From: support Date: Thu, 27 Oct 2022 14:34:00 +0000 (+0000) Subject: Built motion from commit bbec7235.|2.6.20 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=0e18df6e80a9d43af7e027a98d8400c8b9086df1;p=motion2.git Built motion from commit bbec7235.|2.6.20 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 362f09e..da8fcde 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "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-10-25T08:51:37.014Z", + "time": "2022-10-27T14:26:31.596Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2cd8d23..9490509 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "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-10-25T08:51:37.014Z", + "time": "2022-10-27T14:26:31.596Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0549b25..1ceedbc 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index f66562f..79e37a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "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 1c5c9e0..641b96a 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 _0x9fe3=['urlForward[headers],\x20browser[wsindowHeight]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x3178ca,_0x133bc2){var _0x47d0d7=function(_0x4dabeb){while(--_0x4dabeb){_0x3178ca['push'](_0x3178ca['shift']());}};_0x47d0d7(++_0x133bc2);}(_0x9fe3,0x1b1));var _0x39fe=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9fe3[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x39fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x39fe('0x1')],'get':function(_0x161312){return this[_0x39fe('0x2')](_0x39fe('0x3'));}},'action':{'type':Sequelize[_0x39fe('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x39fe('0x5'),_0x39fe('0x6'),_0x39fe('0x7'),_0x39fe('0x8'),'urlForward',_0x39fe('0x9'),'bot',_0x39fe('0xa')]],'msg':_0x39fe('0xb')}},'comment':_0x39fe('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x39fe('0xc')},'data2':{'type':Sequelize[_0x39fe('0x4')](0x1000),'comment':_0x39fe('0xd')},'data3':{'type':Sequelize[_0x39fe('0x4')](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[_0x39fe('0x4')](0x1000),'comments':_0x39fe('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x39fe('0x4')],'comments':_0x39fe('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xbd1d=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xbd1d,0x193));var _0xdbd1=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xbd1d[_0x4a2ba2];return _0x1d09fd;};'use strict';var Sequelize=require(_0xdbd1('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbd1('0x1')],'get':function(_0x327b10){return this[_0xdbd1('0x2')](_0xdbd1('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xdbd1('0x4'),_0xdbd1('0x5'),_0xdbd1('0x6'),_0xdbd1('0x7'),_0xdbd1('0x8'),_0xdbd1('0x9'),_0xdbd1('0xa')]],'msg':_0xdbd1('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xdbd1('0xc')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0xdbd1('0xc')](0x1000),'comment':_0xdbd1('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xdbd1('0xe')},'data4':{'type':Sequelize[_0xdbd1('0xc')](0x1000),'comments':_0xdbd1('0xf')},'data5':{'type':Sequelize[_0xdbd1('0xc')](0x1000),'comments':_0xdbd1('0x10')},'data6':{'type':Sequelize[_0xdbd1('0xc')],'comments':_0xdbd1('0x11')},'data7':{'type':Sequelize[_0xdbd1('0x12')],'comments':_0xdbd1('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d847e07..1bc101b 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 _0x44a3=['apply','reject','update','then','end','sendStatus','stack','name','send','body','Action','find','catch','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range'];(function(_0x34fedc,_0x30255f){var _0xbd34b=function(_0x25b598){while(--_0x25b598){_0x34fedc['push'](_0x34fedc['shift']());}};_0xbd34b(++_0x30255f);}(_0x44a3,0x1da));var _0x344a=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x44a3[_0x3a175b];return _0x9b84fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x344a('0x0'));var jsonpatch=require(_0x344a('0x1'));var rp=require(_0x344a('0x2'));var moment=require(_0x344a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x344a('0x4'));var util=require('util');var path=require(_0x344a('0x5'));var sox=require(_0x344a('0x6'));var csv=require(_0x344a('0x7'));var ejs=require(_0x344a('0x8'));var fs=require('fs');var fs_extra=require(_0x344a('0x9'));var _=require(_0x344a('0xa'));var squel=require(_0x344a('0xb'));var crypto=require(_0x344a('0xc'));var jsforce=require(_0x344a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x344a('0x7'));var querystring=require(_0x344a('0xe'));var Papa=require('papaparse');var Redis=require(_0x344a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x10'));var as=require(_0x344a('0x11'));var hardwareService=require(_0x344a('0x12'));var logger=require(_0x344a('0x13'))(_0x344a('0x14'));var utils=require(_0x344a('0x15'));var config=require(_0x344a('0x16'));var licenseUtil=require(_0x344a('0x17'));var db=require(_0x344a('0x18'))['db'];function respondWithStatusCode(_0x4a7531,_0x2c7d22){_0x2c7d22=_0x2c7d22||0xcc;return function(_0xb87cbd){if(_0xb87cbd){return _0x4a7531['sendStatus'](_0x2c7d22);}return _0x4a7531['status'](_0x2c7d22)['end']();};}function respondWithResult(_0x5abb76,_0x2878cd){_0x2878cd=_0x2878cd||0xc8;return function(_0x4a4290){if(_0x4a4290){return _0x5abb76[_0x344a('0x19')](_0x2878cd)[_0x344a('0x1a')](_0x4a4290);}};}function respondWithFilteredResult(_0x4712ff,_0x87f28b){return function(_0x52509f){if(_0x52509f){var _0x22e8b3=typeof _0x87f28b[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x87f28b['limit']===_0x344a('0x1c');var _0x25c840=_0x52509f[_0x344a('0x1d')];var _0x3c8a8d=_0x22e8b3?0x0:_0x87f28b[_0x344a('0x1b')];var _0x3f5155=_0x22e8b3?_0x52509f[_0x344a('0x1d')]:_0x87f28b[_0x344a('0x1b')]+_0x87f28b['limit'];var _0x16b509;if(_0x3f5155>=_0x25c840){_0x3f5155=_0x25c840;_0x16b509=0xc8;}else{_0x16b509=0xce;}_0x4712ff['status'](_0x16b509);return _0x4712ff[_0x344a('0x1e')](_0x344a('0x1f'),_0x3c8a8d+'-'+_0x3f5155+'/'+_0x25c840)['json'](_0x52509f);}return null;};}function patchUpdates(_0x43fda4){return function(_0x482446){try{jsonpatch[_0x344a('0x20')](_0x482446,_0x43fda4,!![]);}catch(_0x1c9087){return BPromise[_0x344a('0x21')](_0x1c9087);}return _0x482446['save']();};}function saveUpdates(_0x44c9ed,_0x27c1f3){return function(_0x481cee){if(_0x481cee){return _0x481cee[_0x344a('0x22')](_0x44c9ed)['then'](function(_0x1cda8f){return _0x1cda8f;});}return null;};}function removeEntity(_0x228e58,_0x1a4aa3){return function(_0xbb9e5c){if(_0xbb9e5c){return _0xbb9e5c['destroy']()[_0x344a('0x23')](function(){_0x228e58[_0x344a('0x19')](0xcc)[_0x344a('0x24')]();});}};}function handleEntityNotFound(_0x23cd58,_0x39d12a){return function(_0x58de39){if(!_0x58de39){_0x23cd58[_0x344a('0x25')](0x194);}return _0x58de39;};}function handleError(_0xcafa41,_0x433fd6){_0x433fd6=_0x433fd6||0x1f4;return function(_0x34f1a4){logger['error'](_0x34f1a4[_0x344a('0x26')]);if(_0x34f1a4[_0x344a('0x27')]){delete _0x34f1a4[_0x344a('0x27')];}_0xcafa41[_0x344a('0x19')](_0x433fd6)[_0x344a('0x28')](_0x34f1a4);};}exports[_0x344a('0x22')]=function(_0x4fd65d,_0xbf09be){if(_0x4fd65d[_0x344a('0x29')]['id']){delete _0x4fd65d[_0x344a('0x29')]['id'];}return db[_0x344a('0x2a')][_0x344a('0x2b')]({'where':{'id':_0x4fd65d['params']['id']}})[_0x344a('0x23')](handleEntityNotFound(_0xbf09be,null))['then'](saveUpdates(_0x4fd65d['body'],null))[_0x344a('0x23')](respondWithResult(_0xbf09be,null))[_0x344a('0x2c')](handleError(_0xbf09be,null));};exports[_0x344a('0x2d')]=function(_0x21b858,_0x22b7a0){return db['Action'][_0x344a('0x2b')]({'where':{'id':_0x21b858['params']['id']}})[_0x344a('0x23')](handleEntityNotFound(_0x22b7a0,null))[_0x344a('0x23')](removeEntity(_0x22b7a0,null))[_0x344a('0x2c')](handleError(_0x22b7a0,null));}; \ No newline at end of file +var _0x626c=['mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','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','update','then','destroy','error','stack','name','send','body','Action','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x626c,0x1bc));var _0xc626=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x626c[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0xc626('0x0'));var rimraf=require(_0xc626('0x1'));var zipdir=require(_0xc626('0x2'));var jsonpatch=require(_0xc626('0x3'));var rp=require('request-promise');var moment=require(_0xc626('0x4'));var BPromise=require(_0xc626('0x5'));var Mustache=require(_0xc626('0x6'));var util=require(_0xc626('0x7'));var path=require(_0xc626('0x8'));var sox=require(_0xc626('0x9'));var csv=require(_0xc626('0xa'));var ejs=require(_0xc626('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc626('0xc'));var crypto=require(_0xc626('0xd'));var jsforce=require(_0xc626('0xe'));var deskjs=require(_0xc626('0xf'));var toCsv=require(_0xc626('0xa'));var querystring=require(_0xc626('0x10'));var Papa=require(_0xc626('0x11'));var Redis=require(_0xc626('0x12'));var authService=require(_0xc626('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc626('0x14'));var logger=require(_0xc626('0x15'))(_0xc626('0x16'));var utils=require(_0xc626('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc626('0x18'));var db=require(_0xc626('0x19'))['db'];function respondWithStatusCode(_0x25db9c,_0x32bcf6){_0x32bcf6=_0x32bcf6||0xcc;return function(_0x311d47){if(_0x311d47){return _0x25db9c[_0xc626('0x1a')](_0x32bcf6);}return _0x25db9c['status'](_0x32bcf6)[_0xc626('0x1b')]();};}function respondWithResult(_0x52548f,_0x2b53c3){_0x2b53c3=_0x2b53c3||0xc8;return function(_0x111d28){if(_0x111d28){return _0x52548f['status'](_0x2b53c3)[_0xc626('0x1c')](_0x111d28);}};}function respondWithFilteredResult(_0xccc2bd,_0x3c617c){return function(_0x1f3e7a){if(_0x1f3e7a){var _0xc2cdcf=typeof _0x3c617c[_0xc626('0x1d')]===_0xc626('0x1e')&&typeof _0x3c617c[_0xc626('0x1f')]==='undefined';var _0x31e835=_0x1f3e7a[_0xc626('0x20')];var _0x4b4546=_0xc2cdcf?0x0:_0x3c617c['offset'];var _0x25baa9=_0xc2cdcf?_0x1f3e7a[_0xc626('0x20')]:_0x3c617c[_0xc626('0x1d')]+_0x3c617c[_0xc626('0x1f')];var _0x743b4;if(_0x25baa9>=_0x31e835){_0x25baa9=_0x31e835;_0x743b4=0xc8;}else{_0x743b4=0xce;}_0xccc2bd[_0xc626('0x21')](_0x743b4);return _0xccc2bd['set'](_0xc626('0x22'),_0x4b4546+'-'+_0x25baa9+'/'+_0x31e835)['json'](_0x1f3e7a);}return null;};}function patchUpdates(_0x3a6997){return function(_0x4043e9){try{jsonpatch[_0xc626('0x23')](_0x4043e9,_0x3a6997,!![]);}catch(_0x1c6cf4){return BPromise[_0xc626('0x24')](_0x1c6cf4);}return _0x4043e9[_0xc626('0x25')]();};}function saveUpdates(_0xe940fa,_0xf32b14){return function(_0x19540f){if(_0x19540f){return _0x19540f[_0xc626('0x26')](_0xe940fa)[_0xc626('0x27')](function(_0x221330){return _0x221330;});}return null;};}function removeEntity(_0x4c864b,_0x9f6d06){return function(_0x170ad8){if(_0x170ad8){return _0x170ad8[_0xc626('0x28')]()[_0xc626('0x27')](function(){_0x4c864b[_0xc626('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8b7f,_0x2244b0){return function(_0x4e4ea3){if(!_0x4e4ea3){_0x3a8b7f['sendStatus'](0x194);}return _0x4e4ea3;};}function handleError(_0x2cea5c,_0xec891e){_0xec891e=_0xec891e||0x1f4;return function(_0x145e49){logger[_0xc626('0x29')](_0x145e49[_0xc626('0x2a')]);if(_0x145e49[_0xc626('0x2b')]){delete _0x145e49[_0xc626('0x2b')];}_0x2cea5c[_0xc626('0x21')](_0xec891e)[_0xc626('0x2c')](_0x145e49);};}exports[_0xc626('0x26')]=function(_0x20521c,_0x1be5b8){if(_0x20521c['body']['id']){delete _0x20521c[_0xc626('0x2d')]['id'];}return db[_0xc626('0x2e')]['find']({'where':{'id':_0x20521c[_0xc626('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1be5b8,null))[_0xc626('0x27')](saveUpdates(_0x20521c[_0xc626('0x2d')],null))[_0xc626('0x27')](respondWithResult(_0x1be5b8,null))[_0xc626('0x30')](handleError(_0x1be5b8,null));};exports['destroy']=function(_0x2845f8,_0x56c935){return db[_0xc626('0x2e')][_0xc626('0x31')]({'where':{'id':_0x2845f8[_0xc626('0x2f')]['id']}})[_0xc626('0x27')](handleEntityNotFound(_0x56c935,null))[_0xc626('0x27')](removeEntity(_0x56c935,null))[_0xc626('0x30')](handleError(_0x56c935,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 57a929d..5ed425d 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 _0x1cff=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','tools_actions'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x1cff,0x1cc));var _0xf1cf=function(_0x27c582,_0x6652de){_0x27c582=_0x27c582-0x0;var _0x24b4e7=_0x1cff[_0x27c582];return _0x24b4e7;};'use strict';var _=require(_0xf1cf('0x0'));var util=require('util');var logger=require(_0xf1cf('0x1'))('api');var moment=require(_0xf1cf('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1cf('0x3'));var fs=require('fs');var path=require(_0xf1cf('0x4'));var rimraf=require(_0xf1cf('0x5'));var config=require(_0xf1cf('0x6'));var attributes=require('./action.attributes');module[_0xf1cf('0x7')]=function(_0x4ee429,_0x44e83f){return _0x4ee429[_0xf1cf('0x8')]('Action',attributes,{'tableName':_0xf1cf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0227=['exports','define','Action','tools_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3c2e6c,_0x3c88da){var _0x5bf29e=function(_0x381948){while(--_0x381948){_0x3c2e6c['push'](_0x3c2e6c['shift']());}};_0x5bf29e(++_0x3c88da);}(_0x0227,0xe8));var _0x7022=function(_0x43f494,_0x5d5e9f){_0x43f494=_0x43f494-0x0;var _0x2ce562=_0x0227[_0x43f494];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x7022('0x0'));var logger=require(_0x7022('0x1'))(_0x7022('0x2'));var moment=require(_0x7022('0x3'));var BPromise=require(_0x7022('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7022('0x5'));var rimraf=require(_0x7022('0x6'));var config=require(_0x7022('0x7'));var attributes=require('./action.attributes');module[_0x7022('0x8')]=function(_0x4f26e2,_0x1a5800){return _0x4f26e2[_0x7022('0x9')](_0x7022('0xa'),attributes,{'tableName':_0x7022('0xb'),'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 130af9c..71f7f84 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xa0b359,_0x3ef1bd){var _0x11f480=function(_0x5f0706){while(--_0x5f0706){_0xa0b359['push'](_0xa0b359['shift']());}};_0x11f480(++_0x3ef1bd);}(_0x1261,0x144));var _0x1126=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0x1261[_0x5b5947];return _0x7623e0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xcfc5fa,_0x57e383){var _0x11926a=function(_0x263281){while(--_0x263281){_0xcfc5fa['push'](_0xcfc5fa['shift']());}};_0x11926a(++_0x57e383);}(_0x1261,0x144));var _0x1126=function(_0x2aa83a,_0x4b5c0b){_0x2aa83a=_0x2aa83a-0x0;var _0x36a653=_0x1261[_0x2aa83a];return _0x36a653;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 232bb6f..b1614c6 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 _0x4798=['/:id','isAuthenticated','update','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','put'];(function(_0x215788,_0x5d430c){var _0x1dacb9=function(_0x417e22){while(--_0x417e22){_0x215788['push'](_0x215788['shift']());}};_0x1dacb9(++_0x5d430c);}(_0x4798,0x118));var _0x8479=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0x4798[_0x5562fe];return _0x1829c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8479('0x0'));var timeout=require('connect-timeout');var express=require(_0x8479('0x1'));var router=express[_0x8479('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8479('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8479('0x4'));var controller=require('./action.controller');router[_0x8479('0x5')](_0x8479('0x6'),auth[_0x8479('0x7')](),controller[_0x8479('0x8')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8479('0x9')]);module[_0x8479('0xa')]=router; \ No newline at end of file +var _0xbb3f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x1515c9,_0x3db945){var _0x3e9c59=function(_0x56ef9f){while(--_0x56ef9f){_0x1515c9['push'](_0x1515c9['shift']());}};_0x3e9c59(++_0x3db945);}(_0xbb3f,0xcf));var _0xfbb3=function(_0x2b1d7e,_0x32f2ff){_0x2b1d7e=_0x2b1d7e-0x0;var _0xecbf53=_0xbb3f[_0x2b1d7e];return _0xecbf53;};'use strict';var multer=require(_0xfbb3('0x0'));var util=require('util');var path=require(_0xfbb3('0x1'));var timeout=require(_0xfbb3('0x2'));var express=require('express');var router=express[_0xfbb3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfbb3('0x4'));var interaction=require(_0xfbb3('0x5'));var config=require(_0xfbb3('0x6'));var controller=require(_0xfbb3('0x7'));router[_0xfbb3('0x8')]('/:id',auth[_0xfbb3('0x9')](),controller[_0xfbb3('0xa')]);router['delete'](_0xfbb3('0xb'),auth[_0xfbb3('0x9')](),controller[_0xfbb3('0xc')]);module[_0xfbb3('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 3dc5908..08c457d 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x5fd1,0x155));var _0x15fd=function(_0x7c7843,_0x2f5468){_0x7c7843=_0x7c7843-0x0;var _0x393bc0=_0x5fd1[_0x7c7843];return _0x393bc0;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x58c984,_0x4a4dcf){var _0x9b3b5e=function(_0x59870b){while(--_0x59870b){_0x58c984['push'](_0x58c984['shift']());}};_0x9b3b5e(++_0x4a4dcf);}(_0x53ec,0x192));var _0xc53e=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0x53ec[_0x3c414c];return _0x4f3062;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 26f0f64..d037e5b 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 _0x4ab6=['SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','DESC','alias','joins','parse','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','findAll','foreignTable','clone','web','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','run','runReport','MIN(%s)','value','metric','orderBy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','UserProfileResource','then','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0x4ab6,0x1a6));var _0x64ab=function(_0x45e5f2,_0xc803d0){_0x45e5f2=_0x45e5f2-0x0;var _0x333b0a=_0x4ab6[_0x45e5f2];return _0x333b0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64ab('0x1'));var rp=require('request-promise');var moment=require(_0x64ab('0x2'));var BPromise=require(_0x64ab('0x3'));var Mustache=require(_0x64ab('0x4'));var util=require(_0x64ab('0x5'));var path=require(_0x64ab('0x6'));var sox=require(_0x64ab('0x7'));var csv=require(_0x64ab('0x8'));var ejs=require(_0x64ab('0x9'));var fs=require('fs');var fs_extra=require(_0x64ab('0xa'));var _=require(_0x64ab('0xb'));var squel=require(_0x64ab('0xc'));var crypto=require(_0x64ab('0xd'));var jsforce=require(_0x64ab('0xe'));var deskjs=require(_0x64ab('0xf'));var toCsv=require(_0x64ab('0x8'));var querystring=require(_0x64ab('0x10'));var Papa=require(_0x64ab('0x11'));var Redis=require(_0x64ab('0x12'));var authService=require(_0x64ab('0x13'));var qs=require(_0x64ab('0x14'));var as=require(_0x64ab('0x15'));var hardwareService=require(_0x64ab('0x16'));var logger=require('../../config/logger')(_0x64ab('0x17'));var utils=require(_0x64ab('0x18'));var config=require(_0x64ab('0x19'));var licenseUtil=require(_0x64ab('0x1a'));var db=require(_0x64ab('0x1b'))['db'];var dbH=require('../../mysqldb')[_0x64ab('0x1c')];function respondWithStatusCode(_0x85fa6f,_0x54c906){_0x54c906=_0x54c906||0xcc;return function(_0x2e1935){if(_0x2e1935){return _0x85fa6f[_0x64ab('0x1d')](_0x54c906);}return _0x85fa6f['status'](_0x54c906)[_0x64ab('0x1e')]();};}function respondWithResult(_0x57933d,_0x264f2a){_0x264f2a=_0x264f2a||0xc8;return function(_0x4d7717){if(_0x4d7717){return _0x57933d[_0x64ab('0x1f')](_0x264f2a)[_0x64ab('0x20')](_0x4d7717);}};}function respondWithFilteredResult(_0x190df8,_0x1deae8){return function(_0x6595dc){if(_0x6595dc){var _0x521e30=typeof _0x1deae8[_0x64ab('0x21')]===_0x64ab('0x22')&&typeof _0x1deae8[_0x64ab('0x23')]===_0x64ab('0x22');var _0x150cac=_0x6595dc[_0x64ab('0x24')];var _0x5017e6=_0x521e30?0x0:_0x1deae8[_0x64ab('0x21')];var _0x361291=_0x521e30?_0x6595dc[_0x64ab('0x24')]:_0x1deae8['offset']+_0x1deae8[_0x64ab('0x23')];var _0x3d0432;if(_0x361291>=_0x150cac){_0x361291=_0x150cac;_0x3d0432=0xc8;}else{_0x3d0432=0xce;}_0x190df8['status'](_0x3d0432);return _0x190df8[_0x64ab('0x25')](_0x64ab('0x26'),_0x5017e6+'-'+_0x361291+'/'+_0x150cac)[_0x64ab('0x20')](_0x6595dc);}return null;};}function patchUpdates(_0x31818a){return function(_0x39039d){try{jsonpatch[_0x64ab('0x27')](_0x39039d,_0x31818a,!![]);}catch(_0x402d49){return BPromise['reject'](_0x402d49);}return _0x39039d['save']();};}function saveUpdates(_0x1c8186,_0x5af5f9){return function(_0x3b08e3){if(_0x3b08e3){return _0x3b08e3[_0x64ab('0x28')](_0x1c8186)['then'](function(_0x5c136b){return _0x5c136b;});}return null;};}function removeEntity(_0x4a18d1,_0x404c7a){return function(_0x423377){if(_0x423377){return _0x423377[_0x64ab('0x29')]()['then'](function(){var _0x45099f=_0x423377[_0x64ab('0x2a')]({'plain':!![]});var _0x548716='CustomReports';return db[_0x64ab('0x2b')][_0x64ab('0x29')]({'where':{'type':_0x548716,'resourceId':_0x45099f['id']}})[_0x64ab('0x2c')](function(){return _0x423377;});})[_0x64ab('0x2c')](function(){_0x4a18d1[_0x64ab('0x1f')](0xcc)[_0x64ab('0x1e')]();});}};}function handleEntityNotFound(_0x521cf6,_0x66604e){return function(_0x4e482e){if(!_0x4e482e){_0x521cf6['sendStatus'](0x194);}return _0x4e482e;};}function handleError(_0x255208,_0x175345){_0x175345=_0x175345||0x1f4;return function(_0x38be4e){logger['error'](_0x38be4e[_0x64ab('0x2d')]);if(_0x38be4e[_0x64ab('0x2e')]){delete _0x38be4e[_0x64ab('0x2e')];}_0x255208[_0x64ab('0x1f')](_0x175345)[_0x64ab('0x2f')](_0x38be4e);};}exports[_0x64ab('0x30')]=function(_0x4d0d7f,_0x35f722){var _0x5a5aae={},_0x1abe00={},_0x10998c={'count':0x0,'rows':[]};var _0x2f76c0=_['map'](db[_0x64ab('0x31')][_0x64ab('0x32')],function(_0x2d54c5){return{'name':_0x2d54c5[_0x64ab('0x33')],'type':_0x2d54c5[_0x64ab('0x34')][_0x64ab('0x35')]};});_0x1abe00[_0x64ab('0x36')]=_[_0x64ab('0x37')](_0x2f76c0,_0x64ab('0x2e'));_0x1abe00[_0x64ab('0x38')]=_['keys'](_0x4d0d7f['query']);_0x1abe00['filters']=_[_0x64ab('0x39')](_0x1abe00['model'],_0x1abe00[_0x64ab('0x38')]);_0x5a5aae['attributes']=_[_0x64ab('0x39')](_0x1abe00[_0x64ab('0x36')],qs[_0x64ab('0x3a')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x3a')]));_0x5a5aae['attributes']=_0x5a5aae[_0x64ab('0x3b')]['length']?_0x5a5aae[_0x64ab('0x3b')]:_0x1abe00[_0x64ab('0x36')];if(!_0x4d0d7f['query'][_0x64ab('0x3c')](_0x64ab('0x3d'))){_0x5a5aae[_0x64ab('0x23')]=qs[_0x64ab('0x23')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x23')]);_0x5a5aae[_0x64ab('0x21')]=qs[_0x64ab('0x21')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x21')]);}_0x5a5aae[_0x64ab('0x3e')]=qs[_0x64ab('0x3f')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x3f')]);_0x5a5aae[_0x64ab('0x40')]=qs[_0x64ab('0x41')](_[_0x64ab('0x42')](_0x4d0d7f[_0x64ab('0x38')],_0x1abe00['filters']),_0x2f76c0);if(_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x43')]){_0x5a5aae['where']=_[_0x64ab('0x44')](_0x5a5aae[_0x64ab('0x40')],{'$or':_[_0x64ab('0x37')](_0x2f76c0,function(_0x136ce4){if(_0x136ce4['type']!==_0x64ab('0x45')){var _0x3c9357={};_0x3c9357[_0x136ce4[_0x64ab('0x2e')]]={'$like':'%'+_0x4d0d7f['query'][_0x64ab('0x43')]+'%'};return _0x3c9357;}})});}_0x5a5aae=_[_0x64ab('0x44')]({},_0x5a5aae,_0x4d0d7f[_0x64ab('0x46')]);var _0x74b431={'where':_0x5a5aae['where']};return db[_0x64ab('0x31')]['count'](_0x74b431)[_0x64ab('0x2c')](function(_0x1d2a75){_0x10998c[_0x64ab('0x24')]=_0x1d2a75;if(_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x47')]){_0x5a5aae[_0x64ab('0x48')]=[{'all':!![]}];}return db[_0x64ab('0x31')]['findAll'](_0x5a5aae);})[_0x64ab('0x2c')](function(_0x123f98){_0x10998c[_0x64ab('0x49')]=_0x123f98;return _0x10998c;})[_0x64ab('0x2c')](respondWithFilteredResult(_0x35f722,_0x5a5aae))['catch'](handleError(_0x35f722,null));};exports[_0x64ab('0x4a')]=function(_0x10406c,_0x547329){var _0x52f9d0={'raw':![],'where':{'id':_0x10406c[_0x64ab('0x4b')]['id']}},_0x4a27e9={};_0x4a27e9[_0x64ab('0x36')]=_[_0x64ab('0x4c')](db['AnalyticCustomReport']['rawAttributes']);_0x4a27e9[_0x64ab('0x38')]=_[_0x64ab('0x4c')](_0x10406c['query']);_0x4a27e9[_0x64ab('0x41')]=_[_0x64ab('0x39')](_0x4a27e9[_0x64ab('0x36')],_0x4a27e9['query']);_0x52f9d0[_0x64ab('0x3b')]=_[_0x64ab('0x39')](_0x4a27e9[_0x64ab('0x36')],qs[_0x64ab('0x3a')](_0x10406c['query']['fields']));_0x52f9d0[_0x64ab('0x3b')]=_0x52f9d0[_0x64ab('0x3b')][_0x64ab('0x4d')]?_0x52f9d0[_0x64ab('0x3b')]:_0x4a27e9[_0x64ab('0x36')];if(_0x10406c[_0x64ab('0x38')][_0x64ab('0x47')]){_0x52f9d0[_0x64ab('0x48')]=[{'all':!![]}];}_0x52f9d0=_[_0x64ab('0x44')]({},_0x52f9d0,_0x10406c[_0x64ab('0x46')]);return db[_0x64ab('0x31')][_0x64ab('0x4e')](_0x52f9d0)['then'](handleEntityNotFound(_0x547329,null))[_0x64ab('0x2c')](respondWithResult(_0x547329,null))[_0x64ab('0x4f')](handleError(_0x547329,null));};exports[_0x64ab('0x50')]=function(_0x294e4e,_0x357229){return db[_0x64ab('0x31')][_0x64ab('0x50')](_0x294e4e['body'],{})['then'](function(_0x25ecde){var _0x37a4da=_0x294e4e[_0x64ab('0x51')][_0x64ab('0x2a')]({'plain':!![]});if(!_0x37a4da)throw new Error(_0x64ab('0x52'));if(_0x37a4da[_0x64ab('0x53')]==='user'){var _0x5447d8=_0x25ecde['get']({'plain':!![]});var _0x2fa4ab=_0x64ab('0x54');return db[_0x64ab('0x55')][_0x64ab('0x4e')]({'where':{'name':_0x2fa4ab,'userProfileId':_0x37a4da[_0x64ab('0x56')]},'raw':!![]})[_0x64ab('0x2c')](function(_0x55f9fe){if(_0x55f9fe&&_0x55f9fe[_0x64ab('0x57')]===0x0){return db[_0x64ab('0x2b')][_0x64ab('0x50')]({'name':_0x5447d8['name'],'resourceId':_0x5447d8['id'],'type':_0x64ab('0x58'),'sectionId':_0x55f9fe['id']},{})[_0x64ab('0x2c')](function(){return _0x25ecde;});}else{return _0x25ecde;}})[_0x64ab('0x4f')](function(_0x1a6bb8){logger[_0x64ab('0x59')](_0x64ab('0x5a'),_0x1a6bb8);throw _0x1a6bb8;});}return _0x25ecde;})[_0x64ab('0x2c')](respondWithResult(_0x357229,0xc9))[_0x64ab('0x4f')](handleError(_0x357229,null));};exports[_0x64ab('0x28')]=function(_0x376141,_0x974f18){if(_0x376141[_0x64ab('0x5b')]['id']){delete _0x376141[_0x64ab('0x5b')]['id'];}return db['AnalyticCustomReport'][_0x64ab('0x4e')]({'where':{'id':_0x376141['params']['id']}})[_0x64ab('0x2c')](handleEntityNotFound(_0x974f18,null))['then'](saveUpdates(_0x376141[_0x64ab('0x5b')],null))['then'](respondWithResult(_0x974f18,null))[_0x64ab('0x4f')](handleError(_0x974f18,null));};exports['destroy']=function(_0x328373,_0x2ba652){return db[_0x64ab('0x31')][_0x64ab('0x4e')]({'where':{'id':_0x328373['params']['id']}})[_0x64ab('0x2c')](handleEntityNotFound(_0x2ba652,null))['then'](removeEntity(_0x2ba652,null))[_0x64ab('0x4f')](handleError(_0x2ba652,null));};exports[_0x64ab('0x5c')]=function(_0x524e80,_0x3fb356){var _0x40e5e7=0xa;var _0xb5d628=[_0x64ab('0x5d'),_0x64ab('0x5e'),_0x64ab('0x5f'),_0x64ab('0x60')];var _0x5715c5={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':_0x64ab('0x63'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x64ab('0x64'),'GROUP_CONCAT':_0x64ab('0x65'),'GROUP_CONCAT ASC':_0x64ab('0x66'),'GROUP_CONCAT DESC':_0x64ab('0x67')};var _0xa60754={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0x297450=function(_0xe9ee98){return!_[_0x64ab('0x6b')]([_0x64ab('0x6c'),'IS\x20NOT\x20NULL',_0x64ab('0x6d'),'IS\x20NOT\x20EMPTY'],_0xe9ee98);};var _0x3d5fc8=function(_0x4af6a5){if(!_0x4af6a5||!_0x4af6a5[_0x64ab('0x6e')][_0x64ab('0x4d')]){return'';}for(var _0x5a5997='(',_0x1265da=0x0;_0x1265da<_0x4af6a5[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x1265da+=0x1){_0x1265da>0x0&&(_0x5a5997+='\x20'+_0x4af6a5[_0x64ab('0x6f')]+'\x20');_0x5a5997+=_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x70')]?_0x3d5fc8(_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x70')]):_0x4af6a5[_0x64ab('0x6e')][_0x1265da]['field']+'\x20'+_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x71')]+(_0x297450(_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x71')])?'\x20'+_0x4af6a5[_0x64ab('0x6e')][_0x1265da]['value']:'');}return _0x5a5997+')';};var _0x12a5cc={'where':{'id':_0x524e80[_0x64ab('0x4b')]['id']}},_0x19a315,_0x57ecab,_0x53bc5c,_0x2117d5,_0xe4db05;_0x12a5cc=_[_0x64ab('0x44')]({},_0x12a5cc,_0x524e80['options']);return db[_0x64ab('0x31')]['find'](_0x12a5cc)[_0x64ab('0x2c')](function(_0x8ce62f){if(_0x8ce62f){_0x19a315=_0x8ce62f;return _0x8ce62f[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x5dfa84){if(_0x5dfa84){if(!_0x5dfa84[_0x64ab('0x4d')]){throw new db[(_0x64ab('0x73'))][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x57ecab=_0x5dfa84;return db[_0x64ab('0x76')]['findAll']({'raw':!![]});}return null;})[_0x64ab('0x2c')](function(_0x19d8b9){if(_0x19d8b9){_0x53bc5c=_[_0x64ab('0x77')](_0x19d8b9,'id');var _0x34f84e;var _0x3ec6cb=squel[_0x64ab('0x78')]();_0x3ec6cb[_0x64ab('0x79')](_0x19a315[_0x64ab('0x7a')]);for(var _0x431ba8=0x0;_0x431ba8<_0x57ecab['length'];_0x431ba8+=0x1){_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7b')]?_0x53bc5c[_0x57ecab[_0x431ba8][_0x64ab('0x7b')]]['metric']:_0x57ecab[_0x431ba8][_0x64ab('0x7c')];_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7d')]?_[_0x64ab('0x7e')](_0x5715c5[_0x57ecab[_0x431ba8][_0x64ab('0x7d')]],'%s',_0x34f84e):_0x34f84e;_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7f')]?_[_0x64ab('0x7e')](_0xa60754[_0x57ecab[_0x431ba8][_0x64ab('0x7f')]],'%s',_0x34f84e):_0x34f84e;if(_0x57ecab[_0x431ba8][_0x64ab('0x80')]){_0x3ec6cb[_0x64ab('0x70')](_0x34f84e);}_0x57ecab[_0x431ba8]['orderBy']&&_0x3ec6cb[_0x64ab('0x3e')](_0x34f84e,_0x57ecab[_0x431ba8]['orderBy']===_0x64ab('0x81')?![]:!![]);_0x3ec6cb['field'](_0x34f84e,_0x57ecab[_0x431ba8][_0x64ab('0x82')]||_0x34f84e);}if(_0x19a315[_0x64ab('0x83')]){_0x19a315['joins']=JSON[_0x64ab('0x84')](_0x19a315[_0x64ab('0x83')]);for(var _0x188b70=0x0;_0x188b70<_0x19a315['joins'][_0x64ab('0x4d')];_0x188b70+=0x1){if(_0x19a315[_0x64ab('0x83')][_0x188b70]['type']&&_[_0x64ab('0x6b')](_0xb5d628,_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x34')])&&_0x19a315[_0x64ab('0x83')][_0x188b70]['parentKey']&&_0x19a315[_0x64ab('0x83')][_0x188b70]['foreignTable']&&_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x85')]){_0x3ec6cb[_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x34')]](_0x19a315['joins'][_0x188b70]['foreignTable'],null,util[_0x64ab('0x7f')](_0x64ab('0x86'),_0x19a315[_0x64ab('0x7a')],_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x87')],_0x19a315[_0x64ab('0x83')][_0x188b70]['foreignTable'],_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x85')]));}}}if(_0x19a315[_0x64ab('0x88')]){_0x19a315[_0x64ab('0x88')]=JSON[_0x64ab('0x84')](_0x19a315[_0x64ab('0x88')]);_0x3ec6cb[_0x64ab('0x40')](_0x3d5fc8(_0x19a315[_0x64ab('0x88')]['group']));}_0xe4db05=_0x3ec6cb['clone']();_0x3ec6cb[_0x64ab('0x23')](_0x40e5e7);_0x3ec6cb[_0x64ab('0x21')](0x0);logger[_0x64ab('0x89')](_0x64ab('0x8a'),_0x3ec6cb[_0x64ab('0x8b')]());return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x3ec6cb[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')][_0x64ab('0x8d')][_0x64ab('0x8e')]});}})['then'](respondWithResult(_0x3fb356,null))[_0x64ab('0x4f')](handleError(_0x3fb356,null));};function runReport(_0xa24846,_0x3ab896,_0x4e7ef6){var _0x278038=_0x3ab896['name'];var _0x401f82=0xa;var _0x34c282=[_0x64ab('0x5d'),_0x64ab('0x5e'),'right_join','cross_join'];var _0x2eaf65={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x64ab('0x8f'),'MIN':'MIN(%s)','AVG':_0x64ab('0x64'),'GROUP_CONCAT':_0x64ab('0x65'),'GROUP_CONCAT ASC':_0x64ab('0x66'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x13f72c={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':_0x64ab('0x90'),'HOUR':_0x64ab('0x91'),'ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0x558d65=function(_0x3fe0c9){return!_[_0x64ab('0x6b')]([_0x64ab('0x6c'),_0x64ab('0x92'),_0x64ab('0x6d'),_0x64ab('0x93')],_0x3fe0c9);};var _0x2ba1f1=function(_0x169aee){if(!_0x169aee||!_0x169aee[_0x64ab('0x6e')]['length']){return'';}for(var _0x1c98c='(',_0x493bba=0x0;_0x493bba<_0x169aee[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x493bba+=0x1){_0x493bba>0x0&&(_0x1c98c+='\x20'+_0x169aee['operator']+'\x20');_0x1c98c+=_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x70')]?_0x2ba1f1(_0x169aee['rules'][_0x493bba]['group']):_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x7c')]+'\x20'+_0x169aee[_0x64ab('0x6e')][_0x493bba]['condition']+(_0x558d65(_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x71')])?'\x20'+_0x169aee[_0x64ab('0x6e')][_0x493bba]['value']:'');}return _0x1c98c+')';};var _0x352e7d={'where':{'id':_0xa24846['id']}},_0x2bec14,_0x131fd6,_0x5e7e3e,_0x3914c8,_0x1e433a;_0x352e7d=_[_0x64ab('0x44')]({},_0x352e7d,_0x4e7ef6);return db[_0x64ab('0x31')][_0x64ab('0x4e')](_0x352e7d)[_0x64ab('0x2c')](function(_0xf41e62){if(_0xf41e62){_0x2bec14=_0xf41e62;return _0xf41e62[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x4a40af){if(_0x4a40af){if(!_0x4a40af[_0x64ab('0x4d')]){throw new db['Sequelize'][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x131fd6=_0x4a40af;return db[_0x64ab('0x76')][_0x64ab('0x94')]({'raw':!![]});}return null;})['then'](function(_0x663822){if(_0x663822){_0x5e7e3e=_[_0x64ab('0x77')](_0x663822,'id');var _0x4286c7;var _0x5b13d7=squel[_0x64ab('0x78')]();_0x5b13d7['from'](_0x2bec14[_0x64ab('0x7a')]);for(var _0x117bde=0x0;_0x117bde<_0x131fd6['length'];_0x117bde+=0x1){_0x4286c7=_0x131fd6[_0x117bde]['MetricId']?_0x5e7e3e[_0x131fd6[_0x117bde][_0x64ab('0x7b')]]['metric']:_0x131fd6[_0x117bde][_0x64ab('0x7c')];_0x4286c7=_0x131fd6[_0x117bde][_0x64ab('0x7d')]?_['replace'](_0x2eaf65[_0x131fd6[_0x117bde][_0x64ab('0x7d')]],'%s',_0x4286c7):_0x4286c7;_0x4286c7=_0x131fd6[_0x117bde][_0x64ab('0x7f')]?_['replace'](_0x13f72c[_0x131fd6[_0x117bde][_0x64ab('0x7f')]],'%s',_0x4286c7):_0x4286c7;if(_0x131fd6[_0x117bde][_0x64ab('0x80')]){_0x5b13d7[_0x64ab('0x70')](_0x4286c7);}_0x131fd6[_0x117bde]['orderBy']&&_0x5b13d7[_0x64ab('0x3e')](_0x4286c7,_0x131fd6[_0x117bde]['orderBy']===_0x64ab('0x81')?![]:!![]);_0x5b13d7[_0x64ab('0x7c')](_0x4286c7,_0x131fd6[_0x117bde][_0x64ab('0x82')]||_0x4286c7);}if(_0x2bec14[_0x64ab('0x83')]){_0x2bec14[_0x64ab('0x83')]=JSON[_0x64ab('0x84')](_0x2bec14[_0x64ab('0x83')]);for(var _0x85ba68=0x0;_0x85ba68<_0x2bec14[_0x64ab('0x83')][_0x64ab('0x4d')];_0x85ba68+=0x1){if(_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')]&&_[_0x64ab('0x6b')](_0x34c282,_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')])&&_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x87')]&&_0x2bec14[_0x64ab('0x83')][_0x85ba68]['foreignTable']&&_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x85')]){_0x5b13d7[_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')]](_0x2bec14['joins'][_0x85ba68]['foreignTable'],null,util[_0x64ab('0x7f')](_0x64ab('0x86'),_0x2bec14[_0x64ab('0x7a')],_0x2bec14['joins'][_0x85ba68]['parentKey'],_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x95')],_0x2bec14[_0x64ab('0x83')][_0x85ba68]['foreignKey']));}}}if(_0x2bec14[_0x64ab('0x88')]){_0x2bec14['conditions']=JSON[_0x64ab('0x84')](_0x2bec14[_0x64ab('0x88')]);_0x5b13d7['where'](_0x2ba1f1(_0x2bec14['conditions'][_0x64ab('0x70')]));}_0x1e433a=_0x5b13d7[_0x64ab('0x96')]();_0x5b13d7[_0x64ab('0x23')](_0x401f82);_0x5b13d7[_0x64ab('0x21')](0x0);return;}})[_0x64ab('0x2c')](function(){if(_0x3ab896['output']===_0x64ab('0x97')){return null;}var _0x27b94b=_[_0x64ab('0x44')](_0x3ab896,{'name':_0x3ab896[_0x64ab('0x98')]||_0x3ab896['name']||_0x2bec14[_0x64ab('0x2e')],'basename':_0x278038,'savename':util[_0x64ab('0x7f')](_0x64ab('0x99'),_0x3ab896[_0x64ab('0x2e')]||_0x2bec14[_0x64ab('0x2e')],require('randomstring')[_0x64ab('0x9a')](0x4),_0x3ab896[_0x64ab('0x9b')]||_0x64ab('0x9c')),'reportId':_0x2bec14['id'],'reportType':'custom'});return db[_0x64ab('0x9d')]['create'](_0x27b94b,{'raw':!![]});})[_0x64ab('0x2c')](function(_0x148090){if(_0x2bec14[_0x64ab('0x7a')]==='cdr'){_0x1e433a[_0x64ab('0x40')](_0x2bec14[_0x64ab('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3ab896[_0x64ab('0x9e')],_0x3ab896['endDate']);}else{_0x1e433a[_0x64ab('0x40')](_0x2bec14[_0x64ab('0x7a')]+_0x64ab('0x9f'),_0x3ab896[_0x64ab('0x9e')],_0x3ab896[_0x64ab('0xa0')]);}if(_0x148090){logger[_0x64ab('0xa1')](_0x64ab('0xa2'),_0x1e433a[_0x64ab('0x8b')]());require(_0x64ab('0xa3'))[_0x64ab('0xa4')](path['join'](__dirname,_0x64ab('0xa5'),_0x148090[_0x64ab('0x9b')]),[_0x148090['id'],_0x1e433a[_0x64ab('0x8b')](),path[_0x64ab('0x5d')](__dirname,'../../files/reports',_0x148090['savename']),_0x278038]);return _0x148090;}else{var _0x167177=squel[_0x64ab('0x78')]();_0x167177[_0x64ab('0x79')]('('+_0x1e433a[_0x64ab('0x8b')]()+')',_0x64ab('0xa6'));_0x167177['field']('COUNT(*)','count');_0x1e433a['limit'](_0x3ab896['limit']||_0x401f82);_0x1e433a[_0x64ab('0x21')](_0x3ab896[_0x64ab('0x21')]||0x0);return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x167177[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')]['QueryTypes'][_0x64ab('0x8e')]})[_0x64ab('0x2c')](function(_0x2a2230){if(!_0x2a2230[_0x64ab('0x4d')]){_0x3914c8=0x0;}else{_0x3914c8=_0x2a2230[0x0][_0x64ab('0x24')]||0x0;}return dbH[_0x64ab('0x8c')]['query'](_0x1e433a[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')][_0x64ab('0x8d')][_0x64ab('0x8e')]});})[_0x64ab('0x2c')](function(_0x877b4f){return{'rows':_0x877b4f||[],'count':_0x3914c8};});}});}exports[_0x64ab('0xa7')]=function(_0x4b6846,_0x399a32){return runReport(_0x4b6846[_0x64ab('0x4b')],_0x4b6846[_0x64ab('0x38')],_0x4b6846[_0x64ab('0x46')])[_0x64ab('0x2c')](respondWithResult(_0x399a32,null))['catch'](handleError(_0x399a32,null));};exports[_0x64ab('0xa8')]=runReport;exports[_0x64ab('0x38')]=function(_0x5f12f7,_0x262bd3){var _0x4bd492=0xa;var _0x11b0cc=[_0x64ab('0x5d'),_0x64ab('0x5e'),_0x64ab('0x5f'),_0x64ab('0x60')];var _0x6bde46={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':_0x64ab('0x63'),'MAX':'MAX(%s)','MIN':_0x64ab('0xa9'),'AVG':_0x64ab('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x17cbac={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':_0x64ab('0x90'),'HOUR':_0x64ab('0x91'),'ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0xc01f66=function(_0x538efd){return!_['includes'](['IS\x20NULL',_0x64ab('0x92'),_0x64ab('0x6d'),_0x64ab('0x93')],_0x538efd);};var _0x1e6757=function(_0x10e33f){if(!_0x10e33f||!_0x10e33f[_0x64ab('0x6e')][_0x64ab('0x4d')]){return'';}for(var _0x4f255c='(',_0x1390c2=0x0;_0x1390c2<_0x10e33f[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x1390c2+=0x1){_0x1390c2>0x0&&(_0x4f255c+='\x20'+_0x10e33f[_0x64ab('0x6f')]+'\x20');_0x4f255c+=_0x10e33f[_0x64ab('0x6e')][_0x1390c2]['group']?_0x1e6757(_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x70')]):_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x7c')]+'\x20'+_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x71')]+(_0xc01f66(_0x10e33f['rules'][_0x1390c2][_0x64ab('0x71')])?'\x20'+_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0xaa')]:'');}return _0x4f255c+')';};var _0x20c701={'where':{'id':_0x5f12f7[_0x64ab('0x4b')]['id']}},_0x2cff7d,_0x545f42,_0x282f16,_0x5e200b,_0xcf61d7;_0x20c701=_['merge']({},_0x20c701,_0x5f12f7['options']);return db[_0x64ab('0x31')]['find'](_0x20c701)[_0x64ab('0x2c')](function(_0x20649f){if(_0x20649f){_0x2cff7d=_0x20649f;return _0x20649f[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x1e8c8b){if(_0x1e8c8b){if(!_0x1e8c8b[_0x64ab('0x4d')]){throw new db['Sequelize'][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x545f42=_0x1e8c8b;return db[_0x64ab('0x76')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3a07fa){if(_0x3a07fa){_0x282f16=_[_0x64ab('0x77')](_0x3a07fa,'id');var _0x2664ee;var _0x483c05=squel[_0x64ab('0x78')]();_0x483c05['from'](_0x2cff7d[_0x64ab('0x7a')]);for(var _0x5f51e1=0x0;_0x5f51e1<_0x545f42[_0x64ab('0x4d')];_0x5f51e1+=0x1){_0x2664ee=_0x545f42[_0x5f51e1][_0x64ab('0x7b')]?_0x282f16[_0x545f42[_0x5f51e1]['MetricId']][_0x64ab('0xab')]:_0x545f42[_0x5f51e1][_0x64ab('0x7c')];_0x2664ee=_0x545f42[_0x5f51e1]['function']?_[_0x64ab('0x7e')](_0x6bde46[_0x545f42[_0x5f51e1][_0x64ab('0x7d')]],'%s',_0x2664ee):_0x2664ee;_0x2664ee=_0x545f42[_0x5f51e1]['format']?_[_0x64ab('0x7e')](_0x17cbac[_0x545f42[_0x5f51e1][_0x64ab('0x7f')]],'%s',_0x2664ee):_0x2664ee;if(_0x545f42[_0x5f51e1][_0x64ab('0x80')]){_0x483c05['group'](_0x2664ee);}_0x545f42[_0x5f51e1][_0x64ab('0xac')]&&_0x483c05[_0x64ab('0x3e')](_0x2664ee,_0x545f42[_0x5f51e1]['orderBy']==='DESC'?![]:!![]);_0x483c05['field'](_0x2664ee,_0x545f42[_0x5f51e1][_0x64ab('0x82')]||_0x2664ee);}if(_0x2cff7d[_0x64ab('0x83')]){_0x2cff7d[_0x64ab('0x83')]=JSON[_0x64ab('0x84')](_0x2cff7d[_0x64ab('0x83')]);for(var _0x46193b=0x0;_0x46193b<_0x2cff7d['joins'][_0x64ab('0x4d')];_0x46193b+=0x1){if(_0x2cff7d[_0x64ab('0x83')][_0x46193b]['type']&&_[_0x64ab('0x6b')](_0x11b0cc,_0x2cff7d[_0x64ab('0x83')][_0x46193b]['type'])&&_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x87')]&&_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x95')]&&_0x2cff7d['joins'][_0x46193b][_0x64ab('0x85')]){_0x483c05[_0x2cff7d['joins'][_0x46193b]['type']](_0x2cff7d['joins'][_0x46193b][_0x64ab('0x95')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2cff7d['table'],_0x2cff7d['joins'][_0x46193b][_0x64ab('0x87')],_0x2cff7d['joins'][_0x46193b][_0x64ab('0x95')],_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x85')]));}}}if(_0x2cff7d[_0x64ab('0x88')]){_0x2cff7d['conditions']=JSON[_0x64ab('0x84')](_0x2cff7d['conditions']);_0x483c05[_0x64ab('0x40')](_0x1e6757(_0x2cff7d['conditions'][_0x64ab('0x70')]));}_0xcf61d7=_0x483c05[_0x64ab('0x96')]();_0x483c05[_0x64ab('0x23')](_0x4bd492);_0x483c05[_0x64ab('0x21')](0x0);logger[_0x64ab('0x89')]('Limited\x20Query:',_0x483c05[_0x64ab('0x8b')]());return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x483c05[_0x64ab('0x8b')](),{'type':dbH['sequelize'][_0x64ab('0x8d')][_0x64ab('0x8e')]});}})[_0x64ab('0x2c')](function(){return{'sql':_0xcf61d7[_0x64ab('0x8b')]()};})[_0x64ab('0x2c')](respondWithResult(_0x262bd3,null))[_0x64ab('0x4f')](handleError(_0x262bd3,null));}; \ No newline at end of file +var _0x3351=['map','AnalyticCustomReport','rawAttributes','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','includeAll','findAll','rows','catch','params','intersection','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','IS\x20NOT\x20NULL','condition','ValidationErrorItem','metric','output','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','select','COUNT(*)','runReport','operator','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','send','index'];(function(_0xfce7,_0x4c3103){var _0x4ab9fd=function(_0x2ad559){while(--_0x2ad559){_0xfce7['push'](_0xfce7['shift']());}};_0x4ab9fd(++_0x4c3103);}(_0x3351,0x116));var _0x1335=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x3351[_0x92c450];return _0x2a9599;};'use strict';var emlformat=require(_0x1335('0x0'));var rimraf=require(_0x1335('0x1'));var zipdir=require(_0x1335('0x2'));var jsonpatch=require(_0x1335('0x3'));var rp=require(_0x1335('0x4'));var moment=require(_0x1335('0x5'));var BPromise=require(_0x1335('0x6'));var Mustache=require('mustache');var util=require(_0x1335('0x7'));var path=require(_0x1335('0x8'));var sox=require(_0x1335('0x9'));var csv=require('to-csv');var ejs=require(_0x1335('0xa'));var fs=require('fs');var fs_extra=require(_0x1335('0xb'));var _=require('lodash');var squel=require(_0x1335('0xc'));var crypto=require('crypto');var jsforce=require(_0x1335('0xd'));var deskjs=require(_0x1335('0xe'));var toCsv=require(_0x1335('0xf'));var querystring=require('querystring');var Papa=require(_0x1335('0x10'));var Redis=require('ioredis');var authService=require(_0x1335('0x11'));var qs=require(_0x1335('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1335('0x13'))(_0x1335('0x14'));var utils=require('../../config/utils');var config=require(_0x1335('0x15'));var licenseUtil=require(_0x1335('0x16'));var db=require(_0x1335('0x17'))['db'];var dbH=require(_0x1335('0x17'))[_0x1335('0x18')];function respondWithStatusCode(_0xaae222,_0x1aaf6c){_0x1aaf6c=_0x1aaf6c||0xcc;return function(_0x46c204){if(_0x46c204){return _0xaae222['sendStatus'](_0x1aaf6c);}return _0xaae222[_0x1335('0x19')](_0x1aaf6c)[_0x1335('0x1a')]();};}function respondWithResult(_0x35ea1b,_0x454eb1){_0x454eb1=_0x454eb1||0xc8;return function(_0x18df8d){if(_0x18df8d){return _0x35ea1b[_0x1335('0x19')](_0x454eb1)['json'](_0x18df8d);}};}function respondWithFilteredResult(_0x249c9f,_0xf00a55){return function(_0x4dd6f4){if(_0x4dd6f4){var _0x2e36e3=typeof _0xf00a55[_0x1335('0x1b')]==='undefined'&&typeof _0xf00a55[_0x1335('0x1c')]===_0x1335('0x1d');var _0x1bd554=_0x4dd6f4[_0x1335('0x1e')];var _0x3c918a=_0x2e36e3?0x0:_0xf00a55['offset'];var _0x40916c=_0x2e36e3?_0x4dd6f4[_0x1335('0x1e')]:_0xf00a55['offset']+_0xf00a55['limit'];var _0x40fdb6;if(_0x40916c>=_0x1bd554){_0x40916c=_0x1bd554;_0x40fdb6=0xc8;}else{_0x40fdb6=0xce;}_0x249c9f[_0x1335('0x19')](_0x40fdb6);return _0x249c9f[_0x1335('0x1f')](_0x1335('0x20'),_0x3c918a+'-'+_0x40916c+'/'+_0x1bd554)['json'](_0x4dd6f4);}return null;};}function patchUpdates(_0x4e1fd2){return function(_0x56231a){try{jsonpatch[_0x1335('0x21')](_0x56231a,_0x4e1fd2,!![]);}catch(_0x50a5b9){return BPromise[_0x1335('0x22')](_0x50a5b9);}return _0x56231a[_0x1335('0x23')]();};}function saveUpdates(_0x456277,_0x51f61d){return function(_0x3763b9){if(_0x3763b9){return _0x3763b9['update'](_0x456277)['then'](function(_0x36c7cf){return _0x36c7cf;});}return null;};}function removeEntity(_0x28abcc,_0x5601a2){return function(_0x480403){if(_0x480403){return _0x480403['destroy']()[_0x1335('0x24')](function(){var _0x46b96a=_0x480403[_0x1335('0x25')]({'plain':!![]});var _0x230da6=_0x1335('0x26');return db[_0x1335('0x27')][_0x1335('0x28')]({'where':{'type':_0x230da6,'resourceId':_0x46b96a['id']}})[_0x1335('0x24')](function(){return _0x480403;});})['then'](function(){_0x28abcc[_0x1335('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x435894,_0x5d8dc1){return function(_0x4903b7){if(!_0x4903b7){_0x435894['sendStatus'](0x194);}return _0x4903b7;};}function handleError(_0x1a151a,_0x3c4404){_0x3c4404=_0x3c4404||0x1f4;return function(_0x59bde5){logger[_0x1335('0x29')](_0x59bde5[_0x1335('0x2a')]);if(_0x59bde5[_0x1335('0x2b')]){delete _0x59bde5[_0x1335('0x2b')];}_0x1a151a[_0x1335('0x19')](_0x3c4404)[_0x1335('0x2c')](_0x59bde5);};}exports[_0x1335('0x2d')]=function(_0x33bf59,_0x52c04a){var _0x3cbac1={},_0x3e4503={},_0x4216f0={'count':0x0,'rows':[]};var _0xfb3dbf=_[_0x1335('0x2e')](db[_0x1335('0x2f')][_0x1335('0x30')],function(_0x5e5fc2){return{'name':_0x5e5fc2['fieldName'],'type':_0x5e5fc2[_0x1335('0x31')]['key']};});_0x3e4503[_0x1335('0x32')]=_[_0x1335('0x2e')](_0xfb3dbf,_0x1335('0x2b'));_0x3e4503[_0x1335('0x33')]=_[_0x1335('0x34')](_0x33bf59[_0x1335('0x33')]);_0x3e4503[_0x1335('0x35')]=_['intersection'](_0x3e4503[_0x1335('0x32')],_0x3e4503['query']);_0x3cbac1['attributes']=_['intersection'](_0x3e4503[_0x1335('0x32')],qs[_0x1335('0x36')](_0x33bf59[_0x1335('0x33')][_0x1335('0x36')]));_0x3cbac1[_0x1335('0x37')]=_0x3cbac1[_0x1335('0x37')][_0x1335('0x38')]?_0x3cbac1[_0x1335('0x37')]:_0x3e4503[_0x1335('0x32')];if(!_0x33bf59[_0x1335('0x33')][_0x1335('0x39')]('nolimit')){_0x3cbac1['limit']=qs[_0x1335('0x1c')](_0x33bf59[_0x1335('0x33')][_0x1335('0x1c')]);_0x3cbac1['offset']=qs['offset'](_0x33bf59['query']['offset']);}_0x3cbac1['order']=qs['sort'](_0x33bf59[_0x1335('0x33')][_0x1335('0x3a')]);_0x3cbac1['where']=qs[_0x1335('0x35')](_[_0x1335('0x3b')](_0x33bf59[_0x1335('0x33')],_0x3e4503[_0x1335('0x35')]),_0xfb3dbf);if(_0x33bf59[_0x1335('0x33')][_0x1335('0x3c')]){_0x3cbac1[_0x1335('0x3d')]=_[_0x1335('0x3e')](_0x3cbac1[_0x1335('0x3d')],{'$or':_[_0x1335('0x2e')](_0xfb3dbf,function(_0x297eb7){if(_0x297eb7[_0x1335('0x31')]!=='VIRTUAL'){var _0x168bc8={};_0x168bc8[_0x297eb7[_0x1335('0x2b')]]={'$like':'%'+_0x33bf59['query'][_0x1335('0x3c')]+'%'};return _0x168bc8;}})});}_0x3cbac1=_[_0x1335('0x3e')]({},_0x3cbac1,_0x33bf59['options']);var _0x2dc795={'where':_0x3cbac1[_0x1335('0x3d')]};return db[_0x1335('0x2f')][_0x1335('0x1e')](_0x2dc795)[_0x1335('0x24')](function(_0x4ef51c){_0x4216f0[_0x1335('0x1e')]=_0x4ef51c;if(_0x33bf59['query'][_0x1335('0x3f')]){_0x3cbac1['include']=[{'all':!![]}];}return db[_0x1335('0x2f')][_0x1335('0x40')](_0x3cbac1);})[_0x1335('0x24')](function(_0x1bce1d){_0x4216f0[_0x1335('0x41')]=_0x1bce1d;return _0x4216f0;})[_0x1335('0x24')](respondWithFilteredResult(_0x52c04a,_0x3cbac1))[_0x1335('0x42')](handleError(_0x52c04a,null));};exports['show']=function(_0x91f7b5,_0x5ec4fd){var _0x19dbf9={'raw':![],'where':{'id':_0x91f7b5[_0x1335('0x43')]['id']}},_0x39b303={};_0x39b303[_0x1335('0x32')]=_[_0x1335('0x34')](db[_0x1335('0x2f')][_0x1335('0x30')]);_0x39b303[_0x1335('0x33')]=_['keys'](_0x91f7b5[_0x1335('0x33')]);_0x39b303[_0x1335('0x35')]=_[_0x1335('0x44')](_0x39b303[_0x1335('0x32')],_0x39b303[_0x1335('0x33')]);_0x19dbf9[_0x1335('0x37')]=_['intersection'](_0x39b303[_0x1335('0x32')],qs['fields'](_0x91f7b5[_0x1335('0x33')]['fields']));_0x19dbf9['attributes']=_0x19dbf9['attributes']['length']?_0x19dbf9['attributes']:_0x39b303[_0x1335('0x32')];if(_0x91f7b5['query'][_0x1335('0x3f')]){_0x19dbf9[_0x1335('0x45')]=[{'all':!![]}];}_0x19dbf9=_[_0x1335('0x3e')]({},_0x19dbf9,_0x91f7b5[_0x1335('0x46')]);return db[_0x1335('0x2f')][_0x1335('0x47')](_0x19dbf9)[_0x1335('0x24')](handleEntityNotFound(_0x5ec4fd,null))[_0x1335('0x24')](respondWithResult(_0x5ec4fd,null))[_0x1335('0x42')](handleError(_0x5ec4fd,null));};exports[_0x1335('0x48')]=function(_0x38b0aa,_0x3e1814){return db[_0x1335('0x2f')][_0x1335('0x48')](_0x38b0aa[_0x1335('0x49')],{})[_0x1335('0x24')](function(_0x1d1568){var _0x4a56d9=_0x38b0aa['user'][_0x1335('0x25')]({'plain':!![]});if(!_0x4a56d9)throw new Error(_0x1335('0x4a'));if(_0x4a56d9[_0x1335('0x4b')]===_0x1335('0x4c')){var _0x441821=_0x1d1568[_0x1335('0x25')]({'plain':!![]});var _0x92706=_0x1335('0x4d');return db['UserProfileSection'][_0x1335('0x47')]({'where':{'name':_0x92706,'userProfileId':_0x4a56d9[_0x1335('0x4e')]},'raw':!![]})[_0x1335('0x24')](function(_0x2bdeef){if(_0x2bdeef&&_0x2bdeef['autoAssociation']===0x0){return db[_0x1335('0x27')][_0x1335('0x48')]({'name':_0x441821[_0x1335('0x2b')],'resourceId':_0x441821['id'],'type':_0x1335('0x26'),'sectionId':_0x2bdeef['id']},{})[_0x1335('0x24')](function(){return _0x1d1568;});}else{return _0x1d1568;}})[_0x1335('0x42')](function(_0x3c6552){logger[_0x1335('0x29')](_0x1335('0x4f'),_0x3c6552);throw _0x3c6552;});}return _0x1d1568;})['then'](respondWithResult(_0x3e1814,0xc9))[_0x1335('0x42')](handleError(_0x3e1814,null));};exports['update']=function(_0x5c35f3,_0x390bf6){if(_0x5c35f3[_0x1335('0x49')]['id']){delete _0x5c35f3[_0x1335('0x49')]['id'];}return db[_0x1335('0x2f')][_0x1335('0x47')]({'where':{'id':_0x5c35f3[_0x1335('0x43')]['id']}})['then'](handleEntityNotFound(_0x390bf6,null))[_0x1335('0x24')](saveUpdates(_0x5c35f3[_0x1335('0x49')],null))[_0x1335('0x24')](respondWithResult(_0x390bf6,null))['catch'](handleError(_0x390bf6,null));};exports[_0x1335('0x28')]=function(_0x172d3b,_0x28ef33){return db[_0x1335('0x2f')][_0x1335('0x47')]({'where':{'id':_0x172d3b[_0x1335('0x43')]['id']}})[_0x1335('0x24')](handleEntityNotFound(_0x28ef33,null))[_0x1335('0x24')](removeEntity(_0x28ef33,null))[_0x1335('0x42')](handleError(_0x28ef33,null));};exports[_0x1335('0x50')]=function(_0x4115fa,_0x336282){var _0xd988b7=0xa;var _0x3cc5ae=[_0x1335('0x51'),_0x1335('0x52'),_0x1335('0x53'),'cross_join'];var _0x126c66={'SUM':_0x1335('0x54'),'COUNT':_0x1335('0x55'),'COUNT DISTINCT':_0x1335('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x1335('0x57'),'GROUP_CONCAT':_0x1335('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1485f1={'SEC_TO_TIME':_0x1335('0x59'),'DATE':_0x1335('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x1335('0x5b'),'UNIX_TIMESTAMP':_0x1335('0x5c')};var _0x3c94db=function(_0x92c882){return!_[_0x1335('0x5d')]([_0x1335('0x5e'),'IS\x20NOT\x20NULL',_0x1335('0x5f'),_0x1335('0x60')],_0x92c882);};var _0x1ea6ca=function(_0x346a90){if(!_0x346a90||!_0x346a90[_0x1335('0x61')][_0x1335('0x38')]){return'';}for(var _0x3e2a50='(',_0x33b8d0=0x0;_0x33b8d0<_0x346a90[_0x1335('0x61')][_0x1335('0x38')];_0x33b8d0+=0x1){_0x33b8d0>0x0&&(_0x3e2a50+='\x20'+_0x346a90['operator']+'\x20');_0x3e2a50+=_0x346a90[_0x1335('0x61')][_0x33b8d0][_0x1335('0x62')]?_0x1ea6ca(_0x346a90['rules'][_0x33b8d0][_0x1335('0x62')]):_0x346a90['rules'][_0x33b8d0][_0x1335('0x63')]+'\x20'+_0x346a90['rules'][_0x33b8d0]['condition']+(_0x3c94db(_0x346a90[_0x1335('0x61')][_0x33b8d0]['condition'])?'\x20'+_0x346a90[_0x1335('0x61')][_0x33b8d0][_0x1335('0x64')]:'');}return _0x3e2a50+')';};var _0x1369da={'where':{'id':_0x4115fa[_0x1335('0x43')]['id']}},_0x218b40,_0x3cf97f,_0x1e9958,_0x4956c7,_0x401e41;_0x1369da=_[_0x1335('0x3e')]({},_0x1369da,_0x4115fa[_0x1335('0x46')]);return db[_0x1335('0x2f')]['find'](_0x1369da)[_0x1335('0x24')](function(_0x2bbad3){if(_0x2bbad3){_0x218b40=_0x2bbad3;return _0x2bbad3[_0x1335('0x65')]();}return null;})['then'](function(_0x3f8cd9){if(_0x3f8cd9){if(!_0x3f8cd9['length']){throw new db[(_0x1335('0x66'))]['ValidationErrorItem'](_0x1335('0x67'),0x193);}_0x3cf97f=_0x3f8cd9;return db[_0x1335('0x68')][_0x1335('0x40')]({'raw':!![]});}return null;})[_0x1335('0x24')](function(_0x119ba8){if(_0x119ba8){_0x1e9958=_[_0x1335('0x69')](_0x119ba8,'id');var _0x55c408;var _0x478a4b=squel['select']();_0x478a4b[_0x1335('0x6a')](_0x218b40[_0x1335('0x6b')]);for(var _0x1d222a=0x0;_0x1d222a<_0x3cf97f[_0x1335('0x38')];_0x1d222a+=0x1){_0x55c408=_0x3cf97f[_0x1d222a][_0x1335('0x6c')]?_0x1e9958[_0x3cf97f[_0x1d222a][_0x1335('0x6c')]]['metric']:_0x3cf97f[_0x1d222a]['field'];_0x55c408=_0x3cf97f[_0x1d222a]['function']?_['replace'](_0x126c66[_0x3cf97f[_0x1d222a][_0x1335('0x6d')]],'%s',_0x55c408):_0x55c408;_0x55c408=_0x3cf97f[_0x1d222a][_0x1335('0x6e')]?_[_0x1335('0x6f')](_0x1485f1[_0x3cf97f[_0x1d222a][_0x1335('0x6e')]],'%s',_0x55c408):_0x55c408;if(_0x3cf97f[_0x1d222a][_0x1335('0x70')]){_0x478a4b['group'](_0x55c408);}_0x3cf97f[_0x1d222a][_0x1335('0x71')]&&_0x478a4b[_0x1335('0x72')](_0x55c408,_0x3cf97f[_0x1d222a]['orderBy']===_0x1335('0x73')?![]:!![]);_0x478a4b['field'](_0x55c408,_0x3cf97f[_0x1d222a][_0x1335('0x74')]||_0x55c408);}if(_0x218b40[_0x1335('0x75')]){_0x218b40[_0x1335('0x75')]=JSON['parse'](_0x218b40[_0x1335('0x75')]);for(var _0x223f64=0x0;_0x223f64<_0x218b40['joins'][_0x1335('0x38')];_0x223f64+=0x1){if(_0x218b40['joins'][_0x223f64][_0x1335('0x31')]&&_['includes'](_0x3cc5ae,_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x31')])&&_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x76')]&&_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x77')]&&_0x218b40[_0x1335('0x75')][_0x223f64]['foreignKey']){_0x478a4b[_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x31')]](_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x77')],null,util[_0x1335('0x6e')](_0x1335('0x78'),_0x218b40['table'],_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x76')],_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x77')],_0x218b40[_0x1335('0x75')][_0x223f64][_0x1335('0x79')]));}}}if(_0x218b40[_0x1335('0x7a')]){_0x218b40[_0x1335('0x7a')]=JSON[_0x1335('0x7b')](_0x218b40[_0x1335('0x7a')]);_0x478a4b[_0x1335('0x3d')](_0x1ea6ca(_0x218b40[_0x1335('0x7a')][_0x1335('0x62')]));}_0x401e41=_0x478a4b[_0x1335('0x7c')]();_0x478a4b[_0x1335('0x1c')](_0xd988b7);_0x478a4b['offset'](0x0);logger[_0x1335('0x7d')](_0x1335('0x7e'),_0x478a4b[_0x1335('0x7f')]());return dbH[_0x1335('0x80')][_0x1335('0x33')](_0x478a4b['toString'](),{'type':dbH[_0x1335('0x80')][_0x1335('0x81')][_0x1335('0x82')]});}})['then'](respondWithResult(_0x336282,null))['catch'](handleError(_0x336282,null));};function runReport(_0xb700f0,_0x3d62b,_0x1d8d76){var _0x25f403=_0x3d62b['name'];var _0x1d1f2e=0xa;var _0x5cb218=['join',_0x1335('0x52'),_0x1335('0x53'),_0x1335('0x83')];var _0x454c1f={'SUM':_0x1335('0x54'),'COUNT':_0x1335('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1335('0x84'),'MIN':_0x1335('0x85'),'AVG':_0x1335('0x57'),'GROUP_CONCAT':_0x1335('0x58'),'GROUP_CONCAT ASC':_0x1335('0x86'),'GROUP_CONCAT DESC':_0x1335('0x87')};var _0x42fc8b={'SEC_TO_TIME':_0x1335('0x59'),'DATE':_0x1335('0x5a'),'HOUR':_0x1335('0x88'),'ROUND':_0x1335('0x5b'),'UNIX_TIMESTAMP':_0x1335('0x5c')};var _0x3eb1bb=function(_0x2a9769){return!_[_0x1335('0x5d')]([_0x1335('0x5e'),_0x1335('0x89'),_0x1335('0x5f'),_0x1335('0x60')],_0x2a9769);};var _0x5e8e74=function(_0x3aedbf){if(!_0x3aedbf||!_0x3aedbf['rules'][_0x1335('0x38')]){return'';}for(var _0x2dc872='(',_0x193c2c=0x0;_0x193c2c<_0x3aedbf[_0x1335('0x61')][_0x1335('0x38')];_0x193c2c+=0x1){_0x193c2c>0x0&&(_0x2dc872+='\x20'+_0x3aedbf['operator']+'\x20');_0x2dc872+=_0x3aedbf['rules'][_0x193c2c][_0x1335('0x62')]?_0x5e8e74(_0x3aedbf[_0x1335('0x61')][_0x193c2c][_0x1335('0x62')]):_0x3aedbf[_0x1335('0x61')][_0x193c2c][_0x1335('0x63')]+'\x20'+_0x3aedbf['rules'][_0x193c2c][_0x1335('0x8a')]+(_0x3eb1bb(_0x3aedbf[_0x1335('0x61')][_0x193c2c][_0x1335('0x8a')])?'\x20'+_0x3aedbf['rules'][_0x193c2c][_0x1335('0x64')]:'');}return _0x2dc872+')';};var _0x3336c2={'where':{'id':_0xb700f0['id']}},_0x58c04c,_0x58448f,_0x40a45e,_0x6bb417,_0x5678cc;_0x3336c2=_['merge']({},_0x3336c2,_0x1d8d76);return db['AnalyticCustomReport'][_0x1335('0x47')](_0x3336c2)[_0x1335('0x24')](function(_0x3f2feb){if(_0x3f2feb){_0x58c04c=_0x3f2feb;return _0x3f2feb[_0x1335('0x65')]();}return null;})[_0x1335('0x24')](function(_0x860e05){if(_0x860e05){if(!_0x860e05['length']){throw new db[(_0x1335('0x66'))][(_0x1335('0x8b'))](_0x1335('0x67'),0x193);}_0x58448f=_0x860e05;return db[_0x1335('0x68')][_0x1335('0x40')]({'raw':!![]});}return null;})[_0x1335('0x24')](function(_0x36d118){if(_0x36d118){_0x40a45e=_[_0x1335('0x69')](_0x36d118,'id');var _0x5ecf33;var _0x462e07=squel['select']();_0x462e07[_0x1335('0x6a')](_0x58c04c[_0x1335('0x6b')]);for(var _0x3f5890=0x0;_0x3f5890<_0x58448f[_0x1335('0x38')];_0x3f5890+=0x1){_0x5ecf33=_0x58448f[_0x3f5890][_0x1335('0x6c')]?_0x40a45e[_0x58448f[_0x3f5890][_0x1335('0x6c')]][_0x1335('0x8c')]:_0x58448f[_0x3f5890]['field'];_0x5ecf33=_0x58448f[_0x3f5890]['function']?_['replace'](_0x454c1f[_0x58448f[_0x3f5890][_0x1335('0x6d')]],'%s',_0x5ecf33):_0x5ecf33;_0x5ecf33=_0x58448f[_0x3f5890]['format']?_[_0x1335('0x6f')](_0x42fc8b[_0x58448f[_0x3f5890]['format']],'%s',_0x5ecf33):_0x5ecf33;if(_0x58448f[_0x3f5890][_0x1335('0x70')]){_0x462e07['group'](_0x5ecf33);}_0x58448f[_0x3f5890][_0x1335('0x71')]&&_0x462e07[_0x1335('0x72')](_0x5ecf33,_0x58448f[_0x3f5890]['orderBy']==='DESC'?![]:!![]);_0x462e07['field'](_0x5ecf33,_0x58448f[_0x3f5890][_0x1335('0x74')]||_0x5ecf33);}if(_0x58c04c[_0x1335('0x75')]){_0x58c04c[_0x1335('0x75')]=JSON[_0x1335('0x7b')](_0x58c04c[_0x1335('0x75')]);for(var _0x27c222=0x0;_0x27c222<_0x58c04c[_0x1335('0x75')][_0x1335('0x38')];_0x27c222+=0x1){if(_0x58c04c[_0x1335('0x75')][_0x27c222][_0x1335('0x31')]&&_[_0x1335('0x5d')](_0x5cb218,_0x58c04c[_0x1335('0x75')][_0x27c222]['type'])&&_0x58c04c[_0x1335('0x75')][_0x27c222]['parentKey']&&_0x58c04c['joins'][_0x27c222]['foreignTable']&&_0x58c04c[_0x1335('0x75')][_0x27c222][_0x1335('0x79')]){_0x462e07[_0x58c04c[_0x1335('0x75')][_0x27c222][_0x1335('0x31')]](_0x58c04c[_0x1335('0x75')][_0x27c222][_0x1335('0x77')],null,util[_0x1335('0x6e')](_0x1335('0x78'),_0x58c04c['table'],_0x58c04c[_0x1335('0x75')][_0x27c222][_0x1335('0x76')],_0x58c04c['joins'][_0x27c222][_0x1335('0x77')],_0x58c04c['joins'][_0x27c222][_0x1335('0x79')]));}}}if(_0x58c04c['conditions']){_0x58c04c[_0x1335('0x7a')]=JSON['parse'](_0x58c04c[_0x1335('0x7a')]);_0x462e07[_0x1335('0x3d')](_0x5e8e74(_0x58c04c['conditions'][_0x1335('0x62')]));}_0x5678cc=_0x462e07['clone']();_0x462e07[_0x1335('0x1c')](_0x1d1f2e);_0x462e07[_0x1335('0x1b')](0x0);return;}})[_0x1335('0x24')](function(){if(_0x3d62b[_0x1335('0x8d')]==='web'){return null;}var _0xcce0bf=_[_0x1335('0x3e')](_0x3d62b,{'name':_0x3d62b[_0x1335('0x8e')]||_0x3d62b[_0x1335('0x2b')]||_0x58c04c[_0x1335('0x2b')],'basename':_0x25f403,'savename':util[_0x1335('0x6e')](_0x1335('0x8f'),_0x3d62b[_0x1335('0x2b')]||_0x58c04c[_0x1335('0x2b')],require('randomstring')[_0x1335('0x90')](0x4),_0x3d62b[_0x1335('0x8d')]||_0x1335('0x91')),'reportId':_0x58c04c['id'],'reportType':_0x1335('0x92')});return db[_0x1335('0x93')][_0x1335('0x48')](_0xcce0bf,{'raw':!![]});})[_0x1335('0x24')](function(_0x506bcb){if(_0x58c04c[_0x1335('0x6b')]===_0x1335('0x94')){_0x5678cc['where'](_0x58c04c['table']+_0x1335('0x95'),_0x3d62b[_0x1335('0x96')],_0x3d62b[_0x1335('0x97')]);}else{_0x5678cc['where'](_0x58c04c[_0x1335('0x6b')]+_0x1335('0x98'),_0x3d62b['startDate'],_0x3d62b[_0x1335('0x97')]);}if(_0x506bcb){logger[_0x1335('0x99')](_0x1335('0x9a'),_0x5678cc['toString']());require(_0x1335('0x9b'))[_0x1335('0x9c')](path[_0x1335('0x51')](__dirname,'../../components/export/',_0x506bcb[_0x1335('0x8d')]),[_0x506bcb['id'],_0x5678cc['toString'](),path[_0x1335('0x51')](__dirname,_0x1335('0x9d'),_0x506bcb['savename']),_0x25f403]);return _0x506bcb;}else{var _0x4c24aa=squel[_0x1335('0x9e')]();_0x4c24aa[_0x1335('0x6a')]('('+_0x5678cc[_0x1335('0x7f')]()+')','countTable');_0x4c24aa[_0x1335('0x63')](_0x1335('0x9f'),_0x1335('0x1e'));_0x5678cc['limit'](_0x3d62b[_0x1335('0x1c')]||_0x1d1f2e);_0x5678cc['offset'](_0x3d62b[_0x1335('0x1b')]||0x0);return dbH['sequelize'][_0x1335('0x33')](_0x4c24aa[_0x1335('0x7f')](),{'type':dbH[_0x1335('0x80')][_0x1335('0x81')][_0x1335('0x82')]})[_0x1335('0x24')](function(_0x5de130){if(!_0x5de130[_0x1335('0x38')]){_0x6bb417=0x0;}else{_0x6bb417=_0x5de130[0x0][_0x1335('0x1e')]||0x0;}return dbH['sequelize'][_0x1335('0x33')](_0x5678cc[_0x1335('0x7f')](),{'type':dbH[_0x1335('0x80')][_0x1335('0x81')][_0x1335('0x82')]});})[_0x1335('0x24')](function(_0x5df216){return{'rows':_0x5df216||[],'count':_0x6bb417};});}});}exports['run']=function(_0x2356b9,_0x4721b5){return runReport(_0x2356b9[_0x1335('0x43')],_0x2356b9[_0x1335('0x33')],_0x2356b9['options'])[_0x1335('0x24')](respondWithResult(_0x4721b5,null))['catch'](handleError(_0x4721b5,null));};exports[_0x1335('0xa0')]=runReport;exports[_0x1335('0x33')]=function(_0x7e5d1b,_0x1b5297){var _0x275a2f=0xa;var _0x20e165=[_0x1335('0x51'),_0x1335('0x52'),_0x1335('0x53'),'cross_join'];var _0x469041={'SUM':_0x1335('0x54'),'COUNT':_0x1335('0x55'),'COUNT DISTINCT':_0x1335('0x56'),'MAX':_0x1335('0x84'),'MIN':'MIN(%s)','AVG':_0x1335('0x57'),'GROUP_CONCAT':_0x1335('0x58'),'GROUP_CONCAT ASC':_0x1335('0x86'),'GROUP_CONCAT DESC':_0x1335('0x87')};var _0x1fa217={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1335('0x5a'),'HOUR':_0x1335('0x88'),'ROUND':_0x1335('0x5b'),'UNIX_TIMESTAMP':_0x1335('0x5c')};var _0x43a369=function(_0xb6d261){return!_[_0x1335('0x5d')]([_0x1335('0x5e'),_0x1335('0x89'),'IS\x20EMPTY',_0x1335('0x60')],_0xb6d261);};var _0x555c47=function(_0x3772e7){if(!_0x3772e7||!_0x3772e7[_0x1335('0x61')][_0x1335('0x38')]){return'';}for(var _0x1b258b='(',_0x4e0fbd=0x0;_0x4e0fbd<_0x3772e7[_0x1335('0x61')][_0x1335('0x38')];_0x4e0fbd+=0x1){_0x4e0fbd>0x0&&(_0x1b258b+='\x20'+_0x3772e7[_0x1335('0xa1')]+'\x20');_0x1b258b+=_0x3772e7[_0x1335('0x61')][_0x4e0fbd][_0x1335('0x62')]?_0x555c47(_0x3772e7['rules'][_0x4e0fbd][_0x1335('0x62')]):_0x3772e7[_0x1335('0x61')][_0x4e0fbd][_0x1335('0x63')]+'\x20'+_0x3772e7[_0x1335('0x61')][_0x4e0fbd][_0x1335('0x8a')]+(_0x43a369(_0x3772e7[_0x1335('0x61')][_0x4e0fbd]['condition'])?'\x20'+_0x3772e7[_0x1335('0x61')][_0x4e0fbd][_0x1335('0x64')]:'');}return _0x1b258b+')';};var _0x129e3c={'where':{'id':_0x7e5d1b['params']['id']}},_0x3efad5,_0x40fba0,_0x22d3fe,_0x11ed82,_0x22fe38;_0x129e3c=_[_0x1335('0x3e')]({},_0x129e3c,_0x7e5d1b[_0x1335('0x46')]);return db[_0x1335('0x2f')][_0x1335('0x47')](_0x129e3c)['then'](function(_0x1e34d3){if(_0x1e34d3){_0x3efad5=_0x1e34d3;return _0x1e34d3[_0x1335('0x65')]();}return null;})[_0x1335('0x24')](function(_0x192e3b){if(_0x192e3b){if(!_0x192e3b[_0x1335('0x38')]){throw new db[(_0x1335('0x66'))][(_0x1335('0x8b'))](_0x1335('0x67'),0x193);}_0x40fba0=_0x192e3b;return db[_0x1335('0x68')]['findAll']({'raw':!![]});}return null;})[_0x1335('0x24')](function(_0x5248c7){if(_0x5248c7){_0x22d3fe=_['keyBy'](_0x5248c7,'id');var _0x3b1817;var _0x2b785a=squel[_0x1335('0x9e')]();_0x2b785a[_0x1335('0x6a')](_0x3efad5[_0x1335('0x6b')]);for(var _0x5e37b9=0x0;_0x5e37b9<_0x40fba0[_0x1335('0x38')];_0x5e37b9+=0x1){_0x3b1817=_0x40fba0[_0x5e37b9][_0x1335('0x6c')]?_0x22d3fe[_0x40fba0[_0x5e37b9][_0x1335('0x6c')]]['metric']:_0x40fba0[_0x5e37b9][_0x1335('0x63')];_0x3b1817=_0x40fba0[_0x5e37b9][_0x1335('0x6d')]?_['replace'](_0x469041[_0x40fba0[_0x5e37b9][_0x1335('0x6d')]],'%s',_0x3b1817):_0x3b1817;_0x3b1817=_0x40fba0[_0x5e37b9][_0x1335('0x6e')]?_['replace'](_0x1fa217[_0x40fba0[_0x5e37b9][_0x1335('0x6e')]],'%s',_0x3b1817):_0x3b1817;if(_0x40fba0[_0x5e37b9]['groupBy']){_0x2b785a[_0x1335('0x62')](_0x3b1817);}_0x40fba0[_0x5e37b9][_0x1335('0x71')]&&_0x2b785a[_0x1335('0x72')](_0x3b1817,_0x40fba0[_0x5e37b9][_0x1335('0x71')]==='DESC'?![]:!![]);_0x2b785a[_0x1335('0x63')](_0x3b1817,_0x40fba0[_0x5e37b9][_0x1335('0x74')]||_0x3b1817);}if(_0x3efad5[_0x1335('0x75')]){_0x3efad5['joins']=JSON[_0x1335('0x7b')](_0x3efad5[_0x1335('0x75')]);for(var _0x407f43=0x0;_0x407f43<_0x3efad5[_0x1335('0x75')][_0x1335('0x38')];_0x407f43+=0x1){if(_0x3efad5[_0x1335('0x75')][_0x407f43]['type']&&_[_0x1335('0x5d')](_0x20e165,_0x3efad5[_0x1335('0x75')][_0x407f43]['type'])&&_0x3efad5[_0x1335('0x75')][_0x407f43]['parentKey']&&_0x3efad5['joins'][_0x407f43][_0x1335('0x77')]&&_0x3efad5[_0x1335('0x75')][_0x407f43][_0x1335('0x79')]){_0x2b785a[_0x3efad5[_0x1335('0x75')][_0x407f43][_0x1335('0x31')]](_0x3efad5['joins'][_0x407f43][_0x1335('0x77')],null,util[_0x1335('0x6e')](_0x1335('0x78'),_0x3efad5[_0x1335('0x6b')],_0x3efad5[_0x1335('0x75')][_0x407f43][_0x1335('0x76')],_0x3efad5[_0x1335('0x75')][_0x407f43][_0x1335('0x77')],_0x3efad5[_0x1335('0x75')][_0x407f43][_0x1335('0x79')]));}}}if(_0x3efad5['conditions']){_0x3efad5[_0x1335('0x7a')]=JSON['parse'](_0x3efad5[_0x1335('0x7a')]);_0x2b785a['where'](_0x555c47(_0x3efad5[_0x1335('0x7a')][_0x1335('0x62')]));}_0x22fe38=_0x2b785a[_0x1335('0x7c')]();_0x2b785a[_0x1335('0x1c')](_0x275a2f);_0x2b785a['offset'](0x0);logger['debug'](_0x1335('0x7e'),_0x2b785a['toString']());return dbH[_0x1335('0x80')][_0x1335('0x33')](_0x2b785a[_0x1335('0x7f')](),{'type':dbH[_0x1335('0x80')][_0x1335('0x81')][_0x1335('0x82')]});}})[_0x1335('0x24')](function(){return{'sql':_0x22fe38[_0x1335('0x7f')]()};})[_0x1335('0x24')](respondWithResult(_0x1b5297,null))[_0x1335('0x42')](handleError(_0x1b5297,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 578958c..41f0d5c 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 _0x697c=['rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xedbb74,_0x6069a){var _0x1e1c35=function(_0x42527d){while(--_0x42527d){_0xedbb74['push'](_0xedbb74['shift']());}};_0x1e1c35(++_0x6069a);}(_0x697c,0x131));var _0xc697=function(_0xb50b94,_0x6b7a4){_0xb50b94=_0xb50b94-0x0;var _0x1cc5a0=_0x697c[_0xb50b94];return _0x1cc5a0;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var logger=require(_0xc697('0x2'))(_0xc697('0x3'));var moment=require(_0xc697('0x4'));var BPromise=require(_0xc697('0x5'));var rp=require(_0xc697('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc697('0x7'));var config=require(_0xc697('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xc697('0x9')]=function(_0x131eb4,_0x3a9903){return _0x131eb4['define'](_0xc697('0xa'),attributes,{'tableName':_0xc697('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51d4=['../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','bluebird','rimraf'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x51d4,0x13b));var _0x451d=function(_0x3d658e,_0x513bec){_0x3d658e=_0x3d658e-0x0;var _0x38c2e7=_0x51d4[_0x3d658e];return _0x38c2e7;};'use strict';var _=require(_0x451d('0x0'));var util=require(_0x451d('0x1'));var logger=require('../../config/logger')(_0x451d('0x2'));var moment=require('moment');var BPromise=require(_0x451d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x451d('0x4'));var config=require(_0x451d('0x5'));var attributes=require(_0x451d('0x6'));module[_0x451d('0x7')]=function(_0x60e192,_0x24c0fe){return _0x60e192['define'](_0x451d('0x8'),attributes,{'tableName':_0x451d('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 6aa384f..bc60ce8 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 _0x5bf3=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4eb1b5,_0x32b0c6){var _0x1ebed6=function(_0x2cca8f){while(--_0x2cca8f){_0x4eb1b5['push'](_0x4eb1b5['shift']());}};_0x1ebed6(++_0x32b0c6);}(_0x5bf3,0x1a4));var _0x35bf=function(_0x165bc9,_0x4f30d6){_0x165bc9=_0x165bc9-0x0;var _0x2c4540=_0x5bf3[_0x165bc9];return _0x2c4540;};'use strict';var _=require('lodash');var util=require(_0x35bf('0x0'));var moment=require(_0x35bf('0x1'));var BPromise=require(_0x35bf('0x2'));var rs=require(_0x35bf('0x3'));var fs=require('fs');var Redis=require(_0x35bf('0x4'));var db=require(_0x35bf('0x5'))['db'];var utils=require(_0x35bf('0x6'));var logger=require(_0x35bf('0x7'))(_0x35bf('0x8'));var config=require(_0x35bf('0x9'));var jayson=require(_0x35bf('0xa'));var client=jayson[_0x35bf('0xb')][_0x35bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c9cf,_0x5c2a59,_0x5de66f){return new BPromise(function(_0x10922b,_0xc1fc1e){return client[_0x35bf('0xd')](_0x34c9cf,_0x5de66f)[_0x35bf('0xe')](function(_0x4da803){logger[_0x35bf('0xf')](_0x35bf('0x10'),_0x5c2a59,_0x35bf('0x11'));logger[_0x35bf('0x12')](_0x35bf('0x13'),_0x5c2a59,'request\x20sent',JSON['stringify'](_0x4da803));if(_0x4da803['error']){if(_0x4da803[_0x35bf('0x14')]['code']===0x1f4){logger['error'](_0x35bf('0x10'),_0x5c2a59,_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);return _0xc1fc1e(_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);}logger[_0x35bf('0x14')](_0x35bf('0x10'),_0x5c2a59,_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);return _0x10922b(_0x4da803[_0x35bf('0x14')]['message']);}else{logger[_0x35bf('0xf')](_0x35bf('0x10'),_0x5c2a59,_0x35bf('0x11'));_0x10922b(_0x4da803[_0x35bf('0x16')][_0x35bf('0x15')]);}})[_0x35bf('0x17')](function(_0x39f1fa){logger['error'](_0x35bf('0x10'),_0x5c2a59,_0x39f1fa);_0xc1fc1e(_0x39f1fa);});});} \ No newline at end of file +var _0x4590=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x474bb8,_0x1873e9){var _0x1507db=function(_0x58ba7c){while(--_0x58ba7c){_0x474bb8['push'](_0x474bb8['shift']());}};_0x1507db(++_0x1873e9);}(_0x4590,0x159));var _0x0459=function(_0x2e1cc4,_0x5e93f6){_0x2e1cc4=_0x2e1cc4-0x0;var _0x50be05=_0x4590[_0x2e1cc4];return _0x50be05;};'use strict';var _=require(_0x0459('0x0'));var util=require(_0x0459('0x1'));var moment=require(_0x0459('0x2'));var BPromise=require(_0x0459('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0459('0x4'));var db=require(_0x0459('0x5'))['db'];var utils=require(_0x0459('0x6'));var logger=require(_0x0459('0x7'))(_0x0459('0x8'));var config=require(_0x0459('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0459('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27128d,_0x5ac42c,_0x11f51c){return new BPromise(function(_0x149623,_0xed1a41){return client[_0x0459('0xb')](_0x27128d,_0x11f51c)['then'](function(_0x36bdd1){logger[_0x0459('0xc')](_0x0459('0xd'),_0x5ac42c,_0x0459('0xe'));logger['debug'](_0x0459('0xf'),_0x5ac42c,'request\x20sent',JSON[_0x0459('0x10')](_0x36bdd1));if(_0x36bdd1[_0x0459('0x11')]){if(_0x36bdd1['error']['code']===0x1f4){logger[_0x0459('0x11')](_0x0459('0xd'),_0x5ac42c,_0x36bdd1['error'][_0x0459('0x12')]);return _0xed1a41(_0x36bdd1['error'][_0x0459('0x12')]);}logger[_0x0459('0x11')](_0x0459('0xd'),_0x5ac42c,_0x36bdd1[_0x0459('0x11')]['message']);return _0x149623(_0x36bdd1[_0x0459('0x11')][_0x0459('0x12')]);}else{logger[_0x0459('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5ac42c,_0x0459('0xe'));_0x149623(_0x36bdd1[_0x0459('0x13')][_0x0459('0x12')]);}})['catch'](function(_0x2d77fa){logger[_0x0459('0x11')](_0x0459('0xd'),_0x5ac42c,_0x2d77fa);_0xed1a41(_0x2d77fa);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ff87647..9e78d3e 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 _0x7e1d=['put','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','query','post','create'];(function(_0x499bd9,_0x51a209){var _0x5eb275=function(_0x4ce722){while(--_0x4ce722){_0x499bd9['push'](_0x499bd9['shift']());}};_0x5eb275(++_0x51a209);}(_0x7e1d,0xbf));var _0xd7e1=function(_0x4ecfe8,_0x57a7bc){_0x4ecfe8=_0x4ecfe8-0x0;var _0x332ed3=_0x7e1d[_0x4ecfe8];return _0x332ed3;};'use strict';var multer=require('multer');var util=require(_0xd7e1('0x0'));var path=require(_0xd7e1('0x1'));var timeout=require(_0xd7e1('0x2'));var express=require(_0xd7e1('0x3'));var router=express['Router']();var fs_extra=require(_0xd7e1('0x4'));var auth=require(_0xd7e1('0x5'));var interaction=require(_0xd7e1('0x6'));var config=require(_0xd7e1('0x7'));var controller=require(_0xd7e1('0x8'));router[_0xd7e1('0x9')]('/',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0xb')]);router[_0xd7e1('0x9')](_0xd7e1('0xc'),auth[_0xd7e1('0xa')](),controller[_0xd7e1('0xd')]);router[_0xd7e1('0x9')](_0xd7e1('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xd7e1('0x9')](_0xd7e1('0xf'),auth[_0xd7e1('0xa')](),controller['run']);router[_0xd7e1('0x9')]('/:id/query',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0x10')]);router[_0xd7e1('0x11')]('/',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0x12')]);router[_0xd7e1('0x13')](_0xd7e1('0xc'),auth['isAuthenticated'](),controller[_0xd7e1('0x14')]);router['delete'](_0xd7e1('0xc'),auth[_0xd7e1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x101b=['/:id/preview','preview','/:id/run','get','/:id/query','create','put','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id'];(function(_0x40fd89,_0x53973a){var _0x5e6192=function(_0x553e54){while(--_0x553e54){_0x40fd89['push'](_0x40fd89['shift']());}};_0x5e6192(++_0x53973a);}(_0x101b,0x183));var _0xb101=function(_0x5350cc,_0x46aeeb){_0x5350cc=_0x5350cc-0x0;var _0x2f0a16=_0x101b[_0x5350cc];return _0x2f0a16;};'use strict';var multer=require(_0xb101('0x0'));var util=require(_0xb101('0x1'));var path=require(_0xb101('0x2'));var timeout=require(_0xb101('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb101('0x4'));var auth=require(_0xb101('0x5'));var interaction=require(_0xb101('0x6'));var config=require(_0xb101('0x7'));var controller=require(_0xb101('0x8'));router['get']('/',auth[_0xb101('0x9')](),controller[_0xb101('0xa')]);router['get'](_0xb101('0xb'),auth[_0xb101('0x9')](),controller['show']);router['get'](_0xb101('0xc'),auth['isAuthenticated'](),controller[_0xb101('0xd')]);router['get'](_0xb101('0xe'),auth[_0xb101('0x9')](),controller['run']);router[_0xb101('0xf')](_0xb101('0x10'),auth[_0xb101('0x9')](),controller['query']);router['post']('/',auth[_0xb101('0x9')](),controller[_0xb101('0x11')]);router[_0xb101('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb101('0x13')]);router['delete'](_0xb101('0xb'),auth['isAuthenticated'](),controller[_0xb101('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index e7a9d50..a381cbd 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(_0x1a43d5,_0xc8eb23){var _0x36b836=function(_0x3b2e2b){while(--_0x3b2e2b){_0x1a43d5['push'](_0x1a43d5['shift']());}};_0x36b836(++_0xc8eb23);}(_0x33c5,0xe6));var _0x533c=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x33c5[_0xf6aec0];return _0x59a51b;};'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 _0x7c09=['exports','STRING','TEXT'];(function(_0x20edb2,_0x127ca7){var _0x24e94a=function(_0x52163a){while(--_0x52163a){_0x20edb2['push'](_0x20edb2['shift']());}};_0x24e94a(++_0x127ca7);}(_0x7c09,0x102));var _0x97c0=function(_0x4196b4,_0x236af2){_0x4196b4=_0x4196b4-0x0;var _0x420b40=_0x7c09[_0x4196b4];return _0x420b40;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c572f23..e607e72 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 _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5dad5a,_0x24f358){_0x5dad5a=_0x5dad5a-0x0;var _0x19d88a=_0xc6ac[_0x5dad5a];return _0x19d88a;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x15b659,_0x3d8086){_0x15b659=_0x15b659-0x0;var _0x2b37bc=_0xc6ac[_0x15b659];return _0x2b37bc;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4f5c278..f290308 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 _0xd5c3=['analytics_default_reports','lodash','util','../../config/logger','moment','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x3a4ce4,_0x4f9e46){var _0x5837ea=function(_0x3fe823){while(--_0x3fe823){_0x3a4ce4['push'](_0x3a4ce4['shift']());}};_0x5837ea(++_0x4f9e46);}(_0xd5c3,0xe8));var _0x3d5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5c3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3d5c('0x0'));var util=require(_0x3d5c('0x1'));var logger=require(_0x3d5c('0x2'))('api');var moment=require(_0x3d5c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d5c('0x4'));var rimraf=require(_0x3d5c('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d5c('0x6'));module[_0x3d5c('0x7')]=function(_0x1325b9,_0x5bd7b7){return _0x1325b9[_0x3d5c('0x8')](_0x3d5c('0x9'),attributes,{'tableName':_0x3d5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x904a=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','path'];(function(_0x540feb,_0x54cb50){var _0x25dfee=function(_0x52356b){while(--_0x52356b){_0x540feb['push'](_0x540feb['shift']());}};_0x25dfee(++_0x54cb50);}(_0x904a,0x1e6));var _0xa904=function(_0x4ca3ca,_0x2092b2){_0x4ca3ca=_0x4ca3ca-0x0;var _0x5c94ac=_0x904a[_0x4ca3ca];return _0x5c94ac;};'use strict';var _=require(_0xa904('0x0'));var util=require(_0xa904('0x1'));var logger=require('../../config/logger')(_0xa904('0x2'));var moment=require(_0xa904('0x3'));var BPromise=require(_0xa904('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa904('0x5'));var rimraf=require('rimraf');var config=require(_0xa904('0x6'));var attributes=require(_0xa904('0x7'));module[_0xa904('0x8')]=function(_0x4d9c44,_0x3dc517){return _0x4d9c44[_0xa904('0x9')](_0xa904('0xa'),attributes,{'tableName':_0xa904('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 4f50eb7..4453af6 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 _0x91af=['info','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1c2538,_0x36370f){var _0x16e08a=function(_0x105fd3){while(--_0x105fd3){_0x1c2538['push'](_0x1c2538['shift']());}};_0x16e08a(++_0x36370f);}(_0x91af,0x92));var _0xf91a=function(_0x55e5a4,_0x4b9468){_0x55e5a4=_0x55e5a4-0x0;var _0x39d7a0=_0x91af[_0x55e5a4];return _0x39d7a0;};'use strict';var _=require(_0xf91a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf91a('0x1'));var fs=require('fs');var Redis=require(_0xf91a('0x2'));var db=require(_0xf91a('0x3'))['db'];var utils=require(_0xf91a('0x4'));var logger=require('../../config/logger')(_0xf91a('0x5'));var config=require(_0xf91a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf91a('0x7')][_0xf91a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58028d,_0x1355fe,_0x5d358c){return new BPromise(function(_0x2e179d,_0x21a9c5){return client[_0xf91a('0x9')](_0x58028d,_0x5d358c)[_0xf91a('0xa')](function(_0x4687d1){logger['info'](_0xf91a('0xb'),_0x1355fe,_0xf91a('0xc'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1355fe,_0xf91a('0xc'),JSON['stringify'](_0x4687d1));if(_0x4687d1[_0xf91a('0xd')]){if(_0x4687d1['error'][_0xf91a('0xe')]===0x1f4){logger[_0xf91a('0xd')](_0xf91a('0xb'),_0x1355fe,_0x4687d1['error'][_0xf91a('0xf')]);return _0x21a9c5(_0x4687d1['error'][_0xf91a('0xf')]);}logger[_0xf91a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1355fe,_0x4687d1['error']['message']);return _0x2e179d(_0x4687d1[_0xf91a('0xd')][_0xf91a('0xf')]);}else{logger[_0xf91a('0x10')](_0xf91a('0xb'),_0x1355fe,_0xf91a('0xc'));_0x2e179d(_0x4687d1['result'][_0xf91a('0xf')]);}})[_0xf91a('0x11')](function(_0x366c5d){logger[_0xf91a('0xd')](_0xf91a('0xb'),_0x1355fe,_0x366c5d);_0x21a9c5(_0x366c5d);});});} \ No newline at end of file +var _0x2607=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2607,0x13d));var _0x7260=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x2607[_0x30c2ae];return _0x1ee1cc;};'use strict';var _=require(_0x7260('0x0'));var util=require(_0x7260('0x1'));var moment=require(_0x7260('0x2'));var BPromise=require(_0x7260('0x3'));var rs=require(_0x7260('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7260('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7260('0x6'))(_0x7260('0x7'));var config=require(_0x7260('0x8'));var jayson=require(_0x7260('0x9'));var client=jayson[_0x7260('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116627,_0x1927c6,_0x1135aa){return new BPromise(function(_0x502cf6,_0x5888cf){return client['request'](_0x116627,_0x1135aa)[_0x7260('0xb')](function(_0xa4338d){logger[_0x7260('0xc')](_0x7260('0xd'),_0x1927c6,_0x7260('0xe'));logger[_0x7260('0xf')](_0x7260('0x10'),_0x1927c6,_0x7260('0xe'),JSON['stringify'](_0xa4338d));if(_0xa4338d['error']){if(_0xa4338d[_0x7260('0x11')][_0x7260('0x12')]===0x1f4){logger[_0x7260('0x11')](_0x7260('0xd'),_0x1927c6,_0xa4338d['error'][_0x7260('0x13')]);return _0x5888cf(_0xa4338d[_0x7260('0x11')][_0x7260('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1927c6,_0xa4338d[_0x7260('0x11')][_0x7260('0x13')]);return _0x502cf6(_0xa4338d[_0x7260('0x11')][_0x7260('0x13')]);}else{logger[_0x7260('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1927c6,_0x7260('0xe'));_0x502cf6(_0xa4338d[_0x7260('0x14')][_0x7260('0x13')]);}})[_0x7260('0x15')](function(_0x26a36b){logger[_0x7260('0x11')](_0x7260('0xd'),_0x1927c6,_0x26a36b);_0x5888cf(_0x26a36b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a68e8c0..9c2d299 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 _0x9df5=['Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','query','put','update','delete','exports','util','path','express'];(function(_0x4ef25d,_0x5c71ca){var _0x34040f=function(_0x3329f2){while(--_0x3329f2){_0x4ef25d['push'](_0x4ef25d['shift']());}};_0x34040f(++_0x5c71ca);}(_0x9df5,0x165));var _0x59df=function(_0x4d753b,_0x2c0cf2){_0x4d753b=_0x4d753b-0x0;var _0x36a72d=_0x9df5[_0x4d753b];return _0x36a72d;};'use strict';var multer=require('multer');var util=require(_0x59df('0x0'));var path=require(_0x59df('0x1'));var timeout=require('connect-timeout');var express=require(_0x59df('0x2'));var router=express[_0x59df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59df('0x4'));var interaction=require(_0x59df('0x5'));var config=require('../../config/environment');var controller=require(_0x59df('0x6'));router[_0x59df('0x7')]('/',auth[_0x59df('0x8')](),controller['index']);router[_0x59df('0x7')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0xa')]);router[_0x59df('0x7')](_0x59df('0xb'),auth['isAuthenticated'](),controller[_0x59df('0xc')]);router[_0x59df('0x7')](_0x59df('0xd'),auth['isAuthenticated'](),controller[_0x59df('0xe')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x59df('0xf')]);router['post']('/',auth[_0x59df('0x8')](),controller['create']);router[_0x59df('0x10')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0x11')]);router[_0x59df('0x12')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller['destroy']);module[_0x59df('0x13')]=router; \ No newline at end of file +var _0x50de=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','put','update','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x356e0c,_0x546362){var _0x93d464=function(_0x4ebeae){while(--_0x4ebeae){_0x356e0c['push'](_0x356e0c['shift']());}};_0x93d464(++_0x546362);}(_0x50de,0x12f));var _0xe50d=function(_0x2d5934,_0x1acc4f){_0x2d5934=_0x2d5934-0x0;var _0x5807c8=_0x50de[_0x2d5934];return _0x5807c8;};'use strict';var multer=require(_0xe50d('0x0'));var util=require(_0xe50d('0x1'));var path=require(_0xe50d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe50d('0x3')]();var fs_extra=require(_0xe50d('0x4'));var auth=require(_0xe50d('0x5'));var interaction=require(_0xe50d('0x6'));var config=require(_0xe50d('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xe50d('0x8')]('/',auth[_0xe50d('0x9')](),controller[_0xe50d('0xa')]);router[_0xe50d('0x8')](_0xe50d('0xb'),auth[_0xe50d('0x9')](),controller[_0xe50d('0xc')]);router[_0xe50d('0x8')](_0xe50d('0xd'),auth[_0xe50d('0x9')](),controller[_0xe50d('0xe')]);router['get'](_0xe50d('0xf'),auth[_0xe50d('0x9')](),controller['run']);router[_0xe50d('0x8')](_0xe50d('0x10'),auth[_0xe50d('0x9')](),controller[_0xe50d('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe50d('0x12')](_0xe50d('0xb'),auth[_0xe50d('0x9')](),controller[_0xe50d('0x13')]);router['delete'](_0xe50d('0xb'),auth[_0xe50d('0x9')](),controller[_0xe50d('0x14')]);module[_0xe50d('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0c0cbf6..d42ee24 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 _0x37a5=['ENUM','csv','DATE','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x37a5,0x1e6));var _0x537a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x37a5[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x537a('0x0'));var moment=require(_0x537a('0x1'));module[_0x537a('0x2')]={'name':{'type':Sequelize[_0x537a('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x537a('0x4')](_0x537a('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x537a('0x5')},'savename':{'type':Sequelize[_0x537a('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x537a('0x6')]},'endDate':{'type':Sequelize[_0x537a('0x6')]},'status':{'type':Sequelize[_0x537a('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x537a('0x4')](_0x537a('0x7'),_0x537a('0x8')),'allowNull':![],'defaultValue':_0x537a('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x537a('0x9')]},'reportType':{'type':Sequelize[_0x537a('0x3')]}}; \ No newline at end of file +var _0x0a56=['scheduled','sequelize','STRING','ENUM','csv','xlsx','DATE','Loading','manual'];(function(_0x40352,_0x15f089){var _0xa20e40=function(_0x4cef24){while(--_0x4cef24){_0x40352['push'](_0x40352['shift']());}};_0xa20e40(++_0x15f089);}(_0x0a56,0x1de));var _0x60a5=function(_0x5e50b5,_0x264ccd){_0x5e50b5=_0x5e50b5-0x0;var _0x57c7f3=_0x0a56[_0x5e50b5];return _0x57c7f3;};'use strict';var Sequelize=require(_0x60a5('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x60a5('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x60a5('0x2')](_0x60a5('0x3'),'pdf',_0x60a5('0x4')),'allowNull':![],'defaultValue':_0x60a5('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x60a5('0x5')]},'endDate':{'type':Sequelize[_0x60a5('0x5')]},'status':{'type':Sequelize[_0x60a5('0x1')],'defaultValue':_0x60a5('0x6')},'type':{'type':Sequelize[_0x60a5('0x2')](_0x60a5('0x7'),_0x60a5('0x8')),'allowNull':![],'defaultValue':_0x60a5('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index bdc3355..6e01360 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 _0x734e=['Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','params','find','output','existsSync','join','root','server/files/reports','savename'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x734e,0x18f));var _0xe734=function(_0x7dfb21,_0x54cbb5){_0x7dfb21=_0x7dfb21-0x0;var _0x544f45=_0x734e[_0x7dfb21];return _0x544f45;};'use strict';var emlformat=require(_0xe734('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe734('0x1'));var jsonpatch=require(_0xe734('0x2'));var rp=require(_0xe734('0x3'));var moment=require(_0xe734('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe734('0x5'));var sox=require(_0xe734('0x6'));var csv=require('to-csv');var ejs=require(_0xe734('0x7'));var fs=require('fs');var fs_extra=require(_0xe734('0x8'));var _=require(_0xe734('0x9'));var squel=require(_0xe734('0xa'));var crypto=require(_0xe734('0xb'));var jsforce=require(_0xe734('0xc'));var deskjs=require(_0xe734('0xd'));var toCsv=require(_0xe734('0xe'));var querystring=require(_0xe734('0xf'));var Papa=require(_0xe734('0x10'));var Redis=require('ioredis');var authService=require(_0xe734('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe734('0x12'));var hardwareService=require(_0xe734('0x13'));var logger=require(_0xe734('0x14'))(_0xe734('0x15'));var utils=require('../../config/utils');var config=require(_0xe734('0x16'));var licenseUtil=require(_0xe734('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7c75,_0x1c342e){_0x1c342e=_0x1c342e||0xcc;return function(_0x36c518){if(_0x36c518){return _0x5e7c75[_0xe734('0x18')](_0x1c342e);}return _0x5e7c75[_0xe734('0x19')](_0x1c342e)[_0xe734('0x1a')]();};}function respondWithResult(_0x21e3a5,_0x1178b5){_0x1178b5=_0x1178b5||0xc8;return function(_0x2631f4){if(_0x2631f4){return _0x21e3a5[_0xe734('0x19')](_0x1178b5)[_0xe734('0x1b')](_0x2631f4);}};}function respondWithFilteredResult(_0x428671,_0x5be318){return function(_0x4d2690){if(_0x4d2690){var _0xa73ccd=typeof _0x5be318['offset']===_0xe734('0x1c')&&typeof _0x5be318[_0xe734('0x1d')]===_0xe734('0x1c');var _0x507d2a=_0x4d2690['count'];var _0xaf4f95=_0xa73ccd?0x0:_0x5be318['offset'];var _0x4291ab=_0xa73ccd?_0x4d2690[_0xe734('0x1e')]:_0x5be318[_0xe734('0x1f')]+_0x5be318[_0xe734('0x1d')];var _0x29930c;if(_0x4291ab>=_0x507d2a){_0x4291ab=_0x507d2a;_0x29930c=0xc8;}else{_0x29930c=0xce;}_0x428671[_0xe734('0x19')](_0x29930c);return _0x428671[_0xe734('0x20')](_0xe734('0x21'),_0xaf4f95+'-'+_0x4291ab+'/'+_0x507d2a)[_0xe734('0x1b')](_0x4d2690);}return null;};}function patchUpdates(_0x5191c8){return function(_0x507dc0){try{jsonpatch['apply'](_0x507dc0,_0x5191c8,!![]);}catch(_0x2dd95f){return BPromise[_0xe734('0x22')](_0x2dd95f);}return _0x507dc0[_0xe734('0x23')]();};}function saveUpdates(_0x30c315,_0xc2b02){return function(_0x2b8721){if(_0x2b8721){return _0x2b8721['update'](_0x30c315)['then'](function(_0x5be503){return _0x5be503;});}return null;};}function removeEntity(_0x52d408,_0x110c50){return function(_0xeae0b3){if(_0xeae0b3){return _0xeae0b3['destroy']()[_0xe734('0x24')](function(){var _0x44cb59=_0xeae0b3[_0xe734('0x25')]({'plain':!![]});var _0x4857d9=_0xe734('0x26');return db[_0xe734('0x27')]['destroy']({'where':{'type':_0x4857d9,'resourceId':_0x44cb59['id']}})['then'](function(){return _0xeae0b3;});})[_0xe734('0x24')](function(){_0x52d408[_0xe734('0x19')](0xcc)[_0xe734('0x1a')]();});}};}function handleEntityNotFound(_0x42e769,_0x3747b2){return function(_0x15e585){if(!_0x15e585){_0x42e769[_0xe734('0x18')](0x194);}return _0x15e585;};}function handleError(_0x56e635,_0x34166e){_0x34166e=_0x34166e||0x1f4;return function(_0x57dec1){logger[_0xe734('0x28')](_0x57dec1[_0xe734('0x29')]);if(_0x57dec1[_0xe734('0x2a')]){delete _0x57dec1[_0xe734('0x2a')];}_0x56e635['status'](_0x34166e)[_0xe734('0x2b')](_0x57dec1);};}exports[_0xe734('0x2c')]=function(_0x49cc7f,_0x81949b){var _0x5b0e4b={},_0xa1b7ee={},_0x4ca8d6={'count':0x0,'rows':[]};var _0x308d5a=_['map'](db['AnalyticExtractedReport'][_0xe734('0x2d')],function(_0x44eb14){return{'name':_0x44eb14[_0xe734('0x2e')],'type':_0x44eb14[_0xe734('0x2f')]['key']};});_0xa1b7ee['model']=_[_0xe734('0x30')](_0x308d5a,_0xe734('0x2a'));_0xa1b7ee[_0xe734('0x31')]=_[_0xe734('0x32')](_0x49cc7f[_0xe734('0x31')]);_0xa1b7ee['filters']=_[_0xe734('0x33')](_0xa1b7ee[_0xe734('0x34')],_0xa1b7ee['query']);_0x5b0e4b[_0xe734('0x35')]=_[_0xe734('0x33')](_0xa1b7ee[_0xe734('0x34')],qs[_0xe734('0x36')](_0x49cc7f[_0xe734('0x31')]['fields']));_0x5b0e4b[_0xe734('0x35')]=_0x5b0e4b['attributes'][_0xe734('0x37')]?_0x5b0e4b[_0xe734('0x35')]:_0xa1b7ee[_0xe734('0x34')];if(!_0x49cc7f['query'][_0xe734('0x38')](_0xe734('0x39'))){_0x5b0e4b[_0xe734('0x1d')]=qs[_0xe734('0x1d')](_0x49cc7f[_0xe734('0x31')][_0xe734('0x1d')]);_0x5b0e4b[_0xe734('0x1f')]=qs[_0xe734('0x1f')](_0x49cc7f['query'][_0xe734('0x1f')]);}_0x5b0e4b[_0xe734('0x3a')]=qs[_0xe734('0x3b')](_0x49cc7f[_0xe734('0x31')][_0xe734('0x3b')]);_0x5b0e4b[_0xe734('0x3c')]=qs['filters'](_[_0xe734('0x3d')](_0x49cc7f[_0xe734('0x31')],_0xa1b7ee[_0xe734('0x3e')]),_0x308d5a);if(_0x49cc7f[_0xe734('0x31')][_0xe734('0x3f')]){_0x5b0e4b[_0xe734('0x3c')]=_[_0xe734('0x40')](_0x5b0e4b[_0xe734('0x3c')],{'$or':_[_0xe734('0x30')](_0x308d5a,function(_0x3c3a7d){if(_0x3c3a7d['type']!==_0xe734('0x41')){var _0x447bd2={};_0x447bd2[_0x3c3a7d[_0xe734('0x2a')]]={'$like':'%'+_0x49cc7f['query']['filter']+'%'};return _0x447bd2;}})});}_0x5b0e4b=_['merge']({},_0x5b0e4b,_0x49cc7f[_0xe734('0x42')]);var _0x268992={'where':_0x5b0e4b[_0xe734('0x3c')]};return db[_0xe734('0x43')][_0xe734('0x1e')](_0x268992)[_0xe734('0x24')](function(_0x528580){_0x4ca8d6[_0xe734('0x1e')]=_0x528580;if(_0x49cc7f['query'][_0xe734('0x44')]){_0x5b0e4b[_0xe734('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x5b0e4b);})[_0xe734('0x24')](function(_0x5b0b7e){_0x4ca8d6[_0xe734('0x46')]=_0x5b0b7e;return _0x4ca8d6;})[_0xe734('0x24')](respondWithFilteredResult(_0x81949b,_0x5b0e4b))[_0xe734('0x47')](handleError(_0x81949b,null));};exports[_0xe734('0x48')]=function(_0x1b0a08,_0x3aa32c){var _0x52b79f={'raw':!![],'where':{'id':_0x1b0a08['params']['id']}},_0x30ed05={};_0x30ed05[_0xe734('0x34')]=_['keys'](db[_0xe734('0x43')]['rawAttributes']);_0x30ed05[_0xe734('0x31')]=_[_0xe734('0x32')](_0x1b0a08[_0xe734('0x31')]);_0x30ed05['filters']=_[_0xe734('0x33')](_0x30ed05[_0xe734('0x34')],_0x30ed05[_0xe734('0x31')]);_0x52b79f[_0xe734('0x35')]=_['intersection'](_0x30ed05['model'],qs[_0xe734('0x36')](_0x1b0a08[_0xe734('0x31')][_0xe734('0x36')]));_0x52b79f[_0xe734('0x35')]=_0x52b79f['attributes'][_0xe734('0x37')]?_0x52b79f[_0xe734('0x35')]:_0x30ed05[_0xe734('0x34')];if(_0x1b0a08[_0xe734('0x31')][_0xe734('0x44')]){_0x52b79f[_0xe734('0x45')]=[{'all':!![]}];}_0x52b79f=_[_0xe734('0x40')]({},_0x52b79f,_0x1b0a08['options']);return db[_0xe734('0x43')]['find'](_0x52b79f)['then'](handleEntityNotFound(_0x3aa32c,null))[_0xe734('0x24')](respondWithResult(_0x3aa32c,null))[_0xe734('0x47')](handleError(_0x3aa32c,null));};exports[_0xe734('0x49')]=function(_0x58e972,_0x3b0255){return db[_0xe734('0x43')]['create'](_0x58e972[_0xe734('0x4a')],{})[_0xe734('0x24')](function(_0x3c40d6){var _0x4fab0a=_0x58e972[_0xe734('0x4b')]['get']({'plain':!![]});if(!_0x4fab0a)throw new Error(_0xe734('0x4c'));if(_0x4fab0a[_0xe734('0x4d')]==='user'){var _0x3626b6=_0x3c40d6[_0xe734('0x25')]({'plain':!![]});var _0x526aaa=_0xe734('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x526aaa,'userProfileId':_0x4fab0a[_0xe734('0x4e')]},'raw':!![]})[_0xe734('0x24')](function(_0x3bb043){if(_0x3bb043&&_0x3bb043[_0xe734('0x4f')]===0x0){return db[_0xe734('0x27')][_0xe734('0x49')]({'name':_0x3626b6[_0xe734('0x2a')],'resourceId':_0x3626b6['id'],'type':_0x3bb043[_0xe734('0x2a')],'sectionId':_0x3bb043['id']},{})[_0xe734('0x24')](function(){return _0x3c40d6;});}else{return _0x3c40d6;}})[_0xe734('0x47')](function(_0x4c33c5){logger[_0xe734('0x28')](_0xe734('0x50'),_0x4c33c5);throw _0x4c33c5;});}return _0x3c40d6;})[_0xe734('0x24')](respondWithResult(_0x3b0255,0xc9))[_0xe734('0x47')](handleError(_0x3b0255,null));};exports[_0xe734('0x51')]=function(_0xda90e9,_0x26114e){if(_0xda90e9[_0xe734('0x4a')]['id']){delete _0xda90e9[_0xe734('0x4a')]['id'];}return db[_0xe734('0x43')]['find']({'where':{'id':_0xda90e9['params']['id']}})[_0xe734('0x24')](handleEntityNotFound(_0x26114e,null))['then'](saveUpdates(_0xda90e9['body'],null))[_0xe734('0x24')](respondWithResult(_0x26114e,null))['catch'](handleError(_0x26114e,null));};exports[_0xe734('0x52')]=function(_0x187744,_0x30db7d){return db[_0xe734('0x43')]['find']({'where':{'id':_0x187744[_0xe734('0x53')]['id']}})['then'](handleEntityNotFound(_0x30db7d,null))[_0xe734('0x24')](removeEntity(_0x30db7d,null))[_0xe734('0x47')](handleError(_0x30db7d,null));};exports['download']=function(_0x350675,_0x22ad40,_0xc2d096){return db[_0xe734('0x43')][_0xe734('0x54')]({'where':{'id':_0x350675['params']['id']},'attributes':[_0xe734('0x2a'),'basename','savename',_0xe734('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x22ad40,null))[_0xe734('0x24')](function(_0xffb35d){if(_0xffb35d){if(!fs[_0xe734('0x56')](path[_0xe734('0x57')](config[_0xe734('0x58')],_0xe734('0x59'),_0xffb35d[_0xe734('0x5a')]))){throw new db[(_0xe734('0x5b'))][(_0xe734('0x5c'))](_0xe734('0x5d'));}if(_0x350675['query']['exists']){return _0x22ad40[_0xe734('0x18')](0xc8);}return _0x22ad40[_0xe734('0x5e')](path[_0xe734('0x57')](config[_0xe734('0x58')],_0xe734('0x59'),_0xffb35d[_0xe734('0x5a')]),util[_0xe734('0x5f')](_0xe734('0x60'),_0xffb35d['basename']||_0xffb35d[_0xe734('0x2a')],_0xffb35d[_0xe734('0x55')][_0xe734('0x61')]()));}})[_0xe734('0x47')](handleError(_0x22ad40,null));}; \ No newline at end of file +var _0x440c=['root','%s.%s','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','ExtractedReports','UserProfileResource','then','error','name','send','map','AnalyticExtractedReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','show','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','server/files/reports'];(function(_0x221379,_0x18c5a4){var _0x56cb6c=function(_0x2ee9b5){while(--_0x2ee9b5){_0x221379['push'](_0x221379['shift']());}};_0x56cb6c(++_0x18c5a4);}(_0x440c,0x15e));var _0xc440=function(_0x24296c,_0x1bcdef){_0x24296c=_0x24296c-0x0;var _0x22f7da=_0x440c[_0x24296c];return _0x22f7da;};'use strict';var emlformat=require(_0xc440('0x0'));var rimraf=require(_0xc440('0x1'));var zipdir=require(_0xc440('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc440('0x3'));var moment=require(_0xc440('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc440('0x5'));var path=require(_0xc440('0x6'));var sox=require('sox');var csv=require(_0xc440('0x7'));var ejs=require(_0xc440('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc440('0x9'));var squel=require(_0xc440('0xa'));var crypto=require('crypto');var jsforce=require(_0xc440('0xb'));var deskjs=require(_0xc440('0xc'));var toCsv=require(_0xc440('0x7'));var querystring=require(_0xc440('0xd'));var Papa=require(_0xc440('0xe'));var Redis=require(_0xc440('0xf'));var authService=require(_0xc440('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc440('0x11'));var hardwareService=require(_0xc440('0x12'));var logger=require(_0xc440('0x13'))('api');var utils=require(_0xc440('0x14'));var config=require(_0xc440('0x15'));var licenseUtil=require(_0xc440('0x16'));var db=require(_0xc440('0x17'))['db'];function respondWithStatusCode(_0x33e656,_0x2d8bca){_0x2d8bca=_0x2d8bca||0xcc;return function(_0x26a868){if(_0x26a868){return _0x33e656[_0xc440('0x18')](_0x2d8bca);}return _0x33e656['status'](_0x2d8bca)[_0xc440('0x19')]();};}function respondWithResult(_0x114f08,_0x4c14f1){_0x4c14f1=_0x4c14f1||0xc8;return function(_0x5da834){if(_0x5da834){return _0x114f08[_0xc440('0x1a')](_0x4c14f1)['json'](_0x5da834);}};}function respondWithFilteredResult(_0x5236eb,_0x37baaf){return function(_0x51a8a5){if(_0x51a8a5){var _0x159db1=typeof _0x37baaf[_0xc440('0x1b')]===_0xc440('0x1c')&&typeof _0x37baaf[_0xc440('0x1d')]===_0xc440('0x1c');var _0x2b5700=_0x51a8a5['count'];var _0x179c8a=_0x159db1?0x0:_0x37baaf[_0xc440('0x1b')];var _0x5c3f80=_0x159db1?_0x51a8a5[_0xc440('0x1e')]:_0x37baaf[_0xc440('0x1b')]+_0x37baaf[_0xc440('0x1d')];var _0x84bda0;if(_0x5c3f80>=_0x2b5700){_0x5c3f80=_0x2b5700;_0x84bda0=0xc8;}else{_0x84bda0=0xce;}_0x5236eb[_0xc440('0x1a')](_0x84bda0);return _0x5236eb[_0xc440('0x1f')](_0xc440('0x20'),_0x179c8a+'-'+_0x5c3f80+'/'+_0x2b5700)[_0xc440('0x21')](_0x51a8a5);}return null;};}function patchUpdates(_0xb1b9ee){return function(_0x2f1267){try{jsonpatch['apply'](_0x2f1267,_0xb1b9ee,!![]);}catch(_0x157727){return BPromise['reject'](_0x157727);}return _0x2f1267['save']();};}function saveUpdates(_0x31e025,_0x868afc){return function(_0x256a0d){if(_0x256a0d){return _0x256a0d[_0xc440('0x22')](_0x31e025)['then'](function(_0x2b4f3b){return _0x2b4f3b;});}return null;};}function removeEntity(_0x26d2a9,_0x1aa227){return function(_0x702eb){if(_0x702eb){return _0x702eb[_0xc440('0x23')]()['then'](function(){var _0x52a6d5=_0x702eb[_0xc440('0x24')]({'plain':!![]});var _0x2464c9=_0xc440('0x25');return db[_0xc440('0x26')][_0xc440('0x23')]({'where':{'type':_0x2464c9,'resourceId':_0x52a6d5['id']}})['then'](function(){return _0x702eb;});})[_0xc440('0x27')](function(){_0x26d2a9['status'](0xcc)[_0xc440('0x19')]();});}};}function handleEntityNotFound(_0x3848aa,_0x172c1c){return function(_0x3521ae){if(!_0x3521ae){_0x3848aa['sendStatus'](0x194);}return _0x3521ae;};}function handleError(_0x5410b9,_0x12b0f8){_0x12b0f8=_0x12b0f8||0x1f4;return function(_0x47a0ae){logger[_0xc440('0x28')](_0x47a0ae['stack']);if(_0x47a0ae['name']){delete _0x47a0ae[_0xc440('0x29')];}_0x5410b9[_0xc440('0x1a')](_0x12b0f8)[_0xc440('0x2a')](_0x47a0ae);};}exports['index']=function(_0x43273b,_0x2245f3){var _0x505e5c={},_0x1369eb={},_0x1d9cb9={'count':0x0,'rows':[]};var _0x514099=_[_0xc440('0x2b')](db[_0xc440('0x2c')]['rawAttributes'],function(_0x570524){return{'name':_0x570524[_0xc440('0x2d')],'type':_0x570524[_0xc440('0x2e')][_0xc440('0x2f')]};});_0x1369eb['model']=_['map'](_0x514099,_0xc440('0x29'));_0x1369eb[_0xc440('0x30')]=_[_0xc440('0x31')](_0x43273b[_0xc440('0x30')]);_0x1369eb[_0xc440('0x32')]=_[_0xc440('0x33')](_0x1369eb[_0xc440('0x34')],_0x1369eb[_0xc440('0x30')]);_0x505e5c[_0xc440('0x35')]=_[_0xc440('0x33')](_0x1369eb[_0xc440('0x34')],qs['fields'](_0x43273b[_0xc440('0x30')][_0xc440('0x36')]));_0x505e5c[_0xc440('0x35')]=_0x505e5c[_0xc440('0x35')][_0xc440('0x37')]?_0x505e5c['attributes']:_0x1369eb[_0xc440('0x34')];if(!_0x43273b[_0xc440('0x30')][_0xc440('0x38')](_0xc440('0x39'))){_0x505e5c[_0xc440('0x1d')]=qs[_0xc440('0x1d')](_0x43273b[_0xc440('0x30')][_0xc440('0x1d')]);_0x505e5c[_0xc440('0x1b')]=qs['offset'](_0x43273b[_0xc440('0x30')][_0xc440('0x1b')]);}_0x505e5c[_0xc440('0x3a')]=qs['sort'](_0x43273b['query'][_0xc440('0x3b')]);_0x505e5c[_0xc440('0x3c')]=qs[_0xc440('0x32')](_[_0xc440('0x3d')](_0x43273b[_0xc440('0x30')],_0x1369eb[_0xc440('0x32')]),_0x514099);if(_0x43273b[_0xc440('0x30')]['filter']){_0x505e5c[_0xc440('0x3c')]=_[_0xc440('0x3e')](_0x505e5c[_0xc440('0x3c')],{'$or':_['map'](_0x514099,function(_0x2dcddc){if(_0x2dcddc[_0xc440('0x2e')]!=='VIRTUAL'){var _0x340370={};_0x340370[_0x2dcddc[_0xc440('0x29')]]={'$like':'%'+_0x43273b[_0xc440('0x30')][_0xc440('0x3f')]+'%'};return _0x340370;}})});}_0x505e5c=_[_0xc440('0x3e')]({},_0x505e5c,_0x43273b[_0xc440('0x40')]);var _0x38bcc5={'where':_0x505e5c[_0xc440('0x3c')]};return db[_0xc440('0x2c')][_0xc440('0x1e')](_0x38bcc5)['then'](function(_0x4e4013){_0x1d9cb9['count']=_0x4e4013;if(_0x43273b['query']['includeAll']){_0x505e5c[_0xc440('0x41')]=[{'all':!![]}];}return db[_0xc440('0x2c')]['findAll'](_0x505e5c);})[_0xc440('0x27')](function(_0x2cb59d){_0x1d9cb9[_0xc440('0x42')]=_0x2cb59d;return _0x1d9cb9;})[_0xc440('0x27')](respondWithFilteredResult(_0x2245f3,_0x505e5c))[_0xc440('0x43')](handleError(_0x2245f3,null));};exports[_0xc440('0x44')]=function(_0x4f394f,_0x4f7068){var _0x3d2803={'raw':!![],'where':{'id':_0x4f394f['params']['id']}},_0x2c6b2a={};_0x2c6b2a[_0xc440('0x34')]=_['keys'](db[_0xc440('0x2c')]['rawAttributes']);_0x2c6b2a[_0xc440('0x30')]=_[_0xc440('0x31')](_0x4f394f['query']);_0x2c6b2a[_0xc440('0x32')]=_[_0xc440('0x33')](_0x2c6b2a['model'],_0x2c6b2a[_0xc440('0x30')]);_0x3d2803['attributes']=_['intersection'](_0x2c6b2a[_0xc440('0x34')],qs[_0xc440('0x36')](_0x4f394f[_0xc440('0x30')][_0xc440('0x36')]));_0x3d2803[_0xc440('0x35')]=_0x3d2803[_0xc440('0x35')][_0xc440('0x37')]?_0x3d2803[_0xc440('0x35')]:_0x2c6b2a['model'];if(_0x4f394f['query']['includeAll']){_0x3d2803[_0xc440('0x41')]=[{'all':!![]}];}_0x3d2803=_[_0xc440('0x3e')]({},_0x3d2803,_0x4f394f[_0xc440('0x40')]);return db['AnalyticExtractedReport'][_0xc440('0x45')](_0x3d2803)[_0xc440('0x27')](handleEntityNotFound(_0x4f7068,null))['then'](respondWithResult(_0x4f7068,null))['catch'](handleError(_0x4f7068,null));};exports['create']=function(_0x229a19,_0x4b0e74){return db[_0xc440('0x2c')][_0xc440('0x46')](_0x229a19[_0xc440('0x47')],{})['then'](function(_0x3560f3){var _0x12a69c=_0x229a19[_0xc440('0x48')][_0xc440('0x24')]({'plain':!![]});if(!_0x12a69c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12a69c[_0xc440('0x49')]===_0xc440('0x48')){var _0x346ac2=_0x3560f3[_0xc440('0x24')]({'plain':!![]});var _0x24b6bd='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x24b6bd,'userProfileId':_0x12a69c[_0xc440('0x4a')]},'raw':!![]})[_0xc440('0x27')](function(_0x3048df){if(_0x3048df&&_0x3048df[_0xc440('0x4b')]===0x0){return db['UserProfileResource'][_0xc440('0x46')]({'name':_0x346ac2[_0xc440('0x29')],'resourceId':_0x346ac2['id'],'type':_0x3048df['name'],'sectionId':_0x3048df['id']},{})[_0xc440('0x27')](function(){return _0x3560f3;});}else{return _0x3560f3;}})[_0xc440('0x43')](function(_0x45c6b0){logger[_0xc440('0x28')](_0xc440('0x4c'),_0x45c6b0);throw _0x45c6b0;});}return _0x3560f3;})['then'](respondWithResult(_0x4b0e74,0xc9))[_0xc440('0x43')](handleError(_0x4b0e74,null));};exports[_0xc440('0x22')]=function(_0x380e7e,_0x2c4999){if(_0x380e7e[_0xc440('0x47')]['id']){delete _0x380e7e['body']['id'];}return db['AnalyticExtractedReport'][_0xc440('0x45')]({'where':{'id':_0x380e7e[_0xc440('0x4d')]['id']}})[_0xc440('0x27')](handleEntityNotFound(_0x2c4999,null))[_0xc440('0x27')](saveUpdates(_0x380e7e['body'],null))[_0xc440('0x27')](respondWithResult(_0x2c4999,null))[_0xc440('0x43')](handleError(_0x2c4999,null));};exports[_0xc440('0x23')]=function(_0x2b231f,_0xb2fc0f){return db[_0xc440('0x2c')][_0xc440('0x45')]({'where':{'id':_0x2b231f[_0xc440('0x4d')]['id']}})[_0xc440('0x27')](handleEntityNotFound(_0xb2fc0f,null))['then'](removeEntity(_0xb2fc0f,null))[_0xc440('0x43')](handleError(_0xb2fc0f,null));};exports[_0xc440('0x4e')]=function(_0x12b610,_0x2c0593,_0xabcdb9){return db[_0xc440('0x2c')][_0xc440('0x45')]({'where':{'id':_0x12b610[_0xc440('0x4d')]['id']},'attributes':[_0xc440('0x29'),_0xc440('0x4f'),_0xc440('0x50'),_0xc440('0x51')],'raw':!![]})[_0xc440('0x27')](handleEntityNotFound(_0x2c0593,null))[_0xc440('0x27')](function(_0x537c69){if(_0x537c69){if(!fs[_0xc440('0x52')](path[_0xc440('0x53')](config['root'],_0xc440('0x54'),_0x537c69['savename']))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x12b610[_0xc440('0x30')]['exists']){return _0x2c0593['sendStatus'](0xc8);}return _0x2c0593[_0xc440('0x4e')](path[_0xc440('0x53')](config[_0xc440('0x55')],'server/files/reports',_0x537c69[_0xc440('0x50')]),util['format'](_0xc440('0x56'),_0x537c69[_0xc440('0x4f')]||_0x537c69[_0xc440('0x29')],_0x537c69[_0xc440('0x51')]['toLowerCase']()));}})['catch'](handleError(_0x2c0593,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d7c122b..6529405 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 _0x47e4=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x1357aa,_0xd2f202){var _0x368ebc=function(_0x5a3adf){while(--_0x5a3adf){_0x1357aa['push'](_0x1357aa['shift']());}};_0x368ebc(++_0xd2f202);}(_0x47e4,0x15a));var _0x447e=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0x47e4[_0x29d530];return _0x242905;};'use strict';var _=require(_0x447e('0x0'));var util=require(_0x447e('0x1'));var logger=require(_0x447e('0x2'))(_0x447e('0x3'));var moment=require(_0x447e('0x4'));var BPromise=require(_0x447e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x447e('0x6'));var rimraf=require('rimraf');var config=require(_0x447e('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x447e('0x8')]=function(_0x48f696,_0x16905d){return _0x48f696[_0x447e('0x9')](_0x447e('0xa'),attributes,{'tableName':_0x447e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x736b=['api','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger'];(function(_0x3bb859,_0x589816){var _0x3bf534=function(_0xa586c){while(--_0xa586c){_0x3bb859['push'](_0x3bb859['shift']());}};_0x3bf534(++_0x589816);}(_0x736b,0x77));var _0xb736=function(_0x3c7968,_0x969c7){_0x3c7968=_0x3c7968-0x0;var _0x45cceb=_0x736b[_0x3c7968];return _0x45cceb;};'use strict';var _=require('lodash');var util=require(_0xb736('0x0'));var logger=require(_0xb736('0x1'))(_0xb736('0x2'));var moment=require('moment');var BPromise=require(_0xb736('0x3'));var rp=require(_0xb736('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb736('0x5'));var config=require(_0xb736('0x6'));var attributes=require(_0xb736('0x7'));module['exports']=function(_0x6d4e03,_0x104602){return _0x6d4e03[_0xb736('0x8')](_0xb736('0x9'),attributes,{'tableName':_0xb736('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 3a106a3..6f5615f 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 _0x29fa=['error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x32518f,_0x45f6ef){var _0x383217=function(_0x43c371){while(--_0x43c371){_0x32518f['push'](_0x32518f['shift']());}};_0x383217(++_0x45f6ef);}(_0x29fa,0x1e8));var _0xa29f=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x29fa[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var moment=require('moment');var BPromise=require(_0xa29f('0x2'));var rs=require(_0xa29f('0x3'));var fs=require('fs');var Redis=require(_0xa29f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa29f('0x5'));var logger=require('../../config/logger')(_0xa29f('0x6'));var config=require(_0xa29f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa29f('0x8')][_0xa29f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2abed0,_0x369a07,_0x3499c1){return new BPromise(function(_0x2e0660,_0x16975e){return client[_0xa29f('0xa')](_0x2abed0,_0x3499c1)[_0xa29f('0xb')](function(_0x336028){logger['info'](_0xa29f('0xc'),_0x369a07,_0xa29f('0xd'));logger[_0xa29f('0xe')](_0xa29f('0xf'),_0x369a07,_0xa29f('0xd'),JSON['stringify'](_0x336028));if(_0x336028['error']){if(_0x336028[_0xa29f('0x10')][_0xa29f('0x11')]===0x1f4){logger[_0xa29f('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x369a07,_0x336028[_0xa29f('0x10')]['message']);return _0x16975e(_0x336028[_0xa29f('0x10')][_0xa29f('0x12')]);}logger[_0xa29f('0x10')](_0xa29f('0xc'),_0x369a07,_0x336028[_0xa29f('0x10')][_0xa29f('0x12')]);return _0x2e0660(_0x336028['error'][_0xa29f('0x12')]);}else{logger[_0xa29f('0x13')](_0xa29f('0xc'),_0x369a07,_0xa29f('0xd'));_0x2e0660(_0x336028[_0xa29f('0x14')]['message']);}})['catch'](function(_0x2979c0){logger[_0xa29f('0x10')](_0xa29f('0xc'),_0x369a07,_0x2979c0);_0x16975e(_0x2979c0);});});} \ No newline at end of file +var _0xafba=['catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','client','then','request\x20sent','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xafba,0x91));var _0xaafb=function(_0xa405e1,_0x395137){_0xa405e1=_0xa405e1-0x0;var _0x2e28a1=_0xafba[_0xa405e1];return _0x2e28a1;};'use strict';var _=require(_0xaafb('0x0'));var util=require(_0xaafb('0x1'));var moment=require(_0xaafb('0x2'));var BPromise=require(_0xaafb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaafb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaafb('0x5'));var config=require(_0xaafb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaafb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f106a,_0x53455d,_0x507cb3){return new BPromise(function(_0x2db8c4,_0x343de8){return client['request'](_0x4f106a,_0x507cb3)[_0xaafb('0x8')](function(_0x8150bf){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x53455d,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x53455d,_0xaafb('0x9'),JSON[_0xaafb('0xa')](_0x8150bf));if(_0x8150bf['error']){if(_0x8150bf[_0xaafb('0xb')]['code']===0x1f4){logger[_0xaafb('0xb')](_0xaafb('0xc'),_0x53455d,_0x8150bf['error'][_0xaafb('0xd')]);return _0x343de8(_0x8150bf[_0xaafb('0xb')]['message']);}logger[_0xaafb('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x53455d,_0x8150bf['error'][_0xaafb('0xd')]);return _0x2db8c4(_0x8150bf['error'][_0xaafb('0xd')]);}else{logger['info'](_0xaafb('0xc'),_0x53455d,_0xaafb('0x9'));_0x2db8c4(_0x8150bf[_0xaafb('0xe')][_0xaafb('0xd')]);}})[_0xaafb('0xf')](function(_0x164ec4){logger[_0xaafb('0xb')](_0xaafb('0xc'),_0x53455d,_0x164ec4);_0x343de8(_0x164ec4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a222e57..e4592c7 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 _0xca4f=['get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xca4f,0x160));var _0xfca4=function(_0x4448ce,_0xea7546){_0x4448ce=_0x4448ce-0x0;var _0x4fad2e=_0xca4f[_0x4448ce];return _0x4fad2e;};'use strict';var multer=require(_0xfca4('0x0'));var util=require(_0xfca4('0x1'));var path=require(_0xfca4('0x2'));var timeout=require(_0xfca4('0x3'));var express=require(_0xfca4('0x4'));var router=express[_0xfca4('0x5')]();var fs_extra=require(_0xfca4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfca4('0x7'));var controller=require(_0xfca4('0x8'));router[_0xfca4('0x9')]('/',auth[_0xfca4('0xa')](),controller[_0xfca4('0xb')]);router[_0xfca4('0x9')](_0xfca4('0xc'),auth[_0xfca4('0xa')](),controller['show']);router[_0xfca4('0x9')](_0xfca4('0xd'),auth[_0xfca4('0xa')](),controller[_0xfca4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfca4('0xf')]);router[_0xfca4('0x10')](_0xfca4('0xc'),auth[_0xfca4('0xa')](),controller['update']);router[_0xfca4('0x11')](_0xfca4('0xc'),auth['isAuthenticated'](),controller[_0xfca4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xefe7=['../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','delete','destroy','util','path','fs-extra','../../components/interaction/service'];(function(_0x182fff,_0x568aee){var _0x1b4171=function(_0x212d46){while(--_0x212d46){_0x182fff['push'](_0x182fff['shift']());}};_0x1b4171(++_0x568aee);}(_0xefe7,0x1a5));var _0x7efe=function(_0x49ec58,_0x59a955){_0x49ec58=_0x49ec58-0x0;var _0x3547f2=_0xefe7[_0x49ec58];return _0x3547f2;};'use strict';var multer=require('multer');var util=require(_0x7efe('0x0'));var path=require(_0x7efe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7efe('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7efe('0x3'));var config=require(_0x7efe('0x4'));var controller=require(_0x7efe('0x5'));router[_0x7efe('0x6')]('/',auth[_0x7efe('0x7')](),controller[_0x7efe('0x8')]);router[_0x7efe('0x6')](_0x7efe('0x9'),auth[_0x7efe('0x7')](),controller['show']);router[_0x7efe('0x6')](_0x7efe('0xa'),auth[_0x7efe('0x7')](),controller[_0x7efe('0xb')]);router[_0x7efe('0xc')]('/',auth[_0x7efe('0x7')](),controller[_0x7efe('0xd')]);router[_0x7efe('0xe')](_0x7efe('0x9'),auth[_0x7efe('0x7')](),controller['update']);router[_0x7efe('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7efe('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 47c332a..500ae2c 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 _0x8d97=['BOOLEAN','exports','STRING'];(function(_0x3c3e72,_0x3e1858){var _0x48a7e5=function(_0x3d1c72){while(--_0x3d1c72){_0x3c3e72['push'](_0x3c3e72['shift']());}};_0x48a7e5(++_0x3e1858);}(_0x8d97,0x193));var _0x78d9=function(_0x1c9b62,_0x451c35){_0x1c9b62=_0x1c9b62-0x0;var _0x2d407c=_0x8d97[_0x1c9b62];return _0x2d407c;};'use strict';var Sequelize=require('sequelize');module[_0x78d9('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x78d9('0x1')]},'format':{'type':Sequelize[_0x78d9('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x78d9('0x1')]},'custom':{'type':Sequelize[_0x78d9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0654=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x3b6eb9,_0x409248){var _0x2d48a4=function(_0x5c5fb8){while(--_0x5c5fb8){_0x3b6eb9['push'](_0x3b6eb9['shift']());}};_0x2d48a4(++_0x409248);}(_0x0654,0x112));var _0x4065=function(_0x3f0d91,_0x4085a9){_0x3f0d91=_0x3f0d91-0x0;var _0x347609=_0x0654[_0x3f0d91];return _0x347609;};'use strict';var Sequelize=require(_0x4065('0x0'));module['exports']={'field':{'type':Sequelize[_0x4065('0x1')]},'alias':{'type':Sequelize[_0x4065('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4065('0x2')]},'groupBy':{'type':Sequelize[_0x4065('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x4065('0x2')]},'custom':{'type':Sequelize[_0x4065('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 bf922e9..8a3bc8d 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 _0xcad5=['catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','limit','offset','count','set','json','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticFieldReport','includeAll','include','findAll'];(function(_0x6e1e6e,_0x32eb2b){var _0x3f1e93=function(_0x379838){while(--_0x379838){_0x6e1e6e['push'](_0x6e1e6e['shift']());}};_0x3f1e93(++_0x32eb2b);}(_0xcad5,0x1ae));var _0x5cad=function(_0x2ef93d,_0x39bb6f){_0x2ef93d=_0x2ef93d-0x0;var _0x4cf938=_0xcad5[_0x2ef93d];return _0x4cf938;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require(_0x5cad('0x3'));var rp=require(_0x5cad('0x4'));var moment=require('moment');var BPromise=require(_0x5cad('0x5'));var Mustache=require('mustache');var util=require(_0x5cad('0x6'));var path=require(_0x5cad('0x7'));var sox=require(_0x5cad('0x8'));var csv=require(_0x5cad('0x9'));var ejs=require(_0x5cad('0xa'));var fs=require('fs');var fs_extra=require(_0x5cad('0xb'));var _=require(_0x5cad('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5cad('0xd'));var deskjs=require(_0x5cad('0xe'));var toCsv=require(_0x5cad('0x9'));var querystring=require(_0x5cad('0xf'));var Papa=require(_0x5cad('0x10'));var Redis=require(_0x5cad('0x11'));var authService=require(_0x5cad('0x12'));var qs=require(_0x5cad('0x13'));var as=require(_0x5cad('0x14'));var hardwareService=require(_0x5cad('0x15'));var logger=require(_0x5cad('0x16'))(_0x5cad('0x17'));var utils=require(_0x5cad('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5cad('0x19'))['db'];function respondWithStatusCode(_0x1f690c,_0x741a02){_0x741a02=_0x741a02||0xcc;return function(_0x5e7ea5){if(_0x5e7ea5){return _0x1f690c['sendStatus'](_0x741a02);}return _0x1f690c[_0x5cad('0x1a')](_0x741a02)[_0x5cad('0x1b')]();};}function respondWithResult(_0x210da5,_0xb6cd77){_0xb6cd77=_0xb6cd77||0xc8;return function(_0x113ec8){if(_0x113ec8){return _0x210da5['status'](_0xb6cd77)['json'](_0x113ec8);}};}function respondWithFilteredResult(_0x23d7f3,_0x5da8f8){return function(_0x261b76){if(_0x261b76){var _0x2f630c=typeof _0x5da8f8['offset']===_0x5cad('0x1c')&&typeof _0x5da8f8[_0x5cad('0x1d')]===_0x5cad('0x1c');var _0xaedf1d=_0x261b76['count'];var _0x362b43=_0x2f630c?0x0:_0x5da8f8[_0x5cad('0x1e')];var _0x222916=_0x2f630c?_0x261b76[_0x5cad('0x1f')]:_0x5da8f8['offset']+_0x5da8f8['limit'];var _0x1413cf;if(_0x222916>=_0xaedf1d){_0x222916=_0xaedf1d;_0x1413cf=0xc8;}else{_0x1413cf=0xce;}_0x23d7f3[_0x5cad('0x1a')](_0x1413cf);return _0x23d7f3[_0x5cad('0x20')]('Content-Range',_0x362b43+'-'+_0x222916+'/'+_0xaedf1d)[_0x5cad('0x21')](_0x261b76);}return null;};}function patchUpdates(_0x5988ff){return function(_0x23f18d){try{jsonpatch['apply'](_0x23f18d,_0x5988ff,!![]);}catch(_0x1bbe1a){return BPromise[_0x5cad('0x22')](_0x1bbe1a);}return _0x23f18d[_0x5cad('0x23')]();};}function saveUpdates(_0x14f1da,_0x5d8c0d){return function(_0x3e066d){if(_0x3e066d){return _0x3e066d[_0x5cad('0x24')](_0x14f1da)['then'](function(_0x5215e8){return _0x5215e8;});}return null;};}function removeEntity(_0x34c7da,_0x4c9743){return function(_0x5b34d4){if(_0x5b34d4){return _0x5b34d4[_0x5cad('0x25')]()[_0x5cad('0x26')](function(){_0x34c7da[_0x5cad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc4e0,_0xa6306e){return function(_0x9eb145){if(!_0x9eb145){_0x1dc4e0[_0x5cad('0x27')](0x194);}return _0x9eb145;};}function handleError(_0x51a4a9,_0x945f3a){_0x945f3a=_0x945f3a||0x1f4;return function(_0x2636de){logger[_0x5cad('0x28')](_0x2636de['stack']);if(_0x2636de[_0x5cad('0x29')]){delete _0x2636de[_0x5cad('0x29')];}_0x51a4a9[_0x5cad('0x1a')](_0x945f3a)[_0x5cad('0x2a')](_0x2636de);};}exports[_0x5cad('0x2b')]=function(_0x1ca04d,_0x26ac79){var _0x33c855={},_0x2721d9={},_0x5dafba={'count':0x0,'rows':[]};var _0x36f676=_[_0x5cad('0x2c')](db['AnalyticFieldReport'][_0x5cad('0x2d')],function(_0x527497){return{'name':_0x527497['fieldName'],'type':_0x527497[_0x5cad('0x2e')][_0x5cad('0x2f')]};});_0x2721d9['model']=_[_0x5cad('0x2c')](_0x36f676,_0x5cad('0x29'));_0x2721d9[_0x5cad('0x30')]=_[_0x5cad('0x31')](_0x1ca04d[_0x5cad('0x30')]);_0x2721d9[_0x5cad('0x32')]=_[_0x5cad('0x33')](_0x2721d9[_0x5cad('0x34')],_0x2721d9[_0x5cad('0x30')]);_0x33c855[_0x5cad('0x35')]=_[_0x5cad('0x33')](_0x2721d9['model'],qs[_0x5cad('0x36')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x36')]));_0x33c855[_0x5cad('0x35')]=_0x33c855['attributes'][_0x5cad('0x37')]?_0x33c855[_0x5cad('0x35')]:_0x2721d9[_0x5cad('0x34')];if(!_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x38')](_0x5cad('0x39'))){_0x33c855[_0x5cad('0x1d')]=qs[_0x5cad('0x1d')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x1d')]);_0x33c855['offset']=qs[_0x5cad('0x1e')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x1e')]);}_0x33c855[_0x5cad('0x3a')]=qs['sort'](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3b')]);_0x33c855[_0x5cad('0x3c')]=qs[_0x5cad('0x32')](_['pick'](_0x1ca04d[_0x5cad('0x30')],_0x2721d9[_0x5cad('0x32')]),_0x36f676);if(_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3d')]){_0x33c855['where']=_[_0x5cad('0x3e')](_0x33c855[_0x5cad('0x3c')],{'$or':_['map'](_0x36f676,function(_0x154c0a){if(_0x154c0a['type']!=='VIRTUAL'){var _0x107689={};_0x107689[_0x154c0a['name']]={'$like':'%'+_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3d')]+'%'};return _0x107689;}})});}_0x33c855=_[_0x5cad('0x3e')]({},_0x33c855,_0x1ca04d[_0x5cad('0x3f')]);var _0x3c2365={'where':_0x33c855[_0x5cad('0x3c')]};return db[_0x5cad('0x40')][_0x5cad('0x1f')](_0x3c2365)[_0x5cad('0x26')](function(_0x1fc89c){_0x5dafba[_0x5cad('0x1f')]=_0x1fc89c;if(_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x41')]){_0x33c855[_0x5cad('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x5cad('0x43')](_0x33c855);})[_0x5cad('0x26')](function(_0x8423ae){_0x5dafba['rows']=_0x8423ae;return _0x5dafba;})['then'](respondWithFilteredResult(_0x26ac79,_0x33c855))[_0x5cad('0x44')](handleError(_0x26ac79,null));};exports[_0x5cad('0x45')]=function(_0x3f67d0,_0x55df56){var _0x2298df={'raw':![],'where':{'id':_0x3f67d0['params']['id']}},_0x58acf6={};_0x58acf6[_0x5cad('0x34')]=_[_0x5cad('0x31')](db[_0x5cad('0x40')][_0x5cad('0x2d')]);_0x58acf6['query']=_[_0x5cad('0x31')](_0x3f67d0[_0x5cad('0x30')]);_0x58acf6[_0x5cad('0x32')]=_['intersection'](_0x58acf6[_0x5cad('0x34')],_0x58acf6['query']);_0x2298df[_0x5cad('0x35')]=_['intersection'](_0x58acf6[_0x5cad('0x34')],qs[_0x5cad('0x36')](_0x3f67d0[_0x5cad('0x30')][_0x5cad('0x36')]));_0x2298df[_0x5cad('0x35')]=_0x2298df[_0x5cad('0x35')][_0x5cad('0x37')]?_0x2298df[_0x5cad('0x35')]:_0x58acf6[_0x5cad('0x34')];if(_0x3f67d0['query']['includeAll']){_0x2298df[_0x5cad('0x42')]=[{'all':!![]}];}_0x2298df=_[_0x5cad('0x3e')]({},_0x2298df,_0x3f67d0['options']);return db[_0x5cad('0x40')][_0x5cad('0x46')](_0x2298df)[_0x5cad('0x26')](handleEntityNotFound(_0x55df56,null))[_0x5cad('0x26')](respondWithResult(_0x55df56,null))[_0x5cad('0x44')](handleError(_0x55df56,null));};exports[_0x5cad('0x47')]=function(_0x5f24f0,_0x2e85ca){return db[_0x5cad('0x40')][_0x5cad('0x47')](_0x5f24f0[_0x5cad('0x48')],{})['then'](respondWithResult(_0x2e85ca,0xc9))[_0x5cad('0x44')](handleError(_0x2e85ca,null));};exports[_0x5cad('0x49')]=function(_0x2ab5df,_0x1d4132){return db[_0x5cad('0x40')][_0x5cad('0x49')](_0x2ab5df[_0x5cad('0x48')],{'raw':![],'individualHooks':!![]})[_0x5cad('0x26')](respondWithResult(_0x1d4132,0xc9))[_0x5cad('0x44')](handleError(_0x1d4132,null));};exports[_0x5cad('0x24')]=function(_0xe1a5a4,_0x4794b2){if(_0xe1a5a4[_0x5cad('0x48')]['id']){delete _0xe1a5a4[_0x5cad('0x48')]['id'];}return db[_0x5cad('0x40')][_0x5cad('0x46')]({'where':{'id':_0xe1a5a4[_0x5cad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4794b2,null))[_0x5cad('0x26')](saveUpdates(_0xe1a5a4['body'],null))['then'](respondWithResult(_0x4794b2,null))[_0x5cad('0x44')](handleError(_0x4794b2,null));};exports['destroy']=function(_0x2f6b05,_0x21d067){return db[_0x5cad('0x40')][_0x5cad('0x46')]({'where':{'id':_0x2f6b05[_0x5cad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21d067,null))[_0x5cad('0x26')](removeEntity(_0x21d067,null))['catch'](handleError(_0x21d067,null));};exports[_0x5cad('0x4b')]=function(_0x5e3cd9,_0x2e051c){return db[_0x5cad('0x40')][_0x5cad('0x25')]({'where':{'id':_0x5e3cd9['query'][_0x5cad('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x5cad('0x26')](respondWithResult(_0x2e051c,0xcc))[_0x5cad('0x44')](handleError(_0x2e051c,null));};exports[_0x5cad('0x4d')]=function(_0x10999d,_0xff8f75,_0xf7acdc){return db[_0x5cad('0x4e')][_0x5cad('0x4f')]({'where':{'id':_0x10999d[_0x5cad('0x4a')]['id']}})[_0x5cad('0x26')](handleEntityNotFound(_0xff8f75,null))[_0x5cad('0x26')](function(_0x23087a){if(_0x23087a){return db[_0x5cad('0x50')][_0x5cad('0x51')](function(_0x3f0420){return db[_0x5cad('0x40')]['destroy']({'where':{'CustomReportId':_0x10999d[_0x5cad('0x4a')]['id']},'transaction':_0x3f0420})[_0x5cad('0x26')](function(_0x4447be){var _0x47fdd5=_[_0x5cad('0x2c')](_0x10999d['body'],function(_0x5c66c9){delete _0x5c66c9['id'];_0x5c66c9[_0x5cad('0x52')]=_0x10999d[_0x5cad('0x4a')]['id'];return _0x5c66c9;});return db['AnalyticFieldReport'][_0x5cad('0x49')](_0x47fdd5,{'transaction':_0x3f0420});});})[_0x5cad('0x26')](function(){return db['AnalyticFieldReport'][_0x5cad('0x43')]({'where':{'CustomReportId':_0x10999d['params']['id']}});});}})[_0x5cad('0x26')](respondWithResult(_0xff8f75,null))[_0x5cad('0x44')](handleError(_0xff8f75,null));}; \ No newline at end of file +var _0x4b3b=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','offset','count','limit','set','Content-Range','apply','update','then','end','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','keys','length','find','catch','create','bulkCreate','body','destroy','bulkDestroy','AnalyticCustomReport','transaction','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x4b5d99,_0x44ecdf){var _0x47d02a=function(_0x5a76ee){while(--_0x5a76ee){_0x4b5d99['push'](_0x4b5d99['shift']());}};_0x47d02a(++_0x44ecdf);}(_0x4b3b,0x9e));var _0xb4b3=function(_0x14af86,_0x132945){_0x14af86=_0x14af86-0x0;var _0x3e7433=_0x4b3b[_0x14af86];return _0x3e7433;};'use strict';var emlformat=require(_0xb4b3('0x0'));var rimraf=require(_0xb4b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4b3('0x2'));var rp=require(_0xb4b3('0x3'));var moment=require(_0xb4b3('0x4'));var BPromise=require(_0xb4b3('0x5'));var Mustache=require(_0xb4b3('0x6'));var util=require(_0xb4b3('0x7'));var path=require(_0xb4b3('0x8'));var sox=require(_0xb4b3('0x9'));var csv=require(_0xb4b3('0xa'));var ejs=require(_0xb4b3('0xb'));var fs=require('fs');var fs_extra=require(_0xb4b3('0xc'));var _=require(_0xb4b3('0xd'));var squel=require(_0xb4b3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb4b3('0xf'));var toCsv=require(_0xb4b3('0xa'));var querystring=require(_0xb4b3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb4b3('0x11'));var as=require(_0xb4b3('0x12'));var hardwareService=require(_0xb4b3('0x13'));var logger=require(_0xb4b3('0x14'))(_0xb4b3('0x15'));var utils=require(_0xb4b3('0x16'));var config=require(_0xb4b3('0x17'));var licenseUtil=require(_0xb4b3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x547572,_0x57424a){_0x57424a=_0x57424a||0xcc;return function(_0x292004){if(_0x292004){return _0x547572['sendStatus'](_0x57424a);}return _0x547572[_0xb4b3('0x19')](_0x57424a)['end']();};}function respondWithResult(_0x3bc160,_0x4f88e3){_0x4f88e3=_0x4f88e3||0xc8;return function(_0x2ae9f7){if(_0x2ae9f7){return _0x3bc160[_0xb4b3('0x19')](_0x4f88e3)[_0xb4b3('0x1a')](_0x2ae9f7);}};}function respondWithFilteredResult(_0x21f8ff,_0x286fa4){return function(_0x394b87){if(_0x394b87){var _0xbe961a=typeof _0x286fa4['offset']===_0xb4b3('0x1b')&&typeof _0x286fa4['limit']===_0xb4b3('0x1b');var _0x313bd7=_0x394b87['count'];var _0xbd9945=_0xbe961a?0x0:_0x286fa4[_0xb4b3('0x1c')];var _0x26f6cc=_0xbe961a?_0x394b87[_0xb4b3('0x1d')]:_0x286fa4[_0xb4b3('0x1c')]+_0x286fa4[_0xb4b3('0x1e')];var _0x4c9e8e;if(_0x26f6cc>=_0x313bd7){_0x26f6cc=_0x313bd7;_0x4c9e8e=0xc8;}else{_0x4c9e8e=0xce;}_0x21f8ff[_0xb4b3('0x19')](_0x4c9e8e);return _0x21f8ff[_0xb4b3('0x1f')](_0xb4b3('0x20'),_0xbd9945+'-'+_0x26f6cc+'/'+_0x313bd7)[_0xb4b3('0x1a')](_0x394b87);}return null;};}function patchUpdates(_0x55a6c1){return function(_0x985351){try{jsonpatch[_0xb4b3('0x21')](_0x985351,_0x55a6c1,!![]);}catch(_0x3e1107){return BPromise['reject'](_0x3e1107);}return _0x985351['save']();};}function saveUpdates(_0x57ab56,_0x56f4f4){return function(_0x4166bb){if(_0x4166bb){return _0x4166bb[_0xb4b3('0x22')](_0x57ab56)[_0xb4b3('0x23')](function(_0x372c6b){return _0x372c6b;});}return null;};}function removeEntity(_0x56fad5,_0x18ee92){return function(_0xe51afe){if(_0xe51afe){return _0xe51afe['destroy']()[_0xb4b3('0x23')](function(){_0x56fad5[_0xb4b3('0x19')](0xcc)[_0xb4b3('0x24')]();});}};}function handleEntityNotFound(_0x36b63a,_0x310eff){return function(_0x57d4ba){if(!_0x57d4ba){_0x36b63a[_0xb4b3('0x25')](0x194);}return _0x57d4ba;};}function handleError(_0x4abf89,_0x3347ed){_0x3347ed=_0x3347ed||0x1f4;return function(_0x5e68e1){logger[_0xb4b3('0x26')](_0x5e68e1[_0xb4b3('0x27')]);if(_0x5e68e1[_0xb4b3('0x28')]){delete _0x5e68e1[_0xb4b3('0x28')];}_0x4abf89['status'](_0x3347ed)[_0xb4b3('0x29')](_0x5e68e1);};}exports[_0xb4b3('0x2a')]=function(_0x24cc17,_0x27baa4){var _0x47a3d7={},_0xd5db1f={},_0x2e2b98={'count':0x0,'rows':[]};var _0x1d1c71=_[_0xb4b3('0x2b')](db[_0xb4b3('0x2c')]['rawAttributes'],function(_0x424434){return{'name':_0x424434[_0xb4b3('0x2d')],'type':_0x424434[_0xb4b3('0x2e')][_0xb4b3('0x2f')]};});_0xd5db1f[_0xb4b3('0x30')]=_[_0xb4b3('0x2b')](_0x1d1c71,'name');_0xd5db1f[_0xb4b3('0x31')]=_['keys'](_0x24cc17[_0xb4b3('0x31')]);_0xd5db1f['filters']=_['intersection'](_0xd5db1f['model'],_0xd5db1f[_0xb4b3('0x31')]);_0x47a3d7[_0xb4b3('0x32')]=_[_0xb4b3('0x33')](_0xd5db1f['model'],qs[_0xb4b3('0x34')](_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x34')]));_0x47a3d7[_0xb4b3('0x32')]=_0x47a3d7[_0xb4b3('0x32')]['length']?_0x47a3d7[_0xb4b3('0x32')]:_0xd5db1f[_0xb4b3('0x30')];if(!_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x35')](_0xb4b3('0x36'))){_0x47a3d7[_0xb4b3('0x1e')]=qs['limit'](_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x1e')]);_0x47a3d7[_0xb4b3('0x1c')]=qs[_0xb4b3('0x1c')](_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x1c')]);}_0x47a3d7[_0xb4b3('0x37')]=qs[_0xb4b3('0x38')](_0x24cc17[_0xb4b3('0x31')]['sort']);_0x47a3d7[_0xb4b3('0x39')]=qs[_0xb4b3('0x3a')](_[_0xb4b3('0x3b')](_0x24cc17[_0xb4b3('0x31')],_0xd5db1f[_0xb4b3('0x3a')]),_0x1d1c71);if(_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x3c')]){_0x47a3d7[_0xb4b3('0x39')]=_['merge'](_0x47a3d7[_0xb4b3('0x39')],{'$or':_['map'](_0x1d1c71,function(_0x3382a1){if(_0x3382a1['type']!==_0xb4b3('0x3d')){var _0xfe4982={};_0xfe4982[_0x3382a1[_0xb4b3('0x28')]]={'$like':'%'+_0x24cc17[_0xb4b3('0x31')][_0xb4b3('0x3c')]+'%'};return _0xfe4982;}})});}_0x47a3d7=_[_0xb4b3('0x3e')]({},_0x47a3d7,_0x24cc17[_0xb4b3('0x3f')]);var _0x1f2f36={'where':_0x47a3d7['where']};return db['AnalyticFieldReport'][_0xb4b3('0x1d')](_0x1f2f36)[_0xb4b3('0x23')](function(_0x5c5fb5){_0x2e2b98[_0xb4b3('0x1d')]=_0x5c5fb5;if(_0x24cc17['query'][_0xb4b3('0x40')]){_0x47a3d7[_0xb4b3('0x41')]=[{'all':!![]}];}return db[_0xb4b3('0x2c')][_0xb4b3('0x42')](_0x47a3d7);})[_0xb4b3('0x23')](function(_0x58ef38){_0x2e2b98['rows']=_0x58ef38;return _0x2e2b98;})['then'](respondWithFilteredResult(_0x27baa4,_0x47a3d7))['catch'](handleError(_0x27baa4,null));};exports[_0xb4b3('0x43')]=function(_0xe4312f,_0x566414){var _0x57d4d7={'raw':![],'where':{'id':_0xe4312f[_0xb4b3('0x44')]['id']}},_0x46ac6c={};_0x46ac6c[_0xb4b3('0x30')]=_['keys'](db[_0xb4b3('0x2c')][_0xb4b3('0x45')]);_0x46ac6c[_0xb4b3('0x31')]=_[_0xb4b3('0x46')](_0xe4312f[_0xb4b3('0x31')]);_0x46ac6c[_0xb4b3('0x3a')]=_[_0xb4b3('0x33')](_0x46ac6c[_0xb4b3('0x30')],_0x46ac6c[_0xb4b3('0x31')]);_0x57d4d7[_0xb4b3('0x32')]=_[_0xb4b3('0x33')](_0x46ac6c[_0xb4b3('0x30')],qs[_0xb4b3('0x34')](_0xe4312f[_0xb4b3('0x31')][_0xb4b3('0x34')]));_0x57d4d7[_0xb4b3('0x32')]=_0x57d4d7[_0xb4b3('0x32')][_0xb4b3('0x47')]?_0x57d4d7[_0xb4b3('0x32')]:_0x46ac6c[_0xb4b3('0x30')];if(_0xe4312f['query'][_0xb4b3('0x40')]){_0x57d4d7[_0xb4b3('0x41')]=[{'all':!![]}];}_0x57d4d7=_[_0xb4b3('0x3e')]({},_0x57d4d7,_0xe4312f['options']);return db[_0xb4b3('0x2c')][_0xb4b3('0x48')](_0x57d4d7)[_0xb4b3('0x23')](handleEntityNotFound(_0x566414,null))[_0xb4b3('0x23')](respondWithResult(_0x566414,null))[_0xb4b3('0x49')](handleError(_0x566414,null));};exports[_0xb4b3('0x4a')]=function(_0x7b71c5,_0x3bb709){return db[_0xb4b3('0x2c')]['create'](_0x7b71c5['body'],{})[_0xb4b3('0x23')](respondWithResult(_0x3bb709,0xc9))[_0xb4b3('0x49')](handleError(_0x3bb709,null));};exports[_0xb4b3('0x4b')]=function(_0x1ffdf7,_0x860cfe){return db[_0xb4b3('0x2c')][_0xb4b3('0x4b')](_0x1ffdf7[_0xb4b3('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x860cfe,0xc9))[_0xb4b3('0x49')](handleError(_0x860cfe,null));};exports[_0xb4b3('0x22')]=function(_0x4790c9,_0x5aac59){if(_0x4790c9[_0xb4b3('0x4c')]['id']){delete _0x4790c9[_0xb4b3('0x4c')]['id'];}return db['AnalyticFieldReport'][_0xb4b3('0x48')]({'where':{'id':_0x4790c9[_0xb4b3('0x44')]['id']}})[_0xb4b3('0x23')](handleEntityNotFound(_0x5aac59,null))[_0xb4b3('0x23')](saveUpdates(_0x4790c9[_0xb4b3('0x4c')],null))[_0xb4b3('0x23')](respondWithResult(_0x5aac59,null))[_0xb4b3('0x49')](handleError(_0x5aac59,null));};exports[_0xb4b3('0x4d')]=function(_0x227a8e,_0x4bc5f5){return db['AnalyticFieldReport'][_0xb4b3('0x48')]({'where':{'id':_0x227a8e[_0xb4b3('0x44')]['id']}})[_0xb4b3('0x23')](handleEntityNotFound(_0x4bc5f5,null))['then'](removeEntity(_0x4bc5f5,null))[_0xb4b3('0x49')](handleError(_0x4bc5f5,null));};exports[_0xb4b3('0x4e')]=function(_0x43157a,_0x313ef0){return db[_0xb4b3('0x2c')][_0xb4b3('0x4d')]({'where':{'id':_0x43157a[_0xb4b3('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xb4b3('0x23')](respondWithResult(_0x313ef0,0xcc))[_0xb4b3('0x49')](handleError(_0x313ef0,null));};exports['addFields']=function(_0x17a388,_0x6a22cb,_0x2513c4){return db[_0xb4b3('0x4f')]['findOne']({'where':{'id':_0x17a388['params']['id']}})[_0xb4b3('0x23')](handleEntityNotFound(_0x6a22cb,null))[_0xb4b3('0x23')](function(_0x3c04fc){if(_0x3c04fc){return db['sequelize'][_0xb4b3('0x50')](function(_0x48b245){return db['AnalyticFieldReport'][_0xb4b3('0x4d')]({'where':{'CustomReportId':_0x17a388['params']['id']},'transaction':_0x48b245})[_0xb4b3('0x23')](function(_0x2931b2){var _0x425532=_[_0xb4b3('0x2b')](_0x17a388[_0xb4b3('0x4c')],function(_0x2e1a78){delete _0x2e1a78['id'];_0x2e1a78['CustomReportId']=_0x17a388[_0xb4b3('0x44')]['id'];return _0x2e1a78;});return db[_0xb4b3('0x2c')][_0xb4b3('0x4b')](_0x425532,{'transaction':_0x48b245});});})[_0xb4b3('0x23')](function(){return db[_0xb4b3('0x2c')]['findAll']({'where':{'CustomReportId':_0x17a388['params']['id']}});});}})[_0xb4b3('0x23')](respondWithResult(_0x6a22cb,null))[_0xb4b3('0x49')](handleError(_0x6a22cb,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7a124b3..1908249 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 _0x0906=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','util'];(function(_0x5d1534,_0x572c80){var _0x2f5871=function(_0x30fa2e){while(--_0x30fa2e){_0x5d1534['push'](_0x5d1534['shift']());}};_0x2f5871(++_0x572c80);}(_0x0906,0x8f));var _0x6090=function(_0x345d8c,_0x165e29){_0x345d8c=_0x345d8c-0x0;var _0x1bd35e=_0x0906[_0x345d8c];return _0x1bd35e;};'use strict';var _=require('lodash');var util=require(_0x6090('0x0'));var logger=require(_0x6090('0x1'))(_0x6090('0x2'));var moment=require(_0x6090('0x3'));var BPromise=require(_0x6090('0x4'));var rp=require(_0x6090('0x5'));var fs=require('fs');var path=require(_0x6090('0x6'));var rimraf=require('rimraf');var config=require(_0x6090('0x7'));var attributes=require(_0x6090('0x8'));module[_0x6090('0x9')]=function(_0x50d384,_0x55bfad){return _0x50d384[_0x6090('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x6090('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8021=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x5253d7,_0x2ea8f8){var _0x1dd6c9=function(_0x5a6448){while(--_0x5a6448){_0x5253d7['push'](_0x5253d7['shift']());}};_0x1dd6c9(++_0x2ea8f8);}(_0x8021,0x1bc));var _0x1802=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x8021[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x1802('0x0'));var util=require(_0x1802('0x1'));var logger=require(_0x1802('0x2'))(_0x1802('0x3'));var moment=require(_0x1802('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1802('0x5'));var rimraf=require(_0x1802('0x6'));var config=require(_0x1802('0x7'));var attributes=require(_0x1802('0x8'));module[_0x1802('0x9')]=function(_0x4be4ef,_0xc0bea4){return _0x4be4ef[_0x1802('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x1802('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 8802c37..16e5506 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 _0x40dd=['../../mysqldb','../../config/logger','rpc','client','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x163f58,_0x1c8ae4){var _0x472ed9=function(_0xca7deb){while(--_0xca7deb){_0x163f58['push'](_0x163f58['shift']());}};_0x472ed9(++_0x1c8ae4);}(_0x40dd,0x1b2));var _0xd40d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x40dd[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var moment=require(_0xd40d('0x2'));var BPromise=require(_0xd40d('0x3'));var rs=require(_0xd40d('0x4'));var fs=require('fs');var Redis=require(_0xd40d('0x5'));var db=require(_0xd40d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd40d('0x7'))(_0xd40d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd40d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x756e3,_0x2000df,_0x53ffaa){return new BPromise(function(_0x2eb4ff,_0xe49b3e){return client[_0xd40d('0xa')](_0x756e3,_0x53ffaa)[_0xd40d('0xb')](function(_0x4338b6){logger[_0xd40d('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2000df,_0xd40d('0xd'));logger['debug'](_0xd40d('0xe'),_0x2000df,_0xd40d('0xd'),JSON['stringify'](_0x4338b6));if(_0x4338b6['error']){if(_0x4338b6[_0xd40d('0xf')][_0xd40d('0x10')]===0x1f4){logger['error'](_0xd40d('0x11'),_0x2000df,_0x4338b6[_0xd40d('0xf')][_0xd40d('0x12')]);return _0xe49b3e(_0x4338b6['error'][_0xd40d('0x12')]);}logger[_0xd40d('0xf')](_0xd40d('0x11'),_0x2000df,_0x4338b6[_0xd40d('0xf')][_0xd40d('0x12')]);return _0x2eb4ff(_0x4338b6['error'][_0xd40d('0x12')]);}else{logger['info'](_0xd40d('0x11'),_0x2000df,_0xd40d('0xd'));_0x2eb4ff(_0x4338b6[_0xd40d('0x13')][_0xd40d('0x12')]);}})['catch'](function(_0x3356b4){logger[_0xd40d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2000df,_0x3356b4);_0xe49b3e(_0x3356b4);});});} \ No newline at end of file +var _0xefb1=['code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1913ee,_0x42ad2e){var _0x144c22=function(_0x27f5ac){while(--_0x27f5ac){_0x1913ee['push'](_0x1913ee['shift']());}};_0x144c22(++_0x42ad2e);}(_0xefb1,0xe0));var _0x1efb=function(_0x4969ce,_0x1cf3ee){_0x4969ce=_0x4969ce-0x0;var _0x24d478=_0xefb1[_0x4969ce];return _0x24d478;};'use strict';var _=require('lodash');var util=require(_0x1efb('0x0'));var moment=require(_0x1efb('0x1'));var BPromise=require('bluebird');var rs=require(_0x1efb('0x2'));var fs=require('fs');var Redis=require(_0x1efb('0x3'));var db=require(_0x1efb('0x4'))['db'];var utils=require(_0x1efb('0x5'));var logger=require(_0x1efb('0x6'))(_0x1efb('0x7'));var config=require('../../config/environment');var jayson=require(_0x1efb('0x8'));var client=jayson[_0x1efb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31d82a,_0x1a6e48,_0x3e305d){return new BPromise(function(_0x5ab77b,_0x18aa90){return client[_0x1efb('0xa')](_0x31d82a,_0x3e305d)[_0x1efb('0xb')](function(_0x1c27e0){logger[_0x1efb('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a6e48,_0x1efb('0xd'));logger[_0x1efb('0xe')](_0x1efb('0xf'),_0x1a6e48,_0x1efb('0xd'),JSON[_0x1efb('0x10')](_0x1c27e0));if(_0x1c27e0[_0x1efb('0x11')]){if(_0x1c27e0[_0x1efb('0x11')][_0x1efb('0x12')]===0x1f4){logger[_0x1efb('0x11')](_0x1efb('0x13'),_0x1a6e48,_0x1c27e0[_0x1efb('0x11')][_0x1efb('0x14')]);return _0x18aa90(_0x1c27e0[_0x1efb('0x11')][_0x1efb('0x14')]);}logger[_0x1efb('0x11')](_0x1efb('0x13'),_0x1a6e48,_0x1c27e0[_0x1efb('0x11')]['message']);return _0x5ab77b(_0x1c27e0[_0x1efb('0x11')][_0x1efb('0x14')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x1a6e48,'request\x20sent');_0x5ab77b(_0x1c27e0['result'][_0x1efb('0x14')]);}})[_0x1efb('0x15')](function(_0x4aac88){logger[_0x1efb('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a6e48,_0x4aac88);_0x18aa90(_0x4aac88);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7a38e02..bb842e8 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(_0x412dae,_0x190e54){var _0x6bb6ad=function(_0x275d8f){while(--_0x275d8f){_0x412dae['push'](_0x412dae['shift']());}};_0x6bb6ad(++_0x190e54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x384016,_0x484d32){var _0x5f3433=function(_0x52c6a5){while(--_0x52c6a5){_0x384016['push'](_0x384016['shift']());}};_0x5f3433(++_0x484d32);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 7dbbfa1..c8347af 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 _0xe28e=['name','TEXT','sequelize','exports','STRING'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe28e,0x1ba));var _0xee28=function(_0x13dbae,_0x3e2b24){_0x13dbae=_0x13dbae-0x0;var _0x201ddf=_0xe28e[_0x13dbae];return _0x201ddf;};'use strict';var Sequelize=require(_0xee28('0x0'));module[_0xee28('0x1')]={'name':{'type':Sequelize[_0xee28('0x2')],'allowNull':![],'unique':_0xee28('0x3')},'table':{'type':Sequelize[_0xee28('0x2')]},'metric':{'type':Sequelize[_0xee28('0x4')]},'description':{'type':Sequelize[_0xee28('0x2')]}}; \ No newline at end of file +var _0x8c38=['TEXT','sequelize','exports','name','STRING'];(function(_0x502664,_0x1b58c5){var _0x1ee5f9=function(_0x7b9d48){while(--_0x7b9d48){_0x502664['push'](_0x502664['shift']());}};_0x1ee5f9(++_0x1b58c5);}(_0x8c38,0x83));var _0x88c3=function(_0x5943d3,_0xb4cbee){_0x5943d3=_0x5943d3-0x0;var _0x3a4c08=_0x8c38[_0x5943d3];return _0x3a4c08;};'use strict';var Sequelize=require(_0x88c3('0x0'));module[_0x88c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x88c3('0x2')},'table':{'type':Sequelize[_0x88c3('0x3')]},'metric':{'type':Sequelize[_0x88c3('0x4')]},'description':{'type':Sequelize[_0x88c3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c3395d9..f31af93 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 _0x98a8=['../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x1e9c76,_0x4b0ef4){var _0x52ce7e=function(_0x251de9){while(--_0x251de9){_0x1e9c76['push'](_0x1e9c76['shift']());}};_0x52ce7e(++_0x4b0ef4);}(_0x98a8,0x12c));var _0x898a=function(_0x3730c0,_0x5545ed){_0x3730c0=_0x3730c0-0x0;var _0x54b5d5=_0x98a8[_0x3730c0];return _0x54b5d5;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Metrics';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['AnalyticMetric'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));}; \ No newline at end of file +var _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','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'];(function(_0x2401e6,_0x2248d7){var _0xf06a43=function(_0x477bd8){while(--_0x477bd8){_0x2401e6['push'](_0x2401e6['shift']());}};_0xf06a43(++_0x2248d7);}(_0x4b84,0x1cc));var _0x44b8=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x4b84[_0xb833b1];return _0x1ab87a;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7cb7869..dfddd18 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 _0x1d7e=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0x1d7e,0x7d));var _0xe1d7=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1d7e[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0xe1d7('0x0'));var logger=require(_0xe1d7('0x1'))(_0xe1d7('0x2'));var moment=require('moment');var BPromise=require(_0xe1d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1d7('0x4'));var rimraf=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var attributes=require(_0xe1d7('0x7'));module[_0xe1d7('0x8')]=function(_0x4058fe,_0x252026){return _0x4058fe[_0xe1d7('0x9')](_0xe1d7('0xa'),attributes,{'tableName':_0xe1d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x723e,0x179));var _0xe723=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x723e[_0x3e6729];return _0x535bcd;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'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 971f6b3..80ca62b 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 _0x49df=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','AnalyticMetric,\x20%s,\x20%s'];(function(_0x5c5127,_0x4ee5af){var _0x4f34dc=function(_0x48122c){while(--_0x48122c){_0x5c5127['push'](_0x5c5127['shift']());}};_0x4f34dc(++_0x4ee5af);}(_0x49df,0x18e));var _0xf49d=function(_0x5bfaa7,_0x404773){_0x5bfaa7=_0x5bfaa7-0x0;var _0xe1b1a3=_0x49df[_0x5bfaa7];return _0xe1b1a3;};'use strict';var _=require(_0xf49d('0x0'));var util=require('util');var moment=require(_0xf49d('0x1'));var BPromise=require(_0xf49d('0x2'));var rs=require(_0xf49d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf49d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf49d('0x5'));var config=require(_0xf49d('0x6'));var jayson=require(_0xf49d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3969c3,_0x320c60,_0x39257c){return new BPromise(function(_0x302f36,_0x521a72){return client[_0xf49d('0x8')](_0x3969c3,_0x39257c)['then'](function(_0x43794d){logger['info'](_0xf49d('0x9'),_0x320c60,'request\x20sent');logger[_0xf49d('0xa')](_0xf49d('0xb'),_0x320c60,_0xf49d('0xc'),JSON['stringify'](_0x43794d));if(_0x43794d[_0xf49d('0xd')]){if(_0x43794d[_0xf49d('0xd')][_0xf49d('0xe')]===0x1f4){logger['error'](_0xf49d('0x9'),_0x320c60,_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);return _0x521a72(_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);}logger['error'](_0xf49d('0x9'),_0x320c60,_0x43794d[_0xf49d('0xd')]['message']);return _0x302f36(_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x320c60,_0xf49d('0xc'));_0x302f36(_0x43794d['result'][_0xf49d('0xf')]);}})[_0xf49d('0x10')](function(_0x288556){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x320c60,_0x288556);_0x521a72(_0x288556);});});} \ No newline at end of file +var _0x242f=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3aa17f,_0xfbe06d){var _0x205e5d=function(_0x154522){while(--_0x154522){_0x3aa17f['push'](_0x3aa17f['shift']());}};_0x205e5d(++_0xfbe06d);}(_0x242f,0x7e));var _0xf242=function(_0x2c21fa,_0x5f0a10){_0x2c21fa=_0x2c21fa-0x0;var _0x5aafc6=_0x242f[_0x2c21fa];return _0x5aafc6;};'use strict';var _=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var moment=require(_0xf242('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf242('0x3'));var db=require(_0xf242('0x4'))['db'];var utils=require(_0xf242('0x5'));var logger=require(_0xf242('0x6'))(_0xf242('0x7'));var config=require(_0xf242('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf242('0x9')][_0xf242('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x838f7f,_0x11ecea,_0x418967){return new BPromise(function(_0x4848a5,_0x11d344){return client[_0xf242('0xb')](_0x838f7f,_0x418967)[_0xf242('0xc')](function(_0x68d59f){logger[_0xf242('0xd')](_0xf242('0xe'),_0x11ecea,_0xf242('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x11ecea,_0xf242('0xf'),JSON['stringify'](_0x68d59f));if(_0x68d59f['error']){if(_0x68d59f[_0xf242('0x10')][_0xf242('0x11')]===0x1f4){logger[_0xf242('0x10')](_0xf242('0xe'),_0x11ecea,_0x68d59f[_0xf242('0x10')][_0xf242('0x12')]);return _0x11d344(_0x68d59f[_0xf242('0x10')][_0xf242('0x12')]);}logger[_0xf242('0x10')](_0xf242('0xe'),_0x11ecea,_0x68d59f[_0xf242('0x10')][_0xf242('0x12')]);return _0x4848a5(_0x68d59f['error'][_0xf242('0x12')]);}else{logger[_0xf242('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x11ecea,_0xf242('0xf'));_0x4848a5(_0x68d59f[_0xf242('0x13')][_0xf242('0x12')]);}})['catch'](function(_0x4d9bd3){logger[_0xf242('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x11ecea,_0x4d9bd3);_0x11d344(_0x4d9bd3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 240160a..a67a301 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 _0xd9c8=['post','isAuthenticated','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd9c8[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var path=require('path');var timeout=require(_0x8d9c('0x2'));var express=require(_0x8d9c('0x3'));var router=express[_0x8d9c('0x4')]();var fs_extra=require(_0x8d9c('0x5'));var auth=require(_0x8d9c('0x6'));var interaction=require(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d9c('0x9')]);router[_0x8d9c('0xa')](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0xc')]);router[_0x8d9c('0xd')]('/',auth[_0x8d9c('0xe')](),controller[_0x8d9c('0xf')]);router[_0x8d9c('0x10')](_0x8d9c('0xb'),auth[_0x8d9c('0xe')](),controller[_0x8d9c('0x11')]);router['delete'](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4317=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x4317,0x7c));var _0x7431=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4317[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xe')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0x13')]);module[_0x7431('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 4fda9b2..1fcbf04 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 _0x8323=['TEXT','sequelize','exports'];(function(_0x4cda60,_0x2e72ec){var _0x6b531f=function(_0x327f09){while(--_0x327f09){_0x4cda60['push'](_0x4cda60['shift']());}};_0x6b531f(++_0x2e72ec);}(_0x8323,0xe5));var _0x3832=function(_0x8e9fc3,_0x46ecac){_0x8e9fc3=_0x8e9fc3-0x0;var _0x46e02d=_0x8323[_0x8e9fc3];return _0x46e02d;};'use strict';var Sequelize=require(_0x3832('0x0'));module[_0x3832('0x1')]={'tree':{'type':Sequelize[_0x3832('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x25f0=['exports'];(function(_0x3ec412,_0x195122){var _0x29479c=function(_0x3e7517){while(--_0x3e7517){_0x3ec412['push'](_0x3ec412['shift']());}};_0x29479c(++_0x195122);}(_0x25f0,0xf0));var _0x025f=function(_0x24dd47,_0x314303){_0x24dd47=_0x24dd47-0x0;var _0x4ef431=_0x25f0[_0x24dd47];return _0x4ef431;};'use strict';var Sequelize=require('sequelize');module[_0x025f('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7f6136b..a733325 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 _0xa18d=['moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','query','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2f249f,_0x511d6d){var _0x3ba98f=function(_0x495c3e){while(--_0x495c3e){_0x2f249f['push'](_0x2f249f['shift']());}};_0x3ba98f(++_0x511d6d);}(_0xa18d,0xd6));var _0xda18=function(_0x44fa6f,_0x5dec12){_0x44fa6f=_0x44fa6f-0x0;var _0xbbabd7=_0xa18d[_0x44fa6f];return _0xbbabd7;};'use strict';var emlformat=require(_0xda18('0x0'));var rimraf=require(_0xda18('0x1'));var zipdir=require(_0xda18('0x2'));var jsonpatch=require(_0xda18('0x3'));var rp=require(_0xda18('0x4'));var moment=require(_0xda18('0x5'));var BPromise=require(_0xda18('0x6'));var Mustache=require(_0xda18('0x7'));var util=require('util');var path=require(_0xda18('0x8'));var sox=require(_0xda18('0x9'));var csv=require(_0xda18('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda18('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda18('0xa'));var querystring=require(_0xda18('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda18('0xe'));var logger=require(_0xda18('0xf'))(_0xda18('0x10'));var utils=require(_0xda18('0x11'));var config=require(_0xda18('0x12'));var licenseUtil=require(_0xda18('0x13'));var db=require(_0xda18('0x14'))['db'];function respondWithStatusCode(_0x3a436b,_0x3b2508){_0x3b2508=_0x3b2508||0xcc;return function(_0xd6e225){if(_0xd6e225){return _0x3a436b[_0xda18('0x15')](_0x3b2508);}return _0x3a436b[_0xda18('0x16')](_0x3b2508)['end']();};}function respondWithResult(_0x324282,_0x5f20e5){_0x5f20e5=_0x5f20e5||0xc8;return function(_0x282dbc){if(_0x282dbc){return _0x324282['status'](_0x5f20e5)[_0xda18('0x17')](_0x282dbc);}};}function respondWithFilteredResult(_0x58ac7b,_0x141ced){return function(_0x12b18b){if(_0x12b18b){var _0x58711b=typeof _0x141ced[_0xda18('0x18')]==='undefined'&&typeof _0x141ced[_0xda18('0x19')]===_0xda18('0x1a');var _0x1d3126=_0x12b18b['count'];var _0x1ea206=_0x58711b?0x0:_0x141ced[_0xda18('0x18')];var _0x243ccf=_0x58711b?_0x12b18b[_0xda18('0x1b')]:_0x141ced[_0xda18('0x18')]+_0x141ced[_0xda18('0x19')];var _0x15758f;if(_0x243ccf>=_0x1d3126){_0x243ccf=_0x1d3126;_0x15758f=0xc8;}else{_0x15758f=0xce;}_0x58ac7b[_0xda18('0x16')](_0x15758f);return _0x58ac7b[_0xda18('0x1c')](_0xda18('0x1d'),_0x1ea206+'-'+_0x243ccf+'/'+_0x1d3126)['json'](_0x12b18b);}return null;};}function patchUpdates(_0x3388da){return function(_0x2cc608){try{jsonpatch[_0xda18('0x1e')](_0x2cc608,_0x3388da,!![]);}catch(_0x292941){return BPromise[_0xda18('0x1f')](_0x292941);}return _0x2cc608[_0xda18('0x20')]();};}function saveUpdates(_0x2be394,_0x52cfba){return function(_0x5d30a3){if(_0x5d30a3){return _0x5d30a3[_0xda18('0x21')](_0x2be394)['then'](function(_0x2401cd){return _0x2401cd;});}return null;};}function removeEntity(_0x191612,_0x43a66e){return function(_0x44a935){if(_0x44a935){return _0x44a935[_0xda18('0x22')]()['then'](function(){_0x191612[_0xda18('0x16')](0xcc)[_0xda18('0x23')]();});}};}function handleEntityNotFound(_0x57a923,_0x194cec){return function(_0x52ed1d){if(!_0x52ed1d){_0x57a923[_0xda18('0x15')](0x194);}return _0x52ed1d;};}function handleError(_0x41460a,_0x40ec27){_0x40ec27=_0x40ec27||0x1f4;return function(_0x24e422){logger[_0xda18('0x24')](_0x24e422[_0xda18('0x25')]);if(_0x24e422[_0xda18('0x26')]){delete _0x24e422['name'];}_0x41460a[_0xda18('0x16')](_0x40ec27)[_0xda18('0x27')](_0x24e422);};}exports[_0xda18('0x28')]=function(_0x24b69e,_0x432783){var _0x18e252={},_0x19cfeb={},_0x55d624={'count':0x0,'rows':[]};var _0x4ce6a1=_[_0xda18('0x29')](db[_0xda18('0x2a')]['rawAttributes'],function(_0x15ee1c){return{'name':_0x15ee1c[_0xda18('0x2b')],'type':_0x15ee1c[_0xda18('0x2c')]['key']};});_0x19cfeb['model']=_[_0xda18('0x29')](_0x4ce6a1,'name');_0x19cfeb['query']=_['keys'](_0x24b69e['query']);_0x19cfeb[_0xda18('0x2d')]=_['intersection'](_0x19cfeb[_0xda18('0x2e')],_0x19cfeb['query']);_0x18e252[_0xda18('0x2f')]=_[_0xda18('0x30')](_0x19cfeb[_0xda18('0x2e')],qs['fields'](_0x24b69e['query'][_0xda18('0x31')]));_0x18e252['attributes']=_0x18e252[_0xda18('0x2f')][_0xda18('0x32')]?_0x18e252['attributes']:_0x19cfeb[_0xda18('0x2e')];if(!_0x24b69e['query'][_0xda18('0x33')](_0xda18('0x34'))){_0x18e252[_0xda18('0x19')]=qs[_0xda18('0x19')](_0x24b69e[_0xda18('0x35')][_0xda18('0x19')]);_0x18e252[_0xda18('0x18')]=qs[_0xda18('0x18')](_0x24b69e[_0xda18('0x35')]['offset']);}_0x18e252['order']=qs['sort'](_0x24b69e[_0xda18('0x35')][_0xda18('0x36')]);_0x18e252[_0xda18('0x37')]=qs[_0xda18('0x2d')](_[_0xda18('0x38')](_0x24b69e[_0xda18('0x35')],_0x19cfeb['filters']),_0x4ce6a1);if(_0x24b69e['query'][_0xda18('0x39')]){_0x18e252['where']=_[_0xda18('0x3a')](_0x18e252['where'],{'$or':_[_0xda18('0x29')](_0x4ce6a1,function(_0x29114){if(_0x29114[_0xda18('0x2c')]!==_0xda18('0x3b')){var _0x8dc047={};_0x8dc047[_0x29114['name']]={'$like':'%'+_0x24b69e['query'][_0xda18('0x39')]+'%'};return _0x8dc047;}})});}_0x18e252=_['merge']({},_0x18e252,_0x24b69e[_0xda18('0x3c')]);var _0x210336={'where':_0x18e252[_0xda18('0x37')]};return db['AnalyticTreeReport'][_0xda18('0x1b')](_0x210336)[_0xda18('0x3d')](function(_0x451a37){_0x55d624[_0xda18('0x1b')]=_0x451a37;if(_0x24b69e['query'][_0xda18('0x3e')]){_0x18e252[_0xda18('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xda18('0x40')](_0x18e252);})[_0xda18('0x3d')](function(_0x30b257){_0x55d624[_0xda18('0x41')]=_0x30b257;return _0x55d624;})[_0xda18('0x3d')](respondWithFilteredResult(_0x432783,_0x18e252))['catch'](handleError(_0x432783,null));};exports['show']=function(_0x4dde91,_0x3ea709){var _0x756587={'raw':!![],'where':{'id':_0x4dde91[_0xda18('0x42')]['id']}},_0x4f6dbf={};_0x4f6dbf['model']=_[_0xda18('0x43')](db[_0xda18('0x2a')][_0xda18('0x44')]);_0x4f6dbf[_0xda18('0x35')]=_[_0xda18('0x43')](_0x4dde91[_0xda18('0x35')]);_0x4f6dbf[_0xda18('0x2d')]=_['intersection'](_0x4f6dbf['model'],_0x4f6dbf['query']);_0x756587['attributes']=_['intersection'](_0x4f6dbf[_0xda18('0x2e')],qs[_0xda18('0x31')](_0x4dde91[_0xda18('0x35')]['fields']));_0x756587[_0xda18('0x2f')]=_0x756587['attributes'][_0xda18('0x32')]?_0x756587[_0xda18('0x2f')]:_0x4f6dbf[_0xda18('0x2e')];if(_0x4dde91[_0xda18('0x35')][_0xda18('0x3e')]){_0x756587[_0xda18('0x3f')]=[{'all':!![]}];}_0x756587=_['merge']({},_0x756587,_0x4dde91[_0xda18('0x3c')]);return db[_0xda18('0x2a')]['find'](_0x756587)['then'](handleEntityNotFound(_0x3ea709,null))[_0xda18('0x3d')](respondWithResult(_0x3ea709,null))[_0xda18('0x45')](handleError(_0x3ea709,null));};exports[_0xda18('0x46')]=function(_0x57f53d,_0xcfdba2){return db[_0xda18('0x2a')][_0xda18('0x46')](_0x57f53d[_0xda18('0x47')],{})[_0xda18('0x3d')](respondWithResult(_0xcfdba2,0xc9))[_0xda18('0x45')](handleError(_0xcfdba2,null));};exports[_0xda18('0x21')]=function(_0xae5cd6,_0x38ffa2){if(_0xae5cd6['body']['id']){delete _0xae5cd6[_0xda18('0x47')]['id'];}return db[_0xda18('0x2a')][_0xda18('0x48')]({'where':{'id':_0xae5cd6[_0xda18('0x42')]['id']}})['then'](handleEntityNotFound(_0x38ffa2,null))[_0xda18('0x3d')](saveUpdates(_0xae5cd6[_0xda18('0x47')],null))[_0xda18('0x3d')](respondWithResult(_0x38ffa2,null))[_0xda18('0x45')](handleError(_0x38ffa2,null));};exports[_0xda18('0x22')]=function(_0x2bd4fd,_0x72d750){return db[_0xda18('0x2a')]['find']({'where':{'id':_0x2bd4fd[_0xda18('0x42')]['id']}})[_0xda18('0x3d')](handleEntityNotFound(_0x72d750,null))[_0xda18('0x3d')](removeEntity(_0x72d750,null))[_0xda18('0x45')](handleError(_0x72d750,null));}; \ No newline at end of file +var _0xe83e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','merge','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x332741,_0x2ab38c){var _0x4a803a=function(_0x2c596f){while(--_0x2c596f){_0x332741['push'](_0x332741['shift']());}};_0x4a803a(++_0x2ab38c);}(_0xe83e,0x19a));var _0xee83=function(_0x2da568,_0x5e62e6){_0x2da568=_0x2da568-0x0;var _0x7125e0=_0xe83e[_0x2da568];return _0x7125e0;};'use strict';var emlformat=require(_0xee83('0x0'));var rimraf=require(_0xee83('0x1'));var zipdir=require(_0xee83('0x2'));var jsonpatch=require(_0xee83('0x3'));var rp=require(_0xee83('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xee83('0x5'));var csv=require(_0xee83('0x6'));var ejs=require(_0xee83('0x7'));var fs=require('fs');var fs_extra=require(_0xee83('0x8'));var _=require(_0xee83('0x9'));var squel=require(_0xee83('0xa'));var crypto=require(_0xee83('0xb'));var jsforce=require(_0xee83('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xee83('0x6'));var querystring=require(_0xee83('0xd'));var Papa=require(_0xee83('0xe'));var Redis=require(_0xee83('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xee83('0x10'));var as=require(_0xee83('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee83('0x12'))('api');var utils=require(_0xee83('0x13'));var config=require(_0xee83('0x14'));var licenseUtil=require(_0xee83('0x15'));var db=require(_0xee83('0x16'))['db'];function respondWithStatusCode(_0xc9e8d0,_0x40ace5){_0x40ace5=_0x40ace5||0xcc;return function(_0x1c420f){if(_0x1c420f){return _0xc9e8d0[_0xee83('0x17')](_0x40ace5);}return _0xc9e8d0['status'](_0x40ace5)['end']();};}function respondWithResult(_0x54c5c6,_0x3c6478){_0x3c6478=_0x3c6478||0xc8;return function(_0x3dd199){if(_0x3dd199){return _0x54c5c6['status'](_0x3c6478)['json'](_0x3dd199);}};}function respondWithFilteredResult(_0x240fb7,_0xd265e3){return function(_0x4bd344){if(_0x4bd344){var _0x2b5b21=typeof _0xd265e3['offset']===_0xee83('0x18')&&typeof _0xd265e3[_0xee83('0x19')]===_0xee83('0x18');var _0x4651db=_0x4bd344[_0xee83('0x1a')];var _0xfa6ddb=_0x2b5b21?0x0:_0xd265e3[_0xee83('0x1b')];var _0x52c103=_0x2b5b21?_0x4bd344['count']:_0xd265e3[_0xee83('0x1b')]+_0xd265e3[_0xee83('0x19')];var _0x3d6dd4;if(_0x52c103>=_0x4651db){_0x52c103=_0x4651db;_0x3d6dd4=0xc8;}else{_0x3d6dd4=0xce;}_0x240fb7[_0xee83('0x1c')](_0x3d6dd4);return _0x240fb7[_0xee83('0x1d')](_0xee83('0x1e'),_0xfa6ddb+'-'+_0x52c103+'/'+_0x4651db)[_0xee83('0x1f')](_0x4bd344);}return null;};}function patchUpdates(_0x47aa8a){return function(_0x42928e){try{jsonpatch[_0xee83('0x20')](_0x42928e,_0x47aa8a,!![]);}catch(_0x53b5ac){return BPromise['reject'](_0x53b5ac);}return _0x42928e[_0xee83('0x21')]();};}function saveUpdates(_0xc652a9,_0x287620){return function(_0x22b590){if(_0x22b590){return _0x22b590[_0xee83('0x22')](_0xc652a9)[_0xee83('0x23')](function(_0x243d7d){return _0x243d7d;});}return null;};}function removeEntity(_0x4ca350,_0x4c4298){return function(_0x30f846){if(_0x30f846){return _0x30f846[_0xee83('0x24')]()[_0xee83('0x23')](function(){_0x4ca350[_0xee83('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8471,_0x8c02b5){return function(_0x376c2e){if(!_0x376c2e){_0x3d8471[_0xee83('0x17')](0x194);}return _0x376c2e;};}function handleError(_0x5c2399,_0x365bc8){_0x365bc8=_0x365bc8||0x1f4;return function(_0x166f3b){logger['error'](_0x166f3b[_0xee83('0x25')]);if(_0x166f3b[_0xee83('0x26')]){delete _0x166f3b['name'];}_0x5c2399[_0xee83('0x1c')](_0x365bc8)[_0xee83('0x27')](_0x166f3b);};}exports[_0xee83('0x28')]=function(_0x78cb3b,_0x542c60){var _0x5288f6={},_0x1bf9bc={},_0xd05898={'count':0x0,'rows':[]};var _0x51df24=_[_0xee83('0x29')](db[_0xee83('0x2a')]['rawAttributes'],function(_0x585e95){return{'name':_0x585e95[_0xee83('0x2b')],'type':_0x585e95[_0xee83('0x2c')]['key']};});_0x1bf9bc[_0xee83('0x2d')]=_['map'](_0x51df24,'name');_0x1bf9bc['query']=_[_0xee83('0x2e')](_0x78cb3b[_0xee83('0x2f')]);_0x1bf9bc['filters']=_[_0xee83('0x30')](_0x1bf9bc[_0xee83('0x2d')],_0x1bf9bc[_0xee83('0x2f')]);_0x5288f6['attributes']=_[_0xee83('0x30')](_0x1bf9bc[_0xee83('0x2d')],qs[_0xee83('0x31')](_0x78cb3b[_0xee83('0x2f')][_0xee83('0x31')]));_0x5288f6['attributes']=_0x5288f6[_0xee83('0x32')][_0xee83('0x33')]?_0x5288f6['attributes']:_0x1bf9bc['model'];if(!_0x78cb3b[_0xee83('0x2f')]['hasOwnProperty'](_0xee83('0x34'))){_0x5288f6[_0xee83('0x19')]=qs[_0xee83('0x19')](_0x78cb3b[_0xee83('0x2f')][_0xee83('0x19')]);_0x5288f6[_0xee83('0x1b')]=qs[_0xee83('0x1b')](_0x78cb3b['query'][_0xee83('0x1b')]);}_0x5288f6[_0xee83('0x35')]=qs[_0xee83('0x36')](_0x78cb3b['query'][_0xee83('0x36')]);_0x5288f6['where']=qs[_0xee83('0x37')](_[_0xee83('0x38')](_0x78cb3b['query'],_0x1bf9bc[_0xee83('0x37')]),_0x51df24);if(_0x78cb3b[_0xee83('0x2f')][_0xee83('0x39')]){_0x5288f6[_0xee83('0x3a')]=_['merge'](_0x5288f6[_0xee83('0x3a')],{'$or':_[_0xee83('0x29')](_0x51df24,function(_0x4c8ff8){if(_0x4c8ff8[_0xee83('0x2c')]!==_0xee83('0x3b')){var _0x1221d6={};_0x1221d6[_0x4c8ff8['name']]={'$like':'%'+_0x78cb3b[_0xee83('0x2f')]['filter']+'%'};return _0x1221d6;}})});}_0x5288f6=_['merge']({},_0x5288f6,_0x78cb3b[_0xee83('0x3c')]);var _0x38398a={'where':_0x5288f6[_0xee83('0x3a')]};return db[_0xee83('0x2a')][_0xee83('0x1a')](_0x38398a)[_0xee83('0x23')](function(_0x53bc36){_0xd05898[_0xee83('0x1a')]=_0x53bc36;if(_0x78cb3b[_0xee83('0x2f')][_0xee83('0x3d')]){_0x5288f6[_0xee83('0x3e')]=[{'all':!![]}];}return db[_0xee83('0x2a')][_0xee83('0x3f')](_0x5288f6);})[_0xee83('0x23')](function(_0x4d0be0){_0xd05898['rows']=_0x4d0be0;return _0xd05898;})[_0xee83('0x23')](respondWithFilteredResult(_0x542c60,_0x5288f6))['catch'](handleError(_0x542c60,null));};exports[_0xee83('0x40')]=function(_0x3782ce,_0x19e9ce){var _0xa157ff={'raw':!![],'where':{'id':_0x3782ce[_0xee83('0x41')]['id']}},_0x54548a={};_0x54548a[_0xee83('0x2d')]=_[_0xee83('0x2e')](db[_0xee83('0x2a')][_0xee83('0x42')]);_0x54548a[_0xee83('0x2f')]=_[_0xee83('0x2e')](_0x3782ce[_0xee83('0x2f')]);_0x54548a['filters']=_['intersection'](_0x54548a[_0xee83('0x2d')],_0x54548a[_0xee83('0x2f')]);_0xa157ff[_0xee83('0x32')]=_['intersection'](_0x54548a[_0xee83('0x2d')],qs['fields'](_0x3782ce[_0xee83('0x2f')][_0xee83('0x31')]));_0xa157ff['attributes']=_0xa157ff[_0xee83('0x32')][_0xee83('0x33')]?_0xa157ff['attributes']:_0x54548a[_0xee83('0x2d')];if(_0x3782ce['query'][_0xee83('0x3d')]){_0xa157ff[_0xee83('0x3e')]=[{'all':!![]}];}_0xa157ff=_[_0xee83('0x43')]({},_0xa157ff,_0x3782ce[_0xee83('0x3c')]);return db[_0xee83('0x2a')][_0xee83('0x44')](_0xa157ff)['then'](handleEntityNotFound(_0x19e9ce,null))[_0xee83('0x23')](respondWithResult(_0x19e9ce,null))[_0xee83('0x45')](handleError(_0x19e9ce,null));};exports['create']=function(_0x4a10c9,_0x4d9f2b){return db[_0xee83('0x2a')]['create'](_0x4a10c9[_0xee83('0x46')],{})[_0xee83('0x23')](respondWithResult(_0x4d9f2b,0xc9))[_0xee83('0x45')](handleError(_0x4d9f2b,null));};exports['update']=function(_0x58e17f,_0x36ef8e){if(_0x58e17f[_0xee83('0x46')]['id']){delete _0x58e17f[_0xee83('0x46')]['id'];}return db['AnalyticTreeReport'][_0xee83('0x44')]({'where':{'id':_0x58e17f[_0xee83('0x41')]['id']}})[_0xee83('0x23')](handleEntityNotFound(_0x36ef8e,null))[_0xee83('0x23')](saveUpdates(_0x58e17f[_0xee83('0x46')],null))[_0xee83('0x23')](respondWithResult(_0x36ef8e,null))[_0xee83('0x45')](handleError(_0x36ef8e,null));};exports['destroy']=function(_0x4bcbed,_0x54733f){return db[_0xee83('0x2a')][_0xee83('0x44')]({'where':{'id':_0x4bcbed['params']['id']}})[_0xee83('0x23')](handleEntityNotFound(_0x54733f,null))[_0xee83('0x23')](removeEntity(_0x54733f,null))[_0xee83('0x45')](handleError(_0x54733f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index bfe9e28..749bfaa 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 _0x286b=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','../../config/logger'];(function(_0x1bf713,_0x2a079b){var _0x4b2b7b=function(_0x25f828){while(--_0x25f828){_0x1bf713['push'](_0x1bf713['shift']());}};_0x4b2b7b(++_0x2a079b);}(_0x286b,0x1c2));var _0xb286=function(_0x2afcf6,_0x24b28f){_0x2afcf6=_0x2afcf6-0x0;var _0x5232ad=_0x286b[_0x2afcf6];return _0x5232ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb286('0x0'))(_0xb286('0x1'));var moment=require(_0xb286('0x2'));var BPromise=require('bluebird');var rp=require(_0xb286('0x3'));var fs=require('fs');var path=require(_0xb286('0x4'));var rimraf=require(_0xb286('0x5'));var config=require(_0xb286('0x6'));var attributes=require(_0xb286('0x7'));module[_0xb286('0x8')]=function(_0x412b08,_0x1f0fc4){return _0x412b08[_0xb286('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xb286('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1858=['define','analytics_report_trees','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x1e5f85,_0x46ccf2){var _0x3a9ea6=function(_0x1310c0){while(--_0x1310c0){_0x1e5f85['push'](_0x1e5f85['shift']());}};_0x3a9ea6(++_0x46ccf2);}(_0x1858,0x122));var _0x8185=function(_0x19f1e4,_0x1e62de){_0x19f1e4=_0x19f1e4-0x0;var _0x219ebc=_0x1858[_0x19f1e4];return _0x219ebc;};'use strict';var _=require(_0x8185('0x0'));var util=require(_0x8185('0x1'));var logger=require(_0x8185('0x2'))('api');var moment=require(_0x8185('0x3'));var BPromise=require('bluebird');var rp=require(_0x8185('0x4'));var fs=require('fs');var path=require(_0x8185('0x5'));var rimraf=require(_0x8185('0x6'));var config=require(_0x8185('0x7'));var attributes=require(_0x8185('0x8'));module[_0x8185('0x9')]=function(_0x22b4c7,_0x2c50e1){return _0x22b4c7[_0x8185('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x8185('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index a86c054..e765e4c 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xadb5,0xad));var _0x5adb=function(_0xa93e9d,_0x5b5753){_0xa93e9d=_0xa93e9d-0x0;var _0x51e2ef=_0xadb5[_0xa93e9d];return _0x51e2ef;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5f67,_0x2831f0){_0x3f5f67=_0x3f5f67-0x0;var _0x54e376=_0x7a54[_0x3f5f67];return _0x54e376;};'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 d972de7..e0c7b43 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 _0x9643=['get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./analyticTreeReport.controller'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9643,0x13c));var _0x3964=function(_0x267af0,_0x14b547){_0x267af0=_0x267af0-0x0;var _0x37889a=_0x9643[_0x267af0];return _0x37889a;};'use strict';var multer=require(_0x3964('0x0'));var util=require(_0x3964('0x1'));var path=require(_0x3964('0x2'));var timeout=require(_0x3964('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3964('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3964('0x5'));var config=require('../../config/environment');var controller=require(_0x3964('0x6'));router[_0x3964('0x7')]('/',auth[_0x3964('0x8')](),controller[_0x3964('0x9')]);router[_0x3964('0x7')](_0x3964('0xa'),auth[_0x3964('0x8')](),controller[_0x3964('0xb')]);router[_0x3964('0xc')]('/',auth['isAuthenticated'](),controller[_0x3964('0xd')]);router[_0x3964('0xe')](_0x3964('0xa'),auth[_0x3964('0x8')](),controller[_0x3964('0xf')]);router['delete'](_0x3964('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3964('0x10')]=router; \ No newline at end of file +var _0xd501=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1bf7a6,_0x3db8a2){var _0x47b453=function(_0x46cb61){while(--_0x46cb61){_0x1bf7a6['push'](_0x1bf7a6['shift']());}};_0x47b453(++_0x3db8a2);}(_0xd501,0x1df));var _0x1d50=function(_0xf27234,_0x4c8d80){_0xf27234=_0xf27234-0x0;var _0x528122=_0xd501[_0xf27234];return _0x528122;};'use strict';var multer=require(_0x1d50('0x0'));var util=require(_0x1d50('0x1'));var path=require(_0x1d50('0x2'));var timeout=require(_0x1d50('0x3'));var express=require(_0x1d50('0x4'));var router=express[_0x1d50('0x5')]();var fs_extra=require(_0x1d50('0x6'));var auth=require(_0x1d50('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d50('0x8'));var controller=require(_0x1d50('0x9'));router['get']('/',auth[_0x1d50('0xa')](),controller['index']);router[_0x1d50('0xb')]('/:id',auth[_0x1d50('0xa')](),controller[_0x1d50('0xc')]);router[_0x1d50('0xd')]('/',auth[_0x1d50('0xa')](),controller[_0x1d50('0xe')]);router[_0x1d50('0xf')](_0x1d50('0x10'),auth[_0x1d50('0xa')](),controller[_0x1d50('0x11')]);router[_0x1d50('0x12')](_0x1d50('0x10'),auth[_0x1d50('0xa')](),controller[_0x1d50('0x13')]);module[_0x1d50('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c31f56e..023a620 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 _0x17ba=['sequelize','exports','STRING'];(function(_0x2ab914,_0x210788){var _0x35c276=function(_0x2b79d0){while(--_0x2b79d0){_0x2ab914['push'](_0x2ab914['shift']());}};_0x35c276(++_0x210788);}(_0x17ba,0xab));var _0xa17b=function(_0x41edaa,_0x335b24){_0x41edaa=_0x41edaa-0x0;var _0xb0bcb4=_0x17ba[_0x41edaa];return _0xb0bcb4;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa17b('0x2')]},'type':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file +var _0x3f49=['exports','STRING','sequelize'];(function(_0x4848a3,_0x384354){var _0x75ba9a=function(_0x3c5256){while(--_0x3c5256){_0x4848a3['push'](_0x4848a3['shift']());}};_0x75ba9a(++_0x384354);}(_0x3f49,0x11f));var _0x93f4=function(_0x46610f,_0x22d6f1){_0x46610f=_0x46610f-0x0;var _0x5be0f9=_0x3f49[_0x46610f];return _0x5be0f9;};'use strict';var Sequelize=require(_0x93f4('0x0'));module[_0x93f4('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x93f4('0x2')]},'type':{'type':Sequelize[_0x93f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 584e6a0..1e9f6ad 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 _0x72aa=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','clone','params','get','omit','body','createdAt','updatedAt','create','update','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce'];(function(_0x1f14fa,_0xe5444e){var _0xc87f91=function(_0x4c80ed){while(--_0x4c80ed){_0x1f14fa['push'](_0x1f14fa['shift']());}};_0xc87f91(++_0xe5444e);}(_0x72aa,0x1c3));var _0xa72a=function(_0xc4ea4f,_0x858344){_0xc4ea4f=_0xc4ea4f-0x0;var _0x4db3cf=_0x72aa[_0xc4ea4f];return _0x4db3cf;};'use strict';var emlformat=require(_0xa72a('0x0'));var rimraf=require(_0xa72a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72a('0x2'));var rp=require(_0xa72a('0x3'));var moment=require(_0xa72a('0x4'));var BPromise=require(_0xa72a('0x5'));var Mustache=require(_0xa72a('0x6'));var util=require(_0xa72a('0x7'));var path=require(_0xa72a('0x8'));var sox=require(_0xa72a('0x9'));var csv=require(_0xa72a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa72a('0xb'));var _=require(_0xa72a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa72a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa72a('0xa'));var querystring=require(_0xa72a('0xe'));var Papa=require(_0xa72a('0xf'));var Redis=require(_0xa72a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa72a('0x11'));var as=require(_0xa72a('0x12'));var hardwareService=require(_0xa72a('0x13'));var logger=require('../../config/logger')(_0xa72a('0x14'));var utils=require(_0xa72a('0x15'));var config=require(_0xa72a('0x16'));var licenseUtil=require(_0xa72a('0x17'));var db=require(_0xa72a('0x18'))['db'];function respondWithStatusCode(_0x96d1b2,_0x5557f2){_0x5557f2=_0x5557f2||0xcc;return function(_0x5219d3){if(_0x5219d3){return _0x96d1b2[_0xa72a('0x19')](_0x5557f2);}return _0x96d1b2[_0xa72a('0x1a')](_0x5557f2)['end']();};}function respondWithResult(_0xb1959f,_0x198d2e){_0x198d2e=_0x198d2e||0xc8;return function(_0x1b140f){if(_0x1b140f){return _0xb1959f[_0xa72a('0x1a')](_0x198d2e)[_0xa72a('0x1b')](_0x1b140f);}};}function respondWithFilteredResult(_0x1c51be,_0x269187){return function(_0x647537){if(_0x647537){var _0x4b586e=typeof _0x269187[_0xa72a('0x1c')]===_0xa72a('0x1d')&&typeof _0x269187[_0xa72a('0x1e')]===_0xa72a('0x1d');var _0x1f26fa=_0x647537['count'];var _0x5aedbc=_0x4b586e?0x0:_0x269187[_0xa72a('0x1c')];var _0x5619e7=_0x4b586e?_0x647537['count']:_0x269187[_0xa72a('0x1c')]+_0x269187[_0xa72a('0x1e')];var _0x1c1aa5;if(_0x5619e7>=_0x1f26fa){_0x5619e7=_0x1f26fa;_0x1c1aa5=0xc8;}else{_0x1c1aa5=0xce;}_0x1c51be[_0xa72a('0x1a')](_0x1c1aa5);return _0x1c51be[_0xa72a('0x1f')](_0xa72a('0x20'),_0x5aedbc+'-'+_0x5619e7+'/'+_0x1f26fa)[_0xa72a('0x1b')](_0x647537);}return null;};}function patchUpdates(_0x12be4d){return function(_0x2167c9){try{jsonpatch['apply'](_0x2167c9,_0x12be4d,!![]);}catch(_0x3ba8cc){return BPromise[_0xa72a('0x21')](_0x3ba8cc);}return _0x2167c9[_0xa72a('0x22')]();};}function saveUpdates(_0x5048f5,_0x8a2cf5){return function(_0x196a8b){if(_0x196a8b){return _0x196a8b['update'](_0x5048f5)[_0xa72a('0x23')](function(_0x1d9b4e){return _0x1d9b4e;});}return null;};}function removeEntity(_0x1a888d,_0x23a6bf){return function(_0x19fd96){if(_0x19fd96){return _0x19fd96[_0xa72a('0x24')]()[_0xa72a('0x23')](function(){_0x1a888d[_0xa72a('0x1a')](0xcc)[_0xa72a('0x25')]();});}};}function handleEntityNotFound(_0x4f679b,_0x5b3a11){return function(_0x4bb1fc){if(!_0x4bb1fc){_0x4f679b[_0xa72a('0x19')](0x194);}return _0x4bb1fc;};}function handleError(_0x33cb82,_0x5b5c22){_0x5b5c22=_0x5b5c22||0x1f4;return function(_0x118f24){logger[_0xa72a('0x26')](_0x118f24[_0xa72a('0x27')]);if(_0x118f24['name']){delete _0x118f24[_0xa72a('0x28')];}_0x33cb82[_0xa72a('0x1a')](_0x5b5c22)[_0xa72a('0x29')](_0x118f24);};}exports[_0xa72a('0x2a')]=function(_0x49cb2a,_0x4dccfb){var _0x597341={},_0x1d7eaf={},_0x355cd9={'count':0x0,'rows':[]};var _0x2ce4dd=_[_0xa72a('0x2b')](db[_0xa72a('0x2c')][_0xa72a('0x2d')],function(_0x7deb56){return{'name':_0x7deb56[_0xa72a('0x2e')],'type':_0x7deb56[_0xa72a('0x2f')][_0xa72a('0x30')]};});_0x1d7eaf[_0xa72a('0x31')]=_[_0xa72a('0x2b')](_0x2ce4dd,'name');_0x1d7eaf['query']=_[_0xa72a('0x32')](_0x49cb2a[_0xa72a('0x33')]);_0x1d7eaf[_0xa72a('0x34')]=_[_0xa72a('0x35')](_0x1d7eaf[_0xa72a('0x31')],_0x1d7eaf[_0xa72a('0x33')]);_0x597341[_0xa72a('0x36')]=_[_0xa72a('0x35')](_0x1d7eaf[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x37')]));_0x597341[_0xa72a('0x36')]=_0x597341[_0xa72a('0x36')][_0xa72a('0x38')]?_0x597341[_0xa72a('0x36')]:_0x1d7eaf[_0xa72a('0x31')];if(!_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x39')]('nolimit')){_0x597341['limit']=qs[_0xa72a('0x1e')](_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x1e')]);_0x597341[_0xa72a('0x1c')]=qs[_0xa72a('0x1c')](_0x49cb2a['query'][_0xa72a('0x1c')]);}_0x597341[_0xa72a('0x3a')]=qs['sort'](_0x49cb2a[_0xa72a('0x33')]['sort']);_0x597341[_0xa72a('0x3b')]=qs[_0xa72a('0x34')](_[_0xa72a('0x3c')](_0x49cb2a[_0xa72a('0x33')],_0x1d7eaf[_0xa72a('0x34')]),_0x2ce4dd);if(_0x49cb2a[_0xa72a('0x33')]['filter']){_0x597341[_0xa72a('0x3b')]=_['merge'](_0x597341[_0xa72a('0x3b')],{'$or':_[_0xa72a('0x2b')](_0x2ce4dd,function(_0x1ad45c){if(_0x1ad45c[_0xa72a('0x2f')]!==_0xa72a('0x3d')){var _0xfa9431={};_0xfa9431[_0x1ad45c[_0xa72a('0x28')]]={'$like':'%'+_0x49cb2a['query']['filter']+'%'};return _0xfa9431;}})});}_0x597341=_[_0xa72a('0x3e')]({},_0x597341,_0x49cb2a[_0xa72a('0x3f')]);var _0x18354b={'where':_0x597341[_0xa72a('0x3b')]};return db['Attachment'][_0xa72a('0x40')](_0x18354b)[_0xa72a('0x23')](function(_0x291525){_0x355cd9['count']=_0x291525;if(_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x41')]){_0x597341[_0xa72a('0x42')]=[{'all':!![]}];}return db[_0xa72a('0x2c')][_0xa72a('0x43')](_0x597341);})[_0xa72a('0x23')](function(_0x31690a){_0x355cd9[_0xa72a('0x44')]=_0x31690a;return _0x355cd9;})[_0xa72a('0x23')](respondWithFilteredResult(_0x4dccfb,_0x597341))[_0xa72a('0x45')](handleError(_0x4dccfb,null));};exports[_0xa72a('0x46')]=function(_0x5a9d8a,_0x1d5397){var _0x54aee7={'raw':!![],'where':{'id':_0x5a9d8a['params']['id']}},_0x17516b={};_0x17516b[_0xa72a('0x31')]=_[_0xa72a('0x32')](db['Attachment'][_0xa72a('0x2d')]);_0x17516b[_0xa72a('0x33')]=_[_0xa72a('0x32')](_0x5a9d8a['query']);_0x17516b['filters']=_[_0xa72a('0x35')](_0x17516b[_0xa72a('0x31')],_0x17516b[_0xa72a('0x33')]);_0x54aee7['attributes']=_[_0xa72a('0x35')](_0x17516b[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x5a9d8a[_0xa72a('0x33')][_0xa72a('0x37')]));_0x54aee7['attributes']=_0x54aee7[_0xa72a('0x36')]['length']?_0x54aee7[_0xa72a('0x36')]:_0x17516b[_0xa72a('0x31')];if(_0x5a9d8a[_0xa72a('0x33')][_0xa72a('0x41')]){_0x54aee7[_0xa72a('0x42')]=[{'all':!![]}];}_0x54aee7=_[_0xa72a('0x3e')]({},_0x54aee7,_0x5a9d8a[_0xa72a('0x3f')]);return db['Attachment'][_0xa72a('0x47')](_0x54aee7)[_0xa72a('0x23')](handleEntityNotFound(_0x1d5397,null))[_0xa72a('0x23')](respondWithResult(_0x1d5397,null))[_0xa72a('0x45')](handleError(_0x1d5397,null));};exports[_0xa72a('0x48')]=function(_0x254484,_0x4476db){var _0x592d1f={'where':{'id':_0x254484[_0xa72a('0x49')]['id']}},_0x5751d1={};_0x5751d1[_0xa72a('0x31')]=_['keys'](db['Attachment']['rawAttributes']);_0x592d1f[_0xa72a('0x36')]=_[_0xa72a('0x35')](_0x5751d1[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x254484['query']['fields']));_0x592d1f[_0xa72a('0x36')]=_0x592d1f[_0xa72a('0x36')][_0xa72a('0x38')]?_0x592d1f[_0xa72a('0x36')]:_0x5751d1['model'];if(_0x254484[_0xa72a('0x33')]['includeAll']){_0x592d1f[_0xa72a('0x42')]=[{'all':!![]}];}_0x592d1f=_['merge']({},_0x592d1f,_0x254484['options']);return db['Attachment']['find'](_0x592d1f)[_0xa72a('0x23')](handleEntityNotFound(_0x4476db,null))['then'](function(_0x5a727d){if(_0x5a727d){var _0x2ea662=_0x5a727d[_0xa72a('0x4a')]({'plain':!![]});_0x2ea662=qs[_0xa72a('0x4b')](_0x2ea662,['id','createdAt','updatedAt']);_0x254484[_0xa72a('0x4c')]=_[_0xa72a('0x4b')](_0x254484[_0xa72a('0x4c')],['id',_0xa72a('0x4d'),_0xa72a('0x4e')]);return db[_0xa72a('0x2c')][_0xa72a('0x4f')](_['merge'](_0x2ea662,_0x254484[_0xa72a('0x4c')]),{'include':_0x254484['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4476db,0xc9))[_0xa72a('0x45')](handleError(_0x4476db,null));};exports[_0xa72a('0x50')]=function(_0x43ecae,_0xdbaa53){if(_0x43ecae[_0xa72a('0x4c')]['id']){delete _0x43ecae[_0xa72a('0x4c')]['id'];}return db['Attachment']['find']({'where':{'id':_0x43ecae[_0xa72a('0x49')]['id']}})[_0xa72a('0x23')](handleEntityNotFound(_0xdbaa53,null))['then'](saveUpdates(_0x43ecae[_0xa72a('0x4c')],null))['then'](respondWithResult(_0xdbaa53,null))[_0xa72a('0x45')](handleError(_0xdbaa53,null));};exports[_0xa72a('0x24')]=function(_0x4a0309,_0x222059){return db[_0xa72a('0x2c')][_0xa72a('0x47')]({'where':{'id':_0x4a0309[_0xa72a('0x49')]['id']}})[_0xa72a('0x23')](handleEntityNotFound(_0x222059,null))[_0xa72a('0x23')](removeEntity(_0x222059,null))[_0xa72a('0x45')](handleError(_0x222059,null));};exports[_0xa72a('0x4f')]=function(_0x49690b,_0x368f95,_0x1b1a4f){_0x49690b['body'][_0xa72a('0x28')]=_0x49690b[_0xa72a('0x51')][_0xa72a('0x52')];_0x49690b[_0xa72a('0x4c')][_0xa72a('0x53')]=_0x49690b[_0xa72a('0x51')][_0xa72a('0x54')];_0x49690b[_0xa72a('0x4c')][_0xa72a('0x2f')]=_0x49690b['file'][_0xa72a('0x55')];return db[_0xa72a('0x2c')][_0xa72a('0x4f')](_0x49690b[_0xa72a('0x4c')])[_0xa72a('0x23')](respondWithResult(_0x368f95,0xc9))['catch'](handleError(_0x368f95,null));};exports[_0xa72a('0x56')]=function(_0x387c99,_0x4816a9,_0x527979){return db[_0xa72a('0x2c')][_0xa72a('0x57')]({'where':{'id':_0x387c99[_0xa72a('0x49')]['id']},'raw':!![]})[_0xa72a('0x23')](handleEntityNotFound(_0x4816a9,null))[_0xa72a('0x23')](function(_0x493e46){if(_0x493e46){var _0x4eb3cc=_0x493e46[_0xa72a('0x58')]!==null;var _0x54fe79=path[_0xa72a('0x59')](config[_0xa72a('0x5a')],_0xa72a('0x5b'));if(_0x4eb3cc){_0x54fe79=path[_0xa72a('0x59')](_0x54fe79,_0xa72a('0x5c'));}var _0x19e00f=path[_0xa72a('0x59')](_0x54fe79,_0x493e46[_0xa72a('0x53')]);return _0x4816a9[_0xa72a('0x56')](_0x19e00f);}})['catch'](handleError(_0x4816a9,null));}; \ No newline at end of file +var _0x8d33=['name','send','index','map','Attachment','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','length','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','server/files/attachments/','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x8d33,0x1a0));var _0x38d3=function(_0x3354d7,_0x5166f3){_0x3354d7=_0x3354d7-0x0;var _0x489c70=_0x8d33[_0x3354d7];return _0x489c70;};'use strict';var emlformat=require(_0x38d3('0x0'));var rimraf=require(_0x38d3('0x1'));var zipdir=require(_0x38d3('0x2'));var jsonpatch=require(_0x38d3('0x3'));var rp=require(_0x38d3('0x4'));var moment=require(_0x38d3('0x5'));var BPromise=require(_0x38d3('0x6'));var Mustache=require(_0x38d3('0x7'));var util=require(_0x38d3('0x8'));var path=require(_0x38d3('0x9'));var sox=require(_0x38d3('0xa'));var csv=require(_0x38d3('0xb'));var ejs=require(_0x38d3('0xc'));var fs=require('fs');var fs_extra=require(_0x38d3('0xd'));var _=require(_0x38d3('0xe'));var squel=require('squel');var crypto=require(_0x38d3('0xf'));var jsforce=require(_0x38d3('0x10'));var deskjs=require(_0x38d3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x38d3('0x12'));var Papa=require(_0x38d3('0x13'));var Redis=require(_0x38d3('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x38d3('0x15'));var hardwareService=require(_0x38d3('0x16'));var logger=require(_0x38d3('0x17'))('api');var utils=require(_0x38d3('0x18'));var config=require(_0x38d3('0x19'));var licenseUtil=require(_0x38d3('0x1a'));var db=require(_0x38d3('0x1b'))['db'];function respondWithStatusCode(_0x2ab31f,_0x213736){_0x213736=_0x213736||0xcc;return function(_0x5173e2){if(_0x5173e2){return _0x2ab31f[_0x38d3('0x1c')](_0x213736);}return _0x2ab31f[_0x38d3('0x1d')](_0x213736)[_0x38d3('0x1e')]();};}function respondWithResult(_0x507e62,_0x14e4d3){_0x14e4d3=_0x14e4d3||0xc8;return function(_0x335954){if(_0x335954){return _0x507e62['status'](_0x14e4d3)[_0x38d3('0x1f')](_0x335954);}};}function respondWithFilteredResult(_0xf444fd,_0xc4dfa8){return function(_0x3902de){if(_0x3902de){var _0x52408d=typeof _0xc4dfa8['offset']==='undefined'&&typeof _0xc4dfa8[_0x38d3('0x20')]===_0x38d3('0x21');var _0x1955aa=_0x3902de['count'];var _0x4c31f4=_0x52408d?0x0:_0xc4dfa8[_0x38d3('0x22')];var _0x152b6e=_0x52408d?_0x3902de['count']:_0xc4dfa8[_0x38d3('0x22')]+_0xc4dfa8[_0x38d3('0x20')];var _0x39e608;if(_0x152b6e>=_0x1955aa){_0x152b6e=_0x1955aa;_0x39e608=0xc8;}else{_0x39e608=0xce;}_0xf444fd['status'](_0x39e608);return _0xf444fd[_0x38d3('0x23')](_0x38d3('0x24'),_0x4c31f4+'-'+_0x152b6e+'/'+_0x1955aa)[_0x38d3('0x1f')](_0x3902de);}return null;};}function patchUpdates(_0x32d74c){return function(_0xf72e67){try{jsonpatch[_0x38d3('0x25')](_0xf72e67,_0x32d74c,!![]);}catch(_0x1c2267){return BPromise[_0x38d3('0x26')](_0x1c2267);}return _0xf72e67[_0x38d3('0x27')]();};}function saveUpdates(_0x28a479,_0x30135c){return function(_0x1e9d54){if(_0x1e9d54){return _0x1e9d54[_0x38d3('0x28')](_0x28a479)[_0x38d3('0x29')](function(_0x40254d){return _0x40254d;});}return null;};}function removeEntity(_0x200f4a,_0x3ee75f){return function(_0x21722b){if(_0x21722b){return _0x21722b[_0x38d3('0x2a')]()['then'](function(){_0x200f4a[_0x38d3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c352,_0x398aea){return function(_0x547b56){if(!_0x547b56){_0x44c352[_0x38d3('0x1c')](0x194);}return _0x547b56;};}function handleError(_0x21890c,_0x2d5d02){_0x2d5d02=_0x2d5d02||0x1f4;return function(_0x2dd571){logger[_0x38d3('0x2b')](_0x2dd571['stack']);if(_0x2dd571['name']){delete _0x2dd571[_0x38d3('0x2c')];}_0x21890c['status'](_0x2d5d02)[_0x38d3('0x2d')](_0x2dd571);};}exports[_0x38d3('0x2e')]=function(_0x119281,_0x5d8e63){var _0x394f33={},_0xa716df={},_0x152888={'count':0x0,'rows':[]};var _0x1042d5=_[_0x38d3('0x2f')](db[_0x38d3('0x30')][_0x38d3('0x31')],function(_0xb07851){return{'name':_0xb07851[_0x38d3('0x32')],'type':_0xb07851[_0x38d3('0x33')]['key']};});_0xa716df['model']=_['map'](_0x1042d5,_0x38d3('0x2c'));_0xa716df[_0x38d3('0x34')]=_['keys'](_0x119281[_0x38d3('0x34')]);_0xa716df[_0x38d3('0x35')]=_[_0x38d3('0x36')](_0xa716df[_0x38d3('0x37')],_0xa716df['query']);_0x394f33[_0x38d3('0x38')]=_[_0x38d3('0x36')](_0xa716df['model'],qs[_0x38d3('0x39')](_0x119281['query'][_0x38d3('0x39')]));_0x394f33[_0x38d3('0x38')]=_0x394f33[_0x38d3('0x38')]['length']?_0x394f33[_0x38d3('0x38')]:_0xa716df['model'];if(!_0x119281[_0x38d3('0x34')]['hasOwnProperty'](_0x38d3('0x3a'))){_0x394f33['limit']=qs[_0x38d3('0x20')](_0x119281[_0x38d3('0x34')][_0x38d3('0x20')]);_0x394f33['offset']=qs[_0x38d3('0x22')](_0x119281['query']['offset']);}_0x394f33[_0x38d3('0x3b')]=qs[_0x38d3('0x3c')](_0x119281[_0x38d3('0x34')][_0x38d3('0x3c')]);_0x394f33[_0x38d3('0x3d')]=qs['filters'](_[_0x38d3('0x3e')](_0x119281[_0x38d3('0x34')],_0xa716df['filters']),_0x1042d5);if(_0x119281[_0x38d3('0x34')][_0x38d3('0x3f')]){_0x394f33[_0x38d3('0x3d')]=_[_0x38d3('0x40')](_0x394f33['where'],{'$or':_[_0x38d3('0x2f')](_0x1042d5,function(_0x1256fa){if(_0x1256fa['type']!==_0x38d3('0x41')){var _0x197e52={};_0x197e52[_0x1256fa[_0x38d3('0x2c')]]={'$like':'%'+_0x119281[_0x38d3('0x34')][_0x38d3('0x3f')]+'%'};return _0x197e52;}})});}_0x394f33=_['merge']({},_0x394f33,_0x119281[_0x38d3('0x42')]);var _0x3d122f={'where':_0x394f33[_0x38d3('0x3d')]};return db['Attachment']['count'](_0x3d122f)[_0x38d3('0x29')](function(_0x592b63){_0x152888['count']=_0x592b63;if(_0x119281[_0x38d3('0x34')][_0x38d3('0x43')]){_0x394f33['include']=[{'all':!![]}];}return db[_0x38d3('0x30')][_0x38d3('0x44')](_0x394f33);})['then'](function(_0x10f0f4){_0x152888[_0x38d3('0x45')]=_0x10f0f4;return _0x152888;})[_0x38d3('0x29')](respondWithFilteredResult(_0x5d8e63,_0x394f33))[_0x38d3('0x46')](handleError(_0x5d8e63,null));};exports[_0x38d3('0x47')]=function(_0x1d0d39,_0x5ba956){var _0x573563={'raw':!![],'where':{'id':_0x1d0d39[_0x38d3('0x48')]['id']}},_0x401bc4={};_0x401bc4[_0x38d3('0x37')]=_[_0x38d3('0x49')](db[_0x38d3('0x30')][_0x38d3('0x31')]);_0x401bc4[_0x38d3('0x34')]=_['keys'](_0x1d0d39[_0x38d3('0x34')]);_0x401bc4['filters']=_[_0x38d3('0x36')](_0x401bc4[_0x38d3('0x37')],_0x401bc4['query']);_0x573563[_0x38d3('0x38')]=_[_0x38d3('0x36')](_0x401bc4[_0x38d3('0x37')],qs['fields'](_0x1d0d39[_0x38d3('0x34')][_0x38d3('0x39')]));_0x573563['attributes']=_0x573563['attributes']['length']?_0x573563[_0x38d3('0x38')]:_0x401bc4[_0x38d3('0x37')];if(_0x1d0d39[_0x38d3('0x34')][_0x38d3('0x43')]){_0x573563[_0x38d3('0x4a')]=[{'all':!![]}];}_0x573563=_['merge']({},_0x573563,_0x1d0d39[_0x38d3('0x42')]);return db[_0x38d3('0x30')][_0x38d3('0x4b')](_0x573563)[_0x38d3('0x29')](handleEntityNotFound(_0x5ba956,null))['then'](respondWithResult(_0x5ba956,null))[_0x38d3('0x46')](handleError(_0x5ba956,null));};exports['clone']=function(_0x24a7e1,_0x16d6bd){var _0x3e335a={'where':{'id':_0x24a7e1[_0x38d3('0x48')]['id']}},_0x163392={};_0x163392['model']=_[_0x38d3('0x49')](db['Attachment']['rawAttributes']);_0x3e335a[_0x38d3('0x38')]=_['intersection'](_0x163392[_0x38d3('0x37')],qs[_0x38d3('0x39')](_0x24a7e1[_0x38d3('0x34')][_0x38d3('0x39')]));_0x3e335a['attributes']=_0x3e335a[_0x38d3('0x38')][_0x38d3('0x4c')]?_0x3e335a[_0x38d3('0x38')]:_0x163392[_0x38d3('0x37')];if(_0x24a7e1[_0x38d3('0x34')][_0x38d3('0x43')]){_0x3e335a['include']=[{'all':!![]}];}_0x3e335a=_[_0x38d3('0x40')]({},_0x3e335a,_0x24a7e1[_0x38d3('0x42')]);return db[_0x38d3('0x30')][_0x38d3('0x4b')](_0x3e335a)[_0x38d3('0x29')](handleEntityNotFound(_0x16d6bd,null))[_0x38d3('0x29')](function(_0x40c993){if(_0x40c993){var _0x2e4c00=_0x40c993[_0x38d3('0x4d')]({'plain':!![]});_0x2e4c00=qs[_0x38d3('0x4e')](_0x2e4c00,['id',_0x38d3('0x4f'),_0x38d3('0x50')]);_0x24a7e1[_0x38d3('0x51')]=_['omit'](_0x24a7e1[_0x38d3('0x51')],['id',_0x38d3('0x4f'),_0x38d3('0x50')]);return db[_0x38d3('0x30')][_0x38d3('0x52')](_['merge'](_0x2e4c00,_0x24a7e1[_0x38d3('0x51')]),{'include':_0x24a7e1['query'][_0x38d3('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x16d6bd,0xc9))[_0x38d3('0x46')](handleError(_0x16d6bd,null));};exports[_0x38d3('0x28')]=function(_0x21dff5,_0x4abba8){if(_0x21dff5[_0x38d3('0x51')]['id']){delete _0x21dff5[_0x38d3('0x51')]['id'];}return db[_0x38d3('0x30')]['find']({'where':{'id':_0x21dff5['params']['id']}})[_0x38d3('0x29')](handleEntityNotFound(_0x4abba8,null))[_0x38d3('0x29')](saveUpdates(_0x21dff5[_0x38d3('0x51')],null))[_0x38d3('0x29')](respondWithResult(_0x4abba8,null))[_0x38d3('0x46')](handleError(_0x4abba8,null));};exports[_0x38d3('0x2a')]=function(_0xc7bfec,_0x28a3d6){return db[_0x38d3('0x30')][_0x38d3('0x4b')]({'where':{'id':_0xc7bfec[_0x38d3('0x48')]['id']}})['then'](handleEntityNotFound(_0x28a3d6,null))['then'](removeEntity(_0x28a3d6,null))['catch'](handleError(_0x28a3d6,null));};exports[_0x38d3('0x52')]=function(_0x83af43,_0x221f22,_0x1d027d){_0x83af43[_0x38d3('0x51')][_0x38d3('0x2c')]=_0x83af43[_0x38d3('0x53')][_0x38d3('0x54')];_0x83af43[_0x38d3('0x51')][_0x38d3('0x55')]=_0x83af43['file'][_0x38d3('0x56')];_0x83af43['body'][_0x38d3('0x33')]=_0x83af43[_0x38d3('0x53')][_0x38d3('0x57')];return db[_0x38d3('0x30')][_0x38d3('0x52')](_0x83af43[_0x38d3('0x51')])['then'](respondWithResult(_0x221f22,0xc9))[_0x38d3('0x46')](handleError(_0x221f22,null));};exports[_0x38d3('0x58')]=function(_0x294503,_0x3aae95,_0x4ba447){return db[_0x38d3('0x30')]['findOne']({'where':{'id':_0x294503[_0x38d3('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3aae95,null))[_0x38d3('0x29')](function(_0x312f63){if(_0x312f63){var _0x473d1f=_0x312f63[_0x38d3('0x59')]!==null;var _0x2270d5=path['join'](config['root'],_0x38d3('0x5a'));if(_0x473d1f){_0x2270d5=path[_0x38d3('0x5b')](_0x2270d5,'offline-chat/');}var _0x530023=path[_0x38d3('0x5b')](_0x2270d5,_0x312f63[_0x38d3('0x55')]);return _0x3aae95[_0x38d3('0x58')](_0x530023);}})[_0x38d3('0x46')](handleError(_0x3aae95,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 9ff6b1a..0d47f17 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 _0x3b12=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3b12,0x19e));var _0x23b1=function(_0x12f0fd,_0x493307){_0x12f0fd=_0x12f0fd-0x0;var _0x33355d=_0x3b12[_0x12f0fd];return _0x33355d;};'use strict';var _=require(_0x23b1('0x0'));var util=require(_0x23b1('0x1'));var logger=require('../../config/logger')(_0x23b1('0x2'));var moment=require(_0x23b1('0x3'));var BPromise=require(_0x23b1('0x4'));var rp=require(_0x23b1('0x5'));var fs=require('fs');var path=require(_0x23b1('0x6'));var rimraf=require(_0x23b1('0x7'));var config=require(_0x23b1('0x8'));var attributes=require('./attachment.attributes');module[_0x23b1('0x9')]=function(_0x28f6f9,_0x2408a5){return _0x28f6f9[_0x23b1('0xa')](_0x23b1('0xb'),attributes,{'tableName':_0x23b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e85=['rimraf','../../config/environment','exports','define','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2b63ea,_0x182b86){var _0x838701=function(_0x22d6d6){while(--_0x22d6d6){_0x2b63ea['push'](_0x2b63ea['shift']());}};_0x838701(++_0x182b86);}(_0x2e85,0x144));var _0x52e8=function(_0x1aef08,_0x521afc){_0x1aef08=_0x1aef08-0x0;var _0x105a2c=_0x2e85[_0x1aef08];return _0x105a2c;};'use strict';var _=require('lodash');var util=require(_0x52e8('0x0'));var logger=require(_0x52e8('0x1'))(_0x52e8('0x2'));var moment=require(_0x52e8('0x3'));var BPromise=require(_0x52e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52e8('0x5'));var rimraf=require(_0x52e8('0x6'));var config=require(_0x52e8('0x7'));var attributes=require('./attachment.attributes');module[_0x52e8('0x8')]=function(_0x444d91,_0x5720fe){return _0x444d91[_0x52e8('0x9')]('Attachment',attributes,{'tableName':'attachments','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 9741a05..58eb301 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 _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x6a24,0xd1));var _0x46a2=function(_0x4f2694,_0x3c4a1d){_0x4f2694=_0x4f2694-0x0;var _0x53a1a1=_0x6a24[_0x4f2694];return _0x53a1a1;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file +var _0xa75b=['client','http','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Attachment','create','options','CreateAttachment','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa75b,0x170));var _0xba75=function(_0x46d6b7,_0x117a8d){_0x46d6b7=_0x46d6b7-0x0;var _0x44f492=_0xa75b[_0x46d6b7];return _0x44f492;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});}exports['CreateAttachment']=function(_0x2822af){var _0xd8850f=this;return new Promise(function(_0xc4bf17,_0x132750){return db[_0xba75('0x16')][_0xba75('0x17')](_0x2822af['body'],{'raw':_0x2822af[_0xba75('0x18')]?_0x2822af[_0xba75('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x35ffd2){logger[_0xba75('0x14')]('CreateAttachment',_0x2822af);logger['debug'](_0xba75('0x19'),_0x2822af,JSON['stringify'](_0x35ffd2));_0xc4bf17(_0x35ffd2);})[_0xba75('0x1a')](function(_0x2ece41){logger[_0xba75('0x11')]('CreateAttachment',_0x2ece41[_0xba75('0x13')],_0x2822af);_0x132750(_0xd8850f[_0xba75('0x11')](0x1f4,_0x2ece41[_0xba75('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e126f29..4ac2ab2 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3e80d5,_0x4f0faa){var _0x4fb5c7=function(_0x107ff1){while(--_0x107ff1){_0x3e80d5['push'](_0x3e80d5['shift']());}};_0x4fb5c7(++_0x4f0faa);}(_0x2032,0xd9));var _0x2203=function(_0x438eda,_0x3742c5){_0x438eda=_0x438eda-0x0;var _0x2c743b=_0x2032[_0x438eda];return _0x2c743b;};'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/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xa7144f,_0x53ba7a){var _0x417dfe=function(_0x1b6e19){while(--_0x1b6e19){_0xa7144f['push'](_0xa7144f['shift']());}};_0x417dfe(++_0x53ba7a);}(_0x2032,0xd9));var _0x2203=function(_0x5dbb14,_0xfa4e72){_0x5dbb14=_0x5dbb14-0x0;var _0x1e181e=_0x2032[_0x5dbb14];return _0x1e181e;};'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/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 342e638..3aab988 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 _0xcd8d=['clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','passport','passport-local','Strategy','moment','util','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','then','adSsoEnabled','findOne','password','salt','disabled','blocked','online','admin','agent','name','blockDuration','blockedAt','add'];(function(_0x4727f1,_0x2ff773){var _0x2977ce=function(_0x29be89){while(--_0x29be89){_0x4727f1['push'](_0x4727f1['shift']());}};_0x2977ce(++_0x2ff773);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0xcd8d[_0x2f32c4];return _0x3f3018;};'use strict';var passport=require(_0xdcd8('0x0'));var LocalStrategy=require(_0xdcd8('0x1'))[_0xdcd8('0x2')];var moment=require(_0xdcd8('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xdcd8('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xdcd8('0x5'));var config=require(_0xdcd8('0x6'));var logger=require(_0xdcd8('0x7'))(_0xdcd8('0x8'));function isActiveDirectoryConfigured(_0x18abbd){var _0x2e3281=![];if(typeof _0x18abbd[_0xdcd8('0x9')]!==_0xdcd8('0xa')){_0x2e3281=_0x18abbd[_0xdcd8('0x9')][_0xdcd8('0xb')]&&_0x18abbd[_0xdcd8('0x9')][_0xdcd8('0xc')]&&_0x18abbd[_0xdcd8('0x9')]['domain'];}return _0x2e3281;}function adAuthenticate(_0x4fdf26,_0x421c06,_0x52770d){return new BPromise(function(_0x1fcf72,_0x1f2ff6){try{var _0x2c5616=new ActiveDirectory(_0x4fdf26);_0x2c5616['authenticate'](_0x421c06,_0x52770d,function(_0x8758c7,_0xe6d091){if(_0x8758c7){logger[_0xdcd8('0xd')](_0xdcd8('0xe'),_0x421c06,util[_0xdcd8('0xf')](_0x8758c7,{'showHidden':![],'depth':null}));_0x1f2ff6(_0xdcd8('0x10'));}else if(!_0xe6d091){logger['error'](_0xdcd8('0x11'),_0x421c06);_0x1f2ff6(_0xdcd8('0x10'));}else{_0x1fcf72(_0xe6d091);}});}catch(_0x4f04ca){_0x1f2ff6(_0x4f04ca);}});}function ActiveDirectoryAuthenticate(_0x316ad9,_0x50e768,_0x3b1989,_0xec131b){var _0x1f1372,_0x34fd8a;if(!isActiveDirectoryConfigured(config)){logger[_0xdcd8('0xd')](_0xdcd8('0x12'),_0x50e768);return _0xec131b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xdcd8('0x13')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xdcd8('0x14')](function(_0x193d03){_0x1f1372=_0x193d03;if(!_0x1f1372[_0xdcd8('0x15')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x50e768);throw new Error(_0xdcd8('0x10'));}return _0x316ad9[_0xdcd8('0x16')]({'attributes':['id','name',_0xdcd8('0x17'),_0xdcd8('0x18'),'role',_0xdcd8('0x19'),_0xdcd8('0x1a'),'blockedAt',_0xdcd8('0x1b')],'where':{'name':_0x50e768,'role':{'$or':[_0xdcd8('0x1c'),'user',_0xdcd8('0x1d')]},'adSsoEnabled':!![]}});})[_0xdcd8('0x14')](function(_0x172bca){if(!_0x172bca||_0x172bca&&_0x172bca['name']!==_0x50e768){throw new Error(_0xdcd8('0x10'));}_0x34fd8a=_0x172bca;var _0x75a381=_0x34fd8a[_0xdcd8('0x1e')]+'@'+config[_0xdcd8('0x9')]['domain'];return adAuthenticate(config[_0xdcd8('0x9')],_0x75a381,_0x3b1989);})['then'](function(_0x3912e5){if(_0x34fd8a[_0xdcd8('0x19')]){throw new Error(_0xdcd8('0x10'));}if(_0x1f1372[_0xdcd8('0x1f')]>0x0){if(_0x34fd8a[_0xdcd8('0x1a')]){if(moment(_0x34fd8a[_0xdcd8('0x20')])[_0xdcd8('0x21')](_0x1f1372['blockDuration'],'minutes')>moment()){throw new Error(_0xdcd8('0x10'));}return utils[_0xdcd8('0x22')](_0x34fd8a,0x0,![],null)[_0xdcd8('0x14')](function(){return utils[_0xdcd8('0x23')](_0x34fd8a);})[_0xdcd8('0x14')](function(){return _0xec131b(null,_0x34fd8a);});}else{return utils[_0xdcd8('0x23')](_0x34fd8a)['then'](function(){return _0xec131b(null,_0x34fd8a);});}}else{return utils[_0xdcd8('0x23')](_0x34fd8a)['then'](function(){return _0xec131b(null,_0x34fd8a);});}})[_0xdcd8('0x24')](function(_0x36816b){return _0xec131b(null,![],_0x36816b);});}function handleError(_0x3341ce,_0x5f2200,_0xa18d09){return _0x3341ce[_0xdcd8('0x25')](_0x5f2200||0x1f4)[_0xdcd8('0x26')]({'message':_0xa18d09?_0xa18d09['message']||_0xa18d09:''});}exports[_0xdcd8('0x27')]=function(_0x2d5778,_0x23d501,_0x505abe){passport['authenticate'](_0xdcd8('0x28'),function(_0xe7747b,_0x4f3ec5,_0x3a7663){var _0x10d625=_0xe7747b||_0x3a7663;if(_0x10d625){return handleError(_0x23d501,0x191,_0x10d625);}if(!_0x4f3ec5){return handleError(_0x23d501,0x194,{'message':_0xdcd8('0x29')});}else{var _0xca743e={'payload':{'id':_0x4f3ec5['id'],'role':_0x4f3ec5['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xca743e)['then'](function(_0x2b3963){_0x23d501[_0xdcd8('0x2a')]({'id':_0x4f3ec5['id'],'token':_0x2b3963,'statusCall':'','isAlreadyLogged':_0x4f3ec5[_0xdcd8('0x1b')]});});}})(_0x2d5778,_0x23d501,_0x505abe);};passport[_0xdcd8('0x2b')](_0xdcd8('0x28'),new LocalStrategy({'usernameField':_0xdcd8('0x1e'),'passwordField':_0xdcd8('0x17')},function(_0x271eb6,_0x946aab,_0x56d581){return ActiveDirectoryAuthenticate(db['User'],_0x271eb6,_0x946aab,_0x56d581);})); \ No newline at end of file +var _0xda51=['login','authenticate','ad-login','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','url','error','Error\x20authenticate\x20%s:\x20%s','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','name','password','salt','disabled','online','admin','user','domain','blocked','blockedAt','add','clearBlockUser','getLicense','catch','status','send','message'];(function(_0x1fd3f8,_0x8bdd8a){var _0x3d5169=function(_0x582938){while(--_0x582938){_0x1fd3f8['push'](_0x1fd3f8['shift']());}};_0x3d5169(++_0x8bdd8a);}(_0xda51,0x1db));var _0x1da5=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xda51[_0x25e109];return _0xc0f7d6;};'use strict';var passport=require(_0x1da5('0x0'));var LocalStrategy=require(_0x1da5('0x1'))[_0x1da5('0x2')];var moment=require(_0x1da5('0x3'));var ActiveDirectory=require(_0x1da5('0x4'));var BPromise=require(_0x1da5('0x5'));var util=require(_0x1da5('0x6'));var db=require(_0x1da5('0x7'))['db'];var authService=require(_0x1da5('0x8'));var utils=require(_0x1da5('0x9'));var config=require(_0x1da5('0xa'));var logger=require(_0x1da5('0xb'))(_0x1da5('0xc'));function isActiveDirectoryConfigured(_0x35eceb){var _0x415ada=![];if(typeof _0x35eceb[_0x1da5('0xd')]!=='undefined'){_0x415ada=_0x35eceb[_0x1da5('0xd')]['baseDN']&&_0x35eceb[_0x1da5('0xd')][_0x1da5('0xe')]&&_0x35eceb[_0x1da5('0xd')]['domain'];}return _0x415ada;}function adAuthenticate(_0x3abc63,_0x4c8f31,_0x123cfb){return new BPromise(function(_0x39e915,_0x40019a){try{var _0x488999=new ActiveDirectory(_0x3abc63);_0x488999['authenticate'](_0x4c8f31,_0x123cfb,function(_0x32cec0,_0x123819){if(_0x32cec0){logger[_0x1da5('0xf')](_0x1da5('0x10'),_0x4c8f31,util['inspect'](_0x32cec0,{'showHidden':![],'depth':null}));_0x40019a(_0x1da5('0x11'));}else if(!_0x123819){logger['error'](_0x1da5('0x12'),_0x4c8f31);_0x40019a(_0x1da5('0x11'));}else{_0x39e915(_0x123819);}});}catch(_0x41772e){_0x40019a(_0x41772e);}});}function ActiveDirectoryAuthenticate(_0x5ca1a3,_0x395e91,_0x57d9bb,_0x458a9b){var _0x2d4c34,_0x111e62;if(!isActiveDirectoryConfigured(config)){logger[_0x1da5('0xf')](_0x1da5('0x13'),_0x395e91);return _0x458a9b(null,![],{'message':_0x1da5('0x11')});}return db[_0x1da5('0x14')][_0x1da5('0x15')]({'where':{'id':0x1},'attributes':[_0x1da5('0x16'),_0x1da5('0x17')],'raw':!![]})[_0x1da5('0x18')](function(_0x123e72){_0x2d4c34=_0x123e72;if(!_0x2d4c34[_0x1da5('0x16')]){logger[_0x1da5('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x395e91);throw new Error(_0x1da5('0x11'));}return _0x5ca1a3[_0x1da5('0x15')]({'attributes':['id',_0x1da5('0x19'),_0x1da5('0x1a'),_0x1da5('0x1b'),'role',_0x1da5('0x1c'),'blocked','blockedAt',_0x1da5('0x1d')],'where':{'name':_0x395e91,'role':{'$or':[_0x1da5('0x1e'),_0x1da5('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x1da5('0x18')](function(_0x7e90de){if(!_0x7e90de||_0x7e90de&&_0x7e90de[_0x1da5('0x19')]!==_0x395e91){throw new Error(_0x1da5('0x11'));}_0x111e62=_0x7e90de;var _0x2f5679=_0x111e62[_0x1da5('0x19')]+'@'+config[_0x1da5('0xd')][_0x1da5('0x20')];return adAuthenticate(config['activedirectory'],_0x2f5679,_0x57d9bb);})[_0x1da5('0x18')](function(_0x358619){if(_0x111e62[_0x1da5('0x1c')]){throw new Error(_0x1da5('0x11'));}if(_0x2d4c34[_0x1da5('0x17')]>0x0){if(_0x111e62[_0x1da5('0x21')]){if(moment(_0x111e62[_0x1da5('0x22')])[_0x1da5('0x23')](_0x2d4c34[_0x1da5('0x17')],'minutes')>moment()){throw new Error(_0x1da5('0x11'));}return utils[_0x1da5('0x24')](_0x111e62,0x0,![],null)[_0x1da5('0x18')](function(){return utils['getLicense'](_0x111e62);})[_0x1da5('0x18')](function(){return _0x458a9b(null,_0x111e62);});}else{return utils[_0x1da5('0x25')](_0x111e62)['then'](function(){return _0x458a9b(null,_0x111e62);});}}else{return utils[_0x1da5('0x25')](_0x111e62)[_0x1da5('0x18')](function(){return _0x458a9b(null,_0x111e62);});}})[_0x1da5('0x26')](function(_0x1f22c3){return _0x458a9b(null,![],_0x1f22c3);});}function handleError(_0x3e00d1,_0x43f59c,_0x5901b8){return _0x3e00d1[_0x1da5('0x27')](_0x43f59c||0x1f4)[_0x1da5('0x28')]({'message':_0x5901b8?_0x5901b8[_0x1da5('0x29')]||_0x5901b8:''});}exports[_0x1da5('0x2a')]=function(_0x538396,_0x3e5ce1,_0x417ee4){passport[_0x1da5('0x2b')](_0x1da5('0x2c'),function(_0x5e66e5,_0x41c82b,_0x5af5c7){var _0x34b9c0=_0x5e66e5||_0x5af5c7;if(_0x34b9c0){return handleError(_0x3e5ce1,0x191,_0x34b9c0);}if(!_0x41c82b){return handleError(_0x3e5ce1,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x567375={'payload':{'id':_0x41c82b['id'],'role':_0x41c82b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x567375)[_0x1da5('0x18')](function(_0x1684cc){_0x3e5ce1['json']({'id':_0x41c82b['id'],'token':_0x1684cc,'statusCall':'','isAlreadyLogged':_0x41c82b[_0x1da5('0x1d')]});});}})(_0x538396,_0x3e5ce1,_0x417ee4);};passport[_0x1da5('0x2d')](_0x1da5('0x2c'),new LocalStrategy({'usernameField':_0x1da5('0x19'),'passwordField':_0x1da5('0x1a')},function(_0x145210,_0x124101,_0x488e46){return ActiveDirectoryAuthenticate(db[_0x1da5('0x2e')],_0x145210,_0x124101,_0x488e46);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 75883ea..fe13be6 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 _0xb50b=['login','exports','express','./authActiveDirectory.controller'];(function(_0x7c43a9,_0x2ed443){var _0x573edb=function(_0x2be93d){while(--_0x2be93d){_0x7c43a9['push'](_0x7c43a9['shift']());}};_0x573edb(++_0x2ed443);}(_0xb50b,0x15a));var _0xbb50=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xb50b[_0x319cb9];return _0x1735fc;};'use strict';var express=require(_0xbb50('0x0'));var router=express['Router']();var controller=require(_0xbb50('0x1'));router['post']('/',controller[_0xbb50('0x2')]);module[_0xbb50('0x3')]=router; \ No newline at end of file +var _0x663c=['post','exports','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x663c,0x196));var _0xc663=function(_0x1e01ca,_0x14dc80){_0x1e01ca=_0x1e01ca-0x0;var _0x318e7f=_0x663c[_0x1e01ca];return _0x318e7f;};'use strict';var express=require(_0xc663('0x0'));var router=express[_0xc663('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xc663('0x2')]('/',controller['login']);module[_0xc663('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 cc46ef1..c984ffc 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7a54,0x106));var _0x47a5=function(_0x595630,_0x904aeb){_0x595630=_0x595630-0x0;var _0x2464ec=_0x7a54[_0x595630];return _0x2464ec;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7a54,0x106));var _0x47a5=function(_0x2554fb,_0x5b724a){_0x2554fb=_0x2554fb-0x0;var _0x1ffb55=_0x7a54[_0x2554fb];return _0x1ffb55;};'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 a1ed68e..583db8a 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 _0xbd3a=['login','/callback','callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbd3a,0x1e5));var _0xabd3=function(_0x420348,_0x42038c){_0x420348=_0x420348-0x0;var _0x2c09e5=_0xbd3a[_0x420348];return _0x2c09e5;};'use strict';var express=require('express');var passport=require(_0xabd3('0x0'));var router=express[_0xabd3('0x1')]();var controller=require(_0xabd3('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xabd3('0x3'));router[_0xabd3('0x4')]('/',controller[_0xabd3('0x5')]);router[_0xabd3('0x4')](_0xabd3('0x6'),controller[_0xabd3('0x7')],authService[_0xabd3('0x8')],userController[_0xabd3('0x5')],authService[_0xabd3('0x9')]);module['exports']=router; \ No newline at end of file +var _0x5e93=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5e93,0x174));var _0x35e9=function(_0x2b7c86,_0x3d3ab4){_0x2b7c86=_0x2b7c86-0x0;var _0x5d7cd3=_0x5e93[_0x2b7c86];return _0x5d7cd3;};'use strict';var express=require(_0x35e9('0x0'));var passport=require(_0x35e9('0x1'));var router=express[_0x35e9('0x2')]();var controller=require(_0x35e9('0x3'));var userController=require(_0x35e9('0x4'));var authService=require(_0x35e9('0x5'));router[_0x35e9('0x6')]('/',controller[_0x35e9('0x7')]);router[_0x35e9('0x6')](_0x35e9('0x8'),controller[_0x35e9('0x9')],authService[_0x35e9('0xa')],userController['login'],authService[_0x35e9('0xb')]);module[_0x35e9('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9b22476..f2b9f08 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 _0xed4f=['signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','passwordHistoryLimit','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','../../config/utils','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','blockedAt','loginAttempts','agent','authenticate','blocked','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','disabled','add','minutes','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login'];(function(_0x416c14,_0x8f64df){var _0x13a057=function(_0x4131b2){while(--_0x4131b2){_0x416c14['push'](_0x416c14['shift']());}};_0x13a057(++_0x8f64df);}(_0xed4f,0x111));var _0xfed4=function(_0x5d9024,_0x213750){_0x5d9024=_0x5d9024-0x0;var _0x6e7987=_0xed4f[_0x5d9024];return _0x6e7987;};'use strict';var util=require(_0xfed4('0x0'));var passport=require(_0xfed4('0x1'));var LocalStrategy=require(_0xfed4('0x2'))['Strategy'];var jayson=require(_0xfed4('0x3'));var _=require(_0xfed4('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xfed4('0x5'));var client=jayson['client'][_0xfed4('0x6')]({'port':0x232b});function localAuthenticate(_0x4f82d1,_0x1312de,_0x5d6685,_0x1cfb5e){var _0x45203a,_0x510943;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xfed4('0x7'),_0xfed4('0x8')],'raw':!![]})[_0xfed4('0x9')](function(_0x4c171a){_0x45203a=_0x4c171a;return _0x4f82d1[_0xfed4('0xa')]({'attributes':['id',_0xfed4('0xb'),_0xfed4('0xc'),_0xfed4('0xd'),_0xfed4('0xe'),'disabled','blocked',_0xfed4('0xf'),_0xfed4('0x10')],'where':{'name':_0x1312de,'role':{'$or':['admin','user',_0xfed4('0x11')]}}});})[_0xfed4('0x9')](function(_0x5b9030){if(!_0x5b9030||_0x5b9030&&_0x5b9030[_0xfed4('0xb')]!==_0x1312de){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x510943=_0x5b9030;return _0x510943;}})[_0xfed4('0x9')](function(){_0x510943[_0xfed4('0x12')](_0x5d6685,function(_0x10251b,_0x5b7558){var _0x261ab8=_0x510943[_0xfed4('0x10')]+0x1;if(_0x10251b){return _0x1cfb5e(_0x10251b);}else if(!_0x5b7558){if(_0x510943['disabled']){return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x45203a['allowedLoginAttempts']>0x0){if(_0x510943[_0xfed4('0x13')]){if(_0x45203a[_0xfed4('0x8')]>0x0){if(moment(_0x510943[_0xfed4('0xf')])['add'](_0x45203a['blockDuration'],'minutes')>moment()){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else{return utils[_0xfed4('0x15')](_0x510943,_0x261ab8,![],null)[_0xfed4('0x9')](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}}else{return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}}else{if(_0x261ab8>=_0x45203a[_0xfed4('0x7')]){return utils[_0xfed4('0x15')](_0x510943,0x0,!![],moment())['then'](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}else{return utils[_0xfed4('0x15')](_0x510943,_0x261ab8,![],null)['then'](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}}}else{return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x510943[_0xfed4('0x16')]){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else if(_0x45203a[_0xfed4('0x7')]>0x0){if(_0x510943[_0xfed4('0x13')]){if(_0x45203a['blockDuration']>0x0){if(moment(_0x510943[_0xfed4('0xf')])[_0xfed4('0x17')](_0x45203a[_0xfed4('0x8')],_0xfed4('0x18'))>moment()){return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfed4('0x15')](_0x510943,0x0,![],null)[_0xfed4('0x9')](function(){return utils['getLicense'](_0x510943);})[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);});}}else{return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}}else{return utils[_0xfed4('0x15')](_0x510943,0x0,![],null)[_0xfed4('0x9')](function(){return utils[_0xfed4('0x19')](_0x510943);})[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);})[_0xfed4('0x1a')](function(_0x5313e4){return _0x1cfb5e(null,![],_0x5313e4);});}}else{if(_0x510943[_0xfed4('0x13')]){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else{return utils[_0xfed4('0x19')](_0x510943)[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);});}}}});})[_0xfed4('0x1a')](function(_0x976a9){return _0x1cfb5e(null,![],_0x976a9);});}function sendServiceMail(_0x5f3899){return db[_0xfed4('0x1b')][_0xfed4('0x1c')]({'where':{'service':!![]},'attributes':['id','name',_0xfed4('0x1d')],'include':[{'model':db['MailServerOut'],'as':_0xfed4('0x1e'),'include':[{'model':db['CloudProvider'],'as':_0xfed4('0x1f')}]}]})[_0xfed4('0x9')](function(_0x236359){if(!_0x236359){throw new Error(_0xfed4('0x20'));}var _0x3095fe=_0x236359[_0xfed4('0x21')]();var _0x1eb961={'account':_0x3095fe,'message':_[_0xfed4('0x22')]({'from':util[_0xfed4('0x23')](_0xfed4('0x24'),_0x236359[_0xfed4('0xb')],_0x236359[_0xfed4('0x1d')]||_0x236359['Smtp']['user'])},_0x5f3899)};return client[_0xfed4('0x25')](_0xfed4('0x26'),_0x1eb961);})['then'](function(_0x23f051){if(_0x23f051[_0xfed4('0x27')]){throw new Error(util['format'](_0xfed4('0x28'),_0x23f051[_0xfed4('0x27')][_0xfed4('0x29')]||JSON[_0xfed4('0x2a')](_0x23f051[_0xfed4('0x27')])));}return!![];});}function handleError(_0x35afa2,_0x117636,_0x15d519){return _0x35afa2[_0xfed4('0x2b')](_0x117636||0x1f4)[_0xfed4('0x2c')]({'message':_0x15d519?_0x15d519['message']||_0x15d519:''});}exports[_0xfed4('0x2d')]=function(_0x581157,_0x3766ed,_0x2192bb){passport[_0xfed4('0x12')](_0xfed4('0x2e'),function(_0x28d505,_0x429833,_0x586557){var _0x15fd68=_0x28d505||_0x586557;if(_0x15fd68){return handleError(_0x3766ed,0x191,_0x15fd68);}if(!_0x429833){return handleError(_0x3766ed,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3fd64c={'payload':{'id':_0x429833['id'],'role':_0x429833[_0xfed4('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xfed4('0x2f')](_0x3fd64c)[_0xfed4('0x9')](function(_0xe4b1b5){_0x3766ed[_0xfed4('0x30')]({'id':_0x429833['id'],'token':_0xe4b1b5,'statusCall':'','isAlreadyLogged':_0x429833[_0xfed4('0x31')]});});}})(_0x581157,_0x3766ed,_0x2192bb);};exports['forgot']=function(_0x9c26da,_0x85b335){if(!_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]){return handleError(_0x85b335,0x1f4,{'message':_0xfed4('0x33')});}var _0x2a2f04=rs[_0xfed4('0x34')]();_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]=_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')][_0xfed4('0x35')]()[_0xfed4('0x36')]();var _0x544ed7;return db[_0xfed4('0x37')]['findOne']({'where':{'id':0x1},'attributes':[_0xfed4('0x7'),_0xfed4('0x8')],'raw':!![]})['then'](function(_0x185075){_0x544ed7=_0x185075;return db[_0xfed4('0x38')]['find']({'where':{'email':_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]}});})[_0xfed4('0x9')](function(_0x3f99bd){if(!_0x3f99bd){throw new Error(_0xfed4('0x39'));}if(_0x3f99bd[_0xfed4('0x16')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3f99bd['blocked']){if(moment(_0x3f99bd['blockedAt'])[_0xfed4('0x17')](_0x544ed7[_0xfed4('0x8')],_0xfed4('0x18'))>moment()){throw new Error(_0xfed4('0x3a'));}else{_0x3f99bd['blocked']=![];_0x3f99bd['blockedAt']=null;}}_0x3f99bd[_0xfed4('0x3b')]=_0x2a2f04;_0x3f99bd[_0xfed4('0x3c')]=Date[_0xfed4('0x3d')]()+0x36ee80;return _0x3f99bd['save']();})['then'](function(){return sendServiceMail({'to':_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')],'subject':_0xfed4('0x3e'),'text':_0xfed4('0x3f')+_0xfed4('0x40')+'https://'+_0x9c26da[_0xfed4('0x41')]['host']+_0xfed4('0x42')+_0x2a2f04+'\x0a\x0a'+_0xfed4('0x43')});})[_0xfed4('0x9')](function(){_0x85b335[_0xfed4('0x2b')](0xc8)[_0xfed4('0x2c')]({'message':_0xfed4('0x44')});})[_0xfed4('0x1a')](function(_0x18181f){return handleError(_0x85b335,0x1f4,_0x18181f);});};exports[_0xfed4('0x45')]=function(_0x344653,_0x42713d){return db[_0xfed4('0x38')][_0xfed4('0x1c')]({'where':{'resetPasswordToken':_0x344653['params'][_0xfed4('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xfed4('0x9')](function(_0x42cd3e){if(!_0x42cd3e){throw new Error(_0xfed4('0x47'));}return db[_0xfed4('0x37')][_0xfed4('0xa')]({'attributes':['id',_0xfed4('0x48'),_0xfed4('0x49'),'passwordHistoryLimit']})['then'](function(_0x1b411e){if(_0x1b411e[_0xfed4('0x48')])authService[_0xfed4('0x4a')](_0x344653[_0xfed4('0x32')][_0xfed4('0xc')]);if(!_0x1b411e[_0xfed4('0x49')]||!_0x42cd3e['previousPasswords'])return _0x42cd3e;authService[_0xfed4('0x4b')](_0x344653['body']['password'],_0x42cd3e['previousPasswords'],_0x1b411e[_0xfed4('0x4c')]);return _0x42cd3e;})[_0xfed4('0x9')](function(){_0x42cd3e[_0xfed4('0xc')]=_0x344653[_0xfed4('0x32')][_0xfed4('0xc')];_0x42cd3e[_0xfed4('0x3b')]=null;_0x42cd3e[_0xfed4('0x3c')]=null;return _0x42cd3e[_0xfed4('0x4d')]();});})['then'](function(){_0x42713d['status'](0xc8)[_0xfed4('0x2c')]({'message':_0xfed4('0x4e')});})[_0xfed4('0x1a')](function(_0x48329d){return handleError(_0x42713d,0x1f4,_0x48329d);});};passport[_0xfed4('0x4f')]('local-login',new LocalStrategy({'usernameField':_0xfed4('0xb'),'passwordField':_0xfed4('0xc')},function(_0xe2874e,_0x31fc23,_0x3dbdab){return localAuthenticate(db[_0xfed4('0x38')],_0xe2874e,_0x31fc23,_0x3dbdab);})); \ No newline at end of file +var _0xdd8c=['MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','authenticate','local-login','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','https://','headers','host','status','Reset\x20Email\x20sent!','reset','find','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','save','use','User','util','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','getLicense','catch'];(function(_0x4cc13,_0x40f7a6){var _0x801be7=function(_0x103cda){while(--_0x103cda){_0x4cc13['push'](_0x4cc13['shift']());}};_0x801be7(++_0x40f7a6);}(_0xdd8c,0x7c));var _0xcdd8=function(_0x322dce,_0x2c374c){_0x322dce=_0x322dce-0x0;var _0x128e19=_0xdd8c[_0x322dce];return _0x128e19;};'use strict';var util=require(_0xcdd8('0x0'));var passport=require('passport');var LocalStrategy=require(_0xcdd8('0x1'))[_0xcdd8('0x2')];var jayson=require(_0xcdd8('0x3'));var _=require(_0xcdd8('0x4'));var rs=require('randomstring');var moment=require(_0xcdd8('0x5'));var db=require(_0xcdd8('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xcdd8('0x7'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x42daa6,_0xfefd03,_0x2c60bf,_0x556cad){var _0x540430,_0x40bfaf;return db[_0xcdd8('0x8')][_0xcdd8('0x9')]({'where':{'id':0x1},'attributes':[_0xcdd8('0xa'),_0xcdd8('0xb')],'raw':!![]})[_0xcdd8('0xc')](function(_0x386c9f){_0x540430=_0x386c9f;return _0x42daa6[_0xcdd8('0x9')]({'attributes':['id',_0xcdd8('0xd'),_0xcdd8('0xe'),_0xcdd8('0xf'),_0xcdd8('0x10'),_0xcdd8('0x11'),'blocked',_0xcdd8('0x12'),_0xcdd8('0x13')],'where':{'name':_0xfefd03,'role':{'$or':[_0xcdd8('0x14'),_0xcdd8('0x15'),_0xcdd8('0x16')]}}});})[_0xcdd8('0xc')](function(_0x4cac91){if(!_0x4cac91||_0x4cac91&&_0x4cac91['name']!==_0xfefd03){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x40bfaf=_0x4cac91;return _0x40bfaf;}})['then'](function(){_0x40bfaf['authenticate'](_0x2c60bf,function(_0x52de36,_0x3daf13){var _0x345042=_0x40bfaf[_0xcdd8('0x13')]+0x1;if(_0x52de36){return _0x556cad(_0x52de36);}else if(!_0x3daf13){if(_0x40bfaf[_0xcdd8('0x11')]){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}else if(_0x540430[_0xcdd8('0xa')]>0x0){if(_0x40bfaf[_0xcdd8('0x18')]){if(_0x540430['blockDuration']>0x0){if(moment(_0x40bfaf[_0xcdd8('0x12')])[_0xcdd8('0x19')](_0x540430['blockDuration'],_0xcdd8('0x1a'))>moment()){return _0x556cad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcdd8('0x1b')](_0x40bfaf,_0x345042,![],null)[_0xcdd8('0xc')](function(){return _0x556cad(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}}else{if(_0x345042>=_0x540430[_0xcdd8('0xa')]){return utils[_0xcdd8('0x1b')](_0x40bfaf,0x0,!![],moment())[_0xcdd8('0xc')](function(){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});});}else{return utils[_0xcdd8('0x1b')](_0x40bfaf,_0x345042,![],null)[_0xcdd8('0xc')](function(){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});});}}}else{return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}}else{if(_0x40bfaf['disabled']){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}else if(_0x540430[_0xcdd8('0xa')]>0x0){if(_0x40bfaf['blocked']){if(_0x540430['blockDuration']>0x0){if(moment(_0x40bfaf[_0xcdd8('0x12')])[_0xcdd8('0x19')](_0x540430[_0xcdd8('0xb')],_0xcdd8('0x1a'))>moment()){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}else{return utils[_0xcdd8('0x1b')](_0x40bfaf,0x0,![],null)['then'](function(){return utils[_0xcdd8('0x1c')](_0x40bfaf);})[_0xcdd8('0xc')](function(){return _0x556cad(null,_0x40bfaf);});}}else{return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}}else{return utils[_0xcdd8('0x1b')](_0x40bfaf,0x0,![],null)['then'](function(){return utils[_0xcdd8('0x1c')](_0x40bfaf);})['then'](function(){return _0x556cad(null,_0x40bfaf);})[_0xcdd8('0x1d')](function(_0x132600){return _0x556cad(null,![],_0x132600);});}}else{if(_0x40bfaf[_0xcdd8('0x18')]){return _0x556cad(null,![],{'message':_0xcdd8('0x17')});}else{return utils[_0xcdd8('0x1c')](_0x40bfaf)['then'](function(){return _0x556cad(null,_0x40bfaf);});}}}});})[_0xcdd8('0x1d')](function(_0x1e6f57){return _0x556cad(null,![],_0x1e6f57);});}function sendServiceMail(_0x3c628d){return db[_0xcdd8('0x1e')]['find']({'where':{'service':!![]},'attributes':['id',_0xcdd8('0xd'),_0xcdd8('0x1f')],'include':[{'model':db[_0xcdd8('0x20')],'as':_0xcdd8('0x21'),'include':[{'model':db[_0xcdd8('0x22')],'as':_0xcdd8('0x22')}]}]})[_0xcdd8('0xc')](function(_0x307bd2){if(!_0x307bd2){throw new Error(_0xcdd8('0x23'));}var _0x5aa256=_0x307bd2[_0xcdd8('0x24')]();var _0x188e8f={'account':_0x5aa256,'message':_['merge']({'from':util[_0xcdd8('0x25')]('\x22%s\x22\x20<%s>',_0x307bd2[_0xcdd8('0xd')],_0x307bd2[_0xcdd8('0x1f')]||_0x307bd2[_0xcdd8('0x21')][_0xcdd8('0x15')])},_0x3c628d)};return client[_0xcdd8('0x26')]('SendMail',_0x188e8f);})[_0xcdd8('0xc')](function(_0x2a63c0){if(_0x2a63c0[_0xcdd8('0x27')]){throw new Error(util['format'](_0xcdd8('0x28'),_0x2a63c0['error'][_0xcdd8('0x29')]||JSON[_0xcdd8('0x2a')](_0x2a63c0['error'])));}return!![];});}function handleError(_0x2c5350,_0x10543a,_0x1cab32){return _0x2c5350['status'](_0x10543a||0x1f4)[_0xcdd8('0x2b')]({'message':_0x1cab32?_0x1cab32[_0xcdd8('0x29')]||_0x1cab32:''});}exports[_0xcdd8('0x2c')]=function(_0x17dd7c,_0x3e0fb4,_0x593d3e){passport[_0xcdd8('0x2d')](_0xcdd8('0x2e'),function(_0x2fa6f8,_0x159af7,_0x1165d3){var _0x10bbbf=_0x2fa6f8||_0x1165d3;if(_0x10bbbf){return handleError(_0x3e0fb4,0x191,_0x10bbbf);}if(!_0x159af7){return handleError(_0x3e0fb4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2cabb3={'payload':{'id':_0x159af7['id'],'role':_0x159af7['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2cabb3)['then'](function(_0x268e42){_0x3e0fb4[_0xcdd8('0x2f')]({'id':_0x159af7['id'],'token':_0x268e42,'statusCall':'','isAlreadyLogged':_0x159af7['online']});});}})(_0x17dd7c,_0x3e0fb4,_0x593d3e);};exports[_0xcdd8('0x30')]=function(_0x107203,_0x489aae){if(!_0x107203['body'][_0xcdd8('0x1f')]){return handleError(_0x489aae,0x1f4,{'message':_0xcdd8('0x31')});}var _0x57b0b0=rs[_0xcdd8('0x32')]();_0x107203[_0xcdd8('0x33')][_0xcdd8('0x1f')]=_0x107203['body'][_0xcdd8('0x1f')]['trim']()['toLowerCase']();var _0x363612;return db[_0xcdd8('0x8')][_0xcdd8('0x9')]({'where':{'id':0x1},'attributes':[_0xcdd8('0xa'),_0xcdd8('0xb')],'raw':!![]})[_0xcdd8('0xc')](function(_0x700487){_0x363612=_0x700487;return db['User']['find']({'where':{'email':_0x107203['body'][_0xcdd8('0x1f')]}});})[_0xcdd8('0xc')](function(_0x4c01fc){if(!_0x4c01fc){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4c01fc[_0xcdd8('0x11')]){throw new Error(_0xcdd8('0x34'));}if(_0x4c01fc['blocked']){if(moment(_0x4c01fc[_0xcdd8('0x12')])[_0xcdd8('0x19')](_0x363612[_0xcdd8('0xb')],'minutes')>moment()){throw new Error(_0xcdd8('0x35'));}else{_0x4c01fc[_0xcdd8('0x18')]=![];_0x4c01fc[_0xcdd8('0x12')]=null;}}_0x4c01fc[_0xcdd8('0x36')]=_0x57b0b0;_0x4c01fc[_0xcdd8('0x37')]=Date['now']()+0x36ee80;return _0x4c01fc['save']();})[_0xcdd8('0xc')](function(){return sendServiceMail({'to':_0x107203[_0xcdd8('0x33')][_0xcdd8('0x1f')],'subject':_0xcdd8('0x38'),'text':_0xcdd8('0x39')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xcdd8('0x3a')+_0x107203[_0xcdd8('0x3b')][_0xcdd8('0x3c')]+'/reset/'+_0x57b0b0+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xcdd8('0xc')](function(){_0x489aae[_0xcdd8('0x3d')](0xc8)['send']({'message':_0xcdd8('0x3e')});})[_0xcdd8('0x1d')](function(_0x38f469){return handleError(_0x489aae,0x1f4,_0x38f469);});};exports[_0xcdd8('0x3f')]=function(_0x50f1a0,_0x22d7f0){return db['User'][_0xcdd8('0x40')]({'where':{'resetPasswordToken':_0x50f1a0[_0xcdd8('0x41')][_0xcdd8('0x42')],'resetPasswordExpires':{'$gt':Date[_0xcdd8('0x43')]()}}})[_0xcdd8('0xc')](function(_0x462473){if(!_0x462473){throw new Error(_0xcdd8('0x44'));}return db[_0xcdd8('0x8')][_0xcdd8('0x9')]({'attributes':['id',_0xcdd8('0x45'),_0xcdd8('0x46'),_0xcdd8('0x47')]})[_0xcdd8('0xc')](function(_0x4f4e07){if(_0x4f4e07['securePassword'])authService['validatePasswordPattern'](_0x50f1a0['body']['password']);if(!_0x4f4e07[_0xcdd8('0x46')]||!_0x462473[_0xcdd8('0x48')])return _0x462473;authService[_0xcdd8('0x49')](_0x50f1a0[_0xcdd8('0x33')][_0xcdd8('0xe')],_0x462473[_0xcdd8('0x48')],_0x4f4e07[_0xcdd8('0x47')]);return _0x462473;})['then'](function(){_0x462473[_0xcdd8('0xe')]=_0x50f1a0[_0xcdd8('0x33')][_0xcdd8('0xe')];_0x462473['resetPasswordToken']=null;_0x462473[_0xcdd8('0x37')]=null;return _0x462473[_0xcdd8('0x4a')]();});})[_0xcdd8('0xc')](function(){_0x22d7f0[_0xcdd8('0x3d')](0xc8)[_0xcdd8('0x2b')]({'message':'Password\x20reset!'});})['catch'](function(_0x4a6f8f){return handleError(_0x22d7f0,0x1f4,_0x4a6f8f);});};passport[_0xcdd8('0x4b')]('local-login',new LocalStrategy({'usernameField':_0xcdd8('0xd'),'passwordField':_0xcdd8('0xe')},function(_0x4f7810,_0x2233de,_0x5c33e2){return localAuthenticate(db[_0xcdd8('0x4c')],_0x4f7810,_0x2233de,_0x5c33e2);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 61672c2..e583f0a 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 _0x2bf6=['exports','express','Router','post','/forgot','forgot','/reset/:token','reset'];(function(_0x4da736,_0x55e2b1){var _0x270d2e=function(_0x1f97bf){while(--_0x1f97bf){_0x4da736['push'](_0x4da736['shift']());}};_0x270d2e(++_0x55e2b1);}(_0x2bf6,0xd1));var _0x62bf=function(_0x49fc33,_0x471664){_0x49fc33=_0x49fc33-0x0;var _0x5cf941=_0x2bf6[_0x49fc33];return _0x5cf941;};'use strict';var express=require(_0x62bf('0x0'));var router=express[_0x62bf('0x1')]();var controller=require('./authLocal.controller');router[_0x62bf('0x2')]('/',controller['login']);router[_0x62bf('0x2')](_0x62bf('0x3'),controller[_0x62bf('0x4')]);router['post'](_0x62bf('0x5'),controller[_0x62bf('0x6')]);module[_0x62bf('0x7')]=router; \ No newline at end of file +var _0x2fed=['post','login','/forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x16065c,_0x4c193f){var _0x160c85=function(_0x389bc5){while(--_0x389bc5){_0x16065c['push'](_0x16065c['shift']());}};_0x160c85(++_0x4c193f);}(_0x2fed,0x7e));var _0xd2fe=function(_0x5bdc41,_0x4edf28){_0x5bdc41=_0x5bdc41-0x0;var _0x21b11e=_0x2fed[_0x5bdc41];return _0x21b11e;};'use strict';var express=require(_0xd2fe('0x0'));var router=express['Router']();var controller=require(_0xd2fe('0x1'));router[_0xd2fe('0x2')]('/',controller[_0xd2fe('0x3')]);router['post'](_0xd2fe('0x4'),controller['forgot']);router['post'](_0xd2fe('0x5'),controller[_0xd2fe('0x6')]);module[_0xd2fe('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 23e52cb..bbd2904 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 _0xea19=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x58ff8e,_0x39fe0d){var _0x701683=function(_0x163930){while(--_0x163930){_0x58ff8e['push'](_0x58ff8e['shift']());}};_0x701683(++_0x39fe0d);}(_0xea19,0x1ca));var _0x9ea1=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xea19[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0x9ea1('0x0'));module[_0x9ea1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9ea1('0x2')]},'description':{'type':Sequelize[_0x9ea1('0x2')]},'status':{'type':Sequelize[_0x9ea1('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9ea1('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf67f=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x12fbd3,_0x3912af){var _0x2a1f2e=function(_0x2790db){while(--_0x2790db){_0x12fbd3['push'](_0x12fbd3['shift']());}};_0x2a1f2e(++_0x3912af);}(_0xf67f,0x12a));var _0xff67=function(_0x591781,_0x8e0ed2){_0x591781=_0x591781-0x0;var _0x315bd9=_0xf67f[_0x591781];return _0x315bd9;};'use strict';var Sequelize=require(_0xff67('0x0'));module[_0xff67('0x1')]={'name':{'type':Sequelize[_0xff67('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xff67('0x2')]},'description':{'type':Sequelize[_0xff67('0x2')]},'status':{'type':Sequelize[_0xff67('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xff67('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 3edf3cb..e53603a 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 _0x168e=['fields','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','length','include','find','create','body','params','addConditions','ids','omit','getConditions','findOne','Condition','pick','hasOwnProperty','Action','addActions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','update','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x168e,0x1ea));var _0xe168=function(_0xfa0af,_0x21827e){_0xfa0af=_0xfa0af-0x0;var _0x3ee174=_0x168e[_0xfa0af];return _0x3ee174;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe168('0x0'));var rp=require(_0xe168('0x1'));var moment=require(_0xe168('0x2'));var BPromise=require(_0xe168('0x3'));var Mustache=require('mustache');var util=require(_0xe168('0x4'));var path=require(_0xe168('0x5'));var sox=require(_0xe168('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe168('0x7'));var _=require(_0xe168('0x8'));var squel=require(_0xe168('0x9'));var crypto=require(_0xe168('0xa'));var jsforce=require(_0xe168('0xb'));var deskjs=require(_0xe168('0xc'));var toCsv=require(_0xe168('0xd'));var querystring=require('querystring');var Papa=require(_0xe168('0xe'));var Redis=require(_0xe168('0xf'));var authService=require(_0xe168('0x10'));var qs=require(_0xe168('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe168('0x12'));var logger=require(_0xe168('0x13'))('api');var utils=require(_0xe168('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe168('0x15'))['db'];function respondWithStatusCode(_0x380416,_0x59858d){_0x59858d=_0x59858d||0xcc;return function(_0x4f3268){if(_0x4f3268){return _0x380416['sendStatus'](_0x59858d);}return _0x380416[_0xe168('0x16')](_0x59858d)[_0xe168('0x17')]();};}function respondWithResult(_0x21b11a,_0x2c7ced){_0x2c7ced=_0x2c7ced||0xc8;return function(_0x3d3e9c){if(_0x3d3e9c){return _0x21b11a['status'](_0x2c7ced)['json'](_0x3d3e9c);}};}function respondWithFilteredResult(_0x39adae,_0x480dff){return function(_0xdcd480){if(_0xdcd480){var _0x9088de=typeof _0x480dff[_0xe168('0x18')]===_0xe168('0x19')&&typeof _0x480dff[_0xe168('0x1a')]===_0xe168('0x19');var _0xf637d9=_0xdcd480['count'];var _0x226826=_0x9088de?0x0:_0x480dff[_0xe168('0x18')];var _0x11d64d=_0x9088de?_0xdcd480['count']:_0x480dff['offset']+_0x480dff[_0xe168('0x1a')];var _0x43624b;if(_0x11d64d>=_0xf637d9){_0x11d64d=_0xf637d9;_0x43624b=0xc8;}else{_0x43624b=0xce;}_0x39adae[_0xe168('0x16')](_0x43624b);return _0x39adae[_0xe168('0x1b')](_0xe168('0x1c'),_0x226826+'-'+_0x11d64d+'/'+_0xf637d9)[_0xe168('0x1d')](_0xdcd480);}return null;};}function patchUpdates(_0x55cd9a){return function(_0x2853f2){try{jsonpatch[_0xe168('0x1e')](_0x2853f2,_0x55cd9a,!![]);}catch(_0x60ef2a){return BPromise['reject'](_0x60ef2a);}return _0x2853f2['save']();};}function saveUpdates(_0x451184,_0x13a9c6){return function(_0x737651){if(_0x737651){return _0x737651[_0xe168('0x1f')](_0x451184)['then'](function(_0x266926){return _0x266926;});}return null;};}function removeEntity(_0x237711,_0x448241){return function(_0x3d3212){if(_0x3d3212){return _0x3d3212['destroy']()[_0xe168('0x20')](function(){_0x237711[_0xe168('0x16')](0xcc)[_0xe168('0x17')]();});}};}function handleEntityNotFound(_0x1188e5,_0x6749b3){return function(_0x2bf254){if(!_0x2bf254){_0x1188e5['sendStatus'](0x194);}return _0x2bf254;};}function handleError(_0x77aa18,_0x16c971){_0x16c971=_0x16c971||0x1f4;return function(_0x55f58b){logger[_0xe168('0x21')](_0x55f58b[_0xe168('0x22')]);if(_0x55f58b['name']){delete _0x55f58b[_0xe168('0x23')];}_0x77aa18[_0xe168('0x16')](_0x16c971)[_0xe168('0x24')](_0x55f58b);};}exports[_0xe168('0x25')]=function(_0x303046,_0x3da944){var _0x208202={},_0x1bfb68={},_0x390bdd={'count':0x0,'rows':[]};var _0x8bce3f=_[_0xe168('0x26')](db[_0xe168('0x27')][_0xe168('0x28')],function(_0x1e50b5){return{'name':_0x1e50b5[_0xe168('0x29')],'type':_0x1e50b5[_0xe168('0x2a')]['key']};});_0x1bfb68[_0xe168('0x2b')]=_[_0xe168('0x26')](_0x8bce3f,_0xe168('0x23'));_0x1bfb68['query']=_[_0xe168('0x2c')](_0x303046['query']);_0x1bfb68[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0x1bfb68['model'],_0x1bfb68[_0xe168('0x2f')]);_0x208202[_0xe168('0x30')]=_['intersection'](_0x1bfb68[_0xe168('0x2b')],qs['fields'](_0x303046[_0xe168('0x2f')][_0xe168('0x31')]));_0x208202[_0xe168('0x30')]=_0x208202['attributes']['length']?_0x208202[_0xe168('0x30')]:_0x1bfb68['model'];if(!_0x303046[_0xe168('0x2f')]['hasOwnProperty'](_0xe168('0x32'))){_0x208202[_0xe168('0x1a')]=qs[_0xe168('0x1a')](_0x303046[_0xe168('0x2f')][_0xe168('0x1a')]);_0x208202[_0xe168('0x18')]=qs[_0xe168('0x18')](_0x303046[_0xe168('0x2f')][_0xe168('0x18')]);}_0x208202[_0xe168('0x33')]=qs[_0xe168('0x34')](_0x303046[_0xe168('0x2f')][_0xe168('0x34')]);_0x208202[_0xe168('0x35')]=qs[_0xe168('0x2d')](_['pick'](_0x303046['query'],_0x1bfb68[_0xe168('0x2d')]),_0x8bce3f);if(_0x303046[_0xe168('0x2f')][_0xe168('0x36')]){_0x208202[_0xe168('0x35')]=_[_0xe168('0x37')](_0x208202[_0xe168('0x35')],{'$or':_['map'](_0x8bce3f,function(_0x131250){if(_0x131250[_0xe168('0x2a')]!=='VIRTUAL'){var _0x51108f={};_0x51108f[_0x131250[_0xe168('0x23')]]={'$like':'%'+_0x303046[_0xe168('0x2f')][_0xe168('0x36')]+'%'};return _0x51108f;}})});}_0x208202=_['merge']({},_0x208202,_0x303046[_0xe168('0x38')]);var _0x53d1e5={'where':_0x208202[_0xe168('0x35')]};return db[_0xe168('0x27')]['count'](_0x53d1e5)[_0xe168('0x20')](function(_0x4364e5){_0x390bdd['count']=_0x4364e5;if(_0x303046[_0xe168('0x2f')][_0xe168('0x39')]){_0x208202['include']=[{'all':!![]}];}return db['Automation'][_0xe168('0x3a')](_0x208202);})[_0xe168('0x20')](function(_0x17fd43){_0x390bdd['rows']=_0x17fd43;return _0x390bdd;})[_0xe168('0x20')](respondWithFilteredResult(_0x3da944,_0x208202))[_0xe168('0x3b')](handleError(_0x3da944,null));};exports[_0xe168('0x3c')]=function(_0x58db54,_0xe279f2){var _0x34dfda={'raw':![],'where':{'id':_0x58db54['params']['id']}},_0x3bc349={};_0x3bc349[_0xe168('0x2b')]=_['keys'](db[_0xe168('0x27')][_0xe168('0x28')]);_0x3bc349[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x58db54[_0xe168('0x2f')]);_0x3bc349[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0x3bc349['model'],_0x3bc349[_0xe168('0x2f')]);_0x34dfda[_0xe168('0x30')]=_['intersection'](_0x3bc349['model'],qs['fields'](_0x58db54[_0xe168('0x2f')][_0xe168('0x31')]));_0x34dfda[_0xe168('0x30')]=_0x34dfda[_0xe168('0x30')][_0xe168('0x3d')]?_0x34dfda['attributes']:_0x3bc349[_0xe168('0x2b')];if(_0x58db54[_0xe168('0x2f')]['includeAll']){_0x34dfda[_0xe168('0x3e')]=[{'all':!![]}];}_0x34dfda=_[_0xe168('0x37')]({},_0x34dfda,_0x58db54['options']);return db[_0xe168('0x27')][_0xe168('0x3f')](_0x34dfda)[_0xe168('0x20')](handleEntityNotFound(_0xe279f2,null))['then'](respondWithResult(_0xe279f2,null))[_0xe168('0x3b')](handleError(_0xe279f2,null));};exports[_0xe168('0x40')]=function(_0x290dea,_0x495a47){return db[_0xe168('0x27')]['create'](_0x290dea[_0xe168('0x41')],{})[_0xe168('0x20')](respondWithResult(_0x495a47,0xc9))[_0xe168('0x3b')](handleError(_0x495a47,null));};exports[_0xe168('0x1f')]=function(_0x2a1c7d,_0x31c221){if(_0x2a1c7d['body']['id']){delete _0x2a1c7d['body']['id'];}return db[_0xe168('0x27')][_0xe168('0x3f')]({'where':{'id':_0x2a1c7d[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x31c221,null))['then'](saveUpdates(_0x2a1c7d['body'],null))[_0xe168('0x20')](respondWithResult(_0x31c221,null))[_0xe168('0x3b')](handleError(_0x31c221,null));};exports['destroy']=function(_0x37e691,_0x17d632){return db[_0xe168('0x27')]['find']({'where':{'id':_0x37e691[_0xe168('0x42')]['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x17d632,null))['then'](removeEntity(_0x17d632,null))[_0xe168('0x3b')](handleError(_0x17d632,null));};exports[_0xe168('0x43')]=function(_0x1076d0,_0x5ae2f1,_0x2ec083){return db['Condition'][_0xe168('0x3f')]({'where':{'id':_0x1076d0['params']['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x5ae2f1,null))[_0xe168('0x20')](function(_0x3bfb7e){if(_0x3bfb7e){return _0x3bfb7e['addConditions'](_0x1076d0[_0xe168('0x41')][_0xe168('0x44')],_[_0xe168('0x45')](_0x1076d0[_0xe168('0x41')],[_0xe168('0x44'),'id'])||{});}})['then'](respondWithResult(_0x5ae2f1,null))[_0xe168('0x3b')](handleError(_0x5ae2f1,null));};exports[_0xe168('0x46')]=function(_0x33ce7e,_0x40b930,_0x10a802){var _0x197262={};var _0xde48cb={};var _0x58f474;var _0x3b27e6;return db[_0xe168('0x27')][_0xe168('0x47')]({'where':{'id':_0x33ce7e[_0xe168('0x42')]['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x40b930,null))[_0xe168('0x20')](function(_0x5669f5){if(_0x5669f5){_0x58f474=_0x5669f5;_0xde48cb[_0xe168('0x2b')]=_[_0xe168('0x2c')](db[_0xe168('0x48')][_0xe168('0x28')]);_0xde48cb[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x33ce7e[_0xe168('0x2f')]);_0xde48cb[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0xde48cb[_0xe168('0x2b')],_0xde48cb[_0xe168('0x2f')]);_0x197262[_0xe168('0x30')]=_[_0xe168('0x2e')](_0xde48cb[_0xe168('0x2b')],qs[_0xe168('0x31')](_0x33ce7e['query'][_0xe168('0x31')]));_0x197262[_0xe168('0x30')]=_0x197262[_0xe168('0x30')][_0xe168('0x3d')]?_0x197262[_0xe168('0x30')]:_0xde48cb[_0xe168('0x2b')];_0x197262[_0xe168('0x33')]=qs[_0xe168('0x34')](_0x33ce7e[_0xe168('0x2f')][_0xe168('0x34')]);_0x197262[_0xe168('0x35')]=qs[_0xe168('0x2d')](_[_0xe168('0x49')](_0x33ce7e[_0xe168('0x2f')],_0xde48cb['filters']));if(_0x33ce7e['query']['filter']){_0x197262[_0xe168('0x35')]=_['merge'](_0x197262['where'],{'$or':_['map'](_0x197262[_0xe168('0x30')],function(_0x4a953a){var _0x1d10f1={};_0x1d10f1[_0x4a953a]={'$like':'%'+_0x33ce7e[_0xe168('0x2f')]['filter']+'%'};return _0x1d10f1;})});}_0x197262=_[_0xe168('0x37')]({},_0x197262,_0x33ce7e[_0xe168('0x38')]);return _0x58f474[_0xe168('0x46')](_0x197262);}})['then'](function(_0x3641ed){if(_0x3641ed){_0x3b27e6=_0x3641ed[_0xe168('0x3d')];if(!_0x33ce7e[_0xe168('0x2f')][_0xe168('0x4a')](_0xe168('0x32'))){_0x197262[_0xe168('0x1a')]=qs[_0xe168('0x1a')](_0x33ce7e['query']['limit']);_0x197262['offset']=qs[_0xe168('0x18')](_0x33ce7e[_0xe168('0x2f')][_0xe168('0x18')]);}return _0x58f474[_0xe168('0x46')](_0x197262);}})[_0xe168('0x20')](function(_0x2242a5){if(_0x2242a5){return _0x2242a5?{'count':_0x3b27e6,'rows':_0x2242a5}:null;}})['then'](respondWithResult(_0x40b930,null))[_0xe168('0x3b')](handleError(_0x40b930,null));};exports['addActions']=function(_0x3e172f,_0x42a844,_0x59e6ad){return db[_0xe168('0x4b')][_0xe168('0x3f')]({'where':{'id':_0x3e172f[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a844,null))['then'](function(_0x294858){if(_0x294858){return _0x294858[_0xe168('0x4c')](_0x3e172f[_0xe168('0x41')][_0xe168('0x44')],_[_0xe168('0x45')](_0x3e172f[_0xe168('0x41')],[_0xe168('0x44'),'id'])||{});}})[_0xe168('0x20')](respondWithResult(_0x42a844,null))[_0xe168('0x3b')](handleError(_0x42a844,null));};exports['getActions']=function(_0x2f02a6,_0x4e5725,_0x23681b){var _0x550742={};var _0xd5618d={};var _0x3bae02;var _0x39f637;return db[_0xe168('0x27')][_0xe168('0x47')]({'where':{'id':_0x2f02a6[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e5725,null))['then'](function(_0x38e457){if(_0x38e457){_0x3bae02=_0x38e457;_0xd5618d['model']=_[_0xe168('0x2c')](db[_0xe168('0x4b')][_0xe168('0x28')]);_0xd5618d[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x2f02a6[_0xe168('0x2f')]);_0xd5618d[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0xd5618d['model'],_0xd5618d[_0xe168('0x2f')]);_0x550742['attributes']=_[_0xe168('0x2e')](_0xd5618d[_0xe168('0x2b')],qs[_0xe168('0x31')](_0x2f02a6[_0xe168('0x2f')][_0xe168('0x31')]));_0x550742[_0xe168('0x30')]=_0x550742[_0xe168('0x30')][_0xe168('0x3d')]?_0x550742['attributes']:_0xd5618d[_0xe168('0x2b')];_0x550742[_0xe168('0x33')]=qs['sort'](_0x2f02a6['query']['sort']);_0x550742[_0xe168('0x35')]=qs[_0xe168('0x2d')](_[_0xe168('0x49')](_0x2f02a6[_0xe168('0x2f')],_0xd5618d[_0xe168('0x2d')]));if(_0x2f02a6[_0xe168('0x2f')][_0xe168('0x36')]){_0x550742[_0xe168('0x35')]=_[_0xe168('0x37')](_0x550742[_0xe168('0x35')],{'$or':_[_0xe168('0x26')](_0x550742['attributes'],function(_0x147727){var _0x37ba73={};_0x37ba73[_0x147727]={'$like':'%'+_0x2f02a6[_0xe168('0x2f')][_0xe168('0x36')]+'%'};return _0x37ba73;})});}_0x550742=_['merge']({},_0x550742,_0x2f02a6[_0xe168('0x38')]);return _0x3bae02['getActions'](_0x550742);}})[_0xe168('0x20')](function(_0x125c17){if(_0x125c17){_0x39f637=_0x125c17['length'];if(!_0x2f02a6[_0xe168('0x2f')][_0xe168('0x4a')]('nolimit')){_0x550742['limit']=qs[_0xe168('0x1a')](_0x2f02a6[_0xe168('0x2f')][_0xe168('0x1a')]);_0x550742[_0xe168('0x18')]=qs[_0xe168('0x18')](_0x2f02a6[_0xe168('0x2f')]['offset']);}return _0x3bae02['getActions'](_0x550742);}})[_0xe168('0x20')](function(_0x2e36a1){if(_0x2e36a1){return _0x2e36a1?{'count':_0x39f637,'rows':_0x2e36a1}:null;}})[_0xe168('0x20')](respondWithResult(_0x4e5725,null))[_0xe168('0x3b')](handleError(_0x4e5725,null));}; \ No newline at end of file +var _0xc0e6=['Automation','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','Condition','addConditions','ids','getConditions','pick','addActions','Action','omit','getActions','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x4d32e9,_0x390d44){var _0x2d9ece=function(_0xabbd89){while(--_0xabbd89){_0x4d32e9['push'](_0x4d32e9['shift']());}};_0x2d9ece(++_0x390d44);}(_0xc0e6,0x7e));var _0x6c0e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc0e6[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c0e('0x0'));var zipdir=require(_0x6c0e('0x1'));var jsonpatch=require(_0x6c0e('0x2'));var rp=require(_0x6c0e('0x3'));var moment=require(_0x6c0e('0x4'));var BPromise=require(_0x6c0e('0x5'));var Mustache=require(_0x6c0e('0x6'));var util=require('util');var path=require(_0x6c0e('0x7'));var sox=require(_0x6c0e('0x8'));var csv=require(_0x6c0e('0x9'));var ejs=require(_0x6c0e('0xa'));var fs=require('fs');var fs_extra=require(_0x6c0e('0xb'));var _=require(_0x6c0e('0xc'));var squel=require(_0x6c0e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6c0e('0xe'));var toCsv=require(_0x6c0e('0x9'));var querystring=require(_0x6c0e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c0e('0x10'));var qs=require(_0x6c0e('0x11'));var as=require(_0x6c0e('0x12'));var hardwareService=require(_0x6c0e('0x13'));var logger=require('../../config/logger')(_0x6c0e('0x14'));var utils=require('../../config/utils');var config=require(_0x6c0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e95ae,_0x5c79db){_0x5c79db=_0x5c79db||0xcc;return function(_0x1e8fb3){if(_0x1e8fb3){return _0x5e95ae[_0x6c0e('0x16')](_0x5c79db);}return _0x5e95ae['status'](_0x5c79db)[_0x6c0e('0x17')]();};}function respondWithResult(_0x1d5312,_0x4a9ad8){_0x4a9ad8=_0x4a9ad8||0xc8;return function(_0x3d5081){if(_0x3d5081){return _0x1d5312[_0x6c0e('0x18')](_0x4a9ad8)[_0x6c0e('0x19')](_0x3d5081);}};}function respondWithFilteredResult(_0x43bb26,_0x4567e2){return function(_0x2a740b){if(_0x2a740b){var _0x281621=typeof _0x4567e2[_0x6c0e('0x1a')]===_0x6c0e('0x1b')&&typeof _0x4567e2[_0x6c0e('0x1c')]===_0x6c0e('0x1b');var _0x972f3c=_0x2a740b['count'];var _0x28743b=_0x281621?0x0:_0x4567e2[_0x6c0e('0x1a')];var _0x32d8e7=_0x281621?_0x2a740b[_0x6c0e('0x1d')]:_0x4567e2[_0x6c0e('0x1a')]+_0x4567e2[_0x6c0e('0x1c')];var _0x277e2e;if(_0x32d8e7>=_0x972f3c){_0x32d8e7=_0x972f3c;_0x277e2e=0xc8;}else{_0x277e2e=0xce;}_0x43bb26[_0x6c0e('0x18')](_0x277e2e);return _0x43bb26[_0x6c0e('0x1e')](_0x6c0e('0x1f'),_0x28743b+'-'+_0x32d8e7+'/'+_0x972f3c)[_0x6c0e('0x19')](_0x2a740b);}return null;};}function patchUpdates(_0x23c307){return function(_0x389705){try{jsonpatch[_0x6c0e('0x20')](_0x389705,_0x23c307,!![]);}catch(_0x3ff3ba){return BPromise[_0x6c0e('0x21')](_0x3ff3ba);}return _0x389705[_0x6c0e('0x22')]();};}function saveUpdates(_0x4fb7b8,_0x5bbcf7){return function(_0x2f8e84){if(_0x2f8e84){return _0x2f8e84[_0x6c0e('0x23')](_0x4fb7b8)[_0x6c0e('0x24')](function(_0x7c6d0c){return _0x7c6d0c;});}return null;};}function removeEntity(_0x783771,_0x47e6f1){return function(_0x427951){if(_0x427951){return _0x427951[_0x6c0e('0x25')]()[_0x6c0e('0x24')](function(){_0x783771['status'](0xcc)[_0x6c0e('0x17')]();});}};}function handleEntityNotFound(_0x481284,_0x51ba92){return function(_0x1f502d){if(!_0x1f502d){_0x481284[_0x6c0e('0x16')](0x194);}return _0x1f502d;};}function handleError(_0x4c79ac,_0x2d718d){_0x2d718d=_0x2d718d||0x1f4;return function(_0x23c285){logger[_0x6c0e('0x26')](_0x23c285[_0x6c0e('0x27')]);if(_0x23c285[_0x6c0e('0x28')]){delete _0x23c285[_0x6c0e('0x28')];}_0x4c79ac[_0x6c0e('0x18')](_0x2d718d)[_0x6c0e('0x29')](_0x23c285);};}exports[_0x6c0e('0x2a')]=function(_0x37e7ae,_0x4bd1d7){var _0x9cbc32={},_0x18df2d={},_0x47810f={'count':0x0,'rows':[]};var _0x8b1eeb=_[_0x6c0e('0x2b')](db[_0x6c0e('0x2c')]['rawAttributes'],function(_0x5f43e0){return{'name':_0x5f43e0['fieldName'],'type':_0x5f43e0['type'][_0x6c0e('0x2d')]};});_0x18df2d[_0x6c0e('0x2e')]=_[_0x6c0e('0x2b')](_0x8b1eeb,_0x6c0e('0x28'));_0x18df2d[_0x6c0e('0x2f')]=_[_0x6c0e('0x30')](_0x37e7ae[_0x6c0e('0x2f')]);_0x18df2d['filters']=_[_0x6c0e('0x31')](_0x18df2d[_0x6c0e('0x2e')],_0x18df2d['query']);_0x9cbc32['attributes']=_[_0x6c0e('0x31')](_0x18df2d[_0x6c0e('0x2e')],qs[_0x6c0e('0x32')](_0x37e7ae[_0x6c0e('0x2f')][_0x6c0e('0x32')]));_0x9cbc32['attributes']=_0x9cbc32['attributes']['length']?_0x9cbc32[_0x6c0e('0x33')]:_0x18df2d[_0x6c0e('0x2e')];if(!_0x37e7ae['query'][_0x6c0e('0x34')](_0x6c0e('0x35'))){_0x9cbc32[_0x6c0e('0x1c')]=qs['limit'](_0x37e7ae[_0x6c0e('0x2f')]['limit']);_0x9cbc32['offset']=qs['offset'](_0x37e7ae['query'][_0x6c0e('0x1a')]);}_0x9cbc32['order']=qs[_0x6c0e('0x36')](_0x37e7ae['query'][_0x6c0e('0x36')]);_0x9cbc32[_0x6c0e('0x37')]=qs[_0x6c0e('0x38')](_['pick'](_0x37e7ae[_0x6c0e('0x2f')],_0x18df2d['filters']),_0x8b1eeb);if(_0x37e7ae[_0x6c0e('0x2f')][_0x6c0e('0x39')]){_0x9cbc32[_0x6c0e('0x37')]=_[_0x6c0e('0x3a')](_0x9cbc32[_0x6c0e('0x37')],{'$or':_['map'](_0x8b1eeb,function(_0x30177d){if(_0x30177d[_0x6c0e('0x3b')]!==_0x6c0e('0x3c')){var _0x3b5765={};_0x3b5765[_0x30177d[_0x6c0e('0x28')]]={'$like':'%'+_0x37e7ae['query'][_0x6c0e('0x39')]+'%'};return _0x3b5765;}})});}_0x9cbc32=_[_0x6c0e('0x3a')]({},_0x9cbc32,_0x37e7ae[_0x6c0e('0x3d')]);var _0x215b1a={'where':_0x9cbc32[_0x6c0e('0x37')]};return db[_0x6c0e('0x2c')]['count'](_0x215b1a)[_0x6c0e('0x24')](function(_0x5ab8b7){_0x47810f[_0x6c0e('0x1d')]=_0x5ab8b7;if(_0x37e7ae[_0x6c0e('0x2f')][_0x6c0e('0x3e')]){_0x9cbc32[_0x6c0e('0x3f')]=[{'all':!![]}];}return db['Automation'][_0x6c0e('0x40')](_0x9cbc32);})[_0x6c0e('0x24')](function(_0xa1e420){_0x47810f[_0x6c0e('0x41')]=_0xa1e420;return _0x47810f;})[_0x6c0e('0x24')](respondWithFilteredResult(_0x4bd1d7,_0x9cbc32))[_0x6c0e('0x42')](handleError(_0x4bd1d7,null));};exports[_0x6c0e('0x43')]=function(_0x19ebca,_0x264731){var _0x1811f2={'raw':![],'where':{'id':_0x19ebca[_0x6c0e('0x44')]['id']}},_0x5e4c14={};_0x5e4c14[_0x6c0e('0x2e')]=_[_0x6c0e('0x30')](db['Automation'][_0x6c0e('0x45')]);_0x5e4c14[_0x6c0e('0x2f')]=_['keys'](_0x19ebca[_0x6c0e('0x2f')]);_0x5e4c14[_0x6c0e('0x38')]=_[_0x6c0e('0x31')](_0x5e4c14[_0x6c0e('0x2e')],_0x5e4c14[_0x6c0e('0x2f')]);_0x1811f2[_0x6c0e('0x33')]=_['intersection'](_0x5e4c14['model'],qs[_0x6c0e('0x32')](_0x19ebca[_0x6c0e('0x2f')]['fields']));_0x1811f2['attributes']=_0x1811f2['attributes'][_0x6c0e('0x46')]?_0x1811f2[_0x6c0e('0x33')]:_0x5e4c14[_0x6c0e('0x2e')];if(_0x19ebca[_0x6c0e('0x2f')][_0x6c0e('0x3e')]){_0x1811f2[_0x6c0e('0x3f')]=[{'all':!![]}];}_0x1811f2=_[_0x6c0e('0x3a')]({},_0x1811f2,_0x19ebca['options']);return db[_0x6c0e('0x2c')][_0x6c0e('0x47')](_0x1811f2)[_0x6c0e('0x24')](handleEntityNotFound(_0x264731,null))[_0x6c0e('0x24')](respondWithResult(_0x264731,null))['catch'](handleError(_0x264731,null));};exports[_0x6c0e('0x48')]=function(_0x34c512,_0x51013f){return db[_0x6c0e('0x2c')]['create'](_0x34c512[_0x6c0e('0x49')],{})[_0x6c0e('0x24')](respondWithResult(_0x51013f,0xc9))[_0x6c0e('0x42')](handleError(_0x51013f,null));};exports[_0x6c0e('0x23')]=function(_0x19aa83,_0xd75110){if(_0x19aa83[_0x6c0e('0x49')]['id']){delete _0x19aa83[_0x6c0e('0x49')]['id'];}return db[_0x6c0e('0x2c')][_0x6c0e('0x47')]({'where':{'id':_0x19aa83['params']['id']}})[_0x6c0e('0x24')](handleEntityNotFound(_0xd75110,null))['then'](saveUpdates(_0x19aa83['body'],null))[_0x6c0e('0x24')](respondWithResult(_0xd75110,null))[_0x6c0e('0x42')](handleError(_0xd75110,null));};exports[_0x6c0e('0x25')]=function(_0xd49817,_0x4b9e95){return db['Automation'][_0x6c0e('0x47')]({'where':{'id':_0xd49817['params']['id']}})[_0x6c0e('0x24')](handleEntityNotFound(_0x4b9e95,null))[_0x6c0e('0x24')](removeEntity(_0x4b9e95,null))[_0x6c0e('0x42')](handleError(_0x4b9e95,null));};exports['addConditions']=function(_0x533716,_0x2f5ba2,_0x420e5e){return db[_0x6c0e('0x4a')][_0x6c0e('0x47')]({'where':{'id':_0x533716[_0x6c0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f5ba2,null))[_0x6c0e('0x24')](function(_0x47fd49){if(_0x47fd49){return _0x47fd49[_0x6c0e('0x4b')](_0x533716[_0x6c0e('0x49')][_0x6c0e('0x4c')],_['omit'](_0x533716['body'],['ids','id'])||{});}})[_0x6c0e('0x24')](respondWithResult(_0x2f5ba2,null))[_0x6c0e('0x42')](handleError(_0x2f5ba2,null));};exports[_0x6c0e('0x4d')]=function(_0x3adec7,_0x43c54b,_0x26b2bc){var _0x10322e={};var _0x18234e={};var _0x54a51b;var _0x2298ab;return db[_0x6c0e('0x2c')]['findOne']({'where':{'id':_0x3adec7[_0x6c0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x43c54b,null))[_0x6c0e('0x24')](function(_0x72fd59){if(_0x72fd59){_0x54a51b=_0x72fd59;_0x18234e['model']=_[_0x6c0e('0x30')](db[_0x6c0e('0x4a')][_0x6c0e('0x45')]);_0x18234e[_0x6c0e('0x2f')]=_[_0x6c0e('0x30')](_0x3adec7[_0x6c0e('0x2f')]);_0x18234e[_0x6c0e('0x38')]=_[_0x6c0e('0x31')](_0x18234e[_0x6c0e('0x2e')],_0x18234e['query']);_0x10322e['attributes']=_[_0x6c0e('0x31')](_0x18234e[_0x6c0e('0x2e')],qs[_0x6c0e('0x32')](_0x3adec7[_0x6c0e('0x2f')]['fields']));_0x10322e['attributes']=_0x10322e[_0x6c0e('0x33')][_0x6c0e('0x46')]?_0x10322e['attributes']:_0x18234e[_0x6c0e('0x2e')];_0x10322e['order']=qs[_0x6c0e('0x36')](_0x3adec7[_0x6c0e('0x2f')][_0x6c0e('0x36')]);_0x10322e['where']=qs[_0x6c0e('0x38')](_[_0x6c0e('0x4e')](_0x3adec7[_0x6c0e('0x2f')],_0x18234e['filters']));if(_0x3adec7[_0x6c0e('0x2f')][_0x6c0e('0x39')]){_0x10322e[_0x6c0e('0x37')]=_['merge'](_0x10322e[_0x6c0e('0x37')],{'$or':_[_0x6c0e('0x2b')](_0x10322e[_0x6c0e('0x33')],function(_0x168c08){var _0xfdb304={};_0xfdb304[_0x168c08]={'$like':'%'+_0x3adec7[_0x6c0e('0x2f')][_0x6c0e('0x39')]+'%'};return _0xfdb304;})});}_0x10322e=_['merge']({},_0x10322e,_0x3adec7[_0x6c0e('0x3d')]);return _0x54a51b['getConditions'](_0x10322e);}})[_0x6c0e('0x24')](function(_0x15c8fe){if(_0x15c8fe){_0x2298ab=_0x15c8fe[_0x6c0e('0x46')];if(!_0x3adec7[_0x6c0e('0x2f')]['hasOwnProperty']('nolimit')){_0x10322e['limit']=qs[_0x6c0e('0x1c')](_0x3adec7[_0x6c0e('0x2f')][_0x6c0e('0x1c')]);_0x10322e[_0x6c0e('0x1a')]=qs['offset'](_0x3adec7[_0x6c0e('0x2f')][_0x6c0e('0x1a')]);}return _0x54a51b[_0x6c0e('0x4d')](_0x10322e);}})[_0x6c0e('0x24')](function(_0xbb3e27){if(_0xbb3e27){return _0xbb3e27?{'count':_0x2298ab,'rows':_0xbb3e27}:null;}})[_0x6c0e('0x24')](respondWithResult(_0x43c54b,null))[_0x6c0e('0x42')](handleError(_0x43c54b,null));};exports[_0x6c0e('0x4f')]=function(_0x20c0a6,_0x100b7d,_0x4df92a){return db[_0x6c0e('0x50')][_0x6c0e('0x47')]({'where':{'id':_0x20c0a6[_0x6c0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x100b7d,null))[_0x6c0e('0x24')](function(_0xea7683){if(_0xea7683){return _0xea7683[_0x6c0e('0x4f')](_0x20c0a6['body'][_0x6c0e('0x4c')],_[_0x6c0e('0x51')](_0x20c0a6[_0x6c0e('0x49')],['ids','id'])||{});}})[_0x6c0e('0x24')](respondWithResult(_0x100b7d,null))[_0x6c0e('0x42')](handleError(_0x100b7d,null));};exports[_0x6c0e('0x52')]=function(_0x509f19,_0xd608f8,_0x5ae1f6){var _0x339f5a={};var _0x3387c8={};var _0x54506b;var _0x1eb110;return db[_0x6c0e('0x2c')][_0x6c0e('0x53')]({'where':{'id':_0x509f19['params']['id']}})[_0x6c0e('0x24')](handleEntityNotFound(_0xd608f8,null))[_0x6c0e('0x24')](function(_0x3bd870){if(_0x3bd870){_0x54506b=_0x3bd870;_0x3387c8[_0x6c0e('0x2e')]=_[_0x6c0e('0x30')](db[_0x6c0e('0x50')][_0x6c0e('0x45')]);_0x3387c8[_0x6c0e('0x2f')]=_[_0x6c0e('0x30')](_0x509f19[_0x6c0e('0x2f')]);_0x3387c8[_0x6c0e('0x38')]=_[_0x6c0e('0x31')](_0x3387c8[_0x6c0e('0x2e')],_0x3387c8['query']);_0x339f5a[_0x6c0e('0x33')]=_[_0x6c0e('0x31')](_0x3387c8['model'],qs['fields'](_0x509f19[_0x6c0e('0x2f')][_0x6c0e('0x32')]));_0x339f5a['attributes']=_0x339f5a[_0x6c0e('0x33')][_0x6c0e('0x46')]?_0x339f5a['attributes']:_0x3387c8[_0x6c0e('0x2e')];_0x339f5a[_0x6c0e('0x54')]=qs[_0x6c0e('0x36')](_0x509f19[_0x6c0e('0x2f')][_0x6c0e('0x36')]);_0x339f5a[_0x6c0e('0x37')]=qs[_0x6c0e('0x38')](_[_0x6c0e('0x4e')](_0x509f19['query'],_0x3387c8[_0x6c0e('0x38')]));if(_0x509f19[_0x6c0e('0x2f')][_0x6c0e('0x39')]){_0x339f5a[_0x6c0e('0x37')]=_[_0x6c0e('0x3a')](_0x339f5a[_0x6c0e('0x37')],{'$or':_['map'](_0x339f5a[_0x6c0e('0x33')],function(_0x341a3d){var _0x44aa2e={};_0x44aa2e[_0x341a3d]={'$like':'%'+_0x509f19['query']['filter']+'%'};return _0x44aa2e;})});}_0x339f5a=_[_0x6c0e('0x3a')]({},_0x339f5a,_0x509f19[_0x6c0e('0x3d')]);return _0x54506b['getActions'](_0x339f5a);}})[_0x6c0e('0x24')](function(_0x1bbe65){if(_0x1bbe65){_0x1eb110=_0x1bbe65[_0x6c0e('0x46')];if(!_0x509f19[_0x6c0e('0x2f')][_0x6c0e('0x34')]('nolimit')){_0x339f5a[_0x6c0e('0x1c')]=qs[_0x6c0e('0x1c')](_0x509f19[_0x6c0e('0x2f')]['limit']);_0x339f5a['offset']=qs[_0x6c0e('0x1a')](_0x509f19[_0x6c0e('0x2f')][_0x6c0e('0x1a')]);}return _0x54506b[_0x6c0e('0x52')](_0x339f5a);}})[_0x6c0e('0x24')](function(_0x5975bb){if(_0x5975bb){return _0x5975bb?{'count':_0x1eb110,'rows':_0x5975bb}:null;}})[_0x6c0e('0x24')](respondWithResult(_0xd608f8,null))[_0x6c0e('0x42')](handleError(_0xd608f8,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b8a5a75..07e32bf 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 _0xd45a=['api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util'];(function(_0x114f51,_0x418f91){var _0x23ba4b=function(_0x1a59d1){while(--_0x1a59d1){_0x114f51['push'](_0x114f51['shift']());}};_0x23ba4b(++_0x418f91);}(_0xd45a,0xcf));var _0xad45=function(_0x2ba36b,_0x254206){_0x2ba36b=_0x2ba36b-0x0;var _0x163030=_0xd45a[_0x2ba36b];return _0x163030;};'use strict';var _=require(_0xad45('0x0'));var util=require(_0xad45('0x1'));var logger=require('../../config/logger')(_0xad45('0x2'));var moment=require(_0xad45('0x3'));var BPromise=require(_0xad45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad45('0x5'));var rimraf=require(_0xad45('0x6'));var config=require(_0xad45('0x7'));var attributes=require(_0xad45('0x8'));module['exports']=function(_0x428708,_0x61b526){return _0x428708[_0xad45('0x9')]('Automation',attributes,{'tableName':_0xad45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7b6=['path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','api','moment','bluebird'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xb7b6,0x89));var _0x6b7b=function(_0x2f4385,_0x1505d0){_0x2f4385=_0x2f4385-0x0;var _0x1f4fbe=_0xb7b6[_0x2f4385];return _0x1f4fbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6b7b('0x0'));var moment=require(_0x6b7b('0x1'));var BPromise=require(_0x6b7b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b7b('0x3'));var rimraf=require(_0x6b7b('0x4'));var config=require('../../config/environment');var attributes=require(_0x6b7b('0x5'));module[_0x6b7b('0x6')]=function(_0xb58fca,_0x5d9933){return _0xb58fca[_0x6b7b('0x7')](_0x6b7b('0x8'),attributes,{'tableName':_0x6b7b('0x9'),'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 44118ab..fa5f151 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 _0xd5fc=['info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x34697c,_0x20ab9d){var _0x9db760=function(_0x49889f){while(--_0x49889f){_0x34697c['push'](_0x34697c['shift']());}};_0x9db760(++_0x20ab9d);}(_0xd5fc,0xae));var _0xcd5f=function(_0x13c3c2,_0x229f57){_0x13c3c2=_0x13c3c2-0x0;var _0xeea492=_0xd5fc[_0x13c3c2];return _0xeea492;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});} \ No newline at end of file +var _0x2cc4=['client','http','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x273ace,_0x3b28bc){var _0x5a5548=function(_0x2d2aaf){while(--_0x2d2aaf){_0x273ace['push'](_0x273ace['shift']());}};_0x5a5548(++_0x3b28bc);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0x2cc4[_0x393500];return _0x120d3b;};'use strict';var _=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var moment=require(_0x42cc('0x2'));var BPromise=require(_0x42cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42cc('0x4'));var db=require(_0x42cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x42cc('0x6'));var jayson=require(_0x42cc('0x7'));var client=jayson[_0x42cc('0x8')][_0x42cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2348b1,_0x5f2d27,_0x1fac7b){return new BPromise(function(_0x3b686b,_0x3a64ba){return client['request'](_0x2348b1,_0x1fac7b)['then'](function(_0xef766b){logger[_0x42cc('0xa')](_0x42cc('0xb'),_0x5f2d27,_0x42cc('0xc'));logger[_0x42cc('0xd')](_0x42cc('0xe'),_0x5f2d27,_0x42cc('0xc'),JSON[_0x42cc('0xf')](_0xef766b));if(_0xef766b[_0x42cc('0x10')]){if(_0xef766b[_0x42cc('0x10')][_0x42cc('0x11')]===0x1f4){logger[_0x42cc('0x10')]('Automation,\x20%s,\x20%s',_0x5f2d27,_0xef766b['error']['message']);return _0x3a64ba(_0xef766b[_0x42cc('0x10')][_0x42cc('0x12')]);}logger[_0x42cc('0x10')]('Automation,\x20%s,\x20%s',_0x5f2d27,_0xef766b[_0x42cc('0x10')]['message']);return _0x3b686b(_0xef766b[_0x42cc('0x10')]['message']);}else{logger[_0x42cc('0xa')](_0x42cc('0xb'),_0x5f2d27,_0x42cc('0xc'));_0x3b686b(_0xef766b[_0x42cc('0x13')][_0x42cc('0x12')]);}})[_0x42cc('0x14')](function(_0x4245de){logger[_0x42cc('0x10')](_0x42cc('0xb'),_0x5f2d27,_0x4245de);_0x3a64ba(_0x4245de);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7f2472a..f3b8bc6 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 _0x4f5a=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','post','create','addActions','put','delete','exports'];(function(_0x190323,_0x4e67dd){var _0x1f0899=function(_0x72e018){while(--_0x72e018){_0x190323['push'](_0x190323['shift']());}};_0x1f0899(++_0x4e67dd);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x4a31c3,_0x442619){_0x4a31c3=_0x4a31c3-0x0;var _0x9047d7=_0x4f5a[_0x4a31c3];return _0x9047d7;};'use strict';var multer=require(_0xa4f5('0x0'));var util=require(_0xa4f5('0x1'));var path=require('path');var timeout=require(_0xa4f5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa4f5('0x3'));var config=require(_0xa4f5('0x4'));var controller=require('./automation.controller');router[_0xa4f5('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller[_0xa4f5('0x8')]);router[_0xa4f5('0x5')](_0xa4f5('0x9'),auth['isAuthenticated'](),controller[_0xa4f5('0xa')]);router['get']('/:id/actions',auth[_0xa4f5('0x7')](),controller['getActions']);router[_0xa4f5('0xb')]('/',auth[_0xa4f5('0x7')](),controller[_0xa4f5('0xc')]);router[_0xa4f5('0xb')](_0xa4f5('0x9'),auth['isAuthenticated'](),controller['addConditions']);router[_0xa4f5('0xb')]('/:id/actions',auth[_0xa4f5('0x7')](),controller[_0xa4f5('0xd')]);router[_0xa4f5('0xe')](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller['update']);router[_0xa4f5('0xf')](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller['destroy']);module[_0xa4f5('0x10')]=router; \ No newline at end of file +var _0x4350=['delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','index','isAuthenticated','/:id/conditions','getConditions','post','create','addConditions','addActions','/:id','update'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x4350,0x1d0));var _0x0435=function(_0x29cbfa,_0xa1afd6){_0x29cbfa=_0x29cbfa-0x0;var _0x231b3d=_0x4350[_0x29cbfa];return _0x231b3d;};'use strict';var multer=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var path=require('path');var timeout=require(_0x0435('0x2'));var express=require('express');var router=express[_0x0435('0x3')]();var fs_extra=require(_0x0435('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var controller=require(_0x0435('0x7'));router[_0x0435('0x8')]('/',auth['isAuthenticated'](),controller[_0x0435('0x9')]);router['get']('/:id',auth[_0x0435('0xa')](),controller['show']);router['get'](_0x0435('0xb'),auth['isAuthenticated'](),controller[_0x0435('0xc')]);router[_0x0435('0x8')]('/:id/actions',auth[_0x0435('0xa')](),controller['getActions']);router[_0x0435('0xd')]('/',auth[_0x0435('0xa')](),controller[_0x0435('0xe')]);router[_0x0435('0xd')](_0x0435('0xb'),auth[_0x0435('0xa')](),controller[_0x0435('0xf')]);router[_0x0435('0xd')]('/:id/actions',auth['isAuthenticated'](),controller[_0x0435('0x10')]);router['put'](_0x0435('0x11'),auth['isAuthenticated'](),controller[_0x0435('0x12')]);router[_0x0435('0x13')]('/:id',auth[_0x0435('0xa')](),controller[_0x0435('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3de1fa2..794b8fb 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 _0x575d=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x575d,0xc8));var _0xd575=function(_0x36a83e,_0x2dfaaa){_0x36a83e=_0x36a83e-0x0;var _0x2d6049=_0x575d[_0x36a83e];return _0x2d6049;};'use strict';var Sequelize=require(_0xd575('0x0'));module[_0xd575('0x1')]={'name':{'type':Sequelize[_0xd575('0x2')],'unique':_0xd575('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd575('0x4')](_0xd575('0x5')),'allowNull':![],'defaultValue':_0xd575('0x5')},'description':{'type':Sequelize[_0xd575('0x2')]},'active':{'type':Sequelize[_0xd575('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xd575('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd575('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd575('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'comment':_0xd575('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd575('0xf')},'dialTimezone':{'type':Sequelize[_0xd575('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd575('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xd575('0x4')]('always',_0xd575('0x11'),_0xd575('0x12')),'defaultValue':_0xd575('0x13')},'dialAMDActive':{'type':Sequelize[_0xd575('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd575('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd575('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd575('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd575('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd575('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xd575('0x9')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd575('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd575('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd575('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd575('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd575('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd575('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd575('0x4')](_0xd575('0x1c'),_0xd575('0x1d')),'defaultValue':_0xd575('0x1c')},'dialPrefix':{'type':Sequelize[_0xd575('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd575('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x26')}}; \ No newline at end of file +var _0x30ad=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#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)'];(function(_0x592f46,_0x268ae3){var _0x225678=function(_0x451593){while(--_0x451593){_0x592f46['push'](_0x592f46['shift']());}};_0x225678(++_0x268ae3);}(_0x30ad,0xaa));var _0xd30a=function(_0x2e7314,_0x434700){_0x2e7314=_0x2e7314-0x0;var _0x58a977=_0x30ad[_0x2e7314];return _0x58a977;};'use strict';var Sequelize=require(_0xd30a('0x0'));module[_0xd30a('0x1')]={'name':{'type':Sequelize[_0xd30a('0x2')],'unique':_0xd30a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd30a('0x4')](_0xd30a('0x5')),'allowNull':![],'defaultValue':_0xd30a('0x5')},'description':{'type':Sequelize[_0xd30a('0x2')]},'active':{'type':Sequelize[_0xd30a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xd30a('0x7')](0x4)[_0xd30a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd30a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd30a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd30a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd30a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd30a('0x7')](0x5)[_0xd30a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd30a('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'defaultValue':0x3,'comment':_0xd30a('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd30a('0xd')},'dialTimezone':{'type':Sequelize[_0xd30a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':_0xd30a('0xe')},'dialAMDActive':{'type':Sequelize[_0xd30a('0x6')],'defaultValue':0x0,'comment':_0xd30a('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0xd30a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd30a('0x10')},'dialAMDGreeting':{'type':Sequelize[_0xd30a('0x7')](0x9)[_0xd30a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd30a('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd30a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd30a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd30a('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0xd30a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd30a('0x13')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd30a('0x7')](0x9)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd30a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd30a('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd30a('0x7')](0x9)[_0xd30a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd30a('0x15')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd30a('0x4')](_0xd30a('0x16'),_0xd30a('0x17')),'defaultValue':_0xd30a('0x16')},'dialPrefix':{'type':Sequelize[_0xd30a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd30a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd30a('0x18')},'dialCutDigit':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd30a('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd30a('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd30a('0x7')](0x5)[_0xd30a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd30a('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd30a('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xd30a('0x7')](0x5)[_0xd30a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd30a('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd30a('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd30a('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)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd30a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd30a('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd30a('0x7')](0x3)[_0xd30a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd30a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd30a('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5d794f0..5509795 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 _0x5453=['Campaign','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','error','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','cm_contacts','deletedAt\x20IS\x20NULL','cmHopperId','OrderBy','h.id','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','index','map'];(function(_0x3da5ce,_0x2787ea){var _0x3d217a=function(_0x4f1c3d){while(--_0x4f1c3d){_0x3da5ce['push'](_0x3da5ce['shift']());}};_0x3d217a(++_0x2787ea);}(_0x5453,0x18b));var _0x3545=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5453[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x3545('0x0'));var rimraf=require(_0x3545('0x1'));var zipdir=require(_0x3545('0x2'));var jsonpatch=require(_0x3545('0x3'));var rp=require(_0x3545('0x4'));var moment=require(_0x3545('0x5'));var BPromise=require(_0x3545('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3545('0x7'));var sox=require(_0x3545('0x8'));var csv=require('to-csv');var ejs=require(_0x3545('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3545('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3545('0xb'));var deskjs=require(_0x3545('0xc'));var toCsv=require(_0x3545('0xd'));var querystring=require('querystring');var Papa=require(_0x3545('0xe'));var Redis=require(_0x3545('0xf'));var authService=require(_0x3545('0x10'));var qs=require(_0x3545('0x11'));var as=require(_0x3545('0x12'));var hardwareService=require(_0x3545('0x13'));var logger=require(_0x3545('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3545('0x15'));var licenseUtil=require(_0x3545('0x16'));var db=require(_0x3545('0x17'))['db'];function respondWithStatusCode(_0x3de48b,_0x54fcf4){_0x54fcf4=_0x54fcf4||0xcc;return function(_0x4b9316){if(_0x4b9316){return _0x3de48b['sendStatus'](_0x54fcf4);}return _0x3de48b[_0x3545('0x18')](_0x54fcf4)[_0x3545('0x19')]();};}function respondWithResult(_0x5ddba6,_0x427f72){_0x427f72=_0x427f72||0xc8;return function(_0x5b5474){if(_0x5b5474){return _0x5ddba6['status'](_0x427f72)[_0x3545('0x1a')](_0x5b5474);}};}function respondWithFilteredResult(_0x1a4a55,_0x569ebd){return function(_0x29921b){if(_0x29921b){var _0x1717f6=typeof _0x569ebd['offset']===_0x3545('0x1b')&&typeof _0x569ebd['limit']===_0x3545('0x1b');var _0x16e2f8=_0x29921b[_0x3545('0x1c')];var _0x2c008a=_0x1717f6?0x0:_0x569ebd['offset'];var _0x573970=_0x1717f6?_0x29921b[_0x3545('0x1c')]:_0x569ebd['offset']+_0x569ebd[_0x3545('0x1d')];var _0x21c623;if(_0x573970>=_0x16e2f8){_0x573970=_0x16e2f8;_0x21c623=0xc8;}else{_0x21c623=0xce;}_0x1a4a55[_0x3545('0x18')](_0x21c623);return _0x1a4a55[_0x3545('0x1e')](_0x3545('0x1f'),_0x2c008a+'-'+_0x573970+'/'+_0x16e2f8)[_0x3545('0x1a')](_0x29921b);}return null;};}function patchUpdates(_0x10037f){return function(_0x365bc3){try{jsonpatch[_0x3545('0x20')](_0x365bc3,_0x10037f,!![]);}catch(_0x329228){return BPromise[_0x3545('0x21')](_0x329228);}return _0x365bc3['save']();};}function saveUpdates(_0x57de12,_0x20800f){return function(_0x580791){if(_0x580791){return _0x580791[_0x3545('0x22')](_0x57de12)[_0x3545('0x23')](function(_0x5bd498){return _0x5bd498;});}return null;};}function removeEntity(_0x473c00,_0x528b30){return function(_0x5de099){if(_0x5de099){return _0x5de099[_0x3545('0x24')]()[_0x3545('0x23')](function(){var _0x5bb284=_0x5de099[_0x3545('0x25')]({'plain':!![]});var _0x21c4e5=_0x3545('0x26');return db[_0x3545('0x27')][_0x3545('0x24')]({'where':{'type':_0x21c4e5,'resourceId':_0x5bb284['id']}})[_0x3545('0x23')](function(){return _0x5de099;});})['then'](function(){_0x473c00[_0x3545('0x18')](0xcc)[_0x3545('0x19')]();});}};}function handleEntityNotFound(_0x1cc167,_0xeea892){return function(_0x864712){if(!_0x864712){_0x1cc167[_0x3545('0x28')](0x194);}return _0x864712;};}function handleError(_0x3535e6,_0x5360df){_0x5360df=_0x5360df||0x1f4;return function(_0x46450f){logger['error'](_0x46450f['stack']);if(_0x46450f['name']){delete _0x46450f['name'];}_0x3535e6[_0x3545('0x18')](_0x5360df)['send'](_0x46450f);};}exports[_0x3545('0x29')]=function(_0x900e88,_0x341ad3){var _0x2f6057={},_0x3d78a9={},_0x77931f={'count':0x0,'rows':[]};var _0x2fb95f=_[_0x3545('0x2a')](db[_0x3545('0x2b')][_0x3545('0x2c')],function(_0x1277a8){return{'name':_0x1277a8['fieldName'],'type':_0x1277a8['type'][_0x3545('0x2d')]};});_0x3d78a9[_0x3545('0x2e')]=_['map'](_0x2fb95f,_0x3545('0x2f'));_0x3d78a9[_0x3545('0x30')]=_[_0x3545('0x31')](_0x900e88[_0x3545('0x30')]);_0x3d78a9[_0x3545('0x32')]=_[_0x3545('0x33')](_0x3d78a9[_0x3545('0x2e')],_0x3d78a9[_0x3545('0x30')]);_0x2f6057[_0x3545('0x34')]=_[_0x3545('0x33')](_0x3d78a9['model'],qs[_0x3545('0x35')](_0x900e88[_0x3545('0x30')][_0x3545('0x35')]));_0x2f6057[_0x3545('0x34')]=_0x2f6057[_0x3545('0x34')][_0x3545('0x36')]?_0x2f6057['attributes']:_0x3d78a9['model'];if(!_0x900e88[_0x3545('0x30')][_0x3545('0x37')](_0x3545('0x38'))){_0x2f6057[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x900e88[_0x3545('0x30')]['limit']);_0x2f6057[_0x3545('0x39')]=qs['offset'](_0x900e88['query']['offset']);}_0x2f6057[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x900e88['query'][_0x3545('0x3b')]);_0x2f6057[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x900e88[_0x3545('0x30')],_0x3d78a9[_0x3545('0x32')]),_0x2fb95f);if(_0x900e88[_0x3545('0x30')][_0x3545('0x3e')]){_0x2f6057['where']=_[_0x3545('0x3f')](_0x2f6057[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x2fb95f,function(_0x2ec932){if(_0x2ec932[_0x3545('0x40')]!==_0x3545('0x41')){var _0x51a06a={};_0x51a06a[_0x2ec932['name']]={'$like':'%'+_0x900e88[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x51a06a;}})});}_0x2f6057=_[_0x3545('0x3f')]({},_0x2f6057,_0x900e88[_0x3545('0x42')]);var _0x2f13b8={'where':_0x2f6057['where']};return db[_0x3545('0x2b')][_0x3545('0x1c')](_0x2f13b8)[_0x3545('0x23')](function(_0x4d5469){_0x77931f[_0x3545('0x1c')]=_0x4d5469;if(_0x900e88[_0x3545('0x30')]['includeAll']){_0x2f6057[_0x3545('0x43')]=[{'all':!![]}];}return db[_0x3545('0x2b')][_0x3545('0x44')](_0x2f6057);})['then'](function(_0xee3a73){_0x77931f[_0x3545('0x45')]=_0xee3a73;return _0x77931f;})[_0x3545('0x23')](respondWithFilteredResult(_0x341ad3,_0x2f6057))[_0x3545('0x46')](handleError(_0x341ad3,null));};exports[_0x3545('0x47')]=function(_0x44af9d,_0x530854){var _0x505898={'raw':![],'where':{'id':_0x44af9d[_0x3545('0x48')]['id']}},_0x5c9303={};_0x5c9303[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x2b')]['rawAttributes']);_0x5c9303[_0x3545('0x30')]=_[_0x3545('0x31')](_0x44af9d[_0x3545('0x30')]);_0x5c9303[_0x3545('0x32')]=_[_0x3545('0x33')](_0x5c9303[_0x3545('0x2e')],_0x5c9303[_0x3545('0x30')]);_0x505898[_0x3545('0x34')]=_[_0x3545('0x33')](_0x5c9303['model'],qs['fields'](_0x44af9d[_0x3545('0x30')]['fields']));_0x505898[_0x3545('0x34')]=_0x505898[_0x3545('0x34')]['length']?_0x505898[_0x3545('0x34')]:_0x5c9303[_0x3545('0x2e')];if(_0x44af9d[_0x3545('0x30')][_0x3545('0x49')]){_0x505898['include']=[{'all':!![]}];}_0x505898=_['merge']({},_0x505898,_0x44af9d[_0x3545('0x42')]);return db[_0x3545('0x2b')]['find'](_0x505898)[_0x3545('0x23')](handleEntityNotFound(_0x530854,null))['then'](respondWithResult(_0x530854,null))[_0x3545('0x46')](handleError(_0x530854,null));};exports[_0x3545('0x4a')]=function(_0x5f4e9c,_0x3350a9){return db['Campaign'][_0x3545('0x4a')](_0x5f4e9c[_0x3545('0x4b')],{})[_0x3545('0x23')](function(_0x181301){var _0x24ee85=_0x5f4e9c[_0x3545('0x4c')][_0x3545('0x25')]({'plain':!![]});if(!_0x24ee85)throw new Error(_0x3545('0x4d'));if(_0x24ee85[_0x3545('0x4e')]==='user'){var _0x1e16c1=_0x181301['get']({'plain':!![]});var _0x309c3b='IvrCampaigns';return db['UserProfileSection'][_0x3545('0x4f')]({'where':{'name':_0x309c3b,'userProfileId':_0x24ee85[_0x3545('0x50')]},'raw':!![]})[_0x3545('0x23')](function(_0x278b8e){if(_0x278b8e&&_0x278b8e[_0x3545('0x51')]===0x0){return db[_0x3545('0x27')][_0x3545('0x4a')]({'name':_0x1e16c1[_0x3545('0x2f')],'resourceId':_0x1e16c1['id'],'type':_0x278b8e[_0x3545('0x2f')],'sectionId':_0x278b8e['id']},{})[_0x3545('0x23')](function(){return _0x181301;});}else{return _0x181301;}})['catch'](function(_0x2e506b){logger['error'](_0x3545('0x52'),_0x2e506b);throw _0x2e506b;});}return _0x181301;})[_0x3545('0x23')](respondWithResult(_0x3350a9,0xc9))[_0x3545('0x46')](handleError(_0x3350a9,null));};exports[_0x3545('0x53')]=function(_0x3db67c,_0x5d3ed2){var _0x557a73={'where':{'id':_0x3db67c[_0x3545('0x48')]['id']}},_0x2416a8={};_0x2416a8[_0x3545('0x2e')]=_[_0x3545('0x31')](db['Campaign'][_0x3545('0x2c')]);_0x557a73[_0x3545('0x34')]=_['intersection'](_0x2416a8[_0x3545('0x2e')],qs['fields'](_0x3db67c[_0x3545('0x30')]['fields']));_0x557a73['attributes']=_0x557a73[_0x3545('0x34')][_0x3545('0x36')]?_0x557a73[_0x3545('0x34')]:_0x2416a8[_0x3545('0x2e')];if(_0x3db67c[_0x3545('0x30')][_0x3545('0x49')]){_0x557a73[_0x3545('0x43')]=[{'all':!![]}];}_0x557a73=_[_0x3545('0x3f')]({},_0x557a73,_0x3db67c[_0x3545('0x42')]);return db[_0x3545('0x2b')][_0x3545('0x4f')](_0x557a73)[_0x3545('0x23')](handleEntityNotFound(_0x5d3ed2,null))[_0x3545('0x23')](function(_0x2a8a6d){if(_0x2a8a6d){var _0x424e89=_0x2a8a6d[_0x3545('0x25')]({'plain':!![]});_0x424e89=qs[_0x3545('0x54')](_0x424e89,['id','createdAt',_0x3545('0x55')]);_0x3db67c[_0x3545('0x4b')]=_[_0x3545('0x54')](_0x3db67c[_0x3545('0x4b')],['id',_0x3545('0x56'),_0x3545('0x55')]);return db[_0x3545('0x2b')][_0x3545('0x4a')](_[_0x3545('0x3f')](_0x424e89,_0x3db67c[_0x3545('0x4b')]),{'include':_0x3db67c[_0x3545('0x30')][_0x3545('0x49')]?[{'all':!![]}]:undefined})[_0x3545('0x23')](function(_0x373852){var _0x37a077=_0x3db67c[_0x3545('0x4c')][_0x3545('0x25')]({'plain':!![]});if(!_0x37a077)throw new Error(_0x3545('0x4d'));if(_0x37a077[_0x3545('0x4e')]===_0x3545('0x4c')){var _0x176ac3=_0x373852[_0x3545('0x25')]({'plain':!![]});var _0x1c0d67=_0x3545('0x26');return db[_0x3545('0x57')]['find']({'where':{'name':_0x1c0d67,'userProfileId':_0x37a077[_0x3545('0x50')]},'raw':!![]})[_0x3545('0x23')](function(_0x2ddf75){if(_0x2ddf75&&_0x2ddf75[_0x3545('0x51')]===0x0){return db[_0x3545('0x27')][_0x3545('0x4a')]({'name':_0x176ac3[_0x3545('0x2f')],'resourceId':_0x176ac3['id'],'type':_0x2ddf75['name'],'sectionId':_0x2ddf75['id']},{})[_0x3545('0x23')](function(){return _0x373852;});}else{return _0x373852;}})[_0x3545('0x46')](function(_0x4f40da){logger[_0x3545('0x58')](_0x3545('0x52'),_0x4f40da);throw _0x4f40da;});}return _0x373852;});}})[_0x3545('0x23')](respondWithResult(_0x5d3ed2,0xc9))['catch'](handleError(_0x5d3ed2,null));};exports['update']=function(_0x269419,_0x5d2bea){if(_0x269419[_0x3545('0x4b')]['id']){delete _0x269419[_0x3545('0x4b')]['id'];}return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x269419[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x5d2bea,null))[_0x3545('0x23')](saveUpdates(_0x269419[_0x3545('0x4b')],null))[_0x3545('0x23')](respondWithResult(_0x5d2bea,null))[_0x3545('0x46')](handleError(_0x5d2bea,null));};exports[_0x3545('0x24')]=function(_0x571416,_0x4d4e91){return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x571416[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d4e91,null))[_0x3545('0x23')](removeEntity(_0x4d4e91,null))['catch'](handleError(_0x4d4e91,null));};exports[_0x3545('0x59')]=function(_0x3c3bdf,_0x384638,_0x3ea02f){var _0x4028ab={'raw':!![],'where':{}};var _0x428eaa={};var _0x179991={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3c3bdf[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x384638,null))[_0x3545('0x23')](function(_0x255561){if(_0x255561){_0x428eaa[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x5a')][_0x3545('0x2c')]);_0x428eaa[_0x3545('0x30')]=_[_0x3545('0x31')](_0x3c3bdf['query']);_0x428eaa[_0x3545('0x32')]=_[_0x3545('0x33')](_0x428eaa[_0x3545('0x2e')],_0x428eaa[_0x3545('0x30')]);_0x4028ab[_0x3545('0x34')]=_['intersection'](_0x428eaa[_0x3545('0x2e')],qs['fields'](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x35')]));_0x4028ab['attributes']=_0x4028ab[_0x3545('0x34')][_0x3545('0x36')]?_0x4028ab[_0x3545('0x34')]:_0x428eaa[_0x3545('0x2e')];if(!_0x3c3bdf[_0x3545('0x30')][_0x3545('0x37')](_0x3545('0x38'))){_0x4028ab['limit']=qs['limit'](_0x3c3bdf['query'][_0x3545('0x1d')]);_0x4028ab['offset']=qs[_0x3545('0x39')](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x39')]);}_0x4028ab[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3b')]);_0x4028ab[_0x3545('0x3c')]=qs['filters'](_['pick'](_0x3c3bdf[_0x3545('0x30')],_0x428eaa[_0x3545('0x32')]));_0x4028ab[_0x3545('0x3c')][_0x3545('0x5b')]=_0x255561['id'];if(_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3e')]){_0x4028ab[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x4028ab[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x4028ab['attributes'],function(_0x2b4bed){var _0x5f25b6={};_0x5f25b6[_0x2b4bed]={'$like':'%'+_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x5f25b6;})});}_0x4028ab=_[_0x3545('0x3f')]({},_0x4028ab,_0x3c3bdf[_0x3545('0x42')]);return db['CmHopper'][_0x3545('0x1c')]({'where':_0x4028ab[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x1a5198){_0x179991[_0x3545('0x1c')]=_0x1a5198;if(_0x3c3bdf[_0x3545('0x30')][_0x3545('0x49')]){_0x4028ab['include']=[{'all':!![]}];}return db[_0x3545('0x5a')]['findAll'](_0x4028ab);})[_0x3545('0x23')](function(_0x15964a){_0x179991[_0x3545('0x45')]=_0x15964a;return _0x179991;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x384638,_0x4028ab))['catch'](handleError(_0x384638,null));};exports[_0x3545('0x5c')]=function(_0x4ef84b,_0x5f1f40,_0xaf94fd){var _0x3a5035={'raw':!![],'where':{}};var _0x1eade9={};var _0x431548={'count':0x0,'rows':[]};return db['Campaign'][_0x3545('0x5d')]({'where':{'id':_0x4ef84b['params']['id']}})['then'](handleEntityNotFound(_0x5f1f40,null))[_0x3545('0x23')](function(_0x427247){if(_0x427247){_0x1eade9[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x5e')][_0x3545('0x2c')]);_0x1eade9[_0x3545('0x30')]=_[_0x3545('0x31')](_0x4ef84b[_0x3545('0x30')]);_0x1eade9[_0x3545('0x32')]=_[_0x3545('0x33')](_0x1eade9['model'],_0x1eade9[_0x3545('0x30')]);_0x3a5035['attributes']=_[_0x3545('0x33')](_0x1eade9[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x35')]));_0x3a5035[_0x3545('0x34')]=_0x3a5035[_0x3545('0x34')][_0x3545('0x36')]?_0x3a5035['attributes']:_0x1eade9[_0x3545('0x2e')];if(!_0x4ef84b['query'][_0x3545('0x37')](_0x3545('0x38'))){_0x3a5035[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x4ef84b[_0x3545('0x30')]['limit']);_0x3a5035['offset']=qs[_0x3545('0x39')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x39')]);}_0x3a5035[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x3b')]);_0x3a5035['where']=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x4ef84b['query'],_0x1eade9['filters']));_0x3a5035[_0x3545('0x3c')][_0x3545('0x5b')]=_0x427247['id'];if(_0x4ef84b[_0x3545('0x30')][_0x3545('0x3e')]){_0x3a5035['where']=_['merge'](_0x3a5035[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x3a5035['attributes'],function(_0x13d47d){var _0x5e7c85={};_0x5e7c85[_0x13d47d]={'$like':'%'+_0x4ef84b['query'][_0x3545('0x3e')]+'%'};return _0x5e7c85;})});}_0x3a5035=_[_0x3545('0x3f')]({},_0x3a5035,_0x4ef84b[_0x3545('0x42')]);return db[_0x3545('0x5e')][_0x3545('0x1c')]({'where':_0x3a5035['where']})[_0x3545('0x23')](function(_0x469e0c){_0x431548[_0x3545('0x1c')]=_0x469e0c;if(_0x4ef84b['query'][_0x3545('0x49')]){_0x3a5035['include']=[{'all':!![]}];}return db[_0x3545('0x5e')][_0x3545('0x44')](_0x3a5035);})[_0x3545('0x23')](function(_0x5b0118){_0x431548[_0x3545('0x45')]=_0x5b0118;return _0x431548;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x5f1f40,_0x3a5035))[_0x3545('0x46')](handleError(_0x5f1f40,null));};exports[_0x3545('0x5f')]=function(_0x1b9928,_0x2e18e7,_0x42fb6f){var _0x5d4014={'raw':!![],'where':{}};var _0x2322dd={};var _0x291b8c={'count':0x0,'rows':[]};return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x1b9928[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x2e18e7,null))[_0x3545('0x23')](function(_0x218a28){if(_0x218a28){_0x2322dd[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x60')][_0x3545('0x2c')]);_0x2322dd['query']=_[_0x3545('0x31')](_0x1b9928[_0x3545('0x30')]);_0x2322dd[_0x3545('0x32')]=_[_0x3545('0x33')](_0x2322dd[_0x3545('0x2e')],_0x2322dd[_0x3545('0x30')]);_0x5d4014[_0x3545('0x34')]=_[_0x3545('0x33')](_0x2322dd[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x1b9928[_0x3545('0x30')][_0x3545('0x35')]));_0x5d4014['attributes']=_0x5d4014['attributes'][_0x3545('0x36')]?_0x5d4014[_0x3545('0x34')]:_0x2322dd[_0x3545('0x2e')];if(!_0x1b9928['query'][_0x3545('0x37')]('nolimit')){_0x5d4014[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x1b9928[_0x3545('0x30')][_0x3545('0x1d')]);_0x5d4014[_0x3545('0x39')]=qs['offset'](_0x1b9928[_0x3545('0x30')][_0x3545('0x39')]);}_0x5d4014[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x1b9928[_0x3545('0x30')][_0x3545('0x3b')]);_0x5d4014[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x1b9928['query'],_0x2322dd[_0x3545('0x32')]));_0x5d4014['where'][_0x3545('0x5b')]=_0x218a28['id'];if(_0x1b9928[_0x3545('0x30')][_0x3545('0x3e')]){_0x5d4014[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x5d4014[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x5d4014[_0x3545('0x34')],function(_0x48aa79){var _0x219cb5={};_0x219cb5[_0x48aa79]={'$like':'%'+_0x1b9928['query'][_0x3545('0x3e')]+'%'};return _0x219cb5;})});}_0x5d4014=_['merge']({},_0x5d4014,_0x1b9928['options']);return db[_0x3545('0x60')]['count']({'where':_0x5d4014[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x18b862){_0x291b8c['count']=_0x18b862;if(_0x1b9928[_0x3545('0x30')][_0x3545('0x49')]){_0x5d4014[_0x3545('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3545('0x44')](_0x5d4014);})[_0x3545('0x23')](function(_0x1c20cd){_0x291b8c[_0x3545('0x45')]=_0x1c20cd;return _0x291b8c;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x2e18e7,_0x5d4014))[_0x3545('0x46')](handleError(_0x2e18e7,null));};exports[_0x3545('0x61')]=function(_0x10e9f8,_0xc2bd4b,_0x5c949f){var _0xb8d80e={'raw':!![],'where':{}};var _0x23421c={};var _0x361769={'count':0x0,'rows':[]};return db['Campaign'][_0x3545('0x5d')]({'where':{'id':_0x10e9f8['params']['id']}})[_0x3545('0x23')](handleEntityNotFound(_0xc2bd4b,null))['then'](function(_0x120bb0){if(_0x120bb0){_0x23421c[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x62')][_0x3545('0x2c')]);_0x23421c[_0x3545('0x30')]=_[_0x3545('0x31')](_0x10e9f8['query']);_0x23421c[_0x3545('0x32')]=_[_0x3545('0x33')](_0x23421c[_0x3545('0x2e')],_0x23421c[_0x3545('0x30')]);_0xb8d80e[_0x3545('0x34')]=_[_0x3545('0x33')](_0x23421c[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x10e9f8[_0x3545('0x30')][_0x3545('0x35')]));_0xb8d80e[_0x3545('0x34')]=_0xb8d80e[_0x3545('0x34')][_0x3545('0x36')]?_0xb8d80e[_0x3545('0x34')]:_0x23421c[_0x3545('0x2e')];if(!_0x10e9f8['query'][_0x3545('0x37')](_0x3545('0x38'))){_0xb8d80e[_0x3545('0x1d')]=qs['limit'](_0x10e9f8['query'][_0x3545('0x1d')]);_0xb8d80e[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x10e9f8['query']['offset']);}_0xb8d80e['order']=qs[_0x3545('0x3b')](_0x10e9f8[_0x3545('0x30')][_0x3545('0x3b')]);_0xb8d80e['where']=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x10e9f8[_0x3545('0x30')],_0x23421c[_0x3545('0x32')]));_0xb8d80e['where'][_0x3545('0x5b')]=_0x120bb0['id'];if(_0x10e9f8['query']['filter']){_0xb8d80e[_0x3545('0x3c')]=_['merge'](_0xb8d80e[_0x3545('0x3c')],{'$or':_['map'](_0xb8d80e[_0x3545('0x34')],function(_0x5f3e9b){var _0x275c99={};_0x275c99[_0x5f3e9b]={'$like':'%'+_0x10e9f8[_0x3545('0x30')]['filter']+'%'};return _0x275c99;})});}_0xb8d80e=_[_0x3545('0x3f')]({},_0xb8d80e,_0x10e9f8[_0x3545('0x42')]);return db[_0x3545('0x62')]['count']({'where':_0xb8d80e[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x3a1af6){_0x361769[_0x3545('0x1c')]=_0x3a1af6;if(_0x10e9f8[_0x3545('0x30')][_0x3545('0x49')]){_0xb8d80e[_0x3545('0x43')]=[{'all':!![]}];}return db[_0x3545('0x62')]['findAll'](_0xb8d80e);})[_0x3545('0x23')](function(_0x13edbe){_0x361769['rows']=_0x13edbe;return _0x361769;});}})[_0x3545('0x23')](respondWithFilteredResult(_0xc2bd4b,_0xb8d80e))['catch'](handleError(_0xc2bd4b,null));};exports['getLists']=function(_0x2ee527,_0x46b1a6,_0x40b46c){var _0x13fe4b={};var _0x2ae752={};var _0x2f41bb;var _0x26d69f;return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x2ee527[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x46b1a6,null))[_0x3545('0x23')](function(_0x381834){if(_0x381834){_0x2f41bb=_0x381834;_0x2ae752[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x63')][_0x3545('0x2c')]);_0x2ae752[_0x3545('0x30')]=_[_0x3545('0x31')](_0x2ee527[_0x3545('0x30')]);_0x2ae752[_0x3545('0x32')]=_['intersection'](_0x2ae752[_0x3545('0x2e')],_0x2ae752[_0x3545('0x30')]);_0x13fe4b['attributes']=_[_0x3545('0x33')](_0x2ae752['model'],qs[_0x3545('0x35')](_0x2ee527[_0x3545('0x30')][_0x3545('0x35')]));_0x13fe4b[_0x3545('0x34')]=_0x13fe4b[_0x3545('0x34')]['length']?_0x13fe4b[_0x3545('0x34')]:_0x2ae752['model'];_0x13fe4b[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x2ee527[_0x3545('0x30')][_0x3545('0x3b')]);_0x13fe4b[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x2ee527[_0x3545('0x30')],_0x2ae752[_0x3545('0x32')]));if(_0x2ee527[_0x3545('0x30')][_0x3545('0x3e')]){_0x13fe4b[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x13fe4b['where'],{'$or':_[_0x3545('0x2a')](_0x13fe4b[_0x3545('0x34')],function(_0x5ca39b){var _0x5c4c97={};_0x5c4c97[_0x5ca39b]={'$like':'%'+_0x2ee527['query'][_0x3545('0x3e')]+'%'};return _0x5c4c97;})});}_0x13fe4b=_['merge']({},_0x13fe4b,_0x2ee527['options']);return _0x2f41bb[_0x3545('0x64')](_0x13fe4b);}})[_0x3545('0x23')](function(_0x39595b){if(_0x39595b){_0x26d69f=_0x39595b['length'];if(!_0x2ee527['query'][_0x3545('0x37')](_0x3545('0x38'))){_0x13fe4b[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x2ee527[_0x3545('0x30')]['limit']);_0x13fe4b[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x2ee527[_0x3545('0x30')]['offset']);}return _0x2f41bb[_0x3545('0x64')](_0x13fe4b);}})[_0x3545('0x23')](function(_0x1acb08){if(_0x1acb08){return _0x1acb08?{'count':_0x26d69f,'rows':_0x1acb08}:null;}})[_0x3545('0x23')](respondWithResult(_0x46b1a6,null))[_0x3545('0x46')](handleError(_0x46b1a6,null));};exports[_0x3545('0x65')]=function(_0x5de7be,_0x1598ee,_0x370f47){var _0x1b8e14,_0x9bc9c1;var _0x419263=[];var _0x301ecc=moment()['format'](_0x3545('0x66'));return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x5de7be[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x1598ee,null))[_0x3545('0x23')](function(_0x550279){if(_0x550279){_0x9bc9c1=_0x550279;return _0x550279['addLists'](_0x5de7be[_0x3545('0x4b')][_0x3545('0x67')],_[_0x3545('0x54')](_0x5de7be[_0x3545('0x4b')],[_0x3545('0x67'),'id'])||{});}return null;})[_0x3545('0x68')](function(_0x5cb465){var _0x593b61;var _0x250d85;_0x1b8e14=_0x5cb465||[];var _0x475d4e=[];if(_0x5cb465){for(var _0x575aeb=0x0;_0x575aeb<_0x5cb465[_0x3545('0x36')];_0x575aeb+=0x1){var _0x2cc35b=_0x5cb465[_0x575aeb]['get']({'plain':!![]});_0x9bc9c1[_0x3545('0x69')]=_0x5de7be[_0x3545('0x4b')][_0x3545('0x69')]?_0x5de7be[_0x3545('0x4b')][_0x3545('0x69')]:_0x9bc9c1['dialCheckDuplicateType'];switch(_0x9bc9c1[_0x3545('0x69')]){case _0x3545('0x6a'):_0x593b61=squel['insert']()[_0x3545('0x6b')](_0x3545('0x6c'))[_0x3545('0x6d')](['phone',_0x3545('0x6e'),_0x3545('0x6f'),_0x3545('0x70'),_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')]('phone',_0x3545('0x73'))[_0x3545('0x72')](_0x3545('0x74'),_0x3545('0x6e'))['field']('id',_0x3545('0x6f'))[_0x3545('0x72')](_0x2cc35b[_0x3545('0x75')][_0x3545('0x76')](),_0x3545('0x70'))[_0x3545('0x72')](_0x5de7be['params']['id'][_0x3545('0x76')](),_0x3545('0x5b'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x56'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')]('cm_contacts')[_0x3545('0x3c')]('deletedAt\x20IS\x20NULL')[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b['CmListId'][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x78'))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()['field'](_0x3545('0x7a'))['from'](_0x3545('0x7b'))[_0x3545('0x3c')]('CampaignId\x20=\x20?',_0x5de7be[_0x3545('0x48')]['id']['toString']()))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x7c'))[_0x3545('0x77')](_0x3545('0x6c'))[_0x3545('0x3c')](_0x3545('0x7d'),_0x5de7be['params']['id'][_0x3545('0x76')]())))[_0x3545('0x76')]();break;case _0x3545('0x7e'):_0x593b61=squel[_0x3545('0x7f')]()[_0x3545('0x6b')](_0x3545('0x6c'))['fromQuery']([_0x3545('0x73'),_0x3545('0x6e'),_0x3545('0x6f'),'ListId',_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x73'),'phone')['field'](_0x3545('0x74'),_0x3545('0x6e'))[_0x3545('0x72')]('id',_0x3545('0x6f'))[_0x3545('0x72')](_0x2cc35b['CmListId'][_0x3545('0x76')](),_0x3545('0x70'))['field'](_0x5de7be[_0x3545('0x48')]['id']['toString'](),_0x3545('0x5b'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','createdAt')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b[_0x3545('0x75')][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x78'))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()[_0x3545('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0x3545('0x6c'))['where']('CampaignId\x20=\x20?',_0x5de7be['params']['id']['toString']())))['toString']();break;default:_0x593b61=squel['insert']()[_0x3545('0x6b')](_0x3545('0x6c'))[_0x3545('0x6d')](['phone',_0x3545('0x6e'),_0x3545('0x6f'),_0x3545('0x70'),'CampaignId',_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x73'),'phone')['field'](_0x3545('0x74'),'scheduledAt')[_0x3545('0x72')]('id','ContactId')[_0x3545('0x72')](_0x2cc35b['CmListId'][_0x3545('0x76')](),'ListId')[_0x3545('0x72')](_0x5de7be[_0x3545('0x48')]['id']['toString'](),'CampaignId')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','createdAt')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b[_0x3545('0x75')]['toString']())['where'](_0x3545('0x78')))['toString']();}_0x250d85=squel['insert']()[_0x3545('0x6b')]('cm_hopper_additional_phones')[_0x3545('0x6d')]([_0x3545('0x82'),_0x3545('0x6e'),_0x3545('0x73'),_0x3545('0x83'),'createdAt',_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x84'),'id')['field'](_0x3545('0x74'),_0x3545('0x6e'))[_0x3545('0x72')]('ci.item',_0x3545('0x73'))[_0x3545('0x72')]('ci.OrderBY',_0x3545('0x83'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x56'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','updatedAt')[_0x3545('0x77')]('cm_contact_has_items','ci')[_0x3545('0x85')](_0x3545('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x3545('0x86'),_0x2cc35b[_0x3545('0x75')]['toString']())[_0x3545('0x3c')](_0x3545('0x87'),_0x5de7be[_0x3545('0x48')]['id'][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x88'),_0x301ecc))[_0x3545('0x76')]();_0x475d4e['push'](db['sequelize'][_0x3545('0x30')](_0x593b61));_0x419263[_0x3545('0x89')](db[_0x3545('0x8a')][_0x3545('0x30')](_0x250d85));}return BPromise[_0x3545('0x8b')](_0x475d4e);}})[_0x3545('0x23')](function(){return BPromise[_0x3545('0x8b')](_0x419263);})['then'](function(){return _0x1b8e14;})[_0x3545('0x23')](respondWithResult(_0x1598ee,null))[_0x3545('0x46')](handleError(_0x1598ee,null));};exports[_0x3545('0x8c')]=function(_0x2edbe3,_0x681b1b,_0x38e85b){return db['Campaign'][_0x3545('0x4f')]({'where':{'id':_0x2edbe3[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x681b1b,null))[_0x3545('0x23')](function(_0x8f094c){if(_0x8f094c){return _0x8f094c[_0x3545('0x8c')](_0x2edbe3[_0x3545('0x30')][_0x3545('0x67')]);}})[_0x3545('0x23')](function(_0x14b63e){if(_0x14b63e){return db[_0x3545('0x5a')][_0x3545('0x24')]({'where':{'ListId':_0x2edbe3[_0x3545('0x30')][_0x3545('0x67')],'CampaignId':_0x2edbe3[_0x3545('0x48')]['id']}})[_0x3545('0x23')](function(){return _0x14b63e;});}})[_0x3545('0x23')](respondWithStatusCode(_0x681b1b,null))['catch'](handleError(_0x681b1b,null));};exports[_0x3545('0x8d')]=function(_0x5e8014,_0x2b18d4,_0x1d01ce){var _0x3e16ae={};var _0x4ab5dc={};var _0x3cc121;var _0x3124ff;return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x5e8014[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b18d4,null))[_0x3545('0x23')](function(_0x265413){if(_0x265413){_0x3cc121=_0x265413;_0x4ab5dc[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x63')][_0x3545('0x2c')]);_0x4ab5dc[_0x3545('0x30')]=_[_0x3545('0x31')](_0x5e8014[_0x3545('0x30')]);_0x4ab5dc[_0x3545('0x32')]=_['intersection'](_0x4ab5dc[_0x3545('0x2e')],_0x4ab5dc[_0x3545('0x30')]);_0x3e16ae[_0x3545('0x34')]=_['intersection'](_0x4ab5dc[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x5e8014[_0x3545('0x30')][_0x3545('0x35')]));_0x3e16ae['attributes']=_0x3e16ae[_0x3545('0x34')][_0x3545('0x36')]?_0x3e16ae[_0x3545('0x34')]:_0x4ab5dc[_0x3545('0x2e')];_0x3e16ae[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x5e8014[_0x3545('0x30')][_0x3545('0x3b')]);_0x3e16ae[_0x3545('0x3c')]=qs[_0x3545('0x32')](_['pick'](_0x5e8014[_0x3545('0x30')],_0x4ab5dc[_0x3545('0x32')]));if(_0x5e8014[_0x3545('0x30')][_0x3545('0x3e')]){_0x3e16ae[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x3e16ae['where'],{'$or':_['map'](_0x3e16ae[_0x3545('0x34')],function(_0x152e35){var _0x13eed7={};_0x13eed7[_0x152e35]={'$like':'%'+_0x5e8014[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x13eed7;})});}_0x3e16ae=_['merge']({},_0x3e16ae,_0x5e8014[_0x3545('0x42')]);return _0x3cc121[_0x3545('0x8d')](_0x3e16ae);}})[_0x3545('0x23')](function(_0x43410c){if(_0x43410c){_0x3124ff=_0x43410c[_0x3545('0x36')];if(!_0x5e8014[_0x3545('0x30')]['hasOwnProperty'](_0x3545('0x38'))){_0x3e16ae['limit']=qs[_0x3545('0x1d')](_0x5e8014['query'][_0x3545('0x1d')]);_0x3e16ae[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x5e8014['query'][_0x3545('0x39')]);}return _0x3cc121[_0x3545('0x8d')](_0x3e16ae);}})[_0x3545('0x23')](function(_0x408676){if(_0x408676){return _0x408676?{'count':_0x3124ff,'rows':_0x408676}:null;}})[_0x3545('0x23')](respondWithResult(_0x2b18d4,null))['catch'](handleError(_0x2b18d4,null));};exports[_0x3545('0x8e')]=function(_0x4c2ae2,_0x56dffe,_0x2c868c){var _0xf6d8d2,_0x1ce974;var _0x1b5b50=[];var _0x582d91=moment()[_0x3545('0x8f')](_0x3545('0x66'));return db['Campaign'][_0x3545('0x4f')]({'where':{'id':_0x4c2ae2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x56dffe,null))[_0x3545('0x23')](function(_0x7d1356){if(_0x7d1356){_0x1ce974=_0x7d1356;return _0x7d1356[_0x3545('0x8e')](_0x4c2ae2[_0x3545('0x4b')][_0x3545('0x67')],_['omit'](_0x4c2ae2[_0x3545('0x4b')],[_0x3545('0x67'),'id'])||{});}return null;})['spread'](function(_0x5948f0){var _0x6c8529;var _0x2f4aff;_0xf6d8d2=_0x5948f0||[];var _0x2e95e5=[];if(_0x5948f0){for(var _0x4167e1=0x0;_0x4167e1<_0x5948f0['length'];_0x4167e1+=0x1){var _0x870ef4=_0x5948f0[_0x4167e1][_0x3545('0x25')]({'plain':!![]});_0x6c8529=squel[_0x3545('0x7f')]()['into'](_0x3545('0x90'))['fromQuery']([_0x3545('0x73'),'ContactId',_0x3545('0x70'),_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel['select']()['field'](_0x3545('0x73'),_0x3545('0x73'))[_0x3545('0x72')]('id','ContactId')[_0x3545('0x72')](_0x870ef4[_0x3545('0x75')][_0x3545('0x76')](),'ListId')[_0x3545('0x72')](_0x4c2ae2[_0x3545('0x48')]['id']['toString'](),'CampaignId')[_0x3545('0x72')](_0x3545('0x74'),'createdAt')[_0x3545('0x72')]('NOW()',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x870ef4[_0x3545('0x75')]['toString']())[_0x3545('0x3c')](_0x3545('0x78')))['toString']();_0x2e95e5[_0x3545('0x89')](db[_0x3545('0x8a')][_0x3545('0x30')](_0x6c8529));}return BPromise[_0x3545('0x8b')](_0x2e95e5);}})['then'](function(){return _0xf6d8d2;})['then'](respondWithResult(_0x56dffe,null))['catch'](handleError(_0x56dffe,null));};exports[_0x3545('0x91')]=function(_0x86c0c2,_0x3ef7cb,_0x263dde){return db[_0x3545('0x2b')]['find']({'where':{'id':_0x86c0c2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x3ef7cb,null))['then'](function(_0x3a3c0a){if(_0x3a3c0a){return _0x3a3c0a[_0x3545('0x91')](_0x86c0c2[_0x3545('0x30')][_0x3545('0x67')]);}})[_0x3545('0x23')](function(_0x11cb6d){if(_0x11cb6d){return db[_0x3545('0x62')][_0x3545('0x24')]({'where':{'ListId':_0x86c0c2[_0x3545('0x30')][_0x3545('0x67')],'CampaignId':_0x86c0c2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](function(){return _0x11cb6d;});}})[_0x3545('0x23')](respondWithStatusCode(_0x3ef7cb,null))['catch'](handleError(_0x3ef7cb,null));}; \ No newline at end of file +var _0x83cd=['catch','show','params','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','getHoppers','findOne','pick','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','cm_contacts','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','Campaign','includeAll','include','rows'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0x83cd,0x17b));var _0xd83c=function(_0x472851,_0x333c1b){_0x472851=_0x472851-0x0;var _0x210868=_0x83cd[_0x472851];return _0x210868;};'use strict';var emlformat=require(_0xd83c('0x0'));var rimraf=require(_0xd83c('0x1'));var zipdir=require(_0xd83c('0x2'));var jsonpatch=require(_0xd83c('0x3'));var rp=require(_0xd83c('0x4'));var moment=require('moment');var BPromise=require(_0xd83c('0x5'));var Mustache=require(_0xd83c('0x6'));var util=require(_0xd83c('0x7'));var path=require(_0xd83c('0x8'));var sox=require('sox');var csv=require(_0xd83c('0x9'));var ejs=require(_0xd83c('0xa'));var fs=require('fs');var fs_extra=require(_0xd83c('0xb'));var _=require('lodash');var squel=require(_0xd83c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd83c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd83c('0x9'));var querystring=require('querystring');var Papa=require(_0xd83c('0xe'));var Redis=require(_0xd83c('0xf'));var authService=require(_0xd83c('0x10'));var qs=require(_0xd83c('0x11'));var as=require(_0xd83c('0x12'));var hardwareService=require(_0xd83c('0x13'));var logger=require(_0xd83c('0x14'))('api');var utils=require(_0xd83c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd83c('0x16'))['db'];function respondWithStatusCode(_0x19c134,_0xfece32){_0xfece32=_0xfece32||0xcc;return function(_0x51d8f4){if(_0x51d8f4){return _0x19c134[_0xd83c('0x17')](_0xfece32);}return _0x19c134[_0xd83c('0x18')](_0xfece32)[_0xd83c('0x19')]();};}function respondWithResult(_0x2a75af,_0x405078){_0x405078=_0x405078||0xc8;return function(_0x23099c){if(_0x23099c){return _0x2a75af[_0xd83c('0x18')](_0x405078)['json'](_0x23099c);}};}function respondWithFilteredResult(_0x1617a1,_0x54b716){return function(_0x1271d4){if(_0x1271d4){var _0x276b19=typeof _0x54b716[_0xd83c('0x1a')]===_0xd83c('0x1b')&&typeof _0x54b716['limit']===_0xd83c('0x1b');var _0x5eef2f=_0x1271d4['count'];var _0xbd63d9=_0x276b19?0x0:_0x54b716[_0xd83c('0x1a')];var _0x1bf410=_0x276b19?_0x1271d4[_0xd83c('0x1c')]:_0x54b716[_0xd83c('0x1a')]+_0x54b716[_0xd83c('0x1d')];var _0x2810b3;if(_0x1bf410>=_0x5eef2f){_0x1bf410=_0x5eef2f;_0x2810b3=0xc8;}else{_0x2810b3=0xce;}_0x1617a1[_0xd83c('0x18')](_0x2810b3);return _0x1617a1[_0xd83c('0x1e')](_0xd83c('0x1f'),_0xbd63d9+'-'+_0x1bf410+'/'+_0x5eef2f)[_0xd83c('0x20')](_0x1271d4);}return null;};}function patchUpdates(_0x30d96c){return function(_0x24452f){try{jsonpatch['apply'](_0x24452f,_0x30d96c,!![]);}catch(_0xd70446){return BPromise[_0xd83c('0x21')](_0xd70446);}return _0x24452f[_0xd83c('0x22')]();};}function saveUpdates(_0x10dbda,_0x3ee772){return function(_0x1b7d89){if(_0x1b7d89){return _0x1b7d89[_0xd83c('0x23')](_0x10dbda)[_0xd83c('0x24')](function(_0x6a21d1){return _0x6a21d1;});}return null;};}function removeEntity(_0x312f2c,_0x35142f){return function(_0xeafa7e){if(_0xeafa7e){return _0xeafa7e[_0xd83c('0x25')]()[_0xd83c('0x24')](function(){var _0x22569d=_0xeafa7e[_0xd83c('0x26')]({'plain':!![]});var _0x4cdda1=_0xd83c('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cdda1,'resourceId':_0x22569d['id']}})['then'](function(){return _0xeafa7e;});})[_0xd83c('0x24')](function(){_0x312f2c['status'](0xcc)[_0xd83c('0x19')]();});}};}function handleEntityNotFound(_0x339ff9,_0x539a6a){return function(_0x142e8f){if(!_0x142e8f){_0x339ff9[_0xd83c('0x17')](0x194);}return _0x142e8f;};}function handleError(_0xcc9268,_0x56c281){_0x56c281=_0x56c281||0x1f4;return function(_0x1e3f30){logger[_0xd83c('0x28')](_0x1e3f30[_0xd83c('0x29')]);if(_0x1e3f30['name']){delete _0x1e3f30[_0xd83c('0x2a')];}_0xcc9268[_0xd83c('0x18')](_0x56c281)[_0xd83c('0x2b')](_0x1e3f30);};}exports['index']=function(_0x3d6a54,_0x25493e){var _0x2130a6={},_0xe04b9a={},_0x35bdec={'count':0x0,'rows':[]};var _0x1fd8c1=_[_0xd83c('0x2c')](db['Campaign'][_0xd83c('0x2d')],function(_0xaec462){return{'name':_0xaec462[_0xd83c('0x2e')],'type':_0xaec462['type'][_0xd83c('0x2f')]};});_0xe04b9a['model']=_['map'](_0x1fd8c1,_0xd83c('0x2a'));_0xe04b9a[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x3d6a54[_0xd83c('0x30')]);_0xe04b9a[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0xe04b9a[_0xd83c('0x34')],_0xe04b9a[_0xd83c('0x30')]);_0x2130a6[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0xe04b9a[_0xd83c('0x34')],qs['fields'](_0x3d6a54['query']['fields']));_0x2130a6[_0xd83c('0x35')]=_0x2130a6['attributes'][_0xd83c('0x36')]?_0x2130a6[_0xd83c('0x35')]:_0xe04b9a['model'];if(!_0x3d6a54[_0xd83c('0x30')][_0xd83c('0x37')]('nolimit')){_0x2130a6['limit']=qs[_0xd83c('0x1d')](_0x3d6a54[_0xd83c('0x30')]['limit']);_0x2130a6['offset']=qs['offset'](_0x3d6a54[_0xd83c('0x30')][_0xd83c('0x1a')]);}_0x2130a6[_0xd83c('0x38')]=qs[_0xd83c('0x39')](_0x3d6a54[_0xd83c('0x30')][_0xd83c('0x39')]);_0x2130a6[_0xd83c('0x3a')]=qs['filters'](_['pick'](_0x3d6a54[_0xd83c('0x30')],_0xe04b9a[_0xd83c('0x32')]),_0x1fd8c1);if(_0x3d6a54['query']['filter']){_0x2130a6[_0xd83c('0x3a')]=_[_0xd83c('0x3b')](_0x2130a6[_0xd83c('0x3a')],{'$or':_[_0xd83c('0x2c')](_0x1fd8c1,function(_0x16ebff){if(_0x16ebff[_0xd83c('0x3c')]!==_0xd83c('0x3d')){var _0x114108={};_0x114108[_0x16ebff[_0xd83c('0x2a')]]={'$like':'%'+_0x3d6a54['query'][_0xd83c('0x3e')]+'%'};return _0x114108;}})});}_0x2130a6=_[_0xd83c('0x3b')]({},_0x2130a6,_0x3d6a54[_0xd83c('0x3f')]);var _0x5bf1cd={'where':_0x2130a6[_0xd83c('0x3a')]};return db[_0xd83c('0x40')]['count'](_0x5bf1cd)[_0xd83c('0x24')](function(_0x39d451){_0x35bdec[_0xd83c('0x1c')]=_0x39d451;if(_0x3d6a54['query'][_0xd83c('0x41')]){_0x2130a6[_0xd83c('0x42')]=[{'all':!![]}];}return db[_0xd83c('0x40')]['findAll'](_0x2130a6);})[_0xd83c('0x24')](function(_0x3edcdf){_0x35bdec[_0xd83c('0x43')]=_0x3edcdf;return _0x35bdec;})[_0xd83c('0x24')](respondWithFilteredResult(_0x25493e,_0x2130a6))[_0xd83c('0x44')](handleError(_0x25493e,null));};exports[_0xd83c('0x45')]=function(_0x11f8d1,_0x3eb29a){var _0x1d6f93={'raw':![],'where':{'id':_0x11f8d1[_0xd83c('0x46')]['id']}},_0x5ece5d={};_0x5ece5d[_0xd83c('0x34')]=_['keys'](db[_0xd83c('0x40')][_0xd83c('0x2d')]);_0x5ece5d[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x11f8d1['query']);_0x5ece5d[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0x5ece5d[_0xd83c('0x34')],_0x5ece5d[_0xd83c('0x30')]);_0x1d6f93[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0x5ece5d[_0xd83c('0x34')],qs['fields'](_0x11f8d1['query'][_0xd83c('0x47')]));_0x1d6f93[_0xd83c('0x35')]=_0x1d6f93[_0xd83c('0x35')][_0xd83c('0x36')]?_0x1d6f93[_0xd83c('0x35')]:_0x5ece5d[_0xd83c('0x34')];if(_0x11f8d1[_0xd83c('0x30')][_0xd83c('0x41')]){_0x1d6f93[_0xd83c('0x42')]=[{'all':!![]}];}_0x1d6f93=_['merge']({},_0x1d6f93,_0x11f8d1[_0xd83c('0x3f')]);return db[_0xd83c('0x40')][_0xd83c('0x48')](_0x1d6f93)[_0xd83c('0x24')](handleEntityNotFound(_0x3eb29a,null))[_0xd83c('0x24')](respondWithResult(_0x3eb29a,null))['catch'](handleError(_0x3eb29a,null));};exports[_0xd83c('0x49')]=function(_0x3f30e3,_0x18e2bc){return db[_0xd83c('0x40')]['create'](_0x3f30e3['body'],{})[_0xd83c('0x24')](function(_0x5c57a0){var _0xf6ee83=_0x3f30e3['user'][_0xd83c('0x26')]({'plain':!![]});if(!_0xf6ee83)throw new Error(_0xd83c('0x4a'));if(_0xf6ee83[_0xd83c('0x4b')]==='user'){var _0x13ff5a=_0x5c57a0[_0xd83c('0x26')]({'plain':!![]});var _0x58dfd8=_0xd83c('0x27');return db[_0xd83c('0x4c')]['find']({'where':{'name':_0x58dfd8,'userProfileId':_0xf6ee83[_0xd83c('0x4d')]},'raw':!![]})[_0xd83c('0x24')](function(_0x168a7b){if(_0x168a7b&&_0x168a7b['autoAssociation']===0x0){return db[_0xd83c('0x4e')][_0xd83c('0x49')]({'name':_0x13ff5a['name'],'resourceId':_0x13ff5a['id'],'type':_0x168a7b[_0xd83c('0x2a')],'sectionId':_0x168a7b['id']},{})['then'](function(){return _0x5c57a0;});}else{return _0x5c57a0;}})['catch'](function(_0x50cd59){logger[_0xd83c('0x28')](_0xd83c('0x4f'),_0x50cd59);throw _0x50cd59;});}return _0x5c57a0;})[_0xd83c('0x24')](respondWithResult(_0x18e2bc,0xc9))[_0xd83c('0x44')](handleError(_0x18e2bc,null));};exports[_0xd83c('0x50')]=function(_0x575e2b,_0x1749ed){var _0x29bf30={'where':{'id':_0x575e2b[_0xd83c('0x46')]['id']}},_0x34774b={};_0x34774b[_0xd83c('0x34')]=_[_0xd83c('0x31')](db[_0xd83c('0x40')][_0xd83c('0x2d')]);_0x29bf30['attributes']=_['intersection'](_0x34774b[_0xd83c('0x34')],qs['fields'](_0x575e2b[_0xd83c('0x30')][_0xd83c('0x47')]));_0x29bf30[_0xd83c('0x35')]=_0x29bf30[_0xd83c('0x35')][_0xd83c('0x36')]?_0x29bf30[_0xd83c('0x35')]:_0x34774b[_0xd83c('0x34')];if(_0x575e2b['query']['includeAll']){_0x29bf30[_0xd83c('0x42')]=[{'all':!![]}];}_0x29bf30=_['merge']({},_0x29bf30,_0x575e2b[_0xd83c('0x3f')]);return db[_0xd83c('0x40')]['find'](_0x29bf30)[_0xd83c('0x24')](handleEntityNotFound(_0x1749ed,null))[_0xd83c('0x24')](function(_0x1158c0){if(_0x1158c0){var _0x4ffc45=_0x1158c0[_0xd83c('0x26')]({'plain':!![]});_0x4ffc45=qs[_0xd83c('0x51')](_0x4ffc45,['id',_0xd83c('0x52'),_0xd83c('0x53')]);_0x575e2b[_0xd83c('0x54')]=_['omit'](_0x575e2b[_0xd83c('0x54')],['id',_0xd83c('0x52'),'updatedAt']);return db[_0xd83c('0x40')][_0xd83c('0x49')](_[_0xd83c('0x3b')](_0x4ffc45,_0x575e2b['body']),{'include':_0x575e2b[_0xd83c('0x30')][_0xd83c('0x41')]?[{'all':!![]}]:undefined})[_0xd83c('0x24')](function(_0x1ea75e){var _0x15f040=_0x575e2b[_0xd83c('0x55')][_0xd83c('0x26')]({'plain':!![]});if(!_0x15f040)throw new Error(_0xd83c('0x4a'));if(_0x15f040[_0xd83c('0x4b')]==='user'){var _0x2bde69=_0x1ea75e[_0xd83c('0x26')]({'plain':!![]});var _0xb9a03b='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0xb9a03b,'userProfileId':_0x15f040[_0xd83c('0x4d')]},'raw':!![]})[_0xd83c('0x24')](function(_0x58bd27){if(_0x58bd27&&_0x58bd27['autoAssociation']===0x0){return db['UserProfileResource'][_0xd83c('0x49')]({'name':_0x2bde69['name'],'resourceId':_0x2bde69['id'],'type':_0x58bd27[_0xd83c('0x2a')],'sectionId':_0x58bd27['id']},{})['then'](function(){return _0x1ea75e;});}else{return _0x1ea75e;}})['catch'](function(_0x1927de){logger[_0xd83c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1927de);throw _0x1927de;});}return _0x1ea75e;});}})[_0xd83c('0x24')](respondWithResult(_0x1749ed,0xc9))[_0xd83c('0x44')](handleError(_0x1749ed,null));};exports[_0xd83c('0x23')]=function(_0x848a01,_0x4c4c3e){if(_0x848a01[_0xd83c('0x54')]['id']){delete _0x848a01[_0xd83c('0x54')]['id'];}return db[_0xd83c('0x40')][_0xd83c('0x48')]({'where':{'id':_0x848a01['params']['id']}})['then'](handleEntityNotFound(_0x4c4c3e,null))[_0xd83c('0x24')](saveUpdates(_0x848a01['body'],null))[_0xd83c('0x24')](respondWithResult(_0x4c4c3e,null))[_0xd83c('0x44')](handleError(_0x4c4c3e,null));};exports[_0xd83c('0x25')]=function(_0x32776b,_0x310198){return db[_0xd83c('0x40')][_0xd83c('0x48')]({'where':{'id':_0x32776b[_0xd83c('0x46')]['id']}})['then'](handleEntityNotFound(_0x310198,null))[_0xd83c('0x24')](removeEntity(_0x310198,null))[_0xd83c('0x44')](handleError(_0x310198,null));};exports[_0xd83c('0x56')]=function(_0x2f1ca2,_0x3b2879,_0x49ed80){var _0x1a801e={'raw':!![],'where':{}};var _0x2621ee={};var _0x403c75={'count':0x0,'rows':[]};return db[_0xd83c('0x40')][_0xd83c('0x57')]({'where':{'id':_0x2f1ca2[_0xd83c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b2879,null))['then'](function(_0x4b58a2){if(_0x4b58a2){_0x2621ee[_0xd83c('0x34')]=_[_0xd83c('0x31')](db['CmHopper'][_0xd83c('0x2d')]);_0x2621ee[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x2f1ca2['query']);_0x2621ee[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0x2621ee[_0xd83c('0x34')],_0x2621ee[_0xd83c('0x30')]);_0x1a801e['attributes']=_[_0xd83c('0x33')](_0x2621ee[_0xd83c('0x34')],qs[_0xd83c('0x47')](_0x2f1ca2['query'][_0xd83c('0x47')]));_0x1a801e[_0xd83c('0x35')]=_0x1a801e[_0xd83c('0x35')][_0xd83c('0x36')]?_0x1a801e[_0xd83c('0x35')]:_0x2621ee[_0xd83c('0x34')];if(!_0x2f1ca2[_0xd83c('0x30')][_0xd83c('0x37')]('nolimit')){_0x1a801e[_0xd83c('0x1d')]=qs[_0xd83c('0x1d')](_0x2f1ca2[_0xd83c('0x30')]['limit']);_0x1a801e[_0xd83c('0x1a')]=qs['offset'](_0x2f1ca2[_0xd83c('0x30')][_0xd83c('0x1a')]);}_0x1a801e[_0xd83c('0x38')]=qs['sort'](_0x2f1ca2[_0xd83c('0x30')]['sort']);_0x1a801e['where']=qs[_0xd83c('0x32')](_[_0xd83c('0x58')](_0x2f1ca2[_0xd83c('0x30')],_0x2621ee[_0xd83c('0x32')]));_0x1a801e[_0xd83c('0x3a')][_0xd83c('0x59')]=_0x4b58a2['id'];if(_0x2f1ca2[_0xd83c('0x30')]['filter']){_0x1a801e[_0xd83c('0x3a')]=_['merge'](_0x1a801e['where'],{'$or':_[_0xd83c('0x2c')](_0x1a801e['attributes'],function(_0x35c561){var _0xe59564={};_0xe59564[_0x35c561]={'$like':'%'+_0x2f1ca2[_0xd83c('0x30')]['filter']+'%'};return _0xe59564;})});}_0x1a801e=_[_0xd83c('0x3b')]({},_0x1a801e,_0x2f1ca2[_0xd83c('0x3f')]);return db['CmHopper'][_0xd83c('0x1c')]({'where':_0x1a801e[_0xd83c('0x3a')]})[_0xd83c('0x24')](function(_0x22d5ea){_0x403c75[_0xd83c('0x1c')]=_0x22d5ea;if(_0x2f1ca2[_0xd83c('0x30')][_0xd83c('0x41')]){_0x1a801e[_0xd83c('0x42')]=[{'all':!![]}];}return db[_0xd83c('0x5a')][_0xd83c('0x5b')](_0x1a801e);})[_0xd83c('0x24')](function(_0x302bb9){_0x403c75[_0xd83c('0x43')]=_0x302bb9;return _0x403c75;});}})[_0xd83c('0x24')](respondWithFilteredResult(_0x3b2879,_0x1a801e))['catch'](handleError(_0x3b2879,null));};exports[_0xd83c('0x5c')]=function(_0x52c219,_0x621e37,_0x17c06c){var _0x2cde9e={'raw':!![],'where':{}};var _0x2f20a5={};var _0x479a11={'count':0x0,'rows':[]};return db[_0xd83c('0x40')]['findOne']({'where':{'id':_0x52c219['params']['id']}})['then'](handleEntityNotFound(_0x621e37,null))[_0xd83c('0x24')](function(_0x271d2d){if(_0x271d2d){_0x2f20a5[_0xd83c('0x34')]=_[_0xd83c('0x31')](db[_0xd83c('0x5d')][_0xd83c('0x2d')]);_0x2f20a5[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x52c219['query']);_0x2f20a5['filters']=_[_0xd83c('0x33')](_0x2f20a5['model'],_0x2f20a5['query']);_0x2cde9e[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0x2f20a5['model'],qs[_0xd83c('0x47')](_0x52c219[_0xd83c('0x30')][_0xd83c('0x47')]));_0x2cde9e['attributes']=_0x2cde9e[_0xd83c('0x35')]['length']?_0x2cde9e[_0xd83c('0x35')]:_0x2f20a5['model'];if(!_0x52c219[_0xd83c('0x30')][_0xd83c('0x37')](_0xd83c('0x5e'))){_0x2cde9e[_0xd83c('0x1d')]=qs[_0xd83c('0x1d')](_0x52c219[_0xd83c('0x30')][_0xd83c('0x1d')]);_0x2cde9e[_0xd83c('0x1a')]=qs[_0xd83c('0x1a')](_0x52c219[_0xd83c('0x30')][_0xd83c('0x1a')]);}_0x2cde9e['order']=qs['sort'](_0x52c219[_0xd83c('0x30')][_0xd83c('0x39')]);_0x2cde9e[_0xd83c('0x3a')]=qs[_0xd83c('0x32')](_[_0xd83c('0x58')](_0x52c219[_0xd83c('0x30')],_0x2f20a5[_0xd83c('0x32')]));_0x2cde9e[_0xd83c('0x3a')][_0xd83c('0x59')]=_0x271d2d['id'];if(_0x52c219[_0xd83c('0x30')]['filter']){_0x2cde9e[_0xd83c('0x3a')]=_['merge'](_0x2cde9e[_0xd83c('0x3a')],{'$or':_[_0xd83c('0x2c')](_0x2cde9e[_0xd83c('0x35')],function(_0x1f46df){var _0x2dd610={};_0x2dd610[_0x1f46df]={'$like':'%'+_0x52c219[_0xd83c('0x30')][_0xd83c('0x3e')]+'%'};return _0x2dd610;})});}_0x2cde9e=_[_0xd83c('0x3b')]({},_0x2cde9e,_0x52c219[_0xd83c('0x3f')]);return db['CmHopperHistory']['count']({'where':_0x2cde9e['where']})[_0xd83c('0x24')](function(_0x2d7993){_0x479a11[_0xd83c('0x1c')]=_0x2d7993;if(_0x52c219[_0xd83c('0x30')][_0xd83c('0x41')]){_0x2cde9e[_0xd83c('0x42')]=[{'all':!![]}];}return db[_0xd83c('0x5d')][_0xd83c('0x5b')](_0x2cde9e);})[_0xd83c('0x24')](function(_0x26c297){_0x479a11[_0xd83c('0x43')]=_0x26c297;return _0x479a11;});}})[_0xd83c('0x24')](respondWithFilteredResult(_0x621e37,_0x2cde9e))['catch'](handleError(_0x621e37,null));};exports[_0xd83c('0x5f')]=function(_0x72d4c6,_0x243aa8,_0x49b7f4){var _0x345131={'raw':!![],'where':{}};var _0x195241={};var _0x8b6359={'count':0x0,'rows':[]};return db[_0xd83c('0x40')]['findOne']({'where':{'id':_0x72d4c6['params']['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x243aa8,null))[_0xd83c('0x24')](function(_0x23f212){if(_0x23f212){_0x195241[_0xd83c('0x34')]=_[_0xd83c('0x31')](db[_0xd83c('0x60')][_0xd83c('0x2d')]);_0x195241['query']=_[_0xd83c('0x31')](_0x72d4c6[_0xd83c('0x30')]);_0x195241[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0x195241['model'],_0x195241[_0xd83c('0x30')]);_0x345131[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0x195241[_0xd83c('0x34')],qs[_0xd83c('0x47')](_0x72d4c6['query'][_0xd83c('0x47')]));_0x345131['attributes']=_0x345131[_0xd83c('0x35')]['length']?_0x345131[_0xd83c('0x35')]:_0x195241[_0xd83c('0x34')];if(!_0x72d4c6[_0xd83c('0x30')]['hasOwnProperty'](_0xd83c('0x5e'))){_0x345131[_0xd83c('0x1d')]=qs[_0xd83c('0x1d')](_0x72d4c6[_0xd83c('0x30')][_0xd83c('0x1d')]);_0x345131['offset']=qs[_0xd83c('0x1a')](_0x72d4c6[_0xd83c('0x30')][_0xd83c('0x1a')]);}_0x345131['order']=qs['sort'](_0x72d4c6[_0xd83c('0x30')]['sort']);_0x345131[_0xd83c('0x3a')]=qs['filters'](_['pick'](_0x72d4c6[_0xd83c('0x30')],_0x195241[_0xd83c('0x32')]));_0x345131[_0xd83c('0x3a')][_0xd83c('0x59')]=_0x23f212['id'];if(_0x72d4c6['query'][_0xd83c('0x3e')]){_0x345131[_0xd83c('0x3a')]=_[_0xd83c('0x3b')](_0x345131[_0xd83c('0x3a')],{'$or':_['map'](_0x345131[_0xd83c('0x35')],function(_0x230352){var _0x3f5129={};_0x3f5129[_0x230352]={'$like':'%'+_0x72d4c6[_0xd83c('0x30')]['filter']+'%'};return _0x3f5129;})});}_0x345131=_[_0xd83c('0x3b')]({},_0x345131,_0x72d4c6[_0xd83c('0x3f')]);return db[_0xd83c('0x60')][_0xd83c('0x1c')]({'where':_0x345131[_0xd83c('0x3a')]})[_0xd83c('0x24')](function(_0x676644){_0x8b6359[_0xd83c('0x1c')]=_0x676644;if(_0x72d4c6[_0xd83c('0x30')][_0xd83c('0x41')]){_0x345131[_0xd83c('0x42')]=[{'all':!![]}];}return db[_0xd83c('0x60')][_0xd83c('0x5b')](_0x345131);})[_0xd83c('0x24')](function(_0x2b2bc4){_0x8b6359['rows']=_0x2b2bc4;return _0x8b6359;});}})[_0xd83c('0x24')](respondWithFilteredResult(_0x243aa8,_0x345131))[_0xd83c('0x44')](handleError(_0x243aa8,null));};exports[_0xd83c('0x61')]=function(_0x40ea3f,_0x10ed21,_0x323560){var _0x13b4b1={'raw':!![],'where':{}};var _0xb688b5={};var _0x59c782={'count':0x0,'rows':[]};return db[_0xd83c('0x40')][_0xd83c('0x57')]({'where':{'id':_0x40ea3f[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x10ed21,null))[_0xd83c('0x24')](function(_0x23e7ff){if(_0x23e7ff){_0xb688b5[_0xd83c('0x34')]=_[_0xd83c('0x31')](db[_0xd83c('0x62')][_0xd83c('0x2d')]);_0xb688b5[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x40ea3f[_0xd83c('0x30')]);_0xb688b5[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0xb688b5['model'],_0xb688b5[_0xd83c('0x30')]);_0x13b4b1[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0xb688b5[_0xd83c('0x34')],qs[_0xd83c('0x47')](_0x40ea3f['query']['fields']));_0x13b4b1['attributes']=_0x13b4b1[_0xd83c('0x35')][_0xd83c('0x36')]?_0x13b4b1[_0xd83c('0x35')]:_0xb688b5[_0xd83c('0x34')];if(!_0x40ea3f[_0xd83c('0x30')][_0xd83c('0x37')]('nolimit')){_0x13b4b1[_0xd83c('0x1d')]=qs[_0xd83c('0x1d')](_0x40ea3f['query'][_0xd83c('0x1d')]);_0x13b4b1[_0xd83c('0x1a')]=qs['offset'](_0x40ea3f[_0xd83c('0x30')][_0xd83c('0x1a')]);}_0x13b4b1[_0xd83c('0x38')]=qs['sort'](_0x40ea3f[_0xd83c('0x30')][_0xd83c('0x39')]);_0x13b4b1[_0xd83c('0x3a')]=qs[_0xd83c('0x32')](_[_0xd83c('0x58')](_0x40ea3f[_0xd83c('0x30')],_0xb688b5['filters']));_0x13b4b1[_0xd83c('0x3a')][_0xd83c('0x59')]=_0x23e7ff['id'];if(_0x40ea3f[_0xd83c('0x30')][_0xd83c('0x3e')]){_0x13b4b1[_0xd83c('0x3a')]=_['merge'](_0x13b4b1[_0xd83c('0x3a')],{'$or':_[_0xd83c('0x2c')](_0x13b4b1[_0xd83c('0x35')],function(_0x4cc940){var _0x16d002={};_0x16d002[_0x4cc940]={'$like':'%'+_0x40ea3f[_0xd83c('0x30')][_0xd83c('0x3e')]+'%'};return _0x16d002;})});}_0x13b4b1=_[_0xd83c('0x3b')]({},_0x13b4b1,_0x40ea3f[_0xd83c('0x3f')]);return db[_0xd83c('0x62')][_0xd83c('0x1c')]({'where':_0x13b4b1[_0xd83c('0x3a')]})[_0xd83c('0x24')](function(_0x51e615){_0x59c782[_0xd83c('0x1c')]=_0x51e615;if(_0x40ea3f[_0xd83c('0x30')]['includeAll']){_0x13b4b1[_0xd83c('0x42')]=[{'all':!![]}];}return db[_0xd83c('0x62')][_0xd83c('0x5b')](_0x13b4b1);})[_0xd83c('0x24')](function(_0x58e463){_0x59c782['rows']=_0x58e463;return _0x59c782;});}})[_0xd83c('0x24')](respondWithFilteredResult(_0x10ed21,_0x13b4b1))['catch'](handleError(_0x10ed21,null));};exports['getLists']=function(_0xb035ce,_0x1223e8,_0x5d320e){var _0x27b4c9={};var _0x16f9a9={};var _0x15b77d;var _0x107666;return db[_0xd83c('0x40')]['findOne']({'where':{'id':_0xb035ce[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x1223e8,null))[_0xd83c('0x24')](function(_0x3a4586){if(_0x3a4586){_0x15b77d=_0x3a4586;_0x16f9a9[_0xd83c('0x34')]=_[_0xd83c('0x31')](db['CmList']['rawAttributes']);_0x16f9a9[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0xb035ce[_0xd83c('0x30')]);_0x16f9a9[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0x16f9a9[_0xd83c('0x34')],_0x16f9a9[_0xd83c('0x30')]);_0x27b4c9[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0x16f9a9[_0xd83c('0x34')],qs['fields'](_0xb035ce['query'][_0xd83c('0x47')]));_0x27b4c9[_0xd83c('0x35')]=_0x27b4c9[_0xd83c('0x35')]['length']?_0x27b4c9[_0xd83c('0x35')]:_0x16f9a9[_0xd83c('0x34')];_0x27b4c9[_0xd83c('0x38')]=qs[_0xd83c('0x39')](_0xb035ce[_0xd83c('0x30')][_0xd83c('0x39')]);_0x27b4c9[_0xd83c('0x3a')]=qs['filters'](_[_0xd83c('0x58')](_0xb035ce[_0xd83c('0x30')],_0x16f9a9['filters']));if(_0xb035ce[_0xd83c('0x30')][_0xd83c('0x3e')]){_0x27b4c9['where']=_['merge'](_0x27b4c9[_0xd83c('0x3a')],{'$or':_[_0xd83c('0x2c')](_0x27b4c9[_0xd83c('0x35')],function(_0x20d743){var _0x38c87f={};_0x38c87f[_0x20d743]={'$like':'%'+_0xb035ce['query'][_0xd83c('0x3e')]+'%'};return _0x38c87f;})});}_0x27b4c9=_[_0xd83c('0x3b')]({},_0x27b4c9,_0xb035ce[_0xd83c('0x3f')]);return _0x15b77d[_0xd83c('0x63')](_0x27b4c9);}})[_0xd83c('0x24')](function(_0x5ab89e){if(_0x5ab89e){_0x107666=_0x5ab89e[_0xd83c('0x36')];if(!_0xb035ce[_0xd83c('0x30')]['hasOwnProperty']('nolimit')){_0x27b4c9['limit']=qs[_0xd83c('0x1d')](_0xb035ce[_0xd83c('0x30')][_0xd83c('0x1d')]);_0x27b4c9[_0xd83c('0x1a')]=qs['offset'](_0xb035ce[_0xd83c('0x30')][_0xd83c('0x1a')]);}return _0x15b77d[_0xd83c('0x63')](_0x27b4c9);}})['then'](function(_0x493752){if(_0x493752){return _0x493752?{'count':_0x107666,'rows':_0x493752}:null;}})[_0xd83c('0x24')](respondWithResult(_0x1223e8,null))[_0xd83c('0x44')](handleError(_0x1223e8,null));};exports[_0xd83c('0x64')]=function(_0x2ba6a4,_0x29f284,_0x57d870){var _0x3e7398,_0x1bbe98;var _0x28420d=[];var _0x29e91=moment()[_0xd83c('0x65')](_0xd83c('0x66'));return db['Campaign'][_0xd83c('0x48')]({'where':{'id':_0x2ba6a4['params']['id']}})['then'](handleEntityNotFound(_0x29f284,null))['then'](function(_0x21ab47){if(_0x21ab47){_0x1bbe98=_0x21ab47;return _0x21ab47[_0xd83c('0x64')](_0x2ba6a4[_0xd83c('0x54')][_0xd83c('0x67')],_[_0xd83c('0x51')](_0x2ba6a4['body'],[_0xd83c('0x67'),'id'])||{});}return null;})[_0xd83c('0x68')](function(_0xf9d12e){var _0x41f53a;var _0x5b22c0;_0x3e7398=_0xf9d12e||[];var _0x2ea2b8=[];if(_0xf9d12e){for(var _0x3e3094=0x0;_0x3e3094<_0xf9d12e[_0xd83c('0x36')];_0x3e3094+=0x1){var _0x460c98=_0xf9d12e[_0x3e3094][_0xd83c('0x26')]({'plain':!![]});_0x1bbe98[_0xd83c('0x69')]=_0x2ba6a4['body']['dialCheckDuplicateType']?_0x2ba6a4[_0xd83c('0x54')][_0xd83c('0x69')]:_0x1bbe98[_0xd83c('0x69')];switch(_0x1bbe98[_0xd83c('0x69')]){case _0xd83c('0x6a'):_0x41f53a=squel[_0xd83c('0x6b')]()[_0xd83c('0x6c')]('cm_hopper')[_0xd83c('0x6d')](['phone',_0xd83c('0x6e'),_0xd83c('0x6f'),_0xd83c('0x70'),_0xd83c('0x59'),_0xd83c('0x52'),_0xd83c('0x53')],squel[_0xd83c('0x71')]()['field']('phone',_0xd83c('0x72'))[_0xd83c('0x73')](_0xd83c('0x74'),_0xd83c('0x6e'))[_0xd83c('0x73')]('id','ContactId')[_0xd83c('0x73')](_0x460c98[_0xd83c('0x75')]['toString'](),_0xd83c('0x70'))['field'](_0x2ba6a4[_0xd83c('0x46')]['id'][_0xd83c('0x76')](),_0xd83c('0x59'))[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27',_0xd83c('0x52'))[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27','updatedAt')['from'](_0xd83c('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0xd83c('0x3a')]('ListId\x20=\x20?',_0x460c98['CmListId'][_0xd83c('0x76')]())[_0xd83c('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xd83c('0x3a')](_0xd83c('0x78'),squel[_0xd83c('0x71')]()[_0xd83c('0x73')](_0xd83c('0x79'))[_0xd83c('0x7a')](_0xd83c('0x7b'))[_0xd83c('0x3a')](_0xd83c('0x7c'),_0x2ba6a4[_0xd83c('0x46')]['id'][_0xd83c('0x76')]()))[_0xd83c('0x3a')](_0xd83c('0x78'),squel[_0xd83c('0x71')]()[_0xd83c('0x73')](_0xd83c('0x7d'))[_0xd83c('0x7a')](_0xd83c('0x7e'))['where'](_0xd83c('0x7c'),_0x2ba6a4[_0xd83c('0x46')]['id'][_0xd83c('0x76')]())))['toString']();break;case'onlyIfOpen':_0x41f53a=squel['insert']()[_0xd83c('0x6c')](_0xd83c('0x7e'))[_0xd83c('0x6d')](['phone',_0xd83c('0x6e'),_0xd83c('0x6f'),'ListId','CampaignId',_0xd83c('0x52'),_0xd83c('0x53')],squel[_0xd83c('0x71')]()[_0xd83c('0x73')](_0xd83c('0x72'),_0xd83c('0x72'))[_0xd83c('0x73')]('NOW()','scheduledAt')[_0xd83c('0x73')]('id',_0xd83c('0x6f'))[_0xd83c('0x73')](_0x460c98[_0xd83c('0x75')][_0xd83c('0x76')](),_0xd83c('0x70'))[_0xd83c('0x73')](_0x2ba6a4[_0xd83c('0x46')]['id']['toString'](),_0xd83c('0x59'))[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27','createdAt')[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27','updatedAt')[_0xd83c('0x7a')]('cm_contacts')[_0xd83c('0x3a')](_0xd83c('0x7f'))['where'](_0xd83c('0x80'),_0x460c98['CmListId'][_0xd83c('0x76')]())[_0xd83c('0x3a')](_0xd83c('0x81'))[_0xd83c('0x3a')](_0xd83c('0x78'),squel[_0xd83c('0x71')]()[_0xd83c('0x73')](_0xd83c('0x7d'))[_0xd83c('0x7a')](_0xd83c('0x7e'))[_0xd83c('0x3a')]('CampaignId\x20=\x20?',_0x2ba6a4['params']['id'][_0xd83c('0x76')]())))[_0xd83c('0x76')]();break;default:_0x41f53a=squel[_0xd83c('0x6b')]()['into'](_0xd83c('0x7e'))[_0xd83c('0x6d')](['phone',_0xd83c('0x6e'),_0xd83c('0x6f'),_0xd83c('0x70'),_0xd83c('0x59'),_0xd83c('0x52'),'updatedAt'],squel[_0xd83c('0x71')]()['field']('phone','phone')[_0xd83c('0x73')](_0xd83c('0x74'),_0xd83c('0x6e'))[_0xd83c('0x73')]('id',_0xd83c('0x6f'))['field'](_0x460c98[_0xd83c('0x75')][_0xd83c('0x76')](),_0xd83c('0x70'))[_0xd83c('0x73')](_0x2ba6a4[_0xd83c('0x46')]['id'][_0xd83c('0x76')](),_0xd83c('0x59'))[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27',_0xd83c('0x52'))['field']('\x27'+_0x29e91+'\x27',_0xd83c('0x53'))[_0xd83c('0x7a')](_0xd83c('0x77'))[_0xd83c('0x3a')](_0xd83c('0x7f'))['where'](_0xd83c('0x80'),_0x460c98['CmListId'][_0xd83c('0x76')]())[_0xd83c('0x3a')](_0xd83c('0x81')))['toString']();}_0x5b22c0=squel[_0xd83c('0x6b')]()[_0xd83c('0x6c')](_0xd83c('0x82'))[_0xd83c('0x6d')]([_0xd83c('0x83'),_0xd83c('0x6e'),'phone',_0xd83c('0x84'),'createdAt',_0xd83c('0x53')],squel[_0xd83c('0x71')]()[_0xd83c('0x73')]('h.id','id')[_0xd83c('0x73')](_0xd83c('0x74'),'scheduledAt')[_0xd83c('0x73')](_0xd83c('0x85'),_0xd83c('0x72'))[_0xd83c('0x73')](_0xd83c('0x86'),'OrderBy')[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27',_0xd83c('0x52'))[_0xd83c('0x73')]('\x27'+_0x29e91+'\x27',_0xd83c('0x53'))[_0xd83c('0x7a')](_0xd83c('0x87'),'ci')['join'](_0xd83c('0x7e'),'h',_0xd83c('0x88'))[_0xd83c('0x3a')](_0xd83c('0x89'),_0x460c98[_0xd83c('0x75')]['toString']())[_0xd83c('0x3a')](_0xd83c('0x8a'),_0x2ba6a4[_0xd83c('0x46')]['id'][_0xd83c('0x76')]())[_0xd83c('0x3a')](_0xd83c('0x8b'),_0x29e91))[_0xd83c('0x76')]();_0x2ea2b8[_0xd83c('0x8c')](db[_0xd83c('0x8d')][_0xd83c('0x30')](_0x41f53a));_0x28420d[_0xd83c('0x8c')](db[_0xd83c('0x8d')][_0xd83c('0x30')](_0x5b22c0));}return BPromise['all'](_0x2ea2b8);}})['then'](function(){return BPromise[_0xd83c('0x8e')](_0x28420d);})['then'](function(){return _0x3e7398;})[_0xd83c('0x24')](respondWithResult(_0x29f284,null))['catch'](handleError(_0x29f284,null));};exports[_0xd83c('0x8f')]=function(_0xbcc447,_0x68e40f,_0x3435eb){return db[_0xd83c('0x40')][_0xd83c('0x48')]({'where':{'id':_0xbcc447['params']['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x68e40f,null))[_0xd83c('0x24')](function(_0x2e66a8){if(_0x2e66a8){return _0x2e66a8[_0xd83c('0x8f')](_0xbcc447[_0xd83c('0x30')][_0xd83c('0x67')]);}})['then'](function(_0x437077){if(_0x437077){return db[_0xd83c('0x5a')][_0xd83c('0x25')]({'where':{'ListId':_0xbcc447[_0xd83c('0x30')][_0xd83c('0x67')],'CampaignId':_0xbcc447[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](function(){return _0x437077;});}})[_0xd83c('0x24')](respondWithStatusCode(_0x68e40f,null))[_0xd83c('0x44')](handleError(_0x68e40f,null));};exports[_0xd83c('0x90')]=function(_0x315a70,_0x3481ec,_0x2f05e4){var _0x587ac8={};var _0x1d34e7={};var _0x3ed95b;var _0x25903e;return db[_0xd83c('0x40')][_0xd83c('0x57')]({'where':{'id':_0x315a70[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x3481ec,null))['then'](function(_0x14d069){if(_0x14d069){_0x3ed95b=_0x14d069;_0x1d34e7[_0xd83c('0x34')]=_[_0xd83c('0x31')](db[_0xd83c('0x91')][_0xd83c('0x2d')]);_0x1d34e7[_0xd83c('0x30')]=_[_0xd83c('0x31')](_0x315a70[_0xd83c('0x30')]);_0x1d34e7[_0xd83c('0x32')]=_[_0xd83c('0x33')](_0x1d34e7['model'],_0x1d34e7[_0xd83c('0x30')]);_0x587ac8[_0xd83c('0x35')]=_[_0xd83c('0x33')](_0x1d34e7[_0xd83c('0x34')],qs[_0xd83c('0x47')](_0x315a70[_0xd83c('0x30')]['fields']));_0x587ac8['attributes']=_0x587ac8[_0xd83c('0x35')]['length']?_0x587ac8[_0xd83c('0x35')]:_0x1d34e7[_0xd83c('0x34')];_0x587ac8[_0xd83c('0x38')]=qs['sort'](_0x315a70['query'][_0xd83c('0x39')]);_0x587ac8[_0xd83c('0x3a')]=qs[_0xd83c('0x32')](_[_0xd83c('0x58')](_0x315a70['query'],_0x1d34e7[_0xd83c('0x32')]));if(_0x315a70['query']['filter']){_0x587ac8['where']=_['merge'](_0x587ac8['where'],{'$or':_['map'](_0x587ac8['attributes'],function(_0x5ab251){var _0x1add72={};_0x1add72[_0x5ab251]={'$like':'%'+_0x315a70[_0xd83c('0x30')]['filter']+'%'};return _0x1add72;})});}_0x587ac8=_[_0xd83c('0x3b')]({},_0x587ac8,_0x315a70[_0xd83c('0x3f')]);return _0x3ed95b['getBlackLists'](_0x587ac8);}})[_0xd83c('0x24')](function(_0x38e6b2){if(_0x38e6b2){_0x25903e=_0x38e6b2[_0xd83c('0x36')];if(!_0x315a70['query'][_0xd83c('0x37')](_0xd83c('0x5e'))){_0x587ac8[_0xd83c('0x1d')]=qs[_0xd83c('0x1d')](_0x315a70['query']['limit']);_0x587ac8[_0xd83c('0x1a')]=qs[_0xd83c('0x1a')](_0x315a70['query']['offset']);}return _0x3ed95b[_0xd83c('0x90')](_0x587ac8);}})[_0xd83c('0x24')](function(_0x33c347){if(_0x33c347){return _0x33c347?{'count':_0x25903e,'rows':_0x33c347}:null;}})['then'](respondWithResult(_0x3481ec,null))[_0xd83c('0x44')](handleError(_0x3481ec,null));};exports[_0xd83c('0x92')]=function(_0x1c5266,_0x197653,_0x40e5f5){var _0x5a0559,_0x17201c;var _0x4f676e=[];var _0x139d97=moment()[_0xd83c('0x65')](_0xd83c('0x66'));return db['Campaign'][_0xd83c('0x48')]({'where':{'id':_0x1c5266[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x197653,null))[_0xd83c('0x24')](function(_0x246d64){if(_0x246d64){_0x17201c=_0x246d64;return _0x246d64[_0xd83c('0x92')](_0x1c5266['body']['ids'],_[_0xd83c('0x51')](_0x1c5266[_0xd83c('0x54')],[_0xd83c('0x67'),'id'])||{});}return null;})[_0xd83c('0x68')](function(_0x18fa97){var _0x3204f2;var _0x2ffed4;_0x5a0559=_0x18fa97||[];var _0x5b4569=[];if(_0x18fa97){for(var _0x2614d6=0x0;_0x2614d6<_0x18fa97[_0xd83c('0x36')];_0x2614d6+=0x1){var _0x2f9cd5=_0x18fa97[_0x2614d6][_0xd83c('0x26')]({'plain':!![]});_0x3204f2=squel[_0xd83c('0x6b')]()[_0xd83c('0x6c')](_0xd83c('0x93'))[_0xd83c('0x6d')]([_0xd83c('0x72'),'ContactId','ListId',_0xd83c('0x59'),_0xd83c('0x52'),_0xd83c('0x53')],squel[_0xd83c('0x71')]()[_0xd83c('0x73')]('phone',_0xd83c('0x72'))[_0xd83c('0x73')]('id',_0xd83c('0x6f'))[_0xd83c('0x73')](_0x2f9cd5['CmListId'][_0xd83c('0x76')](),_0xd83c('0x70'))[_0xd83c('0x73')](_0x1c5266['params']['id'][_0xd83c('0x76')](),_0xd83c('0x59'))['field'](_0xd83c('0x74'),_0xd83c('0x52'))[_0xd83c('0x73')](_0xd83c('0x74'),_0xd83c('0x53'))[_0xd83c('0x7a')]('cm_contacts')['where'](_0xd83c('0x7f'))[_0xd83c('0x3a')](_0xd83c('0x80'),_0x2f9cd5[_0xd83c('0x75')][_0xd83c('0x76')]())['where'](_0xd83c('0x81')))[_0xd83c('0x76')]();_0x5b4569['push'](db[_0xd83c('0x8d')][_0xd83c('0x30')](_0x3204f2));}return BPromise[_0xd83c('0x8e')](_0x5b4569);}})[_0xd83c('0x24')](function(){return _0x5a0559;})['then'](respondWithResult(_0x197653,null))[_0xd83c('0x44')](handleError(_0x197653,null));};exports[_0xd83c('0x94')]=function(_0x489b73,_0x1cbc5a,_0x32a19a){return db['Campaign']['find']({'where':{'id':_0x489b73[_0xd83c('0x46')]['id']}})[_0xd83c('0x24')](handleEntityNotFound(_0x1cbc5a,null))[_0xd83c('0x24')](function(_0x2eaf1f){if(_0x2eaf1f){return _0x2eaf1f['removeBlackLists'](_0x489b73[_0xd83c('0x30')][_0xd83c('0x67')]);}})[_0xd83c('0x24')](function(_0x5e5e96){if(_0x5e5e96){return db['CmHopperBlack'][_0xd83c('0x25')]({'where':{'ListId':_0x489b73['query'][_0xd83c('0x67')],'CampaignId':_0x489b73['params']['id']}})[_0xd83c('0x24')](function(){return _0x5e5e96;});}})[_0xd83c('0x24')](respondWithStatusCode(_0x1cbc5a,null))[_0xd83c('0x44')](handleError(_0x1cbc5a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6154881..40cb9df 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x38d9cb,_0x30654d){var _0x15102a=function(_0x13db6b){while(--_0x13db6b){_0x38d9cb['push'](_0x38d9cb['shift']());}};_0x15102a(++_0x30654d);}(_0x7a54,0x106));var _0x47a5=function(_0x3cbaed,_0x118959){_0x3cbaed=_0x3cbaed-0x0;var _0x46ae24=_0x7a54[_0x3cbaed];return _0x46ae24;};'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 d5d9158..5a10437 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 _0x1782=['info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x48fda4,_0x2a3651){var _0x39bedb=function(_0x1e023b){while(--_0x1e023b){_0x48fda4['push'](_0x48fda4['shift']());}};_0x39bedb(++_0x2a3651);}(_0x1782,0x13e));var _0x2178=function(_0x5cf767,_0x3f09d1){_0x5cf767=_0x5cf767-0x0;var _0x41d91c=_0x1782[_0x5cf767];return _0x41d91c;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad34,_0x53b9f9,_0x4cf22a){return new BPromise(function(_0x3b4115,_0x2b3991){return client[_0x2178('0xa')](_0x50ad34,_0x4cf22a)[_0x2178('0xb')](function(_0x1cb1e6){logger[_0x2178('0xc')]('Campaign,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));logger[_0x2178('0xe')](_0x2178('0xf'),_0x53b9f9,_0x2178('0xd'),JSON[_0x2178('0x10')](_0x1cb1e6));if(_0x1cb1e6[_0x2178('0x11')]){if(_0x1cb1e6[_0x2178('0x11')][_0x2178('0x12')]===0x1f4){logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6['error'][_0x2178('0x14')]);return _0x2b3991(_0x1cb1e6[_0x2178('0x11')]['message']);}logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6[_0x2178('0x11')][_0x2178('0x14')]);return _0x3b4115(_0x1cb1e6[_0x2178('0x11')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));_0x3b4115(_0x1cb1e6['result'][_0x2178('0x14')]);}})[_0x2178('0x15')](function(_0x5edc68){logger['error'](_0x2178('0x13'),_0x53b9f9,_0x5edc68);_0x2b3991(_0x5edc68);});});}exports[_0x2178('0x16')]=function(_0x561990){var _0x3d7e36=this;return new Promise(function(_0x39dd60,_0x1cece2){return db[_0x2178('0x17')][_0x2178('0x18')]({'raw':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1a')]===undefined?!![]:![]:!![],'where':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1b')]||null:null,'attributes':_0x561990[_0x2178('0x19')]?_0x561990['options'][_0x2178('0x1c')]||null:null,'limit':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1d')]||null:null,'include':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x561990[_0x2178('0x19')][_0x2178('0x1e')],function(_0x3c03f7){return{'model':db[_0x3c03f7[_0x2178('0x20')]],'as':_0x3c03f7['as'],'attributes':_0x3c03f7[_0x2178('0x1c')],'include':_0x3c03f7[_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x3c03f7[_0x2178('0x1e')],function(_0x393f67){return{'model':db[_0x393f67[_0x2178('0x20')]],'as':_0x393f67['as'],'attributes':_0x393f67[_0x2178('0x1c')],'include':_0x393f67[_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x393f67[_0x2178('0x1e')],function(_0x330618){return{'model':db[_0x330618['model']],'as':_0x330618['as'],'attributes':_0x330618[_0x2178('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2178('0xb')](function(_0x50804b){logger['info'](_0x2178('0x16'),_0x561990);logger['debug'](_0x2178('0x16'),_0x561990,JSON[_0x2178('0x10')](_0x50804b));_0x39dd60(_0x50804b);})[_0x2178('0x15')](function(_0x47a28f){logger['error'](_0x2178('0x16'),_0x47a28f[_0x2178('0x14')],_0x561990);_0x1cece2(_0x3d7e36[_0x2178('0x11')](0x1f4,_0x47a28f['message']));});});}; \ No newline at end of file +var _0x6931=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0xf7db51,_0x362b44){var _0x442ae3=function(_0x2d011e){while(--_0x2d011e){_0xf7db51['push'](_0xf7db51['shift']());}};_0x442ae3(++_0x362b44);}(_0x6931,0xa5));var _0x1693=function(_0x2e5392,_0x61af7e){_0x2e5392=_0x2e5392-0x0;var _0x4dda58=_0x6931[_0x2e5392];return _0x4dda58;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1693('0x2'));var fs=require('fs');var Redis=require(_0x1693('0x3'));var db=require(_0x1693('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1693('0x5'))(_0x1693('0x6'));var config=require(_0x1693('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1693('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3594e0,_0x45aa35,_0x328cfc){return new BPromise(function(_0x2ab0a0,_0x31bff8){return client[_0x1693('0x9')](_0x3594e0,_0x328cfc)[_0x1693('0xa')](function(_0x391134){logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));logger[_0x1693('0xe')](_0x1693('0xf'),_0x45aa35,_0x1693('0xd'),JSON[_0x1693('0x10')](_0x391134));if(_0x391134[_0x1693('0x11')]){if(_0x391134['error'][_0x1693('0x12')]===0x1f4){logger['error'](_0x1693('0xc'),_0x45aa35,_0x391134[_0x1693('0x11')]['message']);return _0x31bff8(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}logger[_0x1693('0x11')]('Campaign,\x20%s,\x20%s',_0x45aa35,_0x391134[_0x1693('0x11')][_0x1693('0x13')]);return _0x2ab0a0(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}else{logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));_0x2ab0a0(_0x391134[_0x1693('0x14')][_0x1693('0x13')]);}})[_0x1693('0x15')](function(_0x59cbff){logger[_0x1693('0x11')]('Campaign,\x20%s,\x20%s',_0x45aa35,_0x59cbff);_0x31bff8(_0x59cbff);});});}exports[_0x1693('0x16')]=function(_0x20906b){var _0x2ffa86=this;return new Promise(function(_0x410c3b,_0x3f5287){return db[_0x1693('0x17')][_0x1693('0x18')]({'raw':_0x20906b[_0x1693('0x19')]?_0x20906b[_0x1693('0x19')][_0x1693('0x1a')]===undefined?!![]:![]:!![],'where':_0x20906b[_0x1693('0x19')]?_0x20906b[_0x1693('0x19')][_0x1693('0x1b')]||null:null,'attributes':_0x20906b[_0x1693('0x19')]?_0x20906b[_0x1693('0x19')][_0x1693('0x1c')]||null:null,'limit':_0x20906b['options']?_0x20906b[_0x1693('0x19')][_0x1693('0x1d')]||null:null,'include':_0x20906b['options']?_0x20906b[_0x1693('0x19')][_0x1693('0x1e')]?_[_0x1693('0x1f')](_0x20906b[_0x1693('0x19')][_0x1693('0x1e')],function(_0x588ebe){return{'model':db[_0x588ebe[_0x1693('0x20')]],'as':_0x588ebe['as'],'attributes':_0x588ebe[_0x1693('0x1c')],'include':_0x588ebe[_0x1693('0x1e')]?_['map'](_0x588ebe[_0x1693('0x1e')],function(_0x28a1cc){return{'model':db[_0x28a1cc['model']],'as':_0x28a1cc['as'],'attributes':_0x28a1cc[_0x1693('0x1c')],'include':_0x28a1cc[_0x1693('0x1e')]?_['map'](_0x28a1cc['include'],function(_0x5655dd){return{'model':db[_0x5655dd[_0x1693('0x20')]],'as':_0x5655dd['as'],'attributes':_0x5655dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1693('0xa')](function(_0x3ee757){logger[_0x1693('0xb')](_0x1693('0x16'),_0x20906b);logger['debug'](_0x1693('0x16'),_0x20906b,JSON[_0x1693('0x10')](_0x3ee757));_0x410c3b(_0x3ee757);})['catch'](function(_0x37bce9){logger[_0x1693('0x11')](_0x1693('0x16'),_0x37bce9['message'],_0x20906b);_0x3f5287(_0x2ffa86[_0x1693('0x11')](0x1f4,_0x37bce9[_0x1693('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4f9f55a..73c6460 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 _0xeb53=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','/:id/lists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./campaign.controller'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0xeb53,0xca));var _0x3eb5=function(_0x357bb5,_0x28b8d3){_0x357bb5=_0x357bb5-0x0;var _0xf08844=_0xeb53[_0x357bb5];return _0xf08844;};'use strict';var multer=require(_0x3eb5('0x0'));var util=require(_0x3eb5('0x1'));var path=require(_0x3eb5('0x2'));var timeout=require(_0x3eb5('0x3'));var express=require(_0x3eb5('0x4'));var router=express['Router']();var fs_extra=require(_0x3eb5('0x5'));var auth=require(_0x3eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3eb5('0x7'));router[_0x3eb5('0x8')]('/',auth['isAuthenticated'](),controller[_0x3eb5('0x9')]);router[_0x3eb5('0x8')](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0xc')]);router[_0x3eb5('0x8')](_0x3eb5('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x3eb5('0x8')]('/:id/hopper_histories',auth[_0x3eb5('0xb')](),controller[_0x3eb5('0xe')]);router[_0x3eb5('0x8')](_0x3eb5('0xf'),auth[_0x3eb5('0xb')](),controller['getHopperFinals']);router['get'](_0x3eb5('0x10'),auth[_0x3eb5('0xb')](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x11')]);router[_0x3eb5('0x8')](_0x3eb5('0x12'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x3eb5('0x13')]('/',auth['isAuthenticated'](),controller[_0x3eb5('0x14')]);router[_0x3eb5('0x13')](_0x3eb5('0x15'),auth['isAuthenticated'](),controller[_0x3eb5('0x16')]);router[_0x3eb5('0x13')]('/:id/lists',auth['isAuthenticated'](),controller[_0x3eb5('0x17')]);router[_0x3eb5('0x13')](_0x3eb5('0x12'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x18')]);router['put'](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x19')]);router[_0x3eb5('0x1a')](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller['destroy']);router[_0x3eb5('0x1a')](_0x3eb5('0x1b'),auth[_0x3eb5('0xb')](),controller['removeLists']);router[_0x3eb5('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x3eb5('0x1c')]);module[_0x3eb5('0x1d')]=router; \ No newline at end of file +var _0xccbe=['getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','/:id','update','delete','destroy','removeBlackLists','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xccbe,0xa4));var _0xeccb=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xccbe[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeccb('0x0'));var timeout=require(_0xeccb('0x1'));var express=require('express');var router=express[_0xeccb('0x2')]();var fs_extra=require(_0xeccb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xeccb('0x4'));var config=require(_0xeccb('0x5'));var controller=require('./campaign.controller');router[_0xeccb('0x6')]('/',auth[_0xeccb('0x7')](),controller[_0xeccb('0x8')]);router['get']('/:id',auth[_0xeccb('0x7')](),controller['show']);router[_0xeccb('0x6')]('/:id/hoppers',auth[_0xeccb('0x7')](),controller[_0xeccb('0x9')]);router[_0xeccb('0x6')](_0xeccb('0xa'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xeccb('0x6')](_0xeccb('0xb'),auth[_0xeccb('0x7')](),controller[_0xeccb('0xc')]);router[_0xeccb('0x6')](_0xeccb('0xd'),auth[_0xeccb('0x7')](),controller[_0xeccb('0xe')]);router[_0xeccb('0x6')](_0xeccb('0xf'),auth[_0xeccb('0x7')](),controller[_0xeccb('0x10')]);router[_0xeccb('0x6')](_0xeccb('0x11'),auth[_0xeccb('0x7')](),controller[_0xeccb('0x12')]);router[_0xeccb('0x13')]('/',auth[_0xeccb('0x7')](),controller['create']);router['post'](_0xeccb('0x14'),auth['isAuthenticated'](),controller[_0xeccb('0x15')]);router[_0xeccb('0x13')](_0xeccb('0xf'),auth['isAuthenticated'](),controller[_0xeccb('0x16')]);router[_0xeccb('0x13')](_0xeccb('0x11'),auth[_0xeccb('0x7')](),controller['addBlackLists']);router[_0xeccb('0x17')](_0xeccb('0x18'),auth[_0xeccb('0x7')](),controller[_0xeccb('0x19')]);router[_0xeccb('0x1a')](_0xeccb('0x18'),auth[_0xeccb('0x7')](),controller[_0xeccb('0x1b')]);router['delete'](_0xeccb('0xf'),auth[_0xeccb('0x7')](),controller['removeLists']);router['delete'](_0xeccb('0x11'),auth[_0xeccb('0x7')](),controller[_0xeccb('0x1c')]);module[_0xeccb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3fa1481..fc50909 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 _0xa362=['STRING','TEXT','medium','VIRTUAL','key','sequelize','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xa362,0xe5));var _0x2a36=function(_0xe2ec77,_0x242e37){_0xe2ec77=_0xe2ec77-0x0;var _0x40d177=_0xa362[_0xe2ec77];return _0x40d177;};'use strict';var Sequelize=require(_0x2a36('0x0'));module[_0x2a36('0x1')]={'key':{'type':Sequelize[_0x2a36('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2a36('0x3')],'length':_0x2a36('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2a36('0x2')]},'name':{'type':Sequelize[_0x2a36('0x5')],'get':function(){return this['getDataValue'](_0x2a36('0x6'));}}}; \ No newline at end of file +var _0x4259=['VIRTUAL','getDataValue','key','STRING','TEXT','medium'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x4259,0x19b));var _0x9425=function(_0x23e567,_0x317c3b){_0x23e567=_0x23e567-0x0;var _0x1fceaf=_0x4259[_0x23e567];return _0x1fceaf;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x9425('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x9425('0x1')],'length':_0x9425('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9425('0x0')]},'name':{'type':Sequelize[_0x9425('0x3')],'get':function(){return this[_0x9425('0x4')](_0x9425('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 62d022c..5a8c10c 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 _0x4e33=['keys','rawAttributes','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params'];(function(_0x5934f3,_0x55f354){var _0x44e3f4=function(_0x481815){while(--_0x481815){_0x5934f3['push'](_0x5934f3['shift']());}};_0x44e3f4(++_0x55f354);}(_0x4e33,0x1b5));var _0x34e3=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x4e33[_0x153e7d];return _0x3c22dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34e3('0x0'));var rp=require(_0x34e3('0x1'));var moment=require(_0x34e3('0x2'));var BPromise=require(_0x34e3('0x3'));var Mustache=require(_0x34e3('0x4'));var util=require('util');var path=require(_0x34e3('0x5'));var sox=require('sox');var csv=require(_0x34e3('0x6'));var ejs=require(_0x34e3('0x7'));var fs=require('fs');var fs_extra=require(_0x34e3('0x8'));var _=require(_0x34e3('0x9'));var squel=require(_0x34e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x34e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34e3('0x6'));var querystring=require(_0x34e3('0xc'));var Papa=require(_0x34e3('0xd'));var Redis=require('ioredis');var authService=require(_0x34e3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x34e3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x34e3('0x10'))(_0x34e3('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34e3('0x12'))['db'];function respondWithStatusCode(_0xe3751b,_0x320104){_0x320104=_0x320104||0xcc;return function(_0x1f4e6f){if(_0x1f4e6f){return _0xe3751b[_0x34e3('0x13')](_0x320104);}return _0xe3751b[_0x34e3('0x14')](_0x320104)[_0x34e3('0x15')]();};}function respondWithResult(_0x538f7f,_0x51267a){_0x51267a=_0x51267a||0xc8;return function(_0x533115){if(_0x533115){return _0x538f7f[_0x34e3('0x14')](_0x51267a)[_0x34e3('0x16')](_0x533115);}};}function respondWithFilteredResult(_0x44da4f,_0x4b072e){return function(_0x42a5b9){if(_0x42a5b9){var _0x393c48=typeof _0x4b072e[_0x34e3('0x17')]===_0x34e3('0x18')&&typeof _0x4b072e[_0x34e3('0x19')]===_0x34e3('0x18');var _0x4f81b7=_0x42a5b9[_0x34e3('0x1a')];var _0x258106=_0x393c48?0x0:_0x4b072e[_0x34e3('0x17')];var _0x1be3f7=_0x393c48?_0x42a5b9[_0x34e3('0x1a')]:_0x4b072e[_0x34e3('0x17')]+_0x4b072e['limit'];var _0x4a90e7;if(_0x1be3f7>=_0x4f81b7){_0x1be3f7=_0x4f81b7;_0x4a90e7=0xc8;}else{_0x4a90e7=0xce;}_0x44da4f[_0x34e3('0x14')](_0x4a90e7);return _0x44da4f[_0x34e3('0x1b')](_0x34e3('0x1c'),_0x258106+'-'+_0x1be3f7+'/'+_0x4f81b7)[_0x34e3('0x16')](_0x42a5b9);}return null;};}function patchUpdates(_0x4370ba){return function(_0x43cf7a){try{jsonpatch[_0x34e3('0x1d')](_0x43cf7a,_0x4370ba,!![]);}catch(_0x460ab1){return BPromise[_0x34e3('0x1e')](_0x460ab1);}return _0x43cf7a[_0x34e3('0x1f')]();};}function saveUpdates(_0x5f3597,_0x3dea01){return function(_0x47c1a4){if(_0x47c1a4){return _0x47c1a4[_0x34e3('0x20')](_0x5f3597)[_0x34e3('0x21')](function(_0x4154c1){return _0x4154c1;});}return null;};}function removeEntity(_0x42fc9f,_0x48dbdd){return function(_0x11bf91){if(_0x11bf91){return _0x11bf91[_0x34e3('0x22')]()['then'](function(){var _0x17f687=_0x11bf91[_0x34e3('0x23')]({'plain':!![]});var _0x28fc37=_0x34e3('0x24');return db[_0x34e3('0x25')][_0x34e3('0x22')]({'where':{'type':_0x28fc37,'resourceId':_0x17f687['id']}})[_0x34e3('0x21')](function(){return _0x11bf91;});})[_0x34e3('0x21')](function(){_0x42fc9f[_0x34e3('0x14')](0xcc)[_0x34e3('0x15')]();});}};}function handleEntityNotFound(_0xdd062c,_0x777774){return function(_0x399137){if(!_0x399137){_0xdd062c[_0x34e3('0x13')](0x194);}return _0x399137;};}function handleError(_0x1a6180,_0xdc3433){_0xdc3433=_0xdc3433||0x1f4;return function(_0x294e29){logger[_0x34e3('0x26')](_0x294e29['stack']);if(_0x294e29['name']){delete _0x294e29[_0x34e3('0x27')];}_0x1a6180[_0x34e3('0x14')](_0xdc3433)[_0x34e3('0x28')](_0x294e29);};}exports[_0x34e3('0x29')]=function(_0x786732,_0x89ea7c){var _0x3f534b={},_0x109189={},_0x420c44={'count':0x0,'rows':[]};var _0x569ce2=_[_0x34e3('0x2a')](db[_0x34e3('0x2b')]['rawAttributes'],function(_0x4c9821){return{'name':_0x4c9821[_0x34e3('0x2c')],'type':_0x4c9821[_0x34e3('0x2d')][_0x34e3('0x2e')]};});_0x109189['model']=_[_0x34e3('0x2a')](_0x569ce2,'name');_0x109189[_0x34e3('0x2f')]=_['keys'](_0x786732['query']);_0x109189[_0x34e3('0x30')]=_[_0x34e3('0x31')](_0x109189[_0x34e3('0x32')],_0x109189[_0x34e3('0x2f')]);_0x3f534b[_0x34e3('0x33')]=_[_0x34e3('0x31')](_0x109189[_0x34e3('0x32')],qs['fields'](_0x786732[_0x34e3('0x2f')][_0x34e3('0x34')]));_0x3f534b[_0x34e3('0x33')]=_0x3f534b['attributes'][_0x34e3('0x35')]?_0x3f534b['attributes']:_0x109189[_0x34e3('0x32')];if(!_0x786732[_0x34e3('0x2f')][_0x34e3('0x36')]('nolimit')){_0x3f534b[_0x34e3('0x19')]=qs[_0x34e3('0x19')](_0x786732[_0x34e3('0x2f')][_0x34e3('0x19')]);_0x3f534b[_0x34e3('0x17')]=qs[_0x34e3('0x17')](_0x786732[_0x34e3('0x2f')]['offset']);}_0x3f534b[_0x34e3('0x37')]=qs[_0x34e3('0x38')](_0x786732['query'][_0x34e3('0x38')]);_0x3f534b['where']=qs[_0x34e3('0x30')](_[_0x34e3('0x39')](_0x786732[_0x34e3('0x2f')],_0x109189[_0x34e3('0x30')]),_0x569ce2);if(_0x786732['query'][_0x34e3('0x3a')]){_0x3f534b[_0x34e3('0x3b')]=_[_0x34e3('0x3c')](_0x3f534b['where'],{'$or':[{'key':{'$like':'%'+_0x786732['query'][_0x34e3('0x3a')]+'%'}},{'value':{'$like':'%'+_0x786732[_0x34e3('0x2f')][_0x34e3('0x3a')]+'%'}}]});}_0x3f534b=_['merge']({},_0x3f534b,_0x786732[_0x34e3('0x3d')]);var _0x53f4fc={'where':_0x3f534b[_0x34e3('0x3b')]};return db[_0x34e3('0x2b')][_0x34e3('0x1a')](_0x53f4fc)[_0x34e3('0x21')](function(_0x417038){_0x420c44[_0x34e3('0x1a')]=_0x417038;if(_0x786732[_0x34e3('0x2f')][_0x34e3('0x3e')]){_0x3f534b['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x34e3('0x3f')](_0x3f534b);})[_0x34e3('0x21')](function(_0x2b2af2){_0x420c44[_0x34e3('0x40')]=_0x2b2af2;return _0x420c44;})[_0x34e3('0x21')](respondWithFilteredResult(_0x89ea7c,_0x3f534b))[_0x34e3('0x41')](handleError(_0x89ea7c,null));};exports['show']=function(_0x218d2b,_0x36472e){var _0x2732b3={'raw':!![],'where':{'id':_0x218d2b[_0x34e3('0x42')]['id']}},_0x596305={};_0x596305[_0x34e3('0x32')]=_[_0x34e3('0x43')](db[_0x34e3('0x2b')][_0x34e3('0x44')]);_0x596305[_0x34e3('0x2f')]=_[_0x34e3('0x43')](_0x218d2b['query']);_0x596305[_0x34e3('0x30')]=_[_0x34e3('0x31')](_0x596305['model'],_0x596305[_0x34e3('0x2f')]);_0x2732b3['attributes']=_[_0x34e3('0x31')](_0x596305['model'],qs['fields'](_0x218d2b[_0x34e3('0x2f')][_0x34e3('0x34')]));_0x2732b3[_0x34e3('0x33')]=_0x2732b3[_0x34e3('0x33')][_0x34e3('0x35')]?_0x2732b3[_0x34e3('0x33')]:_0x596305[_0x34e3('0x32')];if(_0x218d2b[_0x34e3('0x2f')][_0x34e3('0x3e')]){_0x2732b3[_0x34e3('0x45')]=[{'all':!![]}];}_0x2732b3=_[_0x34e3('0x3c')]({},_0x2732b3,_0x218d2b['options']);return db[_0x34e3('0x2b')][_0x34e3('0x46')](_0x2732b3)[_0x34e3('0x21')](handleEntityNotFound(_0x36472e,null))[_0x34e3('0x21')](respondWithResult(_0x36472e,null))[_0x34e3('0x41')](handleError(_0x36472e,null));};exports[_0x34e3('0x20')]=function(_0x308565,_0x4807f9){if(_0x308565[_0x34e3('0x47')]['id']){delete _0x308565[_0x34e3('0x47')]['id'];}return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':{'id':_0x308565[_0x34e3('0x42')]['id']}})[_0x34e3('0x21')](handleEntityNotFound(_0x4807f9,null))[_0x34e3('0x21')](saveUpdates(_0x308565[_0x34e3('0x47')],null))['then'](respondWithResult(_0x4807f9,null))[_0x34e3('0x41')](handleError(_0x4807f9,null));};exports[_0x34e3('0x22')]=function(_0x2d2317,_0x268701){return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':{'id':_0x2d2317[_0x34e3('0x42')]['id']}})['then'](handleEntityNotFound(_0x268701,null))[_0x34e3('0x21')](removeEntity(_0x268701,null))[_0x34e3('0x41')](handleError(_0x268701,null));};exports[_0x34e3('0x48')]=function(_0xa1fa51,_0x309c88){var _0x2a8590={'key':_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x2e')]};if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x49')]){_0x2a8590['MailAccountId']=_0xa1fa51[_0x34e3('0x47')]['MailAccountId'];}else if(_0xa1fa51[_0x34e3('0x47')]['SmsAccountId']){_0x2a8590[_0x34e3('0x4a')]=_0xa1fa51['body'][_0x34e3('0x4a')];}else if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4b')]){_0x2a8590[_0x34e3('0x4b')]=_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4b')];}else if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4c')]){_0x2a8590['ChatWebsiteId']=_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4c')];}return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':_0x2a8590})[_0x34e3('0x21')](function(_0x28c912){if(_0x28c912){throw new db[(_0x34e3('0x4d'))][(_0x34e3('0x4e'))](_0x34e3('0x4f'));}return db[_0x34e3('0x2b')][_0x34e3('0x48')](_0xa1fa51[_0x34e3('0x47')]);})[_0x34e3('0x21')](function(_0x42a996){var _0x5ad46c=_0xa1fa51[_0x34e3('0x50')][_0x34e3('0x23')]({'plain':!![]});if(!_0x5ad46c)throw new Error(_0x34e3('0x51'));if(_0x5ad46c[_0x34e3('0x52')]===_0x34e3('0x50')){var _0x20c35d=_0x42a996['get']({'plain':!![]});return db['UserProfileSection'][_0x34e3('0x46')]({'where':{'name':_0x34e3('0x24'),'userProfileId':_0x5ad46c[_0x34e3('0x53')]},'raw':!![]})[_0x34e3('0x21')](function(_0x3bcc38){if(_0x3bcc38&&_0x3bcc38['autoAssociation']===0x0){return db[_0x34e3('0x25')][_0x34e3('0x48')]({'name':_0x20c35d[_0x34e3('0x27')],'resourceId':_0x20c35d['id'],'type':_0x3bcc38['name'],'sectionId':_0x3bcc38['id']},{})[_0x34e3('0x21')](function(){return _0x42a996;});}else{return _0x42a996;}})[_0x34e3('0x41')](function(_0x2fa677){logger[_0x34e3('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fa677);throw _0x2fa677;});}return _0x42a996;})[_0x34e3('0x21')](respondWithResult(_0x309c88,0xc9))[_0x34e3('0x41')](handleError(_0x309c88,null));}; \ No newline at end of file +var _0x81f4=['UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','CannedAnswers','sendStatus','stack','name','send','map','CannedAnswer','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','params','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation'];(function(_0x5a8112,_0x465890){var _0x47d887=function(_0x21be3a){while(--_0x21be3a){_0x5a8112['push'](_0x5a8112['shift']());}};_0x47d887(++_0x465890);}(_0x81f4,0xb6));var _0x481f=function(_0x1680f2,_0x13f7b9){_0x1680f2=_0x1680f2-0x0;var _0x19d047=_0x81f4[_0x1680f2];return _0x19d047;};'use strict';var emlformat=require(_0x481f('0x0'));var rimraf=require(_0x481f('0x1'));var zipdir=require(_0x481f('0x2'));var jsonpatch=require(_0x481f('0x3'));var rp=require(_0x481f('0x4'));var moment=require(_0x481f('0x5'));var BPromise=require(_0x481f('0x6'));var Mustache=require(_0x481f('0x7'));var util=require(_0x481f('0x8'));var path=require(_0x481f('0x9'));var sox=require(_0x481f('0xa'));var csv=require(_0x481f('0xb'));var ejs=require(_0x481f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x481f('0xd'));var crypto=require(_0x481f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x481f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x481f('0x10'));var Papa=require(_0x481f('0x11'));var Redis=require('ioredis');var authService=require(_0x481f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x481f('0x13'));var logger=require('../../config/logger')(_0x481f('0x14'));var utils=require('../../config/utils');var config=require(_0x481f('0x15'));var licenseUtil=require(_0x481f('0x16'));var db=require(_0x481f('0x17'))['db'];function respondWithStatusCode(_0x131a80,_0x191d9f){_0x191d9f=_0x191d9f||0xcc;return function(_0x17510){if(_0x17510){return _0x131a80['sendStatus'](_0x191d9f);}return _0x131a80[_0x481f('0x18')](_0x191d9f)[_0x481f('0x19')]();};}function respondWithResult(_0xe9cb43,_0x56b77e){_0x56b77e=_0x56b77e||0xc8;return function(_0x54b308){if(_0x54b308){return _0xe9cb43['status'](_0x56b77e)[_0x481f('0x1a')](_0x54b308);}};}function respondWithFilteredResult(_0x36b2be,_0x2da707){return function(_0x5b27e2){if(_0x5b27e2){var _0x191c1e=typeof _0x2da707['offset']===_0x481f('0x1b')&&typeof _0x2da707['limit']===_0x481f('0x1b');var _0x3a6488=_0x5b27e2[_0x481f('0x1c')];var _0x1d89e3=_0x191c1e?0x0:_0x2da707['offset'];var _0x346ad6=_0x191c1e?_0x5b27e2['count']:_0x2da707[_0x481f('0x1d')]+_0x2da707[_0x481f('0x1e')];var _0x10ee2e;if(_0x346ad6>=_0x3a6488){_0x346ad6=_0x3a6488;_0x10ee2e=0xc8;}else{_0x10ee2e=0xce;}_0x36b2be[_0x481f('0x18')](_0x10ee2e);return _0x36b2be[_0x481f('0x1f')](_0x481f('0x20'),_0x1d89e3+'-'+_0x346ad6+'/'+_0x3a6488)['json'](_0x5b27e2);}return null;};}function patchUpdates(_0x13b429){return function(_0x4dd473){try{jsonpatch['apply'](_0x4dd473,_0x13b429,!![]);}catch(_0x5ec1c8){return BPromise[_0x481f('0x21')](_0x5ec1c8);}return _0x4dd473[_0x481f('0x22')]();};}function saveUpdates(_0x2359b0,_0x2e200b){return function(_0x527f9a){if(_0x527f9a){return _0x527f9a[_0x481f('0x23')](_0x2359b0)['then'](function(_0x91bd55){return _0x91bd55;});}return null;};}function removeEntity(_0x2e5ba8,_0x1e2d45){return function(_0x3fd3d3){if(_0x3fd3d3){return _0x3fd3d3[_0x481f('0x24')]()[_0x481f('0x25')](function(){var _0x1b68d2=_0x3fd3d3['get']({'plain':!![]});var _0x16fa31=_0x481f('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x16fa31,'resourceId':_0x1b68d2['id']}})[_0x481f('0x25')](function(){return _0x3fd3d3;});})[_0x481f('0x25')](function(){_0x2e5ba8[_0x481f('0x18')](0xcc)[_0x481f('0x19')]();});}};}function handleEntityNotFound(_0x5534aa,_0x216e7a){return function(_0x2e08a1){if(!_0x2e08a1){_0x5534aa[_0x481f('0x27')](0x194);}return _0x2e08a1;};}function handleError(_0x56f086,_0x5775ae){_0x5775ae=_0x5775ae||0x1f4;return function(_0x8537d2){logger['error'](_0x8537d2[_0x481f('0x28')]);if(_0x8537d2[_0x481f('0x29')]){delete _0x8537d2[_0x481f('0x29')];}_0x56f086[_0x481f('0x18')](_0x5775ae)[_0x481f('0x2a')](_0x8537d2);};}exports['index']=function(_0xb4de99,_0x573918){var _0x3ed034={},_0x5bd2b1={},_0x2fa5ce={'count':0x0,'rows':[]};var _0x5c031b=_[_0x481f('0x2b')](db[_0x481f('0x2c')]['rawAttributes'],function(_0x39ab70){return{'name':_0x39ab70[_0x481f('0x2d')],'type':_0x39ab70['type'][_0x481f('0x2e')]};});_0x5bd2b1['model']=_[_0x481f('0x2b')](_0x5c031b,_0x481f('0x29'));_0x5bd2b1[_0x481f('0x2f')]=_[_0x481f('0x30')](_0xb4de99[_0x481f('0x2f')]);_0x5bd2b1[_0x481f('0x31')]=_[_0x481f('0x32')](_0x5bd2b1['model'],_0x5bd2b1[_0x481f('0x2f')]);_0x3ed034[_0x481f('0x33')]=_['intersection'](_0x5bd2b1['model'],qs[_0x481f('0x34')](_0xb4de99[_0x481f('0x2f')][_0x481f('0x34')]));_0x3ed034[_0x481f('0x33')]=_0x3ed034[_0x481f('0x33')][_0x481f('0x35')]?_0x3ed034['attributes']:_0x5bd2b1[_0x481f('0x36')];if(!_0xb4de99[_0x481f('0x2f')][_0x481f('0x37')](_0x481f('0x38'))){_0x3ed034[_0x481f('0x1e')]=qs[_0x481f('0x1e')](_0xb4de99[_0x481f('0x2f')][_0x481f('0x1e')]);_0x3ed034['offset']=qs[_0x481f('0x1d')](_0xb4de99[_0x481f('0x2f')][_0x481f('0x1d')]);}_0x3ed034[_0x481f('0x39')]=qs[_0x481f('0x3a')](_0xb4de99[_0x481f('0x2f')][_0x481f('0x3a')]);_0x3ed034[_0x481f('0x3b')]=qs[_0x481f('0x31')](_[_0x481f('0x3c')](_0xb4de99['query'],_0x5bd2b1[_0x481f('0x31')]),_0x5c031b);if(_0xb4de99[_0x481f('0x2f')]['filter']){_0x3ed034[_0x481f('0x3b')]=_[_0x481f('0x3d')](_0x3ed034['where'],{'$or':[{'key':{'$like':'%'+_0xb4de99[_0x481f('0x2f')][_0x481f('0x3e')]+'%'}},{'value':{'$like':'%'+_0xb4de99['query'][_0x481f('0x3e')]+'%'}}]});}_0x3ed034=_['merge']({},_0x3ed034,_0xb4de99['options']);var _0x34d8ab={'where':_0x3ed034['where']};return db['CannedAnswer'][_0x481f('0x1c')](_0x34d8ab)['then'](function(_0x48949b){_0x2fa5ce['count']=_0x48949b;if(_0xb4de99['query'][_0x481f('0x3f')]){_0x3ed034[_0x481f('0x40')]=[{'all':!![]}];}return db['CannedAnswer'][_0x481f('0x41')](_0x3ed034);})[_0x481f('0x25')](function(_0x5019ba){_0x2fa5ce[_0x481f('0x42')]=_0x5019ba;return _0x2fa5ce;})['then'](respondWithFilteredResult(_0x573918,_0x3ed034))[_0x481f('0x43')](handleError(_0x573918,null));};exports['show']=function(_0xe1a390,_0x501fe1){var _0x58cc40={'raw':!![],'where':{'id':_0xe1a390[_0x481f('0x44')]['id']}},_0x159cbb={};_0x159cbb['model']=_[_0x481f('0x30')](db[_0x481f('0x2c')]['rawAttributes']);_0x159cbb[_0x481f('0x2f')]=_['keys'](_0xe1a390['query']);_0x159cbb[_0x481f('0x31')]=_[_0x481f('0x32')](_0x159cbb[_0x481f('0x36')],_0x159cbb['query']);_0x58cc40['attributes']=_[_0x481f('0x32')](_0x159cbb['model'],qs[_0x481f('0x34')](_0xe1a390[_0x481f('0x2f')][_0x481f('0x34')]));_0x58cc40[_0x481f('0x33')]=_0x58cc40[_0x481f('0x33')]['length']?_0x58cc40['attributes']:_0x159cbb['model'];if(_0xe1a390[_0x481f('0x2f')][_0x481f('0x3f')]){_0x58cc40['include']=[{'all':!![]}];}_0x58cc40=_[_0x481f('0x3d')]({},_0x58cc40,_0xe1a390[_0x481f('0x45')]);return db[_0x481f('0x2c')][_0x481f('0x46')](_0x58cc40)[_0x481f('0x25')](handleEntityNotFound(_0x501fe1,null))[_0x481f('0x25')](respondWithResult(_0x501fe1,null))[_0x481f('0x43')](handleError(_0x501fe1,null));};exports[_0x481f('0x23')]=function(_0x1f574e,_0x2303a8){if(_0x1f574e[_0x481f('0x47')]['id']){delete _0x1f574e['body']['id'];}return db[_0x481f('0x2c')][_0x481f('0x46')]({'where':{'id':_0x1f574e[_0x481f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2303a8,null))[_0x481f('0x25')](saveUpdates(_0x1f574e[_0x481f('0x47')],null))[_0x481f('0x25')](respondWithResult(_0x2303a8,null))[_0x481f('0x43')](handleError(_0x2303a8,null));};exports[_0x481f('0x24')]=function(_0x529e7a,_0xfaa214){return db[_0x481f('0x2c')][_0x481f('0x46')]({'where':{'id':_0x529e7a[_0x481f('0x44')]['id']}})[_0x481f('0x25')](handleEntityNotFound(_0xfaa214,null))[_0x481f('0x25')](removeEntity(_0xfaa214,null))[_0x481f('0x43')](handleError(_0xfaa214,null));};exports['create']=function(_0x56cf3e,_0x1a3714){var _0x530497={'key':_0x56cf3e[_0x481f('0x47')][_0x481f('0x2e')]};if(_0x56cf3e['body'][_0x481f('0x48')]){_0x530497[_0x481f('0x48')]=_0x56cf3e[_0x481f('0x47')][_0x481f('0x48')];}else if(_0x56cf3e[_0x481f('0x47')][_0x481f('0x49')]){_0x530497[_0x481f('0x49')]=_0x56cf3e[_0x481f('0x47')][_0x481f('0x49')];}else if(_0x56cf3e[_0x481f('0x47')][_0x481f('0x4a')]){_0x530497[_0x481f('0x4a')]=_0x56cf3e[_0x481f('0x47')]['OpenchannelAccountId'];}else if(_0x56cf3e[_0x481f('0x47')][_0x481f('0x4b')]){_0x530497['ChatWebsiteId']=_0x56cf3e[_0x481f('0x47')][_0x481f('0x4b')];}return db[_0x481f('0x2c')][_0x481f('0x46')]({'where':_0x530497})['then'](function(_0x5f5011){if(_0x5f5011){throw new db[(_0x481f('0x4c'))][(_0x481f('0x4d'))](_0x481f('0x4e'));}return db[_0x481f('0x2c')]['create'](_0x56cf3e[_0x481f('0x47')]);})[_0x481f('0x25')](function(_0x2bc95e){var _0x51dca1=_0x56cf3e[_0x481f('0x4f')]['get']({'plain':!![]});if(!_0x51dca1)throw new Error(_0x481f('0x50'));if(_0x51dca1['role']===_0x481f('0x4f')){var _0x5ac879=_0x2bc95e[_0x481f('0x51')]({'plain':!![]});return db[_0x481f('0x52')][_0x481f('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x51dca1[_0x481f('0x53')]},'raw':!![]})[_0x481f('0x25')](function(_0x17a3e0){if(_0x17a3e0&&_0x17a3e0[_0x481f('0x54')]===0x0){return db[_0x481f('0x55')][_0x481f('0x56')]({'name':_0x5ac879[_0x481f('0x29')],'resourceId':_0x5ac879['id'],'type':_0x17a3e0[_0x481f('0x29')],'sectionId':_0x17a3e0['id']},{})['then'](function(){return _0x2bc95e;});}else{return _0x2bc95e;}})['catch'](function(_0x3e7a03){logger[_0x481f('0x57')](_0x481f('0x58'),_0x3e7a03);throw _0x3e7a03;});}return _0x2bc95e;})['then'](respondWithResult(_0x1a3714,0xc9))[_0x481f('0x43')](handleError(_0x1a3714,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 13e9e14..4a8519a 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 _0x7b70=['moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','lodash','api'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7b70,0xc4));var _0x07b7=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x7b70[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x07b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x07b7('0x1'));var moment=require(_0x07b7('0x2'));var BPromise=require(_0x07b7('0x3'));var rp=require(_0x07b7('0x4'));var fs=require('fs');var path=require(_0x07b7('0x5'));var rimraf=require(_0x07b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x07b7('0x7'));module['exports']=function(_0x1de428,_0x19e16d){return _0x1de428[_0x07b7('0x8')](_0x07b7('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07b7('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaaf8=['moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','util','api'];(function(_0x222f42,_0x21fa16){var _0x34c41d=function(_0x41ac2a){while(--_0x41ac2a){_0x222f42['push'](_0x222f42['shift']());}};_0x34c41d(++_0x21fa16);}(_0xaaf8,0x1ab));var _0x8aaf=function(_0x15f0e2,_0x22e3ee){_0x15f0e2=_0x15f0e2-0x0;var _0x21cc0c=_0xaaf8[_0x15f0e2];return _0x21cc0c;};'use strict';var _=require('lodash');var util=require(_0x8aaf('0x0'));var logger=require('../../config/logger')(_0x8aaf('0x1'));var moment=require(_0x8aaf('0x2'));var BPromise=require(_0x8aaf('0x3'));var rp=require(_0x8aaf('0x4'));var fs=require('fs');var path=require(_0x8aaf('0x5'));var rimraf=require('rimraf');var config=require(_0x8aaf('0x6'));var attributes=require(_0x8aaf('0x7'));module[_0x8aaf('0x8')]=function(_0x4d0a49,_0xc3fdc7){return _0x4d0a49[_0x8aaf('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aaf('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9b78835..fd9f43d 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(_0xba4983,_0x4b1f8b){var _0x216a79=function(_0x2c9e6f){while(--_0x2c9e6f){_0xba4983['push'](_0xba4983['shift']());}};_0x216a79(++_0x4b1f8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x42676d,_0x14924a){var _0x920e=function(_0x1528d0){while(--_0x1528d0){_0x42676d['push'](_0x42676d['shift']());}};_0x920e(++_0x14924a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 7d5673e..eae0b5f 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 _0x6fc3=['connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x6fc3,0x13b));var _0x36fc=function(_0x185399,_0x5d382d){_0x185399=_0x185399-0x0;var _0x4d08e3=_0x6fc3[_0x185399];return _0x4d08e3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x36fc('0x0'));var express=require(_0x36fc('0x1'));var router=express[_0x36fc('0x2')]();var fs_extra=require(_0x36fc('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x36fc('0x4'));var controller=require(_0x36fc('0x5'));router[_0x36fc('0x6')]('/',auth[_0x36fc('0x7')](),controller[_0x36fc('0x8')]);router[_0x36fc('0x6')](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller['show']);router[_0x36fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x36fc('0xb')]);router[_0x36fc('0xc')](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller[_0x36fc('0xd')]);router['delete'](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller[_0x36fc('0xe')]);module['exports']=router; \ No newline at end of file +var _0xdb7e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb7e,0xb5));var _0xedb7=function(_0x9e049f,_0x4bfa95){_0x9e049f=_0x9e049f-0x0;var _0x2700b2=_0xdb7e[_0x9e049f];return _0x2700b2;};'use strict';var multer=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var path=require(_0xedb7('0x2'));var timeout=require(_0xedb7('0x3'));var express=require(_0xedb7('0x4'));var router=express['Router']();var fs_extra=require(_0xedb7('0x5'));var auth=require(_0xedb7('0x6'));var interaction=require(_0xedb7('0x7'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xedb7('0x8')](),controller[_0xedb7('0x9')]);router[_0xedb7('0xa')](_0xedb7('0xb'),auth['isAuthenticated'](),controller[_0xedb7('0xc')]);router[_0xedb7('0xd')]('/',auth['isAuthenticated'](),controller[_0xedb7('0xe')]);router[_0xedb7('0xf')]('/:id',auth[_0xedb7('0x8')](),controller[_0xedb7('0x10')]);router[_0xedb7('0x11')](_0xedb7('0xb'),auth['isAuthenticated'](),controller[_0xedb7('0x12')]);module[_0xedb7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6f0054f..b4415a0 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 _0xab3a=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x603641,_0x529e6){var _0x4e6e1b=function(_0x3b8072){while(--_0x3b8072){_0x603641['push'](_0x603641['shift']());}};_0x4e6e1b(++_0x529e6);}(_0xab3a,0x1d3));var _0xaab3=function(_0x57426f,_0x52f0d3){_0x57426f=_0x57426f-0x0;var _0xe15733=_0xab3a[_0x57426f];return _0xe15733;};'use strict';var Sequelize=require(_0xaab3('0x0'));module[_0xaab3('0x1')]={'calldate':{'type':Sequelize[_0xaab3('0x2')],'allowNull':![],'defaultValue':_0xaab3('0x3')},'clid':{'type':Sequelize[_0xaab3('0x4')]},'src':{'type':Sequelize[_0xaab3('0x4')]},'dst':{'type':Sequelize[_0xaab3('0x4')]},'dcontext':{'type':Sequelize[_0xaab3('0x4')]},'channel':{'type':Sequelize[_0xaab3('0x4')]},'dstchannel':{'type':Sequelize[_0xaab3('0x4')]},'lastapp':{'type':Sequelize[_0xaab3('0x4')]},'lastdata':{'type':Sequelize[_0xaab3('0x4')]},'duration':{'type':Sequelize[_0xaab3('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xaab3('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaab3('0x4')]},'userfield':{'type':Sequelize[_0xaab3('0x4')]},'uniqueid':{'type':Sequelize[_0xaab3('0x4')]},'linkedid':{'type':Sequelize[_0xaab3('0x4')]},'sequence':{'type':Sequelize[_0xaab3('0x4')]},'peeraccount':{'type':Sequelize[_0xaab3('0x4')]},'type':{'type':Sequelize[_0xaab3('0x4')]},'tag':{'type':Sequelize[_0xaab3('0x4')]}}; \ No newline at end of file +var _0xb226=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xb226,0x11c));var _0x6b22=function(_0x1d790b,_0x218767){_0x1d790b=_0x1d790b-0x0;var _0x4880e5=_0xb226[_0x1d790b];return _0x4880e5;};'use strict';var Sequelize=require(_0x6b22('0x0'));module[_0x6b22('0x1')]={'calldate':{'type':Sequelize[_0x6b22('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x6b22('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x6b22('0x3')]},'dcontext':{'type':Sequelize[_0x6b22('0x3')]},'channel':{'type':Sequelize[_0x6b22('0x3')]},'dstchannel':{'type':Sequelize[_0x6b22('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6b22('0x3')]},'duration':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6b22('0x3')]},'amaflags':{'type':Sequelize[_0x6b22('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6b22('0x3')]},'userfield':{'type':Sequelize[_0x6b22('0x3')]},'uniqueid':{'type':Sequelize[_0x6b22('0x3')]},'linkedid':{'type':Sequelize[_0x6b22('0x3')]},'sequence':{'type':Sequelize[_0x6b22('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6b22('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 65e7625..d207570 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 _0x86f4=['bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1daed9,_0xa4075e){var _0x37b134=function(_0x260e8f){while(--_0x260e8f){_0x1daed9['push'](_0x1daed9['shift']());}};_0x37b134(++_0xa4075e);}(_0x86f4,0x18a));var _0x486f=function(_0x2814f3,_0x593a48){_0x2814f3=_0x2814f3-0x0;var _0x3a38e3=_0x86f4[_0x2814f3];return _0x3a38e3;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['Cdr'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['Cdr'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file +var _0xb458=['reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Cdr','includeAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x422f6f,_0x1ffe7c){var _0x5564f6=function(_0x4488a6){while(--_0x4488a6){_0x422f6f['push'](_0x422f6f['shift']());}};_0x5564f6(++_0x1ffe7c);}(_0xb458,0x103));var _0x8b45=function(_0x31600c,_0x16295b){_0x31600c=_0x31600c-0x0;var _0x295cc1=_0xb458[_0x31600c];return _0x295cc1;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];function respondWithStatusCode(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xcc;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0x16')](_0x52c4db);}return _0x37c220[_0x8b45('0x17')](_0x52c4db)[_0x8b45('0x18')]();};}function respondWithResult(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0xc8;return function(_0x5f0b20){if(_0x5f0b20){return _0x32babc['status'](_0x2ad2ae)[_0x8b45('0x19')](_0x5f0b20);}};}function respondWithFilteredResult(_0x23f1dd,_0x445170){return function(_0x39c1d1){if(_0x39c1d1){var _0x4781d7=typeof _0x445170[_0x8b45('0x1a')]===_0x8b45('0x1b')&&typeof _0x445170[_0x8b45('0x1c')]===_0x8b45('0x1b');var _0x391d1e=_0x39c1d1[_0x8b45('0x1d')];var _0x21d5b2=_0x4781d7?0x0:_0x445170[_0x8b45('0x1a')];var _0x43ffb7=_0x4781d7?_0x39c1d1[_0x8b45('0x1d')]:_0x445170[_0x8b45('0x1a')]+_0x445170[_0x8b45('0x1c')];var _0x309e23;if(_0x43ffb7>=_0x391d1e){_0x43ffb7=_0x391d1e;_0x309e23=0xc8;}else{_0x309e23=0xce;}_0x23f1dd['status'](_0x309e23);return _0x23f1dd[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x21d5b2+'-'+_0x43ffb7+'/'+_0x391d1e)[_0x8b45('0x19')](_0x39c1d1);}return null;};}function patchUpdates(_0x46e21a){return function(_0x3e1438){try{jsonpatch[_0x8b45('0x20')](_0x3e1438,_0x46e21a,!![]);}catch(_0x2f4f1c){return BPromise[_0x8b45('0x21')](_0x2f4f1c);}return _0x3e1438['save']();};}function saveUpdates(_0x52f93f,_0x41154a){return function(_0x580e17){if(_0x580e17){return _0x580e17[_0x8b45('0x22')](_0x52f93f)[_0x8b45('0x23')](function(_0x30f405){return _0x30f405;});}return null;};}function removeEntity(_0x45e2db,_0x165570){return function(_0x2b8526){if(_0x2b8526){return _0x2b8526[_0x8b45('0x24')]()['then'](function(){_0x45e2db['status'](0xcc)[_0x8b45('0x18')]();});}};}function handleEntityNotFound(_0x2c2c06,_0x500044){return function(_0x5723a2){if(!_0x5723a2){_0x2c2c06[_0x8b45('0x16')](0x194);}return _0x5723a2;};}function handleError(_0x32f6f0,_0x2ca2d9){_0x2ca2d9=_0x2ca2d9||0x1f4;return function(_0x2f37bc){logger['error'](_0x2f37bc[_0x8b45('0x25')]);if(_0x2f37bc[_0x8b45('0x26')]){delete _0x2f37bc[_0x8b45('0x26')];}_0x32f6f0[_0x8b45('0x17')](_0x2ca2d9)[_0x8b45('0x27')](_0x2f37bc);};}exports[_0x8b45('0x28')]=function(_0x461017,_0x234f62){var _0x1733a7={},_0xf21bd1={},_0x339c73={'count':0x0,'rows':[]};var _0x1ba2d4=_[_0x8b45('0x29')](db['Cdr'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x29')](_0x1ba2d4,_0x8b45('0x26'));_0xf21bd1['query']=_[_0x8b45('0x2f')](_0x461017[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7[_0x8b45('0x33')]=_['intersection'](_0xf21bd1['model'],qs[_0x8b45('0x34')](_0x461017[_0x8b45('0x30')][_0x8b45('0x34')]));_0x1733a7[_0x8b45('0x33')]=_0x1733a7[_0x8b45('0x33')][_0x8b45('0x35')]?_0x1733a7['attributes']:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x30')][_0x8b45('0x36')](_0x8b45('0x37'))){_0x1733a7['limit']=qs[_0x8b45('0x1c')](_0x461017[_0x8b45('0x30')][_0x8b45('0x1c')]);_0x1733a7['offset']=qs[_0x8b45('0x1a')](_0x461017[_0x8b45('0x30')][_0x8b45('0x1a')]);}_0x1733a7['order']=qs[_0x8b45('0x38')](_0x461017[_0x8b45('0x30')][_0x8b45('0x38')]);_0x1733a7[_0x8b45('0x39')]=qs['filters'](_[_0x8b45('0x3a')](_0x461017[_0x8b45('0x30')],_0xf21bd1[_0x8b45('0x31')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x30')][_0x8b45('0x3b')]){_0x1733a7[_0x8b45('0x39')]=_['merge'](_0x1733a7['where'],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x179f3b){if(_0x179f3b[_0x8b45('0x2c')]!==_0x8b45('0x3c')){var _0x23eb2e={};_0x23eb2e[_0x179f3b['name']]={'$like':'%'+_0x461017[_0x8b45('0x30')]['filter']+'%'};return _0x23eb2e;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3e')]);var _0x5fae26={'where':_0x1733a7[_0x8b45('0x39')]};return db[_0x8b45('0x3f')][_0x8b45('0x1d')](_0x5fae26)[_0x8b45('0x23')](function(_0x1e9d50){_0x339c73[_0x8b45('0x1d')]=_0x1e9d50;if(_0x461017[_0x8b45('0x30')][_0x8b45('0x40')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x3f')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x4eda71){_0x339c73[_0x8b45('0x41')]=_0x4eda71;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x42')](handleError(_0x234f62,null));};exports[_0x8b45('0x43')]=function(_0x454cbc,_0x2770bc){var _0x58e663={'raw':!![],'where':{'id':_0x454cbc['params']['id']}},_0x6fbca4={};_0x6fbca4['model']=_[_0x8b45('0x2f')](db[_0x8b45('0x3f')][_0x8b45('0x2a')]);_0x6fbca4['query']=_[_0x8b45('0x2f')](_0x454cbc['query']);_0x6fbca4[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x6fbca4[_0x8b45('0x2e')],_0x6fbca4[_0x8b45('0x30')]);_0x58e663[_0x8b45('0x33')]=_[_0x8b45('0x32')](_0x6fbca4['model'],qs[_0x8b45('0x34')](_0x454cbc[_0x8b45('0x30')][_0x8b45('0x34')]));_0x58e663[_0x8b45('0x33')]=_0x58e663[_0x8b45('0x33')][_0x8b45('0x35')]?_0x58e663[_0x8b45('0x33')]:_0x6fbca4[_0x8b45('0x2e')];if(_0x454cbc[_0x8b45('0x30')][_0x8b45('0x40')]){_0x58e663[_0x8b45('0x44')]=[{'all':!![]}];}_0x58e663=_[_0x8b45('0x3d')]({},_0x58e663,_0x454cbc[_0x8b45('0x3e')]);return db[_0x8b45('0x3f')][_0x8b45('0x45')](_0x58e663)[_0x8b45('0x23')](handleEntityNotFound(_0x2770bc,null))['then'](respondWithResult(_0x2770bc,null))['catch'](handleError(_0x2770bc,null));};exports['create']=function(_0x308b0d,_0x214e28){return db[_0x8b45('0x3f')][_0x8b45('0x46')](_0x308b0d[_0x8b45('0x47')],{})[_0x8b45('0x23')](respondWithResult(_0x214e28,0xc9))[_0x8b45('0x42')](handleError(_0x214e28,null));};exports[_0x8b45('0x22')]=function(_0x5e2a03,_0x102d01){if(_0x5e2a03['body']['id']){delete _0x5e2a03[_0x8b45('0x47')]['id'];}return db[_0x8b45('0x3f')][_0x8b45('0x45')]({'where':{'id':_0x5e2a03[_0x8b45('0x48')]['id']}})['then'](handleEntityNotFound(_0x102d01,null))[_0x8b45('0x23')](saveUpdates(_0x5e2a03[_0x8b45('0x47')],null))['then'](respondWithResult(_0x102d01,null))[_0x8b45('0x42')](handleError(_0x102d01,null));};exports[_0x8b45('0x24')]=function(_0x52970c,_0xceb596){return db[_0x8b45('0x3f')][_0x8b45('0x45')]({'where':{'id':_0x52970c[_0x8b45('0x48')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0xceb596,null))[_0x8b45('0x23')](removeEntity(_0xceb596,null))['catch'](handleError(_0xceb596,null));};exports['describe']=function(_0x3f7a16,_0x2a2e59){return db[_0x8b45('0x3f')]['describe']()[_0x8b45('0x23')](respondWithResult(_0x2a2e59,null))[_0x8b45('0x42')](handleError(_0x2a2e59,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f3180c8..81a6ba9 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x592f08,_0x25c7b6){var _0x4cd8fb=function(_0x5887b1){while(--_0x5887b1){_0x592f08['push'](_0x592f08['shift']());}};_0x4cd8fb(++_0x25c7b6);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x488723,_0x1bba3b){var _0x517a0c=function(_0x186eae){while(--_0x186eae){_0x488723['push'](_0x488723['shift']());}};_0x517a0c(++_0x1bba3b);}(_0x7a54,0x106));var _0x47a5=function(_0x4acff3,_0x5bc3e9){_0x4acff3=_0x4acff3-0x0;var _0x21f9b1=_0x7a54[_0x4acff3];return _0x21f9b1;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 4827642..a11a185 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 _0xcece=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x11b502,_0x3b3f9){var _0x532480=function(_0x1b55a7){while(--_0x1b55a7){_0x11b502['push'](_0x11b502['shift']());}};_0x532480(++_0x3b3f9);}(_0xcece,0x12f));var _0xecec=function(_0x385329,_0x4fbae6){_0x385329=_0x385329-0x0;var _0x2d88dc=_0xcece[_0x385329];return _0x2d88dc;};'use strict';var _=require(_0xecec('0x0'));var util=require('util');var moment=require(_0xecec('0x1'));var BPromise=require(_0xecec('0x2'));var rs=require(_0xecec('0x3'));var fs=require('fs');var Redis=require(_0xecec('0x4'));var db=require(_0xecec('0x5'))['db'];var utils=require(_0xecec('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xecec('0x7'));var jayson=require(_0xecec('0x8'));var client=jayson['client'][_0xecec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e3568,_0x2dd0f1,_0x58886a){return new BPromise(function(_0x1f51fa,_0x575e64){return client[_0xecec('0xa')](_0x3e3568,_0x58886a)[_0xecec('0xb')](function(_0x4ba43a){logger[_0xecec('0xc')](_0xecec('0xd'),_0x2dd0f1,_0xecec('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x2dd0f1,_0xecec('0xe'),JSON['stringify'](_0x4ba43a));if(_0x4ba43a['error']){if(_0x4ba43a[_0xecec('0xf')]['code']===0x1f4){logger['error'](_0xecec('0xd'),_0x2dd0f1,_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);return _0x575e64(_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);}logger[_0xecec('0xf')](_0xecec('0xd'),_0x2dd0f1,_0x4ba43a['error'][_0xecec('0x10')]);return _0x1f51fa(_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x2dd0f1,_0xecec('0xe'));_0x1f51fa(_0x4ba43a[_0xecec('0x11')][_0xecec('0x10')]);}})[_0xecec('0x12')](function(_0x158312){logger['error'](_0xecec('0xd'),_0x2dd0f1,_0x158312);_0x575e64(_0x158312);});});} \ No newline at end of file +var _0x093e=['../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x093e,0x149));var _0xe093=function(_0x13ec46,_0x44efb1){_0x13ec46=_0x13ec46-0x0;var _0x17ab99=_0x093e[_0x13ec46];return _0x17ab99;};'use strict';var _=require(_0xe093('0x0'));var util=require(_0xe093('0x1'));var moment=require(_0xe093('0x2'));var BPromise=require(_0xe093('0x3'));var rs=require(_0xe093('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe093('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe093('0x6'))('rpc');var config=require(_0xe093('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe093('0x8')][_0xe093('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x358381,_0x239097,_0x21cfc3){return new BPromise(function(_0x2c59f3,_0x2f0ea9){return client[_0xe093('0xa')](_0x358381,_0x21cfc3)[_0xe093('0xb')](function(_0x45e7bb){logger[_0xe093('0xc')](_0xe093('0xd'),_0x239097,'request\x20sent');logger['debug'](_0xe093('0xe'),_0x239097,'request\x20sent',JSON[_0xe093('0xf')](_0x45e7bb));if(_0x45e7bb[_0xe093('0x10')]){if(_0x45e7bb[_0xe093('0x10')][_0xe093('0x11')]===0x1f4){logger[_0xe093('0x10')](_0xe093('0xd'),_0x239097,_0x45e7bb[_0xe093('0x10')][_0xe093('0x12')]);return _0x2f0ea9(_0x45e7bb[_0xe093('0x10')][_0xe093('0x12')]);}logger['error'](_0xe093('0xd'),_0x239097,_0x45e7bb[_0xe093('0x10')][_0xe093('0x12')]);return _0x2c59f3(_0x45e7bb[_0xe093('0x10')][_0xe093('0x12')]);}else{logger[_0xe093('0xc')](_0xe093('0xd'),_0x239097,_0xe093('0x13'));_0x2c59f3(_0x45e7bb['result'][_0xe093('0x12')]);}})[_0xe093('0x14')](function(_0x3b943c){logger[_0xe093('0x10')]('Cdr,\x20%s,\x20%s',_0x239097,_0x3b943c);_0x2f0ea9(_0x3b943c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8e7c34a..82601da 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b30e1,_0x5989e0){var _0xa082ed=function(_0x502150){while(--_0x502150){_0x2b30e1['push'](_0x2b30e1['shift']());}};_0xa082ed(++_0x5989e0);}(_0xb10b,0x12a));var _0xbb10=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xb10b[_0x27650e];return _0x28fe08;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2c1859,_0x1a3db0){var _0x3663aa=function(_0x3bd0d1){while(--_0x3bd0d1){_0x2c1859['push'](_0x2c1859['shift']());}};_0x3663aa(++_0x1a3db0);}(_0xb10b,0x12a));var _0xbb10=function(_0x98ac1f,_0x2effb0){_0x98ac1f=_0x98ac1f-0x0;var _0x1579d1=_0xb10b[_0x98ac1f];return _0x1579d1;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 1c21c6e..757ca82 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 _0xb492=['STRING','noop','TEXT','*,*,*,*'];(function(_0x36c8c6,_0x527c52){var _0x45c1e0=function(_0x41daf3){while(--_0x41daf3){_0x36c8c6['push'](_0x36c8c6['shift']());}};_0x45c1e0(++_0x527c52);}(_0xb492,0x8c));var _0x2b49=function(_0x26f451,_0x11a72e){_0x26f451=_0x26f451-0x0;var _0x342138=_0xb492[_0x26f451];return _0x342138;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2b49('0x0')],'allowNull':![],'defaultValue':_0x2b49('0x1')},'appdata':{'type':Sequelize[_0x2b49('0x2')]()},'description':{'type':Sequelize[_0x2b49('0x0')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2b49('0x3')}}; \ No newline at end of file +var _0x4f9e=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x332026,_0x16c26f){var _0x34064d=function(_0x5e57ef){while(--_0x5e57ef){_0x332026['push'](_0x332026['shift']());}};_0x34064d(++_0x16c26f);}(_0x4f9e,0x99));var _0xe4f9=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4f9e[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0xe4f9('0x0'));module[_0xe4f9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe4f9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe4f9('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe4f9('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2824979..66b19df 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 _0x7e05=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','save','update','then','destroy','error','name','send','params','keys','ChatApplication','query','filters','model','attributes','intersection','fields','includeAll','include','merge','find','catch','body','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x1cbf75,_0x325719){var _0xe8aec9=function(_0x1af7ec){while(--_0x1af7ec){_0x1cbf75['push'](_0x1cbf75['shift']());}};_0xe8aec9(++_0x325719);}(_0x7e05,0x69));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x57e0('0x0'));var rimraf=require(_0x57e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57e0('0x2'));var rp=require('request-promise');var moment=require(_0x57e0('0x3'));var BPromise=require(_0x57e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57e0('0x5'));var sox=require(_0x57e0('0x6'));var csv=require(_0x57e0('0x7'));var ejs=require(_0x57e0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57e0('0x9'));var squel=require('squel');var crypto=require(_0x57e0('0xa'));var jsforce=require(_0x57e0('0xb'));var deskjs=require(_0x57e0('0xc'));var toCsv=require(_0x57e0('0x7'));var querystring=require(_0x57e0('0xd'));var Papa=require(_0x57e0('0xe'));var Redis=require(_0x57e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x57e0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57e0('0x11'));var logger=require('../../config/logger')(_0x57e0('0x12'));var utils=require(_0x57e0('0x13'));var config=require(_0x57e0('0x14'));var licenseUtil=require(_0x57e0('0x15'));var db=require(_0x57e0('0x16'))['db'];function respondWithStatusCode(_0x254141,_0x142d1f){_0x142d1f=_0x142d1f||0xcc;return function(_0x114d14){if(_0x114d14){return _0x254141[_0x57e0('0x17')](_0x142d1f);}return _0x254141['status'](_0x142d1f)[_0x57e0('0x18')]();};}function respondWithResult(_0x1ed2c1,_0x4a4562){_0x4a4562=_0x4a4562||0xc8;return function(_0x32babd){if(_0x32babd){return _0x1ed2c1['status'](_0x4a4562)[_0x57e0('0x19')](_0x32babd);}};}function respondWithFilteredResult(_0x3797e2,_0x746a9d){return function(_0x2e0beb){if(_0x2e0beb){var _0x304ec4=typeof _0x746a9d['offset']===_0x57e0('0x1a')&&typeof _0x746a9d[_0x57e0('0x1b')]===_0x57e0('0x1a');var _0x22c344=_0x2e0beb[_0x57e0('0x1c')];var _0x52cf5a=_0x304ec4?0x0:_0x746a9d[_0x57e0('0x1d')];var _0x2500ea=_0x304ec4?_0x2e0beb[_0x57e0('0x1c')]:_0x746a9d[_0x57e0('0x1d')]+_0x746a9d[_0x57e0('0x1b')];var _0x1f5dce;if(_0x2500ea>=_0x22c344){_0x2500ea=_0x22c344;_0x1f5dce=0xc8;}else{_0x1f5dce=0xce;}_0x3797e2[_0x57e0('0x1e')](_0x1f5dce);return _0x3797e2['set'](_0x57e0('0x1f'),_0x52cf5a+'-'+_0x2500ea+'/'+_0x22c344)[_0x57e0('0x19')](_0x2e0beb);}return null;};}function patchUpdates(_0x2007ff){return function(_0x3814a3){try{jsonpatch['apply'](_0x3814a3,_0x2007ff,!![]);}catch(_0x143e51){return BPromise[_0x57e0('0x20')](_0x143e51);}return _0x3814a3[_0x57e0('0x21')]();};}function saveUpdates(_0x3bc1c0,_0x5d83c6){return function(_0xc5b15){if(_0xc5b15){return _0xc5b15[_0x57e0('0x22')](_0x3bc1c0)[_0x57e0('0x23')](function(_0x4dbdc7){return _0x4dbdc7;});}return null;};}function removeEntity(_0x595696,_0x44e84c){return function(_0x3a6a14){if(_0x3a6a14){return _0x3a6a14[_0x57e0('0x24')]()[_0x57e0('0x23')](function(){_0x595696[_0x57e0('0x1e')](0xcc)[_0x57e0('0x18')]();});}};}function handleEntityNotFound(_0x46fff4,_0x257e51){return function(_0x34b9a4){if(!_0x34b9a4){_0x46fff4['sendStatus'](0x194);}return _0x34b9a4;};}function handleError(_0x3a3047,_0x541c24){_0x541c24=_0x541c24||0x1f4;return function(_0x12a4ec){logger[_0x57e0('0x25')](_0x12a4ec['stack']);if(_0x12a4ec[_0x57e0('0x26')]){delete _0x12a4ec[_0x57e0('0x26')];}_0x3a3047['status'](_0x541c24)[_0x57e0('0x27')](_0x12a4ec);};}exports['show']=function(_0x5d06bc,_0x1a5402){var _0x1b7d9c={'raw':!![],'where':{'id':_0x5d06bc[_0x57e0('0x28')]['id']}},_0x2cef3e={};_0x2cef3e['model']=_[_0x57e0('0x29')](db[_0x57e0('0x2a')]['rawAttributes']);_0x2cef3e['query']=_['keys'](_0x5d06bc[_0x57e0('0x2b')]);_0x2cef3e[_0x57e0('0x2c')]=_['intersection'](_0x2cef3e[_0x57e0('0x2d')],_0x2cef3e[_0x57e0('0x2b')]);_0x1b7d9c[_0x57e0('0x2e')]=_[_0x57e0('0x2f')](_0x2cef3e['model'],qs[_0x57e0('0x30')](_0x5d06bc[_0x57e0('0x2b')]['fields']));_0x1b7d9c['attributes']=_0x1b7d9c['attributes']['length']?_0x1b7d9c['attributes']:_0x2cef3e[_0x57e0('0x2d')];if(_0x5d06bc[_0x57e0('0x2b')][_0x57e0('0x31')]){_0x1b7d9c[_0x57e0('0x32')]=[{'all':!![]}];}_0x1b7d9c=_[_0x57e0('0x33')]({},_0x1b7d9c,_0x5d06bc['options']);return db['ChatApplication'][_0x57e0('0x34')](_0x1b7d9c)[_0x57e0('0x23')](handleEntityNotFound(_0x1a5402,null))[_0x57e0('0x23')](respondWithResult(_0x1a5402,null))[_0x57e0('0x35')](handleError(_0x1a5402,null));};exports[_0x57e0('0x22')]=function(_0x1e1b90,_0x267d30){if(_0x1e1b90[_0x57e0('0x36')]['id']){delete _0x1e1b90[_0x57e0('0x36')]['id'];}return db[_0x57e0('0x2a')][_0x57e0('0x34')]({'where':{'id':_0x1e1b90['params']['id']}})[_0x57e0('0x23')](handleEntityNotFound(_0x267d30,null))[_0x57e0('0x23')](saveUpdates(_0x1e1b90['body'],null))['then'](respondWithResult(_0x267d30,null))[_0x57e0('0x35')](handleError(_0x267d30,null));};exports['destroy']=function(_0x24b74f,_0x3ae7be){return db['ChatApplication']['find']({'where':{'id':_0x24b74f[_0x57e0('0x28')]['id']}})[_0x57e0('0x23')](handleEntityNotFound(_0x3ae7be,null))[_0x57e0('0x23')](removeEntity(_0x3ae7be,null))[_0x57e0('0x35')](handleError(_0x3ae7be,null));}; \ No newline at end of file +var _0xc7ea=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','name','send','show','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch'];(function(_0x55e5cb,_0x3d0213){var _0x4a8ea1=function(_0xab0a29){while(--_0xab0a29){_0x55e5cb['push'](_0x55e5cb['shift']());}};_0x4a8ea1(++_0x3d0213);}(_0xc7ea,0x171));var _0xac7e=function(_0x562cc9,_0x1cb01e){_0x562cc9=_0x562cc9-0x0;var _0x5ddbf8=_0xc7ea[_0x562cc9];return _0x5ddbf8;};'use strict';var emlformat=require(_0xac7e('0x0'));var rimraf=require(_0xac7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7e('0x2'));var rp=require(_0xac7e('0x3'));var moment=require(_0xac7e('0x4'));var BPromise=require(_0xac7e('0x5'));var Mustache=require('mustache');var util=require(_0xac7e('0x6'));var path=require(_0xac7e('0x7'));var sox=require(_0xac7e('0x8'));var csv=require(_0xac7e('0x9'));var ejs=require(_0xac7e('0xa'));var fs=require('fs');var fs_extra=require(_0xac7e('0xb'));var _=require(_0xac7e('0xc'));var squel=require(_0xac7e('0xd'));var crypto=require(_0xac7e('0xe'));var jsforce=require(_0xac7e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xac7e('0x9'));var querystring=require(_0xac7e('0x10'));var Papa=require(_0xac7e('0x11'));var Redis=require(_0xac7e('0x12'));var authService=require(_0xac7e('0x13'));var qs=require(_0xac7e('0x14'));var as=require(_0xac7e('0x15'));var hardwareService=require(_0xac7e('0x16'));var logger=require(_0xac7e('0x17'))(_0xac7e('0x18'));var utils=require(_0xac7e('0x19'));var config=require(_0xac7e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xac7e('0x1b'))['db'];function respondWithStatusCode(_0x13e126,_0x5d4537){_0x5d4537=_0x5d4537||0xcc;return function(_0x617cf9){if(_0x617cf9){return _0x13e126[_0xac7e('0x1c')](_0x5d4537);}return _0x13e126[_0xac7e('0x1d')](_0x5d4537)[_0xac7e('0x1e')]();};}function respondWithResult(_0x31a8e7,_0x52be09){_0x52be09=_0x52be09||0xc8;return function(_0x3486ac){if(_0x3486ac){return _0x31a8e7[_0xac7e('0x1d')](_0x52be09)[_0xac7e('0x1f')](_0x3486ac);}};}function respondWithFilteredResult(_0x41c055,_0x333436){return function(_0x232ce5){if(_0x232ce5){var _0x7ee114=typeof _0x333436[_0xac7e('0x20')]==='undefined'&&typeof _0x333436[_0xac7e('0x21')]===_0xac7e('0x22');var _0x95f21c=_0x232ce5[_0xac7e('0x23')];var _0x242889=_0x7ee114?0x0:_0x333436['offset'];var _0x2be7d7=_0x7ee114?_0x232ce5['count']:_0x333436[_0xac7e('0x20')]+_0x333436['limit'];var _0xa048e9;if(_0x2be7d7>=_0x95f21c){_0x2be7d7=_0x95f21c;_0xa048e9=0xc8;}else{_0xa048e9=0xce;}_0x41c055[_0xac7e('0x1d')](_0xa048e9);return _0x41c055[_0xac7e('0x24')](_0xac7e('0x25'),_0x242889+'-'+_0x2be7d7+'/'+_0x95f21c)[_0xac7e('0x1f')](_0x232ce5);}return null;};}function patchUpdates(_0x2ad784){return function(_0x4d23f9){try{jsonpatch[_0xac7e('0x26')](_0x4d23f9,_0x2ad784,!![]);}catch(_0x3c177d){return BPromise['reject'](_0x3c177d);}return _0x4d23f9[_0xac7e('0x27')]();};}function saveUpdates(_0x2ebc78,_0x2c3b6e){return function(_0x3ce3cc){if(_0x3ce3cc){return _0x3ce3cc[_0xac7e('0x28')](_0x2ebc78)[_0xac7e('0x29')](function(_0x45f7b6){return _0x45f7b6;});}return null;};}function removeEntity(_0x57abe8,_0x2b5f43){return function(_0x32ef52){if(_0x32ef52){return _0x32ef52[_0xac7e('0x2a')]()['then'](function(){_0x57abe8['status'](0xcc)[_0xac7e('0x1e')]();});}};}function handleEntityNotFound(_0x1ae3b4,_0x4620da){return function(_0x50b1e5){if(!_0x50b1e5){_0x1ae3b4[_0xac7e('0x1c')](0x194);}return _0x50b1e5;};}function handleError(_0x1de558,_0x2cafcb){_0x2cafcb=_0x2cafcb||0x1f4;return function(_0x3e0f1a){logger['error'](_0x3e0f1a['stack']);if(_0x3e0f1a[_0xac7e('0x2b')]){delete _0x3e0f1a['name'];}_0x1de558['status'](_0x2cafcb)[_0xac7e('0x2c')](_0x3e0f1a);};}exports[_0xac7e('0x2d')]=function(_0x3ecfc1,_0x4864d1){var _0x224259={'raw':!![],'where':{'id':_0x3ecfc1[_0xac7e('0x2e')]['id']}},_0x376247={};_0x376247[_0xac7e('0x2f')]=_['keys'](db[_0xac7e('0x30')][_0xac7e('0x31')]);_0x376247[_0xac7e('0x32')]=_['keys'](_0x3ecfc1[_0xac7e('0x32')]);_0x376247[_0xac7e('0x33')]=_[_0xac7e('0x34')](_0x376247[_0xac7e('0x2f')],_0x376247['query']);_0x224259[_0xac7e('0x35')]=_['intersection'](_0x376247[_0xac7e('0x2f')],qs[_0xac7e('0x36')](_0x3ecfc1[_0xac7e('0x32')]['fields']));_0x224259[_0xac7e('0x35')]=_0x224259[_0xac7e('0x35')]['length']?_0x224259['attributes']:_0x376247[_0xac7e('0x2f')];if(_0x3ecfc1[_0xac7e('0x32')][_0xac7e('0x37')]){_0x224259[_0xac7e('0x38')]=[{'all':!![]}];}_0x224259=_[_0xac7e('0x39')]({},_0x224259,_0x3ecfc1[_0xac7e('0x3a')]);return db[_0xac7e('0x30')][_0xac7e('0x3b')](_0x224259)[_0xac7e('0x29')](handleEntityNotFound(_0x4864d1,null))['then'](respondWithResult(_0x4864d1,null))[_0xac7e('0x3c')](handleError(_0x4864d1,null));};exports[_0xac7e('0x28')]=function(_0x1e3cc4,_0x38d61e){if(_0x1e3cc4[_0xac7e('0x3d')]['id']){delete _0x1e3cc4[_0xac7e('0x3d')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x1e3cc4[_0xac7e('0x2e')]['id']}})[_0xac7e('0x29')](handleEntityNotFound(_0x38d61e,null))[_0xac7e('0x29')](saveUpdates(_0x1e3cc4[_0xac7e('0x3d')],null))[_0xac7e('0x29')](respondWithResult(_0x38d61e,null))[_0xac7e('0x3c')](handleError(_0x38d61e,null));};exports[_0xac7e('0x2a')]=function(_0x2160cd,_0xacc6b9){return db['ChatApplication'][_0xac7e('0x3b')]({'where':{'id':_0x2160cd[_0xac7e('0x2e')]['id']}})['then'](handleEntityNotFound(_0xacc6b9,null))[_0xac7e('0x29')](removeEntity(_0xacc6b9,null))[_0xac7e('0x3c')](handleError(_0xacc6b9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7fad744..042c636 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 _0xfd25=['utf8mb4','lodash','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xfd25,0x169));var _0x5fd2=function(_0x4b31ea,_0x4dbc5f){_0x4b31ea=_0x4b31ea-0x0;var _0x3bb0f5=_0xfd25[_0x4b31ea];return _0x3bb0f5;};'use strict';var _=require(_0x5fd2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5fd2('0x1'));var moment=require(_0x5fd2('0x2'));var BPromise=require(_0x5fd2('0x3'));var rp=require(_0x5fd2('0x4'));var fs=require('fs');var path=require(_0x5fd2('0x5'));var rimraf=require(_0x5fd2('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fd2('0x7'));module[_0x5fd2('0x8')]=function(_0x31ddb3,_0xbee3e){return _0x31ddb3[_0x5fd2('0x9')]('ChatApplication',attributes,{'tableName':_0x5fd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5fd2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x42cf=['moment','request-promise','rimraf','../../config/environment','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x42cf,0x11f));var _0xf42c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x42cf[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xf42c('0x0'));var util=require(_0xf42c('0x1'));var logger=require('../../config/logger')(_0xf42c('0x2'));var moment=require(_0xf42c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf42c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf42c('0x5'));var config=require(_0xf42c('0x6'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x1cb366,_0x51292c){return _0x1cb366[_0xf42c('0x7')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf42c('0x8'),'collate':_0xf42c('0x9')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b02491a..ae91ace 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 _0x6491=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x6491,0x10f));var _0x1649=function(_0x3856a9,_0x59ed19){_0x3856a9=_0x3856a9-0x0;var _0x541756=_0x6491[_0x3856a9];return _0x541756;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1649('0x0'));var BPromise=require(_0x1649('0x1'));var rs=require(_0x1649('0x2'));var fs=require('fs');var Redis=require(_0x1649('0x3'));var db=require(_0x1649('0x4'))['db'];var utils=require(_0x1649('0x5'));var logger=require(_0x1649('0x6'))(_0x1649('0x7'));var config=require(_0x1649('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1649('0x9')][_0x1649('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f62e,_0x25d8de,_0x16b1eb){return new BPromise(function(_0x40fe4d,_0x18bd9d){return client[_0x1649('0xb')](_0x39f62e,_0x16b1eb)[_0x1649('0xc')](function(_0x15d87e){logger['info'](_0x1649('0xd'),_0x25d8de,'request\x20sent');logger[_0x1649('0xe')](_0x1649('0xf'),_0x25d8de,_0x1649('0x10'),JSON['stringify'](_0x15d87e));if(_0x15d87e[_0x1649('0x11')]){if(_0x15d87e[_0x1649('0x11')][_0x1649('0x12')]===0x1f4){logger[_0x1649('0x11')](_0x1649('0xd'),_0x25d8de,_0x15d87e[_0x1649('0x11')][_0x1649('0x13')]);return _0x18bd9d(_0x15d87e['error'][_0x1649('0x13')]);}logger[_0x1649('0x11')]('ChatApplication,\x20%s,\x20%s',_0x25d8de,_0x15d87e[_0x1649('0x11')][_0x1649('0x13')]);return _0x40fe4d(_0x15d87e[_0x1649('0x11')]['message']);}else{logger['info'](_0x1649('0xd'),_0x25d8de,_0x1649('0x10'));_0x40fe4d(_0x15d87e['result']['message']);}})[_0x1649('0x14')](function(_0x143980){logger[_0x1649('0x11')](_0x1649('0xd'),_0x25d8de,_0x143980);_0x18bd9d(_0x143980);});});} \ No newline at end of file +var _0xb8b6=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x6e420a,_0x2b93e2){var _0x115b00=function(_0x13e07a){while(--_0x13e07a){_0x6e420a['push'](_0x6e420a['shift']());}};_0x115b00(++_0x2b93e2);}(_0xb8b6,0x107));var _0x6b8b=function(_0x71d4a,_0x275eb3){_0x71d4a=_0x71d4a-0x0;var _0x1bff75=_0xb8b6[_0x71d4a];return _0x1bff75;};'use strict';var _=require('lodash');var util=require(_0x6b8b('0x0'));var moment=require(_0x6b8b('0x1'));var BPromise=require(_0x6b8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b8b('0x3'));var db=require(_0x6b8b('0x4'))['db'];var utils=require(_0x6b8b('0x5'));var logger=require('../../config/logger')(_0x6b8b('0x6'));var config=require(_0x6b8b('0x7'));var jayson=require(_0x6b8b('0x8'));var client=jayson[_0x6b8b('0x9')][_0x6b8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x342902,_0x1e9725,_0x4d2ab4){return new BPromise(function(_0x483e12,_0x2fcc5e){return client[_0x6b8b('0xb')](_0x342902,_0x4d2ab4)['then'](function(_0x5b890c){logger[_0x6b8b('0xc')](_0x6b8b('0xd'),_0x1e9725,_0x6b8b('0xe'));logger[_0x6b8b('0xf')](_0x6b8b('0x10'),_0x1e9725,'request\x20sent',JSON[_0x6b8b('0x11')](_0x5b890c));if(_0x5b890c[_0x6b8b('0x12')]){if(_0x5b890c[_0x6b8b('0x12')][_0x6b8b('0x13')]===0x1f4){logger[_0x6b8b('0x12')]('ChatApplication,\x20%s,\x20%s',_0x1e9725,_0x5b890c[_0x6b8b('0x12')]['message']);return _0x2fcc5e(_0x5b890c[_0x6b8b('0x12')][_0x6b8b('0x14')]);}logger[_0x6b8b('0x12')](_0x6b8b('0xd'),_0x1e9725,_0x5b890c['error'][_0x6b8b('0x14')]);return _0x483e12(_0x5b890c[_0x6b8b('0x12')]['message']);}else{logger[_0x6b8b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1e9725,'request\x20sent');_0x483e12(_0x5b890c[_0x6b8b('0x15')][_0x6b8b('0x14')]);}})['catch'](function(_0x5c9662){logger[_0x6b8b('0x12')](_0x6b8b('0xd'),_0x1e9725,_0x5c9662);_0x2fcc5e(_0x5c9662);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6a8a66e..6cc1a2e 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 _0x67ca=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','path','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x67ca,0x78));var _0xa67c=function(_0x13d90d,_0x12b0f7){_0x13d90d=_0x13d90d-0x0;var _0x84bc48=_0x67ca[_0x13d90d];return _0x84bc48;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa67c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa67c('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa67c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa67c('0x3'));var controller=require(_0xa67c('0x4'));router[_0xa67c('0x5')](_0xa67c('0x6'),auth[_0xa67c('0x7')](),controller[_0xa67c('0x8')]);router[_0xa67c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa67c('0xa')]);router[_0xa67c('0xb')](_0xa67c('0x6'),auth[_0xa67c('0x7')](),controller[_0xa67c('0xc')]);module[_0xa67c('0xd')]=router; \ No newline at end of file +var _0x200b=['Router','fs-extra','../../components/interaction/service','get','isAuthenticated','show','put','update','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x200b,0x173));var _0xb200=function(_0x4e28db,_0x4ab3b5){_0x4e28db=_0x4e28db-0x0;var _0x5b4e65=_0x200b[_0x4e28db];return _0x5b4e65;};'use strict';var multer=require(_0xb200('0x0'));var util=require(_0xb200('0x1'));var path=require('path');var timeout=require(_0xb200('0x2'));var express=require(_0xb200('0x3'));var router=express[_0xb200('0x4')]();var fs_extra=require(_0xb200('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb200('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xb200('0x7')]('/:id',auth[_0xb200('0x8')](),controller[_0xb200('0x9')]);router[_0xb200('0xa')]('/:id',auth[_0xb200('0x8')](),controller[_0xb200('0xb')]);router['delete'](_0xb200('0xc'),auth['isAuthenticated'](),controller[_0xb200('0xd')]);module[_0xb200('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 367ec4e..c9f272b 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 _0x287f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x35468d,_0x2a7240){var _0x30da52=function(_0xd9d2f){while(--_0xd9d2f){_0x35468d['push'](_0x35468d['shift']());}};_0x30da52(++_0x2a7240);}(_0x287f,0xc7));var _0xf287=function(_0x14080c,_0x485b3){_0x14080c=_0x14080c-0x0;var _0x254794=_0x287f[_0x14080c];return _0x254794;};'use strict';var Sequelize=require(_0xf287('0x0'));module[_0xf287('0x1')]={'name':{'type':Sequelize[_0xf287('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf287('0x2')]},'write':{'type':Sequelize[_0xf287('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b84=['exports','STRING','sequelize'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x7b84,0x167));var _0x47b8=function(_0x4e3a9c,_0x421cf8){_0x4e3a9c=_0x4e3a9c-0x0;var _0x116527=_0x7b84[_0x4e3a9c];return _0x116527;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')],'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 0367a10..2197c9f 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 _0x049d=['./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','findOne','User','filter','getMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x44b454,_0xd8d71d){var _0x1e6eef=function(_0x232acd){while(--_0x232acd){_0x44b454['push'](_0x44b454['shift']());}};_0x1e6eef(++_0xd8d71d);}(_0x049d,0xa8));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd049('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd049('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd049('0x2'));var moment=require('moment');var BPromise=require(_0xd049('0x3'));var Mustache=require('mustache');var util=require(_0xd049('0x4'));var path=require(_0xd049('0x5'));var sox=require('sox');var csv=require(_0xd049('0x6'));var ejs=require(_0xd049('0x7'));var fs=require('fs');var fs_extra=require(_0xd049('0x8'));var _=require(_0xd049('0x9'));var squel=require(_0xd049('0xa'));var crypto=require('crypto');var jsforce=require(_0xd049('0xb'));var deskjs=require(_0xd049('0xc'));var toCsv=require(_0xd049('0x6'));var querystring=require(_0xd049('0xd'));var Papa=require(_0xd049('0xe'));var Redis=require('ioredis');var authService=require(_0xd049('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd049('0x10'));var logger=require(_0xd049('0x11'))(_0xd049('0x12'));var utils=require(_0xd049('0x13'));var config=require(_0xd049('0x14'));var licenseUtil=require(_0xd049('0x15'));var db=require(_0xd049('0x16'))['db'];config[_0xd049('0x17')]=_[_0xd049('0x18')](config[_0xd049('0x17')],{'host':_0xd049('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd049('0x17')]));require(_0xd049('0x1a'))[_0xd049('0x1b')](socket);function respondWithStatusCode(_0x2c4a0a,_0x56a771){_0x56a771=_0x56a771||0xcc;return function(_0x33379f){if(_0x33379f){return _0x2c4a0a[_0xd049('0x1c')](_0x56a771);}return _0x2c4a0a[_0xd049('0x1d')](_0x56a771)[_0xd049('0x1e')]();};}function respondWithResult(_0x1bbecd,_0x1b1ee1){_0x1b1ee1=_0x1b1ee1||0xc8;return function(_0x1b37e9){if(_0x1b37e9){return _0x1bbecd[_0xd049('0x1d')](_0x1b1ee1)[_0xd049('0x1f')](_0x1b37e9);}};}function respondWithFilteredResult(_0x15fa72,_0x36c8cf){return function(_0x2baea8){if(_0x2baea8){var _0x49639e=typeof _0x36c8cf[_0xd049('0x20')]===_0xd049('0x21')&&typeof _0x36c8cf['limit']===_0xd049('0x21');var _0x2393ac=_0x2baea8['count'];var _0x96bd17=_0x49639e?0x0:_0x36c8cf[_0xd049('0x20')];var _0xefe906=_0x49639e?_0x2baea8[_0xd049('0x22')]:_0x36c8cf[_0xd049('0x20')]+_0x36c8cf[_0xd049('0x23')];var _0xc772fb;if(_0xefe906>=_0x2393ac){_0xefe906=_0x2393ac;_0xc772fb=0xc8;}else{_0xc772fb=0xce;}_0x15fa72[_0xd049('0x1d')](_0xc772fb);return _0x15fa72[_0xd049('0x24')](_0xd049('0x25'),_0x96bd17+'-'+_0xefe906+'/'+_0x2393ac)['json'](_0x2baea8);}return null;};}function patchUpdates(_0x32b248){return function(_0x136ccd){try{jsonpatch[_0xd049('0x26')](_0x136ccd,_0x32b248,!![]);}catch(_0x128551){return BPromise[_0xd049('0x27')](_0x128551);}return _0x136ccd[_0xd049('0x28')]();};}function saveUpdates(_0x5e67ec,_0x13d02a){return function(_0x8c698f){if(_0x8c698f){return _0x8c698f[_0xd049('0x29')](_0x5e67ec)[_0xd049('0x2a')](function(_0x301c99){return _0x301c99;});}return null;};}function removeEntity(_0x1186be,_0x37f685){return function(_0x30b488){if(_0x30b488){return _0x30b488['destroy']()[_0xd049('0x2a')](function(){_0x1186be[_0xd049('0x1d')](0xcc)[_0xd049('0x1e')]();});}};}function handleEntityNotFound(_0x1f94e7,_0x171759){return function(_0x3ccf5a){if(!_0x3ccf5a){_0x1f94e7[_0xd049('0x1c')](0x194);}return _0x3ccf5a;};}function handleError(_0x441ce6,_0x2499d1){_0x2499d1=_0x2499d1||0x1f4;return function(_0x43b3f3){logger['error'](_0x43b3f3['stack']);if(_0x43b3f3[_0xd049('0x2b')]){delete _0x43b3f3[_0xd049('0x2b')];}_0x441ce6[_0xd049('0x1d')](_0x2499d1)[_0xd049('0x2c')](_0x43b3f3);};}exports['index']=function(_0x1b3f8b,_0x717c00){var _0x280436={},_0x46eb1f={},_0xd7adf8={'count':0x0,'rows':[]};var _0x5a9596=_['map'](db['ChatGroup']['rawAttributes'],function(_0x45835d){return{'name':_0x45835d[_0xd049('0x2d')],'type':_0x45835d[_0xd049('0x2e')][_0xd049('0x2f')]};});_0x46eb1f[_0xd049('0x30')]=_[_0xd049('0x31')](_0x5a9596,_0xd049('0x2b'));_0x46eb1f[_0xd049('0x32')]=_[_0xd049('0x33')](_0x1b3f8b['query']);_0x46eb1f['filters']=_[_0xd049('0x34')](_0x46eb1f[_0xd049('0x30')],_0x46eb1f['query']);_0x280436[_0xd049('0x35')]=_[_0xd049('0x34')](_0x46eb1f[_0xd049('0x30')],qs[_0xd049('0x36')](_0x1b3f8b[_0xd049('0x32')]['fields']));_0x280436[_0xd049('0x35')]=_0x280436[_0xd049('0x35')][_0xd049('0x37')]?_0x280436[_0xd049('0x35')]:_0x46eb1f[_0xd049('0x30')];if(!_0x1b3f8b[_0xd049('0x32')][_0xd049('0x38')](_0xd049('0x39'))){_0x280436[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x1b3f8b[_0xd049('0x32')][_0xd049('0x23')]);_0x280436[_0xd049('0x20')]=qs['offset'](_0x1b3f8b[_0xd049('0x32')][_0xd049('0x20')]);}_0x280436[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x1b3f8b[_0xd049('0x32')]['sort']);_0x280436[_0xd049('0x3c')]=qs[_0xd049('0x3d')](_[_0xd049('0x3e')](_0x1b3f8b['query'],_0x46eb1f[_0xd049('0x3d')]),_0x5a9596);if(_0x1b3f8b[_0xd049('0x32')]['filter']){_0x280436['where']=_[_0xd049('0x3f')](_0x280436['where'],{'$or':_['map'](_0x5a9596,function(_0x348aac){if(_0x348aac[_0xd049('0x2e')]!==_0xd049('0x40')){var _0x53d8af={};_0x53d8af[_0x348aac[_0xd049('0x2b')]]={'$like':'%'+_0x1b3f8b[_0xd049('0x32')]['filter']+'%'};return _0x53d8af;}})});}_0x280436=_[_0xd049('0x3f')]({},_0x280436,_0x1b3f8b[_0xd049('0x41')]);var _0x1f6d7d={'where':_0x280436[_0xd049('0x3c')]};return db[_0xd049('0x42')][_0xd049('0x22')](_0x1f6d7d)[_0xd049('0x2a')](function(_0x4db973){_0xd7adf8[_0xd049('0x22')]=_0x4db973;if(_0x1b3f8b[_0xd049('0x32')][_0xd049('0x43')]){_0x280436[_0xd049('0x44')]=[{'all':!![]}];}return db[_0xd049('0x42')][_0xd049('0x45')](_0x280436);})[_0xd049('0x2a')](function(_0x406712){_0xd7adf8[_0xd049('0x46')]=_0x406712;return _0xd7adf8;})['then'](respondWithFilteredResult(_0x717c00,_0x280436))[_0xd049('0x47')](handleError(_0x717c00,null));};exports[_0xd049('0x48')]=function(_0x14b00b,_0x31b6f8){var _0x3df931={'raw':!![],'where':{'id':_0x14b00b['params']['id']}},_0x1e3f15={};_0x1e3f15['model']=_[_0xd049('0x33')](db['ChatGroup'][_0xd049('0x49')]);_0x1e3f15[_0xd049('0x32')]=_[_0xd049('0x33')](_0x14b00b[_0xd049('0x32')]);_0x1e3f15[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x1e3f15[_0xd049('0x30')],_0x1e3f15[_0xd049('0x32')]);_0x3df931[_0xd049('0x35')]=_[_0xd049('0x34')](_0x1e3f15[_0xd049('0x30')],qs['fields'](_0x14b00b[_0xd049('0x32')]['fields']));_0x3df931[_0xd049('0x35')]=_0x3df931['attributes'][_0xd049('0x37')]?_0x3df931[_0xd049('0x35')]:_0x1e3f15[_0xd049('0x30')];if(_0x14b00b[_0xd049('0x32')][_0xd049('0x43')]){_0x3df931['include']=[{'all':!![]}];}_0x3df931=_['merge']({},_0x3df931,_0x14b00b[_0xd049('0x41')]);return db['ChatGroup'][_0xd049('0x4a')](_0x3df931)['then'](handleEntityNotFound(_0x31b6f8,null))['then'](respondWithResult(_0x31b6f8,null))[_0xd049('0x47')](handleError(_0x31b6f8,null));};exports[_0xd049('0x4b')]=function(_0x55ec08,_0x978fa4){return db[_0xd049('0x42')]['create'](_0x55ec08[_0xd049('0x4c')],{})['then'](respondWithResult(_0x978fa4,0xc9))[_0xd049('0x47')](handleError(_0x978fa4,null));};exports[_0xd049('0x29')]=function(_0x349b58,_0x1d9254){if(_0x349b58[_0xd049('0x4c')]['id']){delete _0x349b58[_0xd049('0x4c')]['id'];}return db['ChatGroup'][_0xd049('0x4a')]({'where':{'id':_0x349b58[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x1d9254,null))[_0xd049('0x2a')](saveUpdates(_0x349b58[_0xd049('0x4c')],null))['then'](respondWithResult(_0x1d9254,null))[_0xd049('0x47')](handleError(_0x1d9254,null));};exports[_0xd049('0x4e')]=function(_0x230e94,_0x51af55){return db[_0xd049('0x42')]['find']({'where':{'id':_0x230e94[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x51af55,null))[_0xd049('0x2a')](removeEntity(_0x51af55,null))[_0xd049('0x47')](handleError(_0x51af55,null));};exports['describe']=function(_0x421f2b,_0x171e46){return db[_0xd049('0x42')][_0xd049('0x4f')]()[_0xd049('0x2a')](respondWithResult(_0x171e46,null))[_0xd049('0x47')](handleError(_0x171e46,null));};exports[_0xd049('0x50')]=function(_0x10021f,_0x2249a0,_0x1abfce){return db[_0xd049('0x51')]['count']({'where':{'ChatGroupId':_0x10021f[_0xd049('0x4d')]['id'],'ToId':_0x10021f[_0xd049('0x52')]['id'],'read':![]}})[_0xd049('0x2a')](function(_0xcce276){return{'id':_[_0xd049('0x53')](_0x10021f[_0xd049('0x4d')]['id']),'count':_0xcce276};})['then'](respondWithResult(_0x2249a0,null))[_0xd049('0x47')](handleError(_0x2249a0,null));};exports['addMembers']=function(_0xb15f47,_0x43f8ac,_0x36e529){return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0xb15f47[_0xd049('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43f8ac,null))[_0xd049('0x2a')](function(_0x20319b){if(_0x20319b){return _0x20319b['addMembers'](_0xb15f47[_0xd049('0x4c')][_0xd049('0x54')],_[_0xd049('0x55')](_0xb15f47[_0xd049('0x4c')],[_0xd049('0x54'),'id'])||{});}})[_0xd049('0x2a')](respondWithResult(_0x43f8ac,null))[_0xd049('0x47')](handleError(_0x43f8ac,null));};exports['getMembers']=function(_0x372d8f,_0x33781a,_0x250ca6){var _0x3a4b0f={};var _0x22e083={};var _0x285fdb;var _0x5b3663;return db['ChatGroup'][_0xd049('0x56')]({'where':{'id':_0x372d8f[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x33781a,null))[_0xd049('0x2a')](function(_0xccd771){if(_0xccd771){_0x285fdb=_0xccd771;_0x22e083['model']=_[_0xd049('0x33')](db[_0xd049('0x57')][_0xd049('0x49')]);_0x22e083[_0xd049('0x32')]=_[_0xd049('0x33')](_0x372d8f[_0xd049('0x32')]);_0x22e083[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x22e083[_0xd049('0x30')],_0x22e083[_0xd049('0x32')]);_0x3a4b0f[_0xd049('0x35')]=_[_0xd049('0x34')](_0x22e083[_0xd049('0x30')],qs[_0xd049('0x36')](_0x372d8f[_0xd049('0x32')][_0xd049('0x36')]));_0x3a4b0f['attributes']=_0x3a4b0f[_0xd049('0x35')][_0xd049('0x37')]?_0x3a4b0f[_0xd049('0x35')]:_0x22e083[_0xd049('0x30')];_0x3a4b0f[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x372d8f[_0xd049('0x32')][_0xd049('0x3b')]);_0x3a4b0f[_0xd049('0x3c')]=qs[_0xd049('0x3d')](_['pick'](_0x372d8f[_0xd049('0x32')],_0x22e083['filters']));if(_0x372d8f[_0xd049('0x32')][_0xd049('0x58')]){_0x3a4b0f[_0xd049('0x3c')]=_[_0xd049('0x3f')](_0x3a4b0f[_0xd049('0x3c')],{'$or':_[_0xd049('0x31')](_0x3a4b0f['attributes'],function(_0x4abe1d){var _0x315f1e={};_0x315f1e[_0x4abe1d]={'$like':'%'+_0x372d8f['query'][_0xd049('0x58')]+'%'};return _0x315f1e;})});}_0x3a4b0f=_[_0xd049('0x3f')]({},_0x3a4b0f,_0x372d8f[_0xd049('0x41')]);return _0x285fdb[_0xd049('0x59')](_0x3a4b0f);}})[_0xd049('0x2a')](function(_0x5e3337){if(_0x5e3337){_0x5b3663=_0x5e3337[_0xd049('0x37')];if(!_0x372d8f[_0xd049('0x32')]['hasOwnProperty'](_0xd049('0x39'))){_0x3a4b0f[_0xd049('0x23')]=qs['limit'](_0x372d8f[_0xd049('0x32')][_0xd049('0x23')]);_0x3a4b0f[_0xd049('0x20')]=qs[_0xd049('0x20')](_0x372d8f['query']['offset']);}return _0x285fdb['getMembers'](_0x3a4b0f);}})[_0xd049('0x2a')](function(_0x33b6c8){if(_0x33b6c8){return _0x33b6c8?{'count':_0x5b3663,'rows':_0x33b6c8}:null;}})[_0xd049('0x2a')](respondWithResult(_0x33781a,null))[_0xd049('0x47')](handleError(_0x33781a,null));};exports['removeMembers']=function(_0x569d75,_0x1763d7,_0x44d4c5){return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0x569d75['params']['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x1763d7,null))[_0xd049('0x2a')](function(_0x3904af){if(_0x3904af){return _0x3904af['removeMembers'](_0x569d75[_0xd049('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x1763d7,null))[_0xd049('0x47')](handleError(_0x1763d7,null));};exports[_0xd049('0x5a')]=function(_0x4a64f1,_0x11af7c,_0x524c77){if(_0x4a64f1['body']['id']){delete _0x4a64f1[_0xd049('0x4c')]['id'];}return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0x4a64f1['params']['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x11af7c,null))[_0xd049('0x2a')](function(_0x573263){if(_0x573263){_0x4a64f1[_0xd049('0x4c')][_0xd049('0x5b')]=_0x573263['id'];return db[_0xd049('0x51')][_0xd049('0x4b')](_0x4a64f1[_0xd049('0x4c')]);}})[_0xd049('0x2a')](respondWithResult(_0x11af7c,null))['catch'](handleError(_0x11af7c,null));};exports[_0xd049('0x5c')]=function(_0x1a2f36,_0x49f7b3,_0x1dbb61){var _0x61565e={};var _0x98a5cf={};var _0x58288f;var _0x195233;return db[_0xd049('0x42')][_0xd049('0x56')]({'where':{'id':_0x1a2f36[_0xd049('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49f7b3,null))[_0xd049('0x2a')](function(_0x7b34b8){if(_0x7b34b8){_0x58288f=_0x7b34b8;_0x98a5cf[_0xd049('0x30')]=_['keys'](db[_0xd049('0x51')][_0xd049('0x49')]);_0x98a5cf[_0xd049('0x32')]=_[_0xd049('0x33')](_0x1a2f36[_0xd049('0x32')]);_0x98a5cf[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x98a5cf[_0xd049('0x30')],_0x98a5cf[_0xd049('0x32')]);_0x61565e[_0xd049('0x35')]=_[_0xd049('0x34')](_0x98a5cf[_0xd049('0x30')],qs[_0xd049('0x36')](_0x1a2f36[_0xd049('0x32')][_0xd049('0x36')]));_0x61565e[_0xd049('0x35')]=_0x61565e[_0xd049('0x35')]['length']?_0x61565e[_0xd049('0x35')]:_0x98a5cf[_0xd049('0x30')];_0x61565e[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x1a2f36[_0xd049('0x32')]['sort']);_0x61565e[_0xd049('0x3c')]=qs['filters'](_[_0xd049('0x3e')](_0x1a2f36[_0xd049('0x32')],_0x98a5cf[_0xd049('0x3d')]));if(_0x1a2f36[_0xd049('0x32')]['filter']){_0x61565e[_0xd049('0x3c')]=_[_0xd049('0x3f')](_0x61565e[_0xd049('0x3c')],{'$or':_['map'](_0x61565e[_0xd049('0x35')],function(_0xc5b1ab){var _0x2287be={};_0x2287be[_0xc5b1ab]={'$like':'%'+_0x1a2f36['query'][_0xd049('0x58')]+'%'};return _0x2287be;})});}if(_0x1a2f36['query'][_0xd049('0x5d')]){var _0x1b15b0=_0x1a2f36[_0xd049('0x32')][_0xd049('0x5d')][_0xd049('0x5e')](',');var _0xdaf171={};_0xdaf171[_0x1b15b0[0x0]]={'$gte':moment(_0x1b15b0[0x1])[_0xd049('0x5f')](_0xd049('0x60'))};_0x61565e['where']=_[_0xd049('0x3f')](_0x61565e[_0xd049('0x3c')],_0xdaf171);}_0x61565e=_['merge']({},_0x61565e,_0x1a2f36[_0xd049('0x41')]);return _0x58288f[_0xd049('0x5c')](_0x61565e);}})['then'](function(_0x1d1fdb){if(_0x1d1fdb){_0x195233=_0x1d1fdb[_0xd049('0x37')];if(!_0x1a2f36[_0xd049('0x32')][_0xd049('0x38')](_0xd049('0x39'))){_0x61565e[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x1a2f36['query'][_0xd049('0x23')]);_0x61565e[_0xd049('0x20')]=qs[_0xd049('0x20')](_0x1a2f36['query'][_0xd049('0x20')]);}return _0x58288f['getMessages'](_0x61565e);}})[_0xd049('0x2a')](function(_0x4dfcac){if(_0x4dfcac){return _0x4dfcac?{'count':_0x195233,'rows':_0x4dfcac}:null;}})[_0xd049('0x2a')](respondWithResult(_0x49f7b3,null))[_0xd049('0x47')](handleError(_0x49f7b3,null));}; \ No newline at end of file +var _0x1c06=['findOne','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','describe','getUnread','user','addMembers','ids','omit','getMembers','User','removeMembers','ChatGroupId','getMessages'];(function(_0x3c4a5d,_0x28c1c8){var _0x31b36a=function(_0x3a3634){while(--_0x3a3634){_0x3c4a5d['push'](_0x3c4a5d['shift']());}};_0x31b36a(++_0x28c1c8);}(_0x1c06,0xce));var _0x61c0=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x1c06[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0x61c0('0x0'));var rimraf=require(_0x61c0('0x1'));var zipdir=require(_0x61c0('0x2'));var jsonpatch=require(_0x61c0('0x3'));var rp=require(_0x61c0('0x4'));var moment=require(_0x61c0('0x5'));var BPromise=require(_0x61c0('0x6'));var Mustache=require(_0x61c0('0x7'));var util=require(_0x61c0('0x8'));var path=require(_0x61c0('0x9'));var sox=require('sox');var csv=require(_0x61c0('0xa'));var ejs=require(_0x61c0('0xb'));var fs=require('fs');var fs_extra=require(_0x61c0('0xc'));var _=require(_0x61c0('0xd'));var squel=require(_0x61c0('0xe'));var crypto=require(_0x61c0('0xf'));var jsforce=require(_0x61c0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x61c0('0xa'));var querystring=require(_0x61c0('0x11'));var Papa=require(_0x61c0('0x12'));var Redis=require(_0x61c0('0x13'));var authService=require(_0x61c0('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x61c0('0x15'));var hardwareService=require(_0x61c0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x61c0('0x17'));var config=require(_0x61c0('0x18'));var licenseUtil=require(_0x61c0('0x19'));var db=require(_0x61c0('0x1a'))['db'];config['redis']=_[_0x61c0('0x1b')](config[_0x61c0('0x1c')],{'host':_0x61c0('0x1d'),'port':0x18eb});var socket=require(_0x61c0('0x1e'))(new Redis(config[_0x61c0('0x1c')]));require(_0x61c0('0x1f'))[_0x61c0('0x20')](socket);function respondWithStatusCode(_0x4216b2,_0x49bba2){_0x49bba2=_0x49bba2||0xcc;return function(_0x3c10d0){if(_0x3c10d0){return _0x4216b2[_0x61c0('0x21')](_0x49bba2);}return _0x4216b2['status'](_0x49bba2)[_0x61c0('0x22')]();};}function respondWithResult(_0x233fc0,_0x192644){_0x192644=_0x192644||0xc8;return function(_0x226724){if(_0x226724){return _0x233fc0[_0x61c0('0x23')](_0x192644)[_0x61c0('0x24')](_0x226724);}};}function respondWithFilteredResult(_0x175096,_0x3d6552){return function(_0x12f2e6){if(_0x12f2e6){var _0x522b89=typeof _0x3d6552['offset']===_0x61c0('0x25')&&typeof _0x3d6552[_0x61c0('0x26')]===_0x61c0('0x25');var _0x601b54=_0x12f2e6[_0x61c0('0x27')];var _0x1fd0cc=_0x522b89?0x0:_0x3d6552[_0x61c0('0x28')];var _0x3eff17=_0x522b89?_0x12f2e6['count']:_0x3d6552[_0x61c0('0x28')]+_0x3d6552[_0x61c0('0x26')];var _0x3bd6b3;if(_0x3eff17>=_0x601b54){_0x3eff17=_0x601b54;_0x3bd6b3=0xc8;}else{_0x3bd6b3=0xce;}_0x175096[_0x61c0('0x23')](_0x3bd6b3);return _0x175096['set'](_0x61c0('0x29'),_0x1fd0cc+'-'+_0x3eff17+'/'+_0x601b54)[_0x61c0('0x24')](_0x12f2e6);}return null;};}function patchUpdates(_0xbba82a){return function(_0x49bdc6){try{jsonpatch[_0x61c0('0x2a')](_0x49bdc6,_0xbba82a,!![]);}catch(_0x2ca004){return BPromise['reject'](_0x2ca004);}return _0x49bdc6[_0x61c0('0x2b')]();};}function saveUpdates(_0x3fb75f,_0x146fcc){return function(_0x39b50a){if(_0x39b50a){return _0x39b50a[_0x61c0('0x2c')](_0x3fb75f)[_0x61c0('0x2d')](function(_0x202f8d){return _0x202f8d;});}return null;};}function removeEntity(_0xd8e1b4,_0x5a9299){return function(_0x156b63){if(_0x156b63){return _0x156b63[_0x61c0('0x2e')]()[_0x61c0('0x2d')](function(){_0xd8e1b4['status'](0xcc)[_0x61c0('0x22')]();});}};}function handleEntityNotFound(_0x3d2fcc,_0x1cd854){return function(_0x3c4440){if(!_0x3c4440){_0x3d2fcc[_0x61c0('0x21')](0x194);}return _0x3c4440;};}function handleError(_0xc84e1e,_0x5e13f7){_0x5e13f7=_0x5e13f7||0x1f4;return function(_0x21ad56){logger['error'](_0x21ad56[_0x61c0('0x2f')]);if(_0x21ad56[_0x61c0('0x30')]){delete _0x21ad56[_0x61c0('0x30')];}_0xc84e1e[_0x61c0('0x23')](_0x5e13f7)[_0x61c0('0x31')](_0x21ad56);};}exports[_0x61c0('0x32')]=function(_0x5074a9,_0x364895){var _0x43d99c={},_0x720837={},_0x19567a={'count':0x0,'rows':[]};var _0x11b908=_[_0x61c0('0x33')](db[_0x61c0('0x34')][_0x61c0('0x35')],function(_0xf3d1e2){return{'name':_0xf3d1e2[_0x61c0('0x36')],'type':_0xf3d1e2['type'][_0x61c0('0x37')]};});_0x720837[_0x61c0('0x38')]=_[_0x61c0('0x33')](_0x11b908,_0x61c0('0x30'));_0x720837[_0x61c0('0x39')]=_[_0x61c0('0x3a')](_0x5074a9['query']);_0x720837[_0x61c0('0x3b')]=_[_0x61c0('0x3c')](_0x720837[_0x61c0('0x38')],_0x720837[_0x61c0('0x39')]);_0x43d99c[_0x61c0('0x3d')]=_[_0x61c0('0x3c')](_0x720837['model'],qs[_0x61c0('0x3e')](_0x5074a9[_0x61c0('0x39')][_0x61c0('0x3e')]));_0x43d99c[_0x61c0('0x3d')]=_0x43d99c[_0x61c0('0x3d')][_0x61c0('0x3f')]?_0x43d99c[_0x61c0('0x3d')]:_0x720837[_0x61c0('0x38')];if(!_0x5074a9['query'][_0x61c0('0x40')](_0x61c0('0x41'))){_0x43d99c[_0x61c0('0x26')]=qs[_0x61c0('0x26')](_0x5074a9['query']['limit']);_0x43d99c[_0x61c0('0x28')]=qs[_0x61c0('0x28')](_0x5074a9[_0x61c0('0x39')][_0x61c0('0x28')]);}_0x43d99c[_0x61c0('0x42')]=qs[_0x61c0('0x43')](_0x5074a9[_0x61c0('0x39')][_0x61c0('0x43')]);_0x43d99c[_0x61c0('0x44')]=qs[_0x61c0('0x3b')](_[_0x61c0('0x45')](_0x5074a9[_0x61c0('0x39')],_0x720837[_0x61c0('0x3b')]),_0x11b908);if(_0x5074a9[_0x61c0('0x39')]['filter']){_0x43d99c[_0x61c0('0x44')]=_[_0x61c0('0x46')](_0x43d99c[_0x61c0('0x44')],{'$or':_[_0x61c0('0x33')](_0x11b908,function(_0x4a9948){if(_0x4a9948[_0x61c0('0x47')]!==_0x61c0('0x48')){var _0x2b4f49={};_0x2b4f49[_0x4a9948[_0x61c0('0x30')]]={'$like':'%'+_0x5074a9[_0x61c0('0x39')][_0x61c0('0x49')]+'%'};return _0x2b4f49;}})});}_0x43d99c=_['merge']({},_0x43d99c,_0x5074a9[_0x61c0('0x4a')]);var _0xd259cf={'where':_0x43d99c['where']};return db[_0x61c0('0x34')][_0x61c0('0x27')](_0xd259cf)[_0x61c0('0x2d')](function(_0x2a4f06){_0x19567a['count']=_0x2a4f06;if(_0x5074a9[_0x61c0('0x39')][_0x61c0('0x4b')]){_0x43d99c[_0x61c0('0x4c')]=[{'all':!![]}];}return db[_0x61c0('0x34')][_0x61c0('0x4d')](_0x43d99c);})['then'](function(_0xd24916){_0x19567a['rows']=_0xd24916;return _0x19567a;})[_0x61c0('0x2d')](respondWithFilteredResult(_0x364895,_0x43d99c))[_0x61c0('0x4e')](handleError(_0x364895,null));};exports['show']=function(_0x5b2258,_0x29de52){var _0x3fe551={'raw':!![],'where':{'id':_0x5b2258[_0x61c0('0x4f')]['id']}},_0x1c400b={};_0x1c400b[_0x61c0('0x38')]=_[_0x61c0('0x3a')](db['ChatGroup'][_0x61c0('0x35')]);_0x1c400b['query']=_[_0x61c0('0x3a')](_0x5b2258[_0x61c0('0x39')]);_0x1c400b[_0x61c0('0x3b')]=_[_0x61c0('0x3c')](_0x1c400b['model'],_0x1c400b['query']);_0x3fe551['attributes']=_[_0x61c0('0x3c')](_0x1c400b['model'],qs['fields'](_0x5b2258[_0x61c0('0x39')]['fields']));_0x3fe551[_0x61c0('0x3d')]=_0x3fe551[_0x61c0('0x3d')][_0x61c0('0x3f')]?_0x3fe551[_0x61c0('0x3d')]:_0x1c400b[_0x61c0('0x38')];if(_0x5b2258[_0x61c0('0x39')][_0x61c0('0x4b')]){_0x3fe551[_0x61c0('0x4c')]=[{'all':!![]}];}_0x3fe551=_['merge']({},_0x3fe551,_0x5b2258[_0x61c0('0x4a')]);return db[_0x61c0('0x34')][_0x61c0('0x50')](_0x3fe551)['then'](handleEntityNotFound(_0x29de52,null))[_0x61c0('0x2d')](respondWithResult(_0x29de52,null))[_0x61c0('0x4e')](handleError(_0x29de52,null));};exports[_0x61c0('0x51')]=function(_0x1478ef,_0x2293ba){return db['ChatGroup'][_0x61c0('0x51')](_0x1478ef[_0x61c0('0x52')],{})[_0x61c0('0x2d')](respondWithResult(_0x2293ba,0xc9))['catch'](handleError(_0x2293ba,null));};exports[_0x61c0('0x2c')]=function(_0x305ea7,_0x43da02){if(_0x305ea7['body']['id']){delete _0x305ea7[_0x61c0('0x52')]['id'];}return db[_0x61c0('0x34')]['find']({'where':{'id':_0x305ea7[_0x61c0('0x4f')]['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x43da02,null))['then'](saveUpdates(_0x305ea7['body'],null))[_0x61c0('0x2d')](respondWithResult(_0x43da02,null))[_0x61c0('0x4e')](handleError(_0x43da02,null));};exports[_0x61c0('0x2e')]=function(_0x5501e8,_0x16e9b8){return db['ChatGroup']['find']({'where':{'id':_0x5501e8['params']['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x16e9b8,null))['then'](removeEntity(_0x16e9b8,null))[_0x61c0('0x4e')](handleError(_0x16e9b8,null));};exports['describe']=function(_0x4d1b3a,_0x25e33a){return db[_0x61c0('0x34')][_0x61c0('0x53')]()[_0x61c0('0x2d')](respondWithResult(_0x25e33a,null))[_0x61c0('0x4e')](handleError(_0x25e33a,null));};exports[_0x61c0('0x54')]=function(_0x573427,_0x5942b6,_0xdc2127){return db['ChatInternalMessage'][_0x61c0('0x27')]({'where':{'ChatGroupId':_0x573427['params']['id'],'ToId':_0x573427[_0x61c0('0x55')]['id'],'read':![]}})[_0x61c0('0x2d')](function(_0x2c525f){return{'id':_['toInteger'](_0x573427['params']['id']),'count':_0x2c525f};})['then'](respondWithResult(_0x5942b6,null))[_0x61c0('0x4e')](handleError(_0x5942b6,null));};exports[_0x61c0('0x56')]=function(_0x130304,_0x39af02,_0x2e03b8){return db[_0x61c0('0x34')]['find']({'where':{'id':_0x130304['params']['id']}})['then'](handleEntityNotFound(_0x39af02,null))[_0x61c0('0x2d')](function(_0x2f5b60){if(_0x2f5b60){return _0x2f5b60['addMembers'](_0x130304['body'][_0x61c0('0x57')],_[_0x61c0('0x58')](_0x130304[_0x61c0('0x52')],[_0x61c0('0x57'),'id'])||{});}})[_0x61c0('0x2d')](respondWithResult(_0x39af02,null))[_0x61c0('0x4e')](handleError(_0x39af02,null));};exports[_0x61c0('0x59')]=function(_0x38e0e0,_0x1f1f95,_0x3b11f1){var _0x2751af={};var _0x3bf721={};var _0x57c682;var _0x37dc7b;return db[_0x61c0('0x34')]['findOne']({'where':{'id':_0x38e0e0['params']['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x1f1f95,null))[_0x61c0('0x2d')](function(_0x917804){if(_0x917804){_0x57c682=_0x917804;_0x3bf721[_0x61c0('0x38')]=_[_0x61c0('0x3a')](db[_0x61c0('0x5a')][_0x61c0('0x35')]);_0x3bf721[_0x61c0('0x39')]=_[_0x61c0('0x3a')](_0x38e0e0[_0x61c0('0x39')]);_0x3bf721['filters']=_['intersection'](_0x3bf721[_0x61c0('0x38')],_0x3bf721[_0x61c0('0x39')]);_0x2751af['attributes']=_[_0x61c0('0x3c')](_0x3bf721[_0x61c0('0x38')],qs[_0x61c0('0x3e')](_0x38e0e0['query'][_0x61c0('0x3e')]));_0x2751af[_0x61c0('0x3d')]=_0x2751af[_0x61c0('0x3d')]['length']?_0x2751af[_0x61c0('0x3d')]:_0x3bf721[_0x61c0('0x38')];_0x2751af['order']=qs['sort'](_0x38e0e0['query']['sort']);_0x2751af[_0x61c0('0x44')]=qs[_0x61c0('0x3b')](_[_0x61c0('0x45')](_0x38e0e0[_0x61c0('0x39')],_0x3bf721[_0x61c0('0x3b')]));if(_0x38e0e0[_0x61c0('0x39')]['filter']){_0x2751af['where']=_[_0x61c0('0x46')](_0x2751af[_0x61c0('0x44')],{'$or':_['map'](_0x2751af[_0x61c0('0x3d')],function(_0x3cd882){var _0x59b396={};_0x59b396[_0x3cd882]={'$like':'%'+_0x38e0e0[_0x61c0('0x39')]['filter']+'%'};return _0x59b396;})});}_0x2751af=_[_0x61c0('0x46')]({},_0x2751af,_0x38e0e0[_0x61c0('0x4a')]);return _0x57c682[_0x61c0('0x59')](_0x2751af);}})[_0x61c0('0x2d')](function(_0x44d0a5){if(_0x44d0a5){_0x37dc7b=_0x44d0a5[_0x61c0('0x3f')];if(!_0x38e0e0[_0x61c0('0x39')]['hasOwnProperty'](_0x61c0('0x41'))){_0x2751af[_0x61c0('0x26')]=qs[_0x61c0('0x26')](_0x38e0e0['query']['limit']);_0x2751af[_0x61c0('0x28')]=qs[_0x61c0('0x28')](_0x38e0e0[_0x61c0('0x39')][_0x61c0('0x28')]);}return _0x57c682[_0x61c0('0x59')](_0x2751af);}})[_0x61c0('0x2d')](function(_0x3303cd){if(_0x3303cd){return _0x3303cd?{'count':_0x37dc7b,'rows':_0x3303cd}:null;}})[_0x61c0('0x2d')](respondWithResult(_0x1f1f95,null))[_0x61c0('0x4e')](handleError(_0x1f1f95,null));};exports[_0x61c0('0x5b')]=function(_0x4ae8ca,_0x16d6b4,_0x280cba){return db[_0x61c0('0x34')][_0x61c0('0x50')]({'where':{'id':_0x4ae8ca[_0x61c0('0x4f')]['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x16d6b4,null))['then'](function(_0x1a52af){if(_0x1a52af){return _0x1a52af[_0x61c0('0x5b')](_0x4ae8ca[_0x61c0('0x39')][_0x61c0('0x57')]);}})[_0x61c0('0x2d')](respondWithStatusCode(_0x16d6b4,null))[_0x61c0('0x4e')](handleError(_0x16d6b4,null));};exports['addMessage']=function(_0x2a6673,_0x557260,_0x1463c0){if(_0x2a6673[_0x61c0('0x52')]['id']){delete _0x2a6673[_0x61c0('0x52')]['id'];}return db[_0x61c0('0x34')][_0x61c0('0x50')]({'where':{'id':_0x2a6673[_0x61c0('0x4f')]['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x557260,null))['then'](function(_0x41517d){if(_0x41517d){_0x2a6673[_0x61c0('0x52')][_0x61c0('0x5c')]=_0x41517d['id'];return db['ChatInternalMessage'][_0x61c0('0x51')](_0x2a6673[_0x61c0('0x52')]);}})['then'](respondWithResult(_0x557260,null))[_0x61c0('0x4e')](handleError(_0x557260,null));};exports[_0x61c0('0x5d')]=function(_0x3326bc,_0x1e855b,_0x4984b7){var _0x1e1bc3={};var _0x76e7bd={};var _0x5be670;var _0x54584d;return db[_0x61c0('0x34')][_0x61c0('0x5e')]({'where':{'id':_0x3326bc['params']['id']}})[_0x61c0('0x2d')](handleEntityNotFound(_0x1e855b,null))[_0x61c0('0x2d')](function(_0x18eec2){if(_0x18eec2){_0x5be670=_0x18eec2;_0x76e7bd[_0x61c0('0x38')]=_[_0x61c0('0x3a')](db[_0x61c0('0x5f')]['rawAttributes']);_0x76e7bd[_0x61c0('0x39')]=_['keys'](_0x3326bc[_0x61c0('0x39')]);_0x76e7bd['filters']=_[_0x61c0('0x3c')](_0x76e7bd[_0x61c0('0x38')],_0x76e7bd[_0x61c0('0x39')]);_0x1e1bc3[_0x61c0('0x3d')]=_[_0x61c0('0x3c')](_0x76e7bd['model'],qs['fields'](_0x3326bc['query'][_0x61c0('0x3e')]));_0x1e1bc3[_0x61c0('0x3d')]=_0x1e1bc3[_0x61c0('0x3d')]['length']?_0x1e1bc3[_0x61c0('0x3d')]:_0x76e7bd['model'];_0x1e1bc3[_0x61c0('0x42')]=qs[_0x61c0('0x43')](_0x3326bc[_0x61c0('0x39')]['sort']);_0x1e1bc3[_0x61c0('0x44')]=qs[_0x61c0('0x3b')](_['pick'](_0x3326bc['query'],_0x76e7bd[_0x61c0('0x3b')]));if(_0x3326bc[_0x61c0('0x39')]['filter']){_0x1e1bc3[_0x61c0('0x44')]=_['merge'](_0x1e1bc3[_0x61c0('0x44')],{'$or':_[_0x61c0('0x33')](_0x1e1bc3['attributes'],function(_0x27dfff){var _0x21256e={};_0x21256e[_0x27dfff]={'$like':'%'+_0x3326bc['query'][_0x61c0('0x49')]+'%'};return _0x21256e;})});}if(_0x3326bc[_0x61c0('0x39')]['$gte']){var _0x3f3dea=_0x3326bc[_0x61c0('0x39')][_0x61c0('0x60')][_0x61c0('0x61')](',');var _0x168363={};_0x168363[_0x3f3dea[0x0]]={'$gte':moment(_0x3f3dea[0x1])[_0x61c0('0x62')](_0x61c0('0x63'))};_0x1e1bc3[_0x61c0('0x44')]=_[_0x61c0('0x46')](_0x1e1bc3['where'],_0x168363);}_0x1e1bc3=_[_0x61c0('0x46')]({},_0x1e1bc3,_0x3326bc[_0x61c0('0x4a')]);return _0x5be670[_0x61c0('0x5d')](_0x1e1bc3);}})['then'](function(_0x3d5791){if(_0x3d5791){_0x54584d=_0x3d5791[_0x61c0('0x3f')];if(!_0x3326bc['query'][_0x61c0('0x40')](_0x61c0('0x41'))){_0x1e1bc3[_0x61c0('0x26')]=qs['limit'](_0x3326bc[_0x61c0('0x39')][_0x61c0('0x26')]);_0x1e1bc3['offset']=qs[_0x61c0('0x28')](_0x3326bc[_0x61c0('0x39')][_0x61c0('0x28')]);}return _0x5be670[_0x61c0('0x5d')](_0x1e1bc3);}})[_0x61c0('0x2d')](function(_0x1f8508){if(_0x1f8508){return _0x1f8508?{'count':_0x54584d,'rows':_0x1f8508}:null;}})[_0x61c0('0x2d')](respondWithResult(_0x1e855b,null))[_0x61c0('0x4e')](handleError(_0x1e855b,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f73c2da..bceb7ea 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 _0x1a9b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x5302c2,_0x172b86){var _0x46182c=function(_0x2cd650){while(--_0x2cd650){_0x5302c2['push'](_0x5302c2['shift']());}};_0x46182c(++_0x172b86);}(_0x1a9b,0xf6));var _0xb1a9=function(_0x108fea,_0x1d3617){_0x108fea=_0x108fea-0x0;var _0x499199=_0x1a9b[_0x108fea];return _0x499199;};'use strict';var EventEmitter=require(_0xb1a9('0x0'));var ChatGroup=require(_0xb1a9('0x1'))['db'][_0xb1a9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1a9('0x3'),'afterUpdate':_0xb1a9('0x4'),'afterDestroy':_0xb1a9('0x5')};function emitEvent(_0x16dab3){return function(_0x1b473a,_0x312774,_0x409e8c){ChatGroupEvents[_0xb1a9('0x6')](_0x16dab3+':'+_0x1b473a['id'],_0x1b473a);ChatGroupEvents['emit'](_0x16dab3,_0x1b473a);_0x409e8c(null);};}for(var e in events){if(events[_0xb1a9('0x7')](e)){var event=events[e];ChatGroup[_0xb1a9('0x8')](e,emitEvent(event));}}module[_0xb1a9('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x70e3=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','ChatGroup'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x70e3,0x9d));var _0x370e=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x70e3[_0x5c4f6b];return _0x104c4e;};'use strict';var EventEmitter=require(_0x370e('0x0'));var ChatGroup=require(_0x370e('0x1'))['db'][_0x370e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x370e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x370e('0x4'),'afterDestroy':_0x370e('0x5')};function emitEvent(_0x3ae8ba){return function(_0x5e8764,_0x3649c7,_0x4166dd){ChatGroupEvents[_0x370e('0x6')](_0x3ae8ba+':'+_0x5e8764['id'],_0x5e8764);ChatGroupEvents[_0x370e('0x6')](_0x3ae8ba,_0x5e8764);_0x4166dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x370e('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 62939bd..4b727fa 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 _0xe418=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe418,0x155));var _0x8e41=function(_0x7b3f49,_0x59869f){_0x7b3f49=_0x7b3f49-0x0;var _0x34beb6=_0xe418[_0x7b3f49];return _0x34beb6;};'use strict';var _=require('lodash');var util=require(_0x8e41('0x0'));var logger=require(_0x8e41('0x1'))(_0x8e41('0x2'));var moment=require(_0x8e41('0x3'));var BPromise=require(_0x8e41('0x4'));var rp=require(_0x8e41('0x5'));var fs=require('fs');var path=require(_0x8e41('0x6'));var rimraf=require(_0x8e41('0x7'));var config=require('../../config/environment');var attributes=require(_0x8e41('0x8'));module[_0x8e41('0x9')]=function(_0x2ccf5c,_0x2effc2){return _0x2ccf5c[_0x8e41('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x660f=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x660f,0x1ac));var _0xf660=function(_0x34e639,_0x23ae3f){_0x34e639=_0x34e639-0x0;var _0x52823e=_0x660f[_0x34e639];return _0x52823e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf660('0x0'))('api');var moment=require(_0xf660('0x1'));var BPromise=require(_0xf660('0x2'));var rp=require(_0xf660('0x3'));var fs=require('fs');var path=require(_0xf660('0x4'));var rimraf=require(_0xf660('0x5'));var config=require(_0xf660('0x6'));var attributes=require(_0xf660('0x7'));module[_0xf660('0x8')]=function(_0x110f22,_0x1e0daa){return _0x110f22[_0xf660('0x9')](_0xf660('0xa'),attributes,{'tableName':_0xf660('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 01a58d5..9f451d2 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 _0xf6d1=['ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0xf6d1,0x99));var _0x1f6d=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf6d1[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});config[_0x1f6d('0xc')]=_[_0x1f6d('0xd')](config[_0x1f6d('0xc')],{'host':_0x1f6d('0xe'),'port':0x18eb});var socket=require(_0x1f6d('0xf'))(new Redis(config[_0x1f6d('0xc')]));require(_0x1f6d('0x10'))[_0x1f6d('0x11')](socket);function respondWithRpcPromise(_0x523958,_0x25ec55,_0x4f33bd){return new BPromise(function(_0x456882,_0x4aaba1){return client[_0x1f6d('0x12')](_0x523958,_0x4f33bd)[_0x1f6d('0x13')](function(_0x3d813c){logger[_0x1f6d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,'request\x20sent');logger[_0x1f6d('0x15')](_0x1f6d('0x16'),_0x25ec55,_0x1f6d('0x17'),JSON[_0x1f6d('0x18')](_0x3d813c));if(_0x3d813c[_0x1f6d('0x19')]){if(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1a')]===0x1f4){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x3d813c[_0x1f6d('0x19')]['message']);return _0x4aaba1(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);}logger[_0x1f6d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);return _0x456882(_0x3d813c['error'][_0x1f6d('0x1c')]);}else{logger[_0x1f6d('0x14')](_0x1f6d('0x1b'),_0x25ec55,_0x1f6d('0x17'));_0x456882(_0x3d813c[_0x1f6d('0x1d')][_0x1f6d('0x1c')]);}})['catch'](function(_0x24c5b8){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x24c5b8);_0x4aaba1(_0x24c5b8);});});} \ No newline at end of file +var _0xef72=['register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x3aa48e,_0x22eb8d){var _0x26f857=function(_0x59c01d){while(--_0x59c01d){_0x3aa48e['push'](_0x3aa48e['shift']());}};_0x26f857(++_0x22eb8d);}(_0xef72,0xf8));var _0x2ef7=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0xef72[_0x13e724];return _0x334a44;};'use strict';var _=require(_0x2ef7('0x0'));var util=require(_0x2ef7('0x1'));var moment=require(_0x2ef7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ef7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ef7('0x4'))(_0x2ef7('0x5'));var config=require(_0x2ef7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2ef7('0x7')]['http']({'port':0x232a});config[_0x2ef7('0x8')]=_[_0x2ef7('0x9')](config[_0x2ef7('0x8')],{'host':_0x2ef7('0xa'),'port':0x18eb});var socket=require(_0x2ef7('0xb'))(new Redis(config[_0x2ef7('0x8')]));require('./chatGroup.socket')[_0x2ef7('0xc')](socket);function respondWithRpcPromise(_0x5e1adf,_0x574115,_0x448770){return new BPromise(function(_0x5f54f2,_0x54e43b){return client[_0x2ef7('0xd')](_0x5e1adf,_0x448770)[_0x2ef7('0xe')](function(_0xb1cc9){logger[_0x2ef7('0xf')]('ChatGroup,\x20%s,\x20%s',_0x574115,'request\x20sent');logger[_0x2ef7('0x10')](_0x2ef7('0x11'),_0x574115,_0x2ef7('0x12'),JSON[_0x2ef7('0x13')](_0xb1cc9));if(_0xb1cc9['error']){if(_0xb1cc9[_0x2ef7('0x14')][_0x2ef7('0x15')]===0x1f4){logger[_0x2ef7('0x14')]('ChatGroup,\x20%s,\x20%s',_0x574115,_0xb1cc9[_0x2ef7('0x14')][_0x2ef7('0x16')]);return _0x54e43b(_0xb1cc9[_0x2ef7('0x14')][_0x2ef7('0x16')]);}logger['error'](_0x2ef7('0x17'),_0x574115,_0xb1cc9[_0x2ef7('0x14')][_0x2ef7('0x16')]);return _0x5f54f2(_0xb1cc9[_0x2ef7('0x14')][_0x2ef7('0x16')]);}else{logger['info'](_0x2ef7('0x17'),_0x574115,'request\x20sent');_0x5f54f2(_0xb1cc9[_0x2ef7('0x18')][_0x2ef7('0x16')]);}})[_0x2ef7('0x19')](function(_0x290e13){logger[_0x2ef7('0x14')](_0x2ef7('0x17'),_0x574115,_0x290e13);_0x54e43b(_0x290e13);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2833183..fca5b29 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 _0x7aa1=['update','removeListener','register','chatGroup:','./chatGroup.events','save','remove'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x7aa1,0x12a));var _0x17aa=function(_0x5085de,_0x6e0678){_0x5085de=_0x5085de-0x0;var _0x52b6c3=_0x7aa1[_0x5085de];return _0x52b6c3;};'use strict';var ChatGroupEvents=require(_0x17aa('0x0'));var events=[_0x17aa('0x1'),_0x17aa('0x2'),_0x17aa('0x3')];function createListener(_0x4c4ad7,_0x425ea9){return function(_0x5bd760){_0x425ea9['emit'](_0x4c4ad7,_0x5bd760);};}function removeListener(_0x42855e,_0x2b4eb1){return function(){ChatGroupEvents[_0x17aa('0x4')](_0x42855e,_0x2b4eb1);};}exports[_0x17aa('0x5')]=function(_0x583219){for(var _0x4301d4=0x0,_0x32994b=events['length'];_0x4301d4<_0x32994b;_0x4301d4++){var _0xdcee76=events[_0x4301d4];var _0x1e2739=createListener(_0x17aa('0x6')+_0xdcee76,_0x583219);ChatGroupEvents['on'](_0xdcee76,_0x1e2739);}}; \ No newline at end of file +var _0xc7c4=['./chatGroup.events','save','remove','emit','removeListener','register','chatGroup:'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0xc7c4,0x165));var _0x4c7c=function(_0x85df03,_0x451d08){_0x85df03=_0x85df03-0x0;var _0x3d5ea3=_0xc7c4[_0x85df03];return _0x3d5ea3;};'use strict';var ChatGroupEvents=require(_0x4c7c('0x0'));var events=[_0x4c7c('0x1'),_0x4c7c('0x2'),'update'];function createListener(_0x9409fb,_0x2eba69){return function(_0x46650d){_0x2eba69[_0x4c7c('0x3')](_0x9409fb,_0x46650d);};}function removeListener(_0x18536a,_0x280630){return function(){ChatGroupEvents[_0x4c7c('0x4')](_0x18536a,_0x280630);};}exports[_0x4c7c('0x5')]=function(_0xbbbd14){for(var _0x5e7296=0x0,_0x58eb7d=events['length'];_0x5e7296<_0x58eb7d;_0x5e7296++){var _0x5f1733=events[_0x5e7296];var _0x2e5404=createListener(_0x4c7c('0x6')+_0x5f1733,_0xbbbd14);ChatGroupEvents['on'](_0x5f1733,_0x2e5404);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 787b5e2..17e25e4 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 _0x4973=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','/:id/members','/:id/messages','getMessages','post','create','addMembers','update','delete','destroy','removeMembers','exports','util','path'];(function(_0x480e73,_0x4fc890){var _0x4db556=function(_0x19df7b){while(--_0x19df7b){_0x480e73['push'](_0x480e73['shift']());}};_0x4db556(++_0x4fc890);}(_0x4973,0xbb));var _0x3497=function(_0xd22918,_0x1de1a1){_0xd22918=_0xd22918-0x0;var _0x30c9f9=_0x4973[_0xd22918];return _0x30c9f9;};'use strict';var multer=require('multer');var util=require(_0x3497('0x0'));var path=require(_0x3497('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3497('0x2')]();var fs_extra=require(_0x3497('0x3'));var auth=require(_0x3497('0x4'));var interaction=require(_0x3497('0x5'));var config=require(_0x3497('0x6'));var controller=require(_0x3497('0x7'));router[_0x3497('0x8')]('/',auth[_0x3497('0x9')](),controller[_0x3497('0xa')]);router[_0x3497('0x8')](_0x3497('0xb'),auth[_0x3497('0x9')](),controller[_0x3497('0xc')]);router[_0x3497('0x8')](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0xe')]);router[_0x3497('0x8')](_0x3497('0xf'),auth[_0x3497('0x9')](),controller['getUnread']);router['get'](_0x3497('0x10'),auth[_0x3497('0x9')](),controller['getMembers']);router[_0x3497('0x8')](_0x3497('0x11'),auth[_0x3497('0x9')](),controller[_0x3497('0x12')]);router[_0x3497('0x13')]('/',auth[_0x3497('0x9')](),controller[_0x3497('0x14')]);router['post'](_0x3497('0x10'),auth[_0x3497('0x9')](),controller[_0x3497('0x15')]);router[_0x3497('0x13')](_0x3497('0x11'),auth[_0x3497('0x9')](),controller['addMessage']);router['put'](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0x16')]);router[_0x3497('0x17')](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0x18')]);router[_0x3497('0x17')](_0x3497('0x10'),auth[_0x3497('0x9')](),controller[_0x3497('0x19')]);module[_0x3497('0x1a')]=router; \ No newline at end of file +var _0xa460=['index','get','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','isAuthenticated'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa460,0xbc));var _0x0a46=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0xa460[_0x40de6f];return _0x44a887;};'use strict';var multer=require(_0x0a46('0x0'));var util=require(_0x0a46('0x1'));var path=require(_0x0a46('0x2'));var timeout=require(_0x0a46('0x3'));var express=require(_0x0a46('0x4'));var router=express[_0x0a46('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0a46('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x0a46('0x7')](),controller[_0x0a46('0x8')]);router[_0x0a46('0x9')](_0x0a46('0xa'),auth[_0x0a46('0x7')](),controller[_0x0a46('0xb')]);router[_0x0a46('0x9')](_0x0a46('0xc'),auth[_0x0a46('0x7')](),controller[_0x0a46('0xd')]);router['get'](_0x0a46('0xe'),auth[_0x0a46('0x7')](),controller[_0x0a46('0xf')]);router[_0x0a46('0x9')](_0x0a46('0x10'),auth['isAuthenticated'](),controller[_0x0a46('0x11')]);router[_0x0a46('0x9')](_0x0a46('0x12'),auth['isAuthenticated'](),controller[_0x0a46('0x13')]);router[_0x0a46('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a46('0x14')](_0x0a46('0x10'),auth[_0x0a46('0x7')](),controller[_0x0a46('0x15')]);router['post'](_0x0a46('0x12'),auth[_0x0a46('0x7')](),controller[_0x0a46('0x16')]);router[_0x0a46('0x17')](_0x0a46('0xc'),auth['isAuthenticated'](),controller[_0x0a46('0x18')]);router[_0x0a46('0x19')](_0x0a46('0xc'),auth[_0x0a46('0x7')](),controller[_0x0a46('0x1a')]);router['delete'](_0x0a46('0x10'),auth['isAuthenticated'](),controller[_0x0a46('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6227887..57cb771 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 _0x7b14=['TEXT','DATE','STRING','long','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star'];(function(_0x567a45,_0x2d70e6){var _0x8d4cc3=function(_0x20ccba){while(--_0x20ccba){_0x567a45['push'](_0x567a45['shift']());}};_0x8d4cc3(++_0x2d70e6);}(_0x7b14,0x171));var _0x47b1=function(_0x32b7b8,_0xc36409){_0x32b7b8=_0x32b7b8-0x0;var _0x3d381d=_0x7b14[_0x32b7b8];return _0x3d381d;};'use strict';var Sequelize=require(_0x47b1('0x0'));module[_0x47b1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x47b1('0x2')]},'ratingType':{'type':Sequelize[_0x47b1('0x3')](_0x47b1('0x4'),'thumb'),'defaultValue':_0x47b1('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x47b1('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x47b1('0x6')]},'disposition':{'type':Sequelize[_0x47b1('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x47b1('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x47b1('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x47b1('0x7')]},'osVersion':{'type':Sequelize[_0x47b1('0x7')]},'deviceModel':{'type':Sequelize[_0x47b1('0x7')]},'deviceVendor':{'type':Sequelize[_0x47b1('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x47b1('0x5')]},'customerIp':{'type':Sequelize[_0x47b1('0x7')]},'formData':{'type':Sequelize[_0x47b1('0x5')](_0x47b1('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x47b1('0x3')]('in',_0x47b1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x47b1('0x7')]},'customerPort':{'type':Sequelize[_0x47b1('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x47b1('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x47b1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x47b1('0x2')]}}; \ No newline at end of file +var _0xcf4a=['STRING','long','DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','thumb','TEXT'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcf4a,0xec));var _0xacf4=function(_0x18b367,_0x349a8e){_0x18b367=_0x18b367-0x0;var _0xaa88a8=_0xcf4a[_0x18b367];return _0xaa88a8;};'use strict';var Sequelize=require(_0xacf4('0x0'));module[_0xacf4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xacf4('0x2')]},'ratingType':{'type':Sequelize[_0xacf4('0x3')]('star',_0xacf4('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xacf4('0x5')]},'pathTranscript':{'type':Sequelize[_0xacf4('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xacf4('0x6')]},'secondDisposition':{'type':Sequelize[_0xacf4('0x6')]},'thirdDisposition':{'type':Sequelize[_0xacf4('0x6')]},'note':{'type':Sequelize[_0xacf4('0x6')]},'browserName':{'type':Sequelize[_0xacf4('0x6')]},'browserVersion':{'type':Sequelize[_0xacf4('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xacf4('0x6')]},'deviceModel':{'type':Sequelize[_0xacf4('0x6')]},'deviceVendor':{'type':Sequelize[_0xacf4('0x6')]},'deviceType':{'type':Sequelize[_0xacf4('0x6')]},'referer':{'type':Sequelize[_0xacf4('0x5')]},'customerIp':{'type':Sequelize[_0xacf4('0x6')]},'formData':{'type':Sequelize[_0xacf4('0x5')](_0xacf4('0x7'))},'read1stAt':{'type':Sequelize[_0xacf4('0x8')]},'lastMsgAt':{'type':Sequelize[_0xacf4('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xacf4('0x3')]('in',_0xacf4('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xacf4('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xacf4('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3abacc4..2b89236 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 _0x3a15=['customerPort','N.A.','tail','existsSync','createReadStream','pipe','firstName','lastName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','rimraf','request-promise','bluebird','mustache','util','lodash','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','./chatInteraction.socket','register','jayson/promise','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','update','destroy','stack','name','send','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','show','params','model','keys','attributes','intersection','fields','length','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','CmContact','ContactId','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','%s%d','createdAt','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','ChatInteractionId','push','alias','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','toString','files','tmp','server','attachments','transcript-%d-%s.zip','read','Owner','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3a15,0xde));var _0x53a1=function(_0x51bd64,_0x1c8850){_0x51bd64=_0x51bd64-0x0;var _0x2c7ee4=_0x3a15[_0x51bd64];return _0x2c7ee4;};'use strict';var rimraf=require(_0x53a1('0x0'));var zipdir=require('zip-dir');var rp=require(_0x53a1('0x1'));var moment=require('moment');var BPromise=require(_0x53a1('0x2'));var Mustache=require(_0x53a1('0x3'));var util=require(_0x53a1('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x53a1('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x53a1('0x6'));var logger=require('../../config/logger')(_0x53a1('0x7'));var config=require(_0x53a1('0x8'));var db=require(_0x53a1('0x9'))['db'];config['redis']=_[_0x53a1('0xa')](config[_0x53a1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x53a1('0xc'))[_0x53a1('0xd')](socket);var jayson=require(_0x53a1('0xe'));var client=jayson[_0x53a1('0xf')]['http']({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1a5c95,_0x12f86c,_0x50cd84,_0x1a89e9){return new BPromise(function(_0x17d23b,_0x33b513){var _0x4a14bc=_0x1a89e9||client;return _0x4a14bc[_0x53a1('0x10')](_0x1a5c95,_0x50cd84)[_0x53a1('0x11')](function(_0x3d66f5){logger[_0x53a1('0x12')](_0x53a1('0x13'),_0x12f86c,_0x53a1('0x14'));logger[_0x53a1('0x15')](_0x53a1('0x16'),_0x12f86c,_0x53a1('0x14'),JSON['stringify'](_0x3d66f5));if(_0x3d66f5[_0x53a1('0x17')]){if(_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x18')]===0x1f4){logger[_0x53a1('0x17')](_0x53a1('0x13'),_0x12f86c,_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);return _0x33b513(_0x3d66f5['error'][_0x53a1('0x19')]);}logger['error'](_0x53a1('0x13'),_0x12f86c,_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);return _0x17d23b(_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);}else{logger[_0x53a1('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x12f86c,_0x53a1('0x14'));_0x17d23b(_0x3d66f5[_0x53a1('0x1a')]['message']);}})[_0x53a1('0x1b')](function(_0x32c5f5){logger['error'](_0x53a1('0x13'),_0x12f86c,_0x32c5f5);_0x33b513(_0x32c5f5);});});}function respondWithStatusCode(_0x11253c,_0x5173a3){_0x5173a3=_0x5173a3||0xcc;return function(_0x14718c){if(_0x14718c){return _0x11253c[_0x53a1('0x1c')](_0x5173a3);}return _0x11253c['status'](_0x5173a3)[_0x53a1('0x1d')]();};}function respondWithResult(_0x1a4dab,_0x471e34){_0x471e34=_0x471e34||0xc8;return function(_0x26f84a){if(_0x26f84a){return _0x1a4dab['status'](_0x471e34)[_0x53a1('0x1e')](_0x26f84a);}};}function respondWithFilteredResult(_0x428866,_0x2a71f1){return function(_0x1027d4){if(_0x1027d4){var _0x3bf15c=typeof _0x2a71f1[_0x53a1('0x1f')]==='undefined'&&typeof _0x2a71f1[_0x53a1('0x20')]===_0x53a1('0x21');var _0x17d3ff=_0x1027d4[_0x53a1('0x22')];var _0x348d5f=_0x3bf15c?0x0:_0x2a71f1[_0x53a1('0x1f')];var _0x13f5f7=_0x3bf15c?_0x1027d4[_0x53a1('0x22')]:_0x2a71f1[_0x53a1('0x1f')]+_0x2a71f1[_0x53a1('0x20')];var _0x255768;if(_0x13f5f7>=_0x17d3ff){_0x13f5f7=_0x17d3ff;_0x255768=0xc8;}else{_0x255768=0xce;}_0x428866[_0x53a1('0x23')](_0x255768);return _0x428866['set'](_0x53a1('0x24'),_0x348d5f+'-'+_0x13f5f7+'/'+_0x17d3ff)[_0x53a1('0x1e')](_0x1027d4);}return null;};}function saveUpdates(_0x2ac270){return function(_0x300b4d){if(_0x300b4d){return _0x300b4d[_0x53a1('0x25')](_0x2ac270)[_0x53a1('0x11')](function(_0x2271d7){return _0x2271d7;});}return null;};}function removeEntity(_0x4e10ff){return function(_0x5aba04){if(_0x5aba04){return _0x5aba04[_0x53a1('0x26')]()[_0x53a1('0x11')](function(){_0x4e10ff[_0x53a1('0x23')](0xcc)[_0x53a1('0x1d')]();});}};}function handleEntityNotFound(_0x116f82){return function(_0x7c89a9){if(!_0x7c89a9){_0x116f82['sendStatus'](0x194);}return _0x7c89a9;};}function handleError(_0x53df98,_0x13a2b1){_0x13a2b1=_0x13a2b1||0x1f4;return function(_0x37f834){logger[_0x53a1('0x17')](_0x37f834[_0x53a1('0x27')]);if(_0x37f834[_0x53a1('0x28')]){delete _0x37f834[_0x53a1('0x28')];}_0x53df98[_0x53a1('0x23')](_0x13a2b1)[_0x53a1('0x29')](_0x37f834);};}function getMustacheRender(_0x1c1211,_0x536409){return Mustache['render'](_0x1c1211,_[_0x53a1('0x2a')](_0x536409[_0x53a1('0x2b')],{'contact':_0x536409[_0x53a1('0x2c')],'message':_0x536409['message'],'agent':_0x536409[_0x53a1('0x2d')],'interaction':_0x536409[_0x53a1('0x2e')],'account':_0x536409[_0x53a1('0x2f')]}))||'';}exports[_0x53a1('0x30')]=function(_0x1d9496,_0x33cbec){var _0x4c3bb8={};var _0x3a4c1d=_[_0x53a1('0x31')](db[_0x53a1('0x32')][_0x53a1('0x33')],function(_0x4a83a2){return{'name':_0x4a83a2[_0x53a1('0x34')],'type':_0x4a83a2['type'][_0x53a1('0x35')]};});_0x4c3bb8=qs[_0x53a1('0x36')](_0x3a4c1d,_0x1d9496);return interaction[_0x53a1('0x37')](_0x53a1('0x38'),_0x1d9496[_0x53a1('0x39')],_0x1d9496[_0x53a1('0x3a')],_0x4c3bb8,_0x3a4c1d)[_0x53a1('0x11')](respondWithFilteredResult(_0x33cbec,_0x4c3bb8))[_0x53a1('0x1b')](handleError(_0x33cbec,null));};exports[_0x53a1('0x3b')]=function(_0x4b71a0,_0x2ae1f4){var _0x24776a={'raw':![],'where':{'id':_0x4b71a0[_0x53a1('0x3c')]['id']}},_0x3a47a5={};_0x3a47a5[_0x53a1('0x3d')]=_['keys'](db[_0x53a1('0x32')][_0x53a1('0x33')]);_0x3a47a5[_0x53a1('0x39')]=_[_0x53a1('0x3e')](_0x4b71a0[_0x53a1('0x39')]);_0x3a47a5['filters']=_['intersection'](_0x3a47a5[_0x53a1('0x3d')],_0x3a47a5[_0x53a1('0x39')]);_0x24776a[_0x53a1('0x3f')]=_[_0x53a1('0x40')](_0x3a47a5['model'],qs['fields'](_0x4b71a0['query'][_0x53a1('0x41')]));_0x24776a[_0x53a1('0x3f')]=_0x24776a[_0x53a1('0x3f')][_0x53a1('0x42')]?_0x24776a['attributes']:_0x3a47a5[_0x53a1('0x3d')];if(_0x4b71a0['query']['includeAll']){_0x24776a[_0x53a1('0x43')]=[{'all':!![]}];}_0x24776a=_['merge']({},_0x24776a,_0x4b71a0[_0x53a1('0x44')]);return db[_0x53a1('0x32')]['find'](_0x24776a)[_0x53a1('0x11')](handleEntityNotFound(_0x2ae1f4,null))['then'](respondWithResult(_0x2ae1f4,null))[_0x53a1('0x1b')](handleError(_0x2ae1f4,null));};exports['create']=function(_0x308f91,_0x4ad64a){return db['ChatInteraction'][_0x53a1('0x45')](_0x308f91['body'],{})['then'](respondWithResult(_0x4ad64a,0xc9))[_0x53a1('0x1b')](handleError(_0x4ad64a,null));};exports[_0x53a1('0x25')]=function(_0x29a00f,_0x5cf7e0){if(_0x29a00f[_0x53a1('0x2b')]['id']){delete _0x29a00f[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x29a00f[_0x53a1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5cf7e0,null))[_0x53a1('0x11')](saveUpdates(_0x29a00f[_0x53a1('0x2b')],null))['then'](respondWithResult(_0x5cf7e0,null))[_0x53a1('0x1b')](handleError(_0x5cf7e0,null));};exports[_0x53a1('0x26')]=function(_0x2ac036,_0x42d96c){return db[_0x53a1('0x32')]['find']({'where':{'id':_0x2ac036[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x42d96c,null))['then'](removeEntity(_0x42d96c,null))['catch'](handleError(_0x42d96c,null));};exports[_0x53a1('0x47')]=function(_0x40152c,_0x2b277d){return db[_0x53a1('0x32')][_0x53a1('0x47')]()[_0x53a1('0x11')](respondWithResult(_0x2b277d,null))[_0x53a1('0x1b')](handleError(_0x2b277d,null));};exports[_0x53a1('0x48')]=function(_0x7dd2ee,_0x1c370b){var _0x57de5b=_0x7dd2ee['params']['id'];var _0xda708a;var _0x5ea173;var _0x1d38dc;return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0x57de5b}})['then'](function(_0x232009){_0xda708a=_0x232009;return db[_0x53a1('0x4a')][_0x53a1('0x49')]({'where':{'id':_0x232009[_0x53a1('0x4b')]},'attributes':['id',_0x53a1('0x4c'),'vidaooEscalation',_0x53a1('0x4d'),_0x53a1('0x4e'),_0x53a1('0x4f')],'raw':!![]});})[_0x53a1('0x11')](function(_0x1229bf){if(_0x1229bf&&_0x1229bf[_0x53a1('0x4c')]&&_0x1229bf[_0x53a1('0x50')]){_0x5ea173=_0x1229bf;var _0x1ddf80={'interaction':{'id':_0x57de5b},'agent':{'id':_0x7dd2ee['user']['id'],'name':_0x7dd2ee['user']['name'],'fullname':_0x7dd2ee[_0x53a1('0x3a')][_0x53a1('0x51')],'email':_0x7dd2ee[_0x53a1('0x3a')][_0x53a1('0x52')]},'contact':_0x7dd2ee['body'][_0x53a1('0x2c')],'account':_0x7dd2ee['body'][_0x53a1('0x2f')]};var _0x265ee2={'rejectUnauthorized':![],'method':_0x53a1('0x53'),'url':_0x53a1('0x54'),'headers':{'X-APIKEY':_0x1229bf['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x7dd2ee['user'][_0x53a1('0x52')]],'buttons':null,'topic':_0x5ea173[_0x53a1('0x4d')],'note':_[_0x53a1('0x55')](_0x5ea173[_0x53a1('0x4e')])?null:getMustacheRender(_0x5ea173['vidaooNote'],_0x1ddf80),'metadata':null},'redirect':_0x53a1('0x56'),'json':!![]};try{if(!_[_0x53a1('0x55')](_0x5ea173['vidaooMetadata'])){var _0x3190ba=getMustacheRender(_0x5ea173[_0x53a1('0x4f')],_0x1ddf80);var _0x11bcc1=JSON[_0x53a1('0x57')](_0x3190ba);_0x265ee2[_0x53a1('0x2b')]['metadata']=_0x11bcc1;}}catch(_0x35af82){throw new db[(_0x53a1('0x58'))][(_0x53a1('0x59'))](_0x53a1('0x5a'));}return rp(_0x265ee2);}else{throw new db[(_0x53a1('0x58'))]['ValidationError'](_0x53a1('0x5b'));}})[_0x53a1('0x11')](function(_0x30bd3e){_0x1d38dc=_0x30bd3e;if(_0x1d38dc['id']){var _0x1624ee={'body':_0x1d38dc[_0x53a1('0x5c')],'ChatWebsiteId':_0x5ea173['id'],'ChatInteractionId':_0xda708a['id'],'direction':'out','UserId':_0x7dd2ee['user']['id']};return db[_0x53a1('0x5d')][_0x53a1('0x45')](_0x1624ee,{});}else{throw new db[(_0x53a1('0x58'))]['ValidationError'](_0x53a1('0x5e'));}})[_0x53a1('0x11')](function(){return _0xda708a[_0x53a1('0x5f')]({'vidaooSessionId':_0x1d38dc['id']});})['then'](respondWithResult(_0x1c370b,null))[_0x53a1('0x1b')](handleError(_0x1c370b,null));};exports[_0x53a1('0x60')]=function(_0x193d33,_0x28eb0e){if(_0x193d33[_0x53a1('0x2b')]['id']){delete _0x193d33[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x193d33['params']['id']},'include':[{'model':db['CmContact'],'as':_0x53a1('0x61')}]})[_0x53a1('0x11')](handleEntityNotFound(_0x28eb0e,null))[_0x53a1('0x11')](saveUpdates(_0x193d33[_0x53a1('0x2b')],null))[_0x53a1('0x11')](respondWithResult(_0x28eb0e,null))['catch'](handleError(_0x28eb0e,null));};exports[_0x53a1('0x62')]=function(_0x530265,_0x14776b){if(_0x530265[_0x53a1('0x2b')]['id']){delete _0x530265[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x530265[_0x53a1('0x3c')]['id']}})['then'](function(_0x41e61c){if(!_0x41e61c){logger[_0x53a1('0x17')](_0x53a1('0x63'),_0x53a1('0x62'),0x194,'entity\x20not\x20found');_0x14776b[_0x53a1('0x1c')](0x194);}else{if(_0x41e61c[_0x53a1('0x64')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x41e61c;})[_0x53a1('0x11')](function(_0x6ebb33){if(_0x6ebb33){return _0x6ebb33['update']({'closed':_0x530265[_0x53a1('0x2b')][_0x53a1('0x65')],'disposition':_0x530265[_0x53a1('0x2b')][_0x53a1('0x66')]})[_0x53a1('0x11')](function(_0x57b4dc){return _0x57b4dc;});}})[_0x53a1('0x11')](function(){return respondWithRpcPromise(_0x53a1('0x67'),_0x53a1('0x62'),_0x530265[_0x53a1('0x2b')],client9004);})['then'](respondWithResult(_0x14776b,null))[_0x53a1('0x1b')](handleError(_0x14776b,null));};exports['attachmentUpload']=function(_0xf00eb9,_0x102b54){_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x28')]=_0xf00eb9[_0x53a1('0x68')][_0x53a1('0x69')];_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x6a')]=_0xf00eb9['file'][_0x53a1('0x6b')];_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x6c')]=_0xf00eb9[_0x53a1('0x68')][_0x53a1('0x6d')];return db[_0x53a1('0x6e')][_0x53a1('0x45')](_0xf00eb9['body'])['then'](respondWithResult(_0x102b54,0xc9))[_0x53a1('0x1b')](handleError(_0x102b54,null));};exports[_0x53a1('0x6f')]=function(_0x5db8de,_0x143524){return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0x5db8de[_0x53a1('0x3c')]['id']},'raw':!![]})[_0x53a1('0x11')](handleEntityNotFound(_0x143524,null))[_0x53a1('0x11')](function(_0x215161){if(_0x215161){if(_0x215161[_0x53a1('0x65')]){return _0x143524[_0x53a1('0x23')](0x193)[_0x53a1('0x1e')]({'status':0x193,'message':_0x53a1('0x70')});}return db[_0x53a1('0x6e')]['findOne']({'where':{'id':_0x5db8de[_0x53a1('0x39')][_0x53a1('0x71')]},'raw':!![]})[_0x53a1('0x11')](handleEntityNotFound(_0x143524,null));}})[_0x53a1('0x11')](function(_0x20efc4){if(_0x20efc4){var _0x5ca204=_0x20efc4[_0x53a1('0x72')]!==null;var _0x2182b2=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0x75'));if(_0x5ca204){_0x2182b2=path[_0x53a1('0x73')](_0x2182b2,'offline-chat/');}var _0x1e4c6a=path[_0x53a1('0x73')](_0x2182b2,_0x20efc4[_0x53a1('0x6a')]);return _0x143524['download'](_0x1e4c6a);}})[_0x53a1('0x1b')](handleError(_0x143524,null));};exports[_0x53a1('0x76')]=function(_0x4b99a2,_0x14b633){var _0x49ff14=null;var _0x191111=null;var _0x1a1e73=null;if(_0x4b99a2[_0x53a1('0x2b')]['id']){delete _0x4b99a2[_0x53a1('0x2b')]['id'];}if(_0x4b99a2['body']['mailTranscript']){_0x1a1e73=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0x77'),util[_0x53a1('0x78')](_0x53a1('0x79'),Date[_0x53a1('0x7a')]()));_0x4b99a2['body']['pathTranscript']=_0x1a1e73;}return db['ChatInteraction'][_0x53a1('0x46')]({'where':{'id':_0x4b99a2['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x53a1('0x7b'),'include':[{'model':db[_0x53a1('0x7c')],'as':_0x53a1('0x7c')}]}]})[_0x53a1('0x11')](handleEntityNotFound(_0x14b633,null))[_0x53a1('0x11')](saveUpdates(_0x4b99a2[_0x53a1('0x2b')],null))[_0x53a1('0x11')](function(_0xddc9bf){if(_0xddc9bf){_0x49ff14=_0xddc9bf;return db[_0x53a1('0x4a')][_0x53a1('0x46')]({'where':{'id':_0x49ff14[_0x53a1('0x4b')]}});}})['then'](function(_0x486038){if(_0x486038){_0x191111=_0x486038;return db[_0x53a1('0x7d')]['find']({'where':{'id':_0x49ff14[_0x53a1('0x7e')]}});}})['then'](function(_0x40ca34){if(_0x40ca34){if(_0x1a1e73){var _0xf95a2a=null;for(var _0x697910=0x1;_0x697910<_0x49ff14[_0x53a1('0x7b')][_0x53a1('0x42')];++_0x697910){_0xf95a2a=_0x49ff14['Messages'][_0x697910];var _0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')]('%s%d',_0x191111['agentAlias'],_0xf95a2a[_0x53a1('0x64')]):_0x53a1('0x7f');var _0x526330=_0x4b99a2[_0x53a1('0x2b')][_0x53a1('0x80')]||util[_0x53a1('0x78')]('%s%d',_0x53a1('0x81'),_0xf95a2a['ContactId']);switch(_0x191111[_0x53a1('0x82')]){case _0x53a1('0x83'):_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')]('%s%d',_0x191111[_0x53a1('0x84')],_0xf95a2a['UserId']):_0x53a1('0x7f');break;case'agent_alias':_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?_0xf95a2a[_0x53a1('0x7c')]['alias']||_0xf95a2a[_0x53a1('0x7c')][_0x53a1('0x51')]:_0x53a1('0x7f');break;case'agent_fullname':_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?_0xf95a2a['User'][_0x53a1('0x51')]:_0x53a1('0x7f');break;default:_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')](_0x53a1('0x85'),_0x191111[_0x53a1('0x84')],_0xf95a2a[_0x53a1('0x64')]):_0x53a1('0x7f');}var _0x14d402=util[_0x53a1('0x78')]('[%s]\x20%s:\x20%s\x0a',moment(_0xf95a2a[_0x53a1('0x86')])[_0x53a1('0x78')]('MM/DD/YYYY\x20HH:mm:ss'),_0xf95a2a['direction']==='in'?_0x526330:_0x512e5b,_0xf95a2a[_0x53a1('0x2b')]);if(!_0xf95a2a[_0x53a1('0x87')]){fs[_0x53a1('0x88')](_0x1a1e73,_0x14d402);}}return db[_0x53a1('0x89')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x53a1('0x8a')],'as':_0x53a1('0x8b'),'raw':!![],'include':[{'model':db[_0x53a1('0x8c')],'as':_0x53a1('0x8c'),'raw':!![]}]}]});}}})[_0x53a1('0x11')](function(_0x2a611a){if(!_0x2a611a||!_0x2a611a['Smtp']||!_0x4b99a2[_0x53a1('0x2b')])return _0x49ff14;var _0x517f1d=_0x2a611a[_0x53a1('0x8d')]();return respondWithRpcPromise('SendMail',_0x53a1('0x8e'),{'account':_0x517f1d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2a611a[_0x53a1('0x28')],_0x2a611a['email']||_0x2a611a[_0x53a1('0x8b')][_0x53a1('0x3a')]),'to':_0x4b99a2['body'][_0x53a1('0x8f')],'subject':_0x53a1('0x90'),'text':util[_0x53a1('0x78')](_0x53a1('0x91'),_0x4b99a2[_0x53a1('0x2b')][_0x53a1('0x8f')]),'attachments':[{'path':_0x1a1e73}]}})[_0x53a1('0x11')](function(){return _0x49ff14;})[_0x53a1('0x1b')](function(_0x281892){logger[_0x53a1('0x17')](_0x281892);});})[_0x53a1('0x11')](respondWithStatusCode(_0x14b633,0xc8))[_0x53a1('0x1b')](handleError(_0x14b633,null));};exports[_0x53a1('0x92')]=function(_0x3e063e,_0x4291df){return db['ChatMessage'][_0x53a1('0x46')]({'where':{'id':_0x3e063e[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x4291df,null))['then'](function(_0x4466b4){if(_0x4466b4){return _0x4466b4['addMessage'](_0x3e063e['body'][_0x53a1('0x93')],_[_0x53a1('0x94')](_0x3e063e['body'],[_0x53a1('0x93'),'id'])||{});}})[_0x53a1('0x11')](respondWithResult(_0x4291df,null))[_0x53a1('0x1b')](handleError(_0x4291df,null));};exports[_0x53a1('0x95')]=function(_0x4f8613,_0x22e646){var _0x427aab={'raw':![],'where':{}};var _0x3e417d={};var _0x10d871={'count':0x0,'rows':[]};return db[_0x53a1('0x32')]['findOne']({'where':{'id':_0x4f8613[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x22e646,null))[_0x53a1('0x11')](function(_0x44cd4b){if(_0x44cd4b){_0x3e417d[_0x53a1('0x3d')]=_['keys'](db[_0x53a1('0x5d')][_0x53a1('0x33')]);_0x3e417d[_0x53a1('0x39')]=_['keys'](_0x4f8613['query']);_0x3e417d[_0x53a1('0x96')]=_[_0x53a1('0x40')](_0x3e417d[_0x53a1('0x3d')],_0x3e417d[_0x53a1('0x39')]);_0x427aab['attributes']=_[_0x53a1('0x40')](_0x3e417d[_0x53a1('0x3d')],qs['fields'](_0x4f8613[_0x53a1('0x39')]['fields']));_0x427aab[_0x53a1('0x3f')]=_0x427aab['attributes'][_0x53a1('0x42')]?_0x427aab[_0x53a1('0x3f')]:_0x3e417d['model'];if(!_0x4f8613[_0x53a1('0x39')][_0x53a1('0x97')](_0x53a1('0x98'))){_0x427aab[_0x53a1('0x20')]=qs[_0x53a1('0x20')](_0x4f8613[_0x53a1('0x39')][_0x53a1('0x20')]);_0x427aab[_0x53a1('0x1f')]=qs[_0x53a1('0x1f')](_0x4f8613['query'][_0x53a1('0x1f')]);}_0x427aab[_0x53a1('0x99')]=qs[_0x53a1('0x9a')](_0x4f8613[_0x53a1('0x39')]['sort']);_0x427aab[_0x53a1('0x9b')]=qs[_0x53a1('0x96')](_[_0x53a1('0x9c')](_0x4f8613[_0x53a1('0x39')],_0x3e417d[_0x53a1('0x96')]));_0x427aab[_0x53a1('0x9b')]['ChatInteractionId']=_0x44cd4b['id'];if(_0x4f8613[_0x53a1('0x39')][_0x53a1('0x9d')]){_0x427aab[_0x53a1('0x9b')]=_[_0x53a1('0x2a')](_0x427aab['where'],{'$or':_[_0x53a1('0x31')](_0x427aab[_0x53a1('0x3f')],function(_0x3fce61){var _0x16cf27={};_0x16cf27[_0x3fce61]={'$like':'%'+_0x4f8613[_0x53a1('0x39')]['filter']+'%'};return _0x16cf27;})});}if(_0x4f8613[_0x53a1('0x39')]['$gte']){var _0x4a1616=_0x4f8613['query']['$gte'][_0x53a1('0x9e')](',');var _0x3bb17a={};_0x3bb17a[_0x4a1616[0x0]]={'$gte':moment(_0x4a1616[0x1])['format'](_0x53a1('0x9f'))};_0x427aab['where']=_['merge'](_0x427aab[_0x53a1('0x9b')],_0x3bb17a);}_0x427aab=_[_0x53a1('0x2a')]({},_0x427aab,_0x4f8613[_0x53a1('0x44')]);return db[_0x53a1('0x5d')]['count']({'where':_0x427aab[_0x53a1('0x9b')]})['then'](function(_0x541bbd){_0x10d871[_0x53a1('0x22')]=_0x541bbd;if(_0x4f8613[_0x53a1('0x39')][_0x53a1('0xa0')]){_0x427aab['include']=[{'all':!![]}];}return db[_0x53a1('0x5d')][_0x53a1('0x37')](_0x427aab);})['then'](function(_0x2aba59){_0x10d871[_0x53a1('0xa1')]=_0x2aba59;return _0x10d871;});}})[_0x53a1('0x11')](respondWithFilteredResult(_0x22e646,_0x427aab))[_0x53a1('0x1b')](handleError(_0x22e646,null));};exports['getMyMessages']=function(_0xa7cf0d,_0x57be75){var _0x275093={'where':{}},_0x5bd589={},_0x282e21={'count':0x0,'rows':[]};return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0xa7cf0d['params']['id']}})['then'](handleEntityNotFound(_0x57be75,null))['then'](function(_0x1047ea){if(_0x1047ea){_0x5bd589[_0x53a1('0x3d')]=_[_0x53a1('0x3e')](db[_0x53a1('0x5d')]['rawAttributes']);_0x5bd589[_0x53a1('0x39')]=_[_0x53a1('0x3e')](_0xa7cf0d[_0x53a1('0x39')]);_0x5bd589[_0x53a1('0x96')]=_[_0x53a1('0x40')](_0x5bd589[_0x53a1('0x3d')],_0x5bd589[_0x53a1('0x39')]);_0x275093[_0x53a1('0x3f')]=_[_0x53a1('0x40')](_0x5bd589[_0x53a1('0x3d')],qs[_0x53a1('0x41')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x41')]));_0x275093[_0x53a1('0x3f')]=_0x275093[_0x53a1('0x3f')][_0x53a1('0x42')]?_0x275093[_0x53a1('0x3f')]:_0x5bd589[_0x53a1('0x3d')];if(!_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x97')](_0x53a1('0x98'))){_0x275093['limit']=qs[_0x53a1('0x20')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x20')]);_0x275093[_0x53a1('0x1f')]=qs[_0x53a1('0x1f')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x1f')]);}_0x275093['order']=qs['sort'](_0xa7cf0d[_0x53a1('0x39')]['sort']);_0x275093[_0x53a1('0x9b')]=qs['filters'](_[_0x53a1('0x9c')](_0xa7cf0d[_0x53a1('0x39')],_0x5bd589[_0x53a1('0x96')]));_0x275093[_0x53a1('0x9b')][_0x53a1('0xa2')]=_0x1047ea['id'];if(_0xa7cf0d[_0x53a1('0x39')]['filter']){_0x275093[_0x53a1('0x9b')]=_[_0x53a1('0x2a')](_0x275093['where'],{'$or':_[_0x53a1('0x31')](_0x275093[_0x53a1('0x3f')],function(_0x1bffd3){var _0x5af6b7={};_0x5af6b7[_0x1bffd3]={'$like':'%'+_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x9d')]+'%'};return _0x5af6b7;})});}_0x275093[_0x53a1('0x9b')][_0x53a1('0x87')]=![];if(_0xa7cf0d['query']['id']){_0x275093[_0x53a1('0x9b')]['id']={'$gt':_0xa7cf0d[_0x53a1('0x39')]['id']};}_0x275093=_[_0x53a1('0x2a')]({},_0x275093,_0xa7cf0d['options']);return db['ChatMessage'][_0x53a1('0x22')]({'where':_0x275093[_0x53a1('0x9b')]})['then'](function(_0x208841){_0x282e21['count']=_0x208841;_0x275093['include']=[];if(_0xa7cf0d[_0x53a1('0x39')]['includeAgent']){_0x275093[_0x53a1('0x43')][_0x53a1('0xa3')]({'model':db[_0x53a1('0x7c')],'as':_0x53a1('0x7c'),'attributes':['id',_0x53a1('0x51'),_0x53a1('0xa4')]});}if(_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0xa0')]){_0x275093['include']=[{'all':!![]}];}return db['ChatMessage'][_0x53a1('0x37')](_0x275093);})[_0x53a1('0x11')](function(_0x4dc428){_0x282e21['rows']=_0x4dc428;return _0x282e21;});}})['then'](respondWithFilteredResult(_0x57be75,_0x275093))[_0x53a1('0x1b')](handleError(_0x57be75,null));};exports[_0x53a1('0xa5')]=function(_0x1d5e1f,_0xb368ab){return db[_0x53a1('0x32')]['find']({'where':{'id':_0x1d5e1f['params']['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0xb368ab,null))[_0x53a1('0x11')](function(_0x5290e2){if(_0x5290e2){return _0x5290e2[_0x53a1('0xa6')](_0x1d5e1f['body'][_0x53a1('0x93')],_[_0x53a1('0x94')](_0x1d5e1f[_0x53a1('0x2b')],['ids','id'])||{})[_0x53a1('0xa7')](function(){return db['Tag'][_0x53a1('0x37')]({'attributes':['id',_0x53a1('0x28'),_0x53a1('0xa8')],'where':{'id':_0x1d5e1f['body']['ids']}});})['then'](function(_0x190084){socket['emit'](_0x53a1('0xa9'),{'id':Number(_0x1d5e1f[_0x53a1('0x3c')]['id']),'tags':_0x190084||[]});return{'id':Number(_0x1d5e1f[_0x53a1('0x3c')]['id']),'tags':_0x190084||[]};});}})[_0x53a1('0x11')](respondWithResult(_0xb368ab,null))['catch'](handleError(_0xb368ab,null));};exports[_0x53a1('0xaa')]=function(_0xd1e900,_0x7d48d9){return db[_0x53a1('0x32')]['find']({'where':{'id':_0xd1e900[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x7d48d9,null))[_0x53a1('0x11')](function(_0x1ca795){if(_0x1ca795){return _0x1ca795[_0x53a1('0xaa')](_0xd1e900['query'][_0x53a1('0x93')]);}})[_0x53a1('0x11')](respondWithStatusCode(_0x7d48d9,null))[_0x53a1('0x1b')](handleError(_0x7d48d9,null));};exports['download']=function(_0x4eb911,_0x142525){var _0x6b3b8b=moment()['unix']()[_0x53a1('0xab')]();var _0x3b8c26=path[_0x53a1('0x73')](config['root'],'server',_0x53a1('0xac'),_0x53a1('0xad'));var _0x40bcee=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0xae'),_0x53a1('0xac'),_0x53a1('0xaf'));var _0x510d00=path[_0x53a1('0x73')](_0x3b8c26,_0x6b3b8b);var _0x53f8fd=util[_0x53a1('0x78')](_0x53a1('0xb0'),_0x4eb911['params']['id'],_0x6b3b8b);var _0x176c59=path[_0x53a1('0x73')](_0x3b8c26,_0x53f8fd);var _0x258397=[];_0x258397[_0x53a1('0xa3')]({'model':db['User'],'as':'User','attributes':['id',_0x53a1('0x51')],'raw':!![]});_0x258397[_0x53a1('0xa3')]({'model':db[_0x53a1('0x7d')],'as':_0x53a1('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4eb911[_0x53a1('0x39')][_0x53a1('0xaf')]){_0x258397[_0x53a1('0xa3')]({'model':db[_0x53a1('0x6e')],'as':_0x53a1('0x6e'),'raw':!![]});}var _0x1f4a9f=[{'model':db[_0x53a1('0x5d')],'as':'Messages','attributes':['id',_0x53a1('0x2b'),_0x53a1('0x86'),'direction','secret',_0x53a1('0xb1')],'include':_0x258397}];_0x1f4a9f['push']({'model':db[_0x53a1('0x4a')],'as':'Account','attributes':['id',_0x53a1('0x28')]});_0x1f4a9f[_0x53a1('0xa3')]({'model':db['User'],'as':_0x53a1('0xb2'),'attributes':['id',_0x53a1('0x51')]});return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x4eb911[_0x53a1('0x3c')]['id']},'include':_0x1f4a9f})['then'](handleEntityNotFound(_0x142525,null))[_0x53a1('0x11')](function(_0x52c127){if(_0x52c127){var _0x11a98b=_0x52c127['get']({'plain':!![]});fs[_0x53a1('0xb3')](_0x510d00);var _0x58f97d={'channel':_0x53a1('0xb4'),'account':_0x11a98b['Account'][_0x53a1('0x28')],'agent':_0x11a98b[_0x53a1('0xb2')]?_0x11a98b['Owner'][_0x53a1('0x51')]:'N.A.','createdAt':moment(_0x11a98b[_0x53a1('0x86')])[_0x53a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0x53a1('0xab')](),'closedAt':_0x11a98b['closed']?moment(_0x11a98b[_0x53a1('0xb5')])[_0x53a1('0x78')](_0x53a1('0x9f'))[_0x53a1('0xab')]():'','disposition':_0x11a98b['disposition'],'chatInfo':{'browser':_0x11a98b[_0x53a1('0xb6')],'os':_0x11a98b[_0x53a1('0xb7')],'referer':_0x11a98b[_0x53a1('0xb8')],'customerIp':_0x11a98b[_0x53a1('0xb9')],'customerPort':_0x11a98b['customerPort']?_0x11a98b[_0x53a1('0xba')]:_0x53a1('0xbb')},'messages':_(_0x11a98b['Messages'])[_0x53a1('0xbc')]()[_0x53a1('0x9d')]({'secret':![]})['map'](function(_0x3ee993){if(_0x3ee993[_0x53a1('0x6e')]){var _0xd8264d=path[_0x53a1('0x73')](_0x40bcee,_0x3ee993['Attachment']['basename']);if(fs[_0x53a1('0xbd')](_0xd8264d)){fs[_0x53a1('0xbe')](_0xd8264d)[_0x53a1('0xbf')](fs['createWriteStream'](path[_0x53a1('0x73')](_0x510d00,_0x3ee993['Attachment'][_0x53a1('0x6a')])));}}return{'date':moment(_0x3ee993[_0x53a1('0x86')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x53a1('0xab')](),'sender':_0x3ee993['direction']==='out'?_0x3ee993['User']?_0x3ee993['User']['fullname']:_0x53a1('0x7f'):_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc0')]+(_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc1')]?'\x20'+_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc1')]:''),'body':_0x3ee993[_0x53a1('0x6e')]?_0x3ee993[_0x53a1('0x6e')][_0x53a1('0x6a')]:_0x3ee993[_0x53a1('0x2b')],'direction':_0x3ee993['direction']===_0x53a1('0xc2')?'A':'C','secret':_0x3ee993['secret'],'read':_0x3ee993[_0x53a1('0xb1')],'attachment':_0x3ee993[_0x53a1('0x6e')]};})[_0x53a1('0xc3')]()};return ejs[_0x53a1('0xc4')](path[_0x53a1('0x73')](config[_0x53a1('0x74')],'server',_0x53a1('0xc5'),_0x53a1('0xc6')),{'interaction':_0x58f97d})[_0x53a1('0x11')](function(_0x120878){var _0x36b6b0=path['join'](_0x510d00,_0x53a1('0xc7')+_0x11a98b['id']+'-'+_0x6b3b8b+_0x53a1('0xc8'));var _0x460d21={'path':_0x36b6b0,'channel':_0x53a1('0xb4'),'interactionId':_0x11a98b['id']};return pdf[_0x53a1('0xc9')](_0x120878,_0x460d21);})[_0x53a1('0x11')](function(){return new Promise(function(_0x1fe3ce,_0x2ccedf){zipdir(_0x510d00,{'saveTo':_0x176c59},function(_0x2918c2,_0x307684){if(_0x2918c2)return _0x2ccedf(_0x2918c2);return _0x1fe3ce(_0x307684);});})['then'](function(){return new BPromise(function(_0x26d733,_0x1e7170){rimraf(_0x510d00,function(_0x42e33d){if(_0x42e33d)_0x1e7170(_0x42e33d);return _0x26d733();});});})[_0x53a1('0x11')](function(){return _0x142525[_0x53a1('0xca')](_0x176c59,_0x53f8fd,function(_0xbcb0cf){if(_0xbcb0cf){logger['error'](_0x53a1('0xcb'),_0xbcb0cf);}else{fs['unlinkSync'](_0x176c59);}});});});}else{return _0x142525[_0x53a1('0x1c')](0xc8);}})[_0x53a1('0x1b')](handleError(_0x142525,null));}; \ No newline at end of file +var _0xf378=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','json','offset','limit','count','set','destroy','sendStatus','stack','name','render','merge','interaction','account','index','ChatInteraction','fieldName','getOptions','findAll','chat','user','show','params','model','keys','rawAttributes','filters','intersection','query','fields','attributes','length','includeAll','include','options','find','create','update','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','attachId','root','offline-chat/','join','basename','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','format','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','nolimit','includeAgent','push','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','read','Account','get','mkdirSync','Chat','Owner','createdAt','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf378,0x18e));var _0x8f37=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xf378[_0x1d1779];return _0x2377e9;};'use strict';var rimraf=require(_0x8f37('0x0'));var zipdir=require(_0x8f37('0x1'));var rp=require(_0x8f37('0x2'));var moment=require('moment');var BPromise=require(_0x8f37('0x3'));var Mustache=require(_0x8f37('0x4'));var util=require(_0x8f37('0x5'));var path=require(_0x8f37('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f37('0x7'));var Redis=require('ioredis');var interaction=require(_0x8f37('0x8'));var qs=require(_0x8f37('0x9'));var pdf=require(_0x8f37('0xa'));var logger=require(_0x8f37('0xb'))(_0x8f37('0xc'));var config=require(_0x8f37('0xd'));var db=require(_0x8f37('0xe'))['db'];config['redis']=_[_0x8f37('0xf')](config['redis'],{'host':_0x8f37('0x10'),'port':0x18eb});var socket=require(_0x8f37('0x11'))(new Redis(config[_0x8f37('0x12')]));require(_0x8f37('0x13'))[_0x8f37('0x14')](socket);var jayson=require(_0x8f37('0x15'));var client=jayson[_0x8f37('0x16')][_0x8f37('0x17')]({'port':0x232b});var client9004=jayson[_0x8f37('0x16')]['http']({'port':0x232c});function respondWithRpcPromise(_0x18621b,_0x181d76,_0x57dfb5,_0x373fde){return new BPromise(function(_0x357ed7,_0x16746d){var _0xe7faaa=_0x373fde||client;return _0xe7faaa[_0x8f37('0x18')](_0x18621b,_0x57dfb5)[_0x8f37('0x19')](function(_0x485644){logger['info'](_0x8f37('0x1a'),_0x181d76,_0x8f37('0x1b'));logger[_0x8f37('0x1c')](_0x8f37('0x1d'),_0x181d76,'request\x20sent',JSON[_0x8f37('0x1e')](_0x485644));if(_0x485644[_0x8f37('0x1f')]){if(_0x485644[_0x8f37('0x1f')][_0x8f37('0x20')]===0x1f4){logger[_0x8f37('0x1f')](_0x8f37('0x1a'),_0x181d76,_0x485644[_0x8f37('0x1f')][_0x8f37('0x21')]);return _0x16746d(_0x485644[_0x8f37('0x1f')][_0x8f37('0x21')]);}logger[_0x8f37('0x1f')](_0x8f37('0x1a'),_0x181d76,_0x485644['error'][_0x8f37('0x21')]);return _0x357ed7(_0x485644[_0x8f37('0x1f')][_0x8f37('0x21')]);}else{logger[_0x8f37('0x22')](_0x8f37('0x1a'),_0x181d76,'request\x20sent');_0x357ed7(_0x485644[_0x8f37('0x23')]['message']);}})[_0x8f37('0x24')](function(_0x4ca8e9){logger[_0x8f37('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x181d76,_0x4ca8e9);_0x16746d(_0x4ca8e9);});});}function respondWithStatusCode(_0x36017b,_0x6c4025){_0x6c4025=_0x6c4025||0xcc;return function(_0x3cb24e){if(_0x3cb24e){return _0x36017b['sendStatus'](_0x6c4025);}return _0x36017b['status'](_0x6c4025)[_0x8f37('0x25')]();};}function respondWithResult(_0xf8475e,_0xaf1ff4){_0xaf1ff4=_0xaf1ff4||0xc8;return function(_0x20cc37){if(_0x20cc37){return _0xf8475e[_0x8f37('0x26')](_0xaf1ff4)[_0x8f37('0x27')](_0x20cc37);}};}function respondWithFilteredResult(_0x517bc4,_0x1f436c){return function(_0xc5ca7a){if(_0xc5ca7a){var _0x528383=typeof _0x1f436c[_0x8f37('0x28')]==='undefined'&&typeof _0x1f436c[_0x8f37('0x29')]==='undefined';var _0x15ab23=_0xc5ca7a[_0x8f37('0x2a')];var _0x34881a=_0x528383?0x0:_0x1f436c[_0x8f37('0x28')];var _0x132573=_0x528383?_0xc5ca7a['count']:_0x1f436c[_0x8f37('0x28')]+_0x1f436c[_0x8f37('0x29')];var _0x192c94;if(_0x132573>=_0x15ab23){_0x132573=_0x15ab23;_0x192c94=0xc8;}else{_0x192c94=0xce;}_0x517bc4[_0x8f37('0x26')](_0x192c94);return _0x517bc4[_0x8f37('0x2b')]('Content-Range',_0x34881a+'-'+_0x132573+'/'+_0x15ab23)['json'](_0xc5ca7a);}return null;};}function saveUpdates(_0x147ada){return function(_0xe98fd7){if(_0xe98fd7){return _0xe98fd7['update'](_0x147ada)[_0x8f37('0x19')](function(_0x52852b){return _0x52852b;});}return null;};}function removeEntity(_0x2fb30a){return function(_0xbde708){if(_0xbde708){return _0xbde708[_0x8f37('0x2c')]()[_0x8f37('0x19')](function(){_0x2fb30a[_0x8f37('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff8a68){return function(_0x38087e){if(!_0x38087e){_0xff8a68[_0x8f37('0x2d')](0x194);}return _0x38087e;};}function handleError(_0x26b5eb,_0x373faf){_0x373faf=_0x373faf||0x1f4;return function(_0x4614c0){logger[_0x8f37('0x1f')](_0x4614c0[_0x8f37('0x2e')]);if(_0x4614c0[_0x8f37('0x2f')]){delete _0x4614c0[_0x8f37('0x2f')];}_0x26b5eb['status'](_0x373faf)['send'](_0x4614c0);};}function getMustacheRender(_0x44abab,_0x36c9b0){return Mustache[_0x8f37('0x30')](_0x44abab,_[_0x8f37('0x31')](_0x36c9b0['body'],{'contact':_0x36c9b0['contact'],'message':_0x36c9b0[_0x8f37('0x21')],'agent':_0x36c9b0['agent'],'interaction':_0x36c9b0[_0x8f37('0x32')],'account':_0x36c9b0[_0x8f37('0x33')]}))||'';}exports[_0x8f37('0x34')]=function(_0x1d5e13,_0x4da227){var _0x1cd378={};var _0x7c0249=_['map'](db[_0x8f37('0x35')]['rawAttributes'],function(_0x22fd6f){return{'name':_0x22fd6f[_0x8f37('0x36')],'type':_0x22fd6f['type']['key']};});_0x1cd378=qs[_0x8f37('0x37')](_0x7c0249,_0x1d5e13);return interaction[_0x8f37('0x38')](_0x8f37('0x39'),_0x1d5e13['query'],_0x1d5e13[_0x8f37('0x3a')],_0x1cd378,_0x7c0249)[_0x8f37('0x19')](respondWithFilteredResult(_0x4da227,_0x1cd378))[_0x8f37('0x24')](handleError(_0x4da227,null));};exports[_0x8f37('0x3b')]=function(_0x230351,_0x3968bf){var _0x1549ec={'raw':![],'where':{'id':_0x230351[_0x8f37('0x3c')]['id']}},_0x3830c4={};_0x3830c4[_0x8f37('0x3d')]=_[_0x8f37('0x3e')](db[_0x8f37('0x35')][_0x8f37('0x3f')]);_0x3830c4['query']=_[_0x8f37('0x3e')](_0x230351['query']);_0x3830c4[_0x8f37('0x40')]=_[_0x8f37('0x41')](_0x3830c4[_0x8f37('0x3d')],_0x3830c4[_0x8f37('0x42')]);_0x1549ec['attributes']=_['intersection'](_0x3830c4[_0x8f37('0x3d')],qs[_0x8f37('0x43')](_0x230351[_0x8f37('0x42')][_0x8f37('0x43')]));_0x1549ec[_0x8f37('0x44')]=_0x1549ec[_0x8f37('0x44')][_0x8f37('0x45')]?_0x1549ec[_0x8f37('0x44')]:_0x3830c4['model'];if(_0x230351['query'][_0x8f37('0x46')]){_0x1549ec[_0x8f37('0x47')]=[{'all':!![]}];}_0x1549ec=_['merge']({},_0x1549ec,_0x230351[_0x8f37('0x48')]);return db[_0x8f37('0x35')][_0x8f37('0x49')](_0x1549ec)['then'](handleEntityNotFound(_0x3968bf,null))[_0x8f37('0x19')](respondWithResult(_0x3968bf,null))[_0x8f37('0x24')](handleError(_0x3968bf,null));};exports[_0x8f37('0x4a')]=function(_0x401c5f,_0x14e43f){return db[_0x8f37('0x35')][_0x8f37('0x4a')](_0x401c5f['body'],{})[_0x8f37('0x19')](respondWithResult(_0x14e43f,0xc9))[_0x8f37('0x24')](handleError(_0x14e43f,null));};exports[_0x8f37('0x4b')]=function(_0x410dd4,_0xbccb24){if(_0x410dd4[_0x8f37('0x4c')]['id']){delete _0x410dd4['body']['id'];}return db[_0x8f37('0x35')][_0x8f37('0x49')]({'where':{'id':_0x410dd4[_0x8f37('0x3c')]['id']}})[_0x8f37('0x19')](handleEntityNotFound(_0xbccb24,null))[_0x8f37('0x19')](saveUpdates(_0x410dd4[_0x8f37('0x4c')],null))['then'](respondWithResult(_0xbccb24,null))[_0x8f37('0x24')](handleError(_0xbccb24,null));};exports[_0x8f37('0x2c')]=function(_0x1a5d68,_0xbeec17){return db[_0x8f37('0x35')][_0x8f37('0x49')]({'where':{'id':_0x1a5d68[_0x8f37('0x3c')]['id']}})[_0x8f37('0x19')](handleEntityNotFound(_0xbeec17,null))[_0x8f37('0x19')](removeEntity(_0xbeec17,null))[_0x8f37('0x24')](handleError(_0xbeec17,null));};exports['describe']=function(_0x654d8e,_0x82b688){return db['ChatInteraction'][_0x8f37('0x4d')]()[_0x8f37('0x19')](respondWithResult(_0x82b688,null))[_0x8f37('0x24')](handleError(_0x82b688,null));};exports[_0x8f37('0x4e')]=function(_0x2cd9ea,_0x533ef2){var _0x474331=_0x2cd9ea[_0x8f37('0x3c')]['id'];var _0x39e9e4;var _0x1921df;var _0x673b7d;return db[_0x8f37('0x35')][_0x8f37('0x4f')]({'where':{'id':_0x474331}})['then'](function(_0x2856ff){_0x39e9e4=_0x2856ff;return db[_0x8f37('0x50')][_0x8f37('0x4f')]({'where':{'id':_0x2856ff[_0x8f37('0x51')]},'attributes':['id',_0x8f37('0x52'),_0x8f37('0x53'),_0x8f37('0x54'),_0x8f37('0x55'),'vidaooMetadata'],'raw':!![]});})[_0x8f37('0x19')](function(_0xb14342){if(_0xb14342&&_0xb14342['vidaooApiKey']&&_0xb14342[_0x8f37('0x53')]){_0x1921df=_0xb14342;var _0x1797b2={'interaction':{'id':_0x474331},'agent':{'id':_0x2cd9ea[_0x8f37('0x3a')]['id'],'name':_0x2cd9ea[_0x8f37('0x3a')][_0x8f37('0x2f')],'fullname':_0x2cd9ea['user'][_0x8f37('0x56')],'email':_0x2cd9ea[_0x8f37('0x3a')]['email']},'contact':_0x2cd9ea[_0x8f37('0x4c')][_0x8f37('0x57')],'account':_0x2cd9ea[_0x8f37('0x4c')]['account']};var _0x7cad03={'rejectUnauthorized':![],'method':_0x8f37('0x58'),'url':_0x8f37('0x59'),'headers':{'X-APIKEY':_0xb14342['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2cd9ea[_0x8f37('0x3a')][_0x8f37('0x5a')]],'buttons':null,'topic':_0x1921df['vidaooTopic'],'note':_['isNull'](_0x1921df[_0x8f37('0x55')])?null:getMustacheRender(_0x1921df[_0x8f37('0x55')],_0x1797b2),'metadata':null},'redirect':_0x8f37('0x5b'),'json':!![]};try{if(!_[_0x8f37('0x5c')](_0x1921df[_0x8f37('0x5d')])){var _0x5eb841=getMustacheRender(_0x1921df['vidaooMetadata'],_0x1797b2);var _0x1043a5=JSON[_0x8f37('0x5e')](_0x5eb841);_0x7cad03['body'][_0x8f37('0x5f')]=_0x1043a5;}}catch(_0xf26cd2){throw new db[(_0x8f37('0x60'))][(_0x8f37('0x61'))](_0x8f37('0x62'));}return rp(_0x7cad03);}else{throw new db['Sequelize'][(_0x8f37('0x61'))](_0x8f37('0x63'));}})[_0x8f37('0x19')](function(_0xe7b740){_0x673b7d=_0xe7b740;if(_0x673b7d['id']){var _0x475f2f={'body':_0x673b7d['join_url'],'ChatWebsiteId':_0x1921df['id'],'ChatInteractionId':_0x39e9e4['id'],'direction':_0x8f37('0x64'),'UserId':_0x2cd9ea[_0x8f37('0x3a')]['id']};return db[_0x8f37('0x65')][_0x8f37('0x4a')](_0x475f2f,{});}else{throw new db['Sequelize']['ValidationError'](_0x8f37('0x66'));}})['then'](function(){return _0x39e9e4['updateAttributes']({'vidaooSessionId':_0x673b7d['id']});})[_0x8f37('0x19')](respondWithResult(_0x533ef2,null))[_0x8f37('0x24')](handleError(_0x533ef2,null));};exports[_0x8f37('0x67')]=function(_0x434e26,_0x1eaef8){if(_0x434e26[_0x8f37('0x4c')]['id']){delete _0x434e26[_0x8f37('0x4c')]['id'];}return db[_0x8f37('0x35')]['find']({'where':{'id':_0x434e26[_0x8f37('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x8f37('0x68')}]})[_0x8f37('0x19')](handleEntityNotFound(_0x1eaef8,null))['then'](saveUpdates(_0x434e26[_0x8f37('0x4c')],null))[_0x8f37('0x19')](respondWithResult(_0x1eaef8,null))[_0x8f37('0x24')](handleError(_0x1eaef8,null));};exports[_0x8f37('0x69')]=function(_0x34a77f,_0x4bd5c6){if(_0x34a77f[_0x8f37('0x4c')]['id']){delete _0x34a77f[_0x8f37('0x4c')]['id'];}return db[_0x8f37('0x35')][_0x8f37('0x49')]({'where':{'id':_0x34a77f[_0x8f37('0x3c')]['id']}})[_0x8f37('0x19')](function(_0x493039){if(!_0x493039){logger['error'](_0x8f37('0x6a'),_0x8f37('0x69'),0x194,'entity\x20not\x20found');_0x4bd5c6[_0x8f37('0x2d')](0x194);}else{if(_0x493039[_0x8f37('0x6b')]){throw new db[(_0x8f37('0x60'))][(_0x8f37('0x61'))](_0x8f37('0x6c'));}}return _0x493039;})[_0x8f37('0x19')](function(_0x57d41e){if(_0x57d41e){return _0x57d41e[_0x8f37('0x4b')]({'closed':_0x34a77f[_0x8f37('0x4c')][_0x8f37('0x6d')],'disposition':_0x34a77f['body']['disposition']})[_0x8f37('0x19')](function(_0x4f75da){return _0x4f75da;});}})[_0x8f37('0x19')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x34a77f[_0x8f37('0x4c')],client9004);})[_0x8f37('0x19')](respondWithResult(_0x4bd5c6,null))[_0x8f37('0x24')](handleError(_0x4bd5c6,null));};exports[_0x8f37('0x6e')]=function(_0x12f335,_0x1d360f){_0x12f335[_0x8f37('0x4c')][_0x8f37('0x2f')]=_0x12f335[_0x8f37('0x6f')][_0x8f37('0x70')];_0x12f335['body']['basename']=_0x12f335[_0x8f37('0x6f')][_0x8f37('0x71')];_0x12f335['body']['type']=_0x12f335[_0x8f37('0x6f')]['mimetype'];return db[_0x8f37('0x72')][_0x8f37('0x4a')](_0x12f335[_0x8f37('0x4c')])[_0x8f37('0x19')](respondWithResult(_0x1d360f,0xc9))[_0x8f37('0x24')](handleError(_0x1d360f,null));};exports[_0x8f37('0x73')]=function(_0x5e4dbc,_0x430ac9){return db['ChatInteraction']['findOne']({'where':{'id':_0x5e4dbc['params']['id']},'raw':!![]})[_0x8f37('0x19')](handleEntityNotFound(_0x430ac9,null))[_0x8f37('0x19')](function(_0x4e3a0e){if(_0x4e3a0e){if(_0x4e3a0e[_0x8f37('0x6d')]){return _0x430ac9[_0x8f37('0x26')](0x193)[_0x8f37('0x27')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment']['findOne']({'where':{'id':_0x5e4dbc[_0x8f37('0x42')][_0x8f37('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x430ac9,null));}})[_0x8f37('0x19')](function(_0x1b11d6){if(_0x1b11d6){var _0x5c65db=_0x1b11d6['ChatOfflineMessageId']!==null;var _0x193f82=path['join'](config[_0x8f37('0x75')],'server/files/attachments/');if(_0x5c65db){_0x193f82=path['join'](_0x193f82,_0x8f37('0x76'));}var _0xdb5263=path[_0x8f37('0x77')](_0x193f82,_0x1b11d6[_0x8f37('0x78')]);return _0x430ac9[_0x8f37('0x79')](_0xdb5263);}})[_0x8f37('0x24')](handleError(_0x430ac9,null));};exports[_0x8f37('0x7a')]=function(_0x290056,_0x55c272){var _0x34b2be=null;var _0x19a697=null;var _0x280a59=null;if(_0x290056[_0x8f37('0x4c')]['id']){delete _0x290056[_0x8f37('0x4c')]['id'];}if(_0x290056[_0x8f37('0x4c')][_0x8f37('0x7b')]){_0x280a59=path[_0x8f37('0x77')](config[_0x8f37('0x75')],_0x8f37('0x7c'),util['format'](_0x8f37('0x7d'),Date[_0x8f37('0x7e')]()));_0x290056[_0x8f37('0x4c')][_0x8f37('0x7f')]=_0x280a59;}return db[_0x8f37('0x35')][_0x8f37('0x49')]({'where':{'id':_0x290056[_0x8f37('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x8f37('0x80'),'include':[{'model':db[_0x8f37('0x81')],'as':_0x8f37('0x81')}]}]})[_0x8f37('0x19')](handleEntityNotFound(_0x55c272,null))[_0x8f37('0x19')](saveUpdates(_0x290056[_0x8f37('0x4c')],null))[_0x8f37('0x19')](function(_0x458b96){if(_0x458b96){_0x34b2be=_0x458b96;return db['ChatWebsite']['find']({'where':{'id':_0x34b2be['ChatWebsiteId']}});}})[_0x8f37('0x19')](function(_0x1461b9){if(_0x1461b9){_0x19a697=_0x1461b9;return db[_0x8f37('0x82')]['find']({'where':{'id':_0x34b2be[_0x8f37('0x83')]}});}})[_0x8f37('0x19')](function(_0x24460b){if(_0x24460b){if(_0x280a59){var _0x20b824=null;for(var _0xf799f=0x1;_0xf799f<_0x34b2be[_0x8f37('0x80')]['length'];++_0xf799f){_0x20b824=_0x34b2be[_0x8f37('0x80')][_0xf799f];var _0x35373a=_0x20b824['UserId']?util[_0x8f37('0x84')]('%s%d',_0x19a697[_0x8f37('0x85')],_0x20b824[_0x8f37('0x6b')]):_0x8f37('0x86');var _0x4ac5c6=_0x290056[_0x8f37('0x4c')][_0x8f37('0x87')]||util['format'](_0x8f37('0x88'),_0x8f37('0x89'),_0x20b824[_0x8f37('0x83')]);switch(_0x19a697[_0x8f37('0x8a')]){case _0x8f37('0x8b'):_0x35373a=_0x20b824[_0x8f37('0x6b')]?util[_0x8f37('0x84')](_0x8f37('0x88'),_0x19a697[_0x8f37('0x85')],_0x20b824[_0x8f37('0x6b')]):_0x8f37('0x86');break;case _0x8f37('0x8c'):_0x35373a=_0x20b824['UserId']?_0x20b824[_0x8f37('0x81')][_0x8f37('0x8d')]||_0x20b824[_0x8f37('0x81')][_0x8f37('0x56')]:_0x8f37('0x86');break;case _0x8f37('0x8e'):_0x35373a=_0x20b824[_0x8f37('0x6b')]?_0x20b824[_0x8f37('0x81')][_0x8f37('0x56')]:'System';break;default:_0x35373a=_0x20b824[_0x8f37('0x6b')]?util[_0x8f37('0x84')]('%s%d',_0x19a697[_0x8f37('0x85')],_0x20b824[_0x8f37('0x6b')]):_0x8f37('0x86');}var _0x5ce2ec=util[_0x8f37('0x84')](_0x8f37('0x8f'),moment(_0x20b824['createdAt'])[_0x8f37('0x84')]('MM/DD/YYYY\x20HH:mm:ss'),_0x20b824[_0x8f37('0x90')]==='in'?_0x4ac5c6:_0x35373a,_0x20b824['body']);if(!_0x20b824[_0x8f37('0x91')]){fs[_0x8f37('0x92')](_0x280a59,_0x5ce2ec);}}return db[_0x8f37('0x93')][_0x8f37('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0x8f37('0x94')],'as':_0x8f37('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8f37('0x96'),'raw':!![]}]}]});}}})['then'](function(_0x43f16f){if(!_0x43f16f||!_0x43f16f[_0x8f37('0x95')]||!_0x290056[_0x8f37('0x4c')])return _0x34b2be;var _0x414cff=_0x43f16f['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x414cff,'message':{'from':util['format'](_0x8f37('0x97'),_0x43f16f[_0x8f37('0x2f')],_0x43f16f[_0x8f37('0x5a')]||_0x43f16f['Smtp'][_0x8f37('0x3a')]),'to':_0x290056[_0x8f37('0x4c')][_0x8f37('0x7b')],'subject':_0x8f37('0x98'),'text':util[_0x8f37('0x84')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x290056[_0x8f37('0x4c')]['mailTranscript']),'attachments':[{'path':_0x280a59}]}})['then'](function(){return _0x34b2be;})[_0x8f37('0x24')](function(_0x56bade){logger[_0x8f37('0x1f')](_0x56bade);});})[_0x8f37('0x19')](respondWithStatusCode(_0x55c272,0xc8))[_0x8f37('0x24')](handleError(_0x55c272,null));};exports[_0x8f37('0x99')]=function(_0x1b0343,_0x15b4fc){return db[_0x8f37('0x65')][_0x8f37('0x49')]({'where':{'id':_0x1b0343[_0x8f37('0x3c')]['id']}})[_0x8f37('0x19')](handleEntityNotFound(_0x15b4fc,null))[_0x8f37('0x19')](function(_0x3f0510){if(_0x3f0510){return _0x3f0510['addMessage'](_0x1b0343[_0x8f37('0x4c')][_0x8f37('0x9a')],_[_0x8f37('0x9b')](_0x1b0343[_0x8f37('0x4c')],[_0x8f37('0x9a'),'id'])||{});}})[_0x8f37('0x19')](respondWithResult(_0x15b4fc,null))[_0x8f37('0x24')](handleError(_0x15b4fc,null));};exports[_0x8f37('0x9c')]=function(_0x4431b2,_0x14f091){var _0x1809f5={'raw':![],'where':{}};var _0x38d0f3={};var _0x14ff6c={'count':0x0,'rows':[]};return db[_0x8f37('0x35')][_0x8f37('0x4f')]({'where':{'id':_0x4431b2['params']['id']}})[_0x8f37('0x19')](handleEntityNotFound(_0x14f091,null))[_0x8f37('0x19')](function(_0x4909f3){if(_0x4909f3){_0x38d0f3[_0x8f37('0x3d')]=_[_0x8f37('0x3e')](db[_0x8f37('0x65')]['rawAttributes']);_0x38d0f3['query']=_[_0x8f37('0x3e')](_0x4431b2[_0x8f37('0x42')]);_0x38d0f3[_0x8f37('0x40')]=_[_0x8f37('0x41')](_0x38d0f3[_0x8f37('0x3d')],_0x38d0f3['query']);_0x1809f5[_0x8f37('0x44')]=_[_0x8f37('0x41')](_0x38d0f3[_0x8f37('0x3d')],qs['fields'](_0x4431b2[_0x8f37('0x42')]['fields']));_0x1809f5[_0x8f37('0x44')]=_0x1809f5[_0x8f37('0x44')]['length']?_0x1809f5[_0x8f37('0x44')]:_0x38d0f3[_0x8f37('0x3d')];if(!_0x4431b2['query'][_0x8f37('0x9d')]('nolimit')){_0x1809f5[_0x8f37('0x29')]=qs[_0x8f37('0x29')](_0x4431b2[_0x8f37('0x42')][_0x8f37('0x29')]);_0x1809f5[_0x8f37('0x28')]=qs[_0x8f37('0x28')](_0x4431b2['query'][_0x8f37('0x28')]);}_0x1809f5[_0x8f37('0x9e')]=qs['sort'](_0x4431b2[_0x8f37('0x42')][_0x8f37('0x9f')]);_0x1809f5[_0x8f37('0xa0')]=qs['filters'](_[_0x8f37('0xa1')](_0x4431b2[_0x8f37('0x42')],_0x38d0f3[_0x8f37('0x40')]));_0x1809f5[_0x8f37('0xa0')][_0x8f37('0xa2')]=_0x4909f3['id'];if(_0x4431b2[_0x8f37('0x42')][_0x8f37('0xa3')]){_0x1809f5[_0x8f37('0xa0')]=_[_0x8f37('0x31')](_0x1809f5[_0x8f37('0xa0')],{'$or':_[_0x8f37('0xa4')](_0x1809f5[_0x8f37('0x44')],function(_0x2c108f){var _0x3cd7d0={};_0x3cd7d0[_0x2c108f]={'$like':'%'+_0x4431b2[_0x8f37('0x42')][_0x8f37('0xa3')]+'%'};return _0x3cd7d0;})});}if(_0x4431b2[_0x8f37('0x42')][_0x8f37('0xa5')]){var _0xc3e13f=_0x4431b2['query'][_0x8f37('0xa5')][_0x8f37('0xa6')](',');var _0x40bf79={};_0x40bf79[_0xc3e13f[0x0]]={'$gte':moment(_0xc3e13f[0x1])[_0x8f37('0x84')](_0x8f37('0xa7'))};_0x1809f5[_0x8f37('0xa0')]=_[_0x8f37('0x31')](_0x1809f5[_0x8f37('0xa0')],_0x40bf79);}_0x1809f5=_[_0x8f37('0x31')]({},_0x1809f5,_0x4431b2[_0x8f37('0x48')]);return db['ChatMessage'][_0x8f37('0x2a')]({'where':_0x1809f5['where']})[_0x8f37('0x19')](function(_0x3d1455){_0x14ff6c[_0x8f37('0x2a')]=_0x3d1455;if(_0x4431b2[_0x8f37('0x42')][_0x8f37('0x46')]){_0x1809f5['include']=[{'all':!![]}];}return db[_0x8f37('0x65')][_0x8f37('0x38')](_0x1809f5);})[_0x8f37('0x19')](function(_0x5d6f2f){_0x14ff6c['rows']=_0x5d6f2f;return _0x14ff6c;});}})['then'](respondWithFilteredResult(_0x14f091,_0x1809f5))[_0x8f37('0x24')](handleError(_0x14f091,null));};exports[_0x8f37('0xa8')]=function(_0x3c9552,_0xe98a86){var _0x4a459d={'where':{}},_0x33c8d6={},_0x5ebb6e={'count':0x0,'rows':[]};return db[_0x8f37('0x35')][_0x8f37('0x4f')]({'where':{'id':_0x3c9552[_0x8f37('0x3c')]['id']}})['then'](handleEntityNotFound(_0xe98a86,null))[_0x8f37('0x19')](function(_0x1a005d){if(_0x1a005d){_0x33c8d6[_0x8f37('0x3d')]=_['keys'](db[_0x8f37('0x65')]['rawAttributes']);_0x33c8d6[_0x8f37('0x42')]=_[_0x8f37('0x3e')](_0x3c9552[_0x8f37('0x42')]);_0x33c8d6['filters']=_[_0x8f37('0x41')](_0x33c8d6[_0x8f37('0x3d')],_0x33c8d6[_0x8f37('0x42')]);_0x4a459d[_0x8f37('0x44')]=_[_0x8f37('0x41')](_0x33c8d6['model'],qs[_0x8f37('0x43')](_0x3c9552[_0x8f37('0x42')][_0x8f37('0x43')]));_0x4a459d[_0x8f37('0x44')]=_0x4a459d[_0x8f37('0x44')][_0x8f37('0x45')]?_0x4a459d[_0x8f37('0x44')]:_0x33c8d6[_0x8f37('0x3d')];if(!_0x3c9552[_0x8f37('0x42')]['hasOwnProperty'](_0x8f37('0xa9'))){_0x4a459d[_0x8f37('0x29')]=qs[_0x8f37('0x29')](_0x3c9552[_0x8f37('0x42')]['limit']);_0x4a459d[_0x8f37('0x28')]=qs[_0x8f37('0x28')](_0x3c9552[_0x8f37('0x42')][_0x8f37('0x28')]);}_0x4a459d[_0x8f37('0x9e')]=qs[_0x8f37('0x9f')](_0x3c9552[_0x8f37('0x42')][_0x8f37('0x9f')]);_0x4a459d[_0x8f37('0xa0')]=qs['filters'](_['pick'](_0x3c9552[_0x8f37('0x42')],_0x33c8d6['filters']));_0x4a459d[_0x8f37('0xa0')][_0x8f37('0xa2')]=_0x1a005d['id'];if(_0x3c9552['query'][_0x8f37('0xa3')]){_0x4a459d[_0x8f37('0xa0')]=_[_0x8f37('0x31')](_0x4a459d['where'],{'$or':_[_0x8f37('0xa4')](_0x4a459d[_0x8f37('0x44')],function(_0x26292e){var _0x1cec20={};_0x1cec20[_0x26292e]={'$like':'%'+_0x3c9552[_0x8f37('0x42')][_0x8f37('0xa3')]+'%'};return _0x1cec20;})});}_0x4a459d[_0x8f37('0xa0')][_0x8f37('0x91')]=![];if(_0x3c9552[_0x8f37('0x42')]['id']){_0x4a459d['where']['id']={'$gt':_0x3c9552['query']['id']};}_0x4a459d=_[_0x8f37('0x31')]({},_0x4a459d,_0x3c9552['options']);return db[_0x8f37('0x65')][_0x8f37('0x2a')]({'where':_0x4a459d[_0x8f37('0xa0')]})[_0x8f37('0x19')](function(_0x33cac2){_0x5ebb6e[_0x8f37('0x2a')]=_0x33cac2;_0x4a459d[_0x8f37('0x47')]=[];if(_0x3c9552[_0x8f37('0x42')][_0x8f37('0xaa')]){_0x4a459d['include'][_0x8f37('0xab')]({'model':db[_0x8f37('0x81')],'as':'User','attributes':['id',_0x8f37('0x56'),'alias']});}if(_0x3c9552['query'][_0x8f37('0x46')]){_0x4a459d[_0x8f37('0x47')]=[{'all':!![]}];}return db[_0x8f37('0x65')][_0x8f37('0x38')](_0x4a459d);})[_0x8f37('0x19')](function(_0x597edf){_0x5ebb6e['rows']=_0x597edf;return _0x5ebb6e;});}})[_0x8f37('0x19')](respondWithFilteredResult(_0xe98a86,_0x4a459d))[_0x8f37('0x24')](handleError(_0xe98a86,null));};exports[_0x8f37('0xac')]=function(_0x486ade,_0x32ad3b){return db['ChatInteraction'][_0x8f37('0x49')]({'where':{'id':_0x486ade[_0x8f37('0x3c')]['id']}})[_0x8f37('0x19')](handleEntityNotFound(_0x32ad3b,null))[_0x8f37('0x19')](function(_0x72fc5e){if(_0x72fc5e){return _0x72fc5e[_0x8f37('0xad')](_0x486ade['body'][_0x8f37('0x9a')],_['omit'](_0x486ade[_0x8f37('0x4c')],['ids','id'])||{})[_0x8f37('0xae')](function(){return db[_0x8f37('0xaf')]['findAll']({'attributes':['id',_0x8f37('0x2f'),'color'],'where':{'id':_0x486ade['body'][_0x8f37('0x9a')]}});})[_0x8f37('0x19')](function(_0x4d7bc2){socket[_0x8f37('0xb0')](_0x8f37('0xb1'),{'id':Number(_0x486ade[_0x8f37('0x3c')]['id']),'tags':_0x4d7bc2||[]});return{'id':Number(_0x486ade['params']['id']),'tags':_0x4d7bc2||[]};});}})[_0x8f37('0x19')](respondWithResult(_0x32ad3b,null))[_0x8f37('0x24')](handleError(_0x32ad3b,null));};exports[_0x8f37('0xb2')]=function(_0x3cbe49,_0x31ee87){return db[_0x8f37('0x35')][_0x8f37('0x49')]({'where':{'id':_0x3cbe49[_0x8f37('0x3c')]['id']}})['then'](handleEntityNotFound(_0x31ee87,null))[_0x8f37('0x19')](function(_0x46553b){if(_0x46553b){return _0x46553b[_0x8f37('0xb2')](_0x3cbe49[_0x8f37('0x42')][_0x8f37('0x9a')]);}})[_0x8f37('0x19')](respondWithStatusCode(_0x31ee87,null))[_0x8f37('0x24')](handleError(_0x31ee87,null));};exports[_0x8f37('0x79')]=function(_0x18755e,_0x9ca19b){var _0x37e8be=moment()[_0x8f37('0xb3')]()[_0x8f37('0xb4')]();var _0x53a9f1=path[_0x8f37('0x77')](config[_0x8f37('0x75')],_0x8f37('0xb5'),_0x8f37('0xb6'),_0x8f37('0xb7'));var _0xbe2b04=path[_0x8f37('0x77')](config[_0x8f37('0x75')],_0x8f37('0xb5'),'files',_0x8f37('0xb8'));var _0x46f1ac=path[_0x8f37('0x77')](_0x53a9f1,_0x37e8be);var _0x234344=util[_0x8f37('0x84')](_0x8f37('0xb9'),_0x18755e[_0x8f37('0x3c')]['id'],_0x37e8be);var _0x5618a5=path[_0x8f37('0x77')](_0x53a9f1,_0x234344);var _0x4cc480=[];_0x4cc480[_0x8f37('0xab')]({'model':db[_0x8f37('0x81')],'as':_0x8f37('0x81'),'attributes':['id',_0x8f37('0x56')],'raw':!![]});_0x4cc480[_0x8f37('0xab')]({'model':db[_0x8f37('0x82')],'as':_0x8f37('0x68'),'attributes':['id',_0x8f37('0xba'),'lastName'],'raw':!![]});if(_0x18755e['query'][_0x8f37('0xb8')]){_0x4cc480[_0x8f37('0xab')]({'model':db['Attachment'],'as':_0x8f37('0x72'),'raw':!![]});}var _0x30a794=[{'model':db[_0x8f37('0x65')],'as':_0x8f37('0x80'),'attributes':['id','body','createdAt',_0x8f37('0x90'),'secret',_0x8f37('0xbb')],'include':_0x4cc480}];_0x30a794[_0x8f37('0xab')]({'model':db[_0x8f37('0x50')],'as':_0x8f37('0xbc'),'attributes':['id','name']});_0x30a794[_0x8f37('0xab')]({'model':db[_0x8f37('0x81')],'as':'Owner','attributes':['id',_0x8f37('0x56')]});return db['ChatInteraction']['find']({'where':{'id':_0x18755e['params']['id']},'include':_0x30a794})[_0x8f37('0x19')](handleEntityNotFound(_0x9ca19b,null))[_0x8f37('0x19')](function(_0x11c9bd){if(_0x11c9bd){var _0x1cf4e3=_0x11c9bd[_0x8f37('0xbd')]({'plain':!![]});fs[_0x8f37('0xbe')](_0x46f1ac);var _0x55c5b8={'channel':_0x8f37('0xbf'),'account':_0x1cf4e3[_0x8f37('0xbc')]['name'],'agent':_0x1cf4e3[_0x8f37('0xc0')]?_0x1cf4e3[_0x8f37('0xc0')]['fullname']:'N.A.','createdAt':moment(_0x1cf4e3[_0x8f37('0xc1')])[_0x8f37('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8f37('0xb4')](),'closedAt':_0x1cf4e3[_0x8f37('0x6d')]?moment(_0x1cf4e3['closedAt'])[_0x8f37('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8f37('0xb4')]():'','disposition':_0x1cf4e3[_0x8f37('0xc2')],'chatInfo':{'browser':_0x1cf4e3[_0x8f37('0xc3')],'os':_0x1cf4e3[_0x8f37('0xc4')],'referer':_0x1cf4e3[_0x8f37('0xc5')],'customerIp':_0x1cf4e3[_0x8f37('0xc6')],'customerPort':_0x1cf4e3[_0x8f37('0xc7')]?_0x1cf4e3['customerPort']:_0x8f37('0xc8')},'messages':_(_0x1cf4e3[_0x8f37('0x80')])['tail']()[_0x8f37('0xa3')]({'secret':![]})[_0x8f37('0xa4')](function(_0x48bb0f){if(_0x48bb0f[_0x8f37('0x72')]){var _0x4f46c1=path['join'](_0xbe2b04,_0x48bb0f[_0x8f37('0x72')]['basename']);if(fs[_0x8f37('0xc9')](_0x4f46c1)){fs[_0x8f37('0xca')](_0x4f46c1)[_0x8f37('0xcb')](fs['createWriteStream'](path['join'](_0x46f1ac,_0x48bb0f['Attachment'][_0x8f37('0x78')])));}}return{'date':moment(_0x48bb0f[_0x8f37('0xc1')])[_0x8f37('0x84')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x48bb0f[_0x8f37('0x90')]===_0x8f37('0x64')?_0x48bb0f['User']?_0x48bb0f[_0x8f37('0x81')][_0x8f37('0x56')]:'System':_0x48bb0f[_0x8f37('0x68')][_0x8f37('0xba')]+(_0x48bb0f['Contact'][_0x8f37('0xcc')]?'\x20'+_0x48bb0f[_0x8f37('0x68')][_0x8f37('0xcc')]:''),'body':_0x48bb0f[_0x8f37('0x72')]?_0x48bb0f['Attachment'][_0x8f37('0x78')]:_0x48bb0f[_0x8f37('0x4c')],'direction':_0x48bb0f['direction']===_0x8f37('0x64')?'A':'C','secret':_0x48bb0f['secret'],'read':_0x48bb0f[_0x8f37('0xbb')],'attachment':_0x48bb0f[_0x8f37('0x72')]};})['value']()};return ejs[_0x8f37('0xcd')](path[_0x8f37('0x77')](config['root'],'server',_0x8f37('0xce'),_0x8f37('0xcf')),{'interaction':_0x55c5b8})['then'](function(_0x347d63){var _0x2fbc35=path[_0x8f37('0x77')](_0x46f1ac,_0x8f37('0xd0')+_0x1cf4e3['id']+'-'+_0x37e8be+_0x8f37('0xd1'));var _0x5bc7fc={'path':_0x2fbc35,'channel':'Chat','interactionId':_0x1cf4e3['id']};return pdf[_0x8f37('0xd2')](_0x347d63,_0x5bc7fc);})[_0x8f37('0x19')](function(){return new Promise(function(_0x580174,_0x5caa23){zipdir(_0x46f1ac,{'saveTo':_0x5618a5},function(_0x106840,_0x2259cc){if(_0x106840)return _0x5caa23(_0x106840);return _0x580174(_0x2259cc);});})[_0x8f37('0x19')](function(){return new BPromise(function(_0x4d40a5,_0x27b231){rimraf(_0x46f1ac,function(_0x55ab6d){if(_0x55ab6d)_0x27b231(_0x55ab6d);return _0x4d40a5();});});})['then'](function(){return _0x9ca19b[_0x8f37('0x79')](_0x5618a5,_0x234344,function(_0x568cba){if(_0x568cba){logger[_0x8f37('0x1f')](_0x8f37('0xd3'),_0x568cba);}else{fs[_0x8f37('0xd4')](_0x5618a5);}});});});}else{return _0x9ca19b[_0x8f37('0x2d')](0xc8);}})[_0x8f37('0x24')](handleError(_0x9ca19b,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6053c45..7df649a 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 _0x425b=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x425b,0x191));var _0xb425=function(_0xc4ddc3,_0x4c7d3f){_0xc4ddc3=_0xc4ddc3-0x0;var _0x28045e=_0x425b[_0xc4ddc3];return _0x28045e;};'use strict';var EventEmitter=require(_0xb425('0x0'));var ChatInteraction=require(_0xb425('0x1'))['db'][_0xb425('0x2')];var ChatMessage=require(_0xb425('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb425('0x3')](0x0);var events={'afterCreate':_0xb425('0x4'),'afterUpdate':_0xb425('0x5'),'afterDestroy':'remove'};function emitEvent(_0x424a2a){return function(_0x3bee6f,_0x2b3332,_0x3177fe){_0x3bee6f[_0xb425('0x6')]({'attributes':['id'],'raw':!![]})[_0xb425('0x7')](function(_0x1d1c8e){_0x3bee6f[_0xb425('0x8')](_0xb425('0x9'),_0x1d1c8e[_0xb425('0xa')](function(_0x50bb20){return{'id':_0x50bb20['id']};}));return ChatMessage[_0xb425('0xb')]({'where':{'ChatInteractionId':_0x3bee6f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x57e9cd){_0x3bee6f['setDataValue'](_0xb425('0xc'),_0x57e9cd[_0xb425('0xd')]);ChatInteractionEvents[_0xb425('0xe')](_0x424a2a+':'+_0x3bee6f['id'],_0x3bee6f);ChatInteractionEvents['emit'](_0x424a2a,_0x3bee6f);_0x3177fe(null);})[_0xb425('0xf')](_0x3177fe(null));};}for(var e in events){if(events[_0xb425('0x10')](e)){var event=events[e];ChatInteraction[_0xb425('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xe8a7=['ChatInteraction','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0xe8a7,0x1b8));var _0x7e8a=function(_0x290578,_0x2d4981){_0x290578=_0x290578-0x0;var _0x387494=_0xe8a7[_0x290578];return _0x387494;};'use strict';var EventEmitter=require(_0x7e8a('0x0'));var ChatInteraction=require(_0x7e8a('0x1'))['db'][_0x7e8a('0x2')];var ChatMessage=require(_0x7e8a('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7e8a('0x3')](0x0);var events={'afterCreate':_0x7e8a('0x4'),'afterUpdate':_0x7e8a('0x5'),'afterDestroy':_0x7e8a('0x6')};function emitEvent(_0x576f4c){return function(_0x59436b,_0x256912,_0x2f554c){_0x59436b['getUsers']({'attributes':['id'],'raw':!![]})[_0x7e8a('0x7')](function(_0x4e87e1){_0x59436b[_0x7e8a('0x8')](_0x7e8a('0x9'),_0x4e87e1[_0x7e8a('0xa')](function(_0x22fb3f){return{'id':_0x22fb3f['id']};}));return ChatMessage[_0x7e8a('0xb')]({'where':{'ChatInteractionId':_0x59436b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7e8a('0x7')](function(_0x29700){_0x59436b[_0x7e8a('0x8')](_0x7e8a('0xc'),_0x29700[_0x7e8a('0xd')]);ChatInteractionEvents['emit'](_0x576f4c+':'+_0x59436b['id'],_0x59436b);ChatInteractionEvents[_0x7e8a('0xe')](_0x576f4c,_0x59436b);_0x2f554c(null);})[_0x7e8a('0xf')](_0x2f554c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7e8a('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 13995d0..81b0f32 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 _0xbc24=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format'];(function(_0x20d06a,_0x16b092){var _0x1c48ef=function(_0x2da6d5){while(--_0x2da6d5){_0x20d06a['push'](_0x20d06a['shift']());}};_0x1c48ef(++_0x16b092);}(_0xbc24,0x106));var _0x4bc2=function(_0x1e0ee7,_0x4c6ec9){_0x1e0ee7=_0x1e0ee7-0x0;var _0x4c8045=_0xbc24[_0x1e0ee7];return _0x4c8045;};'use strict';var _=require(_0x4bc2('0x0'));var util=require(_0x4bc2('0x1'));var logger=require(_0x4bc2('0x2'))(_0x4bc2('0x3'));var moment=require(_0x4bc2('0x4'));var BPromise=require(_0x4bc2('0x5'));var rp=require(_0x4bc2('0x6'));var fs=require('fs');var path=require(_0x4bc2('0x7'));var rimraf=require(_0x4bc2('0x8'));var config=require(_0x4bc2('0x9'));var attributes=require(_0x4bc2('0xa'));module[_0x4bc2('0xb')]=function(_0x1b9baf,_0x38778c){return _0x1b9baf[_0x4bc2('0xc')](_0x4bc2('0xd'),attributes,{'tableName':_0x4bc2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9239,_0x25808c,_0x1fe0ec){if(_0x5b9239[_0x4bc2('0xf')]('closed')){_0x5b9239[_0x4bc2('0x10')]=moment()[_0x4bc2('0x11')](_0x4bc2('0x12'));}_0x1fe0ec(null,_0x5b9239);}},'charset':_0x4bc2('0x13'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x908d=['../../config/logger','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x908d,0x10f));var _0xd908=function(_0x8c12db,_0x591626){_0x8c12db=_0x8c12db-0x0;var _0x1290a7=_0x908d[_0x8c12db];return _0x1290a7;};'use strict';var _=require('lodash');var util=require(_0xd908('0x0'));var logger=require(_0xd908('0x1'))('api');var moment=require(_0xd908('0x2'));var BPromise=require('bluebird');var rp=require(_0xd908('0x3'));var fs=require('fs');var path=require(_0xd908('0x4'));var rimraf=require('rimraf');var config=require(_0xd908('0x5'));var attributes=require(_0xd908('0x6'));module[_0xd908('0x7')]=function(_0x35ebb8,_0x5a68a1){return _0x35ebb8[_0xd908('0x8')](_0xd908('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d2055,_0xba6c50,_0x4454e2){if(_0x2d2055[_0xd908('0xa')](_0xd908('0xb'))){_0x2d2055[_0xd908('0xc')]=moment()[_0xd908('0xd')](_0xd908('0xe'));}_0x4454e2(null,_0x2d2055);}},'charset':_0xd908('0xf'),'collate':_0xd908('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 9cb4162..d075ff0 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 _0xb51e=['debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','./chatInteraction.socket','request','then','info','request\x20sent'];(function(_0x286282,_0x21c62d){var _0x452868=function(_0x206985){while(--_0x206985){_0x286282['push'](_0x286282['shift']());}};_0x452868(++_0x21c62d);}(_0xb51e,0x87));var _0xeb51=function(_0x20adc7,_0x16cd8c){_0x20adc7=_0x20adc7-0x0;var _0x22b4f1=_0xb51e[_0x20adc7];return _0x22b4f1;};'use strict';var _=require(_0xeb51('0x0'));var util=require(_0xeb51('0x1'));var moment=require(_0xeb51('0x2'));var BPromise=require(_0xeb51('0x3'));var rs=require(_0xeb51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb51('0x5'))['db'];var utils=require(_0xeb51('0x6'));var logger=require('../../config/logger')(_0xeb51('0x7'));var config=require(_0xeb51('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeb51('0x9')]({'port':0x232a});config[_0xeb51('0xa')]=_['defaults'](config[_0xeb51('0xa')],{'host':_0xeb51('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb51('0xa')]));require(_0xeb51('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e8190,_0x30b61c,_0x588610){return new BPromise(function(_0x1b8e49,_0x4c658f){return client[_0xeb51('0xd')](_0x1e8190,_0x588610)[_0xeb51('0xe')](function(_0x5f4238){logger[_0xeb51('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x30b61c,_0xeb51('0x10'));logger[_0xeb51('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x30b61c,_0xeb51('0x10'),JSON[_0xeb51('0x12')](_0x5f4238));if(_0x5f4238[_0xeb51('0x13')]){if(_0x5f4238[_0xeb51('0x13')][_0xeb51('0x14')]===0x1f4){logger[_0xeb51('0x13')](_0xeb51('0x15'),_0x30b61c,_0x5f4238[_0xeb51('0x13')][_0xeb51('0x16')]);return _0x4c658f(_0x5f4238['error'][_0xeb51('0x16')]);}logger[_0xeb51('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x30b61c,_0x5f4238['error'][_0xeb51('0x16')]);return _0x1b8e49(_0x5f4238['error'][_0xeb51('0x16')]);}else{logger[_0xeb51('0xf')](_0xeb51('0x15'),_0x30b61c,'request\x20sent');_0x1b8e49(_0x5f4238[_0xeb51('0x17')]['message']);}})[_0xeb51('0x18')](function(_0x316af4){logger[_0xeb51('0x13')](_0xeb51('0x15'),_0x30b61c,_0x316af4);_0x4c658f(_0x316af4);});});}exports[_0xeb51('0x19')]=function(_0x52e004){var _0x544269=this;return new Promise(function(_0x31bcbf,_0x495ddc){return db[_0xeb51('0x1a')][_0xeb51('0x1b')](_0x52e004[_0xeb51('0x1c')],{'raw':_0x52e004[_0xeb51('0x1d')]?_0x52e004[_0xeb51('0x1d')][_0xeb51('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e004['options']?_0x52e004['options'][_0xeb51('0x1f')]||null:null,'attributes':_0x52e004['options']?_0x52e004[_0xeb51('0x1d')][_0xeb51('0x20')]||null:null,'limit':_0x52e004[_0xeb51('0x1d')]?_0x52e004[_0xeb51('0x1d')]['limit']||null:null})['then'](function(_0x563984){logger[_0xeb51('0xf')](_0xeb51('0x19'),_0x52e004);logger[_0xeb51('0x11')](_0xeb51('0x19'),_0x52e004,JSON[_0xeb51('0x12')](_0x563984));_0x31bcbf(_0x563984);})[_0xeb51('0x18')](function(_0x4d403d){logger[_0xeb51('0x13')](_0xeb51('0x19'),_0x4d403d[_0xeb51('0x16')],_0x52e004);_0x495ddc(_0x544269[_0xeb51('0x13')](0x1f4,_0x4d403d['message']));});});};exports['AddTagsToChatInteraction']=function(_0x225e43){return new Promise(function(_0xe03ab5,_0x1e5f9a){return db[_0xeb51('0x1a')][_0xeb51('0x21')]({'where':_0x225e43[_0xeb51('0x1d')]?_0x225e43['options']['where']||null:null})['then'](function(_0x2b9318){if(_0x2b9318){return _0x2b9318[_0xeb51('0x22')](_0x225e43[_0xeb51('0x1c')]['ids'],_['omit'](_0x225e43[_0xeb51('0x1c')],[_0xeb51('0x23'),'id'])||{});}})[_0xeb51('0x24')](function(_0x46de1c){logger[_0xeb51('0xf')](_0xeb51('0x25'),_0x225e43);logger[_0xeb51('0x11')](_0xeb51('0x25'),_0x225e43,JSON[_0xeb51('0x12')](_0x46de1c));_0xe03ab5(_0x46de1c);})[_0xeb51('0x18')](function(_0x5db673){logger[_0xeb51('0x13')](_0xeb51('0x25'),_0x5db673[_0xeb51('0x16')],_0x225e43);_0x1e5f9a(_this['error'](0x1f4,_0x5db673[_0xeb51('0x16')]));});});}; \ No newline at end of file +var _0x32b4=['options','raw','where','attributes','limit','ChatInteraction','find','addTags','ids','spread','debug','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x32b4,0x164));var _0x432b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x32b4[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x432b('0x0'));var util=require(_0x432b('0x1'));var moment=require(_0x432b('0x2'));var BPromise=require(_0x432b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x432b('0x4'))['db'];var utils=require(_0x432b('0x5'));var logger=require('../../config/logger')(_0x432b('0x6'));var config=require(_0x432b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x432b('0x8')][_0x432b('0x9')]({'port':0x232a});config[_0x432b('0xa')]=_[_0x432b('0xb')](config[_0x432b('0xa')],{'host':_0x432b('0xc'),'port':0x18eb});var socket=require(_0x432b('0xd'))(new Redis(config[_0x432b('0xa')]));require(_0x432b('0xe'))[_0x432b('0xf')](socket);function respondWithRpcPromise(_0x174737,_0x4cd957,_0x283f5f){return new BPromise(function(_0x3c9925,_0x3a734a){return client[_0x432b('0x10')](_0x174737,_0x283f5f)[_0x432b('0x11')](function(_0x45c250){logger[_0x432b('0x12')](_0x432b('0x13'),_0x4cd957,_0x432b('0x14'));logger['debug'](_0x432b('0x15'),_0x4cd957,_0x432b('0x14'),JSON[_0x432b('0x16')](_0x45c250));if(_0x45c250[_0x432b('0x17')]){if(_0x45c250[_0x432b('0x17')][_0x432b('0x18')]===0x1f4){logger[_0x432b('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4cd957,_0x45c250[_0x432b('0x17')]['message']);return _0x3a734a(_0x45c250[_0x432b('0x17')][_0x432b('0x19')]);}logger[_0x432b('0x17')](_0x432b('0x13'),_0x4cd957,_0x45c250[_0x432b('0x17')][_0x432b('0x19')]);return _0x3c9925(_0x45c250['error'][_0x432b('0x19')]);}else{logger[_0x432b('0x12')](_0x432b('0x13'),_0x4cd957,'request\x20sent');_0x3c9925(_0x45c250[_0x432b('0x1a')][_0x432b('0x19')]);}})[_0x432b('0x1b')](function(_0x38ea99){logger[_0x432b('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4cd957,_0x38ea99);_0x3a734a(_0x38ea99);});});}exports[_0x432b('0x1c')]=function(_0x19fcdb){var _0x2ddb70=this;return new Promise(function(_0x568034,_0x37752c){return db['ChatInteraction'][_0x432b('0x1d')](_0x19fcdb[_0x432b('0x1e')],{'raw':_0x19fcdb[_0x432b('0x1f')]?_0x19fcdb[_0x432b('0x1f')][_0x432b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19fcdb[_0x432b('0x1f')]?_0x19fcdb[_0x432b('0x1f')][_0x432b('0x21')]||null:null,'attributes':_0x19fcdb[_0x432b('0x1f')]?_0x19fcdb[_0x432b('0x1f')][_0x432b('0x22')]||null:null,'limit':_0x19fcdb[_0x432b('0x1f')]?_0x19fcdb[_0x432b('0x1f')][_0x432b('0x23')]||null:null})['then'](function(_0x345a92){logger[_0x432b('0x12')](_0x432b('0x1c'),_0x19fcdb);logger['debug']('UpdateChatInteraction',_0x19fcdb,JSON[_0x432b('0x16')](_0x345a92));_0x568034(_0x345a92);})['catch'](function(_0x11463a){logger[_0x432b('0x17')](_0x432b('0x1c'),_0x11463a[_0x432b('0x19')],_0x19fcdb);_0x37752c(_0x2ddb70['error'](0x1f4,_0x11463a[_0x432b('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x1e5cb1){return new Promise(function(_0x3d5124,_0x23d9f6){return db[_0x432b('0x24')][_0x432b('0x25')]({'where':_0x1e5cb1[_0x432b('0x1f')]?_0x1e5cb1[_0x432b('0x1f')][_0x432b('0x21')]||null:null})['then'](function(_0x3cacb9){if(_0x3cacb9){return _0x3cacb9[_0x432b('0x26')](_0x1e5cb1[_0x432b('0x1e')][_0x432b('0x27')],_['omit'](_0x1e5cb1[_0x432b('0x1e')],[_0x432b('0x27'),'id'])||{});}})[_0x432b('0x28')](function(_0x40be6e){logger[_0x432b('0x12')]('AddTags',_0x1e5cb1);logger[_0x432b('0x29')](_0x432b('0x2a'),_0x1e5cb1,JSON['stringify'](_0x40be6e));_0x3d5124(_0x40be6e);})['catch'](function(_0xb5cbde){logger[_0x432b('0x17')](_0x432b('0x2a'),_0xb5cbde['message'],_0x1e5cb1);_0x23d9f6(_this[_0x432b('0x17')](0x1f4,_0xb5cbde['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e1a8eaf..6e238aa 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 _0x686d=['update','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x372198,_0x31cb62){var _0x510048=function(_0x4b370d){while(--_0x4b370d){_0x372198['push'](_0x372198['shift']());}};_0x510048(++_0x31cb62);}(_0x686d,0x172));var _0xd686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x686d[_0x20a584];return _0x4b41a8;};'use strict';var ChatInteractionEvents=require(_0xd686('0x0'));var events=[_0xd686('0x1'),'remove',_0xd686('0x2')];function createListener(_0xd8c3b2,_0x489671){return function(_0x5b7a13){_0x489671['emit'](_0xd8c3b2,_0x5b7a13);};}function removeListener(_0x16af4c,_0x1e5a5e){return function(){ChatInteractionEvents['removeListener'](_0x16af4c,_0x1e5a5e);};}exports[_0xd686('0x3')]=function(_0x5cc0b3){for(var _0x144020=0x0,_0x2e44cf=events[_0xd686('0x4')];_0x144020<_0x2e44cf;_0x144020++){var _0x511a5e=events[_0x144020];var _0xbb3ea0=createListener(_0xd686('0x5')+_0x511a5e,_0x5cc0b3);ChatInteractionEvents['on'](_0x511a5e,_0xbb3ea0);}}; \ No newline at end of file +var _0x2131=['update','removeListener','length','chatInteraction:','./chatInteraction.events','save'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x2131,0xee));var _0x1213=function(_0x2e72c7,_0x3cefda){_0x2e72c7=_0x2e72c7-0x0;var _0x12f876=_0x2131[_0x2e72c7];return _0x12f876;};'use strict';var ChatInteractionEvents=require(_0x1213('0x0'));var events=[_0x1213('0x1'),'remove',_0x1213('0x2')];function createListener(_0x2dab26,_0x2fc8f5){return function(_0x437c93){_0x2fc8f5['emit'](_0x2dab26,_0x437c93);};}function removeListener(_0xbb5d2,_0x5db678){return function(){ChatInteractionEvents[_0x1213('0x3')](_0xbb5d2,_0x5db678);};}exports['register']=function(_0x4fbbc2){for(var _0x1dc8d3=0x0,_0x1672e2=events[_0x1213('0x4')];_0x1dc8d3<_0x1672e2;_0x1dc8d3++){var _0x4949af=events[_0x1dc8d3];var _0x253e45=createListener(_0x1213('0x5')+_0x4949af,_0x4fbbc2);ChatInteractionEvents['on'](_0x4949af,_0x253e45);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 8329785..600468a 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 _0x2e57=['originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x2e57,0x1a7));var _0x72e5=function(_0x58fae4,_0x4be087){_0x58fae4=_0x58fae4-0x0;var _0x516951=_0x2e57[_0x58fae4];return _0x516951;};'use strict';var multer=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var path=require('path');var timeout=require(_0x72e5('0x2'));var express=require(_0x72e5('0x3'));var router=express[_0x72e5('0x4')]();var fs_extra=require(_0x72e5('0x5'));var auth=require(_0x72e5('0x6'));var interaction=require(_0x72e5('0x7'));var config=require(_0x72e5('0x8'));var controller=require('./chatInteraction.controller');router[_0x72e5('0x9')]('/',auth[_0x72e5('0xa')](),controller[_0x72e5('0xb')]);router[_0x72e5('0x9')](_0x72e5('0xc'),auth[_0x72e5('0xa')](),controller['describe']);router[_0x72e5('0x9')](_0x72e5('0xd'),auth[_0x72e5('0xe')](),controller[_0x72e5('0xf')]);router[_0x72e5('0x9')](_0x72e5('0x10'),auth[_0x72e5('0xe')](),controller[_0x72e5('0x11')]);router[_0x72e5('0x9')](_0x72e5('0x12'),auth[_0x72e5('0xa')](),controller[_0x72e5('0x13')]);router['get'](_0x72e5('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x72e5('0x15')]);router[_0x72e5('0x9')](_0x72e5('0x16'),auth['isAuthenticated'](),controller[_0x72e5('0x17')]);router[_0x72e5('0x18')]('/',auth[_0x72e5('0xa')](),controller[_0x72e5('0x19')]);router[_0x72e5('0x18')](_0x72e5('0x1a'),auth[_0x72e5('0xa')](),controller[_0x72e5('0x1b')]);var upload=multer({'storage':multer[_0x72e5('0x1c')]({'destination':function(_0x20e3c3,_0x440860,_0x1e00fe){_0x1e00fe(null,path[_0x72e5('0x1d')](config[_0x72e5('0x1e')],'server/files/attachments/'));},'filename':function(_0xef41ec,_0xeccd47,_0x2d783d){_0x2d783d(null,util[_0x72e5('0x1f')](_0x72e5('0x20'),Date['now'](),_0xeccd47[_0x72e5('0x21')][_0x72e5('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x72e5('0x18')](_0x72e5('0x23'),upload[_0x72e5('0x24')](_0x72e5('0x25')),controller[_0x72e5('0x26')]);router[_0x72e5('0x18')]('/:id/messages',auth[_0x72e5('0xe')](),controller[_0x72e5('0x27')]);router['post'](_0x72e5('0x28'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),_0x72e5('0x2b')),controller[_0x72e5('0x2c')]);router[_0x72e5('0x2d')](_0x72e5('0xd'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),'chatinteraction:update'),controller[_0x72e5('0x2e')]);router['put'](_0x72e5('0x2f'),controller[_0x72e5('0x30')]);router['put'](_0x72e5('0x31'),auth[_0x72e5('0xe')](),controller[_0x72e5('0x32')]);router[_0x72e5('0x2d')](_0x72e5('0x33'),controller[_0x72e5('0x34')]);router[_0x72e5('0x35')](_0x72e5('0xd'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),_0x72e5('0x36')),controller[_0x72e5('0x37')]);router['delete'](_0x72e5('0x28'),auth[_0x72e5('0xa')](),controller['removeTags']);module[_0x72e5('0x38')]=router; \ No newline at end of file +var _0xcae2=['replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname'];(function(_0x16531b,_0x584ced){var _0x19d85=function(_0x6073a6){while(--_0x6073a6){_0x16531b['push'](_0x16531b['shift']());}};_0x19d85(++_0x584ced);}(_0xcae2,0x1ea));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var path=require(_0x2cae('0x2'));var timeout=require(_0x2cae('0x3'));var express=require(_0x2cae('0x4'));var router=express[_0x2cae('0x5')]();var fs_extra=require(_0x2cae('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2cae('0x7'));var config=require(_0x2cae('0x8'));var controller=require('./chatInteraction.controller');router[_0x2cae('0x9')]('/',auth[_0x2cae('0xa')](),controller[_0x2cae('0xb')]);router[_0x2cae('0x9')]('/describe',auth[_0x2cae('0xa')](),controller[_0x2cae('0xc')]);router[_0x2cae('0x9')](_0x2cae('0xd'),auth[_0x2cae('0xe')](),controller[_0x2cae('0xf')]);router[_0x2cae('0x9')](_0x2cae('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x2cae('0x11')]);router['get']('/:id/messages',auth[_0x2cae('0xa')](),controller['getMessages']);router[_0x2cae('0x9')](_0x2cae('0x12'),auth[_0x2cae('0xe')](),controller[_0x2cae('0x13')]);router[_0x2cae('0x9')](_0x2cae('0x14'),auth[_0x2cae('0xa')](),controller[_0x2cae('0x15')]);router[_0x2cae('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2cae('0x16')]('/:id/vidaoo',auth[_0x2cae('0xa')](),controller[_0x2cae('0x17')]);var upload=multer({'storage':multer[_0x2cae('0x18')]({'destination':function(_0x427b21,_0x1afd37,_0x37fc56){_0x37fc56(null,path['join'](config[_0x2cae('0x19')],_0x2cae('0x1a')));},'filename':function(_0x389f35,_0x447e3d,_0x45ba03){_0x45ba03(null,util[_0x2cae('0x1b')]('%s-%s',Date[_0x2cae('0x1c')](),_0x447e3d[_0x2cae('0x1d')][_0x2cae('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2cae('0x16')](_0x2cae('0x1f'),upload[_0x2cae('0x20')](_0x2cae('0x21')),controller[_0x2cae('0x22')]);router['post']('/:id/messages',auth[_0x2cae('0xe')](),controller[_0x2cae('0x23')]);router[_0x2cae('0x16')](_0x2cae('0x24'),auth['isAuthenticated'](),interaction[_0x2cae('0x25')]('chat',_0x2cae('0x26')),controller['addTags']);router[_0x2cae('0x27')]('/:id',auth['isAuthenticated'](),interaction[_0x2cae('0x25')](_0x2cae('0x28'),_0x2cae('0x29')),controller[_0x2cae('0x2a')]);router[_0x2cae('0x27')](_0x2cae('0x2b'),controller[_0x2cae('0x2c')]);router[_0x2cae('0x27')](_0x2cae('0x2d'),auth[_0x2cae('0xe')](),controller[_0x2cae('0x2e')]);router['put']('/:id/close',controller[_0x2cae('0x2f')]);router['delete'](_0x2cae('0xd'),auth[_0x2cae('0xa')](),interaction[_0x2cae('0x25')](_0x2cae('0x28'),'chatinteraction:destroy'),controller[_0x2cae('0x30')]);router[_0x2cae('0x31')](_0x2cae('0x24'),auth[_0x2cae('0xa')](),controller[_0x2cae('0x32')]);module[_0x2cae('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 223d10d..6f7c58d 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 _0x6611=['BOOLEAN','INTEGER'];(function(_0x4b6791,_0x390a9f){var _0x47de56=function(_0x4f3236){while(--_0x4f3236){_0x4b6791['push'](_0x4b6791['shift']());}};_0x47de56(++_0x390a9f);}(_0x6611,0x9e));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1661('0x0')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1661('0x1')]}}; \ No newline at end of file +var _0xad56=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0x3a6c22,_0x25539e){var _0x61930a=function(_0x69ae65){while(--_0x69ae65){_0x3a6c22['push'](_0x3a6c22['shift']());}};_0x61930a(++_0x25539e);}(_0xad56,0x199));var _0x6ad5=function(_0x30b58,_0x48df3b){_0x30b58=_0x30b58-0x0;var _0x9d210d=_0xad56[_0x30b58];return _0x9d210d;};'use strict';var Sequelize=require(_0x6ad5('0x0'));module[_0x6ad5('0x1')]={'body':{'type':Sequelize[_0x6ad5('0x2')](_0x6ad5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6ad5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a161f93..5044bee 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 _0x7aa8=['key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','findAll','rows','params','include','find','catch','create','body','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','isEmpty','length','push','messages','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x1c8e15,_0x288b5e){var _0x336251=function(_0x349808){while(--_0x349808){_0x1c8e15['push'](_0x1c8e15['shift']());}};_0x336251(++_0x288b5e);}(_0x7aa8,0xa9));var _0x87aa=function(_0x3f850e,_0x388709){_0x3f850e=_0x3f850e-0x0;var _0x3958f4=_0x7aa8[_0x3f850e];return _0x3958f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87aa('0x0'));var zipdir=require(_0x87aa('0x1'));var jsonpatch=require(_0x87aa('0x2'));var rp=require(_0x87aa('0x3'));var moment=require(_0x87aa('0x4'));var BPromise=require(_0x87aa('0x5'));var Mustache=require(_0x87aa('0x6'));var util=require(_0x87aa('0x7'));var path=require(_0x87aa('0x8'));var sox=require(_0x87aa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87aa('0xa'));var _=require(_0x87aa('0xb'));var squel=require(_0x87aa('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x87aa('0xd'));var toCsv=require(_0x87aa('0xe'));var querystring=require('querystring');var Papa=require(_0x87aa('0xf'));var Redis=require(_0x87aa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87aa('0x12'))(_0x87aa('0x13'));var utils=require(_0x87aa('0x14'));var config=require(_0x87aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x87aa('0x16'))['db'];config['redis']=_[_0x87aa('0x17')](config['redis'],{'host':_0x87aa('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87aa('0x19')]));require(_0x87aa('0x1a'))[_0x87aa('0x1b')](socket);function respondWithStatusCode(_0x1f8c08,_0x59d2fb){_0x59d2fb=_0x59d2fb||0xcc;return function(_0x34d17d){if(_0x34d17d){return _0x1f8c08[_0x87aa('0x1c')](_0x59d2fb);}return _0x1f8c08[_0x87aa('0x1d')](_0x59d2fb)[_0x87aa('0x1e')]();};}function respondWithResult(_0x4ad68a,_0x4fb0c9){_0x4fb0c9=_0x4fb0c9||0xc8;return function(_0x1213ab){if(_0x1213ab){return _0x4ad68a[_0x87aa('0x1d')](_0x4fb0c9)[_0x87aa('0x1f')](_0x1213ab);}};}function respondWithFilteredResult(_0x28e36f,_0x29ec50){return function(_0x4616b4){if(_0x4616b4){var _0x1b843d=typeof _0x29ec50['offset']==='undefined'&&typeof _0x29ec50['limit']===_0x87aa('0x20');var _0x4b0b4a=_0x4616b4[_0x87aa('0x21')];var _0x5da8f4=_0x1b843d?0x0:_0x29ec50['offset'];var _0x5ab5e2=_0x1b843d?_0x4616b4[_0x87aa('0x21')]:_0x29ec50[_0x87aa('0x22')]+_0x29ec50[_0x87aa('0x23')];var _0x5a5f91;if(_0x5ab5e2>=_0x4b0b4a){_0x5ab5e2=_0x4b0b4a;_0x5a5f91=0xc8;}else{_0x5a5f91=0xce;}_0x28e36f[_0x87aa('0x1d')](_0x5a5f91);return _0x28e36f['set'](_0x87aa('0x24'),_0x5da8f4+'-'+_0x5ab5e2+'/'+_0x4b0b4a)[_0x87aa('0x1f')](_0x4616b4);}return null;};}function patchUpdates(_0x29fbdd){return function(_0x75657d){try{jsonpatch[_0x87aa('0x25')](_0x75657d,_0x29fbdd,!![]);}catch(_0x53fb3a){return BPromise[_0x87aa('0x26')](_0x53fb3a);}return _0x75657d[_0x87aa('0x27')]();};}function saveUpdates(_0x32ac69,_0x5b9384){return function(_0x43e236){if(_0x43e236){return _0x43e236[_0x87aa('0x28')](_0x32ac69)[_0x87aa('0x29')](function(_0x305a20){return _0x305a20;});}return null;};}function removeEntity(_0x564a53,_0x2b8061){return function(_0x5b638f){if(_0x5b638f){return _0x5b638f[_0x87aa('0x2a')]()['then'](function(){_0x564a53['status'](0xcc)[_0x87aa('0x1e')]();});}};}function handleEntityNotFound(_0xf79a08,_0x1e6ab6){return function(_0x364a18){if(!_0x364a18){_0xf79a08[_0x87aa('0x1c')](0x194);}return _0x364a18;};}function handleError(_0x591591,_0x111682){_0x111682=_0x111682||0x1f4;return function(_0x237a0b){logger[_0x87aa('0x2b')](_0x237a0b['stack']);if(_0x237a0b[_0x87aa('0x2c')]){delete _0x237a0b['name'];}_0x591591[_0x87aa('0x1d')](_0x111682)[_0x87aa('0x2d')](_0x237a0b);};}exports[_0x87aa('0x2e')]=function(_0x3f8b3c,_0x59c029){var _0xf2d221={},_0x94fd44={},_0x4af1ed={'count':0x0,'rows':[]};var _0x23f20e=_[_0x87aa('0x2f')](db['ChatInternalMessage'][_0x87aa('0x30')],function(_0x58dad5){return{'name':_0x58dad5[_0x87aa('0x31')],'type':_0x58dad5[_0x87aa('0x32')][_0x87aa('0x33')]};});_0x94fd44[_0x87aa('0x34')]=_[_0x87aa('0x2f')](_0x23f20e,_0x87aa('0x2c'));_0x94fd44[_0x87aa('0x35')]=_[_0x87aa('0x36')](_0x3f8b3c['query']);_0x94fd44['filters']=_[_0x87aa('0x37')](_0x94fd44[_0x87aa('0x34')],_0x94fd44['query']);_0xf2d221[_0x87aa('0x38')]=_[_0x87aa('0x37')](_0x94fd44['model'],qs[_0x87aa('0x39')](_0x3f8b3c[_0x87aa('0x35')]['fields']));_0xf2d221[_0x87aa('0x38')]=_0xf2d221[_0x87aa('0x38')]['length']?_0xf2d221[_0x87aa('0x38')]:_0x94fd44[_0x87aa('0x34')];if(!_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x3a')](_0x87aa('0x3b'))){_0xf2d221[_0x87aa('0x23')]=qs[_0x87aa('0x23')](_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x23')]);_0xf2d221[_0x87aa('0x22')]=qs['offset'](_0x3f8b3c['query'][_0x87aa('0x22')]);}_0xf2d221['order']=qs['sort'](_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x3c')]);_0xf2d221[_0x87aa('0x3d')]=qs[_0x87aa('0x3e')](_[_0x87aa('0x3f')](_0x3f8b3c[_0x87aa('0x35')],_0x94fd44[_0x87aa('0x3e')]),_0x23f20e);if(_0x3f8b3c['query'][_0x87aa('0x40')]){_0xf2d221[_0x87aa('0x3d')]=_['merge'](_0xf2d221[_0x87aa('0x3d')],{'$or':_[_0x87aa('0x2f')](_0x23f20e,function(_0x3c2d6a){if(_0x3c2d6a[_0x87aa('0x32')]!==_0x87aa('0x41')){var _0x518a20={};_0x518a20[_0x3c2d6a[_0x87aa('0x2c')]]={'$like':'%'+_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x40')]+'%'};return _0x518a20;}})});}_0xf2d221=_[_0x87aa('0x42')]({},_0xf2d221,_0x3f8b3c[_0x87aa('0x43')]);var _0x5568ad={'where':_0xf2d221['where']};return db[_0x87aa('0x44')][_0x87aa('0x21')](_0x5568ad)['then'](function(_0x34b7a8){_0x4af1ed[_0x87aa('0x21')]=_0x34b7a8;if(_0x3f8b3c['query'][_0x87aa('0x45')]){_0xf2d221['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x87aa('0x46')](_0xf2d221);})[_0x87aa('0x29')](function(_0x29f17f){_0x4af1ed[_0x87aa('0x47')]=_0x29f17f;return _0x4af1ed;})['then'](respondWithFilteredResult(_0x59c029,_0xf2d221))['catch'](handleError(_0x59c029,null));};exports['show']=function(_0x397a21,_0x402b5e){var _0x46dc97={'raw':!![],'where':{'id':_0x397a21[_0x87aa('0x48')]['id']}},_0x2f98c9={};_0x2f98c9[_0x87aa('0x34')]=_[_0x87aa('0x36')](db['ChatInternalMessage'][_0x87aa('0x30')]);_0x2f98c9[_0x87aa('0x35')]=_[_0x87aa('0x36')](_0x397a21[_0x87aa('0x35')]);_0x2f98c9[_0x87aa('0x3e')]=_[_0x87aa('0x37')](_0x2f98c9[_0x87aa('0x34')],_0x2f98c9['query']);_0x46dc97[_0x87aa('0x38')]=_[_0x87aa('0x37')](_0x2f98c9[_0x87aa('0x34')],qs[_0x87aa('0x39')](_0x397a21[_0x87aa('0x35')]['fields']));_0x46dc97[_0x87aa('0x38')]=_0x46dc97[_0x87aa('0x38')]['length']?_0x46dc97['attributes']:_0x2f98c9[_0x87aa('0x34')];if(_0x397a21[_0x87aa('0x35')][_0x87aa('0x45')]){_0x46dc97[_0x87aa('0x49')]=[{'all':!![]}];}_0x46dc97=_[_0x87aa('0x42')]({},_0x46dc97,_0x397a21[_0x87aa('0x43')]);return db['ChatInternalMessage'][_0x87aa('0x4a')](_0x46dc97)[_0x87aa('0x29')](handleEntityNotFound(_0x402b5e,null))['then'](respondWithResult(_0x402b5e,null))[_0x87aa('0x4b')](handleError(_0x402b5e,null));};exports[_0x87aa('0x4c')]=function(_0x5dc522,_0x376c4f){return db[_0x87aa('0x44')][_0x87aa('0x4c')](_0x5dc522['body'],{})['then'](respondWithResult(_0x376c4f,0xc9))[_0x87aa('0x4b')](handleError(_0x376c4f,null));};exports[_0x87aa('0x28')]=function(_0x2b1eed,_0x758819){if(_0x2b1eed[_0x87aa('0x4d')]['id']){delete _0x2b1eed[_0x87aa('0x4d')]['id'];}return db[_0x87aa('0x44')][_0x87aa('0x4a')]({'where':{'id':_0x2b1eed[_0x87aa('0x48')]['id']}})[_0x87aa('0x29')](handleEntityNotFound(_0x758819,null))[_0x87aa('0x29')](saveUpdates(_0x2b1eed[_0x87aa('0x4d')],null))[_0x87aa('0x29')](respondWithResult(_0x758819,null))['catch'](handleError(_0x758819,null));};exports['destroy']=function(_0xa71b11,_0x2d782b){return db['ChatInternalMessage'][_0x87aa('0x4a')]({'where':{'id':_0xa71b11[_0x87aa('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d782b,null))[_0x87aa('0x29')](removeEntity(_0x2d782b,null))['catch'](handleError(_0x2d782b,null));};exports[_0x87aa('0x4e')]=function(_0x269a38,_0xc4c6a5){return db[_0x87aa('0x44')][_0x87aa('0x4e')]()[_0x87aa('0x29')](respondWithResult(_0xc4c6a5,null))['catch'](handleError(_0xc4c6a5,null));};function wrapUser(_0x21de28){return function(_0x3c7eb9){var _0x1f1984=_0x21de28[_0x87aa('0x4f')]({'plain':!![]});_0x1f1984['messages']=[];if(_0x3c7eb9){_0x1f1984['lastMessageAt']=_0x3c7eb9[_0x87aa('0x50')];_0x1f1984[_0x87aa('0x51')]=_0x3c7eb9;}else{_0x1f1984[_0x87aa('0x52')]=moment(0x0)[_0x87aa('0x53')](_0x87aa('0x54'));_0x1f1984[_0x87aa('0x51')]={};}return _0x1f1984;};}exports[_0x87aa('0x55')]=function(_0x438394,_0x30d23b,_0x37838c){var _0x4a00da=[];return db[_0x87aa('0x56')][_0x87aa('0x46')]({'where':{'role':[_0x87aa('0x57'),'admin',_0x87aa('0x58')]},'attributes':['id','fullname',_0x87aa('0x2c'),'role',_0x87aa('0x59'),_0x87aa('0x5a'),_0x87aa('0x5b'),_0x87aa('0x5c'),_0x87aa('0x5d'),_0x87aa('0x5e')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x87aa('0x5f'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x87aa('0x29')](function(_0x4246be){if(_0x4246be){var _0x4607be=_0x438394[_0x87aa('0x58')]['get']({'plain':!![]});if(!_0x4607be)throw new Error(_0x87aa('0x60'));if(_0x4607be[_0x87aa('0x61')]===_0x87aa('0x58')){return db[_0x87aa('0x62')][_0x87aa('0x4a')]({'where':{'name':'Agents','userProfileId':_0x4607be[_0x87aa('0x63')]},'raw':!![]})[_0x87aa('0x29')](function(_0x1c93de){if(_0x1c93de){if(_0x1c93de['autoAssociation']===0x0){return db[_0x87aa('0x64')][_0x87aa('0x46')]({'where':{'sectionId':_0x1c93de['id']},'raw':!![]})['then'](function(_0x3bdddc){var _0x4f079a=[];if(_[_0x87aa('0x65')](_0x3bdddc)){_0x4f079a=_[_0x87aa('0x40')](_0x4246be,function(_0x3b883e){if(_0x3b883e[_0x87aa('0x61')]!=='agent'){return _0x3b883e;}});return _0x4f079a;}else{for(var _0x2689b1=0x0;_0x2689b1<_0x4246be[_0x87aa('0x66')];_0x2689b1++){var _0x36836f=_0x4246be[_0x2689b1];if(_0x36836f[_0x87aa('0x61')]===_0x87aa('0x57')){var _0x4fdc5f=_['find'](_0x3bdddc,function(_0x212535){return _0x212535['resourceId']===_0x36836f['id'];});if(_0x4fdc5f)_0x4f079a[_0x87aa('0x67')](_0x36836f);}else{_0x4f079a[_0x87aa('0x67')](_0x36836f);}}return _0x4f079a;}});}else{return _0x4246be;}}else{var _0x42356f=_[_0x87aa('0x40')](_0x4246be,function(_0xbca36){if(_0xbca36[_0x87aa('0x61')]!==_0x87aa('0x57')){return _0xbca36;}});return _0x42356f;}});}else{return _0x4246be;}}})['then'](function(_0x2a297e){var _0x34b1c0=[];if(_0x2a297e){_0x4a00da=_0x2a297e;for(var _0x3ade28=0x0;_0x3ade28<_0x2a297e[_0x87aa('0x66')];_0x3ade28+=0x1){_0x4a00da[_0x3ade28][_0x87aa('0x68')]=[];_0x34b1c0[_0x87aa('0x67')](db[_0x87aa('0x44')][_0x87aa('0x4a')]({'where':{'FromId':[_0x438394[_0x87aa('0x58')]['id'],_0x2a297e[_0x3ade28]['id']],'ToId':[_0x438394[_0x87aa('0x58')]['id'],_0x2a297e[_0x3ade28]['id']],'ChatGroupId':null},'attributes':['id',_0x87aa('0x50'),_0x87aa('0x69'),_0x87aa('0x6a'),_0x87aa('0x6b'),_0x87aa('0x4d')],'order':qs[_0x87aa('0x3c')](_0x87aa('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2a297e[_0x3ade28])));}return BPromise[_0x87aa('0x6d')](_0x34b1c0);}return[];})[_0x87aa('0x29')](function(_0x5c31b4){return{'rows':_0x5c31b4,'count':_0x5c31b4[_0x87aa('0x66')]};})[_0x87aa('0x29')](respondWithResult(_0x30d23b,null))[_0x87aa('0x4b')](handleError(_0x30d23b,null));}; \ No newline at end of file +var _0xb627=['error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','online','lastLoginAt','allowmessenger','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','role','resourceId','push','createdAt','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy'];(function(_0x268000,_0xd65943){var _0x3bdfe1=function(_0x3af23a){while(--_0x3af23a){_0x268000['push'](_0x268000['shift']());}};_0x3bdfe1(++_0xd65943);}(_0xb627,0x194));var _0x7b62=function(_0x1322fb,_0x3e07c2){_0x1322fb=_0x1322fb-0x0;var _0x5d1690=_0xb627[_0x1322fb];return _0x5d1690;};'use strict';var emlformat=require(_0x7b62('0x0'));var rimraf=require(_0x7b62('0x1'));var zipdir=require(_0x7b62('0x2'));var jsonpatch=require(_0x7b62('0x3'));var rp=require(_0x7b62('0x4'));var moment=require('moment');var BPromise=require(_0x7b62('0x5'));var Mustache=require(_0x7b62('0x6'));var util=require('util');var path=require(_0x7b62('0x7'));var sox=require(_0x7b62('0x8'));var csv=require(_0x7b62('0x9'));var ejs=require(_0x7b62('0xa'));var fs=require('fs');var fs_extra=require(_0x7b62('0xb'));var _=require(_0x7b62('0xc'));var squel=require(_0x7b62('0xd'));var crypto=require(_0x7b62('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7b62('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7b62('0x10'));var Papa=require(_0x7b62('0x11'));var Redis=require(_0x7b62('0x12'));var authService=require(_0x7b62('0x13'));var qs=require(_0x7b62('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b62('0x15'));var logger=require(_0x7b62('0x16'))(_0x7b62('0x17'));var utils=require(_0x7b62('0x18'));var config=require(_0x7b62('0x19'));var licenseUtil=require(_0x7b62('0x1a'));var db=require(_0x7b62('0x1b'))['db'];config[_0x7b62('0x1c')]=_[_0x7b62('0x1d')](config['redis'],{'host':_0x7b62('0x1e'),'port':0x18eb});var socket=require(_0x7b62('0x1f'))(new Redis(config[_0x7b62('0x1c')]));require(_0x7b62('0x20'))[_0x7b62('0x21')](socket);function respondWithStatusCode(_0x1fb9ee,_0x35dcf8){_0x35dcf8=_0x35dcf8||0xcc;return function(_0x3ddb0e){if(_0x3ddb0e){return _0x1fb9ee[_0x7b62('0x22')](_0x35dcf8);}return _0x1fb9ee['status'](_0x35dcf8)[_0x7b62('0x23')]();};}function respondWithResult(_0x12f4ab,_0x211e7f){_0x211e7f=_0x211e7f||0xc8;return function(_0x3f9517){if(_0x3f9517){return _0x12f4ab[_0x7b62('0x24')](_0x211e7f)[_0x7b62('0x25')](_0x3f9517);}};}function respondWithFilteredResult(_0x13df6e,_0x1e2964){return function(_0x198763){if(_0x198763){var _0x128127=typeof _0x1e2964[_0x7b62('0x26')]===_0x7b62('0x27')&&typeof _0x1e2964[_0x7b62('0x28')]===_0x7b62('0x27');var _0xeb2b3b=_0x198763[_0x7b62('0x29')];var _0x31fced=_0x128127?0x0:_0x1e2964[_0x7b62('0x26')];var _0x532da3=_0x128127?_0x198763[_0x7b62('0x29')]:_0x1e2964[_0x7b62('0x26')]+_0x1e2964['limit'];var _0x3e03af;if(_0x532da3>=_0xeb2b3b){_0x532da3=_0xeb2b3b;_0x3e03af=0xc8;}else{_0x3e03af=0xce;}_0x13df6e[_0x7b62('0x24')](_0x3e03af);return _0x13df6e[_0x7b62('0x2a')](_0x7b62('0x2b'),_0x31fced+'-'+_0x532da3+'/'+_0xeb2b3b)['json'](_0x198763);}return null;};}function patchUpdates(_0x3d4ef9){return function(_0xe54625){try{jsonpatch[_0x7b62('0x2c')](_0xe54625,_0x3d4ef9,!![]);}catch(_0x39f9bb){return BPromise['reject'](_0x39f9bb);}return _0xe54625[_0x7b62('0x2d')]();};}function saveUpdates(_0x216a2e,_0x2c88af){return function(_0x1eb73e){if(_0x1eb73e){return _0x1eb73e[_0x7b62('0x2e')](_0x216a2e)['then'](function(_0x1b29a6){return _0x1b29a6;});}return null;};}function removeEntity(_0x1f1794,_0x2f1c06){return function(_0xb238ee){if(_0xb238ee){return _0xb238ee[_0x7b62('0x2f')]()['then'](function(){_0x1f1794[_0x7b62('0x24')](0xcc)[_0x7b62('0x23')]();});}};}function handleEntityNotFound(_0x4edad0,_0xd415ec){return function(_0xffcdb8){if(!_0xffcdb8){_0x4edad0['sendStatus'](0x194);}return _0xffcdb8;};}function handleError(_0x10b341,_0x5483f4){_0x5483f4=_0x5483f4||0x1f4;return function(_0xca6a83){logger[_0x7b62('0x30')](_0xca6a83[_0x7b62('0x31')]);if(_0xca6a83[_0x7b62('0x32')]){delete _0xca6a83[_0x7b62('0x32')];}_0x10b341[_0x7b62('0x24')](_0x5483f4)[_0x7b62('0x33')](_0xca6a83);};}exports[_0x7b62('0x34')]=function(_0x2d87ac,_0x1c8a67){var _0x5e3583={},_0x330ce9={},_0x1e0676={'count':0x0,'rows':[]};var _0x4a2dda=_[_0x7b62('0x35')](db[_0x7b62('0x36')][_0x7b62('0x37')],function(_0x47f6f5){return{'name':_0x47f6f5[_0x7b62('0x38')],'type':_0x47f6f5[_0x7b62('0x39')]['key']};});_0x330ce9[_0x7b62('0x3a')]=_[_0x7b62('0x35')](_0x4a2dda,_0x7b62('0x32'));_0x330ce9[_0x7b62('0x3b')]=_[_0x7b62('0x3c')](_0x2d87ac[_0x7b62('0x3b')]);_0x330ce9[_0x7b62('0x3d')]=_[_0x7b62('0x3e')](_0x330ce9[_0x7b62('0x3a')],_0x330ce9[_0x7b62('0x3b')]);_0x5e3583[_0x7b62('0x3f')]=_['intersection'](_0x330ce9['model'],qs[_0x7b62('0x40')](_0x2d87ac[_0x7b62('0x3b')]['fields']));_0x5e3583[_0x7b62('0x3f')]=_0x5e3583[_0x7b62('0x3f')][_0x7b62('0x41')]?_0x5e3583[_0x7b62('0x3f')]:_0x330ce9[_0x7b62('0x3a')];if(!_0x2d87ac[_0x7b62('0x3b')]['hasOwnProperty'](_0x7b62('0x42'))){_0x5e3583[_0x7b62('0x28')]=qs[_0x7b62('0x28')](_0x2d87ac[_0x7b62('0x3b')][_0x7b62('0x28')]);_0x5e3583[_0x7b62('0x26')]=qs['offset'](_0x2d87ac['query']['offset']);}_0x5e3583['order']=qs['sort'](_0x2d87ac[_0x7b62('0x3b')][_0x7b62('0x43')]);_0x5e3583[_0x7b62('0x44')]=qs[_0x7b62('0x3d')](_[_0x7b62('0x45')](_0x2d87ac[_0x7b62('0x3b')],_0x330ce9['filters']),_0x4a2dda);if(_0x2d87ac[_0x7b62('0x3b')]['filter']){_0x5e3583[_0x7b62('0x44')]=_[_0x7b62('0x46')](_0x5e3583['where'],{'$or':_[_0x7b62('0x35')](_0x4a2dda,function(_0x5863b9){if(_0x5863b9[_0x7b62('0x39')]!==_0x7b62('0x47')){var _0x288f3a={};_0x288f3a[_0x5863b9['name']]={'$like':'%'+_0x2d87ac[_0x7b62('0x3b')][_0x7b62('0x48')]+'%'};return _0x288f3a;}})});}_0x5e3583=_[_0x7b62('0x46')]({},_0x5e3583,_0x2d87ac['options']);var _0x88ced1={'where':_0x5e3583['where']};return db[_0x7b62('0x36')]['count'](_0x88ced1)[_0x7b62('0x49')](function(_0x3387f0){_0x1e0676['count']=_0x3387f0;if(_0x2d87ac[_0x7b62('0x3b')][_0x7b62('0x4a')]){_0x5e3583['include']=[{'all':!![]}];}return db[_0x7b62('0x36')][_0x7b62('0x4b')](_0x5e3583);})[_0x7b62('0x49')](function(_0x19108f){_0x1e0676[_0x7b62('0x4c')]=_0x19108f;return _0x1e0676;})[_0x7b62('0x49')](respondWithFilteredResult(_0x1c8a67,_0x5e3583))[_0x7b62('0x4d')](handleError(_0x1c8a67,null));};exports[_0x7b62('0x4e')]=function(_0x4672f3,_0x217671){var _0x5011f5={'raw':!![],'where':{'id':_0x4672f3[_0x7b62('0x4f')]['id']}},_0x222886={};_0x222886[_0x7b62('0x3a')]=_[_0x7b62('0x3c')](db[_0x7b62('0x36')][_0x7b62('0x37')]);_0x222886[_0x7b62('0x3b')]=_['keys'](_0x4672f3['query']);_0x222886[_0x7b62('0x3d')]=_[_0x7b62('0x3e')](_0x222886[_0x7b62('0x3a')],_0x222886['query']);_0x5011f5[_0x7b62('0x3f')]=_[_0x7b62('0x3e')](_0x222886['model'],qs[_0x7b62('0x40')](_0x4672f3['query']['fields']));_0x5011f5[_0x7b62('0x3f')]=_0x5011f5[_0x7b62('0x3f')]['length']?_0x5011f5[_0x7b62('0x3f')]:_0x222886[_0x7b62('0x3a')];if(_0x4672f3[_0x7b62('0x3b')][_0x7b62('0x4a')]){_0x5011f5[_0x7b62('0x50')]=[{'all':!![]}];}_0x5011f5=_[_0x7b62('0x46')]({},_0x5011f5,_0x4672f3['options']);return db[_0x7b62('0x36')][_0x7b62('0x51')](_0x5011f5)[_0x7b62('0x49')](handleEntityNotFound(_0x217671,null))[_0x7b62('0x49')](respondWithResult(_0x217671,null))[_0x7b62('0x4d')](handleError(_0x217671,null));};exports[_0x7b62('0x52')]=function(_0x41931e,_0x53312a){return db[_0x7b62('0x36')]['create'](_0x41931e['body'],{})[_0x7b62('0x49')](respondWithResult(_0x53312a,0xc9))['catch'](handleError(_0x53312a,null));};exports[_0x7b62('0x2e')]=function(_0xcf74a3,_0x23c72d){if(_0xcf74a3[_0x7b62('0x53')]['id']){delete _0xcf74a3[_0x7b62('0x53')]['id'];}return db[_0x7b62('0x36')][_0x7b62('0x51')]({'where':{'id':_0xcf74a3[_0x7b62('0x4f')]['id']}})[_0x7b62('0x49')](handleEntityNotFound(_0x23c72d,null))[_0x7b62('0x49')](saveUpdates(_0xcf74a3[_0x7b62('0x53')],null))[_0x7b62('0x49')](respondWithResult(_0x23c72d,null))['catch'](handleError(_0x23c72d,null));};exports[_0x7b62('0x2f')]=function(_0x4fc2b6,_0x3bbb41){return db[_0x7b62('0x36')][_0x7b62('0x51')]({'where':{'id':_0x4fc2b6[_0x7b62('0x4f')]['id']}})[_0x7b62('0x49')](handleEntityNotFound(_0x3bbb41,null))[_0x7b62('0x49')](removeEntity(_0x3bbb41,null))['catch'](handleError(_0x3bbb41,null));};exports[_0x7b62('0x54')]=function(_0x586429,_0x526c46){return db[_0x7b62('0x36')][_0x7b62('0x54')]()[_0x7b62('0x49')](respondWithResult(_0x526c46,null))[_0x7b62('0x4d')](handleError(_0x526c46,null));};function wrapUser(_0x2e2b08){return function(_0x5912d0){var _0x324b38=_0x2e2b08[_0x7b62('0x55')]({'plain':!![]});_0x324b38[_0x7b62('0x56')]=[];if(_0x5912d0){_0x324b38[_0x7b62('0x57')]=_0x5912d0['createdAt'];_0x324b38[_0x7b62('0x58')]=_0x5912d0;}else{_0x324b38['lastMessageAt']=moment(0x0)[_0x7b62('0x59')](_0x7b62('0x5a'));_0x324b38[_0x7b62('0x58')]={};}return _0x324b38;};}exports['getUsers']=function(_0x2763a3,_0x3d9918,_0x1a0507){var _0x31ca77=[];return db[_0x7b62('0x5b')][_0x7b62('0x4b')]({'where':{'role':[_0x7b62('0x5c'),_0x7b62('0x5d'),_0x7b62('0x5e')]},'attributes':['id',_0x7b62('0x5f'),'name','role','userpic','internal',_0x7b62('0x60'),_0x7b62('0x61'),_0x7b62('0x62'),_0x7b62('0x63')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x7b62('0x49')](function(_0x1dc985){if(_0x1dc985){var _0x5f170f=_0x2763a3[_0x7b62('0x5e')][_0x7b62('0x55')]({'plain':!![]});if(!_0x5f170f)throw new Error(_0x7b62('0x64'));if(_0x5f170f['role']===_0x7b62('0x5e')){return db[_0x7b62('0x65')][_0x7b62('0x51')]({'where':{'name':'Agents','userProfileId':_0x5f170f[_0x7b62('0x66')]},'raw':!![]})['then'](function(_0x53020b){if(_0x53020b){if(_0x53020b[_0x7b62('0x67')]===0x0){return db[_0x7b62('0x68')][_0x7b62('0x4b')]({'where':{'sectionId':_0x53020b['id']},'raw':!![]})[_0x7b62('0x49')](function(_0x24dbae){var _0x58290b=[];if(_[_0x7b62('0x69')](_0x24dbae)){_0x58290b=_[_0x7b62('0x48')](_0x1dc985,function(_0x2b7a68){if(_0x2b7a68[_0x7b62('0x6a')]!==_0x7b62('0x5c')){return _0x2b7a68;}});return _0x58290b;}else{for(var _0x2670e4=0x0;_0x2670e4<_0x1dc985[_0x7b62('0x41')];_0x2670e4++){var _0x36f9c7=_0x1dc985[_0x2670e4];if(_0x36f9c7[_0x7b62('0x6a')]===_0x7b62('0x5c')){var _0x8bceee=_['find'](_0x24dbae,function(_0x3685bb){return _0x3685bb[_0x7b62('0x6b')]===_0x36f9c7['id'];});if(_0x8bceee)_0x58290b[_0x7b62('0x6c')](_0x36f9c7);}else{_0x58290b[_0x7b62('0x6c')](_0x36f9c7);}}return _0x58290b;}});}else{return _0x1dc985;}}else{var _0xecb8ae=_[_0x7b62('0x48')](_0x1dc985,function(_0x480878){if(_0x480878[_0x7b62('0x6a')]!==_0x7b62('0x5c')){return _0x480878;}});return _0xecb8ae;}});}else{return _0x1dc985;}}})[_0x7b62('0x49')](function(_0x45d7b9){var _0x581d61=[];if(_0x45d7b9){_0x31ca77=_0x45d7b9;for(var _0x37ec1f=0x0;_0x37ec1f<_0x45d7b9[_0x7b62('0x41')];_0x37ec1f+=0x1){_0x31ca77[_0x37ec1f][_0x7b62('0x56')]=[];_0x581d61[_0x7b62('0x6c')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x2763a3[_0x7b62('0x5e')]['id'],_0x45d7b9[_0x37ec1f]['id']],'ToId':[_0x2763a3[_0x7b62('0x5e')]['id'],_0x45d7b9[_0x37ec1f]['id']],'ChatGroupId':null},'attributes':['id',_0x7b62('0x6d'),'FromId',_0x7b62('0x6e'),_0x7b62('0x6f'),_0x7b62('0x53')],'order':qs[_0x7b62('0x43')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7b62('0x49')](wrapUser(_0x45d7b9[_0x37ec1f])));}return BPromise[_0x7b62('0x70')](_0x581d61);}return[];})[_0x7b62('0x49')](function(_0x5d7af5){return{'rows':_0x5d7af5,'count':_0x5d7af5[_0x7b62('0x41')]};})['then'](respondWithResult(_0x3d9918,null))[_0x7b62('0x4d')](handleError(_0x3d9918,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4295755..af19207 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 _0x49a1=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','emit'];(function(_0x8b1425,_0x57171c){var _0x416663=function(_0x1ea508){while(--_0x1ea508){_0x8b1425['push'](_0x8b1425['shift']());}};_0x416663(++_0x57171c);}(_0x49a1,0x190));var _0x149a=function(_0x29aa0c,_0x46d2e9){_0x29aa0c=_0x29aa0c-0x0;var _0x491a1d=_0x49a1[_0x29aa0c];return _0x491a1d;};'use strict';var EventEmitter=require(_0x149a('0x0'));var ChatInternalMessage=require(_0x149a('0x1'))['db'][_0x149a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x149a('0x3')](0x0);var events={'afterCreate':_0x149a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49a483){return function(_0x3f7895,_0x13623b,_0x51b039){ChatInternalMessageEvents[_0x149a('0x5')](_0x49a483+':'+_0x3f7895['id'],_0x3f7895);ChatInternalMessageEvents[_0x149a('0x5')](_0x49a483,_0x3f7895);_0x51b039(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x149a('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x0362=['update','remove','emit','hook','exports','events','ChatInternalMessage','save'];(function(_0x11c3a3,_0x5b6b7c){var _0xa19d6a=function(_0x5ddd0f){while(--_0x5ddd0f){_0x11c3a3['push'](_0x11c3a3['shift']());}};_0xa19d6a(++_0x5b6b7c);}(_0x0362,0x15d));var _0x2036=function(_0x5e20ba,_0x2adb5d){_0x5e20ba=_0x5e20ba-0x0;var _0x29b623=_0x0362[_0x5e20ba];return _0x29b623;};'use strict';var EventEmitter=require(_0x2036('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x2036('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2036('0x2'),'afterUpdate':_0x2036('0x3'),'afterDestroy':_0x2036('0x4')};function emitEvent(_0x5ad87b){return function(_0x2dcda5,_0x107482,_0x41db72){ChatInternalMessageEvents[_0x2036('0x5')](_0x5ad87b+':'+_0x2dcda5['id'],_0x2dcda5);ChatInternalMessageEvents[_0x2036('0x5')](_0x5ad87b,_0x2dcda5);_0x41db72(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x2036('0x6')](e,emitEvent(event));}}module[_0x2036('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 d97df86..10835b2 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 _0x28b7=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x28b7,0x17c));var _0x728b=function(_0x285c76,_0x12ea80){_0x285c76=_0x285c76-0x0;var _0x5ced11=_0x28b7[_0x285c76];return _0x5ced11;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var logger=require(_0x728b('0x2'))(_0x728b('0x3'));var moment=require(_0x728b('0x4'));var BPromise=require(_0x728b('0x5'));var rp=require(_0x728b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x728b('0x7'));var config=require(_0x728b('0x8'));var attributes=require(_0x728b('0x9'));module[_0x728b('0xa')]=function(_0x2101d5,_0x44b8e4){return _0x2101d5[_0x728b('0xb')](_0x728b('0xc'),attributes,{'tableName':_0x728b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x728b('0xe')});}; \ No newline at end of file +var _0xdf1e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0xdf1e,0x15e));var _0xedf1=function(_0x35826c,_0x57bdf7){_0x35826c=_0x35826c-0x0;var _0x2d844f=_0xdf1e[_0x35826c];return _0x2d844f;};'use strict';var _=require('lodash');var util=require(_0xedf1('0x0'));var logger=require('../../config/logger')(_0xedf1('0x1'));var moment=require(_0xedf1('0x2'));var BPromise=require(_0xedf1('0x3'));var rp=require(_0xedf1('0x4'));var fs=require('fs');var path=require(_0xedf1('0x5'));var rimraf=require(_0xedf1('0x6'));var config=require(_0xedf1('0x7'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x11fa72,_0x1ec6b8){return _0x11fa72[_0xedf1('0x8')](_0xedf1('0x9'),attributes,{'tableName':_0xedf1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedf1('0xb'),'collate':_0xedf1('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3cc3de6..2cdd7fe 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 _0xf101=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','util','moment','bluebird','randomstring'];(function(_0x34fc32,_0x1b372f){var _0x567758=function(_0x54ca0f){while(--_0x54ca0f){_0x34fc32['push'](_0x34fc32['shift']());}};_0x567758(++_0x1b372f);}(_0xf101,0x141));var _0x1f10=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0xf101[_0xab2afb];return _0x25262b;};'use strict';var _=require('lodash');var util=require(_0x1f10('0x0'));var moment=require(_0x1f10('0x1'));var BPromise=require(_0x1f10('0x2'));var rs=require(_0x1f10('0x3'));var fs=require('fs');var Redis=require(_0x1f10('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f10('0x5'))(_0x1f10('0x6'));var config=require(_0x1f10('0x7'));var jayson=require(_0x1f10('0x8'));var client=jayson[_0x1f10('0x9')]['http']({'port':0x232a});config['redis']=_[_0x1f10('0xa')](config[_0x1f10('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f10('0xc'))(new Redis(config[_0x1f10('0xb')]));require(_0x1f10('0xd'))[_0x1f10('0xe')](socket);function respondWithRpcPromise(_0x4c3e55,_0x2fb802,_0x33a239){return new BPromise(function(_0x5bee7e,_0x4d2183){return client[_0x1f10('0xf')](_0x4c3e55,_0x33a239)[_0x1f10('0x10')](function(_0x43cdb9){logger['info'](_0x1f10('0x11'),_0x2fb802,'request\x20sent');logger[_0x1f10('0x12')](_0x1f10('0x13'),_0x2fb802,_0x1f10('0x14'),JSON['stringify'](_0x43cdb9));if(_0x43cdb9['error']){if(_0x43cdb9[_0x1f10('0x15')][_0x1f10('0x16')]===0x1f4){logger[_0x1f10('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2fb802,_0x43cdb9['error'][_0x1f10('0x17')]);return _0x4d2183(_0x43cdb9[_0x1f10('0x15')]['message']);}logger[_0x1f10('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2fb802,_0x43cdb9['error']['message']);return _0x5bee7e(_0x43cdb9[_0x1f10('0x15')][_0x1f10('0x17')]);}else{logger[_0x1f10('0x18')](_0x1f10('0x11'),_0x2fb802,_0x1f10('0x14'));_0x5bee7e(_0x43cdb9['result']['message']);}})['catch'](function(_0x15a2f8){logger[_0x1f10('0x15')](_0x1f10('0x11'),_0x2fb802,_0x15a2f8);_0x4d2183(_0x15a2f8);});});} \ No newline at end of file +var _0x620b=['defaults','./chatInternalMessage.socket','request','info','request\x20sent','debug','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x620b,0x1c3));var _0xb620=function(_0x5e6678,_0x3f0c45){_0x5e6678=_0x5e6678-0x0;var _0x5c1dc5=_0x620b[_0x5e6678];return _0x5c1dc5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb620('0x0'));var rs=require(_0xb620('0x1'));var fs=require('fs');var Redis=require(_0xb620('0x2'));var db=require(_0xb620('0x3'))['db'];var utils=require(_0xb620('0x4'));var logger=require(_0xb620('0x5'))(_0xb620('0x6'));var config=require(_0xb620('0x7'));var jayson=require(_0xb620('0x8'));var client=jayson['client'][_0xb620('0x9')]({'port':0x232a});config[_0xb620('0xa')]=_[_0xb620('0xb')](config[_0xb620('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb620('0xa')]));require(_0xb620('0xc'))['register'](socket);function respondWithRpcPromise(_0x186a11,_0x18c4fd,_0x1fd63d){return new BPromise(function(_0x3f2911,_0x34e508){return client[_0xb620('0xd')](_0x186a11,_0x1fd63d)['then'](function(_0x2de2d1){logger[_0xb620('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x18c4fd,_0xb620('0xf'));logger[_0xb620('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x18c4fd,'request\x20sent',JSON['stringify'](_0x2de2d1));if(_0x2de2d1[_0xb620('0x11')]){if(_0x2de2d1['error']['code']===0x1f4){logger[_0xb620('0x11')](_0xb620('0x12'),_0x18c4fd,_0x2de2d1[_0xb620('0x11')]['message']);return _0x34e508(_0x2de2d1[_0xb620('0x11')]['message']);}logger[_0xb620('0x11')](_0xb620('0x12'),_0x18c4fd,_0x2de2d1[_0xb620('0x11')][_0xb620('0x13')]);return _0x3f2911(_0x2de2d1[_0xb620('0x11')][_0xb620('0x13')]);}else{logger['info'](_0xb620('0x12'),_0x18c4fd,_0xb620('0xf'));_0x3f2911(_0x2de2d1[_0xb620('0x14')][_0xb620('0x13')]);}})[_0xb620('0x15')](function(_0x448bb8){logger[_0xb620('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x18c4fd,_0x448bb8);_0x34e508(_0x448bb8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index dc22198..aca73d7 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 _0x93f9=['save','remove','emit','removeListener','length','./chatInternalMessage.events'];(function(_0x26c4f9,_0x2773ec){var _0x3e7e9f=function(_0x247ed6){while(--_0x247ed6){_0x26c4f9['push'](_0x26c4f9['shift']());}};_0x3e7e9f(++_0x2773ec);}(_0x93f9,0xd1));var _0x993f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x93f9[_0x5783f4];return _0x28e380;};'use strict';var ChatInternalMessageEvents=require(_0x993f('0x0'));var events=[_0x993f('0x1'),_0x993f('0x2'),'update'];function createListener(_0x686b67,_0x11c5e7){return function(_0x5f35d8){_0x11c5e7[_0x993f('0x3')](_0x686b67,_0x5f35d8);};}function removeListener(_0x2a47ac,_0x5d7f39){return function(){ChatInternalMessageEvents[_0x993f('0x4')](_0x2a47ac,_0x5d7f39);};}exports['register']=function(_0x2f2b9a){for(var _0x22cc65=0x0,_0x3df05d=events[_0x993f('0x5')];_0x22cc65<_0x3df05d;_0x22cc65++){var _0x789c03=events[_0x22cc65];var _0x56c68f=createListener('chatInternalMessage:'+_0x789c03,_0x2f2b9a);ChatInternalMessageEvents['on'](_0x789c03,_0x56c68f);}}; \ No newline at end of file +var _0xf5c4=['chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x5eaf1f,_0xac547c){var _0x24e765=function(_0x412b0f){while(--_0x412b0f){_0x5eaf1f['push'](_0x5eaf1f['shift']());}};_0x24e765(++_0xac547c);}(_0xf5c4,0xa1));var _0x4f5c=function(_0x4d1ecf,_0x374814){_0x4d1ecf=_0x4d1ecf-0x0;var _0x19c055=_0xf5c4[_0x4d1ecf];return _0x19c055;};'use strict';var ChatInternalMessageEvents=require(_0x4f5c('0x0'));var events=['save',_0x4f5c('0x1'),_0x4f5c('0x2')];function createListener(_0xec8856,_0x720e6d){return function(_0x48ba2d){_0x720e6d[_0x4f5c('0x3')](_0xec8856,_0x48ba2d);};}function removeListener(_0x1ce3b0,_0x424cbb){return function(){ChatInternalMessageEvents[_0x4f5c('0x4')](_0x1ce3b0,_0x424cbb);};}exports[_0x4f5c('0x5')]=function(_0x370033){for(var _0x4bb052=0x0,_0x1e2806=events[_0x4f5c('0x6')];_0x4bb052<_0x1e2806;_0x4bb052++){var _0x1e964f=events[_0x4bb052];var _0x4be69b=createListener(_0x4f5c('0x7')+_0x1e964f,_0x370033);ChatInternalMessageEvents['on'](_0x1e964f,_0x4be69b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index b5f0abb..fffba65 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 _0x0b80=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0x49c445,_0x350b54){var _0x118bb4=function(_0xdce3dc){while(--_0xdce3dc){_0x49c445['push'](_0x49c445['shift']());}};_0x118bb4(++_0x350b54);}(_0x0b80,0x196));var _0x00b8=function(_0x2f3f03,_0x3576b4){_0x2f3f03=_0x2f3f03-0x0;var _0x28ca10=_0x0b80[_0x2f3f03];return _0x28ca10;};'use strict';var multer=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var path=require(_0x00b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x00b8('0x3'));var router=express[_0x00b8('0x4')]();var fs_extra=require(_0x00b8('0x5'));var auth=require(_0x00b8('0x6'));var interaction=require(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var controller=require(_0x00b8('0x9'));router[_0x00b8('0xa')]('/',auth[_0x00b8('0xb')](),controller[_0x00b8('0xc')]);router[_0x00b8('0xa')](_0x00b8('0xd'),auth[_0x00b8('0xb')](),controller[_0x00b8('0xe')]);router[_0x00b8('0xa')](_0x00b8('0xf'),auth['isAuthenticated'](),controller[_0x00b8('0x10')]);router[_0x00b8('0xa')](_0x00b8('0x11'),auth['isAuthenticated'](),controller[_0x00b8('0x12')]);router[_0x00b8('0x13')]('/',auth[_0x00b8('0xb')](),controller[_0x00b8('0x14')]);router['put']('/:id',controller[_0x00b8('0x15')]);router['delete'](_0x00b8('0x11'),auth[_0x00b8('0xb')](),controller[_0x00b8('0x16')]);module[_0x00b8('0x17')]=router; \ No newline at end of file +var _0x5057=['Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','show','post','put','/:id','update','delete','exports','util','path','connect-timeout','express'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5057,0x1ca));var _0x7505=function(_0xb08374,_0x141ef3){_0xb08374=_0xb08374-0x0;var _0x428d38=_0x5057[_0xb08374];return _0x428d38;};'use strict';var multer=require('multer');var util=require(_0x7505('0x0'));var path=require(_0x7505('0x1'));var timeout=require(_0x7505('0x2'));var express=require(_0x7505('0x3'));var router=express[_0x7505('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7505('0x5'));var config=require(_0x7505('0x6'));var controller=require(_0x7505('0x7'));router[_0x7505('0x8')]('/',auth[_0x7505('0x9')](),controller[_0x7505('0xa')]);router[_0x7505('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7505('0xb')]);router['get'](_0x7505('0xc'),auth[_0x7505('0x9')](),controller[_0x7505('0xd')]);router[_0x7505('0x8')]('/:id',auth[_0x7505('0x9')](),controller[_0x7505('0xe')]);router[_0x7505('0xf')]('/',auth[_0x7505('0x9')](),controller['create']);router[_0x7505('0x10')](_0x7505('0x11'),controller[_0x7505('0x12')]);router[_0x7505('0x13')]('/:id',auth[_0x7505('0x9')](),controller['destroy']);module[_0x7505('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b113474..a45a3d6 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 _0x0833=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x1892a3,_0x5e5d83){var _0x551b4e=function(_0x1c39cc){while(--_0x1c39cc){_0x1892a3['push'](_0x1892a3['shift']());}};_0x551b4e(++_0x5e5d83);}(_0x0833,0x1bd));var _0x3083=function(_0x1aeff5,_0x365dc2){_0x1aeff5=_0x1aeff5-0x0;var _0x193808=_0x0833[_0x1aeff5];return _0x193808;};'use strict';var Sequelize=require(_0x3083('0x0'));module[_0x3083('0x1')]={'body':{'type':Sequelize[_0x3083('0x2')](_0x3083('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3083('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3083('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3083('0x6')]},'providerResponse':{'type':Sequelize[_0x3083('0x2')]}}; \ No newline at end of file +var _0xee4f=['BOOLEAN','out','DATE','sequelize','medium'];(function(_0x2cb4a0,_0x221e34){var _0x19bd31=function(_0x5c973b){while(--_0x5c973b){_0x2cb4a0['push'](_0x2cb4a0['shift']());}};_0x19bd31(++_0x221e34);}(_0xee4f,0xad));var _0xfee4=function(_0x329a93,_0x2321ef){_0x329a93=_0x329a93-0x0;var _0x5b9b61=_0xee4f[_0x329a93];return _0x5b9b61;};'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 diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 740c892..60259b9 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 _0x4580=['chat-interactions','accept','chat','read','readAt','format','UserId','get','ChatInteractionId','update','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','channel','motionChannel','EventManager','parse','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','event','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','name','index','map','ChatMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','params','describe','../../config/logger'];(function(_0x12e719,_0x4f5581){var _0x3bdd30=function(_0x489472){while(--_0x489472){_0x12e719['push'](_0x12e719['shift']());}};_0x3bdd30(++_0x4f5581);}(_0x4580,0x136));var _0x0458=function(_0x3a2f45,_0x628b19){_0x3a2f45=_0x3a2f45-0x0;var _0x25b26c=_0x4580[_0x3a2f45];return _0x25b26c;};'use strict';var emlformat=require(_0x0458('0x0'));var rimraf=require(_0x0458('0x1'));var zipdir=require(_0x0458('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0458('0x3'));var moment=require('moment');var BPromise=require(_0x0458('0x4'));var Mustache=require(_0x0458('0x5'));var util=require(_0x0458('0x6'));var path=require(_0x0458('0x7'));var sox=require(_0x0458('0x8'));var csv=require('to-csv');var ejs=require(_0x0458('0x9'));var fs=require('fs');var fs_extra=require(_0x0458('0xa'));var _=require('lodash');var squel=require(_0x0458('0xb'));var crypto=require(_0x0458('0xc'));var jsforce=require(_0x0458('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0458('0xe'));var querystring=require(_0x0458('0xf'));var Papa=require(_0x0458('0x10'));var Redis=require(_0x0458('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0458('0x12'));var hardwareService=require(_0x0458('0x13'));var logger=require('../../config/logger')(_0x0458('0x14'));var utils=require(_0x0458('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0458('0x16'))['db'];config[_0x0458('0x17')]=_[_0x0458('0x18')](config[_0x0458('0x17')],{'host':_0x0458('0x19'),'port':0x18eb});var socket=require(_0x0458('0x1a'))(new Redis(config[_0x0458('0x17')]));require(_0x0458('0x1b'))['register'](socket);var jayson=require(_0x0458('0x1c'));var client=jayson['client'][_0x0458('0x1d')]({'port':0x232c});var client9002=jayson[_0x0458('0x1e')][_0x0458('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x261989,_0x14b116,_0x5db9d9,_0x4f4141){return new BPromise(function(_0xc4706c,_0x4677af){var _0x1dd5e7=_0x4f4141||client;return _0x1dd5e7[_0x0458('0x1f')](_0x261989,_0x5db9d9)['then'](function(_0x276ab2){logger[_0x0458('0x20')](_0x0458('0x21'),_0x14b116,'request\x20sent');logger['debug'](_0x0458('0x22'),_0x14b116,_0x0458('0x23'),JSON[_0x0458('0x24')](_0x276ab2));if(_0x276ab2['error']){if(_0x276ab2[_0x0458('0x25')]['code']===0x1f4){logger[_0x0458('0x25')](_0x0458('0x21'),_0x14b116,_0x276ab2['error']['message']);return _0x4677af(_0x276ab2['error'][_0x0458('0x26')]);}logger[_0x0458('0x25')](_0x0458('0x21'),_0x14b116,_0x276ab2[_0x0458('0x25')][_0x0458('0x26')]);return _0xc4706c(_0x276ab2[_0x0458('0x25')]['message']);}else{logger[_0x0458('0x20')](_0x0458('0x21'),_0x14b116,_0x0458('0x23'));_0xc4706c(_0x276ab2[_0x0458('0x27')][_0x0458('0x26')]);}})[_0x0458('0x28')](function(_0x418386){logger['error'](_0x0458('0x21'),_0x14b116,_0x418386);_0x4677af(_0x418386);});});}function respondWithStatusCode(_0x72c84f,_0x4e9dec){_0x4e9dec=_0x4e9dec||0xcc;return function(_0x4d6eac){if(_0x4d6eac){return _0x72c84f[_0x0458('0x29')](_0x4e9dec);}return _0x72c84f[_0x0458('0x2a')](_0x4e9dec)[_0x0458('0x2b')]();};}function respondWithResult(_0x464cf5,_0x2fed83){_0x2fed83=_0x2fed83||0xc8;return function(_0x198546){if(_0x198546){return _0x464cf5[_0x0458('0x2a')](_0x2fed83)[_0x0458('0x2c')](_0x198546);}};}function respondWithFilteredResult(_0x302ffa,_0x1763bf){return function(_0x157b7e){if(_0x157b7e){var _0x26f52f=typeof _0x1763bf[_0x0458('0x2d')]==='undefined'&&typeof _0x1763bf[_0x0458('0x2e')]===_0x0458('0x2f');var _0xfee443=_0x157b7e[_0x0458('0x30')];var _0x11ccf1=_0x26f52f?0x0:_0x1763bf[_0x0458('0x2d')];var _0x4e8c9e=_0x26f52f?_0x157b7e[_0x0458('0x30')]:_0x1763bf[_0x0458('0x2d')]+_0x1763bf[_0x0458('0x2e')];var _0x3dc4d8;if(_0x4e8c9e>=_0xfee443){_0x4e8c9e=_0xfee443;_0x3dc4d8=0xc8;}else{_0x3dc4d8=0xce;}_0x302ffa[_0x0458('0x2a')](_0x3dc4d8);return _0x302ffa[_0x0458('0x31')]('Content-Range',_0x11ccf1+'-'+_0x4e8c9e+'/'+_0xfee443)[_0x0458('0x2c')](_0x157b7e);}return null;};}function patchUpdates(_0x3b6b72){return function(_0x4b4da2){try{jsonpatch[_0x0458('0x32')](_0x4b4da2,_0x3b6b72,!![]);}catch(_0x46ab77){return BPromise[_0x0458('0x33')](_0x46ab77);}return _0x4b4da2['save']();};}function saveUpdates(_0xb7bd01,_0x2de457){return function(_0x4e4efb){if(_0x4e4efb){return _0x4e4efb['update'](_0xb7bd01)[_0x0458('0x34')](function(_0x45f380){return _0x45f380;});}return null;};}function removeEntity(_0x2f5555,_0x21f6f8){return function(_0x5d4ecb){if(_0x5d4ecb){return _0x5d4ecb[_0x0458('0x35')]()[_0x0458('0x34')](function(){_0x2f5555['status'](0xcc)[_0x0458('0x2b')]();});}};}function handleEntityNotFound(_0x1b24dc,_0x9f98c0){return function(_0x28949f){if(!_0x28949f){_0x1b24dc[_0x0458('0x29')](0x194);}return _0x28949f;};}function handleError(_0x46eb04,_0x587e65){_0x587e65=_0x587e65||0x1f4;return function(_0x3b1d7d){logger[_0x0458('0x25')](_0x3b1d7d['stack']);if(_0x3b1d7d[_0x0458('0x36')]){delete _0x3b1d7d[_0x0458('0x36')];}_0x46eb04[_0x0458('0x2a')](_0x587e65)['send'](_0x3b1d7d);};}exports[_0x0458('0x37')]=function(_0x2905a4,_0x1e45b5){var _0x754d74={},_0x2ff3ab={},_0x4d57a3={'count':0x0,'rows':[]};var _0xe28213=_[_0x0458('0x38')](db[_0x0458('0x39')][_0x0458('0x3a')],function(_0x18ec57){return{'name':_0x18ec57[_0x0458('0x3b')],'type':_0x18ec57['type']['key']};});_0x2ff3ab[_0x0458('0x3c')]=_['map'](_0xe28213,'name');_0x2ff3ab[_0x0458('0x3d')]=_[_0x0458('0x3e')](_0x2905a4[_0x0458('0x3d')]);_0x2ff3ab[_0x0458('0x3f')]=_['intersection'](_0x2ff3ab[_0x0458('0x3c')],_0x2ff3ab[_0x0458('0x3d')]);_0x754d74['attributes']=_[_0x0458('0x40')](_0x2ff3ab[_0x0458('0x3c')],qs[_0x0458('0x41')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x41')]));_0x754d74[_0x0458('0x42')]=_0x754d74['attributes'][_0x0458('0x43')]?_0x754d74['attributes']:_0x2ff3ab[_0x0458('0x3c')];if(!_0x2905a4['query'][_0x0458('0x44')]('nolimit')){_0x754d74[_0x0458('0x2e')]=qs[_0x0458('0x2e')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x2e')]);_0x754d74[_0x0458('0x2d')]=qs[_0x0458('0x2d')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x2d')]);}_0x754d74[_0x0458('0x45')]=qs[_0x0458('0x46')](_0x2905a4[_0x0458('0x3d')]['sort']);_0x754d74[_0x0458('0x47')]=qs[_0x0458('0x3f')](_[_0x0458('0x48')](_0x2905a4[_0x0458('0x3d')],_0x2ff3ab[_0x0458('0x3f')]),_0xe28213);if(_0x2905a4['query']['filter']){_0x754d74['where']=_[_0x0458('0x49')](_0x754d74['where'],{'$or':_[_0x0458('0x38')](_0xe28213,function(_0x3ff470){if(_0x3ff470[_0x0458('0x4a')]!==_0x0458('0x4b')){var _0x1c2362={};_0x1c2362[_0x3ff470['name']]={'$like':'%'+_0x2905a4['query'][_0x0458('0x4c')]+'%'};return _0x1c2362;}})});}_0x754d74=_[_0x0458('0x49')]({},_0x754d74,_0x2905a4[_0x0458('0x4d')]);var _0x541ae4={'where':_0x754d74[_0x0458('0x47')]};return db[_0x0458('0x39')][_0x0458('0x30')](_0x541ae4)[_0x0458('0x34')](function(_0x349d32){_0x4d57a3[_0x0458('0x30')]=_0x349d32;if(_0x2905a4['query'][_0x0458('0x4e')]){_0x754d74['include']=[{'all':!![]}];}return db['ChatMessage'][_0x0458('0x4f')](_0x754d74);})[_0x0458('0x34')](function(_0x170ce8){_0x4d57a3[_0x0458('0x50')]=_0x170ce8;return _0x4d57a3;})[_0x0458('0x34')](respondWithFilteredResult(_0x1e45b5,_0x754d74))[_0x0458('0x28')](handleError(_0x1e45b5,null));};exports[_0x0458('0x51')]=function(_0x2e76b4,_0x3a4ba6){var _0x32c3dd={'raw':!![],'where':{'id':_0x2e76b4['params']['id']}},_0x7768f={};_0x7768f[_0x0458('0x3c')]=_[_0x0458('0x3e')](db[_0x0458('0x39')][_0x0458('0x3a')]);_0x7768f[_0x0458('0x3d')]=_['keys'](_0x2e76b4[_0x0458('0x3d')]);_0x7768f[_0x0458('0x3f')]=_[_0x0458('0x40')](_0x7768f['model'],_0x7768f[_0x0458('0x3d')]);_0x32c3dd[_0x0458('0x42')]=_[_0x0458('0x40')](_0x7768f[_0x0458('0x3c')],qs[_0x0458('0x41')](_0x2e76b4[_0x0458('0x3d')][_0x0458('0x41')]));_0x32c3dd[_0x0458('0x42')]=_0x32c3dd[_0x0458('0x42')][_0x0458('0x43')]?_0x32c3dd[_0x0458('0x42')]:_0x7768f[_0x0458('0x3c')];if(_0x2e76b4[_0x0458('0x3d')][_0x0458('0x4e')]){_0x32c3dd[_0x0458('0x52')]=[{'all':!![]}];}_0x32c3dd=_[_0x0458('0x49')]({},_0x32c3dd,_0x2e76b4['options']);return db['ChatMessage'][_0x0458('0x53')](_0x32c3dd)[_0x0458('0x34')](handleEntityNotFound(_0x3a4ba6,null))[_0x0458('0x34')](respondWithResult(_0x3a4ba6,null))[_0x0458('0x28')](handleError(_0x3a4ba6,null));};exports[_0x0458('0x54')]=function(_0x38cf6d,_0x1f14c5){return db[_0x0458('0x39')][_0x0458('0x54')](_0x38cf6d[_0x0458('0x55')],{})[_0x0458('0x34')](respondWithResult(_0x1f14c5,0xc9))[_0x0458('0x28')](handleError(_0x1f14c5,null));};exports['update']=function(_0x4014e3,_0x58857e){if(_0x4014e3['body']['id']){delete _0x4014e3[_0x0458('0x55')]['id'];}return db[_0x0458('0x39')][_0x0458('0x53')]({'where':{'id':_0x4014e3['params']['id']}})[_0x0458('0x34')](handleEntityNotFound(_0x58857e,null))['then'](saveUpdates(_0x4014e3[_0x0458('0x55')],null))[_0x0458('0x34')](respondWithResult(_0x58857e,null))[_0x0458('0x28')](handleError(_0x58857e,null));};exports[_0x0458('0x35')]=function(_0x3bbc80,_0x4fb1cb){return db[_0x0458('0x39')][_0x0458('0x53')]({'where':{'id':_0x3bbc80[_0x0458('0x56')]['id']}})[_0x0458('0x34')](handleEntityNotFound(_0x4fb1cb,null))[_0x0458('0x34')](removeEntity(_0x4fb1cb,null))[_0x0458('0x28')](handleError(_0x4fb1cb,null));};exports[_0x0458('0x57')]=function(_0x5bae36,_0x6bb4c1){return db['ChatMessage'][_0x0458('0x57')]()[_0x0458('0x34')](respondWithResult(_0x6bb4c1,null))['catch'](handleError(_0x6bb4c1,null));};var interaction_log=require(_0x0458('0x58'))(_0x0458('0x59'));exports[_0x0458('0x5a')]=function(_0x1d09ed,_0xa4a72a,_0x55693d){var _0x58654c={'agent':{},'channel':_0x0458('0x5b')};if(_0x1d09ed[_0x0458('0x55')]['id']){delete _0x1d09ed[_0x0458('0x55')]['id'];}_0x1d09ed[_0x0458('0x55')][_0x0458('0x5c')]=!![];_0x1d09ed[_0x0458('0x55')][_0x0458('0x5d')]=moment()[_0x0458('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')]=_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')]||_0x1d09ed['user']['id'];_0x58654c['agent']['id']=_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')];return db[_0x0458('0x39')]['find']({'where':{'id':_0x1d09ed[_0x0458('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa4a72a,null))[_0x0458('0x34')](saveUpdates(_0x1d09ed['body'],null))['then'](function(_0x362f5b){if(_0x362f5b){_0x58654c[_0x0458('0x26')]=_0x362f5b[_0x0458('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x362f5b[_0x0458('0x61')]}});}return null;})[_0x0458('0x34')](handleEntityNotFound(_0xa4a72a,null))[_0x0458('0x34')](function(_0x59cbc7){if(_0x59cbc7){return _0x59cbc7[_0x0458('0x62')]({'UserId':_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')],'read1stAt':_[_0x0458('0x63')](_0x59cbc7[_0x0458('0x64')])?moment()[_0x0458('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x31da7f){if(_0x31da7f){_0x58654c[_0x0458('0x65')]=_0x31da7f[_0x0458('0x60')]({'plain':!![]});interaction_log[_0x0458('0x20')](_0x0458('0x66'),_0x1d09ed[_0x0458('0x67')]['id'],_0x1d09ed[_0x0458('0x67')][_0x0458('0x36')],_0x1d09ed[_0x0458('0x67')][_0x0458('0x68')],_0x58654c[_0x0458('0x65')]['id'],_0x1d09ed[_0x0458('0x55')]?JSON[_0x0458('0x24')](_0x1d09ed['body']):_0x0458('0x69'));return respondWithRpcPromise(_0x0458('0x6a'),_0x0458('0x6b'),_0x58654c);}return null;})[_0x0458('0x34')](function(_0x2b9446){var _0x2df0a8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b9446[_0x0458('0x26')][_0x0458('0x6c')];return db[_0x0458('0x6d')][_0x0458('0x3d')](_0x2df0a8,{'type':db[_0x0458('0x6e')][_0x0458('0x6f')][_0x0458('0x70')],'raw':!![]})[_0x0458('0x34')](function(_0x2ad9f0){return _0x2ad9f0;});})[_0x0458('0x34')](function(_0x4ea3f0){if(_0x4ea3f0){_0x58654c['message'][_0x0458('0x71')]=_0x4ea3f0[0x0];if(!_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')])return;return db[_0x0458('0x72')][_0x0458('0x53')]({'where':{'id':_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')],'role':_0x0458('0x73')},'attributes':['id','name',_0x0458('0x74'),_0x0458('0x75'),_0x0458('0x76')],'raw':!![]});}return null;})[_0x0458('0x34')](function(_0x1aaf65){if(!_0x1aaf65)return null;_0x58654c[_0x0458('0x26')][_0x0458('0x73')]=_0x1aaf65;return _0x58654c;})[_0x0458('0x34')](function(_0x17c782){if(_0x17c782){if(_0x1d09ed['body']['manual']){_0x58654c[_0x0458('0x26')][_0x0458('0x77')]=util[_0x0458('0x5e')]('SIP/%s',_0x1d09ed[_0x0458('0x67')]['name']);_0x58654c[_0x0458('0x26')][_0x0458('0x78')]=_0x58654c[_0x0458('0x78')];_0x58654c['message'][_0x0458('0x79')]=_0x58654c[_0x0458('0x78')];_0x58654c['message']['event']='accept';return respondWithRpcPromise(_0x0458('0x7a'),_0x0458('0x7a'),{'event':'acceptmessage','message':_[_0x0458('0x49')](_0x58654c[_0x0458('0x26')],JSON[_0x0458('0x7b')](_0x58654c['interaction']['formData']))},client9002)[_0x0458('0x34')](function(){return _0x58654c;});}return _0x58654c;}return null;})[_0x0458('0x34')](respondWithResult(_0xa4a72a,null))[_0x0458('0x28')](handleError(_0xa4a72a,null));};var interaction_log=require(_0x0458('0x58'))(_0x0458('0x59'));exports[_0x0458('0x33')]=function(_0x4be26d,_0x3d7ff0,_0x2e72eb){var _0x58b3be={'agent':{},'channel':_0x0458('0x5b')};if(_0x4be26d[_0x0458('0x55')]['id']){delete _0x4be26d[_0x0458('0x55')]['id'];}_0x4be26d[_0x0458('0x55')][_0x0458('0x5f')]=_0x4be26d[_0x0458('0x55')]['UserId']||_0x4be26d[_0x0458('0x67')]['id'];_0x58b3be[_0x0458('0x73')]['id']=_0x4be26d[_0x0458('0x55')]['UserId'];return db['ChatMessage'][_0x0458('0x53')]({'where':{'id':_0x4be26d['params']['id'],'UserId':null}})[_0x0458('0x34')](handleEntityNotFound(_0x3d7ff0,null))[_0x0458('0x34')](function(_0x3636b6){if(_0x3636b6){_0x58b3be[_0x0458('0x26')]=_0x3636b6['get']({'plain':!![]});return db[_0x0458('0x7c')]['find']({'where':{'id':_0x3636b6[_0x0458('0x61')]}});}return null;})[_0x0458('0x34')](handleEntityNotFound(_0x3d7ff0,null))['then'](function(_0x4c8e5e){if(_0x4c8e5e){_0x58b3be[_0x0458('0x65')]=_0x4c8e5e[_0x0458('0x60')]({'plain':!![]});interaction_log[_0x0458('0x20')](_0x0458('0x7d'),_0x4be26d[_0x0458('0x67')]['id'],_0x4be26d[_0x0458('0x67')][_0x0458('0x36')],_0x4be26d[_0x0458('0x67')]['role'],_0x58b3be[_0x0458('0x65')]['id'],_0x4be26d[_0x0458('0x55')]?JSON[_0x0458('0x24')](_0x4be26d[_0x0458('0x55')]):_0x0458('0x69'));return respondWithRpcPromise(_0x0458('0x7e'),_0x0458('0x7f'),_0x58b3be);}return null;})[_0x0458('0x34')](function(_0x2eac78){var _0x3ed047=_0x0458('0x80')+_0x2eac78[_0x0458('0x26')][_0x0458('0x6c')];return db[_0x0458('0x6d')][_0x0458('0x3d')](_0x3ed047,{'type':db[_0x0458('0x6e')][_0x0458('0x6f')][_0x0458('0x70')],'raw':!![]})['then'](function(_0x36a2e6){return _0x36a2e6;});})[_0x0458('0x34')](function(_0x4fc6ef){if(_0x4fc6ef){_0x58b3be[_0x0458('0x26')][_0x0458('0x71')]=_0x4fc6ef[0x0];if(!_0x4be26d['body'][_0x0458('0x5f')])return;return db['User'][_0x0458('0x53')]({'where':{'id':_0x4be26d['body'][_0x0458('0x5f')],'role':_0x0458('0x73')},'attributes':['id',_0x0458('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x0458('0x34')](function(_0xcd6c6e){if(!_0xcd6c6e)return null;_0x58b3be[_0x0458('0x26')][_0x0458('0x73')]=_0xcd6c6e;return _0x58b3be;})['then'](function(_0x215598){if(_0x215598){_0x215598[_0x0458('0x26')][_0x0458('0x77')]=util['format'](_0x0458('0x81'),_0x4be26d[_0x0458('0x67')][_0x0458('0x36')]);_0x215598[_0x0458('0x26')][_0x0458('0x78')]=_0x58b3be['channel'];_0x215598[_0x0458('0x26')][_0x0458('0x79')]=_0x58b3be[_0x0458('0x78')];_0x215598[_0x0458('0x26')][_0x0458('0x82')]=_0x0458('0x33');respondWithRpcPromise(_0x0458('0x7a'),_0x0458('0x7a'),{'event':_0x0458('0x83'),'message':_[_0x0458('0x49')](_0x58b3be['message'],JSON[_0x0458('0x7b')](_0x58b3be[_0x0458('0x65')][_0x0458('0x84')]))},client9002);return _0x58b3be;}return null;})[_0x0458('0x34')](respondWithResult(_0x3d7ff0,null))[_0x0458('0x28')](handleError(_0x3d7ff0,null));}; \ No newline at end of file +var _0xa318=['options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','role','RejectMessage','rejectMessage','Sequelize','motionChannel','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x52a23d,_0xd93644){var _0x4f360b=function(_0x1c60c0){while(--_0x1c60c0){_0x52a23d['push'](_0x52a23d['shift']());}};_0x4f360b(++_0xd93644);}(_0xa318,0x13e));var _0x8a31=function(_0x27a9cd,_0x40311d){_0x27a9cd=_0x27a9cd-0x0;var _0xd8be27=_0xa318[_0x27a9cd];return _0xd8be27;};'use strict';var emlformat=require(_0x8a31('0x0'));var rimraf=require(_0x8a31('0x1'));var zipdir=require(_0x8a31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a31('0x3'));var Mustache=require(_0x8a31('0x4'));var util=require(_0x8a31('0x5'));var path=require('path');var sox=require(_0x8a31('0x6'));var csv=require('to-csv');var ejs=require(_0x8a31('0x7'));var fs=require('fs');var fs_extra=require(_0x8a31('0x8'));var _=require('lodash');var squel=require(_0x8a31('0x9'));var crypto=require('crypto');var jsforce=require(_0x8a31('0xa'));var deskjs=require(_0x8a31('0xb'));var toCsv=require(_0x8a31('0xc'));var querystring=require(_0x8a31('0xd'));var Papa=require(_0x8a31('0xe'));var Redis=require(_0x8a31('0xf'));var authService=require(_0x8a31('0x10'));var qs=require(_0x8a31('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a31('0x12'));var logger=require('../../config/logger')(_0x8a31('0x13'));var utils=require(_0x8a31('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8a31('0x15'));var db=require('../../mysqldb')['db'];config[_0x8a31('0x16')]=_[_0x8a31('0x17')](config['redis'],{'host':_0x8a31('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a31('0x16')]));require(_0x8a31('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8a31('0x1a')][_0x8a31('0x1b')]({'port':0x232c});var client9002=jayson[_0x8a31('0x1a')][_0x8a31('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f9398,_0x970c2f,_0xc423ee,_0x1f0508){return new BPromise(function(_0x1b941d,_0x49ec24){var _0x5b9b9e=_0x1f0508||client;return _0x5b9b9e['request'](_0x3f9398,_0xc423ee)['then'](function(_0xc40602){logger['info'](_0x8a31('0x1c'),_0x970c2f,_0x8a31('0x1d'));logger[_0x8a31('0x1e')](_0x8a31('0x1f'),_0x970c2f,_0x8a31('0x1d'),JSON['stringify'](_0xc40602));if(_0xc40602[_0x8a31('0x20')]){if(_0xc40602[_0x8a31('0x20')]['code']===0x1f4){logger['error'](_0x8a31('0x1c'),_0x970c2f,_0xc40602[_0x8a31('0x20')][_0x8a31('0x21')]);return _0x49ec24(_0xc40602[_0x8a31('0x20')][_0x8a31('0x21')]);}logger[_0x8a31('0x20')](_0x8a31('0x1c'),_0x970c2f,_0xc40602[_0x8a31('0x20')][_0x8a31('0x21')]);return _0x1b941d(_0xc40602['error'][_0x8a31('0x21')]);}else{logger[_0x8a31('0x22')]('ChatMessage,\x20%s,\x20%s',_0x970c2f,_0x8a31('0x1d'));_0x1b941d(_0xc40602[_0x8a31('0x23')][_0x8a31('0x21')]);}})[_0x8a31('0x24')](function(_0x1da35b){logger['error'](_0x8a31('0x1c'),_0x970c2f,_0x1da35b);_0x49ec24(_0x1da35b);});});}function respondWithStatusCode(_0xce4f0a,_0x94e6f1){_0x94e6f1=_0x94e6f1||0xcc;return function(_0x395005){if(_0x395005){return _0xce4f0a['sendStatus'](_0x94e6f1);}return _0xce4f0a[_0x8a31('0x25')](_0x94e6f1)['end']();};}function respondWithResult(_0xd847d3,_0x3b7128){_0x3b7128=_0x3b7128||0xc8;return function(_0xfc6943){if(_0xfc6943){return _0xd847d3[_0x8a31('0x25')](_0x3b7128)[_0x8a31('0x26')](_0xfc6943);}};}function respondWithFilteredResult(_0x4baab1,_0x2280ca){return function(_0x4db5d2){if(_0x4db5d2){var _0xc1e63=typeof _0x2280ca[_0x8a31('0x27')]===_0x8a31('0x28')&&typeof _0x2280ca[_0x8a31('0x29')]===_0x8a31('0x28');var _0x339ed2=_0x4db5d2[_0x8a31('0x2a')];var _0x5e4c49=_0xc1e63?0x0:_0x2280ca['offset'];var _0x44db32=_0xc1e63?_0x4db5d2[_0x8a31('0x2a')]:_0x2280ca[_0x8a31('0x27')]+_0x2280ca[_0x8a31('0x29')];var _0x15dd0a;if(_0x44db32>=_0x339ed2){_0x44db32=_0x339ed2;_0x15dd0a=0xc8;}else{_0x15dd0a=0xce;}_0x4baab1[_0x8a31('0x25')](_0x15dd0a);return _0x4baab1[_0x8a31('0x2b')](_0x8a31('0x2c'),_0x5e4c49+'-'+_0x44db32+'/'+_0x339ed2)[_0x8a31('0x26')](_0x4db5d2);}return null;};}function patchUpdates(_0x209695){return function(_0x3e12db){try{jsonpatch[_0x8a31('0x2d')](_0x3e12db,_0x209695,!![]);}catch(_0x4385f8){return BPromise[_0x8a31('0x2e')](_0x4385f8);}return _0x3e12db[_0x8a31('0x2f')]();};}function saveUpdates(_0x3b56df,_0x3d2b7f){return function(_0x4f894f){if(_0x4f894f){return _0x4f894f[_0x8a31('0x30')](_0x3b56df)[_0x8a31('0x31')](function(_0x3142b9){return _0x3142b9;});}return null;};}function removeEntity(_0x6df394,_0x11c8ab){return function(_0xfba038){if(_0xfba038){return _0xfba038['destroy']()['then'](function(){_0x6df394[_0x8a31('0x25')](0xcc)[_0x8a31('0x32')]();});}};}function handleEntityNotFound(_0x32b424,_0x30bf2a){return function(_0x3e7261){if(!_0x3e7261){_0x32b424['sendStatus'](0x194);}return _0x3e7261;};}function handleError(_0x4cf542,_0x159813){_0x159813=_0x159813||0x1f4;return function(_0x3452a2){logger[_0x8a31('0x20')](_0x3452a2[_0x8a31('0x33')]);if(_0x3452a2[_0x8a31('0x34')]){delete _0x3452a2[_0x8a31('0x34')];}_0x4cf542['status'](_0x159813)['send'](_0x3452a2);};}exports[_0x8a31('0x35')]=function(_0x476c65,_0x2e3c64){var _0x181ad7={},_0x5b4014={},_0x18a220={'count':0x0,'rows':[]};var _0x37c227=_[_0x8a31('0x36')](db[_0x8a31('0x37')][_0x8a31('0x38')],function(_0x117bca){return{'name':_0x117bca[_0x8a31('0x39')],'type':_0x117bca[_0x8a31('0x3a')][_0x8a31('0x3b')]};});_0x5b4014['model']=_[_0x8a31('0x36')](_0x37c227,_0x8a31('0x34'));_0x5b4014[_0x8a31('0x3c')]=_['keys'](_0x476c65[_0x8a31('0x3c')]);_0x5b4014[_0x8a31('0x3d')]=_[_0x8a31('0x3e')](_0x5b4014['model'],_0x5b4014[_0x8a31('0x3c')]);_0x181ad7[_0x8a31('0x3f')]=_['intersection'](_0x5b4014[_0x8a31('0x40')],qs[_0x8a31('0x41')](_0x476c65[_0x8a31('0x3c')]['fields']));_0x181ad7[_0x8a31('0x3f')]=_0x181ad7[_0x8a31('0x3f')][_0x8a31('0x42')]?_0x181ad7[_0x8a31('0x3f')]:_0x5b4014[_0x8a31('0x40')];if(!_0x476c65[_0x8a31('0x3c')][_0x8a31('0x43')](_0x8a31('0x44'))){_0x181ad7[_0x8a31('0x29')]=qs[_0x8a31('0x29')](_0x476c65[_0x8a31('0x3c')][_0x8a31('0x29')]);_0x181ad7[_0x8a31('0x27')]=qs[_0x8a31('0x27')](_0x476c65[_0x8a31('0x3c')][_0x8a31('0x27')]);}_0x181ad7['order']=qs[_0x8a31('0x45')](_0x476c65[_0x8a31('0x3c')][_0x8a31('0x45')]);_0x181ad7[_0x8a31('0x46')]=qs[_0x8a31('0x3d')](_[_0x8a31('0x47')](_0x476c65[_0x8a31('0x3c')],_0x5b4014[_0x8a31('0x3d')]),_0x37c227);if(_0x476c65[_0x8a31('0x3c')][_0x8a31('0x48')]){_0x181ad7[_0x8a31('0x46')]=_[_0x8a31('0x49')](_0x181ad7[_0x8a31('0x46')],{'$or':_[_0x8a31('0x36')](_0x37c227,function(_0x3f5bc4){if(_0x3f5bc4['type']!==_0x8a31('0x4a')){var _0x5b1fd9={};_0x5b1fd9[_0x3f5bc4['name']]={'$like':'%'+_0x476c65[_0x8a31('0x3c')][_0x8a31('0x48')]+'%'};return _0x5b1fd9;}})});}_0x181ad7=_['merge']({},_0x181ad7,_0x476c65[_0x8a31('0x4b')]);var _0x3483e3={'where':_0x181ad7['where']};return db[_0x8a31('0x37')][_0x8a31('0x2a')](_0x3483e3)[_0x8a31('0x31')](function(_0x55f49a){_0x18a220['count']=_0x55f49a;if(_0x476c65[_0x8a31('0x3c')][_0x8a31('0x4c')]){_0x181ad7[_0x8a31('0x4d')]=[{'all':!![]}];}return db[_0x8a31('0x37')][_0x8a31('0x4e')](_0x181ad7);})[_0x8a31('0x31')](function(_0x3bb22c){_0x18a220[_0x8a31('0x4f')]=_0x3bb22c;return _0x18a220;})[_0x8a31('0x31')](respondWithFilteredResult(_0x2e3c64,_0x181ad7))[_0x8a31('0x24')](handleError(_0x2e3c64,null));};exports[_0x8a31('0x50')]=function(_0x497512,_0x106f81){var _0x352bc9={'raw':!![],'where':{'id':_0x497512[_0x8a31('0x51')]['id']}},_0x588c36={};_0x588c36[_0x8a31('0x40')]=_[_0x8a31('0x52')](db[_0x8a31('0x37')][_0x8a31('0x38')]);_0x588c36[_0x8a31('0x3c')]=_[_0x8a31('0x52')](_0x497512[_0x8a31('0x3c')]);_0x588c36[_0x8a31('0x3d')]=_[_0x8a31('0x3e')](_0x588c36[_0x8a31('0x40')],_0x588c36[_0x8a31('0x3c')]);_0x352bc9['attributes']=_[_0x8a31('0x3e')](_0x588c36[_0x8a31('0x40')],qs[_0x8a31('0x41')](_0x497512['query'][_0x8a31('0x41')]));_0x352bc9[_0x8a31('0x3f')]=_0x352bc9[_0x8a31('0x3f')][_0x8a31('0x42')]?_0x352bc9['attributes']:_0x588c36[_0x8a31('0x40')];if(_0x497512[_0x8a31('0x3c')][_0x8a31('0x4c')]){_0x352bc9[_0x8a31('0x4d')]=[{'all':!![]}];}_0x352bc9=_['merge']({},_0x352bc9,_0x497512[_0x8a31('0x4b')]);return db[_0x8a31('0x37')][_0x8a31('0x53')](_0x352bc9)[_0x8a31('0x31')](handleEntityNotFound(_0x106f81,null))[_0x8a31('0x31')](respondWithResult(_0x106f81,null))[_0x8a31('0x24')](handleError(_0x106f81,null));};exports['create']=function(_0x49384d,_0x5f2cd7){return db[_0x8a31('0x37')][_0x8a31('0x54')](_0x49384d['body'],{})[_0x8a31('0x31')](respondWithResult(_0x5f2cd7,0xc9))[_0x8a31('0x24')](handleError(_0x5f2cd7,null));};exports[_0x8a31('0x30')]=function(_0x525d62,_0x220704){if(_0x525d62[_0x8a31('0x55')]['id']){delete _0x525d62[_0x8a31('0x55')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x525d62[_0x8a31('0x51')]['id']}})['then'](handleEntityNotFound(_0x220704,null))[_0x8a31('0x31')](saveUpdates(_0x525d62[_0x8a31('0x55')],null))[_0x8a31('0x31')](respondWithResult(_0x220704,null))[_0x8a31('0x24')](handleError(_0x220704,null));};exports[_0x8a31('0x56')]=function(_0x5255cd,_0x3d3615){return db[_0x8a31('0x37')][_0x8a31('0x53')]({'where':{'id':_0x5255cd[_0x8a31('0x51')]['id']}})[_0x8a31('0x31')](handleEntityNotFound(_0x3d3615,null))[_0x8a31('0x31')](removeEntity(_0x3d3615,null))[_0x8a31('0x24')](handleError(_0x3d3615,null));};exports[_0x8a31('0x57')]=function(_0x1be34b,_0x55ce9d){return db[_0x8a31('0x37')][_0x8a31('0x57')]()['then'](respondWithResult(_0x55ce9d,null))[_0x8a31('0x24')](handleError(_0x55ce9d,null));};var interaction_log=require(_0x8a31('0x58'))(_0x8a31('0x59'));exports[_0x8a31('0x5a')]=function(_0x392d26,_0x8813ab,_0xfbd8c5){var _0x2a3ac1={'agent':{},'channel':_0x8a31('0x5b')};if(_0x392d26[_0x8a31('0x55')]['id']){delete _0x392d26[_0x8a31('0x55')]['id'];}_0x392d26[_0x8a31('0x55')][_0x8a31('0x5c')]=!![];_0x392d26[_0x8a31('0x55')]['readAt']=moment()[_0x8a31('0x5d')](_0x8a31('0x5e'));_0x392d26['body'][_0x8a31('0x5f')]=_0x392d26[_0x8a31('0x55')][_0x8a31('0x5f')]||_0x392d26[_0x8a31('0x60')]['id'];_0x2a3ac1[_0x8a31('0x61')]['id']=_0x392d26[_0x8a31('0x55')][_0x8a31('0x5f')];return db[_0x8a31('0x37')][_0x8a31('0x53')]({'where':{'id':_0x392d26['params']['id'],'UserId':null}})[_0x8a31('0x31')](handleEntityNotFound(_0x8813ab,null))[_0x8a31('0x31')](saveUpdates(_0x392d26['body'],null))[_0x8a31('0x31')](function(_0x3a65f6){if(_0x3a65f6){_0x2a3ac1[_0x8a31('0x21')]=_0x3a65f6[_0x8a31('0x62')]({'plain':!![]});return db[_0x8a31('0x63')]['find']({'where':{'id':_0x3a65f6[_0x8a31('0x64')]}});}return null;})[_0x8a31('0x31')](handleEntityNotFound(_0x8813ab,null))['then'](function(_0x5bd9f8){if(_0x5bd9f8){return _0x5bd9f8[_0x8a31('0x30')]({'UserId':_0x392d26[_0x8a31('0x55')][_0x8a31('0x5f')],'read1stAt':_[_0x8a31('0x65')](_0x5bd9f8[_0x8a31('0x66')])?moment()['format'](_0x8a31('0x5e')):undefined});}return null;})[_0x8a31('0x31')](function(_0xfb6d05){if(_0xfb6d05){_0x2a3ac1[_0x8a31('0x67')]=_0xfb6d05['get']({'plain':!![]});interaction_log['info'](_0x8a31('0x68'),_0x392d26[_0x8a31('0x60')]['id'],_0x392d26['user'][_0x8a31('0x34')],_0x392d26[_0x8a31('0x60')]['role'],_0x2a3ac1[_0x8a31('0x67')]['id'],_0x392d26[_0x8a31('0x55')]?JSON[_0x8a31('0x69')](_0x392d26[_0x8a31('0x55')]):_0x8a31('0x6a'));return respondWithRpcPromise(_0x8a31('0x6b'),_0x8a31('0x6c'),_0x2a3ac1);}return null;})[_0x8a31('0x31')](function(_0x9bd1f2){var _0x11f0fe=_0x8a31('0x6d')+_0x9bd1f2[_0x8a31('0x21')][_0x8a31('0x6e')];return db[_0x8a31('0x6f')][_0x8a31('0x3c')](_0x11f0fe,{'type':db['Sequelize'][_0x8a31('0x70')][_0x8a31('0x71')],'raw':!![]})[_0x8a31('0x31')](function(_0x52d7bd){return _0x52d7bd;});})[_0x8a31('0x31')](function(_0x596275){if(_0x596275){_0x2a3ac1[_0x8a31('0x21')][_0x8a31('0x72')]=_0x596275[0x0];if(!_0x392d26[_0x8a31('0x55')][_0x8a31('0x5f')])return;return db[_0x8a31('0x73')]['find']({'where':{'id':_0x392d26['body'][_0x8a31('0x5f')],'role':_0x8a31('0x61')},'attributes':['id',_0x8a31('0x34'),'fullname',_0x8a31('0x74'),_0x8a31('0x75')],'raw':!![]});}return null;})[_0x8a31('0x31')](function(_0xac1f9b){if(!_0xac1f9b)return null;_0x2a3ac1[_0x8a31('0x21')][_0x8a31('0x61')]=_0xac1f9b;return _0x2a3ac1;})[_0x8a31('0x31')](function(_0x49598d){if(_0x49598d){if(_0x392d26[_0x8a31('0x55')][_0x8a31('0x76')]){_0x2a3ac1[_0x8a31('0x21')][_0x8a31('0x77')]=util[_0x8a31('0x5d')](_0x8a31('0x78'),_0x392d26[_0x8a31('0x60')][_0x8a31('0x34')]);_0x2a3ac1[_0x8a31('0x21')][_0x8a31('0x79')]=_0x2a3ac1['channel'];_0x2a3ac1[_0x8a31('0x21')]['motionChannel']=_0x2a3ac1[_0x8a31('0x79')];_0x2a3ac1[_0x8a31('0x21')][_0x8a31('0x7a')]=_0x8a31('0x5a');return respondWithRpcPromise(_0x8a31('0x7b'),'EventManager',{'event':_0x8a31('0x7c'),'message':_[_0x8a31('0x49')](_0x2a3ac1[_0x8a31('0x21')],JSON[_0x8a31('0x7d')](_0x2a3ac1['interaction']['formData']))},client9002)[_0x8a31('0x31')](function(){return _0x2a3ac1;});}return _0x2a3ac1;}return null;})[_0x8a31('0x31')](respondWithResult(_0x8813ab,null))[_0x8a31('0x24')](handleError(_0x8813ab,null));};var interaction_log=require(_0x8a31('0x58'))(_0x8a31('0x59'));exports[_0x8a31('0x2e')]=function(_0x1c1027,_0x593409,_0x340cd3){var _0x3ca6a7={'agent':{},'channel':_0x8a31('0x5b')};if(_0x1c1027['body']['id']){delete _0x1c1027[_0x8a31('0x55')]['id'];}_0x1c1027['body'][_0x8a31('0x5f')]=_0x1c1027[_0x8a31('0x55')][_0x8a31('0x5f')]||_0x1c1027['user']['id'];_0x3ca6a7[_0x8a31('0x61')]['id']=_0x1c1027['body']['UserId'];return db[_0x8a31('0x37')][_0x8a31('0x53')]({'where':{'id':_0x1c1027[_0x8a31('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x593409,null))[_0x8a31('0x31')](function(_0x1de5bc){if(_0x1de5bc){_0x3ca6a7[_0x8a31('0x21')]=_0x1de5bc[_0x8a31('0x62')]({'plain':!![]});return db[_0x8a31('0x63')][_0x8a31('0x53')]({'where':{'id':_0x1de5bc[_0x8a31('0x64')]}});}return null;})[_0x8a31('0x31')](handleEntityNotFound(_0x593409,null))['then'](function(_0x7abb79){if(_0x7abb79){_0x3ca6a7[_0x8a31('0x67')]=_0x7abb79[_0x8a31('0x62')]({'plain':!![]});interaction_log[_0x8a31('0x22')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c1027[_0x8a31('0x60')]['id'],_0x1c1027['user'][_0x8a31('0x34')],_0x1c1027['user'][_0x8a31('0x7e')],_0x3ca6a7['interaction']['id'],_0x1c1027['body']?JSON[_0x8a31('0x69')](_0x1c1027['body']):_0x8a31('0x6a'));return respondWithRpcPromise(_0x8a31('0x7f'),_0x8a31('0x80'),_0x3ca6a7);}return null;})['then'](function(_0x9c952c){var _0x597aea=_0x8a31('0x6d')+_0x9c952c['message'][_0x8a31('0x6e')];return db['sequelize']['query'](_0x597aea,{'type':db[_0x8a31('0x81')][_0x8a31('0x70')][_0x8a31('0x71')],'raw':!![]})[_0x8a31('0x31')](function(_0xd07d75){return _0xd07d75;});})['then'](function(_0x453666){if(_0x453666){_0x3ca6a7[_0x8a31('0x21')][_0x8a31('0x72')]=_0x453666[0x0];if(!_0x1c1027[_0x8a31('0x55')][_0x8a31('0x5f')])return;return db[_0x8a31('0x73')][_0x8a31('0x53')]({'where':{'id':_0x1c1027[_0x8a31('0x55')][_0x8a31('0x5f')],'role':_0x8a31('0x61')},'attributes':['id',_0x8a31('0x34'),'fullname','email',_0x8a31('0x75')],'raw':!![]});}return null;})[_0x8a31('0x31')](function(_0x47ba3a){if(!_0x47ba3a)return null;_0x3ca6a7['message']['agent']=_0x47ba3a;return _0x3ca6a7;})[_0x8a31('0x31')](function(_0x5f9402){if(_0x5f9402){_0x5f9402[_0x8a31('0x21')][_0x8a31('0x77')]=util[_0x8a31('0x5d')](_0x8a31('0x78'),_0x1c1027[_0x8a31('0x60')][_0x8a31('0x34')]);_0x5f9402['message']['channel']=_0x3ca6a7[_0x8a31('0x79')];_0x5f9402[_0x8a31('0x21')][_0x8a31('0x82')]=_0x3ca6a7['channel'];_0x5f9402[_0x8a31('0x21')]['event']=_0x8a31('0x2e');respondWithRpcPromise(_0x8a31('0x7b'),_0x8a31('0x7b'),{'event':'rejectmessage','message':_[_0x8a31('0x49')](_0x3ca6a7[_0x8a31('0x21')],JSON[_0x8a31('0x7d')](_0x3ca6a7[_0x8a31('0x67')]['formData']))},client9002);return _0x3ca6a7;}return null;})[_0x8a31('0x31')](respondWithResult(_0x593409,null))[_0x8a31('0x24')](handleError(_0x593409,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 678d198..9c431ad 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 _0x6e6d=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x1e4a4a,_0x625229){var _0x215c1d=function(_0x2d6a79){while(--_0x2d6a79){_0x1e4a4a['push'](_0x1e4a4a['shift']());}};_0x215c1d(++_0x625229);}(_0x6e6d,0x7d));var _0xd6e6=function(_0x3c6022,_0x5c4610){_0x3c6022=_0x3c6022-0x0;var _0x54fcd2=_0x6e6d[_0x3c6022];return _0x54fcd2;};'use strict';var EventEmitter=require(_0xd6e6('0x0'));var ChatMessage=require(_0xd6e6('0x1'))['db'][_0xd6e6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd6e6('0x3')](0x0);var events={'afterCreate':_0xd6e6('0x4'),'afterUpdate':_0xd6e6('0x5'),'afterDestroy':_0xd6e6('0x6')};function emitEvent(_0x143fc1){return function(_0x39747c,_0x23e654,_0x4d9e98){ChatMessageEvents[_0xd6e6('0x7')](_0x143fc1+':'+_0x39747c['id'],_0x39747c);ChatMessageEvents[_0xd6e6('0x7')](_0x143fc1,_0x39747c);_0x4d9e98(null);};}for(var e in events){if(events[_0xd6e6('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xd6e6('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x6ea3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x24c5df,_0x36adbc){var _0x374082=function(_0x332441){while(--_0x332441){_0x24c5df['push'](_0x24c5df['shift']());}};_0x374082(++_0x36adbc);}(_0x6ea3,0x1c9));var _0x36ea=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6ea3[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x36ea('0x0'));var ChatMessage=require(_0x36ea('0x1'))['db'][_0x36ea('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x36ea('0x3')](0x0);var events={'afterCreate':_0x36ea('0x4'),'afterUpdate':_0x36ea('0x5'),'afterDestroy':_0x36ea('0x6')};function emitEvent(_0x2b9ccb){return function(_0x734803,_0x2cb540,_0x4d154e){ChatMessageEvents[_0x36ea('0x7')](_0x2b9ccb+':'+_0x734803['id'],_0x734803);ChatMessageEvents[_0x36ea('0x7')](_0x2b9ccb,_0x734803);_0x4d154e(null);};}for(var e in events){if(events[_0x36ea('0x8')](e)){var event=events[e];ChatMessage[_0x36ea('0x9')](e,emitEvent(event));}}module[_0x36ea('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c4de903..970628b 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 _0xccfc=['then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x176108,_0x21f3b8){var _0x1f2f7c=function(_0x32a8b4){while(--_0x32a8b4){_0x176108['push'](_0x176108['shift']());}};_0x1f2f7c(++_0x21f3b8);}(_0xccfc,0x19a));var _0xcccf=function(_0x50b94a,_0x3445be){_0x50b94a=_0x50b94a-0x0;var _0x38b60c=_0xccfc[_0x50b94a];return _0x38b60c;};'use strict';var _=require(_0xcccf('0x0'));var util=require(_0xcccf('0x1'));var logger=require('../../config/logger')(_0xcccf('0x2'));var moment=require(_0xcccf('0x3'));var BPromise=require(_0xcccf('0x4'));var rp=require(_0xcccf('0x5'));var fs=require('fs');var path=require(_0xcccf('0x6'));var rimraf=require(_0xcccf('0x7'));var config=require('../../config/environment');var attributes=require(_0xcccf('0x8'));module['exports']=function(_0x57f6e2,_0x74b960){return _0x57f6e2['define'](_0xcccf('0x9'),attributes,{'tableName':_0xcccf('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xcccf('0xb')],'type':_0xcccf('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcbcef8,_0x5f269f,_0x1eb048){var _0xb95854=_0x57f6e2[_0xcccf('0xd')];var _0x6c691=_0xcbcef8['get']({'plain':!![]});if(_0x6c691[_0xcccf('0xe')][_0xcccf('0xf')]()==='in'||_0x6c691['direction']['toLowerCase']()==='out'&&!_0x6c691[_0xcccf('0x10')]&&!_[_0xcccf('0x11')](_0x6c691[_0xcccf('0x12')])){_0xb95854[_0xcccf('0x13')][_0xcccf('0x14')]({'where':{'id':_0x6c691[_0xcccf('0x15')]}})[_0xcccf('0x16')](function(_0x2a8cc9){if(_0x2a8cc9){_0x2a8cc9[_0xcccf('0x17')]({'lastMsgAt':_0x6c691[_0xcccf('0x18')],'lastMsgDirection':_0x6c691[_0xcccf('0xe')][_0xcccf('0xf')]()});}})['catch'](function(_0x12050e){console['error'](_0x12050e);});}_0x1eb048();}},'charset':_0xcccf('0x19'),'collate':_0xcccf('0x1a')});}; \ No newline at end of file +var _0x17da=['request-promise','path','../../config/environment','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x10b95c,_0x134f5a){var _0x53fbf8=function(_0x5cc266){while(--_0x5cc266){_0x10b95c['push'](_0x10b95c['shift']());}};_0x53fbf8(++_0x134f5a);}(_0x17da,0x167));var _0xa17d=function(_0x8d3fdb,_0x35f605){_0x8d3fdb=_0x8d3fdb-0x0;var _0x42d81a=_0x17da[_0x8d3fdb];return _0x42d81a;};'use strict';var _=require(_0xa17d('0x0'));var util=require('util');var logger=require(_0xa17d('0x1'))(_0xa17d('0x2'));var moment=require(_0xa17d('0x3'));var BPromise=require(_0xa17d('0x4'));var rp=require(_0xa17d('0x5'));var fs=require('fs');var path=require(_0xa17d('0x6'));var rimraf=require('rimraf');var config=require(_0xa17d('0x7'));var attributes=require('./chatMessage.attributes');module[_0xa17d('0x8')]=function(_0x25ce5b,_0x34d2da){return _0x25ce5b['define'](_0xa17d('0x9'),attributes,{'tableName':_0xa17d('0xa'),'paranoid':![],'indexes':[{'name':_0xa17d('0xb'),'fields':[_0xa17d('0xc')],'type':_0xa17d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x326298,_0x4b130f,_0x9c1c55){var _0x57584d=_0x25ce5b[_0xa17d('0xe')];var _0x5d5bc8=_0x326298['get']({'plain':!![]});if(_0x5d5bc8[_0xa17d('0xf')][_0xa17d('0x10')]()==='in'||_0x5d5bc8['direction']['toLowerCase']()===_0xa17d('0x11')&&!_0x5d5bc8[_0xa17d('0x12')]&&!_['isNil'](_0x5d5bc8[_0xa17d('0x13')])){_0x57584d[_0xa17d('0x14')][_0xa17d('0x15')]({'where':{'id':_0x5d5bc8[_0xa17d('0x16')]}})[_0xa17d('0x17')](function(_0x5d68b4){if(_0x5d68b4){_0x5d68b4[_0xa17d('0x18')]({'lastMsgAt':_0x5d5bc8[_0xa17d('0x19')],'lastMsgDirection':_0x5d5bc8[_0xa17d('0xf')][_0xa17d('0x10')]()});}})['catch'](function(_0x567530){console['error'](_0x567530);});}_0x9c1c55();}},'charset':_0xa17d('0x1a'),'collate':_0xa17d('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4dc7d2b..895bc72 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 _0xa40d=['body','options','raw','info','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatMessage','create'];(function(_0x629f05,_0x3f7c6f){var _0x4119ea=function(_0x5b3ba2){while(--_0x5b3ba2){_0x629f05['push'](_0x629f05['shift']());}};_0x4119ea(++_0x3f7c6f);}(_0xa40d,0x140));var _0xda40=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xa40d[_0x3e29df];return _0x3e3ba9;};'use strict';var _=require(_0xda40('0x0'));var util=require(_0xda40('0x1'));var moment=require(_0xda40('0x2'));var BPromise=require(_0xda40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda40('0x4'));var db=require(_0xda40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda40('0x6'))(_0xda40('0x7'));var config=require('../../config/environment');var jayson=require(_0xda40('0x8'));var client=jayson[_0xda40('0x9')][_0xda40('0xa')]({'port':0x232a});config[_0xda40('0xb')]=_[_0xda40('0xc')](config[_0xda40('0xb')],{'host':_0xda40('0xd'),'port':0x18eb});var socket=require(_0xda40('0xe'))(new Redis(config[_0xda40('0xb')]));require(_0xda40('0xf'))[_0xda40('0x10')](socket);function respondWithRpcPromise(_0x87c09f,_0x57e818,_0x828ace){return new BPromise(function(_0x4fdf7,_0x4008cb){return client[_0xda40('0x11')](_0x87c09f,_0x828ace)[_0xda40('0x12')](function(_0x2099a8){logger['info'](_0xda40('0x13'),_0x57e818,_0xda40('0x14'));logger[_0xda40('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57e818,_0xda40('0x14'),JSON[_0xda40('0x16')](_0x2099a8));if(_0x2099a8[_0xda40('0x17')]){if(_0x2099a8['error'][_0xda40('0x18')]===0x1f4){logger['error'](_0xda40('0x13'),_0x57e818,_0x2099a8[_0xda40('0x17')][_0xda40('0x19')]);return _0x4008cb(_0x2099a8['error'][_0xda40('0x19')]);}logger[_0xda40('0x17')](_0xda40('0x13'),_0x57e818,_0x2099a8[_0xda40('0x17')][_0xda40('0x19')]);return _0x4fdf7(_0x2099a8[_0xda40('0x17')]['message']);}else{logger['info'](_0xda40('0x13'),_0x57e818,_0xda40('0x14'));_0x4fdf7(_0x2099a8[_0xda40('0x1a')][_0xda40('0x19')]);}})[_0xda40('0x1b')](function(_0x1a2770){logger[_0xda40('0x17')](_0xda40('0x13'),_0x57e818,_0x1a2770);_0x4008cb(_0x1a2770);});});}exports['CreateChatMessage']=function(_0x289bd5){var _0x50eed8=this;return new Promise(function(_0x303d45,_0x207410){return db[_0xda40('0x1c')][_0xda40('0x1d')](_0x289bd5[_0xda40('0x1e')],{'raw':_0x289bd5['options']?_0x289bd5[_0xda40('0x1f')][_0xda40('0x20')]===undefined?!![]:![]:!![]})[_0xda40('0x12')](function(_0x4eb632){logger[_0xda40('0x21')](_0xda40('0x22'),_0x289bd5);logger[_0xda40('0x15')](_0xda40('0x22'),_0x289bd5,JSON[_0xda40('0x16')](_0x4eb632));_0x303d45(_0x4eb632);})[_0xda40('0x1b')](function(_0xaa3258){logger['error'](_0xda40('0x22'),_0xaa3258[_0xda40('0x19')],_0x289bd5);_0x207410(_0x50eed8[_0xda40('0x17')](0x1f4,_0xaa3258['message']));});});}; \ No newline at end of file +var _0x7937=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','error','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x7937,0x81));var _0x7793=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0x7937[_0x30853f];return _0x3c416d;};'use strict';var _=require(_0x7793('0x0'));var util=require(_0x7793('0x1'));var moment=require(_0x7793('0x2'));var BPromise=require(_0x7793('0x3'));var rs=require(_0x7793('0x4'));var fs=require('fs');var Redis=require(_0x7793('0x5'));var db=require(_0x7793('0x6'))['db'];var utils=require(_0x7793('0x7'));var logger=require(_0x7793('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7793('0x9'));var client=jayson[_0x7793('0xa')][_0x7793('0xb')]({'port':0x232a});config[_0x7793('0xc')]=_[_0x7793('0xd')](config[_0x7793('0xc')],{'host':_0x7793('0xe'),'port':0x18eb});var socket=require(_0x7793('0xf'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x7793('0x10')](socket);function respondWithRpcPromise(_0x5e236d,_0x2801bd,_0x5451f7){return new BPromise(function(_0x4f74ea,_0x2bddf2){return client[_0x7793('0x11')](_0x5e236d,_0x5451f7)[_0x7793('0x12')](function(_0x2dc2d8){logger[_0x7793('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2801bd,_0x7793('0x14'));logger[_0x7793('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2801bd,'request\x20sent',JSON['stringify'](_0x2dc2d8));if(_0x2dc2d8['error']){if(_0x2dc2d8[_0x7793('0x16')]['code']===0x1f4){logger[_0x7793('0x16')](_0x7793('0x17'),_0x2801bd,_0x2dc2d8[_0x7793('0x16')]['message']);return _0x2bddf2(_0x2dc2d8[_0x7793('0x16')][_0x7793('0x18')]);}logger[_0x7793('0x16')](_0x7793('0x17'),_0x2801bd,_0x2dc2d8[_0x7793('0x16')]['message']);return _0x4f74ea(_0x2dc2d8[_0x7793('0x16')]['message']);}else{logger[_0x7793('0x13')](_0x7793('0x17'),_0x2801bd,_0x7793('0x14'));_0x4f74ea(_0x2dc2d8['result'][_0x7793('0x18')]);}})[_0x7793('0x19')](function(_0xbd5808){logger[_0x7793('0x16')](_0x7793('0x17'),_0x2801bd,_0xbd5808);_0x2bddf2(_0xbd5808);});});}exports[_0x7793('0x1a')]=function(_0x4ad07a){var _0x179f67=this;return new Promise(function(_0x115410,_0x1a856f){return db[_0x7793('0x1b')][_0x7793('0x1c')](_0x4ad07a[_0x7793('0x1d')],{'raw':_0x4ad07a[_0x7793('0x1e')]?_0x4ad07a[_0x7793('0x1e')][_0x7793('0x1f')]===undefined?!![]:![]:!![]})[_0x7793('0x12')](function(_0x2b4781){logger['info'](_0x7793('0x1a'),_0x4ad07a);logger[_0x7793('0x15')]('CreateChatMessage',_0x4ad07a,JSON[_0x7793('0x20')](_0x2b4781));_0x115410(_0x2b4781);})[_0x7793('0x19')](function(_0x45b3f7){logger['error']('CreateChatMessage',_0x45b3f7['message'],_0x4ad07a);_0x1a856f(_0x179f67[_0x7793('0x16')](0x1f4,_0x45b3f7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f173584..0e1fea7 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 _0xb66c=['chatMessage:','./chatMessage.events','remove','removeListener','register','length'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xb66c,0x175));var _0xcb66=function(_0xc5d436,_0x3fb8b8){_0xc5d436=_0xc5d436-0x0;var _0x1ac952=_0xb66c[_0xc5d436];return _0x1ac952;};'use strict';var ChatMessageEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){ChatMessageEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);ChatMessageEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file +var _0x3435=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','register'];(function(_0x2896e3,_0x23ed8e){var _0x5e551f=function(_0x2a28f4){while(--_0x2a28f4){_0x2896e3['push'](_0x2896e3['shift']());}};_0x5e551f(++_0x23ed8e);}(_0x3435,0xfa));var _0x5343=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x3435[_0x35af23];return _0x340506;};'use strict';var ChatMessageEvents=require(_0x5343('0x0'));var events=[_0x5343('0x1'),_0x5343('0x2'),_0x5343('0x3')];function createListener(_0x14c416,_0x2a91fe){return function(_0x597aa9){_0x2a91fe[_0x5343('0x4')](_0x14c416,_0x597aa9);};}function removeListener(_0x3ae07e,_0x578a24){return function(){ChatMessageEvents['removeListener'](_0x3ae07e,_0x578a24);};}exports[_0x5343('0x5')]=function(_0x28f0f3){for(var _0x4d26b5=0x0,_0x544b29=events[_0x5343('0x6')];_0x4d26b5<_0x544b29;_0x4d26b5++){var _0x1e1911=events[_0x4d26b5];var _0x9ea9b6=createListener(_0x5343('0x7')+_0x1e1911,_0x28f0f3);ChatMessageEvents['on'](_0x1e1911,_0x9ea9b6);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ed5aee1..cb45009 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 _0x7b6e=['reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','chatmessage:create','create','update','put','/:id/accept','accept'];(function(_0x4bddb3,_0x54faf0){var _0x198ed7=function(_0x263bd7){while(--_0x263bd7){_0x4bddb3['push'](_0x4bddb3['shift']());}};_0x198ed7(++_0x54faf0);}(_0x7b6e,0x117));var _0xe7b6=function(_0x132887,_0x8a429e){_0x132887=_0x132887-0x0;var _0x4edd79=_0x7b6e[_0x132887];return _0x4edd79;};'use strict';var multer=require('multer');var util=require(_0xe7b6('0x0'));var path=require('path');var timeout=require(_0xe7b6('0x1'));var express=require(_0xe7b6('0x2'));var router=express[_0xe7b6('0x3')]();var fs_extra=require(_0xe7b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7b6('0x5'));var config=require(_0xe7b6('0x6'));var controller=require(_0xe7b6('0x7'));router[_0xe7b6('0x8')]('/',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xa')]);router['get']('/describe',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xb')]);router[_0xe7b6('0x8')](_0xe7b6('0xc'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xd')]);router[_0xe7b6('0xe')]('/',auth[_0xe7b6('0x9')](),interaction['tracked']('chat',_0xe7b6('0xf')),controller[_0xe7b6('0x10')]);router['put']('/:id',controller[_0xe7b6('0x11')]);router[_0xe7b6('0x12')](_0xe7b6('0x13'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0x14')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xe7b6('0x15')]);router[_0xe7b6('0x16')]('/:id',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0x17')]);module[_0xe7b6('0x18')]=router; \ No newline at end of file +var _0x2ce9=['chatmessage:create','create','/:id','/:id/accept','accept','put','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked'];(function(_0x189e73,_0x452b70){var _0x21d62c=function(_0x5d4089){while(--_0x5d4089){_0x189e73['push'](_0x189e73['shift']());}};_0x21d62c(++_0x452b70);}(_0x2ce9,0x76));var _0x92ce=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x2ce9[_0x2b5b44];return _0x32cb66;};'use strict';var multer=require('multer');var util=require(_0x92ce('0x0'));var path=require(_0x92ce('0x1'));var timeout=require(_0x92ce('0x2'));var express=require(_0x92ce('0x3'));var router=express['Router']();var fs_extra=require(_0x92ce('0x4'));var auth=require(_0x92ce('0x5'));var interaction=require(_0x92ce('0x6'));var config=require(_0x92ce('0x7'));var controller=require(_0x92ce('0x8'));router[_0x92ce('0x9')]('/',auth[_0x92ce('0xa')](),controller[_0x92ce('0xb')]);router['get'](_0x92ce('0xc'),auth[_0x92ce('0xa')](),controller[_0x92ce('0xd')]);router[_0x92ce('0x9')]('/:id',auth[_0x92ce('0xa')](),controller[_0x92ce('0xe')]);router[_0x92ce('0xf')]('/',auth[_0x92ce('0xa')](),interaction[_0x92ce('0x10')]('chat',_0x92ce('0x11')),controller[_0x92ce('0x12')]);router['put'](_0x92ce('0x13'),controller['update']);router['put'](_0x92ce('0x14'),auth[_0x92ce('0xa')](),controller[_0x92ce('0x15')]);router[_0x92ce('0x16')](_0x92ce('0x17'),auth[_0x92ce('0xa')](),controller[_0x92ce('0x18')]);router['delete'](_0x92ce('0x13'),auth['isAuthenticated'](),controller[_0x92ce('0x19')]);module[_0x92ce('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 265d42b..aa5dba6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x40d042,_0x3ed545){var _0x5b4901=function(_0x3a0f75){while(--_0x3a0f75){_0x40d042['push'](_0x40d042['shift']());}};_0x5b4901(++_0x3ed545);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x463bc8,_0x135367){var _0x441a37=function(_0xbb4c5a){while(--_0xbb4c5a){_0x463bc8['push'](_0x463bc8['shift']());}};_0x441a37(++_0x135367);}(_0xb10b,0x12a));var _0xbb10=function(_0x768458,_0x3d0933){_0x768458=_0x768458-0x0;var _0x31385c=_0xb10b[_0x768458];return _0x31385c;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 64906a6..3c580bd 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(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x7a54,0x106));var _0x47a5=function(_0x5b5088,_0xa04f3f){_0x5b5088=_0x5b5088-0x0;var _0x22f947=_0x7a54[_0x5b5088];return _0x22f947;};'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(_0x38e863,_0x4d104f){var _0x59693c=function(_0xf1e9e2){while(--_0xf1e9e2){_0x38e863['push'](_0x38e863['shift']());}};_0x59693c(++_0x4d104f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 8bc93d3..8b0bc8e 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 _0x6a33=['hook','exports','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x6a33,0x9b));var _0x36a3=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x6a33[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x36a3('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x36a3('0x1')](0x0);var events={'afterCreate':_0x36a3('0x2'),'afterUpdate':_0x36a3('0x3'),'afterDestroy':_0x36a3('0x4')};function emitEvent(_0x441486){return function(_0x3c14af,_0x99f59b,_0x46bb4c){ChatOfflineMessageEvents[_0x36a3('0x5')](_0x441486+':'+_0x3c14af['id'],_0x3c14af);ChatOfflineMessageEvents[_0x36a3('0x5')](_0x441486,_0x3c14af);_0x46bb4c(null);};}for(var e in events){if(events[_0x36a3('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x36a3('0x7')](e,emitEvent(event));}}module[_0x36a3('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x31b9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x440ad4,_0x3c4f8f){var _0x16ce8c=function(_0x4fab87){while(--_0x4fab87){_0x440ad4['push'](_0x440ad4['shift']());}};_0x16ce8c(++_0x3c4f8f);}(_0x31b9,0x151));var _0x931b=function(_0x2190d6,_0x12d5a2){_0x2190d6=_0x2190d6-0x0;var _0x31514b=_0x31b9[_0x2190d6];return _0x31514b;};'use strict';var EventEmitter=require(_0x931b('0x0'));var ChatOfflineMessage=require(_0x931b('0x1'))['db'][_0x931b('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x931b('0x3')](0x0);var events={'afterCreate':_0x931b('0x4'),'afterUpdate':_0x931b('0x5'),'afterDestroy':_0x931b('0x6')};function emitEvent(_0x450c01){return function(_0x566a05,_0x4861ce,_0x20bd00){ChatOfflineMessageEvents[_0x931b('0x7')](_0x450c01+':'+_0x566a05['id'],_0x566a05);ChatOfflineMessageEvents[_0x931b('0x7')](_0x450c01,_0x566a05);_0x20bd00(null);};}for(var e in events){if(events[_0x931b('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x931b('0x9')](e,emitEvent(event));}}module[_0x931b('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4efe412..0724b17 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 _0x1f46=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x1f46,0x1b4));var _0x61f4=function(_0x11cd43,_0x1e235e){_0x11cd43=_0x11cd43-0x0;var _0x5ef8d5=_0x1f46[_0x11cd43];return _0x5ef8d5;};'use strict';var attributes=require(_0x61f4('0x0'));module[_0x61f4('0x1')]=function(_0x5aeda4){return _0x5aeda4[_0x61f4('0x2')](_0x61f4('0x3'),attributes,{'tableName':_0x61f4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61f4('0x5'),'collate':_0x61f4('0x6')});}; \ No newline at end of file +var _0x31ea=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0x31ea,0xb1));var _0xa31e=function(_0x330da3,_0x485558){_0x330da3=_0x330da3-0x0;var _0x2d2863=_0x31ea[_0x330da3];return _0x2d2863;};'use strict';var attributes=require(_0xa31e('0x0'));module['exports']=function(_0x287b20){return _0x287b20[_0xa31e('0x1')](_0xa31e('0x2'),attributes,{'tableName':_0xa31e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa31e('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 29dfdd2..ffeaede 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 _0x68b8=['request','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x68b8,0x1d8));var _0x868b=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x68b8[_0x4d8789];return _0x404e41;};'use strict';var _=require(_0x868b('0x0'));var util=require(_0x868b('0x1'));var moment=require(_0x868b('0x2'));var BPromise=require(_0x868b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x868b('0x4'));var db=require(_0x868b('0x5'))['db'];var utils=require(_0x868b('0x6'));var logger=require(_0x868b('0x7'))('rpc');var config=require(_0x868b('0x8'));var jayson=require(_0x868b('0x9'));var client=jayson['client'][_0x868b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x107cfe,_0x1d107d,_0x766ed3){return new BPromise(function(_0x17ce24,_0x157d0a){return client[_0x868b('0xb')](_0x107cfe,_0x766ed3)['then'](function(_0x53c451){logger['info'](_0x868b('0xc'),_0x1d107d,'request\x20sent');logger['debug'](_0x868b('0xd'),_0x1d107d,_0x868b('0xe'),JSON[_0x868b('0xf')](_0x53c451));if(_0x53c451[_0x868b('0x10')]){if(_0x53c451[_0x868b('0x10')][_0x868b('0x11')]===0x1f4){logger['error'](_0x868b('0xc'),_0x1d107d,_0x53c451[_0x868b('0x10')][_0x868b('0x12')]);return _0x157d0a(_0x53c451[_0x868b('0x10')][_0x868b('0x12')]);}logger['error'](_0x868b('0xc'),_0x1d107d,_0x53c451['error']['message']);return _0x17ce24(_0x53c451['error'][_0x868b('0x12')]);}else{logger['info'](_0x868b('0xc'),_0x1d107d,_0x868b('0xe'));_0x17ce24(_0x53c451[_0x868b('0x13')][_0x868b('0x12')]);}})[_0x868b('0x14')](function(_0x390010){logger[_0x868b('0x10')](_0x868b('0xc'),_0x1d107d,_0x390010);_0x157d0a(_0x390010);});});} \ No newline at end of file +var _0xb016=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x306d94,_0x46ed19){var _0x3e0a16=function(_0x4ea686){while(--_0x4ea686){_0x306d94['push'](_0x306d94['shift']());}};_0x3e0a16(++_0x46ed19);}(_0xb016,0x129));var _0x6b01=function(_0x410c11,_0x279873){_0x410c11=_0x410c11-0x0;var _0x3957a7=_0xb016[_0x410c11];return _0x3957a7;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require(_0x6b01('0x2'));var BPromise=require(_0x6b01('0x3'));var rs=require(_0x6b01('0x4'));var fs=require('fs');var Redis=require(_0x6b01('0x5'));var db=require(_0x6b01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b01('0x7'))(_0x6b01('0x8'));var config=require(_0x6b01('0x9'));var jayson=require(_0x6b01('0xa'));var client=jayson[_0x6b01('0xb')][_0x6b01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4069a6,_0x596508,_0x398a77){return new BPromise(function(_0x37875c,_0x5115b0){return client[_0x6b01('0xd')](_0x4069a6,_0x398a77)[_0x6b01('0xe')](function(_0x53db4f){logger['info'](_0x6b01('0xf'),_0x596508,_0x6b01('0x10'));logger['debug'](_0x6b01('0x11'),_0x596508,_0x6b01('0x10'),JSON[_0x6b01('0x12')](_0x53db4f));if(_0x53db4f[_0x6b01('0x13')]){if(_0x53db4f[_0x6b01('0x13')][_0x6b01('0x14')]===0x1f4){logger[_0x6b01('0x13')](_0x6b01('0xf'),_0x596508,_0x53db4f[_0x6b01('0x13')]['message']);return _0x5115b0(_0x53db4f['error'][_0x6b01('0x15')]);}logger[_0x6b01('0x13')](_0x6b01('0xf'),_0x596508,_0x53db4f[_0x6b01('0x13')][_0x6b01('0x15')]);return _0x37875c(_0x53db4f[_0x6b01('0x13')][_0x6b01('0x15')]);}else{logger['info'](_0x6b01('0xf'),_0x596508,_0x6b01('0x10'));_0x37875c(_0x53db4f[_0x6b01('0x16')][_0x6b01('0x15')]);}})['catch'](function(_0x33f51b){logger[_0x6b01('0x13')](_0x6b01('0xf'),_0x596508,_0x33f51b);_0x5115b0(_0x33f51b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f9abcc2..1a7ee8a 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 _0x6a41=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe'];(function(_0x426bb6,_0x14e2ea){var _0x3421ab=function(_0x341ccc){while(--_0x341ccc){_0x426bb6['push'](_0x426bb6['shift']());}};_0x3421ab(++_0x14e2ea);}(_0x6a41,0x105));var _0x16a4=function(_0xb3205f,_0x13694e){_0xb3205f=_0xb3205f-0x0;var _0x3eac2d=_0x6a41[_0xb3205f];return _0x3eac2d;};'use strict';var multer=require(_0x16a4('0x0'));var util=require(_0x16a4('0x1'));var path=require('path');var timeout=require(_0x16a4('0x2'));var express=require(_0x16a4('0x3'));var router=express[_0x16a4('0x4')]();var fs_extra=require(_0x16a4('0x5'));var auth=require(_0x16a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16a4('0x7'));var controller=require(_0x16a4('0x8'));router['get']('/',auth[_0x16a4('0x9')](),controller['index']);router[_0x16a4('0xa')](_0x16a4('0xb'),auth['isAuthenticated'](),controller[_0x16a4('0xc')]);router['get'](_0x16a4('0xd'),auth[_0x16a4('0x9')](),controller[_0x16a4('0xe')]);router[_0x16a4('0xf')]('/',auth[_0x16a4('0x9')](),controller[_0x16a4('0x10')]);router[_0x16a4('0x11')](_0x16a4('0xd'),auth[_0x16a4('0x9')](),controller[_0x16a4('0x12')]);router['delete']('/:id',auth[_0x16a4('0x9')](),controller[_0x16a4('0x13')]);module[_0x16a4('0x14')]=router; \ No newline at end of file +var _0xcee9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','destroy','multer','util','Router','fs-extra'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcee9,0x183));var _0x9cee=function(_0x2cc1d5,_0x3446f5){_0x2cc1d5=_0x2cc1d5-0x0;var _0x2be77f=_0xcee9[_0x2cc1d5];return _0x2be77f;};'use strict';var multer=require(_0x9cee('0x0'));var util=require(_0x9cee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cee('0x2')]();var fs_extra=require(_0x9cee('0x3'));var auth=require(_0x9cee('0x4'));var interaction=require(_0x9cee('0x5'));var config=require(_0x9cee('0x6'));var controller=require(_0x9cee('0x7'));router[_0x9cee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cee('0x8')](_0x9cee('0x9'),auth[_0x9cee('0xa')](),controller['describe']);router[_0x9cee('0x8')](_0x9cee('0xb'),auth['isAuthenticated'](),controller[_0x9cee('0xc')]);router[_0x9cee('0xd')]('/',auth[_0x9cee('0xa')](),controller[_0x9cee('0xe')]);router[_0x9cee('0xf')](_0x9cee('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9cee('0xb'),auth[_0x9cee('0xa')](),controller[_0x9cee('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3509682..66b9135 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 _0x2f3b=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x2820c8,_0x9cc2c9){var _0x38c7ba=function(_0x80429){while(--_0x80429){_0x2820c8['push'](_0x2820c8['shift']());}};_0x38c7ba(++_0x9cc2c9);}(_0x2f3b,0xc6));var _0xb2f3=function(_0x4e64fc,_0x12bb94){_0x4e64fc=_0x4e64fc-0x0;var _0x3b6898=_0x2f3b[_0x4e64fc];return _0x3b6898;};'use strict';var Sequelize=require('sequelize');module[_0xb2f3('0x0')]={'name':{'type':Sequelize[_0xb2f3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb2f3('0x2')](_0xb2f3('0x3'),_0xb2f3('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xb2f3('0x1')]},'timeout':{'type':Sequelize[_0xb2f3('0x5')]}}; \ No newline at end of file +var _0x07b5=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x4e27ed,_0x49b6cf){var _0x177582=function(_0x415eaf){while(--_0x415eaf){_0x4e27ed['push'](_0x4e27ed['shift']());}};_0x177582(++_0x49b6cf);}(_0x07b5,0x170));var _0x507b=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x07b5[_0xe2c95e];return _0x42ce6f;};'use strict';var Sequelize=require(_0x507b('0x0'));module[_0x507b('0x1')]={'name':{'type':Sequelize[_0x507b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x507b('0x3')](_0x507b('0x4'),_0x507b('0x5')),'defaultValue':_0x507b('0x4')},'selector':{'type':Sequelize[_0x507b('0x2')]},'timeout':{'type':Sequelize[_0x507b('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 81ccdd6..90b74f0 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 _0xf6c1=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','options','catch','create','body','params','find','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3c3b8c,_0x440db6){var _0x2a377e=function(_0x52cf2c){while(--_0x52cf2c){_0x3c3b8c['push'](_0x3c3b8c['shift']());}};_0x2a377e(++_0x440db6);}(_0xf6c1,0x99));var _0x1f6c=function(_0x2d5beb,_0x552f69){_0x2d5beb=_0x2d5beb-0x0;var _0x134b5b=_0xf6c1[_0x2d5beb];return _0x134b5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x386016,_0x8b998c){return function(_0x236f17){if(!_0x236f17){_0x386016[_0x1f6c('0x18')](0x194);}return _0x236f17;};}function handleError(_0x147385,_0x4ffb66){_0x4ffb66=_0x4ffb66||0x1f4;return function(_0xa16408){logger[_0x1f6c('0x28')](_0xa16408[_0x1f6c('0x29')]);if(_0xa16408['name']){delete _0xa16408[_0x1f6c('0x2a')];}_0x147385[_0x1f6c('0x19')](_0x4ffb66)[_0x1f6c('0x2b')](_0xa16408);};}exports[_0x1f6c('0x2c')]=function(_0xeaeccd,_0x15df56){var _0x51a230={'raw':!![],'where':{'id':_0xeaeccd['params']['id']}},_0x420853={};_0x420853[_0x1f6c('0x2d')]=_[_0x1f6c('0x2e')](db[_0x1f6c('0x2f')][_0x1f6c('0x30')]);_0x420853[_0x1f6c('0x31')]=_['keys'](_0xeaeccd[_0x1f6c('0x31')]);_0x420853['filters']=_['intersection'](_0x420853[_0x1f6c('0x2d')],_0x420853[_0x1f6c('0x31')]);_0x51a230[_0x1f6c('0x32')]=_[_0x1f6c('0x33')](_0x420853['model'],qs[_0x1f6c('0x34')](_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x34')]));_0x51a230[_0x1f6c('0x32')]=_0x51a230[_0x1f6c('0x32')]['length']?_0x51a230['attributes']:_0x420853[_0x1f6c('0x2d')];if(_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x35')]){_0x51a230[_0x1f6c('0x36')]=[{'all':!![]}];}_0x51a230=_['merge']({},_0x51a230,_0xeaeccd[_0x1f6c('0x37')]);return db['ChatProactiveAction']['find'](_0x51a230)[_0x1f6c('0x26')](handleEntityNotFound(_0x15df56,null))[_0x1f6c('0x26')](respondWithResult(_0x15df56,null))[_0x1f6c('0x38')](handleError(_0x15df56,null));};exports[_0x1f6c('0x39')]=function(_0x44f909,_0x271aa0){return db[_0x1f6c('0x2f')][_0x1f6c('0x39')](_0x44f909[_0x1f6c('0x3a')],{})[_0x1f6c('0x26')](respondWithResult(_0x271aa0,0xc9))[_0x1f6c('0x38')](handleError(_0x271aa0,null));};exports[_0x1f6c('0x25')]=function(_0x16e207,_0x2fc1c6){if(_0x16e207[_0x1f6c('0x3a')]['id']){delete _0x16e207[_0x1f6c('0x3a')]['id'];}return db[_0x1f6c('0x2f')]['find']({'where':{'id':_0x16e207[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x2fc1c6,null))[_0x1f6c('0x26')](saveUpdates(_0x16e207[_0x1f6c('0x3a')],null))[_0x1f6c('0x26')](respondWithResult(_0x2fc1c6,null))['catch'](handleError(_0x2fc1c6,null));};exports['destroy']=function(_0x29a9ef,_0x845949){return db[_0x1f6c('0x2f')][_0x1f6c('0x3c')]({'where':{'id':_0x29a9ef[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x845949,null))['then'](removeEntity(_0x845949,null))[_0x1f6c('0x38')](handleError(_0x845949,null));}; \ No newline at end of file +var _0x7d9f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body'];(function(_0x5d0a3f,_0x147089){var _0x57add7=function(_0x2d8c15){while(--_0x2d8c15){_0x5d0a3f['push'](_0x5d0a3f['shift']());}};_0x57add7(++_0x147089);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3cc8cb,_0x31f8fe){_0x3cc8cb=_0x3cc8cb-0x0;var _0x427615=_0x7d9f[_0x3cc8cb];return _0x427615;};'use strict';var emlformat=require(_0xf7d9('0x0'));var rimraf=require(_0xf7d9('0x1'));var zipdir=require(_0xf7d9('0x2'));var jsonpatch=require(_0xf7d9('0x3'));var rp=require(_0xf7d9('0x4'));var moment=require('moment');var BPromise=require(_0xf7d9('0x5'));var Mustache=require(_0xf7d9('0x6'));var util=require(_0xf7d9('0x7'));var path=require(_0xf7d9('0x8'));var sox=require(_0xf7d9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7d9('0xa'));var _=require(_0xf7d9('0xb'));var squel=require('squel');var crypto=require(_0xf7d9('0xc'));var jsforce=require(_0xf7d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf7d9('0xe'));var querystring=require('querystring');var Papa=require(_0xf7d9('0xf'));var Redis=require(_0xf7d9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf7d9('0x11'));var hardwareService=require(_0xf7d9('0x12'));var logger=require(_0xf7d9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf7d9('0x14'));var licenseUtil=require(_0xf7d9('0x15'));var db=require(_0xf7d9('0x16'))['db'];function respondWithStatusCode(_0x35e156,_0x594dfe){_0x594dfe=_0x594dfe||0xcc;return function(_0x16e680){if(_0x16e680){return _0x35e156[_0xf7d9('0x17')](_0x594dfe);}return _0x35e156[_0xf7d9('0x18')](_0x594dfe)[_0xf7d9('0x19')]();};}function respondWithResult(_0x49f766,_0x189c82){_0x189c82=_0x189c82||0xc8;return function(_0x359843){if(_0x359843){return _0x49f766[_0xf7d9('0x18')](_0x189c82)[_0xf7d9('0x1a')](_0x359843);}};}function respondWithFilteredResult(_0x5d3029,_0x405ed4){return function(_0x22ed4a){if(_0x22ed4a){var _0x341e27=typeof _0x405ed4['offset']==='undefined'&&typeof _0x405ed4[_0xf7d9('0x1b')]===_0xf7d9('0x1c');var _0xe29103=_0x22ed4a['count'];var _0x44ebd3=_0x341e27?0x0:_0x405ed4[_0xf7d9('0x1d')];var _0x5eb7c9=_0x341e27?_0x22ed4a[_0xf7d9('0x1e')]:_0x405ed4['offset']+_0x405ed4[_0xf7d9('0x1b')];var _0x1bbc77;if(_0x5eb7c9>=_0xe29103){_0x5eb7c9=_0xe29103;_0x1bbc77=0xc8;}else{_0x1bbc77=0xce;}_0x5d3029['status'](_0x1bbc77);return _0x5d3029[_0xf7d9('0x1f')](_0xf7d9('0x20'),_0x44ebd3+'-'+_0x5eb7c9+'/'+_0xe29103)[_0xf7d9('0x1a')](_0x22ed4a);}return null;};}function patchUpdates(_0x316d54){return function(_0x165160){try{jsonpatch[_0xf7d9('0x21')](_0x165160,_0x316d54,!![]);}catch(_0xd04b9d){return BPromise[_0xf7d9('0x22')](_0xd04b9d);}return _0x165160['save']();};}function saveUpdates(_0x5e96df,_0x36b974){return function(_0x4cfe93){if(_0x4cfe93){return _0x4cfe93[_0xf7d9('0x23')](_0x5e96df)[_0xf7d9('0x24')](function(_0x574b12){return _0x574b12;});}return null;};}function removeEntity(_0x8d8e48,_0x27ba8c){return function(_0x514ffa){if(_0x514ffa){return _0x514ffa['destroy']()[_0xf7d9('0x24')](function(){_0x8d8e48[_0xf7d9('0x18')](0xcc)[_0xf7d9('0x19')]();});}};}function handleEntityNotFound(_0x595556,_0x3c0b91){return function(_0x496ab7){if(!_0x496ab7){_0x595556[_0xf7d9('0x17')](0x194);}return _0x496ab7;};}function handleError(_0x3b3ea5,_0x144ae2){_0x144ae2=_0x144ae2||0x1f4;return function(_0x5b1ea5){logger[_0xf7d9('0x25')](_0x5b1ea5[_0xf7d9('0x26')]);if(_0x5b1ea5[_0xf7d9('0x27')]){delete _0x5b1ea5[_0xf7d9('0x27')];}_0x3b3ea5[_0xf7d9('0x18')](_0x144ae2)['send'](_0x5b1ea5);};}exports[_0xf7d9('0x28')]=function(_0x3847ff,_0x2b5f17){var _0x2c04c3={'raw':!![],'where':{'id':_0x3847ff[_0xf7d9('0x29')]['id']}},_0x508b00={};_0x508b00[_0xf7d9('0x2a')]=_[_0xf7d9('0x2b')](db[_0xf7d9('0x2c')][_0xf7d9('0x2d')]);_0x508b00[_0xf7d9('0x2e')]=_['keys'](_0x3847ff['query']);_0x508b00['filters']=_[_0xf7d9('0x2f')](_0x508b00['model'],_0x508b00[_0xf7d9('0x2e')]);_0x2c04c3['attributes']=_[_0xf7d9('0x2f')](_0x508b00['model'],qs['fields'](_0x3847ff['query'][_0xf7d9('0x30')]));_0x2c04c3['attributes']=_0x2c04c3[_0xf7d9('0x31')][_0xf7d9('0x32')]?_0x2c04c3[_0xf7d9('0x31')]:_0x508b00[_0xf7d9('0x2a')];if(_0x3847ff[_0xf7d9('0x2e')][_0xf7d9('0x33')]){_0x2c04c3[_0xf7d9('0x34')]=[{'all':!![]}];}_0x2c04c3=_[_0xf7d9('0x35')]({},_0x2c04c3,_0x3847ff['options']);return db[_0xf7d9('0x2c')][_0xf7d9('0x36')](_0x2c04c3)['then'](handleEntityNotFound(_0x2b5f17,null))['then'](respondWithResult(_0x2b5f17,null))[_0xf7d9('0x37')](handleError(_0x2b5f17,null));};exports[_0xf7d9('0x38')]=function(_0x4110ce,_0x5301a8){return db[_0xf7d9('0x2c')][_0xf7d9('0x38')](_0x4110ce[_0xf7d9('0x39')],{})[_0xf7d9('0x24')](respondWithResult(_0x5301a8,0xc9))[_0xf7d9('0x37')](handleError(_0x5301a8,null));};exports[_0xf7d9('0x23')]=function(_0x427963,_0x1280fa){if(_0x427963[_0xf7d9('0x39')]['id']){delete _0x427963[_0xf7d9('0x39')]['id'];}return db[_0xf7d9('0x2c')]['find']({'where':{'id':_0x427963[_0xf7d9('0x29')]['id']}})['then'](handleEntityNotFound(_0x1280fa,null))[_0xf7d9('0x24')](saveUpdates(_0x427963[_0xf7d9('0x39')],null))[_0xf7d9('0x24')](respondWithResult(_0x1280fa,null))[_0xf7d9('0x37')](handleError(_0x1280fa,null));};exports['destroy']=function(_0x55b49d,_0x2173e2){return db['ChatProactiveAction'][_0xf7d9('0x36')]({'where':{'id':_0x55b49d[_0xf7d9('0x29')]['id']}})[_0xf7d9('0x24')](handleEntityNotFound(_0x2173e2,null))[_0xf7d9('0x24')](removeEntity(_0x2173e2,null))['catch'](handleError(_0x2173e2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 72837fa..ce384e3 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 _0xdbb8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash'];(function(_0x2a87fe,_0x52c61c){var _0x539085=function(_0x966460){while(--_0x966460){_0x2a87fe['push'](_0x2a87fe['shift']());}};_0x539085(++_0x52c61c);}(_0xdbb8,0xe3));var _0x8dbb=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xdbb8[_0x59bcb1];return _0x4a737f;};'use strict';var _=require(_0x8dbb('0x0'));var util=require(_0x8dbb('0x1'));var logger=require(_0x8dbb('0x2'))(_0x8dbb('0x3'));var moment=require(_0x8dbb('0x4'));var BPromise=require(_0x8dbb('0x5'));var rp=require(_0x8dbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dbb('0x7'));var config=require('../../config/environment');var attributes=require(_0x8dbb('0x8'));module[_0x8dbb('0x9')]=function(_0x3f86ca,_0x1199af){return _0x3f86ca[_0x8dbb('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x8dbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x603e=['rimraf','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x603e,0x130));var _0xe603=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0x603e[_0x20714a];return _0x15e877;};'use strict';var _=require(_0xe603('0x0'));var util=require(_0xe603('0x1'));var logger=require(_0xe603('0x2'))(_0xe603('0x3'));var moment=require(_0xe603('0x4'));var BPromise=require(_0xe603('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe603('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xe603('0x7')]=function(_0x49b951,_0x381a83){return _0x49b951['define'](_0xe603('0x8'),attributes,{'tableName':_0xe603('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 843b9b4..16ebc79 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 _0x2972=['code','message','ChatProactiveAction,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x2972,0x144));var _0x2297=function(_0x21a59d,_0x1d8c25){_0x21a59d=_0x21a59d-0x0;var _0x3fc7ae=_0x2972[_0x21a59d];return _0x3fc7ae;};'use strict';var _=require(_0x2297('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2297('0x1'));var rs=require(_0x2297('0x2'));var fs=require('fs');var Redis=require(_0x2297('0x3'));var db=require(_0x2297('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2297('0x5'))(_0x2297('0x6'));var config=require(_0x2297('0x7'));var jayson=require(_0x2297('0x8'));var client=jayson[_0x2297('0x9')][_0x2297('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f65a3,_0x4d0c06,_0x50bff7){return new BPromise(function(_0x41f7a0,_0x414dbb){return client[_0x2297('0xb')](_0x4f65a3,_0x50bff7)['then'](function(_0x845a95){logger[_0x2297('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,_0x2297('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4d0c06,_0x2297('0xd'),JSON[_0x2297('0xe')](_0x845a95));if(_0x845a95[_0x2297('0xf')]){if(_0x845a95[_0x2297('0xf')][_0x2297('0x10')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);return _0x414dbb(_0x845a95['error'][_0x2297('0x11')]);}logger['error'](_0x2297('0x12'),_0x4d0c06,_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);return _0x41f7a0(_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,'request\x20sent');_0x41f7a0(_0x845a95['result'][_0x2297('0x11')]);}})[_0x2297('0x13')](function(_0x38d337){logger[_0x2297('0xf')](_0x2297('0x12'),_0x4d0c06,_0x38d337);_0x414dbb(_0x38d337);});});} \ No newline at end of file +var _0xecab=['jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xecab,0x77));var _0xbeca=function(_0x1aa1aa,_0x33b9e8){_0x1aa1aa=_0x1aa1aa-0x0;var _0xd4b78d=_0xecab[_0x1aa1aa];return _0xd4b78d;};'use strict';var _=require(_0xbeca('0x0'));var util=require('util');var moment=require(_0xbeca('0x1'));var BPromise=require(_0xbeca('0x2'));var rs=require(_0xbeca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeca('0x4'));var logger=require(_0xbeca('0x5'))(_0xbeca('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeca('0x7'));var client=jayson[_0xbeca('0x8')][_0xbeca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8771,_0x45e188,_0x204c05){return new BPromise(function(_0x313b71,_0x4f82df){return client[_0xbeca('0xa')](_0x4e8771,_0x204c05)[_0xbeca('0xb')](function(_0x19d9f3){logger['info'](_0xbeca('0xc'),_0x45e188,_0xbeca('0xd'));logger['debug'](_0xbeca('0xe'),_0x45e188,_0xbeca('0xd'),JSON['stringify'](_0x19d9f3));if(_0x19d9f3[_0xbeca('0xf')]){if(_0x19d9f3[_0xbeca('0xf')][_0xbeca('0x10')]===0x1f4){logger[_0xbeca('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x45e188,_0x19d9f3[_0xbeca('0xf')]['message']);return _0x4f82df(_0x19d9f3[_0xbeca('0xf')][_0xbeca('0x11')]);}logger['error'](_0xbeca('0xc'),_0x45e188,_0x19d9f3[_0xbeca('0xf')]['message']);return _0x313b71(_0x19d9f3[_0xbeca('0xf')][_0xbeca('0x11')]);}else{logger[_0xbeca('0x12')](_0xbeca('0xc'),_0x45e188,_0xbeca('0xd'));_0x313b71(_0x19d9f3[_0xbeca('0x13')][_0xbeca('0x11')]);}})[_0xbeca('0x14')](function(_0x187f95){logger[_0xbeca('0xf')](_0xbeca('0xc'),_0x45e188,_0x187f95);_0x4f82df(_0x187f95);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b5b52cc..1a3ab02 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x3344ed,_0x555e9d){var _0x1196de=function(_0x18312b){while(--_0x18312b){_0x3344ed['push'](_0x3344ed['shift']());}};_0x1196de(++_0x555e9d);}(_0x2675,0x75));var _0x5267=function(_0x1c947f,_0x347428){_0x1c947f=_0x1c947f-0x0;var _0x2618da=_0x2675[_0x1c947f];return _0x2618da;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','destroy','exports','multer','util','path'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb138,0x1dd));var _0x8b13=function(_0x162810,_0x4dd5aa){_0x162810=_0x162810-0x0;var _0x503762=_0xb138[_0x162810];return _0x503762;};'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'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['show']);router[_0x8b13('0xc')]('/',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['put'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['update']);router['delete'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);module[_0x8b13('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 72199b7..544bcf5 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 _0xb3b7=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x1d2d4c,_0x340107){var _0x58ed56=function(_0xf95ad){while(--_0xf95ad){_0x1d2d4c['push'](_0x1d2d4c['shift']());}};_0x58ed56(++_0x340107);}(_0xb3b7,0xdf));var _0x7b3b=function(_0x40c370,_0x421b26){_0x40c370=_0x40c370-0x0;var _0x326048=_0xb3b7[_0x40c370];return _0x326048;};'use strict';var Sequelize=require(_0x7b3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b3b('0x1')],'unique':_0x7b3b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b3b('0x1')]},'timeout':{'type':Sequelize[_0x7b3b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b3b('0x4')]('rrmemory',_0x7b3b('0x5'),_0x7b3b('0x6'))}}; \ No newline at end of file +var _0xc02d=['exports','STRING','roundrobin'];(function(_0x322515,_0x4e6c82){var _0x55e219=function(_0x4c9cbc){while(--_0x4c9cbc){_0x322515['push'](_0x322515['shift']());}};_0x55e219(++_0x4e6c82);}(_0xc02d,0x7e));var _0xdc02=function(_0x17b0ab,_0x24651d){_0x17b0ab=_0x17b0ab-0x0;var _0x5b8268=_0xc02d[_0x17b0ab];return _0x5b8268;};'use strict';var Sequelize=require('sequelize');module[_0xdc02('0x0')]={'name':{'type':Sequelize[_0xdc02('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdc02('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xdc02('0x2'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2100079..dd47346 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 _0x3de1=['omit','spread','userChatQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','count','limit','set','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','error','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','where','filter','findAll','findAndCountAll','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','findOne','Team','order','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents'];(function(_0x2662c8,_0x1351c7){var _0x27fba5=function(_0x1493cc){while(--_0x1493cc){_0x2662c8['push'](_0x2662c8['shift']());}};_0x27fba5(++_0x1351c7);}(_0x3de1,0x170));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x13de('0x0'));var util=require(_0x13de('0x1'));var _=require(_0x13de('0x2'));var squel=require('squel');var Redis=require(_0x13de('0x3'));var qs=require(_0x13de('0x4'));var logger=require('../../config/logger')(_0x13de('0x5'));var config=require(_0x13de('0x6'));var db=require(_0x13de('0x7'))['db'];config[_0x13de('0x8')]=_['defaults'](config[_0x13de('0x8')],{'host':_0x13de('0x9'),'port':0x18eb});var socket=require(_0x13de('0xa'))(new Redis(config[_0x13de('0x8')]));require(_0x13de('0xb'))[_0x13de('0xc')](socket);function respondWithStatusCode(_0x25333e,_0x41f1a5){_0x41f1a5=_0x41f1a5||0xcc;return function(_0xffe4f4){if(_0xffe4f4){return _0x25333e['sendStatus'](_0x41f1a5);}return _0x25333e[_0x13de('0xd')](_0x41f1a5)[_0x13de('0xe')]();};}function respondWithResult(_0x56d766,_0x4cc713){_0x4cc713=_0x4cc713||0xc8;return function(_0x4d9dec){if(_0x4d9dec){return _0x56d766['status'](_0x4cc713)[_0x13de('0xf')](_0x4d9dec);}};}function respondWithFilteredResult(_0x5bf0b5,_0x327799){return function(_0x9d442){if(_0x9d442){var _0x30f6bd=typeof _0x327799[_0x13de('0x10')]===_0x13de('0x11')&&typeof _0x327799['limit']===_0x13de('0x11');var _0x22a452=_0x9d442['count'];var _0x53bcfb=_0x30f6bd?0x0:_0x327799[_0x13de('0x10')];var _0x47d36c=_0x30f6bd?_0x9d442[_0x13de('0x12')]:_0x327799[_0x13de('0x10')]+_0x327799[_0x13de('0x13')];var _0xabab30;if(_0x47d36c>=_0x22a452){_0x47d36c=_0x22a452;_0xabab30=0xc8;}else{_0xabab30=0xce;}_0x5bf0b5['status'](_0xabab30);return _0x5bf0b5[_0x13de('0x14')]('Content-Range',_0x53bcfb+'-'+_0x47d36c+'/'+_0x22a452)[_0x13de('0xf')](_0x9d442);}return null;};}function saveUpdates(_0x57b81c){return function(_0x43e30b){if(_0x43e30b){return _0x43e30b['update'](_0x57b81c)[_0x13de('0x15')](function(_0x3fcee7){return _0x3fcee7;});}return null;};}function removeEntity(_0x23c6be){return function(_0x33d0eb){if(_0x33d0eb){return _0x33d0eb[_0x13de('0x16')]()[_0x13de('0x15')](function(){var _0x14fb5a=_0x33d0eb[_0x13de('0x17')]({'plain':!![]});var _0x290f7e=_0x13de('0x18');return db[_0x13de('0x19')]['destroy']({'where':{'type':_0x290f7e,'resourceId':_0x14fb5a['id']}})[_0x13de('0x15')](function(){return _0x33d0eb;});})[_0x13de('0x15')](function(){_0x23c6be[_0x13de('0xd')](0xcc)[_0x13de('0xe')]();});}};}function handleEntityNotFound(_0x19fdc2){return function(_0x4a7151){if(!_0x4a7151){_0x19fdc2[_0x13de('0x1a')](0x194);}return _0x4a7151;};}function handleError(_0xd1e657,_0x33e64e){_0x33e64e=_0x33e64e||0x1f4;return function(_0x25ccd9){logger[_0x13de('0x1b')](_0x25ccd9['stack']);if(_0x25ccd9[_0x13de('0x1c')]){delete _0x25ccd9['name'];}_0xd1e657[_0x13de('0xd')](_0x33e64e)['send'](_0x25ccd9);};}exports[_0x13de('0x1d')]=function(_0x3a88eb,_0x391e94){var _0x4068d1={};var _0x42bf7d={'count':0x0,'rows':[]};var _0x59786e=_[_0x13de('0x1e')](db[_0x13de('0x1f')][_0x13de('0x20')],function(_0x2ef45c){return{'name':_0x2ef45c[_0x13de('0x21')],'type':_0x2ef45c[_0x13de('0x22')][_0x13de('0x23')]};});_0x4068d1=qs[_0x13de('0x24')](_0x59786e,_0x3a88eb);var _0x3d9d24={'where':_0x4068d1['where']};return db[_0x13de('0x1f')]['count'](_0x3d9d24)[_0x13de('0x15')](function(_0x3525ee){_0x42bf7d[_0x13de('0x12')]=_0x3525ee;_0x4068d1[_0x13de('0x25')]=qs[_0x13de('0x25')](_0x3a88eb['query']);return db[_0x13de('0x1f')]['findAll'](_0x4068d1);})[_0x13de('0x15')](function(_0xc892d8){_0x42bf7d['rows']=_0xc892d8;return _0x42bf7d;})['then'](respondWithFilteredResult(_0x391e94,_0x4068d1))[_0x13de('0x26')](handleError(_0x391e94,null));};exports[_0x13de('0x27')]=function(_0x5487bb,_0x144cea){var _0x543c31={'raw':!![],'where':{'id':_0x5487bb[_0x13de('0x28')]['id']}},_0x1e5bdf={};_0x1e5bdf[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x1f')][_0x13de('0x20')]);_0x1e5bdf[_0x13de('0x2b')]=_['keys'](_0x5487bb['query']);_0x1e5bdf[_0x13de('0x2c')]=_[_0x13de('0x2d')](_0x1e5bdf['model'],_0x1e5bdf['query']);_0x543c31[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x1e5bdf[_0x13de('0x29')],qs[_0x13de('0x2f')](_0x5487bb[_0x13de('0x2b')][_0x13de('0x2f')]));_0x543c31['attributes']=_0x543c31[_0x13de('0x2e')][_0x13de('0x30')]?_0x543c31[_0x13de('0x2e')]:_0x1e5bdf[_0x13de('0x29')];if(_0x5487bb[_0x13de('0x2b')][_0x13de('0x31')]){_0x543c31[_0x13de('0x25')]=[{'all':!![]}];}_0x543c31=_[_0x13de('0x32')]({},_0x543c31,_0x5487bb[_0x13de('0x33')]);return db[_0x13de('0x1f')][_0x13de('0x34')](_0x543c31)[_0x13de('0x15')](handleEntityNotFound(_0x144cea,null))[_0x13de('0x15')](respondWithResult(_0x144cea,null))['catch'](handleError(_0x144cea,null));};exports['create']=function(_0x15ba11,_0x47337c){return db[_0x13de('0x1f')][_0x13de('0x35')](_0x15ba11[_0x13de('0x36')],{})['then'](function(_0x50725d){var _0x449187=_0x15ba11['user'][_0x13de('0x17')]({'plain':!![]});if(!_0x449187)throw new Error(_0x13de('0x37'));if(_0x449187[_0x13de('0x38')]==='user'){var _0x493e5f=_0x50725d[_0x13de('0x17')]({'plain':!![]});var _0x5ad727='ChatQueues';return db[_0x13de('0x39')]['find']({'where':{'name':_0x5ad727,'userProfileId':_0x449187[_0x13de('0x3a')]},'raw':!![]})[_0x13de('0x15')](function(_0x1a66b2){if(_0x1a66b2&&_0x1a66b2[_0x13de('0x3b')]===0x0){return db[_0x13de('0x19')]['create']({'name':_0x493e5f[_0x13de('0x1c')],'resourceId':_0x493e5f['id'],'type':_0x1a66b2[_0x13de('0x1c')],'sectionId':_0x1a66b2['id']},{})['then'](function(){return _0x50725d;});}else{return _0x50725d;}})['catch'](function(_0x137123){logger[_0x13de('0x1b')](_0x13de('0x3c'),_0x137123);throw _0x137123;});}return _0x50725d;})[_0x13de('0x15')](respondWithResult(_0x47337c,0xc9))[_0x13de('0x26')](handleError(_0x47337c,null));};exports[_0x13de('0x3d')]=function(_0x520a43,_0x3a6fd6){if(_0x520a43[_0x13de('0x36')]['id']){delete _0x520a43['body']['id'];}return db[_0x13de('0x1f')][_0x13de('0x34')]({'where':{'id':_0x520a43[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x3a6fd6,null))[_0x13de('0x15')](saveUpdates(_0x520a43['body'],null))[_0x13de('0x15')](respondWithResult(_0x3a6fd6,null))[_0x13de('0x26')](handleError(_0x3a6fd6,null));};exports[_0x13de('0x16')]=function(_0x150b7b,_0x278574){return db[_0x13de('0x1f')][_0x13de('0x34')]({'where':{'id':_0x150b7b[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x278574,null))[_0x13de('0x15')](removeEntity(_0x278574,null))[_0x13de('0x26')](handleError(_0x278574,null));};exports[_0x13de('0x3e')]=function(_0x5b92c1,_0x494427){return db[_0x13de('0x1f')]['describe']()[_0x13de('0x15')](respondWithResult(_0x494427,null))[_0x13de('0x26')](handleError(_0x494427,null));};exports[_0x13de('0x3f')]=function(_0x3d4dd3,_0x3694c0){var _0x3ef33c={'raw':!![],'where':{}},_0x34c4e2={},_0x56fb2b;return db[_0x13de('0x1f')]['findOne']({'where':{'id':_0x3d4dd3['params']['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x3694c0,null))[_0x13de('0x15')](function(_0x4adf83){if(_0x4adf83){_0x56fb2b=_0x4adf83['get']({'plain':!![]});_0x34c4e2[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x40')][_0x13de('0x20')]);_0x34c4e2['query']=_[_0x13de('0x2a')](_0x3d4dd3[_0x13de('0x2b')]);_0x34c4e2['filters']=_[_0x13de('0x2d')](_0x34c4e2['model'],_0x34c4e2[_0x13de('0x2b')]);_0x3ef33c[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x34c4e2[_0x13de('0x29')],qs['fields'](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x2f')]));_0x3ef33c['attributes']=_0x3ef33c[_0x13de('0x2e')][_0x13de('0x30')]?_0x3ef33c[_0x13de('0x2e')]:_0x34c4e2[_0x13de('0x29')];if(!_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0x3ef33c['limit']=qs['limit'](_0x3d4dd3['query'][_0x13de('0x13')]);_0x3ef33c[_0x13de('0x10')]=qs[_0x13de('0x10')](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x10')]);}_0x3ef33c['order']=qs[_0x13de('0x43')](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x43')]);_0x3ef33c['where']=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x3d4dd3['query'],_0x34c4e2[_0x13de('0x2c')]));_0x3ef33c[_0x13de('0x45')]['ChatQueueId']=_0x4adf83['id'];if(_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x46')]){_0x3ef33c[_0x13de('0x45')]=_[_0x13de('0x32')](_0x3ef33c[_0x13de('0x45')],{'$or':_[_0x13de('0x1e')](_0x3ef33c[_0x13de('0x2e')],function(_0x2bffc2){var _0x46835e={};_0x46835e[_0x2bffc2]={'$like':'%'+_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x46835e;})});}_0x3ef33c=_[_0x13de('0x32')]({},_0x3ef33c,_0x3d4dd3[_0x13de('0x33')]);return db[_0x13de('0x40')][_0x13de('0x47')](_0x3ef33c);}})[_0x13de('0x15')](function(_0x32bfa8){if(_0x32bfa8){return db['User'][_0x13de('0x48')]({'where':{'id':_[_0x13de('0x1e')](_0x32bfa8,'UserId'),'role':_0x13de('0x49')},'attributes':['id',_0x13de('0x1c'),_0x13de('0x4a'),_0x13de('0x4b'),_0x13de('0x4c')]});}})[_0x13de('0x15')](function(_0x4949db){if(_0x4949db){return{'count':_0x4949db['count'],'rows':_[_0x13de('0x1e')](_0x4949db[_0x13de('0x4d')],function(_0x27b661){return{'membername':_0x27b661[_0x13de('0x1c')],'UserId':_0x27b661['id'],'queue_name':_0x56fb2b['name'],'ChatQueueId':_0x56fb2b['id'],'interface':util[_0x13de('0x4e')](_0x13de('0x4f'),'SIP',_0x27b661[_0x13de('0x1c')]),'penalty':0x0,'paused':_0x27b661[_0x13de('0x4a')],'createdAt':_0x27b661[_0x13de('0x4c')],'updatedAt':_0x27b661[_0x13de('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x13de('0x15')](respondWithFilteredResult(_0x3694c0,_0x3ef33c))[_0x13de('0x26')](handleError(_0x3694c0,null));};exports['getTeams']=function(_0x243434,_0x2707ab){var _0xf27d96={};var _0x508daf={};var _0x1554b2;var _0x429840;return db[_0x13de('0x1f')][_0x13de('0x50')]({'where':{'id':_0x243434[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x2707ab,null))[_0x13de('0x15')](function(_0x4d21e4){if(_0x4d21e4){_0x1554b2=_0x4d21e4;_0x508daf['model']=_[_0x13de('0x2a')](db[_0x13de('0x51')][_0x13de('0x20')]);_0x508daf[_0x13de('0x2b')]=_['keys'](_0x243434[_0x13de('0x2b')]);_0x508daf['filters']=_[_0x13de('0x2d')](_0x508daf[_0x13de('0x29')],_0x508daf[_0x13de('0x2b')]);_0xf27d96['attributes']=_[_0x13de('0x2d')](_0x508daf[_0x13de('0x29')],qs['fields'](_0x243434[_0x13de('0x2b')][_0x13de('0x2f')]));_0xf27d96[_0x13de('0x2e')]=_0xf27d96[_0x13de('0x2e')][_0x13de('0x30')]?_0xf27d96['attributes']:_0x508daf[_0x13de('0x29')];_0xf27d96[_0x13de('0x52')]=qs[_0x13de('0x43')](_0x243434[_0x13de('0x2b')][_0x13de('0x43')]);_0xf27d96[_0x13de('0x45')]=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x243434[_0x13de('0x2b')],_0x508daf[_0x13de('0x2c')]));if(_0x243434[_0x13de('0x2b')]['filter']){_0xf27d96[_0x13de('0x45')]=_[_0x13de('0x32')](_0xf27d96[_0x13de('0x45')],{'$or':_[_0x13de('0x1e')](_0xf27d96[_0x13de('0x2e')],function(_0x5b38ae){var _0x5547b2={};_0x5547b2[_0x5b38ae]={'$like':'%'+_0x243434[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x5547b2;})});}_0xf27d96=_[_0x13de('0x32')]({},_0xf27d96,_0x243434[_0x13de('0x33')]);return _0x1554b2[_0x13de('0x53')](_0xf27d96);}})[_0x13de('0x15')](function(_0x5c3e01){if(_0x5c3e01){_0x429840=_0x5c3e01[_0x13de('0x30')];if(!_0x243434[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0xf27d96[_0x13de('0x13')]=qs[_0x13de('0x13')](_0x243434[_0x13de('0x2b')][_0x13de('0x13')]);_0xf27d96[_0x13de('0x10')]=qs[_0x13de('0x10')](_0x243434[_0x13de('0x2b')]['offset']);}return _0x1554b2[_0x13de('0x53')](_0xf27d96);}})[_0x13de('0x15')](function(_0xf8ac5e){if(_0xf8ac5e){return _0xf8ac5e?{'count':_0x429840,'rows':_0xf8ac5e}:null;}})[_0x13de('0x15')](respondWithResult(_0x2707ab,null))['catch'](handleError(_0x2707ab,null));};exports[_0x13de('0x54')]=function(_0x80485,_0x3ff4b1){var _0x45de19=_0x80485[_0x13de('0x36')][_0x13de('0x55')];return db['Team'][_0x13de('0x47')]({'where':{'id':_0x45de19},'attributes':['id'],'include':[{'model':db[_0x13de('0x56')],'as':_0x13de('0x57'),'attributes':['id',_0x13de('0x1c'),_0x13de('0x58'),_0x13de('0x59'),_0x13de('0x5a')],'raw':!![]}]})[_0x13de('0x15')](function(_0xdef1db){if(_0xdef1db){var _0x2a1cca=_[_0x13de('0x5b')](_0xdef1db,function(_0x4a000b){var _0x11de90=_0x4a000b[_0x13de('0x17')]({'plain':!![]});return _0x11de90[_0x13de('0x57')];});return db[_0x13de('0x1f')]['find']({'where':{'id':_0x80485[_0x13de('0x28')]['id']}})[_0x13de('0x15')](function(_0x1ef6d3){return db[_0x13de('0x5c')][_0x13de('0x5d')](function(_0x40ff8e){return _0x1ef6d3[_0x13de('0x54')](_0x45de19,{'transaction':_0x40ff8e})[_0x13de('0x15')](function(){return BPromise[_0x13de('0x5e')](_0x2a1cca,function(_0x5072ac){return db['UserChatQueue'][_0x13de('0x5f')]({'where':{'UserId':_0x5072ac['id'],'ChatQueueId':_0x80485['params']['id']},'transaction':_0x40ff8e});});})[_0x13de('0x15')](function(){_0x2a1cca['forEach'](function(_0x5750f7){socket[_0x13de('0x60')]('userChatQueue:save',{'UserId':_0x5750f7['id'],'ChatQueueId':_0x1ef6d3['id']});});});});});}})[_0x13de('0x15')](respondWithStatusCode(_0x3ff4b1,null))[_0x13de('0x26')](handleError(_0x3ff4b1,null));};exports['removeTeams']=function(_0x4be593,_0xab412c){return db[_0x13de('0x51')][_0x13de('0x47')]({'where':{'id':_0x4be593[_0x13de('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x13de('0x56')],'as':_0x13de('0x57'),'attributes':['id'],'raw':!![]}]})[_0x13de('0x15')](handleEntityNotFound(_0xab412c,null))['then'](function(_0x5d12e2){var _0x5d5fce=_[_0x13de('0x1e')](_0x5d12e2,'id');var _0x3dfe5a=[];var _0x11e0aa=[];var _0x1a24e7=squel[_0x13de('0x61')]();_0x1a24e7[_0x13de('0x62')](_0x13de('0x63'))[_0x13de('0x64')](_0x13de('0x65'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x13de('0x45')](_0x13de('0x66'),_0x4be593['params']['id']);for(var _0x3bba86=0x0;_0x3bba86<_0x5d12e2['length'];_0x3bba86+=0x1){let _0x58f435=_0x5d12e2[_0x3bba86];for(var _0x27ec58=0x0;_0x27ec58<_0x58f435[_0x13de('0x57')][_0x13de('0x30')];_0x27ec58+=0x1){let _0x3b22a5=_0x58f435[_0x13de('0x57')][_0x27ec58];var _0x9f8d32=_0x1a24e7[_0x13de('0x67')]();_0x9f8d32[_0x13de('0x45')]('ut.UserId\x20=\x20?',_0x3b22a5['id']);_0x11e0aa['push'](db['sequelize']['query'](_0x9f8d32[_0x13de('0x68')](),{'type':db[_0x13de('0x5c')][_0x13de('0x69')]['SELECT']})[_0x13de('0x15')](function(_0x2eb74c){if(_0x2eb74c['length']===0x1){return _0x3b22a5['id'];}else{var _0x278967=_[_0x13de('0x6a')](_[_0x13de('0x1e')](_0x2eb74c,'TeamId'),function(_0x2eaa7e){return _['includes'](_0x5d5fce,_0x2eaa7e);});if(_0x278967){return _0x3b22a5['id'];}}}));}}return BPromise[_0x13de('0x6b')](_0x11e0aa)['then'](function(_0x305044){_0x3dfe5a=_(_0x3dfe5a)[_0x13de('0x6c')](_0x305044)[_0x13de('0x6d')]()[_0x13de('0x6e')]();return db['ChatQueue'][_0x13de('0x34')]({'where':{'id':_0x4be593['params']['id']}})[_0x13de('0x15')](function(_0x3280eb){return db[_0x13de('0x5c')][_0x13de('0x5d')](function(_0x40bb66){return _0x3280eb[_0x13de('0x6f')](_0x4be593[_0x13de('0x2b')][_0x13de('0x55')],{'transaction':_0x40bb66})[_0x13de('0x15')](function(){if(!_[_0x13de('0x70')](_0x3dfe5a)){return _0x3280eb[_0x13de('0x71')](_0x3dfe5a,{'transaction':_0x40bb66});}})[_0x13de('0x15')](function(){_0x3dfe5a[_0x13de('0x72')](function(_0x3c7920){socket[_0x13de('0x60')]('userChatQueue:remove',{'UserId':_0x3c7920,'ChatQueueId':_0x3280eb['id']});});});});});});})[_0x13de('0x15')](respondWithStatusCode(_0xab412c,null))[_0x13de('0x26')](handleError(_0xab412c,null));};exports['addAgents']=function(_0x2f23a0,_0x11ab96){return db['ChatQueue'][_0x13de('0x34')]({'where':{'id':_0x2f23a0[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x11ab96,null))[_0x13de('0x15')](function(_0x270238){if(_0x270238){return _0x270238[_0x13de('0x73')](_0x2f23a0[_0x13de('0x36')]['ids'],_[_0x13de('0x74')](_0x2f23a0[_0x13de('0x36')],[_0x13de('0x55'),'id'])||{})[_0x13de('0x75')](function(_0x5d96b7){for(var _0x5be97e=0x0;_0x5be97e<_0x2f23a0[_0x13de('0x36')][_0x13de('0x55')][_0x13de('0x30')];_0x5be97e+=0x1){socket[_0x13de('0x60')](_0x13de('0x76'),{'UserId':Number(_0x2f23a0[_0x13de('0x36')][_0x13de('0x55')][_0x5be97e]),'ChatQueueId':Number(_0x2f23a0['params']['id'])});}return _0x5d96b7;});}})['then'](respondWithResult(_0x11ab96,null))[_0x13de('0x26')](handleError(_0x11ab96,null));};exports['removeAgents']=function(_0x4871d9,_0x422fbd){return db[_0x13de('0x1f')]['find']({'where':{'id':_0x4871d9[_0x13de('0x28')]['id']}})['then'](handleEntityNotFound(_0x422fbd,null))[_0x13de('0x15')](function(_0x3de88c){if(_0x3de88c){return _0x3de88c[_0x13de('0x71')](_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')])['then'](function(){if(_[_0x13de('0x77')](_0x4871d9[_0x13de('0x2b')]['ids'])){for(var _0x29f18c=0x0;_0x29f18c<_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')][_0x13de('0x30')];_0x29f18c+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')][_0x29f18c]),'ChatQueueId':Number(_0x4871d9[_0x13de('0x28')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4871d9['query'][_0x13de('0x55')]),'ChatQueueId':Number(_0x4871d9[_0x13de('0x28')]['id'])});}});}})[_0x13de('0x15')](respondWithStatusCode(_0x422fbd,null))[_0x13de('0x26')](handleError(_0x422fbd,null));};exports[_0x13de('0x78')]=function(_0x351127,_0x5f0b70){var _0x270aff={};var _0x567b18={};var _0x162c1e;var _0x61018d;return db[_0x13de('0x1f')][_0x13de('0x50')]({'where':{'id':_0x351127[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x5f0b70,null))[_0x13de('0x15')](function(_0xbe2346){if(_0xbe2346){_0x162c1e=_0xbe2346;_0x567b18[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x56')][_0x13de('0x20')]);_0x567b18[_0x13de('0x2b')]=_['keys'](_0x351127[_0x13de('0x2b')]);_0x567b18[_0x13de('0x2c')]=_[_0x13de('0x2d')](_0x567b18[_0x13de('0x29')],_0x567b18[_0x13de('0x2b')]);_0x270aff[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x567b18['model'],qs[_0x13de('0x2f')](_0x351127['query'][_0x13de('0x2f')]));_0x270aff['attributes']=_0x270aff[_0x13de('0x2e')][_0x13de('0x30')]?_0x270aff['attributes']:_0x567b18[_0x13de('0x29')];_0x270aff[_0x13de('0x52')]=qs[_0x13de('0x43')](_0x351127[_0x13de('0x2b')]['sort']);_0x270aff[_0x13de('0x45')]=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x351127['query'],_0x567b18['filters']));if(_0x351127[_0x13de('0x2b')][_0x13de('0x46')]){_0x270aff[_0x13de('0x45')]=_['merge'](_0x270aff[_0x13de('0x45')],{'$or':_['map'](_0x270aff[_0x13de('0x2e')],function(_0x4f0818){var _0x2538ec={};_0x2538ec[_0x4f0818]={'$like':'%'+_0x351127[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x2538ec;})});}_0x270aff=_[_0x13de('0x32')]({},_0x270aff,_0x351127[_0x13de('0x33')]);return _0x162c1e[_0x13de('0x78')](_0x270aff);}})[_0x13de('0x15')](function(_0x1cf2c7){if(_0x1cf2c7){_0x61018d=_0x1cf2c7[_0x13de('0x30')];if(!_0x351127[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0x270aff[_0x13de('0x13')]=qs[_0x13de('0x13')](_0x351127[_0x13de('0x2b')][_0x13de('0x13')]);_0x270aff['offset']=qs[_0x13de('0x10')](_0x351127['query'][_0x13de('0x10')]);}return _0x162c1e[_0x13de('0x78')](_0x270aff);}})[_0x13de('0x15')](function(_0x5b27fa){if(_0x5b27fa){return _0x5b27fa?{'count':_0x61018d,'rows':_0x5b27fa}:null;}})[_0x13de('0x15')](respondWithResult(_0x5f0b70,null))[_0x13de('0x26')](handleError(_0x5f0b70,null));}; \ No newline at end of file +var _0xcbf9=['ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','compact','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','nolimit','util','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','ChatQueue','fieldName','key','where','include','findAll','catch','model','keys','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','rawAttributes','filters','hasOwnProperty','order','sort','pick','ChatQueueId','filter','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','getTeams','Team','ids','Agents','online','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0xbb6fb5,_0x4db9fb){var _0x2f9501=function(_0x4a9b92){while(--_0x4a9b92){_0xbb6fb5['push'](_0xbb6fb5['shift']());}};_0x2f9501(++_0x4db9fb);}(_0xcbf9,0x16d));var _0x9cbf=function(_0x4e255e,_0x1681c5){_0x4e255e=_0x4e255e-0x0;var _0x88c0aa=_0xcbf9[_0x4e255e];return _0x88c0aa;};'use strict';var BPromise=require('bluebird');var util=require(_0x9cbf('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x9cbf('0x1'));var qs=require(_0x9cbf('0x2'));var logger=require('../../config/logger')(_0x9cbf('0x3'));var config=require(_0x9cbf('0x4'));var db=require(_0x9cbf('0x5'))['db'];config[_0x9cbf('0x6')]=_['defaults'](config['redis'],{'host':_0x9cbf('0x7'),'port':0x18eb});var socket=require(_0x9cbf('0x8'))(new Redis(config[_0x9cbf('0x6')]));require(_0x9cbf('0x9'))['register'](socket);function respondWithStatusCode(_0x1322ab,_0x115d02){_0x115d02=_0x115d02||0xcc;return function(_0x4cf4df){if(_0x4cf4df){return _0x1322ab[_0x9cbf('0xa')](_0x115d02);}return _0x1322ab[_0x9cbf('0xb')](_0x115d02)[_0x9cbf('0xc')]();};}function respondWithResult(_0x406029,_0x4ddc7c){_0x4ddc7c=_0x4ddc7c||0xc8;return function(_0x2f6a1b){if(_0x2f6a1b){return _0x406029['status'](_0x4ddc7c)[_0x9cbf('0xd')](_0x2f6a1b);}};}function respondWithFilteredResult(_0x5b3bca,_0x4788ae){return function(_0x392ec3){if(_0x392ec3){var _0x5994a1=typeof _0x4788ae[_0x9cbf('0xe')]===_0x9cbf('0xf')&&typeof _0x4788ae[_0x9cbf('0x10')]==='undefined';var _0x262b66=_0x392ec3[_0x9cbf('0x11')];var _0x1d5c60=_0x5994a1?0x0:_0x4788ae['offset'];var _0xa0f05b=_0x5994a1?_0x392ec3[_0x9cbf('0x11')]:_0x4788ae[_0x9cbf('0xe')]+_0x4788ae[_0x9cbf('0x10')];var _0x5ac2fd;if(_0xa0f05b>=_0x262b66){_0xa0f05b=_0x262b66;_0x5ac2fd=0xc8;}else{_0x5ac2fd=0xce;}_0x5b3bca[_0x9cbf('0xb')](_0x5ac2fd);return _0x5b3bca[_0x9cbf('0x12')](_0x9cbf('0x13'),_0x1d5c60+'-'+_0xa0f05b+'/'+_0x262b66)[_0x9cbf('0xd')](_0x392ec3);}return null;};}function saveUpdates(_0xde2291){return function(_0x250863){if(_0x250863){return _0x250863[_0x9cbf('0x14')](_0xde2291)[_0x9cbf('0x15')](function(_0x2fde8b){return _0x2fde8b;});}return null;};}function removeEntity(_0x3f72a4){return function(_0x1e048b){if(_0x1e048b){return _0x1e048b[_0x9cbf('0x16')]()[_0x9cbf('0x15')](function(){var _0x4e5b58=_0x1e048b[_0x9cbf('0x17')]({'plain':!![]});var _0x5166c7=_0x9cbf('0x18');return db[_0x9cbf('0x19')][_0x9cbf('0x16')]({'where':{'type':_0x5166c7,'resourceId':_0x4e5b58['id']}})[_0x9cbf('0x15')](function(){return _0x1e048b;});})[_0x9cbf('0x15')](function(){_0x3f72a4[_0x9cbf('0xb')](0xcc)[_0x9cbf('0xc')]();});}};}function handleEntityNotFound(_0x2fef7f){return function(_0xbb2b6a){if(!_0xbb2b6a){_0x2fef7f[_0x9cbf('0xa')](0x194);}return _0xbb2b6a;};}function handleError(_0x5edc1e,_0x4ce092){_0x4ce092=_0x4ce092||0x1f4;return function(_0x1eda82){logger[_0x9cbf('0x1a')](_0x1eda82[_0x9cbf('0x1b')]);if(_0x1eda82['name']){delete _0x1eda82[_0x9cbf('0x1c')];}_0x5edc1e[_0x9cbf('0xb')](_0x4ce092)[_0x9cbf('0x1d')](_0x1eda82);};}exports[_0x9cbf('0x1e')]=function(_0x3ae0db,_0x25aca3){var _0x3eca65={};var _0x226d68={'count':0x0,'rows':[]};var _0xb84c58=_['map'](db[_0x9cbf('0x1f')]['rawAttributes'],function(_0x3d5a2b){return{'name':_0x3d5a2b[_0x9cbf('0x20')],'type':_0x3d5a2b['type'][_0x9cbf('0x21')]};});_0x3eca65=qs['getOptions'](_0xb84c58,_0x3ae0db);var _0x8e70e0={'where':_0x3eca65[_0x9cbf('0x22')]};return db[_0x9cbf('0x1f')]['count'](_0x8e70e0)[_0x9cbf('0x15')](function(_0x2109f5){_0x226d68[_0x9cbf('0x11')]=_0x2109f5;_0x3eca65[_0x9cbf('0x23')]=qs[_0x9cbf('0x23')](_0x3ae0db['query']);return db[_0x9cbf('0x1f')][_0x9cbf('0x24')](_0x3eca65);})['then'](function(_0x5b091c){_0x226d68['rows']=_0x5b091c;return _0x226d68;})[_0x9cbf('0x15')](respondWithFilteredResult(_0x25aca3,_0x3eca65))[_0x9cbf('0x25')](handleError(_0x25aca3,null));};exports['show']=function(_0x4f09b8,_0x38ff99){var _0x827300={'raw':!![],'where':{'id':_0x4f09b8['params']['id']}},_0x2b6374={};_0x2b6374[_0x9cbf('0x26')]=_[_0x9cbf('0x27')](db[_0x9cbf('0x1f')]['rawAttributes']);_0x2b6374[_0x9cbf('0x28')]=_[_0x9cbf('0x27')](_0x4f09b8[_0x9cbf('0x28')]);_0x2b6374['filters']=_[_0x9cbf('0x29')](_0x2b6374['model'],_0x2b6374[_0x9cbf('0x28')]);_0x827300[_0x9cbf('0x2a')]=_[_0x9cbf('0x29')](_0x2b6374['model'],qs[_0x9cbf('0x2b')](_0x4f09b8[_0x9cbf('0x28')]['fields']));_0x827300[_0x9cbf('0x2a')]=_0x827300[_0x9cbf('0x2a')][_0x9cbf('0x2c')]?_0x827300['attributes']:_0x2b6374['model'];if(_0x4f09b8[_0x9cbf('0x28')][_0x9cbf('0x2d')]){_0x827300[_0x9cbf('0x23')]=[{'all':!![]}];}_0x827300=_[_0x9cbf('0x2e')]({},_0x827300,_0x4f09b8[_0x9cbf('0x2f')]);return db[_0x9cbf('0x1f')][_0x9cbf('0x30')](_0x827300)[_0x9cbf('0x15')](handleEntityNotFound(_0x38ff99,null))[_0x9cbf('0x15')](respondWithResult(_0x38ff99,null))[_0x9cbf('0x25')](handleError(_0x38ff99,null));};exports[_0x9cbf('0x31')]=function(_0xb3d678,_0x462f2e){return db[_0x9cbf('0x1f')]['create'](_0xb3d678[_0x9cbf('0x32')],{})[_0x9cbf('0x15')](function(_0x2dcfe2){var _0x62b69b=_0xb3d678[_0x9cbf('0x33')]['get']({'plain':!![]});if(!_0x62b69b)throw new Error(_0x9cbf('0x34'));if(_0x62b69b[_0x9cbf('0x35')]===_0x9cbf('0x33')){var _0x4c9762=_0x2dcfe2[_0x9cbf('0x17')]({'plain':!![]});var _0x3e4753=_0x9cbf('0x18');return db[_0x9cbf('0x36')][_0x9cbf('0x30')]({'where':{'name':_0x3e4753,'userProfileId':_0x62b69b[_0x9cbf('0x37')]},'raw':!![]})[_0x9cbf('0x15')](function(_0x489601){if(_0x489601&&_0x489601['autoAssociation']===0x0){return db[_0x9cbf('0x19')][_0x9cbf('0x31')]({'name':_0x4c9762[_0x9cbf('0x1c')],'resourceId':_0x4c9762['id'],'type':_0x489601['name'],'sectionId':_0x489601['id']},{})[_0x9cbf('0x15')](function(){return _0x2dcfe2;});}else{return _0x2dcfe2;}})[_0x9cbf('0x25')](function(_0x2b47f4){logger[_0x9cbf('0x1a')](_0x9cbf('0x38'),_0x2b47f4);throw _0x2b47f4;});}return _0x2dcfe2;})[_0x9cbf('0x15')](respondWithResult(_0x462f2e,0xc9))[_0x9cbf('0x25')](handleError(_0x462f2e,null));};exports[_0x9cbf('0x14')]=function(_0xe6f035,_0x5dcb39){if(_0xe6f035[_0x9cbf('0x32')]['id']){delete _0xe6f035[_0x9cbf('0x32')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0xe6f035[_0x9cbf('0x39')]['id']}})[_0x9cbf('0x15')](handleEntityNotFound(_0x5dcb39,null))[_0x9cbf('0x15')](saveUpdates(_0xe6f035[_0x9cbf('0x32')],null))[_0x9cbf('0x15')](respondWithResult(_0x5dcb39,null))[_0x9cbf('0x25')](handleError(_0x5dcb39,null));};exports[_0x9cbf('0x16')]=function(_0x131ca0,_0x51053d){return db[_0x9cbf('0x1f')][_0x9cbf('0x30')]({'where':{'id':_0x131ca0['params']['id']}})[_0x9cbf('0x15')](handleEntityNotFound(_0x51053d,null))['then'](removeEntity(_0x51053d,null))[_0x9cbf('0x25')](handleError(_0x51053d,null));};exports[_0x9cbf('0x3a')]=function(_0xc17e7,_0x6920e5){return db[_0x9cbf('0x1f')][_0x9cbf('0x3a')]()[_0x9cbf('0x15')](respondWithResult(_0x6920e5,null))[_0x9cbf('0x25')](handleError(_0x6920e5,null));};exports[_0x9cbf('0x3b')]=function(_0x412fc2,_0x14cdac){var _0x4efd7e={'raw':!![],'where':{}},_0x1219e4={},_0x4db280;return db[_0x9cbf('0x1f')][_0x9cbf('0x3c')]({'where':{'id':_0x412fc2[_0x9cbf('0x39')]['id']}})['then'](handleEntityNotFound(_0x14cdac,null))[_0x9cbf('0x15')](function(_0x53a304){if(_0x53a304){_0x4db280=_0x53a304[_0x9cbf('0x17')]({'plain':!![]});_0x1219e4[_0x9cbf('0x26')]=_[_0x9cbf('0x27')](db[_0x9cbf('0x3d')][_0x9cbf('0x3e')]);_0x1219e4[_0x9cbf('0x28')]=_[_0x9cbf('0x27')](_0x412fc2['query']);_0x1219e4[_0x9cbf('0x3f')]=_['intersection'](_0x1219e4[_0x9cbf('0x26')],_0x1219e4['query']);_0x4efd7e['attributes']=_[_0x9cbf('0x29')](_0x1219e4[_0x9cbf('0x26')],qs[_0x9cbf('0x2b')](_0x412fc2[_0x9cbf('0x28')][_0x9cbf('0x2b')]));_0x4efd7e[_0x9cbf('0x2a')]=_0x4efd7e[_0x9cbf('0x2a')][_0x9cbf('0x2c')]?_0x4efd7e[_0x9cbf('0x2a')]:_0x1219e4[_0x9cbf('0x26')];if(!_0x412fc2['query'][_0x9cbf('0x40')]('nolimit')){_0x4efd7e[_0x9cbf('0x10')]=qs[_0x9cbf('0x10')](_0x412fc2[_0x9cbf('0x28')][_0x9cbf('0x10')]);_0x4efd7e[_0x9cbf('0xe')]=qs[_0x9cbf('0xe')](_0x412fc2[_0x9cbf('0x28')][_0x9cbf('0xe')]);}_0x4efd7e[_0x9cbf('0x41')]=qs['sort'](_0x412fc2['query'][_0x9cbf('0x42')]);_0x4efd7e['where']=qs[_0x9cbf('0x3f')](_[_0x9cbf('0x43')](_0x412fc2[_0x9cbf('0x28')],_0x1219e4['filters']));_0x4efd7e['where'][_0x9cbf('0x44')]=_0x53a304['id'];if(_0x412fc2['query'][_0x9cbf('0x45')]){_0x4efd7e['where']=_[_0x9cbf('0x2e')](_0x4efd7e[_0x9cbf('0x22')],{'$or':_[_0x9cbf('0x46')](_0x4efd7e[_0x9cbf('0x2a')],function(_0x353fab){var _0x24a7b5={};_0x24a7b5[_0x353fab]={'$like':'%'+_0x412fc2[_0x9cbf('0x28')][_0x9cbf('0x45')]+'%'};return _0x24a7b5;})});}_0x4efd7e=_[_0x9cbf('0x2e')]({},_0x4efd7e,_0x412fc2[_0x9cbf('0x2f')]);return db['UserChatQueue'][_0x9cbf('0x24')](_0x4efd7e);}})[_0x9cbf('0x15')](function(_0x2d6357){if(_0x2d6357){return db[_0x9cbf('0x47')][_0x9cbf('0x48')]({'where':{'id':_[_0x9cbf('0x46')](_0x2d6357,_0x9cbf('0x49')),'role':_0x9cbf('0x4a')},'attributes':['id',_0x9cbf('0x1c'),_0x9cbf('0x4b'),_0x9cbf('0x4c'),'createdAt']});}})[_0x9cbf('0x15')](function(_0x3de927){if(_0x3de927){return{'count':_0x3de927[_0x9cbf('0x11')],'rows':_['map'](_0x3de927[_0x9cbf('0x4d')],function(_0x23e51b){return{'membername':_0x23e51b['name'],'UserId':_0x23e51b['id'],'queue_name':_0x4db280[_0x9cbf('0x1c')],'ChatQueueId':_0x4db280['id'],'interface':util[_0x9cbf('0x4e')]('%s/%s',_0x9cbf('0x4f'),_0x23e51b[_0x9cbf('0x1c')]),'penalty':0x0,'paused':_0x23e51b[_0x9cbf('0x4b')],'createdAt':_0x23e51b['createdAt'],'updatedAt':_0x23e51b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9cbf('0x15')](respondWithFilteredResult(_0x14cdac,_0x4efd7e))[_0x9cbf('0x25')](handleError(_0x14cdac,null));};exports[_0x9cbf('0x50')]=function(_0x799f90,_0x220786){var _0x59ee9d={};var _0x2315df={};var _0x38fe22;var _0x1b7a4c;return db[_0x9cbf('0x1f')]['findOne']({'where':{'id':_0x799f90[_0x9cbf('0x39')]['id']}})['then'](handleEntityNotFound(_0x220786,null))['then'](function(_0x456480){if(_0x456480){_0x38fe22=_0x456480;_0x2315df[_0x9cbf('0x26')]=_[_0x9cbf('0x27')](db[_0x9cbf('0x51')][_0x9cbf('0x3e')]);_0x2315df[_0x9cbf('0x28')]=_[_0x9cbf('0x27')](_0x799f90[_0x9cbf('0x28')]);_0x2315df['filters']=_['intersection'](_0x2315df[_0x9cbf('0x26')],_0x2315df['query']);_0x59ee9d[_0x9cbf('0x2a')]=_['intersection'](_0x2315df[_0x9cbf('0x26')],qs[_0x9cbf('0x2b')](_0x799f90[_0x9cbf('0x28')][_0x9cbf('0x2b')]));_0x59ee9d[_0x9cbf('0x2a')]=_0x59ee9d['attributes'][_0x9cbf('0x2c')]?_0x59ee9d[_0x9cbf('0x2a')]:_0x2315df['model'];_0x59ee9d[_0x9cbf('0x41')]=qs['sort'](_0x799f90[_0x9cbf('0x28')]['sort']);_0x59ee9d[_0x9cbf('0x22')]=qs[_0x9cbf('0x3f')](_[_0x9cbf('0x43')](_0x799f90[_0x9cbf('0x28')],_0x2315df[_0x9cbf('0x3f')]));if(_0x799f90['query']['filter']){_0x59ee9d[_0x9cbf('0x22')]=_[_0x9cbf('0x2e')](_0x59ee9d['where'],{'$or':_[_0x9cbf('0x46')](_0x59ee9d[_0x9cbf('0x2a')],function(_0x17c1a1){var _0x3991be={};_0x3991be[_0x17c1a1]={'$like':'%'+_0x799f90[_0x9cbf('0x28')][_0x9cbf('0x45')]+'%'};return _0x3991be;})});}_0x59ee9d=_[_0x9cbf('0x2e')]({},_0x59ee9d,_0x799f90[_0x9cbf('0x2f')]);return _0x38fe22['getTeams'](_0x59ee9d);}})[_0x9cbf('0x15')](function(_0x4873d8){if(_0x4873d8){_0x1b7a4c=_0x4873d8[_0x9cbf('0x2c')];if(!_0x799f90[_0x9cbf('0x28')][_0x9cbf('0x40')]('nolimit')){_0x59ee9d['limit']=qs[_0x9cbf('0x10')](_0x799f90['query'][_0x9cbf('0x10')]);_0x59ee9d[_0x9cbf('0xe')]=qs[_0x9cbf('0xe')](_0x799f90[_0x9cbf('0x28')][_0x9cbf('0xe')]);}return _0x38fe22[_0x9cbf('0x50')](_0x59ee9d);}})['then'](function(_0x16478f){if(_0x16478f){return _0x16478f?{'count':_0x1b7a4c,'rows':_0x16478f}:null;}})[_0x9cbf('0x15')](respondWithResult(_0x220786,null))[_0x9cbf('0x25')](handleError(_0x220786,null));};exports['addTeams']=function(_0xe4bdb0,_0x4a92cd){var _0x3c1133=_0xe4bdb0[_0x9cbf('0x32')][_0x9cbf('0x52')];return db[_0x9cbf('0x51')]['findAll']({'where':{'id':_0x3c1133},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9cbf('0x53'),'attributes':['id',_0x9cbf('0x1c'),_0x9cbf('0x54'),'voicePause','interface'],'raw':!![]}]})[_0x9cbf('0x15')](function(_0x17fd79){if(_0x17fd79){var _0x45eedb=_[_0x9cbf('0x55')](_0x17fd79,function(_0x2f816e){var _0xba6dac=_0x2f816e[_0x9cbf('0x17')]({'plain':!![]});return _0xba6dac['Agents'];});return db[_0x9cbf('0x1f')][_0x9cbf('0x30')]({'where':{'id':_0xe4bdb0['params']['id']}})[_0x9cbf('0x15')](function(_0x3fe225){return db['sequelize'][_0x9cbf('0x56')](function(_0x219b53){return _0x3fe225[_0x9cbf('0x57')](_0x3c1133,{'transaction':_0x219b53})['then'](function(){return BPromise['each'](_0x45eedb,function(_0x3dcca1){return db[_0x9cbf('0x3d')][_0x9cbf('0x58')]({'where':{'UserId':_0x3dcca1['id'],'ChatQueueId':_0xe4bdb0[_0x9cbf('0x39')]['id']},'transaction':_0x219b53});});})['then'](function(){_0x45eedb[_0x9cbf('0x59')](function(_0xb91c89){socket[_0x9cbf('0x5a')](_0x9cbf('0x5b'),{'UserId':_0xb91c89['id'],'ChatQueueId':_0x3fe225['id']});});});});});}})['then'](respondWithStatusCode(_0x4a92cd,null))[_0x9cbf('0x25')](handleError(_0x4a92cd,null));};exports[_0x9cbf('0x5c')]=function(_0x7b418d,_0x338ff7){return db[_0x9cbf('0x51')][_0x9cbf('0x24')]({'where':{'id':_0x7b418d[_0x9cbf('0x28')][_0x9cbf('0x52')]},'attributes':['id'],'include':[{'model':db[_0x9cbf('0x47')],'as':_0x9cbf('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x338ff7,null))[_0x9cbf('0x15')](function(_0x5eb2e3){var _0x5cb1a6=_[_0x9cbf('0x46')](_0x5eb2e3,'id');var _0x14e80a=[];var _0x55e16b=[];var _0x320698=squel[_0x9cbf('0x5d')]();_0x320698[_0x9cbf('0x5e')]('tq.TeamId')[_0x9cbf('0x5f')](_0x9cbf('0x60'),'tq')['join'](_0x9cbf('0x61'),'ut',_0x9cbf('0x62'))[_0x9cbf('0x22')](_0x9cbf('0x63'),_0x7b418d['params']['id']);for(var _0x483a94=0x0;_0x483a94<_0x5eb2e3[_0x9cbf('0x2c')];_0x483a94+=0x1){let _0xbd3521=_0x5eb2e3[_0x483a94];for(var _0x353158=0x0;_0x353158<_0xbd3521[_0x9cbf('0x53')][_0x9cbf('0x2c')];_0x353158+=0x1){let _0x303bef=_0xbd3521[_0x9cbf('0x53')][_0x353158];var _0xc37ced=_0x320698[_0x9cbf('0x64')]();_0xc37ced['where'](_0x9cbf('0x65'),_0x303bef['id']);_0x55e16b['push'](db['sequelize'][_0x9cbf('0x28')](_0xc37ced[_0x9cbf('0x66')](),{'type':db[_0x9cbf('0x67')][_0x9cbf('0x68')][_0x9cbf('0x69')]})[_0x9cbf('0x15')](function(_0x369f3b){if(_0x369f3b[_0x9cbf('0x2c')]===0x1){return _0x303bef['id'];}else{var _0x32247d=_['every'](_[_0x9cbf('0x46')](_0x369f3b,_0x9cbf('0x6a')),function(_0x116c1c){return _[_0x9cbf('0x6b')](_0x5cb1a6,_0x116c1c);});if(_0x32247d){return _0x303bef['id'];}}}));}}return BPromise[_0x9cbf('0x6c')](_0x55e16b)[_0x9cbf('0x15')](function(_0x2aaa73){_0x14e80a=_(_0x14e80a)['union'](_0x2aaa73)[_0x9cbf('0x6d')]()['value']();return db[_0x9cbf('0x1f')][_0x9cbf('0x30')]({'where':{'id':_0x7b418d[_0x9cbf('0x39')]['id']}})[_0x9cbf('0x15')](function(_0xed2417){return db['sequelize'][_0x9cbf('0x56')](function(_0x48f6d0){return _0xed2417[_0x9cbf('0x5c')](_0x7b418d[_0x9cbf('0x28')][_0x9cbf('0x52')],{'transaction':_0x48f6d0})['then'](function(){if(!_['isEmpty'](_0x14e80a)){return _0xed2417['removeAgents'](_0x14e80a,{'transaction':_0x48f6d0});}})[_0x9cbf('0x15')](function(){_0x14e80a[_0x9cbf('0x59')](function(_0x48213d){socket[_0x9cbf('0x5a')](_0x9cbf('0x6e'),{'UserId':_0x48213d,'ChatQueueId':_0xed2417['id']});});});});});});})[_0x9cbf('0x15')](respondWithStatusCode(_0x338ff7,null))['catch'](handleError(_0x338ff7,null));};exports[_0x9cbf('0x6f')]=function(_0x43b34d,_0x610cb3){return db[_0x9cbf('0x1f')][_0x9cbf('0x30')]({'where':{'id':_0x43b34d['params']['id']}})[_0x9cbf('0x15')](handleEntityNotFound(_0x610cb3,null))[_0x9cbf('0x15')](function(_0x219e6c){if(_0x219e6c){return _0x219e6c[_0x9cbf('0x6f')](_0x43b34d[_0x9cbf('0x32')][_0x9cbf('0x52')],_[_0x9cbf('0x70')](_0x43b34d['body'],[_0x9cbf('0x52'),'id'])||{})['spread'](function(_0x5d0bdf){for(var _0x4954bb=0x0;_0x4954bb<_0x43b34d['body'][_0x9cbf('0x52')][_0x9cbf('0x2c')];_0x4954bb+=0x1){socket[_0x9cbf('0x5a')](_0x9cbf('0x5b'),{'UserId':Number(_0x43b34d[_0x9cbf('0x32')][_0x9cbf('0x52')][_0x4954bb]),'ChatQueueId':Number(_0x43b34d['params']['id'])});}return _0x5d0bdf;});}})[_0x9cbf('0x15')](respondWithResult(_0x610cb3,null))[_0x9cbf('0x25')](handleError(_0x610cb3,null));};exports[_0x9cbf('0x71')]=function(_0x3f50c6,_0x35d221){return db[_0x9cbf('0x1f')][_0x9cbf('0x30')]({'where':{'id':_0x3f50c6['params']['id']}})[_0x9cbf('0x15')](handleEntityNotFound(_0x35d221,null))[_0x9cbf('0x15')](function(_0x3e6c68){if(_0x3e6c68){return _0x3e6c68[_0x9cbf('0x71')](_0x3f50c6[_0x9cbf('0x28')]['ids'])[_0x9cbf('0x15')](function(){if(_['isArray'](_0x3f50c6['query'][_0x9cbf('0x52')])){for(var _0x513420=0x0;_0x513420<_0x3f50c6[_0x9cbf('0x28')][_0x9cbf('0x52')][_0x9cbf('0x2c')];_0x513420+=0x1){socket[_0x9cbf('0x5a')](_0x9cbf('0x6e'),{'UserId':Number(_0x3f50c6[_0x9cbf('0x28')][_0x9cbf('0x52')][_0x513420]),'ChatQueueId':Number(_0x3f50c6[_0x9cbf('0x39')]['id'])});}}else{socket['emit'](_0x9cbf('0x6e'),{'UserId':Number(_0x3f50c6[_0x9cbf('0x28')]['ids']),'ChatQueueId':Number(_0x3f50c6[_0x9cbf('0x39')]['id'])});}});}})[_0x9cbf('0x15')](respondWithStatusCode(_0x35d221,null))[_0x9cbf('0x25')](handleError(_0x35d221,null));};exports[_0x9cbf('0x72')]=function(_0x12f5fb,_0x323ea0){var _0x43dd6a={};var _0x1707b5={};var _0x20d734;var _0x13fccc;return db[_0x9cbf('0x1f')][_0x9cbf('0x3c')]({'where':{'id':_0x12f5fb[_0x9cbf('0x39')]['id']}})['then'](handleEntityNotFound(_0x323ea0,null))[_0x9cbf('0x15')](function(_0x1d3e2f){if(_0x1d3e2f){_0x20d734=_0x1d3e2f;_0x1707b5[_0x9cbf('0x26')]=_[_0x9cbf('0x27')](db[_0x9cbf('0x47')]['rawAttributes']);_0x1707b5[_0x9cbf('0x28')]=_[_0x9cbf('0x27')](_0x12f5fb[_0x9cbf('0x28')]);_0x1707b5[_0x9cbf('0x3f')]=_['intersection'](_0x1707b5[_0x9cbf('0x26')],_0x1707b5['query']);_0x43dd6a[_0x9cbf('0x2a')]=_[_0x9cbf('0x29')](_0x1707b5[_0x9cbf('0x26')],qs[_0x9cbf('0x2b')](_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x2b')]));_0x43dd6a[_0x9cbf('0x2a')]=_0x43dd6a['attributes'][_0x9cbf('0x2c')]?_0x43dd6a[_0x9cbf('0x2a')]:_0x1707b5[_0x9cbf('0x26')];_0x43dd6a[_0x9cbf('0x41')]=qs['sort'](_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x42')]);_0x43dd6a[_0x9cbf('0x22')]=qs['filters'](_[_0x9cbf('0x43')](_0x12f5fb[_0x9cbf('0x28')],_0x1707b5['filters']));if(_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x45')]){_0x43dd6a['where']=_[_0x9cbf('0x2e')](_0x43dd6a[_0x9cbf('0x22')],{'$or':_[_0x9cbf('0x46')](_0x43dd6a[_0x9cbf('0x2a')],function(_0x955f43){var _0x5990e6={};_0x5990e6[_0x955f43]={'$like':'%'+_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x45')]+'%'};return _0x5990e6;})});}_0x43dd6a=_[_0x9cbf('0x2e')]({},_0x43dd6a,_0x12f5fb[_0x9cbf('0x2f')]);return _0x20d734['getAgents'](_0x43dd6a);}})['then'](function(_0x241327){if(_0x241327){_0x13fccc=_0x241327[_0x9cbf('0x2c')];if(!_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x40')](_0x9cbf('0x73'))){_0x43dd6a[_0x9cbf('0x10')]=qs[_0x9cbf('0x10')](_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0x10')]);_0x43dd6a['offset']=qs[_0x9cbf('0xe')](_0x12f5fb[_0x9cbf('0x28')][_0x9cbf('0xe')]);}return _0x20d734[_0x9cbf('0x72')](_0x43dd6a);}})['then'](function(_0x21e4d7){if(_0x21e4d7){return _0x21e4d7?{'count':_0x13fccc,'rows':_0x21e4d7}:null;}})[_0x9cbf('0x15')](respondWithResult(_0x323ea0,null))[_0x9cbf('0x25')](handleError(_0x323ea0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 69bc35e..cff7bf5 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 _0x82f0=['ChatQueue','save','update','emit','exports','events','../../mysqldb'];(function(_0x2b0649,_0x233956){var _0x131ab9=function(_0x42c09f){while(--_0x42c09f){_0x2b0649['push'](_0x2b0649['shift']());}};_0x131ab9(++_0x233956);}(_0x82f0,0xc9));var _0x082f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x82f0[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x082f('0x0'));var ChatQueue=require(_0x082f('0x1'))['db'][_0x082f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x082f('0x3'),'afterUpdate':_0x082f('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc15ea5){return function(_0x18593a,_0x5bfe40,_0x43414e){ChatQueueEvents[_0x082f('0x5')](_0xc15ea5+':'+_0x18593a['id'],_0x18593a);ChatQueueEvents['emit'](_0xc15ea5,_0x18593a);_0x43414e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x082f('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xfd2f=['exports','events','../../mysqldb','ChatQueue','save','remove','hook'];(function(_0x565fc6,_0x4ad48f){var _0x2fa55a=function(_0x41bdd9){while(--_0x41bdd9){_0x565fc6['push'](_0x565fc6['shift']());}};_0x2fa55a(++_0x4ad48f);}(_0xfd2f,0x14a));var _0xffd2=function(_0x35df33,_0x513c52){_0x35df33=_0x35df33-0x0;var _0x5077fd=_0xfd2f[_0x35df33];return _0x5077fd;};'use strict';var EventEmitter=require(_0xffd2('0x0'));var ChatQueue=require(_0xffd2('0x1'))['db'][_0xffd2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xffd2('0x3'),'afterUpdate':'update','afterDestroy':_0xffd2('0x4')};function emitEvent(_0x407d4b){return function(_0x492c33,_0x983987,_0x22c424){ChatQueueEvents['emit'](_0x407d4b+':'+_0x492c33['id'],_0x492c33);ChatQueueEvents['emit'](_0x407d4b,_0x492c33);_0x22c424(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xffd2('0x5')](e,emitEvent(event));}}module[_0xffd2('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 d49dc95..ddd3f89 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 _0xdd6a=['chat_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x526fdd,_0x48a18e){var _0x5f0d48=function(_0x783b8d){while(--_0x783b8d){_0x526fdd['push'](_0x526fdd['shift']());}};_0x5f0d48(++_0x48a18e);}(_0xdd6a,0x169));var _0xadd6=function(_0x723288,_0x361804){_0x723288=_0x723288-0x0;var _0x45fecf=_0xdd6a[_0x723288];return _0x45fecf;};'use strict';var _=require(_0xadd6('0x0'));var util=require('util');var logger=require(_0xadd6('0x1'))(_0xadd6('0x2'));var moment=require(_0xadd6('0x3'));var BPromise=require(_0xadd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadd6('0x5'));var rimraf=require('rimraf');var config=require(_0xadd6('0x6'));var attributes=require(_0xadd6('0x7'));module[_0xadd6('0x8')]=function(_0x266dce,_0x51f135){return _0x266dce['define']('ChatQueue',attributes,{'tableName':_0xadd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x981a=['moment','bluebird','request-promise','path','./chatQueue.attributes','define','ChatQueue','lodash','api'];(function(_0x10b44f,_0x12b994){var _0x3b0325=function(_0x3f33c7){while(--_0x3f33c7){_0x10b44f['push'](_0x10b44f['shift']());}};_0x3b0325(++_0x12b994);}(_0x981a,0x1db));var _0xa981=function(_0x11406e,_0x681277){_0x11406e=_0x11406e-0x0;var _0x3ee71c=_0x981a[_0x11406e];return _0x3ee71c;};'use strict';var _=require(_0xa981('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa981('0x1'));var moment=require(_0xa981('0x2'));var BPromise=require(_0xa981('0x3'));var rp=require(_0xa981('0x4'));var fs=require('fs');var path=require(_0xa981('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa981('0x6'));module['exports']=function(_0xf15e6,_0xfccc60){return _0xf15e6[_0xa981('0x7')](_0xa981('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 3c957e7..9ba575e 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 _0x153c=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ChatQueue','findAll','options','raw','where','include','map','model','attributes','GetChatQueue','debug','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x41bc22,_0x18f647){var _0x56b23c=function(_0x321e62){while(--_0x321e62){_0x41bc22['push'](_0x41bc22['shift']());}};_0x56b23c(++_0x18f647);}(_0x153c,0x8c));var _0xc153=function(_0x1f8a6e,_0x5bb5d0){_0x1f8a6e=_0x1f8a6e-0x0;var _0x389dd8=_0x153c[_0x1f8a6e];return _0x389dd8;};'use strict';var _=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var moment=require(_0xc153('0x2'));var BPromise=require(_0xc153('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc153('0x4'));var db=require(_0xc153('0x5'))['db'];var utils=require(_0xc153('0x6'));var logger=require(_0xc153('0x7'))(_0xc153('0x8'));var config=require(_0xc153('0x9'));var jayson=require(_0xc153('0xa'));var client=jayson['client'][_0xc153('0xb')]({'port':0x232a});config[_0xc153('0xc')]=_[_0xc153('0xd')](config[_0xc153('0xc')],{'host':_0xc153('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0xc153('0xf')](socket);function respondWithRpcPromise(_0x3566e3,_0x12ecca,_0x4040b3){return new BPromise(function(_0x1d706e,_0x5367d7){return client['request'](_0x3566e3,_0x4040b3)[_0xc153('0x10')](function(_0x44905b){logger['info'](_0xc153('0x11'),_0x12ecca,_0xc153('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x12ecca,_0xc153('0x12'),JSON[_0xc153('0x13')](_0x44905b));if(_0x44905b[_0xc153('0x14')]){if(_0x44905b['error'][_0xc153('0x15')]===0x1f4){logger[_0xc153('0x14')](_0xc153('0x11'),_0x12ecca,_0x44905b['error'][_0xc153('0x16')]);return _0x5367d7(_0x44905b[_0xc153('0x14')]['message']);}logger['error'](_0xc153('0x11'),_0x12ecca,_0x44905b[_0xc153('0x14')][_0xc153('0x16')]);return _0x1d706e(_0x44905b[_0xc153('0x14')][_0xc153('0x16')]);}else{logger[_0xc153('0x17')](_0xc153('0x11'),_0x12ecca,_0xc153('0x12'));_0x1d706e(_0x44905b['result'][_0xc153('0x16')]);}})[_0xc153('0x18')](function(_0x19fc4e){logger['error'](_0xc153('0x11'),_0x12ecca,_0x19fc4e);_0x5367d7(_0x19fc4e);});});}exports['GetChatQueue']=function(_0x596131){var _0x2198ff=this;return new Promise(function(_0x285e71,_0x2954d){return db[_0xc153('0x19')][_0xc153('0x1a')]({'raw':_0x596131[_0xc153('0x1b')]?_0x596131['options'][_0xc153('0x1c')]===undefined?!![]:![]:!![],'where':_0x596131['options']?_0x596131[_0xc153('0x1b')][_0xc153('0x1d')]||null:null,'attributes':_0x596131[_0xc153('0x1b')]?_0x596131[_0xc153('0x1b')]['attributes']||null:null,'limit':_0x596131['options']?_0x596131[_0xc153('0x1b')]['limit']||null:null,'include':_0x596131[_0xc153('0x1b')]?_0x596131[_0xc153('0x1b')][_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x596131['options'][_0xc153('0x1e')],function(_0x39bbdb){return{'model':db[_0x39bbdb[_0xc153('0x20')]],'as':_0x39bbdb['as'],'attributes':_0x39bbdb[_0xc153('0x21')],'include':_0x39bbdb[_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x39bbdb['include'],function(_0x319405){return{'model':db[_0x319405['model']],'as':_0x319405['as'],'attributes':_0x319405[_0xc153('0x21')],'include':_0x319405[_0xc153('0x1e')]?_['map'](_0x319405[_0xc153('0x1e')],function(_0x38033f){return{'model':db[_0x38033f['model']],'as':_0x38033f['as'],'attributes':_0x38033f[_0xc153('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc153('0x10')](function(_0x27315f){logger['info'](_0xc153('0x22'),_0x596131);logger[_0xc153('0x23')](_0xc153('0x22'),_0x596131,JSON['stringify'](_0x27315f));_0x285e71(_0x27315f);})[_0xc153('0x18')](function(_0x136524){logger[_0xc153('0x14')](_0xc153('0x22'),_0x136524['message'],_0x596131);_0x2954d(_0x2198ff[_0xc153('0x14')](0x1f4,_0x136524['message']));});});};exports[_0xc153('0x24')]=function(_0x5c1741){var _0x3be25b=this;return new Promise(function(_0x23a5be,_0x4f2e7c){return db[_0xc153('0x19')]['find']({'raw':_0x5c1741['options']?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c1741[_0xc153('0x1b')]?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1d')]||null:null,'attributes':_0x5c1741['options']?_0x5c1741[_0xc153('0x1b')][_0xc153('0x21')]||null:null,'include':_0x5c1741[_0xc153('0x1b')]?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x5c1741[_0xc153('0x1b')][_0xc153('0x1e')],function(_0x3b57a7){return{'model':db[_0x3b57a7[_0xc153('0x20')]],'as':_0x3b57a7['as'],'attributes':_0x3b57a7['attributes'],'include':_0x3b57a7['include']?_[_0xc153('0x1f')](_0x3b57a7['include'],function(_0x3e1de5){return{'model':db[_0x3e1de5[_0xc153('0x20')]],'as':_0x3e1de5['as'],'attributes':_0x3e1de5[_0xc153('0x21')],'include':_0x3e1de5['include']?_[_0xc153('0x1f')](_0x3e1de5[_0xc153('0x1e')],function(_0x1c1d4d){return{'model':db[_0x1c1d4d[_0xc153('0x20')]],'as':_0x1c1d4d['as'],'attributes':_0x1c1d4d[_0xc153('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc153('0x10')](function(_0x412455){logger[_0xc153('0x17')]('ShowChatQueue',_0x5c1741);logger['debug'](_0xc153('0x24'),_0x5c1741,JSON[_0xc153('0x13')](_0x412455));_0x23a5be(_0x412455);})[_0xc153('0x18')](function(_0x447c3c){logger[_0xc153('0x14')](_0xc153('0x24'),_0x447c3c['message'],_0x5c1741);_0x4f2e7c(_0x3be25b[_0xc153('0x14')](0x1f4,_0x447c3c[_0xc153('0x16')]));});});}; \ No newline at end of file +var _0x6b20=['message','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','include','model','map','then','ShowChatQueue','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x6b20,0xd1));var _0x06b2=function(_0xe396bc,_0x477b9d){_0xe396bc=_0xe396bc-0x0;var _0x31f195=_0x6b20[_0xe396bc];return _0x31f195;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});config[_0x06b2('0xb')]=_[_0x06b2('0xc')](config['redis'],{'host':_0x06b2('0xd'),'port':0x18eb});var socket=require(_0x06b2('0xe'))(new Redis(config[_0x06b2('0xb')]));require('./chatQueue.socket')[_0x06b2('0xf')](socket);function respondWithRpcPromise(_0x57f854,_0x2cc28f,_0x4da705){return new BPromise(function(_0x552cd8,_0x301519){return client[_0x06b2('0x10')](_0x57f854,_0x4da705)['then'](function(_0x182f8f){logger[_0x06b2('0x11')](_0x06b2('0x12'),_0x2cc28f,_0x06b2('0x13'));logger[_0x06b2('0x14')](_0x06b2('0x15'),_0x2cc28f,_0x06b2('0x13'),JSON[_0x06b2('0x16')](_0x182f8f));if(_0x182f8f[_0x06b2('0x17')]){if(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x18')]===0x1f4){logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f['error'][_0x06b2('0x19')]);return _0x301519(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f[_0x06b2('0x17')]['message']);return _0x552cd8(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}else{logger['info'](_0x06b2('0x12'),_0x2cc28f,'request\x20sent');_0x552cd8(_0x182f8f['result'][_0x06b2('0x19')]);}})[_0x06b2('0x1a')](function(_0x27852e){logger[_0x06b2('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2cc28f,_0x27852e);_0x301519(_0x27852e);});});}exports[_0x06b2('0x1b')]=function(_0x39b309){var _0x18f55b=this;return new Promise(function(_0x465325,_0xe28985){return db[_0x06b2('0x1c')][_0x06b2('0x1d')]({'raw':_0x39b309['options']?_0x39b309[_0x06b2('0x1e')][_0x06b2('0x1f')]===undefined?!![]:![]:!![],'where':_0x39b309[_0x06b2('0x1e')]?_0x39b309[_0x06b2('0x1e')]['where']||null:null,'attributes':_0x39b309['options']?_0x39b309[_0x06b2('0x1e')][_0x06b2('0x20')]||null:null,'limit':_0x39b309['options']?_0x39b309[_0x06b2('0x1e')]['limit']||null:null,'include':_0x39b309[_0x06b2('0x1e')]?_0x39b309[_0x06b2('0x1e')][_0x06b2('0x21')]?_['map'](_0x39b309[_0x06b2('0x1e')][_0x06b2('0x21')],function(_0xc65820){return{'model':db[_0xc65820[_0x06b2('0x22')]],'as':_0xc65820['as'],'attributes':_0xc65820[_0x06b2('0x20')],'include':_0xc65820['include']?_[_0x06b2('0x23')](_0xc65820[_0x06b2('0x21')],function(_0x40a73f){return{'model':db[_0x40a73f[_0x06b2('0x22')]],'as':_0x40a73f['as'],'attributes':_0x40a73f[_0x06b2('0x20')],'include':_0x40a73f[_0x06b2('0x21')]?_['map'](_0x40a73f[_0x06b2('0x21')],function(_0x2a3228){return{'model':db[_0x2a3228[_0x06b2('0x22')]],'as':_0x2a3228['as'],'attributes':_0x2a3228[_0x06b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x24')](function(_0x1bfaa9){logger[_0x06b2('0x11')]('GetChatQueue',_0x39b309);logger[_0x06b2('0x14')](_0x06b2('0x1b'),_0x39b309,JSON[_0x06b2('0x16')](_0x1bfaa9));_0x465325(_0x1bfaa9);})[_0x06b2('0x1a')](function(_0x1cc725){logger[_0x06b2('0x17')](_0x06b2('0x1b'),_0x1cc725[_0x06b2('0x19')],_0x39b309);_0xe28985(_0x18f55b['error'](0x1f4,_0x1cc725[_0x06b2('0x19')]));});});};exports[_0x06b2('0x25')]=function(_0x259e3d){var _0x438c16=this;return new Promise(function(_0x7a7cd7,_0x422393){return db[_0x06b2('0x1c')]['find']({'raw':_0x259e3d['options']?_0x259e3d[_0x06b2('0x1e')][_0x06b2('0x1f')]===undefined?!![]:![]:!![],'where':_0x259e3d[_0x06b2('0x1e')]?_0x259e3d['options'][_0x06b2('0x26')]||null:null,'attributes':_0x259e3d[_0x06b2('0x1e')]?_0x259e3d[_0x06b2('0x1e')][_0x06b2('0x20')]||null:null,'include':_0x259e3d[_0x06b2('0x1e')]?_0x259e3d[_0x06b2('0x1e')]['include']?_[_0x06b2('0x23')](_0x259e3d[_0x06b2('0x1e')][_0x06b2('0x21')],function(_0x4b9b83){return{'model':db[_0x4b9b83[_0x06b2('0x22')]],'as':_0x4b9b83['as'],'attributes':_0x4b9b83[_0x06b2('0x20')],'include':_0x4b9b83['include']?_[_0x06b2('0x23')](_0x4b9b83[_0x06b2('0x21')],function(_0x8d3648){return{'model':db[_0x8d3648[_0x06b2('0x22')]],'as':_0x8d3648['as'],'attributes':_0x8d3648[_0x06b2('0x20')],'include':_0x8d3648[_0x06b2('0x21')]?_[_0x06b2('0x23')](_0x8d3648[_0x06b2('0x21')],function(_0x22e77a){return{'model':db[_0x22e77a[_0x06b2('0x22')]],'as':_0x22e77a['as'],'attributes':_0x22e77a[_0x06b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x24')](function(_0x5ec05d){logger[_0x06b2('0x11')]('ShowChatQueue',_0x259e3d);logger['debug'](_0x06b2('0x25'),_0x259e3d,JSON['stringify'](_0x5ec05d));_0x7a7cd7(_0x5ec05d);})[_0x06b2('0x1a')](function(_0x5313a5){logger[_0x06b2('0x17')](_0x06b2('0x25'),_0x5313a5[_0x06b2('0x19')],_0x259e3d);_0x422393(_0x438c16[_0x06b2('0x17')](0x1f4,_0x5313a5[_0x06b2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 7d0ca4e..b1a9d96 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 _0xda55=['chatQueue:','./chatQueue.events','save','emit','removeListener','length'];(function(_0x5964d3,_0x41e285){var _0x41c5dd=function(_0x3dee3e){while(--_0x3dee3e){_0x5964d3['push'](_0x5964d3['shift']());}};_0x41c5dd(++_0x41e285);}(_0xda55,0x6d));var _0x5da5=function(_0x34ca5a,_0x2f14b1){_0x34ca5a=_0x34ca5a-0x0;var _0x38c2be=_0xda55[_0x34ca5a];return _0x38c2be;};'use strict';var ChatQueueEvents=require(_0x5da5('0x0'));var events=[_0x5da5('0x1'),'remove','update'];function createListener(_0x13ecbc,_0x240a49){return function(_0x26a443){_0x240a49[_0x5da5('0x2')](_0x13ecbc,_0x26a443);};}function removeListener(_0x1c3afd,_0x5da254){return function(){ChatQueueEvents[_0x5da5('0x3')](_0x1c3afd,_0x5da254);};}exports['register']=function(_0x356a37){for(var _0x58e7b3=0x0,_0x2fd877=events[_0x5da5('0x4')];_0x58e7b3<_0x2fd877;_0x58e7b3++){var _0x71b187=events[_0x58e7b3];var _0x46290d=createListener(_0x5da5('0x5')+_0x71b187,_0x356a37);ChatQueueEvents['on'](_0x71b187,_0x46290d);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x5828d0,_0x2c3e93){var _0x239b02=function(_0x702fe4){while(--_0x702fe4){_0x5828d0['push'](_0x5828d0['shift']());}};_0x239b02(++_0x2c3e93);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x19f7a5,_0x4b7eb3){_0x19f7a5=_0x19f7a5-0x0;var _0x172e23=_0x6f0d[_0x19f7a5];return _0x172e23;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e3fb326..d8195f8 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x571896,_0x2edf00){_0x571896=_0x571896-0x0;var _0x20a002=_0x3e74[_0x571896];return _0x20a002;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x380682,_0x5f5bb8){_0x380682=_0x380682-0x0;var _0x1800c2=_0x3e74[_0x380682];return _0x1800c2;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e4599d9..7e4af23 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 _0x100a=['moment','sequelize','exports','STRING','DATE'];(function(_0x20c88b,_0x1e45e1){var _0x1204db=function(_0x198dd9){while(--_0x198dd9){_0x20c88b['push'](_0x20c88b['shift']());}};_0x1204db(++_0x1e45e1);}(_0x100a,0x87));var _0xa100=function(_0x4d166c,_0x5a4732){_0x4d166c=_0x4d166c-0x0;var _0x4c68b2=_0x100a[_0x4d166c];return _0x4c68b2;};'use strict';var moment=require(_0xa100('0x0'));var Sequelize=require(_0xa100('0x1'));module[_0xa100('0x2')]={'uniqueid':{'type':Sequelize[_0xa100('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa100('0x3')]},'joinAt':{'type':Sequelize[_0xa100('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa100('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cf4=['STRING','DATE','moment'];(function(_0xc56144,_0x5d23ef){var _0x1252de=function(_0x2373c0){while(--_0x2373c0){_0xc56144['push'](_0xc56144['shift']());}};_0x1252de(++_0x5d23ef);}(_0x1cf4,0xbf));var _0x41cf=function(_0x3b3767,_0x22856b){_0x3b3767=_0x3b3767-0x0;var _0x2b3863=_0x1cf4[_0x3b3767];return _0x2b3863;};'use strict';var moment=require(_0x41cf('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x41cf('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x41cf('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x41cf('0x2')]},'acceptAt':{'type':Sequelize[_0x41cf('0x2')]},'exitAt':{'type':Sequelize[_0x41cf('0x2')]},'reason':{'type':Sequelize[_0x41cf('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8b31c4c..372651a 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 _0xd43e=['to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatQueueReport','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd43e,0x88));var _0xed43=function(_0x5b9168,_0x203c8a){_0x5b9168=_0x5b9168-0x0;var _0x1c8403=_0xd43e[_0x5b9168];return _0x1c8403;};'use strict';var emlformat=require(_0xed43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed43('0x1'));var jsonpatch=require(_0xed43('0x2'));var rp=require(_0xed43('0x3'));var moment=require(_0xed43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed43('0x5'));var path=require(_0xed43('0x6'));var sox=require(_0xed43('0x7'));var csv=require(_0xed43('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed43('0x9'));var _=require(_0xed43('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed43('0xb'));var toCsv=require(_0xed43('0x8'));var querystring=require(_0xed43('0xc'));var Papa=require(_0xed43('0xd'));var Redis=require(_0xed43('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed43('0xf'));var as=require(_0xed43('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed43('0x11'))(_0xed43('0x12'));var utils=require(_0xed43('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed43('0x14'))['db'];function respondWithStatusCode(_0x34027b,_0x4eed04){_0x4eed04=_0x4eed04||0xcc;return function(_0x1519aa){if(_0x1519aa){return _0x34027b[_0xed43('0x15')](_0x4eed04);}return _0x34027b[_0xed43('0x16')](_0x4eed04)[_0xed43('0x17')]();};}function respondWithResult(_0x2adbc5,_0x403a89){_0x403a89=_0x403a89||0xc8;return function(_0x597544){if(_0x597544){return _0x2adbc5[_0xed43('0x16')](_0x403a89)['json'](_0x597544);}};}function respondWithFilteredResult(_0x2ec9c3,_0x4a9621){return function(_0x2d457a){if(_0x2d457a){var _0x4caa03=typeof _0x4a9621['offset']===_0xed43('0x18')&&typeof _0x4a9621['limit']===_0xed43('0x18');var _0x1ada9c=_0x2d457a[_0xed43('0x19')];var _0x5f5093=_0x4caa03?0x0:_0x4a9621[_0xed43('0x1a')];var _0xa8a443=_0x4caa03?_0x2d457a['count']:_0x4a9621['offset']+_0x4a9621[_0xed43('0x1b')];var _0x46a875;if(_0xa8a443>=_0x1ada9c){_0xa8a443=_0x1ada9c;_0x46a875=0xc8;}else{_0x46a875=0xce;}_0x2ec9c3[_0xed43('0x16')](_0x46a875);return _0x2ec9c3['set'](_0xed43('0x1c'),_0x5f5093+'-'+_0xa8a443+'/'+_0x1ada9c)[_0xed43('0x1d')](_0x2d457a);}return null;};}function patchUpdates(_0x5bbd5c){return function(_0x3570ef){try{jsonpatch[_0xed43('0x1e')](_0x3570ef,_0x5bbd5c,!![]);}catch(_0x336ce7){return BPromise['reject'](_0x336ce7);}return _0x3570ef['save']();};}function saveUpdates(_0x2a6329,_0x42fb48){return function(_0x7f4c4c){if(_0x7f4c4c){return _0x7f4c4c[_0xed43('0x1f')](_0x2a6329)[_0xed43('0x20')](function(_0x45a24a){return _0x45a24a;});}return null;};}function removeEntity(_0x556440,_0x414c7a){return function(_0x30b5cf){if(_0x30b5cf){return _0x30b5cf[_0xed43('0x21')]()['then'](function(){_0x556440[_0xed43('0x16')](0xcc)[_0xed43('0x17')]();});}};}function handleEntityNotFound(_0x28a908,_0x90350a){return function(_0x549f91){if(!_0x549f91){_0x28a908[_0xed43('0x15')](0x194);}return _0x549f91;};}function handleError(_0x53f575,_0x3e7442){_0x3e7442=_0x3e7442||0x1f4;return function(_0xed8706){logger[_0xed43('0x22')](_0xed8706[_0xed43('0x23')]);if(_0xed8706['name']){delete _0xed8706[_0xed43('0x24')];}_0x53f575['status'](_0x3e7442)['send'](_0xed8706);};}exports[_0xed43('0x25')]=function(_0x51f128,_0x587d85){var _0x1b2f66={},_0x139750={},_0x325ab5={'count':0x0,'rows':[]};var _0x1f1207=_[_0xed43('0x26')](db['ChatQueueReport'][_0xed43('0x27')],function(_0x32c395){return{'name':_0x32c395[_0xed43('0x28')],'type':_0x32c395[_0xed43('0x29')][_0xed43('0x2a')]};});_0x139750['model']=_[_0xed43('0x26')](_0x1f1207,_0xed43('0x24'));_0x139750[_0xed43('0x2b')]=_['keys'](_0x51f128[_0xed43('0x2b')]);_0x139750[_0xed43('0x2c')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],_0x139750[_0xed43('0x2b')]);_0x1b2f66[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],qs['fields'](_0x51f128['query'][_0xed43('0x30')]));_0x1b2f66['attributes']=_0x1b2f66[_0xed43('0x2f')][_0xed43('0x31')]?_0x1b2f66['attributes']:_0x139750[_0xed43('0x2e')];if(!_0x51f128[_0xed43('0x2b')][_0xed43('0x32')](_0xed43('0x33'))){_0x1b2f66[_0xed43('0x1b')]=qs[_0xed43('0x1b')](_0x51f128[_0xed43('0x2b')][_0xed43('0x1b')]);_0x1b2f66['offset']=qs['offset'](_0x51f128[_0xed43('0x2b')][_0xed43('0x1a')]);}_0x1b2f66[_0xed43('0x34')]=qs[_0xed43('0x35')](_0x51f128[_0xed43('0x2b')]['sort']);_0x1b2f66[_0xed43('0x36')]=qs['filters'](_[_0xed43('0x37')](_0x51f128[_0xed43('0x2b')],_0x139750[_0xed43('0x2c')]),_0x1f1207);if(_0x51f128['query'][_0xed43('0x38')]){_0x1b2f66[_0xed43('0x36')]=_['merge'](_0x1b2f66[_0xed43('0x36')],{'$or':_[_0xed43('0x26')](_0x1f1207,function(_0x5bf247){if(_0x5bf247[_0xed43('0x29')]!=='VIRTUAL'){var _0x16c207={};_0x16c207[_0x5bf247[_0xed43('0x24')]]={'$like':'%'+_0x51f128['query'][_0xed43('0x38')]+'%'};return _0x16c207;}})});}_0x1b2f66=_[_0xed43('0x39')]({},_0x1b2f66,_0x51f128[_0xed43('0x3a')]);var _0x4a6ff6={'where':_0x1b2f66[_0xed43('0x36')]};return db[_0xed43('0x3b')][_0xed43('0x19')](_0x4a6ff6)[_0xed43('0x20')](function(_0xa6a7c3){_0x325ab5[_0xed43('0x19')]=_0xa6a7c3;if(_0x51f128['query'][_0xed43('0x3c')]){_0x1b2f66['include']=[{'all':!![]}];}return db[_0xed43('0x3b')][_0xed43('0x3d')](_0x1b2f66);})[_0xed43('0x20')](function(_0x2a9a15){_0x325ab5[_0xed43('0x3e')]=_0x2a9a15;return _0x325ab5;})[_0xed43('0x20')](respondWithFilteredResult(_0x587d85,_0x1b2f66))[_0xed43('0x3f')](handleError(_0x587d85,null));};exports[_0xed43('0x40')]=function(_0x19d7de,_0x32ddec){var _0x3ec9c0={'raw':!![],'where':{'id':_0x19d7de[_0xed43('0x41')]['id']}},_0x57ac6b={};_0x57ac6b[_0xed43('0x2e')]=_[_0xed43('0x42')](db['ChatQueueReport'][_0xed43('0x27')]);_0x57ac6b[_0xed43('0x2b')]=_[_0xed43('0x42')](_0x19d7de['query']);_0x57ac6b[_0xed43('0x2c')]=_['intersection'](_0x57ac6b['model'],_0x57ac6b[_0xed43('0x2b')]);_0x3ec9c0[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x57ac6b[_0xed43('0x2e')],qs['fields'](_0x19d7de[_0xed43('0x2b')][_0xed43('0x30')]));_0x3ec9c0['attributes']=_0x3ec9c0['attributes'][_0xed43('0x31')]?_0x3ec9c0['attributes']:_0x57ac6b[_0xed43('0x2e')];if(_0x19d7de['query'][_0xed43('0x3c')]){_0x3ec9c0[_0xed43('0x43')]=[{'all':!![]}];}_0x3ec9c0=_[_0xed43('0x39')]({},_0x3ec9c0,_0x19d7de[_0xed43('0x3a')]);return db[_0xed43('0x3b')][_0xed43('0x44')](_0x3ec9c0)['then'](handleEntityNotFound(_0x32ddec,null))[_0xed43('0x20')](respondWithResult(_0x32ddec,null))[_0xed43('0x3f')](handleError(_0x32ddec,null));};exports[_0xed43('0x45')]=function(_0x2ff4cf,_0x298662){return db[_0xed43('0x3b')]['create'](_0x2ff4cf[_0xed43('0x46')],{})[_0xed43('0x20')](respondWithResult(_0x298662,0xc9))[_0xed43('0x3f')](handleError(_0x298662,null));};exports[_0xed43('0x1f')]=function(_0x567327,_0xeda46e){if(_0x567327[_0xed43('0x46')]['id']){delete _0x567327['body']['id'];}return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x567327[_0xed43('0x41')]['id']}})[_0xed43('0x20')](handleEntityNotFound(_0xeda46e,null))[_0xed43('0x20')](saveUpdates(_0x567327[_0xed43('0x46')],null))[_0xed43('0x20')](respondWithResult(_0xeda46e,null))[_0xed43('0x3f')](handleError(_0xeda46e,null));};exports[_0xed43('0x21')]=function(_0x5f1968,_0x47cb1e){return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x5f1968[_0xed43('0x41')]['id']}})['then'](handleEntityNotFound(_0x47cb1e,null))['then'](removeEntity(_0x47cb1e,null))[_0xed43('0x3f')](handleError(_0x47cb1e,null));};exports[_0xed43('0x47')]=function(_0x399b30,_0x31846d){return db[_0xed43('0x3b')][_0xed43('0x47')]()[_0xed43('0x20')](respondWithResult(_0x31846d,null))[_0xed43('0x3f')](handleError(_0x31846d,null));}; \ No newline at end of file +var _0x6c14=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1a1bf9,_0x30ded7){var _0x55e193=function(_0xbe5ee5){while(--_0xbe5ee5){_0x1a1bf9['push'](_0x1a1bf9['shift']());}};_0x55e193(++_0x30ded7);}(_0x6c14,0xd1));var _0x46c1=function(_0x263257,_0x30d269){_0x263257=_0x263257-0x0;var _0x32516d=_0x6c14[_0x263257];return _0x32516d;};'use strict';var emlformat=require(_0x46c1('0x0'));var rimraf=require(_0x46c1('0x1'));var zipdir=require(_0x46c1('0x2'));var jsonpatch=require(_0x46c1('0x3'));var rp=require(_0x46c1('0x4'));var moment=require('moment');var BPromise=require(_0x46c1('0x5'));var Mustache=require(_0x46c1('0x6'));var util=require(_0x46c1('0x7'));var path=require('path');var sox=require(_0x46c1('0x8'));var csv=require(_0x46c1('0x9'));var ejs=require(_0x46c1('0xa'));var fs=require('fs');var fs_extra=require(_0x46c1('0xb'));var _=require(_0x46c1('0xc'));var squel=require(_0x46c1('0xd'));var crypto=require(_0x46c1('0xe'));var jsforce=require(_0x46c1('0xf'));var deskjs=require(_0x46c1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x46c1('0x11'));var Papa=require(_0x46c1('0x12'));var Redis=require(_0x46c1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x46c1('0x14'));var as=require(_0x46c1('0x15'));var hardwareService=require(_0x46c1('0x16'));var logger=require('../../config/logger')(_0x46c1('0x17'));var utils=require(_0x46c1('0x18'));var config=require(_0x46c1('0x19'));var licenseUtil=require(_0x46c1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c8a7c,_0x24626f){_0x24626f=_0x24626f||0xcc;return function(_0x52af54){if(_0x52af54){return _0x2c8a7c['sendStatus'](_0x24626f);}return _0x2c8a7c[_0x46c1('0x1b')](_0x24626f)[_0x46c1('0x1c')]();};}function respondWithResult(_0xa10462,_0x228380){_0x228380=_0x228380||0xc8;return function(_0x12437d){if(_0x12437d){return _0xa10462['status'](_0x228380)[_0x46c1('0x1d')](_0x12437d);}};}function respondWithFilteredResult(_0x3033a6,_0x221905){return function(_0x414a3f){if(_0x414a3f){var _0x3ce709=typeof _0x221905['offset']==='undefined'&&typeof _0x221905[_0x46c1('0x1e')]===_0x46c1('0x1f');var _0xad4a1b=_0x414a3f[_0x46c1('0x20')];var _0x466899=_0x3ce709?0x0:_0x221905[_0x46c1('0x21')];var _0x2ec920=_0x3ce709?_0x414a3f['count']:_0x221905[_0x46c1('0x21')]+_0x221905[_0x46c1('0x1e')];var _0x537a9d;if(_0x2ec920>=_0xad4a1b){_0x2ec920=_0xad4a1b;_0x537a9d=0xc8;}else{_0x537a9d=0xce;}_0x3033a6['status'](_0x537a9d);return _0x3033a6[_0x46c1('0x22')]('Content-Range',_0x466899+'-'+_0x2ec920+'/'+_0xad4a1b)['json'](_0x414a3f);}return null;};}function patchUpdates(_0x301c0c){return function(_0xfc1f36){try{jsonpatch[_0x46c1('0x23')](_0xfc1f36,_0x301c0c,!![]);}catch(_0x261c6d){return BPromise[_0x46c1('0x24')](_0x261c6d);}return _0xfc1f36[_0x46c1('0x25')]();};}function saveUpdates(_0x3768e9,_0x21e02d){return function(_0x3db7b1){if(_0x3db7b1){return _0x3db7b1[_0x46c1('0x26')](_0x3768e9)[_0x46c1('0x27')](function(_0x217c2c){return _0x217c2c;});}return null;};}function removeEntity(_0x12ce45,_0x712eb8){return function(_0x37fa8c){if(_0x37fa8c){return _0x37fa8c[_0x46c1('0x28')]()[_0x46c1('0x27')](function(){_0x12ce45[_0x46c1('0x1b')](0xcc)[_0x46c1('0x1c')]();});}};}function handleEntityNotFound(_0x361c66,_0x4209e6){return function(_0x2924b8){if(!_0x2924b8){_0x361c66[_0x46c1('0x29')](0x194);}return _0x2924b8;};}function handleError(_0x552932,_0x4aacea){_0x4aacea=_0x4aacea||0x1f4;return function(_0xa8b66e){logger[_0x46c1('0x2a')](_0xa8b66e['stack']);if(_0xa8b66e[_0x46c1('0x2b')]){delete _0xa8b66e[_0x46c1('0x2b')];}_0x552932[_0x46c1('0x1b')](_0x4aacea)[_0x46c1('0x2c')](_0xa8b66e);};}exports[_0x46c1('0x2d')]=function(_0x3fdaea,_0x4d646d){var _0x114048={},_0x4475f7={},_0x32f553={'count':0x0,'rows':[]};var _0x187ecf=_[_0x46c1('0x2e')](db[_0x46c1('0x2f')][_0x46c1('0x30')],function(_0x55b4e6){return{'name':_0x55b4e6[_0x46c1('0x31')],'type':_0x55b4e6['type'][_0x46c1('0x32')]};});_0x4475f7[_0x46c1('0x33')]=_[_0x46c1('0x2e')](_0x187ecf,_0x46c1('0x2b'));_0x4475f7['query']=_['keys'](_0x3fdaea[_0x46c1('0x34')]);_0x4475f7[_0x46c1('0x35')]=_['intersection'](_0x4475f7[_0x46c1('0x33')],_0x4475f7[_0x46c1('0x34')]);_0x114048[_0x46c1('0x36')]=_[_0x46c1('0x37')](_0x4475f7['model'],qs[_0x46c1('0x38')](_0x3fdaea[_0x46c1('0x34')]['fields']));_0x114048[_0x46c1('0x36')]=_0x114048['attributes'][_0x46c1('0x39')]?_0x114048[_0x46c1('0x36')]:_0x4475f7[_0x46c1('0x33')];if(!_0x3fdaea[_0x46c1('0x34')][_0x46c1('0x3a')](_0x46c1('0x3b'))){_0x114048['limit']=qs['limit'](_0x3fdaea[_0x46c1('0x34')]['limit']);_0x114048[_0x46c1('0x21')]=qs['offset'](_0x3fdaea['query'][_0x46c1('0x21')]);}_0x114048[_0x46c1('0x3c')]=qs[_0x46c1('0x3d')](_0x3fdaea['query'][_0x46c1('0x3d')]);_0x114048[_0x46c1('0x3e')]=qs[_0x46c1('0x35')](_['pick'](_0x3fdaea[_0x46c1('0x34')],_0x4475f7[_0x46c1('0x35')]),_0x187ecf);if(_0x3fdaea[_0x46c1('0x34')][_0x46c1('0x3f')]){_0x114048[_0x46c1('0x3e')]=_[_0x46c1('0x40')](_0x114048[_0x46c1('0x3e')],{'$or':_[_0x46c1('0x2e')](_0x187ecf,function(_0x114ed3){if(_0x114ed3['type']!==_0x46c1('0x41')){var _0x3db8f1={};_0x3db8f1[_0x114ed3[_0x46c1('0x2b')]]={'$like':'%'+_0x3fdaea[_0x46c1('0x34')][_0x46c1('0x3f')]+'%'};return _0x3db8f1;}})});}_0x114048=_[_0x46c1('0x40')]({},_0x114048,_0x3fdaea['options']);var _0x102f12={'where':_0x114048['where']};return db[_0x46c1('0x2f')][_0x46c1('0x20')](_0x102f12)[_0x46c1('0x27')](function(_0x4c237b){_0x32f553[_0x46c1('0x20')]=_0x4c237b;if(_0x3fdaea['query'][_0x46c1('0x42')]){_0x114048[_0x46c1('0x43')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x114048);})[_0x46c1('0x27')](function(_0x520f5d){_0x32f553[_0x46c1('0x44')]=_0x520f5d;return _0x32f553;})[_0x46c1('0x27')](respondWithFilteredResult(_0x4d646d,_0x114048))[_0x46c1('0x45')](handleError(_0x4d646d,null));};exports['show']=function(_0x1228d8,_0x4571ed){var _0x5bc21c={'raw':!![],'where':{'id':_0x1228d8[_0x46c1('0x46')]['id']}},_0x171db5={};_0x171db5['model']=_['keys'](db[_0x46c1('0x2f')]['rawAttributes']);_0x171db5[_0x46c1('0x34')]=_[_0x46c1('0x47')](_0x1228d8[_0x46c1('0x34')]);_0x171db5[_0x46c1('0x35')]=_['intersection'](_0x171db5['model'],_0x171db5[_0x46c1('0x34')]);_0x5bc21c[_0x46c1('0x36')]=_[_0x46c1('0x37')](_0x171db5[_0x46c1('0x33')],qs['fields'](_0x1228d8[_0x46c1('0x34')]['fields']));_0x5bc21c['attributes']=_0x5bc21c[_0x46c1('0x36')][_0x46c1('0x39')]?_0x5bc21c['attributes']:_0x171db5[_0x46c1('0x33')];if(_0x1228d8[_0x46c1('0x34')][_0x46c1('0x42')]){_0x5bc21c[_0x46c1('0x43')]=[{'all':!![]}];}_0x5bc21c=_[_0x46c1('0x40')]({},_0x5bc21c,_0x1228d8[_0x46c1('0x48')]);return db['ChatQueueReport'][_0x46c1('0x49')](_0x5bc21c)[_0x46c1('0x27')](handleEntityNotFound(_0x4571ed,null))[_0x46c1('0x27')](respondWithResult(_0x4571ed,null))[_0x46c1('0x45')](handleError(_0x4571ed,null));};exports['create']=function(_0x362157,_0x3e3d7e){return db['ChatQueueReport'][_0x46c1('0x4a')](_0x362157[_0x46c1('0x4b')],{})['then'](respondWithResult(_0x3e3d7e,0xc9))['catch'](handleError(_0x3e3d7e,null));};exports[_0x46c1('0x26')]=function(_0x40aae9,_0x1911e7){if(_0x40aae9['body']['id']){delete _0x40aae9[_0x46c1('0x4b')]['id'];}return db[_0x46c1('0x2f')][_0x46c1('0x49')]({'where':{'id':_0x40aae9['params']['id']}})[_0x46c1('0x27')](handleEntityNotFound(_0x1911e7,null))[_0x46c1('0x27')](saveUpdates(_0x40aae9[_0x46c1('0x4b')],null))[_0x46c1('0x27')](respondWithResult(_0x1911e7,null))[_0x46c1('0x45')](handleError(_0x1911e7,null));};exports[_0x46c1('0x28')]=function(_0x39de88,_0x3194e6){return db[_0x46c1('0x2f')][_0x46c1('0x49')]({'where':{'id':_0x39de88[_0x46c1('0x46')]['id']}})[_0x46c1('0x27')](handleEntityNotFound(_0x3194e6,null))[_0x46c1('0x27')](removeEntity(_0x3194e6,null))[_0x46c1('0x45')](handleError(_0x3194e6,null));};exports[_0x46c1('0x4c')]=function(_0x359425,_0x2a53cb){return db['ChatQueueReport'][_0x46c1('0x4c')]()[_0x46c1('0x27')](respondWithResult(_0x2a53cb,null))[_0x46c1('0x45')](handleError(_0x2a53cb,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fd5a0e7..dd49790 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x10cc02,_0x9f88bd){var _0x18187a=function(_0x13d345){while(--_0x13d345){_0x10cc02['push'](_0x10cc02['shift']());}};_0x18187a(++_0x9f88bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xcb91[_0x151721];return _0x2deaa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'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(_0x2384bb,_0x12f81b){var _0x3f2bac=function(_0x337ece){while(--_0x337ece){_0x2384bb['push'](_0x2384bb['shift']());}};_0x3f2bac(++_0x12f81b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1045ef,_0xfea295){_0x1045ef=_0x1045ef-0x0;var _0x3e99f2=_0xb10b[_0x1045ef];return _0x3e99f2;};'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 50bfe57..aeb7f5f 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 _0x79ad=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','UpdateChatQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79ad,0x16e));var _0xd79a=function(_0x5d0792,_0x486759){_0x5d0792=_0x5d0792-0x0;var _0x2885a6=_0x79ad[_0x5d0792];return _0x2885a6;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd79a('0x1'));var rs=require(_0xd79a('0x2'));var fs=require('fs');var Redis=require(_0xd79a('0x3'));var db=require(_0xd79a('0x4'))['db'];var utils=require(_0xd79a('0x5'));var logger=require(_0xd79a('0x6'))(_0xd79a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd79a('0x8')][_0xd79a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3a5a,_0x273f8d,_0x12bf8c){return new BPromise(function(_0x263519,_0x2d3ec9){return client[_0xd79a('0xa')](_0x1d3a5a,_0x12bf8c)[_0xd79a('0xb')](function(_0x3080b0){logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));logger['debug'](_0xd79a('0xf'),_0x273f8d,_0xd79a('0xe'),JSON[_0xd79a('0x10')](_0x3080b0));if(_0x3080b0[_0xd79a('0x11')]){if(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x12')]===0x1f4){logger[_0xd79a('0x11')](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')]['message']);return _0x2d3ec9(_0x3080b0['error'][_0xd79a('0x13')]);}logger['error'](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);return _0x263519(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);}else{logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));_0x263519(_0x3080b0[_0xd79a('0x14')][_0xd79a('0x13')]);}})[_0xd79a('0x15')](function(_0x10f490){logger['error'](_0xd79a('0xd'),_0x273f8d,_0x10f490);_0x2d3ec9(_0x10f490);});});}exports[_0xd79a('0x16')]=function(_0x13a3e1){var _0x96a4b8=this;return new Promise(function(_0x41d296,_0x1a678b){return db[_0xd79a('0x17')][_0xd79a('0x18')](_0x13a3e1[_0xd79a('0x19')],{'raw':_0x13a3e1[_0xd79a('0x1a')]?_0x13a3e1[_0xd79a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd79a('0xb')](function(_0x558db5){logger['info']('CreateChatQueueReport',_0x13a3e1);logger[_0xd79a('0x1b')](_0xd79a('0x16'),_0x13a3e1,JSON[_0xd79a('0x10')](_0x558db5));_0x41d296(_0x558db5);})['catch'](function(_0x389520){logger[_0xd79a('0x11')](_0xd79a('0x16'),_0x389520[_0xd79a('0x13')],_0x13a3e1);_0x1a678b(_0x96a4b8['error'](0x1f4,_0x389520['message']));});});};exports['UpdateChatQueueReport']=function(_0x59d86b){var _0x170aa1=this;return new Promise(function(_0x5dcadd,_0x4dbc80){return db[_0xd79a('0x17')]['update'](_0x59d86b['body'],{'raw':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b[_0xd79a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d86b['options']?_0x59d86b['options']['where']||null:null,'attributes':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b[_0xd79a('0x1a')]['attributes']||null:null,'limit':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b['options']['limit']||null:null})[_0xd79a('0xb')](function(_0x5be5bd){logger[_0xd79a('0xc')]('UpdateChatQueueReport',_0x59d86b);logger[_0xd79a('0x1b')](_0xd79a('0x1c'),_0x59d86b,JSON[_0xd79a('0x10')](_0x5be5bd));_0x5dcadd(_0x5be5bd);})[_0xd79a('0x15')](function(_0x37d02c){logger[_0xd79a('0x11')]('UpdateChatQueueReport',_0x37d02c[_0xd79a('0x13')],_0x59d86b);_0x4dbc80(_0x170aa1[_0xd79a('0x11')](0x1f4,_0x37d02c[_0xd79a('0x13')]));});});}; \ No newline at end of file +var _0xdba6=['CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x637194,_0x430b89){var _0x330895=function(_0x2e0c24){while(--_0x2e0c24){_0x637194['push'](_0x637194['shift']());}};_0x330895(++_0x430b89);}(_0xdba6,0x169));var _0x6dba=function(_0x12c27a,_0x501e9a){_0x12c27a=_0x12c27a-0x0;var _0x2d5d1c=_0xdba6[_0x12c27a];return _0x2d5d1c;};'use strict';var _=require(_0x6dba('0x0'));var util=require(_0x6dba('0x1'));var moment=require(_0x6dba('0x2'));var BPromise=require(_0x6dba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6dba('0x4'));var db=require(_0x6dba('0x5'))['db'];var utils=require(_0x6dba('0x6'));var logger=require(_0x6dba('0x7'))(_0x6dba('0x8'));var config=require('../../config/environment');var jayson=require(_0x6dba('0x9'));var client=jayson[_0x6dba('0xa')][_0x6dba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfeb0,_0x975b58,_0x4bfecb){return new BPromise(function(_0x9c0e99,_0x198453){return client[_0x6dba('0xc')](_0x2bfeb0,_0x4bfecb)[_0x6dba('0xd')](function(_0x18cfb3){logger[_0x6dba('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x975b58,_0x6dba('0xf'));logger[_0x6dba('0x10')](_0x6dba('0x11'),_0x975b58,_0x6dba('0xf'),JSON['stringify'](_0x18cfb3));if(_0x18cfb3['error']){if(_0x18cfb3[_0x6dba('0x12')]['code']===0x1f4){logger[_0x6dba('0x12')](_0x6dba('0x13'),_0x975b58,_0x18cfb3[_0x6dba('0x12')][_0x6dba('0x14')]);return _0x198453(_0x18cfb3[_0x6dba('0x12')]['message']);}logger[_0x6dba('0x12')](_0x6dba('0x13'),_0x975b58,_0x18cfb3[_0x6dba('0x12')][_0x6dba('0x14')]);return _0x9c0e99(_0x18cfb3[_0x6dba('0x12')][_0x6dba('0x14')]);}else{logger[_0x6dba('0xe')](_0x6dba('0x13'),_0x975b58,_0x6dba('0xf'));_0x9c0e99(_0x18cfb3[_0x6dba('0x15')][_0x6dba('0x14')]);}})[_0x6dba('0x16')](function(_0x28d9a6){logger[_0x6dba('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x975b58,_0x28d9a6);_0x198453(_0x28d9a6);});});}exports[_0x6dba('0x17')]=function(_0x6a4787){var _0x40d0a2=this;return new Promise(function(_0x1da25c,_0x3e06a3){return db[_0x6dba('0x18')][_0x6dba('0x19')](_0x6a4787[_0x6dba('0x1a')],{'raw':_0x6a4787[_0x6dba('0x1b')]?_0x6a4787['options'][_0x6dba('0x1c')]===undefined?!![]:![]:!![]})[_0x6dba('0xd')](function(_0x278f39){logger[_0x6dba('0xe')](_0x6dba('0x17'),_0x6a4787);logger[_0x6dba('0x10')](_0x6dba('0x17'),_0x6a4787,JSON[_0x6dba('0x1d')](_0x278f39));_0x1da25c(_0x278f39);})[_0x6dba('0x16')](function(_0x1cb8cb){logger[_0x6dba('0x12')](_0x6dba('0x17'),_0x1cb8cb[_0x6dba('0x14')],_0x6a4787);_0x3e06a3(_0x40d0a2[_0x6dba('0x12')](0x1f4,_0x1cb8cb[_0x6dba('0x14')]));});});};exports[_0x6dba('0x1e')]=function(_0x247d46){var _0x1ae37c=this;return new Promise(function(_0x105a78,_0x10fabc){return db[_0x6dba('0x18')][_0x6dba('0x1f')](_0x247d46[_0x6dba('0x1a')],{'raw':_0x247d46['options']?_0x247d46['options'][_0x6dba('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x247d46[_0x6dba('0x1b')]?_0x247d46[_0x6dba('0x1b')]['where']||null:null,'attributes':_0x247d46[_0x6dba('0x1b')]?_0x247d46['options']['attributes']||null:null,'limit':_0x247d46[_0x6dba('0x1b')]?_0x247d46[_0x6dba('0x1b')]['limit']||null:null})[_0x6dba('0xd')](function(_0x2e803f){logger[_0x6dba('0xe')](_0x6dba('0x1e'),_0x247d46);logger[_0x6dba('0x10')](_0x6dba('0x1e'),_0x247d46,JSON[_0x6dba('0x1d')](_0x2e803f));_0x105a78(_0x2e803f);})[_0x6dba('0x16')](function(_0xb9339f){logger[_0x6dba('0x12')](_0x6dba('0x1e'),_0xb9339f[_0x6dba('0x14')],_0x247d46);_0x10fabc(_0x1ae37c[_0x6dba('0x12')](0x1f4,_0xb9339f[_0x6dba('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 19ca60c..4f889f1 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 _0x72ec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d18d1,_0x365c54){var _0x1409e9=function(_0x29defd){while(--_0x29defd){_0x3d18d1['push'](_0x3d18d1['shift']());}};_0x1409e9(++_0x365c54);}(_0x72ec,0x95));var _0xc72e=function(_0x70504d,_0x34e810){_0x70504d=_0x70504d-0x0;var _0x47e29b=_0x72ec[_0x70504d];return _0x47e29b;};'use strict';var multer=require(_0xc72e('0x0'));var util=require(_0xc72e('0x1'));var path=require(_0xc72e('0x2'));var timeout=require(_0xc72e('0x3'));var express=require(_0xc72e('0x4'));var router=express[_0xc72e('0x5')]();var fs_extra=require(_0xc72e('0x6'));var auth=require(_0xc72e('0x7'));var interaction=require(_0xc72e('0x8'));var config=require(_0xc72e('0x9'));var controller=require(_0xc72e('0xa'));router['get']('/',auth[_0xc72e('0xb')](),controller['index']);router[_0xc72e('0xc')](_0xc72e('0xd'),auth[_0xc72e('0xb')](),controller['describe']);router[_0xc72e('0xc')]('/:id',auth[_0xc72e('0xb')](),controller['show']);router[_0xc72e('0xe')]('/',auth[_0xc72e('0xb')](),controller[_0xc72e('0xf')]);router[_0xc72e('0x10')](_0xc72e('0x11'),auth[_0xc72e('0xb')](),controller[_0xc72e('0x12')]);router[_0xc72e('0x13')](_0xc72e('0x11'),auth[_0xc72e('0xb')](),controller[_0xc72e('0x14')]);module[_0xc72e('0x15')]=router; \ No newline at end of file +var _0x9881=['./chatQueueReport.controller','get','isAuthenticated','/describe','/:id','show','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9881,0xf4));var _0x1988=function(_0x3877f5,_0xeaac42){_0x3877f5=_0x3877f5-0x0;var _0x249e7f=_0x9881[_0x3877f5];return _0x249e7f;};'use strict';var multer=require(_0x1988('0x0'));var util=require('util');var path=require(_0x1988('0x1'));var timeout=require(_0x1988('0x2'));var express=require(_0x1988('0x3'));var router=express['Router']();var fs_extra=require(_0x1988('0x4'));var auth=require(_0x1988('0x5'));var interaction=require(_0x1988('0x6'));var config=require(_0x1988('0x7'));var controller=require(_0x1988('0x8'));router[_0x1988('0x9')]('/',auth[_0x1988('0xa')](),controller['index']);router[_0x1988('0x9')](_0x1988('0xb'),auth[_0x1988('0xa')](),controller['describe']);router[_0x1988('0x9')](_0x1988('0xc'),auth['isAuthenticated'](),controller[_0x1988('0xd')]);router['post']('/',auth[_0x1988('0xa')](),controller['create']);router[_0x1988('0xe')]('/:id',auth[_0x1988('0xa')](),controller[_0x1988('0xf')]);router['delete'](_0x1988('0xc'),auth[_0x1988('0xa')](),controller[_0x1988('0x10')]);module[_0x1988('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index af2341b..47a0fb7 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xaef372,_0xc57733){var _0x181170=function(_0x55b6db){while(--_0x55b6db){_0xaef372['push'](_0xaef372['shift']());}};_0x181170(++_0xc57733);}(_0xf4eb,0xec));var _0xbf4e=function(_0x307c62,_0x3e7463){_0x307c62=_0x307c62-0x0;var _0x2d4e20=_0xf4eb[_0x307c62];return _0x2d4e20;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x318966,_0x197359){_0x318966=_0x318966-0x0;var _0x159adb=_0x9bde[_0x318966];return _0x159adb;};'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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ae2492e..b3e6a7c 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 _0xd3d5=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','intersection','length','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','nolimit'];(function(_0x31d833,_0xda825a){var _0x16d362=function(_0x46cb6c){while(--_0x46cb6c){_0x31d833['push'](_0x31d833['shift']());}};_0x16d362(++_0xda825a);}(_0xd3d5,0xf6));var _0x5d3d=function(_0x274a6c,_0x1a7726){_0x274a6c=_0x274a6c-0x0;var _0x30a5cf=_0xd3d5[_0x274a6c];return _0x30a5cf;};'use strict';var emlformat=require(_0x5d3d('0x0'));var rimraf=require(_0x5d3d('0x1'));var zipdir=require(_0x5d3d('0x2'));var jsonpatch=require(_0x5d3d('0x3'));var rp=require(_0x5d3d('0x4'));var moment=require(_0x5d3d('0x5'));var BPromise=require(_0x5d3d('0x6'));var Mustache=require(_0x5d3d('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5d3d('0x8'));var ejs=require(_0x5d3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5d3d('0xa'));var crypto=require('crypto');var jsforce=require(_0x5d3d('0xb'));var deskjs=require(_0x5d3d('0xc'));var toCsv=require(_0x5d3d('0x8'));var querystring=require(_0x5d3d('0xd'));var Papa=require(_0x5d3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d3d('0xf'));var as=require(_0x5d3d('0x10'));var hardwareService=require(_0x5d3d('0x11'));var logger=require(_0x5d3d('0x12'))(_0x5d3d('0x13'));var utils=require(_0x5d3d('0x14'));var config=require(_0x5d3d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d3d('0x16'))['db'];function respondWithStatusCode(_0x1543f0,_0x50f004){_0x50f004=_0x50f004||0xcc;return function(_0x4b4103){if(_0x4b4103){return _0x1543f0[_0x5d3d('0x17')](_0x50f004);}return _0x1543f0[_0x5d3d('0x18')](_0x50f004)[_0x5d3d('0x19')]();};}function respondWithResult(_0x25b340,_0xdcca91){_0xdcca91=_0xdcca91||0xc8;return function(_0x1c51ba){if(_0x1c51ba){return _0x25b340[_0x5d3d('0x18')](_0xdcca91)[_0x5d3d('0x1a')](_0x1c51ba);}};}function respondWithFilteredResult(_0x5e9cd8,_0x212f8c){return function(_0x550be2){if(_0x550be2){var _0x43a47b=typeof _0x212f8c[_0x5d3d('0x1b')]===_0x5d3d('0x1c')&&typeof _0x212f8c[_0x5d3d('0x1d')]==='undefined';var _0x1ea164=_0x550be2[_0x5d3d('0x1e')];var _0x35317d=_0x43a47b?0x0:_0x212f8c['offset'];var _0x309990=_0x43a47b?_0x550be2[_0x5d3d('0x1e')]:_0x212f8c[_0x5d3d('0x1b')]+_0x212f8c[_0x5d3d('0x1d')];var _0x170d9b;if(_0x309990>=_0x1ea164){_0x309990=_0x1ea164;_0x170d9b=0xc8;}else{_0x170d9b=0xce;}_0x5e9cd8[_0x5d3d('0x18')](_0x170d9b);return _0x5e9cd8[_0x5d3d('0x1f')](_0x5d3d('0x20'),_0x35317d+'-'+_0x309990+'/'+_0x1ea164)[_0x5d3d('0x1a')](_0x550be2);}return null;};}function patchUpdates(_0x23de3f){return function(_0x4d9a11){try{jsonpatch[_0x5d3d('0x21')](_0x4d9a11,_0x23de3f,!![]);}catch(_0x435d11){return BPromise[_0x5d3d('0x22')](_0x435d11);}return _0x4d9a11[_0x5d3d('0x23')]();};}function saveUpdates(_0x4a083b,_0x421f4d){return function(_0x42db5c){if(_0x42db5c){return _0x42db5c[_0x5d3d('0x24')](_0x4a083b)[_0x5d3d('0x25')](function(_0x4325de){return _0x4325de;});}return null;};}function removeEntity(_0x326c82,_0x13b787){return function(_0x4cf820){if(_0x4cf820){return _0x4cf820[_0x5d3d('0x26')]()[_0x5d3d('0x25')](function(){_0x326c82[_0x5d3d('0x18')](0xcc)[_0x5d3d('0x19')]();});}};}function handleEntityNotFound(_0xd0ccbe,_0x3e4230){return function(_0xf2c7ef){if(!_0xf2c7ef){_0xd0ccbe[_0x5d3d('0x17')](0x194);}return _0xf2c7ef;};}function handleError(_0x4014da,_0x3c93f0){_0x3c93f0=_0x3c93f0||0x1f4;return function(_0x4a8a89){logger[_0x5d3d('0x27')](_0x4a8a89['stack']);if(_0x4a8a89[_0x5d3d('0x28')]){delete _0x4a8a89[_0x5d3d('0x28')];}_0x4014da['status'](_0x3c93f0)[_0x5d3d('0x29')](_0x4a8a89);};}exports['index']=function(_0xb819f5,_0x37e91a){var _0x5cdb58={},_0x7b346={},_0x1bc53b={'count':0x0,'rows':[]};var _0x5113a9=_['map'](db[_0x5d3d('0x2a')][_0x5d3d('0x2b')],function(_0x51afbe){return{'name':_0x51afbe[_0x5d3d('0x2c')],'type':_0x51afbe[_0x5d3d('0x2d')][_0x5d3d('0x2e')]};});_0x7b346[_0x5d3d('0x2f')]=_[_0x5d3d('0x30')](_0x5113a9,_0x5d3d('0x28'));_0x7b346[_0x5d3d('0x31')]=_['keys'](_0xb819f5[_0x5d3d('0x31')]);_0x7b346[_0x5d3d('0x32')]=_['intersection'](_0x7b346[_0x5d3d('0x2f')],_0x7b346[_0x5d3d('0x31')]);_0x5cdb58[_0x5d3d('0x33')]=_['intersection'](_0x7b346['model'],qs[_0x5d3d('0x34')](_0xb819f5['query'][_0x5d3d('0x34')]));_0x5cdb58[_0x5d3d('0x33')]=_0x5cdb58[_0x5d3d('0x33')]['length']?_0x5cdb58[_0x5d3d('0x33')]:_0x7b346[_0x5d3d('0x2f')];if(!_0xb819f5['query']['hasOwnProperty'](_0x5d3d('0x35'))){_0x5cdb58[_0x5d3d('0x1d')]=qs[_0x5d3d('0x1d')](_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x1d')]);_0x5cdb58[_0x5d3d('0x1b')]=qs[_0x5d3d('0x1b')](_0xb819f5['query'][_0x5d3d('0x1b')]);}_0x5cdb58[_0x5d3d('0x36')]=qs[_0x5d3d('0x37')](_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x37')]);_0x5cdb58[_0x5d3d('0x38')]=qs[_0x5d3d('0x32')](_[_0x5d3d('0x39')](_0xb819f5[_0x5d3d('0x31')],_0x7b346[_0x5d3d('0x32')]),_0x5113a9);if(_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x3a')]){_0x5cdb58['where']=_[_0x5d3d('0x3b')](_0x5cdb58['where'],{'$or':_[_0x5d3d('0x30')](_0x5113a9,function(_0x333fd4){if(_0x333fd4[_0x5d3d('0x2d')]!==_0x5d3d('0x3c')){var _0x5631a6={};_0x5631a6[_0x333fd4[_0x5d3d('0x28')]]={'$like':'%'+_0xb819f5['query'][_0x5d3d('0x3a')]+'%'};return _0x5631a6;}})});}_0x5cdb58=_[_0x5d3d('0x3b')]({},_0x5cdb58,_0xb819f5[_0x5d3d('0x3d')]);var _0x165590={'where':_0x5cdb58[_0x5d3d('0x38')]};return db[_0x5d3d('0x2a')][_0x5d3d('0x1e')](_0x165590)[_0x5d3d('0x25')](function(_0x117b76){_0x1bc53b['count']=_0x117b76;if(_0xb819f5['query'][_0x5d3d('0x3e')]){_0x5cdb58['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x5d3d('0x3f')](_0x5cdb58);})[_0x5d3d('0x25')](function(_0x157cc5){_0x1bc53b['rows']=_0x157cc5;return _0x1bc53b;})[_0x5d3d('0x25')](respondWithFilteredResult(_0x37e91a,_0x5cdb58))['catch'](handleError(_0x37e91a,null));};exports[_0x5d3d('0x40')]=function(_0x264d38,_0x5e94dd){var _0x42a610={'raw':!![],'where':{'id':_0x264d38[_0x5d3d('0x41')]['id']}},_0x269d3b={};_0x269d3b['model']=_[_0x5d3d('0x42')](db['ChatTransferReport'][_0x5d3d('0x2b')]);_0x269d3b[_0x5d3d('0x31')]=_[_0x5d3d('0x42')](_0x264d38[_0x5d3d('0x31')]);_0x269d3b[_0x5d3d('0x32')]=_[_0x5d3d('0x43')](_0x269d3b[_0x5d3d('0x2f')],_0x269d3b[_0x5d3d('0x31')]);_0x42a610[_0x5d3d('0x33')]=_[_0x5d3d('0x43')](_0x269d3b[_0x5d3d('0x2f')],qs['fields'](_0x264d38[_0x5d3d('0x31')][_0x5d3d('0x34')]));_0x42a610[_0x5d3d('0x33')]=_0x42a610[_0x5d3d('0x33')][_0x5d3d('0x44')]?_0x42a610['attributes']:_0x269d3b['model'];if(_0x264d38[_0x5d3d('0x31')][_0x5d3d('0x3e')]){_0x42a610[_0x5d3d('0x45')]=[{'all':!![]}];}_0x42a610=_[_0x5d3d('0x3b')]({},_0x42a610,_0x264d38[_0x5d3d('0x3d')]);return db[_0x5d3d('0x2a')][_0x5d3d('0x46')](_0x42a610)[_0x5d3d('0x25')](handleEntityNotFound(_0x5e94dd,null))[_0x5d3d('0x25')](respondWithResult(_0x5e94dd,null))[_0x5d3d('0x47')](handleError(_0x5e94dd,null));};exports[_0x5d3d('0x48')]=function(_0x4eb42a,_0x3b8ef5){return db[_0x5d3d('0x2a')][_0x5d3d('0x48')](_0x4eb42a[_0x5d3d('0x49')],{})[_0x5d3d('0x25')](respondWithResult(_0x3b8ef5,0xc9))['catch'](handleError(_0x3b8ef5,null));};exports[_0x5d3d('0x24')]=function(_0x2daf73,_0x3a3e7e){if(_0x2daf73[_0x5d3d('0x49')]['id']){delete _0x2daf73[_0x5d3d('0x49')]['id'];}return db[_0x5d3d('0x2a')]['find']({'where':{'id':_0x2daf73[_0x5d3d('0x41')]['id']}})[_0x5d3d('0x25')](handleEntityNotFound(_0x3a3e7e,null))[_0x5d3d('0x25')](saveUpdates(_0x2daf73['body'],null))[_0x5d3d('0x25')](respondWithResult(_0x3a3e7e,null))['catch'](handleError(_0x3a3e7e,null));};exports[_0x5d3d('0x26')]=function(_0x1b4dac,_0x59bed6){return db[_0x5d3d('0x2a')][_0x5d3d('0x46')]({'where':{'id':_0x1b4dac[_0x5d3d('0x41')]['id']}})[_0x5d3d('0x25')](handleEntityNotFound(_0x59bed6,null))['then'](removeEntity(_0x59bed6,null))[_0x5d3d('0x47')](handleError(_0x59bed6,null));};exports[_0x5d3d('0x4a')]=function(_0x42f858,_0x5cbef7){return db[_0x5d3d('0x2a')]['describe']()[_0x5d3d('0x25')](respondWithResult(_0x5cbef7,null))[_0x5d3d('0x47')](handleError(_0x5cbef7,null));}; \ No newline at end of file +var _0xb700=['pick','where','merge','VIRTUAL','filter','options','ChatTransferReport','includeAll','include','rows','catch','params','keys','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xb700,0xf3));var _0x0b70=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xb700[_0x4bf96c];return _0x281d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b70('0x0'));var zipdir=require(_0x0b70('0x1'));var jsonpatch=require(_0x0b70('0x2'));var rp=require(_0x0b70('0x3'));var moment=require(_0x0b70('0x4'));var BPromise=require(_0x0b70('0x5'));var Mustache=require(_0x0b70('0x6'));var util=require(_0x0b70('0x7'));var path=require(_0x0b70('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b70('0x9'));var _=require(_0x0b70('0xa'));var squel=require(_0x0b70('0xb'));var crypto=require(_0x0b70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b70('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0b70('0xe'));var Papa=require(_0x0b70('0xf'));var Redis=require(_0x0b70('0x10'));var authService=require(_0x0b70('0x11'));var qs=require(_0x0b70('0x12'));var as=require(_0x0b70('0x13'));var hardwareService=require(_0x0b70('0x14'));var logger=require(_0x0b70('0x15'))(_0x0b70('0x16'));var utils=require(_0x0b70('0x17'));var config=require(_0x0b70('0x18'));var licenseUtil=require(_0x0b70('0x19'));var db=require(_0x0b70('0x1a'))['db'];function respondWithStatusCode(_0x3bc877,_0x40ac56){_0x40ac56=_0x40ac56||0xcc;return function(_0x552b49){if(_0x552b49){return _0x3bc877[_0x0b70('0x1b')](_0x40ac56);}return _0x3bc877[_0x0b70('0x1c')](_0x40ac56)[_0x0b70('0x1d')]();};}function respondWithResult(_0x11f197,_0x3ac07d){_0x3ac07d=_0x3ac07d||0xc8;return function(_0x2a3ce3){if(_0x2a3ce3){return _0x11f197[_0x0b70('0x1c')](_0x3ac07d)[_0x0b70('0x1e')](_0x2a3ce3);}};}function respondWithFilteredResult(_0x5b1847,_0x21d414){return function(_0x1969b4){if(_0x1969b4){var _0x325a4e=typeof _0x21d414[_0x0b70('0x1f')]==='undefined'&&typeof _0x21d414[_0x0b70('0x20')]===_0x0b70('0x21');var _0x5a0b84=_0x1969b4[_0x0b70('0x22')];var _0x37b408=_0x325a4e?0x0:_0x21d414[_0x0b70('0x1f')];var _0x314d9f=_0x325a4e?_0x1969b4[_0x0b70('0x22')]:_0x21d414[_0x0b70('0x1f')]+_0x21d414[_0x0b70('0x20')];var _0x3f572c;if(_0x314d9f>=_0x5a0b84){_0x314d9f=_0x5a0b84;_0x3f572c=0xc8;}else{_0x3f572c=0xce;}_0x5b1847[_0x0b70('0x1c')](_0x3f572c);return _0x5b1847[_0x0b70('0x23')](_0x0b70('0x24'),_0x37b408+'-'+_0x314d9f+'/'+_0x5a0b84)[_0x0b70('0x1e')](_0x1969b4);}return null;};}function patchUpdates(_0x116a00){return function(_0x1dffca){try{jsonpatch['apply'](_0x1dffca,_0x116a00,!![]);}catch(_0x47962d){return BPromise['reject'](_0x47962d);}return _0x1dffca[_0x0b70('0x25')]();};}function saveUpdates(_0x512113,_0x2e0375){return function(_0x39bf3b){if(_0x39bf3b){return _0x39bf3b['update'](_0x512113)[_0x0b70('0x26')](function(_0x57a20d){return _0x57a20d;});}return null;};}function removeEntity(_0xbbea03,_0x1ab15f){return function(_0x53503e){if(_0x53503e){return _0x53503e['destroy']()[_0x0b70('0x26')](function(){_0xbbea03[_0x0b70('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcb5c8e,_0x3d0ee3){return function(_0x15a52){if(!_0x15a52){_0xcb5c8e['sendStatus'](0x194);}return _0x15a52;};}function handleError(_0x476dba,_0x227555){_0x227555=_0x227555||0x1f4;return function(_0x264270){logger['error'](_0x264270[_0x0b70('0x27')]);if(_0x264270[_0x0b70('0x28')]){delete _0x264270[_0x0b70('0x28')];}_0x476dba[_0x0b70('0x1c')](_0x227555)['send'](_0x264270);};}exports['index']=function(_0x19bdd9,_0x368bda){var _0x45936e={},_0x547e67={},_0x5a3113={'count':0x0,'rows':[]};var _0x5d40da=_['map'](db['ChatTransferReport'][_0x0b70('0x29')],function(_0x5898f9){return{'name':_0x5898f9[_0x0b70('0x2a')],'type':_0x5898f9[_0x0b70('0x2b')][_0x0b70('0x2c')]};});_0x547e67[_0x0b70('0x2d')]=_[_0x0b70('0x2e')](_0x5d40da,_0x0b70('0x28'));_0x547e67[_0x0b70('0x2f')]=_['keys'](_0x19bdd9[_0x0b70('0x2f')]);_0x547e67[_0x0b70('0x30')]=_[_0x0b70('0x31')](_0x547e67[_0x0b70('0x2d')],_0x547e67['query']);_0x45936e[_0x0b70('0x32')]=_[_0x0b70('0x31')](_0x547e67[_0x0b70('0x2d')],qs[_0x0b70('0x33')](_0x19bdd9[_0x0b70('0x2f')][_0x0b70('0x33')]));_0x45936e['attributes']=_0x45936e[_0x0b70('0x32')][_0x0b70('0x34')]?_0x45936e['attributes']:_0x547e67[_0x0b70('0x2d')];if(!_0x19bdd9['query'][_0x0b70('0x35')](_0x0b70('0x36'))){_0x45936e[_0x0b70('0x20')]=qs[_0x0b70('0x20')](_0x19bdd9[_0x0b70('0x2f')][_0x0b70('0x20')]);_0x45936e[_0x0b70('0x1f')]=qs[_0x0b70('0x1f')](_0x19bdd9[_0x0b70('0x2f')][_0x0b70('0x1f')]);}_0x45936e[_0x0b70('0x37')]=qs[_0x0b70('0x38')](_0x19bdd9[_0x0b70('0x2f')]['sort']);_0x45936e['where']=qs[_0x0b70('0x30')](_[_0x0b70('0x39')](_0x19bdd9[_0x0b70('0x2f')],_0x547e67['filters']),_0x5d40da);if(_0x19bdd9[_0x0b70('0x2f')]['filter']){_0x45936e[_0x0b70('0x3a')]=_[_0x0b70('0x3b')](_0x45936e['where'],{'$or':_[_0x0b70('0x2e')](_0x5d40da,function(_0x14c154){if(_0x14c154[_0x0b70('0x2b')]!==_0x0b70('0x3c')){var _0x584336={};_0x584336[_0x14c154['name']]={'$like':'%'+_0x19bdd9[_0x0b70('0x2f')][_0x0b70('0x3d')]+'%'};return _0x584336;}})});}_0x45936e=_[_0x0b70('0x3b')]({},_0x45936e,_0x19bdd9[_0x0b70('0x3e')]);var _0xbe8b37={'where':_0x45936e[_0x0b70('0x3a')]};return db[_0x0b70('0x3f')]['count'](_0xbe8b37)[_0x0b70('0x26')](function(_0xe37290){_0x5a3113['count']=_0xe37290;if(_0x19bdd9[_0x0b70('0x2f')][_0x0b70('0x40')]){_0x45936e[_0x0b70('0x41')]=[{'all':!![]}];}return db[_0x0b70('0x3f')]['findAll'](_0x45936e);})['then'](function(_0x5d71a5){_0x5a3113[_0x0b70('0x42')]=_0x5d71a5;return _0x5a3113;})[_0x0b70('0x26')](respondWithFilteredResult(_0x368bda,_0x45936e))[_0x0b70('0x43')](handleError(_0x368bda,null));};exports['show']=function(_0x52c701,_0x16b5f4){var _0x2df2aa={'raw':!![],'where':{'id':_0x52c701[_0x0b70('0x44')]['id']}},_0x320765={};_0x320765['model']=_[_0x0b70('0x45')](db[_0x0b70('0x3f')][_0x0b70('0x29')]);_0x320765[_0x0b70('0x2f')]=_[_0x0b70('0x45')](_0x52c701[_0x0b70('0x2f')]);_0x320765[_0x0b70('0x30')]=_[_0x0b70('0x31')](_0x320765[_0x0b70('0x2d')],_0x320765[_0x0b70('0x2f')]);_0x2df2aa[_0x0b70('0x32')]=_[_0x0b70('0x31')](_0x320765[_0x0b70('0x2d')],qs['fields'](_0x52c701[_0x0b70('0x2f')][_0x0b70('0x33')]));_0x2df2aa['attributes']=_0x2df2aa[_0x0b70('0x32')]['length']?_0x2df2aa['attributes']:_0x320765[_0x0b70('0x2d')];if(_0x52c701[_0x0b70('0x2f')]['includeAll']){_0x2df2aa[_0x0b70('0x41')]=[{'all':!![]}];}_0x2df2aa=_[_0x0b70('0x3b')]({},_0x2df2aa,_0x52c701['options']);return db['ChatTransferReport']['find'](_0x2df2aa)[_0x0b70('0x26')](handleEntityNotFound(_0x16b5f4,null))[_0x0b70('0x26')](respondWithResult(_0x16b5f4,null))[_0x0b70('0x43')](handleError(_0x16b5f4,null));};exports[_0x0b70('0x46')]=function(_0x5efbb6,_0x440bf6){return db['ChatTransferReport'][_0x0b70('0x46')](_0x5efbb6[_0x0b70('0x47')],{})['then'](respondWithResult(_0x440bf6,0xc9))[_0x0b70('0x43')](handleError(_0x440bf6,null));};exports['update']=function(_0x39b803,_0x1c07a3){if(_0x39b803[_0x0b70('0x47')]['id']){delete _0x39b803[_0x0b70('0x47')]['id'];}return db[_0x0b70('0x3f')][_0x0b70('0x48')]({'where':{'id':_0x39b803[_0x0b70('0x44')]['id']}})[_0x0b70('0x26')](handleEntityNotFound(_0x1c07a3,null))[_0x0b70('0x26')](saveUpdates(_0x39b803[_0x0b70('0x47')],null))['then'](respondWithResult(_0x1c07a3,null))['catch'](handleError(_0x1c07a3,null));};exports[_0x0b70('0x49')]=function(_0x10fa73,_0x232ad1){return db['ChatTransferReport'][_0x0b70('0x48')]({'where':{'id':_0x10fa73['params']['id']}})[_0x0b70('0x26')](handleEntityNotFound(_0x232ad1,null))['then'](removeEntity(_0x232ad1,null))[_0x0b70('0x43')](handleError(_0x232ad1,null));};exports[_0x0b70('0x4a')]=function(_0x5857ff,_0x8ec27b){return db[_0x0b70('0x3f')][_0x0b70('0x4a')]()[_0x0b70('0x26')](respondWithResult(_0x8ec27b,null))[_0x0b70('0x43')](handleError(_0x8ec27b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6d914ed..b387bb4 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 _0x7ecb=['../../config/logger','api','bluebird','path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x7ecb,0x1c7));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb7ec('0x0'));var util=require('util');var logger=require(_0xb7ec('0x1'))(_0xb7ec('0x2'));var moment=require('moment');var BPromise=require(_0xb7ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ec('0x4'));var rimraf=require(_0xb7ec('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7ec('0x6'));module[_0xb7ec('0x7')]=function(_0x4718b2,_0x502efa){return _0x4718b2[_0xb7ec('0x8')](_0xb7ec('0x9'),attributes,{'tableName':_0xb7ec('0xa'),'paranoid':![],'indexes':[{'name':_0xb7ec('0xb'),'fields':[_0xb7ec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x73e9=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x73e9,0xd4));var _0x973e=function(_0x150fd9,_0xa49dcb){_0x150fd9=_0x150fd9-0x0;var _0x556529=_0x73e9[_0x150fd9];return _0x556529;};'use strict';var _=require(_0x973e('0x0'));var util=require(_0x973e('0x1'));var logger=require('../../config/logger')(_0x973e('0x2'));var moment=require(_0x973e('0x3'));var BPromise=require(_0x973e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x973e('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x973e('0x6')]=function(_0x302acc,_0x2a0b73){return _0x302acc[_0x973e('0x7')](_0x973e('0x8'),attributes,{'tableName':_0x973e('0x9'),'paranoid':![],'indexes':[{'name':_0x973e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9bb9f88..23a9116 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 _0xd62a=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd62a,0x172));var _0xad62=function(_0x3a3a6b,_0x59b6ec){_0x3a3a6b=_0x3a3a6b-0x0;var _0x66450a=_0xd62a[_0x3a3a6b];return _0x66450a;};'use strict';var _=require('lodash');var util=require(_0xad62('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad62('0x1'));var fs=require('fs');var Redis=require(_0xad62('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xad62('0x3'));var logger=require(_0xad62('0x4'))(_0xad62('0x5'));var config=require('../../config/environment');var jayson=require(_0xad62('0x6'));var client=jayson[_0xad62('0x7')][_0xad62('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580db0,_0x2f09cf,_0x410239){return new BPromise(function(_0xc5b52e,_0x5a9ad4){return client[_0xad62('0x9')](_0x580db0,_0x410239)[_0xad62('0xa')](function(_0xdb6abb){logger[_0xad62('0xb')](_0xad62('0xc'),_0x2f09cf,_0xad62('0xd'));logger[_0xad62('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2f09cf,_0xad62('0xd'),JSON['stringify'](_0xdb6abb));if(_0xdb6abb[_0xad62('0xf')]){if(_0xdb6abb[_0xad62('0xf')][_0xad62('0x10')]===0x1f4){logger[_0xad62('0xf')](_0xad62('0xc'),_0x2f09cf,_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);return _0x5a9ad4(_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);}logger[_0xad62('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x2f09cf,_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);return _0xc5b52e(_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);}else{logger['info'](_0xad62('0xc'),_0x2f09cf,_0xad62('0xd'));_0xc5b52e(_0xdb6abb[_0xad62('0x12')][_0xad62('0x11')]);}})[_0xad62('0x13')](function(_0xd9c823){logger['error'](_0xad62('0xc'),_0x2f09cf,_0xd9c823);_0x5a9ad4(_0xd9c823);});});} \ No newline at end of file +var _0x401e=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a257f,_0x18ab97){var _0x3a7574=function(_0x35fae6){while(--_0x35fae6){_0x5a257f['push'](_0x5a257f['shift']());}};_0x3a7574(++_0x18ab97);}(_0x401e,0x1c4));var _0xe401=function(_0x5a02b9,_0x5c0c06){_0x5a02b9=_0x5a02b9-0x0;var _0x4d2bb8=_0x401e[_0x5a02b9];return _0x4d2bb8;};'use strict';var _=require(_0xe401('0x0'));var util=require(_0xe401('0x1'));var moment=require('moment');var BPromise=require(_0xe401('0x2'));var rs=require(_0xe401('0x3'));var fs=require('fs');var Redis=require(_0xe401('0x4'));var db=require(_0xe401('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe401('0x6'))(_0xe401('0x7'));var config=require(_0xe401('0x8'));var jayson=require(_0xe401('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5042c2,_0xe1666,_0x4a8195){return new BPromise(function(_0x2b0262,_0x208b1c){return client[_0xe401('0xa')](_0x5042c2,_0x4a8195)[_0xe401('0xb')](function(_0x279fa9){logger[_0xe401('0xc')](_0xe401('0xd'),_0xe1666,_0xe401('0xe'));logger[_0xe401('0xf')](_0xe401('0x10'),_0xe1666,_0xe401('0xe'),JSON[_0xe401('0x11')](_0x279fa9));if(_0x279fa9[_0xe401('0x12')]){if(_0x279fa9[_0xe401('0x12')]['code']===0x1f4){logger[_0xe401('0x12')](_0xe401('0xd'),_0xe1666,_0x279fa9[_0xe401('0x12')][_0xe401('0x13')]);return _0x208b1c(_0x279fa9['error'][_0xe401('0x13')]);}logger[_0xe401('0x12')](_0xe401('0xd'),_0xe1666,_0x279fa9['error'][_0xe401('0x13')]);return _0x2b0262(_0x279fa9[_0xe401('0x12')][_0xe401('0x13')]);}else{logger['info'](_0xe401('0xd'),_0xe1666,_0xe401('0xe'));_0x2b0262(_0x279fa9[_0xe401('0x14')][_0xe401('0x13')]);}})[_0xe401('0x15')](function(_0x5b4e73){logger[_0xe401('0x12')](_0xe401('0xd'),_0xe1666,_0x5b4e73);_0x208b1c(_0x5b4e73);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index e593143..bd8d9f7 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 _0x6622=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','/:id'];(function(_0x8bf294,_0x1ca4ae){var _0x596021=function(_0x2d1e15){while(--_0x2d1e15){_0x8bf294['push'](_0x8bf294['shift']());}};_0x596021(++_0x1ca4ae);}(_0x6622,0x115));var _0x2662=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x6622[_0x37ae26];return _0x1b1902;};'use strict';var multer=require(_0x2662('0x0'));var util=require('util');var path=require(_0x2662('0x1'));var timeout=require(_0x2662('0x2'));var express=require('express');var router=express[_0x2662('0x3')]();var fs_extra=require(_0x2662('0x4'));var auth=require(_0x2662('0x5'));var interaction=require(_0x2662('0x6'));var config=require('../../config/environment');var controller=require(_0x2662('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2662('0x8')]);router[_0x2662('0x9')](_0x2662('0xa'),auth[_0x2662('0xb')](),controller[_0x2662('0xc')]);router['get']('/:id',auth[_0x2662('0xb')](),controller['show']);router[_0x2662('0xd')]('/',auth[_0x2662('0xb')](),controller[_0x2662('0xe')]);router[_0x2662('0xf')](_0x2662('0x10'),auth[_0x2662('0xb')](),controller[_0x2662('0x11')]);router[_0x2662('0x12')](_0x2662('0x10'),auth[_0x2662('0xb')](),controller[_0x2662('0x13')]);module[_0x2662('0x14')]=router; \ No newline at end of file +var _0x4e86=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','post','/:id','update','delete','destroy','exports','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e86,0x1f2));var _0x64e8=function(_0x2be82e,_0x1b042b){_0x2be82e=_0x2be82e-0x0;var _0x4e0410=_0x4e86[_0x2be82e];return _0x4e0410;};'use strict';var multer=require('multer');var util=require(_0x64e8('0x0'));var path=require(_0x64e8('0x1'));var timeout=require(_0x64e8('0x2'));var express=require(_0x64e8('0x3'));var router=express[_0x64e8('0x4')]();var fs_extra=require(_0x64e8('0x5'));var auth=require(_0x64e8('0x6'));var interaction=require(_0x64e8('0x7'));var config=require(_0x64e8('0x8'));var controller=require(_0x64e8('0x9'));router[_0x64e8('0xa')]('/',auth[_0x64e8('0xb')](),controller['index']);router['get'](_0x64e8('0xc'),auth[_0x64e8('0xb')](),controller[_0x64e8('0xd')]);router[_0x64e8('0xa')]('/:id',auth[_0x64e8('0xb')](),controller['show']);router[_0x64e8('0xe')]('/',auth[_0x64e8('0xb')](),controller['create']);router['put'](_0x64e8('0xf'),auth[_0x64e8('0xb')](),controller[_0x64e8('0x10')]);router[_0x64e8('0x11')](_0x64e8('0xf'),auth[_0x64e8('0xb')](),controller[_0x64e8('0x12')]);module[_0x64e8('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 043d586..3e22839 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 _0xeb65=['setDataValue','input','textarea','Leave\x20your\x20comments','getDataValue','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','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','stringify','name','text','onlineForm'];(function(_0x540cf4,_0x21e29e){var _0x254c12=function(_0x5da45e){while(--_0x5da45e){_0x540cf4['push'](_0x540cf4['shift']());}};_0x254c12(++_0x21e29e);}(_0xeb65,0x110));var _0x5eb6=function(_0x565a48,_0x2fd653){_0x565a48=_0x565a48-0x0;var _0x2ce86b=_0xeb65[_0x565a48];return _0x2ce86b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5eb6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x5eb6('0x1')]},'mapKey':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2')},'mapKeyOffline':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5eb6('0x1')]},'animation':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5eb6('0x8')](_0x5eb6('0x9'),_0x5eb6('0xa')),'defaultValue':_0x5eb6('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'header_offline':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5eb6('0xe')]},'closingQuestion':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x11')},'noteTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x12')},'placeholderMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x13')},'closingMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x14')},'closingMessageButton':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'skipMessageButton':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x15')},'conditionAgreement':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x5eb6('0x8')](_0x5eb6('0x16'),_0x5eb6('0x17')),'defaultValue':_0x5eb6('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':function(){return JSON[_0x5eb6('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x5eb6('0x19'),'type':_0x5eb6('0x1a'),'required':!![]},'props':{'title':_0x5eb6('0x19'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5eb6('0x2'),'type':_0x5eb6('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5eb6('0x1b'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x3b6b8b){return this[_0x5eb6('0x1c')](_0x5eb6('0x1b'),JSON[_0x5eb6('0x18')](_0x3b6b8b));}},'offlineForm':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5eb6('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5eb6('0x2')},'variable':null},{'type':_0x5eb6('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x5eb6('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x5eb6('0x20')]('offlineForm')?JSON[_0x5eb6('0x21')](this['getDataValue'](_0x5eb6('0x22'))):{};},'set':function(_0x376f87){return this[_0x5eb6('0x1c')](_0x5eb6('0x22'),JSON[_0x5eb6('0x18')](_0x376f87));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5eb6('0x23')]();}},'autoclose':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5eb6('0x1')]},'waitingTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5eb6('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5eb6('0x28');}},'notificationSound':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x29')},'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[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x2b')},'defaultTitle':{'type':Sequelize[_0x5eb6('0x1')]},'customerAvatar':{'type':Sequelize[_0x5eb6('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5eb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5eb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2d')},'systemAvatar':{'type':Sequelize[_0x5eb6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5eb6('0x6')],'comment':_0x5eb6('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![],'comment':_0x5eb6('0x2f'),'set':function(_0x22d130){if(!_0x22d130)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5eb6('0x30'),_0x22d130);}},'vidaooEscalation':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5eb6('0x1')]},'vidaooTopic':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':function(){return _0x5eb6('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5eb6('0xe')]}}; \ No newline at end of file +var _0xb842=['sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}'];(function(_0x43bdf1,_0x41737e){var _0x67f96e=function(_0x5a4db4){while(--_0x5a4db4){_0x43bdf1['push'](_0x43bdf1['shift']());}};_0x67f96e(++_0x41737e);}(_0xb842,0x1ef));var _0x2b84=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0xb842[_0x72895a];return _0x5226d5;};'use strict';var Sequelize=require(_0x2b84('0x0'));var rs=require(_0x2b84('0x1'));module['exports']={'name':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![],'unique':_0x2b84('0x3')},'description':{'type':Sequelize[_0x2b84('0x2')]},'mapKey':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0x4')},'key':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![],'defaultValue':_0x2b84('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2b84('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![],'defaultValue':_0x2b84('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2b84('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2b84('0x2')]},'animation':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2b84('0xa')](_0x2b84('0xb'),_0x2b84('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0xd')},'start_chat_button':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0xe')},'offline_chat_button':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0xf')},'header_offline':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2b84('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x13')},'placeholderMessage':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x14')},'closingMessage':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0xf')},'skipMessageButton':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x16')},'conditionAgreement':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x2b84('0x18'),_0x2b84('0x19')),'defaultValue':_0x2b84('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2b84('0x1a')],'defaultValue':function(){return JSON[_0x2b84('0x1b')]({'items':[{'type':_0x2b84('0x1c'),'variable':null,'config':{'placeholder':_0x2b84('0x1d'),'type':_0x2b84('0x1e'),'required':!![]},'props':{'title':_0x2b84('0x1d'),'helpText':''}},{'type':_0x2b84('0x1c'),'props':{'title':_0x2b84('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x2b84('0x4'),'type':_0x2b84('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2b84('0x1f')](_0x2b84('0x20'))?JSON[_0x2b84('0x21')](this[_0x2b84('0x1f')](_0x2b84('0x20'))):{};},'set':function(_0xcabe7a){return this[_0x2b84('0x22')](_0x2b84('0x20'),JSON['stringify'](_0xcabe7a));}},'offlineForm':{'type':Sequelize[_0x2b84('0x1a')],'defaultValue':function(){return JSON[_0x2b84('0x1b')]({'items':[{'type':_0x2b84('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2b84('0x4'),'type':_0x2b84('0x4')},'variable':null},{'type':_0x2b84('0x23'),'config':{'placeholder':'Comments'},'props':{'title':_0x2b84('0x24'),'helpText':_0x2b84('0x25')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x2b84('0x21')](this['getDataValue'](_0x2b84('0x26'))):{};},'set':function(_0x537cb7){return this['setDataValue']('offlineForm',JSON['stringify'](_0x537cb7));}},'token':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':function(){return rs[_0x2b84('0x27')]();}},'autoclose':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2b84('0x2')]},'forwardOffline':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2b84('0x2')]},'waitingTitle':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x28')},'waitingMessage':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x29')},'offlineMessageSubject':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0x2c')},'skipUnmanaged':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x16')},'sendUnmanaged':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2b84('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2b84('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2b84('0x1a')],'defaultValue':function(){return _0x2b84('0x2d');}},'notificationSound':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2b84('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2b84('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x2f')},'verticalAlignment':{'type':Sequelize[_0x2b84('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x2b84('0x30')},'messagesAlignment':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':_0x2b84('0x31')},'defaultTitle':{'type':Sequelize[_0x2b84('0x2')]},'customerAvatar':{'type':Sequelize[_0x2b84('0x1a')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2b84('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![],'defaultValue':_0x2b84('0x32'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2b84('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2b84('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2b84('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x2b84('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b84('0x8')],'comment':_0x2b84('0x33')},'mandatoryDisposition':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b4a94){if(!_0x4b4a94)this['setDataValue'](_0x2b84('0x34'),null);this[_0x2b84('0x22')](_0x2b84('0x35'),_0x4b4a94);}},'vidaooEscalation':{'type':Sequelize[_0x2b84('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2b84('0x2')]},'vidaooTopic':{'type':Sequelize[_0x2b84('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x2b84('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2b84('0x1a')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 301d7af..4d3ab75 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 _0xf9ae=['merge','options','includeAll','include','rows','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','body','Disposition','getDispositions','findOne','nolimit','ChatWebsiteId','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','sitepic','../../config/license/util','custom','isNil','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','List','orderBy','Applications','priority','asc','account','ListId','contact','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','applications','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','startRouting','EventManager','notify','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','originalname','server','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','forwardOfflineAddress','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','order','Owner','internal','Tag','Tags','color','tag','getLicense','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','headers','x-real-ip','remoteAddress','replace','labelText','textColor','textButtonColor','hideWhenOffline','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getProactiveActions','getFields','online','false','onlineForm','items','fromKey','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','jayson/promise','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','destroy','get','ChatWebsites','stack','name','send','getSnippet','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','ONLINE','OFFLINE','timezone','No\x20timezone','Interval','Intervals','all','user-agent-parser','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','device','%s\x20%s\x20%s','vendor','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','limit','sort','where','pick','filters','filter'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf9ae,0xc5));var _0xef9a=function(_0x510461,_0x42f9af){_0x510461=_0x510461-0x0;var _0x701009=_0xf9ae[_0x510461];return _0x701009;};'use strict';var Mustache=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var path=require(_0xef9a('0x2'));var ejs=require(_0xef9a('0x3'));var fs=require('fs');var fs_extra=require(_0xef9a('0x4'));var _=require('lodash');var querystring=require(_0xef9a('0x5'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0xef9a('0x6'));var url=require(_0xef9a('0x7'));var qs=require(_0xef9a('0x8'));var logger=require('../../config/logger')(_0xef9a('0x9'));var config=require(_0xef9a('0xa'));var APIOutOfIntervalError=require(_0xef9a('0xb'))[_0xef9a('0xc')];var APINotFoundError=require('../../errors/api')[_0xef9a('0xd')];var APIHandleError=require(_0xef9a('0xb'))[_0xef9a('0xe')];var db=require(_0xef9a('0xf'))['db'];config[_0xef9a('0x10')]=_[_0xef9a('0x11')](config['redis'],{'host':_0xef9a('0x12'),'port':0x18eb});var socket=require(_0xef9a('0x13'))(new Redis(config[_0xef9a('0x10')]));require(_0xef9a('0x14'))['register'](socket);var client=jayson[_0xef9a('0x15')][_0xef9a('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xef9a('0x16')]({'port':0x232a});var client9003=jayson['client'][_0xef9a('0x16')]({'port':0x232b});var client9001=jayson[_0xef9a('0x15')][_0xef9a('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x22f793,_0x1e45e3,_0x52b3a7,_0x59d511){return new Promise(function(_0x48e659,_0x417c8d){var _0x393554=_0x59d511||client;return _0x393554[_0xef9a('0x17')](_0x22f793,_0x52b3a7)[_0xef9a('0x18')](function(_0x43b6a9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1e45e3,_0xef9a('0x19'));logger['debug'](_0xef9a('0x1a'),_0x1e45e3,_0xef9a('0x19'),JSON[_0xef9a('0x1b')](_0x43b6a9));if(_0x43b6a9[_0xef9a('0x1c')]){if(_0x43b6a9[_0xef9a('0x1c')][_0xef9a('0x1d')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1e45e3,_0x43b6a9['error'][_0xef9a('0x1e')]);return _0x417c8d(_0x43b6a9['error'][_0xef9a('0x1e')]);}logger[_0xef9a('0x1c')](_0xef9a('0x1f'),_0x1e45e3,_0x43b6a9[_0xef9a('0x1c')][_0xef9a('0x1e')]);return _0x48e659(_0x43b6a9['error']['message']);}else{logger['info'](_0xef9a('0x1f'),_0x1e45e3,_0xef9a('0x19'));_0x48e659(_0x43b6a9[_0xef9a('0x20')][_0xef9a('0x1e')]);}})[_0xef9a('0x21')](function(_0x5661ca){logger[_0xef9a('0x1c')](_0xef9a('0x1f'),_0x1e45e3,_0x5661ca);_0x417c8d(_0x5661ca);});});}function respondWithStatusCode(_0xe85287,_0x139369){_0x139369=_0x139369||0xcc;return function(_0x39d64f){if(_0x39d64f){return _0xe85287[_0xef9a('0x22')](_0x139369);}return _0xe85287[_0xef9a('0x23')](_0x139369)[_0xef9a('0x24')]();};}function respondWithResult(_0x206876,_0x37c705){_0x37c705=_0x37c705||0xc8;return function(_0x1a79ed){if(_0x1a79ed){return _0x206876[_0xef9a('0x23')](_0x37c705)[_0xef9a('0x25')](_0x1a79ed);}};}function respondWithFilteredResult(_0xaadd94,_0x29bef7){return function(_0x5991bc){if(_0x5991bc){var _0x10d4b1=typeof _0x29bef7['offset']===_0xef9a('0x26')&&typeof _0x29bef7['limit']===_0xef9a('0x26');var _0x21f485=_0x5991bc[_0xef9a('0x27')];var _0x8711c9=_0x10d4b1?0x0:_0x29bef7[_0xef9a('0x28')];var _0x1834b7=_0x10d4b1?_0x5991bc[_0xef9a('0x27')]:_0x29bef7[_0xef9a('0x28')]+_0x29bef7['limit'];var _0x3b2947;if(_0x1834b7>=_0x21f485){_0x1834b7=_0x21f485;_0x3b2947=0xc8;}else{_0x3b2947=0xce;}_0xaadd94[_0xef9a('0x23')](_0x3b2947);return _0xaadd94[_0xef9a('0x29')](_0xef9a('0x2a'),_0x8711c9+'-'+_0x1834b7+'/'+_0x21f485)[_0xef9a('0x25')](_0x5991bc);}return null;};}function saveUpdates(_0x13a9fb){return function(_0x464639){if(_0x464639){return _0x464639['update'](_0x13a9fb)[_0xef9a('0x18')](function(_0x25b318){return _0x25b318;});}return null;};}function removeEntity(_0x2217b6){return function(_0x3743e5){if(_0x3743e5){return _0x3743e5[_0xef9a('0x2b')]()[_0xef9a('0x18')](function(){var _0x2849be=_0x3743e5[_0xef9a('0x2c')]({'plain':!![]});var _0x22cc8a=_0xef9a('0x2d');return db['UserProfileResource'][_0xef9a('0x2b')]({'where':{'type':_0x22cc8a,'resourceId':_0x2849be['id']}})[_0xef9a('0x18')](function(){return _0x3743e5;});})[_0xef9a('0x18')](function(){_0x2217b6[_0xef9a('0x23')](0xcc)[_0xef9a('0x24')]();});}};}function handleEntityNotFound(_0x3f498e){return function(_0x57e9c8){if(!_0x57e9c8){_0x3f498e[_0xef9a('0x22')](0x194);}return _0x57e9c8;};}function handleError(_0x456206,_0x32d98d){_0x32d98d=_0x32d98d||0x1f4;return function(_0x523d91){logger['error'](_0x523d91[_0xef9a('0x2e')]);if(_0x523d91[_0xef9a('0x2f')]){delete _0x523d91[_0xef9a('0x2f')];}_0x456206[_0xef9a('0x23')](_0x32d98d)[_0xef9a('0x30')](_0x523d91);};}function iftimePromise(_0x37789b,_0x1e8e7a){return respondWithRpcPromise('Command',_0xef9a('0x31'),{'command':_0x1e8e7a['timezone']?util[_0xef9a('0x32')](_0xef9a('0x33'),_0x37789b[_0xef9a('0x34')],_0x1e8e7a['timezone']):util[_0xef9a('0x32')](_0xef9a('0x35'),_0x37789b[_0xef9a('0x34')])},client9002)['then'](function(_0xe249c8){var _0x45fd3a=_0xe249c8&&_0xe249c8[_0xef9a('0x36')]('true')>=0x0?!![]:![];logger[_0xef9a('0x37')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e8e7a['id'],_0x37789b['id'],_0x37789b[_0xef9a('0x34')],_0x45fd3a?_0xef9a('0x38'):_0xef9a('0x39'),_0x1e8e7a[_0xef9a('0x3a')]?_0x1e8e7a['timezone']:'No\x20timezone');return _0x45fd3a;})[_0xef9a('0x21')](function(_0x32ba16){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e8e7a['id'],_0x37789b['id'],_0x37789b[_0xef9a('0x34')],util['inspect'](_0x32ba16,{'showHidden':![],'depth':null}),_0x1e8e7a['timezone']?_0x1e8e7a['timezone']:_0xef9a('0x3b'));return![];});}function checkWebsiteIntervals(_0x1b96f6){var _0x45085f=_['map'](_0x1b96f6[_0xef9a('0x3c')][_0xef9a('0x3d')],function(_0x1befa3){var _0x37a09b=_0x1befa3['get']({'plain':!![]});return iftimePromise(_0x37a09b,_0x1b96f6);});return Promise[_0xef9a('0x3e')](_0x45085f)[_0xef9a('0x18')](function(_0x84406e){return _['some'](_0x84406e);});}function createInteractionObject(_0x12787a,_0x92d99c,_0x3ab2af,_0x4acd8a){var _0xbcc328=require(_0xef9a('0x3f'));var _0x18905e=new _0xbcc328();var _0x348afd=_0x18905e['setUA'](_0x3ab2af[_0xef9a('0x40')])[_0xef9a('0x41')]();var _0x38af1c=_0x92d99c['customerIp'];if(_0x3ab2af[_0xef9a('0x42')]){_0x38af1c=_0x3ab2af[_0xef9a('0x42')];}else if(_0x3ab2af[_0xef9a('0x43')]){_0x38af1c=_['first'](_0x3ab2af[_0xef9a('0x43')][_0xef9a('0x44')](','));}return{'ContactId':_0x4acd8a['id'],'ChatWebsiteId':_0x12787a,'from':(_0x4acd8a[_0xef9a('0x45')]||'')+'\x20'+(_0x4acd8a[_0xef9a('0x46')]||''),'customerIp':_0x38af1c,'customerPort':_0x3ab2af['x-real-port']?_0x3ab2af[_0xef9a('0x47')]:null,'referer':_0x92d99c[_0xef9a('0x48')],'browserName':_0x348afd['browser'][_0xef9a('0x2f')]&&_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]?util['format']('%s\x20%s',_0x348afd[_0xef9a('0x49')]['name'],_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]):_0xef9a('0x4b'),'browserVersion':_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]||_0xef9a('0x4b'),'osName':util[_0xef9a('0x32')]('%s\x20%s',_0x348afd['os'][_0xef9a('0x2f')],_0x348afd['os'][_0xef9a('0x4a')]),'osVersion':_0x348afd['os'][_0xef9a('0x4a')],'deviceModel':_0x348afd[_0xef9a('0x4c')]['model']&&_0x348afd[_0xef9a('0x4c')]['vendor']?util[_0xef9a('0x32')](_0xef9a('0x4d'),_0x348afd['device']['model'],_0x348afd[_0xef9a('0x4c')][_0xef9a('0x4e')],_0x348afd[_0xef9a('0x4c')]['type']):null,'deviceVendor':_0x348afd['device'][_0xef9a('0x4e')],'deviceType':_0x348afd[_0xef9a('0x4c')][_0xef9a('0x4f')],'formData':JSON[_0xef9a('0x1b')](_0x92d99c)};}exports['index']=function(_0x287d6e,_0x409af1){var _0x5c79ba={'include':[{'model':db[_0xef9a('0x50')],'as':_0xef9a('0x51')}]},_0x16251f={},_0x4d4ce9={'count':0x0,'rows':[]};var _0x1656dd=_[_0xef9a('0x52')](db[_0xef9a('0x53')][_0xef9a('0x54')],function(_0x17bd39){return{'name':_0x17bd39[_0xef9a('0x55')],'type':_0x17bd39['type'][_0xef9a('0x56')]};});_0x16251f['model']=_[_0xef9a('0x52')](_0x1656dd,_0xef9a('0x2f'));_0x16251f[_0xef9a('0x57')]=_['keys'](_0x287d6e[_0xef9a('0x57')]);_0x16251f['filters']=_[_0xef9a('0x58')](_0x16251f[_0xef9a('0x59')],_0x16251f[_0xef9a('0x57')]);_0x5c79ba[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x16251f[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5b')]));_0x5c79ba[_0xef9a('0x5a')]=_0x5c79ba[_0xef9a('0x5a')]['length']?_0x5c79ba[_0xef9a('0x5a')]:_0x16251f['model'];if(!_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5c')]('nolimit')){_0x5c79ba[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x5c79ba[_0xef9a('0x28')]=qs['offset'](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x28')]);}_0x5c79ba['order']=qs[_0xef9a('0x5e')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x5c79ba[_0xef9a('0x5f')]=qs['filters'](_[_0xef9a('0x60')](_0x287d6e[_0xef9a('0x57')],_0x16251f[_0xef9a('0x61')]),_0x1656dd);if(_0x287d6e[_0xef9a('0x57')][_0xef9a('0x62')]){_0x5c79ba[_0xef9a('0x5f')]=_['merge'](_0x5c79ba['where'],{'$or':_[_0xef9a('0x52')](_0x1656dd,function(_0x2a7bf8){if(_0x2a7bf8['type']!=='VIRTUAL'){var _0xe9460c={};_0xe9460c[_0x2a7bf8[_0xef9a('0x2f')]]={'$like':'%'+_0x287d6e[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0xe9460c;}})});}_0x5c79ba=_[_0xef9a('0x63')]({},_0x5c79ba,_0x287d6e[_0xef9a('0x64')]);var _0x567e87={'where':_0x5c79ba[_0xef9a('0x5f')]};return db['ChatWebsite'][_0xef9a('0x27')](_0x567e87)[_0xef9a('0x18')](function(_0x1f2c7d){_0x4d4ce9['count']=_0x1f2c7d;if(_0x287d6e[_0xef9a('0x57')][_0xef9a('0x65')]){_0x5c79ba[_0xef9a('0x66')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x5c79ba);})[_0xef9a('0x18')](function(_0xf6cb25){_0x4d4ce9[_0xef9a('0x67')]=_0xf6cb25;return _0x4d4ce9;})[_0xef9a('0x18')](respondWithFilteredResult(_0x409af1,_0x5c79ba))[_0xef9a('0x21')](handleError(_0x409af1,null));};exports['show']=function(_0x28d828,_0x329d82){var _0x5ab2b1={'raw':![],'where':{'id':_0x28d828[_0xef9a('0x68')]['id']},'include':[{'model':db['Pause'],'as':_0xef9a('0x51')}]},_0x2551f1={};_0x2551f1['model']=_[_0xef9a('0x69')](db[_0xef9a('0x53')][_0xef9a('0x54')]);_0x2551f1['query']=_[_0xef9a('0x69')](_0x28d828[_0xef9a('0x57')]);_0x2551f1[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x2551f1[_0xef9a('0x59')],_0x2551f1[_0xef9a('0x57')]);_0x5ab2b1['attributes']=_[_0xef9a('0x58')](_0x2551f1[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x28d828['query'][_0xef9a('0x5b')]));_0x5ab2b1[_0xef9a('0x5a')]=_0x5ab2b1[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x5ab2b1[_0xef9a('0x5a')]:_0x2551f1[_0xef9a('0x59')];if(_0x28d828[_0xef9a('0x57')][_0xef9a('0x65')]){_0x5ab2b1[_0xef9a('0x66')]=[{'all':!![]}];}_0x5ab2b1=_['merge']({},_0x5ab2b1,_0x28d828[_0xef9a('0x64')]);return db['ChatWebsite'][_0xef9a('0x6b')](_0x5ab2b1)[_0xef9a('0x18')](handleEntityNotFound(_0x329d82,null))['then'](respondWithResult(_0x329d82,null))['catch'](handleError(_0x329d82,null));};exports[_0xef9a('0x6c')]=function(_0x1548c5,_0x16c3fe){return db[_0xef9a('0x53')][_0xef9a('0x6c')](_0x1548c5['body'],{})['then'](function(_0x178480){var _0x154f3c=_0x1548c5[_0xef9a('0x6d')]['get']({'plain':!![]});if(!_0x154f3c)throw new Error(_0xef9a('0x6e'));if(_0x154f3c[_0xef9a('0x6f')]===_0xef9a('0x6d')){var _0x247d2e=_0x178480['get']({'plain':!![]});var _0x574f96='ChatWebsites';return db[_0xef9a('0x70')]['find']({'where':{'name':_0x574f96,'userProfileId':_0x154f3c[_0xef9a('0x71')]},'raw':!![]})['then'](function(_0x238def){if(_0x238def&&_0x238def['autoAssociation']===0x0){return db['UserProfileResource'][_0xef9a('0x6c')]({'name':_0x247d2e[_0xef9a('0x2f')],'resourceId':_0x247d2e['id'],'type':_0x238def[_0xef9a('0x2f')],'sectionId':_0x238def['id']},{})[_0xef9a('0x18')](function(){return _0x178480;});}else{return _0x178480;}})[_0xef9a('0x21')](function(_0x3c23d3){logger[_0xef9a('0x1c')](_0xef9a('0x72'),_0x3c23d3);throw _0x3c23d3;});}return _0x178480;})['then'](respondWithResult(_0x16c3fe,0xc9))['catch'](handleError(_0x16c3fe,null));};exports[_0xef9a('0x73')]=function(_0x3f0db7,_0x3a1af6){if(_0x3f0db7['body']['id']){delete _0x3f0db7['body']['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3f0db7[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0x50')],'as':_0xef9a('0x51')}]})[_0xef9a('0x18')](handleEntityNotFound(_0x3a1af6,null))[_0xef9a('0x18')](saveUpdates(_0x3f0db7['body'],null))[_0xef9a('0x18')](respondWithResult(_0x3a1af6,null))[_0xef9a('0x21')](handleError(_0x3a1af6,null));};exports[_0xef9a('0x2b')]=function(_0x4883f0,_0x233883){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x4883f0[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x233883,null))[_0xef9a('0x18')](removeEntity(_0x233883,null))[_0xef9a('0x21')](handleError(_0x233883,null));};exports[_0xef9a('0x74')]=function(_0xede58,_0x205110){return db[_0xef9a('0x53')][_0xef9a('0x74')]()['then'](respondWithResult(_0x205110,null))[_0xef9a('0x21')](handleError(_0x205110,null));};exports[_0xef9a('0x75')]=function(_0x3fcfdb,_0xe58c2){if(_0x3fcfdb[_0xef9a('0x76')]['id']){delete _0x3fcfdb['body']['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3fcfdb[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0xe58c2,null))[_0xef9a('0x18')](function(_0x52f320){if(_0x52f320){_0x3fcfdb[_0xef9a('0x76')]['ChatWebsiteId']=_0x52f320['id'];return db[_0xef9a('0x77')]['create'](_0x3fcfdb[_0xef9a('0x76')]);}})[_0xef9a('0x18')](respondWithResult(_0xe58c2,null))['catch'](handleError(_0xe58c2,null));};exports[_0xef9a('0x78')]=function(_0x2e9f5d,_0x172e30){var _0x1b15ed={'raw':![],'where':{}};var _0x2cd78c={};var _0x1c56b6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xef9a('0x79')]({'where':{'id':_0x2e9f5d[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x172e30,null))[_0xef9a('0x18')](function(_0x429bfb){if(_0x429bfb){_0x2cd78c[_0xef9a('0x59')]=_[_0xef9a('0x69')](db['Disposition'][_0xef9a('0x54')]);_0x2cd78c[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2e9f5d['query']);_0x2cd78c['filters']=_['intersection'](_0x2cd78c[_0xef9a('0x59')],_0x2cd78c[_0xef9a('0x57')]);_0x1b15ed[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x2cd78c['model'],qs[_0xef9a('0x5b')](_0x2e9f5d['query'][_0xef9a('0x5b')]));_0x1b15ed[_0xef9a('0x5a')]=_0x1b15ed[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x1b15ed[_0xef9a('0x5a')]:_0x2cd78c[_0xef9a('0x59')];if(!_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x1b15ed[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x1b15ed[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x2e9f5d[_0xef9a('0x57')]['offset']);}_0x1b15ed['order']=qs[_0xef9a('0x5e')](_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x1b15ed[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_['pick'](_0x2e9f5d['query'],_0x2cd78c[_0xef9a('0x61')]));_0x1b15ed[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x429bfb['id'];if(_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x62')]){_0x1b15ed[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x1b15ed[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x1b15ed[_0xef9a('0x5a')],function(_0x33acfa){var _0x4aa865={};_0x4aa865[_0x33acfa]={'$like':'%'+_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4aa865;})});}_0x1b15ed=_['merge']({},_0x1b15ed,_0x2e9f5d['options']);return db[_0xef9a('0x77')]['count']({'where':_0x1b15ed['where']})['then'](function(_0x271b08){_0x1c56b6[_0xef9a('0x27')]=_0x271b08;if(_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x65')]){_0x1b15ed[_0xef9a('0x66')]=[{'all':!![]}];}return db[_0xef9a('0x77')][_0xef9a('0x7c')](_0x1b15ed);})[_0xef9a('0x18')](function(_0x4da80a){_0x1c56b6['rows']=_0x4da80a;return _0x1c56b6;});}})['then'](respondWithFilteredResult(_0x172e30,_0x1b15ed))['catch'](handleError(_0x172e30,null));};exports[_0xef9a('0x7d')]=function(_0x92b929,_0x54078f){return db[_0xef9a('0x53')]['find']({'where':{'id':_0x92b929['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x54078f,null))[_0xef9a('0x18')](function(_0x46db8c){if(_0x46db8c){return _0x46db8c[_0xef9a('0x7d')](_0x92b929[_0xef9a('0x57')]['ids']);}})[_0xef9a('0x18')](respondWithStatusCode(_0x54078f,null))[_0xef9a('0x21')](handleError(_0x54078f,null));};exports[_0xef9a('0x7e')]=function(_0x19c5f5,_0x132dc0){if(_0x19c5f5['body']['id']){delete _0x19c5f5[_0xef9a('0x76')]['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x19c5f5['params']['id']}})['then'](handleEntityNotFound(_0x132dc0,null))[_0xef9a('0x18')](function(_0x4e6ec6){if(_0x4e6ec6){_0x19c5f5[_0xef9a('0x76')][_0xef9a('0x7b')]=_0x4e6ec6['id'];return db[_0xef9a('0x7f')]['create'](_0x19c5f5[_0xef9a('0x76')]);}})[_0xef9a('0x18')](respondWithResult(_0x132dc0,null))[_0xef9a('0x21')](handleError(_0x132dc0,null));};exports['getAnswers']=function(_0x2c5fff,_0x4164d5){var _0x30e923={'raw':![],'where':{}};var _0x193603={};var _0x24419d={'count':0x0,'rows':[]};return db[_0xef9a('0x53')]['findOne']({'where':{'id':_0x2c5fff[_0xef9a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4164d5,null))[_0xef9a('0x18')](function(_0x3b968d){if(_0x3b968d){_0x193603[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0x7f')][_0xef9a('0x54')]);_0x193603[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2c5fff['query']);_0x193603[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x193603['model'],_0x193603[_0xef9a('0x57')]);_0x30e923[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x193603['model'],qs[_0xef9a('0x5b')](_0x2c5fff['query'][_0xef9a('0x5b')]));_0x30e923[_0xef9a('0x5a')]=_0x30e923['attributes'][_0xef9a('0x6a')]?_0x30e923[_0xef9a('0x5a')]:_0x193603['model'];if(!_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x5c')]('nolimit')){_0x30e923[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x30e923[_0xef9a('0x28')]=qs['offset'](_0x2c5fff['query'][_0xef9a('0x28')]);}_0x30e923['order']=qs[_0xef9a('0x5e')](_0x2c5fff[_0xef9a('0x57')]['sort']);_0x30e923['where']=qs[_0xef9a('0x61')](_['pick'](_0x2c5fff['query'],_0x193603[_0xef9a('0x61')]));_0x30e923[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x3b968d['id'];if(_0x2c5fff['query'][_0xef9a('0x62')]){_0x30e923[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x30e923['where'],{'$or':_[_0xef9a('0x52')](_0x30e923[_0xef9a('0x5a')],function(_0x5a85b1){var _0x55009e={};_0x55009e[_0x5a85b1]={'$like':'%'+_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x55009e;})});}_0x30e923=_[_0xef9a('0x63')]({},_0x30e923,_0x2c5fff[_0xef9a('0x64')]);return db['CannedAnswer'][_0xef9a('0x27')]({'where':_0x30e923[_0xef9a('0x5f')]})[_0xef9a('0x18')](function(_0x5e5854){_0x24419d[_0xef9a('0x27')]=_0x5e5854;if(_0x2c5fff['query'][_0xef9a('0x65')]){_0x30e923['include']=[{'all':!![]}];}return db[_0xef9a('0x7f')][_0xef9a('0x7c')](_0x30e923);})[_0xef9a('0x18')](function(_0x280b10){_0x24419d[_0xef9a('0x67')]=_0x280b10;return _0x24419d;});}})[_0xef9a('0x18')](respondWithFilteredResult(_0x4164d5,_0x30e923))[_0xef9a('0x21')](handleError(_0x4164d5,null));};exports[_0xef9a('0x80')]=function(_0x3e303d,_0x4cae5e){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3e303d[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x4cae5e,null))[_0xef9a('0x18')](function(_0x3d0d45){if(_0x3d0d45){return _0x3d0d45[_0xef9a('0x80')](_0x3e303d[_0xef9a('0x57')][_0xef9a('0x81')]);}})[_0xef9a('0x18')](respondWithStatusCode(_0x4cae5e,null))['catch'](handleError(_0x4cae5e,null));};exports[_0xef9a('0x82')]=function(_0x49b94a,_0x12d768){_0x49b94a[_0xef9a('0x76')]['sitepic']=_0x49b94a[_0xef9a('0x83')][_0xef9a('0x84')];return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x49b94a['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x12d768,null))[_0xef9a('0x18')](saveUpdates(_0x49b94a[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x12d768,null))[_0xef9a('0x21')](handleError(_0x12d768,null));};exports['addAvatar']=function(_0x40694f,_0x3f9749){_0x40694f[_0xef9a('0x76')][_0xef9a('0x85')]=_0x40694f[_0xef9a('0x83')][_0xef9a('0x84')];return db['ChatWebsite']['find']({'where':{'id':_0x40694f['params']['id']}})['then'](handleEntityNotFound(_0x3f9749,null))[_0xef9a('0x18')](saveUpdates(_0x40694f[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x3f9749,null))['catch'](handleError(_0x3f9749,null));};exports[_0xef9a('0x86')]=function(_0x259ac0,_0x2d14a7){_0x259ac0[_0xef9a('0x76')]['customerAvatar']=_0x259ac0[_0xef9a('0x83')][_0xef9a('0x84')];return db['ChatWebsite'][_0xef9a('0x6b')]({'where':{'id':_0x259ac0[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x2d14a7,null))[_0xef9a('0x18')](saveUpdates(_0x259ac0[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x2d14a7,null))['catch'](handleError(_0x2d14a7,null));};exports[_0xef9a('0x87')]=function(_0x1d3417,_0x330e1d){_0x1d3417['body'][_0xef9a('0x88')]=_0x1d3417[_0xef9a('0x83')][_0xef9a('0x84')];return db[_0xef9a('0x53')]['find']({'where':{'id':_0x1d3417['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x330e1d,null))[_0xef9a('0x18')](saveUpdates(_0x1d3417['body'],null))['then'](respondWithResult(_0x330e1d,null))['catch'](handleError(_0x330e1d,null));};exports['getLogo']=function(_0x3b3c89,_0x11d4ae){var _0x2844c9=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x1de243={'where':{'id':_0x3b3c89[_0xef9a('0x68')]['id']},'attributes':['id',_0xef9a('0x89')],'raw':!![]};var _0x34275f=![];return require(_0xef9a('0x8a'))['getLicense']()[_0xef9a('0x18')](function(_0x177985){if(_0x177985){_0x34275f=_0x177985[_0xef9a('0x8b')];}})[_0xef9a('0x18')](function(){return db['ChatWebsite'][_0xef9a('0x6b')](_0x1de243);})['then'](handleEntityNotFound(_0x11d4ae,null))[_0xef9a('0x18')](function(_0x527261){if(_0x527261){if(!_[_0xef9a('0x8c')](_0x527261['sitepic'])){if(fs['existsSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x8f'),_0x527261['sitepic']))&&_0x34275f){_0x2844c9=path['join'](config['root'],'server/files/images/logos/',_0x527261[_0xef9a('0x89')]);}}return _0x11d4ae[_0xef9a('0x90')](_0x2844c9);}})['catch'](handleError(_0x11d4ae,null));};exports[_0xef9a('0x91')]=function(_0xc44a00,_0x502daa){var _0x326ff4=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x92'));var _0x2757a9={'where':{'id':_0xc44a00['params']['id']},'attributes':['id',_0xef9a('0x85')],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x2757a9)[_0xef9a('0x18')](handleEntityNotFound(_0x502daa,null))['then'](function(_0x137d8e){if(_0x137d8e){if(!_['isNil'](_0x137d8e[_0xef9a('0x85')])){if(fs[_0xef9a('0x93')](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x94'),_0x137d8e[_0xef9a('0x85')]))){_0x326ff4=path['join'](config[_0xef9a('0x8e')],'server/files/images/avatars/',_0x137d8e['agentAvatar']);}}return _0x502daa[_0xef9a('0x90')](_0x326ff4);}})['catch'](handleError(_0x502daa,null));};exports['getCustomerAvatar']=function(_0x346928,_0x3d8343){var _0x2b9c4d=path['join'](config[_0xef9a('0x8e')],'server/files/images/avatars/customer_avatar.png');var _0x53427b={'where':{'id':_0x346928[_0xef9a('0x68')]['id']},'attributes':['id','customerAvatar',_0xef9a('0x95')],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x53427b)[_0xef9a('0x18')](handleEntityNotFound(_0x3d8343,null))[_0xef9a('0x18')](function(_0x2e15d8){if(_0x2e15d8){if(!_[_0xef9a('0x8c')](_0x2e15d8[_0xef9a('0x96')])){if(fs[_0xef9a('0x93')](path[_0xef9a('0x8d')](config['root'],_0xef9a('0x94'),_0x2e15d8[_0xef9a('0x96')]))&&_0x2e15d8['showCustomerAvatar']){_0x2b9c4d=path[_0xef9a('0x8d')](config['root'],_0xef9a('0x94'),_0x2e15d8['customerAvatar']);}}return _0x3d8343[_0xef9a('0x90')](_0x2b9c4d);}})[_0xef9a('0x21')](handleError(_0x3d8343,null));};exports[_0xef9a('0x97')]=function(_0x139973,_0xa25f15){var _0x53e675=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x98'));var _0x3fc435={'where':{'id':_0x139973['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x3fc435)[_0xef9a('0x18')](handleEntityNotFound(_0xa25f15,null))[_0xef9a('0x18')](function(_0x29da59){if(_0x29da59){if(!_[_0xef9a('0x8c')](_0x29da59[_0xef9a('0x88')])){if(fs['existsSync'](path['join'](config['root'],_0xef9a('0x94'),_0x29da59[_0xef9a('0x88')]))){_0x53e675=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x94'),_0x29da59[_0xef9a('0x88')]);}}return _0xa25f15[_0xef9a('0x90')](_0x53e675);}})[_0xef9a('0x21')](handleError(_0xa25f15,null));};exports['notify']=function(_0xba598a,_0x379681){var _0x50dbd6={'body':_0xba598a[_0xef9a('0x76')],'channel':_0xef9a('0x99')};var _0x361354=[];var _0x249573=[];var _0x301df4={};var _0xdad25=![];return db[_0xef9a('0x9a')][_0xef9a('0x74')]()['then'](function(_0x3fa34d){if(!_0x3fa34d){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0x9c'));}_0x361354=_[_0xef9a('0x9d')](_[_0xef9a('0x69')](_0x3fa34d),['createdAt',_0xef9a('0x9e')]);_0x249573=_['difference'](_[_0xef9a('0x69')](_0x3fa34d),[_0xef9a('0x9f'),_0xef9a('0x9e'),_0xef9a('0xa0'),'ListId']);if(_0xba598a[_0xef9a('0x76')]['id']){delete _0xba598a[_0xef9a('0x76')]['id'];}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')])){throw new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0xa3'));}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0x76')])||_0xba598a[_0xef9a('0x76')][_0xef9a('0x76')]===''){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa4'));}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0xa5')])){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa6')+_0x249573);}if(!_[_0xef9a('0xa7')](_0x249573,_0xba598a[_0xef9a('0x76')][_0xef9a('0xa5')])){throw new db['Sequelize']['ValidationError'](_0xef9a('0xa8')+_0x249573);}_0x301df4[_0xba598a[_0xef9a('0x76')]['mapKey']]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')];})[_0xef9a('0x18')](function(){return db[_0xef9a('0x53')]['find']({'where':{'id':_0xba598a[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0xef9a('0xaa'),'where':_0x301df4,'limit':0x1,'order':[[_0xef9a('0x9e'),_0xef9a('0xab')]]}]},{'model':db[_0xef9a('0xac')],'as':'Applications'},{'model':db['Interval'],'as':_0xef9a('0x3c'),'include':[{'model':db[_0xef9a('0x3c')],'as':_0xef9a('0x3d'),'attributes':['id',_0xef9a('0x34')],'raw':!![]}]}]});})[_0xef9a('0x18')](function(_0x4faab8){if(!_0x4faab8)throw new APINotFoundError(util['format'](_0xef9a('0xad'),_0xba598a[_0xef9a('0x68')]['id']));if(!_0x4faab8[_0xef9a('0x3c')]||!_0x4faab8['Interval'][_0xef9a('0x3d')])return[_0x4faab8,!![]];return[_0x4faab8,checkWebsiteIntervals(_0x4faab8)];})['spread'](function(_0xa9a767,_0xf69d6e){if(!_0xf69d6e)throw new APIOutOfIntervalError();if(!_0xa9a767[_0xef9a('0xae')])return;_0x50dbd6['account']=_0xa9a767;_0x50dbd6['list']=_0xa9a767[_0xef9a('0xae')];_0x50dbd6['applications']=_[_0xef9a('0xaf')](_0xa9a767[_0xef9a('0xb0')],[_0xef9a('0xb1')],[_0xef9a('0xb2')]);if(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xb0')]){delete _0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xb0')];}if(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xae')]&&_0x50dbd6['account'][_0xef9a('0xae')]['Contacts'][_0xef9a('0x6a')]){return _0x50dbd6[_0xef9a('0xb3')]['List'][_0xef9a('0xaa')][0x0];}var _0xa55a28=_[_0xef9a('0x11')](_0xba598a['body'],{'firstName':_0xba598a['body'][_0xef9a('0xa1')],'ListId':_0xa9a767[_0xef9a('0xb4')]});_0xa55a28[_0xba598a[_0xef9a('0x76')]['mapKey']]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')];return db[_0xef9a('0x9a')]['create'](_0xa55a28,{'fields':_0x361354,'raw':!![]});})[_0xef9a('0x18')](function(_0x45a64d){_0x50dbd6[_0xef9a('0xb5')]=_0x45a64d;var _0x14675a=createInteractionObject(_0xba598a[_0xef9a('0x68')]['id'],_0xba598a[_0xef9a('0x76')],_0xba598a['headers'],_0x45a64d);var _0x3ff892={'ChatWebsiteId':_0xba598a['params']['id'],'closed':![]};if(_0xba598a[_0xef9a('0x76')]['threadId']){_0x3ff892[_0xef9a('0xb6')]=_0xba598a['body']['threadId'];return db[_0xef9a('0xb7')][_0xef9a('0x6b')]({'where':_0x3ff892})[_0xef9a('0x18')](function(_0x19e853){if(_0x19e853){_0xdad25=!![];return _0x19e853;}_0x14675a[_0xef9a('0xb6')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')];_0x14675a[_0xef9a('0xb8')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xb8')];return db[_0xef9a('0xb7')][_0xef9a('0x6c')](_0x14675a);});}_0x3ff892[_0xef9a('0xb9')]=_0x45a64d['id'];if(_0xba598a[_0xef9a('0x76')][_0xef9a('0xba')]&&_0xba598a['body'][_0xef9a('0xba')]['id']){_0x3ff892['id']=_0xba598a['body'][_0xef9a('0xba')]['id'];return db[_0xef9a('0xb7')][_0xef9a('0x6b')]({'where':_0x3ff892})[_0xef9a('0x18')](function(_0x10c329){if(_0x10c329){_0xdad25=!![];return _0x10c329;}return db[_0xef9a('0xb7')][_0xef9a('0x6c')](_0x14675a);});}return db[_0xef9a('0xb7')]['create'](_0x14675a);})['then'](function(_0x429e77){if(!_0xdad25)return _0x429e77;var _0x524ec3={'from':(_0x50dbd6[_0xef9a('0xb5')][_0xef9a('0x45')]||'')+'\x20'+(_0x50dbd6[_0xef9a('0xb5')][_0xef9a('0x46')]||'')};if(_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')]&&_0xba598a['body'][_0xef9a('0xbb')]&&_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')]!=_0xba598a[_0xef9a('0x76')][_0xef9a('0xbb')]){_0x524ec3[_0xef9a('0xb6')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xbb')];}return _0x429e77['update'](_0x524ec3);})['then'](function(_0x47656b){_0x50dbd6[_0xef9a('0xba')]=_0x47656b[_0xef9a('0x2c')]({'plain':!![]});_0x50dbd6['interaction']['created']=!_0xdad25;if(_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xbc')]){if(_0x50dbd6['account']['autoclose']){_0x50dbd6[_0xef9a('0xbd')][_0xef9a('0xbe')]({'id':0x0,'priority':_0x50dbd6['applications']['length']+0x1,'app':'close','appdata':_0xef9a('0xbf'),'interval':_0xef9a('0xc0')});}}return db[_0xef9a('0xc1')][_0xef9a('0x6c')]({'body':_0xba598a['body'][_0xef9a('0x76')],'ChatWebsiteId':_0xba598a[_0xef9a('0x68')]['id'],'ChatInteractionId':_0x47656b['id'],'direction':'in','ContactId':_0x50dbd6[_0xef9a('0xb5')]['id'],'AttachmentId':_0xba598a['body']['AttachmentId']});})[_0xef9a('0x18')](function(_0x52f0c4){_0x50dbd6[_0xef9a('0x1e')]=_0x52f0c4;if(!_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xc2')]){return;}return db[_0xef9a('0xc3')]['find']({'attributes':['id',_0xef9a('0x2f')],'where':{'id':_0x50dbd6[_0xef9a('0xba')]['UserId']}});})['then'](function(_0x2a4436){if(_0x2a4436){_0x50dbd6[_0xef9a('0xbd')][_0xef9a('0xc4')]({'id':0x0,'priority':0x0,'app':_0xef9a('0xc5'),'appdata':_0x2a4436[_0xef9a('0x2f')]+','+(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xc6')]||0xa),'interval':_0xef9a('0xc0')});_0x50dbd6[_0xef9a('0xc7')]=!![];}if(!_0x50dbd6['interaction'][_0xef9a('0xc8')]){return;}return db[_0xef9a('0xc9')][_0xef9a('0x6b')]({'attributes':['id',_0xef9a('0x2f')],'where':{'id':_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xc8')]}});})[_0xef9a('0x18')](function(_0x45a34b){if(_0x45a34b){_0x50dbd6[_0xef9a('0xbd')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45a34b[_0xef9a('0x2f')]+','+(_0x50dbd6['account'][_0xef9a('0xca')]||0x12c),'interval':_0xef9a('0xc0')});}return respondWithRpcPromise('Start',_0xef9a('0xcb'),_0x50dbd6);})[_0xef9a('0x18')](function(_0x4e9391){respondWithRpcPromise(_0xef9a('0xcc'),'EventManager',{'event':_0xef9a('0xcd'),'message':_0x4e9391},client9002);return _0x4e9391;})[_0xef9a('0x18')](respondWithResult(_0x379681,null))[_0xef9a('0x21')](APIHandleError(_0x379681));};exports[_0xef9a('0xce')]=function(_0x882a9f,_0x314fc3){var _0x5bbb5b,_0x4294aa,_0x40e66c;var _0x56b99e=[];var _0xd756b7={};var _0x412c9b=_0x882a9f[_0xef9a('0xcf')]||[];var _0x1d3c6c=[];var _0x130879;return db['CmContact'][_0xef9a('0x74')]()[_0xef9a('0x18')](function(_0x4adc5f){if(!_0x4adc5f){throw new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0x9c'));}_0x56b99e=_[_0xef9a('0x9d')](_['keys'](_0x4adc5f),[_0xef9a('0x9f'),_0xef9a('0x9e'),_0xef9a('0xa0'),_0xef9a('0xb4')]);if(_0x882a9f[_0xef9a('0x76')]['id']){delete _0x882a9f['body']['id'];}if(_[_0xef9a('0x8c')](_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')])){throw _0x314fc3['status'](0x1f4)[_0xef9a('0x30')](new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa3')));}if(_[_0xef9a('0x8c')](_0x882a9f[_0xef9a('0x76')][_0xef9a('0x76')])||_0x882a9f[_0xef9a('0x76')][_0xef9a('0x76')]===''){throw _0x314fc3[_0xef9a('0x23')](0x1f4)['send'](new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0xa4')));}if(_['isNil'](_0x882a9f[_0xef9a('0x76')][_0xef9a('0xd0')])){throw _0x314fc3['status'](0x1f4)[_0xef9a('0x30')](new db['Sequelize'][(_0xef9a('0xa2'))](_0xef9a('0xd1')+_0x56b99e));}if(!_[_0xef9a('0xa7')](_0x56b99e,_0x882a9f['body']['mapKeyOffline'])){throw _0x314fc3[_0xef9a('0x23')](0x1f4)[_0xef9a('0x30')](new db[(_0xef9a('0x9b'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56b99e));}_0xd756b7[_0x882a9f[_0xef9a('0x76')][_0xef9a('0xd0')]]=_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')];})['then'](function(){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x882a9f[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0xa9')],'as':_0xef9a('0xae')},{'model':db[_0xef9a('0xd2')],'as':_0xef9a('0xd2')}]});})[_0xef9a('0x18')](handleEntityNotFound(_0x314fc3,null))[_0xef9a('0x18')](function(_0x3af56f){if(_0x3af56f&&_0x3af56f[_0xef9a('0xae')]){_0x4294aa=_0x3af56f;var _0x480833=_[_0xef9a('0x11')](_0x882a9f['body'],{'firstName':_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')],'phone':_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')],'ListId':_0x3af56f['ListId']});_0x480833[_0x882a9f[_0xef9a('0x76')]['mapKeyOffline']]=_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')];return db['CmContact'][_0xef9a('0xd3')]({'where':_0xd756b7,'defaults':_0x480833});}})[_0xef9a('0xd4')](function(_0x52b261){if(_0x52b261){_0x40e66c=_0x52b261;var _0x42db73=fs['readFileSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0xd5')),'utf8');var _0x20ecb6=ejs[_0xef9a('0xd6')](_0x42db73,{'body':_['toPairs'](_0x882a9f['body']['body']),'bodyTitle':_0x4294aa[_0xef9a('0xd7')]});return db[_0xef9a('0xd8')][_0xef9a('0x6c')]({'body':_0x20ecb6,'plainBody':htmlToText['fromString'](_0x20ecb6),'ContactId':_0x52b261['id'],'ChatWebsiteId':_0x4294aa['id']});}})[_0xef9a('0x18')](function(_0x37ffe6){_0x130879=_0x37ffe6;if(_0x412c9b[_0xef9a('0x6a')]){var _0x2fec2a=_0x412c9b[_0xef9a('0x52')](function(_0x139df5){return{'name':_0x139df5[_0xef9a('0xd9')],'basename':_0x139df5[_0xef9a('0x84')],'type':_0x139df5['mimetype'],'ChatOfflineMessageId':_0x37ffe6['id']};});_0x1d3c6c=_0x2fec2a[_0xef9a('0x52')](_0x36df2f=>{var _0x5626bf={'filename':_0x36df2f[_0xef9a('0x2f')],'path':path[_0xef9a('0x8d')](config['root'],_0xef9a('0xda'),_0xef9a('0xcf'),'attachments',_0xef9a('0xdb'),_0x36df2f[_0xef9a('0xdc')])};return _0x5626bf;});if(!_0x4294aa[_0xef9a('0xdd')]){return db['sequelize']['transaction'](function(_0x1621d0){return db[_0xef9a('0xde')][_0xef9a('0xdf')](_0x2fec2a,{'transaction':_0x1621d0});});}}})[_0xef9a('0x18')](function(){if(_0x130879){_0x5bbb5b=_0x130879;return db['MailAccount'][_0xef9a('0x79')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xef9a('0xe0')],'as':_0xef9a('0xe0'),'raw':!![]}]}]});}})['then'](function(_0x59d138){if(_0x59d138&&_0x59d138[_0xef9a('0xe1')]&&_0x4294aa[_0xef9a('0xe2')]&&_0x4294aa['forwardOfflineAddress']){var _0x20e7da=_0x59d138[_0xef9a('0xe3')]();return respondWithRpcPromise(_0xef9a('0xe4'),_0xef9a('0xe5'),{'account':_0x20e7da,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x59d138[_0xef9a('0x2f')],_0x59d138['email']||_0x59d138[_0xef9a('0xe1')][_0xef9a('0x6d')]),'to':_0x4294aa[_0xef9a('0xe6')],'subject':_0x4294aa['offlineMessageSubject'],'html':_0x5bbb5b[_0xef9a('0x76')],'attachments':_0x1d3c6c}},client9003)['then'](function(){return _0x5bbb5b;})[_0xef9a('0x21')](function(_0x27a68e){logger['error'](_0x27a68e);});}})[_0xef9a('0x18')](function(){if(_0x4294aa&&_0x4294aa[_0xef9a('0xdd')]&&_0x4294aa['MailAccountId']){var _0x3f7cb5=[];if(_0x412c9b[_0xef9a('0x6a')]){_0x3f7cb5=_0x412c9b[_0xef9a('0x52')](function(_0x21dd6e){return{'name':_0x21dd6e['originalname'],'basename':_0x21dd6e[_0xef9a('0x84')],'type':_0x21dd6e['mimetype'],'ChatOfflineMessageId':_0x130879['id']};});}var _0x56180b;if(!_['isNil'](_0x4294aa[_0xef9a('0xe7')])){var _0x4bb8d8=_['map'](_0x882a9f['body'],function(_0x1d7af0){return _0x1d7af0;});var _0xe0e2c4=_[_0xef9a('0xe8')](_0x4bb8d8)[0x0];var _0x5646cd=_[_0xef9a('0xe9')](_0xe0e2c4,function(_0x458c4e){return _0x458c4e;});_0x56180b=_0x5646cd[0x1][_0x4294aa[_0xef9a('0xe7')]];}var _0x5f47d8={'from':_0x40e66c['email'],'firstName':_0x40e66c[_0xef9a('0x45')],'lastName':_0x40e66c[_0xef9a('0x46')],'mapKey':_0xef9a('0xea'),'message':{'from':_0x40e66c['email'],'to':_0x4294aa[_0xef9a('0xd2')][_0xef9a('0xea')],'cc':'','subject':_[_0xef9a('0x8c')](_0x56180b)?_0x4294aa[_0xef9a('0xeb')]:_0x56180b,'messageId':'','sentAt':new Date(),'attach':_0x3f7cb5['length'],'attachments':_0x3f7cb5,'originChannel':_0xef9a('0xec'),'ChatWebsiteId':_0x4294aa['id'],'ChatOfflineMessageId':_0x5bbb5b['id'],'originTo':_0x4294aa['MailAccount'][_0xef9a('0xea')]},'body':_0x5bbb5b[_0xef9a('0x76')]};var _0x3d98b0={'account':{'id':_0x4294aa[_0xef9a('0xed')]},'body':_0x5f47d8,'log':_0xef9a('0xee')};return respondWithRpcPromise(_0xef9a('0xee'),_0xef9a('0xef'),_0x3d98b0,client9001)['then'](function(){return _0x5bbb5b;})['catch'](function(_0x5aaf58){logger[_0xef9a('0x1c')](_0x5aaf58);});}return;})[_0xef9a('0x18')](function(){if(_0x5bbb5b){return _0x5bbb5b;}})['then'](respondWithResult(_0x314fc3,null))['catch'](function(){for(var _0x5b93b8 of _0x412c9b){var _0x1f5c59=path['join'](config[_0xef9a('0x8e')],_0xef9a('0xda'),_0xef9a('0xcf'),_0xef9a('0xf0'),_0xef9a('0xdb'),_0x5b93b8[_0xef9a('0x84')]);fs_extra[_0xef9a('0xf1')](_0x1f5c59)['catch'](function(_0x1da22c){logger[_0xef9a('0x1c')](_0xef9a('0xf2'),_0x1f5c59,_0x1da22c);});}});};exports[_0xef9a('0xf3')]=function(_0x4e70db,_0x2f43bd){return db[_0xef9a('0xb7')]['find']({'where':{'id':_0x4e70db['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x2f43bd,null))[_0xef9a('0x18')](function(_0x4d6969){if(_0x4d6969){return _0x4d6969[_0xef9a('0xf3')](_0x4e70db['body'][_0xef9a('0x81')],_['omit'](_0x4e70db[_0xef9a('0x76')],[_0xef9a('0x81'),'id'])||{});}})[_0xef9a('0x18')](respondWithResult(_0x2f43bd,null))[_0xef9a('0x21')](handleError(_0x2f43bd,null));};exports[_0xef9a('0xf4')]=function(_0x61d390,_0x5849e2){var _0x4aef7b={'raw':![],'where':{}};var _0x16726f={};var _0x17f071={'count':0x0,'rows':[]};return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x61d390['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x5849e2,null))['then'](function(_0x4fd5a0){if(_0x4fd5a0){_0x16726f[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xb7')][_0xef9a('0x54')]);_0x16726f['query']=_[_0xef9a('0x69')](_0x61d390[_0xef9a('0x57')]);_0x16726f[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x16726f['model'],_0x16726f[_0xef9a('0x57')]);_0x4aef7b[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x16726f['model'],qs[_0xef9a('0x5b')](_0x61d390[_0xef9a('0x57')][_0xef9a('0x5b')]));_0x4aef7b[_0xef9a('0x5a')]=_0x4aef7b[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x4aef7b[_0xef9a('0x5a')]:_0x16726f[_0xef9a('0x59')];if(!_0x61d390[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x4aef7b[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x61d390[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x4aef7b[_0xef9a('0x28')]=qs['offset'](_0x61d390[_0xef9a('0x57')][_0xef9a('0x28')]);}_0x4aef7b[_0xef9a('0xf5')]=qs['sort'](_0x61d390[_0xef9a('0x57')]['sort']);_0x4aef7b[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x61d390[_0xef9a('0x57')],_0x16726f[_0xef9a('0x61')]));_0x4aef7b[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x4fd5a0['id'];if(_0x61d390[_0xef9a('0x57')]['filter']){_0x4aef7b[_0xef9a('0x5f')]=_['merge'](_0x4aef7b['where'],{'$or':_[_0xef9a('0x52')](_0x4aef7b['attributes'],function(_0x1bfbbf){var _0x4bbcac={};_0x4bbcac[_0x1bfbbf]={'$like':'%'+_0x61d390[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4bbcac;})});}_0x4aef7b=_[_0xef9a('0x63')]({},_0x4aef7b,_0x61d390['options']);return db[_0xef9a('0xb7')][_0xef9a('0x27')]({'where':_0x4aef7b['where']})['then'](function(_0x488939){_0x17f071[_0xef9a('0x27')]=_0x488939;if(_0x61d390[_0xef9a('0x57')][_0xef9a('0x65')]){_0x4aef7b[_0xef9a('0x66')]=[{'model':db[_0xef9a('0x9a')],'as':'Contact','required':![]},{'model':db[_0xef9a('0xc3')],'as':_0xef9a('0xf6'),'attributes':[_0xef9a('0x2f'),'fullname',_0xef9a('0xf7')],'required':![]},{'model':db[_0xef9a('0xf8')],'as':_0xef9a('0xf9'),'attributes':['id',_0xef9a('0x2f'),_0xef9a('0xfa')],'where':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]?{'id':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]}:undefined,'required':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0xef9a('0x7c')](_0x4aef7b);})[_0xef9a('0x18')](function(_0x2b6b24){_0x17f071[_0xef9a('0x67')]=_0x2b6b24;return _0x17f071;});}})[_0xef9a('0x18')](respondWithFilteredResult(_0x5849e2,_0x4aef7b))[_0xef9a('0x21')](handleError(_0x5849e2,null));};exports[_0xef9a('0x31')]=function(_0x369268,_0x4e3826){var _0x29c19d=0x0;var _0x2dcff2=0x0;var _0x548dcd=![];var _0x319f27;var _0x2bed00;return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x369268[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0x3c')],'as':'Interval','include':[{'model':db[_0xef9a('0x3c')],'as':'Intervals','attributes':['id',_0xef9a('0x34')]}]}]})[_0xef9a('0x18')](handleEntityNotFound(_0x4e3826,null))[_0xef9a('0x18')](function(_0x304610){if(_0x304610){_0x319f27=_0x304610;return _0x304610['getProactiveActions']({'raw':!![]});}})[_0xef9a('0x18')](function(_0x4b3783){if(_0x319f27){if(_0x4b3783){_0x2bed00=_0x4b3783;}}return require(_0xef9a('0x8a'))[_0xef9a('0xfc')]();})['then'](function(_0x44cade){if(_0x44cade){_0x2dcff2=_0x44cade[_0xef9a('0xfd')];_0x548dcd=_0x44cade[_0xef9a('0x8b')];}})['then'](function(){return db[_0xef9a('0xb7')][_0xef9a('0x27')]({'where':{'closed':![]}});})['then'](function(_0x1cff2f){_0x29c19d=_0x1cff2f;if(_0x2dcff2&&_0x1cff2f>_0x2dcff2){return db[_0xef9a('0xfe')][_0xef9a('0x79')]({'where':{'id':0x1}})[_0xef9a('0x18')](function(_0x241a3b){if(_0x241a3b){_0x241a3b['increment'](_0xef9a('0xff'));}});}})[_0xef9a('0x18')](function(){if(!_0x319f27[_0xef9a('0x3c')]||!_0x319f27['Interval']['Intervals'])return!![];return checkWebsiteIntervals(_0x319f27);})['then'](function(_0x1daf13){var _0x539bb0=fs['readFileSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x100')),_0xef9a('0x101'));var _0x1dfe7d=new url[(_0xef9a('0x102'))](_0x319f27[_0xef9a('0x103')])[_0xef9a('0x104')];var _0x4a9862=_0xef9a('0x105');var _0x370b34=![];var _0x3ecfdd={'chatVersion':_0x4a9862,'chatWebsiteAddressOrigin':_0x1dfe7d,'remote':_0x319f27[_0xef9a('0x106')],'query':querystring['stringify'](_[_0xef9a('0x63')](_0x319f27[_0xef9a('0x2c')]({'plain':!![]}),{'customerIp':_0x369268[_0xef9a('0x107')][_0xef9a('0x43')]||_0x369268[_0xef9a('0x107')][_0xef9a('0x108')]||_0x369268['connection'][_0xef9a('0x109')]||_0x369268['ip'],'referer':_0x369268['headers'][_0xef9a('0x48')],'openedInteractions':_0x29c19d,'maxInteractions':_0x2dcff2,'virtual':_0x548dcd['virtual'],'online':_0x1daf13,'custom':_0x548dcd}))[_0xef9a('0x10a')](/'/g,'\x5c\x27')};_0x4e3826[_0xef9a('0x30')](ejs[_0xef9a('0xd6')](Mustache[_0xef9a('0xd6')](_0x539bb0,_0x3ecfdd),{'proactiveActions':_0x2bed00,'alignment':_0x319f27['alignment'],'verticalAlignment':_0x319f27['verticalAlignment'],'div_color':_0x319f27[_0xef9a('0xfa')],'labelText':_0x319f27[_0xef9a('0x10b')],'text_color':_0x319f27[_0xef9a('0x10c')],'text_button_color':_0x319f27[_0xef9a('0x10d')],'button_color':_0x319f27['color_button'],'background_color':_0x319f27['backgroundColor'],'hideWhenOffline':_0x319f27[_0xef9a('0x10e')],'intervalId':_0x319f27['IntervalId'],'isDevelopment':_0x370b34,'chatVersion':_0x4a9862}));})[_0xef9a('0x21')](handleError(_0x4e3826,null));};exports[_0xef9a('0x10f')]=function(_0x2fb277,_0x283199){var _0x57946e=_0x2fb277[_0xef9a('0x68')]['id'];var _0x6e33f8=_0x2fb277[_0xef9a('0x76')];var _0x134f68=0xc8;var _0x5cbba7=null;return db[_0xef9a('0x110')]['transaction']({'isolationLevel':db[_0xef9a('0x110')]['Transaction'][_0xef9a('0x111')][_0xef9a('0x112')]},function(_0x4ac7b9){return db['ChatWebsite'][_0xef9a('0x79')]({'where':{'id':_0x57946e},'transaction':_0x4ac7b9})[_0xef9a('0x18')](function(_0x45cf6f){if(_0x45cf6f){return db['ChatApplication'][_0xef9a('0x2b')]({'where':{'ChatWebsiteId':_0x57946e},'transaction':_0x4ac7b9})[_0xef9a('0x18')](function(){var _0x27ec8c=_['map'](_0x6e33f8,function(_0x193dae){_0x193dae[_0xef9a('0x7b')]=_0x57946e;return _0x193dae;});return db[_0xef9a('0xac')][_0xef9a('0xdf')](_0x27ec8c,{'transaction':_0x4ac7b9});});}else{_0x134f68=0x194;_0x5cbba7=[];}});})['then'](function(){if(_0x134f68!==0x194){return db[_0xef9a('0xac')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x57946e},'order':_0xef9a('0xb1')})[_0xef9a('0x18')](function(_0xcc2d07){_0x5cbba7=_0xcc2d07;});}})[_0xef9a('0x21')](function(_0x47a9ec){_0x134f68=0x1f4;logger[_0xef9a('0x1c')](_0x47a9ec[_0xef9a('0x2e')]);if(_0x47a9ec[_0xef9a('0x2f')]){delete _0x47a9ec['name'];}_0x5cbba7=_0x47a9ec;})[_0xef9a('0x113')](function(){if(_0x5cbba7===null){_0x283199[_0xef9a('0x22')](_0x134f68);}else{if(_0x134f68===0x1f4){_0x283199[_0xef9a('0x23')](_0x134f68)['send'](_0x5cbba7);}else{_0x283199[_0xef9a('0x23')](_0x134f68)[_0xef9a('0x25')](_0x5cbba7);}}});};exports[_0xef9a('0x114')]=function(_0x2b925c,_0x427587){var _0x51ea32={};var _0x2c18d9={};var _0x3842d0;var _0x196879;return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x2b925c[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x427587,null))[_0xef9a('0x18')](function(_0x8badeb){if(_0x8badeb){_0x3842d0=_0x8badeb;_0x2c18d9[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xac')]['rawAttributes']);_0x2c18d9[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2b925c[_0xef9a('0x57')]);_0x2c18d9[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x2c18d9[_0xef9a('0x59')],_0x2c18d9[_0xef9a('0x57')]);_0x51ea32[_0xef9a('0x5a')]=_['intersection'](_0x2c18d9[_0xef9a('0x59')],qs['fields'](_0x2b925c['query'][_0xef9a('0x5b')]));_0x51ea32['attributes']=_0x51ea32['attributes']['length']?_0x51ea32[_0xef9a('0x5a')]:_0x2c18d9[_0xef9a('0x59')];_0x51ea32['order']=qs[_0xef9a('0x5e')](_0x2b925c[_0xef9a('0x57')]['sort']);_0x51ea32[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_['pick'](_0x2b925c['query'],_0x2c18d9['filters']));if(_0x2b925c[_0xef9a('0x57')][_0xef9a('0x62')]){_0x51ea32[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x51ea32[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x51ea32['attributes'],function(_0x450b9d){var _0x4d8f9b={};_0x4d8f9b[_0x450b9d]={'$like':'%'+_0x2b925c[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4d8f9b;})});}_0x51ea32=_[_0xef9a('0x63')]({},_0x51ea32,_0x2b925c[_0xef9a('0x64')]);return _0x3842d0[_0xef9a('0x114')](_0x51ea32);}})[_0xef9a('0x18')](function(_0x119fdd){if(_0x119fdd){_0x196879=_0x119fdd[_0xef9a('0x6a')];if(!_0x2b925c['query'][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x51ea32[_0xef9a('0x5d')]=qs['limit'](_0x2b925c[_0xef9a('0x57')]['limit']);_0x51ea32[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x2b925c[_0xef9a('0x57')]['offset']);}return _0x3842d0['getApplications'](_0x51ea32);}})['then'](function(_0x7f4348){if(_0x7f4348){return _0x7f4348?{'count':_0x196879,'rows':_0x7f4348}:null;}})['then'](respondWithResult(_0x427587,null))[_0xef9a('0x21')](handleError(_0x427587,null));};exports[_0xef9a('0x115')]=function(_0x2f7f5e,_0x221c41){return db[_0xef9a('0x116')][_0xef9a('0x6b')]({'where':{'id':_0x2f7f5e[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x221c41,null))[_0xef9a('0x18')](function(_0x384267){if(_0x384267){return _0x384267[_0xef9a('0x115')](_0x2f7f5e['body']['ids'],_[_0xef9a('0x117')](_0x2f7f5e[_0xef9a('0x76')],['ids','id'])||{});}})[_0xef9a('0x18')](respondWithResult(_0x221c41,null))[_0xef9a('0x21')](handleError(_0x221c41,null));};exports['getProactiveActions']=function(_0x2f5fca,_0x466671){var _0x1d7fe6={};var _0x324f27={};var _0x40a6cc;var _0x408928;return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x2f5fca[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x466671,null))[_0xef9a('0x18')](function(_0x4fe22a){if(_0x4fe22a){_0x40a6cc=_0x4fe22a;_0x324f27['model']=_['keys'](db[_0xef9a('0x118')][_0xef9a('0x54')]);_0x324f27[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2f5fca['query']);_0x324f27[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x324f27[_0xef9a('0x59')],_0x324f27['query']);_0x1d7fe6[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x324f27[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x2f5fca['query'][_0xef9a('0x5b')]));_0x1d7fe6[_0xef9a('0x5a')]=_0x1d7fe6[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x1d7fe6[_0xef9a('0x5a')]:_0x324f27[_0xef9a('0x59')];_0x1d7fe6[_0xef9a('0xf5')]=qs[_0xef9a('0x5e')](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x1d7fe6[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x2f5fca[_0xef9a('0x57')],_0x324f27[_0xef9a('0x61')]));if(_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x62')]){_0x1d7fe6['where']=_[_0xef9a('0x63')](_0x1d7fe6[_0xef9a('0x5f')],{'$or':_['map'](_0x1d7fe6['attributes'],function(_0x3587ec){var _0x41e5f0={};_0x41e5f0[_0x3587ec]={'$like':'%'+_0x2f5fca[_0xef9a('0x57')]['filter']+'%'};return _0x41e5f0;})});}_0x1d7fe6=_['merge']({},_0x1d7fe6,_0x2f5fca[_0xef9a('0x64')]);return _0x40a6cc[_0xef9a('0x119')](_0x1d7fe6);}})[_0xef9a('0x18')](function(_0x4de82d){if(_0x4de82d){_0x408928=_0x4de82d['length'];if(!_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x1d7fe6[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x1d7fe6['offset']=qs['offset'](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x28')]);}return _0x40a6cc[_0xef9a('0x119')](_0x1d7fe6);}})[_0xef9a('0x18')](function(_0x1fe7e2){if(_0x1fe7e2){return _0x1fe7e2?{'count':_0x408928,'rows':_0x1fe7e2}:null;}})[_0xef9a('0x18')](respondWithResult(_0x466671,null))[_0xef9a('0x21')](handleError(_0x466671,null));};exports[_0xef9a('0x11a')]=function(_0x16e549,_0x268415){var _0x6b34a5=_0x16e549[_0xef9a('0x57')][_0xef9a('0x11b')]===_0xef9a('0x11c')?'offlineForm':_0xef9a('0x11d');return db[_0xef9a('0x53')]['find']({'attributes':['id',_0x6b34a5],'where':{'id':_0x16e549[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x268415,null))[_0xef9a('0x18')](function(_0x4c54ca){if(_0x4c54ca){var _0x8f8c85=_0x4c54ca[_0x6b34a5];var _0x38d3e9=_0x8f8c85&&_0x8f8c85[_0xef9a('0x11e')]?_0x8f8c85[_0xef9a('0x11e')]:[];_0x268415[_0xef9a('0x30')]({'fromKey':_[_0xef9a('0x8c')](_0x8f8c85['fromKey'])?undefined:_0x8f8c85[_0xef9a('0x11f')],'count':_0x38d3e9['length'],'rows':_0x38d3e9});}})[_0xef9a('0x21')](handleError(_0x268415,null));};exports['getOfflineMessages']=function(_0x19d0e7,_0x28b56f){var _0x2d86d4={'raw':![],'where':{}};var _0x11a5ef={};var _0x38a9ce={'count':0x0,'rows':[]};return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x19d0e7[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x28b56f,null))[_0xef9a('0x18')](function(_0x2052e4){if(_0x2052e4){_0x11a5ef[_0xef9a('0x59')]=_['keys'](db[_0xef9a('0xd8')][_0xef9a('0x54')]);_0x11a5ef['query']=_[_0xef9a('0x69')](_0x19d0e7['query']);_0x11a5ef[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x11a5ef['model'],_0x11a5ef[_0xef9a('0x57')]);_0x2d86d4[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x11a5ef[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x19d0e7[_0xef9a('0x57')]['fields']));_0x2d86d4[_0xef9a('0x5a')]=_0x2d86d4['attributes'][_0xef9a('0x6a')]?_0x2d86d4[_0xef9a('0x5a')]:_0x11a5ef['model'];if(!_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x2d86d4[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x2d86d4[_0xef9a('0x28')]=qs['offset'](_0x19d0e7['query']['offset']);}_0x2d86d4['order']=qs['sort'](_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x2d86d4[_0xef9a('0x5f')]=qs['filters'](_['pick'](_0x19d0e7[_0xef9a('0x57')],_0x11a5ef[_0xef9a('0x61')]));_0x2d86d4[_0xef9a('0x5f')]['ChatWebsiteId']=_0x2052e4['id'];if(_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x62')]){_0x2d86d4[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x2d86d4[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x2d86d4['attributes'],function(_0x50ac60){var _0x347ed0={};_0x347ed0[_0x50ac60]={'$like':'%'+_0x19d0e7[_0xef9a('0x57')]['filter']+'%'};return _0x347ed0;})});}_0x2d86d4=_['merge']({},_0x2d86d4,_0x19d0e7['options']);return db[_0xef9a('0xd8')][_0xef9a('0x27')]({'where':_0x2d86d4[_0xef9a('0x5f')]})[_0xef9a('0x18')](function(_0x19a6a0){_0x38a9ce[_0xef9a('0x27')]=_0x19a6a0;if(_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x65')]){_0x2d86d4[_0xef9a('0x66')]=[{'all':!![]}];}else{_0x2d86d4[_0xef9a('0x66')]=[{'model':db[_0xef9a('0x9a')],'as':_0xef9a('0x120'),'required':![]},{'model':db[_0xef9a('0xde')],'as':'Attachments','required':![]}];}return db[_0xef9a('0xd8')][_0xef9a('0x7c')](_0x2d86d4);})[_0xef9a('0x18')](function(_0x17c0d3){_0x38a9ce[_0xef9a('0x67')]=_0x17c0d3;return _0x38a9ce;});}})['then'](respondWithFilteredResult(_0x28b56f,_0x2d86d4))['catch'](handleError(_0x28b56f,null));};exports[_0xef9a('0x121')]=function(_0x119f0b,_0x1672bc){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x119f0b['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x1672bc,null))['then'](function(_0x379c4a){if(_0x379c4a){return _0x379c4a[_0xef9a('0x121')](_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')],_['omit'](_0x119f0b[_0xef9a('0x76')],[_0xef9a('0x81'),'id'])||{})['spread'](function(_0x1613bf){for(var _0x355738=0x0;_0x355738<_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')][_0xef9a('0x6a')];_0x355738+=0x1){socket['emit'](_0xef9a('0x122'),{'UserId':Number(_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')][_0x355738]),'ChatWebsiteId':Number(_0x119f0b['params']['id'])});}return _0x1613bf;});}})[_0xef9a('0x18')](respondWithResult(_0x1672bc,null))[_0xef9a('0x21')](handleError(_0x1672bc,null));};exports['removeAgents']=function(_0x2f8f4e,_0x3e9808){return db[_0xef9a('0x53')]['find']({'where':{'id':_0x2f8f4e[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x3e9808,null))[_0xef9a('0x18')](function(_0x136eba){if(_0x136eba){return _0x136eba[_0xef9a('0x123')](_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')])[_0xef9a('0x18')](function(){if(_[_0xef9a('0x124')](_0x2f8f4e['query'][_0xef9a('0x81')])){for(var _0x480723=0x0;_0x480723<_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')]['length'];_0x480723+=0x1){socket[_0xef9a('0x125')](_0xef9a('0x126'),{'UserId':Number(_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')][_0x480723]),'ChatWebsiteId':Number(_0x2f8f4e[_0xef9a('0x68')]['id'])});}}else{socket[_0xef9a('0x125')](_0xef9a('0x126'),{'UserId':Number(_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')]),'ChatWebsiteId':Number(_0x2f8f4e[_0xef9a('0x68')]['id'])});}});}})[_0xef9a('0x18')](respondWithStatusCode(_0x3e9808,null))[_0xef9a('0x21')](handleError(_0x3e9808,null));};exports[_0xef9a('0x127')]=function(_0x4025f4,_0x1fe2d5){var _0x2773a0={};var _0x186ec9={};var _0x5dd7f1;var _0x1fd9a8;return db[_0xef9a('0x53')]['findOne']({'where':{'id':_0x4025f4['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x1fe2d5,null))[_0xef9a('0x18')](function(_0x77fc1a){if(_0x77fc1a){_0x5dd7f1=_0x77fc1a;_0x186ec9[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xc3')]['rawAttributes']);_0x186ec9['query']=_[_0xef9a('0x69')](_0x4025f4[_0xef9a('0x57')]);_0x186ec9[_0xef9a('0x61')]=_['intersection'](_0x186ec9[_0xef9a('0x59')],_0x186ec9[_0xef9a('0x57')]);_0x2773a0[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x186ec9['model'],qs[_0xef9a('0x5b')](_0x4025f4[_0xef9a('0x57')]['fields']));_0x2773a0[_0xef9a('0x5a')]=_0x2773a0[_0xef9a('0x5a')]['length']?_0x2773a0[_0xef9a('0x5a')]:_0x186ec9[_0xef9a('0x59')];_0x2773a0[_0xef9a('0xf5')]=qs[_0xef9a('0x5e')](_0x4025f4['query'][_0xef9a('0x5e')]);_0x2773a0[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x4025f4[_0xef9a('0x57')],_0x186ec9[_0xef9a('0x61')]));if(_0x4025f4['query'][_0xef9a('0x62')]){_0x2773a0[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x2773a0[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x2773a0[_0xef9a('0x5a')],function(_0x366463){var _0x579605={};_0x579605[_0x366463]={'$like':'%'+_0x4025f4[_0xef9a('0x57')]['filter']+'%'};return _0x579605;})});}_0x2773a0=_[_0xef9a('0x63')]({},_0x2773a0,_0x4025f4['options']);return _0x5dd7f1[_0xef9a('0x127')](_0x2773a0);}})[_0xef9a('0x18')](function(_0x213153){if(_0x213153){_0x1fd9a8=_0x213153['length'];if(!_0x4025f4['query'][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x2773a0['limit']=qs['limit'](_0x4025f4['query'][_0xef9a('0x5d')]);_0x2773a0[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x4025f4[_0xef9a('0x57')][_0xef9a('0x28')]);}return _0x5dd7f1['getAgents'](_0x2773a0);}})[_0xef9a('0x18')](function(_0x55b55d){if(_0x55b55d){return _0x55b55d?{'count':_0x1fd9a8,'rows':_0x55b55d}:null;}})[_0xef9a('0x18')](respondWithResult(_0x1fe2d5,null))['catch'](handleError(_0x1fe2d5,null));}; \ No newline at end of file +var _0xb3e5=['pick','ChatWebsiteId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','download','notify','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','orderBy','priority','asc','from','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','applications','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','queue','startRouting','EventManager','ListId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','files','attachments','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','email','originalname','subjectOffline','toPairsIn','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','increment','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','virtual','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','sendStatus','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','url','../../components/parsers/qs','api','APIOutOfIntervalError','../../errors/api','APINotFoundError','handleError','defaults','register','http','client','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','Command','getSnippet','format','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','catch','inspect','map','Interval','Intervals','all','some','setUA','user-agent','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne'];(function(_0x574a38,_0x23c116){var _0x47084c=function(_0x1a2e6a){while(--_0x1a2e6a){_0x574a38['push'](_0x574a38['shift']());}};_0x47084c(++_0x23c116);}(_0xb3e5,0xb9));var _0x5b3e=function(_0x55b114,_0xe1c816){_0x55b114=_0x55b114-0x0;var _0xa1156a=_0xb3e5[_0x55b114];return _0xa1156a;};'use strict';var Mustache=require(_0x5b3e('0x0'));var util=require(_0x5b3e('0x1'));var path=require(_0x5b3e('0x2'));var ejs=require(_0x5b3e('0x3'));var fs=require('fs');var fs_extra=require(_0x5b3e('0x4'));var _=require(_0x5b3e('0x5'));var querystring=require(_0x5b3e('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x5b3e('0x7'));var jayson=require(_0x5b3e('0x8'));var url=require(_0x5b3e('0x9'));var qs=require(_0x5b3e('0xa'));var logger=require('../../config/logger')(_0x5b3e('0xb'));var config=require('../../config/environment');var APIOutOfIntervalError=require('../../errors/api')[_0x5b3e('0xc')];var APINotFoundError=require(_0x5b3e('0xd'))[_0x5b3e('0xe')];var APIHandleError=require(_0x5b3e('0xd'))[_0x5b3e('0xf')];var db=require('../../mysqldb')['db'];config['redis']=_[_0x5b3e('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x5b3e('0x11')](socket);var client=jayson['client'][_0x5b3e('0x12')]({'port':0x232c});var client9002=jayson[_0x5b3e('0x13')][_0x5b3e('0x12')]({'port':0x232a});var client9003=jayson[_0x5b3e('0x13')][_0x5b3e('0x12')]({'port':0x232b});var client9001=jayson['client'][_0x5b3e('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x3ed8d2,_0x1b7740,_0x1e27cb,_0x30a73f){return new Promise(function(_0x21499d,_0x51322a){var _0x3b5e8b=_0x30a73f||client;return _0x3b5e8b[_0x5b3e('0x14')](_0x3ed8d2,_0x1e27cb)['then'](function(_0x548a66){logger[_0x5b3e('0x15')](_0x5b3e('0x16'),_0x1b7740,_0x5b3e('0x17'));logger[_0x5b3e('0x18')](_0x5b3e('0x19'),_0x1b7740,_0x5b3e('0x17'),JSON[_0x5b3e('0x1a')](_0x548a66));if(_0x548a66[_0x5b3e('0x1b')]){if(_0x548a66['error'][_0x5b3e('0x1c')]===0x1f4){logger['error'](_0x5b3e('0x16'),_0x1b7740,_0x548a66[_0x5b3e('0x1b')][_0x5b3e('0x1d')]);return _0x51322a(_0x548a66['error'][_0x5b3e('0x1d')]);}logger['error'](_0x5b3e('0x16'),_0x1b7740,_0x548a66[_0x5b3e('0x1b')]['message']);return _0x21499d(_0x548a66[_0x5b3e('0x1b')][_0x5b3e('0x1d')]);}else{logger[_0x5b3e('0x15')](_0x5b3e('0x16'),_0x1b7740,_0x5b3e('0x17'));_0x21499d(_0x548a66[_0x5b3e('0x1e')][_0x5b3e('0x1d')]);}})['catch'](function(_0xf582e5){logger[_0x5b3e('0x1b')](_0x5b3e('0x16'),_0x1b7740,_0xf582e5);_0x51322a(_0xf582e5);});});}function respondWithStatusCode(_0x45a90e,_0x16f5e6){_0x16f5e6=_0x16f5e6||0xcc;return function(_0x1470d6){if(_0x1470d6){return _0x45a90e['sendStatus'](_0x16f5e6);}return _0x45a90e[_0x5b3e('0x1f')](_0x16f5e6)[_0x5b3e('0x20')]();};}function respondWithResult(_0x5d2347,_0x1a8a1c){_0x1a8a1c=_0x1a8a1c||0xc8;return function(_0x48e052){if(_0x48e052){return _0x5d2347[_0x5b3e('0x1f')](_0x1a8a1c)[_0x5b3e('0x21')](_0x48e052);}};}function respondWithFilteredResult(_0x59f95f,_0xd3f0e6){return function(_0x217bba){if(_0x217bba){var _0x1619ef=typeof _0xd3f0e6['offset']==='undefined'&&typeof _0xd3f0e6[_0x5b3e('0x22')]===_0x5b3e('0x23');var _0x4b6b23=_0x217bba[_0x5b3e('0x24')];var _0xf19eca=_0x1619ef?0x0:_0xd3f0e6[_0x5b3e('0x25')];var _0x466d0c=_0x1619ef?_0x217bba['count']:_0xd3f0e6[_0x5b3e('0x25')]+_0xd3f0e6[_0x5b3e('0x22')];var _0x281e6a;if(_0x466d0c>=_0x4b6b23){_0x466d0c=_0x4b6b23;_0x281e6a=0xc8;}else{_0x281e6a=0xce;}_0x59f95f[_0x5b3e('0x1f')](_0x281e6a);return _0x59f95f[_0x5b3e('0x26')](_0x5b3e('0x27'),_0xf19eca+'-'+_0x466d0c+'/'+_0x4b6b23)[_0x5b3e('0x21')](_0x217bba);}return null;};}function saveUpdates(_0x536206){return function(_0x13ab09){if(_0x13ab09){return _0x13ab09[_0x5b3e('0x28')](_0x536206)[_0x5b3e('0x29')](function(_0x16edd5){return _0x16edd5;});}return null;};}function removeEntity(_0x3547f7){return function(_0x1db87b){if(_0x1db87b){return _0x1db87b[_0x5b3e('0x2a')]()[_0x5b3e('0x29')](function(){var _0xcb5f0e=_0x1db87b[_0x5b3e('0x2b')]({'plain':!![]});var _0x186c8f='ChatWebsites';return db[_0x5b3e('0x2c')]['destroy']({'where':{'type':_0x186c8f,'resourceId':_0xcb5f0e['id']}})['then'](function(){return _0x1db87b;});})[_0x5b3e('0x29')](function(){_0x3547f7[_0x5b3e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c43df){return function(_0xedc72b){if(!_0xedc72b){_0x2c43df['sendStatus'](0x194);}return _0xedc72b;};}function handleError(_0x33e60d,_0x4eccbf){_0x4eccbf=_0x4eccbf||0x1f4;return function(_0x3478f9){logger[_0x5b3e('0x1b')](_0x3478f9[_0x5b3e('0x2d')]);if(_0x3478f9['name']){delete _0x3478f9[_0x5b3e('0x2e')];}_0x33e60d[_0x5b3e('0x1f')](_0x4eccbf)[_0x5b3e('0x2f')](_0x3478f9);};}function iftimePromise(_0x18a451,_0x29d8d0){return respondWithRpcPromise(_0x5b3e('0x30'),_0x5b3e('0x31'),{'command':_0x29d8d0['timezone']?util[_0x5b3e('0x32')](_0x5b3e('0x33'),_0x18a451['interval'],_0x29d8d0[_0x5b3e('0x34')]):util[_0x5b3e('0x32')](_0x5b3e('0x35'),_0x18a451[_0x5b3e('0x36')])},client9002)[_0x5b3e('0x29')](function(_0x528afb){var _0x5603e5=_0x528afb&&_0x528afb[_0x5b3e('0x37')](_0x5b3e('0x38'))>=0x0?!![]:![];logger['info'](_0x5b3e('0x39'),_0x29d8d0['id'],_0x18a451['id'],_0x18a451[_0x5b3e('0x36')],_0x5603e5?'ONLINE':_0x5b3e('0x3a'),_0x29d8d0[_0x5b3e('0x34')]?_0x29d8d0[_0x5b3e('0x34')]:_0x5b3e('0x3b'));return _0x5603e5;})[_0x5b3e('0x3c')](function(_0x46c73f){logger[_0x5b3e('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x29d8d0['id'],_0x18a451['id'],_0x18a451[_0x5b3e('0x36')],util[_0x5b3e('0x3d')](_0x46c73f,{'showHidden':![],'depth':null}),_0x29d8d0[_0x5b3e('0x34')]?_0x29d8d0[_0x5b3e('0x34')]:_0x5b3e('0x3b'));return![];});}function checkWebsiteIntervals(_0x1373cb){var _0xb0ac69=_[_0x5b3e('0x3e')](_0x1373cb[_0x5b3e('0x3f')][_0x5b3e('0x40')],function(_0x5dc88e){var _0x546a9e=_0x5dc88e[_0x5b3e('0x2b')]({'plain':!![]});return iftimePromise(_0x546a9e,_0x1373cb);});return Promise[_0x5b3e('0x41')](_0xb0ac69)[_0x5b3e('0x29')](function(_0xad3af9){return _[_0x5b3e('0x42')](_0xad3af9);});}function createInteractionObject(_0xdc6508,_0x3a2178,_0x40b74f,_0x3c57d7){var _0xdbeee7=require('user-agent-parser');var _0x43dc0b=new _0xdbeee7();var _0x12ffd3=_0x43dc0b[_0x5b3e('0x43')](_0x40b74f[_0x5b3e('0x44')])['getResult']();var _0x2fb6be=_0x3a2178['customerIp'];if(_0x40b74f['cf-connecting-ip']){_0x2fb6be=_0x40b74f['cf-connecting-ip'];}else if(_0x40b74f[_0x5b3e('0x45')]){_0x2fb6be=_['first'](_0x40b74f['x-forwarded-for'][_0x5b3e('0x46')](','));}return{'ContactId':_0x3c57d7['id'],'ChatWebsiteId':_0xdc6508,'from':(_0x3c57d7[_0x5b3e('0x47')]||'')+'\x20'+(_0x3c57d7[_0x5b3e('0x48')]||''),'customerIp':_0x2fb6be,'customerPort':_0x40b74f[_0x5b3e('0x49')]?_0x40b74f[_0x5b3e('0x49')]:null,'referer':_0x3a2178[_0x5b3e('0x4a')],'browserName':_0x12ffd3[_0x5b3e('0x4b')][_0x5b3e('0x2e')]&&_0x12ffd3[_0x5b3e('0x4b')][_0x5b3e('0x4c')]?util[_0x5b3e('0x32')]('%s\x20%s',_0x12ffd3['browser'][_0x5b3e('0x2e')],_0x12ffd3['browser'][_0x5b3e('0x4c')]):_0x5b3e('0x4d'),'browserVersion':_0x12ffd3[_0x5b3e('0x4b')][_0x5b3e('0x4c')]||_0x5b3e('0x4d'),'osName':util['format']('%s\x20%s',_0x12ffd3['os'][_0x5b3e('0x2e')],_0x12ffd3['os']['version']),'osVersion':_0x12ffd3['os'][_0x5b3e('0x4c')],'deviceModel':_0x12ffd3[_0x5b3e('0x4e')]['model']&&_0x12ffd3[_0x5b3e('0x4e')][_0x5b3e('0x4f')]?util['format'](_0x5b3e('0x50'),_0x12ffd3[_0x5b3e('0x4e')][_0x5b3e('0x51')],_0x12ffd3['device'][_0x5b3e('0x4f')],_0x12ffd3[_0x5b3e('0x4e')]['type']):null,'deviceVendor':_0x12ffd3[_0x5b3e('0x4e')]['vendor'],'deviceType':_0x12ffd3[_0x5b3e('0x4e')][_0x5b3e('0x52')],'formData':JSON['stringify'](_0x3a2178)};}exports[_0x5b3e('0x53')]=function(_0x3a0d6c,_0x4146d4){var _0x166cda={'include':[{'model':db[_0x5b3e('0x54')],'as':_0x5b3e('0x55')}]},_0x3d4275={},_0x4835ef={'count':0x0,'rows':[]};var _0x5a6f45=_['map'](db[_0x5b3e('0x56')][_0x5b3e('0x57')],function(_0x50f97e){return{'name':_0x50f97e[_0x5b3e('0x58')],'type':_0x50f97e[_0x5b3e('0x52')]['key']};});_0x3d4275[_0x5b3e('0x51')]=_[_0x5b3e('0x3e')](_0x5a6f45,'name');_0x3d4275[_0x5b3e('0x59')]=_[_0x5b3e('0x5a')](_0x3a0d6c[_0x5b3e('0x59')]);_0x3d4275[_0x5b3e('0x5b')]=_[_0x5b3e('0x5c')](_0x3d4275[_0x5b3e('0x51')],_0x3d4275[_0x5b3e('0x59')]);_0x166cda['attributes']=_['intersection'](_0x3d4275['model'],qs['fields'](_0x3a0d6c[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x166cda[_0x5b3e('0x5e')]=_0x166cda[_0x5b3e('0x5e')][_0x5b3e('0x5f')]?_0x166cda[_0x5b3e('0x5e')]:_0x3d4275[_0x5b3e('0x51')];if(!_0x3a0d6c[_0x5b3e('0x59')][_0x5b3e('0x60')](_0x5b3e('0x61'))){_0x166cda[_0x5b3e('0x22')]=qs[_0x5b3e('0x22')](_0x3a0d6c[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x166cda['offset']=qs['offset'](_0x3a0d6c[_0x5b3e('0x59')][_0x5b3e('0x25')]);}_0x166cda[_0x5b3e('0x62')]=qs['sort'](_0x3a0d6c['query'][_0x5b3e('0x63')]);_0x166cda[_0x5b3e('0x64')]=qs[_0x5b3e('0x5b')](_['pick'](_0x3a0d6c[_0x5b3e('0x59')],_0x3d4275[_0x5b3e('0x5b')]),_0x5a6f45);if(_0x3a0d6c[_0x5b3e('0x59')]['filter']){_0x166cda[_0x5b3e('0x64')]=_[_0x5b3e('0x65')](_0x166cda['where'],{'$or':_[_0x5b3e('0x3e')](_0x5a6f45,function(_0x1a20d4){if(_0x1a20d4[_0x5b3e('0x52')]!==_0x5b3e('0x66')){var _0x1a83b1={};_0x1a83b1[_0x1a20d4[_0x5b3e('0x2e')]]={'$like':'%'+_0x3a0d6c[_0x5b3e('0x59')][_0x5b3e('0x67')]+'%'};return _0x1a83b1;}})});}_0x166cda=_[_0x5b3e('0x65')]({},_0x166cda,_0x3a0d6c[_0x5b3e('0x68')]);var _0x376a00={'where':_0x166cda[_0x5b3e('0x64')]};return db[_0x5b3e('0x56')][_0x5b3e('0x24')](_0x376a00)[_0x5b3e('0x29')](function(_0x237765){_0x4835ef[_0x5b3e('0x24')]=_0x237765;if(_0x3a0d6c['query'][_0x5b3e('0x69')]){_0x166cda['include']=[{'all':!![]}];}return db[_0x5b3e('0x56')][_0x5b3e('0x6a')](_0x166cda);})[_0x5b3e('0x29')](function(_0x33fb47){_0x4835ef[_0x5b3e('0x6b')]=_0x33fb47;return _0x4835ef;})['then'](respondWithFilteredResult(_0x4146d4,_0x166cda))[_0x5b3e('0x3c')](handleError(_0x4146d4,null));};exports[_0x5b3e('0x6c')]=function(_0x1774b3,_0x223eb3){var _0x39a95f={'raw':![],'where':{'id':_0x1774b3[_0x5b3e('0x6d')]['id']},'include':[{'model':db['Pause'],'as':_0x5b3e('0x55')}]},_0x5e873f={};_0x5e873f[_0x5b3e('0x51')]=_[_0x5b3e('0x5a')](db[_0x5b3e('0x56')][_0x5b3e('0x57')]);_0x5e873f[_0x5b3e('0x59')]=_[_0x5b3e('0x5a')](_0x1774b3[_0x5b3e('0x59')]);_0x5e873f[_0x5b3e('0x5b')]=_['intersection'](_0x5e873f[_0x5b3e('0x51')],_0x5e873f[_0x5b3e('0x59')]);_0x39a95f['attributes']=_[_0x5b3e('0x5c')](_0x5e873f['model'],qs[_0x5b3e('0x5d')](_0x1774b3[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x39a95f[_0x5b3e('0x5e')]=_0x39a95f[_0x5b3e('0x5e')][_0x5b3e('0x5f')]?_0x39a95f['attributes']:_0x5e873f[_0x5b3e('0x51')];if(_0x1774b3['query'][_0x5b3e('0x69')]){_0x39a95f['include']=[{'all':!![]}];}_0x39a95f=_[_0x5b3e('0x65')]({},_0x39a95f,_0x1774b3[_0x5b3e('0x68')]);return db[_0x5b3e('0x56')][_0x5b3e('0x6e')](_0x39a95f)[_0x5b3e('0x29')](handleEntityNotFound(_0x223eb3,null))[_0x5b3e('0x29')](respondWithResult(_0x223eb3,null))['catch'](handleError(_0x223eb3,null));};exports[_0x5b3e('0x6f')]=function(_0x12de91,_0x518e61){return db['ChatWebsite']['create'](_0x12de91[_0x5b3e('0x70')],{})[_0x5b3e('0x29')](function(_0x42b073){var _0x59b77c=_0x12de91[_0x5b3e('0x71')][_0x5b3e('0x2b')]({'plain':!![]});if(!_0x59b77c)throw new Error(_0x5b3e('0x72'));if(_0x59b77c[_0x5b3e('0x73')]===_0x5b3e('0x71')){var _0x17b229=_0x42b073[_0x5b3e('0x2b')]({'plain':!![]});var _0x448cbd=_0x5b3e('0x74');return db[_0x5b3e('0x75')][_0x5b3e('0x6e')]({'where':{'name':_0x448cbd,'userProfileId':_0x59b77c['userProfileId']},'raw':!![]})[_0x5b3e('0x29')](function(_0x384d03){if(_0x384d03&&_0x384d03['autoAssociation']===0x0){return db[_0x5b3e('0x2c')][_0x5b3e('0x6f')]({'name':_0x17b229[_0x5b3e('0x2e')],'resourceId':_0x17b229['id'],'type':_0x384d03['name'],'sectionId':_0x384d03['id']},{})['then'](function(){return _0x42b073;});}else{return _0x42b073;}})[_0x5b3e('0x3c')](function(_0x342bf7){logger[_0x5b3e('0x1b')](_0x5b3e('0x76'),_0x342bf7);throw _0x342bf7;});}return _0x42b073;})['then'](respondWithResult(_0x518e61,0xc9))[_0x5b3e('0x3c')](handleError(_0x518e61,null));};exports[_0x5b3e('0x28')]=function(_0x4c05b3,_0x24d2e9){if(_0x4c05b3['body']['id']){delete _0x4c05b3['body']['id'];}return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x4c05b3[_0x5b3e('0x6d')]['id']},'include':[{'model':db['Pause'],'as':_0x5b3e('0x55')}]})[_0x5b3e('0x29')](handleEntityNotFound(_0x24d2e9,null))[_0x5b3e('0x29')](saveUpdates(_0x4c05b3[_0x5b3e('0x70')],null))['then'](respondWithResult(_0x24d2e9,null))[_0x5b3e('0x3c')](handleError(_0x24d2e9,null));};exports[_0x5b3e('0x2a')]=function(_0x170efe,_0x1c6e31){return db[_0x5b3e('0x56')]['find']({'where':{'id':_0x170efe['params']['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x1c6e31,null))['then'](removeEntity(_0x1c6e31,null))[_0x5b3e('0x3c')](handleError(_0x1c6e31,null));};exports['describe']=function(_0x19cb12,_0x3281d5){return db[_0x5b3e('0x56')][_0x5b3e('0x77')]()[_0x5b3e('0x29')](respondWithResult(_0x3281d5,null))[_0x5b3e('0x3c')](handleError(_0x3281d5,null));};exports[_0x5b3e('0x78')]=function(_0x58e12c,_0x38b830){if(_0x58e12c[_0x5b3e('0x70')]['id']){delete _0x58e12c[_0x5b3e('0x70')]['id'];}return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x58e12c['params']['id']}})['then'](handleEntityNotFound(_0x38b830,null))[_0x5b3e('0x29')](function(_0x3d66a5){if(_0x3d66a5){_0x58e12c[_0x5b3e('0x70')]['ChatWebsiteId']=_0x3d66a5['id'];return db[_0x5b3e('0x79')][_0x5b3e('0x6f')](_0x58e12c[_0x5b3e('0x70')]);}})[_0x5b3e('0x29')](respondWithResult(_0x38b830,null))[_0x5b3e('0x3c')](handleError(_0x38b830,null));};exports[_0x5b3e('0x7a')]=function(_0x59ce5f,_0x58628b){var _0x562b55={'raw':![],'where':{}};var _0x2445a2={};var _0x28361f={'count':0x0,'rows':[]};return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x59ce5f[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x58628b,null))[_0x5b3e('0x29')](function(_0x2dc087){if(_0x2dc087){_0x2445a2[_0x5b3e('0x51')]=_[_0x5b3e('0x5a')](db['Disposition']['rawAttributes']);_0x2445a2['query']=_[_0x5b3e('0x5a')](_0x59ce5f['query']);_0x2445a2[_0x5b3e('0x5b')]=_['intersection'](_0x2445a2[_0x5b3e('0x51')],_0x2445a2[_0x5b3e('0x59')]);_0x562b55[_0x5b3e('0x5e')]=_[_0x5b3e('0x5c')](_0x2445a2[_0x5b3e('0x51')],qs[_0x5b3e('0x5d')](_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x562b55[_0x5b3e('0x5e')]=_0x562b55[_0x5b3e('0x5e')]['length']?_0x562b55[_0x5b3e('0x5e')]:_0x2445a2[_0x5b3e('0x51')];if(!_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x60')](_0x5b3e('0x61'))){_0x562b55[_0x5b3e('0x22')]=qs[_0x5b3e('0x22')](_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x562b55['offset']=qs[_0x5b3e('0x25')](_0x59ce5f['query'][_0x5b3e('0x25')]);}_0x562b55[_0x5b3e('0x62')]=qs['sort'](_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x63')]);_0x562b55[_0x5b3e('0x64')]=qs[_0x5b3e('0x5b')](_[_0x5b3e('0x7c')](_0x59ce5f[_0x5b3e('0x59')],_0x2445a2['filters']));_0x562b55['where'][_0x5b3e('0x7d')]=_0x2dc087['id'];if(_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x67')]){_0x562b55[_0x5b3e('0x64')]=_[_0x5b3e('0x65')](_0x562b55['where'],{'$or':_[_0x5b3e('0x3e')](_0x562b55[_0x5b3e('0x5e')],function(_0x26ca16){var _0x5a899f={};_0x5a899f[_0x26ca16]={'$like':'%'+_0x59ce5f['query'][_0x5b3e('0x67')]+'%'};return _0x5a899f;})});}_0x562b55=_[_0x5b3e('0x65')]({},_0x562b55,_0x59ce5f[_0x5b3e('0x68')]);return db[_0x5b3e('0x79')][_0x5b3e('0x24')]({'where':_0x562b55[_0x5b3e('0x64')]})[_0x5b3e('0x29')](function(_0x1e7425){_0x28361f[_0x5b3e('0x24')]=_0x1e7425;if(_0x59ce5f[_0x5b3e('0x59')][_0x5b3e('0x69')]){_0x562b55[_0x5b3e('0x7e')]=[{'all':!![]}];}return db[_0x5b3e('0x79')][_0x5b3e('0x6a')](_0x562b55);})[_0x5b3e('0x29')](function(_0x31d55a){_0x28361f[_0x5b3e('0x6b')]=_0x31d55a;return _0x28361f;});}})['then'](respondWithFilteredResult(_0x58628b,_0x562b55))[_0x5b3e('0x3c')](handleError(_0x58628b,null));};exports[_0x5b3e('0x7f')]=function(_0x3a181f,_0x3eff05){return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x3a181f[_0x5b3e('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3eff05,null))['then'](function(_0x289ed2){if(_0x289ed2){return _0x289ed2[_0x5b3e('0x7f')](_0x3a181f[_0x5b3e('0x59')][_0x5b3e('0x80')]);}})['then'](respondWithStatusCode(_0x3eff05,null))[_0x5b3e('0x3c')](handleError(_0x3eff05,null));};exports[_0x5b3e('0x81')]=function(_0x2b47e7,_0x388873){if(_0x2b47e7[_0x5b3e('0x70')]['id']){delete _0x2b47e7[_0x5b3e('0x70')]['id'];}return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x2b47e7[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x388873,null))[_0x5b3e('0x29')](function(_0x3b3358){if(_0x3b3358){_0x2b47e7['body'][_0x5b3e('0x7d')]=_0x3b3358['id'];return db[_0x5b3e('0x82')][_0x5b3e('0x6f')](_0x2b47e7[_0x5b3e('0x70')]);}})['then'](respondWithResult(_0x388873,null))['catch'](handleError(_0x388873,null));};exports[_0x5b3e('0x83')]=function(_0x4af0c0,_0x57ff44){var _0x532bf4={'raw':![],'where':{}};var _0x4d25f4={};var _0x37fc92={'count':0x0,'rows':[]};return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x4af0c0[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x57ff44,null))[_0x5b3e('0x29')](function(_0x3d7172){if(_0x3d7172){_0x4d25f4[_0x5b3e('0x51')]=_[_0x5b3e('0x5a')](db[_0x5b3e('0x82')][_0x5b3e('0x57')]);_0x4d25f4[_0x5b3e('0x59')]=_[_0x5b3e('0x5a')](_0x4af0c0[_0x5b3e('0x59')]);_0x4d25f4['filters']=_[_0x5b3e('0x5c')](_0x4d25f4[_0x5b3e('0x51')],_0x4d25f4[_0x5b3e('0x59')]);_0x532bf4[_0x5b3e('0x5e')]=_[_0x5b3e('0x5c')](_0x4d25f4[_0x5b3e('0x51')],qs[_0x5b3e('0x5d')](_0x4af0c0['query'][_0x5b3e('0x5d')]));_0x532bf4[_0x5b3e('0x5e')]=_0x532bf4[_0x5b3e('0x5e')][_0x5b3e('0x5f')]?_0x532bf4[_0x5b3e('0x5e')]:_0x4d25f4['model'];if(!_0x4af0c0[_0x5b3e('0x59')][_0x5b3e('0x60')](_0x5b3e('0x61'))){_0x532bf4['limit']=qs['limit'](_0x4af0c0[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x532bf4[_0x5b3e('0x25')]=qs[_0x5b3e('0x25')](_0x4af0c0[_0x5b3e('0x59')]['offset']);}_0x532bf4['order']=qs['sort'](_0x4af0c0['query'][_0x5b3e('0x63')]);_0x532bf4['where']=qs['filters'](_['pick'](_0x4af0c0[_0x5b3e('0x59')],_0x4d25f4[_0x5b3e('0x5b')]));_0x532bf4[_0x5b3e('0x64')][_0x5b3e('0x7d')]=_0x3d7172['id'];if(_0x4af0c0[_0x5b3e('0x59')][_0x5b3e('0x67')]){_0x532bf4[_0x5b3e('0x64')]=_[_0x5b3e('0x65')](_0x532bf4[_0x5b3e('0x64')],{'$or':_[_0x5b3e('0x3e')](_0x532bf4[_0x5b3e('0x5e')],function(_0x4297b){var _0xe5bc84={};_0xe5bc84[_0x4297b]={'$like':'%'+_0x4af0c0['query'][_0x5b3e('0x67')]+'%'};return _0xe5bc84;})});}_0x532bf4=_[_0x5b3e('0x65')]({},_0x532bf4,_0x4af0c0[_0x5b3e('0x68')]);return db[_0x5b3e('0x82')][_0x5b3e('0x24')]({'where':_0x532bf4[_0x5b3e('0x64')]})[_0x5b3e('0x29')](function(_0x5a1801){_0x37fc92['count']=_0x5a1801;if(_0x4af0c0[_0x5b3e('0x59')]['includeAll']){_0x532bf4['include']=[{'all':!![]}];}return db[_0x5b3e('0x82')][_0x5b3e('0x6a')](_0x532bf4);})[_0x5b3e('0x29')](function(_0x2dfe4e){_0x37fc92[_0x5b3e('0x6b')]=_0x2dfe4e;return _0x37fc92;});}})[_0x5b3e('0x29')](respondWithFilteredResult(_0x57ff44,_0x532bf4))[_0x5b3e('0x3c')](handleError(_0x57ff44,null));};exports[_0x5b3e('0x84')]=function(_0x41780a,_0x2a24a5){return db['ChatWebsite'][_0x5b3e('0x6e')]({'where':{'id':_0x41780a[_0x5b3e('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2a24a5,null))[_0x5b3e('0x29')](function(_0x5d31c7){if(_0x5d31c7){return _0x5d31c7['removeAnswers'](_0x41780a[_0x5b3e('0x59')][_0x5b3e('0x80')]);}})[_0x5b3e('0x29')](respondWithStatusCode(_0x2a24a5,null))[_0x5b3e('0x3c')](handleError(_0x2a24a5,null));};exports[_0x5b3e('0x85')]=function(_0x2c06f5,_0x31226b){_0x2c06f5[_0x5b3e('0x70')][_0x5b3e('0x86')]=_0x2c06f5[_0x5b3e('0x87')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x2c06f5['params']['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x31226b,null))[_0x5b3e('0x29')](saveUpdates(_0x2c06f5[_0x5b3e('0x70')],null))[_0x5b3e('0x29')](respondWithResult(_0x31226b,null))[_0x5b3e('0x3c')](handleError(_0x31226b,null));};exports[_0x5b3e('0x88')]=function(_0x1131b9,_0x318afe){_0x1131b9[_0x5b3e('0x70')][_0x5b3e('0x89')]=_0x1131b9['file'][_0x5b3e('0x8a')];return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x1131b9[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x318afe,null))[_0x5b3e('0x29')](saveUpdates(_0x1131b9[_0x5b3e('0x70')],null))[_0x5b3e('0x29')](respondWithResult(_0x318afe,null))[_0x5b3e('0x3c')](handleError(_0x318afe,null));};exports[_0x5b3e('0x8b')]=function(_0x2a70d1,_0x7c6909){_0x2a70d1[_0x5b3e('0x70')][_0x5b3e('0x8c')]=_0x2a70d1[_0x5b3e('0x87')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x2a70d1[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x7c6909,null))[_0x5b3e('0x29')](saveUpdates(_0x2a70d1[_0x5b3e('0x70')],null))[_0x5b3e('0x29')](respondWithResult(_0x7c6909,null))[_0x5b3e('0x3c')](handleError(_0x7c6909,null));};exports[_0x5b3e('0x8d')]=function(_0x133082,_0x5cf169){_0x133082[_0x5b3e('0x70')][_0x5b3e('0x8e')]=_0x133082[_0x5b3e('0x87')][_0x5b3e('0x8a')];return db['ChatWebsite']['find']({'where':{'id':_0x133082[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x5cf169,null))['then'](saveUpdates(_0x133082['body'],null))[_0x5b3e('0x29')](respondWithResult(_0x5cf169,null))[_0x5b3e('0x3c')](handleError(_0x5cf169,null));};exports[_0x5b3e('0x8f')]=function(_0x1124bc,_0x45a1ee){var _0x2cb167=path[_0x5b3e('0x90')](config[_0x5b3e('0x91')],_0x5b3e('0x92'));var _0x4a7d45={'where':{'id':_0x1124bc['params']['id']},'attributes':['id',_0x5b3e('0x86')],'raw':!![]};var _0x7150e6=![];return require(_0x5b3e('0x93'))[_0x5b3e('0x94')]()[_0x5b3e('0x29')](function(_0x2cdd09){if(_0x2cdd09){_0x7150e6=_0x2cdd09[_0x5b3e('0x95')];}})['then'](function(){return db[_0x5b3e('0x56')]['find'](_0x4a7d45);})['then'](handleEntityNotFound(_0x45a1ee,null))[_0x5b3e('0x29')](function(_0x36857c){if(_0x36857c){if(!_[_0x5b3e('0x96')](_0x36857c[_0x5b3e('0x86')])){if(fs['existsSync'](path[_0x5b3e('0x90')](config[_0x5b3e('0x91')],_0x5b3e('0x97'),_0x36857c[_0x5b3e('0x86')]))&&_0x7150e6){_0x2cb167=path[_0x5b3e('0x90')](config[_0x5b3e('0x91')],_0x5b3e('0x97'),_0x36857c[_0x5b3e('0x86')]);}}return _0x45a1ee['download'](_0x2cb167);}})[_0x5b3e('0x3c')](handleError(_0x45a1ee,null));};exports['getAvatar']=function(_0xae81fa,_0x4ca45d){var _0x5b3b12=path[_0x5b3e('0x90')](config['root'],_0x5b3e('0x98'));var _0x1910b9={'where':{'id':_0xae81fa[_0x5b3e('0x6d')]['id']},'attributes':['id',_0x5b3e('0x89')],'raw':!![]};return db['ChatWebsite'][_0x5b3e('0x6e')](_0x1910b9)[_0x5b3e('0x29')](handleEntityNotFound(_0x4ca45d,null))[_0x5b3e('0x29')](function(_0x1b3ee4){if(_0x1b3ee4){if(!_[_0x5b3e('0x96')](_0x1b3ee4[_0x5b3e('0x89')])){if(fs[_0x5b3e('0x99')](path[_0x5b3e('0x90')](config['root'],_0x5b3e('0x9a'),_0x1b3ee4[_0x5b3e('0x89')]))){_0x5b3b12=path[_0x5b3e('0x90')](config['root'],_0x5b3e('0x9a'),_0x1b3ee4[_0x5b3e('0x89')]);}}return _0x4ca45d['download'](_0x5b3b12);}})[_0x5b3e('0x3c')](handleError(_0x4ca45d,null));};exports[_0x5b3e('0x9b')]=function(_0x534090,_0x15f0f0){var _0x16b60=path['join'](config[_0x5b3e('0x91')],_0x5b3e('0x9c'));var _0x9b4ab0={'where':{'id':_0x534090[_0x5b3e('0x6d')]['id']},'attributes':['id',_0x5b3e('0x8c'),_0x5b3e('0x9d')],'raw':!![]};return db[_0x5b3e('0x56')][_0x5b3e('0x6e')](_0x9b4ab0)['then'](handleEntityNotFound(_0x15f0f0,null))[_0x5b3e('0x29')](function(_0xc9c204){if(_0xc9c204){if(!_[_0x5b3e('0x96')](_0xc9c204['customerAvatar'])){if(fs[_0x5b3e('0x99')](path[_0x5b3e('0x90')](config[_0x5b3e('0x91')],'server/files/images/avatars/',_0xc9c204['customerAvatar']))&&_0xc9c204[_0x5b3e('0x9d')]){_0x16b60=path['join'](config['root'],_0x5b3e('0x9a'),_0xc9c204[_0x5b3e('0x8c')]);}}return _0x15f0f0['download'](_0x16b60);}})[_0x5b3e('0x3c')](handleError(_0x15f0f0,null));};exports[_0x5b3e('0x9e')]=function(_0x24cf08,_0x5a3acd){var _0x19e30d=path['join'](config[_0x5b3e('0x91')],_0x5b3e('0x9f'));var _0x33fb94={'where':{'id':_0x24cf08[_0x5b3e('0x6d')]['id']},'attributes':['id',_0x5b3e('0x8e')],'raw':!![]};return db[_0x5b3e('0x56')][_0x5b3e('0x6e')](_0x33fb94)[_0x5b3e('0x29')](handleEntityNotFound(_0x5a3acd,null))['then'](function(_0x180107){if(_0x180107){if(!_[_0x5b3e('0x96')](_0x180107[_0x5b3e('0x8e')])){if(fs[_0x5b3e('0x99')](path[_0x5b3e('0x90')](config[_0x5b3e('0x91')],_0x5b3e('0x9a'),_0x180107[_0x5b3e('0x8e')]))){_0x19e30d=path['join'](config[_0x5b3e('0x91')],'server/files/images/avatars/',_0x180107[_0x5b3e('0x8e')]);}}return _0x5a3acd[_0x5b3e('0xa0')](_0x19e30d);}})[_0x5b3e('0x3c')](handleError(_0x5a3acd,null));};exports[_0x5b3e('0xa1')]=function(_0x247153,_0x56c88d){var _0x4360ec={'body':_0x247153[_0x5b3e('0x70')],'channel':_0x5b3e('0xa2')};var _0xe31ed7=[];var _0x2579dd=[];var _0x31b962={};var _0x2a6f44=![];return db[_0x5b3e('0xa3')][_0x5b3e('0x77')]()[_0x5b3e('0x29')](function(_0x5ea5a6){if(!_0x5ea5a6){throw new db[(_0x5b3e('0xa4'))][(_0x5b3e('0xa5'))](_0x5b3e('0xa6'));}_0xe31ed7=_[_0x5b3e('0xa7')](_[_0x5b3e('0x5a')](_0x5ea5a6),[_0x5b3e('0xa8'),_0x5b3e('0xa9')]);_0x2579dd=_[_0x5b3e('0xa7')](_[_0x5b3e('0x5a')](_0x5ea5a6),[_0x5b3e('0xa8'),'updatedAt','CompanyId','ListId']);if(_0x247153[_0x5b3e('0x70')]['id']){delete _0x247153[_0x5b3e('0x70')]['id'];}if(_[_0x5b3e('0x96')](_0x247153[_0x5b3e('0x70')]['from'])){throw new db[(_0x5b3e('0xa4'))]['ValidationError'](_0x5b3e('0xaa'));}if(_[_0x5b3e('0x96')](_0x247153[_0x5b3e('0x70')]['body'])||_0x247153[_0x5b3e('0x70')][_0x5b3e('0x70')]===''){throw new db[(_0x5b3e('0xa4'))]['ValidationError'](_0x5b3e('0xab'));}if(_[_0x5b3e('0x96')](_0x247153[_0x5b3e('0x70')][_0x5b3e('0xac')])){throw new db[(_0x5b3e('0xa4'))][(_0x5b3e('0xa5'))](_0x5b3e('0xad')+_0x2579dd);}if(!_[_0x5b3e('0xae')](_0x2579dd,_0x247153['body'][_0x5b3e('0xac')])){throw new db['Sequelize']['ValidationError'](_0x5b3e('0xaf')+_0x2579dd);}_0x31b962[_0x247153[_0x5b3e('0x70')]['mapKey']]=_0x247153[_0x5b3e('0x70')]['from'];})[_0x5b3e('0x29')](function(){return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x247153['params']['id']},'include':[{'model':db[_0x5b3e('0xb0')],'as':_0x5b3e('0xb1'),'include':[{'model':db[_0x5b3e('0xa3')],'as':_0x5b3e('0xb2'),'where':_0x31b962,'limit':0x1,'order':[[_0x5b3e('0xa9'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x5b3e('0xb3')},{'model':db[_0x5b3e('0x3f')],'as':'Interval','include':[{'model':db[_0x5b3e('0x3f')],'as':_0x5b3e('0x40'),'attributes':['id',_0x5b3e('0x36')],'raw':!![]}]}]});})[_0x5b3e('0x29')](function(_0x2b762c){if(!_0x2b762c)throw new APINotFoundError(util[_0x5b3e('0x32')](_0x5b3e('0xb4'),_0x247153['params']['id']));if(!_0x2b762c[_0x5b3e('0x3f')]||!_0x2b762c[_0x5b3e('0x3f')]['Intervals'])return[_0x2b762c,!![]];return[_0x2b762c,checkWebsiteIntervals(_0x2b762c)];})['spread'](function(_0x5f57eb,_0x508b2f){if(!_0x508b2f)throw new APIOutOfIntervalError();if(!_0x5f57eb[_0x5b3e('0xb1')])return;_0x4360ec[_0x5b3e('0xb5')]=_0x5f57eb;_0x4360ec[_0x5b3e('0xb6')]=_0x5f57eb['List'];_0x4360ec['applications']=_[_0x5b3e('0xb7')](_0x5f57eb[_0x5b3e('0xb3')],[_0x5b3e('0xb8')],[_0x5b3e('0xb9')]);if(_0x4360ec[_0x5b3e('0xb5')][_0x5b3e('0xb3')]){delete _0x4360ec[_0x5b3e('0xb5')][_0x5b3e('0xb3')];}if(_0x4360ec['account']['List']&&_0x4360ec[_0x5b3e('0xb5')][_0x5b3e('0xb1')][_0x5b3e('0xb2')][_0x5b3e('0x5f')]){return _0x4360ec[_0x5b3e('0xb5')][_0x5b3e('0xb1')][_0x5b3e('0xb2')][0x0];}var _0x2a681b=_[_0x5b3e('0x10')](_0x247153[_0x5b3e('0x70')],{'firstName':_0x247153[_0x5b3e('0x70')][_0x5b3e('0xba')],'ListId':_0x5f57eb['ListId']});_0x2a681b[_0x247153['body'][_0x5b3e('0xac')]]=_0x247153[_0x5b3e('0x70')]['from'];return db[_0x5b3e('0xa3')][_0x5b3e('0x6f')](_0x2a681b,{'fields':_0xe31ed7,'raw':!![]});})['then'](function(_0x32906b){_0x4360ec[_0x5b3e('0xbb')]=_0x32906b;var _0x2b6cfb=createInteractionObject(_0x247153['params']['id'],_0x247153[_0x5b3e('0x70')],_0x247153[_0x5b3e('0xbc')],_0x32906b);var _0x349c76={'ChatWebsiteId':_0x247153[_0x5b3e('0x6d')]['id'],'closed':![]};if(_0x247153[_0x5b3e('0x70')]['threadId']){_0x349c76[_0x5b3e('0xbd')]=_0x247153['body']['threadId'];return db[_0x5b3e('0xbe')][_0x5b3e('0x6e')]({'where':_0x349c76})[_0x5b3e('0x29')](function(_0x207f1b){if(_0x207f1b){_0x2a6f44=!![];return _0x207f1b;}_0x2b6cfb[_0x5b3e('0xbd')]=_0x247153[_0x5b3e('0x70')][_0x5b3e('0xbd')];_0x2b6cfb[_0x5b3e('0xbf')]=_0x247153[_0x5b3e('0x70')][_0x5b3e('0xbf')];return db['ChatInteraction']['create'](_0x2b6cfb);});}_0x349c76[_0x5b3e('0xc0')]=_0x32906b['id'];if(_0x247153[_0x5b3e('0x70')]['interaction']&&_0x247153[_0x5b3e('0x70')][_0x5b3e('0xc1')]['id']){_0x349c76['id']=_0x247153['body'][_0x5b3e('0xc1')]['id'];return db[_0x5b3e('0xbe')][_0x5b3e('0x6e')]({'where':_0x349c76})[_0x5b3e('0x29')](function(_0x1b49d1){if(_0x1b49d1){_0x2a6f44=!![];return _0x1b49d1;}return db[_0x5b3e('0xbe')]['create'](_0x2b6cfb);});}return db[_0x5b3e('0xbe')][_0x5b3e('0x6f')](_0x2b6cfb);})[_0x5b3e('0x29')](function(_0x2fc748){if(!_0x2a6f44)return _0x2fc748;var _0x2c26c3={'from':(_0x4360ec[_0x5b3e('0xbb')][_0x5b3e('0x47')]||'')+'\x20'+(_0x4360ec['contact'][_0x5b3e('0x48')]||'')};if(_0x247153[_0x5b3e('0x70')][_0x5b3e('0xbd')]&&_0x247153['body'][_0x5b3e('0xc2')]&&_0x247153[_0x5b3e('0x70')][_0x5b3e('0xbd')]!=_0x247153[_0x5b3e('0x70')][_0x5b3e('0xc2')]){_0x2c26c3[_0x5b3e('0xbd')]=_0x247153[_0x5b3e('0x70')][_0x5b3e('0xc2')];}return _0x2fc748['update'](_0x2c26c3);})['then'](function(_0x580e52){_0x4360ec[_0x5b3e('0xc1')]=_0x580e52[_0x5b3e('0x2b')]({'plain':!![]});_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xc3')]=!_0x2a6f44;if(_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xc3')]){if(_0x4360ec['account'][_0x5b3e('0xc4')]){_0x4360ec['applications'][_0x5b3e('0xc5')]({'id':0x0,'priority':_0x4360ec[_0x5b3e('0xc6')]['length']+0x1,'app':_0x5b3e('0xc7'),'appdata':_0x5b3e('0xc8'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x247153['body']['body'],'ChatWebsiteId':_0x247153[_0x5b3e('0x6d')]['id'],'ChatInteractionId':_0x580e52['id'],'direction':'in','ContactId':_0x4360ec['contact']['id'],'AttachmentId':_0x247153[_0x5b3e('0x70')][_0x5b3e('0xc9')]});})[_0x5b3e('0x29')](function(_0x37cc79){_0x4360ec[_0x5b3e('0x1d')]=_0x37cc79;if(!_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xca')]){return;}return db[_0x5b3e('0xcb')]['find']({'attributes':['id',_0x5b3e('0x2e')],'where':{'id':_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xca')]}});})[_0x5b3e('0x29')](function(_0x4f2039){if(_0x4f2039){_0x4360ec[_0x5b3e('0xc6')][_0x5b3e('0xcc')]({'id':0x0,'priority':0x0,'app':_0x5b3e('0xcd'),'appdata':_0x4f2039[_0x5b3e('0x2e')]+','+(_0x4360ec[_0x5b3e('0xb5')][_0x5b3e('0xce')]||0xa),'interval':_0x5b3e('0xcf')});_0x4360ec[_0x5b3e('0xd0')]=!![];}if(!_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xd1')]){return;}return db['ChatQueue'][_0x5b3e('0x6e')]({'attributes':['id',_0x5b3e('0x2e')],'where':{'id':_0x4360ec[_0x5b3e('0xc1')][_0x5b3e('0xd1')]}});})[_0x5b3e('0x29')](function(_0x18c380){if(_0x18c380){_0x4360ec['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x5b3e('0xd2'),'appdata':_0x18c380['name']+','+(_0x4360ec[_0x5b3e('0xb5')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5b3e('0xcf')});}return respondWithRpcPromise('Start',_0x5b3e('0xd3'),_0x4360ec);})[_0x5b3e('0x29')](function(_0x4257be){respondWithRpcPromise(_0x5b3e('0xd4'),_0x5b3e('0xd4'),{'event':_0x5b3e('0xa1'),'message':_0x4257be},client9002);return _0x4257be;})[_0x5b3e('0x29')](respondWithResult(_0x56c88d,null))[_0x5b3e('0x3c')](APIHandleError(_0x56c88d));};exports['offline']=function(_0x42c76a,_0x9fa59f){var _0x1b0ab7,_0x4edad0,_0xfb7a2d;var _0x132f05=[];var _0x41fa9f={};var _0x137d33=_0x42c76a['files']||[];var _0x29f594=[];var _0x2d9d67;return db[_0x5b3e('0xa3')][_0x5b3e('0x77')]()[_0x5b3e('0x29')](function(_0x2066ff){if(!_0x2066ff){throw new db[(_0x5b3e('0xa4'))]['ValidationError']('no\x20available\x20attributes');}_0x132f05=_['difference'](_['keys'](_0x2066ff),[_0x5b3e('0xa8'),_0x5b3e('0xa9'),'CompanyId',_0x5b3e('0xd5')]);if(_0x42c76a[_0x5b3e('0x70')]['id']){delete _0x42c76a[_0x5b3e('0x70')]['id'];}if(_[_0x5b3e('0x96')](_0x42c76a[_0x5b3e('0x70')]['from'])){throw _0x9fa59f[_0x5b3e('0x1f')](0x1f4)['send'](new db[(_0x5b3e('0xa4'))][(_0x5b3e('0xa5'))](_0x5b3e('0xaa')));}if(_[_0x5b3e('0x96')](_0x42c76a[_0x5b3e('0x70')]['body'])||_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0x70')]===''){throw _0x9fa59f[_0x5b3e('0x1f')](0x1f4)[_0x5b3e('0x2f')](new db[(_0x5b3e('0xa4'))][(_0x5b3e('0xa5'))](_0x5b3e('0xab')));}if(_[_0x5b3e('0x96')](_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0xd6')])){throw _0x9fa59f[_0x5b3e('0x1f')](0x1f4)['send'](new db[(_0x5b3e('0xa4'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x132f05));}if(!_['includes'](_0x132f05,_0x42c76a[_0x5b3e('0x70')]['mapKeyOffline'])){throw _0x9fa59f[_0x5b3e('0x1f')](0x1f4)[_0x5b3e('0x2f')](new db[(_0x5b3e('0xa4'))][(_0x5b3e('0xa5'))](_0x5b3e('0xd7')+_0x132f05));}_0x41fa9f[_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0xd6')]]=_0x42c76a['body'][_0x5b3e('0xba')];})[_0x5b3e('0x29')](function(){return db['ChatWebsite'][_0x5b3e('0x6e')]({'where':{'id':_0x42c76a['params']['id']},'include':[{'model':db[_0x5b3e('0xb0')],'as':_0x5b3e('0xb1')},{'model':db[_0x5b3e('0xd8')],'as':_0x5b3e('0xd8')}]});})[_0x5b3e('0x29')](handleEntityNotFound(_0x9fa59f,null))[_0x5b3e('0x29')](function(_0x40dfef){if(_0x40dfef&&_0x40dfef[_0x5b3e('0xb1')]){_0x4edad0=_0x40dfef;var _0x1473d3=_[_0x5b3e('0x10')](_0x42c76a[_0x5b3e('0x70')],{'firstName':_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0xba')],'phone':_0x42c76a[_0x5b3e('0x70')]['from'],'ListId':_0x40dfef['ListId']});_0x1473d3[_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0xd6')]]=_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0xba')];return db[_0x5b3e('0xa3')][_0x5b3e('0xd9')]({'where':_0x41fa9f,'defaults':_0x1473d3});}})[_0x5b3e('0xda')](function(_0x4a8097){if(_0x4a8097){_0xfb7a2d=_0x4a8097;var _0x550631=fs['readFileSync'](path[_0x5b3e('0x90')](config['root'],_0x5b3e('0xdb')),_0x5b3e('0xdc'));var _0x2e071b=ejs[_0x5b3e('0xdd')](_0x550631,{'body':_[_0x5b3e('0xde')](_0x42c76a[_0x5b3e('0x70')][_0x5b3e('0x70')]),'bodyTitle':_0x4edad0[_0x5b3e('0xdf')]});return db[_0x5b3e('0xe0')][_0x5b3e('0x6f')]({'body':_0x2e071b,'plainBody':htmlToText['fromString'](_0x2e071b),'ContactId':_0x4a8097['id'],'ChatWebsiteId':_0x4edad0['id']});}})[_0x5b3e('0x29')](function(_0x3e9ac4){_0x2d9d67=_0x3e9ac4;if(_0x137d33[_0x5b3e('0x5f')]){var _0x735b76=_0x137d33[_0x5b3e('0x3e')](function(_0x194818){return{'name':_0x194818['originalname'],'basename':_0x194818['filename'],'type':_0x194818[_0x5b3e('0xe1')],'ChatOfflineMessageId':_0x3e9ac4['id']};});_0x29f594=_0x735b76[_0x5b3e('0x3e')](_0x2dacd0=>{var _0x58830d={'filename':_0x2dacd0['name'],'path':path['join'](config[_0x5b3e('0x91')],_0x5b3e('0xe2'),_0x5b3e('0xe3'),_0x5b3e('0xe4'),'offline-chat',_0x2dacd0[_0x5b3e('0xe5')])};return _0x58830d;});if(!_0x4edad0[_0x5b3e('0xe6')]){return db['sequelize']['transaction'](function(_0x2ebdd2){return db[_0x5b3e('0xe7')][_0x5b3e('0xe8')](_0x735b76,{'transaction':_0x2ebdd2});});}}})[_0x5b3e('0x29')](function(){if(_0x2d9d67){_0x1b0ab7=_0x2d9d67;return db[_0x5b3e('0xd8')][_0x5b3e('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0x5b3e('0xe9')],'as':_0x5b3e('0xea'),'raw':!![],'include':[{'model':db[_0x5b3e('0xeb')],'as':_0x5b3e('0xeb'),'raw':!![]}]}]});}})[_0x5b3e('0x29')](function(_0x5b11ef){if(_0x5b11ef&&_0x5b11ef[_0x5b3e('0xea')]&&_0x4edad0[_0x5b3e('0xec')]&&_0x4edad0[_0x5b3e('0xed')]){var _0xeeb9de=_0x5b11ef['getSmtpOptions']();return respondWithRpcPromise(_0x5b3e('0xee'),_0x5b3e('0xef'),{'account':_0xeeb9de,'message':{'from':util[_0x5b3e('0x32')]('\x22%s\x22\x20<%s>',_0x5b11ef['name'],_0x5b11ef[_0x5b3e('0xf0')]||_0x5b11ef[_0x5b3e('0xea')][_0x5b3e('0x71')]),'to':_0x4edad0[_0x5b3e('0xed')],'subject':_0x4edad0['offlineMessageSubject'],'html':_0x1b0ab7[_0x5b3e('0x70')],'attachments':_0x29f594}},client9003)[_0x5b3e('0x29')](function(){return _0x1b0ab7;})[_0x5b3e('0x3c')](function(_0x57cde6){logger[_0x5b3e('0x1b')](_0x57cde6);});}})[_0x5b3e('0x29')](function(){if(_0x4edad0&&_0x4edad0['openNewInteraction']&&_0x4edad0['MailAccountId']){var _0x456e2e=[];if(_0x137d33[_0x5b3e('0x5f')]){_0x456e2e=_0x137d33[_0x5b3e('0x3e')](function(_0x4a9475){return{'name':_0x4a9475[_0x5b3e('0xf1')],'basename':_0x4a9475[_0x5b3e('0x8a')],'type':_0x4a9475[_0x5b3e('0xe1')],'ChatOfflineMessageId':_0x2d9d67['id']};});}var _0x28f3de;if(!_['isNil'](_0x4edad0[_0x5b3e('0xf2')])){var _0x2fa034=_[_0x5b3e('0x3e')](_0x42c76a[_0x5b3e('0x70')],function(_0xe49cec){return _0xe49cec;});var _0x30c1c4=_[_0x5b3e('0xf3')](_0x2fa034)[0x0];var _0xf2de24=_['mapValues'](_0x30c1c4,function(_0x173b3f){return _0x173b3f;});_0x28f3de=_0xf2de24[0x1][_0x4edad0[_0x5b3e('0xf2')]];}var _0xeaf7bb={'from':_0xfb7a2d[_0x5b3e('0xf0')],'firstName':_0xfb7a2d['firstName'],'lastName':_0xfb7a2d[_0x5b3e('0x48')],'mapKey':'email','message':{'from':_0xfb7a2d[_0x5b3e('0xf0')],'to':_0x4edad0[_0x5b3e('0xd8')][_0x5b3e('0xf0')],'cc':'','subject':_[_0x5b3e('0x96')](_0x28f3de)?_0x4edad0[_0x5b3e('0xf4')]:_0x28f3de,'messageId':'','sentAt':new Date(),'attach':_0x456e2e[_0x5b3e('0x5f')],'attachments':_0x456e2e,'originChannel':_0x5b3e('0xf5'),'ChatWebsiteId':_0x4edad0['id'],'ChatOfflineMessageId':_0x1b0ab7['id'],'originTo':_0x4edad0[_0x5b3e('0xd8')][_0x5b3e('0xf0')]},'body':_0x1b0ab7[_0x5b3e('0x70')]};var _0x2dd1da={'account':{'id':_0x4edad0[_0x5b3e('0xf6')]},'body':_0xeaf7bb,'log':_0x5b3e('0xf7')};return respondWithRpcPromise(_0x5b3e('0xf7'),'notifyMail',_0x2dd1da,client9001)['then'](function(){return _0x1b0ab7;})[_0x5b3e('0x3c')](function(_0x516701){logger[_0x5b3e('0x1b')](_0x516701);});}return;})[_0x5b3e('0x29')](function(){if(_0x1b0ab7){return _0x1b0ab7;}})[_0x5b3e('0x29')](respondWithResult(_0x9fa59f,null))[_0x5b3e('0x3c')](function(){for(var _0x2b1143 of _0x137d33){var _0x41784a=path['join'](config[_0x5b3e('0x91')],_0x5b3e('0xe2'),'files',_0x5b3e('0xe4'),_0x5b3e('0xf8'),_0x2b1143[_0x5b3e('0x8a')]);fs_extra[_0x5b3e('0xf9')](_0x41784a)[_0x5b3e('0x3c')](function(_0x11156e){logger[_0x5b3e('0x1b')](_0x5b3e('0xfa'),_0x41784a,_0x11156e);});}});};exports[_0x5b3e('0xfb')]=function(_0x295ff9,_0x473f71){return db['ChatInteraction']['find']({'where':{'id':_0x295ff9[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x473f71,null))['then'](function(_0x57d6d7){if(_0x57d6d7){return _0x57d6d7[_0x5b3e('0xfb')](_0x295ff9[_0x5b3e('0x70')][_0x5b3e('0x80')],_[_0x5b3e('0xfc')](_0x295ff9['body'],[_0x5b3e('0x80'),'id'])||{});}})[_0x5b3e('0x29')](respondWithResult(_0x473f71,null))[_0x5b3e('0x3c')](handleError(_0x473f71,null));};exports[_0x5b3e('0xfd')]=function(_0x35ed63,_0xbd755){var _0x3b0c2c={'raw':![],'where':{}};var _0x31920f={};var _0x4e34b8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5b3e('0x7b')]({'where':{'id':_0x35ed63['params']['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0xbd755,null))['then'](function(_0x1c5a42){if(_0x1c5a42){_0x31920f['model']=_[_0x5b3e('0x5a')](db[_0x5b3e('0xbe')][_0x5b3e('0x57')]);_0x31920f[_0x5b3e('0x59')]=_['keys'](_0x35ed63[_0x5b3e('0x59')]);_0x31920f[_0x5b3e('0x5b')]=_[_0x5b3e('0x5c')](_0x31920f[_0x5b3e('0x51')],_0x31920f[_0x5b3e('0x59')]);_0x3b0c2c['attributes']=_['intersection'](_0x31920f[_0x5b3e('0x51')],qs[_0x5b3e('0x5d')](_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x3b0c2c[_0x5b3e('0x5e')]=_0x3b0c2c['attributes'][_0x5b3e('0x5f')]?_0x3b0c2c[_0x5b3e('0x5e')]:_0x31920f[_0x5b3e('0x51')];if(!_0x35ed63['query'][_0x5b3e('0x60')]('nolimit')){_0x3b0c2c['limit']=qs[_0x5b3e('0x22')](_0x35ed63[_0x5b3e('0x59')]['limit']);_0x3b0c2c[_0x5b3e('0x25')]=qs[_0x5b3e('0x25')](_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x25')]);}_0x3b0c2c['order']=qs[_0x5b3e('0x63')](_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x63')]);_0x3b0c2c[_0x5b3e('0x64')]=qs['filters'](_[_0x5b3e('0x7c')](_0x35ed63[_0x5b3e('0x59')],_0x31920f[_0x5b3e('0x5b')]));_0x3b0c2c[_0x5b3e('0x64')][_0x5b3e('0x7d')]=_0x1c5a42['id'];if(_0x35ed63['query'][_0x5b3e('0x67')]){_0x3b0c2c[_0x5b3e('0x64')]=_['merge'](_0x3b0c2c[_0x5b3e('0x64')],{'$or':_[_0x5b3e('0x3e')](_0x3b0c2c['attributes'],function(_0x37f536){var _0x248fee={};_0x248fee[_0x37f536]={'$like':'%'+_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x67')]+'%'};return _0x248fee;})});}_0x3b0c2c=_[_0x5b3e('0x65')]({},_0x3b0c2c,_0x35ed63[_0x5b3e('0x68')]);return db[_0x5b3e('0xbe')][_0x5b3e('0x24')]({'where':_0x3b0c2c[_0x5b3e('0x64')]})[_0x5b3e('0x29')](function(_0x435636){_0x4e34b8[_0x5b3e('0x24')]=_0x435636;if(_0x35ed63[_0x5b3e('0x59')]['includeAll']){_0x3b0c2c[_0x5b3e('0x7e')]=[{'model':db[_0x5b3e('0xa3')],'as':_0x5b3e('0xfe'),'required':![]},{'model':db[_0x5b3e('0xcb')],'as':_0x5b3e('0xff'),'attributes':[_0x5b3e('0x2e'),_0x5b3e('0x100'),_0x5b3e('0x101')],'required':![]},{'model':db[_0x5b3e('0x102')],'as':_0x5b3e('0x103'),'attributes':['id','name',_0x5b3e('0x104')],'where':_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x105')]?{'id':_0x35ed63['query'][_0x5b3e('0x105')]}:undefined,'required':_0x35ed63[_0x5b3e('0x59')][_0x5b3e('0x105')]?!![]:![]}];}return db[_0x5b3e('0xbe')][_0x5b3e('0x6a')](_0x3b0c2c);})[_0x5b3e('0x29')](function(_0x3fe59e){_0x4e34b8['rows']=_0x3fe59e;return _0x4e34b8;});}})[_0x5b3e('0x29')](respondWithFilteredResult(_0xbd755,_0x3b0c2c))[_0x5b3e('0x3c')](handleError(_0xbd755,null));};exports['getSnippet']=function(_0x341143,_0x2493a6){var _0x5852c6=0x0;var _0x5ecfff=0x0;var _0x3c9291=![];var _0x3f16e4;var _0x5b51c0;return db['ChatWebsite'][_0x5b3e('0x6e')]({'where':{'id':_0x341143[_0x5b3e('0x6d')]['id']},'include':[{'model':db[_0x5b3e('0x3f')],'as':_0x5b3e('0x3f'),'include':[{'model':db[_0x5b3e('0x3f')],'as':_0x5b3e('0x40'),'attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x2493a6,null))[_0x5b3e('0x29')](function(_0x24eb3d){if(_0x24eb3d){_0x3f16e4=_0x24eb3d;return _0x24eb3d['getProactiveActions']({'raw':!![]});}})[_0x5b3e('0x29')](function(_0x2627a5){if(_0x3f16e4){if(_0x2627a5){_0x5b51c0=_0x2627a5;}}return require('../../config/license/util')[_0x5b3e('0x94')]();})[_0x5b3e('0x29')](function(_0x50c01b){if(_0x50c01b){_0x5ecfff=_0x50c01b['virtual'];_0x3c9291=_0x50c01b[_0x5b3e('0x95')];}})[_0x5b3e('0x29')](function(){return db[_0x5b3e('0xbe')][_0x5b3e('0x24')]({'where':{'closed':![]}});})[_0x5b3e('0x29')](function(_0x3c1346){_0x5852c6=_0x3c1346;if(_0x5ecfff&&_0x3c1346>_0x5ecfff){return db['License'][_0x5b3e('0x7b')]({'where':{'id':0x1}})[_0x5b3e('0x29')](function(_0x58984e){if(_0x58984e){_0x58984e[_0x5b3e('0x106')]('chatLicenseExceeded');}});}})[_0x5b3e('0x29')](function(){if(!_0x3f16e4[_0x5b3e('0x3f')]||!_0x3f16e4['Interval'][_0x5b3e('0x40')])return!![];return checkWebsiteIntervals(_0x3f16e4);})['then'](function(_0x3605e3){var _0x399f88=fs[_0x5b3e('0x107')](path[_0x5b3e('0x90')](config['root'],_0x5b3e('0x108')),'utf8');var _0x277a58=new url[(_0x5b3e('0x109'))](_0x3f16e4[_0x5b3e('0x10a')])[_0x5b3e('0x10b')];var _0x20c67e=_0x5b3e('0x10c');var _0xd01fa2=![];var _0x4ac110={'chatVersion':_0x20c67e,'chatWebsiteAddressOrigin':_0x277a58,'remote':_0x3f16e4[_0x5b3e('0x10d')],'query':querystring[_0x5b3e('0x1a')](_[_0x5b3e('0x65')](_0x3f16e4[_0x5b3e('0x2b')]({'plain':!![]}),{'customerIp':_0x341143[_0x5b3e('0xbc')][_0x5b3e('0x45')]||_0x341143['headers'][_0x5b3e('0x10e')]||_0x341143[_0x5b3e('0x10f')][_0x5b3e('0x110')]||_0x341143['ip'],'referer':_0x341143[_0x5b3e('0xbc')][_0x5b3e('0x4a')],'openedInteractions':_0x5852c6,'maxInteractions':_0x5ecfff,'virtual':_0x3c9291[_0x5b3e('0x111')],'online':_0x3605e3,'custom':_0x3c9291}))[_0x5b3e('0x112')](/'/g,'\x5c\x27')};_0x2493a6[_0x5b3e('0x2f')](ejs[_0x5b3e('0xdd')](Mustache[_0x5b3e('0xdd')](_0x399f88,_0x4ac110),{'proactiveActions':_0x5b51c0,'alignment':_0x3f16e4['alignment'],'verticalAlignment':_0x3f16e4[_0x5b3e('0x113')],'div_color':_0x3f16e4[_0x5b3e('0x104')],'labelText':_0x3f16e4[_0x5b3e('0x114')],'text_color':_0x3f16e4[_0x5b3e('0x115')],'text_button_color':_0x3f16e4[_0x5b3e('0x116')],'button_color':_0x3f16e4[_0x5b3e('0x117')],'background_color':_0x3f16e4[_0x5b3e('0x118')],'hideWhenOffline':_0x3f16e4[_0x5b3e('0x119')],'intervalId':_0x3f16e4[_0x5b3e('0x11a')],'isDevelopment':_0xd01fa2,'chatVersion':_0x20c67e}));})['catch'](handleError(_0x2493a6,null));};exports[_0x5b3e('0x11b')]=function(_0x3bc5f0,_0x422b45){var _0x21a894=_0x3bc5f0[_0x5b3e('0x6d')]['id'];var _0x13f02f=_0x3bc5f0[_0x5b3e('0x70')];var _0x2ea515=0xc8;var _0x3f34d2=null;return db[_0x5b3e('0x11c')][_0x5b3e('0x11d')]({'isolationLevel':db['sequelize'][_0x5b3e('0x11e')][_0x5b3e('0x11f')][_0x5b3e('0x120')]},function(_0x4f24a4){return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x21a894},'transaction':_0x4f24a4})[_0x5b3e('0x29')](function(_0x5c62a0){if(_0x5c62a0){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x21a894},'transaction':_0x4f24a4})[_0x5b3e('0x29')](function(){var _0x1397d3=_[_0x5b3e('0x3e')](_0x13f02f,function(_0x383a8a){_0x383a8a['ChatWebsiteId']=_0x21a894;return _0x383a8a;});return db[_0x5b3e('0x121')][_0x5b3e('0xe8')](_0x1397d3,{'transaction':_0x4f24a4});});}else{_0x2ea515=0x194;_0x3f34d2=[];}});})[_0x5b3e('0x29')](function(){if(_0x2ea515!==0x194){return db[_0x5b3e('0x121')][_0x5b3e('0x122')]({'where':{'ChatWebsiteId':_0x21a894},'order':_0x5b3e('0xb8')})[_0x5b3e('0x29')](function(_0x445ab0){_0x3f34d2=_0x445ab0;});}})[_0x5b3e('0x3c')](function(_0x5ef5fb){_0x2ea515=0x1f4;logger[_0x5b3e('0x1b')](_0x5ef5fb[_0x5b3e('0x2d')]);if(_0x5ef5fb['name']){delete _0x5ef5fb[_0x5b3e('0x2e')];}_0x3f34d2=_0x5ef5fb;})['finally'](function(){if(_0x3f34d2===null){_0x422b45[_0x5b3e('0x123')](_0x2ea515);}else{if(_0x2ea515===0x1f4){_0x422b45[_0x5b3e('0x1f')](_0x2ea515)['send'](_0x3f34d2);}else{_0x422b45[_0x5b3e('0x1f')](_0x2ea515)[_0x5b3e('0x21')](_0x3f34d2);}}});};exports['getApplications']=function(_0x149328,_0x3437a0){var _0x5743db={};var _0x58809e={};var _0x30b850;var _0x48cef3;return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x149328[_0x5b3e('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3437a0,null))[_0x5b3e('0x29')](function(_0x366796){if(_0x366796){_0x30b850=_0x366796;_0x58809e[_0x5b3e('0x51')]=_[_0x5b3e('0x5a')](db[_0x5b3e('0x121')][_0x5b3e('0x57')]);_0x58809e[_0x5b3e('0x59')]=_['keys'](_0x149328[_0x5b3e('0x59')]);_0x58809e[_0x5b3e('0x5b')]=_[_0x5b3e('0x5c')](_0x58809e['model'],_0x58809e['query']);_0x5743db[_0x5b3e('0x5e')]=_[_0x5b3e('0x5c')](_0x58809e['model'],qs['fields'](_0x149328[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x5743db['attributes']=_0x5743db['attributes'][_0x5b3e('0x5f')]?_0x5743db[_0x5b3e('0x5e')]:_0x58809e[_0x5b3e('0x51')];_0x5743db[_0x5b3e('0x62')]=qs[_0x5b3e('0x63')](_0x149328[_0x5b3e('0x59')]['sort']);_0x5743db[_0x5b3e('0x64')]=qs[_0x5b3e('0x5b')](_[_0x5b3e('0x7c')](_0x149328['query'],_0x58809e[_0x5b3e('0x5b')]));if(_0x149328['query'][_0x5b3e('0x67')]){_0x5743db[_0x5b3e('0x64')]=_[_0x5b3e('0x65')](_0x5743db['where'],{'$or':_[_0x5b3e('0x3e')](_0x5743db[_0x5b3e('0x5e')],function(_0x4af0f3){var _0x1fe447={};_0x1fe447[_0x4af0f3]={'$like':'%'+_0x149328[_0x5b3e('0x59')][_0x5b3e('0x67')]+'%'};return _0x1fe447;})});}_0x5743db=_[_0x5b3e('0x65')]({},_0x5743db,_0x149328[_0x5b3e('0x68')]);return _0x30b850[_0x5b3e('0x124')](_0x5743db);}})[_0x5b3e('0x29')](function(_0x16c194){if(_0x16c194){_0x48cef3=_0x16c194[_0x5b3e('0x5f')];if(!_0x149328['query'][_0x5b3e('0x60')](_0x5b3e('0x61'))){_0x5743db[_0x5b3e('0x22')]=qs[_0x5b3e('0x22')](_0x149328[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x5743db[_0x5b3e('0x25')]=qs[_0x5b3e('0x25')](_0x149328[_0x5b3e('0x59')][_0x5b3e('0x25')]);}return _0x30b850[_0x5b3e('0x124')](_0x5743db);}})['then'](function(_0x2c3bf2){if(_0x2c3bf2){return _0x2c3bf2?{'count':_0x48cef3,'rows':_0x2c3bf2}:null;}})[_0x5b3e('0x29')](respondWithResult(_0x3437a0,null))[_0x5b3e('0x3c')](handleError(_0x3437a0,null));};exports[_0x5b3e('0x125')]=function(_0x2cb895,_0x2fc63b){return db[_0x5b3e('0x126')][_0x5b3e('0x6e')]({'where':{'id':_0x2cb895[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x2fc63b,null))[_0x5b3e('0x29')](function(_0x4ed019){if(_0x4ed019){return _0x4ed019[_0x5b3e('0x125')](_0x2cb895['body'][_0x5b3e('0x80')],_[_0x5b3e('0xfc')](_0x2cb895[_0x5b3e('0x70')],[_0x5b3e('0x80'),'id'])||{});}})[_0x5b3e('0x29')](respondWithResult(_0x2fc63b,null))[_0x5b3e('0x3c')](handleError(_0x2fc63b,null));};exports[_0x5b3e('0x127')]=function(_0x37db5e,_0x1be671){var _0x5e62d9={};var _0x597506={};var _0x4852c4;var _0x10335a;return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x37db5e[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x1be671,null))[_0x5b3e('0x29')](function(_0x2d125d){if(_0x2d125d){_0x4852c4=_0x2d125d;_0x597506[_0x5b3e('0x51')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x597506[_0x5b3e('0x59')]=_['keys'](_0x37db5e[_0x5b3e('0x59')]);_0x597506['filters']=_[_0x5b3e('0x5c')](_0x597506[_0x5b3e('0x51')],_0x597506[_0x5b3e('0x59')]);_0x5e62d9[_0x5b3e('0x5e')]=_[_0x5b3e('0x5c')](_0x597506['model'],qs[_0x5b3e('0x5d')](_0x37db5e[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x5e62d9[_0x5b3e('0x5e')]=_0x5e62d9['attributes'][_0x5b3e('0x5f')]?_0x5e62d9[_0x5b3e('0x5e')]:_0x597506[_0x5b3e('0x51')];_0x5e62d9[_0x5b3e('0x62')]=qs[_0x5b3e('0x63')](_0x37db5e['query'][_0x5b3e('0x63')]);_0x5e62d9[_0x5b3e('0x64')]=qs['filters'](_[_0x5b3e('0x7c')](_0x37db5e[_0x5b3e('0x59')],_0x597506['filters']));if(_0x37db5e[_0x5b3e('0x59')][_0x5b3e('0x67')]){_0x5e62d9['where']=_['merge'](_0x5e62d9[_0x5b3e('0x64')],{'$or':_[_0x5b3e('0x3e')](_0x5e62d9['attributes'],function(_0x46148a){var _0x1b3952={};_0x1b3952[_0x46148a]={'$like':'%'+_0x37db5e[_0x5b3e('0x59')][_0x5b3e('0x67')]+'%'};return _0x1b3952;})});}_0x5e62d9=_['merge']({},_0x5e62d9,_0x37db5e[_0x5b3e('0x68')]);return _0x4852c4[_0x5b3e('0x127')](_0x5e62d9);}})[_0x5b3e('0x29')](function(_0x209eed){if(_0x209eed){_0x10335a=_0x209eed[_0x5b3e('0x5f')];if(!_0x37db5e[_0x5b3e('0x59')]['hasOwnProperty']('nolimit')){_0x5e62d9[_0x5b3e('0x22')]=qs[_0x5b3e('0x22')](_0x37db5e[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x5e62d9['offset']=qs[_0x5b3e('0x25')](_0x37db5e[_0x5b3e('0x59')]['offset']);}return _0x4852c4['getProactiveActions'](_0x5e62d9);}})[_0x5b3e('0x29')](function(_0x33b6be){if(_0x33b6be){return _0x33b6be?{'count':_0x10335a,'rows':_0x33b6be}:null;}})[_0x5b3e('0x29')](respondWithResult(_0x1be671,null))[_0x5b3e('0x3c')](handleError(_0x1be671,null));};exports[_0x5b3e('0x128')]=function(_0x1696ec,_0x2b7b74){var _0x2b4064=_0x1696ec[_0x5b3e('0x59')]['online']===_0x5b3e('0x129')?_0x5b3e('0x12a'):_0x5b3e('0x12b');return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'attributes':['id',_0x2b4064],'where':{'id':_0x1696ec[_0x5b3e('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2b7b74,null))['then'](function(_0x5e32eb){if(_0x5e32eb){var _0x295a80=_0x5e32eb[_0x2b4064];var _0x1cb4d9=_0x295a80&&_0x295a80[_0x5b3e('0x12c')]?_0x295a80['items']:[];_0x2b7b74[_0x5b3e('0x2f')]({'fromKey':_['isNil'](_0x295a80[_0x5b3e('0x12d')])?undefined:_0x295a80['fromKey'],'count':_0x1cb4d9['length'],'rows':_0x1cb4d9});}})['catch'](handleError(_0x2b7b74,null));};exports[_0x5b3e('0x12e')]=function(_0x3d4f10,_0x16331d){var _0x3f6d37={'raw':![],'where':{}};var _0x549711={};var _0x1e8f47={'count':0x0,'rows':[]};return db[_0x5b3e('0x56')][_0x5b3e('0x7b')]({'where':{'id':_0x3d4f10[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x16331d,null))[_0x5b3e('0x29')](function(_0x869738){if(_0x869738){_0x549711['model']=_[_0x5b3e('0x5a')](db[_0x5b3e('0xe0')][_0x5b3e('0x57')]);_0x549711[_0x5b3e('0x59')]=_[_0x5b3e('0x5a')](_0x3d4f10[_0x5b3e('0x59')]);_0x549711['filters']=_[_0x5b3e('0x5c')](_0x549711[_0x5b3e('0x51')],_0x549711[_0x5b3e('0x59')]);_0x3f6d37[_0x5b3e('0x5e')]=_[_0x5b3e('0x5c')](_0x549711[_0x5b3e('0x51')],qs['fields'](_0x3d4f10[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x3f6d37[_0x5b3e('0x5e')]=_0x3f6d37[_0x5b3e('0x5e')][_0x5b3e('0x5f')]?_0x3f6d37['attributes']:_0x549711[_0x5b3e('0x51')];if(!_0x3d4f10[_0x5b3e('0x59')]['hasOwnProperty'](_0x5b3e('0x61'))){_0x3f6d37['limit']=qs['limit'](_0x3d4f10[_0x5b3e('0x59')][_0x5b3e('0x22')]);_0x3f6d37[_0x5b3e('0x25')]=qs[_0x5b3e('0x25')](_0x3d4f10[_0x5b3e('0x59')]['offset']);}_0x3f6d37[_0x5b3e('0x62')]=qs[_0x5b3e('0x63')](_0x3d4f10[_0x5b3e('0x59')]['sort']);_0x3f6d37[_0x5b3e('0x64')]=qs[_0x5b3e('0x5b')](_[_0x5b3e('0x7c')](_0x3d4f10[_0x5b3e('0x59')],_0x549711[_0x5b3e('0x5b')]));_0x3f6d37['where']['ChatWebsiteId']=_0x869738['id'];if(_0x3d4f10[_0x5b3e('0x59')]['filter']){_0x3f6d37['where']=_[_0x5b3e('0x65')](_0x3f6d37[_0x5b3e('0x64')],{'$or':_[_0x5b3e('0x3e')](_0x3f6d37[_0x5b3e('0x5e')],function(_0x30b7e5){var _0x57acee={};_0x57acee[_0x30b7e5]={'$like':'%'+_0x3d4f10[_0x5b3e('0x59')][_0x5b3e('0x67')]+'%'};return _0x57acee;})});}_0x3f6d37=_[_0x5b3e('0x65')]({},_0x3f6d37,_0x3d4f10[_0x5b3e('0x68')]);return db['ChatOfflineMessage']['count']({'where':_0x3f6d37[_0x5b3e('0x64')]})['then'](function(_0x4d561c){_0x1e8f47['count']=_0x4d561c;if(_0x3d4f10[_0x5b3e('0x59')][_0x5b3e('0x69')]){_0x3f6d37[_0x5b3e('0x7e')]=[{'all':!![]}];}else{_0x3f6d37['include']=[{'model':db[_0x5b3e('0xa3')],'as':'Contact','required':![]},{'model':db[_0x5b3e('0xe7')],'as':_0x5b3e('0x12f'),'required':![]}];}return db[_0x5b3e('0xe0')][_0x5b3e('0x6a')](_0x3f6d37);})[_0x5b3e('0x29')](function(_0x4a074f){_0x1e8f47[_0x5b3e('0x6b')]=_0x4a074f;return _0x1e8f47;});}})[_0x5b3e('0x29')](respondWithFilteredResult(_0x16331d,_0x3f6d37))['catch'](handleError(_0x16331d,null));};exports[_0x5b3e('0x130')]=function(_0x1137d7,_0x1097b3){return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x1137d7['params']['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x1097b3,null))[_0x5b3e('0x29')](function(_0x19556b){if(_0x19556b){return _0x19556b[_0x5b3e('0x130')](_0x1137d7[_0x5b3e('0x70')]['ids'],_['omit'](_0x1137d7[_0x5b3e('0x70')],['ids','id'])||{})[_0x5b3e('0xda')](function(_0x233fd0){for(var _0x1bb28d=0x0;_0x1bb28d<_0x1137d7[_0x5b3e('0x70')]['ids'][_0x5b3e('0x5f')];_0x1bb28d+=0x1){socket[_0x5b3e('0x131')]('userChatWebsite:save',{'UserId':Number(_0x1137d7['body']['ids'][_0x1bb28d]),'ChatWebsiteId':Number(_0x1137d7['params']['id'])});}return _0x233fd0;});}})['then'](respondWithResult(_0x1097b3,null))[_0x5b3e('0x3c')](handleError(_0x1097b3,null));};exports[_0x5b3e('0x132')]=function(_0x103d7e,_0x529a80){return db[_0x5b3e('0x56')][_0x5b3e('0x6e')]({'where':{'id':_0x103d7e[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x529a80,null))[_0x5b3e('0x29')](function(_0x5aee89){if(_0x5aee89){return _0x5aee89['removeAgents'](_0x103d7e[_0x5b3e('0x59')][_0x5b3e('0x80')])['then'](function(){if(_['isArray'](_0x103d7e['query'][_0x5b3e('0x80')])){for(var _0x3a3c29=0x0;_0x3a3c29<_0x103d7e[_0x5b3e('0x59')][_0x5b3e('0x80')][_0x5b3e('0x5f')];_0x3a3c29+=0x1){socket[_0x5b3e('0x131')]('userChatWebsite:remove',{'UserId':Number(_0x103d7e[_0x5b3e('0x59')][_0x5b3e('0x80')][_0x3a3c29]),'ChatWebsiteId':Number(_0x103d7e[_0x5b3e('0x6d')]['id'])});}}else{socket[_0x5b3e('0x131')](_0x5b3e('0x133'),{'UserId':Number(_0x103d7e[_0x5b3e('0x59')][_0x5b3e('0x80')]),'ChatWebsiteId':Number(_0x103d7e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x529a80,null))[_0x5b3e('0x3c')](handleError(_0x529a80,null));};exports[_0x5b3e('0x134')]=function(_0x47806c,_0x4bfe9f){var _0x3fd6bb={};var _0x5d871d={};var _0x4a9512;var _0x3e4138;return db['ChatWebsite'][_0x5b3e('0x7b')]({'where':{'id':_0x47806c[_0x5b3e('0x6d')]['id']}})[_0x5b3e('0x29')](handleEntityNotFound(_0x4bfe9f,null))['then'](function(_0x5d2db6){if(_0x5d2db6){_0x4a9512=_0x5d2db6;_0x5d871d[_0x5b3e('0x51')]=_[_0x5b3e('0x5a')](db['User'][_0x5b3e('0x57')]);_0x5d871d[_0x5b3e('0x59')]=_['keys'](_0x47806c[_0x5b3e('0x59')]);_0x5d871d['filters']=_[_0x5b3e('0x5c')](_0x5d871d['model'],_0x5d871d[_0x5b3e('0x59')]);_0x3fd6bb[_0x5b3e('0x5e')]=_['intersection'](_0x5d871d[_0x5b3e('0x51')],qs[_0x5b3e('0x5d')](_0x47806c[_0x5b3e('0x59')][_0x5b3e('0x5d')]));_0x3fd6bb['attributes']=_0x3fd6bb[_0x5b3e('0x5e')]['length']?_0x3fd6bb[_0x5b3e('0x5e')]:_0x5d871d[_0x5b3e('0x51')];_0x3fd6bb['order']=qs[_0x5b3e('0x63')](_0x47806c[_0x5b3e('0x59')]['sort']);_0x3fd6bb[_0x5b3e('0x64')]=qs[_0x5b3e('0x5b')](_[_0x5b3e('0x7c')](_0x47806c[_0x5b3e('0x59')],_0x5d871d[_0x5b3e('0x5b')]));if(_0x47806c[_0x5b3e('0x59')]['filter']){_0x3fd6bb['where']=_[_0x5b3e('0x65')](_0x3fd6bb[_0x5b3e('0x64')],{'$or':_[_0x5b3e('0x3e')](_0x3fd6bb[_0x5b3e('0x5e')],function(_0x2cdc91){var _0x265b73={};_0x265b73[_0x2cdc91]={'$like':'%'+_0x47806c['query']['filter']+'%'};return _0x265b73;})});}_0x3fd6bb=_[_0x5b3e('0x65')]({},_0x3fd6bb,_0x47806c[_0x5b3e('0x68')]);return _0x4a9512[_0x5b3e('0x134')](_0x3fd6bb);}})['then'](function(_0x31d591){if(_0x31d591){_0x3e4138=_0x31d591[_0x5b3e('0x5f')];if(!_0x47806c[_0x5b3e('0x59')][_0x5b3e('0x60')](_0x5b3e('0x61'))){_0x3fd6bb[_0x5b3e('0x22')]=qs[_0x5b3e('0x22')](_0x47806c[_0x5b3e('0x59')]['limit']);_0x3fd6bb[_0x5b3e('0x25')]=qs[_0x5b3e('0x25')](_0x47806c['query'][_0x5b3e('0x25')]);}return _0x4a9512[_0x5b3e('0x134')](_0x3fd6bb);}})[_0x5b3e('0x29')](function(_0x21c53c){if(_0x21c53c){return _0x21c53c?{'count':_0x3e4138,'rows':_0x21c53c}:null;}})[_0x5b3e('0x29')](respondWithResult(_0x4bfe9f,null))[_0x5b3e('0x3c')](handleError(_0x4bfe9f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ce30580..db619e0 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 _0x4fde=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x43afbb,_0x448109){var _0xa9ddec=function(_0x4e965f){while(--_0x4e965f){_0x43afbb['push'](_0x43afbb['shift']());}};_0xa9ddec(++_0x448109);}(_0x4fde,0x19f));var _0xe4fd=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x4fde[_0x5be7aa];return _0x215408;};'use strict';var EventEmitter=require(_0xe4fd('0x0'));var ChatWebsite=require(_0xe4fd('0x1'))['db'][_0xe4fd('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe4fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4fd('0x4'),'afterDestroy':_0xe4fd('0x5')};function emitEvent(_0x4bf61e){return function(_0x36d49f,_0x3c4c49,_0x8b810a){ChatWebsiteEvents[_0xe4fd('0x6')](_0x4bf61e+':'+_0x36d49f['id'],_0x36d49f);ChatWebsiteEvents[_0xe4fd('0x6')](_0x4bf61e,_0x36d49f);_0x8b810a(null);};}for(var e in events){if(events[_0xe4fd('0x7')](e)){var event=events[e];ChatWebsite[_0xe4fd('0x8')](e,emitEvent(event));}}module[_0xe4fd('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x95f4=['ChatWebsite','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x95f4,0xf1));var _0x495f=function(_0x31742e,_0x223fdf){_0x31742e=_0x31742e-0x0;var _0x522b5e=_0x95f4[_0x31742e];return _0x522b5e;};'use strict';var EventEmitter=require(_0x495f('0x0'));var ChatWebsite=require(_0x495f('0x1'))['db'][_0x495f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x495f('0x3'),'afterDestroy':_0x495f('0x4')};function emitEvent(_0x5edb36){return function(_0x501377,_0x87cc22,_0x22465d){ChatWebsiteEvents[_0x495f('0x5')](_0x5edb36+':'+_0x501377['id'],_0x501377);ChatWebsiteEvents['emit'](_0x5edb36,_0x501377);_0x22465d(null);};}for(var e in events){if(events[_0x495f('0x6')](e)){var event=events[e];ChatWebsite[_0x495f('0x7')](e,emitEvent(event));}}module[_0x495f('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index dd9a231..b33044a 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 _0x5c65=['moment','bluebird','request-promise','rimraf','exports','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x4586f9,_0x39aee8){var _0x41d034=function(_0x31002c){while(--_0x31002c){_0x4586f9['push'](_0x4586f9['shift']());}};_0x41d034(++_0x39aee8);}(_0x5c65,0xb1));var _0x55c6=function(_0x528c42,_0x596eb4){_0x528c42=_0x528c42-0x0;var _0x607b50=_0x5c65[_0x528c42];return _0x607b50;};'use strict';var _=require(_0x55c6('0x0'));var util=require(_0x55c6('0x1'));var logger=require(_0x55c6('0x2'))('api');var moment=require(_0x55c6('0x3'));var BPromise=require(_0x55c6('0x4'));var rp=require(_0x55c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55c6('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x55c6('0x7')]=function(_0x5c01cf,_0x10a484){return _0x5c01cf[_0x55c6('0x8')](_0x55c6('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9dc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites','lodash','util','../../config/logger'];(function(_0x190d26,_0x133371){var _0x2302e4=function(_0x108222){while(--_0x108222){_0x190d26['push'](_0x190d26['shift']());}};_0x2302e4(++_0x133371);}(_0xd9dc,0x101));var _0xcd9d=function(_0x4bdcbf,_0x306baf){_0x4bdcbf=_0x4bdcbf-0x0;var _0x21b314=_0xd9dc[_0x4bdcbf];return _0x21b314;};'use strict';var _=require(_0xcd9d('0x0'));var util=require(_0xcd9d('0x1'));var logger=require(_0xcd9d('0x2'))(_0xcd9d('0x3'));var moment=require(_0xcd9d('0x4'));var BPromise=require(_0xcd9d('0x5'));var rp=require(_0xcd9d('0x6'));var fs=require('fs');var path=require(_0xcd9d('0x7'));var rimraf=require(_0xcd9d('0x8'));var config=require(_0xcd9d('0x9'));var attributes=require(_0xcd9d('0xa'));module[_0xcd9d('0xb')]=function(_0x47190f,_0x3937d6){return _0x47190f['define']('ChatWebsite',attributes,{'tableName':_0xcd9d('0xc'),'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 adf0e0b..8814806 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 _0x581d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0xaf803f,_0x22b3f6){var _0x40669f=function(_0x57aa19){while(--_0x57aa19){_0xaf803f['push'](_0xaf803f['shift']());}};_0x40669f(++_0x22b3f6);}(_0x581d,0xa8));var _0xd581=function(_0x80a3c,_0x24c35a){_0x80a3c=_0x80a3c-0x0;var _0x41b3bf=_0x581d[_0x80a3c];return _0x41b3bf;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var moment=require(_0xd581('0x2'));var BPromise=require(_0xd581('0x3'));var rs=require(_0xd581('0x4'));var fs=require('fs');var Redis=require(_0xd581('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd581('0x6'));var logger=require(_0xd581('0x7'))(_0xd581('0x8'));var config=require(_0xd581('0x9'));var jayson=require(_0xd581('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xd581('0xb')]=_[_0xd581('0xc')](config[_0xd581('0xb')],{'host':_0xd581('0xd'),'port':0x18eb});var socket=require(_0xd581('0xe'))(new Redis(config[_0xd581('0xb')]));require(_0xd581('0xf'))[_0xd581('0x10')](socket);function respondWithRpcPromise(_0x3f5fe5,_0xd3a3b4,_0x23497f){return new BPromise(function(_0x5dcc88,_0x2c5d9d){return client['request'](_0x3f5fe5,_0x23497f)[_0xd581('0x11')](function(_0x565ab8){logger['info'](_0xd581('0x12'),_0xd3a3b4,'request\x20sent');logger[_0xd581('0x13')](_0xd581('0x14'),_0xd3a3b4,_0xd581('0x15'),JSON[_0xd581('0x16')](_0x565ab8));if(_0x565ab8[_0xd581('0x17')]){if(_0x565ab8['error'][_0xd581('0x18')]===0x1f4){logger['error'](_0xd581('0x12'),_0xd3a3b4,_0x565ab8[_0xd581('0x17')]['message']);return _0x2c5d9d(_0x565ab8['error'][_0xd581('0x19')]);}logger['error'](_0xd581('0x12'),_0xd3a3b4,_0x565ab8[_0xd581('0x17')][_0xd581('0x19')]);return _0x5dcc88(_0x565ab8[_0xd581('0x17')][_0xd581('0x19')]);}else{logger[_0xd581('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xd3a3b4,_0xd581('0x15'));_0x5dcc88(_0x565ab8['result'][_0xd581('0x19')]);}})[_0xd581('0x1b')](function(_0x217553){logger[_0xd581('0x17')]('ChatWebsite,\x20%s,\x20%s',_0xd3a3b4,_0x217553);_0x2c5d9d(_0x217553);});});} \ No newline at end of file +var _0xd22f=['error','message','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify'];(function(_0x1ebc0f,_0x12171a){var _0x5d9cbd=function(_0x1d3bb4){while(--_0x1d3bb4){_0x1ebc0f['push'](_0x1ebc0f['shift']());}};_0x5d9cbd(++_0x12171a);}(_0xd22f,0x1a4));var _0xfd22=function(_0x97501e,_0x48c8fd){_0x97501e=_0x97501e-0x0;var _0x5919c8=_0xd22f[_0x97501e];return _0x5919c8;};'use strict';var _=require(_0xfd22('0x0'));var util=require(_0xfd22('0x1'));var moment=require(_0xfd22('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd22('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd22('0x5'))(_0xfd22('0x6'));var config=require(_0xfd22('0x7'));var jayson=require(_0xfd22('0x8'));var client=jayson[_0xfd22('0x9')]['http']({'port':0x232a});config[_0xfd22('0xa')]=_[_0xfd22('0xb')](config[_0xfd22('0xa')],{'host':_0xfd22('0xc'),'port':0x18eb});var socket=require(_0xfd22('0xd'))(new Redis(config[_0xfd22('0xa')]));require(_0xfd22('0xe'))[_0xfd22('0xf')](socket);function respondWithRpcPromise(_0x9671a,_0x17ea00,_0x2d9aa7){return new BPromise(function(_0xc67996,_0x36e1cc){return client[_0xfd22('0x10')](_0x9671a,_0x2d9aa7)[_0xfd22('0x11')](function(_0x38601f){logger[_0xfd22('0x12')](_0xfd22('0x13'),_0x17ea00,'request\x20sent');logger[_0xfd22('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x17ea00,'request\x20sent',JSON[_0xfd22('0x15')](_0x38601f));if(_0x38601f[_0xfd22('0x16')]){if(_0x38601f['error']['code']===0x1f4){logger[_0xfd22('0x16')](_0xfd22('0x13'),_0x17ea00,_0x38601f[_0xfd22('0x16')][_0xfd22('0x17')]);return _0x36e1cc(_0x38601f[_0xfd22('0x16')]['message']);}logger['error'](_0xfd22('0x13'),_0x17ea00,_0x38601f[_0xfd22('0x16')][_0xfd22('0x17')]);return _0xc67996(_0x38601f['error']['message']);}else{logger[_0xfd22('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x17ea00,_0xfd22('0x18'));_0xc67996(_0x38601f['result']['message']);}})[_0xfd22('0x19')](function(_0x3faade){logger[_0xfd22('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x17ea00,_0x3faade);_0x36e1cc(_0x3faade);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index b2392f5..7f3a1a4 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 _0x4b05=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x73f378,_0x550420){var _0x57db43=function(_0xdecd43){while(--_0xdecd43){_0x73f378['push'](_0x73f378['shift']());}};_0x57db43(++_0x550420);}(_0x4b05,0x1e1));var _0x54b0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b05[_0x122ef9];return _0x42fba0;};'use strict';var ChatWebsiteEvents=require(_0x54b0('0x0'));var events=[_0x54b0('0x1'),_0x54b0('0x2'),_0x54b0('0x3')];function createListener(_0x6c4a55,_0x276028){return function(_0x2aabb7){_0x276028[_0x54b0('0x4')](_0x6c4a55,_0x2aabb7);};}function removeListener(_0x412cbd,_0xe8132e){return function(){ChatWebsiteEvents[_0x54b0('0x5')](_0x412cbd,_0xe8132e);};}exports[_0x54b0('0x6')]=function(_0x39b968){for(var _0x5cbae1=0x0,_0x332243=events[_0x54b0('0x7')];_0x5cbae1<_0x332243;_0x5cbae1++){var _0x1b6653=events[_0x5cbae1];var _0x5e72fd=createListener(_0x54b0('0x8')+_0x1b6653,_0x39b968);ChatWebsiteEvents['on'](_0x1b6653,_0x5e72fd);}}; \ No newline at end of file +var _0x6bd9=['emit','removeListener','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x22d7bb,_0x4c158e){var _0x40a737=function(_0xd85bab){while(--_0xd85bab){_0x22d7bb['push'](_0x22d7bb['shift']());}};_0x40a737(++_0x4c158e);}(_0x6bd9,0xea));var _0x96bd=function(_0x2ab202,_0x5a8f28){_0x2ab202=_0x2ab202-0x0;var _0x64b1be=_0x6bd9[_0x2ab202];return _0x64b1be;};'use strict';var ChatWebsiteEvents=require(_0x96bd('0x0'));var events=[_0x96bd('0x1'),_0x96bd('0x2'),_0x96bd('0x3')];function createListener(_0x31c113,_0x585a33){return function(_0x591b34){_0x585a33[_0x96bd('0x4')](_0x31c113,_0x591b34);};}function removeListener(_0x1878a7,_0x5f49e4){return function(){ChatWebsiteEvents[_0x96bd('0x5')](_0x1878a7,_0x5f49e4);};}exports['register']=function(_0x1e50e1){for(var _0x53fbdf=0x0,_0x3cde87=events['length'];_0x53fbdf<_0x3cde87;_0x53fbdf++){var _0x452759=events[_0x53fbdf];var _0x532736=createListener(_0x96bd('0x6')+_0x452759,_0x1e50e1);ChatWebsiteEvents['on'](_0x452759,_0x532736);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b969ae3..31efb6d 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 _0x8167=['file','addLogo','server/files/images/avatars/','single','addAvatar','format','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','/:id/logo'];(function(_0x573f5b,_0x3b1368){var _0x4118ca=function(_0x3b5600){while(--_0x3b5600){_0x573f5b['push'](_0x573f5b['shift']());}};_0x4118ca(++_0x3b1368);}(_0x8167,0x136));var _0x7816=function(_0x2c6106,_0x24820c){_0x2c6106=_0x2c6106-0x0;var _0x446d8a=_0x8167[_0x2c6106];return _0x446d8a;};'use strict';var multer=require(_0x7816('0x0'));var util=require(_0x7816('0x1'));var path=require(_0x7816('0x2'));var timeout=require(_0x7816('0x3'));var express=require(_0x7816('0x4'));var router=express[_0x7816('0x5')]();var fs_extra=require(_0x7816('0x6'));var auth=require(_0x7816('0x7'));var interaction=require(_0x7816('0x8'));var config=require(_0x7816('0x9'));var controller=require('./chatWebsite.controller');router[_0x7816('0xa')]('/',auth['isAuthenticated'](),controller[_0x7816('0xb')]);router[_0x7816('0xa')](_0x7816('0xc'),auth['isAuthenticated'](),controller[_0x7816('0xd')]);router['get'](_0x7816('0xe'),auth[_0x7816('0xf')](),controller['show']);router[_0x7816('0xa')](_0x7816('0x10'),auth[_0x7816('0xf')](),controller[_0x7816('0x11')]);router[_0x7816('0xa')](_0x7816('0x12'),auth[_0x7816('0xf')](),controller['getAnswers']);router[_0x7816('0xa')]('/:id/logo',controller['getLogo']);router[_0x7816('0xa')](_0x7816('0x13'),controller['getAvatar']);router[_0x7816('0xa')](_0x7816('0x14'),controller[_0x7816('0x15')]);router[_0x7816('0xa')](_0x7816('0x16'),controller[_0x7816('0x17')]);router[_0x7816('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x7816('0x18')]);router[_0x7816('0xa')](_0x7816('0x19'),controller[_0x7816('0x1a')]);router[_0x7816('0xa')](_0x7816('0x1b'),auth[_0x7816('0xf')](),controller[_0x7816('0x1c')]);router[_0x7816('0xa')]('/:id/proactive_actions',auth[_0x7816('0xf')](),controller[_0x7816('0x1d')]);router[_0x7816('0xa')]('/:id/fields',controller[_0x7816('0x1e')]);router[_0x7816('0xa')](_0x7816('0x1f'),auth[_0x7816('0xf')](),controller['getOfflineMessages']);router[_0x7816('0xa')](_0x7816('0x20'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7816('0x21')]('/',auth['isAuthenticated'](),controller[_0x7816('0x22')]);router[_0x7816('0x21')](_0x7816('0x10'),auth[_0x7816('0xf')](),controller[_0x7816('0x23')]);router['post']('/:id/canned_answers',auth[_0x7816('0xf')](),controller[_0x7816('0x24')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x70beb2,_0x5a9bc2,_0x44ef7e){_0x44ef7e(null,path[_0x7816('0x26')](config[_0x7816('0x27')],_0x7816('0x28')));},'filename':function(_0x38df7b,_0xf01f0,_0x1b7439){_0x1b7439(null,util['format'](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0xf01f0[_0x7816('0x2b')]));}})});router['post'](_0x7816('0x2c'),upload['single'](_0x7816('0x2d')),controller[_0x7816('0x2e')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x4562b5,_0x2c2774,_0xfbcb99){_0xfbcb99(null,path[_0x7816('0x26')](config['root'],_0x7816('0x2f')));},'filename':function(_0x1b1d6d,_0xf43d41,_0x255742){_0x255742(null,util['format'](_0x7816('0x29'),Date['now'](),_0xf43d41[_0x7816('0x2b')]));}})});router['post']('/:id/avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x31')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x449a77,_0x278074,_0x444102){_0x444102(null,path[_0x7816('0x26')](config['root'],_0x7816('0x2f')));},'filename':function(_0x539739,_0x2aab88,_0xeea89f){_0xeea89f(null,util[_0x7816('0x32')](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0x2aab88['originalname']));}})});router[_0x7816('0x21')]('/:id/customer_avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x33')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x490b22,_0x972218,_0x2f5363){_0x2f5363(null,path[_0x7816('0x26')](config[_0x7816('0x27')],'server/files/images/avatars/'));},'filename':function(_0x37c8c8,_0x48b7f5,_0x415f46){_0x415f46(null,util[_0x7816('0x32')](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0x48b7f5[_0x7816('0x2b')]));}})});router[_0x7816('0x21')]('/:id/system_avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x34')]);router[_0x7816('0x21')]('/:id/notify',controller[_0x7816('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x438b6a,_0xfd2dab,_0x289927){const _0x48a6d9=path[_0x7816('0x26')](config[_0x7816('0x27')],_0x7816('0x36'),_0x7816('0x37'),_0x7816('0x38'));fs_extra[_0x7816('0x39')](_0x48a6d9,function(){_0x289927(null,_0x48a6d9);});},'filename':function(_0x30fdc9,_0xabc22,_0x2d2f7f){const _0x872740=_0xabc22[_0x7816('0x2b')][_0x7816('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5a1a74=path['extname'](_0x872740);const _0x58e3b8=Date[_0x7816('0x2a')]()+'-'+_0x872740[_0x7816('0x3a')](_0x5a1a74,'')+_0x5a1a74;_0x2d2f7f(null,_0x58e3b8);}})});router[_0x7816('0x21')](_0x7816('0x3b'),offlineUploadMulter[_0x7816('0x3c')](),controller[_0x7816('0x3d')]);router['post'](_0x7816('0x3e'),auth['isAuthenticated'](),controller[_0x7816('0x3f')]);router['post'](_0x7816('0x1b'),auth[_0x7816('0xf')](),controller[_0x7816('0x40')]);router['post'](_0x7816('0x41'),auth[_0x7816('0xf')](),controller['addProactiveActions']);router[_0x7816('0x21')](_0x7816('0x20'),auth[_0x7816('0xf')](),controller['addAgents']);router['put'](_0x7816('0xe'),auth[_0x7816('0xf')](),controller[_0x7816('0x42')]);router[_0x7816('0x43')](_0x7816('0xe'),auth[_0x7816('0xf')](),controller[_0x7816('0x44')]);router[_0x7816('0x43')]('/:id/dispositions',auth[_0x7816('0xf')](),controller[_0x7816('0x45')]);router[_0x7816('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x7816('0x43')](_0x7816('0x20'),auth[_0x7816('0xf')](),controller['removeAgents']);module[_0x7816('0x46')]=router; \ No newline at end of file +var _0x8c21=['/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getProactiveActions','getFields','getOfflineMessages','getAgents','post','create','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','/:id/avatar','single','addAvatar','root','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','/:id/users','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar'];(function(_0x95b44e,_0x4af5e1){var _0x4d33ea=function(_0x35acd6){while(--_0x35acd6){_0x95b44e['push'](_0x95b44e['shift']());}};_0x4d33ea(++_0x4af5e1);}(_0x8c21,0x18c));var _0x18c2=function(_0x54996a,_0x4670ee){_0x54996a=_0x54996a-0x0;var _0x2f2bdd=_0x8c21[_0x54996a];return _0x2f2bdd;};'use strict';var multer=require(_0x18c2('0x0'));var util=require(_0x18c2('0x1'));var path=require(_0x18c2('0x2'));var timeout=require(_0x18c2('0x3'));var express=require(_0x18c2('0x4'));var router=express['Router']();var fs_extra=require(_0x18c2('0x5'));var auth=require(_0x18c2('0x6'));var interaction=require(_0x18c2('0x7'));var config=require(_0x18c2('0x8'));var controller=require(_0x18c2('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x18c2('0xa')]('/describe',auth[_0x18c2('0xb')](),controller[_0x18c2('0xc')]);router[_0x18c2('0xa')](_0x18c2('0xd'),auth['isAuthenticated'](),controller[_0x18c2('0xe')]);router[_0x18c2('0xa')](_0x18c2('0xf'),auth['isAuthenticated'](),controller[_0x18c2('0x10')]);router[_0x18c2('0xa')](_0x18c2('0x11'),auth[_0x18c2('0xb')](),controller[_0x18c2('0x12')]);router[_0x18c2('0xa')](_0x18c2('0x13'),controller[_0x18c2('0x14')]);router[_0x18c2('0xa')]('/:id/avatar',controller[_0x18c2('0x15')]);router[_0x18c2('0xa')](_0x18c2('0x16'),controller[_0x18c2('0x17')]);router['get'](_0x18c2('0x18'),controller[_0x18c2('0x19')]);router[_0x18c2('0xa')](_0x18c2('0x1a'),auth[_0x18c2('0xb')](),controller[_0x18c2('0x1b')]);router[_0x18c2('0xa')]('/:id/snippet',controller[_0x18c2('0x1c')]);router[_0x18c2('0xa')]('/:id/applications',auth[_0x18c2('0xb')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth[_0x18c2('0xb')](),controller[_0x18c2('0x1d')]);router[_0x18c2('0xa')]('/:id/fields',controller[_0x18c2('0x1e')]);router[_0x18c2('0xa')]('/:id/offline_messages',auth[_0x18c2('0xb')](),controller[_0x18c2('0x1f')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x18c2('0x20')]);router[_0x18c2('0x21')]('/',auth['isAuthenticated'](),controller[_0x18c2('0x22')]);router[_0x18c2('0x21')](_0x18c2('0xf'),auth[_0x18c2('0xb')](),controller['addDisposition']);router[_0x18c2('0x21')]('/:id/canned_answers',auth[_0x18c2('0xb')](),controller[_0x18c2('0x23')]);var upload=multer({'storage':multer[_0x18c2('0x24')]({'destination':function(_0xb14e9b,_0x2bfb51,_0x50a013){_0x50a013(null,path[_0x18c2('0x25')](config['root'],_0x18c2('0x26')));},'filename':function(_0x13803f,_0x354cad,_0x11015e){_0x11015e(null,util[_0x18c2('0x27')](_0x18c2('0x28'),Date[_0x18c2('0x29')](),_0x354cad[_0x18c2('0x2a')]));}})});router[_0x18c2('0x21')](_0x18c2('0x13'),upload['single'](_0x18c2('0x2b')),controller[_0x18c2('0x2c')]);var upload=multer({'storage':multer[_0x18c2('0x24')]({'destination':function(_0x2d9a08,_0x575a79,_0x3aac00){_0x3aac00(null,path[_0x18c2('0x25')](config['root'],_0x18c2('0x2d')));},'filename':function(_0xe29d4f,_0x2d9cec,_0x12659e){_0x12659e(null,util['format']('%s-%s',Date[_0x18c2('0x29')](),_0x2d9cec[_0x18c2('0x2a')]));}})});router[_0x18c2('0x21')](_0x18c2('0x2e'),upload[_0x18c2('0x2f')](_0x18c2('0x2b')),controller[_0x18c2('0x30')]);var upload=multer({'storage':multer[_0x18c2('0x24')]({'destination':function(_0x3dc230,_0xc55e6,_0x65c98a){_0x65c98a(null,path['join'](config[_0x18c2('0x31')],_0x18c2('0x2d')));},'filename':function(_0x577ab8,_0x366f38,_0x23d0ca){_0x23d0ca(null,util[_0x18c2('0x27')](_0x18c2('0x28'),Date[_0x18c2('0x29')](),_0x366f38[_0x18c2('0x2a')]));}})});router[_0x18c2('0x21')](_0x18c2('0x16'),upload['single']('file'),controller[_0x18c2('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a08b9,_0x1c3eb3,_0x2f27da){_0x2f27da(null,path['join'](config[_0x18c2('0x31')],'server/files/images/avatars/'));},'filename':function(_0x367acc,_0x2c2a9c,_0x2f0477){_0x2f0477(null,util[_0x18c2('0x27')](_0x18c2('0x28'),Date[_0x18c2('0x29')](),_0x2c2a9c['originalname']));}})});router['post'](_0x18c2('0x18'),upload['single'](_0x18c2('0x2b')),controller[_0x18c2('0x33')]);router[_0x18c2('0x21')](_0x18c2('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x18c2('0x24')]({'destination':function(_0x181c52,_0x5e3744,_0x662105){const _0x5718e2=path[_0x18c2('0x25')](config['root'],_0x18c2('0x35'),'attachments',_0x18c2('0x36'));fs_extra[_0x18c2('0x37')](_0x5718e2,function(){_0x662105(null,_0x5718e2);});},'filename':function(_0x2ca086,_0x4d30b3,_0x3ae70d){const _0x524b64=_0x4d30b3[_0x18c2('0x2a')][_0x18c2('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x335fde=path['extname'](_0x524b64);const _0xbe5908=Date[_0x18c2('0x29')]()+'-'+_0x524b64[_0x18c2('0x38')](_0x335fde,'')+_0x335fde;_0x3ae70d(null,_0xbe5908);}})});router[_0x18c2('0x21')]('/:id/offline',offlineUploadMulter['any'](),controller['offline']);router['post'](_0x18c2('0x1a'),auth['isAuthenticated'](),controller[_0x18c2('0x39')]);router['post'](_0x18c2('0x3a'),auth['isAuthenticated'](),controller[_0x18c2('0x3b')]);router['post'](_0x18c2('0x3c'),auth['isAuthenticated'](),controller[_0x18c2('0x3d')]);router[_0x18c2('0x21')](_0x18c2('0x3e'),auth[_0x18c2('0xb')](),controller['addAgents']);router[_0x18c2('0x3f')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x18c2('0xb')](),controller[_0x18c2('0x40')]);router[_0x18c2('0x41')](_0x18c2('0xf'),auth[_0x18c2('0xb')](),controller[_0x18c2('0x42')]);router[_0x18c2('0x41')](_0x18c2('0x11'),auth[_0x18c2('0xb')](),controller[_0x18c2('0x43')]);router[_0x18c2('0x41')](_0x18c2('0x3e'),auth[_0x18c2('0xb')](),controller[_0x18c2('0x44')]);module[_0x18c2('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 10530f9..dd7c0c6 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 _0x0e6c=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x0e6c,0x13c));var _0xc0e6=function(_0x41200c,_0x195027){_0x41200c=_0x41200c-0x0;var _0x2a4cf4=_0x0e6c[_0x41200c];return _0x2a4cf4;};var beaverLogger=require(_0xc0e6('0x0'));var express=require(_0xc0e6('0x1'));var auth=require(_0xc0e6('0x2'));var config=require(_0xc0e6('0x3'));var router=express[_0xc0e6('0x4')]();var isProduction=config[_0xc0e6('0x5')]===_0xc0e6('0x6')||![];function clientSideLogs(_0x1f2f55,_0x2a5999,_0xede790){var _0x41af34=_0x1f2f55[_0xc0e6('0x7')][_0xc0e6('0x8')](_0xc0e6('0x9'));if(!_0x41af34){throw new Error(_0xc0e6('0xa'));}return beaverLogger[_0xc0e6('0xb')]({'uri':_0xc0e6('0xc'),'logger':_0x41af34,'enableCors':!isProduction})(_0x1f2f55,_0x2a5999,_0xede790);}router[_0xc0e6('0xd')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xfabe=['exports','../components/auth/service','../config/environment','Router','env','get','Client-Side\x20logger\x20not\x20found!','/client-logs','isAuthenticated'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xfabe,0x64));var _0xefab=function(_0x4b4765,_0x32d7b6){_0x4b4765=_0x4b4765-0x0;var _0x590656=_0xfabe[_0x4b4765];return _0x590656;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xefab('0x0'));var config=require(_0xefab('0x1'));var router=express[_0xefab('0x2')]();var isProduction=config[_0xefab('0x3')]==='production'||![];function clientSideLogs(_0x54d8b3,_0x1d5015,_0x3e5bb7){var _0x36ae9=_0x54d8b3['app'][_0xefab('0x4')]('client-side-logger');if(!_0x36ae9){throw new Error(_0xefab('0x5'));}return beaverLogger['expressEndpoint']({'uri':_0xefab('0x6'),'logger':_0x36ae9,'enableCors':!isProduction})(_0x54d8b3,_0x1d5015,_0x3e5bb7);}router['use'](auth[_0xefab('0x7')](),clientSideLogs);module[_0xefab('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 836c356..9554fe9 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 _0x5d9e=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x4eaad4,_0x5e4a95){var _0x1527f9=function(_0x487873){while(--_0x487873){_0x4eaad4['push'](_0x4eaad4['shift']());}};_0x1527f9(++_0x5e4a95);}(_0x5d9e,0x199));var _0xe5d9=function(_0x37b1d2,_0x59b821){_0x37b1d2=_0x37b1d2-0x0;var _0x5ce1bb=_0x5d9e[_0x37b1d2];return _0x5ce1bb;};'use strict';var Sequelize=require(_0xe5d9('0x0'));module[_0xe5d9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe5d9('0x2')](_0xe5d9('0x3'),_0xe5d9('0x4'),_0xe5d9('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe5d9('0x2')](_0xe5d9('0x6'),_0xe5d9('0x7'))},'data1':{'type':Sequelize[_0xe5d9('0x8')],'comment':_0xe5d9('0x9')},'data2':{'type':Sequelize[_0xe5d9('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xe5d9('0x8')],'comment':_0xe5d9('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0xe5d9('0xb')},'data5':{'type':Sequelize[_0xe5d9('0xc')],'comment':_0xe5d9('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe5d9('0xc')],'comment':_0xe5d9('0xe')}}; \ No newline at end of file +var _0x214c=['exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token'];(function(_0x1e6601,_0x99250b){var _0x44ddf1=function(_0x118097){while(--_0x118097){_0x1e6601['push'](_0x1e6601['shift']());}};_0x44ddf1(++_0x99250b);}(_0x214c,0x1a0));var _0xc214=function(_0x4353cd,_0x3c8895){_0x4353cd=_0x4353cd-0x0;var _0x4eb363=_0x214c[_0x4353cd];return _0x4eb363;};'use strict';var Sequelize=require('sequelize');module[_0xc214('0x0')]={'name':{'type':Sequelize[_0xc214('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc214('0x2')]('AmazonAWS',_0xc214('0x3'),_0xc214('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc214('0x2')](_0xc214('0x5'),_0xc214('0x6'))},'data1':{'type':Sequelize[_0xc214('0x1')],'comment':_0xc214('0x7')},'data2':{'type':Sequelize[_0xc214('0x1')],'comment':_0xc214('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xc214('0x9')},'data4':{'type':Sequelize[_0xc214('0x1')],'comment':_0xc214('0xa')},'data5':{'type':Sequelize[_0xc214('0xb')],'comment':_0xc214('0xc')},'data6':{'type':Sequelize[_0xc214('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc214('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9ba196d..ac34583 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 _0xc5d6=['update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','key','query','filters','attributes','model','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','MicrosoftAzure','data3','show','params','keys','intersection','fields','service','decryptString','create','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','catch','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0xc5d6,0x10b));var _0x6c5d=function(_0x351a4c,_0x2c7ac7){_0x351a4c=_0x351a4c-0x0;var _0x4ab784=_0xc5d6[_0x351a4c];return _0x4ab784;};'use strict';var _=require('lodash');var Redis=require(_0x6c5d('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x6c5d('0x1'));var config=require('../../config/environment');var logger=require(_0x6c5d('0x2'))(_0x6c5d('0x3'));var db=require(_0x6c5d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x6c5d('0x5')]=_[_0x6c5d('0x6')](config['redis'],{'host':_0x6c5d('0x7'),'port':0x18eb});var socket=require(_0x6c5d('0x8'))(new Redis(config[_0x6c5d('0x5')]));var redis=new Redis(config[_0x6c5d('0x5')]);function respondWithStatusCode(_0x2b47cf,_0x594cc6){_0x594cc6=_0x594cc6||0xcc;return function(_0x529106){if(_0x529106){return _0x2b47cf[_0x6c5d('0x9')](_0x594cc6);}return _0x2b47cf[_0x6c5d('0xa')](_0x594cc6)['end']();};}function respondWithResult(_0x436d8c,_0x4b23f8){_0x4b23f8=_0x4b23f8||0xc8;return function(_0x2dfcda){if(_0x2dfcda){return _0x436d8c[_0x6c5d('0xa')](_0x4b23f8)['json'](_0x2dfcda);}};}function respondWithFilteredResult(_0x445253,_0x365ba5){return function(_0x2b9761){if(_0x2b9761){var _0x5a8791=typeof _0x365ba5['offset']===_0x6c5d('0xb')&&typeof _0x365ba5[_0x6c5d('0xc')]===_0x6c5d('0xb');var _0x32aef5=_0x2b9761[_0x6c5d('0xd')];var _0x3bc8cd=_0x5a8791?0x0:_0x365ba5['offset'];var _0x59b31a=_0x5a8791?_0x2b9761[_0x6c5d('0xd')]:_0x365ba5[_0x6c5d('0xe')]+_0x365ba5[_0x6c5d('0xc')];var _0x23c67a;if(_0x59b31a>=_0x32aef5){_0x59b31a=_0x32aef5;_0x23c67a=0xc8;}else{_0x23c67a=0xce;}_0x445253[_0x6c5d('0xa')](_0x23c67a);return _0x445253[_0x6c5d('0xf')](_0x6c5d('0x10'),_0x3bc8cd+'-'+_0x59b31a+'/'+_0x32aef5)[_0x6c5d('0x11')](_0x2b9761);}return null;};}function saveUpdates(_0x1fc6de){return function(_0x3112d0){if(_0x3112d0){return _0x3112d0[_0x6c5d('0x12')](_0x1fc6de)[_0x6c5d('0x13')](function(_0xc29cca){return _0xc29cca;});}return null;};}function removeEntity(_0x2ce50d){return function(_0x3a1d49){if(_0x3a1d49){return _0x3a1d49[_0x6c5d('0x14')]()['then'](function(){_0x2ce50d[_0x6c5d('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d9c5){return function(_0x11018d){if(!_0x11018d){_0x11d9c5[_0x6c5d('0x9')](0x194);}return _0x11018d;};}function handleError(_0x26e02b,_0x29bde4){_0x29bde4=_0x29bde4||0x1f4;return function(_0x28ff55){logger[_0x6c5d('0x15')](_0x28ff55[_0x6c5d('0x16')]);if(_0x28ff55[_0x6c5d('0x17')]){delete _0x28ff55[_0x6c5d('0x17')];}_0x26e02b['status'](_0x29bde4)[_0x6c5d('0x18')](_0x28ff55);};}function maskClientSecret(_0xb71270){return _[_0x6c5d('0x19')](_0xb71270[_0x6c5d('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6c5d('0x1b')]=function(_0x1a4388,_0x5aa135){var _0x293637={},_0x326a56={},_0x51a646={'count':0x0,'rows':[]};var _0x5bb0a0=_[_0x6c5d('0x1c')](db[_0x6c5d('0x1d')]['rawAttributes'],function(_0x577374){return{'name':_0x577374[_0x6c5d('0x1e')],'type':_0x577374[_0x6c5d('0x1f')][_0x6c5d('0x20')]};});_0x326a56['model']=_[_0x6c5d('0x1c')](_0x5bb0a0,_0x6c5d('0x17'));_0x326a56[_0x6c5d('0x21')]=_['keys'](_0x1a4388[_0x6c5d('0x21')]);_0x326a56[_0x6c5d('0x22')]=_['intersection'](_0x326a56['model'],_0x326a56['query']);_0x293637[_0x6c5d('0x23')]=_['intersection'](_0x326a56[_0x6c5d('0x24')],qs['fields'](_0x1a4388[_0x6c5d('0x21')]['fields']));_0x293637[_0x6c5d('0x23')]=_0x293637['attributes'][_0x6c5d('0x25')]?_0x293637[_0x6c5d('0x23')]:_0x326a56[_0x6c5d('0x24')];if(!_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x26')]('nolimit')){_0x293637[_0x6c5d('0xc')]=qs[_0x6c5d('0xc')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0xc')]);_0x293637[_0x6c5d('0xe')]=qs[_0x6c5d('0xe')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0xe')]);}_0x293637[_0x6c5d('0x27')]=qs[_0x6c5d('0x28')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x28')]);_0x293637[_0x6c5d('0x29')]=qs[_0x6c5d('0x22')](_['pick'](_0x1a4388['query'],_0x326a56[_0x6c5d('0x22')]),_0x5bb0a0);if(_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x2a')]){_0x293637[_0x6c5d('0x29')]=_[_0x6c5d('0x2b')](_0x293637[_0x6c5d('0x29')],{'$or':_[_0x6c5d('0x1c')](_0x5bb0a0,function(_0x33ec4b){if(_0x33ec4b[_0x6c5d('0x1f')]!==_0x6c5d('0x2c')){var _0x527c3b={};_0x527c3b[_0x33ec4b['name']]={'$like':'%'+_0x1a4388['query']['filter']+'%'};return _0x527c3b;}})});}_0x293637=_[_0x6c5d('0x2b')]({},_0x293637,_0x1a4388[_0x6c5d('0x2d')]);var _0x18ab88={'where':_0x293637[_0x6c5d('0x29')]};return db[_0x6c5d('0x1d')]['count'](_0x18ab88)[_0x6c5d('0x13')](function(_0x5cdfcc){_0x51a646['count']=_0x5cdfcc;if(_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x2e')]){_0x293637[_0x6c5d('0x2f')]=[{'all':!![]}];}return db[_0x6c5d('0x1d')]['findAll'](_0x293637);})[_0x6c5d('0x13')](function(_0x17388b){_0x51a646[_0x6c5d('0x30')]=_[_0x6c5d('0x1c')](_0x17388b,function(_0x4345b9){if(_0x4345b9['service']===_0x6c5d('0x31')){var _0xc92c7=encryptor['decryptString'](_0x4345b9['data3']);_0x4345b9[_0x6c5d('0x32')]=maskClientSecret(_0xc92c7);}return _0x4345b9;});return _0x51a646;})[_0x6c5d('0x13')](respondWithFilteredResult(_0x5aa135,_0x293637))['catch'](handleError(_0x5aa135,null));};exports[_0x6c5d('0x33')]=function(_0x243eef,_0x2fb213){var _0x4973fb={'raw':!![],'where':{'id':_0x243eef[_0x6c5d('0x34')]['id']}},_0x53da50={};_0x53da50[_0x6c5d('0x24')]=_[_0x6c5d('0x35')](db[_0x6c5d('0x1d')]['rawAttributes']);_0x53da50[_0x6c5d('0x21')]=_[_0x6c5d('0x35')](_0x243eef['query']);_0x53da50['filters']=_[_0x6c5d('0x36')](_0x53da50['model'],_0x53da50[_0x6c5d('0x21')]);_0x4973fb[_0x6c5d('0x23')]=_[_0x6c5d('0x36')](_0x53da50['model'],qs['fields'](_0x243eef[_0x6c5d('0x21')][_0x6c5d('0x37')]));_0x4973fb[_0x6c5d('0x23')]=_0x4973fb[_0x6c5d('0x23')]['length']?_0x4973fb[_0x6c5d('0x23')]:_0x53da50[_0x6c5d('0x24')];if(_0x243eef['query']['includeAll']){_0x4973fb[_0x6c5d('0x2f')]=[{'all':!![]}];}_0x4973fb=_['merge']({},_0x4973fb,_0x243eef[_0x6c5d('0x2d')]);return db[_0x6c5d('0x1d')]['find'](_0x4973fb)[_0x6c5d('0x13')](handleEntityNotFound(_0x2fb213,null))[_0x6c5d('0x13')](function(_0x13d9e4){if(_0x13d9e4[_0x6c5d('0x38')]===_0x6c5d('0x31')){var _0x5df897=encryptor[_0x6c5d('0x39')](_0x13d9e4[_0x6c5d('0x32')]);_0x13d9e4[_0x6c5d('0x32')]=maskClientSecret(_0x5df897);}return _0x13d9e4;})[_0x6c5d('0x13')](respondWithResult(_0x2fb213,null))['catch'](handleError(_0x2fb213,null));};exports[_0x6c5d('0x3a')]=function(_0x26d09e,_0x48e74e){if(!_0x26d09e['body'][_0x6c5d('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x26d09e['body'][_0x6c5d('0x38')])throw new Error(_0x6c5d('0x3b'));var _0x5e23ed=db[_0x6c5d('0x1d')][_0x6c5d('0x3c')][_0x6c5d('0x38')][_0x6c5d('0x3d')];if(!_0x5e23ed[_0x6c5d('0x3e')](_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x38')]))throw new Error(_0x6c5d('0x40')+_0x5e23ed['join'](',\x20'));if(_0x26d09e['body'][_0x6c5d('0x38')]===_0x6c5d('0x31')&&_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x32')]){_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x32')]=encryptor[_0x6c5d('0x41')](_0x26d09e['body']['data3']);}return db[_0x6c5d('0x1d')][_0x6c5d('0x3a')](_0x26d09e['body'],{})[_0x6c5d('0x13')](respondWithResult(_0x48e74e,0xc9))[_0x6c5d('0x42')](handleError(_0x48e74e,null));};exports[_0x6c5d('0x12')]=function(_0x2f870b,_0x3e51b1){if(_0x2f870b['body']['id']){delete _0x2f870b[_0x6c5d('0x3f')]['id'];}return db[_0x6c5d('0x1d')][_0x6c5d('0x43')]({'where':{'id':_0x2f870b[_0x6c5d('0x34')]['id']}})['then'](handleEntityNotFound(_0x3e51b1,null))[_0x6c5d('0x13')](function(_0x206c87){if(_0x206c87[_0x6c5d('0x38')]===_0x6c5d('0x31')&&_0x2f870b[_0x6c5d('0x3f')][_0x6c5d('0x32')]){_0x2f870b[_0x6c5d('0x3f')][_0x6c5d('0x32')]=encryptor[_0x6c5d('0x41')](_0x2f870b[_0x6c5d('0x3f')]['data3']);}return _0x206c87;})[_0x6c5d('0x13')](saveUpdates(_0x2f870b[_0x6c5d('0x3f')],null))['then'](respondWithResult(_0x3e51b1,null))['catch'](handleError(_0x3e51b1,null));};exports[_0x6c5d('0x14')]=function(_0x36fc30,_0x28780e){return db[_0x6c5d('0x1d')]['find']({'where':{'id':_0x36fc30['params']['id']}})[_0x6c5d('0x13')](handleEntityNotFound(_0x28780e,null))['then'](removeEntity(_0x28780e,null))[_0x6c5d('0x42')](handleError(_0x28780e,null));};exports[_0x6c5d('0x44')]=function(_0x20219c,_0x4d510e){return db[_0x6c5d('0x1d')]['findOne']({'where':{'id':_0x20219c[_0x6c5d('0x34')]['id']},'raw':!![]})[_0x6c5d('0x13')](function(_0x2024df){if(!_0x2024df)return _0x4d510e[_0x6c5d('0x9')](0x194);return{'url':oauth[_0x6c5d('0x45')](_0x2024df,_0x20219c[_0x6c5d('0x46')]['id'])};})[_0x6c5d('0x13')](respondWithResult(_0x4d510e,null))['catch'](handleError(_0x4d510e,null));};exports['oauth2MicrosoftCallback']=function(_0x2a4e90,_0x3c778d){var _0x2f7cfe=_0x2a4e90[_0x6c5d('0x3f')];var _0x4415e4;var _0x35c6ab;if(_0x2f7cfe['error'])throw _0x2f7cfe;redis[_0x6c5d('0x47')](_0x2f7cfe[_0x6c5d('0x48')])[_0x6c5d('0x13')](function(_0x1111b0){if(!_0x1111b0)throw new Error(_0x6c5d('0x49'));_0x4415e4=JSON[_0x6c5d('0x4a')](_0x1111b0);var _0x10b2e2=Buffer[_0x6c5d('0x4b')](_0x2f7cfe[_0x6c5d('0x48')],_0x6c5d('0x4c'))['toString'](_0x6c5d('0x4d'));_0x35c6ab=JSON[_0x6c5d('0x4a')](_0x10b2e2);if(!oauth[_0x6c5d('0x4e')](_0x2f7cfe[_0x6c5d('0x4f')],_0x4415e4['oauth2Claims']))throw new Error(_0x6c5d('0x50'));redis[_0x6c5d('0x51')](_0x2f7cfe[_0x6c5d('0x48')]);return oauth[_0x6c5d('0x52')](_0x2f7cfe[_0x6c5d('0x53')],_0x4415e4);})[_0x6c5d('0x13')](function(_0x121d73){_0x4415e4[_0x6c5d('0x54')]=_0x121d73[_0x6c5d('0x55')];_0x4415e4[_0x6c5d('0x56')]=_0x121d73[_0x6c5d('0x57')];return db[_0x6c5d('0x1d')][_0x6c5d('0x12')]({'data5':_0x4415e4['data5'],'data6':_0x4415e4[_0x6c5d('0x56')]},{'where':{'id':_0x4415e4['id']}});})[_0x6c5d('0x13')](function(){oauth[_0x6c5d('0x58')](_0x4415e4);socket[_0x6c5d('0x59')](_0x6c5d('0x5a'),{'id':_0x35c6ab['id']});return;})[_0x6c5d('0x13')](respondWithStatusCode(_0x3c778d,null))[_0x6c5d('0x42')](function(_0x1c5c6a){if(_0x35c6ab){socket['emit'](_0x6c5d('0x5b'),{'id':_0x35c6ab['id']});}if(!_0x4415e4){logger['error'](_0x6c5d('0x5c'),_0x1c5c6a);return _0x3c778d[_0x6c5d('0xa')](0x1f4)[_0x6c5d('0x18')](_0x1c5c6a[_0x6c5d('0x5d')]);}logger[_0x6c5d('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4415e4['id'],JSON[_0x6c5d('0x5e')](_0x1c5c6a));});}; \ No newline at end of file +var _0x201b=['Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','params','encryptString','destroy','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','startRefreshInterval','emit','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','send','padEnd','slice','index','CloudProvider','type','key','map','name','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','findAll','service','MicrosoftAzure','data3','show','rawAttributes','intersection','include','merge','find','decryptString','catch','create','body','Service\x20parameter\x20not\x20specified','values','includes'];(function(_0x3b1a74,_0x431559){var _0x58b051=function(_0x2b62c4){while(--_0x2b62c4){_0x3b1a74['push'](_0x3b1a74['shift']());}};_0x58b051(++_0x431559);}(_0x201b,0x77));var _0xb201=function(_0x4ec784,_0x3995d7){_0x4ec784=_0x4ec784-0x0;var _0x4e3ec3=_0x201b[_0x4ec784];return _0x4e3ec3;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xb201('0x0'));var encryptor=require(_0xb201('0x1'));var config=require(_0xb201('0x2'));var logger=require(_0xb201('0x3'))(_0xb201('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xb201('0x5'));config[_0xb201('0x6')]=_[_0xb201('0x7')](config['redis'],{'host':_0xb201('0x8'),'port':0x18eb});var socket=require(_0xb201('0x9'))(new Redis(config[_0xb201('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x29ee00,_0x9ead73){_0x9ead73=_0x9ead73||0xcc;return function(_0x4d0f07){if(_0x4d0f07){return _0x29ee00[_0xb201('0xa')](_0x9ead73);}return _0x29ee00[_0xb201('0xb')](_0x9ead73)[_0xb201('0xc')]();};}function respondWithResult(_0xeab41d,_0x20bce8){_0x20bce8=_0x20bce8||0xc8;return function(_0xd03a90){if(_0xd03a90){return _0xeab41d[_0xb201('0xb')](_0x20bce8)[_0xb201('0xd')](_0xd03a90);}};}function respondWithFilteredResult(_0x40be56,_0x528c5b){return function(_0x4ac92f){if(_0x4ac92f){var _0x33ad7b=typeof _0x528c5b[_0xb201('0xe')]===_0xb201('0xf')&&typeof _0x528c5b[_0xb201('0x10')]==='undefined';var _0x3c8c4a=_0x4ac92f[_0xb201('0x11')];var _0x5607fe=_0x33ad7b?0x0:_0x528c5b[_0xb201('0xe')];var _0x40ad8f=_0x33ad7b?_0x4ac92f[_0xb201('0x11')]:_0x528c5b[_0xb201('0xe')]+_0x528c5b['limit'];var _0x3d26b7;if(_0x40ad8f>=_0x3c8c4a){_0x40ad8f=_0x3c8c4a;_0x3d26b7=0xc8;}else{_0x3d26b7=0xce;}_0x40be56[_0xb201('0xb')](_0x3d26b7);return _0x40be56[_0xb201('0x12')]('Content-Range',_0x5607fe+'-'+_0x40ad8f+'/'+_0x3c8c4a)[_0xb201('0xd')](_0x4ac92f);}return null;};}function saveUpdates(_0x5ef6ba){return function(_0x2de787){if(_0x2de787){return _0x2de787[_0xb201('0x13')](_0x5ef6ba)[_0xb201('0x14')](function(_0x2cdd49){return _0x2cdd49;});}return null;};}function removeEntity(_0x32da75){return function(_0xc8cf49){if(_0xc8cf49){return _0xc8cf49['destroy']()['then'](function(){_0x32da75[_0xb201('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af8a9){return function(_0x3ef4e4){if(!_0x3ef4e4){_0x3af8a9[_0xb201('0xa')](0x194);}return _0x3ef4e4;};}function handleError(_0xe3fcf1,_0x5234a8){_0x5234a8=_0x5234a8||0x1f4;return function(_0x2bb4af){logger[_0xb201('0x15')](_0x2bb4af[_0xb201('0x16')]);if(_0x2bb4af['name']){delete _0x2bb4af['name'];}_0xe3fcf1[_0xb201('0xb')](_0x5234a8)[_0xb201('0x17')](_0x2bb4af);};}function maskClientSecret(_0x1ab884){return _[_0xb201('0x18')](_0x1ab884[_0xb201('0x19')](0x0,0x3),0x14,'*');}exports[_0xb201('0x1a')]=function(_0x52c34c,_0x8acd21){var _0x3384ab={},_0x441a1d={},_0x40be3d={'count':0x0,'rows':[]};var _0x408420=_['map'](db[_0xb201('0x1b')]['rawAttributes'],function(_0x2ae695){return{'name':_0x2ae695['fieldName'],'type':_0x2ae695[_0xb201('0x1c')][_0xb201('0x1d')]};});_0x441a1d['model']=_[_0xb201('0x1e')](_0x408420,_0xb201('0x1f'));_0x441a1d[_0xb201('0x20')]=_[_0xb201('0x21')](_0x52c34c[_0xb201('0x20')]);_0x441a1d['filters']=_['intersection'](_0x441a1d[_0xb201('0x22')],_0x441a1d['query']);_0x3384ab['attributes']=_['intersection'](_0x441a1d['model'],qs[_0xb201('0x23')](_0x52c34c['query']['fields']));_0x3384ab[_0xb201('0x24')]=_0x3384ab[_0xb201('0x24')][_0xb201('0x25')]?_0x3384ab[_0xb201('0x24')]:_0x441a1d[_0xb201('0x22')];if(!_0x52c34c[_0xb201('0x20')][_0xb201('0x26')](_0xb201('0x27'))){_0x3384ab[_0xb201('0x10')]=qs['limit'](_0x52c34c[_0xb201('0x20')][_0xb201('0x10')]);_0x3384ab[_0xb201('0xe')]=qs[_0xb201('0xe')](_0x52c34c[_0xb201('0x20')][_0xb201('0xe')]);}_0x3384ab[_0xb201('0x28')]=qs[_0xb201('0x29')](_0x52c34c[_0xb201('0x20')]['sort']);_0x3384ab[_0xb201('0x2a')]=qs['filters'](_[_0xb201('0x2b')](_0x52c34c[_0xb201('0x20')],_0x441a1d[_0xb201('0x2c')]),_0x408420);if(_0x52c34c['query'][_0xb201('0x2d')]){_0x3384ab[_0xb201('0x2a')]=_['merge'](_0x3384ab[_0xb201('0x2a')],{'$or':_['map'](_0x408420,function(_0x18b526){if(_0x18b526[_0xb201('0x1c')]!=='VIRTUAL'){var _0x452290={};_0x452290[_0x18b526['name']]={'$like':'%'+_0x52c34c[_0xb201('0x20')][_0xb201('0x2d')]+'%'};return _0x452290;}})});}_0x3384ab=_['merge']({},_0x3384ab,_0x52c34c[_0xb201('0x2e')]);var _0x3494ba={'where':_0x3384ab['where']};return db[_0xb201('0x1b')][_0xb201('0x11')](_0x3494ba)[_0xb201('0x14')](function(_0x63d806){_0x40be3d[_0xb201('0x11')]=_0x63d806;if(_0x52c34c[_0xb201('0x20')][_0xb201('0x2f')]){_0x3384ab['include']=[{'all':!![]}];}return db[_0xb201('0x1b')][_0xb201('0x30')](_0x3384ab);})[_0xb201('0x14')](function(_0x3d8507){_0x40be3d['rows']=_['map'](_0x3d8507,function(_0x513d26){if(_0x513d26[_0xb201('0x31')]===_0xb201('0x32')){var _0x22c6ce=encryptor['decryptString'](_0x513d26[_0xb201('0x33')]);_0x513d26[_0xb201('0x33')]=maskClientSecret(_0x22c6ce);}return _0x513d26;});return _0x40be3d;})[_0xb201('0x14')](respondWithFilteredResult(_0x8acd21,_0x3384ab))['catch'](handleError(_0x8acd21,null));};exports[_0xb201('0x34')]=function(_0x4f619c,_0x5cf413){var _0x286a11={'raw':!![],'where':{'id':_0x4f619c['params']['id']}},_0x248b31={};_0x248b31[_0xb201('0x22')]=_[_0xb201('0x21')](db[_0xb201('0x1b')][_0xb201('0x35')]);_0x248b31[_0xb201('0x20')]=_[_0xb201('0x21')](_0x4f619c['query']);_0x248b31[_0xb201('0x2c')]=_[_0xb201('0x36')](_0x248b31[_0xb201('0x22')],_0x248b31[_0xb201('0x20')]);_0x286a11[_0xb201('0x24')]=_[_0xb201('0x36')](_0x248b31[_0xb201('0x22')],qs[_0xb201('0x23')](_0x4f619c[_0xb201('0x20')]['fields']));_0x286a11[_0xb201('0x24')]=_0x286a11[_0xb201('0x24')][_0xb201('0x25')]?_0x286a11['attributes']:_0x248b31[_0xb201('0x22')];if(_0x4f619c[_0xb201('0x20')][_0xb201('0x2f')]){_0x286a11[_0xb201('0x37')]=[{'all':!![]}];}_0x286a11=_[_0xb201('0x38')]({},_0x286a11,_0x4f619c['options']);return db[_0xb201('0x1b')][_0xb201('0x39')](_0x286a11)[_0xb201('0x14')](handleEntityNotFound(_0x5cf413,null))[_0xb201('0x14')](function(_0x4669f5){if(_0x4669f5[_0xb201('0x31')]==='MicrosoftAzure'){var _0x19e62d=encryptor[_0xb201('0x3a')](_0x4669f5[_0xb201('0x33')]);_0x4669f5[_0xb201('0x33')]=maskClientSecret(_0x19e62d);}return _0x4669f5;})['then'](respondWithResult(_0x5cf413,null))[_0xb201('0x3b')](handleError(_0x5cf413,null));};exports[_0xb201('0x3c')]=function(_0x215a02,_0x4c7aef){if(!_0x215a02[_0xb201('0x3d')][_0xb201('0x1f')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x215a02[_0xb201('0x3d')][_0xb201('0x31')])throw new Error(_0xb201('0x3e'));var _0x4cdcf3=db[_0xb201('0x1b')][_0xb201('0x35')][_0xb201('0x31')][_0xb201('0x3f')];if(!_0x4cdcf3[_0xb201('0x40')](_0x215a02[_0xb201('0x3d')][_0xb201('0x31')]))throw new Error(_0xb201('0x41')+_0x4cdcf3[_0xb201('0x42')](',\x20'));if(_0x215a02['body']['service']===_0xb201('0x32')&&_0x215a02[_0xb201('0x3d')][_0xb201('0x33')]){_0x215a02[_0xb201('0x3d')]['data3']=encryptor['encryptString'](_0x215a02['body']['data3']);}return db['CloudProvider'][_0xb201('0x3c')](_0x215a02[_0xb201('0x3d')],{})[_0xb201('0x14')](respondWithResult(_0x4c7aef,0xc9))[_0xb201('0x3b')](handleError(_0x4c7aef,null));};exports['update']=function(_0x2e1f42,_0x2644d6){if(_0x2e1f42[_0xb201('0x3d')]['id']){delete _0x2e1f42[_0xb201('0x3d')]['id'];}return db['CloudProvider'][_0xb201('0x39')]({'where':{'id':_0x2e1f42[_0xb201('0x43')]['id']}})[_0xb201('0x14')](handleEntityNotFound(_0x2644d6,null))[_0xb201('0x14')](function(_0x2a9dc2){if(_0x2a9dc2[_0xb201('0x31')]===_0xb201('0x32')&&_0x2e1f42['body'][_0xb201('0x33')]){_0x2e1f42[_0xb201('0x3d')]['data3']=encryptor[_0xb201('0x44')](_0x2e1f42[_0xb201('0x3d')][_0xb201('0x33')]);}return _0x2a9dc2;})[_0xb201('0x14')](saveUpdates(_0x2e1f42[_0xb201('0x3d')],null))[_0xb201('0x14')](respondWithResult(_0x2644d6,null))[_0xb201('0x3b')](handleError(_0x2644d6,null));};exports[_0xb201('0x45')]=function(_0x280fa4,_0x1c8eff){return db[_0xb201('0x1b')][_0xb201('0x39')]({'where':{'id':_0x280fa4['params']['id']}})[_0xb201('0x14')](handleEntityNotFound(_0x1c8eff,null))[_0xb201('0x14')](removeEntity(_0x1c8eff,null))[_0xb201('0x3b')](handleError(_0x1c8eff,null));};exports[_0xb201('0x46')]=function(_0x4bd5a0,_0x7684c5){return db[_0xb201('0x1b')]['findOne']({'where':{'id':_0x4bd5a0[_0xb201('0x43')]['id']},'raw':!![]})[_0xb201('0x14')](function(_0x594061){if(!_0x594061)return _0x7684c5[_0xb201('0xa')](0x194);return{'url':oauth[_0xb201('0x47')](_0x594061,_0x4bd5a0[_0xb201('0x48')]['id'])};})[_0xb201('0x14')](respondWithResult(_0x7684c5,null))[_0xb201('0x3b')](handleError(_0x7684c5,null));};exports[_0xb201('0x49')]=function(_0x38a099,_0x502265){var _0x472811=_0x38a099[_0xb201('0x3d')];var _0x27ab79;var _0x3d5829;if(_0x472811['error'])throw _0x472811;redis[_0xb201('0x4a')](_0x472811[_0xb201('0x4b')])[_0xb201('0x14')](function(_0x2db7e0){if(!_0x2db7e0)throw new Error(_0xb201('0x4c'));_0x27ab79=JSON[_0xb201('0x4d')](_0x2db7e0);var _0x3ddb28=Buffer[_0xb201('0x4e')](_0x472811[_0xb201('0x4b')],'base64')[_0xb201('0x4f')](_0xb201('0x50'));_0x3d5829=JSON[_0xb201('0x4d')](_0x3ddb28);if(!oauth['isValidIdToken'](_0x472811[_0xb201('0x51')],_0x27ab79[_0xb201('0x52')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xb201('0x53')](_0x472811[_0xb201('0x4b')]);return oauth[_0xb201('0x54')](_0x472811[_0xb201('0x55')],_0x27ab79);})[_0xb201('0x14')](function(_0x88ddb7){_0x27ab79[_0xb201('0x56')]=_0x88ddb7['access_token'];_0x27ab79['data6']=_0x88ddb7[_0xb201('0x57')];return db[_0xb201('0x1b')]['update']({'data5':_0x27ab79[_0xb201('0x56')],'data6':_0x27ab79['data6']},{'where':{'id':_0x27ab79['id']}});})[_0xb201('0x14')](function(){oauth[_0xb201('0x58')](_0x27ab79);socket['emit']('microsoftAuthorization:success',{'id':_0x3d5829['id']});return;})[_0xb201('0x14')](respondWithStatusCode(_0x502265,null))[_0xb201('0x3b')](function(_0x10f25d){if(_0x3d5829){socket[_0xb201('0x59')]('microsoftAuthorization:error',{'id':_0x3d5829['id']});}if(!_0x27ab79){logger[_0xb201('0x15')](_0xb201('0x5a'),_0x10f25d);return _0x502265['status'](0x1f4)[_0xb201('0x17')](_0x10f25d['message']);}logger[_0xb201('0x15')](_0xb201('0x5b'),_0x27ab79['id'],JSON['stringify'](_0x10f25d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index fa67cc0..9d5d0ff 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 _0x3499=['CloudProvider','util','../../config/logger','api','moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x1dd18b,_0x5bdd0d){var _0x46926c=function(_0x3f40db){while(--_0x3f40db){_0x1dd18b['push'](_0x1dd18b['shift']());}};_0x46926c(++_0x5bdd0d);}(_0x3499,0xf3));var _0x9349=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0x3499[_0x718f1f];return _0x48b289;};'use strict';var _=require('lodash');var util=require(_0x9349('0x0'));var logger=require(_0x9349('0x1'))(_0x9349('0x2'));var moment=require(_0x9349('0x3'));var BPromise=require(_0x9349('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9349('0x5'));var rimraf=require(_0x9349('0x6'));var config=require('../../config/environment');var attributes=require(_0x9349('0x7'));module[_0x9349('0x8')]=function(_0x35e2b4,_0x533460){return _0x35e2b4[_0x9349('0x9')](_0x9349('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bef=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x1186cb,_0x488e8b){var _0x4500b6=function(_0x2629ae){while(--_0x2629ae){_0x1186cb['push'](_0x1186cb['shift']());}};_0x4500b6(++_0x488e8b);}(_0x6bef,0x158));var _0xf6be=function(_0x272307,_0x34935f){_0x272307=_0x272307-0x0;var _0x279aa2=_0x6bef[_0x272307];return _0x279aa2;};'use strict';var _=require(_0xf6be('0x0'));var util=require(_0xf6be('0x1'));var logger=require(_0xf6be('0x2'))(_0xf6be('0x3'));var moment=require(_0xf6be('0x4'));var BPromise=require(_0xf6be('0x5'));var rp=require(_0xf6be('0x6'));var fs=require('fs');var path=require(_0xf6be('0x7'));var rimraf=require(_0xf6be('0x8'));var config=require(_0xf6be('0x9'));var attributes=require(_0xf6be('0xa'));module[_0xf6be('0xb')]=function(_0x10a7a3,_0x3b5540){return _0x10a7a3[_0xf6be('0xc')](_0xf6be('0xd'),attributes,{'tableName':_0xf6be('0xe'),'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 ced4d28..4193f4c 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 _0xe3c1=['ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','update','authorization_code','intervals','bind','findAll','all','catch','error','crypto','jsonwebtoken','moment'];(function(_0x4f3c10,_0x4cb1b1){var _0x1802cb=function(_0x4d4a74){while(--_0x4d4a74){_0x4f3c10['push'](_0x4f3c10['shift']());}};_0x1802cb(++_0x4cb1b1);}(_0xe3c1,0x197));var _0x1e3c=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xe3c1[_0x1f7413];return _0x2d2775;};'use strict';var _=require('lodash');var crypto=require(_0x1e3c('0x0'));var jwt=require(_0x1e3c('0x1'));var moment=require(_0x1e3c('0x2'));var Redis=require(_0x1e3c('0x3'));var rp=require(_0x1e3c('0x4'));var util=require(_0x1e3c('0x5'));var encryptor=require(_0x1e3c('0x6'));var config=require(_0x1e3c('0x7'));var logger=require(_0x1e3c('0x8'))(_0x1e3c('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x1e3c('0xa'))['db'];config['redis']=_[_0x1e3c('0xb')](config[_0x1e3c('0xc')],{'host':_0x1e3c('0xd'),'port':0x18eb});var redis=new Redis(config[_0x1e3c('0xc')]);var MICROSOFT_AUTH_URL=_0x1e3c('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1e3c('0xf'),_0x1e3c('0x10'),_0x1e3c('0x11'),_0x1e3c('0x12'),_0x1e3c('0x13'),_0x1e3c('0x14'),_0x1e3c('0x15')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x1e3c('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0x1e3c('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x67ca21){var _0x37f729=_['map'](AZURE_AUTH_SCOPES[_0x67ca21[_0x1e3c('0x18')]]);if(_0x67ca21['type']===_0x1e3c('0x19'))_0x37f729[_0x1e3c('0x1a')](_0x67ca21[_0x1e3c('0x1b')]+_0x1e3c('0x1c'));return _0x37f729[_0x1e3c('0x1d')]('\x20');}function getAccessTokenScope(_0x5d45d){if(_0x5d45d[_0x1e3c('0x18')]===_0x1e3c('0x1e'))return _0x1e3c('0x13');if(_0x5d45d['type']===_0x1e3c('0x19'))return _0x5d45d[_0x1e3c('0x1b')]+_0x1e3c('0x1c');}function generateMicrosoftAuthorizationUrl(_0x2a58f0,_0x4fc0bc){var _0x42d810=MICROSOFT_AUTH_URL[_0x1e3c('0x1f')](_0x1e3c('0x20'),_0x2a58f0[_0x1e3c('0x21')]);var _0x401782=[_0x1e3c('0x22'),'id_token'];var _0x450610=Buffer[_0x1e3c('0x23')](JSON[_0x1e3c('0x24')]({'id':_0x4fc0bc}))['toString'](_0x1e3c('0x25'));var _0x187a57=crypto[_0x1e3c('0x26')](0x10)[_0x1e3c('0x27')](_0x1e3c('0x28'));var _0x12df62=getAuthorizationScopes(_0x2a58f0);var _0x24d2f6=[{'key':_0x1e3c('0x29'),'value':_0x2a58f0[_0x1e3c('0x2a')]},{'key':_0x1e3c('0x2b'),'value':encodeURIComponent(_0x401782[_0x1e3c('0x1d')]('\x20'))},{'key':_0x1e3c('0x2c'),'value':_0x2a58f0[_0x1e3c('0x2d')]},{'key':_0x1e3c('0x2e'),'value':_0x1e3c('0x2f')},{'key':_0x1e3c('0x30'),'value':encodeURIComponent(_0x12df62)},{'key':_0x1e3c('0x31'),'value':_0x450610},{'key':_0x1e3c('0x32'),'value':_0x187a57},{'key':_0x1e3c('0x33'),'value':_0x1e3c('0x34')}];var _0x3b29c8=_0x42d810+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1e3c('0x35')](_0x24d2f6,function(_0x55baa2){return _0x55baa2['key']+'='+_0x55baa2[_0x1e3c('0x36')];})[_0x1e3c('0x1d')]('&');_0x2a58f0[_0x1e3c('0x37')]={'issuer':_0x42d810['replace'](_0x1e3c('0x38'),''),'audience':_0x2a58f0[_0x1e3c('0x2a')],'state':_0x450610,'nonce':_0x187a57};redis[_0x1e3c('0x39')](_0x450610,JSON[_0x1e3c('0x24')](_0x2a58f0));return _0x3b29c8;}function isValidIdToken(_0x561cd3,_0x253a02){try{var _0x3fb046=jwt[_0x1e3c('0x3a')](_0x561cd3,{'complete':!![]});var _0x14b90e=_0x3fb046[_0x1e3c('0x3b')];if(_0x14b90e[_0x1e3c('0x3c')]!==_0x253a02[_0x1e3c('0x3d')])return![];if(_0x14b90e['aud']!==_0x253a02[_0x1e3c('0x3e')])return![];if(_0x14b90e['nonce']!==_0x253a02['nonce'])return![];if(moment()[_0x1e3c('0x3f')](moment[_0x1e3c('0x40')](_0x14b90e['exp'])))return![];return!![];}catch(_0x5289ad){throw _0x5289ad;}}function refreshOauth2MicrosoftAccessToken(_0x1c9ce7){return Promise['resolve']()[_0x1e3c('0x41')](function(){if(_0x1c9ce7[_0x1e3c('0x42')])return _0x1c9ce7;return db[_0x1e3c('0x43')][_0x1e3c('0x44')]({'where':{'id':_0x1c9ce7['id']},'raw':!![]});})[_0x1e3c('0x41')](function(_0x5a2a72){var _0x56d123={'grant_type':_0x1e3c('0x45'),'refresh_token':_0x5a2a72[_0x1e3c('0x46')],'scope':getAccessTokenScope(_0x5a2a72),'redirect_uri':_0x5a2a72['data4'],'client_id':_0x5a2a72[_0x1e3c('0x2a')],'client_secret':encryptor[_0x1e3c('0x47')](_0x5a2a72['data3'])};var _0x5476ce={'method':_0x1e3c('0x48'),'uri':MICROSOFT_AUTH_URL['replace'](_0x1e3c('0x20'),_0x5a2a72['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56d123,'json':!![]};return rp(_0x5476ce);})[_0x1e3c('0x41')](function(_0x259eec){_0x1c9ce7[_0x1e3c('0x49')]=_0x259eec['access_token'];_0x1c9ce7[_0x1e3c('0x46')]=_0x259eec[_0x1e3c('0x45')];return db[_0x1e3c('0x43')][_0x1e3c('0x4a')]({'data5':_0x1c9ce7[_0x1e3c('0x49')],'data6':_0x1c9ce7[_0x1e3c('0x46')]},{'where':{'id':_0x1c9ce7['id']}});})[_0x1e3c('0x41')](function(){return _0x1c9ce7;})['catch'](function(_0x32d1ea){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x1c9ce7['id'],_0x32d1ea);});}function getOauth2MicrosoftAccessToken(_0x3b0c20,_0x2cb53c){var _0x1ada52={'grant_type':_0x1e3c('0x4b'),'code':_0x3b0c20,'scope':getAccessTokenScope(_0x2cb53c),'redirect_uri':_0x2cb53c[_0x1e3c('0x2d')],'client_id':_0x2cb53c['data1'],'client_secret':encryptor['decryptString'](_0x2cb53c[_0x1e3c('0x42')])};var _0x7e7bb={'method':_0x1e3c('0x48'),'uri':MICROSOFT_AUTH_URL['replace'](_0x1e3c('0x20'),_0x2cb53c[_0x1e3c('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1ada52,'json':!![]};return rp(_0x7e7bb);}function startRefreshInterval(_0x515286){var _0x4dc746=schedule[_0x1e3c('0x4c')];if(_0x4dc746[_0x515286['id']])clearInterval(_0x4dc746[_0x515286['id']]);_0x4dc746[_0x515286['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1e3c('0x4d')](this,{'id':_0x515286['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1e3c('0x4c')]=_0x4dc746;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x1e3c('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1e3c('0x41')](function(_0x1648cf){var _0x200708=_0x1648cf['map'](function(_0x1b2d93){return refreshOauth2MicrosoftAccessToken(_0x1b2d93)['then'](function(_0x208abc){startRefreshInterval(_0x208abc);});});return Promise[_0x1e3c('0x4f')](_0x200708);})[_0x1e3c('0x50')](function(_0x15b73d){var _0x40ed25=_0x15b73d?util['inspect'](_0x15b73d,{'showHidden':![],'depth':null}):'';logger[_0x1e3c('0x51')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x40ed25);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe4ea=['openid','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','code','base64','randomBytes','toString','client_id','data1','data4','response_mode','scope','nonce','key','value','oauth2/','set','stringify','decode','issuer','aud','audience','isAfter','unix','exp','then','CloudProvider','data6','decryptString','data2','access_token','refresh_token','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office.com/POP.AccessAsUser.All'];(function(_0x584b1a,_0x5b4d87){var _0x1a72aa=function(_0x20d216){while(--_0x20d216){_0x584b1a['push'](_0x584b1a['shift']());}};_0x1a72aa(++_0x5b4d87);}(_0xe4ea,0x14e));var _0xae4e=function(_0x21c43f,_0x188b41){_0x21c43f=_0x21c43f-0x0;var _0x3d146a=_0xe4ea[_0x21c43f];return _0x3d146a;};'use strict';var _=require(_0xae4e('0x0'));var crypto=require('crypto');var jwt=require(_0xae4e('0x1'));var moment=require(_0xae4e('0x2'));var Redis=require(_0xae4e('0x3'));var rp=require('request-promise');var util=require(_0xae4e('0x4'));var encryptor=require(_0xae4e('0x5'));var config=require(_0xae4e('0x6'));var logger=require(_0xae4e('0x7'))(_0xae4e('0x8'));var schedule=require(_0xae4e('0x9'));var db=require('../../mysqldb')['db'];config[_0xae4e('0xa')]=_[_0xae4e('0xb')](config[_0xae4e('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xae4e('0xa')]);var MICROSOFT_AUTH_URL=_0xae4e('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xae4e('0xd'),_0xae4e('0xe'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0xae4e('0xf'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xae4e('0x10'),_0xae4e('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xae4e('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xae4e('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4198d4){var _0x1ba975=_[_0xae4e('0x14')](AZURE_AUTH_SCOPES[_0x4198d4[_0xae4e('0x15')]]);if(_0x4198d4[_0xae4e('0x15')]===_0xae4e('0x16'))_0x1ba975[_0xae4e('0x17')](_0x4198d4[_0xae4e('0x18')]+_0xae4e('0x19'));return _0x1ba975[_0xae4e('0x1a')]('\x20');}function getAccessTokenScope(_0x5620c0){if(_0x5620c0['type']==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x5620c0['type']===_0xae4e('0x16'))return _0x5620c0[_0xae4e('0x18')]+_0xae4e('0x19');}function generateMicrosoftAuthorizationUrl(_0x1220a4,_0x4b977f){var _0x21264c=MICROSOFT_AUTH_URL[_0xae4e('0x1b')](_0xae4e('0x1c'),_0x1220a4['data2']);var _0x271138=[_0xae4e('0x1d'),'id_token'];var _0x17cea8=Buffer['from'](JSON['stringify']({'id':_0x4b977f}))['toString'](_0xae4e('0x1e'));var _0x3aaaa7=crypto[_0xae4e('0x1f')](0x10)[_0xae4e('0x20')]('hex');var _0x4ac3c7=getAuthorizationScopes(_0x1220a4);var _0x5b90c1=[{'key':_0xae4e('0x21'),'value':_0x1220a4[_0xae4e('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x271138['join']('\x20'))},{'key':'redirect_uri','value':_0x1220a4[_0xae4e('0x23')]},{'key':_0xae4e('0x24'),'value':'form_post'},{'key':_0xae4e('0x25'),'value':encodeURIComponent(_0x4ac3c7)},{'key':'state','value':_0x17cea8},{'key':_0xae4e('0x26'),'value':_0x3aaaa7},{'key':'prompt','value':'login'}];var _0x5bcfe6=_0x21264c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xae4e('0x14')](_0x5b90c1,function(_0x3a6ee3){return _0x3a6ee3[_0xae4e('0x27')]+'='+_0x3a6ee3[_0xae4e('0x28')];})[_0xae4e('0x1a')]('&');_0x1220a4['oauth2Claims']={'issuer':_0x21264c[_0xae4e('0x1b')](_0xae4e('0x29'),''),'audience':_0x1220a4[_0xae4e('0x22')],'state':_0x17cea8,'nonce':_0x3aaaa7};redis[_0xae4e('0x2a')](_0x17cea8,JSON[_0xae4e('0x2b')](_0x1220a4));return _0x5bcfe6;}function isValidIdToken(_0x2a1357,_0x309821){try{var _0x1483c2=jwt[_0xae4e('0x2c')](_0x2a1357,{'complete':!![]});var _0x5b0504=_0x1483c2['payload'];if(_0x5b0504['iss']!==_0x309821[_0xae4e('0x2d')])return![];if(_0x5b0504[_0xae4e('0x2e')]!==_0x309821[_0xae4e('0x2f')])return![];if(_0x5b0504[_0xae4e('0x26')]!==_0x309821[_0xae4e('0x26')])return![];if(moment()[_0xae4e('0x30')](moment[_0xae4e('0x31')](_0x5b0504[_0xae4e('0x32')])))return![];return!![];}catch(_0xa67abb){throw _0xa67abb;}}function refreshOauth2MicrosoftAccessToken(_0x4d1f45){return Promise['resolve']()[_0xae4e('0x33')](function(){if(_0x4d1f45['data3'])return _0x4d1f45;return db[_0xae4e('0x34')]['findOne']({'where':{'id':_0x4d1f45['id']},'raw':!![]});})['then'](function(_0x56f646){var _0x32b83b={'grant_type':'refresh_token','refresh_token':_0x56f646[_0xae4e('0x35')],'scope':getAccessTokenScope(_0x56f646),'redirect_uri':_0x56f646[_0xae4e('0x23')],'client_id':_0x56f646[_0xae4e('0x22')],'client_secret':encryptor[_0xae4e('0x36')](_0x56f646['data3'])};var _0x3e721d={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xae4e('0x1b')](_0xae4e('0x1c'),_0x56f646[_0xae4e('0x37')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x32b83b,'json':!![]};return rp(_0x3e721d);})[_0xae4e('0x33')](function(_0x1c1287){_0x4d1f45['data5']=_0x1c1287[_0xae4e('0x38')];_0x4d1f45[_0xae4e('0x35')]=_0x1c1287[_0xae4e('0x39')];return db[_0xae4e('0x34')]['update']({'data5':_0x4d1f45[_0xae4e('0x3a')],'data6':_0x4d1f45['data6']},{'where':{'id':_0x4d1f45['id']}});})[_0xae4e('0x33')](function(){return _0x4d1f45;})[_0xae4e('0x3b')](function(_0x585099){logger[_0xae4e('0x3c')](_0xae4e('0x3d'),_0x4d1f45['id'],_0x585099);});}function getOauth2MicrosoftAccessToken(_0x289181,_0x2dc51f){var _0x4f9588={'grant_type':_0xae4e('0x3e'),'code':_0x289181,'scope':getAccessTokenScope(_0x2dc51f),'redirect_uri':_0x2dc51f[_0xae4e('0x23')],'client_id':_0x2dc51f[_0xae4e('0x22')],'client_secret':encryptor[_0xae4e('0x36')](_0x2dc51f[_0xae4e('0x3f')])};var _0x3e873f={'method':_0xae4e('0x40'),'uri':MICROSOFT_AUTH_URL[_0xae4e('0x1b')](_0xae4e('0x1c'),_0x2dc51f[_0xae4e('0x37')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f9588,'json':!![]};return rp(_0x3e873f);}function startRefreshInterval(_0x5a8ff0){var _0x3d77a8=schedule[_0xae4e('0x41')];if(_0x3d77a8[_0x5a8ff0['id']])clearInterval(_0x3d77a8[_0x5a8ff0['id']]);_0x3d77a8[_0x5a8ff0['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5a8ff0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xae4e('0x41')]=_0x3d77a8;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xae4e('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xae4e('0x33')](function(_0x4d27e4){var _0x4e3a24=_0x4d27e4['map'](function(_0x316afa){return refreshOauth2MicrosoftAccessToken(_0x316afa)['then'](function(_0x18ee79){startRefreshInterval(_0x18ee79);});});return Promise[_0xae4e('0x43')](_0x4e3a24);})[_0xae4e('0x3b')](function(_0x3ea1ab){var _0x5a3bed=_0x3ea1ab?util['inspect'](_0x3ea1ab,{'showHidden':![],'depth':null}):'';logger[_0xae4e('0x3c')](_0xae4e('0x44'),_0x5a3bed);});}module[_0xae4e('0x45')]={'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 a46546d..2748c45 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 _0x2581=['request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','CloudProvider,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16fb2b,_0xc16fac){var _0x26b2b8=function(_0x30d7fa){while(--_0x30d7fa){_0x16fb2b['push'](_0x16fb2b['shift']());}};_0x26b2b8(++_0xc16fac);}(_0x2581,0xcb));var _0x1258=function(_0x41cf27,_0x41b729){_0x41cf27=_0x41cf27-0x0;var _0x530b52=_0x2581[_0x41cf27];return _0x530b52;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('CloudProvider,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file +var _0x2015=['client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5c8fc7,_0x571e82){var _0x389dfc=function(_0x830e4b){while(--_0x830e4b){_0x5c8fc7['push'](_0x5c8fc7['shift']());}};_0x389dfc(++_0x571e82);}(_0x2015,0x193));var _0x5201=function(_0x358a1c,_0x2434d4){_0x358a1c=_0x358a1c-0x0;var _0x12e845=_0x2015[_0x358a1c];return _0x12e845;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var moment=require(_0x5201('0x2'));var BPromise=require(_0x5201('0x3'));var rs=require(_0x5201('0x4'));var fs=require('fs');var Redis=require(_0x5201('0x5'));var db=require(_0x5201('0x6'))['db'];var utils=require(_0x5201('0x7'));var logger=require('../../config/logger')(_0x5201('0x8'));var config=require(_0x5201('0x9'));var jayson=require(_0x5201('0xa'));var client=jayson[_0x5201('0xb')][_0x5201('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11ce7b,_0x334b42,_0x374d23){return new BPromise(function(_0x15367c,_0x6fc2c3){return client['request'](_0x11ce7b,_0x374d23)[_0x5201('0xd')](function(_0x17d8f3){logger['info'](_0x5201('0xe'),_0x334b42,_0x5201('0xf'));logger[_0x5201('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x334b42,_0x5201('0xf'),JSON[_0x5201('0x11')](_0x17d8f3));if(_0x17d8f3[_0x5201('0x12')]){if(_0x17d8f3[_0x5201('0x12')][_0x5201('0x13')]===0x1f4){logger[_0x5201('0x12')](_0x5201('0xe'),_0x334b42,_0x17d8f3[_0x5201('0x12')][_0x5201('0x14')]);return _0x6fc2c3(_0x17d8f3[_0x5201('0x12')][_0x5201('0x14')]);}logger[_0x5201('0x12')]('CloudProvider,\x20%s,\x20%s',_0x334b42,_0x17d8f3[_0x5201('0x12')][_0x5201('0x14')]);return _0x15367c(_0x17d8f3['error']['message']);}else{logger[_0x5201('0x15')](_0x5201('0xe'),_0x334b42,_0x5201('0xf'));_0x15367c(_0x17d8f3['result']['message']);}})[_0x5201('0x16')](function(_0x582210){logger[_0x5201('0x12')]('CloudProvider,\x20%s,\x20%s',_0x334b42,_0x582210);_0x6fc2c3(_0x582210);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d5c00a7..2ec8df6 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(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x5f2f,0x73));var _0xf5f2=function(_0x392713,_0x49cee8){_0x392713=_0x392713-0x0;var _0x28c927=_0x5f2f[_0x392713];return _0x28c927;};'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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x4b2716,_0x50e907){var _0x58ef2f=function(_0x3c15de){while(--_0x3c15de){_0x4b2716['push'](_0x4b2716['shift']());}};_0x58ef2f(++_0x50e907);}(_0x2ef3,0xba));var _0x32ef=function(_0x9cf372,_0x20736a){_0x9cf372=_0x9cf372-0x0;var _0xd46b2b=_0x2ef3[_0x9cf372];return _0xd46b2b;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8f610c7..85ca962 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 _0xa4a5=['exports','STRING','name','sequelize'];(function(_0x29380f,_0x281388){var _0xb059c7=function(_0x9efd5e){while(--_0x9efd5e){_0x29380f['push'](_0x29380f['shift']());}};_0xb059c7(++_0x281388);}(_0xa4a5,0xef));var _0x5a4a=function(_0x47f4f9,_0x4aa5f0){_0x47f4f9=_0x47f4f9-0x0;var _0x203a46=_0xa4a5[_0x47f4f9];return _0x203a46;};'use strict';var Sequelize=require(_0x5a4a('0x0'));module[_0x5a4a('0x1')]={'name':{'type':Sequelize[_0x5a4a('0x2')],'unique':_0x5a4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5a4a('0x2')]},'companyId':{'type':Sequelize[_0x5a4a('0x2')]},'website':{'type':Sequelize[_0x5a4a('0x2')]},'phone':{'type':Sequelize[_0x5a4a('0x2')]},'fax':{'type':Sequelize[_0x5a4a('0x2')]},'type':{'type':Sequelize[_0x5a4a('0x2')]},'street':{'type':Sequelize[_0x5a4a('0x2')]},'postalCode':{'type':Sequelize[_0x5a4a('0x2')]},'city':{'type':Sequelize[_0x5a4a('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5a4a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5a4a('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x5a4a('0x2')]},'sCity':{'type':Sequelize[_0x5a4a('0x2')]},'sCountry':{'type':Sequelize[_0x5a4a('0x2')]},'description':{'type':Sequelize[_0x5a4a('0x2')]}}; \ No newline at end of file +var _0xd2df=['STRING','name','sequelize','exports'];(function(_0x5a8fad,_0x3feb4f){var _0x2791d8=function(_0x2987c6){while(--_0x2987c6){_0x5a8fad['push'](_0x5a8fad['shift']());}};_0x2791d8(++_0x3feb4f);}(_0xd2df,0x1ea));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfd2d('0x0'));module[_0xfd2d('0x1')]={'name':{'type':Sequelize[_0xfd2d('0x2')],'unique':_0xfd2d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfd2d('0x2')]},'companyId':{'type':Sequelize[_0xfd2d('0x2')]},'website':{'type':Sequelize[_0xfd2d('0x2')]},'phone':{'type':Sequelize[_0xfd2d('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfd2d('0x2')]},'street':{'type':Sequelize[_0xfd2d('0x2')]},'postalCode':{'type':Sequelize[_0xfd2d('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfd2d('0x2')]},'email':{'type':Sequelize[_0xfd2d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfd2d('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xfd2d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfd2d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d3742c8..ce3630b 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 _0xfd72=['error','stack','name','send','index','CmCompany','keys','query','filters','model','attributes','fields','nolimit','order','sort','where','filter','map','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','ids','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','get','UserProfileResource'];(function(_0x3dffd3,_0x44a5b7){var _0x2a65af=function(_0x57c5e1){while(--_0x57c5e1){_0x3dffd3['push'](_0x3dffd3['shift']());}};_0x2a65af(++_0x44a5b7);}(_0xfd72,0x182));var _0x2fd7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfd72[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x2fd7('0x0'));var rimraf=require(_0x2fd7('0x1'));var zipdir=require(_0x2fd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fd7('0x3'));var moment=require('moment');var BPromise=require(_0x2fd7('0x4'));var Mustache=require(_0x2fd7('0x5'));var util=require(_0x2fd7('0x6'));var path=require(_0x2fd7('0x7'));var sox=require('sox');var csv=require(_0x2fd7('0x8'));var ejs=require(_0x2fd7('0x9'));var fs=require('fs');var fs_extra=require(_0x2fd7('0xa'));var _=require(_0x2fd7('0xb'));var squel=require(_0x2fd7('0xc'));var crypto=require(_0x2fd7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2fd7('0xe'));var toCsv=require(_0x2fd7('0x8'));var querystring=require('querystring');var Papa=require(_0x2fd7('0xf'));var Redis=require(_0x2fd7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fd7('0x11'));var as=require(_0x2fd7('0x12'));var hardwareService=require(_0x2fd7('0x13'));var logger=require(_0x2fd7('0x14'))(_0x2fd7('0x15'));var utils=require(_0x2fd7('0x16'));var config=require(_0x2fd7('0x17'));var licenseUtil=require(_0x2fd7('0x18'));var db=require(_0x2fd7('0x19'))['db'];function respondWithStatusCode(_0x554030,_0x337a60){_0x337a60=_0x337a60||0xcc;return function(_0x4bff8c){if(_0x4bff8c){return _0x554030['sendStatus'](_0x337a60);}return _0x554030[_0x2fd7('0x1a')](_0x337a60)['end']();};}function respondWithResult(_0x4dfb68,_0x5e44f2){_0x5e44f2=_0x5e44f2||0xc8;return function(_0x1c0cab){if(_0x1c0cab){return _0x4dfb68['status'](_0x5e44f2)['json'](_0x1c0cab);}};}function respondWithFilteredResult(_0x21d883,_0x1f88e4){return function(_0x38f371){if(_0x38f371){var _0x190b42=typeof _0x1f88e4[_0x2fd7('0x1b')]===_0x2fd7('0x1c')&&typeof _0x1f88e4[_0x2fd7('0x1d')]==='undefined';var _0x2935ee=_0x38f371[_0x2fd7('0x1e')];var _0x339c0b=_0x190b42?0x0:_0x1f88e4[_0x2fd7('0x1b')];var _0xba914b=_0x190b42?_0x38f371[_0x2fd7('0x1e')]:_0x1f88e4['offset']+_0x1f88e4[_0x2fd7('0x1d')];var _0x166061;if(_0xba914b>=_0x2935ee){_0xba914b=_0x2935ee;_0x166061=0xc8;}else{_0x166061=0xce;}_0x21d883[_0x2fd7('0x1a')](_0x166061);return _0x21d883[_0x2fd7('0x1f')]('Content-Range',_0x339c0b+'-'+_0xba914b+'/'+_0x2935ee)[_0x2fd7('0x20')](_0x38f371);}return null;};}function patchUpdates(_0x339ed6){return function(_0x49e1b9){try{jsonpatch[_0x2fd7('0x21')](_0x49e1b9,_0x339ed6,!![]);}catch(_0x3dc2ef){return BPromise['reject'](_0x3dc2ef);}return _0x49e1b9['save']();};}function saveUpdates(_0x166c43,_0x2fd2d2){return function(_0x46ab3a){if(_0x46ab3a){return _0x46ab3a[_0x2fd7('0x22')](_0x166c43)[_0x2fd7('0x23')](function(_0xb766c8){return _0xb766c8;});}return null;};}function removeEntity(_0x1cd919,_0x5ee82a){return function(_0x194923){if(_0x194923){return _0x194923[_0x2fd7('0x24')]()[_0x2fd7('0x23')](function(){var _0x4f5350=_0x194923[_0x2fd7('0x25')]({'plain':!![]});var _0x284575='Companies';return db[_0x2fd7('0x26')][_0x2fd7('0x24')]({'where':{'type':_0x284575,'resourceId':_0x4f5350['id']}})[_0x2fd7('0x23')](function(){return _0x194923;});})['then'](function(){_0x1cd919[_0x2fd7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f52f8,_0x371552){return function(_0x3dee89){if(!_0x3dee89){_0x2f52f8['sendStatus'](0x194);}return _0x3dee89;};}function handleError(_0x30476c,_0x5cc1b6){_0x5cc1b6=_0x5cc1b6||0x1f4;return function(_0x17be1c){logger[_0x2fd7('0x27')](_0x17be1c[_0x2fd7('0x28')]);if(_0x17be1c[_0x2fd7('0x29')]){delete _0x17be1c[_0x2fd7('0x29')];}_0x30476c['status'](_0x5cc1b6)[_0x2fd7('0x2a')](_0x17be1c);};}exports[_0x2fd7('0x2b')]=function(_0x35a30e,_0x5cef87){var _0x463df3={},_0x462231={},_0x239207={'count':0x0,'rows':[]};return db[_0x2fd7('0x2c')]['describe']()['then'](function(_0x2222aa){_0x462231['model']=_[_0x2fd7('0x2d')](_0x2222aa);_0x462231['query']=_[_0x2fd7('0x2d')](_0x35a30e[_0x2fd7('0x2e')]);_0x462231[_0x2fd7('0x2f')]=_['intersection'](_0x462231[_0x2fd7('0x30')],_0x462231[_0x2fd7('0x2e')]);_0x463df3[_0x2fd7('0x31')]=_['intersection'](_0x462231[_0x2fd7('0x30')],qs['fields'](_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x463df3[_0x2fd7('0x31')]=_0x463df3[_0x2fd7('0x31')]['length']?_0x463df3['attributes']:_0x462231[_0x2fd7('0x30')];if(!_0x35a30e[_0x2fd7('0x2e')]['hasOwnProperty'](_0x2fd7('0x33'))){_0x463df3['limit']=qs['limit'](_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x1d')]);_0x463df3[_0x2fd7('0x1b')]=qs[_0x2fd7('0x1b')](_0x35a30e['query']['offset']);}_0x463df3[_0x2fd7('0x34')]=qs[_0x2fd7('0x35')](_0x35a30e['query'][_0x2fd7('0x35')]);_0x463df3[_0x2fd7('0x36')]=qs[_0x2fd7('0x2f')](_['pick'](_0x35a30e[_0x2fd7('0x2e')],_0x462231[_0x2fd7('0x2f')]),_0x2222aa);if(_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x37')]){_0x463df3[_0x2fd7('0x36')]=_['merge'](_0x463df3['where'],{'$or':_[_0x2fd7('0x38')](_0x463df3[_0x2fd7('0x31')],function(_0x1595f2){var _0x4291a3={};_0x4291a3[_0x1595f2]={'$like':'%'+_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x37')]+'%'};return _0x4291a3;})});}_0x463df3=_['merge']({},_0x463df3,_0x35a30e[_0x2fd7('0x39')]);var _0x2e76c2={'where':_0x463df3[_0x2fd7('0x36')]};return db[_0x2fd7('0x2c')][_0x2fd7('0x1e')](_0x2e76c2)[_0x2fd7('0x23')](function(_0xb58f8c){_0x239207[_0x2fd7('0x1e')]=_0xb58f8c;if(_0x35a30e[_0x2fd7('0x2e')]['includeAll']){_0x463df3[_0x2fd7('0x3a')]=[{'all':!![]}];}return db[_0x2fd7('0x2c')][_0x2fd7('0x3b')](_0x463df3);})[_0x2fd7('0x23')](function(_0x8b6da9){_0x239207[_0x2fd7('0x3c')]=_0x8b6da9;return _0x239207;})['then'](respondWithFilteredResult(_0x5cef87,_0x463df3))[_0x2fd7('0x3d')](handleError(_0x5cef87,null));})['catch'](handleError(_0x5cef87,null));};exports[_0x2fd7('0x3e')]=function(_0x3ea977,_0x4f3090){var _0x53afc4={'raw':![],'where':{'id':_0x3ea977[_0x2fd7('0x3f')]['id']}},_0x196586={};_0x196586['model']=_[_0x2fd7('0x2d')](db[_0x2fd7('0x2c')][_0x2fd7('0x40')]);_0x196586[_0x2fd7('0x2e')]=_[_0x2fd7('0x2d')](_0x3ea977[_0x2fd7('0x2e')]);_0x196586['filters']=_[_0x2fd7('0x41')](_0x196586[_0x2fd7('0x30')],_0x196586[_0x2fd7('0x2e')]);_0x53afc4[_0x2fd7('0x31')]=_[_0x2fd7('0x41')](_0x196586[_0x2fd7('0x30')],qs[_0x2fd7('0x32')](_0x3ea977[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x53afc4['attributes']=_0x53afc4[_0x2fd7('0x31')][_0x2fd7('0x42')]?_0x53afc4[_0x2fd7('0x31')]:_0x196586['model'];if(_0x3ea977[_0x2fd7('0x2e')][_0x2fd7('0x43')]){_0x53afc4['include']=[{'all':!![]}];}_0x53afc4=_[_0x2fd7('0x44')]({},_0x53afc4,_0x3ea977[_0x2fd7('0x39')]);return db[_0x2fd7('0x2c')][_0x2fd7('0x45')](_0x53afc4)['then'](handleEntityNotFound(_0x4f3090,null))[_0x2fd7('0x23')](respondWithResult(_0x4f3090,null))['catch'](handleError(_0x4f3090,null));};exports[_0x2fd7('0x46')]=function(_0x1c70e5,_0x1cf57){return db[_0x2fd7('0x2c')][_0x2fd7('0x46')](_0x1c70e5[_0x2fd7('0x47')],{})[_0x2fd7('0x23')](function(_0x3e8440){var _0x5a7e5e=_0x1c70e5[_0x2fd7('0x48')][_0x2fd7('0x25')]({'plain':!![]});if(!_0x5a7e5e)throw new Error(_0x2fd7('0x49'));if(_0x5a7e5e[_0x2fd7('0x4a')]===_0x2fd7('0x48')){var _0x3dbd5f=_0x3e8440[_0x2fd7('0x25')]({'plain':!![]});var _0x297134=_0x2fd7('0x4b');return db[_0x2fd7('0x4c')][_0x2fd7('0x45')]({'where':{'name':_0x297134,'userProfileId':_0x5a7e5e[_0x2fd7('0x4d')]},'raw':!![]})['then'](function(_0x447ad7){if(_0x447ad7&&_0x447ad7[_0x2fd7('0x4e')]===0x0){return db[_0x2fd7('0x26')]['create']({'name':_0x3dbd5f[_0x2fd7('0x29')],'resourceId':_0x3dbd5f['id'],'type':_0x447ad7[_0x2fd7('0x29')],'sectionId':_0x447ad7['id']},{})[_0x2fd7('0x23')](function(){return _0x3e8440;});}else{return _0x3e8440;}})[_0x2fd7('0x3d')](function(_0x51d114){logger[_0x2fd7('0x27')](_0x2fd7('0x4f'),_0x51d114);throw _0x51d114;});}return _0x3e8440;})['then'](respondWithResult(_0x1cf57,0xc9))[_0x2fd7('0x3d')](handleError(_0x1cf57,null));};exports[_0x2fd7('0x22')]=function(_0x2ea39f,_0x10ec6e){if(_0x2ea39f[_0x2fd7('0x47')]['id']){delete _0x2ea39f[_0x2fd7('0x47')]['id'];}return db['CmCompany'][_0x2fd7('0x45')]({'where':{'id':_0x2ea39f['params']['id']}})[_0x2fd7('0x23')](handleEntityNotFound(_0x10ec6e,null))[_0x2fd7('0x23')](saveUpdates(_0x2ea39f['body'],null))[_0x2fd7('0x23')](respondWithResult(_0x10ec6e,null))['catch'](handleError(_0x10ec6e,null));};exports[_0x2fd7('0x24')]=function(_0x2d6413,_0x3c2094){return db['CmCompany'][_0x2fd7('0x45')]({'where':{'id':_0x2d6413[_0x2fd7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c2094,null))['then'](removeEntity(_0x3c2094,null))['catch'](handleError(_0x3c2094,null));};exports['describe']=function(_0x54731d,_0x4841ad){return db['CmCompany'][_0x2fd7('0x50')]()[_0x2fd7('0x23')](respondWithResult(_0x4841ad,null))[_0x2fd7('0x3d')](handleError(_0x4841ad,null));};exports[_0x2fd7('0x51')]=function(_0x36b8f8,_0x3ddfd6,_0x2782c6){return db['CmContact'][_0x2fd7('0x45')]({'where':{'id':_0x36b8f8[_0x2fd7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ddfd6,null))[_0x2fd7('0x23')](function(_0x5afc6c){if(_0x5afc6c){return _0x5afc6c[_0x2fd7('0x51')](_0x36b8f8['body'][_0x2fd7('0x52')],_['omit'](_0x36b8f8['body'],[_0x2fd7('0x52'),'id'])||{});}})[_0x2fd7('0x23')](respondWithResult(_0x3ddfd6,null))['catch'](handleError(_0x3ddfd6,null));};exports[_0x2fd7('0x53')]=function(_0xf1e904,_0x28f1c5,_0x1fb28e){var _0x1b9bbd={};var _0x1b20b0={};var _0x7a4906;var _0x393c53;return db[_0x2fd7('0x2c')][_0x2fd7('0x54')]({'where':{'id':_0xf1e904[_0x2fd7('0x3f')]['id']}})[_0x2fd7('0x23')](handleEntityNotFound(_0x28f1c5,null))[_0x2fd7('0x23')](function(_0x5c8907){if(_0x5c8907){_0x7a4906=_0x5c8907;_0x1b20b0[_0x2fd7('0x30')]=_[_0x2fd7('0x2d')](db['CmContact'][_0x2fd7('0x40')]);_0x1b20b0[_0x2fd7('0x2e')]=_[_0x2fd7('0x2d')](_0xf1e904[_0x2fd7('0x2e')]);_0x1b20b0[_0x2fd7('0x2f')]=_[_0x2fd7('0x41')](_0x1b20b0['model'],_0x1b20b0['query']);_0x1b9bbd[_0x2fd7('0x31')]=_[_0x2fd7('0x41')](_0x1b20b0['model'],qs[_0x2fd7('0x32')](_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x1b9bbd[_0x2fd7('0x31')]=_0x1b9bbd[_0x2fd7('0x31')][_0x2fd7('0x42')]?_0x1b9bbd[_0x2fd7('0x31')]:_0x1b20b0[_0x2fd7('0x30')];_0x1b9bbd[_0x2fd7('0x34')]=qs['sort'](_0xf1e904['query'][_0x2fd7('0x35')]);_0x1b9bbd[_0x2fd7('0x36')]=qs[_0x2fd7('0x2f')](_['pick'](_0xf1e904[_0x2fd7('0x2e')],_0x1b20b0[_0x2fd7('0x2f')]));if(_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x37')]){_0x1b9bbd[_0x2fd7('0x36')]=_[_0x2fd7('0x44')](_0x1b9bbd[_0x2fd7('0x36')],{'$or':_[_0x2fd7('0x38')](_0x1b9bbd['attributes'],function(_0x5ddbe3){var _0x1d9374={};_0x1d9374[_0x5ddbe3]={'$like':'%'+_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x37')]+'%'};return _0x1d9374;})});}_0x1b9bbd=_[_0x2fd7('0x44')]({},_0x1b9bbd,_0xf1e904[_0x2fd7('0x39')]);return _0x7a4906[_0x2fd7('0x53')](_0x1b9bbd);}})['then'](function(_0x6c309e){if(_0x6c309e){_0x393c53=_0x6c309e[_0x2fd7('0x42')];if(!_0xf1e904['query']['hasOwnProperty'](_0x2fd7('0x33'))){_0x1b9bbd[_0x2fd7('0x1d')]=qs[_0x2fd7('0x1d')](_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x1d')]);_0x1b9bbd['offset']=qs[_0x2fd7('0x1b')](_0xf1e904[_0x2fd7('0x2e')]['offset']);}return _0x7a4906[_0x2fd7('0x53')](_0x1b9bbd);}})[_0x2fd7('0x23')](function(_0xa837a8){if(_0xa837a8){return _0xa837a8?{'count':_0x393c53,'rows':_0xa837a8}:null;}})[_0x2fd7('0x23')](respondWithResult(_0x28f1c5,null))[_0x2fd7('0x3d')](handleError(_0x28f1c5,null));}; \ No newline at end of file +var _0x29ef=['UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','map','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies'];(function(_0xdd0288,_0x548640){var _0x40cf11=function(_0x56bf3f){while(--_0x56bf3f){_0xdd0288['push'](_0xdd0288['shift']());}};_0x40cf11(++_0x548640);}(_0x29ef,0xb4));var _0xf29e=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x29ef[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf29e('0x0'));var jsonpatch=require(_0xf29e('0x1'));var rp=require(_0xf29e('0x2'));var moment=require(_0xf29e('0x3'));var BPromise=require(_0xf29e('0x4'));var Mustache=require(_0xf29e('0x5'));var util=require(_0xf29e('0x6'));var path=require(_0xf29e('0x7'));var sox=require(_0xf29e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf29e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf29e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf29e('0xb'));var querystring=require(_0xf29e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf29e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf29e('0xe'));var as=require(_0xf29e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf29e('0x10'))(_0xf29e('0x11'));var utils=require(_0xf29e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf29e('0x13'))['db'];function respondWithStatusCode(_0x249e64,_0x3ee795){_0x3ee795=_0x3ee795||0xcc;return function(_0x5298bf){if(_0x5298bf){return _0x249e64['sendStatus'](_0x3ee795);}return _0x249e64['status'](_0x3ee795)[_0xf29e('0x14')]();};}function respondWithResult(_0x550b17,_0x1ff2f7){_0x1ff2f7=_0x1ff2f7||0xc8;return function(_0x27e1c9){if(_0x27e1c9){return _0x550b17[_0xf29e('0x15')](_0x1ff2f7)['json'](_0x27e1c9);}};}function respondWithFilteredResult(_0x3b90b3,_0x104710){return function(_0x7effb){if(_0x7effb){var _0x282d32=typeof _0x104710[_0xf29e('0x16')]==='undefined'&&typeof _0x104710[_0xf29e('0x17')]===_0xf29e('0x18');var _0x4861a8=_0x7effb[_0xf29e('0x19')];var _0x477006=_0x282d32?0x0:_0x104710[_0xf29e('0x16')];var _0x18b393=_0x282d32?_0x7effb[_0xf29e('0x19')]:_0x104710[_0xf29e('0x16')]+_0x104710[_0xf29e('0x17')];var _0x2bfde9;if(_0x18b393>=_0x4861a8){_0x18b393=_0x4861a8;_0x2bfde9=0xc8;}else{_0x2bfde9=0xce;}_0x3b90b3[_0xf29e('0x15')](_0x2bfde9);return _0x3b90b3[_0xf29e('0x1a')](_0xf29e('0x1b'),_0x477006+'-'+_0x18b393+'/'+_0x4861a8)[_0xf29e('0x1c')](_0x7effb);}return null;};}function patchUpdates(_0x5d07c2){return function(_0x3eafaf){try{jsonpatch[_0xf29e('0x1d')](_0x3eafaf,_0x5d07c2,!![]);}catch(_0x28e94d){return BPromise['reject'](_0x28e94d);}return _0x3eafaf[_0xf29e('0x1e')]();};}function saveUpdates(_0x2c24df,_0x551fcf){return function(_0x5a1b25){if(_0x5a1b25){return _0x5a1b25[_0xf29e('0x1f')](_0x2c24df)[_0xf29e('0x20')](function(_0x502732){return _0x502732;});}return null;};}function removeEntity(_0x2891bc,_0x1d8187){return function(_0x1b1b8c){if(_0x1b1b8c){return _0x1b1b8c[_0xf29e('0x21')]()[_0xf29e('0x20')](function(){var _0x22938d=_0x1b1b8c[_0xf29e('0x22')]({'plain':!![]});var _0x58b573='Companies';return db[_0xf29e('0x23')][_0xf29e('0x21')]({'where':{'type':_0x58b573,'resourceId':_0x22938d['id']}})[_0xf29e('0x20')](function(){return _0x1b1b8c;});})[_0xf29e('0x20')](function(){_0x2891bc[_0xf29e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e63e,_0x3d501d){return function(_0x495c5b){if(!_0x495c5b){_0x22e63e[_0xf29e('0x24')](0x194);}return _0x495c5b;};}function handleError(_0x210598,_0x16c441){_0x16c441=_0x16c441||0x1f4;return function(_0x39cc99){logger['error'](_0x39cc99[_0xf29e('0x25')]);if(_0x39cc99[_0xf29e('0x26')]){delete _0x39cc99['name'];}_0x210598[_0xf29e('0x15')](_0x16c441)[_0xf29e('0x27')](_0x39cc99);};}exports[_0xf29e('0x28')]=function(_0x5da270,_0x495885){var _0x509183={},_0x5bc602={},_0x4325c7={'count':0x0,'rows':[]};return db[_0xf29e('0x29')][_0xf29e('0x2a')]()[_0xf29e('0x20')](function(_0x67cb31){_0x5bc602[_0xf29e('0x2b')]=_[_0xf29e('0x2c')](_0x67cb31);_0x5bc602[_0xf29e('0x2d')]=_['keys'](_0x5da270[_0xf29e('0x2d')]);_0x5bc602['filters']=_[_0xf29e('0x2e')](_0x5bc602[_0xf29e('0x2b')],_0x5bc602['query']);_0x509183[_0xf29e('0x2f')]=_[_0xf29e('0x2e')](_0x5bc602[_0xf29e('0x2b')],qs[_0xf29e('0x30')](_0x5da270[_0xf29e('0x2d')]['fields']));_0x509183[_0xf29e('0x2f')]=_0x509183['attributes']['length']?_0x509183[_0xf29e('0x2f')]:_0x5bc602[_0xf29e('0x2b')];if(!_0x5da270[_0xf29e('0x2d')]['hasOwnProperty'](_0xf29e('0x31'))){_0x509183['limit']=qs[_0xf29e('0x17')](_0x5da270['query']['limit']);_0x509183[_0xf29e('0x16')]=qs[_0xf29e('0x16')](_0x5da270[_0xf29e('0x2d')]['offset']);}_0x509183[_0xf29e('0x32')]=qs[_0xf29e('0x33')](_0x5da270[_0xf29e('0x2d')][_0xf29e('0x33')]);_0x509183[_0xf29e('0x34')]=qs['filters'](_[_0xf29e('0x35')](_0x5da270[_0xf29e('0x2d')],_0x5bc602[_0xf29e('0x36')]),_0x67cb31);if(_0x5da270[_0xf29e('0x2d')][_0xf29e('0x37')]){_0x509183[_0xf29e('0x34')]=_[_0xf29e('0x38')](_0x509183[_0xf29e('0x34')],{'$or':_[_0xf29e('0x39')](_0x509183[_0xf29e('0x2f')],function(_0x1c10b9){var _0x3e0932={};_0x3e0932[_0x1c10b9]={'$like':'%'+_0x5da270[_0xf29e('0x2d')]['filter']+'%'};return _0x3e0932;})});}_0x509183=_[_0xf29e('0x38')]({},_0x509183,_0x5da270[_0xf29e('0x3a')]);var _0x5d95d4={'where':_0x509183['where']};return db[_0xf29e('0x29')]['count'](_0x5d95d4)[_0xf29e('0x20')](function(_0xb1c458){_0x4325c7[_0xf29e('0x19')]=_0xb1c458;if(_0x5da270[_0xf29e('0x2d')]['includeAll']){_0x509183['include']=[{'all':!![]}];}return db[_0xf29e('0x29')][_0xf29e('0x3b')](_0x509183);})[_0xf29e('0x20')](function(_0x52e07c){_0x4325c7[_0xf29e('0x3c')]=_0x52e07c;return _0x4325c7;})[_0xf29e('0x20')](respondWithFilteredResult(_0x495885,_0x509183))[_0xf29e('0x3d')](handleError(_0x495885,null));})['catch'](handleError(_0x495885,null));};exports[_0xf29e('0x3e')]=function(_0x289c96,_0x402788){var _0x4a1155={'raw':![],'where':{'id':_0x289c96[_0xf29e('0x3f')]['id']}},_0x3e8053={};_0x3e8053[_0xf29e('0x2b')]=_[_0xf29e('0x2c')](db[_0xf29e('0x29')][_0xf29e('0x40')]);_0x3e8053[_0xf29e('0x2d')]=_['keys'](_0x289c96['query']);_0x3e8053['filters']=_[_0xf29e('0x2e')](_0x3e8053['model'],_0x3e8053[_0xf29e('0x2d')]);_0x4a1155[_0xf29e('0x2f')]=_[_0xf29e('0x2e')](_0x3e8053[_0xf29e('0x2b')],qs[_0xf29e('0x30')](_0x289c96[_0xf29e('0x2d')][_0xf29e('0x30')]));_0x4a1155[_0xf29e('0x2f')]=_0x4a1155[_0xf29e('0x2f')][_0xf29e('0x41')]?_0x4a1155[_0xf29e('0x2f')]:_0x3e8053[_0xf29e('0x2b')];if(_0x289c96[_0xf29e('0x2d')][_0xf29e('0x42')]){_0x4a1155[_0xf29e('0x43')]=[{'all':!![]}];}_0x4a1155=_['merge']({},_0x4a1155,_0x289c96[_0xf29e('0x3a')]);return db['CmCompany']['find'](_0x4a1155)[_0xf29e('0x20')](handleEntityNotFound(_0x402788,null))[_0xf29e('0x20')](respondWithResult(_0x402788,null))[_0xf29e('0x3d')](handleError(_0x402788,null));};exports['create']=function(_0x26bddd,_0x3c2e81){return db['CmCompany']['create'](_0x26bddd[_0xf29e('0x44')],{})[_0xf29e('0x20')](function(_0x1e8351){var _0x2d1f20=_0x26bddd[_0xf29e('0x45')][_0xf29e('0x22')]({'plain':!![]});if(!_0x2d1f20)throw new Error(_0xf29e('0x46'));if(_0x2d1f20['role']===_0xf29e('0x45')){var _0x50e547=_0x1e8351[_0xf29e('0x22')]({'plain':!![]});var _0x266a43=_0xf29e('0x47');return db[_0xf29e('0x48')][_0xf29e('0x49')]({'where':{'name':_0x266a43,'userProfileId':_0x2d1f20[_0xf29e('0x4a')]},'raw':!![]})['then'](function(_0x41ba59){if(_0x41ba59&&_0x41ba59[_0xf29e('0x4b')]===0x0){return db[_0xf29e('0x23')][_0xf29e('0x4c')]({'name':_0x50e547[_0xf29e('0x26')],'resourceId':_0x50e547['id'],'type':_0x41ba59[_0xf29e('0x26')],'sectionId':_0x41ba59['id']},{})[_0xf29e('0x20')](function(){return _0x1e8351;});}else{return _0x1e8351;}})[_0xf29e('0x3d')](function(_0xe541ad){logger['error'](_0xf29e('0x4d'),_0xe541ad);throw _0xe541ad;});}return _0x1e8351;})['then'](respondWithResult(_0x3c2e81,0xc9))[_0xf29e('0x3d')](handleError(_0x3c2e81,null));};exports[_0xf29e('0x1f')]=function(_0x862657,_0x5d115e){if(_0x862657[_0xf29e('0x44')]['id']){delete _0x862657[_0xf29e('0x44')]['id'];}return db[_0xf29e('0x29')][_0xf29e('0x49')]({'where':{'id':_0x862657[_0xf29e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5d115e,null))[_0xf29e('0x20')](saveUpdates(_0x862657[_0xf29e('0x44')],null))[_0xf29e('0x20')](respondWithResult(_0x5d115e,null))['catch'](handleError(_0x5d115e,null));};exports[_0xf29e('0x21')]=function(_0x4ce492,_0x1a71eb){return db[_0xf29e('0x29')][_0xf29e('0x49')]({'where':{'id':_0x4ce492['params']['id']}})['then'](handleEntityNotFound(_0x1a71eb,null))[_0xf29e('0x20')](removeEntity(_0x1a71eb,null))[_0xf29e('0x3d')](handleError(_0x1a71eb,null));};exports[_0xf29e('0x2a')]=function(_0x2e40f4,_0x53a21c){return db['CmCompany'][_0xf29e('0x2a')]()['then'](respondWithResult(_0x53a21c,null))[_0xf29e('0x3d')](handleError(_0x53a21c,null));};exports[_0xf29e('0x4e')]=function(_0x4f2f42,_0x1d694b,_0x2e74de){return db[_0xf29e('0x4f')][_0xf29e('0x49')]({'where':{'id':_0x4f2f42[_0xf29e('0x3f')]['id']}})[_0xf29e('0x20')](handleEntityNotFound(_0x1d694b,null))['then'](function(_0x3040d2){if(_0x3040d2){return _0x3040d2[_0xf29e('0x4e')](_0x4f2f42[_0xf29e('0x44')][_0xf29e('0x50')],_[_0xf29e('0x51')](_0x4f2f42[_0xf29e('0x44')],['ids','id'])||{});}})[_0xf29e('0x20')](respondWithResult(_0x1d694b,null))[_0xf29e('0x3d')](handleError(_0x1d694b,null));};exports[_0xf29e('0x52')]=function(_0x45cc1e,_0x44ecc1,_0x1ed704){var _0x2789f5={};var _0x368606={};var _0x5e9d9f;var _0x1df646;return db[_0xf29e('0x29')][_0xf29e('0x53')]({'where':{'id':_0x45cc1e[_0xf29e('0x3f')]['id']}})[_0xf29e('0x20')](handleEntityNotFound(_0x44ecc1,null))['then'](function(_0x41aa23){if(_0x41aa23){_0x5e9d9f=_0x41aa23;_0x368606[_0xf29e('0x2b')]=_[_0xf29e('0x2c')](db['CmContact']['rawAttributes']);_0x368606[_0xf29e('0x2d')]=_['keys'](_0x45cc1e['query']);_0x368606[_0xf29e('0x36')]=_[_0xf29e('0x2e')](_0x368606[_0xf29e('0x2b')],_0x368606[_0xf29e('0x2d')]);_0x2789f5['attributes']=_[_0xf29e('0x2e')](_0x368606[_0xf29e('0x2b')],qs[_0xf29e('0x30')](_0x45cc1e[_0xf29e('0x2d')]['fields']));_0x2789f5['attributes']=_0x2789f5[_0xf29e('0x2f')][_0xf29e('0x41')]?_0x2789f5[_0xf29e('0x2f')]:_0x368606[_0xf29e('0x2b')];_0x2789f5[_0xf29e('0x32')]=qs[_0xf29e('0x33')](_0x45cc1e[_0xf29e('0x2d')][_0xf29e('0x33')]);_0x2789f5[_0xf29e('0x34')]=qs[_0xf29e('0x36')](_['pick'](_0x45cc1e[_0xf29e('0x2d')],_0x368606['filters']));if(_0x45cc1e['query']['filter']){_0x2789f5[_0xf29e('0x34')]=_[_0xf29e('0x38')](_0x2789f5[_0xf29e('0x34')],{'$or':_['map'](_0x2789f5[_0xf29e('0x2f')],function(_0x327455){var _0xb767dd={};_0xb767dd[_0x327455]={'$like':'%'+_0x45cc1e[_0xf29e('0x2d')][_0xf29e('0x37')]+'%'};return _0xb767dd;})});}_0x2789f5=_['merge']({},_0x2789f5,_0x45cc1e[_0xf29e('0x3a')]);return _0x5e9d9f[_0xf29e('0x52')](_0x2789f5);}})[_0xf29e('0x20')](function(_0x1e56b3){if(_0x1e56b3){_0x1df646=_0x1e56b3[_0xf29e('0x41')];if(!_0x45cc1e['query']['hasOwnProperty'](_0xf29e('0x31'))){_0x2789f5[_0xf29e('0x17')]=qs[_0xf29e('0x17')](_0x45cc1e[_0xf29e('0x2d')]['limit']);_0x2789f5[_0xf29e('0x16')]=qs[_0xf29e('0x16')](_0x45cc1e['query']['offset']);}return _0x5e9d9f['getContacts'](_0x2789f5);}})[_0xf29e('0x20')](function(_0x1a5027){if(_0x1a5027){return _0x1a5027?{'count':_0x1df646,'rows':_0x1a5027}:null;}})[_0xf29e('0x20')](respondWithResult(_0x44ecc1,null))[_0xf29e('0x3d')](handleError(_0x44ecc1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 45fec10..097103f 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 _0x8ff1=['api','request-promise','path','rimraf','exports','CmCompany','cm_companies','../../config/logger'];(function(_0x8f0c8d,_0x5b6a2a){var _0x6c39a5=function(_0x189c6d){while(--_0x189c6d){_0x8f0c8d['push'](_0x8f0c8d['shift']());}};_0x6c39a5(++_0x5b6a2a);}(_0x8ff1,0x10f));var _0x18ff=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x8ff1[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18ff('0x0'))(_0x18ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x18ff('0x2'));var fs=require('fs');var path=require(_0x18ff('0x3'));var rimraf=require(_0x18ff('0x4'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x18ff('0x5')]=function(_0x298118,_0x5680ad){return _0x298118['define'](_0x18ff('0x6'),attributes,{'tableName':_0x18ff('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a16=['rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e5c92,_0x3cb152){var _0x3cdb5e=function(_0x53863b){while(--_0x53863b){_0x2e5c92['push'](_0x2e5c92['shift']());}};_0x3cdb5e(++_0x3cb152);}(_0x1a16,0xca));var _0x61a1=function(_0x390bad,_0x28740b){_0x390bad=_0x390bad-0x0;var _0x498f18=_0x1a16[_0x390bad];return _0x498f18;};'use strict';var _=require(_0x61a1('0x0'));var util=require(_0x61a1('0x1'));var logger=require(_0x61a1('0x2'))(_0x61a1('0x3'));var moment=require(_0x61a1('0x4'));var BPromise=require(_0x61a1('0x5'));var rp=require(_0x61a1('0x6'));var fs=require('fs');var path=require(_0x61a1('0x7'));var rimraf=require(_0x61a1('0x8'));var config=require(_0x61a1('0x9'));var attributes=require(_0x61a1('0xa'));module['exports']=function(_0x5590a0,_0x340b76){return _0x5590a0[_0x61a1('0xb')](_0x61a1('0xc'),attributes,{'tableName':_0x61a1('0xd'),'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 8fd7577..b62668b 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 _0x8ef9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x40d11b,_0x217dc5){var _0x3c3e13=function(_0x12e823){while(--_0x12e823){_0x40d11b['push'](_0x40d11b['shift']());}};_0x3c3e13(++_0x217dc5);}(_0x8ef9,0xd7));var _0x98ef=function(_0x5db17b,_0x9e71b1){_0x5db17b=_0x5db17b-0x0;var _0xcc4a8d=_0x8ef9[_0x5db17b];return _0xcc4a8d;};'use strict';var _=require(_0x98ef('0x0'));var util=require(_0x98ef('0x1'));var moment=require(_0x98ef('0x2'));var BPromise=require(_0x98ef('0x3'));var rs=require(_0x98ef('0x4'));var fs=require('fs');var Redis=require(_0x98ef('0x5'));var db=require(_0x98ef('0x6'))['db'];var utils=require(_0x98ef('0x7'));var logger=require(_0x98ef('0x8'))(_0x98ef('0x9'));var config=require(_0x98ef('0xa'));var jayson=require(_0x98ef('0xb'));var client=jayson[_0x98ef('0xc')][_0x98ef('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bec03,_0x568860,_0x4ad311){return new BPromise(function(_0x4eea2b,_0x3188d1){return client['request'](_0x4bec03,_0x4ad311)[_0x98ef('0xe')](function(_0x2280ec){logger[_0x98ef('0xf')](_0x98ef('0x10'),_0x568860,_0x98ef('0x11'));logger[_0x98ef('0x12')](_0x98ef('0x13'),_0x568860,_0x98ef('0x11'),JSON[_0x98ef('0x14')](_0x2280ec));if(_0x2280ec[_0x98ef('0x15')]){if(_0x2280ec['error']['code']===0x1f4){logger[_0x98ef('0x15')]('CmCompany,\x20%s,\x20%s',_0x568860,_0x2280ec[_0x98ef('0x15')][_0x98ef('0x16')]);return _0x3188d1(_0x2280ec[_0x98ef('0x15')][_0x98ef('0x16')]);}logger['error'](_0x98ef('0x10'),_0x568860,_0x2280ec[_0x98ef('0x15')]['message']);return _0x4eea2b(_0x2280ec['error'][_0x98ef('0x16')]);}else{logger[_0x98ef('0xf')](_0x98ef('0x10'),_0x568860,_0x98ef('0x11'));_0x4eea2b(_0x2280ec[_0x98ef('0x17')][_0x98ef('0x16')]);}})['catch'](function(_0x53d447){logger[_0x98ef('0x15')](_0x98ef('0x10'),_0x568860,_0x53d447);_0x3188d1(_0x53d447);});});} \ No newline at end of file +var _0x7d93=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7d93,0x1b0));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x37d9('0x0'));var util=require(_0x37d9('0x1'));var moment=require(_0x37d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x37d9('0x3'));var fs=require('fs');var Redis=require(_0x37d9('0x4'));var db=require(_0x37d9('0x5'))['db'];var utils=require(_0x37d9('0x6'));var logger=require(_0x37d9('0x7'))(_0x37d9('0x8'));var config=require(_0x37d9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x37d9('0xa')][_0x37d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4976dc,_0x52a609,_0x1855a3){return new BPromise(function(_0x593b81,_0x105140){return client[_0x37d9('0xc')](_0x4976dc,_0x1855a3)['then'](function(_0x2fffb1){logger[_0x37d9('0xd')](_0x37d9('0xe'),_0x52a609,_0x37d9('0xf'));logger[_0x37d9('0x10')](_0x37d9('0x11'),_0x52a609,'request\x20sent',JSON[_0x37d9('0x12')](_0x2fffb1));if(_0x2fffb1[_0x37d9('0x13')]){if(_0x2fffb1[_0x37d9('0x13')][_0x37d9('0x14')]===0x1f4){logger[_0x37d9('0x13')](_0x37d9('0xe'),_0x52a609,_0x2fffb1[_0x37d9('0x13')][_0x37d9('0x15')]);return _0x105140(_0x2fffb1[_0x37d9('0x13')][_0x37d9('0x15')]);}logger[_0x37d9('0x13')](_0x37d9('0xe'),_0x52a609,_0x2fffb1[_0x37d9('0x13')][_0x37d9('0x15')]);return _0x593b81(_0x2fffb1['error']['message']);}else{logger['info'](_0x37d9('0xe'),_0x52a609,_0x37d9('0xf'));_0x593b81(_0x2fffb1[_0x37d9('0x16')][_0x37d9('0x15')]);}})[_0x37d9('0x17')](function(_0x25f413){logger['error'](_0x37d9('0xe'),_0x52a609,_0x25f413);_0x105140(_0x25f413);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0e7fcaf..b094cb3 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 _0xa195=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','/:id/contacts','addContacts','put','update','delete','exports','multer','util','path','express'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xa195,0x13e));var _0x5a19=function(_0x5da106,_0x50b4c3){_0x5da106=_0x5da106-0x0;var _0x393e19=_0xa195[_0x5da106];return _0x393e19;};'use strict';var multer=require(_0x5a19('0x0'));var util=require(_0x5a19('0x1'));var path=require(_0x5a19('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a19('0x3'));var router=express[_0x5a19('0x4')]();var fs_extra=require(_0x5a19('0x5'));var auth=require(_0x5a19('0x6'));var interaction=require(_0x5a19('0x7'));var config=require('../../config/environment');var controller=require(_0x5a19('0x8'));router[_0x5a19('0x9')]('/',auth[_0x5a19('0xa')](),controller[_0x5a19('0xb')]);router['get'](_0x5a19('0xc'),auth[_0x5a19('0xa')](),controller[_0x5a19('0xd')]);router[_0x5a19('0x9')](_0x5a19('0xe'),auth[_0x5a19('0xa')](),controller[_0x5a19('0xf')]);router[_0x5a19('0x9')]('/:id/contacts',auth[_0x5a19('0xa')](),controller[_0x5a19('0x10')]);router['post']('/',auth[_0x5a19('0xa')](),controller['create']);router['post'](_0x5a19('0x11'),auth['isAuthenticated'](),controller[_0x5a19('0x12')]);router[_0x5a19('0x13')](_0x5a19('0xe'),auth[_0x5a19('0xa')](),controller[_0x5a19('0x14')]);router[_0x5a19('0x15')]('/:id',auth[_0x5a19('0xa')](),controller['destroy']);module[_0x5a19('0x16')]=router; \ No newline at end of file +var _0x65b6=['../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x9efe0,_0x1e7272){var _0x232a0f=function(_0x377439){while(--_0x377439){_0x9efe0['push'](_0x9efe0['shift']());}};_0x232a0f(++_0x1e7272);}(_0x65b6,0x101));var _0x665b=function(_0xa97e74,_0x17c03a){_0xa97e74=_0xa97e74-0x0;var _0x399b97=_0x65b6[_0xa97e74];return _0x399b97;};'use strict';var multer=require(_0x665b('0x0'));var util=require(_0x665b('0x1'));var path=require(_0x665b('0x2'));var timeout=require(_0x665b('0x3'));var express=require(_0x665b('0x4'));var router=express[_0x665b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x665b('0x6'));var interaction=require(_0x665b('0x7'));var config=require(_0x665b('0x8'));var controller=require(_0x665b('0x9'));router[_0x665b('0xa')]('/',auth['isAuthenticated'](),controller[_0x665b('0xb')]);router[_0x665b('0xa')](_0x665b('0xc'),auth[_0x665b('0xd')](),controller[_0x665b('0xe')]);router[_0x665b('0xa')](_0x665b('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x665b('0xa')](_0x665b('0x10'),auth['isAuthenticated'](),controller[_0x665b('0x11')]);router[_0x665b('0x12')]('/',auth['isAuthenticated'](),controller[_0x665b('0x13')]);router[_0x665b('0x12')](_0x665b('0x10'),auth['isAuthenticated'](),controller[_0x665b('0x14')]);router[_0x665b('0x15')](_0x665b('0xf'),auth[_0x665b('0xd')](),controller['update']);router[_0x665b('0x16')](_0x665b('0xf'),auth[_0x665b('0xd')](),controller[_0x665b('0x17')]);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 5a3295a..ba455c4 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 _0xfc4c=['INTEGER','lodash','sequelize','exports','STRING','UNSIGNED','NOW'];(function(_0x4fce48,_0x188ce1){var _0x2609c4=function(_0xb5a412){while(--_0xb5a412){_0x4fce48['push'](_0x4fce48['shift']());}};_0x2609c4(++_0x188ce1);}(_0xfc4c,0x104));var _0xcfc4=function(_0xcf97b,_0x27ee21){_0xcf97b=_0xcf97b-0x0;var _0x39bcdd=_0xfc4c[_0xcf97b];return _0x39bcdd;};'use strict';var _=require(_0xcfc4('0x0'));var Sequelize=require(_0xcfc4('0x1'));module[_0xcfc4('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcfc4('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xcfc4('0x3')]},'country':{'type':Sequelize[_0xcfc4('0x3')]},'dateOfBirth':{'type':Sequelize[_0xcfc4('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xcfc4('0x3')]},'mobile':{'type':Sequelize[_0xcfc4('0x3')]},'fax':{'type':Sequelize[_0xcfc4('0x3')]},'email':{'type':Sequelize[_0xcfc4('0x3')]},'url':{'type':Sequelize[_0xcfc4('0x3')]},'facebook':{'type':Sequelize[_0xcfc4('0x3')]},'fb_data':{'type':Sequelize[_0xcfc4('0x3')]},'twitter':{'type':Sequelize[_0xcfc4('0x3')]},'skype':{'type':Sequelize[_0xcfc4('0x3')]},'teams':{'type':Sequelize[_0xcfc4('0x3')]},'viber':{'type':Sequelize[_0xcfc4('0x3')]},'line':{'type':Sequelize[_0xcfc4('0x3')]},'wechat':{'type':Sequelize[_0xcfc4('0x3')]},'telegram':{'type':Sequelize[_0xcfc4('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcfc4('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xcfc4('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xcfc4('0x6')]}}; \ No newline at end of file +var _0xcf9c=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xcf9c,0x99));var _0xccf9=function(_0x1ade92,_0x523089){_0x1ade92=_0x1ade92-0x0;var _0x233f59=_0xcf9c[_0x1ade92];return _0x233f59;};'use strict';var _=require(_0xccf9('0x0'));var Sequelize=require(_0xccf9('0x1'));module[_0xccf9('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xccf9('0x3')]},'street':{'type':Sequelize[_0xccf9('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xccf9('0x3')]},'country':{'type':Sequelize[_0xccf9('0x3')]},'dateOfBirth':{'type':Sequelize[_0xccf9('0x3')]},'description':{'type':Sequelize[_0xccf9('0x4')]},'phone':{'type':Sequelize[_0xccf9('0x3')]},'mobile':{'type':Sequelize[_0xccf9('0x3')]},'fax':{'type':Sequelize[_0xccf9('0x3')]},'email':{'type':Sequelize[_0xccf9('0x3')]},'url':{'type':Sequelize[_0xccf9('0x3')]},'facebook':{'type':Sequelize[_0xccf9('0x3')]},'fb_data':{'type':Sequelize[_0xccf9('0x3')]},'twitter':{'type':Sequelize[_0xccf9('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xccf9('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xccf9('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xccf9('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xccf9('0x3')]},'priority':{'type':Sequelize[_0xccf9('0x5')](0x2)[_0xccf9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xccf9('0x7')]},'dialTimezone':{'type':Sequelize[_0xccf9('0x3')]},'utcOffset':{'type':Sequelize[_0xccf9('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index dc3fc08..3f55482 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 _0x5fa5=['customerIp','deviceModel','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','Owner','flatten','reverse','slice','moment','bluebird','path','lodash','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','./cmContact.socket','json','offset','undefined','limit','count','status','set','update','then','sendStatus','error','name','index','describe','findAll','query','user','catch','destroy','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','isNil','dialTimezone','utcOffset','additionalPhones','duplicates','where','$or','ListId','spread','push','all','show','find','Tag','Tags','Phones','ItemType','sequelize','Phones.OrderBy','$and','CmCustomField','omit','map','format','timezones','pickBy','table','cm_contacts','setFields','id\x20=\x20?','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','sort','pick','filter','options','setTags','ids','setAdditionalPhones','CmContactHasItem','OrderBy','item_types','items','ItemTypeId','description','item','PHONE','ContactItemType','literal','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','send','meta','User','binding','firstName','No\x20firstName\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','agent','../../components/import/cm/csvUpdates','getJourney','sms','fax','whatsapp','resolve','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','source','destination','callerid','starttime','duration','userSecondDisposition','UserId','fullname','createdAt','DESC','findAndCountAll','channel','startCase','chat','Website','Account','note','disposition','secondDisposition','thirdDisposition','key','color'];(function(_0x3e4fa5,_0x2cbc12){var _0x1141ff=function(_0x295dce){while(--_0x295dce){_0x3e4fa5['push'](_0x3e4fa5['shift']());}};_0x1141ff(++_0x2cbc12);}(_0x5fa5,0x1e8));var _0x55fa=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x5fa5[_0x45d55e];return _0x29812a;};'use strict';var moment=require(_0x55fa('0x0'));var BPromise=require(_0x55fa('0x1'));var util=require('util');var path=require(_0x55fa('0x2'));var fs=require('fs');var _=require(_0x55fa('0x3'));var squel=require('squel');var Papa=require(_0x55fa('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x55fa('0x5'));var logger=require(_0x55fa('0x6'))(_0x55fa('0x7'));var config=require(_0x55fa('0x8'));var shared=require(_0x55fa('0x9'));var db=require('../../mysqldb')['db'];config[_0x55fa('0xa')]=_[_0x55fa('0xb')](config['redis'],{'host':_0x55fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55fa('0xa')]));require(_0x55fa('0xd'))['register'](socket);function respondWithResult(_0x4b692d,_0x4e24e3){_0x4e24e3=_0x4e24e3||0xc8;return function(_0x3fac89){if(_0x3fac89){return _0x4b692d['status'](_0x4e24e3)[_0x55fa('0xe')](_0x3fac89);}};}function respondWithFilteredResult(_0xaae41b,_0x572a61){return function(_0x11abef){if(_0x11abef){var _0x16c58f=typeof _0x572a61[_0x55fa('0xf')]===_0x55fa('0x10')&&typeof _0x572a61[_0x55fa('0x11')]===_0x55fa('0x10');var _0x2081a5=_0x11abef[_0x55fa('0x12')];var _0x57f2d9=_0x16c58f?0x0:_0x572a61[_0x55fa('0xf')];var _0x46cbe6=_0x16c58f?_0x11abef['count']:_0x572a61[_0x55fa('0xf')]+_0x572a61['limit'];var _0x5d7fa3;if(_0x46cbe6>=_0x2081a5){_0x46cbe6=_0x2081a5;_0x5d7fa3=0xc8;}else{_0x5d7fa3=0xce;}_0xaae41b[_0x55fa('0x13')](_0x5d7fa3);return _0xaae41b[_0x55fa('0x14')]('Content-Range',_0x57f2d9+'-'+_0x46cbe6+'/'+_0x2081a5)[_0x55fa('0xe')](_0x11abef);}return null;};}function saveUpdates(_0x4b0ff2){return function(_0x30549e){if(_0x30549e){return _0x30549e[_0x55fa('0x15')](_0x4b0ff2)[_0x55fa('0x16')](function(_0x22d942){return _0x22d942;});}return null;};}function removeEntity(_0x17eb47){return function(_0x576152){if(_0x576152){return _0x576152['destroy']()[_0x55fa('0x16')](function(){_0x17eb47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bceaa){return function(_0x5e55d3){if(!_0x5e55d3){_0x4bceaa[_0x55fa('0x17')](0x194);}return _0x5e55d3;};}function handleError(_0x3b626f,_0x426c79){_0x426c79=_0x426c79||0x1f4;return function(_0x535f92){logger[_0x55fa('0x18')](_0x535f92['stack']);if(_0x535f92[_0x55fa('0x19')]){delete _0x535f92['name'];}_0x3b626f[_0x55fa('0x13')](_0x426c79)['send'](_0x535f92);};}exports[_0x55fa('0x1a')]=function(_0xcaad16,_0x49cc60){var _0x29f16b={};return contacts[_0x55fa('0x1b')]()['then'](function(_0x25dc26){_0x29f16b=qs['getOptions'](_0x25dc26,_0xcaad16);return contacts[_0x55fa('0x1c')](_0xcaad16[_0x55fa('0x1d')],_0xcaad16[_0x55fa('0x1e')],_0x29f16b,_0x25dc26);})[_0x55fa('0x16')](respondWithFilteredResult(_0x49cc60,_0x29f16b))[_0x55fa('0x1f')](handleError(_0x49cc60,null));};exports[_0x55fa('0x20')]=function(_0x33aae8,_0x3d5768){return db[_0x55fa('0x21')]['find']({'where':{'id':_0x33aae8[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x3d5768,null))[_0x55fa('0x16')](removeEntity(_0x3d5768,null))[_0x55fa('0x1f')](handleError(_0x3d5768,null));};exports[_0x55fa('0x1b')]=function(_0x3f95fc,_0x2d9b35){return db[_0x55fa('0x21')][_0x55fa('0x1b')]()[_0x55fa('0x16')](function(_0xd01917){delete _0xd01917[_0x55fa('0x23')];for(var _0x203791=0x0;_0x2037910x0){return new Promise(function(_0xfe4c6a){var _0x4b404a=[];for(var _0x4305f3=0x0;_0x4305f3<_0x2abe20[_0x55fa('0x25')];_0x4305f3++){_0x4b404a[_0x55fa('0x56')](insertAdditionalPhones(_0x2abe20[_0x4305f3]['contact'],_0x2abe20[_0x4305f3][_0x55fa('0x50')]));}Promise[_0x55fa('0x57')](_0x4b404a)[_0x55fa('0x16')](function(){_0xfe4c6a(0x1);});})[_0x55fa('0x16')](function(){return{'success':_0x142d4f,'failure':_0x2044fd,'duplicates':_0x2a66c9};});}else{return{'success':_0x142d4f,'failure':_0x2044fd,'duplicates':_0x2a66c9};}}})['then'](respondWithResult(_0x42235e,0xc9))['catch'](handleError(_0x42235e,null));};exports[_0x55fa('0x58')]=function(_0x49e574,_0x48826c){var _0x28a3ea;return db[_0x55fa('0x21')][_0x55fa('0x1b')]()[_0x55fa('0x16')](function(_0x201146){return db[_0x55fa('0x21')][_0x55fa('0x59')]({'where':{'id':_0x49e574[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x55fa('0x5a')],'as':_0x55fa('0x5b'),'attributes':['id',_0x55fa('0x19'),'color'],'required':_0x49e574[_0x55fa('0x1d')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x55fa('0x5c'),'where':{'CmContactId':_0x49e574[_0x55fa('0x22')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x55fa('0x5d')}]}],'order':[db[_0x55fa('0x5e')]['literal'](_0x55fa('0x5f'))],'attributes':_[_0x55fa('0x24')](_0x201146)});})[_0x55fa('0x16')](function(_0x301299){if(!_[_0x55fa('0x4d')](_0x301299)){_0x28a3ea=_0x301299['get']({'plain':!![]});var _0xb3433c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x301299&&_0x301299[_0x55fa('0x54')]){if(_0x301299[_0x55fa('0x54')]){_0xb3433c[_0x55fa('0x52')][_0x55fa('0x60')][_0x55fa('0x56')]({'ListId':{'$ne':_0x301299[_0x55fa('0x54')]}});}}return db[_0x55fa('0x61')][_0x55fa('0x1c')](_0xb3433c);}})['then'](function(_0x40455f){if(!_[_0x55fa('0x4d')](_0x40455f)){return _[_0x55fa('0x62')](_0x28a3ea,_[_0x55fa('0x63')](_0x40455f,function(_0x4305a8){return util[_0x55fa('0x64')]('cf_%d',_0x4305a8['id']);}));}})[_0x55fa('0x16')](handleEntityNotFound(_0x48826c,null))[_0x55fa('0x16')](respondWithResult(_0x48826c,null))[_0x55fa('0x1f')](handleError(_0x48826c,null));};exports[_0x55fa('0x15')]=function(_0x54aec7,_0x180d5d){var _0x55326d;if(_0x54aec7[_0x55fa('0x32')]['id']){delete _0x54aec7[_0x55fa('0x32')]['id'];}if(!_[_0x55fa('0x4d')](_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4e')])){var _0x43abd9=_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4e')];if(!_[_0x55fa('0x4d')](shared[_0x55fa('0x65')][_0x43abd9]))_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4f')]=shared[_0x55fa('0x65')][_0x43abd9][_0x55fa('0x4f')];}return db['CmContact'][_0x55fa('0x59')]({'where':{'id':_0x54aec7[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x180d5d,null))['then'](saveUpdates(_0x54aec7[_0x55fa('0x32')],null))[_0x55fa('0x16')](function(_0x4f1194){_0x55326d=_0x4f1194;var _0x16c9e7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4f1194&&_0x4f1194[_0x55fa('0x54')]){if(_0x4f1194[_0x55fa('0x54')]){_0x16c9e7['where'][_0x55fa('0x60')][_0x55fa('0x56')]({'ListId':{'$ne':_0x4f1194['ListId']}});}}return db[_0x55fa('0x61')][_0x55fa('0x1c')](_0x16c9e7);})[_0x55fa('0x16')](function(_0xcfbd10){if(_0xcfbd10){return _[_0x55fa('0x62')](_[_0x55fa('0x66')](_0x54aec7[_0x55fa('0x32')],function(_0x3f758c,_0x568ce5){return _[_0x55fa('0x26')](_0x568ce5,'cf_');}),_[_0x55fa('0x63')](_0xcfbd10,function(_0x57c9b7){return util[_0x55fa('0x64')]('cf_%d',_0x57c9b7['id']);}));}})[_0x55fa('0x16')](function(_0x198a5b){if(_0x198a5b&&!_['isEmpty'](_0x198a5b)){var _0x147429=squel['update']()[_0x55fa('0x67')](_0x55fa('0x68'))[_0x55fa('0x69')](_0x198a5b)['where'](_0x55fa('0x6a'),_0x54aec7[_0x55fa('0x22')]['id'])['toParam']();return db[_0x55fa('0x5e')][_0x55fa('0x1d')](_0x147429['text'],{'replacements':_0x147429[_0x55fa('0x2c')]});}})[_0x55fa('0x16')](function(){if(_0x54aec7['body'][_0x55fa('0x6b')]&&_0x55326d){return db[_0x55fa('0x6c')][_0x55fa('0x15')]({'phone':_0x54aec7[_0x55fa('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x55326d['id']}});}})[_0x55fa('0x16')](function(){return _0x55326d;})[_0x55fa('0x16')](respondWithResult(_0x180d5d,null))[_0x55fa('0x1f')](handleError(_0x180d5d,null));};exports[_0x55fa('0x6d')]=function(_0x729670,_0x5c3bbc){var _0x57d0fc={};var _0x25c5a9={};var _0x5b0f15;var _0x246040;return db[_0x55fa('0x21')][_0x55fa('0x6e')]({'where':{'id':_0x729670[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x5c3bbc,null))[_0x55fa('0x16')](function(_0x5b9dcd){if(_0x5b9dcd){_0x5b0f15=_0x5b9dcd;_0x25c5a9[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db[_0x55fa('0x5a')][_0x55fa('0x70')]);_0x25c5a9['query']=_[_0x55fa('0x24')](_0x729670['query']);_0x25c5a9[_0x55fa('0x71')]=_['intersection'](_0x25c5a9['model'],_0x25c5a9['query']);_0x57d0fc[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x25c5a9[_0x55fa('0x6f')],qs[_0x55fa('0x74')](_0x729670[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x57d0fc[_0x55fa('0x72')]=_0x57d0fc['attributes']['length']?_0x57d0fc[_0x55fa('0x72')]:_0x25c5a9['model'];_0x57d0fc[_0x55fa('0x75')]=qs['sort'](_0x729670[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x57d0fc[_0x55fa('0x52')]=qs[_0x55fa('0x71')](_[_0x55fa('0x77')](_0x729670[_0x55fa('0x1d')],_0x25c5a9[_0x55fa('0x71')]));if(_0x729670['query'][_0x55fa('0x78')]){_0x57d0fc[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x57d0fc[_0x55fa('0x52')],{'$or':_['map'](_0x57d0fc['attributes'],function(_0x4ce744){var _0x126c3f={};_0x126c3f[_0x4ce744]={'$like':'%'+_0x729670[_0x55fa('0x1d')]['filter']+'%'};return _0x126c3f;})});}_0x57d0fc=_[_0x55fa('0x31')]({},_0x57d0fc,_0x729670[_0x55fa('0x79')]);return _0x5b0f15[_0x55fa('0x6d')](_0x57d0fc);}})[_0x55fa('0x16')](function(_0x4cf8b8){if(_0x4cf8b8){_0x246040=_0x4cf8b8[_0x55fa('0x25')];if(!_0x729670[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0x57d0fc['limit']=qs[_0x55fa('0x11')](_0x729670['query'][_0x55fa('0x11')]);_0x57d0fc[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x729670['query'][_0x55fa('0xf')]);}return _0x5b0f15[_0x55fa('0x6d')](_0x57d0fc);}})[_0x55fa('0x16')](function(_0x353c7e){if(_0x353c7e){return _0x353c7e?{'count':_0x246040,'rows':_0x353c7e}:null;}})[_0x55fa('0x16')](respondWithResult(_0x5c3bbc,null))[_0x55fa('0x1f')](handleError(_0x5c3bbc,null));};exports[_0x55fa('0x7a')]=function(_0x1196b3,_0x591c97){if(_0x1196b3[_0x55fa('0x32')]['id']){delete _0x1196b3['body']['id'];}return db['CmContact']['findOne']({'where':{'id':_0x1196b3['params']['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x591c97,null))[_0x55fa('0x16')](function(_0x1ba218){if(_0x1ba218){return _0x1ba218[_0x55fa('0x7a')](_0x1196b3[_0x55fa('0x32')][_0x55fa('0x7b')]||[]);}return null;})[_0x55fa('0x16')](respondWithResult(_0x591c97,null))['catch'](handleError(_0x591c97,null));};exports[_0x55fa('0x7c')]=function(_0x55cafc,_0x44aa9e){var _0x5268ca=[];_0x5268ca[_0x55fa('0x56')](addAdditionalPhones(_0x55cafc[_0x55fa('0x32')]));Promise[_0x55fa('0x57')](_0x5268ca)['then'](function(){_0x5268ca=[];_0x5268ca[_0x55fa('0x56')](deleteCmHopperPhones(_0x55cafc['body']['id']));_0x5268ca[_0x55fa('0x56')](addCmHopperPhones(_0x55cafc[_0x55fa('0x32')]['id']));Promise[_0x55fa('0x57')](_0x5268ca)['then'](function(){return[0x1];})[_0x55fa('0x16')](respondWithResult(_0x44aa9e,null));});};function addAdditionalPhones(_0x45791d){var _0x57d0e7;return new Promise(function(_0x4fcc18){return db[_0x55fa('0x7d')]['destroy']({'where':{'CmContactId':_0x45791d['id']}})['then'](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x55fa('0x7e')]})[_0x55fa('0x16')](function(_0x36cc15){var _0x520b09=[];for(var _0x1581a3=0x0;_0x1581a3<_0x45791d['items'][_0x55fa('0x25')];_0x1581a3++){var _0x5d8140=_0x45791d[_0x55fa('0x7f')]?_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])?'':_0x45791d['item_types'][_0x1581a3]:_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]?_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]:'';var _0x33e8d3=_[_0x55fa('0x4d')](_0x45791d['items'][_0x1581a3][_0x55fa('0x82')])?'':_0x45791d[_0x55fa('0x80')][_0x1581a3]['description'];var _0x5c834d=_0x5d8140+':'+_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x6b')]+'§'+_0x33e8d3;if(_['isNil'](_0x57d0e7))_0x57d0e7=_0x5c834d;else _0x57d0e7+=';'+_0x5c834d;var _0x3a1e4d=null;var _0x5b4d89=null;if(_0x45791d[_0x55fa('0x7f')]){if(!_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])){_0x5b4d89=_[_0x55fa('0x59')](_0x36cc15,function(_0x346209){return _0x346209['id']===_0x45791d['item_types'][_0x1581a3];});if(!_['isNil'](_0x5b4d89)){_0x3a1e4d=_0x5b4d89['OrderBy'];}}}else{if(!_[_0x55fa('0x4d')](_0x45791d['items'][_0x1581a3])){_0x5b4d89=_[_0x55fa('0x59')](_0x36cc15,function(_0x3f6413){return _0x3f6413['id']===_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')];});if(!_[_0x55fa('0x4d')](_0x5b4d89)){_0x3a1e4d=_0x1581a3;}}}if(_['isNil'](_0x3a1e4d)){_0x3a1e4d=0x64;}_0x520b09[_0x55fa('0x56')](addAdditionalPhone(_0x45791d['id'],_0x45791d['items'][_0x1581a3]['phone'],_0x45791d[_0x55fa('0x7f')]?_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])?null:_0x45791d[_0x55fa('0x7f')][_0x1581a3]:_0x45791d['items'][_0x1581a3][_0x55fa('0x81')]?_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]:null,_0x3a1e4d,_0x33e8d3));}Promise[_0x55fa('0x57')](_0x520b09)[_0x55fa('0x16')](function(){db['CmContact'][_0x55fa('0x15')]({'AdditionalPhones':_0x57d0e7},{'where':{'id':_0x45791d['id']}})[_0x55fa('0x16')](function(){_0x4fcc18(0x1);});});});});});}function addAdditionalPhone(_0x410ff2,_0x57f712,_0x1ac234,_0x553430,_0x1ef9b6){return db[_0x55fa('0x7d')][_0x55fa('0x59')]({'where':{'CmContactId':_0x410ff2,'item':_0x57f712}})[_0x55fa('0x16')](function(_0x43167e){if(_0x43167e)logger[_0x55fa('0x2d')]('contact\x20phone\x20exists',_0x43167e);else{db[_0x55fa('0x7d')][_0x55fa('0x3b')]({'CmContactId':_0x410ff2,'item':_0x57f712,'ItemTypeId':_0x1ac234,'OrderBy':_0x553430,'ItemClass':'PHONE','description':_0x1ef9b6});}});}function deleteCmHopperPhones(_0x401e99){return new Promise(function(_0x8ce4d1){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x401e99}})['then'](function(_0x4b52af){db['CmHopperAdditionalPhone'][_0x55fa('0x20')]({'where':{'CmHopperId':{'$in':_[_0x55fa('0x63')](_0x4b52af,'id')}}});})[_0x55fa('0x16')](function(){_0x8ce4d1(0x1);});});}function addCmHopperPhones(_0x449f67){return new Promise(function(_0x9e8865){return db[_0x55fa('0x6c')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x449f67}})[_0x55fa('0x16')](function(_0x51a06b){var _0x196ca8=[];_['map'](_0x51a06b,function(_0x36ab00){_0x196ca8[_0x55fa('0x56')](createCmHopperPhone(_0x449f67,_0x36ab00['id']));});Promise['all'](_0x196ca8)[_0x55fa('0x16')](function(){_0x9e8865(0x1);});});});}function createCmHopperPhone(_0x27f52b,_0x28d775){return new Promise(function(_0x4b0bee){db['CmContactHasItem'][_0x55fa('0x1c')]({'raw':!![],'attributes':[_0x55fa('0x83'),_0x55fa('0x7e')],'where':{'CmContactId':_0x27f52b,'ItemClass':_0x55fa('0x84')},'include':[{'model':db[_0x55fa('0x85')],'attributes':[_0x55fa('0x7e')],'as':'ItemType'}],'order':['OrderBy',db[_0x55fa('0x5e')][_0x55fa('0x86')](_0x55fa('0x87'))]})['then'](function(_0x4c9ff8){var _0x22bb00=0x1;var _0x4aa9f0=_['map'](_0x4c9ff8,function(_0x46fa77){_0x46fa77[_0x55fa('0x88')]=_0x28d775;_0x46fa77['phone']=_0x46fa77[_0x55fa('0x83')];_0x46fa77[_0x55fa('0x7e')]=_0x22bb00;delete _0x46fa77['ItemType.OrderBy'];_0x22bb00=_0x22bb00+0x1;return _0x46fa77;});return db[_0x55fa('0x89')]['bulkCreate'](_0x4aa9f0,{});})[_0x55fa('0x16')](function(){_0x4b0bee(0x1);});});}function insertAdditionalPhones(_0x33078c,_0x1fd0db){return new Promise(function(_0x15e42b){var _0x4c7c87=[];for(var _0x275d0c=0x0;_0x275d0c<_0x1fd0db['length'];_0x275d0c++){var _0x2cf226=_0x1fd0db[_0x275d0c];_0x4c7c87[_0x55fa('0x56')](parseContactItemType(_0x2cf226));}Promise['all'](_0x4c7c87)[_0x55fa('0x16')](function(){var _0x4b9a17={'id':_0x33078c['id'],'items':_0x1fd0db};return addAdditionalPhones(_0x4b9a17)['then'](function(){return addCmHopperPhones(_0x33078c['id']);});})[_0x55fa('0x16')](function(){_0x15e42b(_0x33078c);});});}function parseContactItemType(_0x5763e6){return new Promise(function(_0x510130){if(_0x5763e6[_0x55fa('0x30')](_0x55fa('0x81'))){_0x510130(_0x5763e6);}else{return db[_0x55fa('0x85')]['find']({'where':{'name':_0x5763e6[_0x55fa('0x5d')]}})['then'](function(_0x5516f9){if(_['isNil'](_0x5516f9))_0x5763e6[_0x55fa('0x81')]=null;else _0x5763e6[_0x55fa('0x81')]=_0x5516f9['id'];_0x510130(_0x5763e6);});}});}exports['getAdditionalPhones']=function(_0x340841,_0x56dbc5){return db[_0x55fa('0x7d')][_0x55fa('0x1c')]({'raw':!![],'where':{'CmContactId':_0x340841[_0x55fa('0x22')]['id'],'ItemClass':_0x55fa('0x84')},'include':[{'model':db['ContactItemType'],'as':_0x55fa('0x5d')}],'order':[['OrderBy'],[db[_0x55fa('0x5e')][_0x55fa('0x86')](_0x55fa('0x87'))]]})[_0x55fa('0x16')](function(_0x345352){return _0x345352;})[_0x55fa('0x16')](respondWithResult(_0x56dbc5,null))[_0x55fa('0x1f')](handleError(_0x56dbc5,null));};exports['duplicateAdditionalPhones']=function(_0x531a8f,_0xdbb0e7){return db[_0x55fa('0x7d')][_0x55fa('0x1c')]({'raw':!![],'where':{'CmContactId':_0x531a8f[_0x55fa('0x32')][_0x55fa('0x8a')]}})[_0x55fa('0x16')](function(_0x379542){var _0x492dc6=_[_0x55fa('0x63')](_0x379542,function(_0x4825ac){_0x4825ac[_0x55fa('0x8b')]=_0x531a8f['body'][_0x55fa('0x8c')];return _0x4825ac;});return db[_0x55fa('0x7d')][_0x55fa('0x8d')](_0x492dc6,{});})[_0x55fa('0x16')](function(){return addCmHopperPhones(_0x531a8f[_0x55fa('0x32')][_0x55fa('0x8c')]);})[_0x55fa('0x16')](function(){return['ok'];})[_0x55fa('0x16')](respondWithResult(_0xdbb0e7,null))[_0x55fa('0x1f')](handleError(_0xdbb0e7,null));};exports[_0x55fa('0x8e')]=function(_0x3aeb91,_0x12e59e){var _0xb6a6c9=[];_0xb6a6c9['push'](createCmHopperPhone(_0x3aeb91['body']['id'],_0x3aeb91[_0x55fa('0x32')][_0x55fa('0x8f')]));Promise[_0x55fa('0x57')](_0xb6a6c9)['then'](function(){return[0x1];})['then'](respondWithResult(_0x12e59e,null));};exports[_0x55fa('0x90')]=function(_0x21461d,_0x4a78a3){var _0x5222ae={'raw':![],'where':{}};var _0x3a88ab={};var _0x4211c7={'count':0x0,'rows':[]};return db[_0x55fa('0x21')][_0x55fa('0x6e')]({'where':{'id':_0x21461d['params']['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x4a78a3,null))['then'](function(_0x46e970){if(_0x46e970){_0x3a88ab[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db[_0x55fa('0x6c')][_0x55fa('0x70')]);_0x3a88ab[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x21461d['query']);_0x3a88ab[_0x55fa('0x71')]=_[_0x55fa('0x73')](_0x3a88ab[_0x55fa('0x6f')],_0x3a88ab[_0x55fa('0x1d')]);_0x5222ae[_0x55fa('0x72')]=_['intersection'](_0x3a88ab['model'],qs[_0x55fa('0x74')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x5222ae[_0x55fa('0x72')]=_0x5222ae[_0x55fa('0x72')][_0x55fa('0x25')]?_0x5222ae[_0x55fa('0x72')]:_0x3a88ab[_0x55fa('0x6f')];if(!_0x21461d[_0x55fa('0x1d')]['hasOwnProperty'](_0x55fa('0x91'))){_0x5222ae[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x11')]);_0x5222ae[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0x5222ae[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x5222ae[_0x55fa('0x52')]=qs['filters'](_['pick'](_0x21461d['query'],_0x3a88ab[_0x55fa('0x71')]));_0x5222ae[_0x55fa('0x52')][_0x55fa('0x92')]=_0x46e970['id'];if(_0x21461d[_0x55fa('0x1d')]['filter']){_0x5222ae[_0x55fa('0x52')]=_['merge'](_0x5222ae[_0x55fa('0x52')],{'$or':_[_0x55fa('0x63')](_0x5222ae[_0x55fa('0x72')],function(_0x49b826){var _0xececbe={};_0xececbe[_0x49b826]={'$like':'%'+_0x21461d[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0xececbe;})});}_0x5222ae=_[_0x55fa('0x31')]({},_0x5222ae,_0x21461d[_0x55fa('0x79')]);return db[_0x55fa('0x6c')][_0x55fa('0x12')]({'where':_0x5222ae[_0x55fa('0x52')]})[_0x55fa('0x16')](function(_0x521ea2){_0x4211c7[_0x55fa('0x12')]=_0x521ea2;if(_0x21461d['query'][_0x55fa('0x93')]){_0x5222ae[_0x55fa('0x94')]=[{'all':!![]}];}return db['CmHopper'][_0x55fa('0x1c')](_0x5222ae);})[_0x55fa('0x16')](function(_0x3567d2){_0x4211c7[_0x55fa('0x95')]=_0x3567d2;return _0x4211c7;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x4a78a3,_0x5222ae))[_0x55fa('0x1f')](handleError(_0x4a78a3,null));};exports['getHopperHistories']=function(_0x5b2705,_0x16a177){var _0x28f7f7={'raw':!![],'where':{}};var _0x274818={};var _0x5cd28f={'count':0x0,'rows':[]};return db[_0x55fa('0x21')]['findOne']({'where':{'id':_0x5b2705[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x16a177,null))['then'](function(_0x37e7a4){if(_0x37e7a4){_0x274818[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['CmHopperHistory']['rawAttributes']);_0x274818['query']=_['keys'](_0x5b2705['query']);_0x274818[_0x55fa('0x71')]=_[_0x55fa('0x73')](_0x274818[_0x55fa('0x6f')],_0x274818[_0x55fa('0x1d')]);_0x28f7f7[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x274818['model'],qs['fields'](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x28f7f7[_0x55fa('0x72')]=_0x28f7f7['attributes'][_0x55fa('0x25')]?_0x28f7f7[_0x55fa('0x72')]:_0x274818[_0x55fa('0x6f')];if(!_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0x28f7f7[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x5b2705['query'][_0x55fa('0x11')]);_0x28f7f7[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0x28f7f7[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x28f7f7['where']=qs[_0x55fa('0x71')](_[_0x55fa('0x77')](_0x5b2705[_0x55fa('0x1d')],_0x274818[_0x55fa('0x71')]));_0x28f7f7[_0x55fa('0x52')]['ContactId']=_0x37e7a4['id'];if(_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x78')]){_0x28f7f7[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x28f7f7['where'],{'$or':_['map'](_0x28f7f7['attributes'],function(_0x2c1cd9){var _0x2b938b={};_0x2b938b[_0x2c1cd9]={'$like':'%'+_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0x2b938b;})});}_0x28f7f7=_[_0x55fa('0x31')]({},_0x28f7f7,_0x5b2705[_0x55fa('0x79')]);return db['CmHopperHistory'][_0x55fa('0x12')]({'where':_0x28f7f7[_0x55fa('0x52')]})[_0x55fa('0x16')](function(_0x2151ca){_0x5cd28f[_0x55fa('0x12')]=_0x2151ca;if(_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x93')]){_0x28f7f7[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x46')][_0x55fa('0x1c')](_0x28f7f7);})[_0x55fa('0x16')](function(_0x3d4242){_0x5cd28f[_0x55fa('0x95')]=_0x3d4242;return _0x5cd28f;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x16a177,_0x28f7f7))[_0x55fa('0x1f')](handleError(_0x16a177,null));};exports[_0x55fa('0x96')]=function(_0x53bd4a,_0x4f054a){var _0x1a99e1={'raw':!![],'where':{}};var _0x1dc8f0={};var _0x1d27b6={'count':0x0,'rows':[]};return db[_0x55fa('0x21')]['findOne']({'where':{'id':_0x53bd4a[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x4f054a,null))[_0x55fa('0x16')](function(_0x15e94e){if(_0x15e94e){_0x1dc8f0[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['CmHopperFinal'][_0x55fa('0x70')]);_0x1dc8f0[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x53bd4a[_0x55fa('0x1d')]);_0x1dc8f0['filters']=_[_0x55fa('0x73')](_0x1dc8f0[_0x55fa('0x6f')],_0x1dc8f0[_0x55fa('0x1d')]);_0x1a99e1[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x1dc8f0[_0x55fa('0x6f')],qs[_0x55fa('0x74')](_0x53bd4a['query'][_0x55fa('0x74')]));_0x1a99e1[_0x55fa('0x72')]=_0x1a99e1[_0x55fa('0x72')][_0x55fa('0x25')]?_0x1a99e1[_0x55fa('0x72')]:_0x1dc8f0[_0x55fa('0x6f')];if(!_0x53bd4a['query'][_0x55fa('0x30')]('nolimit')){_0x1a99e1['limit']=qs[_0x55fa('0x11')](_0x53bd4a['query'][_0x55fa('0x11')]);_0x1a99e1['offset']=qs[_0x55fa('0xf')](_0x53bd4a['query']['offset']);}_0x1a99e1[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x1a99e1[_0x55fa('0x52')]=qs['filters'](_['pick'](_0x53bd4a[_0x55fa('0x1d')],_0x1dc8f0[_0x55fa('0x71')]));_0x1a99e1[_0x55fa('0x52')][_0x55fa('0x92')]=_0x15e94e['id'];if(_0x53bd4a['query'][_0x55fa('0x78')]){_0x1a99e1[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x1a99e1['where'],{'$or':_['map'](_0x1a99e1[_0x55fa('0x72')],function(_0x2555d0){var _0xcd2749={};_0xcd2749[_0x2555d0]={'$like':'%'+_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0xcd2749;})});}_0x1a99e1=_[_0x55fa('0x31')]({},_0x1a99e1,_0x53bd4a[_0x55fa('0x79')]);return db[_0x55fa('0x45')][_0x55fa('0x12')]({'where':_0x1a99e1[_0x55fa('0x52')]})['then'](function(_0x362e3c){_0x1d27b6[_0x55fa('0x12')]=_0x362e3c;if(_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x93')]){_0x1a99e1[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x45')]['findAll'](_0x1a99e1);})[_0x55fa('0x16')](function(_0x3a8ec4){_0x1d27b6[_0x55fa('0x95')]=_0x3a8ec4;return _0x1d27b6;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x4f054a,_0x1a99e1))['catch'](handleError(_0x4f054a,null));};exports[_0x55fa('0x97')]=function(_0x1ed98f,_0x2c78b9){var _0xff0bba={'raw':!![],'where':{}};var _0x177b47={};var _0x56f160={'count':0x0,'rows':[]};return db['CmContact'][_0x55fa('0x6e')]({'where':{'id':_0x1ed98f[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x2c78b9,null))['then'](function(_0x59d7ce){if(_0x59d7ce){_0x177b47[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['JscriptySessionReport'][_0x55fa('0x70')]);_0x177b47[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x1ed98f[_0x55fa('0x1d')]);_0x177b47['filters']=_['intersection'](_0x177b47[_0x55fa('0x6f')],_0x177b47[_0x55fa('0x1d')]);_0xff0bba[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x177b47['model'],qs[_0x55fa('0x74')](_0x1ed98f['query'][_0x55fa('0x74')]));_0xff0bba['attributes']=_0xff0bba[_0x55fa('0x72')][_0x55fa('0x25')]?_0xff0bba[_0x55fa('0x72')]:_0x177b47[_0x55fa('0x6f')];if(!_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0xff0bba[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x11')]);_0xff0bba[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0xff0bba[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x76')]);_0xff0bba['where']=qs[_0x55fa('0x71')](_['pick'](_0x1ed98f[_0x55fa('0x1d')],_0x177b47[_0x55fa('0x71')]));_0xff0bba[_0x55fa('0x52')][_0x55fa('0x92')]=_0x59d7ce['id'];if(_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x78')]){_0xff0bba[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0xff0bba['where'],{'$or':_[_0x55fa('0x63')](_0xff0bba[_0x55fa('0x72')],function(_0x2f8869){var _0x4008b4={};_0x4008b4[_0x2f8869]={'$like':'%'+_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0x4008b4;})});}_0xff0bba=_[_0x55fa('0x31')]({},_0xff0bba,_0x1ed98f['options']);return db[_0x55fa('0x98')][_0x55fa('0x12')]({'where':_0xff0bba[_0x55fa('0x52')]})['then'](function(_0x22b792){_0x56f160[_0x55fa('0x12')]=_0x22b792;if(_0x1ed98f[_0x55fa('0x1d')]['includeAll']){_0xff0bba[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x98')]['findAll'](_0xff0bba);})[_0x55fa('0x16')](function(_0x3a14ab){_0x56f160[_0x55fa('0x95')]=_0x3a14ab;return _0x56f160;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x2c78b9,_0xff0bba))[_0x55fa('0x1f')](handleError(_0x2c78b9,null));};exports[_0x55fa('0x99')]=function(_0x18a86a,_0x3b3ac9){try{if(!_0x18a86a['body']['ListId']){throw new Error(_0x55fa('0x9a'));}if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x9b')]){throw new Error(_0x55fa('0x9c'));}if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x9d')]){throw new Error(_0x55fa('0x9e'));}if(!_0x18a86a[_0x55fa('0x32')]['socket_timestamp']){throw new Error(_0x55fa('0x9f'));}var _0x4b720a=_0x18a86a['body'][_0x55fa('0x9b')][_0x55fa('0xa0')](',');var _0x3b4f3f=_0x18a86a['body'][_0x55fa('0x9d')]['split'](',');if(!_0x4b720a[_0x55fa('0x25')]||!_0x3b4f3f[_0x55fa('0x25')]||_0x4b720a[_0x55fa('0x25')]!==_0x3b4f3f[_0x55fa('0x25')]){throw new Error(_0x55fa('0xa1'));}_0x18a86a[_0x55fa('0x32')][_0x55fa('0x74')]=_[_0x55fa('0xa2')](_0x4b720a,_0x3b4f3f);if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x74')]['phone']){throw new Error(_0x55fa('0xa3'));}if(!_0x18a86a[_0x55fa('0x32')]['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x42b6c8=path[_0x55fa('0x36')](config[_0x55fa('0xa4')],'server/files/tmp',_0x18a86a[_0x55fa('0xa5')][_0x55fa('0xa6')]);fs[_0x55fa('0xa7')](_0x42b6c8,parseInt(_0x55fa('0xa8'),0x8));var _0xb0b63d=require(_0x55fa('0xa9'))[_0x55fa('0xaa')](path['join'](__dirname,_0x55fa('0xab')),[_0x42b6c8,_0x18a86a['body']['binding_keys'],_0x18a86a[_0x55fa('0x32')]['binding_values'],_0x18a86a[_0x55fa('0x32')][_0x55fa('0x54')],_0x18a86a['body'][_0x55fa('0xac')],_0x18a86a[_0x55fa('0x32')][_0x55fa('0x51')],_0x18a86a[_0x55fa('0x32')][_0x55fa('0xad')]]);return _0x3b3ac9[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0xb0b63d[_0x55fa('0xae')]});}catch(_0x5596b7){return _0x3b3ac9[_0x55fa('0x13')](0x1f4)[_0x55fa('0xaf')](_0x5596b7);}};exports['upload']=function(_0x349d3d,_0x29630b){var _0x584cac=fs['createReadStream'](_0x349d3d[_0x55fa('0xa5')][_0x55fa('0x2')]);Papa['parse'](_0x584cac,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3f036a){return _0x29630b[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'file':_0x349d3d[_0x55fa('0xa5')],'fields':_0x3f036a[_0x55fa('0xb0')][_0x55fa('0x74')]});}});};exports['import']=function(_0x547648,_0x38aa33){return db[_0x55fa('0xb1')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x55fa('0x16')](function(_0x320aa2){var _0x2d5124=![];if(!_0x547648[_0x55fa('0x32')][_0x55fa('0x54')]){throw new Error(_0x55fa('0x9a'));}if(!_0x547648[_0x55fa('0x32')]['binding'][_0x55fa('0x6b')]){throw new Error(_0x55fa('0xa3'));}if(!_0x547648[_0x55fa('0x32')][_0x55fa('0xb2')][_0x55fa('0xb3')]){throw new Error(_0x55fa('0xb4'));}if(!_0x547648[_0x55fa('0x32')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x22b684=require('child_process')[_0x55fa('0xaa')](path[_0x55fa('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x547648['params']['id'],JSON[_0x55fa('0xb5')](_0x547648['body']),JSON[_0x55fa('0xb5')](_0x320aa2)]);_0x22b684['on'](_0x55fa('0xb6'),function(){_0x2d5124=!![];return _0x38aa33[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'message':_0x55fa('0xb7'),'pid':_0x22b684['pid']});});_0x22b684['on'](_0x55fa('0xb8'),function(_0x9c6ac4){if(_0x9c6ac4&&!_0x2d5124){return _0x38aa33[_0x55fa('0x13')](0x1f4)[_0x55fa('0xe')]({'message':_0x55fa('0xb9'),'pid':_0x22b684[_0x55fa('0xae')]});}});})[_0x55fa('0x1f')](handleError(_0x38aa33,null));};exports['importUpdates']=function(_0xc23580,_0x47d0c3){return db[_0x55fa('0xb1')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x55fa('0xba')}})[_0x55fa('0x16')](function(_0x1c5a1f){var _0x5c1293=![];if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0x54')]){throw new Error('No\x20ListId\x20specified');}if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0xb2')]['phone']){throw new Error(_0x55fa('0xa3'));}if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0xb2')][_0x55fa('0xb3')]){throw new Error(_0x55fa('0xb4'));}if(!_0xc23580['body'][_0x55fa('0xad')]){throw new Error(_0x55fa('0x9f'));}var _0x5c1ccc=require('child_process')[_0x55fa('0xaa')](path[_0x55fa('0x36')](__dirname,_0x55fa('0xbb')),[_0xc23580['params']['id'],JSON[_0x55fa('0xb5')](_0xc23580['body']),JSON[_0x55fa('0xb5')](_0x1c5a1f)]);_0x5c1ccc['on'](_0x55fa('0xb6'),function(){_0x5c1293=!![];return _0x47d0c3['status'](0xc8)[_0x55fa('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x5c1ccc[_0x55fa('0xae')]});});_0x5c1ccc['on']('exit',function(_0x2b50ee){if(_0x2b50ee&&!_0x5c1293){return _0x47d0c3[_0x55fa('0x13')](0x1f4)[_0x55fa('0xe')]({'message':'error\x20child\x20process','pid':_0x5c1ccc['pid']});}});})[_0x55fa('0x1f')](handleError(_0x47d0c3,null));};exports[_0x55fa('0xbc')]=function(_0x3a2755,_0x4726e6){var _0x23a1a8=['mail','chat',_0x55fa('0xbd'),'openchannel',_0x55fa('0xbe'),_0x55fa('0xbf'),'voice'];var _0x5d5b01={'offset':0x0,'order':qs[_0x55fa('0x76')]('-createdAt')},_0x566c83={'count':0x0,'rows':[]};Promise[_0x55fa('0xc0')]()['then'](function(){if(_0x3a2755[_0x55fa('0x1d')]['channel']){if(!_[_0x55fa('0xc1')](_0x23a1a8,_0x3a2755[_0x55fa('0x1d')]['channel'][_0x55fa('0xc2')]())){throw new Error(_0x55fa('0xc3'));}_0x23a1a8=[_0x3a2755[_0x55fa('0x1d')]['channel'][_0x55fa('0xc2')]()];}if(_0x3a2755['query'][_0x55fa('0xc4')]){try{var _0x3f5865=JSON[_0x55fa('0xc5')](_0x3a2755[_0x55fa('0x1d')]['range']);if(!moment(_0x3f5865['from'])[_0x55fa('0xc6')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3f5865['to'])['isValid']()){throw new Error(_0x55fa('0xc7'));}}catch(_0x5326bf){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x3a2755[_0x55fa('0x1d')][_0x55fa('0x30')](_0x55fa('0x91'))){_0x5d5b01[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x3a2755['query'][_0x55fa('0x11')]||0xa);_0x5d5b01[_0x55fa('0xf')]=qs['offset'](_0x3a2755['query'][_0x55fa('0xf')]);}var _0x320924=_0x23a1a8[_0x55fa('0x63')](function(_0x31aaef){if(_0x31aaef===_0x55fa('0xc8')){var _0x904bae={'attributes':['id','uniqueid','type',_0x55fa('0xc9'),_0x55fa('0xca'),_0x55fa('0xcb'),_0x55fa('0xcc'),'endtime',_0x55fa('0xcd'),'note','createdAt','userDisposition',_0x55fa('0xce'),'userThirdDisposition',_0x55fa('0xcf')],'where':{'ContactId':_0x3a2755[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x55fa('0xb1')],'as':_0x55fa('0xb1'),'attributes':['id',_0x55fa('0x19'),_0x55fa('0xd0'),'alias']}],'order':[[_0x55fa('0xd1'),_0x55fa('0xd2')]]};if(_0x3a2755['query'][_0x55fa('0xc4')]){_0x904bae[_0x55fa('0x52')][_0x55fa('0xd1')]={'$gte':_0x3f5865[_0x55fa('0x38')],'$lte':_0x3f5865['to']};}return db['VoiceCallReport'][_0x55fa('0xd3')](_0x904bae)[_0x55fa('0x16')](function(_0x369eb9){_0x566c83[_0x55fa('0x12')]+=_0x369eb9[_0x55fa('0x12')];return _[_0x55fa('0x63')](_0x369eb9[_0x55fa('0x95')],function(_0x589efb){var _0x4365f9=_0x589efb[_0x55fa('0x33')]({'plain':!![]});_0x4365f9[_0x55fa('0xd4')]=_0x31aaef;if(_0x4365f9[_0x55fa('0xb1')]){_0x4365f9[_0x55fa('0xb1')]={'id':_0x4365f9[_0x55fa('0xb1')]['id'],'name':_0x4365f9[_0x55fa('0xb1')][_0x55fa('0x19')],'fullname':_0x4365f9[_0x55fa('0xb1')][_0x55fa('0xd0')],'alias':_0x4365f9[_0x55fa('0xb1')]['alias']};}return _0x4365f9;});});}else{var _0x29fc64=_[_0x55fa('0xd5')](_0x31aaef)+(_0x31aaef===_0x55fa('0xd6')?_0x55fa('0xd7'):_0x55fa('0xd8'));var _0x431a61={'attributes':['id','closed','closedAt',_0x55fa('0xd1'),_0x55fa('0xd9'),_0x55fa('0xda'),_0x55fa('0xdb'),_0x55fa('0xdc'),_0x55fa('0xcf'),_0x29fc64+'Id'],'where':{'ContactId':_0x3a2755[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x29fc64],'as':_0x55fa('0xd8'),'attributes':['id','name',_0x55fa('0xdd')]},{'model':db[_0x55fa('0xb1')],'as':'Owner','attributes':['id','name',_0x55fa('0xd0')]},{'model':db[_0x55fa('0x5a')],'as':_0x55fa('0x5b'),'attributes':['id','name',_0x55fa('0xde')],'through':{'attributes':[]}}],'order':[[_0x55fa('0xd1'),_0x55fa('0xd2')]]};if(_0x3a2755['query'][_0x55fa('0xc4')]){_0x431a61['where']['createdAt']={'$gte':_0x3f5865[_0x55fa('0x38')],'$lte':_0x3f5865['to']};}switch(_0x31aaef){case _0x55fa('0xd6'):_0x431a61[_0x55fa('0x72')][_0x55fa('0x56')]('browserName',_0x55fa('0xdf'),'customerPort',_0x55fa('0xe0'),'osName','ratingMessage','ratingType',_0x55fa('0xe1'),_0x55fa('0xe2'));break;case'mail':_0x431a61['attributes'][_0x55fa('0x56')](_0x55fa('0xe3'),_0x55fa('0xe4'));break;case _0x55fa('0xe5'):_0x431a61[_0x55fa('0x72')]['push'](_0x55fa('0xe6'),_0x55fa('0xe7'));break;}return db[_[_0x55fa('0xd5')](_0x31aaef)+_0x55fa('0xe8')]['findAndCountAll'](_0x431a61)[_0x55fa('0x16')](function(_0xbe29ed){_0x566c83[_0x55fa('0x12')]+=_0xbe29ed[_0x55fa('0x12')];return _[_0x55fa('0x63')](_0xbe29ed[_0x55fa('0x95')],function(_0x316681){var _0xa76463=_0x316681['get']({'plain':!![]});_0xa76463['channel']=_0x31aaef;if(_0xa76463[_0x55fa('0xe9')]){_0xa76463['Owner']={'id':_0xa76463[_0x55fa('0xe9')]['id'],'name':_0xa76463[_0x55fa('0xe9')]['name'],'fullname':_0xa76463[_0x55fa('0xe9')][_0x55fa('0xd0')]};}return _0xa76463;});});}});return Promise['all'](_0x320924);})[_0x55fa('0x16')](function(_0x4d3c6c){return _(_0x4d3c6c)[_0x55fa('0xea')]()['sortBy'](_0x55fa('0xd1'))[_0x55fa('0xeb')]()['value']();})[_0x55fa('0x16')](function(_0x18ca69){_0x566c83[_0x55fa('0x95')]=_0x5d5b01['limit']?_0x18ca69[_0x55fa('0xec')](_0x5d5b01[_0x55fa('0xf')],_0x5d5b01[_0x55fa('0xf')]+_0x5d5b01[_0x55fa('0x11')]):_0x18ca69;return _0x566c83;})[_0x55fa('0x16')](respondWithFilteredResult(_0x4726e6,_0x5d5b01))[_0x55fa('0x1f')](handleError(_0x4726e6,null));}; \ No newline at end of file +var _0xd566=['nolimit','setTags','ids','setAdditionalPhones','all','OrderBy','item_types','items','ItemTypeId','description','CmHopper','PHONE','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','ContactId','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','No\x20association\x20keys\x20specified!','socket_timestamp','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','path','parse','import','User','agent','No\x20ListId\x20specified','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','binding','../../components/import/cm/csvUpdates','getJourney','mail','openchannel','fax','whatsapp','voice','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','createdAt','DESC','findAndCountAll','startCase','chat','Website','Account','closed','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','referer','subject','substatus','threadId','Interaction','flatten','sortBy','reverse','slice','util','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','error','stack','name','send','index','describe','findAll','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','query','CmCustomField','custom','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','CmHopperBlack','create','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','WhatsappInteraction','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','cf_%d','omit','pickBy','map','format','isEmpty','table','cm_contacts','setFields','toParam','values','phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','pick','filter','options'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd566,0x17a));var _0x6d56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd566[_0x19950b];return _0x3c6b41;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x6d56('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x6d56('0x1'));var squel=require('squel');var Papa=require(_0x6d56('0x2'));var Redis=require(_0x6d56('0x3'));var contacts=require(_0x6d56('0x4'));var qs=require(_0x6d56('0x5'));var logger=require('../../config/logger')(_0x6d56('0x6'));var config=require(_0x6d56('0x7'));var shared=require(_0x6d56('0x8'));var db=require('../../mysqldb')['db'];config[_0x6d56('0x9')]=_[_0x6d56('0xa')](config['redis'],{'host':_0x6d56('0xb'),'port':0x18eb});var socket=require(_0x6d56('0xc'))(new Redis(config[_0x6d56('0x9')]));require(_0x6d56('0xd'))[_0x6d56('0xe')](socket);function respondWithResult(_0x2262f7,_0x2f671d){_0x2f671d=_0x2f671d||0xc8;return function(_0x5db4cc){if(_0x5db4cc){return _0x2262f7['status'](_0x2f671d)[_0x6d56('0xf')](_0x5db4cc);}};}function respondWithFilteredResult(_0xa45411,_0x22dc36){return function(_0xdc55da){if(_0xdc55da){var _0x49790e=typeof _0x22dc36[_0x6d56('0x10')]===_0x6d56('0x11')&&typeof _0x22dc36[_0x6d56('0x12')]===_0x6d56('0x11');var _0x513e5c=_0xdc55da[_0x6d56('0x13')];var _0x3eac9b=_0x49790e?0x0:_0x22dc36[_0x6d56('0x10')];var _0x37f746=_0x49790e?_0xdc55da['count']:_0x22dc36[_0x6d56('0x10')]+_0x22dc36['limit'];var _0x45f160;if(_0x37f746>=_0x513e5c){_0x37f746=_0x513e5c;_0x45f160=0xc8;}else{_0x45f160=0xce;}_0xa45411[_0x6d56('0x14')](_0x45f160);return _0xa45411[_0x6d56('0x15')](_0x6d56('0x16'),_0x3eac9b+'-'+_0x37f746+'/'+_0x513e5c)[_0x6d56('0xf')](_0xdc55da);}return null;};}function saveUpdates(_0x3f6e91){return function(_0x189136){if(_0x189136){return _0x189136[_0x6d56('0x17')](_0x3f6e91)[_0x6d56('0x18')](function(_0x1d0a08){return _0x1d0a08;});}return null;};}function removeEntity(_0x463318){return function(_0x595ea7){if(_0x595ea7){return _0x595ea7[_0x6d56('0x19')]()['then'](function(){_0x463318[_0x6d56('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f31b4){return function(_0x15231c){if(!_0x15231c){_0x2f31b4['sendStatus'](0x194);}return _0x15231c;};}function handleError(_0x28f022,_0x4881e2){_0x4881e2=_0x4881e2||0x1f4;return function(_0x1ee869){logger[_0x6d56('0x1a')](_0x1ee869[_0x6d56('0x1b')]);if(_0x1ee869[_0x6d56('0x1c')]){delete _0x1ee869[_0x6d56('0x1c')];}_0x28f022['status'](_0x4881e2)[_0x6d56('0x1d')](_0x1ee869);};}exports[_0x6d56('0x1e')]=function(_0x43e820,_0x24e411){var _0x5dde8d={};return contacts[_0x6d56('0x1f')]()[_0x6d56('0x18')](function(_0x41542f){_0x5dde8d=qs['getOptions'](_0x41542f,_0x43e820);return contacts[_0x6d56('0x20')](_0x43e820['query'],_0x43e820['user'],_0x5dde8d,_0x41542f);})[_0x6d56('0x18')](respondWithFilteredResult(_0x24e411,_0x5dde8d))[_0x6d56('0x21')](handleError(_0x24e411,null));};exports[_0x6d56('0x19')]=function(_0x29cf62,_0x1fd712){return db[_0x6d56('0x22')][_0x6d56('0x23')]({'where':{'id':_0x29cf62[_0x6d56('0x24')]['id']}})['then'](handleEntityNotFound(_0x1fd712,null))[_0x6d56('0x18')](removeEntity(_0x1fd712,null))[_0x6d56('0x21')](handleError(_0x1fd712,null));};exports[_0x6d56('0x1f')]=function(_0x3a1b85,_0x46d85b){return db['CmContact']['describe']()['then'](function(_0x491470){delete _0x491470[_0x6d56('0x25')];for(var _0x115fa8=0x0;_0x115fa80x0){return new Promise(function(_0x4425ee){var _0x23ef3d=[];for(var _0x5becf6=0x0;_0x5becf6<_0x268285[_0x6d56('0x27')];_0x5becf6++){_0x23ef3d['push'](insertAdditionalPhones(_0x268285[_0x5becf6]['contact'],_0x268285[_0x5becf6][_0x6d56('0x50')]));}Promise['all'](_0x23ef3d)['then'](function(){_0x4425ee(0x1);});})[_0x6d56('0x18')](function(){return{'success':_0x3498f3,'failure':_0x13f079,'duplicates':_0x45f57b};});}else{return{'success':_0x3498f3,'failure':_0x13f079,'duplicates':_0x45f57b};}}})[_0x6d56('0x18')](respondWithResult(_0x2c8f01,0xc9))[_0x6d56('0x21')](handleError(_0x2c8f01,null));};exports[_0x6d56('0x5a')]=function(_0x2fc4fc,_0x6f0d02){var _0x6e359b;return db[_0x6d56('0x22')][_0x6d56('0x1f')]()[_0x6d56('0x18')](function(_0x81fa3d){return db['CmContact'][_0x6d56('0x23')]({'where':{'id':_0x2fc4fc[_0x6d56('0x24')]['id']},'include':[{'model':db[_0x6d56('0x5b')],'as':_0x6d56('0x5c'),'attributes':['id','name',_0x6d56('0x5d')],'required':_0x2fc4fc['query'][_0x6d56('0x5e')]?!![]:![]},{'model':db[_0x6d56('0x5f')],'as':_0x6d56('0x60'),'where':{'CmContactId':_0x2fc4fc[_0x6d56('0x24')]['id']},'required':![],'include':[{'model':db[_0x6d56('0x61')],'as':_0x6d56('0x62')}]}],'order':[db[_0x6d56('0x63')][_0x6d56('0x64')](_0x6d56('0x65'))],'attributes':_[_0x6d56('0x26')](_0x81fa3d)});})['then'](function(_0x3f22a5){if(!_[_0x6d56('0x4c')](_0x3f22a5)){_0x6e359b=_0x3f22a5['get']({'plain':!![]});var _0x5dd593={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3f22a5&&_0x3f22a5[_0x6d56('0x56')]){if(_0x3f22a5[_0x6d56('0x56')]){_0x5dd593[_0x6d56('0x54')][_0x6d56('0x66')]['push']({'ListId':{'$ne':_0x3f22a5[_0x6d56('0x56')]}});}}return db[_0x6d56('0x2e')][_0x6d56('0x20')](_0x5dd593);}})['then'](function(_0xfb9e36){if(!_[_0x6d56('0x4c')](_0xfb9e36)){return _['omit'](_0x6e359b,_['map'](_0xfb9e36,function(_0x4e4e14){return util['format'](_0x6d56('0x67'),_0x4e4e14['id']);}));}})[_0x6d56('0x18')](handleEntityNotFound(_0x6f0d02,null))[_0x6d56('0x18')](respondWithResult(_0x6f0d02,null))['catch'](handleError(_0x6f0d02,null));};exports[_0x6d56('0x17')]=function(_0x5c1c6a,_0x4abf1a){var _0x24f28d;if(_0x5c1c6a[_0x6d56('0x34')]['id']){delete _0x5c1c6a[_0x6d56('0x34')]['id'];}if(!_[_0x6d56('0x4c')](_0x5c1c6a[_0x6d56('0x34')]['dialTimezone'])){var _0x248e5b=_0x5c1c6a[_0x6d56('0x34')][_0x6d56('0x4d')];if(!_['isNil'](shared[_0x6d56('0x4e')][_0x248e5b]))_0x5c1c6a[_0x6d56('0x34')][_0x6d56('0x4f')]=shared['timezones'][_0x248e5b][_0x6d56('0x4f')];}return db[_0x6d56('0x22')][_0x6d56('0x23')]({'where':{'id':_0x5c1c6a[_0x6d56('0x24')]['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x4abf1a,null))['then'](saveUpdates(_0x5c1c6a['body'],null))[_0x6d56('0x18')](function(_0x400cd6){_0x24f28d=_0x400cd6;var _0x381f9c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x400cd6&&_0x400cd6[_0x6d56('0x56')]){if(_0x400cd6[_0x6d56('0x56')]){_0x381f9c['where'][_0x6d56('0x66')][_0x6d56('0x59')]({'ListId':{'$ne':_0x400cd6[_0x6d56('0x56')]}});}}return db['CmCustomField'][_0x6d56('0x20')](_0x381f9c);})[_0x6d56('0x18')](function(_0x43fe98){if(_0x43fe98){return _[_0x6d56('0x68')](_[_0x6d56('0x69')](_0x5c1c6a['body'],function(_0x55d52c,_0x223478){return _[_0x6d56('0x28')](_0x223478,_0x6d56('0x29'));}),_[_0x6d56('0x6a')](_0x43fe98,function(_0x383c84){return util[_0x6d56('0x6b')](_0x6d56('0x67'),_0x383c84['id']);}));}})[_0x6d56('0x18')](function(_0x1bc875){if(_0x1bc875&&!_[_0x6d56('0x6c')](_0x1bc875)){var _0x4fc252=squel[_0x6d56('0x17')]()[_0x6d56('0x6d')](_0x6d56('0x6e'))[_0x6d56('0x6f')](_0x1bc875)[_0x6d56('0x54')]('id\x20=\x20?',_0x5c1c6a[_0x6d56('0x24')]['id'])[_0x6d56('0x70')]();return db[_0x6d56('0x63')][_0x6d56('0x2d')](_0x4fc252['text'],{'replacements':_0x4fc252[_0x6d56('0x71')]});}})[_0x6d56('0x18')](function(){if(_0x5c1c6a[_0x6d56('0x34')][_0x6d56('0x72')]&&_0x24f28d){return db['CmHopper'][_0x6d56('0x17')]({'phone':_0x5c1c6a[_0x6d56('0x34')][_0x6d56('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x24f28d['id']}});}})[_0x6d56('0x18')](function(){return _0x24f28d;})['then'](respondWithResult(_0x4abf1a,null))[_0x6d56('0x21')](handleError(_0x4abf1a,null));};exports[_0x6d56('0x73')]=function(_0x1c97c1,_0x499050){var _0x1ed812={};var _0x4775c0={};var _0x39c339;var _0x20d2ef;return db[_0x6d56('0x22')][_0x6d56('0x74')]({'where':{'id':_0x1c97c1['params']['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x499050,null))[_0x6d56('0x18')](function(_0x4f40b0){if(_0x4f40b0){_0x39c339=_0x4f40b0;_0x4775c0[_0x6d56('0x75')]=_['keys'](db['Tag'][_0x6d56('0x76')]);_0x4775c0[_0x6d56('0x2d')]=_[_0x6d56('0x26')](_0x1c97c1['query']);_0x4775c0['filters']=_[_0x6d56('0x77')](_0x4775c0['model'],_0x4775c0[_0x6d56('0x2d')]);_0x1ed812[_0x6d56('0x78')]=_[_0x6d56('0x77')](_0x4775c0['model'],qs[_0x6d56('0x79')](_0x1c97c1[_0x6d56('0x2d')]['fields']));_0x1ed812[_0x6d56('0x78')]=_0x1ed812['attributes'][_0x6d56('0x27')]?_0x1ed812[_0x6d56('0x78')]:_0x4775c0[_0x6d56('0x75')];_0x1ed812[_0x6d56('0x7a')]=qs['sort'](_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x7b')]);_0x1ed812['where']=qs[_0x6d56('0x7c')](_[_0x6d56('0x7d')](_0x1c97c1[_0x6d56('0x2d')],_0x4775c0[_0x6d56('0x7c')]));if(_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x7e')]){_0x1ed812['where']=_['merge'](_0x1ed812[_0x6d56('0x54')],{'$or':_['map'](_0x1ed812[_0x6d56('0x78')],function(_0x53583f){var _0xd56b2a={};_0xd56b2a[_0x53583f]={'$like':'%'+_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x7e')]+'%'};return _0xd56b2a;})});}_0x1ed812=_[_0x6d56('0x33')]({},_0x1ed812,_0x1c97c1[_0x6d56('0x7f')]);return _0x39c339['getTags'](_0x1ed812);}})[_0x6d56('0x18')](function(_0x3e96f4){if(_0x3e96f4){_0x20d2ef=_0x3e96f4['length'];if(!_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x32')](_0x6d56('0x80'))){_0x1ed812[_0x6d56('0x12')]=qs['limit'](_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x12')]);_0x1ed812[_0x6d56('0x10')]=qs['offset'](_0x1c97c1[_0x6d56('0x2d')][_0x6d56('0x10')]);}return _0x39c339[_0x6d56('0x73')](_0x1ed812);}})[_0x6d56('0x18')](function(_0x1ce19d){if(_0x1ce19d){return _0x1ce19d?{'count':_0x20d2ef,'rows':_0x1ce19d}:null;}})['then'](respondWithResult(_0x499050,null))['catch'](handleError(_0x499050,null));};exports['setTags']=function(_0x38dcc0,_0x1cbfd7){if(_0x38dcc0[_0x6d56('0x34')]['id']){delete _0x38dcc0[_0x6d56('0x34')]['id'];}return db[_0x6d56('0x22')][_0x6d56('0x74')]({'where':{'id':_0x38dcc0[_0x6d56('0x24')]['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x1cbfd7,null))[_0x6d56('0x18')](function(_0x2111d0){if(_0x2111d0){return _0x2111d0[_0x6d56('0x81')](_0x38dcc0[_0x6d56('0x34')][_0x6d56('0x82')]||[]);}return null;})[_0x6d56('0x18')](respondWithResult(_0x1cbfd7,null))[_0x6d56('0x21')](handleError(_0x1cbfd7,null));};exports[_0x6d56('0x83')]=function(_0x49716c,_0x3e3de9){var _0x16b03a=[];_0x16b03a[_0x6d56('0x59')](addAdditionalPhones(_0x49716c[_0x6d56('0x34')]));Promise[_0x6d56('0x84')](_0x16b03a)[_0x6d56('0x18')](function(){_0x16b03a=[];_0x16b03a[_0x6d56('0x59')](deleteCmHopperPhones(_0x49716c[_0x6d56('0x34')]['id']));_0x16b03a[_0x6d56('0x59')](addCmHopperPhones(_0x49716c['body']['id']));Promise[_0x6d56('0x84')](_0x16b03a)['then'](function(){return[0x1];})['then'](respondWithResult(_0x3e3de9,null));});};function addAdditionalPhones(_0x17da2b){var _0x8985;return new Promise(function(_0x1bc86e){return db['CmContactHasItem'][_0x6d56('0x19')]({'where':{'CmContactId':_0x17da2b['id']}})[_0x6d56('0x18')](function(){db['ContactItemType'][_0x6d56('0x20')]({'raw':!![],'attributes':['id',_0x6d56('0x85')]})['then'](function(_0x5d0954){var _0x4c882c=[];for(var _0x5f1da3=0x0;_0x5f1da3<_0x17da2b['items']['length'];_0x5f1da3++){var _0x382ea1=_0x17da2b[_0x6d56('0x86')]?_[_0x6d56('0x4c')](_0x17da2b[_0x6d56('0x86')][_0x5f1da3])?'':_0x17da2b[_0x6d56('0x86')][_0x5f1da3]:_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x88')]?_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x88')]:'';var _0x5f53dd=_[_0x6d56('0x4c')](_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x89')])?'':_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x89')];var _0x150f1a=_0x382ea1+':'+_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x72')]+'§'+_0x5f53dd;if(_['isNil'](_0x8985))_0x8985=_0x150f1a;else _0x8985+=';'+_0x150f1a;var _0x45d17a=null;var _0x4a152b=null;if(_0x17da2b[_0x6d56('0x86')]){if(!_[_0x6d56('0x4c')](_0x17da2b[_0x6d56('0x86')][_0x5f1da3])){_0x4a152b=_[_0x6d56('0x23')](_0x5d0954,function(_0x39b3ef){return _0x39b3ef['id']===_0x17da2b[_0x6d56('0x86')][_0x5f1da3];});if(!_[_0x6d56('0x4c')](_0x4a152b)){_0x45d17a=_0x4a152b['OrderBy'];}}}else{if(!_['isNil'](_0x17da2b[_0x6d56('0x87')][_0x5f1da3])){_0x4a152b=_[_0x6d56('0x23')](_0x5d0954,function(_0x58f68f){return _0x58f68f['id']===_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x88')];});if(!_['isNil'](_0x4a152b)){_0x45d17a=_0x5f1da3;}}}if(_[_0x6d56('0x4c')](_0x45d17a)){_0x45d17a=0x64;}_0x4c882c['push'](addAdditionalPhone(_0x17da2b['id'],_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x72')],_0x17da2b[_0x6d56('0x86')]?_[_0x6d56('0x4c')](_0x17da2b[_0x6d56('0x86')][_0x5f1da3])?null:_0x17da2b[_0x6d56('0x86')][_0x5f1da3]:_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x88')]?_0x17da2b[_0x6d56('0x87')][_0x5f1da3][_0x6d56('0x88')]:null,_0x45d17a,_0x5f53dd));}Promise[_0x6d56('0x84')](_0x4c882c)[_0x6d56('0x18')](function(){db[_0x6d56('0x22')][_0x6d56('0x17')]({'AdditionalPhones':_0x8985},{'where':{'id':_0x17da2b['id']}})['then'](function(){_0x1bc86e(0x1);});});});});});}function addAdditionalPhone(_0x9a589,_0x157d79,_0x2560ce,_0x3061f7,_0x15efe7){return db['CmContactHasItem'][_0x6d56('0x23')]({'where':{'CmContactId':_0x9a589,'item':_0x157d79}})[_0x6d56('0x18')](function(_0x62c987){if(_0x62c987)logger[_0x6d56('0x3a')]('contact\x20phone\x20exists',_0x62c987);else{db[_0x6d56('0x5f')][_0x6d56('0x3c')]({'CmContactId':_0x9a589,'item':_0x157d79,'ItemTypeId':_0x2560ce,'OrderBy':_0x3061f7,'ItemClass':'PHONE','description':_0x15efe7});}});}function deleteCmHopperPhones(_0x69ffa7){return new Promise(function(_0x30b102){return db[_0x6d56('0x8a')][_0x6d56('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x69ffa7}})[_0x6d56('0x18')](function(_0x3493c9){db['CmHopperAdditionalPhone'][_0x6d56('0x19')]({'where':{'CmHopperId':{'$in':_[_0x6d56('0x6a')](_0x3493c9,'id')}}});})[_0x6d56('0x18')](function(){_0x30b102(0x1);});});}function addCmHopperPhones(_0xdcc6be){return new Promise(function(_0x396968){return db['CmHopper'][_0x6d56('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdcc6be}})[_0x6d56('0x18')](function(_0x47d8aa){var _0x3e1983=[];_[_0x6d56('0x6a')](_0x47d8aa,function(_0x476f7d){_0x3e1983['push'](createCmHopperPhone(_0xdcc6be,_0x476f7d['id']));});Promise[_0x6d56('0x84')](_0x3e1983)[_0x6d56('0x18')](function(){_0x396968(0x1);});});});}function createCmHopperPhone(_0x349b46,_0x808bc7){return new Promise(function(_0x545057){db[_0x6d56('0x5f')][_0x6d56('0x20')]({'raw':!![],'attributes':['item',_0x6d56('0x85')],'where':{'CmContactId':_0x349b46,'ItemClass':_0x6d56('0x8b')},'include':[{'model':db[_0x6d56('0x61')],'attributes':['OrderBy'],'as':_0x6d56('0x62')}],'order':[_0x6d56('0x85'),db[_0x6d56('0x63')][_0x6d56('0x64')](_0x6d56('0x8c'))]})[_0x6d56('0x18')](function(_0xce6ab){var _0x52d1a2=0x1;var _0x3269e9=_[_0x6d56('0x6a')](_0xce6ab,function(_0x416a42){_0x416a42[_0x6d56('0x8d')]=_0x808bc7;_0x416a42[_0x6d56('0x72')]=_0x416a42[_0x6d56('0x8e')];_0x416a42['OrderBy']=_0x52d1a2;delete _0x416a42[_0x6d56('0x8f')];_0x52d1a2=_0x52d1a2+0x1;return _0x416a42;});return db[_0x6d56('0x90')]['bulkCreate'](_0x3269e9,{});})[_0x6d56('0x18')](function(){_0x545057(0x1);});});}function insertAdditionalPhones(_0x51581c,_0xd5200a){return new Promise(function(_0x21efa0){var _0x49e099=[];for(var _0xa6e2da=0x0;_0xa6e2da<_0xd5200a['length'];_0xa6e2da++){var _0x26a671=_0xd5200a[_0xa6e2da];_0x49e099[_0x6d56('0x59')](parseContactItemType(_0x26a671));}Promise[_0x6d56('0x84')](_0x49e099)[_0x6d56('0x18')](function(){var _0x57d70b={'id':_0x51581c['id'],'items':_0xd5200a};return addAdditionalPhones(_0x57d70b)[_0x6d56('0x18')](function(){return addCmHopperPhones(_0x51581c['id']);});})[_0x6d56('0x18')](function(){_0x21efa0(_0x51581c);});});}function parseContactItemType(_0x422773){return new Promise(function(_0x1e16c3){if(_0x422773[_0x6d56('0x32')](_0x6d56('0x88'))){_0x1e16c3(_0x422773);}else{return db[_0x6d56('0x61')]['find']({'where':{'name':_0x422773[_0x6d56('0x62')]}})[_0x6d56('0x18')](function(_0xa57659){if(_[_0x6d56('0x4c')](_0xa57659))_0x422773['ItemTypeId']=null;else _0x422773[_0x6d56('0x88')]=_0xa57659['id'];_0x1e16c3(_0x422773);});}});}exports['getAdditionalPhones']=function(_0xf288fa,_0x5a5510){return db[_0x6d56('0x5f')][_0x6d56('0x20')]({'raw':!![],'where':{'CmContactId':_0xf288fa[_0x6d56('0x24')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x6d56('0x85')],[db[_0x6d56('0x63')][_0x6d56('0x64')](_0x6d56('0x8c'))]]})[_0x6d56('0x18')](function(_0x3d7e66){return _0x3d7e66;})[_0x6d56('0x18')](respondWithResult(_0x5a5510,null))[_0x6d56('0x21')](handleError(_0x5a5510,null));};exports[_0x6d56('0x91')]=function(_0x30c480,_0x5341b8){return db[_0x6d56('0x5f')][_0x6d56('0x20')]({'raw':!![],'where':{'CmContactId':_0x30c480[_0x6d56('0x34')][_0x6d56('0x92')]}})[_0x6d56('0x18')](function(_0x441c17){var _0x558a41=_[_0x6d56('0x6a')](_0x441c17,function(_0x38ea23){_0x38ea23[_0x6d56('0x93')]=_0x30c480[_0x6d56('0x34')][_0x6d56('0x94')];return _0x38ea23;});return db[_0x6d56('0x5f')][_0x6d56('0x51')](_0x558a41,{});})[_0x6d56('0x18')](function(){return addCmHopperPhones(_0x30c480['body'][_0x6d56('0x94')]);})['then'](function(){return['ok'];})[_0x6d56('0x18')](respondWithResult(_0x5341b8,null))[_0x6d56('0x21')](handleError(_0x5341b8,null));};exports[_0x6d56('0x95')]=function(_0x5b0906,_0x2401a3){var _0xdfbe6=[];_0xdfbe6['push'](createCmHopperPhone(_0x5b0906['body']['id'],_0x5b0906[_0x6d56('0x34')][_0x6d56('0x96')]));Promise[_0x6d56('0x84')](_0xdfbe6)[_0x6d56('0x18')](function(){return[0x1];})[_0x6d56('0x18')](respondWithResult(_0x2401a3,null));};exports[_0x6d56('0x97')]=function(_0x12e024,_0x1c4ebd){var _0x323652={'raw':![],'where':{}};var _0x50a4e7={};var _0x3c028e={'count':0x0,'rows':[]};return db[_0x6d56('0x22')][_0x6d56('0x74')]({'where':{'id':_0x12e024[_0x6d56('0x24')]['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x1c4ebd,null))[_0x6d56('0x18')](function(_0x22e1a4){if(_0x22e1a4){_0x50a4e7[_0x6d56('0x75')]=_[_0x6d56('0x26')](db[_0x6d56('0x8a')][_0x6d56('0x76')]);_0x50a4e7[_0x6d56('0x2d')]=_[_0x6d56('0x26')](_0x12e024[_0x6d56('0x2d')]);_0x50a4e7[_0x6d56('0x7c')]=_['intersection'](_0x50a4e7[_0x6d56('0x75')],_0x50a4e7[_0x6d56('0x2d')]);_0x323652[_0x6d56('0x78')]=_[_0x6d56('0x77')](_0x50a4e7[_0x6d56('0x75')],qs['fields'](_0x12e024['query'][_0x6d56('0x79')]));_0x323652[_0x6d56('0x78')]=_0x323652[_0x6d56('0x78')][_0x6d56('0x27')]?_0x323652[_0x6d56('0x78')]:_0x50a4e7['model'];if(!_0x12e024[_0x6d56('0x2d')][_0x6d56('0x32')](_0x6d56('0x80'))){_0x323652[_0x6d56('0x12')]=qs[_0x6d56('0x12')](_0x12e024[_0x6d56('0x2d')]['limit']);_0x323652[_0x6d56('0x10')]=qs[_0x6d56('0x10')](_0x12e024[_0x6d56('0x2d')][_0x6d56('0x10')]);}_0x323652[_0x6d56('0x7a')]=qs['sort'](_0x12e024['query'][_0x6d56('0x7b')]);_0x323652['where']=qs[_0x6d56('0x7c')](_['pick'](_0x12e024[_0x6d56('0x2d')],_0x50a4e7[_0x6d56('0x7c')]));_0x323652[_0x6d56('0x54')]['ContactId']=_0x22e1a4['id'];if(_0x12e024[_0x6d56('0x2d')][_0x6d56('0x7e')]){_0x323652[_0x6d56('0x54')]=_[_0x6d56('0x33')](_0x323652[_0x6d56('0x54')],{'$or':_['map'](_0x323652['attributes'],function(_0x1f764d){var _0x2276dc={};_0x2276dc[_0x1f764d]={'$like':'%'+_0x12e024[_0x6d56('0x2d')]['filter']+'%'};return _0x2276dc;})});}_0x323652=_[_0x6d56('0x33')]({},_0x323652,_0x12e024['options']);return db['CmHopper']['count']({'where':_0x323652[_0x6d56('0x54')]})[_0x6d56('0x18')](function(_0x5b4d26){_0x3c028e[_0x6d56('0x13')]=_0x5b4d26;if(_0x12e024[_0x6d56('0x2d')][_0x6d56('0x98')]){_0x323652[_0x6d56('0x99')]=[{'all':!![]}];}return db[_0x6d56('0x8a')][_0x6d56('0x20')](_0x323652);})[_0x6d56('0x18')](function(_0x21e85c){_0x3c028e[_0x6d56('0x9a')]=_0x21e85c;return _0x3c028e;});}})[_0x6d56('0x18')](respondWithFilteredResult(_0x1c4ebd,_0x323652))[_0x6d56('0x21')](handleError(_0x1c4ebd,null));};exports[_0x6d56('0x9b')]=function(_0x120aef,_0x5d300b){var _0x300200={'raw':!![],'where':{}};var _0x44fcf9={};var _0x3020a3={'count':0x0,'rows':[]};return db[_0x6d56('0x22')][_0x6d56('0x74')]({'where':{'id':_0x120aef[_0x6d56('0x24')]['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x5d300b,null))[_0x6d56('0x18')](function(_0x38fbce){if(_0x38fbce){_0x44fcf9[_0x6d56('0x75')]=_[_0x6d56('0x26')](db[_0x6d56('0x45')][_0x6d56('0x76')]);_0x44fcf9[_0x6d56('0x2d')]=_[_0x6d56('0x26')](_0x120aef[_0x6d56('0x2d')]);_0x44fcf9[_0x6d56('0x7c')]=_['intersection'](_0x44fcf9[_0x6d56('0x75')],_0x44fcf9[_0x6d56('0x2d')]);_0x300200[_0x6d56('0x78')]=_[_0x6d56('0x77')](_0x44fcf9[_0x6d56('0x75')],qs[_0x6d56('0x79')](_0x120aef[_0x6d56('0x2d')][_0x6d56('0x79')]));_0x300200[_0x6d56('0x78')]=_0x300200[_0x6d56('0x78')][_0x6d56('0x27')]?_0x300200[_0x6d56('0x78')]:_0x44fcf9[_0x6d56('0x75')];if(!_0x120aef[_0x6d56('0x2d')]['hasOwnProperty'](_0x6d56('0x80'))){_0x300200['limit']=qs[_0x6d56('0x12')](_0x120aef['query']['limit']);_0x300200[_0x6d56('0x10')]=qs['offset'](_0x120aef[_0x6d56('0x2d')][_0x6d56('0x10')]);}_0x300200['order']=qs['sort'](_0x120aef[_0x6d56('0x2d')][_0x6d56('0x7b')]);_0x300200['where']=qs['filters'](_['pick'](_0x120aef['query'],_0x44fcf9[_0x6d56('0x7c')]));_0x300200[_0x6d56('0x54')][_0x6d56('0x9c')]=_0x38fbce['id'];if(_0x120aef['query'][_0x6d56('0x7e')]){_0x300200[_0x6d56('0x54')]=_[_0x6d56('0x33')](_0x300200[_0x6d56('0x54')],{'$or':_[_0x6d56('0x6a')](_0x300200[_0x6d56('0x78')],function(_0x18b90a){var _0x4b6256={};_0x4b6256[_0x18b90a]={'$like':'%'+_0x120aef[_0x6d56('0x2d')][_0x6d56('0x7e')]+'%'};return _0x4b6256;})});}_0x300200=_[_0x6d56('0x33')]({},_0x300200,_0x120aef[_0x6d56('0x7f')]);return db['CmHopperHistory']['count']({'where':_0x300200[_0x6d56('0x54')]})[_0x6d56('0x18')](function(_0x1974cb){_0x3020a3['count']=_0x1974cb;if(_0x120aef[_0x6d56('0x2d')][_0x6d56('0x98')]){_0x300200['include']=[{'all':!![]}];}return db[_0x6d56('0x45')]['findAll'](_0x300200);})[_0x6d56('0x18')](function(_0x249ba8){_0x3020a3['rows']=_0x249ba8;return _0x3020a3;});}})[_0x6d56('0x18')](respondWithFilteredResult(_0x5d300b,_0x300200))['catch'](handleError(_0x5d300b,null));};exports[_0x6d56('0x9d')]=function(_0x2f72ea,_0x3c591d){var _0x202841={'raw':!![],'where':{}};var _0x3f5b6e={};var _0x4b2b50={'count':0x0,'rows':[]};return db[_0x6d56('0x22')]['findOne']({'where':{'id':_0x2f72ea['params']['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x3c591d,null))[_0x6d56('0x18')](function(_0x15586b){if(_0x15586b){_0x3f5b6e['model']=_['keys'](db[_0x6d56('0x9e')][_0x6d56('0x76')]);_0x3f5b6e[_0x6d56('0x2d')]=_[_0x6d56('0x26')](_0x2f72ea['query']);_0x3f5b6e[_0x6d56('0x7c')]=_['intersection'](_0x3f5b6e['model'],_0x3f5b6e[_0x6d56('0x2d')]);_0x202841[_0x6d56('0x78')]=_[_0x6d56('0x77')](_0x3f5b6e['model'],qs['fields'](_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x79')]));_0x202841[_0x6d56('0x78')]=_0x202841[_0x6d56('0x78')][_0x6d56('0x27')]?_0x202841[_0x6d56('0x78')]:_0x3f5b6e[_0x6d56('0x75')];if(!_0x2f72ea[_0x6d56('0x2d')]['hasOwnProperty'](_0x6d56('0x80'))){_0x202841['limit']=qs[_0x6d56('0x12')](_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x12')]);_0x202841['offset']=qs[_0x6d56('0x10')](_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x10')]);}_0x202841[_0x6d56('0x7a')]=qs[_0x6d56('0x7b')](_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x7b')]);_0x202841['where']=qs[_0x6d56('0x7c')](_[_0x6d56('0x7d')](_0x2f72ea[_0x6d56('0x2d')],_0x3f5b6e[_0x6d56('0x7c')]));_0x202841[_0x6d56('0x54')]['ContactId']=_0x15586b['id'];if(_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x7e')]){_0x202841[_0x6d56('0x54')]=_['merge'](_0x202841[_0x6d56('0x54')],{'$or':_['map'](_0x202841[_0x6d56('0x78')],function(_0x45bab9){var _0x554dbf={};_0x554dbf[_0x45bab9]={'$like':'%'+_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x7e')]+'%'};return _0x554dbf;})});}_0x202841=_[_0x6d56('0x33')]({},_0x202841,_0x2f72ea['options']);return db['CmHopperFinal'][_0x6d56('0x13')]({'where':_0x202841[_0x6d56('0x54')]})[_0x6d56('0x18')](function(_0x4edf73){_0x4b2b50['count']=_0x4edf73;if(_0x2f72ea[_0x6d56('0x2d')][_0x6d56('0x98')]){_0x202841['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x6d56('0x20')](_0x202841);})['then'](function(_0x5df263){_0x4b2b50[_0x6d56('0x9a')]=_0x5df263;return _0x4b2b50;});}})[_0x6d56('0x18')](respondWithFilteredResult(_0x3c591d,_0x202841))[_0x6d56('0x21')](handleError(_0x3c591d,null));};exports[_0x6d56('0x9f')]=function(_0xf67ff6,_0x81cbbc){var _0x48fc63={'raw':!![],'where':{}};var _0xe4024e={};var _0x502a95={'count':0x0,'rows':[]};return db[_0x6d56('0x22')][_0x6d56('0x74')]({'where':{'id':_0xf67ff6['params']['id']}})[_0x6d56('0x18')](handleEntityNotFound(_0x81cbbc,null))[_0x6d56('0x18')](function(_0x59f34f){if(_0x59f34f){_0xe4024e[_0x6d56('0x75')]=_['keys'](db[_0x6d56('0xa0')][_0x6d56('0x76')]);_0xe4024e['query']=_['keys'](_0xf67ff6[_0x6d56('0x2d')]);_0xe4024e[_0x6d56('0x7c')]=_[_0x6d56('0x77')](_0xe4024e[_0x6d56('0x75')],_0xe4024e[_0x6d56('0x2d')]);_0x48fc63['attributes']=_[_0x6d56('0x77')](_0xe4024e[_0x6d56('0x75')],qs['fields'](_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x79')]));_0x48fc63[_0x6d56('0x78')]=_0x48fc63['attributes'][_0x6d56('0x27')]?_0x48fc63['attributes']:_0xe4024e[_0x6d56('0x75')];if(!_0xf67ff6['query'][_0x6d56('0x32')]('nolimit')){_0x48fc63[_0x6d56('0x12')]=qs[_0x6d56('0x12')](_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x12')]);_0x48fc63[_0x6d56('0x10')]=qs['offset'](_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x10')]);}_0x48fc63[_0x6d56('0x7a')]=qs['sort'](_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x7b')]);_0x48fc63['where']=qs['filters'](_[_0x6d56('0x7d')](_0xf67ff6['query'],_0xe4024e[_0x6d56('0x7c')]));_0x48fc63[_0x6d56('0x54')][_0x6d56('0x9c')]=_0x59f34f['id'];if(_0xf67ff6['query'][_0x6d56('0x7e')]){_0x48fc63[_0x6d56('0x54')]=_[_0x6d56('0x33')](_0x48fc63[_0x6d56('0x54')],{'$or':_[_0x6d56('0x6a')](_0x48fc63[_0x6d56('0x78')],function(_0x2546a1){var _0x622232={};_0x622232[_0x2546a1]={'$like':'%'+_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x7e')]+'%'};return _0x622232;})});}_0x48fc63=_['merge']({},_0x48fc63,_0xf67ff6['options']);return db[_0x6d56('0xa0')][_0x6d56('0x13')]({'where':_0x48fc63[_0x6d56('0x54')]})[_0x6d56('0x18')](function(_0x22bc60){_0x502a95[_0x6d56('0x13')]=_0x22bc60;if(_0xf67ff6[_0x6d56('0x2d')][_0x6d56('0x98')]){_0x48fc63[_0x6d56('0x99')]=[{'all':!![]}];}return db[_0x6d56('0xa0')][_0x6d56('0x20')](_0x48fc63);})['then'](function(_0x31288c){_0x502a95[_0x6d56('0x9a')]=_0x31288c;return _0x502a95;});}})[_0x6d56('0x18')](respondWithFilteredResult(_0x81cbbc,_0x48fc63))[_0x6d56('0x21')](handleError(_0x81cbbc,null));};exports['uploadCsv']=function(_0x52b47f,_0x1a612e){try{if(!_0x52b47f[_0x6d56('0x34')][_0x6d56('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x52b47f[_0x6d56('0x34')]['binding_keys']){throw new Error(_0x6d56('0xa1'));}if(!_0x52b47f['body']['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x52b47f['body'][_0x6d56('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x125c14=_0x52b47f[_0x6d56('0x34')][_0x6d56('0xa3')][_0x6d56('0xa4')](',');var _0x200721=_0x52b47f[_0x6d56('0x34')]['binding_values']['split'](',');if(!_0x125c14[_0x6d56('0x27')]||!_0x200721[_0x6d56('0x27')]||_0x125c14[_0x6d56('0x27')]!==_0x200721[_0x6d56('0x27')]){throw new Error(_0x6d56('0xa5'));}_0x52b47f[_0x6d56('0x34')][_0x6d56('0x79')]=_[_0x6d56('0xa6')](_0x125c14,_0x200721);if(!_0x52b47f['body'][_0x6d56('0x79')][_0x6d56('0x72')]){throw new Error(_0x6d56('0xa7'));}if(!_0x52b47f[_0x6d56('0x34')][_0x6d56('0x79')][_0x6d56('0xa8')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x310906=path[_0x6d56('0x4b')](config[_0x6d56('0xa9')],_0x6d56('0xaa'),_0x52b47f[_0x6d56('0xab')][_0x6d56('0xac')]);fs[_0x6d56('0xad')](_0x310906,parseInt(_0x6d56('0xae'),0x8));var _0x3bb98a=require('child_process')[_0x6d56('0xaf')](path[_0x6d56('0x4b')](__dirname,_0x6d56('0xb0')),[_0x310906,_0x52b47f[_0x6d56('0x34')]['binding_keys'],_0x52b47f[_0x6d56('0x34')][_0x6d56('0xb1')],_0x52b47f['body'][_0x6d56('0x56')],_0x52b47f[_0x6d56('0x34')][_0x6d56('0xb2')],_0x52b47f[_0x6d56('0x34')][_0x6d56('0x53')],_0x52b47f[_0x6d56('0x34')][_0x6d56('0xa2')]]);return _0x1a612e[_0x6d56('0x14')](0xc8)[_0x6d56('0xf')]({'message':_0x6d56('0xb3'),'pid':_0x3bb98a[_0x6d56('0xb4')]});}catch(_0x2a4592){return _0x1a612e[_0x6d56('0x14')](0x1f4)[_0x6d56('0x1d')](_0x2a4592);}};exports['upload']=function(_0x2c802f,_0x2e089e){var _0x1d539b=fs['createReadStream'](_0x2c802f['file'][_0x6d56('0xb5')]);Papa[_0x6d56('0xb6')](_0x1d539b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c89fd){return _0x2e089e['status'](0xc8)[_0x6d56('0xf')]({'file':_0x2c802f[_0x6d56('0xab')],'fields':_0x5c89fd['meta'][_0x6d56('0x79')]});}});};exports[_0x6d56('0xb7')]=function(_0x1ab914,_0x11c2a9){return db[_0x6d56('0xb8')][_0x6d56('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x6d56('0xb9')}})[_0x6d56('0x18')](function(_0x294411){var _0xefd249=![];if(!_0x1ab914[_0x6d56('0x34')]['ListId']){throw new Error(_0x6d56('0xba'));}if(!_0x1ab914[_0x6d56('0x34')]['binding'][_0x6d56('0x72')]){throw new Error(_0x6d56('0xa7'));}if(!_0x1ab914['body']['binding'][_0x6d56('0xa8')]){throw new Error(_0x6d56('0xbb'));}if(!_0x1ab914[_0x6d56('0x34')][_0x6d56('0xa2')]){throw new Error(_0x6d56('0xbc'));}var _0x3c6945=require(_0x6d56('0xbd'))['fork'](path[_0x6d56('0x4b')](__dirname,_0x6d56('0xbe')),[_0x1ab914[_0x6d56('0x24')]['id'],JSON['stringify'](_0x1ab914['body']),JSON[_0x6d56('0xbf')](_0x294411)]);_0x3c6945['on'](_0x6d56('0xc0'),function(){_0xefd249=!![];return _0x11c2a9[_0x6d56('0x14')](0xc8)['json']({'message':_0x6d56('0xc1'),'pid':_0x3c6945[_0x6d56('0xb4')]});});_0x3c6945['on'](_0x6d56('0xc2'),function(_0x2f2098){if(_0x2f2098&&!_0xefd249){return _0x11c2a9[_0x6d56('0x14')](0x1f4)[_0x6d56('0xf')]({'message':_0x6d56('0xc3'),'pid':_0x3c6945['pid']});}});})[_0x6d56('0x21')](handleError(_0x11c2a9,null));};exports[_0x6d56('0xc4')]=function(_0x1a996b,_0x302774){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x6d56('0xb9')}})[_0x6d56('0x18')](function(_0x2dbc24){var _0x4e5361=![];if(!_0x1a996b[_0x6d56('0x34')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x1a996b[_0x6d56('0x34')][_0x6d56('0xc5')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1a996b[_0x6d56('0x34')][_0x6d56('0xc5')][_0x6d56('0xa8')]){throw new Error(_0x6d56('0xbb'));}if(!_0x1a996b[_0x6d56('0x34')][_0x6d56('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5e3663=require('child_process')[_0x6d56('0xaf')](path['join'](__dirname,_0x6d56('0xc6')),[_0x1a996b[_0x6d56('0x24')]['id'],JSON[_0x6d56('0xbf')](_0x1a996b[_0x6d56('0x34')]),JSON['stringify'](_0x2dbc24)]);_0x5e3663['on'](_0x6d56('0xc0'),function(){_0x4e5361=!![];return _0x302774[_0x6d56('0x14')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x5e3663[_0x6d56('0xb4')]});});_0x5e3663['on'](_0x6d56('0xc2'),function(_0x2fec0e){if(_0x2fec0e&&!_0x4e5361){return _0x302774['status'](0x1f4)[_0x6d56('0xf')]({'message':_0x6d56('0xc3'),'pid':_0x5e3663[_0x6d56('0xb4')]});}});})[_0x6d56('0x21')](handleError(_0x302774,null));};exports[_0x6d56('0xc7')]=function(_0x923890,_0x5709fa){var _0x535cc9=[_0x6d56('0xc8'),'chat','sms',_0x6d56('0xc9'),_0x6d56('0xca'),_0x6d56('0xcb'),_0x6d56('0xcc')];var _0x42de91={'offset':0x0,'order':qs[_0x6d56('0x7b')]('-createdAt')},_0x52cb74={'count':0x0,'rows':[]};Promise[_0x6d56('0xcd')]()[_0x6d56('0x18')](function(){if(_0x923890[_0x6d56('0x2d')][_0x6d56('0xce')]){if(!_[_0x6d56('0xcf')](_0x535cc9,_0x923890['query']['channel']['toLowerCase']())){throw new Error(_0x6d56('0xd0'));}_0x535cc9=[_0x923890[_0x6d56('0x2d')][_0x6d56('0xce')][_0x6d56('0xd1')]()];}if(_0x923890[_0x6d56('0x2d')][_0x6d56('0xd2')]){try{var _0x2d09d5=JSON[_0x6d56('0xb6')](_0x923890[_0x6d56('0x2d')][_0x6d56('0xd2')]);if(!moment(_0x2d09d5[_0x6d56('0x35')])[_0x6d56('0xd3')]()){throw new Error(_0x6d56('0xd4'));}if(!moment(_0x2d09d5['to'])['isValid']()){throw new Error(_0x6d56('0xd5'));}}catch(_0x12213f){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x923890[_0x6d56('0x2d')]['hasOwnProperty'](_0x6d56('0x80'))){_0x42de91[_0x6d56('0x12')]=qs[_0x6d56('0x12')](_0x923890[_0x6d56('0x2d')]['limit']||0xa);_0x42de91[_0x6d56('0x10')]=qs[_0x6d56('0x10')](_0x923890['query'][_0x6d56('0x10')]);}var _0xb45f33=_0x535cc9[_0x6d56('0x6a')](function(_0x535cb5){if(_0x535cb5==='voice'){var _0x8b4ee3={'attributes':['id',_0x6d56('0xd6'),_0x6d56('0x30'),_0x6d56('0xd7'),_0x6d56('0xd8'),_0x6d56('0xd9'),_0x6d56('0xda'),'endtime',_0x6d56('0xdb'),_0x6d56('0xdc'),'createdAt',_0x6d56('0xdd'),_0x6d56('0xde'),_0x6d56('0xdf'),_0x6d56('0xe0')],'where':{'ContactId':_0x923890[_0x6d56('0x24')]['id']},'include':[{'model':db[_0x6d56('0xb8')],'as':_0x6d56('0xb8'),'attributes':['id',_0x6d56('0x1c'),_0x6d56('0xe1'),_0x6d56('0xe2')]}],'order':[[_0x6d56('0xe3'),_0x6d56('0xe4')]]};if(_0x923890[_0x6d56('0x2d')]['range']){_0x8b4ee3['where']['createdAt']={'$gte':_0x2d09d5[_0x6d56('0x35')],'$lte':_0x2d09d5['to']};}return db[_0x6d56('0x47')][_0x6d56('0xe5')](_0x8b4ee3)[_0x6d56('0x18')](function(_0x244ef0){_0x52cb74[_0x6d56('0x13')]+=_0x244ef0['count'];return _[_0x6d56('0x6a')](_0x244ef0[_0x6d56('0x9a')],function(_0x4d2cbe){var _0x2b0d4d=_0x4d2cbe['get']({'plain':!![]});_0x2b0d4d[_0x6d56('0xce')]=_0x535cb5;if(_0x2b0d4d['User']){_0x2b0d4d[_0x6d56('0xb8')]={'id':_0x2b0d4d[_0x6d56('0xb8')]['id'],'name':_0x2b0d4d['User'][_0x6d56('0x1c')],'fullname':_0x2b0d4d[_0x6d56('0xb8')]['fullname'],'alias':_0x2b0d4d[_0x6d56('0xb8')][_0x6d56('0xe2')]};}return _0x2b0d4d;});});}else{var _0x867ec1=_[_0x6d56('0xe6')](_0x535cb5)+(_0x535cb5===_0x6d56('0xe7')?_0x6d56('0xe8'):_0x6d56('0xe9'));var _0x437355={'attributes':['id',_0x6d56('0xea'),'closedAt','createdAt',_0x6d56('0xdc'),_0x6d56('0xeb'),_0x6d56('0xec'),_0x6d56('0xed'),_0x6d56('0xe0'),_0x867ec1+'Id'],'where':{'ContactId':_0x923890[_0x6d56('0x24')]['id']},'include':[{'model':db[_0x867ec1],'as':_0x6d56('0xe9'),'attributes':['id',_0x6d56('0x1c'),'key']},{'model':db[_0x6d56('0xb8')],'as':_0x6d56('0xee'),'attributes':['id',_0x6d56('0x1c'),_0x6d56('0xe1')]},{'model':db[_0x6d56('0x5b')],'as':_0x6d56('0x5c'),'attributes':['id',_0x6d56('0x1c'),_0x6d56('0x5d')],'through':{'attributes':[]}}],'order':[[_0x6d56('0xe3'),'DESC']]};if(_0x923890[_0x6d56('0x2d')][_0x6d56('0xd2')]){_0x437355[_0x6d56('0x54')]['createdAt']={'$gte':_0x2d09d5[_0x6d56('0x35')],'$lte':_0x2d09d5['to']};}switch(_0x535cb5){case _0x6d56('0xe7'):_0x437355['attributes'][_0x6d56('0x59')](_0x6d56('0xef'),_0x6d56('0xf0'),'customerPort',_0x6d56('0xf1'),_0x6d56('0xf2'),_0x6d56('0xf3'),'ratingType','ratingValue',_0x6d56('0xf4'));break;case _0x6d56('0xc8'):_0x437355[_0x6d56('0x78')][_0x6d56('0x59')](_0x6d56('0xf5'),_0x6d56('0xf6'));break;case _0x6d56('0xc9'):_0x437355[_0x6d56('0x78')][_0x6d56('0x59')]('externalUrl',_0x6d56('0xf7'));break;}return db[_[_0x6d56('0xe6')](_0x535cb5)+_0x6d56('0xf8')][_0x6d56('0xe5')](_0x437355)[_0x6d56('0x18')](function(_0x5132be){_0x52cb74[_0x6d56('0x13')]+=_0x5132be[_0x6d56('0x13')];return _[_0x6d56('0x6a')](_0x5132be['rows'],function(_0x577c8d){var _0x1f42ab=_0x577c8d[_0x6d56('0x36')]({'plain':!![]});_0x1f42ab[_0x6d56('0xce')]=_0x535cb5;if(_0x1f42ab['Owner']){_0x1f42ab['Owner']={'id':_0x1f42ab['Owner']['id'],'name':_0x1f42ab[_0x6d56('0xee')][_0x6d56('0x1c')],'fullname':_0x1f42ab['Owner'][_0x6d56('0xe1')]};}return _0x1f42ab;});});}});return Promise[_0x6d56('0x84')](_0xb45f33);})[_0x6d56('0x18')](function(_0x24fb9b){return _(_0x24fb9b)[_0x6d56('0xf9')]()[_0x6d56('0xfa')](_0x6d56('0xe3'))[_0x6d56('0xfb')]()['value']();})[_0x6d56('0x18')](function(_0x1b1002){_0x52cb74['rows']=_0x42de91['limit']?_0x1b1002[_0x6d56('0xfc')](_0x42de91['offset'],_0x42de91['offset']+_0x42de91[_0x6d56('0x12')]):_0x1b1002;return _0x52cb74;})[_0x6d56('0x18')](respondWithFilteredResult(_0x5709fa,_0x42de91))['catch'](handleError(_0x5709fa,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 0fb1229..2e5f993 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 _0xb01c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove'];(function(_0x3b9161,_0x2849b6){var _0x28efdf=function(_0x3bf76b){while(--_0x3bf76b){_0x3b9161['push'](_0x3b9161['shift']());}};_0x28efdf(++_0x2849b6);}(_0xb01c,0xf4));var _0xcb01=function(_0x816739,_0x5b3c98){_0x816739=_0x816739-0x0;var _0x22dcae=_0xb01c[_0x816739];return _0x22dcae;};'use strict';var EventEmitter=require(_0xcb01('0x0'));var CmContact=require(_0xcb01('0x1'))['db'][_0xcb01('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcb01('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb01('0x4'),'afterDestroy':_0xcb01('0x5')};function emitEvent(_0x3660c4){return function(_0x3c2285,_0x2618b2,_0x222988){CmContactEvents[_0xcb01('0x6')](_0x3660c4+':'+_0x3c2285['id'],_0x3c2285);CmContactEvents[_0xcb01('0x6')](_0x3660c4,_0x3c2285);_0x222988(null);};}for(var e in events){if(events[_0xcb01('0x7')](e)){var event=events[e];CmContact[_0xcb01('0x8')](e,emitEvent(event));}}module[_0xcb01('0x9')]=CmContactEvents; \ No newline at end of file +var _0x025b=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x14510c,_0x3f66f0){var _0x31c5f8=function(_0x1660ec){while(--_0x1660ec){_0x14510c['push'](_0x14510c['shift']());}};_0x31c5f8(++_0x3f66f0);}(_0x025b,0x191));var _0xb025=function(_0x5f4adb,_0x3e363f){_0x5f4adb=_0x5f4adb-0x0;var _0x9964ce=_0x025b[_0x5f4adb];return _0x9964ce;};'use strict';var EventEmitter=require(_0xb025('0x0'));var CmContact=require(_0xb025('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xb025('0x2')](0x0);var events={'afterCreate':_0xb025('0x3'),'afterUpdate':_0xb025('0x4'),'afterDestroy':_0xb025('0x5')};function emitEvent(_0xc8c235){return function(_0x597759,_0x3641cc,_0x3e45f0){CmContactEvents[_0xb025('0x6')](_0xc8c235+':'+_0x597759['id'],_0x597759);CmContactEvents[_0xb025('0x6')](_0xc8c235,_0x597759);_0x3e45f0(null);};}for(var e in events){if(events[_0xb025('0x7')](e)){var event=events[e];CmContact[_0xb025('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d46bfc2..5183d2b 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 _0x170a=['CmHopperBlack','message','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','exports','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','afterCreate','inspect','scheduledat','format','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','CmHopperFinal','error','cmContact','\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','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists'];(function(_0x152879,_0x38672b){var _0x56861b=function(_0x3dace3){while(--_0x3dace3){_0x152879['push'](_0x152879['shift']());}};_0x56861b(++_0x38672b);}(_0x170a,0x128));var _0xa170=function(_0x84325a,_0x36aff8){_0x84325a=_0x84325a-0x0;var _0x145498=_0x170a[_0x84325a];return _0x145498;};'use strict';var _=require(_0xa170('0x0'));var util=require(_0xa170('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa170('0x2'));var BPromise=require(_0xa170('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa170('0x4'));var rimraf=require(_0xa170('0x5'));var config=require(_0xa170('0x6'));var shared=require(_0xa170('0x7'));var attributes=require('./cmContact.attributes');module[_0xa170('0x8')]=function(_0x42677f,_0x367ef6){return _0x42677f['define'](_0xa170('0x9'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xa170('0xa'),'fields':['phone']},{'name':_0xa170('0xb'),'fields':[_0xa170('0xc'),_0xa170('0xd'),_0xa170('0xa'),_0xa170('0xe'),_0xa170('0xf'),_0xa170('0x10')],'type':_0xa170('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xa170('0x12'),'hooks':{'afterCreate':function(_0x3c4319,_0x57cfa3,_0x4397c2){var _0x1f5621=_0x42677f[_0xa170('0x13')];var _0x8e8e62=_0x3c4319[_0xa170('0x14')]({'plain':!![]});function _0x50f4b1(){return function(_0x2f2be1){logger['error']('cmContact',_0xa170('0x15'),util[_0xa170('0x16')](_0x2f2be1,{'showHidden':![],'depth':null}));};}function _0x21b457(_0x43a83e,_0x36ec90){var _0x49df49=_0x36ec90['scheduledat']?_0x36ec90[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2ec558,_0x5f934d){if(_[_0xa170('0x19')](_0x36ec90['dialTimezone'])){_0x2ec558({'ret':_0x49df49});}else{_0x1f5621[_0xa170('0x1a')][_0xa170('0x1b')]({'where':{'id':_0x43a83e['id']}})[_0xa170('0x1c')](function(_0x3a2f91){if(!_[_0xa170('0x19')](_0x3a2f91)){var _0x51b75d=_0x3a2f91[_0xa170('0x1d')];if(!_[_0xa170('0x19')](_0x51b75d)){var _0x37435c=shared[_0xa170('0x1e')];var _0x55fc44=_0x37435c[_0x51b75d];var _0x44e472=_0x37435c[_0x36ec90[_0xa170('0x1d')]];if(!_[_0xa170('0x19')](_0x55fc44)&&!_['isNil'](_0x44e472)){var _0x2f08f1=_0x55fc44[_0xa170('0x1f')]-_0x44e472[_0xa170('0x1f')];_0x49df49=_0x36ec90[_0xa170('0x17')]?_0x36ec90[_0xa170('0x17')]:moment();var _0x380a61=moment(_0x49df49)[_0xa170('0x20')](_0x2f08f1,_0xa170('0x21'));_0x2ec558({'ret':_0x380a61[_0xa170('0x18')](_0xa170('0x22'))});}else _0x2ec558({'ret':_0x49df49});}else _0x2ec558({'ret':_0x49df49});}else{_0x2ec558({'ret':_0x49df49});}});}});return 0xa;}var _0x10df83=function(_0x50d546){return new BPromise(function(_0x1a3e66,_0x2a633b){_0x21b457(_0x50d546,_0x8e8e62)[_0xa170('0x1c')](function(_0x1d7ac7){_0x8e8e62[_0xa170('0x17')]=_0x1d7ac7[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')][_0xa170('0x1b')]({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0x50d546['id']}})[_0xa170('0x1c')](function(_0x49b524){if(!_[_0xa170('0x19')](_0x49b524)){throw new Error(_0xa170('0x25')+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x50d546['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x50d546['id']});})[_0xa170('0x2a')](function(_0xca2276){_0x2a633b(_0xca2276);});});});};var _0x487ce3=function(_0xf7de72){return new BPromise(function(_0xa4d14e,_0x2361c5){_0x21b457(_0xf7de72,_0x8e8e62)[_0xa170('0x1c')](function(_0x4fd496){_0x8e8e62[_0xa170('0x17')]=_0x4fd496[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')]['findOne']({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0xf7de72['id']}})[_0xa170('0x1c')](function(_0x34466c){if(!_[_0xa170('0x19')](_0x34466c)){throw new Error(_0xa170('0x25')+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xf7de72['id']);}return _0x1f5621[_0xa170('0x2b')][_0xa170('0x1b')]({'where':{'calleridnum':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0xf7de72['id']}});})['then'](function(_0x57826a){if(!_[_0xa170('0x19')](_0x57826a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xf7de72['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xf7de72['id']});})['catch'](function(_0x5dfd9d){_0x2361c5(_0x5dfd9d);});});});};function _0x2f4323(){return function(_0x4fcb9c){logger[_0xa170('0x2c')](_0xa170('0x2d'),'afterCreate',util[_0xa170('0x16')](_0x4fcb9c,{'showHidden':![],'depth':null}));};}function _0x11f0f9(_0x4371c0,_0xfccbe6){var _0x257c4f=_0xfccbe6[_0xa170('0x17')]?_0xfccbe6['scheduledat']:moment()[_0xa170('0x18')](_0xa170('0x22'));return new BPromise(function(_0x3d7a40,_0x4acb6a){if(_['isNil'](_0xfccbe6['dialTimezone'])){_0x3d7a40({'ret':_0x257c4f});}else{_0x1f5621['Campaign'][_0xa170('0x1b')]({'where':{'id':_0x4371c0['id']}})['then'](function(_0x560372){if(!_['isNil'](_0x560372)){var _0x7d9ea9=_0x560372['dialTimezone'];if(!_[_0xa170('0x19')](_0x7d9ea9)){var _0x5d40cf=shared[_0xa170('0x1e')];var _0x2223fe=_0x5d40cf[_0x7d9ea9];var _0x44da06=_0x5d40cf[_0xfccbe6[_0xa170('0x1d')]];if(!_[_0xa170('0x19')](_0x2223fe)&&!_['isNil'](_0x44da06)){var _0x3b2fb7=_0x2223fe[_0xa170('0x1f')]-_0x44da06[_0xa170('0x1f')];_0x257c4f=_0xfccbe6[_0xa170('0x17')]?_0xfccbe6[_0xa170('0x17')]:moment();var _0x4214bc=moment(_0x257c4f)[_0xa170('0x20')](_0x3b2fb7,'minutes');_0x3d7a40({'ret':_0x4214bc[_0xa170('0x18')](_0xa170('0x22'))});}else _0x3d7a40({'ret':_0x257c4f});}else _0x3d7a40({'ret':_0x257c4f});}else{_0x3d7a40({'ret':_0x257c4f});}});}});return 0xa;}var _0x5a9931=function(_0x22aa6a){return new BPromise(function(_0x4d98fb,_0x320af7){_0x11f0f9(_0x22aa6a,_0x8e8e62)[_0xa170('0x1c')](function(_0x20ae39){_0x8e8e62[_0xa170('0x17')]=_0x20ae39[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')]['findOne']({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x22aa6a['id']}})[_0xa170('0x1c')](function(_0x6dd7fd){if(!_[_0xa170('0x19')](_0x6dd7fd)){throw new Error(_0xa170('0x25')+_0x8e8e62['phone']+_0xa170('0x2e')+_0x22aa6a['id']);}return _0x1f5621[_0xa170('0x24')]['create']({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62['ListId'],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62['priority']:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x22aa6a['id']});})['catch'](function(_0x45c8c4){_0x320af7(_0x45c8c4);});});});};var _0x1fb1b1=function(_0x3bcea1){return new BPromise(function(_0x1b0fad,_0x2ab9dc){_0x11f0f9(_0x3bcea1,_0x8e8e62)[_0xa170('0x1c')](function(_0x285104){_0x8e8e62[_0xa170('0x17')]=_0x285104[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')][_0xa170('0x1b')]({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x3bcea1['id']}})[_0xa170('0x1c')](function(_0x2f434c){if(!_[_0xa170('0x19')](_0x2f434c)){throw new Error(_0xa170('0x25')+_0x8e8e62['phone']+_0xa170('0x2f')+_0x3bcea1['id']);}return _0x1f5621[_0xa170('0x2b')]['findOne']({'where':{'calleridnum':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x3bcea1['id']}});})[_0xa170('0x1c')](function(_0x148cf3){if(!_[_0xa170('0x19')](_0x148cf3)){throw new Error(_0xa170('0x30')+_0x8e8e62[_0xa170('0xa')]+_0xa170('0x31')+_0x3bcea1['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62['priority']?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62['callbackUniqueid']:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')](_0xa170('0x22')):undefined,'CampaignId':_0x3bcea1['id']});})[_0xa170('0x2a')](function(_0x1eef44){_0x2ab9dc(_0x1eef44);});});});};if(_0x8e8e62['ListId']){_0x1f5621['VoiceQueue'][_0xa170('0x32')]({'where':{'type':_0xa170('0x33')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x35'),'where':{'id':_0x8e8e62['ListId']}}]})[_0xa170('0x1c')](function(_0x2673ab){if(_0x2673ab){var _0xda6f5e=[];for(var _0x54f84e=0x0,_0x1bab56;_0x54f84e<_0x2673ab[_0xa170('0x36')];_0x54f84e+=0x1){_0x1bab56=_0x2673ab[_0x54f84e]['get']({'plain':!![]});switch(_0x1bab56[_0xa170('0x37')]){case _0xa170('0x38'):_0x487ce3(_0x1bab56)[_0xa170('0x2a')](_0x50f4b1());break;case _0xa170('0x39'):_0x10df83(_0x1bab56)[_0xa170('0x2a')](_0x50f4b1());break;default:_0x11f0f9(_0x1bab56,_0x8e8e62)['then'](function(_0x37e85f){_0x8e8e62['scheduledat']=_0x37e85f['ret'];_0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'scheduledat':_0x8e8e62['scheduledat']?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'callback':_0x8e8e62['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62['callbackUniqueid']?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1bab56['id']})[_0xa170('0x2a')](_0x50f4b1());});}}}})[_0xa170('0x1c')](function(){return _0x1f5621['VoiceQueue'][_0xa170('0x32')]({'where':{'type':_0xa170('0x33')},'attributes':['id'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x3a'),'where':{'id':_0x8e8e62[_0xa170('0x27')]}}]})['then'](function(_0xdf0026){if(_0xdf0026){var _0x2f7215=[];for(var _0x49f4f3=0x0,_0x438ca0;_0x49f4f3<_0xdf0026[_0xa170('0x36')];_0x49f4f3+=0x1){_0x438ca0=_0xdf0026[_0x49f4f3][_0xa170('0x14')]({'plain':!![]});_0x1f5621[_0xa170('0x3b')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62['ListId'],'VoiceQueueId':_0x438ca0['id']})[_0xa170('0x2a')](function(_0x400ff6){logger[_0xa170('0x2c')]('cmContact,\x20%s,\x20%s',_0xa170('0x15'),_0x400ff6[_0xa170('0x3c')]);});}}});})[_0xa170('0x1c')](function(){return _0x1f5621['Campaign'][_0xa170('0x32')]({'attributes':['id',_0xa170('0x37'),'dialTimezone'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x35'),'where':{'id':_0x8e8e62[_0xa170('0x27')]}}]})['then'](function(_0x18c741){if(_0x18c741){var _0x48742e=[];for(var _0x65c170=0x0,_0x3f8b48;_0x65c170<_0x18c741[_0xa170('0x36')];_0x65c170+=0x1){_0x3f8b48=_0x18c741[_0x65c170][_0xa170('0x14')]({'plain':!![]});switch(_0x3f8b48['dialCheckDuplicateType']){case _0xa170('0x38'):_0x1fb1b1(_0x3f8b48)['catch'](_0x2f4323());break;case _0xa170('0x39'):_0x5a9931(_0x3f8b48)[_0xa170('0x2a')](_0x2f4323());break;default:_0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')](_0xa170('0x22')),'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62['priority']:0x2,'callback':_0x8e8e62['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x8e8e62['callbackUniqueid']?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3f8b48['id']})['catch'](_0x2f4323());}}}});})['then'](function(){return _0x1f5621[_0xa170('0x3d')]['findAll']({'attributes':['id'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x3a'),'where':{'id':_0x8e8e62['ListId']}}]})[_0xa170('0x1c')](function(_0x3b30dc){if(_0x3b30dc){var _0xafec24=[];for(var _0x3270c8=0x0,_0x2bcfaa;_0x3270c8<_0x3b30dc[_0xa170('0x36')];_0x3270c8+=0x1){_0x2bcfaa=_0x3b30dc[_0x3270c8][_0xa170('0x14')]({'plain':!![]});_0x1f5621[_0xa170('0x3b')]['create']({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'CampaignId':_0x2bcfaa['id']})[_0xa170('0x2a')](function(_0x3fdf12){logger['error'](_0xa170('0x3e'),'afterCreate',_0x3fdf12['message']);});}}});})[_0xa170('0x1c')](function(){_0x4397c2();})[_0xa170('0x2a')](function(_0x91501c){logger[_0xa170('0x2c')]('cmContact,\x20%s,\x20%s','afterCreate',_0x91501c[_0xa170('0x3c')]);_0x4397c2(_0x91501c);});}else{_0x4397c2(new Error(_0xa170('0x3f')));}},'afterDestroy':function(_0x55a825,_0x209283,_0x402fb2){var _0x42e4a7=_0x42677f[_0xa170('0x13')];var _0x55d7c8=_0x55a825[_0xa170('0x14')]({'plain':!![]});return _0x42e4a7[_0xa170('0x24')][_0xa170('0x32')]({'raw':!![],'where':{'ListId':_0x55d7c8[_0xa170('0x27')],'ContactId':_0x55d7c8['id']}})[_0xa170('0x1c')](function(_0x52b02d){if(!_[_0xa170('0x40')](_0x52b02d)){var _0x3e1b5b=[];for(var _0xe1f354=0x0;_0xe1f354<_0x52b02d[_0xa170('0x36')];_0xe1f354+=0x1){var _0x4f5db5=_0x42e4a7[_0xa170('0x24')][_0xa170('0x41')]({'where':{'ListId':_0x52b02d[_0xe1f354]['ListId'],'ContactId':_0x52b02d[_0xe1f354][_0xa170('0x42')],'VoiceQueueId':_0x52b02d[_0xe1f354]['VoiceQueueId'],'CampaignId':_0x52b02d[_0xe1f354]['CampaignId']}});_0x3e1b5b['push'](_0x4f5db5);}return BPromise[_0xa170('0x43')](_0x3e1b5b);}})[_0xa170('0x1c')](function(_0x5f19f5){logger[_0xa170('0x44')](_0xa170('0x45'),util[_0xa170('0x16')](_0x5f19f5,{'showHidden':![],'depth':null}));_0x402fb2();})[_0xa170('0x2a')](function(_0xcfb593){logger['error'](_0xa170('0x46'),util[_0xa170('0x16')](_0xcfb593,{'showHidden':![],'depth':null}));_0x402fb2(_0xcfb593);});}}});}; \ No newline at end of file +var _0x5711=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','length','dialCheckDuplicateType','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','afterCreate','message','CmList','Lists','always','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5711,0x17b));var _0x1571=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x5711[_0x72a33d];return _0x2621d5;};'use strict';var _=require('lodash');var util=require(_0x1571('0x0'));var logger=require(_0x1571('0x1'))(_0x1571('0x2'));var moment=require(_0x1571('0x3'));var BPromise=require(_0x1571('0x4'));var rp=require(_0x1571('0x5'));var fs=require('fs');var path=require(_0x1571('0x6'));var rimraf=require(_0x1571('0x7'));var config=require('../../config/environment');var shared=require(_0x1571('0x8'));var attributes=require(_0x1571('0x9'));module[_0x1571('0xa')]=function(_0x2c8a65,_0x5c8cc1){return _0x2c8a65[_0x1571('0xb')]('CmContact',attributes,{'tableName':_0x1571('0xc'),'paranoid':!![],'indexes':[{'name':_0x1571('0xd'),'fields':[_0x1571('0xd')]},{'name':_0x1571('0xe'),'fields':[_0x1571('0xf'),_0x1571('0x10'),_0x1571('0xd'),_0x1571('0x11'),_0x1571('0x12'),_0x1571('0x13')],'type':_0x1571('0x14')}],'timestamps':!![],'charset':_0x1571('0x15'),'collate':_0x1571('0x16'),'hooks':{'afterCreate':function(_0x4e67d1,_0x4988ee,_0x1952f6){var _0x187062=_0x2c8a65[_0x1571('0x17')];var _0x30a9ba=_0x4e67d1[_0x1571('0x18')]({'plain':!![]});function _0x19d5a1(){return function(_0x456122){logger[_0x1571('0x19')](_0x1571('0x1a'),'afterCreate',util['inspect'](_0x456122,{'showHidden':![],'depth':null}));};}function _0x5e7b4a(_0x160fa2,_0x3e9154){var _0x2be727=_0x3e9154[_0x1571('0x1b')]?_0x3e9154[_0x1571('0x1b')]:moment()[_0x1571('0x1c')](_0x1571('0x1d'));return new BPromise(function(_0x15b378,_0x3f6c3c){if(_[_0x1571('0x1e')](_0x3e9154['dialTimezone'])){_0x15b378({'ret':_0x2be727});}else{_0x187062[_0x1571('0x1f')][_0x1571('0x20')]({'where':{'id':_0x160fa2['id']}})[_0x1571('0x21')](function(_0x33e1e0){if(!_[_0x1571('0x1e')](_0x33e1e0)){var _0x4a6749=_0x33e1e0[_0x1571('0x22')];if(!_['isNil'](_0x4a6749)){var _0x2069ca=shared[_0x1571('0x23')];var _0x1cb454=_0x2069ca[_0x4a6749];var _0x2c1dca=_0x2069ca[_0x3e9154[_0x1571('0x22')]];if(!_['isNil'](_0x1cb454)&&!_[_0x1571('0x1e')](_0x2c1dca)){var _0x170f1d=_0x1cb454[_0x1571('0x24')]-_0x2c1dca[_0x1571('0x24')];_0x2be727=_0x3e9154[_0x1571('0x1b')]?_0x3e9154['scheduledat']:moment();var _0x5968ee=moment(_0x2be727)[_0x1571('0x25')](_0x170f1d,_0x1571('0x26'));_0x15b378({'ret':_0x5968ee['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x15b378({'ret':_0x2be727});}else _0x15b378({'ret':_0x2be727});}else{_0x15b378({'ret':_0x2be727});}});}});return 0xa;}var _0x3acb48=function(_0x3b3575){return new BPromise(function(_0x161ca6,_0x5ccd89){_0x5e7b4a(_0x3b3575,_0x30a9ba)['then'](function(_0x12b37e){_0x30a9ba[_0x1571('0x1b')]=_0x12b37e['ret'];_0x187062['CmHopper'][_0x1571('0x20')]({'where':{'phone':_0x30a9ba[_0x1571('0xd')],'VoiceQueueId':_0x3b3575['id']}})['then'](function(_0x150a58){if(!_[_0x1571('0x1e')](_0x150a58)){throw new Error(_0x1571('0x27')+_0x30a9ba[_0x1571('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x3b3575['id']);}return _0x187062[_0x1571('0x28')][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'priority':_0x30a9ba['priority']?_0x30a9ba[_0x1571('0x2b')]:0x2,'scheduledat':_0x30a9ba[_0x1571('0x1b')]?_0x30a9ba[_0x1571('0x1b')]:moment()[_0x1571('0x1c')](_0x1571('0x1d')),'callback':_0x30a9ba[_0x1571('0x2c')]?!![]:![],'callbackuniqueid':_0x30a9ba['callbackUniqueid']?_0x30a9ba[_0x1571('0x2c')]:undefined,'callbackat':_0x30a9ba['callbackUniqueid']?moment()[_0x1571('0x1c')](_0x1571('0x1d')):undefined,'VoiceQueueId':_0x3b3575['id']});})[_0x1571('0x2d')](function(_0x5acc44){_0x5ccd89(_0x5acc44);});});});};var _0x5de752=function(_0x3bf681){return new BPromise(function(_0x632987,_0xa710b6){_0x5e7b4a(_0x3bf681,_0x30a9ba)[_0x1571('0x21')](function(_0x15e33d){_0x30a9ba[_0x1571('0x1b')]=_0x15e33d[_0x1571('0x2e')];_0x187062[_0x1571('0x28')][_0x1571('0x20')]({'where':{'phone':_0x30a9ba[_0x1571('0xd')],'VoiceQueueId':_0x3bf681['id']}})['then'](function(_0x21a796){if(!_[_0x1571('0x1e')](_0x21a796)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30a9ba[_0x1571('0xd')]+_0x1571('0x2f')+_0x3bf681['id']);}return _0x187062[_0x1571('0x30')]['findOne']({'where':{'calleridnum':_0x30a9ba[_0x1571('0xd')],'VoiceQueueId':_0x3bf681['id']}});})[_0x1571('0x21')](function(_0x418fd6){if(!_[_0x1571('0x1e')](_0x418fd6)){throw new Error(_0x1571('0x31')+_0x30a9ba[_0x1571('0xd')]+_0x1571('0x32')+_0x3bf681['id']);}return _0x187062[_0x1571('0x28')][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'priority':_0x30a9ba[_0x1571('0x2b')]?_0x30a9ba[_0x1571('0x2b')]:0x2,'scheduledat':_0x30a9ba[_0x1571('0x1b')]?_0x30a9ba[_0x1571('0x1b')]:moment()[_0x1571('0x1c')](_0x1571('0x1d')),'callback':_0x30a9ba[_0x1571('0x2c')]?!![]:![],'callbackuniqueid':_0x30a9ba[_0x1571('0x2c')]?_0x30a9ba[_0x1571('0x2c')]:undefined,'callbackat':_0x30a9ba[_0x1571('0x2c')]?moment()['format'](_0x1571('0x1d')):undefined,'VoiceQueueId':_0x3bf681['id']});})[_0x1571('0x2d')](function(_0x5766d9){_0xa710b6(_0x5766d9);});});});};function _0x5f153c(){return function(_0x1e82d3){logger[_0x1571('0x19')]('cmContact','afterCreate',util[_0x1571('0x33')](_0x1e82d3,{'showHidden':![],'depth':null}));};}function _0x337614(_0x4e0883,_0x3b5c47){var _0x25d024=_0x3b5c47[_0x1571('0x1b')]?_0x3b5c47['scheduledat']:moment()['format'](_0x1571('0x1d'));return new BPromise(function(_0xd3b3aa,_0x3dc4fc){if(_['isNil'](_0x3b5c47[_0x1571('0x22')])){_0xd3b3aa({'ret':_0x25d024});}else{_0x187062[_0x1571('0x34')][_0x1571('0x20')]({'where':{'id':_0x4e0883['id']}})[_0x1571('0x21')](function(_0x476a92){if(!_[_0x1571('0x1e')](_0x476a92)){var _0x276339=_0x476a92[_0x1571('0x22')];if(!_[_0x1571('0x1e')](_0x276339)){var _0x1b3779=shared[_0x1571('0x23')];var _0x254d82=_0x1b3779[_0x276339];var _0x165d6f=_0x1b3779[_0x3b5c47['dialTimezone']];if(!_[_0x1571('0x1e')](_0x254d82)&&!_[_0x1571('0x1e')](_0x165d6f)){var _0x3e778d=_0x254d82[_0x1571('0x24')]-_0x165d6f[_0x1571('0x24')];_0x25d024=_0x3b5c47[_0x1571('0x1b')]?_0x3b5c47[_0x1571('0x1b')]:moment();var _0x15e6e8=moment(_0x25d024)['add'](_0x3e778d,'minutes');_0xd3b3aa({'ret':_0x15e6e8['format'](_0x1571('0x1d'))});}else _0xd3b3aa({'ret':_0x25d024});}else _0xd3b3aa({'ret':_0x25d024});}else{_0xd3b3aa({'ret':_0x25d024});}});}});return 0xa;}var _0x3326e8=function(_0x66591){return new BPromise(function(_0x19c086,_0x14c50e){_0x337614(_0x66591,_0x30a9ba)[_0x1571('0x21')](function(_0x41f931){_0x30a9ba['scheduledat']=_0x41f931['ret'];_0x187062[_0x1571('0x28')]['findOne']({'where':{'phone':_0x30a9ba[_0x1571('0xd')],'CampaignId':_0x66591['id']}})[_0x1571('0x21')](function(_0x5b2a9f){if(!_['isNil'](_0x5b2a9f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30a9ba[_0x1571('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x66591['id']);}return _0x187062[_0x1571('0x28')][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'priority':_0x30a9ba[_0x1571('0x2b')]?_0x30a9ba[_0x1571('0x2b')]:0x2,'scheduledat':_0x30a9ba['scheduledat']?_0x30a9ba[_0x1571('0x1b')]:moment()[_0x1571('0x1c')](_0x1571('0x1d')),'callback':_0x30a9ba[_0x1571('0x2c')]?!![]:![],'callbackuniqueid':_0x30a9ba[_0x1571('0x2c')]?_0x30a9ba[_0x1571('0x2c')]:undefined,'callbackat':_0x30a9ba[_0x1571('0x2c')]?moment()[_0x1571('0x1c')](_0x1571('0x1d')):undefined,'CampaignId':_0x66591['id']});})[_0x1571('0x2d')](function(_0x13838f){_0x14c50e(_0x13838f);});});});};var _0x1fcea7=function(_0x12bba2){return new BPromise(function(_0xdebffa,_0xb3cb22){_0x337614(_0x12bba2,_0x30a9ba)[_0x1571('0x21')](function(_0x5cfaf7){_0x30a9ba[_0x1571('0x1b')]=_0x5cfaf7[_0x1571('0x2e')];_0x187062[_0x1571('0x28')][_0x1571('0x20')]({'where':{'phone':_0x30a9ba[_0x1571('0xd')],'CampaignId':_0x12bba2['id']}})['then'](function(_0x53a475){if(!_['isNil'](_0x53a475)){throw new Error('cmContact,\x20afterCreate\x20'+_0x30a9ba[_0x1571('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x12bba2['id']);}return _0x187062[_0x1571('0x30')][_0x1571('0x20')]({'where':{'calleridnum':_0x30a9ba[_0x1571('0xd')],'CampaignId':_0x12bba2['id']}});})[_0x1571('0x21')](function(_0x459dd5){if(!_[_0x1571('0x1e')](_0x459dd5)){throw new Error(_0x1571('0x31')+_0x30a9ba[_0x1571('0xd')]+_0x1571('0x35')+_0x12bba2['id']);}return _0x187062[_0x1571('0x28')]['create']({'phone':_0x30a9ba['phone'],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'priority':_0x30a9ba[_0x1571('0x2b')]?_0x30a9ba[_0x1571('0x2b')]:0x2,'scheduledat':_0x30a9ba[_0x1571('0x1b')]?_0x30a9ba[_0x1571('0x1b')]:moment()[_0x1571('0x1c')](_0x1571('0x1d')),'callback':_0x30a9ba[_0x1571('0x2c')]?!![]:![],'callbackuniqueid':_0x30a9ba['callbackUniqueid']?_0x30a9ba['callbackUniqueid']:undefined,'callbackat':_0x30a9ba[_0x1571('0x2c')]?moment()[_0x1571('0x1c')](_0x1571('0x1d')):undefined,'CampaignId':_0x12bba2['id']});})['catch'](function(_0x2d491e){_0xb3cb22(_0x2d491e);});});});};if(_0x30a9ba[_0x1571('0x2a')]){_0x187062['VoiceQueue'][_0x1571('0x36')]({'where':{'type':_0x1571('0x37')},'attributes':['id','dialCheckDuplicateType',_0x1571('0x22')],'include':[{'model':_0x187062['CmList'],'as':'Lists','where':{'id':_0x30a9ba[_0x1571('0x2a')]}}]})[_0x1571('0x21')](function(_0x1598e2){if(_0x1598e2){var _0x94d68f=[];for(var _0x45323d=0x0,_0x159c8e;_0x45323d<_0x1598e2[_0x1571('0x38')];_0x45323d+=0x1){_0x159c8e=_0x1598e2[_0x45323d][_0x1571('0x18')]({'plain':!![]});switch(_0x159c8e[_0x1571('0x39')]){case'always':_0x5de752(_0x159c8e)[_0x1571('0x2d')](_0x19d5a1());break;case _0x1571('0x3a'):_0x3acb48(_0x159c8e)[_0x1571('0x2d')](_0x19d5a1());break;default:_0x337614(_0x159c8e,_0x30a9ba)[_0x1571('0x21')](function(_0xb308ac){_0x30a9ba['scheduledat']=_0xb308ac[_0x1571('0x2e')];_0x187062['CmHopper'][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'scheduledat':_0x30a9ba[_0x1571('0x1b')]?_0x30a9ba['scheduledat']:moment()[_0x1571('0x1c')](_0x1571('0x1d')),'priority':_0x30a9ba[_0x1571('0x2b')]?_0x30a9ba['priority']:0x2,'callback':_0x30a9ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30a9ba['callbackUniqueid']?_0x30a9ba['callbackUniqueid']:undefined,'callbackat':_0x30a9ba[_0x1571('0x2c')]?moment()[_0x1571('0x1c')](_0x1571('0x1d')):undefined,'VoiceQueueId':_0x159c8e['id']})[_0x1571('0x2d')](_0x19d5a1());});}}}})[_0x1571('0x21')](function(){return _0x187062['VoiceQueue'][_0x1571('0x36')]({'where':{'type':_0x1571('0x37')},'attributes':['id'],'include':[{'model':_0x187062['CmList'],'as':_0x1571('0x3b'),'where':{'id':_0x30a9ba['ListId']}}]})[_0x1571('0x21')](function(_0xa674ce){if(_0xa674ce){var _0x5d5a64=[];for(var _0x4a55f7=0x0,_0x47dabd;_0x4a55f7<_0xa674ce[_0x1571('0x38')];_0x4a55f7+=0x1){_0x47dabd=_0xa674ce[_0x4a55f7][_0x1571('0x18')]({'plain':!![]});_0x187062['CmHopperBlack'][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba[_0x1571('0x2a')],'VoiceQueueId':_0x47dabd['id']})[_0x1571('0x2d')](function(_0x58b47d){logger[_0x1571('0x19')](_0x1571('0x3c'),_0x1571('0x3d'),_0x58b47d[_0x1571('0x3e')]);});}}});})[_0x1571('0x21')](function(){return _0x187062[_0x1571('0x34')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x187062[_0x1571('0x3f')],'as':_0x1571('0x40'),'where':{'id':_0x30a9ba[_0x1571('0x2a')]}}]})['then'](function(_0x3861cc){if(_0x3861cc){var _0x5cd7d1=[];for(var _0x5d3cdc=0x0,_0x3995c9;_0x5d3cdc<_0x3861cc[_0x1571('0x38')];_0x5d3cdc+=0x1){_0x3995c9=_0x3861cc[_0x5d3cdc][_0x1571('0x18')]({'plain':!![]});switch(_0x3995c9[_0x1571('0x39')]){case _0x1571('0x41'):_0x1fcea7(_0x3995c9)[_0x1571('0x2d')](_0x5f153c());break;case _0x1571('0x3a'):_0x3326e8(_0x3995c9)['catch'](_0x5f153c());break;default:_0x187062[_0x1571('0x28')][_0x1571('0x29')]({'phone':_0x30a9ba[_0x1571('0xd')],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba['ListId'],'scheduledat':_0x30a9ba['scheduledat']?_0x30a9ba[_0x1571('0x1b')]:moment()[_0x1571('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x30a9ba[_0x1571('0x2b')]?_0x30a9ba['priority']:0x2,'callback':_0x30a9ba[_0x1571('0x2c')]?!![]:![],'callbackuniqueid':_0x30a9ba[_0x1571('0x2c')]?_0x30a9ba[_0x1571('0x2c')]:undefined,'callbackat':_0x30a9ba[_0x1571('0x2c')]?moment()[_0x1571('0x1c')](_0x1571('0x1d')):undefined,'CampaignId':_0x3995c9['id']})[_0x1571('0x2d')](_0x5f153c());}}}});})['then'](function(){return _0x187062[_0x1571('0x34')][_0x1571('0x36')]({'attributes':['id'],'include':[{'model':_0x187062[_0x1571('0x3f')],'as':'BlackLists','where':{'id':_0x30a9ba[_0x1571('0x2a')]}}]})[_0x1571('0x21')](function(_0x5c138f){if(_0x5c138f){var _0x451cd4=[];for(var _0x5d4fd9=0x0,_0x435385;_0x5d4fd9<_0x5c138f[_0x1571('0x38')];_0x5d4fd9+=0x1){_0x435385=_0x5c138f[_0x5d4fd9][_0x1571('0x18')]({'plain':!![]});_0x187062['CmHopperBlack'][_0x1571('0x29')]({'phone':_0x30a9ba['phone'],'ContactId':_0x30a9ba['id'],'ListId':_0x30a9ba['ListId'],'CampaignId':_0x435385['id']})['catch'](function(_0x4d94f8){logger[_0x1571('0x19')]('cmContact,\x20%s,\x20%s','afterCreate',_0x4d94f8[_0x1571('0x3e')]);});}}});})[_0x1571('0x21')](function(){_0x1952f6();})[_0x1571('0x2d')](function(_0x17e468){logger[_0x1571('0x19')](_0x1571('0x3c'),_0x1571('0x3d'),_0x17e468[_0x1571('0x3e')]);_0x1952f6(_0x17e468);});}else{_0x1952f6(new Error(_0x1571('0x42')));}},'afterDestroy':function(_0x4224e7,_0x4635e1,_0x2688e4){var _0x331520=_0x2c8a65[_0x1571('0x17')];var _0x37997b=_0x4224e7[_0x1571('0x18')]({'plain':!![]});return _0x331520[_0x1571('0x28')][_0x1571('0x36')]({'raw':!![],'where':{'ListId':_0x37997b[_0x1571('0x2a')],'ContactId':_0x37997b['id']}})['then'](function(_0x4c41ae){if(!_[_0x1571('0x43')](_0x4c41ae)){var _0x9e49c3=[];for(var _0x209f60=0x0;_0x209f60<_0x4c41ae[_0x1571('0x38')];_0x209f60+=0x1){var _0x4cae1e=_0x331520['CmHopper'][_0x1571('0x44')]({'where':{'ListId':_0x4c41ae[_0x209f60][_0x1571('0x2a')],'ContactId':_0x4c41ae[_0x209f60][_0x1571('0x45')],'VoiceQueueId':_0x4c41ae[_0x209f60]['VoiceQueueId'],'CampaignId':_0x4c41ae[_0x209f60][_0x1571('0x46')]}});_0x9e49c3[_0x1571('0x47')](_0x4cae1e);}return BPromise[_0x1571('0x48')](_0x9e49c3);}})[_0x1571('0x21')](function(_0x41b8ab){logger[_0x1571('0x49')](_0x1571('0x4a'),util[_0x1571('0x33')](_0x41b8ab,{'showHidden':![],'depth':null}));_0x2688e4();})['catch'](function(_0x42a464){logger['error'](_0x1571('0x4b'),util[_0x1571('0x33')](_0x42a464,{'showHidden':![],'depth':null}));_0x2688e4(_0x42a464);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index c7bee05..fd9d776 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(_0x4e9bde,_0x1def12){var _0x2f0194=function(_0xd5b7ac){while(--_0xd5b7ac){_0x4e9bde['push'](_0x4e9bde['shift']());}};_0x2f0194(++_0x1def12);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x56bdd4,_0x5eca23){var _0x29475c=function(_0x257ffb){while(--_0x257ffb){_0x56bdd4['push'](_0x56bdd4['shift']());}};_0x29475c(++_0x5eca23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 4ff36d8..d5c22a1 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 _0x02ef=['sequelize','INTEGER','STRING'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x02ef,0x11a));var _0xf02e=function(_0x51a023,_0x40ff38){_0x51a023=_0x51a023-0x0;var _0x1dfe91=_0x02ef[_0x51a023];return _0x1dfe91;};'use strict';var Sequelize=require(_0xf02e('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xf02e('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf02e('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf02e('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xf02e('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xf02e('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x0531=['INTEGER','STRING','sequelize','exports'];(function(_0x1ba995,_0x46e0e3){var _0x4798bf=function(_0x544294){while(--_0x544294){_0x1ba995['push'](_0x1ba995['shift']());}};_0x4798bf(++_0x46e0e3);}(_0x0531,0xde));var _0x1053=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x0531[_0x1e8b1e];return _0x4a0fde;};'use strict';var Sequelize=require(_0x1053('0x0'));module[_0x1053('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1053('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x1053('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x1053('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 f0c6172..7dc1896 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 _0x650f=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','name','status','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit'];(function(_0x2da5,_0x155a77){var _0x393fa9=function(_0xfb161e){while(--_0xfb161e){_0x2da5['push'](_0x2da5['shift']());}};_0x393fa9(++_0x155a77);}(_0x650f,0x1c1));var _0xf650=function(_0x4ba636,_0x71c18c){_0x4ba636=_0x4ba636-0x0;var _0x487c69=_0x650f[_0x4ba636];return _0x487c69;};'use strict';var emlformat=require(_0xf650('0x0'));var rimraf=require(_0xf650('0x1'));var zipdir=require(_0xf650('0x2'));var jsonpatch=require(_0xf650('0x3'));var rp=require(_0xf650('0x4'));var moment=require('moment');var BPromise=require(_0xf650('0x5'));var Mustache=require('mustache');var util=require(_0xf650('0x6'));var path=require(_0xf650('0x7'));var sox=require(_0xf650('0x8'));var csv=require(_0xf650('0x9'));var ejs=require(_0xf650('0xa'));var fs=require('fs');var fs_extra=require(_0xf650('0xb'));var _=require(_0xf650('0xc'));var squel=require('squel');var crypto=require(_0xf650('0xd'));var jsforce=require(_0xf650('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf650('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf650('0x10'));var hardwareService=require(_0xf650('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf650('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf650('0x13'));var db=require(_0xf650('0x14'))['db'];function respondWithStatusCode(_0x2a1302,_0xe942c2){_0xe942c2=_0xe942c2||0xcc;return function(_0x24c656){if(_0x24c656){return _0x2a1302[_0xf650('0x15')](_0xe942c2);}return _0x2a1302['status'](_0xe942c2)[_0xf650('0x16')]();};}function respondWithResult(_0x24ad5c,_0x123618){_0x123618=_0x123618||0xc8;return function(_0x147dea){if(_0x147dea){return _0x24ad5c['status'](_0x123618)[_0xf650('0x17')](_0x147dea);}};}function respondWithFilteredResult(_0x5589a6,_0x3cb81c){return function(_0x3fbfae){if(_0x3fbfae){var _0x4acc05=typeof _0x3cb81c['offset']==='undefined'&&typeof _0x3cb81c[_0xf650('0x18')]==='undefined';var _0x59a65b=_0x3fbfae[_0xf650('0x19')];var _0x3dbf11=_0x4acc05?0x0:_0x3cb81c['offset'];var _0x46b299=_0x4acc05?_0x3fbfae['count']:_0x3cb81c[_0xf650('0x1a')]+_0x3cb81c[_0xf650('0x18')];var _0x21ac28;if(_0x46b299>=_0x59a65b){_0x46b299=_0x59a65b;_0x21ac28=0xc8;}else{_0x21ac28=0xce;}_0x5589a6['status'](_0x21ac28);return _0x5589a6[_0xf650('0x1b')](_0xf650('0x1c'),_0x3dbf11+'-'+_0x46b299+'/'+_0x59a65b)[_0xf650('0x17')](_0x3fbfae);}return null;};}function patchUpdates(_0x3eaf28){return function(_0x2f8d74){try{jsonpatch[_0xf650('0x1d')](_0x2f8d74,_0x3eaf28,!![]);}catch(_0x2f5628){return BPromise[_0xf650('0x1e')](_0x2f5628);}return _0x2f8d74[_0xf650('0x1f')]();};}function saveUpdates(_0x350c5e,_0x5a35eb){return function(_0x3e4931){if(_0x3e4931){return _0x3e4931[_0xf650('0x20')](_0x350c5e)[_0xf650('0x21')](function(_0x4998dd){return _0x4998dd;});}return null;};}function removeEntity(_0x105794,_0x1a17e4){return function(_0x9c2632){if(_0x9c2632){return _0x9c2632[_0xf650('0x22')]()[_0xf650('0x21')](function(){var _0x2b456c=_0x9c2632['get']({'plain':!![]});var _0x4de1cb=_0xf650('0x23');return db[_0xf650('0x24')]['destroy']({'where':{'type':_0x4de1cb,'resourceId':_0x2b456c['id']}})[_0xf650('0x21')](function(){return _0x9c2632;});})['then'](function(){_0x105794['status'](0xcc)[_0xf650('0x16')]();});}};}function handleEntityNotFound(_0x39b3cb,_0x1560da){return function(_0x3429a0){if(!_0x3429a0){_0x39b3cb[_0xf650('0x15')](0x194);}return _0x3429a0;};}function handleError(_0x3e8cd6,_0x4c0905){_0x4c0905=_0x4c0905||0x1f4;return function(_0x370d56){logger['error'](_0x370d56['stack']);if(_0x370d56['name']){delete _0x370d56[_0xf650('0x25')];}_0x3e8cd6[_0xf650('0x26')](_0x4c0905)[_0xf650('0x27')](_0x370d56);};}exports[_0xf650('0x28')]=function(_0x3cbd49,_0x492ee8){var _0x560b77={},_0xf05c5a={},_0x3ef1e1={'count':0x0,'rows':[]};var _0x6381b3=_['map'](db[_0xf650('0x29')][_0xf650('0x2a')],function(_0x6a6c5a){return{'name':_0x6a6c5a[_0xf650('0x2b')],'type':_0x6a6c5a[_0xf650('0x2c')][_0xf650('0x2d')]};});_0xf05c5a[_0xf650('0x2e')]=_[_0xf650('0x2f')](_0x6381b3,'name');_0xf05c5a[_0xf650('0x30')]=_['keys'](_0x3cbd49['query']);_0xf05c5a[_0xf650('0x31')]=_[_0xf650('0x32')](_0xf05c5a[_0xf650('0x2e')],_0xf05c5a[_0xf650('0x30')]);_0x560b77[_0xf650('0x33')]=_[_0xf650('0x32')](_0xf05c5a['model'],qs[_0xf650('0x34')](_0x3cbd49[_0xf650('0x30')][_0xf650('0x34')]));_0x560b77[_0xf650('0x33')]=_0x560b77[_0xf650('0x33')][_0xf650('0x35')]?_0x560b77['attributes']:_0xf05c5a['model'];if(!_0x3cbd49[_0xf650('0x30')]['hasOwnProperty']('nolimit')){_0x560b77[_0xf650('0x18')]=qs[_0xf650('0x18')](_0x3cbd49['query'][_0xf650('0x18')]);_0x560b77['offset']=qs[_0xf650('0x1a')](_0x3cbd49[_0xf650('0x30')][_0xf650('0x1a')]);}_0x560b77[_0xf650('0x36')]=qs[_0xf650('0x37')](_0x3cbd49[_0xf650('0x30')]['sort']);_0x560b77[_0xf650('0x38')]=qs[_0xf650('0x31')](_[_0xf650('0x39')](_0x3cbd49[_0xf650('0x30')],_0xf05c5a[_0xf650('0x31')]),_0x6381b3);if(_0x3cbd49[_0xf650('0x30')]['filter']){_0x560b77[_0xf650('0x38')]=_[_0xf650('0x3a')](_0x560b77['where'],{'$or':_[_0xf650('0x2f')](_0x6381b3,function(_0x958dfc){if(_0x958dfc[_0xf650('0x2c')]!==_0xf650('0x3b')){var _0x2b8cdf={};_0x2b8cdf[_0x958dfc[_0xf650('0x25')]]={'$like':'%'+_0x3cbd49[_0xf650('0x30')]['filter']+'%'};return _0x2b8cdf;}})});}_0x560b77=_[_0xf650('0x3a')]({},_0x560b77,_0x3cbd49[_0xf650('0x3c')]);var _0x1c2722={'where':_0x560b77[_0xf650('0x38')]};return db[_0xf650('0x29')][_0xf650('0x19')](_0x1c2722)[_0xf650('0x21')](function(_0x210225){_0x3ef1e1['count']=_0x210225;if(_0x3cbd49['query'][_0xf650('0x3d')]){_0x560b77[_0xf650('0x3e')]=[{'all':!![]}];}return db[_0xf650('0x29')][_0xf650('0x3f')](_0x560b77);})[_0xf650('0x21')](function(_0x160162){_0x3ef1e1['rows']=_0x160162;return _0x3ef1e1;})['then'](respondWithFilteredResult(_0x492ee8,_0x560b77))[_0xf650('0x40')](handleError(_0x492ee8,null));};exports[_0xf650('0x41')]=function(_0x2f0480,_0x1b4eab){var _0x72f624={'raw':!![],'where':{'id':_0x2f0480[_0xf650('0x42')]['id']}},_0x55b734={};_0x55b734[_0xf650('0x2e')]=_['keys'](db[_0xf650('0x29')]['rawAttributes']);_0x55b734['query']=_[_0xf650('0x43')](_0x2f0480[_0xf650('0x30')]);_0x55b734['filters']=_[_0xf650('0x32')](_0x55b734[_0xf650('0x2e')],_0x55b734[_0xf650('0x30')]);_0x72f624[_0xf650('0x33')]=_['intersection'](_0x55b734['model'],qs['fields'](_0x2f0480[_0xf650('0x30')][_0xf650('0x34')]));_0x72f624[_0xf650('0x33')]=_0x72f624['attributes'][_0xf650('0x35')]?_0x72f624[_0xf650('0x33')]:_0x55b734[_0xf650('0x2e')];if(_0x2f0480[_0xf650('0x30')][_0xf650('0x3d')]){_0x72f624[_0xf650('0x3e')]=[{'all':!![]}];}_0x72f624=_['merge']({},_0x72f624,_0x2f0480[_0xf650('0x3c')]);return db[_0xf650('0x29')][_0xf650('0x44')](_0x72f624)[_0xf650('0x21')](handleEntityNotFound(_0x1b4eab,null))[_0xf650('0x21')](respondWithResult(_0x1b4eab,null))[_0xf650('0x40')](handleError(_0x1b4eab,null));};exports['create']=function(_0x176284,_0x29b20f){return db[_0xf650('0x29')][_0xf650('0x45')](_0x176284['body'],{})[_0xf650('0x21')](function(_0x4302dd){var _0x3b2c20=_0x176284['user'][_0xf650('0x46')]({'plain':!![]});if(!_0x3b2c20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2c20[_0xf650('0x47')]===_0xf650('0x48')){var _0x255ce5=_0x4302dd['get']({'plain':!![]});var _0x569b19=_0xf650('0x23');return db[_0xf650('0x49')]['find']({'where':{'name':_0x569b19,'userProfileId':_0x3b2c20[_0xf650('0x4a')]},'raw':!![]})[_0xf650('0x21')](function(_0x96c950){if(_0x96c950&&_0x96c950[_0xf650('0x4b')]===0x0){return db[_0xf650('0x24')][_0xf650('0x45')]({'name':_0x255ce5[_0xf650('0x25')],'resourceId':_0x255ce5['id'],'type':_0x96c950[_0xf650('0x25')],'sectionId':_0x96c950['id']},{})[_0xf650('0x21')](function(){return _0x4302dd;});}else{return _0x4302dd;}})['catch'](function(_0x228cad){logger[_0xf650('0x4c')](_0xf650('0x4d'),_0x228cad);throw _0x228cad;});}return _0x4302dd;})[_0xf650('0x21')](respondWithResult(_0x29b20f,0xc9))[_0xf650('0x40')](handleError(_0x29b20f,null));};exports[_0xf650('0x20')]=function(_0x2103c7,_0xa710b7){if(_0x2103c7[_0xf650('0x4e')]['id']){delete _0x2103c7['body']['id'];}return db[_0xf650('0x29')]['find']({'where':{'id':_0x2103c7[_0xf650('0x42')]['id']}})[_0xf650('0x21')](handleEntityNotFound(_0xa710b7,null))[_0xf650('0x21')](saveUpdates(_0x2103c7[_0xf650('0x4e')],null))[_0xf650('0x21')](respondWithResult(_0xa710b7,null))[_0xf650('0x40')](handleError(_0xa710b7,null));};exports[_0xf650('0x22')]=function(_0x4eb65a,_0x4560ec){return db[_0xf650('0x29')][_0xf650('0x44')]({'where':{'id':_0x4eb65a[_0xf650('0x42')]['id']}})[_0xf650('0x21')](handleEntityNotFound(_0x4560ec,null))[_0xf650('0x21')](removeEntity(_0x4560ec,null))[_0xf650('0x40')](handleError(_0x4560ec,null));}; \ No newline at end of file +var _0x58ff=['nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','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','moment','path','to-csv','fs-extra','lodash','squel','jsforce','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','offset','undefined','limit','count','set','json','reject','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x20d0dc,_0x57635c){var _0x208280=function(_0x416ae4){while(--_0x416ae4){_0x20d0dc['push'](_0x20d0dc['shift']());}};_0x208280(++_0x57635c);}(_0x58ff,0x1ad));var _0xf58f=function(_0x55ff82,_0x5d2144){_0x55ff82=_0x55ff82-0x0;var _0x13ba8e=_0x58ff[_0x55ff82];return _0x13ba8e;};'use strict';var emlformat=require(_0xf58f('0x0'));var rimraf=require(_0xf58f('0x1'));var zipdir=require(_0xf58f('0x2'));var jsonpatch=require(_0xf58f('0x3'));var rp=require(_0xf58f('0x4'));var moment=require(_0xf58f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf58f('0x6'));var sox=require('sox');var csv=require(_0xf58f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf58f('0x8'));var _=require(_0xf58f('0x9'));var squel=require(_0xf58f('0xa'));var crypto=require('crypto');var jsforce=require(_0xf58f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf58f('0x7'));var querystring=require(_0xf58f('0xc'));var Papa=require(_0xf58f('0xd'));var Redis=require(_0xf58f('0xe'));var authService=require(_0xf58f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf58f('0x10'));var hardwareService=require(_0xf58f('0x11'));var logger=require(_0xf58f('0x12'))(_0xf58f('0x13'));var utils=require(_0xf58f('0x14'));var config=require(_0xf58f('0x15'));var licenseUtil=require(_0xf58f('0x16'));var db=require(_0xf58f('0x17'))['db'];function respondWithStatusCode(_0xd9dc12,_0x49c35d){_0x49c35d=_0x49c35d||0xcc;return function(_0x2f3aaa){if(_0x2f3aaa){return _0xd9dc12[_0xf58f('0x18')](_0x49c35d);}return _0xd9dc12[_0xf58f('0x19')](_0x49c35d)[_0xf58f('0x1a')]();};}function respondWithResult(_0xb10d70,_0x35529c){_0x35529c=_0x35529c||0xc8;return function(_0x3b4b0d){if(_0x3b4b0d){return _0xb10d70[_0xf58f('0x19')](_0x35529c)['json'](_0x3b4b0d);}};}function respondWithFilteredResult(_0x34db25,_0x1aa34b){return function(_0x50b2d2){if(_0x50b2d2){var _0x5a46d8=typeof _0x1aa34b[_0xf58f('0x1b')]===_0xf58f('0x1c')&&typeof _0x1aa34b[_0xf58f('0x1d')]===_0xf58f('0x1c');var _0x2bab62=_0x50b2d2[_0xf58f('0x1e')];var _0x287caa=_0x5a46d8?0x0:_0x1aa34b['offset'];var _0x48d177=_0x5a46d8?_0x50b2d2[_0xf58f('0x1e')]:_0x1aa34b[_0xf58f('0x1b')]+_0x1aa34b[_0xf58f('0x1d')];var _0x3831ca;if(_0x48d177>=_0x2bab62){_0x48d177=_0x2bab62;_0x3831ca=0xc8;}else{_0x3831ca=0xce;}_0x34db25[_0xf58f('0x19')](_0x3831ca);return _0x34db25[_0xf58f('0x1f')]('Content-Range',_0x287caa+'-'+_0x48d177+'/'+_0x2bab62)[_0xf58f('0x20')](_0x50b2d2);}return null;};}function patchUpdates(_0x40b43d){return function(_0xab29fb){try{jsonpatch['apply'](_0xab29fb,_0x40b43d,!![]);}catch(_0x31c020){return BPromise[_0xf58f('0x21')](_0x31c020);}return _0xab29fb['save']();};}function saveUpdates(_0x3141cb,_0x4e81de){return function(_0x42c5bf){if(_0x42c5bf){return _0x42c5bf[_0xf58f('0x22')](_0x3141cb)['then'](function(_0x20a97d){return _0x20a97d;});}return null;};}function removeEntity(_0x57bda7,_0x4887bd){return function(_0x180177){if(_0x180177){return _0x180177[_0xf58f('0x23')]()[_0xf58f('0x24')](function(){var _0x183ba0=_0x180177[_0xf58f('0x25')]({'plain':!![]});var _0x4cdcf6=_0xf58f('0x26');return db[_0xf58f('0x27')][_0xf58f('0x23')]({'where':{'type':_0x4cdcf6,'resourceId':_0x183ba0['id']}})[_0xf58f('0x24')](function(){return _0x180177;});})['then'](function(){_0x57bda7['status'](0xcc)[_0xf58f('0x1a')]();});}};}function handleEntityNotFound(_0x52dcf1,_0x21df33){return function(_0x5c0a6d){if(!_0x5c0a6d){_0x52dcf1[_0xf58f('0x18')](0x194);}return _0x5c0a6d;};}function handleError(_0xf3441e,_0x53352e){_0x53352e=_0x53352e||0x1f4;return function(_0x210ad2){logger[_0xf58f('0x28')](_0x210ad2[_0xf58f('0x29')]);if(_0x210ad2[_0xf58f('0x2a')]){delete _0x210ad2[_0xf58f('0x2a')];}_0xf3441e['status'](_0x53352e)['send'](_0x210ad2);};}exports['index']=function(_0x5a8a8d,_0x2907b7){var _0x1bf38f={},_0x54466f={},_0x1e76be={'count':0x0,'rows':[]};var _0x37a856=_[_0xf58f('0x2b')](db[_0xf58f('0x2c')][_0xf58f('0x2d')],function(_0xbe5469){return{'name':_0xbe5469[_0xf58f('0x2e')],'type':_0xbe5469[_0xf58f('0x2f')][_0xf58f('0x30')]};});_0x54466f[_0xf58f('0x31')]=_[_0xf58f('0x2b')](_0x37a856,_0xf58f('0x2a'));_0x54466f[_0xf58f('0x32')]=_[_0xf58f('0x33')](_0x5a8a8d[_0xf58f('0x32')]);_0x54466f[_0xf58f('0x34')]=_[_0xf58f('0x35')](_0x54466f[_0xf58f('0x31')],_0x54466f[_0xf58f('0x32')]);_0x1bf38f['attributes']=_['intersection'](_0x54466f[_0xf58f('0x31')],qs['fields'](_0x5a8a8d['query'][_0xf58f('0x36')]));_0x1bf38f[_0xf58f('0x37')]=_0x1bf38f['attributes']['length']?_0x1bf38f[_0xf58f('0x37')]:_0x54466f[_0xf58f('0x31')];if(!_0x5a8a8d['query'][_0xf58f('0x38')](_0xf58f('0x39'))){_0x1bf38f['limit']=qs['limit'](_0x5a8a8d[_0xf58f('0x32')]['limit']);_0x1bf38f[_0xf58f('0x1b')]=qs[_0xf58f('0x1b')](_0x5a8a8d[_0xf58f('0x32')][_0xf58f('0x1b')]);}_0x1bf38f[_0xf58f('0x3a')]=qs[_0xf58f('0x3b')](_0x5a8a8d[_0xf58f('0x32')][_0xf58f('0x3b')]);_0x1bf38f[_0xf58f('0x3c')]=qs[_0xf58f('0x34')](_['pick'](_0x5a8a8d['query'],_0x54466f[_0xf58f('0x34')]),_0x37a856);if(_0x5a8a8d[_0xf58f('0x32')][_0xf58f('0x3d')]){_0x1bf38f[_0xf58f('0x3c')]=_[_0xf58f('0x3e')](_0x1bf38f['where'],{'$or':_[_0xf58f('0x2b')](_0x37a856,function(_0x3369fc){if(_0x3369fc[_0xf58f('0x2f')]!==_0xf58f('0x3f')){var _0x35d035={};_0x35d035[_0x3369fc[_0xf58f('0x2a')]]={'$like':'%'+_0x5a8a8d[_0xf58f('0x32')][_0xf58f('0x3d')]+'%'};return _0x35d035;}})});}_0x1bf38f=_['merge']({},_0x1bf38f,_0x5a8a8d['options']);var _0x59808a={'where':_0x1bf38f[_0xf58f('0x3c')]};return db[_0xf58f('0x2c')][_0xf58f('0x1e')](_0x59808a)[_0xf58f('0x24')](function(_0x2f0815){_0x1e76be[_0xf58f('0x1e')]=_0x2f0815;if(_0x5a8a8d[_0xf58f('0x32')][_0xf58f('0x40')]){_0x1bf38f[_0xf58f('0x41')]=[{'all':!![]}];}return db[_0xf58f('0x2c')][_0xf58f('0x42')](_0x1bf38f);})['then'](function(_0x2e527f){_0x1e76be[_0xf58f('0x43')]=_0x2e527f;return _0x1e76be;})['then'](respondWithFilteredResult(_0x2907b7,_0x1bf38f))[_0xf58f('0x44')](handleError(_0x2907b7,null));};exports[_0xf58f('0x45')]=function(_0x520a5c,_0x3b762d){var _0x3defdc={'raw':!![],'where':{'id':_0x520a5c[_0xf58f('0x46')]['id']}},_0x1cad15={};_0x1cad15['model']=_[_0xf58f('0x33')](db['CmContactHasItem'][_0xf58f('0x2d')]);_0x1cad15[_0xf58f('0x32')]=_[_0xf58f('0x33')](_0x520a5c[_0xf58f('0x32')]);_0x1cad15['filters']=_[_0xf58f('0x35')](_0x1cad15[_0xf58f('0x31')],_0x1cad15[_0xf58f('0x32')]);_0x3defdc[_0xf58f('0x37')]=_[_0xf58f('0x35')](_0x1cad15[_0xf58f('0x31')],qs[_0xf58f('0x36')](_0x520a5c[_0xf58f('0x32')][_0xf58f('0x36')]));_0x3defdc[_0xf58f('0x37')]=_0x3defdc[_0xf58f('0x37')][_0xf58f('0x47')]?_0x3defdc[_0xf58f('0x37')]:_0x1cad15[_0xf58f('0x31')];if(_0x520a5c['query'][_0xf58f('0x40')]){_0x3defdc[_0xf58f('0x41')]=[{'all':!![]}];}_0x3defdc=_[_0xf58f('0x3e')]({},_0x3defdc,_0x520a5c['options']);return db[_0xf58f('0x2c')][_0xf58f('0x48')](_0x3defdc)['then'](handleEntityNotFound(_0x3b762d,null))[_0xf58f('0x24')](respondWithResult(_0x3b762d,null))['catch'](handleError(_0x3b762d,null));};exports[_0xf58f('0x49')]=function(_0x564335,_0x2f76e4){return db['CmContactHasItem'][_0xf58f('0x49')](_0x564335[_0xf58f('0x4a')],{})[_0xf58f('0x24')](function(_0x4dc826){var _0x446b96=_0x564335[_0xf58f('0x4b')][_0xf58f('0x25')]({'plain':!![]});if(!_0x446b96)throw new Error(_0xf58f('0x4c'));if(_0x446b96[_0xf58f('0x4d')]===_0xf58f('0x4b')){var _0x52b591=_0x4dc826[_0xf58f('0x25')]({'plain':!![]});var _0xd5d5a3='CmContactHasItems';return db[_0xf58f('0x4e')]['find']({'where':{'name':_0xd5d5a3,'userProfileId':_0x446b96[_0xf58f('0x4f')]},'raw':!![]})['then'](function(_0x1b3a65){if(_0x1b3a65&&_0x1b3a65['autoAssociation']===0x0){return db[_0xf58f('0x27')][_0xf58f('0x49')]({'name':_0x52b591[_0xf58f('0x2a')],'resourceId':_0x52b591['id'],'type':_0x1b3a65[_0xf58f('0x2a')],'sectionId':_0x1b3a65['id']},{})[_0xf58f('0x24')](function(){return _0x4dc826;});}else{return _0x4dc826;}})[_0xf58f('0x44')](function(_0x9c700c){logger[_0xf58f('0x28')](_0xf58f('0x50'),_0x9c700c);throw _0x9c700c;});}return _0x4dc826;})[_0xf58f('0x24')](respondWithResult(_0x2f76e4,0xc9))[_0xf58f('0x44')](handleError(_0x2f76e4,null));};exports[_0xf58f('0x22')]=function(_0x2b5701,_0x1649a2){if(_0x2b5701['body']['id']){delete _0x2b5701['body']['id'];}return db[_0xf58f('0x2c')]['find']({'where':{'id':_0x2b5701[_0xf58f('0x46')]['id']}})[_0xf58f('0x24')](handleEntityNotFound(_0x1649a2,null))['then'](saveUpdates(_0x2b5701[_0xf58f('0x4a')],null))[_0xf58f('0x24')](respondWithResult(_0x1649a2,null))['catch'](handleError(_0x1649a2,null));};exports[_0xf58f('0x23')]=function(_0x365eb2,_0x49b14f){return db[_0xf58f('0x2c')][_0xf58f('0x48')]({'where':{'id':_0x365eb2['params']['id']}})['then'](handleEntityNotFound(_0x49b14f,null))['then'](removeEntity(_0x49b14f,null))['catch'](handleError(_0x49b14f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index fee869c..9dc0434 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 _0x6080=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x4657de,_0x472cb1){var _0x4c68aa=function(_0x2b5247){while(--_0x2b5247){_0x4657de['push'](_0x4657de['shift']());}};_0x4c68aa(++_0x472cb1);}(_0x6080,0x11e));var _0x0608=function(_0x5cf6e4,_0x9129c9){_0x5cf6e4=_0x5cf6e4-0x0;var _0x410278=_0x6080[_0x5cf6e4];return _0x410278;};'use strict';var _=require(_0x0608('0x0'));var util=require(_0x0608('0x1'));var logger=require(_0x0608('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0608('0x3'));var fs=require('fs');var path=require(_0x0608('0x4'));var rimraf=require('rimraf');var config=require(_0x0608('0x5'));var attributes=require(_0x0608('0x6'));module[_0x0608('0x7')]=function(_0x3cb3a8,_0x5d76ab){return _0x3cb3a8[_0x0608('0x8')](_0x0608('0x9'),attributes,{'tableName':_0x0608('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35aa=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x599d71,_0xc4507a){var _0x22b097=function(_0x1666a6){while(--_0x1666a6){_0x599d71['push'](_0x599d71['shift']());}};_0x22b097(++_0xc4507a);}(_0x35aa,0x7c));var _0xa35a=function(_0xc07d8c,_0x59d21f){_0xc07d8c=_0xc07d8c-0x0;var _0xdfe2ab=_0x35aa[_0xc07d8c];return _0xdfe2ab;};'use strict';var _=require(_0xa35a('0x0'));var util=require(_0xa35a('0x1'));var logger=require(_0xa35a('0x2'))('api');var moment=require(_0xa35a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa35a('0x4'));var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module[_0xa35a('0x9')]=function(_0x2e2e98,_0x28f68c){return _0x2e2e98[_0xa35a('0xa')](_0xa35a('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 33ada0f..1c5c79e 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 _0x8eaa=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x8eaa,0x119));var _0xa8ea=function(_0x193cc8,_0x295d92){_0x193cc8=_0x193cc8-0x0;var _0x4e171d=_0x8eaa[_0x193cc8];return _0x4e171d;};'use strict';var _=require(_0xa8ea('0x0'));var util=require(_0xa8ea('0x1'));var moment=require(_0xa8ea('0x2'));var BPromise=require(_0xa8ea('0x3'));var rs=require(_0xa8ea('0x4'));var fs=require('fs');var Redis=require(_0xa8ea('0x5'));var db=require(_0xa8ea('0x6'))['db'];var utils=require(_0xa8ea('0x7'));var logger=require('../../config/logger')(_0xa8ea('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa8ea('0x9')][_0xa8ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e709,_0x306598,_0x504099){return new BPromise(function(_0x21ea08,_0x536321){return client[_0xa8ea('0xb')](_0x4e709,_0x504099)['then'](function(_0x3ca2d4){logger[_0xa8ea('0xc')](_0xa8ea('0xd'),_0x306598,'request\x20sent');logger[_0xa8ea('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x306598,_0xa8ea('0xf'),JSON[_0xa8ea('0x10')](_0x3ca2d4));if(_0x3ca2d4[_0xa8ea('0x11')]){if(_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x12')]===0x1f4){logger[_0xa8ea('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x306598,_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);return _0x536321(_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);}logger[_0xa8ea('0x11')](_0xa8ea('0xd'),_0x306598,_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);return _0x21ea08(_0x3ca2d4[_0xa8ea('0x11')]['message']);}else{logger[_0xa8ea('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x306598,_0xa8ea('0xf'));_0x21ea08(_0x3ca2d4[_0xa8ea('0x14')][_0xa8ea('0x13')]);}})[_0xa8ea('0x15')](function(_0x3ba1db){logger[_0xa8ea('0x11')](_0xa8ea('0xd'),_0x306598,_0x3ba1db);_0x536321(_0x3ba1db);});});} \ No newline at end of file +var _0xcb61=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x42fada,_0xe53baf){var _0x14a3e7=function(_0x42bfe5){while(--_0x42bfe5){_0x42fada['push'](_0x42fada['shift']());}};_0x14a3e7(++_0xe53baf);}(_0xcb61,0x14b));var _0x1cb6=function(_0x2d378d,_0x5f50d2){_0x2d378d=_0x2d378d-0x0;var _0x2417fe=_0xcb61[_0x2d378d];return _0x2417fe;};'use strict';var _=require(_0x1cb6('0x0'));var util=require('util');var moment=require(_0x1cb6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cb6('0x2'));var db=require(_0x1cb6('0x3'))['db'];var utils=require(_0x1cb6('0x4'));var logger=require(_0x1cb6('0x5'))('rpc');var config=require(_0x1cb6('0x6'));var jayson=require(_0x1cb6('0x7'));var client=jayson[_0x1cb6('0x8')][_0x1cb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f368d,_0x1b5c79,_0x134ac3){return new BPromise(function(_0x4aeb89,_0x532e18){return client[_0x1cb6('0xa')](_0x1f368d,_0x134ac3)[_0x1cb6('0xb')](function(_0x298c0a){logger[_0x1cb6('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x1b5c79,_0x1cb6('0xd'));logger[_0x1cb6('0xe')](_0x1cb6('0xf'),_0x1b5c79,'request\x20sent',JSON[_0x1cb6('0x10')](_0x298c0a));if(_0x298c0a[_0x1cb6('0x11')]){if(_0x298c0a[_0x1cb6('0x11')]['code']===0x1f4){logger[_0x1cb6('0x11')](_0x1cb6('0x12'),_0x1b5c79,_0x298c0a[_0x1cb6('0x11')][_0x1cb6('0x13')]);return _0x532e18(_0x298c0a[_0x1cb6('0x11')][_0x1cb6('0x13')]);}logger[_0x1cb6('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x1b5c79,_0x298c0a[_0x1cb6('0x11')][_0x1cb6('0x13')]);return _0x4aeb89(_0x298c0a[_0x1cb6('0x11')][_0x1cb6('0x13')]);}else{logger[_0x1cb6('0xc')](_0x1cb6('0x12'),_0x1b5c79,_0x1cb6('0xd'));_0x4aeb89(_0x298c0a[_0x1cb6('0x14')][_0x1cb6('0x13')]);}})['catch'](function(_0x46da24){logger[_0x1cb6('0x11')](_0x1cb6('0x12'),_0x1b5c79,_0x46da24);_0x532e18(_0x46da24);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 78a6907..91aadfb 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 _0xbb59=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show'];(function(_0x463e39,_0x5d48b2){var _0x44f0c0=function(_0x280e99){while(--_0x280e99){_0x463e39['push'](_0x463e39['shift']());}};_0x44f0c0(++_0x5d48b2);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x19ce65,_0x24828e){_0x19ce65=_0x19ce65-0x0;var _0x2b6ea8=_0xbb59[_0x19ce65];return _0x2b6ea8;};'use strict';var multer=require(_0x9bb5('0x0'));var util=require('util');var path=require(_0x9bb5('0x1'));var timeout=require(_0x9bb5('0x2'));var express=require(_0x9bb5('0x3'));var router=express[_0x9bb5('0x4')]();var fs_extra=require(_0x9bb5('0x5'));var auth=require(_0x9bb5('0x6'));var interaction=require(_0x9bb5('0x7'));var config=require(_0x9bb5('0x8'));var controller=require(_0x9bb5('0x9'));router[_0x9bb5('0xa')]('/',auth[_0x9bb5('0xb')](),controller['index']);router['get'](_0x9bb5('0xc'),auth[_0x9bb5('0xb')](),controller[_0x9bb5('0xd')]);router[_0x9bb5('0xe')]('/',auth['isAuthenticated'](),controller[_0x9bb5('0xf')]);router[_0x9bb5('0x10')](_0x9bb5('0xc'),auth[_0x9bb5('0xb')](),controller[_0x9bb5('0x11')]);router[_0x9bb5('0x12')](_0x9bb5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9bb5('0x13')]=router; \ No newline at end of file +var _0xce03=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dc2c0,_0x3e39ab){var _0x4291c6=function(_0x4229fc){while(--_0x4229fc){_0x3dc2c0['push'](_0x3dc2c0['shift']());}};_0x4291c6(++_0x3e39ab);}(_0xce03,0x114));var _0x3ce0=function(_0x324746,_0x4fd874){_0x324746=_0x324746-0x0;var _0x230038=_0xce03[_0x324746];return _0x230038;};'use strict';var multer=require(_0x3ce0('0x0'));var util=require(_0x3ce0('0x1'));var path=require(_0x3ce0('0x2'));var timeout=require(_0x3ce0('0x3'));var express=require(_0x3ce0('0x4'));var router=express[_0x3ce0('0x5')]();var fs_extra=require(_0x3ce0('0x6'));var auth=require(_0x3ce0('0x7'));var interaction=require(_0x3ce0('0x8'));var config=require(_0x3ce0('0x9'));var controller=require(_0x3ce0('0xa'));router[_0x3ce0('0xb')]('/',auth[_0x3ce0('0xc')](),controller[_0x3ce0('0xd')]);router[_0x3ce0('0xb')]('/:id',auth[_0x3ce0('0xc')](),controller[_0x3ce0('0xe')]);router['post']('/',auth[_0x3ce0('0xc')](),controller[_0x3ce0('0xf')]);router['put'](_0x3ce0('0x10'),auth[_0x3ce0('0xc')](),controller['update']);router['delete'](_0x3ce0('0x10'),auth[_0x3ce0('0xc')](),controller[_0x3ce0('0x11')]);module[_0x3ce0('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 efd80aa..41c8f55 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 _0x672f=['VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','values','BOOLEAN','ENUM','voice'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x672f,0x15c));var _0xf672=function(_0x5436f2,_0x5e07a6){_0x5436f2=_0x5436f2-0x0;var _0x5c526e=_0x672f[_0x5436f2];return _0x5c526e;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xf672('0x0')],'get':function(_0x5975d7){return this['getDataValue'](_0xf672('0x1'));}},'alias':{'type':Sequelize[_0xf672('0x2')],'allowNull':![],'set':function(_0xcd95e0){this[_0xf672('0x3')](_0xf672('0x1'),_0xcd95e0?_0xcd95e0:this[_0xf672('0x4')](_0xf672('0x5')));}},'type':{'type':Sequelize[_0xf672('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0xf672('0x6')](_0xf672('0x7')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON['parse'](this[_0xf672('0x4')](_0xf672('0x8')));}else{return this[_0xf672('0x4')]('values');}},'set':function(_0xbe943b){if(Array['isArray'](_0xbe943b)){this['setDataValue'](_0xf672('0x8'),JSON['stringify'](_0xbe943b));}else{this['setDataValue'](_0xf672('0x8'),_0xbe943b);}}},'required':{'type':Sequelize[_0xf672('0x9')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf672('0xa')](_0xf672('0xb'))}}; \ No newline at end of file +var _0x9da6=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long','type','select','values','isArray','stringify'];(function(_0x21391d,_0x357b8a){var _0x515d5e=function(_0xb88b77){while(--_0xb88b77){_0x21391d['push'](_0x21391d['shift']());}};_0x515d5e(++_0x357b8a);}(_0x9da6,0x1b3));var _0x69da=function(_0x201d18,_0x373335){_0x201d18=_0x201d18-0x0;var _0x58c0dd=_0x9da6[_0x201d18];return _0x58c0dd;};'use strict';var Sequelize=require(_0x69da('0x0'));var _=require(_0x69da('0x1'));module[_0x69da('0x2')]={'name':{'type':Sequelize[_0x69da('0x3')],'get':function(_0x50cb37){return this[_0x69da('0x4')](_0x69da('0x5'));}},'alias':{'type':Sequelize[_0x69da('0x6')],'allowNull':![],'set':function(_0x635b6c){this[_0x69da('0x7')]('alias',_0x635b6c?_0x635b6c:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x69da('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x69da('0x8')](_0x69da('0x9')),'get':function(){if(this[_0x69da('0x4')](_0x69da('0xa'))===_0x69da('0xb')){return JSON['parse'](this[_0x69da('0x4')](_0x69da('0xc')));}else{return this['getDataValue'](_0x69da('0xc'));}},'set':function(_0x428d0c){if(Array[_0x69da('0xd')](_0x428d0c)){this[_0x69da('0x7')](_0x69da('0xc'),JSON[_0x69da('0xe')](_0x428d0c));}else{this[_0x69da('0x7')]('values',_0x428d0c);}}},'required':{'type':Sequelize[_0x69da('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x69da('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x69da('0x10')](_0x69da('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4d84320..d1d79c2 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 _0x7b88=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','params','keys','find','catch','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1e7ebe,_0x25b41e){var _0x1aea69=function(_0x3adc9e){while(--_0x3adc9e){_0x1e7ebe['push'](_0x1e7ebe['shift']());}};_0x1aea69(++_0x25b41e);}(_0x7b88,0x1ed));var _0x87b8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7b88[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x87b8('0x0'));var rimraf=require(_0x87b8('0x1'));var zipdir=require(_0x87b8('0x2'));var jsonpatch=require(_0x87b8('0x3'));var rp=require(_0x87b8('0x4'));var moment=require(_0x87b8('0x5'));var BPromise=require(_0x87b8('0x6'));var Mustache=require('mustache');var util=require(_0x87b8('0x7'));var path=require(_0x87b8('0x8'));var sox=require(_0x87b8('0x9'));var csv=require(_0x87b8('0xa'));var ejs=require(_0x87b8('0xb'));var fs=require('fs');var fs_extra=require(_0x87b8('0xc'));var _=require(_0x87b8('0xd'));var squel=require(_0x87b8('0xe'));var crypto=require(_0x87b8('0xf'));var jsforce=require(_0x87b8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x87b8('0x11'));var Papa=require('papaparse');var Redis=require(_0x87b8('0x12'));var authService=require(_0x87b8('0x13'));var qs=require(_0x87b8('0x14'));var as=require(_0x87b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x87b8('0x16'));var licenseUtil=require(_0x87b8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x89ca5c,_0x146981){_0x146981=_0x146981||0xcc;return function(_0x21f22e){if(_0x21f22e){return _0x89ca5c[_0x87b8('0x18')](_0x146981);}return _0x89ca5c[_0x87b8('0x19')](_0x146981)[_0x87b8('0x1a')]();};}function respondWithResult(_0x472789,_0x139556){_0x139556=_0x139556||0xc8;return function(_0x1e5585){if(_0x1e5585){return _0x472789[_0x87b8('0x19')](_0x139556)['json'](_0x1e5585);}};}function respondWithFilteredResult(_0x13061d,_0x3787c4){return function(_0x59e706){if(_0x59e706){var _0x35d453=typeof _0x3787c4['offset']===_0x87b8('0x1b')&&typeof _0x3787c4[_0x87b8('0x1c')]===_0x87b8('0x1b');var _0x3c375a=_0x59e706[_0x87b8('0x1d')];var _0x5b1820=_0x35d453?0x0:_0x3787c4[_0x87b8('0x1e')];var _0x4f0339=_0x35d453?_0x59e706[_0x87b8('0x1d')]:_0x3787c4[_0x87b8('0x1e')]+_0x3787c4[_0x87b8('0x1c')];var _0x18b5a7;if(_0x4f0339>=_0x3c375a){_0x4f0339=_0x3c375a;_0x18b5a7=0xc8;}else{_0x18b5a7=0xce;}_0x13061d[_0x87b8('0x19')](_0x18b5a7);return _0x13061d[_0x87b8('0x1f')](_0x87b8('0x20'),_0x5b1820+'-'+_0x4f0339+'/'+_0x3c375a)[_0x87b8('0x21')](_0x59e706);}return null;};}function patchUpdates(_0x325ac0){return function(_0x562afe){try{jsonpatch[_0x87b8('0x22')](_0x562afe,_0x325ac0,!![]);}catch(_0x1d00fb){return BPromise['reject'](_0x1d00fb);}return _0x562afe[_0x87b8('0x23')]();};}function saveUpdates(_0xa271e9,_0x3d192c){return function(_0x3262fc){if(_0x3262fc){return _0x3262fc[_0x87b8('0x24')](_0xa271e9)['then'](function(_0x2a5eb6){return _0x2a5eb6;});}return null;};}function removeEntity(_0x5d5620,_0x1f40b9){return function(_0x41a6bb){if(_0x41a6bb){return _0x41a6bb[_0x87b8('0x25')]()[_0x87b8('0x26')](function(){_0x5d5620['status'](0xcc)[_0x87b8('0x1a')]();});}};}function handleEntityNotFound(_0x243883,_0x226e1e){return function(_0xa667d9){if(!_0xa667d9){_0x243883['sendStatus'](0x194);}return _0xa667d9;};}function handleError(_0x46c4ae,_0x39554c){_0x39554c=_0x39554c||0x1f4;return function(_0x2fc99e){logger[_0x87b8('0x27')](_0x2fc99e[_0x87b8('0x28')]);if(_0x2fc99e[_0x87b8('0x29')]){delete _0x2fc99e['name'];}_0x46c4ae[_0x87b8('0x19')](_0x39554c)[_0x87b8('0x2a')](_0x2fc99e);};}exports[_0x87b8('0x2b')]=function(_0x1dda34,_0x133205){var _0x26d5db={},_0x38d2f2={},_0x3cabbe={'count':0x0,'rows':[]};var _0x5df39b=_[_0x87b8('0x2c')](db[_0x87b8('0x2d')][_0x87b8('0x2e')],function(_0x27e05a){return{'name':_0x27e05a['fieldName'],'type':_0x27e05a['type'][_0x87b8('0x2f')]};});_0x38d2f2['model']=_[_0x87b8('0x30')](_[_0x87b8('0x2c')](_0x5df39b,_0x87b8('0x29')),[_0x87b8('0x29')]);_0x38d2f2[_0x87b8('0x31')]=_['keys'](_0x1dda34['query']);_0x38d2f2[_0x87b8('0x32')]=_[_0x87b8('0x33')](_0x38d2f2[_0x87b8('0x34')],_0x38d2f2[_0x87b8('0x31')]);_0x26d5db[_0x87b8('0x35')]=_[_0x87b8('0x33')](_0x38d2f2['model'],qs[_0x87b8('0x36')](_0x1dda34[_0x87b8('0x31')]['fields']));_0x26d5db[_0x87b8('0x35')]=_0x26d5db[_0x87b8('0x35')][_0x87b8('0x37')]?_0x26d5db[_0x87b8('0x35')]:_0x38d2f2[_0x87b8('0x34')];if(!_0x1dda34[_0x87b8('0x31')][_0x87b8('0x38')]('nolimit')){_0x26d5db[_0x87b8('0x1c')]=qs[_0x87b8('0x1c')](_0x1dda34['query'][_0x87b8('0x1c')]);_0x26d5db['offset']=qs[_0x87b8('0x1e')](_0x1dda34[_0x87b8('0x31')][_0x87b8('0x1e')]);}_0x26d5db['order']=qs[_0x87b8('0x39')](_0x1dda34[_0x87b8('0x31')][_0x87b8('0x39')]);_0x26d5db[_0x87b8('0x3a')]=qs['filters'](_['pick'](_0x1dda34[_0x87b8('0x31')],_0x38d2f2[_0x87b8('0x32')]),_0x5df39b);if(_0x1dda34['query'][_0x87b8('0x3b')]){_0x26d5db[_0x87b8('0x3a')]=_[_0x87b8('0x3c')](_0x26d5db[_0x87b8('0x3a')],{'$or':_[_0x87b8('0x2c')](_0x5df39b,function(_0x36969f){if(_0x36969f[_0x87b8('0x3d')]!==_0x87b8('0x3e')){var _0xcae14={};_0xcae14[_0x36969f[_0x87b8('0x29')]]={'$like':'%'+_0x1dda34['query']['filter']+'%'};return _0xcae14;}})});}_0x26d5db=_[_0x87b8('0x3c')]({},_0x26d5db,_0x1dda34[_0x87b8('0x3f')]);var _0x364a70={'where':_0x26d5db[_0x87b8('0x3a')]};return db['CmCustomField'][_0x87b8('0x1d')](_0x364a70)[_0x87b8('0x26')](function(_0x5e2598){_0x3cabbe[_0x87b8('0x1d')]=_0x5e2598;if(_0x1dda34[_0x87b8('0x31')][_0x87b8('0x40')]){_0x26d5db['include']=[{'all':!![]}];}return db[_0x87b8('0x2d')][_0x87b8('0x41')](_0x26d5db);})['then'](function(_0x50dfc1){_0x3cabbe['rows']=_0x50dfc1;return _0x3cabbe;})['then'](respondWithFilteredResult(_0x133205,_0x26d5db))['catch'](handleError(_0x133205,null));};exports['show']=function(_0xbc4446,_0x61c206){var _0x2d1468={'raw':!![],'where':{'id':_0xbc4446[_0x87b8('0x42')]['id']}},_0x112b5f={};_0x112b5f['model']=_['keys'](db['CmCustomField'][_0x87b8('0x2e')]);_0x112b5f[_0x87b8('0x31')]=_[_0x87b8('0x43')](_0xbc4446['query']);_0x112b5f[_0x87b8('0x32')]=_[_0x87b8('0x33')](_0x112b5f[_0x87b8('0x34')],_0x112b5f[_0x87b8('0x31')]);_0x2d1468[_0x87b8('0x35')]=_[_0x87b8('0x33')](_0x112b5f['model'],qs[_0x87b8('0x36')](_0xbc4446[_0x87b8('0x31')][_0x87b8('0x36')]));_0x2d1468[_0x87b8('0x35')]=_0x2d1468[_0x87b8('0x35')][_0x87b8('0x37')]?_0x2d1468[_0x87b8('0x35')]:_0x112b5f[_0x87b8('0x34')];if(_0xbc4446[_0x87b8('0x31')][_0x87b8('0x40')]){_0x2d1468['include']=[{'all':!![]}];}_0x2d1468=_[_0x87b8('0x3c')]({},_0x2d1468,_0xbc4446[_0x87b8('0x3f')]);return db[_0x87b8('0x2d')][_0x87b8('0x44')](_0x2d1468)[_0x87b8('0x26')](handleEntityNotFound(_0x61c206,null))['then'](respondWithResult(_0x61c206,null))[_0x87b8('0x45')](handleError(_0x61c206,null));};exports[_0x87b8('0x24')]=function(_0x5e8357,_0x5130d7){if(_0x5e8357[_0x87b8('0x46')]['id']){delete _0x5e8357[_0x87b8('0x46')]['id'];}return db[_0x87b8('0x2d')]['find']({'where':{'id':_0x5e8357['params']['id']}})['then'](handleEntityNotFound(_0x5130d7,null))[_0x87b8('0x26')](saveUpdates(_0x5e8357[_0x87b8('0x46')],null))[_0x87b8('0x26')](respondWithResult(_0x5130d7,null))[_0x87b8('0x45')](handleError(_0x5130d7,null));};exports[_0x87b8('0x25')]=function(_0x407557,_0x456e8a){return db[_0x87b8('0x2d')][_0x87b8('0x44')]({'where':{'id':_0x407557[_0x87b8('0x42')]['id']}})['then'](handleEntityNotFound(_0x456e8a,null))[_0x87b8('0x26')](removeEntity(_0x456e8a,null))[_0x87b8('0x45')](handleError(_0x456e8a,null));};exports['create']=function(_0x25b179,_0x5806dc){var _0x25cd1a;return db[_0x87b8('0x47')]['transaction'](function(_0x56a18c){return db['CmCustomField'][_0x87b8('0x48')](_0x25b179['body'],{'transaction':_0x56a18c})[_0x87b8('0x26')](function(_0x9ae3a){_0x25cd1a=_0x9ae3a;var _0x2eb09c={'type':db[_0x87b8('0x49')][_0x87b8('0x4a')],'transaction':_0x56a18c};switch(_0x25b179[_0x87b8('0x46')][_0x87b8('0x3d')]){case _0x87b8('0x4b'):_0x2eb09c[_0x87b8('0x3d')]=db['Sequelize'][_0x87b8('0x4a')];break;case'number':_0x2eb09c[_0x87b8('0x3d')]=db[_0x87b8('0x49')][_0x87b8('0x4c')];break;case _0x87b8('0x4d'):_0x2eb09c[_0x87b8('0x3d')]=db['Sequelize'][_0x87b8('0x4e')];_0x2eb09c[_0x87b8('0x4f')]=![];break;default:}return db[_0x87b8('0x47')][_0x87b8('0x50')][_0x87b8('0x51')](_0x87b8('0x52'),util[_0x87b8('0x53')](_0x87b8('0x54'),_0x25cd1a['id']),_0x2eb09c);})[_0x87b8('0x26')](function(){return _0x25cd1a;});})[_0x87b8('0x26')](respondWithResult(_0x5806dc,0xc9))[_0x87b8('0x45')](handleError(_0x5806dc,null));}; \ No newline at end of file +var _0xcb1f=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','update','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%d','eml-format','zip-dir','fast-json-patch'];(function(_0x363bc7,_0x18f9f6){var _0x2a43c4=function(_0x2688dd){while(--_0x2688dd){_0x363bc7['push'](_0x363bc7['shift']());}};_0x2a43c4(++_0x18f9f6);}(_0xcb1f,0xb1));var _0xfcb1=function(_0x7d0afa,_0x25ede4){_0x7d0afa=_0x7d0afa-0x0;var _0x124bfd=_0xcb1f[_0x7d0afa];return _0x124bfd;};'use strict';var emlformat=require(_0xfcb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcb1('0x1'));var jsonpatch=require(_0xfcb1('0x2'));var rp=require('request-promise');var moment=require(_0xfcb1('0x3'));var BPromise=require(_0xfcb1('0x4'));var Mustache=require(_0xfcb1('0x5'));var util=require(_0xfcb1('0x6'));var path=require(_0xfcb1('0x7'));var sox=require('sox');var csv=require(_0xfcb1('0x8'));var ejs=require(_0xfcb1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcb1('0xa'));var squel=require(_0xfcb1('0xb'));var crypto=require(_0xfcb1('0xc'));var jsforce=require(_0xfcb1('0xd'));var deskjs=require(_0xfcb1('0xe'));var toCsv=require(_0xfcb1('0x8'));var querystring=require(_0xfcb1('0xf'));var Papa=require(_0xfcb1('0x10'));var Redis=require(_0xfcb1('0x11'));var authService=require(_0xfcb1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfcb1('0x13'));var hardwareService=require(_0xfcb1('0x14'));var logger=require(_0xfcb1('0x15'))(_0xfcb1('0x16'));var utils=require(_0xfcb1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfcb1('0x18'));var db=require(_0xfcb1('0x19'))['db'];function respondWithStatusCode(_0x401cfb,_0x12d82c){_0x12d82c=_0x12d82c||0xcc;return function(_0x9932e3){if(_0x9932e3){return _0x401cfb['sendStatus'](_0x12d82c);}return _0x401cfb[_0xfcb1('0x1a')](_0x12d82c)[_0xfcb1('0x1b')]();};}function respondWithResult(_0x18f3e8,_0x3c9fb0){_0x3c9fb0=_0x3c9fb0||0xc8;return function(_0x5626f1){if(_0x5626f1){return _0x18f3e8['status'](_0x3c9fb0)[_0xfcb1('0x1c')](_0x5626f1);}};}function respondWithFilteredResult(_0x4de4cb,_0x2efd7c){return function(_0x124dc5){if(_0x124dc5){var _0x4bf3d9=typeof _0x2efd7c[_0xfcb1('0x1d')]===_0xfcb1('0x1e')&&typeof _0x2efd7c[_0xfcb1('0x1f')]===_0xfcb1('0x1e');var _0x44012e=_0x124dc5['count'];var _0x48e14a=_0x4bf3d9?0x0:_0x2efd7c['offset'];var _0x378f9c=_0x4bf3d9?_0x124dc5[_0xfcb1('0x20')]:_0x2efd7c[_0xfcb1('0x1d')]+_0x2efd7c[_0xfcb1('0x1f')];var _0x521f65;if(_0x378f9c>=_0x44012e){_0x378f9c=_0x44012e;_0x521f65=0xc8;}else{_0x521f65=0xce;}_0x4de4cb[_0xfcb1('0x1a')](_0x521f65);return _0x4de4cb[_0xfcb1('0x21')]('Content-Range',_0x48e14a+'-'+_0x378f9c+'/'+_0x44012e)['json'](_0x124dc5);}return null;};}function patchUpdates(_0x56471f){return function(_0x24438b){try{jsonpatch['apply'](_0x24438b,_0x56471f,!![]);}catch(_0x31ba87){return BPromise[_0xfcb1('0x22')](_0x31ba87);}return _0x24438b[_0xfcb1('0x23')]();};}function saveUpdates(_0x5d99ec,_0x2a9c95){return function(_0x1b6472){if(_0x1b6472){return _0x1b6472['update'](_0x5d99ec)[_0xfcb1('0x24')](function(_0x5f2644){return _0x5f2644;});}return null;};}function removeEntity(_0x4881ce,_0x109b33){return function(_0x461f61){if(_0x461f61){return _0x461f61[_0xfcb1('0x25')]()[_0xfcb1('0x24')](function(){_0x4881ce[_0xfcb1('0x1a')](0xcc)[_0xfcb1('0x1b')]();});}};}function handleEntityNotFound(_0x54c6bd,_0x29fb2c){return function(_0x21d705){if(!_0x21d705){_0x54c6bd[_0xfcb1('0x26')](0x194);}return _0x21d705;};}function handleError(_0x3623e0,_0x1a7cb7){_0x1a7cb7=_0x1a7cb7||0x1f4;return function(_0x4f332f){logger[_0xfcb1('0x27')](_0x4f332f[_0xfcb1('0x28')]);if(_0x4f332f['name']){delete _0x4f332f[_0xfcb1('0x29')];}_0x3623e0['status'](_0x1a7cb7)[_0xfcb1('0x2a')](_0x4f332f);};}exports[_0xfcb1('0x2b')]=function(_0x516969,_0x1d2f09){var _0x52fff0={},_0xff4f9f={},_0x222242={'count':0x0,'rows':[]};var _0x15360a=_[_0xfcb1('0x2c')](db[_0xfcb1('0x2d')]['rawAttributes'],function(_0x410723){return{'name':_0x410723[_0xfcb1('0x2e')],'type':_0x410723[_0xfcb1('0x2f')][_0xfcb1('0x30')]};});_0xff4f9f[_0xfcb1('0x31')]=_[_0xfcb1('0x32')](_[_0xfcb1('0x2c')](_0x15360a,_0xfcb1('0x29')),[_0xfcb1('0x29')]);_0xff4f9f['query']=_[_0xfcb1('0x33')](_0x516969[_0xfcb1('0x34')]);_0xff4f9f[_0xfcb1('0x35')]=_['intersection'](_0xff4f9f[_0xfcb1('0x31')],_0xff4f9f[_0xfcb1('0x34')]);_0x52fff0['attributes']=_[_0xfcb1('0x36')](_0xff4f9f['model'],qs[_0xfcb1('0x37')](_0x516969[_0xfcb1('0x34')][_0xfcb1('0x37')]));_0x52fff0[_0xfcb1('0x38')]=_0x52fff0[_0xfcb1('0x38')][_0xfcb1('0x39')]?_0x52fff0[_0xfcb1('0x38')]:_0xff4f9f[_0xfcb1('0x31')];if(!_0x516969[_0xfcb1('0x34')][_0xfcb1('0x3a')](_0xfcb1('0x3b'))){_0x52fff0[_0xfcb1('0x1f')]=qs[_0xfcb1('0x1f')](_0x516969[_0xfcb1('0x34')][_0xfcb1('0x1f')]);_0x52fff0[_0xfcb1('0x1d')]=qs[_0xfcb1('0x1d')](_0x516969['query'][_0xfcb1('0x1d')]);}_0x52fff0[_0xfcb1('0x3c')]=qs[_0xfcb1('0x3d')](_0x516969[_0xfcb1('0x34')]['sort']);_0x52fff0[_0xfcb1('0x3e')]=qs['filters'](_[_0xfcb1('0x3f')](_0x516969[_0xfcb1('0x34')],_0xff4f9f[_0xfcb1('0x35')]),_0x15360a);if(_0x516969[_0xfcb1('0x34')][_0xfcb1('0x40')]){_0x52fff0['where']=_[_0xfcb1('0x41')](_0x52fff0[_0xfcb1('0x3e')],{'$or':_['map'](_0x15360a,function(_0x1bd5c9){if(_0x1bd5c9[_0xfcb1('0x2f')]!=='VIRTUAL'){var _0x4a020b={};_0x4a020b[_0x1bd5c9[_0xfcb1('0x29')]]={'$like':'%'+_0x516969['query']['filter']+'%'};return _0x4a020b;}})});}_0x52fff0=_[_0xfcb1('0x41')]({},_0x52fff0,_0x516969[_0xfcb1('0x42')]);var _0x185b01={'where':_0x52fff0['where']};return db[_0xfcb1('0x2d')][_0xfcb1('0x20')](_0x185b01)[_0xfcb1('0x24')](function(_0x11254c){_0x222242['count']=_0x11254c;if(_0x516969[_0xfcb1('0x34')][_0xfcb1('0x43')]){_0x52fff0[_0xfcb1('0x44')]=[{'all':!![]}];}return db[_0xfcb1('0x2d')][_0xfcb1('0x45')](_0x52fff0);})[_0xfcb1('0x24')](function(_0x32174c){_0x222242['rows']=_0x32174c;return _0x222242;})['then'](respondWithFilteredResult(_0x1d2f09,_0x52fff0))[_0xfcb1('0x46')](handleError(_0x1d2f09,null));};exports[_0xfcb1('0x47')]=function(_0x4eb942,_0x4d595e){var _0x1850d2={'raw':!![],'where':{'id':_0x4eb942[_0xfcb1('0x48')]['id']}},_0x39220e={};_0x39220e[_0xfcb1('0x31')]=_['keys'](db['CmCustomField'][_0xfcb1('0x49')]);_0x39220e['query']=_['keys'](_0x4eb942[_0xfcb1('0x34')]);_0x39220e[_0xfcb1('0x35')]=_[_0xfcb1('0x36')](_0x39220e['model'],_0x39220e[_0xfcb1('0x34')]);_0x1850d2[_0xfcb1('0x38')]=_[_0xfcb1('0x36')](_0x39220e['model'],qs['fields'](_0x4eb942[_0xfcb1('0x34')][_0xfcb1('0x37')]));_0x1850d2[_0xfcb1('0x38')]=_0x1850d2[_0xfcb1('0x38')][_0xfcb1('0x39')]?_0x1850d2[_0xfcb1('0x38')]:_0x39220e[_0xfcb1('0x31')];if(_0x4eb942['query'][_0xfcb1('0x43')]){_0x1850d2[_0xfcb1('0x44')]=[{'all':!![]}];}_0x1850d2=_['merge']({},_0x1850d2,_0x4eb942[_0xfcb1('0x42')]);return db[_0xfcb1('0x2d')]['find'](_0x1850d2)['then'](handleEntityNotFound(_0x4d595e,null))[_0xfcb1('0x24')](respondWithResult(_0x4d595e,null))[_0xfcb1('0x46')](handleError(_0x4d595e,null));};exports[_0xfcb1('0x4a')]=function(_0x1edb30,_0x9f477e){if(_0x1edb30['body']['id']){delete _0x1edb30[_0xfcb1('0x4b')]['id'];}return db['CmCustomField'][_0xfcb1('0x4c')]({'where':{'id':_0x1edb30['params']['id']}})[_0xfcb1('0x24')](handleEntityNotFound(_0x9f477e,null))[_0xfcb1('0x24')](saveUpdates(_0x1edb30['body'],null))['then'](respondWithResult(_0x9f477e,null))[_0xfcb1('0x46')](handleError(_0x9f477e,null));};exports[_0xfcb1('0x25')]=function(_0x8907dc,_0x200bc5){return db['CmCustomField'][_0xfcb1('0x4c')]({'where':{'id':_0x8907dc['params']['id']}})[_0xfcb1('0x24')](handleEntityNotFound(_0x200bc5,null))['then'](removeEntity(_0x200bc5,null))[_0xfcb1('0x46')](handleError(_0x200bc5,null));};exports[_0xfcb1('0x4d')]=function(_0x35fff9,_0x511a9f){var _0x48c43f;return db[_0xfcb1('0x4e')][_0xfcb1('0x4f')](function(_0x4408f7){return db[_0xfcb1('0x2d')][_0xfcb1('0x4d')](_0x35fff9[_0xfcb1('0x4b')],{'transaction':_0x4408f7})[_0xfcb1('0x24')](function(_0x218d98){_0x48c43f=_0x218d98;var _0x45ebdc={'type':db[_0xfcb1('0x50')]['TEXT'],'transaction':_0x4408f7};switch(_0x35fff9['body'][_0xfcb1('0x2f')]){case _0xfcb1('0x51'):_0x45ebdc[_0xfcb1('0x2f')]=db['Sequelize'][_0xfcb1('0x52')];break;case _0xfcb1('0x53'):_0x45ebdc[_0xfcb1('0x2f')]=db['Sequelize'][_0xfcb1('0x54')];break;case _0xfcb1('0x55'):_0x45ebdc['type']=db[_0xfcb1('0x50')][_0xfcb1('0x56')];_0x45ebdc[_0xfcb1('0x57')]=![];break;default:}return db['sequelize']['queryInterface'][_0xfcb1('0x58')]('cm_contacts',util['format'](_0xfcb1('0x59'),_0x48c43f['id']),_0x45ebdc);})[_0xfcb1('0x24')](function(){return _0x48c43f;});})['then'](respondWithResult(_0x511a9f,0xc9))['catch'](handleError(_0x511a9f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f017a59..7f01c40 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 _0x8654=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x4b0f0e,_0x57d1f0){var _0x36acb4=function(_0x595704){while(--_0x595704){_0x4b0f0e['push'](_0x4b0f0e['shift']());}};_0x36acb4(++_0x57d1f0);}(_0x8654,0x1cc));var _0x4865=function(_0x3adb8e,_0x479df6){_0x3adb8e=_0x3adb8e-0x0;var _0x1795c0=_0x8654[_0x3adb8e];return _0x1795c0;};'use strict';var _=require(_0x4865('0x0'));var util=require(_0x4865('0x1'));var logger=require(_0x4865('0x2'))('api');var moment=require(_0x4865('0x3'));var BPromise=require(_0x4865('0x4'));var rp=require(_0x4865('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4865('0x6'));var config=require(_0x4865('0x7'));var attributes=require(_0x4865('0x8'));module[_0x4865('0x9')]=function(_0x19e399,_0x1b647c){return _0x19e399['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ea0=['CmCustomField','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmCustomField.attributes','define'];(function(_0x33c92d,_0x2cbd62){var _0xde178=function(_0x370e79){while(--_0x370e79){_0x33c92d['push'](_0x33c92d['shift']());}};_0xde178(++_0x2cbd62);}(_0x2ea0,0xdd));var _0x02ea=function(_0xf3d4dd,_0x3d1208){_0xf3d4dd=_0xf3d4dd-0x0;var _0x1f4e7b=_0x2ea0[_0xf3d4dd];return _0x1f4e7b;};'use strict';var _=require(_0x02ea('0x0'));var util=require(_0x02ea('0x1'));var logger=require(_0x02ea('0x2'))(_0x02ea('0x3'));var moment=require(_0x02ea('0x4'));var BPromise=require(_0x02ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x02ea('0x6'));var config=require(_0x02ea('0x7'));var attributes=require(_0x02ea('0x8'));module['exports']=function(_0x45ee04,_0x5cf3a6){return _0x45ee04[_0x02ea('0x9')](_0x02ea('0xa'),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 32116a6..2c19694 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 _0x5e94=['code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xcaf035,_0x4cfffa){var _0x149bf0=function(_0x34cd04){while(--_0x34cd04){_0xcaf035['push'](_0xcaf035['shift']());}};_0x149bf0(++_0x4cfffa);}(_0x5e94,0xb5));var _0x45e9=function(_0x4ad72f,_0x5a9055){_0x4ad72f=_0x4ad72f-0x0;var _0x279dcf=_0x5e94[_0x4ad72f];return _0x279dcf;};'use strict';var _=require(_0x45e9('0x0'));var util=require(_0x45e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45e9('0x2'));var fs=require('fs');var Redis=require(_0x45e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x45e9('0x4'));var logger=require('../../config/logger')(_0x45e9('0x5'));var config=require(_0x45e9('0x6'));var jayson=require(_0x45e9('0x7'));var client=jayson['client'][_0x45e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30e759,_0x129055,_0x27fee5){return new BPromise(function(_0x25e5fa,_0x2f4225){return client[_0x45e9('0x9')](_0x30e759,_0x27fee5)[_0x45e9('0xa')](function(_0x3556b0){logger[_0x45e9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x129055,'request\x20sent');logger[_0x45e9('0xc')](_0x45e9('0xd'),_0x129055,_0x45e9('0xe'),JSON[_0x45e9('0xf')](_0x3556b0));if(_0x3556b0[_0x45e9('0x10')]){if(_0x3556b0[_0x45e9('0x10')][_0x45e9('0x11')]===0x1f4){logger[_0x45e9('0x10')](_0x45e9('0x12'),_0x129055,_0x3556b0[_0x45e9('0x10')]['message']);return _0x2f4225(_0x3556b0[_0x45e9('0x10')]['message']);}logger[_0x45e9('0x10')](_0x45e9('0x12'),_0x129055,_0x3556b0['error'][_0x45e9('0x13')]);return _0x25e5fa(_0x3556b0[_0x45e9('0x10')][_0x45e9('0x13')]);}else{logger[_0x45e9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x129055,_0x45e9('0xe'));_0x25e5fa(_0x3556b0[_0x45e9('0x14')][_0x45e9('0x13')]);}})[_0x45e9('0x15')](function(_0x5bff43){logger['error'](_0x45e9('0x12'),_0x129055,_0x5bff43);_0x2f4225(_0x5bff43);});});} \ No newline at end of file +var _0x8ee1=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message'];(function(_0x473706,_0x438bc3){var _0x2f1a5d=function(_0x222319){while(--_0x222319){_0x473706['push'](_0x473706['shift']());}};_0x2f1a5d(++_0x438bc3);}(_0x8ee1,0x1e4));var _0x18ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8ee1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x18ee('0x0'));var util=require('util');var moment=require(_0x18ee('0x1'));var BPromise=require(_0x18ee('0x2'));var rs=require(_0x18ee('0x3'));var fs=require('fs');var Redis=require(_0x18ee('0x4'));var db=require(_0x18ee('0x5'))['db'];var utils=require(_0x18ee('0x6'));var logger=require(_0x18ee('0x7'))(_0x18ee('0x8'));var config=require(_0x18ee('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x18ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x133d4c,_0x43453a,_0x251335){return new BPromise(function(_0x1d6d5d,_0x320855){return client[_0x18ee('0xb')](_0x133d4c,_0x251335)['then'](function(_0x16fa5e){logger[_0x18ee('0xc')]('CmCustomField,\x20%s,\x20%s',_0x43453a,_0x18ee('0xd'));logger[_0x18ee('0xe')](_0x18ee('0xf'),_0x43453a,_0x18ee('0xd'),JSON[_0x18ee('0x10')](_0x16fa5e));if(_0x16fa5e['error']){if(_0x16fa5e['error']['code']===0x1f4){logger[_0x18ee('0x11')](_0x18ee('0x12'),_0x43453a,_0x16fa5e['error'][_0x18ee('0x13')]);return _0x320855(_0x16fa5e[_0x18ee('0x11')][_0x18ee('0x13')]);}logger[_0x18ee('0x11')](_0x18ee('0x12'),_0x43453a,_0x16fa5e[_0x18ee('0x11')][_0x18ee('0x13')]);return _0x1d6d5d(_0x16fa5e[_0x18ee('0x11')]['message']);}else{logger['info'](_0x18ee('0x12'),_0x43453a,_0x18ee('0xd'));_0x1d6d5d(_0x16fa5e[_0x18ee('0x14')][_0x18ee('0x13')]);}})['catch'](function(_0x152f14){logger['error'](_0x18ee('0x12'),_0x43453a,_0x152f14);_0x320855(_0x152f14);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 9c650d8..1178102 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 _0x126e=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x126e,0x108));var _0xe126=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x126e[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/:id',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0xd')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xe')]);router['put'](_0xe126('0xf'),auth[_0xe126('0xa')](),controller['update']);router[_0xe126('0x10')](_0xe126('0xf'),auth['isAuthenticated'](),controller[_0xe126('0x11')]);module['exports']=router; \ No newline at end of file +var _0x897d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x257d84,_0x8eaaea){var _0x3d1ba2=function(_0x349119){while(--_0x349119){_0x257d84['push'](_0x257d84['shift']());}};_0x3d1ba2(++_0x8eaaea);}(_0x897d,0x80));var _0xd897=function(_0x217a95,_0xd8b1e7){_0x217a95=_0x217a95-0x0;var _0x2646c0=_0x897d[_0x217a95];return _0x2646c0;};'use strict';var multer=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var path=require(_0xd897('0x2'));var timeout=require(_0xd897('0x3'));var express=require(_0xd897('0x4'));var router=express[_0xd897('0x5')]();var fs_extra=require(_0xd897('0x6'));var auth=require(_0xd897('0x7'));var interaction=require(_0xd897('0x8'));var config=require(_0xd897('0x9'));var controller=require(_0xd897('0xa'));router[_0xd897('0xb')]('/',auth[_0xd897('0xc')](),controller[_0xd897('0xd')]);router[_0xd897('0xb')](_0xd897('0xe'),auth[_0xd897('0xc')](),controller[_0xd897('0xf')]);router[_0xd897('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd897('0x11')](_0xd897('0xe'),auth['isAuthenticated'](),controller[_0xd897('0x12')]);router[_0xd897('0x13')](_0xd897('0xe'),auth[_0xd897('0xc')](),controller[_0xd897('0x14')]);module[_0xd897('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6a10bb4..e03d17d 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 _0x68a2=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','STRING'];(function(_0x447770,_0x690294){var _0x4b3fc7=function(_0x50455a){while(--_0x50455a){_0x447770['push'](_0x447770['shift']());}};_0x4b3fc7(++_0x690294);}(_0x68a2,0x15e));var _0x268a=function(_0x3d5921,_0x4ecb26){_0x3d5921=_0x3d5921-0x0;var _0x3baba9=_0x68a2[_0x3d5921];return _0x3baba9;};'use strict';var moment=require(_0x268a('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x268a('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x268a('0x3')],'defaultValue':moment()['format'](_0x268a('0x4'))},'countbusyretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x268a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x268a('0x3')]},'priority':{'type':Sequelize[_0x268a('0x5')](0x2)[_0x268a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'ListId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'CampaignId':{'type':Sequelize[_0x268a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x268a('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x268a('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8bff=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bff,0xb3));var _0xf8bf=function(_0x35f2f3,_0x1bbec2){_0x35f2f3=_0x35f2f3-0x0;var _0x38c76a=_0x8bff[_0x35f2f3];return _0x38c76a;};'use strict';var moment=require('moment');var Sequelize=require(_0xf8bf('0x0'));module['exports']={'phone':{'type':Sequelize[_0xf8bf('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xf8bf('0x2')](_0xf8bf('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf8bf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8bf('0x5')]},'priority':{'type':Sequelize[_0xf8bf('0x6')](0x2)[_0xf8bf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf8bf('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf8bf('0x6')],'unique':_0xf8bf('0x8')},'UserId':{'type':Sequelize[_0xf8bf('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf8bf('0x8')},'CampaignId':{'type':Sequelize[_0xf8bf('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf8bf('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8bf('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf8bf('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8bf('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf8bf('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8bf('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf8bf('0x5')],'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 23262be..b14aed4 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 _0x106f=['where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','find','catch','create','body','describe','destroy','params','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','firstName','isNil','calleridname','lastName','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','prev','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','recallme','UPDATE','CmList','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x34951f,_0x277327){var _0x487db1=function(_0x452a5f){while(--_0x452a5f){_0x34951f['push'](_0x34951f['shift']());}};_0x487db1(++_0x277327);}(_0x106f,0x162));var _0xf106=function(_0x27333b,_0x3ba850){_0x27333b=_0x27333b-0x0;var _0x535b10=_0x106f[_0x27333b];return _0x535b10;};'use strict';var moment=require(_0xf106('0x0'));var _=require(_0xf106('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xf106('0x2'))(_0xf106('0x3'));var shared=require('../../config/environment');var db=require(_0xf106('0x4'))['db'];function respondWithResult(_0x4ab04f,_0x1236af){_0x1236af=_0x1236af||0xc8;return function(_0x370f6a){if(_0x370f6a){return _0x4ab04f[_0xf106('0x5')](_0x1236af)[_0xf106('0x6')](_0x370f6a);}};}function respondWithFilteredResult(_0x253f6d,_0x282fd4){return function(_0xc9588d){if(_0xc9588d){var _0x546acc=typeof _0x282fd4[_0xf106('0x7')]===_0xf106('0x8')&&typeof _0x282fd4['limit']==='undefined';var _0x507ad9=_0xc9588d['count'];var _0x52befe=_0x546acc?0x0:_0x282fd4[_0xf106('0x7')];var _0x3761d5=_0x546acc?_0xc9588d[_0xf106('0x9')]:_0x282fd4[_0xf106('0x7')]+_0x282fd4[_0xf106('0xa')];var _0x32ba4d;if(_0x3761d5>=_0x507ad9){_0x3761d5=_0x507ad9;_0x32ba4d=0xc8;}else{_0x32ba4d=0xce;}_0x253f6d[_0xf106('0x5')](_0x32ba4d);return _0x253f6d[_0xf106('0xb')](_0xf106('0xc'),_0x52befe+'-'+_0x3761d5+'/'+_0x507ad9)[_0xf106('0x6')](_0xc9588d);}return null;};}function saveUpdates(_0x31eebf,_0x5e9da8){return function(_0x2bd234){if(_0x2bd234){return _0x2bd234[_0xf106('0xd')](_0x31eebf)['then'](function(_0x59854c){return _0x59854c;});}return null;};}function handleEntityNotFound(_0x322351,_0x2cdbf6){return function(_0x292a0d){if(!_0x292a0d){_0x322351['sendStatus'](0x194);}return _0x292a0d;};}function handleError(_0x26bd1b,_0x26186f){_0x26186f=_0x26186f||0x1f4;return function(_0xf05683){logger['error'](_0xf05683[_0xf106('0xe')]);if(_0xf05683[_0xf106('0xf')]){delete _0xf05683['name'];}_0x26bd1b[_0xf106('0x5')](_0x26186f)[_0xf106('0x10')](_0xf05683);};}exports[_0xf106('0x11')]=function(_0x5e4c8f,_0x5d02c0){var _0x13b6b4={},_0x726d7c={},_0x7e15d1={'count':0x0,'rows':[]};var _0x4d395d=_[_0xf106('0x12')](db[_0xf106('0x13')][_0xf106('0x14')],function(_0x17b243){return{'name':_0x17b243[_0xf106('0x15')],'type':_0x17b243[_0xf106('0x16')][_0xf106('0x17')]};});_0x726d7c[_0xf106('0x18')]=_[_0xf106('0x12')](_0x4d395d,'name');_0x726d7c['query']=_[_0xf106('0x19')](_0x5e4c8f['query']);_0x726d7c[_0xf106('0x1a')]=_[_0xf106('0x1b')](_0x726d7c[_0xf106('0x18')],_0x726d7c[_0xf106('0x1c')]);_0x726d7c[_0xf106('0x1a')]=_['concat'](_0x726d7c['filters'],[_0xf106('0x1d'),_0xf106('0x1e'),_0xf106('0x1f'),_0xf106('0x20'),_0xf106('0x21'),_0xf106('0x22'),_0xf106('0x23'),_0xf106('0x24'),_0xf106('0x25'),_0xf106('0x26'),_0xf106('0x27'),_0xf106('0x28'),'$notIn','$like','$notLike',_0xf106('0x29'),_0xf106('0x2a'),_0xf106('0x2b'),_0xf106('0x2c'),_0xf106('0x2d'),_0xf106('0x2e'),'$any']);_0x13b6b4[_0xf106('0x2f')]=_[_0xf106('0x1b')](_0x726d7c[_0xf106('0x18')],qs[_0xf106('0x30')](_0x5e4c8f['query'][_0xf106('0x30')]));_0x13b6b4[_0xf106('0x2f')]=_0x13b6b4[_0xf106('0x2f')][_0xf106('0x31')]?_0x13b6b4[_0xf106('0x2f')]:_0x726d7c[_0xf106('0x18')];if(!_0x5e4c8f['query'][_0xf106('0x32')](_0xf106('0x33'))){_0x13b6b4[_0xf106('0xa')]=qs[_0xf106('0xa')](_0x5e4c8f['query'][_0xf106('0xa')]);_0x13b6b4[_0xf106('0x7')]=qs['offset'](_0x5e4c8f[_0xf106('0x1c')][_0xf106('0x7')]);}_0x13b6b4[_0xf106('0x34')]=qs[_0xf106('0x35')](_0x5e4c8f[_0xf106('0x1c')][_0xf106('0x35')]);_0x13b6b4[_0xf106('0x36')]=qs[_0xf106('0x1a')](_[_0xf106('0x37')](_0x5e4c8f[_0xf106('0x1c')],_0x726d7c[_0xf106('0x1a')]),_0x4d395d);if(_0x5e4c8f['query']['filter']){_0x13b6b4[_0xf106('0x36')]=_[_0xf106('0x38')](_0x13b6b4[_0xf106('0x36')],{'$or':_['map'](_0x4d395d,function(_0x149645){if(_0x149645[_0xf106('0x16')]!==_0xf106('0x39')){var _0xebb99={};_0xebb99[_0x149645[_0xf106('0xf')]]={'$like':'%'+_0x5e4c8f['query'][_0xf106('0x3a')]+'%'};return _0xebb99;}})});}_0x13b6b4=_['merge']({},_0x13b6b4,_0x5e4c8f[_0xf106('0x3b')]);var _0x2e4c93={'where':_0x13b6b4[_0xf106('0x36')]};return db[_0xf106('0x13')]['count'](_0x2e4c93)[_0xf106('0x3c')](function(_0x3d1e1f){_0x7e15d1[_0xf106('0x9')]=_0x3d1e1f;if(_0x5e4c8f['query']['includeAll']){_0x13b6b4['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x13b6b4);})[_0xf106('0x3c')](function(_0x5de95b){_0x7e15d1['rows']=_0x5de95b;return _0x7e15d1;})[_0xf106('0x3c')](respondWithFilteredResult(_0x5d02c0,_0x13b6b4))['catch'](handleError(_0x5d02c0,null));};exports['show']=function(_0x26ffc3,_0x1a3b02){var _0x2d4c90={'raw':!![],'where':{'id':_0x26ffc3['params']['id']}},_0x3e557d={};_0x3e557d[_0xf106('0x18')]=_[_0xf106('0x19')](db['CmHopper'][_0xf106('0x14')]);_0x3e557d[_0xf106('0x1c')]=_[_0xf106('0x19')](_0x26ffc3[_0xf106('0x1c')]);_0x3e557d[_0xf106('0x1a')]=_[_0xf106('0x1b')](_0x3e557d[_0xf106('0x18')],_0x3e557d['query']);_0x2d4c90['attributes']=_[_0xf106('0x1b')](_0x3e557d['model'],qs['fields'](_0x26ffc3[_0xf106('0x1c')][_0xf106('0x30')]));_0x2d4c90['attributes']=_0x2d4c90['attributes'][_0xf106('0x31')]?_0x2d4c90['attributes']:_0x3e557d[_0xf106('0x18')];if(_0x26ffc3[_0xf106('0x1c')][_0xf106('0x3d')]){_0x2d4c90[_0xf106('0x3e')]=[{'all':!![]}];}_0x2d4c90=_[_0xf106('0x38')]({},_0x2d4c90,_0x26ffc3[_0xf106('0x3b')]);return db[_0xf106('0x13')][_0xf106('0x3f')](_0x2d4c90)[_0xf106('0x3c')](handleEntityNotFound(_0x1a3b02,null))[_0xf106('0x3c')](respondWithResult(_0x1a3b02,null))[_0xf106('0x40')](handleError(_0x1a3b02,null));};exports[_0xf106('0x41')]=function(_0x39763c,_0x252ee1){return db[_0xf106('0x13')][_0xf106('0x41')](_0x39763c[_0xf106('0x42')],{})[_0xf106('0x3c')](respondWithResult(_0x252ee1,0xc9))['catch'](handleError(_0x252ee1,null));};exports[_0xf106('0xd')]=function(_0x20942e,_0xd0e741){if(_0x20942e[_0xf106('0x42')]['id']){delete _0x20942e[_0xf106('0x42')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x20942e['params']['id']}})['then'](handleEntityNotFound(_0xd0e741,null))[_0xf106('0x3c')](saveUpdates(_0x20942e['body'],null))['then'](respondWithResult(_0xd0e741,null))[_0xf106('0x40')](handleError(_0xd0e741,null));};exports[_0xf106('0x43')]=function(_0xd50443,_0x105337){return db['CmHopper'][_0xf106('0x43')]()[_0xf106('0x3c')](respondWithResult(_0x105337,null))[_0xf106('0x40')](handleError(_0x105337,null));};exports[_0xf106('0x44')]=function(_0x1bf065,_0x519192){var _0x59bd01;var _0x37dc6a=_0x1bf065[_0xf106('0x45')]['id'];return db[_0xf106('0x13')]['find']({'where':{'id':_0x1bf065[_0xf106('0x45')]['id']}})[_0xf106('0x3c')](handleEntityNotFound(_0x519192,null))[_0xf106('0x3c')](function(_0x1ddfce){if(_0x1ddfce){return _0x1ddfce['destroy']()[_0xf106('0x3c')](function(_0x5b80a8){return _0x5b80a8;});}})['then'](function(_0x148730){_0x59bd01=_0x148730;if(_0x148730){if(_0x148730[_0xf106('0x46')]||_0x148730['CampaignId']){return db[_0x148730[_0xf106('0x46')]?_0xf106('0x47'):_0xf106('0x48')][_0xf106('0x3f')]({'where':{'id':_0x148730[_0xf106('0x46')]?_0x148730[_0xf106('0x46')]:_0x148730['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xf106('0x3c')](function(_0x53b682){var _0x20c935={};if(_0x53b682){_['merge'](_0x20c935,_[_0xf106('0x49')](_0x59bd01[_0xf106('0x4a')],[_0xf106('0x4b'),_0xf106('0x4c'),'id']));_0x20c935['state']=0x15;_0x20c935[_0xf106('0x4d')]=_0xf106('0x4e');_0x20c935[_0xf106('0x4f')]=_0x53b682[_0xf106('0xf')];_0x20c935[_0xf106('0x50')]=_0x1bf065[_0xf106('0x51')][_0xf106('0xf')];_0x20c935[_0xf106('0x52')]=_0x1bf065[_0xf106('0x51')]['id'];_0x20c935[_0xf106('0x4e')]=!![];_0x20c935[_0xf106('0x53')]=moment()[_0xf106('0x54')](_0xf106('0x55'));_0x20c935[_0xf106('0x56')]=_0x59bd01[_0xf106('0x57')];_0x20c935[_0xf106('0x58')]=_0x59bd01['VoiceQueueId']?'queue':_0xf106('0x59');return db[_0xf106('0x5a')][_0xf106('0x3f')]({'where':{'id':_0x20c935['ContactId']},'attributes':[_0xf106('0x5b'),'lastName']})[_0xf106('0x3c')](function(_0x332a79){if(!_[_0xf106('0x5c')](_0x519192)&&!_['isNil'](_0x332a79[_0xf106('0x5b')])){_0x20c935['calleridname']=_0x332a79[_0xf106('0x5b')];if(!_[_0xf106('0x5c')](_0x332a79['lastName'])){_0x20c935[_0xf106('0x5d')]+='\x20'+_0x332a79[_0xf106('0x5e')];}}})['finally'](function(){return db[_0xf106('0x5f')][_0xf106('0x41')](_0x20c935);});}})['then'](function(_0x24f283){return db['CmHopperAdditionalPhone'][_0xf106('0x44')]({'where':{'CmHopperId':_0x37dc6a}});})[_0xf106('0x3c')](function(){return _0x519192['status'](0xcc)[_0xf106('0x60')]();})['catch'](handleError(_0x519192,null));};exports['getPreview']=function(_0x151d33,_0x1b903b){var _0x15bf0f=[];return db[_0xf106('0x5a')][_0xf106('0x43')]()[_0xf106('0x3c')](function(_0xe2c0ee){_0x15bf0f=_[_0xf106('0x19')](_0xe2c0ee);return _0x151d33[_0xf106('0x51')][_0xf106('0x61')]({'where':{'type':_0xf106('0x62'),'dialActive':!![],'dialMethod':_0xf106('0x63')},'attributes':['id',_0xf106('0x64'),_0xf106('0x65')],'raw':!![]});})[_0xf106('0x3c')](function(_0x40bc98){if(_0x40bc98&&_0x40bc98['length']){return db[_0xf106('0x66')]['transaction'](function(_0x40be0c){var _0x505f8f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf106('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x40bc98,'id')},'$or':[{'UserId':null},{'UserId':_0x151d33[_0xf106('0x51')]['id']}]};var _0x3c07c6={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x40bc98)[_0xf106('0x3a')]([_0xf106('0x65'),0x0])[_0xf106('0x12')]('id')[_0xf106('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x151d33[_0xf106('0x51')]['id']}]};var _0x1eac36={'$or':[_0x505f8f,_0x3c07c6]};var _0x409d13=[];if(_0x151d33['body'][_0xf106('0x68')]&&_0x151d33[_0xf106('0x42')]['direction']===_0xf106('0x69')){if(!_['isEmpty'](_0x151d33[_0xf106('0x42')][_0xf106('0x6a')])){_0x1eac36['id']={'$in':_0x151d33[_0xf106('0x42')][_0xf106('0x6a')]};}_0x409d13=[['priority',_0xf106('0x6b')],[_0xf106('0x6c'),_0x40bc98[0x0][_0xf106('0x64')]===_0xf106('0x6b')?'DESC':_0xf106('0x6b')],db[_0xf106('0x66')][_0xf106('0x6d')](_0xf106('0x6e')),['id',_0xf106('0x6f')]];}else{if(!_[_0xf106('0x70')](_0x151d33[_0xf106('0x42')][_0xf106('0x6a')])){_0x1eac36['id']={'$notIn':_0x151d33[_0xf106('0x42')][_0xf106('0x6a')]};}_0x409d13=[[_0xf106('0x71'),_0xf106('0x6f')],['scheduledAt',_0x40bc98[0x0][_0xf106('0x64')]],db[_0xf106('0x66')][_0xf106('0x6d')](_0xf106('0x72')),['id',_0xf106('0x6b')]];}return db['CmHopper'][_0xf106('0x73')]({'attributes':['id',_0xf106('0x74'),_0xf106('0x57'),'recallme'],'where':_0x1eac36,'order':_0x409d13,'transaction':_0x40be0c,'lock':_0x40be0c[_0xf106('0x75')]['UPDATE'],'include':[{'model':db[_0xf106('0x5a')],'as':_0xf106('0x76'),'attributes':_0x15bf0f,'include':[{'model':db[_0xf106('0x77')],'as':_0xf106('0x78'),'attributes':['id',_0xf106('0xf')]}]},{'model':db['CmList'],'as':_0xf106('0x79'),'attributes':['id','name']},{'model':db[_0xf106('0x47')],'as':_0xf106('0x7a'),'attributes':['id',_0xf106('0xf'),_0xf106('0x7b')]}]})[_0xf106('0x3c')](function(_0x27f68c){if(_0x27f68c){return _0x27f68c[_0xf106('0xd')]({'UserId':_0x151d33[_0xf106('0x51')]['id']},{'transaction':_0x40be0c});}});});}})['then'](handleEntityNotFound(_0x1b903b,null))[_0xf106('0x3c')](respondWithResult(_0x1b903b,null))['catch'](handleError(_0x1b903b,null));};exports[_0xf106('0x7c')]=function(_0x4393b1,_0x5974ed,_0x1d4b0f){var _0x340317=[];var _0x5258ad=_0x4393b1[_0xf106('0x45')]['id'];var _0x5eafcf=_0x4393b1[_0xf106('0x51')]['id'];return db[_0xf106('0x5a')][_0xf106('0x43')]()['then'](function(_0x35263c){_0x340317=_['keys'](_0x35263c);return db[_0xf106('0x66')]['transaction'](function(_0x26fc26){const _0x28e042={'id':_0x5258ad};return db[_0xf106('0x13')][_0xf106('0x73')]({'attributes':['id',_0xf106('0x74'),_0xf106('0x7d')],'where':_0x28e042,'transaction':_0x26fc26,'lock':_0x26fc26[_0xf106('0x75')][_0xf106('0x7e')],'include':[{'model':db[_0xf106('0x5a')],'as':_0xf106('0x76'),'attributes':_0x340317,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xf106('0xf')]}]},{'model':db[_0xf106('0x7f')],'as':_0xf106('0x79'),'attributes':['id',_0xf106('0xf')]},{'model':db[_0xf106('0x47')],'as':_0xf106('0x7a'),'attributes':['id','name',_0xf106('0x7b')]}]})[_0xf106('0x3c')](function(_0x4b5ef5){if(_0x4b5ef5){return _0x4b5ef5[_0xf106('0xd')]({'UserId':_0x5eafcf},{'transaction':_0x26fc26});}});});})[_0xf106('0x3c')](handleEntityNotFound(_0x5974ed,null))['then'](respondWithResult(_0x5974ed,null))[_0xf106('0x40')](handleError(_0x5974ed,null));};exports[_0xf106('0x80')]=function(_0x1ce81f,_0x5a1d5e){return _0x1ce81f[_0xf106('0x51')][_0xf106('0x61')]({'where':{'type':_0xf106('0x62'),'dialActive':!![],'dialMethod':_0xf106('0x63')},'attributes':['id'],'raw':!![]})[_0xf106('0x3c')](function(_0x2f6a31){if(_0x2f6a31&&_0x2f6a31[_0xf106('0x31')]){return db[_0xf106('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf106('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x2f6a31,'id')},'$or':[{'UserId':null},{'UserId':_0x1ce81f['user']['id']}]}});}return 0x0;})[_0xf106('0x3c')](function(_0x5547ed){if(!_[_0xf106('0x5c')](_0x5547ed)&&_['isNumber'](_0x5547ed)){return _0x5a1d5e[_0xf106('0x5')](0xc8)[_0xf106('0x6')]({'contacts':_0x5547ed});}else{logger['error'](_0xf106('0x81'),_0xf106('0x80'),0x194,_0xf106('0x82'));_0x5a1d5e[_0xf106('0x83')](0x194);}})[_0xf106('0x40')](handleError(_0x5a1d5e,null));};exports[_0xf106('0x84')]=function(_0x50d390,_0x92e626){var _0x4760fd=shared['timezones'];var _0x4b6927=[];_[_0xf106('0x12')](_0x4760fd,function(_0x1f2297){_0x4b6927[_0xf106('0x85')]({'id':_0x1f2297[_0xf106('0xf')],'name':_0x1f2297[_0xf106('0xf')],'utcOffset':_0x1f2297[_0xf106('0x86')]});});return _0x92e626[_0xf106('0x5')](0xc8)[_0xf106('0x6')]({'tz':_0x4b6927});};exports[_0xf106('0x87')]=function(_0x578815,_0x3e037e){var _0x10fb6e=shared['timezones'];var _0x4986c9={};if(!_[_0xf106('0x5c')](_0x10fb6e[_0x578815[_0xf106('0x42')]['id']]))_0x4986c9=_0x10fb6e[_0x578815['body']['id']];return _0x3e037e[_0xf106('0x5')](0xc8)['json'](_0x4986c9);}; \ No newline at end of file +var _0x885a=['key','model','query','keys','filters','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','dialActive','getPreviewRecall','transaction','recallme','Contact','Queue','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','CmHopper','rawAttributes','type'];(function(_0x23cfaf,_0x1d8545){var _0xf8af44=function(_0x163779){while(--_0x163779){_0x23cfaf['push'](_0x23cfaf['shift']());}};_0xf8af44(++_0x1d8545);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var _=require(_0xa885('0x0'));var qs=require(_0xa885('0x1'));var logger=require(_0xa885('0x2'))(_0xa885('0x3'));var shared=require('../../config/environment');var db=require(_0xa885('0x4'))['db'];function respondWithResult(_0x1c41b5,_0x2386ec){_0x2386ec=_0x2386ec||0xc8;return function(_0x106e16){if(_0x106e16){return _0x1c41b5[_0xa885('0x5')](_0x2386ec)[_0xa885('0x6')](_0x106e16);}};}function respondWithFilteredResult(_0x5dfd7e,_0x7ac6bd){return function(_0x1200c7){if(_0x1200c7){var _0x31fd77=typeof _0x7ac6bd['offset']===_0xa885('0x7')&&typeof _0x7ac6bd[_0xa885('0x8')]===_0xa885('0x7');var _0x5e49d0=_0x1200c7[_0xa885('0x9')];var _0x299f57=_0x31fd77?0x0:_0x7ac6bd[_0xa885('0xa')];var _0x745710=_0x31fd77?_0x1200c7[_0xa885('0x9')]:_0x7ac6bd[_0xa885('0xa')]+_0x7ac6bd[_0xa885('0x8')];var _0x571c0d;if(_0x745710>=_0x5e49d0){_0x745710=_0x5e49d0;_0x571c0d=0xc8;}else{_0x571c0d=0xce;}_0x5dfd7e[_0xa885('0x5')](_0x571c0d);return _0x5dfd7e[_0xa885('0xb')](_0xa885('0xc'),_0x299f57+'-'+_0x745710+'/'+_0x5e49d0)[_0xa885('0x6')](_0x1200c7);}return null;};}function saveUpdates(_0x412b2a,_0x3e9c7a){return function(_0x4585d9){if(_0x4585d9){return _0x4585d9['update'](_0x412b2a)[_0xa885('0xd')](function(_0x1d789f){return _0x1d789f;});}return null;};}function handleEntityNotFound(_0x27b24a,_0x12d81c){return function(_0x33ce2e){if(!_0x33ce2e){_0x27b24a['sendStatus'](0x194);}return _0x33ce2e;};}function handleError(_0x1c9687,_0x2ca5c5){_0x2ca5c5=_0x2ca5c5||0x1f4;return function(_0x5296e6){logger[_0xa885('0xe')](_0x5296e6[_0xa885('0xf')]);if(_0x5296e6['name']){delete _0x5296e6[_0xa885('0x10')];}_0x1c9687[_0xa885('0x5')](_0x2ca5c5)['send'](_0x5296e6);};}exports[_0xa885('0x11')]=function(_0x543e7a,_0x2e9290){var _0x3960ea={},_0x8c26c={},_0x4e4d51={'count':0x0,'rows':[]};var _0x289b76=_['map'](db[_0xa885('0x12')][_0xa885('0x13')],function(_0x113043){return{'name':_0x113043['fieldName'],'type':_0x113043[_0xa885('0x14')][_0xa885('0x15')]};});_0x8c26c[_0xa885('0x16')]=_['map'](_0x289b76,_0xa885('0x10'));_0x8c26c[_0xa885('0x17')]=_[_0xa885('0x18')](_0x543e7a['query']);_0x8c26c[_0xa885('0x19')]=_['intersection'](_0x8c26c[_0xa885('0x16')],_0x8c26c[_0xa885('0x17')]);_0x8c26c['filters']=_[_0xa885('0x1a')](_0x8c26c[_0xa885('0x19')],[_0xa885('0x1b'),'$or',_0xa885('0x1c'),_0xa885('0x1d'),'$lt',_0xa885('0x1e'),'$ne',_0xa885('0x1f'),'$not',_0xa885('0x20'),_0xa885('0x21'),_0xa885('0x22'),_0xa885('0x23'),_0xa885('0x24'),_0xa885('0x25'),_0xa885('0x26'),_0xa885('0x27'),'$like','$overlap','$contains','$contained',_0xa885('0x28')]);_0x3960ea[_0xa885('0x29')]=_[_0xa885('0x2a')](_0x8c26c[_0xa885('0x16')],qs[_0xa885('0x2b')](_0x543e7a[_0xa885('0x17')]['fields']));_0x3960ea[_0xa885('0x29')]=_0x3960ea['attributes'][_0xa885('0x2c')]?_0x3960ea['attributes']:_0x8c26c[_0xa885('0x16')];if(!_0x543e7a['query'][_0xa885('0x2d')](_0xa885('0x2e'))){_0x3960ea[_0xa885('0x8')]=qs['limit'](_0x543e7a[_0xa885('0x17')][_0xa885('0x8')]);_0x3960ea['offset']=qs[_0xa885('0xa')](_0x543e7a['query'][_0xa885('0xa')]);}_0x3960ea[_0xa885('0x2f')]=qs[_0xa885('0x30')](_0x543e7a['query'][_0xa885('0x30')]);_0x3960ea[_0xa885('0x31')]=qs[_0xa885('0x19')](_['pick'](_0x543e7a[_0xa885('0x17')],_0x8c26c[_0xa885('0x19')]),_0x289b76);if(_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]){_0x3960ea[_0xa885('0x31')]=_[_0xa885('0x33')](_0x3960ea[_0xa885('0x31')],{'$or':_[_0xa885('0x34')](_0x289b76,function(_0x5235af){if(_0x5235af['type']!==_0xa885('0x35')){var _0x1d43b5={};_0x1d43b5[_0x5235af[_0xa885('0x10')]]={'$like':'%'+_0x543e7a[_0xa885('0x17')][_0xa885('0x32')]+'%'};return _0x1d43b5;}})});}_0x3960ea=_[_0xa885('0x33')]({},_0x3960ea,_0x543e7a[_0xa885('0x36')]);var _0x337e55={'where':_0x3960ea[_0xa885('0x31')]};return db['CmHopper']['count'](_0x337e55)[_0xa885('0xd')](function(_0x576c78){_0x4e4d51['count']=_0x576c78;if(_0x543e7a[_0xa885('0x17')]['includeAll']){_0x3960ea[_0xa885('0x37')]=[{'all':!![]}];}return db[_0xa885('0x12')][_0xa885('0x38')](_0x3960ea);})[_0xa885('0xd')](function(_0x2d433e){_0x4e4d51[_0xa885('0x39')]=_0x2d433e;return _0x4e4d51;})[_0xa885('0xd')](respondWithFilteredResult(_0x2e9290,_0x3960ea))[_0xa885('0x3a')](handleError(_0x2e9290,null));};exports[_0xa885('0x3b')]=function(_0x2f48a9,_0x531586){var _0x30759d={'raw':!![],'where':{'id':_0x2f48a9[_0xa885('0x3c')]['id']}},_0x4012b3={};_0x4012b3[_0xa885('0x16')]=_[_0xa885('0x18')](db['CmHopper']['rawAttributes']);_0x4012b3[_0xa885('0x17')]=_[_0xa885('0x18')](_0x2f48a9[_0xa885('0x17')]);_0x4012b3[_0xa885('0x19')]=_[_0xa885('0x2a')](_0x4012b3['model'],_0x4012b3[_0xa885('0x17')]);_0x30759d[_0xa885('0x29')]=_['intersection'](_0x4012b3['model'],qs[_0xa885('0x2b')](_0x2f48a9[_0xa885('0x17')]['fields']));_0x30759d['attributes']=_0x30759d[_0xa885('0x29')][_0xa885('0x2c')]?_0x30759d[_0xa885('0x29')]:_0x4012b3[_0xa885('0x16')];if(_0x2f48a9[_0xa885('0x17')][_0xa885('0x3d')]){_0x30759d[_0xa885('0x37')]=[{'all':!![]}];}_0x30759d=_[_0xa885('0x33')]({},_0x30759d,_0x2f48a9[_0xa885('0x36')]);return db[_0xa885('0x12')][_0xa885('0x3e')](_0x30759d)['then'](handleEntityNotFound(_0x531586,null))[_0xa885('0xd')](respondWithResult(_0x531586,null))[_0xa885('0x3a')](handleError(_0x531586,null));};exports[_0xa885('0x3f')]=function(_0x49c6a7,_0x47f3b4){return db[_0xa885('0x12')][_0xa885('0x3f')](_0x49c6a7[_0xa885('0x40')],{})['then'](respondWithResult(_0x47f3b4,0xc9))[_0xa885('0x3a')](handleError(_0x47f3b4,null));};exports['update']=function(_0x2d4bb5,_0x245fe9){if(_0x2d4bb5['body']['id']){delete _0x2d4bb5[_0xa885('0x40')]['id'];}return db[_0xa885('0x12')][_0xa885('0x3e')]({'where':{'id':_0x2d4bb5[_0xa885('0x3c')]['id']}})[_0xa885('0xd')](handleEntityNotFound(_0x245fe9,null))['then'](saveUpdates(_0x2d4bb5[_0xa885('0x40')],null))[_0xa885('0xd')](respondWithResult(_0x245fe9,null))[_0xa885('0x3a')](handleError(_0x245fe9,null));};exports['describe']=function(_0x4d146e,_0x52fbeb){return db[_0xa885('0x12')][_0xa885('0x41')]()[_0xa885('0xd')](respondWithResult(_0x52fbeb,null))[_0xa885('0x3a')](handleError(_0x52fbeb,null));};exports[_0xa885('0x42')]=function(_0x49aa9b,_0x43245c){var _0x476532;var _0x4397d6=_0x49aa9b[_0xa885('0x3c')]['id'];return db[_0xa885('0x12')]['find']({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))[_0xa885('0xd')](function(_0x289716){if(_0x289716){return _0x289716[_0xa885('0x42')]()[_0xa885('0xd')](function(_0x164d9d){return _0x164d9d;});}})[_0xa885('0xd')](function(_0x35e931){_0x476532=_0x35e931;if(_0x35e931){if(_0x35e931['VoiceQueueId']||_0x35e931[_0xa885('0x43')]){return db[_0x35e931[_0xa885('0x44')]?_0xa885('0x45'):_0xa885('0x46')][_0xa885('0x3e')]({'where':{'id':_0x35e931[_0xa885('0x44')]?_0x35e931[_0xa885('0x44')]:_0x35e931['CampaignId']},'attributes':['id',_0xa885('0x10')],'raw':!![]});}}})[_0xa885('0xd')](function(_0x1fde66){var _0x55ea83={};if(_0x1fde66){_[_0xa885('0x33')](_0x55ea83,_[_0xa885('0x47')](_0x476532[_0xa885('0x48')],[_0xa885('0x49'),_0xa885('0x4a'),'id']));_0x55ea83[_0xa885('0x4b')]=0x15;_0x55ea83[_0xa885('0x4c')]=_0xa885('0x4d');_0x55ea83['campaign']=_0x1fde66[_0xa885('0x10')];_0x55ea83[_0xa885('0x4e')]=_0x49aa9b[_0xa885('0x4f')]['name'];_0x55ea83[_0xa885('0x50')]=_0x49aa9b[_0xa885('0x4f')]['id'];_0x55ea83[_0xa885('0x4d')]=!![];_0x55ea83[_0xa885('0x51')]=moment()[_0xa885('0x52')](_0xa885('0x53'));_0x55ea83['calleridnum']=_0x476532[_0xa885('0x54')];_0x55ea83[_0xa885('0x55')]=_0x476532[_0xa885('0x44')]?'queue':_0xa885('0x56');return db[_0xa885('0x57')][_0xa885('0x3e')]({'where':{'id':_0x55ea83[_0xa885('0x58')]},'attributes':[_0xa885('0x59'),_0xa885('0x5a')]})[_0xa885('0xd')](function(_0x288bbc){if(!_[_0xa885('0x5b')](_0x43245c)&&!_['isNil'](_0x288bbc[_0xa885('0x59')])){_0x55ea83[_0xa885('0x5c')]=_0x288bbc['firstName'];if(!_['isNil'](_0x288bbc[_0xa885('0x5a')])){_0x55ea83[_0xa885('0x5c')]+='\x20'+_0x288bbc['lastName'];}}})[_0xa885('0x5d')](function(){return db[_0xa885('0x5e')][_0xa885('0x3f')](_0x55ea83);});}})[_0xa885('0xd')](function(_0x1e3576){return db[_0xa885('0x5f')][_0xa885('0x42')]({'where':{'CmHopperId':_0x4397d6}});})['then'](function(){return _0x43245c[_0xa885('0x5')](0xcc)[_0xa885('0x60')]();})['catch'](handleError(_0x43245c,null));};exports[_0xa885('0x61')]=function(_0x48ded4,_0x117cfe){var _0x5698d6=[];return db[_0xa885('0x57')][_0xa885('0x41')]()[_0xa885('0xd')](function(_0x22eb32){_0x5698d6=_['keys'](_0x22eb32);return _0x48ded4[_0xa885('0x4f')][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xa885('0x64'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xa885('0xd')](function(_0xb066be){if(_0xb066be&&_0xb066be['length']){return db[_0xa885('0x65')]['transaction'](function(_0x36c7ba){var _0x2f053a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0xb066be,'id')},'$or':[{'UserId':null},{'UserId':_0x48ded4[_0xa885('0x4f')]['id']}]};var _0x3bc750={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb066be)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xa885('0x34')]('id')[_0xa885('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x48ded4['user']['id']}]};var _0x55d5d0={'$or':[_0x2f053a,_0x3bc750]};var _0x3c9df4=[];if(_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]&&_0x48ded4[_0xa885('0x40')][_0xa885('0x67')]===_0xa885('0x68')){if(!_[_0xa885('0x69')](_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')])){_0x55d5d0['id']={'$in':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[['priority',_0xa885('0x6b')],[_0xa885('0x6c'),_0xb066be[0x0][_0xa885('0x64')]===_0xa885('0x6b')?_0xa885('0x6d'):'ASC'],db[_0xa885('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xa885('0x6d')]];}else{if(!_[_0xa885('0x69')](_0x48ded4['body']['hopperIds'])){_0x55d5d0['id']={'$notIn':_0x48ded4[_0xa885('0x40')][_0xa885('0x6a')]};}_0x3c9df4=[[_0xa885('0x6e'),'DESC'],['scheduledAt',_0xb066be[0x0][_0xa885('0x64')]],db[_0xa885('0x65')][_0xa885('0x6f')](_0xa885('0x70')),['id','ASC']];}return db[_0xa885('0x12')][_0xa885('0x71')]({'attributes':['id',_0xa885('0x72'),'phone','recallme'],'where':_0x55d5d0,'order':_0x3c9df4,'transaction':_0x36c7ba,'lock':_0x36c7ba[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':'Contact','attributes':_0x5698d6,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id',_0xa885('0x10')]}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':'Queue','attributes':['id',_0xa885('0x10'),_0xa885('0x78')]}]})['then'](function(_0x314d83){if(_0x314d83){return _0x314d83['update']({'UserId':_0x48ded4[_0xa885('0x4f')]['id']},{'transaction':_0x36c7ba});}});});}})[_0xa885('0xd')](handleEntityNotFound(_0x117cfe,null))[_0xa885('0xd')](respondWithResult(_0x117cfe,null))[_0xa885('0x3a')](handleError(_0x117cfe,null));};exports[_0xa885('0x79')]=function(_0x29ed6e,_0x1ca586,_0x3aa8bc){var _0x490d15=[];var _0x55413d=_0x29ed6e[_0xa885('0x3c')]['id'];var _0xb1eac6=_0x29ed6e['user']['id'];return db[_0xa885('0x57')][_0xa885('0x41')]()['then'](function(_0x425374){_0x490d15=_['keys'](_0x425374);return db[_0xa885('0x65')][_0xa885('0x7a')](function(_0x37ef1b){const _0x26950f={'id':_0x55413d};return db['CmHopper']['findOne']({'attributes':['id',_0xa885('0x72'),_0xa885('0x7b')],'where':_0x26950f,'transaction':_0x37ef1b,'lock':_0x37ef1b[_0xa885('0x73')][_0xa885('0x74')],'include':[{'model':db[_0xa885('0x57')],'as':_0xa885('0x7c'),'attributes':_0x490d15,'include':[{'model':db[_0xa885('0x75')],'as':_0xa885('0x76'),'attributes':['id','name']}]},{'model':db[_0xa885('0x77')],'as':'List','attributes':['id',_0xa885('0x10')]},{'model':db[_0xa885('0x45')],'as':_0xa885('0x7d'),'attributes':['id','name',_0xa885('0x78')]}]})[_0xa885('0xd')](function(_0x50a7ef){if(_0x50a7ef){return _0x50a7ef['update']({'UserId':_0xb1eac6},{'transaction':_0x37ef1b});}});});})[_0xa885('0xd')](handleEntityNotFound(_0x1ca586,null))[_0xa885('0xd')](respondWithResult(_0x1ca586,null))[_0xa885('0x3a')](handleError(_0x1ca586,null));};exports[_0xa885('0x7e')]=function(_0x243d5e,_0x4bd60c){return _0x243d5e['user'][_0xa885('0x62')]({'where':{'type':_0xa885('0x63'),'dialActive':!![],'dialMethod':_0xa885('0x7f')},'attributes':['id'],'raw':!![]})[_0xa885('0xd')](function(_0x56bd37){if(_0x56bd37&&_0x56bd37['length']){return db['CmHopper'][_0xa885('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa885('0x52')](_0xa885('0x53'))},'VoiceQueueId':{'$in':_[_0xa885('0x34')](_0x56bd37,'id')},'$or':[{'UserId':null},{'UserId':_0x243d5e[_0xa885('0x4f')]['id']}]}});}return 0x0;})[_0xa885('0xd')](function(_0x220614){if(!_['isNil'](_0x220614)&&_['isNumber'](_0x220614)){return _0x4bd60c[_0xa885('0x5')](0xc8)['json']({'contacts':_0x220614});}else{logger[_0xa885('0xe')](_0xa885('0x80'),_0xa885('0x7e'),0x194,_0xa885('0x81'));_0x4bd60c['sendStatus'](0x194);}})[_0xa885('0x3a')](handleError(_0x4bd60c,null));};exports[_0xa885('0x82')]=function(_0x2ff728,_0x5a6f1f){var _0xe5881c=shared[_0xa885('0x83')];var _0x9cda91=[];_['map'](_0xe5881c,function(_0x1d51ac){_0x9cda91[_0xa885('0x84')]({'id':_0x1d51ac[_0xa885('0x10')],'name':_0x1d51ac[_0xa885('0x10')],'utcOffset':_0x1d51ac[_0xa885('0x85')]});});return _0x5a6f1f[_0xa885('0x5')](0xc8)['json']({'tz':_0x9cda91});};exports[_0xa885('0x86')]=function(_0x40a85d,_0x3be76a){var _0x1689c8=shared['timezones'];var _0x3c088d={};if(!_[_0xa885('0x5b')](_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']]))_0x3c088d=_0x1689c8[_0x40a85d[_0xa885('0x40')]['id']];return _0x3be76a[_0xa885('0x5')](0xc8)[_0xa885('0x6')](_0x3c088d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ed502c6..f7b68e2 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x45179b,_0x2e9d90){var _0x191fb3=function(_0x72f162){while(--_0x72f162){_0x45179b['push'](_0x45179b['shift']());}};_0x191fb3(++_0x2e9d90);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x2b374b,_0x165a3c){var _0x2bdfe3=function(_0x18ea45){while(--_0x18ea45){_0x2b374b['push'](_0x2b374b['shift']());}};_0x2bdfe3(++_0x165a3c);}(_0x4819,0xcd));var _0x9481=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x4819[_0x408de5];return _0x2015a1;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[{'name':_0x9481('0xc'),'fields':[_0x9481('0xc')]},{'name':_0x9481('0xd'),'fields':['phone']},{'name':_0x9481('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ef870c2..182f6d8 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 _0x8ae9=['raw','attributes','limit','include','model','map','then','debug','stringify','message','error','find','info','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','catch','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','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','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','order','LOCK','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','lodash','util','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x98ae('0x2'))(_0x98ae('0x3'));exports[_0x98ae('0x4')]=function(_0x5a6b34){var _0x4eea43=this;return new Promise(function(_0x1423b7,_0x45d5ad){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x5a6b34['options']?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')]['where']||null:null,'attributes':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'include':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')]?_['map'](_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x51918e){return{'model':db[_0x51918e[_0x98ae('0xc')]],'as':_0x51918e['as'],'attributes':_0x51918e[_0x98ae('0x9')],'include':_0x51918e[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x51918e['include'],function(_0x3bb1e9){return{'model':db[_0x3bb1e9[_0x98ae('0xc')]],'as':_0x3bb1e9['as'],'attributes':_0x3bb1e9['attributes'],'include':_0x3bb1e9[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3bb1e9[_0x98ae('0xb')],function(_0x5e7578){return{'model':db[_0x5e7578[_0x98ae('0xc')]],'as':_0x5e7578['as'],'attributes':_0x5e7578['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0x530b86){logger['info'](_0x98ae('0x4'),_0x5a6b34);logger[_0x98ae('0xf')](_0x98ae('0x4'),_0x5a6b34,JSON[_0x98ae('0x10')](_0x530b86));_0x1423b7(_0x530b86);})['catch'](function(_0xb45dff){logger['error'](_0x98ae('0x4'),_0xb45dff[_0x98ae('0x11')],_0x5a6b34);_0x45d5ad(_0x4eea43[_0x98ae('0x12')](0x1f4,_0xb45dff['message']));});});};exports['ShowCmHopper']=function(_0x1f90c2){var _0x328382=this;return new Promise(function(_0x445ad0,_0x521314){return db[_0x98ae('0x5')][_0x98ae('0x13')]({'raw':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2[_0x98ae('0x7')]['where']||null:null,'attributes':_0x1f90c2['options']?_0x1f90c2[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'include':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x1f90c2[_0x98ae('0x7')]['include'],function(_0xe43740){return{'model':db[_0xe43740[_0x98ae('0xc')]],'as':_0xe43740['as'],'attributes':_0xe43740['attributes'],'include':_0xe43740['include']?_['map'](_0xe43740['include'],function(_0x3f308e){return{'model':db[_0x3f308e[_0x98ae('0xc')]],'as':_0x3f308e['as'],'attributes':_0x3f308e[_0x98ae('0x9')],'include':_0x3f308e[_0x98ae('0xb')]?_['map'](_0x3f308e['include'],function(_0x43b883){return{'model':db[_0x43b883[_0x98ae('0xc')]],'as':_0x43b883['as'],'attributes':_0x43b883[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0xd42fa){logger[_0x98ae('0x14')](_0x98ae('0x15'),_0x1f90c2);logger[_0x98ae('0xf')](_0x98ae('0x15'),_0x1f90c2,JSON[_0x98ae('0x10')](_0xd42fa));_0x445ad0(_0xd42fa);})['catch'](function(_0xbb54e){logger[_0x98ae('0x12')]('ShowCmHopper',_0xbb54e['message'],_0x1f90c2);_0x521314(_0x328382[_0x98ae('0x12')](0x1f4,_0xbb54e[_0x98ae('0x11')]));});});};exports[_0x98ae('0x16')]=function(_0x2a3950){var _0x3202b1=this;return new Promise(function(_0x3fa925,_0x2e8d6c){return db[_0x98ae('0x5')]['create'](_0x2a3950[_0x98ae('0x17')],{'raw':_0x2a3950[_0x98ae('0x7')]?_0x2a3950[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![]})[_0x98ae('0xe')](function(_0x278bdd){logger['info'](_0x98ae('0x16'),_0x2a3950);logger[_0x98ae('0xf')](_0x98ae('0x16'),_0x2a3950,JSON[_0x98ae('0x10')](_0x278bdd));_0x3fa925(_0x278bdd);})['catch'](function(_0x10cfcd){logger['error'](_0x98ae('0x16'),_0x10cfcd[_0x98ae('0x11')],_0x2a3950);_0x2e8d6c(_0x3202b1['error'](0x1f4,_0x10cfcd[_0x98ae('0x11')]));});});};exports[_0x98ae('0x18')]=function(_0x522c66){var _0x276d02=this;return new Promise(function(_0x2d7008,_0x5f290f){return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x522c66[_0x98ae('0x17')],{'raw':_0x522c66[_0x98ae('0x7')]?_0x522c66[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x9')]||null:null,'limit':_0x522c66['options']?_0x522c66[_0x98ae('0x7')][_0x98ae('0xa')]||null:null})[_0x98ae('0xe')](function(_0xe0e73e){logger[_0x98ae('0x14')](_0x98ae('0x18'),_0x522c66);logger[_0x98ae('0x14')](_0x98ae('0x1b'),JSON[_0x98ae('0x10')](_0x522c66[_0x98ae('0x7')]['where']),_0x522c66[_0x98ae('0x17')][_0x98ae('0x1c')]);logger['debug'](_0x98ae('0x18'),_0x522c66,JSON['stringify'](_0xe0e73e));_0x2d7008(_0xe0e73e);})[_0x98ae('0x1d')](function(_0x597d8f){logger[_0x98ae('0x12')]('UpdateCmHopper',_0x597d8f[_0x98ae('0x11')],_0x522c66);_0x5f290f(_0x276d02[_0x98ae('0x12')](0x1f4,_0x597d8f[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1e')]=function(_0x541730){var _0x3ddf84=this;return new Promise(function(_0x3f7d52,_0x5288fe){return db['CmHopper']['destroy']({'where':_0x541730['options']?_0x541730[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null})[_0x98ae('0xe')](function(_0x481504){logger[_0x98ae('0x14')]('DestroyCmHopper',_0x541730);logger[_0x98ae('0xf')](_0x98ae('0x1e'),_0x541730,JSON[_0x98ae('0x10')](_0x481504));_0x3f7d52(_0x481504);})[_0x98ae('0x1d')](function(_0xeecc14){logger[_0x98ae('0x12')]('DestroyCmHopper',_0xeecc14[_0x98ae('0x11')],_0x541730);_0x5288fe(_0x3ddf84['error'](0x1f4,_0xeecc14[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1f')]=function(_0x47c8ad){var _0x236a01=this;return new Promise(function(_0x11edaf,_0x9dbceb){return db[_0x98ae('0x20')][_0x98ae('0x21')]()[_0x98ae('0xe')](function(_0x105be9){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x37f9b1){return db[_0x98ae('0x5')]['findAll']({'where':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'order':_0x47c8ad['options']?_0x47c8ad[_0x98ae('0x7')]['order']||null:null,'transaction':_0x37f9b1,'lock':_0x37f9b1['LOCK'][_0x98ae('0x24')],'include':[{'model':db[_0x98ae('0x20')],'as':'Contact','attributes':_[_0x98ae('0x25')](_0x105be9)},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]}]})['then'](function(_0x5166e1){var _0x565627=[];var _0x40ea49=[];for(var _0x285394=0x0;_0x285394<_0x5166e1[_0x98ae('0x2a')];_0x285394+=0x1){var _0x1408c6=_0x5166e1[_0x285394][_0x98ae('0x2b')];if(_0x1408c6===null){_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad[_0x98ae('0x17')],{'transaction':_0x37f9b1}));}else if(!_0x40ea49[_0x98ae('0x2d')](_0x1408c6)){_0x40ea49[_0x98ae('0x2c')](_0x1408c6);_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad['body'],{'transaction':_0x37f9b1}));}}return BPromise[_0x98ae('0x2e')](_0x565627);});})['then'](function(_0x3b8cda){logger[_0x98ae('0x14')](_0x98ae('0x1f'),_0x47c8ad);if(_0x3b8cda[_0x98ae('0x2a')]>0x0){logger[_0x98ae('0x14')](_0x98ae('0x2f'),_0x3b8cda[0x0][_0x98ae('0x30')]['id'],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x31')],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x1c')]);}logger[_0x98ae('0xf')](_0x98ae('0x1f'),_0x47c8ad,JSON[_0x98ae('0x10')](_0x3b8cda));_0x11edaf(_0x3b8cda);})['catch'](function(_0x4a8c41){logger[_0x98ae('0x12')](_0x98ae('0x1f'),_0x4a8c41[_0x98ae('0x11')],_0x47c8ad);_0x9dbceb(_0x236a01[_0x98ae('0x12')](0x1f4,_0x4a8c41[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x32')]=function(_0x1ea1de){var _0x400477=this;return new Promise(function(_0x370072,_0x18b1cc){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x204b9c){return db[_0x98ae('0x33')][_0x98ae('0x34')](_0x1ea1de[_0x98ae('0x17')],{'raw':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'transaction':_0x204b9c})[_0x98ae('0xe')](function(){logger[_0x98ae('0x14')](_0x98ae('0x35'),JSON[_0x98ae('0x10')](_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]),_0x1ea1de[_0x98ae('0x7')]['where'][_0x98ae('0x1c')]);return db['CmHopper']['destroy']({'where':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null,'transaction':_0x204b9c});});})['then'](function(_0x59656a){logger[_0x98ae('0x14')]('MoveContactManagedDialer',_0x1ea1de);logger[_0x98ae('0xf')](_0x98ae('0x32'),_0x1ea1de,JSON[_0x98ae('0x10')](_0x59656a));_0x370072(_0x59656a);})[_0x98ae('0x1d')](function(_0x40eacb){logger[_0x98ae('0x12')](_0x98ae('0x32'),_0x40eacb[_0x98ae('0x11')],_0x1ea1de);_0x18b1cc(_0x400477['error'](0x1f4,_0x40eacb[_0x98ae('0x11')]));});});};exports[_0x98ae('0x36')]=function(_0x3a723a){var _0x4f007d=this;return new Promise(function(_0xb58176,_0xab8d04){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x3a723a[_0x98ae('0x7')]?_0x3a723a[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x3a723a['options']?_0x3a723a['options'][_0x98ae('0x1a')]||null:null,'attributes':[[db[_0x98ae('0x22')]['fn'](_0x98ae('0x37'),db[_0x98ae('0x22')]['fn']('IF',db[_0x98ae('0x22')][_0x98ae('0x38')]('`scheduledat`\x20>=\x20'+util['format'](_0x98ae('0x39'),moment()[_0x98ae('0x3a')](_0x98ae('0x3b')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x98ae('0xe')](function(_0x57e0ab){logger['info'](_0x98ae('0x36'),_0x3a723a);logger[_0x98ae('0xf')]('CountReScheduled',_0x3a723a,JSON['stringify'](_0x57e0ab));_0xb58176(_0x57e0ab);})[_0x98ae('0x1d')](function(_0xc04a27){logger[_0x98ae('0x12')](_0x98ae('0x36'),_0xc04a27['message'],_0x3a723a);_0xab8d04(_0x4f007d[_0x98ae('0x12')](0x1f4,_0xc04a27[_0x98ae('0x11')]));});});};exports[_0x98ae('0x3c')]=function(_0x18041a){var _0xe088f5=this;return new Promise(function(_0x24b5f7,_0x5cb7eb){return db['CmContact'][_0x98ae('0x21')]()[_0x98ae('0xe')](function(){return db['sequelize']['transaction'](function(_0xe9a5f1){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x18041a['options']?_0x18041a[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':0x1,'order':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x3d')]||null:null,'group':db[_0x98ae('0x5')][_0x98ae('0x2b')],'transaction':_0xe9a5f1,'lock':_0xe9a5f1[_0x98ae('0x3e')][_0x98ae('0x24')],'include':_0x18041a[_0x98ae('0x7')]?_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x5e1dc8){return{'model':db[_0x5e1dc8[_0x98ae('0xc')]],'as':_0x5e1dc8['as'],'attributes':_0x5e1dc8[_0x98ae('0x9')],'include':_0x5e1dc8['include']?_[_0x98ae('0xd')](_0x5e1dc8[_0x98ae('0xb')],function(_0xe6929e){return{'model':db[_0xe6929e[_0x98ae('0xc')]],'as':_0xe6929e['as'],'attributes':_0xe6929e[_0x98ae('0x9')],'include':_0xe6929e['include']?_[_0x98ae('0xd')](_0xe6929e['include'],function(_0x1eeed6){return{'model':db[_0x1eeed6[_0x98ae('0xc')]],'as':_0x1eeed6['as'],'attributes':_0x1eeed6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533e8a){var _0x3649e7=[];for(var _0x28cd72=0x0;_0x28cd72<_0x533e8a[_0x98ae('0x2a')];_0x28cd72+=0x1){_0x3649e7[_0x98ae('0x2c')](_0x533e8a[_0x28cd72][_0x98ae('0x19')](_0x18041a[_0x98ae('0x17')],{'transaction':_0xe9a5f1}));}return BPromise['all'](_0x3649e7);});})[_0x98ae('0xe')](function(_0x5be3c5){logger[_0x98ae('0x14')](_0x98ae('0x3c'),_0x18041a);logger[_0x98ae('0xf')](_0x98ae('0x3c'),_0x18041a,JSON[_0x98ae('0x10')](_0x5be3c5));_0x24b5f7(_0x5be3c5);})[_0x98ae('0x1d')](function(_0xa35669){logger[_0x98ae('0x12')](_0x98ae('0x3c'),_0xa35669[_0x98ae('0x11')],_0x18041a);_0x5cb7eb(_0xe088f5[_0x98ae('0x12')](0x1f4,_0xa35669[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x3f')]=function(_0x4400a8){var _0x3e950e=this;return new Promise(function(_0x3befa4,_0x4ba27d){db[_0x98ae('0x20')][_0x98ae('0x21')]()['then'](function(_0x5edef4){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0xa')]||null:null,'include':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')]['include']?_[_0x98ae('0xd')](_0x4400a8['options'][_0x98ae('0xb')],function(_0x3cf593){return{'model':db[_0x3cf593['model']],'as':_0x3cf593['as'],'attributes':_0x3cf593['as']===_0x98ae('0x40')?_[_0x98ae('0x25')](_0x5edef4):_0x3cf593[_0x98ae('0x9')],'include':_0x3cf593[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3cf593[_0x98ae('0xb')],function(_0x532386){return{'model':db[_0x532386[_0x98ae('0xc')]],'as':_0x532386['as'],'attributes':_0x532386[_0x98ae('0x9')],'include':_0x532386['include']?_[_0x98ae('0xd')](_0x532386[_0x98ae('0xb')],function(_0x5f789){return{'model':db[_0x5f789[_0x98ae('0xc')]],'as':_0x5f789['as'],'attributes':_0x5f789[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x596930){logger['info'](_0x98ae('0x4'),_0x4400a8);logger['debug'](_0x98ae('0x4'),_0x4400a8,JSON[_0x98ae('0x10')](_0x596930));_0x3befa4(_0x596930);})[_0x98ae('0x1d')](function(_0x2ca8c5){logger[_0x98ae('0x12')](_0x98ae('0x4'),_0x2ca8c5['message'],_0x4400a8);_0x4ba27d(_0x3e950e[_0x98ae('0x12')](0x1f4,_0x2ca8c5[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x41')]=function(_0x76aade){var _0x33d14f=this;return new Promise(function(_0x3502e2,_0x5de92d){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x76aade[_0x98ae('0x7')][_0x98ae('0x1a')][_0x98ae('0x42')]},'attributes':['id',_0x98ae('0x43')],'order':[['id','DESC']]})['then'](function(_0x20e1dd){logger[_0x98ae('0x14')]('getContactByPhone',_0x76aade);logger[_0x98ae('0xf')](_0x98ae('0x44'),_0x76aade,JSON[_0x98ae('0x10')](_0x20e1dd));_0x3502e2(_0x20e1dd);})[_0x98ae('0x1d')](function(_0x5b0f80){logger[_0x98ae('0x12')](_0x98ae('0x44'),_0x5b0f80[_0x98ae('0x11')],_0x76aade);_0x5de92d(_0x33d14f[_0x98ae('0x12')](0x1f4,_0x5b0f80[_0x98ae('0x11')]));});});};exports[_0x98ae('0x45')]=function(_0x53ad1b){var _0x2d5c84=this;return new Promise(function(_0x4e8699,_0x1fb64d){return db[_0x98ae('0x22')]['transaction'](function(_0x350256){var _0x503e42=_0x53ad1b[_0x98ae('0x7')]&&_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]?_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]:{};return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x53ad1b[_0x98ae('0x17')],{'where':_0x503e42,'transaction':_0x350256})[_0x98ae('0xe')](function(_0x4c168a){logger[_0x98ae('0x14')]('ResetActiveCalls',_0x53ad1b);logger[_0x98ae('0xf')](_0x98ae('0x45'),_0x53ad1b,JSON[_0x98ae('0x10')](_0x4c168a));_0x4e8699(_0x4c168a);})[_0x98ae('0x1d')](function(_0x12de87){logger[_0x98ae('0x12')]('ResetActiveCalls',_0x12de87['message'],_0x53ad1b);_0x1fb64d(_0x2d5c84[_0x98ae('0x12')](0x1f4,_0x12de87[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x46')]=function(_0xca7086){var _0x534e8d=this;var _0x4e35fc=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x47')];var _0x42d13f=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x48')];var _0x1e0269=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x49')];return new Promise(function(_0x35f7c3,_0xb1ad0d){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e35fc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x98ae('0x22')][_0x98ae('0x38')](_0x98ae('0x4a')+_0x42d13f+'\x20MINUTE'),'$gt':db[_0x98ae('0x22')]['literal']('NOW()')}},'UserId':{'$in':_0x1e0269}},'include':[{'model':db['CmContact'],'as':_0x98ae('0x40')},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]},{'model':db[_0x98ae('0x4b')],'as':_0x98ae('0x4c')}]})[_0x98ae('0xe')](function(_0x53dc96){if(_0x53dc96[_0x98ae('0x2a')]>0x0){return db[_0x98ae('0x22')]['transaction'](function(_0x55dcac){return db[_0x98ae('0x5')][_0x98ae('0x19')]({'recallmeNotifiedDate':db[_0x98ae('0x22')][_0x98ae('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x98ae('0xd')](_0x53dc96,'id')}},'transaction':_0x55dcac})[_0x98ae('0xe')](function(){_0x35f7c3(_0x53dc96);})['catch'](function(_0x5be4bc){logger[_0x98ae('0x12')](_0x98ae('0x46'),_0x5be4bc[_0x98ae('0x11')],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x5be4bc[_0x98ae('0x11')]));});})[_0x98ae('0x1d')](function(_0x350f22){logger['error'](_0x98ae('0x46'),_0x350f22['message'],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x350f22['message']));});}else{_0x35f7c3(_0x53dc96);}});});}; \ No newline at end of file +var _0x9f37=['`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','findAll','all','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','rpc','CmHopper','options','raw','where','attributes','limit','model','include','map','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','then','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','UPDATE','CmContact','User','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x768165,_0x1e7660){var _0x5874ee=function(_0x56e35c){while(--_0x56e35c){_0x768165['push'](_0x768165['shift']());}};_0x5874ee(++_0x1e7660);}(_0x9f37,0xb6));var _0x79f3=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9f37[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require(_0x79f3('0x2'));var BPromise=require('bluebird');var db=require(_0x79f3('0x3'))['db'];var logger=require('../../config/logger')(_0x79f3('0x4'));exports['GetCmHopper']=function(_0x47de24){var _0x49ef78=this;return new Promise(function(_0x3284f9,_0x8b3eba){return db[_0x79f3('0x5')]['findAll']({'raw':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x47de24[_0x79f3('0x6')]?_0x47de24['options'][_0x79f3('0x8')]||null:null,'attributes':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0xa')]||null:null,'include':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')]['include']?_['map'](_0x47de24[_0x79f3('0x6')]['include'],function(_0xf8b67c){return{'model':db[_0xf8b67c[_0x79f3('0xb')]],'as':_0xf8b67c['as'],'attributes':_0xf8b67c[_0x79f3('0x9')],'include':_0xf8b67c[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0xf8b67c[_0x79f3('0xc')],function(_0x20513b){return{'model':db[_0x20513b[_0x79f3('0xb')]],'as':_0x20513b['as'],'attributes':_0x20513b[_0x79f3('0x9')],'include':_0x20513b[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x20513b[_0x79f3('0xc')],function(_0x42a04a){return{'model':db[_0x42a04a[_0x79f3('0xb')]],'as':_0x42a04a['as'],'attributes':_0x42a04a[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26941b){logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x47de24);logger[_0x79f3('0x10')](_0x79f3('0xf'),_0x47de24,JSON[_0x79f3('0x11')](_0x26941b));_0x3284f9(_0x26941b);})['catch'](function(_0x3490dc){logger['error'](_0x79f3('0xf'),_0x3490dc['message'],_0x47de24);_0x8b3eba(_0x49ef78[_0x79f3('0x12')](0x1f4,_0x3490dc[_0x79f3('0x13')]));});});};exports[_0x79f3('0x14')]=function(_0xaf5bf8){var _0x2f0ec7=this;return new Promise(function(_0x3c3009,_0x515800){return db['CmHopper']['find']({'raw':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')]['where']||null:null,'attributes':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'include':_0xaf5bf8['options']?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0xc')]?_[_0x79f3('0xd')](_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0xc')],function(_0x360845){return{'model':db[_0x360845[_0x79f3('0xb')]],'as':_0x360845['as'],'attributes':_0x360845[_0x79f3('0x9')],'include':_0x360845[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x360845[_0x79f3('0xc')],function(_0x1ae10b){return{'model':db[_0x1ae10b['model']],'as':_0x1ae10b['as'],'attributes':_0x1ae10b[_0x79f3('0x9')],'include':_0x1ae10b[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x1ae10b[_0x79f3('0xc')],function(_0x23510b){return{'model':db[_0x23510b[_0x79f3('0xb')]],'as':_0x23510b['as'],'attributes':_0x23510b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b9140){logger['info'](_0x79f3('0x14'),_0xaf5bf8);logger[_0x79f3('0x10')](_0x79f3('0x14'),_0xaf5bf8,JSON[_0x79f3('0x11')](_0x4b9140));_0x3c3009(_0x4b9140);})[_0x79f3('0x15')](function(_0x3635b0){logger[_0x79f3('0x12')](_0x79f3('0x14'),_0x3635b0[_0x79f3('0x13')],_0xaf5bf8);_0x515800(_0x2f0ec7[_0x79f3('0x12')](0x1f4,_0x3635b0[_0x79f3('0x13')]));});});};exports[_0x79f3('0x16')]=function(_0x11e047){var _0x4895bd=this;return new Promise(function(_0x3c0527,_0x5f573e){return db[_0x79f3('0x5')][_0x79f3('0x17')](_0x11e047[_0x79f3('0x18')],{'raw':_0x11e047[_0x79f3('0x6')]?_0x11e047[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![]})[_0x79f3('0x19')](function(_0x2e1c61){logger['info'](_0x79f3('0x16'),_0x11e047);logger[_0x79f3('0x10')](_0x79f3('0x16'),_0x11e047,JSON[_0x79f3('0x11')](_0x2e1c61));_0x3c0527(_0x2e1c61);})[_0x79f3('0x15')](function(_0x1893e1){logger['error'](_0x79f3('0x16'),_0x1893e1[_0x79f3('0x13')],_0x11e047);_0x5f573e(_0x4895bd[_0x79f3('0x12')](0x1f4,_0x1893e1[_0x79f3('0x13')]));});});};exports[_0x79f3('0x1a')]=function(_0x42c786){var _0x8018ef=this;return new Promise(function(_0xa5168f,_0x58571d){return db[_0x79f3('0x5')][_0x79f3('0x1b')](_0x42c786[_0x79f3('0x18')],{'raw':_0x42c786[_0x79f3('0x6')]?_0x42c786[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c786[_0x79f3('0x6')]?_0x42c786[_0x79f3('0x6')]['where']||null:null,'attributes':_0x42c786['options']?_0x42c786[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x42c786['options']?_0x42c786[_0x79f3('0x6')]['limit']||null:null})[_0x79f3('0x19')](function(_0x30cdd1){logger['info']('UpdateCmHopper',_0x42c786);logger[_0x79f3('0xe')](_0x79f3('0x1c'),JSON[_0x79f3('0x11')](_0x42c786[_0x79f3('0x6')][_0x79f3('0x8')]),_0x42c786[_0x79f3('0x18')][_0x79f3('0x1d')]);logger[_0x79f3('0x10')](_0x79f3('0x1a'),_0x42c786,JSON[_0x79f3('0x11')](_0x30cdd1));_0xa5168f(_0x30cdd1);})[_0x79f3('0x15')](function(_0xe2ddbc){logger[_0x79f3('0x12')](_0x79f3('0x1a'),_0xe2ddbc['message'],_0x42c786);_0x58571d(_0x8018ef['error'](0x1f4,_0xe2ddbc[_0x79f3('0x13')]));});});};exports[_0x79f3('0x1e')]=function(_0x4929f2){var _0xdac768=this;return new Promise(function(_0x519e1d,_0x68782){return db[_0x79f3('0x5')][_0x79f3('0x1f')]({'where':_0x4929f2[_0x79f3('0x6')]?_0x4929f2[_0x79f3('0x6')]['where']||null:null})[_0x79f3('0x19')](function(_0x392a68){logger[_0x79f3('0xe')](_0x79f3('0x1e'),_0x4929f2);logger[_0x79f3('0x10')](_0x79f3('0x1e'),_0x4929f2,JSON[_0x79f3('0x11')](_0x392a68));_0x519e1d(_0x392a68);})[_0x79f3('0x15')](function(_0x54b27f){logger[_0x79f3('0x12')]('DestroyCmHopper',_0x54b27f[_0x79f3('0x13')],_0x4929f2);_0x68782(_0xdac768[_0x79f3('0x12')](0x1f4,_0x54b27f[_0x79f3('0x13')]));});});};exports[_0x79f3('0x20')]=function(_0x12dffc){var _0x25d9df=this;return new Promise(function(_0x50ff70,_0x40bf65){return db['CmContact'][_0x79f3('0x21')]()[_0x79f3('0x19')](function(_0x4c3d08){return db[_0x79f3('0x22')]['transaction'](function(_0x33ac22){return db['CmHopper']['findAll']({'where':_0x12dffc[_0x79f3('0x6')]?_0x12dffc[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':_0x12dffc[_0x79f3('0x6')]?_0x12dffc['options'][_0x79f3('0x9')]||null:null,'limit':_0x12dffc['options']?_0x12dffc['options']['limit']||null:null,'order':_0x12dffc[_0x79f3('0x6')]?_0x12dffc[_0x79f3('0x6')][_0x79f3('0x23')]||null:null,'transaction':_0x33ac22,'lock':_0x33ac22['LOCK'][_0x79f3('0x24')],'include':[{'model':db[_0x79f3('0x25')],'as':'Contact','attributes':_['keys'](_0x4c3d08)},{'model':db[_0x79f3('0x26')],'as':'Agent','attributes':['id',_0x79f3('0x27'),_0x79f3('0x28')]}]})[_0x79f3('0x19')](function(_0x4dd7f3){var _0x54c6e0=[];var _0x1a005b=[];for(var _0x2460dc=0x0;_0x2460dc<_0x4dd7f3[_0x79f3('0x29')];_0x2460dc+=0x1){var _0x49d4c6=_0x4dd7f3[_0x2460dc][_0x79f3('0x2a')];if(_0x49d4c6===null){_0x54c6e0[_0x79f3('0x2b')](_0x4dd7f3[_0x2460dc][_0x79f3('0x1b')](_0x12dffc[_0x79f3('0x18')],{'transaction':_0x33ac22}));}else if(!_0x1a005b[_0x79f3('0x2c')](_0x49d4c6)){_0x1a005b[_0x79f3('0x2b')](_0x49d4c6);_0x54c6e0[_0x79f3('0x2b')](_0x4dd7f3[_0x2460dc]['update'](_0x12dffc[_0x79f3('0x18')],{'transaction':_0x33ac22}));}}return BPromise['all'](_0x54c6e0);});})[_0x79f3('0x19')](function(_0x2e8fcf){logger[_0x79f3('0xe')]('GetContactDialer',_0x12dffc);if(_0x2e8fcf[_0x79f3('0x29')]>0x0){logger['info'](_0x79f3('0x2d'),_0x2e8fcf[0x0][_0x79f3('0x2e')]['id'],_0x2e8fcf[0x0][_0x79f3('0x2e')][_0x79f3('0x2f')],_0x2e8fcf[0x0][_0x79f3('0x2e')][_0x79f3('0x1d')]);}logger['debug']('GetContactDialer',_0x12dffc,JSON[_0x79f3('0x11')](_0x2e8fcf));_0x50ff70(_0x2e8fcf);})[_0x79f3('0x15')](function(_0x12d16d){logger['error'](_0x79f3('0x20'),_0x12d16d[_0x79f3('0x13')],_0x12dffc);_0x40bf65(_0x25d9df[_0x79f3('0x12')](0x1f4,_0x12d16d[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x30')]=function(_0x66c47b){var _0x547bd6=this;return new Promise(function(_0x12ecca,_0x504392){return db[_0x79f3('0x22')][_0x79f3('0x31')](function(_0x2fa3a7){return db[_0x79f3('0x32')]['create'](_0x66c47b['body'],{'raw':_0x66c47b['options']?_0x66c47b[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'transaction':_0x2fa3a7})[_0x79f3('0x19')](function(){logger['info'](_0x79f3('0x33'),JSON[_0x79f3('0x11')](_0x66c47b[_0x79f3('0x6')]['where']),_0x66c47b[_0x79f3('0x6')]['where'][_0x79f3('0x1d')]);return db[_0x79f3('0x5')]['destroy']({'where':_0x66c47b[_0x79f3('0x6')]?_0x66c47b['options']['where']||null:null,'transaction':_0x2fa3a7});});})[_0x79f3('0x19')](function(_0x54bdd0){logger[_0x79f3('0xe')](_0x79f3('0x30'),_0x66c47b);logger[_0x79f3('0x10')](_0x79f3('0x30'),_0x66c47b,JSON[_0x79f3('0x11')](_0x54bdd0));_0x12ecca(_0x54bdd0);})[_0x79f3('0x15')](function(_0x6135ff){logger[_0x79f3('0x12')](_0x79f3('0x30'),_0x6135ff['message'],_0x66c47b);_0x504392(_0x547bd6[_0x79f3('0x12')](0x1f4,_0x6135ff[_0x79f3('0x13')]));});});};exports['CountReScheduled']=function(_0x331b9a){var _0x4b3f72=this;return new Promise(function(_0x55e59e,_0x5bb9bf){return db[_0x79f3('0x5')]['findAll']({'raw':_0x331b9a[_0x79f3('0x6')]?_0x331b9a[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x331b9a[_0x79f3('0x6')]?_0x331b9a[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x79f3('0x22')]['fn']('IF',db[_0x79f3('0x22')]['literal'](_0x79f3('0x34')+util[_0x79f3('0x35')](_0x79f3('0x36'),moment()[_0x79f3('0x35')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x79f3('0x37')]]})[_0x79f3('0x19')](function(_0x4e4dfc){logger['info'](_0x79f3('0x38'),_0x331b9a);logger[_0x79f3('0x10')](_0x79f3('0x38'),_0x331b9a,JSON['stringify'](_0x4e4dfc));_0x55e59e(_0x4e4dfc);})[_0x79f3('0x15')](function(_0x4bbc2c){logger[_0x79f3('0x12')](_0x79f3('0x38'),_0x4bbc2c[_0x79f3('0x13')],_0x331b9a);_0x5bb9bf(_0x4b3f72[_0x79f3('0x12')](0x1f4,_0x4bbc2c[_0x79f3('0x13')]));});});};exports['GetContactRecallMe']=function(_0x161f6c){var _0x3431c2=this;return new Promise(function(_0x2fb212,_0x2e3ceb){return db[_0x79f3('0x25')][_0x79f3('0x21')]()[_0x79f3('0x19')](function(){return db[_0x79f3('0x22')][_0x79f3('0x31')](function(_0xa298af){return db['CmHopper'][_0x79f3('0x39')]({'where':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')]['where']||null:null,'attributes':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':0x1,'order':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')][_0x79f3('0x23')]||null:null,'group':db[_0x79f3('0x5')][_0x79f3('0x2a')],'transaction':_0xa298af,'lock':_0xa298af['LOCK'][_0x79f3('0x24')],'include':_0x161f6c['options']?_0x161f6c[_0x79f3('0x6')]['include']?_['map'](_0x161f6c[_0x79f3('0x6')]['include'],function(_0x5270b8){return{'model':db[_0x5270b8[_0x79f3('0xb')]],'as':_0x5270b8['as'],'attributes':_0x5270b8['attributes'],'include':_0x5270b8[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x5270b8['include'],function(_0x4e9e92){return{'model':db[_0x4e9e92[_0x79f3('0xb')]],'as':_0x4e9e92['as'],'attributes':_0x4e9e92['attributes'],'include':_0x4e9e92[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x4e9e92[_0x79f3('0xc')],function(_0x1a05e7){return{'model':db[_0x1a05e7['model']],'as':_0x1a05e7['as'],'attributes':_0x1a05e7[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3ce9){var _0x13c5b5=[];for(var _0x188bd8=0x0;_0x188bd8<_0x2a3ce9[_0x79f3('0x29')];_0x188bd8+=0x1){_0x13c5b5[_0x79f3('0x2b')](_0x2a3ce9[_0x188bd8][_0x79f3('0x1b')](_0x161f6c['body'],{'transaction':_0xa298af}));}return BPromise[_0x79f3('0x3a')](_0x13c5b5);});})['then'](function(_0x555986){logger[_0x79f3('0xe')](_0x79f3('0x3b'),_0x161f6c);logger[_0x79f3('0x10')](_0x79f3('0x3b'),_0x161f6c,JSON[_0x79f3('0x11')](_0x555986));_0x2fb212(_0x555986);})[_0x79f3('0x15')](function(_0x2e325e){logger[_0x79f3('0x12')](_0x79f3('0x3b'),_0x2e325e['message'],_0x161f6c);_0x2e3ceb(_0x3431c2[_0x79f3('0x12')](0x1f4,_0x2e325e[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x3c')]=function(_0x5c3f5e){var _0x348a6e=this;return new Promise(function(_0x31ed84,_0x1f139d){db[_0x79f3('0x25')][_0x79f3('0x21')]()[_0x79f3('0x19')](function(_0x803ad3){return db['CmHopper'][_0x79f3('0x39')]({'raw':_0x5c3f5e['options']?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x5c3f5e[_0x79f3('0x6')]?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':_0x5c3f5e[_0x79f3('0x6')]?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x5c3f5e['options']?_0x5c3f5e['options'][_0x79f3('0xa')]||null:null,'include':_0x5c3f5e['options']?_0x5c3f5e['options'][_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0xc')],function(_0x65bc64){return{'model':db[_0x65bc64[_0x79f3('0xb')]],'as':_0x65bc64['as'],'attributes':_0x65bc64['as']===_0x79f3('0x3d')?_[_0x79f3('0x3e')](_0x803ad3):_0x65bc64[_0x79f3('0x9')],'include':_0x65bc64[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x65bc64['include'],function(_0x485b04){return{'model':db[_0x485b04[_0x79f3('0xb')]],'as':_0x485b04['as'],'attributes':_0x485b04[_0x79f3('0x9')],'include':_0x485b04[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x485b04[_0x79f3('0xc')],function(_0x5ea979){return{'model':db[_0x5ea979[_0x79f3('0xb')]],'as':_0x5ea979['as'],'attributes':_0x5ea979[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})[_0x79f3('0x19')](function(_0x1a9033){logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x5c3f5e);logger['debug']('GetCmHopper',_0x5c3f5e,JSON[_0x79f3('0x11')](_0x1a9033));_0x31ed84(_0x1a9033);})[_0x79f3('0x15')](function(_0x41110e){logger['error'](_0x79f3('0xf'),_0x41110e[_0x79f3('0x13')],_0x5c3f5e);_0x1f139d(_0x348a6e[_0x79f3('0x12')](0x1f4,_0x41110e[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x3f')]=function(_0x2ad24d){var _0x333ea2=this;return new Promise(function(_0x364b7c,_0x10f6b4){return db['CmContact'][_0x79f3('0x40')]({'raw':!![],'where':{'phone':_0x2ad24d[_0x79f3('0x6')][_0x79f3('0x8')][_0x79f3('0x41')]},'attributes':['id',_0x79f3('0x42')],'order':[['id',_0x79f3('0x43')]]})['then'](function(_0x3cfb8d){logger[_0x79f3('0xe')](_0x79f3('0x44'),_0x2ad24d);logger[_0x79f3('0x10')](_0x79f3('0x44'),_0x2ad24d,JSON[_0x79f3('0x11')](_0x3cfb8d));_0x364b7c(_0x3cfb8d);})['catch'](function(_0x275823){logger[_0x79f3('0x12')](_0x79f3('0x44'),_0x275823[_0x79f3('0x13')],_0x2ad24d);_0x10f6b4(_0x333ea2[_0x79f3('0x12')](0x1f4,_0x275823[_0x79f3('0x13')]));});});};exports['ResetActiveCalls']=function(_0x39ebe5){var _0x18e10b=this;return new Promise(function(_0x4c9c90,_0x4df05f){return db['sequelize'][_0x79f3('0x31')](function(_0xdd26ca){var _0x1804d2=_0x39ebe5['options']&&_0x39ebe5[_0x79f3('0x6')]['where']?_0x39ebe5[_0x79f3('0x6')][_0x79f3('0x8')]:{};return db['CmHopper'][_0x79f3('0x1b')](_0x39ebe5[_0x79f3('0x18')],{'where':_0x1804d2,'transaction':_0xdd26ca})[_0x79f3('0x19')](function(_0x3ecefd){logger[_0x79f3('0xe')](_0x79f3('0x45'),_0x39ebe5);logger[_0x79f3('0x10')](_0x79f3('0x45'),_0x39ebe5,JSON[_0x79f3('0x11')](_0x3ecefd));_0x4c9c90(_0x3ecefd);})[_0x79f3('0x15')](function(_0x90b3fa){logger[_0x79f3('0x12')](_0x79f3('0x45'),_0x90b3fa[_0x79f3('0x13')],_0x39ebe5);_0x4df05f(_0x18e10b[_0x79f3('0x12')](0x1f4,_0x90b3fa[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x46')]=function(_0x5f4095){var _0x8e40bb=this;var _0x540faf=_0x5f4095[_0x79f3('0x18')][_0x79f3('0x8')][_0x79f3('0x47')];var _0x21cca6=_0x5f4095[_0x79f3('0x18')]['where'][_0x79f3('0x48')];var _0x53db90=_0x5f4095['body']['where']['availableAgentsIds'];return new Promise(function(_0x75fa54,_0x2c8900){return db[_0x79f3('0x5')][_0x79f3('0x39')]({'where':{'voiceQueueId':{'$in':_0x540faf},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x79f3('0x22')][_0x79f3('0x49')]('NOW()\x20+\x20INTERVAL\x20'+_0x21cca6+_0x79f3('0x4a')),'$gt':db[_0x79f3('0x22')][_0x79f3('0x49')](_0x79f3('0x4b'))}},'UserId':{'$in':_0x53db90}},'include':[{'model':db[_0x79f3('0x25')],'as':_0x79f3('0x3d')},{'model':db['User'],'as':'Agent','attributes':['id',_0x79f3('0x27'),_0x79f3('0x28')]},{'model':db[_0x79f3('0x4c')],'as':_0x79f3('0x4d')}]})[_0x79f3('0x19')](function(_0x308043){if(_0x308043[_0x79f3('0x29')]>0x0){return db['sequelize'][_0x79f3('0x31')](function(_0x1dd2a7){return db[_0x79f3('0x5')][_0x79f3('0x1b')]({'recallmeNotifiedDate':db[_0x79f3('0x22')][_0x79f3('0x49')](_0x79f3('0x4b'))},{'where':{'id':{'$in':_[_0x79f3('0xd')](_0x308043,'id')}},'transaction':_0x1dd2a7})[_0x79f3('0x19')](function(){_0x75fa54(_0x308043);})[_0x79f3('0x15')](function(_0x54b266){logger[_0x79f3('0x12')](_0x79f3('0x46'),_0x54b266['message'],_0x5f4095);_0x2c8900(_0x8e40bb[_0x79f3('0x12')](0x1f4,_0x54b266[_0x79f3('0x13')]));});})[_0x79f3('0x15')](function(_0x4f55bc){logger[_0x79f3('0x12')](_0x79f3('0x46'),_0x4f55bc[_0x79f3('0x13')],_0x5f4095);_0x2c8900(_0x8e40bb['error'](0x1f4,_0x4f55bc[_0x79f3('0x13')]));});}else{_0x75fa54(_0x308043);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ec1cd74..10553cc 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 _0x39cc=['getPreviewRecall','post','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getTimezones','/:id','show','/:id/previewrecall'];(function(_0x534e8b,_0x1f8fd9){var _0x5542cc=function(_0x1f31f2){while(--_0x1f31f2){_0x534e8b['push'](_0x534e8b['shift']());}};_0x5542cc(++_0x1f8fd9);}(_0x39cc,0x195));var _0xc39c=function(_0x9ca3a,_0x236fdb){_0x9ca3a=_0x9ca3a-0x0;var _0x14a0ca=_0x39cc[_0x9ca3a];return _0x14a0ca;};'use strict';var express=require(_0xc39c('0x0'));var router=express[_0xc39c('0x1')]();var auth=require(_0xc39c('0x2'));var controller=require(_0xc39c('0x3'));router[_0xc39c('0x4')]('/',auth[_0xc39c('0x5')](),controller['index']);router[_0xc39c('0x4')](_0xc39c('0x6'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x7')]);router[_0xc39c('0x4')](_0xc39c('0x8'),auth[_0xc39c('0x5')](),controller['getOpenContacts']);router['get']('/timezones',auth['isAuthenticated'](),controller[_0xc39c('0x9')]);router['get'](_0xc39c('0xa'),auth[_0xc39c('0x5')](),controller[_0xc39c('0xb')]);router[_0xc39c('0x4')](_0xc39c('0xc'),auth[_0xc39c('0x5')](),controller[_0xc39c('0xd')]);router[_0xc39c('0xe')]('/',auth[_0xc39c('0x5')](),controller['create']);router[_0xc39c('0xe')]('/preview',auth[_0xc39c('0x5')](),controller[_0xc39c('0xf')]);router[_0xc39c('0xe')](_0xc39c('0x10'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x11')]);router['put'](_0xc39c('0xa'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x12')]);router[_0xc39c('0x13')](_0xc39c('0xa'),auth['isAuthenticated'](),controller[_0xc39c('0x14')]);module[_0xc39c('0x15')]=router; \ No newline at end of file +var _0x8175=['getTimezones','/:id','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8175,0xc9));var _0x5817=function(_0x4f1651,_0xc4ac4f){_0x4f1651=_0x4f1651-0x0;var _0x44868e=_0x8175[_0x4f1651];return _0x44868e;};'use strict';var express=require(_0x5817('0x0'));var router=express[_0x5817('0x1')]();var auth=require(_0x5817('0x2'));var controller=require('./cmHopper.controller');router[_0x5817('0x3')]('/',auth[_0x5817('0x4')](),controller['index']);router[_0x5817('0x3')](_0x5817('0x5'),auth[_0x5817('0x4')](),controller[_0x5817('0x6')]);router[_0x5817('0x3')](_0x5817('0x7'),auth[_0x5817('0x4')](),controller[_0x5817('0x8')]);router[_0x5817('0x3')]('/timezones',auth[_0x5817('0x4')](),controller[_0x5817('0x9')]);router[_0x5817('0x3')](_0x5817('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5817('0x3')]('/:id/previewrecall',auth[_0x5817('0x4')](),controller[_0x5817('0xb')]);router[_0x5817('0xc')]('/',auth[_0x5817('0x4')](),controller[_0x5817('0xd')]);router['post'](_0x5817('0xe'),auth[_0x5817('0x4')](),controller[_0x5817('0xf')]);router[_0x5817('0xc')](_0x5817('0x10'),auth[_0x5817('0x4')](),controller['getTimezone']);router[_0x5817('0x11')](_0x5817('0xa'),auth[_0x5817('0x4')](),controller[_0x5817('0x12')]);router[_0x5817('0x13')](_0x5817('0xa'),auth[_0x5817('0x4')](),controller[_0x5817('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 1937511..c9c03fa 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 _0x6a40=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment'];(function(_0x497a9d,_0x1ae5df){var _0x22b092=function(_0x797d63){while(--_0x797d63){_0x497a9d['push'](_0x497a9d['shift']());}};_0x22b092(++_0x1ae5df);}(_0x6a40,0x1c7));var _0x06a4=function(_0xd8ae9,_0x46e1cf){_0xd8ae9=_0xd8ae9-0x0;var _0x5b9de5=_0x6a40[_0xd8ae9];return _0x5b9de5;};'use strict';var moment=require(_0x06a4('0x0'));var Sequelize=require(_0x06a4('0x1'));module[_0x06a4('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x06a4('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x06a4('0x4')],'defaultValue':moment()[_0x06a4('0x5')](_0x06a4('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x56a9=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56a9,0x6a));var _0x956a=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x56a9[_0x22b39b];return _0x280e1d;};'use strict';var moment=require(_0x956a('0x0'));var Sequelize=require(_0x956a('0x1'));module[_0x956a('0x2')]={'CmHopperId':{'type':Sequelize[_0x956a('0x3')]},'phone':{'type':Sequelize[_0x956a('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x956a('0x5')],'defaultValue':moment()['format'](_0x956a('0x6'))},'countbusyretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x956a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x956a('0x3')],'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 77a1f69..05578a4 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 _0x766d=['Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset'];(function(_0x2480b5,_0x1899e9){var _0x108649=function(_0x205847){while(--_0x205847){_0x2480b5['push'](_0x2480b5['shift']());}};_0x108649(++_0x1899e9);}(_0x766d,0x1cd));var _0xd766=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x766d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd766('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd766('0x1'));var jsonpatch=require(_0xd766('0x2'));var rp=require('request-promise');var moment=require(_0xd766('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd766('0x4'));var util=require(_0xd766('0x5'));var path=require('path');var sox=require(_0xd766('0x6'));var csv=require(_0xd766('0x7'));var ejs=require(_0xd766('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd766('0x9'));var squel=require(_0xd766('0xa'));var crypto=require(_0xd766('0xb'));var jsforce=require(_0xd766('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd766('0x7'));var querystring=require(_0xd766('0xd'));var Papa=require(_0xd766('0xe'));var Redis=require(_0xd766('0xf'));var authService=require(_0xd766('0x10'));var qs=require(_0xd766('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd766('0x12'));var logger=require(_0xd766('0x13'))(_0xd766('0x14'));var utils=require(_0xd766('0x15'));var config=require(_0xd766('0x16'));var licenseUtil=require(_0xd766('0x17'));var db=require(_0xd766('0x18'))['db'];function respondWithStatusCode(_0x80c84d,_0x40cb66){_0x40cb66=_0x40cb66||0xcc;return function(_0x5e96a1){if(_0x5e96a1){return _0x80c84d['sendStatus'](_0x40cb66);}return _0x80c84d[_0xd766('0x19')](_0x40cb66)[_0xd766('0x1a')]();};}function respondWithResult(_0x260ab9,_0x349659){_0x349659=_0x349659||0xc8;return function(_0x5d4dc2){if(_0x5d4dc2){return _0x260ab9[_0xd766('0x19')](_0x349659)['json'](_0x5d4dc2);}};}function respondWithFilteredResult(_0x3edcef,_0x143cd9){return function(_0x31566e){if(_0x31566e){var _0x37f490=typeof _0x143cd9['offset']===_0xd766('0x1b')&&typeof _0x143cd9[_0xd766('0x1c')]===_0xd766('0x1b');var _0x13bab7=_0x31566e['count'];var _0x37dc55=_0x37f490?0x0:_0x143cd9['offset'];var _0xe4b2cb=_0x37f490?_0x31566e[_0xd766('0x1d')]:_0x143cd9[_0xd766('0x1e')]+_0x143cd9[_0xd766('0x1c')];var _0x2946f6;if(_0xe4b2cb>=_0x13bab7){_0xe4b2cb=_0x13bab7;_0x2946f6=0xc8;}else{_0x2946f6=0xce;}_0x3edcef[_0xd766('0x19')](_0x2946f6);return _0x3edcef['set'](_0xd766('0x1f'),_0x37dc55+'-'+_0xe4b2cb+'/'+_0x13bab7)['json'](_0x31566e);}return null;};}function patchUpdates(_0x5a3d17){return function(_0x59d961){try{jsonpatch[_0xd766('0x20')](_0x59d961,_0x5a3d17,!![]);}catch(_0x48e20d){return BPromise[_0xd766('0x21')](_0x48e20d);}return _0x59d961[_0xd766('0x22')]();};}function saveUpdates(_0x1e7d88,_0x190475){return function(_0x5ea7ad){if(_0x5ea7ad){return _0x5ea7ad[_0xd766('0x23')](_0x1e7d88)['then'](function(_0x4cda2d){return _0x4cda2d;});}return null;};}function removeEntity(_0x14381f,_0x478761){return function(_0x4d5c68){if(_0x4d5c68){return _0x4d5c68[_0xd766('0x24')]()[_0xd766('0x25')](function(){var _0x2ac2ba=_0x4d5c68['get']({'plain':!![]});var _0x200190=_0xd766('0x26');return db['UserProfileResource'][_0xd766('0x24')]({'where':{'type':_0x200190,'resourceId':_0x2ac2ba['id']}})[_0xd766('0x25')](function(){return _0x4d5c68;});})[_0xd766('0x25')](function(){_0x14381f[_0xd766('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e139,_0x4930c9){return function(_0x24d9cc){if(!_0x24d9cc){_0x19e139['sendStatus'](0x194);}return _0x24d9cc;};}function handleError(_0x22b938,_0x1d4b60){_0x1d4b60=_0x1d4b60||0x1f4;return function(_0x5bb6f9){logger[_0xd766('0x27')](_0x5bb6f9[_0xd766('0x28')]);if(_0x5bb6f9[_0xd766('0x29')]){delete _0x5bb6f9[_0xd766('0x29')];}_0x22b938[_0xd766('0x19')](_0x1d4b60)['send'](_0x5bb6f9);};}exports[_0xd766('0x2a')]=function(_0x1258d1,_0x207b7c){var _0x5414c4={},_0x22b7ae={},_0xd5e833={'count':0x0,'rows':[]};var _0x1d51c3=_['map'](db['CmHopperAdditionalPhone'][_0xd766('0x2b')],function(_0x4c17ad){return{'name':_0x4c17ad[_0xd766('0x2c')],'type':_0x4c17ad[_0xd766('0x2d')]['key']};});_0x22b7ae['model']=_[_0xd766('0x2e')](_0x1d51c3,_0xd766('0x29'));_0x22b7ae[_0xd766('0x2f')]=_['keys'](_0x1258d1[_0xd766('0x2f')]);_0x22b7ae[_0xd766('0x30')]=_['intersection'](_0x22b7ae[_0xd766('0x31')],_0x22b7ae['query']);_0x5414c4[_0xd766('0x32')]=_[_0xd766('0x33')](_0x22b7ae[_0xd766('0x31')],qs[_0xd766('0x34')](_0x1258d1[_0xd766('0x2f')][_0xd766('0x34')]));_0x5414c4[_0xd766('0x32')]=_0x5414c4[_0xd766('0x32')][_0xd766('0x35')]?_0x5414c4[_0xd766('0x32')]:_0x22b7ae[_0xd766('0x31')];if(!_0x1258d1[_0xd766('0x2f')]['hasOwnProperty'](_0xd766('0x36'))){_0x5414c4['limit']=qs[_0xd766('0x1c')](_0x1258d1[_0xd766('0x2f')]['limit']);_0x5414c4[_0xd766('0x1e')]=qs['offset'](_0x1258d1[_0xd766('0x2f')]['offset']);}_0x5414c4[_0xd766('0x37')]=qs[_0xd766('0x38')](_0x1258d1[_0xd766('0x2f')]['sort']);_0x5414c4['where']=qs['filters'](_[_0xd766('0x39')](_0x1258d1[_0xd766('0x2f')],_0x22b7ae['filters']),_0x1d51c3);if(_0x1258d1[_0xd766('0x2f')][_0xd766('0x3a')]){_0x5414c4[_0xd766('0x3b')]=_[_0xd766('0x3c')](_0x5414c4[_0xd766('0x3b')],{'$or':_[_0xd766('0x2e')](_0x1d51c3,function(_0x27e488){if(_0x27e488[_0xd766('0x2d')]!==_0xd766('0x3d')){var _0xc42985={};_0xc42985[_0x27e488[_0xd766('0x29')]]={'$like':'%'+_0x1258d1[_0xd766('0x2f')][_0xd766('0x3a')]+'%'};return _0xc42985;}})});}_0x5414c4=_['merge']({},_0x5414c4,_0x1258d1[_0xd766('0x3e')]);var _0x4254df={'where':_0x5414c4[_0xd766('0x3b')]};return db[_0xd766('0x3f')][_0xd766('0x1d')](_0x4254df)[_0xd766('0x25')](function(_0x2d5549){_0xd5e833[_0xd766('0x1d')]=_0x2d5549;if(_0x1258d1[_0xd766('0x2f')][_0xd766('0x40')]){_0x5414c4[_0xd766('0x41')]=[{'all':!![]}];}return db[_0xd766('0x3f')][_0xd766('0x42')](_0x5414c4);})['then'](function(_0x156839){_0xd5e833[_0xd766('0x43')]=_0x156839;return _0xd5e833;})[_0xd766('0x25')](respondWithFilteredResult(_0x207b7c,_0x5414c4))[_0xd766('0x44')](handleError(_0x207b7c,null));};exports[_0xd766('0x45')]=function(_0x51f84f,_0x1cc589){var _0x73b46e={'raw':!![],'where':{'id':_0x51f84f[_0xd766('0x46')]['id']}},_0x21936b={};_0x21936b[_0xd766('0x31')]=_[_0xd766('0x47')](db[_0xd766('0x3f')][_0xd766('0x2b')]);_0x21936b[_0xd766('0x2f')]=_[_0xd766('0x47')](_0x51f84f['query']);_0x21936b['filters']=_[_0xd766('0x33')](_0x21936b[_0xd766('0x31')],_0x21936b[_0xd766('0x2f')]);_0x73b46e[_0xd766('0x32')]=_[_0xd766('0x33')](_0x21936b[_0xd766('0x31')],qs[_0xd766('0x34')](_0x51f84f[_0xd766('0x2f')][_0xd766('0x34')]));_0x73b46e[_0xd766('0x32')]=_0x73b46e[_0xd766('0x32')][_0xd766('0x35')]?_0x73b46e['attributes']:_0x21936b[_0xd766('0x31')];if(_0x51f84f[_0xd766('0x2f')][_0xd766('0x40')]){_0x73b46e['include']=[{'all':!![]}];}_0x73b46e=_[_0xd766('0x3c')]({},_0x73b46e,_0x51f84f[_0xd766('0x3e')]);return db[_0xd766('0x3f')][_0xd766('0x48')](_0x73b46e)[_0xd766('0x25')](handleEntityNotFound(_0x1cc589,null))[_0xd766('0x25')](respondWithResult(_0x1cc589,null))[_0xd766('0x44')](handleError(_0x1cc589,null));};exports['create']=function(_0x245c8c,_0x2b01e4){return db[_0xd766('0x3f')][_0xd766('0x49')](_0x245c8c[_0xd766('0x4a')],{})['then'](function(_0x5d23b3){var _0x36741c=_0x245c8c[_0xd766('0x4b')][_0xd766('0x4c')]({'plain':!![]});if(!_0x36741c)throw new Error(_0xd766('0x4d'));if(_0x36741c['role']===_0xd766('0x4b')){var _0x53f4eb=_0x5d23b3[_0xd766('0x4c')]({'plain':!![]});var _0x2d4d54=_0xd766('0x26');return db[_0xd766('0x4e')][_0xd766('0x48')]({'where':{'name':_0x2d4d54,'userProfileId':_0x36741c['userProfileId']},'raw':!![]})[_0xd766('0x25')](function(_0x117ca1){if(_0x117ca1&&_0x117ca1[_0xd766('0x4f')]===0x0){return db[_0xd766('0x50')][_0xd766('0x49')]({'name':_0x53f4eb[_0xd766('0x29')],'resourceId':_0x53f4eb['id'],'type':_0x117ca1[_0xd766('0x29')],'sectionId':_0x117ca1['id']},{})[_0xd766('0x25')](function(){return _0x5d23b3;});}else{return _0x5d23b3;}})[_0xd766('0x44')](function(_0x111a13){logger['error'](_0xd766('0x51'),_0x111a13);throw _0x111a13;});}return _0x5d23b3;})[_0xd766('0x25')](respondWithResult(_0x2b01e4,0xc9))[_0xd766('0x44')](handleError(_0x2b01e4,null));};exports['update']=function(_0x1f1867,_0x1fc692){if(_0x1f1867[_0xd766('0x4a')]['id']){delete _0x1f1867[_0xd766('0x4a')]['id'];}return db[_0xd766('0x3f')][_0xd766('0x48')]({'where':{'id':_0x1f1867[_0xd766('0x46')]['id']}})[_0xd766('0x25')](handleEntityNotFound(_0x1fc692,null))[_0xd766('0x25')](saveUpdates(_0x1f1867['body'],null))['then'](respondWithResult(_0x1fc692,null))['catch'](handleError(_0x1fc692,null));};exports[_0xd766('0x24')]=function(_0x5aa668,_0x3e37da){return db['CmHopperAdditionalPhone'][_0xd766('0x48')]({'where':{'id':_0x5aa668[_0xd766('0x46')]['id']}})[_0xd766('0x25')](handleEntityNotFound(_0x3e37da,null))[_0xd766('0x25')](removeEntity(_0x3e37da,null))[_0xd766('0x44')](handleError(_0x3e37da,null));}; \ No newline at end of file +var _0xb0cb=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','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','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb0cb,0x170));var _0xbb0c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb0cb[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0xbb0c('0x0'));var rimraf=require(_0xbb0c('0x1'));var zipdir=require(_0xbb0c('0x2'));var jsonpatch=require(_0xbb0c('0x3'));var rp=require('request-promise');var moment=require(_0xbb0c('0x4'));var BPromise=require(_0xbb0c('0x5'));var Mustache=require(_0xbb0c('0x6'));var util=require(_0xbb0c('0x7'));var path=require(_0xbb0c('0x8'));var sox=require(_0xbb0c('0x9'));var csv=require(_0xbb0c('0xa'));var ejs=require(_0xbb0c('0xb'));var fs=require('fs');var fs_extra=require(_0xbb0c('0xc'));var _=require('lodash');var squel=require(_0xbb0c('0xd'));var crypto=require('crypto');var jsforce=require(_0xbb0c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb0c('0xf'));var Papa=require(_0xbb0c('0x10'));var Redis=require(_0xbb0c('0x11'));var authService=require(_0xbb0c('0x12'));var qs=require(_0xbb0c('0x13'));var as=require(_0xbb0c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb0c('0x15'))(_0xbb0c('0x16'));var utils=require('../../config/utils');var config=require(_0xbb0c('0x17'));var licenseUtil=require(_0xbb0c('0x18'));var db=require(_0xbb0c('0x19'))['db'];function respondWithStatusCode(_0x4c1482,_0x1369c5){_0x1369c5=_0x1369c5||0xcc;return function(_0x1c494d){if(_0x1c494d){return _0x4c1482[_0xbb0c('0x1a')](_0x1369c5);}return _0x4c1482[_0xbb0c('0x1b')](_0x1369c5)[_0xbb0c('0x1c')]();};}function respondWithResult(_0x4ecb10,_0x37aea0){_0x37aea0=_0x37aea0||0xc8;return function(_0x17ac0f){if(_0x17ac0f){return _0x4ecb10[_0xbb0c('0x1b')](_0x37aea0)[_0xbb0c('0x1d')](_0x17ac0f);}};}function respondWithFilteredResult(_0x5c882b,_0x5af34a){return function(_0x439bc8){if(_0x439bc8){var _0x2c2412=typeof _0x5af34a[_0xbb0c('0x1e')]===_0xbb0c('0x1f')&&typeof _0x5af34a[_0xbb0c('0x20')]===_0xbb0c('0x1f');var _0x322f81=_0x439bc8[_0xbb0c('0x21')];var _0x4cf770=_0x2c2412?0x0:_0x5af34a[_0xbb0c('0x1e')];var _0x489eea=_0x2c2412?_0x439bc8[_0xbb0c('0x21')]:_0x5af34a[_0xbb0c('0x1e')]+_0x5af34a[_0xbb0c('0x20')];var _0x484554;if(_0x489eea>=_0x322f81){_0x489eea=_0x322f81;_0x484554=0xc8;}else{_0x484554=0xce;}_0x5c882b[_0xbb0c('0x1b')](_0x484554);return _0x5c882b['set'](_0xbb0c('0x22'),_0x4cf770+'-'+_0x489eea+'/'+_0x322f81)['json'](_0x439bc8);}return null;};}function patchUpdates(_0x5512a2){return function(_0x9346c2){try{jsonpatch['apply'](_0x9346c2,_0x5512a2,!![]);}catch(_0x56dd18){return BPromise[_0xbb0c('0x23')](_0x56dd18);}return _0x9346c2[_0xbb0c('0x24')]();};}function saveUpdates(_0x580ed9,_0x269baf){return function(_0x3ea245){if(_0x3ea245){return _0x3ea245[_0xbb0c('0x25')](_0x580ed9)[_0xbb0c('0x26')](function(_0x42cdc3){return _0x42cdc3;});}return null;};}function removeEntity(_0x258c7e,_0x56eade){return function(_0x2bbbe0){if(_0x2bbbe0){return _0x2bbbe0[_0xbb0c('0x27')]()[_0xbb0c('0x26')](function(){var _0xa48934=_0x2bbbe0[_0xbb0c('0x28')]({'plain':!![]});var _0x3d27e5=_0xbb0c('0x29');return db['UserProfileResource'][_0xbb0c('0x27')]({'where':{'type':_0x3d27e5,'resourceId':_0xa48934['id']}})[_0xbb0c('0x26')](function(){return _0x2bbbe0;});})[_0xbb0c('0x26')](function(){_0x258c7e[_0xbb0c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5754aa,_0x56fa1f){return function(_0x49db8f){if(!_0x49db8f){_0x5754aa[_0xbb0c('0x1a')](0x194);}return _0x49db8f;};}function handleError(_0x3d67c7,_0x5c7be9){_0x5c7be9=_0x5c7be9||0x1f4;return function(_0x50d521){logger[_0xbb0c('0x2a')](_0x50d521[_0xbb0c('0x2b')]);if(_0x50d521['name']){delete _0x50d521[_0xbb0c('0x2c')];}_0x3d67c7[_0xbb0c('0x1b')](_0x5c7be9)[_0xbb0c('0x2d')](_0x50d521);};}exports[_0xbb0c('0x2e')]=function(_0x1cd573,_0x2d1149){var _0x3fbe98={},_0xe3af0={},_0x12dd51={'count':0x0,'rows':[]};var _0xf3fbc=_[_0xbb0c('0x2f')](db[_0xbb0c('0x30')][_0xbb0c('0x31')],function(_0x325cab){return{'name':_0x325cab[_0xbb0c('0x32')],'type':_0x325cab[_0xbb0c('0x33')]['key']};});_0xe3af0[_0xbb0c('0x34')]=_[_0xbb0c('0x2f')](_0xf3fbc,_0xbb0c('0x2c'));_0xe3af0[_0xbb0c('0x35')]=_['keys'](_0x1cd573['query']);_0xe3af0['filters']=_[_0xbb0c('0x36')](_0xe3af0[_0xbb0c('0x34')],_0xe3af0[_0xbb0c('0x35')]);_0x3fbe98[_0xbb0c('0x37')]=_[_0xbb0c('0x36')](_0xe3af0[_0xbb0c('0x34')],qs['fields'](_0x1cd573[_0xbb0c('0x35')][_0xbb0c('0x38')]));_0x3fbe98[_0xbb0c('0x37')]=_0x3fbe98[_0xbb0c('0x37')][_0xbb0c('0x39')]?_0x3fbe98[_0xbb0c('0x37')]:_0xe3af0['model'];if(!_0x1cd573[_0xbb0c('0x35')][_0xbb0c('0x3a')](_0xbb0c('0x3b'))){_0x3fbe98[_0xbb0c('0x20')]=qs[_0xbb0c('0x20')](_0x1cd573[_0xbb0c('0x35')][_0xbb0c('0x20')]);_0x3fbe98[_0xbb0c('0x1e')]=qs[_0xbb0c('0x1e')](_0x1cd573['query'][_0xbb0c('0x1e')]);}_0x3fbe98[_0xbb0c('0x3c')]=qs['sort'](_0x1cd573['query'][_0xbb0c('0x3d')]);_0x3fbe98[_0xbb0c('0x3e')]=qs[_0xbb0c('0x3f')](_[_0xbb0c('0x40')](_0x1cd573[_0xbb0c('0x35')],_0xe3af0[_0xbb0c('0x3f')]),_0xf3fbc);if(_0x1cd573[_0xbb0c('0x35')][_0xbb0c('0x41')]){_0x3fbe98[_0xbb0c('0x3e')]=_[_0xbb0c('0x42')](_0x3fbe98['where'],{'$or':_[_0xbb0c('0x2f')](_0xf3fbc,function(_0x33facd){if(_0x33facd[_0xbb0c('0x33')]!==_0xbb0c('0x43')){var _0x40ffdc={};_0x40ffdc[_0x33facd[_0xbb0c('0x2c')]]={'$like':'%'+_0x1cd573[_0xbb0c('0x35')][_0xbb0c('0x41')]+'%'};return _0x40ffdc;}})});}_0x3fbe98=_['merge']({},_0x3fbe98,_0x1cd573[_0xbb0c('0x44')]);var _0x4df488={'where':_0x3fbe98[_0xbb0c('0x3e')]};return db['CmHopperAdditionalPhone'][_0xbb0c('0x21')](_0x4df488)['then'](function(_0x5835a9){_0x12dd51[_0xbb0c('0x21')]=_0x5835a9;if(_0x1cd573['query'][_0xbb0c('0x45')]){_0x3fbe98[_0xbb0c('0x46')]=[{'all':!![]}];}return db[_0xbb0c('0x30')][_0xbb0c('0x47')](_0x3fbe98);})['then'](function(_0xd27bf2){_0x12dd51[_0xbb0c('0x48')]=_0xd27bf2;return _0x12dd51;})[_0xbb0c('0x26')](respondWithFilteredResult(_0x2d1149,_0x3fbe98))[_0xbb0c('0x49')](handleError(_0x2d1149,null));};exports[_0xbb0c('0x4a')]=function(_0x43d4e4,_0x5e0311){var _0x165062={'raw':!![],'where':{'id':_0x43d4e4[_0xbb0c('0x4b')]['id']}},_0x1858cc={};_0x1858cc[_0xbb0c('0x34')]=_['keys'](db[_0xbb0c('0x30')]['rawAttributes']);_0x1858cc['query']=_[_0xbb0c('0x4c')](_0x43d4e4[_0xbb0c('0x35')]);_0x1858cc[_0xbb0c('0x3f')]=_[_0xbb0c('0x36')](_0x1858cc[_0xbb0c('0x34')],_0x1858cc[_0xbb0c('0x35')]);_0x165062[_0xbb0c('0x37')]=_[_0xbb0c('0x36')](_0x1858cc[_0xbb0c('0x34')],qs['fields'](_0x43d4e4[_0xbb0c('0x35')][_0xbb0c('0x38')]));_0x165062[_0xbb0c('0x37')]=_0x165062[_0xbb0c('0x37')]['length']?_0x165062['attributes']:_0x1858cc['model'];if(_0x43d4e4[_0xbb0c('0x35')]['includeAll']){_0x165062[_0xbb0c('0x46')]=[{'all':!![]}];}_0x165062=_[_0xbb0c('0x42')]({},_0x165062,_0x43d4e4[_0xbb0c('0x44')]);return db['CmHopperAdditionalPhone'][_0xbb0c('0x4d')](_0x165062)['then'](handleEntityNotFound(_0x5e0311,null))[_0xbb0c('0x26')](respondWithResult(_0x5e0311,null))[_0xbb0c('0x49')](handleError(_0x5e0311,null));};exports[_0xbb0c('0x4e')]=function(_0x5afb20,_0x3d3b07){return db[_0xbb0c('0x30')][_0xbb0c('0x4e')](_0x5afb20[_0xbb0c('0x4f')],{})['then'](function(_0x1736ef){var _0x1c0222=_0x5afb20['user'][_0xbb0c('0x28')]({'plain':!![]});if(!_0x1c0222)throw new Error(_0xbb0c('0x50'));if(_0x1c0222[_0xbb0c('0x51')]===_0xbb0c('0x52')){var _0x4ff090=_0x1736ef[_0xbb0c('0x28')]({'plain':!![]});var _0x3f5f8b='CmHopperAdditionalPhones';return db[_0xbb0c('0x53')]['find']({'where':{'name':_0x3f5f8b,'userProfileId':_0x1c0222['userProfileId']},'raw':!![]})[_0xbb0c('0x26')](function(_0x42b5c2){if(_0x42b5c2&&_0x42b5c2[_0xbb0c('0x54')]===0x0){return db[_0xbb0c('0x55')]['create']({'name':_0x4ff090[_0xbb0c('0x2c')],'resourceId':_0x4ff090['id'],'type':_0x42b5c2[_0xbb0c('0x2c')],'sectionId':_0x42b5c2['id']},{})['then'](function(){return _0x1736ef;});}else{return _0x1736ef;}})[_0xbb0c('0x49')](function(_0x916a83){logger[_0xbb0c('0x2a')](_0xbb0c('0x56'),_0x916a83);throw _0x916a83;});}return _0x1736ef;})['then'](respondWithResult(_0x3d3b07,0xc9))[_0xbb0c('0x49')](handleError(_0x3d3b07,null));};exports[_0xbb0c('0x25')]=function(_0x37ce1b,_0x28da32){if(_0x37ce1b['body']['id']){delete _0x37ce1b[_0xbb0c('0x4f')]['id'];}return db[_0xbb0c('0x30')]['find']({'where':{'id':_0x37ce1b[_0xbb0c('0x4b')]['id']}})[_0xbb0c('0x26')](handleEntityNotFound(_0x28da32,null))[_0xbb0c('0x26')](saveUpdates(_0x37ce1b[_0xbb0c('0x4f')],null))[_0xbb0c('0x26')](respondWithResult(_0x28da32,null))['catch'](handleError(_0x28da32,null));};exports[_0xbb0c('0x27')]=function(_0x1b9218,_0x261182){return db[_0xbb0c('0x30')][_0xbb0c('0x4d')]({'where':{'id':_0x1b9218[_0xbb0c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x261182,null))[_0xbb0c('0x26')](removeEntity(_0x261182,null))[_0xbb0c('0x49')](handleError(_0x261182,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 827fbfa..3159ab3 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 _0xcc0e=['bluebird','request-promise','path','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment'];(function(_0x4a9bdd,_0x5098f5){var _0x1ba3a4=function(_0x3b157f){while(--_0x3b157f){_0x4a9bdd['push'](_0x4a9bdd['shift']());}};_0x1ba3a4(++_0x5098f5);}(_0xcc0e,0x8c));var _0xecc0=function(_0x326afa,_0x842680){_0x326afa=_0x326afa-0x0;var _0x3255cf=_0xcc0e[_0x326afa];return _0x3255cf;};'use strict';var _=require(_0xecc0('0x0'));var util=require('util');var logger=require(_0xecc0('0x1'))(_0xecc0('0x2'));var moment=require(_0xecc0('0x3'));var BPromise=require(_0xecc0('0x4'));var rp=require(_0xecc0('0x5'));var fs=require('fs');var path=require(_0xecc0('0x6'));var rimraf=require('rimraf');var config=require(_0xecc0('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xecc0('0x8')]=function(_0x298ada,_0x4d7d90){return _0x298ada[_0xecc0('0x9')](_0xecc0('0xa'),attributes,{'tableName':_0xecc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e35=['bluebird','request-promise','path','../../config/environment','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','moment'];(function(_0x36cb47,_0xb4dbe){var _0x3ea2b7=function(_0x20a626){while(--_0x20a626){_0x36cb47['push'](_0x36cb47['shift']());}};_0x3ea2b7(++_0xb4dbe);}(_0x2e35,0x101));var _0x52e3=function(_0x350ad8,_0x4c5ff3){_0x350ad8=_0x350ad8-0x0;var _0x308b44=_0x2e35[_0x350ad8];return _0x308b44;};'use strict';var _=require(_0x52e3('0x0'));var util=require('util');var logger=require(_0x52e3('0x1'))('api');var moment=require(_0x52e3('0x2'));var BPromise=require(_0x52e3('0x3'));var rp=require(_0x52e3('0x4'));var fs=require('fs');var path=require(_0x52e3('0x5'));var rimraf=require('rimraf');var config=require(_0x52e3('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x583d54,_0x8477a3){return _0x583d54[_0x52e3('0x7')](_0x52e3('0x8'),attributes,{'tableName':_0x52e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 1d348e6..5ebc2fb 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 _0x4714=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VerifyAdditionalPhones','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countcongestionretry','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','countnoanswerretry','sequelize','transaction','CmHopper','update','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4714,0x183));var _0x4471=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4714[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x4471('0x0'));var moment=require(_0x4471('0x1'));var BPromise=require(_0x4471('0x2'));var rs=require(_0x4471('0x3'));var fs=require('fs');var Redis=require(_0x4471('0x4'));var db=require(_0x4471('0x5'))['db'];var utils=require(_0x4471('0x6'));var logger=require(_0x4471('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4471('0x8'));var client=jayson[_0x4471('0x9')][_0x4471('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3187bf,_0x5d081a,_0x864b73){return new BPromise(function(_0x4809d1,_0x9ba3e5){return client[_0x4471('0xb')](_0x3187bf,_0x864b73)[_0x4471('0xc')](function(_0x23fdc5){logger['info'](_0x4471('0xd'),_0x5d081a,_0x4471('0xe'));logger[_0x4471('0xf')](_0x4471('0x10'),_0x5d081a,_0x4471('0xe'),JSON['stringify'](_0x23fdc5));if(_0x23fdc5['error']){if(_0x23fdc5[_0x4471('0x11')]['code']===0x1f4){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x9ba3e5(_0x23fdc5[_0x4471('0x11')]['message']);}logger[_0x4471('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x4809d1(_0x23fdc5['error'][_0x4471('0x12')]);}else{logger[_0x4471('0x13')](_0x4471('0xd'),_0x5d081a,'request\x20sent');_0x4809d1(_0x23fdc5[_0x4471('0x14')]['message']);}})[_0x4471('0x15')](function(_0x32c9e6){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x32c9e6);_0x9ba3e5(_0x32c9e6);});});}exports[_0x4471('0x16')]=function(_0x5236e8){var _0x1bfc07=this;return new Promise(function(_0xf156be,_0xcfaf37){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x5236e8[_0x4471('0x17')][_0x4471('0x18')],'ListId':_0x5236e8[_0x4471('0x17')]['ListId'],'VoiceQueueId':_0x5236e8[_0x4471('0x17')][_0x4471('0x19')]===undefined?null:_0x5236e8[_0x4471('0x17')][_0x4471('0x19')],'CampaignId':_0x5236e8['body']['CampaignId']===undefined?null:_0x5236e8[_0x4471('0x17')][_0x4471('0x1a')]}})[_0x4471('0xc')](function(_0xc0bdca){if(_0xc0bdca!=null){return db[_0x4471('0x1b')][_0x4471('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xc0bdca['id'],'OrderBy':{'$gt':_0xc0bdca[_0x4471('0x1d')]}},'order':[[_0x4471('0x1d'),_0x4471('0x1e')]]})[_0x4471('0xc')](function(_0x586b02){var _0x4fc82f=0x0;if(_0x586b02){if(_0x586b02[_0x4471('0x1f')]+_0x586b02['countcongestionretry']+_0x586b02['countnoanswerretry']+_0x586b02[_0x4471('0x20')]+_0x586b02[_0x4471('0x21')]+_0x586b02[_0x4471('0x22')]+_0x586b02[_0x4471('0x23')]+_0x586b02['countagentrejectretry']<_0x5236e8[_0x4471('0x24')][_0x4471('0x25')])_0x4fc82f=0x1;_0xf156be({'additional':_0x4fc82f});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xc0bdca['id']},'order':[['OrderBy','ASC']]})[_0x4471('0xc')](function(_0x2c7a88){var _0x56efbf=0x0;if(_0x2c7a88){if(_0x2c7a88[_0x4471('0x1f')]+_0x2c7a88[_0x4471('0x26')]+_0x2c7a88['countnoanswerretry']+_0x2c7a88['countnosuchnumberretry']+_0x2c7a88[_0x4471('0x21')]+_0x2c7a88[_0x4471('0x22')]+_0x2c7a88['countmachineretry']+_0x2c7a88['countagentrejectretry']<_0x5236e8[_0x4471('0x24')][_0x4471('0x25')])_0x56efbf=0x1;_0xf156be({'additional':_0x56efbf});}else{_0xf156be({'additional':0x0});}})['catch'](function(_0x419cea){logger[_0x4471('0x11')]('VerifyAdditionalPhones',_0x419cea[_0x4471('0x12')]);_0xcfaf37(_0x1bfc07[_0x4471('0x11')](0x1f4,_0x419cea[_0x4471('0x12')]));});}})[_0x4471('0x15')](function(_0x22309f){logger[_0x4471('0x11')]('VerifyAdditionalPhones',_0x22309f[_0x4471('0x12')]);_0xcfaf37(_0x1bfc07[_0x4471('0x11')](0x1f4,_0x22309f[_0x4471('0x12')]));});}else _0xf156be({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x492027){var _0x3548c2=this;return new Promise(function(_0xf89956,_0x1b82ba){return db['CmHopper'][_0x4471('0x1c')]({'raw':!![],'where':{'ContactId':_0x492027[_0x4471('0x17')][_0x4471('0x18')],'ListId':_0x492027[_0x4471('0x17')][_0x4471('0x27')],'VoiceQueueId':_0x492027[_0x4471('0x17')][_0x4471('0x19')]===undefined?null:_0x492027[_0x4471('0x17')][_0x4471('0x19')],'CampaignId':_0x492027[_0x4471('0x17')][_0x4471('0x1a')]===undefined?null:_0x492027[_0x4471('0x17')][_0x4471('0x1a')]}})[_0x4471('0xc')](function(_0xaca8ed){if(_0xaca8ed!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xaca8ed['id'],'OrderBy':{'$gte':_0xaca8ed[_0x4471('0x1d')]}},'order':[[_0x4471('0x1d'),_0x4471('0x1e')]]})[_0x4471('0xc')](function(_0x262fd7){if(_0x262fd7)return activateAdditionalPhone(_0xaca8ed,_0x492027[_0x4471('0x17')],_0x262fd7,_0x492027[_0x4471('0x28')],_0x492027[_0x4471('0x29')])[_0x4471('0xc')](function(_0xe8be6f){_0xf89956(_0xe8be6f);});else{return db[_0x4471('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xaca8ed['id']},'order':[[_0x4471('0x1d'),'ASC']]})[_0x4471('0xc')](function(_0x326d29){if(_0x326d29)return activateAdditionalPhone(_0xaca8ed,_0x492027['body'],_0x326d29,_0x492027[_0x4471('0x28')],_0x492027[_0x4471('0x29')])[_0x4471('0xc')](function(_0x52273b){_0xf89956(_0x52273b);});else{_0xf89956({'id':_0xaca8ed['id'],'phone':''});}})[_0x4471('0x15')](function(_0x1eed55){logger['error'](_0x4471('0x16'),_0x1eed55['message']);_0x1b82ba(_0x3548c2[_0x4471('0x11')](0x1f4,_0x1eed55['message']));});}})[_0x4471('0x15')](function(_0x314f1e){logger[_0x4471('0x11')](_0x4471('0x16'),_0x314f1e['message']);_0x1b82ba(_0x3548c2['error'](0x1f4,_0x314f1e[_0x4471('0x12')]));});}else _0xf89956(0x1);});});};function activateAdditionalPhone(_0x4583ec,_0x58e14b,_0x4e0e2d,_0x2060f1,_0x386fcb){return new Promise(function(_0x521962,_0xedc568){var _0xc14f4e;if(_[_0x4471('0x2a')](_0x4e0e2d[_0x4471('0x2b')])){_0x4e0e2d[_0x4471('0x2b')]=moment();}if(moment()>moment(_0x4e0e2d['scheduledat'])){_0xc14f4e=moment()['add'](_0x386fcb||0x3,'minutes');}else{if(_0x4e0e2d[_0x4471('0x1d')]==0x0){_0xc14f4e=moment(_0x4e0e2d['scheduledat']);}else{_0xc14f4e=moment()[_0x4471('0x2c')](_0x386fcb||0x3,'minutes');}}if(_[_0x4471('0x2a')](_0xc14f4e)){_0xc14f4e=moment()[_0x4471('0x2c')](_0x386fcb||0x3,_0x4471('0x2d'));}var _0x29cec5={'phone':_0x4583ec[_0x4471('0x2e')],'active':0x0,'OrderBy':_[_0x4471('0x2a')](_0x4583ec['OrderBy'])?0x0:_0x4583ec[_0x4471('0x1d')],'scheduledat':moment()[_0x4471('0x2c')](_0x2060f1||0x1,'minutes'),'countbusyretry':_0x58e14b[_0x4471('0x1f')],'countcongestionretry':_0x58e14b[_0x4471('0x26')],'countnoanswerretry':_0x58e14b['countnoanswerretry'],'countnosuchnumberretry':_0x58e14b['countnosuchnumberretry'],'countdropretry':_0x58e14b[_0x4471('0x21')],'countabandonedretry':_0x58e14b[_0x4471('0x22')],'countmachineretry':_0x58e14b[_0x4471('0x23')],'countagentrejectretry':_0x58e14b[_0x4471('0x2f')],'createdAt':_0x58e14b[_0x4471('0x30')],'updatedAt':_0x58e14b[_0x4471('0x31')]};var _0x3a28eb={'CmHopperId':_0x4583ec['id'],'phone':_0x4e0e2d['phone'],'active':0x0,'OrderBy':_[_0x4471('0x2a')](_0x4e0e2d[_0x4471('0x1d')])?0x0:_0x4e0e2d[_0x4471('0x1d')],'scheduledat':_0xc14f4e,'countbusyretry':_0x4e0e2d[_0x4471('0x1f')],'countcongestionretry':_0x4e0e2d['countcongestionretry'],'countnoanswerretry':_0x4e0e2d[_0x4471('0x32')],'countnosuchnumberretry':_0x4e0e2d[_0x4471('0x20')],'countdropretry':_0x4e0e2d['countdropretry'],'countabandonedretry':_0x4e0e2d[_0x4471('0x22')],'countmachineretry':_0x4e0e2d[_0x4471('0x23')],'countagentrejectretry':_0x4e0e2d[_0x4471('0x2f')],'createdAt':_0x4e0e2d[_0x4471('0x30')],'updatedAt':_0x4e0e2d[_0x4471('0x31')]};return db[_0x4471('0x33')][_0x4471('0x34')](function(_0x37f889){return db[_0x4471('0x1b')]['update'](_0x29cec5,{'where':{'id':_0x4e0e2d['id']}},{'transaction':_0x37f889})[_0x4471('0xc')](function(){return db[_0x4471('0x35')][_0x4471('0x36')](_0x3a28eb,{'where':{'id':_0x4583ec['id']}},{'transaction':_0x37f889});});})[_0x4471('0xc')](function(_0x42a135){_0x521962({'id':_0x4583ec['id'],'phone':_0x4e0e2d[_0x4471('0x2e')]});})[_0x4471('0x15')](function(_0x43572d){logger[_0x4471('0x11')]('activateAdditionalPhone',_0x43572d['message']);_0xedc568({'error':_0x43572d[_0x4471('0x12')]});});});}exports[_0x4471('0x37')]=function(_0x540e8f){var _0x1e6c3a=this;return new Promise(function(_0x57145a,_0x4bd74c){return db[_0x4471('0x35')][_0x4471('0x36')](_0x540e8f[_0x4471('0x17')]['field'],{'where':{'id':_0x540e8f['body']['id']}})['then'](function(_0x14b7b5){_0x57145a(_0x14b7b5);})[_0x4471('0x15')](function(_0x304dfb){logger['error']('IncrementPreviewCounters',_0x304dfb['message']);_0x4bd74c(_0x1e6c3a[_0x4471('0x11')](0x1f4,_0x304dfb['message']));});});}; \ No newline at end of file +var _0x8c39=['VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','activateAdditionalPhone','IncrementPreviewCounters','update','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x60e43,_0x5011d7){var _0x5d270d=function(_0x4a176c){while(--_0x4a176c){_0x60e43['push'](_0x60e43['shift']());}};_0x5d270d(++_0x5011d7);}(_0x8c39,0x1f3));var _0x98c3=function(_0xb5d06f,_0x2b4284){_0xb5d06f=_0xb5d06f-0x0;var _0x2f9559=_0x8c39[_0xb5d06f];return _0x2f9559;};'use strict';var _=require(_0x98c3('0x0'));var util=require(_0x98c3('0x1'));var moment=require(_0x98c3('0x2'));var BPromise=require(_0x98c3('0x3'));var rs=require(_0x98c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98c3('0x5'))['db'];var utils=require(_0x98c3('0x6'));var logger=require('../../config/logger')(_0x98c3('0x7'));var config=require(_0x98c3('0x8'));var jayson=require(_0x98c3('0x9'));var client=jayson[_0x98c3('0xa')][_0x98c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xccf19,_0x1d7add,_0x536bd3){return new BPromise(function(_0x5fd326,_0x2c2e7e){return client[_0x98c3('0xc')](_0xccf19,_0x536bd3)[_0x98c3('0xd')](function(_0x17e4dc){logger[_0x98c3('0xe')](_0x98c3('0xf'),_0x1d7add,_0x98c3('0x10'));logger['debug'](_0x98c3('0x11'),_0x1d7add,'request\x20sent',JSON[_0x98c3('0x12')](_0x17e4dc));if(_0x17e4dc['error']){if(_0x17e4dc[_0x98c3('0x13')][_0x98c3('0x14')]===0x1f4){logger[_0x98c3('0x13')](_0x98c3('0xf'),_0x1d7add,_0x17e4dc[_0x98c3('0x13')][_0x98c3('0x15')]);return _0x2c2e7e(_0x17e4dc[_0x98c3('0x13')][_0x98c3('0x15')]);}logger['error'](_0x98c3('0xf'),_0x1d7add,_0x17e4dc[_0x98c3('0x13')][_0x98c3('0x15')]);return _0x5fd326(_0x17e4dc[_0x98c3('0x13')][_0x98c3('0x15')]);}else{logger[_0x98c3('0xe')](_0x98c3('0xf'),_0x1d7add,_0x98c3('0x10'));_0x5fd326(_0x17e4dc['result'][_0x98c3('0x15')]);}})[_0x98c3('0x16')](function(_0x6c7e0e){logger[_0x98c3('0x13')](_0x98c3('0xf'),_0x1d7add,_0x6c7e0e);_0x2c2e7e(_0x6c7e0e);});});}exports[_0x98c3('0x17')]=function(_0x76e150){var _0x4dfa21=this;return new Promise(function(_0x273e0f,_0x35116a){return db[_0x98c3('0x18')][_0x98c3('0x19')]({'raw':!![],'where':{'ContactId':_0x76e150[_0x98c3('0x1a')][_0x98c3('0x1b')],'ListId':_0x76e150['body'][_0x98c3('0x1c')],'VoiceQueueId':_0x76e150[_0x98c3('0x1a')][_0x98c3('0x1d')]===undefined?null:_0x76e150[_0x98c3('0x1a')]['VoiceQueueId'],'CampaignId':_0x76e150[_0x98c3('0x1a')][_0x98c3('0x1e')]===undefined?null:_0x76e150['body'][_0x98c3('0x1e')]}})[_0x98c3('0xd')](function(_0xc2cf4f){if(_0xc2cf4f!=null){return db[_0x98c3('0x1f')][_0x98c3('0x19')]({'raw':!![],'where':{'CmHopperId':_0xc2cf4f['id'],'OrderBy':{'$gt':_0xc2cf4f[_0x98c3('0x20')]}},'order':[['OrderBy',_0x98c3('0x21')]]})['then'](function(_0x18ce56){var _0x5b1e2d=0x0;if(_0x18ce56){if(_0x18ce56[_0x98c3('0x22')]+_0x18ce56['countcongestionretry']+_0x18ce56[_0x98c3('0x23')]+_0x18ce56[_0x98c3('0x24')]+_0x18ce56[_0x98c3('0x25')]+_0x18ce56[_0x98c3('0x26')]+_0x18ce56[_0x98c3('0x27')]+_0x18ce56[_0x98c3('0x28')]<_0x76e150['entity'][_0x98c3('0x29')])_0x5b1e2d=0x1;_0x273e0f({'additional':_0x5b1e2d});}else{return db[_0x98c3('0x1f')][_0x98c3('0x19')]({'raw':!![],'where':{'CmHopperId':_0xc2cf4f['id']},'order':[[_0x98c3('0x20'),_0x98c3('0x21')]]})[_0x98c3('0xd')](function(_0x332b2b){var _0x32455d=0x0;if(_0x332b2b){if(_0x332b2b[_0x98c3('0x22')]+_0x332b2b[_0x98c3('0x2a')]+_0x332b2b[_0x98c3('0x23')]+_0x332b2b[_0x98c3('0x24')]+_0x332b2b['countdropretry']+_0x332b2b[_0x98c3('0x26')]+_0x332b2b[_0x98c3('0x27')]+_0x332b2b[_0x98c3('0x28')]<_0x76e150['entity'][_0x98c3('0x29')])_0x32455d=0x1;_0x273e0f({'additional':_0x32455d});}else{_0x273e0f({'additional':0x0});}})[_0x98c3('0x16')](function(_0x284adc){logger['error'](_0x98c3('0x17'),_0x284adc[_0x98c3('0x15')]);_0x35116a(_0x4dfa21['error'](0x1f4,_0x284adc[_0x98c3('0x15')]));});}})[_0x98c3('0x16')](function(_0x836606){logger[_0x98c3('0x13')]('VerifyAdditionalPhones',_0x836606['message']);_0x35116a(_0x4dfa21[_0x98c3('0x13')](0x1f4,_0x836606[_0x98c3('0x15')]));});}else _0x273e0f({'additional':0x0});});});};exports[_0x98c3('0x2b')]=function(_0x321551){var _0x3683b4=this;return new Promise(function(_0x477577,_0x4190b8){return db[_0x98c3('0x18')][_0x98c3('0x19')]({'raw':!![],'where':{'ContactId':_0x321551['body'][_0x98c3('0x1b')],'ListId':_0x321551[_0x98c3('0x1a')][_0x98c3('0x1c')],'VoiceQueueId':_0x321551['body'][_0x98c3('0x1d')]===undefined?null:_0x321551['body'][_0x98c3('0x1d')],'CampaignId':_0x321551[_0x98c3('0x1a')][_0x98c3('0x1e')]===undefined?null:_0x321551[_0x98c3('0x1a')][_0x98c3('0x1e')]}})[_0x98c3('0xd')](function(_0x1c8abb){if(_0x1c8abb!=null){return db[_0x98c3('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1c8abb['id'],'OrderBy':{'$gte':_0x1c8abb[_0x98c3('0x20')]}},'order':[[_0x98c3('0x20'),_0x98c3('0x21')]]})['then'](function(_0x3cdecb){if(_0x3cdecb)return activateAdditionalPhone(_0x1c8abb,_0x321551['body'],_0x3cdecb,_0x321551[_0x98c3('0x2c')],_0x321551[_0x98c3('0x2d')])[_0x98c3('0xd')](function(_0x195ad8){_0x477577(_0x195ad8);});else{return db[_0x98c3('0x1f')][_0x98c3('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1c8abb['id']},'order':[[_0x98c3('0x20'),_0x98c3('0x21')]]})[_0x98c3('0xd')](function(_0x4c2619){if(_0x4c2619)return activateAdditionalPhone(_0x1c8abb,_0x321551[_0x98c3('0x1a')],_0x4c2619,_0x321551[_0x98c3('0x2c')],_0x321551['waitTime'])[_0x98c3('0xd')](function(_0x1ba9fc){_0x477577(_0x1ba9fc);});else{_0x477577({'id':_0x1c8abb['id'],'phone':''});}})['catch'](function(_0x55bfaa){logger[_0x98c3('0x13')](_0x98c3('0x17'),_0x55bfaa['message']);_0x4190b8(_0x3683b4[_0x98c3('0x13')](0x1f4,_0x55bfaa[_0x98c3('0x15')]));});}})[_0x98c3('0x16')](function(_0x3d4b6e){logger[_0x98c3('0x13')]('VerifyAdditionalPhones',_0x3d4b6e[_0x98c3('0x15')]);_0x4190b8(_0x3683b4[_0x98c3('0x13')](0x1f4,_0x3d4b6e[_0x98c3('0x15')]));});}else _0x477577(0x1);});});};function activateAdditionalPhone(_0x461b52,_0x1c692c,_0x1d2888,_0x3be967,_0x5865d6){return new Promise(function(_0x26ecc7,_0x251081){var _0x4ead14;if(_[_0x98c3('0x2e')](_0x1d2888[_0x98c3('0x2f')])){_0x1d2888[_0x98c3('0x2f')]=moment();}if(moment()>moment(_0x1d2888[_0x98c3('0x2f')])){_0x4ead14=moment()[_0x98c3('0x30')](_0x5865d6||0x3,'minutes');}else{if(_0x1d2888[_0x98c3('0x20')]==0x0){_0x4ead14=moment(_0x1d2888[_0x98c3('0x2f')]);}else{_0x4ead14=moment()[_0x98c3('0x30')](_0x5865d6||0x3,_0x98c3('0x31'));}}if(_[_0x98c3('0x2e')](_0x4ead14)){_0x4ead14=moment()[_0x98c3('0x30')](_0x5865d6||0x3,'minutes');}var _0x19a231={'phone':_0x461b52[_0x98c3('0x32')],'active':0x0,'OrderBy':_[_0x98c3('0x2e')](_0x461b52[_0x98c3('0x20')])?0x0:_0x461b52[_0x98c3('0x20')],'scheduledat':moment()[_0x98c3('0x30')](_0x3be967||0x1,'minutes'),'countbusyretry':_0x1c692c[_0x98c3('0x22')],'countcongestionretry':_0x1c692c[_0x98c3('0x2a')],'countnoanswerretry':_0x1c692c[_0x98c3('0x23')],'countnosuchnumberretry':_0x1c692c[_0x98c3('0x24')],'countdropretry':_0x1c692c[_0x98c3('0x25')],'countabandonedretry':_0x1c692c[_0x98c3('0x26')],'countmachineretry':_0x1c692c[_0x98c3('0x27')],'countagentrejectretry':_0x1c692c['countagentrejectretry'],'createdAt':_0x1c692c[_0x98c3('0x33')],'updatedAt':_0x1c692c[_0x98c3('0x34')]};var _0x588f3e={'CmHopperId':_0x461b52['id'],'phone':_0x1d2888[_0x98c3('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x1d2888[_0x98c3('0x20')])?0x0:_0x1d2888[_0x98c3('0x20')],'scheduledat':_0x4ead14,'countbusyretry':_0x1d2888[_0x98c3('0x22')],'countcongestionretry':_0x1d2888[_0x98c3('0x2a')],'countnoanswerretry':_0x1d2888['countnoanswerretry'],'countnosuchnumberretry':_0x1d2888['countnosuchnumberretry'],'countdropretry':_0x1d2888[_0x98c3('0x25')],'countabandonedretry':_0x1d2888['countabandonedretry'],'countmachineretry':_0x1d2888[_0x98c3('0x27')],'countagentrejectretry':_0x1d2888['countagentrejectretry'],'createdAt':_0x1d2888[_0x98c3('0x33')],'updatedAt':_0x1d2888[_0x98c3('0x34')]};return db[_0x98c3('0x35')]['transaction'](function(_0x538130){return db[_0x98c3('0x1f')]['update'](_0x19a231,{'where':{'id':_0x1d2888['id']}},{'transaction':_0x538130})[_0x98c3('0xd')](function(){return db[_0x98c3('0x18')]['update'](_0x588f3e,{'where':{'id':_0x461b52['id']}},{'transaction':_0x538130});});})[_0x98c3('0xd')](function(_0x4469fa){_0x26ecc7({'id':_0x461b52['id'],'phone':_0x1d2888[_0x98c3('0x32')]});})[_0x98c3('0x16')](function(_0x1d8459){logger[_0x98c3('0x13')](_0x98c3('0x36'),_0x1d8459[_0x98c3('0x15')]);_0x251081({'error':_0x1d8459[_0x98c3('0x15')]});});});}exports[_0x98c3('0x37')]=function(_0x30053d){var _0x35cb6d=this;return new Promise(function(_0x634e79,_0x19242e){return db[_0x98c3('0x18')][_0x98c3('0x38')](_0x30053d[_0x98c3('0x1a')][_0x98c3('0x39')],{'where':{'id':_0x30053d['body']['id']}})[_0x98c3('0xd')](function(_0x159ebd){_0x634e79(_0x159ebd);})[_0x98c3('0x16')](function(_0x179f64){logger[_0x98c3('0x13')](_0x98c3('0x37'),_0x179f64['message']);_0x19242e(_0x35cb6d[_0x98c3('0x13')](0x1f4,_0x179f64[_0x98c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 0115c73..fb156cc 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 _0x3704=['create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x3704,0x6c));var _0x4370=function(_0x502b1c,_0x463985){_0x502b1c=_0x502b1c-0x0;var _0x40d88d=_0x3704[_0x502b1c];return _0x40d88d;};'use strict';var multer=require('multer');var util=require(_0x4370('0x0'));var path=require(_0x4370('0x1'));var timeout=require('connect-timeout');var express=require(_0x4370('0x2'));var router=express[_0x4370('0x3')]();var fs_extra=require(_0x4370('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4370('0x5'));var config=require(_0x4370('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x4370('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4370('0x8'),auth['isAuthenticated'](),controller[_0x4370('0x9')]);router['post']('/',auth[_0x4370('0xa')](),controller[_0x4370('0xb')]);router[_0x4370('0xc')](_0x4370('0x8'),auth[_0x4370('0xa')](),controller[_0x4370('0xd')]);router[_0x4370('0xe')](_0x4370('0x8'),auth['isAuthenticated'](),controller[_0x4370('0xf')]);module[_0x4370('0x10')]=router; \ No newline at end of file +var _0x1ff7=['destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','/:id','isAuthenticated','show','create'];(function(_0x6beb92,_0x14b5d3){var _0x51f315=function(_0x15e373){while(--_0x15e373){_0x6beb92['push'](_0x6beb92['shift']());}};_0x51f315(++_0x14b5d3);}(_0x1ff7,0x189));var _0x71ff=function(_0x4feeaa,_0xe283ea){_0x4feeaa=_0x4feeaa-0x0;var _0x37ba43=_0x1ff7[_0x4feeaa];return _0x37ba43;};'use strict';var multer=require(_0x71ff('0x0'));var util=require(_0x71ff('0x1'));var path=require('path');var timeout=require(_0x71ff('0x2'));var express=require(_0x71ff('0x3'));var router=express['Router']();var fs_extra=require(_0x71ff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x71ff('0x5'));var config=require(_0x71ff('0x6'));var controller=require(_0x71ff('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x71ff('0x8')]);router['get'](_0x71ff('0x9'),auth[_0x71ff('0xa')](),controller[_0x71ff('0xb')]);router['post']('/',auth[_0x71ff('0xa')](),controller[_0x71ff('0xc')]);router['put'](_0x71ff('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x71ff('0x9'),auth[_0x71ff('0xa')](),controller[_0x71ff('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index cd4961b..6e2dc79 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 _0xcde7=['contactListQueue','exports','STRING','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcde7,0x65));var _0x7cde=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcde7[_0x178e48];return _0x440d7e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7cde('0x0')]={'phone':{'type':Sequelize[_0x7cde('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7cde('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7cde('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7cde('0x3')}}; \ No newline at end of file +var _0x1952=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x505603,_0x338393){var _0x2dfd31=function(_0x370a20){while(--_0x370a20){_0x505603['push'](_0x505603['shift']());}};_0x2dfd31(++_0x338393);}(_0x1952,0x92));var _0x2195=function(_0x51d5f0,_0x42cafb){_0x51d5f0=_0x51d5f0-0x0;var _0x1eb9ce=_0x1952[_0x51d5f0];return _0x1eb9ce;};'use strict';var moment=require('moment');var Sequelize=require(_0x2195('0x0'));module[_0x2195('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2195('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x2195('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x2195('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e9bc894..83ce3fb 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 _0xc41e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','send','index','CmHopperBlack','rawAttributes','fieldName','key','map','name','query','keys','filters','intersection','attributes','model'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xc41e,0x9c));var _0xec41=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc41e[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec41('0x0'));var jsonpatch=require(_0xec41('0x1'));var rp=require(_0xec41('0x2'));var moment=require(_0xec41('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec41('0x4'));var util=require(_0xec41('0x5'));var path=require(_0xec41('0x6'));var sox=require(_0xec41('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec41('0x8'));var _=require(_0xec41('0x9'));var squel=require('squel');var crypto=require(_0xec41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec41('0xb'));var toCsv=require(_0xec41('0xc'));var querystring=require('querystring');var Papa=require(_0xec41('0xd'));var Redis=require(_0xec41('0xe'));var authService=require(_0xec41('0xf'));var qs=require(_0xec41('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec41('0x11'));var logger=require(_0xec41('0x12'))('api');var utils=require(_0xec41('0x13'));var config=require(_0xec41('0x14'));var licenseUtil=require(_0xec41('0x15'));var db=require(_0xec41('0x16'))['db'];function respondWithStatusCode(_0x2f49f0,_0x5c1740){_0x5c1740=_0x5c1740||0xcc;return function(_0x3f5ad2){if(_0x3f5ad2){return _0x2f49f0[_0xec41('0x17')](_0x5c1740);}return _0x2f49f0[_0xec41('0x18')](_0x5c1740)[_0xec41('0x19')]();};}function respondWithResult(_0x518460,_0x41fee3){_0x41fee3=_0x41fee3||0xc8;return function(_0x12615b){if(_0x12615b){return _0x518460[_0xec41('0x18')](_0x41fee3)[_0xec41('0x1a')](_0x12615b);}};}function respondWithFilteredResult(_0x549c73,_0x30f086){return function(_0x31118c){if(_0x31118c){var _0x5ccc1c=typeof _0x30f086['offset']==='undefined'&&typeof _0x30f086[_0xec41('0x1b')]==='undefined';var _0x2c5468=_0x31118c['count'];var _0x591aef=_0x5ccc1c?0x0:_0x30f086['offset'];var _0x1172a7=_0x5ccc1c?_0x31118c[_0xec41('0x1c')]:_0x30f086[_0xec41('0x1d')]+_0x30f086[_0xec41('0x1b')];var _0x5014ea;if(_0x1172a7>=_0x2c5468){_0x1172a7=_0x2c5468;_0x5014ea=0xc8;}else{_0x5014ea=0xce;}_0x549c73['status'](_0x5014ea);return _0x549c73[_0xec41('0x1e')](_0xec41('0x1f'),_0x591aef+'-'+_0x1172a7+'/'+_0x2c5468)[_0xec41('0x1a')](_0x31118c);}return null;};}function patchUpdates(_0x56a5c5){return function(_0x4826e4){try{jsonpatch[_0xec41('0x20')](_0x4826e4,_0x56a5c5,!![]);}catch(_0x418f4d){return BPromise['reject'](_0x418f4d);}return _0x4826e4[_0xec41('0x21')]();};}function saveUpdates(_0x2a6e8d,_0x56b9d6){return function(_0x57322c){if(_0x57322c){return _0x57322c[_0xec41('0x22')](_0x2a6e8d)['then'](function(_0x1d036b){return _0x1d036b;});}return null;};}function removeEntity(_0x2d4e75,_0x163043){return function(_0x4f78b5){if(_0x4f78b5){return _0x4f78b5[_0xec41('0x23')]()[_0xec41('0x24')](function(){_0x2d4e75[_0xec41('0x18')](0xcc)[_0xec41('0x19')]();});}};}function handleEntityNotFound(_0x3f0d16,_0x3bab16){return function(_0x4bbb4e){if(!_0x4bbb4e){_0x3f0d16[_0xec41('0x17')](0x194);}return _0x4bbb4e;};}function handleError(_0x3b9c8f,_0x108dda){_0x108dda=_0x108dda||0x1f4;return function(_0x5c4238){logger['error'](_0x5c4238['stack']);if(_0x5c4238['name']){delete _0x5c4238['name'];}_0x3b9c8f['status'](_0x108dda)[_0xec41('0x25')](_0x5c4238);};}exports[_0xec41('0x26')]=function(_0x1fb4da,_0x33e778){var _0x2b0c19={},_0xf9d92e={},_0x456aa0={'count':0x0,'rows':[]};var _0x324c08=_['map'](db[_0xec41('0x27')][_0xec41('0x28')],function(_0x2d39e3){return{'name':_0x2d39e3[_0xec41('0x29')],'type':_0x2d39e3['type'][_0xec41('0x2a')]};});_0xf9d92e['model']=_[_0xec41('0x2b')](_0x324c08,_0xec41('0x2c'));_0xf9d92e[_0xec41('0x2d')]=_[_0xec41('0x2e')](_0x1fb4da['query']);_0xf9d92e[_0xec41('0x2f')]=_[_0xec41('0x30')](_0xf9d92e['model'],_0xf9d92e[_0xec41('0x2d')]);_0x2b0c19[_0xec41('0x31')]=_[_0xec41('0x30')](_0xf9d92e[_0xec41('0x32')],qs[_0xec41('0x33')](_0x1fb4da[_0xec41('0x2d')][_0xec41('0x33')]));_0x2b0c19[_0xec41('0x31')]=_0x2b0c19[_0xec41('0x31')][_0xec41('0x34')]?_0x2b0c19[_0xec41('0x31')]:_0xf9d92e[_0xec41('0x32')];if(!_0x1fb4da['query'][_0xec41('0x35')](_0xec41('0x36'))){_0x2b0c19[_0xec41('0x1b')]=qs[_0xec41('0x1b')](_0x1fb4da['query'][_0xec41('0x1b')]);_0x2b0c19['offset']=qs[_0xec41('0x1d')](_0x1fb4da[_0xec41('0x2d')]['offset']);}_0x2b0c19[_0xec41('0x37')]=qs[_0xec41('0x38')](_0x1fb4da[_0xec41('0x2d')][_0xec41('0x38')]);_0x2b0c19[_0xec41('0x39')]=qs[_0xec41('0x2f')](_['pick'](_0x1fb4da[_0xec41('0x2d')],_0xf9d92e[_0xec41('0x2f')]),_0x324c08);if(_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3a')]){_0x2b0c19[_0xec41('0x39')]=_[_0xec41('0x3b')](_0x2b0c19[_0xec41('0x39')],{'$or':_[_0xec41('0x2b')](_0x324c08,function(_0x22cf05){if(_0x22cf05['type']!==_0xec41('0x3c')){var _0x3f1e76={};_0x3f1e76[_0x22cf05[_0xec41('0x2c')]]={'$like':'%'+_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3a')]+'%'};return _0x3f1e76;}})});}_0x2b0c19=_[_0xec41('0x3b')]({},_0x2b0c19,_0x1fb4da[_0xec41('0x3d')]);var _0x465601={'where':_0x2b0c19['where']};return db[_0xec41('0x27')][_0xec41('0x1c')](_0x465601)[_0xec41('0x24')](function(_0x494cbb){_0x456aa0[_0xec41('0x1c')]=_0x494cbb;if(_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3e')]){_0x2b0c19[_0xec41('0x3f')]=[{'all':!![]}];}return db[_0xec41('0x27')]['findAll'](_0x2b0c19);})[_0xec41('0x24')](function(_0x523d1d){_0x456aa0['rows']=_0x523d1d;return _0x456aa0;})['then'](respondWithFilteredResult(_0x33e778,_0x2b0c19))[_0xec41('0x40')](handleError(_0x33e778,null));};exports['show']=function(_0x5d6702,_0x11274f){var _0x5cc51b={'raw':!![],'where':{'id':_0x5d6702[_0xec41('0x41')]['id']}},_0x1cfaef={};_0x1cfaef[_0xec41('0x32')]=_[_0xec41('0x2e')](db[_0xec41('0x27')][_0xec41('0x28')]);_0x1cfaef['query']=_['keys'](_0x5d6702[_0xec41('0x2d')]);_0x1cfaef[_0xec41('0x2f')]=_[_0xec41('0x30')](_0x1cfaef[_0xec41('0x32')],_0x1cfaef[_0xec41('0x2d')]);_0x5cc51b[_0xec41('0x31')]=_[_0xec41('0x30')](_0x1cfaef[_0xec41('0x32')],qs['fields'](_0x5d6702[_0xec41('0x2d')]['fields']));_0x5cc51b['attributes']=_0x5cc51b[_0xec41('0x31')]['length']?_0x5cc51b[_0xec41('0x31')]:_0x1cfaef['model'];if(_0x5d6702[_0xec41('0x2d')][_0xec41('0x3e')]){_0x5cc51b['include']=[{'all':!![]}];}_0x5cc51b=_[_0xec41('0x3b')]({},_0x5cc51b,_0x5d6702[_0xec41('0x3d')]);return db[_0xec41('0x27')]['find'](_0x5cc51b)[_0xec41('0x24')](handleEntityNotFound(_0x11274f,null))[_0xec41('0x24')](respondWithResult(_0x11274f,null))[_0xec41('0x40')](handleError(_0x11274f,null));};exports[_0xec41('0x22')]=function(_0x4bea22,_0x195821){if(_0x4bea22[_0xec41('0x42')]['id']){delete _0x4bea22['body']['id'];}return db[_0xec41('0x27')][_0xec41('0x43')]({'where':{'id':_0x4bea22['params']['id']}})[_0xec41('0x24')](handleEntityNotFound(_0x195821,null))[_0xec41('0x24')](saveUpdates(_0x4bea22[_0xec41('0x42')],null))[_0xec41('0x24')](respondWithResult(_0x195821,null))[_0xec41('0x40')](handleError(_0x195821,null));};exports[_0xec41('0x23')]=function(_0x442901,_0x5b2b13){return db['CmHopperBlack']['find']({'where':{'id':_0x442901[_0xec41('0x41')]['id']}})[_0xec41('0x24')](handleEntityNotFound(_0x5b2b13,null))['then'](removeEntity(_0x5b2b13,null))['catch'](handleError(_0x5b2b13,null));};exports['describe']=function(_0x4589da,_0xd646d9){return db[_0xec41('0x27')][_0xec41('0x44')]()[_0xec41('0x24')](respondWithResult(_0xd646d9,null))[_0xec41('0x40')](handleError(_0xd646d9,null));}; \ No newline at end of file +var _0xc833=['index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','params','length','find','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc833,0xfd));var _0x3c83=function(_0x3032bf,_0x26ed48){_0x3032bf=_0x3032bf-0x0;var _0x22f47c=_0xc833[_0x3032bf];return _0x22f47c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c83('0x0'));var zipdir=require(_0x3c83('0x1'));var jsonpatch=require(_0x3c83('0x2'));var rp=require(_0x3c83('0x3'));var moment=require(_0x3c83('0x4'));var BPromise=require(_0x3c83('0x5'));var Mustache=require('mustache');var util=require(_0x3c83('0x6'));var path=require('path');var sox=require(_0x3c83('0x7'));var csv=require('to-csv');var ejs=require(_0x3c83('0x8'));var fs=require('fs');var fs_extra=require(_0x3c83('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c83('0xa'));var jsforce=require(_0x3c83('0xb'));var deskjs=require(_0x3c83('0xc'));var toCsv=require(_0x3c83('0xd'));var querystring=require(_0x3c83('0xe'));var Papa=require(_0x3c83('0xf'));var Redis=require(_0x3c83('0x10'));var authService=require(_0x3c83('0x11'));var qs=require(_0x3c83('0x12'));var as=require(_0x3c83('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c83('0x14'))(_0x3c83('0x15'));var utils=require(_0x3c83('0x16'));var config=require(_0x3c83('0x17'));var licenseUtil=require(_0x3c83('0x18'));var db=require(_0x3c83('0x19'))['db'];function respondWithStatusCode(_0x521055,_0x323569){_0x323569=_0x323569||0xcc;return function(_0x48b645){if(_0x48b645){return _0x521055['sendStatus'](_0x323569);}return _0x521055[_0x3c83('0x1a')](_0x323569)[_0x3c83('0x1b')]();};}function respondWithResult(_0x1de23c,_0xbfdaf5){_0xbfdaf5=_0xbfdaf5||0xc8;return function(_0x2b4ebd){if(_0x2b4ebd){return _0x1de23c[_0x3c83('0x1a')](_0xbfdaf5)[_0x3c83('0x1c')](_0x2b4ebd);}};}function respondWithFilteredResult(_0x8cf1,_0x16e08b){return function(_0x540cdd){if(_0x540cdd){var _0x4cd4f2=typeof _0x16e08b[_0x3c83('0x1d')]===_0x3c83('0x1e')&&typeof _0x16e08b[_0x3c83('0x1f')]===_0x3c83('0x1e');var _0x51722b=_0x540cdd[_0x3c83('0x20')];var _0x5f3d0a=_0x4cd4f2?0x0:_0x16e08b['offset'];var _0x30804a=_0x4cd4f2?_0x540cdd[_0x3c83('0x20')]:_0x16e08b[_0x3c83('0x1d')]+_0x16e08b[_0x3c83('0x1f')];var _0xa38ef8;if(_0x30804a>=_0x51722b){_0x30804a=_0x51722b;_0xa38ef8=0xc8;}else{_0xa38ef8=0xce;}_0x8cf1[_0x3c83('0x1a')](_0xa38ef8);return _0x8cf1['set'](_0x3c83('0x21'),_0x5f3d0a+'-'+_0x30804a+'/'+_0x51722b)['json'](_0x540cdd);}return null;};}function patchUpdates(_0x5eb498){return function(_0x5d37f8){try{jsonpatch['apply'](_0x5d37f8,_0x5eb498,!![]);}catch(_0x291c41){return BPromise[_0x3c83('0x22')](_0x291c41);}return _0x5d37f8[_0x3c83('0x23')]();};}function saveUpdates(_0x1284c2,_0x3379f1){return function(_0x7b7163){if(_0x7b7163){return _0x7b7163[_0x3c83('0x24')](_0x1284c2)['then'](function(_0x311562){return _0x311562;});}return null;};}function removeEntity(_0x31a938,_0x5e2eeb){return function(_0x4448f2){if(_0x4448f2){return _0x4448f2[_0x3c83('0x25')]()[_0x3c83('0x26')](function(){_0x31a938[_0x3c83('0x1a')](0xcc)[_0x3c83('0x1b')]();});}};}function handleEntityNotFound(_0x2bee89,_0xed9592){return function(_0x424004){if(!_0x424004){_0x2bee89['sendStatus'](0x194);}return _0x424004;};}function handleError(_0x30b17c,_0x2c74af){_0x2c74af=_0x2c74af||0x1f4;return function(_0x2ef7de){logger[_0x3c83('0x27')](_0x2ef7de[_0x3c83('0x28')]);if(_0x2ef7de[_0x3c83('0x29')]){delete _0x2ef7de['name'];}_0x30b17c[_0x3c83('0x1a')](_0x2c74af)[_0x3c83('0x2a')](_0x2ef7de);};}exports[_0x3c83('0x2b')]=function(_0x20316d,_0x57a4da){var _0x3d6e14={},_0x3f6c02={},_0x21e286={'count':0x0,'rows':[]};var _0x21ad93=_[_0x3c83('0x2c')](db['CmHopperBlack'][_0x3c83('0x2d')],function(_0x5de483){return{'name':_0x5de483[_0x3c83('0x2e')],'type':_0x5de483[_0x3c83('0x2f')]['key']};});_0x3f6c02[_0x3c83('0x30')]=_['map'](_0x21ad93,_0x3c83('0x29'));_0x3f6c02[_0x3c83('0x31')]=_[_0x3c83('0x32')](_0x20316d[_0x3c83('0x31')]);_0x3f6c02['filters']=_[_0x3c83('0x33')](_0x3f6c02[_0x3c83('0x30')],_0x3f6c02[_0x3c83('0x31')]);_0x3d6e14[_0x3c83('0x34')]=_['intersection'](_0x3f6c02['model'],qs[_0x3c83('0x35')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x35')]));_0x3d6e14[_0x3c83('0x34')]=_0x3d6e14['attributes']['length']?_0x3d6e14[_0x3c83('0x34')]:_0x3f6c02[_0x3c83('0x30')];if(!_0x20316d[_0x3c83('0x31')][_0x3c83('0x36')](_0x3c83('0x37'))){_0x3d6e14['limit']=qs[_0x3c83('0x1f')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x1f')]);_0x3d6e14[_0x3c83('0x1d')]=qs[_0x3c83('0x1d')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x1d')]);}_0x3d6e14['order']=qs[_0x3c83('0x38')](_0x20316d[_0x3c83('0x31')][_0x3c83('0x38')]);_0x3d6e14[_0x3c83('0x39')]=qs[_0x3c83('0x3a')](_[_0x3c83('0x3b')](_0x20316d[_0x3c83('0x31')],_0x3f6c02[_0x3c83('0x3a')]),_0x21ad93);if(_0x20316d['query'][_0x3c83('0x3c')]){_0x3d6e14[_0x3c83('0x39')]=_[_0x3c83('0x3d')](_0x3d6e14[_0x3c83('0x39')],{'$or':_['map'](_0x21ad93,function(_0x54c91d){if(_0x54c91d[_0x3c83('0x2f')]!==_0x3c83('0x3e')){var _0x3a8468={};_0x3a8468[_0x54c91d[_0x3c83('0x29')]]={'$like':'%'+_0x20316d[_0x3c83('0x31')][_0x3c83('0x3c')]+'%'};return _0x3a8468;}})});}_0x3d6e14=_[_0x3c83('0x3d')]({},_0x3d6e14,_0x20316d[_0x3c83('0x3f')]);var _0x389fb1={'where':_0x3d6e14[_0x3c83('0x39')]};return db[_0x3c83('0x40')][_0x3c83('0x20')](_0x389fb1)[_0x3c83('0x26')](function(_0xb44bb2){_0x21e286[_0x3c83('0x20')]=_0xb44bb2;if(_0x20316d[_0x3c83('0x31')][_0x3c83('0x41')]){_0x3d6e14[_0x3c83('0x42')]=[{'all':!![]}];}return db[_0x3c83('0x40')]['findAll'](_0x3d6e14);})[_0x3c83('0x26')](function(_0x14dc95){_0x21e286[_0x3c83('0x43')]=_0x14dc95;return _0x21e286;})[_0x3c83('0x26')](respondWithFilteredResult(_0x57a4da,_0x3d6e14))['catch'](handleError(_0x57a4da,null));};exports['show']=function(_0x1769bd,_0x281b0a){var _0x4089f7={'raw':!![],'where':{'id':_0x1769bd[_0x3c83('0x44')]['id']}},_0x2b8b5c={};_0x2b8b5c[_0x3c83('0x30')]=_['keys'](db[_0x3c83('0x40')][_0x3c83('0x2d')]);_0x2b8b5c[_0x3c83('0x31')]=_[_0x3c83('0x32')](_0x1769bd[_0x3c83('0x31')]);_0x2b8b5c[_0x3c83('0x3a')]=_[_0x3c83('0x33')](_0x2b8b5c[_0x3c83('0x30')],_0x2b8b5c[_0x3c83('0x31')]);_0x4089f7[_0x3c83('0x34')]=_['intersection'](_0x2b8b5c[_0x3c83('0x30')],qs['fields'](_0x1769bd[_0x3c83('0x31')][_0x3c83('0x35')]));_0x4089f7[_0x3c83('0x34')]=_0x4089f7[_0x3c83('0x34')][_0x3c83('0x45')]?_0x4089f7['attributes']:_0x2b8b5c[_0x3c83('0x30')];if(_0x1769bd[_0x3c83('0x31')][_0x3c83('0x41')]){_0x4089f7[_0x3c83('0x42')]=[{'all':!![]}];}_0x4089f7=_[_0x3c83('0x3d')]({},_0x4089f7,_0x1769bd['options']);return db[_0x3c83('0x40')][_0x3c83('0x46')](_0x4089f7)[_0x3c83('0x26')](handleEntityNotFound(_0x281b0a,null))['then'](respondWithResult(_0x281b0a,null))[_0x3c83('0x47')](handleError(_0x281b0a,null));};exports[_0x3c83('0x24')]=function(_0x1e825c,_0x4d582f){if(_0x1e825c[_0x3c83('0x48')]['id']){delete _0x1e825c[_0x3c83('0x48')]['id'];}return db[_0x3c83('0x40')][_0x3c83('0x46')]({'where':{'id':_0x1e825c[_0x3c83('0x44')]['id']}})[_0x3c83('0x26')](handleEntityNotFound(_0x4d582f,null))[_0x3c83('0x26')](saveUpdates(_0x1e825c[_0x3c83('0x48')],null))['then'](respondWithResult(_0x4d582f,null))[_0x3c83('0x47')](handleError(_0x4d582f,null));};exports['destroy']=function(_0x7d9ea2,_0x352280){return db['CmHopperBlack'][_0x3c83('0x46')]({'where':{'id':_0x7d9ea2[_0x3c83('0x44')]['id']}})[_0x3c83('0x26')](handleEntityNotFound(_0x352280,null))[_0x3c83('0x26')](removeEntity(_0x352280,null))[_0x3c83('0x47')](handleError(_0x352280,null));};exports[_0x3c83('0x49')]=function(_0x4a1f69,_0x1b609e){return db[_0x3c83('0x40')]['describe']()[_0x3c83('0x26')](respondWithResult(_0x1b609e,null))[_0x3c83('0x47')](handleError(_0x1b609e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8e5cec5..55f3edc 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 _0x91c7=['define','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x91c7,0x184));var _0x791c=function(_0x257a0,_0x42d2b4){_0x257a0=_0x257a0-0x0;var _0x8a44ed=_0x91c7[_0x257a0];return _0x8a44ed;};'use strict';var _=require('lodash');var util=require(_0x791c('0x0'));var logger=require(_0x791c('0x1'))(_0x791c('0x2'));var moment=require(_0x791c('0x3'));var BPromise=require('bluebird');var rp=require(_0x791c('0x4'));var fs=require('fs');var path=require(_0x791c('0x5'));var rimraf=require(_0x791c('0x6'));var config=require(_0x791c('0x7'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x3478d5,_0x522aa2){return _0x3478d5[_0x791c('0x8')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c75=['util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1c75,0x128));var _0x51c7=function(_0x1c9f84,_0x12db77){_0x1c9f84=_0x1c9f84-0x0;var _0x250013=_0x1c75[_0x1c9f84];return _0x250013;};'use strict';var _=require(_0x51c7('0x0'));var util=require(_0x51c7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x51c7('0x2'));var rp=require(_0x51c7('0x3'));var fs=require('fs');var path=require(_0x51c7('0x4'));var rimraf=require(_0x51c7('0x5'));var config=require(_0x51c7('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x51c7('0x7')]=function(_0xc45ee3,_0x153fca){return _0xc45ee3[_0x51c7('0x8')](_0x51c7('0x9'),attributes,{'tableName':_0x51c7('0xa'),'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 03358c2..4fc5232 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 _0x5279=['limit','include','map','model','attributes','catch','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x5279,0x80));var _0x9527=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5279[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var moment=require(_0x9527('0x2'));var BPromise=require(_0x9527('0x3'));var rs=require(_0x9527('0x4'));var fs=require('fs');var Redis=require(_0x9527('0x5'));var db=require(_0x9527('0x6'))['db'];var utils=require(_0x9527('0x7'));var logger=require(_0x9527('0x8'))(_0x9527('0x9'));var config=require(_0x9527('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x400c3a,_0x47e69c,_0x2ee811){return new BPromise(function(_0x4608cd,_0x2e96b4){return client[_0x9527('0xc')](_0x400c3a,_0x2ee811)[_0x9527('0xd')](function(_0x19408d){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,'request\x20sent');logger[_0x9527('0xe')](_0x9527('0xf'),_0x47e69c,_0x9527('0x10'),JSON[_0x9527('0x11')](_0x19408d));if(_0x19408d[_0x9527('0x12')]){if(_0x19408d[_0x9527('0x12')][_0x9527('0x13')]===0x1f4){logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);return _0x2e96b4(_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);}logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x19408d['error']['message']);return _0x4608cd(_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);}else{logger[_0x9527('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x9527('0x10'));_0x4608cd(_0x19408d[_0x9527('0x16')][_0x9527('0x14')]);}})['catch'](function(_0x35b395){logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x35b395);_0x2e96b4(_0x35b395);});});}exports[_0x9527('0x17')]=function(_0x45ca8b){var _0x568278=this;return new Promise(function(_0x7a3882,_0x520ee5){return db[_0x9527('0x18')][_0x9527('0x19')]({'raw':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b['options'][_0x9527('0x1b')]===undefined?!![]:![]:!![],'where':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')]['where']||null:null,'attributes':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b['options']['attributes']||null:null,'limit':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1c')]||null:null,'include':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1d')]?_[_0x9527('0x1e')](_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1d')],function(_0x12bcf5){return{'model':db[_0x12bcf5[_0x9527('0x1f')]],'as':_0x12bcf5['as'],'attributes':_0x12bcf5[_0x9527('0x20')],'include':_0x12bcf5[_0x9527('0x1d')]?_['map'](_0x12bcf5['include'],function(_0x28b9fe){return{'model':db[_0x28b9fe[_0x9527('0x1f')]],'as':_0x28b9fe['as'],'attributes':_0x28b9fe[_0x9527('0x20')],'include':_0x28b9fe['include']?_[_0x9527('0x1e')](_0x28b9fe[_0x9527('0x1d')],function(_0x4fc381){return{'model':db[_0x4fc381[_0x9527('0x1f')]],'as':_0x4fc381['as'],'attributes':_0x4fc381[_0x9527('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9527('0xd')](function(_0x559c34){logger[_0x9527('0x15')]('GetCmHopperBlack',_0x45ca8b);logger[_0x9527('0xe')](_0x9527('0x17'),_0x45ca8b,JSON['stringify'](_0x559c34));_0x7a3882(_0x559c34);})[_0x9527('0x21')](function(_0x403314){logger['error']('GetCmHopperBlack',_0x403314[_0x9527('0x14')],_0x45ca8b);_0x520ee5(_0x568278['error'](0x1f4,_0x403314[_0x9527('0x14')]));});});};exports[_0x9527('0x22')]=function(_0x16bfa8){var _0x488bc3=this;return new Promise(function(_0x2c2190,_0x124295){return db[_0x9527('0x18')][_0x9527('0x23')](_0x16bfa8['body'],{'raw':_0x16bfa8['options']?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x24')]||null:null,'attributes':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x20')]||null:null,'limit':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')]['limit']||null:null})[_0x9527('0xd')](function(_0x2fe9c0){logger[_0x9527('0x15')](_0x9527('0x22'),_0x16bfa8);logger[_0x9527('0xe')](_0x9527('0x22'),_0x16bfa8,JSON[_0x9527('0x11')](_0x2fe9c0));_0x2c2190(_0x2fe9c0);})[_0x9527('0x21')](function(_0x4e79){logger[_0x9527('0x12')]('UpdateCmHopperBlack',_0x4e79['message'],_0x16bfa8);_0x124295(_0x488bc3['error'](0x1f4,_0x4e79['message']));});});};exports[_0x9527('0x25')]=function(_0x4128ee){var _0x4adeb8=this;return new Promise(function(_0x4eff49,_0x23c747){return db['CmHopperBlack'][_0x9527('0x26')]({'where':_0x4128ee[_0x9527('0x1a')]?_0x4128ee[_0x9527('0x1a')]['where']||null:null})[_0x9527('0xd')](function(_0x2e93fa){logger[_0x9527('0x15')](_0x9527('0x25'),_0x4128ee);logger['debug'](_0x9527('0x25'),_0x4128ee,JSON[_0x9527('0x11')](_0x2e93fa));_0x4eff49(_0x2e93fa);})[_0x9527('0x21')](function(_0x5717ba){logger[_0x9527('0x12')](_0x9527('0x25'),_0x5717ba[_0x9527('0x14')],_0x4128ee);_0x23c747(_0x4adeb8[_0x9527('0x12')](0x1f4,_0x5717ba['message']));});});}; \ No newline at end of file +var _0x5be7=['../../config/utils','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','stringify','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40a121,_0x4d5484){var _0x10ff90=function(_0x34a092){while(--_0x34a092){_0x40a121['push'](_0x40a121['shift']());}};_0x10ff90(++_0x4d5484);}(_0x5be7,0x67));var _0x75be=function(_0x51bad5,_0x3d1443){_0x51bad5=_0x51bad5-0x0;var _0x5a0e3f=_0x5be7[_0x51bad5];return _0x5a0e3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x75be('0x0'));var BPromise=require(_0x75be('0x1'));var rs=require(_0x75be('0x2'));var fs=require('fs');var Redis=require(_0x75be('0x3'));var db=require(_0x75be('0x4'))['db'];var utils=require(_0x75be('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x75be('0x6'));var client=jayson[_0x75be('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ec45a,_0x50d1b2,_0x5d1e40){return new BPromise(function(_0x3ab171,_0x1808c7){return client[_0x75be('0x8')](_0x1ec45a,_0x5d1e40)[_0x75be('0x9')](function(_0x232d92){logger[_0x75be('0xa')](_0x75be('0xb'),_0x50d1b2,_0x75be('0xc'));logger[_0x75be('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x50d1b2,_0x75be('0xc'),JSON['stringify'](_0x232d92));if(_0x232d92['error']){if(_0x232d92[_0x75be('0xe')][_0x75be('0xf')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x50d1b2,_0x232d92[_0x75be('0xe')][_0x75be('0x10')]);return _0x1808c7(_0x232d92[_0x75be('0xe')][_0x75be('0x10')]);}logger[_0x75be('0xe')](_0x75be('0xb'),_0x50d1b2,_0x232d92['error'][_0x75be('0x10')]);return _0x3ab171(_0x232d92['error']['message']);}else{logger[_0x75be('0xa')](_0x75be('0xb'),_0x50d1b2,_0x75be('0xc'));_0x3ab171(_0x232d92[_0x75be('0x11')]['message']);}})[_0x75be('0x12')](function(_0x36e852){logger[_0x75be('0xe')](_0x75be('0xb'),_0x50d1b2,_0x36e852);_0x1808c7(_0x36e852);});});}exports[_0x75be('0x13')]=function(_0x58855f){var _0x3b2dff=this;return new Promise(function(_0x625948,_0x16de49){return db['CmHopperBlack'][_0x75be('0x14')]({'raw':_0x58855f['options']?_0x58855f[_0x75be('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x58855f['options']?_0x58855f[_0x75be('0x15')][_0x75be('0x16')]||null:null,'attributes':_0x58855f['options']?_0x58855f[_0x75be('0x15')][_0x75be('0x17')]||null:null,'limit':_0x58855f[_0x75be('0x15')]?_0x58855f[_0x75be('0x15')][_0x75be('0x18')]||null:null,'include':_0x58855f[_0x75be('0x15')]?_0x58855f[_0x75be('0x15')][_0x75be('0x19')]?_[_0x75be('0x1a')](_0x58855f[_0x75be('0x15')][_0x75be('0x19')],function(_0x243d68){return{'model':db[_0x243d68[_0x75be('0x1b')]],'as':_0x243d68['as'],'attributes':_0x243d68[_0x75be('0x17')],'include':_0x243d68[_0x75be('0x19')]?_[_0x75be('0x1a')](_0x243d68[_0x75be('0x19')],function(_0x5c782e){return{'model':db[_0x5c782e[_0x75be('0x1b')]],'as':_0x5c782e['as'],'attributes':_0x5c782e[_0x75be('0x17')],'include':_0x5c782e[_0x75be('0x19')]?_['map'](_0x5c782e['include'],function(_0x41b258){return{'model':db[_0x41b258[_0x75be('0x1b')]],'as':_0x41b258['as'],'attributes':_0x41b258[_0x75be('0x17')]};}):[]};}):[]};}):[]:[]})[_0x75be('0x9')](function(_0x55a3a8){logger[_0x75be('0xa')](_0x75be('0x13'),_0x58855f);logger[_0x75be('0xd')](_0x75be('0x13'),_0x58855f,JSON['stringify'](_0x55a3a8));_0x625948(_0x55a3a8);})[_0x75be('0x12')](function(_0xc79d54){logger[_0x75be('0xe')](_0x75be('0x13'),_0xc79d54[_0x75be('0x10')],_0x58855f);_0x16de49(_0x3b2dff[_0x75be('0xe')](0x1f4,_0xc79d54[_0x75be('0x10')]));});});};exports[_0x75be('0x1c')]=function(_0x59374c){var _0x513fd7=this;return new Promise(function(_0x9224b8,_0x43cfaf){return db[_0x75be('0x1d')][_0x75be('0x1e')](_0x59374c[_0x75be('0x1f')],{'raw':_0x59374c['options']?_0x59374c[_0x75be('0x15')][_0x75be('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59374c[_0x75be('0x15')]?_0x59374c[_0x75be('0x15')]['where']||null:null,'attributes':_0x59374c[_0x75be('0x15')]?_0x59374c[_0x75be('0x15')][_0x75be('0x17')]||null:null,'limit':_0x59374c[_0x75be('0x15')]?_0x59374c[_0x75be('0x15')][_0x75be('0x18')]||null:null})['then'](function(_0x327273){logger[_0x75be('0xa')](_0x75be('0x1c'),_0x59374c);logger[_0x75be('0xd')](_0x75be('0x1c'),_0x59374c,JSON[_0x75be('0x21')](_0x327273));_0x9224b8(_0x327273);})[_0x75be('0x12')](function(_0x552675){logger['error']('UpdateCmHopperBlack',_0x552675[_0x75be('0x10')],_0x59374c);_0x43cfaf(_0x513fd7[_0x75be('0xe')](0x1f4,_0x552675[_0x75be('0x10')]));});});};exports[_0x75be('0x22')]=function(_0x3ecd46){var _0x203a6a=this;return new Promise(function(_0x3e0d08,_0x5c2845){return db[_0x75be('0x1d')][_0x75be('0x23')]({'where':_0x3ecd46['options']?_0x3ecd46[_0x75be('0x15')]['where']||null:null})[_0x75be('0x9')](function(_0x3e38a8){logger[_0x75be('0xa')](_0x75be('0x22'),_0x3ecd46);logger[_0x75be('0xd')](_0x75be('0x22'),_0x3ecd46,JSON['stringify'](_0x3e38a8));_0x3e0d08(_0x3e38a8);})['catch'](function(_0x4ca2d7){logger[_0x75be('0xe')](_0x75be('0x22'),_0x4ca2d7[_0x75be('0x10')],_0x3ecd46);_0x5c2845(_0x203a6a[_0x75be('0xe')](0x1f4,_0x4ca2d7[_0x75be('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 055ab80..beb6e46 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 _0xdf55=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x242300,_0x3314f3){var _0x4d3198=function(_0x4f0495){while(--_0x4f0495){_0x242300['push'](_0x242300['shift']());}};_0x4d3198(++_0x3314f3);}(_0xdf55,0x83));var _0x5df5=function(_0x5bc4e2,_0x427ff9){_0x5bc4e2=_0x5bc4e2-0x0;var _0x4c93f9=_0xdf55[_0x5bc4e2];return _0x4c93f9;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['put']('/:id',auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0xf')](_0x5df5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('0x10')]=router; \ No newline at end of file +var _0x0f4d=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3b3294,_0x579a24){var _0x3498bd=function(_0x4b4ccc){while(--_0x4b4ccc){_0x3b3294['push'](_0x3b3294['shift']());}};_0x3498bd(++_0x579a24);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x489395,_0x39ec7e){_0x489395=_0x489395-0x0;var _0x8239b9=_0x0f4d[_0x489395];return _0x8239b9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['put'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['delete']('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);module[_0xd0f4('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 72bd7db..5978491 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 _0x8388=['getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x47c6b9,_0x210b3c){var _0x34f34d=function(_0x47c336){while(--_0x47c336){_0x47c6b9['push'](_0x47c6b9['shift']());}};_0x34f34d(++_0x210b3c);}(_0x8388,0xea));var _0x8838=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x8388[_0x4ed32d];return _0xf624df;};'use strict';var Sequelize=require(_0x8838('0x0'));var moment=require(_0x8838('0x1'));module[_0x8838('0x2')]={'state':{'type':Sequelize[_0x8838('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8838('0x4')]},'scheduledat':{'type':Sequelize[_0x8838('0x5')]},'countbusyretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8838('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8838('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8838('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8838('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8838('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8838('0x5')]},'endtime':{'type':Sequelize[_0x8838('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8838('0x4')]},'campaigntype':{'type':Sequelize[_0x8838('0x4')]},'membername':{'type':Sequelize[_0x8838('0x4')]},'reason':{'type':Sequelize[_0x8838('0x4')]},'disposition':{'type':Sequelize[_0x8838('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8838('0x4')]},'dispositionat':{'type':Sequelize[_0x8838('0x5')],'set':function(_0x1ee47f){var _0x3e7e78=this[_0x8838('0x6')](_0x8838('0x7'));if(_0x3e7e78&&_0x1ee47f){this['setDataValue'](_0x8838('0x8'),moment(_0x1ee47f)[_0x8838('0x9')](moment(_0x3e7e78),_0x8838('0xa')));}}},'amd':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8838('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8838('0x5')]},'deleted':{'type':Sequelize[_0x8838('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8838('0x5')]},'recallme':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8838('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x860f=['INTEGER','STRING','DATE','endtime','followuptime','diff','BOOLEAN','sequelize','moment','exports'];(function(_0x164dd3,_0xf6e7b4){var _0x21d35a=function(_0x279c53){while(--_0x279c53){_0x164dd3['push'](_0x164dd3['shift']());}};_0x21d35a(++_0xf6e7b4);}(_0x860f,0x1dd));var _0xf860=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x860f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xf860('0x0'));var moment=require(_0xf860('0x1'));module[_0xf860('0x2')]={'state':{'type':Sequelize[_0xf860('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xf860('0x4')]},'scheduledat':{'type':Sequelize[_0xf860('0x5')]},'countbusyretry':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf860('0x4')]},'originatecalleridname':{'type':Sequelize[_0xf860('0x4')]},'calleridnum':{'type':Sequelize[_0xf860('0x4')]},'calleridname':{'type':Sequelize[_0xf860('0x4')]},'starttime':{'type':Sequelize[_0xf860('0x5')]},'responsetime':{'type':Sequelize[_0xf860('0x5')]},'answertime':{'type':Sequelize[_0xf860('0x5')]},'droptime':{'type':Sequelize[_0xf860('0x5')]},'endtime':{'type':Sequelize[_0xf860('0x5')]},'ringtime':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf860('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf860('0x4')]},'membername':{'type':Sequelize[_0xf860('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf860('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf860('0x4')]},'dispositionat':{'type':Sequelize[_0xf860('0x5')],'set':function(_0x591e60){var _0x48c194=this['getDataValue'](_0xf860('0x6'));if(_0x48c194&&_0x591e60){this['setDataValue'](_0xf860('0x7'),moment(_0x591e60)[_0xf860('0x8')](moment(_0x48c194),'seconds'));}}},'amd':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf860('0x5')]},'callback':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf860('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf860('0x5')]},'deleted':{'type':Sequelize[_0xf860('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf860('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf860('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf860('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 7e0d7b0..012410e 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 _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x90b1,0x1bb));var _0x190b=function(_0x4f5ef9,_0x2eaea0){_0x4f5ef9=_0x4f5ef9-0x0;var _0x4e43c1=_0x90b1[_0x4f5ef9];return _0x4e43c1;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file +var _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x6ed917,_0x5f2cba){var _0x5a8e26=function(_0x5dd1d8){while(--_0x5dd1d8){_0x6ed917['push'](_0x6ed917['shift']());}};_0x5a8e26(++_0x5f2cba);}(_0x5496,0x175));var _0x6549=function(_0x19a210,_0x398375){_0x19a210=_0x19a210-0x0;var _0x345ca6=_0x5496[_0x19a210];return _0x345ca6;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 09f56ef..81cc4f4 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 _0x8751=['CmHopperFinal','cm_hopper_final','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0xc81d38,_0xe1a6b6){var _0x46a243=function(_0x1f52b3){while(--_0x1f52b3){_0xc81d38['push'](_0xc81d38['shift']());}};_0x46a243(++_0xe1a6b6);}(_0x8751,0x15f));var _0x1875=function(_0x2581e8,_0xbc46d7){_0x2581e8=_0x2581e8-0x0;var _0x4f3c74=_0x8751[_0x2581e8];return _0x4f3c74;};'use strict';var _=require(_0x1875('0x0'));var util=require(_0x1875('0x1'));var logger=require(_0x1875('0x2'))(_0x1875('0x3'));var moment=require('moment');var BPromise=require(_0x1875('0x4'));var rp=require(_0x1875('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1875('0x6'));var attributes=require(_0x1875('0x7'));module['exports']=function(_0x358031,_0x5c2c2e){return _0x358031[_0x1875('0x8')](_0x1875('0x9'),attributes,{'tableName':_0x1875('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x1875('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x05e8=['rimraf','../../config/environment','CmHopperFinal','calleridnum','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x3267f0,_0x41df78){var _0x22b8a1=function(_0x88fb1a){while(--_0x88fb1a){_0x3267f0['push'](_0x3267f0['shift']());}};_0x22b8a1(++_0x41df78);}(_0x05e8,0x1d9));var _0x805e=function(_0x498653,_0x59d91f){_0x498653=_0x498653-0x0;var _0x4a7d62=_0x05e8[_0x498653];return _0x4a7d62;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x805e('0x0'))('api');var moment=require(_0x805e('0x1'));var BPromise=require(_0x805e('0x2'));var rp=require(_0x805e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x805e('0x4'));var config=require(_0x805e('0x5'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x58f255,_0x66a0e2){return _0x58f255['define'](_0x805e('0x6'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x805e('0x7'),'fields':[_0x805e('0x7')]},{'name':_0x805e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 60433e3..465b675 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(_0x4d26c9,_0x134162){var _0x1c60f2=function(_0x5b866d){while(--_0x5b866d){_0x4d26c9['push'](_0x4d26c9['shift']());}};_0x1c60f2(++_0x134162);}(_0xb10b,0x12a));var _0xbb10=function(_0x59ed12,_0xf96ab6){_0x59ed12=_0x59ed12-0x0;var _0x3b6f60=_0xb10b[_0x59ed12];return _0x3b6f60;};'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(_0x171a2a,_0x958a70){var _0x5ecb2e=function(_0x228366){while(--_0x228366){_0x171a2a['push'](_0x171a2a['shift']());}};_0x5ecb2e(++_0x958a70);}(_0x7a54,0x106));var _0x47a5=function(_0x4ef427,_0x52fb66){_0x4ef427=_0x4ef427-0x0;var _0x28d7f7=_0x7a54[_0x4ef427];return _0x28d7f7;};'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 095423b..39b1389 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 _0x542a=['show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','update','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe'];(function(_0x54e48e,_0x2c51e4){var _0x508aa4=function(_0x5aa466){while(--_0x5aa466){_0x54e48e['push'](_0x54e48e['shift']());}};_0x508aa4(++_0x2c51e4);}(_0x542a,0x71));var _0xa542=function(_0x5de0b1,_0x407bea){_0x5de0b1=_0x5de0b1-0x0;var _0x1f7498=_0x542a[_0x5de0b1];return _0x1f7498;};'use strict';var multer=require(_0xa542('0x0'));var util=require(_0xa542('0x1'));var path=require(_0xa542('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa542('0x3')]();var fs_extra=require(_0xa542('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa542('0x5'));var config=require(_0xa542('0x6'));var controller=require(_0xa542('0x7'));router[_0xa542('0x8')]('/',auth[_0xa542('0x9')](),controller['index']);router[_0xa542('0x8')](_0xa542('0xa'),auth[_0xa542('0x9')](),controller[_0xa542('0xb')]);router[_0xa542('0x8')]('/:id',auth[_0xa542('0x9')](),controller[_0xa542('0xc')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xa542('0x9')](),controller[_0xa542('0xd')]);router[_0xa542('0x8')](_0xa542('0xe'),auth[_0xa542('0x9')](),controller[_0xa542('0xf')]);router[_0xa542('0x10')](_0xa542('0x11'),auth[_0xa542('0x9')](),controller[_0xa542('0x12')]);router[_0xa542('0x10')](_0xa542('0x13'),auth[_0xa542('0x9')](),controller[_0xa542('0x14')]);router[_0xa542('0x10')](_0xa542('0x15'),auth['isAuthenticated'](),controller[_0xa542('0x16')]);router['put'](_0xa542('0x17'),auth['isAuthenticated'](),controller[_0xa542('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb072=['/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put'];(function(_0x30f210,_0x12bac5){var _0x29fcbf=function(_0x24a55d){while(--_0x24a55d){_0x30f210['push'](_0x30f210['shift']());}};_0x29fcbf(++_0x12bac5);}(_0xb072,0x1a7));var _0x2b07=function(_0x200db9,_0x46f289){_0x200db9=_0x200db9-0x0;var _0x54df43=_0xb072[_0x200db9];return _0x54df43;};'use strict';var multer=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var path=require('path');var timeout=require(_0x2b07('0x2'));var express=require(_0x2b07('0x3'));var router=express[_0x2b07('0x4')]();var fs_extra=require(_0x2b07('0x5'));var auth=require(_0x2b07('0x6'));var interaction=require(_0x2b07('0x7'));var config=require(_0x2b07('0x8'));var controller=require(_0x2b07('0x9'));router[_0x2b07('0xa')]('/',auth[_0x2b07('0xb')](),controller['index']);router[_0x2b07('0xa')](_0x2b07('0xc'),auth['isAuthenticated'](),controller[_0x2b07('0xd')]);router[_0x2b07('0xa')]('/:id',auth[_0x2b07('0xb')](),controller[_0x2b07('0xe')]);router[_0x2b07('0xa')](_0x2b07('0xf'),auth[_0x2b07('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x2b07('0x10'),auth[_0x2b07('0xb')](),controller[_0x2b07('0x11')]);router['post'](_0x2b07('0x12'),auth['isAuthenticated'](),controller[_0x2b07('0x13')]);router[_0x2b07('0x14')](_0x2b07('0x15'),auth[_0x2b07('0xb')](),controller[_0x2b07('0x16')]);router['post']('/checkContactHopper',auth[_0x2b07('0xb')](),controller[_0x2b07('0x17')]);router[_0x2b07('0x18')](_0x2b07('0x19'),auth[_0x2b07('0xb')](),controller[_0x2b07('0x1a')]);module[_0x2b07('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7907cfa..408821e 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 _0x96dd=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x59a578,_0x300511){var _0x1475e8=function(_0x50dab3){while(--_0x50dab3){_0x59a578['push'](_0x59a578['shift']());}};_0x1475e8(++_0x300511);}(_0x96dd,0x73));var _0xd96d=function(_0x4ef1ff,_0x5090a3){_0x4ef1ff=_0x4ef1ff-0x0;var _0x3d70c1=_0x96dd[_0x4ef1ff];return _0x3d70c1;};'use strict';var Sequelize=require(_0xd96d('0x0'));module[_0xd96d('0x1')]={'state':{'type':Sequelize[_0xd96d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd96d('0x3')]},'scheduledat':{'type':Sequelize[_0xd96d('0x4')]},'countbusyretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd96d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd96d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd96d('0x3')]},'calleridnum':{'type':Sequelize[_0xd96d('0x3')]},'calleridname':{'type':Sequelize[_0xd96d('0x3')]},'starttime':{'type':Sequelize[_0xd96d('0x4')]},'responsetime':{'type':Sequelize[_0xd96d('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd96d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd96d('0x3')]},'campaign':{'type':Sequelize[_0xd96d('0x3')]},'campaigntype':{'type':Sequelize[_0xd96d('0x3')]},'membername':{'type':Sequelize[_0xd96d('0x3')]},'reason':{'type':Sequelize[_0xd96d('0x3')]},'amd':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd96d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd96d('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd96d('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd96d('0x3')]}}; \ No newline at end of file +var _0x322b=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x3d9a1f,_0x4cf787){var _0x358820=function(_0x219ca1){while(--_0x219ca1){_0x3d9a1f['push'](_0x3d9a1f['shift']());}};_0x358820(++_0x4cf787);}(_0x322b,0x106));var _0xb322=function(_0x243921,_0x3eb2fd){_0x243921=_0x243921-0x0;var _0x1021be=_0x322b[_0x243921];return _0x1021be;};'use strict';var Sequelize=require(_0xb322('0x0'));module['exports']={'state':{'type':Sequelize[_0xb322('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb322('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb322('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb322('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb322('0x2')]},'calleridname':{'type':Sequelize[_0xb322('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb322('0x3')]},'answertime':{'type':Sequelize[_0xb322('0x3')]},'droptime':{'type':Sequelize[_0xb322('0x3')]},'endtime':{'type':Sequelize[_0xb322('0x3')]},'ringtime':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb322('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb322('0x2')]},'membername':{'type':Sequelize[_0xb322('0x2')]},'reason':{'type':Sequelize[_0xb322('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb322('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb322('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb322('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb322('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb322('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 762b40b..da3d0d4 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 _0xfdff=['find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','save','update','then','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','length','options'];(function(_0x2844ae,_0x321476){var _0x3e157f=function(_0x32ed05){while(--_0x32ed05){_0x2844ae['push'](_0x2844ae['shift']());}};_0x3e157f(++_0x321476);}(_0xfdff,0x10d));var _0xffdf=function(_0x549451,_0x2eaf21){_0x549451=_0x549451-0x0;var _0x1b87ef=_0xfdff[_0x549451];return _0x1b87ef;};'use strict';var emlformat=require(_0xffdf('0x0'));var rimraf=require(_0xffdf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffdf('0x2'));var moment=require(_0xffdf('0x3'));var BPromise=require(_0xffdf('0x4'));var Mustache=require('mustache');var util=require(_0xffdf('0x5'));var path=require('path');var sox=require(_0xffdf('0x6'));var csv=require(_0xffdf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffdf('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xffdf('0x9'));var jsforce=require(_0xffdf('0xa'));var deskjs=require(_0xffdf('0xb'));var toCsv=require(_0xffdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xffdf('0xc'));var authService=require(_0xffdf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffdf('0xe'));var logger=require(_0xffdf('0xf'))('api');var utils=require(_0xffdf('0x10'));var config=require(_0xffdf('0x11'));var licenseUtil=require(_0xffdf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f26a,_0x1fb719){_0x1fb719=_0x1fb719||0xcc;return function(_0x10cd11){if(_0x10cd11){return _0x43f26a[_0xffdf('0x13')](_0x1fb719);}return _0x43f26a['status'](_0x1fb719)[_0xffdf('0x14')]();};}function respondWithResult(_0x516768,_0x211c9c){_0x211c9c=_0x211c9c||0xc8;return function(_0x62db7f){if(_0x62db7f){return _0x516768[_0xffdf('0x15')](_0x211c9c)[_0xffdf('0x16')](_0x62db7f);}};}function respondWithFilteredResult(_0x3e5973,_0x51cfe7){return function(_0x2b689a){if(_0x2b689a){var _0x3d7389=typeof _0x51cfe7['offset']===_0xffdf('0x17')&&typeof _0x51cfe7[_0xffdf('0x18')]===_0xffdf('0x17');var _0x4c4838=_0x2b689a[_0xffdf('0x19')];var _0x50aa26=_0x3d7389?0x0:_0x51cfe7[_0xffdf('0x1a')];var _0x40205d=_0x3d7389?_0x2b689a[_0xffdf('0x19')]:_0x51cfe7[_0xffdf('0x1a')]+_0x51cfe7['limit'];var _0x471391;if(_0x40205d>=_0x4c4838){_0x40205d=_0x4c4838;_0x471391=0xc8;}else{_0x471391=0xce;}_0x3e5973[_0xffdf('0x15')](_0x471391);return _0x3e5973[_0xffdf('0x1b')]('Content-Range',_0x50aa26+'-'+_0x40205d+'/'+_0x4c4838)[_0xffdf('0x16')](_0x2b689a);}return null;};}function patchUpdates(_0x31b064){return function(_0x5b340c){try{jsonpatch['apply'](_0x5b340c,_0x31b064,!![]);}catch(_0x2eb44d){return BPromise['reject'](_0x2eb44d);}return _0x5b340c[_0xffdf('0x1c')]();};}function saveUpdates(_0x20dab7,_0x309c4f){return function(_0x3e209f){if(_0x3e209f){return _0x3e209f[_0xffdf('0x1d')](_0x20dab7)[_0xffdf('0x1e')](function(_0x3bb785){return _0x3bb785;});}return null;};}function removeEntity(_0x38b7cc,_0x256724){return function(_0x95d763){if(_0x95d763){return _0x95d763['destroy']()[_0xffdf('0x1e')](function(){_0x38b7cc[_0xffdf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7f88,_0x1f4bcb){return function(_0x483db8){if(!_0x483db8){_0x1d7f88[_0xffdf('0x13')](0x194);}return _0x483db8;};}function handleError(_0x5eeb72,_0x442620){_0x442620=_0x442620||0x1f4;return function(_0x15ca51){logger['error'](_0x15ca51['stack']);if(_0x15ca51['name']){delete _0x15ca51[_0xffdf('0x1f')];}_0x5eeb72[_0xffdf('0x15')](_0x442620)['send'](_0x15ca51);};}exports[_0xffdf('0x20')]=function(_0x2d8b41,_0x484443){var _0x19b3ea={},_0x5963a9={},_0x34fc24={'count':0x0,'rows':[]};var _0x554200=_[_0xffdf('0x21')](db[_0xffdf('0x22')][_0xffdf('0x23')],function(_0x267e6b){return{'name':_0x267e6b[_0xffdf('0x24')],'type':_0x267e6b[_0xffdf('0x25')]['key']};});_0x5963a9[_0xffdf('0x26')]=_[_0xffdf('0x21')](_0x554200,_0xffdf('0x1f'));_0x5963a9[_0xffdf('0x27')]=_[_0xffdf('0x28')](_0x2d8b41[_0xffdf('0x27')]);_0x5963a9['filters']=_[_0xffdf('0x29')](_0x5963a9[_0xffdf('0x26')],_0x5963a9['query']);_0x19b3ea[_0xffdf('0x2a')]=_[_0xffdf('0x29')](_0x5963a9[_0xffdf('0x26')],qs[_0xffdf('0x2b')](_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x2b')]));_0x19b3ea[_0xffdf('0x2a')]=_0x19b3ea[_0xffdf('0x2a')]['length']?_0x19b3ea[_0xffdf('0x2a')]:_0x5963a9[_0xffdf('0x26')];if(!_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x2c')]('nolimit')){_0x19b3ea[_0xffdf('0x18')]=qs[_0xffdf('0x18')](_0x2d8b41[_0xffdf('0x27')]['limit']);_0x19b3ea[_0xffdf('0x1a')]=qs[_0xffdf('0x1a')](_0x2d8b41['query'][_0xffdf('0x1a')]);}_0x19b3ea[_0xffdf('0x2d')]=qs[_0xffdf('0x2e')](_0x2d8b41['query'][_0xffdf('0x2e')]);_0x19b3ea[_0xffdf('0x2f')]=qs[_0xffdf('0x30')](_[_0xffdf('0x31')](_0x2d8b41[_0xffdf('0x27')],_0x5963a9[_0xffdf('0x30')]),_0x554200);if(_0x2d8b41[_0xffdf('0x27')]['filter']){_0x19b3ea[_0xffdf('0x2f')]=_[_0xffdf('0x32')](_0x19b3ea[_0xffdf('0x2f')],{'$or':_['map'](_0x554200,function(_0x1e3320){if(_0x1e3320[_0xffdf('0x25')]!==_0xffdf('0x33')){var _0x50d485={};_0x50d485[_0x1e3320[_0xffdf('0x1f')]]={'$like':'%'+_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x34')]+'%'};return _0x50d485;}})});}_0x19b3ea=_[_0xffdf('0x32')]({},_0x19b3ea,_0x2d8b41['options']);var _0x37e914={'where':_0x19b3ea[_0xffdf('0x2f')]};return db['CmHopperHistory']['count'](_0x37e914)[_0xffdf('0x1e')](function(_0x4d71da){_0x34fc24[_0xffdf('0x19')]=_0x4d71da;if(_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x35')]){_0x19b3ea[_0xffdf('0x36')]=[{'all':!![]}];}return db[_0xffdf('0x22')][_0xffdf('0x37')](_0x19b3ea);})['then'](function(_0x32851f){_0x34fc24[_0xffdf('0x38')]=_0x32851f;return _0x34fc24;})[_0xffdf('0x1e')](respondWithFilteredResult(_0x484443,_0x19b3ea))[_0xffdf('0x39')](handleError(_0x484443,null));};exports['show']=function(_0xe8c2ad,_0x4292c5){var _0x31b379={'raw':!![],'where':{'id':_0xe8c2ad[_0xffdf('0x3a')]['id']}},_0x84fe2={};_0x84fe2[_0xffdf('0x26')]=_[_0xffdf('0x28')](db[_0xffdf('0x22')]['rawAttributes']);_0x84fe2[_0xffdf('0x27')]=_['keys'](_0xe8c2ad[_0xffdf('0x27')]);_0x84fe2[_0xffdf('0x30')]=_['intersection'](_0x84fe2[_0xffdf('0x26')],_0x84fe2['query']);_0x31b379[_0xffdf('0x2a')]=_[_0xffdf('0x29')](_0x84fe2[_0xffdf('0x26')],qs['fields'](_0xe8c2ad[_0xffdf('0x27')]['fields']));_0x31b379[_0xffdf('0x2a')]=_0x31b379[_0xffdf('0x2a')][_0xffdf('0x3b')]?_0x31b379[_0xffdf('0x2a')]:_0x84fe2[_0xffdf('0x26')];if(_0xe8c2ad['query'][_0xffdf('0x35')]){_0x31b379[_0xffdf('0x36')]=[{'all':!![]}];}_0x31b379=_[_0xffdf('0x32')]({},_0x31b379,_0xe8c2ad[_0xffdf('0x3c')]);return db['CmHopperHistory'][_0xffdf('0x3d')](_0x31b379)['then'](handleEntityNotFound(_0x4292c5,null))[_0xffdf('0x1e')](respondWithResult(_0x4292c5,null))['catch'](handleError(_0x4292c5,null));};exports['create']=function(_0xa4c26a,_0x4f37b0){return db['CmHopperHistory'][_0xffdf('0x3e')](_0xa4c26a[_0xffdf('0x3f')],{})[_0xffdf('0x1e')](respondWithResult(_0x4f37b0,0xc9))[_0xffdf('0x39')](handleError(_0x4f37b0,null));};exports[_0xffdf('0x40')]=function(_0x144d8f,_0x10e0de){return db[_0xffdf('0x22')]['describe']()[_0xffdf('0x1e')](respondWithResult(_0x10e0de,null))[_0xffdf('0x39')](handleError(_0x10e0de,null));};exports[_0xffdf('0x1d')]=function(_0x10d6bd,_0x5932f8){if(_0x10d6bd[_0xffdf('0x3f')][_0xffdf('0x41')]){delete _0x10d6bd['body'][_0xffdf('0x41')];}return db[_0xffdf('0x22')][_0xffdf('0x3d')]({'where':{'uniqueid':_0x10d6bd[_0xffdf('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5932f8,null))['then'](saveUpdates(_0x10d6bd[_0xffdf('0x3f')],null))['then'](respondWithResult(_0x5932f8,null))[_0xffdf('0x39')](handleError(_0x5932f8,null));}; \ No newline at end of file +var _0xf69d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','describe','body','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x463b3c,_0x5447c9){var _0x804218=function(_0xc94234){while(--_0xc94234){_0x463b3c['push'](_0x463b3c['shift']());}};_0x804218(++_0x5447c9);}(_0xf69d,0x13d));var _0xdf69=function(_0x37bf42,_0x267338){_0x37bf42=_0x37bf42-0x0;var _0x50d32e=_0xf69d[_0x37bf42];return _0x50d32e;};'use strict';var emlformat=require(_0xdf69('0x0'));var rimraf=require(_0xdf69('0x1'));var zipdir=require(_0xdf69('0x2'));var jsonpatch=require(_0xdf69('0x3'));var rp=require(_0xdf69('0x4'));var moment=require(_0xdf69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf69('0x6'));var util=require(_0xdf69('0x7'));var path=require(_0xdf69('0x8'));var sox=require(_0xdf69('0x9'));var csv=require('to-csv');var ejs=require(_0xdf69('0xa'));var fs=require('fs');var fs_extra=require(_0xdf69('0xb'));var _=require(_0xdf69('0xc'));var squel=require(_0xdf69('0xd'));var crypto=require(_0xdf69('0xe'));var jsforce=require(_0xdf69('0xf'));var deskjs=require(_0xdf69('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdf69('0x11'));var Papa=require(_0xdf69('0x12'));var Redis=require('ioredis');var authService=require(_0xdf69('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdf69('0x14'));var hardwareService=require(_0xdf69('0x15'));var logger=require(_0xdf69('0x16'))('api');var utils=require(_0xdf69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdf69('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54584e,_0x20370d){_0x20370d=_0x20370d||0xcc;return function(_0x6d40b2){if(_0x6d40b2){return _0x54584e['sendStatus'](_0x20370d);}return _0x54584e[_0xdf69('0x19')](_0x20370d)[_0xdf69('0x1a')]();};}function respondWithResult(_0xa8230,_0x34c128){_0x34c128=_0x34c128||0xc8;return function(_0x50459f){if(_0x50459f){return _0xa8230[_0xdf69('0x19')](_0x34c128)[_0xdf69('0x1b')](_0x50459f);}};}function respondWithFilteredResult(_0x402736,_0x4c4450){return function(_0x1c4efd){if(_0x1c4efd){var _0xea0b93=typeof _0x4c4450[_0xdf69('0x1c')]===_0xdf69('0x1d')&&typeof _0x4c4450[_0xdf69('0x1e')]===_0xdf69('0x1d');var _0x9cbad5=_0x1c4efd[_0xdf69('0x1f')];var _0x54446a=_0xea0b93?0x0:_0x4c4450[_0xdf69('0x1c')];var _0x476b91=_0xea0b93?_0x1c4efd[_0xdf69('0x1f')]:_0x4c4450[_0xdf69('0x1c')]+_0x4c4450[_0xdf69('0x1e')];var _0x30697d;if(_0x476b91>=_0x9cbad5){_0x476b91=_0x9cbad5;_0x30697d=0xc8;}else{_0x30697d=0xce;}_0x402736['status'](_0x30697d);return _0x402736[_0xdf69('0x20')](_0xdf69('0x21'),_0x54446a+'-'+_0x476b91+'/'+_0x9cbad5)[_0xdf69('0x1b')](_0x1c4efd);}return null;};}function patchUpdates(_0x48a53f){return function(_0xc4e2d8){try{jsonpatch[_0xdf69('0x22')](_0xc4e2d8,_0x48a53f,!![]);}catch(_0x332864){return BPromise[_0xdf69('0x23')](_0x332864);}return _0xc4e2d8[_0xdf69('0x24')]();};}function saveUpdates(_0x3b1071,_0x460988){return function(_0x1e96ca){if(_0x1e96ca){return _0x1e96ca[_0xdf69('0x25')](_0x3b1071)[_0xdf69('0x26')](function(_0x2dd639){return _0x2dd639;});}return null;};}function removeEntity(_0x4c4771,_0x4dac67){return function(_0x473ff3){if(_0x473ff3){return _0x473ff3[_0xdf69('0x27')]()[_0xdf69('0x26')](function(){_0x4c4771[_0xdf69('0x19')](0xcc)[_0xdf69('0x1a')]();});}};}function handleEntityNotFound(_0x3fd3a8,_0x339690){return function(_0x9b2c0c){if(!_0x9b2c0c){_0x3fd3a8[_0xdf69('0x28')](0x194);}return _0x9b2c0c;};}function handleError(_0xf5d471,_0x4dc8bb){_0x4dc8bb=_0x4dc8bb||0x1f4;return function(_0x495dbd){logger[_0xdf69('0x29')](_0x495dbd[_0xdf69('0x2a')]);if(_0x495dbd[_0xdf69('0x2b')]){delete _0x495dbd[_0xdf69('0x2b')];}_0xf5d471['status'](_0x4dc8bb)[_0xdf69('0x2c')](_0x495dbd);};}exports[_0xdf69('0x2d')]=function(_0x229c06,_0x524fcc){var _0x5b6e5b={},_0x1f5e29={},_0x23962b={'count':0x0,'rows':[]};var _0x156e60=_[_0xdf69('0x2e')](db[_0xdf69('0x2f')][_0xdf69('0x30')],function(_0x106ca3){return{'name':_0x106ca3[_0xdf69('0x31')],'type':_0x106ca3[_0xdf69('0x32')][_0xdf69('0x33')]};});_0x1f5e29['model']=_['map'](_0x156e60,'name');_0x1f5e29[_0xdf69('0x34')]=_[_0xdf69('0x35')](_0x229c06[_0xdf69('0x34')]);_0x1f5e29['filters']=_[_0xdf69('0x36')](_0x1f5e29[_0xdf69('0x37')],_0x1f5e29[_0xdf69('0x34')]);_0x5b6e5b[_0xdf69('0x38')]=_['intersection'](_0x1f5e29[_0xdf69('0x37')],qs[_0xdf69('0x39')](_0x229c06[_0xdf69('0x34')][_0xdf69('0x39')]));_0x5b6e5b[_0xdf69('0x38')]=_0x5b6e5b[_0xdf69('0x38')][_0xdf69('0x3a')]?_0x5b6e5b[_0xdf69('0x38')]:_0x1f5e29[_0xdf69('0x37')];if(!_0x229c06[_0xdf69('0x34')][_0xdf69('0x3b')](_0xdf69('0x3c'))){_0x5b6e5b[_0xdf69('0x1e')]=qs[_0xdf69('0x1e')](_0x229c06['query']['limit']);_0x5b6e5b[_0xdf69('0x1c')]=qs[_0xdf69('0x1c')](_0x229c06[_0xdf69('0x34')][_0xdf69('0x1c')]);}_0x5b6e5b[_0xdf69('0x3d')]=qs[_0xdf69('0x3e')](_0x229c06[_0xdf69('0x34')]['sort']);_0x5b6e5b[_0xdf69('0x3f')]=qs[_0xdf69('0x40')](_[_0xdf69('0x41')](_0x229c06[_0xdf69('0x34')],_0x1f5e29[_0xdf69('0x40')]),_0x156e60);if(_0x229c06[_0xdf69('0x34')]['filter']){_0x5b6e5b['where']=_['merge'](_0x5b6e5b['where'],{'$or':_[_0xdf69('0x2e')](_0x156e60,function(_0x3d12db){if(_0x3d12db['type']!==_0xdf69('0x42')){var _0x1eff41={};_0x1eff41[_0x3d12db[_0xdf69('0x2b')]]={'$like':'%'+_0x229c06[_0xdf69('0x34')][_0xdf69('0x43')]+'%'};return _0x1eff41;}})});}_0x5b6e5b=_[_0xdf69('0x44')]({},_0x5b6e5b,_0x229c06[_0xdf69('0x45')]);var _0x16eda6={'where':_0x5b6e5b[_0xdf69('0x3f')]};return db['CmHopperHistory'][_0xdf69('0x1f')](_0x16eda6)[_0xdf69('0x26')](function(_0x4fbe78){_0x23962b[_0xdf69('0x1f')]=_0x4fbe78;if(_0x229c06['query'][_0xdf69('0x46')]){_0x5b6e5b['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf69('0x47')](_0x5b6e5b);})['then'](function(_0x44ea1d){_0x23962b[_0xdf69('0x48')]=_0x44ea1d;return _0x23962b;})[_0xdf69('0x26')](respondWithFilteredResult(_0x524fcc,_0x5b6e5b))[_0xdf69('0x49')](handleError(_0x524fcc,null));};exports[_0xdf69('0x4a')]=function(_0x27ee71,_0x2fd085){var _0x4cb345={'raw':!![],'where':{'id':_0x27ee71['params']['id']}},_0x45045f={};_0x45045f[_0xdf69('0x37')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x45045f['query']=_[_0xdf69('0x35')](_0x27ee71['query']);_0x45045f[_0xdf69('0x40')]=_[_0xdf69('0x36')](_0x45045f['model'],_0x45045f[_0xdf69('0x34')]);_0x4cb345['attributes']=_[_0xdf69('0x36')](_0x45045f[_0xdf69('0x37')],qs[_0xdf69('0x39')](_0x27ee71[_0xdf69('0x34')][_0xdf69('0x39')]));_0x4cb345['attributes']=_0x4cb345[_0xdf69('0x38')][_0xdf69('0x3a')]?_0x4cb345[_0xdf69('0x38')]:_0x45045f['model'];if(_0x27ee71[_0xdf69('0x34')][_0xdf69('0x46')]){_0x4cb345[_0xdf69('0x4b')]=[{'all':!![]}];}_0x4cb345=_[_0xdf69('0x44')]({},_0x4cb345,_0x27ee71['options']);return db[_0xdf69('0x2f')][_0xdf69('0x4c')](_0x4cb345)[_0xdf69('0x26')](handleEntityNotFound(_0x2fd085,null))['then'](respondWithResult(_0x2fd085,null))['catch'](handleError(_0x2fd085,null));};exports[_0xdf69('0x4d')]=function(_0x41a0ed,_0x4fb195){return db[_0xdf69('0x2f')]['create'](_0x41a0ed['body'],{})[_0xdf69('0x26')](respondWithResult(_0x4fb195,0xc9))[_0xdf69('0x49')](handleError(_0x4fb195,null));};exports[_0xdf69('0x4e')]=function(_0x354c0e,_0x2ee569){return db[_0xdf69('0x2f')]['describe']()['then'](respondWithResult(_0x2ee569,null))[_0xdf69('0x49')](handleError(_0x2ee569,null));};exports[_0xdf69('0x25')]=function(_0x25c283,_0x19bd13){if(_0x25c283[_0xdf69('0x4f')][_0xdf69('0x50')]){delete _0x25c283[_0xdf69('0x4f')]['uniqueid'];}return db[_0xdf69('0x2f')][_0xdf69('0x4c')]({'where':{'uniqueid':_0x25c283[_0xdf69('0x51')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0x19bd13,null))['then'](saveUpdates(_0x25c283[_0xdf69('0x4f')],null))[_0xdf69('0x26')](respondWithResult(_0x19bd13,null))[_0xdf69('0x49')](handleError(_0x19bd13,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 34cfe4f..852e740 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 _0x77d4=['exports','define','endtime','uniqueid','util','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes'];(function(_0x4ef721,_0x1513f3){var _0x1b035e=function(_0x1b409f){while(--_0x1b409f){_0x4ef721['push'](_0x4ef721['shift']());}};_0x1b035e(++_0x1513f3);}(_0x77d4,0x108));var _0x477d=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x77d4[_0x1b820f];return _0x423354;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));module[_0x477d('0x6')]=function(_0x471fca,_0x2545e5){return _0x471fca[_0x477d('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x477d('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x477d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8561=['define','endtime','util','../../config/logger','moment','request-promise','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8561,0x1b2));var _0x1856=function(_0x185b17,_0x5c458b){_0x185b17=_0x185b17-0x0;var _0x3f7835=_0x8561[_0x185b17];return _0x3f7835;};'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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4cd36f6..bbcebe6 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 _0xcd60=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xcd60,0xf0));var _0x0cd6=function(_0x551a0a,_0x4db6c0){_0x551a0a=_0x551a0a-0x0;var _0x4c64fd=_0xcd60[_0x551a0a];return _0x4c64fd;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var moment=require(_0x0cd6('0x2'));var BPromise=require(_0x0cd6('0x3'));var rs=require(_0x0cd6('0x4'));var fs=require('fs');var Redis=require(_0x0cd6('0x5'));var db=require(_0x0cd6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd6('0x7'))(_0x0cd6('0x8'));var config=require(_0x0cd6('0x9'));var jayson=require(_0x0cd6('0xa'));var client=jayson[_0x0cd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ceb47,_0x460833,_0x47c8b2){return new BPromise(function(_0x4714bf,_0x4fb298){return client[_0x0cd6('0xc')](_0x2ceb47,_0x47c8b2)[_0x0cd6('0xd')](function(_0x14f396){logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,'request\x20sent');logger[_0x0cd6('0x10')](_0x0cd6('0x11'),_0x460833,_0x0cd6('0x12'),JSON[_0x0cd6('0x13')](_0x14f396));if(_0x14f396[_0x0cd6('0x14')]){if(_0x14f396['error']['code']===0x1f4){logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')]['message']);return _0x4fb298(_0x14f396[_0x0cd6('0x14')]['message']);}logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);return _0x4714bf(_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);}else{logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,_0x0cd6('0x12'));_0x4714bf(_0x14f396[_0x0cd6('0x16')][_0x0cd6('0x15')]);}})[_0x0cd6('0x17')](function(_0x30d35c){logger[_0x0cd6('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x460833,_0x30d35c);_0x4fb298(_0x30d35c);});});}exports[_0x0cd6('0x18')]=function(_0x202d73){var _0x48ac27=this;return new Promise(function(_0x5c37ee,_0x5bebbc){return db[_0x0cd6('0x19')]['create'](_0x202d73['body'],{'raw':_0x202d73[_0x0cd6('0x1a')]?_0x202d73['options'][_0x0cd6('0x1b')]===undefined?!![]:![]:!![]})[_0x0cd6('0xd')](function(_0x1b29b1){logger[_0x0cd6('0xe')](_0x0cd6('0x18'),_0x202d73);logger[_0x0cd6('0x10')](_0x0cd6('0x18'),_0x202d73,JSON[_0x0cd6('0x13')](_0x1b29b1));_0x5c37ee(_0x1b29b1);})['catch'](function(_0x643aa0){logger[_0x0cd6('0x14')](_0x0cd6('0x18'),_0x643aa0['message'],_0x202d73);_0x5bebbc(_0x48ac27['error'](0x1f4,_0x643aa0['message']));});});};exports[_0x0cd6('0x1c')]=function(_0x5c8b8b){var _0x5ac9c0=this;return new Promise(function(_0x4e0eb1,_0x4beec7){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x5c8b8b[_0x0cd6('0x1a')]?_0x5c8b8b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8b8b['options']?_0x5c8b8b[_0x0cd6('0x1a')]['where']||null:null,'attributes':[[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x21')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x24')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x25')))),_0x0cd6('0x26')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x27')))),_0x0cd6('0x28')],[db[_0x0cd6('0x1e')]['fn']('AVG',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x29')))),_0x0cd6('0x2a')],[db['sequelize']['fn'](_0x0cd6('0x2b'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x2c')))),_0x0cd6('0x2d')]]})['then'](function(_0x2bf56d){logger[_0x0cd6('0xe')]('AvgHandleTime',_0x5c8b8b);logger[_0x0cd6('0x10')](_0x0cd6('0x1c'),_0x5c8b8b,JSON[_0x0cd6('0x13')](_0x2bf56d));_0x4e0eb1(_0x2bf56d);})['catch'](function(_0x23d159){logger[_0x0cd6('0x14')](_0x0cd6('0x1c'),_0x23d159['message'],_0x5c8b8b);_0x4beec7(_0x5ac9c0[_0x0cd6('0x14')](0x1f4,_0x23d159['message']));});});};exports[_0x0cd6('0x2e')]=function(_0x3b723b){var _0x4058e2=this;return new Promise(function(_0x5574dd,_0x2ac6ab){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x3b723b[_0x0cd6('0x1a')]?_0x3b723b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b723b['options']?_0x3b723b[_0x0cd6('0x1a')][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x32')))),_0x0cd6('0x33')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),'outboundAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x35')))),_0x0cd6('0x36')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x37')))),_0x0cd6('0x38')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x39')))),'outboundDropCallsDayTimeout'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0cd6('0x3a')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3b')))),'outboundUnknownCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x0cd6('0x3c')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0cd6('0x3f')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x40')))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x0cd6('0x41')]],'group':['campaign']})[_0x0cd6('0xd')](function(_0x1c0500){logger[_0x0cd6('0xe')](_0x0cd6('0x2e'),_0x3b723b);logger[_0x0cd6('0x10')](_0x0cd6('0x2e'),_0x3b723b,JSON[_0x0cd6('0x13')](_0x1c0500));_0x5574dd(_0x1c0500);})[_0x0cd6('0x17')](function(_0x4bd5dd){logger[_0x0cd6('0x14')](_0x0cd6('0x2e'),_0x4bd5dd[_0x0cd6('0x15')],_0x3b723b);_0x2ac6ab(_0x4058e2[_0x0cd6('0x14')](0x1f4,_0x4bd5dd['message']));});});};exports['GetCampaignHopperHistory']=function(_0x155c6c){var _0x49b08f=this;return new Promise(function(_0x38e284,_0x1825c3){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c[_0x0cd6('0x1a')][_0x0cd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c['options'][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x42')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x43')]],'group':[_0x0cd6('0x30')]})[_0x0cd6('0xd')](function(_0x556a11){logger[_0x0cd6('0xe')](_0x0cd6('0x44'),_0x155c6c);logger[_0x0cd6('0x10')]('GetCampaignHopperHistory',_0x155c6c,JSON[_0x0cd6('0x13')](_0x556a11));_0x38e284(_0x556a11);})[_0x0cd6('0x17')](function(_0x31b4bc){logger[_0x0cd6('0x14')](_0x0cd6('0x44'),_0x31b4bc['message'],_0x155c6c);_0x1825c3(_0x49b08f[_0x0cd6('0x14')](0x1f4,_0x31b4bc[_0x0cd6('0x15')]));});});}; \ No newline at end of file +var _0xcb91=['outboundReCallsDay','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')](_0x23d3a9[_0x1cb9('0x17')],{'raw':_0x23d3a9[_0x1cb9('0x18')]?_0x23d3a9[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x559bcc){logger[_0x1cb9('0xa')]('CreateCmHopperHistory',_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON['stringify'](_0x559bcc));_0x479d43(_0x559bcc);})['catch'](function(_0x2e3854){logger[_0x1cb9('0x10')](_0x1cb9('0x14'),_0x2e3854[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340[_0x1cb9('0x10')](0x1f4,_0x2e3854[_0x1cb9('0x12')]));});});};exports['AvgHandleTime']=function(_0x55b232){var _0x6c6f61=this;return new Promise(function(_0x557199,_0x10a419){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x55b232[_0x1cb9('0x18')]?_0x55b232[_0x1cb9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x55b232[_0x1cb9('0x18')]?_0x55b232[_0x1cb9('0x18')]['where']||null:null,'attributes':[[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')][_0x1cb9('0x1d')]('id')),_0x1cb9('0x1e')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x1cb9('0x20')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x21')))),_0x1cb9('0x22')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1cb9('0x1b')]['fn']('AVG',db[_0x1cb9('0x1b')]['fn']('IF',db['sequelize'][_0x1cb9('0x1f')](_0x1cb9('0x24')))),_0x1cb9('0x25')],[db[_0x1cb9('0x1b')]['fn']('AVG',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x26')))),_0x1cb9('0x27')]]})[_0x1cb9('0x28')](function(_0xc6d5fd){logger[_0x1cb9('0xa')](_0x1cb9('0x29'),_0x55b232);logger[_0x1cb9('0xd')](_0x1cb9('0x29'),_0x55b232,JSON[_0x1cb9('0xf')](_0xc6d5fd));_0x557199(_0xc6d5fd);})[_0x1cb9('0x13')](function(_0x4c8cb0){logger['error'](_0x1cb9('0x29'),_0x4c8cb0[_0x1cb9('0x12')],_0x55b232);_0x10a419(_0x6c6f61[_0x1cb9('0x10')](0x1f4,_0x4c8cb0[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x2a')]=function(_0x3a06e6){var _0x35f5e8=this;return new Promise(function(_0x3f5637,_0x4d3e39){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x3a06e6[_0x1cb9('0x18')]?_0x3a06e6['options'][_0x1cb9('0x19')]===undefined?!![]:![]:!![],'where':_0x3a06e6['options']?_0x3a06e6[_0x1cb9('0x18')]['where']||null:null,'attributes':[[_0x1cb9('0x2b'),_0x1cb9('0x2c')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x2d')))),_0x1cb9('0x2e')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1cb9('0x2f')))),_0x1cb9('0x30')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db['sequelize'][_0x1cb9('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0x1cb9('0x31')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')]['literal'](_0x1cb9('0x32')))),_0x1cb9('0x33')],[db['sequelize']['fn']('COUNT',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x34')))),_0x1cb9('0x35')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1cb9('0x36')))),_0x1cb9('0x37')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x38')))),_0x1cb9('0x39')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')]('`state`\x20=\x2014,\x201,\x20null'))),_0x1cb9('0x3b')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db['sequelize']['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3c')))),_0x1cb9('0x3d')],[db['sequelize']['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x3e')))),_0x1cb9('0x3f')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x1cb9('0x3d')],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x40')))),_0x1cb9('0x41')]],'group':[_0x1cb9('0x2b')]})[_0x1cb9('0x28')](function(_0x4a4b87){logger[_0x1cb9('0xa')]('GetVoiceQueueHopperHistory',_0x3a06e6);logger[_0x1cb9('0xd')]('GetVoiceQueueHopperHistory',_0x3a06e6,JSON[_0x1cb9('0xf')](_0x4a4b87));_0x3f5637(_0x4a4b87);})['catch'](function(_0x5e5174){logger[_0x1cb9('0x10')](_0x1cb9('0x2a'),_0x5e5174[_0x1cb9('0x12')],_0x3a06e6);_0x4d3e39(_0x35f5e8['error'](0x1f4,_0x5e5174[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x42')]=function(_0x52fbfe){var _0x571b33=this;return new Promise(function(_0x398d9d,_0x1a0314){return db[_0x1cb9('0x15')][_0x1cb9('0x1a')]({'raw':_0x52fbfe[_0x1cb9('0x18')]?_0x52fbfe[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![],'where':_0x52fbfe['options']?_0x52fbfe[_0x1cb9('0x18')][_0x1cb9('0x43')]||null:null,'attributes':[[_0x1cb9('0x2b'),'name'],[db[_0x1cb9('0x1b')]['fn'](_0x1cb9('0x1c'),db[_0x1cb9('0x1b')][_0x1cb9('0x1d')]('id')),_0x1cb9('0x44')],[db[_0x1cb9('0x1b')]['fn']('COUNT',db[_0x1cb9('0x1b')]['fn']('IF',db[_0x1cb9('0x1b')][_0x1cb9('0x1f')](_0x1cb9('0x2f')))),_0x1cb9('0x45')]],'group':[_0x1cb9('0x2b')]})[_0x1cb9('0x28')](function(_0x3c126a){logger[_0x1cb9('0xa')](_0x1cb9('0x42'),_0x52fbfe);logger[_0x1cb9('0xd')]('GetCampaignHopperHistory',_0x52fbfe,JSON[_0x1cb9('0xf')](_0x3c126a));_0x398d9d(_0x3c126a);})[_0x1cb9('0x13')](function(_0xebc79f){logger[_0x1cb9('0x10')]('GetCampaignHopperHistory',_0xebc79f['message'],_0x52fbfe);_0x1a0314(_0x571b33[_0x1cb9('0x10')](0x1f4,_0xebc79f[_0x1cb9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 1d6fcc0..e05f5af 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 _0x15d0=['../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x15d0,0xb7));var _0x015d=function(_0x5831f1,_0x358111){_0x5831f1=_0x5831f1-0x0;var _0x77ec77=_0x15d0[_0x5831f1];return _0x77ec77;};'use strict';var multer=require(_0x015d('0x0'));var util=require('util');var path=require(_0x015d('0x1'));var timeout=require(_0x015d('0x2'));var express=require('express');var router=express[_0x015d('0x3')]();var fs_extra=require(_0x015d('0x4'));var auth=require(_0x015d('0x5'));var interaction=require(_0x015d('0x6'));var config=require(_0x015d('0x7'));var controller=require(_0x015d('0x8'));router['get']('/',auth[_0x015d('0x9')](),controller[_0x015d('0xa')]);router[_0x015d('0xb')](_0x015d('0xc'),auth['isAuthenticated'](),controller[_0x015d('0xd')]);router['get']('/:id',auth[_0x015d('0x9')](),controller[_0x015d('0xe')]);router[_0x015d('0xf')]('/',auth[_0x015d('0x9')](),controller[_0x015d('0x10')]);router['put'](_0x015d('0x11'),auth[_0x015d('0x9')](),controller['update']);module[_0x015d('0x12')]=router; \ No newline at end of file +var _0x32d0=['exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put'];(function(_0x1d5934,_0x2a14e7){var _0x2744da=function(_0x2e665e){while(--_0x2e665e){_0x1d5934['push'](_0x1d5934['shift']());}};_0x2744da(++_0x2a14e7);}(_0x32d0,0x177));var _0x032d=function(_0x1983e8,_0x2d179b){_0x1983e8=_0x1983e8-0x0;var _0x8dd5a=_0x32d0[_0x1983e8];return _0x8dd5a;};'use strict';var multer=require(_0x032d('0x0'));var util=require(_0x032d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x032d('0x2')]();var fs_extra=require(_0x032d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x032d('0x4'));var config=require(_0x032d('0x5'));var controller=require(_0x032d('0x6'));router['get']('/',auth[_0x032d('0x7')](),controller[_0x032d('0x8')]);router[_0x032d('0x9')](_0x032d('0xa'),auth[_0x032d('0x7')](),controller[_0x032d('0xb')]);router[_0x032d('0x9')](_0x032d('0xc'),auth[_0x032d('0x7')](),controller[_0x032d('0xd')]);router[_0x032d('0xe')]('/',auth[_0x032d('0x7')](),controller['create']);router[_0x032d('0xf')]('/:id',auth[_0x032d('0x7')](),controller['update']);module[_0x032d('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f3632a0..aabc46c 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 _0x6f72=['exports','STRING','name'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6f72,0xae));var _0x26f7=function(_0x93557a,_0x43aa42){_0x93557a=_0x93557a-0x0;var _0x57c4bb=_0x6f72[_0x93557a];return _0x57c4bb;};'use strict';var Sequelize=require('sequelize');module[_0x26f7('0x0')]={'name':{'type':Sequelize[_0x26f7('0x1')],'unique':_0x26f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26f7('0x1')]}}; \ No newline at end of file +var _0xf23b=['exports','STRING','name','sequelize'];(function(_0x47f0c1,_0x1bec8c){var _0x2f3b0c=function(_0xd64c28){while(--_0xd64c28){_0x47f0c1['push'](_0x47f0c1['shift']());}};_0x2f3b0c(++_0x1bec8c);}(_0xf23b,0x133));var _0xbf23=function(_0x28977f,_0x4d3016){_0x28977f=_0x28977f-0x0;var _0x91a0d5=_0xf23b[_0x28977f];return _0x91a0d5;};'use strict';var Sequelize=require(_0xbf23('0x0'));module[_0xbf23('0x1')]={'name':{'type':Sequelize[_0xbf23('0x2')],'unique':_0xbf23('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf23('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 29ff1fd..34765c7 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 _0x680c=['setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Lists','end','error','stack','name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','Disposition','rawAttributes','length','nolimit','pick','ListId','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync'];(function(_0x163999,_0x5c8a82){var _0x52dfce=function(_0x5d5e2f){while(--_0x5d5e2f){_0x163999['push'](_0x163999['shift']());}};_0x52dfce(++_0x5c8a82);}(_0x680c,0xc2));var _0xc680=function(_0x26a351,_0x5dd04c){_0x26a351=_0x26a351-0x0;var _0x1ef7fe=_0x680c[_0x26a351];return _0x1ef7fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc680('0x0'));var zipdir=require(_0xc680('0x1'));var jsonpatch=require(_0xc680('0x2'));var rp=require(_0xc680('0x3'));var moment=require(_0xc680('0x4'));var BPromise=require(_0xc680('0x5'));var Mustache=require(_0xc680('0x6'));var util=require(_0xc680('0x7'));var path=require(_0xc680('0x8'));var sox=require(_0xc680('0x9'));var csv=require(_0xc680('0xa'));var ejs=require(_0xc680('0xb'));var fs=require('fs');var fs_extra=require(_0xc680('0xc'));var _=require('lodash');var squel=require(_0xc680('0xd'));var crypto=require(_0xc680('0xe'));var jsforce=require(_0xc680('0xf'));var deskjs=require(_0xc680('0x10'));var toCsv=require(_0xc680('0xa'));var querystring=require(_0xc680('0x11'));var Papa=require('papaparse');var Redis=require(_0xc680('0x12'));var authService=require(_0xc680('0x13'));var qs=require(_0xc680('0x14'));var as=require(_0xc680('0x15'));var hardwareService=require(_0xc680('0x16'));var logger=require(_0xc680('0x17'))(_0xc680('0x18'));var utils=require(_0xc680('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc680('0x1a'));var db=require(_0xc680('0x1b'))['db'];var csv_results;config[_0xc680('0x1c')]=_['defaults'](config[_0xc680('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc680('0x1d'))(new Redis(config[_0xc680('0x1c')]));require('./cmList.socket')[_0xc680('0x1e')](socket);function respondWithStatusCode(_0x11e3dc,_0x4aa7bd){_0x4aa7bd=_0x4aa7bd||0xcc;return function(_0x344534){if(_0x344534){return _0x11e3dc[_0xc680('0x1f')](_0x4aa7bd);}return _0x11e3dc[_0xc680('0x20')](_0x4aa7bd)['end']();};}function respondWithResult(_0x41562c,_0x51e2ad){_0x51e2ad=_0x51e2ad||0xc8;return function(_0x317332){if(_0x317332){return _0x41562c[_0xc680('0x20')](_0x51e2ad)[_0xc680('0x21')](_0x317332);}};}function respondWithFilteredResult(_0x152f2d,_0xa50a62){return function(_0x38c331){if(_0x38c331){var _0x4be01b=typeof _0xa50a62['offset']===_0xc680('0x22')&&typeof _0xa50a62['limit']==='undefined';var _0x5169e1=_0x38c331[_0xc680('0x23')];var _0x1fcff6=_0x4be01b?0x0:_0xa50a62[_0xc680('0x24')];var _0x344a17=_0x4be01b?_0x38c331['count']:_0xa50a62[_0xc680('0x24')]+_0xa50a62[_0xc680('0x25')];var _0x196cd9;if(_0x344a17>=_0x5169e1){_0x344a17=_0x5169e1;_0x196cd9=0xc8;}else{_0x196cd9=0xce;}_0x152f2d[_0xc680('0x20')](_0x196cd9);return _0x152f2d[_0xc680('0x26')](_0xc680('0x27'),_0x1fcff6+'-'+_0x344a17+'/'+_0x5169e1)[_0xc680('0x21')](_0x38c331);}return null;};}function patchUpdates(_0x310fed){return function(_0x338b8e){try{jsonpatch[_0xc680('0x28')](_0x338b8e,_0x310fed,!![]);}catch(_0x14fadd){return BPromise['reject'](_0x14fadd);}return _0x338b8e[_0xc680('0x29')]();};}function saveUpdates(_0x5edbd8,_0x15576a){return function(_0x4f726e){if(_0x4f726e){return _0x4f726e['update'](_0x5edbd8)[_0xc680('0x2a')](function(_0x3d7187){return _0x3d7187;});}return null;};}function removeEntity(_0x172263,_0x2f6b04){return function(_0x1ec569){if(_0x1ec569){return _0x1ec569[_0xc680('0x2b')]()[_0xc680('0x2a')](function(){var _0x4bf55f=_0x1ec569[_0xc680('0x2c')]({'plain':!![]});var _0x3878ec=_0xc680('0x2d');return db['UserProfileResource'][_0xc680('0x2b')]({'where':{'type':_0x3878ec,'resourceId':_0x4bf55f['id']}})[_0xc680('0x2a')](function(){return _0x1ec569;});})[_0xc680('0x2a')](function(){_0x172263[_0xc680('0x20')](0xcc)[_0xc680('0x2e')]();});}};}function handleEntityNotFound(_0x426460,_0x32a632){return function(_0x435501){if(!_0x435501){_0x426460[_0xc680('0x1f')](0x194);}return _0x435501;};}function handleError(_0x29d163,_0x4123f2){_0x4123f2=_0x4123f2||0x1f4;return function(_0x1ab731){logger[_0xc680('0x2f')](_0x1ab731[_0xc680('0x30')]);if(_0x1ab731[_0xc680('0x31')]){delete _0x1ab731[_0xc680('0x31')];}_0x29d163['status'](_0x4123f2)[_0xc680('0x32')](_0x1ab731);};}exports[_0xc680('0x33')]=function(_0x3fa446,_0x28199c){var _0xec1f54={},_0x50c819={},_0x45ee4c={'count':0x0,'rows':[]};var _0x220160=_[_0xc680('0x34')](db[_0xc680('0x35')]['rawAttributes'],function(_0x16f617){return{'name':_0x16f617[_0xc680('0x36')],'type':_0x16f617[_0xc680('0x37')][_0xc680('0x38')]};});_0x50c819[_0xc680('0x39')]=_[_0xc680('0x34')](_0x220160,_0xc680('0x31'));_0x50c819[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x3fa446[_0xc680('0x3a')]);_0x50c819[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x50c819[_0xc680('0x39')],_0x50c819[_0xc680('0x3a')]);_0xec1f54[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0x50c819[_0xc680('0x39')],qs[_0xc680('0x3f')](_0x3fa446['query'][_0xc680('0x3f')]));_0xec1f54[_0xc680('0x3e')]=_0xec1f54[_0xc680('0x3e')]['length']?_0xec1f54[_0xc680('0x3e')]:_0x50c819['model'];if(!_0x3fa446[_0xc680('0x3a')][_0xc680('0x40')]('nolimit')){_0xec1f54[_0xc680('0x25')]=qs[_0xc680('0x25')](_0x3fa446[_0xc680('0x3a')][_0xc680('0x25')]);_0xec1f54['offset']=qs['offset'](_0x3fa446[_0xc680('0x3a')]['offset']);}_0xec1f54[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x3fa446[_0xc680('0x3a')][_0xc680('0x42')]);_0xec1f54[_0xc680('0x43')]=qs['filters'](_['pick'](_0x3fa446['query'],_0x50c819['filters']),_0x220160);if(_0x3fa446[_0xc680('0x3a')][_0xc680('0x44')]){_0xec1f54[_0xc680('0x43')]=_[_0xc680('0x45')](_0xec1f54[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x220160,function(_0x4fb449){if(_0x4fb449[_0xc680('0x37')]!==_0xc680('0x46')){var _0x442d9a={};_0x442d9a[_0x4fb449[_0xc680('0x31')]]={'$like':'%'+_0x3fa446[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x442d9a;}})});}_0xec1f54=_['merge']({},_0xec1f54,_0x3fa446[_0xc680('0x47')]);var _0x29de8c={'where':_0xec1f54[_0xc680('0x43')]};return db[_0xc680('0x35')][_0xc680('0x23')](_0x29de8c)[_0xc680('0x2a')](function(_0x2f3ef3){_0x45ee4c[_0xc680('0x23')]=_0x2f3ef3;if(_0x3fa446['query'][_0xc680('0x48')]){_0xec1f54['include']=[{'all':!![]}];}return db[_0xc680('0x35')][_0xc680('0x49')](_0xec1f54);})['then'](function(_0x1cccee){_0x45ee4c[_0xc680('0x4a')]=_0x1cccee;return _0x45ee4c;})[_0xc680('0x2a')](respondWithFilteredResult(_0x28199c,_0xec1f54))[_0xc680('0x4b')](handleError(_0x28199c,null));};exports[_0xc680('0x4c')]=function(_0x123b81,_0xd07632){var _0x445dc5={'raw':![],'where':{'id':_0x123b81[_0xc680('0x4d')]['id']}},_0xf0e382={};_0xf0e382[_0xc680('0x39')]=_[_0xc680('0x3b')](db['CmList']['rawAttributes']);_0xf0e382[_0xc680('0x3a')]=_['keys'](_0x123b81['query']);_0xf0e382[_0xc680('0x3c')]=_['intersection'](_0xf0e382[_0xc680('0x39')],_0xf0e382[_0xc680('0x3a')]);_0x445dc5[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0xf0e382[_0xc680('0x39')],qs[_0xc680('0x3f')](_0x123b81['query'][_0xc680('0x3f')]));_0x445dc5[_0xc680('0x3e')]=_0x445dc5[_0xc680('0x3e')]['length']?_0x445dc5[_0xc680('0x3e')]:_0xf0e382['model'];if(_0x123b81['query'][_0xc680('0x48')]){_0x445dc5[_0xc680('0x4e')]=[{'all':!![]}];}_0x445dc5=_[_0xc680('0x45')]({},_0x445dc5,_0x123b81[_0xc680('0x47')]);return db['CmList'][_0xc680('0x4f')](_0x445dc5)['then'](handleEntityNotFound(_0xd07632,null))[_0xc680('0x2a')](respondWithResult(_0xd07632,null))[_0xc680('0x4b')](handleError(_0xd07632,null));};exports[_0xc680('0x50')]=function(_0x21263f,_0x30a6cc){return db[_0xc680('0x35')][_0xc680('0x50')](_0x21263f[_0xc680('0x51')],{})[_0xc680('0x2a')](function(_0x2ed53b){var _0x3f5661=_0x21263f[_0xc680('0x52')][_0xc680('0x2c')]({'plain':!![]});if(!_0x3f5661)throw new Error(_0xc680('0x53'));if(_0x3f5661['role']===_0xc680('0x52')){var _0x23e014=_0x2ed53b[_0xc680('0x2c')]({'plain':!![]});var _0x455853='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x455853,'userProfileId':_0x3f5661[_0xc680('0x54')]},'raw':!![]})['then'](function(_0x2c8ee7){if(_0x2c8ee7&&_0x2c8ee7[_0xc680('0x55')]===0x0){return db[_0xc680('0x56')][_0xc680('0x50')]({'name':_0x23e014[_0xc680('0x31')],'resourceId':_0x23e014['id'],'type':_0x2c8ee7[_0xc680('0x31')],'sectionId':_0x2c8ee7['id']},{})[_0xc680('0x2a')](function(){return _0x2ed53b;});}else{return _0x2ed53b;}})[_0xc680('0x4b')](function(_0xc5f26d){logger[_0xc680('0x2f')](_0xc680('0x57'),_0xc5f26d);throw _0xc5f26d;});}return _0x2ed53b;})[_0xc680('0x2a')](respondWithResult(_0x30a6cc,0xc9))[_0xc680('0x4b')](handleError(_0x30a6cc,null));};exports[_0xc680('0x58')]=function(_0xbdf73b,_0x2656ec){if(_0xbdf73b[_0xc680('0x51')]['id']){delete _0xbdf73b[_0xc680('0x51')]['id'];}return db[_0xc680('0x35')]['find']({'where':{'id':_0xbdf73b[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2656ec,null))[_0xc680('0x2a')](saveUpdates(_0xbdf73b[_0xc680('0x51')],null))['then'](respondWithResult(_0x2656ec,null))[_0xc680('0x4b')](handleError(_0x2656ec,null));};exports[_0xc680('0x2b')]=function(_0x44f694,_0x56a4eb){return db[_0xc680('0x35')]['find']({'where':{'id':_0x44f694[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x56a4eb,null))['then'](removeEntity(_0x56a4eb,null))['catch'](handleError(_0x56a4eb,null));};exports[_0xc680('0x59')]=function(_0x100218,_0x361049){return db[_0xc680('0x35')]['describe']()[_0xc680('0x2a')](respondWithResult(_0x361049,null))['catch'](handleError(_0x361049,null));};exports['addDisposition']=function(_0x2ea0a3,_0x5aabde,_0x43f68e){if(_0x2ea0a3[_0xc680('0x51')]['id']){delete _0x2ea0a3[_0xc680('0x51')]['id'];}return db[_0xc680('0x35')][_0xc680('0x4f')]({'where':{'id':_0x2ea0a3['params']['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x5aabde,null))[_0xc680('0x2a')](function(_0x4146ee){if(_0x4146ee){_0x2ea0a3[_0xc680('0x51')]['ListId']=_0x4146ee['id'];return db['Disposition'][_0xc680('0x50')](_0x2ea0a3[_0xc680('0x51')]);}})['then'](respondWithResult(_0x5aabde,null))[_0xc680('0x4b')](handleError(_0x5aabde,null));};exports['getDispositions']=function(_0x9e459a,_0x25463f,_0x450059){var _0x31aec6={'raw':![],'where':{}};var _0x4443c8={};var _0x5bbd8e={'count':0x0,'rows':[]};return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x9e459a['params']['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x25463f,null))[_0xc680('0x2a')](function(_0x9bd6ca){if(_0x9bd6ca){_0x4443c8['model']=_[_0xc680('0x3b')](db[_0xc680('0x5b')][_0xc680('0x5c')]);_0x4443c8[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x9e459a['query']);_0x4443c8[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x4443c8[_0xc680('0x39')],_0x4443c8['query']);_0x31aec6['attributes']=_['intersection'](_0x4443c8['model'],qs[_0xc680('0x3f')](_0x9e459a[_0xc680('0x3a')][_0xc680('0x3f')]));_0x31aec6[_0xc680('0x3e')]=_0x31aec6[_0xc680('0x3e')][_0xc680('0x5d')]?_0x31aec6[_0xc680('0x3e')]:_0x4443c8['model'];if(!_0x9e459a[_0xc680('0x3a')]['hasOwnProperty'](_0xc680('0x5e'))){_0x31aec6[_0xc680('0x25')]=qs['limit'](_0x9e459a[_0xc680('0x3a')]['limit']);_0x31aec6['offset']=qs['offset'](_0x9e459a[_0xc680('0x3a')][_0xc680('0x24')]);}_0x31aec6[_0xc680('0x41')]=qs['sort'](_0x9e459a[_0xc680('0x3a')][_0xc680('0x42')]);_0x31aec6[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x9e459a[_0xc680('0x3a')],_0x4443c8[_0xc680('0x3c')]));_0x31aec6['where'][_0xc680('0x60')]=_0x9bd6ca['id'];if(_0x9e459a[_0xc680('0x3a')][_0xc680('0x44')]){_0x31aec6['where']=_[_0xc680('0x45')](_0x31aec6['where'],{'$or':_['map'](_0x31aec6[_0xc680('0x3e')],function(_0x1bec9f){var _0x21e5a3={};_0x21e5a3[_0x1bec9f]={'$like':'%'+_0x9e459a[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x21e5a3;})});}_0x31aec6=_[_0xc680('0x45')]({},_0x31aec6,_0x9e459a['options']);return db[_0xc680('0x5b')][_0xc680('0x23')]({'where':_0x31aec6[_0xc680('0x43')]})[_0xc680('0x2a')](function(_0x432822){_0x5bbd8e[_0xc680('0x23')]=_0x432822;if(_0x9e459a[_0xc680('0x3a')][_0xc680('0x48')]){_0x31aec6[_0xc680('0x4e')]=[{'all':!![]}];}return db[_0xc680('0x5b')][_0xc680('0x49')](_0x31aec6);})[_0xc680('0x2a')](function(_0x384955){_0x5bbd8e['rows']=_0x384955;return _0x5bbd8e;});}})[_0xc680('0x2a')](respondWithFilteredResult(_0x25463f,_0x31aec6))['catch'](handleError(_0x25463f,null));};exports[_0xc680('0x61')]=function(_0x29280d,_0x2f7ce6,_0x5c5927){return db[_0xc680('0x35')]['find']({'where':{'id':_0x29280d[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2f7ce6,null))['then'](function(_0xe5b318){if(_0xe5b318){return _0xe5b318[_0xc680('0x61')](_0x29280d[_0xc680('0x3a')][_0xc680('0x62')]);}})[_0xc680('0x2a')](respondWithStatusCode(_0x2f7ce6,null))['catch'](handleError(_0x2f7ce6,null));};exports[_0xc680('0x63')]=function(_0x53bdb8,_0x432117,_0x3ddac9){return db[_0xc680('0x35')][_0xc680('0x4f')]({'where':{'id':_0x53bdb8[_0xc680('0x4d')]['id']}})['then'](handleEntityNotFound(_0x432117,null))[_0xc680('0x2a')](function(_0x21f75a){if(_0x21f75a){var _0x5eaf42=[];var _0x1bd977={'success':[],'errors':[]};return db[_0xc680('0x64')][_0xc680('0x59')]()[_0xc680('0x2a')](function(_0x41bc18){if(_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]&&_['isArray'](_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')])){if(_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')][_0xc680('0x5d')]){_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')][_0xc680('0x66')](';')+';';}else{_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=null;}}else{_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=null;}if(_0x53bdb8['body']&&_[_0xc680('0x67')](_0x53bdb8[_0xc680('0x51')])){for(var _0x86bf31=0x0;_0x86bf31<_0x53bdb8[_0xc680('0x51')][_0xc680('0x5d')];_0x86bf31+=0x1){_0x53bdb8['body'][_0x86bf31][_0xc680('0x60')]=_0x53bdb8[_0xc680('0x4d')]['id'];_0x5eaf42[_0xc680('0x68')](_0x53bdb8[_0xc680('0x51')][_0x86bf31]);}return BPromise[_0xc680('0x69')](_0x5eaf42,function(_0x51dd9c){return db[_0xc680('0x64')]['create'](_[_0xc680('0x6a')](_0x51dd9c,[_0xc680('0x62'),'id'])||{},{'fields':_[_0xc680('0x3b')](_0x41bc18),'raw':!![]})[_0xc680('0x2a')](function(_0x1f2c82){_0x1bd977[_0xc680('0x6b')][_0xc680('0x68')](_0x1f2c82['dataValues']);})['catch'](function(_0x439613){_0x1bd977[_0xc680('0x6c')]['push']({'data':_0x51dd9c,'error':_0x439613[_0xc680('0x6d')]});});})[_0xc680('0x2a')](function(_0x4b00b2){return _0x1bd977;})['catch'](function(_0xce2bab){return _0xce2bab;});}else{_0x432117['status'](0x190)[_0xc680('0x21')]({'message':_0xc680('0x6e')});}});}})[_0xc680('0x2a')](respondWithResult(_0x432117,null))[_0xc680('0x4b')](handleError(_0x432117,null));};exports[_0xc680('0x6f')]=function(_0x468e13,_0x5666cd,_0x5c2abb){var _0x265112;return db['CmList'][_0xc680('0x4f')]({'where':{'id':_0x468e13[_0xc680('0x4d')]['id']},'include':[{'model':db[_0xc680('0x70')],'as':_0xc680('0x71')}]})[_0xc680('0x2a')](handleEntityNotFound(_0x5666cd,null))[_0xc680('0x2a')](function(_0x2ac7b2){if(_0x2ac7b2){_0x265112=_0x2ac7b2;return db[_0xc680('0x64')]['rawAttributes'];}})[_0xc680('0x2a')](function(_0x386a8c){if(_0x386a8c){var _0x4314f1={};var _0x3191d8={};_0x3191d8[_0xc680('0x39')]=_[_0xc680('0x72')](_[_0xc680('0x3b')](_0x386a8c),_['map'](_0x265112[_0xc680('0x71')],function(_0x5dd77d){return util[_0xc680('0x73')](_0xc680('0x74'),_0x5dd77d['id']);}));_0x3191d8['query']=_[_0xc680('0x3b')](_0x468e13[_0xc680('0x3a')]);_0x3191d8[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x3191d8[_0xc680('0x39')],_0x3191d8[_0xc680('0x3a')]);_0x4314f1[_0xc680('0x3e')]=_['intersection'](_0x3191d8[_0xc680('0x39')],qs['fields'](_0x468e13[_0xc680('0x3a')][_0xc680('0x3f')]));_0x4314f1['attributes']=_0x4314f1[_0xc680('0x3e')][_0xc680('0x5d')]?_0x4314f1[_0xc680('0x3e')]:_0x3191d8[_0xc680('0x39')];if(!_0x468e13['query']['hasOwnProperty'](_0xc680('0x5e'))){_0x4314f1[_0xc680('0x25')]=qs['limit'](_0x468e13['query'][_0xc680('0x25')]);_0x4314f1['offset']=qs['offset'](_0x468e13[_0xc680('0x3a')][_0xc680('0x24')]);}_0x4314f1[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x468e13['query'][_0xc680('0x42')]);_0x4314f1[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x468e13[_0xc680('0x3a')],_0x3191d8[_0xc680('0x3c')]));_0x4314f1['raw']=!![];if(_0x468e13[_0xc680('0x3a')][_0xc680('0x44')]){_0x4314f1[_0xc680('0x43')]=_[_0xc680('0x45')](_0x4314f1[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x4314f1[_0xc680('0x3e')],function(_0x316e4c){var _0x239a54={};_0x239a54[_0x316e4c]={'$like':'%'+_0x468e13[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x239a54;})});}_0x4314f1=_['merge']({},_0x4314f1,_0x468e13[_0xc680('0x47')]);return _0x265112['getContacts'](_0x4314f1);}})[_0xc680('0x2a')](respondWithResult(_0x5666cd,null))[_0xc680('0x4b')](handleError(_0x5666cd,null));};exports['getContactsCsv']=function(_0x2a767a,_0xbb7e27,_0x520493){var _0x5a4ffe;var _0x7e9331;var _0x27b10d;var _0x2fd8aa=_0x2a767a['params']['id'];csv_results=[];return db[_0xc680('0x75')]['findAll']({'attributes':['id',_0xc680('0x31')],'raw':!![],'order':[_0xc680('0x76')]})[_0xc680('0x2a')](function(_0x38be99){_0x5a4ffe=_0x38be99;var _0x30d1aa=_['keys'](db[_0xc680('0x64')][_0xc680('0x5c')]);return db[_0xc680('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xc680('0x77')]})[_0xc680('0x2a')](function(_0x2eb701){_0x7e9331=_0x2eb701;var _0x448fa6=squel[_0xc680('0x78')]()[_0xc680('0x3f')](_0x30d1aa)[_0xc680('0x79')](_0xc680('0x7a'),'c')[_0xc680('0x43')](_0xc680('0x7b'),_0x2fd8aa)[_0xc680('0x43')](_0xc680('0x7c'))['distinct']();for(var _0x555fdf=0x0;_0x555fdf<_0x7e9331[_0xc680('0x5d')];_0x555fdf++){_0x448fa6[_0xc680('0x7d')](_0xc680('0x7e')+_0x7e9331[_0x555fdf]['id'],'customField_'+_0x7e9331[_0x555fdf][_0xc680('0x77')]);}for(var _0x555fdf=0x0;_0x555fdf<_0x5a4ffe['length'];_0x555fdf++){_0x448fa6[_0xc680('0x7d')](squel[_0xc680('0x78')]()[_0xc680('0x7d')]('item')['from'](_0xc680('0x7f'))[_0xc680('0x43')](_0xc680('0x80'),_0x5a4ffe[_0x555fdf]['id'])['where'](_0xc680('0x81')),'additionalPhone_'+_0x5a4ffe[_0x555fdf][_0xc680('0x31')]);_0x448fa6[_0xc680('0x7d')](squel['select']()['field'](_0xc680('0x82'))['from']('cm_contact_has_items')['where'](_0xc680('0x80'),_0x5a4ffe[_0x555fdf]['id'])['where'](_0xc680('0x81')),_0xc680('0x83')+_0x5a4ffe[_0x555fdf][_0xc680('0x31')]);}var _0x504462=[];_0x504462[_0xc680('0x68')](_0x448fa6['toString']());BPromise[_0xc680('0x69')](_0x504462,handleQuery)[_0xc680('0x2a')](function(_0x26629c){handleQuery(_0x448fa6[_0xc680('0x84')]());var _0x5849e7=csv_results[0x0];if(!_[_0xc680('0x85')](_0x5849e7)){var _0x51fc69=toCsv(_0x5849e7);var _0x5acae9=Date[_0xc680('0x86')]();fs[_0xc680('0x87')](util[_0xc680('0x73')]('/tmp/list_%d_%s.csv',_0x2fd8aa,_0x5acae9),_0x51fc69);_0xbb7e27[_0xc680('0x88')](_0xc680('0x89'),'attachment;\x20filename='+util['format'](_0xc680('0x8a'),_0x2fd8aa,_0x5acae9));_0xbb7e27[_0xc680('0x88')](_0xc680('0x8b'),_0xc680('0x8c'));return _0xbb7e27[_0xc680('0x8d')](util[_0xc680('0x73')](_0xc680('0x8e'),_0x2fd8aa,_0x5acae9));}else{return _0xbb7e27[_0xc680('0x1f')](0xcc);}});});});};exports[_0xc680('0x8f')]=function(_0xe38524,_0x4dda3d,_0x2f1822){var _0xe231ca;delete _0xe38524['body']['id'];return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0xe38524[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x4dda3d,null))['then'](function(_0x419aa2){if(_0x419aa2){return db[_0xc680('0x90')]['transaction'](function(_0x417924){return db[_0xc680('0x70')][_0xc680('0x50')](_0xe38524[_0xc680('0x51')],{'transaction':_0x417924})[_0xc680('0x2a')](function(_0x59b9ab){_0xe231ca=_0x59b9ab;return _0x419aa2[_0xc680('0x91')](_0x59b9ab,{'transaction':_0x417924});})[_0xc680('0x2a')](function(){var _0x114cbb={'type':db[_0xc680('0x92')][_0xc680('0x93')],'transaction':_0x417924};switch(_0xe38524[_0xc680('0x51')]['type']){case _0xc680('0x94'):_0x114cbb[_0xc680('0x37')]=db['Sequelize'][_0xc680('0x93')];break;case'number':_0x114cbb[_0xc680('0x37')]=db[_0xc680('0x92')]['INTEGER'];break;case _0xc680('0x95'):_0x114cbb[_0xc680('0x37')]=db[_0xc680('0x92')][_0xc680('0x96')];_0x114cbb[_0xc680('0x97')]=![];break;default:}return db[_0xc680('0x90')][_0xc680('0x98')][_0xc680('0x99')]('cm_contacts',util[_0xc680('0x73')](_0xc680('0x9a'),_0xe231ca['id']),_0x114cbb);})['then'](function(){return _0xe231ca;});});}})[_0xc680('0x2a')](respondWithResult(_0x4dda3d,null))[_0xc680('0x4b')](handleError(_0x4dda3d,null));};exports['getCustomFields']=function(_0x3ae318,_0x3cc1f9,_0x548341){var _0x14fb65={};var _0x9475cf={};var _0x47103f;var _0x6ef0fa;return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x3ae318[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x3cc1f9,null))[_0xc680('0x2a')](function(_0x30d5ba){if(_0x30d5ba){_0x47103f=_0x30d5ba;_0x9475cf[_0xc680('0x39')]=_[_0xc680('0x3b')](db[_0xc680('0x70')][_0xc680('0x5c')]);_0x9475cf[_0xc680('0x3a')]=_['keys'](_0x3ae318['query']);_0x9475cf[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x9475cf[_0xc680('0x39')],_0x9475cf[_0xc680('0x3a')]);_0x14fb65[_0xc680('0x3e')]=_['intersection'](_0x9475cf[_0xc680('0x39')],qs['fields'](_0x3ae318[_0xc680('0x3a')][_0xc680('0x3f')]));_0x14fb65[_0xc680('0x3e')]=_0x14fb65[_0xc680('0x3e')][_0xc680('0x5d')]?_0x14fb65['attributes']:_0x9475cf[_0xc680('0x39')];_0x14fb65[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x3ae318[_0xc680('0x3a')][_0xc680('0x42')]);_0x14fb65[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x3ae318[_0xc680('0x3a')],_0x9475cf[_0xc680('0x3c')]));_0x14fb65[_0xc680('0x43')]=_['merge'](_0x14fb65['where'],{'$or':[{'ListId':_0x30d5ba['id']},{'ListId':null}]});if(_0x3ae318['query'][_0xc680('0x44')]){_0x14fb65[_0xc680('0x43')]=_[_0xc680('0x45')](_0x14fb65[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x14fb65[_0xc680('0x3e')],function(_0x4945f){var _0x3bfc72={};_0x3bfc72[_0x4945f]={'$like':'%'+_0x3ae318['query'][_0xc680('0x44')]+'%'};return _0x3bfc72;})});}_0x14fb65=_[_0xc680('0x45')]({},_0x14fb65,_0x3ae318[_0xc680('0x47')]);return db[_0xc680('0x70')]['findAndCountAll'](_0x14fb65);}})[_0xc680('0x2a')](respondWithResult(_0x3cc1f9,null))[_0xc680('0x4b')](handleError(_0x3cc1f9,null));};exports[_0xc680('0x9b')]=function(_0x27e16f,_0x14183b){return db[_0xc680('0x70')][_0xc680('0x9c')]({'where':{'ListId':null}})[_0xc680('0x2a')](handleEntityNotFound(_0x14183b,null))['then'](function(_0x50cdea){return _0x50cdea;})[_0xc680('0x2a')](respondWithResult(_0x14183b,null))[_0xc680('0x4b')](handleError(_0x14183b,null));};exports[_0xc680('0x9d')]=function(_0x45ac70,_0xafa389,_0x48dc9b){return db['CmList']['find']({'where':{'id':_0x45ac70[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0xafa389,null))[_0xc680('0x2a')](function(_0xbc248c){if(_0xbc248c){return _0xbc248c[_0xc680('0x9d')](_0x45ac70[_0xc680('0x51')][_0xc680('0x62')],_[_0xc680('0x6a')](_0x45ac70[_0xc680('0x51')],['ids','id'])||{})[_0xc680('0x9e')](function(_0x4b7657){for(var _0x22fa0d=0x0;_0x22fa0d<_0x45ac70[_0xc680('0x51')][_0xc680('0x62')][_0xc680('0x5d')];_0x22fa0d+=0x1){socket[_0xc680('0x9f')](_0xc680('0xa0'),{'UserId':Number(_0x45ac70['body'][_0xc680('0x62')][_0x22fa0d]),'CmListId':Number(_0x45ac70[_0xc680('0x4d')]['id'])});}return _0x4b7657;});}})[_0xc680('0x2a')](respondWithResult(_0xafa389,null))[_0xc680('0x4b')](handleError(_0xafa389,null));};exports[_0xc680('0xa1')]=function(_0x1422dc,_0x1f84b0,_0x18eb45){return db[_0xc680('0x35')]['find']({'where':{'id':_0x1422dc[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x1f84b0,null))[_0xc680('0x2a')](function(_0x356730){if(_0x356730){return _0x356730[_0xc680('0xa1')](_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')])[_0xc680('0x2a')](function(){if(_[_0xc680('0x67')](_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')])){for(var _0x34c7d3=0x0;_0x34c7d3<_0x1422dc['query'][_0xc680('0x62')]['length'];_0x34c7d3+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')][_0x34c7d3]),'CmListId':Number(_0x1422dc[_0xc680('0x4d')]['id'])});}}else{socket[_0xc680('0x9f')]('userCmList:remove',{'UserId':Number(_0x1422dc['query'][_0xc680('0x62')]),'CmListId':Number(_0x1422dc['params']['id'])});}});}})[_0xc680('0x2a')](respondWithStatusCode(_0x1f84b0,null))[_0xc680('0x4b')](handleError(_0x1f84b0,null));};exports[_0xc680('0xa2')]=function(_0x474a85,_0x2b1160,_0x3494b8){var _0x2c2e22={};var _0x1c97ea={};var _0x550a8a;var _0x1a5473;return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x474a85[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2b1160,null))['then'](function(_0x290c61){if(_0x290c61){_0x550a8a=_0x290c61;_0x1c97ea[_0xc680('0x39')]=_['keys'](db[_0xc680('0xa3')][_0xc680('0x5c')]);_0x1c97ea[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x474a85[_0xc680('0x3a')]);_0x1c97ea[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x1c97ea['model'],_0x1c97ea[_0xc680('0x3a')]);_0x2c2e22[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0x1c97ea[_0xc680('0x39')],qs['fields'](_0x474a85[_0xc680('0x3a')]['fields']));_0x2c2e22[_0xc680('0x3e')]=_0x2c2e22[_0xc680('0x3e')][_0xc680('0x5d')]?_0x2c2e22[_0xc680('0x3e')]:_0x1c97ea[_0xc680('0x39')];_0x2c2e22[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x474a85[_0xc680('0x3a')][_0xc680('0x42')]);_0x2c2e22['where']=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x474a85[_0xc680('0x3a')],_0x1c97ea['filters']));if(_0x474a85[_0xc680('0x3a')][_0xc680('0x44')]){_0x2c2e22['where']=_['merge'](_0x2c2e22['where'],{'$or':_[_0xc680('0x34')](_0x2c2e22[_0xc680('0x3e')],function(_0x1e1a93){var _0x299fc8={};_0x299fc8[_0x1e1a93]={'$like':'%'+_0x474a85[_0xc680('0x3a')]['filter']+'%'};return _0x299fc8;})});}_0x2c2e22=_['merge']({},_0x2c2e22,_0x474a85[_0xc680('0x47')]);return _0x550a8a[_0xc680('0xa2')](_0x2c2e22);}})['then'](function(_0xf5a6f7){if(_0xf5a6f7){_0x1a5473=_0xf5a6f7['length'];if(!_0x474a85[_0xc680('0x3a')][_0xc680('0x40')](_0xc680('0x5e'))){_0x2c2e22[_0xc680('0x25')]=qs[_0xc680('0x25')](_0x474a85[_0xc680('0x3a')]['limit']);_0x2c2e22[_0xc680('0x24')]=qs[_0xc680('0x24')](_0x474a85[_0xc680('0x3a')][_0xc680('0x24')]);}return _0x550a8a[_0xc680('0xa2')](_0x2c2e22);}})['then'](function(_0x457ca9){if(_0x457ca9){return _0x457ca9?{'count':_0x1a5473,'rows':_0x457ca9}:null;}})[_0xc680('0x2a')](respondWithResult(_0x2b1160,null))['catch'](handleError(_0x2b1160,null));};function handleQuery(_0xdbe274){logger[_0xc680('0xa4')](_0xdbe274);return db[_0xc680('0x90')][_0xc680('0x3a')](_0xdbe274)[_0xc680('0x9e')](function(_0x566caf){csv_results['push'](_0x566caf);})[_0xc680('0x4b')](function(_0x97dd69){logger[_0xc680('0x2f')](_0x97dd69['message']);});} \ No newline at end of file +var _0xbf3d=['user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','addContacts','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','cf_%d','raw','getContactsCsv','OrderBy','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','destroy','then','Lists','UserProfileResource','error','stack','index','map','CmList','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','include','findAll','rows','catch','show','includeAll','merge','options','find','create','body'];(function(_0x3b0e0c,_0x3f3e40){var _0x5baa46=function(_0x54bc82){while(--_0x54bc82){_0x3b0e0c['push'](_0x3b0e0c['shift']());}};_0x5baa46(++_0x3f3e40);}(_0xbf3d,0xfb));var _0xdbf3=function(_0x3ae690,_0x406b36){_0x3ae690=_0x3ae690-0x0;var _0x3dd33c=_0xbf3d[_0x3ae690];return _0x3dd33c;};'use strict';var emlformat=require(_0xdbf3('0x0'));var rimraf=require(_0xdbf3('0x1'));var zipdir=require(_0xdbf3('0x2'));var jsonpatch=require(_0xdbf3('0x3'));var rp=require(_0xdbf3('0x4'));var moment=require(_0xdbf3('0x5'));var BPromise=require(_0xdbf3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbf3('0x7'));var sox=require(_0xdbf3('0x8'));var csv=require(_0xdbf3('0x9'));var ejs=require(_0xdbf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbf3('0xb'));var squel=require(_0xdbf3('0xc'));var crypto=require(_0xdbf3('0xd'));var jsforce=require(_0xdbf3('0xe'));var deskjs=require(_0xdbf3('0xf'));var toCsv=require(_0xdbf3('0x9'));var querystring=require(_0xdbf3('0x10'));var Papa=require(_0xdbf3('0x11'));var Redis=require(_0xdbf3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdbf3('0x13'));var as=require(_0xdbf3('0x14'));var hardwareService=require(_0xdbf3('0x15'));var logger=require(_0xdbf3('0x16'))(_0xdbf3('0x17'));var utils=require(_0xdbf3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdbf3('0x19'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xdbf3('0x1a')]=_['defaults'](config['redis'],{'host':_0xdbf3('0x1b'),'port':0x18eb});var socket=require(_0xdbf3('0x1c'))(new Redis(config[_0xdbf3('0x1a')]));require(_0xdbf3('0x1d'))[_0xdbf3('0x1e')](socket);function respondWithStatusCode(_0x3c9bae,_0x7df5ff){_0x7df5ff=_0x7df5ff||0xcc;return function(_0xf1a052){if(_0xf1a052){return _0x3c9bae[_0xdbf3('0x1f')](_0x7df5ff);}return _0x3c9bae[_0xdbf3('0x20')](_0x7df5ff)[_0xdbf3('0x21')]();};}function respondWithResult(_0x435fb9,_0x3ddbe1){_0x3ddbe1=_0x3ddbe1||0xc8;return function(_0x13080f){if(_0x13080f){return _0x435fb9[_0xdbf3('0x20')](_0x3ddbe1)[_0xdbf3('0x22')](_0x13080f);}};}function respondWithFilteredResult(_0x1be8f5,_0x36b1d4){return function(_0x2cc3f8){if(_0x2cc3f8){var _0x2564ee=typeof _0x36b1d4[_0xdbf3('0x23')]==='undefined'&&typeof _0x36b1d4[_0xdbf3('0x24')]===_0xdbf3('0x25');var _0x3ab130=_0x2cc3f8[_0xdbf3('0x26')];var _0x45889d=_0x2564ee?0x0:_0x36b1d4[_0xdbf3('0x23')];var _0x4a741c=_0x2564ee?_0x2cc3f8[_0xdbf3('0x26')]:_0x36b1d4[_0xdbf3('0x23')]+_0x36b1d4[_0xdbf3('0x24')];var _0x3f4ebb;if(_0x4a741c>=_0x3ab130){_0x4a741c=_0x3ab130;_0x3f4ebb=0xc8;}else{_0x3f4ebb=0xce;}_0x1be8f5[_0xdbf3('0x20')](_0x3f4ebb);return _0x1be8f5[_0xdbf3('0x27')]('Content-Range',_0x45889d+'-'+_0x4a741c+'/'+_0x3ab130)[_0xdbf3('0x22')](_0x2cc3f8);}return null;};}function patchUpdates(_0x430eff){return function(_0x53deba){try{jsonpatch[_0xdbf3('0x28')](_0x53deba,_0x430eff,!![]);}catch(_0x574dde){return BPromise['reject'](_0x574dde);}return _0x53deba['save']();};}function saveUpdates(_0x3d5609,_0x537b04){return function(_0x1e6ae0){if(_0x1e6ae0){return _0x1e6ae0[_0xdbf3('0x29')](_0x3d5609)['then'](function(_0x33fc5e){return _0x33fc5e;});}return null;};}function removeEntity(_0x413533,_0x524ce7){return function(_0x289c4d){if(_0x289c4d){return _0x289c4d[_0xdbf3('0x2a')]()[_0xdbf3('0x2b')](function(){var _0x2ffaba=_0x289c4d['get']({'plain':!![]});var _0x51dc84=_0xdbf3('0x2c');return db[_0xdbf3('0x2d')][_0xdbf3('0x2a')]({'where':{'type':_0x51dc84,'resourceId':_0x2ffaba['id']}})['then'](function(){return _0x289c4d;});})[_0xdbf3('0x2b')](function(){_0x413533[_0xdbf3('0x20')](0xcc)[_0xdbf3('0x21')]();});}};}function handleEntityNotFound(_0x30e009,_0x3bf1fe){return function(_0x31abdf){if(!_0x31abdf){_0x30e009['sendStatus'](0x194);}return _0x31abdf;};}function handleError(_0x4c3133,_0x3b5110){_0x3b5110=_0x3b5110||0x1f4;return function(_0x1d0c57){logger[_0xdbf3('0x2e')](_0x1d0c57[_0xdbf3('0x2f')]);if(_0x1d0c57['name']){delete _0x1d0c57['name'];}_0x4c3133[_0xdbf3('0x20')](_0x3b5110)['send'](_0x1d0c57);};}exports[_0xdbf3('0x30')]=function(_0x43d8bb,_0x1bd638){var _0x492d87={},_0x38b10c={},_0x3869e8={'count':0x0,'rows':[]};var _0x475854=_[_0xdbf3('0x31')](db[_0xdbf3('0x32')][_0xdbf3('0x33')],function(_0x2338ca){return{'name':_0x2338ca['fieldName'],'type':_0x2338ca[_0xdbf3('0x34')][_0xdbf3('0x35')]};});_0x38b10c[_0xdbf3('0x36')]=_[_0xdbf3('0x31')](_0x475854,_0xdbf3('0x37'));_0x38b10c[_0xdbf3('0x38')]=_[_0xdbf3('0x39')](_0x43d8bb[_0xdbf3('0x38')]);_0x38b10c[_0xdbf3('0x3a')]=_[_0xdbf3('0x3b')](_0x38b10c[_0xdbf3('0x36')],_0x38b10c[_0xdbf3('0x38')]);_0x492d87[_0xdbf3('0x3c')]=_[_0xdbf3('0x3b')](_0x38b10c[_0xdbf3('0x36')],qs[_0xdbf3('0x3d')](_0x43d8bb['query'][_0xdbf3('0x3d')]));_0x492d87['attributes']=_0x492d87['attributes'][_0xdbf3('0x3e')]?_0x492d87[_0xdbf3('0x3c')]:_0x38b10c[_0xdbf3('0x36')];if(!_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x3f')]('nolimit')){_0x492d87[_0xdbf3('0x24')]=qs[_0xdbf3('0x24')](_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x24')]);_0x492d87[_0xdbf3('0x23')]=qs[_0xdbf3('0x23')](_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x23')]);}_0x492d87['order']=qs[_0xdbf3('0x40')](_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x40')]);_0x492d87[_0xdbf3('0x41')]=qs[_0xdbf3('0x3a')](_[_0xdbf3('0x42')](_0x43d8bb[_0xdbf3('0x38')],_0x38b10c[_0xdbf3('0x3a')]),_0x475854);if(_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x43')]){_0x492d87[_0xdbf3('0x41')]=_['merge'](_0x492d87[_0xdbf3('0x41')],{'$or':_[_0xdbf3('0x31')](_0x475854,function(_0x29f5dd){if(_0x29f5dd['type']!=='VIRTUAL'){var _0x3af03a={};_0x3af03a[_0x29f5dd[_0xdbf3('0x37')]]={'$like':'%'+_0x43d8bb[_0xdbf3('0x38')][_0xdbf3('0x43')]+'%'};return _0x3af03a;}})});}_0x492d87=_['merge']({},_0x492d87,_0x43d8bb['options']);var _0x1d7a14={'where':_0x492d87['where']};return db['CmList'][_0xdbf3('0x26')](_0x1d7a14)[_0xdbf3('0x2b')](function(_0x5e1262){_0x3869e8[_0xdbf3('0x26')]=_0x5e1262;if(_0x43d8bb[_0xdbf3('0x38')]['includeAll']){_0x492d87[_0xdbf3('0x44')]=[{'all':!![]}];}return db['CmList'][_0xdbf3('0x45')](_0x492d87);})[_0xdbf3('0x2b')](function(_0x130669){_0x3869e8[_0xdbf3('0x46')]=_0x130669;return _0x3869e8;})['then'](respondWithFilteredResult(_0x1bd638,_0x492d87))[_0xdbf3('0x47')](handleError(_0x1bd638,null));};exports[_0xdbf3('0x48')]=function(_0x586fde,_0x1aa9a8){var _0x1405bf={'raw':![],'where':{'id':_0x586fde['params']['id']}},_0x2e0cbe={};_0x2e0cbe[_0xdbf3('0x36')]=_['keys'](db[_0xdbf3('0x32')][_0xdbf3('0x33')]);_0x2e0cbe['query']=_['keys'](_0x586fde[_0xdbf3('0x38')]);_0x2e0cbe[_0xdbf3('0x3a')]=_[_0xdbf3('0x3b')](_0x2e0cbe['model'],_0x2e0cbe[_0xdbf3('0x38')]);_0x1405bf[_0xdbf3('0x3c')]=_[_0xdbf3('0x3b')](_0x2e0cbe['model'],qs[_0xdbf3('0x3d')](_0x586fde['query']['fields']));_0x1405bf[_0xdbf3('0x3c')]=_0x1405bf['attributes'][_0xdbf3('0x3e')]?_0x1405bf[_0xdbf3('0x3c')]:_0x2e0cbe[_0xdbf3('0x36')];if(_0x586fde[_0xdbf3('0x38')][_0xdbf3('0x49')]){_0x1405bf[_0xdbf3('0x44')]=[{'all':!![]}];}_0x1405bf=_[_0xdbf3('0x4a')]({},_0x1405bf,_0x586fde[_0xdbf3('0x4b')]);return db[_0xdbf3('0x32')][_0xdbf3('0x4c')](_0x1405bf)[_0xdbf3('0x2b')](handleEntityNotFound(_0x1aa9a8,null))[_0xdbf3('0x2b')](respondWithResult(_0x1aa9a8,null))['catch'](handleError(_0x1aa9a8,null));};exports[_0xdbf3('0x4d')]=function(_0x29ce38,_0x570b22){return db[_0xdbf3('0x32')]['create'](_0x29ce38[_0xdbf3('0x4e')],{})[_0xdbf3('0x2b')](function(_0x23b81d){var _0x3af6aa=_0x29ce38[_0xdbf3('0x4f')]['get']({'plain':!![]});if(!_0x3af6aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3af6aa[_0xdbf3('0x50')]===_0xdbf3('0x4f')){var _0x1f0bbd=_0x23b81d['get']({'plain':!![]});var _0x2a93cd='Lists';return db[_0xdbf3('0x51')][_0xdbf3('0x4c')]({'where':{'name':_0x2a93cd,'userProfileId':_0x3af6aa[_0xdbf3('0x52')]},'raw':!![]})[_0xdbf3('0x2b')](function(_0x119b05){if(_0x119b05&&_0x119b05[_0xdbf3('0x53')]===0x0){return db[_0xdbf3('0x2d')][_0xdbf3('0x4d')]({'name':_0x1f0bbd[_0xdbf3('0x37')],'resourceId':_0x1f0bbd['id'],'type':_0x119b05[_0xdbf3('0x37')],'sectionId':_0x119b05['id']},{})[_0xdbf3('0x2b')](function(){return _0x23b81d;});}else{return _0x23b81d;}})[_0xdbf3('0x47')](function(_0x5a3618){logger['error'](_0xdbf3('0x54'),_0x5a3618);throw _0x5a3618;});}return _0x23b81d;})[_0xdbf3('0x2b')](respondWithResult(_0x570b22,0xc9))['catch'](handleError(_0x570b22,null));};exports[_0xdbf3('0x29')]=function(_0x24e6cd,_0x519c1d){if(_0x24e6cd['body']['id']){delete _0x24e6cd['body']['id'];}return db['CmList'][_0xdbf3('0x4c')]({'where':{'id':_0x24e6cd[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x519c1d,null))[_0xdbf3('0x2b')](saveUpdates(_0x24e6cd[_0xdbf3('0x4e')],null))[_0xdbf3('0x2b')](respondWithResult(_0x519c1d,null))['catch'](handleError(_0x519c1d,null));};exports[_0xdbf3('0x2a')]=function(_0x59f55d,_0x1f132c){return db[_0xdbf3('0x32')]['find']({'where':{'id':_0x59f55d[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x1f132c,null))[_0xdbf3('0x2b')](removeEntity(_0x1f132c,null))[_0xdbf3('0x47')](handleError(_0x1f132c,null));};exports[_0xdbf3('0x56')]=function(_0x3d2350,_0x234c51){return db[_0xdbf3('0x32')][_0xdbf3('0x56')]()[_0xdbf3('0x2b')](respondWithResult(_0x234c51,null))[_0xdbf3('0x47')](handleError(_0x234c51,null));};exports[_0xdbf3('0x57')]=function(_0x45fba9,_0x231ebe,_0x350d6c){if(_0x45fba9[_0xdbf3('0x4e')]['id']){delete _0x45fba9[_0xdbf3('0x4e')]['id'];}return db[_0xdbf3('0x32')][_0xdbf3('0x4c')]({'where':{'id':_0x45fba9['params']['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x231ebe,null))[_0xdbf3('0x2b')](function(_0x270cd9){if(_0x270cd9){_0x45fba9['body'][_0xdbf3('0x58')]=_0x270cd9['id'];return db[_0xdbf3('0x59')][_0xdbf3('0x4d')](_0x45fba9['body']);}})[_0xdbf3('0x2b')](respondWithResult(_0x231ebe,null))['catch'](handleError(_0x231ebe,null));};exports[_0xdbf3('0x5a')]=function(_0x184906,_0x1e2aff,_0x3535ca){var _0x67afff={'raw':![],'where':{}};var _0xff691b={};var _0x169695={'count':0x0,'rows':[]};return db[_0xdbf3('0x32')][_0xdbf3('0x5b')]({'where':{'id':_0x184906[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x1e2aff,null))[_0xdbf3('0x2b')](function(_0x468397){if(_0x468397){_0xff691b[_0xdbf3('0x36')]=_['keys'](db['Disposition'][_0xdbf3('0x33')]);_0xff691b[_0xdbf3('0x38')]=_[_0xdbf3('0x39')](_0x184906[_0xdbf3('0x38')]);_0xff691b['filters']=_[_0xdbf3('0x3b')](_0xff691b['model'],_0xff691b['query']);_0x67afff['attributes']=_['intersection'](_0xff691b[_0xdbf3('0x36')],qs[_0xdbf3('0x3d')](_0x184906['query'][_0xdbf3('0x3d')]));_0x67afff[_0xdbf3('0x3c')]=_0x67afff[_0xdbf3('0x3c')]['length']?_0x67afff[_0xdbf3('0x3c')]:_0xff691b[_0xdbf3('0x36')];if(!_0x184906['query']['hasOwnProperty'](_0xdbf3('0x5c'))){_0x67afff[_0xdbf3('0x24')]=qs['limit'](_0x184906[_0xdbf3('0x38')]['limit']);_0x67afff[_0xdbf3('0x23')]=qs['offset'](_0x184906[_0xdbf3('0x38')]['offset']);}_0x67afff[_0xdbf3('0x5d')]=qs['sort'](_0x184906[_0xdbf3('0x38')][_0xdbf3('0x40')]);_0x67afff[_0xdbf3('0x41')]=qs['filters'](_[_0xdbf3('0x42')](_0x184906[_0xdbf3('0x38')],_0xff691b[_0xdbf3('0x3a')]));_0x67afff[_0xdbf3('0x41')][_0xdbf3('0x58')]=_0x468397['id'];if(_0x184906['query'][_0xdbf3('0x43')]){_0x67afff['where']=_[_0xdbf3('0x4a')](_0x67afff[_0xdbf3('0x41')],{'$or':_[_0xdbf3('0x31')](_0x67afff[_0xdbf3('0x3c')],function(_0xf81132){var _0x2154fe={};_0x2154fe[_0xf81132]={'$like':'%'+_0x184906[_0xdbf3('0x38')]['filter']+'%'};return _0x2154fe;})});}_0x67afff=_[_0xdbf3('0x4a')]({},_0x67afff,_0x184906[_0xdbf3('0x4b')]);return db[_0xdbf3('0x59')]['count']({'where':_0x67afff[_0xdbf3('0x41')]})[_0xdbf3('0x2b')](function(_0xaff07c){_0x169695[_0xdbf3('0x26')]=_0xaff07c;if(_0x184906[_0xdbf3('0x38')][_0xdbf3('0x49')]){_0x67afff[_0xdbf3('0x44')]=[{'all':!![]}];}return db[_0xdbf3('0x59')]['findAll'](_0x67afff);})[_0xdbf3('0x2b')](function(_0x2482d1){_0x169695[_0xdbf3('0x46')]=_0x2482d1;return _0x169695;});}})[_0xdbf3('0x2b')](respondWithFilteredResult(_0x1e2aff,_0x67afff))['catch'](handleError(_0x1e2aff,null));};exports[_0xdbf3('0x5e')]=function(_0x1c68fc,_0x5a2caf,_0x1186cd){return db[_0xdbf3('0x32')][_0xdbf3('0x4c')]({'where':{'id':_0x1c68fc['params']['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x5a2caf,null))[_0xdbf3('0x2b')](function(_0x4f5b05){if(_0x4f5b05){return _0x4f5b05[_0xdbf3('0x5e')](_0x1c68fc['query'][_0xdbf3('0x5f')]);}})[_0xdbf3('0x2b')](respondWithStatusCode(_0x5a2caf,null))[_0xdbf3('0x47')](handleError(_0x5a2caf,null));};exports[_0xdbf3('0x60')]=function(_0xd4c699,_0x4a6d0c,_0x90de9e){return db['CmList'][_0xdbf3('0x4c')]({'where':{'id':_0xd4c699[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x4a6d0c,null))[_0xdbf3('0x2b')](function(_0x47cd85){if(_0x47cd85){var _0x48535e=[];var _0x5d3532={'success':[],'errors':[]};return db['CmContact'][_0xdbf3('0x56')]()[_0xdbf3('0x2b')](function(_0x34cb4c){if(_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')]&&_[_0xdbf3('0x62')](_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')])){if(_0xd4c699['body']['tags'][_0xdbf3('0x3e')]){_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')]=_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')][_0xdbf3('0x63')](';')+';';}else{_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')]=null;}}else{_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x61')]=null;}if(_0xd4c699['body']&&_[_0xdbf3('0x62')](_0xd4c699[_0xdbf3('0x4e')])){for(var _0x4d9e8a=0x0;_0x4d9e8a<_0xd4c699[_0xdbf3('0x4e')][_0xdbf3('0x3e')];_0x4d9e8a+=0x1){_0xd4c699[_0xdbf3('0x4e')][_0x4d9e8a]['ListId']=_0xd4c699[_0xdbf3('0x55')]['id'];_0x48535e[_0xdbf3('0x64')](_0xd4c699[_0xdbf3('0x4e')][_0x4d9e8a]);}return BPromise[_0xdbf3('0x65')](_0x48535e,function(_0x2ba0c0){return db['CmContact'][_0xdbf3('0x4d')](_[_0xdbf3('0x66')](_0x2ba0c0,['ids','id'])||{},{'fields':_[_0xdbf3('0x39')](_0x34cb4c),'raw':!![]})[_0xdbf3('0x2b')](function(_0x24d341){_0x5d3532['success'][_0xdbf3('0x64')](_0x24d341[_0xdbf3('0x67')]);})[_0xdbf3('0x47')](function(_0x1d1cf2){_0x5d3532[_0xdbf3('0x68')][_0xdbf3('0x64')]({'data':_0x2ba0c0,'error':_0x1d1cf2[_0xdbf3('0x69')]});});})['then'](function(_0x3cbc8a){return _0x5d3532;})['catch'](function(_0x4f82fd){return _0x4f82fd;});}else{_0x4a6d0c[_0xdbf3('0x20')](0x190)[_0xdbf3('0x22')]({'message':_0xdbf3('0x6a')});}});}})[_0xdbf3('0x2b')](respondWithResult(_0x4a6d0c,null))[_0xdbf3('0x47')](handleError(_0x4a6d0c,null));};exports[_0xdbf3('0x6b')]=function(_0x527ad5,_0x176342,_0x4c2324){var _0x2dfe78;return db[_0xdbf3('0x32')]['find']({'where':{'id':_0x527ad5[_0xdbf3('0x55')]['id']},'include':[{'model':db[_0xdbf3('0x6c')],'as':_0xdbf3('0x6d')}]})[_0xdbf3('0x2b')](handleEntityNotFound(_0x176342,null))[_0xdbf3('0x2b')](function(_0x2671c3){if(_0x2671c3){_0x2dfe78=_0x2671c3;return db[_0xdbf3('0x6e')][_0xdbf3('0x33')];}})['then'](function(_0x371e82){if(_0x371e82){var _0xbafc6a={};var _0x20d7cb={};_0x20d7cb[_0xdbf3('0x36')]=_['concat'](_['keys'](_0x371e82),_[_0xdbf3('0x31')](_0x2dfe78['CustomFields'],function(_0x39218e){return util['format'](_0xdbf3('0x6f'),_0x39218e['id']);}));_0x20d7cb[_0xdbf3('0x38')]=_[_0xdbf3('0x39')](_0x527ad5[_0xdbf3('0x38')]);_0x20d7cb[_0xdbf3('0x3a')]=_[_0xdbf3('0x3b')](_0x20d7cb[_0xdbf3('0x36')],_0x20d7cb[_0xdbf3('0x38')]);_0xbafc6a['attributes']=_[_0xdbf3('0x3b')](_0x20d7cb[_0xdbf3('0x36')],qs[_0xdbf3('0x3d')](_0x527ad5[_0xdbf3('0x38')][_0xdbf3('0x3d')]));_0xbafc6a[_0xdbf3('0x3c')]=_0xbafc6a[_0xdbf3('0x3c')][_0xdbf3('0x3e')]?_0xbafc6a[_0xdbf3('0x3c')]:_0x20d7cb[_0xdbf3('0x36')];if(!_0x527ad5[_0xdbf3('0x38')]['hasOwnProperty']('nolimit')){_0xbafc6a[_0xdbf3('0x24')]=qs[_0xdbf3('0x24')](_0x527ad5[_0xdbf3('0x38')][_0xdbf3('0x24')]);_0xbafc6a['offset']=qs[_0xdbf3('0x23')](_0x527ad5['query'][_0xdbf3('0x23')]);}_0xbafc6a['order']=qs[_0xdbf3('0x40')](_0x527ad5[_0xdbf3('0x38')][_0xdbf3('0x40')]);_0xbafc6a[_0xdbf3('0x41')]=qs[_0xdbf3('0x3a')](_[_0xdbf3('0x42')](_0x527ad5['query'],_0x20d7cb['filters']));_0xbafc6a[_0xdbf3('0x70')]=!![];if(_0x527ad5[_0xdbf3('0x38')][_0xdbf3('0x43')]){_0xbafc6a[_0xdbf3('0x41')]=_[_0xdbf3('0x4a')](_0xbafc6a[_0xdbf3('0x41')],{'$or':_[_0xdbf3('0x31')](_0xbafc6a['attributes'],function(_0x4fa354){var _0x80468={};_0x80468[_0x4fa354]={'$like':'%'+_0x527ad5[_0xdbf3('0x38')][_0xdbf3('0x43')]+'%'};return _0x80468;})});}_0xbafc6a=_[_0xdbf3('0x4a')]({},_0xbafc6a,_0x527ad5['options']);return _0x2dfe78[_0xdbf3('0x6b')](_0xbafc6a);}})[_0xdbf3('0x2b')](respondWithResult(_0x176342,null))[_0xdbf3('0x47')](handleError(_0x176342,null));};exports[_0xdbf3('0x71')]=function(_0x334572,_0x1572d4,_0x4cbe25){var _0x2f01b0;var _0xf30a0b;var _0x1e462a;var _0x4dd2dc=_0x334572[_0xdbf3('0x55')]['id'];csv_results=[];return db['ContactItemType'][_0xdbf3('0x45')]({'attributes':['id',_0xdbf3('0x37')],'raw':!![],'order':[_0xdbf3('0x72')]})[_0xdbf3('0x2b')](function(_0x40fe1f){_0x2f01b0=_0x40fe1f;var _0x585033=_['keys'](db[_0xdbf3('0x6e')]['rawAttributes']);return db['CmCustomField'][_0xdbf3('0x45')]({'raw':!![],'attributes':['id','alias']})[_0xdbf3('0x2b')](function(_0x4b1df7){_0xf30a0b=_0x4b1df7;var _0x595032=squel[_0xdbf3('0x73')]()[_0xdbf3('0x3d')](_0x585033)['from'](_0xdbf3('0x74'),'c')[_0xdbf3('0x41')](_0xdbf3('0x75'),_0x4dd2dc)['where'](_0xdbf3('0x76'))[_0xdbf3('0x77')]();for(var _0x406641=0x0;_0x406641<_0xf30a0b[_0xdbf3('0x3e')];_0x406641++){_0x595032[_0xdbf3('0x78')]('c.cf_'+_0xf30a0b[_0x406641]['id'],'customField_'+_0xf30a0b[_0x406641]['alias']);}for(var _0x406641=0x0;_0x406641<_0x2f01b0[_0xdbf3('0x3e')];_0x406641++){_0x595032[_0xdbf3('0x78')](squel[_0xdbf3('0x73')]()[_0xdbf3('0x78')](_0xdbf3('0x79'))[_0xdbf3('0x7a')](_0xdbf3('0x7b'))[_0xdbf3('0x41')](_0xdbf3('0x7c'),_0x2f01b0[_0x406641]['id'])[_0xdbf3('0x41')](_0xdbf3('0x7d')),_0xdbf3('0x7e')+_0x2f01b0[_0x406641]['name']);_0x595032['field'](squel[_0xdbf3('0x73')]()[_0xdbf3('0x78')](_0xdbf3('0x7f'))[_0xdbf3('0x7a')]('cm_contact_has_items')[_0xdbf3('0x41')](_0xdbf3('0x7c'),_0x2f01b0[_0x406641]['id'])[_0xdbf3('0x41')]('CmContactId\x20=\x20c.id'),_0xdbf3('0x80')+_0x2f01b0[_0x406641][_0xdbf3('0x37')]);}var _0x33ce14=[];_0x33ce14[_0xdbf3('0x64')](_0x595032[_0xdbf3('0x81')]());BPromise['each'](_0x33ce14,handleQuery)[_0xdbf3('0x2b')](function(_0x4088ed){handleQuery(_0x595032[_0xdbf3('0x81')]());var _0x4c111a=csv_results[0x0];if(!_[_0xdbf3('0x82')](_0x4c111a)){var _0x5bb959=toCsv(_0x4c111a);var _0x1be169=Date[_0xdbf3('0x83')]();fs[_0xdbf3('0x84')](util[_0xdbf3('0x85')](_0xdbf3('0x86'),_0x4dd2dc,_0x1be169),_0x5bb959);_0x1572d4[_0xdbf3('0x87')](_0xdbf3('0x88'),_0xdbf3('0x89')+util[_0xdbf3('0x85')](_0xdbf3('0x8a'),_0x4dd2dc,_0x1be169));_0x1572d4[_0xdbf3('0x87')]('Content-type',_0xdbf3('0x8b'));return _0x1572d4['download'](util[_0xdbf3('0x85')](_0xdbf3('0x86'),_0x4dd2dc,_0x1be169));}else{return _0x1572d4[_0xdbf3('0x1f')](0xcc);}});});});};exports[_0xdbf3('0x8c')]=function(_0x99d2be,_0x28c222,_0x121c5c){var _0x381c09;delete _0x99d2be[_0xdbf3('0x4e')]['id'];return db[_0xdbf3('0x32')][_0xdbf3('0x5b')]({'where':{'id':_0x99d2be[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x28c222,null))['then'](function(_0x2d315a){if(_0x2d315a){return db[_0xdbf3('0x8d')][_0xdbf3('0x8e')](function(_0x5af9dc){return db[_0xdbf3('0x6c')][_0xdbf3('0x4d')](_0x99d2be[_0xdbf3('0x4e')],{'transaction':_0x5af9dc})[_0xdbf3('0x2b')](function(_0x1b9807){_0x381c09=_0x1b9807;return _0x2d315a[_0xdbf3('0x8f')](_0x1b9807,{'transaction':_0x5af9dc});})[_0xdbf3('0x2b')](function(){var _0x4b241e={'type':db[_0xdbf3('0x90')]['TEXT'],'transaction':_0x5af9dc};switch(_0x99d2be[_0xdbf3('0x4e')][_0xdbf3('0x34')]){case _0xdbf3('0x91'):_0x4b241e[_0xdbf3('0x34')]=db[_0xdbf3('0x90')][_0xdbf3('0x92')];break;case _0xdbf3('0x93'):_0x4b241e[_0xdbf3('0x34')]=db['Sequelize'][_0xdbf3('0x94')];break;case _0xdbf3('0x95'):_0x4b241e[_0xdbf3('0x34')]=db[_0xdbf3('0x90')][_0xdbf3('0x96')];_0x4b241e['defaultValue']=![];break;default:}return db[_0xdbf3('0x8d')][_0xdbf3('0x97')]['addColumn']('cm_contacts',util[_0xdbf3('0x85')](_0xdbf3('0x98'),_0x381c09['id']),_0x4b241e);})[_0xdbf3('0x2b')](function(){return _0x381c09;});});}})[_0xdbf3('0x2b')](respondWithResult(_0x28c222,null))[_0xdbf3('0x47')](handleError(_0x28c222,null));};exports[_0xdbf3('0x99')]=function(_0xdd0245,_0x2075cc,_0x35facc){var _0x2c63b9={};var _0x465c8b={};var _0x2e592c;var _0xce6fc0;return db[_0xdbf3('0x32')][_0xdbf3('0x5b')]({'where':{'id':_0xdd0245[_0xdbf3('0x55')]['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x2075cc,null))[_0xdbf3('0x2b')](function(_0xe8e8f0){if(_0xe8e8f0){_0x2e592c=_0xe8e8f0;_0x465c8b[_0xdbf3('0x36')]=_[_0xdbf3('0x39')](db[_0xdbf3('0x6c')]['rawAttributes']);_0x465c8b['query']=_[_0xdbf3('0x39')](_0xdd0245[_0xdbf3('0x38')]);_0x465c8b[_0xdbf3('0x3a')]=_[_0xdbf3('0x3b')](_0x465c8b[_0xdbf3('0x36')],_0x465c8b['query']);_0x2c63b9[_0xdbf3('0x3c')]=_[_0xdbf3('0x3b')](_0x465c8b['model'],qs[_0xdbf3('0x3d')](_0xdd0245[_0xdbf3('0x38')]['fields']));_0x2c63b9['attributes']=_0x2c63b9['attributes'][_0xdbf3('0x3e')]?_0x2c63b9[_0xdbf3('0x3c')]:_0x465c8b['model'];_0x2c63b9[_0xdbf3('0x5d')]=qs[_0xdbf3('0x40')](_0xdd0245[_0xdbf3('0x38')]['sort']);_0x2c63b9['where']=qs['filters'](_[_0xdbf3('0x42')](_0xdd0245['query'],_0x465c8b[_0xdbf3('0x3a')]));_0x2c63b9[_0xdbf3('0x41')]=_['merge'](_0x2c63b9['where'],{'$or':[{'ListId':_0xe8e8f0['id']},{'ListId':null}]});if(_0xdd0245[_0xdbf3('0x38')][_0xdbf3('0x43')]){_0x2c63b9['where']=_[_0xdbf3('0x4a')](_0x2c63b9[_0xdbf3('0x41')],{'$or':_[_0xdbf3('0x31')](_0x2c63b9[_0xdbf3('0x3c')],function(_0x2d719e){var _0x4a3b74={};_0x4a3b74[_0x2d719e]={'$like':'%'+_0xdd0245['query'][_0xdbf3('0x43')]+'%'};return _0x4a3b74;})});}_0x2c63b9=_[_0xdbf3('0x4a')]({},_0x2c63b9,_0xdd0245[_0xdbf3('0x4b')]);return db[_0xdbf3('0x6c')][_0xdbf3('0x9a')](_0x2c63b9);}})[_0xdbf3('0x2b')](respondWithResult(_0x2075cc,null))[_0xdbf3('0x47')](handleError(_0x2075cc,null));};exports[_0xdbf3('0x9b')]=function(_0x5b8b65,_0x5d68cd){return db[_0xdbf3('0x6c')][_0xdbf3('0x9a')]({'where':{'ListId':null}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x5d68cd,null))[_0xdbf3('0x2b')](function(_0x59ffb5){return _0x59ffb5;})[_0xdbf3('0x2b')](respondWithResult(_0x5d68cd,null))[_0xdbf3('0x47')](handleError(_0x5d68cd,null));};exports[_0xdbf3('0x9c')]=function(_0x1b36ec,_0x189eed,_0xcc89a7){return db[_0xdbf3('0x32')][_0xdbf3('0x4c')]({'where':{'id':_0x1b36ec['params']['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x189eed,null))[_0xdbf3('0x2b')](function(_0x5bfaed){if(_0x5bfaed){return _0x5bfaed[_0xdbf3('0x9c')](_0x1b36ec[_0xdbf3('0x4e')][_0xdbf3('0x5f')],_[_0xdbf3('0x66')](_0x1b36ec['body'],[_0xdbf3('0x5f'),'id'])||{})[_0xdbf3('0x9d')](function(_0x4d22ea){for(var _0x5138b6=0x0;_0x5138b6<_0x1b36ec[_0xdbf3('0x4e')][_0xdbf3('0x5f')]['length'];_0x5138b6+=0x1){socket[_0xdbf3('0x9e')](_0xdbf3('0x9f'),{'UserId':Number(_0x1b36ec[_0xdbf3('0x4e')]['ids'][_0x5138b6]),'CmListId':Number(_0x1b36ec['params']['id'])});}return _0x4d22ea;});}})[_0xdbf3('0x2b')](respondWithResult(_0x189eed,null))[_0xdbf3('0x47')](handleError(_0x189eed,null));};exports[_0xdbf3('0xa0')]=function(_0x29ed3b,_0x7ae3a0,_0x459d0b){return db[_0xdbf3('0x32')][_0xdbf3('0x4c')]({'where':{'id':_0x29ed3b['params']['id']}})[_0xdbf3('0x2b')](handleEntityNotFound(_0x7ae3a0,null))[_0xdbf3('0x2b')](function(_0x31194c){if(_0x31194c){return _0x31194c[_0xdbf3('0xa0')](_0x29ed3b['query'][_0xdbf3('0x5f')])[_0xdbf3('0x2b')](function(){if(_[_0xdbf3('0x62')](_0x29ed3b[_0xdbf3('0x38')]['ids'])){for(var _0x3605e0=0x0;_0x3605e0<_0x29ed3b[_0xdbf3('0x38')][_0xdbf3('0x5f')][_0xdbf3('0x3e')];_0x3605e0+=0x1){socket[_0xdbf3('0x9e')](_0xdbf3('0xa1'),{'UserId':Number(_0x29ed3b[_0xdbf3('0x38')][_0xdbf3('0x5f')][_0x3605e0]),'CmListId':Number(_0x29ed3b[_0xdbf3('0x55')]['id'])});}}else{socket['emit'](_0xdbf3('0xa1'),{'UserId':Number(_0x29ed3b[_0xdbf3('0x38')][_0xdbf3('0x5f')]),'CmListId':Number(_0x29ed3b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7ae3a0,null))[_0xdbf3('0x47')](handleError(_0x7ae3a0,null));};exports['getAgents']=function(_0x564d0d,_0x44631b,_0x1fb6d7){var _0x156cb={};var _0x548233={};var _0x469408;var _0x4f0e3b;return db[_0xdbf3('0x32')][_0xdbf3('0x5b')]({'where':{'id':_0x564d0d['params']['id']}})['then'](handleEntityNotFound(_0x44631b,null))[_0xdbf3('0x2b')](function(_0x4789b9){if(_0x4789b9){_0x469408=_0x4789b9;_0x548233['model']=_[_0xdbf3('0x39')](db[_0xdbf3('0xa2')]['rawAttributes']);_0x548233[_0xdbf3('0x38')]=_[_0xdbf3('0x39')](_0x564d0d[_0xdbf3('0x38')]);_0x548233[_0xdbf3('0x3a')]=_['intersection'](_0x548233['model'],_0x548233['query']);_0x156cb[_0xdbf3('0x3c')]=_[_0xdbf3('0x3b')](_0x548233[_0xdbf3('0x36')],qs['fields'](_0x564d0d[_0xdbf3('0x38')][_0xdbf3('0x3d')]));_0x156cb['attributes']=_0x156cb[_0xdbf3('0x3c')][_0xdbf3('0x3e')]?_0x156cb[_0xdbf3('0x3c')]:_0x548233[_0xdbf3('0x36')];_0x156cb[_0xdbf3('0x5d')]=qs[_0xdbf3('0x40')](_0x564d0d[_0xdbf3('0x38')][_0xdbf3('0x40')]);_0x156cb['where']=qs[_0xdbf3('0x3a')](_[_0xdbf3('0x42')](_0x564d0d[_0xdbf3('0x38')],_0x548233['filters']));if(_0x564d0d['query']['filter']){_0x156cb[_0xdbf3('0x41')]=_[_0xdbf3('0x4a')](_0x156cb[_0xdbf3('0x41')],{'$or':_['map'](_0x156cb['attributes'],function(_0x23de18){var _0x32c235={};_0x32c235[_0x23de18]={'$like':'%'+_0x564d0d['query']['filter']+'%'};return _0x32c235;})});}_0x156cb=_[_0xdbf3('0x4a')]({},_0x156cb,_0x564d0d['options']);return _0x469408[_0xdbf3('0xa3')](_0x156cb);}})['then'](function(_0x373d46){if(_0x373d46){_0x4f0e3b=_0x373d46[_0xdbf3('0x3e')];if(!_0x564d0d[_0xdbf3('0x38')][_0xdbf3('0x3f')](_0xdbf3('0x5c'))){_0x156cb[_0xdbf3('0x24')]=qs[_0xdbf3('0x24')](_0x564d0d[_0xdbf3('0x38')][_0xdbf3('0x24')]);_0x156cb[_0xdbf3('0x23')]=qs['offset'](_0x564d0d['query'][_0xdbf3('0x23')]);}return _0x469408[_0xdbf3('0xa3')](_0x156cb);}})[_0xdbf3('0x2b')](function(_0x243443){if(_0x243443){return _0x243443?{'count':_0x4f0e3b,'rows':_0x243443}:null;}})['then'](respondWithResult(_0x44631b,null))[_0xdbf3('0x47')](handleError(_0x44631b,null));};function handleQuery(_0x2d9190){logger[_0xdbf3('0xa4')](_0x2d9190);return db[_0xdbf3('0x8d')]['query'](_0x2d9190)[_0xdbf3('0x9d')](function(_0x11920f){csv_results['push'](_0x11920f);})['catch'](function(_0x1cb909){logger['error'](_0x1cb909[_0xdbf3('0x69')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6952d84..c421a7a 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x68cd52,_0x14f980){var _0x386d35=function(_0x5ab6c4){while(--_0x5ab6c4){_0x68cd52['push'](_0x68cd52['shift']());}};_0x386d35(++_0x14f980);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2529df,_0x3ca0b7){_0x2529df=_0x2529df-0x0;var _0x3d30bd=_0x3e74[_0x2529df];return _0x3d30bd;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5b72bbb..7b60afb 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x4a7015,_0x2549de){var _0x3ac494=function(_0x1c67ca){while(--_0x1c67ca){_0x4a7015['push'](_0x4a7015['shift']());}};_0x3ac494(++_0x2549de);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x1a4670,_0x28b96b){var _0x34b340=function(_0x5d0cab){while(--_0x5d0cab){_0x1a4670['push'](_0x1a4670['shift']());}};_0x34b340(++_0x28b96b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 0942afb..516de53 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 _0xf0bf=['message','CmList,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','error'];(function(_0x109494,_0x5e9981){var _0x3953b5=function(_0x52a391){while(--_0x52a391){_0x109494['push'](_0x109494['shift']());}};_0x3953b5(++_0x5e9981);}(_0xf0bf,0x64));var _0xff0b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf0bf[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xff0b('0x0'));var moment=require(_0xff0b('0x1'));var BPromise=require(_0xff0b('0x2'));var rs=require(_0xff0b('0x3'));var fs=require('fs');var Redis=require(_0xff0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff0b('0x5'))(_0xff0b('0x6'));var config=require(_0xff0b('0x7'));var jayson=require(_0xff0b('0x8'));var client=jayson[_0xff0b('0x9')][_0xff0b('0xa')]({'port':0x232a});config['redis']=_[_0xff0b('0xb')](config[_0xff0b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xff0b('0xd'))(new Redis(config['redis']));require(_0xff0b('0xe'))['register'](socket);function respondWithRpcPromise(_0x15cf9f,_0x34b2f3,_0x54a5fd){return new BPromise(function(_0x484184,_0x3f4b51){return client['request'](_0x15cf9f,_0x54a5fd)[_0xff0b('0xf')](function(_0x570a77){logger[_0xff0b('0x10')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0xff0b('0x11'));logger[_0xff0b('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x34b2f3,_0xff0b('0x11'),JSON['stringify'](_0x570a77));if(_0x570a77[_0xff0b('0x13')]){if(_0x570a77[_0xff0b('0x13')]['code']===0x1f4){logger[_0xff0b('0x13')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);return _0x3f4b51(_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);}logger[_0xff0b('0x13')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0x570a77[_0xff0b('0x13')]['message']);return _0x484184(_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);}else{logger[_0xff0b('0x10')](_0xff0b('0x15'),_0x34b2f3,'request\x20sent');_0x484184(_0x570a77[_0xff0b('0x16')][_0xff0b('0x14')]);}})[_0xff0b('0x17')](function(_0x45267a){logger['error'](_0xff0b('0x15'),_0x34b2f3,_0x45267a);_0x3f4b51(_0x45267a);});});} \ No newline at end of file +var _0x356b=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x356b,0xc9));var _0xb356=function(_0x5abfbc,_0x15b1c2){_0x5abfbc=_0x5abfbc-0x0;var _0x1d230f=_0x356b[_0x5abfbc];return _0x1d230f;};'use strict';var _=require(_0xb356('0x0'));var util=require('util');var moment=require(_0xb356('0x1'));var BPromise=require(_0xb356('0x2'));var rs=require(_0xb356('0x3'));var fs=require('fs');var Redis=require(_0xb356('0x4'));var db=require(_0xb356('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb356('0x6'))('rpc');var config=require(_0xb356('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb356('0x8')]({'port':0x232a});config[_0xb356('0x9')]=_['defaults'](config[_0xb356('0x9')],{'host':_0xb356('0xa'),'port':0x18eb});var socket=require(_0xb356('0xb'))(new Redis(config[_0xb356('0x9')]));require(_0xb356('0xc'))[_0xb356('0xd')](socket);function respondWithRpcPromise(_0x168401,_0x3df43f,_0x2720af){return new BPromise(function(_0x2b6ec9,_0x41ed7d){return client[_0xb356('0xe')](_0x168401,_0x2720af)[_0xb356('0xf')](function(_0x448eeb){logger['info'](_0xb356('0x10'),_0x3df43f,_0xb356('0x11'));logger[_0xb356('0x12')](_0xb356('0x13'),_0x3df43f,_0xb356('0x11'),JSON[_0xb356('0x14')](_0x448eeb));if(_0x448eeb['error']){if(_0x448eeb[_0xb356('0x15')][_0xb356('0x16')]===0x1f4){logger[_0xb356('0x15')](_0xb356('0x10'),_0x3df43f,_0x448eeb[_0xb356('0x15')][_0xb356('0x17')]);return _0x41ed7d(_0x448eeb[_0xb356('0x15')][_0xb356('0x17')]);}logger[_0xb356('0x15')](_0xb356('0x10'),_0x3df43f,_0x448eeb['error'][_0xb356('0x17')]);return _0x2b6ec9(_0x448eeb[_0xb356('0x15')][_0xb356('0x17')]);}else{logger['info'](_0xb356('0x10'),_0x3df43f,_0xb356('0x11'));_0x2b6ec9(_0x448eeb['result'][_0xb356('0x17')]);}})[_0xb356('0x18')](function(_0x412434){logger[_0xb356('0x15')](_0xb356('0x10'),_0x3df43f,_0x412434);_0x41ed7d(_0x412434);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6d90a1a..5deaa7b 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 _0x7be4=['./cmList.events','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x2cbb74,_0x241c10){var _0xa6d18=function(_0x5a2940){while(--_0x5a2940){_0x2cbb74['push'](_0x2cbb74['shift']());}};_0xa6d18(++_0x241c10);}(_0x7be4,0x1c8));var _0x47be=function(_0x1cd426,_0x2e4c3e){_0x1cd426=_0x1cd426-0x0;var _0x92fd89=_0x7be4[_0x1cd426];return _0x92fd89;};'use strict';var CmListEvents=require(_0x47be('0x0'));var events=['save',_0x47be('0x1'),_0x47be('0x2')];function createListener(_0x773963,_0x3e2751){return function(_0x39d1c0){_0x3e2751[_0x47be('0x3')](_0x773963,_0x39d1c0);};}function removeListener(_0x12860d,_0x3c7244){return function(){CmListEvents[_0x47be('0x4')](_0x12860d,_0x3c7244);};}exports[_0x47be('0x5')]=function(_0x47e08e){for(var _0x11a17c=0x0,_0x2bb267=events[_0x47be('0x6')];_0x11a17c<_0x2bb267;_0x11a17c++){var _0x28929d=events[_0x11a17c];var _0x30ef58=createListener(_0x47be('0x7')+_0x28929d,_0x47e08e);CmListEvents['on'](_0x28929d,_0x30ef58);}}; \ No newline at end of file +var _0xc7d7=['remove','update','emit','register','length','cmList:','./cmList.events','save'];(function(_0xfc3f80,_0x4e8c1a){var _0x2f19d8=function(_0x207373){while(--_0x207373){_0xfc3f80['push'](_0xfc3f80['shift']());}};_0x2f19d8(++_0x4e8c1a);}(_0xc7d7,0x18e));var _0x7c7d=function(_0x5698f3,_0x15bdab){_0x5698f3=_0x5698f3-0x0;var _0x157252=_0xc7d7[_0x5698f3];return _0x157252;};'use strict';var CmListEvents=require(_0x7c7d('0x0'));var events=[_0x7c7d('0x1'),_0x7c7d('0x2'),_0x7c7d('0x3')];function createListener(_0x233913,_0x3782d2){return function(_0xd53b5c){_0x3782d2[_0x7c7d('0x4')](_0x233913,_0xd53b5c);};}function removeListener(_0x413315,_0x4cbac2){return function(){CmListEvents['removeListener'](_0x413315,_0x4cbac2);};}exports[_0x7c7d('0x5')]=function(_0x3c3987){for(var _0x4d7137=0x0,_0x556262=events[_0x7c7d('0x6')];_0x4d7137<_0x556262;_0x4d7137++){var _0x54a9aa=events[_0x4d7137];var _0x3f40cb=createListener(_0x7c7d('0x7')+_0x54a9aa,_0x3c3987);CmListEvents['on'](_0x54a9aa,_0x3f40cb);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fc5dabb..77c7175 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 _0x9fca=['get','/global_fields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index'];(function(_0x5c3e7c,_0x39ca9e){var _0x40cdf0=function(_0x251ddc){while(--_0x251ddc){_0x5c3e7c['push'](_0x5c3e7c['shift']());}};_0x40cdf0(++_0x39ca9e);}(_0x9fca,0x7f));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa9fc('0x0'));var util=require(_0xa9fc('0x1'));var path=require(_0xa9fc('0x2'));var timeout=require(_0xa9fc('0x3'));var express=require(_0xa9fc('0x4'));var router=express[_0xa9fc('0x5')]();var fs_extra=require(_0xa9fc('0x6'));var auth=require(_0xa9fc('0x7'));var interaction=require(_0xa9fc('0x8'));var config=require(_0xa9fc('0x9'));var controller=require(_0xa9fc('0xa'));router['get']('/',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0xc')]);router[_0xa9fc('0xd')]('/describe',auth[_0xa9fc('0xb')](),controller['describe']);router[_0xa9fc('0xd')](_0xa9fc('0xe'),auth[_0xa9fc('0xb')](),controller['getGlobalCustomFields']);router[_0xa9fc('0xd')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x10')]);router['get']('/:id/dispositions',auth[_0xa9fc('0xb')](),controller['getDispositions']);router[_0xa9fc('0xd')](_0xa9fc('0x11'),auth['isAuthenticated'](),controller[_0xa9fc('0x12')]);router[_0xa9fc('0xd')](_0xa9fc('0x13'),auth['isAuthenticated'](),controller[_0xa9fc('0x14')]);router[_0xa9fc('0xd')](_0xa9fc('0x15'),auth[_0xa9fc('0xb')](),controller['getCustomFields']);router[_0xa9fc('0xd')](_0xa9fc('0x16'),auth[_0xa9fc('0xb')](),controller['getAgents']);router[_0xa9fc('0x17')]('/',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x18')]);router[_0xa9fc('0x17')](_0xa9fc('0x19'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1a')]);router[_0xa9fc('0x17')](_0xa9fc('0x11'),auth['isAuthenticated'](),controller[_0xa9fc('0x1b')]);router[_0xa9fc('0x17')](_0xa9fc('0x15'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1c')]);router[_0xa9fc('0x17')](_0xa9fc('0x16'),auth['isAuthenticated'](),controller[_0xa9fc('0x1d')]);router[_0xa9fc('0x1e')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1f')]);router[_0xa9fc('0x20')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x21')]);router[_0xa9fc('0x20')](_0xa9fc('0x19'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa9fc('0x20')](_0xa9fc('0x16'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x22')]);module['exports']=router; \ No newline at end of file +var _0x1f61=['addDisposition','addContacts','addAgents','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post'];(function(_0x555ffe,_0x206b3e){var _0x4eae39=function(_0x1353e3){while(--_0x1353e3){_0x555ffe['push'](_0x555ffe['shift']());}};_0x4eae39(++_0x206b3e);}(_0x1f61,0x14c));var _0x11f6=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0x1f61[_0x1da10a];return _0x5aea64;};'use strict';var multer=require(_0x11f6('0x0'));var util=require('util');var path=require(_0x11f6('0x1'));var timeout=require(_0x11f6('0x2'));var express=require(_0x11f6('0x3'));var router=express['Router']();var fs_extra=require(_0x11f6('0x4'));var auth=require(_0x11f6('0x5'));var interaction=require(_0x11f6('0x6'));var config=require(_0x11f6('0x7'));var controller=require(_0x11f6('0x8'));router['get']('/',auth[_0x11f6('0x9')](),controller[_0x11f6('0xa')]);router[_0x11f6('0xb')](_0x11f6('0xc'),auth[_0x11f6('0x9')](),controller[_0x11f6('0xd')]);router[_0x11f6('0xb')]('/global_fields',auth['isAuthenticated'](),controller[_0x11f6('0xe')]);router[_0x11f6('0xb')](_0x11f6('0xf'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x10')]);router['get'](_0x11f6('0x11'),auth['isAuthenticated'](),controller[_0x11f6('0x12')]);router['get']('/:id/contacts',auth[_0x11f6('0x9')](),controller[_0x11f6('0x13')]);router[_0x11f6('0xb')](_0x11f6('0x14'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x15')]);router['get'](_0x11f6('0x16'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x17')]);router['get'](_0x11f6('0x18'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x19')]);router['post']('/',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1a')]);router[_0x11f6('0x1b')](_0x11f6('0x11'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x1c')]);router[_0x11f6('0x1b')]('/:id/contacts',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1d')]);router[_0x11f6('0x1b')](_0x11f6('0x16'),auth[_0x11f6('0x9')](),controller['addCustomField']);router['post'](_0x11f6('0x18'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x1e')]);router['put']('/:id',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1f')]);router[_0x11f6('0x20')](_0x11f6('0xf'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x21')]);router[_0x11f6('0x20')](_0x11f6('0x11'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x22')]);router[_0x11f6('0x20')](_0x11f6('0x18'),auth[_0x11f6('0x9')](),controller['removeAgents']);module[_0x11f6('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 01a99d2..d323072 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 _0x57fd=['getDataValue','field','STRING','sequelize','exports'];(function(_0x96a41f,_0x4ce2a1){var _0x558c68=function(_0x22de36){while(--_0x22de36){_0x96a41f['push'](_0x96a41f['shift']());}};_0x558c68(++_0x4ce2a1);}(_0x57fd,0xb7));var _0xd57f=function(_0x2c914b,_0x12e1fc){_0x2c914b=_0x2c914b-0x0;var _0x56bb18=_0x57fd[_0x2c914b];return _0x56bb18;};'use strict';var Sequelize=require(_0xd57f('0x0'));module[_0xd57f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1ddbc3){return this[_0xd57f('0x2')](_0xd57f('0x3'));}},'field':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0d75=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x435031,_0x1c187b){var _0x32b0c8=function(_0x4f0e87){while(--_0x4f0e87){_0x435031['push'](_0x435031['shift']());}};_0x32b0c8(++_0x1c187b);}(_0x0d75,0x191));var _0x50d7=function(_0x4ed179,_0x2c8a9a){_0x4ed179=_0x4ed179-0x0;var _0x4200fd=_0x0d75[_0x4ed179];return _0x4200fd;};'use strict';var Sequelize=require(_0x50d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x50d7('0x1')],'get':function(_0x53afb9){return this[_0x50d7('0x2')](_0x50d7('0x3'));}},'field':{'type':Sequelize[_0x50d7('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x50d7('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 efbec87..1f5d902 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(_0x3f5880,_0x2beec0){var _0x1cc879=function(_0x38b7b1){while(--_0x38b7b1){_0x3f5880['push'](_0x3f5880['shift']());}};_0x1cc879(++_0x2beec0);}(_0x7a54,0x106));var _0x47a5=function(_0x48eb70,_0x245034){_0x48eb70=_0x48eb70-0x0;var _0x41e855=_0x7a54[_0x48eb70];return _0x41e855;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1bd40b,_0x4cd6eb){var _0x2dd0ac=function(_0x448360){while(--_0x448360){_0x1bd40b['push'](_0x1bd40b['shift']());}};_0x2dd0ac(++_0x4cd6eb);}(_0x7a54,0x106));var _0x47a5=function(_0x52399c,_0x91d17f){_0x52399c=_0x52399c-0x0;var _0x58c2fc=_0x7a54[_0x52399c];return _0x58c2fc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4b3b77e..e0f2a7b 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 _0x8f1f=['util','api','moment','bluebird','request-promise','path','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f1f,0xa7));var _0xf8f1=function(_0x42304a,_0x14be94){_0x42304a=_0x42304a-0x0;var _0x159335=_0x8f1f[_0x42304a];return _0x159335;};'use strict';var _=require(_0xf8f1('0x0'));var util=require(_0xf8f1('0x1'));var logger=require('../../config/logger')(_0xf8f1('0x2'));var moment=require(_0xf8f1('0x3'));var BPromise=require(_0xf8f1('0x4'));var rp=require(_0xf8f1('0x5'));var fs=require('fs');var path=require(_0xf8f1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8f1('0x7'));module[_0xf8f1('0x8')]=function(_0x29a98f,_0x54ecde){return _0x29a98f[_0xf8f1('0x9')](_0xf8f1('0xa'),attributes,{'tableName':_0xf8f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a49=['bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x5779e3,_0x442fd9){var _0x17f6f7=function(_0x52b19e){while(--_0x52b19e){_0x5779e3['push'](_0x5779e3['shift']());}};_0x17f6f7(++_0x442fd9);}(_0x9a49,0x105));var _0x99a4=function(_0x59ee12,_0x54fee5){_0x59ee12=_0x59ee12-0x0;var _0x532468=_0x9a49[_0x59ee12];return _0x532468;};'use strict';var _=require(_0x99a4('0x0'));var util=require(_0x99a4('0x1'));var logger=require(_0x99a4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x99a4('0x3'));var rp=require(_0x99a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99a4('0x5'));var config=require(_0x99a4('0x6'));var attributes=require(_0x99a4('0x7'));module[_0x99a4('0x8')]=function(_0x5807db,_0x248f93){return _0x5807db[_0x99a4('0x9')](_0x99a4('0xa'),attributes,{'tableName':_0x99a4('0xb'),'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 e0da87b..5c61fbf 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 _0xaf2b=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2b076b,_0x455a17){var _0x98ef20=function(_0x54706e){while(--_0x54706e){_0x2b076b['push'](_0x2b076b['shift']());}};_0x98ef20(++_0x455a17);}(_0xaf2b,0xbc));var _0xbaf2=function(_0x28f5cb,_0x37fadc){_0x28f5cb=_0x28f5cb-0x0;var _0x27cd13=_0xaf2b[_0x28f5cb];return _0x27cd13;};'use strict';var _=require(_0xbaf2('0x0'));var util=require('util');var moment=require(_0xbaf2('0x1'));var BPromise=require(_0xbaf2('0x2'));var rs=require(_0xbaf2('0x3'));var fs=require('fs');var Redis=require(_0xbaf2('0x4'));var db=require(_0xbaf2('0x5'))['db'];var utils=require(_0xbaf2('0x6'));var logger=require(_0xbaf2('0x7'))(_0xbaf2('0x8'));var config=require('../../config/environment');var jayson=require(_0xbaf2('0x9'));var client=jayson[_0xbaf2('0xa')][_0xbaf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321563,_0x4b4b84,_0x2a4de6){return new BPromise(function(_0x15864d,_0x6a58d){return client[_0xbaf2('0xc')](_0x321563,_0x2a4de6)[_0xbaf2('0xd')](function(_0x93fbae){logger[_0xbaf2('0xe')](_0xbaf2('0xf'),_0x4b4b84,_0xbaf2('0x10'));logger[_0xbaf2('0x11')](_0xbaf2('0x12'),_0x4b4b84,_0xbaf2('0x10'),JSON[_0xbaf2('0x13')](_0x93fbae));if(_0x93fbae[_0xbaf2('0x14')]){if(_0x93fbae['error'][_0xbaf2('0x15')]===0x1f4){logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);return _0x6a58d(_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);}logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x93fbae[_0xbaf2('0x14')]['message']);return _0x15864d(_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);}else{logger[_0xbaf2('0xe')]('Condition,\x20%s,\x20%s',_0x4b4b84,'request\x20sent');_0x15864d(_0x93fbae[_0xbaf2('0x17')]['message']);}})[_0xbaf2('0x18')](function(_0x1209c6){logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x1209c6);_0x6a58d(_0x1209c6);});});} \ No newline at end of file +var _0xceb8=['client','http','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x2d7fc7,_0x13396b){var _0x27e3d1=function(_0x392313){while(--_0x392313){_0x2d7fc7['push'](_0x2d7fc7['shift']());}};_0x27e3d1(++_0x13396b);}(_0xceb8,0xf0));var _0x8ceb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xceb8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8ceb('0x0'));var util=require('util');var moment=require(_0x8ceb('0x1'));var BPromise=require(_0x8ceb('0x2'));var rs=require(_0x8ceb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ceb('0x4'))['db'];var utils=require(_0x8ceb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8ceb('0x6'));var client=jayson[_0x8ceb('0x7')][_0x8ceb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524954,_0x5af533,_0xbeec92){return new BPromise(function(_0x14753c,_0xa4361d){return client['request'](_0x524954,_0xbeec92)[_0x8ceb('0x9')](function(_0xc423bd){logger[_0x8ceb('0xa')](_0x8ceb('0xb'),_0x5af533,'request\x20sent');logger[_0x8ceb('0xc')](_0x8ceb('0xd'),_0x5af533,_0x8ceb('0xe'),JSON[_0x8ceb('0xf')](_0xc423bd));if(_0xc423bd[_0x8ceb('0x10')]){if(_0xc423bd['error'][_0x8ceb('0x11')]===0x1f4){logger[_0x8ceb('0x10')](_0x8ceb('0xb'),_0x5af533,_0xc423bd['error'][_0x8ceb('0x12')]);return _0xa4361d(_0xc423bd[_0x8ceb('0x10')][_0x8ceb('0x12')]);}logger[_0x8ceb('0x10')](_0x8ceb('0xb'),_0x5af533,_0xc423bd['error'][_0x8ceb('0x12')]);return _0x14753c(_0xc423bd['error'][_0x8ceb('0x12')]);}else{logger['info'](_0x8ceb('0xb'),_0x5af533,_0x8ceb('0xe'));_0x14753c(_0xc423bd['result'][_0x8ceb('0x12')]);}})['catch'](function(_0x11c836){logger['error'](_0x8ceb('0xb'),_0x5af533,_0x11c836);_0xa4361d(_0x11c836);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0beb036..963334a 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 _0x6f9c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','multer'];(function(_0xbe7c99,_0x464391){var _0x22f4e2=function(_0x2b79e3){while(--_0x2b79e3){_0xbe7c99['push'](_0xbe7c99['shift']());}};_0x22f4e2(++_0x464391);}(_0x6f9c,0x110));var _0xc6f9=function(_0x3acfa8,_0x50daa0){_0x3acfa8=_0x3acfa8-0x0;var _0x11af75=_0x6f9c[_0x3acfa8];return _0x11af75;};'use strict';var multer=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var path=require(_0xc6f9('0x2'));var timeout=require(_0xc6f9('0x3'));var express=require(_0xc6f9('0x4'));var router=express['Router']();var fs_extra=require(_0xc6f9('0x5'));var auth=require(_0xc6f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc6f9('0x7'));var controller=require(_0xc6f9('0x8'));router[_0xc6f9('0x9')](_0xc6f9('0xa'),auth[_0xc6f9('0xb')](),controller['update']);router[_0xc6f9('0xc')](_0xc6f9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1a4a=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','update','delete','isAuthenticated','destroy','exports','multer'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x1a4a,0x194));var _0xa1a4=function(_0x4667da,_0x17f442){_0x4667da=_0x4667da-0x0;var _0x329bd7=_0x1a4a[_0x4667da];return _0x329bd7;};'use strict';var multer=require(_0xa1a4('0x0'));var util=require(_0xa1a4('0x1'));var path=require('path');var timeout=require(_0xa1a4('0x2'));var express=require('express');var router=express[_0xa1a4('0x3')]();var fs_extra=require(_0xa1a4('0x4'));var auth=require(_0xa1a4('0x5'));var interaction=require(_0xa1a4('0x6'));var config=require(_0xa1a4('0x7'));var controller=require(_0xa1a4('0x8'));router['put'](_0xa1a4('0x9'),auth['isAuthenticated'](),controller[_0xa1a4('0xa')]);router[_0xa1a4('0xb')]('/:id',auth[_0xa1a4('0xc')](),controller[_0xa1a4('0xd')]);module[_0xa1a4('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index fd3cab5..bc4c64e 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 _0xea1a=['sequelize','exports','STRING','name'];(function(_0x151159,_0x4f35fc){var _0x3c7f71=function(_0x4af24a){while(--_0x4af24a){_0x151159['push'](_0x151159['shift']());}};_0x3c7f71(++_0x4f35fc);}(_0xea1a,0x158));var _0xaea1=function(_0x19ecf7,_0x308815){_0x19ecf7=_0x19ecf7-0x0;var _0x51bd71=_0xea1a[_0x19ecf7];return _0x51bd71;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'name':{'type':Sequelize[_0xaea1('0x2')],'allowNull':![],'unique':_0xaea1('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaea1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xfbc8=['STRING','sequelize','exports','name','INTEGER'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0xfbc8,0xb5));var _0x8fbc=function(_0x2a6490,_0x1adf0f){_0x2a6490=_0x2a6490-0x0;var _0x1b31df=_0xfbc8[_0x2a6490];return _0x1b31df;};'use strict';var Sequelize=require(_0x8fbc('0x0'));module[_0x8fbc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8fbc('0x2')},'OrderBy':{'type':Sequelize[_0x8fbc('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8fbc('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 27cdbf2..b894ab1 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 _0x36ee=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','stack','index','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x32ef84,_0x2048fa){var _0x3d7245=function(_0x26f42f){while(--_0x26f42f){_0x32ef84['push'](_0x32ef84['shift']());}};_0x3d7245(++_0x2048fa);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['ContactItemType'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='ContactItemTypes';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['ContactItemType']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](db[_0xe36e('0x54')][_0xe36e('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7c3766[_0xe36e('0x46')]['id']}}))[_0xe36e('0x26')](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));}; \ No newline at end of file +var _0x056b=['find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','ContactItemTypes','error','stack','name','index','map','ContactItemType','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll'];(function(_0x13c471,_0x2250e6){var _0xb6c73f=function(_0x4b0bfb){while(--_0x4b0bfb){_0x13c471['push'](_0x13c471['shift']());}};_0xb6c73f(++_0x2250e6);}(_0x056b,0xb6));var _0xb056=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x056b[_0x12a2a6];return _0x1754ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb056('0x0'));var zipdir=require(_0xb056('0x1'));var jsonpatch=require(_0xb056('0x2'));var rp=require(_0xb056('0x3'));var moment=require(_0xb056('0x4'));var BPromise=require(_0xb056('0x5'));var Mustache=require(_0xb056('0x6'));var util=require(_0xb056('0x7'));var path=require(_0xb056('0x8'));var sox=require(_0xb056('0x9'));var csv=require(_0xb056('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb056('0xb'));var _=require(_0xb056('0xc'));var squel=require(_0xb056('0xd'));var crypto=require(_0xb056('0xe'));var jsforce=require(_0xb056('0xf'));var deskjs=require(_0xb056('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb056('0x11'));var Redis=require(_0xb056('0x12'));var authService=require(_0xb056('0x13'));var qs=require(_0xb056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb056('0x15'));var logger=require('../../config/logger')(_0xb056('0x16'));var utils=require(_0xb056('0x17'));var config=require(_0xb056('0x18'));var licenseUtil=require(_0xb056('0x19'));var db=require(_0xb056('0x1a'))['db'];function respondWithStatusCode(_0x5d8306,_0x49c5ec){_0x49c5ec=_0x49c5ec||0xcc;return function(_0xf3e80f){if(_0xf3e80f){return _0x5d8306[_0xb056('0x1b')](_0x49c5ec);}return _0x5d8306['status'](_0x49c5ec)[_0xb056('0x1c')]();};}function respondWithResult(_0x34611b,_0xf1c2e9){_0xf1c2e9=_0xf1c2e9||0xc8;return function(_0x1197e5){if(_0x1197e5){return _0x34611b[_0xb056('0x1d')](_0xf1c2e9)[_0xb056('0x1e')](_0x1197e5);}};}function respondWithFilteredResult(_0x179e49,_0x4b838e){return function(_0x162146){if(_0x162146){var _0x43565e=typeof _0x4b838e[_0xb056('0x1f')]===_0xb056('0x20')&&typeof _0x4b838e['limit']===_0xb056('0x20');var _0x4e501a=_0x162146[_0xb056('0x21')];var _0x311eb9=_0x43565e?0x0:_0x4b838e['offset'];var _0x29c77e=_0x43565e?_0x162146['count']:_0x4b838e[_0xb056('0x1f')]+_0x4b838e[_0xb056('0x22')];var _0x5e4bd9;if(_0x29c77e>=_0x4e501a){_0x29c77e=_0x4e501a;_0x5e4bd9=0xc8;}else{_0x5e4bd9=0xce;}_0x179e49[_0xb056('0x1d')](_0x5e4bd9);return _0x179e49['set'](_0xb056('0x23'),_0x311eb9+'-'+_0x29c77e+'/'+_0x4e501a)[_0xb056('0x1e')](_0x162146);}return null;};}function patchUpdates(_0x457b54){return function(_0x33dd35){try{jsonpatch['apply'](_0x33dd35,_0x457b54,!![]);}catch(_0x1db585){return BPromise['reject'](_0x1db585);}return _0x33dd35[_0xb056('0x24')]();};}function saveUpdates(_0x5dea90,_0x324ce6){return function(_0x40ac2d){if(_0x40ac2d){return _0x40ac2d[_0xb056('0x25')](_0x5dea90)[_0xb056('0x26')](function(_0x36e539){return _0x36e539;});}return null;};}function removeEntity(_0x4bb6c0,_0x4e66c3){return function(_0x1016da){if(_0x1016da){return _0x1016da[_0xb056('0x27')]()[_0xb056('0x26')](function(){var _0x1bd6ac=_0x1016da['get']({'plain':!![]});var _0x44a14f=_0xb056('0x28');return db['UserProfileResource'][_0xb056('0x27')]({'where':{'type':_0x44a14f,'resourceId':_0x1bd6ac['id']}})[_0xb056('0x26')](function(){return _0x1016da;});})[_0xb056('0x26')](function(){_0x4bb6c0[_0xb056('0x1d')](0xcc)[_0xb056('0x1c')]();});}};}function handleEntityNotFound(_0x4024d7,_0x211898){return function(_0x2042f1){if(!_0x2042f1){_0x4024d7['sendStatus'](0x194);}return _0x2042f1;};}function handleError(_0x29fbc1,_0x51b06b){_0x51b06b=_0x51b06b||0x1f4;return function(_0x3d83d3){logger[_0xb056('0x29')](_0x3d83d3[_0xb056('0x2a')]);if(_0x3d83d3['name']){delete _0x3d83d3[_0xb056('0x2b')];}_0x29fbc1[_0xb056('0x1d')](_0x51b06b)['send'](_0x3d83d3);};}exports[_0xb056('0x2c')]=function(_0x43aa63,_0x329eaa){var _0x1fad05={},_0x3ce984={},_0x4ebca5={'count':0x0,'rows':[]};var _0x87f31e=_[_0xb056('0x2d')](db[_0xb056('0x2e')][_0xb056('0x2f')],function(_0x103482){return{'name':_0x103482['fieldName'],'type':_0x103482[_0xb056('0x30')][_0xb056('0x31')]};});_0x3ce984[_0xb056('0x32')]=_[_0xb056('0x2d')](_0x87f31e,_0xb056('0x2b'));_0x3ce984[_0xb056('0x33')]=_[_0xb056('0x34')](_0x43aa63[_0xb056('0x33')]);_0x3ce984['filters']=_[_0xb056('0x35')](_0x3ce984['model'],_0x3ce984[_0xb056('0x33')]);_0x1fad05['attributes']=_['intersection'](_0x3ce984[_0xb056('0x32')],qs[_0xb056('0x36')](_0x43aa63[_0xb056('0x33')][_0xb056('0x36')]));_0x1fad05[_0xb056('0x37')]=_0x1fad05[_0xb056('0x37')][_0xb056('0x38')]?_0x1fad05['attributes']:_0x3ce984[_0xb056('0x32')];if(!_0x43aa63[_0xb056('0x33')]['hasOwnProperty']('nolimit')){_0x1fad05[_0xb056('0x22')]=qs[_0xb056('0x22')](_0x43aa63[_0xb056('0x33')]['limit']);_0x1fad05[_0xb056('0x1f')]=qs[_0xb056('0x1f')](_0x43aa63[_0xb056('0x33')][_0xb056('0x1f')]);}_0x1fad05[_0xb056('0x39')]=qs[_0xb056('0x3a')](_0x43aa63[_0xb056('0x33')][_0xb056('0x3a')]);_0x1fad05[_0xb056('0x3b')]=qs[_0xb056('0x3c')](_[_0xb056('0x3d')](_0x43aa63[_0xb056('0x33')],_0x3ce984['filters']),_0x87f31e);if(_0x43aa63[_0xb056('0x33')]['filter']){_0x1fad05[_0xb056('0x3b')]=_[_0xb056('0x3e')](_0x1fad05[_0xb056('0x3b')],{'$or':_[_0xb056('0x2d')](_0x87f31e,function(_0x460f28){if(_0x460f28[_0xb056('0x30')]!==_0xb056('0x3f')){var _0x42b54f={};_0x42b54f[_0x460f28['name']]={'$like':'%'+_0x43aa63[_0xb056('0x33')][_0xb056('0x40')]+'%'};return _0x42b54f;}})});}_0x1fad05=_[_0xb056('0x3e')]({},_0x1fad05,_0x43aa63[_0xb056('0x41')]);var _0x134db7={'where':_0x1fad05['where']};return db[_0xb056('0x2e')][_0xb056('0x21')](_0x134db7)[_0xb056('0x26')](function(_0x216f72){_0x4ebca5[_0xb056('0x21')]=_0x216f72;if(_0x43aa63[_0xb056('0x33')]['includeAll']){_0x1fad05[_0xb056('0x42')]=[{'all':!![]}];}return db['ContactItemType'][_0xb056('0x43')](_0x1fad05);})[_0xb056('0x26')](function(_0x21d98e){_0x4ebca5[_0xb056('0x44')]=_0x21d98e;return _0x4ebca5;})[_0xb056('0x26')](respondWithFilteredResult(_0x329eaa,_0x1fad05))[_0xb056('0x45')](handleError(_0x329eaa,null));};exports[_0xb056('0x46')]=function(_0x248819,_0x2c8b61){var _0x149341={'raw':!![],'where':{'id':_0x248819[_0xb056('0x47')]['id']}},_0x4fa3c5={};_0x4fa3c5[_0xb056('0x32')]=_[_0xb056('0x34')](db['ContactItemType'][_0xb056('0x2f')]);_0x4fa3c5[_0xb056('0x33')]=_['keys'](_0x248819['query']);_0x4fa3c5[_0xb056('0x3c')]=_[_0xb056('0x35')](_0x4fa3c5[_0xb056('0x32')],_0x4fa3c5[_0xb056('0x33')]);_0x149341['attributes']=_['intersection'](_0x4fa3c5['model'],qs['fields'](_0x248819['query']['fields']));_0x149341[_0xb056('0x37')]=_0x149341['attributes'][_0xb056('0x38')]?_0x149341[_0xb056('0x37')]:_0x4fa3c5[_0xb056('0x32')];if(_0x248819[_0xb056('0x33')][_0xb056('0x48')]){_0x149341[_0xb056('0x42')]=[{'all':!![]}];}_0x149341=_[_0xb056('0x3e')]({},_0x149341,_0x248819[_0xb056('0x41')]);return db['ContactItemType'][_0xb056('0x49')](_0x149341)[_0xb056('0x26')](handleEntityNotFound(_0x2c8b61,null))['then'](respondWithResult(_0x2c8b61,null))[_0xb056('0x45')](handleError(_0x2c8b61,null));};exports[_0xb056('0x4a')]=function(_0xe40439,_0x2f2d22){return db[_0xb056('0x2e')][_0xb056('0x4a')](_0xe40439['body'],{})[_0xb056('0x26')](function(_0x5e2224){var _0x132268=_0xe40439[_0xb056('0x4b')][_0xb056('0x4c')]({'plain':!![]});if(!_0x132268)throw new Error(_0xb056('0x4d'));if(_0x132268[_0xb056('0x4e')]===_0xb056('0x4b')){var _0x2b6733=_0x5e2224[_0xb056('0x4c')]({'plain':!![]});var _0x5a3bbf=_0xb056('0x28');return db[_0xb056('0x4f')][_0xb056('0x49')]({'where':{'name':_0x5a3bbf,'userProfileId':_0x132268[_0xb056('0x50')]},'raw':!![]})[_0xb056('0x26')](function(_0x35acab){if(_0x35acab&&_0x35acab[_0xb056('0x51')]===0x0){return db[_0xb056('0x52')]['create']({'name':_0x2b6733[_0xb056('0x2b')],'resourceId':_0x2b6733['id'],'type':_0x35acab[_0xb056('0x2b')],'sectionId':_0x35acab['id']},{})[_0xb056('0x26')](function(){return _0x5e2224;});}else{return _0x5e2224;}})[_0xb056('0x45')](function(_0x1a5170){logger[_0xb056('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a5170);throw _0x1a5170;});}return _0x5e2224;})[_0xb056('0x26')](respondWithResult(_0x2f2d22,0xc9))[_0xb056('0x45')](handleError(_0x2f2d22,null));};exports[_0xb056('0x25')]=function(_0x536d85,_0x37c64c){if(_0x536d85['body']['id']){delete _0x536d85[_0xb056('0x53')]['id'];}return db[_0xb056('0x2e')][_0xb056('0x49')]({'where':{'id':_0x536d85[_0xb056('0x47')]['id']}})['then'](handleEntityNotFound(_0x37c64c,null))[_0xb056('0x26')](saveUpdates(_0x536d85[_0xb056('0x53')],null))['then'](respondWithResult(_0x37c64c,null))[_0xb056('0x45')](handleError(_0x37c64c,null));};exports[_0xb056('0x27')]=function(_0x1d3cdd,_0x1546e5){return db[_0xb056('0x2e')]['find']({'where':{'id':_0x1d3cdd[_0xb056('0x47')]['id']}})[_0xb056('0x26')](handleEntityNotFound(_0x1546e5,null))[_0xb056('0x26')](db[_0xb056('0x54')][_0xb056('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d3cdd[_0xb056('0x47')]['id']}}))[_0xb056('0x26')](removeEntity(_0x1546e5,null))[_0xb056('0x45')](handleError(_0x1546e5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 127732f..884f558 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 _0x7ad7=['exports','define','ContactItemType','tools_contact_item_types','lodash','api','bluebird','request-promise','path','./contactItemType.attributes'];(function(_0x3a9883,_0x3c53cf){var _0x49a0ef=function(_0x5a16aa){while(--_0x5a16aa){_0x3a9883['push'](_0x3a9883['shift']());}};_0x49a0ef(++_0x3c53cf);}(_0x7ad7,0xe0));var _0x77ad=function(_0x3b9ba6,_0x4e7d1f){_0x3b9ba6=_0x3b9ba6-0x0;var _0x445105=_0x7ad7[_0x3b9ba6];return _0x445105;};'use strict';var _=require(_0x77ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x77ad('0x1'));var moment=require('moment');var BPromise=require(_0x77ad('0x2'));var rp=require(_0x77ad('0x3'));var fs=require('fs');var path=require(_0x77ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77ad('0x5'));module[_0x77ad('0x6')]=function(_0x1ace74,_0x29486f){return _0x1ace74[_0x77ad('0x7')](_0x77ad('0x8'),attributes,{'tableName':_0x77ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fa=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xd8fa,0x1bf));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xad8f('0x0'));var util=require(_0xad8f('0x1'));var logger=require(_0xad8f('0x2'))(_0xad8f('0x3'));var moment=require('moment');var BPromise=require(_0xad8f('0x4'));var rp=require(_0xad8f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad8f('0x6'));var config=require(_0xad8f('0x7'));var attributes=require(_0xad8f('0x8'));module[_0xad8f('0x9')]=function(_0x210edb,_0x1f281b){return _0x210edb[_0xad8f('0xa')](_0xad8f('0xb'),attributes,{'tableName':_0xad8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 635f4a1..e7b91b0 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 _0xe083=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x1250c5,_0x35e550){var _0x2afac5=function(_0x197ba2){while(--_0x197ba2){_0x1250c5['push'](_0x1250c5['shift']());}};_0x2afac5(++_0x35e550);}(_0xe083,0x76));var _0x3e08=function(_0x4a8973,_0x30d011){_0x4a8973=_0x4a8973-0x0;var _0x150b1d=_0xe083[_0x4a8973];return _0x150b1d;};'use strict';var _=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e08('0x2'));var fs=require('fs');var Redis=require(_0x3e08('0x3'));var db=require(_0x3e08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e08('0x5'))(_0x3e08('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e08('0x7'));var client=jayson[_0x3e08('0x8')][_0x3e08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51bd77,_0x203348,_0x2ddcdd){return new BPromise(function(_0x4378ca,_0x5d9589){return client[_0x3e08('0xa')](_0x51bd77,_0x2ddcdd)[_0x3e08('0xb')](function(_0xfc6661){logger[_0x3e08('0xc')](_0x3e08('0xd'),_0x203348,_0x3e08('0xe'));logger[_0x3e08('0xf')](_0x3e08('0x10'),_0x203348,'request\x20sent',JSON[_0x3e08('0x11')](_0xfc6661));if(_0xfc6661[_0x3e08('0x12')]){if(_0xfc6661['error'][_0x3e08('0x13')]===0x1f4){logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);return _0x5d9589(_0xfc6661[_0x3e08('0x12')]['message']);}logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);return _0x4378ca(_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);}else{logger['info'](_0x3e08('0xd'),_0x203348,_0x3e08('0xe'));_0x4378ca(_0xfc6661['result']['message']);}})[_0x3e08('0x15')](function(_0x10c847){logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0x10c847);_0x5d9589(_0x10c847);});});} \ No newline at end of file +var _0x5d31=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x5d31,0xb7));var _0x15d3=function(_0x31f94d,_0x97563){_0x31f94d=_0x31f94d-0x0;var _0xca77c0=_0x5d31[_0x31f94d];return _0xca77c0;};'use strict';var _=require(_0x15d3('0x0'));var util=require(_0x15d3('0x1'));var moment=require(_0x15d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x15d3('0x3'));var fs=require('fs');var Redis=require(_0x15d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x15d3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x15d3('0x6'));var jayson=require(_0x15d3('0x7'));var client=jayson[_0x15d3('0x8')][_0x15d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7128,_0x204309,_0x5ab85a){return new BPromise(function(_0x169a5e,_0x1f690b){return client[_0x15d3('0xa')](_0x1f7128,_0x5ab85a)['then'](function(_0x37d3ae){logger['info']('ContactItemType,\x20%s,\x20%s',_0x204309,_0x15d3('0xb'));logger[_0x15d3('0xc')](_0x15d3('0xd'),_0x204309,_0x15d3('0xb'),JSON[_0x15d3('0xe')](_0x37d3ae));if(_0x37d3ae[_0x15d3('0xf')]){if(_0x37d3ae[_0x15d3('0xf')]['code']===0x1f4){logger[_0x15d3('0xf')](_0x15d3('0x10'),_0x204309,_0x37d3ae[_0x15d3('0xf')][_0x15d3('0x11')]);return _0x1f690b(_0x37d3ae[_0x15d3('0xf')][_0x15d3('0x11')]);}logger['error'](_0x15d3('0x10'),_0x204309,_0x37d3ae[_0x15d3('0xf')][_0x15d3('0x11')]);return _0x169a5e(_0x37d3ae['error']['message']);}else{logger[_0x15d3('0x12')]('ContactItemType,\x20%s,\x20%s',_0x204309,_0x15d3('0xb'));_0x169a5e(_0x37d3ae[_0x15d3('0x13')][_0x15d3('0x11')]);}})[_0x15d3('0x14')](function(_0x4fe0b7){logger[_0x15d3('0xf')](_0x15d3('0x10'),_0x204309,_0x4fe0b7);_0x1f690b(_0x4fe0b7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2c84cef..b19aa6a 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 _0xd111=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x41b04c,_0x35837c){var _0x338984=function(_0x57430e){while(--_0x57430e){_0x41b04c['push'](_0x41b04c['shift']());}};_0x338984(++_0x35837c);}(_0xd111,0x14f));var _0x1d11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd111[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1d11('0x0'));var util=require(_0x1d11('0x1'));var path=require(_0x1d11('0x2'));var timeout=require(_0x1d11('0x3'));var express=require(_0x1d11('0x4'));var router=express[_0x1d11('0x5')]();var fs_extra=require(_0x1d11('0x6'));var auth=require(_0x1d11('0x7'));var interaction=require(_0x1d11('0x8'));var config=require(_0x1d11('0x9'));var controller=require(_0x1d11('0xa'));router['get']('/',auth[_0x1d11('0xb')](),controller['index']);router[_0x1d11('0xc')](_0x1d11('0xd'),auth[_0x1d11('0xb')](),controller['show']);router[_0x1d11('0xe')]('/',auth[_0x1d11('0xb')](),controller[_0x1d11('0xf')]);router[_0x1d11('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1d11('0x11')]);router['delete']('/:id',auth[_0x1d11('0xb')](),controller[_0x1d11('0x12')]);module[_0x1d11('0x13')]=router; \ No newline at end of file +var _0x3205=['/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3205,0xbc));var _0x5320=function(_0x52a203,_0x507e0f){_0x52a203=_0x52a203-0x0;var _0x38c07a=_0x3205[_0x52a203];return _0x38c07a;};'use strict';var multer=require('multer');var util=require(_0x5320('0x0'));var path=require(_0x5320('0x1'));var timeout=require(_0x5320('0x2'));var express=require(_0x5320('0x3'));var router=express[_0x5320('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5320('0x5'));var interaction=require(_0x5320('0x6'));var config=require(_0x5320('0x7'));var controller=require(_0x5320('0x8'));router[_0x5320('0x9')]('/',auth[_0x5320('0xa')](),controller[_0x5320('0xb')]);router[_0x5320('0x9')](_0x5320('0xc'),auth[_0x5320('0xa')](),controller[_0x5320('0xd')]);router[_0x5320('0xe')]('/',auth[_0x5320('0xa')](),controller[_0x5320('0xf')]);router[_0x5320('0x10')]('/:id',auth[_0x5320('0xa')](),controller[_0x5320('0x11')]);router[_0x5320('0x12')](_0x5320('0xc'),auth[_0x5320('0xa')](),controller[_0x5320('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index dc868d0..a9c8519 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x3e0f9d,_0x187bc9){var _0x184b9c=function(_0x1e2196){while(--_0x1e2196){_0x3e0f9d['push'](_0x3e0f9d['shift']());}};_0x184b9c(++_0x187bc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x29af75,_0x152b87){_0x29af75=_0x29af75-0x0;var _0x32b56b=_0xb10b[_0x29af75];return _0x32b56b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 9394b13..e918954 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 _0x0509=['undefined','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','merge','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','pick','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','offset'];(function(_0x26f169,_0x2d01b2){var _0x43aad9=function(_0x4395ea){while(--_0x4395ea){_0x26f169['push'](_0x26f169['shift']());}};_0x43aad9(++_0x2d01b2);}(_0x0509,0x1ed));var _0x9050=function(_0x7f870e,_0x393b9c){_0x7f870e=_0x7f870e-0x0;var _0x752210=_0x0509[_0x7f870e];return _0x752210;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9050('0x0'));var zipdir=require(_0x9050('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9050('0x2'));var moment=require(_0x9050('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9050('0x4'));var util=require(_0x9050('0x5'));var path=require(_0x9050('0x6'));var sox=require(_0x9050('0x7'));var csv=require(_0x9050('0x8'));var ejs=require(_0x9050('0x9'));var fs=require('fs');var fs_extra=require(_0x9050('0xa'));var _=require(_0x9050('0xb'));var squel=require(_0x9050('0xc'));var crypto=require(_0x9050('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9050('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9050('0xf'));var Redis=require('ioredis');var authService=require(_0x9050('0x10'));var qs=require(_0x9050('0x11'));var as=require(_0x9050('0x12'));var hardwareService=require(_0x9050('0x13'));var logger=require(_0x9050('0x14'))(_0x9050('0x15'));var utils=require(_0x9050('0x16'));var config=require(_0x9050('0x17'));var licenseUtil=require(_0x9050('0x18'));var db=require(_0x9050('0x19'))['db'];config[_0x9050('0x1a')]=_[_0x9050('0x1b')](config[_0x9050('0x1a')],{'host':_0x9050('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9050('0x1a')]));require(_0x9050('0x1d'))[_0x9050('0x1e')](socket);function respondWithStatusCode(_0x5749bb,_0x1a2b36){_0x1a2b36=_0x1a2b36||0xcc;return function(_0x11ae41){if(_0x11ae41){return _0x5749bb[_0x9050('0x1f')](_0x1a2b36);}return _0x5749bb[_0x9050('0x20')](_0x1a2b36)[_0x9050('0x21')]();};}function respondWithResult(_0x23b3f,_0x1dcbf4){_0x1dcbf4=_0x1dcbf4||0xc8;return function(_0x429f21){if(_0x429f21){return _0x23b3f[_0x9050('0x20')](_0x1dcbf4)['json'](_0x429f21);}};}function respondWithFilteredResult(_0x195f2d,_0xaa2109){return function(_0x33ab58){if(_0x33ab58){var _0x5caf56=typeof _0xaa2109[_0x9050('0x22')]===_0x9050('0x23')&&typeof _0xaa2109[_0x9050('0x24')]===_0x9050('0x23');var _0x2a3587=_0x33ab58[_0x9050('0x25')];var _0x44a428=_0x5caf56?0x0:_0xaa2109[_0x9050('0x22')];var _0x427ec7=_0x5caf56?_0x33ab58['count']:_0xaa2109[_0x9050('0x22')]+_0xaa2109[_0x9050('0x24')];var _0xffc94a;if(_0x427ec7>=_0x2a3587){_0x427ec7=_0x2a3587;_0xffc94a=0xc8;}else{_0xffc94a=0xce;}_0x195f2d[_0x9050('0x20')](_0xffc94a);return _0x195f2d[_0x9050('0x26')]('Content-Range',_0x44a428+'-'+_0x427ec7+'/'+_0x2a3587)[_0x9050('0x27')](_0x33ab58);}return null;};}function patchUpdates(_0x4648d0){return function(_0x574c76){try{jsonpatch[_0x9050('0x28')](_0x574c76,_0x4648d0,!![]);}catch(_0x20de8b){return BPromise['reject'](_0x20de8b);}return _0x574c76[_0x9050('0x29')]();};}function saveUpdates(_0x130677,_0x3ef5d9){return function(_0x1cc58a){if(_0x1cc58a){return _0x1cc58a[_0x9050('0x2a')](_0x130677)[_0x9050('0x2b')](function(_0x10f53f){return _0x10f53f;});}return null;};}function removeEntity(_0x8cac4b,_0x987cde){return function(_0x119ef8){if(_0x119ef8){return _0x119ef8[_0x9050('0x2c')]()['then'](function(){var _0xca77b5=_0x119ef8[_0x9050('0x2d')]({'plain':!![]});var _0xb43503='CustomDashboards';return db[_0x9050('0x2e')][_0x9050('0x2c')]({'where':{'type':_0xb43503,'resourceId':_0xca77b5['id']}})[_0x9050('0x2b')](function(){return _0x119ef8;});})['then'](function(){_0x8cac4b[_0x9050('0x20')](0xcc)[_0x9050('0x21')]();});}};}function handleEntityNotFound(_0x10b444,_0x21f29f){return function(_0x3fe4c3){if(!_0x3fe4c3){_0x10b444[_0x9050('0x1f')](0x194);}return _0x3fe4c3;};}function handleError(_0x2709d6,_0x1f7db7){_0x1f7db7=_0x1f7db7||0x1f4;return function(_0x3c23a8){logger[_0x9050('0x2f')](_0x3c23a8[_0x9050('0x30')]);if(_0x3c23a8['name']){delete _0x3c23a8[_0x9050('0x31')];}_0x2709d6[_0x9050('0x20')](_0x1f7db7)[_0x9050('0x32')](_0x3c23a8);};}exports[_0x9050('0x33')]=function(_0x1b5b9b,_0xcf1eee){var _0x45311d={},_0x24ff52={},_0x4650df={'count':0x0,'rows':[]};var _0x9fb04c=_['map'](db[_0x9050('0x34')][_0x9050('0x35')],function(_0x4f4b77){return{'name':_0x4f4b77['fieldName'],'type':_0x4f4b77['type']['key']};});_0x24ff52[_0x9050('0x36')]=_[_0x9050('0x37')](_0x9fb04c,'name');_0x24ff52[_0x9050('0x38')]=_['keys'](_0x1b5b9b[_0x9050('0x38')]);_0x24ff52[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x24ff52[_0x9050('0x36')],_0x24ff52[_0x9050('0x38')]);_0x45311d[_0x9050('0x3b')]=_[_0x9050('0x3a')](_0x24ff52[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x3c')]));_0x45311d['attributes']=_0x45311d[_0x9050('0x3b')][_0x9050('0x3d')]?_0x45311d[_0x9050('0x3b')]:_0x24ff52['model'];if(!_0x1b5b9b[_0x9050('0x38')][_0x9050('0x3e')](_0x9050('0x3f'))){_0x45311d['limit']=qs[_0x9050('0x24')](_0x1b5b9b[_0x9050('0x38')]['limit']);_0x45311d['offset']=qs[_0x9050('0x22')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x22')]);}_0x45311d[_0x9050('0x40')]=qs[_0x9050('0x41')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x41')]);_0x45311d[_0x9050('0x42')]=qs[_0x9050('0x39')](_['pick'](_0x1b5b9b[_0x9050('0x38')],_0x24ff52[_0x9050('0x39')]),_0x9fb04c);if(_0x1b5b9b[_0x9050('0x38')][_0x9050('0x43')]){_0x45311d[_0x9050('0x42')]=_['merge'](_0x45311d[_0x9050('0x42')],{'$or':_['map'](_0x9fb04c,function(_0x926cbe){if(_0x926cbe['type']!==_0x9050('0x44')){var _0xbfb73e={};_0xbfb73e[_0x926cbe[_0x9050('0x31')]]={'$like':'%'+_0x1b5b9b['query'][_0x9050('0x43')]+'%'};return _0xbfb73e;}})});}_0x45311d=_['merge']({},_0x45311d,_0x1b5b9b['options']);var _0xa31707={'where':_0x45311d[_0x9050('0x42')]};return db[_0x9050('0x34')][_0x9050('0x25')](_0xa31707)[_0x9050('0x2b')](function(_0x5a12d9){_0x4650df['count']=_0x5a12d9;if(_0x1b5b9b['query'][_0x9050('0x45')]){_0x45311d[_0x9050('0x46')]=[{'all':!![]}];}return db[_0x9050('0x34')][_0x9050('0x47')](_0x45311d);})['then'](function(_0x2557eb){_0x4650df[_0x9050('0x48')]=_0x2557eb;return _0x4650df;})['then'](respondWithFilteredResult(_0xcf1eee,_0x45311d))['catch'](handleError(_0xcf1eee,null));};exports[_0x9050('0x49')]=function(_0x28d1d2,_0x1c9b09){var _0x506a44={'raw':![],'where':{'id':_0x28d1d2[_0x9050('0x4a')]['id']}},_0x2e72d4={};_0x2e72d4['model']=_[_0x9050('0x4b')](db[_0x9050('0x34')][_0x9050('0x35')]);_0x2e72d4[_0x9050('0x38')]=_[_0x9050('0x4b')](_0x28d1d2[_0x9050('0x38')]);_0x2e72d4[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x2e72d4[_0x9050('0x36')],_0x2e72d4[_0x9050('0x38')]);_0x506a44[_0x9050('0x3b')]=_['intersection'](_0x2e72d4[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x28d1d2['query'][_0x9050('0x3c')]));_0x506a44[_0x9050('0x3b')]=_0x506a44[_0x9050('0x3b')][_0x9050('0x3d')]?_0x506a44[_0x9050('0x3b')]:_0x2e72d4['model'];if(_0x28d1d2['query'][_0x9050('0x45')]){_0x506a44[_0x9050('0x46')]=[{'all':!![]}];}_0x506a44=_[_0x9050('0x4c')]({},_0x506a44,_0x28d1d2[_0x9050('0x4d')]);return db[_0x9050('0x34')]['find'](_0x506a44)[_0x9050('0x2b')](handleEntityNotFound(_0x1c9b09,null))['then'](respondWithResult(_0x1c9b09,null))[_0x9050('0x4e')](handleError(_0x1c9b09,null));};exports[_0x9050('0x4f')]=function(_0x4cab98,_0x5da3c0){return db[_0x9050('0x34')][_0x9050('0x4f')](_0x4cab98[_0x9050('0x50')],{})[_0x9050('0x2b')](function(_0x107fde){var _0x29e898=_0x4cab98['user'][_0x9050('0x2d')]({'plain':!![]});if(!_0x29e898)throw new Error(_0x9050('0x51'));if(_0x29e898['role']===_0x9050('0x52')){var _0x4f199a=_0x107fde['get']({'plain':!![]});var _0x131ef5=_0x9050('0x53');return db[_0x9050('0x54')][_0x9050('0x55')]({'where':{'name':_0x131ef5,'userProfileId':_0x29e898[_0x9050('0x56')]},'raw':!![]})[_0x9050('0x2b')](function(_0x30a79a){if(_0x30a79a&&_0x30a79a[_0x9050('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f199a[_0x9050('0x31')],'resourceId':_0x4f199a['id'],'type':_0x30a79a[_0x9050('0x31')],'sectionId':_0x30a79a['id']},{})[_0x9050('0x2b')](function(){return _0x107fde;});}else{return _0x107fde;}})[_0x9050('0x4e')](function(_0xf50522){logger[_0x9050('0x2f')](_0x9050('0x58'),_0xf50522);throw _0xf50522;});}return _0x107fde;})[_0x9050('0x2b')](respondWithResult(_0x5da3c0,0xc9))[_0x9050('0x4e')](handleError(_0x5da3c0,null));};exports[_0x9050('0x59')]=function(_0x270a9b,_0x387cd8){var _0x231699={'where':{'id':_0x270a9b['params']['id']}},_0x1cbc14={};_0x1cbc14[_0x9050('0x36')]=_[_0x9050('0x4b')](db['Dashboard']['rawAttributes']);_0x231699[_0x9050('0x3b')]=_[_0x9050('0x3a')](_0x1cbc14[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x270a9b['query'][_0x9050('0x3c')]));_0x231699[_0x9050('0x3b')]=_0x231699[_0x9050('0x3b')][_0x9050('0x3d')]?_0x231699[_0x9050('0x3b')]:_0x1cbc14['model'];if(_0x270a9b[_0x9050('0x38')][_0x9050('0x45')]){_0x231699[_0x9050('0x46')]=[{'all':!![]}];}_0x231699=_[_0x9050('0x4c')]({},_0x231699,_0x270a9b[_0x9050('0x4d')]);return db['Dashboard'][_0x9050('0x55')](_0x231699)[_0x9050('0x2b')](handleEntityNotFound(_0x387cd8,null))['then'](function(_0x382881){if(_0x382881){var _0x7a9ec8=_0x382881['get']({'plain':!![]});_0x7a9ec8=qs['omit'](_0x7a9ec8,['id',_0x9050('0x5a'),_0x9050('0x5b')]);_0x270a9b['body']=_['omit'](_0x270a9b['body'],['id',_0x9050('0x5a'),_0x9050('0x5b')]);return db[_0x9050('0x34')][_0x9050('0x4f')](_[_0x9050('0x4c')](_0x7a9ec8,_0x270a9b[_0x9050('0x50')]),{'include':_0x270a9b[_0x9050('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x9050('0x2b')](function(_0x299433){var _0x4d0e22=_0x270a9b[_0x9050('0x52')]['get']({'plain':!![]});if(!_0x4d0e22)throw new Error(_0x9050('0x51'));if(_0x4d0e22[_0x9050('0x5c')]==='user'){var _0x3af251=_0x299433[_0x9050('0x2d')]({'plain':!![]});var _0x4f7879=_0x9050('0x53');return db[_0x9050('0x54')]['find']({'where':{'name':_0x4f7879,'userProfileId':_0x4d0e22[_0x9050('0x56')]},'raw':!![]})[_0x9050('0x2b')](function(_0x4e0ed1){if(_0x4e0ed1&&_0x4e0ed1[_0x9050('0x57')]===0x0){return db['UserProfileResource'][_0x9050('0x4f')]({'name':_0x3af251['name'],'resourceId':_0x3af251['id'],'type':_0x4e0ed1[_0x9050('0x31')],'sectionId':_0x4e0ed1['id']},{})[_0x9050('0x2b')](function(){return _0x299433;});}else{return _0x299433;}})[_0x9050('0x4e')](function(_0x7c70ef){logger[_0x9050('0x2f')](_0x9050('0x58'),_0x7c70ef);throw _0x7c70ef;});}return _0x299433;});}})[_0x9050('0x2b')](respondWithResult(_0x387cd8,0xc9))[_0x9050('0x4e')](handleError(_0x387cd8,null));};exports[_0x9050('0x2a')]=function(_0x2f4f34,_0x2141f3){if(_0x2f4f34[_0x9050('0x50')]['id']){delete _0x2f4f34[_0x9050('0x50')]['id'];}return db[_0x9050('0x34')]['find']({'where':{'id':_0x2f4f34[_0x9050('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2141f3,null))[_0x9050('0x2b')](saveUpdates(_0x2f4f34[_0x9050('0x50')],null))[_0x9050('0x2b')](respondWithResult(_0x2141f3,null))[_0x9050('0x4e')](handleError(_0x2141f3,null));};exports[_0x9050('0x2c')]=function(_0x34bcc7,_0x54c967){return db[_0x9050('0x34')][_0x9050('0x55')]({'where':{'id':_0x34bcc7[_0x9050('0x4a')]['id']}})[_0x9050('0x2b')](handleEntityNotFound(_0x54c967,null))[_0x9050('0x2b')](removeEntity(_0x54c967,null))[_0x9050('0x4e')](handleError(_0x54c967,null));};function widgetAttributes(_0xb55371){try{switch(_0xb55371[_0x9050('0x5d')]){case _0x9050('0x5e'):return[{'name':'attrUrl','value':_0xb55371[_0x9050('0x5f')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x62')}];case _0x9050('0x63'):return[{'name':_0x9050('0x64'),'value':_0xb55371['attrPath']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||''}];case _0x9050('0x65'):return[{'name':_0x9050('0x66'),'value':_0xb55371[_0x9050('0x66')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x67')},{'name':'attrTimezone','value':_0xb55371[_0x9050('0x68')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x1]?_0xb55371[_0x9050('0x60')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0xb55371[_0x9050('0x69')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2]['value']:undefined)||0xc}];case _0x9050('0x6a'):return[{'name':'attrMetric','value':_0xb55371[_0x9050('0x6b')]||(_0xb55371['attrs']&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x6c')},{'name':_0x9050('0x6d'),'value':_0xb55371[_0x9050('0x6d')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x1]?_0xb55371['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0xb55371[_0x9050('0x69')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2][_0x9050('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0xb55371[_0x9050('0x6e')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x3]?_0xb55371[_0x9050('0x60')][0x3][_0x9050('0x61')]:undefined)||_0x9050('0x6f')},{'name':_0x9050('0x70'),'value':_0xb55371['attrEmailAccounts']||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x4]?_0xb55371[_0x9050('0x60')][0x4][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x71'),'value':_0xb55371[_0x9050('0x71')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x5]?_0xb55371[_0x9050('0x60')][0x5][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x72'),'value':_0xb55371['attrSmsAccounts']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x6]?_0xb55371[_0x9050('0x60')][0x6][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x73'),'value':_0xb55371[_0x9050('0x73')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x7]?_0xb55371[_0x9050('0x60')][0x7][_0x9050('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xb55371[_0x9050('0x74')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x8]?_0xb55371[_0x9050('0x60')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xb55371['attrChatWebsites']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x9]?_0xb55371[_0x9050('0x60')][0x9]['value']:undefined)||''}];case _0x9050('0x75'):case _0x9050('0x76'):return[{'name':'attrSerie1','value':_0xb55371[_0x9050('0x77')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x6c')},{'name':_0x9050('0x78'),'value':_0xb55371[_0x9050('0x78')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x1]?_0xb55371['attrs'][0x1][_0x9050('0x61')]:undefined)||null},{'name':_0x9050('0x79'),'value':_0xb55371[_0x9050('0x79')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2][_0x9050('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xb55371['attrVoiceQueues']||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x3]?_0xb55371[_0x9050('0x60')][0x3][_0x9050('0x61')]:undefined)||[]},{'name':_0x9050('0x6e'),'value':_0xb55371[_0x9050('0x6e')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x4]?_0xb55371[_0x9050('0x60')][0x4]['value']:undefined)||_0x9050('0x6f')},{'name':_0x9050('0x70'),'value':_0xb55371['attrEmailAccounts']||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x5]?_0xb55371[_0x9050('0x60')][0x5][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x71'),'value':_0xb55371[_0x9050('0x71')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x6]?_0xb55371[_0x9050('0x60')][0x6][_0x9050('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xb55371[_0x9050('0x72')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x7]?_0xb55371['attrs'][0x7][_0x9050('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xb55371['attrOpenchannelAccounts']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x8]?_0xb55371[_0x9050('0x60')][0x8][_0x9050('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xb55371[_0x9050('0x74')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x9]?_0xb55371[_0x9050('0x60')][0x9][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x7a'),'value':_0xb55371['attrChatWebsites']||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0xa]?_0xb55371[_0x9050('0x60')][0xa]['value']:undefined)||''}];case _0x9050('0x7b'):return[{'name':'attrReport','type':_0xb55371[_0x9050('0x7c')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x5d')]:undefined)||null,'value':_0xb55371[_0x9050('0x7d')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0xb55371[_0x9050('0x7e')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x1]?_0xb55371['attrs'][0x1][_0x9050('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x2d3dcc){logger['error'](_0x9050('0x7f'),JSON['stringify'](_0x2d3dcc));return[];}}exports[_0x9050('0x80')]=function(_0x497471,_0x4491b9,_0x220973){if(_0x497471['body']['id']){delete _0x497471[_0x9050('0x50')]['id'];}return db[_0x9050('0x34')][_0x9050('0x55')]({'where':{'id':_0x497471['params']['id']}})['then'](handleEntityNotFound(_0x4491b9,null))['then'](function(_0x436750){if(_0x436750){_0x497471[_0x9050('0x50')]['DashboardId']=_0x436750['id'];_0x497471['body'][_0x9050('0x60')]=widgetAttributes(_0x497471[_0x9050('0x50')]);return db[_0x9050('0x81')][_0x9050('0x4f')](_0x497471[_0x9050('0x50')]);}})[_0x9050('0x2b')](respondWithResult(_0x4491b9,null))[_0x9050('0x4e')](handleError(_0x4491b9,null));};exports[_0x9050('0x82')]=function(_0x2cd13f,_0x1469fa,_0xeff3c4){var _0x35fadd={};var _0x160bfc={};var _0x44aa00;var _0x21c22a;return db[_0x9050('0x34')]['findOne']({'where':{'id':_0x2cd13f[_0x9050('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1469fa,null))[_0x9050('0x2b')](function(_0x418ef4){if(_0x418ef4){_0x44aa00=_0x418ef4;_0x160bfc['model']=_[_0x9050('0x4b')](db[_0x9050('0x81')][_0x9050('0x35')]);_0x160bfc['query']=_[_0x9050('0x4b')](_0x2cd13f[_0x9050('0x38')]);_0x160bfc[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x160bfc[_0x9050('0x36')],_0x160bfc['query']);_0x35fadd['attributes']=_[_0x9050('0x3a')](_0x160bfc['model'],qs[_0x9050('0x3c')](_0x2cd13f[_0x9050('0x38')][_0x9050('0x3c')]));_0x35fadd[_0x9050('0x3b')]=_0x35fadd[_0x9050('0x3b')]['length']?_0x35fadd[_0x9050('0x3b')]:_0x160bfc[_0x9050('0x36')];_0x35fadd[_0x9050('0x40')]=qs[_0x9050('0x41')](_0x2cd13f[_0x9050('0x38')][_0x9050('0x41')]);_0x35fadd[_0x9050('0x42')]=qs['filters'](_[_0x9050('0x83')](_0x2cd13f['query'],_0x160bfc['filters']));if(_0x2cd13f[_0x9050('0x38')]['filter']){_0x35fadd[_0x9050('0x42')]=_[_0x9050('0x4c')](_0x35fadd[_0x9050('0x42')],{'$or':_[_0x9050('0x37')](_0x35fadd[_0x9050('0x3b')],function(_0x5e1aa3){var _0x29de48={};_0x29de48[_0x5e1aa3]={'$like':'%'+_0x2cd13f[_0x9050('0x38')][_0x9050('0x43')]+'%'};return _0x29de48;})});}_0x35fadd=_[_0x9050('0x4c')]({},_0x35fadd,_0x2cd13f['options']);return _0x44aa00[_0x9050('0x82')](_0x35fadd);}})[_0x9050('0x2b')](function(_0x537d6f){if(_0x537d6f){_0x21c22a=_0x537d6f[_0x9050('0x3d')];if(!_0x2cd13f[_0x9050('0x38')][_0x9050('0x3e')](_0x9050('0x3f'))){_0x35fadd[_0x9050('0x24')]=qs[_0x9050('0x24')](_0x2cd13f[_0x9050('0x38')]['limit']);_0x35fadd['offset']=qs[_0x9050('0x22')](_0x2cd13f['query'][_0x9050('0x22')]);}return _0x44aa00[_0x9050('0x82')](_0x35fadd);}})['then'](function(_0x3cb94c){if(_0x3cb94c){return _0x3cb94c?{'count':_0x21c22a,'rows':_0x3cb94c}:null;}})[_0x9050('0x2b')](respondWithResult(_0x1469fa,null))[_0x9050('0x4e')](handleError(_0x1469fa,null));}; \ No newline at end of file +var _0xc949=['iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','reportType','widgetAttributes:\x20%s','addItem','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','UserProfileSection','update'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xc949,0x1a8));var _0x9c94=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xc949[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c94('0x0'));var zipdir=require(_0x9c94('0x1'));var jsonpatch=require(_0x9c94('0x2'));var rp=require(_0x9c94('0x3'));var moment=require(_0x9c94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c94('0x5'));var util=require(_0x9c94('0x6'));var path=require(_0x9c94('0x7'));var sox=require(_0x9c94('0x8'));var csv=require(_0x9c94('0x9'));var ejs=require(_0x9c94('0xa'));var fs=require('fs');var fs_extra=require(_0x9c94('0xb'));var _=require(_0x9c94('0xc'));var squel=require(_0x9c94('0xd'));var crypto=require('crypto');var jsforce=require(_0x9c94('0xe'));var deskjs=require(_0x9c94('0xf'));var toCsv=require(_0x9c94('0x9'));var querystring=require(_0x9c94('0x10'));var Papa=require(_0x9c94('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c94('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x13'));var logger=require('../../config/logger')(_0x9c94('0x14'));var utils=require(_0x9c94('0x15'));var config=require(_0x9c94('0x16'));var licenseUtil=require(_0x9c94('0x17'));var db=require('../../mysqldb')['db'];config[_0x9c94('0x18')]=_[_0x9c94('0x19')](config[_0x9c94('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c94('0x1a'))[_0x9c94('0x1b')](socket);function respondWithStatusCode(_0xbd473a,_0x47bc1b){_0x47bc1b=_0x47bc1b||0xcc;return function(_0x38592a){if(_0x38592a){return _0xbd473a[_0x9c94('0x1c')](_0x47bc1b);}return _0xbd473a[_0x9c94('0x1d')](_0x47bc1b)[_0x9c94('0x1e')]();};}function respondWithResult(_0x443b1a,_0x2be43b){_0x2be43b=_0x2be43b||0xc8;return function(_0x383188){if(_0x383188){return _0x443b1a[_0x9c94('0x1d')](_0x2be43b)[_0x9c94('0x1f')](_0x383188);}};}function respondWithFilteredResult(_0x431fec,_0x244fb4){return function(_0x4cbd32){if(_0x4cbd32){var _0x2d5c4d=typeof _0x244fb4[_0x9c94('0x20')]==='undefined'&&typeof _0x244fb4['limit']===_0x9c94('0x21');var _0x415454=_0x4cbd32['count'];var _0x3e6083=_0x2d5c4d?0x0:_0x244fb4[_0x9c94('0x20')];var _0x2b80df=_0x2d5c4d?_0x4cbd32[_0x9c94('0x22')]:_0x244fb4[_0x9c94('0x20')]+_0x244fb4['limit'];var _0x275552;if(_0x2b80df>=_0x415454){_0x2b80df=_0x415454;_0x275552=0xc8;}else{_0x275552=0xce;}_0x431fec[_0x9c94('0x1d')](_0x275552);return _0x431fec['set'](_0x9c94('0x23'),_0x3e6083+'-'+_0x2b80df+'/'+_0x415454)[_0x9c94('0x1f')](_0x4cbd32);}return null;};}function patchUpdates(_0x3b0643){return function(_0x1a4c0f){try{jsonpatch[_0x9c94('0x24')](_0x1a4c0f,_0x3b0643,!![]);}catch(_0x569353){return BPromise[_0x9c94('0x25')](_0x569353);}return _0x1a4c0f[_0x9c94('0x26')]();};}function saveUpdates(_0x615165,_0x28a179){return function(_0x38e4f5){if(_0x38e4f5){return _0x38e4f5['update'](_0x615165)[_0x9c94('0x27')](function(_0x4d0bc6){return _0x4d0bc6;});}return null;};}function removeEntity(_0x47451e,_0x4aa38e){return function(_0x3dc767){if(_0x3dc767){return _0x3dc767[_0x9c94('0x28')]()[_0x9c94('0x27')](function(){var _0x4a8190=_0x3dc767[_0x9c94('0x29')]({'plain':!![]});var _0x5be8e9=_0x9c94('0x2a');return db[_0x9c94('0x2b')]['destroy']({'where':{'type':_0x5be8e9,'resourceId':_0x4a8190['id']}})['then'](function(){return _0x3dc767;});})[_0x9c94('0x27')](function(){_0x47451e[_0x9c94('0x1d')](0xcc)[_0x9c94('0x1e')]();});}};}function handleEntityNotFound(_0x4d28d5,_0x59b979){return function(_0x4421ab){if(!_0x4421ab){_0x4d28d5['sendStatus'](0x194);}return _0x4421ab;};}function handleError(_0x5804bc,_0x3f2ab4){_0x3f2ab4=_0x3f2ab4||0x1f4;return function(_0x539baa){logger['error'](_0x539baa[_0x9c94('0x2c')]);if(_0x539baa[_0x9c94('0x2d')]){delete _0x539baa['name'];}_0x5804bc['status'](_0x3f2ab4)['send'](_0x539baa);};}exports[_0x9c94('0x2e')]=function(_0x51bbc5,_0x1d6c61){var _0x2993e7={},_0x3a1c23={},_0x2e52bf={'count':0x0,'rows':[]};var _0x363c45=_[_0x9c94('0x2f')](db[_0x9c94('0x30')][_0x9c94('0x31')],function(_0x48a018){return{'name':_0x48a018[_0x9c94('0x32')],'type':_0x48a018[_0x9c94('0x33')][_0x9c94('0x34')]};});_0x3a1c23[_0x9c94('0x35')]=_[_0x9c94('0x2f')](_0x363c45,_0x9c94('0x2d'));_0x3a1c23['query']=_['keys'](_0x51bbc5[_0x9c94('0x36')]);_0x3a1c23[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x3a1c23['model'],_0x3a1c23['query']);_0x2993e7[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0x3a1c23[_0x9c94('0x35')],qs[_0x9c94('0x3a')](_0x51bbc5[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x2993e7[_0x9c94('0x39')]=_0x2993e7[_0x9c94('0x39')][_0x9c94('0x3b')]?_0x2993e7['attributes']:_0x3a1c23[_0x9c94('0x35')];if(!_0x51bbc5['query'][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x2993e7[_0x9c94('0x3e')]=qs[_0x9c94('0x3e')](_0x51bbc5[_0x9c94('0x36')][_0x9c94('0x3e')]);_0x2993e7[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x51bbc5['query']['offset']);}_0x2993e7['order']=qs[_0x9c94('0x3f')](_0x51bbc5[_0x9c94('0x36')][_0x9c94('0x3f')]);_0x2993e7['where']=qs['filters'](_[_0x9c94('0x40')](_0x51bbc5[_0x9c94('0x36')],_0x3a1c23[_0x9c94('0x37')]),_0x363c45);if(_0x51bbc5[_0x9c94('0x36')][_0x9c94('0x41')]){_0x2993e7[_0x9c94('0x42')]=_[_0x9c94('0x43')](_0x2993e7[_0x9c94('0x42')],{'$or':_[_0x9c94('0x2f')](_0x363c45,function(_0x176290){if(_0x176290['type']!==_0x9c94('0x44')){var _0x167c2c={};_0x167c2c[_0x176290['name']]={'$like':'%'+_0x51bbc5['query'][_0x9c94('0x41')]+'%'};return _0x167c2c;}})});}_0x2993e7=_[_0x9c94('0x43')]({},_0x2993e7,_0x51bbc5['options']);var _0x56147a={'where':_0x2993e7['where']};return db[_0x9c94('0x30')][_0x9c94('0x22')](_0x56147a)[_0x9c94('0x27')](function(_0x18b5ea){_0x2e52bf[_0x9c94('0x22')]=_0x18b5ea;if(_0x51bbc5[_0x9c94('0x36')]['includeAll']){_0x2993e7[_0x9c94('0x45')]=[{'all':!![]}];}return db[_0x9c94('0x30')]['findAll'](_0x2993e7);})[_0x9c94('0x27')](function(_0x152e42){_0x2e52bf[_0x9c94('0x46')]=_0x152e42;return _0x2e52bf;})[_0x9c94('0x27')](respondWithFilteredResult(_0x1d6c61,_0x2993e7))[_0x9c94('0x47')](handleError(_0x1d6c61,null));};exports[_0x9c94('0x48')]=function(_0xc3240b,_0x280523){var _0x4834f5={'raw':![],'where':{'id':_0xc3240b[_0x9c94('0x49')]['id']}},_0x9e093={};_0x9e093['model']=_[_0x9c94('0x4a')](db[_0x9c94('0x30')][_0x9c94('0x31')]);_0x9e093[_0x9c94('0x36')]=_[_0x9c94('0x4a')](_0xc3240b[_0x9c94('0x36')]);_0x9e093[_0x9c94('0x37')]=_['intersection'](_0x9e093[_0x9c94('0x35')],_0x9e093[_0x9c94('0x36')]);_0x4834f5[_0x9c94('0x39')]=_['intersection'](_0x9e093['model'],qs['fields'](_0xc3240b[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x4834f5[_0x9c94('0x39')]=_0x4834f5[_0x9c94('0x39')][_0x9c94('0x3b')]?_0x4834f5[_0x9c94('0x39')]:_0x9e093[_0x9c94('0x35')];if(_0xc3240b[_0x9c94('0x36')][_0x9c94('0x4b')]){_0x4834f5[_0x9c94('0x45')]=[{'all':!![]}];}_0x4834f5=_[_0x9c94('0x43')]({},_0x4834f5,_0xc3240b['options']);return db[_0x9c94('0x30')][_0x9c94('0x4c')](_0x4834f5)[_0x9c94('0x27')](handleEntityNotFound(_0x280523,null))[_0x9c94('0x27')](respondWithResult(_0x280523,null))[_0x9c94('0x47')](handleError(_0x280523,null));};exports[_0x9c94('0x4d')]=function(_0x284243,_0x5017a1){return db[_0x9c94('0x30')]['create'](_0x284243['body'],{})[_0x9c94('0x27')](function(_0x1d46ca){var _0x187bdc=_0x284243[_0x9c94('0x4e')][_0x9c94('0x29')]({'plain':!![]});if(!_0x187bdc)throw new Error(_0x9c94('0x4f'));if(_0x187bdc[_0x9c94('0x50')]===_0x9c94('0x4e')){var _0x532b82=_0x1d46ca[_0x9c94('0x29')]({'plain':!![]});var _0x11f66f=_0x9c94('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x11f66f,'userProfileId':_0x187bdc[_0x9c94('0x51')]},'raw':!![]})['then'](function(_0x467368){if(_0x467368&&_0x467368[_0x9c94('0x52')]===0x0){return db[_0x9c94('0x2b')][_0x9c94('0x4d')]({'name':_0x532b82[_0x9c94('0x2d')],'resourceId':_0x532b82['id'],'type':_0x467368['name'],'sectionId':_0x467368['id']},{})[_0x9c94('0x27')](function(){return _0x1d46ca;});}else{return _0x1d46ca;}})['catch'](function(_0x1c356f){logger[_0x9c94('0x53')](_0x9c94('0x54'),_0x1c356f);throw _0x1c356f;});}return _0x1d46ca;})[_0x9c94('0x27')](respondWithResult(_0x5017a1,0xc9))[_0x9c94('0x47')](handleError(_0x5017a1,null));};exports[_0x9c94('0x55')]=function(_0x193d3f,_0xca8683){var _0x32144e={'where':{'id':_0x193d3f[_0x9c94('0x49')]['id']}},_0xa7c1ee={};_0xa7c1ee[_0x9c94('0x35')]=_[_0x9c94('0x4a')](db['Dashboard'][_0x9c94('0x31')]);_0x32144e[_0x9c94('0x39')]=_['intersection'](_0xa7c1ee[_0x9c94('0x35')],qs['fields'](_0x193d3f[_0x9c94('0x36')][_0x9c94('0x3a')]));_0x32144e['attributes']=_0x32144e[_0x9c94('0x39')][_0x9c94('0x3b')]?_0x32144e[_0x9c94('0x39')]:_0xa7c1ee[_0x9c94('0x35')];if(_0x193d3f['query'][_0x9c94('0x4b')]){_0x32144e[_0x9c94('0x45')]=[{'all':!![]}];}_0x32144e=_[_0x9c94('0x43')]({},_0x32144e,_0x193d3f['options']);return db[_0x9c94('0x30')][_0x9c94('0x4c')](_0x32144e)['then'](handleEntityNotFound(_0xca8683,null))[_0x9c94('0x27')](function(_0x46d530){if(_0x46d530){var _0x481f8e=_0x46d530[_0x9c94('0x29')]({'plain':!![]});_0x481f8e=qs[_0x9c94('0x56')](_0x481f8e,['id',_0x9c94('0x57'),_0x9c94('0x58')]);_0x193d3f[_0x9c94('0x59')]=_[_0x9c94('0x56')](_0x193d3f['body'],['id','createdAt',_0x9c94('0x58')]);return db[_0x9c94('0x30')][_0x9c94('0x4d')](_[_0x9c94('0x43')](_0x481f8e,_0x193d3f['body']),{'include':_0x193d3f[_0x9c94('0x36')][_0x9c94('0x4b')]?[{'all':!![]}]:undefined})[_0x9c94('0x27')](function(_0x6c3bf7){var _0x310d54=_0x193d3f[_0x9c94('0x4e')][_0x9c94('0x29')]({'plain':!![]});if(!_0x310d54)throw new Error(_0x9c94('0x4f'));if(_0x310d54[_0x9c94('0x50')]===_0x9c94('0x4e')){var _0x3b8c51=_0x6c3bf7[_0x9c94('0x29')]({'plain':!![]});var _0x4c9f93=_0x9c94('0x2a');return db[_0x9c94('0x5a')][_0x9c94('0x4c')]({'where':{'name':_0x4c9f93,'userProfileId':_0x310d54[_0x9c94('0x51')]},'raw':!![]})[_0x9c94('0x27')](function(_0x15a238){if(_0x15a238&&_0x15a238[_0x9c94('0x52')]===0x0){return db[_0x9c94('0x2b')]['create']({'name':_0x3b8c51[_0x9c94('0x2d')],'resourceId':_0x3b8c51['id'],'type':_0x15a238['name'],'sectionId':_0x15a238['id']},{})[_0x9c94('0x27')](function(){return _0x6c3bf7;});}else{return _0x6c3bf7;}})[_0x9c94('0x47')](function(_0x12ba16){logger[_0x9c94('0x53')](_0x9c94('0x54'),_0x12ba16);throw _0x12ba16;});}return _0x6c3bf7;});}})[_0x9c94('0x27')](respondWithResult(_0xca8683,0xc9))[_0x9c94('0x47')](handleError(_0xca8683,null));};exports[_0x9c94('0x5b')]=function(_0x33519c,_0xfd5dcb){if(_0x33519c[_0x9c94('0x59')]['id']){delete _0x33519c[_0x9c94('0x59')]['id'];}return db[_0x9c94('0x30')][_0x9c94('0x4c')]({'where':{'id':_0x33519c[_0x9c94('0x49')]['id']}})['then'](handleEntityNotFound(_0xfd5dcb,null))['then'](saveUpdates(_0x33519c[_0x9c94('0x59')],null))[_0x9c94('0x27')](respondWithResult(_0xfd5dcb,null))['catch'](handleError(_0xfd5dcb,null));};exports[_0x9c94('0x28')]=function(_0x5e1adf,_0x416497){return db[_0x9c94('0x30')]['find']({'where':{'id':_0x5e1adf[_0x9c94('0x49')]['id']}})['then'](handleEntityNotFound(_0x416497,null))[_0x9c94('0x27')](removeEntity(_0x416497,null))[_0x9c94('0x47')](handleError(_0x416497,null));};function widgetAttributes(_0x1cda92){try{switch(_0x1cda92['type']){case _0x9c94('0x5c'):return[{'name':'attrUrl','value':_0x1cda92[_0x9c94('0x5d')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x0]?_0x1cda92[_0x9c94('0x5e')][0x0][_0x9c94('0x5f')]:undefined)||_0x9c94('0x60')}];case _0x9c94('0x61'):return[{'name':_0x9c94('0x62'),'value':_0x1cda92['attrPath']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x0]?_0x1cda92['attrs'][0x0][_0x9c94('0x5f')]:undefined)||''}];case _0x9c94('0x63'):return[{'name':'attrHourFormat','value':_0x1cda92[_0x9c94('0x64')]||(_0x1cda92['attrs']&&_0x1cda92['attrs'][0x0]?_0x1cda92[_0x9c94('0x5e')][0x0][_0x9c94('0x5f')]:undefined)||_0x9c94('0x65')},{'name':_0x9c94('0x66'),'value':_0x1cda92['attrTimezone']||(_0x1cda92['attrs']&&_0x1cda92[_0x9c94('0x5e')][0x1]?_0x1cda92[_0x9c94('0x5e')][0x1]['value']:undefined)||_0x9c94('0x67')},{'name':_0x9c94('0x68'),'value':_0x1cda92[_0x9c94('0x68')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x2]?_0x1cda92[_0x9c94('0x5e')][0x2][_0x9c94('0x5f')]:undefined)||0xc}];case _0x9c94('0x69'):return[{'name':'attrMetric','value':_0x1cda92[_0x9c94('0x6a')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x0]?_0x1cda92[_0x9c94('0x5e')][0x0]['value']:undefined)||_0x9c94('0x6b')},{'name':'attrVoiceQueues','value':_0x1cda92['attrVoiceQueues']||(_0x1cda92['attrs']&&_0x1cda92['attrs'][0x1]?_0x1cda92[_0x9c94('0x5e')][0x1][_0x9c94('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0x1cda92[_0x9c94('0x68')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x2]?_0x1cda92['attrs'][0x2][_0x9c94('0x5f')]:undefined)||0x14},{'name':_0x9c94('0x6c'),'value':_0x1cda92['attrChannel']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x3]?_0x1cda92[_0x9c94('0x5e')][0x3]['value']:undefined)||_0x9c94('0x6d')},{'name':_0x9c94('0x6e'),'value':_0x1cda92[_0x9c94('0x6e')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x4]?_0x1cda92['attrs'][0x4][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x6f'),'value':_0x1cda92[_0x9c94('0x6f')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x5]?_0x1cda92['attrs'][0x5][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x70'),'value':_0x1cda92[_0x9c94('0x70')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x6]?_0x1cda92[_0x9c94('0x5e')][0x6][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x71'),'value':_0x1cda92[_0x9c94('0x71')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x7]?_0x1cda92['attrs'][0x7][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x72'),'value':_0x1cda92[_0x9c94('0x72')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x8]?_0x1cda92[_0x9c94('0x5e')][0x8]['value']:undefined)||''},{'name':_0x9c94('0x73'),'value':_0x1cda92['attrChatWebsites']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x9]?_0x1cda92[_0x9c94('0x5e')][0x9][_0x9c94('0x5f')]:undefined)||''}];case _0x9c94('0x74'):case _0x9c94('0x75'):return[{'name':_0x9c94('0x76'),'value':_0x1cda92[_0x9c94('0x76')]||(_0x1cda92['attrs']&&_0x1cda92[_0x9c94('0x5e')][0x0]?_0x1cda92['attrs'][0x0][_0x9c94('0x5f')]:undefined)||_0x9c94('0x6b')},{'name':'attrSerie2','value':_0x1cda92[_0x9c94('0x77')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x1]?_0x1cda92[_0x9c94('0x5e')][0x1][_0x9c94('0x5f')]:undefined)||null},{'name':_0x9c94('0x78'),'value':_0x1cda92[_0x9c94('0x78')]||(_0x1cda92['attrs']&&_0x1cda92[_0x9c94('0x5e')][0x2]?_0x1cda92['attrs'][0x2]['value']:undefined)||null},{'name':_0x9c94('0x79'),'value':_0x1cda92[_0x9c94('0x79')]||(_0x1cda92['attrs']&&_0x1cda92['attrs'][0x3]?_0x1cda92[_0x9c94('0x5e')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x1cda92['attrChannel']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x4]?_0x1cda92['attrs'][0x4][_0x9c94('0x5f')]:undefined)||_0x9c94('0x6d')},{'name':_0x9c94('0x6e'),'value':_0x1cda92[_0x9c94('0x6e')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x5]?_0x1cda92[_0x9c94('0x5e')][0x5][_0x9c94('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1cda92[_0x9c94('0x6f')]||(_0x1cda92['attrs']&&_0x1cda92['attrs'][0x6]?_0x1cda92[_0x9c94('0x5e')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1cda92[_0x9c94('0x70')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x7]?_0x1cda92['attrs'][0x7][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x71'),'value':_0x1cda92['attrOpenchannelAccounts']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x8]?_0x1cda92[_0x9c94('0x5e')][0x8][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x72'),'value':_0x1cda92[_0x9c94('0x72')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x9]?_0x1cda92['attrs'][0x9][_0x9c94('0x5f')]:undefined)||''},{'name':_0x9c94('0x73'),'value':_0x1cda92[_0x9c94('0x73')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0xa]?_0x1cda92['attrs'][0xa][_0x9c94('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x9c94('0x7a'),'type':_0x1cda92[_0x9c94('0x7b')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x0]?_0x1cda92['attrs'][0x0][_0x9c94('0x33')]:undefined)||null,'value':_0x1cda92[_0x9c94('0x7a')]||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92['attrs'][0x0]?_0x1cda92[_0x9c94('0x5e')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x1cda92['attrRefresh']||(_0x1cda92[_0x9c94('0x5e')]&&_0x1cda92[_0x9c94('0x5e')][0x1]?_0x1cda92[_0x9c94('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2707b0){logger['error'](_0x9c94('0x7c'),JSON['stringify'](_0x2707b0));return[];}}exports[_0x9c94('0x7d')]=function(_0x3cdaa4,_0x328b71,_0x24ed6f){if(_0x3cdaa4[_0x9c94('0x59')]['id']){delete _0x3cdaa4[_0x9c94('0x59')]['id'];}return db[_0x9c94('0x30')]['find']({'where':{'id':_0x3cdaa4[_0x9c94('0x49')]['id']}})[_0x9c94('0x27')](handleEntityNotFound(_0x328b71,null))['then'](function(_0x31c9d8){if(_0x31c9d8){_0x3cdaa4[_0x9c94('0x59')]['DashboardId']=_0x31c9d8['id'];_0x3cdaa4[_0x9c94('0x59')][_0x9c94('0x5e')]=widgetAttributes(_0x3cdaa4[_0x9c94('0x59')]);return db[_0x9c94('0x7e')][_0x9c94('0x4d')](_0x3cdaa4[_0x9c94('0x59')]);}})[_0x9c94('0x27')](respondWithResult(_0x328b71,null))[_0x9c94('0x47')](handleError(_0x328b71,null));};exports['getItems']=function(_0xd4a1d4,_0x41bf7d,_0x40c89c){var _0x3ed53e={};var _0x19825b={};var _0x3eb522;var _0xd38391;return db[_0x9c94('0x30')][_0x9c94('0x7f')]({'where':{'id':_0xd4a1d4[_0x9c94('0x49')]['id']}})['then'](handleEntityNotFound(_0x41bf7d,null))[_0x9c94('0x27')](function(_0x379914){if(_0x379914){_0x3eb522=_0x379914;_0x19825b[_0x9c94('0x35')]=_[_0x9c94('0x4a')](db[_0x9c94('0x7e')][_0x9c94('0x31')]);_0x19825b[_0x9c94('0x36')]=_[_0x9c94('0x4a')](_0xd4a1d4[_0x9c94('0x36')]);_0x19825b[_0x9c94('0x37')]=_[_0x9c94('0x38')](_0x19825b[_0x9c94('0x35')],_0x19825b[_0x9c94('0x36')]);_0x3ed53e[_0x9c94('0x39')]=_[_0x9c94('0x38')](_0x19825b['model'],qs['fields'](_0xd4a1d4['query']['fields']));_0x3ed53e[_0x9c94('0x39')]=_0x3ed53e[_0x9c94('0x39')]['length']?_0x3ed53e['attributes']:_0x19825b[_0x9c94('0x35')];_0x3ed53e['order']=qs[_0x9c94('0x3f')](_0xd4a1d4[_0x9c94('0x36')][_0x9c94('0x3f')]);_0x3ed53e['where']=qs[_0x9c94('0x37')](_[_0x9c94('0x40')](_0xd4a1d4[_0x9c94('0x36')],_0x19825b[_0x9c94('0x37')]));if(_0xd4a1d4['query']['filter']){_0x3ed53e[_0x9c94('0x42')]=_['merge'](_0x3ed53e['where'],{'$or':_[_0x9c94('0x2f')](_0x3ed53e[_0x9c94('0x39')],function(_0x55a8e1){var _0x1e2b01={};_0x1e2b01[_0x55a8e1]={'$like':'%'+_0xd4a1d4['query']['filter']+'%'};return _0x1e2b01;})});}_0x3ed53e=_[_0x9c94('0x43')]({},_0x3ed53e,_0xd4a1d4['options']);return _0x3eb522['getItems'](_0x3ed53e);}})[_0x9c94('0x27')](function(_0x67c9c6){if(_0x67c9c6){_0xd38391=_0x67c9c6[_0x9c94('0x3b')];if(!_0xd4a1d4['query'][_0x9c94('0x3c')](_0x9c94('0x3d'))){_0x3ed53e['limit']=qs[_0x9c94('0x3e')](_0xd4a1d4[_0x9c94('0x36')][_0x9c94('0x3e')]);_0x3ed53e[_0x9c94('0x20')]=qs['offset'](_0xd4a1d4['query'][_0x9c94('0x20')]);}return _0x3eb522[_0x9c94('0x80')](_0x3ed53e);}})[_0x9c94('0x27')](function(_0x101472){if(_0x101472){return _0x101472?{'count':_0xd38391,'rows':_0x101472}:null;}})[_0x9c94('0x27')](respondWithResult(_0x41bf7d,null))['catch'](handleError(_0x41bf7d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index af4d793..dc29835 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 _0x80ea=['update','remove','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x4b5e6d,_0x43c640){var _0x1af022=function(_0x11dc32){while(--_0x11dc32){_0x4b5e6d['push'](_0x4b5e6d['shift']());}};_0x1af022(++_0x43c640);}(_0x80ea,0x1cf));var _0xa80e=function(_0x42fea3,_0x5ae69b){_0x42fea3=_0x42fea3-0x0;var _0x27df4a=_0x80ea[_0x42fea3];return _0x27df4a;};'use strict';var EventEmitter=require(_0xa80e('0x0'));var Dashboard=require(_0xa80e('0x1'))['db'][_0xa80e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa80e('0x3')](0x0);var events={'afterCreate':_0xa80e('0x4'),'afterUpdate':_0xa80e('0x5'),'afterDestroy':_0xa80e('0x6')};function emitEvent(_0x521626){return function(_0x1d1c5b,_0x1935bb,_0xa60975){DashboardEvents['emit'](_0x521626+':'+_0x1d1c5b['id'],_0x1d1c5b);DashboardEvents['emit'](_0x521626,_0x1d1c5b);_0xa60975(null);};}for(var e in events){if(events[_0xa80e('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa80e('0x8')]=DashboardEvents; \ No newline at end of file +var _0x2d8e=['Dashboard','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1c82ff,_0x17dbda){var _0x3281d9=function(_0x5632bd){while(--_0x5632bd){_0x1c82ff['push'](_0x1c82ff['shift']());}};_0x3281d9(++_0x17dbda);}(_0x2d8e,0x17a));var _0xe2d8=function(_0x5dbcc5,_0x2a6363){_0x5dbcc5=_0x5dbcc5-0x0;var _0x18daae=_0x2d8e[_0x5dbcc5];return _0x18daae;};'use strict';var EventEmitter=require(_0xe2d8('0x0'));var Dashboard=require(_0xe2d8('0x1'))['db'][_0xe2d8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe2d8('0x3')](0x0);var events={'afterCreate':_0xe2d8('0x4'),'afterUpdate':_0xe2d8('0x5'),'afterDestroy':_0xe2d8('0x6')};function emitEvent(_0x1f21e0){return function(_0x3714c2,_0x5cc70a,_0x21d44d){DashboardEvents['emit'](_0x1f21e0+':'+_0x3714c2['id'],_0x3714c2);DashboardEvents['emit'](_0x1f21e0,_0x3714c2);_0x21d44d(null);};}for(var e in events){if(events[_0xe2d8('0x7')](e)){var event=events[e];Dashboard[_0xe2d8('0x8')](e,emitEvent(event));}}module[_0xe2d8('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7faa5b9..5045b20 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 _0xbd31=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xbd31,0x79));var _0x1bd3=function(_0x1c20d0,_0x5322b0){_0x1c20d0=_0x1c20d0-0x0;var _0xaf2a73=_0xbd31[_0x1c20d0];return _0xaf2a73;};'use strict';var _=require(_0x1bd3('0x0'));var util=require(_0x1bd3('0x1'));var logger=require(_0x1bd3('0x2'))(_0x1bd3('0x3'));var moment=require(_0x1bd3('0x4'));var BPromise=require(_0x1bd3('0x5'));var rp=require(_0x1bd3('0x6'));var fs=require('fs');var path=require(_0x1bd3('0x7'));var rimraf=require(_0x1bd3('0x8'));var config=require(_0x1bd3('0x9'));var attributes=require(_0x1bd3('0xa'));module['exports']=function(_0x49b622,_0x593335){return _0x49b622['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd69=['moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','define','dashboards','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd69,0x188));var _0x9dd6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdd69[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9dd6('0x0'));var util=require(_0x9dd6('0x1'));var logger=require(_0x9dd6('0x2'))(_0x9dd6('0x3'));var moment=require(_0x9dd6('0x4'));var BPromise=require(_0x9dd6('0x5'));var rp=require(_0x9dd6('0x6'));var fs=require('fs');var path=require(_0x9dd6('0x7'));var rimraf=require('rimraf');var config=require(_0x9dd6('0x8'));var attributes=require(_0x9dd6('0x9'));module['exports']=function(_0x4775de,_0x5b8254){return _0x4775de[_0x9dd6('0xa')]('Dashboard',attributes,{'tableName':_0x9dd6('0xb'),'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 1c0086e..3c8bee5 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 _0xa4d1=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x54a2c3,_0x57cc09){var _0x2a60ed=function(_0x50b1fa){while(--_0x50b1fa){_0x54a2c3['push'](_0x54a2c3['shift']());}};_0x2a60ed(++_0x57cc09);}(_0xa4d1,0x16a));var _0x1a4d=function(_0x4eb42c,_0x434cf0){_0x4eb42c=_0x4eb42c-0x0;var _0x11c8e7=_0xa4d1[_0x4eb42c];return _0x11c8e7;};'use strict';var _=require(_0x1a4d('0x0'));var util=require('util');var moment=require(_0x1a4d('0x1'));var BPromise=require(_0x1a4d('0x2'));var rs=require(_0x1a4d('0x3'));var fs=require('fs');var Redis=require(_0x1a4d('0x4'));var db=require(_0x1a4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a4d('0x6'))('rpc');var config=require(_0x1a4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a4d('0x8')]['http']({'port':0x232a});config[_0x1a4d('0x9')]=_[_0x1a4d('0xa')](config[_0x1a4d('0x9')],{'host':_0x1a4d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a4d('0x9')]));require(_0x1a4d('0xc'))[_0x1a4d('0xd')](socket);function respondWithRpcPromise(_0x22c3b2,_0x272593,_0x17946e){return new BPromise(function(_0x692efe,_0x1e4593){return client['request'](_0x22c3b2,_0x17946e)[_0x1a4d('0xe')](function(_0x48d62c){logger['info'](_0x1a4d('0xf'),_0x272593,_0x1a4d('0x10'));logger[_0x1a4d('0x11')](_0x1a4d('0x12'),_0x272593,'request\x20sent',JSON['stringify'](_0x48d62c));if(_0x48d62c[_0x1a4d('0x13')]){if(_0x48d62c[_0x1a4d('0x13')]['code']===0x1f4){logger[_0x1a4d('0x13')]('Dashboard,\x20%s,\x20%s',_0x272593,_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);return _0x1e4593(_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);}logger[_0x1a4d('0x13')](_0x1a4d('0xf'),_0x272593,_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);return _0x692efe(_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);}else{logger[_0x1a4d('0x15')](_0x1a4d('0xf'),_0x272593,'request\x20sent');_0x692efe(_0x48d62c[_0x1a4d('0x16')][_0x1a4d('0x14')]);}})[_0x1a4d('0x17')](function(_0x27e62d){logger['error'](_0x1a4d('0xf'),_0x272593,_0x27e62d);_0x1e4593(_0x27e62d);});});} \ No newline at end of file +var _0x903f=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','request\x20sent','debug','stringify','code','error','Dashboard,\x20%s,\x20%s','message','result'];(function(_0x344128,_0x9b9e88){var _0x693fae=function(_0x3e2b2e){while(--_0x3e2b2e){_0x344128['push'](_0x344128['shift']());}};_0x693fae(++_0x9b9e88);}(_0x903f,0x197));var _0xf903=function(_0x3913d5,_0x2f7f8d){_0x3913d5=_0x3913d5-0x0;var _0x3bb52e=_0x903f[_0x3913d5];return _0x3bb52e;};'use strict';var _=require(_0xf903('0x0'));var util=require(_0xf903('0x1'));var moment=require(_0xf903('0x2'));var BPromise=require(_0xf903('0x3'));var rs=require(_0xf903('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf903('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf903('0x6'))(_0xf903('0x7'));var config=require(_0xf903('0x8'));var jayson=require(_0xf903('0x9'));var client=jayson[_0xf903('0xa')][_0xf903('0xb')]({'port':0x232a});config[_0xf903('0xc')]=_[_0xf903('0xd')](config[_0xf903('0xc')],{'host':_0xf903('0xe'),'port':0x18eb});var socket=require(_0xf903('0xf'))(new Redis(config[_0xf903('0xc')]));require(_0xf903('0x10'))['register'](socket);function respondWithRpcPromise(_0x5f5d60,_0x39a1a1,_0xebd10){return new BPromise(function(_0x23dcb0,_0x39ba04){return client[_0xf903('0x11')](_0x5f5d60,_0xebd10)[_0xf903('0x12')](function(_0xe420e9){logger[_0xf903('0x13')]('Dashboard,\x20%s,\x20%s',_0x39a1a1,_0xf903('0x14'));logger[_0xf903('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x39a1a1,_0xf903('0x14'),JSON[_0xf903('0x16')](_0xe420e9));if(_0xe420e9['error']){if(_0xe420e9['error'][_0xf903('0x17')]===0x1f4){logger[_0xf903('0x18')](_0xf903('0x19'),_0x39a1a1,_0xe420e9[_0xf903('0x18')][_0xf903('0x1a')]);return _0x39ba04(_0xe420e9[_0xf903('0x18')][_0xf903('0x1a')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x39a1a1,_0xe420e9[_0xf903('0x18')][_0xf903('0x1a')]);return _0x23dcb0(_0xe420e9['error'][_0xf903('0x1a')]);}else{logger[_0xf903('0x13')](_0xf903('0x19'),_0x39a1a1,'request\x20sent');_0x23dcb0(_0xe420e9[_0xf903('0x1b')][_0xf903('0x1a')]);}})[_0xf903('0x1c')](function(_0x2253a3){logger[_0xf903('0x18')](_0xf903('0x19'),_0x39a1a1,_0x2253a3);_0x39ba04(_0x2253a3);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index aced1dd..85fb085 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 _0x5a73=['dashboard:','./dashboard.events','save','update','emit','removeListener','register','length'];(function(_0xdf5452,_0x19af67){var _0xf35e7b=function(_0x4a4ad8){while(--_0x4a4ad8){_0xdf5452['push'](_0xdf5452['shift']());}};_0xf35e7b(++_0x19af67);}(_0x5a73,0xb1));var _0x35a7=function(_0x5db081,_0x270109){_0x5db081=_0x5db081-0x0;var _0x2d881e=_0x5a73[_0x5db081];return _0x2d881e;};'use strict';var DashboardEvents=require(_0x35a7('0x0'));var events=[_0x35a7('0x1'),'remove',_0x35a7('0x2')];function createListener(_0x538ee4,_0x489abe){return function(_0x2465a5){_0x489abe[_0x35a7('0x3')](_0x538ee4,_0x2465a5);};}function removeListener(_0x1fc0af,_0x1e7767){return function(){DashboardEvents[_0x35a7('0x4')](_0x1fc0af,_0x1e7767);};}exports[_0x35a7('0x5')]=function(_0x530218){for(var _0xbd4a21=0x0,_0x1dd877=events[_0x35a7('0x6')];_0xbd4a21<_0x1dd877;_0xbd4a21++){var _0x5b9e08=events[_0xbd4a21];var _0x4adb55=createListener(_0x35a7('0x7')+_0x5b9e08,_0x530218);DashboardEvents['on'](_0x5b9e08,_0x4adb55);}}; \ No newline at end of file +var _0x465c=['save','remove','removeListener','length','dashboard:','./dashboard.events'];(function(_0x10be8d,_0x16f086){var _0xc3a7d=function(_0x3afe22){while(--_0x3afe22){_0x10be8d['push'](_0x10be8d['shift']());}};_0xc3a7d(++_0x16f086);}(_0x465c,0xcb));var _0xc465=function(_0xfe89fc,_0x3ddd7d){_0xfe89fc=_0xfe89fc-0x0;var _0x4837d1=_0x465c[_0xfe89fc];return _0x4837d1;};'use strict';var DashboardEvents=require(_0xc465('0x0'));var events=[_0xc465('0x1'),_0xc465('0x2'),'update'];function createListener(_0x32573b,_0x58ba03){return function(_0x4c0503){_0x58ba03['emit'](_0x32573b,_0x4c0503);};}function removeListener(_0x1202d8,_0x5f34e0){return function(){DashboardEvents[_0xc465('0x3')](_0x1202d8,_0x5f34e0);};}exports['register']=function(_0x9649a3){for(var _0x30a994=0x0,_0x3f981=events[_0xc465('0x4')];_0x30a994<_0x3f981;_0x30a994++){var _0x73bf1e=events[_0x30a994];var _0x205aee=createListener(_0xc465('0x5')+_0x73bf1e,_0x9649a3);DashboardEvents['on'](_0x73bf1e,_0x205aee);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5c5f043..520ff56 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 _0xe40b=['./dashboard.controller','get','isAuthenticated','index','getItems','post','create','/:id/clone','clone','/:id/items','put','update','/:id','exports','multer','express','Router','../../components/auth/service'];(function(_0xe4636b,_0x2620dd){var _0xe2b2b1=function(_0x5b2a4b){while(--_0x5b2a4b){_0xe4636b['push'](_0xe4636b['shift']());}};_0xe2b2b1(++_0x2620dd);}(_0xe40b,0x11c));var _0xbe40=function(_0x3014e8,_0x4f14d5){_0x3014e8=_0x3014e8-0x0;var _0x35b417=_0xe40b[_0x3014e8];return _0x35b417;};'use strict';var multer=require(_0xbe40('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe40('0x1'));var router=express[_0xbe40('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbe40('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe40('0x4'));router[_0xbe40('0x5')]('/',auth[_0xbe40('0x6')](),controller[_0xbe40('0x7')]);router[_0xbe40('0x5')]('/:id',auth[_0xbe40('0x6')](),controller['show']);router[_0xbe40('0x5')]('/:id/items',auth[_0xbe40('0x6')](),controller[_0xbe40('0x8')]);router[_0xbe40('0x9')]('/',auth[_0xbe40('0x6')](),controller[_0xbe40('0xa')]);router[_0xbe40('0x9')](_0xbe40('0xb'),auth[_0xbe40('0x6')](),controller[_0xbe40('0xc')]);router[_0xbe40('0x9')](_0xbe40('0xd'),auth[_0xbe40('0x6')](),controller['addItem']);router[_0xbe40('0xe')]('/:id',auth[_0xbe40('0x6')](),controller[_0xbe40('0xf')]);router['delete'](_0xbe40('0x10'),auth[_0xbe40('0x6')](),controller['destroy']);module[_0xbe40('0x11')]=router; \ No newline at end of file +var _0x6062=['post','create','/:id/clone','clone','addItem','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6062,0x87));var _0x2606=function(_0x35c34c,_0x21ac81){_0x35c34c=_0x35c34c-0x0;var _0x5c2f62=_0x6062[_0x35c34c];return _0x5c2f62;};'use strict';var multer=require('multer');var util=require(_0x2606('0x0'));var path=require(_0x2606('0x1'));var timeout=require('connect-timeout');var express=require(_0x2606('0x2'));var router=express[_0x2606('0x3')]();var fs_extra=require(_0x2606('0x4'));var auth=require(_0x2606('0x5'));var interaction=require(_0x2606('0x6'));var config=require(_0x2606('0x7'));var controller=require(_0x2606('0x8'));router[_0x2606('0x9')]('/',auth[_0x2606('0xa')](),controller[_0x2606('0xb')]);router[_0x2606('0x9')]('/:id',auth[_0x2606('0xa')](),controller[_0x2606('0xc')]);router['get'](_0x2606('0xd'),auth[_0x2606('0xa')](),controller[_0x2606('0xe')]);router[_0x2606('0xf')]('/',auth[_0x2606('0xa')](),controller[_0x2606('0x10')]);router[_0x2606('0xf')](_0x2606('0x11'),auth[_0x2606('0xa')](),controller[_0x2606('0x12')]);router[_0x2606('0xf')]('/:id/items',auth[_0x2606('0xa')](),controller[_0x2606('0x13')]);router[_0x2606('0x14')](_0x2606('0x15'),auth[_0x2606('0xa')](),controller['update']);router[_0x2606('0x16')](_0x2606('0x15'),auth['isAuthenticated'](),controller[_0x2606('0x17')]);module[_0x2606('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 94a0b75..02b00b5 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x5d17,0x114));var _0x75d1=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x5d17[_0x3f2228];return _0x285ae4;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x2b8971,_0x581f63){var _0x1aaddc=function(_0xffa738){while(--_0xffa738){_0x2b8971['push'](_0x2b8971['shift']());}};_0x1aaddc(++_0x581f63);}(_0x33af,0xec));var _0xf33a=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0x33af[_0xee37f1];return _0x37fd54;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'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 609d923..e6eafc8 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 _0x0a05=['redis','defaults','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','include','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','multibar-chart','attrSerie1','attrSerie3','attrWhatsappAccounts','attrChatWebsites','web-report','attrReport','reportType','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0a05,0x9e));var _0x50a0=function(_0xfb9aaa,_0x37935d){_0xfb9aaa=_0xfb9aaa-0x0;var _0x103bf7=_0x0a05[_0xfb9aaa];return _0x103bf7;};'use strict';var emlformat=require(_0x50a0('0x0'));var rimraf=require(_0x50a0('0x1'));var zipdir=require(_0x50a0('0x2'));var jsonpatch=require(_0x50a0('0x3'));var rp=require(_0x50a0('0x4'));var moment=require(_0x50a0('0x5'));var BPromise=require(_0x50a0('0x6'));var Mustache=require('mustache');var util=require(_0x50a0('0x7'));var path=require('path');var sox=require(_0x50a0('0x8'));var csv=require('to-csv');var ejs=require(_0x50a0('0x9'));var fs=require('fs');var fs_extra=require(_0x50a0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x50a0('0xb'));var jsforce=require(_0x50a0('0xc'));var deskjs=require(_0x50a0('0xd'));var toCsv=require(_0x50a0('0xe'));var querystring=require('querystring');var Papa=require(_0x50a0('0xf'));var Redis=require('ioredis');var authService=require(_0x50a0('0x10'));var qs=require(_0x50a0('0x11'));var as=require(_0x50a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50a0('0x13'))('api');var utils=require(_0x50a0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50a0('0x15'))['db'];config[_0x50a0('0x16')]=_[_0x50a0('0x17')](config[_0x50a0('0x16')],{'host':_0x50a0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50a0('0x16')]));require(_0x50a0('0x19'))[_0x50a0('0x1a')](socket);function respondWithStatusCode(_0x2a083d,_0x113142){_0x113142=_0x113142||0xcc;return function(_0x572bcb){if(_0x572bcb){return _0x2a083d['sendStatus'](_0x113142);}return _0x2a083d['status'](_0x113142)['end']();};}function respondWithResult(_0x2a4ce7,_0x2b6b20){_0x2b6b20=_0x2b6b20||0xc8;return function(_0x3c641e){if(_0x3c641e){return _0x2a4ce7[_0x50a0('0x1b')](_0x2b6b20)[_0x50a0('0x1c')](_0x3c641e);}};}function respondWithFilteredResult(_0x474f10,_0x4a9c6f){return function(_0x4e2e05){if(_0x4e2e05){var _0x4303b1=typeof _0x4a9c6f[_0x50a0('0x1d')]===_0x50a0('0x1e')&&typeof _0x4a9c6f[_0x50a0('0x1f')]===_0x50a0('0x1e');var _0x48ec1e=_0x4e2e05[_0x50a0('0x20')];var _0x5d7536=_0x4303b1?0x0:_0x4a9c6f[_0x50a0('0x1d')];var _0x2d7773=_0x4303b1?_0x4e2e05[_0x50a0('0x20')]:_0x4a9c6f[_0x50a0('0x1d')]+_0x4a9c6f['limit'];var _0x62c40a;if(_0x2d7773>=_0x48ec1e){_0x2d7773=_0x48ec1e;_0x62c40a=0xc8;}else{_0x62c40a=0xce;}_0x474f10['status'](_0x62c40a);return _0x474f10[_0x50a0('0x21')](_0x50a0('0x22'),_0x5d7536+'-'+_0x2d7773+'/'+_0x48ec1e)['json'](_0x4e2e05);}return null;};}function patchUpdates(_0x190263){return function(_0x449c5d){try{jsonpatch[_0x50a0('0x23')](_0x449c5d,_0x190263,!![]);}catch(_0x89e493){return BPromise[_0x50a0('0x24')](_0x89e493);}return _0x449c5d[_0x50a0('0x25')]();};}function saveUpdates(_0x427094,_0x263c00){return function(_0x4b5467){if(_0x4b5467){return _0x4b5467['update'](_0x427094)[_0x50a0('0x26')](function(_0x44958b){return _0x44958b;});}return null;};}function removeEntity(_0xba9168,_0x4c9d9b){return function(_0x40b91c){if(_0x40b91c){return _0x40b91c[_0x50a0('0x27')]()[_0x50a0('0x26')](function(){_0xba9168['status'](0xcc)[_0x50a0('0x28')]();});}};}function handleEntityNotFound(_0x498a52,_0x3d0b47){return function(_0xf174f5){if(!_0xf174f5){_0x498a52[_0x50a0('0x29')](0x194);}return _0xf174f5;};}function handleError(_0x4d7d78,_0xde56f1){_0xde56f1=_0xde56f1||0x1f4;return function(_0x2e0dd9){logger[_0x50a0('0x2a')](_0x2e0dd9['stack']);if(_0x2e0dd9[_0x50a0('0x2b')]){delete _0x2e0dd9[_0x50a0('0x2b')];}_0x4d7d78[_0x50a0('0x1b')](_0xde56f1)[_0x50a0('0x2c')](_0x2e0dd9);};}exports['show']=function(_0x54d1de,_0x56e4f5){var _0x5524ae={'raw':![],'where':{'id':_0x54d1de[_0x50a0('0x2d')]['id']}},_0x271aa3={};_0x271aa3[_0x50a0('0x2e')]=_[_0x50a0('0x2f')](db[_0x50a0('0x30')][_0x50a0('0x31')]);_0x271aa3[_0x50a0('0x32')]=_['keys'](_0x54d1de['query']);_0x271aa3[_0x50a0('0x33')]=_['intersection'](_0x271aa3[_0x50a0('0x2e')],_0x271aa3['query']);_0x5524ae[_0x50a0('0x34')]=_[_0x50a0('0x35')](_0x271aa3[_0x50a0('0x2e')],qs[_0x50a0('0x36')](_0x54d1de[_0x50a0('0x32')][_0x50a0('0x36')]));_0x5524ae[_0x50a0('0x34')]=_0x5524ae[_0x50a0('0x34')][_0x50a0('0x37')]?_0x5524ae[_0x50a0('0x34')]:_0x271aa3[_0x50a0('0x2e')];if(_0x54d1de[_0x50a0('0x32')]['includeAll']){_0x5524ae[_0x50a0('0x38')]=[{'all':!![]}];}_0x5524ae=_['merge']({},_0x5524ae,_0x54d1de['options']);return db[_0x50a0('0x30')][_0x50a0('0x39')](_0x5524ae)['then'](handleEntityNotFound(_0x56e4f5,null))[_0x50a0('0x26')](respondWithResult(_0x56e4f5,null))[_0x50a0('0x3a')](handleError(_0x56e4f5,null));};exports[_0x50a0('0x27')]=function(_0x8eb59b,_0x234778){return db[_0x50a0('0x30')][_0x50a0('0x39')]({'where':{'id':_0x8eb59b[_0x50a0('0x2d')]['id']}})[_0x50a0('0x26')](handleEntityNotFound(_0x234778,null))[_0x50a0('0x26')](removeEntity(_0x234778,null))[_0x50a0('0x3a')](handleError(_0x234778,null));};function widgetAttributes(_0x15ca93){try{switch(_0x15ca93[_0x50a0('0x3b')]){case'iframe':return[{'name':_0x50a0('0x3c'),'value':_0x15ca93[_0x50a0('0x3c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0][_0x50a0('0x3e')]:undefined)||_0x50a0('0x3f')}];case _0x50a0('0x40'):return[{'name':'attrPath','value':_0x15ca93[_0x50a0('0x41')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93['attrs'][0x0][_0x50a0('0x3e')]:undefined)||''}];case _0x50a0('0x42'):return[{'name':'attrHourFormat','value':_0x15ca93[_0x50a0('0x43')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||_0x50a0('0x44')},{'name':_0x50a0('0x45'),'value':_0x15ca93[_0x50a0('0x45')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1]['value']:undefined)||'0.00'},{'name':_0x50a0('0x46'),'value':_0x15ca93[_0x50a0('0x46')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||0xc}];case _0x50a0('0x47'):return[{'name':_0x50a0('0x48'),'value':_0x15ca93['attrMetric']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93['attrs'][0x0]['value']:undefined)||_0x50a0('0x49')},{'name':'attrVoiceQueues','value':_0x15ca93[_0x50a0('0x4a')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1][_0x50a0('0x3e')]:undefined)||[]},{'name':_0x50a0('0x46'),'value':_0x15ca93[_0x50a0('0x46')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0x50a0('0x4b'),'value':_0x15ca93[_0x50a0('0x4b')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x3]?_0x15ca93[_0x50a0('0x3d')][0x3][_0x50a0('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x15ca93['attrEmailAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x4]?_0x15ca93[_0x50a0('0x3d')][0x4][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4c'),'value':_0x15ca93[_0x50a0('0x4c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x5]?_0x15ca93[_0x50a0('0x3d')][0x5][_0x50a0('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x15ca93[_0x50a0('0x4d')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x6]?_0x15ca93[_0x50a0('0x3d')][0x6]['value']:undefined)||''},{'name':_0x50a0('0x4e'),'value':_0x15ca93['attrOpenchannelAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x7]?_0x15ca93[_0x50a0('0x3d')][0x7][_0x50a0('0x3e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x15ca93['attrWhatsappAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x8]?_0x15ca93[_0x50a0('0x3d')][0x8][_0x50a0('0x3e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x15ca93['attrChatWebsites']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x9]?_0x15ca93['attrs'][0x9]['value']:undefined)||''}];case _0x50a0('0x4f'):case'pie-chart':return[{'name':_0x50a0('0x50'),'value':_0x15ca93[_0x50a0('0x50')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||_0x50a0('0x49')},{'name':'attrSerie2','value':_0x15ca93['attrSerie2']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1][_0x50a0('0x3e')]:undefined)||null},{'name':_0x50a0('0x51'),'value':_0x15ca93[_0x50a0('0x51')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x15ca93[_0x50a0('0x4a')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x3]?_0x15ca93[_0x50a0('0x3d')][0x3][_0x50a0('0x3e')]:undefined)||[]},{'name':_0x50a0('0x4b'),'value':_0x15ca93['attrChannel']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x4]?_0x15ca93[_0x50a0('0x3d')][0x4][_0x50a0('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x15ca93['attrEmailAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x5]?_0x15ca93[_0x50a0('0x3d')][0x5][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4c'),'value':_0x15ca93[_0x50a0('0x4c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x6]?_0x15ca93[_0x50a0('0x3d')][0x6][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4d'),'value':_0x15ca93[_0x50a0('0x4d')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x7]?_0x15ca93[_0x50a0('0x3d')][0x7][_0x50a0('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x15ca93[_0x50a0('0x4e')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x8]?_0x15ca93[_0x50a0('0x3d')][0x8][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x52'),'value':_0x15ca93[_0x50a0('0x52')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x9]?_0x15ca93[_0x50a0('0x3d')][0x9]['value']:undefined)||''},{'name':_0x50a0('0x53'),'value':_0x15ca93[_0x50a0('0x53')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0xa]?_0x15ca93['attrs'][0xa]['value']:undefined)||''}];case _0x50a0('0x54'):return[{'name':_0x50a0('0x55'),'type':_0x15ca93[_0x50a0('0x56')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['type']:undefined)||null,'value':_0x15ca93[_0x50a0('0x55')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x15ca93['attrRefresh']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x1]?_0x15ca93['attrs'][0x1][_0x50a0('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x34974b){logger[_0x50a0('0x2a')]('widgetAttributes:\x20%s',JSON['stringify'](_0x34974b));return[];}}exports[_0x50a0('0x57')]=function(_0x53602e,_0x5da081){if(_0x53602e[_0x50a0('0x58')]){_0x53602e[_0x50a0('0x58')]['attrs']=widgetAttributes(_0x53602e[_0x50a0('0x58')]);}return db['DashboardItem'][_0x50a0('0x57')](_0x53602e[_0x50a0('0x58')],{})[_0x50a0('0x26')](respondWithResult(_0x5da081,0xc9))[_0x50a0('0x3a')](handleError(_0x5da081,null));};exports[_0x50a0('0x59')]=function(_0xc65b9,_0xe6a02d){if(_0xc65b9[_0x50a0('0x58')]['id']){delete _0xc65b9[_0x50a0('0x58')]['id'];}_0xc65b9['body'][_0x50a0('0x3d')]=widgetAttributes(_0xc65b9[_0x50a0('0x58')]);return db['DashboardItem'][_0x50a0('0x39')]({'where':{'id':_0xc65b9['params']['id']}})['then'](handleEntityNotFound(_0xe6a02d,null))['then'](saveUpdates(_0xc65b9['body'],null))[_0x50a0('0x26')](respondWithResult(_0xe6a02d,null))[_0x50a0('0x3a')](handleError(_0xe6a02d,null));}; \ No newline at end of file +var _0x3dd6=['attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','show','params','model','keys','DashboardItem','query','intersection','attributes','fields','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dd6,0xcf));var _0x63dd=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0x3dd6[_0xaaa123];return _0x44d6d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x63dd('0x0'));var rp=require(_0x63dd('0x1'));var moment=require(_0x63dd('0x2'));var BPromise=require(_0x63dd('0x3'));var Mustache=require(_0x63dd('0x4'));var util=require(_0x63dd('0x5'));var path=require('path');var sox=require(_0x63dd('0x6'));var csv=require('to-csv');var ejs=require(_0x63dd('0x7'));var fs=require('fs');var fs_extra=require(_0x63dd('0x8'));var _=require(_0x63dd('0x9'));var squel=require(_0x63dd('0xa'));var crypto=require(_0x63dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63dd('0xc'));var toCsv=require(_0x63dd('0xd'));var querystring=require(_0x63dd('0xe'));var Papa=require(_0x63dd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63dd('0x10'));var as=require(_0x63dd('0x11'));var hardwareService=require(_0x63dd('0x12'));var logger=require(_0x63dd('0x13'))(_0x63dd('0x14'));var utils=require('../../config/utils');var config=require(_0x63dd('0x15'));var licenseUtil=require(_0x63dd('0x16'));var db=require(_0x63dd('0x17'))['db'];config[_0x63dd('0x18')]=_['defaults'](config[_0x63dd('0x18')],{'host':_0x63dd('0x19'),'port':0x18eb});var socket=require(_0x63dd('0x1a'))(new Redis(config[_0x63dd('0x18')]));require(_0x63dd('0x1b'))[_0x63dd('0x1c')](socket);function respondWithStatusCode(_0x56c030,_0x5b2f9f){_0x5b2f9f=_0x5b2f9f||0xcc;return function(_0x46952c){if(_0x46952c){return _0x56c030[_0x63dd('0x1d')](_0x5b2f9f);}return _0x56c030[_0x63dd('0x1e')](_0x5b2f9f)['end']();};}function respondWithResult(_0x4144eb,_0x3c9b5e){_0x3c9b5e=_0x3c9b5e||0xc8;return function(_0x1af946){if(_0x1af946){return _0x4144eb['status'](_0x3c9b5e)[_0x63dd('0x1f')](_0x1af946);}};}function respondWithFilteredResult(_0x368f85,_0x42781d){return function(_0xaf3376){if(_0xaf3376){var _0x3cb266=typeof _0x42781d[_0x63dd('0x20')]===_0x63dd('0x21')&&typeof _0x42781d[_0x63dd('0x22')]===_0x63dd('0x21');var _0x8f2691=_0xaf3376[_0x63dd('0x23')];var _0x1e09a5=_0x3cb266?0x0:_0x42781d['offset'];var _0x2e1305=_0x3cb266?_0xaf3376['count']:_0x42781d[_0x63dd('0x20')]+_0x42781d[_0x63dd('0x22')];var _0x22ad3d;if(_0x2e1305>=_0x8f2691){_0x2e1305=_0x8f2691;_0x22ad3d=0xc8;}else{_0x22ad3d=0xce;}_0x368f85['status'](_0x22ad3d);return _0x368f85[_0x63dd('0x24')](_0x63dd('0x25'),_0x1e09a5+'-'+_0x2e1305+'/'+_0x8f2691)[_0x63dd('0x1f')](_0xaf3376);}return null;};}function patchUpdates(_0x887c58){return function(_0x19e3e9){try{jsonpatch[_0x63dd('0x26')](_0x19e3e9,_0x887c58,!![]);}catch(_0xf8bc2){return BPromise[_0x63dd('0x27')](_0xf8bc2);}return _0x19e3e9[_0x63dd('0x28')]();};}function saveUpdates(_0x4b2451,_0x52cec7){return function(_0x48cfbe){if(_0x48cfbe){return _0x48cfbe[_0x63dd('0x29')](_0x4b2451)[_0x63dd('0x2a')](function(_0x540a9f){return _0x540a9f;});}return null;};}function removeEntity(_0x34d5d5,_0x222e13){return function(_0x4a80df){if(_0x4a80df){return _0x4a80df[_0x63dd('0x2b')]()[_0x63dd('0x2a')](function(){_0x34d5d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2417f0,_0x474f3e){return function(_0x105618){if(!_0x105618){_0x2417f0[_0x63dd('0x1d')](0x194);}return _0x105618;};}function handleError(_0x15a13d,_0x47aa25){_0x47aa25=_0x47aa25||0x1f4;return function(_0x7ca662){logger['error'](_0x7ca662[_0x63dd('0x2c')]);if(_0x7ca662['name']){delete _0x7ca662['name'];}_0x15a13d[_0x63dd('0x1e')](_0x47aa25)[_0x63dd('0x2d')](_0x7ca662);};}exports[_0x63dd('0x2e')]=function(_0x3da8d5,_0x2734c9){var _0x452daf={'raw':![],'where':{'id':_0x3da8d5[_0x63dd('0x2f')]['id']}},_0x5525fd={};_0x5525fd[_0x63dd('0x30')]=_[_0x63dd('0x31')](db[_0x63dd('0x32')]['rawAttributes']);_0x5525fd[_0x63dd('0x33')]=_[_0x63dd('0x31')](_0x3da8d5[_0x63dd('0x33')]);_0x5525fd['filters']=_[_0x63dd('0x34')](_0x5525fd[_0x63dd('0x30')],_0x5525fd[_0x63dd('0x33')]);_0x452daf[_0x63dd('0x35')]=_['intersection'](_0x5525fd['model'],qs[_0x63dd('0x36')](_0x3da8d5['query'][_0x63dd('0x36')]));_0x452daf[_0x63dd('0x35')]=_0x452daf[_0x63dd('0x35')]['length']?_0x452daf[_0x63dd('0x35')]:_0x5525fd[_0x63dd('0x30')];if(_0x3da8d5[_0x63dd('0x33')]['includeAll']){_0x452daf[_0x63dd('0x37')]=[{'all':!![]}];}_0x452daf=_[_0x63dd('0x38')]({},_0x452daf,_0x3da8d5[_0x63dd('0x39')]);return db[_0x63dd('0x32')][_0x63dd('0x3a')](_0x452daf)[_0x63dd('0x2a')](handleEntityNotFound(_0x2734c9,null))['then'](respondWithResult(_0x2734c9,null))['catch'](handleError(_0x2734c9,null));};exports[_0x63dd('0x2b')]=function(_0x4c8d7f,_0x1ee993){return db['DashboardItem']['find']({'where':{'id':_0x4c8d7f['params']['id']}})[_0x63dd('0x2a')](handleEntityNotFound(_0x1ee993,null))[_0x63dd('0x2a')](removeEntity(_0x1ee993,null))[_0x63dd('0x3b')](handleError(_0x1ee993,null));};function widgetAttributes(_0x393d1c){try{switch(_0x393d1c[_0x63dd('0x3c')]){case _0x63dd('0x3d'):return[{'name':'attrUrl','value':_0x393d1c[_0x63dd('0x3e')]||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c[_0x63dd('0x3f')][0x0][_0x63dd('0x40')]:undefined)||_0x63dd('0x41')}];case _0x63dd('0x42'):return[{'name':'attrPath','value':_0x393d1c['attrPath']||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c['attrs'][0x0][_0x63dd('0x40')]:undefined)||''}];case _0x63dd('0x43'):return[{'name':_0x63dd('0x44'),'value':_0x393d1c[_0x63dd('0x44')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c[_0x63dd('0x3f')][0x0][_0x63dd('0x40')]:undefined)||'HH:mm:ss'},{'name':_0x63dd('0x45'),'value':_0x393d1c[_0x63dd('0x45')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x1]?_0x393d1c[_0x63dd('0x3f')][0x1][_0x63dd('0x40')]:undefined)||_0x63dd('0x46')},{'name':_0x63dd('0x47'),'value':_0x393d1c[_0x63dd('0x47')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x2]?_0x393d1c['attrs'][0x2][_0x63dd('0x40')]:undefined)||0xc}];case _0x63dd('0x48'):return[{'name':'attrMetric','value':_0x393d1c[_0x63dd('0x49')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c[_0x63dd('0x3f')][0x0][_0x63dd('0x40')]:undefined)||_0x63dd('0x4a')},{'name':_0x63dd('0x4b'),'value':_0x393d1c[_0x63dd('0x4b')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x1]?_0x393d1c['attrs'][0x1][_0x63dd('0x40')]:undefined)||[]},{'name':_0x63dd('0x47'),'value':_0x393d1c[_0x63dd('0x47')]||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0x2]?_0x393d1c['attrs'][0x2][_0x63dd('0x40')]:undefined)||0x14},{'name':_0x63dd('0x4c'),'value':_0x393d1c[_0x63dd('0x4c')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x3]?_0x393d1c[_0x63dd('0x3f')][0x3][_0x63dd('0x40')]:undefined)||_0x63dd('0x4d')},{'name':_0x63dd('0x4e'),'value':_0x393d1c[_0x63dd('0x4e')]||(_0x393d1c['attrs']&&_0x393d1c['attrs'][0x4]?_0x393d1c['attrs'][0x4]['value']:undefined)||''},{'name':_0x63dd('0x4f'),'value':_0x393d1c[_0x63dd('0x4f')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x5]?_0x393d1c['attrs'][0x5][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x50'),'value':_0x393d1c[_0x63dd('0x50')]||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0x6]?_0x393d1c['attrs'][0x6][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x51'),'value':_0x393d1c[_0x63dd('0x51')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x7]?_0x393d1c[_0x63dd('0x3f')][0x7][_0x63dd('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x393d1c[_0x63dd('0x52')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x8]?_0x393d1c[_0x63dd('0x3f')][0x8][_0x63dd('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x393d1c[_0x63dd('0x53')]||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0x9]?_0x393d1c[_0x63dd('0x3f')][0x9]['value']:undefined)||''}];case _0x63dd('0x54'):case _0x63dd('0x55'):return[{'name':_0x63dd('0x56'),'value':_0x393d1c[_0x63dd('0x56')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c['attrs'][0x0][_0x63dd('0x40')]:undefined)||_0x63dd('0x4a')},{'name':_0x63dd('0x57'),'value':_0x393d1c['attrSerie2']||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0x1]?_0x393d1c['attrs'][0x1][_0x63dd('0x40')]:undefined)||null},{'name':_0x63dd('0x58'),'value':_0x393d1c[_0x63dd('0x58')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x2]?_0x393d1c[_0x63dd('0x3f')][0x2]['value']:undefined)||null},{'name':_0x63dd('0x4b'),'value':_0x393d1c['attrVoiceQueues']||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x3]?_0x393d1c[_0x63dd('0x3f')][0x3]['value']:undefined)||[]},{'name':_0x63dd('0x4c'),'value':_0x393d1c[_0x63dd('0x4c')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x4]?_0x393d1c[_0x63dd('0x3f')][0x4][_0x63dd('0x40')]:undefined)||_0x63dd('0x4d')},{'name':_0x63dd('0x4e'),'value':_0x393d1c['attrEmailAccounts']||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x5]?_0x393d1c[_0x63dd('0x3f')][0x5][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x4f'),'value':_0x393d1c[_0x63dd('0x4f')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x6]?_0x393d1c['attrs'][0x6][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x50'),'value':_0x393d1c[_0x63dd('0x50')]||(_0x393d1c['attrs']&&_0x393d1c['attrs'][0x7]?_0x393d1c[_0x63dd('0x3f')][0x7]['value']:undefined)||''},{'name':_0x63dd('0x51'),'value':_0x393d1c[_0x63dd('0x51')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x8]?_0x393d1c['attrs'][0x8][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x52'),'value':_0x393d1c[_0x63dd('0x52')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x9]?_0x393d1c[_0x63dd('0x3f')][0x9][_0x63dd('0x40')]:undefined)||''},{'name':_0x63dd('0x53'),'value':_0x393d1c[_0x63dd('0x53')]||(_0x393d1c['attrs']&&_0x393d1c[_0x63dd('0x3f')][0xa]?_0x393d1c['attrs'][0xa][_0x63dd('0x40')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x393d1c[_0x63dd('0x59')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c[_0x63dd('0x3f')][0x0]?_0x393d1c['attrs'][0x0][_0x63dd('0x3c')]:undefined)||null,'value':_0x393d1c[_0x63dd('0x5a')]||(_0x393d1c[_0x63dd('0x3f')]&&_0x393d1c['attrs'][0x0]?_0x393d1c[_0x63dd('0x3f')][0x0][_0x63dd('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x393d1c[_0x63dd('0x5b')]||(_0x393d1c['attrs']&&_0x393d1c['attrs'][0x1]?_0x393d1c[_0x63dd('0x3f')][0x1][_0x63dd('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x46d946){logger['error'](_0x63dd('0x5c'),JSON[_0x63dd('0x5d')](_0x46d946));return[];}}exports[_0x63dd('0x5e')]=function(_0x737eaf,_0x5ccf7f){if(_0x737eaf[_0x63dd('0x5f')]){_0x737eaf[_0x63dd('0x5f')][_0x63dd('0x3f')]=widgetAttributes(_0x737eaf[_0x63dd('0x5f')]);}return db['DashboardItem'][_0x63dd('0x5e')](_0x737eaf['body'],{})['then'](respondWithResult(_0x5ccf7f,0xc9))['catch'](handleError(_0x5ccf7f,null));};exports['update']=function(_0x3057ce,_0x35aeb3){if(_0x3057ce['body']['id']){delete _0x3057ce[_0x63dd('0x5f')]['id'];}_0x3057ce['body'][_0x63dd('0x3f')]=widgetAttributes(_0x3057ce[_0x63dd('0x5f')]);return db[_0x63dd('0x32')][_0x63dd('0x3a')]({'where':{'id':_0x3057ce['params']['id']}})[_0x63dd('0x2a')](handleEntityNotFound(_0x35aeb3,null))['then'](saveUpdates(_0x3057ce['body'],null))['then'](respondWithResult(_0x35aeb3,null))[_0x63dd('0x3b')](handleError(_0x35aeb3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8d22e23..6344b52 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 _0xa9ed=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x5d7ea1,_0x1091e9){var _0x5724a6=function(_0x6d0375){while(--_0x6d0375){_0x5d7ea1['push'](_0x5d7ea1['shift']());}};_0x5724a6(++_0x1091e9);}(_0xa9ed,0x11b));var _0xda9e=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xa9ed[_0x2b1551];return _0x2fc2a1;};'use strict';var EventEmitter=require(_0xda9e('0x0'));var DashboardItem=require(_0xda9e('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xda9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda9e('0x3'),'afterDestroy':_0xda9e('0x4')};function emitEvent(_0x2527b1){return function(_0x49dc91,_0xcc01f4,_0x290fc5){DashboardItemEvents[_0xda9e('0x5')](_0x2527b1+':'+_0x49dc91['id'],_0x49dc91);DashboardItemEvents['emit'](_0x2527b1,_0x49dc91);_0x290fc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xda9e('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x236c=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x4e6dfe,_0x466405){var _0x1183d4=function(_0x50720f){while(--_0x50720f){_0x4e6dfe['push'](_0x4e6dfe['shift']());}};_0x1183d4(++_0x466405);}(_0x236c,0x164));var _0xc236=function(_0x45e579,_0x5e0fe3){_0x45e579=_0x45e579-0x0;var _0x391363=_0x236c[_0x45e579];return _0x391363;};'use strict';var EventEmitter=require(_0xc236('0x0'));var DashboardItem=require(_0xc236('0x1'))['db'][_0xc236('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc236('0x3')](0x0);var events={'afterCreate':_0xc236('0x4'),'afterUpdate':_0xc236('0x5'),'afterDestroy':_0xc236('0x6')};function emitEvent(_0x24dbd0){return function(_0x1c8f18,_0x5a8923,_0x366c45){DashboardItemEvents[_0xc236('0x7')](_0x24dbd0+':'+_0x1c8f18['id'],_0x1c8f18);DashboardItemEvents[_0xc236('0x7')](_0x24dbd0,_0x1c8f18);_0x366c45(null);};}for(var e in events){if(events[_0xc236('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index dda5e45..f057a89 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 _0x0c97=['exports','define','DashboardItem','dashboard_items','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x335cfa,_0x1e7634){var _0xb7a81b=function(_0x36cf8b){while(--_0x36cf8b){_0x335cfa['push'](_0x335cfa['shift']());}};_0xb7a81b(++_0x1e7634);}(_0x0c97,0x64));var _0x70c9=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x0c97[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var util=require(_0x70c9('0x0'));var logger=require('../../config/logger')(_0x70c9('0x1'));var moment=require('moment');var BPromise=require(_0x70c9('0x2'));var rp=require(_0x70c9('0x3'));var fs=require('fs');var path=require(_0x70c9('0x4'));var rimraf=require(_0x70c9('0x5'));var config=require(_0x70c9('0x6'));var attributes=require(_0x70c9('0x7'));module[_0x70c9('0x8')]=function(_0xdeb2fa,_0x5a4400){return _0xdeb2fa[_0x70c9('0x9')](_0x70c9('0xa'),attributes,{'tableName':_0x70c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02c1=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x15beeb,_0x32bd4f){var _0x5b681a=function(_0x2f9b5c){while(--_0x2f9b5c){_0x15beeb['push'](_0x15beeb['shift']());}};_0x5b681a(++_0x32bd4f);}(_0x02c1,0x8e));var _0x102c=function(_0x3ea3b4,_0x46eaeb){_0x3ea3b4=_0x3ea3b4-0x0;var _0x520f06=_0x02c1[_0x3ea3b4];return _0x520f06;};'use strict';var _=require(_0x102c('0x0'));var util=require('util');var logger=require(_0x102c('0x1'))(_0x102c('0x2'));var moment=require(_0x102c('0x3'));var BPromise=require('bluebird');var rp=require(_0x102c('0x4'));var fs=require('fs');var path=require(_0x102c('0x5'));var rimraf=require(_0x102c('0x6'));var config=require(_0x102c('0x7'));var attributes=require(_0x102c('0x8'));module[_0x102c('0x9')]=function(_0x5630a7,_0x52b172){return _0x5630a7[_0x102c('0xa')](_0x102c('0xb'),attributes,{'tableName':_0x102c('0xc'),'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 abd956e..1e9eec6 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 _0xbb0b=['redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','defaults'];(function(_0x34aa1b,_0x477610){var _0x4cff5f=function(_0x5bdd0b){while(--_0x5bdd0b){_0x34aa1b['push'](_0x34aa1b['shift']());}};_0x4cff5f(++_0x477610);}(_0xbb0b,0x1d1));var _0xbbb0=function(_0xb2ced3,_0x582d89){_0xb2ced3=_0xb2ced3-0x0;var _0x18e671=_0xbb0b[_0xb2ced3];return _0x18e671;};'use strict';var _=require(_0xbbb0('0x0'));var util=require(_0xbbb0('0x1'));var moment=require(_0xbbb0('0x2'));var BPromise=require(_0xbbb0('0x3'));var rs=require(_0xbbb0('0x4'));var fs=require('fs');var Redis=require(_0xbbb0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbb0('0x6'))(_0xbbb0('0x7'));var config=require(_0xbbb0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbbb0('0x9')]({'port':0x232a});config['redis']=_[_0xbbb0('0xa')](config[_0xbbb0('0xb')],{'host':_0xbbb0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbb0('0xb')]));require(_0xbbb0('0xd'))[_0xbbb0('0xe')](socket);function respondWithRpcPromise(_0x5c3e5b,_0x45f761,_0x38f217){return new BPromise(function(_0x37f396,_0x3af9f1){return client[_0xbbb0('0xf')](_0x5c3e5b,_0x38f217)[_0xbbb0('0x10')](function(_0x22e5aa){logger[_0xbbb0('0x11')](_0xbbb0('0x12'),_0x45f761,_0xbbb0('0x13'));logger[_0xbbb0('0x14')](_0xbbb0('0x15'),_0x45f761,_0xbbb0('0x13'),JSON[_0xbbb0('0x16')](_0x22e5aa));if(_0x22e5aa['error']){if(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x18')]===0x1f4){logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0x22e5aa['error'][_0xbbb0('0x19')]);return _0x3af9f1(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);}logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);return _0x37f396(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);}else{logger[_0xbbb0('0x11')]('DashboardItem,\x20%s,\x20%s',_0x45f761,_0xbbb0('0x13'));_0x37f396(_0x22e5aa[_0xbbb0('0x1a')]['message']);}})[_0xbbb0('0x1b')](function(_0xa1707){logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0xa1707);_0x3af9f1(_0xa1707);});});} \ No newline at end of file +var _0x48c7=['randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x48c7,0x16e));var _0x748c=function(_0xe1bdfa,_0x5371ce){_0xe1bdfa=_0xe1bdfa-0x0;var _0x28daee=_0x48c7[_0xe1bdfa];return _0x28daee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x748c('0x0'));var BPromise=require(_0x748c('0x1'));var rs=require(_0x748c('0x2'));var fs=require('fs');var Redis=require(_0x748c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x748c('0x4'));var jayson=require(_0x748c('0x5'));var client=jayson[_0x748c('0x6')][_0x748c('0x7')]({'port':0x232a});config[_0x748c('0x8')]=_[_0x748c('0x9')](config['redis'],{'host':_0x748c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x748c('0xb'))[_0x748c('0xc')](socket);function respondWithRpcPromise(_0x522227,_0x469ecd,_0x5c037c){return new BPromise(function(_0x548da3,_0x5d2d5b){return client[_0x748c('0xd')](_0x522227,_0x5c037c)['then'](function(_0x2361b3){logger[_0x748c('0xe')](_0x748c('0xf'),_0x469ecd,'request\x20sent');logger['debug'](_0x748c('0x10'),_0x469ecd,_0x748c('0x11'),JSON[_0x748c('0x12')](_0x2361b3));if(_0x2361b3[_0x748c('0x13')]){if(_0x2361b3['error']['code']===0x1f4){logger[_0x748c('0x13')](_0x748c('0xf'),_0x469ecd,_0x2361b3[_0x748c('0x13')][_0x748c('0x14')]);return _0x5d2d5b(_0x2361b3['error'][_0x748c('0x14')]);}logger[_0x748c('0x13')](_0x748c('0xf'),_0x469ecd,_0x2361b3[_0x748c('0x13')][_0x748c('0x14')]);return _0x548da3(_0x2361b3[_0x748c('0x13')][_0x748c('0x14')]);}else{logger[_0x748c('0xe')](_0x748c('0xf'),_0x469ecd,_0x748c('0x11'));_0x548da3(_0x2361b3[_0x748c('0x15')][_0x748c('0x14')]);}})[_0x748c('0x16')](function(_0x10ccc4){logger[_0x748c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x469ecd,_0x10ccc4);_0x5d2d5b(_0x10ccc4);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 34b2efd..2863fad 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 _0xa3d9=['removeListener','register','length','dashboardItem:'];(function(_0x5908b8,_0x544699){var _0xe24a76=function(_0x2bd33f){while(--_0x2bd33f){_0x5908b8['push'](_0x5908b8['shift']());}};_0xe24a76(++_0x544699);}(_0xa3d9,0x138));var _0x9a3d=function(_0x1a20ec,_0x27626c){_0x1a20ec=_0x1a20ec-0x0;var _0x3a2ec1=_0xa3d9[_0x1a20ec];return _0x3a2ec1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove','update'];function createListener(_0x4a5e7e,_0x4156e9){return function(_0x34b603){_0x4156e9['emit'](_0x4a5e7e,_0x34b603);};}function removeListener(_0x591ce3,_0x535ea0){return function(){DashboardItemEvents[_0x9a3d('0x0')](_0x591ce3,_0x535ea0);};}exports[_0x9a3d('0x1')]=function(_0x365334){for(var _0xcc9da=0x0,_0x1f5d60=events[_0x9a3d('0x2')];_0xcc9da<_0x1f5d60;_0xcc9da++){var _0x21c4b0=events[_0xcc9da];var _0xf19ae1=createListener(_0x9a3d('0x3')+_0x21c4b0,_0x365334);DashboardItemEvents['on'](_0x21c4b0,_0xf19ae1);}}; \ No newline at end of file +var _0x3e85=['save','remove','update','removeListener','register','length','dashboardItem:'];(function(_0x2b657f,_0x2fb6b8){var _0x1f8b2f=function(_0x9ae853){while(--_0x9ae853){_0x2b657f['push'](_0x2b657f['shift']());}};_0x1f8b2f(++_0x2fb6b8);}(_0x3e85,0x8c));var _0x53e8=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0x3e85[_0x49a57f];return _0x2fa2a5;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x53e8('0x0'),_0x53e8('0x1'),_0x53e8('0x2')];function createListener(_0x210fb2,_0x3ea26f){return function(_0x988581){_0x3ea26f['emit'](_0x210fb2,_0x988581);};}function removeListener(_0x5632dc,_0x162ef1){return function(){DashboardItemEvents[_0x53e8('0x3')](_0x5632dc,_0x162ef1);};}exports[_0x53e8('0x4')]=function(_0x68fe5b){for(var _0xc33a68=0x0,_0x49041f=events[_0x53e8('0x5')];_0xc33a68<_0x49041f;_0xc33a68++){var _0x26da21=events[_0xc33a68];var _0x1a38fd=createListener(_0x53e8('0x6')+_0x26da21,_0x68fe5b);DashboardItemEvents['on'](_0x26da21,_0x1a38fd);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ab098bf..89e4793 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 _0x700f=['/:id','show','post','put','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x700f,0xec));var _0xf700=function(_0x484051,_0x5ed01a){_0x484051=_0x484051-0x0;var _0x162620=_0x700f[_0x484051];return _0x162620;};'use strict';var multer=require(_0xf700('0x0'));var util=require(_0xf700('0x1'));var path=require(_0xf700('0x2'));var timeout=require(_0xf700('0x3'));var express=require(_0xf700('0x4'));var router=express[_0xf700('0x5')]();var fs_extra=require(_0xf700('0x6'));var auth=require(_0xf700('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf700('0x8'));var controller=require(_0xf700('0x9'));router[_0xf700('0xa')](_0xf700('0xb'),auth['isAuthenticated'](),controller[_0xf700('0xc')]);router[_0xf700('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf700('0xe')](_0xf700('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf700('0xf')]('/:id',auth[_0xf700('0x10')](),controller[_0xf700('0x11')]);module[_0xf700('0x12')]=router; \ No newline at end of file +var _0x3021=['Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','delete','destroy','exports','multer','util','path'];(function(_0x22f0ac,_0x117cdc){var _0x510fc7=function(_0x5220aa){while(--_0x5220aa){_0x22f0ac['push'](_0x22f0ac['shift']());}};_0x510fc7(++_0x117cdc);}(_0x3021,0xb1));var _0x1302=function(_0x3613ce,_0x4e06a8){_0x3613ce=_0x3613ce-0x0;var _0x10a79e=_0x3021[_0x3613ce];return _0x10a79e;};'use strict';var multer=require(_0x1302('0x0'));var util=require(_0x1302('0x1'));var path=require(_0x1302('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1302('0x3')]();var fs_extra=require(_0x1302('0x4'));var auth=require(_0x1302('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1302('0x6'));var controller=require(_0x1302('0x7'));router[_0x1302('0x8')](_0x1302('0x9'),auth['isAuthenticated'](),controller[_0x1302('0xa')]);router[_0x1302('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1302('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1302('0xc')](_0x1302('0x9'),auth['isAuthenticated'](),controller[_0x1302('0xd')]);module[_0x1302('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 a3c4d54..9575ed6 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 _0x0f65=['STRING','ENUM','first','third','sequelize','exports'];(function(_0x5a0884,_0x1e5618){var _0x408cba=function(_0x2f6cc9){while(--_0x2f6cc9){_0x5a0884['push'](_0x5a0884['shift']());}};_0x408cba(++_0x1e5618);}(_0x0f65,0xb2));var _0x50f6=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0x0f65[_0x17fd65];return _0x27d033;};'use strict';var Sequelize=require(_0x50f6('0x0'));module[_0x50f6('0x1')]={'name':{'type':Sequelize[_0x50f6('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x50f6('0x3')](_0x50f6('0x4'),'second',_0x50f6('0x5')),'allowNull':![],'defaultValue':_0x50f6('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e80=['ENUM','first','second','third','sequelize','STRING'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x6e80,0x64));var _0x06e8=function(_0x5e6421,_0x97f511){_0x5e6421=_0x5e6421-0x0;var _0x38d9ba=_0x6e80[_0x5e6421];return _0x38d9ba;};'use strict';var Sequelize=require(_0x06e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x06e8('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x06e8('0x2')](_0x06e8('0x3'),_0x06e8('0x4'),_0x06e8('0x5')),'allowNull':![],'defaultValue':_0x06e8('0x3')},'description':{'type':Sequelize[_0x06e8('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 71c01da..735356d 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 _0x14c2=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Dispositions','destroy','error','stack','send','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','catch','merge','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5c6469,_0x54afe8){var _0x4a85d0=function(_0x668156){while(--_0x668156){_0x5c6469['push'](_0x5c6469['shift']());}};_0x4a85d0(++_0x54afe8);}(_0x14c2,0x180));var _0x214c=function(_0x3fe512,_0x37937e){_0x3fe512=_0x3fe512-0x0;var _0x4827c9=_0x14c2[_0x3fe512];return _0x4827c9;};'use strict';var emlformat=require(_0x214c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x214c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x214c('0x2'));var moment=require(_0x214c('0x3'));var BPromise=require(_0x214c('0x4'));var Mustache=require('mustache');var util=require(_0x214c('0x5'));var path=require(_0x214c('0x6'));var sox=require(_0x214c('0x7'));var csv=require(_0x214c('0x8'));var ejs=require(_0x214c('0x9'));var fs=require('fs');var fs_extra=require(_0x214c('0xa'));var _=require(_0x214c('0xb'));var squel=require('squel');var crypto=require(_0x214c('0xc'));var jsforce=require(_0x214c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x214c('0xe'));var Papa=require(_0x214c('0xf'));var Redis=require('ioredis');var authService=require(_0x214c('0x10'));var qs=require(_0x214c('0x11'));var as=require(_0x214c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x214c('0x13'))(_0x214c('0x14'));var utils=require(_0x214c('0x15'));var config=require(_0x214c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x214c('0x17'))['db'];function respondWithStatusCode(_0xb7c799,_0x30750e){_0x30750e=_0x30750e||0xcc;return function(_0x3df35a){if(_0x3df35a){return _0xb7c799[_0x214c('0x18')](_0x30750e);}return _0xb7c799[_0x214c('0x19')](_0x30750e)[_0x214c('0x1a')]();};}function respondWithResult(_0x4f2690,_0x104aab){_0x104aab=_0x104aab||0xc8;return function(_0x1b067e){if(_0x1b067e){return _0x4f2690[_0x214c('0x19')](_0x104aab)[_0x214c('0x1b')](_0x1b067e);}};}function respondWithFilteredResult(_0x364666,_0x23f99c){return function(_0x37f483){if(_0x37f483){var _0x2bb298=typeof _0x23f99c[_0x214c('0x1c')]==='undefined'&&typeof _0x23f99c[_0x214c('0x1d')]==='undefined';var _0x319e88=_0x37f483['count'];var _0x273376=_0x2bb298?0x0:_0x23f99c[_0x214c('0x1c')];var _0x390fe5=_0x2bb298?_0x37f483[_0x214c('0x1e')]:_0x23f99c[_0x214c('0x1c')]+_0x23f99c[_0x214c('0x1d')];var _0x3921aa;if(_0x390fe5>=_0x319e88){_0x390fe5=_0x319e88;_0x3921aa=0xc8;}else{_0x3921aa=0xce;}_0x364666[_0x214c('0x19')](_0x3921aa);return _0x364666[_0x214c('0x1f')](_0x214c('0x20'),_0x273376+'-'+_0x390fe5+'/'+_0x319e88)[_0x214c('0x1b')](_0x37f483);}return null;};}function patchUpdates(_0x2717ba){return function(_0x30a79c){try{jsonpatch[_0x214c('0x21')](_0x30a79c,_0x2717ba,!![]);}catch(_0x4dea8c){return BPromise[_0x214c('0x22')](_0x4dea8c);}return _0x30a79c[_0x214c('0x23')]();};}function saveUpdates(_0x1d83ad,_0x3f71c8){return function(_0x2b98d3){if(_0x2b98d3){return _0x2b98d3[_0x214c('0x24')](_0x1d83ad)['then'](function(_0x1e6ed7){return _0x1e6ed7;});}return null;};}function removeEntity(_0x5b34ae,_0x5efcc6){return function(_0x4a385d){if(_0x4a385d){return _0x4a385d['destroy']()[_0x214c('0x25')](function(){var _0x26e95c=_0x4a385d[_0x214c('0x26')]({'plain':!![]});var _0x4d3ce2=_0x214c('0x27');return db['UserProfileResource'][_0x214c('0x28')]({'where':{'type':_0x4d3ce2,'resourceId':_0x26e95c['id']}})[_0x214c('0x25')](function(){return _0x4a385d;});})['then'](function(){_0x5b34ae[_0x214c('0x19')](0xcc)[_0x214c('0x1a')]();});}};}function handleEntityNotFound(_0xbbea8c,_0x5de0be){return function(_0x204e00){if(!_0x204e00){_0xbbea8c[_0x214c('0x18')](0x194);}return _0x204e00;};}function handleError(_0xce1aee,_0x48c83b){_0x48c83b=_0x48c83b||0x1f4;return function(_0x9da0d){logger[_0x214c('0x29')](_0x9da0d[_0x214c('0x2a')]);if(_0x9da0d['name']){delete _0x9da0d['name'];}_0xce1aee['status'](_0x48c83b)[_0x214c('0x2b')](_0x9da0d);};}exports['index']=function(_0x19bf45,_0x217abc){var _0x56117f={},_0x5d3856={},_0x31cb67={'count':0x0,'rows':[]};var _0x50ca38=_[_0x214c('0x2c')](db[_0x214c('0x2d')][_0x214c('0x2e')],function(_0x2a8ca7){return{'name':_0x2a8ca7[_0x214c('0x2f')],'type':_0x2a8ca7[_0x214c('0x30')]['key']};});_0x5d3856[_0x214c('0x31')]=_[_0x214c('0x2c')](_0x50ca38,'name');_0x5d3856['query']=_[_0x214c('0x32')](_0x19bf45[_0x214c('0x33')]);_0x5d3856[_0x214c('0x34')]=_[_0x214c('0x35')](_0x5d3856['model'],_0x5d3856[_0x214c('0x33')]);_0x56117f[_0x214c('0x36')]=_[_0x214c('0x35')](_0x5d3856[_0x214c('0x31')],qs[_0x214c('0x37')](_0x19bf45['query'][_0x214c('0x37')]));_0x56117f['attributes']=_0x56117f[_0x214c('0x36')][_0x214c('0x38')]?_0x56117f[_0x214c('0x36')]:_0x5d3856[_0x214c('0x31')];if(!_0x19bf45[_0x214c('0x33')][_0x214c('0x39')](_0x214c('0x3a'))){_0x56117f['limit']=qs[_0x214c('0x1d')](_0x19bf45['query'][_0x214c('0x1d')]);_0x56117f[_0x214c('0x1c')]=qs[_0x214c('0x1c')](_0x19bf45['query'][_0x214c('0x1c')]);}_0x56117f[_0x214c('0x3b')]=qs[_0x214c('0x3c')](_0x19bf45[_0x214c('0x33')][_0x214c('0x3c')]);_0x56117f[_0x214c('0x3d')]=qs[_0x214c('0x34')](_[_0x214c('0x3e')](_0x19bf45[_0x214c('0x33')],_0x5d3856[_0x214c('0x34')]),_0x50ca38);if(_0x19bf45['query'][_0x214c('0x3f')]){_0x56117f[_0x214c('0x3d')]=_['merge'](_0x56117f[_0x214c('0x3d')],{'$or':_[_0x214c('0x2c')](_0x50ca38,function(_0x710c38){if(_0x710c38[_0x214c('0x30')]!==_0x214c('0x40')){var _0x51b9b0={};_0x51b9b0[_0x710c38['name']]={'$like':'%'+_0x19bf45[_0x214c('0x33')][_0x214c('0x3f')]+'%'};return _0x51b9b0;}})});}_0x56117f=_['merge']({},_0x56117f,_0x19bf45[_0x214c('0x41')]);var _0x4585bd={'where':_0x56117f['where']};return db[_0x214c('0x2d')][_0x214c('0x1e')](_0x4585bd)[_0x214c('0x25')](function(_0x2f3801){_0x31cb67[_0x214c('0x1e')]=_0x2f3801;if(_0x19bf45[_0x214c('0x33')][_0x214c('0x42')]){_0x56117f[_0x214c('0x43')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56117f);})[_0x214c('0x25')](function(_0x3b9c2d){_0x31cb67['rows']=_0x3b9c2d;return _0x31cb67;})['then'](respondWithFilteredResult(_0x217abc,_0x56117f))[_0x214c('0x44')](handleError(_0x217abc,null));};exports['show']=function(_0x1175bb,_0x3f2995){var _0x58ffab={'raw':!![],'where':{'id':_0x1175bb['params']['id']}},_0x2c204a={};_0x2c204a[_0x214c('0x31')]=_['keys'](db[_0x214c('0x2d')]['rawAttributes']);_0x2c204a[_0x214c('0x33')]=_[_0x214c('0x32')](_0x1175bb[_0x214c('0x33')]);_0x2c204a[_0x214c('0x34')]=_[_0x214c('0x35')](_0x2c204a[_0x214c('0x31')],_0x2c204a[_0x214c('0x33')]);_0x58ffab[_0x214c('0x36')]=_[_0x214c('0x35')](_0x2c204a[_0x214c('0x31')],qs[_0x214c('0x37')](_0x1175bb[_0x214c('0x33')]['fields']));_0x58ffab['attributes']=_0x58ffab[_0x214c('0x36')][_0x214c('0x38')]?_0x58ffab['attributes']:_0x2c204a[_0x214c('0x31')];if(_0x1175bb[_0x214c('0x33')]['includeAll']){_0x58ffab[_0x214c('0x43')]=[{'all':!![]}];}_0x58ffab=_[_0x214c('0x45')]({},_0x58ffab,_0x1175bb[_0x214c('0x41')]);return db[_0x214c('0x2d')][_0x214c('0x46')](_0x58ffab)[_0x214c('0x25')](handleEntityNotFound(_0x3f2995,null))['then'](respondWithResult(_0x3f2995,null))[_0x214c('0x44')](handleError(_0x3f2995,null));};exports[_0x214c('0x47')]=function(_0xa21fda,_0xef5de5){return db['Disposition'][_0x214c('0x47')](_0xa21fda['body'],{})[_0x214c('0x25')](function(_0x354456){var _0x11c0b3=_0xa21fda[_0x214c('0x48')][_0x214c('0x26')]({'plain':!![]});if(!_0x11c0b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11c0b3[_0x214c('0x49')]===_0x214c('0x48')){var _0x45cc1e=_0x354456[_0x214c('0x26')]({'plain':!![]});var _0x380350=_0x214c('0x27');return db[_0x214c('0x4a')][_0x214c('0x46')]({'where':{'name':_0x380350,'userProfileId':_0x11c0b3[_0x214c('0x4b')]},'raw':!![]})[_0x214c('0x25')](function(_0x203aa9){if(_0x203aa9&&_0x203aa9['autoAssociation']===0x0){return db[_0x214c('0x4c')][_0x214c('0x47')]({'name':_0x45cc1e[_0x214c('0x4d')],'resourceId':_0x45cc1e['id'],'type':_0x203aa9[_0x214c('0x4d')],'sectionId':_0x203aa9['id']},{})[_0x214c('0x25')](function(){return _0x354456;});}else{return _0x354456;}})[_0x214c('0x44')](function(_0x2f6d28){logger[_0x214c('0x29')](_0x214c('0x4e'),_0x2f6d28);throw _0x2f6d28;});}return _0x354456;})['then'](respondWithResult(_0xef5de5,0xc9))[_0x214c('0x44')](handleError(_0xef5de5,null));};exports[_0x214c('0x24')]=function(_0xea2781,_0xa05d1a){if(_0xea2781[_0x214c('0x4f')]['id']){delete _0xea2781[_0x214c('0x4f')]['id'];}return db[_0x214c('0x2d')][_0x214c('0x46')]({'where':{'id':_0xea2781[_0x214c('0x50')]['id']}})[_0x214c('0x25')](handleEntityNotFound(_0xa05d1a,null))[_0x214c('0x25')](saveUpdates(_0xea2781[_0x214c('0x4f')],null))['then'](respondWithResult(_0xa05d1a,null))[_0x214c('0x44')](handleError(_0xa05d1a,null));};exports[_0x214c('0x28')]=function(_0x34064e,_0x26425b){return db[_0x214c('0x2d')][_0x214c('0x46')]({'where':{'id':_0x34064e[_0x214c('0x50')]['id']}})[_0x214c('0x25')](handleEntityNotFound(_0x26425b,null))['then'](removeEntity(_0x26425b,null))[_0x214c('0x44')](handleError(_0x26425b,null));}; \ No newline at end of file +var _0x0c42=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','rawAttributes','fieldName','keys','query','filters','model','attributes','intersection','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Disposition','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x311e78,_0xbcf8ca){var _0x44fef6=function(_0x610029){while(--_0x610029){_0x311e78['push'](_0x311e78['shift']());}};_0x44fef6(++_0xbcf8ca);}(_0x0c42,0x191));var _0x20c4=function(_0x1176fd,_0xacdb1e){_0x1176fd=_0x1176fd-0x0;var _0x10082c=_0x0c42[_0x1176fd];return _0x10082c;};'use strict';var emlformat=require(_0x20c4('0x0'));var rimraf=require(_0x20c4('0x1'));var zipdir=require(_0x20c4('0x2'));var jsonpatch=require(_0x20c4('0x3'));var rp=require(_0x20c4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x20c4('0x5'));var util=require(_0x20c4('0x6'));var path=require(_0x20c4('0x7'));var sox=require(_0x20c4('0x8'));var csv=require(_0x20c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20c4('0xa'));var _=require('lodash');var squel=require(_0x20c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x20c4('0xc'));var deskjs=require(_0x20c4('0xd'));var toCsv=require(_0x20c4('0x9'));var querystring=require('querystring');var Papa=require(_0x20c4('0xe'));var Redis=require(_0x20c4('0xf'));var authService=require(_0x20c4('0x10'));var qs=require(_0x20c4('0x11'));var as=require(_0x20c4('0x12'));var hardwareService=require(_0x20c4('0x13'));var logger=require(_0x20c4('0x14'))(_0x20c4('0x15'));var utils=require(_0x20c4('0x16'));var config=require(_0x20c4('0x17'));var licenseUtil=require(_0x20c4('0x18'));var db=require(_0x20c4('0x19'))['db'];function respondWithStatusCode(_0x188060,_0x506e63){_0x506e63=_0x506e63||0xcc;return function(_0x430c10){if(_0x430c10){return _0x188060['sendStatus'](_0x506e63);}return _0x188060[_0x20c4('0x1a')](_0x506e63)[_0x20c4('0x1b')]();};}function respondWithResult(_0x59f54f,_0x1e1327){_0x1e1327=_0x1e1327||0xc8;return function(_0x4c6dae){if(_0x4c6dae){return _0x59f54f[_0x20c4('0x1a')](_0x1e1327)[_0x20c4('0x1c')](_0x4c6dae);}};}function respondWithFilteredResult(_0x30831a,_0x55a517){return function(_0x1d7e48){if(_0x1d7e48){var _0x25b671=typeof _0x55a517[_0x20c4('0x1d')]===_0x20c4('0x1e')&&typeof _0x55a517[_0x20c4('0x1f')]===_0x20c4('0x1e');var _0x2f79a0=_0x1d7e48[_0x20c4('0x20')];var _0x3f9b92=_0x25b671?0x0:_0x55a517[_0x20c4('0x1d')];var _0xda61dc=_0x25b671?_0x1d7e48['count']:_0x55a517['offset']+_0x55a517[_0x20c4('0x1f')];var _0x59c65d;if(_0xda61dc>=_0x2f79a0){_0xda61dc=_0x2f79a0;_0x59c65d=0xc8;}else{_0x59c65d=0xce;}_0x30831a[_0x20c4('0x1a')](_0x59c65d);return _0x30831a[_0x20c4('0x21')](_0x20c4('0x22'),_0x3f9b92+'-'+_0xda61dc+'/'+_0x2f79a0)[_0x20c4('0x1c')](_0x1d7e48);}return null;};}function patchUpdates(_0x28ba0a){return function(_0x47071e){try{jsonpatch[_0x20c4('0x23')](_0x47071e,_0x28ba0a,!![]);}catch(_0x3fa1a5){return BPromise[_0x20c4('0x24')](_0x3fa1a5);}return _0x47071e[_0x20c4('0x25')]();};}function saveUpdates(_0xf2c4f4,_0xf499ad){return function(_0xbe436d){if(_0xbe436d){return _0xbe436d[_0x20c4('0x26')](_0xf2c4f4)[_0x20c4('0x27')](function(_0x14d2d8){return _0x14d2d8;});}return null;};}function removeEntity(_0x442ffd,_0x287753){return function(_0x20e812){if(_0x20e812){return _0x20e812[_0x20c4('0x28')]()[_0x20c4('0x27')](function(){var _0x135f06=_0x20e812[_0x20c4('0x29')]({'plain':!![]});var _0x7c7d69='Dispositions';return db['UserProfileResource'][_0x20c4('0x28')]({'where':{'type':_0x7c7d69,'resourceId':_0x135f06['id']}})[_0x20c4('0x27')](function(){return _0x20e812;});})['then'](function(){_0x442ffd[_0x20c4('0x1a')](0xcc)[_0x20c4('0x1b')]();});}};}function handleEntityNotFound(_0x5bc23a,_0x18fb67){return function(_0x12e4f5){if(!_0x12e4f5){_0x5bc23a['sendStatus'](0x194);}return _0x12e4f5;};}function handleError(_0x5592dd,_0x490034){_0x490034=_0x490034||0x1f4;return function(_0x19907c){logger['error'](_0x19907c[_0x20c4('0x2a')]);if(_0x19907c[_0x20c4('0x2b')]){delete _0x19907c[_0x20c4('0x2b')];}_0x5592dd[_0x20c4('0x1a')](_0x490034)[_0x20c4('0x2c')](_0x19907c);};}exports[_0x20c4('0x2d')]=function(_0x57c41d,_0x4916bb){var _0x2045ac={},_0x1673ff={},_0x2b6f72={'count':0x0,'rows':[]};var _0x2f4a51=_[_0x20c4('0x2e')](db['Disposition'][_0x20c4('0x2f')],function(_0x48a01f){return{'name':_0x48a01f[_0x20c4('0x30')],'type':_0x48a01f['type']['key']};});_0x1673ff['model']=_['map'](_0x2f4a51,_0x20c4('0x2b'));_0x1673ff['query']=_[_0x20c4('0x31')](_0x57c41d[_0x20c4('0x32')]);_0x1673ff[_0x20c4('0x33')]=_['intersection'](_0x1673ff[_0x20c4('0x34')],_0x1673ff[_0x20c4('0x32')]);_0x2045ac[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0x1673ff[_0x20c4('0x34')],qs['fields'](_0x57c41d['query']['fields']));_0x2045ac['attributes']=_0x2045ac[_0x20c4('0x35')][_0x20c4('0x37')]?_0x2045ac[_0x20c4('0x35')]:_0x1673ff[_0x20c4('0x34')];if(!_0x57c41d[_0x20c4('0x32')]['hasOwnProperty'](_0x20c4('0x38'))){_0x2045ac['limit']=qs['limit'](_0x57c41d['query'][_0x20c4('0x1f')]);_0x2045ac[_0x20c4('0x1d')]=qs[_0x20c4('0x1d')](_0x57c41d[_0x20c4('0x32')][_0x20c4('0x1d')]);}_0x2045ac['order']=qs[_0x20c4('0x39')](_0x57c41d[_0x20c4('0x32')][_0x20c4('0x39')]);_0x2045ac[_0x20c4('0x3a')]=qs[_0x20c4('0x33')](_[_0x20c4('0x3b')](_0x57c41d[_0x20c4('0x32')],_0x1673ff[_0x20c4('0x33')]),_0x2f4a51);if(_0x57c41d[_0x20c4('0x32')][_0x20c4('0x3c')]){_0x2045ac[_0x20c4('0x3a')]=_['merge'](_0x2045ac[_0x20c4('0x3a')],{'$or':_['map'](_0x2f4a51,function(_0x191b22){if(_0x191b22[_0x20c4('0x3d')]!==_0x20c4('0x3e')){var _0xd3ab6a={};_0xd3ab6a[_0x191b22[_0x20c4('0x2b')]]={'$like':'%'+_0x57c41d[_0x20c4('0x32')][_0x20c4('0x3c')]+'%'};return _0xd3ab6a;}})});}_0x2045ac=_[_0x20c4('0x3f')]({},_0x2045ac,_0x57c41d[_0x20c4('0x40')]);var _0x504320={'where':_0x2045ac[_0x20c4('0x3a')]};return db[_0x20c4('0x41')]['count'](_0x504320)[_0x20c4('0x27')](function(_0x4c7f61){_0x2b6f72[_0x20c4('0x20')]=_0x4c7f61;if(_0x57c41d['query'][_0x20c4('0x42')]){_0x2045ac['include']=[{'all':!![]}];}return db[_0x20c4('0x41')][_0x20c4('0x43')](_0x2045ac);})[_0x20c4('0x27')](function(_0x5676f4){_0x2b6f72['rows']=_0x5676f4;return _0x2b6f72;})['then'](respondWithFilteredResult(_0x4916bb,_0x2045ac))[_0x20c4('0x44')](handleError(_0x4916bb,null));};exports[_0x20c4('0x45')]=function(_0xbc1700,_0xe03cbd){var _0x252e9f={'raw':!![],'where':{'id':_0xbc1700[_0x20c4('0x46')]['id']}},_0xdb39bc={};_0xdb39bc[_0x20c4('0x34')]=_[_0x20c4('0x31')](db[_0x20c4('0x41')][_0x20c4('0x2f')]);_0xdb39bc[_0x20c4('0x32')]=_[_0x20c4('0x31')](_0xbc1700['query']);_0xdb39bc[_0x20c4('0x33')]=_[_0x20c4('0x36')](_0xdb39bc['model'],_0xdb39bc[_0x20c4('0x32')]);_0x252e9f[_0x20c4('0x35')]=_[_0x20c4('0x36')](_0xdb39bc[_0x20c4('0x34')],qs[_0x20c4('0x47')](_0xbc1700[_0x20c4('0x32')]['fields']));_0x252e9f[_0x20c4('0x35')]=_0x252e9f[_0x20c4('0x35')][_0x20c4('0x37')]?_0x252e9f[_0x20c4('0x35')]:_0xdb39bc[_0x20c4('0x34')];if(_0xbc1700[_0x20c4('0x32')][_0x20c4('0x42')]){_0x252e9f[_0x20c4('0x48')]=[{'all':!![]}];}_0x252e9f=_[_0x20c4('0x3f')]({},_0x252e9f,_0xbc1700['options']);return db[_0x20c4('0x41')][_0x20c4('0x49')](_0x252e9f)[_0x20c4('0x27')](handleEntityNotFound(_0xe03cbd,null))[_0x20c4('0x27')](respondWithResult(_0xe03cbd,null))[_0x20c4('0x44')](handleError(_0xe03cbd,null));};exports['create']=function(_0x227fd3,_0x5908eb){return db[_0x20c4('0x41')][_0x20c4('0x4a')](_0x227fd3[_0x20c4('0x4b')],{})['then'](function(_0x39de8f){var _0x2289e0=_0x227fd3[_0x20c4('0x4c')][_0x20c4('0x29')]({'plain':!![]});if(!_0x2289e0)throw new Error(_0x20c4('0x4d'));if(_0x2289e0[_0x20c4('0x4e')]==='user'){var _0x12b420=_0x39de8f[_0x20c4('0x29')]({'plain':!![]});var _0x42c488='Dispositions';return db[_0x20c4('0x4f')][_0x20c4('0x49')]({'where':{'name':_0x42c488,'userProfileId':_0x2289e0[_0x20c4('0x50')]},'raw':!![]})[_0x20c4('0x27')](function(_0x4c7074){if(_0x4c7074&&_0x4c7074['autoAssociation']===0x0){return db[_0x20c4('0x51')][_0x20c4('0x4a')]({'name':_0x12b420[_0x20c4('0x2b')],'resourceId':_0x12b420['id'],'type':_0x4c7074[_0x20c4('0x2b')],'sectionId':_0x4c7074['id']},{})['then'](function(){return _0x39de8f;});}else{return _0x39de8f;}})[_0x20c4('0x44')](function(_0x195ad7){logger[_0x20c4('0x52')](_0x20c4('0x53'),_0x195ad7);throw _0x195ad7;});}return _0x39de8f;})[_0x20c4('0x27')](respondWithResult(_0x5908eb,0xc9))[_0x20c4('0x44')](handleError(_0x5908eb,null));};exports[_0x20c4('0x26')]=function(_0x50b4b1,_0x4ef3cc){if(_0x50b4b1[_0x20c4('0x4b')]['id']){delete _0x50b4b1[_0x20c4('0x4b')]['id'];}return db[_0x20c4('0x41')]['find']({'where':{'id':_0x50b4b1[_0x20c4('0x46')]['id']}})[_0x20c4('0x27')](handleEntityNotFound(_0x4ef3cc,null))['then'](saveUpdates(_0x50b4b1[_0x20c4('0x4b')],null))[_0x20c4('0x27')](respondWithResult(_0x4ef3cc,null))['catch'](handleError(_0x4ef3cc,null));};exports[_0x20c4('0x28')]=function(_0x3a1174,_0xbc2769){return db[_0x20c4('0x41')]['find']({'where':{'id':_0x3a1174[_0x20c4('0x46')]['id']}})[_0x20c4('0x27')](handleEntityNotFound(_0xbc2769,null))[_0x20c4('0x27')](removeEntity(_0xbc2769,null))[_0x20c4('0x44')](handleError(_0xbc2769,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index aa79723..80616ee 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 _0x315b=['name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','tools_dispositions','name_voice','name','ListId','name_chat','name_mail','MailAccountId'];(function(_0x32acd7,_0x3d83aa){var _0x39d2b8=function(_0x3aaae5){while(--_0x3aaae5){_0x32acd7['push'](_0x32acd7['shift']());}};_0x39d2b8(++_0x3d83aa);}(_0x315b,0xae));var _0xb315=function(_0x2aca18,_0x124dba){_0x2aca18=_0x2aca18-0x0;var _0x3b1501=_0x315b[_0x2aca18];return _0x3b1501;};'use strict';var _=require(_0xb315('0x0'));var util=require(_0xb315('0x1'));var logger=require(_0xb315('0x2'))(_0xb315('0x3'));var moment=require(_0xb315('0x4'));var BPromise=require(_0xb315('0x5'));var rp=require(_0xb315('0x6'));var fs=require('fs');var path=require(_0xb315('0x7'));var rimraf=require(_0xb315('0x8'));var config=require(_0xb315('0x9'));var attributes=require('./disposition.attributes');module['exports']=function(_0x2112c0,_0x2eb5b0){return _0x2112c0[_0xb315('0xa')]('Disposition',attributes,{'tableName':_0xb315('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb315('0xc'),'fields':[_0xb315('0xd'),_0xb315('0xe')]},{'unique':!![],'name':_0xb315('0xf'),'fields':[_0xb315('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xb315('0x10'),'fields':['name',_0xb315('0x11')]},{'unique':!![],'name':_0xb315('0x12'),'fields':[_0xb315('0xd'),_0xb315('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0xb315('0xd'),_0xb315('0x14')]},{'unique':!![],'name':_0xb315('0x15'),'fields':[_0xb315('0xd'),_0xb315('0x16')]},{'unique':!![],'name':_0xb315('0x17'),'fields':[_0xb315('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9704=['name_voice','name','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','moment','request-promise','path','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x11b00e,_0x136181){var _0x382ae4=function(_0x1ff932){while(--_0x1ff932){_0x11b00e['push'](_0x11b00e['shift']());}};_0x382ae4(++_0x136181);}(_0x9704,0x1dd));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4970('0x0'));var util=require(_0x4970('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4970('0x2'));var BPromise=require('bluebird');var rp=require(_0x4970('0x3'));var fs=require('fs');var path=require(_0x4970('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4970('0x5'));module['exports']=function(_0x2527ae,_0x4d56ba){return _0x2527ae[_0x4970('0x6')](_0x4970('0x7'),attributes,{'tableName':_0x4970('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4970('0x9'),'fields':[_0x4970('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x4970('0xa'),_0x4970('0xb')]},{'unique':!![],'name':_0x4970('0xc'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x4970('0xa'),_0x4970('0xd')]},{'unique':!![],'name':_0x4970('0xe'),'fields':['name',_0x4970('0xf')]},{'unique':!![],'name':_0x4970('0x10'),'fields':[_0x4970('0xa'),_0x4970('0x11')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x4970('0xa'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ba9a00f..99e28a2 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(_0x49526d,_0x103895){var _0x999d14=function(_0x1c7475){while(--_0x1c7475){_0x49526d['push'](_0x49526d['shift']());}};_0x999d14(++_0x103895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x241c70,_0x400b46){var _0x9163f8=function(_0x1d44b0){while(--_0x1d44b0){_0x241c70['push'](_0x241c70['shift']());}};_0x9163f8(++_0x400b46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 5271c70..7c549aa 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 _0x240f=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x240f,0x19e));var _0xf240=function(_0x1f9ab6,_0x57f552){_0x1f9ab6=_0x1f9ab6-0x0;var _0xe8ed1b=_0x240f[_0x1f9ab6];return _0xe8ed1b;};'use strict';var multer=require(_0xf240('0x0'));var util=require(_0xf240('0x1'));var path=require(_0xf240('0x2'));var timeout=require(_0xf240('0x3'));var express=require(_0xf240('0x4'));var router=express['Router']();var fs_extra=require(_0xf240('0x5'));var auth=require(_0xf240('0x6'));var interaction=require(_0xf240('0x7'));var config=require(_0xf240('0x8'));var controller=require(_0xf240('0x9'));router[_0xf240('0xa')]('/',auth[_0xf240('0xb')](),controller[_0xf240('0xc')]);router['get'](_0xf240('0xd'),auth[_0xf240('0xb')](),controller[_0xf240('0xe')]);router[_0xf240('0xf')]('/',auth[_0xf240('0xb')](),controller['create']);router[_0xf240('0x10')](_0xf240('0xd'),auth[_0xf240('0xb')](),controller['update']);router[_0xf240('0x11')]('/:id',auth[_0xf240('0xb')](),controller['destroy']);module[_0xf240('0x12')]=router; \ No newline at end of file +var _0xc71d=['show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id'];(function(_0x2ebb74,_0x37f6f5){var _0x364e27=function(_0x36ae8a){while(--_0x36ae8a){_0x2ebb74['push'](_0x2ebb74['shift']());}};_0x364e27(++_0x37f6f5);}(_0xc71d,0x1ec));var _0xdc71=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xc71d[_0xbbfe59];return _0x28a2a4;};'use strict';var multer=require(_0xdc71('0x0'));var util=require(_0xdc71('0x1'));var path=require(_0xdc71('0x2'));var timeout=require(_0xdc71('0x3'));var express=require(_0xdc71('0x4'));var router=express['Router']();var fs_extra=require(_0xdc71('0x5'));var auth=require(_0xdc71('0x6'));var interaction=require(_0xdc71('0x7'));var config=require('../../config/environment');var controller=require(_0xdc71('0x8'));router[_0xdc71('0x9')]('/',auth[_0xdc71('0xa')](),controller['index']);router[_0xdc71('0x9')](_0xdc71('0xb'),auth[_0xdc71('0xa')](),controller[_0xdc71('0xc')]);router[_0xdc71('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc71('0xe')](_0xdc71('0xb'),auth[_0xdc71('0xa')](),controller[_0xdc71('0xf')]);router[_0xdc71('0x10')](_0xdc71('0xb'),auth[_0xdc71('0xa')](),controller['destroy']);module[_0xdc71('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 077c61c..7a54ab5 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 _0x7bd0=['STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x7bd0,0x111));var _0x07bd=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x7bd0[_0x58381c];return _0x1a7440;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07bd('0x2')]},'ecm':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x4'),'no'),'defaultValue':_0x07bd('0x4')},'headerinfo':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x5')},'minrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),_0x07bd('0x8'),_0x07bd('0x9'),'12000',_0x07bd('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),'7200',_0x07bd('0x9'),_0x07bd('0xb'),_0x07bd('0xa')),'defaultValue':_0x07bd('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x07bd('0xc')},'gateway':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x07bd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0xe'),_0x07bd('0xf'),_0x07bd('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07bd('0x11')],'defaultValue':function(){return _0x07bd('0x12');}},'notificationSound':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07bd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x07bd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![],'comment':_0x07bd('0x15'),'set':function(_0x4929d6){if(!_0x4929d6)this[_0x07bd('0x16')](_0x07bd('0x17'),null);this['setDataValue'](_0x07bd('0x18'),_0x4929d6);}}}; \ No newline at end of file +var _0x8ace=['14400','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','7200'];(function(_0xe0f0c9,_0x38bffc){var _0x68191d=function(_0x2aacc3){while(--_0x2aacc3){_0xe0f0c9['push'](_0xe0f0c9['shift']());}};_0x68191d(++_0x38bffc);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x8ace[_0xbf8ec1];return _0xc84567;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8ac('0x2')]},'ecm':{'type':Sequelize[_0xe8ac('0x3')](_0xe8ac('0x4'),'no'),'defaultValue':_0xe8ac('0x4')},'headerinfo':{'type':Sequelize[_0xe8ac('0x2')],'defaultValue':_0xe8ac('0x5')},'localstationid':{'type':Sequelize[_0xe8ac('0x2')],'unique':_0xe8ac('0x6')},'minrate':{'type':Sequelize[_0xe8ac('0x3')](_0xe8ac('0x7'),_0xe8ac('0x8'),'7200',_0xe8ac('0x9'),_0xe8ac('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xe8ac('0x3')]('2400',_0xe8ac('0x8'),_0xe8ac('0xb'),_0xe8ac('0x9'),_0xe8ac('0xa'),_0xe8ac('0xc')),'defaultValue':_0xe8ac('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xe8ac('0xd')},'gateway':{'type':Sequelize[_0xe8ac('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe8ac('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe8ac('0x3')](_0xe8ac('0xe'),'IAX',_0xe8ac('0xf'),_0xe8ac('0x10')),'defaultValue':_0xe8ac('0xe')},'key':{'type':Sequelize[_0xe8ac('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe8ac('0x11')],'defaultValue':function(){return _0xe8ac('0x12');}},'notificationSound':{'type':Sequelize[_0xe8ac('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8ac('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe8ac('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe8ac('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe8ac('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe8ac('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8ac('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0xe8ac('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xe8ac('0x13')],'defaultValue':![],'comment':_0xe8ac('0x16'),'set':function(_0x25d219){if(!_0x25d219)this[_0xe8ac('0x17')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x25d219);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7e1c97d..c49f6b6 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 _0x18ea=['Send\x20Fax\x20failed','filename','spread','out','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','CmContact','Contacts','DESC','attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x18ea,0x195));var _0xa18e=function(_0xd99061,_0x447cd8){_0xd99061=_0xd99061-0x0;var _0x2b134a=_0x18ea[_0xd99061];return _0x2b134a;};'use strict';var emlformat=require(_0xa18e('0x0'));var rimraf=require(_0xa18e('0x1'));var zipdir=require(_0xa18e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa18e('0x3'));var moment=require(_0xa18e('0x4'));var BPromise=require(_0xa18e('0x5'));var Mustache=require('mustache');var util=require(_0xa18e('0x6'));var path=require(_0xa18e('0x7'));var sox=require('sox');var csv=require(_0xa18e('0x8'));var ejs=require(_0xa18e('0x9'));var fs=require('fs');var fs_extra=require(_0xa18e('0xa'));var _=require(_0xa18e('0xb'));var squel=require('squel');var crypto=require(_0xa18e('0xc'));var jsforce=require(_0xa18e('0xd'));var deskjs=require(_0xa18e('0xe'));var toCsv=require(_0xa18e('0x8'));var querystring=require(_0xa18e('0xf'));var Papa=require(_0xa18e('0x10'));var Redis=require(_0xa18e('0x11'));var authService=require(_0xa18e('0x12'));var qs=require(_0xa18e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa18e('0x14'));var logger=require(_0xa18e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa18e('0x16'));var licenseUtil=require(_0xa18e('0x17'));var db=require(_0xa18e('0x18'))['db'];config['redis']=_['defaults'](config[_0xa18e('0x19')],{'host':_0xa18e('0x1a'),'port':0x18eb});var socket=require(_0xa18e('0x1b'))(new Redis(config['redis']));require(_0xa18e('0x1c'))[_0xa18e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa18e('0x1e')][_0xa18e('0x1f')]({'port':0x232c});var client9002=jayson[_0xa18e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad7e9,_0x375d1b,_0x768488,_0x787f5f){return new BPromise(function(_0x1f3dff,_0x8020df){var _0x286de9=_0x787f5f||client;return _0x286de9[_0xa18e('0x20')](_0x1ad7e9,_0x768488)['then'](function(_0x1fb92f){logger[_0xa18e('0x21')](_0xa18e('0x22'),_0x375d1b,_0xa18e('0x23'));logger[_0xa18e('0x24')](_0xa18e('0x25'),_0x375d1b,_0xa18e('0x23'),JSON[_0xa18e('0x26')](_0x1fb92f));if(_0x1fb92f[_0xa18e('0x27')]){if(_0x1fb92f[_0xa18e('0x27')][_0xa18e('0x28')]===0x1f4){logger[_0xa18e('0x27')]('FaxAccount,\x20%s,\x20%s',_0x375d1b,_0x1fb92f[_0xa18e('0x27')]['message']);return _0x8020df(_0x1fb92f[_0xa18e('0x27')]['message']);}logger[_0xa18e('0x27')](_0xa18e('0x22'),_0x375d1b,_0x1fb92f['error']['message']);return _0x1f3dff(_0x1fb92f[_0xa18e('0x27')][_0xa18e('0x29')]);}else{logger['info'](_0xa18e('0x22'),_0x375d1b,'request\x20sent');_0x1f3dff(_0x1fb92f[_0xa18e('0x2a')][_0xa18e('0x29')]);}})['catch'](function(_0x512510){logger[_0xa18e('0x27')]('FaxAccount,\x20%s,\x20%s',_0x375d1b,_0x512510);_0x8020df(_0x512510);});});}function respondWithStatusCode(_0x7f6b65,_0x526da2){_0x526da2=_0x526da2||0xcc;return function(_0x41472d){if(_0x41472d){return _0x7f6b65[_0xa18e('0x2b')](_0x526da2);}return _0x7f6b65['status'](_0x526da2)[_0xa18e('0x2c')]();};}function respondWithResult(_0x16c146,_0x590d57){_0x590d57=_0x590d57||0xc8;return function(_0x2b8667){if(_0x2b8667){return _0x16c146['status'](_0x590d57)[_0xa18e('0x2d')](_0x2b8667);}};}function respondWithFilteredResult(_0x1b3e34,_0x18e587){return function(_0x1d24ad){if(_0x1d24ad){var _0x2fcbd0=typeof _0x18e587[_0xa18e('0x2e')]===_0xa18e('0x2f')&&typeof _0x18e587[_0xa18e('0x30')]===_0xa18e('0x2f');var _0x16f779=_0x1d24ad['count'];var _0x4534f8=_0x2fcbd0?0x0:_0x18e587[_0xa18e('0x2e')];var _0x38bad8=_0x2fcbd0?_0x1d24ad[_0xa18e('0x31')]:_0x18e587['offset']+_0x18e587[_0xa18e('0x30')];var _0x354818;if(_0x38bad8>=_0x16f779){_0x38bad8=_0x16f779;_0x354818=0xc8;}else{_0x354818=0xce;}_0x1b3e34[_0xa18e('0x32')](_0x354818);return _0x1b3e34[_0xa18e('0x33')](_0xa18e('0x34'),_0x4534f8+'-'+_0x38bad8+'/'+_0x16f779)[_0xa18e('0x2d')](_0x1d24ad);}return null;};}function patchUpdates(_0x416d52){return function(_0x5bf164){try{jsonpatch[_0xa18e('0x35')](_0x5bf164,_0x416d52,!![]);}catch(_0x19fb1c){return BPromise[_0xa18e('0x36')](_0x19fb1c);}return _0x5bf164[_0xa18e('0x37')]();};}function saveUpdates(_0x58e35d,_0x371a0e){return function(_0x4bbd23){if(_0x4bbd23){return _0x4bbd23[_0xa18e('0x38')](_0x58e35d)[_0xa18e('0x39')](function(_0x53aca5){return _0x53aca5;});}return null;};}function removeEntity(_0x569463,_0x59bb49){return function(_0x29b81f){if(_0x29b81f){return _0x29b81f[_0xa18e('0x3a')]()[_0xa18e('0x39')](function(){var _0x56f3c7=_0x29b81f['get']({'plain':!![]});var _0x505859=_0xa18e('0x3b');return db[_0xa18e('0x3c')][_0xa18e('0x3a')]({'where':{'type':_0x505859,'resourceId':_0x56f3c7['id']}})[_0xa18e('0x39')](function(){return _0x29b81f;});})[_0xa18e('0x39')](function(){_0x569463['status'](0xcc)[_0xa18e('0x2c')]();});}};}function handleEntityNotFound(_0x28f5c4,_0x1050c5){return function(_0x3b27d3){if(!_0x3b27d3){_0x28f5c4[_0xa18e('0x2b')](0x194);}return _0x3b27d3;};}function handleError(_0xb4e9e0,_0x7641ae){_0x7641ae=_0x7641ae||0x1f4;return function(_0xc9aa0e){logger['error'](_0xc9aa0e['stack']);if(_0xc9aa0e['name']){delete _0xc9aa0e[_0xa18e('0x3d')];}_0xb4e9e0[_0xa18e('0x32')](_0x7641ae)[_0xa18e('0x3e')](_0xc9aa0e);};}exports[_0xa18e('0x3f')]=function(_0x2537a3,_0x1f1a87){var _0x1fd262={'include':[{'model':db[_0xa18e('0x40')],'as':_0xa18e('0x41')}]},_0x3de322={},_0x20ebfb={'count':0x0,'rows':[]};var _0x28744d=_[_0xa18e('0x42')](db[_0xa18e('0x43')][_0xa18e('0x44')],function(_0x45d650){return{'name':_0x45d650['fieldName'],'type':_0x45d650[_0xa18e('0x45')]['key']};});_0x3de322['model']=_['map'](_0x28744d,_0xa18e('0x3d'));_0x3de322[_0xa18e('0x46')]=_['keys'](_0x2537a3[_0xa18e('0x46')]);_0x3de322['filters']=_[_0xa18e('0x47')](_0x3de322['model'],_0x3de322['query']);_0x1fd262[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x3de322[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x1fd262['attributes']=_0x1fd262[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x1fd262[_0xa18e('0x48')]:_0x3de322['model'];if(!_0x2537a3['query'][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x1fd262['limit']=qs[_0xa18e('0x30')](_0x2537a3['query'][_0xa18e('0x30')]);_0x1fd262[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x1fd262[_0xa18e('0x4e')]=qs['sort'](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x1fd262[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2537a3[_0xa18e('0x46')],_0x3de322['filters']),_0x28744d);if(_0x2537a3[_0xa18e('0x46')][_0xa18e('0x53')]){_0x1fd262[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x1fd262[_0xa18e('0x50')],{'$or':_['map'](_0x28744d,function(_0x192aaf){if(_0x192aaf[_0xa18e('0x45')]!=='VIRTUAL'){var _0x4f62d3={};_0x4f62d3[_0x192aaf[_0xa18e('0x3d')]]={'$like':'%'+_0x2537a3[_0xa18e('0x46')]['filter']+'%'};return _0x4f62d3;}})});}_0x1fd262=_['merge']({},_0x1fd262,_0x2537a3[_0xa18e('0x55')]);var _0x37fed3={'where':_0x1fd262[_0xa18e('0x50')]};return db[_0xa18e('0x43')][_0xa18e('0x31')](_0x37fed3)[_0xa18e('0x39')](function(_0x3434de){_0x20ebfb['count']=_0x3434de;if(_0x2537a3[_0xa18e('0x46')][_0xa18e('0x56')]){_0x1fd262[_0xa18e('0x57')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x1fd262);})[_0xa18e('0x39')](function(_0x2806f9){_0x20ebfb[_0xa18e('0x58')]=_0x2806f9;return _0x20ebfb;})[_0xa18e('0x39')](respondWithFilteredResult(_0x1f1a87,_0x1fd262))[_0xa18e('0x59')](handleError(_0x1f1a87,null));};exports[_0xa18e('0x5a')]=function(_0x96a1b3,_0x39f01c){var _0x166c7f={'raw':![],'where':{'id':_0x96a1b3[_0xa18e('0x5b')]['id']},'include':[{'model':db[_0xa18e('0x40')],'as':'mandatoryDispositionPause'}]},_0x29584b={};_0x29584b[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x43')]['rawAttributes']);_0x29584b[_0xa18e('0x46')]=_['keys'](_0x96a1b3[_0xa18e('0x46')]);_0x29584b['filters']=_['intersection'](_0x29584b[_0xa18e('0x49')],_0x29584b['query']);_0x166c7f[_0xa18e('0x48')]=_['intersection'](_0x29584b['model'],qs[_0xa18e('0x4a')](_0x96a1b3['query'][_0xa18e('0x4a')]));_0x166c7f[_0xa18e('0x48')]=_0x166c7f[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x166c7f['attributes']:_0x29584b['model'];if(_0x96a1b3[_0xa18e('0x46')]['includeAll']){_0x166c7f['include']=[{'all':!![]}];}_0x166c7f=_[_0xa18e('0x54')]({},_0x166c7f,_0x96a1b3[_0xa18e('0x55')]);return db['FaxAccount']['find'](_0x166c7f)[_0xa18e('0x39')](handleEntityNotFound(_0x39f01c,null))['then'](respondWithResult(_0x39f01c,null))[_0xa18e('0x59')](handleError(_0x39f01c,null));};exports[_0xa18e('0x5d')]=function(_0x3e0f3f,_0x1ebca4){return db[_0xa18e('0x43')][_0xa18e('0x5d')](_0x3e0f3f[_0xa18e('0x5e')],{})[_0xa18e('0x39')](function(_0x3dafe7){var _0xc39ba5=_0x3e0f3f[_0xa18e('0x5f')][_0xa18e('0x60')]({'plain':!![]});if(!_0xc39ba5)throw new Error(_0xa18e('0x61'));if(_0xc39ba5[_0xa18e('0x62')]===_0xa18e('0x5f')){var _0x4c0fb2=_0x3dafe7[_0xa18e('0x60')]({'plain':!![]});var _0x3f9c74='FaxAccounts';return db[_0xa18e('0x63')]['find']({'where':{'name':_0x3f9c74,'userProfileId':_0xc39ba5['userProfileId']},'raw':!![]})[_0xa18e('0x39')](function(_0x5e601a){if(_0x5e601a&&_0x5e601a['autoAssociation']===0x0){return db[_0xa18e('0x3c')][_0xa18e('0x5d')]({'name':_0x4c0fb2[_0xa18e('0x3d')],'resourceId':_0x4c0fb2['id'],'type':_0x5e601a[_0xa18e('0x3d')],'sectionId':_0x5e601a['id']},{})['then'](function(){return _0x3dafe7;});}else{return _0x3dafe7;}})[_0xa18e('0x59')](function(_0x3656e4){logger[_0xa18e('0x27')](_0xa18e('0x64'),_0x3656e4);throw _0x3656e4;});}return _0x3dafe7;})[_0xa18e('0x39')](respondWithResult(_0x1ebca4,0xc9))[_0xa18e('0x59')](handleError(_0x1ebca4,null));};exports['update']=function(_0x6b4de8,_0x3d8986){if(_0x6b4de8['body']['id']){delete _0x6b4de8['body']['id'];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x6b4de8['params']['id']},'include':[{'model':db[_0xa18e('0x40')],'as':_0xa18e('0x41')}]})[_0xa18e('0x39')](handleEntityNotFound(_0x3d8986,null))[_0xa18e('0x39')](saveUpdates(_0x6b4de8['body'],null))[_0xa18e('0x39')](respondWithResult(_0x3d8986,null))['catch'](handleError(_0x3d8986,null));};exports[_0xa18e('0x3a')]=function(_0x3375bb,_0x27049d){return db[_0xa18e('0x43')]['find']({'where':{'id':_0x3375bb[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27049d,null))[_0xa18e('0x39')](removeEntity(_0x27049d,null))[_0xa18e('0x59')](handleError(_0x27049d,null));};exports['describe']=function(_0x280df2,_0x5de0f5){return db[_0xa18e('0x43')]['describe']()[_0xa18e('0x39')](respondWithResult(_0x5de0f5,null))[_0xa18e('0x59')](handleError(_0x5de0f5,null));};exports[_0xa18e('0x66')]=function(_0x4fe0d9,_0x15a4af,_0x34d5c2){if(_0x4fe0d9['body']['id']){delete _0x4fe0d9[_0xa18e('0x5e')]['id'];}return db['FaxAccount'][_0xa18e('0x65')]({'where':{'id':_0x4fe0d9[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x15a4af,null))['then'](function(_0x1bc2d6){if(_0x1bc2d6){_0x4fe0d9[_0xa18e('0x5e')][_0xa18e('0x67')]=_0x1bc2d6['id'];return db[_0xa18e('0x68')][_0xa18e('0x5d')](_0x4fe0d9[_0xa18e('0x5e')]);}})[_0xa18e('0x39')](respondWithResult(_0x15a4af,null))['catch'](handleError(_0x15a4af,null));};exports[_0xa18e('0x69')]=function(_0x5dcf88,_0x5407ad,_0x35d7e3){var _0x31aea3={'raw':![],'where':{}};var _0x208e25={};var _0x5dafd6={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x5dcf88['params']['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5407ad,null))[_0xa18e('0x39')](function(_0x29e7bf){if(_0x29e7bf){_0x208e25[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x68')][_0xa18e('0x44')]);_0x208e25[_0xa18e('0x46')]=_['keys'](_0x5dcf88['query']);_0x208e25[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x208e25[_0xa18e('0x49')],_0x208e25[_0xa18e('0x46')]);_0x31aea3[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x208e25['model'],qs[_0xa18e('0x4a')](_0x5dcf88[_0xa18e('0x46')]['fields']));_0x31aea3['attributes']=_0x31aea3[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x31aea3[_0xa18e('0x48')]:_0x208e25[_0xa18e('0x49')];if(!_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x31aea3['limit']=qs[_0xa18e('0x30')](_0x5dcf88['query']['limit']);_0x31aea3[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x31aea3[_0xa18e('0x4e')]=qs[_0xa18e('0x4f')](_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x31aea3[_0xa18e('0x50')]=qs['filters'](_[_0xa18e('0x52')](_0x5dcf88['query'],_0x208e25[_0xa18e('0x51')]));_0x31aea3['where'][_0xa18e('0x67')]=_0x29e7bf['id'];if(_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x53')]){_0x31aea3[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x31aea3['where'],{'$or':_[_0xa18e('0x42')](_0x31aea3[_0xa18e('0x48')],function(_0x2c318e){var _0x42d0f8={};_0x42d0f8[_0x2c318e]={'$like':'%'+_0x5dcf88['query']['filter']+'%'};return _0x42d0f8;})});}_0x31aea3=_[_0xa18e('0x54')]({},_0x31aea3,_0x5dcf88['options']);return db[_0xa18e('0x68')][_0xa18e('0x31')]({'where':_0x31aea3[_0xa18e('0x50')]})[_0xa18e('0x39')](function(_0x3ca95d){_0x5dafd6[_0xa18e('0x31')]=_0x3ca95d;if(_0x5dcf88[_0xa18e('0x46')]['includeAll']){_0x31aea3[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0x68')]['findAll'](_0x31aea3);})['then'](function(_0x3b87a8){_0x5dafd6[_0xa18e('0x58')]=_0x3b87a8;return _0x5dafd6;});}})[_0xa18e('0x39')](respondWithFilteredResult(_0x5407ad,_0x31aea3))[_0xa18e('0x59')](handleError(_0x5407ad,null));};exports['removeDispositions']=function(_0x1dba0e,_0x55e8ee,_0xed0128){return db['FaxAccount'][_0xa18e('0x65')]({'where':{'id':_0x1dba0e[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x55e8ee,null))[_0xa18e('0x39')](function(_0x5c715b){if(_0x5c715b){return _0x5c715b[_0xa18e('0x6b')](_0x1dba0e['query'][_0xa18e('0x6c')]);}})[_0xa18e('0x39')](respondWithStatusCode(_0x55e8ee,null))['catch'](handleError(_0x55e8ee,null));};exports[_0xa18e('0x6d')]=function(_0xee1d8d,_0x2c2205,_0x455dd4){if(_0xee1d8d[_0xa18e('0x5e')]['id']){delete _0xee1d8d[_0xa18e('0x5e')]['id'];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0xee1d8d[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x2c2205,null))[_0xa18e('0x39')](function(_0x291be3){if(_0x291be3){_0xee1d8d[_0xa18e('0x5e')][_0xa18e('0x67')]=_0x291be3['id'];return db[_0xa18e('0x6e')][_0xa18e('0x5d')](_0xee1d8d[_0xa18e('0x5e')]);}})[_0xa18e('0x39')](respondWithResult(_0x2c2205,null))[_0xa18e('0x59')](handleError(_0x2c2205,null));};exports[_0xa18e('0x6f')]=function(_0x4ae9c3,_0x443b3e,_0x307010){var _0x2cc754={'raw':![],'where':{}};var _0x2cc432={};var _0x567d0f={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x4ae9c3[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x443b3e,null))[_0xa18e('0x39')](function(_0x147426){if(_0x147426){_0x2cc432[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x6e')]['rawAttributes']);_0x2cc432['query']=_['keys'](_0x4ae9c3[_0xa18e('0x46')]);_0x2cc432[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x2cc432[_0xa18e('0x49')],_0x2cc432[_0xa18e('0x46')]);_0x2cc754[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x2cc432[_0xa18e('0x49')],qs['fields'](_0x4ae9c3[_0xa18e('0x46')]['fields']));_0x2cc754[_0xa18e('0x48')]=_0x2cc754[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x2cc754[_0xa18e('0x48')]:_0x2cc432[_0xa18e('0x49')];if(!_0x4ae9c3['query'][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x2cc754['limit']=qs[_0xa18e('0x30')](_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x30')]);_0x2cc754[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x2cc754['order']=qs[_0xa18e('0x4f')](_0x4ae9c3[_0xa18e('0x46')]['sort']);_0x2cc754['where']=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x4ae9c3[_0xa18e('0x46')],_0x2cc432[_0xa18e('0x51')]));_0x2cc754[_0xa18e('0x50')][_0xa18e('0x67')]=_0x147426['id'];if(_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x53')]){_0x2cc754[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x2cc754[_0xa18e('0x50')],{'$or':_[_0xa18e('0x42')](_0x2cc754[_0xa18e('0x48')],function(_0x313ae3){var _0x1d095a={};_0x1d095a[_0x313ae3]={'$like':'%'+_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x1d095a;})});}_0x2cc754=_[_0xa18e('0x54')]({},_0x2cc754,_0x4ae9c3['options']);return db['CannedAnswer'][_0xa18e('0x31')]({'where':_0x2cc754['where']})['then'](function(_0x2c9637){_0x567d0f[_0xa18e('0x31')]=_0x2c9637;if(_0x4ae9c3['query'][_0xa18e('0x56')]){_0x2cc754[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0x6e')][_0xa18e('0x70')](_0x2cc754);})[_0xa18e('0x39')](function(_0x11b094){_0x567d0f[_0xa18e('0x58')]=_0x11b094;return _0x567d0f;});}})[_0xa18e('0x39')](respondWithFilteredResult(_0x443b3e,_0x2cc754))['catch'](handleError(_0x443b3e,null));};exports[_0xa18e('0x71')]=function(_0x131419,_0x348688,_0x20315a){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x131419[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x348688,null))['then'](function(_0x1b05d9){if(_0x1b05d9){return _0x1b05d9[_0xa18e('0x71')](_0x131419['query']['ids']);}})[_0xa18e('0x39')](respondWithStatusCode(_0x348688,null))[_0xa18e('0x59')](handleError(_0x348688,null));};exports['addInteraction']=function(_0x8a5ecf,_0x1522da,_0x122f46){return db[_0xa18e('0x72')][_0xa18e('0x65')]({'where':{'id':_0x8a5ecf['params']['id']}})['then'](handleEntityNotFound(_0x1522da,null))[_0xa18e('0x39')](function(_0x107b78){if(_0x107b78){return _0x107b78[_0xa18e('0x73')](_0x8a5ecf[_0xa18e('0x5e')][_0xa18e('0x6c')],_[_0xa18e('0x74')](_0x8a5ecf['body'],[_0xa18e('0x6c'),'id'])||{});}})[_0xa18e('0x39')](respondWithResult(_0x1522da,null))[_0xa18e('0x59')](handleError(_0x1522da,null));};exports[_0xa18e('0x75')]=function(_0x2931f7,_0x5f1737,_0x48415f){var _0x554ad7={'raw':![],'where':{}};var _0x6a7079={};var _0x2d4329={'count':0x0,'rows':[]};return db[_0xa18e('0x43')]['findOne']({'where':{'id':_0x2931f7[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5f1737,null))[_0xa18e('0x39')](function(_0x411e8e){if(_0x411e8e){_0x6a7079['model']=_[_0xa18e('0x5c')](db[_0xa18e('0x72')]['rawAttributes']);_0x6a7079[_0xa18e('0x46')]=_[_0xa18e('0x5c')](_0x2931f7[_0xa18e('0x46')]);_0x6a7079[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x6a7079[_0xa18e('0x49')],_0x6a7079[_0xa18e('0x46')]);_0x554ad7[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x6a7079[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2931f7['query'][_0xa18e('0x4a')]));_0x554ad7[_0xa18e('0x48')]=_0x554ad7['attributes'][_0xa18e('0x4b')]?_0x554ad7['attributes']:_0x6a7079[_0xa18e('0x49')];if(!_0x2931f7[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x554ad7['limit']=qs[_0xa18e('0x30')](_0x2931f7[_0xa18e('0x46')][_0xa18e('0x30')]);_0x554ad7[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2931f7['query'][_0xa18e('0x2e')]);}_0x554ad7[_0xa18e('0x4e')]=qs['sort'](_0x2931f7[_0xa18e('0x46')]['sort']);_0x554ad7[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2931f7[_0xa18e('0x46')],_0x6a7079[_0xa18e('0x51')]));_0x554ad7['where'][_0xa18e('0x67')]=_0x411e8e['id'];if(_0x2931f7[_0xa18e('0x46')][_0xa18e('0x53')]){_0x554ad7[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x554ad7['where'],{'$or':_[_0xa18e('0x42')](_0x554ad7[_0xa18e('0x48')],function(_0xdee37e){var _0x56e3d1={};_0x56e3d1[_0xdee37e]={'$like':'%'+_0x2931f7['query'][_0xa18e('0x53')]+'%'};return _0x56e3d1;})});}_0x554ad7=_[_0xa18e('0x54')]({},_0x554ad7,_0x2931f7[_0xa18e('0x55')]);return db[_0xa18e('0x72')][_0xa18e('0x31')]({'where':_0x554ad7[_0xa18e('0x50')]})['then'](function(_0x16fe03){_0x2d4329[_0xa18e('0x31')]=_0x16fe03;if(_0x2931f7[_0xa18e('0x46')][_0xa18e('0x56')]){_0x554ad7[_0xa18e('0x57')]=[{'model':db['CmContact'],'as':_0xa18e('0x76'),'required':![]},{'model':db[_0xa18e('0x77')],'as':_0xa18e('0x78'),'attributes':['name',_0xa18e('0x79'),_0xa18e('0x7a')],'required':![]},{'model':db['Tag'],'as':_0xa18e('0x7b'),'attributes':['id','name','color'],'where':_0x2931f7[_0xa18e('0x46')]['tag']?{'id':_0x2931f7[_0xa18e('0x46')]['tag']}:undefined,'required':_0x2931f7[_0xa18e('0x46')][_0xa18e('0x7c')]?!![]:![]}];}return db[_0xa18e('0x72')][_0xa18e('0x70')](_0x554ad7);})['then'](function(_0x26e559){_0x2d4329[_0xa18e('0x58')]=_0x26e559;return _0x2d4329;});}})['then'](respondWithFilteredResult(_0x5f1737,_0x554ad7))[_0xa18e('0x59')](handleError(_0x5f1737,null));};exports['addApplications']=function(_0x14a6b7,_0xa372d4){var _0x5b4f41=_0x14a6b7['params']['id'];var _0x35816a=_0x14a6b7['body'];var _0x31dd54=0xc8;var _0x5c0fcf=null;return db[_0xa18e('0x7d')][_0xa18e('0x7e')]({'isolationLevel':db['sequelize']['Transaction'][_0xa18e('0x7f')]['READ_COMMITTED']},function(_0x1dfb7c){return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x5b4f41},'transaction':_0x1dfb7c})['then'](function(_0x4329ad){if(_0x4329ad){return db[_0xa18e('0x80')][_0xa18e('0x3a')]({'where':{'FaxAccountId':_0x5b4f41},'transaction':_0x1dfb7c})[_0xa18e('0x39')](function(){var _0x341969=_[_0xa18e('0x42')](_0x35816a,function(_0x3ee3b0){_0x3ee3b0[_0xa18e('0x67')]=_0x5b4f41;return _0x3ee3b0;});return db[_0xa18e('0x80')][_0xa18e('0x81')](_0x341969,{'transaction':_0x1dfb7c});});}else{_0x31dd54=0x194;_0x5c0fcf=[];}});})[_0xa18e('0x39')](function(){if(_0x31dd54!==0x194){return db[_0xa18e('0x80')][_0xa18e('0x82')]({'where':{'FaxAccountId':_0x5b4f41},'order':_0xa18e('0x83')})[_0xa18e('0x39')](function(_0x3366fc){_0x5c0fcf=_0x3366fc;});}})[_0xa18e('0x59')](function(_0x795dff){_0x31dd54=0x1f4;logger['error'](_0x795dff[_0xa18e('0x84')]);if(_0x795dff[_0xa18e('0x3d')]){delete _0x795dff['name'];}_0x5c0fcf=_0x795dff;})['finally'](function(){if(_0x5c0fcf===null){_0xa372d4[_0xa18e('0x2b')](_0x31dd54);}else{if(_0x31dd54===0x1f4){_0xa372d4['status'](_0x31dd54)[_0xa18e('0x3e')](_0x5c0fcf);}else{_0xa372d4[_0xa18e('0x32')](_0x31dd54)[_0xa18e('0x2d')](_0x5c0fcf);}}});};exports['getApplications']=function(_0x3760dc,_0x5292fb,_0x2225a7){var _0x56c464={};var _0x29aa79={};var _0x1d547b;var _0x5ac6c1;return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x3760dc[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5292fb,null))[_0xa18e('0x39')](function(_0x9dcf1d){if(_0x9dcf1d){_0x1d547b=_0x9dcf1d;_0x29aa79[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x80')][_0xa18e('0x44')]);_0x29aa79[_0xa18e('0x46')]=_['keys'](_0x3760dc['query']);_0x29aa79[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x29aa79['model'],_0x29aa79['query']);_0x56c464[_0xa18e('0x48')]=_['intersection'](_0x29aa79['model'],qs[_0xa18e('0x4a')](_0x3760dc[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x56c464[_0xa18e('0x48')]=_0x56c464[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x56c464['attributes']:_0x29aa79[_0xa18e('0x49')];_0x56c464[_0xa18e('0x4e')]=qs['sort'](_0x3760dc[_0xa18e('0x46')]['sort']);_0x56c464[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x3760dc[_0xa18e('0x46')],_0x29aa79[_0xa18e('0x51')]));if(_0x3760dc[_0xa18e('0x46')][_0xa18e('0x53')]){_0x56c464[_0xa18e('0x50')]=_['merge'](_0x56c464['where'],{'$or':_[_0xa18e('0x42')](_0x56c464[_0xa18e('0x48')],function(_0x24f471){var _0x4b417d={};_0x4b417d[_0x24f471]={'$like':'%'+_0x3760dc[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x4b417d;})});}_0x56c464=_[_0xa18e('0x54')]({},_0x56c464,_0x3760dc[_0xa18e('0x55')]);return _0x1d547b[_0xa18e('0x85')](_0x56c464);}})['then'](function(_0x3f19df){if(_0x3f19df){_0x5ac6c1=_0x3f19df[_0xa18e('0x4b')];if(!_0x3760dc[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x56c464['limit']=qs['limit'](_0x3760dc[_0xa18e('0x46')][_0xa18e('0x30')]);_0x56c464[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x3760dc[_0xa18e('0x46')]['offset']);}return _0x1d547b['getApplications'](_0x56c464);}})[_0xa18e('0x39')](function(_0x486851){if(_0x486851){return _0x486851?{'count':_0x5ac6c1,'rows':_0x486851}:null;}})[_0xa18e('0x39')](respondWithResult(_0x5292fb,null))[_0xa18e('0x59')](handleError(_0x5292fb,null));};function Extension(_0x353b5a,_0x184743,_0x438828,_0x59c6b7){this[_0xa18e('0x86')]=_0xa18e('0x87');this[_0xa18e('0x88')]=_0x353b5a[_0xa18e('0x89')];this['app']=_0x59c6b7;this[_0xa18e('0x45')]=_0xa18e('0x8a');this[_0xa18e('0x8b')]=_0xa18e('0x8c');this[_0xa18e('0x67')]=_0x353b5a['id'];this[_0xa18e('0x83')]=_0x184743;this['appdata']=_0x438828;}function createExtensionsReciveFax(_0xae6fbd){var _0x29ab3f=0x1;var _0x744655=[];_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,'',_0xa18e('0x8e')));_0x29ab3f+=0x1;_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,_0xa18e('0x8f'),_0xa18e('0x90')));_0x29ab3f+=0x1;for(var _0x1c3fa4 in _0xae6fbd){if(_0xae6fbd[_0xa18e('0x4c')](_0x1c3fa4)&&(_0x1c3fa4===_0xa18e('0x91')||_0x1c3fa4==='localstationid'||_0x1c3fa4===_0xa18e('0x92')||_0x1c3fa4===_0xa18e('0x93')||_0x1c3fa4===_0xa18e('0x94')||_0x1c3fa4===_0xa18e('0x95')||_0x1c3fa4===_0xa18e('0x96')||_0x1c3fa4===_0xa18e('0x97')||_0x1c3fa4==='t38timeout')){_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,'FAXOPT('+_0x1c3fa4+')='+_0xae6fbd[_0x1c3fa4],'Set'));_0x29ab3f+=0x1;}}_0x744655['push'](new Extension(_0xae6fbd,_0x29ab3f,'6','Wait'));_0x29ab3f+=0x1;_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,_0xa18e('0x98'),_0xa18e('0x99')));_0x29ab3f=0x0;return _0x744655;}exports[_0xa18e('0x9a')]=function(_0x598955,_0x5a12d7,_0x19c4c3){var _0x23d8a4;return db[_0xa18e('0x7d')]['transaction'](function(_0x272c00){return db[_0xa18e('0x43')][_0xa18e('0x5d')](_0x598955[_0xa18e('0x5e')],{'transaction':_0x272c00})[_0xa18e('0x39')](function(_0x309854){_0x23d8a4=_0x309854['get']({'plain':!![]});return db[_0xa18e('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x23d8a4),{'transaction':_0x272c00});});})['then'](function(){return _0x23d8a4;})['then'](respondWithResult(_0x5a12d7,null))['catch'](handleError(_0x5a12d7,null));};exports['updateAccountApplications']=function(_0x14577a,_0x36d2ad,_0x4caa38){var _0x4c9938;return db[_0xa18e('0x7d')][_0xa18e('0x7e')](function(_0x432d2e){return db[_0xa18e('0x43')][_0xa18e('0x38')](_0x14577a[_0xa18e('0x5e')],{'where':{'id':_0x14577a['body']['id']},'transaction':_0x432d2e})[_0xa18e('0x39')](function(_0xed0cc5){return db[_0xa18e('0x9b')][_0xa18e('0x3a')]({'where':{'FaxAccountId':_0x14577a[_0xa18e('0x5e')]['id']},'transaction':_0x432d2e})[_0xa18e('0x39')](function(_0x56407c){return db['VoiceExtension'][_0xa18e('0x81')](createExtensionsReciveFax(_[_0xa18e('0x74')](_0x14577a[_0xa18e('0x5e')],[_0xa18e('0x9c'),'key',_0xa18e('0x9d'),_0xa18e('0x9e'),_0xa18e('0x9f'),_0xa18e('0xa0')])),{'transaction':_0x432d2e});});});})['then'](function(){return db[_0xa18e('0x43')]['findById'](_0x14577a[_0xa18e('0x5e')]['id']);})['then'](respondWithResult(_0x36d2ad,null))['catch'](handleError(_0x36d2ad,null));};exports[_0xa18e('0xa1')]=function(_0x2754c0,_0x29e3fa,_0x1a31ce){var _0xc4fa5e={'raw':!![],'where':{}};var _0x2749e1={};var _0x5dd92a={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x2754c0[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x29e3fa,null))[_0xa18e('0x39')](function(_0x323b30){if(_0x323b30){_0x2749e1['model']=_[_0xa18e('0x5c')](db['FaxMessage'][_0xa18e('0x44')]);_0x2749e1[_0xa18e('0x46')]=_['keys'](_0x2754c0[_0xa18e('0x46')]);_0x2749e1[_0xa18e('0x51')]=_['intersection'](_0x2749e1[_0xa18e('0x49')],_0x2749e1[_0xa18e('0x46')]);_0xc4fa5e[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x2749e1[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2754c0['query'][_0xa18e('0x4a')]));_0xc4fa5e['attributes']=_0xc4fa5e[_0xa18e('0x48')][_0xa18e('0x4b')]?_0xc4fa5e[_0xa18e('0x48')]:_0x2749e1['model'];if(!_0x2754c0[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0xc4fa5e[_0xa18e('0x30')]=qs[_0xa18e('0x30')](_0x2754c0['query'][_0xa18e('0x30')]);_0xc4fa5e[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2754c0['query'][_0xa18e('0x2e')]);}_0xc4fa5e[_0xa18e('0x4e')]=qs['sort'](_0x2754c0[_0xa18e('0x46')][_0xa18e('0x4f')]);_0xc4fa5e[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2754c0['query'],_0x2749e1[_0xa18e('0x51')]));_0xc4fa5e[_0xa18e('0x50')][_0xa18e('0x67')]=_0x323b30['id'];if(_0x2754c0[_0xa18e('0x46')]['filter']){_0xc4fa5e[_0xa18e('0x50')]=_['merge'](_0xc4fa5e[_0xa18e('0x50')],{'$or':_['map'](_0xc4fa5e['attributes'],function(_0x20e26d){var _0x2918cf={};_0x2918cf[_0x20e26d]={'$like':'%'+_0x2754c0[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x2918cf;})});}if(_0x2754c0[_0xa18e('0x46')][_0xa18e('0xa2')]){var _0x3eeed5=_0x2754c0[_0xa18e('0x46')][_0xa18e('0xa2')][_0xa18e('0xa3')](',');var _0x2f1c04={};_0x2f1c04[_0x3eeed5[0x0]]={'$gte':moment(_0x3eeed5[0x1])[_0xa18e('0xa4')](_0xa18e('0xa5'))};_0xc4fa5e['where']=_[_0xa18e('0x54')](_0xc4fa5e[_0xa18e('0x50')],_0x2f1c04);}_0xc4fa5e=_[_0xa18e('0x54')]({},_0xc4fa5e,_0x2754c0[_0xa18e('0x55')]);return db[_0xa18e('0xa6')][_0xa18e('0x31')]({'where':_0xc4fa5e['where']})[_0xa18e('0x39')](function(_0x22395d){_0x5dd92a[_0xa18e('0x31')]=_0x22395d;if(_0x2754c0[_0xa18e('0x46')][_0xa18e('0x56')]){_0xc4fa5e[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0xa6')][_0xa18e('0x70')](_0xc4fa5e);})[_0xa18e('0x39')](function(_0x5ecc9b){_0x5dd92a[_0xa18e('0x58')]=_0x5ecc9b;return _0x5dd92a;});}})['then'](respondWithFilteredResult(_0x29e3fa,_0xc4fa5e))[_0xa18e('0x59')](handleError(_0x29e3fa,null));};exports['send']=function(_0x589def,_0x38f50d,_0x297ac8){var _0x192d8a,_0x681884={},_0x22de4a;if(_0x589def[_0xa18e('0x5e')]['to']){_0x22de4a=_0x589def[_0xa18e('0x5e')]['to'][0x0];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x589def[_0xa18e('0x5b')]['id']},'include':[{'model':db[_0xa18e('0xa7')],'as':'List','include':[{'model':db[_0xa18e('0xa8')],'as':_0xa18e('0xa9'),'where':{'fax':_0x22de4a},'limit':0x1,'order':[[_0xa18e('0x9e'),_0xa18e('0xaa')]]}]}]})[_0xa18e('0x39')](handleEntityNotFound(_0x38f50d,null))['then'](function(_0x1a4807){_0x192d8a=_0x1a4807;if(_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')]&&_0x589def['body']['attachments'][_0xa18e('0x4b')]){for(var _0x23446b=0x0;_0x23446b<_0x589def['body'][_0xa18e('0xab')][_0xa18e('0x4b')];_0x23446b+=0x1){_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]={'filename':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]['name'],'id':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]['id'],'path':path['join'](config['root'],'server/files/attachments',_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b][_0xa18e('0xac')])};}}return respondWithRpcPromise(_0xa18e('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5b')]['id'])?undefined:_0x589def[_0xa18e('0x5b')]['id'],'path':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0x7')])?undefined:_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0]['path'],'fax':_['isNil'](_0x589def['body']['to'][0x0])?undefined:_0x589def[_0xa18e('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x192d8a){if(_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xaf')])){_0x589def[_0xa18e('0x5e')][_0xa18e('0xaf')]=util['format'](_0xa18e('0xb0'),_0x192d8a[_0xa18e('0x3d')],_0x192d8a[_0xa18e('0xb1')]);}if(_0x192d8a[_0xa18e('0xb2')]){if(_0x192d8a['List'][_0xa18e('0xa9')][_0xa18e('0x4b')]){return _0x192d8a[_0xa18e('0xb2')]['Contacts'][0x0];}else{return db[_0xa18e('0xa8')][_0xa18e('0x5d')](_['defaults'](_0x589def[_0xa18e('0x5e')],{'firstName':_0x589def[_0xa18e('0x5e')]['to'][0x0],'phone':_0x589def[_0xa18e('0x5e')]['to'][0x0],'fax':_0x589def[_0xa18e('0x5e')]['to'][0x0],'ListId':_0x192d8a[_0xa18e('0xa0')]}));}}else{throw new Error(_0xa18e('0xb3'));}}else{throw new Error(_0xa18e('0xb4'));}})[_0xa18e('0x39')](function(_0x343d0c){if(_0x343d0c){return db[_0xa18e('0x72')][_0xa18e('0x65')]({'where':{'ContactId':_0x343d0c['id'],'closed':![],'FaxAccountId':_0x192d8a['id']}})['then'](function(_0xd68609){if(_0xd68609){return[_0xd68609,![]];}return db[_0xa18e('0x72')][_0xa18e('0x5d')]({'UserId':_0x589def[_0xa18e('0x5f')]['id'],'ContactId':_0x343d0c['id'],'FaxAccountId':_0x192d8a['id'],'fax':_0x589def['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa18e('0x54')](_0x589def['body'],{'read':![],'body':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0xb5')],'FaxAccountId':_0x192d8a['id'],'UserId':_0x589def['user']['id'],'ContactId':_0x343d0c['id'],'AttachmentId':_0x589def[_0xa18e('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xa18e('0xa6')],'as':'Messages'}]})['then'](function(_0x1705d5){return[_0x1705d5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa18e('0xb6')](function(_0x4c98cf,_0x31b40a){if(_0x31b40a){return _0x4c98cf;}return db['FaxMessage'][_0xa18e('0x5d')]({'direction':_0xa18e('0xb7'),'read':![],'body':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0]['filename'],'FaxAccountId':_0x192d8a['id'],'FaxInteractionId':_0x4c98cf['id'],'UserId':_0x589def[_0xa18e('0x5f')]['id'],'ContactId':_0x4c98cf[_0xa18e('0xb8')],'AttachmentId':_0x589def['body'][_0xa18e('0xab')][0x0]['id']})[_0xa18e('0x39')](function(_0x380223){_0x4c98cf['dataValues'][_0xa18e('0xb9')]=[];_0x4c98cf[_0xa18e('0xba')][_0xa18e('0xb9')][_0xa18e('0x8d')](_0x380223['dataValues']);return _0x4c98cf;});})[_0xa18e('0x39')](function(_0x5e8595){respondWithRpcPromise(_0xa18e('0xbb'),_0xa18e('0xbb'),{'FaxAccountId':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5b')]['id'])?undefined:_0x589def[_0xa18e('0x5b')]['id'],'path':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0x7')])?undefined:_0x589def['body'][_0xa18e('0xab')][0x0][_0xa18e('0x7')],'fax':_[_0xa18e('0xae')](_0x589def['body']['to'][0x0])?undefined:_0x589def[_0xa18e('0x5e')]['to'][0x0],'AttachmentId':_0x589def[_0xa18e('0x5e')]['attachments'][0x0]['id']},client9002)[_0xa18e('0x39')](function(_0x3f0440){logger[_0xa18e('0x21')](_0xa18e('0xbc'),_0x3f0440);})[_0xa18e('0x59')](function(_0x26414c){logger[_0xa18e('0x21')](_0xa18e('0xbc'),_0x26414c);});return _0x5e8595;})[_0xa18e('0x39')](respondWithResult(_0x38f50d,null))[_0xa18e('0x59')](handleError(_0x38f50d,null));};exports[_0xa18e('0xbd')]=function(_0xc71d31,_0x2b4a76,_0xb0ebf){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0xc71d31[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x2b4a76,null))['then'](function(_0x372e17){if(_0x372e17){return _0x372e17[_0xa18e('0xbd')](_0xc71d31[_0xa18e('0x5e')]['ids'],_['omit'](_0xc71d31['body'],[_0xa18e('0x6c'),'id'])||{})[_0xa18e('0xb6')](function(_0x203517){for(var _0xa1a35e=0x0;_0xa1a35e<_0xc71d31[_0xa18e('0x5e')][_0xa18e('0x6c')]['length'];_0xa1a35e+=0x1){socket[_0xa18e('0xbe')](_0xa18e('0xbf'),{'UserId':Number(_0xc71d31[_0xa18e('0x5e')][_0xa18e('0x6c')][_0xa1a35e]),'FaxAccountId':Number(_0xc71d31['params']['id'])});}return _0x203517;});}})[_0xa18e('0x39')](respondWithResult(_0x2b4a76,null))['catch'](handleError(_0x2b4a76,null));};exports['removeAgents']=function(_0x5e2196,_0x410bf2,_0x2aaf0d){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x5e2196['params']['id']}})['then'](handleEntityNotFound(_0x410bf2,null))[_0xa18e('0x39')](function(_0x532842){if(_0x532842){return _0x532842[_0xa18e('0xc0')](_0x5e2196[_0xa18e('0x46')][_0xa18e('0x6c')])['then'](function(){if(_[_0xa18e('0xc1')](_0x5e2196['query'][_0xa18e('0x6c')])){for(var _0x2a5c68=0x0;_0x2a5c68<_0x5e2196[_0xa18e('0x46')]['ids'][_0xa18e('0x4b')];_0x2a5c68+=0x1){socket[_0xa18e('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x5e2196[_0xa18e('0x46')][_0xa18e('0x6c')][_0x2a5c68]),'FaxAccountId':Number(_0x5e2196[_0xa18e('0x5b')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5e2196['query'][_0xa18e('0x6c')]),'FaxAccountId':Number(_0x5e2196[_0xa18e('0x5b')]['id'])});}});}})[_0xa18e('0x39')](respondWithStatusCode(_0x410bf2,null))[_0xa18e('0x59')](handleError(_0x410bf2,null));};exports[_0xa18e('0xc2')]=function(_0x406684,_0x6b53ec,_0x2a5faf){var _0x3a5fca={};var _0x476813={};var _0x94b915;var _0x7208bf;return db[_0xa18e('0x43')]['findOne']({'where':{'id':_0x406684[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x6b53ec,null))[_0xa18e('0x39')](function(_0x2363d4){if(_0x2363d4){_0x94b915=_0x2363d4;_0x476813['model']=_[_0xa18e('0x5c')](db[_0xa18e('0x77')][_0xa18e('0x44')]);_0x476813[_0xa18e('0x46')]=_[_0xa18e('0x5c')](_0x406684[_0xa18e('0x46')]);_0x476813['filters']=_[_0xa18e('0x47')](_0x476813['model'],_0x476813['query']);_0x3a5fca[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x476813[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x406684[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x3a5fca['attributes']=_0x3a5fca['attributes'][_0xa18e('0x4b')]?_0x3a5fca[_0xa18e('0x48')]:_0x476813[_0xa18e('0x49')];_0x3a5fca[_0xa18e('0x4e')]=qs[_0xa18e('0x4f')](_0x406684[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x3a5fca[_0xa18e('0x50')]=qs['filters'](_['pick'](_0x406684[_0xa18e('0x46')],_0x476813[_0xa18e('0x51')]));if(_0x406684[_0xa18e('0x46')][_0xa18e('0x53')]){_0x3a5fca[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x3a5fca['where'],{'$or':_['map'](_0x3a5fca[_0xa18e('0x48')],function(_0x4de2cd){var _0x14187c={};_0x14187c[_0x4de2cd]={'$like':'%'+_0x406684[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x14187c;})});}_0x3a5fca=_[_0xa18e('0x54')]({},_0x3a5fca,_0x406684['options']);return _0x94b915['getAgents'](_0x3a5fca);}})[_0xa18e('0x39')](function(_0x17c466){if(_0x17c466){_0x7208bf=_0x17c466[_0xa18e('0x4b')];if(!_0x406684[_0xa18e('0x46')]['hasOwnProperty'](_0xa18e('0x4d'))){_0x3a5fca['limit']=qs[_0xa18e('0x30')](_0x406684[_0xa18e('0x46')][_0xa18e('0x30')]);_0x3a5fca['offset']=qs['offset'](_0x406684[_0xa18e('0x46')][_0xa18e('0x2e')]);}return _0x94b915[_0xa18e('0xc2')](_0x3a5fca);}})['then'](function(_0x18bfc6){if(_0x18bfc6){return _0x18bfc6?{'count':_0x7208bf,'rows':_0x18bfc6}:null;}})[_0xa18e('0x39')](respondWithResult(_0x6b53ec,null))[_0xa18e('0x59')](handleError(_0x6b53ec,null));}; \ No newline at end of file +var _0xa338=['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','destroy','describe','addDisposition','FaxAccountId','Disposition','getDispositions','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tags','color','tag','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','Wait','ReceiveFax','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','ListId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','join','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','type','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa338,0x126));var _0x8a33=function(_0x220ff7,_0x47fe4e){_0x220ff7=_0x220ff7-0x0;var _0x4caa66=_0xa338[_0x220ff7];return _0x4caa66;};'use strict';var emlformat=require(_0x8a33('0x0'));var rimraf=require(_0x8a33('0x1'));var zipdir=require(_0x8a33('0x2'));var jsonpatch=require(_0x8a33('0x3'));var rp=require('request-promise');var moment=require(_0x8a33('0x4'));var BPromise=require(_0x8a33('0x5'));var Mustache=require(_0x8a33('0x6'));var util=require(_0x8a33('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8a33('0x8'));var ejs=require(_0x8a33('0x9'));var fs=require('fs');var fs_extra=require(_0x8a33('0xa'));var _=require(_0x8a33('0xb'));var squel=require(_0x8a33('0xc'));var crypto=require(_0x8a33('0xd'));var jsforce=require(_0x8a33('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8a33('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a33('0xf'));var qs=require(_0x8a33('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a33('0x11'));var logger=require('../../config/logger')(_0x8a33('0x12'));var utils=require(_0x8a33('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8a33('0x14'));var db=require('../../mysqldb')['db'];config[_0x8a33('0x15')]=_[_0x8a33('0x16')](config[_0x8a33('0x15')],{'host':_0x8a33('0x17'),'port':0x18eb});var socket=require(_0x8a33('0x18'))(new Redis(config[_0x8a33('0x15')]));require(_0x8a33('0x19'))[_0x8a33('0x1a')](socket);var jayson=require(_0x8a33('0x1b'));var client=jayson[_0x8a33('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x8a33('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f07f,_0x1c1912,_0x58168b,_0x512351){return new BPromise(function(_0x2280d5,_0x1c4564){var _0x460c05=_0x512351||client;return _0x460c05['request'](_0x52f07f,_0x58168b)[_0x8a33('0x1d')](function(_0x576a19){logger[_0x8a33('0x1e')]('FaxAccount,\x20%s,\x20%s',_0x1c1912,_0x8a33('0x1f'));logger[_0x8a33('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1c1912,_0x8a33('0x1f'),JSON[_0x8a33('0x21')](_0x576a19));if(_0x576a19['error']){if(_0x576a19['error']['code']===0x1f4){logger[_0x8a33('0x22')](_0x8a33('0x23'),_0x1c1912,_0x576a19[_0x8a33('0x22')][_0x8a33('0x24')]);return _0x1c4564(_0x576a19[_0x8a33('0x22')]['message']);}logger[_0x8a33('0x22')](_0x8a33('0x23'),_0x1c1912,_0x576a19[_0x8a33('0x22')][_0x8a33('0x24')]);return _0x2280d5(_0x576a19[_0x8a33('0x22')]['message']);}else{logger[_0x8a33('0x1e')](_0x8a33('0x23'),_0x1c1912,_0x8a33('0x1f'));_0x2280d5(_0x576a19['result'][_0x8a33('0x24')]);}})[_0x8a33('0x25')](function(_0x4d1fe9){logger[_0x8a33('0x22')](_0x8a33('0x23'),_0x1c1912,_0x4d1fe9);_0x1c4564(_0x4d1fe9);});});}function respondWithStatusCode(_0x5aac15,_0x1355bd){_0x1355bd=_0x1355bd||0xcc;return function(_0x264f49){if(_0x264f49){return _0x5aac15[_0x8a33('0x26')](_0x1355bd);}return _0x5aac15['status'](_0x1355bd)[_0x8a33('0x27')]();};}function respondWithResult(_0x25a9c1,_0x2c26d1){_0x2c26d1=_0x2c26d1||0xc8;return function(_0x48ed40){if(_0x48ed40){return _0x25a9c1[_0x8a33('0x28')](_0x2c26d1)[_0x8a33('0x29')](_0x48ed40);}};}function respondWithFilteredResult(_0x32d293,_0x28fb43){return function(_0x1036c5){if(_0x1036c5){var _0xbf969d=typeof _0x28fb43[_0x8a33('0x2a')]===_0x8a33('0x2b')&&typeof _0x28fb43['limit']===_0x8a33('0x2b');var _0x4017b2=_0x1036c5[_0x8a33('0x2c')];var _0x2908d2=_0xbf969d?0x0:_0x28fb43[_0x8a33('0x2a')];var _0x99e578=_0xbf969d?_0x1036c5[_0x8a33('0x2c')]:_0x28fb43[_0x8a33('0x2a')]+_0x28fb43['limit'];var _0x5b1af2;if(_0x99e578>=_0x4017b2){_0x99e578=_0x4017b2;_0x5b1af2=0xc8;}else{_0x5b1af2=0xce;}_0x32d293[_0x8a33('0x28')](_0x5b1af2);return _0x32d293[_0x8a33('0x2d')](_0x8a33('0x2e'),_0x2908d2+'-'+_0x99e578+'/'+_0x4017b2)['json'](_0x1036c5);}return null;};}function patchUpdates(_0xcebbd1){return function(_0x502013){try{jsonpatch[_0x8a33('0x2f')](_0x502013,_0xcebbd1,!![]);}catch(_0x4dac40){return BPromise[_0x8a33('0x30')](_0x4dac40);}return _0x502013['save']();};}function saveUpdates(_0x439cf5,_0xb6a12){return function(_0x45e967){if(_0x45e967){return _0x45e967[_0x8a33('0x31')](_0x439cf5)[_0x8a33('0x1d')](function(_0x5489b3){return _0x5489b3;});}return null;};}function removeEntity(_0x37f73f,_0x38f181){return function(_0x569a5f){if(_0x569a5f){return _0x569a5f['destroy']()[_0x8a33('0x1d')](function(){var _0x5a6a70=_0x569a5f[_0x8a33('0x32')]({'plain':!![]});var _0x24261d=_0x8a33('0x33');return db[_0x8a33('0x34')]['destroy']({'where':{'type':_0x24261d,'resourceId':_0x5a6a70['id']}})[_0x8a33('0x1d')](function(){return _0x569a5f;});})[_0x8a33('0x1d')](function(){_0x37f73f[_0x8a33('0x28')](0xcc)[_0x8a33('0x27')]();});}};}function handleEntityNotFound(_0x494eb4,_0xc79b55){return function(_0x182026){if(!_0x182026){_0x494eb4[_0x8a33('0x26')](0x194);}return _0x182026;};}function handleError(_0x284bb9,_0x43bcb9){_0x43bcb9=_0x43bcb9||0x1f4;return function(_0x5667a7){logger[_0x8a33('0x22')](_0x5667a7[_0x8a33('0x35')]);if(_0x5667a7[_0x8a33('0x36')]){delete _0x5667a7[_0x8a33('0x36')];}_0x284bb9[_0x8a33('0x28')](_0x43bcb9)[_0x8a33('0x37')](_0x5667a7);};}exports[_0x8a33('0x38')]=function(_0x3f0972,_0x17ff0e){var _0x451c19={'include':[{'model':db[_0x8a33('0x39')],'as':'mandatoryDispositionPause'}]},_0x321400={},_0x57854d={'count':0x0,'rows':[]};var _0x390946=_['map'](db[_0x8a33('0x3a')][_0x8a33('0x3b')],function(_0x3c268c){return{'name':_0x3c268c[_0x8a33('0x3c')],'type':_0x3c268c['type'][_0x8a33('0x3d')]};});_0x321400[_0x8a33('0x3e')]=_[_0x8a33('0x3f')](_0x390946,_0x8a33('0x36'));_0x321400[_0x8a33('0x40')]=_[_0x8a33('0x41')](_0x3f0972[_0x8a33('0x40')]);_0x321400[_0x8a33('0x42')]=_[_0x8a33('0x43')](_0x321400[_0x8a33('0x3e')],_0x321400[_0x8a33('0x40')]);_0x451c19['attributes']=_[_0x8a33('0x43')](_0x321400[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0x3f0972[_0x8a33('0x40')][_0x8a33('0x44')]));_0x451c19[_0x8a33('0x45')]=_0x451c19[_0x8a33('0x45')]['length']?_0x451c19['attributes']:_0x321400[_0x8a33('0x3e')];if(!_0x3f0972['query'][_0x8a33('0x46')](_0x8a33('0x47'))){_0x451c19['limit']=qs[_0x8a33('0x48')](_0x3f0972[_0x8a33('0x40')][_0x8a33('0x48')]);_0x451c19['offset']=qs['offset'](_0x3f0972[_0x8a33('0x40')][_0x8a33('0x2a')]);}_0x451c19[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0x3f0972[_0x8a33('0x40')]['sort']);_0x451c19['where']=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0x3f0972['query'],_0x321400[_0x8a33('0x42')]),_0x390946);if(_0x3f0972['query']['filter']){_0x451c19['where']=_['merge'](_0x451c19[_0x8a33('0x4c')],{'$or':_[_0x8a33('0x3f')](_0x390946,function(_0x1570a4){if(_0x1570a4[_0x8a33('0x4d')]!==_0x8a33('0x4e')){var _0x516ec3={};_0x516ec3[_0x1570a4[_0x8a33('0x36')]]={'$like':'%'+_0x3f0972['query'][_0x8a33('0x4f')]+'%'};return _0x516ec3;}})});}_0x451c19=_[_0x8a33('0x50')]({},_0x451c19,_0x3f0972['options']);var _0xf3f78b={'where':_0x451c19['where']};return db['FaxAccount'][_0x8a33('0x2c')](_0xf3f78b)[_0x8a33('0x1d')](function(_0x4e6adf){_0x57854d['count']=_0x4e6adf;if(_0x3f0972['query'][_0x8a33('0x51')]){_0x451c19['include']=[{'all':!![]}];}return db[_0x8a33('0x3a')][_0x8a33('0x52')](_0x451c19);})[_0x8a33('0x1d')](function(_0x1b4fda){_0x57854d[_0x8a33('0x53')]=_0x1b4fda;return _0x57854d;})['then'](respondWithFilteredResult(_0x17ff0e,_0x451c19))[_0x8a33('0x25')](handleError(_0x17ff0e,null));};exports[_0x8a33('0x54')]=function(_0x5c6bf8,_0x18f317){var _0x572204={'raw':![],'where':{'id':_0x5c6bf8[_0x8a33('0x55')]['id']},'include':[{'model':db[_0x8a33('0x39')],'as':_0x8a33('0x56')}]},_0x110704={};_0x110704[_0x8a33('0x3e')]=_[_0x8a33('0x41')](db[_0x8a33('0x3a')][_0x8a33('0x3b')]);_0x110704[_0x8a33('0x40')]=_[_0x8a33('0x41')](_0x5c6bf8[_0x8a33('0x40')]);_0x110704['filters']=_['intersection'](_0x110704[_0x8a33('0x3e')],_0x110704[_0x8a33('0x40')]);_0x572204[_0x8a33('0x45')]=_['intersection'](_0x110704[_0x8a33('0x3e')],qs['fields'](_0x5c6bf8[_0x8a33('0x40')][_0x8a33('0x44')]));_0x572204['attributes']=_0x572204[_0x8a33('0x45')]['length']?_0x572204[_0x8a33('0x45')]:_0x110704[_0x8a33('0x3e')];if(_0x5c6bf8[_0x8a33('0x40')]['includeAll']){_0x572204[_0x8a33('0x57')]=[{'all':!![]}];}_0x572204=_[_0x8a33('0x50')]({},_0x572204,_0x5c6bf8[_0x8a33('0x58')]);return db['FaxAccount']['find'](_0x572204)[_0x8a33('0x1d')](handleEntityNotFound(_0x18f317,null))[_0x8a33('0x1d')](respondWithResult(_0x18f317,null))[_0x8a33('0x25')](handleError(_0x18f317,null));};exports[_0x8a33('0x59')]=function(_0x3edb37,_0x428915){return db['FaxAccount'][_0x8a33('0x59')](_0x3edb37[_0x8a33('0x5a')],{})[_0x8a33('0x1d')](function(_0x73ee7c){var _0x1c14c9=_0x3edb37[_0x8a33('0x5b')][_0x8a33('0x32')]({'plain':!![]});if(!_0x1c14c9)throw new Error(_0x8a33('0x5c'));if(_0x1c14c9[_0x8a33('0x5d')]===_0x8a33('0x5b')){var _0x9c6b9f=_0x73ee7c['get']({'plain':!![]});var _0x40a533=_0x8a33('0x33');return db['UserProfileSection'][_0x8a33('0x5e')]({'where':{'name':_0x40a533,'userProfileId':_0x1c14c9[_0x8a33('0x5f')]},'raw':!![]})[_0x8a33('0x1d')](function(_0x3ec1ca){if(_0x3ec1ca&&_0x3ec1ca[_0x8a33('0x60')]===0x0){return db[_0x8a33('0x34')][_0x8a33('0x59')]({'name':_0x9c6b9f[_0x8a33('0x36')],'resourceId':_0x9c6b9f['id'],'type':_0x3ec1ca['name'],'sectionId':_0x3ec1ca['id']},{})[_0x8a33('0x1d')](function(){return _0x73ee7c;});}else{return _0x73ee7c;}})[_0x8a33('0x25')](function(_0x568a0f){logger['error'](_0x8a33('0x61'),_0x568a0f);throw _0x568a0f;});}return _0x73ee7c;})[_0x8a33('0x1d')](respondWithResult(_0x428915,0xc9))[_0x8a33('0x25')](handleError(_0x428915,null));};exports[_0x8a33('0x31')]=function(_0xb5514b,_0x5ac4de){if(_0xb5514b['body']['id']){delete _0xb5514b['body']['id'];}return db['FaxAccount'][_0x8a33('0x5e')]({'where':{'id':_0xb5514b['params']['id']},'include':[{'model':db[_0x8a33('0x39')],'as':'mandatoryDispositionPause'}]})[_0x8a33('0x1d')](handleEntityNotFound(_0x5ac4de,null))[_0x8a33('0x1d')](saveUpdates(_0xb5514b[_0x8a33('0x5a')],null))[_0x8a33('0x1d')](respondWithResult(_0x5ac4de,null))['catch'](handleError(_0x5ac4de,null));};exports[_0x8a33('0x62')]=function(_0x496a7b,_0x7e6f92){return db[_0x8a33('0x3a')]['find']({'where':{'id':_0x496a7b[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x7e6f92,null))['then'](removeEntity(_0x7e6f92,null))[_0x8a33('0x25')](handleError(_0x7e6f92,null));};exports[_0x8a33('0x63')]=function(_0x5ae935,_0x528d3c){return db['FaxAccount'][_0x8a33('0x63')]()['then'](respondWithResult(_0x528d3c,null))[_0x8a33('0x25')](handleError(_0x528d3c,null));};exports[_0x8a33('0x64')]=function(_0x3f8210,_0x30b3a6,_0x231092){if(_0x3f8210[_0x8a33('0x5a')]['id']){delete _0x3f8210['body']['id'];}return db[_0x8a33('0x3a')][_0x8a33('0x5e')]({'where':{'id':_0x3f8210[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x30b3a6,null))[_0x8a33('0x1d')](function(_0x912670){if(_0x912670){_0x3f8210[_0x8a33('0x5a')][_0x8a33('0x65')]=_0x912670['id'];return db[_0x8a33('0x66')]['create'](_0x3f8210[_0x8a33('0x5a')]);}})[_0x8a33('0x1d')](respondWithResult(_0x30b3a6,null))[_0x8a33('0x25')](handleError(_0x30b3a6,null));};exports[_0x8a33('0x67')]=function(_0x5860d9,_0x12ae22,_0x5c902a){var _0x1043fa={'raw':![],'where':{}};var _0xea0508={};var _0x330aa2={'count':0x0,'rows':[]};return db[_0x8a33('0x3a')]['findOne']({'where':{'id':_0x5860d9[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x12ae22,null))[_0x8a33('0x1d')](function(_0x41d2f2){if(_0x41d2f2){_0xea0508[_0x8a33('0x3e')]=_[_0x8a33('0x41')](db[_0x8a33('0x66')][_0x8a33('0x3b')]);_0xea0508['query']=_[_0x8a33('0x41')](_0x5860d9[_0x8a33('0x40')]);_0xea0508['filters']=_[_0x8a33('0x43')](_0xea0508['model'],_0xea0508['query']);_0x1043fa[_0x8a33('0x45')]=_[_0x8a33('0x43')](_0xea0508[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0x5860d9[_0x8a33('0x40')][_0x8a33('0x44')]));_0x1043fa[_0x8a33('0x45')]=_0x1043fa[_0x8a33('0x45')][_0x8a33('0x68')]?_0x1043fa['attributes']:_0xea0508[_0x8a33('0x3e')];if(!_0x5860d9['query'][_0x8a33('0x46')](_0x8a33('0x47'))){_0x1043fa[_0x8a33('0x48')]=qs['limit'](_0x5860d9[_0x8a33('0x40')][_0x8a33('0x48')]);_0x1043fa[_0x8a33('0x2a')]=qs[_0x8a33('0x2a')](_0x5860d9[_0x8a33('0x40')][_0x8a33('0x2a')]);}_0x1043fa['order']=qs[_0x8a33('0x4a')](_0x5860d9[_0x8a33('0x40')][_0x8a33('0x4a')]);_0x1043fa[_0x8a33('0x4c')]=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0x5860d9[_0x8a33('0x40')],_0xea0508[_0x8a33('0x42')]));_0x1043fa[_0x8a33('0x4c')][_0x8a33('0x65')]=_0x41d2f2['id'];if(_0x5860d9[_0x8a33('0x40')][_0x8a33('0x4f')]){_0x1043fa['where']=_['merge'](_0x1043fa['where'],{'$or':_[_0x8a33('0x3f')](_0x1043fa[_0x8a33('0x45')],function(_0x491b41){var _0x2f2295={};_0x2f2295[_0x491b41]={'$like':'%'+_0x5860d9['query'][_0x8a33('0x4f')]+'%'};return _0x2f2295;})});}_0x1043fa=_[_0x8a33('0x50')]({},_0x1043fa,_0x5860d9['options']);return db[_0x8a33('0x66')][_0x8a33('0x2c')]({'where':_0x1043fa[_0x8a33('0x4c')]})[_0x8a33('0x1d')](function(_0x5cdbb0){_0x330aa2[_0x8a33('0x2c')]=_0x5cdbb0;if(_0x5860d9[_0x8a33('0x40')][_0x8a33('0x51')]){_0x1043fa[_0x8a33('0x57')]=[{'all':!![]}];}return db[_0x8a33('0x66')][_0x8a33('0x52')](_0x1043fa);})[_0x8a33('0x1d')](function(_0xe1c7e5){_0x330aa2[_0x8a33('0x53')]=_0xe1c7e5;return _0x330aa2;});}})[_0x8a33('0x1d')](respondWithFilteredResult(_0x12ae22,_0x1043fa))['catch'](handleError(_0x12ae22,null));};exports[_0x8a33('0x69')]=function(_0x2787b6,_0x3cfb31,_0x2a6b06){return db[_0x8a33('0x3a')]['find']({'where':{'id':_0x2787b6[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x3cfb31,null))[_0x8a33('0x1d')](function(_0x42ecfb){if(_0x42ecfb){return _0x42ecfb[_0x8a33('0x69')](_0x2787b6[_0x8a33('0x40')][_0x8a33('0x6a')]);}})[_0x8a33('0x1d')](respondWithStatusCode(_0x3cfb31,null))['catch'](handleError(_0x3cfb31,null));};exports[_0x8a33('0x6b')]=function(_0x284098,_0x2fbc2d,_0x53487b){if(_0x284098[_0x8a33('0x5a')]['id']){delete _0x284098['body']['id'];}return db[_0x8a33('0x3a')]['find']({'where':{'id':_0x284098[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x2fbc2d,null))[_0x8a33('0x1d')](function(_0x4e079d){if(_0x4e079d){_0x284098[_0x8a33('0x5a')]['FaxAccountId']=_0x4e079d['id'];return db[_0x8a33('0x6c')][_0x8a33('0x59')](_0x284098[_0x8a33('0x5a')]);}})[_0x8a33('0x1d')](respondWithResult(_0x2fbc2d,null))[_0x8a33('0x25')](handleError(_0x2fbc2d,null));};exports[_0x8a33('0x6d')]=function(_0xdddc1d,_0x2ea0cf,_0x12f916){var _0x150663={'raw':![],'where':{}};var _0x44d962={};var _0x2f7f28={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8a33('0x6e')]({'where':{'id':_0xdddc1d[_0x8a33('0x55')]['id']}})['then'](handleEntityNotFound(_0x2ea0cf,null))[_0x8a33('0x1d')](function(_0x38b71f){if(_0x38b71f){_0x44d962['model']=_[_0x8a33('0x41')](db[_0x8a33('0x6c')][_0x8a33('0x3b')]);_0x44d962[_0x8a33('0x40')]=_[_0x8a33('0x41')](_0xdddc1d[_0x8a33('0x40')]);_0x44d962[_0x8a33('0x42')]=_['intersection'](_0x44d962[_0x8a33('0x3e')],_0x44d962['query']);_0x150663['attributes']=_[_0x8a33('0x43')](_0x44d962[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0xdddc1d[_0x8a33('0x40')]['fields']));_0x150663[_0x8a33('0x45')]=_0x150663[_0x8a33('0x45')][_0x8a33('0x68')]?_0x150663[_0x8a33('0x45')]:_0x44d962[_0x8a33('0x3e')];if(!_0xdddc1d[_0x8a33('0x40')][_0x8a33('0x46')](_0x8a33('0x47'))){_0x150663[_0x8a33('0x48')]=qs['limit'](_0xdddc1d['query'][_0x8a33('0x48')]);_0x150663[_0x8a33('0x2a')]=qs[_0x8a33('0x2a')](_0xdddc1d[_0x8a33('0x40')]['offset']);}_0x150663[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0xdddc1d[_0x8a33('0x40')]['sort']);_0x150663[_0x8a33('0x4c')]=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0xdddc1d[_0x8a33('0x40')],_0x44d962[_0x8a33('0x42')]));_0x150663['where'][_0x8a33('0x65')]=_0x38b71f['id'];if(_0xdddc1d['query'][_0x8a33('0x4f')]){_0x150663[_0x8a33('0x4c')]=_['merge'](_0x150663['where'],{'$or':_[_0x8a33('0x3f')](_0x150663[_0x8a33('0x45')],function(_0x24204a){var _0x2b67dd={};_0x2b67dd[_0x24204a]={'$like':'%'+_0xdddc1d[_0x8a33('0x40')]['filter']+'%'};return _0x2b67dd;})});}_0x150663=_[_0x8a33('0x50')]({},_0x150663,_0xdddc1d[_0x8a33('0x58')]);return db[_0x8a33('0x6c')][_0x8a33('0x2c')]({'where':_0x150663[_0x8a33('0x4c')]})[_0x8a33('0x1d')](function(_0x4f657e){_0x2f7f28['count']=_0x4f657e;if(_0xdddc1d[_0x8a33('0x40')][_0x8a33('0x51')]){_0x150663[_0x8a33('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8a33('0x52')](_0x150663);})[_0x8a33('0x1d')](function(_0x561c6a){_0x2f7f28[_0x8a33('0x53')]=_0x561c6a;return _0x2f7f28;});}})['then'](respondWithFilteredResult(_0x2ea0cf,_0x150663))[_0x8a33('0x25')](handleError(_0x2ea0cf,null));};exports[_0x8a33('0x6f')]=function(_0x4ad4f9,_0x1087c9,_0x3e1294){return db[_0x8a33('0x3a')]['find']({'where':{'id':_0x4ad4f9[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x1087c9,null))['then'](function(_0x29d459){if(_0x29d459){return _0x29d459['removeAnswers'](_0x4ad4f9[_0x8a33('0x40')][_0x8a33('0x6a')]);}})[_0x8a33('0x1d')](respondWithStatusCode(_0x1087c9,null))['catch'](handleError(_0x1087c9,null));};exports[_0x8a33('0x70')]=function(_0x5e6df8,_0x1eade9,_0x119661){return db[_0x8a33('0x71')][_0x8a33('0x5e')]({'where':{'id':_0x5e6df8[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x1eade9,null))[_0x8a33('0x1d')](function(_0x925aec){if(_0x925aec){return _0x925aec[_0x8a33('0x70')](_0x5e6df8[_0x8a33('0x5a')][_0x8a33('0x6a')],_[_0x8a33('0x72')](_0x5e6df8[_0x8a33('0x5a')],[_0x8a33('0x6a'),'id'])||{});}})[_0x8a33('0x1d')](respondWithResult(_0x1eade9,null))[_0x8a33('0x25')](handleError(_0x1eade9,null));};exports[_0x8a33('0x73')]=function(_0x3ab66f,_0x12868f,_0x38919d){var _0x199d5e={'raw':![],'where':{}};var _0x160a5a={};var _0x1cfe38={'count':0x0,'rows':[]};return db[_0x8a33('0x3a')][_0x8a33('0x6e')]({'where':{'id':_0x3ab66f[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x12868f,null))[_0x8a33('0x1d')](function(_0x25c2b6){if(_0x25c2b6){_0x160a5a[_0x8a33('0x3e')]=_[_0x8a33('0x41')](db['FaxInteraction']['rawAttributes']);_0x160a5a[_0x8a33('0x40')]=_[_0x8a33('0x41')](_0x3ab66f[_0x8a33('0x40')]);_0x160a5a[_0x8a33('0x42')]=_[_0x8a33('0x43')](_0x160a5a['model'],_0x160a5a[_0x8a33('0x40')]);_0x199d5e['attributes']=_[_0x8a33('0x43')](_0x160a5a[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x44')]));_0x199d5e[_0x8a33('0x45')]=_0x199d5e['attributes'][_0x8a33('0x68')]?_0x199d5e['attributes']:_0x160a5a['model'];if(!_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x46')](_0x8a33('0x47'))){_0x199d5e[_0x8a33('0x48')]=qs[_0x8a33('0x48')](_0x3ab66f[_0x8a33('0x40')]['limit']);_0x199d5e[_0x8a33('0x2a')]=qs[_0x8a33('0x2a')](_0x3ab66f['query']['offset']);}_0x199d5e[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x4a')]);_0x199d5e['where']=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0x3ab66f['query'],_0x160a5a[_0x8a33('0x42')]));_0x199d5e['where']['FaxAccountId']=_0x25c2b6['id'];if(_0x3ab66f['query'][_0x8a33('0x4f')]){_0x199d5e[_0x8a33('0x4c')]=_['merge'](_0x199d5e[_0x8a33('0x4c')],{'$or':_[_0x8a33('0x3f')](_0x199d5e[_0x8a33('0x45')],function(_0x849760){var _0x2dba43={};_0x2dba43[_0x849760]={'$like':'%'+_0x3ab66f[_0x8a33('0x40')]['filter']+'%'};return _0x2dba43;})});}_0x199d5e=_[_0x8a33('0x50')]({},_0x199d5e,_0x3ab66f['options']);return db[_0x8a33('0x71')][_0x8a33('0x2c')]({'where':_0x199d5e[_0x8a33('0x4c')]})['then'](function(_0x29674b){_0x1cfe38[_0x8a33('0x2c')]=_0x29674b;if(_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x51')]){_0x199d5e['include']=[{'model':db[_0x8a33('0x74')],'as':_0x8a33('0x75'),'required':![]},{'model':db['User'],'as':_0x8a33('0x76'),'attributes':['name',_0x8a33('0x77'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8a33('0x78'),'attributes':['id','name',_0x8a33('0x79')],'where':_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x7a')]?{'id':_0x3ab66f[_0x8a33('0x40')]['tag']}:undefined,'required':_0x3ab66f[_0x8a33('0x40')][_0x8a33('0x7a')]?!![]:![]}];}return db[_0x8a33('0x71')][_0x8a33('0x52')](_0x199d5e);})[_0x8a33('0x1d')](function(_0x2769ff){_0x1cfe38[_0x8a33('0x53')]=_0x2769ff;return _0x1cfe38;});}})[_0x8a33('0x1d')](respondWithFilteredResult(_0x12868f,_0x199d5e))['catch'](handleError(_0x12868f,null));};exports['addApplications']=function(_0x220679,_0x4ec934){var _0x11006a=_0x220679['params']['id'];var _0x48040b=_0x220679[_0x8a33('0x5a')];var _0x3130ac=0xc8;var _0x46a1bd=null;return db[_0x8a33('0x7b')]['transaction']({'isolationLevel':db[_0x8a33('0x7b')][_0x8a33('0x7c')]['ISOLATION_LEVELS'][_0x8a33('0x7d')]},function(_0x3c3857){return db['FaxAccount'][_0x8a33('0x6e')]({'where':{'id':_0x11006a},'transaction':_0x3c3857})[_0x8a33('0x1d')](function(_0x4732b1){if(_0x4732b1){return db[_0x8a33('0x7e')][_0x8a33('0x62')]({'where':{'FaxAccountId':_0x11006a},'transaction':_0x3c3857})['then'](function(){var _0x36a50a=_['map'](_0x48040b,function(_0x3b61d7){_0x3b61d7[_0x8a33('0x65')]=_0x11006a;return _0x3b61d7;});return db['FaxApplication'][_0x8a33('0x7f')](_0x36a50a,{'transaction':_0x3c3857});});}else{_0x3130ac=0x194;_0x46a1bd=[];}});})[_0x8a33('0x1d')](function(){if(_0x3130ac!==0x194){return db[_0x8a33('0x7e')][_0x8a33('0x80')]({'where':{'FaxAccountId':_0x11006a},'order':_0x8a33('0x81')})[_0x8a33('0x1d')](function(_0x2d7854){_0x46a1bd=_0x2d7854;});}})[_0x8a33('0x25')](function(_0x2fd8bd){_0x3130ac=0x1f4;logger[_0x8a33('0x22')](_0x2fd8bd['stack']);if(_0x2fd8bd[_0x8a33('0x36')]){delete _0x2fd8bd[_0x8a33('0x36')];}_0x46a1bd=_0x2fd8bd;})[_0x8a33('0x82')](function(){if(_0x46a1bd===null){_0x4ec934[_0x8a33('0x26')](_0x3130ac);}else{if(_0x3130ac===0x1f4){_0x4ec934['status'](_0x3130ac)['send'](_0x46a1bd);}else{_0x4ec934[_0x8a33('0x28')](_0x3130ac)[_0x8a33('0x29')](_0x46a1bd);}}});};exports[_0x8a33('0x83')]=function(_0x2c95af,_0x202429,_0x20a6d6){var _0x4bcbd7={};var _0x502a5b={};var _0x35eefa;var _0x5d3fde;return db[_0x8a33('0x3a')][_0x8a33('0x6e')]({'where':{'id':_0x2c95af[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x202429,null))[_0x8a33('0x1d')](function(_0x27ba8b){if(_0x27ba8b){_0x35eefa=_0x27ba8b;_0x502a5b[_0x8a33('0x3e')]=_['keys'](db['FaxApplication'][_0x8a33('0x3b')]);_0x502a5b[_0x8a33('0x40')]=_['keys'](_0x2c95af[_0x8a33('0x40')]);_0x502a5b['filters']=_['intersection'](_0x502a5b['model'],_0x502a5b[_0x8a33('0x40')]);_0x4bcbd7[_0x8a33('0x45')]=_[_0x8a33('0x43')](_0x502a5b[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0x2c95af[_0x8a33('0x40')][_0x8a33('0x44')]));_0x4bcbd7['attributes']=_0x4bcbd7[_0x8a33('0x45')][_0x8a33('0x68')]?_0x4bcbd7[_0x8a33('0x45')]:_0x502a5b[_0x8a33('0x3e')];_0x4bcbd7[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0x2c95af[_0x8a33('0x40')][_0x8a33('0x4a')]);_0x4bcbd7[_0x8a33('0x4c')]=qs['filters'](_[_0x8a33('0x4b')](_0x2c95af[_0x8a33('0x40')],_0x502a5b[_0x8a33('0x42')]));if(_0x2c95af[_0x8a33('0x40')]['filter']){_0x4bcbd7[_0x8a33('0x4c')]=_['merge'](_0x4bcbd7['where'],{'$or':_[_0x8a33('0x3f')](_0x4bcbd7[_0x8a33('0x45')],function(_0x435a16){var _0x371512={};_0x371512[_0x435a16]={'$like':'%'+_0x2c95af[_0x8a33('0x40')][_0x8a33('0x4f')]+'%'};return _0x371512;})});}_0x4bcbd7=_[_0x8a33('0x50')]({},_0x4bcbd7,_0x2c95af[_0x8a33('0x58')]);return _0x35eefa[_0x8a33('0x83')](_0x4bcbd7);}})[_0x8a33('0x1d')](function(_0x20f96e){if(_0x20f96e){_0x5d3fde=_0x20f96e['length'];if(!_0x2c95af[_0x8a33('0x40')][_0x8a33('0x46')](_0x8a33('0x47'))){_0x4bcbd7['limit']=qs['limit'](_0x2c95af[_0x8a33('0x40')][_0x8a33('0x48')]);_0x4bcbd7[_0x8a33('0x2a')]=qs[_0x8a33('0x2a')](_0x2c95af['query'][_0x8a33('0x2a')]);}return _0x35eefa['getApplications'](_0x4bcbd7);}})['then'](function(_0x5d41d9){if(_0x5d41d9){return _0x5d41d9?{'count':_0x5d3fde,'rows':_0x5d41d9}:null;}})[_0x8a33('0x1d')](respondWithResult(_0x202429,null))[_0x8a33('0x25')](handleError(_0x202429,null));};function Extension(_0x1b109f,_0x3efbba,_0xc40fca,_0x57202e){this[_0x8a33('0x84')]=_0x8a33('0x85');this[_0x8a33('0x86')]=_0x1b109f[_0x8a33('0x87')];this[_0x8a33('0x88')]=_0x57202e;this[_0x8a33('0x4d')]=_0x8a33('0x89');this['description']='Fax\x20Extension';this[_0x8a33('0x65')]=_0x1b109f['id'];this[_0x8a33('0x81')]=_0x3efbba;this['appdata']=_0xc40fca;}function createExtensionsReciveFax(_0x4df01b){var _0x35a777=0x1;var _0x4e833f=[];_0x4e833f[_0x8a33('0x8a')](new Extension(_0x4df01b,_0x35a777,'',_0x8a33('0x8b')));_0x35a777+=0x1;_0x4e833f[_0x8a33('0x8a')](new Extension(_0x4df01b,_0x35a777,_0x8a33('0x8c'),_0x8a33('0x8d')));_0x35a777+=0x1;for(var _0x524d1e in _0x4df01b){if(_0x4df01b['hasOwnProperty'](_0x524d1e)&&(_0x524d1e===_0x8a33('0x8e')||_0x524d1e===_0x8a33('0x87')||_0x524d1e===_0x8a33('0x8f')||_0x524d1e===_0x8a33('0x90')||_0x524d1e==='headerinfo'||_0x524d1e===_0x8a33('0x91')||_0x524d1e===_0x8a33('0x92')||_0x524d1e==='modem'||_0x524d1e===_0x8a33('0x93'))){_0x4e833f[_0x8a33('0x8a')](new Extension(_0x4df01b,_0x35a777,'FAXOPT('+_0x524d1e+')='+_0x4df01b[_0x524d1e],_0x8a33('0x8d')));_0x35a777+=0x1;}}_0x4e833f['push'](new Extension(_0x4df01b,_0x35a777,'6',_0x8a33('0x94')));_0x35a777+=0x1;_0x4e833f[_0x8a33('0x8a')](new Extension(_0x4df01b,_0x35a777,'/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',_0x8a33('0x95')));_0x35a777=0x0;return _0x4e833f;}exports['addAccountApplications']=function(_0x27a61c,_0x3cc18b,_0x37ddb7){var _0x3ba1db;return db[_0x8a33('0x7b')][_0x8a33('0x96')](function(_0x341fae){return db[_0x8a33('0x3a')]['create'](_0x27a61c[_0x8a33('0x5a')],{'transaction':_0x341fae})[_0x8a33('0x1d')](function(_0x287f80){_0x3ba1db=_0x287f80['get']({'plain':!![]});return db[_0x8a33('0x97')][_0x8a33('0x7f')](createExtensionsReciveFax(_0x3ba1db),{'transaction':_0x341fae});});})[_0x8a33('0x1d')](function(){return _0x3ba1db;})[_0x8a33('0x1d')](respondWithResult(_0x3cc18b,null))[_0x8a33('0x25')](handleError(_0x3cc18b,null));};exports[_0x8a33('0x98')]=function(_0x56c0bf,_0x168d47,_0x4172bf){var _0x3440f1;return db[_0x8a33('0x7b')][_0x8a33('0x96')](function(_0x33867b){return db['FaxAccount']['update'](_0x56c0bf[_0x8a33('0x5a')],{'where':{'id':_0x56c0bf['body']['id']},'transaction':_0x33867b})[_0x8a33('0x1d')](function(_0x144b66){return db[_0x8a33('0x97')][_0x8a33('0x62')]({'where':{'FaxAccountId':_0x56c0bf[_0x8a33('0x5a')]['id']},'transaction':_0x33867b})['then'](function(_0x200e27){return db[_0x8a33('0x97')][_0x8a33('0x7f')](createExtensionsReciveFax(_['omit'](_0x56c0bf['body'],[_0x8a33('0x99'),_0x8a33('0x3d'),_0x8a33('0x9a'),'updatedAt','TrunkId',_0x8a33('0x9b')])),{'transaction':_0x33867b});});});})[_0x8a33('0x1d')](function(){return db[_0x8a33('0x3a')]['findById'](_0x56c0bf[_0x8a33('0x5a')]['id']);})[_0x8a33('0x1d')](respondWithResult(_0x168d47,null))[_0x8a33('0x25')](handleError(_0x168d47,null));};exports[_0x8a33('0x9c')]=function(_0x1d59ce,_0x1d1962,_0x5ddd9f){var _0x3b933b={'raw':!![],'where':{}};var _0x294e09={};var _0x107cdf={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1d59ce[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x1d1962,null))[_0x8a33('0x1d')](function(_0x3bb6d9){if(_0x3bb6d9){_0x294e09[_0x8a33('0x3e')]=_[_0x8a33('0x41')](db['FaxMessage'][_0x8a33('0x3b')]);_0x294e09[_0x8a33('0x40')]=_[_0x8a33('0x41')](_0x1d59ce[_0x8a33('0x40')]);_0x294e09[_0x8a33('0x42')]=_['intersection'](_0x294e09['model'],_0x294e09[_0x8a33('0x40')]);_0x3b933b['attributes']=_[_0x8a33('0x43')](_0x294e09[_0x8a33('0x3e')],qs['fields'](_0x1d59ce[_0x8a33('0x40')]['fields']));_0x3b933b[_0x8a33('0x45')]=_0x3b933b[_0x8a33('0x45')][_0x8a33('0x68')]?_0x3b933b['attributes']:_0x294e09[_0x8a33('0x3e')];if(!_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x46')](_0x8a33('0x47'))){_0x3b933b['limit']=qs[_0x8a33('0x48')](_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x48')]);_0x3b933b[_0x8a33('0x2a')]=qs[_0x8a33('0x2a')](_0x1d59ce[_0x8a33('0x40')]['offset']);}_0x3b933b[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0x1d59ce['query'][_0x8a33('0x4a')]);_0x3b933b[_0x8a33('0x4c')]=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0x1d59ce['query'],_0x294e09[_0x8a33('0x42')]));_0x3b933b['where'][_0x8a33('0x65')]=_0x3bb6d9['id'];if(_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x4f')]){_0x3b933b[_0x8a33('0x4c')]=_[_0x8a33('0x50')](_0x3b933b[_0x8a33('0x4c')],{'$or':_['map'](_0x3b933b[_0x8a33('0x45')],function(_0x49cc11){var _0x5c4d42={};_0x5c4d42[_0x49cc11]={'$like':'%'+_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x4f')]+'%'};return _0x5c4d42;})});}if(_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x9d')]){var _0x53093c=_0x1d59ce[_0x8a33('0x40')]['$gte'][_0x8a33('0x9e')](',');var _0xe53480={};_0xe53480[_0x53093c[0x0]]={'$gte':moment(_0x53093c[0x1])[_0x8a33('0x9f')](_0x8a33('0xa0'))};_0x3b933b[_0x8a33('0x4c')]=_[_0x8a33('0x50')](_0x3b933b[_0x8a33('0x4c')],_0xe53480);}_0x3b933b=_['merge']({},_0x3b933b,_0x1d59ce[_0x8a33('0x58')]);return db[_0x8a33('0xa1')][_0x8a33('0x2c')]({'where':_0x3b933b[_0x8a33('0x4c')]})[_0x8a33('0x1d')](function(_0x4383af){_0x107cdf[_0x8a33('0x2c')]=_0x4383af;if(_0x1d59ce[_0x8a33('0x40')][_0x8a33('0x51')]){_0x3b933b['include']=[{'all':!![]}];}return db['FaxMessage'][_0x8a33('0x52')](_0x3b933b);})[_0x8a33('0x1d')](function(_0x5db0ed){_0x107cdf[_0x8a33('0x53')]=_0x5db0ed;return _0x107cdf;});}})[_0x8a33('0x1d')](respondWithFilteredResult(_0x1d1962,_0x3b933b))[_0x8a33('0x25')](handleError(_0x1d1962,null));};exports[_0x8a33('0x37')]=function(_0x1cc2c9,_0x41b784,_0x1ebbd0){var _0x3b5ebc,_0x5f1cc0={},_0xfea25f;if(_0x1cc2c9[_0x8a33('0x5a')]['to']){_0xfea25f=_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0];}return db[_0x8a33('0x3a')][_0x8a33('0x5e')]({'where':{'id':_0x1cc2c9['params']['id']},'include':[{'model':db[_0x8a33('0xa2')],'as':'List','include':[{'model':db[_0x8a33('0x74')],'as':_0x8a33('0xa3'),'where':{'fax':_0xfea25f},'limit':0x1,'order':[['updatedAt',_0x8a33('0xa4')]]}]}]})[_0x8a33('0x1d')](handleEntityNotFound(_0x41b784,null))[_0x8a33('0x1d')](function(_0x25d29c){_0x3b5ebc=_0x25d29c;if(_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')]&&_0x1cc2c9['body'][_0x8a33('0xa5')][_0x8a33('0x68')]){for(var _0x1aeca1=0x0;_0x1aeca1<_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][_0x8a33('0x68')];_0x1aeca1+=0x1){_0x1cc2c9['body']['attachments'][_0x1aeca1]={'filename':_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][_0x1aeca1]['name'],'id':_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][_0x1aeca1]['id'],'path':path[_0x8a33('0xa6')](config['root'],'server/files/attachments',_0x1cc2c9['body'][_0x8a33('0xa5')][_0x1aeca1][_0x8a33('0xa7')])};}}return respondWithRpcPromise(_0x8a33('0xa8'),_0x8a33('0xa8'),{'FaxAccountId':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x55')]['id'])?undefined:_0x1cc2c9[_0x8a33('0x55')]['id'],'path':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0][_0x8a33('0xaa')])?undefined:_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0][_0x8a33('0xaa')],'fax':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0])?undefined:_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x3b5ebc){if(_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xab')])){_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xab')]=util['format'](_0x8a33('0xac'),_0x3b5ebc[_0x8a33('0x36')],_0x3b5ebc['fax']);}if(_0x3b5ebc[_0x8a33('0xad')]){if(_0x3b5ebc[_0x8a33('0xad')][_0x8a33('0xa3')]['length']){return _0x3b5ebc[_0x8a33('0xad')][_0x8a33('0xa3')][0x0];}else{return db['CmContact'][_0x8a33('0x59')](_[_0x8a33('0x16')](_0x1cc2c9[_0x8a33('0x5a')],{'firstName':_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0],'phone':_0x1cc2c9['body']['to'][0x0],'fax':_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0],'ListId':_0x3b5ebc['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8a33('0xae'));}})[_0x8a33('0x1d')](function(_0x1dea88){if(_0x1dea88){return db[_0x8a33('0x71')]['find']({'where':{'ContactId':_0x1dea88['id'],'closed':![],'FaxAccountId':_0x3b5ebc['id']}})[_0x8a33('0x1d')](function(_0x42c103){if(_0x42c103){return[_0x42c103,![]];}return db['FaxInteraction']['create']({'UserId':_0x1cc2c9[_0x8a33('0x5b')]['id'],'ContactId':_0x1dea88['id'],'FaxAccountId':_0x3b5ebc['id'],'fax':_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0],'firstMsgDirection':_0x8a33('0xaf'),'Messages':[_['merge'](_0x1cc2c9[_0x8a33('0x5a')],{'read':![],'body':_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0][_0x8a33('0xb0')],'FaxAccountId':_0x3b5ebc['id'],'UserId':_0x1cc2c9[_0x8a33('0x5b')]['id'],'ContactId':_0x1dea88['id'],'AttachmentId':_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x8a33('0xb1')}]})['then'](function(_0x4fad7e){return[_0x4fad7e,!![]];});});}else{throw new Error(_0x8a33('0xb2'));}})[_0x8a33('0xb3')](function(_0x418a1f,_0x518bcc){if(_0x518bcc){return _0x418a1f;}return db['FaxMessage'][_0x8a33('0x59')]({'direction':_0x8a33('0xaf'),'read':![],'body':_0x1cc2c9[_0x8a33('0x5a')]['attachments'][0x0][_0x8a33('0xb0')],'FaxAccountId':_0x3b5ebc['id'],'FaxInteractionId':_0x418a1f['id'],'UserId':_0x1cc2c9[_0x8a33('0x5b')]['id'],'ContactId':_0x418a1f[_0x8a33('0xb4')],'AttachmentId':_0x1cc2c9['body']['attachments'][0x0]['id']})['then'](function(_0x23f67f){_0x418a1f[_0x8a33('0xb5')][_0x8a33('0xb1')]=[];_0x418a1f[_0x8a33('0xb5')]['Messages'][_0x8a33('0x8a')](_0x23f67f[_0x8a33('0xb5')]);return _0x418a1f;});})['then'](function(_0x1e4e6c){respondWithRpcPromise(_0x8a33('0xb6'),_0x8a33('0xb6'),{'FaxAccountId':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x55')]['id'])?undefined:_0x1cc2c9[_0x8a33('0x55')]['id'],'path':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0][_0x8a33('0xaa')])?undefined:_0x1cc2c9[_0x8a33('0x5a')][_0x8a33('0xa5')][0x0]['path'],'fax':_[_0x8a33('0xa9')](_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0])?undefined:_0x1cc2c9[_0x8a33('0x5a')]['to'][0x0],'AttachmentId':_0x1cc2c9[_0x8a33('0x5a')]['attachments'][0x0]['id']},client9002)['then'](function(_0x4f0dea){logger[_0x8a33('0x1e')](_0x8a33('0xb7'),_0x4f0dea);})['catch'](function(_0x4e7ffa){logger[_0x8a33('0x1e')](_0x8a33('0xb7'),_0x4e7ffa);});return _0x1e4e6c;})[_0x8a33('0x1d')](respondWithResult(_0x41b784,null))[_0x8a33('0x25')](handleError(_0x41b784,null));};exports[_0x8a33('0xb8')]=function(_0x51246a,_0x4440f7,_0x3ad5a6){return db[_0x8a33('0x3a')][_0x8a33('0x5e')]({'where':{'id':_0x51246a[_0x8a33('0x55')]['id']}})[_0x8a33('0x1d')](handleEntityNotFound(_0x4440f7,null))[_0x8a33('0x1d')](function(_0x250d7e){if(_0x250d7e){return _0x250d7e[_0x8a33('0xb8')](_0x51246a[_0x8a33('0x5a')][_0x8a33('0x6a')],_['omit'](_0x51246a['body'],['ids','id'])||{})['spread'](function(_0x3a1b00){for(var _0x1fdfee=0x0;_0x1fdfee<_0x51246a[_0x8a33('0x5a')][_0x8a33('0x6a')][_0x8a33('0x68')];_0x1fdfee+=0x1){socket[_0x8a33('0xb9')](_0x8a33('0xba'),{'UserId':Number(_0x51246a[_0x8a33('0x5a')][_0x8a33('0x6a')][_0x1fdfee]),'FaxAccountId':Number(_0x51246a[_0x8a33('0x55')]['id'])});}return _0x3a1b00;});}})['then'](respondWithResult(_0x4440f7,null))[_0x8a33('0x25')](handleError(_0x4440f7,null));};exports['removeAgents']=function(_0x3b941f,_0x29ad1a,_0x4e069d){return db[_0x8a33('0x3a')][_0x8a33('0x5e')]({'where':{'id':_0x3b941f[_0x8a33('0x55')]['id']}})['then'](handleEntityNotFound(_0x29ad1a,null))[_0x8a33('0x1d')](function(_0x20605f){if(_0x20605f){return _0x20605f[_0x8a33('0xbb')](_0x3b941f['query']['ids'])[_0x8a33('0x1d')](function(){if(_[_0x8a33('0xbc')](_0x3b941f[_0x8a33('0x40')][_0x8a33('0x6a')])){for(var _0x4fcfe1=0x0;_0x4fcfe1<_0x3b941f[_0x8a33('0x40')][_0x8a33('0x6a')][_0x8a33('0x68')];_0x4fcfe1+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3b941f[_0x8a33('0x40')]['ids'][_0x4fcfe1]),'FaxAccountId':Number(_0x3b941f['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3b941f[_0x8a33('0x40')][_0x8a33('0x6a')]),'FaxAccountId':Number(_0x3b941f[_0x8a33('0x55')]['id'])});}});}})[_0x8a33('0x1d')](respondWithStatusCode(_0x29ad1a,null))[_0x8a33('0x25')](handleError(_0x29ad1a,null));};exports[_0x8a33('0xbd')]=function(_0x17ed1a,_0x2073b0,_0x3dd51f){var _0x25101f={};var _0x5eb00b={};var _0x176da4;var _0x5e7644;return db['FaxAccount']['findOne']({'where':{'id':_0x17ed1a[_0x8a33('0x55')]['id']}})['then'](handleEntityNotFound(_0x2073b0,null))[_0x8a33('0x1d')](function(_0x3cffb6){if(_0x3cffb6){_0x176da4=_0x3cffb6;_0x5eb00b[_0x8a33('0x3e')]=_['keys'](db[_0x8a33('0xbe')][_0x8a33('0x3b')]);_0x5eb00b['query']=_['keys'](_0x17ed1a[_0x8a33('0x40')]);_0x5eb00b[_0x8a33('0x42')]=_[_0x8a33('0x43')](_0x5eb00b[_0x8a33('0x3e')],_0x5eb00b[_0x8a33('0x40')]);_0x25101f[_0x8a33('0x45')]=_[_0x8a33('0x43')](_0x5eb00b[_0x8a33('0x3e')],qs[_0x8a33('0x44')](_0x17ed1a['query'][_0x8a33('0x44')]));_0x25101f['attributes']=_0x25101f['attributes'][_0x8a33('0x68')]?_0x25101f[_0x8a33('0x45')]:_0x5eb00b[_0x8a33('0x3e')];_0x25101f[_0x8a33('0x49')]=qs[_0x8a33('0x4a')](_0x17ed1a['query'][_0x8a33('0x4a')]);_0x25101f[_0x8a33('0x4c')]=qs[_0x8a33('0x42')](_[_0x8a33('0x4b')](_0x17ed1a['query'],_0x5eb00b[_0x8a33('0x42')]));if(_0x17ed1a[_0x8a33('0x40')][_0x8a33('0x4f')]){_0x25101f[_0x8a33('0x4c')]=_[_0x8a33('0x50')](_0x25101f['where'],{'$or':_[_0x8a33('0x3f')](_0x25101f[_0x8a33('0x45')],function(_0x51d284){var _0x195518={};_0x195518[_0x51d284]={'$like':'%'+_0x17ed1a[_0x8a33('0x40')][_0x8a33('0x4f')]+'%'};return _0x195518;})});}_0x25101f=_[_0x8a33('0x50')]({},_0x25101f,_0x17ed1a[_0x8a33('0x58')]);return _0x176da4['getAgents'](_0x25101f);}})[_0x8a33('0x1d')](function(_0x3ef23f){if(_0x3ef23f){_0x5e7644=_0x3ef23f['length'];if(!_0x17ed1a[_0x8a33('0x40')]['hasOwnProperty']('nolimit')){_0x25101f[_0x8a33('0x48')]=qs[_0x8a33('0x48')](_0x17ed1a[_0x8a33('0x40')][_0x8a33('0x48')]);_0x25101f[_0x8a33('0x2a')]=qs['offset'](_0x17ed1a[_0x8a33('0x40')]['offset']);}return _0x176da4[_0x8a33('0xbd')](_0x25101f);}})[_0x8a33('0x1d')](function(_0x943c90){if(_0x943c90){return _0x943c90?{'count':_0x5e7644,'rows':_0x943c90}:null;}})[_0x8a33('0x1d')](respondWithResult(_0x2073b0,null))[_0x8a33('0x25')](handleError(_0x2073b0,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9a28e45..9270864 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 _0x8917=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x8917,0xc8));var _0x7891=function(_0x41c387,_0x5816ba){_0x41c387=_0x41c387-0x0;var _0x114fb6=_0x8917[_0x41c387];return _0x114fb6;};'use strict';var EventEmitter=require(_0x7891('0x0'));var FaxAccount=require(_0x7891('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7891('0x2'),'afterUpdate':_0x7891('0x3'),'afterDestroy':_0x7891('0x4')};function emitEvent(_0xdfcc8c){return function(_0x74ae4d,_0x5db3f4,_0xc163aa){FaxAccountEvents[_0x7891('0x5')](_0xdfcc8c+':'+_0x74ae4d['id'],_0x74ae4d);FaxAccountEvents[_0x7891('0x5')](_0xdfcc8c,_0x74ae4d);_0xc163aa(null);};}for(var e in events){if(events[_0x7891('0x6')](e)){var event=events[e];FaxAccount[_0x7891('0x7')](e,emitEvent(event));}}module[_0x7891('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xdcda=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x910da6,_0x114f2f){var _0x51feba=function(_0x345524){while(--_0x345524){_0x910da6['push'](_0x910da6['shift']());}};_0x51feba(++_0x114f2f);}(_0xdcda,0xa3));var _0xadcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcda[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xadcd('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xadcd('0x1')](0x0);var events={'afterCreate':_0xadcd('0x2'),'afterUpdate':_0xadcd('0x3'),'afterDestroy':_0xadcd('0x4')};function emitEvent(_0x3d5a83){return function(_0x13d12f,_0x2a37f0,_0xa8e289){FaxAccountEvents[_0xadcd('0x5')](_0x3d5a83+':'+_0x13d12f['id'],_0x13d12f);FaxAccountEvents[_0xadcd('0x5')](_0x3d5a83,_0x13d12f);_0xa8e289(null);};}for(var e in events){if(events[_0xadcd('0x6')](e)){var event=events[e];FaxAccount[_0xadcd('0x7')](e,emitEvent(event));}}module[_0xadcd('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a6b30e1..f1ee877 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 _0x59af=['define','fax_accounts','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./faxAccount.attributes','exports'];(function(_0x2880ee,_0x2e2650){var _0x10f264=function(_0x532937){while(--_0x532937){_0x2880ee['push'](_0x2880ee['shift']());}};_0x10f264(++_0x2e2650);}(_0x59af,0x12e));var _0xf59a=function(_0x218f0c,_0x209467){_0x218f0c=_0x218f0c-0x0;var _0x24e888=_0x59af[_0x218f0c];return _0x24e888;};'use strict';var _=require(_0xf59a('0x0'));var util=require('util');var logger=require(_0xf59a('0x1'))('api');var moment=require(_0xf59a('0x2'));var BPromise=require(_0xf59a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf59a('0x4'));var rimraf=require('rimraf');var config=require(_0xf59a('0x5'));var attributes=require(_0xf59a('0x6'));module[_0xf59a('0x7')]=function(_0x35ccb6,_0x3e53c4){return _0x35ccb6[_0xf59a('0x8')]('FaxAccount',attributes,{'tableName':_0xf59a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c06=['../../config/environment','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c06,0xa4));var _0x62c0=function(_0x33c436,_0x55b523){_0x33c436=_0x33c436-0x0;var _0x3a9409=_0x2c06[_0x33c436];return _0x3a9409;};'use strict';var _=require(_0x62c0('0x0'));var util=require('util');var logger=require(_0x62c0('0x1'))('api');var moment=require(_0x62c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x62c0('0x3'));var fs=require('fs');var path=require(_0x62c0('0x4'));var rimraf=require(_0x62c0('0x5'));var config=require(_0x62c0('0x6'));var attributes=require(_0x62c0('0x7'));module['exports']=function(_0x2f9861,_0x1b5fea){return _0x2f9861['define'](_0x62c0('0x8'),attributes,{'tableName':_0x62c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index e4d5b5b..1f6cb2d 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 _0x4a5d=['unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','startRouting','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxAccount','options','raw','attributes','include','map','model','GetFaxAccount','body','fax','CmContact','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','Contacts','DESC','get','Applications','applications','orderBy','priority','asc','length','create','FaxInteraction','spread','push','close'];(function(_0x416f87,_0x42b830){var _0x2bb8d7=function(_0x1aa5a8){while(--_0x1aa5a8){_0x416f87['push'](_0x416f87['shift']());}};_0x2bb8d7(++_0x42b830);}(_0x4a5d,0x164));var _0xd4a5=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0x4a5d[_0x537c37];return _0x241f84;};'use strict';var _=require('lodash');var util=require(_0xd4a5('0x0'));var moment=require(_0xd4a5('0x1'));var BPromise=require(_0xd4a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4a5('0x4'))(_0xd4a5('0x5'));var config=require(_0xd4a5('0x6'));var jayson=require(_0xd4a5('0x7'));var client=jayson[_0xd4a5('0x8')][_0xd4a5('0x9')]({'port':0x232c});config['redis']=_[_0xd4a5('0xa')](config[_0xd4a5('0xb')],{'host':_0xd4a5('0xc'),'port':0x18eb});var socket=require(_0xd4a5('0xd'))(new Redis(config[_0xd4a5('0xb')]));require('./faxAccount.socket')[_0xd4a5('0xe')](socket);function respondWithRpcPromise(_0x5c7da6,_0x371952,_0x416d8e){return new BPromise(function(_0x2a5df5,_0x64d677){return client['request'](_0x5c7da6,_0x416d8e)['then'](function(_0x4346aa){logger['info'](_0xd4a5('0xf'),_0x371952,_0xd4a5('0x10'));logger[_0xd4a5('0x11')](_0xd4a5('0x12'),_0x371952,_0xd4a5('0x10'),JSON['stringify'](_0x4346aa));if(_0x4346aa[_0xd4a5('0x13')]){if(_0x4346aa[_0xd4a5('0x13')][_0xd4a5('0x14')]===0x1f4){logger[_0xd4a5('0x13')](_0xd4a5('0xf'),_0x371952,_0x4346aa[_0xd4a5('0x13')][_0xd4a5('0x15')]);return _0x64d677(_0x4346aa['error'][_0xd4a5('0x15')]);}logger['error'](_0xd4a5('0xf'),_0x371952,_0x4346aa[_0xd4a5('0x13')]['message']);return _0x2a5df5(_0x4346aa['error'][_0xd4a5('0x15')]);}else{logger[_0xd4a5('0x16')]('FaxAccount,\x20%s,\x20%s',_0x371952,_0xd4a5('0x10'));_0x2a5df5(_0x4346aa[_0xd4a5('0x17')][_0xd4a5('0x15')]);}})[_0xd4a5('0x18')](function(_0x36b13a){logger['error'](_0xd4a5('0xf'),_0x371952,_0x36b13a);_0x64d677(_0x36b13a);});});}exports['GetFaxAccount']=function(_0x511cb4){var _0x343c6e=this;return new Promise(function(_0x4eaf7d,_0xad2d7d){return db[_0xd4a5('0x19')]['findAll']({'raw':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4['options'][_0xd4a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')]['where']||null:null,'attributes':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')][_0xd4a5('0x1c')]||null:null,'limit':_0x511cb4['options']?_0x511cb4[_0xd4a5('0x1a')]['limit']||null:null,'include':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')][_0xd4a5('0x1d')]?_[_0xd4a5('0x1e')](_0x511cb4[_0xd4a5('0x1a')]['include'],function(_0x479f27){return{'model':db[_0x479f27[_0xd4a5('0x1f')]],'as':_0x479f27['as'],'attributes':_0x479f27[_0xd4a5('0x1c')],'include':_0x479f27['include']?_['map'](_0x479f27[_0xd4a5('0x1d')],function(_0x23d593){return{'model':db[_0x23d593[_0xd4a5('0x1f')]],'as':_0x23d593['as'],'attributes':_0x23d593['attributes'],'include':_0x23d593[_0xd4a5('0x1d')]?_[_0xd4a5('0x1e')](_0x23d593['include'],function(_0x1b6335){return{'model':db[_0x1b6335[_0xd4a5('0x1f')]],'as':_0x1b6335['as'],'attributes':_0x1b6335[_0xd4a5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4ba0){logger[_0xd4a5('0x16')](_0xd4a5('0x20'),_0x511cb4);logger[_0xd4a5('0x11')](_0xd4a5('0x20'),_0x511cb4,JSON['stringify'](_0x3f4ba0));_0x4eaf7d(_0x3f4ba0);})[_0xd4a5('0x18')](function(_0x5a70ce){logger[_0xd4a5('0x13')](_0xd4a5('0x20'),_0x5a70ce[_0xd4a5('0x15')],_0x511cb4);_0xad2d7d(_0x343c6e['error'](0x1f4,_0x5a70ce[_0xd4a5('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x116620,_0x1c999e,_0x55cefd){var _0x16f685=this;return new Promise(function(_0x50df6c,_0x4c8e56){var _0x4e49e1={'body':_0x116620[_0xd4a5('0x21')],'channel':_0xd4a5('0x22')};var _0x10c587=[];var _0x4746b4=[];var _0x3042bc={};return db[_0xd4a5('0x23')]['describe']()[_0xd4a5('0x24')](function(_0x1e1ec9){if(!_0x1e1ec9){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))](_0xd4a5('0x27'));}_0x10c587=_[_0xd4a5('0x28')](_[_0xd4a5('0x29')](_0x1e1ec9),[_0xd4a5('0x2a'),_0xd4a5('0x2b')]);_0x4746b4=_[_0xd4a5('0x28')](_[_0xd4a5('0x29')](_0x1e1ec9),[_0xd4a5('0x2a'),_0xd4a5('0x2b'),'CompanyId',_0xd4a5('0x2c')]);if(_0x116620[_0xd4a5('0x21')]['id']){delete _0x116620[_0xd4a5('0x21')]['id'];}if(_[_0xd4a5('0x2d')](_0x116620[_0xd4a5('0x21')]['from'])){throw new db[(_0xd4a5('0x25'))]['ValidationError'](_0xd4a5('0x2e'));}if(_['isNil'](_0x116620[_0xd4a5('0x21')]['body'])||_0x116620[_0xd4a5('0x21')][_0xd4a5('0x21')]===''){throw new db['Sequelize']['ValidationError'](_0xd4a5('0x2f'));}if(_['isNil'](_0x116620[_0xd4a5('0x21')]['mapKey'])){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4746b4);}if(!_[_0xd4a5('0x30')](_0x4746b4,_0x116620['body'][_0xd4a5('0x31')])){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))](_0xd4a5('0x32')+_0x4746b4);}_0x3042bc[_0x116620[_0xd4a5('0x21')][_0xd4a5('0x31')]]=_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')];})[_0xd4a5('0x24')](function(){return db[_0xd4a5('0x19')][_0xd4a5('0x34')]({'where':{'id':_0x116620[_0xd4a5('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0xd4a5('0x36'),'include':[{'model':db[_0xd4a5('0x23')],'as':_0xd4a5('0x37'),'where':_0x3042bc,'limit':0x1,'order':[['updatedAt',_0xd4a5('0x38')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xd4a5('0x24')](function(_0x34ada0){if(_0x34ada0&&_0x34ada0[_0xd4a5('0x36')]){var _0x558500=_0x34ada0[_0xd4a5('0x39')]({'plain':!![]});_0x4e49e1[_0xd4a5('0x35')]=_0x558500;_0x4e49e1['applications']=_0x558500[_0xd4a5('0x3a')];_0x4e49e1['list']=_0x558500[_0xd4a5('0x36')];_0x4e49e1[_0xd4a5('0x3b')]=_[_0xd4a5('0x3c')](_0x4e49e1[_0xd4a5('0x3b')],[_0xd4a5('0x3d')],[_0xd4a5('0x3e')]);if(_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x3a')]){delete _0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x3a')];}if(_0x4e49e1[_0xd4a5('0x35')]['List']&&_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x36')][_0xd4a5('0x37')][_0xd4a5('0x3f')]){return _0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x36')][_0xd4a5('0x37')][0x0];}var _0x3bfb4b=_['defaults'](_0x116620[_0xd4a5('0x21')],{'firstName':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')],'ListId':_0x558500['ListId']});_0x3bfb4b[_0x116620[_0xd4a5('0x21')][_0xd4a5('0x31')]]=_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')];return db['CmContact'][_0xd4a5('0x40')](_0x3bfb4b,{'fields':_0x10c587,'raw':!![]});}})[_0xd4a5('0x24')](function(_0xc9a78c){_0x4e49e1['contact']=_0xc9a78c;if(_0xc9a78c){var _0x4d949c={'ContactId':_0xc9a78c['id'],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id'],'fax':_0xc9a78c[_0xd4a5('0x22')]};return db[_0xd4a5('0x41')][_0xd4a5('0x34')]({'where':{'ContactId':_0xc9a78c['id'],'closed':![],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id']}})['then'](function(_0x36a162){if(_0x36a162){return[_0x36a162,![]];}return db[_0xd4a5('0x41')]['create'](_0x4d949c)[_0xd4a5('0x24')](function(_0x54e12d){return[_0x54e12d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd4a5('0x42')](function(_0x3a8235,_0x18117c){var _0x2bcade=_0x3a8235[_0xd4a5('0x39')]({'plain':!![]});if(_0x18117c){if(_0x4e49e1[_0xd4a5('0x35')]['autoclose']){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x43')]({'id':0x0,'priority':_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x3f')]+0x1,'app':_0xd4a5('0x44'),'appdata':_0xd4a5('0x45'),'interval':_0xd4a5('0x46')});}_0x2bcade['created']=!![];}else{_0x2bcade[_0xd4a5('0x47')]=![];}_0x4e49e1[_0xd4a5('0x48')]=_0x2bcade;return db[_0xd4a5('0x49')][_0xd4a5('0x40')]({'body':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x21')],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id'],'FaxInteractionId':_0x3a8235['id'],'direction':'in','ContactId':_0x3a8235[_0xd4a5('0x4a')],'AttachmentId':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x4b')]});})[_0xd4a5('0x24')](function(_0x1849ba){_0x4e49e1[_0xd4a5('0x15')]=_0x1849ba;if(!_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x4c')])return;return db[_0xd4a5('0x4d')][_0xd4a5('0x34')]({'attributes':['id',_0xd4a5('0x4e')],'where':{'id':_0x4e49e1[_0xd4a5('0x48')]['UserId']}});})[_0xd4a5('0x24')](function(_0x3cad0a){if(_0x3cad0a){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x4f')]({'id':0x0,'priority':0x0,'app':_0xd4a5('0x50'),'appdata':_0x3cad0a[_0xd4a5('0x4e')]+','+(_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x51')]||0xa),'interval':_0xd4a5('0x46')});}if(!_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x52')])return;return db['FaxQueue'][_0xd4a5('0x34')]({'attributes':['id',_0xd4a5('0x4e')],'where':{'id':_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x52')]}});})[_0xd4a5('0x24')](function(_0x277a97){if(_0x277a97){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x4f')]({'id':0x0,'priority':0x1,'app':_0xd4a5('0x53'),'appdata':_0x277a97[_0xd4a5('0x4e')]+','+(_0x4e49e1[_0xd4a5('0x35')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd4a5('0x54'),_0x4e49e1);})[_0xd4a5('0x24')](function(_0x1e5a60){_0x50df6c(_0x1e5a60);})['catch'](function(_0x3b2f4c){_0x4c8e56(_0x16f685[_0xd4a5('0x13')](0x1f4,_0x3b2f4c[_0xd4a5('0x15')]));});});}; \ No newline at end of file +var _0xd373=['../../config/environment','defaults','redis','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','map','include','model','debug','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','DESC','Applications','applications','orderBy','priority','asc','length','Contacts','from','contact','FaxInteraction','find','create','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','name','agent','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','waitForTheAssignedQueue','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xe810e1,_0x3b209b){var _0x167f63=function(_0x2bca99){while(--_0x2bca99){_0xe810e1['push'](_0xe810e1['shift']());}};_0x167f63(++_0x3b209b);}(_0xd373,0xac));var _0x3d37=function(_0x489569,_0x3a07bb){_0x489569=_0x489569-0x0;var _0x831eb7=_0xd373[_0x489569];return _0x831eb7;};'use strict';var _=require(_0x3d37('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3d37('0x1'));var rs=require(_0x3d37('0x2'));var fs=require('fs');var Redis=require(_0x3d37('0x3'));var db=require(_0x3d37('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d37('0x5'))('rpc');var config=require(_0x3d37('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x3d37('0x7')](config[_0x3d37('0x8')],{'host':_0x3d37('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d37('0x8')]));require(_0x3d37('0xa'))[_0x3d37('0xb')](socket);function respondWithRpcPromise(_0xabe7a0,_0x3efe60,_0x56ad90){return new BPromise(function(_0x484560,_0x2e4166){return client[_0x3d37('0xc')](_0xabe7a0,_0x56ad90)[_0x3d37('0xd')](function(_0x18079e){logger[_0x3d37('0xe')]('FaxAccount,\x20%s,\x20%s',_0x3efe60,'request\x20sent');logger['debug'](_0x3d37('0xf'),_0x3efe60,_0x3d37('0x10'),JSON[_0x3d37('0x11')](_0x18079e));if(_0x18079e[_0x3d37('0x12')]){if(_0x18079e['error']['code']===0x1f4){logger[_0x3d37('0x12')](_0x3d37('0x13'),_0x3efe60,_0x18079e[_0x3d37('0x12')][_0x3d37('0x14')]);return _0x2e4166(_0x18079e[_0x3d37('0x12')][_0x3d37('0x14')]);}logger[_0x3d37('0x12')]('FaxAccount,\x20%s,\x20%s',_0x3efe60,_0x18079e[_0x3d37('0x12')][_0x3d37('0x14')]);return _0x484560(_0x18079e['error']['message']);}else{logger[_0x3d37('0xe')](_0x3d37('0x13'),_0x3efe60,_0x3d37('0x10'));_0x484560(_0x18079e[_0x3d37('0x15')][_0x3d37('0x14')]);}})[_0x3d37('0x16')](function(_0x56d6e5){logger['error'](_0x3d37('0x13'),_0x3efe60,_0x56d6e5);_0x2e4166(_0x56d6e5);});});}exports[_0x3d37('0x17')]=function(_0xdc4f00){var _0x24536e=this;return new Promise(function(_0x4f89f2,_0x262caa){return db[_0x3d37('0x18')][_0x3d37('0x19')]({'raw':_0xdc4f00[_0x3d37('0x1a')]?_0xdc4f00[_0x3d37('0x1a')][_0x3d37('0x1b')]===undefined?!![]:![]:!![],'where':_0xdc4f00[_0x3d37('0x1a')]?_0xdc4f00['options'][_0x3d37('0x1c')]||null:null,'attributes':_0xdc4f00[_0x3d37('0x1a')]?_0xdc4f00['options'][_0x3d37('0x1d')]||null:null,'limit':_0xdc4f00[_0x3d37('0x1a')]?_0xdc4f00[_0x3d37('0x1a')]['limit']||null:null,'include':_0xdc4f00[_0x3d37('0x1a')]?_0xdc4f00[_0x3d37('0x1a')]['include']?_[_0x3d37('0x1e')](_0xdc4f00[_0x3d37('0x1a')][_0x3d37('0x1f')],function(_0x2308fe){return{'model':db[_0x2308fe[_0x3d37('0x20')]],'as':_0x2308fe['as'],'attributes':_0x2308fe[_0x3d37('0x1d')],'include':_0x2308fe['include']?_['map'](_0x2308fe[_0x3d37('0x1f')],function(_0x114c9b){return{'model':db[_0x114c9b['model']],'as':_0x114c9b['as'],'attributes':_0x114c9b[_0x3d37('0x1d')],'include':_0x114c9b[_0x3d37('0x1f')]?_['map'](_0x114c9b[_0x3d37('0x1f')],function(_0x4f5dde){return{'model':db[_0x4f5dde[_0x3d37('0x20')]],'as':_0x4f5dde['as'],'attributes':_0x4f5dde[_0x3d37('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d37('0xd')](function(_0x1b9e88){logger[_0x3d37('0xe')](_0x3d37('0x17'),_0xdc4f00);logger[_0x3d37('0x21')](_0x3d37('0x17'),_0xdc4f00,JSON['stringify'](_0x1b9e88));_0x4f89f2(_0x1b9e88);})[_0x3d37('0x16')](function(_0xf80b4e){logger[_0x3d37('0x12')](_0x3d37('0x17'),_0xf80b4e[_0x3d37('0x14')],_0xdc4f00);_0x262caa(_0x24536e[_0x3d37('0x12')](0x1f4,_0xf80b4e[_0x3d37('0x14')]));});});};exports[_0x3d37('0x22')]=function(_0x5b2190,_0x3d43d9,_0x1555b5){var _0x4eeb97=this;return new Promise(function(_0x337b65,_0x295156){var _0x14cf04={'body':_0x5b2190[_0x3d37('0x23')],'channel':_0x3d37('0x24')};var _0x299843=[];var _0x3ee1b9=[];var _0xb7c854={};return db[_0x3d37('0x25')][_0x3d37('0x26')]()['then'](function(_0x6c6462){if(!_0x6c6462){throw new db[(_0x3d37('0x27'))][(_0x3d37('0x28'))]('no\x20available\x20attributes');}_0x299843=_[_0x3d37('0x29')](_[_0x3d37('0x2a')](_0x6c6462),[_0x3d37('0x2b'),_0x3d37('0x2c')]);_0x3ee1b9=_[_0x3d37('0x29')](_[_0x3d37('0x2a')](_0x6c6462),[_0x3d37('0x2b'),'updatedAt',_0x3d37('0x2d'),_0x3d37('0x2e')]);if(_0x5b2190[_0x3d37('0x23')]['id']){delete _0x5b2190[_0x3d37('0x23')]['id'];}if(_[_0x3d37('0x2f')](_0x5b2190[_0x3d37('0x23')]['from'])){throw new db[(_0x3d37('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x5b2190[_0x3d37('0x23')][_0x3d37('0x23')])||_0x5b2190[_0x3d37('0x23')]['body']===''){throw new db[(_0x3d37('0x27'))][(_0x3d37('0x28'))](_0x3d37('0x30'));}if(_[_0x3d37('0x2f')](_0x5b2190[_0x3d37('0x23')][_0x3d37('0x31')])){throw new db[(_0x3d37('0x27'))][(_0x3d37('0x28'))](_0x3d37('0x32')+_0x3ee1b9);}if(!_[_0x3d37('0x33')](_0x3ee1b9,_0x5b2190[_0x3d37('0x23')]['mapKey'])){throw new db[(_0x3d37('0x27'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ee1b9);}_0xb7c854[_0x5b2190['body'][_0x3d37('0x31')]]=_0x5b2190[_0x3d37('0x23')]['from'];})[_0x3d37('0xd')](function(){return db[_0x3d37('0x18')]['find']({'where':{'id':_0x5b2190[_0x3d37('0x34')]['id']},'include':[{'model':db[_0x3d37('0x35')],'as':_0x3d37('0x36'),'include':[{'model':db[_0x3d37('0x25')],'as':'Contacts','where':_0xb7c854,'limit':0x1,'order':[[_0x3d37('0x2c'),_0x3d37('0x37')]]}]},{'model':db['FaxApplication'],'as':_0x3d37('0x38')}]});})['then'](function(_0x56e7f5){if(_0x56e7f5&&_0x56e7f5[_0x3d37('0x36')]){var _0x34756e=_0x56e7f5['get']({'plain':!![]});_0x14cf04[_0x3d37('0x34')]=_0x34756e;_0x14cf04[_0x3d37('0x39')]=_0x34756e[_0x3d37('0x38')];_0x14cf04['list']=_0x34756e['List'];_0x14cf04[_0x3d37('0x39')]=_[_0x3d37('0x3a')](_0x14cf04[_0x3d37('0x39')],[_0x3d37('0x3b')],[_0x3d37('0x3c')]);if(_0x14cf04[_0x3d37('0x34')]['Applications']){delete _0x14cf04['account'][_0x3d37('0x38')];}if(_0x14cf04[_0x3d37('0x34')]['List']&&_0x14cf04[_0x3d37('0x34')][_0x3d37('0x36')]['Contacts'][_0x3d37('0x3d')]){return _0x14cf04[_0x3d37('0x34')][_0x3d37('0x36')][_0x3d37('0x3e')][0x0];}var _0x9bc2b6=_[_0x3d37('0x7')](_0x5b2190[_0x3d37('0x23')],{'firstName':_0x5b2190[_0x3d37('0x23')][_0x3d37('0x3f')],'ListId':_0x34756e[_0x3d37('0x2e')]});_0x9bc2b6[_0x5b2190['body']['mapKey']]=_0x5b2190[_0x3d37('0x23')][_0x3d37('0x3f')];return db['CmContact']['create'](_0x9bc2b6,{'fields':_0x299843,'raw':!![]});}})[_0x3d37('0xd')](function(_0x283c52){_0x14cf04[_0x3d37('0x40')]=_0x283c52;if(_0x283c52){var _0x421445={'ContactId':_0x283c52['id'],'FaxAccountId':_0x5b2190[_0x3d37('0x34')]['id'],'fax':_0x283c52[_0x3d37('0x24')]};return db[_0x3d37('0x41')][_0x3d37('0x42')]({'where':{'ContactId':_0x283c52['id'],'closed':![],'FaxAccountId':_0x5b2190['account']['id']}})[_0x3d37('0xd')](function(_0x9e99fa){if(_0x9e99fa){return[_0x9e99fa,![]];}return db['FaxInteraction'][_0x3d37('0x43')](_0x421445)[_0x3d37('0xd')](function(_0x30aa4c){return[_0x30aa4c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d37('0x44')](function(_0x1cd5a8,_0x3263c8){var _0x5004fb=_0x1cd5a8[_0x3d37('0x45')]({'plain':!![]});if(_0x3263c8){if(_0x14cf04['account'][_0x3d37('0x46')]){_0x14cf04[_0x3d37('0x39')][_0x3d37('0x47')]({'id':0x0,'priority':_0x14cf04[_0x3d37('0x39')][_0x3d37('0x3d')]+0x1,'app':_0x3d37('0x48'),'appdata':_0x3d37('0x49'),'interval':_0x3d37('0x4a')});}_0x5004fb['created']=!![];}else{_0x5004fb[_0x3d37('0x4b')]=![];}_0x14cf04[_0x3d37('0x4c')]=_0x5004fb;return db[_0x3d37('0x4d')][_0x3d37('0x43')]({'body':_0x5b2190[_0x3d37('0x23')][_0x3d37('0x23')],'FaxAccountId':_0x5b2190[_0x3d37('0x34')]['id'],'FaxInteractionId':_0x1cd5a8['id'],'direction':'in','ContactId':_0x1cd5a8[_0x3d37('0x4e')],'AttachmentId':_0x5b2190[_0x3d37('0x23')]['AttachmentId']});})[_0x3d37('0xd')](function(_0x583dac){_0x14cf04[_0x3d37('0x14')]=_0x583dac;if(!_0x14cf04['interaction'][_0x3d37('0x4f')])return;return db['User'][_0x3d37('0x42')]({'attributes':['id',_0x3d37('0x50')],'where':{'id':_0x14cf04[_0x3d37('0x4c')][_0x3d37('0x4f')]}});})['then'](function(_0x1f43fc){if(_0x1f43fc){_0x14cf04['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3d37('0x51'),'appdata':_0x1f43fc[_0x3d37('0x50')]+','+(_0x14cf04[_0x3d37('0x34')][_0x3d37('0x52')]||0xa),'interval':_0x3d37('0x4a')});}if(!_0x14cf04[_0x3d37('0x4c')][_0x3d37('0x53')])return;return db[_0x3d37('0x54')][_0x3d37('0x42')]({'attributes':['id',_0x3d37('0x50')],'where':{'id':_0x14cf04[_0x3d37('0x4c')][_0x3d37('0x53')]}});})[_0x3d37('0xd')](function(_0x2cf3f2){if(_0x2cf3f2){_0x14cf04['applications'][_0x3d37('0x55')]({'id':0x0,'priority':0x1,'app':_0x3d37('0x56'),'appdata':_0x2cf3f2[_0x3d37('0x50')]+','+(_0x14cf04['account'][_0x3d37('0x57')]||0x12c),'interval':_0x3d37('0x4a')});}return respondWithRpcPromise('Start',_0x3d37('0x58'),_0x14cf04);})[_0x3d37('0xd')](function(_0x4520ab){_0x337b65(_0x4520ab);})[_0x3d37('0x16')](function(_0x3edb04){_0x295156(_0x4eeb97[_0x3d37('0x12')](0x1f4,_0x3edb04[_0x3d37('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ea5a7e8..81dc1e1 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 _0xb806=['remove','update','emit','removeListener','register','length','./faxAccount.events','save'];(function(_0x485ba3,_0x333f48){var _0x344ab2=function(_0x4efcc5){while(--_0x4efcc5){_0x485ba3['push'](_0x485ba3['shift']());}};_0x344ab2(++_0x333f48);}(_0xb806,0x96));var _0x6b80=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xb806[_0x2642cb];return _0xe6e41;};'use strict';var FaxAccountEvents=require(_0x6b80('0x0'));var events=[_0x6b80('0x1'),_0x6b80('0x2'),_0x6b80('0x3')];function createListener(_0x7bb8de,_0x2cedf1){return function(_0xf04494){_0x2cedf1[_0x6b80('0x4')](_0x7bb8de,_0xf04494);};}function removeListener(_0x4ca530,_0x1f4568){return function(){FaxAccountEvents[_0x6b80('0x5')](_0x4ca530,_0x1f4568);};}exports[_0x6b80('0x6')]=function(_0x3b6d82){for(var _0x2a3b85=0x0,_0x10b6e9=events[_0x6b80('0x7')];_0x2a3b85<_0x10b6e9;_0x2a3b85++){var _0x3076cd=events[_0x2a3b85];var _0xfac7ff=createListener('faxAccount:'+_0x3076cd,_0x3b6d82);FaxAccountEvents['on'](_0x3076cd,_0xfac7ff);}}; \ No newline at end of file +var _0x6ba6=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x6ba6,0x91));var _0x66ba=function(_0x388721,_0x36c47b){_0x388721=_0x388721-0x0;var _0x4a6dbc=_0x6ba6[_0x388721];return _0x4a6dbc;};'use strict';var FaxAccountEvents=require(_0x66ba('0x0'));var events=[_0x66ba('0x1'),_0x66ba('0x2'),_0x66ba('0x3')];function createListener(_0x172435,_0x14a6cb){return function(_0x4678cd){_0x14a6cb[_0x66ba('0x4')](_0x172435,_0x4678cd);};}function removeListener(_0xd0bb35,_0x897575){return function(){FaxAccountEvents[_0x66ba('0x5')](_0xd0bb35,_0x897575);};}exports[_0x66ba('0x6')]=function(_0x2458a4){for(var _0x53e236=0x0,_0x51f4b1=events[_0x66ba('0x7')];_0x53e236<_0x51f4b1;_0x53e236++){var _0x88324d=events[_0x53e236];var _0x1a1438=createListener(_0x66ba('0x8')+_0x88324d,_0x2458a4);FaxAccountEvents['on'](_0x88324d,_0x1a1438);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2d1a675..ef1fcac 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 _0xd512=['getMessages','/:id/users','getAgents','post','addAnswer','/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages'];(function(_0x23b41b,_0x28e66e){var _0x40c253=function(_0x58477e){while(--_0x58477e){_0x23b41b['push'](_0x23b41b['shift']());}};_0x40c253(++_0x28e66e);}(_0xd512,0x102));var _0x2d51=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xd512[_0x1d0aee];return _0x34ee2c;};'use strict';var multer=require(_0x2d51('0x0'));var util=require(_0x2d51('0x1'));var path=require(_0x2d51('0x2'));var timeout=require(_0x2d51('0x3'));var express=require(_0x2d51('0x4'));var router=express[_0x2d51('0x5')]();var fs_extra=require(_0x2d51('0x6'));var auth=require(_0x2d51('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2d51('0x8'));var controller=require('./faxAccount.controller');router[_0x2d51('0x9')]('/',auth[_0x2d51('0xa')](),controller['index']);router[_0x2d51('0x9')](_0x2d51('0xb'),auth[_0x2d51('0xa')](),controller[_0x2d51('0xc')]);router[_0x2d51('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2d51('0xd')]);router[_0x2d51('0x9')](_0x2d51('0xe'),auth[_0x2d51('0xa')](),controller[_0x2d51('0xf')]);router[_0x2d51('0x9')](_0x2d51('0x10'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x11')]);router[_0x2d51('0x9')]('/:id/interactions',auth[_0x2d51('0xa')](),controller[_0x2d51('0x12')]);router[_0x2d51('0x9')](_0x2d51('0x13'),auth['isAuthenticated'](),controller[_0x2d51('0x14')]);router['get'](_0x2d51('0x15'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x16')]);router[_0x2d51('0x9')](_0x2d51('0x17'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x18')]);router[_0x2d51('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2d51('0xe'),auth[_0x2d51('0xa')](),controller['addDisposition']);router[_0x2d51('0x19')]('/:id/canned_answers',auth[_0x2d51('0xa')](),controller[_0x2d51('0x1a')]);router[_0x2d51('0x19')](_0x2d51('0x1b'),auth[_0x2d51('0xa')](),controller['addInteraction']);router[_0x2d51('0x19')](_0x2d51('0x13'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x1c')]);router[_0x2d51('0x19')](_0x2d51('0x1d'),auth['isAuthenticated'](),controller[_0x2d51('0x1e')]);router[_0x2d51('0x19')](_0x2d51('0x1f'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x20')]);router[_0x2d51('0x19')](_0x2d51('0x21'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x22')]);router[_0x2d51('0x19')](_0x2d51('0x17'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x2d51('0x23'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x24')]);router['delete']('/:id',auth[_0x2d51('0xa')](),controller['destroy']);router[_0x2d51('0x25')](_0x2d51('0xe'),auth['isAuthenticated'](),controller[_0x2d51('0x26')]);router[_0x2d51('0x25')](_0x2d51('0x10'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x27')]);router[_0x2d51('0x25')](_0x2d51('0x17'),auth[_0x2d51('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2cb5=['isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','getAgents','post','create','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/users','addAgents','update','destroy','delete','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x5dee75,_0x55ca86){var _0x13736a=function(_0x4892f1){while(--_0x4892f1){_0x5dee75['push'](_0x5dee75['shift']());}};_0x13736a(++_0x55ca86);}(_0x2cb5,0x14e));var _0x52cb=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x2cb5[_0x4aac5a];return _0x42e7bc;};'use strict';var multer=require(_0x52cb('0x0'));var util=require(_0x52cb('0x1'));var path=require('path');var timeout=require(_0x52cb('0x2'));var express=require(_0x52cb('0x3'));var router=express[_0x52cb('0x4')]();var fs_extra=require(_0x52cb('0x5'));var auth=require(_0x52cb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x52cb('0x7')]('/',auth[_0x52cb('0x8')](),controller[_0x52cb('0x9')]);router['get']('/describe',auth[_0x52cb('0x8')](),controller[_0x52cb('0xa')]);router[_0x52cb('0x7')](_0x52cb('0xb'),auth[_0x52cb('0x8')](),controller[_0x52cb('0xc')]);router[_0x52cb('0x7')](_0x52cb('0xd'),auth[_0x52cb('0x8')](),controller[_0x52cb('0xe')]);router[_0x52cb('0x7')]('/:id/canned_answers',auth[_0x52cb('0x8')](),controller[_0x52cb('0xf')]);router['get'](_0x52cb('0x10'),auth[_0x52cb('0x8')](),controller['getInteractions']);router[_0x52cb('0x7')](_0x52cb('0x11'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x12')]);router[_0x52cb('0x7')]('/:id/messages',auth[_0x52cb('0x8')](),controller[_0x52cb('0x13')]);router[_0x52cb('0x7')]('/:id/users',auth[_0x52cb('0x8')](),controller[_0x52cb('0x14')]);router[_0x52cb('0x15')]('/',auth[_0x52cb('0x8')](),controller[_0x52cb('0x16')]);router[_0x52cb('0x15')](_0x52cb('0xd'),auth[_0x52cb('0x8')](),controller['addDisposition']);router[_0x52cb('0x15')](_0x52cb('0x17'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x18')]);router[_0x52cb('0x15')](_0x52cb('0x10'),auth['isAuthenticated'](),controller[_0x52cb('0x19')]);router[_0x52cb('0x15')](_0x52cb('0x11'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x1a')]);router[_0x52cb('0x15')](_0x52cb('0x1b'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x1c')]);router[_0x52cb('0x15')](_0x52cb('0x1d'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x1e')]);router[_0x52cb('0x15')]('/:id/send',auth[_0x52cb('0x8')](),controller['send']);router[_0x52cb('0x15')](_0x52cb('0x1f'),auth['isAuthenticated'](),controller[_0x52cb('0x20')]);router['put'](_0x52cb('0xb'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x21')]);router['delete'](_0x52cb('0xb'),auth[_0x52cb('0x8')](),controller[_0x52cb('0x22')]);router[_0x52cb('0x23')](_0x52cb('0xd'),auth[_0x52cb('0x8')](),controller['removeDispositions']);router[_0x52cb('0x23')](_0x52cb('0x17'),auth['isAuthenticated'](),controller[_0x52cb('0x24')]);router[_0x52cb('0x23')](_0x52cb('0x1f'),auth[_0x52cb('0x8')](),controller['removeAgents']);module[_0x52cb('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b9f759e..046469e 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 _0x04d4=['sequelize','exports','STRING','TEXT'];(function(_0x27f889,_0x5d99f4){var _0x272102=function(_0x5de32c){while(--_0x5de32c){_0x27f889['push'](_0x27f889['shift']());}};_0x272102(++_0x5d99f4);}(_0x04d4,0x7c));var _0x404d=function(_0x1102a8,_0x3a2142){_0x1102a8=_0x1102a8-0x0;var _0x102dc1=_0x04d4[_0x1102a8];return _0x102dc1;};'use strict';var Sequelize=require(_0x404d('0x0'));module[_0x404d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x404d('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x404d('0x3')]()},'description':{'type':Sequelize[_0x404d('0x2')]},'interval':{'type':Sequelize[_0x404d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xef86=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xef86,0xa5));var _0x6ef8=function(_0x10fd0f,_0x30d1d6){_0x10fd0f=_0x10fd0f-0x0;var _0x5ea15e=_0xef86[_0x10fd0f];return _0x5ea15e;};'use strict';var Sequelize=require(_0x6ef8('0x0'));module[_0x6ef8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6ef8('0x2')],'allowNull':![],'defaultValue':_0x6ef8('0x3')},'appdata':{'type':Sequelize[_0x6ef8('0x4')]()},'description':{'type':Sequelize[_0x6ef8('0x2')]},'interval':{'type':Sequelize[_0x6ef8('0x2')],'defaultValue':_0x6ef8('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6935711..2206625 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 _0xae69=['attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','query','keys','intersection','model'];(function(_0x338abc,_0x3ec158){var _0x304599=function(_0x43c7eb){while(--_0x43c7eb){_0x338abc['push'](_0x338abc['shift']());}};_0x304599(++_0x3ec158);}(_0xae69,0x13f));var _0x9ae6=function(_0x3ee22c,_0x8806c6){_0x3ee22c=_0x3ee22c-0x0;var _0x405e51=_0xae69[_0x3ee22c];return _0x405e51;};'use strict';var emlformat=require(_0x9ae6('0x0'));var rimraf=require(_0x9ae6('0x1'));var zipdir=require(_0x9ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ae6('0x3'));var moment=require(_0x9ae6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ae6('0x5'));var util=require('util');var path=require(_0x9ae6('0x6'));var sox=require(_0x9ae6('0x7'));var csv=require(_0x9ae6('0x8'));var ejs=require(_0x9ae6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ae6('0xa'));var squel=require(_0x9ae6('0xb'));var crypto=require(_0x9ae6('0xc'));var jsforce=require(_0x9ae6('0xd'));var deskjs=require(_0x9ae6('0xe'));var toCsv=require(_0x9ae6('0x8'));var querystring=require(_0x9ae6('0xf'));var Papa=require(_0x9ae6('0x10'));var Redis=require('ioredis');var authService=require(_0x9ae6('0x11'));var qs=require(_0x9ae6('0x12'));var as=require(_0x9ae6('0x13'));var hardwareService=require(_0x9ae6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9ae6('0x15'));var config=require(_0x9ae6('0x16'));var licenseUtil=require(_0x9ae6('0x17'));var db=require(_0x9ae6('0x18'))['db'];function respondWithStatusCode(_0xdaab46,_0x38986f){_0x38986f=_0x38986f||0xcc;return function(_0x35b87f){if(_0x35b87f){return _0xdaab46[_0x9ae6('0x19')](_0x38986f);}return _0xdaab46[_0x9ae6('0x1a')](_0x38986f)[_0x9ae6('0x1b')]();};}function respondWithResult(_0x3df40f,_0x2c0cae){_0x2c0cae=_0x2c0cae||0xc8;return function(_0x457936){if(_0x457936){return _0x3df40f[_0x9ae6('0x1a')](_0x2c0cae)[_0x9ae6('0x1c')](_0x457936);}};}function respondWithFilteredResult(_0x5e4965,_0x4bdc1d){return function(_0x5696a3){if(_0x5696a3){var _0x36d49e=typeof _0x4bdc1d[_0x9ae6('0x1d')]===_0x9ae6('0x1e')&&typeof _0x4bdc1d[_0x9ae6('0x1f')]==='undefined';var _0x1cef31=_0x5696a3[_0x9ae6('0x20')];var _0x412bb3=_0x36d49e?0x0:_0x4bdc1d[_0x9ae6('0x1d')];var _0x239df7=_0x36d49e?_0x5696a3[_0x9ae6('0x20')]:_0x4bdc1d[_0x9ae6('0x1d')]+_0x4bdc1d[_0x9ae6('0x1f')];var _0x14c78c;if(_0x239df7>=_0x1cef31){_0x239df7=_0x1cef31;_0x14c78c=0xc8;}else{_0x14c78c=0xce;}_0x5e4965[_0x9ae6('0x1a')](_0x14c78c);return _0x5e4965['set'](_0x9ae6('0x21'),_0x412bb3+'-'+_0x239df7+'/'+_0x1cef31)['json'](_0x5696a3);}return null;};}function patchUpdates(_0x111207){return function(_0x3a63e4){try{jsonpatch[_0x9ae6('0x22')](_0x3a63e4,_0x111207,!![]);}catch(_0x1e9817){return BPromise['reject'](_0x1e9817);}return _0x3a63e4[_0x9ae6('0x23')]();};}function saveUpdates(_0x2cc578,_0x3c4cdc){return function(_0x3faaf9){if(_0x3faaf9){return _0x3faaf9[_0x9ae6('0x24')](_0x2cc578)[_0x9ae6('0x25')](function(_0x11584b){return _0x11584b;});}return null;};}function removeEntity(_0x19e314,_0x2a6582){return function(_0xd24f35){if(_0xd24f35){return _0xd24f35[_0x9ae6('0x26')]()[_0x9ae6('0x25')](function(){_0x19e314[_0x9ae6('0x1a')](0xcc)[_0x9ae6('0x1b')]();});}};}function handleEntityNotFound(_0x31e030,_0x3d82bc){return function(_0x742317){if(!_0x742317){_0x31e030[_0x9ae6('0x19')](0x194);}return _0x742317;};}function handleError(_0x17e0e1,_0xcd0b7){_0xcd0b7=_0xcd0b7||0x1f4;return function(_0x563c9f){logger['error'](_0x563c9f[_0x9ae6('0x27')]);if(_0x563c9f['name']){delete _0x563c9f[_0x9ae6('0x28')];}_0x17e0e1[_0x9ae6('0x1a')](_0xcd0b7)[_0x9ae6('0x29')](_0x563c9f);};}exports[_0x9ae6('0x2a')]=function(_0x3f4210,_0x51e463){var _0x45e8d6={},_0x329ee3={},_0x28bd51={'count':0x0,'rows':[]};var _0x10827b=_['map'](db[_0x9ae6('0x2b')][_0x9ae6('0x2c')],function(_0x5c9833){return{'name':_0x5c9833[_0x9ae6('0x2d')],'type':_0x5c9833[_0x9ae6('0x2e')]['key']};});_0x329ee3['model']=_['map'](_0x10827b,_0x9ae6('0x28'));_0x329ee3[_0x9ae6('0x2f')]=_[_0x9ae6('0x30')](_0x3f4210[_0x9ae6('0x2f')]);_0x329ee3['filters']=_[_0x9ae6('0x31')](_0x329ee3[_0x9ae6('0x32')],_0x329ee3[_0x9ae6('0x2f')]);_0x45e8d6[_0x9ae6('0x33')]=_[_0x9ae6('0x31')](_0x329ee3['model'],qs[_0x9ae6('0x34')](_0x3f4210['query'][_0x9ae6('0x34')]));_0x45e8d6['attributes']=_0x45e8d6[_0x9ae6('0x33')][_0x9ae6('0x35')]?_0x45e8d6[_0x9ae6('0x33')]:_0x329ee3[_0x9ae6('0x32')];if(!_0x3f4210[_0x9ae6('0x2f')]['hasOwnProperty'](_0x9ae6('0x36'))){_0x45e8d6['limit']=qs[_0x9ae6('0x1f')](_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x1f')]);_0x45e8d6[_0x9ae6('0x1d')]=qs[_0x9ae6('0x1d')](_0x3f4210['query']['offset']);}_0x45e8d6[_0x9ae6('0x37')]=qs[_0x9ae6('0x38')](_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x38')]);_0x45e8d6[_0x9ae6('0x39')]=qs[_0x9ae6('0x3a')](_['pick'](_0x3f4210[_0x9ae6('0x2f')],_0x329ee3[_0x9ae6('0x3a')]),_0x10827b);if(_0x3f4210['query'][_0x9ae6('0x3b')]){_0x45e8d6[_0x9ae6('0x39')]=_[_0x9ae6('0x3c')](_0x45e8d6[_0x9ae6('0x39')],{'$or':_[_0x9ae6('0x3d')](_0x10827b,function(_0x55805c){if(_0x55805c[_0x9ae6('0x2e')]!==_0x9ae6('0x3e')){var _0x2dda06={};_0x2dda06[_0x55805c[_0x9ae6('0x28')]]={'$like':'%'+_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x3b')]+'%'};return _0x2dda06;}})});}_0x45e8d6=_[_0x9ae6('0x3c')]({},_0x45e8d6,_0x3f4210[_0x9ae6('0x3f')]);var _0x47dc79={'where':_0x45e8d6[_0x9ae6('0x39')]};return db[_0x9ae6('0x2b')][_0x9ae6('0x20')](_0x47dc79)['then'](function(_0x27a367){_0x28bd51[_0x9ae6('0x20')]=_0x27a367;if(_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x45e8d6[_0x9ae6('0x41')]=[{'all':!![]}];}return db[_0x9ae6('0x2b')][_0x9ae6('0x42')](_0x45e8d6);})[_0x9ae6('0x25')](function(_0x406a7c){_0x28bd51[_0x9ae6('0x43')]=_0x406a7c;return _0x28bd51;})[_0x9ae6('0x25')](respondWithFilteredResult(_0x51e463,_0x45e8d6))[_0x9ae6('0x44')](handleError(_0x51e463,null));};exports[_0x9ae6('0x45')]=function(_0x3a0670,_0x4e632b){var _0x21c126={'raw':!![],'where':{'id':_0x3a0670[_0x9ae6('0x46')]['id']}},_0x31e4e6={};_0x31e4e6[_0x9ae6('0x32')]=_[_0x9ae6('0x30')](db[_0x9ae6('0x2b')][_0x9ae6('0x2c')]);_0x31e4e6[_0x9ae6('0x2f')]=_[_0x9ae6('0x30')](_0x3a0670[_0x9ae6('0x2f')]);_0x31e4e6['filters']=_[_0x9ae6('0x31')](_0x31e4e6[_0x9ae6('0x32')],_0x31e4e6[_0x9ae6('0x2f')]);_0x21c126[_0x9ae6('0x33')]=_[_0x9ae6('0x31')](_0x31e4e6[_0x9ae6('0x32')],qs[_0x9ae6('0x34')](_0x3a0670[_0x9ae6('0x2f')][_0x9ae6('0x34')]));_0x21c126['attributes']=_0x21c126[_0x9ae6('0x33')][_0x9ae6('0x35')]?_0x21c126[_0x9ae6('0x33')]:_0x31e4e6[_0x9ae6('0x32')];if(_0x3a0670[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x21c126[_0x9ae6('0x41')]=[{'all':!![]}];}_0x21c126=_[_0x9ae6('0x3c')]({},_0x21c126,_0x3a0670[_0x9ae6('0x3f')]);return db[_0x9ae6('0x2b')][_0x9ae6('0x47')](_0x21c126)[_0x9ae6('0x25')](handleEntityNotFound(_0x4e632b,null))['then'](respondWithResult(_0x4e632b,null))[_0x9ae6('0x44')](handleError(_0x4e632b,null));};exports['create']=function(_0x48018,_0x94ae4c){return db[_0x9ae6('0x2b')][_0x9ae6('0x48')](_0x48018[_0x9ae6('0x49')],{})[_0x9ae6('0x25')](respondWithResult(_0x94ae4c,0xc9))[_0x9ae6('0x44')](handleError(_0x94ae4c,null));};exports[_0x9ae6('0x24')]=function(_0x5a3916,_0x2fb33b){if(_0x5a3916[_0x9ae6('0x49')]['id']){delete _0x5a3916['body']['id'];}return db[_0x9ae6('0x2b')][_0x9ae6('0x47')]({'where':{'id':_0x5a3916['params']['id']}})['then'](handleEntityNotFound(_0x2fb33b,null))['then'](saveUpdates(_0x5a3916[_0x9ae6('0x49')],null))[_0x9ae6('0x25')](respondWithResult(_0x2fb33b,null))[_0x9ae6('0x44')](handleError(_0x2fb33b,null));};exports[_0x9ae6('0x26')]=function(_0x1bbea8,_0x34326e){return db['FaxApplication'][_0x9ae6('0x47')]({'where':{'id':_0x1bbea8[_0x9ae6('0x46')]['id']}})[_0x9ae6('0x25')](handleEntityNotFound(_0x34326e,null))[_0x9ae6('0x25')](removeEntity(_0x34326e,null))['catch'](handleError(_0x34326e,null));}; \ No newline at end of file +var _0xd24c=['reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','request-promise','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x1debbd,_0x4bd739){var _0x40c66d=function(_0x1d8938){while(--_0x1d8938){_0x1debbd['push'](_0x1debbd['shift']());}};_0x40c66d(++_0x4bd739);}(_0xd24c,0x73));var _0xcd24=function(_0x5633d9,_0x3ddc68){_0x5633d9=_0x5633d9-0x0;var _0x39571c=_0xd24c[_0x5633d9];return _0x39571c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcd24('0x2'));var util=require(_0xcd24('0x3'));var path=require(_0xcd24('0x4'));var sox=require(_0xcd24('0x5'));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(_0xcd24('0x6'));var crypto=require(_0xcd24('0x7'));var jsforce=require(_0xcd24('0x8'));var deskjs=require(_0xcd24('0x9'));var toCsv=require(_0xcd24('0xa'));var querystring=require(_0xcd24('0xb'));var Papa=require(_0xcd24('0xc'));var Redis=require(_0xcd24('0xd'));var authService=require(_0xcd24('0xe'));var qs=require(_0xcd24('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd24('0x10'));var logger=require('../../config/logger')(_0xcd24('0x11'));var utils=require('../../config/utils');var config=require(_0xcd24('0x12'));var licenseUtil=require(_0xcd24('0x13'));var db=require(_0xcd24('0x14'))['db'];function respondWithStatusCode(_0x22836b,_0x30aabe){_0x30aabe=_0x30aabe||0xcc;return function(_0x53ad13){if(_0x53ad13){return _0x22836b['sendStatus'](_0x30aabe);}return _0x22836b[_0xcd24('0x15')](_0x30aabe)[_0xcd24('0x16')]();};}function respondWithResult(_0x4ac63d,_0x31ae1e){_0x31ae1e=_0x31ae1e||0xc8;return function(_0x158665){if(_0x158665){return _0x4ac63d['status'](_0x31ae1e)[_0xcd24('0x17')](_0x158665);}};}function respondWithFilteredResult(_0x45ee1f,_0x36c0ec){return function(_0x28fad8){if(_0x28fad8){var _0x10f4da=typeof _0x36c0ec[_0xcd24('0x18')]===_0xcd24('0x19')&&typeof _0x36c0ec[_0xcd24('0x1a')]===_0xcd24('0x19');var _0x11457f=_0x28fad8[_0xcd24('0x1b')];var _0x99fdb5=_0x10f4da?0x0:_0x36c0ec[_0xcd24('0x18')];var _0x4cebe7=_0x10f4da?_0x28fad8[_0xcd24('0x1b')]:_0x36c0ec['offset']+_0x36c0ec['limit'];var _0x102d29;if(_0x4cebe7>=_0x11457f){_0x4cebe7=_0x11457f;_0x102d29=0xc8;}else{_0x102d29=0xce;}_0x45ee1f[_0xcd24('0x15')](_0x102d29);return _0x45ee1f[_0xcd24('0x1c')](_0xcd24('0x1d'),_0x99fdb5+'-'+_0x4cebe7+'/'+_0x11457f)[_0xcd24('0x17')](_0x28fad8);}return null;};}function patchUpdates(_0x5e5c99){return function(_0x299771){try{jsonpatch[_0xcd24('0x1e')](_0x299771,_0x5e5c99,!![]);}catch(_0x34107c){return BPromise[_0xcd24('0x1f')](_0x34107c);}return _0x299771[_0xcd24('0x20')]();};}function saveUpdates(_0x596c1c,_0x34b2c7){return function(_0xffeb07){if(_0xffeb07){return _0xffeb07[_0xcd24('0x21')](_0x596c1c)[_0xcd24('0x22')](function(_0x5ba42f){return _0x5ba42f;});}return null;};}function removeEntity(_0x3d6edb,_0x195166){return function(_0x4ec951){if(_0x4ec951){return _0x4ec951[_0xcd24('0x23')]()['then'](function(){_0x3d6edb[_0xcd24('0x15')](0xcc)[_0xcd24('0x16')]();});}};}function handleEntityNotFound(_0x3a1508,_0x942501){return function(_0xa51b06){if(!_0xa51b06){_0x3a1508[_0xcd24('0x24')](0x194);}return _0xa51b06;};}function handleError(_0x1b1b22,_0x3a4026){_0x3a4026=_0x3a4026||0x1f4;return function(_0x1ad338){logger[_0xcd24('0x25')](_0x1ad338['stack']);if(_0x1ad338[_0xcd24('0x26')]){delete _0x1ad338[_0xcd24('0x26')];}_0x1b1b22[_0xcd24('0x15')](_0x3a4026)[_0xcd24('0x27')](_0x1ad338);};}exports[_0xcd24('0x28')]=function(_0x3fd893,_0x46a9d2){var _0x3d8a5f={},_0x14978e={},_0x5f0ada={'count':0x0,'rows':[]};var _0x3c84dc=_[_0xcd24('0x29')](db['FaxApplication'][_0xcd24('0x2a')],function(_0x5a2ca0){return{'name':_0x5a2ca0['fieldName'],'type':_0x5a2ca0[_0xcd24('0x2b')]['key']};});_0x14978e[_0xcd24('0x2c')]=_[_0xcd24('0x29')](_0x3c84dc,_0xcd24('0x26'));_0x14978e['query']=_[_0xcd24('0x2d')](_0x3fd893[_0xcd24('0x2e')]);_0x14978e[_0xcd24('0x2f')]=_['intersection'](_0x14978e[_0xcd24('0x2c')],_0x14978e[_0xcd24('0x2e')]);_0x3d8a5f['attributes']=_[_0xcd24('0x30')](_0x14978e[_0xcd24('0x2c')],qs[_0xcd24('0x31')](_0x3fd893['query']['fields']));_0x3d8a5f[_0xcd24('0x32')]=_0x3d8a5f[_0xcd24('0x32')][_0xcd24('0x33')]?_0x3d8a5f[_0xcd24('0x32')]:_0x14978e[_0xcd24('0x2c')];if(!_0x3fd893['query'][_0xcd24('0x34')](_0xcd24('0x35'))){_0x3d8a5f[_0xcd24('0x1a')]=qs['limit'](_0x3fd893[_0xcd24('0x2e')][_0xcd24('0x1a')]);_0x3d8a5f[_0xcd24('0x18')]=qs[_0xcd24('0x18')](_0x3fd893['query'][_0xcd24('0x18')]);}_0x3d8a5f[_0xcd24('0x36')]=qs[_0xcd24('0x37')](_0x3fd893[_0xcd24('0x2e')][_0xcd24('0x37')]);_0x3d8a5f[_0xcd24('0x38')]=qs[_0xcd24('0x2f')](_[_0xcd24('0x39')](_0x3fd893[_0xcd24('0x2e')],_0x14978e[_0xcd24('0x2f')]),_0x3c84dc);if(_0x3fd893[_0xcd24('0x2e')][_0xcd24('0x3a')]){_0x3d8a5f[_0xcd24('0x38')]=_[_0xcd24('0x3b')](_0x3d8a5f[_0xcd24('0x38')],{'$or':_[_0xcd24('0x29')](_0x3c84dc,function(_0x2a1bf6){if(_0x2a1bf6[_0xcd24('0x2b')]!==_0xcd24('0x3c')){var _0x42150f={};_0x42150f[_0x2a1bf6[_0xcd24('0x26')]]={'$like':'%'+_0x3fd893['query']['filter']+'%'};return _0x42150f;}})});}_0x3d8a5f=_[_0xcd24('0x3b')]({},_0x3d8a5f,_0x3fd893[_0xcd24('0x3d')]);var _0x34c2d9={'where':_0x3d8a5f[_0xcd24('0x38')]};return db[_0xcd24('0x3e')][_0xcd24('0x1b')](_0x34c2d9)[_0xcd24('0x22')](function(_0x570998){_0x5f0ada['count']=_0x570998;if(_0x3fd893['query'][_0xcd24('0x3f')]){_0x3d8a5f[_0xcd24('0x40')]=[{'all':!![]}];}return db[_0xcd24('0x3e')][_0xcd24('0x41')](_0x3d8a5f);})[_0xcd24('0x22')](function(_0x54dfb8){_0x5f0ada[_0xcd24('0x42')]=_0x54dfb8;return _0x5f0ada;})[_0xcd24('0x22')](respondWithFilteredResult(_0x46a9d2,_0x3d8a5f))[_0xcd24('0x43')](handleError(_0x46a9d2,null));};exports[_0xcd24('0x44')]=function(_0x39a933,_0xd6f25a){var _0x1961a0={'raw':!![],'where':{'id':_0x39a933[_0xcd24('0x45')]['id']}},_0x108dd3={};_0x108dd3[_0xcd24('0x2c')]=_[_0xcd24('0x2d')](db[_0xcd24('0x3e')][_0xcd24('0x2a')]);_0x108dd3[_0xcd24('0x2e')]=_['keys'](_0x39a933[_0xcd24('0x2e')]);_0x108dd3[_0xcd24('0x2f')]=_['intersection'](_0x108dd3[_0xcd24('0x2c')],_0x108dd3['query']);_0x1961a0[_0xcd24('0x32')]=_['intersection'](_0x108dd3[_0xcd24('0x2c')],qs[_0xcd24('0x31')](_0x39a933[_0xcd24('0x2e')][_0xcd24('0x31')]));_0x1961a0[_0xcd24('0x32')]=_0x1961a0['attributes'][_0xcd24('0x33')]?_0x1961a0[_0xcd24('0x32')]:_0x108dd3[_0xcd24('0x2c')];if(_0x39a933[_0xcd24('0x2e')]['includeAll']){_0x1961a0[_0xcd24('0x40')]=[{'all':!![]}];}_0x1961a0=_[_0xcd24('0x3b')]({},_0x1961a0,_0x39a933[_0xcd24('0x3d')]);return db[_0xcd24('0x3e')][_0xcd24('0x46')](_0x1961a0)['then'](handleEntityNotFound(_0xd6f25a,null))[_0xcd24('0x22')](respondWithResult(_0xd6f25a,null))[_0xcd24('0x43')](handleError(_0xd6f25a,null));};exports[_0xcd24('0x47')]=function(_0x18bdf0,_0x20c8a5){return db[_0xcd24('0x3e')][_0xcd24('0x47')](_0x18bdf0[_0xcd24('0x48')],{})['then'](respondWithResult(_0x20c8a5,0xc9))['catch'](handleError(_0x20c8a5,null));};exports['update']=function(_0x23bc21,_0x12f4bb){if(_0x23bc21['body']['id']){delete _0x23bc21['body']['id'];}return db['FaxApplication'][_0xcd24('0x46')]({'where':{'id':_0x23bc21[_0xcd24('0x45')]['id']}})[_0xcd24('0x22')](handleEntityNotFound(_0x12f4bb,null))['then'](saveUpdates(_0x23bc21[_0xcd24('0x48')],null))[_0xcd24('0x22')](respondWithResult(_0x12f4bb,null))['catch'](handleError(_0x12f4bb,null));};exports[_0xcd24('0x23')]=function(_0x25b99a,_0x410027){return db[_0xcd24('0x3e')][_0xcd24('0x46')]({'where':{'id':_0x25b99a[_0xcd24('0x45')]['id']}})['then'](handleEntityNotFound(_0x410027,null))[_0xcd24('0x22')](removeEntity(_0x410027,null))[_0xcd24('0x43')](handleError(_0x410027,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6c51348..8eba3c1 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 _0x487b=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x45749a,_0x52b3c5){var _0x36e168=function(_0x429717){while(--_0x429717){_0x45749a['push'](_0x45749a['shift']());}};_0x36e168(++_0x52b3c5);}(_0x487b,0x6d));var _0xb487=function(_0x473970,_0xe20c1){_0x473970=_0x473970-0x0;var _0x18366e=_0x487b[_0x473970];return _0x18366e;};'use strict';var _=require(_0xb487('0x0'));var util=require(_0xb487('0x1'));var logger=require('../../config/logger')(_0xb487('0x2'));var moment=require(_0xb487('0x3'));var BPromise=require('bluebird');var rp=require(_0xb487('0x4'));var fs=require('fs');var path=require(_0xb487('0x5'));var rimraf=require('rimraf');var config=require(_0xb487('0x6'));var attributes=require(_0xb487('0x7'));module[_0xb487('0x8')]=function(_0x48e193,_0x514d72){return _0x48e193[_0xb487('0x9')](_0xb487('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb487('0xb')});}; \ No newline at end of file +var _0x9ce4=['path','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x19b71b,_0x222aa3){var _0x361407=function(_0xc3dd34){while(--_0xc3dd34){_0x19b71b['push'](_0x19b71b['shift']());}};_0x361407(++_0x222aa3);}(_0x9ce4,0x93));var _0x49ce=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x9ce4[_0x8b0f43];return _0x3f4425;};'use strict';var _=require(_0x49ce('0x0'));var util=require(_0x49ce('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x49ce('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49ce('0x3'));var rimraf=require(_0x49ce('0x4'));var config=require(_0x49ce('0x5'));var attributes=require(_0x49ce('0x6'));module['exports']=function(_0x2a4d97,_0x244c4d){return _0x2a4d97['define'](_0x49ce('0x7'),attributes,{'tableName':_0x49ce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x49ce('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0a604b9..2058d48 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 _0x819a=['../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxApplication','update','raw','options','attributes','limit','then','UpdateFaxApplication','stringify','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1ba2de,_0x3b3ac9){var _0x5295da=function(_0x1b9576){while(--_0x1b9576){_0x1ba2de['push'](_0x1ba2de['shift']());}};_0x5295da(++_0x3b3ac9);}(_0x819a,0xaf));var _0xa819=function(_0x31fb52,_0xded904){_0x31fb52=_0x31fb52-0x0;var _0x3fc244=_0x819a[_0x31fb52];return _0x3fc244;};'use strict';var _=require(_0xa819('0x0'));var util=require('util');var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var rs=require(_0xa819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa819('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa819('0x5'))(_0xa819('0x6'));var config=require(_0xa819('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa819('0x8')][_0xa819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a277,_0xeafdf9,_0x5b8519){return new BPromise(function(_0x53e7a2,_0x18a552){return client[_0xa819('0xa')](_0x51a277,_0x5b8519)['then'](function(_0x44d4ca){logger[_0xa819('0xb')](_0xa819('0xc'),_0xeafdf9,'request\x20sent');logger[_0xa819('0xd')](_0xa819('0xe'),_0xeafdf9,_0xa819('0xf'),JSON['stringify'](_0x44d4ca));if(_0x44d4ca['error']){if(_0x44d4ca[_0xa819('0x10')][_0xa819('0x11')]===0x1f4){logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x18a552(_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);}logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x53e7a2(_0x44d4ca['error'][_0xa819('0x12')]);}else{logger['info'](_0xa819('0xc'),_0xeafdf9,'request\x20sent');_0x53e7a2(_0x44d4ca[_0xa819('0x13')][_0xa819('0x12')]);}})[_0xa819('0x14')](function(_0x1fa750){logger['error']('FaxApplication,\x20%s,\x20%s',_0xeafdf9,_0x1fa750);_0x18a552(_0x1fa750);});});}exports['UpdateFaxApplication']=function(_0x4c3a17){var _0x354c5a=this;return new Promise(function(_0x4f72c2,_0x4096ee){return db[_0xa819('0x15')][_0xa819('0x16')](_0x4c3a17['body'],{'raw':_0x4c3a17['options']?_0x4c3a17['options'][_0xa819('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')]['where']||null:null,'attributes':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x19')]||null:null,'limit':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x1a')]||null:null})[_0xa819('0x1b')](function(_0x2e15e8){logger[_0xa819('0xb')](_0xa819('0x1c'),_0x4c3a17);logger['debug']('UpdateFaxApplication',_0x4c3a17,JSON[_0xa819('0x1d')](_0x2e15e8));_0x4f72c2(_0x2e15e8);})[_0xa819('0x14')](function(_0x4050f0){logger[_0xa819('0x10')](_0xa819('0x1c'),_0x4050f0[_0xa819('0x12')],_0x4c3a17);_0x4096ee(_0x354c5a['error'](0x1f4,_0x4050f0[_0xa819('0x12')]));});});}; \ No newline at end of file +var _0x74fe=['options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication','update','body'];(function(_0x3cff41,_0x6d45b6){var _0x16ab1f=function(_0x3c30cc){while(--_0x3c30cc){_0x3cff41['push'](_0x3cff41['shift']());}};_0x16ab1f(++_0x6d45b6);}(_0x74fe,0xca));var _0xe74f=function(_0x35eab2,_0x454aa3){_0x35eab2=_0x35eab2-0x0;var _0x2d7a40=_0x74fe[_0x35eab2];return _0x2d7a40;};'use strict';var _=require(_0xe74f('0x0'));var util=require(_0xe74f('0x1'));var moment=require(_0xe74f('0x2'));var BPromise=require(_0xe74f('0x3'));var rs=require(_0xe74f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe74f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe74f('0x6'))('rpc');var config=require(_0xe74f('0x7'));var jayson=require(_0xe74f('0x8'));var client=jayson['client'][_0xe74f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x109d05,_0x3844d1,_0x266c67){return new BPromise(function(_0x5b771d,_0x670a37){return client['request'](_0x109d05,_0x266c67)[_0xe74f('0xa')](function(_0xdb781f){logger[_0xe74f('0xb')](_0xe74f('0xc'),_0x3844d1,_0xe74f('0xd'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3844d1,_0xe74f('0xd'),JSON[_0xe74f('0xe')](_0xdb781f));if(_0xdb781f[_0xe74f('0xf')]){if(_0xdb781f[_0xe74f('0xf')][_0xe74f('0x10')]===0x1f4){logger[_0xe74f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0xdb781f[_0xe74f('0xf')]['message']);return _0x670a37(_0xdb781f[_0xe74f('0xf')][_0xe74f('0x11')]);}logger[_0xe74f('0xf')](_0xe74f('0xc'),_0x3844d1,_0xdb781f[_0xe74f('0xf')][_0xe74f('0x11')]);return _0x5b771d(_0xdb781f['error'][_0xe74f('0x11')]);}else{logger[_0xe74f('0xb')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0xe74f('0xd'));_0x5b771d(_0xdb781f['result'][_0xe74f('0x11')]);}})[_0xe74f('0x12')](function(_0x5f03d9){logger[_0xe74f('0xf')]('FaxApplication,\x20%s,\x20%s',_0x3844d1,_0x5f03d9);_0x670a37(_0x5f03d9);});});}exports[_0xe74f('0x13')]=function(_0x20ffa3){var _0x386d3f=this;return new Promise(function(_0x31c190,_0x458dbf){return db['FaxApplication'][_0xe74f('0x14')](_0x20ffa3[_0xe74f('0x15')],{'raw':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3[_0xe74f('0x16')][_0xe74f('0x18')]||null:null,'attributes':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x19')]||null:null,'limit':_0x20ffa3[_0xe74f('0x16')]?_0x20ffa3['options'][_0xe74f('0x1a')]||null:null})[_0xe74f('0xa')](function(_0x137a01){logger['info'](_0xe74f('0x13'),_0x20ffa3);logger[_0xe74f('0x1b')](_0xe74f('0x13'),_0x20ffa3,JSON[_0xe74f('0xe')](_0x137a01));_0x31c190(_0x137a01);})[_0xe74f('0x12')](function(_0x531656){logger[_0xe74f('0xf')](_0xe74f('0x13'),_0x531656['message'],_0x20ffa3);_0x458dbf(_0x386d3f[_0xe74f('0xf')](0x1f4,_0x531656[_0xe74f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1bac0c6..2b9fa61 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x1a5b4f,_0x3cfe15){var _0x3e062c=function(_0xaf8ba1){while(--_0xaf8ba1){_0x1a5b4f['push'](_0x1a5b4f['shift']());}};_0x3e062c(++_0x3cfe15);}(_0x4024,0x89));var _0x4402=function(_0xe3af07,_0x462efc){_0xe3af07=_0xe3af07-0x0;var _0x570765=_0x4024[_0xe3af07];return _0x570765;};'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 +var _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xb688,0xcf));var _0x8b68=function(_0x2a3fdc,_0x23835e){_0x2a3fdc=_0x2a3fdc-0x0;var _0x4c213b=_0xb688[_0x2a3fdc];return _0x4c213b;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 409be47..7f642be 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 _0xc6ac=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4d9b14,_0x76a10d){var _0x263a8f=function(_0x1980b7){while(--_0x1980b7){_0x4d9b14['push'](_0x4d9b14['shift']());}};_0x263a8f(++_0x76a10d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x39aa3e,_0x2fada2){_0x39aa3e=_0x39aa3e-0x0;var _0x1bab37=_0xc6ac[_0x39aa3e];return _0x1bab37;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'closed':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc6a('0x3')]},'disposition':{'type':Sequelize[_0xcc6a('0x4')]},'secondDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'note':{'type':Sequelize[_0xcc6a('0x4')]},'read1stAt':{'type':Sequelize[_0xcc6a('0x3')]},'fax':{'type':Sequelize[_0xcc6a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in',_0xcc6a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc6a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xcc6a('0x7')]}}; \ No newline at end of file +var _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x4e67ce,_0x332027){var _0x46ce95=function(_0x847e9f){while(--_0x847e9f){_0x4e67ce['push'](_0x4e67ce['shift']());}};_0x46ce95(++_0x332027);}(_0xcaf2,0x8a));var _0x2caf=function(_0x318807,_0x51678f){_0x318807=_0x318807-0x0;var _0x33ea7e=_0xcaf2[_0x318807];return _0x33ea7e;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 616e015..d2b2471 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 _0x695e=['then','end','error','stack','name','send','index','map','FaxInteraction','type','key','getOptions','findAll','fax','show','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','find','create','body','catch','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','where','FaxInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','existsSync','createReadStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy'];(function(_0x2919e4,_0x535b43){var _0x124dc5=function(_0x427338){while(--_0x427338){_0x2919e4['push'](_0x2919e4['shift']());}};_0x124dc5(++_0x535b43);}(_0x695e,0x170));var _0xe695=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0x695e[_0x4565eb];return _0x67832;};'use strict';var rimraf=require(_0xe695('0x0'));var zipdir=require(_0xe695('0x1'));var moment=require(_0xe695('0x2'));var BPromise=require(_0xe695('0x3'));var util=require(_0xe695('0x4'));var path=require(_0xe695('0x5'));var fs=require('fs');var _=require(_0xe695('0x6'));var Redis=require('ioredis');var interaction=require(_0xe695('0x7'));var qs=require(_0xe695('0x8'));var logger=require(_0xe695('0x9'))(_0xe695('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe695('0xb')](config[_0xe695('0xc')],{'host':_0xe695('0xd'),'port':0x18eb});var socket=require(_0xe695('0xe'))(new Redis(config[_0xe695('0xc')]));require(_0xe695('0xf'))[_0xe695('0x10')](socket);function respondWithStatusCode(_0xd32cc7,_0x134c41){_0x134c41=_0x134c41||0xcc;return function(_0x9a3d5a){if(_0x9a3d5a){return _0xd32cc7[_0xe695('0x11')](_0x134c41);}return _0xd32cc7[_0xe695('0x12')](_0x134c41)['end']();};}function respondWithResult(_0x457cd8,_0x4a6de4){_0x4a6de4=_0x4a6de4||0xc8;return function(_0x26ebdf){if(_0x26ebdf){return _0x457cd8['status'](_0x4a6de4)[_0xe695('0x13')](_0x26ebdf);}};}function respondWithFilteredResult(_0xde5546,_0x4beb8b){return function(_0x40efad){if(_0x40efad){var _0x1020a4=typeof _0x4beb8b[_0xe695('0x14')]===_0xe695('0x15')&&typeof _0x4beb8b['limit']==='undefined';var _0x496476=_0x40efad['count'];var _0xb32d5a=_0x1020a4?0x0:_0x4beb8b[_0xe695('0x14')];var _0x51808f=_0x1020a4?_0x40efad[_0xe695('0x16')]:_0x4beb8b[_0xe695('0x14')]+_0x4beb8b[_0xe695('0x17')];var _0x5fe82b;if(_0x51808f>=_0x496476){_0x51808f=_0x496476;_0x5fe82b=0xc8;}else{_0x5fe82b=0xce;}_0xde5546[_0xe695('0x12')](_0x5fe82b);return _0xde5546[_0xe695('0x18')](_0xe695('0x19'),_0xb32d5a+'-'+_0x51808f+'/'+_0x496476)[_0xe695('0x13')](_0x40efad);}return null;};}function saveUpdates(_0x4932fb){return function(_0x5c314a){if(_0x5c314a){return _0x5c314a[_0xe695('0x1a')](_0x4932fb)['then'](function(_0x3a1e47){return _0x3a1e47;});}return null;};}function removeEntity(_0x56d772){return function(_0x58b3b3){if(_0x58b3b3){return _0x58b3b3[_0xe695('0x1b')]()[_0xe695('0x1c')](function(){_0x56d772[_0xe695('0x12')](0xcc)[_0xe695('0x1d')]();});}};}function handleEntityNotFound(_0x4a2b1c){return function(_0x46dae3){if(!_0x46dae3){_0x4a2b1c[_0xe695('0x11')](0x194);}return _0x46dae3;};}function handleError(_0xb0342c,_0x495278){_0x495278=_0x495278||0x1f4;return function(_0x1724c7){logger[_0xe695('0x1e')](_0x1724c7[_0xe695('0x1f')]);if(_0x1724c7['name']){delete _0x1724c7[_0xe695('0x20')];}_0xb0342c['status'](_0x495278)[_0xe695('0x21')](_0x1724c7);};}exports[_0xe695('0x22')]=function(_0x23959b,_0x454cac){var _0x8f7461={};var _0x21328a=_[_0xe695('0x23')](db[_0xe695('0x24')]['rawAttributes'],function(_0x1ff8f8){return{'name':_0x1ff8f8['fieldName'],'type':_0x1ff8f8[_0xe695('0x25')][_0xe695('0x26')]};});_0x8f7461=qs[_0xe695('0x27')](_0x21328a,_0x23959b);return interaction[_0xe695('0x28')](_0xe695('0x29'),_0x23959b['query'],_0x23959b['user'],_0x8f7461,_0x21328a)[_0xe695('0x1c')](respondWithFilteredResult(_0x454cac,_0x8f7461))['catch'](handleError(_0x454cac,null));};exports[_0xe695('0x2a')]=function(_0x5d751f,_0x227bf8){var _0x3ec690={'raw':![],'where':{'id':_0x5d751f['params']['id']}},_0x5c7b95={};_0x5c7b95['model']=_[_0xe695('0x2b')](db['FaxInteraction'][_0xe695('0x2c')]);_0x5c7b95[_0xe695('0x2d')]=_[_0xe695('0x2b')](_0x5d751f[_0xe695('0x2d')]);_0x5c7b95['filters']=_[_0xe695('0x2e')](_0x5c7b95[_0xe695('0x2f')],_0x5c7b95[_0xe695('0x2d')]);_0x3ec690[_0xe695('0x30')]=_[_0xe695('0x2e')](_0x5c7b95['model'],qs[_0xe695('0x31')](_0x5d751f[_0xe695('0x2d')][_0xe695('0x31')]));_0x3ec690[_0xe695('0x30')]=_0x3ec690[_0xe695('0x30')][_0xe695('0x32')]?_0x3ec690[_0xe695('0x30')]:_0x5c7b95[_0xe695('0x2f')];if(_0x5d751f[_0xe695('0x2d')][_0xe695('0x33')]){_0x3ec690[_0xe695('0x34')]=[{'all':!![]}];}_0x3ec690=_['merge']({},_0x3ec690,_0x5d751f['options']);return db['FaxInteraction'][_0xe695('0x35')](_0x3ec690)[_0xe695('0x1c')](handleEntityNotFound(_0x227bf8,null))[_0xe695('0x1c')](respondWithResult(_0x227bf8,null))['catch'](handleError(_0x227bf8,null));};exports[_0xe695('0x36')]=function(_0x4cee16,_0x4892f8){return db[_0xe695('0x24')][_0xe695('0x36')](_0x4cee16[_0xe695('0x37')],{})[_0xe695('0x1c')](respondWithResult(_0x4892f8,0xc9))[_0xe695('0x38')](handleError(_0x4892f8,null));};exports['update']=function(_0x46be0a,_0x455286){if(_0x46be0a['body']['id']){delete _0x46be0a[_0xe695('0x37')]['id'];}return db['FaxInteraction'][_0xe695('0x35')]({'where':{'id':_0x46be0a[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x455286,null))[_0xe695('0x1c')](saveUpdates(_0x46be0a[_0xe695('0x37')],null))[_0xe695('0x1c')](respondWithResult(_0x455286,null))[_0xe695('0x38')](handleError(_0x455286,null));};exports[_0xe695('0x1b')]=function(_0x5eb6b6,_0x1c024a){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x5eb6b6['params']['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x1c024a,null))[_0xe695('0x1c')](removeEntity(_0x1c024a,null))[_0xe695('0x38')](handleError(_0x1c024a,null));};exports[_0xe695('0x3a')]=function(_0x4cb7f7,_0x932232){return db[_0xe695('0x24')][_0xe695('0x3a')]()[_0xe695('0x1c')](respondWithResult(_0x932232,null))[_0xe695('0x38')](handleError(_0x932232,null));};exports[_0xe695('0x3b')]=function(_0x5217ee,_0x1ca840){return db[_0xe695('0x3c')][_0xe695('0x35')]({'where':{'id':_0x5217ee['params']['id']}})['then'](handleEntityNotFound(_0x1ca840,null))[_0xe695('0x1c')](function(_0x1ea08c){if(_0x1ea08c){return _0x1ea08c[_0xe695('0x3b')](_0x5217ee[_0xe695('0x37')][_0xe695('0x3d')],_[_0xe695('0x3e')](_0x5217ee[_0xe695('0x37')],[_0xe695('0x3d'),'id'])||{});}})[_0xe695('0x1c')](respondWithResult(_0x1ca840,null))[_0xe695('0x38')](handleError(_0x1ca840,null));};exports[_0xe695('0x3f')]=function(_0x20fe04,_0x1f448f){var _0x3f3f33={'raw':![],'where':{}};var _0x1a3e28={};var _0x375574={'count':0x0,'rows':[]};return db[_0xe695('0x24')][_0xe695('0x40')]({'where':{'id':_0x20fe04[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x1f448f,null))['then'](function(_0x4b3fb3){if(_0x4b3fb3){_0x1a3e28[_0xe695('0x2f')]=_[_0xe695('0x2b')](db[_0xe695('0x3c')][_0xe695('0x2c')]);_0x1a3e28[_0xe695('0x2d')]=_[_0xe695('0x2b')](_0x20fe04[_0xe695('0x2d')]);_0x1a3e28['filters']=_[_0xe695('0x2e')](_0x1a3e28[_0xe695('0x2f')],_0x1a3e28['query']);_0x3f3f33[_0xe695('0x30')]=_[_0xe695('0x2e')](_0x1a3e28[_0xe695('0x2f')],qs[_0xe695('0x31')](_0x20fe04[_0xe695('0x2d')][_0xe695('0x31')]));_0x3f3f33[_0xe695('0x30')]=_0x3f3f33['attributes']['length']?_0x3f3f33[_0xe695('0x30')]:_0x1a3e28[_0xe695('0x2f')];if(!_0x20fe04[_0xe695('0x2d')][_0xe695('0x41')](_0xe695('0x42'))){_0x3f3f33[_0xe695('0x17')]=qs[_0xe695('0x17')](_0x20fe04[_0xe695('0x2d')][_0xe695('0x17')]);_0x3f3f33[_0xe695('0x14')]=qs['offset'](_0x20fe04[_0xe695('0x2d')][_0xe695('0x14')]);}_0x3f3f33[_0xe695('0x43')]=qs['sort'](_0x20fe04[_0xe695('0x2d')]['sort']);_0x3f3f33[_0xe695('0x44')]=qs['filters'](_['pick'](_0x20fe04[_0xe695('0x2d')],_0x1a3e28['filters']));_0x3f3f33['where'][_0xe695('0x45')]=_0x4b3fb3['id'];if(_0x20fe04[_0xe695('0x2d')]['filter']){_0x3f3f33[_0xe695('0x44')]=_['merge'](_0x3f3f33[_0xe695('0x44')],{'$or':_[_0xe695('0x23')](_0x3f3f33['attributes'],function(_0x2e26ad){var _0x3c7458={};_0x3c7458[_0x2e26ad]={'$like':'%'+_0x20fe04['query']['filter']+'%'};return _0x3c7458;})});}if(_0x20fe04[_0xe695('0x2d')][_0xe695('0x46')]){var _0x4b85e3=_0x20fe04[_0xe695('0x2d')][_0xe695('0x46')]['split'](',');var _0x3d94ee={};_0x3d94ee[_0x4b85e3[0x0]]={'$gte':moment(_0x4b85e3[0x1])['format'](_0xe695('0x47'))};_0x3f3f33[_0xe695('0x44')]=_['merge'](_0x3f3f33[_0xe695('0x44')],_0x3d94ee);}_0x3f3f33=_[_0xe695('0x48')]({},_0x3f3f33,_0x20fe04['options']);return db['FaxMessage']['count']({'where':_0x3f3f33[_0xe695('0x44')]})[_0xe695('0x1c')](function(_0x166b2e){_0x375574[_0xe695('0x16')]=_0x166b2e;if(_0x20fe04[_0xe695('0x2d')][_0xe695('0x33')]){_0x3f3f33[_0xe695('0x34')]=[{'all':!![]}];}return db[_0xe695('0x3c')][_0xe695('0x28')](_0x3f3f33);})['then'](function(_0x2f9536){_0x375574[_0xe695('0x49')]=_0x2f9536;return _0x375574;});}})[_0xe695('0x1c')](respondWithFilteredResult(_0x1f448f,_0x3f3f33))[_0xe695('0x38')](handleError(_0x1f448f,null));};exports[_0xe695('0x4a')]=function(_0x35b786,_0x28c1ea){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x35b786[_0xe695('0x39')]['id']}})['then'](handleEntityNotFound(_0x28c1ea,null))[_0xe695('0x1c')](function(_0x5789a0){if(_0x5789a0){return _0x5789a0[_0xe695('0x4b')](_0x35b786['body'][_0xe695('0x3d')],_[_0xe695('0x3e')](_0x35b786[_0xe695('0x37')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xe695('0x28')]({'attributes':['id','name',_0xe695('0x4c')],'where':{'id':_0x35b786[_0xe695('0x37')]['ids']}});})[_0xe695('0x1c')](function(_0x4d542){socket['emit'](_0xe695('0x4d'),{'id':Number(_0x35b786['params']['id']),'tags':_0x4d542||[]});return{'id':Number(_0x35b786[_0xe695('0x39')]['id']),'tags':_0x4d542||[]};});}})[_0xe695('0x1c')](respondWithResult(_0x28c1ea,null))[_0xe695('0x38')](handleError(_0x28c1ea,null));};exports[_0xe695('0x4e')]=function(_0x48f399,_0x3a8503){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x48f399[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x3a8503,null))[_0xe695('0x1c')](function(_0x1c959b){if(_0x1c959b){return _0x1c959b['removeTags'](_0x48f399['query'][_0xe695('0x3d')]);}})[_0xe695('0x1c')](respondWithStatusCode(_0x3a8503,null))[_0xe695('0x38')](handleError(_0x3a8503,null));};exports[_0xe695('0x4f')]=function(_0x532b56,_0x4a0f39){var _0x120b60=moment()[_0xe695('0x50')]()[_0xe695('0x51')]();var _0x5bc3f9=path[_0xe695('0x52')](config[_0xe695('0x53')],_0xe695('0x54'),_0xe695('0x55'),_0xe695('0x56'));var _0x4d44ae=path[_0xe695('0x52')](config['root'],_0xe695('0x54'),_0xe695('0x55'),'attachments');var _0x294d84=path[_0xe695('0x52')](_0x5bc3f9,_0x120b60);var _0x1db292=util[_0xe695('0x57')](_0xe695('0x58'),_0x532b56[_0xe695('0x39')]['id'],_0x120b60);var _0x508e1e=path[_0xe695('0x52')](_0x5bc3f9,_0x1db292);var _0x17ae78=[];_0x17ae78[_0xe695('0x59')]({'model':db['Attachment'],'as':_0xe695('0x5a'),'raw':!![]});var _0x421a7f=[{'model':db[_0xe695('0x3c')],'as':'Messages','attributes':['id',_0xe695('0x37'),'createdAt'],'include':_0x17ae78}];return db[_0xe695('0x24')]['find']({'where':{'id':_0x532b56[_0xe695('0x39')]['id']},'include':_0x421a7f})['then'](handleEntityNotFound(_0x4a0f39,null))[_0xe695('0x1c')](function(_0x4dfa2a){if(_0x4dfa2a&&_0x4dfa2a[_0xe695('0x5b')]){var _0x370514=_0x4dfa2a[_0xe695('0x5c')]({'plain':!![]});fs['mkdirSync'](_0x294d84);for(var _0x2b903a=0x0;_0x2b903a<_0x370514[_0xe695('0x5b')][_0xe695('0x32')];_0x2b903a++){var _0x7bc012=_0x370514[_0xe695('0x5b')][_0x2b903a][_0xe695('0x5a')];if(_0x7bc012){var _0x466003=path[_0xe695('0x52')](_0x4d44ae,_0x7bc012[_0xe695('0x5d')]);if(fs[_0xe695('0x5e')](_0x466003)){fs[_0xe695('0x5f')](_0x466003)['pipe'](fs['createWriteStream'](path[_0xe695('0x52')](_0x294d84,_0x7bc012[_0xe695('0x5d')])));}}}return BPromise[_0xe695('0x60')]()[_0xe695('0x1c')](function(){return new BPromise(function(_0x361435,_0x2b38ff){zipdir(_0x294d84,{'saveTo':_0x508e1e},function(_0x2931fa,_0x5389a2){if(_0x2931fa)return _0x2b38ff(_0x2931fa);return _0x361435(_0x5389a2);});})[_0xe695('0x1c')](function(){return new BPromise(function(_0x4261ca,_0x4e2e7c){rimraf(_0x294d84,function(_0x5a1180){if(_0x5a1180)_0x4e2e7c(_0x5a1180);return _0x4261ca();});});})[_0xe695('0x1c')](function(){return _0x4a0f39[_0xe695('0x4f')](_0x508e1e,_0x1db292,function(_0x3687d5){if(_0x3687d5){console['log'](_0xe695('0x61'),_0x3687d5);}else{fs[_0xe695('0x62')](_0x508e1e);}});});});}else{return _0x4a0f39[_0xe695('0x11')](0xc8);}})[_0xe695('0x38')](handleError(_0x4a0f39,null));}; \ No newline at end of file +var _0x5068=['include','merge','options','find','catch','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','findAll','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','push','Attachment','createdAt','Messages','pipe','createWriteStream','basename','resolve','log','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','fax','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll'];(function(_0x56a71a,_0x216a9d){var _0x5aaa2d=function(_0x5d8311){while(--_0x5d8311){_0x56a71a['push'](_0x56a71a['shift']());}};_0x5aaa2d(++_0x216a9d);}(_0x5068,0x166));var _0x8506=function(_0x43768e,_0x274c86){_0x43768e=_0x43768e-0x0;var _0x1f79a1=_0x5068[_0x43768e];return _0x1f79a1;};'use strict';var rimraf=require(_0x8506('0x0'));var zipdir=require(_0x8506('0x1'));var moment=require('moment');var BPromise=require(_0x8506('0x2'));var util=require(_0x8506('0x3'));var path=require(_0x8506('0x4'));var fs=require('fs');var _=require(_0x8506('0x5'));var Redis=require(_0x8506('0x6'));var interaction=require(_0x8506('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x8506('0x8'))(_0x8506('0x9'));var config=require('../../config/environment');var db=require(_0x8506('0xa'))['db'];config[_0x8506('0xb')]=_['defaults'](config[_0x8506('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8506('0xc'))(new Redis(config[_0x8506('0xb')]));require('./faxInteraction.socket')[_0x8506('0xd')](socket);function respondWithStatusCode(_0x2d6785,_0x35f88a){_0x35f88a=_0x35f88a||0xcc;return function(_0x359bfe){if(_0x359bfe){return _0x2d6785[_0x8506('0xe')](_0x35f88a);}return _0x2d6785['status'](_0x35f88a)['end']();};}function respondWithResult(_0x1f260f,_0x51e6ca){_0x51e6ca=_0x51e6ca||0xc8;return function(_0x463827){if(_0x463827){return _0x1f260f[_0x8506('0xf')](_0x51e6ca)[_0x8506('0x10')](_0x463827);}};}function respondWithFilteredResult(_0x5374d0,_0x5362d6){return function(_0x478806){if(_0x478806){var _0x2ddfef=typeof _0x5362d6[_0x8506('0x11')]===_0x8506('0x12')&&typeof _0x5362d6[_0x8506('0x13')]===_0x8506('0x12');var _0x4a2e26=_0x478806[_0x8506('0x14')];var _0x3513b6=_0x2ddfef?0x0:_0x5362d6[_0x8506('0x11')];var _0x1aaaa1=_0x2ddfef?_0x478806[_0x8506('0x14')]:_0x5362d6[_0x8506('0x11')]+_0x5362d6[_0x8506('0x13')];var _0x3f888c;if(_0x1aaaa1>=_0x4a2e26){_0x1aaaa1=_0x4a2e26;_0x3f888c=0xc8;}else{_0x3f888c=0xce;}_0x5374d0['status'](_0x3f888c);return _0x5374d0['set'](_0x8506('0x15'),_0x3513b6+'-'+_0x1aaaa1+'/'+_0x4a2e26)['json'](_0x478806);}return null;};}function saveUpdates(_0x5c20dc){return function(_0x14c7bb){if(_0x14c7bb){return _0x14c7bb[_0x8506('0x16')](_0x5c20dc)[_0x8506('0x17')](function(_0xfeb3ca){return _0xfeb3ca;});}return null;};}function removeEntity(_0x474978){return function(_0x10af82){if(_0x10af82){return _0x10af82[_0x8506('0x18')]()[_0x8506('0x17')](function(){_0x474978[_0x8506('0xf')](0xcc)[_0x8506('0x19')]();});}};}function handleEntityNotFound(_0x569f09){return function(_0x16d77a){if(!_0x16d77a){_0x569f09[_0x8506('0xe')](0x194);}return _0x16d77a;};}function handleError(_0x3d2bba,_0x45cfea){_0x45cfea=_0x45cfea||0x1f4;return function(_0x37fe0a){logger[_0x8506('0x1a')](_0x37fe0a[_0x8506('0x1b')]);if(_0x37fe0a[_0x8506('0x1c')]){delete _0x37fe0a[_0x8506('0x1c')];}_0x3d2bba[_0x8506('0xf')](_0x45cfea)[_0x8506('0x1d')](_0x37fe0a);};}exports[_0x8506('0x1e')]=function(_0x3510b7,_0x29277c){var _0x236398={};var _0x281252=_[_0x8506('0x1f')](db[_0x8506('0x20')][_0x8506('0x21')],function(_0x384055){return{'name':_0x384055[_0x8506('0x22')],'type':_0x384055[_0x8506('0x23')]['key']};});_0x236398=qs[_0x8506('0x24')](_0x281252,_0x3510b7);return interaction['findAll'](_0x8506('0x25'),_0x3510b7[_0x8506('0x26')],_0x3510b7[_0x8506('0x27')],_0x236398,_0x281252)[_0x8506('0x17')](respondWithFilteredResult(_0x29277c,_0x236398))['catch'](handleError(_0x29277c,null));};exports[_0x8506('0x28')]=function(_0x50b653,_0x245641){var _0x3230cc={'raw':![],'where':{'id':_0x50b653[_0x8506('0x29')]['id']}},_0x326430={};_0x326430[_0x8506('0x2a')]=_['keys'](db['FaxInteraction'][_0x8506('0x21')]);_0x326430['query']=_[_0x8506('0x2b')](_0x50b653[_0x8506('0x26')]);_0x326430[_0x8506('0x2c')]=_[_0x8506('0x2d')](_0x326430['model'],_0x326430[_0x8506('0x26')]);_0x3230cc[_0x8506('0x2e')]=_[_0x8506('0x2d')](_0x326430[_0x8506('0x2a')],qs[_0x8506('0x2f')](_0x50b653[_0x8506('0x26')][_0x8506('0x2f')]));_0x3230cc[_0x8506('0x2e')]=_0x3230cc[_0x8506('0x2e')][_0x8506('0x30')]?_0x3230cc['attributes']:_0x326430[_0x8506('0x2a')];if(_0x50b653['query'][_0x8506('0x31')]){_0x3230cc[_0x8506('0x32')]=[{'all':!![]}];}_0x3230cc=_[_0x8506('0x33')]({},_0x3230cc,_0x50b653[_0x8506('0x34')]);return db[_0x8506('0x20')][_0x8506('0x35')](_0x3230cc)[_0x8506('0x17')](handleEntityNotFound(_0x245641,null))[_0x8506('0x17')](respondWithResult(_0x245641,null))[_0x8506('0x36')](handleError(_0x245641,null));};exports[_0x8506('0x37')]=function(_0x227973,_0x452f86){return db[_0x8506('0x20')]['create'](_0x227973[_0x8506('0x38')],{})[_0x8506('0x17')](respondWithResult(_0x452f86,0xc9))[_0x8506('0x36')](handleError(_0x452f86,null));};exports['update']=function(_0xec4ef2,_0x1a1503){if(_0xec4ef2[_0x8506('0x38')]['id']){delete _0xec4ef2[_0x8506('0x38')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0xec4ef2[_0x8506('0x29')]['id']}})[_0x8506('0x17')](handleEntityNotFound(_0x1a1503,null))[_0x8506('0x17')](saveUpdates(_0xec4ef2['body'],null))[_0x8506('0x17')](respondWithResult(_0x1a1503,null))[_0x8506('0x36')](handleError(_0x1a1503,null));};exports[_0x8506('0x18')]=function(_0x356db5,_0x5dbda6){return db['FaxInteraction'][_0x8506('0x35')]({'where':{'id':_0x356db5[_0x8506('0x29')]['id']}})['then'](handleEntityNotFound(_0x5dbda6,null))[_0x8506('0x17')](removeEntity(_0x5dbda6,null))[_0x8506('0x36')](handleError(_0x5dbda6,null));};exports[_0x8506('0x39')]=function(_0x4e4b50,_0x1afe6c){return db[_0x8506('0x20')][_0x8506('0x39')]()['then'](respondWithResult(_0x1afe6c,null))[_0x8506('0x36')](handleError(_0x1afe6c,null));};exports[_0x8506('0x3a')]=function(_0x335592,_0x3e1894){return db[_0x8506('0x3b')]['find']({'where':{'id':_0x335592[_0x8506('0x29')]['id']}})[_0x8506('0x17')](handleEntityNotFound(_0x3e1894,null))[_0x8506('0x17')](function(_0xa3bb80){if(_0xa3bb80){return _0xa3bb80['addMessage'](_0x335592['body'][_0x8506('0x3c')],_['omit'](_0x335592['body'],['ids','id'])||{});}})[_0x8506('0x17')](respondWithResult(_0x3e1894,null))[_0x8506('0x36')](handleError(_0x3e1894,null));};exports[_0x8506('0x3d')]=function(_0x5d9688,_0x321dec){var _0x2ffbc3={'raw':![],'where':{}};var _0x4788c2={};var _0x472cd3={'count':0x0,'rows':[]};return db[_0x8506('0x20')][_0x8506('0x3e')]({'where':{'id':_0x5d9688['params']['id']}})[_0x8506('0x17')](handleEntityNotFound(_0x321dec,null))[_0x8506('0x17')](function(_0xab19fd){if(_0xab19fd){_0x4788c2[_0x8506('0x2a')]=_[_0x8506('0x2b')](db[_0x8506('0x3b')]['rawAttributes']);_0x4788c2[_0x8506('0x26')]=_[_0x8506('0x2b')](_0x5d9688[_0x8506('0x26')]);_0x4788c2['filters']=_[_0x8506('0x2d')](_0x4788c2['model'],_0x4788c2[_0x8506('0x26')]);_0x2ffbc3['attributes']=_[_0x8506('0x2d')](_0x4788c2['model'],qs[_0x8506('0x2f')](_0x5d9688['query']['fields']));_0x2ffbc3[_0x8506('0x2e')]=_0x2ffbc3[_0x8506('0x2e')][_0x8506('0x30')]?_0x2ffbc3['attributes']:_0x4788c2[_0x8506('0x2a')];if(!_0x5d9688[_0x8506('0x26')][_0x8506('0x3f')](_0x8506('0x40'))){_0x2ffbc3['limit']=qs[_0x8506('0x13')](_0x5d9688[_0x8506('0x26')][_0x8506('0x13')]);_0x2ffbc3[_0x8506('0x11')]=qs[_0x8506('0x11')](_0x5d9688[_0x8506('0x26')]['offset']);}_0x2ffbc3[_0x8506('0x41')]=qs[_0x8506('0x42')](_0x5d9688[_0x8506('0x26')][_0x8506('0x42')]);_0x2ffbc3[_0x8506('0x43')]=qs[_0x8506('0x2c')](_[_0x8506('0x44')](_0x5d9688[_0x8506('0x26')],_0x4788c2[_0x8506('0x2c')]));_0x2ffbc3['where'][_0x8506('0x45')]=_0xab19fd['id'];if(_0x5d9688[_0x8506('0x26')][_0x8506('0x46')]){_0x2ffbc3[_0x8506('0x43')]=_[_0x8506('0x33')](_0x2ffbc3[_0x8506('0x43')],{'$or':_[_0x8506('0x1f')](_0x2ffbc3[_0x8506('0x2e')],function(_0x5d1f13){var _0x28d903={};_0x28d903[_0x5d1f13]={'$like':'%'+_0x5d9688['query']['filter']+'%'};return _0x28d903;})});}if(_0x5d9688[_0x8506('0x26')][_0x8506('0x47')]){var _0x5ac82c=_0x5d9688[_0x8506('0x26')]['$gte']['split'](',');var _0x7fcec9={};_0x7fcec9[_0x5ac82c[0x0]]={'$gte':moment(_0x5ac82c[0x1])[_0x8506('0x48')](_0x8506('0x49'))};_0x2ffbc3[_0x8506('0x43')]=_[_0x8506('0x33')](_0x2ffbc3[_0x8506('0x43')],_0x7fcec9);}_0x2ffbc3=_[_0x8506('0x33')]({},_0x2ffbc3,_0x5d9688[_0x8506('0x34')]);return db[_0x8506('0x3b')][_0x8506('0x14')]({'where':_0x2ffbc3['where']})[_0x8506('0x17')](function(_0x448b19){_0x472cd3[_0x8506('0x14')]=_0x448b19;if(_0x5d9688[_0x8506('0x26')][_0x8506('0x31')]){_0x2ffbc3[_0x8506('0x32')]=[{'all':!![]}];}return db[_0x8506('0x3b')]['findAll'](_0x2ffbc3);})[_0x8506('0x17')](function(_0x3dcc1c){_0x472cd3[_0x8506('0x4a')]=_0x3dcc1c;return _0x472cd3;});}})[_0x8506('0x17')](respondWithFilteredResult(_0x321dec,_0x2ffbc3))[_0x8506('0x36')](handleError(_0x321dec,null));};exports[_0x8506('0x4b')]=function(_0x193bd9,_0x65da75){return db[_0x8506('0x20')][_0x8506('0x35')]({'where':{'id':_0x193bd9[_0x8506('0x29')]['id']}})[_0x8506('0x17')](handleEntityNotFound(_0x65da75,null))['then'](function(_0x42b3f4){if(_0x42b3f4){return _0x42b3f4[_0x8506('0x4c')](_0x193bd9[_0x8506('0x38')][_0x8506('0x3c')],_[_0x8506('0x4d')](_0x193bd9['body'],[_0x8506('0x3c'),'id'])||{})['spread'](function(){return db[_0x8506('0x4e')][_0x8506('0x4f')]({'attributes':['id',_0x8506('0x1c'),_0x8506('0x50')],'where':{'id':_0x193bd9[_0x8506('0x38')][_0x8506('0x3c')]}});})[_0x8506('0x17')](function(_0x4d987a){socket['emit'](_0x8506('0x51'),{'id':Number(_0x193bd9['params']['id']),'tags':_0x4d987a||[]});return{'id':Number(_0x193bd9['params']['id']),'tags':_0x4d987a||[]};});}})['then'](respondWithResult(_0x65da75,null))[_0x8506('0x36')](handleError(_0x65da75,null));};exports[_0x8506('0x52')]=function(_0x28a482,_0x20f4b8){return db[_0x8506('0x20')][_0x8506('0x35')]({'where':{'id':_0x28a482[_0x8506('0x29')]['id']}})[_0x8506('0x17')](handleEntityNotFound(_0x20f4b8,null))[_0x8506('0x17')](function(_0x408c25){if(_0x408c25){return _0x408c25[_0x8506('0x52')](_0x28a482[_0x8506('0x26')][_0x8506('0x3c')]);}})['then'](respondWithStatusCode(_0x20f4b8,null))[_0x8506('0x36')](handleError(_0x20f4b8,null));};exports[_0x8506('0x53')]=function(_0xbf2c4f,_0x543f9e){var _0x58683f=moment()[_0x8506('0x54')]()[_0x8506('0x55')]();var _0x241479=path[_0x8506('0x56')](config[_0x8506('0x57')],'server',_0x8506('0x58'),_0x8506('0x59'));var _0x1f7b2d=path[_0x8506('0x56')](config[_0x8506('0x57')],_0x8506('0x5a'),_0x8506('0x58'),_0x8506('0x5b'));var _0x193398=path[_0x8506('0x56')](_0x241479,_0x58683f);var _0x3ae887=util[_0x8506('0x48')]('transcript-%d-%s.zip',_0xbf2c4f[_0x8506('0x29')]['id'],_0x58683f);var _0x2a4476=path[_0x8506('0x56')](_0x241479,_0x3ae887);var _0x2e203e=[];_0x2e203e[_0x8506('0x5c')]({'model':db[_0x8506('0x5d')],'as':_0x8506('0x5d'),'raw':!![]});var _0x13d3c9=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x8506('0x38'),_0x8506('0x5e')],'include':_0x2e203e}];return db['FaxInteraction'][_0x8506('0x35')]({'where':{'id':_0xbf2c4f[_0x8506('0x29')]['id']},'include':_0x13d3c9})[_0x8506('0x17')](handleEntityNotFound(_0x543f9e,null))[_0x8506('0x17')](function(_0x21070c){if(_0x21070c&&_0x21070c['Messages']){var _0x374643=_0x21070c['get']({'plain':!![]});fs['mkdirSync'](_0x193398);for(var _0x570a40=0x0;_0x570a40<_0x374643[_0x8506('0x5f')][_0x8506('0x30')];_0x570a40++){var _0x26de00=_0x374643[_0x8506('0x5f')][_0x570a40][_0x8506('0x5d')];if(_0x26de00){var _0x4b5ccc=path['join'](_0x1f7b2d,_0x26de00['basename']);if(fs['existsSync'](_0x4b5ccc)){fs['createReadStream'](_0x4b5ccc)[_0x8506('0x60')](fs[_0x8506('0x61')](path['join'](_0x193398,_0x26de00[_0x8506('0x62')])));}}}return BPromise[_0x8506('0x63')]()[_0x8506('0x17')](function(){return new BPromise(function(_0x271630,_0xe3c2db){zipdir(_0x193398,{'saveTo':_0x2a4476},function(_0x192374,_0x559487){if(_0x192374)return _0xe3c2db(_0x192374);return _0x271630(_0x559487);});})[_0x8506('0x17')](function(){return new BPromise(function(_0x500248,_0x2a69e7){rimraf(_0x193398,function(_0x1c1947){if(_0x1c1947)_0x2a69e7(_0x1c1947);return _0x500248();});});})['then'](function(){return _0x543f9e[_0x8506('0x53')](_0x2a4476,_0x3ae887,function(_0x957294){if(_0x957294){console[_0x8506('0x64')]('err',_0x957294);}else{fs[_0x8506('0x65')](_0x2a4476);}});});});}else{return _0x543f9e[_0x8506('0xe')](0xc8);}})[_0x8506('0x36')](handleError(_0x543f9e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 63518c1..0c9e58b 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 _0xaf8a=['hook','exports','../../mysqldb','FaxMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5c0d70,_0x5effb1){var _0xd4b206=function(_0x54003d){while(--_0x54003d){_0x5c0d70['push'](_0x5c0d70['shift']());}};_0xd4b206(++_0x5effb1);}(_0xaf8a,0x68));var _0xaaf8=function(_0x5f4eda,_0x47b8c9){_0x5f4eda=_0x5f4eda-0x0;var _0x1fd698=_0xaf8a[_0x5f4eda];return _0x1fd698;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xaaf8('0x0'))['db'][_0xaaf8('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaaf8('0x2'),'afterUpdate':'update','afterDestroy':_0xaaf8('0x3')};function emitEvent(_0x10b57b){return function(_0x3e6eef,_0x31ad46,_0x2d1331){_0x3e6eef[_0xaaf8('0x4')]({'attributes':['id'],'raw':!![]})[_0xaaf8('0x5')](function(_0x47779f){_0x3e6eef[_0xaaf8('0x6')](_0xaaf8('0x7'),_0x47779f[_0xaaf8('0x8')](function(_0x4ea563){return{'id':_0x4ea563['id']};}));return FaxMessage[_0xaaf8('0x9')]({'where':{'FaxInteractionId':_0x3e6eef['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaaf8('0x5')](function(_0x10e6ea){_0x3e6eef['setDataValue'](_0xaaf8('0xa'),_0x10e6ea[_0xaaf8('0xb')]);FaxInteractionEvents[_0xaaf8('0xc')](_0x10b57b+':'+_0x3e6eef['id'],_0x3e6eef);FaxInteractionEvents[_0xaaf8('0xc')](_0x10b57b,_0x3e6eef);_0x2d1331(null);})[_0xaaf8('0xd')](_0x2d1331(null));};}for(var e in events){if(events[_0xaaf8('0xe')](e)){var event=events[e];FaxInteraction[_0xaaf8('0xf')](e,emitEvent(event));}}module[_0xaaf8('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x533f=['findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x50e557,_0x12b242){var _0x1b1121=function(_0x29c0fe){while(--_0x29c0fe){_0x50e557['push'](_0x50e557['shift']());}};_0x1b1121(++_0x12b242);}(_0x533f,0x111));var _0xf533=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x533f[_0xcfe8cc];return _0x55ac53;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf533('0x0'))['db'][_0xf533('0x1')];var FaxMessage=require(_0xf533('0x0'))['db'][_0xf533('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf533('0x3')](0x0);var events={'afterCreate':_0xf533('0x4'),'afterUpdate':_0xf533('0x5'),'afterDestroy':_0xf533('0x6')};function emitEvent(_0x292850){return function(_0x38bc54,_0x4c03a2,_0x4faf5a){_0x38bc54[_0xf533('0x7')]({'attributes':['id'],'raw':!![]})[_0xf533('0x8')](function(_0x56ac36){_0x38bc54[_0xf533('0x9')](_0xf533('0xa'),_0x56ac36[_0xf533('0xb')](function(_0xda9cc8){return{'id':_0xda9cc8['id']};}));return FaxMessage[_0xf533('0xc')]({'where':{'FaxInteractionId':_0x38bc54['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf533('0x8')](function(_0x2a660a){_0x38bc54[_0xf533('0x9')](_0xf533('0xd'),_0x2a660a[_0xf533('0xe')]);FaxInteractionEvents['emit'](_0x292850+':'+_0x38bc54['id'],_0x38bc54);FaxInteractionEvents[_0xf533('0xf')](_0x292850,_0x38bc54);_0x4faf5a(null);})[_0xf533('0x10')](_0x4faf5a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xf533('0x11')](e,emitEvent(event));}}module[_0xf533('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6ce62bc..7d980e9 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 _0x7a5b=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x1dc3a1,_0x588a78){var _0x27b58f=function(_0x48b9b0){while(--_0x48b9b0){_0x1dc3a1['push'](_0x1dc3a1['shift']());}};_0x27b58f(++_0x588a78);}(_0x7a5b,0x1d3));var _0xb7a5=function(_0x133638,_0x418b24){_0x133638=_0x133638-0x0;var _0x2e276d=_0x7a5b[_0x133638];return _0x2e276d;};'use strict';var _=require(_0xb7a5('0x0'));var util=require(_0xb7a5('0x1'));var logger=require('../../config/logger')(_0xb7a5('0x2'));var moment=require(_0xb7a5('0x3'));var BPromise=require(_0xb7a5('0x4'));var rp=require(_0xb7a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7a5('0x6'));var config=require(_0xb7a5('0x7'));var attributes=require(_0xb7a5('0x8'));module[_0xb7a5('0x9')]=function(_0x4eadcc,_0x166f5f){return _0x4eadcc[_0xb7a5('0xa')](_0xb7a5('0xb'),attributes,{'tableName':_0xb7a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ea68b,_0x36ec12,_0x3d2445){if(_0x1ea68b['changed'](_0xb7a5('0xd'))){_0x1ea68b['closedAt']=moment()[_0xb7a5('0xe')](_0xb7a5('0xf'));}_0x3d2445(null,_0x1ea68b);}}});}; \ No newline at end of file +var _0xe02a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x392b6d,_0x55c00f){var _0x12f976=function(_0x194d75){while(--_0x194d75){_0x392b6d['push'](_0x392b6d['shift']());}};_0x12f976(++_0x55c00f);}(_0xe02a,0xa3));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xae02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae02('0x1'));var rp=require(_0xae02('0x2'));var fs=require('fs');var path=require(_0xae02('0x3'));var rimraf=require(_0xae02('0x4'));var config=require(_0xae02('0x5'));var attributes=require(_0xae02('0x6'));module[_0xae02('0x7')]=function(_0x1894b4,_0x2ad7f4){return _0x1894b4[_0xae02('0x8')](_0xae02('0x9'),attributes,{'tableName':_0xae02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24befe,_0x244971,_0x7dbfe6){if(_0x24befe[_0xae02('0xb')](_0xae02('0xc'))){_0x24befe[_0xae02('0xd')]=moment()[_0xae02('0xe')](_0xae02('0xf'));}_0x7dbfe6(null,_0x24befe);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6f4ece2..94169ca 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 _0x7f0d=['code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','stringify','AddTagsToFaxInteraction','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7f0d,0x149));var _0xd7f0=function(_0x59ee2a,_0x5e4411){_0x59ee2a=_0x59ee2a-0x0;var _0x1f3c02=_0x7f0d[_0x59ee2a];return _0x1f3c02;};'use strict';var _=require(_0xd7f0('0x0'));var util=require(_0xd7f0('0x1'));var moment=require(_0xd7f0('0x2'));var BPromise=require(_0xd7f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f0('0x4'));var db=require(_0xd7f0('0x5'))['db'];var utils=require(_0xd7f0('0x6'));var logger=require(_0xd7f0('0x7'))('rpc');var config=require(_0xd7f0('0x8'));var jayson=require(_0xd7f0('0x9'));var client=jayson[_0xd7f0('0xa')][_0xd7f0('0xb')]({'port':0x232a});config[_0xd7f0('0xc')]=_[_0xd7f0('0xd')](config[_0xd7f0('0xc')],{'host':_0xd7f0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xd7f0('0xf')](socket);function respondWithRpcPromise(_0x1dd84d,_0x414d89,_0x18f633){return new BPromise(function(_0x4b9bcb,_0x43ec79){return client[_0xd7f0('0x10')](_0x1dd84d,_0x18f633)[_0xd7f0('0x11')](function(_0x36725e){logger[_0xd7f0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0xd7f0('0x13'));logger['debug'](_0xd7f0('0x14'),_0x414d89,_0xd7f0('0x13'),JSON['stringify'](_0x36725e));if(_0x36725e[_0xd7f0('0x15')]){if(_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x16')]===0x1f4){logger[_0xd7f0('0x15')](_0xd7f0('0x17'),_0x414d89,_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x18')]);return _0x43ec79(_0x36725e['error'][_0xd7f0('0x18')]);}logger[_0xd7f0('0x15')](_0xd7f0('0x17'),_0x414d89,_0x36725e[_0xd7f0('0x15')]['message']);return _0x4b9bcb(_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x18')]);}else{logger[_0xd7f0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0xd7f0('0x13'));_0x4b9bcb(_0x36725e[_0xd7f0('0x19')][_0xd7f0('0x18')]);}})['catch'](function(_0x52a49f){logger[_0xd7f0('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0x52a49f);_0x43ec79(_0x52a49f);});});}exports[_0xd7f0('0x1a')]=function(_0x5919b2){var _0x258a41=this;return new Promise(function(_0x2db7cc,_0x3031c8){return db[_0xd7f0('0x1b')]['update'](_0x5919b2[_0xd7f0('0x1c')],{'raw':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2[_0xd7f0('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5919b2['options']?_0x5919b2[_0xd7f0('0x1d')][_0xd7f0('0x1e')]||null:null,'attributes':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2[_0xd7f0('0x1d')][_0xd7f0('0x1f')]||null:null,'limit':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2['options']['limit']||null:null})[_0xd7f0('0x11')](function(_0x1196c5){logger[_0xd7f0('0x12')](_0xd7f0('0x1a'),_0x5919b2);logger['debug']('UpdateFaxInteraction',_0x5919b2,JSON[_0xd7f0('0x20')](_0x1196c5));_0x2db7cc(_0x1196c5);})['catch'](function(_0x56c9e8){logger[_0xd7f0('0x15')](_0xd7f0('0x1a'),_0x56c9e8[_0xd7f0('0x18')],_0x5919b2);_0x3031c8(_0x258a41[_0xd7f0('0x15')](0x1f4,_0x56c9e8[_0xd7f0('0x18')]));});});};exports[_0xd7f0('0x21')]=function(_0x991b5f){return new Promise(function(_0x4ce05b,_0x18dce9){return db['FaxInteraction']['find']({'where':_0x991b5f[_0xd7f0('0x1d')]?_0x991b5f['options']['where']||null:null})[_0xd7f0('0x11')](function(_0x3134e8){if(_0x3134e8){return _0x3134e8['addTags'](_0x991b5f['body']['ids'],_[_0xd7f0('0x22')](_0x991b5f[_0xd7f0('0x1c')],[_0xd7f0('0x23'),'id'])||{});}})[_0xd7f0('0x24')](function(_0x34e96d){logger[_0xd7f0('0x12')](_0xd7f0('0x25'),_0x991b5f);logger['debug']('AddTags',_0x991b5f,JSON[_0xd7f0('0x20')](_0x34e96d));_0x4ce05b(_0x34e96d);})[_0xd7f0('0x26')](function(_0x46c0f9){logger[_0xd7f0('0x15')](_0xd7f0('0x25'),_0x46c0f9[_0xd7f0('0x18')],_0x991b5f);_0x18dce9(_this[_0xd7f0('0x15')](0x1f4,_0x46c0f9[_0xd7f0('0x18')]));});});}; \ No newline at end of file +var _0x5b80=['options','where','limit','stringify','FaxInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','body'];(function(_0x56e6e4,_0x18dc9b){var _0x1bdb3e=function(_0x43d3d1){while(--_0x43d3d1){_0x56e6e4['push'](_0x56e6e4['shift']());}};_0x1bdb3e(++_0x18dc9b);}(_0x5b80,0x1de));var _0x05b8=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x5b80[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x05b8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x05b8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x05b8('0x3'))(_0x05b8('0x4'));var config=require(_0x05b8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x05b8('0x6')][_0x05b8('0x7')]({'port':0x232a});config[_0x05b8('0x8')]=_[_0x05b8('0x9')](config['redis'],{'host':_0x05b8('0xa'),'port':0x18eb});var socket=require(_0x05b8('0xb'))(new Redis(config['redis']));require(_0x05b8('0xc'))[_0x05b8('0xd')](socket);function respondWithRpcPromise(_0x35ffe1,_0x2e36d2,_0x19ce76){return new BPromise(function(_0x1159ee,_0x5c7413){return client[_0x05b8('0xe')](_0x35ffe1,_0x19ce76)[_0x05b8('0xf')](function(_0xe73554){logger[_0x05b8('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x2e36d2,_0x05b8('0x11'));logger[_0x05b8('0x12')](_0x05b8('0x13'),_0x2e36d2,_0x05b8('0x11'),JSON['stringify'](_0xe73554));if(_0xe73554[_0x05b8('0x14')]){if(_0xe73554[_0x05b8('0x14')][_0x05b8('0x15')]===0x1f4){logger['error'](_0x05b8('0x16'),_0x2e36d2,_0xe73554['error'][_0x05b8('0x17')]);return _0x5c7413(_0xe73554['error'][_0x05b8('0x17')]);}logger[_0x05b8('0x14')](_0x05b8('0x16'),_0x2e36d2,_0xe73554[_0x05b8('0x14')][_0x05b8('0x17')]);return _0x1159ee(_0xe73554[_0x05b8('0x14')][_0x05b8('0x17')]);}else{logger[_0x05b8('0x10')](_0x05b8('0x16'),_0x2e36d2,_0x05b8('0x11'));_0x1159ee(_0xe73554[_0x05b8('0x18')][_0x05b8('0x17')]);}})[_0x05b8('0x19')](function(_0x3b6a4e){logger['error'](_0x05b8('0x16'),_0x2e36d2,_0x3b6a4e);_0x5c7413(_0x3b6a4e);});});}exports[_0x05b8('0x1a')]=function(_0x3ef466){var _0x2759f6=this;return new Promise(function(_0x3b83e1,_0x2725d2){return db['FaxInteraction'][_0x05b8('0x1b')](_0x3ef466[_0x05b8('0x1c')],{'raw':_0x3ef466[_0x05b8('0x1d')]?_0x3ef466[_0x05b8('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef466[_0x05b8('0x1d')]?_0x3ef466['options'][_0x05b8('0x1e')]||null:null,'attributes':_0x3ef466['options']?_0x3ef466[_0x05b8('0x1d')]['attributes']||null:null,'limit':_0x3ef466[_0x05b8('0x1d')]?_0x3ef466[_0x05b8('0x1d')][_0x05b8('0x1f')]||null:null})['then'](function(_0x32d804){logger[_0x05b8('0x10')](_0x05b8('0x1a'),_0x3ef466);logger['debug'](_0x05b8('0x1a'),_0x3ef466,JSON[_0x05b8('0x20')](_0x32d804));_0x3b83e1(_0x32d804);})[_0x05b8('0x19')](function(_0x9877ce){logger[_0x05b8('0x14')](_0x05b8('0x1a'),_0x9877ce[_0x05b8('0x17')],_0x3ef466);_0x2725d2(_0x2759f6[_0x05b8('0x14')](0x1f4,_0x9877ce[_0x05b8('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x19d928){return new Promise(function(_0x3dde2b,_0x5d9c43){return db[_0x05b8('0x21')][_0x05b8('0x22')]({'where':_0x19d928['options']?_0x19d928[_0x05b8('0x1d')][_0x05b8('0x1e')]||null:null})[_0x05b8('0xf')](function(_0x4bdeac){if(_0x4bdeac){return _0x4bdeac['addTags'](_0x19d928[_0x05b8('0x1c')][_0x05b8('0x23')],_[_0x05b8('0x24')](_0x19d928['body'],['ids','id'])||{});}})[_0x05b8('0x25')](function(_0x4b4af7){logger['info']('AddTags',_0x19d928);logger[_0x05b8('0x12')](_0x05b8('0x26'),_0x19d928,JSON['stringify'](_0x4b4af7));_0x3dde2b(_0x4b4af7);})[_0x05b8('0x19')](function(_0x5da8e0){logger[_0x05b8('0x14')](_0x05b8('0x26'),_0x5da8e0[_0x05b8('0x17')],_0x19d928);_0x5d9c43(_this[_0x05b8('0x14')](0x1f4,_0x5da8e0[_0x05b8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 616de7d..ccb4366 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 _0x85d8=['length','./faxInteraction.events','save','remove','update','emit'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x85d8,0x139));var _0x885d=function(_0x1bd645,_0x54a918){_0x1bd645=_0x1bd645-0x0;var _0x974dae=_0x85d8[_0x1bd645];return _0x974dae;};'use strict';var FaxInteractionEvents=require(_0x885d('0x0'));var events=[_0x885d('0x1'),_0x885d('0x2'),_0x885d('0x3')];function createListener(_0x57687e,_0x16b02d){return function(_0x194635){_0x16b02d[_0x885d('0x4')](_0x57687e,_0x194635);};}function removeListener(_0xad4bee,_0x42be9a){return function(){FaxInteractionEvents['removeListener'](_0xad4bee,_0x42be9a);};}exports['register']=function(_0x15020e){for(var _0x1a6296=0x0,_0x54fb95=events[_0x885d('0x5')];_0x1a6296<_0x54fb95;_0x1a6296++){var _0x3eaee8=events[_0x1a6296];var _0x5c0674=createListener('faxInteraction:'+_0x3eaee8,_0x15020e);FaxInteractionEvents['on'](_0x3eaee8,_0x5c0674);}}; \ No newline at end of file +var _0xef62=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x51156d,_0xe9e50){var _0x598764=function(_0x4058af){while(--_0x4058af){_0x51156d['push'](_0x51156d['shift']());}};_0x598764(++_0xe9e50);}(_0xef62,0x105));var _0x2ef6=function(_0x3d537b,_0x5d2728){_0x3d537b=_0x3d537b-0x0;var _0x5d2e69=_0xef62[_0x3d537b];return _0x5d2e69;};'use strict';var FaxInteractionEvents=require(_0x2ef6('0x0'));var events=[_0x2ef6('0x1'),'remove',_0x2ef6('0x2')];function createListener(_0x1a3fa1,_0x370676){return function(_0x16c7ff){_0x370676[_0x2ef6('0x3')](_0x1a3fa1,_0x16c7ff);};}function removeListener(_0x26945d,_0xaa378){return function(){FaxInteractionEvents[_0x2ef6('0x4')](_0x26945d,_0xaa378);};}exports[_0x2ef6('0x5')]=function(_0x455a7c){for(var _0xbda672=0x0,_0x44fbbb=events[_0x2ef6('0x6')];_0xbda672<_0x44fbbb;_0xbda672++){var _0x4848e3=events[_0xbda672];var _0x70a1b4=createListener(_0x2ef6('0x7')+_0x4848e3,_0x455a7c);FaxInteractionEvents['on'](_0x4848e3,_0x70a1b4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 894e4c9..1926426 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 _0x0bb2=['destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0bb2,0x16b));var _0x20bb=function(_0x22fc57,_0x50974f){_0x22fc57=_0x22fc57-0x0;var _0x10932c=_0x0bb2[_0x22fc57];return _0x10932c;};'use strict';var multer=require('multer');var util=require(_0x20bb('0x0'));var path=require(_0x20bb('0x1'));var timeout=require('connect-timeout');var express=require(_0x20bb('0x2'));var router=express[_0x20bb('0x3')]();var fs_extra=require(_0x20bb('0x4'));var auth=require(_0x20bb('0x5'));var interaction=require(_0x20bb('0x6'));var config=require(_0x20bb('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x20bb('0x8')](),controller['index']);router[_0x20bb('0x9')](_0x20bb('0xa'),auth[_0x20bb('0x8')](),controller['describe']);router[_0x20bb('0x9')]('/:id',auth[_0x20bb('0x8')](),controller[_0x20bb('0xb')]);router['get'](_0x20bb('0xc'),auth[_0x20bb('0x8')](),controller['getMessages']);router[_0x20bb('0x9')](_0x20bb('0xd'),auth[_0x20bb('0x8')](),controller['download']);router['post']('/',auth[_0x20bb('0x8')](),controller['create']);router[_0x20bb('0xe')](_0x20bb('0xc'),auth['isAuthenticated'](),controller[_0x20bb('0xf')]);router[_0x20bb('0xe')](_0x20bb('0x10'),auth['isAuthenticated'](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x13')),controller[_0x20bb('0x14')]);router[_0x20bb('0x15')](_0x20bb('0x16'),auth[_0x20bb('0x8')](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x17')),controller[_0x20bb('0x18')]);router[_0x20bb('0x19')](_0x20bb('0x16'),auth['isAuthenticated'](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x1a')),controller[_0x20bb('0x1b')]);router['delete'](_0x20bb('0x10'),auth['isAuthenticated'](),controller[_0x20bb('0x1c')]);module[_0x20bb('0x1d')]=router; \ No newline at end of file +var _0xe06f=['addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','fax'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe06f,0x65));var _0xfe06=function(_0x441ae,_0x2f2209){_0x441ae=_0x441ae-0x0;var _0x418a32=_0xe06f[_0x441ae];return _0x418a32;};'use strict';var multer=require(_0xfe06('0x0'));var util=require(_0xfe06('0x1'));var path=require('path');var timeout=require(_0xfe06('0x2'));var express=require('express');var router=express[_0xfe06('0x3')]();var fs_extra=require(_0xfe06('0x4'));var auth=require(_0xfe06('0x5'));var interaction=require(_0xfe06('0x6'));var config=require(_0xfe06('0x7'));var controller=require(_0xfe06('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfe06('0x9')](_0xfe06('0xa'),auth[_0xfe06('0xb')](),controller[_0xfe06('0xc')]);router[_0xfe06('0x9')](_0xfe06('0xd'),auth['isAuthenticated'](),controller[_0xfe06('0xe')]);router[_0xfe06('0x9')](_0xfe06('0xf'),auth[_0xfe06('0xb')](),controller['getMessages']);router[_0xfe06('0x9')](_0xfe06('0x10'),auth[_0xfe06('0xb')](),controller[_0xfe06('0x11')]);router[_0xfe06('0x12')]('/',auth[_0xfe06('0xb')](),controller[_0xfe06('0x13')]);router[_0xfe06('0x12')]('/:id/messages',auth[_0xfe06('0xb')](),controller[_0xfe06('0x14')]);router[_0xfe06('0x12')](_0xfe06('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xfe06('0x16'),'faxinteraction:addtags'),controller[_0xfe06('0x17')]);router[_0xfe06('0x18')](_0xfe06('0xd'),auth['isAuthenticated'](),interaction[_0xfe06('0x19')](_0xfe06('0x16'),_0xfe06('0x1a')),controller[_0xfe06('0x1b')]);router[_0xfe06('0x1c')](_0xfe06('0xd'),auth[_0xfe06('0xb')](),interaction['tracked'](_0xfe06('0x16'),_0xfe06('0x1d')),controller[_0xfe06('0x1e')]);router[_0xfe06('0x1c')](_0xfe06('0x15'),auth['isAuthenticated'](),controller['removeTags']);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 5e3a716..c08c93a 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 _0xecd5=['ENUM','out','exports','TEXT','medium'];(function(_0x37ce96,_0x5082d6){var _0x15d885=function(_0x5452bd){while(--_0x5452bd){_0x37ce96['push'](_0x37ce96['shift']());}};_0x15d885(++_0x5082d6);}(_0xecd5,0x110));var _0x5ecd=function(_0x33c0d3,_0x62e06){_0x33c0d3=_0x33c0d3-0x0;var _0x1c5b91=_0xecd5[_0x33c0d3];return _0x1c5b91;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'body':{'type':Sequelize[_0x5ecd('0x1')](_0x5ecd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ecd('0x3')]('in',_0x5ecd('0x4')),'defaultValue':_0x5ecd('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5ecd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6282=['TEXT','medium','out','DATE','sequelize','exports'];(function(_0x271f2b,_0x26c47b){var _0x3c3141=function(_0x45c716){while(--_0x45c716){_0x271f2b['push'](_0x271f2b['shift']());}};_0x3c3141(++_0x26c47b);}(_0x6282,0x76));var _0x2628=function(_0xfc15a4,_0x4daaa6){_0xfc15a4=_0xfc15a4-0x0;var _0xb14508=_0x6282[_0xfc15a4];return _0xb14508;};'use strict';var Sequelize=require(_0x2628('0x0'));module[_0x2628('0x1')]={'body':{'type':Sequelize[_0x2628('0x2')](_0x2628('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2628('0x4')),'defaultValue':_0x2628('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x2628('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 376bcad..4d4a2db 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 _0x6fe9=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','User','fullname','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','server','attachments','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','find','update','body','params','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x42e35a,_0x3e3085){var _0x408359=function(_0x31d4ae){while(--_0x31d4ae){_0x42e35a['push'](_0x42e35a['shift']());}};_0x408359(++_0x3e3085);}(_0x6fe9,0x145));var _0x96fe=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6fe9[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x96fe('0x0'));var rimraf=require(_0x96fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96fe('0x2'));var rp=require('request-promise');var moment=require(_0x96fe('0x3'));var BPromise=require(_0x96fe('0x4'));var Mustache=require('mustache');var util=require(_0x96fe('0x5'));var path=require(_0x96fe('0x6'));var sox=require(_0x96fe('0x7'));var csv=require(_0x96fe('0x8'));var ejs=require(_0x96fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96fe('0xa'));var squel=require(_0x96fe('0xb'));var crypto=require(_0x96fe('0xc'));var jsforce=require(_0x96fe('0xd'));var deskjs=require(_0x96fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x96fe('0xf'));var Redis=require(_0x96fe('0x10'));var authService=require(_0x96fe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x96fe('0x12'));var hardwareService=require(_0x96fe('0x13'));var logger=require(_0x96fe('0x14'))(_0x96fe('0x15'));var utils=require(_0x96fe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x96fe('0x17'));var db=require(_0x96fe('0x18'))['db'];config[_0x96fe('0x19')]=_[_0x96fe('0x1a')](config[_0x96fe('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96fe('0x1b'))(new Redis(config[_0x96fe('0x19')]));require(_0x96fe('0x1c'))[_0x96fe('0x1d')](socket);var jayson=require(_0x96fe('0x1e'));var client=jayson['client'][_0x96fe('0x1f')]({'port':0x232c});var client9002=jayson[_0x96fe('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250dbd,_0x2ed4dd,_0x5d37de,_0x56c4d5){return new BPromise(function(_0x3e18a6,_0x1aaebe){var _0x6772b0=_0x56c4d5||client;return _0x6772b0[_0x96fe('0x21')](_0x250dbd,_0x5d37de)['then'](function(_0x22957f){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2ed4dd,_0x96fe('0x22'));logger[_0x96fe('0x23')](_0x96fe('0x24'),_0x2ed4dd,_0x96fe('0x22'),JSON[_0x96fe('0x25')](_0x22957f));if(_0x22957f[_0x96fe('0x26')]){if(_0x22957f[_0x96fe('0x26')][_0x96fe('0x27')]===0x1f4){logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x22957f['error'][_0x96fe('0x29')]);return _0x1aaebe(_0x22957f[_0x96fe('0x26')][_0x96fe('0x29')]);}logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x22957f['error'][_0x96fe('0x29')]);return _0x3e18a6(_0x22957f['error'][_0x96fe('0x29')]);}else{logger[_0x96fe('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x2ed4dd,_0x96fe('0x22'));_0x3e18a6(_0x22957f[_0x96fe('0x2b')][_0x96fe('0x29')]);}})[_0x96fe('0x2c')](function(_0x5594c8){logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x5594c8);_0x1aaebe(_0x5594c8);});});}function respondWithStatusCode(_0x4f7730,_0x1a49fe){_0x1a49fe=_0x1a49fe||0xcc;return function(_0xff4c20){if(_0xff4c20){return _0x4f7730[_0x96fe('0x2d')](_0x1a49fe);}return _0x4f7730[_0x96fe('0x2e')](_0x1a49fe)[_0x96fe('0x2f')]();};}function respondWithResult(_0x3d93e5,_0x519b7a){_0x519b7a=_0x519b7a||0xc8;return function(_0x5cb3fb){if(_0x5cb3fb){return _0x3d93e5[_0x96fe('0x2e')](_0x519b7a)[_0x96fe('0x30')](_0x5cb3fb);}};}function respondWithFilteredResult(_0x444cd6,_0x118bfb){return function(_0x4a7bcf){if(_0x4a7bcf){var _0x552713=typeof _0x118bfb[_0x96fe('0x31')]===_0x96fe('0x32')&&typeof _0x118bfb[_0x96fe('0x33')]===_0x96fe('0x32');var _0x26c80b=_0x4a7bcf[_0x96fe('0x34')];var _0xb3953b=_0x552713?0x0:_0x118bfb[_0x96fe('0x31')];var _0x2e380c=_0x552713?_0x4a7bcf['count']:_0x118bfb[_0x96fe('0x31')]+_0x118bfb[_0x96fe('0x33')];var _0x4c4f0f;if(_0x2e380c>=_0x26c80b){_0x2e380c=_0x26c80b;_0x4c4f0f=0xc8;}else{_0x4c4f0f=0xce;}_0x444cd6['status'](_0x4c4f0f);return _0x444cd6[_0x96fe('0x35')]('Content-Range',_0xb3953b+'-'+_0x2e380c+'/'+_0x26c80b)[_0x96fe('0x30')](_0x4a7bcf);}return null;};}function patchUpdates(_0x4cc61c){return function(_0x548d63){try{jsonpatch[_0x96fe('0x36')](_0x548d63,_0x4cc61c,!![]);}catch(_0x4f5841){return BPromise[_0x96fe('0x37')](_0x4f5841);}return _0x548d63[_0x96fe('0x38')]();};}function saveUpdates(_0x358e1e,_0x307332){return function(_0x54515d){if(_0x54515d){return _0x54515d['update'](_0x358e1e)['then'](function(_0x106274){return _0x106274;});}return null;};}function removeEntity(_0x1db5a3,_0xebcc8c){return function(_0x57fe22){if(_0x57fe22){return _0x57fe22[_0x96fe('0x39')]()[_0x96fe('0x3a')](function(){_0x1db5a3[_0x96fe('0x2e')](0xcc)[_0x96fe('0x2f')]();});}};}function handleEntityNotFound(_0x1c3579,_0x24adfd){return function(_0x482063){if(!_0x482063){_0x1c3579[_0x96fe('0x2d')](0x194);}return _0x482063;};}function handleError(_0x42f792,_0x271d9c){_0x271d9c=_0x271d9c||0x1f4;return function(_0x57fe9c){logger[_0x96fe('0x26')](_0x57fe9c['stack']);if(_0x57fe9c['name']){delete _0x57fe9c[_0x96fe('0x3b')];}_0x42f792[_0x96fe('0x2e')](_0x271d9c)[_0x96fe('0x3c')](_0x57fe9c);};}exports[_0x96fe('0x3d')]=function(_0x29dbb6,_0xdbc527){var _0x4fc382={},_0x498f89={},_0x3e18d0={'count':0x0,'rows':[]};var _0x3dd7ea=_[_0x96fe('0x3e')](db[_0x96fe('0x3f')][_0x96fe('0x40')],function(_0x51704e){return{'name':_0x51704e['fieldName'],'type':_0x51704e[_0x96fe('0x41')][_0x96fe('0x42')]};});_0x498f89[_0x96fe('0x43')]=_[_0x96fe('0x3e')](_0x3dd7ea,'name');_0x498f89['query']=_[_0x96fe('0x44')](_0x29dbb6[_0x96fe('0x45')]);_0x498f89[_0x96fe('0x46')]=_[_0x96fe('0x47')](_0x498f89[_0x96fe('0x43')],_0x498f89[_0x96fe('0x45')]);_0x4fc382['attributes']=_[_0x96fe('0x47')](_0x498f89[_0x96fe('0x43')],qs[_0x96fe('0x48')](_0x29dbb6['query'][_0x96fe('0x48')]));_0x4fc382[_0x96fe('0x49')]=_0x4fc382[_0x96fe('0x49')][_0x96fe('0x4a')]?_0x4fc382[_0x96fe('0x49')]:_0x498f89[_0x96fe('0x43')];if(!_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x4b')](_0x96fe('0x4c'))){_0x4fc382[_0x96fe('0x33')]=qs[_0x96fe('0x33')](_0x29dbb6['query'][_0x96fe('0x33')]);_0x4fc382[_0x96fe('0x31')]=qs[_0x96fe('0x31')](_0x29dbb6['query'][_0x96fe('0x31')]);}_0x4fc382[_0x96fe('0x4d')]=qs[_0x96fe('0x4e')](_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x4e')]);_0x4fc382[_0x96fe('0x4f')]=qs['filters'](_['pick'](_0x29dbb6['query'],_0x498f89['filters']),_0x3dd7ea);if(_0x29dbb6[_0x96fe('0x45')]['filter']){_0x4fc382[_0x96fe('0x4f')]=_[_0x96fe('0x50')](_0x4fc382['where'],{'$or':_[_0x96fe('0x3e')](_0x3dd7ea,function(_0x46a0cf){if(_0x46a0cf[_0x96fe('0x41')]!==_0x96fe('0x51')){var _0x411eca={};_0x411eca[_0x46a0cf['name']]={'$like':'%'+_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x52')]+'%'};return _0x411eca;}})});}_0x4fc382=_[_0x96fe('0x50')]({},_0x4fc382,_0x29dbb6[_0x96fe('0x53')]);var _0x2a9ad3={'where':_0x4fc382['where']};return db[_0x96fe('0x3f')][_0x96fe('0x34')](_0x2a9ad3)[_0x96fe('0x3a')](function(_0x4977cf){_0x3e18d0[_0x96fe('0x34')]=_0x4977cf;if(_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x54')]){_0x4fc382['include']=[{'all':!![]}];}return db[_0x96fe('0x3f')][_0x96fe('0x55')](_0x4fc382);})[_0x96fe('0x3a')](function(_0x341fe8){_0x3e18d0[_0x96fe('0x56')]=_0x341fe8;return _0x3e18d0;})[_0x96fe('0x3a')](respondWithFilteredResult(_0xdbc527,_0x4fc382))[_0x96fe('0x2c')](handleError(_0xdbc527,null));};exports['show']=function(_0x71626c,_0x7cafe2){var _0x528dc6={'raw':!![],'where':{'id':_0x71626c['params']['id']}},_0x154c69={};_0x154c69[_0x96fe('0x43')]=_['keys'](db[_0x96fe('0x3f')][_0x96fe('0x40')]);_0x154c69[_0x96fe('0x45')]=_['keys'](_0x71626c['query']);_0x154c69[_0x96fe('0x46')]=_['intersection'](_0x154c69[_0x96fe('0x43')],_0x154c69[_0x96fe('0x45')]);_0x528dc6[_0x96fe('0x49')]=_['intersection'](_0x154c69[_0x96fe('0x43')],qs[_0x96fe('0x48')](_0x71626c[_0x96fe('0x45')][_0x96fe('0x48')]));_0x528dc6[_0x96fe('0x49')]=_0x528dc6[_0x96fe('0x49')][_0x96fe('0x4a')]?_0x528dc6[_0x96fe('0x49')]:_0x154c69['model'];if(_0x71626c['query'][_0x96fe('0x54')]){_0x528dc6['include']=[{'all':!![]}];}_0x528dc6=_['merge']({},_0x528dc6,_0x71626c[_0x96fe('0x53')]);return db[_0x96fe('0x3f')][_0x96fe('0x57')](_0x528dc6)[_0x96fe('0x3a')](handleEntityNotFound(_0x7cafe2,null))['then'](respondWithResult(_0x7cafe2,null))[_0x96fe('0x2c')](handleError(_0x7cafe2,null));};exports[_0x96fe('0x58')]=function(_0x5bce1d,_0x405fff){if(_0x5bce1d['body']['id']){delete _0x5bce1d[_0x96fe('0x59')]['id'];}return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x5bce1d[_0x96fe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x405fff,null))[_0x96fe('0x3a')](saveUpdates(_0x5bce1d[_0x96fe('0x59')],null))[_0x96fe('0x3a')](respondWithResult(_0x405fff,null))[_0x96fe('0x2c')](handleError(_0x405fff,null));};exports[_0x96fe('0x39')]=function(_0x4bd73c,_0x3aea00){return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x4bd73c[_0x96fe('0x5a')]['id']}})[_0x96fe('0x3a')](handleEntityNotFound(_0x3aea00,null))[_0x96fe('0x3a')](removeEntity(_0x3aea00,null))[_0x96fe('0x2c')](handleError(_0x3aea00,null));};exports['describe']=function(_0x4836eb,_0x2122df){return db[_0x96fe('0x3f')][_0x96fe('0x5b')]()[_0x96fe('0x3a')](respondWithResult(_0x2122df,null))[_0x96fe('0x2c')](handleError(_0x2122df,null));};var interaction_log=require(_0x96fe('0x14'))(_0x96fe('0x5c'));exports[_0x96fe('0x5d')]=function(_0x3617a8,_0x5dc511,_0x4919a8){var _0xa3687e={'agent':{},'channel':_0x96fe('0x5e')};if(_0x3617a8[_0x96fe('0x59')]['id']){delete _0x3617a8[_0x96fe('0x59')]['id'];}_0x3617a8['body'][_0x96fe('0x5f')]=!![];_0x3617a8[_0x96fe('0x59')]['readAt']=moment()[_0x96fe('0x60')](_0x96fe('0x61'));_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')]=_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')]||_0x3617a8[_0x96fe('0x63')]['id'];_0xa3687e[_0x96fe('0x64')]['id']=_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')];return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x3617a8[_0x96fe('0x5a')]['id'],'UserId':null}})[_0x96fe('0x3a')](handleEntityNotFound(_0x5dc511,null))[_0x96fe('0x3a')](saveUpdates(_0x3617a8['body'],null))['then'](function(_0x47db4a){if(_0x47db4a){_0xa3687e[_0x96fe('0x29')]=_0x47db4a[_0x96fe('0x65')]({'plain':!![]});return db[_0x96fe('0x66')][_0x96fe('0x57')]({'where':{'id':_0x47db4a[_0x96fe('0x67')]}});}return null;})[_0x96fe('0x3a')](handleEntityNotFound(_0x5dc511,null))[_0x96fe('0x3a')](function(_0x31e8d9){if(_0x31e8d9){return _0x31e8d9['update']({'UserId':_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')],'read1stAt':_[_0x96fe('0x68')](_0x31e8d9[_0x96fe('0x69')])?moment()['format'](_0x96fe('0x61')):undefined});}return null;})[_0x96fe('0x3a')](function(_0x1a3330){if(_0x1a3330){_0xa3687e[_0x96fe('0x6a')]=_0x1a3330[_0x96fe('0x65')]({'plain':!![]});interaction_log['info'](_0x96fe('0x6b'),_0x3617a8[_0x96fe('0x63')]['id'],_0x3617a8['user'][_0x96fe('0x3b')],_0x3617a8[_0x96fe('0x63')][_0x96fe('0x6c')],_0xa3687e[_0x96fe('0x6a')]['id'],_0x3617a8['body']?JSON[_0x96fe('0x25')](_0x3617a8[_0x96fe('0x59')]):_0x96fe('0x6d'));return respondWithRpcPromise(_0x96fe('0x6e'),'acceptMessage',_0xa3687e);}return null;})['then'](function(_0x2eb681){var _0x3adb7c=_0x96fe('0x6f')+_0x2eb681[_0x96fe('0x29')][_0x96fe('0x70')];return db[_0x96fe('0x71')][_0x96fe('0x45')](_0x3adb7c,{'type':db[_0x96fe('0x72')][_0x96fe('0x73')][_0x96fe('0x74')],'raw':!![]})[_0x96fe('0x3a')](function(_0x4bfd52){return _0x4bfd52;});})[_0x96fe('0x3a')](function(_0x156e80){if(_0x156e80){_0xa3687e[_0x96fe('0x29')][_0x96fe('0x75')]=_0x156e80[0x0];if(!_0x3617a8[_0x96fe('0x59')]['UserId'])return;return db['User'][_0x96fe('0x57')]({'where':{'id':_0x3617a8['body'][_0x96fe('0x62')],'role':'agent'},'attributes':['id',_0x96fe('0x3b'),'fullname',_0x96fe('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x272120){if(!_0x272120)return null;_0xa3687e[_0x96fe('0x29')]['agent']=_0x272120;return _0xa3687e;})['then'](function(_0x2402f5){if(_0x2402f5){if(_0x3617a8[_0x96fe('0x59')][_0x96fe('0x77')]){_0xa3687e['message'][_0x96fe('0x78')]=util[_0x96fe('0x60')](_0x96fe('0x79'),_0x3617a8[_0x96fe('0x63')][_0x96fe('0x3b')]);_0xa3687e[_0x96fe('0x29')][_0x96fe('0x7a')]=_0xa3687e[_0x96fe('0x7a')];_0xa3687e['message'][_0x96fe('0x7b')]=_0xa3687e[_0x96fe('0x7a')];_0xa3687e[_0x96fe('0x29')][_0x96fe('0x7c')]=_0x96fe('0x5d');return respondWithRpcPromise('EventManager',_0x96fe('0x7d'),{'event':_0x96fe('0x7e'),'message':_0xa3687e['message']},client9002)['then'](function(){return _0xa3687e;});}return _0xa3687e;}return null;})[_0x96fe('0x3a')](respondWithResult(_0x5dc511,null))['catch'](handleError(_0x5dc511,null));};var interaction_log=require(_0x96fe('0x14'))(_0x96fe('0x5c'));exports[_0x96fe('0x37')]=function(_0x526b0b,_0x3a23c5,_0x28b722){var _0x3d1952={'agent':{},'channel':_0x96fe('0x5e')};if(_0x526b0b['body']['id']){delete _0x526b0b[_0x96fe('0x59')]['id'];}_0x526b0b[_0x96fe('0x59')]['UserId']=_0x526b0b[_0x96fe('0x59')][_0x96fe('0x62')]||_0x526b0b[_0x96fe('0x63')]['id'];_0x3d1952[_0x96fe('0x64')]['id']=_0x526b0b['body'][_0x96fe('0x62')];return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x526b0b[_0x96fe('0x5a')]['id'],'UserId':null}})[_0x96fe('0x3a')](handleEntityNotFound(_0x3a23c5,null))[_0x96fe('0x3a')](function(_0x23b074){if(_0x23b074){_0x3d1952['message']=_0x23b074[_0x96fe('0x65')]({'plain':!![]});return db[_0x96fe('0x66')][_0x96fe('0x57')]({'where':{'id':_0x23b074[_0x96fe('0x67')]}});}return null;})[_0x96fe('0x3a')](handleEntityNotFound(_0x3a23c5,null))[_0x96fe('0x3a')](function(_0x69fd91){if(_0x69fd91){_0x3d1952[_0x96fe('0x6a')]=_0x69fd91[_0x96fe('0x65')]({'plain':!![]});interaction_log[_0x96fe('0x2a')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x526b0b[_0x96fe('0x63')]['id'],_0x526b0b[_0x96fe('0x63')][_0x96fe('0x3b')],_0x526b0b[_0x96fe('0x63')][_0x96fe('0x6c')],_0x3d1952[_0x96fe('0x6a')]['id'],_0x526b0b['body']?JSON[_0x96fe('0x25')](_0x526b0b[_0x96fe('0x59')]):_0x96fe('0x6d'));return respondWithRpcPromise(_0x96fe('0x7f'),_0x96fe('0x80'),_0x3d1952);}return null;})[_0x96fe('0x3a')](function(_0x4df6d4){var _0x4c2430='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df6d4['message'][_0x96fe('0x70')];return db['sequelize'][_0x96fe('0x45')](_0x4c2430,{'type':db[_0x96fe('0x72')][_0x96fe('0x73')]['SELECT'],'raw':!![]})[_0x96fe('0x3a')](function(_0xeb6350){return _0xeb6350;});})[_0x96fe('0x3a')](function(_0x4de6e7){if(_0x4de6e7){_0x3d1952[_0x96fe('0x29')][_0x96fe('0x75')]=_0x4de6e7[0x0];if(!_0x526b0b[_0x96fe('0x59')][_0x96fe('0x62')])return;return db[_0x96fe('0x81')][_0x96fe('0x57')]({'where':{'id':_0x526b0b[_0x96fe('0x59')]['UserId'],'role':_0x96fe('0x64')},'attributes':['id',_0x96fe('0x3b'),_0x96fe('0x82'),_0x96fe('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x98649c){if(!_0x98649c)return null;_0x3d1952['message'][_0x96fe('0x64')]=_0x98649c;return _0x3d1952;})[_0x96fe('0x3a')](function(_0x4f7ad7){if(_0x4f7ad7){_0x4f7ad7[_0x96fe('0x29')][_0x96fe('0x78')]=util['format'](_0x96fe('0x79'),_0x526b0b[_0x96fe('0x63')][_0x96fe('0x3b')]);_0x4f7ad7[_0x96fe('0x29')]['channel']=_0x3d1952[_0x96fe('0x7a')];_0x4f7ad7['message'][_0x96fe('0x7b')]=_0x3d1952[_0x96fe('0x7a')];_0x4f7ad7[_0x96fe('0x29')][_0x96fe('0x7c')]=_0x96fe('0x37');respondWithRpcPromise('EventManager',_0x96fe('0x7d'),{'event':_0x96fe('0x83'),'message':_0x4f7ad7['message']},client9002);return _0x3d1952;}return null;})['then'](respondWithResult(_0x3a23c5,null))[_0x96fe('0x2c')](handleError(_0x3a23c5,null));};exports[_0x96fe('0x84')]=function(_0x5689ed,_0x3dbd6a){var _0x4da419;return db[_0x96fe('0x3f')][_0x96fe('0x84')](_0x5689ed['body'],{})[_0x96fe('0x3a')](function(_0x4e4f5c){_0x4da419=_0x4e4f5c;return db[_0x96fe('0x85')][_0x96fe('0x86')]({'where':{'id':_0x4da419[_0x96fe('0x70')]}});})[_0x96fe('0x3a')](function(_0x3eb792){if(_['isNil'](_0x3eb792)){return;}else{_0x4da419[_0x96fe('0x5e')]=_0x3eb792['fax'];return db[_0x96fe('0x87')]['findOne']({'where':{'id':_0x4da419['AttachmentId']}});}})[_0x96fe('0x3a')](function(_0x5411bb){return respondWithRpcPromise(_0x96fe('0x88'),_0x96fe('0x88'),{'FaxAccountId':_['isNil'](_0x5689ed['body'])?undefined:_0x5689ed[_0x96fe('0x59')][_0x96fe('0x89')],'path':_[_0x96fe('0x68')](_0x5411bb)?undefined:util[_0x96fe('0x60')](_0x96fe('0x8a'),_0x5411bb[_0x96fe('0x8b')]),'fax':_[_0x96fe('0x68')](_0x4da419[_0x96fe('0x5e')])?undefined:_0x4da419[_0x96fe('0x5e')],'AttachmentId':_0x4da419[_0x96fe('0x8c')]},client9002);})[_0x96fe('0x3a')](respondWithResult(_0x3dbd6a,0xc9))['catch'](handleError(_0x3dbd6a,null));};exports[_0x96fe('0x8d')]=function(_0x4cea9a,_0x1a90f1){var _0xf88990=path[_0x96fe('0x8e')](config['root'],_0x96fe('0x8f'),'files',_0x96fe('0x90'));return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x4cea9a[_0x96fe('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':_0x96fe('0x87')}]})[_0x96fe('0x3a')](handleEntityNotFound(_0x1a90f1,null))[_0x96fe('0x3a')](function(_0x3388d1){if(_0x3388d1){return _0x1a90f1[_0x96fe('0x8d')](path[_0x96fe('0x8e')](_0xf88990,_0x3388d1[_0x96fe('0x87')][_0x96fe('0x8b')]));}})[_0x96fe('0x2c')](handleError(_0x1a90f1,null));}; \ No newline at end of file +var _0x4ca5=['name','send','index','map','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','FaxMessage','rawAttributes','find','body','../../config/logger','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','sequelize','QueryTypes','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','reject','create','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','redis','defaults','localhost','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','save','update','destroy','stack'];(function(_0x99f811,_0x44d59e){var _0x37ba7f=function(_0x3f3961){while(--_0x3f3961){_0x99f811['push'](_0x99f811['shift']());}};_0x37ba7f(++_0x44d59e);}(_0x4ca5,0xdd));var _0x54ca=function(_0x99f11f,_0x57046a){_0x99f11f=_0x99f11f-0x0;var _0x32335a=_0x4ca5[_0x99f11f];return _0x32335a;};'use strict';var emlformat=require(_0x54ca('0x0'));var rimraf=require(_0x54ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54ca('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x54ca('0x3'));var Mustache=require('mustache');var util=require(_0x54ca('0x4'));var path=require(_0x54ca('0x5'));var sox=require('sox');var csv=require(_0x54ca('0x6'));var ejs=require(_0x54ca('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54ca('0x8'));var squel=require('squel');var crypto=require(_0x54ca('0x9'));var jsforce=require(_0x54ca('0xa'));var deskjs=require(_0x54ca('0xb'));var toCsv=require(_0x54ca('0x6'));var querystring=require(_0x54ca('0xc'));var Papa=require(_0x54ca('0xd'));var Redis=require(_0x54ca('0xe'));var authService=require(_0x54ca('0xf'));var qs=require(_0x54ca('0x10'));var as=require(_0x54ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x54ca('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x54ca('0x13'));var db=require('../../mysqldb')['db'];config[_0x54ca('0x14')]=_[_0x54ca('0x15')](config['redis'],{'host':_0x54ca('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')[_0x54ca('0x17')](socket);var jayson=require(_0x54ca('0x18'));var client=jayson['client'][_0x54ca('0x19')]({'port':0x232c});var client9002=jayson[_0x54ca('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xabd7f,_0xfa10d7,_0x4b6cde,_0x1ec300){return new BPromise(function(_0x1dc011,_0x1320b6){var _0x4d26bc=_0x1ec300||client;return _0x4d26bc[_0x54ca('0x1b')](_0xabd7f,_0x4b6cde)[_0x54ca('0x1c')](function(_0x1bb3fc){logger[_0x54ca('0x1d')](_0x54ca('0x1e'),_0xfa10d7,_0x54ca('0x1f'));logger[_0x54ca('0x20')](_0x54ca('0x21'),_0xfa10d7,_0x54ca('0x1f'),JSON['stringify'](_0x1bb3fc));if(_0x1bb3fc['error']){if(_0x1bb3fc[_0x54ca('0x22')][_0x54ca('0x23')]===0x1f4){logger['error'](_0x54ca('0x1e'),_0xfa10d7,_0x1bb3fc[_0x54ca('0x22')][_0x54ca('0x24')]);return _0x1320b6(_0x1bb3fc['error']['message']);}logger[_0x54ca('0x22')](_0x54ca('0x1e'),_0xfa10d7,_0x1bb3fc[_0x54ca('0x22')][_0x54ca('0x24')]);return _0x1dc011(_0x1bb3fc[_0x54ca('0x22')]['message']);}else{logger[_0x54ca('0x1d')](_0x54ca('0x1e'),_0xfa10d7,_0x54ca('0x1f'));_0x1dc011(_0x1bb3fc[_0x54ca('0x25')][_0x54ca('0x24')]);}})[_0x54ca('0x26')](function(_0x30f660){logger['error'](_0x54ca('0x1e'),_0xfa10d7,_0x30f660);_0x1320b6(_0x30f660);});});}function respondWithStatusCode(_0x3bf504,_0x3e62b9){_0x3e62b9=_0x3e62b9||0xcc;return function(_0x5b7236){if(_0x5b7236){return _0x3bf504[_0x54ca('0x27')](_0x3e62b9);}return _0x3bf504[_0x54ca('0x28')](_0x3e62b9)[_0x54ca('0x29')]();};}function respondWithResult(_0x4b6fd1,_0x14c3ac){_0x14c3ac=_0x14c3ac||0xc8;return function(_0x543ca2){if(_0x543ca2){return _0x4b6fd1[_0x54ca('0x28')](_0x14c3ac)[_0x54ca('0x2a')](_0x543ca2);}};}function respondWithFilteredResult(_0x4c7df2,_0x4c5e7d){return function(_0x1f557d){if(_0x1f557d){var _0x568d23=typeof _0x4c5e7d[_0x54ca('0x2b')]===_0x54ca('0x2c')&&typeof _0x4c5e7d[_0x54ca('0x2d')]===_0x54ca('0x2c');var _0x5dd7a7=_0x1f557d[_0x54ca('0x2e')];var _0x36b10e=_0x568d23?0x0:_0x4c5e7d[_0x54ca('0x2b')];var _0x3e4c87=_0x568d23?_0x1f557d[_0x54ca('0x2e')]:_0x4c5e7d[_0x54ca('0x2b')]+_0x4c5e7d['limit'];var _0x2e7115;if(_0x3e4c87>=_0x5dd7a7){_0x3e4c87=_0x5dd7a7;_0x2e7115=0xc8;}else{_0x2e7115=0xce;}_0x4c7df2['status'](_0x2e7115);return _0x4c7df2['set']('Content-Range',_0x36b10e+'-'+_0x3e4c87+'/'+_0x5dd7a7)['json'](_0x1f557d);}return null;};}function patchUpdates(_0x45a25b){return function(_0x37aa1c){try{jsonpatch['apply'](_0x37aa1c,_0x45a25b,!![]);}catch(_0x30319e){return BPromise['reject'](_0x30319e);}return _0x37aa1c[_0x54ca('0x2f')]();};}function saveUpdates(_0x320e0a,_0x287d94){return function(_0x21bf37){if(_0x21bf37){return _0x21bf37[_0x54ca('0x30')](_0x320e0a)[_0x54ca('0x1c')](function(_0x3643eb){return _0x3643eb;});}return null;};}function removeEntity(_0x1602d9,_0x5785d1){return function(_0x287b41){if(_0x287b41){return _0x287b41[_0x54ca('0x31')]()[_0x54ca('0x1c')](function(){_0x1602d9[_0x54ca('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fd9b9,_0x4af071){return function(_0x2550f5){if(!_0x2550f5){_0x1fd9b9['sendStatus'](0x194);}return _0x2550f5;};}function handleError(_0x1be25b,_0x5a2d3e){_0x5a2d3e=_0x5a2d3e||0x1f4;return function(_0x13ba2e){logger['error'](_0x13ba2e[_0x54ca('0x32')]);if(_0x13ba2e[_0x54ca('0x33')]){delete _0x13ba2e[_0x54ca('0x33')];}_0x1be25b[_0x54ca('0x28')](_0x5a2d3e)[_0x54ca('0x34')](_0x13ba2e);};}exports[_0x54ca('0x35')]=function(_0x401d5b,_0x1d9202){var _0x190a80={},_0x14a561={},_0x39a608={'count':0x0,'rows':[]};var _0x173688=_[_0x54ca('0x36')](db['FaxMessage']['rawAttributes'],function(_0x26d6c6){return{'name':_0x26d6c6[_0x54ca('0x37')],'type':_0x26d6c6[_0x54ca('0x38')][_0x54ca('0x39')]};});_0x14a561['model']=_[_0x54ca('0x36')](_0x173688,_0x54ca('0x33'));_0x14a561['query']=_[_0x54ca('0x3a')](_0x401d5b['query']);_0x14a561[_0x54ca('0x3b')]=_[_0x54ca('0x3c')](_0x14a561[_0x54ca('0x3d')],_0x14a561[_0x54ca('0x3e')]);_0x190a80[_0x54ca('0x3f')]=_[_0x54ca('0x3c')](_0x14a561[_0x54ca('0x3d')],qs['fields'](_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x40')]));_0x190a80[_0x54ca('0x3f')]=_0x190a80[_0x54ca('0x3f')][_0x54ca('0x41')]?_0x190a80[_0x54ca('0x3f')]:_0x14a561['model'];if(!_0x401d5b['query'][_0x54ca('0x42')](_0x54ca('0x43'))){_0x190a80[_0x54ca('0x2d')]=qs['limit'](_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x2d')]);_0x190a80['offset']=qs[_0x54ca('0x2b')](_0x401d5b['query'][_0x54ca('0x2b')]);}_0x190a80['order']=qs['sort'](_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x44')]);_0x190a80[_0x54ca('0x45')]=qs['filters'](_[_0x54ca('0x46')](_0x401d5b[_0x54ca('0x3e')],_0x14a561[_0x54ca('0x3b')]),_0x173688);if(_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x47')]){_0x190a80[_0x54ca('0x45')]=_['merge'](_0x190a80[_0x54ca('0x45')],{'$or':_[_0x54ca('0x36')](_0x173688,function(_0x544578){if(_0x544578['type']!==_0x54ca('0x48')){var _0x1c0d41={};_0x1c0d41[_0x544578[_0x54ca('0x33')]]={'$like':'%'+_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x47')]+'%'};return _0x1c0d41;}})});}_0x190a80=_[_0x54ca('0x49')]({},_0x190a80,_0x401d5b[_0x54ca('0x4a')]);var _0x47225a={'where':_0x190a80[_0x54ca('0x45')]};return db['FaxMessage'][_0x54ca('0x2e')](_0x47225a)[_0x54ca('0x1c')](function(_0x5aa128){_0x39a608['count']=_0x5aa128;if(_0x401d5b[_0x54ca('0x3e')][_0x54ca('0x4b')]){_0x190a80[_0x54ca('0x4c')]=[{'all':!![]}];}return db['FaxMessage'][_0x54ca('0x4d')](_0x190a80);})[_0x54ca('0x1c')](function(_0x3b10de){_0x39a608[_0x54ca('0x4e')]=_0x3b10de;return _0x39a608;})[_0x54ca('0x1c')](respondWithFilteredResult(_0x1d9202,_0x190a80))[_0x54ca('0x26')](handleError(_0x1d9202,null));};exports[_0x54ca('0x4f')]=function(_0x599661,_0x3182b8){var _0x805a12={'raw':!![],'where':{'id':_0x599661[_0x54ca('0x50')]['id']}},_0xffd652={};_0xffd652[_0x54ca('0x3d')]=_[_0x54ca('0x3a')](db[_0x54ca('0x51')][_0x54ca('0x52')]);_0xffd652[_0x54ca('0x3e')]=_[_0x54ca('0x3a')](_0x599661[_0x54ca('0x3e')]);_0xffd652['filters']=_['intersection'](_0xffd652[_0x54ca('0x3d')],_0xffd652['query']);_0x805a12[_0x54ca('0x3f')]=_['intersection'](_0xffd652['model'],qs[_0x54ca('0x40')](_0x599661[_0x54ca('0x3e')]['fields']));_0x805a12[_0x54ca('0x3f')]=_0x805a12[_0x54ca('0x3f')][_0x54ca('0x41')]?_0x805a12[_0x54ca('0x3f')]:_0xffd652['model'];if(_0x599661[_0x54ca('0x3e')][_0x54ca('0x4b')]){_0x805a12[_0x54ca('0x4c')]=[{'all':!![]}];}_0x805a12=_['merge']({},_0x805a12,_0x599661[_0x54ca('0x4a')]);return db[_0x54ca('0x51')][_0x54ca('0x53')](_0x805a12)[_0x54ca('0x1c')](handleEntityNotFound(_0x3182b8,null))[_0x54ca('0x1c')](respondWithResult(_0x3182b8,null))[_0x54ca('0x26')](handleError(_0x3182b8,null));};exports[_0x54ca('0x30')]=function(_0x3a4036,_0x113d1e){if(_0x3a4036[_0x54ca('0x54')]['id']){delete _0x3a4036['body']['id'];}return db[_0x54ca('0x51')][_0x54ca('0x53')]({'where':{'id':_0x3a4036['params']['id']}})[_0x54ca('0x1c')](handleEntityNotFound(_0x113d1e,null))[_0x54ca('0x1c')](saveUpdates(_0x3a4036['body'],null))[_0x54ca('0x1c')](respondWithResult(_0x113d1e,null))['catch'](handleError(_0x113d1e,null));};exports[_0x54ca('0x31')]=function(_0x17dde2,_0x5966d3){return db[_0x54ca('0x51')][_0x54ca('0x53')]({'where':{'id':_0x17dde2[_0x54ca('0x50')]['id']}})[_0x54ca('0x1c')](handleEntityNotFound(_0x5966d3,null))[_0x54ca('0x1c')](removeEntity(_0x5966d3,null))['catch'](handleError(_0x5966d3,null));};exports['describe']=function(_0x22faa8,_0x452553){return db['FaxMessage']['describe']()[_0x54ca('0x1c')](respondWithResult(_0x452553,null))[_0x54ca('0x26')](handleError(_0x452553,null));};var interaction_log=require(_0x54ca('0x55'))(_0x54ca('0x56'));exports[_0x54ca('0x57')]=function(_0x384e8a,_0x46680c,_0x192e44){var _0x29a67b={'agent':{},'channel':'fax'};if(_0x384e8a[_0x54ca('0x54')]['id']){delete _0x384e8a[_0x54ca('0x54')]['id'];}_0x384e8a[_0x54ca('0x54')][_0x54ca('0x58')]=!![];_0x384e8a['body'][_0x54ca('0x59')]=moment()[_0x54ca('0x5a')](_0x54ca('0x5b'));_0x384e8a[_0x54ca('0x54')][_0x54ca('0x5c')]=_0x384e8a[_0x54ca('0x54')][_0x54ca('0x5c')]||_0x384e8a[_0x54ca('0x5d')]['id'];_0x29a67b[_0x54ca('0x5e')]['id']=_0x384e8a[_0x54ca('0x54')][_0x54ca('0x5c')];return db[_0x54ca('0x51')][_0x54ca('0x53')]({'where':{'id':_0x384e8a[_0x54ca('0x50')]['id'],'UserId':null}})[_0x54ca('0x1c')](handleEntityNotFound(_0x46680c,null))[_0x54ca('0x1c')](saveUpdates(_0x384e8a[_0x54ca('0x54')],null))[_0x54ca('0x1c')](function(_0x8b71a8){if(_0x8b71a8){_0x29a67b[_0x54ca('0x24')]=_0x8b71a8[_0x54ca('0x5f')]({'plain':!![]});return db[_0x54ca('0x60')][_0x54ca('0x53')]({'where':{'id':_0x8b71a8['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x46680c,null))[_0x54ca('0x1c')](function(_0x32db02){if(_0x32db02){return _0x32db02['update']({'UserId':_0x384e8a['body'][_0x54ca('0x5c')],'read1stAt':_[_0x54ca('0x61')](_0x32db02['read1stAt'])?moment()[_0x54ca('0x5a')](_0x54ca('0x5b')):undefined});}return null;})['then'](function(_0x2b6ddd){if(_0x2b6ddd){_0x29a67b[_0x54ca('0x62')]=_0x2b6ddd[_0x54ca('0x5f')]({'plain':!![]});interaction_log['info'](_0x54ca('0x63'),_0x384e8a['user']['id'],_0x384e8a[_0x54ca('0x5d')][_0x54ca('0x33')],_0x384e8a[_0x54ca('0x5d')][_0x54ca('0x64')],_0x29a67b[_0x54ca('0x62')]['id'],_0x384e8a[_0x54ca('0x54')]?JSON[_0x54ca('0x65')](_0x384e8a[_0x54ca('0x54')]):_0x54ca('0x66'));return respondWithRpcPromise('AcceptMessage',_0x54ca('0x67'),_0x29a67b);}return null;})['then'](function(_0x2d3520){var _0x5ede2e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d3520[_0x54ca('0x24')]['ContactId'];return db[_0x54ca('0x68')][_0x54ca('0x3e')](_0x5ede2e,{'type':db['Sequelize'][_0x54ca('0x69')]['SELECT'],'raw':!![]})[_0x54ca('0x1c')](function(_0x1e99d6){return _0x1e99d6;});})[_0x54ca('0x1c')](function(_0x436616){if(_0x436616){_0x29a67b[_0x54ca('0x24')]['contact']=_0x436616[0x0];if(!_0x384e8a[_0x54ca('0x54')]['UserId'])return;return db[_0x54ca('0x6a')][_0x54ca('0x53')]({'where':{'id':_0x384e8a[_0x54ca('0x54')][_0x54ca('0x5c')],'role':'agent'},'attributes':['id',_0x54ca('0x33'),_0x54ca('0x6b'),_0x54ca('0x6c'),_0x54ca('0x6d')],'raw':!![]});}return null;})[_0x54ca('0x1c')](function(_0x34e3da){if(!_0x34e3da)return null;_0x29a67b[_0x54ca('0x24')][_0x54ca('0x5e')]=_0x34e3da;return _0x29a67b;})[_0x54ca('0x1c')](function(_0x45d78c){if(_0x45d78c){if(_0x384e8a['body']['manual']){_0x29a67b[_0x54ca('0x24')][_0x54ca('0x6e')]=util['format'](_0x54ca('0x6f'),_0x384e8a[_0x54ca('0x5d')][_0x54ca('0x33')]);_0x29a67b[_0x54ca('0x24')][_0x54ca('0x70')]=_0x29a67b[_0x54ca('0x70')];_0x29a67b[_0x54ca('0x24')][_0x54ca('0x71')]=_0x29a67b[_0x54ca('0x70')];_0x29a67b[_0x54ca('0x24')][_0x54ca('0x72')]=_0x54ca('0x57');return respondWithRpcPromise(_0x54ca('0x73'),_0x54ca('0x73'),{'event':'acceptmessage','message':_0x29a67b[_0x54ca('0x24')]},client9002)['then'](function(){return _0x29a67b;});}return _0x29a67b;}return null;})[_0x54ca('0x1c')](respondWithResult(_0x46680c,null))['catch'](handleError(_0x46680c,null));};var interaction_log=require(_0x54ca('0x55'))('fax-interactions');exports['reject']=function(_0x3155b5,_0x525256,_0x372496){var _0xadab38={'agent':{},'channel':_0x54ca('0x74')};if(_0x3155b5['body']['id']){delete _0x3155b5[_0x54ca('0x54')]['id'];}_0x3155b5[_0x54ca('0x54')][_0x54ca('0x5c')]=_0x3155b5[_0x54ca('0x54')][_0x54ca('0x5c')]||_0x3155b5[_0x54ca('0x5d')]['id'];_0xadab38[_0x54ca('0x5e')]['id']=_0x3155b5[_0x54ca('0x54')][_0x54ca('0x5c')];return db[_0x54ca('0x51')][_0x54ca('0x53')]({'where':{'id':_0x3155b5[_0x54ca('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x525256,null))['then'](function(_0x29069b){if(_0x29069b){_0xadab38[_0x54ca('0x24')]=_0x29069b['get']({'plain':!![]});return db[_0x54ca('0x60')]['find']({'where':{'id':_0x29069b['FaxInteractionId']}});}return null;})[_0x54ca('0x1c')](handleEntityNotFound(_0x525256,null))[_0x54ca('0x1c')](function(_0x3e39ec){if(_0x3e39ec){_0xadab38[_0x54ca('0x62')]=_0x3e39ec[_0x54ca('0x5f')]({'plain':!![]});interaction_log[_0x54ca('0x1d')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3155b5['user']['id'],_0x3155b5['user'][_0x54ca('0x33')],_0x3155b5[_0x54ca('0x5d')]['role'],_0xadab38['interaction']['id'],_0x3155b5[_0x54ca('0x54')]?JSON['stringify'](_0x3155b5[_0x54ca('0x54')]):_0x54ca('0x66'));return respondWithRpcPromise(_0x54ca('0x75'),_0x54ca('0x76'),_0xadab38);}return null;})[_0x54ca('0x1c')](function(_0xc14e81){var _0x40803f=_0x54ca('0x77')+_0xc14e81['message'][_0x54ca('0x78')];return db[_0x54ca('0x68')][_0x54ca('0x3e')](_0x40803f,{'type':db['Sequelize']['QueryTypes'][_0x54ca('0x79')],'raw':!![]})[_0x54ca('0x1c')](function(_0x445211){return _0x445211;});})[_0x54ca('0x1c')](function(_0x3430bd){if(_0x3430bd){_0xadab38[_0x54ca('0x24')]['contact']=_0x3430bd[0x0];if(!_0x3155b5[_0x54ca('0x54')]['UserId'])return;return db[_0x54ca('0x6a')][_0x54ca('0x53')]({'where':{'id':_0x3155b5[_0x54ca('0x54')][_0x54ca('0x5c')],'role':'agent'},'attributes':['id','name',_0x54ca('0x6b'),_0x54ca('0x6c'),_0x54ca('0x6d')],'raw':!![]});}return null;})[_0x54ca('0x1c')](function(_0x3a16f7){if(!_0x3a16f7)return null;_0xadab38[_0x54ca('0x24')][_0x54ca('0x5e')]=_0x3a16f7;return _0xadab38;})['then'](function(_0x4ed3dd){if(_0x4ed3dd){_0x4ed3dd[_0x54ca('0x24')][_0x54ca('0x6e')]=util[_0x54ca('0x5a')](_0x54ca('0x6f'),_0x3155b5[_0x54ca('0x5d')]['name']);_0x4ed3dd[_0x54ca('0x24')][_0x54ca('0x70')]=_0xadab38['channel'];_0x4ed3dd['message']['motionChannel']=_0xadab38['channel'];_0x4ed3dd[_0x54ca('0x24')][_0x54ca('0x72')]=_0x54ca('0x7a');respondWithRpcPromise(_0x54ca('0x73'),_0x54ca('0x73'),{'event':'rejectmessage','message':_0x4ed3dd[_0x54ca('0x24')]},client9002);return _0xadab38;}return null;})[_0x54ca('0x1c')](respondWithResult(_0x525256,null))[_0x54ca('0x26')](handleError(_0x525256,null));};exports[_0x54ca('0x7b')]=function(_0x1bb5c5,_0x915cc8){var _0x1b1000;return db[_0x54ca('0x51')]['create'](_0x1bb5c5[_0x54ca('0x54')],{})[_0x54ca('0x1c')](function(_0x365f53){_0x1b1000=_0x365f53;return db['CmContact']['findOne']({'where':{'id':_0x1b1000[_0x54ca('0x78')]}});})[_0x54ca('0x1c')](function(_0x5d3a0b){if(_[_0x54ca('0x61')](_0x5d3a0b)){return;}else{_0x1b1000[_0x54ca('0x74')]=_0x5d3a0b[_0x54ca('0x74')];return db[_0x54ca('0x7c')][_0x54ca('0x7d')]({'where':{'id':_0x1b1000[_0x54ca('0x7e')]}});}})[_0x54ca('0x1c')](function(_0x2f0548){return respondWithRpcPromise(_0x54ca('0x7f'),'SendFax',{'FaxAccountId':_[_0x54ca('0x61')](_0x1bb5c5[_0x54ca('0x54')])?undefined:_0x1bb5c5[_0x54ca('0x54')]['FaxAccountId'],'path':_['isNil'](_0x2f0548)?undefined:util[_0x54ca('0x5a')](_0x54ca('0x80'),_0x2f0548['basename']),'fax':_['isNil'](_0x1b1000[_0x54ca('0x74')])?undefined:_0x1b1000[_0x54ca('0x74')],'AttachmentId':_0x1b1000[_0x54ca('0x7e')]},client9002);})[_0x54ca('0x1c')](respondWithResult(_0x915cc8,0xc9))[_0x54ca('0x26')](handleError(_0x915cc8,null));};exports[_0x54ca('0x81')]=function(_0x1bab90,_0x588b40){var _0x1c6d43=path[_0x54ca('0x82')](config[_0x54ca('0x83')],_0x54ca('0x84'),_0x54ca('0x85'),_0x54ca('0x86'));return db[_0x54ca('0x51')][_0x54ca('0x53')]({'where':{'id':_0x1bab90[_0x54ca('0x50')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x54ca('0x1c')](handleEntityNotFound(_0x588b40,null))[_0x54ca('0x1c')](function(_0x48413d){if(_0x48413d){return _0x588b40[_0x54ca('0x81')](path[_0x54ca('0x82')](_0x1c6d43,_0x48413d[_0x54ca('0x7c')][_0x54ca('0x87')]));}})[_0x54ca('0x26')](handleError(_0x588b40,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 665f36e..7a7246c 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 _0x3c85=['remove','emit','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x27589b,_0x1db3ed){var _0x50f792=function(_0x51598a){while(--_0x51598a){_0x27589b['push'](_0x27589b['shift']());}};_0x50f792(++_0x1db3ed);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3acb5f,_0x1f13b5){_0x3acb5f=_0x3acb5f-0x0;var _0xce371a=_0x3c85[_0x3acb5f];return _0xce371a;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var FaxMessage=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe056=['hook','exports','FaxMessage','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x1f1bae,_0x5c0a31){var _0x19efaa=function(_0x588666){while(--_0x588666){_0x1f1bae['push'](_0x1f1bae['shift']());}};_0x19efaa(++_0x5c0a31);}(_0xe056,0xdb));var _0x6e05=function(_0x168127,_0x59cea1){_0x168127=_0x168127-0x0;var _0x4c99ad=_0xe056[_0x168127];return _0x4c99ad;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x6e05('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6e05('0x1')](0x0);var events={'afterCreate':_0x6e05('0x2'),'afterUpdate':'update','afterDestroy':_0x6e05('0x3')};function emitEvent(_0x518934){return function(_0x13ea30,_0x1bec29,_0x5205e6){FaxMessageEvents['emit'](_0x518934+':'+_0x13ea30['id'],_0x13ea30);FaxMessageEvents['emit'](_0x518934,_0x13ea30);_0x5205e6(null);};}for(var e in events){if(events[_0x6e05('0x4')](e)){var event=events[e];FaxMessage[_0x6e05('0x5')](e,emitEvent(event));}}module[_0x6e05('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c18872c..8538e25 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 _0xdc3b=['exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','bluebird','../../config/environment'];(function(_0x485ee5,_0x1c562f){var _0x12de85=function(_0x804741){while(--_0x804741){_0x485ee5['push'](_0x485ee5['shift']());}};_0x12de85(++_0x1c562f);}(_0xdc3b,0x1bd));var _0xbdc3=function(_0x1dfc85,_0x204e54){_0x1dfc85=_0x1dfc85-0x0;var _0x185e46=_0xdc3b[_0x1dfc85];return _0x185e46;};'use strict';var _=require(_0xbdc3('0x0'));var util=require(_0xbdc3('0x1'));var logger=require('../../config/logger')(_0xbdc3('0x2'));var moment=require('moment');var BPromise=require(_0xbdc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbdc3('0x4'));var attributes=require('./faxMessage.attributes');module[_0xbdc3('0x5')]=function(_0x3cd052,_0x3f3e81){return _0x3cd052[_0xbdc3('0x6')](_0xbdc3('0x7'),attributes,{'tableName':_0xbdc3('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xbdc3('0x9')],'type':_0xbdc3('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x174506,_0x5d1712,_0x284e48){var _0x2fc4dc=_0x3cd052['models'];var _0x4c2c1b=_0x174506[_0xbdc3('0xb')]({'plain':!![]});if(_0x4c2c1b['direction']['toLowerCase']()==='in'||_0x4c2c1b[_0xbdc3('0xc')][_0xbdc3('0xd')]()===_0xbdc3('0xe')&&!_0x4c2c1b[_0xbdc3('0xf')]&&!_['isNil'](_0x4c2c1b['UserId'])){_0x2fc4dc[_0xbdc3('0x10')][_0xbdc3('0x11')]({'where':{'id':_0x4c2c1b[_0xbdc3('0x12')]}})[_0xbdc3('0x13')](function(_0x5d970f){if(_0x5d970f){_0x5d970f[_0xbdc3('0x14')]({'lastMsgAt':_0x4c2c1b[_0xbdc3('0x15')],'lastMsgDirection':_0x4c2c1b[_0xbdc3('0xc')][_0xbdc3('0xd')]()});}})[_0xbdc3('0x16')](function(_0x184dbd){console[_0xbdc3('0x17')](_0x184dbd);});}_0x284e48();}},'charset':'utf8mb4','collate':_0xbdc3('0x18')});}; \ No newline at end of file +var _0x1d60=['models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT'];(function(_0x182870,_0x5b19bd){var _0x5d6517=function(_0x4edd9e){while(--_0x4edd9e){_0x182870['push'](_0x182870['shift']());}};_0x5d6517(++_0x5b19bd);}(_0x1d60,0x101));var _0x01d6=function(_0x3dcc29,_0x59d913){_0x3dcc29=_0x3dcc29-0x0;var _0x47a63f=_0x1d60[_0x3dcc29];return _0x47a63f;};'use strict';var _=require(_0x01d6('0x0'));var util=require(_0x01d6('0x1'));var logger=require(_0x01d6('0x2'))(_0x01d6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01d6('0x5'));var config=require(_0x01d6('0x6'));var attributes=require(_0x01d6('0x7'));module[_0x01d6('0x8')]=function(_0x15e7df,_0x3c9c09){return _0x15e7df['define']('FaxMessage',attributes,{'tableName':_0x01d6('0x9'),'paranoid':![],'indexes':[{'name':_0x01d6('0xa'),'fields':[_0x01d6('0xb')],'type':_0x01d6('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31bd2c,_0x9dd7a9,_0x57798a){var _0x3c7de6=_0x15e7df[_0x01d6('0xd')];var _0x1275c4=_0x31bd2c[_0x01d6('0xe')]({'plain':!![]});if(_0x1275c4[_0x01d6('0xf')][_0x01d6('0x10')]()==='in'||_0x1275c4['direction']['toLowerCase']()===_0x01d6('0x11')&&!_0x1275c4['secret']&&!_['isNil'](_0x1275c4[_0x01d6('0x12')])){_0x3c7de6[_0x01d6('0x13')][_0x01d6('0x14')]({'where':{'id':_0x1275c4[_0x01d6('0x15')]}})[_0x01d6('0x16')](function(_0x3d1581){if(_0x3d1581){_0x3d1581['update']({'lastMsgAt':_0x1275c4[_0x01d6('0x17')],'lastMsgDirection':_0x1275c4[_0x01d6('0xf')]['toLowerCase']()});}})[_0x01d6('0x18')](function(_0x2e211b){console[_0x01d6('0x19')](_0x2e211b);});}_0x57798a();}},'charset':'utf8mb4','collate':_0x01d6('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c481985..077b63e 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 _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3667fa,_0x4a9421){var _0x46340e=function(_0x58d928){while(--_0x58d928){_0x3667fa['push'](_0x3667fa['shift']());}};_0x46340e(++_0x4a9421);}(_0xb821,0xa7));var _0x1b82=function(_0x166dd9,_0x2902b4){_0x166dd9=_0x166dd9-0x0;var _0x2ebe5a=_0xb821[_0x166dd9];return _0x2ebe5a;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file +var _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x1ce9b3,_0x5a00b4){var _0x3af89d=function(_0x1767c2){while(--_0x1767c2){_0x1ce9b3['push'](_0x1ce9b3['shift']());}};_0x3af89d(++_0x5a00b4);}(_0x17ba,0xab));var _0xa17b=function(_0x25f0cf,_0x2a77e2){_0x25f0cf=_0x25f0cf-0x0;var _0x43f3ab=_0x17ba[_0x25f0cf];return _0x43f3ab;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index aa8cbc2..9bdfb34 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 _0x1bfb=['removeListener','register','length','faxMessage:','./faxMessage.events','save','update','emit'];(function(_0x112dc8,_0x102fb3){var _0x260b62=function(_0x569ef){while(--_0x569ef){_0x112dc8['push'](_0x112dc8['shift']());}};_0x260b62(++_0x102fb3);}(_0x1bfb,0xe4));var _0xb1bf=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x1bfb[_0x209fcd];return _0x501d5e;};'use strict';var FaxMessageEvents=require(_0xb1bf('0x0'));var events=[_0xb1bf('0x1'),'remove',_0xb1bf('0x2')];function createListener(_0x5742f6,_0x3f92e5){return function(_0xe8bb6e){_0x3f92e5[_0xb1bf('0x3')](_0x5742f6,_0xe8bb6e);};}function removeListener(_0xc167a3,_0x550b6f){return function(){FaxMessageEvents[_0xb1bf('0x4')](_0xc167a3,_0x550b6f);};}exports[_0xb1bf('0x5')]=function(_0xaac5c4){for(var _0x116fd0=0x0,_0x5a95c0=events[_0xb1bf('0x6')];_0x116fd0<_0x5a95c0;_0x116fd0++){var _0x236795=events[_0x116fd0];var _0x375b89=createListener(_0xb1bf('0x7')+_0x236795,_0xaac5c4);FaxMessageEvents['on'](_0x236795,_0x375b89);}}; \ No newline at end of file +var _0xb6bf=['emit','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x3b8a24,_0x54b12f){var _0x2bbac1=function(_0x5f0714){while(--_0x5f0714){_0x3b8a24['push'](_0x3b8a24['shift']());}};_0x2bbac1(++_0x54b12f);}(_0xb6bf,0xf9));var _0xfb6b=function(_0x4b6ece,_0x3234be){_0x4b6ece=_0x4b6ece-0x0;var _0x55c744=_0xb6bf[_0x4b6ece];return _0x55c744;};'use strict';var FaxMessageEvents=require(_0xfb6b('0x0'));var events=[_0xfb6b('0x1'),_0xfb6b('0x2'),'update'];function createListener(_0x527b20,_0x33e6bb){return function(_0x5e427e){_0x33e6bb[_0xfb6b('0x3')](_0x527b20,_0x5e427e);};}function removeListener(_0x1f1feb,_0x2db5cc){return function(){FaxMessageEvents['removeListener'](_0x1f1feb,_0x2db5cc);};}exports[_0xfb6b('0x4')]=function(_0x1d290d){for(var _0x533b1d=0x0,_0x4445fe=events[_0xfb6b('0x5')];_0x533b1d<_0x4445fe;_0x533b1d++){var _0x5be385=events[_0x533b1d];var _0x2cd0fe=createListener(_0xfb6b('0x6')+_0x5be385,_0x1d290d);FaxMessageEvents['on'](_0x5be385,_0x2cd0fe);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 209e9fd..ab0ab38 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 _0x9bde=['index','/describe','isAuthenticated','describe','/:id','show','download','post','fax','faxmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get'];(function(_0x4bf574,_0x185cd8){var _0x2d6b82=function(_0x5d11a2){while(--_0x5d11a2){_0x4bf574['push'](_0x4bf574['shift']());}};_0x2d6b82(++_0x185cd8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x162648,_0xcfed8f){_0x162648=_0x162648-0x0;var _0x270d70=_0x9bde[_0x162648];return _0x270d70;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe9bd('0xf')]);router[_0xe9bd('0x10')]('/',auth[_0xe9bd('0xb')](),interaction['tracked'](_0xe9bd('0x11'),_0xe9bd('0x12')),controller[_0xe9bd('0x13')]);router[_0xe9bd('0x14')]('/:id',auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x14')](_0xe9bd('0x15'),auth[_0xe9bd('0xb')](),controller['accept']);router['put'](_0xe9bd('0x16'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x17')]);router[_0xe9bd('0x18')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7af2=['/:id/reject','reject','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','show','faxmessage:create','put','update','/:id/accept','accept'];(function(_0x3d7419,_0x4d8c11){var _0x5e25cb=function(_0x30b59e){while(--_0x30b59e){_0x3d7419['push'](_0x3d7419['shift']());}};_0x5e25cb(++_0x4d8c11);}(_0x7af2,0x119));var _0x27af=function(_0x33fcc2,_0xd83799){_0x33fcc2=_0x33fcc2-0x0;var _0x56a707=_0x7af2[_0x33fcc2];return _0x56a707;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var fs_extra=require(_0x27af('0x4'));var auth=require(_0x27af('0x5'));var interaction=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var controller=require(_0x27af('0x8'));router[_0x27af('0x9')]('/',auth[_0x27af('0xa')](),controller[_0x27af('0xb')]);router[_0x27af('0x9')]('/describe',auth[_0x27af('0xa')](),controller[_0x27af('0xc')]);router[_0x27af('0x9')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0xd')]);router[_0x27af('0x9')]('/:id/download',auth[_0x27af('0xa')](),controller['download']);router['post']('/',auth[_0x27af('0xa')](),interaction['tracked']('fax',_0x27af('0xe')),controller['create']);router[_0x27af('0xf')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0x10')]);router[_0x27af('0xf')](_0x27af('0x11'),auth[_0x27af('0xa')](),controller[_0x27af('0x12')]);router[_0x27af('0xf')](_0x27af('0x13'),auth[_0x27af('0xa')](),controller[_0x27af('0x14')]);router[_0x27af('0x15')](_0x27af('0x16'),auth[_0x27af('0xa')](),controller[_0x27af('0x17')]);module[_0x27af('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 44b7794..c71f787 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 _0xf151=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xeb9e77,_0x535701){var _0x3468ec=function(_0x2c0ad9){while(--_0x2c0ad9){_0xeb9e77['push'](_0xeb9e77['shift']());}};_0x3468ec(++_0x535701);}(_0xf151,0x1aa));var _0x1f15=function(_0x162d44,_0x4461b8){_0x162d44=_0x162d44-0x0;var _0x3383a6=_0xf151[_0x162d44];return _0x3383a6;};'use strict';var Sequelize=require(_0x1f15('0x0'));module[_0x1f15('0x1')]={'name':{'type':Sequelize[_0x1f15('0x2')],'unique':_0x1f15('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1f15('0x2')]},'timeout':{'type':Sequelize[_0x1f15('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1f15('0x5')](_0x1f15('0x6'),_0x1f15('0x7'),_0x1f15('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e6e=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e6e,0x74));var _0xe5e6=function(_0x226dae,_0x35dccf){_0x226dae=_0x226dae-0x0;var _0x57db37=_0x5e6e[_0x226dae];return _0x57db37;};'use strict';var Sequelize=require(_0xe5e6('0x0'));module[_0xe5e6('0x1')]={'name':{'type':Sequelize[_0xe5e6('0x2')],'unique':_0xe5e6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe5e6('0x2')]},'timeout':{'type':Sequelize[_0xe5e6('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe5e6('0x5')](_0xe5e6('0x6'),'beepall',_0xe5e6('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe5e6('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 44325f9..d8d61b8 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 _0xeae8=['Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','map','filter','merge','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','online','interface','flatMap','Agents','sequelize','findOrCreate','removeTeams','ids','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','emit','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xeae8,0x66));var _0x8eae=function(_0x20c594,_0x1454f7){_0x20c594=_0x20c594-0x0;var _0x4c39fd=_0xeae8[_0x20c594];return _0x4c39fd;};'use strict';var BPromise=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var _=require(_0x8eae('0x2'));var squel=require('squel');var Redis=require(_0x8eae('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x8eae('0x4'))('api');var config=require(_0x8eae('0x5'));var db=require(_0x8eae('0x6'))['db'];config[_0x8eae('0x7')]=_[_0x8eae('0x8')](config[_0x8eae('0x7')],{'host':_0x8eae('0x9'),'port':0x18eb});var socket=require(_0x8eae('0xa'))(new Redis(config[_0x8eae('0x7')]));require(_0x8eae('0xb'))[_0x8eae('0xc')](socket);function respondWithStatusCode(_0x476ba1,_0x48581b){_0x48581b=_0x48581b||0xcc;return function(_0x4ecbe7){if(_0x4ecbe7){return _0x476ba1[_0x8eae('0xd')](_0x48581b);}return _0x476ba1[_0x8eae('0xe')](_0x48581b)[_0x8eae('0xf')]();};}function respondWithResult(_0x329b64,_0x15ba7d){_0x15ba7d=_0x15ba7d||0xc8;return function(_0x4aba96){if(_0x4aba96){return _0x329b64['status'](_0x15ba7d)['json'](_0x4aba96);}};}function respondWithFilteredResult(_0x9bf1c1,_0x3ade80){return function(_0x5098cf){if(_0x5098cf){var _0x406afc=typeof _0x3ade80['offset']===_0x8eae('0x10')&&typeof _0x3ade80[_0x8eae('0x11')]===_0x8eae('0x10');var _0x10f61e=_0x5098cf[_0x8eae('0x12')];var _0x549d19=_0x406afc?0x0:_0x3ade80[_0x8eae('0x13')];var _0x39d8e7=_0x406afc?_0x5098cf[_0x8eae('0x12')]:_0x3ade80[_0x8eae('0x13')]+_0x3ade80[_0x8eae('0x11')];var _0x1cec9f;if(_0x39d8e7>=_0x10f61e){_0x39d8e7=_0x10f61e;_0x1cec9f=0xc8;}else{_0x1cec9f=0xce;}_0x9bf1c1[_0x8eae('0xe')](_0x1cec9f);return _0x9bf1c1[_0x8eae('0x14')](_0x8eae('0x15'),_0x549d19+'-'+_0x39d8e7+'/'+_0x10f61e)['json'](_0x5098cf);}return null;};}function saveUpdates(_0x5e214e){return function(_0x4e3950){if(_0x4e3950){return _0x4e3950[_0x8eae('0x16')](_0x5e214e)['then'](function(_0x3db47b){return _0x3db47b;});}return null;};}function removeEntity(_0x3fe930){return function(_0x386a97){if(_0x386a97){return _0x386a97[_0x8eae('0x17')]()[_0x8eae('0x18')](function(){var _0x173672=_0x386a97[_0x8eae('0x19')]({'plain':!![]});var _0x42e734=_0x8eae('0x1a');return db[_0x8eae('0x1b')]['destroy']({'where':{'type':_0x42e734,'resourceId':_0x173672['id']}})['then'](function(){return _0x386a97;});})[_0x8eae('0x18')](function(){_0x3fe930[_0x8eae('0xe')](0xcc)[_0x8eae('0xf')]();});}};}function handleEntityNotFound(_0x4d4d8f){return function(_0x1ee7fb){if(!_0x1ee7fb){_0x4d4d8f[_0x8eae('0xd')](0x194);}return _0x1ee7fb;};}function handleError(_0x51fa34,_0x1dc612){_0x1dc612=_0x1dc612||0x1f4;return function(_0x3326b3){logger['error'](_0x3326b3[_0x8eae('0x1c')]);if(_0x3326b3[_0x8eae('0x1d')]){delete _0x3326b3[_0x8eae('0x1d')];}_0x51fa34[_0x8eae('0xe')](_0x1dc612)[_0x8eae('0x1e')](_0x3326b3);};}exports[_0x8eae('0x1f')]=function(_0x3761a6,_0x3efe66){var _0x14c0c5={};var _0x2fc7ec={'count':0x0,'rows':[]};var _0x386bec=_['map'](db[_0x8eae('0x20')][_0x8eae('0x21')],function(_0x141940){return{'name':_0x141940[_0x8eae('0x22')],'type':_0x141940[_0x8eae('0x23')][_0x8eae('0x24')]};});_0x14c0c5=qs[_0x8eae('0x25')](_0x386bec,_0x3761a6);var _0x4e7d7c={'where':_0x14c0c5[_0x8eae('0x26')]};return db['FaxQueue'][_0x8eae('0x12')](_0x4e7d7c)[_0x8eae('0x18')](function(_0x34f0c4){_0x2fc7ec[_0x8eae('0x12')]=_0x34f0c4;_0x14c0c5[_0x8eae('0x27')]=qs['include'](_0x3761a6['query']);return db[_0x8eae('0x20')][_0x8eae('0x28')](_0x14c0c5);})[_0x8eae('0x18')](function(_0x307a19){_0x2fc7ec['rows']=_0x307a19;return _0x2fc7ec;})[_0x8eae('0x18')](respondWithFilteredResult(_0x3efe66,_0x14c0c5))[_0x8eae('0x29')](handleError(_0x3efe66,null));};exports[_0x8eae('0x2a')]=function(_0x3273c0,_0x2f92d0){var _0x2e9c51={'raw':!![],'where':{'id':_0x3273c0[_0x8eae('0x2b')]['id']}},_0x286bb2={};_0x286bb2[_0x8eae('0x2c')]=_[_0x8eae('0x2d')](db[_0x8eae('0x20')][_0x8eae('0x21')]);_0x286bb2[_0x8eae('0x2e')]=_[_0x8eae('0x2d')](_0x3273c0[_0x8eae('0x2e')]);_0x286bb2[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x286bb2[_0x8eae('0x2c')],_0x286bb2[_0x8eae('0x2e')]);_0x2e9c51[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x286bb2['model'],qs[_0x8eae('0x32')](_0x3273c0[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x2e9c51['attributes']=_0x2e9c51[_0x8eae('0x31')][_0x8eae('0x33')]?_0x2e9c51[_0x8eae('0x31')]:_0x286bb2[_0x8eae('0x2c')];if(_0x3273c0['query'][_0x8eae('0x34')]){_0x2e9c51['include']=[{'all':!![]}];}_0x2e9c51=_['merge']({},_0x2e9c51,_0x3273c0[_0x8eae('0x35')]);return db[_0x8eae('0x20')][_0x8eae('0x36')](_0x2e9c51)[_0x8eae('0x18')](handleEntityNotFound(_0x2f92d0,null))[_0x8eae('0x18')](respondWithResult(_0x2f92d0,null))[_0x8eae('0x29')](handleError(_0x2f92d0,null));};exports[_0x8eae('0x37')]=function(_0x53bd4b,_0x71f9be){return db[_0x8eae('0x20')]['create'](_0x53bd4b['body'],{})['then'](function(_0x6cc974){var _0x3b6bba=_0x53bd4b['user'][_0x8eae('0x19')]({'plain':!![]});if(!_0x3b6bba)throw new Error(_0x8eae('0x38'));if(_0x3b6bba['role']===_0x8eae('0x39')){var _0x2ee9c2=_0x6cc974[_0x8eae('0x19')]({'plain':!![]});var _0x11c626=_0x8eae('0x1a');return db['UserProfileSection'][_0x8eae('0x36')]({'where':{'name':_0x11c626,'userProfileId':_0x3b6bba[_0x8eae('0x3a')]},'raw':!![]})[_0x8eae('0x18')](function(_0x488b61){if(_0x488b61&&_0x488b61[_0x8eae('0x3b')]===0x0){return db[_0x8eae('0x1b')]['create']({'name':_0x2ee9c2[_0x8eae('0x1d')],'resourceId':_0x2ee9c2['id'],'type':_0x488b61[_0x8eae('0x1d')],'sectionId':_0x488b61['id']},{})[_0x8eae('0x18')](function(){return _0x6cc974;});}else{return _0x6cc974;}})[_0x8eae('0x29')](function(_0x5923f7){logger[_0x8eae('0x3c')](_0x8eae('0x3d'),_0x5923f7);throw _0x5923f7;});}return _0x6cc974;})[_0x8eae('0x18')](respondWithResult(_0x71f9be,0xc9))[_0x8eae('0x29')](handleError(_0x71f9be,null));};exports['update']=function(_0x985430,_0x284dca){if(_0x985430[_0x8eae('0x3e')]['id']){delete _0x985430[_0x8eae('0x3e')]['id'];}return db['FaxQueue'][_0x8eae('0x36')]({'where':{'id':_0x985430['params']['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x284dca,null))['then'](saveUpdates(_0x985430[_0x8eae('0x3e')],null))[_0x8eae('0x18')](respondWithResult(_0x284dca,null))['catch'](handleError(_0x284dca,null));};exports[_0x8eae('0x17')]=function(_0x22bf50,_0x1fdf59){return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x22bf50[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x1fdf59,null))[_0x8eae('0x18')](removeEntity(_0x1fdf59,null))[_0x8eae('0x29')](handleError(_0x1fdf59,null));};exports['describe']=function(_0x35000d,_0x590e0b){return db[_0x8eae('0x20')][_0x8eae('0x3f')]()[_0x8eae('0x18')](respondWithResult(_0x590e0b,null))[_0x8eae('0x29')](handleError(_0x590e0b,null));};exports['getMembers']=function(_0x2a4bc9,_0x32fec2){var _0x27cccb={'raw':!![],'where':{}},_0x448004={},_0xc3f899;return db[_0x8eae('0x20')][_0x8eae('0x40')]({'where':{'id':_0x2a4bc9[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x32fec2,null))[_0x8eae('0x18')](function(_0x319a94){if(_0x319a94){_0xc3f899=_0x319a94['get']({'plain':!![]});_0x448004[_0x8eae('0x2c')]=_[_0x8eae('0x2d')](db['UserFaxQueue'][_0x8eae('0x21')]);_0x448004['query']=_[_0x8eae('0x2d')](_0x2a4bc9['query']);_0x448004[_0x8eae('0x2f')]=_['intersection'](_0x448004[_0x8eae('0x2c')],_0x448004[_0x8eae('0x2e')]);_0x27cccb[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x448004[_0x8eae('0x2c')],qs[_0x8eae('0x32')](_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x27cccb[_0x8eae('0x31')]=_0x27cccb[_0x8eae('0x31')][_0x8eae('0x33')]?_0x27cccb['attributes']:_0x448004['model'];if(!_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x41')](_0x8eae('0x42'))){_0x27cccb[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x2a4bc9[_0x8eae('0x2e')]['limit']);_0x27cccb[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x13')]);}_0x27cccb[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x2a4bc9['query'][_0x8eae('0x44')]);_0x27cccb[_0x8eae('0x26')]=qs['filters'](_[_0x8eae('0x45')](_0x2a4bc9[_0x8eae('0x2e')],_0x448004[_0x8eae('0x2f')]));_0x27cccb[_0x8eae('0x26')][_0x8eae('0x46')]=_0x319a94['id'];if(_0x2a4bc9[_0x8eae('0x2e')]['filter']){_0x27cccb[_0x8eae('0x26')]=_['merge'](_0x27cccb[_0x8eae('0x26')],{'$or':_[_0x8eae('0x47')](_0x27cccb[_0x8eae('0x31')],function(_0x537e25){var _0x33a210={};_0x33a210[_0x537e25]={'$like':'%'+_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x33a210;})});}_0x27cccb=_[_0x8eae('0x49')]({},_0x27cccb,_0x2a4bc9[_0x8eae('0x35')]);return db[_0x8eae('0x4a')][_0x8eae('0x28')](_0x27cccb);}})[_0x8eae('0x18')](function(_0x226120){if(_0x226120){return db[_0x8eae('0x4b')][_0x8eae('0x4c')]({'where':{'id':_['map'](_0x226120,_0x8eae('0x4d')),'role':_0x8eae('0x4e')},'attributes':['id',_0x8eae('0x1d'),_0x8eae('0x4f'),_0x8eae('0x50'),_0x8eae('0x51')]});}})[_0x8eae('0x18')](function(_0x1d105e){if(_0x1d105e){return{'count':_0x1d105e[_0x8eae('0x12')],'rows':_[_0x8eae('0x47')](_0x1d105e[_0x8eae('0x52')],function(_0x5df388){return{'membername':_0x5df388[_0x8eae('0x1d')],'UserId':_0x5df388['id'],'queue_name':_0xc3f899[_0x8eae('0x1d')],'FaxQueueId':_0xc3f899['id'],'interface':util[_0x8eae('0x53')](_0x8eae('0x54'),_0x8eae('0x55'),_0x5df388[_0x8eae('0x1d')]),'penalty':0x0,'paused':_0x5df388['faxPause'],'createdAt':_0x5df388[_0x8eae('0x51')],'updatedAt':_0x5df388['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8eae('0x18')](respondWithFilteredResult(_0x32fec2,_0x27cccb))['catch'](handleError(_0x32fec2,null));};exports[_0x8eae('0x56')]=function(_0x113b86,_0x573946){var _0x20a577={};var _0x572b8c={};var _0x5ce4ef;var _0x422436;return db['FaxQueue'][_0x8eae('0x40')]({'where':{'id':_0x113b86['params']['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x573946,null))['then'](function(_0x3c57df){if(_0x3c57df){_0x5ce4ef=_0x3c57df;_0x572b8c['model']=_['keys'](db['Team'][_0x8eae('0x21')]);_0x572b8c[_0x8eae('0x2e')]=_['keys'](_0x113b86[_0x8eae('0x2e')]);_0x572b8c[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x572b8c['model'],_0x572b8c[_0x8eae('0x2e')]);_0x20a577['attributes']=_[_0x8eae('0x30')](_0x572b8c['model'],qs['fields'](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x20a577['attributes']=_0x20a577[_0x8eae('0x31')][_0x8eae('0x33')]?_0x20a577['attributes']:_0x572b8c[_0x8eae('0x2c')];_0x20a577[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x44')]);_0x20a577['where']=qs[_0x8eae('0x2f')](_[_0x8eae('0x45')](_0x113b86['query'],_0x572b8c[_0x8eae('0x2f')]));if(_0x113b86[_0x8eae('0x2e')][_0x8eae('0x48')]){_0x20a577[_0x8eae('0x26')]=_['merge'](_0x20a577[_0x8eae('0x26')],{'$or':_[_0x8eae('0x47')](_0x20a577[_0x8eae('0x31')],function(_0x20660d){var _0x327ead={};_0x327ead[_0x20660d]={'$like':'%'+_0x113b86[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x327ead;})});}_0x20a577=_[_0x8eae('0x49')]({},_0x20a577,_0x113b86[_0x8eae('0x35')]);return _0x5ce4ef[_0x8eae('0x56')](_0x20a577);}})[_0x8eae('0x18')](function(_0x59ef33){if(_0x59ef33){_0x422436=_0x59ef33['length'];if(!_0x113b86[_0x8eae('0x2e')][_0x8eae('0x41')](_0x8eae('0x42'))){_0x20a577[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x113b86['query'][_0x8eae('0x11')]);_0x20a577['offset']=qs['offset'](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x13')]);}return _0x5ce4ef[_0x8eae('0x56')](_0x20a577);}})[_0x8eae('0x18')](function(_0x255490){if(_0x255490){return _0x255490?{'count':_0x422436,'rows':_0x255490}:null;}})[_0x8eae('0x18')](respondWithResult(_0x573946,null))[_0x8eae('0x29')](handleError(_0x573946,null));};exports[_0x8eae('0x57')]=function(_0x48e08c,_0x3380ea){var _0x3041b6=_0x48e08c[_0x8eae('0x3e')]['ids'];return db[_0x8eae('0x58')]['findAll']({'where':{'id':_0x3041b6},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x8eae('0x1d'),_0x8eae('0x59'),'voicePause',_0x8eae('0x5a')],'raw':!![]}]})['then'](function(_0x4de55c){if(_0x4de55c){var _0x28043f=_[_0x8eae('0x5b')](_0x4de55c,function(_0x229125){var _0xa8a22b=_0x229125[_0x8eae('0x19')]({'plain':!![]});return _0xa8a22b[_0x8eae('0x5c')];});return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x48e08c['params']['id']}})['then'](function(_0x2eb092){return db[_0x8eae('0x5d')]['transaction'](function(_0x2f14fd){return _0x2eb092['addTeams'](_0x3041b6,{'transaction':_0x2f14fd})['then'](function(){return BPromise['each'](_0x28043f,function(_0x1a8f28){return db[_0x8eae('0x4a')][_0x8eae('0x5e')]({'where':{'UserId':_0x1a8f28['id'],'FaxQueueId':_0x48e08c[_0x8eae('0x2b')]['id']},'transaction':_0x2f14fd});});})[_0x8eae('0x18')](function(){_0x28043f['forEach'](function(_0x2c45c0){socket['emit']('userFaxQueue:save',{'UserId':_0x2c45c0['id'],'FaxQueueId':_0x2eb092['id']});});});});});}})[_0x8eae('0x18')](respondWithStatusCode(_0x3380ea,null))[_0x8eae('0x29')](handleError(_0x3380ea,null));};exports[_0x8eae('0x5f')]=function(_0x317034,_0x41bef6){return db['Team'][_0x8eae('0x28')]({'where':{'id':_0x317034[_0x8eae('0x2e')][_0x8eae('0x60')]},'attributes':['id'],'include':[{'model':db[_0x8eae('0x4b')],'as':_0x8eae('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x8eae('0x18')](handleEntityNotFound(_0x41bef6,null))['then'](function(_0x10601e){var _0x480cc2=_[_0x8eae('0x47')](_0x10601e,'id');var _0x33bcae=[];var _0x366fa1=[];var _0x57da24=squel[_0x8eae('0x61')]();_0x57da24[_0x8eae('0x62')](_0x8eae('0x63'))['from'](_0x8eae('0x64'),'tq')[_0x8eae('0x65')]('user_has_teams','ut',_0x8eae('0x66'))[_0x8eae('0x26')](_0x8eae('0x67'),_0x317034[_0x8eae('0x2b')]['id']);for(var _0x426680=0x0;_0x426680<_0x10601e[_0x8eae('0x33')];_0x426680+=0x1){let _0x5cdc7a=_0x10601e[_0x426680];for(var _0x4ad1c1=0x0;_0x4ad1c1<_0x5cdc7a[_0x8eae('0x5c')][_0x8eae('0x33')];_0x4ad1c1+=0x1){let _0x3be5dd=_0x5cdc7a[_0x8eae('0x5c')][_0x4ad1c1];var _0x1d1fde=_0x57da24[_0x8eae('0x68')]();_0x1d1fde[_0x8eae('0x26')](_0x8eae('0x69'),_0x3be5dd['id']);_0x366fa1[_0x8eae('0x6a')](db[_0x8eae('0x5d')]['query'](_0x1d1fde[_0x8eae('0x6b')](),{'type':db[_0x8eae('0x5d')]['QueryTypes']['SELECT']})[_0x8eae('0x18')](function(_0x33b9b1){if(_0x33b9b1[_0x8eae('0x33')]===0x1){return _0x3be5dd['id'];}else{var _0x549547=_[_0x8eae('0x6c')](_[_0x8eae('0x47')](_0x33b9b1,_0x8eae('0x6d')),function(_0x5023c2){return _[_0x8eae('0x6e')](_0x480cc2,_0x5023c2);});if(_0x549547){return _0x3be5dd['id'];}}}));}}return BPromise[_0x8eae('0x6f')](_0x366fa1)[_0x8eae('0x18')](function(_0x4e8ecc){_0x33bcae=_(_0x33bcae)['union'](_0x4e8ecc)[_0x8eae('0x70')]()[_0x8eae('0x71')]();return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x317034[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](function(_0x378ee4){return db[_0x8eae('0x5d')]['transaction'](function(_0x1b9b16){return _0x378ee4['removeTeams'](_0x317034[_0x8eae('0x2e')][_0x8eae('0x60')],{'transaction':_0x1b9b16})['then'](function(){if(!_[_0x8eae('0x72')](_0x33bcae)){return _0x378ee4[_0x8eae('0x73')](_0x33bcae,{'transaction':_0x1b9b16});}})[_0x8eae('0x18')](function(){_0x33bcae[_0x8eae('0x74')](function(_0x20635f){socket['emit'](_0x8eae('0x75'),{'UserId':_0x20635f,'FaxQueueId':_0x378ee4['id']});});});});});});})[_0x8eae('0x18')](respondWithStatusCode(_0x41bef6,null))[_0x8eae('0x29')](handleError(_0x41bef6,null));};exports['addAgents']=function(_0xbde2b8,_0xc846b8){return db['FaxQueue'][_0x8eae('0x36')]({'where':{'id':_0xbde2b8[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0xc846b8,null))['then'](function(_0x926831){if(_0x926831){return _0x926831[_0x8eae('0x76')](_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')],_[_0x8eae('0x77')](_0xbde2b8[_0x8eae('0x3e')],['ids','id'])||{})['spread'](function(_0xf3d28d){for(var _0xc04b9a=0x0;_0xc04b9a<_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')][_0x8eae('0x33')];_0xc04b9a+=0x1){socket[_0x8eae('0x78')]('userFaxQueue:save',{'UserId':Number(_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')][_0xc04b9a]),'FaxQueueId':Number(_0xbde2b8[_0x8eae('0x2b')]['id'])});}return _0xf3d28d;});}})[_0x8eae('0x18')](respondWithResult(_0xc846b8,null))['catch'](handleError(_0xc846b8,null));};exports[_0x8eae('0x73')]=function(_0x32f653,_0x222cb3){return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x32f653[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x222cb3,null))[_0x8eae('0x18')](function(_0xc20b44){if(_0xc20b44){return _0xc20b44[_0x8eae('0x73')](_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')])[_0x8eae('0x18')](function(){if(_[_0x8eae('0x79')](_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')])){for(var _0x46000c=0x0;_0x46000c<_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')][_0x8eae('0x33')];_0x46000c+=0x1){socket[_0x8eae('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')][_0x46000c]),'FaxQueueId':Number(_0x32f653[_0x8eae('0x2b')]['id'])});}}else{socket[_0x8eae('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x32f653[_0x8eae('0x2e')]['ids']),'FaxQueueId':Number(_0x32f653[_0x8eae('0x2b')]['id'])});}});}})[_0x8eae('0x18')](respondWithStatusCode(_0x222cb3,null))['catch'](handleError(_0x222cb3,null));};exports[_0x8eae('0x7a')]=function(_0x2cd852,_0x29897c){var _0x400da5={};var _0x56b399={};var _0x1500ba;var _0x1c05c8;return db[_0x8eae('0x20')][_0x8eae('0x40')]({'where':{'id':_0x2cd852[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x29897c,null))[_0x8eae('0x18')](function(_0x5c1837){if(_0x5c1837){_0x1500ba=_0x5c1837;_0x56b399['model']=_[_0x8eae('0x2d')](db['User'][_0x8eae('0x21')]);_0x56b399['query']=_[_0x8eae('0x2d')](_0x2cd852[_0x8eae('0x2e')]);_0x56b399[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x56b399[_0x8eae('0x2c')],_0x56b399[_0x8eae('0x2e')]);_0x400da5[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x56b399[_0x8eae('0x2c')],qs[_0x8eae('0x32')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x400da5['attributes']=_0x400da5[_0x8eae('0x31')]['length']?_0x400da5[_0x8eae('0x31')]:_0x56b399[_0x8eae('0x2c')];_0x400da5[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x44')]);_0x400da5[_0x8eae('0x26')]=qs['filters'](_[_0x8eae('0x45')](_0x2cd852[_0x8eae('0x2e')],_0x56b399['filters']));if(_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x48')]){_0x400da5['where']=_['merge'](_0x400da5[_0x8eae('0x26')],{'$or':_['map'](_0x400da5[_0x8eae('0x31')],function(_0x1b6bf3){var _0x408c5c={};_0x408c5c[_0x1b6bf3]={'$like':'%'+_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x408c5c;})});}_0x400da5=_['merge']({},_0x400da5,_0x2cd852[_0x8eae('0x35')]);return _0x1500ba[_0x8eae('0x7a')](_0x400da5);}})['then'](function(_0x5d7073){if(_0x5d7073){_0x1c05c8=_0x5d7073[_0x8eae('0x33')];if(!_0x2cd852['query'][_0x8eae('0x41')](_0x8eae('0x42'))){_0x400da5[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x11')]);_0x400da5[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x13')]);}return _0x1500ba[_0x8eae('0x7a')](_0x400da5);}})[_0x8eae('0x18')](function(_0x27943f){if(_0x27943f){return _0x27943f?{'count':_0x1c05c8,'rows':_0x27943f}:null;}})['then'](respondWithResult(_0x29897c,null))[_0x8eae('0x29')](handleError(_0x29897c,null));}; \ No newline at end of file +var _0x0a1c=['stack','name','send','index','map','FaxQueue','fieldName','type','getOptions','where','include','query','findAll','catch','show','model','keys','filters','attributes','intersection','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','findOne','UserFaxQueue','hasOwnProperty','order','sort','pick','FaxQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','createdAt','getTeams','Team','rawAttributes','nolimit','addTeams','ids','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','Agents','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userFaxQueue:remove','getAgents','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error'];(function(_0x545913,_0x353f9b){var _0x13d315=function(_0x375de5){while(--_0x375de5){_0x545913['push'](_0x545913['shift']());}};_0x13d315(++_0x353f9b);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x0a1c[_0x4baae2];return _0x1a2285;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc0a1('0x0'));var squel=require(_0xc0a1('0x1'));var Redis=require(_0xc0a1('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc0a1('0x3'));var config=require(_0xc0a1('0x4'));var db=require(_0xc0a1('0x5'))['db'];config[_0xc0a1('0x6')]=_[_0xc0a1('0x7')](config[_0xc0a1('0x6')],{'host':_0xc0a1('0x8'),'port':0x18eb});var socket=require(_0xc0a1('0x9'))(new Redis(config[_0xc0a1('0x6')]));require(_0xc0a1('0xa'))[_0xc0a1('0xb')](socket);function respondWithStatusCode(_0x42c215,_0x14e116){_0x14e116=_0x14e116||0xcc;return function(_0x2cfd8a){if(_0x2cfd8a){return _0x42c215[_0xc0a1('0xc')](_0x14e116);}return _0x42c215[_0xc0a1('0xd')](_0x14e116)[_0xc0a1('0xe')]();};}function respondWithResult(_0x4a1238,_0x9457ef){_0x9457ef=_0x9457ef||0xc8;return function(_0x234f42){if(_0x234f42){return _0x4a1238[_0xc0a1('0xd')](_0x9457ef)['json'](_0x234f42);}};}function respondWithFilteredResult(_0x360dc4,_0x4683ab){return function(_0xd25ae5){if(_0xd25ae5){var _0x4d9b49=typeof _0x4683ab[_0xc0a1('0xf')]===_0xc0a1('0x10')&&typeof _0x4683ab['limit']===_0xc0a1('0x10');var _0x47887=_0xd25ae5[_0xc0a1('0x11')];var _0x395ade=_0x4d9b49?0x0:_0x4683ab[_0xc0a1('0xf')];var _0x517689=_0x4d9b49?_0xd25ae5['count']:_0x4683ab[_0xc0a1('0xf')]+_0x4683ab[_0xc0a1('0x12')];var _0x49a97c;if(_0x517689>=_0x47887){_0x517689=_0x47887;_0x49a97c=0xc8;}else{_0x49a97c=0xce;}_0x360dc4['status'](_0x49a97c);return _0x360dc4[_0xc0a1('0x13')](_0xc0a1('0x14'),_0x395ade+'-'+_0x517689+'/'+_0x47887)['json'](_0xd25ae5);}return null;};}function saveUpdates(_0x334cc4){return function(_0xcec062){if(_0xcec062){return _0xcec062[_0xc0a1('0x15')](_0x334cc4)[_0xc0a1('0x16')](function(_0x234067){return _0x234067;});}return null;};}function removeEntity(_0x124d0f){return function(_0x36620e){if(_0x36620e){return _0x36620e[_0xc0a1('0x17')]()[_0xc0a1('0x16')](function(){var _0x36acc2=_0x36620e[_0xc0a1('0x18')]({'plain':!![]});var _0x26ca3c=_0xc0a1('0x19');return db[_0xc0a1('0x1a')][_0xc0a1('0x17')]({'where':{'type':_0x26ca3c,'resourceId':_0x36acc2['id']}})[_0xc0a1('0x16')](function(){return _0x36620e;});})['then'](function(){_0x124d0f[_0xc0a1('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340d03){return function(_0xc9d7b0){if(!_0xc9d7b0){_0x340d03[_0xc0a1('0xc')](0x194);}return _0xc9d7b0;};}function handleError(_0x316f1a,_0x40eaa4){_0x40eaa4=_0x40eaa4||0x1f4;return function(_0x53b9ca){logger[_0xc0a1('0x1b')](_0x53b9ca[_0xc0a1('0x1c')]);if(_0x53b9ca[_0xc0a1('0x1d')]){delete _0x53b9ca[_0xc0a1('0x1d')];}_0x316f1a[_0xc0a1('0xd')](_0x40eaa4)[_0xc0a1('0x1e')](_0x53b9ca);};}exports[_0xc0a1('0x1f')]=function(_0x6b1ca5,_0x3e1a93){var _0x161bff={};var _0x5d9925={'count':0x0,'rows':[]};var _0x569816=_[_0xc0a1('0x20')](db[_0xc0a1('0x21')]['rawAttributes'],function(_0x52ba51){return{'name':_0x52ba51[_0xc0a1('0x22')],'type':_0x52ba51[_0xc0a1('0x23')]['key']};});_0x161bff=qs[_0xc0a1('0x24')](_0x569816,_0x6b1ca5);var _0x95b026={'where':_0x161bff[_0xc0a1('0x25')]};return db[_0xc0a1('0x21')][_0xc0a1('0x11')](_0x95b026)[_0xc0a1('0x16')](function(_0x114f76){_0x5d9925[_0xc0a1('0x11')]=_0x114f76;_0x161bff['include']=qs[_0xc0a1('0x26')](_0x6b1ca5[_0xc0a1('0x27')]);return db[_0xc0a1('0x21')][_0xc0a1('0x28')](_0x161bff);})[_0xc0a1('0x16')](function(_0x38750d){_0x5d9925['rows']=_0x38750d;return _0x5d9925;})['then'](respondWithFilteredResult(_0x3e1a93,_0x161bff))[_0xc0a1('0x29')](handleError(_0x3e1a93,null));};exports[_0xc0a1('0x2a')]=function(_0x5b7d77,_0xa341c0){var _0x4f1a93={'raw':!![],'where':{'id':_0x5b7d77['params']['id']}},_0x1e7317={};_0x1e7317[_0xc0a1('0x2b')]=_[_0xc0a1('0x2c')](db[_0xc0a1('0x21')]['rawAttributes']);_0x1e7317[_0xc0a1('0x27')]=_['keys'](_0x5b7d77[_0xc0a1('0x27')]);_0x1e7317[_0xc0a1('0x2d')]=_['intersection'](_0x1e7317[_0xc0a1('0x2b')],_0x1e7317[_0xc0a1('0x27')]);_0x4f1a93[_0xc0a1('0x2e')]=_[_0xc0a1('0x2f')](_0x1e7317[_0xc0a1('0x2b')],qs[_0xc0a1('0x30')](_0x5b7d77['query'][_0xc0a1('0x30')]));_0x4f1a93[_0xc0a1('0x2e')]=_0x4f1a93[_0xc0a1('0x2e')][_0xc0a1('0x31')]?_0x4f1a93[_0xc0a1('0x2e')]:_0x1e7317[_0xc0a1('0x2b')];if(_0x5b7d77['query']['includeAll']){_0x4f1a93[_0xc0a1('0x26')]=[{'all':!![]}];}_0x4f1a93=_[_0xc0a1('0x32')]({},_0x4f1a93,_0x5b7d77[_0xc0a1('0x33')]);return db['FaxQueue']['find'](_0x4f1a93)[_0xc0a1('0x16')](handleEntityNotFound(_0xa341c0,null))[_0xc0a1('0x16')](respondWithResult(_0xa341c0,null))[_0xc0a1('0x29')](handleError(_0xa341c0,null));};exports['create']=function(_0xc80b,_0x423da0){return db['FaxQueue'][_0xc0a1('0x34')](_0xc80b[_0xc0a1('0x35')],{})['then'](function(_0x3fa7cd){var _0x32f40b=_0xc80b[_0xc0a1('0x36')][_0xc0a1('0x18')]({'plain':!![]});if(!_0x32f40b)throw new Error(_0xc0a1('0x37'));if(_0x32f40b[_0xc0a1('0x38')]===_0xc0a1('0x36')){var _0x42309c=_0x3fa7cd['get']({'plain':!![]});var _0x498bf2=_0xc0a1('0x19');return db[_0xc0a1('0x39')]['find']({'where':{'name':_0x498bf2,'userProfileId':_0x32f40b[_0xc0a1('0x3a')]},'raw':!![]})[_0xc0a1('0x16')](function(_0x273b64){if(_0x273b64&&_0x273b64[_0xc0a1('0x3b')]===0x0){return db[_0xc0a1('0x1a')][_0xc0a1('0x34')]({'name':_0x42309c['name'],'resourceId':_0x42309c['id'],'type':_0x273b64[_0xc0a1('0x1d')],'sectionId':_0x273b64['id']},{})[_0xc0a1('0x16')](function(){return _0x3fa7cd;});}else{return _0x3fa7cd;}})['catch'](function(_0x289501){logger[_0xc0a1('0x1b')](_0xc0a1('0x3c'),_0x289501);throw _0x289501;});}return _0x3fa7cd;})[_0xc0a1('0x16')](respondWithResult(_0x423da0,0xc9))[_0xc0a1('0x29')](handleError(_0x423da0,null));};exports[_0xc0a1('0x15')]=function(_0x41d73d,_0x4d9b35){if(_0x41d73d['body']['id']){delete _0x41d73d[_0xc0a1('0x35')]['id'];}return db['FaxQueue'][_0xc0a1('0x3d')]({'where':{'id':_0x41d73d['params']['id']}})['then'](handleEntityNotFound(_0x4d9b35,null))[_0xc0a1('0x16')](saveUpdates(_0x41d73d[_0xc0a1('0x35')],null))[_0xc0a1('0x16')](respondWithResult(_0x4d9b35,null))[_0xc0a1('0x29')](handleError(_0x4d9b35,null));};exports[_0xc0a1('0x17')]=function(_0x23ae3a,_0x2b1730){return db[_0xc0a1('0x21')][_0xc0a1('0x3d')]({'where':{'id':_0x23ae3a[_0xc0a1('0x3e')]['id']}})[_0xc0a1('0x16')](handleEntityNotFound(_0x2b1730,null))[_0xc0a1('0x16')](removeEntity(_0x2b1730,null))[_0xc0a1('0x29')](handleError(_0x2b1730,null));};exports[_0xc0a1('0x3f')]=function(_0xdbf055,_0x2df4cf){return db['FaxQueue'][_0xc0a1('0x3f')]()[_0xc0a1('0x16')](respondWithResult(_0x2df4cf,null))['catch'](handleError(_0x2df4cf,null));};exports['getMembers']=function(_0x187e91,_0x581818){var _0xbac6ae={'raw':!![],'where':{}},_0x1bc504={},_0x796690;return db['FaxQueue'][_0xc0a1('0x40')]({'where':{'id':_0x187e91[_0xc0a1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x581818,null))[_0xc0a1('0x16')](function(_0x45c24e){if(_0x45c24e){_0x796690=_0x45c24e['get']({'plain':!![]});_0x1bc504['model']=_[_0xc0a1('0x2c')](db[_0xc0a1('0x41')]['rawAttributes']);_0x1bc504[_0xc0a1('0x27')]=_[_0xc0a1('0x2c')](_0x187e91[_0xc0a1('0x27')]);_0x1bc504[_0xc0a1('0x2d')]=_['intersection'](_0x1bc504['model'],_0x1bc504[_0xc0a1('0x27')]);_0xbac6ae['attributes']=_[_0xc0a1('0x2f')](_0x1bc504['model'],qs[_0xc0a1('0x30')](_0x187e91['query'][_0xc0a1('0x30')]));_0xbac6ae[_0xc0a1('0x2e')]=_0xbac6ae['attributes'][_0xc0a1('0x31')]?_0xbac6ae[_0xc0a1('0x2e')]:_0x1bc504[_0xc0a1('0x2b')];if(!_0x187e91[_0xc0a1('0x27')][_0xc0a1('0x42')]('nolimit')){_0xbac6ae['limit']=qs[_0xc0a1('0x12')](_0x187e91['query'][_0xc0a1('0x12')]);_0xbac6ae['offset']=qs[_0xc0a1('0xf')](_0x187e91[_0xc0a1('0x27')][_0xc0a1('0xf')]);}_0xbac6ae[_0xc0a1('0x43')]=qs[_0xc0a1('0x44')](_0x187e91[_0xc0a1('0x27')][_0xc0a1('0x44')]);_0xbac6ae[_0xc0a1('0x25')]=qs[_0xc0a1('0x2d')](_[_0xc0a1('0x45')](_0x187e91[_0xc0a1('0x27')],_0x1bc504[_0xc0a1('0x2d')]));_0xbac6ae[_0xc0a1('0x25')][_0xc0a1('0x46')]=_0x45c24e['id'];if(_0x187e91[_0xc0a1('0x27')][_0xc0a1('0x47')]){_0xbac6ae[_0xc0a1('0x25')]=_['merge'](_0xbac6ae['where'],{'$or':_[_0xc0a1('0x20')](_0xbac6ae[_0xc0a1('0x2e')],function(_0x23b3e0){var _0x3d37d1={};_0x3d37d1[_0x23b3e0]={'$like':'%'+_0x187e91[_0xc0a1('0x27')][_0xc0a1('0x47')]+'%'};return _0x3d37d1;})});}_0xbac6ae=_[_0xc0a1('0x32')]({},_0xbac6ae,_0x187e91[_0xc0a1('0x33')]);return db[_0xc0a1('0x41')]['findAll'](_0xbac6ae);}})[_0xc0a1('0x16')](function(_0x2de5af){if(_0x2de5af){return db[_0xc0a1('0x48')][_0xc0a1('0x49')]({'where':{'id':_['map'](_0x2de5af,_0xc0a1('0x4a')),'role':_0xc0a1('0x4b')},'attributes':['id',_0xc0a1('0x1d'),'faxPause',_0xc0a1('0x4c'),'createdAt']});}})[_0xc0a1('0x16')](function(_0x57bcb){if(_0x57bcb){return{'count':_0x57bcb['count'],'rows':_[_0xc0a1('0x20')](_0x57bcb['rows'],function(_0x569079){return{'membername':_0x569079[_0xc0a1('0x1d')],'UserId':_0x569079['id'],'queue_name':_0x796690[_0xc0a1('0x1d')],'FaxQueueId':_0x796690['id'],'interface':util[_0xc0a1('0x4d')](_0xc0a1('0x4e'),'SIP',_0x569079['name']),'penalty':0x0,'paused':_0x569079['faxPause'],'createdAt':_0x569079[_0xc0a1('0x4f')],'updatedAt':_0x569079['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc0a1('0x16')](respondWithFilteredResult(_0x581818,_0xbac6ae))[_0xc0a1('0x29')](handleError(_0x581818,null));};exports[_0xc0a1('0x50')]=function(_0x4ef311,_0x4188a7){var _0x246a05={};var _0x20d116={};var _0x11ff04;var _0x33a06b;return db['FaxQueue'][_0xc0a1('0x40')]({'where':{'id':_0x4ef311[_0xc0a1('0x3e')]['id']}})[_0xc0a1('0x16')](handleEntityNotFound(_0x4188a7,null))['then'](function(_0x4cb4b3){if(_0x4cb4b3){_0x11ff04=_0x4cb4b3;_0x20d116['model']=_[_0xc0a1('0x2c')](db[_0xc0a1('0x51')][_0xc0a1('0x52')]);_0x20d116[_0xc0a1('0x27')]=_[_0xc0a1('0x2c')](_0x4ef311[_0xc0a1('0x27')]);_0x20d116[_0xc0a1('0x2d')]=_[_0xc0a1('0x2f')](_0x20d116[_0xc0a1('0x2b')],_0x20d116[_0xc0a1('0x27')]);_0x246a05['attributes']=_[_0xc0a1('0x2f')](_0x20d116[_0xc0a1('0x2b')],qs[_0xc0a1('0x30')](_0x4ef311[_0xc0a1('0x27')][_0xc0a1('0x30')]));_0x246a05[_0xc0a1('0x2e')]=_0x246a05[_0xc0a1('0x2e')]['length']?_0x246a05[_0xc0a1('0x2e')]:_0x20d116[_0xc0a1('0x2b')];_0x246a05['order']=qs['sort'](_0x4ef311['query']['sort']);_0x246a05[_0xc0a1('0x25')]=qs[_0xc0a1('0x2d')](_[_0xc0a1('0x45')](_0x4ef311[_0xc0a1('0x27')],_0x20d116[_0xc0a1('0x2d')]));if(_0x4ef311[_0xc0a1('0x27')][_0xc0a1('0x47')]){_0x246a05[_0xc0a1('0x25')]=_[_0xc0a1('0x32')](_0x246a05[_0xc0a1('0x25')],{'$or':_[_0xc0a1('0x20')](_0x246a05['attributes'],function(_0x8dcadd){var _0x2b99e4={};_0x2b99e4[_0x8dcadd]={'$like':'%'+_0x4ef311[_0xc0a1('0x27')][_0xc0a1('0x47')]+'%'};return _0x2b99e4;})});}_0x246a05=_[_0xc0a1('0x32')]({},_0x246a05,_0x4ef311[_0xc0a1('0x33')]);return _0x11ff04[_0xc0a1('0x50')](_0x246a05);}})[_0xc0a1('0x16')](function(_0x1ec803){if(_0x1ec803){_0x33a06b=_0x1ec803[_0xc0a1('0x31')];if(!_0x4ef311[_0xc0a1('0x27')][_0xc0a1('0x42')](_0xc0a1('0x53'))){_0x246a05['limit']=qs[_0xc0a1('0x12')](_0x4ef311['query']['limit']);_0x246a05['offset']=qs[_0xc0a1('0xf')](_0x4ef311[_0xc0a1('0x27')]['offset']);}return _0x11ff04[_0xc0a1('0x50')](_0x246a05);}})[_0xc0a1('0x16')](function(_0x6ab7b3){if(_0x6ab7b3){return _0x6ab7b3?{'count':_0x33a06b,'rows':_0x6ab7b3}:null;}})[_0xc0a1('0x16')](respondWithResult(_0x4188a7,null))[_0xc0a1('0x29')](handleError(_0x4188a7,null));};exports[_0xc0a1('0x54')]=function(_0x5345df,_0x358504){var _0x37c6b0=_0x5345df[_0xc0a1('0x35')][_0xc0a1('0x55')];return db[_0xc0a1('0x51')][_0xc0a1('0x28')]({'where':{'id':_0x37c6b0},'attributes':['id'],'include':[{'model':db[_0xc0a1('0x48')],'as':'Agents','attributes':['id',_0xc0a1('0x1d'),'online',_0xc0a1('0x56'),_0xc0a1('0x57')],'raw':!![]}]})[_0xc0a1('0x16')](function(_0x3c4c59){if(_0x3c4c59){var _0x577e18=_[_0xc0a1('0x58')](_0x3c4c59,function(_0x5813c7){var _0x3ec7f5=_0x5813c7[_0xc0a1('0x18')]({'plain':!![]});return _0x3ec7f5['Agents'];});return db[_0xc0a1('0x21')]['find']({'where':{'id':_0x5345df[_0xc0a1('0x3e')]['id']}})[_0xc0a1('0x16')](function(_0x4423b4){return db[_0xc0a1('0x59')][_0xc0a1('0x5a')](function(_0xfd51eb){return _0x4423b4['addTeams'](_0x37c6b0,{'transaction':_0xfd51eb})[_0xc0a1('0x16')](function(){return BPromise['each'](_0x577e18,function(_0x33aa9f){return db[_0xc0a1('0x41')][_0xc0a1('0x5b')]({'where':{'UserId':_0x33aa9f['id'],'FaxQueueId':_0x5345df[_0xc0a1('0x3e')]['id']},'transaction':_0xfd51eb});});})[_0xc0a1('0x16')](function(){_0x577e18['forEach'](function(_0x300e5e){socket[_0xc0a1('0x5c')](_0xc0a1('0x5d'),{'UserId':_0x300e5e['id'],'FaxQueueId':_0x4423b4['id']});});});});});}})['then'](respondWithStatusCode(_0x358504,null))[_0xc0a1('0x29')](handleError(_0x358504,null));};exports[_0xc0a1('0x5e')]=function(_0xae97f2,_0x4c7f17){return db['Team'][_0xc0a1('0x28')]({'where':{'id':_0xae97f2[_0xc0a1('0x27')][_0xc0a1('0x55')]},'attributes':['id'],'include':[{'model':db[_0xc0a1('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc0a1('0x16')](handleEntityNotFound(_0x4c7f17,null))['then'](function(_0x3f54dd){var _0x9f9a7d=_[_0xc0a1('0x20')](_0x3f54dd,'id');var _0x63a2d=[];var _0x56950e=[];var _0x168756=squel['select']();_0x168756[_0xc0a1('0x5f')](_0xc0a1('0x60'))[_0xc0a1('0x61')]('team_has_fax_queues','tq')[_0xc0a1('0x62')](_0xc0a1('0x63'),'ut',_0xc0a1('0x64'))['where'](_0xc0a1('0x65'),_0xae97f2[_0xc0a1('0x3e')]['id']);for(var _0x411756=0x0;_0x411756<_0x3f54dd['length'];_0x411756+=0x1){let _0x26044a=_0x3f54dd[_0x411756];for(var _0x787e18=0x0;_0x787e18<_0x26044a[_0xc0a1('0x66')][_0xc0a1('0x31')];_0x787e18+=0x1){let _0x471996=_0x26044a['Agents'][_0x787e18];var _0x4a0e7f=_0x168756['clone']();_0x4a0e7f[_0xc0a1('0x25')]('ut.UserId\x20=\x20?',_0x471996['id']);_0x56950e['push'](db[_0xc0a1('0x59')][_0xc0a1('0x27')](_0x4a0e7f[_0xc0a1('0x67')](),{'type':db[_0xc0a1('0x59')]['QueryTypes'][_0xc0a1('0x68')]})[_0xc0a1('0x16')](function(_0xa8f906){if(_0xa8f906[_0xc0a1('0x31')]===0x1){return _0x471996['id'];}else{var _0x2b6f0e=_[_0xc0a1('0x69')](_[_0xc0a1('0x20')](_0xa8f906,_0xc0a1('0x6a')),function(_0x10b786){return _[_0xc0a1('0x6b')](_0x9f9a7d,_0x10b786);});if(_0x2b6f0e){return _0x471996['id'];}}}));}}return BPromise[_0xc0a1('0x6c')](_0x56950e)[_0xc0a1('0x16')](function(_0x3c232f){_0x63a2d=_(_0x63a2d)['union'](_0x3c232f)[_0xc0a1('0x6d')]()[_0xc0a1('0x6e')]();return db[_0xc0a1('0x21')][_0xc0a1('0x3d')]({'where':{'id':_0xae97f2['params']['id']}})[_0xc0a1('0x16')](function(_0x214639){return db['sequelize'][_0xc0a1('0x5a')](function(_0x2469d4){return _0x214639[_0xc0a1('0x5e')](_0xae97f2[_0xc0a1('0x27')][_0xc0a1('0x55')],{'transaction':_0x2469d4})[_0xc0a1('0x16')](function(){if(!_[_0xc0a1('0x6f')](_0x63a2d)){return _0x214639[_0xc0a1('0x70')](_0x63a2d,{'transaction':_0x2469d4});}})[_0xc0a1('0x16')](function(){_0x63a2d[_0xc0a1('0x71')](function(_0x58a2d1){socket[_0xc0a1('0x5c')]('userFaxQueue:remove',{'UserId':_0x58a2d1,'FaxQueueId':_0x214639['id']});});});});});});})['then'](respondWithStatusCode(_0x4c7f17,null))[_0xc0a1('0x29')](handleError(_0x4c7f17,null));};exports[_0xc0a1('0x72')]=function(_0x410527,_0xbccb){return db[_0xc0a1('0x21')]['find']({'where':{'id':_0x410527['params']['id']}})[_0xc0a1('0x16')](handleEntityNotFound(_0xbccb,null))[_0xc0a1('0x16')](function(_0x36803f){if(_0x36803f){return _0x36803f[_0xc0a1('0x72')](_0x410527[_0xc0a1('0x35')]['ids'],_['omit'](_0x410527[_0xc0a1('0x35')],[_0xc0a1('0x55'),'id'])||{})[_0xc0a1('0x73')](function(_0xc0d95){for(var _0x4798b7=0x0;_0x4798b7<_0x410527[_0xc0a1('0x35')]['ids'][_0xc0a1('0x31')];_0x4798b7+=0x1){socket[_0xc0a1('0x5c')](_0xc0a1('0x5d'),{'UserId':Number(_0x410527[_0xc0a1('0x35')][_0xc0a1('0x55')][_0x4798b7]),'FaxQueueId':Number(_0x410527[_0xc0a1('0x3e')]['id'])});}return _0xc0d95;});}})['then'](respondWithResult(_0xbccb,null))[_0xc0a1('0x29')](handleError(_0xbccb,null));};exports[_0xc0a1('0x70')]=function(_0x404733,_0x145a32){return db[_0xc0a1('0x21')][_0xc0a1('0x3d')]({'where':{'id':_0x404733['params']['id']}})[_0xc0a1('0x16')](handleEntityNotFound(_0x145a32,null))[_0xc0a1('0x16')](function(_0x2c909e){if(_0x2c909e){return _0x2c909e[_0xc0a1('0x70')](_0x404733['query'][_0xc0a1('0x55')])['then'](function(){if(_[_0xc0a1('0x74')](_0x404733[_0xc0a1('0x27')][_0xc0a1('0x55')])){for(var _0x3b6092=0x0;_0x3b6092<_0x404733[_0xc0a1('0x27')]['ids'][_0xc0a1('0x31')];_0x3b6092+=0x1){socket[_0xc0a1('0x5c')]('userFaxQueue:remove',{'UserId':Number(_0x404733[_0xc0a1('0x27')][_0xc0a1('0x55')][_0x3b6092]),'FaxQueueId':Number(_0x404733[_0xc0a1('0x3e')]['id'])});}}else{socket[_0xc0a1('0x5c')](_0xc0a1('0x75'),{'UserId':Number(_0x404733[_0xc0a1('0x27')][_0xc0a1('0x55')]),'FaxQueueId':Number(_0x404733[_0xc0a1('0x3e')]['id'])});}});}})['then'](respondWithStatusCode(_0x145a32,null))['catch'](handleError(_0x145a32,null));};exports[_0xc0a1('0x76')]=function(_0x3ce709,_0x3d288d){var _0x48ba0d={};var _0x17efde={};var _0x3d67c7;var _0x2a6ee7;return db[_0xc0a1('0x21')][_0xc0a1('0x40')]({'where':{'id':_0x3ce709[_0xc0a1('0x3e')]['id']}})[_0xc0a1('0x16')](handleEntityNotFound(_0x3d288d,null))['then'](function(_0x11d0fc){if(_0x11d0fc){_0x3d67c7=_0x11d0fc;_0x17efde[_0xc0a1('0x2b')]=_[_0xc0a1('0x2c')](db['User'][_0xc0a1('0x52')]);_0x17efde[_0xc0a1('0x27')]=_['keys'](_0x3ce709[_0xc0a1('0x27')]);_0x17efde[_0xc0a1('0x2d')]=_[_0xc0a1('0x2f')](_0x17efde[_0xc0a1('0x2b')],_0x17efde[_0xc0a1('0x27')]);_0x48ba0d[_0xc0a1('0x2e')]=_[_0xc0a1('0x2f')](_0x17efde[_0xc0a1('0x2b')],qs['fields'](_0x3ce709[_0xc0a1('0x27')][_0xc0a1('0x30')]));_0x48ba0d['attributes']=_0x48ba0d[_0xc0a1('0x2e')][_0xc0a1('0x31')]?_0x48ba0d[_0xc0a1('0x2e')]:_0x17efde[_0xc0a1('0x2b')];_0x48ba0d[_0xc0a1('0x43')]=qs[_0xc0a1('0x44')](_0x3ce709[_0xc0a1('0x27')][_0xc0a1('0x44')]);_0x48ba0d[_0xc0a1('0x25')]=qs[_0xc0a1('0x2d')](_[_0xc0a1('0x45')](_0x3ce709['query'],_0x17efde['filters']));if(_0x3ce709[_0xc0a1('0x27')]['filter']){_0x48ba0d['where']=_['merge'](_0x48ba0d[_0xc0a1('0x25')],{'$or':_[_0xc0a1('0x20')](_0x48ba0d['attributes'],function(_0x3af85a){var _0x50520c={};_0x50520c[_0x3af85a]={'$like':'%'+_0x3ce709[_0xc0a1('0x27')][_0xc0a1('0x47')]+'%'};return _0x50520c;})});}_0x48ba0d=_[_0xc0a1('0x32')]({},_0x48ba0d,_0x3ce709['options']);return _0x3d67c7['getAgents'](_0x48ba0d);}})[_0xc0a1('0x16')](function(_0x59b6fb){if(_0x59b6fb){_0x2a6ee7=_0x59b6fb[_0xc0a1('0x31')];if(!_0x3ce709[_0xc0a1('0x27')][_0xc0a1('0x42')]('nolimit')){_0x48ba0d[_0xc0a1('0x12')]=qs[_0xc0a1('0x12')](_0x3ce709['query'][_0xc0a1('0x12')]);_0x48ba0d[_0xc0a1('0xf')]=qs['offset'](_0x3ce709[_0xc0a1('0x27')][_0xc0a1('0xf')]);}return _0x3d67c7[_0xc0a1('0x76')](_0x48ba0d);}})[_0xc0a1('0x16')](function(_0x3f3236){if(_0x3f3236){return _0x3f3236?{'count':_0x2a6ee7,'rows':_0x3f3236}:null;}})[_0xc0a1('0x16')](respondWithResult(_0x3d288d,null))[_0xc0a1('0x29')](handleError(_0x3d288d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6f8ff6d..414e440 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 _0x7d23=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x369fe3,_0x90ec18){var _0x55c62e=function(_0x38ec18){while(--_0x38ec18){_0x369fe3['push'](_0x369fe3['shift']());}};_0x55c62e(++_0x90ec18);}(_0x7d23,0x121));var _0x37d2=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7d23[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require(_0x37d2('0x0'));var FaxQueue=require(_0x37d2('0x1'))['db'][_0x37d2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x37d2('0x3')](0x0);var events={'afterCreate':_0x37d2('0x4'),'afterUpdate':'update','afterDestroy':_0x37d2('0x5')};function emitEvent(_0x44d9b7){return function(_0x59466d,_0xa0ff08,_0x11e44a){FaxQueueEvents[_0x37d2('0x6')](_0x44d9b7+':'+_0x59466d['id'],_0x59466d);FaxQueueEvents[_0x37d2('0x6')](_0x44d9b7,_0x59466d);_0x11e44a(null);};}for(var e in events){if(events[_0x37d2('0x7')](e)){var event=events[e];FaxQueue[_0x37d2('0x8')](e,emitEvent(event));}}module[_0x37d2('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x8418=['hook','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4f9e0b,_0x5b5417){var _0x30a299=function(_0xb998c8){while(--_0xb998c8){_0x4f9e0b['push'](_0x4f9e0b['shift']());}};_0x30a299(++_0x5b5417);}(_0x8418,0x174));var _0x8841=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x8418[_0x3b5ad9];return _0x611ae9;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8841('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8841('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8841('0x2'),'afterDestroy':_0x8841('0x3')};function emitEvent(_0x1bba50){return function(_0x1f9fe4,_0x5bcbd1,_0x1da4e0){FaxQueueEvents[_0x8841('0x4')](_0x1bba50+':'+_0x1f9fe4['id'],_0x1f9fe4);FaxQueueEvents['emit'](_0x1bba50,_0x1f9fe4);_0x1da4e0(null);};}for(var e in events){if(events[_0x8841('0x5')](e)){var event=events[e];FaxQueue[_0x8841('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9b48973..4733924 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 _0x0d18=['api','moment','bluebird','path','../../config/environment','define','fax_queues','lodash','util','../../config/logger'];(function(_0x5227df,_0x727417){var _0x2d1477=function(_0x4c101b){while(--_0x4c101b){_0x5227df['push'](_0x5227df['shift']());}};_0x2d1477(++_0x727417);}(_0x0d18,0x133));var _0x80d1=function(_0x2f6984,_0x41d3ee){_0x2f6984=_0x2f6984-0x0;var _0x1df6ab=_0x0d18[_0x2f6984];return _0x1df6ab;};'use strict';var _=require(_0x80d1('0x0'));var util=require(_0x80d1('0x1'));var logger=require(_0x80d1('0x2'))(_0x80d1('0x3'));var moment=require(_0x80d1('0x4'));var BPromise=require(_0x80d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d1('0x6'));var rimraf=require('rimraf');var config=require(_0x80d1('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x1d52b2,_0x5c41d5){return _0x1d52b2[_0x80d1('0x8')]('FaxQueue',attributes,{'tableName':_0x80d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f21=['bluebird','request-promise','path','rimraf','./faxQueue.attributes','FaxQueue','lodash','api','moment'];(function(_0x47757b,_0x5e93b0){var _0x4217ce=function(_0x3d98dd){while(--_0x3d98dd){_0x47757b['push'](_0x47757b['shift']());}};_0x4217ce(++_0x5e93b0);}(_0x0f21,0x192));var _0x10f2=function(_0x196004,_0x31a6fc){_0x196004=_0x196004-0x0;var _0xec74b6=_0x0f21[_0x196004];return _0xec74b6;};'use strict';var _=require(_0x10f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10f2('0x1'));var moment=require(_0x10f2('0x2'));var BPromise=require(_0x10f2('0x3'));var rp=require(_0x10f2('0x4'));var fs=require('fs');var path=require(_0x10f2('0x5'));var rimraf=require(_0x10f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x10f2('0x7'));module['exports']=function(_0xf0ac66,_0xa1396c){return _0xf0ac66['define'](_0x10f2('0x8'),attributes,{'tableName':'fax_queues','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 63953c3..f12cbe7 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 _0x0af9=['request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','model','attributes','map','stringify','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1cfba9,_0x27575f){var _0x533a2f=function(_0x333509){while(--_0x333509){_0x1cfba9['push'](_0x1cfba9['shift']());}};_0x533a2f(++_0x27575f);}(_0x0af9,0x115));var _0x90af=function(_0x3330a6,_0x380de0){_0x3330a6=_0x3330a6-0x0;var _0x2f7b63=_0x0af9[_0x3330a6];return _0x2f7b63;};'use strict';var _=require(_0x90af('0x0'));var util=require(_0x90af('0x1'));var moment=require(_0x90af('0x2'));var BPromise=require('bluebird');var rs=require(_0x90af('0x3'));var fs=require('fs');var Redis=require(_0x90af('0x4'));var db=require(_0x90af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x90af('0x6'))(_0x90af('0x7'));var config=require(_0x90af('0x8'));var jayson=require(_0x90af('0x9'));var client=jayson[_0x90af('0xa')][_0x90af('0xb')]({'port':0x232a});config[_0x90af('0xc')]=_[_0x90af('0xd')](config['redis'],{'host':_0x90af('0xe'),'port':0x18eb});var socket=require(_0x90af('0xf'))(new Redis(config[_0x90af('0xc')]));require('./faxQueue.socket')[_0x90af('0x10')](socket);function respondWithRpcPromise(_0x552330,_0x138b9d,_0x483212){return new BPromise(function(_0x3ea300,_0x4a1239){return client[_0x90af('0x11')](_0x552330,_0x483212)[_0x90af('0x12')](function(_0x30a378){logger['info'](_0x90af('0x13'),_0x138b9d,_0x90af('0x14'));logger[_0x90af('0x15')](_0x90af('0x16'),_0x138b9d,'request\x20sent',JSON['stringify'](_0x30a378));if(_0x30a378[_0x90af('0x17')]){if(_0x30a378[_0x90af('0x17')][_0x90af('0x18')]===0x1f4){logger[_0x90af('0x17')]('FaxQueue,\x20%s,\x20%s',_0x138b9d,_0x30a378[_0x90af('0x17')][_0x90af('0x19')]);return _0x4a1239(_0x30a378['error'][_0x90af('0x19')]);}logger['error'](_0x90af('0x13'),_0x138b9d,_0x30a378['error']['message']);return _0x3ea300(_0x30a378['error'][_0x90af('0x19')]);}else{logger[_0x90af('0x1a')](_0x90af('0x13'),_0x138b9d,'request\x20sent');_0x3ea300(_0x30a378[_0x90af('0x1b')][_0x90af('0x19')]);}})[_0x90af('0x1c')](function(_0x2a80c8){logger['error'](_0x90af('0x13'),_0x138b9d,_0x2a80c8);_0x4a1239(_0x2a80c8);});});}exports[_0x90af('0x1d')]=function(_0x27b020){var _0x195e1b=this;return new Promise(function(_0x5714ea,_0x4074a3){return db[_0x90af('0x1e')][_0x90af('0x1f')]({'raw':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x21')]===undefined?!![]:![]:!![],'where':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x22')]||null:null,'attributes':_0x27b020[_0x90af('0x20')]?_0x27b020[_0x90af('0x20')]['attributes']||null:null,'limit':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x23')]||null:null,'include':_0x27b020['options']?_0x27b020[_0x90af('0x20')][_0x90af('0x24')]?_['map'](_0x27b020[_0x90af('0x20')][_0x90af('0x24')],function(_0x32149a){return{'model':db[_0x32149a['model']],'as':_0x32149a['as'],'attributes':_0x32149a['attributes'],'include':_0x32149a[_0x90af('0x24')]?_['map'](_0x32149a[_0x90af('0x24')],function(_0x3a8cb4){return{'model':db[_0x3a8cb4[_0x90af('0x25')]],'as':_0x3a8cb4['as'],'attributes':_0x3a8cb4[_0x90af('0x26')],'include':_0x3a8cb4[_0x90af('0x24')]?_[_0x90af('0x27')](_0x3a8cb4[_0x90af('0x24')],function(_0x3ba3d2){return{'model':db[_0x3ba3d2[_0x90af('0x25')]],'as':_0x3ba3d2['as'],'attributes':_0x3ba3d2[_0x90af('0x26')]};}):[]};}):[]};}):[]:[]})[_0x90af('0x12')](function(_0x1fe68b){logger[_0x90af('0x1a')](_0x90af('0x1d'),_0x27b020);logger[_0x90af('0x15')]('GetFaxQueue',_0x27b020,JSON[_0x90af('0x28')](_0x1fe68b));_0x5714ea(_0x1fe68b);})['catch'](function(_0x914a3d){logger[_0x90af('0x17')]('GetFaxQueue',_0x914a3d[_0x90af('0x19')],_0x27b020);_0x4074a3(_0x195e1b['error'](0x1f4,_0x914a3d[_0x90af('0x19')]));});});};exports['ShowFaxQueue']=function(_0x1b5b53){var _0x5be13b=this;return new Promise(function(_0x3b665d,_0xc47eae){return db[_0x90af('0x1e')]['find']({'raw':_0x1b5b53['options']?_0x1b5b53[_0x90af('0x20')][_0x90af('0x21')]===undefined?!![]:![]:!![],'where':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53['options']['where']||null:null,'attributes':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53[_0x90af('0x20')][_0x90af('0x26')]||null:null,'include':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53['options']['include']?_[_0x90af('0x27')](_0x1b5b53[_0x90af('0x20')][_0x90af('0x24')],function(_0x1ff63b){return{'model':db[_0x1ff63b[_0x90af('0x25')]],'as':_0x1ff63b['as'],'attributes':_0x1ff63b[_0x90af('0x26')],'include':_0x1ff63b[_0x90af('0x24')]?_['map'](_0x1ff63b[_0x90af('0x24')],function(_0x1a02b5){return{'model':db[_0x1a02b5['model']],'as':_0x1a02b5['as'],'attributes':_0x1a02b5[_0x90af('0x26')],'include':_0x1a02b5[_0x90af('0x24')]?_[_0x90af('0x27')](_0x1a02b5[_0x90af('0x24')],function(_0x425472){return{'model':db[_0x425472['model']],'as':_0x425472['as'],'attributes':_0x425472[_0x90af('0x26')]};}):[]};}):[]};}):[]:[]})[_0x90af('0x12')](function(_0x3d6584){logger[_0x90af('0x1a')](_0x90af('0x29'),_0x1b5b53);logger['debug']('ShowFaxQueue',_0x1b5b53,JSON['stringify'](_0x3d6584));_0x3b665d(_0x3d6584);})[_0x90af('0x1c')](function(_0x21ee73){logger[_0x90af('0x17')](_0x90af('0x29'),_0x21ee73[_0x90af('0x19')],_0x1b5b53);_0xc47eae(_0x5be13b[_0x90af('0x17')](0x1f4,_0x21ee73[_0x90af('0x19')]));});});}; \ No newline at end of file +var _0xc2ad=['error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','catch','ShowFaxQueue','find','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x384cae,_0x516b8c){var _0xb84434=function(_0x136048){while(--_0x136048){_0x384cae['push'](_0x384cae['shift']());}};_0xb84434(++_0x516b8c);}(_0xc2ad,0x16f));var _0xdc2a=function(_0x1c6091,_0x38a0b2){_0x1c6091=_0x1c6091-0x0;var _0xf0c085=_0xc2ad[_0x1c6091];return _0xf0c085;};'use strict';var _=require('lodash');var util=require(_0xdc2a('0x0'));var moment=require(_0xdc2a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc2a('0x2'));var db=require(_0xdc2a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc2a('0x4'))(_0xdc2a('0x5'));var config=require(_0xdc2a('0x6'));var jayson=require(_0xdc2a('0x7'));var client=jayson[_0xdc2a('0x8')][_0xdc2a('0x9')]({'port':0x232a});config[_0xdc2a('0xa')]=_[_0xdc2a('0xb')](config[_0xdc2a('0xa')],{'host':_0xdc2a('0xc'),'port':0x18eb});var socket=require(_0xdc2a('0xd'))(new Redis(config['redis']));require(_0xdc2a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1386a8,_0x5480d6,_0x50ce40){return new BPromise(function(_0xb34260,_0x36d45e){return client[_0xdc2a('0xf')](_0x1386a8,_0x50ce40)[_0xdc2a('0x10')](function(_0x14e4a4){logger[_0xdc2a('0x11')](_0xdc2a('0x12'),_0x5480d6,_0xdc2a('0x13'));logger[_0xdc2a('0x14')](_0xdc2a('0x15'),_0x5480d6,_0xdc2a('0x13'),JSON[_0xdc2a('0x16')](_0x14e4a4));if(_0x14e4a4[_0xdc2a('0x17')]){if(_0x14e4a4['error'][_0xdc2a('0x18')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5480d6,_0x14e4a4[_0xdc2a('0x17')]['message']);return _0x36d45e(_0x14e4a4['error'][_0xdc2a('0x19')]);}logger[_0xdc2a('0x17')](_0xdc2a('0x12'),_0x5480d6,_0x14e4a4[_0xdc2a('0x17')][_0xdc2a('0x19')]);return _0xb34260(_0x14e4a4['error']['message']);}else{logger[_0xdc2a('0x11')](_0xdc2a('0x12'),_0x5480d6,_0xdc2a('0x13'));_0xb34260(_0x14e4a4[_0xdc2a('0x1a')][_0xdc2a('0x19')]);}})['catch'](function(_0x213da8){logger[_0xdc2a('0x17')](_0xdc2a('0x12'),_0x5480d6,_0x213da8);_0x36d45e(_0x213da8);});});}exports[_0xdc2a('0x1b')]=function(_0x3968e9){var _0x277882=this;return new Promise(function(_0x29fdc7,_0x48a530){return db[_0xdc2a('0x1c')][_0xdc2a('0x1d')]({'raw':_0x3968e9[_0xdc2a('0x1e')]?_0x3968e9[_0xdc2a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3968e9['options']?_0x3968e9[_0xdc2a('0x1e')][_0xdc2a('0x1f')]||null:null,'attributes':_0x3968e9[_0xdc2a('0x1e')]?_0x3968e9[_0xdc2a('0x1e')][_0xdc2a('0x20')]||null:null,'limit':_0x3968e9[_0xdc2a('0x1e')]?_0x3968e9[_0xdc2a('0x1e')]['limit']||null:null,'include':_0x3968e9['options']?_0x3968e9[_0xdc2a('0x1e')][_0xdc2a('0x21')]?_[_0xdc2a('0x22')](_0x3968e9[_0xdc2a('0x1e')]['include'],function(_0x19ad61){return{'model':db[_0x19ad61[_0xdc2a('0x23')]],'as':_0x19ad61['as'],'attributes':_0x19ad61[_0xdc2a('0x20')],'include':_0x19ad61[_0xdc2a('0x21')]?_[_0xdc2a('0x22')](_0x19ad61[_0xdc2a('0x21')],function(_0x30d200){return{'model':db[_0x30d200[_0xdc2a('0x23')]],'as':_0x30d200['as'],'attributes':_0x30d200[_0xdc2a('0x20')],'include':_0x30d200['include']?_['map'](_0x30d200['include'],function(_0x386340){return{'model':db[_0x386340[_0xdc2a('0x23')]],'as':_0x386340['as'],'attributes':_0x386340[_0xdc2a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a0e1d){logger['info'](_0xdc2a('0x1b'),_0x3968e9);logger['debug'](_0xdc2a('0x1b'),_0x3968e9,JSON[_0xdc2a('0x16')](_0x3a0e1d));_0x29fdc7(_0x3a0e1d);})[_0xdc2a('0x24')](function(_0x7c7c73){logger[_0xdc2a('0x17')]('GetFaxQueue',_0x7c7c73[_0xdc2a('0x19')],_0x3968e9);_0x48a530(_0x277882['error'](0x1f4,_0x7c7c73[_0xdc2a('0x19')]));});});};exports[_0xdc2a('0x25')]=function(_0x4bcb71){var _0x550803=this;return new Promise(function(_0x47f141,_0x344c44){return db[_0xdc2a('0x1c')][_0xdc2a('0x26')]({'raw':_0x4bcb71['options']?_0x4bcb71[_0xdc2a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4bcb71['options']?_0x4bcb71['options'][_0xdc2a('0x1f')]||null:null,'attributes':_0x4bcb71[_0xdc2a('0x1e')]?_0x4bcb71['options']['attributes']||null:null,'include':_0x4bcb71[_0xdc2a('0x1e')]?_0x4bcb71[_0xdc2a('0x1e')][_0xdc2a('0x21')]?_['map'](_0x4bcb71['options'][_0xdc2a('0x21')],function(_0x5d5d99){return{'model':db[_0x5d5d99[_0xdc2a('0x23')]],'as':_0x5d5d99['as'],'attributes':_0x5d5d99[_0xdc2a('0x20')],'include':_0x5d5d99[_0xdc2a('0x21')]?_['map'](_0x5d5d99[_0xdc2a('0x21')],function(_0x3e8ae7){return{'model':db[_0x3e8ae7['model']],'as':_0x3e8ae7['as'],'attributes':_0x3e8ae7[_0xdc2a('0x20')],'include':_0x3e8ae7[_0xdc2a('0x21')]?_[_0xdc2a('0x22')](_0x3e8ae7['include'],function(_0x57e7d9){return{'model':db[_0x57e7d9[_0xdc2a('0x23')]],'as':_0x57e7d9['as'],'attributes':_0x57e7d9[_0xdc2a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdc2a('0x10')](function(_0x3622c3){logger['info'](_0xdc2a('0x25'),_0x4bcb71);logger['debug']('ShowFaxQueue',_0x4bcb71,JSON[_0xdc2a('0x16')](_0x3622c3));_0x47f141(_0x3622c3);})[_0xdc2a('0x24')](function(_0x4c5f96){logger[_0xdc2a('0x17')](_0xdc2a('0x25'),_0x4c5f96[_0xdc2a('0x19')],_0x4bcb71);_0x344c44(_0x550803['error'](0x1f4,_0x4c5f96['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 527bb74..76b0624 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 _0x4a1d=['save','remove','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x29362,_0x111e27){var _0x206a69=function(_0x5eeadf){while(--_0x5eeadf){_0x29362['push'](_0x29362['shift']());}};_0x206a69(++_0x111e27);}(_0x4a1d,0x113));var _0xd4a1=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4a1d[_0x278e3c];return _0x3e2d9b;};'use strict';var FaxQueueEvents=require(_0xd4a1('0x0'));var events=[_0xd4a1('0x1'),_0xd4a1('0x2'),'update'];function createListener(_0x48ce0e,_0x5aa7b2){return function(_0x4564f2){_0x5aa7b2['emit'](_0x48ce0e,_0x4564f2);};}function removeListener(_0x10e8d6,_0x30aae2){return function(){FaxQueueEvents[_0xd4a1('0x3')](_0x10e8d6,_0x30aae2);};}exports['register']=function(_0x3ccc2c){for(var _0xb5bac0=0x0,_0x5b177f=events[_0xd4a1('0x4')];_0xb5bac0<_0x5b177f;_0xb5bac0++){var _0x3a1b48=events[_0xb5bac0];var _0x4b646d=createListener(_0xd4a1('0x5')+_0x3a1b48,_0x3ccc2c);FaxQueueEvents['on'](_0x3a1b48,_0x4b646d);}}; \ No newline at end of file +var _0x09d8=['register','save','update','emit'];(function(_0x28cb3b,_0x474677){var _0x178260=function(_0x53beaf){while(--_0x53beaf){_0x28cb3b['push'](_0x28cb3b['shift']());}};_0x178260(++_0x474677);}(_0x09d8,0x1d5));var _0x809d=function(_0x2efc9d,_0x3c9317){_0x2efc9d=_0x2efc9d-0x0;var _0x5f9d97=_0x09d8[_0x2efc9d];return _0x5f9d97;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x809d('0x0'),'remove',_0x809d('0x1')];function createListener(_0x3dd888,_0x38e14a){return function(_0x126cd3){_0x38e14a[_0x809d('0x2')](_0x3dd888,_0x126cd3);};}function removeListener(_0x1d13b7,_0xa15d12){return function(){FaxQueueEvents['removeListener'](_0x1d13b7,_0xa15d12);};}exports[_0x809d('0x3')]=function(_0x26077d){for(var _0x557be7=0x0,_0x38ee04=events['length'];_0x557be7<_0x38ee04;_0x557be7++){var _0x549641=events[_0x557be7];var _0x58857f=createListener('faxQueue:'+_0x549641,_0x26077d);FaxQueueEvents['on'](_0x549641,_0x58857f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2352983..affc028 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 _0x4991=['addAgents','put','update','destroy','delete','/:id/teams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users'];(function(_0x55c50d,_0x21b593){var _0x2c62f0=function(_0x1d9623){while(--_0x1d9623){_0x55c50d['push'](_0x55c50d['shift']());}};_0x2c62f0(++_0x21b593);}(_0x4991,0xf7));var _0x1499=function(_0x2eb52f,_0x396d94){_0x2eb52f=_0x2eb52f-0x0;var _0x49bc71=_0x4991[_0x2eb52f];return _0x49bc71;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/teams',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x13')]('/',auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router[_0x1499('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1499('0x15')]);router['post'](_0x1499('0x16'),auth[_0x1499('0xc')](),controller[_0x1499('0x17')]);router[_0x1499('0x18')]('/:id',auth[_0x1499('0xc')](),controller[_0x1499('0x19')]);router['delete'](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x1a')]);router[_0x1499('0x1b')](_0x1499('0x1c'),auth[_0x1499('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x1499('0xc')](),controller[_0x1499('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x90b1=['addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x59fc7c,_0x1146f2){var _0x2653ff=function(_0x4e4d5f){while(--_0x4e4d5f){_0x59fc7c['push'](_0x59fc7c['shift']());}};_0x2653ff(++_0x1146f2);}(_0x90b1,0x1bb));var _0x190b=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x90b1[_0x5be7aa];return _0x215408;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0x8')](_0x190b('0xe'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x8')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller['getTeams']);router[_0x190b('0x8')](_0x190b('0x11'),auth['isAuthenticated'](),controller[_0x190b('0x12')]);router[_0x190b('0x13')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0x14')]);router[_0x190b('0x13')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x15')]);router[_0x190b('0x13')](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x16')]);router[_0x190b('0x17')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0x18')]);router[_0x190b('0x19')]('/:id',auth[_0x190b('0xa')](),controller['destroy']);router[_0x190b('0x19')](_0x190b('0x10'),auth[_0x190b('0xa')](),controller[_0x190b('0x1a')]);router['delete'](_0x190b('0x11'),auth[_0x190b('0xa')](),controller[_0x190b('0x1b')]);module[_0x190b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0e903a2..6546804 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 _0xef30=['moment','sequelize','exports','STRING','DATE'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xef30,0x118));var _0x0ef3=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xef30[_0x3e8270];return _0x1ccde9;};'use strict';var moment=require(_0x0ef3('0x0'));var Sequelize=require(_0x0ef3('0x1'));module[_0x0ef3('0x2')]={'uniqueid':{'type':Sequelize[_0x0ef3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0ef3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0ef3('0x4')]},'acceptAt':{'type':Sequelize[_0x0ef3('0x4')]},'exitAt':{'type':Sequelize[_0x0ef3('0x4')]},'reason':{'type':Sequelize[_0x0ef3('0x3')]}}; \ No newline at end of file +var _0x6596=['sequelize','STRING','DATE','moment'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x6596,0x1d3));var _0x6659=function(_0xc7198c,_0xfca606){_0xc7198c=_0xc7198c-0x0;var _0x2a89be=_0x6596[_0xc7198c];return _0x2a89be;};'use strict';var moment=require(_0x6659('0x0'));var Sequelize=require(_0x6659('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6659('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6659('0x2')]},'joinAt':{'type':Sequelize[_0x6659('0x3')]},'leaveAt':{'type':Sequelize[_0x6659('0x3')]},'acceptAt':{'type':Sequelize[_0x6659('0x3')]},'exitAt':{'type':Sequelize[_0x6659('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 16ea8b6..3280018 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 _0xe58a=['include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x37b32b,_0x3a8bfb){var _0x2c9ed0=function(_0x45ef28){while(--_0x45ef28){_0x37b32b['push'](_0x37b32b['shift']());}};_0x2c9ed0(++_0x3a8bfb);}(_0xe58a,0x9f));var _0xae58=function(_0x291cca,_0x55d36f){_0x291cca=_0x291cca-0x0;var _0x3c240c=_0xe58a[_0x291cca];return _0x3c240c;};'use strict';var emlformat=require(_0xae58('0x0'));var rimraf=require(_0xae58('0x1'));var zipdir=require(_0xae58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae58('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae58('0x4'));var util=require('util');var path=require('path');var sox=require(_0xae58('0x5'));var csv=require('to-csv');var ejs=require(_0xae58('0x6'));var fs=require('fs');var fs_extra=require(_0xae58('0x7'));var _=require(_0xae58('0x8'));var squel=require(_0xae58('0x9'));var crypto=require(_0xae58('0xa'));var jsforce=require(_0xae58('0xb'));var deskjs=require(_0xae58('0xc'));var toCsv=require(_0xae58('0xd'));var querystring=require(_0xae58('0xe'));var Papa=require(_0xae58('0xf'));var Redis=require('ioredis');var authService=require(_0xae58('0x10'));var qs=require(_0xae58('0x11'));var as=require(_0xae58('0x12'));var hardwareService=require(_0xae58('0x13'));var logger=require(_0xae58('0x14'))('api');var utils=require(_0xae58('0x15'));var config=require(_0xae58('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae58('0x17'))['db'];function respondWithStatusCode(_0x574c0d,_0x3a0ce7){_0x3a0ce7=_0x3a0ce7||0xcc;return function(_0x819a8b){if(_0x819a8b){return _0x574c0d[_0xae58('0x18')](_0x3a0ce7);}return _0x574c0d[_0xae58('0x19')](_0x3a0ce7)['end']();};}function respondWithResult(_0x36ee75,_0x52503a){_0x52503a=_0x52503a||0xc8;return function(_0x54f59c){if(_0x54f59c){return _0x36ee75[_0xae58('0x19')](_0x52503a)[_0xae58('0x1a')](_0x54f59c);}};}function respondWithFilteredResult(_0x144e48,_0x12642f){return function(_0x4c57b9){if(_0x4c57b9){var _0x13f61e=typeof _0x12642f[_0xae58('0x1b')]===_0xae58('0x1c')&&typeof _0x12642f[_0xae58('0x1d')]==='undefined';var _0x4dcadf=_0x4c57b9[_0xae58('0x1e')];var _0x3d9b06=_0x13f61e?0x0:_0x12642f[_0xae58('0x1b')];var _0x252488=_0x13f61e?_0x4c57b9[_0xae58('0x1e')]:_0x12642f['offset']+_0x12642f[_0xae58('0x1d')];var _0x3802cc;if(_0x252488>=_0x4dcadf){_0x252488=_0x4dcadf;_0x3802cc=0xc8;}else{_0x3802cc=0xce;}_0x144e48[_0xae58('0x19')](_0x3802cc);return _0x144e48[_0xae58('0x1f')](_0xae58('0x20'),_0x3d9b06+'-'+_0x252488+'/'+_0x4dcadf)[_0xae58('0x1a')](_0x4c57b9);}return null;};}function patchUpdates(_0x3b7fc4){return function(_0x367130){try{jsonpatch[_0xae58('0x21')](_0x367130,_0x3b7fc4,!![]);}catch(_0x544768){return BPromise['reject'](_0x544768);}return _0x367130[_0xae58('0x22')]();};}function saveUpdates(_0x598499,_0x3f199e){return function(_0x4da705){if(_0x4da705){return _0x4da705[_0xae58('0x23')](_0x598499)[_0xae58('0x24')](function(_0x128fd4){return _0x128fd4;});}return null;};}function removeEntity(_0x2ace7f,_0x41d2f2){return function(_0x569f07){if(_0x569f07){return _0x569f07[_0xae58('0x25')]()[_0xae58('0x24')](function(){_0x2ace7f[_0xae58('0x19')](0xcc)[_0xae58('0x26')]();});}};}function handleEntityNotFound(_0x557b6e,_0x2fdc7a){return function(_0x567c8b){if(!_0x567c8b){_0x557b6e['sendStatus'](0x194);}return _0x567c8b;};}function handleError(_0x2b1fff,_0x4e5bd5){_0x4e5bd5=_0x4e5bd5||0x1f4;return function(_0x2c3876){logger['error'](_0x2c3876[_0xae58('0x27')]);if(_0x2c3876[_0xae58('0x28')]){delete _0x2c3876[_0xae58('0x28')];}_0x2b1fff['status'](_0x4e5bd5)['send'](_0x2c3876);};}exports['index']=function(_0x5049de,_0x2afd0e){var _0x5b6505={},_0x551755={},_0xbefe7c={'count':0x0,'rows':[]};var _0x16dc96=_[_0xae58('0x29')](db[_0xae58('0x2a')][_0xae58('0x2b')],function(_0x5eaea4){return{'name':_0x5eaea4[_0xae58('0x2c')],'type':_0x5eaea4[_0xae58('0x2d')][_0xae58('0x2e')]};});_0x551755[_0xae58('0x2f')]=_[_0xae58('0x29')](_0x16dc96,_0xae58('0x28'));_0x551755[_0xae58('0x30')]=_[_0xae58('0x31')](_0x5049de[_0xae58('0x30')]);_0x551755[_0xae58('0x32')]=_[_0xae58('0x33')](_0x551755[_0xae58('0x2f')],_0x551755['query']);_0x5b6505[_0xae58('0x34')]=_[_0xae58('0x33')](_0x551755[_0xae58('0x2f')],qs[_0xae58('0x35')](_0x5049de[_0xae58('0x30')]['fields']));_0x5b6505[_0xae58('0x34')]=_0x5b6505[_0xae58('0x34')]['length']?_0x5b6505[_0xae58('0x34')]:_0x551755[_0xae58('0x2f')];if(!_0x5049de[_0xae58('0x30')][_0xae58('0x36')]('nolimit')){_0x5b6505[_0xae58('0x1d')]=qs['limit'](_0x5049de[_0xae58('0x30')][_0xae58('0x1d')]);_0x5b6505[_0xae58('0x1b')]=qs[_0xae58('0x1b')](_0x5049de['query'][_0xae58('0x1b')]);}_0x5b6505['order']=qs[_0xae58('0x37')](_0x5049de[_0xae58('0x30')]['sort']);_0x5b6505['where']=qs[_0xae58('0x32')](_[_0xae58('0x38')](_0x5049de['query'],_0x551755[_0xae58('0x32')]),_0x16dc96);if(_0x5049de[_0xae58('0x30')][_0xae58('0x39')]){_0x5b6505[_0xae58('0x3a')]=_[_0xae58('0x3b')](_0x5b6505['where'],{'$or':_[_0xae58('0x29')](_0x16dc96,function(_0x5e6ec3){if(_0x5e6ec3[_0xae58('0x2d')]!==_0xae58('0x3c')){var _0x140f2d={};_0x140f2d[_0x5e6ec3[_0xae58('0x28')]]={'$like':'%'+_0x5049de[_0xae58('0x30')][_0xae58('0x39')]+'%'};return _0x140f2d;}})});}_0x5b6505=_[_0xae58('0x3b')]({},_0x5b6505,_0x5049de[_0xae58('0x3d')]);var _0xdbe20d={'where':_0x5b6505[_0xae58('0x3a')]};return db[_0xae58('0x2a')][_0xae58('0x1e')](_0xdbe20d)[_0xae58('0x24')](function(_0x383aeb){_0xbefe7c[_0xae58('0x1e')]=_0x383aeb;if(_0x5049de[_0xae58('0x30')][_0xae58('0x3e')]){_0x5b6505[_0xae58('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xae58('0x40')](_0x5b6505);})['then'](function(_0x1d4276){_0xbefe7c[_0xae58('0x41')]=_0x1d4276;return _0xbefe7c;})['then'](respondWithFilteredResult(_0x2afd0e,_0x5b6505))[_0xae58('0x42')](handleError(_0x2afd0e,null));};exports[_0xae58('0x43')]=function(_0x461dfe,_0xcd7d92){var _0x4f1039={'raw':!![],'where':{'id':_0x461dfe['params']['id']}},_0x58b242={};_0x58b242['model']=_[_0xae58('0x31')](db[_0xae58('0x2a')]['rawAttributes']);_0x58b242[_0xae58('0x30')]=_['keys'](_0x461dfe[_0xae58('0x30')]);_0x58b242[_0xae58('0x32')]=_[_0xae58('0x33')](_0x58b242[_0xae58('0x2f')],_0x58b242['query']);_0x4f1039['attributes']=_[_0xae58('0x33')](_0x58b242['model'],qs[_0xae58('0x35')](_0x461dfe[_0xae58('0x30')]['fields']));_0x4f1039[_0xae58('0x34')]=_0x4f1039[_0xae58('0x34')][_0xae58('0x44')]?_0x4f1039[_0xae58('0x34')]:_0x58b242[_0xae58('0x2f')];if(_0x461dfe[_0xae58('0x30')][_0xae58('0x3e')]){_0x4f1039[_0xae58('0x3f')]=[{'all':!![]}];}_0x4f1039=_['merge']({},_0x4f1039,_0x461dfe[_0xae58('0x3d')]);return db[_0xae58('0x2a')][_0xae58('0x45')](_0x4f1039)[_0xae58('0x24')](handleEntityNotFound(_0xcd7d92,null))[_0xae58('0x24')](respondWithResult(_0xcd7d92,null))[_0xae58('0x42')](handleError(_0xcd7d92,null));};exports[_0xae58('0x46')]=function(_0x33d1c0,_0x3a44e1){return db[_0xae58('0x2a')][_0xae58('0x46')](_0x33d1c0[_0xae58('0x47')],{})[_0xae58('0x24')](respondWithResult(_0x3a44e1,0xc9))[_0xae58('0x42')](handleError(_0x3a44e1,null));};exports[_0xae58('0x23')]=function(_0x51d068,_0x384d93){if(_0x51d068['body']['id']){delete _0x51d068[_0xae58('0x47')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x51d068['params']['id']}})[_0xae58('0x24')](handleEntityNotFound(_0x384d93,null))[_0xae58('0x24')](saveUpdates(_0x51d068['body'],null))['then'](respondWithResult(_0x384d93,null))['catch'](handleError(_0x384d93,null));};exports[_0xae58('0x25')]=function(_0x306a05,_0xafe83c){return db[_0xae58('0x2a')]['find']({'where':{'id':_0x306a05[_0xae58('0x48')]['id']}})[_0xae58('0x24')](handleEntityNotFound(_0xafe83c,null))[_0xae58('0x24')](removeEntity(_0xafe83c,null))[_0xae58('0x42')](handleError(_0xafe83c,null));};exports[_0xae58('0x49')]=function(_0x22fec7,_0x6d677c){return db[_0xae58('0x2a')][_0xae58('0x49')]()[_0xae58('0x24')](respondWithResult(_0x6d677c,null))[_0xae58('0x42')](handleError(_0x6d677c,null));}; \ No newline at end of file +var _0x1752=['name','send','index','map','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxQueueReport','includeAll','findAll','catch','show','params','fields','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack'];(function(_0x4d861e,_0x1e1183){var _0x10c0c0=function(_0x2b86c7){while(--_0x2b86c7){_0x4d861e['push'](_0x4d861e['shift']());}};_0x10c0c0(++_0x1e1183);}(_0x1752,0xa5));var _0x2175=function(_0x9597d7,_0x47cedb){_0x9597d7=_0x9597d7-0x0;var _0x144ca2=_0x1752[_0x9597d7];return _0x144ca2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];function respondWithStatusCode(_0x5bc446,_0x43be3c){_0x43be3c=_0x43be3c||0xcc;return function(_0x393c02){if(_0x393c02){return _0x5bc446['sendStatus'](_0x43be3c);}return _0x5bc446[_0x2175('0x16')](_0x43be3c)[_0x2175('0x17')]();};}function respondWithResult(_0x45df73,_0x3bc01f){_0x3bc01f=_0x3bc01f||0xc8;return function(_0x21d4cd){if(_0x21d4cd){return _0x45df73[_0x2175('0x16')](_0x3bc01f)[_0x2175('0x18')](_0x21d4cd);}};}function respondWithFilteredResult(_0x413688,_0x5d84db){return function(_0x55b798){if(_0x55b798){var _0x371b42=typeof _0x5d84db[_0x2175('0x19')]===_0x2175('0x1a')&&typeof _0x5d84db['limit']==='undefined';var _0x588b0b=_0x55b798[_0x2175('0x1b')];var _0x377586=_0x371b42?0x0:_0x5d84db['offset'];var _0x53576c=_0x371b42?_0x55b798[_0x2175('0x1b')]:_0x5d84db[_0x2175('0x19')]+_0x5d84db[_0x2175('0x1c')];var _0x51628d;if(_0x53576c>=_0x588b0b){_0x53576c=_0x588b0b;_0x51628d=0xc8;}else{_0x51628d=0xce;}_0x413688[_0x2175('0x16')](_0x51628d);return _0x413688['set'](_0x2175('0x1d'),_0x377586+'-'+_0x53576c+'/'+_0x588b0b)['json'](_0x55b798);}return null;};}function patchUpdates(_0x37818a){return function(_0x4ec36c){try{jsonpatch['apply'](_0x4ec36c,_0x37818a,!![]);}catch(_0x5344af){return BPromise[_0x2175('0x1e')](_0x5344af);}return _0x4ec36c['save']();};}function saveUpdates(_0x28c4b8,_0x46ea57){return function(_0x2dd77b){if(_0x2dd77b){return _0x2dd77b[_0x2175('0x1f')](_0x28c4b8)[_0x2175('0x20')](function(_0x12d150){return _0x12d150;});}return null;};}function removeEntity(_0x5ac63e,_0x49d4b9){return function(_0x3d849e){if(_0x3d849e){return _0x3d849e[_0x2175('0x21')]()[_0x2175('0x20')](function(){_0x5ac63e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6374,_0xe252f0){return function(_0x2204cd){if(!_0x2204cd){_0x9c6374['sendStatus'](0x194);}return _0x2204cd;};}function handleError(_0x224fa3,_0x4d2120){_0x4d2120=_0x4d2120||0x1f4;return function(_0x5e696c){logger[_0x2175('0x22')](_0x5e696c[_0x2175('0x23')]);if(_0x5e696c[_0x2175('0x24')]){delete _0x5e696c[_0x2175('0x24')];}_0x224fa3[_0x2175('0x16')](_0x4d2120)[_0x2175('0x25')](_0x5e696c);};}exports[_0x2175('0x26')]=function(_0x40d8c8,_0x1b807b){var _0x1c721d={},_0x7b6edb={},_0x56dcf9={'count':0x0,'rows':[]};var _0x20fccf=_[_0x2175('0x27')](db['FaxQueueReport']['rawAttributes'],function(_0x3d64ac){return{'name':_0x3d64ac['fieldName'],'type':_0x3d64ac[_0x2175('0x28')]['key']};});_0x7b6edb['model']=_['map'](_0x20fccf,_0x2175('0x24'));_0x7b6edb[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x40d8c8[_0x2175('0x29')]);_0x7b6edb['filters']=_[_0x2175('0x2b')](_0x7b6edb[_0x2175('0x2c')],_0x7b6edb['query']);_0x1c721d[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x7b6edb['model'],qs['fields'](_0x40d8c8['query']['fields']));_0x1c721d[_0x2175('0x2d')]=_0x1c721d[_0x2175('0x2d')][_0x2175('0x2e')]?_0x1c721d[_0x2175('0x2d')]:_0x7b6edb[_0x2175('0x2c')];if(!_0x40d8c8[_0x2175('0x29')][_0x2175('0x2f')](_0x2175('0x30'))){_0x1c721d['limit']=qs['limit'](_0x40d8c8['query']['limit']);_0x1c721d['offset']=qs[_0x2175('0x19')](_0x40d8c8[_0x2175('0x29')]['offset']);}_0x1c721d[_0x2175('0x31')]=qs[_0x2175('0x32')](_0x40d8c8[_0x2175('0x29')][_0x2175('0x32')]);_0x1c721d[_0x2175('0x33')]=qs[_0x2175('0x34')](_['pick'](_0x40d8c8[_0x2175('0x29')],_0x7b6edb[_0x2175('0x34')]),_0x20fccf);if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]){_0x1c721d[_0x2175('0x33')]=_[_0x2175('0x36')](_0x1c721d[_0x2175('0x33')],{'$or':_[_0x2175('0x27')](_0x20fccf,function(_0x38c212){if(_0x38c212[_0x2175('0x28')]!==_0x2175('0x37')){var _0x4be65c={};_0x4be65c[_0x38c212[_0x2175('0x24')]]={'$like':'%'+_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]+'%'};return _0x4be65c;}})});}_0x1c721d=_['merge']({},_0x1c721d,_0x40d8c8['options']);var _0x932bb6={'where':_0x1c721d['where']};return db[_0x2175('0x38')][_0x2175('0x1b')](_0x932bb6)[_0x2175('0x20')](function(_0x4989df){_0x56dcf9['count']=_0x4989df;if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x39')]){_0x1c721d['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x2175('0x3a')](_0x1c721d);})[_0x2175('0x20')](function(_0x61784d){_0x56dcf9['rows']=_0x61784d;return _0x56dcf9;})[_0x2175('0x20')](respondWithFilteredResult(_0x1b807b,_0x1c721d))[_0x2175('0x3b')](handleError(_0x1b807b,null));};exports[_0x2175('0x3c')]=function(_0x5a6679,_0x49cf7d){var _0x459cee={'raw':!![],'where':{'id':_0x5a6679[_0x2175('0x3d')]['id']}},_0x47f60d={};_0x47f60d[_0x2175('0x2c')]=_['keys'](db['FaxQueueReport']['rawAttributes']);_0x47f60d[_0x2175('0x29')]=_['keys'](_0x5a6679['query']);_0x47f60d[_0x2175('0x34')]=_['intersection'](_0x47f60d[_0x2175('0x2c')],_0x47f60d[_0x2175('0x29')]);_0x459cee[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x47f60d[_0x2175('0x2c')],qs[_0x2175('0x3e')](_0x5a6679['query'][_0x2175('0x3e')]));_0x459cee[_0x2175('0x2d')]=_0x459cee[_0x2175('0x2d')][_0x2175('0x2e')]?_0x459cee[_0x2175('0x2d')]:_0x47f60d[_0x2175('0x2c')];if(_0x5a6679['query'][_0x2175('0x39')]){_0x459cee[_0x2175('0x3f')]=[{'all':!![]}];}_0x459cee=_[_0x2175('0x36')]({},_0x459cee,_0x5a6679['options']);return db[_0x2175('0x38')]['find'](_0x459cee)['then'](handleEntityNotFound(_0x49cf7d,null))[_0x2175('0x20')](respondWithResult(_0x49cf7d,null))[_0x2175('0x3b')](handleError(_0x49cf7d,null));};exports[_0x2175('0x40')]=function(_0x5ee4aa,_0x32d6eb){return db[_0x2175('0x38')][_0x2175('0x40')](_0x5ee4aa[_0x2175('0x41')],{})[_0x2175('0x20')](respondWithResult(_0x32d6eb,0xc9))['catch'](handleError(_0x32d6eb,null));};exports['update']=function(_0xdb0a97,_0xeaabe3){if(_0xdb0a97[_0x2175('0x41')]['id']){delete _0xdb0a97[_0x2175('0x41')]['id'];}return db[_0x2175('0x38')]['find']({'where':{'id':_0xdb0a97[_0x2175('0x3d')]['id']}})[_0x2175('0x20')](handleEntityNotFound(_0xeaabe3,null))[_0x2175('0x20')](saveUpdates(_0xdb0a97['body'],null))['then'](respondWithResult(_0xeaabe3,null))[_0x2175('0x3b')](handleError(_0xeaabe3,null));};exports['destroy']=function(_0x5af419,_0x5bab81){return db['FaxQueueReport'][_0x2175('0x42')]({'where':{'id':_0x5af419[_0x2175('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bab81,null))['then'](removeEntity(_0x5bab81,null))['catch'](handleError(_0x5bab81,null));};exports['describe']=function(_0x3ed1bf,_0x7c2c1f){return db['FaxQueueReport']['describe']()[_0x2175('0x20')](respondWithResult(_0x7c2c1f,null))[_0x2175('0x3b')](handleError(_0x7c2c1f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 33c0fc2..c623b3e 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x462344,_0x18dd96){var _0x316138=function(_0x4d8a26){while(--_0x4d8a26){_0x462344['push'](_0x462344['shift']());}};_0x316138(++_0x18dd96);}(_0xf494,0x1c6));var _0x4f49=function(_0x2b551e,_0x28680f){_0x2b551e=_0x2b551e-0x0;var _0x230318=_0xf494[_0x2b551e];return _0x230318;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0xfea467,_0xac0a06){var _0x29e3ed=function(_0x44eea3){while(--_0x44eea3){_0xfea467['push'](_0xfea467['shift']());}};_0x29e3ed(++_0xac0a06);}(_0x5fab,0x177));var _0xb5fa=function(_0x186872,_0x50a406){_0x186872=_0x186872-0x0;var _0x2f440d=_0x5fab[_0x186872];return _0x2f440d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['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 3970ae4..8886918 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 _0x5207=['limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','debug','UpdateFaxQueueReport','where'];(function(_0x5a39a8,_0x56de07){var _0x13bc3e=function(_0x7364b3){while(--_0x7364b3){_0x5a39a8['push'](_0x5a39a8['shift']());}};_0x13bc3e(++_0x56de07);}(_0x5207,0x89));var _0x7520=function(_0x28fa67,_0x186055){_0x28fa67=_0x28fa67-0x0;var _0x1a2d66=_0x5207[_0x28fa67];return _0x1a2d66;};'use strict';var _=require(_0x7520('0x0'));var util=require(_0x7520('0x1'));var moment=require(_0x7520('0x2'));var BPromise=require('bluebird');var rs=require(_0x7520('0x3'));var fs=require('fs');var Redis=require(_0x7520('0x4'));var db=require(_0x7520('0x5'))['db'];var utils=require(_0x7520('0x6'));var logger=require(_0x7520('0x7'))('rpc');var config=require(_0x7520('0x8'));var jayson=require(_0x7520('0x9'));var client=jayson[_0x7520('0xa')][_0x7520('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa963dd,_0x22c0e1,_0x4e457b){return new BPromise(function(_0x21b07a,_0x29a1cb){return client[_0x7520('0xc')](_0xa963dd,_0x4e457b)['then'](function(_0x5681ff){logger[_0x7520('0xd')](_0x7520('0xe'),_0x22c0e1,_0x7520('0xf'));logger['debug'](_0x7520('0x10'),_0x22c0e1,_0x7520('0xf'),JSON[_0x7520('0x11')](_0x5681ff));if(_0x5681ff['error']){if(_0x5681ff[_0x7520('0x12')][_0x7520('0x13')]===0x1f4){logger[_0x7520('0x12')](_0x7520('0xe'),_0x22c0e1,_0x5681ff['error'][_0x7520('0x14')]);return _0x29a1cb(_0x5681ff[_0x7520('0x12')][_0x7520('0x14')]);}logger[_0x7520('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x22c0e1,_0x5681ff[_0x7520('0x12')]['message']);return _0x21b07a(_0x5681ff['error'][_0x7520('0x14')]);}else{logger[_0x7520('0xd')](_0x7520('0xe'),_0x22c0e1,_0x7520('0xf'));_0x21b07a(_0x5681ff[_0x7520('0x15')]['message']);}})[_0x7520('0x16')](function(_0x4a0e94){logger[_0x7520('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x22c0e1,_0x4a0e94);_0x29a1cb(_0x4a0e94);});});}exports['CreateFaxQueueReport']=function(_0x94ce75){var _0x53543f=this;return new Promise(function(_0x256338,_0x3e0531){return db[_0x7520('0x17')][_0x7520('0x18')](_0x94ce75[_0x7520('0x19')],{'raw':_0x94ce75[_0x7520('0x1a')]?_0x94ce75['options'][_0x7520('0x1b')]===undefined?!![]:![]:!![]})[_0x7520('0x1c')](function(_0x306f71){logger['info'](_0x7520('0x1d'),_0x94ce75);logger[_0x7520('0x1e')]('CreateFaxQueueReport',_0x94ce75,JSON[_0x7520('0x11')](_0x306f71));_0x256338(_0x306f71);})['catch'](function(_0x1cb323){logger[_0x7520('0x12')](_0x7520('0x1d'),_0x1cb323['message'],_0x94ce75);_0x3e0531(_0x53543f[_0x7520('0x12')](0x1f4,_0x1cb323['message']));});});};exports[_0x7520('0x1f')]=function(_0xb2de04){var _0x3a259a=this;return new Promise(function(_0x17b18d,_0x282d65){return db[_0x7520('0x17')]['update'](_0xb2de04[_0x7520('0x19')],{'raw':_0xb2de04[_0x7520('0x1a')]?_0xb2de04[_0x7520('0x1a')][_0x7520('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb2de04[_0x7520('0x1a')]?_0xb2de04['options'][_0x7520('0x20')]||null:null,'attributes':_0xb2de04[_0x7520('0x1a')]?_0xb2de04[_0x7520('0x1a')]['attributes']||null:null,'limit':_0xb2de04['options']?_0xb2de04[_0x7520('0x1a')][_0x7520('0x21')]||null:null})['then'](function(_0x6133bc){logger['info'](_0x7520('0x1f'),_0xb2de04);logger[_0x7520('0x1e')](_0x7520('0x1f'),_0xb2de04,JSON[_0x7520('0x11')](_0x6133bc));_0x17b18d(_0x6133bc);})[_0x7520('0x16')](function(_0x4b13f9){logger[_0x7520('0x12')](_0x7520('0x1f'),_0x4b13f9[_0x7520('0x14')],_0xb2de04);_0x282d65(_0x3a259a[_0x7520('0x12')](0x1f4,_0x4b13f9[_0x7520('0x14')]));});});}; \ No newline at end of file +var _0x1253=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','body'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x1253,0x1a6));var _0x3125=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1253[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3125('0x0'));var util=require(_0x3125('0x1'));var moment=require(_0x3125('0x2'));var BPromise=require(_0x3125('0x3'));var rs=require(_0x3125('0x4'));var fs=require('fs');var Redis=require(_0x3125('0x5'));var db=require(_0x3125('0x6'))['db'];var utils=require(_0x3125('0x7'));var logger=require(_0x3125('0x8'))(_0x3125('0x9'));var config=require(_0x3125('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3125('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9e79,_0x299619,_0x108d1c){return new BPromise(function(_0x5c55da,_0x5354a7){return client['request'](_0x3b9e79,_0x108d1c)[_0x3125('0xc')](function(_0x352d61){logger[_0x3125('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x299619,_0x3125('0xe'));logger[_0x3125('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x299619,'request\x20sent',JSON[_0x3125('0x10')](_0x352d61));if(_0x352d61[_0x3125('0x11')]){if(_0x352d61[_0x3125('0x11')]['code']===0x1f4){logger['error'](_0x3125('0x12'),_0x299619,_0x352d61[_0x3125('0x11')]['message']);return _0x5354a7(_0x352d61[_0x3125('0x11')][_0x3125('0x13')]);}logger[_0x3125('0x11')](_0x3125('0x12'),_0x299619,_0x352d61[_0x3125('0x11')][_0x3125('0x13')]);return _0x5c55da(_0x352d61['error']['message']);}else{logger[_0x3125('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x299619,_0x3125('0xe'));_0x5c55da(_0x352d61[_0x3125('0x14')][_0x3125('0x13')]);}})[_0x3125('0x15')](function(_0x5af84b){logger[_0x3125('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x299619,_0x5af84b);_0x5354a7(_0x5af84b);});});}exports[_0x3125('0x16')]=function(_0xfd6cf4){var _0x5c8515=this;return new Promise(function(_0x5f2a75,_0xbdb6e7){return db[_0x3125('0x17')]['create'](_0xfd6cf4['body'],{'raw':_0xfd6cf4[_0x3125('0x18')]?_0xfd6cf4[_0x3125('0x18')][_0x3125('0x19')]===undefined?!![]:![]:!![]})[_0x3125('0xc')](function(_0x10616b){logger['info'](_0x3125('0x16'),_0xfd6cf4);logger[_0x3125('0xf')](_0x3125('0x16'),_0xfd6cf4,JSON[_0x3125('0x10')](_0x10616b));_0x5f2a75(_0x10616b);})['catch'](function(_0x1440e9){logger['error']('CreateFaxQueueReport',_0x1440e9[_0x3125('0x13')],_0xfd6cf4);_0xbdb6e7(_0x5c8515[_0x3125('0x11')](0x1f4,_0x1440e9[_0x3125('0x13')]));});});};exports[_0x3125('0x1a')]=function(_0x5511f5){var _0x4fd589=this;return new Promise(function(_0x3a865c,_0x55ba7e){return db[_0x3125('0x17')]['update'](_0x5511f5[_0x3125('0x1b')],{'raw':_0x5511f5[_0x3125('0x18')]?_0x5511f5[_0x3125('0x18')][_0x3125('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5511f5[_0x3125('0x18')]?_0x5511f5[_0x3125('0x18')]['where']||null:null,'attributes':_0x5511f5[_0x3125('0x18')]?_0x5511f5['options'][_0x3125('0x1c')]||null:null,'limit':_0x5511f5['options']?_0x5511f5[_0x3125('0x18')][_0x3125('0x1d')]||null:null})[_0x3125('0xc')](function(_0x5ef5f6){logger[_0x3125('0xd')]('UpdateFaxQueueReport',_0x5511f5);logger['debug'](_0x3125('0x1a'),_0x5511f5,JSON['stringify'](_0x5ef5f6));_0x3a865c(_0x5ef5f6);})[_0x3125('0x15')](function(_0x77ee18){logger[_0x3125('0x11')]('UpdateFaxQueueReport',_0x77ee18[_0x3125('0x13')],_0x5511f5);_0x55ba7e(_0x4fd589[_0x3125('0x11')](0x1f4,_0x77ee18['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 680d18f..e0bee9c 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 _0xdae7=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','/:id','post'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xdae7,0xec));var _0x7dae=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xdae7[_0x4178af];return _0x20f4b1;};'use strict';var multer=require(_0x7dae('0x0'));var util=require(_0x7dae('0x1'));var path=require(_0x7dae('0x2'));var timeout=require(_0x7dae('0x3'));var express=require(_0x7dae('0x4'));var router=express[_0x7dae('0x5')]();var fs_extra=require(_0x7dae('0x6'));var auth=require(_0x7dae('0x7'));var interaction=require(_0x7dae('0x8'));var config=require(_0x7dae('0x9'));var controller=require(_0x7dae('0xa'));router[_0x7dae('0xb')]('/',auth['isAuthenticated'](),controller[_0x7dae('0xc')]);router[_0x7dae('0xb')]('/describe',auth[_0x7dae('0xd')](),controller['describe']);router['get'](_0x7dae('0xe'),auth[_0x7dae('0xd')](),controller['show']);router[_0x7dae('0xf')]('/',auth[_0x7dae('0xd')](),controller[_0x7dae('0x10')]);router['put'](_0x7dae('0xe'),auth['isAuthenticated'](),controller[_0x7dae('0x11')]);router[_0x7dae('0x12')](_0x7dae('0xe'),auth[_0x7dae('0xd')](),controller[_0x7dae('0x13')]);module[_0x7dae('0x14')]=router; \ No newline at end of file +var _0x8692=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x240f20,_0x3347d5){var _0x4c4da4=function(_0x3fe32e){while(--_0x3fe32e){_0x240f20['push'](_0x240f20['shift']());}};_0x4c4da4(++_0x3347d5);}(_0x8692,0x199));var _0x2869=function(_0x522dd2,_0x1a6b38){_0x522dd2=_0x522dd2-0x0;var _0x3ba7d8=_0x8692[_0x522dd2];return _0x3ba7d8;};'use strict';var multer=require(_0x2869('0x0'));var util=require(_0x2869('0x1'));var path=require(_0x2869('0x2'));var timeout=require(_0x2869('0x3'));var express=require(_0x2869('0x4'));var router=express[_0x2869('0x5')]();var fs_extra=require(_0x2869('0x6'));var auth=require(_0x2869('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2869('0x8'));var controller=require('./faxQueueReport.controller');router[_0x2869('0x9')]('/',auth[_0x2869('0xa')](),controller[_0x2869('0xb')]);router[_0x2869('0x9')](_0x2869('0xc'),auth['isAuthenticated'](),controller[_0x2869('0xd')]);router[_0x2869('0x9')](_0x2869('0xe'),auth[_0x2869('0xa')](),controller[_0x2869('0xf')]);router['post']('/',auth[_0x2869('0xa')](),controller[_0x2869('0x10')]);router[_0x2869('0x11')](_0x2869('0xe'),auth['isAuthenticated'](),controller[_0x2869('0x12')]);router[_0x2869('0x13')](_0x2869('0xe'),auth['isAuthenticated'](),controller[_0x2869('0x14')]);module[_0x2869('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 960bec7..41d08fd 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x205ffb,_0x1db835){var _0x160df5=function(_0x1535b){while(--_0x1535b){_0x205ffb['push'](_0x205ffb['shift']());}};_0x160df5(++_0x1db835);}(_0xaa88,0x137));var _0x8aa8=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xaa88[_0x2fd160];return _0x5c2031;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x552da2,_0x154e1f){var _0x3d6bf0=function(_0xbeef92){while(--_0xbeef92){_0x552da2['push'](_0x552da2['shift']());}};_0x3d6bf0(++_0x154e1f);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d4298,_0x5217f9){_0x5d4298=_0x5d4298-0x0;var _0x16effc=_0xedd9[_0x5d4298];return _0x16effc;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fea733f..ef2d262 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 _0x35fd=['rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','fields','includeAll','options','find','create','body','destroy','describe','eml-format'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x35fd,0x17b));var _0xd35f=function(_0x38b81d,_0xa12762){_0x38b81d=_0x38b81d-0x0;var _0x399584=_0x35fd[_0x38b81d];return _0x399584;};'use strict';var emlformat=require(_0xd35f('0x0'));var rimraf=require(_0xd35f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd35f('0x2'));var rp=require(_0xd35f('0x3'));var moment=require('moment');var BPromise=require(_0xd35f('0x4'));var Mustache=require('mustache');var util=require(_0xd35f('0x5'));var path=require(_0xd35f('0x6'));var sox=require(_0xd35f('0x7'));var csv=require(_0xd35f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd35f('0x9'));var _=require(_0xd35f('0xa'));var squel=require(_0xd35f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd35f('0xc'));var deskjs=require(_0xd35f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd35f('0xe'));var Papa=require(_0xd35f('0xf'));var Redis=require('ioredis');var authService=require(_0xd35f('0x10'));var qs=require(_0xd35f('0x11'));var as=require(_0xd35f('0x12'));var hardwareService=require(_0xd35f('0x13'));var logger=require(_0xd35f('0x14'))(_0xd35f('0x15'));var utils=require('../../config/utils');var config=require(_0xd35f('0x16'));var licenseUtil=require(_0xd35f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd199,_0x49ae0a){_0x49ae0a=_0x49ae0a||0xcc;return function(_0x305fe7){if(_0x305fe7){return _0x3cd199['sendStatus'](_0x49ae0a);}return _0x3cd199[_0xd35f('0x18')](_0x49ae0a)[_0xd35f('0x19')]();};}function respondWithResult(_0x32deea,_0x452326){_0x452326=_0x452326||0xc8;return function(_0x433ec7){if(_0x433ec7){return _0x32deea[_0xd35f('0x18')](_0x452326)[_0xd35f('0x1a')](_0x433ec7);}};}function respondWithFilteredResult(_0xd80655,_0x57f918){return function(_0x403eae){if(_0x403eae){var _0x4330c7=typeof _0x57f918['offset']==='undefined'&&typeof _0x57f918['limit']===_0xd35f('0x1b');var _0x517036=_0x403eae[_0xd35f('0x1c')];var _0x3d4a64=_0x4330c7?0x0:_0x57f918[_0xd35f('0x1d')];var _0x1c3b96=_0x4330c7?_0x403eae[_0xd35f('0x1c')]:_0x57f918[_0xd35f('0x1d')]+_0x57f918[_0xd35f('0x1e')];var _0x431e52;if(_0x1c3b96>=_0x517036){_0x1c3b96=_0x517036;_0x431e52=0xc8;}else{_0x431e52=0xce;}_0xd80655['status'](_0x431e52);return _0xd80655[_0xd35f('0x1f')](_0xd35f('0x20'),_0x3d4a64+'-'+_0x1c3b96+'/'+_0x517036)[_0xd35f('0x1a')](_0x403eae);}return null;};}function patchUpdates(_0x4a0794){return function(_0x21ac7a){try{jsonpatch[_0xd35f('0x21')](_0x21ac7a,_0x4a0794,!![]);}catch(_0x3a44ca){return BPromise['reject'](_0x3a44ca);}return _0x21ac7a[_0xd35f('0x22')]();};}function saveUpdates(_0x37fa2e,_0x4d239b){return function(_0x21bf3b){if(_0x21bf3b){return _0x21bf3b[_0xd35f('0x23')](_0x37fa2e)[_0xd35f('0x24')](function(_0xdd505d){return _0xdd505d;});}return null;};}function removeEntity(_0x4809a3,_0x4dd0f6){return function(_0x524821){if(_0x524821){return _0x524821['destroy']()[_0xd35f('0x24')](function(){_0x4809a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a49cf,_0x19599b){return function(_0x4bce97){if(!_0x4bce97){_0x3a49cf[_0xd35f('0x25')](0x194);}return _0x4bce97;};}function handleError(_0x4f5ca2,_0x8a0e86){_0x8a0e86=_0x8a0e86||0x1f4;return function(_0x26dd01){logger[_0xd35f('0x26')](_0x26dd01[_0xd35f('0x27')]);if(_0x26dd01[_0xd35f('0x28')]){delete _0x26dd01[_0xd35f('0x28')];}_0x4f5ca2[_0xd35f('0x18')](_0x8a0e86)[_0xd35f('0x29')](_0x26dd01);};}exports[_0xd35f('0x2a')]=function(_0x57f1ee,_0x1ad478){var _0x1d2e2c={},_0x5de1de={},_0xe872f={'count':0x0,'rows':[]};var _0x3142a0=_[_0xd35f('0x2b')](db[_0xd35f('0x2c')][_0xd35f('0x2d')],function(_0x3fee63){return{'name':_0x3fee63[_0xd35f('0x2e')],'type':_0x3fee63[_0xd35f('0x2f')]['key']};});_0x5de1de[_0xd35f('0x30')]=_['map'](_0x3142a0,_0xd35f('0x28'));_0x5de1de[_0xd35f('0x31')]=_['keys'](_0x57f1ee[_0xd35f('0x31')]);_0x5de1de[_0xd35f('0x32')]=_[_0xd35f('0x33')](_0x5de1de[_0xd35f('0x30')],_0x5de1de['query']);_0x1d2e2c[_0xd35f('0x34')]=_[_0xd35f('0x33')](_0x5de1de['model'],qs['fields'](_0x57f1ee[_0xd35f('0x31')]['fields']));_0x1d2e2c[_0xd35f('0x34')]=_0x1d2e2c[_0xd35f('0x34')][_0xd35f('0x35')]?_0x1d2e2c['attributes']:_0x5de1de['model'];if(!_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x36')](_0xd35f('0x37'))){_0x1d2e2c['limit']=qs[_0xd35f('0x1e')](_0x57f1ee[_0xd35f('0x31')]['limit']);_0x1d2e2c['offset']=qs[_0xd35f('0x1d')](_0x57f1ee[_0xd35f('0x31')]['offset']);}_0x1d2e2c['order']=qs[_0xd35f('0x38')](_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x38')]);_0x1d2e2c[_0xd35f('0x39')]=qs[_0xd35f('0x32')](_['pick'](_0x57f1ee[_0xd35f('0x31')],_0x5de1de[_0xd35f('0x32')]),_0x3142a0);if(_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x3a')]){_0x1d2e2c['where']=_[_0xd35f('0x3b')](_0x1d2e2c['where'],{'$or':_[_0xd35f('0x2b')](_0x3142a0,function(_0x344b25){if(_0x344b25[_0xd35f('0x2f')]!==_0xd35f('0x3c')){var _0x4f97c6={};_0x4f97c6[_0x344b25[_0xd35f('0x28')]]={'$like':'%'+_0x57f1ee[_0xd35f('0x31')]['filter']+'%'};return _0x4f97c6;}})});}_0x1d2e2c=_['merge']({},_0x1d2e2c,_0x57f1ee['options']);var _0xad1495={'where':_0x1d2e2c[_0xd35f('0x39')]};return db[_0xd35f('0x2c')][_0xd35f('0x1c')](_0xad1495)[_0xd35f('0x24')](function(_0x21a085){_0xe872f[_0xd35f('0x1c')]=_0x21a085;if(_0x57f1ee[_0xd35f('0x31')]['includeAll']){_0x1d2e2c[_0xd35f('0x3d')]=[{'all':!![]}];}return db[_0xd35f('0x2c')][_0xd35f('0x3e')](_0x1d2e2c);})[_0xd35f('0x24')](function(_0x709e92){_0xe872f[_0xd35f('0x3f')]=_0x709e92;return _0xe872f;})[_0xd35f('0x24')](respondWithFilteredResult(_0x1ad478,_0x1d2e2c))[_0xd35f('0x40')](handleError(_0x1ad478,null));};exports[_0xd35f('0x41')]=function(_0x3fe6d5,_0x19372c){var _0x175132={'raw':!![],'where':{'id':_0x3fe6d5[_0xd35f('0x42')]['id']}},_0x1b8620={};_0x1b8620['model']=_[_0xd35f('0x43')](db[_0xd35f('0x2c')][_0xd35f('0x2d')]);_0x1b8620['query']=_[_0xd35f('0x43')](_0x3fe6d5['query']);_0x1b8620[_0xd35f('0x32')]=_[_0xd35f('0x33')](_0x1b8620[_0xd35f('0x30')],_0x1b8620[_0xd35f('0x31')]);_0x175132[_0xd35f('0x34')]=_[_0xd35f('0x33')](_0x1b8620[_0xd35f('0x30')],qs[_0xd35f('0x44')](_0x3fe6d5['query'][_0xd35f('0x44')]));_0x175132[_0xd35f('0x34')]=_0x175132[_0xd35f('0x34')]['length']?_0x175132['attributes']:_0x1b8620[_0xd35f('0x30')];if(_0x3fe6d5['query'][_0xd35f('0x45')]){_0x175132['include']=[{'all':!![]}];}_0x175132=_[_0xd35f('0x3b')]({},_0x175132,_0x3fe6d5[_0xd35f('0x46')]);return db[_0xd35f('0x2c')][_0xd35f('0x47')](_0x175132)[_0xd35f('0x24')](handleEntityNotFound(_0x19372c,null))['then'](respondWithResult(_0x19372c,null))[_0xd35f('0x40')](handleError(_0x19372c,null));};exports[_0xd35f('0x48')]=function(_0x389549,_0x233daa){return db[_0xd35f('0x2c')][_0xd35f('0x48')](_0x389549[_0xd35f('0x49')],{})[_0xd35f('0x24')](respondWithResult(_0x233daa,0xc9))[_0xd35f('0x40')](handleError(_0x233daa,null));};exports[_0xd35f('0x23')]=function(_0x41a8df,_0x2fd890){if(_0x41a8df[_0xd35f('0x49')]['id']){delete _0x41a8df[_0xd35f('0x49')]['id'];}return db[_0xd35f('0x2c')][_0xd35f('0x47')]({'where':{'id':_0x41a8df['params']['id']}})[_0xd35f('0x24')](handleEntityNotFound(_0x2fd890,null))[_0xd35f('0x24')](saveUpdates(_0x41a8df[_0xd35f('0x49')],null))[_0xd35f('0x24')](respondWithResult(_0x2fd890,null))[_0xd35f('0x40')](handleError(_0x2fd890,null));};exports[_0xd35f('0x4a')]=function(_0x3f8dcb,_0x344f67){return db['FaxTransferReport'][_0xd35f('0x47')]({'where':{'id':_0x3f8dcb[_0xd35f('0x42')]['id']}})[_0xd35f('0x24')](handleEntityNotFound(_0x344f67,null))[_0xd35f('0x24')](removeEntity(_0x344f67,null))[_0xd35f('0x40')](handleError(_0x344f67,null));};exports[_0xd35f('0x4b')]=function(_0x6b29f2,_0x49926c){return db[_0xd35f('0x2c')][_0xd35f('0x4b')]()[_0xd35f('0x24')](respondWithResult(_0x49926c,null))[_0xd35f('0x40')](handleError(_0x49926c,null));}; \ No newline at end of file +var _0xf390=['save','update','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','json','apply'];(function(_0x2eb002,_0x1ff1be){var _0x50d03a=function(_0x25059e){while(--_0x25059e){_0x2eb002['push'](_0x2eb002['shift']());}};_0x50d03a(++_0x1ff1be);}(_0xf390,0xbb));var _0x0f39=function(_0x75b6b8,_0x2eeb9c){_0x75b6b8=_0x75b6b8-0x0;var _0x18109b=_0xf390[_0x75b6b8];return _0x18109b;};'use strict';var emlformat=require(_0x0f39('0x0'));var rimraf=require(_0x0f39('0x1'));var zipdir=require(_0x0f39('0x2'));var jsonpatch=require(_0x0f39('0x3'));var rp=require(_0x0f39('0x4'));var moment=require('moment');var BPromise=require(_0x0f39('0x5'));var Mustache=require(_0x0f39('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0f39('0x7'));var csv=require(_0x0f39('0x8'));var ejs=require(_0x0f39('0x9'));var fs=require('fs');var fs_extra=require(_0x0f39('0xa'));var _=require(_0x0f39('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0f39('0xc'));var deskjs=require(_0x0f39('0xd'));var toCsv=require(_0x0f39('0x8'));var querystring=require(_0x0f39('0xe'));var Papa=require(_0x0f39('0xf'));var Redis=require('ioredis');var authService=require(_0x0f39('0x10'));var qs=require(_0x0f39('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f39('0x12'));var logger=require(_0x0f39('0x13'))(_0x0f39('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f39('0x15'));var db=require(_0x0f39('0x16'))['db'];function respondWithStatusCode(_0x34b3e0,_0x2822e8){_0x2822e8=_0x2822e8||0xcc;return function(_0x21fe48){if(_0x21fe48){return _0x34b3e0[_0x0f39('0x17')](_0x2822e8);}return _0x34b3e0[_0x0f39('0x18')](_0x2822e8)[_0x0f39('0x19')]();};}function respondWithResult(_0x4da089,_0x3e6424){_0x3e6424=_0x3e6424||0xc8;return function(_0x567858){if(_0x567858){return _0x4da089['status'](_0x3e6424)['json'](_0x567858);}};}function respondWithFilteredResult(_0x582974,_0x119cf0){return function(_0x439467){if(_0x439467){var _0xbf1cc1=typeof _0x119cf0['offset']==='undefined'&&typeof _0x119cf0['limit']===_0x0f39('0x1a');var _0x58a60a=_0x439467[_0x0f39('0x1b')];var _0x585902=_0xbf1cc1?0x0:_0x119cf0[_0x0f39('0x1c')];var _0x544613=_0xbf1cc1?_0x439467['count']:_0x119cf0[_0x0f39('0x1c')]+_0x119cf0['limit'];var _0x4e7404;if(_0x544613>=_0x58a60a){_0x544613=_0x58a60a;_0x4e7404=0xc8;}else{_0x4e7404=0xce;}_0x582974['status'](_0x4e7404);return _0x582974[_0x0f39('0x1d')]('Content-Range',_0x585902+'-'+_0x544613+'/'+_0x58a60a)[_0x0f39('0x1e')](_0x439467);}return null;};}function patchUpdates(_0x4fb0a7){return function(_0x4ff14f){try{jsonpatch[_0x0f39('0x1f')](_0x4ff14f,_0x4fb0a7,!![]);}catch(_0x31faaf){return BPromise['reject'](_0x31faaf);}return _0x4ff14f[_0x0f39('0x20')]();};}function saveUpdates(_0x29fe02,_0x360c1a){return function(_0xf33288){if(_0xf33288){return _0xf33288[_0x0f39('0x21')](_0x29fe02)['then'](function(_0x1599d0){return _0x1599d0;});}return null;};}function removeEntity(_0x22c994,_0x280418){return function(_0x5bef9b){if(_0x5bef9b){return _0x5bef9b['destroy']()['then'](function(){_0x22c994['status'](0xcc)[_0x0f39('0x19')]();});}};}function handleEntityNotFound(_0x4a13d0,_0x13465d){return function(_0x44ab7d){if(!_0x44ab7d){_0x4a13d0[_0x0f39('0x17')](0x194);}return _0x44ab7d;};}function handleError(_0xca58b1,_0x356629){_0x356629=_0x356629||0x1f4;return function(_0x3ab09b){logger[_0x0f39('0x22')](_0x3ab09b[_0x0f39('0x23')]);if(_0x3ab09b['name']){delete _0x3ab09b[_0x0f39('0x24')];}_0xca58b1['status'](_0x356629)[_0x0f39('0x25')](_0x3ab09b);};}exports[_0x0f39('0x26')]=function(_0x218f27,_0x4c191b){var _0x3280e7={},_0x4780cf={},_0x2cd24a={'count':0x0,'rows':[]};var _0x239041=_['map'](db[_0x0f39('0x27')][_0x0f39('0x28')],function(_0x27e938){return{'name':_0x27e938[_0x0f39('0x29')],'type':_0x27e938[_0x0f39('0x2a')][_0x0f39('0x2b')]};});_0x4780cf[_0x0f39('0x2c')]=_[_0x0f39('0x2d')](_0x239041,_0x0f39('0x24'));_0x4780cf['query']=_[_0x0f39('0x2e')](_0x218f27[_0x0f39('0x2f')]);_0x4780cf[_0x0f39('0x30')]=_['intersection'](_0x4780cf[_0x0f39('0x2c')],_0x4780cf[_0x0f39('0x2f')]);_0x3280e7['attributes']=_[_0x0f39('0x31')](_0x4780cf[_0x0f39('0x2c')],qs[_0x0f39('0x32')](_0x218f27['query'][_0x0f39('0x32')]));_0x3280e7['attributes']=_0x3280e7[_0x0f39('0x33')][_0x0f39('0x34')]?_0x3280e7[_0x0f39('0x33')]:_0x4780cf[_0x0f39('0x2c')];if(!_0x218f27['query'][_0x0f39('0x35')](_0x0f39('0x36'))){_0x3280e7[_0x0f39('0x37')]=qs[_0x0f39('0x37')](_0x218f27[_0x0f39('0x2f')][_0x0f39('0x37')]);_0x3280e7[_0x0f39('0x1c')]=qs['offset'](_0x218f27[_0x0f39('0x2f')][_0x0f39('0x1c')]);}_0x3280e7[_0x0f39('0x38')]=qs[_0x0f39('0x39')](_0x218f27[_0x0f39('0x2f')][_0x0f39('0x39')]);_0x3280e7['where']=qs[_0x0f39('0x30')](_['pick'](_0x218f27[_0x0f39('0x2f')],_0x4780cf['filters']),_0x239041);if(_0x218f27[_0x0f39('0x2f')][_0x0f39('0x3a')]){_0x3280e7[_0x0f39('0x3b')]=_[_0x0f39('0x3c')](_0x3280e7[_0x0f39('0x3b')],{'$or':_[_0x0f39('0x2d')](_0x239041,function(_0x2a9a45){if(_0x2a9a45[_0x0f39('0x2a')]!=='VIRTUAL'){var _0x2446a8={};_0x2446a8[_0x2a9a45['name']]={'$like':'%'+_0x218f27[_0x0f39('0x2f')][_0x0f39('0x3a')]+'%'};return _0x2446a8;}})});}_0x3280e7=_['merge']({},_0x3280e7,_0x218f27[_0x0f39('0x3d')]);var _0x4a671c={'where':_0x3280e7[_0x0f39('0x3b')]};return db['FaxTransferReport'][_0x0f39('0x1b')](_0x4a671c)[_0x0f39('0x3e')](function(_0x516571){_0x2cd24a[_0x0f39('0x1b')]=_0x516571;if(_0x218f27[_0x0f39('0x2f')][_0x0f39('0x3f')]){_0x3280e7['include']=[{'all':!![]}];}return db[_0x0f39('0x27')][_0x0f39('0x40')](_0x3280e7);})[_0x0f39('0x3e')](function(_0x4fe424){_0x2cd24a[_0x0f39('0x41')]=_0x4fe424;return _0x2cd24a;})[_0x0f39('0x3e')](respondWithFilteredResult(_0x4c191b,_0x3280e7))[_0x0f39('0x42')](handleError(_0x4c191b,null));};exports[_0x0f39('0x43')]=function(_0x5dae81,_0x105455){var _0x39cfcb={'raw':!![],'where':{'id':_0x5dae81[_0x0f39('0x44')]['id']}},_0x578f8b={};_0x578f8b['model']=_[_0x0f39('0x2e')](db[_0x0f39('0x27')]['rawAttributes']);_0x578f8b['query']=_[_0x0f39('0x2e')](_0x5dae81[_0x0f39('0x2f')]);_0x578f8b[_0x0f39('0x30')]=_[_0x0f39('0x31')](_0x578f8b[_0x0f39('0x2c')],_0x578f8b[_0x0f39('0x2f')]);_0x39cfcb['attributes']=_['intersection'](_0x578f8b[_0x0f39('0x2c')],qs[_0x0f39('0x32')](_0x5dae81[_0x0f39('0x2f')]['fields']));_0x39cfcb[_0x0f39('0x33')]=_0x39cfcb[_0x0f39('0x33')][_0x0f39('0x34')]?_0x39cfcb[_0x0f39('0x33')]:_0x578f8b[_0x0f39('0x2c')];if(_0x5dae81[_0x0f39('0x2f')][_0x0f39('0x3f')]){_0x39cfcb['include']=[{'all':!![]}];}_0x39cfcb=_[_0x0f39('0x3c')]({},_0x39cfcb,_0x5dae81[_0x0f39('0x3d')]);return db[_0x0f39('0x27')][_0x0f39('0x45')](_0x39cfcb)[_0x0f39('0x3e')](handleEntityNotFound(_0x105455,null))['then'](respondWithResult(_0x105455,null))[_0x0f39('0x42')](handleError(_0x105455,null));};exports[_0x0f39('0x46')]=function(_0x5635dc,_0x5b5716){return db['FaxTransferReport'][_0x0f39('0x46')](_0x5635dc[_0x0f39('0x47')],{})['then'](respondWithResult(_0x5b5716,0xc9))['catch'](handleError(_0x5b5716,null));};exports[_0x0f39('0x21')]=function(_0xdb86b4,_0x2baefd){if(_0xdb86b4['body']['id']){delete _0xdb86b4[_0x0f39('0x47')]['id'];}return db['FaxTransferReport'][_0x0f39('0x45')]({'where':{'id':_0xdb86b4[_0x0f39('0x44')]['id']}})[_0x0f39('0x3e')](handleEntityNotFound(_0x2baefd,null))[_0x0f39('0x3e')](saveUpdates(_0xdb86b4[_0x0f39('0x47')],null))[_0x0f39('0x3e')](respondWithResult(_0x2baefd,null))[_0x0f39('0x42')](handleError(_0x2baefd,null));};exports['destroy']=function(_0x3531bb,_0x2fca44){return db['FaxTransferReport'][_0x0f39('0x45')]({'where':{'id':_0x3531bb[_0x0f39('0x44')]['id']}})[_0x0f39('0x3e')](handleEntityNotFound(_0x2fca44,null))['then'](removeEntity(_0x2fca44,null))[_0x0f39('0x42')](handleError(_0x2fca44,null));};exports[_0x0f39('0x48')]=function(_0x4bb5b0,_0x23e01e){return db[_0x0f39('0x27')][_0x0f39('0x48')]()[_0x0f39('0x3e')](respondWithResult(_0x23e01e,null))[_0x0f39('0x42')](handleError(_0x23e01e,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 82ab174..8cbffdb 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 _0x749c=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x749c,0x17a));var _0xc749=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x749c[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require('moment');var BPromise=require(_0xc749('0x4'));var rp=require(_0xc749('0x5'));var fs=require('fs');var path=require(_0xc749('0x6'));var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));module['exports']=function(_0x2b3dbc,_0x4adb3e){return _0x2b3dbc[_0xc749('0xa')](_0xc749('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc749('0xc'),'fields':[_0xc749('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd206=['path','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','moment','bluebird'];(function(_0x9b6888,_0x3843ef){var _0x50494b=function(_0x50f42b){while(--_0x50f42b){_0x9b6888['push'](_0x9b6888['shift']());}};_0x50494b(++_0x3843ef);}(_0xd206,0x89));var _0x6d20=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xd206[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x6d20('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6d20('0x1'));var BPromise=require(_0x6d20('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d20('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d20('0x4'));module[_0x6d20('0x5')]=function(_0x54a356,_0x1d24a5){return _0x54a356[_0x6d20('0x6')](_0x6d20('0x7'),attributes,{'tableName':_0x6d20('0x8'),'paranoid':![],'indexes':[{'name':_0x6d20('0x9'),'fields':[_0x6d20('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 73c0fe9..b33206b 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 _0xbcb9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x1ae5d8,_0x25e539){var _0x163c9f=function(_0x9736a7){while(--_0x9736a7){_0x1ae5d8['push'](_0x1ae5d8['shift']());}};_0x163c9f(++_0x25e539);}(_0xbcb9,0x174));var _0x9bcb=function(_0x32a56d,_0x1e6981){_0x32a56d=_0x32a56d-0x0;var _0x3bd14e=_0xbcb9[_0x32a56d];return _0x3bd14e;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bcb('0x4'))['db'];var utils=require(_0x9bcb('0x5'));var logger=require(_0x9bcb('0x6'))(_0x9bcb('0x7'));var config=require(_0x9bcb('0x8'));var jayson=require(_0x9bcb('0x9'));var client=jayson[_0x9bcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c9e0,_0x40c0cc,_0x26bc12){return new BPromise(function(_0x522516,_0x44fcdd){return client[_0x9bcb('0xb')](_0x25c9e0,_0x26bc12)['then'](function(_0x1e87c9){logger[_0x9bcb('0xc')](_0x9bcb('0xd'),_0x40c0cc,_0x9bcb('0xe'));logger[_0x9bcb('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x40c0cc,_0x9bcb('0xe'),JSON[_0x9bcb('0x10')](_0x1e87c9));if(_0x1e87c9['error']){if(_0x1e87c9[_0x9bcb('0x11')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x40c0cc,_0x1e87c9[_0x9bcb('0x11')][_0x9bcb('0x12')]);return _0x44fcdd(_0x1e87c9[_0x9bcb('0x11')][_0x9bcb('0x12')]);}logger[_0x9bcb('0x11')](_0x9bcb('0xd'),_0x40c0cc,_0x1e87c9['error'][_0x9bcb('0x12')]);return _0x522516(_0x1e87c9[_0x9bcb('0x11')]['message']);}else{logger[_0x9bcb('0xc')](_0x9bcb('0xd'),_0x40c0cc,'request\x20sent');_0x522516(_0x1e87c9[_0x9bcb('0x13')][_0x9bcb('0x12')]);}})[_0x9bcb('0x14')](function(_0x58ac50){logger[_0x9bcb('0x11')](_0x9bcb('0xd'),_0x40c0cc,_0x58ac50);_0x44fcdd(_0x58ac50);});});} \ No newline at end of file +var _0xb347=['client','http','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4463cb,_0x4e3952){var _0x5d0d1c=function(_0x2cef84){while(--_0x2cef84){_0x4463cb['push'](_0x4463cb['shift']());}};_0x5d0d1c(++_0x4e3952);}(_0xb347,0x1ab));var _0x7b34=function(_0x5eb5a7,_0x1402eb){_0x5eb5a7=_0x5eb5a7-0x0;var _0x328df2=_0xb347[_0x5eb5a7];return _0x328df2;};'use strict';var _=require(_0x7b34('0x0'));var util=require('util');var moment=require(_0x7b34('0x1'));var BPromise=require(_0x7b34('0x2'));var rs=require(_0x7b34('0x3'));var fs=require('fs');var Redis=require(_0x7b34('0x4'));var db=require(_0x7b34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b34('0x6'))(_0x7b34('0x7'));var config=require(_0x7b34('0x8'));var jayson=require(_0x7b34('0x9'));var client=jayson[_0x7b34('0xa')][_0x7b34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427107,_0x121e56,_0x2cbf8b){return new BPromise(function(_0x413e4d,_0x4c682a){return client[_0x7b34('0xc')](_0x427107,_0x2cbf8b)['then'](function(_0x18a8fb){logger[_0x7b34('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x121e56,_0x7b34('0xe'));logger[_0x7b34('0xf')](_0x7b34('0x10'),_0x121e56,_0x7b34('0xe'),JSON[_0x7b34('0x11')](_0x18a8fb));if(_0x18a8fb['error']){if(_0x18a8fb['error'][_0x7b34('0x12')]===0x1f4){logger[_0x7b34('0x13')](_0x7b34('0x14'),_0x121e56,_0x18a8fb[_0x7b34('0x13')][_0x7b34('0x15')]);return _0x4c682a(_0x18a8fb['error'][_0x7b34('0x15')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x121e56,_0x18a8fb['error']['message']);return _0x413e4d(_0x18a8fb[_0x7b34('0x13')][_0x7b34('0x15')]);}else{logger[_0x7b34('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x121e56,_0x7b34('0xe'));_0x413e4d(_0x18a8fb[_0x7b34('0x16')]['message']);}})['catch'](function(_0x3abab7){logger[_0x7b34('0x13')](_0x7b34('0x14'),_0x121e56,_0x3abab7);_0x4c682a(_0x3abab7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2b57356..6cb0a07 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 _0x265a=['/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x46f04a,_0x5f594a){var _0x19012d=function(_0x5d4924){while(--_0x5d4924){_0x46f04a['push'](_0x46f04a['shift']());}};_0x19012d(++_0x5f594a);}(_0x265a,0x8b));var _0xa265=function(_0x21b9fd,_0x3a7ff0){_0x21b9fd=_0x21b9fd-0x0;var _0x416aa1=_0x265a[_0x21b9fd];return _0x416aa1;};'use strict';var multer=require('multer');var util=require(_0xa265('0x0'));var path=require(_0xa265('0x1'));var timeout=require(_0xa265('0x2'));var express=require(_0xa265('0x3'));var router=express[_0xa265('0x4')]();var fs_extra=require(_0xa265('0x5'));var auth=require(_0xa265('0x6'));var interaction=require(_0xa265('0x7'));var config=require(_0xa265('0x8'));var controller=require(_0xa265('0x9'));router[_0xa265('0xa')]('/',auth['isAuthenticated'](),controller[_0xa265('0xb')]);router[_0xa265('0xa')](_0xa265('0xc'),auth[_0xa265('0xd')](),controller[_0xa265('0xe')]);router[_0xa265('0xa')](_0xa265('0xf'),auth[_0xa265('0xd')](),controller[_0xa265('0x10')]);router['post']('/',auth[_0xa265('0xd')](),controller[_0xa265('0x11')]);router['put']('/:id',auth[_0xa265('0xd')](),controller[_0xa265('0x12')]);router[_0xa265('0x13')](_0xa265('0xf'),auth[_0xa265('0xd')](),controller[_0xa265('0x14')]);module[_0xa265('0x15')]=router; \ No newline at end of file +var _0x1ec2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','/describe','describe','get','show','post','put','/:id','update','delete','exports','util'];(function(_0x58d592,_0x544a2f){var _0x6db52c=function(_0x4300b6){while(--_0x4300b6){_0x58d592['push'](_0x58d592['shift']());}};_0x6db52c(++_0x544a2f);}(_0x1ec2,0x110));var _0x21ec=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x1ec2[_0x16d10f];return _0x50c823;};'use strict';var multer=require('multer');var util=require(_0x21ec('0x0'));var path=require(_0x21ec('0x1'));var timeout=require(_0x21ec('0x2'));var express=require(_0x21ec('0x3'));var router=express[_0x21ec('0x4')]();var fs_extra=require(_0x21ec('0x5'));var auth=require(_0x21ec('0x6'));var interaction=require(_0x21ec('0x7'));var config=require(_0x21ec('0x8'));var controller=require(_0x21ec('0x9'));router['get']('/',auth[_0x21ec('0xa')](),controller['index']);router['get'](_0x21ec('0xb'),auth[_0x21ec('0xa')](),controller[_0x21ec('0xc')]);router[_0x21ec('0xd')]('/:id',auth[_0x21ec('0xa')](),controller[_0x21ec('0xe')]);router[_0x21ec('0xf')]('/',auth[_0x21ec('0xa')](),controller['create']);router[_0x21ec('0x10')](_0x21ec('0x11'),auth[_0x21ec('0xa')](),controller[_0x21ec('0x12')]);router[_0x21ec('0x13')](_0x21ec('0x11'),auth[_0x21ec('0xa')](),controller['destroy']);module[_0x21ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 55b13e1..05ec47f 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 _0x61ff=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports'];(function(_0x20baf9,_0x2a21ac){var _0xb29df7=function(_0x1ca90b){while(--_0x1ca90b){_0x20baf9['push'](_0x20baf9['shift']());}};_0xb29df7(++_0x2a21ac);}(_0x61ff,0x1e0));var _0xf61f=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x61ff[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xf61f('0x0'));var util=require(_0xf61f('0x1'));var path=require(_0xf61f('0x2'));var timeout=require(_0xf61f('0x3'));var express=require(_0xf61f('0x4'));var router=express[_0xf61f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf61f('0x6'));var config=require('../../config/environment');var controller=require(_0xf61f('0x7'));router[_0xf61f('0x8')]('/',auth[_0xf61f('0x9')](),controller['index']);router[_0xf61f('0x8')](_0xf61f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf61f('0x8')](_0xf61f('0xb'),auth[_0xf61f('0x9')](),controller[_0xf61f('0xc')]);router[_0xf61f('0x8')](_0xf61f('0xd'),auth['isAuthenticated'](),controller[_0xf61f('0xe')]);router[_0xf61f('0xf')]('/',auth[_0xf61f('0x9')](),controller['create']);router[_0xf61f('0xf')](_0xf61f('0xb'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x10')]);router['put'](_0xf61f('0xa'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x11')]);router['delete'](_0xf61f('0xa'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x12')]);module[_0xf61f('0x13')]=router; \ No newline at end of file +var _0x8852=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields'];(function(_0x54ae9a,_0x1b1759){var _0x1200dd=function(_0x4fa1d3){while(--_0x4fa1d3){_0x54ae9a['push'](_0x54ae9a['shift']());}};_0x1200dd(++_0x1b1759);}(_0x8852,0x64));var _0x2885=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8852[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x2885('0x0'));var util=require(_0x2885('0x1'));var path=require('path');var timeout=require(_0x2885('0x2'));var express=require(_0x2885('0x3'));var router=express[_0x2885('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2885('0x5'));var config=require(_0x2885('0x6'));var controller=require(_0x2885('0x7'));router[_0x2885('0x8')]('/',auth[_0x2885('0x9')](),controller[_0x2885('0xa')]);router[_0x2885('0x8')](_0x2885('0xb'),auth[_0x2885('0x9')](),controller[_0x2885('0xc')]);router[_0x2885('0x8')](_0x2885('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x2885('0x9')](),controller[_0x2885('0xe')]);router[_0x2885('0xf')]('/',auth[_0x2885('0x9')](),controller[_0x2885('0x10')]);router[_0x2885('0xf')](_0x2885('0xd'),auth['isAuthenticated'](),controller[_0x2885('0x11')]);router[_0x2885('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2885('0x13')]);router[_0x2885('0x14')](_0x2885('0xb'),auth[_0x2885('0x9')](),controller[_0x2885('0x15')]);module[_0x2885('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8ff7951..19eb83e 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 _0xc2f2=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x48b3e7,_0x1ba61f){var _0x518cd7=function(_0x1fb413){while(--_0x1fb413){_0x48b3e7['push'](_0x48b3e7['shift']());}};_0x518cd7(++_0x1ba61f);}(_0xc2f2,0xb4));var _0x2c2f=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xc2f2[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0x2c2f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c2f('0x1')]},'description':{'type':Sequelize[_0x2c2f('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x2c2f('0x2')]('basic'),'defaultValue':_0x2c2f('0x3')},'password':{'type':Sequelize[_0x2c2f('0x1')]},'consumerKey':{'type':Sequelize[_0x2c2f('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2c2f('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2c2f('0x2')](_0x2c2f('0x4'),_0x2c2f('0x5')),'defaultValue':_0x2c2f('0x4')}}; \ No newline at end of file +var _0xce13=['STRING','ENUM','basic','integrationTab','newTab','sequelize','exports'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xce13,0xde));var _0x3ce1=function(_0x24bdc7,_0x1cf8c6){_0x24bdc7=_0x24bdc7-0x0;var _0x1133bb=_0xce13[_0x24bdc7];return _0x1133bb;};'use strict';var Sequelize=require(_0x3ce1('0x0'));module[_0x3ce1('0x1')]={'name':{'type':Sequelize[_0x3ce1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3ce1('0x2')]},'remoteUri':{'type':Sequelize[_0x3ce1('0x2')]},'authType':{'type':Sequelize[_0x3ce1('0x3')](_0x3ce1('0x4')),'defaultValue':_0x3ce1('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x3ce1('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3ce1('0x2')]},'tokenSecret':{'type':Sequelize[_0x3ce1('0x2')]},'serverUrl':{'type':Sequelize[_0x3ce1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3ce1('0x3')](_0x3ce1('0x5'),_0x3ce1('0x6')),'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 9e08785..32f9a53 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 _0x97e2=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','DeskAccount','find','create','update','body','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','end','name','index','map','type','key','model','query','filters','intersection'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x97e2,0x126));var _0x297e=function(_0x308916,_0x1fa3c8){_0x308916=_0x308916-0x0;var _0x5c6f9b=_0x97e2[_0x308916];return _0x5c6f9b;};'use strict';var emlformat=require(_0x297e('0x0'));var rimraf=require(_0x297e('0x1'));var zipdir=require(_0x297e('0x2'));var jsonpatch=require(_0x297e('0x3'));var rp=require(_0x297e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x297e('0x5'));var util=require(_0x297e('0x6'));var path=require(_0x297e('0x7'));var sox=require(_0x297e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x297e('0x9'));var _=require(_0x297e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x297e('0xb'));var deskjs=require(_0x297e('0xc'));var toCsv=require(_0x297e('0xd'));var querystring=require(_0x297e('0xe'));var Papa=require(_0x297e('0xf'));var Redis=require(_0x297e('0x10'));var authService=require(_0x297e('0x11'));var qs=require(_0x297e('0x12'));var as=require(_0x297e('0x13'));var hardwareService=require(_0x297e('0x14'));var logger=require(_0x297e('0x15'))(_0x297e('0x16'));var utils=require(_0x297e('0x17'));var config=require(_0x297e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x297e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e522c,_0x86dce){_0x86dce=_0x86dce||0xcc;return function(_0x6b3f5c){if(_0x6b3f5c){return _0x3e522c[_0x297e('0x1a')](_0x86dce);}return _0x3e522c[_0x297e('0x1b')](_0x86dce)['end']();};}function respondWithResult(_0x1bf836,_0x202893){_0x202893=_0x202893||0xc8;return function(_0x151bac){if(_0x151bac){return _0x1bf836['status'](_0x202893)[_0x297e('0x1c')](_0x151bac);}};}function respondWithFilteredResult(_0x13bd71,_0x567ea6){return function(_0x1a7718){if(_0x1a7718){var _0x481b02=typeof _0x567ea6[_0x297e('0x1d')]==='undefined'&&typeof _0x567ea6[_0x297e('0x1e')]===_0x297e('0x1f');var _0xfe6765=_0x1a7718[_0x297e('0x20')];var _0x3cd998=_0x481b02?0x0:_0x567ea6[_0x297e('0x1d')];var _0x43a4dc=_0x481b02?_0x1a7718[_0x297e('0x20')]:_0x567ea6[_0x297e('0x1d')]+_0x567ea6['limit'];var _0x14f1b9;if(_0x43a4dc>=_0xfe6765){_0x43a4dc=_0xfe6765;_0x14f1b9=0xc8;}else{_0x14f1b9=0xce;}_0x13bd71[_0x297e('0x1b')](_0x14f1b9);return _0x13bd71[_0x297e('0x21')](_0x297e('0x22'),_0x3cd998+'-'+_0x43a4dc+'/'+_0xfe6765)[_0x297e('0x1c')](_0x1a7718);}return null;};}function patchUpdates(_0x5dc5f7){return function(_0x4ad599){try{jsonpatch[_0x297e('0x23')](_0x4ad599,_0x5dc5f7,!![]);}catch(_0x461f86){return BPromise['reject'](_0x461f86);}return _0x4ad599['save']();};}function saveUpdates(_0x57d02c,_0x42555b){return function(_0x52dcd1){if(_0x52dcd1){return _0x52dcd1['update'](_0x57d02c)[_0x297e('0x24')](function(_0xa9e9f7){return _0xa9e9f7;});}return null;};}function removeEntity(_0x5b698e,_0x31e8ec){return function(_0x34e667){if(_0x34e667){return _0x34e667[_0x297e('0x25')]()['then'](function(){_0x5b698e[_0x297e('0x1b')](0xcc)[_0x297e('0x26')]();});}};}function handleEntityNotFound(_0x35da74,_0x1c8241){return function(_0x195909){if(!_0x195909){_0x35da74[_0x297e('0x1a')](0x194);}return _0x195909;};}function handleError(_0x24ec30,_0xac3ff1){_0xac3ff1=_0xac3ff1||0x1f4;return function(_0xbaeeb5){logger['error'](_0xbaeeb5['stack']);if(_0xbaeeb5[_0x297e('0x27')]){delete _0xbaeeb5[_0x297e('0x27')];}_0x24ec30[_0x297e('0x1b')](_0xac3ff1)['send'](_0xbaeeb5);};}exports[_0x297e('0x28')]=function(_0x2e1104,_0x239dc3){var _0x3fcc7c={},_0xeb7eb2={},_0x1f9dda={'count':0x0,'rows':[]};var _0x241dbc=_[_0x297e('0x29')](db['DeskAccount']['rawAttributes'],function(_0xffc94e){return{'name':_0xffc94e['fieldName'],'type':_0xffc94e[_0x297e('0x2a')][_0x297e('0x2b')]};});_0xeb7eb2[_0x297e('0x2c')]=_[_0x297e('0x29')](_0x241dbc,'name');_0xeb7eb2['query']=_['keys'](_0x2e1104[_0x297e('0x2d')]);_0xeb7eb2[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0xeb7eb2[_0x297e('0x2c')],_0xeb7eb2['query']);_0x3fcc7c[_0x297e('0x30')]=_[_0x297e('0x2f')](_0xeb7eb2[_0x297e('0x2c')],qs[_0x297e('0x31')](_0x2e1104['query'][_0x297e('0x31')]));_0x3fcc7c[_0x297e('0x30')]=_0x3fcc7c[_0x297e('0x30')][_0x297e('0x32')]?_0x3fcc7c[_0x297e('0x30')]:_0xeb7eb2['model'];if(!_0x2e1104['query'][_0x297e('0x33')](_0x297e('0x34'))){_0x3fcc7c[_0x297e('0x1e')]=qs['limit'](_0x2e1104['query'][_0x297e('0x1e')]);_0x3fcc7c[_0x297e('0x1d')]=qs['offset'](_0x2e1104[_0x297e('0x2d')]['offset']);}_0x3fcc7c[_0x297e('0x35')]=qs[_0x297e('0x36')](_0x2e1104[_0x297e('0x2d')][_0x297e('0x36')]);_0x3fcc7c[_0x297e('0x37')]=qs[_0x297e('0x2e')](_[_0x297e('0x38')](_0x2e1104[_0x297e('0x2d')],_0xeb7eb2[_0x297e('0x2e')]),_0x241dbc);if(_0x2e1104['query'][_0x297e('0x39')]){_0x3fcc7c[_0x297e('0x37')]=_[_0x297e('0x3a')](_0x3fcc7c[_0x297e('0x37')],{'$or':_[_0x297e('0x29')](_0x241dbc,function(_0x8c4e60){if(_0x8c4e60[_0x297e('0x2a')]!==_0x297e('0x3b')){var _0x19b3a2={};_0x19b3a2[_0x8c4e60[_0x297e('0x27')]]={'$like':'%'+_0x2e1104['query'][_0x297e('0x39')]+'%'};return _0x19b3a2;}})});}_0x3fcc7c=_[_0x297e('0x3a')]({},_0x3fcc7c,_0x2e1104['options']);var _0x9b7016={'where':_0x3fcc7c['where']};return db['DeskAccount'][_0x297e('0x20')](_0x9b7016)[_0x297e('0x24')](function(_0x55251f){_0x1f9dda[_0x297e('0x20')]=_0x55251f;if(_0x2e1104[_0x297e('0x2d')][_0x297e('0x3c')]){_0x3fcc7c[_0x297e('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0x297e('0x3e')](_0x3fcc7c);})[_0x297e('0x24')](function(_0xdbb414){_0x1f9dda[_0x297e('0x3f')]=_0xdbb414;return _0x1f9dda;})['then'](respondWithFilteredResult(_0x239dc3,_0x3fcc7c))[_0x297e('0x40')](handleError(_0x239dc3,null));};exports[_0x297e('0x41')]=function(_0x140aed,_0x25a93f){var _0x3310d2={'raw':![],'where':{'id':_0x140aed[_0x297e('0x42')]['id']}},_0x4b459a={};_0x4b459a[_0x297e('0x2c')]=_[_0x297e('0x43')](db['DeskAccount'][_0x297e('0x44')]);_0x4b459a['query']=_[_0x297e('0x43')](_0x140aed[_0x297e('0x2d')]);_0x4b459a['filters']=_[_0x297e('0x2f')](_0x4b459a['model'],_0x4b459a[_0x297e('0x2d')]);_0x3310d2[_0x297e('0x30')]=_[_0x297e('0x2f')](_0x4b459a['model'],qs[_0x297e('0x31')](_0x140aed[_0x297e('0x2d')]['fields']));_0x3310d2['attributes']=_0x3310d2[_0x297e('0x30')][_0x297e('0x32')]?_0x3310d2[_0x297e('0x30')]:_0x4b459a[_0x297e('0x2c')];if(_0x140aed[_0x297e('0x2d')][_0x297e('0x3c')]){_0x3310d2[_0x297e('0x3d')]=[{'all':!![]}];}_0x3310d2=_['merge']({},_0x3310d2,_0x140aed[_0x297e('0x45')]);return db[_0x297e('0x46')][_0x297e('0x47')](_0x3310d2)[_0x297e('0x24')](handleEntityNotFound(_0x25a93f,null))[_0x297e('0x24')](respondWithResult(_0x25a93f,null))['catch'](handleError(_0x25a93f,null));};exports[_0x297e('0x48')]=function(_0x13ca15,_0x179662){return db[_0x297e('0x46')]['create'](_0x13ca15['body'],{})[_0x297e('0x24')](respondWithResult(_0x179662,0xc9))[_0x297e('0x40')](handleError(_0x179662,null));};exports[_0x297e('0x49')]=function(_0x3f2e5d,_0x27b030){if(_0x3f2e5d[_0x297e('0x4a')]['id']){delete _0x3f2e5d[_0x297e('0x4a')]['id'];}return db['DeskAccount'][_0x297e('0x47')]({'where':{'id':_0x3f2e5d[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x27b030,null))[_0x297e('0x24')](saveUpdates(_0x3f2e5d['body'],null))[_0x297e('0x24')](respondWithResult(_0x27b030,null))['catch'](handleError(_0x27b030,null));};exports[_0x297e('0x25')]=function(_0x1f9f80,_0xf98ac9){return db[_0x297e('0x46')][_0x297e('0x47')]({'where':{'id':_0x1f9f80[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0xf98ac9,null))[_0x297e('0x24')](removeEntity(_0xf98ac9,null))['catch'](handleError(_0xf98ac9,null));};exports['getConfigurations']=function(_0x5304ac,_0x14afcf,_0x218eb2){var _0xffd8aa={};var _0x5bd514={};var _0x39e125;var _0x5aa55f;return db[_0x297e('0x46')][_0x297e('0x4b')]({'where':{'id':_0x5304ac[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x14afcf,null))[_0x297e('0x24')](function(_0x2cba78){if(_0x2cba78){_0x39e125=_0x2cba78;_0x5bd514['model']=_[_0x297e('0x43')](db[_0x297e('0x4c')][_0x297e('0x44')]);_0x5bd514[_0x297e('0x2d')]=_[_0x297e('0x43')](_0x5304ac[_0x297e('0x2d')]);_0x5bd514[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0x5bd514[_0x297e('0x2c')],_0x5bd514[_0x297e('0x2d')]);_0xffd8aa['attributes']=_[_0x297e('0x2f')](_0x5bd514['model'],qs['fields'](_0x5304ac[_0x297e('0x2d')][_0x297e('0x31')]));_0xffd8aa[_0x297e('0x30')]=_0xffd8aa['attributes'][_0x297e('0x32')]?_0xffd8aa['attributes']:_0x5bd514[_0x297e('0x2c')];_0xffd8aa[_0x297e('0x35')]=qs[_0x297e('0x36')](_0x5304ac[_0x297e('0x2d')]['sort']);_0xffd8aa[_0x297e('0x37')]=qs['filters'](_[_0x297e('0x38')](_0x5304ac['query'],_0x5bd514[_0x297e('0x2e')]));if(_0x5304ac[_0x297e('0x2d')]['filter']){_0xffd8aa[_0x297e('0x37')]=_[_0x297e('0x3a')](_0xffd8aa[_0x297e('0x37')],{'$or':_[_0x297e('0x29')](_0xffd8aa['attributes'],function(_0x1846cc){var _0x588c3b={};_0x588c3b[_0x1846cc]={'$like':'%'+_0x5304ac[_0x297e('0x2d')]['filter']+'%'};return _0x588c3b;})});}_0xffd8aa=_[_0x297e('0x3a')]({},_0xffd8aa,_0x5304ac['options']);return _0x39e125['getConfigurations'](_0xffd8aa);}})[_0x297e('0x24')](function(_0x137816){if(_0x137816){_0x5aa55f=_0x137816[_0x297e('0x32')];if(!_0x5304ac[_0x297e('0x2d')][_0x297e('0x33')](_0x297e('0x34'))){_0xffd8aa[_0x297e('0x1e')]=qs[_0x297e('0x1e')](_0x5304ac[_0x297e('0x2d')][_0x297e('0x1e')]);_0xffd8aa[_0x297e('0x1d')]=qs['offset'](_0x5304ac[_0x297e('0x2d')][_0x297e('0x1d')]);}return _0x39e125['getConfigurations'](_0xffd8aa);}})[_0x297e('0x24')](function(_0x4a2f1c){if(_0x4a2f1c){return _0x4a2f1c?{'count':_0x5aa55f,'rows':_0x4a2f1c}:null;}})[_0x297e('0x24')](respondWithResult(_0x14afcf,null))['catch'](handleError(_0x14afcf,null));};exports['addConfiguration']=function(_0x5f107e,_0x2c4249,_0x5db22e){if(_0x5f107e[_0x297e('0x4a')]['id']){delete _0x5f107e[_0x297e('0x4a')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5f107e[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x2c4249,null))[_0x297e('0x24')](function(_0xe45540){if(_0xe45540){_0x5f107e[_0x297e('0x4a')][_0x297e('0x4d')]=_0xe45540['id'];_0x5f107e[_0x297e('0x4a')][_0x297e('0x4e')]=integrations[_0x297e('0x4f')](_0x5f107e['body'][_0x297e('0x50')],_0x5f107e[_0x297e('0x4a')][_0x297e('0x2a')]);_0x5f107e['body']['Descriptions']=integrations['getDescriptions'](_0x5f107e[_0x297e('0x4a')]['channel'],_0x5f107e['body'][_0x297e('0x2a')]);return db[_0x297e('0x4c')][_0x297e('0x48')](_0x5f107e[_0x297e('0x4a')],{'include':[{'model':db[_0x297e('0x51')],'as':_0x297e('0x4e')},{'model':db[_0x297e('0x51')],'as':_0x297e('0x52')}]});}return null;})[_0x297e('0x24')](respondWithResult(_0x2c4249,null))[_0x297e('0x40')](handleError(_0x2c4249,null));};exports[_0x297e('0x53')]=function(_0x3abb6a,_0x5a43b2,_0x2a2e77){var _0x217ee8=[{'name':_0x297e('0x54'),'label':_0x297e('0x54'),'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 _0x572c70='';return db['DeskAccount'][_0x297e('0x4b')]({'where':{'id':_0x3abb6a['params']['id']},'attributes':['id',_0x297e('0x55'),_0x297e('0x56'),_0x297e('0x57'),_0x297e('0x58'),'consumerKey',_0x297e('0x59'),_0x297e('0x5a'),_0x297e('0x5b')]})[_0x297e('0x24')](handleEntityNotFound(_0x5a43b2,null))[_0x297e('0x24')](function(_0xd25694){if(_0xd25694){_0x572c70=_0xd25694[_0x297e('0x55')];var _0x3fdacb=_0x572c70[_0x297e('0x5c')](-0x1);if(_0x3fdacb==='/'){_0x572c70=_0x572c70[_0x297e('0x5d')](0x0,_0x572c70['lastIndexOf'](_0x3fdacb));}var _0x6b1e6b={'method':_0x297e('0x5e'),'uri':util[_0x297e('0x5f')](_0x297e('0x60'),_0x572c70),'headers':{'Content-Type':_0x297e('0x61'),'Accept':_0x297e('0x61')},'json':!![]};if(_0xd25694[_0x297e('0x56')]===_0x297e('0x62')){_0x6b1e6b[_0x297e('0x63')]['Authorization']=util[_0x297e('0x5f')](_0x297e('0x64'),new Buffer(util[_0x297e('0x5f')](_0x297e('0x65'),_0xd25694[_0x297e('0x57')],_0xd25694[_0x297e('0x58')]))[_0x297e('0x66')](_0x297e('0x67')));}return rp(_0x6b1e6b)[_0x297e('0x24')](function(_0x29e639){return _0x217ee8[_0x297e('0x68')](_[_0x297e('0x29')](_0x29e639[_0x297e('0x69')]['entries'],function(_0x5b1d1b){return{'id':_0x5b1d1b[_0x297e('0x27')],'name':_0x5b1d1b[_0x297e('0x27')],'type':_0x5b1d1b[_0x297e('0x2a')],'active':_0x5b1d1b[_0x297e('0x6a')],'label':_0x5b1d1b[_0x297e('0x6b')],'custom':!![]};}));});}})[_0x297e('0x24')](function(_0x253616){return{'count':_0x253616[_0x297e('0x32')],'rows':_0x253616};})[_0x297e('0x24')](respondWithResult(_0x5a43b2,null))['catch'](function(_0x4fac1f){var _0x155ff4=_0x3abb6a['query'][_0x297e('0x6c')]?0x1f4:_0x4fac1f['statusCode']||0x1f4;logger[_0x297e('0x6d')](_0x297e('0x6e'),_0x297e('0x53'),_0x155ff4,JSON[_0x297e('0x6f')](_0x4fac1f));delete _0x4fac1f[_0x297e('0x27')];if(_0x155ff4===0x191){_0x155ff4=0x190;}_0x5a43b2[_0x297e('0x1b')](_0x155ff4)[_0x297e('0x70')](_0x3abb6a[_0x297e('0x2d')][_0x297e('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x4fac1f[_0x297e('0x71')]}:_0x4fac1f);});}; \ No newline at end of file +var _0x6b32=['VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge'];(function(_0x47bf4d,_0x2bef5f){var _0x223567=function(_0x4bf9c3){while(--_0x4bf9c3){_0x47bf4d['push'](_0x47bf4d['shift']());}};_0x223567(++_0x2bef5f);}(_0x6b32,0x19a));var _0x26b3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26b3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26b3('0x1'));var moment=require(_0x26b3('0x2'));var BPromise=require(_0x26b3('0x3'));var Mustache=require(_0x26b3('0x4'));var util=require(_0x26b3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x26b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26b3('0x7'));var _=require(_0x26b3('0x8'));var squel=require('squel');var crypto=require(_0x26b3('0x9'));var jsforce=require(_0x26b3('0xa'));var deskjs=require(_0x26b3('0xb'));var toCsv=require(_0x26b3('0x6'));var querystring=require(_0x26b3('0xc'));var Papa=require('papaparse');var Redis=require(_0x26b3('0xd'));var authService=require(_0x26b3('0xe'));var qs=require(_0x26b3('0xf'));var as=require(_0x26b3('0x10'));var hardwareService=require(_0x26b3('0x11'));var logger=require(_0x26b3('0x12'))(_0x26b3('0x13'));var utils=require(_0x26b3('0x14'));var config=require(_0x26b3('0x15'));var licenseUtil=require(_0x26b3('0x16'));var db=require(_0x26b3('0x17'))['db'];var integrations=require(_0x26b3('0x18'));function respondWithStatusCode(_0x1bd8ae,_0x13b632){_0x13b632=_0x13b632||0xcc;return function(_0x53b31b){if(_0x53b31b){return _0x1bd8ae[_0x26b3('0x19')](_0x13b632);}return _0x1bd8ae[_0x26b3('0x1a')](_0x13b632)['end']();};}function respondWithResult(_0x4ca24d,_0xa0fab){_0xa0fab=_0xa0fab||0xc8;return function(_0x58d930){if(_0x58d930){return _0x4ca24d['status'](_0xa0fab)[_0x26b3('0x1b')](_0x58d930);}};}function respondWithFilteredResult(_0x5f1068,_0x1af209){return function(_0x3645e6){if(_0x3645e6){var _0x5b49e5=typeof _0x1af209[_0x26b3('0x1c')]===_0x26b3('0x1d')&&typeof _0x1af209[_0x26b3('0x1e')]===_0x26b3('0x1d');var _0x20b988=_0x3645e6[_0x26b3('0x1f')];var _0x2f2a75=_0x5b49e5?0x0:_0x1af209['offset'];var _0x42fe7a=_0x5b49e5?_0x3645e6[_0x26b3('0x1f')]:_0x1af209[_0x26b3('0x1c')]+_0x1af209[_0x26b3('0x1e')];var _0x5d2c22;if(_0x42fe7a>=_0x20b988){_0x42fe7a=_0x20b988;_0x5d2c22=0xc8;}else{_0x5d2c22=0xce;}_0x5f1068[_0x26b3('0x1a')](_0x5d2c22);return _0x5f1068[_0x26b3('0x20')](_0x26b3('0x21'),_0x2f2a75+'-'+_0x42fe7a+'/'+_0x20b988)[_0x26b3('0x1b')](_0x3645e6);}return null;};}function patchUpdates(_0x525395){return function(_0x571857){try{jsonpatch[_0x26b3('0x22')](_0x571857,_0x525395,!![]);}catch(_0x286a41){return BPromise[_0x26b3('0x23')](_0x286a41);}return _0x571857['save']();};}function saveUpdates(_0x36c5da,_0x3bf118){return function(_0x2d010d){if(_0x2d010d){return _0x2d010d[_0x26b3('0x24')](_0x36c5da)[_0x26b3('0x25')](function(_0x9c76e6){return _0x9c76e6;});}return null;};}function removeEntity(_0x5c0b55,_0x1f8115){return function(_0x432e31){if(_0x432e31){return _0x432e31['destroy']()[_0x26b3('0x25')](function(){_0x5c0b55['status'](0xcc)[_0x26b3('0x26')]();});}};}function handleEntityNotFound(_0x48608d,_0x249e7a){return function(_0x26216e){if(!_0x26216e){_0x48608d[_0x26b3('0x19')](0x194);}return _0x26216e;};}function handleError(_0xb04777,_0x6e3f73){_0x6e3f73=_0x6e3f73||0x1f4;return function(_0x572bd7){logger['error'](_0x572bd7[_0x26b3('0x27')]);if(_0x572bd7['name']){delete _0x572bd7[_0x26b3('0x28')];}_0xb04777[_0x26b3('0x1a')](_0x6e3f73)[_0x26b3('0x29')](_0x572bd7);};}exports[_0x26b3('0x2a')]=function(_0x2fbf23,_0x3dd4c1){var _0x5b781={},_0x262fc6={},_0x530394={'count':0x0,'rows':[]};var _0x4e58d4=_[_0x26b3('0x2b')](db[_0x26b3('0x2c')][_0x26b3('0x2d')],function(_0x50875b){return{'name':_0x50875b[_0x26b3('0x2e')],'type':_0x50875b[_0x26b3('0x2f')][_0x26b3('0x30')]};});_0x262fc6[_0x26b3('0x31')]=_['map'](_0x4e58d4,_0x26b3('0x28'));_0x262fc6[_0x26b3('0x32')]=_['keys'](_0x2fbf23['query']);_0x262fc6[_0x26b3('0x33')]=_[_0x26b3('0x34')](_0x262fc6[_0x26b3('0x31')],_0x262fc6[_0x26b3('0x32')]);_0x5b781['attributes']=_[_0x26b3('0x34')](_0x262fc6[_0x26b3('0x31')],qs[_0x26b3('0x35')](_0x2fbf23[_0x26b3('0x32')][_0x26b3('0x35')]));_0x5b781[_0x26b3('0x36')]=_0x5b781[_0x26b3('0x36')][_0x26b3('0x37')]?_0x5b781['attributes']:_0x262fc6[_0x26b3('0x31')];if(!_0x2fbf23[_0x26b3('0x32')][_0x26b3('0x38')]('nolimit')){_0x5b781[_0x26b3('0x1e')]=qs[_0x26b3('0x1e')](_0x2fbf23[_0x26b3('0x32')][_0x26b3('0x1e')]);_0x5b781[_0x26b3('0x1c')]=qs[_0x26b3('0x1c')](_0x2fbf23[_0x26b3('0x32')][_0x26b3('0x1c')]);}_0x5b781[_0x26b3('0x39')]=qs[_0x26b3('0x3a')](_0x2fbf23['query'][_0x26b3('0x3a')]);_0x5b781['where']=qs[_0x26b3('0x33')](_[_0x26b3('0x3b')](_0x2fbf23[_0x26b3('0x32')],_0x262fc6[_0x26b3('0x33')]),_0x4e58d4);if(_0x2fbf23['query'][_0x26b3('0x3c')]){_0x5b781['where']=_[_0x26b3('0x3d')](_0x5b781['where'],{'$or':_[_0x26b3('0x2b')](_0x4e58d4,function(_0x42b0d0){if(_0x42b0d0['type']!==_0x26b3('0x3e')){var _0x42ba3e={};_0x42ba3e[_0x42b0d0[_0x26b3('0x28')]]={'$like':'%'+_0x2fbf23['query']['filter']+'%'};return _0x42ba3e;}})});}_0x5b781=_[_0x26b3('0x3d')]({},_0x5b781,_0x2fbf23[_0x26b3('0x3f')]);var _0x4fa6d7={'where':_0x5b781[_0x26b3('0x40')]};return db['DeskAccount'][_0x26b3('0x1f')](_0x4fa6d7)['then'](function(_0x225446){_0x530394['count']=_0x225446;if(_0x2fbf23[_0x26b3('0x32')][_0x26b3('0x41')]){_0x5b781[_0x26b3('0x42')]=[{'all':!![]}];}return db[_0x26b3('0x2c')][_0x26b3('0x43')](_0x5b781);})[_0x26b3('0x25')](function(_0x5befbc){_0x530394[_0x26b3('0x44')]=_0x5befbc;return _0x530394;})[_0x26b3('0x25')](respondWithFilteredResult(_0x3dd4c1,_0x5b781))[_0x26b3('0x45')](handleError(_0x3dd4c1,null));};exports[_0x26b3('0x46')]=function(_0x2de4ef,_0x3c785d){var _0x3f67dd={'raw':![],'where':{'id':_0x2de4ef[_0x26b3('0x47')]['id']}},_0xd39ddc={};_0xd39ddc[_0x26b3('0x31')]=_[_0x26b3('0x48')](db[_0x26b3('0x2c')]['rawAttributes']);_0xd39ddc['query']=_[_0x26b3('0x48')](_0x2de4ef[_0x26b3('0x32')]);_0xd39ddc[_0x26b3('0x33')]=_[_0x26b3('0x34')](_0xd39ddc['model'],_0xd39ddc[_0x26b3('0x32')]);_0x3f67dd[_0x26b3('0x36')]=_['intersection'](_0xd39ddc[_0x26b3('0x31')],qs['fields'](_0x2de4ef[_0x26b3('0x32')][_0x26b3('0x35')]));_0x3f67dd[_0x26b3('0x36')]=_0x3f67dd['attributes'][_0x26b3('0x37')]?_0x3f67dd[_0x26b3('0x36')]:_0xd39ddc['model'];if(_0x2de4ef['query'][_0x26b3('0x41')]){_0x3f67dd[_0x26b3('0x42')]=[{'all':!![]}];}_0x3f67dd=_['merge']({},_0x3f67dd,_0x2de4ef[_0x26b3('0x3f')]);return db[_0x26b3('0x2c')][_0x26b3('0x49')](_0x3f67dd)['then'](handleEntityNotFound(_0x3c785d,null))['then'](respondWithResult(_0x3c785d,null))['catch'](handleError(_0x3c785d,null));};exports[_0x26b3('0x4a')]=function(_0x1b11e3,_0x2696b0){return db[_0x26b3('0x2c')][_0x26b3('0x4a')](_0x1b11e3[_0x26b3('0x4b')],{})[_0x26b3('0x25')](respondWithResult(_0x2696b0,0xc9))[_0x26b3('0x45')](handleError(_0x2696b0,null));};exports['update']=function(_0x343cbb,_0x3ecc40){if(_0x343cbb['body']['id']){delete _0x343cbb[_0x26b3('0x4b')]['id'];}return db[_0x26b3('0x2c')][_0x26b3('0x49')]({'where':{'id':_0x343cbb[_0x26b3('0x47')]['id']}})[_0x26b3('0x25')](handleEntityNotFound(_0x3ecc40,null))[_0x26b3('0x25')](saveUpdates(_0x343cbb[_0x26b3('0x4b')],null))[_0x26b3('0x25')](respondWithResult(_0x3ecc40,null))['catch'](handleError(_0x3ecc40,null));};exports['destroy']=function(_0x2877f8,_0x4db0c4){return db[_0x26b3('0x2c')][_0x26b3('0x49')]({'where':{'id':_0x2877f8[_0x26b3('0x47')]['id']}})[_0x26b3('0x25')](handleEntityNotFound(_0x4db0c4,null))[_0x26b3('0x25')](removeEntity(_0x4db0c4,null))['catch'](handleError(_0x4db0c4,null));};exports['getConfigurations']=function(_0x5407ee,_0x1a8acf,_0x149e4d){var _0x1f69b7={};var _0x40e3f0={};var _0x2f64b4;var _0x568303;return db[_0x26b3('0x2c')][_0x26b3('0x4c')]({'where':{'id':_0x5407ee['params']['id']}})[_0x26b3('0x25')](handleEntityNotFound(_0x1a8acf,null))[_0x26b3('0x25')](function(_0x1e3ad5){if(_0x1e3ad5){_0x2f64b4=_0x1e3ad5;_0x40e3f0[_0x26b3('0x31')]=_[_0x26b3('0x48')](db['DeskConfiguration'][_0x26b3('0x2d')]);_0x40e3f0[_0x26b3('0x32')]=_['keys'](_0x5407ee['query']);_0x40e3f0[_0x26b3('0x33')]=_[_0x26b3('0x34')](_0x40e3f0[_0x26b3('0x31')],_0x40e3f0[_0x26b3('0x32')]);_0x1f69b7[_0x26b3('0x36')]=_['intersection'](_0x40e3f0[_0x26b3('0x31')],qs['fields'](_0x5407ee[_0x26b3('0x32')]['fields']));_0x1f69b7[_0x26b3('0x36')]=_0x1f69b7[_0x26b3('0x36')][_0x26b3('0x37')]?_0x1f69b7[_0x26b3('0x36')]:_0x40e3f0[_0x26b3('0x31')];_0x1f69b7[_0x26b3('0x39')]=qs['sort'](_0x5407ee['query']['sort']);_0x1f69b7['where']=qs[_0x26b3('0x33')](_[_0x26b3('0x3b')](_0x5407ee[_0x26b3('0x32')],_0x40e3f0[_0x26b3('0x33')]));if(_0x5407ee[_0x26b3('0x32')][_0x26b3('0x3c')]){_0x1f69b7[_0x26b3('0x40')]=_[_0x26b3('0x3d')](_0x1f69b7[_0x26b3('0x40')],{'$or':_[_0x26b3('0x2b')](_0x1f69b7[_0x26b3('0x36')],function(_0x154e41){var _0x43a2e2={};_0x43a2e2[_0x154e41]={'$like':'%'+_0x5407ee['query'][_0x26b3('0x3c')]+'%'};return _0x43a2e2;})});}_0x1f69b7=_[_0x26b3('0x3d')]({},_0x1f69b7,_0x5407ee['options']);return _0x2f64b4[_0x26b3('0x4d')](_0x1f69b7);}})[_0x26b3('0x25')](function(_0x3f128b){if(_0x3f128b){_0x568303=_0x3f128b['length'];if(!_0x5407ee['query'][_0x26b3('0x38')](_0x26b3('0x4e'))){_0x1f69b7[_0x26b3('0x1e')]=qs[_0x26b3('0x1e')](_0x5407ee[_0x26b3('0x32')][_0x26b3('0x1e')]);_0x1f69b7['offset']=qs[_0x26b3('0x1c')](_0x5407ee[_0x26b3('0x32')][_0x26b3('0x1c')]);}return _0x2f64b4['getConfigurations'](_0x1f69b7);}})['then'](function(_0x10a028){if(_0x10a028){return _0x10a028?{'count':_0x568303,'rows':_0x10a028}:null;}})['then'](respondWithResult(_0x1a8acf,null))[_0x26b3('0x45')](handleError(_0x1a8acf,null));};exports[_0x26b3('0x4f')]=function(_0x2e12b8,_0x9bfbb4,_0x1ccde8){if(_0x2e12b8[_0x26b3('0x4b')]['id']){delete _0x2e12b8[_0x26b3('0x4b')]['id'];}return db[_0x26b3('0x2c')]['findOne']({'where':{'id':_0x2e12b8[_0x26b3('0x47')]['id']}})[_0x26b3('0x25')](handleEntityNotFound(_0x9bfbb4,null))[_0x26b3('0x25')](function(_0xf727df){if(_0xf727df){_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x50')]=_0xf727df['id'];_0x2e12b8['body'][_0x26b3('0x51')]=integrations['getSubjects'](_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x52')],_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x2f')]);_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x53')]=integrations[_0x26b3('0x54')](_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x52')],_0x2e12b8[_0x26b3('0x4b')][_0x26b3('0x2f')]);return db[_0x26b3('0x55')]['create'](_0x2e12b8[_0x26b3('0x4b')],{'include':[{'model':db[_0x26b3('0x56')],'as':_0x26b3('0x51')},{'model':db[_0x26b3('0x56')],'as':_0x26b3('0x53')}]});}return null;})['then'](respondWithResult(_0x9bfbb4,null))['catch'](handleError(_0x9bfbb4,null));};exports[_0x26b3('0x57')]=function(_0x3ab7d3,_0x2845fe,_0x1a379f){var _0x2e456e=[{'name':_0x26b3('0x58'),'label':_0x26b3('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 _0x383b66='';return db[_0x26b3('0x2c')][_0x26b3('0x4c')]({'where':{'id':_0x3ab7d3[_0x26b3('0x47')]['id']},'attributes':['id',_0x26b3('0x59'),'authType',_0x26b3('0x5a'),_0x26b3('0x5b'),_0x26b3('0x5c'),_0x26b3('0x5d'),_0x26b3('0x5e'),_0x26b3('0x5f')]})[_0x26b3('0x25')](handleEntityNotFound(_0x2845fe,null))[_0x26b3('0x25')](function(_0x100a94){if(_0x100a94){_0x383b66=_0x100a94[_0x26b3('0x59')];var _0x24634e=_0x383b66[_0x26b3('0x60')](-0x1);if(_0x24634e==='/'){_0x383b66=_0x383b66[_0x26b3('0x61')](0x0,_0x383b66[_0x26b3('0x62')](_0x24634e));}var _0x562df3={'method':_0x26b3('0x63'),'uri':util[_0x26b3('0x64')](_0x26b3('0x65'),_0x383b66),'headers':{'Content-Type':_0x26b3('0x66'),'Accept':_0x26b3('0x66')},'json':!![]};if(_0x100a94['authType']===_0x26b3('0x67')){_0x562df3['headers'][_0x26b3('0x68')]=util['format'](_0x26b3('0x69'),new Buffer(util[_0x26b3('0x64')](_0x26b3('0x6a'),_0x100a94['username'],_0x100a94[_0x26b3('0x5b')]))[_0x26b3('0x6b')](_0x26b3('0x6c')));}return rp(_0x562df3)[_0x26b3('0x25')](function(_0xeab423){return _0x2e456e[_0x26b3('0x6d')](_[_0x26b3('0x2b')](_0xeab423['_embedded']['entries'],function(_0x11f851){return{'id':_0x11f851[_0x26b3('0x28')],'name':_0x11f851[_0x26b3('0x28')],'type':_0x11f851[_0x26b3('0x2f')],'active':_0x11f851[_0x26b3('0x6e')],'label':_0x11f851[_0x26b3('0x6f')],'custom':!![]};}));});}})[_0x26b3('0x25')](function(_0x1c5238){return{'count':_0x1c5238[_0x26b3('0x37')],'rows':_0x1c5238};})['then'](respondWithResult(_0x2845fe,null))[_0x26b3('0x45')](function(_0x1f5ae1){var _0x3d2c31=_0x3ab7d3['query'][_0x26b3('0x70')]?0x1f4:_0x1f5ae1[_0x26b3('0x71')]||0x1f4;logger[_0x26b3('0x72')](_0x26b3('0x73'),_0x26b3('0x57'),_0x3d2c31,JSON[_0x26b3('0x74')](_0x1f5ae1));delete _0x1f5ae1[_0x26b3('0x28')];if(_0x3d2c31===0x191){_0x3d2c31=0x190;}_0x2845fe[_0x26b3('0x1a')](_0x3d2c31)[_0x26b3('0x29')](_0x3ab7d3[_0x26b3('0x32')][_0x26b3('0x70')]?{'message':_0x26b3('0x75'),'statusCode':_0x1f5ae1[_0x26b3('0x71')]}:_0x1f5ae1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e1a9989..dc81fb3 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 _0x3d8a=['define','DeskAccount','int_desk_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x230bb8,_0xa1718){var _0x16cb9a=function(_0x2848fe){while(--_0x2848fe){_0x230bb8['push'](_0x230bb8['shift']());}};_0x16cb9a(++_0xa1718);}(_0x3d8a,0xc9));var _0xa3d8=function(_0x194238,_0x4587b8){_0x194238=_0x194238-0x0;var _0x201345=_0x3d8a[_0x194238];return _0x201345;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa3d8('0x0'));var BPromise=require(_0xa3d8('0x1'));var rp=require(_0xa3d8('0x2'));var fs=require('fs');var path=require(_0xa3d8('0x3'));var rimraf=require(_0xa3d8('0x4'));var config=require(_0xa3d8('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa3d8('0x6'));module[_0xa3d8('0x7')]=function(_0x2c9e76,_0x35744f){return _0x2c9e76[_0xa3d8('0x8')](_0xa3d8('0x9'),attributes,{'tableName':_0xa3d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79b1=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','bluebird','request-promise'];(function(_0x26c936,_0x29ed7e){var _0x27ca0c=function(_0x42c79a){while(--_0x42c79a){_0x26c936['push'](_0x26c936['shift']());}};_0x27ca0c(++_0x29ed7e);}(_0x79b1,0xbf));var _0x179b=function(_0x3c16a9,_0x109c94){_0x3c16a9=_0x3c16a9-0x0;var _0x2b5f7c=_0x79b1[_0x3c16a9];return _0x2b5f7c;};'use strict';var _=require(_0x179b('0x0'));var util=require(_0x179b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x179b('0x2'));var rp=require(_0x179b('0x3'));var fs=require('fs');var path=require(_0x179b('0x4'));var rimraf=require(_0x179b('0x5'));var config=require(_0x179b('0x6'));var attributes=require(_0x179b('0x7'));var integrations=require(_0x179b('0x8'));module[_0x179b('0x9')]=function(_0x5eee8f,_0x22448f){return _0x5eee8f[_0x179b('0xa')](_0x179b('0xb'),attributes,{'tableName':_0x179b('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 9b73d74..3c9d7c0 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 _0x020b=['model','then','GetDeskAccount','find','raw','ShowDeskAccount','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','DeskAccount','options','where','attributes','limit','include','map'];(function(_0x18f685,_0x18d9d9){var _0x46a02e=function(_0x1064d0){while(--_0x1064d0){_0x18f685['push'](_0x18f685['shift']());}};_0x46a02e(++_0x18d9d9);}(_0x020b,0x15a));var _0xb020=function(_0x223612,_0x3d61d3){_0x223612=_0x223612-0x0;var _0x4198e7=_0x020b[_0x223612];return _0x4198e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb020('0x0'));var BPromise=require(_0xb020('0x1'));var rs=require(_0xb020('0x2'));var fs=require('fs');var Redis=require(_0xb020('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb020('0x4'));var logger=require(_0xb020('0x5'))('rpc');var config=require(_0xb020('0x6'));var jayson=require(_0xb020('0x7'));var client=jayson[_0xb020('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14330e,_0x4e23f9,_0x41e5ea){return new BPromise(function(_0x8399d3,_0x459fe1){return client[_0xb020('0x9')](_0x14330e,_0x41e5ea)['then'](function(_0x48b47d){logger[_0xb020('0xa')](_0xb020('0xb'),_0x4e23f9,'request\x20sent');logger[_0xb020('0xc')](_0xb020('0xd'),_0x4e23f9,_0xb020('0xe'),JSON[_0xb020('0xf')](_0x48b47d));if(_0x48b47d[_0xb020('0x10')]){if(_0x48b47d[_0xb020('0x10')][_0xb020('0x11')]===0x1f4){logger[_0xb020('0x10')](_0xb020('0xb'),_0x4e23f9,_0x48b47d['error'][_0xb020('0x12')]);return _0x459fe1(_0x48b47d[_0xb020('0x10')][_0xb020('0x12')]);}logger[_0xb020('0x10')](_0xb020('0xb'),_0x4e23f9,_0x48b47d[_0xb020('0x10')]['message']);return _0x8399d3(_0x48b47d[_0xb020('0x10')]['message']);}else{logger[_0xb020('0xa')](_0xb020('0xb'),_0x4e23f9,_0xb020('0xe'));_0x8399d3(_0x48b47d[_0xb020('0x13')][_0xb020('0x12')]);}})[_0xb020('0x14')](function(_0x48a96b){logger[_0xb020('0x10')]('DeskAccount,\x20%s,\x20%s',_0x4e23f9,_0x48a96b);_0x459fe1(_0x48a96b);});});}exports['GetDeskAccount']=function(_0x4c769b){var _0x11348b=this;return new Promise(function(_0x51bd4a,_0xd3190){return db[_0xb020('0x15')]['findAll']({'raw':_0x4c769b['options']?_0x4c769b[_0xb020('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c769b[_0xb020('0x16')]?_0x4c769b['options'][_0xb020('0x17')]||null:null,'attributes':_0x4c769b['options']?_0x4c769b[_0xb020('0x16')][_0xb020('0x18')]||null:null,'limit':_0x4c769b['options']?_0x4c769b['options'][_0xb020('0x19')]||null:null,'include':_0x4c769b[_0xb020('0x16')]?_0x4c769b[_0xb020('0x16')][_0xb020('0x1a')]?_[_0xb020('0x1b')](_0x4c769b[_0xb020('0x16')]['include'],function(_0x4be729){return{'model':db[_0x4be729[_0xb020('0x1c')]],'as':_0x4be729['as'],'attributes':_0x4be729[_0xb020('0x18')],'include':_0x4be729['include']?_[_0xb020('0x1b')](_0x4be729[_0xb020('0x1a')],function(_0x4f4d9a){return{'model':db[_0x4f4d9a[_0xb020('0x1c')]],'as':_0x4f4d9a['as'],'attributes':_0x4f4d9a[_0xb020('0x18')],'include':_0x4f4d9a[_0xb020('0x1a')]?_['map'](_0x4f4d9a[_0xb020('0x1a')],function(_0x2517dd){return{'model':db[_0x2517dd[_0xb020('0x1c')]],'as':_0x2517dd['as'],'attributes':_0x2517dd[_0xb020('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb020('0x1d')](function(_0x144db8){logger[_0xb020('0xa')](_0xb020('0x1e'),_0x4c769b);logger[_0xb020('0xc')](_0xb020('0x1e'),_0x4c769b,JSON[_0xb020('0xf')](_0x144db8));_0x51bd4a(_0x144db8);})[_0xb020('0x14')](function(_0x1ca499){logger[_0xb020('0x10')](_0xb020('0x1e'),_0x1ca499[_0xb020('0x12')],_0x4c769b);_0xd3190(_0x11348b['error'](0x1f4,_0x1ca499[_0xb020('0x12')]));});});};exports['ShowDeskAccount']=function(_0x32821e){var _0x3686c7=this;return new Promise(function(_0x3d0ae3,_0x38ea6f){return db[_0xb020('0x15')][_0xb020('0x1f')]({'raw':_0x32821e[_0xb020('0x16')]?_0x32821e[_0xb020('0x16')][_0xb020('0x20')]===undefined?!![]:![]:!![],'where':_0x32821e['options']?_0x32821e[_0xb020('0x16')][_0xb020('0x17')]||null:null,'attributes':_0x32821e[_0xb020('0x16')]?_0x32821e[_0xb020('0x16')][_0xb020('0x18')]||null:null,'include':_0x32821e['options']?_0x32821e[_0xb020('0x16')][_0xb020('0x1a')]?_[_0xb020('0x1b')](_0x32821e[_0xb020('0x16')]['include'],function(_0x241e94){return{'model':db[_0x241e94['model']],'as':_0x241e94['as'],'attributes':_0x241e94['attributes'],'include':_0x241e94['include']?_[_0xb020('0x1b')](_0x241e94[_0xb020('0x1a')],function(_0x3e5cef){return{'model':db[_0x3e5cef[_0xb020('0x1c')]],'as':_0x3e5cef['as'],'attributes':_0x3e5cef['attributes'],'include':_0x3e5cef['include']?_[_0xb020('0x1b')](_0x3e5cef[_0xb020('0x1a')],function(_0x56f35f){return{'model':db[_0x56f35f['model']],'as':_0x56f35f['as'],'attributes':_0x56f35f[_0xb020('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x241b97){logger[_0xb020('0xa')](_0xb020('0x21'),_0x32821e);logger[_0xb020('0xc')](_0xb020('0x21'),_0x32821e,JSON[_0xb020('0xf')](_0x241b97));_0x3d0ae3(_0x241b97);})[_0xb020('0x14')](function(_0x5d1747){logger[_0xb020('0x10')](_0xb020('0x21'),_0x5d1747[_0xb020('0x12')],_0x32821e);_0x38ea6f(_0x3686c7[_0xb020('0x10')](0x1f4,_0x5d1747[_0xb020('0x12')]));});});}; \ No newline at end of file +var _0x3c98=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','catch','where','ShowDeskAccount','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3c98,0x19f));var _0x83c9=function(_0x54c88d,_0xe69f4a){_0x54c88d=_0x54c88d-0x0;var _0x3874ff=_0x3c98[_0x54c88d];return _0x3874ff;};'use strict';var _=require(_0x83c9('0x0'));var util=require(_0x83c9('0x1'));var moment=require(_0x83c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83c9('0x3'));var db=require(_0x83c9('0x4'))['db'];var utils=require(_0x83c9('0x5'));var logger=require(_0x83c9('0x6'))('rpc');var config=require(_0x83c9('0x7'));var jayson=require(_0x83c9('0x8'));var client=jayson[_0x83c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed790,_0x221599,_0x18bceb){return new BPromise(function(_0x1c16ce,_0x1029aa){return client[_0x83c9('0xa')](_0x2ed790,_0x18bceb)[_0x83c9('0xb')](function(_0x5f539e){logger[_0x83c9('0xc')](_0x83c9('0xd'),_0x221599,_0x83c9('0xe'));logger[_0x83c9('0xf')](_0x83c9('0x10'),_0x221599,'request\x20sent',JSON[_0x83c9('0x11')](_0x5f539e));if(_0x5f539e['error']){if(_0x5f539e[_0x83c9('0x12')][_0x83c9('0x13')]===0x1f4){logger['error'](_0x83c9('0xd'),_0x221599,_0x5f539e[_0x83c9('0x12')][_0x83c9('0x14')]);return _0x1029aa(_0x5f539e[_0x83c9('0x12')][_0x83c9('0x14')]);}logger[_0x83c9('0x12')](_0x83c9('0xd'),_0x221599,_0x5f539e[_0x83c9('0x12')][_0x83c9('0x14')]);return _0x1c16ce(_0x5f539e[_0x83c9('0x12')][_0x83c9('0x14')]);}else{logger[_0x83c9('0xc')]('DeskAccount,\x20%s,\x20%s',_0x221599,'request\x20sent');_0x1c16ce(_0x5f539e[_0x83c9('0x15')][_0x83c9('0x14')]);}})['catch'](function(_0x128bdb){logger[_0x83c9('0x12')](_0x83c9('0xd'),_0x221599,_0x128bdb);_0x1029aa(_0x128bdb);});});}exports[_0x83c9('0x16')]=function(_0x21a574){var _0x7a9f8d=this;return new Promise(function(_0x24cecf,_0xe58b23){return db[_0x83c9('0x17')][_0x83c9('0x18')]({'raw':_0x21a574[_0x83c9('0x19')]?_0x21a574[_0x83c9('0x19')][_0x83c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x21a574[_0x83c9('0x19')]?_0x21a574[_0x83c9('0x19')]['where']||null:null,'attributes':_0x21a574[_0x83c9('0x19')]?_0x21a574[_0x83c9('0x19')][_0x83c9('0x1b')]||null:null,'limit':_0x21a574[_0x83c9('0x19')]?_0x21a574['options'][_0x83c9('0x1c')]||null:null,'include':_0x21a574['options']?_0x21a574[_0x83c9('0x19')][_0x83c9('0x1d')]?_[_0x83c9('0x1e')](_0x21a574[_0x83c9('0x19')][_0x83c9('0x1d')],function(_0x1eb6dd){return{'model':db[_0x1eb6dd['model']],'as':_0x1eb6dd['as'],'attributes':_0x1eb6dd[_0x83c9('0x1b')],'include':_0x1eb6dd[_0x83c9('0x1d')]?_[_0x83c9('0x1e')](_0x1eb6dd[_0x83c9('0x1d')],function(_0x40d026){return{'model':db[_0x40d026[_0x83c9('0x1f')]],'as':_0x40d026['as'],'attributes':_0x40d026[_0x83c9('0x1b')],'include':_0x40d026['include']?_[_0x83c9('0x1e')](_0x40d026[_0x83c9('0x1d')],function(_0x52d1bd){return{'model':db[_0x52d1bd[_0x83c9('0x1f')]],'as':_0x52d1bd['as'],'attributes':_0x52d1bd[_0x83c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x83c9('0xb')](function(_0x939161){logger[_0x83c9('0xc')](_0x83c9('0x16'),_0x21a574);logger['debug'](_0x83c9('0x16'),_0x21a574,JSON[_0x83c9('0x11')](_0x939161));_0x24cecf(_0x939161);})[_0x83c9('0x20')](function(_0x1da48d){logger['error']('GetDeskAccount',_0x1da48d[_0x83c9('0x14')],_0x21a574);_0xe58b23(_0x7a9f8d[_0x83c9('0x12')](0x1f4,_0x1da48d[_0x83c9('0x14')]));});});};exports['ShowDeskAccount']=function(_0x18d8e4){var _0x165c7c=this;return new Promise(function(_0x3d68c3,_0x5394e3){return db['DeskAccount']['find']({'raw':_0x18d8e4['options']?_0x18d8e4['options'][_0x83c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x18d8e4['options']?_0x18d8e4['options'][_0x83c9('0x21')]||null:null,'attributes':_0x18d8e4['options']?_0x18d8e4[_0x83c9('0x19')][_0x83c9('0x1b')]||null:null,'include':_0x18d8e4[_0x83c9('0x19')]?_0x18d8e4[_0x83c9('0x19')]['include']?_[_0x83c9('0x1e')](_0x18d8e4[_0x83c9('0x19')][_0x83c9('0x1d')],function(_0x2a4c45){return{'model':db[_0x2a4c45[_0x83c9('0x1f')]],'as':_0x2a4c45['as'],'attributes':_0x2a4c45[_0x83c9('0x1b')],'include':_0x2a4c45['include']?_[_0x83c9('0x1e')](_0x2a4c45[_0x83c9('0x1d')],function(_0x10e020){return{'model':db[_0x10e020[_0x83c9('0x1f')]],'as':_0x10e020['as'],'attributes':_0x10e020['attributes'],'include':_0x10e020[_0x83c9('0x1d')]?_[_0x83c9('0x1e')](_0x10e020[_0x83c9('0x1d')],function(_0x844b52){return{'model':db[_0x844b52[_0x83c9('0x1f')]],'as':_0x844b52['as'],'attributes':_0x844b52[_0x83c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4290f4){logger['info'](_0x83c9('0x22'),_0x18d8e4);logger['debug'](_0x83c9('0x22'),_0x18d8e4,JSON[_0x83c9('0x11')](_0x4290f4));_0x3d68c3(_0x4290f4);})['catch'](function(_0x960b88){logger[_0x83c9('0x12')](_0x83c9('0x22'),_0x960b88['message'],_0x18d8e4);_0x5394e3(_0x165c7c['error'](0x1f4,_0x960b88[_0x83c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2be805d..105cdbb 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd35c1b,_0x475106){var _0x519fc0=function(_0x374179){while(--_0x374179){_0xd35c1b['push'](_0xd35c1b['shift']());}};_0x519fc0(++_0x475106);}(_0x34e8,0x12c));var _0x834e=function(_0x2f078d,_0x170d9a){_0x2f078d=_0x2f078d-0x0;var _0x14af6c=_0x34e8[_0x2f078d];return _0x14af6c;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 17e909a..6f64231 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 _0x381a=['exports','STRING','sequelize'];(function(_0x17791f,_0x1d16d8){var _0x332dc4=function(_0x32873b){while(--_0x32873b){_0x17791f['push'](_0x17791f['shift']());}};_0x332dc4(++_0x1d16d8);}(_0x381a,0x122));var _0xa381=function(_0x4e814f,_0x212439){_0x4e814f=_0x4e814f-0x0;var _0x4f40de=_0x381a[_0x4e814f];return _0x4f40de;};'use strict';var Sequelize=require(_0xa381('0x0'));module[_0xa381('0x1')]={'name':{'type':Sequelize[_0xa381('0x2')]},'description':{'type':Sequelize[_0xa381('0x2')]}}; \ No newline at end of file +var _0xefc4=['exports','STRING'];(function(_0x288583,_0x40e5ef){var _0x86dec2=function(_0x9488dc){while(--_0x9488dc){_0x288583['push'](_0x288583['shift']());}};_0x86dec2(++_0x40e5ef);}(_0xefc4,0x1b2));var _0x4efc=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xefc4[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require('sequelize');module[_0x4efc('0x0')]={'name':{'type':Sequelize[_0x4efc('0x1')]},'description':{'type':Sequelize[_0x4efc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c1e56be..d32033d 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 _0x3d67=['../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','save','update','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','merge','find','create','body','params','getFields','DeskField','nolimit','getSubjects','findOne','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0x414658,_0x32591f){var _0x3f33b8=function(_0x1ce3f3){while(--_0x1ce3f3){_0x414658['push'](_0x414658['shift']());}};_0x3f33b8(++_0x32591f);}(_0x3d67,0xe7));var _0x73d6=function(_0x3d4ea9,_0x3bded6){_0x3d4ea9=_0x3d4ea9-0x0;var _0x29b6c3=_0x3d67[_0x3d4ea9];return _0x29b6c3;};'use strict';var emlformat=require(_0x73d6('0x0'));var rimraf=require(_0x73d6('0x1'));var zipdir=require(_0x73d6('0x2'));var jsonpatch=require(_0x73d6('0x3'));var rp=require(_0x73d6('0x4'));var moment=require(_0x73d6('0x5'));var BPromise=require(_0x73d6('0x6'));var Mustache=require('mustache');var util=require(_0x73d6('0x7'));var path=require(_0x73d6('0x8'));var sox=require(_0x73d6('0x9'));var csv=require(_0x73d6('0xa'));var ejs=require(_0x73d6('0xb'));var fs=require('fs');var fs_extra=require(_0x73d6('0xc'));var _=require('lodash');var squel=require(_0x73d6('0xd'));var crypto=require(_0x73d6('0xe'));var jsforce=require(_0x73d6('0xf'));var deskjs=require(_0x73d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x73d6('0x11'));var Papa=require(_0x73d6('0x12'));var Redis=require(_0x73d6('0x13'));var authService=require(_0x73d6('0x14'));var qs=require(_0x73d6('0x15'));var as=require(_0x73d6('0x16'));var hardwareService=require(_0x73d6('0x17'));var logger=require(_0x73d6('0x18'))(_0x73d6('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73d6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c376,_0x1c44ac){_0x1c44ac=_0x1c44ac||0xcc;return function(_0x3e1387){if(_0x3e1387){return _0x19c376[_0x73d6('0x1b')](_0x1c44ac);}return _0x19c376['status'](_0x1c44ac)[_0x73d6('0x1c')]();};}function respondWithResult(_0x585697,_0xe00941){_0xe00941=_0xe00941||0xc8;return function(_0x7baaa4){if(_0x7baaa4){return _0x585697[_0x73d6('0x1d')](_0xe00941)[_0x73d6('0x1e')](_0x7baaa4);}};}function respondWithFilteredResult(_0x1cba31,_0x130b5f){return function(_0x92ee57){if(_0x92ee57){var _0x4cd924=typeof _0x130b5f[_0x73d6('0x1f')]===_0x73d6('0x20')&&typeof _0x130b5f[_0x73d6('0x21')]===_0x73d6('0x20');var _0x565055=_0x92ee57[_0x73d6('0x22')];var _0x9c8f10=_0x4cd924?0x0:_0x130b5f[_0x73d6('0x1f')];var _0x29ee01=_0x4cd924?_0x92ee57[_0x73d6('0x22')]:_0x130b5f[_0x73d6('0x1f')]+_0x130b5f[_0x73d6('0x21')];var _0x4fec36;if(_0x29ee01>=_0x565055){_0x29ee01=_0x565055;_0x4fec36=0xc8;}else{_0x4fec36=0xce;}_0x1cba31[_0x73d6('0x1d')](_0x4fec36);return _0x1cba31['set']('Content-Range',_0x9c8f10+'-'+_0x29ee01+'/'+_0x565055)['json'](_0x92ee57);}return null;};}function patchUpdates(_0x1f81de){return function(_0x31466a){try{jsonpatch['apply'](_0x31466a,_0x1f81de,!![]);}catch(_0x51c678){return BPromise['reject'](_0x51c678);}return _0x31466a[_0x73d6('0x23')]();};}function saveUpdates(_0x27bfb9,_0x6d2d0b){return function(_0x4fd420){if(_0x4fd420){return _0x4fd420[_0x73d6('0x24')](_0x27bfb9)[_0x73d6('0x25')](function(_0x3b1231){return _0x3b1231;});}return null;};}function removeEntity(_0x29957b,_0x4c511a){return function(_0x501dce){if(_0x501dce){return _0x501dce['destroy']()[_0x73d6('0x25')](function(){_0x29957b[_0x73d6('0x1d')](0xcc)[_0x73d6('0x1c')]();});}};}function handleEntityNotFound(_0x355312,_0x29a7b2){return function(_0xdbab00){if(!_0xdbab00){_0x355312[_0x73d6('0x1b')](0x194);}return _0xdbab00;};}function handleError(_0x42403d,_0x593b61){_0x593b61=_0x593b61||0x1f4;return function(_0x5c6340){logger[_0x73d6('0x26')](_0x5c6340[_0x73d6('0x27')]);if(_0x5c6340[_0x73d6('0x28')]){delete _0x5c6340[_0x73d6('0x28')];}_0x42403d[_0x73d6('0x1d')](_0x593b61)[_0x73d6('0x29')](_0x5c6340);};}exports[_0x73d6('0x2a')]=function(_0x4a4ee2,_0x2a5ef2){var _0x442266={},_0x45f770={},_0x3ab88a={'count':0x0,'rows':[]};var _0xcf612f=_[_0x73d6('0x2b')](db[_0x73d6('0x2c')][_0x73d6('0x2d')],function(_0x5a68a6){return{'name':_0x5a68a6['fieldName'],'type':_0x5a68a6[_0x73d6('0x2e')][_0x73d6('0x2f')]};});_0x45f770[_0x73d6('0x30')]=_[_0x73d6('0x2b')](_0xcf612f,_0x73d6('0x28'));_0x45f770[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x4a4ee2[_0x73d6('0x31')]);_0x45f770[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x45f770[_0x73d6('0x30')],_0x45f770[_0x73d6('0x31')]);_0x442266['attributes']=_[_0x73d6('0x34')](_0x45f770['model'],qs[_0x73d6('0x35')](_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x35')]));_0x442266[_0x73d6('0x36')]=_0x442266[_0x73d6('0x36')][_0x73d6('0x37')]?_0x442266[_0x73d6('0x36')]:_0x45f770['model'];if(!_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x38')]('nolimit')){_0x442266[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0x4a4ee2[_0x73d6('0x31')]['limit']);_0x442266['offset']=qs[_0x73d6('0x1f')](_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x1f')]);}_0x442266['order']=qs[_0x73d6('0x39')](_0x4a4ee2['query'][_0x73d6('0x39')]);_0x442266[_0x73d6('0x3a')]=qs['filters'](_[_0x73d6('0x3b')](_0x4a4ee2[_0x73d6('0x31')],_0x45f770['filters']),_0xcf612f);if(_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x442266[_0x73d6('0x3a')]=_['merge'](_0x442266[_0x73d6('0x3a')],{'$or':_['map'](_0xcf612f,function(_0x2acc61){if(_0x2acc61['type']!==_0x73d6('0x3d')){var _0x1345b7={};_0x1345b7[_0x2acc61['name']]={'$like':'%'+_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x1345b7;}})});}_0x442266=_['merge']({},_0x442266,_0x4a4ee2[_0x73d6('0x3e')]);var _0x4495db={'where':_0x442266['where']};return db[_0x73d6('0x2c')][_0x73d6('0x22')](_0x4495db)[_0x73d6('0x25')](function(_0xc6ddb8){_0x3ab88a[_0x73d6('0x22')]=_0xc6ddb8;if(_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3f')]){_0x442266['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x73d6('0x40')](_0x442266);})['then'](function(_0x484e7e){_0x3ab88a[_0x73d6('0x41')]=_0x484e7e;return _0x3ab88a;})['then'](respondWithFilteredResult(_0x2a5ef2,_0x442266))[_0x73d6('0x42')](handleError(_0x2a5ef2,null));};exports[_0x73d6('0x43')]=function(_0x5f2488,_0x4db0ec){var _0x2003fd={'raw':![],'where':{'id':_0x5f2488['params']['id']}},_0x5b5339={};_0x5b5339[_0x73d6('0x30')]=_['keys'](db[_0x73d6('0x2c')][_0x73d6('0x2d')]);_0x5b5339[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x5f2488[_0x73d6('0x31')]);_0x5b5339[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x5b5339[_0x73d6('0x30')],_0x5b5339[_0x73d6('0x31')]);_0x2003fd[_0x73d6('0x36')]=_['intersection'](_0x5b5339[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x5f2488[_0x73d6('0x31')][_0x73d6('0x35')]));_0x2003fd['attributes']=_0x2003fd['attributes'][_0x73d6('0x37')]?_0x2003fd[_0x73d6('0x36')]:_0x5b5339[_0x73d6('0x30')];if(_0x5f2488[_0x73d6('0x31')][_0x73d6('0x3f')]){_0x2003fd[_0x73d6('0x44')]=[{'all':!![]}];}_0x2003fd=_[_0x73d6('0x45')]({},_0x2003fd,_0x5f2488['options']);return db[_0x73d6('0x2c')][_0x73d6('0x46')](_0x2003fd)[_0x73d6('0x25')](handleEntityNotFound(_0x4db0ec,null))[_0x73d6('0x25')](respondWithResult(_0x4db0ec,null))[_0x73d6('0x42')](handleError(_0x4db0ec,null));};exports['create']=function(_0x34b008,_0x3caa9e){return db[_0x73d6('0x2c')][_0x73d6('0x47')](_0x34b008['body'],{})[_0x73d6('0x25')](respondWithResult(_0x3caa9e,0xc9))['catch'](handleError(_0x3caa9e,null));};exports[_0x73d6('0x24')]=function(_0x3759e4,_0x49670b){if(_0x3759e4[_0x73d6('0x48')]['id']){delete _0x3759e4[_0x73d6('0x48')]['id'];}return db['DeskConfiguration'][_0x73d6('0x46')]({'where':{'id':_0x3759e4[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x49670b,null))[_0x73d6('0x25')](saveUpdates(_0x3759e4[_0x73d6('0x48')],null))['then'](respondWithResult(_0x49670b,null))[_0x73d6('0x42')](handleError(_0x49670b,null));};exports['destroy']=function(_0x5545f0,_0x203450){return db[_0x73d6('0x2c')][_0x73d6('0x46')]({'where':{'id':_0x5545f0[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x203450,null))[_0x73d6('0x25')](removeEntity(_0x203450,null))[_0x73d6('0x42')](handleError(_0x203450,null));};exports[_0x73d6('0x4a')]=function(_0xd1a713,_0xc52f8,_0x34fdc5){var _0x41e130={};var _0x2c5c76={};var _0x514e54;var _0xe7d27;return db['DeskConfiguration']['findOne']({'where':{'id':_0xd1a713[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0xc52f8,null))[_0x73d6('0x25')](function(_0x1d64f5){if(_0x1d64f5){_0x514e54=_0x1d64f5;_0x2c5c76[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x2c5c76[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0xd1a713[_0x73d6('0x31')]);_0x2c5c76[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x2c5c76[_0x73d6('0x30')],_0x2c5c76[_0x73d6('0x31')]);_0x41e130[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x2c5c76[_0x73d6('0x30')],qs['fields'](_0xd1a713['query'][_0x73d6('0x35')]));_0x41e130[_0x73d6('0x36')]=_0x41e130['attributes'][_0x73d6('0x37')]?_0x41e130[_0x73d6('0x36')]:_0x2c5c76[_0x73d6('0x30')];_0x41e130['order']=qs[_0x73d6('0x39')](_0xd1a713[_0x73d6('0x31')][_0x73d6('0x39')]);_0x41e130[_0x73d6('0x3a')]=qs[_0x73d6('0x33')](_['pick'](_0xd1a713['query'],_0x2c5c76['filters']));if(_0xd1a713[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x41e130[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x41e130[_0x73d6('0x3a')],{'$or':_['map'](_0x41e130[_0x73d6('0x36')],function(_0x3745b6){var _0x2f4a12={};_0x2f4a12[_0x3745b6]={'$like':'%'+_0xd1a713[_0x73d6('0x31')]['filter']+'%'};return _0x2f4a12;})});}_0x41e130=_[_0x73d6('0x45')]({},_0x41e130,_0xd1a713[_0x73d6('0x3e')]);return _0x514e54[_0x73d6('0x4a')](_0x41e130);}})[_0x73d6('0x25')](function(_0x36718b){if(_0x36718b){_0xe7d27=_0x36718b[_0x73d6('0x37')];if(!_0xd1a713[_0x73d6('0x31')]['hasOwnProperty'](_0x73d6('0x4c'))){_0x41e130[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0xd1a713[_0x73d6('0x31')]['limit']);_0x41e130[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0xd1a713[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x514e54[_0x73d6('0x4a')](_0x41e130);}})[_0x73d6('0x25')](function(_0x41d338){if(_0x41d338){return _0x41d338?{'count':_0xe7d27,'rows':_0x41d338}:null;}})[_0x73d6('0x25')](respondWithResult(_0xc52f8,null))[_0x73d6('0x42')](handleError(_0xc52f8,null));};exports[_0x73d6('0x4d')]=function(_0x3cf40a,_0x4b7fa9,_0x31933d){var _0x431447={};var _0x25522d={};var _0x14946c;var _0x33d69c;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x3cf40a['params']['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x4b7fa9,null))[_0x73d6('0x25')](function(_0x4b1c89){if(_0x4b1c89){_0x14946c=_0x4b1c89;_0x25522d[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x25522d[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x3cf40a[_0x73d6('0x31')]);_0x25522d['filters']=_[_0x73d6('0x34')](_0x25522d['model'],_0x25522d['query']);_0x431447[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x25522d[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x35')]));_0x431447[_0x73d6('0x36')]=_0x431447['attributes'][_0x73d6('0x37')]?_0x431447['attributes']:_0x25522d[_0x73d6('0x30')];_0x431447[_0x73d6('0x4f')]=qs['sort'](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x39')]);_0x431447[_0x73d6('0x3a')]=qs[_0x73d6('0x33')](_[_0x73d6('0x3b')](_0x3cf40a['query'],_0x25522d[_0x73d6('0x33')]));if(_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x431447[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x431447[_0x73d6('0x3a')],{'$or':_[_0x73d6('0x2b')](_0x431447[_0x73d6('0x36')],function(_0x1ac837){var _0x238454={};_0x238454[_0x1ac837]={'$like':'%'+_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x238454;})});}_0x431447=_['merge']({},_0x431447,_0x3cf40a['options']);return _0x14946c[_0x73d6('0x4d')](_0x431447);}})[_0x73d6('0x25')](function(_0x4f4a92){if(_0x4f4a92){_0x33d69c=_0x4f4a92[_0x73d6('0x37')];if(!_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x431447[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x21')]);_0x431447[_0x73d6('0x1f')]=qs['offset'](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x14946c[_0x73d6('0x4d')](_0x431447);}})['then'](function(_0x5a66c6){if(_0x5a66c6){return _0x5a66c6?{'count':_0x33d69c,'rows':_0x5a66c6}:null;}})[_0x73d6('0x25')](respondWithResult(_0x4b7fa9,null))['catch'](handleError(_0x4b7fa9,null));};exports['getDescriptions']=function(_0x275212,_0x31c060,_0x5aba49){var _0x41a7d7={};var _0x46ef2d={};var _0x37e5b4;var _0x3dc7fb;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x275212[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x31c060,null))[_0x73d6('0x25')](function(_0x19d9fa){if(_0x19d9fa){_0x37e5b4=_0x19d9fa;_0x46ef2d[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x46ef2d[_0x73d6('0x31')]=_['keys'](_0x275212[_0x73d6('0x31')]);_0x46ef2d[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x46ef2d['model'],_0x46ef2d['query']);_0x41a7d7[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x46ef2d[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x275212[_0x73d6('0x31')][_0x73d6('0x35')]));_0x41a7d7[_0x73d6('0x36')]=_0x41a7d7[_0x73d6('0x36')][_0x73d6('0x37')]?_0x41a7d7[_0x73d6('0x36')]:_0x46ef2d[_0x73d6('0x30')];_0x41a7d7[_0x73d6('0x4f')]=qs[_0x73d6('0x39')](_0x275212[_0x73d6('0x31')][_0x73d6('0x39')]);_0x41a7d7[_0x73d6('0x3a')]=qs['filters'](_[_0x73d6('0x3b')](_0x275212[_0x73d6('0x31')],_0x46ef2d['filters']));if(_0x275212['query']['filter']){_0x41a7d7[_0x73d6('0x3a')]=_['merge'](_0x41a7d7[_0x73d6('0x3a')],{'$or':_[_0x73d6('0x2b')](_0x41a7d7['attributes'],function(_0x38f1d6){var _0x990c4c={};_0x990c4c[_0x38f1d6]={'$like':'%'+_0x275212[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x990c4c;})});}_0x41a7d7=_['merge']({},_0x41a7d7,_0x275212[_0x73d6('0x3e')]);return _0x37e5b4[_0x73d6('0x50')](_0x41a7d7);}})['then'](function(_0x57d754){if(_0x57d754){_0x3dc7fb=_0x57d754[_0x73d6('0x37')];if(!_0x275212[_0x73d6('0x31')][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x41a7d7['limit']=qs[_0x73d6('0x21')](_0x275212[_0x73d6('0x31')][_0x73d6('0x21')]);_0x41a7d7[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0x275212[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x37e5b4[_0x73d6('0x50')](_0x41a7d7);}})['then'](function(_0x1a5db6){if(_0x1a5db6){return _0x1a5db6?{'count':_0x3dc7fb,'rows':_0x1a5db6}:null;}})[_0x73d6('0x25')](respondWithResult(_0x31c060,null))['catch'](handleError(_0x31c060,null));};exports['getTags']=function(_0x26865,_0x2a151b,_0x46a5b2){var _0x1964ee={};var _0x26df96={};var _0x40942f;var _0x3619a7;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x26865[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x2a151b,null))[_0x73d6('0x25')](function(_0x332630){if(_0x332630){_0x40942f=_0x332630;_0x26df96['model']=_['keys'](db[_0x73d6('0x51')][_0x73d6('0x2d')]);_0x26df96[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x26865[_0x73d6('0x31')]);_0x26df96[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x26df96[_0x73d6('0x30')],_0x26df96['query']);_0x1964ee[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x26df96[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x26865['query']['fields']));_0x1964ee['attributes']=_0x1964ee[_0x73d6('0x36')][_0x73d6('0x37')]?_0x1964ee[_0x73d6('0x36')]:_0x26df96[_0x73d6('0x30')];_0x1964ee[_0x73d6('0x4f')]=qs[_0x73d6('0x39')](_0x26865[_0x73d6('0x31')][_0x73d6('0x39')]);_0x1964ee['where']=qs[_0x73d6('0x33')](_[_0x73d6('0x3b')](_0x26865['query'],_0x26df96['filters']));if(_0x26865[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x1964ee[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x1964ee[_0x73d6('0x3a')],{'$or':_['map'](_0x1964ee['attributes'],function(_0x159f4a){var _0x478b2f={};_0x478b2f[_0x159f4a]={'$like':'%'+_0x26865[_0x73d6('0x31')]['filter']+'%'};return _0x478b2f;})});}_0x1964ee=_[_0x73d6('0x45')]({},_0x1964ee,_0x26865[_0x73d6('0x3e')]);return _0x40942f[_0x73d6('0x52')](_0x1964ee);}})['then'](function(_0x496fb1){if(_0x496fb1){_0x3619a7=_0x496fb1[_0x73d6('0x37')];if(!_0x26865['query'][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x1964ee['limit']=qs[_0x73d6('0x21')](_0x26865[_0x73d6('0x31')]['limit']);_0x1964ee[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0x26865[_0x73d6('0x31')]['offset']);}return _0x40942f[_0x73d6('0x52')](_0x1964ee);}})[_0x73d6('0x25')](function(_0x54c2ba){if(_0x54c2ba){return _0x54c2ba?{'count':_0x3619a7,'rows':_0x54c2ba}:null;}})['then'](respondWithResult(_0x2a151b,null))[_0x73d6('0x42')](handleError(_0x2a151b,null));};exports['setTags']=function(_0x48151e,_0x50eecb,_0x3337a5){if(_0x48151e[_0x73d6('0x48')]['id']){delete _0x48151e[_0x73d6('0x48')]['id'];}return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x48151e[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x50eecb,null))[_0x73d6('0x25')](function(_0x3ec604){if(_0x3ec604){return _0x3ec604[_0x73d6('0x53')](_0x48151e[_0x73d6('0x48')][_0x73d6('0x54')]||[]);}return null;})['then'](respondWithResult(_0x50eecb,null))[_0x73d6('0x42')](handleError(_0x50eecb,null));}; \ No newline at end of file +var _0x21a7=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','findOne','getFields','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x21a7,0x1db));var _0x721a=function(_0x24a136,_0x2c3bf1){_0x24a136=_0x24a136-0x0;var _0x2f58ba=_0x21a7[_0x24a136];return _0x2f58ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x721a('0x0'));var zipdir=require(_0x721a('0x1'));var jsonpatch=require(_0x721a('0x2'));var rp=require('request-promise');var moment=require(_0x721a('0x3'));var BPromise=require(_0x721a('0x4'));var Mustache=require(_0x721a('0x5'));var util=require(_0x721a('0x6'));var path=require('path');var sox=require(_0x721a('0x7'));var csv=require(_0x721a('0x8'));var ejs=require(_0x721a('0x9'));var fs=require('fs');var fs_extra=require(_0x721a('0xa'));var _=require('lodash');var squel=require(_0x721a('0xb'));var crypto=require('crypto');var jsforce=require(_0x721a('0xc'));var deskjs=require(_0x721a('0xd'));var toCsv=require(_0x721a('0x8'));var querystring=require(_0x721a('0xe'));var Papa=require(_0x721a('0xf'));var Redis=require('ioredis');var authService=require(_0x721a('0x10'));var qs=require(_0x721a('0x11'));var as=require(_0x721a('0x12'));var hardwareService=require(_0x721a('0x13'));var logger=require(_0x721a('0x14'))(_0x721a('0x15'));var utils=require(_0x721a('0x16'));var config=require(_0x721a('0x17'));var licenseUtil=require(_0x721a('0x18'));var db=require(_0x721a('0x19'))['db'];function respondWithStatusCode(_0xe6f43f,_0x43c057){_0x43c057=_0x43c057||0xcc;return function(_0x35fe6a){if(_0x35fe6a){return _0xe6f43f[_0x721a('0x1a')](_0x43c057);}return _0xe6f43f[_0x721a('0x1b')](_0x43c057)[_0x721a('0x1c')]();};}function respondWithResult(_0x22dbae,_0xfa7af0){_0xfa7af0=_0xfa7af0||0xc8;return function(_0x508080){if(_0x508080){return _0x22dbae['status'](_0xfa7af0)[_0x721a('0x1d')](_0x508080);}};}function respondWithFilteredResult(_0x1d632a,_0xd7fb28){return function(_0x332c24){if(_0x332c24){var _0x834825=typeof _0xd7fb28['offset']==='undefined'&&typeof _0xd7fb28[_0x721a('0x1e')]==='undefined';var _0x4df5dc=_0x332c24[_0x721a('0x1f')];var _0x3e19fb=_0x834825?0x0:_0xd7fb28[_0x721a('0x20')];var _0x3bb1b6=_0x834825?_0x332c24[_0x721a('0x1f')]:_0xd7fb28[_0x721a('0x20')]+_0xd7fb28[_0x721a('0x1e')];var _0x3928e4;if(_0x3bb1b6>=_0x4df5dc){_0x3bb1b6=_0x4df5dc;_0x3928e4=0xc8;}else{_0x3928e4=0xce;}_0x1d632a['status'](_0x3928e4);return _0x1d632a[_0x721a('0x21')](_0x721a('0x22'),_0x3e19fb+'-'+_0x3bb1b6+'/'+_0x4df5dc)[_0x721a('0x1d')](_0x332c24);}return null;};}function patchUpdates(_0x5ae571){return function(_0x3f48ac){try{jsonpatch[_0x721a('0x23')](_0x3f48ac,_0x5ae571,!![]);}catch(_0x44f17e){return BPromise['reject'](_0x44f17e);}return _0x3f48ac[_0x721a('0x24')]();};}function saveUpdates(_0x55e1e5,_0x3977fa){return function(_0x75d0aa){if(_0x75d0aa){return _0x75d0aa[_0x721a('0x25')](_0x55e1e5)[_0x721a('0x26')](function(_0x273a5a){return _0x273a5a;});}return null;};}function removeEntity(_0x259ff7,_0x1e7af5){return function(_0xbdfa4){if(_0xbdfa4){return _0xbdfa4['destroy']()[_0x721a('0x26')](function(){_0x259ff7['status'](0xcc)[_0x721a('0x1c')]();});}};}function handleEntityNotFound(_0xe29adc,_0x3a58df){return function(_0xb50c70){if(!_0xb50c70){_0xe29adc['sendStatus'](0x194);}return _0xb50c70;};}function handleError(_0x323e16,_0x364049){_0x364049=_0x364049||0x1f4;return function(_0x27be1f){logger[_0x721a('0x27')](_0x27be1f[_0x721a('0x28')]);if(_0x27be1f['name']){delete _0x27be1f[_0x721a('0x29')];}_0x323e16[_0x721a('0x1b')](_0x364049)[_0x721a('0x2a')](_0x27be1f);};}exports[_0x721a('0x2b')]=function(_0x11625e,_0x394883){var _0x4649ac={},_0x28dee8={},_0xb9952f={'count':0x0,'rows':[]};var _0x53305c=_[_0x721a('0x2c')](db['DeskConfiguration'][_0x721a('0x2d')],function(_0x293b51){return{'name':_0x293b51[_0x721a('0x2e')],'type':_0x293b51[_0x721a('0x2f')][_0x721a('0x30')]};});_0x28dee8['model']=_[_0x721a('0x2c')](_0x53305c,_0x721a('0x29'));_0x28dee8[_0x721a('0x31')]=_[_0x721a('0x32')](_0x11625e['query']);_0x28dee8[_0x721a('0x33')]=_[_0x721a('0x34')](_0x28dee8[_0x721a('0x35')],_0x28dee8[_0x721a('0x31')]);_0x4649ac[_0x721a('0x36')]=_[_0x721a('0x34')](_0x28dee8['model'],qs[_0x721a('0x37')](_0x11625e[_0x721a('0x31')]['fields']));_0x4649ac['attributes']=_0x4649ac['attributes'][_0x721a('0x38')]?_0x4649ac['attributes']:_0x28dee8[_0x721a('0x35')];if(!_0x11625e[_0x721a('0x31')][_0x721a('0x39')](_0x721a('0x3a'))){_0x4649ac[_0x721a('0x1e')]=qs[_0x721a('0x1e')](_0x11625e[_0x721a('0x31')][_0x721a('0x1e')]);_0x4649ac[_0x721a('0x20')]=qs[_0x721a('0x20')](_0x11625e[_0x721a('0x31')]['offset']);}_0x4649ac[_0x721a('0x3b')]=qs['sort'](_0x11625e[_0x721a('0x31')][_0x721a('0x3c')]);_0x4649ac[_0x721a('0x3d')]=qs[_0x721a('0x33')](_[_0x721a('0x3e')](_0x11625e['query'],_0x28dee8[_0x721a('0x33')]),_0x53305c);if(_0x11625e[_0x721a('0x31')][_0x721a('0x3f')]){_0x4649ac[_0x721a('0x3d')]=_[_0x721a('0x40')](_0x4649ac['where'],{'$or':_['map'](_0x53305c,function(_0x3217d1){if(_0x3217d1['type']!=='VIRTUAL'){var _0x55f869={};_0x55f869[_0x3217d1[_0x721a('0x29')]]={'$like':'%'+_0x11625e[_0x721a('0x31')][_0x721a('0x3f')]+'%'};return _0x55f869;}})});}_0x4649ac=_[_0x721a('0x40')]({},_0x4649ac,_0x11625e[_0x721a('0x41')]);var _0x25e055={'where':_0x4649ac[_0x721a('0x3d')]};return db[_0x721a('0x42')][_0x721a('0x1f')](_0x25e055)[_0x721a('0x26')](function(_0x30e3e6){_0xb9952f['count']=_0x30e3e6;if(_0x11625e['query'][_0x721a('0x43')]){_0x4649ac[_0x721a('0x44')]=[{'all':!![]}];}return db[_0x721a('0x42')][_0x721a('0x45')](_0x4649ac);})[_0x721a('0x26')](function(_0x11bdf4){_0xb9952f[_0x721a('0x46')]=_0x11bdf4;return _0xb9952f;})['then'](respondWithFilteredResult(_0x394883,_0x4649ac))[_0x721a('0x47')](handleError(_0x394883,null));};exports[_0x721a('0x48')]=function(_0x56e233,_0x17f5bf){var _0x3c1d8d={'raw':![],'where':{'id':_0x56e233['params']['id']}},_0xe51704={};_0xe51704[_0x721a('0x35')]=_['keys'](db[_0x721a('0x42')][_0x721a('0x2d')]);_0xe51704[_0x721a('0x31')]=_[_0x721a('0x32')](_0x56e233['query']);_0xe51704[_0x721a('0x33')]=_['intersection'](_0xe51704[_0x721a('0x35')],_0xe51704['query']);_0x3c1d8d[_0x721a('0x36')]=_['intersection'](_0xe51704[_0x721a('0x35')],qs['fields'](_0x56e233['query'][_0x721a('0x37')]));_0x3c1d8d[_0x721a('0x36')]=_0x3c1d8d[_0x721a('0x36')][_0x721a('0x38')]?_0x3c1d8d[_0x721a('0x36')]:_0xe51704['model'];if(_0x56e233[_0x721a('0x31')]['includeAll']){_0x3c1d8d[_0x721a('0x44')]=[{'all':!![]}];}_0x3c1d8d=_[_0x721a('0x40')]({},_0x3c1d8d,_0x56e233[_0x721a('0x41')]);return db[_0x721a('0x42')][_0x721a('0x49')](_0x3c1d8d)['then'](handleEntityNotFound(_0x17f5bf,null))[_0x721a('0x26')](respondWithResult(_0x17f5bf,null))['catch'](handleError(_0x17f5bf,null));};exports[_0x721a('0x4a')]=function(_0x6b5821,_0x2fd7c4){return db[_0x721a('0x42')][_0x721a('0x4a')](_0x6b5821['body'],{})['then'](respondWithResult(_0x2fd7c4,0xc9))[_0x721a('0x47')](handleError(_0x2fd7c4,null));};exports[_0x721a('0x25')]=function(_0x36406a,_0x6d3669){if(_0x36406a[_0x721a('0x4b')]['id']){delete _0x36406a[_0x721a('0x4b')]['id'];}return db[_0x721a('0x42')][_0x721a('0x49')]({'where':{'id':_0x36406a[_0x721a('0x4c')]['id']}})[_0x721a('0x26')](handleEntityNotFound(_0x6d3669,null))[_0x721a('0x26')](saveUpdates(_0x36406a[_0x721a('0x4b')],null))[_0x721a('0x26')](respondWithResult(_0x6d3669,null))[_0x721a('0x47')](handleError(_0x6d3669,null));};exports[_0x721a('0x4d')]=function(_0xa5589d,_0x229472){return db[_0x721a('0x42')][_0x721a('0x49')]({'where':{'id':_0xa5589d[_0x721a('0x4c')]['id']}})[_0x721a('0x26')](handleEntityNotFound(_0x229472,null))[_0x721a('0x26')](removeEntity(_0x229472,null))['catch'](handleError(_0x229472,null));};exports['getFields']=function(_0x46ff8b,_0x34c51d,_0x1c5521){var _0x2e63b2={};var _0x276e36={};var _0x3a043b;var _0x54ae9f;return db[_0x721a('0x42')][_0x721a('0x4e')]({'where':{'id':_0x46ff8b[_0x721a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34c51d,null))[_0x721a('0x26')](function(_0x2688ee){if(_0x2688ee){_0x3a043b=_0x2688ee;_0x276e36[_0x721a('0x35')]=_[_0x721a('0x32')](db['DeskField'][_0x721a('0x2d')]);_0x276e36[_0x721a('0x31')]=_['keys'](_0x46ff8b[_0x721a('0x31')]);_0x276e36['filters']=_[_0x721a('0x34')](_0x276e36[_0x721a('0x35')],_0x276e36[_0x721a('0x31')]);_0x2e63b2[_0x721a('0x36')]=_['intersection'](_0x276e36['model'],qs[_0x721a('0x37')](_0x46ff8b[_0x721a('0x31')][_0x721a('0x37')]));_0x2e63b2[_0x721a('0x36')]=_0x2e63b2['attributes'][_0x721a('0x38')]?_0x2e63b2[_0x721a('0x36')]:_0x276e36['model'];_0x2e63b2[_0x721a('0x3b')]=qs['sort'](_0x46ff8b[_0x721a('0x31')][_0x721a('0x3c')]);_0x2e63b2['where']=qs[_0x721a('0x33')](_['pick'](_0x46ff8b[_0x721a('0x31')],_0x276e36[_0x721a('0x33')]));if(_0x46ff8b[_0x721a('0x31')]['filter']){_0x2e63b2[_0x721a('0x3d')]=_[_0x721a('0x40')](_0x2e63b2[_0x721a('0x3d')],{'$or':_[_0x721a('0x2c')](_0x2e63b2[_0x721a('0x36')],function(_0x41979a){var _0x12f01e={};_0x12f01e[_0x41979a]={'$like':'%'+_0x46ff8b[_0x721a('0x31')][_0x721a('0x3f')]+'%'};return _0x12f01e;})});}_0x2e63b2=_[_0x721a('0x40')]({},_0x2e63b2,_0x46ff8b[_0x721a('0x41')]);return _0x3a043b[_0x721a('0x4f')](_0x2e63b2);}})[_0x721a('0x26')](function(_0x1bf180){if(_0x1bf180){_0x54ae9f=_0x1bf180['length'];if(!_0x46ff8b[_0x721a('0x31')][_0x721a('0x39')](_0x721a('0x3a'))){_0x2e63b2[_0x721a('0x1e')]=qs[_0x721a('0x1e')](_0x46ff8b[_0x721a('0x31')][_0x721a('0x1e')]);_0x2e63b2[_0x721a('0x20')]=qs['offset'](_0x46ff8b[_0x721a('0x31')][_0x721a('0x20')]);}return _0x3a043b[_0x721a('0x4f')](_0x2e63b2);}})['then'](function(_0x3324d6){if(_0x3324d6){return _0x3324d6?{'count':_0x54ae9f,'rows':_0x3324d6}:null;}})[_0x721a('0x26')](respondWithResult(_0x34c51d,null))['catch'](handleError(_0x34c51d,null));};exports['getSubjects']=function(_0x464214,_0x248db8,_0x10ac21){var _0x42d42f={};var _0x4c80c6={};var _0x3086fb;var _0x46f573;return db[_0x721a('0x42')][_0x721a('0x4e')]({'where':{'id':_0x464214[_0x721a('0x4c')]['id']}})[_0x721a('0x26')](handleEntityNotFound(_0x248db8,null))[_0x721a('0x26')](function(_0x1ba862){if(_0x1ba862){_0x3086fb=_0x1ba862;_0x4c80c6[_0x721a('0x35')]=_[_0x721a('0x32')](db['DeskField'][_0x721a('0x2d')]);_0x4c80c6[_0x721a('0x31')]=_[_0x721a('0x32')](_0x464214[_0x721a('0x31')]);_0x4c80c6[_0x721a('0x33')]=_[_0x721a('0x34')](_0x4c80c6[_0x721a('0x35')],_0x4c80c6[_0x721a('0x31')]);_0x42d42f[_0x721a('0x36')]=_[_0x721a('0x34')](_0x4c80c6[_0x721a('0x35')],qs['fields'](_0x464214[_0x721a('0x31')]['fields']));_0x42d42f[_0x721a('0x36')]=_0x42d42f['attributes']['length']?_0x42d42f[_0x721a('0x36')]:_0x4c80c6[_0x721a('0x35')];_0x42d42f[_0x721a('0x3b')]=qs[_0x721a('0x3c')](_0x464214[_0x721a('0x31')][_0x721a('0x3c')]);_0x42d42f[_0x721a('0x3d')]=qs[_0x721a('0x33')](_['pick'](_0x464214['query'],_0x4c80c6[_0x721a('0x33')]));if(_0x464214['query'][_0x721a('0x3f')]){_0x42d42f[_0x721a('0x3d')]=_['merge'](_0x42d42f[_0x721a('0x3d')],{'$or':_['map'](_0x42d42f[_0x721a('0x36')],function(_0x450e08){var _0x1b5710={};_0x1b5710[_0x450e08]={'$like':'%'+_0x464214['query'][_0x721a('0x3f')]+'%'};return _0x1b5710;})});}_0x42d42f=_[_0x721a('0x40')]({},_0x42d42f,_0x464214[_0x721a('0x41')]);return _0x3086fb[_0x721a('0x50')](_0x42d42f);}})['then'](function(_0x462f9a){if(_0x462f9a){_0x46f573=_0x462f9a[_0x721a('0x38')];if(!_0x464214[_0x721a('0x31')][_0x721a('0x39')](_0x721a('0x3a'))){_0x42d42f[_0x721a('0x1e')]=qs[_0x721a('0x1e')](_0x464214['query'][_0x721a('0x1e')]);_0x42d42f['offset']=qs[_0x721a('0x20')](_0x464214[_0x721a('0x31')][_0x721a('0x20')]);}return _0x3086fb[_0x721a('0x50')](_0x42d42f);}})[_0x721a('0x26')](function(_0x4072c8){if(_0x4072c8){return _0x4072c8?{'count':_0x46f573,'rows':_0x4072c8}:null;}})[_0x721a('0x26')](respondWithResult(_0x248db8,null))[_0x721a('0x47')](handleError(_0x248db8,null));};exports[_0x721a('0x51')]=function(_0x43ab66,_0x35b34b,_0xecba65){var _0x3ae2bf={};var _0x45566b={};var _0x3aea97;var _0x391d75;return db[_0x721a('0x42')][_0x721a('0x4e')]({'where':{'id':_0x43ab66[_0x721a('0x4c')]['id']}})[_0x721a('0x26')](handleEntityNotFound(_0x35b34b,null))[_0x721a('0x26')](function(_0x1abe59){if(_0x1abe59){_0x3aea97=_0x1abe59;_0x45566b[_0x721a('0x35')]=_[_0x721a('0x32')](db[_0x721a('0x52')]['rawAttributes']);_0x45566b['query']=_[_0x721a('0x32')](_0x43ab66['query']);_0x45566b[_0x721a('0x33')]=_[_0x721a('0x34')](_0x45566b[_0x721a('0x35')],_0x45566b[_0x721a('0x31')]);_0x3ae2bf['attributes']=_[_0x721a('0x34')](_0x45566b[_0x721a('0x35')],qs[_0x721a('0x37')](_0x43ab66['query']['fields']));_0x3ae2bf[_0x721a('0x36')]=_0x3ae2bf[_0x721a('0x36')][_0x721a('0x38')]?_0x3ae2bf[_0x721a('0x36')]:_0x45566b[_0x721a('0x35')];_0x3ae2bf[_0x721a('0x3b')]=qs[_0x721a('0x3c')](_0x43ab66['query']['sort']);_0x3ae2bf[_0x721a('0x3d')]=qs['filters'](_[_0x721a('0x3e')](_0x43ab66['query'],_0x45566b['filters']));if(_0x43ab66[_0x721a('0x31')][_0x721a('0x3f')]){_0x3ae2bf[_0x721a('0x3d')]=_['merge'](_0x3ae2bf[_0x721a('0x3d')],{'$or':_[_0x721a('0x2c')](_0x3ae2bf['attributes'],function(_0x4b837d){var _0x4ddf7f={};_0x4ddf7f[_0x4b837d]={'$like':'%'+_0x43ab66[_0x721a('0x31')][_0x721a('0x3f')]+'%'};return _0x4ddf7f;})});}_0x3ae2bf=_[_0x721a('0x40')]({},_0x3ae2bf,_0x43ab66[_0x721a('0x41')]);return _0x3aea97[_0x721a('0x51')](_0x3ae2bf);}})[_0x721a('0x26')](function(_0x1d3aeb){if(_0x1d3aeb){_0x391d75=_0x1d3aeb[_0x721a('0x38')];if(!_0x43ab66[_0x721a('0x31')][_0x721a('0x39')](_0x721a('0x3a'))){_0x3ae2bf[_0x721a('0x1e')]=qs[_0x721a('0x1e')](_0x43ab66[_0x721a('0x31')]['limit']);_0x3ae2bf[_0x721a('0x20')]=qs[_0x721a('0x20')](_0x43ab66[_0x721a('0x31')]['offset']);}return _0x3aea97['getDescriptions'](_0x3ae2bf);}})[_0x721a('0x26')](function(_0x1b1c18){if(_0x1b1c18){return _0x1b1c18?{'count':_0x391d75,'rows':_0x1b1c18}:null;}})[_0x721a('0x26')](respondWithResult(_0x35b34b,null))[_0x721a('0x47')](handleError(_0x35b34b,null));};exports[_0x721a('0x53')]=function(_0x58facc,_0xae8e11,_0x2299b4){var _0x56d6bb={};var _0x680baa={};var _0x56f288;var _0x2f4aaf;return db['DeskConfiguration']['findOne']({'where':{'id':_0x58facc[_0x721a('0x4c')]['id']}})['then'](handleEntityNotFound(_0xae8e11,null))['then'](function(_0x4c0d2b){if(_0x4c0d2b){_0x56f288=_0x4c0d2b;_0x680baa[_0x721a('0x35')]=_[_0x721a('0x32')](db[_0x721a('0x54')][_0x721a('0x2d')]);_0x680baa['query']=_[_0x721a('0x32')](_0x58facc[_0x721a('0x31')]);_0x680baa[_0x721a('0x33')]=_['intersection'](_0x680baa['model'],_0x680baa[_0x721a('0x31')]);_0x56d6bb[_0x721a('0x36')]=_['intersection'](_0x680baa['model'],qs['fields'](_0x58facc[_0x721a('0x31')][_0x721a('0x37')]));_0x56d6bb[_0x721a('0x36')]=_0x56d6bb['attributes'][_0x721a('0x38')]?_0x56d6bb[_0x721a('0x36')]:_0x680baa[_0x721a('0x35')];_0x56d6bb[_0x721a('0x3b')]=qs[_0x721a('0x3c')](_0x58facc[_0x721a('0x31')][_0x721a('0x3c')]);_0x56d6bb[_0x721a('0x3d')]=qs['filters'](_[_0x721a('0x3e')](_0x58facc[_0x721a('0x31')],_0x680baa['filters']));if(_0x58facc[_0x721a('0x31')][_0x721a('0x3f')]){_0x56d6bb[_0x721a('0x3d')]=_[_0x721a('0x40')](_0x56d6bb[_0x721a('0x3d')],{'$or':_[_0x721a('0x2c')](_0x56d6bb[_0x721a('0x36')],function(_0x3f85de){var _0x495d90={};_0x495d90[_0x3f85de]={'$like':'%'+_0x58facc[_0x721a('0x31')]['filter']+'%'};return _0x495d90;})});}_0x56d6bb=_[_0x721a('0x40')]({},_0x56d6bb,_0x58facc[_0x721a('0x41')]);return _0x56f288['getTags'](_0x56d6bb);}})[_0x721a('0x26')](function(_0x266b34){if(_0x266b34){_0x2f4aaf=_0x266b34['length'];if(!_0x58facc[_0x721a('0x31')][_0x721a('0x39')](_0x721a('0x3a'))){_0x56d6bb['limit']=qs[_0x721a('0x1e')](_0x58facc[_0x721a('0x31')][_0x721a('0x1e')]);_0x56d6bb['offset']=qs[_0x721a('0x20')](_0x58facc['query']['offset']);}return _0x56f288[_0x721a('0x53')](_0x56d6bb);}})[_0x721a('0x26')](function(_0x448269){if(_0x448269){return _0x448269?{'count':_0x2f4aaf,'rows':_0x448269}:null;}})[_0x721a('0x26')](respondWithResult(_0xae8e11,null))[_0x721a('0x47')](handleError(_0xae8e11,null));};exports[_0x721a('0x55')]=function(_0x1f0084,_0x57a247,_0x3e57fd){if(_0x1f0084[_0x721a('0x4b')]['id']){delete _0x1f0084['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x1f0084['params']['id']}})[_0x721a('0x26')](handleEntityNotFound(_0x57a247,null))['then'](function(_0x322717){if(_0x322717){return _0x322717[_0x721a('0x55')](_0x1f0084[_0x721a('0x4b')][_0x721a('0x56')]||[]);}return null;})[_0x721a('0x26')](respondWithResult(_0x57a247,null))[_0x721a('0x47')](handleError(_0x57a247,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4fa3a1f..410249d 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 _0x2ce9=['DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','path','rimraf','./intDeskConfiguration.attributes','define'];(function(_0x18b4d3,_0x1cc71){var _0x665332=function(_0x27e3d9){while(--_0x27e3d9){_0x18b4d3['push'](_0x18b4d3['shift']());}};_0x665332(++_0x1cc71);}(_0x2ce9,0x65));var _0x92ce=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2ce9[_0x5e709a];return _0x57401a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x92ce('0x0'))(_0x92ce('0x1'));var moment=require(_0x92ce('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ce('0x3'));var rimraf=require(_0x92ce('0x4'));var config=require('../../config/environment');var attributes=require(_0x92ce('0x5'));module['exports']=function(_0x197a7c,_0x377eb6){return _0x197a7c[_0x92ce('0x6')](_0x92ce('0x7'),attributes,{'tableName':_0x92ce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d05=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x5d05,0x1d2));var _0x55d0=function(_0x15372f,_0x467b0c){_0x15372f=_0x15372f-0x0;var _0x52e750=_0x5d05[_0x15372f];return _0x52e750;};'use strict';var _=require(_0x55d0('0x0'));var util=require(_0x55d0('0x1'));var logger=require(_0x55d0('0x2'))(_0x55d0('0x3'));var moment=require('moment');var BPromise=require(_0x55d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x55d0('0x5'));var rimraf=require(_0x55d0('0x6'));var config=require(_0x55d0('0x7'));var attributes=require(_0x55d0('0x8'));module[_0x55d0('0x9')]=function(_0x23c9b4,_0x20de69){return _0x23c9b4[_0x55d0('0xa')](_0x55d0('0xb'),attributes,{'tableName':_0x55d0('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 c0825d8..31c25ee 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 _0x839b=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x839b,0x1d5));var _0xb839=function(_0x5eb675,_0xe3e9a){_0x5eb675=_0x5eb675-0x0;var _0x52e4f8=_0x839b[_0x5eb675];return _0x52e4f8;};'use strict';var _=require(_0xb839('0x0'));var util=require(_0xb839('0x1'));var moment=require('moment');var BPromise=require(_0xb839('0x2'));var rs=require(_0xb839('0x3'));var fs=require('fs');var Redis=require(_0xb839('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb839('0x5'));var logger=require('../../config/logger')(_0xb839('0x6'));var config=require(_0xb839('0x7'));var jayson=require(_0xb839('0x8'));var client=jayson[_0xb839('0x9')][_0xb839('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25641e,_0x40a760,_0x37c964){return new BPromise(function(_0x3d50f4,_0x49b08c){return client['request'](_0x25641e,_0x37c964)[_0xb839('0xb')](function(_0x1333cb){logger[_0xb839('0xc')](_0xb839('0xd'),_0x40a760,'request\x20sent');logger[_0xb839('0xe')](_0xb839('0xf'),_0x40a760,_0xb839('0x10'),JSON[_0xb839('0x11')](_0x1333cb));if(_0x1333cb[_0xb839('0x12')]){if(_0x1333cb['error'][_0xb839('0x13')]===0x1f4){logger['error'](_0xb839('0xd'),_0x40a760,_0x1333cb['error'][_0xb839('0x14')]);return _0x49b08c(_0x1333cb[_0xb839('0x12')][_0xb839('0x14')]);}logger['error'](_0xb839('0xd'),_0x40a760,_0x1333cb[_0xb839('0x12')]['message']);return _0x3d50f4(_0x1333cb[_0xb839('0x12')][_0xb839('0x14')]);}else{logger[_0xb839('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x40a760,_0xb839('0x10'));_0x3d50f4(_0x1333cb[_0xb839('0x15')][_0xb839('0x14')]);}})[_0xb839('0x16')](function(_0x57eaac){logger[_0xb839('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x40a760,_0x57eaac);_0x49b08c(_0x57eaac);});});} \ No newline at end of file +var _0x1b0e=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1b0e,0x132));var _0xe1b0=function(_0x2def35,_0x706978){_0x2def35=_0x2def35-0x0;var _0x4142d0=_0x1b0e[_0x2def35];return _0x4142d0;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 55e1445..cf0e663 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 _0x640e=['util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2e4bd3,_0x4bb4b9){var _0x3ec1a0=function(_0x401acd){while(--_0x401acd){_0x2e4bd3['push'](_0x2e4bd3['shift']());}};_0x3ec1a0(++_0x4bb4b9);}(_0x640e,0x65));var _0xe640=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x640e[_0x142020];return _0x40da8f;};'use strict';var multer=require(_0xe640('0x0'));var util=require(_0xe640('0x1'));var path=require('path');var timeout=require(_0xe640('0x2'));var express=require(_0xe640('0x3'));var router=express[_0xe640('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe640('0x5'));var controller=require('./intDeskField.controller');router[_0xe640('0x6')]('/',auth[_0xe640('0x7')](),controller[_0xe640('0x8')]);router[_0xe640('0x6')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xa')]);router[_0xe640('0xb')]('/',auth[_0xe640('0x7')](),controller['create']);router[_0xe640('0xc')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xd')]);router[_0xe640('0xe')](_0xe640('0x9'),auth['isAuthenticated'](),controller[_0xe640('0xf')]);module[_0xe640('0x10')]=router; \ No newline at end of file +var _0x9fa9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','util','path'];(function(_0x36bc58,_0x27f03c){var _0x4a547e=function(_0x6326c6){while(--_0x6326c6){_0x36bc58['push'](_0x36bc58['shift']());}};_0x4a547e(++_0x27f03c);}(_0x9fa9,0xb2));var _0x99fa=function(_0x2a7afa,_0x5d196e){_0x2a7afa=_0x2a7afa-0x0;var _0x25d991=_0x9fa9[_0x2a7afa];return _0x25d991;};'use strict';var multer=require('multer');var util=require(_0x99fa('0x0'));var path=require(_0x99fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x99fa('0x2'));var router=express['Router']();var fs_extra=require(_0x99fa('0x3'));var auth=require(_0x99fa('0x4'));var interaction=require(_0x99fa('0x5'));var config=require(_0x99fa('0x6'));var controller=require(_0x99fa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x99fa('0x8')]);router[_0x99fa('0x9')](_0x99fa('0xa'),auth[_0x99fa('0xb')](),controller['show']);router[_0x99fa('0xc')]('/',auth[_0x99fa('0xb')](),controller[_0x99fa('0xd')]);router[_0x99fa('0xe')](_0x99fa('0xa'),auth[_0x99fa('0xb')](),controller[_0x99fa('0xf')]);router['delete'](_0x99fa('0xa'),auth['isAuthenticated'](),controller[_0x99fa('0x10')]);module[_0x99fa('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 8b6d52b..a777c45 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 _0x34ca=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0xe9a485,_0x185300){var _0x59e007=function(_0x1768a6){while(--_0x1768a6){_0xe9a485['push'](_0xe9a485['shift']());}};_0x59e007(++_0x185300);}(_0x34ca,0x192));var _0xa34c=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x34ca[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xa34c('0x0'));module[_0xa34c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa34c('0x2'),_0xa34c('0x3'),_0xa34c('0x4'),_0xa34c('0x5'),'picklist'),'defaultValue':_0xa34c('0x2')},'content':{'type':Sequelize[_0xa34c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa34c('0x3'),_0xa34c('0x4'))},'keyContent':{'type':Sequelize[_0xa34c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa34c('0x6')]},'customField':{'type':Sequelize[_0xa34c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa34c('0x6')]}}; \ No newline at end of file +var _0x0353=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x372400,_0xdaeb10){var _0x4cd28c=function(_0x497d1f){while(--_0x497d1f){_0x372400['push'](_0x372400['shift']());}};_0x4cd28c(++_0xdaeb10);}(_0x0353,0x106));var _0x3035=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x0353[_0x3f0b30];return _0x2748a5;};'use strict';var Sequelize=require(_0x3035('0x0'));module[_0x3035('0x1')]={'type':{'type':Sequelize[_0x3035('0x2')](_0x3035('0x3'),'variable',_0x3035('0x4'),_0x3035('0x5'),_0x3035('0x6')),'defaultValue':_0x3035('0x3')},'content':{'type':Sequelize[_0x3035('0x7')]},'key':{'type':Sequelize[_0x3035('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3035('0x3'),_0x3035('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x3035('0x7')]},'idField':{'type':Sequelize[_0x3035('0x7')]},'nameField':{'type':Sequelize[_0x3035('0x7')]},'customField':{'type':Sequelize[_0x3035('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3035('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7b51b7f..28b0bef 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 _0x1107=['eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','DeskField','count','includeAll','rows','catch','params','rawAttributes','options','find','create','body','destroy'];(function(_0x98476,_0x25f0aa){var _0x5df151=function(_0x3d2c35){while(--_0x3d2c35){_0x98476['push'](_0x98476['shift']());}};_0x5df151(++_0x25f0aa);}(_0x1107,0xd8));var _0x7110=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0x1107[_0x18a772];return _0xbaac04;};'use strict';var emlformat=require(_0x7110('0x0'));var rimraf=require(_0x7110('0x1'));var zipdir=require(_0x7110('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7110('0x3'));var BPromise=require(_0x7110('0x4'));var Mustache=require('mustache');var util=require(_0x7110('0x5'));var path=require(_0x7110('0x6'));var sox=require(_0x7110('0x7'));var csv=require(_0x7110('0x8'));var ejs=require(_0x7110('0x9'));var fs=require('fs');var fs_extra=require(_0x7110('0xa'));var _=require(_0x7110('0xb'));var squel=require(_0x7110('0xc'));var crypto=require(_0x7110('0xd'));var jsforce=require(_0x7110('0xe'));var deskjs=require(_0x7110('0xf'));var toCsv=require(_0x7110('0x8'));var querystring=require(_0x7110('0x10'));var Papa=require('papaparse');var Redis=require(_0x7110('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7110('0x12'));var as=require(_0x7110('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7110('0x14'))(_0x7110('0x15'));var utils=require(_0x7110('0x16'));var config=require(_0x7110('0x17'));var licenseUtil=require(_0x7110('0x18'));var db=require(_0x7110('0x19'))['db'];function respondWithStatusCode(_0x427997,_0x35984d){_0x35984d=_0x35984d||0xcc;return function(_0x458ad7){if(_0x458ad7){return _0x427997['sendStatus'](_0x35984d);}return _0x427997[_0x7110('0x1a')](_0x35984d)['end']();};}function respondWithResult(_0x36c44d,_0x56b08b){_0x56b08b=_0x56b08b||0xc8;return function(_0x21cb1d){if(_0x21cb1d){return _0x36c44d[_0x7110('0x1a')](_0x56b08b)[_0x7110('0x1b')](_0x21cb1d);}};}function respondWithFilteredResult(_0x149238,_0x26fe8a){return function(_0x1a8f7f){if(_0x1a8f7f){var _0x2ad1c3=typeof _0x26fe8a['offset']===_0x7110('0x1c')&&typeof _0x26fe8a['limit']===_0x7110('0x1c');var _0x39664d=_0x1a8f7f['count'];var _0x9df9ca=_0x2ad1c3?0x0:_0x26fe8a[_0x7110('0x1d')];var _0x3b590f=_0x2ad1c3?_0x1a8f7f['count']:_0x26fe8a['offset']+_0x26fe8a[_0x7110('0x1e')];var _0x13c8ea;if(_0x3b590f>=_0x39664d){_0x3b590f=_0x39664d;_0x13c8ea=0xc8;}else{_0x13c8ea=0xce;}_0x149238[_0x7110('0x1a')](_0x13c8ea);return _0x149238[_0x7110('0x1f')](_0x7110('0x20'),_0x9df9ca+'-'+_0x3b590f+'/'+_0x39664d)['json'](_0x1a8f7f);}return null;};}function patchUpdates(_0x3bd2bc){return function(_0x3b5f7f){try{jsonpatch[_0x7110('0x21')](_0x3b5f7f,_0x3bd2bc,!![]);}catch(_0x264250){return BPromise[_0x7110('0x22')](_0x264250);}return _0x3b5f7f[_0x7110('0x23')]();};}function saveUpdates(_0x29dcb2,_0x38b7cd){return function(_0x530a3e){if(_0x530a3e){return _0x530a3e[_0x7110('0x24')](_0x29dcb2)['then'](function(_0x3bd510){return _0x3bd510;});}return null;};}function removeEntity(_0xcf45c,_0x2373b4){return function(_0x166862){if(_0x166862){return _0x166862['destroy']()[_0x7110('0x25')](function(){_0xcf45c[_0x7110('0x1a')](0xcc)[_0x7110('0x26')]();});}};}function handleEntityNotFound(_0x54fc43,_0x341eb7){return function(_0x4acb38){if(!_0x4acb38){_0x54fc43['sendStatus'](0x194);}return _0x4acb38;};}function handleError(_0x427943,_0x1370c5){_0x1370c5=_0x1370c5||0x1f4;return function(_0x16b03d){logger[_0x7110('0x27')](_0x16b03d['stack']);if(_0x16b03d[_0x7110('0x28')]){delete _0x16b03d[_0x7110('0x28')];}_0x427943[_0x7110('0x1a')](_0x1370c5)[_0x7110('0x29')](_0x16b03d);};}exports[_0x7110('0x2a')]=function(_0x381203,_0x280781){var _0x389047={},_0x1b163a={},_0x106e19={'count':0x0,'rows':[]};var _0x35264c=_[_0x7110('0x2b')](db['DeskField']['rawAttributes'],function(_0x2d88fb){return{'name':_0x2d88fb['fieldName'],'type':_0x2d88fb['type'][_0x7110('0x2c')]};});_0x1b163a[_0x7110('0x2d')]=_['map'](_0x35264c,_0x7110('0x28'));_0x1b163a['query']=_[_0x7110('0x2e')](_0x381203[_0x7110('0x2f')]);_0x1b163a['filters']=_[_0x7110('0x30')](_0x1b163a[_0x7110('0x2d')],_0x1b163a[_0x7110('0x2f')]);_0x389047['attributes']=_[_0x7110('0x30')](_0x1b163a[_0x7110('0x2d')],qs[_0x7110('0x31')](_0x381203[_0x7110('0x2f')][_0x7110('0x31')]));_0x389047[_0x7110('0x32')]=_0x389047[_0x7110('0x32')][_0x7110('0x33')]?_0x389047[_0x7110('0x32')]:_0x1b163a['model'];if(!_0x381203['query'][_0x7110('0x34')]('nolimit')){_0x389047[_0x7110('0x1e')]=qs[_0x7110('0x1e')](_0x381203[_0x7110('0x2f')][_0x7110('0x1e')]);_0x389047['offset']=qs['offset'](_0x381203[_0x7110('0x2f')]['offset']);}_0x389047[_0x7110('0x35')]=qs[_0x7110('0x36')](_0x381203['query'][_0x7110('0x36')]);_0x389047['where']=qs[_0x7110('0x37')](_[_0x7110('0x38')](_0x381203[_0x7110('0x2f')],_0x1b163a[_0x7110('0x37')]),_0x35264c);if(_0x381203[_0x7110('0x2f')]['filter']){_0x389047[_0x7110('0x39')]=_[_0x7110('0x3a')](_0x389047[_0x7110('0x39')],{'$or':_[_0x7110('0x2b')](_0x35264c,function(_0x9e611a){if(_0x9e611a[_0x7110('0x3b')]!=='VIRTUAL'){var _0x1a6bf2={};_0x1a6bf2[_0x9e611a[_0x7110('0x28')]]={'$like':'%'+_0x381203[_0x7110('0x2f')]['filter']+'%'};return _0x1a6bf2;}})});}_0x389047=_['merge']({},_0x389047,_0x381203['options']);var _0xe0e65c={'where':_0x389047[_0x7110('0x39')]};return db[_0x7110('0x3c')][_0x7110('0x3d')](_0xe0e65c)['then'](function(_0x2648b2){_0x106e19[_0x7110('0x3d')]=_0x2648b2;if(_0x381203['query'][_0x7110('0x3e')]){_0x389047['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x389047);})[_0x7110('0x25')](function(_0x4d46e6){_0x106e19[_0x7110('0x3f')]=_0x4d46e6;return _0x106e19;})[_0x7110('0x25')](respondWithFilteredResult(_0x280781,_0x389047))[_0x7110('0x40')](handleError(_0x280781,null));};exports['show']=function(_0x38a01e,_0x4a5a36){var _0x1c86d7={'raw':!![],'where':{'id':_0x38a01e[_0x7110('0x41')]['id']}},_0x280a97={};_0x280a97[_0x7110('0x2d')]=_[_0x7110('0x2e')](db[_0x7110('0x3c')][_0x7110('0x42')]);_0x280a97['query']=_[_0x7110('0x2e')](_0x38a01e['query']);_0x280a97[_0x7110('0x37')]=_['intersection'](_0x280a97[_0x7110('0x2d')],_0x280a97[_0x7110('0x2f')]);_0x1c86d7['attributes']=_[_0x7110('0x30')](_0x280a97[_0x7110('0x2d')],qs[_0x7110('0x31')](_0x38a01e['query']['fields']));_0x1c86d7[_0x7110('0x32')]=_0x1c86d7['attributes'][_0x7110('0x33')]?_0x1c86d7[_0x7110('0x32')]:_0x280a97[_0x7110('0x2d')];if(_0x38a01e[_0x7110('0x2f')][_0x7110('0x3e')]){_0x1c86d7['include']=[{'all':!![]}];}_0x1c86d7=_[_0x7110('0x3a')]({},_0x1c86d7,_0x38a01e[_0x7110('0x43')]);return db[_0x7110('0x3c')][_0x7110('0x44')](_0x1c86d7)['then'](handleEntityNotFound(_0x4a5a36,null))[_0x7110('0x25')](respondWithResult(_0x4a5a36,null))[_0x7110('0x40')](handleError(_0x4a5a36,null));};exports['create']=function(_0x59c99a,_0x29a489){return db[_0x7110('0x3c')][_0x7110('0x45')](_0x59c99a[_0x7110('0x46')],{})[_0x7110('0x25')](respondWithResult(_0x29a489,0xc9))['catch'](handleError(_0x29a489,null));};exports[_0x7110('0x24')]=function(_0x5c1211,_0x1ba0f4){if(_0x5c1211['body']['id']){delete _0x5c1211[_0x7110('0x46')]['id'];}return db[_0x7110('0x3c')][_0x7110('0x44')]({'where':{'id':_0x5c1211['params']['id']}})[_0x7110('0x25')](handleEntityNotFound(_0x1ba0f4,null))[_0x7110('0x25')](saveUpdates(_0x5c1211['body'],null))[_0x7110('0x25')](respondWithResult(_0x1ba0f4,null))[_0x7110('0x40')](handleError(_0x1ba0f4,null));};exports[_0x7110('0x47')]=function(_0x32c28e,_0xb8c57f){return db[_0x7110('0x3c')][_0x7110('0x44')]({'where':{'id':_0x32c28e[_0x7110('0x41')]['id']}})['then'](handleEntityNotFound(_0xb8c57f,null))[_0x7110('0x25')](removeEntity(_0xb8c57f,null))[_0x7110('0x40')](handleError(_0xb8c57f,null));}; \ No newline at end of file +var _0x83ed=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','DeskField','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys','intersection'];(function(_0x24ca0b,_0x787b8b){var _0x91612e=function(_0x2bacef){while(--_0x2bacef){_0x24ca0b['push'](_0x24ca0b['shift']());}};_0x91612e(++_0x787b8b);}(_0x83ed,0x66));var _0xd83e=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x83ed[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0xd83e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd83e('0x1'));var jsonpatch=require(_0xd83e('0x2'));var rp=require(_0xd83e('0x3'));var moment=require('moment');var BPromise=require(_0xd83e('0x4'));var Mustache=require(_0xd83e('0x5'));var util=require(_0xd83e('0x6'));var path=require(_0xd83e('0x7'));var sox=require(_0xd83e('0x8'));var csv=require(_0xd83e('0x9'));var ejs=require(_0xd83e('0xa'));var fs=require('fs');var fs_extra=require(_0xd83e('0xb'));var _=require(_0xd83e('0xc'));var squel=require('squel');var crypto=require(_0xd83e('0xd'));var jsforce=require(_0xd83e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd83e('0x9'));var querystring=require(_0xd83e('0xf'));var Papa=require(_0xd83e('0x10'));var Redis=require('ioredis');var authService=require(_0xd83e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd83e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd83e('0x13'))(_0xd83e('0x14'));var utils=require('../../config/utils');var config=require(_0xd83e('0x15'));var licenseUtil=require(_0xd83e('0x16'));var db=require(_0xd83e('0x17'))['db'];function respondWithStatusCode(_0x53ce8b,_0x2a2a88){_0x2a2a88=_0x2a2a88||0xcc;return function(_0x3ff12f){if(_0x3ff12f){return _0x53ce8b[_0xd83e('0x18')](_0x2a2a88);}return _0x53ce8b[_0xd83e('0x19')](_0x2a2a88)[_0xd83e('0x1a')]();};}function respondWithResult(_0x275334,_0x4739b3){_0x4739b3=_0x4739b3||0xc8;return function(_0x23c5cc){if(_0x23c5cc){return _0x275334[_0xd83e('0x19')](_0x4739b3)[_0xd83e('0x1b')](_0x23c5cc);}};}function respondWithFilteredResult(_0x4129c5,_0x41d742){return function(_0x8b7347){if(_0x8b7347){var _0x5b9373=typeof _0x41d742['offset']===_0xd83e('0x1c')&&typeof _0x41d742['limit']===_0xd83e('0x1c');var _0x4b2a22=_0x8b7347[_0xd83e('0x1d')];var _0x91b23f=_0x5b9373?0x0:_0x41d742['offset'];var _0x585b74=_0x5b9373?_0x8b7347[_0xd83e('0x1d')]:_0x41d742[_0xd83e('0x1e')]+_0x41d742[_0xd83e('0x1f')];var _0x35e4d2;if(_0x585b74>=_0x4b2a22){_0x585b74=_0x4b2a22;_0x35e4d2=0xc8;}else{_0x35e4d2=0xce;}_0x4129c5[_0xd83e('0x19')](_0x35e4d2);return _0x4129c5[_0xd83e('0x20')](_0xd83e('0x21'),_0x91b23f+'-'+_0x585b74+'/'+_0x4b2a22)[_0xd83e('0x1b')](_0x8b7347);}return null;};}function patchUpdates(_0x1bd8e5){return function(_0x505514){try{jsonpatch[_0xd83e('0x22')](_0x505514,_0x1bd8e5,!![]);}catch(_0x58f7da){return BPromise[_0xd83e('0x23')](_0x58f7da);}return _0x505514[_0xd83e('0x24')]();};}function saveUpdates(_0x58a9d5,_0x30ea73){return function(_0x1bb6a5){if(_0x1bb6a5){return _0x1bb6a5[_0xd83e('0x25')](_0x58a9d5)[_0xd83e('0x26')](function(_0x17e96e){return _0x17e96e;});}return null;};}function removeEntity(_0x1e0dee,_0x43b520){return function(_0x38842d){if(_0x38842d){return _0x38842d['destroy']()['then'](function(){_0x1e0dee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21aafc,_0x3d19b8){return function(_0x2d1549){if(!_0x2d1549){_0x21aafc[_0xd83e('0x18')](0x194);}return _0x2d1549;};}function handleError(_0x277c94,_0x2bc6f8){_0x2bc6f8=_0x2bc6f8||0x1f4;return function(_0x40c974){logger[_0xd83e('0x27')](_0x40c974[_0xd83e('0x28')]);if(_0x40c974[_0xd83e('0x29')]){delete _0x40c974[_0xd83e('0x29')];}_0x277c94[_0xd83e('0x19')](_0x2bc6f8)[_0xd83e('0x2a')](_0x40c974);};}exports['index']=function(_0x27a905,_0x4189e2){var _0x1e4f1a={},_0x2f1178={},_0x49be67={'count':0x0,'rows':[]};var _0x13c861=_['map'](db['DeskField'][_0xd83e('0x2b')],function(_0x2adafe){return{'name':_0x2adafe[_0xd83e('0x2c')],'type':_0x2adafe[_0xd83e('0x2d')][_0xd83e('0x2e')]};});_0x2f1178['model']=_['map'](_0x13c861,_0xd83e('0x29'));_0x2f1178[_0xd83e('0x2f')]=_[_0xd83e('0x30')](_0x27a905[_0xd83e('0x2f')]);_0x2f1178['filters']=_[_0xd83e('0x31')](_0x2f1178[_0xd83e('0x32')],_0x2f1178[_0xd83e('0x2f')]);_0x1e4f1a[_0xd83e('0x33')]=_[_0xd83e('0x31')](_0x2f1178[_0xd83e('0x32')],qs[_0xd83e('0x34')](_0x27a905[_0xd83e('0x2f')]['fields']));_0x1e4f1a[_0xd83e('0x33')]=_0x1e4f1a['attributes'][_0xd83e('0x35')]?_0x1e4f1a['attributes']:_0x2f1178[_0xd83e('0x32')];if(!_0x27a905[_0xd83e('0x2f')][_0xd83e('0x36')](_0xd83e('0x37'))){_0x1e4f1a[_0xd83e('0x1f')]=qs[_0xd83e('0x1f')](_0x27a905[_0xd83e('0x2f')][_0xd83e('0x1f')]);_0x1e4f1a[_0xd83e('0x1e')]=qs[_0xd83e('0x1e')](_0x27a905['query']['offset']);}_0x1e4f1a[_0xd83e('0x38')]=qs[_0xd83e('0x39')](_0x27a905[_0xd83e('0x2f')][_0xd83e('0x39')]);_0x1e4f1a['where']=qs['filters'](_['pick'](_0x27a905[_0xd83e('0x2f')],_0x2f1178[_0xd83e('0x3a')]),_0x13c861);if(_0x27a905['query'][_0xd83e('0x3b')]){_0x1e4f1a[_0xd83e('0x3c')]=_[_0xd83e('0x3d')](_0x1e4f1a[_0xd83e('0x3c')],{'$or':_['map'](_0x13c861,function(_0x5324f5){if(_0x5324f5[_0xd83e('0x2d')]!==_0xd83e('0x3e')){var _0x204ea0={};_0x204ea0[_0x5324f5[_0xd83e('0x29')]]={'$like':'%'+_0x27a905[_0xd83e('0x2f')][_0xd83e('0x3b')]+'%'};return _0x204ea0;}})});}_0x1e4f1a=_[_0xd83e('0x3d')]({},_0x1e4f1a,_0x27a905[_0xd83e('0x3f')]);var _0x4200a8={'where':_0x1e4f1a[_0xd83e('0x3c')]};return db[_0xd83e('0x40')][_0xd83e('0x1d')](_0x4200a8)[_0xd83e('0x26')](function(_0x28c87a){_0x49be67[_0xd83e('0x1d')]=_0x28c87a;if(_0x27a905[_0xd83e('0x2f')]['includeAll']){_0x1e4f1a[_0xd83e('0x41')]=[{'all':!![]}];}return db['DeskField'][_0xd83e('0x42')](_0x1e4f1a);})[_0xd83e('0x26')](function(_0x49a24c){_0x49be67[_0xd83e('0x43')]=_0x49a24c;return _0x49be67;})[_0xd83e('0x26')](respondWithFilteredResult(_0x4189e2,_0x1e4f1a))[_0xd83e('0x44')](handleError(_0x4189e2,null));};exports[_0xd83e('0x45')]=function(_0x310fa5,_0x12dd54){var _0x11fb48={'raw':!![],'where':{'id':_0x310fa5[_0xd83e('0x46')]['id']}},_0x254978={};_0x254978[_0xd83e('0x32')]=_[_0xd83e('0x30')](db[_0xd83e('0x40')][_0xd83e('0x2b')]);_0x254978[_0xd83e('0x2f')]=_[_0xd83e('0x30')](_0x310fa5['query']);_0x254978['filters']=_[_0xd83e('0x31')](_0x254978[_0xd83e('0x32')],_0x254978[_0xd83e('0x2f')]);_0x11fb48['attributes']=_['intersection'](_0x254978[_0xd83e('0x32')],qs[_0xd83e('0x34')](_0x310fa5[_0xd83e('0x2f')]['fields']));_0x11fb48['attributes']=_0x11fb48[_0xd83e('0x33')][_0xd83e('0x35')]?_0x11fb48['attributes']:_0x254978['model'];if(_0x310fa5[_0xd83e('0x2f')][_0xd83e('0x47')]){_0x11fb48['include']=[{'all':!![]}];}_0x11fb48=_['merge']({},_0x11fb48,_0x310fa5[_0xd83e('0x3f')]);return db[_0xd83e('0x40')][_0xd83e('0x48')](_0x11fb48)[_0xd83e('0x26')](handleEntityNotFound(_0x12dd54,null))[_0xd83e('0x26')](respondWithResult(_0x12dd54,null))[_0xd83e('0x44')](handleError(_0x12dd54,null));};exports[_0xd83e('0x49')]=function(_0x46bf7c,_0x777288){return db[_0xd83e('0x40')]['create'](_0x46bf7c[_0xd83e('0x4a')],{})[_0xd83e('0x26')](respondWithResult(_0x777288,0xc9))['catch'](handleError(_0x777288,null));};exports[_0xd83e('0x25')]=function(_0x113646,_0x431f6f){if(_0x113646[_0xd83e('0x4a')]['id']){delete _0x113646[_0xd83e('0x4a')]['id'];}return db[_0xd83e('0x40')][_0xd83e('0x48')]({'where':{'id':_0x113646[_0xd83e('0x46')]['id']}})['then'](handleEntityNotFound(_0x431f6f,null))[_0xd83e('0x26')](saveUpdates(_0x113646['body'],null))['then'](respondWithResult(_0x431f6f,null))[_0xd83e('0x44')](handleError(_0x431f6f,null));};exports[_0xd83e('0x4b')]=function(_0x3361d0,_0x1714a2){return db[_0xd83e('0x40')][_0xd83e('0x48')]({'where':{'id':_0x3361d0['params']['id']}})[_0xd83e('0x26')](handleEntityNotFound(_0x1714a2,null))[_0xd83e('0x26')](removeEntity(_0x1714a2,null))[_0xd83e('0x44')](handleError(_0x1714a2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a4aadec..9eac477 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 _0x62f8=['exports','define','int_desk_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x62f8,0x66));var _0x862f=function(_0x146b42,_0x282dac){_0x146b42=_0x146b42-0x0;var _0x548e50=_0x62f8[_0x146b42];return _0x548e50;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var logger=require(_0x862f('0x2'))(_0x862f('0x3'));var moment=require(_0x862f('0x4'));var BPromise=require(_0x862f('0x5'));var rp=require(_0x862f('0x6'));var fs=require('fs');var path=require(_0x862f('0x7'));var rimraf=require('rimraf');var config=require(_0x862f('0x8'));var attributes=require(_0x862f('0x9'));module[_0x862f('0xa')]=function(_0x1b1acd,_0x38b099){return _0x1b1acd[_0x862f('0xb')]('DeskField',attributes,{'tableName':_0x862f('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x862f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d27=['bluebird','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','FieldId','lodash','api','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0d27,0xa2));var _0x70d2=function(_0x1e3b11,_0x326b78){_0x1e3b11=_0x1e3b11-0x0;var _0x2d3902=_0x0d27[_0x1e3b11];return _0x2d3902;};'use strict';var _=require(_0x70d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x70d2('0x1'));var moment=require(_0x70d2('0x2'));var BPromise=require(_0x70d2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70d2('0x4'));var config=require('../../config/environment');var attributes=require(_0x70d2('0x5'));module[_0x70d2('0x6')]=function(_0x45a24c,_0x34c799){return _0x45a24c[_0x70d2('0x7')]('DeskField',attributes,{'tableName':_0x70d2('0x8'),'paranoid':![],'indexes':[{'name':_0x70d2('0x9'),'fields':['idField',_0x70d2('0xa')],'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 328b87f..25255ab 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 _0x2c23=['then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2c23,0xf2));var _0x32c2=function(_0x4614eb,_0x5ee1de){_0x4614eb=_0x4614eb-0x0;var _0x123f27=_0x2c23[_0x4614eb];return _0x123f27;};'use strict';var _=require(_0x32c2('0x0'));var util=require(_0x32c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32c2('0x2'));var fs=require('fs');var Redis=require(_0x32c2('0x3'));var db=require(_0x32c2('0x4'))['db'];var utils=require(_0x32c2('0x5'));var logger=require('../../config/logger')(_0x32c2('0x6'));var config=require(_0x32c2('0x7'));var jayson=require(_0x32c2('0x8'));var client=jayson[_0x32c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd14b,_0x3f2cc3,_0x41474e){return new BPromise(function(_0x47b4ae,_0xefb0eb){return client[_0x32c2('0xa')](_0x2dd14b,_0x41474e)[_0x32c2('0xb')](function(_0x197f2d){logger[_0x32c2('0xc')](_0x32c2('0xd'),_0x3f2cc3,_0x32c2('0xe'));logger[_0x32c2('0xf')](_0x32c2('0x10'),_0x3f2cc3,_0x32c2('0xe'),JSON[_0x32c2('0x11')](_0x197f2d));if(_0x197f2d['error']){if(_0x197f2d[_0x32c2('0x12')][_0x32c2('0x13')]===0x1f4){logger['error'](_0x32c2('0xd'),_0x3f2cc3,_0x197f2d['error']['message']);return _0xefb0eb(_0x197f2d['error'][_0x32c2('0x14')]);}logger[_0x32c2('0x12')](_0x32c2('0xd'),_0x3f2cc3,_0x197f2d[_0x32c2('0x12')][_0x32c2('0x14')]);return _0x47b4ae(_0x197f2d[_0x32c2('0x12')][_0x32c2('0x14')]);}else{logger[_0x32c2('0xc')](_0x32c2('0xd'),_0x3f2cc3,_0x32c2('0xe'));_0x47b4ae(_0x197f2d[_0x32c2('0x15')][_0x32c2('0x14')]);}})[_0x32c2('0x16')](function(_0x5d4cb5){logger['error'](_0x32c2('0xd'),_0x3f2cc3,_0x5d4cb5);_0xefb0eb(_0x5d4cb5);});});} \ No newline at end of file +var _0xfe3e=['info','catch','moment','ioredis','rpc','http','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x30ce77,_0x369978){var _0x548fb8=function(_0x149425){while(--_0x149425){_0x30ce77['push'](_0x30ce77['shift']());}};_0x548fb8(++_0x369978);}(_0xfe3e,0x128));var _0xefe3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfe3e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xefe3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefe3('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefe3('0x2'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefe3('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x237033,_0x2a8ea5,_0x38ee3b){return new BPromise(function(_0x2cec98,_0x1ccadb){return client['request'](_0x237033,_0x38ee3b)[_0xefe3('0x4')](function(_0x450fb6){logger['info'](_0xefe3('0x5'),_0x2a8ea5,_0xefe3('0x6'));logger[_0xefe3('0x7')](_0xefe3('0x8'),_0x2a8ea5,_0xefe3('0x6'),JSON[_0xefe3('0x9')](_0x450fb6));if(_0x450fb6[_0xefe3('0xa')]){if(_0x450fb6[_0xefe3('0xa')]['code']===0x1f4){logger[_0xefe3('0xa')](_0xefe3('0x5'),_0x2a8ea5,_0x450fb6[_0xefe3('0xa')][_0xefe3('0xb')]);return _0x1ccadb(_0x450fb6[_0xefe3('0xa')][_0xefe3('0xb')]);}logger[_0xefe3('0xa')](_0xefe3('0x5'),_0x2a8ea5,_0x450fb6[_0xefe3('0xa')][_0xefe3('0xb')]);return _0x2cec98(_0x450fb6[_0xefe3('0xa')][_0xefe3('0xb')]);}else{logger[_0xefe3('0xc')](_0xefe3('0x5'),_0x2a8ea5,_0xefe3('0x6'));_0x2cec98(_0x450fb6['result'][_0xefe3('0xb')]);}})[_0xefe3('0xd')](function(_0xbf79dd){logger[_0xefe3('0xa')](_0xefe3('0x5'),_0x2a8ea5,_0xbf79dd);_0x1ccadb(_0xbf79dd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index abc6167..3a74b15 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 _0x5e95=['/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x11b4df,_0x4a7379){var _0x436ba0=function(_0x11c580){while(--_0x11c580){_0x11b4df['push'](_0x11b4df['shift']());}};_0x436ba0(++_0x4a7379);}(_0x5e95,0xce));var _0x55e9=function(_0x435f71,_0xfb5d03){_0x435f71=_0x435f71-0x0;var _0x18e3e1=_0x5e95[_0x435f71];return _0x18e3e1;};'use strict';var multer=require('multer');var util=require(_0x55e9('0x0'));var path=require(_0x55e9('0x1'));var timeout=require(_0x55e9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55e9('0x3'));var config=require(_0x55e9('0x4'));var controller=require('./intDynamics365Account.controller');router[_0x55e9('0x5')]('/',auth[_0x55e9('0x6')](),controller[_0x55e9('0x7')]);router[_0x55e9('0x5')](_0x55e9('0x8'),auth[_0x55e9('0x6')](),controller[_0x55e9('0x9')]);router['get']('/:id/configurations',auth[_0x55e9('0x6')](),controller['getConfigurations']);router[_0x55e9('0x5')](_0x55e9('0xa'),auth[_0x55e9('0x6')](),controller[_0x55e9('0xb')]);router[_0x55e9('0xc')]('/',auth[_0x55e9('0x6')](),controller[_0x55e9('0xd')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x55e9('0xe')]);router['put'](_0x55e9('0x8'),auth[_0x55e9('0x6')](),controller[_0x55e9('0xf')]);router['delete']('/:id',auth[_0x55e9('0x6')](),controller[_0x55e9('0x10')]);module[_0x55e9('0x11')]=router; \ No newline at end of file +var _0x5aff=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0xf48efb,_0x307c7f){var _0x179636=function(_0xfcbe59){while(--_0xfcbe59){_0xf48efb['push'](_0xf48efb['shift']());}};_0x179636(++_0x307c7f);}(_0x5aff,0x116));var _0xf5af=function(_0x5799c2,_0x2e941e){_0x5799c2=_0x5799c2-0x0;var _0x30878c=_0x5aff[_0x5799c2];return _0x30878c;};'use strict';var multer=require(_0xf5af('0x0'));var util=require(_0xf5af('0x1'));var path=require('path');var timeout=require(_0xf5af('0x2'));var express=require(_0xf5af('0x3'));var router=express[_0xf5af('0x4')]();var fs_extra=require(_0xf5af('0x5'));var auth=require(_0xf5af('0x6'));var interaction=require(_0xf5af('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xf5af('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf5af('0x8')](_0xf5af('0x9'),auth['isAuthenticated'](),controller[_0xf5af('0xa')]);router['get'](_0xf5af('0xb'),auth[_0xf5af('0xc')](),controller[_0xf5af('0xd')]);router[_0xf5af('0x8')](_0xf5af('0xe'),auth[_0xf5af('0xc')](),controller[_0xf5af('0xf')]);router[_0xf5af('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5af('0x10')](_0xf5af('0xb'),auth[_0xf5af('0xc')](),controller[_0xf5af('0x11')]);router[_0xf5af('0x12')](_0xf5af('0x9'),auth[_0xf5af('0xc')](),controller[_0xf5af('0x13')]);router[_0xf5af('0x14')]('/:id',auth[_0xf5af('0xc')](),controller[_0xf5af('0x15')]);module[_0xf5af('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 70bf8ce..604d8d2 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 _0x908e=['exports','STRING','sequelize'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x908e,0x182));var _0xe908=function(_0x24984a,_0x10fb2d){_0x24984a=_0x24984a-0x0;var _0x405c82=_0x908e[_0x24984a];return _0x405c82;};'use strict';var Sequelize=require(_0xe908('0x0'));module[_0xe908('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe908('0x2')]},'remoteUri':{'type':Sequelize[_0xe908('0x2')]},'tenantId':{'type':Sequelize[_0xe908('0x2')]},'clientId':{'type':Sequelize[_0xe908('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe908('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6b4e=['BOOLEAN','exports','STRING'];(function(_0x30c975,_0x1d1e5d){var _0x587b4c=function(_0x22a40f){while(--_0x22a40f){_0x30c975['push'](_0x30c975['shift']());}};_0x587b4c(++_0x1d1e5d);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x2ae289,_0x870d5d){_0x2ae289=_0x2ae289-0x0;var _0x12b941=_0x6b4e[_0x2ae289];return _0x12b941;};'use strict';var Sequelize=require('sequelize');module[_0xe6b4('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xe6b4('0x1')]},'clientId':{'type':Sequelize[_0xe6b4('0x1')]},'clientSecret':{'type':Sequelize[_0xe6b4('0x1')]},'serverUrl':{'type':Sequelize[_0xe6b4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe6b4('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe6b4('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 11bb417..34f4cf1 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 _0x108a=['offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','length','create','body','find','params','getConfigurations','findOne','Dynamics365Configuration','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','util','lodash','api','../../mysqldb','../../components/integrations/configuration','status'];(function(_0x24c9d0,_0x4967b6){var _0x58c87f=function(_0x380793){while(--_0x380793){_0x24c9d0['push'](_0x24c9d0['shift']());}};_0x58c87f(++_0x4967b6);}(_0x108a,0x172));var _0xa108=function(_0x47cc4d,_0x28794b){_0x47cc4d=_0x47cc4d-0x0;var _0x3442ca=_0x108a[_0x47cc4d];return _0x3442ca;};'use strict';var rp=require('request-promise');var util=require(_0xa108('0x0'));var _=require(_0xa108('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa108('0x2'));var db=require(_0xa108('0x3'))['db'];var integrations=require(_0xa108('0x4'));function respondWithResult(_0x575c28,_0x34c565){_0x34c565=_0x34c565||0xc8;return function(_0x2ce36e){if(_0x2ce36e){return _0x575c28[_0xa108('0x5')](_0x34c565)['json'](_0x2ce36e);}};}function respondWithFilteredResult(_0x26ab84,_0xa90075){return function(_0xe6d22b){if(_0xe6d22b){var _0x4066ae=typeof _0xa90075[_0xa108('0x6')]===_0xa108('0x7')&&typeof _0xa90075[_0xa108('0x8')]===_0xa108('0x7');var _0x5ee7e6=_0xe6d22b[_0xa108('0x9')];var _0x32c869=_0x4066ae?0x0:_0xa90075[_0xa108('0x6')];var _0x5afbbe=_0x4066ae?_0xe6d22b[_0xa108('0x9')]:_0xa90075['offset']+_0xa90075[_0xa108('0x8')];var _0x3bd73b;if(_0x5afbbe>=_0x5ee7e6){_0x5afbbe=_0x5ee7e6;_0x3bd73b=0xc8;}else{_0x3bd73b=0xce;}_0x26ab84['status'](_0x3bd73b);return _0x26ab84[_0xa108('0xa')](_0xa108('0xb'),_0x32c869+'-'+_0x5afbbe+'/'+_0x5ee7e6)[_0xa108('0xc')](_0xe6d22b);}return null;};}function saveUpdates(_0x1debcf){return function(_0x2ca158){if(_0x2ca158){return _0x2ca158[_0xa108('0xd')](_0x1debcf)[_0xa108('0xe')](function(_0xf48242){return _0xf48242;});}return null;};}function removeEntity(_0x464aec){return function(_0x2f34a1){if(_0x2f34a1){return _0x2f34a1[_0xa108('0xf')]()[_0xa108('0xe')](function(){_0x464aec[_0xa108('0x5')](0xcc)[_0xa108('0x10')]();});}};}function handleEntityNotFound(_0x34ccc7){return function(_0x450471){if(!_0x450471){_0x34ccc7[_0xa108('0x11')](0x194);}return _0x450471;};}function handleError(_0x46f9e6,_0x186fdb){_0x186fdb=_0x186fdb||0x1f4;return function(_0x63bfb2){logger[_0xa108('0x12')](_0x63bfb2[_0xa108('0x13')]);if(_0x63bfb2[_0xa108('0x14')]){delete _0x63bfb2[_0xa108('0x14')];}_0x46f9e6['status'](_0x186fdb)[_0xa108('0x15')](_0x63bfb2);};}exports['index']=function(_0x437988,_0xaa4730){var _0x59b39c={},_0x51654e={},_0x3e28a5={'count':0x0,'rows':[]};var _0x21b300=_[_0xa108('0x16')](db['Dynamics365Account'][_0xa108('0x17')],function(_0x1e328b){return{'name':_0x1e328b[_0xa108('0x18')],'type':_0x1e328b[_0xa108('0x19')]['key']};});_0x51654e[_0xa108('0x1a')]=_['map'](_0x21b300,_0xa108('0x14'));_0x51654e['query']=_[_0xa108('0x1b')](_0x437988[_0xa108('0x1c')]);_0x51654e[_0xa108('0x1d')]=_[_0xa108('0x1e')](_0x51654e[_0xa108('0x1a')],_0x51654e[_0xa108('0x1c')]);_0x59b39c[_0xa108('0x1f')]=_['intersection'](_0x51654e[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x437988[_0xa108('0x1c')][_0xa108('0x20')]));_0x59b39c[_0xa108('0x1f')]=_0x59b39c[_0xa108('0x1f')]['length']?_0x59b39c['attributes']:_0x51654e['model'];if(!_0x437988['query'][_0xa108('0x21')](_0xa108('0x22'))){_0x59b39c[_0xa108('0x8')]=qs[_0xa108('0x8')](_0x437988[_0xa108('0x1c')]['limit']);_0x59b39c[_0xa108('0x6')]=qs[_0xa108('0x6')](_0x437988[_0xa108('0x1c')]['offset']);}_0x59b39c[_0xa108('0x23')]=qs[_0xa108('0x24')](_0x437988[_0xa108('0x1c')][_0xa108('0x24')]);_0x59b39c['where']=qs[_0xa108('0x1d')](_[_0xa108('0x25')](_0x437988[_0xa108('0x1c')],_0x51654e[_0xa108('0x1d')]),_0x21b300);if(_0x437988[_0xa108('0x1c')][_0xa108('0x26')]){_0x59b39c[_0xa108('0x27')]=_[_0xa108('0x28')](_0x59b39c['where'],{'$or':_['map'](_0x21b300,function(_0x1e4299){if(_0x1e4299[_0xa108('0x19')]!==_0xa108('0x29')){var _0x4fc8fd={};_0x4fc8fd[_0x1e4299[_0xa108('0x14')]]={'$like':'%'+_0x437988[_0xa108('0x1c')][_0xa108('0x26')]+'%'};return _0x4fc8fd;}})});}_0x59b39c=_[_0xa108('0x28')]({},_0x59b39c,_0x437988[_0xa108('0x2a')]);var _0x4043ec={'where':_0x59b39c[_0xa108('0x27')]};return db[_0xa108('0x2b')][_0xa108('0x9')](_0x4043ec)[_0xa108('0xe')](function(_0x23dd74){_0x3e28a5['count']=_0x23dd74;if(_0x437988['query'][_0xa108('0x2c')]){_0x59b39c[_0xa108('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xa108('0x2e')](_0x59b39c);})[_0xa108('0xe')](function(_0x1275af){_0x3e28a5[_0xa108('0x2f')]=_0x1275af;return _0x3e28a5;})[_0xa108('0xe')](respondWithFilteredResult(_0xaa4730,_0x59b39c))[_0xa108('0x30')](handleError(_0xaa4730,null));};exports['show']=function(_0x52d581,_0x40b9b0){var _0x2b25a2={'raw':![],'where':{'id':_0x52d581['params']['id']}},_0x335146={};_0x335146[_0xa108('0x1a')]=_[_0xa108('0x1b')](db[_0xa108('0x2b')][_0xa108('0x17')]);_0x335146['query']=_[_0xa108('0x1b')](_0x52d581[_0xa108('0x1c')]);_0x335146['filters']=_[_0xa108('0x1e')](_0x335146[_0xa108('0x1a')],_0x335146['query']);_0x2b25a2['attributes']=_[_0xa108('0x1e')](_0x335146[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x52d581[_0xa108('0x1c')][_0xa108('0x20')]));_0x2b25a2[_0xa108('0x1f')]=_0x2b25a2[_0xa108('0x1f')][_0xa108('0x31')]?_0x2b25a2['attributes']:_0x335146[_0xa108('0x1a')];if(_0x52d581[_0xa108('0x1c')][_0xa108('0x2c')]){_0x2b25a2[_0xa108('0x2d')]=[{'all':!![]}];}_0x2b25a2=_[_0xa108('0x28')]({},_0x2b25a2,_0x52d581[_0xa108('0x2a')]);return db[_0xa108('0x2b')]['find'](_0x2b25a2)['then'](handleEntityNotFound(_0x40b9b0,null))[_0xa108('0xe')](respondWithResult(_0x40b9b0,null))[_0xa108('0x30')](handleError(_0x40b9b0,null));};exports[_0xa108('0x32')]=function(_0x5d38d7,_0x2998c7){return db['Dynamics365Account'][_0xa108('0x32')](_0x5d38d7[_0xa108('0x33')],{})['then'](respondWithResult(_0x2998c7,0xc9))[_0xa108('0x30')](handleError(_0x2998c7,null));};exports[_0xa108('0xd')]=function(_0x329c2d,_0x5be856){if(_0x329c2d['body']['id']){delete _0x329c2d['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x329c2d['params']['id']}})['then'](handleEntityNotFound(_0x5be856,null))[_0xa108('0xe')](saveUpdates(_0x329c2d['body'],null))[_0xa108('0xe')](respondWithResult(_0x5be856,null))['catch'](handleError(_0x5be856,null));};exports[_0xa108('0xf')]=function(_0x36e56b,_0x3e812a){return db['Dynamics365Account'][_0xa108('0x34')]({'where':{'id':_0x36e56b[_0xa108('0x35')]['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x3e812a,null))[_0xa108('0xe')](removeEntity(_0x3e812a,null))[_0xa108('0x30')](handleError(_0x3e812a,null));};exports[_0xa108('0x36')]=function(_0x1bdf21,_0x493bb5){var _0x57303b={};var _0x399c81={};var _0x571085;var _0xa97b36;return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x1bdf21[_0xa108('0x35')]['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x493bb5,null))[_0xa108('0xe')](function(_0x1c7ab9){if(_0x1c7ab9){_0x571085=_0x1c7ab9;_0x399c81[_0xa108('0x1a')]=_['keys'](db[_0xa108('0x38')][_0xa108('0x17')]);_0x399c81['query']=_[_0xa108('0x1b')](_0x1bdf21[_0xa108('0x1c')]);_0x399c81[_0xa108('0x1d')]=_[_0xa108('0x1e')](_0x399c81[_0xa108('0x1a')],_0x399c81['query']);_0x57303b[_0xa108('0x1f')]=_[_0xa108('0x1e')](_0x399c81[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x1bdf21[_0xa108('0x1c')][_0xa108('0x20')]));_0x57303b[_0xa108('0x1f')]=_0x57303b[_0xa108('0x1f')][_0xa108('0x31')]?_0x57303b[_0xa108('0x1f')]:_0x399c81[_0xa108('0x1a')];_0x57303b['order']=qs[_0xa108('0x24')](_0x1bdf21[_0xa108('0x1c')]['sort']);_0x57303b['where']=qs[_0xa108('0x1d')](_['pick'](_0x1bdf21[_0xa108('0x1c')],_0x399c81[_0xa108('0x1d')]));if(_0x1bdf21['query'][_0xa108('0x26')]){_0x57303b[_0xa108('0x27')]=_[_0xa108('0x28')](_0x57303b[_0xa108('0x27')],{'$or':_['map'](_0x57303b[_0xa108('0x1f')],function(_0x3e796a){var _0x48a162={};_0x48a162[_0x3e796a]={'$like':'%'+_0x1bdf21[_0xa108('0x1c')]['filter']+'%'};return _0x48a162;})});}_0x57303b=_[_0xa108('0x28')]({},_0x57303b,_0x1bdf21[_0xa108('0x2a')]);return _0x571085['getConfigurations'](_0x57303b);}})[_0xa108('0xe')](function(_0x43b981){if(_0x43b981){_0xa97b36=_0x43b981['length'];if(!_0x1bdf21[_0xa108('0x1c')][_0xa108('0x21')](_0xa108('0x22'))){_0x57303b[_0xa108('0x8')]=qs[_0xa108('0x8')](_0x1bdf21[_0xa108('0x1c')][_0xa108('0x8')]);_0x57303b[_0xa108('0x6')]=qs[_0xa108('0x6')](_0x1bdf21[_0xa108('0x1c')]['offset']);}return _0x571085[_0xa108('0x36')](_0x57303b);}})['then'](function(_0x12f9af){if(_0x12f9af){return _0x12f9af?{'count':_0xa97b36,'rows':_0x12f9af}:null;}})['then'](respondWithResult(_0x493bb5,null))[_0xa108('0x30')](handleError(_0x493bb5,null));};exports['addConfiguration']=function(_0x50b751,_0x5ad858){if(_0x50b751[_0xa108('0x33')]['id']){delete _0x50b751[_0xa108('0x33')]['id'];}return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x50b751['params']['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x5ad858,null))['then'](function(_0x4d3b11){if(_0x4d3b11){_0x50b751[_0xa108('0x33')]['AccountId']=_0x4d3b11['id'];_0x50b751[_0xa108('0x33')]['Subjects']=integrations[_0xa108('0x39')](_0x50b751[_0xa108('0x33')][_0xa108('0x3a')],_0x50b751[_0xa108('0x33')][_0xa108('0x19')]);_0x50b751['body'][_0xa108('0x3b')]=integrations['getDescriptions'](_0x50b751[_0xa108('0x33')][_0xa108('0x3a')],_0x50b751[_0xa108('0x33')][_0xa108('0x19')]);return db['Dynamics365Configuration'][_0xa108('0x32')](_0x50b751['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xa108('0x3c')],'as':_0xa108('0x3b')}]});}return null;})[_0xa108('0xe')](respondWithResult(_0x5ad858,null))['catch'](handleError(_0x5ad858,null));};function sanitizeRemoteUri(_0x3f5672){var _0x880825=_0x3f5672[_0xa108('0x3d')](-0x1);if(_0x880825==='/')return _0x3f5672[_0xa108('0x3e')](0x0,_0x3f5672[_0xa108('0x3f')](_0x880825));return _0x3f5672;}function getWebApiUrl(_0x18a6df){return util[_0xa108('0x40')](_0xa108('0x41'),_0x18a6df);}exports[_0xa108('0x42')]=function(_0x39d059,_0x4c4558){var _0xe82536=_0x39d059[_0xa108('0x1c')][_0xa108('0x43')];var _0x40e654=_0xe82536===_0xa108('0x44')?_0xa108('0x45'):_0xa108('0x46');var _0x13afb0='';var _0x3a4261='';var _0x3a002a='';var _0x2d7d0d='';var _0x73ca70='';var _0x31f55e='';var _0x42491f='';var _0x4c85d1='';var _0x326856=['title',_0xa108('0x47'),'customerid',_0xa108('0x48'),_0xa108('0x49'),_0xa108('0x4a'),_0xa108('0x4b'),_0xa108('0x4c'),_0xa108('0x4d'),_0xa108('0x4e')];var _0x37064d=[_0xa108('0x4f'),_0xa108('0x50'),_0xa108('0x51'),_0xa108('0x52'),_0xa108('0x53'),_0xa108('0x54'),_0xa108('0x55'),_0xa108('0x56'),_0xa108('0x57'),_0xa108('0x58'),_0xa108('0x59'),'createdbyyominame','createdon',_0xa108('0x5a'),'createdonbehalfbyyominame',_0xa108('0x5b'),_0xa108('0x5c'),_0xa108('0x5d'),'emailaddress','entitlementidname','entityimage_timestamp',_0xa108('0x5e'),_0xa108('0x5f'),'exchangerate',_0xa108('0x60'),_0xa108('0x61'),_0xa108('0x62'),'influencescore',_0xa108('0x63'),_0xa108('0x64'),_0xa108('0x65'),_0xa108('0x66'),_0xa108('0x67'),_0xa108('0x68'),'modifiedbyyominame','modifiedon',_0xa108('0x69'),'modifiedonbehalfbyyominame',_0xa108('0x6a'),_0xa108('0x6b'),'numberofchildincidents',_0xa108('0x6c'),'overriddencreatedon',_0xa108('0x6d'),_0xa108('0x6e'),_0xa108('0x6f'),_0xa108('0x70'),_0xa108('0x71'),'primarycontactidyominame',_0xa108('0x72'),_0xa108('0x73'),'productserialnumber',_0xa108('0x74'),_0xa108('0x75'),_0xa108('0x76'),_0xa108('0x77'),_0xa108('0x78'),_0xa108('0x79'),'slainvokedidname',_0xa108('0x7a'),_0xa108('0x7b'),_0xa108('0x7c'),_0xa108('0x7d'),'subjectidname',_0xa108('0x7e'),_0xa108('0x7f'),'transactioncurrencyidname',_0xa108('0x80'),'utcconversiontimezonecode',_0xa108('0x81')];var _0x15f263=_0x326856[_0xa108('0x82')](_0x37064d);return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x39d059[_0xa108('0x35')]['id']},'attributes':['id',_0xa108('0x83'),_0xa108('0x84'),_0xa108('0x85'),_0xa108('0x86'),_0xa108('0x87'),_0xa108('0x88'),_0xa108('0x89')],'include':[{'model':db['CloudProvider'],'as':_0xa108('0x8a'),'attributes':['id','data5',_0xa108('0x8b')]}]})[_0xa108('0xe')](handleEntityNotFound(_0x4c4558,null))[_0xa108('0xe')](function(_0x557ab1){if(_0x557ab1){if(_0x557ab1[_0xa108('0x89')]){_0x557ab1['access_token']=_0x557ab1[_0xa108('0x8a')][_0xa108('0x8c')];_0x4c85d1=sanitizeRemoteUri(_0x557ab1[_0xa108('0x8a')][_0xa108('0x8b')]);_0x42491f=getWebApiUrl(_0x4c85d1);return _0x557ab1;}_0x4c85d1=sanitizeRemoteUri(_0x557ab1[_0xa108('0x85')]);_0x42491f=getWebApiUrl(_0x4c85d1);var _0x5b2117={'method':_0xa108('0x8d'),'uri':_0xa108('0x8e')+_0x557ab1[_0xa108('0x86')]+_0xa108('0x8f'),'form':{'client_id':_0x557ab1['clientId'],'resource':_0x4c85d1,'username':_0x557ab1[_0xa108('0x83')],'password':_0x557ab1[_0xa108('0x84')],'grant_type':'password','client_secret':_0x557ab1['clientSecret']},'json':!![]};return rp(_0x5b2117);}})[_0xa108('0xe')](function(_0x61013d){_0x31f55e=_0x61013d[_0xa108('0x90')];var _0x4da4d2={'method':_0xa108('0x91'),'uri':encodeURI(_0x42491f+_0xa108('0x92')+_0x40e654+'\x27'),'headers':{'Authorization':_0xa108('0x93')+_0x31f55e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4da4d2);})[_0xa108('0xe')](function(_0x28f1e3){var _0xe2b41e=_0x28f1e3[_0xa108('0x94')][0x0];var _0x119cfe=_0xe2b41e[_0xa108('0x95')];var _0x191a3f={'method':_0xa108('0x91'),'uri':_0x42491f+_0xa108('0x96')+_0x119cfe+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xa108('0x93')+_0x31f55e,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x191a3f);})[_0xa108('0xe')](function(_0x3a8f65){_0x13afb0=_0x3a8f65;_0x3a4261=_0x13afb0[_0xa108('0x98')];_0x3a4261=_[_0xa108('0x99')](_0x3a4261,function(_0x708bb9){return!_0x15f263[_0xa108('0x9a')](_0x708bb9['LogicalName']);});var _0x4b30e2=[];var _0x2d579f=[];_0x3a4261['forEach'](function(_0x4aac8f){if(_0x4aac8f[_0xa108('0x9b')]){var _0x9d0d14=_0x4aac8f[_0xa108('0x9b')][_0xa108('0x3e')](_0x4aac8f[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x9d0d14===_0xa108('0x9c')){_0x4b30e2[_0xa108('0x9d')](getSelectList(_0x42491f,_0xe82536,_0x2d579f,_0x13afb0[_0xa108('0x95')],_0x4aac8f[_0xa108('0x95')],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x4b30e2);})[_0xa108('0xe')](function(_0x448d3a){_0x3a002a=_0x448d3a[0x0];var _0x27d02e=[];var _0xd07b9d=[];_0x3a4261[_0xa108('0x9f')](function(_0x39d36a){if(!_[_0xa108('0xa0')](_0x39d36a['@odata.type'])){var _0x3f4ca4=_0x39d36a[_0xa108('0x9b')][_0xa108('0x3e')](_0x39d36a[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x3f4ca4===_0xa108('0xa1')){_0x27d02e[_0xa108('0x9d')](getBooleanList(_0x42491f,_0xe82536,_0xd07b9d,_0x13afb0[_0xa108('0x95')],_0x39d36a['MetadataId'],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x27d02e);})['then'](function(_0x4ab264){_0x2d7d0d=_0x4ab264[0x0];var _0x18c196=[];var _0x8790a7=[];_0x3a4261[_0xa108('0x9f')](function(_0x47ab5f){if(_0x47ab5f[_0xa108('0x9b')]){var _0x13421c=_0x47ab5f[_0xa108('0x9b')][_0xa108('0x3e')](_0x47ab5f[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x13421c===_0xa108('0xa2')||_0x13421c===_0xa108('0xa3')||_0x13421c===_0xa108('0xa4')||_0x13421c===_0xa108('0xa5')||_0x13421c===_0xa108('0xa6')||_0x13421c===_0xa108('0xa7')||_0x13421c===_0xa108('0xa8')||_0x13421c==='EntityNameAttributeMetadata'||_0x13421c===_0xa108('0xa9')||_0x13421c===_0xa108('0xaa')){_0x18c196[_0xa108('0x9d')](getInputList(_0x42491f,_0xe82536,_0x13421c,_0x8790a7,_0x13afb0[_0xa108('0x95')],_0x47ab5f[_0xa108('0x95')],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x18c196);})[_0xa108('0xe')](function(_0x315f43){_0x73ca70=_0x315f43[0x0];var _0x45907=_0x3a002a[_0xa108('0x82')](_0x2d7d0d)[_0xa108('0x82')](_0x73ca70);var _0x224580={'count':_0x45907[_0xa108('0x31')],'rows':_0x45907};return _0x224580;})[_0xa108('0xe')](respondWithResult(_0x4c4558,null))['catch'](function(_0x753ac2){var _0xdc3c6b=_0x39d059[_0xa108('0x1c')][_0xa108('0xab')]?0x1f4:_0x753ac2[_0xa108('0xac')]||0x1f4;logger['error'](_0x753ac2[_0xa108('0x13')]);delete _0x753ac2['name'];if(_0xdc3c6b===0x191){_0xdc3c6b=0x190;}_0x4c4558['status'](_0xdc3c6b)['send'](_0x39d059[_0xa108('0x1c')][_0xa108('0xab')]?{'message':_0xa108('0xad'),'statusCode':_0x753ac2[_0xa108('0xac')]}:_0x753ac2);});};function getSelectList(_0x56eea3,_0x4ad6dc,_0x30e1a1,_0x301d99,_0x33e13f,_0x3f8941){var _0x41919e={'method':_0xa108('0x91'),'uri':_0x56eea3+'EntityDefinitions('+_0x301d99+_0xa108('0xae')+_0x33e13f+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xa108('0xaf'),'headers':{'Authorization':_0xa108('0x93')+_0x3f8941,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x41919e)['then'](function(_0x20a3e1){var _0x334c64=[];var _0xd083ae=_0x20a3e1[_0xa108('0xb0')][_0xa108('0xb1')];_0xd083ae['forEach'](function(_0x101374){_0x334c64[_0xa108('0x9d')]({'name':_0x101374[_0xa108('0xb2')][_0xa108('0xb3')]['Label'],'value':String(_0x101374[_0xa108('0xb4')])});});var _0x58ce3a={'id':_0x4ad6dc+'_'+_0x20a3e1[_0xa108('0xb5')],'name':_0x20a3e1[_0xa108('0xb6')]['UserLocalizedLabel'][_0xa108('0xb2')],'custom':![],'options':_0x334c64};_0x30e1a1['push'](_0x58ce3a);return _0x30e1a1;});}function getBooleanList(_0x2c49e3,_0x38962a,_0x391e3c,_0xfc0310,_0x595b25,_0x50a152){var _0x44e927={'method':_0xa108('0x91'),'uri':_0x2c49e3+_0xa108('0x96')+_0xfc0310+_0xa108('0xae')+_0x595b25+_0xa108('0xb7'),'headers':{'Authorization':_0xa108('0x93')+_0x50a152,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x44e927)[_0xa108('0xe')](function(_0x582d77){var _0x49793c=[];_0x49793c[_0xa108('0x9d')]({'name':_0x582d77[_0xa108('0xb0')][_0xa108('0xb8')]['Label'][_0xa108('0xb3')][_0xa108('0xb2')],'value':'true'},{'name':_0x582d77[_0xa108('0xb0')][_0xa108('0xb9')][_0xa108('0xb2')][_0xa108('0xb3')][_0xa108('0xb2')],'value':_0xa108('0xba')});var _0x252569={'id':_0x38962a+'_'+_0x582d77['LogicalName'],'name':_0x582d77[_0xa108('0xb6')][_0xa108('0xb3')][_0xa108('0xb2')],'custom':![],'options':_0x49793c};_0x391e3c[_0xa108('0x9d')](_0x252569);return _0x391e3c;});}function getInputList(_0x4b3290,_0x128ebb,_0x140019,_0xba67ec,_0x3a1ccf,_0x5a7bab,_0x3b3d86){var _0x412ef4={'method':'GET','uri':_0x4b3290+_0xa108('0x96')+_0x3a1ccf+_0xa108('0xae')+_0x5a7bab+')/Microsoft.Dynamics.CRM.'+_0x140019+_0xa108('0xbb'),'headers':{'Authorization':_0xa108('0x93')+_0x3b3d86,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x412ef4)[_0xa108('0xe')](function(_0xa47705){var _0x3b9788={'id':_0x128ebb+'_'+_0xa47705[_0xa108('0xb5')],'name':_0xa47705[_0xa108('0xb6')][_0xa108('0xb3')]?_0xa47705[_0xa108('0xb6')][_0xa108('0xb3')]['Label']:_0xa47705['LogicalName'],'custom':![],'options':[]};_0xba67ec[_0xa108('0x9d')](_0x3b9788);return _0xba67ec;});} \ No newline at end of file +var _0x85f8=['overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','PicklistAttributeMetadata','push','MetadataId','all','@odata.type','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','stack','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','api','../../components/integrations/configuration','status','json','undefined','count','offset','set','Content-Range','destroy','then','end','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','create','update','body','find','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','customeridtype','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85f8,0x10f));var _0x885f=function(_0x46bc57,_0x3eb260){_0x46bc57=_0x46bc57-0x0;var _0x417b7e=_0x85f8[_0x46bc57];return _0x417b7e;};'use strict';var rp=require(_0x885f('0x0'));var util=require(_0x885f('0x1'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x885f('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0x885f('0x3'));function respondWithResult(_0x871785,_0x2425f7){_0x2425f7=_0x2425f7||0xc8;return function(_0x444c12){if(_0x444c12){return _0x871785[_0x885f('0x4')](_0x2425f7)[_0x885f('0x5')](_0x444c12);}};}function respondWithFilteredResult(_0x578126,_0x4f8f5c){return function(_0x43f1d5){if(_0x43f1d5){var _0x4783ee=typeof _0x4f8f5c['offset']===_0x885f('0x6')&&typeof _0x4f8f5c['limit']===_0x885f('0x6');var _0x34c5b8=_0x43f1d5[_0x885f('0x7')];var _0x2834e1=_0x4783ee?0x0:_0x4f8f5c[_0x885f('0x8')];var _0x4c3b7a=_0x4783ee?_0x43f1d5[_0x885f('0x7')]:_0x4f8f5c[_0x885f('0x8')]+_0x4f8f5c['limit'];var _0x5dfb75;if(_0x4c3b7a>=_0x34c5b8){_0x4c3b7a=_0x34c5b8;_0x5dfb75=0xc8;}else{_0x5dfb75=0xce;}_0x578126[_0x885f('0x4')](_0x5dfb75);return _0x578126[_0x885f('0x9')](_0x885f('0xa'),_0x2834e1+'-'+_0x4c3b7a+'/'+_0x34c5b8)[_0x885f('0x5')](_0x43f1d5);}return null;};}function saveUpdates(_0xfdbf00){return function(_0x4147fb){if(_0x4147fb){return _0x4147fb['update'](_0xfdbf00)['then'](function(_0x2633e3){return _0x2633e3;});}return null;};}function removeEntity(_0x138593){return function(_0x1f69c1){if(_0x1f69c1){return _0x1f69c1[_0x885f('0xb')]()[_0x885f('0xc')](function(){_0x138593[_0x885f('0x4')](0xcc)[_0x885f('0xd')]();});}};}function handleEntityNotFound(_0x4115cd){return function(_0x2b377d){if(!_0x2b377d){_0x4115cd['sendStatus'](0x194);}return _0x2b377d;};}function handleError(_0x1c6760,_0x2200ad){_0x2200ad=_0x2200ad||0x1f4;return function(_0x15e5e5){logger[_0x885f('0xe')](_0x15e5e5['stack']);if(_0x15e5e5[_0x885f('0xf')]){delete _0x15e5e5[_0x885f('0xf')];}_0x1c6760['status'](_0x2200ad)[_0x885f('0x10')](_0x15e5e5);};}exports[_0x885f('0x11')]=function(_0x42cd96,_0x4b3796){var _0x4bab3f={},_0x4f5958={},_0x542994={'count':0x0,'rows':[]};var _0x28ac51=_[_0x885f('0x12')](db[_0x885f('0x13')][_0x885f('0x14')],function(_0x37ba64){return{'name':_0x37ba64[_0x885f('0x15')],'type':_0x37ba64['type'][_0x885f('0x16')]};});_0x4f5958[_0x885f('0x17')]=_[_0x885f('0x12')](_0x28ac51,'name');_0x4f5958[_0x885f('0x18')]=_[_0x885f('0x19')](_0x42cd96[_0x885f('0x18')]);_0x4f5958[_0x885f('0x1a')]=_[_0x885f('0x1b')](_0x4f5958[_0x885f('0x17')],_0x4f5958[_0x885f('0x18')]);_0x4bab3f['attributes']=_[_0x885f('0x1b')](_0x4f5958['model'],qs[_0x885f('0x1c')](_0x42cd96[_0x885f('0x18')]['fields']));_0x4bab3f[_0x885f('0x1d')]=_0x4bab3f[_0x885f('0x1d')][_0x885f('0x1e')]?_0x4bab3f[_0x885f('0x1d')]:_0x4f5958[_0x885f('0x17')];if(!_0x42cd96[_0x885f('0x18')][_0x885f('0x1f')](_0x885f('0x20'))){_0x4bab3f['limit']=qs[_0x885f('0x21')](_0x42cd96[_0x885f('0x18')][_0x885f('0x21')]);_0x4bab3f[_0x885f('0x8')]=qs[_0x885f('0x8')](_0x42cd96[_0x885f('0x18')][_0x885f('0x8')]);}_0x4bab3f[_0x885f('0x22')]=qs[_0x885f('0x23')](_0x42cd96[_0x885f('0x18')][_0x885f('0x23')]);_0x4bab3f[_0x885f('0x24')]=qs[_0x885f('0x1a')](_['pick'](_0x42cd96['query'],_0x4f5958[_0x885f('0x1a')]),_0x28ac51);if(_0x42cd96[_0x885f('0x18')][_0x885f('0x25')]){_0x4bab3f['where']=_[_0x885f('0x26')](_0x4bab3f[_0x885f('0x24')],{'$or':_['map'](_0x28ac51,function(_0x523f55){if(_0x523f55['type']!=='VIRTUAL'){var _0x4497cf={};_0x4497cf[_0x523f55[_0x885f('0xf')]]={'$like':'%'+_0x42cd96[_0x885f('0x18')][_0x885f('0x25')]+'%'};return _0x4497cf;}})});}_0x4bab3f=_[_0x885f('0x26')]({},_0x4bab3f,_0x42cd96[_0x885f('0x27')]);var _0x148c45={'where':_0x4bab3f['where']};return db[_0x885f('0x13')]['count'](_0x148c45)[_0x885f('0xc')](function(_0x1f7e04){_0x542994[_0x885f('0x7')]=_0x1f7e04;if(_0x42cd96[_0x885f('0x18')][_0x885f('0x28')]){_0x4bab3f[_0x885f('0x29')]=[{'all':!![]}];}return db[_0x885f('0x13')][_0x885f('0x2a')](_0x4bab3f);})['then'](function(_0x1a5318){_0x542994['rows']=_0x1a5318;return _0x542994;})[_0x885f('0xc')](respondWithFilteredResult(_0x4b3796,_0x4bab3f))[_0x885f('0x2b')](handleError(_0x4b3796,null));};exports[_0x885f('0x2c')]=function(_0x58a7e9,_0x3d9cd4){var _0x488a78={'raw':![],'where':{'id':_0x58a7e9[_0x885f('0x2d')]['id']}},_0x532ccc={};_0x532ccc[_0x885f('0x17')]=_[_0x885f('0x19')](db['Dynamics365Account'][_0x885f('0x14')]);_0x532ccc[_0x885f('0x18')]=_[_0x885f('0x19')](_0x58a7e9[_0x885f('0x18')]);_0x532ccc[_0x885f('0x1a')]=_[_0x885f('0x1b')](_0x532ccc[_0x885f('0x17')],_0x532ccc[_0x885f('0x18')]);_0x488a78[_0x885f('0x1d')]=_[_0x885f('0x1b')](_0x532ccc[_0x885f('0x17')],qs[_0x885f('0x1c')](_0x58a7e9['query'][_0x885f('0x1c')]));_0x488a78[_0x885f('0x1d')]=_0x488a78['attributes'][_0x885f('0x1e')]?_0x488a78['attributes']:_0x532ccc[_0x885f('0x17')];if(_0x58a7e9[_0x885f('0x18')][_0x885f('0x28')]){_0x488a78['include']=[{'all':!![]}];}_0x488a78=_[_0x885f('0x26')]({},_0x488a78,_0x58a7e9[_0x885f('0x27')]);return db[_0x885f('0x13')]['find'](_0x488a78)[_0x885f('0xc')](handleEntityNotFound(_0x3d9cd4,null))[_0x885f('0xc')](respondWithResult(_0x3d9cd4,null))[_0x885f('0x2b')](handleError(_0x3d9cd4,null));};exports[_0x885f('0x2e')]=function(_0x4da028,_0x49c6f7){return db[_0x885f('0x13')][_0x885f('0x2e')](_0x4da028['body'],{})['then'](respondWithResult(_0x49c6f7,0xc9))[_0x885f('0x2b')](handleError(_0x49c6f7,null));};exports[_0x885f('0x2f')]=function(_0x25d645,_0xc122b3){if(_0x25d645[_0x885f('0x30')]['id']){delete _0x25d645[_0x885f('0x30')]['id'];}return db[_0x885f('0x13')][_0x885f('0x31')]({'where':{'id':_0x25d645['params']['id']}})[_0x885f('0xc')](handleEntityNotFound(_0xc122b3,null))[_0x885f('0xc')](saveUpdates(_0x25d645[_0x885f('0x30')],null))[_0x885f('0xc')](respondWithResult(_0xc122b3,null))[_0x885f('0x2b')](handleError(_0xc122b3,null));};exports[_0x885f('0xb')]=function(_0x27a3b7,_0x1d09e9){return db[_0x885f('0x13')][_0x885f('0x31')]({'where':{'id':_0x27a3b7['params']['id']}})['then'](handleEntityNotFound(_0x1d09e9,null))['then'](removeEntity(_0x1d09e9,null))[_0x885f('0x2b')](handleError(_0x1d09e9,null));};exports[_0x885f('0x32')]=function(_0x55d300,_0x5288bd){var _0x13fd42={};var _0x16458a={};var _0x15ff35;var _0x4289af;return db[_0x885f('0x13')][_0x885f('0x33')]({'where':{'id':_0x55d300[_0x885f('0x2d')]['id']}})[_0x885f('0xc')](handleEntityNotFound(_0x5288bd,null))[_0x885f('0xc')](function(_0x2844c0){if(_0x2844c0){_0x15ff35=_0x2844c0;_0x16458a['model']=_[_0x885f('0x19')](db['Dynamics365Configuration'][_0x885f('0x14')]);_0x16458a['query']=_[_0x885f('0x19')](_0x55d300['query']);_0x16458a['filters']=_[_0x885f('0x1b')](_0x16458a[_0x885f('0x17')],_0x16458a['query']);_0x13fd42[_0x885f('0x1d')]=_['intersection'](_0x16458a[_0x885f('0x17')],qs[_0x885f('0x1c')](_0x55d300[_0x885f('0x18')][_0x885f('0x1c')]));_0x13fd42[_0x885f('0x1d')]=_0x13fd42[_0x885f('0x1d')]['length']?_0x13fd42[_0x885f('0x1d')]:_0x16458a['model'];_0x13fd42[_0x885f('0x22')]=qs[_0x885f('0x23')](_0x55d300['query'][_0x885f('0x23')]);_0x13fd42[_0x885f('0x24')]=qs[_0x885f('0x1a')](_[_0x885f('0x34')](_0x55d300[_0x885f('0x18')],_0x16458a['filters']));if(_0x55d300[_0x885f('0x18')][_0x885f('0x25')]){_0x13fd42[_0x885f('0x24')]=_[_0x885f('0x26')](_0x13fd42[_0x885f('0x24')],{'$or':_[_0x885f('0x12')](_0x13fd42[_0x885f('0x1d')],function(_0x660c1f){var _0x17fa85={};_0x17fa85[_0x660c1f]={'$like':'%'+_0x55d300[_0x885f('0x18')][_0x885f('0x25')]+'%'};return _0x17fa85;})});}_0x13fd42=_[_0x885f('0x26')]({},_0x13fd42,_0x55d300[_0x885f('0x27')]);return _0x15ff35[_0x885f('0x32')](_0x13fd42);}})[_0x885f('0xc')](function(_0x1c2f16){if(_0x1c2f16){_0x4289af=_0x1c2f16[_0x885f('0x1e')];if(!_0x55d300[_0x885f('0x18')]['hasOwnProperty']('nolimit')){_0x13fd42['limit']=qs[_0x885f('0x21')](_0x55d300[_0x885f('0x18')]['limit']);_0x13fd42[_0x885f('0x8')]=qs['offset'](_0x55d300[_0x885f('0x18')][_0x885f('0x8')]);}return _0x15ff35[_0x885f('0x32')](_0x13fd42);}})[_0x885f('0xc')](function(_0x16938b){if(_0x16938b){return _0x16938b?{'count':_0x4289af,'rows':_0x16938b}:null;}})[_0x885f('0xc')](respondWithResult(_0x5288bd,null))[_0x885f('0x2b')](handleError(_0x5288bd,null));};exports[_0x885f('0x35')]=function(_0x4d486d,_0xb9c900){if(_0x4d486d['body']['id']){delete _0x4d486d[_0x885f('0x30')]['id'];}return db[_0x885f('0x13')][_0x885f('0x33')]({'where':{'id':_0x4d486d['params']['id']}})[_0x885f('0xc')](handleEntityNotFound(_0xb9c900,null))['then'](function(_0x160474){if(_0x160474){_0x4d486d[_0x885f('0x30')][_0x885f('0x36')]=_0x160474['id'];_0x4d486d[_0x885f('0x30')][_0x885f('0x37')]=integrations[_0x885f('0x38')](_0x4d486d['body']['channel'],_0x4d486d['body'][_0x885f('0x39')]);_0x4d486d[_0x885f('0x30')][_0x885f('0x3a')]=integrations[_0x885f('0x3b')](_0x4d486d[_0x885f('0x30')]['channel'],_0x4d486d[_0x885f('0x30')][_0x885f('0x39')]);return db[_0x885f('0x3c')][_0x885f('0x2e')](_0x4d486d[_0x885f('0x30')],{'include':[{'model':db[_0x885f('0x3d')],'as':_0x885f('0x37')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x885f('0xc')](respondWithResult(_0xb9c900,null))['catch'](handleError(_0xb9c900,null));};function sanitizeRemoteUri(_0x2bff34){var _0x450fd8=_0x2bff34[_0x885f('0x3e')](-0x1);if(_0x450fd8==='/')return _0x2bff34[_0x885f('0x3f')](0x0,_0x2bff34[_0x885f('0x40')](_0x450fd8));return _0x2bff34;}function getWebApiUrl(_0x430d42){return util[_0x885f('0x41')](_0x885f('0x42'),_0x430d42);}exports[_0x885f('0x43')]=function(_0x2510d5,_0x3bc01a){var _0x357f9d=_0x2510d5[_0x885f('0x18')][_0x885f('0x44')];var _0x227261=_0x357f9d===_0x885f('0x45')?_0x885f('0x46'):_0x885f('0x47');var _0x50bdee='';var _0x5bfecb='';var _0x20c330='';var _0x4d6ae5='';var _0x3830bc='';var _0x39e5d4='';var _0x578520='';var _0x32d3b5='';var _0x3a6805=[_0x885f('0x48'),'description',_0x885f('0x49'),'ownerid','caseorigincode',_0x885f('0x4a'),_0x885f('0x4b'),_0x885f('0x4c'),'directioncode','phonecall_activity_parties'];var _0xcf5cf8=[_0x885f('0x4d'),'accountidyominame',_0x885f('0x4e'),_0x885f('0x4f'),'contactidname',_0x885f('0x50'),_0x885f('0x51'),_0x885f('0x52'),_0x885f('0x53'),_0x885f('0x54'),'createdbyname','createdbyyominame',_0x885f('0x55'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname',_0x885f('0x56'),'customeridyominame',_0x885f('0x57'),'entitlementidname','entityimage_timestamp',_0x885f('0x58'),_0x885f('0x59'),_0x885f('0x5a'),_0x885f('0x5b'),_0x885f('0x5c'),_0x885f('0x5d'),'influencescore','kbarticleidname',_0x885f('0x5e'),_0x885f('0x5f'),_0x885f('0x60'),_0x885f('0x61'),_0x885f('0x62'),'modifiedbyyominame','modifiedon','modifiedonbehalfbyname',_0x885f('0x63'),_0x885f('0x64'),'msdyn_iotalertname',_0x885f('0x65'),_0x885f('0x66'),_0x885f('0x67'),_0x885f('0x68'),_0x885f('0x69'),_0x885f('0x6a'),_0x885f('0x6b'),_0x885f('0x6c'),_0x885f('0x6d'),_0x885f('0x6e'),_0x885f('0x6f'),_0x885f('0x70'),_0x885f('0x71'),_0x885f('0x72'),_0x885f('0x73'),_0x885f('0x74'),_0x885f('0x75'),'sentimentvalue',_0x885f('0x76'),_0x885f('0x77'),_0x885f('0x78'),_0x885f('0x79'),'statuscode','subjectidname','ticketnumber',_0x885f('0x7a'),_0x885f('0x7b'),'traversedpath',_0x885f('0x7c'),_0x885f('0x7d')];var _0x3a6d7a=_0x3a6805['concat'](_0xcf5cf8);return db[_0x885f('0x13')]['findOne']({'where':{'id':_0x2510d5[_0x885f('0x2d')]['id']},'attributes':['id',_0x885f('0x7e'),_0x885f('0x7f'),_0x885f('0x80'),_0x885f('0x81'),'clientId','clientSecret',_0x885f('0x82')],'include':[{'model':db['CloudProvider'],'as':_0x885f('0x83'),'attributes':['id',_0x885f('0x84'),'data7']}]})[_0x885f('0xc')](handleEntityNotFound(_0x3bc01a,null))['then'](function(_0x5dd0b4){if(_0x5dd0b4){if(_0x5dd0b4['modernAuthentication']){_0x5dd0b4[_0x885f('0x85')]=_0x5dd0b4[_0x885f('0x83')]['data5'];_0x32d3b5=sanitizeRemoteUri(_0x5dd0b4['CloudProvider'][_0x885f('0x86')]);_0x578520=getWebApiUrl(_0x32d3b5);return _0x5dd0b4;}_0x32d3b5=sanitizeRemoteUri(_0x5dd0b4[_0x885f('0x80')]);_0x578520=getWebApiUrl(_0x32d3b5);var _0x46ef2b={'method':_0x885f('0x87'),'uri':_0x885f('0x88')+_0x5dd0b4[_0x885f('0x81')]+_0x885f('0x89'),'form':{'client_id':_0x5dd0b4[_0x885f('0x8a')],'resource':_0x32d3b5,'username':_0x5dd0b4[_0x885f('0x7e')],'password':_0x5dd0b4[_0x885f('0x7f')],'grant_type':'password','client_secret':_0x5dd0b4[_0x885f('0x8b')]},'json':!![]};return rp(_0x46ef2b);}})[_0x885f('0xc')](function(_0x2a0cac){_0x39e5d4=_0x2a0cac['access_token'];var _0x2df0ad={'method':_0x885f('0x8c'),'uri':encodeURI(_0x578520+_0x885f('0x8d')+_0x227261+'\x27'),'headers':{'Authorization':_0x885f('0x8e')+_0x39e5d4,'If-None-Match':null,'OData-Version':_0x885f('0x8f')},'json':!![]};return rp(_0x2df0ad);})[_0x885f('0xc')](function(_0x425fd9){var _0x55638f=_0x425fd9[_0x885f('0x90')][0x0];var _0x7e3ee4=_0x55638f['MetadataId'];var _0x474539={'method':_0x885f('0x8c'),'uri':_0x578520+'EntityDefinitions('+_0x7e3ee4+_0x885f('0x91'),'headers':{'Authorization':'Bearer\x20'+_0x39e5d4,'If-None-Match':null,'OData-Version':_0x885f('0x8f')},'json':!![]};return rp(_0x474539);})['then'](function(_0x145860){_0x50bdee=_0x145860;_0x5bfecb=_0x50bdee[_0x885f('0x92')];_0x5bfecb=_[_0x885f('0x93')](_0x5bfecb,function(_0x586430){return!_0x3a6d7a[_0x885f('0x94')](_0x586430[_0x885f('0x95')]);});var _0x2c79c3=[];var _0x27a314=[];_0x5bfecb[_0x885f('0x96')](function(_0x3d81aa){if(_0x3d81aa['@odata.type']){var _0x413d8c=_0x3d81aa['@odata.type'][_0x885f('0x3f')](_0x3d81aa['@odata.type'][_0x885f('0x40')]('.')+0x1);if(_0x413d8c===_0x885f('0x97')){_0x2c79c3[_0x885f('0x98')](getSelectList(_0x578520,_0x357f9d,_0x27a314,_0x50bdee['MetadataId'],_0x3d81aa[_0x885f('0x99')],_0x39e5d4));}}});return Promise[_0x885f('0x9a')](_0x2c79c3);})[_0x885f('0xc')](function(_0x2a40e8){_0x20c330=_0x2a40e8[0x0];var _0x49b837=[];var _0x3f81cf=[];_0x5bfecb[_0x885f('0x96')](function(_0x4a286c){if(!_['isNil'](_0x4a286c[_0x885f('0x9b')])){var _0x1d2c55=_0x4a286c['@odata.type'][_0x885f('0x3f')](_0x4a286c[_0x885f('0x9b')][_0x885f('0x40')]('.')+0x1);if(_0x1d2c55===_0x885f('0x9c')){_0x49b837[_0x885f('0x98')](getBooleanList(_0x578520,_0x357f9d,_0x3f81cf,_0x50bdee[_0x885f('0x99')],_0x4a286c['MetadataId'],_0x39e5d4));}}});return Promise[_0x885f('0x9a')](_0x49b837);})[_0x885f('0xc')](function(_0x1386bd){_0x4d6ae5=_0x1386bd[0x0];var _0x2d66ba=[];var _0x5b9d42=[];_0x5bfecb[_0x885f('0x96')](function(_0x429eae){if(_0x429eae[_0x885f('0x9b')]){var _0x3fe323=_0x429eae['@odata.type'][_0x885f('0x3f')](_0x429eae[_0x885f('0x9b')][_0x885f('0x40')]('.')+0x1);if(_0x3fe323===_0x885f('0x9d')||_0x3fe323===_0x885f('0x9e')||_0x3fe323===_0x885f('0x9f')||_0x3fe323===_0x885f('0xa0')||_0x3fe323==='MemoAttributeMetadata'||_0x3fe323===_0x885f('0xa1')||_0x3fe323===_0x885f('0xa2')||_0x3fe323===_0x885f('0xa3')||_0x3fe323==='StateAttributeMetadata'||_0x3fe323===_0x885f('0xa4')){_0x2d66ba[_0x885f('0x98')](getInputList(_0x578520,_0x357f9d,_0x3fe323,_0x5b9d42,_0x50bdee[_0x885f('0x99')],_0x429eae['MetadataId'],_0x39e5d4));}}});return Promise[_0x885f('0x9a')](_0x2d66ba);})['then'](function(_0x6a4fb4){_0x3830bc=_0x6a4fb4[0x0];var _0x4f10e7=_0x20c330[_0x885f('0xa5')](_0x4d6ae5)[_0x885f('0xa5')](_0x3830bc);var _0xca06f={'count':_0x4f10e7[_0x885f('0x1e')],'rows':_0x4f10e7};return _0xca06f;})[_0x885f('0xc')](respondWithResult(_0x3bc01a,null))[_0x885f('0x2b')](function(_0x3aa9b7){var _0x2d38f7=_0x2510d5[_0x885f('0x18')][_0x885f('0xa6')]?0x1f4:_0x3aa9b7[_0x885f('0xa7')]||0x1f4;logger[_0x885f('0xe')](_0x3aa9b7[_0x885f('0xa8')]);delete _0x3aa9b7[_0x885f('0xf')];if(_0x2d38f7===0x191){_0x2d38f7=0x190;}_0x3bc01a[_0x885f('0x4')](_0x2d38f7)[_0x885f('0x10')](_0x2510d5[_0x885f('0x18')][_0x885f('0xa6')]?{'message':_0x885f('0xa9'),'statusCode':_0x3aa9b7[_0x885f('0xa7')]}:_0x3aa9b7);});};function getSelectList(_0x44b8d7,_0x4fcc36,_0x4b00d2,_0x4a7046,_0x1a05e3,_0x2a0d82){var _0x5033f3={'method':_0x885f('0x8c'),'uri':_0x44b8d7+_0x885f('0xaa')+_0x4a7046+_0x885f('0xab')+_0x1a05e3+_0x885f('0xac')+_0x885f('0xad'),'headers':{'Authorization':_0x885f('0x8e')+_0x2a0d82,'If-None-Match':null,'OData-Version':_0x885f('0x8f')},'json':!![]};return rp(_0x5033f3)[_0x885f('0xc')](function(_0x5719be){var _0x4e64c0=[];var _0x85fa79=_0x5719be[_0x885f('0xae')][_0x885f('0xaf')];_0x85fa79[_0x885f('0x96')](function(_0x1d83c7){_0x4e64c0[_0x885f('0x98')]({'name':_0x1d83c7[_0x885f('0xb0')][_0x885f('0xb1')][_0x885f('0xb0')],'value':String(_0x1d83c7[_0x885f('0xb2')])});});var _0x317ec6={'id':_0x4fcc36+'_'+_0x5719be[_0x885f('0x95')],'name':_0x5719be[_0x885f('0xb3')][_0x885f('0xb1')][_0x885f('0xb0')],'custom':![],'options':_0x4e64c0};_0x4b00d2['push'](_0x317ec6);return _0x4b00d2;});}function getBooleanList(_0x31a189,_0x1939b8,_0x3b0a03,_0x4fcf4d,_0x1fed9e,_0x57dbea){var _0x2fcafa={'method':_0x885f('0x8c'),'uri':_0x31a189+_0x885f('0xaa')+_0x4fcf4d+_0x885f('0xab')+_0x1fed9e+_0x885f('0xb4'),'headers':{'Authorization':_0x885f('0x8e')+_0x57dbea,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2fcafa)[_0x885f('0xc')](function(_0x144bec){var _0x2cbe14=[];_0x2cbe14[_0x885f('0x98')]({'name':_0x144bec[_0x885f('0xae')][_0x885f('0xb5')][_0x885f('0xb0')]['UserLocalizedLabel']['Label'],'value':_0x885f('0xb6')},{'name':_0x144bec[_0x885f('0xae')][_0x885f('0xb7')][_0x885f('0xb0')][_0x885f('0xb1')]['Label'],'value':_0x885f('0xb8')});var _0x53e8ff={'id':_0x1939b8+'_'+_0x144bec['LogicalName'],'name':_0x144bec[_0x885f('0xb3')][_0x885f('0xb1')][_0x885f('0xb0')],'custom':![],'options':_0x2cbe14};_0x3b0a03[_0x885f('0x98')](_0x53e8ff);return _0x3b0a03;});}function getInputList(_0x6288f4,_0x426900,_0x2935cd,_0x18ec5b,_0x5a8ca4,_0x5e2532,_0x4fcca1){var _0x5b3587={'method':_0x885f('0x8c'),'uri':_0x6288f4+_0x885f('0xaa')+_0x5a8ca4+')/Attributes('+_0x5e2532+_0x885f('0xb9')+_0x2935cd+_0x885f('0xba'),'headers':{'Authorization':_0x885f('0x8e')+_0x4fcca1,'If-None-Match':null,'OData-Version':_0x885f('0x8f')},'json':!![]};return rp(_0x5b3587)['then'](function(_0x34ce19){var _0x419353={'id':_0x426900+'_'+_0x34ce19['LogicalName'],'name':_0x34ce19['DisplayName'][_0x885f('0xb1')]?_0x34ce19[_0x885f('0xb3')]['UserLocalizedLabel']['Label']:_0x34ce19['LogicalName'],'custom':![],'options':[]};_0x18ec5b['push'](_0x419353);return _0x18ec5b;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f89faa3..5d782c2 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b2d569b..fd35469 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 _0xdb22=['error','message','info','result','catch','Dynamics365Account','findAll','options','raw','where','limit','map','include','attributes','model','GetDynamics365Account','find','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdb22,0x1c3));var _0x2db2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdb22[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2db2('0x0'));var util=require('util');var moment=require(_0x2db2('0x1'));var BPromise=require(_0x2db2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2db2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2db2('0x4'))(_0x2db2('0x5'));var config=require(_0x2db2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2db2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f0b2,_0x4b5065,_0x291099){return new BPromise(function(_0x1e3b80,_0x1fb212){return client['request'](_0x30f0b2,_0x291099)[_0x2db2('0x8')](function(_0x263194){logger['info'](_0x2db2('0x9'),_0x4b5065,_0x2db2('0xa'));logger[_0x2db2('0xb')](_0x2db2('0xc'),_0x4b5065,_0x2db2('0xa'),JSON[_0x2db2('0xd')](_0x263194));if(_0x263194[_0x2db2('0xe')]){if(_0x263194[_0x2db2('0xe')]['code']===0x1f4){logger[_0x2db2('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4b5065,_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);return _0x1fb212(_0x263194[_0x2db2('0xe')]['message']);}logger[_0x2db2('0xe')](_0x2db2('0x9'),_0x4b5065,_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);return _0x1e3b80(_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);}else{logger[_0x2db2('0x10')](_0x2db2('0x9'),_0x4b5065,_0x2db2('0xa'));_0x1e3b80(_0x263194[_0x2db2('0x11')][_0x2db2('0xf')]);}})[_0x2db2('0x12')](function(_0x18c81f){logger[_0x2db2('0xe')](_0x2db2('0x9'),_0x4b5065,_0x18c81f);_0x1fb212(_0x18c81f);});});}exports['GetDynamics365Account']=function(_0x1dedde){var _0x5e50d7=this;return new Promise(function(_0x406ddd,_0x18e2a7){return db[_0x2db2('0x13')][_0x2db2('0x14')]({'raw':_0x1dedde[_0x2db2('0x15')]?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x16')]===undefined?!![]:![]:!![],'where':_0x1dedde['options']?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x17')]||null:null,'attributes':_0x1dedde[_0x2db2('0x15')]?_0x1dedde['options']['attributes']||null:null,'limit':_0x1dedde['options']?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x18')]||null:null,'include':_0x1dedde[_0x2db2('0x15')]?_0x1dedde[_0x2db2('0x15')]['include']?_[_0x2db2('0x19')](_0x1dedde['options'][_0x2db2('0x1a')],function(_0x5767da){return{'model':db[_0x5767da['model']],'as':_0x5767da['as'],'attributes':_0x5767da[_0x2db2('0x1b')],'include':_0x5767da['include']?_['map'](_0x5767da[_0x2db2('0x1a')],function(_0x5cbdca){return{'model':db[_0x5cbdca[_0x2db2('0x1c')]],'as':_0x5cbdca['as'],'attributes':_0x5cbdca[_0x2db2('0x1b')],'include':_0x5cbdca[_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x5cbdca[_0x2db2('0x1a')],function(_0x3694a8){return{'model':db[_0x3694a8[_0x2db2('0x1c')]],'as':_0x3694a8['as'],'attributes':_0x3694a8[_0x2db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x8')](function(_0x213c17){logger['info']('GetDynamics365Account',_0x1dedde);logger[_0x2db2('0xb')]('GetDynamics365Account',_0x1dedde,JSON[_0x2db2('0xd')](_0x213c17));_0x406ddd(_0x213c17);})[_0x2db2('0x12')](function(_0x28257c){logger[_0x2db2('0xe')](_0x2db2('0x1d'),_0x28257c[_0x2db2('0xf')],_0x1dedde);_0x18e2a7(_0x5e50d7[_0x2db2('0xe')](0x1f4,_0x28257c[_0x2db2('0xf')]));});});};exports['ShowDynamics365Account']=function(_0x5b2653){var _0x2867f2=this;return new Promise(function(_0x43eb3f,_0x4dda1e){return db[_0x2db2('0x13')][_0x2db2('0x1e')]({'raw':_0x5b2653[_0x2db2('0x15')]?_0x5b2653['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b2653[_0x2db2('0x15')]?_0x5b2653[_0x2db2('0x15')]['where']||null:null,'attributes':_0x5b2653[_0x2db2('0x15')]?_0x5b2653[_0x2db2('0x15')]['attributes']||null:null,'include':_0x5b2653['options']?_0x5b2653['options'][_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x5b2653['options'][_0x2db2('0x1a')],function(_0x296249){return{'model':db[_0x296249[_0x2db2('0x1c')]],'as':_0x296249['as'],'attributes':_0x296249[_0x2db2('0x1b')],'include':_0x296249['include']?_[_0x2db2('0x19')](_0x296249[_0x2db2('0x1a')],function(_0x23bc73){return{'model':db[_0x23bc73['model']],'as':_0x23bc73['as'],'attributes':_0x23bc73['attributes'],'include':_0x23bc73[_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x23bc73[_0x2db2('0x1a')],function(_0x3091e4){return{'model':db[_0x3091e4[_0x2db2('0x1c')]],'as':_0x3091e4['as'],'attributes':_0x3091e4[_0x2db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x8')](function(_0x27ea87){logger[_0x2db2('0x10')]('ShowDynamics365Account',_0x5b2653);logger[_0x2db2('0xb')]('ShowDynamics365Account',_0x5b2653,JSON[_0x2db2('0xd')](_0x27ea87));_0x43eb3f(_0x27ea87);})[_0x2db2('0x12')](function(_0x21612d){logger[_0x2db2('0xe')]('ShowDynamics365Account',_0x21612d[_0x2db2('0xf')],_0x5b2653);_0x4dda1e(_0x2867f2['error'](0x1f4,_0x21612d[_0x2db2('0xf')]));});});}; \ No newline at end of file +var _0x3e2b=['../../config/environment','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x353cd6,_0xc795f6){var _0x55712a=function(_0x3b83e1){while(--_0x3b83e1){_0x353cd6['push'](_0x353cd6['shift']());}};_0x55712a(++_0xc795f6);}(_0x3e2b,0x179));var _0xb3e2=function(_0x3e39d7,_0x3c0dd9){_0x3e39d7=_0x3e39d7-0x0;var _0xcaf5a2=_0x3e2b[_0x3e39d7];return _0xcaf5a2;};'use strict';var _=require(_0xb3e2('0x0'));var util=require(_0xb3e2('0x1'));var moment=require(_0xb3e2('0x2'));var BPromise=require(_0xb3e2('0x3'));var rs=require(_0xb3e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3e2('0x5'))['db'];var utils=require(_0xb3e2('0x6'));var logger=require('../../config/logger')(_0xb3e2('0x7'));var config=require(_0xb3e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb3e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28997e,_0x500217,_0x6e6edf){return new BPromise(function(_0x3eb503,_0x553dc3){return client[_0xb3e2('0xa')](_0x28997e,_0x6e6edf)[_0xb3e2('0xb')](function(_0x649c7d){logger[_0xb3e2('0xc')](_0xb3e2('0xd'),_0x500217,_0xb3e2('0xe'));logger[_0xb3e2('0xf')](_0xb3e2('0x10'),_0x500217,_0xb3e2('0xe'),JSON['stringify'](_0x649c7d));if(_0x649c7d['error']){if(_0x649c7d[_0xb3e2('0x11')]['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x500217,_0x649c7d[_0xb3e2('0x11')]['message']);return _0x553dc3(_0x649c7d[_0xb3e2('0x11')][_0xb3e2('0x12')]);}logger[_0xb3e2('0x11')](_0xb3e2('0xd'),_0x500217,_0x649c7d['error'][_0xb3e2('0x12')]);return _0x3eb503(_0x649c7d[_0xb3e2('0x11')][_0xb3e2('0x12')]);}else{logger[_0xb3e2('0xc')](_0xb3e2('0xd'),_0x500217,_0xb3e2('0xe'));_0x3eb503(_0x649c7d[_0xb3e2('0x13')]['message']);}})[_0xb3e2('0x14')](function(_0x1a1f59){logger[_0xb3e2('0x11')](_0xb3e2('0xd'),_0x500217,_0x1a1f59);_0x553dc3(_0x1a1f59);});});}exports['GetDynamics365Account']=function(_0x1bc04b){var _0x166ae0=this;return new Promise(function(_0x1dbc35,_0x595a52){return db[_0xb3e2('0x15')][_0xb3e2('0x16')]({'raw':_0x1bc04b[_0xb3e2('0x17')]?_0x1bc04b['options'][_0xb3e2('0x18')]===undefined?!![]:![]:!![],'where':_0x1bc04b[_0xb3e2('0x17')]?_0x1bc04b['options']['where']||null:null,'attributes':_0x1bc04b[_0xb3e2('0x17')]?_0x1bc04b[_0xb3e2('0x17')][_0xb3e2('0x19')]||null:null,'limit':_0x1bc04b['options']?_0x1bc04b['options'][_0xb3e2('0x1a')]||null:null,'include':_0x1bc04b[_0xb3e2('0x17')]?_0x1bc04b['options'][_0xb3e2('0x1b')]?_[_0xb3e2('0x1c')](_0x1bc04b[_0xb3e2('0x17')][_0xb3e2('0x1b')],function(_0x175b31){return{'model':db[_0x175b31[_0xb3e2('0x1d')]],'as':_0x175b31['as'],'attributes':_0x175b31[_0xb3e2('0x19')],'include':_0x175b31[_0xb3e2('0x1b')]?_[_0xb3e2('0x1c')](_0x175b31[_0xb3e2('0x1b')],function(_0x96ce0d){return{'model':db[_0x96ce0d[_0xb3e2('0x1d')]],'as':_0x96ce0d['as'],'attributes':_0x96ce0d[_0xb3e2('0x19')],'include':_0x96ce0d[_0xb3e2('0x1b')]?_[_0xb3e2('0x1c')](_0x96ce0d[_0xb3e2('0x1b')],function(_0x1d8c2c){return{'model':db[_0x1d8c2c[_0xb3e2('0x1d')]],'as':_0x1d8c2c['as'],'attributes':_0x1d8c2c[_0xb3e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb3e2('0xb')](function(_0x3b6ff9){logger[_0xb3e2('0xc')](_0xb3e2('0x1e'),_0x1bc04b);logger[_0xb3e2('0xf')](_0xb3e2('0x1e'),_0x1bc04b,JSON[_0xb3e2('0x1f')](_0x3b6ff9));_0x1dbc35(_0x3b6ff9);})[_0xb3e2('0x14')](function(_0x3b4027){logger[_0xb3e2('0x11')](_0xb3e2('0x1e'),_0x3b4027['message'],_0x1bc04b);_0x595a52(_0x166ae0['error'](0x1f4,_0x3b4027[_0xb3e2('0x12')]));});});};exports[_0xb3e2('0x20')]=function(_0x19dbdc){var _0x3d6dd4=this;return new Promise(function(_0x50e835,_0x10c091){return db[_0xb3e2('0x15')][_0xb3e2('0x21')]({'raw':_0x19dbdc[_0xb3e2('0x17')]?_0x19dbdc['options'][_0xb3e2('0x18')]===undefined?!![]:![]:!![],'where':_0x19dbdc[_0xb3e2('0x17')]?_0x19dbdc[_0xb3e2('0x17')][_0xb3e2('0x22')]||null:null,'attributes':_0x19dbdc['options']?_0x19dbdc[_0xb3e2('0x17')]['attributes']||null:null,'include':_0x19dbdc['options']?_0x19dbdc[_0xb3e2('0x17')][_0xb3e2('0x1b')]?_['map'](_0x19dbdc[_0xb3e2('0x17')]['include'],function(_0x2add5f){return{'model':db[_0x2add5f['model']],'as':_0x2add5f['as'],'attributes':_0x2add5f['attributes'],'include':_0x2add5f[_0xb3e2('0x1b')]?_['map'](_0x2add5f[_0xb3e2('0x1b')],function(_0x2bc7e6){return{'model':db[_0x2bc7e6['model']],'as':_0x2bc7e6['as'],'attributes':_0x2bc7e6[_0xb3e2('0x19')],'include':_0x2bc7e6[_0xb3e2('0x1b')]?_[_0xb3e2('0x1c')](_0x2bc7e6[_0xb3e2('0x1b')],function(_0x28ee7b){return{'model':db[_0x28ee7b[_0xb3e2('0x1d')]],'as':_0x28ee7b['as'],'attributes':_0x28ee7b[_0xb3e2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b90fc){logger[_0xb3e2('0xc')](_0xb3e2('0x20'),_0x19dbdc);logger[_0xb3e2('0xf')]('ShowDynamics365Account',_0x19dbdc,JSON[_0xb3e2('0x1f')](_0x4b90fc));_0x50e835(_0x4b90fc);})['catch'](function(_0x1a19f7){logger['error'](_0xb3e2('0x20'),_0x1a19f7[_0xb3e2('0x12')],_0x19dbdc);_0x10c091(_0x3d6dd4[_0xb3e2('0x11')](0x1f4,_0x1a19f7['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5fd0179..1270f59 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 _0x4df2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/subjects','/:id/descriptions','getDescriptions','create'];(function(_0x42f993,_0x591779){var _0x380e13=function(_0x365279){while(--_0x365279){_0x42f993['push'](_0x42f993['shift']());}};_0x380e13(++_0x591779);}(_0x4df2,0xbf));var _0x24df=function(_0x2fe3df,_0x4e0603){_0x2fe3df=_0x2fe3df-0x0;var _0x50f2cd=_0x4df2[_0x2fe3df];return _0x50f2cd;};'use strict';var multer=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var path=require(_0x24df('0x2'));var timeout=require('connect-timeout');var express=require(_0x24df('0x3'));var router=express[_0x24df('0x4')]();var fs_extra=require(_0x24df('0x5'));var auth=require(_0x24df('0x6'));var interaction=require(_0x24df('0x7'));var config=require(_0x24df('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x24df('0x9')](),controller[_0x24df('0xa')]);router['get'](_0x24df('0xb'),auth[_0x24df('0x9')](),controller[_0x24df('0xc')]);router[_0x24df('0xd')]('/:id/fields',auth[_0x24df('0x9')](),controller['getFields']);router[_0x24df('0xd')](_0x24df('0xe'),auth[_0x24df('0x9')](),controller['getSubjects']);router[_0x24df('0xd')](_0x24df('0xf'),auth[_0x24df('0x9')](),controller[_0x24df('0x10')]);router['post']('/',auth[_0x24df('0x9')](),controller[_0x24df('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x24df('0x12')]=router; \ No newline at end of file +var _0x71f6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','delete','destroy','util','connect-timeout','express','Router'];(function(_0x14f26f,_0x812a0d){var _0x5a572b=function(_0x412f42){while(--_0x412f42){_0x14f26f['push'](_0x14f26f['shift']());}};_0x5a572b(++_0x812a0d);}(_0x71f6,0x1ac));var _0x671f=function(_0x5b4dfb,_0x1b1bf8){_0x5b4dfb=_0x5b4dfb-0x0;var _0x379762=_0x71f6[_0x5b4dfb];return _0x379762;};'use strict';var multer=require('multer');var util=require(_0x671f('0x0'));var path=require('path');var timeout=require(_0x671f('0x1'));var express=require(_0x671f('0x2'));var router=express[_0x671f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x671f('0x4'));var interaction=require(_0x671f('0x5'));var config=require(_0x671f('0x6'));var controller=require(_0x671f('0x7'));router[_0x671f('0x8')]('/',auth[_0x671f('0x9')](),controller['index']);router[_0x671f('0x8')](_0x671f('0xa'),auth[_0x671f('0x9')](),controller[_0x671f('0xb')]);router[_0x671f('0x8')]('/:id/fields',auth[_0x671f('0x9')](),controller[_0x671f('0xc')]);router[_0x671f('0x8')](_0x671f('0xd'),auth[_0x671f('0x9')](),controller['getSubjects']);router['get'](_0x671f('0xe'),auth[_0x671f('0x9')](),controller[_0x671f('0xf')]);router['post']('/',auth[_0x671f('0x9')](),controller['create']);router['put'](_0x671f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x671f('0x10')](_0x671f('0xa'),auth[_0x671f('0x9')](),controller[_0x671f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b3ee079..4d6f104 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 _0x97b7=['STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x97b7,0x14e));var _0x797b=function(_0x3944f0,_0x5a6429){_0x3944f0=_0x3944f0-0x0;var _0x181472=_0x97b7[_0x3944f0];return _0x181472;};'use strict';var Sequelize=require(_0x797b('0x0'));module[_0x797b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x797b('0x2')]},'ticketType':{'type':Sequelize[_0x797b('0x3')](_0x797b('0x4'),'phonecall'),'defaultValue':_0x797b('0x4')},'moduleCreate':{'type':Sequelize[_0x797b('0x3')](_0x797b('0x5'),_0x797b('0x6')),'defaultValue':_0x797b('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x797b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x797b('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x94e2=['BOOLEAN','STRING','ENUM','incident','phonecall','contact'];(function(_0x456570,_0x57bbec){var _0xebaf7e=function(_0xda6036){while(--_0xda6036){_0x456570['push'](_0x456570['shift']());}};_0xebaf7e(++_0x57bbec);}(_0x94e2,0x1b7));var _0x294e=function(_0x5aa023,_0x1cf1d2){_0x5aa023=_0x5aa023-0x0;var _0x31ceb5=_0x94e2[_0x5aa023];return _0x31ceb5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x294e('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x294e('0x1')](_0x294e('0x2'),_0x294e('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x294e('0x4'),'nothing'),'defaultValue':_0x294e('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x294e('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x294e('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index de6adec..6b9c690 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 _0x51a4=['update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save'];(function(_0x56a936,_0x457a1b){var _0x5ec02b=function(_0x242e0b){while(--_0x242e0b){_0x56a936['push'](_0x56a936['shift']());}};_0x5ec02b(++_0x457a1b);}(_0x51a4,0x1b8));var _0x451a=function(_0x127a47,_0xaa4991){_0x127a47=_0x127a47-0x0;var _0x4d76b9=_0x51a4[_0x127a47];return _0x4d76b9;};'use strict';var emlformat=require(_0x451a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x451a('0x1'));var jsonpatch=require(_0x451a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x451a('0x3'));var Mustache=require(_0x451a('0x4'));var util=require(_0x451a('0x5'));var path=require(_0x451a('0x6'));var sox=require(_0x451a('0x7'));var csv=require(_0x451a('0x8'));var ejs=require(_0x451a('0x9'));var fs=require('fs');var fs_extra=require(_0x451a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x451a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x451a('0xc'));var Redis=require(_0x451a('0xd'));var authService=require(_0x451a('0xe'));var qs=require(_0x451a('0xf'));var as=require(_0x451a('0x10'));var hardwareService=require(_0x451a('0x11'));var logger=require('../../config/logger')(_0x451a('0x12'));var utils=require(_0x451a('0x13'));var config=require(_0x451a('0x14'));var licenseUtil=require(_0x451a('0x15'));var db=require(_0x451a('0x16'))['db'];function respondWithStatusCode(_0x22316b,_0xbbd9c6){_0xbbd9c6=_0xbbd9c6||0xcc;return function(_0x2eb564){if(_0x2eb564){return _0x22316b[_0x451a('0x17')](_0xbbd9c6);}return _0x22316b[_0x451a('0x18')](_0xbbd9c6)['end']();};}function respondWithResult(_0x43fa98,_0x435040){_0x435040=_0x435040||0xc8;return function(_0x54d235){if(_0x54d235){return _0x43fa98[_0x451a('0x18')](_0x435040)['json'](_0x54d235);}};}function respondWithFilteredResult(_0x10af8c,_0x5bf630){return function(_0xf943f1){if(_0xf943f1){var _0x3d2c51=typeof _0x5bf630[_0x451a('0x19')]==='undefined'&&typeof _0x5bf630[_0x451a('0x1a')]===_0x451a('0x1b');var _0x4a26be=_0xf943f1[_0x451a('0x1c')];var _0x38f284=_0x3d2c51?0x0:_0x5bf630[_0x451a('0x19')];var _0x3d0ac9=_0x3d2c51?_0xf943f1[_0x451a('0x1c')]:_0x5bf630['offset']+_0x5bf630['limit'];var _0x400b64;if(_0x3d0ac9>=_0x4a26be){_0x3d0ac9=_0x4a26be;_0x400b64=0xc8;}else{_0x400b64=0xce;}_0x10af8c[_0x451a('0x18')](_0x400b64);return _0x10af8c['set'](_0x451a('0x1d'),_0x38f284+'-'+_0x3d0ac9+'/'+_0x4a26be)[_0x451a('0x1e')](_0xf943f1);}return null;};}function patchUpdates(_0x51211b){return function(_0x39b1ed){try{jsonpatch[_0x451a('0x1f')](_0x39b1ed,_0x51211b,!![]);}catch(_0x32f678){return BPromise[_0x451a('0x20')](_0x32f678);}return _0x39b1ed[_0x451a('0x21')]();};}function saveUpdates(_0x3b9b50,_0x48c87c){return function(_0xa59a12){if(_0xa59a12){return _0xa59a12[_0x451a('0x22')](_0x3b9b50)[_0x451a('0x23')](function(_0x453e71){return _0x453e71;});}return null;};}function removeEntity(_0x847092,_0xb12a05){return function(_0x13a987){if(_0x13a987){return _0x13a987[_0x451a('0x24')]()['then'](function(){_0x847092[_0x451a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37ea59,_0x540319){return function(_0x520c4d){if(!_0x520c4d){_0x37ea59[_0x451a('0x17')](0x194);}return _0x520c4d;};}function handleError(_0x5b02e2,_0x157dca){_0x157dca=_0x157dca||0x1f4;return function(_0x568227){logger[_0x451a('0x25')](_0x568227['stack']);if(_0x568227['name']){delete _0x568227[_0x451a('0x26')];}_0x5b02e2['status'](_0x157dca)[_0x451a('0x27')](_0x568227);};}exports[_0x451a('0x28')]=function(_0x3db6d4,_0x97ea14){var _0x5384b6={},_0x268c72={},_0x304f84={'count':0x0,'rows':[]};var _0x2fefa0=_[_0x451a('0x29')](db[_0x451a('0x2a')][_0x451a('0x2b')],function(_0x129c16){return{'name':_0x129c16[_0x451a('0x2c')],'type':_0x129c16['type'][_0x451a('0x2d')]};});_0x268c72['model']=_['map'](_0x2fefa0,_0x451a('0x26'));_0x268c72[_0x451a('0x2e')]=_[_0x451a('0x2f')](_0x3db6d4[_0x451a('0x2e')]);_0x268c72[_0x451a('0x30')]=_[_0x451a('0x31')](_0x268c72[_0x451a('0x32')],_0x268c72[_0x451a('0x2e')]);_0x5384b6['attributes']=_[_0x451a('0x31')](_0x268c72['model'],qs[_0x451a('0x33')](_0x3db6d4['query']['fields']));_0x5384b6[_0x451a('0x34')]=_0x5384b6[_0x451a('0x34')][_0x451a('0x35')]?_0x5384b6['attributes']:_0x268c72[_0x451a('0x32')];if(!_0x3db6d4[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x5384b6[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x3db6d4[_0x451a('0x2e')][_0x451a('0x1a')]);_0x5384b6['offset']=qs[_0x451a('0x19')](_0x3db6d4[_0x451a('0x2e')][_0x451a('0x19')]);}_0x5384b6[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x3db6d4['query'][_0x451a('0x39')]);_0x5384b6['where']=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x3db6d4['query'],_0x268c72[_0x451a('0x30')]),_0x2fefa0);if(_0x3db6d4[_0x451a('0x2e')][_0x451a('0x3b')]){_0x5384b6[_0x451a('0x3c')]=_[_0x451a('0x3d')](_0x5384b6['where'],{'$or':_['map'](_0x2fefa0,function(_0x380c39){if(_0x380c39[_0x451a('0x3e')]!==_0x451a('0x3f')){var _0x46c142={};_0x46c142[_0x380c39[_0x451a('0x26')]]={'$like':'%'+_0x3db6d4[_0x451a('0x2e')]['filter']+'%'};return _0x46c142;}})});}_0x5384b6=_['merge']({},_0x5384b6,_0x3db6d4['options']);var _0x523a79={'where':_0x5384b6[_0x451a('0x3c')]};return db[_0x451a('0x2a')][_0x451a('0x1c')](_0x523a79)[_0x451a('0x23')](function(_0x30d96c){_0x304f84['count']=_0x30d96c;if(_0x3db6d4[_0x451a('0x2e')][_0x451a('0x40')]){_0x5384b6[_0x451a('0x41')]=[{'all':!![]}];}return db[_0x451a('0x2a')][_0x451a('0x42')](_0x5384b6);})[_0x451a('0x23')](function(_0x4330b2){_0x304f84[_0x451a('0x43')]=_0x4330b2;return _0x304f84;})[_0x451a('0x23')](respondWithFilteredResult(_0x97ea14,_0x5384b6))['catch'](handleError(_0x97ea14,null));};exports['show']=function(_0x4a2867,_0x3b5682){var _0x40120d={'raw':![],'where':{'id':_0x4a2867[_0x451a('0x44')]['id']}},_0x17cbe2={};_0x17cbe2[_0x451a('0x32')]=_[_0x451a('0x2f')](db[_0x451a('0x2a')][_0x451a('0x2b')]);_0x17cbe2[_0x451a('0x2e')]=_[_0x451a('0x2f')](_0x4a2867[_0x451a('0x2e')]);_0x17cbe2[_0x451a('0x30')]=_[_0x451a('0x31')](_0x17cbe2[_0x451a('0x32')],_0x17cbe2['query']);_0x40120d['attributes']=_[_0x451a('0x31')](_0x17cbe2['model'],qs[_0x451a('0x33')](_0x4a2867[_0x451a('0x2e')][_0x451a('0x33')]));_0x40120d[_0x451a('0x34')]=_0x40120d['attributes'][_0x451a('0x35')]?_0x40120d[_0x451a('0x34')]:_0x17cbe2[_0x451a('0x32')];if(_0x4a2867[_0x451a('0x2e')][_0x451a('0x40')]){_0x40120d[_0x451a('0x41')]=[{'all':!![]}];}_0x40120d=_[_0x451a('0x3d')]({},_0x40120d,_0x4a2867[_0x451a('0x45')]);return db['Dynamics365Configuration'][_0x451a('0x46')](_0x40120d)[_0x451a('0x23')](handleEntityNotFound(_0x3b5682,null))[_0x451a('0x23')](respondWithResult(_0x3b5682,null))['catch'](handleError(_0x3b5682,null));};exports[_0x451a('0x47')]=function(_0x4219ed,_0x2c91d1){return db[_0x451a('0x2a')][_0x451a('0x47')](_0x4219ed[_0x451a('0x48')],{})['then'](respondWithResult(_0x2c91d1,0xc9))[_0x451a('0x49')](handleError(_0x2c91d1,null));};exports[_0x451a('0x22')]=function(_0x26d7bf,_0x2e05b8){if(_0x26d7bf[_0x451a('0x48')]['id']){delete _0x26d7bf['body']['id'];}return db[_0x451a('0x2a')]['find']({'where':{'id':_0x26d7bf['params']['id']}})['then'](handleEntityNotFound(_0x2e05b8,null))['then'](saveUpdates(_0x26d7bf['body'],null))[_0x451a('0x23')](respondWithResult(_0x2e05b8,null))['catch'](handleError(_0x2e05b8,null));};exports[_0x451a('0x24')]=function(_0x583827,_0x3291ab){return db[_0x451a('0x2a')][_0x451a('0x46')]({'where':{'id':_0x583827['params']['id']}})['then'](handleEntityNotFound(_0x3291ab,null))[_0x451a('0x23')](removeEntity(_0x3291ab,null))['catch'](handleError(_0x3291ab,null));};exports[_0x451a('0x4a')]=function(_0x2f01df,_0x6da23f,_0x46f394){var _0x569d33={};var _0x50b589={};var _0x547115;var _0x3f8c0e;return db['Dynamics365Configuration'][_0x451a('0x4b')]({'where':{'id':_0x2f01df['params']['id']}})['then'](handleEntityNotFound(_0x6da23f,null))['then'](function(_0xcc2fac){if(_0xcc2fac){_0x547115=_0xcc2fac;_0x50b589['model']=_[_0x451a('0x2f')](db[_0x451a('0x4c')][_0x451a('0x2b')]);_0x50b589[_0x451a('0x2e')]=_['keys'](_0x2f01df[_0x451a('0x2e')]);_0x50b589[_0x451a('0x30')]=_[_0x451a('0x31')](_0x50b589[_0x451a('0x32')],_0x50b589[_0x451a('0x2e')]);_0x569d33['attributes']=_[_0x451a('0x31')](_0x50b589[_0x451a('0x32')],qs[_0x451a('0x33')](_0x2f01df['query']['fields']));_0x569d33[_0x451a('0x34')]=_0x569d33[_0x451a('0x34')][_0x451a('0x35')]?_0x569d33[_0x451a('0x34')]:_0x50b589['model'];_0x569d33[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x2f01df['query'][_0x451a('0x39')]);_0x569d33['where']=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x2f01df['query'],_0x50b589[_0x451a('0x30')]));if(_0x2f01df[_0x451a('0x2e')]['filter']){_0x569d33['where']=_['merge'](_0x569d33[_0x451a('0x3c')],{'$or':_[_0x451a('0x29')](_0x569d33[_0x451a('0x34')],function(_0x1e0f3c){var _0x43a798={};_0x43a798[_0x1e0f3c]={'$like':'%'+_0x2f01df['query'][_0x451a('0x3b')]+'%'};return _0x43a798;})});}_0x569d33=_[_0x451a('0x3d')]({},_0x569d33,_0x2f01df[_0x451a('0x45')]);return _0x547115['getFields'](_0x569d33);}})['then'](function(_0x40a14c){if(_0x40a14c){_0x3f8c0e=_0x40a14c['length'];if(!_0x2f01df[_0x451a('0x2e')]['hasOwnProperty'](_0x451a('0x37'))){_0x569d33[_0x451a('0x1a')]=qs['limit'](_0x2f01df[_0x451a('0x2e')][_0x451a('0x1a')]);_0x569d33[_0x451a('0x19')]=qs[_0x451a('0x19')](_0x2f01df['query'][_0x451a('0x19')]);}return _0x547115[_0x451a('0x4a')](_0x569d33);}})[_0x451a('0x23')](function(_0x2824fe){if(_0x2824fe){return _0x2824fe?{'count':_0x3f8c0e,'rows':_0x2824fe}:null;}})['then'](respondWithResult(_0x6da23f,null))[_0x451a('0x49')](handleError(_0x6da23f,null));};exports[_0x451a('0x4d')]=function(_0x5d8829,_0x20d2db,_0x20bd19){var _0x405c95={};var _0x42d8ab={};var _0x25f22e;var _0x5330d1;return db[_0x451a('0x2a')][_0x451a('0x4b')]({'where':{'id':_0x5d8829['params']['id']}})['then'](handleEntityNotFound(_0x20d2db,null))[_0x451a('0x23')](function(_0x1a02ca){if(_0x1a02ca){_0x25f22e=_0x1a02ca;_0x42d8ab['model']=_['keys'](db[_0x451a('0x4c')]['rawAttributes']);_0x42d8ab['query']=_[_0x451a('0x2f')](_0x5d8829[_0x451a('0x2e')]);_0x42d8ab['filters']=_[_0x451a('0x31')](_0x42d8ab[_0x451a('0x32')],_0x42d8ab[_0x451a('0x2e')]);_0x405c95['attributes']=_[_0x451a('0x31')](_0x42d8ab[_0x451a('0x32')],qs[_0x451a('0x33')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x33')]));_0x405c95['attributes']=_0x405c95[_0x451a('0x34')][_0x451a('0x35')]?_0x405c95[_0x451a('0x34')]:_0x42d8ab[_0x451a('0x32')];_0x405c95[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x39')]);_0x405c95[_0x451a('0x3c')]=qs['filters'](_[_0x451a('0x3a')](_0x5d8829[_0x451a('0x2e')],_0x42d8ab[_0x451a('0x30')]));if(_0x5d8829[_0x451a('0x2e')]['filter']){_0x405c95[_0x451a('0x3c')]=_[_0x451a('0x3d')](_0x405c95['where'],{'$or':_[_0x451a('0x29')](_0x405c95[_0x451a('0x34')],function(_0xfef560){var _0x25d8f2={};_0x25d8f2[_0xfef560]={'$like':'%'+_0x5d8829[_0x451a('0x2e')]['filter']+'%'};return _0x25d8f2;})});}_0x405c95=_[_0x451a('0x3d')]({},_0x405c95,_0x5d8829[_0x451a('0x45')]);return _0x25f22e[_0x451a('0x4d')](_0x405c95);}})['then'](function(_0xa96005){if(_0xa96005){_0x5330d1=_0xa96005[_0x451a('0x35')];if(!_0x5d8829[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x405c95[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x1a')]);_0x405c95['offset']=qs[_0x451a('0x19')](_0x5d8829[_0x451a('0x2e')]['offset']);}return _0x25f22e[_0x451a('0x4d')](_0x405c95);}})[_0x451a('0x23')](function(_0x4d69a2){if(_0x4d69a2){return _0x4d69a2?{'count':_0x5330d1,'rows':_0x4d69a2}:null;}})[_0x451a('0x23')](respondWithResult(_0x20d2db,null))[_0x451a('0x49')](handleError(_0x20d2db,null));};exports[_0x451a('0x4e')]=function(_0x111871,_0x404620,_0x275f5c){var _0x53b40b={};var _0x17e91b={};var _0x7e42a;var _0x86bd64;return db[_0x451a('0x2a')][_0x451a('0x4b')]({'where':{'id':_0x111871[_0x451a('0x44')]['id']}})[_0x451a('0x23')](handleEntityNotFound(_0x404620,null))[_0x451a('0x23')](function(_0x233e06){if(_0x233e06){_0x7e42a=_0x233e06;_0x17e91b[_0x451a('0x32')]=_[_0x451a('0x2f')](db[_0x451a('0x4c')][_0x451a('0x2b')]);_0x17e91b[_0x451a('0x2e')]=_['keys'](_0x111871['query']);_0x17e91b[_0x451a('0x30')]=_[_0x451a('0x31')](_0x17e91b['model'],_0x17e91b['query']);_0x53b40b[_0x451a('0x34')]=_['intersection'](_0x17e91b[_0x451a('0x32')],qs[_0x451a('0x33')](_0x111871[_0x451a('0x2e')]['fields']));_0x53b40b[_0x451a('0x34')]=_0x53b40b[_0x451a('0x34')]['length']?_0x53b40b['attributes']:_0x17e91b[_0x451a('0x32')];_0x53b40b[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x111871['query']['sort']);_0x53b40b[_0x451a('0x3c')]=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x111871[_0x451a('0x2e')],_0x17e91b[_0x451a('0x30')]));if(_0x111871['query']['filter']){_0x53b40b[_0x451a('0x3c')]=_['merge'](_0x53b40b[_0x451a('0x3c')],{'$or':_[_0x451a('0x29')](_0x53b40b['attributes'],function(_0x4363fb){var _0x47b42={};_0x47b42[_0x4363fb]={'$like':'%'+_0x111871[_0x451a('0x2e')][_0x451a('0x3b')]+'%'};return _0x47b42;})});}_0x53b40b=_[_0x451a('0x3d')]({},_0x53b40b,_0x111871['options']);return _0x7e42a[_0x451a('0x4e')](_0x53b40b);}})[_0x451a('0x23')](function(_0x5ddbc0){if(_0x5ddbc0){_0x86bd64=_0x5ddbc0[_0x451a('0x35')];if(!_0x111871[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x53b40b[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x111871[_0x451a('0x2e')][_0x451a('0x1a')]);_0x53b40b[_0x451a('0x19')]=qs[_0x451a('0x19')](_0x111871[_0x451a('0x2e')][_0x451a('0x19')]);}return _0x7e42a[_0x451a('0x4e')](_0x53b40b);}})['then'](function(_0x4f29b4){if(_0x4f29b4){return _0x4f29b4?{'count':_0x86bd64,'rows':_0x4f29b4}:null;}})['then'](respondWithResult(_0x404620,null))['catch'](handleError(_0x404620,null));}; \ No newline at end of file +var _0x7f75=['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/license/util','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','create','body','find','catch','getFields','findOne','Dynamics365Field','rawAttributes','nolimit','getSubjects','getDescriptions','request-promise','moment'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7f75,0x1e4));var _0x57f7=function(_0x2e8d36,_0x5dadae){_0x2e8d36=_0x2e8d36-0x0;var _0x2dbd92=_0x7f75[_0x2e8d36];return _0x2dbd92;};'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(_0x57f7('0x0'));var moment=require(_0x57f7('0x1'));var BPromise=require(_0x57f7('0x2'));var Mustache=require(_0x57f7('0x3'));var util=require(_0x57f7('0x4'));var path=require(_0x57f7('0x5'));var sox=require(_0x57f7('0x6'));var csv=require(_0x57f7('0x7'));var ejs=require(_0x57f7('0x8'));var fs=require('fs');var fs_extra=require(_0x57f7('0x9'));var _=require('lodash');var squel=require(_0x57f7('0xa'));var crypto=require(_0x57f7('0xb'));var jsforce=require(_0x57f7('0xc'));var deskjs=require(_0x57f7('0xd'));var toCsv=require(_0x57f7('0x7'));var querystring=require(_0x57f7('0xe'));var Papa=require(_0x57f7('0xf'));var Redis=require(_0x57f7('0x10'));var authService=require(_0x57f7('0x11'));var qs=require(_0x57f7('0x12'));var as=require(_0x57f7('0x13'));var hardwareService=require(_0x57f7('0x14'));var logger=require(_0x57f7('0x15'))(_0x57f7('0x16'));var utils=require(_0x57f7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x57f7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52e1e5,_0x462f52){_0x462f52=_0x462f52||0xcc;return function(_0xeb3dfd){if(_0xeb3dfd){return _0x52e1e5['sendStatus'](_0x462f52);}return _0x52e1e5['status'](_0x462f52)[_0x57f7('0x19')]();};}function respondWithResult(_0x225809,_0x5f5d5f){_0x5f5d5f=_0x5f5d5f||0xc8;return function(_0x25f70d){if(_0x25f70d){return _0x225809[_0x57f7('0x1a')](_0x5f5d5f)[_0x57f7('0x1b')](_0x25f70d);}};}function respondWithFilteredResult(_0xbf904e,_0xbe55c4){return function(_0x120a6c){if(_0x120a6c){var _0x3c994e=typeof _0xbe55c4[_0x57f7('0x1c')]===_0x57f7('0x1d')&&typeof _0xbe55c4['limit']===_0x57f7('0x1d');var _0x335d0c=_0x120a6c[_0x57f7('0x1e')];var _0x59d398=_0x3c994e?0x0:_0xbe55c4[_0x57f7('0x1c')];var _0x9d3006=_0x3c994e?_0x120a6c[_0x57f7('0x1e')]:_0xbe55c4['offset']+_0xbe55c4[_0x57f7('0x1f')];var _0x403417;if(_0x9d3006>=_0x335d0c){_0x9d3006=_0x335d0c;_0x403417=0xc8;}else{_0x403417=0xce;}_0xbf904e['status'](_0x403417);return _0xbf904e[_0x57f7('0x20')]('Content-Range',_0x59d398+'-'+_0x9d3006+'/'+_0x335d0c)[_0x57f7('0x1b')](_0x120a6c);}return null;};}function patchUpdates(_0x5ea147){return function(_0x14f8c0){try{jsonpatch[_0x57f7('0x21')](_0x14f8c0,_0x5ea147,!![]);}catch(_0x4155d5){return BPromise[_0x57f7('0x22')](_0x4155d5);}return _0x14f8c0['save']();};}function saveUpdates(_0xd7dbea,_0x42a4eb){return function(_0x5b5c96){if(_0x5b5c96){return _0x5b5c96[_0x57f7('0x23')](_0xd7dbea)[_0x57f7('0x24')](function(_0x535010){return _0x535010;});}return null;};}function removeEntity(_0xeb6027,_0x56447e){return function(_0x27441e){if(_0x27441e){return _0x27441e[_0x57f7('0x25')]()['then'](function(){_0xeb6027[_0x57f7('0x1a')](0xcc)[_0x57f7('0x19')]();});}};}function handleEntityNotFound(_0xd24eda,_0x2fc3bf){return function(_0x10e187){if(!_0x10e187){_0xd24eda[_0x57f7('0x26')](0x194);}return _0x10e187;};}function handleError(_0x3ac56c,_0x534487){_0x534487=_0x534487||0x1f4;return function(_0x377f62){logger[_0x57f7('0x27')](_0x377f62[_0x57f7('0x28')]);if(_0x377f62[_0x57f7('0x29')]){delete _0x377f62[_0x57f7('0x29')];}_0x3ac56c[_0x57f7('0x1a')](_0x534487)['send'](_0x377f62);};}exports[_0x57f7('0x2a')]=function(_0x140701,_0x4d016f){var _0x11180f={},_0x43d97b={},_0x24c5f1={'count':0x0,'rows':[]};var _0x4ff4e5=_[_0x57f7('0x2b')](db[_0x57f7('0x2c')]['rawAttributes'],function(_0x973603){return{'name':_0x973603[_0x57f7('0x2d')],'type':_0x973603[_0x57f7('0x2e')][_0x57f7('0x2f')]};});_0x43d97b['model']=_['map'](_0x4ff4e5,_0x57f7('0x29'));_0x43d97b['query']=_[_0x57f7('0x30')](_0x140701['query']);_0x43d97b[_0x57f7('0x31')]=_[_0x57f7('0x32')](_0x43d97b['model'],_0x43d97b[_0x57f7('0x33')]);_0x11180f[_0x57f7('0x34')]=_['intersection'](_0x43d97b[_0x57f7('0x35')],qs[_0x57f7('0x36')](_0x140701[_0x57f7('0x33')][_0x57f7('0x36')]));_0x11180f[_0x57f7('0x34')]=_0x11180f[_0x57f7('0x34')][_0x57f7('0x37')]?_0x11180f[_0x57f7('0x34')]:_0x43d97b['model'];if(!_0x140701[_0x57f7('0x33')][_0x57f7('0x38')]('nolimit')){_0x11180f[_0x57f7('0x1f')]=qs[_0x57f7('0x1f')](_0x140701['query'][_0x57f7('0x1f')]);_0x11180f[_0x57f7('0x1c')]=qs['offset'](_0x140701[_0x57f7('0x33')][_0x57f7('0x1c')]);}_0x11180f[_0x57f7('0x39')]=qs['sort'](_0x140701[_0x57f7('0x33')][_0x57f7('0x3a')]);_0x11180f[_0x57f7('0x3b')]=qs[_0x57f7('0x31')](_[_0x57f7('0x3c')](_0x140701[_0x57f7('0x33')],_0x43d97b['filters']),_0x4ff4e5);if(_0x140701[_0x57f7('0x33')][_0x57f7('0x3d')]){_0x11180f[_0x57f7('0x3b')]=_[_0x57f7('0x3e')](_0x11180f['where'],{'$or':_['map'](_0x4ff4e5,function(_0x534e9e){if(_0x534e9e[_0x57f7('0x2e')]!==_0x57f7('0x3f')){var _0x12eb34={};_0x12eb34[_0x534e9e['name']]={'$like':'%'+_0x140701[_0x57f7('0x33')][_0x57f7('0x3d')]+'%'};return _0x12eb34;}})});}_0x11180f=_[_0x57f7('0x3e')]({},_0x11180f,_0x140701[_0x57f7('0x40')]);var _0x40ca45={'where':_0x11180f[_0x57f7('0x3b')]};return db[_0x57f7('0x2c')][_0x57f7('0x1e')](_0x40ca45)[_0x57f7('0x24')](function(_0x352490){_0x24c5f1[_0x57f7('0x1e')]=_0x352490;if(_0x140701[_0x57f7('0x33')][_0x57f7('0x41')]){_0x11180f[_0x57f7('0x42')]=[{'all':!![]}];}return db[_0x57f7('0x2c')]['findAll'](_0x11180f);})[_0x57f7('0x24')](function(_0x4a52cc){_0x24c5f1[_0x57f7('0x43')]=_0x4a52cc;return _0x24c5f1;})[_0x57f7('0x24')](respondWithFilteredResult(_0x4d016f,_0x11180f))['catch'](handleError(_0x4d016f,null));};exports[_0x57f7('0x44')]=function(_0x683670,_0x4b4d5e){var _0x47801a={'raw':![],'where':{'id':_0x683670[_0x57f7('0x45')]['id']}},_0x51916c={};_0x51916c[_0x57f7('0x35')]=_[_0x57f7('0x30')](db['Dynamics365Configuration']['rawAttributes']);_0x51916c[_0x57f7('0x33')]=_[_0x57f7('0x30')](_0x683670[_0x57f7('0x33')]);_0x51916c[_0x57f7('0x31')]=_[_0x57f7('0x32')](_0x51916c[_0x57f7('0x35')],_0x51916c[_0x57f7('0x33')]);_0x47801a['attributes']=_[_0x57f7('0x32')](_0x51916c[_0x57f7('0x35')],qs[_0x57f7('0x36')](_0x683670[_0x57f7('0x33')][_0x57f7('0x36')]));_0x47801a['attributes']=_0x47801a[_0x57f7('0x34')][_0x57f7('0x37')]?_0x47801a[_0x57f7('0x34')]:_0x51916c['model'];if(_0x683670[_0x57f7('0x33')]['includeAll']){_0x47801a['include']=[{'all':!![]}];}_0x47801a=_[_0x57f7('0x3e')]({},_0x47801a,_0x683670[_0x57f7('0x40')]);return db[_0x57f7('0x2c')]['find'](_0x47801a)['then'](handleEntityNotFound(_0x4b4d5e,null))[_0x57f7('0x24')](respondWithResult(_0x4b4d5e,null))['catch'](handleError(_0x4b4d5e,null));};exports[_0x57f7('0x46')]=function(_0x592420,_0x3dbe05){return db[_0x57f7('0x2c')][_0x57f7('0x46')](_0x592420[_0x57f7('0x47')],{})[_0x57f7('0x24')](respondWithResult(_0x3dbe05,0xc9))['catch'](handleError(_0x3dbe05,null));};exports[_0x57f7('0x23')]=function(_0x9c9cd1,_0x4b7f9e){if(_0x9c9cd1[_0x57f7('0x47')]['id']){delete _0x9c9cd1[_0x57f7('0x47')]['id'];}return db[_0x57f7('0x2c')][_0x57f7('0x48')]({'where':{'id':_0x9c9cd1[_0x57f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7f9e,null))['then'](saveUpdates(_0x9c9cd1[_0x57f7('0x47')],null))['then'](respondWithResult(_0x4b7f9e,null))[_0x57f7('0x49')](handleError(_0x4b7f9e,null));};exports['destroy']=function(_0x27c754,_0x40a585){return db[_0x57f7('0x2c')][_0x57f7('0x48')]({'where':{'id':_0x27c754[_0x57f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x40a585,null))[_0x57f7('0x24')](removeEntity(_0x40a585,null))[_0x57f7('0x49')](handleError(_0x40a585,null));};exports[_0x57f7('0x4a')]=function(_0x599a59,_0x5c28ef,_0x3bbe6e){var _0x229030={};var _0x1a0964={};var _0x1f547c;var _0x34b8cd;return db[_0x57f7('0x2c')][_0x57f7('0x4b')]({'where':{'id':_0x599a59['params']['id']}})[_0x57f7('0x24')](handleEntityNotFound(_0x5c28ef,null))['then'](function(_0x352976){if(_0x352976){_0x1f547c=_0x352976;_0x1a0964['model']=_[_0x57f7('0x30')](db[_0x57f7('0x4c')][_0x57f7('0x4d')]);_0x1a0964[_0x57f7('0x33')]=_[_0x57f7('0x30')](_0x599a59[_0x57f7('0x33')]);_0x1a0964['filters']=_['intersection'](_0x1a0964[_0x57f7('0x35')],_0x1a0964[_0x57f7('0x33')]);_0x229030[_0x57f7('0x34')]=_[_0x57f7('0x32')](_0x1a0964[_0x57f7('0x35')],qs[_0x57f7('0x36')](_0x599a59[_0x57f7('0x33')]['fields']));_0x229030[_0x57f7('0x34')]=_0x229030[_0x57f7('0x34')]['length']?_0x229030[_0x57f7('0x34')]:_0x1a0964[_0x57f7('0x35')];_0x229030[_0x57f7('0x39')]=qs[_0x57f7('0x3a')](_0x599a59[_0x57f7('0x33')][_0x57f7('0x3a')]);_0x229030['where']=qs[_0x57f7('0x31')](_[_0x57f7('0x3c')](_0x599a59[_0x57f7('0x33')],_0x1a0964['filters']));if(_0x599a59['query']['filter']){_0x229030['where']=_['merge'](_0x229030[_0x57f7('0x3b')],{'$or':_[_0x57f7('0x2b')](_0x229030[_0x57f7('0x34')],function(_0x13e63f){var _0x12a3f8={};_0x12a3f8[_0x13e63f]={'$like':'%'+_0x599a59['query'][_0x57f7('0x3d')]+'%'};return _0x12a3f8;})});}_0x229030=_[_0x57f7('0x3e')]({},_0x229030,_0x599a59[_0x57f7('0x40')]);return _0x1f547c[_0x57f7('0x4a')](_0x229030);}})[_0x57f7('0x24')](function(_0x3a4c27){if(_0x3a4c27){_0x34b8cd=_0x3a4c27[_0x57f7('0x37')];if(!_0x599a59['query']['hasOwnProperty'](_0x57f7('0x4e'))){_0x229030[_0x57f7('0x1f')]=qs[_0x57f7('0x1f')](_0x599a59[_0x57f7('0x33')][_0x57f7('0x1f')]);_0x229030[_0x57f7('0x1c')]=qs[_0x57f7('0x1c')](_0x599a59[_0x57f7('0x33')][_0x57f7('0x1c')]);}return _0x1f547c[_0x57f7('0x4a')](_0x229030);}})[_0x57f7('0x24')](function(_0x2cfdff){if(_0x2cfdff){return _0x2cfdff?{'count':_0x34b8cd,'rows':_0x2cfdff}:null;}})['then'](respondWithResult(_0x5c28ef,null))[_0x57f7('0x49')](handleError(_0x5c28ef,null));};exports[_0x57f7('0x4f')]=function(_0x557938,_0x1e2329,_0x19c7fb){var _0x4ffd5d={};var _0x1a904e={};var _0x2d6548;var _0x43bc50;return db[_0x57f7('0x2c')][_0x57f7('0x4b')]({'where':{'id':_0x557938[_0x57f7('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e2329,null))[_0x57f7('0x24')](function(_0x306b74){if(_0x306b74){_0x2d6548=_0x306b74;_0x1a904e[_0x57f7('0x35')]=_[_0x57f7('0x30')](db[_0x57f7('0x4c')]['rawAttributes']);_0x1a904e[_0x57f7('0x33')]=_['keys'](_0x557938[_0x57f7('0x33')]);_0x1a904e[_0x57f7('0x31')]=_[_0x57f7('0x32')](_0x1a904e[_0x57f7('0x35')],_0x1a904e[_0x57f7('0x33')]);_0x4ffd5d['attributes']=_[_0x57f7('0x32')](_0x1a904e[_0x57f7('0x35')],qs[_0x57f7('0x36')](_0x557938['query'][_0x57f7('0x36')]));_0x4ffd5d['attributes']=_0x4ffd5d[_0x57f7('0x34')][_0x57f7('0x37')]?_0x4ffd5d[_0x57f7('0x34')]:_0x1a904e['model'];_0x4ffd5d[_0x57f7('0x39')]=qs[_0x57f7('0x3a')](_0x557938[_0x57f7('0x33')][_0x57f7('0x3a')]);_0x4ffd5d[_0x57f7('0x3b')]=qs[_0x57f7('0x31')](_['pick'](_0x557938[_0x57f7('0x33')],_0x1a904e[_0x57f7('0x31')]));if(_0x557938[_0x57f7('0x33')][_0x57f7('0x3d')]){_0x4ffd5d['where']=_[_0x57f7('0x3e')](_0x4ffd5d[_0x57f7('0x3b')],{'$or':_[_0x57f7('0x2b')](_0x4ffd5d[_0x57f7('0x34')],function(_0x5951b1){var _0x544133={};_0x544133[_0x5951b1]={'$like':'%'+_0x557938[_0x57f7('0x33')][_0x57f7('0x3d')]+'%'};return _0x544133;})});}_0x4ffd5d=_[_0x57f7('0x3e')]({},_0x4ffd5d,_0x557938['options']);return _0x2d6548[_0x57f7('0x4f')](_0x4ffd5d);}})[_0x57f7('0x24')](function(_0x5c392d){if(_0x5c392d){_0x43bc50=_0x5c392d[_0x57f7('0x37')];if(!_0x557938[_0x57f7('0x33')][_0x57f7('0x38')]('nolimit')){_0x4ffd5d['limit']=qs[_0x57f7('0x1f')](_0x557938[_0x57f7('0x33')][_0x57f7('0x1f')]);_0x4ffd5d[_0x57f7('0x1c')]=qs['offset'](_0x557938[_0x57f7('0x33')][_0x57f7('0x1c')]);}return _0x2d6548[_0x57f7('0x4f')](_0x4ffd5d);}})[_0x57f7('0x24')](function(_0x49a695){if(_0x49a695){return _0x49a695?{'count':_0x43bc50,'rows':_0x49a695}:null;}})[_0x57f7('0x24')](respondWithResult(_0x1e2329,null))['catch'](handleError(_0x1e2329,null));};exports[_0x57f7('0x50')]=function(_0x278a91,_0x128cff,_0x5596bd){var _0xc959bd={};var _0x19868b={};var _0x1d2e89;var _0x224cc;return db[_0x57f7('0x2c')][_0x57f7('0x4b')]({'where':{'id':_0x278a91[_0x57f7('0x45')]['id']}})[_0x57f7('0x24')](handleEntityNotFound(_0x128cff,null))['then'](function(_0x2842ef){if(_0x2842ef){_0x1d2e89=_0x2842ef;_0x19868b[_0x57f7('0x35')]=_[_0x57f7('0x30')](db[_0x57f7('0x4c')]['rawAttributes']);_0x19868b[_0x57f7('0x33')]=_['keys'](_0x278a91[_0x57f7('0x33')]);_0x19868b[_0x57f7('0x31')]=_['intersection'](_0x19868b[_0x57f7('0x35')],_0x19868b[_0x57f7('0x33')]);_0xc959bd[_0x57f7('0x34')]=_['intersection'](_0x19868b[_0x57f7('0x35')],qs[_0x57f7('0x36')](_0x278a91['query'][_0x57f7('0x36')]));_0xc959bd[_0x57f7('0x34')]=_0xc959bd['attributes'][_0x57f7('0x37')]?_0xc959bd[_0x57f7('0x34')]:_0x19868b['model'];_0xc959bd[_0x57f7('0x39')]=qs[_0x57f7('0x3a')](_0x278a91[_0x57f7('0x33')][_0x57f7('0x3a')]);_0xc959bd[_0x57f7('0x3b')]=qs['filters'](_['pick'](_0x278a91[_0x57f7('0x33')],_0x19868b['filters']));if(_0x278a91[_0x57f7('0x33')][_0x57f7('0x3d')]){_0xc959bd[_0x57f7('0x3b')]=_['merge'](_0xc959bd['where'],{'$or':_[_0x57f7('0x2b')](_0xc959bd[_0x57f7('0x34')],function(_0x2ff904){var _0x31cdff={};_0x31cdff[_0x2ff904]={'$like':'%'+_0x278a91[_0x57f7('0x33')][_0x57f7('0x3d')]+'%'};return _0x31cdff;})});}_0xc959bd=_[_0x57f7('0x3e')]({},_0xc959bd,_0x278a91['options']);return _0x1d2e89['getDescriptions'](_0xc959bd);}})[_0x57f7('0x24')](function(_0x1f46ef){if(_0x1f46ef){_0x224cc=_0x1f46ef[_0x57f7('0x37')];if(!_0x278a91[_0x57f7('0x33')][_0x57f7('0x38')](_0x57f7('0x4e'))){_0xc959bd[_0x57f7('0x1f')]=qs[_0x57f7('0x1f')](_0x278a91[_0x57f7('0x33')]['limit']);_0xc959bd[_0x57f7('0x1c')]=qs[_0x57f7('0x1c')](_0x278a91[_0x57f7('0x33')][_0x57f7('0x1c')]);}return _0x1d2e89[_0x57f7('0x50')](_0xc959bd);}})[_0x57f7('0x24')](function(_0x4e1c68){if(_0x4e1c68){return _0x4e1c68?{'count':_0x224cc,'rows':_0x4e1c68}:null;}})['then'](respondWithResult(_0x128cff,null))[_0x57f7('0x49')](handleError(_0x128cff,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4b1608b..edbe9f8 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0x5dc888,_0xeffd84){var _0x3b4ceb=function(_0xebbefe){while(--_0xebbefe){_0x5dc888['push'](_0x5dc888['shift']());}};_0x3b4ceb(++_0xeffd84);}(_0xedd9,0xfc));var _0x9edd=function(_0x4064b6,_0x45ed94){_0x4064b6=_0x4064b6-0x0;var _0x174f0b=_0xedd9[_0x4064b6];return _0x174f0b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['define','Dynamics365Configuration','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x582204,_0x5816dd){var _0x45226c=function(_0x441066){while(--_0x441066){_0x582204['push'](_0x582204['shift']());}};_0x45226c(++_0x5816dd);}(_0x5b02,0xe9));var _0x25b0=function(_0x2f75ae,_0x52f0b6){_0x2f75ae=_0x2f75ae-0x0;var _0x48d85c=_0x5b02[_0x2f75ae];return _0x48d85c;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('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 b32a1eb..f2893cd 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 _0x8437=['code','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8437,0xe1));var _0x7843=function(_0x3124b3,_0x5df3bd){_0x3124b3=_0x3124b3-0x0;var _0x5ce488=_0x8437[_0x3124b3];return _0x5ce488;};'use strict';var _=require(_0x7843('0x0'));var util=require(_0x7843('0x1'));var moment=require(_0x7843('0x2'));var BPromise=require(_0x7843('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7843('0x4'));var db=require(_0x7843('0x5'))['db'];var utils=require(_0x7843('0x6'));var logger=require(_0x7843('0x7'))('rpc');var config=require(_0x7843('0x8'));var jayson=require(_0x7843('0x9'));var client=jayson['client'][_0x7843('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaa2eb4,_0x43c357,_0x5ffaf2){return new BPromise(function(_0x148e40,_0x35faf2){return client['request'](_0xaa2eb4,_0x5ffaf2)[_0x7843('0xb')](function(_0x34fa2e){logger[_0x7843('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43c357,'request\x20sent');logger[_0x7843('0xd')](_0x7843('0xe'),_0x43c357,'request\x20sent',JSON[_0x7843('0xf')](_0x34fa2e));if(_0x34fa2e[_0x7843('0x10')]){if(_0x34fa2e[_0x7843('0x10')][_0x7843('0x11')]===0x1f4){logger[_0x7843('0x10')](_0x7843('0x12'),_0x43c357,_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);return _0x35faf2(_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);}logger['error'](_0x7843('0x12'),_0x43c357,_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);return _0x148e40(_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);}else{logger[_0x7843('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43c357,_0x7843('0x14'));_0x148e40(_0x34fa2e[_0x7843('0x15')]['message']);}})['catch'](function(_0x4cf3e2){logger[_0x7843('0x10')](_0x7843('0x12'),_0x43c357,_0x4cf3e2);_0x35faf2(_0x4cf3e2);});});} \ No newline at end of file +var _0xaa95=['http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3715b3,_0x45af78){var _0x3d32c1=function(_0x1edaf6){while(--_0x1edaf6){_0x3715b3['push'](_0x3715b3['shift']());}};_0x3d32c1(++_0x45af78);}(_0xaa95,0x193));var _0x5aa9=function(_0x2d879e,_0x45cd61){_0x2d879e=_0x2d879e-0x0;var _0x11b621=_0xaa95[_0x2d879e];return _0x11b621;};'use strict';var _=require(_0x5aa9('0x0'));var util=require(_0x5aa9('0x1'));var moment=require(_0x5aa9('0x2'));var BPromise=require(_0x5aa9('0x3'));var rs=require(_0x5aa9('0x4'));var fs=require('fs');var Redis=require(_0x5aa9('0x5'));var db=require(_0x5aa9('0x6'))['db'];var utils=require(_0x5aa9('0x7'));var logger=require(_0x5aa9('0x8'))(_0x5aa9('0x9'));var config=require(_0x5aa9('0xa'));var jayson=require(_0x5aa9('0xb'));var client=jayson[_0x5aa9('0xc')][_0x5aa9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3dcf69,_0x38a574,_0x2162d0){return new BPromise(function(_0x257389,_0x3f8cdf){return client['request'](_0x3dcf69,_0x2162d0)[_0x5aa9('0xe')](function(_0x1d80af){logger[_0x5aa9('0xf')](_0x5aa9('0x10'),_0x38a574,'request\x20sent');logger[_0x5aa9('0x11')](_0x5aa9('0x12'),_0x38a574,_0x5aa9('0x13'),JSON[_0x5aa9('0x14')](_0x1d80af));if(_0x1d80af[_0x5aa9('0x15')]){if(_0x1d80af[_0x5aa9('0x15')][_0x5aa9('0x16')]===0x1f4){logger[_0x5aa9('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38a574,_0x1d80af[_0x5aa9('0x15')]['message']);return _0x3f8cdf(_0x1d80af[_0x5aa9('0x15')][_0x5aa9('0x17')]);}logger[_0x5aa9('0x15')](_0x5aa9('0x10'),_0x38a574,_0x1d80af[_0x5aa9('0x15')][_0x5aa9('0x17')]);return _0x257389(_0x1d80af[_0x5aa9('0x15')][_0x5aa9('0x17')]);}else{logger['info'](_0x5aa9('0x10'),_0x38a574,_0x5aa9('0x13'));_0x257389(_0x1d80af[_0x5aa9('0x18')][_0x5aa9('0x17')]);}})[_0x5aa9('0x19')](function(_0x200d08){logger[_0x5aa9('0x15')](_0x5aa9('0x10'),_0x38a574,_0x200d08);_0x3f8cdf(_0x200d08);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f77e0cd..5d7ddbc 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 _0xd3e3=['get','isAuthenticated','/:id','create','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x3314f1,_0x43ecad){var _0x2380c0=function(_0x3acb94){while(--_0x3acb94){_0x3314f1['push'](_0x3314f1['shift']());}};_0x2380c0(++_0x43ecad);}(_0xd3e3,0x19c));var _0x3d3e=function(_0x5d180a,_0x24766f){_0x5d180a=_0x5d180a-0x0;var _0x4d147d=_0xd3e3[_0x5d180a];return _0x4d147d;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d3e('0x1'));var express=require(_0x3d3e('0x2'));var router=express[_0x3d3e('0x3')]();var fs_extra=require(_0x3d3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x5'));var config=require(_0x3d3e('0x6'));var controller=require(_0x3d3e('0x7'));router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller['index']);router[_0x3d3e('0x8')](_0x3d3e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xb')]);router['put'](_0x3d3e('0xa'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xc')]);router['delete']('/:id',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xd')]);module[_0x3d3e('0xe')]=router; \ No newline at end of file +var _0x2219=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','update','delete','multer'];(function(_0x550af7,_0x3d29ef){var _0x32ab11=function(_0x46cd62){while(--_0x46cd62){_0x550af7['push'](_0x550af7['shift']());}};_0x32ab11(++_0x3d29ef);}(_0x2219,0x86));var _0x9221=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x2219[_0x3e8270];return _0x1ccde9;};'use strict';var multer=require(_0x9221('0x0'));var util=require(_0x9221('0x1'));var path=require(_0x9221('0x2'));var timeout=require(_0x9221('0x3'));var express=require('express');var router=express[_0x9221('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9221('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9221('0x6'));var controller=require(_0x9221('0x7'));router[_0x9221('0x8')]('/',auth[_0x9221('0x9')](),controller[_0x9221('0xa')]);router[_0x9221('0x8')](_0x9221('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9221('0xc')]('/',auth[_0x9221('0x9')](),controller['create']);router['put'](_0x9221('0xb'),auth[_0x9221('0x9')](),controller[_0x9221('0xd')]);router[_0x9221('0xe')]('/:id',auth[_0x9221('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 4d132c1..0ca0b35 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 _0xb6ce=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xb6ce,0x1f1));var _0xeb6c=function(_0xa7e8d4,_0x28758c){_0xa7e8d4=_0xa7e8d4-0x0;var _0x2a5c65=_0xb6ce[_0xa7e8d4];return _0x2a5c65;};'use strict';var Sequelize=require(_0xeb6c('0x0'));module[_0xeb6c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeb6c('0x2'),_0xeb6c('0x3'),_0xeb6c('0x4'),_0xeb6c('0x5'),_0xeb6c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeb6c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeb6c('0x8')]('string',_0xeb6c('0x3'),_0xeb6c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xeb6c('0x7')]},'nameField':{'type':Sequelize[_0xeb6c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe9c5=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xe9c5,0x189));var _0x5e9c=function(_0x1dae9b,_0x3df436){_0x1dae9b=_0x1dae9b-0x0;var _0x359503=_0xe9c5[_0x1dae9b];return _0x359503;};'use strict';var Sequelize=require(_0x5e9c('0x0'));module[_0x5e9c('0x1')]={'type':{'type':Sequelize[_0x5e9c('0x2')](_0x5e9c('0x3'),_0x5e9c('0x4'),_0x5e9c('0x5'),_0x5e9c('0x6'),_0x5e9c('0x7')),'defaultValue':_0x5e9c('0x3')},'content':{'type':Sequelize[_0x5e9c('0x8')]},'key':{'type':Sequelize[_0x5e9c('0x8')]},'keyType':{'type':Sequelize[_0x5e9c('0x2')](_0x5e9c('0x3'),_0x5e9c('0x4'),_0x5e9c('0x5'))},'keyContent':{'type':Sequelize[_0x5e9c('0x8')]},'idField':{'type':Sequelize[_0x5e9c('0x8')]},'nameField':{'type':Sequelize[_0x5e9c('0x8')]},'customField':{'type':Sequelize[_0x5e9c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e9c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c7ef6f7..7a83b95 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 _0xd979=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','json','apply','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','Dynamics365Field','includeAll','include','rows','show','rawAttributes','options','find','create','catch','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4d6490,_0x3e41aa){var _0x17b4f9=function(_0x5b93e5){while(--_0x5b93e5){_0x4d6490['push'](_0x4d6490['shift']());}};_0x17b4f9(++_0x3e41aa);}(_0xd979,0x7b));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9d97('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d97('0x1'));var moment=require(_0x9d97('0x2'));var BPromise=require(_0x9d97('0x3'));var Mustache=require(_0x9d97('0x4'));var util=require(_0x9d97('0x5'));var path=require(_0x9d97('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d97('0x7'));var _=require(_0x9d97('0x8'));var squel=require(_0x9d97('0x9'));var crypto=require('crypto');var jsforce=require(_0x9d97('0xa'));var deskjs=require(_0x9d97('0xb'));var toCsv=require(_0x9d97('0xc'));var querystring=require(_0x9d97('0xd'));var Papa=require(_0x9d97('0xe'));var Redis=require(_0x9d97('0xf'));var authService=require(_0x9d97('0x10'));var qs=require(_0x9d97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d97('0x12'));var logger=require(_0x9d97('0x13'))(_0x9d97('0x14'));var utils=require('../../config/utils');var config=require(_0x9d97('0x15'));var licenseUtil=require(_0x9d97('0x16'));var db=require(_0x9d97('0x17'))['db'];function respondWithStatusCode(_0xcd698,_0x3adc79){_0x3adc79=_0x3adc79||0xcc;return function(_0x238a75){if(_0x238a75){return _0xcd698['sendStatus'](_0x3adc79);}return _0xcd698['status'](_0x3adc79)['end']();};}function respondWithResult(_0x39344b,_0x48956f){_0x48956f=_0x48956f||0xc8;return function(_0x3a21cd){if(_0x3a21cd){return _0x39344b[_0x9d97('0x18')](_0x48956f)['json'](_0x3a21cd);}};}function respondWithFilteredResult(_0x7e7a35,_0x202515){return function(_0x80298d){if(_0x80298d){var _0x51ce86=typeof _0x202515['offset']===_0x9d97('0x19')&&typeof _0x202515[_0x9d97('0x1a')]===_0x9d97('0x19');var _0x180f46=_0x80298d[_0x9d97('0x1b')];var _0x7a2c47=_0x51ce86?0x0:_0x202515[_0x9d97('0x1c')];var _0x8bd74c=_0x51ce86?_0x80298d['count']:_0x202515[_0x9d97('0x1c')]+_0x202515[_0x9d97('0x1a')];var _0x245d04;if(_0x8bd74c>=_0x180f46){_0x8bd74c=_0x180f46;_0x245d04=0xc8;}else{_0x245d04=0xce;}_0x7e7a35[_0x9d97('0x18')](_0x245d04);return _0x7e7a35['set']('Content-Range',_0x7a2c47+'-'+_0x8bd74c+'/'+_0x180f46)[_0x9d97('0x1d')](_0x80298d);}return null;};}function patchUpdates(_0x295e9d){return function(_0x2f4f77){try{jsonpatch[_0x9d97('0x1e')](_0x2f4f77,_0x295e9d,!![]);}catch(_0x1aed77){return BPromise['reject'](_0x1aed77);}return _0x2f4f77[_0x9d97('0x1f')]();};}function saveUpdates(_0x3fcc5d,_0x36d077){return function(_0xdf6a4){if(_0xdf6a4){return _0xdf6a4[_0x9d97('0x20')](_0x3fcc5d)[_0x9d97('0x21')](function(_0x5a6c8c){return _0x5a6c8c;});}return null;};}function removeEntity(_0x26bbc2,_0x8223b8){return function(_0xa84bed){if(_0xa84bed){return _0xa84bed[_0x9d97('0x22')]()['then'](function(){_0x26bbc2['status'](0xcc)[_0x9d97('0x23')]();});}};}function handleEntityNotFound(_0x12fb70,_0x2a63ad){return function(_0x184d0f){if(!_0x184d0f){_0x12fb70[_0x9d97('0x24')](0x194);}return _0x184d0f;};}function handleError(_0x4eba78,_0x34b991){_0x34b991=_0x34b991||0x1f4;return function(_0x8c4cd9){logger['error'](_0x8c4cd9[_0x9d97('0x25')]);if(_0x8c4cd9[_0x9d97('0x26')]){delete _0x8c4cd9[_0x9d97('0x26')];}_0x4eba78[_0x9d97('0x18')](_0x34b991)[_0x9d97('0x27')](_0x8c4cd9);};}exports[_0x9d97('0x28')]=function(_0x25cd4a,_0x4d064c){var _0x546fc7={},_0x3112bf={},_0x7b003f={'count':0x0,'rows':[]};var _0x584da4=_[_0x9d97('0x29')](db['Dynamics365Field']['rawAttributes'],function(_0x25e78d){return{'name':_0x25e78d[_0x9d97('0x2a')],'type':_0x25e78d[_0x9d97('0x2b')][_0x9d97('0x2c')]};});_0x3112bf[_0x9d97('0x2d')]=_[_0x9d97('0x29')](_0x584da4,_0x9d97('0x26'));_0x3112bf['query']=_[_0x9d97('0x2e')](_0x25cd4a[_0x9d97('0x2f')]);_0x3112bf[_0x9d97('0x30')]=_[_0x9d97('0x31')](_0x3112bf[_0x9d97('0x2d')],_0x3112bf['query']);_0x546fc7[_0x9d97('0x32')]=_['intersection'](_0x3112bf[_0x9d97('0x2d')],qs[_0x9d97('0x33')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x33')]));_0x546fc7['attributes']=_0x546fc7[_0x9d97('0x32')][_0x9d97('0x34')]?_0x546fc7[_0x9d97('0x32')]:_0x3112bf['model'];if(!_0x25cd4a[_0x9d97('0x2f')]['hasOwnProperty']('nolimit')){_0x546fc7[_0x9d97('0x1a')]=qs[_0x9d97('0x1a')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x1a')]);_0x546fc7['offset']=qs['offset'](_0x25cd4a['query'][_0x9d97('0x1c')]);}_0x546fc7['order']=qs[_0x9d97('0x35')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x35')]);_0x546fc7[_0x9d97('0x36')]=qs[_0x9d97('0x30')](_[_0x9d97('0x37')](_0x25cd4a[_0x9d97('0x2f')],_0x3112bf[_0x9d97('0x30')]),_0x584da4);if(_0x25cd4a['query'][_0x9d97('0x38')]){_0x546fc7[_0x9d97('0x36')]=_[_0x9d97('0x39')](_0x546fc7[_0x9d97('0x36')],{'$or':_[_0x9d97('0x29')](_0x584da4,function(_0x95599c){if(_0x95599c[_0x9d97('0x2b')]!=='VIRTUAL'){var _0x896209={};_0x896209[_0x95599c[_0x9d97('0x26')]]={'$like':'%'+_0x25cd4a[_0x9d97('0x2f')]['filter']+'%'};return _0x896209;}})});}_0x546fc7=_[_0x9d97('0x39')]({},_0x546fc7,_0x25cd4a['options']);var _0x297711={'where':_0x546fc7['where']};return db[_0x9d97('0x3a')][_0x9d97('0x1b')](_0x297711)[_0x9d97('0x21')](function(_0x1cffa7){_0x7b003f['count']=_0x1cffa7;if(_0x25cd4a['query'][_0x9d97('0x3b')]){_0x546fc7[_0x9d97('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x546fc7);})[_0x9d97('0x21')](function(_0x5e6e8a){_0x7b003f[_0x9d97('0x3d')]=_0x5e6e8a;return _0x7b003f;})['then'](respondWithFilteredResult(_0x4d064c,_0x546fc7))['catch'](handleError(_0x4d064c,null));};exports[_0x9d97('0x3e')]=function(_0x16e42e,_0x3c0287){var _0x1403ea={'raw':!![],'where':{'id':_0x16e42e['params']['id']}},_0x1f4a15={};_0x1f4a15[_0x9d97('0x2d')]=_[_0x9d97('0x2e')](db[_0x9d97('0x3a')][_0x9d97('0x3f')]);_0x1f4a15[_0x9d97('0x2f')]=_[_0x9d97('0x2e')](_0x16e42e['query']);_0x1f4a15[_0x9d97('0x30')]=_[_0x9d97('0x31')](_0x1f4a15[_0x9d97('0x2d')],_0x1f4a15[_0x9d97('0x2f')]);_0x1403ea['attributes']=_[_0x9d97('0x31')](_0x1f4a15['model'],qs['fields'](_0x16e42e[_0x9d97('0x2f')][_0x9d97('0x33')]));_0x1403ea['attributes']=_0x1403ea[_0x9d97('0x32')][_0x9d97('0x34')]?_0x1403ea[_0x9d97('0x32')]:_0x1f4a15['model'];if(_0x16e42e[_0x9d97('0x2f')][_0x9d97('0x3b')]){_0x1403ea[_0x9d97('0x3c')]=[{'all':!![]}];}_0x1403ea=_['merge']({},_0x1403ea,_0x16e42e[_0x9d97('0x40')]);return db[_0x9d97('0x3a')][_0x9d97('0x41')](_0x1403ea)[_0x9d97('0x21')](handleEntityNotFound(_0x3c0287,null))[_0x9d97('0x21')](respondWithResult(_0x3c0287,null))['catch'](handleError(_0x3c0287,null));};exports[_0x9d97('0x42')]=function(_0x4a0fb3,_0x298da1){return db[_0x9d97('0x3a')]['create'](_0x4a0fb3['body'],{})[_0x9d97('0x21')](respondWithResult(_0x298da1,0xc9))[_0x9d97('0x43')](handleError(_0x298da1,null));};exports['update']=function(_0x5d2256,_0x5dab8f){if(_0x5d2256[_0x9d97('0x44')]['id']){delete _0x5d2256['body']['id'];}return db[_0x9d97('0x3a')][_0x9d97('0x41')]({'where':{'id':_0x5d2256[_0x9d97('0x45')]['id']}})[_0x9d97('0x21')](handleEntityNotFound(_0x5dab8f,null))['then'](saveUpdates(_0x5d2256[_0x9d97('0x44')],null))['then'](respondWithResult(_0x5dab8f,null))[_0x9d97('0x43')](handleError(_0x5dab8f,null));};exports[_0x9d97('0x22')]=function(_0x36f0cd,_0x11ed6d){return db['Dynamics365Field']['find']({'where':{'id':_0x36f0cd['params']['id']}})[_0x9d97('0x21')](handleEntityNotFound(_0x11ed6d,null))['then'](removeEntity(_0x11ed6d,null))['catch'](handleError(_0x11ed6d,null));}; \ No newline at end of file +var _0xa334=['index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','include','findAll','rows','show','params','intersection','includeAll','options','find','create','body','update','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','reject','then','destroy','sendStatus','error','stack','name','send'];(function(_0x2e7279,_0x28dd44){var _0x2e95a9=function(_0x596c05){while(--_0x596c05){_0x2e7279['push'](_0x2e7279['shift']());}};_0x2e95a9(++_0x28dd44);}(_0xa334,0x149));var _0x4a33=function(_0x380738,_0xae6ae8){_0x380738=_0x380738-0x0;var _0x1f9037=_0xa334[_0x380738];return _0x1f9037;};'use strict';var emlformat=require(_0x4a33('0x0'));var rimraf=require(_0x4a33('0x1'));var zipdir=require(_0x4a33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a33('0x3'));var moment=require(_0x4a33('0x4'));var BPromise=require(_0x4a33('0x5'));var Mustache=require(_0x4a33('0x6'));var util=require('util');var path=require(_0x4a33('0x7'));var sox=require(_0x4a33('0x8'));var csv=require('to-csv');var ejs=require(_0x4a33('0x9'));var fs=require('fs');var fs_extra=require(_0x4a33('0xa'));var _=require('lodash');var squel=require(_0x4a33('0xb'));var crypto=require(_0x4a33('0xc'));var jsforce=require(_0x4a33('0xd'));var deskjs=require(_0x4a33('0xe'));var toCsv=require(_0x4a33('0xf'));var querystring=require(_0x4a33('0x10'));var Papa=require(_0x4a33('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4a33('0x12'));var as=require(_0x4a33('0x13'));var hardwareService=require(_0x4a33('0x14'));var logger=require(_0x4a33('0x15'))(_0x4a33('0x16'));var utils=require('../../config/utils');var config=require(_0x4a33('0x17'));var licenseUtil=require(_0x4a33('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5c40,_0x4e290f){_0x4e290f=_0x4e290f||0xcc;return function(_0x422d00){if(_0x422d00){return _0x5e5c40['sendStatus'](_0x4e290f);}return _0x5e5c40[_0x4a33('0x19')](_0x4e290f)[_0x4a33('0x1a')]();};}function respondWithResult(_0x45f1c8,_0x32513d){_0x32513d=_0x32513d||0xc8;return function(_0x36cd3d){if(_0x36cd3d){return _0x45f1c8[_0x4a33('0x19')](_0x32513d)[_0x4a33('0x1b')](_0x36cd3d);}};}function respondWithFilteredResult(_0x4b4c6a,_0x32a9b4){return function(_0x452cc5){if(_0x452cc5){var _0x801cb8=typeof _0x32a9b4[_0x4a33('0x1c')]==='undefined'&&typeof _0x32a9b4[_0x4a33('0x1d')]===_0x4a33('0x1e');var _0x4e0062=_0x452cc5[_0x4a33('0x1f')];var _0x2397eb=_0x801cb8?0x0:_0x32a9b4[_0x4a33('0x1c')];var _0x369355=_0x801cb8?_0x452cc5[_0x4a33('0x1f')]:_0x32a9b4[_0x4a33('0x1c')]+_0x32a9b4['limit'];var _0x1f37bd;if(_0x369355>=_0x4e0062){_0x369355=_0x4e0062;_0x1f37bd=0xc8;}else{_0x1f37bd=0xce;}_0x4b4c6a['status'](_0x1f37bd);return _0x4b4c6a[_0x4a33('0x20')]('Content-Range',_0x2397eb+'-'+_0x369355+'/'+_0x4e0062)['json'](_0x452cc5);}return null;};}function patchUpdates(_0x1a39dd){return function(_0x2dae57){try{jsonpatch['apply'](_0x2dae57,_0x1a39dd,!![]);}catch(_0x59c399){return BPromise[_0x4a33('0x21')](_0x59c399);}return _0x2dae57['save']();};}function saveUpdates(_0x2fe3a4,_0x270c8a){return function(_0x443e65){if(_0x443e65){return _0x443e65['update'](_0x2fe3a4)[_0x4a33('0x22')](function(_0x2795d0){return _0x2795d0;});}return null;};}function removeEntity(_0x3ff65f,_0x3f23e0){return function(_0x39432a){if(_0x39432a){return _0x39432a[_0x4a33('0x23')]()['then'](function(){_0x3ff65f['status'](0xcc)[_0x4a33('0x1a')]();});}};}function handleEntityNotFound(_0x4a7564,_0x469a37){return function(_0x29f06c){if(!_0x29f06c){_0x4a7564[_0x4a33('0x24')](0x194);}return _0x29f06c;};}function handleError(_0x10f4ac,_0x4e6b58){_0x4e6b58=_0x4e6b58||0x1f4;return function(_0x46ad12){logger[_0x4a33('0x25')](_0x46ad12[_0x4a33('0x26')]);if(_0x46ad12['name']){delete _0x46ad12[_0x4a33('0x27')];}_0x10f4ac[_0x4a33('0x19')](_0x4e6b58)[_0x4a33('0x28')](_0x46ad12);};}exports[_0x4a33('0x29')]=function(_0x55a519,_0x5c946b){var _0x5aca3e={},_0x436e21={},_0xef258c={'count':0x0,'rows':[]};var _0x52cdaa=_[_0x4a33('0x2a')](db[_0x4a33('0x2b')][_0x4a33('0x2c')],function(_0x470df2){return{'name':_0x470df2[_0x4a33('0x2d')],'type':_0x470df2[_0x4a33('0x2e')][_0x4a33('0x2f')]};});_0x436e21[_0x4a33('0x30')]=_['map'](_0x52cdaa,_0x4a33('0x27'));_0x436e21[_0x4a33('0x31')]=_[_0x4a33('0x32')](_0x55a519['query']);_0x436e21[_0x4a33('0x33')]=_['intersection'](_0x436e21[_0x4a33('0x30')],_0x436e21[_0x4a33('0x31')]);_0x5aca3e['attributes']=_['intersection'](_0x436e21[_0x4a33('0x30')],qs[_0x4a33('0x34')](_0x55a519['query']['fields']));_0x5aca3e[_0x4a33('0x35')]=_0x5aca3e[_0x4a33('0x35')][_0x4a33('0x36')]?_0x5aca3e[_0x4a33('0x35')]:_0x436e21[_0x4a33('0x30')];if(!_0x55a519[_0x4a33('0x31')]['hasOwnProperty'](_0x4a33('0x37'))){_0x5aca3e[_0x4a33('0x1d')]=qs[_0x4a33('0x1d')](_0x55a519[_0x4a33('0x31')][_0x4a33('0x1d')]);_0x5aca3e[_0x4a33('0x1c')]=qs['offset'](_0x55a519[_0x4a33('0x31')][_0x4a33('0x1c')]);}_0x5aca3e['order']=qs[_0x4a33('0x38')](_0x55a519['query'][_0x4a33('0x38')]);_0x5aca3e[_0x4a33('0x39')]=qs['filters'](_[_0x4a33('0x3a')](_0x55a519[_0x4a33('0x31')],_0x436e21[_0x4a33('0x33')]),_0x52cdaa);if(_0x55a519[_0x4a33('0x31')][_0x4a33('0x3b')]){_0x5aca3e[_0x4a33('0x39')]=_[_0x4a33('0x3c')](_0x5aca3e[_0x4a33('0x39')],{'$or':_[_0x4a33('0x2a')](_0x52cdaa,function(_0x1cc67f){if(_0x1cc67f[_0x4a33('0x2e')]!=='VIRTUAL'){var _0x333aef={};_0x333aef[_0x1cc67f[_0x4a33('0x27')]]={'$like':'%'+_0x55a519[_0x4a33('0x31')][_0x4a33('0x3b')]+'%'};return _0x333aef;}})});}_0x5aca3e=_['merge']({},_0x5aca3e,_0x55a519['options']);var _0x597127={'where':_0x5aca3e['where']};return db[_0x4a33('0x2b')][_0x4a33('0x1f')](_0x597127)[_0x4a33('0x22')](function(_0x876b03){_0xef258c[_0x4a33('0x1f')]=_0x876b03;if(_0x55a519[_0x4a33('0x31')]['includeAll']){_0x5aca3e[_0x4a33('0x3d')]=[{'all':!![]}];}return db[_0x4a33('0x2b')][_0x4a33('0x3e')](_0x5aca3e);})[_0x4a33('0x22')](function(_0x439e56){_0xef258c[_0x4a33('0x3f')]=_0x439e56;return _0xef258c;})[_0x4a33('0x22')](respondWithFilteredResult(_0x5c946b,_0x5aca3e))['catch'](handleError(_0x5c946b,null));};exports[_0x4a33('0x40')]=function(_0x5e97e5,_0x4ab72f){var _0x33716e={'raw':!![],'where':{'id':_0x5e97e5[_0x4a33('0x41')]['id']}},_0x6efb0a={};_0x6efb0a[_0x4a33('0x30')]=_[_0x4a33('0x32')](db['Dynamics365Field']['rawAttributes']);_0x6efb0a['query']=_[_0x4a33('0x32')](_0x5e97e5[_0x4a33('0x31')]);_0x6efb0a[_0x4a33('0x33')]=_['intersection'](_0x6efb0a['model'],_0x6efb0a[_0x4a33('0x31')]);_0x33716e[_0x4a33('0x35')]=_[_0x4a33('0x42')](_0x6efb0a[_0x4a33('0x30')],qs['fields'](_0x5e97e5['query'][_0x4a33('0x34')]));_0x33716e[_0x4a33('0x35')]=_0x33716e[_0x4a33('0x35')][_0x4a33('0x36')]?_0x33716e[_0x4a33('0x35')]:_0x6efb0a[_0x4a33('0x30')];if(_0x5e97e5[_0x4a33('0x31')][_0x4a33('0x43')]){_0x33716e[_0x4a33('0x3d')]=[{'all':!![]}];}_0x33716e=_[_0x4a33('0x3c')]({},_0x33716e,_0x5e97e5[_0x4a33('0x44')]);return db[_0x4a33('0x2b')][_0x4a33('0x45')](_0x33716e)[_0x4a33('0x22')](handleEntityNotFound(_0x4ab72f,null))['then'](respondWithResult(_0x4ab72f,null))['catch'](handleError(_0x4ab72f,null));};exports['create']=function(_0x1960db,_0xa945b1){return db[_0x4a33('0x2b')][_0x4a33('0x46')](_0x1960db[_0x4a33('0x47')],{})[_0x4a33('0x22')](respondWithResult(_0xa945b1,0xc9))['catch'](handleError(_0xa945b1,null));};exports[_0x4a33('0x48')]=function(_0x470058,_0x1e0ca2){if(_0x470058['body']['id']){delete _0x470058[_0x4a33('0x47')]['id'];}return db['Dynamics365Field'][_0x4a33('0x45')]({'where':{'id':_0x470058[_0x4a33('0x41')]['id']}})[_0x4a33('0x22')](handleEntityNotFound(_0x1e0ca2,null))[_0x4a33('0x22')](saveUpdates(_0x470058['body'],null))[_0x4a33('0x22')](respondWithResult(_0x1e0ca2,null))[_0x4a33('0x49')](handleError(_0x1e0ca2,null));};exports[_0x4a33('0x23')]=function(_0x359ffb,_0x58b889){return db[_0x4a33('0x2b')][_0x4a33('0x45')]({'where':{'id':_0x359ffb[_0x4a33('0x41')]['id']}})['then'](handleEntityNotFound(_0x58b889,null))['then'](removeEntity(_0x58b889,null))[_0x4a33('0x49')](handleError(_0x58b889,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ba6d392..bc78090 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 _0x8394=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x46ad9e,_0x203184){var _0x5727cb=function(_0x32a93e){while(--_0x32a93e){_0x46ad9e['push'](_0x46ad9e['shift']());}};_0x5727cb(++_0x203184);}(_0x8394,0x120));var _0x4839=function(_0xced9e2,_0xb6a6a0){_0xced9e2=_0xced9e2-0x0;var _0x4e69dd=_0x8394[_0xced9e2];return _0x4e69dd;};'use strict';var _=require(_0x4839('0x0'));var util=require(_0x4839('0x1'));var logger=require(_0x4839('0x2'))(_0x4839('0x3'));var moment=require(_0x4839('0x4'));var BPromise=require(_0x4839('0x5'));var rp=require(_0x4839('0x6'));var fs=require('fs');var path=require(_0x4839('0x7'));var rimraf=require(_0x4839('0x8'));var config=require('../../config/environment');var attributes=require(_0x4839('0x9'));module[_0x4839('0xa')]=function(_0x171d63,_0x18b0e4){return _0x171d63['define'](_0x4839('0xb'),attributes,{'tableName':_0x4839('0xc'),'paranoid':![],'indexes':[{'name':_0x4839('0xd'),'fields':[_0x4839('0xe'),_0x4839('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cc1=['int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x3f53df,_0x1f0fdd){var _0x1af68e=function(_0x78a25c){while(--_0x78a25c){_0x3f53df['push'](_0x3f53df['shift']());}};_0x1af68e(++_0x1f0fdd);}(_0x0cc1,0xd5));var _0x10cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10cc('0x0'));var util=require(_0x10cc('0x1'));var logger=require(_0x10cc('0x2'))(_0x10cc('0x3'));var moment=require('moment');var BPromise=require(_0x10cc('0x4'));var rp=require(_0x10cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10cc('0x6'));var config=require(_0x10cc('0x7'));var attributes=require(_0x10cc('0x8'));module[_0x10cc('0x9')]=function(_0x2f787c,_0x3ab55b){return _0x2f787c[_0x10cc('0xa')](_0x10cc('0xb'),attributes,{'tableName':_0x10cc('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x10cc('0xd'),_0x10cc('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 82c0e39..87adad7 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 _0x2b15=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x2b15,0x7c));var _0x52b1=function(_0x44511e,_0x2242ba){_0x44511e=_0x44511e-0x0;var _0x243798=_0x2b15[_0x44511e];return _0x243798;};'use strict';var _=require('lodash');var util=require(_0x52b1('0x0'));var moment=require(_0x52b1('0x1'));var BPromise=require(_0x52b1('0x2'));var rs=require(_0x52b1('0x3'));var fs=require('fs');var Redis=require(_0x52b1('0x4'));var db=require(_0x52b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x52b1('0x6'))(_0x52b1('0x7'));var config=require(_0x52b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x52b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36f950,_0x1acf41,_0xabfe03){return new BPromise(function(_0x17a3c3,_0x4ad73e){return client[_0x52b1('0xa')](_0x36f950,_0xabfe03)[_0x52b1('0xb')](function(_0x4c6670){logger[_0x52b1('0xc')](_0x52b1('0xd'),_0x1acf41,'request\x20sent');logger[_0x52b1('0xe')](_0x52b1('0xf'),_0x1acf41,_0x52b1('0x10'),JSON['stringify'](_0x4c6670));if(_0x4c6670['error']){if(_0x4c6670[_0x52b1('0x11')][_0x52b1('0x12')]===0x1f4){logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x4c6670['error'][_0x52b1('0x13')]);return _0x4ad73e(_0x4c6670[_0x52b1('0x11')][_0x52b1('0x13')]);}logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x4c6670[_0x52b1('0x11')][_0x52b1('0x13')]);return _0x17a3c3(_0x4c6670['error']['message']);}else{logger[_0x52b1('0xc')](_0x52b1('0xd'),_0x1acf41,_0x52b1('0x10'));_0x17a3c3(_0x4c6670[_0x52b1('0x14')][_0x52b1('0x13')]);}})['catch'](function(_0x525cb7){logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x525cb7);_0x4ad73e(_0x525cb7);});});} \ No newline at end of file +var _0xe29f=['http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x1c623b,_0x1adf0f){var _0x490bef=function(_0x528dca){while(--_0x528dca){_0x1c623b['push'](_0x1c623b['shift']());}};_0x490bef(++_0x1adf0f);}(_0xe29f,0x1e7));var _0xfe29=function(_0x6f8934,_0x48c88f){_0x6f8934=_0x6f8934-0x0;var _0x21af99=_0xe29f[_0x6f8934];return _0x21af99;};'use strict';var _=require(_0xfe29('0x0'));var util=require('util');var moment=require(_0xfe29('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe29('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe29('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe29('0x4'))(_0xfe29('0x5'));var config=require('../../config/environment');var jayson=require(_0xfe29('0x6'));var client=jayson['client'][_0xfe29('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e944d,_0x2b0481,_0x399f65){return new BPromise(function(_0x4eca19,_0x27b0f0){return client[_0xfe29('0x8')](_0x4e944d,_0x399f65)[_0xfe29('0x9')](function(_0xee01ed){logger['info'](_0xfe29('0xa'),_0x2b0481,'request\x20sent');logger[_0xfe29('0xb')](_0xfe29('0xc'),_0x2b0481,_0xfe29('0xd'),JSON['stringify'](_0xee01ed));if(_0xee01ed['error']){if(_0xee01ed[_0xfe29('0xe')]['code']===0x1f4){logger[_0xfe29('0xe')](_0xfe29('0xa'),_0x2b0481,_0xee01ed[_0xfe29('0xe')][_0xfe29('0xf')]);return _0x27b0f0(_0xee01ed[_0xfe29('0xe')]['message']);}logger[_0xfe29('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x2b0481,_0xee01ed[_0xfe29('0xe')][_0xfe29('0xf')]);return _0x4eca19(_0xee01ed['error']['message']);}else{logger[_0xfe29('0x10')](_0xfe29('0xa'),_0x2b0481,_0xfe29('0xd'));_0x4eca19(_0xee01ed[_0xfe29('0x11')][_0xfe29('0xf')]);}})[_0xfe29('0x12')](function(_0xc13ac4){logger[_0xfe29('0xe')](_0xfe29('0xa'),_0x2b0481,_0xc13ac4);_0x27b0f0(_0xc13ac4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c345188..95c21fc 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 _0x74b0=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','/:id'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x74b0,0x1d5));var _0x074b=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x74b0[_0x741a7b];return _0x43a8e6;};'use strict';var multer=require(_0x074b('0x0'));var util=require(_0x074b('0x1'));var path=require(_0x074b('0x2'));var timeout=require(_0x074b('0x3'));var express=require(_0x074b('0x4'));var router=express[_0x074b('0x5')]();var fs_extra=require(_0x074b('0x6'));var auth=require(_0x074b('0x7'));var interaction=require(_0x074b('0x8'));var config=require(_0x074b('0x9'));var controller=require(_0x074b('0xa'));router['get']('/',auth[_0x074b('0xb')](),controller['index']);router[_0x074b('0xc')](_0x074b('0xd'),auth[_0x074b('0xb')](),controller[_0x074b('0xe')]);router[_0x074b('0xc')](_0x074b('0xf'),auth[_0x074b('0xb')](),controller[_0x074b('0x10')]);router['get']('/:id/fields',auth[_0x074b('0xb')](),controller[_0x074b('0x11')]);router[_0x074b('0x12')]('/',auth[_0x074b('0xb')](),controller[_0x074b('0x13')]);router[_0x074b('0x12')](_0x074b('0xf'),auth[_0x074b('0xb')](),controller[_0x074b('0x14')]);router[_0x074b('0x15')]('/:id',auth[_0x074b('0xb')](),controller[_0x074b('0x16')]);router['delete'](_0x074b('0xd'),auth[_0x074b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6a6f=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','getFields','create','post','/:id/configurations','put','/:id','update'];(function(_0x11b5a6,_0x2fc369){var _0x1203c6=function(_0xd4e996){while(--_0xd4e996){_0x11b5a6['push'](_0x11b5a6['shift']());}};_0x1203c6(++_0x2fc369);}(_0x6a6f,0xdd));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf6a6('0x0'));var util=require(_0xf6a6('0x1'));var path=require(_0xf6a6('0x2'));var timeout=require(_0xf6a6('0x3'));var express=require(_0xf6a6('0x4'));var router=express[_0xf6a6('0x5')]();var fs_extra=require(_0xf6a6('0x6'));var auth=require(_0xf6a6('0x7'));var interaction=require(_0xf6a6('0x8'));var config=require(_0xf6a6('0x9'));var controller=require(_0xf6a6('0xa'));router[_0xf6a6('0xb')]('/',auth[_0xf6a6('0xc')](),controller['index']);router[_0xf6a6('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf6a6('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf6a6('0xb')]('/:id/fields',auth[_0xf6a6('0xc')](),controller[_0xf6a6('0xe')]);router['post']('/',auth[_0xf6a6('0xc')](),controller[_0xf6a6('0xf')]);router[_0xf6a6('0x10')](_0xf6a6('0x11'),auth[_0xf6a6('0xc')](),controller['addConfiguration']);router[_0xf6a6('0x12')](_0xf6a6('0x13'),auth[_0xf6a6('0xc')](),controller[_0xf6a6('0x14')]);router[_0xf6a6('0x15')](_0xf6a6('0x13'),auth[_0xf6a6('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1e81c16..52fd12b 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 _0x93e9=['sequelize','exports','STRING','username'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x93e9,0xcc));var _0x993e=function(_0x2c5741,_0x2b1bfb){_0x2c5741=_0x2c5741-0x0;var _0x49ec16=_0x93e9[_0x2c5741];return _0x49ec16;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd4a2=['STRING','username','sequelize'];(function(_0x433624,_0x4388e3){var _0x4af78f=function(_0x29af08){while(--_0x29af08){_0x433624['push'](_0x433624['shift']());}};_0x4af78f(++_0x4388e3);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2cab5f,_0x43bc99){_0x2cab5f=_0x2cab5f-0x0;var _0x457037=_0xd4a2[_0x2cab5f];return _0x457037;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4a6f351..880b3ff 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 _0x3b59=['includeAll','findAll','rows','catch','show','params','include','create','body','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','apiKey','toString','subject','agent','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x3b59,0x9c));var _0x93b5=function(_0xf71220,_0x3ec190){_0xf71220=_0xf71220-0x0;var _0x6efb4f=_0x3b59[_0xf71220];return _0x6efb4f;};'use strict';var emlformat=require(_0x93b5('0x0'));var rimraf=require(_0x93b5('0x1'));var zipdir=require(_0x93b5('0x2'));var jsonpatch=require(_0x93b5('0x3'));var rp=require(_0x93b5('0x4'));var moment=require(_0x93b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93b5('0x6'));var util=require('util');var path=require(_0x93b5('0x7'));var sox=require(_0x93b5('0x8'));var csv=require(_0x93b5('0x9'));var ejs=require(_0x93b5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93b5('0xb'));var squel=require(_0x93b5('0xc'));var crypto=require(_0x93b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x93b5('0xe'));var toCsv=require(_0x93b5('0x9'));var querystring=require(_0x93b5('0xf'));var Papa=require(_0x93b5('0x10'));var Redis=require(_0x93b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93b5('0x12'));var as=require(_0x93b5('0x13'));var hardwareService=require(_0x93b5('0x14'));var logger=require(_0x93b5('0x15'))(_0x93b5('0x16'));var utils=require('../../config/utils');var config=require(_0x93b5('0x17'));var licenseUtil=require(_0x93b5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x93b5('0x19'));function respondWithStatusCode(_0x1d80b2,_0x3022c2){_0x3022c2=_0x3022c2||0xcc;return function(_0x3dad37){if(_0x3dad37){return _0x1d80b2[_0x93b5('0x1a')](_0x3022c2);}return _0x1d80b2['status'](_0x3022c2)[_0x93b5('0x1b')]();};}function respondWithResult(_0x151e45,_0x4e9b23){_0x4e9b23=_0x4e9b23||0xc8;return function(_0x15ffe2){if(_0x15ffe2){return _0x151e45[_0x93b5('0x1c')](_0x4e9b23)[_0x93b5('0x1d')](_0x15ffe2);}};}function respondWithFilteredResult(_0x4c3d28,_0x39d8f5){return function(_0x546d3e){if(_0x546d3e){var _0x4cb6bf=typeof _0x39d8f5[_0x93b5('0x1e')]==='undefined'&&typeof _0x39d8f5[_0x93b5('0x1f')]===_0x93b5('0x20');var _0xc92c18=_0x546d3e['count'];var _0x4fa3ae=_0x4cb6bf?0x0:_0x39d8f5['offset'];var _0x16e6e6=_0x4cb6bf?_0x546d3e[_0x93b5('0x21')]:_0x39d8f5[_0x93b5('0x1e')]+_0x39d8f5[_0x93b5('0x1f')];var _0x1c4019;if(_0x16e6e6>=_0xc92c18){_0x16e6e6=_0xc92c18;_0x1c4019=0xc8;}else{_0x1c4019=0xce;}_0x4c3d28[_0x93b5('0x1c')](_0x1c4019);return _0x4c3d28[_0x93b5('0x22')](_0x93b5('0x23'),_0x4fa3ae+'-'+_0x16e6e6+'/'+_0xc92c18)[_0x93b5('0x1d')](_0x546d3e);}return null;};}function patchUpdates(_0x3ba1bc){return function(_0x5c1172){try{jsonpatch['apply'](_0x5c1172,_0x3ba1bc,!![]);}catch(_0x3e2452){return BPromise[_0x93b5('0x24')](_0x3e2452);}return _0x5c1172['save']();};}function saveUpdates(_0x170379,_0x1d8270){return function(_0x2e9e75){if(_0x2e9e75){return _0x2e9e75[_0x93b5('0x25')](_0x170379)[_0x93b5('0x26')](function(_0x194ae3){return _0x194ae3;});}return null;};}function removeEntity(_0x45c8ee,_0x7f6df6){return function(_0x1c7349){if(_0x1c7349){return _0x1c7349[_0x93b5('0x27')]()[_0x93b5('0x26')](function(){_0x45c8ee[_0x93b5('0x1c')](0xcc)[_0x93b5('0x1b')]();});}};}function handleEntityNotFound(_0x3a31db,_0x3494f){return function(_0x7eed38){if(!_0x7eed38){_0x3a31db[_0x93b5('0x1a')](0x194);}return _0x7eed38;};}function handleError(_0x11add6,_0x4977df){_0x4977df=_0x4977df||0x1f4;return function(_0xc6c370){logger[_0x93b5('0x28')](_0xc6c370[_0x93b5('0x29')]);if(_0xc6c370[_0x93b5('0x2a')]){delete _0xc6c370[_0x93b5('0x2a')];}_0x11add6[_0x93b5('0x1c')](_0x4977df)[_0x93b5('0x2b')](_0xc6c370);};}exports[_0x93b5('0x2c')]=function(_0x59389b,_0x2a6b07){var _0x239f96={},_0x54bc50={},_0xf7fc9c={'count':0x0,'rows':[]};var _0x4e4212=_[_0x93b5('0x2d')](db[_0x93b5('0x2e')][_0x93b5('0x2f')],function(_0x1a3495){return{'name':_0x1a3495[_0x93b5('0x30')],'type':_0x1a3495[_0x93b5('0x31')][_0x93b5('0x32')]};});_0x54bc50[_0x93b5('0x33')]=_[_0x93b5('0x2d')](_0x4e4212,_0x93b5('0x2a'));_0x54bc50['query']=_[_0x93b5('0x34')](_0x59389b['query']);_0x54bc50['filters']=_['intersection'](_0x54bc50['model'],_0x54bc50[_0x93b5('0x35')]);_0x239f96[_0x93b5('0x36')]=_[_0x93b5('0x37')](_0x54bc50[_0x93b5('0x33')],qs[_0x93b5('0x38')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x38')]));_0x239f96[_0x93b5('0x36')]=_0x239f96[_0x93b5('0x36')][_0x93b5('0x39')]?_0x239f96[_0x93b5('0x36')]:_0x54bc50['model'];if(!_0x59389b['query'][_0x93b5('0x3a')](_0x93b5('0x3b'))){_0x239f96[_0x93b5('0x1f')]=qs[_0x93b5('0x1f')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x1f')]);_0x239f96['offset']=qs['offset'](_0x59389b['query']['offset']);}_0x239f96['order']=qs[_0x93b5('0x3c')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x3c')]);_0x239f96[_0x93b5('0x3d')]=qs[_0x93b5('0x3e')](_[_0x93b5('0x3f')](_0x59389b[_0x93b5('0x35')],_0x54bc50[_0x93b5('0x3e')]),_0x4e4212);if(_0x59389b[_0x93b5('0x35')][_0x93b5('0x40')]){_0x239f96['where']=_['merge'](_0x239f96['where'],{'$or':_[_0x93b5('0x2d')](_0x4e4212,function(_0x394400){if(_0x394400[_0x93b5('0x31')]!==_0x93b5('0x41')){var _0x751eff={};_0x751eff[_0x394400[_0x93b5('0x2a')]]={'$like':'%'+_0x59389b['query'][_0x93b5('0x40')]+'%'};return _0x751eff;}})});}_0x239f96=_[_0x93b5('0x42')]({},_0x239f96,_0x59389b[_0x93b5('0x43')]);var _0x5d5134={'where':_0x239f96[_0x93b5('0x3d')]};return db[_0x93b5('0x2e')]['count'](_0x5d5134)['then'](function(_0xa46dca){_0xf7fc9c[_0x93b5('0x21')]=_0xa46dca;if(_0x59389b[_0x93b5('0x35')][_0x93b5('0x44')]){_0x239f96['include']=[{'all':!![]}];}return db[_0x93b5('0x2e')][_0x93b5('0x45')](_0x239f96);})[_0x93b5('0x26')](function(_0x30188f){_0xf7fc9c[_0x93b5('0x46')]=_0x30188f;return _0xf7fc9c;})[_0x93b5('0x26')](respondWithFilteredResult(_0x2a6b07,_0x239f96))[_0x93b5('0x47')](handleError(_0x2a6b07,null));};exports[_0x93b5('0x48')]=function(_0x51726a,_0x4cabd8){var _0x22b4cf={'raw':![],'where':{'id':_0x51726a[_0x93b5('0x49')]['id']}},_0x290e26={};_0x290e26[_0x93b5('0x33')]=_[_0x93b5('0x34')](db[_0x93b5('0x2e')][_0x93b5('0x2f')]);_0x290e26[_0x93b5('0x35')]=_[_0x93b5('0x34')](_0x51726a[_0x93b5('0x35')]);_0x290e26['filters']=_[_0x93b5('0x37')](_0x290e26['model'],_0x290e26[_0x93b5('0x35')]);_0x22b4cf[_0x93b5('0x36')]=_[_0x93b5('0x37')](_0x290e26['model'],qs[_0x93b5('0x38')](_0x51726a[_0x93b5('0x35')][_0x93b5('0x38')]));_0x22b4cf[_0x93b5('0x36')]=_0x22b4cf[_0x93b5('0x36')][_0x93b5('0x39')]?_0x22b4cf[_0x93b5('0x36')]:_0x290e26['model'];if(_0x51726a[_0x93b5('0x35')][_0x93b5('0x44')]){_0x22b4cf[_0x93b5('0x4a')]=[{'all':!![]}];}_0x22b4cf=_[_0x93b5('0x42')]({},_0x22b4cf,_0x51726a['options']);return db[_0x93b5('0x2e')]['find'](_0x22b4cf)['then'](handleEntityNotFound(_0x4cabd8,null))['then'](respondWithResult(_0x4cabd8,null))[_0x93b5('0x47')](handleError(_0x4cabd8,null));};exports[_0x93b5('0x4b')]=function(_0x6d8e3b,_0x19717d){return db[_0x93b5('0x2e')][_0x93b5('0x4b')](_0x6d8e3b[_0x93b5('0x4c')],{})['then'](respondWithResult(_0x19717d,0xc9))[_0x93b5('0x47')](handleError(_0x19717d,null));};exports[_0x93b5('0x25')]=function(_0x488c3c,_0x505217){if(_0x488c3c[_0x93b5('0x4c')]['id']){delete _0x488c3c[_0x93b5('0x4c')]['id'];}return db[_0x93b5('0x2e')]['find']({'where':{'id':_0x488c3c['params']['id']}})['then'](handleEntityNotFound(_0x505217,null))[_0x93b5('0x26')](saveUpdates(_0x488c3c['body'],null))['then'](respondWithResult(_0x505217,null))[_0x93b5('0x47')](handleError(_0x505217,null));};exports['destroy']=function(_0x27a39a,_0x5eee7d){return db[_0x93b5('0x2e')]['find']({'where':{'id':_0x27a39a['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x5eee7d,null))[_0x93b5('0x26')](removeEntity(_0x5eee7d,null))[_0x93b5('0x47')](handleError(_0x5eee7d,null));};exports[_0x93b5('0x4d')]=function(_0x27c467,_0x53b4c1,_0x4b6792){var _0x49c5fd={};var _0x21c070={};var _0xe7b552;var _0x3b47bb;return db[_0x93b5('0x2e')]['findOne']({'where':{'id':_0x27c467['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x53b4c1,null))['then'](function(_0x4853bf){if(_0x4853bf){_0xe7b552=_0x4853bf;_0x21c070[_0x93b5('0x33')]=_[_0x93b5('0x34')](db['FreshdeskConfiguration'][_0x93b5('0x2f')]);_0x21c070['query']=_[_0x93b5('0x34')](_0x27c467[_0x93b5('0x35')]);_0x21c070[_0x93b5('0x3e')]=_[_0x93b5('0x37')](_0x21c070[_0x93b5('0x33')],_0x21c070['query']);_0x49c5fd['attributes']=_[_0x93b5('0x37')](_0x21c070['model'],qs['fields'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x38')]));_0x49c5fd['attributes']=_0x49c5fd[_0x93b5('0x36')]['length']?_0x49c5fd[_0x93b5('0x36')]:_0x21c070['model'];_0x49c5fd[_0x93b5('0x4e')]=qs['sort'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x3c')]);_0x49c5fd['where']=qs['filters'](_[_0x93b5('0x3f')](_0x27c467[_0x93b5('0x35')],_0x21c070[_0x93b5('0x3e')]));if(_0x27c467['query'][_0x93b5('0x40')]){_0x49c5fd[_0x93b5('0x3d')]=_[_0x93b5('0x42')](_0x49c5fd[_0x93b5('0x3d')],{'$or':_[_0x93b5('0x2d')](_0x49c5fd[_0x93b5('0x36')],function(_0x4b3474){var _0x3d19a6={};_0x3d19a6[_0x4b3474]={'$like':'%'+_0x27c467[_0x93b5('0x35')]['filter']+'%'};return _0x3d19a6;})});}_0x49c5fd=_[_0x93b5('0x42')]({},_0x49c5fd,_0x27c467[_0x93b5('0x43')]);return _0xe7b552[_0x93b5('0x4d')](_0x49c5fd);}})[_0x93b5('0x26')](function(_0x152888){if(_0x152888){_0x3b47bb=_0x152888[_0x93b5('0x39')];if(!_0x27c467[_0x93b5('0x35')][_0x93b5('0x3a')](_0x93b5('0x3b'))){_0x49c5fd[_0x93b5('0x1f')]=qs[_0x93b5('0x1f')](_0x27c467[_0x93b5('0x35')]['limit']);_0x49c5fd[_0x93b5('0x1e')]=qs['offset'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x1e')]);}return _0xe7b552[_0x93b5('0x4d')](_0x49c5fd);}})[_0x93b5('0x26')](function(_0x4efdb7){if(_0x4efdb7){return _0x4efdb7?{'count':_0x3b47bb,'rows':_0x4efdb7}:null;}})['then'](respondWithResult(_0x53b4c1,null))[_0x93b5('0x47')](handleError(_0x53b4c1,null));};exports[_0x93b5('0x4f')]=function(_0x2537c1,_0x465792,_0x288701){if(_0x2537c1[_0x93b5('0x4c')]['id']){delete _0x2537c1[_0x93b5('0x4c')]['id'];}return db['FreshdeskAccount'][_0x93b5('0x50')]({'where':{'id':_0x2537c1['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x465792,null))[_0x93b5('0x26')](function(_0x1db0ef){if(_0x1db0ef){_0x2537c1['body'][_0x93b5('0x51')]=_0x1db0ef['id'];_0x2537c1[_0x93b5('0x4c')][_0x93b5('0x52')]=integrations[_0x93b5('0x53')](_0x2537c1['body'][_0x93b5('0x54')],_0x2537c1['body'][_0x93b5('0x31')]);_0x2537c1['body'][_0x93b5('0x55')]=integrations[_0x93b5('0x56')](_0x2537c1[_0x93b5('0x4c')]['channel'],_0x2537c1[_0x93b5('0x4c')]['type']);return db['FreshdeskConfiguration'][_0x93b5('0x4b')](_0x2537c1[_0x93b5('0x4c')],{'include':[{'model':db['FreshdeskField'],'as':_0x93b5('0x52')},{'model':db['FreshdeskField'],'as':_0x93b5('0x55')}]});}return null;})['then'](respondWithResult(_0x465792,null))[_0x93b5('0x47')](handleError(_0x465792,null));};exports[_0x93b5('0x57')]=function(_0x4efd03,_0x22c366,_0x8db8db){var _0x2ad932='';return db[_0x93b5('0x2e')][_0x93b5('0x50')]({'where':{'id':_0x4efd03[_0x93b5('0x49')]['id']},'attributes':['id',_0x93b5('0x58'),'apiKey']})[_0x93b5('0x26')](handleEntityNotFound(_0x22c366,null))[_0x93b5('0x26')](function(_0x2dea19){if(_0x2dea19){_0x2ad932=_0x2dea19['remoteUri'];var _0x2ef917=_0x2ad932[_0x93b5('0x59')](-0x1);if(_0x2ef917==='/'){_0x2ad932=_0x2ad932[_0x93b5('0x5a')](0x0,_0x2ad932['lastIndexOf'](_0x2ef917));}return rp({'method':'GET','uri':util[_0x93b5('0x5b')](_0x93b5('0x5c'),_0x2ad932,_0x93b5('0x5d')),'headers':{'Authorization':util[_0x93b5('0x5b')]('Basic\x20%s',new Buffer(util[_0x93b5('0x5b')]('%s:X',_0x2dea19[_0x93b5('0x5e')]))[_0x93b5('0x5f')]('base64'))},'json':!![]});}})[_0x93b5('0x26')](function(_0x4acd54){if(_0x4acd54){var _0x25ed4e=['requester',_0x93b5('0x60'),_0x93b5('0x61'),'description',_0x93b5('0x1c'),'priority',_0x93b5('0x62'),_0x93b5('0x63'),_0x93b5('0x64'),_0x93b5('0x62'),_0x93b5('0x65')];_['remove'](_0x4acd54,function(_0x4997eb){return _0x25ed4e[_0x93b5('0x66')](_0x4997eb[_0x93b5('0x2a')])||!_0x4997eb[_0x93b5('0x67')]&&_0x4997eb[_0x93b5('0x31')]!==_0x93b5('0x68')&&_0x4997eb[_0x93b5('0x31')]!==_0x93b5('0x69');});return{'count':_0x4acd54[_0x93b5('0x39')],'rows':_[_0x93b5('0x2d')](_0x4acd54,function(_0x35ed34){return{'id':_0x35ed34['name'],'name':_0x35ed34['label'],'custom':!_0x35ed34[_0x93b5('0x67')],'options':_0x35ed34[_0x93b5('0x6a')]?_[_0x93b5('0x2d')](_0x35ed34['choices'],function(_0x3b2d9d){return{'name':_[_0x93b5('0x6b')](_0x3b2d9d),'value':_0x3b2d9d};}):[]};})};}})[_0x93b5('0x26')](respondWithResult(_0x22c366,null))[_0x93b5('0x47')](function(_0x2d26c8){var _0x256925=_0x4efd03[_0x93b5('0x35')][_0x93b5('0x6c')]?0x1f4:_0x2d26c8[_0x93b5('0x6d')]||0x1f4;logger[_0x93b5('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x93b5('0x57'),_0x256925,JSON[_0x93b5('0x6e')](_0x2d26c8));delete _0x2d26c8[_0x93b5('0x2a')];if(_0x256925===0x191){_0x256925=0x190;}_0x22c366['status'](_0x256925)[_0x93b5('0x2b')](_0x4efd03[_0x93b5('0x35')][_0x93b5('0x6c')]?{'message':_0x93b5('0x6f'),'statusCode':_0x2d26c8[_0x93b5('0x6d')]}:_0x2d26c8);});}; \ No newline at end of file +var _0x2697=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','type','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','toString','base64','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','map','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2697,0x120));var _0x7269=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0x2697[_0x48326a];return _0x466709;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7269('0x0'));var zipdir=require(_0x7269('0x1'));var jsonpatch=require(_0x7269('0x2'));var rp=require(_0x7269('0x3'));var moment=require(_0x7269('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7269('0x5'));var util=require('util');var path=require(_0x7269('0x6'));var sox=require(_0x7269('0x7'));var csv=require(_0x7269('0x8'));var ejs=require(_0x7269('0x9'));var fs=require('fs');var fs_extra=require(_0x7269('0xa'));var _=require(_0x7269('0xb'));var squel=require(_0x7269('0xc'));var crypto=require(_0x7269('0xd'));var jsforce=require(_0x7269('0xe'));var deskjs=require(_0x7269('0xf'));var toCsv=require(_0x7269('0x8'));var querystring=require('querystring');var Papa=require(_0x7269('0x10'));var Redis=require(_0x7269('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7269('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7269('0x13'));var logger=require('../../config/logger')(_0x7269('0x14'));var utils=require('../../config/utils');var config=require(_0x7269('0x15'));var licenseUtil=require(_0x7269('0x16'));var db=require(_0x7269('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x29a0ca,_0x2c5957){_0x2c5957=_0x2c5957||0xcc;return function(_0x5dbe57){if(_0x5dbe57){return _0x29a0ca[_0x7269('0x18')](_0x2c5957);}return _0x29a0ca[_0x7269('0x19')](_0x2c5957)[_0x7269('0x1a')]();};}function respondWithResult(_0x4a0355,_0x2ba8ec){_0x2ba8ec=_0x2ba8ec||0xc8;return function(_0x4eeb9b){if(_0x4eeb9b){return _0x4a0355[_0x7269('0x19')](_0x2ba8ec)[_0x7269('0x1b')](_0x4eeb9b);}};}function respondWithFilteredResult(_0x26547f,_0x44e266){return function(_0x880b51){if(_0x880b51){var _0x2c0608=typeof _0x44e266['offset']===_0x7269('0x1c')&&typeof _0x44e266[_0x7269('0x1d')]===_0x7269('0x1c');var _0x1f7289=_0x880b51['count'];var _0x5589b7=_0x2c0608?0x0:_0x44e266['offset'];var _0x244e6e=_0x2c0608?_0x880b51[_0x7269('0x1e')]:_0x44e266[_0x7269('0x1f')]+_0x44e266[_0x7269('0x1d')];var _0x133ddc;if(_0x244e6e>=_0x1f7289){_0x244e6e=_0x1f7289;_0x133ddc=0xc8;}else{_0x133ddc=0xce;}_0x26547f[_0x7269('0x19')](_0x133ddc);return _0x26547f[_0x7269('0x20')]('Content-Range',_0x5589b7+'-'+_0x244e6e+'/'+_0x1f7289)['json'](_0x880b51);}return null;};}function patchUpdates(_0x534f81){return function(_0x367ad1){try{jsonpatch['apply'](_0x367ad1,_0x534f81,!![]);}catch(_0x2d3c66){return BPromise['reject'](_0x2d3c66);}return _0x367ad1[_0x7269('0x21')]();};}function saveUpdates(_0x8ce025,_0x55e40d){return function(_0x149c19){if(_0x149c19){return _0x149c19[_0x7269('0x22')](_0x8ce025)['then'](function(_0x509e9){return _0x509e9;});}return null;};}function removeEntity(_0x293af6,_0xbb82d0){return function(_0x383fde){if(_0x383fde){return _0x383fde['destroy']()[_0x7269('0x23')](function(){_0x293af6[_0x7269('0x19')](0xcc)[_0x7269('0x1a')]();});}};}function handleEntityNotFound(_0x2e6c02,_0x3392ec){return function(_0x3d72c9){if(!_0x3d72c9){_0x2e6c02['sendStatus'](0x194);}return _0x3d72c9;};}function handleError(_0x198b59,_0x3afb72){_0x3afb72=_0x3afb72||0x1f4;return function(_0x339414){logger[_0x7269('0x24')](_0x339414[_0x7269('0x25')]);if(_0x339414['name']){delete _0x339414[_0x7269('0x26')];}_0x198b59[_0x7269('0x19')](_0x3afb72)['send'](_0x339414);};}exports[_0x7269('0x27')]=function(_0x492e73,_0x124c07){var _0x3988c8={},_0xe3ee31={},_0x2be62e={'count':0x0,'rows':[]};var _0x468d0b=_['map'](db[_0x7269('0x28')][_0x7269('0x29')],function(_0xc6aea5){return{'name':_0xc6aea5[_0x7269('0x2a')],'type':_0xc6aea5['type'][_0x7269('0x2b')]};});_0xe3ee31[_0x7269('0x2c')]=_['map'](_0x468d0b,'name');_0xe3ee31[_0x7269('0x2d')]=_[_0x7269('0x2e')](_0x492e73[_0x7269('0x2d')]);_0xe3ee31[_0x7269('0x2f')]=_[_0x7269('0x30')](_0xe3ee31[_0x7269('0x2c')],_0xe3ee31['query']);_0x3988c8['attributes']=_[_0x7269('0x30')](_0xe3ee31[_0x7269('0x2c')],qs['fields'](_0x492e73[_0x7269('0x2d')]['fields']));_0x3988c8[_0x7269('0x31')]=_0x3988c8[_0x7269('0x31')][_0x7269('0x32')]?_0x3988c8[_0x7269('0x31')]:_0xe3ee31[_0x7269('0x2c')];if(!_0x492e73[_0x7269('0x2d')][_0x7269('0x33')]('nolimit')){_0x3988c8[_0x7269('0x1d')]=qs[_0x7269('0x1d')](_0x492e73['query'][_0x7269('0x1d')]);_0x3988c8[_0x7269('0x1f')]=qs[_0x7269('0x1f')](_0x492e73['query'][_0x7269('0x1f')]);}_0x3988c8[_0x7269('0x34')]=qs[_0x7269('0x35')](_0x492e73[_0x7269('0x2d')]['sort']);_0x3988c8[_0x7269('0x36')]=qs[_0x7269('0x2f')](_[_0x7269('0x37')](_0x492e73[_0x7269('0x2d')],_0xe3ee31[_0x7269('0x2f')]),_0x468d0b);if(_0x492e73['query'][_0x7269('0x38')]){_0x3988c8[_0x7269('0x36')]=_[_0x7269('0x39')](_0x3988c8['where'],{'$or':_['map'](_0x468d0b,function(_0x399efe){if(_0x399efe['type']!==_0x7269('0x3a')){var _0x492a1e={};_0x492a1e[_0x399efe[_0x7269('0x26')]]={'$like':'%'+_0x492e73[_0x7269('0x2d')]['filter']+'%'};return _0x492a1e;}})});}_0x3988c8=_['merge']({},_0x3988c8,_0x492e73[_0x7269('0x3b')]);var _0x2265ac={'where':_0x3988c8[_0x7269('0x36')]};return db[_0x7269('0x28')][_0x7269('0x1e')](_0x2265ac)[_0x7269('0x23')](function(_0x1fd570){_0x2be62e[_0x7269('0x1e')]=_0x1fd570;if(_0x492e73[_0x7269('0x2d')][_0x7269('0x3c')]){_0x3988c8[_0x7269('0x3d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7269('0x3e')](_0x3988c8);})[_0x7269('0x23')](function(_0x2a2273){_0x2be62e[_0x7269('0x3f')]=_0x2a2273;return _0x2be62e;})[_0x7269('0x23')](respondWithFilteredResult(_0x124c07,_0x3988c8))[_0x7269('0x40')](handleError(_0x124c07,null));};exports[_0x7269('0x41')]=function(_0x2a67c3,_0x5ebeb7){var _0x5dc295={'raw':![],'where':{'id':_0x2a67c3[_0x7269('0x42')]['id']}},_0x2543cb={};_0x2543cb['model']=_['keys'](db['FreshdeskAccount'][_0x7269('0x29')]);_0x2543cb[_0x7269('0x2d')]=_['keys'](_0x2a67c3[_0x7269('0x2d')]);_0x2543cb[_0x7269('0x2f')]=_[_0x7269('0x30')](_0x2543cb[_0x7269('0x2c')],_0x2543cb[_0x7269('0x2d')]);_0x5dc295['attributes']=_['intersection'](_0x2543cb[_0x7269('0x2c')],qs[_0x7269('0x43')](_0x2a67c3[_0x7269('0x2d')][_0x7269('0x43')]));_0x5dc295[_0x7269('0x31')]=_0x5dc295['attributes'][_0x7269('0x32')]?_0x5dc295[_0x7269('0x31')]:_0x2543cb['model'];if(_0x2a67c3['query']['includeAll']){_0x5dc295[_0x7269('0x3d')]=[{'all':!![]}];}_0x5dc295=_[_0x7269('0x39')]({},_0x5dc295,_0x2a67c3[_0x7269('0x3b')]);return db['FreshdeskAccount'][_0x7269('0x44')](_0x5dc295)[_0x7269('0x23')](handleEntityNotFound(_0x5ebeb7,null))[_0x7269('0x23')](respondWithResult(_0x5ebeb7,null))[_0x7269('0x40')](handleError(_0x5ebeb7,null));};exports['create']=function(_0x1e35df,_0x55d198){return db[_0x7269('0x28')][_0x7269('0x45')](_0x1e35df[_0x7269('0x46')],{})[_0x7269('0x23')](respondWithResult(_0x55d198,0xc9))[_0x7269('0x40')](handleError(_0x55d198,null));};exports[_0x7269('0x22')]=function(_0x5f34d3,_0x23d91b){if(_0x5f34d3['body']['id']){delete _0x5f34d3[_0x7269('0x46')]['id'];}return db[_0x7269('0x28')][_0x7269('0x44')]({'where':{'id':_0x5f34d3[_0x7269('0x42')]['id']}})[_0x7269('0x23')](handleEntityNotFound(_0x23d91b,null))['then'](saveUpdates(_0x5f34d3['body'],null))[_0x7269('0x23')](respondWithResult(_0x23d91b,null))[_0x7269('0x40')](handleError(_0x23d91b,null));};exports['destroy']=function(_0x46aa1f,_0x27bedc){return db[_0x7269('0x28')]['find']({'where':{'id':_0x46aa1f[_0x7269('0x42')]['id']}})[_0x7269('0x23')](handleEntityNotFound(_0x27bedc,null))[_0x7269('0x23')](removeEntity(_0x27bedc,null))['catch'](handleError(_0x27bedc,null));};exports['getConfigurations']=function(_0x32d06d,_0x4a4add,_0x42afa2){var _0x5ecbec={};var _0x1ca09e={};var _0x37e699;var _0x1826d2;return db[_0x7269('0x28')]['findOne']({'where':{'id':_0x32d06d[_0x7269('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a4add,null))[_0x7269('0x23')](function(_0x43fdc5){if(_0x43fdc5){_0x37e699=_0x43fdc5;_0x1ca09e[_0x7269('0x2c')]=_[_0x7269('0x2e')](db[_0x7269('0x47')][_0x7269('0x29')]);_0x1ca09e[_0x7269('0x2d')]=_[_0x7269('0x2e')](_0x32d06d[_0x7269('0x2d')]);_0x1ca09e[_0x7269('0x2f')]=_['intersection'](_0x1ca09e[_0x7269('0x2c')],_0x1ca09e[_0x7269('0x2d')]);_0x5ecbec[_0x7269('0x31')]=_[_0x7269('0x30')](_0x1ca09e[_0x7269('0x2c')],qs[_0x7269('0x43')](_0x32d06d[_0x7269('0x2d')][_0x7269('0x43')]));_0x5ecbec['attributes']=_0x5ecbec[_0x7269('0x31')]['length']?_0x5ecbec['attributes']:_0x1ca09e[_0x7269('0x2c')];_0x5ecbec[_0x7269('0x34')]=qs[_0x7269('0x35')](_0x32d06d[_0x7269('0x2d')][_0x7269('0x35')]);_0x5ecbec['where']=qs[_0x7269('0x2f')](_[_0x7269('0x37')](_0x32d06d[_0x7269('0x2d')],_0x1ca09e['filters']));if(_0x32d06d[_0x7269('0x2d')][_0x7269('0x38')]){_0x5ecbec[_0x7269('0x36')]=_[_0x7269('0x39')](_0x5ecbec[_0x7269('0x36')],{'$or':_['map'](_0x5ecbec[_0x7269('0x31')],function(_0x2ae935){var _0x234eca={};_0x234eca[_0x2ae935]={'$like':'%'+_0x32d06d['query'][_0x7269('0x38')]+'%'};return _0x234eca;})});}_0x5ecbec=_[_0x7269('0x39')]({},_0x5ecbec,_0x32d06d[_0x7269('0x3b')]);return _0x37e699[_0x7269('0x48')](_0x5ecbec);}})[_0x7269('0x23')](function(_0x193da5){if(_0x193da5){_0x1826d2=_0x193da5[_0x7269('0x32')];if(!_0x32d06d[_0x7269('0x2d')][_0x7269('0x33')](_0x7269('0x49'))){_0x5ecbec[_0x7269('0x1d')]=qs[_0x7269('0x1d')](_0x32d06d[_0x7269('0x2d')][_0x7269('0x1d')]);_0x5ecbec[_0x7269('0x1f')]=qs[_0x7269('0x1f')](_0x32d06d[_0x7269('0x2d')][_0x7269('0x1f')]);}return _0x37e699['getConfigurations'](_0x5ecbec);}})[_0x7269('0x23')](function(_0x3f8ab1){if(_0x3f8ab1){return _0x3f8ab1?{'count':_0x1826d2,'rows':_0x3f8ab1}:null;}})[_0x7269('0x23')](respondWithResult(_0x4a4add,null))[_0x7269('0x40')](handleError(_0x4a4add,null));};exports[_0x7269('0x4a')]=function(_0x262989,_0x4505f6,_0x55ff74){if(_0x262989[_0x7269('0x46')]['id']){delete _0x262989[_0x7269('0x46')]['id'];}return db['FreshdeskAccount'][_0x7269('0x4b')]({'where':{'id':_0x262989['params']['id']}})[_0x7269('0x23')](handleEntityNotFound(_0x4505f6,null))[_0x7269('0x23')](function(_0x435142){if(_0x435142){_0x262989[_0x7269('0x46')][_0x7269('0x4c')]=_0x435142['id'];_0x262989[_0x7269('0x46')][_0x7269('0x4d')]=integrations[_0x7269('0x4e')](_0x262989[_0x7269('0x46')]['channel'],_0x262989[_0x7269('0x46')]['type']);_0x262989[_0x7269('0x46')][_0x7269('0x4f')]=integrations['getDescriptions'](_0x262989['body']['channel'],_0x262989[_0x7269('0x46')][_0x7269('0x50')]);return db['FreshdeskConfiguration'][_0x7269('0x45')](_0x262989['body'],{'include':[{'model':db[_0x7269('0x51')],'as':_0x7269('0x4d')},{'model':db[_0x7269('0x51')],'as':_0x7269('0x4f')}]});}return null;})[_0x7269('0x23')](respondWithResult(_0x4505f6,null))['catch'](handleError(_0x4505f6,null));};exports[_0x7269('0x52')]=function(_0x44ec8d,_0x1f31d7,_0x45ab0f){var _0x31d03e='';return db[_0x7269('0x28')][_0x7269('0x4b')]({'where':{'id':_0x44ec8d[_0x7269('0x42')]['id']},'attributes':['id',_0x7269('0x53'),_0x7269('0x54')]})[_0x7269('0x23')](handleEntityNotFound(_0x1f31d7,null))[_0x7269('0x23')](function(_0xd0fc13){if(_0xd0fc13){_0x31d03e=_0xd0fc13['remoteUri'];var _0xf59051=_0x31d03e[_0x7269('0x55')](-0x1);if(_0xf59051==='/'){_0x31d03e=_0x31d03e[_0x7269('0x56')](0x0,_0x31d03e[_0x7269('0x57')](_0xf59051));}return rp({'method':_0x7269('0x58'),'uri':util['format'](_0x7269('0x59'),_0x31d03e,_0x7269('0x5a')),'headers':{'Authorization':util[_0x7269('0x5b')]('Basic\x20%s',new Buffer(util[_0x7269('0x5b')]('%s:X',_0xd0fc13['apiKey']))[_0x7269('0x5c')](_0x7269('0x5d')))},'json':!![]});}})[_0x7269('0x23')](function(_0x1f29c5){if(_0x1f29c5){var _0x3d26aa=['requester','subject','agent',_0x7269('0x5e'),_0x7269('0x19'),_0x7269('0x5f'),'group',_0x7269('0x60'),_0x7269('0x61'),_0x7269('0x62'),_0x7269('0x63')];_[_0x7269('0x64')](_0x1f29c5,function(_0x1c11e3){return _0x3d26aa[_0x7269('0x65')](_0x1c11e3[_0x7269('0x26')])||!_0x1c11e3[_0x7269('0x66')]&&_0x1c11e3[_0x7269('0x50')]!==_0x7269('0x67')&&_0x1c11e3['type']!==_0x7269('0x68');});return{'count':_0x1f29c5[_0x7269('0x32')],'rows':_[_0x7269('0x69')](_0x1f29c5,function(_0x3cbd47){return{'id':_0x3cbd47[_0x7269('0x26')],'name':_0x3cbd47[_0x7269('0x6a')],'custom':!_0x3cbd47[_0x7269('0x66')],'options':_0x3cbd47[_0x7269('0x6b')]?_[_0x7269('0x69')](_0x3cbd47[_0x7269('0x6b')],function(_0x31b980){return{'name':_[_0x7269('0x6c')](_0x31b980),'value':_0x31b980};}):[]};})};}})[_0x7269('0x23')](respondWithResult(_0x1f31d7,null))[_0x7269('0x40')](function(_0x5c3776){var _0x335037=_0x44ec8d[_0x7269('0x2d')][_0x7269('0x6d')]?0x1f4:_0x5c3776[_0x7269('0x6e')]||0x1f4;logger[_0x7269('0x24')](_0x7269('0x6f'),_0x7269('0x52'),_0x335037,JSON[_0x7269('0x70')](_0x5c3776));delete _0x5c3776[_0x7269('0x26')];if(_0x335037===0x191){_0x335037=0x190;}_0x1f31d7[_0x7269('0x19')](_0x335037)['send'](_0x44ec8d[_0x7269('0x2d')][_0x7269('0x6d')]?{'message':_0x7269('0x71'),'statusCode':_0x5c3776[_0x7269('0x6e')]}:_0x5c3776);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 06144c1..60cde59 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 _0x2054=['api','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger'];(function(_0x52ec83,_0x43a4c3){var _0xbb5984=function(_0x3fc0a2){while(--_0x3fc0a2){_0x52ec83['push'](_0x52ec83['shift']());}};_0xbb5984(++_0x43a4c3);}(_0x2054,0xe8));var _0x4205=function(_0x4d214f,_0x4a9d72){_0x4d214f=_0x4d214f-0x0;var _0x35d3e0=_0x2054[_0x4d214f];return _0x35d3e0;};'use strict';var _=require('lodash');var util=require(_0x4205('0x0'));var logger=require(_0x4205('0x1'))(_0x4205('0x2'));var moment=require('moment');var BPromise=require(_0x4205('0x3'));var rp=require(_0x4205('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4205('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4205('0x6'));module['exports']=function(_0xa371ee,_0x18c1e5){return _0xa371ee['define'](_0x4205('0x7'),attributes,{'tableName':_0x4205('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84dc=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x1217db,_0xa754e5){var _0x459c64=function(_0x53b7c7){while(--_0x53b7c7){_0x1217db['push'](_0x1217db['shift']());}};_0x459c64(++_0xa754e5);}(_0x84dc,0x175));var _0xc84d=function(_0x399ab7,_0x391287){_0x399ab7=_0x399ab7-0x0;var _0x51dbf0=_0x84dc[_0x399ab7];return _0x51dbf0;};'use strict';var _=require(_0xc84d('0x0'));var util=require(_0xc84d('0x1'));var logger=require(_0xc84d('0x2'))(_0xc84d('0x3'));var moment=require(_0xc84d('0x4'));var BPromise=require(_0xc84d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc84d('0x6'));var config=require(_0xc84d('0x7'));var attributes=require(_0xc84d('0x8'));var integrations=require(_0xc84d('0x9'));module['exports']=function(_0x349a3d,_0x99a21a){return _0x349a3d[_0xc84d('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xc84d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a970033..b0d108d 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 _0x6ddd=['result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','limit','map','include','model','ShowFreshdeskAccount','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2f363b,_0x18c675){var _0x27dbb5=function(_0x45ad0e){while(--_0x45ad0e){_0x2f363b['push'](_0x2f363b['shift']());}};_0x27dbb5(++_0x18c675);}(_0x6ddd,0x157));var _0xd6dd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6ddd[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd6dd('0x0'));var util=require(_0xd6dd('0x1'));var moment=require('moment');var BPromise=require(_0xd6dd('0x2'));var rs=require(_0xd6dd('0x3'));var fs=require('fs');var Redis=require(_0xd6dd('0x4'));var db=require(_0xd6dd('0x5'))['db'];var utils=require(_0xd6dd('0x6'));var logger=require(_0xd6dd('0x7'))(_0xd6dd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6dd('0x9')][_0xd6dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a7584,_0x30a6c6,_0xf177e5){return new BPromise(function(_0x465d54,_0x210e48){return client['request'](_0x2a7584,_0xf177e5)[_0xd6dd('0xb')](function(_0x5f0db4){logger['info'](_0xd6dd('0xc'),_0x30a6c6,_0xd6dd('0xd'));logger[_0xd6dd('0xe')](_0xd6dd('0xf'),_0x30a6c6,_0xd6dd('0xd'),JSON[_0xd6dd('0x10')](_0x5f0db4));if(_0x5f0db4[_0xd6dd('0x11')]){if(_0x5f0db4[_0xd6dd('0x11')]['code']===0x1f4){logger[_0xd6dd('0x11')](_0xd6dd('0xc'),_0x30a6c6,_0x5f0db4['error'][_0xd6dd('0x12')]);return _0x210e48(_0x5f0db4[_0xd6dd('0x11')]['message']);}logger['error'](_0xd6dd('0xc'),_0x30a6c6,_0x5f0db4['error']['message']);return _0x465d54(_0x5f0db4[_0xd6dd('0x11')][_0xd6dd('0x12')]);}else{logger[_0xd6dd('0x13')](_0xd6dd('0xc'),_0x30a6c6,'request\x20sent');_0x465d54(_0x5f0db4[_0xd6dd('0x14')][_0xd6dd('0x12')]);}})[_0xd6dd('0x15')](function(_0x1a5f47){logger[_0xd6dd('0x11')](_0xd6dd('0xc'),_0x30a6c6,_0x1a5f47);_0x210e48(_0x1a5f47);});});}exports[_0xd6dd('0x16')]=function(_0x506203){var _0x1839c6=this;return new Promise(function(_0x364f23,_0x546e3f){return db[_0xd6dd('0x17')]['findAll']({'raw':_0x506203[_0xd6dd('0x18')]?_0x506203[_0xd6dd('0x18')][_0xd6dd('0x19')]===undefined?!![]:![]:!![],'where':_0x506203['options']?_0x506203[_0xd6dd('0x18')]['where']||null:null,'attributes':_0x506203[_0xd6dd('0x18')]?_0x506203[_0xd6dd('0x18')][_0xd6dd('0x1a')]||null:null,'limit':_0x506203[_0xd6dd('0x18')]?_0x506203['options'][_0xd6dd('0x1b')]||null:null,'include':_0x506203[_0xd6dd('0x18')]?_0x506203['options']['include']?_[_0xd6dd('0x1c')](_0x506203['options'][_0xd6dd('0x1d')],function(_0xcb1a59){return{'model':db[_0xcb1a59['model']],'as':_0xcb1a59['as'],'attributes':_0xcb1a59['attributes'],'include':_0xcb1a59[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0xcb1a59['include'],function(_0x524d26){return{'model':db[_0x524d26[_0xd6dd('0x1e')]],'as':_0x524d26['as'],'attributes':_0x524d26[_0xd6dd('0x1a')],'include':_0x524d26[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x524d26[_0xd6dd('0x1d')],function(_0x4e9d5d){return{'model':db[_0x4e9d5d[_0xd6dd('0x1e')]],'as':_0x4e9d5d['as'],'attributes':_0x4e9d5d[_0xd6dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd6dd('0xb')](function(_0x13b4ae){logger[_0xd6dd('0x13')]('GetFreshdeskAccount',_0x506203);logger[_0xd6dd('0xe')](_0xd6dd('0x16'),_0x506203,JSON['stringify'](_0x13b4ae));_0x364f23(_0x13b4ae);})[_0xd6dd('0x15')](function(_0x3f9351){logger[_0xd6dd('0x11')]('GetFreshdeskAccount',_0x3f9351[_0xd6dd('0x12')],_0x506203);_0x546e3f(_0x1839c6[_0xd6dd('0x11')](0x1f4,_0x3f9351[_0xd6dd('0x12')]));});});};exports[_0xd6dd('0x1f')]=function(_0x5f5ce7){var _0x36a970=this;return new Promise(function(_0x5cde89,_0x164b18){return db[_0xd6dd('0x17')]['find']({'raw':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x19')]===undefined?!![]:![]:!![],'where':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x20')]||null:null,'attributes':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7[_0xd6dd('0x18')][_0xd6dd('0x1a')]||null:null,'include':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x5f5ce7[_0xd6dd('0x18')][_0xd6dd('0x1d')],function(_0x5f34da){return{'model':db[_0x5f34da[_0xd6dd('0x1e')]],'as':_0x5f34da['as'],'attributes':_0x5f34da[_0xd6dd('0x1a')],'include':_0x5f34da[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x5f34da['include'],function(_0x3d9769){return{'model':db[_0x3d9769[_0xd6dd('0x1e')]],'as':_0x3d9769['as'],'attributes':_0x3d9769[_0xd6dd('0x1a')],'include':_0x3d9769['include']?_[_0xd6dd('0x1c')](_0x3d9769[_0xd6dd('0x1d')],function(_0x165011){return{'model':db[_0x165011['model']],'as':_0x165011['as'],'attributes':_0x165011[_0xd6dd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b9b5){logger['info'](_0xd6dd('0x1f'),_0x5f5ce7);logger[_0xd6dd('0xe')]('ShowFreshdeskAccount',_0x5f5ce7,JSON[_0xd6dd('0x10')](_0x36b9b5));_0x5cde89(_0x36b9b5);})[_0xd6dd('0x15')](function(_0x2f077a){logger['error'](_0xd6dd('0x1f'),_0x2f077a[_0xd6dd('0x12')],_0x5f5ce7);_0x164b18(_0x36a970[_0xd6dd('0x11')](0x1f4,_0x2f077a[_0xd6dd('0x12')]));});});}; \ No newline at end of file +var _0x9e1f=['request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','include','model','map','attributes','debug','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x9e1f,0x9c));var _0xf9e1=function(_0x49ac7f,_0x152333){_0x49ac7f=_0x49ac7f-0x0;var _0x4f73f3=_0x9e1f[_0x49ac7f];return _0x4f73f3;};'use strict';var _=require(_0xf9e1('0x0'));var util=require(_0xf9e1('0x1'));var moment=require(_0xf9e1('0x2'));var BPromise=require(_0xf9e1('0x3'));var rs=require(_0xf9e1('0x4'));var fs=require('fs');var Redis=require(_0xf9e1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9e1('0x6'))(_0xf9e1('0x7'));var config=require(_0xf9e1('0x8'));var jayson=require(_0xf9e1('0x9'));var client=jayson[_0xf9e1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4207d7,_0x4eecf4,_0x26755d){return new BPromise(function(_0x125338,_0x43100c){return client[_0xf9e1('0xb')](_0x4207d7,_0x26755d)[_0xf9e1('0xc')](function(_0x4e7580){logger[_0xf9e1('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x4eecf4,_0xf9e1('0xe'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4eecf4,_0xf9e1('0xe'),JSON[_0xf9e1('0xf')](_0x4e7580));if(_0x4e7580[_0xf9e1('0x10')]){if(_0x4e7580[_0xf9e1('0x10')][_0xf9e1('0x11')]===0x1f4){logger[_0xf9e1('0x10')](_0xf9e1('0x12'),_0x4eecf4,_0x4e7580['error']['message']);return _0x43100c(_0x4e7580[_0xf9e1('0x10')]['message']);}logger[_0xf9e1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x4eecf4,_0x4e7580[_0xf9e1('0x10')][_0xf9e1('0x13')]);return _0x125338(_0x4e7580[_0xf9e1('0x10')]['message']);}else{logger[_0xf9e1('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x4eecf4,_0xf9e1('0xe'));_0x125338(_0x4e7580[_0xf9e1('0x14')][_0xf9e1('0x13')]);}})[_0xf9e1('0x15')](function(_0x38b351){logger[_0xf9e1('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x4eecf4,_0x38b351);_0x43100c(_0x38b351);});});}exports[_0xf9e1('0x16')]=function(_0x3f5d73){var _0x2b847f=this;return new Promise(function(_0x1c493c,_0x3dfc4e){return db[_0xf9e1('0x17')][_0xf9e1('0x18')]({'raw':_0x3f5d73[_0xf9e1('0x19')]?_0x3f5d73[_0xf9e1('0x19')][_0xf9e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f5d73['options']?_0x3f5d73[_0xf9e1('0x19')][_0xf9e1('0x1b')]||null:null,'attributes':_0x3f5d73[_0xf9e1('0x19')]?_0x3f5d73['options']['attributes']||null:null,'limit':_0x3f5d73[_0xf9e1('0x19')]?_0x3f5d73[_0xf9e1('0x19')]['limit']||null:null,'include':_0x3f5d73[_0xf9e1('0x19')]?_0x3f5d73[_0xf9e1('0x19')][_0xf9e1('0x1c')]?_['map'](_0x3f5d73[_0xf9e1('0x19')][_0xf9e1('0x1c')],function(_0x36e9da){return{'model':db[_0x36e9da[_0xf9e1('0x1d')]],'as':_0x36e9da['as'],'attributes':_0x36e9da['attributes'],'include':_0x36e9da['include']?_[_0xf9e1('0x1e')](_0x36e9da[_0xf9e1('0x1c')],function(_0x1fa036){return{'model':db[_0x1fa036[_0xf9e1('0x1d')]],'as':_0x1fa036['as'],'attributes':_0x1fa036['attributes'],'include':_0x1fa036[_0xf9e1('0x1c')]?_[_0xf9e1('0x1e')](_0x1fa036[_0xf9e1('0x1c')],function(_0x4bb069){return{'model':db[_0x4bb069[_0xf9e1('0x1d')]],'as':_0x4bb069['as'],'attributes':_0x4bb069[_0xf9e1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee4b9){logger[_0xf9e1('0xd')](_0xf9e1('0x16'),_0x3f5d73);logger[_0xf9e1('0x20')]('GetFreshdeskAccount',_0x3f5d73,JSON[_0xf9e1('0xf')](_0x5ee4b9));_0x1c493c(_0x5ee4b9);})[_0xf9e1('0x15')](function(_0x5572e7){logger[_0xf9e1('0x10')](_0xf9e1('0x16'),_0x5572e7[_0xf9e1('0x13')],_0x3f5d73);_0x3dfc4e(_0x2b847f[_0xf9e1('0x10')](0x1f4,_0x5572e7[_0xf9e1('0x13')]));});});};exports[_0xf9e1('0x21')]=function(_0x21f43c){var _0x13ae1f=this;return new Promise(function(_0x37f01a,_0x5e0de5){return db[_0xf9e1('0x17')]['find']({'raw':_0x21f43c[_0xf9e1('0x19')]?_0x21f43c[_0xf9e1('0x19')][_0xf9e1('0x1a')]===undefined?!![]:![]:!![],'where':_0x21f43c[_0xf9e1('0x19')]?_0x21f43c[_0xf9e1('0x19')]['where']||null:null,'attributes':_0x21f43c['options']?_0x21f43c[_0xf9e1('0x19')][_0xf9e1('0x1f')]||null:null,'include':_0x21f43c[_0xf9e1('0x19')]?_0x21f43c[_0xf9e1('0x19')]['include']?_[_0xf9e1('0x1e')](_0x21f43c[_0xf9e1('0x19')][_0xf9e1('0x1c')],function(_0x334449){return{'model':db[_0x334449['model']],'as':_0x334449['as'],'attributes':_0x334449[_0xf9e1('0x1f')],'include':_0x334449[_0xf9e1('0x1c')]?_[_0xf9e1('0x1e')](_0x334449[_0xf9e1('0x1c')],function(_0x173b80){return{'model':db[_0x173b80['model']],'as':_0x173b80['as'],'attributes':_0x173b80[_0xf9e1('0x1f')],'include':_0x173b80[_0xf9e1('0x1c')]?_['map'](_0x173b80[_0xf9e1('0x1c')],function(_0x561630){return{'model':db[_0x561630['model']],'as':_0x561630['as'],'attributes':_0x561630[_0xf9e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf9e1('0xc')](function(_0x3e94ab){logger[_0xf9e1('0xd')](_0xf9e1('0x21'),_0x21f43c);logger['debug'](_0xf9e1('0x21'),_0x21f43c,JSON[_0xf9e1('0xf')](_0x3e94ab));_0x37f01a(_0x3e94ab);})[_0xf9e1('0x15')](function(_0x12bb61){logger[_0xf9e1('0x10')](_0xf9e1('0x21'),_0x12bb61['message'],_0x21f43c);_0x5e0de5(_0x13ae1f['error'](0x1f4,_0x12bb61[_0xf9e1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a6c29f7..ef7a1aa 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 _0xd12d=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','./intFreshdeskConfiguration.controller','get','index','/:id'];(function(_0x42a556,_0x4ed3c4){var _0x354144=function(_0x9610fa){while(--_0x9610fa){_0x42a556['push'](_0x42a556['shift']());}};_0x354144(++_0x4ed3c4);}(_0xd12d,0xae));var _0xdd12=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd12d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xdd12('0x0'));var util=require(_0xdd12('0x1'));var path=require('path');var timeout=require(_0xdd12('0x2'));var express=require(_0xdd12('0x3'));var router=express[_0xdd12('0x4')]();var fs_extra=require(_0xdd12('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd12('0x6'));router[_0xdd12('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd12('0x8')]);router[_0xdd12('0x7')](_0xdd12('0x9'),auth[_0xdd12('0xa')](),controller['show']);router['get'](_0xdd12('0xb'),auth[_0xdd12('0xa')](),controller[_0xdd12('0xc')]);router[_0xdd12('0x7')](_0xdd12('0xd'),auth[_0xdd12('0xa')](),controller[_0xdd12('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdd12('0x7')](_0xdd12('0xf'),auth[_0xdd12('0xa')](),controller[_0xdd12('0x10')]);router[_0xdd12('0x11')]('/',auth[_0xdd12('0xa')](),controller[_0xdd12('0x12')]);router[_0xdd12('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0xdd12('0x13')]);router['put'](_0xdd12('0x9'),auth[_0xdd12('0xa')](),controller[_0xdd12('0x14')]);router[_0xdd12('0x15')](_0xdd12('0x9'),auth['isAuthenticated'](),controller[_0xdd12('0x16')]);module['exports']=router; \ No newline at end of file +var _0x468d=['../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','/:id','delete','exports','express','fs-extra','../../components/auth/service'];(function(_0x24bcc4,_0x226525){var _0x2e6411=function(_0x541b84){while(--_0x541b84){_0x24bcc4['push'](_0x24bcc4['shift']());}};_0x2e6411(++_0x226525);}(_0x468d,0x115));var _0xd468=function(_0x4107ba,_0x389cb7){_0x4107ba=_0x4107ba-0x0;var _0x268846=_0x468d[_0x4107ba];return _0x268846;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd468('0x0'));var router=express['Router']();var fs_extra=require(_0xd468('0x1'));var auth=require(_0xd468('0x2'));var interaction=require(_0xd468('0x3'));var config=require('../../config/environment');var controller=require(_0xd468('0x4'));router[_0xd468('0x5')]('/',auth[_0xd468('0x6')](),controller['index']);router[_0xd468('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xd468('0x7')]);router[_0xd468('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd468('0x8')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd468('0x9')]);router[_0xd468('0x5')](_0xd468('0xa'),auth[_0xd468('0x6')](),controller[_0xd468('0xb')]);router[_0xd468('0x5')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xd468('0xc')]('/',auth[_0xd468('0x6')](),controller[_0xd468('0xd')]);router[_0xd468('0xc')](_0xd468('0xe'),auth[_0xd468('0x6')](),controller[_0xd468('0xf')]);router[_0xd468('0x10')](_0xd468('0x11'),auth[_0xd468('0x6')](),controller['update']);router[_0xd468('0x12')](_0xd468('0x11'),auth[_0xd468('0x6')](),controller['destroy']);module[_0xd468('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 25d0866..eecb549 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 _0xc076=['STRING'];(function(_0x261035,_0x5d983f){var _0x241fe8=function(_0x658083){while(--_0x658083){_0x261035['push'](_0x261035['shift']());}};_0x241fe8(++_0x5d983f);}(_0xc076,0x68));var _0x6c07=function(_0xfa9c71,_0x198d5a){_0xfa9c71=_0xfa9c71-0x0;var _0x41a12e=_0xc076[_0xfa9c71];return _0x41a12e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c07('0x0')]},'description':{'type':Sequelize[_0x6c07('0x0')]}}; \ No newline at end of file +var _0x7264=['sequelize','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7264,0x1e2));var _0x4726=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7264[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x4726('0x0'));module['exports']={'name':{'type':Sequelize[_0x4726('0x1')]},'description':{'type':Sequelize[_0x4726('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f5a8708..f977fc5 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 _0xb8cf=['count','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','FreshdeskField','order','hasOwnProperty','findOne','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb8cf,0x12e));var _0xfb8c=function(_0x5d34ca,_0x284212){_0x5d34ca=_0x5d34ca-0x0;var _0x5ab023=_0xb8cf[_0x5d34ca];return _0x5ab023;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb8c('0x0'));var jsonpatch=require(_0xfb8c('0x1'));var rp=require('request-promise');var moment=require(_0xfb8c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfb8c('0x3'));var util=require(_0xfb8c('0x4'));var path=require(_0xfb8c('0x5'));var sox=require(_0xfb8c('0x6'));var csv=require(_0xfb8c('0x7'));var ejs=require(_0xfb8c('0x8'));var fs=require('fs');var fs_extra=require(_0xfb8c('0x9'));var _=require(_0xfb8c('0xa'));var squel=require(_0xfb8c('0xb'));var crypto=require(_0xfb8c('0xc'));var jsforce=require(_0xfb8c('0xd'));var deskjs=require(_0xfb8c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb8c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb8c('0x10'));var as=require(_0xfb8c('0x11'));var hardwareService=require(_0xfb8c('0x12'));var logger=require(_0xfb8c('0x13'))(_0xfb8c('0x14'));var utils=require('../../config/utils');var config=require(_0xfb8c('0x15'));var licenseUtil=require(_0xfb8c('0x16'));var db=require(_0xfb8c('0x17'))['db'];function respondWithStatusCode(_0x3a2dd3,_0x40c19a){_0x40c19a=_0x40c19a||0xcc;return function(_0x5b8512){if(_0x5b8512){return _0x3a2dd3['sendStatus'](_0x40c19a);}return _0x3a2dd3['status'](_0x40c19a)[_0xfb8c('0x18')]();};}function respondWithResult(_0x4248f2,_0x4ad481){_0x4ad481=_0x4ad481||0xc8;return function(_0xd79272){if(_0xd79272){return _0x4248f2[_0xfb8c('0x19')](_0x4ad481)[_0xfb8c('0x1a')](_0xd79272);}};}function respondWithFilteredResult(_0x339654,_0x585fb6){return function(_0x4bb922){if(_0x4bb922){var _0x29792f=typeof _0x585fb6[_0xfb8c('0x1b')]===_0xfb8c('0x1c')&&typeof _0x585fb6[_0xfb8c('0x1d')]===_0xfb8c('0x1c');var _0x4b867d=_0x4bb922[_0xfb8c('0x1e')];var _0x37677d=_0x29792f?0x0:_0x585fb6[_0xfb8c('0x1b')];var _0x5290db=_0x29792f?_0x4bb922[_0xfb8c('0x1e')]:_0x585fb6['offset']+_0x585fb6['limit'];var _0x4ab3b6;if(_0x5290db>=_0x4b867d){_0x5290db=_0x4b867d;_0x4ab3b6=0xc8;}else{_0x4ab3b6=0xce;}_0x339654['status'](_0x4ab3b6);return _0x339654['set'](_0xfb8c('0x1f'),_0x37677d+'-'+_0x5290db+'/'+_0x4b867d)[_0xfb8c('0x1a')](_0x4bb922);}return null;};}function patchUpdates(_0xbe49f0){return function(_0x63c7ed){try{jsonpatch['apply'](_0x63c7ed,_0xbe49f0,!![]);}catch(_0x43bee8){return BPromise[_0xfb8c('0x20')](_0x43bee8);}return _0x63c7ed[_0xfb8c('0x21')]();};}function saveUpdates(_0x24c41e,_0x3fc5d3){return function(_0x548d9f){if(_0x548d9f){return _0x548d9f['update'](_0x24c41e)[_0xfb8c('0x22')](function(_0x49a306){return _0x49a306;});}return null;};}function removeEntity(_0x47a86a,_0x4de150){return function(_0x561b49){if(_0x561b49){return _0x561b49[_0xfb8c('0x23')]()[_0xfb8c('0x22')](function(){_0x47a86a[_0xfb8c('0x19')](0xcc)[_0xfb8c('0x18')]();});}};}function handleEntityNotFound(_0x4685d4,_0x22c844){return function(_0x391bba){if(!_0x391bba){_0x4685d4[_0xfb8c('0x24')](0x194);}return _0x391bba;};}function handleError(_0x451a82,_0xf39828){_0xf39828=_0xf39828||0x1f4;return function(_0x5ca458){logger[_0xfb8c('0x25')](_0x5ca458['stack']);if(_0x5ca458['name']){delete _0x5ca458[_0xfb8c('0x26')];}_0x451a82[_0xfb8c('0x19')](_0xf39828)[_0xfb8c('0x27')](_0x5ca458);};}exports[_0xfb8c('0x28')]=function(_0x164ec0,_0x590879){var _0xaef37e={},_0x4611c6={},_0xda20be={'count':0x0,'rows':[]};var _0x30db53=_[_0xfb8c('0x29')](db['FreshdeskConfiguration'][_0xfb8c('0x2a')],function(_0x11a62c){return{'name':_0x11a62c[_0xfb8c('0x2b')],'type':_0x11a62c['type']['key']};});_0x4611c6[_0xfb8c('0x2c')]=_[_0xfb8c('0x29')](_0x30db53,_0xfb8c('0x26'));_0x4611c6[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x164ec0[_0xfb8c('0x2d')]);_0x4611c6[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x4611c6['model'],_0x4611c6[_0xfb8c('0x2d')]);_0xaef37e[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x4611c6['model'],qs[_0xfb8c('0x32')](_0x164ec0[_0xfb8c('0x2d')]['fields']));_0xaef37e[_0xfb8c('0x31')]=_0xaef37e[_0xfb8c('0x31')][_0xfb8c('0x33')]?_0xaef37e[_0xfb8c('0x31')]:_0x4611c6[_0xfb8c('0x2c')];if(!_0x164ec0[_0xfb8c('0x2d')]['hasOwnProperty']('nolimit')){_0xaef37e[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0xaef37e[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}_0xaef37e['order']=qs[_0xfb8c('0x34')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0xaef37e[_0xfb8c('0x35')]=qs['filters'](_[_0xfb8c('0x36')](_0x164ec0[_0xfb8c('0x2d')],_0x4611c6['filters']),_0x30db53);if(_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0xaef37e['where']=_[_0xfb8c('0x38')](_0xaef37e[_0xfb8c('0x35')],{'$or':_['map'](_0x30db53,function(_0x911d4b){if(_0x911d4b[_0xfb8c('0x39')]!==_0xfb8c('0x3a')){var _0x1f7dba={};_0x1f7dba[_0x911d4b[_0xfb8c('0x26')]]={'$like':'%'+_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x37')]+'%'};return _0x1f7dba;}})});}_0xaef37e=_[_0xfb8c('0x38')]({},_0xaef37e,_0x164ec0[_0xfb8c('0x3b')]);var _0x3ad227={'where':_0xaef37e[_0xfb8c('0x35')]};return db[_0xfb8c('0x3c')][_0xfb8c('0x1e')](_0x3ad227)[_0xfb8c('0x22')](function(_0x29f58c){_0xda20be[_0xfb8c('0x1e')]=_0x29f58c;if(_0x164ec0['query'][_0xfb8c('0x3d')]){_0xaef37e[_0xfb8c('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xfb8c('0x3f')](_0xaef37e);})['then'](function(_0x177f28){_0xda20be['rows']=_0x177f28;return _0xda20be;})[_0xfb8c('0x22')](respondWithFilteredResult(_0x590879,_0xaef37e))[_0xfb8c('0x40')](handleError(_0x590879,null));};exports[_0xfb8c('0x41')]=function(_0x15babe,_0x38eb6b){var _0x1dd138={'raw':![],'where':{'id':_0x15babe[_0xfb8c('0x42')]['id']}},_0x512dde={};_0x512dde[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db['FreshdeskConfiguration'][_0xfb8c('0x2a')]);_0x512dde[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x15babe['query']);_0x512dde['filters']=_['intersection'](_0x512dde[_0xfb8c('0x2c')],_0x512dde[_0xfb8c('0x2d')]);_0x1dd138['attributes']=_[_0xfb8c('0x30')](_0x512dde[_0xfb8c('0x2c')],qs[_0xfb8c('0x32')](_0x15babe[_0xfb8c('0x2d')]['fields']));_0x1dd138[_0xfb8c('0x31')]=_0x1dd138[_0xfb8c('0x31')][_0xfb8c('0x33')]?_0x1dd138['attributes']:_0x512dde[_0xfb8c('0x2c')];if(_0x15babe[_0xfb8c('0x2d')][_0xfb8c('0x3d')]){_0x1dd138['include']=[{'all':!![]}];}_0x1dd138=_[_0xfb8c('0x38')]({},_0x1dd138,_0x15babe[_0xfb8c('0x3b')]);return db[_0xfb8c('0x3c')][_0xfb8c('0x43')](_0x1dd138)[_0xfb8c('0x22')](handleEntityNotFound(_0x38eb6b,null))[_0xfb8c('0x22')](respondWithResult(_0x38eb6b,null))['catch'](handleError(_0x38eb6b,null));};exports[_0xfb8c('0x44')]=function(_0x10e447,_0x54ed95){return db[_0xfb8c('0x3c')][_0xfb8c('0x44')](_0x10e447[_0xfb8c('0x45')],{})[_0xfb8c('0x22')](respondWithResult(_0x54ed95,0xc9))[_0xfb8c('0x40')](handleError(_0x54ed95,null));};exports[_0xfb8c('0x46')]=function(_0x2f88e1,_0x41d48e){if(_0x2f88e1[_0xfb8c('0x45')]['id']){delete _0x2f88e1[_0xfb8c('0x45')]['id'];}return db[_0xfb8c('0x3c')][_0xfb8c('0x43')]({'where':{'id':_0x2f88e1[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x41d48e,null))[_0xfb8c('0x22')](saveUpdates(_0x2f88e1[_0xfb8c('0x45')],null))['then'](respondWithResult(_0x41d48e,null))[_0xfb8c('0x40')](handleError(_0x41d48e,null));};exports[_0xfb8c('0x23')]=function(_0x100ce,_0x43fa85){return db[_0xfb8c('0x3c')][_0xfb8c('0x43')]({'where':{'id':_0x100ce['params']['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x43fa85,null))[_0xfb8c('0x22')](removeEntity(_0x43fa85,null))[_0xfb8c('0x40')](handleError(_0x43fa85,null));};exports[_0xfb8c('0x47')]=function(_0x58bf6f,_0x31f889,_0x52b45b){var _0x219852={};var _0x42a978={};var _0x19acd0;var _0x3aa5ae;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x58bf6f[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x31f889,null))['then'](function(_0x40f157){if(_0x40f157){_0x19acd0=_0x40f157;_0x42a978[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db[_0xfb8c('0x48')][_0xfb8c('0x2a')]);_0x42a978['query']=_[_0xfb8c('0x2e')](_0x58bf6f[_0xfb8c('0x2d')]);_0x42a978[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x42a978[_0xfb8c('0x2c')],_0x42a978[_0xfb8c('0x2d')]);_0x219852[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x42a978[_0xfb8c('0x2c')],qs['fields'](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x219852[_0xfb8c('0x31')]=_0x219852['attributes'][_0xfb8c('0x33')]?_0x219852['attributes']:_0x42a978['model'];_0x219852[_0xfb8c('0x49')]=qs[_0xfb8c('0x34')](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0x219852[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x58bf6f['query'],_0x42a978[_0xfb8c('0x2f')]));if(_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x219852[_0xfb8c('0x35')]=_['merge'](_0x219852['where'],{'$or':_[_0xfb8c('0x29')](_0x219852['attributes'],function(_0x38368c){var _0x133c07={};_0x133c07[_0x38368c]={'$like':'%'+_0x58bf6f[_0xfb8c('0x2d')]['filter']+'%'};return _0x133c07;})});}_0x219852=_[_0xfb8c('0x38')]({},_0x219852,_0x58bf6f[_0xfb8c('0x3b')]);return _0x19acd0[_0xfb8c('0x47')](_0x219852);}})[_0xfb8c('0x22')](function(_0x2170b5){if(_0x2170b5){_0x3aa5ae=_0x2170b5[_0xfb8c('0x33')];if(!_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x4a')]('nolimit')){_0x219852[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x58bf6f['query'][_0xfb8c('0x1d')]);_0x219852[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x19acd0['getFields'](_0x219852);}})[_0xfb8c('0x22')](function(_0x44c6c2){if(_0x44c6c2){return _0x44c6c2?{'count':_0x3aa5ae,'rows':_0x44c6c2}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x31f889,null))[_0xfb8c('0x40')](handleError(_0x31f889,null));};exports['getSubjects']=function(_0x23d0dd,_0x755aa5,_0x202108){var _0x54b6ab={};var _0x51442b={};var _0x3feb62;var _0x59d568;return db[_0xfb8c('0x3c')][_0xfb8c('0x4b')]({'where':{'id':_0x23d0dd[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x755aa5,null))[_0xfb8c('0x22')](function(_0xd5ec3f){if(_0xd5ec3f){_0x3feb62=_0xd5ec3f;_0x51442b[_0xfb8c('0x2c')]=_['keys'](db['FreshdeskField'][_0xfb8c('0x2a')]);_0x51442b[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x23d0dd['query']);_0x51442b[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x51442b['model'],_0x51442b[_0xfb8c('0x2d')]);_0x54b6ab['attributes']=_[_0xfb8c('0x30')](_0x51442b[_0xfb8c('0x2c')],qs[_0xfb8c('0x32')](_0x23d0dd[_0xfb8c('0x2d')]['fields']));_0x54b6ab[_0xfb8c('0x31')]=_0x54b6ab['attributes']['length']?_0x54b6ab[_0xfb8c('0x31')]:_0x51442b[_0xfb8c('0x2c')];_0x54b6ab[_0xfb8c('0x49')]=qs[_0xfb8c('0x34')](_0x23d0dd['query'][_0xfb8c('0x34')]);_0x54b6ab[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x23d0dd[_0xfb8c('0x2d')],_0x51442b['filters']));if(_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x54b6ab['where']=_['merge'](_0x54b6ab['where'],{'$or':_['map'](_0x54b6ab[_0xfb8c('0x31')],function(_0x19250e){var _0x13b5d4={};_0x13b5d4[_0x19250e]={'$like':'%'+_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x37')]+'%'};return _0x13b5d4;})});}_0x54b6ab=_['merge']({},_0x54b6ab,_0x23d0dd['options']);return _0x3feb62[_0xfb8c('0x4c')](_0x54b6ab);}})[_0xfb8c('0x22')](function(_0x1e600f){if(_0x1e600f){_0x59d568=_0x1e600f[_0xfb8c('0x33')];if(!_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x4a')](_0xfb8c('0x4d'))){_0x54b6ab[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x54b6ab[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x23d0dd[_0xfb8c('0x2d')]['offset']);}return _0x3feb62['getSubjects'](_0x54b6ab);}})[_0xfb8c('0x22')](function(_0x4fc66c){if(_0x4fc66c){return _0x4fc66c?{'count':_0x59d568,'rows':_0x4fc66c}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x755aa5,null))[_0xfb8c('0x40')](handleError(_0x755aa5,null));};exports[_0xfb8c('0x4e')]=function(_0x4c6526,_0x405052,_0x3fda73){var _0x3881c1={};var _0x36f0e0={};var _0x5838db;var _0x516a57;return db['FreshdeskConfiguration'][_0xfb8c('0x4b')]({'where':{'id':_0x4c6526[_0xfb8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x405052,null))[_0xfb8c('0x22')](function(_0x28b31f){if(_0x28b31f){_0x5838db=_0x28b31f;_0x36f0e0[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db[_0xfb8c('0x48')]['rawAttributes']);_0x36f0e0[_0xfb8c('0x2d')]=_['keys'](_0x4c6526[_0xfb8c('0x2d')]);_0x36f0e0[_0xfb8c('0x2f')]=_['intersection'](_0x36f0e0['model'],_0x36f0e0[_0xfb8c('0x2d')]);_0x3881c1[_0xfb8c('0x31')]=_['intersection'](_0x36f0e0[_0xfb8c('0x2c')],qs['fields'](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x3881c1['attributes']=_0x3881c1[_0xfb8c('0x31')]['length']?_0x3881c1[_0xfb8c('0x31')]:_0x36f0e0[_0xfb8c('0x2c')];_0x3881c1[_0xfb8c('0x49')]=qs['sort'](_0x4c6526['query'][_0xfb8c('0x34')]);_0x3881c1['where']=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x4c6526[_0xfb8c('0x2d')],_0x36f0e0['filters']));if(_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x3881c1[_0xfb8c('0x35')]=_[_0xfb8c('0x38')](_0x3881c1[_0xfb8c('0x35')],{'$or':_[_0xfb8c('0x29')](_0x3881c1['attributes'],function(_0x6b7224){var _0x3aa7fb={};_0x3aa7fb[_0x6b7224]={'$like':'%'+_0x4c6526[_0xfb8c('0x2d')]['filter']+'%'};return _0x3aa7fb;})});}_0x3881c1=_[_0xfb8c('0x38')]({},_0x3881c1,_0x4c6526[_0xfb8c('0x3b')]);return _0x5838db[_0xfb8c('0x4e')](_0x3881c1);}})[_0xfb8c('0x22')](function(_0x5baa52){if(_0x5baa52){_0x516a57=_0x5baa52[_0xfb8c('0x33')];if(!_0x4c6526[_0xfb8c('0x2d')]['hasOwnProperty'](_0xfb8c('0x4d'))){_0x3881c1[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x3881c1[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x5838db[_0xfb8c('0x4e')](_0x3881c1);}})['then'](function(_0xb09873){if(_0xb09873){return _0xb09873?{'count':_0x516a57,'rows':_0xb09873}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x405052,null))[_0xfb8c('0x40')](handleError(_0x405052,null));};exports[_0xfb8c('0x4f')]=function(_0x3c568b,_0x3c5462,_0x1872ef){var _0x1fdc33={};var _0x24e0cc={};var _0x2098cc;var _0x249dee;return db[_0xfb8c('0x3c')][_0xfb8c('0x4b')]({'where':{'id':_0x3c568b[_0xfb8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c5462,null))['then'](function(_0x4a34a6){if(_0x4a34a6){_0x2098cc=_0x4a34a6;_0x24e0cc[_0xfb8c('0x2c')]=_['keys'](db[_0xfb8c('0x50')][_0xfb8c('0x2a')]);_0x24e0cc[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x3c568b[_0xfb8c('0x2d')]);_0x24e0cc['filters']=_['intersection'](_0x24e0cc[_0xfb8c('0x2c')],_0x24e0cc[_0xfb8c('0x2d')]);_0x1fdc33[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x24e0cc[_0xfb8c('0x2c')],qs['fields'](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x1fdc33['attributes']=_0x1fdc33['attributes']['length']?_0x1fdc33[_0xfb8c('0x31')]:_0x24e0cc[_0xfb8c('0x2c')];_0x1fdc33['order']=qs[_0xfb8c('0x34')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0x1fdc33[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_['pick'](_0x3c568b[_0xfb8c('0x2d')],_0x24e0cc['filters']));if(_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x1fdc33[_0xfb8c('0x35')]=_[_0xfb8c('0x38')](_0x1fdc33[_0xfb8c('0x35')],{'$or':_['map'](_0x1fdc33['attributes'],function(_0x139ff2){var _0x4e2bdc={};_0x4e2bdc[_0x139ff2]={'$like':'%'+_0x3c568b[_0xfb8c('0x2d')]['filter']+'%'};return _0x4e2bdc;})});}_0x1fdc33=_[_0xfb8c('0x38')]({},_0x1fdc33,_0x3c568b[_0xfb8c('0x3b')]);return _0x2098cc[_0xfb8c('0x4f')](_0x1fdc33);}})[_0xfb8c('0x22')](function(_0x34cbba){if(_0x34cbba){_0x249dee=_0x34cbba['length'];if(!_0x3c568b[_0xfb8c('0x2d')]['hasOwnProperty'](_0xfb8c('0x4d'))){_0x1fdc33[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x1fdc33[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x2098cc[_0xfb8c('0x4f')](_0x1fdc33);}})[_0xfb8c('0x22')](function(_0x3543aa){if(_0x3543aa){return _0x3543aa?{'count':_0x249dee,'rows':_0x3543aa}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x3c5462,null))['catch'](handleError(_0x3c5462,null));};exports['setTags']=function(_0x5efd23,_0x188074,_0x4a2bd5){if(_0x5efd23['body']['id']){delete _0x5efd23[_0xfb8c('0x45')]['id'];}return db['FreshdeskConfiguration'][_0xfb8c('0x4b')]({'where':{'id':_0x5efd23[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x188074,null))[_0xfb8c('0x22')](function(_0x169b59){if(_0x169b59){return _0x169b59[_0xfb8c('0x51')](_0x5efd23[_0xfb8c('0x45')][_0xfb8c('0x52')]||[]);}return null;})[_0xfb8c('0x22')](respondWithResult(_0x188074,null))[_0xfb8c('0x40')](handleError(_0x188074,null));}; \ No newline at end of file +var _0x5046=['filter','options','then','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x154d86,_0x2d74b0){var _0x161771=function(_0x155671){while(--_0x155671){_0x154d86['push'](_0x154d86['shift']());}};_0x161771(++_0x2d74b0);}(_0x5046,0x10a));var _0x6504=function(_0x500d36,_0x3172f7){_0x500d36=_0x500d36-0x0;var _0x136b55=_0x5046[_0x500d36];return _0x136b55;};'use strict';var emlformat=require(_0x6504('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6504('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6504('0x2'));var moment=require('moment');var BPromise=require(_0x6504('0x3'));var Mustache=require('mustache');var util=require(_0x6504('0x4'));var path=require(_0x6504('0x5'));var sox=require('sox');var csv=require(_0x6504('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6504('0x7'));var _=require(_0x6504('0x8'));var squel=require(_0x6504('0x9'));var crypto=require(_0x6504('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6504('0xb'));var toCsv=require(_0x6504('0x6'));var querystring=require(_0x6504('0xc'));var Papa=require('papaparse');var Redis=require(_0x6504('0xd'));var authService=require(_0x6504('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6504('0xf'));var hardwareService=require(_0x6504('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x6504('0x11'));var config=require(_0x6504('0x12'));var licenseUtil=require(_0x6504('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115a08,_0x1de8e6){_0x1de8e6=_0x1de8e6||0xcc;return function(_0x3f8762){if(_0x3f8762){return _0x115a08[_0x6504('0x14')](_0x1de8e6);}return _0x115a08[_0x6504('0x15')](_0x1de8e6)[_0x6504('0x16')]();};}function respondWithResult(_0x5d4833,_0x23dbb8){_0x23dbb8=_0x23dbb8||0xc8;return function(_0x76d4f){if(_0x76d4f){return _0x5d4833['status'](_0x23dbb8)['json'](_0x76d4f);}};}function respondWithFilteredResult(_0x2df99f,_0x4372cb){return function(_0x388546){if(_0x388546){var _0x54b40e=typeof _0x4372cb[_0x6504('0x17')]==='undefined'&&typeof _0x4372cb[_0x6504('0x18')]==='undefined';var _0x24591f=_0x388546['count'];var _0x5de0fc=_0x54b40e?0x0:_0x4372cb['offset'];var _0x470a93=_0x54b40e?_0x388546[_0x6504('0x19')]:_0x4372cb[_0x6504('0x17')]+_0x4372cb[_0x6504('0x18')];var _0x536f43;if(_0x470a93>=_0x24591f){_0x470a93=_0x24591f;_0x536f43=0xc8;}else{_0x536f43=0xce;}_0x2df99f[_0x6504('0x15')](_0x536f43);return _0x2df99f[_0x6504('0x1a')](_0x6504('0x1b'),_0x5de0fc+'-'+_0x470a93+'/'+_0x24591f)[_0x6504('0x1c')](_0x388546);}return null;};}function patchUpdates(_0x25a247){return function(_0x936193){try{jsonpatch[_0x6504('0x1d')](_0x936193,_0x25a247,!![]);}catch(_0x16454d){return BPromise[_0x6504('0x1e')](_0x16454d);}return _0x936193['save']();};}function saveUpdates(_0xc7eb82,_0x4e35cc){return function(_0x15f3f0){if(_0x15f3f0){return _0x15f3f0[_0x6504('0x1f')](_0xc7eb82)['then'](function(_0x455b8d){return _0x455b8d;});}return null;};}function removeEntity(_0x3e67e7,_0x14d414){return function(_0x30a053){if(_0x30a053){return _0x30a053[_0x6504('0x20')]()['then'](function(){_0x3e67e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5d39,_0x3cab41){return function(_0x551a49){if(!_0x551a49){_0x2c5d39[_0x6504('0x14')](0x194);}return _0x551a49;};}function handleError(_0x3f42e5,_0x5bbeb7){_0x5bbeb7=_0x5bbeb7||0x1f4;return function(_0x26c8fd){logger['error'](_0x26c8fd[_0x6504('0x21')]);if(_0x26c8fd[_0x6504('0x22')]){delete _0x26c8fd[_0x6504('0x22')];}_0x3f42e5[_0x6504('0x15')](_0x5bbeb7)[_0x6504('0x23')](_0x26c8fd);};}exports[_0x6504('0x24')]=function(_0x470bfe,_0x9ec169){var _0x24d0bb={},_0x1f59f2={},_0x185240={'count':0x0,'rows':[]};var _0x18777f=_[_0x6504('0x25')](db[_0x6504('0x26')][_0x6504('0x27')],function(_0xf1a4d){return{'name':_0xf1a4d[_0x6504('0x28')],'type':_0xf1a4d[_0x6504('0x29')][_0x6504('0x2a')]};});_0x1f59f2['model']=_[_0x6504('0x25')](_0x18777f,_0x6504('0x22'));_0x1f59f2[_0x6504('0x2b')]=_[_0x6504('0x2c')](_0x470bfe['query']);_0x1f59f2[_0x6504('0x2d')]=_['intersection'](_0x1f59f2['model'],_0x1f59f2['query']);_0x24d0bb['attributes']=_[_0x6504('0x2e')](_0x1f59f2['model'],qs[_0x6504('0x2f')](_0x470bfe[_0x6504('0x2b')][_0x6504('0x2f')]));_0x24d0bb[_0x6504('0x30')]=_0x24d0bb[_0x6504('0x30')]['length']?_0x24d0bb[_0x6504('0x30')]:_0x1f59f2[_0x6504('0x31')];if(!_0x470bfe['query'][_0x6504('0x32')](_0x6504('0x33'))){_0x24d0bb[_0x6504('0x18')]=qs[_0x6504('0x18')](_0x470bfe['query'][_0x6504('0x18')]);_0x24d0bb[_0x6504('0x17')]=qs[_0x6504('0x17')](_0x470bfe[_0x6504('0x2b')][_0x6504('0x17')]);}_0x24d0bb[_0x6504('0x34')]=qs[_0x6504('0x35')](_0x470bfe[_0x6504('0x2b')]['sort']);_0x24d0bb[_0x6504('0x36')]=qs['filters'](_[_0x6504('0x37')](_0x470bfe[_0x6504('0x2b')],_0x1f59f2[_0x6504('0x2d')]),_0x18777f);if(_0x470bfe[_0x6504('0x2b')]['filter']){_0x24d0bb[_0x6504('0x36')]=_[_0x6504('0x38')](_0x24d0bb[_0x6504('0x36')],{'$or':_[_0x6504('0x25')](_0x18777f,function(_0x46836b){if(_0x46836b[_0x6504('0x29')]!==_0x6504('0x39')){var _0x353071={};_0x353071[_0x46836b[_0x6504('0x22')]]={'$like':'%'+_0x470bfe[_0x6504('0x2b')][_0x6504('0x3a')]+'%'};return _0x353071;}})});}_0x24d0bb=_['merge']({},_0x24d0bb,_0x470bfe[_0x6504('0x3b')]);var _0x2499b1={'where':_0x24d0bb[_0x6504('0x36')]};return db[_0x6504('0x26')][_0x6504('0x19')](_0x2499b1)[_0x6504('0x3c')](function(_0x2c53dc){_0x185240[_0x6504('0x19')]=_0x2c53dc;if(_0x470bfe['query'][_0x6504('0x3d')]){_0x24d0bb[_0x6504('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x6504('0x3f')](_0x24d0bb);})[_0x6504('0x3c')](function(_0x4cb899){_0x185240[_0x6504('0x40')]=_0x4cb899;return _0x185240;})[_0x6504('0x3c')](respondWithFilteredResult(_0x9ec169,_0x24d0bb))['catch'](handleError(_0x9ec169,null));};exports[_0x6504('0x41')]=function(_0x237d60,_0x5d1cb6){var _0x70afdd={'raw':![],'where':{'id':_0x237d60[_0x6504('0x42')]['id']}},_0x43acb9={};_0x43acb9['model']=_[_0x6504('0x2c')](db[_0x6504('0x26')]['rawAttributes']);_0x43acb9['query']=_[_0x6504('0x2c')](_0x237d60[_0x6504('0x2b')]);_0x43acb9['filters']=_[_0x6504('0x2e')](_0x43acb9[_0x6504('0x31')],_0x43acb9[_0x6504('0x2b')]);_0x70afdd[_0x6504('0x30')]=_[_0x6504('0x2e')](_0x43acb9[_0x6504('0x31')],qs['fields'](_0x237d60[_0x6504('0x2b')][_0x6504('0x2f')]));_0x70afdd['attributes']=_0x70afdd[_0x6504('0x30')][_0x6504('0x43')]?_0x70afdd[_0x6504('0x30')]:_0x43acb9[_0x6504('0x31')];if(_0x237d60[_0x6504('0x2b')][_0x6504('0x3d')]){_0x70afdd['include']=[{'all':!![]}];}_0x70afdd=_['merge']({},_0x70afdd,_0x237d60[_0x6504('0x3b')]);return db['FreshdeskConfiguration'][_0x6504('0x44')](_0x70afdd)[_0x6504('0x3c')](handleEntityNotFound(_0x5d1cb6,null))[_0x6504('0x3c')](respondWithResult(_0x5d1cb6,null))[_0x6504('0x45')](handleError(_0x5d1cb6,null));};exports['create']=function(_0x57be8d,_0x2f5e6e){return db['FreshdeskConfiguration'][_0x6504('0x46')](_0x57be8d[_0x6504('0x47')],{})[_0x6504('0x3c')](respondWithResult(_0x2f5e6e,0xc9))[_0x6504('0x45')](handleError(_0x2f5e6e,null));};exports[_0x6504('0x1f')]=function(_0x306a0c,_0x46deb){if(_0x306a0c[_0x6504('0x47')]['id']){delete _0x306a0c[_0x6504('0x47')]['id'];}return db[_0x6504('0x26')][_0x6504('0x44')]({'where':{'id':_0x306a0c[_0x6504('0x42')]['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x46deb,null))[_0x6504('0x3c')](saveUpdates(_0x306a0c[_0x6504('0x47')],null))[_0x6504('0x3c')](respondWithResult(_0x46deb,null))['catch'](handleError(_0x46deb,null));};exports['destroy']=function(_0x9f58c0,_0x526057){return db[_0x6504('0x26')][_0x6504('0x44')]({'where':{'id':_0x9f58c0[_0x6504('0x42')]['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x526057,null))[_0x6504('0x3c')](removeEntity(_0x526057,null))['catch'](handleError(_0x526057,null));};exports[_0x6504('0x48')]=function(_0x66c685,_0xa1db87,_0x477983){var _0x3233a8={};var _0x92cb89={};var _0x11c3fb;var _0x22820a;return db['FreshdeskConfiguration'][_0x6504('0x49')]({'where':{'id':_0x66c685[_0x6504('0x42')]['id']}})['then'](handleEntityNotFound(_0xa1db87,null))[_0x6504('0x3c')](function(_0x25d3f6){if(_0x25d3f6){_0x11c3fb=_0x25d3f6;_0x92cb89[_0x6504('0x31')]=_[_0x6504('0x2c')](db[_0x6504('0x4a')][_0x6504('0x27')]);_0x92cb89[_0x6504('0x2b')]=_[_0x6504('0x2c')](_0x66c685[_0x6504('0x2b')]);_0x92cb89[_0x6504('0x2d')]=_[_0x6504('0x2e')](_0x92cb89[_0x6504('0x31')],_0x92cb89[_0x6504('0x2b')]);_0x3233a8['attributes']=_['intersection'](_0x92cb89[_0x6504('0x31')],qs[_0x6504('0x2f')](_0x66c685['query'][_0x6504('0x2f')]));_0x3233a8[_0x6504('0x30')]=_0x3233a8[_0x6504('0x30')][_0x6504('0x43')]?_0x3233a8[_0x6504('0x30')]:_0x92cb89[_0x6504('0x31')];_0x3233a8[_0x6504('0x34')]=qs['sort'](_0x66c685[_0x6504('0x2b')][_0x6504('0x35')]);_0x3233a8[_0x6504('0x36')]=qs[_0x6504('0x2d')](_[_0x6504('0x37')](_0x66c685['query'],_0x92cb89[_0x6504('0x2d')]));if(_0x66c685[_0x6504('0x2b')][_0x6504('0x3a')]){_0x3233a8[_0x6504('0x36')]=_[_0x6504('0x38')](_0x3233a8['where'],{'$or':_[_0x6504('0x25')](_0x3233a8['attributes'],function(_0xf0f7e3){var _0x3e7e3a={};_0x3e7e3a[_0xf0f7e3]={'$like':'%'+_0x66c685['query']['filter']+'%'};return _0x3e7e3a;})});}_0x3233a8=_[_0x6504('0x38')]({},_0x3233a8,_0x66c685['options']);return _0x11c3fb[_0x6504('0x48')](_0x3233a8);}})[_0x6504('0x3c')](function(_0x2250c4){if(_0x2250c4){_0x22820a=_0x2250c4['length'];if(!_0x66c685[_0x6504('0x2b')][_0x6504('0x32')]('nolimit')){_0x3233a8[_0x6504('0x18')]=qs[_0x6504('0x18')](_0x66c685[_0x6504('0x2b')][_0x6504('0x18')]);_0x3233a8[_0x6504('0x17')]=qs[_0x6504('0x17')](_0x66c685[_0x6504('0x2b')][_0x6504('0x17')]);}return _0x11c3fb['getFields'](_0x3233a8);}})[_0x6504('0x3c')](function(_0x17791d){if(_0x17791d){return _0x17791d?{'count':_0x22820a,'rows':_0x17791d}:null;}})[_0x6504('0x3c')](respondWithResult(_0xa1db87,null))['catch'](handleError(_0xa1db87,null));};exports[_0x6504('0x4b')]=function(_0x3121c2,_0x5a657a,_0x48215c){var _0x4976d0={};var _0x60f43c={};var _0x50a03;var _0x3f206b;return db[_0x6504('0x26')][_0x6504('0x49')]({'where':{'id':_0x3121c2['params']['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x5a657a,null))[_0x6504('0x3c')](function(_0x2ea598){if(_0x2ea598){_0x50a03=_0x2ea598;_0x60f43c[_0x6504('0x31')]=_['keys'](db[_0x6504('0x4a')][_0x6504('0x27')]);_0x60f43c['query']=_[_0x6504('0x2c')](_0x3121c2[_0x6504('0x2b')]);_0x60f43c['filters']=_['intersection'](_0x60f43c[_0x6504('0x31')],_0x60f43c[_0x6504('0x2b')]);_0x4976d0[_0x6504('0x30')]=_['intersection'](_0x60f43c[_0x6504('0x31')],qs[_0x6504('0x2f')](_0x3121c2['query'][_0x6504('0x2f')]));_0x4976d0[_0x6504('0x30')]=_0x4976d0[_0x6504('0x30')]['length']?_0x4976d0[_0x6504('0x30')]:_0x60f43c[_0x6504('0x31')];_0x4976d0[_0x6504('0x34')]=qs[_0x6504('0x35')](_0x3121c2[_0x6504('0x2b')][_0x6504('0x35')]);_0x4976d0[_0x6504('0x36')]=qs[_0x6504('0x2d')](_['pick'](_0x3121c2[_0x6504('0x2b')],_0x60f43c[_0x6504('0x2d')]));if(_0x3121c2[_0x6504('0x2b')][_0x6504('0x3a')]){_0x4976d0[_0x6504('0x36')]=_[_0x6504('0x38')](_0x4976d0[_0x6504('0x36')],{'$or':_[_0x6504('0x25')](_0x4976d0[_0x6504('0x30')],function(_0x4d130e){var _0x290b5b={};_0x290b5b[_0x4d130e]={'$like':'%'+_0x3121c2[_0x6504('0x2b')][_0x6504('0x3a')]+'%'};return _0x290b5b;})});}_0x4976d0=_['merge']({},_0x4976d0,_0x3121c2['options']);return _0x50a03[_0x6504('0x4b')](_0x4976d0);}})['then'](function(_0x5d528b){if(_0x5d528b){_0x3f206b=_0x5d528b[_0x6504('0x43')];if(!_0x3121c2[_0x6504('0x2b')][_0x6504('0x32')](_0x6504('0x33'))){_0x4976d0[_0x6504('0x18')]=qs[_0x6504('0x18')](_0x3121c2['query']['limit']);_0x4976d0['offset']=qs[_0x6504('0x17')](_0x3121c2[_0x6504('0x2b')][_0x6504('0x17')]);}return _0x50a03[_0x6504('0x4b')](_0x4976d0);}})['then'](function(_0x29b6ac){if(_0x29b6ac){return _0x29b6ac?{'count':_0x3f206b,'rows':_0x29b6ac}:null;}})['then'](respondWithResult(_0x5a657a,null))[_0x6504('0x45')](handleError(_0x5a657a,null));};exports[_0x6504('0x4c')]=function(_0x5c8de3,_0x5ae271,_0x4478b8){var _0x1c521d={};var _0x312732={};var _0xbe2b7;var _0x50d342;return db['FreshdeskConfiguration'][_0x6504('0x49')]({'where':{'id':_0x5c8de3[_0x6504('0x42')]['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x5ae271,null))[_0x6504('0x3c')](function(_0x379320){if(_0x379320){_0xbe2b7=_0x379320;_0x312732[_0x6504('0x31')]=_[_0x6504('0x2c')](db[_0x6504('0x4a')][_0x6504('0x27')]);_0x312732[_0x6504('0x2b')]=_[_0x6504('0x2c')](_0x5c8de3[_0x6504('0x2b')]);_0x312732[_0x6504('0x2d')]=_[_0x6504('0x2e')](_0x312732[_0x6504('0x31')],_0x312732['query']);_0x1c521d[_0x6504('0x30')]=_['intersection'](_0x312732['model'],qs[_0x6504('0x2f')](_0x5c8de3[_0x6504('0x2b')][_0x6504('0x2f')]));_0x1c521d[_0x6504('0x30')]=_0x1c521d[_0x6504('0x30')]['length']?_0x1c521d[_0x6504('0x30')]:_0x312732[_0x6504('0x31')];_0x1c521d[_0x6504('0x34')]=qs[_0x6504('0x35')](_0x5c8de3[_0x6504('0x2b')][_0x6504('0x35')]);_0x1c521d[_0x6504('0x36')]=qs[_0x6504('0x2d')](_[_0x6504('0x37')](_0x5c8de3[_0x6504('0x2b')],_0x312732['filters']));if(_0x5c8de3['query'][_0x6504('0x3a')]){_0x1c521d['where']=_[_0x6504('0x38')](_0x1c521d['where'],{'$or':_['map'](_0x1c521d[_0x6504('0x30')],function(_0x5362b4){var _0xba542={};_0xba542[_0x5362b4]={'$like':'%'+_0x5c8de3[_0x6504('0x2b')][_0x6504('0x3a')]+'%'};return _0xba542;})});}_0x1c521d=_[_0x6504('0x38')]({},_0x1c521d,_0x5c8de3[_0x6504('0x3b')]);return _0xbe2b7[_0x6504('0x4c')](_0x1c521d);}})[_0x6504('0x3c')](function(_0x3ee481){if(_0x3ee481){_0x50d342=_0x3ee481['length'];if(!_0x5c8de3[_0x6504('0x2b')][_0x6504('0x32')](_0x6504('0x33'))){_0x1c521d[_0x6504('0x18')]=qs[_0x6504('0x18')](_0x5c8de3[_0x6504('0x2b')][_0x6504('0x18')]);_0x1c521d['offset']=qs[_0x6504('0x17')](_0x5c8de3[_0x6504('0x2b')][_0x6504('0x17')]);}return _0xbe2b7[_0x6504('0x4c')](_0x1c521d);}})[_0x6504('0x3c')](function(_0x701ca8){if(_0x701ca8){return _0x701ca8?{'count':_0x50d342,'rows':_0x701ca8}:null;}})[_0x6504('0x3c')](respondWithResult(_0x5ae271,null))['catch'](handleError(_0x5ae271,null));};exports[_0x6504('0x4d')]=function(_0x1eb2b4,_0x9594cc,_0x368b84){var _0x353391={};var _0x42bf87={};var _0x3c75da;var _0x299f5c;return db['FreshdeskConfiguration'][_0x6504('0x49')]({'where':{'id':_0x1eb2b4[_0x6504('0x42')]['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x9594cc,null))[_0x6504('0x3c')](function(_0x3d1cb3){if(_0x3d1cb3){_0x3c75da=_0x3d1cb3;_0x42bf87[_0x6504('0x31')]=_[_0x6504('0x2c')](db[_0x6504('0x4e')]['rawAttributes']);_0x42bf87[_0x6504('0x2b')]=_[_0x6504('0x2c')](_0x1eb2b4[_0x6504('0x2b')]);_0x42bf87[_0x6504('0x2d')]=_[_0x6504('0x2e')](_0x42bf87['model'],_0x42bf87[_0x6504('0x2b')]);_0x353391['attributes']=_[_0x6504('0x2e')](_0x42bf87['model'],qs['fields'](_0x1eb2b4[_0x6504('0x2b')]['fields']));_0x353391[_0x6504('0x30')]=_0x353391['attributes'][_0x6504('0x43')]?_0x353391[_0x6504('0x30')]:_0x42bf87[_0x6504('0x31')];_0x353391['order']=qs[_0x6504('0x35')](_0x1eb2b4[_0x6504('0x2b')][_0x6504('0x35')]);_0x353391[_0x6504('0x36')]=qs[_0x6504('0x2d')](_[_0x6504('0x37')](_0x1eb2b4['query'],_0x42bf87[_0x6504('0x2d')]));if(_0x1eb2b4[_0x6504('0x2b')]['filter']){_0x353391['where']=_[_0x6504('0x38')](_0x353391['where'],{'$or':_[_0x6504('0x25')](_0x353391[_0x6504('0x30')],function(_0x101e6b){var _0x54fd1c={};_0x54fd1c[_0x101e6b]={'$like':'%'+_0x1eb2b4[_0x6504('0x2b')][_0x6504('0x3a')]+'%'};return _0x54fd1c;})});}_0x353391=_[_0x6504('0x38')]({},_0x353391,_0x1eb2b4['options']);return _0x3c75da[_0x6504('0x4d')](_0x353391);}})[_0x6504('0x3c')](function(_0x50eb26){if(_0x50eb26){_0x299f5c=_0x50eb26[_0x6504('0x43')];if(!_0x1eb2b4[_0x6504('0x2b')][_0x6504('0x32')](_0x6504('0x33'))){_0x353391[_0x6504('0x18')]=qs[_0x6504('0x18')](_0x1eb2b4[_0x6504('0x2b')][_0x6504('0x18')]);_0x353391['offset']=qs['offset'](_0x1eb2b4[_0x6504('0x2b')][_0x6504('0x17')]);}return _0x3c75da[_0x6504('0x4d')](_0x353391);}})['then'](function(_0x56af27){if(_0x56af27){return _0x56af27?{'count':_0x299f5c,'rows':_0x56af27}:null;}})[_0x6504('0x3c')](respondWithResult(_0x9594cc,null))[_0x6504('0x45')](handleError(_0x9594cc,null));};exports[_0x6504('0x4f')]=function(_0x1b3524,_0x5204b2,_0x4d0daf){if(_0x1b3524[_0x6504('0x47')]['id']){delete _0x1b3524[_0x6504('0x47')]['id'];}return db[_0x6504('0x26')][_0x6504('0x49')]({'where':{'id':_0x1b3524[_0x6504('0x42')]['id']}})[_0x6504('0x3c')](handleEntityNotFound(_0x5204b2,null))['then'](function(_0x34d0da){if(_0x34d0da){return _0x34d0da['setTags'](_0x1b3524[_0x6504('0x47')][_0x6504('0x50')]||[]);}return null;})['then'](respondWithResult(_0x5204b2,null))[_0x6504('0x45')](handleError(_0x5204b2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 86eabf3..8035509 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 _0xdb64=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5603c7,_0xd3c00c){var _0xeed043=function(_0x236b91){while(--_0x236b91){_0x5603c7['push'](_0x5603c7['shift']());}};_0xeed043(++_0xd3c00c);}(_0xdb64,0x164));var _0x4db6=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xdb64[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x4db6('0x0'));var util=require(_0x4db6('0x1'));var logger=require(_0x4db6('0x2'))(_0x4db6('0x3'));var moment=require(_0x4db6('0x4'));var BPromise=require(_0x4db6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4db6('0x6'));var rimraf=require(_0x4db6('0x7'));var config=require('../../config/environment');var attributes=require(_0x4db6('0x8'));module[_0x4db6('0x9')]=function(_0x25eddd,_0x1a3759){return _0x25eddd[_0x4db6('0xa')](_0x4db6('0xb'),attributes,{'tableName':_0x4db6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff8a=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration'];(function(_0xcd68f0,_0x56fc56){var _0x4a0801=function(_0x5be525){while(--_0x5be525){_0xcd68f0['push'](_0xcd68f0['shift']());}};_0x4a0801(++_0x56fc56);}(_0xff8a,0x1da));var _0xaff8=function(_0x2ca4e6,_0x4ba084){_0x2ca4e6=_0x2ca4e6-0x0;var _0x4db9ee=_0xff8a[_0x2ca4e6];return _0x4db9ee;};'use strict';var _=require(_0xaff8('0x0'));var util=require('util');var logger=require(_0xaff8('0x1'))(_0xaff8('0x2'));var moment=require(_0xaff8('0x3'));var BPromise=require(_0xaff8('0x4'));var rp=require(_0xaff8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaff8('0x6'));var config=require(_0xaff8('0x7'));var attributes=require(_0xaff8('0x8'));module['exports']=function(_0x347e32,_0x32ec9f){return _0x347e32['define'](_0xaff8('0x9'),attributes,{'tableName':_0xaff8('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 348651c..b7f6022 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 _0x4a8b=['jayson/promise','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2c1eb0,_0x246538){var _0x27b11c=function(_0x4926e6){while(--_0x4926e6){_0x2c1eb0['push'](_0x2c1eb0['shift']());}};_0x27b11c(++_0x246538);}(_0x4a8b,0x108));var _0xb4a8=function(_0x54aa73,_0x1a53a5){_0x54aa73=_0x54aa73-0x0;var _0x12e83d=_0x4a8b[_0x54aa73];return _0x12e83d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4a8('0x0'));var BPromise=require('bluebird');var rs=require(_0xb4a8('0x1'));var fs=require('fs');var Redis=require(_0xb4a8('0x2'));var db=require(_0xb4a8('0x3'))['db'];var utils=require(_0xb4a8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb4a8('0x5'));var jayson=require(_0xb4a8('0x6'));var client=jayson['client'][_0xb4a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x595e52,_0x25c702,_0x27b73d){return new BPromise(function(_0x527007,_0x377401){return client['request'](_0x595e52,_0x27b73d)['then'](function(_0x1ec482){logger[_0xb4a8('0x8')](_0xb4a8('0x9'),_0x25c702,_0xb4a8('0xa'));logger[_0xb4a8('0xb')](_0xb4a8('0xc'),_0x25c702,_0xb4a8('0xa'),JSON[_0xb4a8('0xd')](_0x1ec482));if(_0x1ec482['error']){if(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0xf')]===0x1f4){logger[_0xb4a8('0xe')](_0xb4a8('0x9'),_0x25c702,_0x1ec482[_0xb4a8('0xe')]['message']);return _0x377401(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);}logger[_0xb4a8('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x25c702,_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);return _0x527007(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);}else{logger[_0xb4a8('0x8')](_0xb4a8('0x9'),_0x25c702,_0xb4a8('0xa'));_0x527007(_0x1ec482[_0xb4a8('0x11')]['message']);}})['catch'](function(_0x41ed94){logger[_0xb4a8('0xe')](_0xb4a8('0x9'),_0x25c702,_0x41ed94);_0x377401(_0x41ed94);});});} \ No newline at end of file +var _0xe339=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x52be9b,_0x51ab2e){var _0x1fbcc5=function(_0x9de14c){while(--_0x9de14c){_0x52be9b['push'](_0x52be9b['shift']());}};_0x1fbcc5(++_0x51ab2e);}(_0xe339,0x145));var _0x9e33=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xe339[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0x9e33('0x0'));var util=require(_0x9e33('0x1'));var moment=require('moment');var BPromise=require(_0x9e33('0x2'));var rs=require(_0x9e33('0x3'));var fs=require('fs');var Redis=require(_0x9e33('0x4'));var db=require(_0x9e33('0x5'))['db'];var utils=require(_0x9e33('0x6'));var logger=require(_0x9e33('0x7'))(_0x9e33('0x8'));var config=require('../../config/environment');var jayson=require(_0x9e33('0x9'));var client=jayson[_0x9e33('0xa')][_0x9e33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5232a8,_0x3ec599,_0x102120){return new BPromise(function(_0x43346a,_0x51e541){return client['request'](_0x5232a8,_0x102120)[_0x9e33('0xc')](function(_0x8c494a){logger[_0x9e33('0xd')](_0x9e33('0xe'),_0x3ec599,_0x9e33('0xf'));logger[_0x9e33('0x10')](_0x9e33('0x11'),_0x3ec599,_0x9e33('0xf'),JSON[_0x9e33('0x12')](_0x8c494a));if(_0x8c494a[_0x9e33('0x13')]){if(_0x8c494a['error']['code']===0x1f4){logger[_0x9e33('0x13')](_0x9e33('0xe'),_0x3ec599,_0x8c494a[_0x9e33('0x13')][_0x9e33('0x14')]);return _0x51e541(_0x8c494a[_0x9e33('0x13')][_0x9e33('0x14')]);}logger['error'](_0x9e33('0xe'),_0x3ec599,_0x8c494a[_0x9e33('0x13')]['message']);return _0x43346a(_0x8c494a[_0x9e33('0x13')][_0x9e33('0x14')]);}else{logger[_0x9e33('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3ec599,_0x9e33('0xf'));_0x43346a(_0x8c494a['result']['message']);}})[_0x9e33('0x15')](function(_0x32707a){logger[_0x9e33('0x13')](_0x9e33('0xe'),_0x3ec599,_0x32707a);_0x51e541(_0x32707a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2e9c3a2..9acc616 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 _0xff99=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','post','create','put','isAuthenticated','destroy','util'];(function(_0xf5fa9c,_0x1d9b9e){var _0x38a0cf=function(_0x48bc5f){while(--_0x48bc5f){_0xf5fa9c['push'](_0xf5fa9c['shift']());}};_0x38a0cf(++_0x1d9b9e);}(_0xff99,0x12b));var _0x9ff9=function(_0x31e197,_0x561733){_0x31e197=_0x31e197-0x0;var _0x3a5df1=_0xff99[_0x31e197];return _0x3a5df1;};'use strict';var multer=require('multer');var util=require(_0x9ff9('0x0'));var path=require(_0x9ff9('0x1'));var timeout=require(_0x9ff9('0x2'));var express=require('express');var router=express[_0x9ff9('0x3')]();var fs_extra=require(_0x9ff9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ff9('0x5'));var config=require(_0x9ff9('0x6'));var controller=require(_0x9ff9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ff9('0x8')](_0x9ff9('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9ff9('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ff9('0xb')]);router[_0x9ff9('0xc')](_0x9ff9('0x9'),auth[_0x9ff9('0xd')](),controller['update']);router['delete'](_0x9ff9('0x9'),auth[_0x9ff9('0xd')](),controller[_0x9ff9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9080=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x9080,0x13c));var _0x0908=function(_0x35435c,_0x43d126){_0x35435c=_0x35435c-0x0;var _0x9a387f=_0x9080[_0x35435c];return _0x9a387f;};'use strict';var multer=require(_0x0908('0x0'));var util=require('util');var path=require(_0x0908('0x1'));var timeout=require(_0x0908('0x2'));var express=require(_0x0908('0x3'));var router=express[_0x0908('0x4')]();var fs_extra=require(_0x0908('0x5'));var auth=require(_0x0908('0x6'));var interaction=require(_0x0908('0x7'));var config=require(_0x0908('0x8'));var controller=require(_0x0908('0x9'));router[_0x0908('0xa')]('/',auth['isAuthenticated'](),controller[_0x0908('0xb')]);router[_0x0908('0xa')](_0x0908('0xc'),auth[_0x0908('0xd')](),controller[_0x0908('0xe')]);router[_0x0908('0xf')]('/',auth[_0x0908('0xd')](),controller['create']);router[_0x0908('0x10')](_0x0908('0xc'),auth[_0x0908('0xd')](),controller[_0x0908('0x11')]);router['delete'](_0x0908('0xc'),auth[_0x0908('0xd')](),controller[_0x0908('0x12')]);module[_0x0908('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 e258cac..5a85888 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 _0xa56e=['exports','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize'];(function(_0x7d9951,_0xe6a504){var _0x2be1a9=function(_0x521a27){while(--_0x521a27){_0x7d9951['push'](_0x7d9951['shift']());}};_0x2be1a9(++_0xe6a504);}(_0xa56e,0x74));var _0xea56=function(_0x304a2f,_0x55d3df){_0x304a2f=_0x304a2f-0x0;var _0x4a5e83=_0xa56e[_0x304a2f];return _0x4a5e83;};'use strict';var Sequelize=require(_0xea56('0x0'));module[_0xea56('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xea56('0x2'),_0xea56('0x3'),_0xea56('0x4'),_0xea56('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xea56('0x6')]},'key':{'type':Sequelize[_0xea56('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xea56('0x7'),_0xea56('0x2'),_0xea56('0x3'))},'keyContent':{'type':Sequelize[_0xea56('0x6')]},'idField':{'type':Sequelize[_0xea56('0x6')]},'nameField':{'type':Sequelize[_0xea56('0x6')]},'customField':{'type':Sequelize[_0xea56('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1faf=['exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x52614f,_0x54e403){var _0x2a05df=function(_0x56692b){while(--_0x56692b){_0x52614f['push'](_0x52614f['shift']());}};_0x2a05df(++_0x54e403);}(_0x1faf,0x1f1));var _0xf1fa=function(_0x4c3a8c,_0x582a1c){_0x4c3a8c=_0x4c3a8c-0x0;var _0x555e09=_0x1faf[_0x4c3a8c];return _0x555e09;};'use strict';var Sequelize=require('sequelize');module[_0xf1fa('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf1fa('0x1'),_0xf1fa('0x2'),'customVariable',_0xf1fa('0x3'),'picklist'),'defaultValue':_0xf1fa('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf1fa('0x4')]},'keyType':{'type':Sequelize[_0xf1fa('0x5')]('string',_0xf1fa('0x2'),_0xf1fa('0x6'))},'keyContent':{'type':Sequelize[_0xf1fa('0x4')]},'idField':{'type':Sequelize[_0xf1fa('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f563093..e14173c 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 _0x1d2d=['where','pick','filter','merge','options','FreshdeskField','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0xb2e92d,_0x4ac521){var _0x5c7b21=function(_0x3705fc){while(--_0x3705fc){_0xb2e92d['push'](_0xb2e92d['shift']());}};_0x5c7b21(++_0x4ac521);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5a9729,_0x54d1a2){_0x5a9729=_0x5a9729-0x0;var _0xc088=_0x1d2d[_0x5a9729];return _0xc088;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['FreshdeskField'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));}; \ No newline at end of file +var _0x222f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0x222f,0x1a4));var _0xf222=function(_0x35e3b8,_0x1f543f){_0x35e3b8=_0x35e3b8-0x0;var _0xae5b9a=_0x222f[_0x35e3b8];return _0xae5b9a;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x1883c1,_0x3fce26){return function(_0x4305e0){if(!_0x4305e0){_0x1883c1[_0xf222('0x18')](0x194);}return _0x4305e0;};}function handleError(_0x42616e,_0x263dc2){_0x263dc2=_0x263dc2||0x1f4;return function(_0x15bf4e){logger[_0xf222('0x27')](_0x15bf4e[_0xf222('0x28')]);if(_0x15bf4e['name']){delete _0x15bf4e[_0xf222('0x29')];}_0x42616e[_0xf222('0x19')](_0x263dc2)[_0xf222('0x2a')](_0x15bf4e);};}exports[_0xf222('0x2b')]=function(_0xe41039,_0x40a715){var _0x3789e0={},_0x1b928b={},_0x1e87ec={'count':0x0,'rows':[]};var _0x59721a=_[_0xf222('0x2c')](db[_0xf222('0x2d')][_0xf222('0x2e')],function(_0x53a382){return{'name':_0x53a382[_0xf222('0x2f')],'type':_0x53a382['type'][_0xf222('0x30')]};});_0x1b928b[_0xf222('0x31')]=_[_0xf222('0x2c')](_0x59721a,_0xf222('0x29'));_0x1b928b[_0xf222('0x32')]=_[_0xf222('0x33')](_0xe41039[_0xf222('0x32')]);_0x1b928b['filters']=_['intersection'](_0x1b928b[_0xf222('0x31')],_0x1b928b[_0xf222('0x32')]);_0x3789e0[_0xf222('0x34')]=_[_0xf222('0x35')](_0x1b928b[_0xf222('0x31')],qs[_0xf222('0x36')](_0xe41039['query'][_0xf222('0x36')]));_0x3789e0[_0xf222('0x34')]=_0x3789e0[_0xf222('0x34')]['length']?_0x3789e0[_0xf222('0x34')]:_0x1b928b[_0xf222('0x31')];if(!_0xe41039[_0xf222('0x32')]['hasOwnProperty'](_0xf222('0x37'))){_0x3789e0[_0xf222('0x1d')]=qs[_0xf222('0x1d')](_0xe41039['query'][_0xf222('0x1d')]);_0x3789e0[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0xe41039[_0xf222('0x32')][_0xf222('0x1b')]);}_0x3789e0['order']=qs[_0xf222('0x38')](_0xe41039['query'][_0xf222('0x38')]);_0x3789e0[_0xf222('0x39')]=qs[_0xf222('0x3a')](_['pick'](_0xe41039[_0xf222('0x32')],_0x1b928b[_0xf222('0x3a')]),_0x59721a);if(_0xe41039['query'][_0xf222('0x3b')]){_0x3789e0['where']=_[_0xf222('0x3c')](_0x3789e0[_0xf222('0x39')],{'$or':_[_0xf222('0x2c')](_0x59721a,function(_0x5c8b04){if(_0x5c8b04[_0xf222('0x3d')]!==_0xf222('0x3e')){var _0x2c1e49={};_0x2c1e49[_0x5c8b04[_0xf222('0x29')]]={'$like':'%'+_0xe41039[_0xf222('0x32')][_0xf222('0x3b')]+'%'};return _0x2c1e49;}})});}_0x3789e0=_['merge']({},_0x3789e0,_0xe41039[_0xf222('0x3f')]);var _0x24e8a5={'where':_0x3789e0['where']};return db['FreshdeskField'][_0xf222('0x1e')](_0x24e8a5)['then'](function(_0x2b20d3){_0x1e87ec[_0xf222('0x1e')]=_0x2b20d3;if(_0xe41039[_0xf222('0x32')][_0xf222('0x40')]){_0x3789e0['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xf222('0x41')](_0x3789e0);})['then'](function(_0x522a9e){_0x1e87ec[_0xf222('0x42')]=_0x522a9e;return _0x1e87ec;})[_0xf222('0x25')](respondWithFilteredResult(_0x40a715,_0x3789e0))[_0xf222('0x43')](handleError(_0x40a715,null));};exports[_0xf222('0x44')]=function(_0x10f065,_0x2af478){var _0x5c60e6={'raw':!![],'where':{'id':_0x10f065[_0xf222('0x45')]['id']}},_0xf829ae={};_0xf829ae['model']=_[_0xf222('0x33')](db[_0xf222('0x2d')]['rawAttributes']);_0xf829ae[_0xf222('0x32')]=_['keys'](_0x10f065[_0xf222('0x32')]);_0xf829ae[_0xf222('0x3a')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],_0xf829ae[_0xf222('0x32')]);_0x5c60e6[_0xf222('0x34')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],qs[_0xf222('0x36')](_0x10f065[_0xf222('0x32')][_0xf222('0x36')]));_0x5c60e6['attributes']=_0x5c60e6['attributes']['length']?_0x5c60e6[_0xf222('0x34')]:_0xf829ae[_0xf222('0x31')];if(_0x10f065[_0xf222('0x32')][_0xf222('0x40')]){_0x5c60e6['include']=[{'all':!![]}];}_0x5c60e6=_[_0xf222('0x3c')]({},_0x5c60e6,_0x10f065[_0xf222('0x3f')]);return db[_0xf222('0x2d')][_0xf222('0x46')](_0x5c60e6)['then'](handleEntityNotFound(_0x2af478,null))[_0xf222('0x25')](respondWithResult(_0x2af478,null))[_0xf222('0x43')](handleError(_0x2af478,null));};exports[_0xf222('0x47')]=function(_0x37b393,_0x1d60e5){return db[_0xf222('0x2d')][_0xf222('0x47')](_0x37b393[_0xf222('0x48')],{})[_0xf222('0x25')](respondWithResult(_0x1d60e5,0xc9))[_0xf222('0x43')](handleError(_0x1d60e5,null));};exports['update']=function(_0x5d0d70,_0x193762){if(_0x5d0d70['body']['id']){delete _0x5d0d70[_0xf222('0x48')]['id'];}return db['FreshdeskField'][_0xf222('0x46')]({'where':{'id':_0x5d0d70['params']['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x193762,null))[_0xf222('0x25')](saveUpdates(_0x5d0d70[_0xf222('0x48')],null))[_0xf222('0x25')](respondWithResult(_0x193762,null))['catch'](handleError(_0x193762,null));};exports[_0xf222('0x26')]=function(_0x34fd50,_0x380642){return db[_0xf222('0x2d')][_0xf222('0x46')]({'where':{'id':_0x34fd50[_0xf222('0x45')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x380642,null))[_0xf222('0x25')](removeEntity(_0x380642,null))[_0xf222('0x43')](handleError(_0x380642,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6714adb..59c79e4 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 _0x1bdd=['../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x59c1e0,_0x5af500){var _0x17436c=function(_0x20685a){while(--_0x20685a){_0x59c1e0['push'](_0x59c1e0['shift']());}};_0x17436c(++_0x5af500);}(_0x1bdd,0x143));var _0xd1bd=function(_0x33dea9,_0x1ff0fd){_0x33dea9=_0x33dea9-0x0;var _0x531efa=_0x1bdd[_0x33dea9];return _0x531efa;};'use strict';var _=require(_0xd1bd('0x0'));var util=require(_0xd1bd('0x1'));var logger=require(_0xd1bd('0x2'))(_0xd1bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1bd('0x4'));var fs=require('fs');var path=require(_0xd1bd('0x5'));var rimraf=require(_0xd1bd('0x6'));var config=require(_0xd1bd('0x7'));var attributes=require(_0xd1bd('0x8'));module['exports']=function(_0x23db60,_0x2fc380){return _0x23db60[_0xd1bd('0x9')](_0xd1bd('0xa'),attributes,{'tableName':_0xd1bd('0xb'),'paranoid':![],'indexes':[{'name':_0xd1bd('0xc'),'fields':[_0xd1bd('0xd'),_0xd1bd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60d4=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','int_freshdesk_fields','idField','lodash'];(function(_0x10eb4f,_0x356f91){var _0x4743ff=function(_0x2d0287){while(--_0x2d0287){_0x10eb4f['push'](_0x10eb4f['shift']());}};_0x4743ff(++_0x356f91);}(_0x60d4,0xa4));var _0x460d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60d4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x460d('0x0'));var util=require(_0x460d('0x1'));var logger=require(_0x460d('0x2'))(_0x460d('0x3'));var moment=require('moment');var BPromise=require(_0x460d('0x4'));var rp=require(_0x460d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x460d('0x6'));var attributes=require(_0x460d('0x7'));module[_0x460d('0x8')]=function(_0x3ab4ae,_0x27e4c3){return _0x3ab4ae['define']('FreshdeskField',attributes,{'tableName':_0x460d('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x460d('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 759754d..e409e73 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 _0x8a3c=['client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x46b3ef,_0x13825d){var _0x14b497=function(_0x17d577){while(--_0x17d577){_0x46b3ef['push'](_0x46b3ef['shift']());}};_0x14b497(++_0x13825d);}(_0x8a3c,0x113));var _0xc8a3=function(_0x5bd072,_0x3f02d6){_0x5bd072=_0x5bd072-0x0;var _0x17c868=_0x8a3c[_0x5bd072];return _0x17c868;};'use strict';var _=require(_0xc8a3('0x0'));var util=require(_0xc8a3('0x1'));var moment=require(_0xc8a3('0x2'));var BPromise=require(_0xc8a3('0x3'));var rs=require(_0xc8a3('0x4'));var fs=require('fs');var Redis=require(_0xc8a3('0x5'));var db=require(_0xc8a3('0x6'))['db'];var utils=require(_0xc8a3('0x7'));var logger=require('../../config/logger')(_0xc8a3('0x8'));var config=require(_0xc8a3('0x9'));var jayson=require(_0xc8a3('0xa'));var client=jayson[_0xc8a3('0xb')][_0xc8a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2718a2,_0x3839d7,_0x2ded4c){return new BPromise(function(_0x568b6a,_0x15e6e2){return client[_0xc8a3('0xd')](_0x2718a2,_0x2ded4c)[_0xc8a3('0xe')](function(_0x3115ea){logger[_0xc8a3('0xf')](_0xc8a3('0x10'),_0x3839d7,_0xc8a3('0x11'));logger[_0xc8a3('0x12')](_0xc8a3('0x13'),_0x3839d7,_0xc8a3('0x11'),JSON[_0xc8a3('0x14')](_0x3115ea));if(_0x3115ea[_0xc8a3('0x15')]){if(_0x3115ea[_0xc8a3('0x15')][_0xc8a3('0x16')]===0x1f4){logger[_0xc8a3('0x15')](_0xc8a3('0x10'),_0x3839d7,_0x3115ea[_0xc8a3('0x15')]['message']);return _0x15e6e2(_0x3115ea['error']['message']);}logger['error'](_0xc8a3('0x10'),_0x3839d7,_0x3115ea[_0xc8a3('0x15')]['message']);return _0x568b6a(_0x3115ea[_0xc8a3('0x15')][_0xc8a3('0x17')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3839d7,_0xc8a3('0x11'));_0x568b6a(_0x3115ea[_0xc8a3('0x18')][_0xc8a3('0x17')]);}})[_0xc8a3('0x19')](function(_0x2aee60){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3839d7,_0x2aee60);_0x15e6e2(_0x2aee60);});});} \ No newline at end of file +var _0x7fee=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent'];(function(_0x59b6a9,_0x405dd3){var _0x266dc0=function(_0x3ac25b){while(--_0x3ac25b){_0x59b6a9['push'](_0x59b6a9['shift']());}};_0x266dc0(++_0x405dd3);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x7fee[_0x37ffea];return _0x2e2615;};'use strict';var _=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var moment=require(_0xe7fe('0x2'));var BPromise=require(_0xe7fe('0x3'));var rs=require(_0xe7fe('0x4'));var fs=require('fs');var Redis=require(_0xe7fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7fe('0x6'));var logger=require(_0xe7fe('0x7'))(_0xe7fe('0x8'));var config=require('../../config/environment');var jayson=require(_0xe7fe('0x9'));var client=jayson['client'][_0xe7fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeca7d9,_0x25a6a4,_0x9b55e8){return new BPromise(function(_0x1f3366,_0xf5e41b){return client[_0xe7fe('0xb')](_0xeca7d9,_0x9b55e8)['then'](function(_0x5b8d3f){logger['info'](_0xe7fe('0xc'),_0x25a6a4,'request\x20sent');logger[_0xe7fe('0xd')](_0xe7fe('0xe'),_0x25a6a4,'request\x20sent',JSON['stringify'](_0x5b8d3f));if(_0x5b8d3f[_0xe7fe('0xf')]){if(_0x5b8d3f[_0xe7fe('0xf')]['code']===0x1f4){logger[_0xe7fe('0xf')](_0xe7fe('0xc'),_0x25a6a4,_0x5b8d3f[_0xe7fe('0xf')]['message']);return _0xf5e41b(_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);}logger[_0xe7fe('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x25a6a4,_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);return _0x1f3366(_0x5b8d3f[_0xe7fe('0xf')][_0xe7fe('0x10')]);}else{logger[_0xe7fe('0x11')](_0xe7fe('0xc'),_0x25a6a4,_0xe7fe('0x12'));_0x1f3366(_0x5b8d3f[_0xe7fe('0x13')][_0xe7fe('0x10')]);}})[_0xe7fe('0x14')](function(_0x3616a6){logger[_0xe7fe('0xf')](_0xe7fe('0xc'),_0x25a6a4,_0x3616a6);_0xf5e41b(_0x3616a6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 384a98e..067fc2b 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 _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x1e1f1c,_0x788ad4){var _0x508a08=function(_0x5118da){while(--_0x5118da){_0x1e1f1c['push'](_0x1e1f1c['shift']());}};_0x508a08(++_0x788ad4);}(_0xdb94,0xab));var _0x4db9=function(_0x3ba415,_0x5a10ee){_0x3ba415=_0x3ba415-0x0;var _0x4ba43c=_0xdb94[_0x3ba415];return _0x4ba43c;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('0x16')]=router; \ No newline at end of file +var _0x5423=['create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x3f1a6b,_0x1b0d61){var _0x118093=function(_0x17f991){while(--_0x17f991){_0x3f1a6b['push'](_0x3f1a6b['shift']());}};_0x118093(++_0x1b0d61);}(_0x5423,0xe3));var _0x3542=function(_0x3259fe,_0x4925fa){_0x3259fe=_0x3259fe-0x0;var _0xae7b06=_0x5423[_0x3259fe];return _0xae7b06;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var fs_extra=require(_0x3542('0x4'));var auth=require(_0x3542('0x5'));var interaction=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x3542('0x8')]('/',auth[_0x3542('0x9')](),controller[_0x3542('0xa')]);router[_0x3542('0x8')](_0x3542('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3542('0x8')](_0x3542('0xc'),auth['isAuthenticated'](),controller[_0x3542('0xd')]);router[_0x3542('0x8')]('/:id/fields',auth[_0x3542('0x9')](),controller[_0x3542('0xe')]);router['post']('/',auth[_0x3542('0x9')](),controller[_0x3542('0xf')]);router[_0x3542('0x10')](_0x3542('0xc'),auth[_0x3542('0x9')](),controller[_0x3542('0x11')]);router[_0x3542('0x12')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller[_0x3542('0x13')]);router[_0x3542('0x14')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller['destroy']);module[_0x3542('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index abbd4ae..21aac92 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 _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x5ed1a4,_0x6d43b8){var _0x4c6082=function(_0x356389){while(--_0x356389){_0x5ed1a4['push'](_0x5ed1a4['shift']());}};_0x4c6082(++_0x6d43b8);}(_0x236c,0x155));var _0xc236=function(_0x214370,_0x24264e){_0x214370=_0x214370-0x0;var _0x989e4f=_0x236c[_0x214370];return _0x989e4f;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5c6835,_0x5d3a05){var _0x125843=function(_0x22409a){while(--_0x22409a){_0x5c6835['push'](_0x5c6835['shift']());}};_0x125843(++_0x5d3a05);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('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 2cdef5a..f45c962 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 _0x2f29=['format','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','catch','params','fields','includeAll','include','options','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x2f29,0x197));var _0x92f2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2f29[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x92f2('0x0'));var rp=require(_0x92f2('0x1'));var moment=require(_0x92f2('0x2'));var BPromise=require(_0x92f2('0x3'));var Mustache=require(_0x92f2('0x4'));var util=require(_0x92f2('0x5'));var path=require(_0x92f2('0x6'));var sox=require(_0x92f2('0x7'));var csv=require(_0x92f2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f2('0x9'));var _=require(_0x92f2('0xa'));var squel=require(_0x92f2('0xb'));var crypto=require(_0x92f2('0xc'));var jsforce=require(_0x92f2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x92f2('0xe'));var Papa=require(_0x92f2('0xf'));var Redis=require('ioredis');var authService=require(_0x92f2('0x10'));var qs=require(_0x92f2('0x11'));var as=require(_0x92f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92f2('0x13'))(_0x92f2('0x14'));var utils=require('../../config/utils');var config=require(_0x92f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x92f2('0x16'))['db'];var integrations=require(_0x92f2('0x17'));function respondWithStatusCode(_0x5a6064,_0x3e0135){_0x3e0135=_0x3e0135||0xcc;return function(_0x3b704c){if(_0x3b704c){return _0x5a6064[_0x92f2('0x18')](_0x3e0135);}return _0x5a6064['status'](_0x3e0135)['end']();};}function respondWithResult(_0x3d736e,_0x33e50c){_0x33e50c=_0x33e50c||0xc8;return function(_0x2fa648){if(_0x2fa648){return _0x3d736e[_0x92f2('0x19')](_0x33e50c)['json'](_0x2fa648);}};}function respondWithFilteredResult(_0x36fe11,_0x4a1a49){return function(_0x186e95){if(_0x186e95){var _0x1f20aa=typeof _0x4a1a49['offset']===_0x92f2('0x1a')&&typeof _0x4a1a49[_0x92f2('0x1b')]==='undefined';var _0x4804a7=_0x186e95[_0x92f2('0x1c')];var _0xe7deca=_0x1f20aa?0x0:_0x4a1a49[_0x92f2('0x1d')];var _0x107960=_0x1f20aa?_0x186e95[_0x92f2('0x1c')]:_0x4a1a49[_0x92f2('0x1d')]+_0x4a1a49[_0x92f2('0x1b')];var _0x4c0fe9;if(_0x107960>=_0x4804a7){_0x107960=_0x4804a7;_0x4c0fe9=0xc8;}else{_0x4c0fe9=0xce;}_0x36fe11[_0x92f2('0x19')](_0x4c0fe9);return _0x36fe11['set'](_0x92f2('0x1e'),_0xe7deca+'-'+_0x107960+'/'+_0x4804a7)[_0x92f2('0x1f')](_0x186e95);}return null;};}function patchUpdates(_0x4a3c4a){return function(_0x1e93ab){try{jsonpatch[_0x92f2('0x20')](_0x1e93ab,_0x4a3c4a,!![]);}catch(_0x407751){return BPromise[_0x92f2('0x21')](_0x407751);}return _0x1e93ab[_0x92f2('0x22')]();};}function saveUpdates(_0x494fdc,_0x4c7c32){return function(_0x410fe2){if(_0x410fe2){return _0x410fe2[_0x92f2('0x23')](_0x494fdc)[_0x92f2('0x24')](function(_0x1840a8){return _0x1840a8;});}return null;};}function removeEntity(_0xd53a69,_0x380fe9){return function(_0x15f621){if(_0x15f621){return _0x15f621['destroy']()[_0x92f2('0x24')](function(){_0xd53a69['status'](0xcc)[_0x92f2('0x25')]();});}};}function handleEntityNotFound(_0x73608d,_0x8ac543){return function(_0x20db05){if(!_0x20db05){_0x73608d[_0x92f2('0x18')](0x194);}return _0x20db05;};}function handleError(_0x14f512,_0x2c356a){_0x2c356a=_0x2c356a||0x1f4;return function(_0x36c765){logger[_0x92f2('0x26')](_0x36c765[_0x92f2('0x27')]);if(_0x36c765[_0x92f2('0x28')]){delete _0x36c765['name'];}_0x14f512['status'](_0x2c356a)[_0x92f2('0x29')](_0x36c765);};}exports[_0x92f2('0x2a')]=function(_0x395156,_0x32aa8f){var _0x108b55={},_0x1e2e08={},_0x5dbb99={'count':0x0,'rows':[]};var _0x32dea3=_['map'](db[_0x92f2('0x2b')][_0x92f2('0x2c')],function(_0x20dcfc){return{'name':_0x20dcfc[_0x92f2('0x2d')],'type':_0x20dcfc[_0x92f2('0x2e')][_0x92f2('0x2f')]};});_0x1e2e08['model']=_[_0x92f2('0x30')](_0x32dea3,_0x92f2('0x28'));_0x1e2e08[_0x92f2('0x31')]=_[_0x92f2('0x32')](_0x395156[_0x92f2('0x31')]);_0x1e2e08['filters']=_[_0x92f2('0x33')](_0x1e2e08[_0x92f2('0x34')],_0x1e2e08[_0x92f2('0x31')]);_0x108b55[_0x92f2('0x35')]=_['intersection'](_0x1e2e08[_0x92f2('0x34')],qs['fields'](_0x395156[_0x92f2('0x31')]['fields']));_0x108b55[_0x92f2('0x35')]=_0x108b55['attributes'][_0x92f2('0x36')]?_0x108b55[_0x92f2('0x35')]:_0x1e2e08[_0x92f2('0x34')];if(!_0x395156[_0x92f2('0x31')][_0x92f2('0x37')](_0x92f2('0x38'))){_0x108b55[_0x92f2('0x1b')]=qs[_0x92f2('0x1b')](_0x395156[_0x92f2('0x31')]['limit']);_0x108b55['offset']=qs[_0x92f2('0x1d')](_0x395156[_0x92f2('0x31')][_0x92f2('0x1d')]);}_0x108b55['order']=qs[_0x92f2('0x39')](_0x395156[_0x92f2('0x31')]['sort']);_0x108b55[_0x92f2('0x3a')]=qs[_0x92f2('0x3b')](_['pick'](_0x395156[_0x92f2('0x31')],_0x1e2e08['filters']),_0x32dea3);if(_0x395156[_0x92f2('0x31')][_0x92f2('0x3c')]){_0x108b55[_0x92f2('0x3a')]=_[_0x92f2('0x3d')](_0x108b55['where'],{'$or':_[_0x92f2('0x30')](_0x32dea3,function(_0x352ba3){if(_0x352ba3[_0x92f2('0x2e')]!==_0x92f2('0x3e')){var _0x10bef7={};_0x10bef7[_0x352ba3[_0x92f2('0x28')]]={'$like':'%'+_0x395156[_0x92f2('0x31')][_0x92f2('0x3c')]+'%'};return _0x10bef7;}})});}_0x108b55=_[_0x92f2('0x3d')]({},_0x108b55,_0x395156['options']);var _0x187380={'where':_0x108b55[_0x92f2('0x3a')]};return db[_0x92f2('0x2b')]['count'](_0x187380)[_0x92f2('0x24')](function(_0x47f36d){_0x5dbb99['count']=_0x47f36d;if(_0x395156['query']['includeAll']){_0x108b55['include']=[{'all':!![]}];}return db[_0x92f2('0x2b')][_0x92f2('0x3f')](_0x108b55);})[_0x92f2('0x24')](function(_0xac213a){_0x5dbb99[_0x92f2('0x40')]=_0xac213a;return _0x5dbb99;})[_0x92f2('0x24')](respondWithFilteredResult(_0x32aa8f,_0x108b55))[_0x92f2('0x41')](handleError(_0x32aa8f,null));};exports['show']=function(_0x31caa5,_0x519747){var _0x2ffea7={'raw':![],'where':{'id':_0x31caa5[_0x92f2('0x42')]['id']}},_0x57da5f={};_0x57da5f[_0x92f2('0x34')]=_[_0x92f2('0x32')](db[_0x92f2('0x2b')][_0x92f2('0x2c')]);_0x57da5f[_0x92f2('0x31')]=_['keys'](_0x31caa5[_0x92f2('0x31')]);_0x57da5f[_0x92f2('0x3b')]=_['intersection'](_0x57da5f['model'],_0x57da5f['query']);_0x2ffea7[_0x92f2('0x35')]=_[_0x92f2('0x33')](_0x57da5f[_0x92f2('0x34')],qs[_0x92f2('0x43')](_0x31caa5[_0x92f2('0x31')][_0x92f2('0x43')]));_0x2ffea7[_0x92f2('0x35')]=_0x2ffea7[_0x92f2('0x35')][_0x92f2('0x36')]?_0x2ffea7['attributes']:_0x57da5f[_0x92f2('0x34')];if(_0x31caa5[_0x92f2('0x31')][_0x92f2('0x44')]){_0x2ffea7[_0x92f2('0x45')]=[{'all':!![]}];}_0x2ffea7=_[_0x92f2('0x3d')]({},_0x2ffea7,_0x31caa5[_0x92f2('0x46')]);return db[_0x92f2('0x2b')][_0x92f2('0x47')](_0x2ffea7)[_0x92f2('0x24')](handleEntityNotFound(_0x519747,null))[_0x92f2('0x24')](respondWithResult(_0x519747,null))[_0x92f2('0x41')](handleError(_0x519747,null));};exports[_0x92f2('0x48')]=function(_0x542d5a,_0x3eff1c){return db[_0x92f2('0x2b')][_0x92f2('0x48')](_0x542d5a[_0x92f2('0x49')],{})[_0x92f2('0x24')](respondWithResult(_0x3eff1c,0xc9))[_0x92f2('0x41')](handleError(_0x3eff1c,null));};exports[_0x92f2('0x23')]=function(_0x1c597d,_0x981c77){if(_0x1c597d[_0x92f2('0x49')]['id']){delete _0x1c597d['body']['id'];}return db[_0x92f2('0x2b')][_0x92f2('0x47')]({'where':{'id':_0x1c597d[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x981c77,null))[_0x92f2('0x24')](saveUpdates(_0x1c597d[_0x92f2('0x49')],null))[_0x92f2('0x24')](respondWithResult(_0x981c77,null))['catch'](handleError(_0x981c77,null));};exports[_0x92f2('0x4a')]=function(_0x2a3c24,_0x21bba7){return db['FreshsalesAccount']['find']({'where':{'id':_0x2a3c24[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x21bba7,null))[_0x92f2('0x24')](removeEntity(_0x21bba7,null))[_0x92f2('0x41')](handleError(_0x21bba7,null));};exports[_0x92f2('0x4b')]=function(_0x1ffaa5,_0x414431,_0x549245){var _0xf4cc2f={};var _0x3a3c7d={};var _0x420eac;var _0x4cd57f;return db[_0x92f2('0x2b')][_0x92f2('0x4c')]({'where':{'id':_0x1ffaa5['params']['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x414431,null))[_0x92f2('0x24')](function(_0x288529){if(_0x288529){_0x420eac=_0x288529;_0x3a3c7d[_0x92f2('0x34')]=_[_0x92f2('0x32')](db[_0x92f2('0x4d')][_0x92f2('0x2c')]);_0x3a3c7d['query']=_[_0x92f2('0x32')](_0x1ffaa5['query']);_0x3a3c7d[_0x92f2('0x3b')]=_[_0x92f2('0x33')](_0x3a3c7d[_0x92f2('0x34')],_0x3a3c7d[_0x92f2('0x31')]);_0xf4cc2f[_0x92f2('0x35')]=_[_0x92f2('0x33')](_0x3a3c7d[_0x92f2('0x34')],qs[_0x92f2('0x43')](_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x43')]));_0xf4cc2f['attributes']=_0xf4cc2f['attributes'][_0x92f2('0x36')]?_0xf4cc2f[_0x92f2('0x35')]:_0x3a3c7d[_0x92f2('0x34')];_0xf4cc2f['order']=qs[_0x92f2('0x39')](_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x39')]);_0xf4cc2f['where']=qs[_0x92f2('0x3b')](_[_0x92f2('0x4e')](_0x1ffaa5[_0x92f2('0x31')],_0x3a3c7d[_0x92f2('0x3b')]));if(_0x1ffaa5[_0x92f2('0x31')]['filter']){_0xf4cc2f[_0x92f2('0x3a')]=_['merge'](_0xf4cc2f['where'],{'$or':_['map'](_0xf4cc2f['attributes'],function(_0x3c3099){var _0x48721c={};_0x48721c[_0x3c3099]={'$like':'%'+_0x1ffaa5[_0x92f2('0x31')]['filter']+'%'};return _0x48721c;})});}_0xf4cc2f=_[_0x92f2('0x3d')]({},_0xf4cc2f,_0x1ffaa5[_0x92f2('0x46')]);return _0x420eac[_0x92f2('0x4b')](_0xf4cc2f);}})[_0x92f2('0x24')](function(_0x369094){if(_0x369094){_0x4cd57f=_0x369094[_0x92f2('0x36')];if(!_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x37')](_0x92f2('0x38'))){_0xf4cc2f[_0x92f2('0x1b')]=qs['limit'](_0x1ffaa5[_0x92f2('0x31')]['limit']);_0xf4cc2f[_0x92f2('0x1d')]=qs[_0x92f2('0x1d')](_0x1ffaa5[_0x92f2('0x31')]['offset']);}return _0x420eac[_0x92f2('0x4b')](_0xf4cc2f);}})[_0x92f2('0x24')](function(_0x264a1b){if(_0x264a1b){return _0x264a1b?{'count':_0x4cd57f,'rows':_0x264a1b}:null;}})[_0x92f2('0x24')](respondWithResult(_0x414431,null))[_0x92f2('0x41')](handleError(_0x414431,null));};exports[_0x92f2('0x4f')]=function(_0x12db47,_0x355e56,_0x4a92c9){if(_0x12db47[_0x92f2('0x49')]['id']){delete _0x12db47[_0x92f2('0x49')]['id'];}return db['FreshsalesAccount'][_0x92f2('0x4c')]({'where':{'id':_0x12db47[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x355e56,null))[_0x92f2('0x24')](function(_0x241aac){if(_0x241aac){_0x12db47['body'][_0x92f2('0x50')]=_0x241aac['id'];_0x12db47[_0x92f2('0x49')][_0x92f2('0x51')]=integrations['getSubjects'](_0x12db47['body'][_0x92f2('0x52')],_0x12db47[_0x92f2('0x49')]['type']);_0x12db47[_0x92f2('0x49')][_0x92f2('0x53')]=integrations['getDescriptions'](_0x12db47[_0x92f2('0x49')][_0x92f2('0x52')],_0x12db47[_0x92f2('0x49')][_0x92f2('0x2e')]);return db[_0x92f2('0x4d')][_0x92f2('0x48')](_0x12db47[_0x92f2('0x49')],{'include':[{'model':db[_0x92f2('0x54')],'as':_0x92f2('0x51')},{'model':db[_0x92f2('0x54')],'as':_0x92f2('0x53')}]});}return null;})['then'](respondWithResult(_0x355e56,null))[_0x92f2('0x41')](handleError(_0x355e56,null));};exports[_0x92f2('0x55')]=function(_0x4a7a3a,_0x2917e7,_0x48b08d){var _0x811f9f='';var _0x20ef9c='';return db[_0x92f2('0x2b')]['findOne']({'where':{'id':_0x4a7a3a[_0x92f2('0x42')]['id']},'attributes':['id',_0x92f2('0x56'),_0x92f2('0x57'),_0x92f2('0x58')]})[_0x92f2('0x24')](handleEntityNotFound(_0x2917e7,null))[_0x92f2('0x24')](function(_0x4e37bf){if(_0x4e37bf){_0x20ef9c=_0x4e37bf['username'];_0x811f9f=_0x4e37bf[_0x92f2('0x57')];var _0x580261=_0x4e37bf['remoteUri'][_0x92f2('0x59')](-0x1);if(_0x580261==='/'){_0x811f9f=_0x811f9f[_0x92f2('0x5a')](0x0,_0x811f9f[_0x92f2('0x5b')](_0x580261));}return rp({'method':_0x92f2('0x5c'),'uri':util[_0x92f2('0x5d')]('%s%s',_0x811f9f,'/api/selector/owners'),'headers':{'Authorization':_0x92f2('0x5e')+_0x4e37bf[_0x92f2('0x58')]},'json':!![]});}})[_0x92f2('0x24')](function(_0x31e8a4){if(_0x31e8a4){var _0x20b9ce=_0x31e8a4['users'];var _0x48daab=![];var _0x5524a6=null;for(_0x5524a6=0x0;_0x5524a6<_0x20b9ce[_0x92f2('0x36')];_0x5524a6++){if(_0x20b9ce[_0x5524a6][_0x92f2('0x5f')]===_0x20ef9c){_0x48daab=!![];}}if(_0x48daab){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x92f2('0x60')});}}})['then'](respondWithResult(_0x2917e7,null))[_0x92f2('0x41')](function(_0x229556){var _0x322ce8=_0x4a7a3a[_0x92f2('0x31')][_0x92f2('0x61')]?0x1f4:_0x229556['statusCode']||0x1f4;logger[_0x92f2('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x92f2('0x55'),_0x322ce8,JSON[_0x92f2('0x62')](_0x229556));delete _0x229556['name'];if(_0x322ce8===0x191){_0x322ce8=0x190;}_0x2917e7[_0x92f2('0x19')](_0x322ce8)[_0x92f2('0x29')](_0x4a7a3a[_0x92f2('0x31')][_0x92f2('0x61')]?{'message':_0x92f2('0x63'),'statusCode':_0x229556['statusCode']}:_0x229556);});}; \ No newline at end of file +var _0xebd9=['update','then','destroy','status','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','find','catch','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save'];(function(_0x4d1336,_0x57734d){var _0xdc30c5=function(_0x5b459c){while(--_0x5b459c){_0x4d1336['push'](_0x4d1336['shift']());}};_0xdc30c5(++_0x57734d);}(_0xebd9,0xb0));var _0x9ebd=function(_0x3b2156,_0x30a37c){_0x3b2156=_0x3b2156-0x0;var _0x1a18f8=_0xebd9[_0x3b2156];return _0x1a18f8;};'use strict';var emlformat=require(_0x9ebd('0x0'));var rimraf=require(_0x9ebd('0x1'));var zipdir=require(_0x9ebd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ebd('0x3'));var moment=require(_0x9ebd('0x4'));var BPromise=require(_0x9ebd('0x5'));var Mustache=require('mustache');var util=require(_0x9ebd('0x6'));var path=require(_0x9ebd('0x7'));var sox=require(_0x9ebd('0x8'));var csv=require(_0x9ebd('0x9'));var ejs=require(_0x9ebd('0xa'));var fs=require('fs');var fs_extra=require(_0x9ebd('0xb'));var _=require(_0x9ebd('0xc'));var squel=require(_0x9ebd('0xd'));var crypto=require(_0x9ebd('0xe'));var jsforce=require(_0x9ebd('0xf'));var deskjs=require(_0x9ebd('0x10'));var toCsv=require(_0x9ebd('0x9'));var querystring=require(_0x9ebd('0x11'));var Papa=require(_0x9ebd('0x12'));var Redis=require('ioredis');var authService=require(_0x9ebd('0x13'));var qs=require(_0x9ebd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ebd('0x15'));var logger=require(_0x9ebd('0x16'))(_0x9ebd('0x17'));var utils=require(_0x9ebd('0x18'));var config=require(_0x9ebd('0x19'));var licenseUtil=require(_0x9ebd('0x1a'));var db=require(_0x9ebd('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x21e488,_0x41a659){_0x41a659=_0x41a659||0xcc;return function(_0x2acf29){if(_0x2acf29){return _0x21e488[_0x9ebd('0x1c')](_0x41a659);}return _0x21e488['status'](_0x41a659)[_0x9ebd('0x1d')]();};}function respondWithResult(_0x3a9ca1,_0xac96f1){_0xac96f1=_0xac96f1||0xc8;return function(_0x5c4ce2){if(_0x5c4ce2){return _0x3a9ca1['status'](_0xac96f1)['json'](_0x5c4ce2);}};}function respondWithFilteredResult(_0x33daa4,_0x6a284f){return function(_0x130893){if(_0x130893){var _0x3c76ee=typeof _0x6a284f[_0x9ebd('0x1e')]===_0x9ebd('0x1f')&&typeof _0x6a284f['limit']===_0x9ebd('0x1f');var _0x2038bf=_0x130893[_0x9ebd('0x20')];var _0x5a98be=_0x3c76ee?0x0:_0x6a284f[_0x9ebd('0x1e')];var _0xf54e35=_0x3c76ee?_0x130893[_0x9ebd('0x20')]:_0x6a284f[_0x9ebd('0x1e')]+_0x6a284f[_0x9ebd('0x21')];var _0x2cf95e;if(_0xf54e35>=_0x2038bf){_0xf54e35=_0x2038bf;_0x2cf95e=0xc8;}else{_0x2cf95e=0xce;}_0x33daa4['status'](_0x2cf95e);return _0x33daa4[_0x9ebd('0x22')](_0x9ebd('0x23'),_0x5a98be+'-'+_0xf54e35+'/'+_0x2038bf)[_0x9ebd('0x24')](_0x130893);}return null;};}function patchUpdates(_0x4a4f2a){return function(_0xabc3d){try{jsonpatch[_0x9ebd('0x25')](_0xabc3d,_0x4a4f2a,!![]);}catch(_0x1ea345){return BPromise[_0x9ebd('0x26')](_0x1ea345);}return _0xabc3d[_0x9ebd('0x27')]();};}function saveUpdates(_0x27f953,_0x782e1c){return function(_0x117d09){if(_0x117d09){return _0x117d09[_0x9ebd('0x28')](_0x27f953)[_0x9ebd('0x29')](function(_0x4d731e){return _0x4d731e;});}return null;};}function removeEntity(_0x97eff1,_0x3ed76a){return function(_0x15a59d){if(_0x15a59d){return _0x15a59d[_0x9ebd('0x2a')]()[_0x9ebd('0x29')](function(){_0x97eff1[_0x9ebd('0x2b')](0xcc)[_0x9ebd('0x1d')]();});}};}function handleEntityNotFound(_0x23fa47,_0x1c5218){return function(_0x40c164){if(!_0x40c164){_0x23fa47['sendStatus'](0x194);}return _0x40c164;};}function handleError(_0x4d9cbc,_0x52f31d){_0x52f31d=_0x52f31d||0x1f4;return function(_0x10605c){logger['error'](_0x10605c[_0x9ebd('0x2c')]);if(_0x10605c[_0x9ebd('0x2d')]){delete _0x10605c[_0x9ebd('0x2d')];}_0x4d9cbc[_0x9ebd('0x2b')](_0x52f31d)['send'](_0x10605c);};}exports[_0x9ebd('0x2e')]=function(_0x189f35,_0x25ecbe){var _0x56a0bb={},_0x532680={},_0x569433={'count':0x0,'rows':[]};var _0x46bce4=_[_0x9ebd('0x2f')](db[_0x9ebd('0x30')][_0x9ebd('0x31')],function(_0x4cb658){return{'name':_0x4cb658[_0x9ebd('0x32')],'type':_0x4cb658[_0x9ebd('0x33')][_0x9ebd('0x34')]};});_0x532680[_0x9ebd('0x35')]=_['map'](_0x46bce4,_0x9ebd('0x2d'));_0x532680[_0x9ebd('0x36')]=_['keys'](_0x189f35[_0x9ebd('0x36')]);_0x532680[_0x9ebd('0x37')]=_['intersection'](_0x532680['model'],_0x532680['query']);_0x56a0bb[_0x9ebd('0x38')]=_[_0x9ebd('0x39')](_0x532680[_0x9ebd('0x35')],qs['fields'](_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x3a')]));_0x56a0bb[_0x9ebd('0x38')]=_0x56a0bb[_0x9ebd('0x38')][_0x9ebd('0x3b')]?_0x56a0bb[_0x9ebd('0x38')]:_0x532680['model'];if(!_0x189f35['query'][_0x9ebd('0x3c')]('nolimit')){_0x56a0bb['limit']=qs[_0x9ebd('0x21')](_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x21')]);_0x56a0bb[_0x9ebd('0x1e')]=qs[_0x9ebd('0x1e')](_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x1e')]);}_0x56a0bb[_0x9ebd('0x3d')]=qs[_0x9ebd('0x3e')](_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x3e')]);_0x56a0bb[_0x9ebd('0x3f')]=qs[_0x9ebd('0x37')](_[_0x9ebd('0x40')](_0x189f35[_0x9ebd('0x36')],_0x532680[_0x9ebd('0x37')]),_0x46bce4);if(_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x41')]){_0x56a0bb[_0x9ebd('0x3f')]=_[_0x9ebd('0x42')](_0x56a0bb['where'],{'$or':_[_0x9ebd('0x2f')](_0x46bce4,function(_0x299b9b){if(_0x299b9b[_0x9ebd('0x33')]!==_0x9ebd('0x43')){var _0x16574b={};_0x16574b[_0x299b9b['name']]={'$like':'%'+_0x189f35[_0x9ebd('0x36')][_0x9ebd('0x41')]+'%'};return _0x16574b;}})});}_0x56a0bb=_[_0x9ebd('0x42')]({},_0x56a0bb,_0x189f35[_0x9ebd('0x44')]);var _0x12fbe1={'where':_0x56a0bb[_0x9ebd('0x3f')]};return db[_0x9ebd('0x30')][_0x9ebd('0x20')](_0x12fbe1)[_0x9ebd('0x29')](function(_0x3e8607){_0x569433['count']=_0x3e8607;if(_0x189f35['query'][_0x9ebd('0x45')]){_0x56a0bb[_0x9ebd('0x46')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x9ebd('0x47')](_0x56a0bb);})[_0x9ebd('0x29')](function(_0x4d826c){_0x569433['rows']=_0x4d826c;return _0x569433;})[_0x9ebd('0x29')](respondWithFilteredResult(_0x25ecbe,_0x56a0bb))['catch'](handleError(_0x25ecbe,null));};exports[_0x9ebd('0x48')]=function(_0x27b634,_0x38f5a0){var _0xd7ecc2={'raw':![],'where':{'id':_0x27b634['params']['id']}},_0x33aec9={};_0x33aec9[_0x9ebd('0x35')]=_[_0x9ebd('0x49')](db[_0x9ebd('0x30')]['rawAttributes']);_0x33aec9[_0x9ebd('0x36')]=_['keys'](_0x27b634[_0x9ebd('0x36')]);_0x33aec9['filters']=_['intersection'](_0x33aec9[_0x9ebd('0x35')],_0x33aec9[_0x9ebd('0x36')]);_0xd7ecc2[_0x9ebd('0x38')]=_[_0x9ebd('0x39')](_0x33aec9[_0x9ebd('0x35')],qs[_0x9ebd('0x3a')](_0x27b634[_0x9ebd('0x36')][_0x9ebd('0x3a')]));_0xd7ecc2[_0x9ebd('0x38')]=_0xd7ecc2['attributes'][_0x9ebd('0x3b')]?_0xd7ecc2[_0x9ebd('0x38')]:_0x33aec9[_0x9ebd('0x35')];if(_0x27b634[_0x9ebd('0x36')][_0x9ebd('0x45')]){_0xd7ecc2[_0x9ebd('0x46')]=[{'all':!![]}];}_0xd7ecc2=_[_0x9ebd('0x42')]({},_0xd7ecc2,_0x27b634[_0x9ebd('0x44')]);return db['FreshsalesAccount'][_0x9ebd('0x4a')](_0xd7ecc2)[_0x9ebd('0x29')](handleEntityNotFound(_0x38f5a0,null))[_0x9ebd('0x29')](respondWithResult(_0x38f5a0,null))[_0x9ebd('0x4b')](handleError(_0x38f5a0,null));};exports[_0x9ebd('0x4c')]=function(_0x26a7c5,_0x2cdeb8){return db[_0x9ebd('0x30')][_0x9ebd('0x4c')](_0x26a7c5['body'],{})[_0x9ebd('0x29')](respondWithResult(_0x2cdeb8,0xc9))[_0x9ebd('0x4b')](handleError(_0x2cdeb8,null));};exports[_0x9ebd('0x28')]=function(_0x506aa3,_0x1aa092){if(_0x506aa3['body']['id']){delete _0x506aa3[_0x9ebd('0x4d')]['id'];}return db[_0x9ebd('0x30')][_0x9ebd('0x4a')]({'where':{'id':_0x506aa3[_0x9ebd('0x4e')]['id']}})[_0x9ebd('0x29')](handleEntityNotFound(_0x1aa092,null))['then'](saveUpdates(_0x506aa3['body'],null))['then'](respondWithResult(_0x1aa092,null))[_0x9ebd('0x4b')](handleError(_0x1aa092,null));};exports['destroy']=function(_0x2e81b4,_0x57d08f){return db[_0x9ebd('0x30')][_0x9ebd('0x4a')]({'where':{'id':_0x2e81b4[_0x9ebd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57d08f,null))[_0x9ebd('0x29')](removeEntity(_0x57d08f,null))[_0x9ebd('0x4b')](handleError(_0x57d08f,null));};exports[_0x9ebd('0x4f')]=function(_0x10fc26,_0x3fbf74,_0x2425f0){var _0x291218={};var _0xb71c90={};var _0x1eadd1;var _0x818759;return db[_0x9ebd('0x30')][_0x9ebd('0x50')]({'where':{'id':_0x10fc26['params']['id']}})['then'](handleEntityNotFound(_0x3fbf74,null))[_0x9ebd('0x29')](function(_0x186955){if(_0x186955){_0x1eadd1=_0x186955;_0xb71c90[_0x9ebd('0x35')]=_[_0x9ebd('0x49')](db[_0x9ebd('0x51')]['rawAttributes']);_0xb71c90['query']=_[_0x9ebd('0x49')](_0x10fc26['query']);_0xb71c90[_0x9ebd('0x37')]=_[_0x9ebd('0x39')](_0xb71c90[_0x9ebd('0x35')],_0xb71c90[_0x9ebd('0x36')]);_0x291218[_0x9ebd('0x38')]=_[_0x9ebd('0x39')](_0xb71c90[_0x9ebd('0x35')],qs[_0x9ebd('0x3a')](_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x3a')]));_0x291218[_0x9ebd('0x38')]=_0x291218[_0x9ebd('0x38')][_0x9ebd('0x3b')]?_0x291218['attributes']:_0xb71c90['model'];_0x291218[_0x9ebd('0x3d')]=qs[_0x9ebd('0x3e')](_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x3e')]);_0x291218[_0x9ebd('0x3f')]=qs[_0x9ebd('0x37')](_[_0x9ebd('0x40')](_0x10fc26[_0x9ebd('0x36')],_0xb71c90[_0x9ebd('0x37')]));if(_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x41')]){_0x291218[_0x9ebd('0x3f')]=_[_0x9ebd('0x42')](_0x291218['where'],{'$or':_[_0x9ebd('0x2f')](_0x291218['attributes'],function(_0xdb9dac){var _0x1b3e96={};_0x1b3e96[_0xdb9dac]={'$like':'%'+_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x41')]+'%'};return _0x1b3e96;})});}_0x291218=_['merge']({},_0x291218,_0x10fc26[_0x9ebd('0x44')]);return _0x1eadd1[_0x9ebd('0x4f')](_0x291218);}})[_0x9ebd('0x29')](function(_0x58b341){if(_0x58b341){_0x818759=_0x58b341[_0x9ebd('0x3b')];if(!_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x3c')]('nolimit')){_0x291218[_0x9ebd('0x21')]=qs[_0x9ebd('0x21')](_0x10fc26['query'][_0x9ebd('0x21')]);_0x291218[_0x9ebd('0x1e')]=qs[_0x9ebd('0x1e')](_0x10fc26[_0x9ebd('0x36')][_0x9ebd('0x1e')]);}return _0x1eadd1['getConfigurations'](_0x291218);}})[_0x9ebd('0x29')](function(_0x2e9cd6){if(_0x2e9cd6){return _0x2e9cd6?{'count':_0x818759,'rows':_0x2e9cd6}:null;}})['then'](respondWithResult(_0x3fbf74,null))[_0x9ebd('0x4b')](handleError(_0x3fbf74,null));};exports[_0x9ebd('0x52')]=function(_0x27d40e,_0x4a1cae,_0xb88c8f){if(_0x27d40e['body']['id']){delete _0x27d40e[_0x9ebd('0x4d')]['id'];}return db['FreshsalesAccount'][_0x9ebd('0x50')]({'where':{'id':_0x27d40e[_0x9ebd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a1cae,null))[_0x9ebd('0x29')](function(_0x3a13a1){if(_0x3a13a1){_0x27d40e['body'][_0x9ebd('0x53')]=_0x3a13a1['id'];_0x27d40e[_0x9ebd('0x4d')][_0x9ebd('0x54')]=integrations['getSubjects'](_0x27d40e['body'][_0x9ebd('0x55')],_0x27d40e[_0x9ebd('0x4d')][_0x9ebd('0x33')]);_0x27d40e['body']['Descriptions']=integrations[_0x9ebd('0x56')](_0x27d40e[_0x9ebd('0x4d')]['channel'],_0x27d40e[_0x9ebd('0x4d')][_0x9ebd('0x33')]);return db[_0x9ebd('0x51')][_0x9ebd('0x4c')](_0x27d40e[_0x9ebd('0x4d')],{'include':[{'model':db[_0x9ebd('0x57')],'as':_0x9ebd('0x54')},{'model':db[_0x9ebd('0x57')],'as':_0x9ebd('0x58')}]});}return null;})[_0x9ebd('0x29')](respondWithResult(_0x4a1cae,null))[_0x9ebd('0x4b')](handleError(_0x4a1cae,null));};exports['getFields']=function(_0x22a05c,_0x30d072,_0x29c600){var _0x25dedc='';var _0x3e2067='';return db[_0x9ebd('0x30')][_0x9ebd('0x50')]({'where':{'id':_0x22a05c[_0x9ebd('0x4e')]['id']},'attributes':['id',_0x9ebd('0x59'),_0x9ebd('0x5a'),_0x9ebd('0x5b')]})[_0x9ebd('0x29')](handleEntityNotFound(_0x30d072,null))[_0x9ebd('0x29')](function(_0x1e6053){if(_0x1e6053){_0x3e2067=_0x1e6053['username'];_0x25dedc=_0x1e6053[_0x9ebd('0x5a')];var _0x5a2553=_0x1e6053[_0x9ebd('0x5a')][_0x9ebd('0x5c')](-0x1);if(_0x5a2553==='/'){_0x25dedc=_0x25dedc[_0x9ebd('0x5d')](0x0,_0x25dedc[_0x9ebd('0x5e')](_0x5a2553));}return rp({'method':_0x9ebd('0x5f'),'uri':util[_0x9ebd('0x60')](_0x9ebd('0x61'),_0x25dedc,_0x9ebd('0x62')),'headers':{'Authorization':_0x9ebd('0x63')+_0x1e6053[_0x9ebd('0x5b')]},'json':!![]});}})[_0x9ebd('0x29')](function(_0x3bb6ac){if(_0x3bb6ac){var _0x4acf1d=_0x3bb6ac[_0x9ebd('0x64')];var _0x59128e=![];var _0x148b97=null;for(_0x148b97=0x0;_0x148b97<_0x4acf1d[_0x9ebd('0x3b')];_0x148b97++){if(_0x4acf1d[_0x148b97]['email']===_0x3e2067){_0x59128e=!![];}}if(_0x59128e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9ebd('0x65')});}}})[_0x9ebd('0x29')](respondWithResult(_0x30d072,null))[_0x9ebd('0x4b')](function(_0x49e646){var _0x4f8871=_0x22a05c[_0x9ebd('0x36')][_0x9ebd('0x66')]?0x1f4:_0x49e646['statusCode']||0x1f4;logger[_0x9ebd('0x67')](_0x9ebd('0x68'),_0x9ebd('0x69'),_0x4f8871,JSON[_0x9ebd('0x6a')](_0x49e646));delete _0x49e646[_0x9ebd('0x2d')];if(_0x4f8871===0x191){_0x4f8871=0x190;}_0x30d072[_0x9ebd('0x2b')](_0x4f8871)['send'](_0x22a05c[_0x9ebd('0x36')][_0x9ebd('0x66')]?{'message':_0x9ebd('0x6b'),'statusCode':_0x49e646['statusCode']}:_0x49e646);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5bc7cc8..e75336d 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x132710,_0x1b980b){var _0x26923c=function(_0x526e39){while(--_0x526e39){_0x132710['push'](_0x132710['shift']());}};_0x26923c(++_0x1b980b);}(_0x25e7,0x1d6));var _0x725e=function(_0x3517e5,_0x2c3608){_0x3517e5=_0x3517e5-0x0;var _0x15ba05=_0x25e7[_0x3517e5];return _0x15ba05;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['define','util','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x81c6,0x1d5));var _0x681c=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0x81c6[_0x4b6804];return _0x11b4f1;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));var integrations=require(_0x681c('0x6'));module[_0x681c('0x7')]=function(_0x4ea522,_0x45331){return _0x4ea522[_0x681c('0x8')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 b51bbdb..8c5df81 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 _0xc2c7=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','find','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d2d8d,_0x47d40e){var _0x36ff00=function(_0x35cb55){while(--_0x35cb55){_0x2d2d8d['push'](_0x2d2d8d['shift']());}};_0x36ff00(++_0x47d40e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x295fa0,_0xf95931){_0x295fa0=_0x295fa0-0x0;var _0x3615af=_0xc2c7[_0x295fa0];return _0x3615af;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')]({'raw':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0x14453f[_0x7c2c('0x18')]?_0x14453f['options'][_0x7c2c('0x1a')]||null:null,'attributes':_0x14453f['options']?_0x14453f['options'][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1c')]||null:null,'include':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1d')]?_['map'](_0x14453f[_0x7c2c('0x18')]['include'],function(_0x302c93){return{'model':db[_0x302c93['model']],'as':_0x302c93['as'],'attributes':_0x302c93[_0x7c2c('0x1b')],'include':_0x302c93[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x302c93['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x1f')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1b')],'include':_0x4d6ec7[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x4d6ec7[_0x7c2c('0x1d')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x1f')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xc')](function(_0xf39941){logger[_0x7c2c('0x20')](_0x7c2c('0x15'),_0x14453f);logger[_0x7c2c('0xf')](_0x7c2c('0x15'),_0x14453f,JSON[_0x7c2c('0x11')](_0xf39941));_0x17df4a(_0xf39941);})[_0x7c2c('0x21')](function(_0xa040ff){logger['error'](_0x7c2c('0x15'),_0xa040ff[_0x7c2c('0x14')],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0xa040ff[_0x7c2c('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0xcb98ba){var _0x30dd1c=this;return new Promise(function(_0x4192c8,_0x1ef88b){return db[_0x7c2c('0x16')][_0x7c2c('0x22')]({'raw':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options'][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1a')]||null:null,'attributes':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['attributes']||null:null,'include':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['include']?_[_0x7c2c('0x1e')](_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1d')],function(_0x156c03){return{'model':db[_0x156c03['model']],'as':_0x156c03['as'],'attributes':_0x156c03[_0x7c2c('0x1b')],'include':_0x156c03[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x156c03[_0x7c2c('0x1d')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x1f')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1b')],'include':_0x204968[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x204968[_0x7c2c('0x1d')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x1f')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54cbb7){logger[_0x7c2c('0x20')]('ShowFreshsalesAccount',_0xcb98ba);logger['debug']('ShowFreshsalesAccount',_0xcb98ba,JSON[_0x7c2c('0x11')](_0x54cbb7));_0x4192c8(_0x54cbb7);})[_0x7c2c('0x21')](function(_0x129bf0){logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x129bf0[_0x7c2c('0x14')],_0xcb98ba);_0x1ef88b(_0x30dd1c[_0x7c2c('0x12')](0x1f4,_0x129bf0[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0xc4aa=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x4713c3,_0x39b203){var _0xd284e4=function(_0x271e12){while(--_0x271e12){_0x4713c3['push'](_0x4713c3['shift']());}};_0xd284e4(++_0x39b203);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'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')]('FreshsalesAccount,\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')]({'raw':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'limit':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1c')]||null:null,'include':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x28e304[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x4d2d6c){return{'model':db[_0x4d2d6c[_0xac4a('0x1f')]],'as':_0x4d2d6c['as'],'attributes':_0x4d2d6c[_0xac4a('0x1b')],'include':_0x4d2d6c[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x4d2d6c[_0xac4a('0x1d')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x1f')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1b')],'include':_0x2b0dc2[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x2b0dc2[_0xac4a('0x1d')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x1f')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0xc')](function(_0x20202c){logger['info'](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON[_0xac4a('0x20')](_0x20202c));_0x546c5d(_0x20202c);})[_0xac4a('0x14')](function(_0x4a5a9e){logger['error'](_0xac4a('0x15'),_0x4a5a9e[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x4a5a9e['message']));});});};exports['ShowFreshsalesAccount']=function(_0x355755){var _0x2896bc=this;return new Promise(function(_0x228629,_0x432066){return db[_0xac4a('0x16')]['find']({'raw':_0x355755[_0xac4a('0x18')]?_0x355755['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x355755['options']?_0x355755[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'include':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x1634df){return{'model':db[_0x1634df[_0xac4a('0x1f')]],'as':_0x1634df['as'],'attributes':_0x1634df[_0xac4a('0x1b')],'include':_0x1634df['include']?_[_0xac4a('0x1e')](_0x1634df[_0xac4a('0x1d')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x1f')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1b')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x1d')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x1f')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453d02){logger[_0xac4a('0x13')]('ShowFreshsalesAccount',_0x355755);logger[_0xac4a('0xf')](_0xac4a('0x21'),_0x355755,JSON[_0xac4a('0x20')](_0x453d02));_0x228629(_0x453d02);})['catch'](function(_0x121328){logger[_0xac4a('0x10')](_0xac4a('0x21'),_0x121328['message'],_0x355755);_0x432066(_0x2896bc[_0xac4a('0x10')](0x1f4,_0x121328[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 93b8b53..28f36e4 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 _0xd0eb=['create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x7b5ee0,_0x32bbcc){var _0x3c995a=function(_0x1b3f9e){while(--_0x1b3f9e){_0x7b5ee0['push'](_0x7b5ee0['shift']());}};_0x3c995a(++_0x32bbcc);}(_0xd0eb,0x1d4));var _0xbd0e=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xd0eb[_0x387dc1];return _0x17567c;};'use strict';var multer=require(_0xbd0e('0x0'));var util=require(_0xbd0e('0x1'));var path=require('path');var timeout=require(_0xbd0e('0x2'));var express=require('express');var router=express[_0xbd0e('0x3')]();var fs_extra=require(_0xbd0e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd0e('0x5'));var config=require(_0xbd0e('0x6'));var controller=require(_0xbd0e('0x7'));router['get']('/',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x9')]);router[_0xbd0e('0xa')]('/:id',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xb')]);router[_0xbd0e('0xa')]('/:id/subjects',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xc')]);router[_0xbd0e('0xa')](_0xbd0e('0xd'),auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xe')]);router[_0xbd0e('0xa')]('/:id/fields',auth[_0xbd0e('0x8')](),controller['getFields']);router['post']('/',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xf')]);router[_0xbd0e('0x10')]('/:id',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x11')]);router['delete'](_0xbd0e('0x12'),auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x13')]);module[_0xbd0e('0x14')]=router; \ No newline at end of file +var _0x8ca8=['/:id/fields','getFields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show'];(function(_0x5f084a,_0x53d22a){var _0x2d60c1=function(_0x43f3a7){while(--_0x43f3a7){_0x5f084a['push'](_0x5f084a['shift']());}};_0x2d60c1(++_0x53d22a);}(_0x8ca8,0x8c));var _0x88ca=function(_0xcf002c,_0x5103d5){_0xcf002c=_0xcf002c-0x0;var _0x4e4739=_0x8ca8[_0xcf002c];return _0x4e4739;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require(_0x88ca('0x2'));var timeout=require(_0x88ca('0x3'));var express=require(_0x88ca('0x4'));var router=express[_0x88ca('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x88ca('0x6'));var config=require(_0x88ca('0x7'));var controller=require(_0x88ca('0x8'));router['get']('/',auth[_0x88ca('0x9')](),controller[_0x88ca('0xa')]);router[_0x88ca('0xb')](_0x88ca('0xc'),auth[_0x88ca('0x9')](),controller[_0x88ca('0xd')]);router[_0x88ca('0xb')]('/:id/subjects',auth[_0x88ca('0x9')](),controller['getSubjects']);router[_0x88ca('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x88ca('0xb')](_0x88ca('0xe'),auth['isAuthenticated'](),controller[_0x88ca('0xf')]);router['post']('/',auth[_0x88ca('0x9')](),controller[_0x88ca('0x10')]);router[_0x88ca('0x11')](_0x88ca('0xc'),auth['isAuthenticated'](),controller[_0x88ca('0x12')]);router[_0x88ca('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x88ca('0x14')]);module[_0x88ca('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a0f325d..ff13223 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 _0xcfe0=['sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcfe0,0xcc));var _0x0cfe=function(_0x177b36,_0x15536b){_0x177b36=_0x177b36-0x0;var _0x50a20c=_0xcfe0[_0x177b36];return _0x50a20c;};'use strict';var Sequelize=require(_0x0cfe('0x0'));module[_0x0cfe('0x1')]={'name':{'type':Sequelize[_0x0cfe('0x2')]},'description':{'type':Sequelize[_0x0cfe('0x2')]}}; \ No newline at end of file +var _0x3459=['exports','STRING'];(function(_0x54ea6a,_0x32fef5){var _0x236cdb=function(_0x110464){while(--_0x110464){_0x54ea6a['push'](_0x54ea6a['shift']());}};_0x236cdb(++_0x32fef5);}(_0x3459,0x1f0));var _0x9345=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3459[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x9345('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9345('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1dcdc81..607a0e7 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 _0xee1d=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','update','body','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xee1d,0xd2));var _0xdee1=function(_0x778b72,_0x19857f){_0x778b72=_0x778b72-0x0;var _0x4528ab=_0xee1d[_0x778b72];return _0x4528ab;};'use strict';var emlformat=require(_0xdee1('0x0'));var rimraf=require(_0xdee1('0x1'));var zipdir=require(_0xdee1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdee1('0x3'));var moment=require(_0xdee1('0x4'));var BPromise=require(_0xdee1('0x5'));var Mustache=require(_0xdee1('0x6'));var util=require(_0xdee1('0x7'));var path=require(_0xdee1('0x8'));var sox=require(_0xdee1('0x9'));var csv=require(_0xdee1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdee1('0xb'));var _=require(_0xdee1('0xc'));var squel=require('squel');var crypto=require(_0xdee1('0xd'));var jsforce=require(_0xdee1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdee1('0xf'));var Papa=require('papaparse');var Redis=require(_0xdee1('0x10'));var authService=require(_0xdee1('0x11'));var qs=require(_0xdee1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdee1('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdee1('0x14'))['db'];function respondWithStatusCode(_0x4452af,_0x2efc72){_0x2efc72=_0x2efc72||0xcc;return function(_0x36743e){if(_0x36743e){return _0x4452af[_0xdee1('0x15')](_0x2efc72);}return _0x4452af[_0xdee1('0x16')](_0x2efc72)[_0xdee1('0x17')]();};}function respondWithResult(_0xadb16d,_0x2508fa){_0x2508fa=_0x2508fa||0xc8;return function(_0x32cb9f){if(_0x32cb9f){return _0xadb16d[_0xdee1('0x16')](_0x2508fa)['json'](_0x32cb9f);}};}function respondWithFilteredResult(_0x32e259,_0x6bbe3e){return function(_0x1d23ed){if(_0x1d23ed){var _0x3bf978=typeof _0x6bbe3e[_0xdee1('0x18')]==='undefined'&&typeof _0x6bbe3e[_0xdee1('0x19')]===_0xdee1('0x1a');var _0x33bada=_0x1d23ed[_0xdee1('0x1b')];var _0x4aa35a=_0x3bf978?0x0:_0x6bbe3e[_0xdee1('0x18')];var _0xbf12d0=_0x3bf978?_0x1d23ed['count']:_0x6bbe3e['offset']+_0x6bbe3e[_0xdee1('0x19')];var _0x16c19c;if(_0xbf12d0>=_0x33bada){_0xbf12d0=_0x33bada;_0x16c19c=0xc8;}else{_0x16c19c=0xce;}_0x32e259[_0xdee1('0x16')](_0x16c19c);return _0x32e259['set']('Content-Range',_0x4aa35a+'-'+_0xbf12d0+'/'+_0x33bada)[_0xdee1('0x1c')](_0x1d23ed);}return null;};}function patchUpdates(_0x59a4ac){return function(_0x2a701d){try{jsonpatch['apply'](_0x2a701d,_0x59a4ac,!![]);}catch(_0x548216){return BPromise[_0xdee1('0x1d')](_0x548216);}return _0x2a701d[_0xdee1('0x1e')]();};}function saveUpdates(_0x23d459,_0x43a4ff){return function(_0x5654af){if(_0x5654af){return _0x5654af['update'](_0x23d459)[_0xdee1('0x1f')](function(_0x41b68c){return _0x41b68c;});}return null;};}function removeEntity(_0x2b473d,_0x116852){return function(_0x1e5f68){if(_0x1e5f68){return _0x1e5f68[_0xdee1('0x20')]()[_0xdee1('0x1f')](function(){_0x2b473d[_0xdee1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df5f2,_0x5bc23b){return function(_0x2a694d){if(!_0x2a694d){_0x1df5f2[_0xdee1('0x15')](0x194);}return _0x2a694d;};}function handleError(_0x4b76f6,_0x23f961){_0x23f961=_0x23f961||0x1f4;return function(_0x371cee){logger[_0xdee1('0x21')](_0x371cee[_0xdee1('0x22')]);if(_0x371cee[_0xdee1('0x23')]){delete _0x371cee[_0xdee1('0x23')];}_0x4b76f6[_0xdee1('0x16')](_0x23f961)[_0xdee1('0x24')](_0x371cee);};}exports[_0xdee1('0x25')]=function(_0x1e49ab,_0x23bbd2){var _0x2c0aec={},_0x301caa={},_0x4cca10={'count':0x0,'rows':[]};var _0x388b8f=_[_0xdee1('0x26')](db[_0xdee1('0x27')][_0xdee1('0x28')],function(_0x49fd8a){return{'name':_0x49fd8a['fieldName'],'type':_0x49fd8a[_0xdee1('0x29')]['key']};});_0x301caa[_0xdee1('0x2a')]=_['map'](_0x388b8f,_0xdee1('0x23'));_0x301caa['query']=_[_0xdee1('0x2b')](_0x1e49ab['query']);_0x301caa[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x301caa[_0xdee1('0x2a')],_0x301caa['query']);_0x2c0aec[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x301caa['model'],qs[_0xdee1('0x2f')](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x2f')]));_0x2c0aec['attributes']=_0x2c0aec[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x2c0aec[_0xdee1('0x2e')]:_0x301caa[_0xdee1('0x2a')];if(!_0x1e49ab['query'][_0xdee1('0x32')](_0xdee1('0x33'))){_0x2c0aec['limit']=qs[_0xdee1('0x19')](_0x1e49ab[_0xdee1('0x30')]['limit']);_0x2c0aec[_0xdee1('0x18')]=qs['offset'](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x18')]);}_0x2c0aec[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x35')]);_0x2c0aec[_0xdee1('0x36')]=qs[_0xdee1('0x2c')](_['pick'](_0x1e49ab[_0xdee1('0x30')],_0x301caa[_0xdee1('0x2c')]),_0x388b8f);if(_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x37')]){_0x2c0aec[_0xdee1('0x36')]=_[_0xdee1('0x38')](_0x2c0aec[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0x388b8f,function(_0x2cea6e){if(_0x2cea6e[_0xdee1('0x29')]!==_0xdee1('0x39')){var _0x205dc5={};_0x205dc5[_0x2cea6e[_0xdee1('0x23')]]={'$like':'%'+_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0x205dc5;}})});}_0x2c0aec=_[_0xdee1('0x38')]({},_0x2c0aec,_0x1e49ab[_0xdee1('0x3a')]);var _0x2f2d60={'where':_0x2c0aec[_0xdee1('0x36')]};return db[_0xdee1('0x27')][_0xdee1('0x1b')](_0x2f2d60)[_0xdee1('0x1f')](function(_0x249d01){_0x4cca10[_0xdee1('0x1b')]=_0x249d01;if(_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x3b')]){_0x2c0aec[_0xdee1('0x3c')]=[{'all':!![]}];}return db[_0xdee1('0x27')][_0xdee1('0x3d')](_0x2c0aec);})[_0xdee1('0x1f')](function(_0x1d7e3d){_0x4cca10[_0xdee1('0x3e')]=_0x1d7e3d;return _0x4cca10;})[_0xdee1('0x1f')](respondWithFilteredResult(_0x23bbd2,_0x2c0aec))['catch'](handleError(_0x23bbd2,null));};exports['show']=function(_0x47bd93,_0x299754){var _0x164bbc={'raw':![],'where':{'id':_0x47bd93[_0xdee1('0x3f')]['id']}},_0x4cece6={};_0x4cece6['model']=_[_0xdee1('0x2b')](db[_0xdee1('0x27')][_0xdee1('0x28')]);_0x4cece6[_0xdee1('0x30')]=_['keys'](_0x47bd93[_0xdee1('0x30')]);_0x4cece6[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x4cece6[_0xdee1('0x2a')],_0x4cece6[_0xdee1('0x30')]);_0x164bbc[_0xdee1('0x2e')]=_['intersection'](_0x4cece6[_0xdee1('0x2a')],qs[_0xdee1('0x2f')](_0x47bd93[_0xdee1('0x30')]['fields']));_0x164bbc[_0xdee1('0x2e')]=_0x164bbc[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x164bbc['attributes']:_0x4cece6[_0xdee1('0x2a')];if(_0x47bd93['query']['includeAll']){_0x164bbc[_0xdee1('0x3c')]=[{'all':!![]}];}_0x164bbc=_[_0xdee1('0x38')]({},_0x164bbc,_0x47bd93[_0xdee1('0x3a')]);return db[_0xdee1('0x27')][_0xdee1('0x40')](_0x164bbc)[_0xdee1('0x1f')](handleEntityNotFound(_0x299754,null))[_0xdee1('0x1f')](respondWithResult(_0x299754,null))[_0xdee1('0x41')](handleError(_0x299754,null));};exports[_0xdee1('0x42')]=function(_0x576b16,_0x587c0a){return db[_0xdee1('0x27')]['create'](_0x576b16['body'],{})[_0xdee1('0x1f')](respondWithResult(_0x587c0a,0xc9))['catch'](handleError(_0x587c0a,null));};exports[_0xdee1('0x43')]=function(_0x7dc9ad,_0x3c8500){if(_0x7dc9ad[_0xdee1('0x44')]['id']){delete _0x7dc9ad[_0xdee1('0x44')]['id'];}return db[_0xdee1('0x27')]['find']({'where':{'id':_0x7dc9ad[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x3c8500,null))[_0xdee1('0x1f')](saveUpdates(_0x7dc9ad[_0xdee1('0x44')],null))['then'](respondWithResult(_0x3c8500,null))['catch'](handleError(_0x3c8500,null));};exports[_0xdee1('0x20')]=function(_0x3ddd8c,_0x437b2a){return db['FreshsalesConfiguration'][_0xdee1('0x40')]({'where':{'id':_0x3ddd8c[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x437b2a,null))[_0xdee1('0x1f')](removeEntity(_0x437b2a,null))[_0xdee1('0x41')](handleError(_0x437b2a,null));};exports[_0xdee1('0x45')]=function(_0x3c2792,_0x249356,_0x2d6f7a){var _0x1398e3={};var _0x205da2={};var _0x59c6b8;var _0x3f7de3;return db['FreshsalesConfiguration'][_0xdee1('0x46')]({'where':{'id':_0x3c2792[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x249356,null))[_0xdee1('0x1f')](function(_0x3d85f4){if(_0x3d85f4){_0x59c6b8=_0x3d85f4;_0x205da2[_0xdee1('0x2a')]=_[_0xdee1('0x2b')](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x205da2[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x3c2792[_0xdee1('0x30')]);_0x205da2['filters']=_[_0xdee1('0x2d')](_0x205da2[_0xdee1('0x2a')],_0x205da2[_0xdee1('0x30')]);_0x1398e3[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x205da2[_0xdee1('0x2a')],qs['fields'](_0x3c2792['query'][_0xdee1('0x2f')]));_0x1398e3[_0xdee1('0x2e')]=_0x1398e3[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x1398e3[_0xdee1('0x2e')]:_0x205da2[_0xdee1('0x2a')];_0x1398e3[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x3c2792['query'][_0xdee1('0x35')]);_0x1398e3[_0xdee1('0x36')]=qs[_0xdee1('0x2c')](_['pick'](_0x3c2792[_0xdee1('0x30')],_0x205da2[_0xdee1('0x2c')]));if(_0x3c2792[_0xdee1('0x30')][_0xdee1('0x37')]){_0x1398e3['where']=_['merge'](_0x1398e3[_0xdee1('0x36')],{'$or':_['map'](_0x1398e3[_0xdee1('0x2e')],function(_0x2956d4){var _0x458914={};_0x458914[_0x2956d4]={'$like':'%'+_0x3c2792['query'][_0xdee1('0x37')]+'%'};return _0x458914;})});}_0x1398e3=_[_0xdee1('0x38')]({},_0x1398e3,_0x3c2792['options']);return _0x59c6b8['getSubjects'](_0x1398e3);}})['then'](function(_0xa30a05){if(_0xa30a05){_0x3f7de3=_0xa30a05[_0xdee1('0x31')];if(!_0x3c2792[_0xdee1('0x30')][_0xdee1('0x32')](_0xdee1('0x33'))){_0x1398e3[_0xdee1('0x19')]=qs[_0xdee1('0x19')](_0x3c2792[_0xdee1('0x30')][_0xdee1('0x19')]);_0x1398e3[_0xdee1('0x18')]=qs['offset'](_0x3c2792[_0xdee1('0x30')]['offset']);}return _0x59c6b8[_0xdee1('0x45')](_0x1398e3);}})[_0xdee1('0x1f')](function(_0x57c4d){if(_0x57c4d){return _0x57c4d?{'count':_0x3f7de3,'rows':_0x57c4d}:null;}})['then'](respondWithResult(_0x249356,null))['catch'](handleError(_0x249356,null));};exports[_0xdee1('0x48')]=function(_0x2bdf17,_0x5abe12,_0x2749fd){var _0xa45bda={};var _0x4e0825={};var _0x4079b7;var _0x51ec91;return db[_0xdee1('0x27')][_0xdee1('0x46')]({'where':{'id':_0x2bdf17[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x5abe12,null))[_0xdee1('0x1f')](function(_0xbd2d01){if(_0xbd2d01){_0x4079b7=_0xbd2d01;_0x4e0825[_0xdee1('0x2a')]=_['keys'](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x4e0825[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x2bdf17[_0xdee1('0x30')]);_0x4e0825[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x4e0825['model'],_0x4e0825[_0xdee1('0x30')]);_0xa45bda[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x4e0825[_0xdee1('0x2a')],qs['fields'](_0x2bdf17['query'][_0xdee1('0x2f')]));_0xa45bda[_0xdee1('0x2e')]=_0xa45bda[_0xdee1('0x2e')][_0xdee1('0x31')]?_0xa45bda[_0xdee1('0x2e')]:_0x4e0825[_0xdee1('0x2a')];_0xa45bda['order']=qs[_0xdee1('0x35')](_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x35')]);_0xa45bda['where']=qs['filters'](_[_0xdee1('0x49')](_0x2bdf17[_0xdee1('0x30')],_0x4e0825['filters']));if(_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x37')]){_0xa45bda['where']=_[_0xdee1('0x38')](_0xa45bda[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0xa45bda[_0xdee1('0x2e')],function(_0xc9474e){var _0xdf9508={};_0xdf9508[_0xc9474e]={'$like':'%'+_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0xdf9508;})});}_0xa45bda=_[_0xdee1('0x38')]({},_0xa45bda,_0x2bdf17[_0xdee1('0x3a')]);return _0x4079b7['getDescriptions'](_0xa45bda);}})['then'](function(_0x2452a0){if(_0x2452a0){_0x51ec91=_0x2452a0['length'];if(!_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x32')](_0xdee1('0x33'))){_0xa45bda[_0xdee1('0x19')]=qs['limit'](_0x2bdf17[_0xdee1('0x30')]['limit']);_0xa45bda[_0xdee1('0x18')]=qs[_0xdee1('0x18')](_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x18')]);}return _0x4079b7['getDescriptions'](_0xa45bda);}})[_0xdee1('0x1f')](function(_0xba420a){if(_0xba420a){return _0xba420a?{'count':_0x51ec91,'rows':_0xba420a}:null;}})[_0xdee1('0x1f')](respondWithResult(_0x5abe12,null))[_0xdee1('0x41')](handleError(_0x5abe12,null));};exports['getFields']=function(_0x1c8202,_0x1853f9,_0x18654f){var _0x33572c={};var _0x143ed7={};var _0x927838;var _0x451ee6;return db[_0xdee1('0x27')]['findOne']({'where':{'id':_0x1c8202[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x1853f9,null))[_0xdee1('0x1f')](function(_0x1b26f5){if(_0x1b26f5){_0x927838=_0x1b26f5;_0x143ed7[_0xdee1('0x2a')]=_[_0xdee1('0x2b')](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x143ed7[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x1c8202[_0xdee1('0x30')]);_0x143ed7[_0xdee1('0x2c')]=_['intersection'](_0x143ed7[_0xdee1('0x2a')],_0x143ed7['query']);_0x33572c[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x143ed7[_0xdee1('0x2a')],qs[_0xdee1('0x2f')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x2f')]));_0x33572c['attributes']=_0x33572c[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x33572c[_0xdee1('0x2e')]:_0x143ed7[_0xdee1('0x2a')];_0x33572c[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x1c8202[_0xdee1('0x30')]['sort']);_0x33572c['where']=qs[_0xdee1('0x2c')](_[_0xdee1('0x49')](_0x1c8202[_0xdee1('0x30')],_0x143ed7[_0xdee1('0x2c')]));if(_0x1c8202[_0xdee1('0x30')]['filter']){_0x33572c[_0xdee1('0x36')]=_[_0xdee1('0x38')](_0x33572c[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0x33572c['attributes'],function(_0x3e376c){var _0x1bc6f4={};_0x1bc6f4[_0x3e376c]={'$like':'%'+_0x1c8202[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0x1bc6f4;})});}_0x33572c=_[_0xdee1('0x38')]({},_0x33572c,_0x1c8202[_0xdee1('0x3a')]);return _0x927838[_0xdee1('0x4a')](_0x33572c);}})[_0xdee1('0x1f')](function(_0x2e18fb){if(_0x2e18fb){_0x451ee6=_0x2e18fb[_0xdee1('0x31')];if(!_0x1c8202[_0xdee1('0x30')]['hasOwnProperty'](_0xdee1('0x33'))){_0x33572c['limit']=qs[_0xdee1('0x19')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x19')]);_0x33572c[_0xdee1('0x18')]=qs[_0xdee1('0x18')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x18')]);}return _0x927838[_0xdee1('0x4a')](_0x33572c);}})[_0xdee1('0x1f')](function(_0x5900a0){if(_0x5900a0){return _0x5900a0?{'count':_0x451ee6,'rows':_0x5900a0}:null;}})['then'](respondWithResult(_0x1853f9,null))['catch'](handleError(_0x1853f9,null));}; \ No newline at end of file +var _0x80ce=['reject','save','then','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','fields','find','create','body','update','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x29deda,_0x38ea10){var _0x4ac98b=function(_0x28c446){while(--_0x28c446){_0x29deda['push'](_0x29deda['shift']());}};_0x4ac98b(++_0x38ea10);}(_0x80ce,0x7d));var _0xe80c=function(_0xc506f3,_0x516e60){_0xc506f3=_0xc506f3-0x0;var _0x446d50=_0x80ce[_0xc506f3];return _0x446d50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe80c('0x0'));var rp=require(_0xe80c('0x1'));var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require(_0xe80c('0x5'));var path=require(_0xe80c('0x6'));var sox=require(_0xe80c('0x7'));var csv=require(_0xe80c('0x8'));var ejs=require(_0xe80c('0x9'));var fs=require('fs');var fs_extra=require(_0xe80c('0xa'));var _=require(_0xe80c('0xb'));var squel=require(_0xe80c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0xd'));var toCsv=require(_0xe80c('0x8'));var querystring=require('querystring');var Papa=require(_0xe80c('0xe'));var Redis=require(_0xe80c('0xf'));var authService=require(_0xe80c('0x10'));var qs=require(_0xe80c('0x11'));var as=require(_0xe80c('0x12'));var hardwareService=require(_0xe80c('0x13'));var logger=require('../../config/logger')(_0xe80c('0x14'));var utils=require(_0xe80c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3b13,_0x38cede){_0x38cede=_0x38cede||0xcc;return function(_0x1f8ea2){if(_0x1f8ea2){return _0x4d3b13[_0xe80c('0x16')](_0x38cede);}return _0x4d3b13[_0xe80c('0x17')](_0x38cede)[_0xe80c('0x18')]();};}function respondWithResult(_0x3c707e,_0x3ea41f){_0x3ea41f=_0x3ea41f||0xc8;return function(_0x3e25dd){if(_0x3e25dd){return _0x3c707e['status'](_0x3ea41f)[_0xe80c('0x19')](_0x3e25dd);}};}function respondWithFilteredResult(_0x2a2f9c,_0x4e9612){return function(_0x277f91){if(_0x277f91){var _0x53b0cb=typeof _0x4e9612[_0xe80c('0x1a')]===_0xe80c('0x1b')&&typeof _0x4e9612[_0xe80c('0x1c')]==='undefined';var _0x3e28d4=_0x277f91['count'];var _0x373d4a=_0x53b0cb?0x0:_0x4e9612['offset'];var _0x2a9bd0=_0x53b0cb?_0x277f91[_0xe80c('0x1d')]:_0x4e9612[_0xe80c('0x1a')]+_0x4e9612[_0xe80c('0x1c')];var _0x40617a;if(_0x2a9bd0>=_0x3e28d4){_0x2a9bd0=_0x3e28d4;_0x40617a=0xc8;}else{_0x40617a=0xce;}_0x2a2f9c[_0xe80c('0x17')](_0x40617a);return _0x2a2f9c[_0xe80c('0x1e')](_0xe80c('0x1f'),_0x373d4a+'-'+_0x2a9bd0+'/'+_0x3e28d4)[_0xe80c('0x19')](_0x277f91);}return null;};}function patchUpdates(_0x5903ac){return function(_0x4f5ff5){try{jsonpatch[_0xe80c('0x20')](_0x4f5ff5,_0x5903ac,!![]);}catch(_0x1aff0e){return BPromise[_0xe80c('0x21')](_0x1aff0e);}return _0x4f5ff5[_0xe80c('0x22')]();};}function saveUpdates(_0x24b63c,_0x31db11){return function(_0x97d405){if(_0x97d405){return _0x97d405['update'](_0x24b63c)[_0xe80c('0x23')](function(_0x3e8246){return _0x3e8246;});}return null;};}function removeEntity(_0x35b15d,_0x36411e){return function(_0x43e4a6){if(_0x43e4a6){return _0x43e4a6[_0xe80c('0x24')]()[_0xe80c('0x23')](function(){_0x35b15d[_0xe80c('0x17')](0xcc)[_0xe80c('0x18')]();});}};}function handleEntityNotFound(_0x31ac93,_0x2294d2){return function(_0x6fc16e){if(!_0x6fc16e){_0x31ac93[_0xe80c('0x16')](0x194);}return _0x6fc16e;};}function handleError(_0x303fdc,_0x270f0a){_0x270f0a=_0x270f0a||0x1f4;return function(_0x56ccf4){logger['error'](_0x56ccf4['stack']);if(_0x56ccf4[_0xe80c('0x25')]){delete _0x56ccf4['name'];}_0x303fdc[_0xe80c('0x17')](_0x270f0a)[_0xe80c('0x26')](_0x56ccf4);};}exports[_0xe80c('0x27')]=function(_0x286fc0,_0x68b8db){var _0xca0868={},_0x488186={},_0x342665={'count':0x0,'rows':[]};var _0x14d4f6=_[_0xe80c('0x28')](db[_0xe80c('0x29')][_0xe80c('0x2a')],function(_0x1635ba){return{'name':_0x1635ba[_0xe80c('0x2b')],'type':_0x1635ba[_0xe80c('0x2c')][_0xe80c('0x2d')]};});_0x488186['model']=_[_0xe80c('0x28')](_0x14d4f6,_0xe80c('0x25'));_0x488186[_0xe80c('0x2e')]=_['keys'](_0x286fc0[_0xe80c('0x2e')]);_0x488186[_0xe80c('0x2f')]=_['intersection'](_0x488186['model'],_0x488186[_0xe80c('0x2e')]);_0xca0868[_0xe80c('0x30')]=_[_0xe80c('0x31')](_0x488186[_0xe80c('0x32')],qs['fields'](_0x286fc0[_0xe80c('0x2e')]['fields']));_0xca0868[_0xe80c('0x30')]=_0xca0868[_0xe80c('0x30')][_0xe80c('0x33')]?_0xca0868[_0xe80c('0x30')]:_0x488186['model'];if(!_0x286fc0[_0xe80c('0x2e')][_0xe80c('0x34')](_0xe80c('0x35'))){_0xca0868['limit']=qs[_0xe80c('0x1c')](_0x286fc0[_0xe80c('0x2e')][_0xe80c('0x1c')]);_0xca0868[_0xe80c('0x1a')]=qs['offset'](_0x286fc0[_0xe80c('0x2e')][_0xe80c('0x1a')]);}_0xca0868[_0xe80c('0x36')]=qs[_0xe80c('0x37')](_0x286fc0[_0xe80c('0x2e')]['sort']);_0xca0868['where']=qs['filters'](_['pick'](_0x286fc0[_0xe80c('0x2e')],_0x488186[_0xe80c('0x2f')]),_0x14d4f6);if(_0x286fc0[_0xe80c('0x2e')]['filter']){_0xca0868['where']=_[_0xe80c('0x38')](_0xca0868[_0xe80c('0x39')],{'$or':_[_0xe80c('0x28')](_0x14d4f6,function(_0xd09abb){if(_0xd09abb[_0xe80c('0x2c')]!==_0xe80c('0x3a')){var _0x557538={};_0x557538[_0xd09abb[_0xe80c('0x25')]]={'$like':'%'+_0x286fc0[_0xe80c('0x2e')][_0xe80c('0x3b')]+'%'};return _0x557538;}})});}_0xca0868=_[_0xe80c('0x38')]({},_0xca0868,_0x286fc0[_0xe80c('0x3c')]);var _0x5abe23={'where':_0xca0868[_0xe80c('0x39')]};return db[_0xe80c('0x29')]['count'](_0x5abe23)[_0xe80c('0x23')](function(_0x3035e7){_0x342665[_0xe80c('0x1d')]=_0x3035e7;if(_0x286fc0[_0xe80c('0x2e')][_0xe80c('0x3d')]){_0xca0868[_0xe80c('0x3e')]=[{'all':!![]}];}return db[_0xe80c('0x29')][_0xe80c('0x3f')](_0xca0868);})[_0xe80c('0x23')](function(_0xc07e2e){_0x342665[_0xe80c('0x40')]=_0xc07e2e;return _0x342665;})[_0xe80c('0x23')](respondWithFilteredResult(_0x68b8db,_0xca0868))[_0xe80c('0x41')](handleError(_0x68b8db,null));};exports['show']=function(_0x3a895c,_0x8bf7a8){var _0x1ee6ce={'raw':![],'where':{'id':_0x3a895c['params']['id']}},_0x17a267={};_0x17a267[_0xe80c('0x32')]=_['keys'](db[_0xe80c('0x29')]['rawAttributes']);_0x17a267['query']=_[_0xe80c('0x42')](_0x3a895c['query']);_0x17a267[_0xe80c('0x2f')]=_[_0xe80c('0x31')](_0x17a267['model'],_0x17a267[_0xe80c('0x2e')]);_0x1ee6ce[_0xe80c('0x30')]=_[_0xe80c('0x31')](_0x17a267['model'],qs[_0xe80c('0x43')](_0x3a895c['query'][_0xe80c('0x43')]));_0x1ee6ce[_0xe80c('0x30')]=_0x1ee6ce[_0xe80c('0x30')][_0xe80c('0x33')]?_0x1ee6ce[_0xe80c('0x30')]:_0x17a267[_0xe80c('0x32')];if(_0x3a895c['query'][_0xe80c('0x3d')]){_0x1ee6ce['include']=[{'all':!![]}];}_0x1ee6ce=_[_0xe80c('0x38')]({},_0x1ee6ce,_0x3a895c['options']);return db[_0xe80c('0x29')][_0xe80c('0x44')](_0x1ee6ce)[_0xe80c('0x23')](handleEntityNotFound(_0x8bf7a8,null))[_0xe80c('0x23')](respondWithResult(_0x8bf7a8,null))[_0xe80c('0x41')](handleError(_0x8bf7a8,null));};exports['create']=function(_0xd8a3ed,_0x2e256d){return db[_0xe80c('0x29')][_0xe80c('0x45')](_0xd8a3ed[_0xe80c('0x46')],{})[_0xe80c('0x23')](respondWithResult(_0x2e256d,0xc9))[_0xe80c('0x41')](handleError(_0x2e256d,null));};exports[_0xe80c('0x47')]=function(_0x27061f,_0x2770c4){if(_0x27061f[_0xe80c('0x46')]['id']){delete _0x27061f['body']['id'];}return db['FreshsalesConfiguration'][_0xe80c('0x44')]({'where':{'id':_0x27061f[_0xe80c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2770c4,null))['then'](saveUpdates(_0x27061f[_0xe80c('0x46')],null))[_0xe80c('0x23')](respondWithResult(_0x2770c4,null))['catch'](handleError(_0x2770c4,null));};exports[_0xe80c('0x24')]=function(_0x347116,_0x5d3064){return db['FreshsalesConfiguration'][_0xe80c('0x44')]({'where':{'id':_0x347116['params']['id']}})['then'](handleEntityNotFound(_0x5d3064,null))[_0xe80c('0x23')](removeEntity(_0x5d3064,null))[_0xe80c('0x41')](handleError(_0x5d3064,null));};exports[_0xe80c('0x49')]=function(_0x19f67e,_0x1be5ff,_0x4578a6){var _0x2db197={};var _0x250442={};var _0x4cf3d3;var _0x50c212;return db[_0xe80c('0x29')][_0xe80c('0x4a')]({'where':{'id':_0x19f67e[_0xe80c('0x48')]['id']}})[_0xe80c('0x23')](handleEntityNotFound(_0x1be5ff,null))['then'](function(_0x478b52){if(_0x478b52){_0x4cf3d3=_0x478b52;_0x250442['model']=_[_0xe80c('0x42')](db[_0xe80c('0x4b')][_0xe80c('0x2a')]);_0x250442[_0xe80c('0x2e')]=_[_0xe80c('0x42')](_0x19f67e['query']);_0x250442[_0xe80c('0x2f')]=_['intersection'](_0x250442[_0xe80c('0x32')],_0x250442[_0xe80c('0x2e')]);_0x2db197[_0xe80c('0x30')]=_['intersection'](_0x250442[_0xe80c('0x32')],qs[_0xe80c('0x43')](_0x19f67e[_0xe80c('0x2e')][_0xe80c('0x43')]));_0x2db197['attributes']=_0x2db197[_0xe80c('0x30')][_0xe80c('0x33')]?_0x2db197[_0xe80c('0x30')]:_0x250442['model'];_0x2db197[_0xe80c('0x36')]=qs[_0xe80c('0x37')](_0x19f67e[_0xe80c('0x2e')][_0xe80c('0x37')]);_0x2db197['where']=qs['filters'](_[_0xe80c('0x4c')](_0x19f67e['query'],_0x250442[_0xe80c('0x2f')]));if(_0x19f67e[_0xe80c('0x2e')][_0xe80c('0x3b')]){_0x2db197['where']=_['merge'](_0x2db197[_0xe80c('0x39')],{'$or':_[_0xe80c('0x28')](_0x2db197[_0xe80c('0x30')],function(_0x3894ef){var _0x2c94e1={};_0x2c94e1[_0x3894ef]={'$like':'%'+_0x19f67e[_0xe80c('0x2e')]['filter']+'%'};return _0x2c94e1;})});}_0x2db197=_['merge']({},_0x2db197,_0x19f67e[_0xe80c('0x3c')]);return _0x4cf3d3[_0xe80c('0x49')](_0x2db197);}})['then'](function(_0x2acc03){if(_0x2acc03){_0x50c212=_0x2acc03[_0xe80c('0x33')];if(!_0x19f67e['query']['hasOwnProperty']('nolimit')){_0x2db197['limit']=qs[_0xe80c('0x1c')](_0x19f67e[_0xe80c('0x2e')][_0xe80c('0x1c')]);_0x2db197['offset']=qs[_0xe80c('0x1a')](_0x19f67e['query'][_0xe80c('0x1a')]);}return _0x4cf3d3[_0xe80c('0x49')](_0x2db197);}})[_0xe80c('0x23')](function(_0x37a0f1){if(_0x37a0f1){return _0x37a0f1?{'count':_0x50c212,'rows':_0x37a0f1}:null;}})['then'](respondWithResult(_0x1be5ff,null))[_0xe80c('0x41')](handleError(_0x1be5ff,null));};exports[_0xe80c('0x4d')]=function(_0x1044e5,_0x538b9a,_0x625a68){var _0x12e238={};var _0x531480={};var _0x3f429d;var _0x4f67a8;return db['FreshsalesConfiguration'][_0xe80c('0x4a')]({'where':{'id':_0x1044e5['params']['id']}})[_0xe80c('0x23')](handleEntityNotFound(_0x538b9a,null))[_0xe80c('0x23')](function(_0x12339f){if(_0x12339f){_0x3f429d=_0x12339f;_0x531480['model']=_['keys'](db[_0xe80c('0x4b')][_0xe80c('0x2a')]);_0x531480[_0xe80c('0x2e')]=_[_0xe80c('0x42')](_0x1044e5[_0xe80c('0x2e')]);_0x531480[_0xe80c('0x2f')]=_['intersection'](_0x531480[_0xe80c('0x32')],_0x531480['query']);_0x12e238['attributes']=_[_0xe80c('0x31')](_0x531480[_0xe80c('0x32')],qs['fields'](_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x43')]));_0x12e238['attributes']=_0x12e238[_0xe80c('0x30')][_0xe80c('0x33')]?_0x12e238['attributes']:_0x531480['model'];_0x12e238[_0xe80c('0x36')]=qs[_0xe80c('0x37')](_0x1044e5['query'][_0xe80c('0x37')]);_0x12e238[_0xe80c('0x39')]=qs[_0xe80c('0x2f')](_['pick'](_0x1044e5[_0xe80c('0x2e')],_0x531480[_0xe80c('0x2f')]));if(_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x3b')]){_0x12e238[_0xe80c('0x39')]=_[_0xe80c('0x38')](_0x12e238[_0xe80c('0x39')],{'$or':_[_0xe80c('0x28')](_0x12e238[_0xe80c('0x30')],function(_0x5ed004){var _0x2dd127={};_0x2dd127[_0x5ed004]={'$like':'%'+_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x3b')]+'%'};return _0x2dd127;})});}_0x12e238=_[_0xe80c('0x38')]({},_0x12e238,_0x1044e5[_0xe80c('0x3c')]);return _0x3f429d['getDescriptions'](_0x12e238);}})[_0xe80c('0x23')](function(_0x3efc54){if(_0x3efc54){_0x4f67a8=_0x3efc54['length'];if(!_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x34')]('nolimit')){_0x12e238[_0xe80c('0x1c')]=qs[_0xe80c('0x1c')](_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x1c')]);_0x12e238[_0xe80c('0x1a')]=qs[_0xe80c('0x1a')](_0x1044e5[_0xe80c('0x2e')][_0xe80c('0x1a')]);}return _0x3f429d['getDescriptions'](_0x12e238);}})[_0xe80c('0x23')](function(_0x1402fd){if(_0x1402fd){return _0x1402fd?{'count':_0x4f67a8,'rows':_0x1402fd}:null;}})[_0xe80c('0x23')](respondWithResult(_0x538b9a,null))[_0xe80c('0x41')](handleError(_0x538b9a,null));};exports['getFields']=function(_0x5b3006,_0x3d69cb,_0x27c656){var _0x55ed0f={};var _0x412362={};var _0x44f61a;var _0x5c7613;return db['FreshsalesConfiguration'][_0xe80c('0x4a')]({'where':{'id':_0x5b3006['params']['id']}})[_0xe80c('0x23')](handleEntityNotFound(_0x3d69cb,null))['then'](function(_0xf00980){if(_0xf00980){_0x44f61a=_0xf00980;_0x412362[_0xe80c('0x32')]=_[_0xe80c('0x42')](db[_0xe80c('0x4b')]['rawAttributes']);_0x412362['query']=_['keys'](_0x5b3006[_0xe80c('0x2e')]);_0x412362['filters']=_[_0xe80c('0x31')](_0x412362[_0xe80c('0x32')],_0x412362[_0xe80c('0x2e')]);_0x55ed0f[_0xe80c('0x30')]=_['intersection'](_0x412362[_0xe80c('0x32')],qs[_0xe80c('0x43')](_0x5b3006[_0xe80c('0x2e')][_0xe80c('0x43')]));_0x55ed0f[_0xe80c('0x30')]=_0x55ed0f[_0xe80c('0x30')][_0xe80c('0x33')]?_0x55ed0f[_0xe80c('0x30')]:_0x412362[_0xe80c('0x32')];_0x55ed0f[_0xe80c('0x36')]=qs[_0xe80c('0x37')](_0x5b3006[_0xe80c('0x2e')][_0xe80c('0x37')]);_0x55ed0f['where']=qs[_0xe80c('0x2f')](_[_0xe80c('0x4c')](_0x5b3006[_0xe80c('0x2e')],_0x412362[_0xe80c('0x2f')]));if(_0x5b3006['query'][_0xe80c('0x3b')]){_0x55ed0f['where']=_[_0xe80c('0x38')](_0x55ed0f[_0xe80c('0x39')],{'$or':_[_0xe80c('0x28')](_0x55ed0f[_0xe80c('0x30')],function(_0x4eb46f){var _0x448526={};_0x448526[_0x4eb46f]={'$like':'%'+_0x5b3006[_0xe80c('0x2e')][_0xe80c('0x3b')]+'%'};return _0x448526;})});}_0x55ed0f=_[_0xe80c('0x38')]({},_0x55ed0f,_0x5b3006[_0xe80c('0x3c')]);return _0x44f61a[_0xe80c('0x4e')](_0x55ed0f);}})[_0xe80c('0x23')](function(_0x386a62){if(_0x386a62){_0x5c7613=_0x386a62['length'];if(!_0x5b3006['query'][_0xe80c('0x34')](_0xe80c('0x35'))){_0x55ed0f[_0xe80c('0x1c')]=qs['limit'](_0x5b3006[_0xe80c('0x2e')]['limit']);_0x55ed0f['offset']=qs[_0xe80c('0x1a')](_0x5b3006[_0xe80c('0x2e')][_0xe80c('0x1a')]);}return _0x44f61a[_0xe80c('0x4e')](_0x55ed0f);}})[_0xe80c('0x23')](function(_0x29f4cd){if(_0x29f4cd){return _0x29f4cd?{'count':_0x5c7613,'rows':_0x29f4cd}:null;}})['then'](respondWithResult(_0x3d69cb,null))[_0xe80c('0x41')](handleError(_0x3d69cb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ef1f1d5..658eb91 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 _0xd485=['../../config/environment','exports','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd485,0x67));var _0x5d48=function(_0x334769,_0x18f042){_0x334769=_0x334769-0x0;var _0x2234ba=_0xd485[_0x334769];return _0x2234ba;};'use strict';var _=require(_0x5d48('0x0'));var util=require(_0x5d48('0x1'));var logger=require(_0x5d48('0x2'))(_0x5d48('0x3'));var moment=require(_0x5d48('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d48('0x5'));var rimraf=require(_0x5d48('0x6'));var config=require(_0x5d48('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5d48('0x8')]=function(_0x49e307,_0x4e46a0){return _0x49e307['define']('FreshsalesConfiguration',attributes,{'tableName':_0x5d48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c3a=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x9c3a,0xf3));var _0xa9c3=function(_0x4286fd,_0x328b02){_0x4286fd=_0x4286fd-0x0;var _0xaa53b1=_0x9c3a[_0x4286fd];return _0xaa53b1;};'use strict';var _=require(_0xa9c3('0x0'));var util=require(_0xa9c3('0x1'));var logger=require(_0xa9c3('0x2'))('api');var moment=require(_0xa9c3('0x3'));var BPromise=require(_0xa9c3('0x4'));var rp=require(_0xa9c3('0x5'));var fs=require('fs');var path=require(_0xa9c3('0x6'));var rimraf=require(_0xa9c3('0x7'));var config=require(_0xa9c3('0x8'));var attributes=require(_0xa9c3('0x9'));module[_0xa9c3('0xa')]=function(_0x1167e9,_0x4a3d3b){return _0x1167e9['define'](_0xa9c3('0xb'),attributes,{'tableName':_0xa9c3('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 ac58193..82ed325 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 _0x182a=['../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x182a,0x10c));var _0xa182=function(_0x1842a4,_0x11e06f){_0x1842a4=_0x1842a4-0x0;var _0x2fdb8f=_0x182a[_0x1842a4];return _0x2fdb8f;};'use strict';var _=require(_0xa182('0x0'));var util=require(_0xa182('0x1'));var moment=require(_0xa182('0x2'));var BPromise=require(_0xa182('0x3'));var rs=require(_0xa182('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa182('0x5'))['db'];var utils=require(_0xa182('0x6'));var logger=require('../../config/logger')(_0xa182('0x7'));var config=require(_0xa182('0x8'));var jayson=require(_0xa182('0x9'));var client=jayson[_0xa182('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5160e3,_0x520bfe,_0xa1d20b){return new BPromise(function(_0x517e17,_0x3bd659){return client[_0xa182('0xb')](_0x5160e3,_0xa1d20b)[_0xa182('0xc')](function(_0xeff1ca){logger[_0xa182('0xd')](_0xa182('0xe'),_0x520bfe,'request\x20sent');logger[_0xa182('0xf')](_0xa182('0x10'),_0x520bfe,_0xa182('0x11'),JSON[_0xa182('0x12')](_0xeff1ca));if(_0xeff1ca[_0xa182('0x13')]){if(_0xeff1ca['error'][_0xa182('0x14')]===0x1f4){logger[_0xa182('0x13')](_0xa182('0xe'),_0x520bfe,_0xeff1ca[_0xa182('0x13')]['message']);return _0x3bd659(_0xeff1ca['error'][_0xa182('0x15')]);}logger[_0xa182('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x520bfe,_0xeff1ca[_0xa182('0x13')]['message']);return _0x517e17(_0xeff1ca[_0xa182('0x13')][_0xa182('0x15')]);}else{logger[_0xa182('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x520bfe,_0xa182('0x11'));_0x517e17(_0xeff1ca['result'][_0xa182('0x15')]);}})[_0xa182('0x16')](function(_0x32bc08){logger[_0xa182('0x13')](_0xa182('0xe'),_0x520bfe,_0x32bc08);_0x3bd659(_0x32bc08);});});} \ No newline at end of file +var _0x2244=['../../config/logger','rpc','../../config/environment','jayson/promise','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59164c,_0x46bb55){var _0x35101b=function(_0x225789){while(--_0x225789){_0x59164c['push'](_0x59164c['shift']());}};_0x35101b(++_0x46bb55);}(_0x2244,0xb6));var _0x4224=function(_0xab67aa,_0x52e0ae){_0xab67aa=_0xab67aa-0x0;var _0x28a522=_0x2244[_0xab67aa];return _0x28a522;};'use strict';var _=require(_0x4224('0x0'));var util=require(_0x4224('0x1'));var moment=require(_0x4224('0x2'));var BPromise=require(_0x4224('0x3'));var rs=require(_0x4224('0x4'));var fs=require('fs');var Redis=require(_0x4224('0x5'));var db=require(_0x4224('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4224('0x7'))(_0x4224('0x8'));var config=require(_0x4224('0x9'));var jayson=require(_0x4224('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x509c53,_0x5b0592,_0x27d941){return new BPromise(function(_0x18150b,_0x814fdc){return client['request'](_0x509c53,_0x27d941)['then'](function(_0x24348c){logger[_0x4224('0xb')](_0x4224('0xc'),_0x5b0592,_0x4224('0xd'));logger[_0x4224('0xe')](_0x4224('0xf'),_0x5b0592,_0x4224('0xd'),JSON[_0x4224('0x10')](_0x24348c));if(_0x24348c['error']){if(_0x24348c['error'][_0x4224('0x11')]===0x1f4){logger['error'](_0x4224('0xc'),_0x5b0592,_0x24348c[_0x4224('0x12')]['message']);return _0x814fdc(_0x24348c[_0x4224('0x12')][_0x4224('0x13')]);}logger[_0x4224('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b0592,_0x24348c[_0x4224('0x12')][_0x4224('0x13')]);return _0x18150b(_0x24348c[_0x4224('0x12')][_0x4224('0x13')]);}else{logger['info'](_0x4224('0xc'),_0x5b0592,_0x4224('0xd'));_0x18150b(_0x24348c['result'][_0x4224('0x13')]);}})[_0x4224('0x14')](function(_0xce3201){logger[_0x4224('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b0592,_0xce3201);_0x814fdc(_0xce3201);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e94bebd..3a811bf 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 _0x946e=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','show','isAuthenticated','create','update','destroy','multer'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x946e,0x1d0));var _0xe946=function(_0x44cbef,_0x533a1a){_0x44cbef=_0x44cbef-0x0;var _0x196610=_0x946e[_0x44cbef];return _0x196610;};'use strict';var multer=require(_0xe946('0x0'));var util=require('util');var path=require(_0xe946('0x1'));var timeout=require('connect-timeout');var express=require(_0xe946('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe946('0x3'));var interaction=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var controller=require(_0xe946('0x6'));router[_0xe946('0x7')]('/',auth['isAuthenticated'](),controller[_0xe946('0x8')]);router[_0xe946('0x7')](_0xe946('0x9'),auth['isAuthenticated'](),controller[_0xe946('0xa')]);router['post']('/',auth[_0xe946('0xb')](),controller[_0xe946('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe946('0xd')]);router['delete']('/:id',auth[_0xe946('0xb')](),controller[_0xe946('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa62c=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x400566,_0x474083){var _0x40f3e8=function(_0x34c917){while(--_0x34c917){_0x400566['push'](_0x400566['shift']());}};_0x40f3e8(++_0x474083);}(_0xa62c,0x70));var _0xca62=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0xa62c[_0x45c262];return _0x4f2ba6;};'use strict';var multer=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var path=require(_0xca62('0x2'));var timeout=require(_0xca62('0x3'));var express=require(_0xca62('0x4'));var router=express[_0xca62('0x5')]();var fs_extra=require(_0xca62('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xca62('0x7'));var config=require(_0xca62('0x8'));var controller=require(_0xca62('0x9'));router[_0xca62('0xa')]('/',auth[_0xca62('0xb')](),controller[_0xca62('0xc')]);router[_0xca62('0xa')](_0xca62('0xd'),auth['isAuthenticated'](),controller[_0xca62('0xe')]);router[_0xca62('0xf')]('/',auth[_0xca62('0xb')](),controller['create']);router[_0xca62('0x10')](_0xca62('0xd'),auth[_0xca62('0xb')](),controller['update']);router[_0xca62('0x11')](_0xca62('0xd'),auth[_0xca62('0xb')](),controller[_0xca62('0x12')]);module[_0xca62('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 b181eef..3ca3fe1 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 _0x29bd=['exports','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x48d50f,_0x40be69){var _0x2ea859=function(_0x1e01b2){while(--_0x1e01b2){_0x48d50f['push'](_0x48d50f['shift']());}};_0x2ea859(++_0x40be69);}(_0x29bd,0x1c0));var _0xd29b=function(_0x5d286a,_0x306ac0){_0x5d286a=_0x5d286a-0x0;var _0x303e0d=_0x29bd[_0x5d286a];return _0x303e0d;};'use strict';var Sequelize=require('sequelize');module[_0xd29b('0x0')]={'type':{'type':Sequelize[_0xd29b('0x1')](_0xd29b('0x2'),_0xd29b('0x3'),'customVariable',_0xd29b('0x4'),_0xd29b('0x5')),'defaultValue':_0xd29b('0x2')},'content':{'type':Sequelize[_0xd29b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd29b('0x1')]('string',_0xd29b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd29b('0x6')]},'idField':{'type':Sequelize[_0xd29b('0x6')]},'nameField':{'type':Sequelize[_0xd29b('0x6')]},'customField':{'type':Sequelize[_0xd29b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd29b('0x6')]}}; \ No newline at end of file +var _0x2045=['customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x2b28d8,_0x25fb00){var _0x25cd1e=function(_0x4cfdbf){while(--_0x4cfdbf){_0x2b28d8['push'](_0x2b28d8['shift']());}};_0x25cd1e(++_0x25fb00);}(_0x2045,0xba));var _0x5204=function(_0x45b479,_0x3e6574){_0x45b479=_0x45b479-0x0;var _0x1c3cbe=_0x2045[_0x45b479];return _0x1c3cbe;};'use strict';var Sequelize=require(_0x5204('0x0'));module[_0x5204('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x5204('0x2'),_0x5204('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x5204('0x4')]},'key':{'type':Sequelize[_0x5204('0x4')]},'keyType':{'type':Sequelize[_0x5204('0x5')]('string','variable',_0x5204('0x3'))},'keyContent':{'type':Sequelize[_0x5204('0x4')]},'idField':{'type':Sequelize[_0x5204('0x4')]},'nameField':{'type':Sequelize[_0x5204('0x4')]},'customField':{'type':Sequelize[_0x5204('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5204('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 11cb41d..395953f 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 _0x737b=['bluebird','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','find','create','body','params','zip-dir'];(function(_0x14f495,_0x231ef3){var _0x42ecc7=function(_0x50becd){while(--_0x50becd){_0x14f495['push'](_0x14f495['shift']());}};_0x42ecc7(++_0x231ef3);}(_0x737b,0x197));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb737('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb737('0x1'));var Mustache=require('mustache');var util=require(_0xb737('0x2'));var path=require(_0xb737('0x3'));var sox=require(_0xb737('0x4'));var csv=require(_0xb737('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb737('0x6'));var crypto=require(_0xb737('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xb737('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb737('0x9'));var Papa=require('papaparse');var Redis=require(_0xb737('0xa'));var authService=require(_0xb737('0xb'));var qs=require(_0xb737('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb737('0xd'))(_0xb737('0xe'));var utils=require(_0xb737('0xf'));var config=require(_0xb737('0x10'));var licenseUtil=require(_0xb737('0x11'));var db=require(_0xb737('0x12'))['db'];function respondWithStatusCode(_0x542d47,_0x30bfe3){_0x30bfe3=_0x30bfe3||0xcc;return function(_0x536fc7){if(_0x536fc7){return _0x542d47[_0xb737('0x13')](_0x30bfe3);}return _0x542d47[_0xb737('0x14')](_0x30bfe3)[_0xb737('0x15')]();};}function respondWithResult(_0x17350f,_0x1d1c78){_0x1d1c78=_0x1d1c78||0xc8;return function(_0x1cbbc4){if(_0x1cbbc4){return _0x17350f['status'](_0x1d1c78)[_0xb737('0x16')](_0x1cbbc4);}};}function respondWithFilteredResult(_0x24d42b,_0x5ec6da){return function(_0x380d7d){if(_0x380d7d){var _0x335509=typeof _0x5ec6da[_0xb737('0x17')]===_0xb737('0x18')&&typeof _0x5ec6da[_0xb737('0x19')]===_0xb737('0x18');var _0x43f203=_0x380d7d[_0xb737('0x1a')];var _0x599bc4=_0x335509?0x0:_0x5ec6da['offset'];var _0x58659d=_0x335509?_0x380d7d[_0xb737('0x1a')]:_0x5ec6da[_0xb737('0x17')]+_0x5ec6da[_0xb737('0x19')];var _0x52e35f;if(_0x58659d>=_0x43f203){_0x58659d=_0x43f203;_0x52e35f=0xc8;}else{_0x52e35f=0xce;}_0x24d42b['status'](_0x52e35f);return _0x24d42b['set']('Content-Range',_0x599bc4+'-'+_0x58659d+'/'+_0x43f203)[_0xb737('0x16')](_0x380d7d);}return null;};}function patchUpdates(_0x582e08){return function(_0x1cb3da){try{jsonpatch[_0xb737('0x1b')](_0x1cb3da,_0x582e08,!![]);}catch(_0x4b75d8){return BPromise[_0xb737('0x1c')](_0x4b75d8);}return _0x1cb3da[_0xb737('0x1d')]();};}function saveUpdates(_0x26896a,_0x4c3e3f){return function(_0x41a5a4){if(_0x41a5a4){return _0x41a5a4[_0xb737('0x1e')](_0x26896a)[_0xb737('0x1f')](function(_0x1dbc8e){return _0x1dbc8e;});}return null;};}function removeEntity(_0x93fbcc,_0x226d31){return function(_0x3a8ad3){if(_0x3a8ad3){return _0x3a8ad3[_0xb737('0x20')]()[_0xb737('0x1f')](function(){_0x93fbcc[_0xb737('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bf64,_0x17a4fa){return function(_0x2d09a9){if(!_0x2d09a9){_0x19bf64[_0xb737('0x13')](0x194);}return _0x2d09a9;};}function handleError(_0x2630a0,_0x59ad64){_0x59ad64=_0x59ad64||0x1f4;return function(_0x3aa8f0){logger['error'](_0x3aa8f0[_0xb737('0x21')]);if(_0x3aa8f0[_0xb737('0x22')]){delete _0x3aa8f0[_0xb737('0x22')];}_0x2630a0[_0xb737('0x14')](_0x59ad64)[_0xb737('0x23')](_0x3aa8f0);};}exports[_0xb737('0x24')]=function(_0x203f81,_0x109494){var _0x499345={},_0x1a3de6={},_0x1b0a60={'count':0x0,'rows':[]};var _0x232612=_[_0xb737('0x25')](db[_0xb737('0x26')][_0xb737('0x27')],function(_0x44f5f6){return{'name':_0x44f5f6[_0xb737('0x28')],'type':_0x44f5f6['type'][_0xb737('0x29')]};});_0x1a3de6[_0xb737('0x2a')]=_[_0xb737('0x25')](_0x232612,_0xb737('0x22'));_0x1a3de6['query']=_[_0xb737('0x2b')](_0x203f81[_0xb737('0x2c')]);_0x1a3de6[_0xb737('0x2d')]=_[_0xb737('0x2e')](_0x1a3de6[_0xb737('0x2a')],_0x1a3de6[_0xb737('0x2c')]);_0x499345[_0xb737('0x2f')]=_[_0xb737('0x2e')](_0x1a3de6[_0xb737('0x2a')],qs[_0xb737('0x30')](_0x203f81[_0xb737('0x2c')]['fields']));_0x499345[_0xb737('0x2f')]=_0x499345[_0xb737('0x2f')][_0xb737('0x31')]?_0x499345['attributes']:_0x1a3de6[_0xb737('0x2a')];if(!_0x203f81[_0xb737('0x2c')][_0xb737('0x32')](_0xb737('0x33'))){_0x499345[_0xb737('0x19')]=qs[_0xb737('0x19')](_0x203f81['query'][_0xb737('0x19')]);_0x499345['offset']=qs[_0xb737('0x17')](_0x203f81[_0xb737('0x2c')][_0xb737('0x17')]);}_0x499345['order']=qs[_0xb737('0x34')](_0x203f81[_0xb737('0x2c')][_0xb737('0x34')]);_0x499345[_0xb737('0x35')]=qs[_0xb737('0x2d')](_[_0xb737('0x36')](_0x203f81[_0xb737('0x2c')],_0x1a3de6[_0xb737('0x2d')]),_0x232612);if(_0x203f81['query'][_0xb737('0x37')]){_0x499345[_0xb737('0x35')]=_[_0xb737('0x38')](_0x499345[_0xb737('0x35')],{'$or':_['map'](_0x232612,function(_0x2d1c02){if(_0x2d1c02[_0xb737('0x39')]!=='VIRTUAL'){var _0x3ec791={};_0x3ec791[_0x2d1c02['name']]={'$like':'%'+_0x203f81[_0xb737('0x2c')][_0xb737('0x37')]+'%'};return _0x3ec791;}})});}_0x499345=_[_0xb737('0x38')]({},_0x499345,_0x203f81[_0xb737('0x3a')]);var _0x37752f={'where':_0x499345['where']};return db['FreshsalesField'][_0xb737('0x1a')](_0x37752f)[_0xb737('0x1f')](function(_0x344d2b){_0x1b0a60[_0xb737('0x1a')]=_0x344d2b;if(_0x203f81[_0xb737('0x2c')]['includeAll']){_0x499345[_0xb737('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0xb737('0x3c')](_0x499345);})['then'](function(_0x4f6b41){_0x1b0a60[_0xb737('0x3d')]=_0x4f6b41;return _0x1b0a60;})[_0xb737('0x1f')](respondWithFilteredResult(_0x109494,_0x499345))[_0xb737('0x3e')](handleError(_0x109494,null));};exports[_0xb737('0x3f')]=function(_0x18d1c1,_0x5d30ee){var _0x233ba9={'raw':!![],'where':{'id':_0x18d1c1['params']['id']}},_0x4b098c={};_0x4b098c[_0xb737('0x2a')]=_['keys'](db[_0xb737('0x26')][_0xb737('0x27')]);_0x4b098c[_0xb737('0x2c')]=_[_0xb737('0x2b')](_0x18d1c1[_0xb737('0x2c')]);_0x4b098c[_0xb737('0x2d')]=_[_0xb737('0x2e')](_0x4b098c[_0xb737('0x2a')],_0x4b098c[_0xb737('0x2c')]);_0x233ba9[_0xb737('0x2f')]=_[_0xb737('0x2e')](_0x4b098c[_0xb737('0x2a')],qs[_0xb737('0x30')](_0x18d1c1[_0xb737('0x2c')][_0xb737('0x30')]));_0x233ba9[_0xb737('0x2f')]=_0x233ba9[_0xb737('0x2f')][_0xb737('0x31')]?_0x233ba9['attributes']:_0x4b098c[_0xb737('0x2a')];if(_0x18d1c1[_0xb737('0x2c')]['includeAll']){_0x233ba9[_0xb737('0x3b')]=[{'all':!![]}];}_0x233ba9=_['merge']({},_0x233ba9,_0x18d1c1[_0xb737('0x3a')]);return db[_0xb737('0x26')][_0xb737('0x40')](_0x233ba9)[_0xb737('0x1f')](handleEntityNotFound(_0x5d30ee,null))['then'](respondWithResult(_0x5d30ee,null))['catch'](handleError(_0x5d30ee,null));};exports[_0xb737('0x41')]=function(_0x3fce76,_0x256f7b){return db[_0xb737('0x26')][_0xb737('0x41')](_0x3fce76[_0xb737('0x42')],{})[_0xb737('0x1f')](respondWithResult(_0x256f7b,0xc9))['catch'](handleError(_0x256f7b,null));};exports[_0xb737('0x1e')]=function(_0x298e6f,_0x1bcd5c){if(_0x298e6f[_0xb737('0x42')]['id']){delete _0x298e6f['body']['id'];}return db[_0xb737('0x26')][_0xb737('0x40')]({'where':{'id':_0x298e6f[_0xb737('0x43')]['id']}})[_0xb737('0x1f')](handleEntityNotFound(_0x1bcd5c,null))[_0xb737('0x1f')](saveUpdates(_0x298e6f['body'],null))[_0xb737('0x1f')](respondWithResult(_0x1bcd5c,null))[_0xb737('0x3e')](handleError(_0x1bcd5c,null));};exports[_0xb737('0x20')]=function(_0x7bfb29,_0x310bd9){return db[_0xb737('0x26')]['find']({'where':{'id':_0x7bfb29[_0xb737('0x43')]['id']}})[_0xb737('0x1f')](handleEntityNotFound(_0x310bd9,null))['then'](removeEntity(_0x310bd9,null))['catch'](handleError(_0x310bd9,null));}; \ No newline at end of file +var _0x321f=['VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','limit','order','sort','where','pick','filter'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x321f,0x1c5));var _0xf321=function(_0x5baed9,_0x409757){_0x5baed9=_0x5baed9-0x0;var _0x43aad3=_0x321f[_0x5baed9];return _0x43aad3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf321('0x0'));var zipdir=require(_0xf321('0x1'));var jsonpatch=require(_0xf321('0x2'));var rp=require('request-promise');var moment=require(_0xf321('0x3'));var BPromise=require(_0xf321('0x4'));var Mustache=require(_0xf321('0x5'));var util=require(_0xf321('0x6'));var path=require('path');var sox=require(_0xf321('0x7'));var csv=require(_0xf321('0x8'));var ejs=require(_0xf321('0x9'));var fs=require('fs');var fs_extra=require(_0xf321('0xa'));var _=require(_0xf321('0xb'));var squel=require(_0xf321('0xc'));var crypto=require(_0xf321('0xd'));var jsforce=require(_0xf321('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf321('0x8'));var querystring=require(_0xf321('0xf'));var Papa=require(_0xf321('0x10'));var Redis=require(_0xf321('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf321('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf321('0x13'));var logger=require(_0xf321('0x14'))(_0xf321('0x15'));var utils=require('../../config/utils');var config=require(_0xf321('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf321('0x17'))['db'];function respondWithStatusCode(_0x113e96,_0x3ab1a1){_0x3ab1a1=_0x3ab1a1||0xcc;return function(_0x7d6ca){if(_0x7d6ca){return _0x113e96[_0xf321('0x18')](_0x3ab1a1);}return _0x113e96[_0xf321('0x19')](_0x3ab1a1)[_0xf321('0x1a')]();};}function respondWithResult(_0x9da6bb,_0x2cab7d){_0x2cab7d=_0x2cab7d||0xc8;return function(_0xf9b702){if(_0xf9b702){return _0x9da6bb[_0xf321('0x19')](_0x2cab7d)[_0xf321('0x1b')](_0xf9b702);}};}function respondWithFilteredResult(_0x36f7ad,_0x1b07ee){return function(_0x190729){if(_0x190729){var _0x3ad65a=typeof _0x1b07ee[_0xf321('0x1c')]===_0xf321('0x1d')&&typeof _0x1b07ee['limit']===_0xf321('0x1d');var _0x521641=_0x190729['count'];var _0x3f800f=_0x3ad65a?0x0:_0x1b07ee[_0xf321('0x1c')];var _0x1559e9=_0x3ad65a?_0x190729[_0xf321('0x1e')]:_0x1b07ee[_0xf321('0x1c')]+_0x1b07ee['limit'];var _0x522413;if(_0x1559e9>=_0x521641){_0x1559e9=_0x521641;_0x522413=0xc8;}else{_0x522413=0xce;}_0x36f7ad[_0xf321('0x19')](_0x522413);return _0x36f7ad['set'](_0xf321('0x1f'),_0x3f800f+'-'+_0x1559e9+'/'+_0x521641)[_0xf321('0x1b')](_0x190729);}return null;};}function patchUpdates(_0x55eeec){return function(_0x5af790){try{jsonpatch[_0xf321('0x20')](_0x5af790,_0x55eeec,!![]);}catch(_0x42c7ca){return BPromise[_0xf321('0x21')](_0x42c7ca);}return _0x5af790[_0xf321('0x22')]();};}function saveUpdates(_0x39a59c,_0x180c5f){return function(_0x5a7de1){if(_0x5a7de1){return _0x5a7de1['update'](_0x39a59c)[_0xf321('0x23')](function(_0x1f5fe0){return _0x1f5fe0;});}return null;};}function removeEntity(_0x4e6af2,_0x2a1b2e){return function(_0x8d7200){if(_0x8d7200){return _0x8d7200['destroy']()['then'](function(){_0x4e6af2[_0xf321('0x19')](0xcc)[_0xf321('0x1a')]();});}};}function handleEntityNotFound(_0xa600e7,_0x4be40d){return function(_0x1886fa){if(!_0x1886fa){_0xa600e7[_0xf321('0x18')](0x194);}return _0x1886fa;};}function handleError(_0x26ceb2,_0x4c43e6){_0x4c43e6=_0x4c43e6||0x1f4;return function(_0x4492be){logger[_0xf321('0x24')](_0x4492be[_0xf321('0x25')]);if(_0x4492be[_0xf321('0x26')]){delete _0x4492be[_0xf321('0x26')];}_0x26ceb2['status'](_0x4c43e6)['send'](_0x4492be);};}exports[_0xf321('0x27')]=function(_0x17696a,_0x33c1d2){var _0x5cee21={},_0x1f95ff={},_0x7792a9={'count':0x0,'rows':[]};var _0x102820=_[_0xf321('0x28')](db[_0xf321('0x29')][_0xf321('0x2a')],function(_0x2f954d){return{'name':_0x2f954d[_0xf321('0x2b')],'type':_0x2f954d[_0xf321('0x2c')][_0xf321('0x2d')]};});_0x1f95ff['model']=_[_0xf321('0x28')](_0x102820,_0xf321('0x26'));_0x1f95ff[_0xf321('0x2e')]=_['keys'](_0x17696a[_0xf321('0x2e')]);_0x1f95ff[_0xf321('0x2f')]=_['intersection'](_0x1f95ff[_0xf321('0x30')],_0x1f95ff[_0xf321('0x2e')]);_0x5cee21['attributes']=_['intersection'](_0x1f95ff[_0xf321('0x30')],qs['fields'](_0x17696a[_0xf321('0x2e')][_0xf321('0x31')]));_0x5cee21[_0xf321('0x32')]=_0x5cee21[_0xf321('0x32')][_0xf321('0x33')]?_0x5cee21[_0xf321('0x32')]:_0x1f95ff[_0xf321('0x30')];if(!_0x17696a[_0xf321('0x2e')]['hasOwnProperty']('nolimit')){_0x5cee21['limit']=qs[_0xf321('0x34')](_0x17696a['query'][_0xf321('0x34')]);_0x5cee21[_0xf321('0x1c')]=qs[_0xf321('0x1c')](_0x17696a[_0xf321('0x2e')][_0xf321('0x1c')]);}_0x5cee21[_0xf321('0x35')]=qs['sort'](_0x17696a['query'][_0xf321('0x36')]);_0x5cee21[_0xf321('0x37')]=qs[_0xf321('0x2f')](_[_0xf321('0x38')](_0x17696a[_0xf321('0x2e')],_0x1f95ff['filters']),_0x102820);if(_0x17696a[_0xf321('0x2e')][_0xf321('0x39')]){_0x5cee21[_0xf321('0x37')]=_['merge'](_0x5cee21[_0xf321('0x37')],{'$or':_[_0xf321('0x28')](_0x102820,function(_0x5b08d1){if(_0x5b08d1[_0xf321('0x2c')]!==_0xf321('0x3a')){var _0x4ca9c0={};_0x4ca9c0[_0x5b08d1[_0xf321('0x26')]]={'$like':'%'+_0x17696a['query']['filter']+'%'};return _0x4ca9c0;}})});}_0x5cee21=_[_0xf321('0x3b')]({},_0x5cee21,_0x17696a[_0xf321('0x3c')]);var _0x54ffe5={'where':_0x5cee21[_0xf321('0x37')]};return db[_0xf321('0x29')][_0xf321('0x1e')](_0x54ffe5)[_0xf321('0x23')](function(_0x3ac8a7){_0x7792a9[_0xf321('0x1e')]=_0x3ac8a7;if(_0x17696a[_0xf321('0x2e')][_0xf321('0x3d')]){_0x5cee21[_0xf321('0x3e')]=[{'all':!![]}];}return db[_0xf321('0x29')][_0xf321('0x3f')](_0x5cee21);})['then'](function(_0x371b77){_0x7792a9['rows']=_0x371b77;return _0x7792a9;})[_0xf321('0x23')](respondWithFilteredResult(_0x33c1d2,_0x5cee21))[_0xf321('0x40')](handleError(_0x33c1d2,null));};exports['show']=function(_0x3abef7,_0x57614b){var _0x461270={'raw':!![],'where':{'id':_0x3abef7[_0xf321('0x41')]['id']}},_0x17ec05={};_0x17ec05[_0xf321('0x30')]=_[_0xf321('0x42')](db[_0xf321('0x29')][_0xf321('0x2a')]);_0x17ec05[_0xf321('0x2e')]=_['keys'](_0x3abef7[_0xf321('0x2e')]);_0x17ec05[_0xf321('0x2f')]=_['intersection'](_0x17ec05['model'],_0x17ec05[_0xf321('0x2e')]);_0x461270[_0xf321('0x32')]=_[_0xf321('0x43')](_0x17ec05['model'],qs[_0xf321('0x31')](_0x3abef7[_0xf321('0x2e')][_0xf321('0x31')]));_0x461270[_0xf321('0x32')]=_0x461270[_0xf321('0x32')][_0xf321('0x33')]?_0x461270[_0xf321('0x32')]:_0x17ec05[_0xf321('0x30')];if(_0x3abef7['query'][_0xf321('0x3d')]){_0x461270[_0xf321('0x3e')]=[{'all':!![]}];}_0x461270=_['merge']({},_0x461270,_0x3abef7[_0xf321('0x3c')]);return db[_0xf321('0x29')][_0xf321('0x44')](_0x461270)[_0xf321('0x23')](handleEntityNotFound(_0x57614b,null))['then'](respondWithResult(_0x57614b,null))[_0xf321('0x40')](handleError(_0x57614b,null));};exports[_0xf321('0x45')]=function(_0x573933,_0x4a0c15){return db[_0xf321('0x29')][_0xf321('0x45')](_0x573933[_0xf321('0x46')],{})[_0xf321('0x23')](respondWithResult(_0x4a0c15,0xc9))[_0xf321('0x40')](handleError(_0x4a0c15,null));};exports[_0xf321('0x47')]=function(_0x4662d2,_0x2a9ee9){if(_0x4662d2[_0xf321('0x46')]['id']){delete _0x4662d2[_0xf321('0x46')]['id'];}return db[_0xf321('0x29')][_0xf321('0x44')]({'where':{'id':_0x4662d2[_0xf321('0x41')]['id']}})[_0xf321('0x23')](handleEntityNotFound(_0x2a9ee9,null))[_0xf321('0x23')](saveUpdates(_0x4662d2['body'],null))[_0xf321('0x23')](respondWithResult(_0x2a9ee9,null))['catch'](handleError(_0x2a9ee9,null));};exports[_0xf321('0x48')]=function(_0x8e7d5,_0x25909a){return db[_0xf321('0x29')][_0xf321('0x44')]({'where':{'id':_0x8e7d5[_0xf321('0x41')]['id']}})[_0xf321('0x23')](handleEntityNotFound(_0x25909a,null))[_0xf321('0x23')](removeEntity(_0x25909a,null))[_0xf321('0x40')](handleError(_0x25909a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c26aad8..c35445c 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 _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf2e3[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger'];(function(_0x3a5450,_0x4483b3){var _0x34ea28=function(_0x386366){while(--_0x386366){_0x3a5450['push'](_0x3a5450['shift']());}};_0x34ea28(++_0x4483b3);}(_0xd943,0x15d));var _0x3d94=function(_0x469c2e,_0x505de6){_0x469c2e=_0x469c2e-0x0;var _0x467184=_0xd943[_0x469c2e];return _0x467184;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('FreshsalesField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 136def8..d79f6fb 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x687b,0x14a));var _0xb687=function(_0x3509d8,_0x5074b5){_0x3509d8=_0x3509d8-0x0;var _0x4dcedb=_0x687b[_0x3509d8];return _0x4dcedb;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xd117,0x182));var _0x7d11=function(_0x3c5ad6,_0x47b7bf){_0x3c5ad6=_0x3c5ad6-0x0;var _0x3154f2=_0xd117[_0x3c5ad6];return _0x3154f2;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 6463bf5..4fc66e8 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4cb938,_0x550432){var _0x304870=function(_0x595998){while(--_0x595998){_0x4cb938['push'](_0x4cb938['shift']());}};_0x304870(++_0x550432);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2bfb06,_0x27317f){var _0x25ccd5=function(_0x1da8a7){while(--_0x1da8a7){_0x2bfb06['push'](_0x2bfb06['shift']());}};_0x25ccd5(++_0x27317f);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 9d9d0f9..538e207 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 _0x1c77=['ENUM','integrationTab','exports','STRING','username'];(function(_0x2ee26b,_0x2d74e){var _0x4d6ef2=function(_0x43a682){while(--_0x43a682){_0x2ee26b['push'](_0x2ee26b['shift']());}};_0x4d6ef2(++_0x2d74e);}(_0x1c77,0xed));var _0x71c7=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x1c77[_0x2e53e1];return _0x3a23de;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'name':{'type':Sequelize[_0x71c7('0x1')]},'description':{'type':Sequelize[_0x71c7('0x1')]},'username':{'type':Sequelize[_0x71c7('0x1')],'unique':_0x71c7('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x71c7('0x1')]},'clientId':{'type':Sequelize[_0x71c7('0x1')]},'clientSecret':{'type':Sequelize[_0x71c7('0x1')]},'securityToken':{'type':Sequelize[_0x71c7('0x1')]},'serverUrl':{'type':Sequelize[_0x71c7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x71c7('0x3')](_0x71c7('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x44c2=['integrationTab','sequelize','exports','STRING','username'];(function(_0x3e2480,_0x2eed70){var _0x652c0=function(_0xaae5d2){while(--_0xaae5d2){_0x3e2480['push'](_0x3e2480['shift']());}};_0x652c0(++_0x2eed70);}(_0x44c2,0x100));var _0x244c=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x44c2[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'name':{'type':Sequelize[_0x244c('0x2')]},'description':{'type':Sequelize[_0x244c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x244c('0x3')},'remoteUri':{'type':Sequelize[_0x244c('0x2')]},'password':{'type':Sequelize[_0x244c('0x2')]},'clientId':{'type':Sequelize[_0x244c('0x2')]},'clientSecret':{'type':Sequelize[_0x244c('0x2')]},'securityToken':{'type':Sequelize[_0x244c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x244c('0x4'),'newTab'),'defaultValue':_0x244c('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c8e87cd..2bcb211 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 _0xfdf9=['password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SalesforceAccount','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username'];(function(_0x9f021c,_0x59b485){var _0x3f6ca8=function(_0x2d9b17){while(--_0x2d9b17){_0x9f021c['push'](_0x9f021c['shift']());}};_0x3f6ca8(++_0x59b485);}(_0xfdf9,0x124));var _0x9fdf=function(_0x310781,_0x5bfe0b){_0x310781=_0x310781-0x0;var _0x23a7a6=_0xfdf9[_0x310781];return _0x23a7a6;};'use strict';var emlformat=require(_0x9fdf('0x0'));var rimraf=require(_0x9fdf('0x1'));var zipdir=require(_0x9fdf('0x2'));var jsonpatch=require(_0x9fdf('0x3'));var rp=require(_0x9fdf('0x4'));var moment=require(_0x9fdf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9fdf('0x6'));var util=require(_0x9fdf('0x7'));var path=require(_0x9fdf('0x8'));var sox=require('sox');var csv=require(_0x9fdf('0x9'));var ejs=require(_0x9fdf('0xa'));var fs=require('fs');var fs_extra=require(_0x9fdf('0xb'));var _=require(_0x9fdf('0xc'));var squel=require(_0x9fdf('0xd'));var crypto=require(_0x9fdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9fdf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9fdf('0x10'));var Papa=require(_0x9fdf('0x11'));var Redis=require(_0x9fdf('0x12'));var authService=require(_0x9fdf('0x13'));var qs=require(_0x9fdf('0x14'));var as=require(_0x9fdf('0x15'));var hardwareService=require(_0x9fdf('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9fdf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9fdf('0x18'));var db=require(_0x9fdf('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56278d,_0x3c5d21){_0x3c5d21=_0x3c5d21||0xcc;return function(_0x5649b2){if(_0x5649b2){return _0x56278d[_0x9fdf('0x1a')](_0x3c5d21);}return _0x56278d['status'](_0x3c5d21)[_0x9fdf('0x1b')]();};}function respondWithResult(_0x28f680,_0x3d85e7){_0x3d85e7=_0x3d85e7||0xc8;return function(_0x1ad4ba){if(_0x1ad4ba){return _0x28f680['status'](_0x3d85e7)[_0x9fdf('0x1c')](_0x1ad4ba);}};}function respondWithFilteredResult(_0x40a321,_0x4b5c82){return function(_0x5c06ec){if(_0x5c06ec){var _0x450db0=typeof _0x4b5c82[_0x9fdf('0x1d')]==='undefined'&&typeof _0x4b5c82[_0x9fdf('0x1e')]===_0x9fdf('0x1f');var _0x296bdb=_0x5c06ec['count'];var _0x2bd21a=_0x450db0?0x0:_0x4b5c82['offset'];var _0x3a2a75=_0x450db0?_0x5c06ec[_0x9fdf('0x20')]:_0x4b5c82[_0x9fdf('0x1d')]+_0x4b5c82[_0x9fdf('0x1e')];var _0x57f7d9;if(_0x3a2a75>=_0x296bdb){_0x3a2a75=_0x296bdb;_0x57f7d9=0xc8;}else{_0x57f7d9=0xce;}_0x40a321[_0x9fdf('0x21')](_0x57f7d9);return _0x40a321[_0x9fdf('0x22')]('Content-Range',_0x2bd21a+'-'+_0x3a2a75+'/'+_0x296bdb)[_0x9fdf('0x1c')](_0x5c06ec);}return null;};}function patchUpdates(_0x31339c){return function(_0x4fbe7d){try{jsonpatch[_0x9fdf('0x23')](_0x4fbe7d,_0x31339c,!![]);}catch(_0x2e1828){return BPromise[_0x9fdf('0x24')](_0x2e1828);}return _0x4fbe7d[_0x9fdf('0x25')]();};}function saveUpdates(_0x13671d,_0x1b6be0){return function(_0x56b04b){if(_0x56b04b){return _0x56b04b['update'](_0x13671d)[_0x9fdf('0x26')](function(_0x4dff48){return _0x4dff48;});}return null;};}function removeEntity(_0x30d91c,_0x3d99aa){return function(_0x69d1d3){if(_0x69d1d3){return _0x69d1d3[_0x9fdf('0x27')]()[_0x9fdf('0x26')](function(){_0x30d91c[_0x9fdf('0x21')](0xcc)[_0x9fdf('0x1b')]();});}};}function handleEntityNotFound(_0x451125,_0x56972a){return function(_0x3a4602){if(!_0x3a4602){_0x451125[_0x9fdf('0x1a')](0x194);}return _0x3a4602;};}function handleError(_0x42e9ac,_0x3179a5){_0x3179a5=_0x3179a5||0x1f4;return function(_0x15193a){logger['error'](_0x15193a[_0x9fdf('0x28')]);if(_0x15193a[_0x9fdf('0x29')]){delete _0x15193a[_0x9fdf('0x29')];}_0x42e9ac[_0x9fdf('0x21')](_0x3179a5)['send'](_0x15193a);};}exports[_0x9fdf('0x2a')]=function(_0x751f3e,_0x31df16){var _0x34fe22={},_0x541bb5={},_0x50aa3a={'count':0x0,'rows':[]};var _0x264da7=_[_0x9fdf('0x2b')](db['SalesforceAccount'][_0x9fdf('0x2c')],function(_0x565b0e){return{'name':_0x565b0e[_0x9fdf('0x2d')],'type':_0x565b0e[_0x9fdf('0x2e')][_0x9fdf('0x2f')]};});_0x541bb5[_0x9fdf('0x30')]=_[_0x9fdf('0x2b')](_0x264da7,_0x9fdf('0x29'));_0x541bb5[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x751f3e[_0x9fdf('0x31')]);_0x541bb5[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x541bb5[_0x9fdf('0x30')],_0x541bb5['query']);_0x34fe22[_0x9fdf('0x35')]=_['intersection'](_0x541bb5[_0x9fdf('0x30')],qs['fields'](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x34fe22[_0x9fdf('0x35')]=_0x34fe22[_0x9fdf('0x35')][_0x9fdf('0x37')]?_0x34fe22['attributes']:_0x541bb5[_0x9fdf('0x30')];if(!_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x38')](_0x9fdf('0x39'))){_0x34fe22[_0x9fdf('0x1e')]=qs[_0x9fdf('0x1e')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x1e')]);_0x34fe22['offset']=qs[_0x9fdf('0x1d')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x1d')]);}_0x34fe22[_0x9fdf('0x3a')]=qs[_0x9fdf('0x3b')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x3b')]);_0x34fe22[_0x9fdf('0x3c')]=qs[_0x9fdf('0x33')](_[_0x9fdf('0x3d')](_0x751f3e[_0x9fdf('0x31')],_0x541bb5[_0x9fdf('0x33')]),_0x264da7);if(_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x3e')]){_0x34fe22[_0x9fdf('0x3c')]=_[_0x9fdf('0x3f')](_0x34fe22[_0x9fdf('0x3c')],{'$or':_[_0x9fdf('0x2b')](_0x264da7,function(_0x14464b){if(_0x14464b['type']!=='VIRTUAL'){var _0x1e38ea={};_0x1e38ea[_0x14464b[_0x9fdf('0x29')]]={'$like':'%'+_0x751f3e['query']['filter']+'%'};return _0x1e38ea;}})});}_0x34fe22=_[_0x9fdf('0x3f')]({},_0x34fe22,_0x751f3e['options']);var _0xb5cd1b={'where':_0x34fe22['where']};return db[_0x9fdf('0x40')][_0x9fdf('0x20')](_0xb5cd1b)[_0x9fdf('0x26')](function(_0x1732cc){_0x50aa3a['count']=_0x1732cc;if(_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x41')]){_0x34fe22['include']=[{'all':!![]}];}return db[_0x9fdf('0x40')][_0x9fdf('0x42')](_0x34fe22);})[_0x9fdf('0x26')](function(_0x3d9a30){_0x50aa3a[_0x9fdf('0x43')]=_0x3d9a30;return _0x50aa3a;})[_0x9fdf('0x26')](respondWithFilteredResult(_0x31df16,_0x34fe22))[_0x9fdf('0x44')](handleError(_0x31df16,null));};exports[_0x9fdf('0x45')]=function(_0x2f1238,_0x4ed267){var _0x375238={'raw':![],'where':{'id':_0x2f1238[_0x9fdf('0x46')]['id']}},_0x2eb0a7={};_0x2eb0a7['model']=_[_0x9fdf('0x32')](db[_0x9fdf('0x40')][_0x9fdf('0x2c')]);_0x2eb0a7[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x2f1238[_0x9fdf('0x31')]);_0x2eb0a7[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x2eb0a7[_0x9fdf('0x30')],_0x2eb0a7[_0x9fdf('0x31')]);_0x375238[_0x9fdf('0x35')]=_[_0x9fdf('0x34')](_0x2eb0a7[_0x9fdf('0x30')],qs[_0x9fdf('0x36')](_0x2f1238[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x375238[_0x9fdf('0x35')]=_0x375238[_0x9fdf('0x35')][_0x9fdf('0x37')]?_0x375238['attributes']:_0x2eb0a7[_0x9fdf('0x30')];if(_0x2f1238[_0x9fdf('0x31')]['includeAll']){_0x375238[_0x9fdf('0x47')]=[{'all':!![]}];}_0x375238=_[_0x9fdf('0x3f')]({},_0x375238,_0x2f1238[_0x9fdf('0x48')]);return db[_0x9fdf('0x40')][_0x9fdf('0x49')](_0x375238)['then'](handleEntityNotFound(_0x4ed267,null))[_0x9fdf('0x26')](respondWithResult(_0x4ed267,null))[_0x9fdf('0x44')](handleError(_0x4ed267,null));};exports[_0x9fdf('0x4a')]=function(_0x490065,_0x3abafb){return db[_0x9fdf('0x40')]['create'](_0x490065[_0x9fdf('0x4b')],{})['then'](respondWithResult(_0x3abafb,0xc9))[_0x9fdf('0x44')](handleError(_0x3abafb,null));};exports[_0x9fdf('0x4c')]=function(_0x54c83a,_0x51e509){if(_0x54c83a[_0x9fdf('0x4b')]['id']){delete _0x54c83a['body']['id'];}return db[_0x9fdf('0x40')][_0x9fdf('0x49')]({'where':{'id':_0x54c83a[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x51e509,null))[_0x9fdf('0x26')](saveUpdates(_0x54c83a[_0x9fdf('0x4b')],null))[_0x9fdf('0x26')](respondWithResult(_0x51e509,null))[_0x9fdf('0x44')](handleError(_0x51e509,null));};exports[_0x9fdf('0x27')]=function(_0x5c4ac2,_0x333a7a){return db[_0x9fdf('0x40')][_0x9fdf('0x49')]({'where':{'id':_0x5c4ac2[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x333a7a,null))['then'](removeEntity(_0x333a7a,null))[_0x9fdf('0x44')](handleError(_0x333a7a,null));};exports[_0x9fdf('0x4d')]=function(_0x2c673e,_0x42cdf8,_0x792f93){var _0x3698aa={};var _0x2e56b8={};var _0x138e13;var _0x495740;return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x2c673e[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x42cdf8,null))['then'](function(_0x212932){if(_0x212932){_0x138e13=_0x212932;_0x2e56b8[_0x9fdf('0x30')]=_[_0x9fdf('0x32')](db[_0x9fdf('0x4f')][_0x9fdf('0x2c')]);_0x2e56b8[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x2c673e['query']);_0x2e56b8[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x2e56b8[_0x9fdf('0x30')],_0x2e56b8['query']);_0x3698aa[_0x9fdf('0x35')]=_[_0x9fdf('0x34')](_0x2e56b8[_0x9fdf('0x30')],qs[_0x9fdf('0x36')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x3698aa[_0x9fdf('0x35')]=_0x3698aa[_0x9fdf('0x35')]['length']?_0x3698aa[_0x9fdf('0x35')]:_0x2e56b8[_0x9fdf('0x30')];_0x3698aa[_0x9fdf('0x3a')]=qs[_0x9fdf('0x3b')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3b')]);_0x3698aa[_0x9fdf('0x3c')]=qs[_0x9fdf('0x33')](_[_0x9fdf('0x3d')](_0x2c673e[_0x9fdf('0x31')],_0x2e56b8[_0x9fdf('0x33')]));if(_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3e')]){_0x3698aa[_0x9fdf('0x3c')]=_[_0x9fdf('0x3f')](_0x3698aa[_0x9fdf('0x3c')],{'$or':_[_0x9fdf('0x2b')](_0x3698aa[_0x9fdf('0x35')],function(_0x2c86b4){var _0xb755d3={};_0xb755d3[_0x2c86b4]={'$like':'%'+_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3e')]+'%'};return _0xb755d3;})});}_0x3698aa=_[_0x9fdf('0x3f')]({},_0x3698aa,_0x2c673e['options']);return _0x138e13['getConfigurations'](_0x3698aa);}})[_0x9fdf('0x26')](function(_0x2eae36){if(_0x2eae36){_0x495740=_0x2eae36[_0x9fdf('0x37')];if(!_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x38')](_0x9fdf('0x39'))){_0x3698aa[_0x9fdf('0x1e')]=qs[_0x9fdf('0x1e')](_0x2c673e[_0x9fdf('0x31')]['limit']);_0x3698aa['offset']=qs[_0x9fdf('0x1d')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x1d')]);}return _0x138e13['getConfigurations'](_0x3698aa);}})['then'](function(_0x43022a){if(_0x43022a){return _0x43022a?{'count':_0x495740,'rows':_0x43022a}:null;}})[_0x9fdf('0x26')](respondWithResult(_0x42cdf8,null))[_0x9fdf('0x44')](handleError(_0x42cdf8,null));};exports[_0x9fdf('0x50')]=function(_0x30f3de,_0x25b071,_0x515d2d){if(_0x30f3de['body']['id']){delete _0x30f3de[_0x9fdf('0x4b')]['id'];}return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x30f3de[_0x9fdf('0x46')]['id']}})['then'](handleEntityNotFound(_0x25b071,null))[_0x9fdf('0x26')](function(_0xb8cac3){if(_0xb8cac3){_0x30f3de[_0x9fdf('0x4b')]['AccountId']=_0xb8cac3['id'];_0x30f3de[_0x9fdf('0x4b')]['Subjects']=integrations['getSubjects'](_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x51')],_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x2e')]);_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x52')]=integrations[_0x9fdf('0x53')](_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x51')],_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x2e')]);return db['SalesforceConfiguration'][_0x9fdf('0x4a')](_0x30f3de['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x9fdf('0x54')],'as':_0x9fdf('0x52')}]});}return null;})[_0x9fdf('0x26')](respondWithResult(_0x25b071,null))[_0x9fdf('0x44')](handleError(_0x25b071,null));};exports[_0x9fdf('0x55')]=function(_0x11a946,_0x28905f,_0xa900fe){var _0x5acb3f;var _0x373436='';var _0x2e4e13=_0x9fdf('0x56');return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x11a946[_0x9fdf('0x46')]['id']},'attributes':['id','remoteUri','clientId',_0x9fdf('0x57'),_0x9fdf('0x58'),_0x9fdf('0x59'),_0x9fdf('0x5a')]})[_0x9fdf('0x26')](handleEntityNotFound(_0x28905f,null))['then'](function(_0x710189){if(_0x710189){_0x373436=_0x710189['remoteUri'];var _0x84f11=_0x373436[_0x9fdf('0x5b')](-0x1);if(_0x84f11==='/'){_0x373436=_0x373436[_0x9fdf('0x5c')](0x0,_0x373436[_0x9fdf('0x5d')](_0x84f11));}_0x5acb3f=new jsforce[(_0x9fdf('0x5e'))]({'oauth2':{'loginUrl':_0x373436,'clientId':_0x710189['clientId'],'clientSecret':_0x710189[_0x9fdf('0x57')]}});return _0x5acb3f[_0x9fdf('0x5f')](_0x710189[_0x9fdf('0x58')],_0x710189[_0x9fdf('0x59')][_0x9fdf('0x60')](_0x710189[_0x9fdf('0x5a')]));}})['then'](function(_0x41fb1a){if(_0x41fb1a){if(!_[_0x9fdf('0x61')](_0x11a946[_0x9fdf('0x31')][_0x9fdf('0x62')])){_0x2e4e13=_0x11a946[_0x9fdf('0x31')]['ticketType'];}return _0x5acb3f[_0x9fdf('0x63')](_0x2e4e13)[_0x9fdf('0x64')]();}})[_0x9fdf('0x26')](function(_0x19c17c){var _0x2bd62c=[_0x9fdf('0x65'),_0x9fdf('0x66'),_0x9fdf('0x67'),_0x9fdf('0x68'),_0x9fdf('0x69'),_0x9fdf('0x6a')];var _0x37ab4f=[_0x9fdf('0x6b'),'int',_0x9fdf('0x6c'),_0x9fdf('0x6d'),'email','textarea',_0x9fdf('0x6e')];if(_0x19c17c){_[_0x9fdf('0x6f')](_0x19c17c[_0x9fdf('0x36')],function(_0x32957e){return _0x2bd62c[_0x9fdf('0x70')](_0x32957e[_0x9fdf('0x29')])||!_0x37ab4f[_0x9fdf('0x70')](_0x32957e[_0x9fdf('0x2e')]);});return{'count':_0x19c17c[_0x9fdf('0x36')]['length'],'rows':_[_0x9fdf('0x2b')](_0x19c17c[_0x9fdf('0x36')],function(_0x10743a){return{'id':_0x10743a['name'],'name':_0x10743a[_0x9fdf('0x71')],'custom':_0x10743a[_0x9fdf('0x72')],'options':_0x10743a[_0x9fdf('0x73')][_0x9fdf('0x37')]>0x0?_['map'](_0x10743a['picklistValues'],function(_0x1712c8){return{'name':_0x1712c8[_0x9fdf('0x71')],'value':_0x1712c8[_0x9fdf('0x74')]};}):_0x10743a[_0x9fdf('0x2e')]==_0x9fdf('0x6d')?[{'name':'True','value':_0x9fdf('0x75')},{'name':_0x9fdf('0x76'),'value':_0x9fdf('0x77')}]:[]};})};}})[_0x9fdf('0x26')](respondWithResult(_0x28905f,null))[_0x9fdf('0x44')](function(_0x50295a){var _0xecc174=_0x11a946['query'][_0x9fdf('0x78')]?0x1f4:_0x50295a['statusCode']||0x1f4;logger[_0x9fdf('0x79')](_0x9fdf('0x7a'),_0x9fdf('0x55'),_0xecc174,JSON[_0x9fdf('0x7b')](_0x50295a));delete _0x50295a[_0x9fdf('0x29')];if(_0xecc174===0x191){_0xecc174=0x190;}_0x28905f[_0x9fdf('0x21')](_0xecc174)[_0x9fdf('0x7c')](_0x11a946[_0x9fdf('0x31')]['test']?{'message':_0x9fdf('0x7d'),'statusCode':_0x50295a[_0x9fdf('0x7e')]}:_0x50295a);});}; \ No newline at end of file +var _0x9a7b=['catch','keys','fields','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','Description','string','int','picklist','email','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x194748,_0x3ea342){var _0x5171d3=function(_0x3f0425){while(--_0x3f0425){_0x194748['push'](_0x194748['shift']());}};_0x5171d3(++_0x3ea342);}(_0x9a7b,0xbe));var _0xb9a7=function(_0x1e0af1,_0x3532f5){_0x1e0af1=_0x1e0af1-0x0;var _0x15404d=_0x9a7b[_0x1e0af1];return _0x15404d;};'use strict';var emlformat=require(_0xb9a7('0x0'));var rimraf=require(_0xb9a7('0x1'));var zipdir=require(_0xb9a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9a7('0x3'));var moment=require(_0xb9a7('0x4'));var BPromise=require(_0xb9a7('0x5'));var Mustache=require(_0xb9a7('0x6'));var util=require(_0xb9a7('0x7'));var path=require(_0xb9a7('0x8'));var sox=require(_0xb9a7('0x9'));var csv=require(_0xb9a7('0xa'));var ejs=require(_0xb9a7('0xb'));var fs=require('fs');var fs_extra=require(_0xb9a7('0xc'));var _=require(_0xb9a7('0xd'));var squel=require(_0xb9a7('0xe'));var crypto=require(_0xb9a7('0xf'));var jsforce=require(_0xb9a7('0x10'));var deskjs=require(_0xb9a7('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb9a7('0x12'));var Papa=require(_0xb9a7('0x13'));var Redis=require(_0xb9a7('0x14'));var authService=require(_0xb9a7('0x15'));var qs=require(_0xb9a7('0x16'));var as=require(_0xb9a7('0x17'));var hardwareService=require(_0xb9a7('0x18'));var logger=require(_0xb9a7('0x19'))(_0xb9a7('0x1a'));var utils=require(_0xb9a7('0x1b'));var config=require(_0xb9a7('0x1c'));var licenseUtil=require(_0xb9a7('0x1d'));var db=require(_0xb9a7('0x1e'))['db'];var integrations=require(_0xb9a7('0x1f'));function respondWithStatusCode(_0x23698b,_0xfb57c5){_0xfb57c5=_0xfb57c5||0xcc;return function(_0x177f65){if(_0x177f65){return _0x23698b['sendStatus'](_0xfb57c5);}return _0x23698b[_0xb9a7('0x20')](_0xfb57c5)[_0xb9a7('0x21')]();};}function respondWithResult(_0x363553,_0x596a46){_0x596a46=_0x596a46||0xc8;return function(_0x5260d6){if(_0x5260d6){return _0x363553['status'](_0x596a46)[_0xb9a7('0x22')](_0x5260d6);}};}function respondWithFilteredResult(_0x4a71fe,_0x154b02){return function(_0xd55aa0){if(_0xd55aa0){var _0x5bfb2c=typeof _0x154b02[_0xb9a7('0x23')]==='undefined'&&typeof _0x154b02[_0xb9a7('0x24')]===_0xb9a7('0x25');var _0x3495e3=_0xd55aa0[_0xb9a7('0x26')];var _0x121478=_0x5bfb2c?0x0:_0x154b02['offset'];var _0x385e2f=_0x5bfb2c?_0xd55aa0[_0xb9a7('0x26')]:_0x154b02[_0xb9a7('0x23')]+_0x154b02[_0xb9a7('0x24')];var _0x2d1346;if(_0x385e2f>=_0x3495e3){_0x385e2f=_0x3495e3;_0x2d1346=0xc8;}else{_0x2d1346=0xce;}_0x4a71fe[_0xb9a7('0x20')](_0x2d1346);return _0x4a71fe[_0xb9a7('0x27')](_0xb9a7('0x28'),_0x121478+'-'+_0x385e2f+'/'+_0x3495e3)['json'](_0xd55aa0);}return null;};}function patchUpdates(_0x65cede){return function(_0x43350e){try{jsonpatch[_0xb9a7('0x29')](_0x43350e,_0x65cede,!![]);}catch(_0x1eafac){return BPromise[_0xb9a7('0x2a')](_0x1eafac);}return _0x43350e[_0xb9a7('0x2b')]();};}function saveUpdates(_0x40cc60,_0x54dcb5){return function(_0x1f22e8){if(_0x1f22e8){return _0x1f22e8[_0xb9a7('0x2c')](_0x40cc60)[_0xb9a7('0x2d')](function(_0x417df4){return _0x417df4;});}return null;};}function removeEntity(_0x4447aa,_0x314191){return function(_0x39529f){if(_0x39529f){return _0x39529f['destroy']()[_0xb9a7('0x2d')](function(){_0x4447aa[_0xb9a7('0x20')](0xcc)[_0xb9a7('0x21')]();});}};}function handleEntityNotFound(_0x17fa4c,_0x340671){return function(_0x3d9465){if(!_0x3d9465){_0x17fa4c[_0xb9a7('0x2e')](0x194);}return _0x3d9465;};}function handleError(_0x1fac51,_0x4ad783){_0x4ad783=_0x4ad783||0x1f4;return function(_0x1a73af){logger[_0xb9a7('0x2f')](_0x1a73af[_0xb9a7('0x30')]);if(_0x1a73af[_0xb9a7('0x31')]){delete _0x1a73af[_0xb9a7('0x31')];}_0x1fac51[_0xb9a7('0x20')](_0x4ad783)[_0xb9a7('0x32')](_0x1a73af);};}exports[_0xb9a7('0x33')]=function(_0x160573,_0x7d1407){var _0x4219eb={},_0x131163={},_0x5ad60e={'count':0x0,'rows':[]};var _0x344862=_[_0xb9a7('0x34')](db[_0xb9a7('0x35')][_0xb9a7('0x36')],function(_0xd0a028){return{'name':_0xd0a028[_0xb9a7('0x37')],'type':_0xd0a028[_0xb9a7('0x38')][_0xb9a7('0x39')]};});_0x131163['model']=_[_0xb9a7('0x34')](_0x344862,_0xb9a7('0x31'));_0x131163[_0xb9a7('0x3a')]=_['keys'](_0x160573[_0xb9a7('0x3a')]);_0x131163[_0xb9a7('0x3b')]=_[_0xb9a7('0x3c')](_0x131163[_0xb9a7('0x3d')],_0x131163[_0xb9a7('0x3a')]);_0x4219eb['attributes']=_[_0xb9a7('0x3c')](_0x131163[_0xb9a7('0x3d')],qs['fields'](_0x160573[_0xb9a7('0x3a')]['fields']));_0x4219eb[_0xb9a7('0x3e')]=_0x4219eb['attributes'][_0xb9a7('0x3f')]?_0x4219eb[_0xb9a7('0x3e')]:_0x131163[_0xb9a7('0x3d')];if(!_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x40')](_0xb9a7('0x41'))){_0x4219eb[_0xb9a7('0x24')]=qs[_0xb9a7('0x24')](_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x24')]);_0x4219eb[_0xb9a7('0x23')]=qs[_0xb9a7('0x23')](_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x23')]);}_0x4219eb['order']=qs[_0xb9a7('0x42')](_0x160573['query']['sort']);_0x4219eb[_0xb9a7('0x43')]=qs[_0xb9a7('0x3b')](_[_0xb9a7('0x44')](_0x160573[_0xb9a7('0x3a')],_0x131163[_0xb9a7('0x3b')]),_0x344862);if(_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x45')]){_0x4219eb[_0xb9a7('0x43')]=_[_0xb9a7('0x46')](_0x4219eb[_0xb9a7('0x43')],{'$or':_['map'](_0x344862,function(_0x5a2da4){if(_0x5a2da4[_0xb9a7('0x38')]!==_0xb9a7('0x47')){var _0x3bf1d8={};_0x3bf1d8[_0x5a2da4[_0xb9a7('0x31')]]={'$like':'%'+_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x45')]+'%'};return _0x3bf1d8;}})});}_0x4219eb=_[_0xb9a7('0x46')]({},_0x4219eb,_0x160573[_0xb9a7('0x48')]);var _0x4cdb99={'where':_0x4219eb['where']};return db[_0xb9a7('0x35')][_0xb9a7('0x26')](_0x4cdb99)[_0xb9a7('0x2d')](function(_0x4f2879){_0x5ad60e['count']=_0x4f2879;if(_0x160573[_0xb9a7('0x3a')][_0xb9a7('0x49')]){_0x4219eb[_0xb9a7('0x4a')]=[{'all':!![]}];}return db[_0xb9a7('0x35')][_0xb9a7('0x4b')](_0x4219eb);})[_0xb9a7('0x2d')](function(_0x4a7703){_0x5ad60e['rows']=_0x4a7703;return _0x5ad60e;})[_0xb9a7('0x2d')](respondWithFilteredResult(_0x7d1407,_0x4219eb))[_0xb9a7('0x4c')](handleError(_0x7d1407,null));};exports['show']=function(_0x528117,_0x26a00b){var _0x207b5e={'raw':![],'where':{'id':_0x528117['params']['id']}},_0x491c50={};_0x491c50['model']=_[_0xb9a7('0x4d')](db[_0xb9a7('0x35')][_0xb9a7('0x36')]);_0x491c50[_0xb9a7('0x3a')]=_[_0xb9a7('0x4d')](_0x528117['query']);_0x491c50['filters']=_[_0xb9a7('0x3c')](_0x491c50[_0xb9a7('0x3d')],_0x491c50[_0xb9a7('0x3a')]);_0x207b5e[_0xb9a7('0x3e')]=_[_0xb9a7('0x3c')](_0x491c50[_0xb9a7('0x3d')],qs[_0xb9a7('0x4e')](_0x528117['query'][_0xb9a7('0x4e')]));_0x207b5e[_0xb9a7('0x3e')]=_0x207b5e[_0xb9a7('0x3e')][_0xb9a7('0x3f')]?_0x207b5e['attributes']:_0x491c50[_0xb9a7('0x3d')];if(_0x528117['query'][_0xb9a7('0x49')]){_0x207b5e[_0xb9a7('0x4a')]=[{'all':!![]}];}_0x207b5e=_[_0xb9a7('0x46')]({},_0x207b5e,_0x528117[_0xb9a7('0x48')]);return db[_0xb9a7('0x35')][_0xb9a7('0x4f')](_0x207b5e)[_0xb9a7('0x2d')](handleEntityNotFound(_0x26a00b,null))[_0xb9a7('0x2d')](respondWithResult(_0x26a00b,null))[_0xb9a7('0x4c')](handleError(_0x26a00b,null));};exports[_0xb9a7('0x50')]=function(_0x5db08c,_0x2d79d1){return db[_0xb9a7('0x35')][_0xb9a7('0x50')](_0x5db08c['body'],{})[_0xb9a7('0x2d')](respondWithResult(_0x2d79d1,0xc9))[_0xb9a7('0x4c')](handleError(_0x2d79d1,null));};exports[_0xb9a7('0x2c')]=function(_0x555cb7,_0x338b21){if(_0x555cb7[_0xb9a7('0x51')]['id']){delete _0x555cb7['body']['id'];}return db[_0xb9a7('0x35')][_0xb9a7('0x4f')]({'where':{'id':_0x555cb7[_0xb9a7('0x52')]['id']}})[_0xb9a7('0x2d')](handleEntityNotFound(_0x338b21,null))[_0xb9a7('0x2d')](saveUpdates(_0x555cb7[_0xb9a7('0x51')],null))[_0xb9a7('0x2d')](respondWithResult(_0x338b21,null))[_0xb9a7('0x4c')](handleError(_0x338b21,null));};exports[_0xb9a7('0x53')]=function(_0xe7279c,_0x332525){return db['SalesforceAccount']['find']({'where':{'id':_0xe7279c[_0xb9a7('0x52')]['id']}})[_0xb9a7('0x2d')](handleEntityNotFound(_0x332525,null))['then'](removeEntity(_0x332525,null))[_0xb9a7('0x4c')](handleError(_0x332525,null));};exports[_0xb9a7('0x54')]=function(_0xa8d0fb,_0x131cd7,_0x4c43e3){var _0x159493={};var _0x2c5cae={};var _0x597728;var _0x48351f;return db[_0xb9a7('0x35')][_0xb9a7('0x55')]({'where':{'id':_0xa8d0fb[_0xb9a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x131cd7,null))[_0xb9a7('0x2d')](function(_0x524096){if(_0x524096){_0x597728=_0x524096;_0x2c5cae[_0xb9a7('0x3d')]=_[_0xb9a7('0x4d')](db[_0xb9a7('0x56')]['rawAttributes']);_0x2c5cae['query']=_['keys'](_0xa8d0fb[_0xb9a7('0x3a')]);_0x2c5cae['filters']=_['intersection'](_0x2c5cae['model'],_0x2c5cae[_0xb9a7('0x3a')]);_0x159493[_0xb9a7('0x3e')]=_[_0xb9a7('0x3c')](_0x2c5cae[_0xb9a7('0x3d')],qs['fields'](_0xa8d0fb['query']['fields']));_0x159493[_0xb9a7('0x3e')]=_0x159493[_0xb9a7('0x3e')][_0xb9a7('0x3f')]?_0x159493[_0xb9a7('0x3e')]:_0x2c5cae[_0xb9a7('0x3d')];_0x159493['order']=qs['sort'](_0xa8d0fb[_0xb9a7('0x3a')][_0xb9a7('0x42')]);_0x159493[_0xb9a7('0x43')]=qs['filters'](_[_0xb9a7('0x44')](_0xa8d0fb[_0xb9a7('0x3a')],_0x2c5cae[_0xb9a7('0x3b')]));if(_0xa8d0fb[_0xb9a7('0x3a')][_0xb9a7('0x45')]){_0x159493['where']=_['merge'](_0x159493[_0xb9a7('0x43')],{'$or':_[_0xb9a7('0x34')](_0x159493[_0xb9a7('0x3e')],function(_0x41798f){var _0x26bf7b={};_0x26bf7b[_0x41798f]={'$like':'%'+_0xa8d0fb[_0xb9a7('0x3a')][_0xb9a7('0x45')]+'%'};return _0x26bf7b;})});}_0x159493=_[_0xb9a7('0x46')]({},_0x159493,_0xa8d0fb['options']);return _0x597728[_0xb9a7('0x54')](_0x159493);}})['then'](function(_0x54a1f1){if(_0x54a1f1){_0x48351f=_0x54a1f1[_0xb9a7('0x3f')];if(!_0xa8d0fb[_0xb9a7('0x3a')][_0xb9a7('0x40')]('nolimit')){_0x159493['limit']=qs[_0xb9a7('0x24')](_0xa8d0fb[_0xb9a7('0x3a')][_0xb9a7('0x24')]);_0x159493['offset']=qs[_0xb9a7('0x23')](_0xa8d0fb[_0xb9a7('0x3a')]['offset']);}return _0x597728[_0xb9a7('0x54')](_0x159493);}})[_0xb9a7('0x2d')](function(_0x236be2){if(_0x236be2){return _0x236be2?{'count':_0x48351f,'rows':_0x236be2}:null;}})[_0xb9a7('0x2d')](respondWithResult(_0x131cd7,null))['catch'](handleError(_0x131cd7,null));};exports[_0xb9a7('0x57')]=function(_0x40f5b9,_0x5d7479,_0x4c3446){if(_0x40f5b9['body']['id']){delete _0x40f5b9[_0xb9a7('0x51')]['id'];}return db[_0xb9a7('0x35')]['findOne']({'where':{'id':_0x40f5b9[_0xb9a7('0x52')]['id']}})[_0xb9a7('0x2d')](handleEntityNotFound(_0x5d7479,null))['then'](function(_0x150aaf){if(_0x150aaf){_0x40f5b9[_0xb9a7('0x51')][_0xb9a7('0x58')]=_0x150aaf['id'];_0x40f5b9['body'][_0xb9a7('0x59')]=integrations[_0xb9a7('0x5a')](_0x40f5b9[_0xb9a7('0x51')][_0xb9a7('0x5b')],_0x40f5b9['body'][_0xb9a7('0x38')]);_0x40f5b9[_0xb9a7('0x51')]['Descriptions']=integrations[_0xb9a7('0x5c')](_0x40f5b9[_0xb9a7('0x51')][_0xb9a7('0x5b')],_0x40f5b9[_0xb9a7('0x51')][_0xb9a7('0x38')]);return db['SalesforceConfiguration']['create'](_0x40f5b9[_0xb9a7('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xb9a7('0x5d')],'as':_0xb9a7('0x5e')}]});}return null;})[_0xb9a7('0x2d')](respondWithResult(_0x5d7479,null))[_0xb9a7('0x4c')](handleError(_0x5d7479,null));};exports[_0xb9a7('0x5f')]=function(_0x5b6b09,_0x5a9772,_0x19f132){var _0x13cd03;var _0x523a45='';var _0x41ca6b=_0xb9a7('0x60');return db[_0xb9a7('0x35')]['findOne']({'where':{'id':_0x5b6b09[_0xb9a7('0x52')]['id']},'attributes':['id',_0xb9a7('0x61'),_0xb9a7('0x62'),_0xb9a7('0x63'),_0xb9a7('0x64'),_0xb9a7('0x65'),_0xb9a7('0x66')]})[_0xb9a7('0x2d')](handleEntityNotFound(_0x5a9772,null))[_0xb9a7('0x2d')](function(_0x122527){if(_0x122527){_0x523a45=_0x122527['remoteUri'];var _0x20ad00=_0x523a45['slice'](-0x1);if(_0x20ad00==='/'){_0x523a45=_0x523a45[_0xb9a7('0x67')](0x0,_0x523a45[_0xb9a7('0x68')](_0x20ad00));}_0x13cd03=new jsforce[(_0xb9a7('0x69'))]({'oauth2':{'loginUrl':_0x523a45,'clientId':_0x122527['clientId'],'clientSecret':_0x122527[_0xb9a7('0x63')]}});return _0x13cd03[_0xb9a7('0x6a')](_0x122527[_0xb9a7('0x64')],_0x122527[_0xb9a7('0x65')]['concat'](_0x122527['securityToken']));}})['then'](function(_0x3cb3f1){if(_0x3cb3f1){if(!_[_0xb9a7('0x6b')](_0x5b6b09[_0xb9a7('0x3a')][_0xb9a7('0x6c')])){_0x41ca6b=_0x5b6b09[_0xb9a7('0x3a')][_0xb9a7('0x6c')];}return _0x13cd03[_0xb9a7('0x6d')](_0x41ca6b)[_0xb9a7('0x6e')]();}})[_0xb9a7('0x2d')](function(_0x4be1ba){var _0x169c1d=[_0xb9a7('0x6f'),'ActivityDate',_0xb9a7('0x70'),'IsRecurrence',_0xb9a7('0x71'),_0xb9a7('0x72')];var _0x273f21=[_0xb9a7('0x73'),_0xb9a7('0x74'),_0xb9a7('0x75'),'boolean',_0xb9a7('0x76'),'textarea',_0xb9a7('0x77')];if(_0x4be1ba){_[_0xb9a7('0x78')](_0x4be1ba['fields'],function(_0x4b9790){return _0x169c1d['includes'](_0x4b9790['name'])||!_0x273f21[_0xb9a7('0x79')](_0x4b9790[_0xb9a7('0x38')]);});return{'count':_0x4be1ba[_0xb9a7('0x4e')][_0xb9a7('0x3f')],'rows':_[_0xb9a7('0x34')](_0x4be1ba[_0xb9a7('0x4e')],function(_0x1d8d5b){return{'id':_0x1d8d5b[_0xb9a7('0x31')],'name':_0x1d8d5b[_0xb9a7('0x7a')],'custom':_0x1d8d5b['custom'],'options':_0x1d8d5b[_0xb9a7('0x7b')]['length']>0x0?_[_0xb9a7('0x34')](_0x1d8d5b['picklistValues'],function(_0x4c8f72){return{'name':_0x4c8f72[_0xb9a7('0x7a')],'value':_0x4c8f72[_0xb9a7('0x7c')]};}):_0x1d8d5b['type']=='boolean'?[{'name':_0xb9a7('0x7d'),'value':_0xb9a7('0x7e')},{'name':_0xb9a7('0x7f'),'value':_0xb9a7('0x80')}]:[]};})};}})['then'](respondWithResult(_0x5a9772,null))[_0xb9a7('0x4c')](function(_0x200088){var _0x228e54=_0x5b6b09[_0xb9a7('0x3a')][_0xb9a7('0x81')]?0x1f4:_0x200088[_0xb9a7('0x82')]||0x1f4;logger[_0xb9a7('0x2f')](_0xb9a7('0x83'),_0xb9a7('0x5f'),_0x228e54,JSON[_0xb9a7('0x84')](_0x200088));delete _0x200088[_0xb9a7('0x31')];if(_0x228e54===0x191){_0x228e54=0x190;}_0x5a9772[_0xb9a7('0x20')](_0x228e54)[_0xb9a7('0x32')](_0x5b6b09[_0xb9a7('0x3a')][_0xb9a7('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x200088[_0xb9a7('0x82')]}:_0x200088);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4323f8b..04f0749 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 _0x3caa=['exports','define','SalesforceAccount','lodash','util','api','moment','bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3caa,0x99));var _0xa3ca=function(_0x498f14,_0x40798b){_0x498f14=_0x498f14-0x0;var _0x194d4d=_0x3caa[_0x498f14];return _0x194d4d;};'use strict';var _=require(_0xa3ca('0x0'));var util=require(_0xa3ca('0x1'));var logger=require('../../config/logger')(_0xa3ca('0x2'));var moment=require(_0xa3ca('0x3'));var BPromise=require(_0xa3ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3ca('0x5'));var integrations=require(_0xa3ca('0x6'));module[_0xa3ca('0x7')]=function(_0x55d4b1,_0xcc654a){return _0x55d4b1[_0xa3ca('0x8')](_0xa3ca('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x4ffcc1,_0x48325a){var _0x485152=function(_0x1420e9){while(--_0x1420e9){_0x4ffcc1['push'](_0x4ffcc1['shift']());}};_0x485152(++_0x48325a);}(_0xf72b,0x1d9));var _0xbf72=function(_0x106be3,_0x4988fd){_0x106be3=_0x106be3-0x0;var _0x5e403d=_0xf72b[_0x106be3];return _0x5e403d;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));var integrations=require(_0xbf72('0x8'));module[_0xbf72('0x9')]=function(_0x5ee060,_0x41c11d){return _0x5ee060[_0xbf72('0xa')](_0xbf72('0xb'),attributes,{'tableName':_0xbf72('0xc'),'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 7525ca9..7f1d7ef 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 _0xa836=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','map','model','include','ShowSalesforceAccount','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x29e189,_0x499077){var _0x380cc9=function(_0x52ffba){while(--_0x52ffba){_0x29e189['push'](_0x29e189['shift']());}};_0x380cc9(++_0x499077);}(_0xa836,0x162));var _0x6a83=function(_0x4ec922,_0x53bda6){_0x4ec922=_0x4ec922-0x0;var _0x53757f=_0xa836[_0x4ec922];return _0x53757f;};'use strict';var _=require(_0x6a83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a83('0x1'));var fs=require('fs');var Redis=require(_0x6a83('0x2'));var db=require(_0x6a83('0x3'))['db'];var utils=require(_0x6a83('0x4'));var logger=require(_0x6a83('0x5'))(_0x6a83('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a83('0x7'));var client=jayson[_0x6a83('0x8')][_0x6a83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a83b7,_0x4ffb1a,_0x407d24){return new BPromise(function(_0x3b40bc,_0x4eb6b8){return client[_0x6a83('0xa')](_0x2a83b7,_0x407d24)[_0x6a83('0xb')](function(_0x515801){logger[_0x6a83('0xc')](_0x6a83('0xd'),_0x4ffb1a,_0x6a83('0xe'));logger[_0x6a83('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4ffb1a,'request\x20sent',JSON[_0x6a83('0x10')](_0x515801));if(_0x515801[_0x6a83('0x11')]){if(_0x515801[_0x6a83('0x11')][_0x6a83('0x12')]===0x1f4){logger[_0x6a83('0x11')](_0x6a83('0xd'),_0x4ffb1a,_0x515801[_0x6a83('0x11')][_0x6a83('0x13')]);return _0x4eb6b8(_0x515801['error'][_0x6a83('0x13')]);}logger['error'](_0x6a83('0xd'),_0x4ffb1a,_0x515801[_0x6a83('0x11')][_0x6a83('0x13')]);return _0x3b40bc(_0x515801['error'][_0x6a83('0x13')]);}else{logger[_0x6a83('0xc')](_0x6a83('0xd'),_0x4ffb1a,'request\x20sent');_0x3b40bc(_0x515801['result'][_0x6a83('0x13')]);}})[_0x6a83('0x14')](function(_0x146ff2){logger[_0x6a83('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4ffb1a,_0x146ff2);_0x4eb6b8(_0x146ff2);});});}exports[_0x6a83('0x15')]=function(_0x2b1220){var _0x260072=this;return new Promise(function(_0x33f30a,_0x3d730d){return db[_0x6a83('0x16')]['findAll']({'raw':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x18')]===undefined?!![]:![]:!![],'where':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x19')]||null:null,'attributes':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x1a')]||null:null,'limit':_0x2b1220[_0x6a83('0x17')]?_0x2b1220['options'][_0x6a83('0x1b')]||null:null,'include':_0x2b1220['options']?_0x2b1220[_0x6a83('0x17')]['include']?_[_0x6a83('0x1c')](_0x2b1220[_0x6a83('0x17')]['include'],function(_0x1f9c0b){return{'model':db[_0x1f9c0b[_0x6a83('0x1d')]],'as':_0x1f9c0b['as'],'attributes':_0x1f9c0b[_0x6a83('0x1a')],'include':_0x1f9c0b['include']?_[_0x6a83('0x1c')](_0x1f9c0b[_0x6a83('0x1e')],function(_0x1738e7){return{'model':db[_0x1738e7['model']],'as':_0x1738e7['as'],'attributes':_0x1738e7[_0x6a83('0x1a')],'include':_0x1738e7[_0x6a83('0x1e')]?_['map'](_0x1738e7[_0x6a83('0x1e')],function(_0x3d9b0a){return{'model':db[_0x3d9b0a[_0x6a83('0x1d')]],'as':_0x3d9b0a['as'],'attributes':_0x3d9b0a[_0x6a83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a83('0xb')](function(_0xa7dafe){logger[_0x6a83('0xc')](_0x6a83('0x15'),_0x2b1220);logger[_0x6a83('0xf')](_0x6a83('0x15'),_0x2b1220,JSON[_0x6a83('0x10')](_0xa7dafe));_0x33f30a(_0xa7dafe);})['catch'](function(_0xab9417){logger[_0x6a83('0x11')](_0x6a83('0x15'),_0xab9417[_0x6a83('0x13')],_0x2b1220);_0x3d730d(_0x260072[_0x6a83('0x11')](0x1f4,_0xab9417[_0x6a83('0x13')]));});});};exports[_0x6a83('0x1f')]=function(_0x4813dc){var _0x5ce329=this;return new Promise(function(_0x4e7cac,_0x2cdc81){return db[_0x6a83('0x16')][_0x6a83('0x20')]({'raw':_0x4813dc[_0x6a83('0x17')]?_0x4813dc['options'][_0x6a83('0x18')]===undefined?!![]:![]:!![],'where':_0x4813dc[_0x6a83('0x17')]?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x19')]||null:null,'attributes':_0x4813dc['options']?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1a')]||null:null,'include':_0x4813dc['options']?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1e')]?_[_0x6a83('0x1c')](_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1e')],function(_0x56a157){return{'model':db[_0x56a157['model']],'as':_0x56a157['as'],'attributes':_0x56a157[_0x6a83('0x1a')],'include':_0x56a157[_0x6a83('0x1e')]?_[_0x6a83('0x1c')](_0x56a157[_0x6a83('0x1e')],function(_0x40273e){return{'model':db[_0x40273e[_0x6a83('0x1d')]],'as':_0x40273e['as'],'attributes':_0x40273e[_0x6a83('0x1a')],'include':_0x40273e['include']?_[_0x6a83('0x1c')](_0x40273e[_0x6a83('0x1e')],function(_0x7e5697){return{'model':db[_0x7e5697[_0x6a83('0x1d')]],'as':_0x7e5697['as'],'attributes':_0x7e5697[_0x6a83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a83('0xb')](function(_0x262fde){logger[_0x6a83('0xc')]('ShowSalesforceAccount',_0x4813dc);logger[_0x6a83('0xf')](_0x6a83('0x1f'),_0x4813dc,JSON[_0x6a83('0x10')](_0x262fde));_0x4e7cac(_0x262fde);})[_0x6a83('0x14')](function(_0x17c375){logger[_0x6a83('0x11')](_0x6a83('0x1f'),_0x17c375[_0x6a83('0x13')],_0x4813dc);_0x2cdc81(_0x5ce329[_0x6a83('0x11')](0x1f4,_0x17c375[_0x6a83('0x13')]));});});}; \ No newline at end of file +var _0xead1=['stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','include','map','attributes','model','then','debug','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2fa52f,_0x3ba1d7){var _0x4baeec=function(_0x158e93){while(--_0x158e93){_0x2fa52f['push'](_0x2fa52f['shift']());}};_0x4baeec(++_0x3ba1d7);}(_0xead1,0x76));var _0x1ead=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xead1[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1ead('0x0'));var moment=require(_0x1ead('0x1'));var BPromise=require(_0x1ead('0x2'));var rs=require(_0x1ead('0x3'));var fs=require('fs');var Redis=require(_0x1ead('0x4'));var db=require(_0x1ead('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ead('0x6'))(_0x1ead('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ead('0x8')][_0x1ead('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x133317,_0x32648d,_0x197645){return new BPromise(function(_0x331f3b,_0x31fa08){return client['request'](_0x133317,_0x197645)['then'](function(_0x34e114){logger[_0x1ead('0xa')](_0x1ead('0xb'),_0x32648d,_0x1ead('0xc'));logger['debug'](_0x1ead('0xd'),_0x32648d,_0x1ead('0xc'),JSON[_0x1ead('0xe')](_0x34e114));if(_0x34e114[_0x1ead('0xf')]){if(_0x34e114[_0x1ead('0xf')][_0x1ead('0x10')]===0x1f4){logger[_0x1ead('0xf')](_0x1ead('0xb'),_0x32648d,_0x34e114[_0x1ead('0xf')][_0x1ead('0x11')]);return _0x31fa08(_0x34e114['error']['message']);}logger['error'](_0x1ead('0xb'),_0x32648d,_0x34e114[_0x1ead('0xf')]['message']);return _0x331f3b(_0x34e114[_0x1ead('0xf')]['message']);}else{logger[_0x1ead('0xa')](_0x1ead('0xb'),_0x32648d,_0x1ead('0xc'));_0x331f3b(_0x34e114[_0x1ead('0x12')][_0x1ead('0x11')]);}})[_0x1ead('0x13')](function(_0x484789){logger[_0x1ead('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x32648d,_0x484789);_0x31fa08(_0x484789);});});}exports[_0x1ead('0x14')]=function(_0x3234f3){var _0x22593e=this;return new Promise(function(_0x51528f,_0x456aed){return db[_0x1ead('0x15')][_0x1ead('0x16')]({'raw':_0x3234f3[_0x1ead('0x17')]?_0x3234f3[_0x1ead('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3234f3[_0x1ead('0x17')]?_0x3234f3[_0x1ead('0x17')][_0x1ead('0x18')]||null:null,'attributes':_0x3234f3[_0x1ead('0x17')]?_0x3234f3[_0x1ead('0x17')]['attributes']||null:null,'limit':_0x3234f3[_0x1ead('0x17')]?_0x3234f3[_0x1ead('0x17')]['limit']||null:null,'include':_0x3234f3[_0x1ead('0x17')]?_0x3234f3['options'][_0x1ead('0x19')]?_[_0x1ead('0x1a')](_0x3234f3[_0x1ead('0x17')][_0x1ead('0x19')],function(_0x58ca8e){return{'model':db[_0x58ca8e['model']],'as':_0x58ca8e['as'],'attributes':_0x58ca8e[_0x1ead('0x1b')],'include':_0x58ca8e[_0x1ead('0x19')]?_[_0x1ead('0x1a')](_0x58ca8e[_0x1ead('0x19')],function(_0x585ee2){return{'model':db[_0x585ee2[_0x1ead('0x1c')]],'as':_0x585ee2['as'],'attributes':_0x585ee2[_0x1ead('0x1b')],'include':_0x585ee2['include']?_[_0x1ead('0x1a')](_0x585ee2[_0x1ead('0x19')],function(_0x49960e){return{'model':db[_0x49960e[_0x1ead('0x1c')]],'as':_0x49960e['as'],'attributes':_0x49960e[_0x1ead('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ead('0x1d')](function(_0xf88741){logger[_0x1ead('0xa')]('GetSalesforceAccount',_0x3234f3);logger[_0x1ead('0x1e')]('GetSalesforceAccount',_0x3234f3,JSON['stringify'](_0xf88741));_0x51528f(_0xf88741);})[_0x1ead('0x13')](function(_0x1d1f43){logger[_0x1ead('0xf')](_0x1ead('0x14'),_0x1d1f43[_0x1ead('0x11')],_0x3234f3);_0x456aed(_0x22593e[_0x1ead('0xf')](0x1f4,_0x1d1f43['message']));});});};exports[_0x1ead('0x1f')]=function(_0x14543e){var _0x8984e0=this;return new Promise(function(_0x1a596b,_0x57b303){return db[_0x1ead('0x15')][_0x1ead('0x20')]({'raw':_0x14543e[_0x1ead('0x17')]?_0x14543e[_0x1ead('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x14543e[_0x1ead('0x17')]?_0x14543e[_0x1ead('0x17')]['where']||null:null,'attributes':_0x14543e[_0x1ead('0x17')]?_0x14543e[_0x1ead('0x17')][_0x1ead('0x1b')]||null:null,'include':_0x14543e[_0x1ead('0x17')]?_0x14543e[_0x1ead('0x17')]['include']?_[_0x1ead('0x1a')](_0x14543e[_0x1ead('0x17')][_0x1ead('0x19')],function(_0x12f1fe){return{'model':db[_0x12f1fe[_0x1ead('0x1c')]],'as':_0x12f1fe['as'],'attributes':_0x12f1fe[_0x1ead('0x1b')],'include':_0x12f1fe[_0x1ead('0x19')]?_[_0x1ead('0x1a')](_0x12f1fe[_0x1ead('0x19')],function(_0x4534e7){return{'model':db[_0x4534e7[_0x1ead('0x1c')]],'as':_0x4534e7['as'],'attributes':_0x4534e7[_0x1ead('0x1b')],'include':_0x4534e7['include']?_[_0x1ead('0x1a')](_0x4534e7['include'],function(_0x110668){return{'model':db[_0x110668['model']],'as':_0x110668['as'],'attributes':_0x110668[_0x1ead('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x593b5f){logger['info'](_0x1ead('0x1f'),_0x14543e);logger['debug'](_0x1ead('0x1f'),_0x14543e,JSON[_0x1ead('0xe')](_0x593b5f));_0x1a596b(_0x593b5f);})[_0x1ead('0x13')](function(_0xba9f25){logger[_0x1ead('0xf')](_0x1ead('0x1f'),_0xba9f25[_0x1ead('0x11')],_0x14543e);_0x57b303(_0x8984e0[_0x1ead('0xf')](0x1f4,_0xba9f25[_0x1ead('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8726940..bead098 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb28,0x106));var _0x8db2=function(_0x223469,_0x2e0d09){_0x223469=_0x223469-0x0;var _0x4b992f=_0xdb28[_0x223469];return _0x4b992f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x34b571,_0x3db6ca){var _0x5a93b9=function(_0x583651){while(--_0x583651){_0x34b571['push'](_0x34b571['shift']());}};_0x5a93b9(++_0x3db6ca);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4b99e9,_0x3d805f){_0x4b99e9=_0x4b99e9-0x0;var _0x15f2f9=_0x5f2f[_0x4b99e9];return _0x15f2f9;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7af967c..33375a3 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 _0xcd6a=['STRING','ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','contact','lead'];(function(_0x40566d,_0x3775ef){var _0x5be48c=function(_0x5a7e5a){while(--_0x5a7e5a){_0x40566d['push'](_0x40566d['shift']());}};_0x5be48c(++_0x3775ef);}(_0xcd6a,0xbe));var _0xacd6=function(_0x358c85,_0x555eca){_0x358c85=_0x358c85-0x0;var _0x309fa=_0xcd6a[_0x358c85];return _0x309fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xacd6('0x0')]},'description':{'type':Sequelize[_0xacd6('0x0')]},'ticketType':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x2'),_0xacd6('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x4'),'contact','lead',_0xacd6('0x5'),_0xacd6('0x6')),'defaultValue':_0xacd6('0x4')},'moduleCreate':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x7'),_0xacd6('0x8'),_0xacd6('0x9'),'account'),'defaultValue':_0xacd6('0x9')},'leadId':{'type':Sequelize[_0xacd6('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xacd6('0x0')]},'additionalSearchLead':{'type':Sequelize[_0xacd6('0x0')]}}; \ No newline at end of file +var _0x878c=['lead','account_contact_lead','account','nothing','contact','sequelize','STRING','ENUM','Task','Case','contact_lead'];(function(_0x16e905,_0x31eb17){var _0x53cb0f=function(_0x57e0ac){while(--_0x57e0ac){_0x16e905['push'](_0x16e905['shift']());}};_0x53cb0f(++_0x31eb17);}(_0x878c,0x1de));var _0xc878=function(_0x4d5f37,_0x431410){_0x4d5f37=_0x4d5f37-0x0;var _0x5ef460=_0x878c[_0x4d5f37];return _0x5ef460;};'use strict';var Sequelize=require(_0xc878('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc878('0x1')]},'ticketType':{'type':Sequelize[_0xc878('0x2')](_0xc878('0x3'),_0xc878('0x4')),'defaultValue':_0xc878('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc878('0x5'),'contact',_0xc878('0x6'),_0xc878('0x7'),_0xc878('0x8')),'defaultValue':_0xc878('0x5')},'moduleCreate':{'type':Sequelize[_0xc878('0x2')](_0xc878('0x9'),_0xc878('0xa'),'lead',_0xc878('0x8')),'defaultValue':_0xc878('0x6')},'leadId':{'type':Sequelize[_0xc878('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xc878('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e964527..83a8d9d 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 _0x80ab=['body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create'];(function(_0x5d1594,_0x55fd12){var _0x56a18f=function(_0x3eff73){while(--_0x3eff73){_0x5d1594['push'](_0x5d1594['shift']());}};_0x56a18f(++_0x55fd12);}(_0x80ab,0x143));var _0xb80a=function(_0x3e0040,_0x2c81a0){_0x3e0040=_0x3e0040-0x0;var _0x29a07c=_0x80ab[_0x3e0040];return _0x29a07c;};'use strict';var emlformat=require(_0xb80a('0x0'));var rimraf=require(_0xb80a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb80a('0x2'));var rp=require(_0xb80a('0x3'));var moment=require(_0xb80a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb80a('0x5'));var util=require(_0xb80a('0x6'));var path=require('path');var sox=require(_0xb80a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb80a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb80a('0x9'));var jsforce=require(_0xb80a('0xa'));var deskjs=require(_0xb80a('0xb'));var toCsv=require(_0xb80a('0xc'));var querystring=require('querystring');var Papa=require(_0xb80a('0xd'));var Redis=require(_0xb80a('0xe'));var authService=require(_0xb80a('0xf'));var qs=require(_0xb80a('0x10'));var as=require(_0xb80a('0x11'));var hardwareService=require(_0xb80a('0x12'));var logger=require(_0xb80a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb80a('0x14'));var licenseUtil=require(_0xb80a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349b98,_0x454dde){_0x454dde=_0x454dde||0xcc;return function(_0x571ae9){if(_0x571ae9){return _0x349b98[_0xb80a('0x16')](_0x454dde);}return _0x349b98[_0xb80a('0x17')](_0x454dde)[_0xb80a('0x18')]();};}function respondWithResult(_0x5e461f,_0x1fbba1){_0x1fbba1=_0x1fbba1||0xc8;return function(_0x5fe140){if(_0x5fe140){return _0x5e461f[_0xb80a('0x17')](_0x1fbba1)[_0xb80a('0x19')](_0x5fe140);}};}function respondWithFilteredResult(_0x2bac3a,_0x5e51ac){return function(_0x429ec7){if(_0x429ec7){var _0x907821=typeof _0x5e51ac[_0xb80a('0x1a')]==='undefined'&&typeof _0x5e51ac[_0xb80a('0x1b')]===_0xb80a('0x1c');var _0x2e10ce=_0x429ec7[_0xb80a('0x1d')];var _0x2007ea=_0x907821?0x0:_0x5e51ac[_0xb80a('0x1a')];var _0x198808=_0x907821?_0x429ec7[_0xb80a('0x1d')]:_0x5e51ac[_0xb80a('0x1a')]+_0x5e51ac['limit'];var _0x4b83a0;if(_0x198808>=_0x2e10ce){_0x198808=_0x2e10ce;_0x4b83a0=0xc8;}else{_0x4b83a0=0xce;}_0x2bac3a[_0xb80a('0x17')](_0x4b83a0);return _0x2bac3a[_0xb80a('0x1e')](_0xb80a('0x1f'),_0x2007ea+'-'+_0x198808+'/'+_0x2e10ce)['json'](_0x429ec7);}return null;};}function patchUpdates(_0x9e7529){return function(_0x449d5e){try{jsonpatch[_0xb80a('0x20')](_0x449d5e,_0x9e7529,!![]);}catch(_0x5a5165){return BPromise[_0xb80a('0x21')](_0x5a5165);}return _0x449d5e[_0xb80a('0x22')]();};}function saveUpdates(_0x18f3ef,_0x338350){return function(_0xfe1d5c){if(_0xfe1d5c){return _0xfe1d5c[_0xb80a('0x23')](_0x18f3ef)[_0xb80a('0x24')](function(_0x5973b0){return _0x5973b0;});}return null;};}function removeEntity(_0x4ba212,_0x19565e){return function(_0x1b00a0){if(_0x1b00a0){return _0x1b00a0[_0xb80a('0x25')]()[_0xb80a('0x24')](function(){_0x4ba212[_0xb80a('0x17')](0xcc)[_0xb80a('0x18')]();});}};}function handleEntityNotFound(_0x776b44,_0x30cd3b){return function(_0x375b2b){if(!_0x375b2b){_0x776b44[_0xb80a('0x16')](0x194);}return _0x375b2b;};}function handleError(_0x3f967d,_0x2fdf8c){_0x2fdf8c=_0x2fdf8c||0x1f4;return function(_0x1b83b4){logger[_0xb80a('0x26')](_0x1b83b4['stack']);if(_0x1b83b4[_0xb80a('0x27')]){delete _0x1b83b4[_0xb80a('0x27')];}_0x3f967d['status'](_0x2fdf8c)[_0xb80a('0x28')](_0x1b83b4);};}exports[_0xb80a('0x29')]=function(_0x36fa59,_0x363716){var _0x2927af={},_0x15e56a={},_0x4796de={'count':0x0,'rows':[]};var _0x3e8ffa=_[_0xb80a('0x2a')](db[_0xb80a('0x2b')][_0xb80a('0x2c')],function(_0x596a18){return{'name':_0x596a18[_0xb80a('0x2d')],'type':_0x596a18[_0xb80a('0x2e')][_0xb80a('0x2f')]};});_0x15e56a['model']=_[_0xb80a('0x2a')](_0x3e8ffa,_0xb80a('0x27'));_0x15e56a[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0x36fa59['query']);_0x15e56a[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x15e56a['model'],_0x15e56a[_0xb80a('0x30')]);_0x2927af[_0xb80a('0x34')]=_['intersection'](_0x15e56a[_0xb80a('0x35')],qs[_0xb80a('0x36')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x36')]));_0x2927af[_0xb80a('0x34')]=_0x2927af['attributes'][_0xb80a('0x37')]?_0x2927af[_0xb80a('0x34')]:_0x15e56a['model'];if(!_0x36fa59[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x2927af['limit']=qs[_0xb80a('0x1b')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x2927af[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x36fa59['query'][_0xb80a('0x1a')]);}_0x2927af[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x2927af[_0xb80a('0x3c')]=qs['filters'](_['pick'](_0x36fa59[_0xb80a('0x30')],_0x15e56a[_0xb80a('0x32')]),_0x3e8ffa);if(_0x36fa59[_0xb80a('0x30')][_0xb80a('0x3d')]){_0x2927af['where']=_['merge'](_0x2927af[_0xb80a('0x3c')],{'$or':_[_0xb80a('0x2a')](_0x3e8ffa,function(_0x39bdbb){if(_0x39bdbb['type']!=='VIRTUAL'){var _0x10529c={};_0x10529c[_0x39bdbb[_0xb80a('0x27')]]={'$like':'%'+_0x36fa59[_0xb80a('0x30')]['filter']+'%'};return _0x10529c;}})});}_0x2927af=_[_0xb80a('0x3e')]({},_0x2927af,_0x36fa59[_0xb80a('0x3f')]);var _0x379860={'where':_0x2927af[_0xb80a('0x3c')]};return db[_0xb80a('0x2b')][_0xb80a('0x1d')](_0x379860)[_0xb80a('0x24')](function(_0x5bcbcd){_0x4796de[_0xb80a('0x1d')]=_0x5bcbcd;if(_0x36fa59['query'][_0xb80a('0x40')]){_0x2927af[_0xb80a('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xb80a('0x42')](_0x2927af);})[_0xb80a('0x24')](function(_0x4a3e2a){_0x4796de[_0xb80a('0x43')]=_0x4a3e2a;return _0x4796de;})[_0xb80a('0x24')](respondWithFilteredResult(_0x363716,_0x2927af))[_0xb80a('0x44')](handleError(_0x363716,null));};exports['show']=function(_0xdede8a,_0x22036e){var _0x1cd88={'raw':![],'where':{'id':_0xdede8a[_0xb80a('0x45')]['id']}},_0x160a59={};_0x160a59[_0xb80a('0x35')]=_[_0xb80a('0x31')](db['SalesforceConfiguration'][_0xb80a('0x2c')]);_0x160a59[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0xdede8a[_0xb80a('0x30')]);_0x160a59['filters']=_['intersection'](_0x160a59[_0xb80a('0x35')],_0x160a59[_0xb80a('0x30')]);_0x1cd88[_0xb80a('0x34')]=_['intersection'](_0x160a59[_0xb80a('0x35')],qs[_0xb80a('0x36')](_0xdede8a[_0xb80a('0x30')]['fields']));_0x1cd88[_0xb80a('0x34')]=_0x1cd88[_0xb80a('0x34')][_0xb80a('0x37')]?_0x1cd88[_0xb80a('0x34')]:_0x160a59[_0xb80a('0x35')];if(_0xdede8a[_0xb80a('0x30')][_0xb80a('0x40')]){_0x1cd88[_0xb80a('0x41')]=[{'all':!![]}];}_0x1cd88=_[_0xb80a('0x3e')]({},_0x1cd88,_0xdede8a[_0xb80a('0x3f')]);return db['SalesforceConfiguration'][_0xb80a('0x46')](_0x1cd88)[_0xb80a('0x24')](handleEntityNotFound(_0x22036e,null))[_0xb80a('0x24')](respondWithResult(_0x22036e,null))[_0xb80a('0x44')](handleError(_0x22036e,null));};exports[_0xb80a('0x47')]=function(_0x52751f,_0x5aaa23){return db[_0xb80a('0x2b')]['create'](_0x52751f[_0xb80a('0x48')],{})[_0xb80a('0x24')](respondWithResult(_0x5aaa23,0xc9))[_0xb80a('0x44')](handleError(_0x5aaa23,null));};exports[_0xb80a('0x23')]=function(_0xd91fe5,_0x434082){if(_0xd91fe5[_0xb80a('0x48')]['id']){delete _0xd91fe5[_0xb80a('0x48')]['id'];}return db[_0xb80a('0x2b')][_0xb80a('0x46')]({'where':{'id':_0xd91fe5['params']['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x434082,null))[_0xb80a('0x24')](saveUpdates(_0xd91fe5[_0xb80a('0x48')],null))[_0xb80a('0x24')](respondWithResult(_0x434082,null))[_0xb80a('0x44')](handleError(_0x434082,null));};exports[_0xb80a('0x25')]=function(_0x48b02e,_0x3a0a70){return db['SalesforceConfiguration'][_0xb80a('0x46')]({'where':{'id':_0x48b02e[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x3a0a70,null))[_0xb80a('0x24')](removeEntity(_0x3a0a70,null))[_0xb80a('0x44')](handleError(_0x3a0a70,null));};exports[_0xb80a('0x49')]=function(_0x1bef2e,_0x43d48e,_0x209274){var _0x296bee={};var _0x42558a={};var _0x1a6f86;var _0x59a490;return db[_0xb80a('0x2b')][_0xb80a('0x4a')]({'where':{'id':_0x1bef2e[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x43d48e,null))['then'](function(_0xc05311){if(_0xc05311){_0x1a6f86=_0xc05311;_0x42558a[_0xb80a('0x35')]=_[_0xb80a('0x31')](db[_0xb80a('0x4b')][_0xb80a('0x2c')]);_0x42558a['query']=_[_0xb80a('0x31')](_0x1bef2e['query']);_0x42558a[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x42558a[_0xb80a('0x35')],_0x42558a[_0xb80a('0x30')]);_0x296bee['attributes']=_['intersection'](_0x42558a['model'],qs[_0xb80a('0x36')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x36')]));_0x296bee[_0xb80a('0x34')]=_0x296bee[_0xb80a('0x34')][_0xb80a('0x37')]?_0x296bee[_0xb80a('0x34')]:_0x42558a['model'];_0x296bee[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x296bee[_0xb80a('0x3c')]=qs[_0xb80a('0x32')](_[_0xb80a('0x4c')](_0x1bef2e['query'],_0x42558a[_0xb80a('0x32')]));if(_0x1bef2e[_0xb80a('0x30')]['filter']){_0x296bee[_0xb80a('0x3c')]=_[_0xb80a('0x3e')](_0x296bee['where'],{'$or':_[_0xb80a('0x2a')](_0x296bee[_0xb80a('0x34')],function(_0x222189){var _0x1012a0={};_0x1012a0[_0x222189]={'$like':'%'+_0x1bef2e[_0xb80a('0x30')]['filter']+'%'};return _0x1012a0;})});}_0x296bee=_['merge']({},_0x296bee,_0x1bef2e[_0xb80a('0x3f')]);return _0x1a6f86[_0xb80a('0x49')](_0x296bee);}})[_0xb80a('0x24')](function(_0x115396){if(_0x115396){_0x59a490=_0x115396[_0xb80a('0x37')];if(!_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x296bee[_0xb80a('0x1b')]=qs[_0xb80a('0x1b')](_0x1bef2e['query']['limit']);_0x296bee[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x1a')]);}return _0x1a6f86['getFields'](_0x296bee);}})[_0xb80a('0x24')](function(_0x45477a){if(_0x45477a){return _0x45477a?{'count':_0x59a490,'rows':_0x45477a}:null;}})[_0xb80a('0x24')](respondWithResult(_0x43d48e,null))['catch'](handleError(_0x43d48e,null));};exports[_0xb80a('0x4d')]=function(_0xff8489,_0x2b50de,_0x138623){var _0x3e8b81={};var _0x54fcf5={};var _0x1c3416;var _0x9a656;return db[_0xb80a('0x2b')]['findOne']({'where':{'id':_0xff8489[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x2b50de,null))['then'](function(_0x1cf5c9){if(_0x1cf5c9){_0x1c3416=_0x1cf5c9;_0x54fcf5[_0xb80a('0x35')]=_[_0xb80a('0x31')](db[_0xb80a('0x4b')][_0xb80a('0x2c')]);_0x54fcf5[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0xff8489[_0xb80a('0x30')]);_0x54fcf5['filters']=_[_0xb80a('0x33')](_0x54fcf5[_0xb80a('0x35')],_0x54fcf5[_0xb80a('0x30')]);_0x3e8b81['attributes']=_[_0xb80a('0x33')](_0x54fcf5[_0xb80a('0x35')],qs['fields'](_0xff8489[_0xb80a('0x30')][_0xb80a('0x36')]));_0x3e8b81[_0xb80a('0x34')]=_0x3e8b81['attributes'][_0xb80a('0x37')]?_0x3e8b81[_0xb80a('0x34')]:_0x54fcf5['model'];_0x3e8b81['order']=qs[_0xb80a('0x3b')](_0xff8489[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x3e8b81[_0xb80a('0x3c')]=qs['filters'](_[_0xb80a('0x4c')](_0xff8489[_0xb80a('0x30')],_0x54fcf5[_0xb80a('0x32')]));if(_0xff8489[_0xb80a('0x30')][_0xb80a('0x3d')]){_0x3e8b81[_0xb80a('0x3c')]=_['merge'](_0x3e8b81['where'],{'$or':_[_0xb80a('0x2a')](_0x3e8b81['attributes'],function(_0x5a6529){var _0x451d49={};_0x451d49[_0x5a6529]={'$like':'%'+_0xff8489[_0xb80a('0x30')][_0xb80a('0x3d')]+'%'};return _0x451d49;})});}_0x3e8b81=_[_0xb80a('0x3e')]({},_0x3e8b81,_0xff8489['options']);return _0x1c3416[_0xb80a('0x4d')](_0x3e8b81);}})[_0xb80a('0x24')](function(_0x1a55f9){if(_0x1a55f9){_0x9a656=_0x1a55f9[_0xb80a('0x37')];if(!_0xff8489[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x3e8b81['limit']=qs['limit'](_0xff8489[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x3e8b81[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0xff8489[_0xb80a('0x30')][_0xb80a('0x1a')]);}return _0x1c3416[_0xb80a('0x4d')](_0x3e8b81);}})[_0xb80a('0x24')](function(_0x337d3f){if(_0x337d3f){return _0x337d3f?{'count':_0x9a656,'rows':_0x337d3f}:null;}})['then'](respondWithResult(_0x2b50de,null))[_0xb80a('0x44')](handleError(_0x2b50de,null));};exports[_0xb80a('0x4e')]=function(_0x1e334,_0x331b13,_0x395009){var _0x2b718f={};var _0x21cf2e={};var _0x2dcf19;var _0x5d8040;return db['SalesforceConfiguration'][_0xb80a('0x4a')]({'where':{'id':_0x1e334[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x331b13,null))[_0xb80a('0x24')](function(_0x547816){if(_0x547816){_0x2dcf19=_0x547816;_0x21cf2e[_0xb80a('0x35')]=_[_0xb80a('0x31')](db['SalesforceField'][_0xb80a('0x2c')]);_0x21cf2e[_0xb80a('0x30')]=_['keys'](_0x1e334[_0xb80a('0x30')]);_0x21cf2e[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x21cf2e[_0xb80a('0x35')],_0x21cf2e['query']);_0x2b718f[_0xb80a('0x34')]=_[_0xb80a('0x33')](_0x21cf2e['model'],qs['fields'](_0x1e334['query'][_0xb80a('0x36')]));_0x2b718f[_0xb80a('0x34')]=_0x2b718f[_0xb80a('0x34')][_0xb80a('0x37')]?_0x2b718f['attributes']:_0x21cf2e['model'];_0x2b718f[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x1e334[_0xb80a('0x30')]['sort']);_0x2b718f[_0xb80a('0x3c')]=qs['filters'](_['pick'](_0x1e334[_0xb80a('0x30')],_0x21cf2e[_0xb80a('0x32')]));if(_0x1e334[_0xb80a('0x30')]['filter']){_0x2b718f[_0xb80a('0x3c')]=_[_0xb80a('0x3e')](_0x2b718f[_0xb80a('0x3c')],{'$or':_['map'](_0x2b718f[_0xb80a('0x34')],function(_0x2fef40){var _0x2283ba={};_0x2283ba[_0x2fef40]={'$like':'%'+_0x1e334[_0xb80a('0x30')][_0xb80a('0x3d')]+'%'};return _0x2283ba;})});}_0x2b718f=_['merge']({},_0x2b718f,_0x1e334['options']);return _0x2dcf19[_0xb80a('0x4e')](_0x2b718f);}})[_0xb80a('0x24')](function(_0x3110f6){if(_0x3110f6){_0x5d8040=_0x3110f6[_0xb80a('0x37')];if(!_0x1e334[_0xb80a('0x30')][_0xb80a('0x38')]('nolimit')){_0x2b718f['limit']=qs[_0xb80a('0x1b')](_0x1e334[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x2b718f[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x1e334[_0xb80a('0x30')]['offset']);}return _0x2dcf19[_0xb80a('0x4e')](_0x2b718f);}})['then'](function(_0x177c04){if(_0x177c04){return _0x177c04?{'count':_0x5d8040,'rows':_0x177c04}:null;}})[_0xb80a('0x24')](respondWithResult(_0x331b13,null))[_0xb80a('0x44')](handleError(_0x331b13,null));}; \ No newline at end of file +var _0x7881=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','SalesforceConfiguration','include','findAll','rows','show','includeAll','options','find','catch','create','body','params','getFields','order','getSubjects','findOne','SalesforceField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','save','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x55e2a9,_0x5aabcb){var _0x1e52b8=function(_0xe89e57){while(--_0xe89e57){_0x55e2a9['push'](_0x55e2a9['shift']());}};_0x1e52b8(++_0x5aabcb);}(_0x7881,0x69));var _0x1788=function(_0x30f62d,_0x3c3147){_0x30f62d=_0x30f62d-0x0;var _0x4fb27a=_0x7881[_0x30f62d];return _0x4fb27a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1788('0x0'));var zipdir=require(_0x1788('0x1'));var jsonpatch=require(_0x1788('0x2'));var rp=require(_0x1788('0x3'));var moment=require(_0x1788('0x4'));var BPromise=require(_0x1788('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1788('0x6'));var ejs=require(_0x1788('0x7'));var fs=require('fs');var fs_extra=require(_0x1788('0x8'));var _=require('lodash');var squel=require(_0x1788('0x9'));var crypto=require(_0x1788('0xa'));var jsforce=require(_0x1788('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1788('0x6'));var querystring=require(_0x1788('0xc'));var Papa=require(_0x1788('0xd'));var Redis=require(_0x1788('0xe'));var authService=require(_0x1788('0xf'));var qs=require(_0x1788('0x10'));var as=require(_0x1788('0x11'));var hardwareService=require(_0x1788('0x12'));var logger=require('../../config/logger')(_0x1788('0x13'));var utils=require(_0x1788('0x14'));var config=require(_0x1788('0x15'));var licenseUtil=require(_0x1788('0x16'));var db=require(_0x1788('0x17'))['db'];function respondWithStatusCode(_0x475d40,_0x2d0122){_0x2d0122=_0x2d0122||0xcc;return function(_0x1da9bf){if(_0x1da9bf){return _0x475d40[_0x1788('0x18')](_0x2d0122);}return _0x475d40[_0x1788('0x19')](_0x2d0122)[_0x1788('0x1a')]();};}function respondWithResult(_0x91a4b1,_0x60252e){_0x60252e=_0x60252e||0xc8;return function(_0x458a26){if(_0x458a26){return _0x91a4b1[_0x1788('0x19')](_0x60252e)[_0x1788('0x1b')](_0x458a26);}};}function respondWithFilteredResult(_0x857d75,_0x8b01f5){return function(_0x148554){if(_0x148554){var _0x10a87e=typeof _0x8b01f5[_0x1788('0x1c')]==='undefined'&&typeof _0x8b01f5[_0x1788('0x1d')]===_0x1788('0x1e');var _0x3e4a99=_0x148554['count'];var _0x177448=_0x10a87e?0x0:_0x8b01f5[_0x1788('0x1c')];var _0x38b00f=_0x10a87e?_0x148554[_0x1788('0x1f')]:_0x8b01f5[_0x1788('0x1c')]+_0x8b01f5[_0x1788('0x1d')];var _0x1d3b40;if(_0x38b00f>=_0x3e4a99){_0x38b00f=_0x3e4a99;_0x1d3b40=0xc8;}else{_0x1d3b40=0xce;}_0x857d75[_0x1788('0x19')](_0x1d3b40);return _0x857d75['set']('Content-Range',_0x177448+'-'+_0x38b00f+'/'+_0x3e4a99)['json'](_0x148554);}return null;};}function patchUpdates(_0x239beb){return function(_0x3ac73b){try{jsonpatch['apply'](_0x3ac73b,_0x239beb,!![]);}catch(_0x402c8a){return BPromise['reject'](_0x402c8a);}return _0x3ac73b[_0x1788('0x20')]();};}function saveUpdates(_0x1f89b1,_0x17abd){return function(_0x46ea39){if(_0x46ea39){return _0x46ea39['update'](_0x1f89b1)['then'](function(_0x391b96){return _0x391b96;});}return null;};}function removeEntity(_0x4ca62d,_0x36dc2f){return function(_0x210621){if(_0x210621){return _0x210621['destroy']()[_0x1788('0x21')](function(){_0x4ca62d[_0x1788('0x19')](0xcc)[_0x1788('0x1a')]();});}};}function handleEntityNotFound(_0x2a9143,_0x95dd09){return function(_0x11ef1f){if(!_0x11ef1f){_0x2a9143[_0x1788('0x18')](0x194);}return _0x11ef1f;};}function handleError(_0x47ee99,_0xfe08ed){_0xfe08ed=_0xfe08ed||0x1f4;return function(_0x291681){logger[_0x1788('0x22')](_0x291681[_0x1788('0x23')]);if(_0x291681[_0x1788('0x24')]){delete _0x291681[_0x1788('0x24')];}_0x47ee99[_0x1788('0x19')](_0xfe08ed)[_0x1788('0x25')](_0x291681);};}exports[_0x1788('0x26')]=function(_0x26b21a,_0x11d9d0){var _0x47b6dd={},_0x585686={},_0x391f06={'count':0x0,'rows':[]};var _0x5d1743=_['map'](db['SalesforceConfiguration'][_0x1788('0x27')],function(_0x235b9e){return{'name':_0x235b9e['fieldName'],'type':_0x235b9e[_0x1788('0x28')][_0x1788('0x29')]};});_0x585686[_0x1788('0x2a')]=_[_0x1788('0x2b')](_0x5d1743,'name');_0x585686[_0x1788('0x2c')]=_[_0x1788('0x2d')](_0x26b21a[_0x1788('0x2c')]);_0x585686[_0x1788('0x2e')]=_[_0x1788('0x2f')](_0x585686['model'],_0x585686[_0x1788('0x2c')]);_0x47b6dd[_0x1788('0x30')]=_[_0x1788('0x2f')](_0x585686[_0x1788('0x2a')],qs[_0x1788('0x31')](_0x26b21a[_0x1788('0x2c')][_0x1788('0x31')]));_0x47b6dd['attributes']=_0x47b6dd[_0x1788('0x30')][_0x1788('0x32')]?_0x47b6dd[_0x1788('0x30')]:_0x585686['model'];if(!_0x26b21a[_0x1788('0x2c')][_0x1788('0x33')](_0x1788('0x34'))){_0x47b6dd[_0x1788('0x1d')]=qs[_0x1788('0x1d')](_0x26b21a[_0x1788('0x2c')][_0x1788('0x1d')]);_0x47b6dd[_0x1788('0x1c')]=qs['offset'](_0x26b21a['query'][_0x1788('0x1c')]);}_0x47b6dd['order']=qs['sort'](_0x26b21a[_0x1788('0x2c')][_0x1788('0x35')]);_0x47b6dd[_0x1788('0x36')]=qs[_0x1788('0x2e')](_[_0x1788('0x37')](_0x26b21a[_0x1788('0x2c')],_0x585686[_0x1788('0x2e')]),_0x5d1743);if(_0x26b21a['query'][_0x1788('0x38')]){_0x47b6dd[_0x1788('0x36')]=_['merge'](_0x47b6dd[_0x1788('0x36')],{'$or':_[_0x1788('0x2b')](_0x5d1743,function(_0x3299fc){if(_0x3299fc['type']!==_0x1788('0x39')){var _0x35d04c={};_0x35d04c[_0x3299fc[_0x1788('0x24')]]={'$like':'%'+_0x26b21a[_0x1788('0x2c')][_0x1788('0x38')]+'%'};return _0x35d04c;}})});}_0x47b6dd=_[_0x1788('0x3a')]({},_0x47b6dd,_0x26b21a['options']);var _0x155f3e={'where':_0x47b6dd['where']};return db[_0x1788('0x3b')][_0x1788('0x1f')](_0x155f3e)[_0x1788('0x21')](function(_0xe46f1f){_0x391f06[_0x1788('0x1f')]=_0xe46f1f;if(_0x26b21a[_0x1788('0x2c')]['includeAll']){_0x47b6dd[_0x1788('0x3c')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x1788('0x3d')](_0x47b6dd);})[_0x1788('0x21')](function(_0x196f9e){_0x391f06[_0x1788('0x3e')]=_0x196f9e;return _0x391f06;})[_0x1788('0x21')](respondWithFilteredResult(_0x11d9d0,_0x47b6dd))['catch'](handleError(_0x11d9d0,null));};exports[_0x1788('0x3f')]=function(_0x1b08f6,_0x292e7e){var _0x467155={'raw':![],'where':{'id':_0x1b08f6['params']['id']}},_0x1276e2={};_0x1276e2[_0x1788('0x2a')]=_['keys'](db[_0x1788('0x3b')]['rawAttributes']);_0x1276e2[_0x1788('0x2c')]=_[_0x1788('0x2d')](_0x1b08f6['query']);_0x1276e2[_0x1788('0x2e')]=_[_0x1788('0x2f')](_0x1276e2[_0x1788('0x2a')],_0x1276e2[_0x1788('0x2c')]);_0x467155[_0x1788('0x30')]=_[_0x1788('0x2f')](_0x1276e2['model'],qs[_0x1788('0x31')](_0x1b08f6[_0x1788('0x2c')][_0x1788('0x31')]));_0x467155['attributes']=_0x467155[_0x1788('0x30')][_0x1788('0x32')]?_0x467155[_0x1788('0x30')]:_0x1276e2['model'];if(_0x1b08f6[_0x1788('0x2c')][_0x1788('0x40')]){_0x467155['include']=[{'all':!![]}];}_0x467155=_['merge']({},_0x467155,_0x1b08f6[_0x1788('0x41')]);return db['SalesforceConfiguration'][_0x1788('0x42')](_0x467155)[_0x1788('0x21')](handleEntityNotFound(_0x292e7e,null))[_0x1788('0x21')](respondWithResult(_0x292e7e,null))[_0x1788('0x43')](handleError(_0x292e7e,null));};exports[_0x1788('0x44')]=function(_0x5e1d31,_0x2e38f4){return db[_0x1788('0x3b')]['create'](_0x5e1d31[_0x1788('0x45')],{})[_0x1788('0x21')](respondWithResult(_0x2e38f4,0xc9))['catch'](handleError(_0x2e38f4,null));};exports['update']=function(_0x4229d0,_0x3b273c){if(_0x4229d0[_0x1788('0x45')]['id']){delete _0x4229d0[_0x1788('0x45')]['id'];}return db[_0x1788('0x3b')][_0x1788('0x42')]({'where':{'id':_0x4229d0[_0x1788('0x46')]['id']}})[_0x1788('0x21')](handleEntityNotFound(_0x3b273c,null))[_0x1788('0x21')](saveUpdates(_0x4229d0['body'],null))['then'](respondWithResult(_0x3b273c,null))['catch'](handleError(_0x3b273c,null));};exports['destroy']=function(_0x273072,_0x5a28cc){return db[_0x1788('0x3b')][_0x1788('0x42')]({'where':{'id':_0x273072['params']['id']}})[_0x1788('0x21')](handleEntityNotFound(_0x5a28cc,null))[_0x1788('0x21')](removeEntity(_0x5a28cc,null))['catch'](handleError(_0x5a28cc,null));};exports[_0x1788('0x47')]=function(_0x41ab59,_0x256d87,_0x2ab260){var _0x3bbba4={};var _0x531e5c={};var _0x56fcd3;var _0x3609fd;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x41ab59[_0x1788('0x46')]['id']}})[_0x1788('0x21')](handleEntityNotFound(_0x256d87,null))['then'](function(_0x19dc6f){if(_0x19dc6f){_0x56fcd3=_0x19dc6f;_0x531e5c['model']=_[_0x1788('0x2d')](db['SalesforceField'][_0x1788('0x27')]);_0x531e5c['query']=_[_0x1788('0x2d')](_0x41ab59[_0x1788('0x2c')]);_0x531e5c[_0x1788('0x2e')]=_[_0x1788('0x2f')](_0x531e5c[_0x1788('0x2a')],_0x531e5c['query']);_0x3bbba4[_0x1788('0x30')]=_[_0x1788('0x2f')](_0x531e5c[_0x1788('0x2a')],qs[_0x1788('0x31')](_0x41ab59['query'][_0x1788('0x31')]));_0x3bbba4[_0x1788('0x30')]=_0x3bbba4[_0x1788('0x30')][_0x1788('0x32')]?_0x3bbba4[_0x1788('0x30')]:_0x531e5c[_0x1788('0x2a')];_0x3bbba4[_0x1788('0x48')]=qs[_0x1788('0x35')](_0x41ab59[_0x1788('0x2c')][_0x1788('0x35')]);_0x3bbba4[_0x1788('0x36')]=qs[_0x1788('0x2e')](_[_0x1788('0x37')](_0x41ab59['query'],_0x531e5c['filters']));if(_0x41ab59[_0x1788('0x2c')][_0x1788('0x38')]){_0x3bbba4['where']=_['merge'](_0x3bbba4['where'],{'$or':_['map'](_0x3bbba4[_0x1788('0x30')],function(_0x40c356){var _0x5014f3={};_0x5014f3[_0x40c356]={'$like':'%'+_0x41ab59['query'][_0x1788('0x38')]+'%'};return _0x5014f3;})});}_0x3bbba4=_[_0x1788('0x3a')]({},_0x3bbba4,_0x41ab59[_0x1788('0x41')]);return _0x56fcd3[_0x1788('0x47')](_0x3bbba4);}})[_0x1788('0x21')](function(_0x5d9cf6){if(_0x5d9cf6){_0x3609fd=_0x5d9cf6[_0x1788('0x32')];if(!_0x41ab59[_0x1788('0x2c')][_0x1788('0x33')]('nolimit')){_0x3bbba4['limit']=qs['limit'](_0x41ab59[_0x1788('0x2c')][_0x1788('0x1d')]);_0x3bbba4[_0x1788('0x1c')]=qs[_0x1788('0x1c')](_0x41ab59['query'][_0x1788('0x1c')]);}return _0x56fcd3['getFields'](_0x3bbba4);}})[_0x1788('0x21')](function(_0x18705b){if(_0x18705b){return _0x18705b?{'count':_0x3609fd,'rows':_0x18705b}:null;}})[_0x1788('0x21')](respondWithResult(_0x256d87,null))['catch'](handleError(_0x256d87,null));};exports[_0x1788('0x49')]=function(_0x418d65,_0xb77ab8,_0x4a8a6d){var _0x41f2d6={};var _0x34de43={};var _0x4240b2;var _0x1fca8a;return db[_0x1788('0x3b')][_0x1788('0x4a')]({'where':{'id':_0x418d65[_0x1788('0x46')]['id']}})[_0x1788('0x21')](handleEntityNotFound(_0xb77ab8,null))[_0x1788('0x21')](function(_0x588d12){if(_0x588d12){_0x4240b2=_0x588d12;_0x34de43[_0x1788('0x2a')]=_['keys'](db[_0x1788('0x4b')][_0x1788('0x27')]);_0x34de43['query']=_[_0x1788('0x2d')](_0x418d65[_0x1788('0x2c')]);_0x34de43[_0x1788('0x2e')]=_[_0x1788('0x2f')](_0x34de43[_0x1788('0x2a')],_0x34de43['query']);_0x41f2d6[_0x1788('0x30')]=_[_0x1788('0x2f')](_0x34de43[_0x1788('0x2a')],qs[_0x1788('0x31')](_0x418d65[_0x1788('0x2c')][_0x1788('0x31')]));_0x41f2d6[_0x1788('0x30')]=_0x41f2d6[_0x1788('0x30')][_0x1788('0x32')]?_0x41f2d6['attributes']:_0x34de43['model'];_0x41f2d6['order']=qs['sort'](_0x418d65[_0x1788('0x2c')][_0x1788('0x35')]);_0x41f2d6[_0x1788('0x36')]=qs[_0x1788('0x2e')](_[_0x1788('0x37')](_0x418d65[_0x1788('0x2c')],_0x34de43['filters']));if(_0x418d65[_0x1788('0x2c')][_0x1788('0x38')]){_0x41f2d6[_0x1788('0x36')]=_['merge'](_0x41f2d6[_0x1788('0x36')],{'$or':_['map'](_0x41f2d6[_0x1788('0x30')],function(_0x5d196d){var _0x88c527={};_0x88c527[_0x5d196d]={'$like':'%'+_0x418d65[_0x1788('0x2c')]['filter']+'%'};return _0x88c527;})});}_0x41f2d6=_[_0x1788('0x3a')]({},_0x41f2d6,_0x418d65[_0x1788('0x41')]);return _0x4240b2['getSubjects'](_0x41f2d6);}})[_0x1788('0x21')](function(_0x664db6){if(_0x664db6){_0x1fca8a=_0x664db6['length'];if(!_0x418d65[_0x1788('0x2c')][_0x1788('0x33')](_0x1788('0x34'))){_0x41f2d6['limit']=qs['limit'](_0x418d65[_0x1788('0x2c')][_0x1788('0x1d')]);_0x41f2d6[_0x1788('0x1c')]=qs[_0x1788('0x1c')](_0x418d65['query'][_0x1788('0x1c')]);}return _0x4240b2['getSubjects'](_0x41f2d6);}})['then'](function(_0x211310){if(_0x211310){return _0x211310?{'count':_0x1fca8a,'rows':_0x211310}:null;}})[_0x1788('0x21')](respondWithResult(_0xb77ab8,null))[_0x1788('0x43')](handleError(_0xb77ab8,null));};exports[_0x1788('0x4c')]=function(_0x4a375a,_0x58d214,_0x1edfaa){var _0xf149dd={};var _0x8d0ca0={};var _0x230803;var _0x5db0fa;return db[_0x1788('0x3b')]['findOne']({'where':{'id':_0x4a375a['params']['id']}})['then'](handleEntityNotFound(_0x58d214,null))['then'](function(_0x12a050){if(_0x12a050){_0x230803=_0x12a050;_0x8d0ca0['model']=_[_0x1788('0x2d')](db[_0x1788('0x4b')]['rawAttributes']);_0x8d0ca0[_0x1788('0x2c')]=_[_0x1788('0x2d')](_0x4a375a[_0x1788('0x2c')]);_0x8d0ca0[_0x1788('0x2e')]=_[_0x1788('0x2f')](_0x8d0ca0['model'],_0x8d0ca0[_0x1788('0x2c')]);_0xf149dd[_0x1788('0x30')]=_['intersection'](_0x8d0ca0[_0x1788('0x2a')],qs[_0x1788('0x31')](_0x4a375a['query']['fields']));_0xf149dd[_0x1788('0x30')]=_0xf149dd['attributes'][_0x1788('0x32')]?_0xf149dd[_0x1788('0x30')]:_0x8d0ca0[_0x1788('0x2a')];_0xf149dd[_0x1788('0x48')]=qs[_0x1788('0x35')](_0x4a375a[_0x1788('0x2c')]['sort']);_0xf149dd[_0x1788('0x36')]=qs[_0x1788('0x2e')](_[_0x1788('0x37')](_0x4a375a[_0x1788('0x2c')],_0x8d0ca0[_0x1788('0x2e')]));if(_0x4a375a['query'][_0x1788('0x38')]){_0xf149dd[_0x1788('0x36')]=_[_0x1788('0x3a')](_0xf149dd['where'],{'$or':_[_0x1788('0x2b')](_0xf149dd[_0x1788('0x30')],function(_0x4e18af){var _0x35fea0={};_0x35fea0[_0x4e18af]={'$like':'%'+_0x4a375a[_0x1788('0x2c')][_0x1788('0x38')]+'%'};return _0x35fea0;})});}_0xf149dd=_[_0x1788('0x3a')]({},_0xf149dd,_0x4a375a[_0x1788('0x41')]);return _0x230803[_0x1788('0x4c')](_0xf149dd);}})['then'](function(_0x157bb5){if(_0x157bb5){_0x5db0fa=_0x157bb5[_0x1788('0x32')];if(!_0x4a375a[_0x1788('0x2c')]['hasOwnProperty']('nolimit')){_0xf149dd['limit']=qs[_0x1788('0x1d')](_0x4a375a[_0x1788('0x2c')]['limit']);_0xf149dd['offset']=qs[_0x1788('0x1c')](_0x4a375a[_0x1788('0x2c')][_0x1788('0x1c')]);}return _0x230803[_0x1788('0x4c')](_0xf149dd);}})['then'](function(_0x106723){if(_0x106723){return _0x106723?{'count':_0x5db0fa,'rows':_0x106723}:null;}})['then'](respondWithResult(_0x58d214,null))[_0x1788('0x43')](handleError(_0x58d214,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 19c747e..25f3f6f 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 _0x9044=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x308a9c,_0x1caa8a){var _0x1b2728=function(_0x1bd9ec){while(--_0x1bd9ec){_0x308a9c['push'](_0x308a9c['shift']());}};_0x1b2728(++_0x1caa8a);}(_0x9044,0x87));var _0x4904=function(_0x995239,_0x5d4841){_0x995239=_0x995239-0x0;var _0xa968b5=_0x9044[_0x995239];return _0xa968b5;};'use strict';var _=require(_0x4904('0x0'));var util=require(_0x4904('0x1'));var logger=require(_0x4904('0x2'))(_0x4904('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4904('0x4'));var fs=require('fs');var path=require(_0x4904('0x5'));var rimraf=require(_0x4904('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4904('0x7')]=function(_0x52fbad,_0x18b78f){return _0x52fbad[_0x4904('0x8')](_0x4904('0x9'),attributes,{'tableName':_0x4904('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7535=['define','SalesforceConfiguration','lodash','bluebird','rimraf','../../config/environment','exports'];(function(_0x12d2b1,_0x1215e5){var _0x51e1a0=function(_0x2a46ce){while(--_0x2a46ce){_0x12d2b1['push'](_0x12d2b1['shift']());}};_0x51e1a0(++_0x1215e5);}(_0x7535,0x13d));var _0x5753=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x7535[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x5753('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5753('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5753('0x2'));var config=require(_0x5753('0x3'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x5753('0x4')]=function(_0xc3cd17,_0x3e52ee){return _0xc3cd17[_0x5753('0x5')](_0x5753('0x6'),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 f010646..8f845c1 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 _0x3694=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x436edf,_0x50ba4a){var _0x5087fb=function(_0x49fdd2){while(--_0x49fdd2){_0x436edf['push'](_0x436edf['shift']());}};_0x5087fb(++_0x50ba4a);}(_0x3694,0x17a));var _0x4369=function(_0x9ce343,_0x3f5bb9){_0x9ce343=_0x9ce343-0x0;var _0x4ddff0=_0x3694[_0x9ce343];return _0x4ddff0;};'use strict';var _=require('lodash');var util=require(_0x4369('0x0'));var moment=require(_0x4369('0x1'));var BPromise=require(_0x4369('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4369('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4369('0x4'));var logger=require(_0x4369('0x5'))(_0x4369('0x6'));var config=require(_0x4369('0x7'));var jayson=require(_0x4369('0x8'));var client=jayson['client'][_0x4369('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd040,_0x344915,_0x51db26){return new BPromise(function(_0x2a5e75,_0x652c03){return client[_0x4369('0xa')](_0x2fd040,_0x51db26)[_0x4369('0xb')](function(_0x1a1a98){logger[_0x4369('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x344915,_0x4369('0xd'));logger[_0x4369('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x344915,_0x4369('0xd'),JSON[_0x4369('0xf')](_0x1a1a98));if(_0x1a1a98[_0x4369('0x10')]){if(_0x1a1a98[_0x4369('0x10')]['code']===0x1f4){logger[_0x4369('0x10')](_0x4369('0x11'),_0x344915,_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);return _0x652c03(_0x1a1a98[_0x4369('0x10')]['message']);}logger[_0x4369('0x10')](_0x4369('0x11'),_0x344915,_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);return _0x2a5e75(_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);}else{logger[_0x4369('0xc')](_0x4369('0x11'),_0x344915,'request\x20sent');_0x2a5e75(_0x1a1a98[_0x4369('0x13')][_0x4369('0x12')]);}})[_0x4369('0x14')](function(_0x105af1){logger['error'](_0x4369('0x11'),_0x344915,_0x105af1);_0x652c03(_0x105af1);});});} \ No newline at end of file +var _0xf32f=['catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5d35c4,_0x594f71){var _0x5f5898=function(_0x5b1f57){while(--_0x5b1f57){_0x5d35c4['push'](_0x5d35c4['shift']());}};_0x5f5898(++_0x594f71);}(_0xf32f,0xdd));var _0xff32=function(_0xd5da2a,_0x25ba44){_0xd5da2a=_0xd5da2a-0x0;var _0x3babbd=_0xf32f[_0xd5da2a];return _0x3babbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff32('0x0'));var BPromise=require(_0xff32('0x1'));var rs=require(_0xff32('0x2'));var fs=require('fs');var Redis=require(_0xff32('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xff32('0x4'));var logger=require(_0xff32('0x5'))(_0xff32('0x6'));var config=require(_0xff32('0x7'));var jayson=require(_0xff32('0x8'));var client=jayson[_0xff32('0x9')][_0xff32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6191,_0x515161,_0x39fdc9){return new BPromise(function(_0x57fc84,_0x333a36){return client[_0xff32('0xb')](_0x3a6191,_0x39fdc9)[_0xff32('0xc')](function(_0x1afbf8){logger[_0xff32('0xd')](_0xff32('0xe'),_0x515161,_0xff32('0xf'));logger[_0xff32('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x515161,_0xff32('0xf'),JSON[_0xff32('0x11')](_0x1afbf8));if(_0x1afbf8[_0xff32('0x12')]){if(_0x1afbf8[_0xff32('0x12')]['code']===0x1f4){logger[_0xff32('0x12')](_0xff32('0xe'),_0x515161,_0x1afbf8[_0xff32('0x12')][_0xff32('0x13')]);return _0x333a36(_0x1afbf8[_0xff32('0x12')][_0xff32('0x13')]);}logger[_0xff32('0x12')](_0xff32('0xe'),_0x515161,_0x1afbf8[_0xff32('0x12')][_0xff32('0x13')]);return _0x57fc84(_0x1afbf8[_0xff32('0x12')][_0xff32('0x13')]);}else{logger[_0xff32('0xd')](_0xff32('0xe'),_0x515161,_0xff32('0xf'));_0x57fc84(_0x1afbf8[_0xff32('0x14')][_0xff32('0x13')]);}})[_0xff32('0x15')](function(_0x1e0c5d){logger['error'](_0xff32('0xe'),_0x515161,_0x1e0c5d);_0x333a36(_0x1e0c5d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 371c857..09f5873 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 _0xd0d0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','update','delete','destroy','multer','util','path'];(function(_0x4687e4,_0x2d12f1){var _0x927c22=function(_0x2a87cb){while(--_0x2a87cb){_0x4687e4['push'](_0x4687e4['shift']());}};_0x927c22(++_0x2d12f1);}(_0xd0d0,0x1d1));var _0x0d0d=function(_0x53fb06,_0x523c8b){_0x53fb06=_0x53fb06-0x0;var _0x4a8bad=_0xd0d0[_0x53fb06];return _0x4a8bad;};'use strict';var multer=require(_0x0d0d('0x0'));var util=require(_0x0d0d('0x1'));var path=require(_0x0d0d('0x2'));var timeout=require(_0x0d0d('0x3'));var express=require(_0x0d0d('0x4'));var router=express[_0x0d0d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0d0d('0x6'));var interaction=require(_0x0d0d('0x7'));var config=require(_0x0d0d('0x8'));var controller=require(_0x0d0d('0x9'));router[_0x0d0d('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d0d('0xb')]);router[_0x0d0d('0xa')](_0x0d0d('0xc'),auth[_0x0d0d('0xd')](),controller['show']);router['post']('/',auth[_0x0d0d('0xd')](),controller[_0x0d0d('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0d0d('0xf')]);router[_0x0d0d('0x10')](_0x0d0d('0xc'),auth['isAuthenticated'](),controller[_0x0d0d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8216=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x43ff43,_0x7893a3){var _0x360cda=function(_0x5005df){while(--_0x5005df){_0x43ff43['push'](_0x43ff43['shift']());}};_0x360cda(++_0x7893a3);}(_0x8216,0x1c2));var _0x6821=function(_0x1ca155,_0x1c31e2){_0x1ca155=_0x1ca155-0x0;var _0x25320c=_0x8216[_0x1ca155];return _0x25320c;};'use strict';var multer=require(_0x6821('0x0'));var util=require(_0x6821('0x1'));var path=require(_0x6821('0x2'));var timeout=require(_0x6821('0x3'));var express=require(_0x6821('0x4'));var router=express['Router']();var fs_extra=require(_0x6821('0x5'));var auth=require(_0x6821('0x6'));var interaction=require(_0x6821('0x7'));var config=require(_0x6821('0x8'));var controller=require(_0x6821('0x9'));router[_0x6821('0xa')]('/',auth[_0x6821('0xb')](),controller[_0x6821('0xc')]);router[_0x6821('0xa')](_0x6821('0xd'),auth['isAuthenticated'](),controller[_0x6821('0xe')]);router[_0x6821('0xf')]('/',auth[_0x6821('0xb')](),controller['create']);router['put']('/:id',auth[_0x6821('0xb')](),controller[_0x6821('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6821('0x11')]);module[_0x6821('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c1baf2a..0488bb1 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 _0x8a0c=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x1230f6,_0x334699){var _0x964bc=function(_0x553c6b){while(--_0x553c6b){_0x1230f6['push'](_0x1230f6['shift']());}};_0x964bc(++_0x334699);}(_0x8a0c,0x1ac));var _0xc8a0=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8a0c[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0xc8a0('0x0'));module[_0xc8a0('0x1')]={'type':{'type':Sequelize[_0xc8a0('0x2')](_0xc8a0('0x3'),_0xc8a0('0x4'),'customVariable',_0xc8a0('0x5'),'picklist'),'defaultValue':_0xc8a0('0x3')},'content':{'type':Sequelize[_0xc8a0('0x6')]},'key':{'type':Sequelize[_0xc8a0('0x6')]},'keyType':{'type':Sequelize[_0xc8a0('0x2')]('string',_0xc8a0('0x4'),_0xc8a0('0x7'))},'keyContent':{'type':Sequelize[_0xc8a0('0x6')]},'idField':{'type':Sequelize[_0xc8a0('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc592=['string','variable','customVariable','keyValue','STRING','ENUM','sequelize','exports'];(function(_0x2d034d,_0x532a40){var _0x286474=function(_0x17d07c){while(--_0x17d07c){_0x2d034d['push'](_0x2d034d['shift']());}};_0x286474(++_0x532a40);}(_0xc592,0x1de));var _0x2c59=function(_0x8228fd,_0x54165d){_0x8228fd=_0x8228fd-0x0;var _0x20f797=_0xc592[_0x8228fd];return _0x20f797;};'use strict';var Sequelize=require(_0x2c59('0x0'));module[_0x2c59('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2c59('0x2'),_0x2c59('0x3'),_0x2c59('0x4'),_0x2c59('0x5'),'picklist'),'defaultValue':_0x2c59('0x2')},'content':{'type':Sequelize[_0x2c59('0x6')]},'key':{'type':Sequelize[_0x2c59('0x6')]},'keyType':{'type':Sequelize[_0x2c59('0x7')](_0x2c59('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2c59('0x6')]},'variableName':{'type':Sequelize[_0x2c59('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 22d7117..3940ba9 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 _0x6465=['path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1e44ac,_0x1d99ab){var _0x19d8cd=function(_0x37ce84){while(--_0x37ce84){_0x1e44ac['push'](_0x1e44ac['shift']());}};_0x19d8cd(++_0x1d99ab);}(_0x6465,0x16f));var _0x5646=function(_0x236f5a,_0xe33e5c){_0x236f5a=_0x236f5a-0x0;var _0xb19e4b=_0x6465[_0x236f5a];return _0xb19e4b;};'use strict';var emlformat=require(_0x5646('0x0'));var rimraf=require(_0x5646('0x1'));var zipdir=require(_0x5646('0x2'));var jsonpatch=require(_0x5646('0x3'));var rp=require(_0x5646('0x4'));var moment=require('moment');var BPromise=require(_0x5646('0x5'));var Mustache=require(_0x5646('0x6'));var util=require(_0x5646('0x7'));var path=require(_0x5646('0x8'));var sox=require(_0x5646('0x9'));var csv=require(_0x5646('0xa'));var ejs=require(_0x5646('0xb'));var fs=require('fs');var fs_extra=require(_0x5646('0xc'));var _=require('lodash');var squel=require(_0x5646('0xd'));var crypto=require(_0x5646('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5646('0xf'));var toCsv=require(_0x5646('0xa'));var querystring=require(_0x5646('0x10'));var Papa=require('papaparse');var Redis=require(_0x5646('0x11'));var authService=require(_0x5646('0x12'));var qs=require(_0x5646('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5646('0x14'));var logger=require(_0x5646('0x15'))(_0x5646('0x16'));var utils=require('../../config/utils');var config=require(_0x5646('0x17'));var licenseUtil=require(_0x5646('0x18'));var db=require(_0x5646('0x19'))['db'];function respondWithStatusCode(_0x4f4326,_0x24024f){_0x24024f=_0x24024f||0xcc;return function(_0x5b9be6){if(_0x5b9be6){return _0x4f4326[_0x5646('0x1a')](_0x24024f);}return _0x4f4326[_0x5646('0x1b')](_0x24024f)[_0x5646('0x1c')]();};}function respondWithResult(_0x1c3b8c,_0x42f8aa){_0x42f8aa=_0x42f8aa||0xc8;return function(_0x1c775c){if(_0x1c775c){return _0x1c3b8c[_0x5646('0x1b')](_0x42f8aa)[_0x5646('0x1d')](_0x1c775c);}};}function respondWithFilteredResult(_0x1e960a,_0x578a04){return function(_0x4d82d6){if(_0x4d82d6){var _0x5cafc4=typeof _0x578a04[_0x5646('0x1e')]==='undefined'&&typeof _0x578a04['limit']===_0x5646('0x1f');var _0x10db02=_0x4d82d6[_0x5646('0x20')];var _0x25bf89=_0x5cafc4?0x0:_0x578a04[_0x5646('0x1e')];var _0x2a1834=_0x5cafc4?_0x4d82d6['count']:_0x578a04[_0x5646('0x1e')]+_0x578a04[_0x5646('0x21')];var _0x38584b;if(_0x2a1834>=_0x10db02){_0x2a1834=_0x10db02;_0x38584b=0xc8;}else{_0x38584b=0xce;}_0x1e960a[_0x5646('0x1b')](_0x38584b);return _0x1e960a[_0x5646('0x22')](_0x5646('0x23'),_0x25bf89+'-'+_0x2a1834+'/'+_0x10db02)['json'](_0x4d82d6);}return null;};}function patchUpdates(_0x405f25){return function(_0x50faf7){try{jsonpatch[_0x5646('0x24')](_0x50faf7,_0x405f25,!![]);}catch(_0x5844a0){return BPromise[_0x5646('0x25')](_0x5844a0);}return _0x50faf7[_0x5646('0x26')]();};}function saveUpdates(_0x204b6d,_0x328c8a){return function(_0x237f7a){if(_0x237f7a){return _0x237f7a[_0x5646('0x27')](_0x204b6d)[_0x5646('0x28')](function(_0x222406){return _0x222406;});}return null;};}function removeEntity(_0x579ab4,_0x5464bc){return function(_0x47f632){if(_0x47f632){return _0x47f632[_0x5646('0x29')]()[_0x5646('0x28')](function(){_0x579ab4[_0x5646('0x1b')](0xcc)[_0x5646('0x1c')]();});}};}function handleEntityNotFound(_0x458736,_0x5dbd06){return function(_0x2868df){if(!_0x2868df){_0x458736['sendStatus'](0x194);}return _0x2868df;};}function handleError(_0xda5294,_0x32b3e7){_0x32b3e7=_0x32b3e7||0x1f4;return function(_0x5f118a){logger[_0x5646('0x2a')](_0x5f118a[_0x5646('0x2b')]);if(_0x5f118a[_0x5646('0x2c')]){delete _0x5f118a[_0x5646('0x2c')];}_0xda5294['status'](_0x32b3e7)[_0x5646('0x2d')](_0x5f118a);};}exports['index']=function(_0x2ea13d,_0x303f64){var _0x399ede={},_0x588938={},_0x2a55f4={'count':0x0,'rows':[]};var _0x53fdd9=_[_0x5646('0x2e')](db[_0x5646('0x2f')][_0x5646('0x30')],function(_0xd80614){return{'name':_0xd80614[_0x5646('0x31')],'type':_0xd80614[_0x5646('0x32')]['key']};});_0x588938[_0x5646('0x33')]=_['map'](_0x53fdd9,'name');_0x588938[_0x5646('0x34')]=_[_0x5646('0x35')](_0x2ea13d[_0x5646('0x34')]);_0x588938[_0x5646('0x36')]=_['intersection'](_0x588938[_0x5646('0x33')],_0x588938[_0x5646('0x34')]);_0x399ede[_0x5646('0x37')]=_[_0x5646('0x38')](_0x588938[_0x5646('0x33')],qs[_0x5646('0x39')](_0x2ea13d[_0x5646('0x34')]['fields']));_0x399ede[_0x5646('0x37')]=_0x399ede[_0x5646('0x37')][_0x5646('0x3a')]?_0x399ede[_0x5646('0x37')]:_0x588938[_0x5646('0x33')];if(!_0x2ea13d[_0x5646('0x34')][_0x5646('0x3b')](_0x5646('0x3c'))){_0x399ede['limit']=qs['limit'](_0x2ea13d['query']['limit']);_0x399ede[_0x5646('0x1e')]=qs[_0x5646('0x1e')](_0x2ea13d[_0x5646('0x34')][_0x5646('0x1e')]);}_0x399ede['order']=qs[_0x5646('0x3d')](_0x2ea13d[_0x5646('0x34')][_0x5646('0x3d')]);_0x399ede[_0x5646('0x3e')]=qs['filters'](_[_0x5646('0x3f')](_0x2ea13d[_0x5646('0x34')],_0x588938['filters']),_0x53fdd9);if(_0x2ea13d[_0x5646('0x34')][_0x5646('0x40')]){_0x399ede[_0x5646('0x3e')]=_[_0x5646('0x41')](_0x399ede[_0x5646('0x3e')],{'$or':_['map'](_0x53fdd9,function(_0x2a79b5){if(_0x2a79b5[_0x5646('0x32')]!==_0x5646('0x42')){var _0x4af367={};_0x4af367[_0x2a79b5[_0x5646('0x2c')]]={'$like':'%'+_0x2ea13d['query'][_0x5646('0x40')]+'%'};return _0x4af367;}})});}_0x399ede=_[_0x5646('0x41')]({},_0x399ede,_0x2ea13d[_0x5646('0x43')]);var _0x295ec7={'where':_0x399ede['where']};return db[_0x5646('0x2f')][_0x5646('0x20')](_0x295ec7)[_0x5646('0x28')](function(_0x4d3f34){_0x2a55f4['count']=_0x4d3f34;if(_0x2ea13d[_0x5646('0x34')]['includeAll']){_0x399ede['include']=[{'all':!![]}];}return db[_0x5646('0x2f')]['findAll'](_0x399ede);})[_0x5646('0x28')](function(_0x325394){_0x2a55f4[_0x5646('0x44')]=_0x325394;return _0x2a55f4;})['then'](respondWithFilteredResult(_0x303f64,_0x399ede))['catch'](handleError(_0x303f64,null));};exports['show']=function(_0x3fc053,_0x3559f3){var _0x8f4c06={'raw':!![],'where':{'id':_0x3fc053[_0x5646('0x45')]['id']}},_0x31ae00={};_0x31ae00[_0x5646('0x33')]=_[_0x5646('0x35')](db['SalesforceField'][_0x5646('0x30')]);_0x31ae00[_0x5646('0x34')]=_[_0x5646('0x35')](_0x3fc053[_0x5646('0x34')]);_0x31ae00[_0x5646('0x36')]=_['intersection'](_0x31ae00['model'],_0x31ae00[_0x5646('0x34')]);_0x8f4c06['attributes']=_[_0x5646('0x38')](_0x31ae00[_0x5646('0x33')],qs['fields'](_0x3fc053[_0x5646('0x34')][_0x5646('0x39')]));_0x8f4c06['attributes']=_0x8f4c06[_0x5646('0x37')][_0x5646('0x3a')]?_0x8f4c06[_0x5646('0x37')]:_0x31ae00['model'];if(_0x3fc053[_0x5646('0x34')][_0x5646('0x46')]){_0x8f4c06['include']=[{'all':!![]}];}_0x8f4c06=_[_0x5646('0x41')]({},_0x8f4c06,_0x3fc053[_0x5646('0x43')]);return db['SalesforceField'][_0x5646('0x47')](_0x8f4c06)[_0x5646('0x28')](handleEntityNotFound(_0x3559f3,null))['then'](respondWithResult(_0x3559f3,null))[_0x5646('0x48')](handleError(_0x3559f3,null));};exports[_0x5646('0x49')]=function(_0x3d7852,_0x3e20aa){return db[_0x5646('0x2f')][_0x5646('0x49')](_0x3d7852[_0x5646('0x4a')],{})[_0x5646('0x28')](respondWithResult(_0x3e20aa,0xc9))['catch'](handleError(_0x3e20aa,null));};exports[_0x5646('0x27')]=function(_0x38967d,_0x131ae9){if(_0x38967d['body']['id']){delete _0x38967d['body']['id'];}return db[_0x5646('0x2f')][_0x5646('0x47')]({'where':{'id':_0x38967d['params']['id']}})['then'](handleEntityNotFound(_0x131ae9,null))[_0x5646('0x28')](saveUpdates(_0x38967d[_0x5646('0x4a')],null))[_0x5646('0x28')](respondWithResult(_0x131ae9,null))[_0x5646('0x48')](handleError(_0x131ae9,null));};exports['destroy']=function(_0x334bca,_0x269552){return db['SalesforceField']['find']({'where':{'id':_0x334bca[_0x5646('0x45')]['id']}})[_0x5646('0x28')](handleEntityNotFound(_0x269552,null))['then'](removeEntity(_0x269552,null))[_0x5646('0x48')](handleError(_0x269552,null));}; \ No newline at end of file +var _0x6f12=['ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','then','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','rows','params','keys','includeAll','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x455f91,_0x2d19da){var _0x38e919=function(_0x42d094){while(--_0x42d094){_0x455f91['push'](_0x455f91['shift']());}};_0x38e919(++_0x2d19da);}(_0x6f12,0x86));var _0x26f1=function(_0x2e6d0c,_0x14c856){_0x2e6d0c=_0x2e6d0c-0x0;var _0x180a6b=_0x6f12[_0x2e6d0c];return _0x180a6b;};'use strict';var emlformat=require(_0x26f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26f1('0x1'));var jsonpatch=require(_0x26f1('0x2'));var rp=require(_0x26f1('0x3'));var moment=require(_0x26f1('0x4'));var BPromise=require(_0x26f1('0x5'));var Mustache=require(_0x26f1('0x6'));var util=require(_0x26f1('0x7'));var path=require(_0x26f1('0x8'));var sox=require(_0x26f1('0x9'));var csv=require('to-csv');var ejs=require(_0x26f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26f1('0xb'));var squel=require(_0x26f1('0xc'));var crypto=require('crypto');var jsforce=require(_0x26f1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x26f1('0xe'));var Redis=require(_0x26f1('0xf'));var authService=require(_0x26f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x26f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26f1('0x12'))(_0x26f1('0x13'));var utils=require('../../config/utils');var config=require(_0x26f1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x26f1('0x15'))['db'];function respondWithStatusCode(_0xa0d2a6,_0x2cfb9c){_0x2cfb9c=_0x2cfb9c||0xcc;return function(_0x14136a){if(_0x14136a){return _0xa0d2a6['sendStatus'](_0x2cfb9c);}return _0xa0d2a6[_0x26f1('0x16')](_0x2cfb9c)[_0x26f1('0x17')]();};}function respondWithResult(_0x1478de,_0x2f88f4){_0x2f88f4=_0x2f88f4||0xc8;return function(_0x1bad0b){if(_0x1bad0b){return _0x1478de[_0x26f1('0x16')](_0x2f88f4)['json'](_0x1bad0b);}};}function respondWithFilteredResult(_0x4d9e05,_0x25fb47){return function(_0x3a36b9){if(_0x3a36b9){var _0x446c8b=typeof _0x25fb47[_0x26f1('0x18')]===_0x26f1('0x19')&&typeof _0x25fb47[_0x26f1('0x1a')]===_0x26f1('0x19');var _0x24523e=_0x3a36b9[_0x26f1('0x1b')];var _0x46e2a5=_0x446c8b?0x0:_0x25fb47[_0x26f1('0x18')];var _0x4d7aad=_0x446c8b?_0x3a36b9[_0x26f1('0x1b')]:_0x25fb47[_0x26f1('0x18')]+_0x25fb47[_0x26f1('0x1a')];var _0x205ccc;if(_0x4d7aad>=_0x24523e){_0x4d7aad=_0x24523e;_0x205ccc=0xc8;}else{_0x205ccc=0xce;}_0x4d9e05[_0x26f1('0x16')](_0x205ccc);return _0x4d9e05['set'](_0x26f1('0x1c'),_0x46e2a5+'-'+_0x4d7aad+'/'+_0x24523e)[_0x26f1('0x1d')](_0x3a36b9);}return null;};}function patchUpdates(_0x44b723){return function(_0x565b50){try{jsonpatch['apply'](_0x565b50,_0x44b723,!![]);}catch(_0xf0b049){return BPromise[_0x26f1('0x1e')](_0xf0b049);}return _0x565b50[_0x26f1('0x1f')]();};}function saveUpdates(_0x40d548,_0x166915){return function(_0x4bda56){if(_0x4bda56){return _0x4bda56['update'](_0x40d548)['then'](function(_0x53a6c6){return _0x53a6c6;});}return null;};}function removeEntity(_0x3c83e7,_0xca0c64){return function(_0x52a49a){if(_0x52a49a){return _0x52a49a[_0x26f1('0x20')]()[_0x26f1('0x21')](function(){_0x3c83e7[_0x26f1('0x16')](0xcc)[_0x26f1('0x17')]();});}};}function handleEntityNotFound(_0x18b009,_0x1cb5c0){return function(_0x517e27){if(!_0x517e27){_0x18b009[_0x26f1('0x22')](0x194);}return _0x517e27;};}function handleError(_0x18b2cf,_0x119454){_0x119454=_0x119454||0x1f4;return function(_0x2b6ba6){logger['error'](_0x2b6ba6[_0x26f1('0x23')]);if(_0x2b6ba6[_0x26f1('0x24')]){delete _0x2b6ba6[_0x26f1('0x24')];}_0x18b2cf[_0x26f1('0x16')](_0x119454)[_0x26f1('0x25')](_0x2b6ba6);};}exports[_0x26f1('0x26')]=function(_0x3e3d17,_0x1dc8cf){var _0x4cb959={},_0x2c10b7={},_0x2dba54={'count':0x0,'rows':[]};var _0x20ef68=_[_0x26f1('0x27')](db['SalesforceField']['rawAttributes'],function(_0x4de8fa){return{'name':_0x4de8fa[_0x26f1('0x28')],'type':_0x4de8fa[_0x26f1('0x29')][_0x26f1('0x2a')]};});_0x2c10b7[_0x26f1('0x2b')]=_[_0x26f1('0x27')](_0x20ef68,_0x26f1('0x24'));_0x2c10b7[_0x26f1('0x2c')]=_['keys'](_0x3e3d17[_0x26f1('0x2c')]);_0x2c10b7['filters']=_[_0x26f1('0x2d')](_0x2c10b7[_0x26f1('0x2b')],_0x2c10b7[_0x26f1('0x2c')]);_0x4cb959['attributes']=_[_0x26f1('0x2d')](_0x2c10b7['model'],qs[_0x26f1('0x2e')](_0x3e3d17[_0x26f1('0x2c')][_0x26f1('0x2e')]));_0x4cb959[_0x26f1('0x2f')]=_0x4cb959[_0x26f1('0x2f')][_0x26f1('0x30')]?_0x4cb959[_0x26f1('0x2f')]:_0x2c10b7['model'];if(!_0x3e3d17[_0x26f1('0x2c')][_0x26f1('0x31')](_0x26f1('0x32'))){_0x4cb959['limit']=qs['limit'](_0x3e3d17[_0x26f1('0x2c')][_0x26f1('0x1a')]);_0x4cb959[_0x26f1('0x18')]=qs[_0x26f1('0x18')](_0x3e3d17[_0x26f1('0x2c')]['offset']);}_0x4cb959[_0x26f1('0x33')]=qs[_0x26f1('0x34')](_0x3e3d17[_0x26f1('0x2c')]['sort']);_0x4cb959[_0x26f1('0x35')]=qs[_0x26f1('0x36')](_[_0x26f1('0x37')](_0x3e3d17[_0x26f1('0x2c')],_0x2c10b7['filters']),_0x20ef68);if(_0x3e3d17[_0x26f1('0x2c')][_0x26f1('0x38')]){_0x4cb959[_0x26f1('0x35')]=_[_0x26f1('0x39')](_0x4cb959[_0x26f1('0x35')],{'$or':_[_0x26f1('0x27')](_0x20ef68,function(_0x5695b7){if(_0x5695b7[_0x26f1('0x29')]!==_0x26f1('0x3a')){var _0x272864={};_0x272864[_0x5695b7[_0x26f1('0x24')]]={'$like':'%'+_0x3e3d17[_0x26f1('0x2c')][_0x26f1('0x38')]+'%'};return _0x272864;}})});}_0x4cb959=_[_0x26f1('0x39')]({},_0x4cb959,_0x3e3d17[_0x26f1('0x3b')]);var _0x58aa88={'where':_0x4cb959[_0x26f1('0x35')]};return db[_0x26f1('0x3c')]['count'](_0x58aa88)['then'](function(_0x2fae7c){_0x2dba54[_0x26f1('0x1b')]=_0x2fae7c;if(_0x3e3d17[_0x26f1('0x2c')]['includeAll']){_0x4cb959[_0x26f1('0x3d')]=[{'all':!![]}];}return db[_0x26f1('0x3c')][_0x26f1('0x3e')](_0x4cb959);})[_0x26f1('0x21')](function(_0x17f096){_0x2dba54[_0x26f1('0x3f')]=_0x17f096;return _0x2dba54;})[_0x26f1('0x21')](respondWithFilteredResult(_0x1dc8cf,_0x4cb959))['catch'](handleError(_0x1dc8cf,null));};exports['show']=function(_0x1e4b1e,_0x5ced33){var _0x3a4ba8={'raw':!![],'where':{'id':_0x1e4b1e[_0x26f1('0x40')]['id']}},_0x1de511={};_0x1de511['model']=_[_0x26f1('0x41')](db[_0x26f1('0x3c')]['rawAttributes']);_0x1de511[_0x26f1('0x2c')]=_[_0x26f1('0x41')](_0x1e4b1e[_0x26f1('0x2c')]);_0x1de511['filters']=_['intersection'](_0x1de511[_0x26f1('0x2b')],_0x1de511['query']);_0x3a4ba8[_0x26f1('0x2f')]=_[_0x26f1('0x2d')](_0x1de511[_0x26f1('0x2b')],qs[_0x26f1('0x2e')](_0x1e4b1e['query'][_0x26f1('0x2e')]));_0x3a4ba8['attributes']=_0x3a4ba8['attributes'][_0x26f1('0x30')]?_0x3a4ba8[_0x26f1('0x2f')]:_0x1de511['model'];if(_0x1e4b1e['query'][_0x26f1('0x42')]){_0x3a4ba8[_0x26f1('0x3d')]=[{'all':!![]}];}_0x3a4ba8=_[_0x26f1('0x39')]({},_0x3a4ba8,_0x1e4b1e[_0x26f1('0x3b')]);return db['SalesforceField'][_0x26f1('0x43')](_0x3a4ba8)[_0x26f1('0x21')](handleEntityNotFound(_0x5ced33,null))[_0x26f1('0x21')](respondWithResult(_0x5ced33,null))[_0x26f1('0x44')](handleError(_0x5ced33,null));};exports[_0x26f1('0x45')]=function(_0x53d105,_0x2dba9b){return db[_0x26f1('0x3c')][_0x26f1('0x45')](_0x53d105[_0x26f1('0x46')],{})[_0x26f1('0x21')](respondWithResult(_0x2dba9b,0xc9))[_0x26f1('0x44')](handleError(_0x2dba9b,null));};exports[_0x26f1('0x47')]=function(_0x5f5da6,_0x5e7887){if(_0x5f5da6['body']['id']){delete _0x5f5da6[_0x26f1('0x46')]['id'];}return db[_0x26f1('0x3c')][_0x26f1('0x43')]({'where':{'id':_0x5f5da6[_0x26f1('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e7887,null))['then'](saveUpdates(_0x5f5da6['body'],null))[_0x26f1('0x21')](respondWithResult(_0x5e7887,null))[_0x26f1('0x44')](handleError(_0x5e7887,null));};exports[_0x26f1('0x20')]=function(_0x3a36d4,_0x2b3f7f){return db['SalesforceField'][_0x26f1('0x43')]({'where':{'id':_0x3a36d4[_0x26f1('0x40')]['id']}})[_0x26f1('0x21')](handleEntityNotFound(_0x2b3f7f,null))[_0x26f1('0x21')](removeEntity(_0x2b3f7f,null))[_0x26f1('0x44')](handleError(_0x2b3f7f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5a239eb..5698f96 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 _0x985a=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x267614,_0x3546b9){var _0x3ad2f1=function(_0x291eac){while(--_0x291eac){_0x267614['push'](_0x267614['shift']());}};_0x3ad2f1(++_0x3546b9);}(_0x985a,0xc3));var _0xa985=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x985a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa985('0x0'));var util=require(_0xa985('0x1'));var logger=require(_0xa985('0x2'))(_0xa985('0x3'));var moment=require(_0xa985('0x4'));var BPromise=require(_0xa985('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa985('0x6'));var rimraf=require(_0xa985('0x7'));var config=require(_0xa985('0x8'));var attributes=require(_0xa985('0x9'));module[_0xa985('0xa')]=function(_0x117d4e,_0x54fc0f){return _0x117d4e[_0xa985('0xb')](_0xa985('0xc'),attributes,{'tableName':_0xa985('0xd'),'paranoid':![],'indexes':[{'name':_0xa985('0xe'),'fields':[_0xa985('0xf'),_0xa985('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff74=['salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x199dae,_0x4d6e8d){var _0x110a95=function(_0x33369d){while(--_0x33369d){_0x199dae['push'](_0x199dae['shift']());}};_0x110a95(++_0x4d6e8d);}(_0xff74,0x1a3));var _0x4ff7=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xff74[_0x1e5068];return _0x2230b6;};'use strict';var _=require(_0x4ff7('0x0'));var util=require(_0x4ff7('0x1'));var logger=require(_0x4ff7('0x2'))('api');var moment=require(_0x4ff7('0x3'));var BPromise=require(_0x4ff7('0x4'));var rp=require(_0x4ff7('0x5'));var fs=require('fs');var path=require(_0x4ff7('0x6'));var rimraf=require('rimraf');var config=require(_0x4ff7('0x7'));var attributes=require(_0x4ff7('0x8'));module[_0x4ff7('0x9')]=function(_0x23303a,_0x14db51){return _0x23303a[_0x4ff7('0xa')](_0x4ff7('0xb'),attributes,{'tableName':_0x4ff7('0xc'),'paranoid':![],'indexes':[{'name':_0x4ff7('0xd'),'fields':[_0x4ff7('0xe'),_0x4ff7('0xf')],'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 7b2ed9e..cf1d29c 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 _0xd2b6=['../../config/environment','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd2b6,0x72));var _0x6d2b=function(_0x58591c,_0x3dbb23){_0x58591c=_0x58591c-0x0;var _0x46585c=_0xd2b6[_0x58591c];return _0x46585c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6d2b('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d2b('0x1'));var db=require(_0x6d2b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d2b('0x3'))(_0x6d2b('0x4'));var config=require(_0x6d2b('0x5'));var jayson=require(_0x6d2b('0x6'));var client=jayson[_0x6d2b('0x7')][_0x6d2b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e9368,_0x3de29a,_0x2ea88d){return new BPromise(function(_0x44bb1f,_0x23c7c1){return client['request'](_0x2e9368,_0x2ea88d)['then'](function(_0x2c774c){logger[_0x6d2b('0x9')](_0x6d2b('0xa'),_0x3de29a,_0x6d2b('0xb'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3de29a,_0x6d2b('0xb'),JSON[_0x6d2b('0xc')](_0x2c774c));if(_0x2c774c[_0x6d2b('0xd')]){if(_0x2c774c['error'][_0x6d2b('0xe')]===0x1f4){logger[_0x6d2b('0xd')](_0x6d2b('0xa'),_0x3de29a,_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);return _0x23c7c1(_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);}logger[_0x6d2b('0xd')](_0x6d2b('0xa'),_0x3de29a,_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);return _0x44bb1f(_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);}else{logger[_0x6d2b('0x9')](_0x6d2b('0xa'),_0x3de29a,'request\x20sent');_0x44bb1f(_0x2c774c['result'][_0x6d2b('0xf')]);}})[_0x6d2b('0x10')](function(_0x2221b1){logger['error'](_0x6d2b('0xa'),_0x3de29a,_0x2221b1);_0x23c7c1(_0x2221b1);});});} \ No newline at end of file +var _0xec53=['then','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SalesforceField,\x20%s,\x20%s','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xec53,0x180));var _0x3ec5=function(_0x3f78e0,_0x17fbe5){_0x3f78e0=_0x3f78e0-0x0;var _0x33c5c7=_0xec53[_0x3f78e0];return _0x33c5c7;};'use strict';var _=require(_0x3ec5('0x0'));var util=require(_0x3ec5('0x1'));var moment=require(_0x3ec5('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ec5('0x3'));var fs=require('fs');var Redis=require(_0x3ec5('0x4'));var db=require(_0x3ec5('0x5'))['db'];var utils=require(_0x3ec5('0x6'));var logger=require('../../config/logger')(_0x3ec5('0x7'));var config=require(_0x3ec5('0x8'));var jayson=require(_0x3ec5('0x9'));var client=jayson[_0x3ec5('0xa')][_0x3ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130e05,_0x34b4fd,_0x3abac4){return new BPromise(function(_0x27c59b,_0x5b315f){return client['request'](_0x130e05,_0x3abac4)[_0x3ec5('0xc')](function(_0x46a389){logger['info']('SalesforceField,\x20%s,\x20%s',_0x34b4fd,'request\x20sent');logger[_0x3ec5('0xd')](_0x3ec5('0xe'),_0x34b4fd,_0x3ec5('0xf'),JSON['stringify'](_0x46a389));if(_0x46a389[_0x3ec5('0x10')]){if(_0x46a389[_0x3ec5('0x10')]['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x34b4fd,_0x46a389[_0x3ec5('0x10')]['message']);return _0x5b315f(_0x46a389['error'][_0x3ec5('0x11')]);}logger['error'](_0x3ec5('0x12'),_0x34b4fd,_0x46a389[_0x3ec5('0x10')][_0x3ec5('0x11')]);return _0x27c59b(_0x46a389[_0x3ec5('0x10')][_0x3ec5('0x11')]);}else{logger[_0x3ec5('0x13')](_0x3ec5('0x12'),_0x34b4fd,_0x3ec5('0xf'));_0x27c59b(_0x46a389[_0x3ec5('0x14')][_0x3ec5('0x11')]);}})[_0x3ec5('0x15')](function(_0x54ce60){logger[_0x3ec5('0x10')](_0x3ec5('0x12'),_0x34b4fd,_0x54ce60);_0x5b315f(_0x54ce60);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e1fc1f7..3628b0a 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 _0xe833=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1c3138,_0xeddefd){var _0x3fa2f9=function(_0x2b734a){while(--_0x2b734a){_0x1c3138['push'](_0x1c3138['shift']());}};_0x3fa2f9(++_0xeddefd);}(_0xe833,0x1c6));var _0x3e83=function(_0x5660d8,_0x114965){_0x5660d8=_0x5660d8-0x0;var _0x1f3342=_0xe833[_0x5660d8];return _0x1f3342;};'use strict';var multer=require(_0x3e83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e83('0x1'));var express=require(_0x3e83('0x2'));var router=express['Router']();var fs_extra=require(_0x3e83('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e83('0x4'));var config=require(_0x3e83('0x5'));var controller=require(_0x3e83('0x6'));router[_0x3e83('0x7')]('/',auth['isAuthenticated'](),controller[_0x3e83('0x8')]);router[_0x3e83('0x7')](_0x3e83('0x9'),auth[_0x3e83('0xa')](),controller['show']);router[_0x3e83('0x7')](_0x3e83('0xb'),auth[_0x3e83('0xa')](),controller[_0x3e83('0xc')]);router['get'](_0x3e83('0xd'),auth[_0x3e83('0xa')](),controller['getFields']);router[_0x3e83('0xe')]('/',auth[_0x3e83('0xa')](),controller[_0x3e83('0xf')]);router[_0x3e83('0xe')](_0x3e83('0xb'),auth[_0x3e83('0xa')](),controller[_0x3e83('0x10')]);router[_0x3e83('0x11')](_0x3e83('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3e83('0x12')](_0x3e83('0x9'),auth[_0x3e83('0xa')](),controller[_0x3e83('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0d3b=['get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x187ec9,_0x3db0f2){var _0x4386e6=function(_0x357089){while(--_0x357089){_0x187ec9['push'](_0x187ec9['shift']());}};_0x4386e6(++_0x3db0f2);}(_0x0d3b,0xf4));var _0xb0d3=function(_0x15967c,_0x55af65){_0x15967c=_0x15967c-0x0;var _0x581ce5=_0x0d3b[_0x15967c];return _0x581ce5;};'use strict';var multer=require(_0xb0d3('0x0'));var util=require(_0xb0d3('0x1'));var path=require(_0xb0d3('0x2'));var timeout=require(_0xb0d3('0x3'));var express=require(_0xb0d3('0x4'));var router=express['Router']();var fs_extra=require(_0xb0d3('0x5'));var auth=require(_0xb0d3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb0d3('0x7'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb0d3('0x8')](_0xb0d3('0x9'),auth[_0xb0d3('0xa')](),controller[_0xb0d3('0xb')]);router['get'](_0xb0d3('0xc'),auth[_0xb0d3('0xa')](),controller[_0xb0d3('0xd')]);router[_0xb0d3('0x8')](_0xb0d3('0xe'),auth[_0xb0d3('0xa')](),controller[_0xb0d3('0xf')]);router[_0xb0d3('0x10')]('/',auth[_0xb0d3('0xa')](),controller['create']);router[_0xb0d3('0x10')](_0xb0d3('0xc'),auth['isAuthenticated'](),controller[_0xb0d3('0x11')]);router[_0xb0d3('0x12')](_0xb0d3('0x9'),auth[_0xb0d3('0xa')](),controller['update']);router[_0xb0d3('0x13')](_0xb0d3('0x9'),auth['isAuthenticated'](),controller[_0xb0d3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cffae8c..1b71cda 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 _0x6d28=['remoteUri','sequelize','STRING'];(function(_0x53a8bf,_0x59b79f){var _0x1cee30=function(_0xbeb8e){while(--_0xbeb8e){_0x53a8bf['push'](_0x53a8bf['shift']());}};_0x1cee30(++_0x59b79f);}(_0x6d28,0x121));var _0x86d2=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6d28[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x86d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x86d2('0x1')]},'description':{'type':Sequelize[_0x86d2('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x86d2('0x1')]},'email':{'type':Sequelize[_0x86d2('0x1')]},'remoteUri':{'type':Sequelize[_0x86d2('0x1')],'unique':_0x86d2('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6a78=['exports','STRING','remoteUri','sequelize'];(function(_0x231399,_0x361836){var _0x3c0fb1=function(_0x43c2c1){while(--_0x43c2c1){_0x231399['push'](_0x231399['shift']());}};_0x3c0fb1(++_0x361836);}(_0x6a78,0x147));var _0x86a7=function(_0x3f53fc,_0x2c4f7f){_0x3f53fc=_0x3f53fc-0x0;var _0x3b6f27=_0x6a78[_0x3f53fc];return _0x3b6f27;};'use strict';var Sequelize=require(_0x86a7('0x0'));module[_0x86a7('0x1')]={'name':{'type':Sequelize[_0x86a7('0x2')]},'description':{'type':Sequelize[_0x86a7('0x2')]},'username':{'type':Sequelize[_0x86a7('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x86a7('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x86a7('0x2')],'unique':_0x86a7('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f368e46..cc37a9a 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 _0xe0a9=['find','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ServicenowField','Descriptions','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','knowledge','calendar_stc','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','company','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','correlation_id','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','include','findAll','rows','catch','params','includeAll','create','body'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe0a9,0x11d));var _0x9e0a=function(_0x4c5597,_0x3bfb10){_0x4c5597=_0x4c5597-0x0;var _0x1fa053=_0xe0a9[_0x4c5597];return _0x1fa053;};'use strict';var emlformat=require(_0x9e0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e0a('0x1'));var jsonpatch=require(_0x9e0a('0x2'));var rp=require(_0x9e0a('0x3'));var moment=require(_0x9e0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e0a('0x5'));var util=require(_0x9e0a('0x6'));var path=require(_0x9e0a('0x7'));var sox=require(_0x9e0a('0x8'));var csv=require(_0x9e0a('0x9'));var ejs=require(_0x9e0a('0xa'));var fs=require('fs');var fs_extra=require(_0x9e0a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e0a('0xc'));var toCsv=require(_0x9e0a('0x9'));var querystring=require(_0x9e0a('0xd'));var Papa=require(_0x9e0a('0xe'));var Redis=require(_0x9e0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9e0a('0x10'));var hardwareService=require(_0x9e0a('0x11'));var logger=require(_0x9e0a('0x12'))(_0x9e0a('0x13'));var utils=require(_0x9e0a('0x14'));var config=require(_0x9e0a('0x15'));var licenseUtil=require(_0x9e0a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9e0a('0x17'));function respondWithStatusCode(_0x53a14b,_0x3b924c){_0x3b924c=_0x3b924c||0xcc;return function(_0x329fdc){if(_0x329fdc){return _0x53a14b[_0x9e0a('0x18')](_0x3b924c);}return _0x53a14b[_0x9e0a('0x19')](_0x3b924c)['end']();};}function respondWithResult(_0x415f93,_0x4028d2){_0x4028d2=_0x4028d2||0xc8;return function(_0x360846){if(_0x360846){return _0x415f93[_0x9e0a('0x19')](_0x4028d2)['json'](_0x360846);}};}function respondWithFilteredResult(_0x59fef2,_0xb60217){return function(_0x22c4fc){if(_0x22c4fc){var _0x51b0d9=typeof _0xb60217['offset']==='undefined'&&typeof _0xb60217[_0x9e0a('0x1a')]===_0x9e0a('0x1b');var _0x22a241=_0x22c4fc[_0x9e0a('0x1c')];var _0x174593=_0x51b0d9?0x0:_0xb60217[_0x9e0a('0x1d')];var _0x3f2b97=_0x51b0d9?_0x22c4fc['count']:_0xb60217[_0x9e0a('0x1d')]+_0xb60217[_0x9e0a('0x1a')];var _0x580bed;if(_0x3f2b97>=_0x22a241){_0x3f2b97=_0x22a241;_0x580bed=0xc8;}else{_0x580bed=0xce;}_0x59fef2['status'](_0x580bed);return _0x59fef2[_0x9e0a('0x1e')](_0x9e0a('0x1f'),_0x174593+'-'+_0x3f2b97+'/'+_0x22a241)[_0x9e0a('0x20')](_0x22c4fc);}return null;};}function patchUpdates(_0xb3aac0){return function(_0x2917bb){try{jsonpatch[_0x9e0a('0x21')](_0x2917bb,_0xb3aac0,!![]);}catch(_0x345df2){return BPromise[_0x9e0a('0x22')](_0x345df2);}return _0x2917bb['save']();};}function saveUpdates(_0x2a452c,_0x1724c1){return function(_0x54a4e9){if(_0x54a4e9){return _0x54a4e9[_0x9e0a('0x23')](_0x2a452c)[_0x9e0a('0x24')](function(_0x88f7b4){return _0x88f7b4;});}return null;};}function removeEntity(_0xb8b008,_0x3c3cdc){return function(_0x4c2d23){if(_0x4c2d23){return _0x4c2d23[_0x9e0a('0x25')]()['then'](function(){_0xb8b008[_0x9e0a('0x19')](0xcc)[_0x9e0a('0x26')]();});}};}function handleEntityNotFound(_0x18789e,_0x5ac5a2){return function(_0x5e7403){if(!_0x5e7403){_0x18789e[_0x9e0a('0x18')](0x194);}return _0x5e7403;};}function handleError(_0x4e09bf,_0x59d27b){_0x59d27b=_0x59d27b||0x1f4;return function(_0x147035){logger[_0x9e0a('0x27')](_0x147035[_0x9e0a('0x28')]);if(_0x147035[_0x9e0a('0x29')]){delete _0x147035[_0x9e0a('0x29')];}_0x4e09bf[_0x9e0a('0x19')](_0x59d27b)[_0x9e0a('0x2a')](_0x147035);};}exports[_0x9e0a('0x2b')]=function(_0x160b97,_0x4f4e2d){var _0x1b8543={},_0x5d9dd7={},_0x1b5da0={'count':0x0,'rows':[]};var _0x4c649d=_[_0x9e0a('0x2c')](db[_0x9e0a('0x2d')][_0x9e0a('0x2e')],function(_0x328bf1){return{'name':_0x328bf1[_0x9e0a('0x2f')],'type':_0x328bf1['type']['key']};});_0x5d9dd7['model']=_[_0x9e0a('0x2c')](_0x4c649d,_0x9e0a('0x29'));_0x5d9dd7['query']=_[_0x9e0a('0x30')](_0x160b97['query']);_0x5d9dd7[_0x9e0a('0x31')]=_['intersection'](_0x5d9dd7[_0x9e0a('0x32')],_0x5d9dd7[_0x9e0a('0x33')]);_0x1b8543[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x5d9dd7['model'],qs['fields'](_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x36')]));_0x1b8543[_0x9e0a('0x34')]=_0x1b8543['attributes'][_0x9e0a('0x37')]?_0x1b8543[_0x9e0a('0x34')]:_0x5d9dd7[_0x9e0a('0x32')];if(!_0x160b97['query'][_0x9e0a('0x38')](_0x9e0a('0x39'))){_0x1b8543['limit']=qs['limit'](_0x160b97[_0x9e0a('0x33')]['limit']);_0x1b8543['offset']=qs[_0x9e0a('0x1d')](_0x160b97[_0x9e0a('0x33')]['offset']);}_0x1b8543[_0x9e0a('0x3a')]=qs[_0x9e0a('0x3b')](_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3b')]);_0x1b8543[_0x9e0a('0x3c')]=qs['filters'](_['pick'](_0x160b97[_0x9e0a('0x33')],_0x5d9dd7[_0x9e0a('0x31')]),_0x4c649d);if(_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3d')]){_0x1b8543[_0x9e0a('0x3c')]=_['merge'](_0x1b8543[_0x9e0a('0x3c')],{'$or':_['map'](_0x4c649d,function(_0x5a1650){if(_0x5a1650[_0x9e0a('0x3e')]!=='VIRTUAL'){var _0x216fec={};_0x216fec[_0x5a1650[_0x9e0a('0x29')]]={'$like':'%'+_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3d')]+'%'};return _0x216fec;}})});}_0x1b8543=_[_0x9e0a('0x3f')]({},_0x1b8543,_0x160b97[_0x9e0a('0x40')]);var _0x5d5346={'where':_0x1b8543[_0x9e0a('0x3c')]};return db[_0x9e0a('0x2d')][_0x9e0a('0x1c')](_0x5d5346)[_0x9e0a('0x24')](function(_0x3109d5){_0x1b5da0[_0x9e0a('0x1c')]=_0x3109d5;if(_0x160b97[_0x9e0a('0x33')]['includeAll']){_0x1b8543[_0x9e0a('0x41')]=[{'all':!![]}];}return db[_0x9e0a('0x2d')][_0x9e0a('0x42')](_0x1b8543);})[_0x9e0a('0x24')](function(_0x431021){_0x1b5da0[_0x9e0a('0x43')]=_0x431021;return _0x1b5da0;})[_0x9e0a('0x24')](respondWithFilteredResult(_0x4f4e2d,_0x1b8543))[_0x9e0a('0x44')](handleError(_0x4f4e2d,null));};exports['show']=function(_0x3048a7,_0x40b196){var _0x44f21f={'raw':![],'where':{'id':_0x3048a7[_0x9e0a('0x45')]['id']}},_0x209025={};_0x209025[_0x9e0a('0x32')]=_['keys'](db[_0x9e0a('0x2d')][_0x9e0a('0x2e')]);_0x209025[_0x9e0a('0x33')]=_[_0x9e0a('0x30')](_0x3048a7[_0x9e0a('0x33')]);_0x209025[_0x9e0a('0x31')]=_[_0x9e0a('0x35')](_0x209025[_0x9e0a('0x32')],_0x209025[_0x9e0a('0x33')]);_0x44f21f[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x209025[_0x9e0a('0x32')],qs[_0x9e0a('0x36')](_0x3048a7[_0x9e0a('0x33')]['fields']));_0x44f21f[_0x9e0a('0x34')]=_0x44f21f[_0x9e0a('0x34')][_0x9e0a('0x37')]?_0x44f21f[_0x9e0a('0x34')]:_0x209025[_0x9e0a('0x32')];if(_0x3048a7[_0x9e0a('0x33')][_0x9e0a('0x46')]){_0x44f21f[_0x9e0a('0x41')]=[{'all':!![]}];}_0x44f21f=_[_0x9e0a('0x3f')]({},_0x44f21f,_0x3048a7[_0x9e0a('0x40')]);return db[_0x9e0a('0x2d')]['find'](_0x44f21f)[_0x9e0a('0x24')](handleEntityNotFound(_0x40b196,null))[_0x9e0a('0x24')](respondWithResult(_0x40b196,null))[_0x9e0a('0x44')](handleError(_0x40b196,null));};exports[_0x9e0a('0x47')]=function(_0x5c74e4,_0x3f0f5f){return db[_0x9e0a('0x2d')]['create'](_0x5c74e4['body'],{})[_0x9e0a('0x24')](respondWithResult(_0x3f0f5f,0xc9))['catch'](handleError(_0x3f0f5f,null));};exports[_0x9e0a('0x23')]=function(_0x4b8fb4,_0x34635d){if(_0x4b8fb4[_0x9e0a('0x48')]['id']){delete _0x4b8fb4[_0x9e0a('0x48')]['id'];}return db['ServicenowAccount'][_0x9e0a('0x49')]({'where':{'id':_0x4b8fb4[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x34635d,null))['then'](saveUpdates(_0x4b8fb4[_0x9e0a('0x48')],null))[_0x9e0a('0x24')](respondWithResult(_0x34635d,null))[_0x9e0a('0x44')](handleError(_0x34635d,null));};exports[_0x9e0a('0x25')]=function(_0x4e8f68,_0x2ffe31){return db[_0x9e0a('0x2d')][_0x9e0a('0x49')]({'where':{'id':_0x4e8f68[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x2ffe31,null))[_0x9e0a('0x24')](removeEntity(_0x2ffe31,null))['catch'](handleError(_0x2ffe31,null));};exports[_0x9e0a('0x4a')]=function(_0x4d837a,_0x341080,_0x5a5f96){var _0x21a7d2={};var _0x50c35b={};var _0x17b999;var _0x266f63;return db[_0x9e0a('0x2d')][_0x9e0a('0x4b')]({'where':{'id':_0x4d837a[_0x9e0a('0x45')]['id']}})['then'](handleEntityNotFound(_0x341080,null))['then'](function(_0x401284){if(_0x401284){_0x17b999=_0x401284;_0x50c35b['model']=_[_0x9e0a('0x30')](db[_0x9e0a('0x4c')][_0x9e0a('0x2e')]);_0x50c35b[_0x9e0a('0x33')]=_[_0x9e0a('0x30')](_0x4d837a['query']);_0x50c35b[_0x9e0a('0x31')]=_[_0x9e0a('0x35')](_0x50c35b[_0x9e0a('0x32')],_0x50c35b[_0x9e0a('0x33')]);_0x21a7d2[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x50c35b['model'],qs['fields'](_0x4d837a[_0x9e0a('0x33')]['fields']));_0x21a7d2[_0x9e0a('0x34')]=_0x21a7d2[_0x9e0a('0x34')][_0x9e0a('0x37')]?_0x21a7d2['attributes']:_0x50c35b[_0x9e0a('0x32')];_0x21a7d2[_0x9e0a('0x3a')]=qs['sort'](_0x4d837a['query']['sort']);_0x21a7d2[_0x9e0a('0x3c')]=qs[_0x9e0a('0x31')](_[_0x9e0a('0x4d')](_0x4d837a[_0x9e0a('0x33')],_0x50c35b[_0x9e0a('0x31')]));if(_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x3d')]){_0x21a7d2['where']=_[_0x9e0a('0x3f')](_0x21a7d2[_0x9e0a('0x3c')],{'$or':_['map'](_0x21a7d2[_0x9e0a('0x34')],function(_0x384212){var _0x42b423={};_0x42b423[_0x384212]={'$like':'%'+_0x4d837a[_0x9e0a('0x33')]['filter']+'%'};return _0x42b423;})});}_0x21a7d2=_[_0x9e0a('0x3f')]({},_0x21a7d2,_0x4d837a['options']);return _0x17b999['getConfigurations'](_0x21a7d2);}})[_0x9e0a('0x24')](function(_0x32c235){if(_0x32c235){_0x266f63=_0x32c235['length'];if(!_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x38')]('nolimit')){_0x21a7d2[_0x9e0a('0x1a')]=qs['limit'](_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x1a')]);_0x21a7d2['offset']=qs[_0x9e0a('0x1d')](_0x4d837a[_0x9e0a('0x33')]['offset']);}return _0x17b999[_0x9e0a('0x4a')](_0x21a7d2);}})['then'](function(_0x5452d4){if(_0x5452d4){return _0x5452d4?{'count':_0x266f63,'rows':_0x5452d4}:null;}})[_0x9e0a('0x24')](respondWithResult(_0x341080,null))[_0x9e0a('0x44')](handleError(_0x341080,null));};exports[_0x9e0a('0x4e')]=function(_0x59734d,_0x481bc1,_0x3e5457){if(_0x59734d[_0x9e0a('0x48')]['id']){delete _0x59734d['body']['id'];}return db['ServicenowAccount'][_0x9e0a('0x4b')]({'where':{'id':_0x59734d[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x481bc1,null))[_0x9e0a('0x24')](function(_0x26122e){if(_0x26122e){_0x59734d[_0x9e0a('0x48')]['AccountId']=_0x26122e['id'];_0x59734d[_0x9e0a('0x48')][_0x9e0a('0x4f')]=integrations[_0x9e0a('0x50')](_0x59734d['body']['channel'],_0x59734d[_0x9e0a('0x48')]['type']);_0x59734d[_0x9e0a('0x48')]['Descriptions']=integrations[_0x9e0a('0x51')](_0x59734d['body'][_0x9e0a('0x52')],_0x59734d[_0x9e0a('0x48')][_0x9e0a('0x3e')]);return db['ServicenowConfiguration'][_0x9e0a('0x47')](_0x59734d[_0x9e0a('0x48')],{'include':[{'model':db[_0x9e0a('0x53')],'as':_0x9e0a('0x4f')},{'model':db[_0x9e0a('0x53')],'as':_0x9e0a('0x54')}]});}return null;})['then'](respondWithResult(_0x481bc1,null))[_0x9e0a('0x44')](handleError(_0x481bc1,null));};exports['getFields']=function(_0x1eae2b,_0x2f18e1,_0x7eb13b){var _0xc4c77e=[_0x9e0a('0x55'),_0x9e0a('0x56'),'knowledge',_0x9e0a('0x57'),_0x9e0a('0x58'),_0x9e0a('0x59'),_0x9e0a('0x5a'),'severity',_0x9e0a('0x5b')];var _0x8510af=[_0x9e0a('0x5c'),_0x9e0a('0x55'),_0x9e0a('0x5d'),'watch_list',_0x9e0a('0x5e'),_0x9e0a('0x5f'),_0x9e0a('0x60'),_0x9e0a('0x56'),_0x9e0a('0x61'),_0x9e0a('0x62'),_0x9e0a('0x63'),_0x9e0a('0x64'),_0x9e0a('0x65'),_0x9e0a('0x66'),'sys_created_on','sys_domain','state','sys_created_by',_0x9e0a('0x67'),_0x9e0a('0x3a'),_0x9e0a('0x68'),'closed_at','cmdb_ci',_0x9e0a('0x69'),_0x9e0a('0x6a'),_0x9e0a('0x6b'),'work_notes_list',_0x9e0a('0x6c'),'priority',_0x9e0a('0x6d'),_0x9e0a('0x6e'),_0x9e0a('0x6f'),_0x9e0a('0x70'),'opened_at',_0x9e0a('0x71'),'group_list','work_end',_0x9e0a('0x72'),_0x9e0a('0x73'),_0x9e0a('0x74'),_0x9e0a('0x75'),_0x9e0a('0x57'),_0x9e0a('0x76'),'short_description',_0x9e0a('0x58'),'correlation_display',_0x9e0a('0x77'),'work_start',_0x9e0a('0x78'),_0x9e0a('0x79'),'additional_assignee_list',_0x9e0a('0x7a'),_0x9e0a('0x7b'),_0x9e0a('0x59'),_0x9e0a('0x7c'),_0x9e0a('0x7d'),_0x9e0a('0x7e'),_0x9e0a('0x7f'),'parent_incident',_0x9e0a('0x80'),_0x9e0a('0x81'),'reopened_by',_0x9e0a('0x5a'),_0x9e0a('0x82'),'problem_id',_0x9e0a('0x83'),_0x9e0a('0x84'),_0x9e0a('0x85'),_0x9e0a('0x86'),_0x9e0a('0x87'),'comments',_0x9e0a('0x88'),_0x9e0a('0x89'),_0x9e0a('0x8a'),_0x9e0a('0x8b'),_0x9e0a('0x8c'),_0x9e0a('0x8d'),'sys_tags','escalation',_0x9e0a('0x8e'),_0x9e0a('0x8f'),_0x9e0a('0x90'),_0x9e0a('0x5b')];var _0x10b17e='';var _0x28f04c='';var _0x13ef46=[];var _0x43fca4='';var _0x3f3a31='';var _0x401a15=[];var _0xedefb0='';var _0x3557d9='';var _0xb6d58c={};var _0x3a3a95='';return db[_0x9e0a('0x2d')][_0x9e0a('0x4b')]({'where':{'id':_0x1eae2b[_0x9e0a('0x45')]['id']},'attributes':['id',_0x9e0a('0x91'),_0x9e0a('0x92'),'email',_0x9e0a('0x93'),'serverUrl']})[_0x9e0a('0x24')](handleEntityNotFound(_0x2f18e1,null))['then'](function(_0x56c4ad){if(_0x56c4ad){_0x3a3a95=_0x56c4ad[_0x9e0a('0x93')];var _0x3d32f1=_0x3a3a95[_0x9e0a('0x94')](-0x1);if(_0x3d32f1==='/'){_0x3a3a95=_0x3a3a95[_0x9e0a('0x95')](0x0,_0x3a3a95[_0x9e0a('0x96')](_0x3d32f1));}_0x3557d9=util[_0x9e0a('0x97')](_0x9e0a('0x98'),_0x3a3a95);_0xedefb0=util[_0x9e0a('0x97')]('%s/api/now/table/',_0x3a3a95);_0xb6d58c={'user':_0x56c4ad[_0x9e0a('0x91')],'pass':_0x56c4ad[_0x9e0a('0x92')]};var _0x27ef2e={'method':_0x9e0a('0x99'),'uri':_0x3557d9+_0x9e0a('0x9a'),'auth':_0xb6d58c,'json':!![]};return rp(_0x27ef2e);}})['then'](function(_0x496fac){if(_0x496fac['result'][_0x9e0a('0x37')]>0x0){_0x10b17e=_0x496fac[_0x9e0a('0x9b')];}console['log'](_0x9e0a('0x9c'),_0x10b17e);_0x401a15=[];_0x28f04c=Object['assign']([],_0x10b17e);_[_0x9e0a('0x9d')](_0x28f04c,function(_0x3db73c){return!_0xc4c77e[_0x9e0a('0x9e')](_0x3db73c[_0x9e0a('0x29')]);});_0x28f04c[_0x9e0a('0x9f')](function(_0x570d64){var _0x48cb37=createFieldObject(_0xedefb0,_0xb6d58c,_0x570d64[_0x9e0a('0xa0')],_0x570d64['name'],_0x570d64[_0x9e0a('0xa1')],![]);_0x401a15[_0x9e0a('0xa2')](_0x48cb37);});return Promise[_0x9e0a('0xa3')](_0x401a15);})['then'](function(_0x41e63f){_0x13ef46=_0x41e63f;_0x43fca4=Object[_0x9e0a('0xa4')]([],_0x10b17e);console['log']('TCL:\x20_object',_0x10b17e);_['remove'](_0x43fca4,function(_0x4921db){return _0x8510af['includes'](_0x4921db[_0x9e0a('0x29')]);});console[_0x9e0a('0xa5')](_0x9e0a('0xa6'),_0x43fca4);_0x401a15=[];_0x43fca4[_0x9e0a('0x9f')](function(_0x1e41c5){var _0x4dc5bb=createFieldObject(_0xedefb0,_0xb6d58c,_0x1e41c5[_0x9e0a('0xa0')],_0x1e41c5['name'],_0x1e41c5['label'],!![]);_0x401a15[_0x9e0a('0xa2')](_0x4dc5bb);});return Promise[_0x9e0a('0xa3')](_0x401a15);})[_0x9e0a('0x24')](function(_0x3aac1b){_0x3f3a31=_0x3aac1b;var _0x3ede5a=_0x13ef46[_0x9e0a('0xa7')](_0x3f3a31);return{'count':_0x3ede5a[_0x9e0a('0x37')],'rows':_0x3ede5a};})[_0x9e0a('0x24')](respondWithResult(_0x2f18e1,null))['catch'](function(_0x375b00){console['log'](_0x9e0a('0xa8')+_0x375b00);var _0x45e66a=_0x1eae2b['query']['test']?0x1f4:_0x375b00[_0x9e0a('0xa9')]||0x1f4;logger['error'](_0x375b00[_0x9e0a('0x28')]);delete _0x375b00['name'];if(_0x45e66a===0x191){_0x45e66a=0x190;}_0x2f18e1['status'](_0x45e66a)[_0x9e0a('0x2a')](_0x1eae2b[_0x9e0a('0x33')][_0x9e0a('0xaa')]?{'message':_0x9e0a('0xab'),'statusCode':_0x375b00[_0x9e0a('0xa9')]}:_0x375b00);});};function createFieldObject(_0xff3b32,_0x2b07a9,_0x4b7c1e,_0x62840d,_0xe15b2f,_0x5e9fd4){return new Promise(function(_0x13716e,_0x172368){var _0x5737d5={'id':_0x62840d,'name':_0xe15b2f,'custom':_0x5e9fd4};if(_0x4b7c1e===_0x9e0a('0xac')){_0x5737d5[_0x9e0a('0x40')]=[{'name':_0x9e0a('0xad'),'value':'true'},{'name':_0x9e0a('0xae'),'value':_0x9e0a('0xaf')}];_0x13716e(_0x5737d5);}else{var _0xd122f6={'method':_0x9e0a('0x99'),'uri':_0xff3b32+_0x9e0a('0xb0')+_0x62840d,'auth':_0x2b07a9,'json':!![]};return rp(_0xd122f6)['then'](function(_0x542df5){var _0x21ea04=[];if(_0x542df5[_0x9e0a('0x9b')][_0x9e0a('0x37')]>0x0){_0x542df5[_0x9e0a('0x9b')][_0x9e0a('0x9f')](function(_0x1481e3){if(_0x1481e3[_0x9e0a('0xb1')]===_0x9e0a('0xaf')){var _0x31d966={'name':_0x1481e3['label'],'value':_0x1481e3[_0x9e0a('0xb2')]};_0x21ea04[_0x9e0a('0xa2')](_0x31d966);}});}_0x5737d5[_0x9e0a('0x40')]=_0x21ea04;if(_0x5737d5[_0x9e0a('0x40')][_0x9e0a('0x37')]>0x0){_0x13716e(_0x5737d5);}else{if(_0x5e9fd4==![]){_0x13716e();}else{_0x13716e(_0x5737d5);}}});}});} \ No newline at end of file +var _0x4154=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ServicenowAccount','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','category','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','work_notes_list','business_service','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','correlation_display','work_start','assignment_group','business_stc','description','calendar_duration','notify','close_notes','closed_by','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','statusCode','error','test','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x4154,0x15e));var _0x4415=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0x4154[_0x42bd43];return _0x421e88;};'use strict';var emlformat=require(_0x4415('0x0'));var rimraf=require(_0x4415('0x1'));var zipdir=require(_0x4415('0x2'));var jsonpatch=require(_0x4415('0x3'));var rp=require('request-promise');var moment=require(_0x4415('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4415('0x5'));var util=require(_0x4415('0x6'));var path=require('path');var sox=require(_0x4415('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4415('0x8'));var squel=require('squel');var crypto=require(_0x4415('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4415('0xa'));var toCsv=require(_0x4415('0xb'));var querystring=require(_0x4415('0xc'));var Papa=require('papaparse');var Redis=require(_0x4415('0xd'));var authService=require(_0x4415('0xe'));var qs=require(_0x4415('0xf'));var as=require(_0x4415('0x10'));var hardwareService=require(_0x4415('0x11'));var logger=require(_0x4415('0x12'))(_0x4415('0x13'));var utils=require(_0x4415('0x14'));var config=require(_0x4415('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4415('0x16'))['db'];var integrations=require(_0x4415('0x17'));function respondWithStatusCode(_0x456e79,_0x35fb9c){_0x35fb9c=_0x35fb9c||0xcc;return function(_0x4254a5){if(_0x4254a5){return _0x456e79[_0x4415('0x18')](_0x35fb9c);}return _0x456e79[_0x4415('0x19')](_0x35fb9c)['end']();};}function respondWithResult(_0x57dc01,_0x1d63ac){_0x1d63ac=_0x1d63ac||0xc8;return function(_0x2e99cd){if(_0x2e99cd){return _0x57dc01['status'](_0x1d63ac)['json'](_0x2e99cd);}};}function respondWithFilteredResult(_0x3f8f04,_0x3ab069){return function(_0x45530a){if(_0x45530a){var _0x2cf13a=typeof _0x3ab069['offset']===_0x4415('0x1a')&&typeof _0x3ab069[_0x4415('0x1b')]===_0x4415('0x1a');var _0x1024d6=_0x45530a['count'];var _0x44f2f9=_0x2cf13a?0x0:_0x3ab069[_0x4415('0x1c')];var _0x12b64b=_0x2cf13a?_0x45530a[_0x4415('0x1d')]:_0x3ab069[_0x4415('0x1c')]+_0x3ab069[_0x4415('0x1b')];var _0x1845f6;if(_0x12b64b>=_0x1024d6){_0x12b64b=_0x1024d6;_0x1845f6=0xc8;}else{_0x1845f6=0xce;}_0x3f8f04[_0x4415('0x19')](_0x1845f6);return _0x3f8f04[_0x4415('0x1e')](_0x4415('0x1f'),_0x44f2f9+'-'+_0x12b64b+'/'+_0x1024d6)[_0x4415('0x20')](_0x45530a);}return null;};}function patchUpdates(_0x26f463){return function(_0x34b580){try{jsonpatch[_0x4415('0x21')](_0x34b580,_0x26f463,!![]);}catch(_0x4b54a4){return BPromise[_0x4415('0x22')](_0x4b54a4);}return _0x34b580[_0x4415('0x23')]();};}function saveUpdates(_0x1be050,_0x2adabc){return function(_0x502cfb){if(_0x502cfb){return _0x502cfb[_0x4415('0x24')](_0x1be050)[_0x4415('0x25')](function(_0x2eff5d){return _0x2eff5d;});}return null;};}function removeEntity(_0x53db58,_0x417434){return function(_0x4b820c){if(_0x4b820c){return _0x4b820c[_0x4415('0x26')]()[_0x4415('0x25')](function(){_0x53db58[_0x4415('0x19')](0xcc)[_0x4415('0x27')]();});}};}function handleEntityNotFound(_0x26062f,_0xc6e976){return function(_0x33494d){if(!_0x33494d){_0x26062f['sendStatus'](0x194);}return _0x33494d;};}function handleError(_0x522496,_0x35adf9){_0x35adf9=_0x35adf9||0x1f4;return function(_0x545966){logger['error'](_0x545966[_0x4415('0x28')]);if(_0x545966[_0x4415('0x29')]){delete _0x545966[_0x4415('0x29')];}_0x522496[_0x4415('0x19')](_0x35adf9)[_0x4415('0x2a')](_0x545966);};}exports[_0x4415('0x2b')]=function(_0x54acf7,_0x56ad45){var _0x5ba6bc={},_0x4e51e9={},_0x47c3f3={'count':0x0,'rows':[]};var _0x37cc86=_[_0x4415('0x2c')](db[_0x4415('0x2d')]['rawAttributes'],function(_0xda4dc1){return{'name':_0xda4dc1[_0x4415('0x2e')],'type':_0xda4dc1[_0x4415('0x2f')]['key']};});_0x4e51e9[_0x4415('0x30')]=_[_0x4415('0x2c')](_0x37cc86,_0x4415('0x29'));_0x4e51e9['query']=_[_0x4415('0x31')](_0x54acf7[_0x4415('0x32')]);_0x4e51e9[_0x4415('0x33')]=_[_0x4415('0x34')](_0x4e51e9[_0x4415('0x30')],_0x4e51e9[_0x4415('0x32')]);_0x5ba6bc['attributes']=_['intersection'](_0x4e51e9[_0x4415('0x30')],qs[_0x4415('0x35')](_0x54acf7[_0x4415('0x32')][_0x4415('0x35')]));_0x5ba6bc[_0x4415('0x36')]=_0x5ba6bc[_0x4415('0x36')][_0x4415('0x37')]?_0x5ba6bc[_0x4415('0x36')]:_0x4e51e9[_0x4415('0x30')];if(!_0x54acf7['query'][_0x4415('0x38')]('nolimit')){_0x5ba6bc[_0x4415('0x1b')]=qs[_0x4415('0x1b')](_0x54acf7['query']['limit']);_0x5ba6bc[_0x4415('0x1c')]=qs[_0x4415('0x1c')](_0x54acf7[_0x4415('0x32')]['offset']);}_0x5ba6bc['order']=qs['sort'](_0x54acf7[_0x4415('0x32')][_0x4415('0x39')]);_0x5ba6bc[_0x4415('0x3a')]=qs[_0x4415('0x33')](_[_0x4415('0x3b')](_0x54acf7[_0x4415('0x32')],_0x4e51e9['filters']),_0x37cc86);if(_0x54acf7[_0x4415('0x32')]['filter']){_0x5ba6bc[_0x4415('0x3a')]=_[_0x4415('0x3c')](_0x5ba6bc['where'],{'$or':_[_0x4415('0x2c')](_0x37cc86,function(_0x4d783f){if(_0x4d783f[_0x4415('0x2f')]!==_0x4415('0x3d')){var _0x221fff={};_0x221fff[_0x4d783f[_0x4415('0x29')]]={'$like':'%'+_0x54acf7[_0x4415('0x32')][_0x4415('0x3e')]+'%'};return _0x221fff;}})});}_0x5ba6bc=_[_0x4415('0x3c')]({},_0x5ba6bc,_0x54acf7[_0x4415('0x3f')]);var _0x502de4={'where':_0x5ba6bc['where']};return db[_0x4415('0x2d')]['count'](_0x502de4)[_0x4415('0x25')](function(_0x1abd78){_0x47c3f3['count']=_0x1abd78;if(_0x54acf7[_0x4415('0x32')][_0x4415('0x40')]){_0x5ba6bc[_0x4415('0x41')]=[{'all':!![]}];}return db[_0x4415('0x2d')][_0x4415('0x42')](_0x5ba6bc);})['then'](function(_0x293ce0){_0x47c3f3['rows']=_0x293ce0;return _0x47c3f3;})[_0x4415('0x25')](respondWithFilteredResult(_0x56ad45,_0x5ba6bc))[_0x4415('0x43')](handleError(_0x56ad45,null));};exports['show']=function(_0x5c5dd8,_0x3d5c19){var _0x5bc972={'raw':![],'where':{'id':_0x5c5dd8[_0x4415('0x44')]['id']}},_0x547f92={};_0x547f92[_0x4415('0x30')]=_[_0x4415('0x31')](db[_0x4415('0x2d')][_0x4415('0x45')]);_0x547f92[_0x4415('0x32')]=_[_0x4415('0x31')](_0x5c5dd8['query']);_0x547f92[_0x4415('0x33')]=_[_0x4415('0x34')](_0x547f92[_0x4415('0x30')],_0x547f92[_0x4415('0x32')]);_0x5bc972[_0x4415('0x36')]=_['intersection'](_0x547f92[_0x4415('0x30')],qs[_0x4415('0x35')](_0x5c5dd8[_0x4415('0x32')][_0x4415('0x35')]));_0x5bc972[_0x4415('0x36')]=_0x5bc972[_0x4415('0x36')][_0x4415('0x37')]?_0x5bc972[_0x4415('0x36')]:_0x547f92[_0x4415('0x30')];if(_0x5c5dd8[_0x4415('0x32')][_0x4415('0x40')]){_0x5bc972[_0x4415('0x41')]=[{'all':!![]}];}_0x5bc972=_[_0x4415('0x3c')]({},_0x5bc972,_0x5c5dd8[_0x4415('0x3f')]);return db[_0x4415('0x2d')][_0x4415('0x46')](_0x5bc972)[_0x4415('0x25')](handleEntityNotFound(_0x3d5c19,null))['then'](respondWithResult(_0x3d5c19,null))['catch'](handleError(_0x3d5c19,null));};exports['create']=function(_0x1d65b9,_0x2fca06){return db[_0x4415('0x2d')][_0x4415('0x47')](_0x1d65b9[_0x4415('0x48')],{})['then'](respondWithResult(_0x2fca06,0xc9))[_0x4415('0x43')](handleError(_0x2fca06,null));};exports['update']=function(_0x364d52,_0x504042){if(_0x364d52[_0x4415('0x48')]['id']){delete _0x364d52[_0x4415('0x48')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x364d52[_0x4415('0x44')]['id']}})[_0x4415('0x25')](handleEntityNotFound(_0x504042,null))[_0x4415('0x25')](saveUpdates(_0x364d52[_0x4415('0x48')],null))[_0x4415('0x25')](respondWithResult(_0x504042,null))['catch'](handleError(_0x504042,null));};exports[_0x4415('0x26')]=function(_0x125510,_0x22a9b5){return db['ServicenowAccount']['find']({'where':{'id':_0x125510['params']['id']}})[_0x4415('0x25')](handleEntityNotFound(_0x22a9b5,null))[_0x4415('0x25')](removeEntity(_0x22a9b5,null))[_0x4415('0x43')](handleError(_0x22a9b5,null));};exports[_0x4415('0x49')]=function(_0x4af046,_0x521361,_0x470e5a){var _0x29fc44={};var _0x26d4a4={};var _0x5d984d;var _0x17b43c;return db[_0x4415('0x2d')][_0x4415('0x4a')]({'where':{'id':_0x4af046[_0x4415('0x44')]['id']}})['then'](handleEntityNotFound(_0x521361,null))[_0x4415('0x25')](function(_0x403c0c){if(_0x403c0c){_0x5d984d=_0x403c0c;_0x26d4a4[_0x4415('0x30')]=_['keys'](db[_0x4415('0x4b')][_0x4415('0x45')]);_0x26d4a4[_0x4415('0x32')]=_['keys'](_0x4af046['query']);_0x26d4a4['filters']=_['intersection'](_0x26d4a4[_0x4415('0x30')],_0x26d4a4[_0x4415('0x32')]);_0x29fc44[_0x4415('0x36')]=_[_0x4415('0x34')](_0x26d4a4[_0x4415('0x30')],qs[_0x4415('0x35')](_0x4af046[_0x4415('0x32')]['fields']));_0x29fc44[_0x4415('0x36')]=_0x29fc44['attributes'][_0x4415('0x37')]?_0x29fc44[_0x4415('0x36')]:_0x26d4a4[_0x4415('0x30')];_0x29fc44[_0x4415('0x4c')]=qs['sort'](_0x4af046[_0x4415('0x32')]['sort']);_0x29fc44['where']=qs['filters'](_['pick'](_0x4af046[_0x4415('0x32')],_0x26d4a4[_0x4415('0x33')]));if(_0x4af046[_0x4415('0x32')][_0x4415('0x3e')]){_0x29fc44[_0x4415('0x3a')]=_[_0x4415('0x3c')](_0x29fc44[_0x4415('0x3a')],{'$or':_[_0x4415('0x2c')](_0x29fc44[_0x4415('0x36')],function(_0x2c2783){var _0x1c31c8={};_0x1c31c8[_0x2c2783]={'$like':'%'+_0x4af046['query'][_0x4415('0x3e')]+'%'};return _0x1c31c8;})});}_0x29fc44=_[_0x4415('0x3c')]({},_0x29fc44,_0x4af046[_0x4415('0x3f')]);return _0x5d984d['getConfigurations'](_0x29fc44);}})['then'](function(_0x3fff25){if(_0x3fff25){_0x17b43c=_0x3fff25[_0x4415('0x37')];if(!_0x4af046[_0x4415('0x32')][_0x4415('0x38')](_0x4415('0x4d'))){_0x29fc44[_0x4415('0x1b')]=qs[_0x4415('0x1b')](_0x4af046['query'][_0x4415('0x1b')]);_0x29fc44[_0x4415('0x1c')]=qs[_0x4415('0x1c')](_0x4af046[_0x4415('0x32')][_0x4415('0x1c')]);}return _0x5d984d[_0x4415('0x49')](_0x29fc44);}})[_0x4415('0x25')](function(_0x359840){if(_0x359840){return _0x359840?{'count':_0x17b43c,'rows':_0x359840}:null;}})[_0x4415('0x25')](respondWithResult(_0x521361,null))[_0x4415('0x43')](handleError(_0x521361,null));};exports[_0x4415('0x4e')]=function(_0x4ffc22,_0x2018b0,_0x52fb0b){if(_0x4ffc22[_0x4415('0x48')]['id']){delete _0x4ffc22[_0x4415('0x48')]['id'];}return db['ServicenowAccount'][_0x4415('0x4a')]({'where':{'id':_0x4ffc22[_0x4415('0x44')]['id']}})[_0x4415('0x25')](handleEntityNotFound(_0x2018b0,null))[_0x4415('0x25')](function(_0x1b047c){if(_0x1b047c){_0x4ffc22[_0x4415('0x48')][_0x4415('0x4f')]=_0x1b047c['id'];_0x4ffc22[_0x4415('0x48')][_0x4415('0x50')]=integrations[_0x4415('0x51')](_0x4ffc22[_0x4415('0x48')][_0x4415('0x52')],_0x4ffc22[_0x4415('0x48')]['type']);_0x4ffc22[_0x4415('0x48')]['Descriptions']=integrations['getDescriptions'](_0x4ffc22[_0x4415('0x48')][_0x4415('0x52')],_0x4ffc22[_0x4415('0x48')][_0x4415('0x2f')]);return db[_0x4415('0x4b')][_0x4415('0x47')](_0x4ffc22['body'],{'include':[{'model':db[_0x4415('0x53')],'as':_0x4415('0x50')},{'model':db[_0x4415('0x53')],'as':_0x4415('0x54')}]});}return null;})[_0x4415('0x25')](respondWithResult(_0x2018b0,null))[_0x4415('0x43')](handleError(_0x2018b0,null));};exports[_0x4415('0x55')]=function(_0xd86529,_0x55370b,_0xe355f){var _0x3b5612=['made_sla',_0x4415('0x56'),_0x4415('0x57'),_0x4415('0x58'),_0x4415('0x59'),'notify',_0x4415('0x5a'),'severity',_0x4415('0x5b')];var _0x4c707e=['parent',_0x4415('0x5c'),_0x4415('0x5d'),'watch_list',_0x4415('0x5e'),_0x4415('0x5f'),_0x4415('0x60'),_0x4415('0x56'),_0x4415('0x61'),_0x4415('0x62'),_0x4415('0x63'),_0x4415('0x64'),_0x4415('0x65'),_0x4415('0x66'),_0x4415('0x67'),_0x4415('0x68'),_0x4415('0x69'),_0x4415('0x6a'),_0x4415('0x57'),'order','calendar_stc',_0x4415('0x6b'),'cmdb_ci',_0x4415('0x6c'),_0x4415('0x6d'),'active',_0x4415('0x6e'),_0x4415('0x6f'),'priority','sys_domain_path',_0x4415('0x70'),_0x4415('0x71'),_0x4415('0x72'),_0x4415('0x73'),'business_duration',_0x4415('0x74'),_0x4415('0x75'),_0x4415('0x76'),_0x4415('0x77'),_0x4415('0x78'),_0x4415('0x79'),_0x4415('0x58'),'work_notes','short_description',_0x4415('0x59'),_0x4415('0x7a'),'delivery_task',_0x4415('0x7b'),_0x4415('0x7c'),_0x4415('0x7d'),'additional_assignee_list',_0x4415('0x7e'),_0x4415('0x7f'),_0x4415('0x80'),'sys_class_name',_0x4415('0x81'),_0x4415('0x82'),'follow_up',_0x4415('0x83'),_0x4415('0x84'),_0x4415('0x85'),'reopened_by',_0x4415('0x5a'),_0x4415('0x86'),'problem_id',_0x4415('0x87'),_0x4415('0x88'),_0x4415('0x89'),_0x4415('0x8a'),_0x4415('0x8b'),_0x4415('0x8c'),_0x4415('0x8d'),_0x4415('0x8e'),_0x4415('0x8f'),_0x4415('0x90'),_0x4415('0x91'),_0x4415('0x92'),_0x4415('0x93'),_0x4415('0x94'),'upon_approval',_0x4415('0x95'),'location','category'];var _0x34353d='';var _0x17eedc='';var _0x566583=[];var _0x23f659='';var _0x5e475e='';var _0x37067a=[];var _0x4d4fc2='';var _0x529230='';var _0x18802c={};var _0x1e840c='';return db[_0x4415('0x2d')]['findOne']({'where':{'id':_0xd86529[_0x4415('0x44')]['id']},'attributes':['id',_0x4415('0x96'),'password',_0x4415('0x97'),_0x4415('0x98'),'serverUrl']})['then'](handleEntityNotFound(_0x55370b,null))[_0x4415('0x25')](function(_0x1e5b2f){if(_0x1e5b2f){_0x1e840c=_0x1e5b2f[_0x4415('0x98')];var _0x123de5=_0x1e840c[_0x4415('0x99')](-0x1);if(_0x123de5==='/'){_0x1e840c=_0x1e840c['substring'](0x0,_0x1e840c[_0x4415('0x9a')](_0x123de5));}_0x529230=util[_0x4415('0x9b')](_0x4415('0x9c'),_0x1e840c);_0x4d4fc2=util[_0x4415('0x9b')](_0x4415('0x9d'),_0x1e840c);_0x18802c={'user':_0x1e5b2f[_0x4415('0x96')],'pass':_0x1e5b2f[_0x4415('0x9e')]};var _0x13080f={'method':'GET','uri':_0x529230+_0x4415('0x9f'),'auth':_0x18802c,'json':!![]};return rp(_0x13080f);}})[_0x4415('0x25')](function(_0x72b716){if(_0x72b716[_0x4415('0xa0')][_0x4415('0x37')]>0x0){_0x34353d=_0x72b716[_0x4415('0xa0')];}console['log'](_0x4415('0xa1'),_0x34353d);_0x37067a=[];_0x17eedc=Object[_0x4415('0xa2')]([],_0x34353d);_['remove'](_0x17eedc,function(_0x2e26b8){return!_0x3b5612[_0x4415('0xa3')](_0x2e26b8[_0x4415('0x29')]);});_0x17eedc[_0x4415('0xa4')](function(_0x10b58a){var _0x20670d=createFieldObject(_0x4d4fc2,_0x18802c,_0x10b58a[_0x4415('0xa5')],_0x10b58a[_0x4415('0x29')],_0x10b58a[_0x4415('0xa6')],![]);_0x37067a['push'](_0x20670d);});return Promise[_0x4415('0xa7')](_0x37067a);})[_0x4415('0x25')](function(_0x139a2e){_0x566583=_0x139a2e;_0x23f659=Object[_0x4415('0xa2')]([],_0x34353d);console[_0x4415('0xa8')](_0x4415('0xa9'),_0x34353d);_['remove'](_0x23f659,function(_0x2c309b){return _0x4c707e[_0x4415('0xa3')](_0x2c309b[_0x4415('0x29')]);});console[_0x4415('0xa8')](_0x4415('0xaa'),_0x23f659);_0x37067a=[];_0x23f659[_0x4415('0xa4')](function(_0x1a847a){var _0x10a58d=createFieldObject(_0x4d4fc2,_0x18802c,_0x1a847a[_0x4415('0xa5')],_0x1a847a['name'],_0x1a847a[_0x4415('0xa6')],!![]);_0x37067a[_0x4415('0xab')](_0x10a58d);});return Promise[_0x4415('0xa7')](_0x37067a);})[_0x4415('0x25')](function(_0x4d5bdb){_0x5e475e=_0x4d5bdb;var _0x3feca7=_0x566583['concat'](_0x5e475e);return{'count':_0x3feca7[_0x4415('0x37')],'rows':_0x3feca7};})[_0x4415('0x25')](respondWithResult(_0x55370b,null))[_0x4415('0x43')](function(_0xf4b8e9){console[_0x4415('0xa8')]('ServiceNow\x20error:\x20'+_0xf4b8e9);var _0x40c82f=_0xd86529['query']['test']?0x1f4:_0xf4b8e9[_0x4415('0xac')]||0x1f4;logger[_0x4415('0xad')](_0xf4b8e9[_0x4415('0x28')]);delete _0xf4b8e9['name'];if(_0x40c82f===0x191){_0x40c82f=0x190;}_0x55370b[_0x4415('0x19')](_0x40c82f)['send'](_0xd86529[_0x4415('0x32')][_0x4415('0xae')]?{'message':_0x4415('0xaf'),'statusCode':_0xf4b8e9[_0x4415('0xac')]}:_0xf4b8e9);});};function createFieldObject(_0x49dfd9,_0x42c111,_0x5486dc,_0x3c21ca,_0x3f966c,_0x4a20f5){return new Promise(function(_0x4a1af5,_0x44b74c){var _0x24a3f8={'id':_0x3c21ca,'name':_0x3f966c,'custom':_0x4a20f5};if(_0x5486dc===_0x4415('0xb0')){_0x24a3f8[_0x4415('0x3f')]=[{'name':_0x4415('0xb1'),'value':_0x4415('0xb2')},{'name':_0x4415('0xb3'),'value':_0x4415('0xb4')}];_0x4a1af5(_0x24a3f8);}else{var _0x2e2c7a={'method':_0x4415('0xb5'),'uri':_0x49dfd9+_0x4415('0xb6')+_0x3c21ca,'auth':_0x42c111,'json':!![]};return rp(_0x2e2c7a)[_0x4415('0x25')](function(_0x3c3b43){var _0x1f2862=[];if(_0x3c3b43[_0x4415('0xa0')][_0x4415('0x37')]>0x0){_0x3c3b43['result']['forEach'](function(_0x18f256){if(_0x18f256['inactive']==='false'){var _0x5b27c3={'name':_0x18f256['label'],'value':_0x18f256[_0x4415('0xb7')]};_0x1f2862[_0x4415('0xab')](_0x5b27c3);}});}_0x24a3f8[_0x4415('0x3f')]=_0x1f2862;if(_0x24a3f8[_0x4415('0x3f')][_0x4415('0x37')]>0x0){_0x4a1af5(_0x24a3f8);}else{if(_0x4a20f5==![]){_0x4a1af5();}else{_0x4a1af5(_0x24a3f8);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1df5f0b..577061d 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x5496,0x175));var _0x6549=function(_0xfa92ef,_0x1b3bf9){_0xfa92ef=_0xfa92ef-0x0;var _0x20d776=_0x5496[_0xfa92ef];return _0x20d776;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x5fc3[_0x4bdf64];return _0x9a1a19;};'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'));var integrations=require(_0x35fc('0x9'));module['exports']=function(_0x5754be,_0x19a0d1){return _0x5754be['define'](_0x35fc('0xa'),attributes,{'tableName':_0x35fc('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 28a048e..aec47df 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 _0xd17f=['info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','limit','include','map','model','attributes','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xd17f,0x1f2));var _0xfd17=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd17f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfd17('0x0'));var util=require(_0xfd17('0x1'));var moment=require(_0xfd17('0x2'));var BPromise=require(_0xfd17('0x3'));var rs=require(_0xfd17('0x4'));var fs=require('fs');var Redis=require(_0xfd17('0x5'));var db=require(_0xfd17('0x6'))['db'];var utils=require(_0xfd17('0x7'));var logger=require(_0xfd17('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd17('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29f250,_0x5688f8,_0x2ba4e6){return new BPromise(function(_0x240857,_0x22b0d7){return client[_0xfd17('0xa')](_0x29f250,_0x2ba4e6)[_0xfd17('0xb')](function(_0x28c1a3){logger[_0xfd17('0xc')](_0xfd17('0xd'),_0x5688f8,_0xfd17('0xe'));logger[_0xfd17('0xf')](_0xfd17('0x10'),_0x5688f8,'request\x20sent',JSON[_0xfd17('0x11')](_0x28c1a3));if(_0x28c1a3['error']){if(_0x28c1a3[_0xfd17('0x12')]['code']===0x1f4){logger[_0xfd17('0x12')](_0xfd17('0xd'),_0x5688f8,_0x28c1a3[_0xfd17('0x12')]['message']);return _0x22b0d7(_0x28c1a3[_0xfd17('0x12')]['message']);}logger[_0xfd17('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5688f8,_0x28c1a3['error'][_0xfd17('0x13')]);return _0x240857(_0x28c1a3['error'][_0xfd17('0x13')]);}else{logger[_0xfd17('0xc')](_0xfd17('0xd'),_0x5688f8,_0xfd17('0xe'));_0x240857(_0x28c1a3[_0xfd17('0x14')][_0xfd17('0x13')]);}})[_0xfd17('0x15')](function(_0x4fa109){logger[_0xfd17('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5688f8,_0x4fa109);_0x22b0d7(_0x4fa109);});});}exports[_0xfd17('0x16')]=function(_0x171d3){var _0x1a3b95=this;return new Promise(function(_0x5e9198,_0x4b2d6e){return db[_0xfd17('0x17')]['findAll']({'raw':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x19')]===undefined?!![]:![]:!![],'where':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')]['where']||null:null,'attributes':_0x171d3['options']?_0x171d3['options']['attributes']||null:null,'limit':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x1a')]||null:null,'include':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x171d3[_0xfd17('0x18')][_0xfd17('0x1b')],function(_0x2d17f0){return{'model':db[_0x2d17f0[_0xfd17('0x1d')]],'as':_0x2d17f0['as'],'attributes':_0x2d17f0[_0xfd17('0x1e')],'include':_0x2d17f0['include']?_[_0xfd17('0x1c')](_0x2d17f0[_0xfd17('0x1b')],function(_0x32bc22){return{'model':db[_0x32bc22[_0xfd17('0x1d')]],'as':_0x32bc22['as'],'attributes':_0x32bc22[_0xfd17('0x1e')],'include':_0x32bc22[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x32bc22[_0xfd17('0x1b')],function(_0x3b9483){return{'model':db[_0x3b9483[_0xfd17('0x1d')]],'as':_0x3b9483['as'],'attributes':_0x3b9483['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd17('0xb')](function(_0x1a8f73){logger[_0xfd17('0xc')](_0xfd17('0x16'),_0x171d3);logger[_0xfd17('0xf')](_0xfd17('0x16'),_0x171d3,JSON['stringify'](_0x1a8f73));_0x5e9198(_0x1a8f73);})['catch'](function(_0x36537b){logger[_0xfd17('0x12')]('GetServicenowAccount',_0x36537b[_0xfd17('0x13')],_0x171d3);_0x4b2d6e(_0x1a3b95['error'](0x1f4,_0x36537b['message']));});});};exports[_0xfd17('0x1f')]=function(_0x27824e){var _0x7524fd=this;return new Promise(function(_0xb31dfb,_0x3f24f1){return db[_0xfd17('0x17')][_0xfd17('0x20')]({'raw':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x19')]===undefined?!![]:![]:!![],'where':_0x27824e[_0xfd17('0x18')]?_0x27824e['options'][_0xfd17('0x21')]||null:null,'attributes':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x1e')]||null:null,'include':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x1b')]?_['map'](_0x27824e[_0xfd17('0x18')][_0xfd17('0x1b')],function(_0x5952ae){return{'model':db[_0x5952ae[_0xfd17('0x1d')]],'as':_0x5952ae['as'],'attributes':_0x5952ae[_0xfd17('0x1e')],'include':_0x5952ae[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x5952ae['include'],function(_0x120d28){return{'model':db[_0x120d28[_0xfd17('0x1d')]],'as':_0x120d28['as'],'attributes':_0x120d28['attributes'],'include':_0x120d28[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x120d28[_0xfd17('0x1b')],function(_0x407a78){return{'model':db[_0x407a78[_0xfd17('0x1d')]],'as':_0x407a78['as'],'attributes':_0x407a78[_0xfd17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd17('0xb')](function(_0x505cdd){logger['info'](_0xfd17('0x1f'),_0x27824e);logger[_0xfd17('0xf')](_0xfd17('0x1f'),_0x27824e,JSON[_0xfd17('0x11')](_0x505cdd));_0xb31dfb(_0x505cdd);})[_0xfd17('0x15')](function(_0x530d9a){logger[_0xfd17('0x12')](_0xfd17('0x1f'),_0x530d9a[_0xfd17('0x13')],_0x27824e);_0x3f24f1(_0x7524fd['error'](0x1f4,_0x530d9a[_0xfd17('0x13')]));});});}; \ No newline at end of file +var _0x4cf3=['../../config/logger','rpc','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','result','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','GetServicenowAccount','ShowServicenowAccount','find','map','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x5e5671,_0x457d56){var _0x3035f8=function(_0x3397e4){while(--_0x3397e4){_0x5e5671['push'](_0x5e5671['shift']());}};_0x3035f8(++_0x457d56);}(_0x4cf3,0x15b));var _0x34cf=function(_0x188f21,_0x2fe457){_0x188f21=_0x188f21-0x0;var _0x3391e0=_0x4cf3[_0x188f21];return _0x3391e0;};'use strict';var _=require('lodash');var util=require(_0x34cf('0x0'));var moment=require(_0x34cf('0x1'));var BPromise=require('bluebird');var rs=require(_0x34cf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34cf('0x3'))['db'];var utils=require(_0x34cf('0x4'));var logger=require(_0x34cf('0x5'))(_0x34cf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x34cf('0x7')][_0x34cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x321ada,_0xf1c572,_0x46e1bb){return new BPromise(function(_0x129479,_0x3e63c6){return client['request'](_0x321ada,_0x46e1bb)[_0x34cf('0x9')](function(_0x75c071){logger[_0x34cf('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0xf1c572,_0x34cf('0xb'));logger[_0x34cf('0xc')](_0x34cf('0xd'),_0xf1c572,'request\x20sent',JSON[_0x34cf('0xe')](_0x75c071));if(_0x75c071[_0x34cf('0xf')]){if(_0x75c071[_0x34cf('0xf')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xf1c572,_0x75c071[_0x34cf('0xf')][_0x34cf('0x10')]);return _0x3e63c6(_0x75c071[_0x34cf('0xf')][_0x34cf('0x10')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xf1c572,_0x75c071[_0x34cf('0xf')]['message']);return _0x129479(_0x75c071[_0x34cf('0xf')]['message']);}else{logger[_0x34cf('0xa')](_0x34cf('0x11'),_0xf1c572,_0x34cf('0xb'));_0x129479(_0x75c071[_0x34cf('0x12')][_0x34cf('0x10')]);}})['catch'](function(_0x436b4a){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0xf1c572,_0x436b4a);_0x3e63c6(_0x436b4a);});});}exports['GetServicenowAccount']=function(_0x4e0924){var _0x47683c=this;return new Promise(function(_0x3a3172,_0x1358e1){return db[_0x34cf('0x13')][_0x34cf('0x14')]({'raw':_0x4e0924[_0x34cf('0x15')]?_0x4e0924[_0x34cf('0x15')][_0x34cf('0x16')]===undefined?!![]:![]:!![],'where':_0x4e0924['options']?_0x4e0924[_0x34cf('0x15')][_0x34cf('0x17')]||null:null,'attributes':_0x4e0924[_0x34cf('0x15')]?_0x4e0924['options'][_0x34cf('0x18')]||null:null,'limit':_0x4e0924[_0x34cf('0x15')]?_0x4e0924[_0x34cf('0x15')][_0x34cf('0x19')]||null:null,'include':_0x4e0924[_0x34cf('0x15')]?_0x4e0924[_0x34cf('0x15')][_0x34cf('0x1a')]?_['map'](_0x4e0924[_0x34cf('0x15')]['include'],function(_0x47d2cc){return{'model':db[_0x47d2cc[_0x34cf('0x1b')]],'as':_0x47d2cc['as'],'attributes':_0x47d2cc[_0x34cf('0x18')],'include':_0x47d2cc['include']?_['map'](_0x47d2cc[_0x34cf('0x1a')],function(_0x2e6386){return{'model':db[_0x2e6386[_0x34cf('0x1b')]],'as':_0x2e6386['as'],'attributes':_0x2e6386[_0x34cf('0x18')],'include':_0x2e6386[_0x34cf('0x1a')]?_['map'](_0x2e6386[_0x34cf('0x1a')],function(_0x41cb63){return{'model':db[_0x41cb63['model']],'as':_0x41cb63['as'],'attributes':_0x41cb63[_0x34cf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x34cf('0x9')](function(_0x528fad){logger[_0x34cf('0xa')](_0x34cf('0x1c'),_0x4e0924);logger[_0x34cf('0xc')](_0x34cf('0x1c'),_0x4e0924,JSON[_0x34cf('0xe')](_0x528fad));_0x3a3172(_0x528fad);})['catch'](function(_0x32df47){logger[_0x34cf('0xf')](_0x34cf('0x1c'),_0x32df47[_0x34cf('0x10')],_0x4e0924);_0x1358e1(_0x47683c[_0x34cf('0xf')](0x1f4,_0x32df47['message']));});});};exports[_0x34cf('0x1d')]=function(_0x54a3e7){var _0x58d15a=this;return new Promise(function(_0xd792e2,_0x17f749){return db[_0x34cf('0x13')][_0x34cf('0x1e')]({'raw':_0x54a3e7[_0x34cf('0x15')]?_0x54a3e7[_0x34cf('0x15')][_0x34cf('0x16')]===undefined?!![]:![]:!![],'where':_0x54a3e7[_0x34cf('0x15')]?_0x54a3e7['options']['where']||null:null,'attributes':_0x54a3e7[_0x34cf('0x15')]?_0x54a3e7[_0x34cf('0x15')][_0x34cf('0x18')]||null:null,'include':_0x54a3e7[_0x34cf('0x15')]?_0x54a3e7['options'][_0x34cf('0x1a')]?_['map'](_0x54a3e7[_0x34cf('0x15')][_0x34cf('0x1a')],function(_0x4d7e9e){return{'model':db[_0x4d7e9e[_0x34cf('0x1b')]],'as':_0x4d7e9e['as'],'attributes':_0x4d7e9e[_0x34cf('0x18')],'include':_0x4d7e9e[_0x34cf('0x1a')]?_[_0x34cf('0x1f')](_0x4d7e9e[_0x34cf('0x1a')],function(_0x25cf9f){return{'model':db[_0x25cf9f[_0x34cf('0x1b')]],'as':_0x25cf9f['as'],'attributes':_0x25cf9f[_0x34cf('0x18')],'include':_0x25cf9f[_0x34cf('0x1a')]?_[_0x34cf('0x1f')](_0x25cf9f[_0x34cf('0x1a')],function(_0x2420b0){return{'model':db[_0x2420b0[_0x34cf('0x1b')]],'as':_0x2420b0['as'],'attributes':_0x2420b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x34cf('0x9')](function(_0x38340f){logger['info'](_0x34cf('0x1d'),_0x54a3e7);logger[_0x34cf('0xc')]('ShowServicenowAccount',_0x54a3e7,JSON['stringify'](_0x38340f));_0xd792e2(_0x38340f);})['catch'](function(_0x1ab092){logger['error'](_0x34cf('0x1d'),_0x1ab092[_0x34cf('0x10')],_0x54a3e7);_0x17f749(_0x58d15a[_0x34cf('0xf')](0x1f4,_0x1ab092[_0x34cf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 9d4d2ea..55fb38e 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 _0xe555=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../config/environment','./intServicenowConfiguration.controller','get','index'];(function(_0x53998a,_0x169537){var _0x329629=function(_0x1091fd){while(--_0x1091fd){_0x53998a['push'](_0x53998a['shift']());}};_0x329629(++_0x169537);}(_0xe555,0x98));var _0x5e55=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xe555[_0x134827];return _0x366671;};'use strict';var multer=require(_0x5e55('0x0'));var util=require('util');var path=require(_0x5e55('0x1'));var timeout=require(_0x5e55('0x2'));var express=require('express');var router=express[_0x5e55('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e55('0x4'));var controller=require(_0x5e55('0x5'));router[_0x5e55('0x6')]('/',auth['isAuthenticated'](),controller[_0x5e55('0x7')]);router[_0x5e55('0x6')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xa')]);router[_0x5e55('0x6')](_0x5e55('0xb'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xc')]);router['get'](_0x5e55('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x5e55('0xe'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e55('0x10')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller['update']);router[_0x5e55('0x11')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller[_0x5e55('0x12')]);module[_0x5e55('0x13')]=router; \ No newline at end of file +var _0x3910=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x1e7bc9,_0x39582e){var _0x211fab=function(_0x159635){while(--_0x159635){_0x1e7bc9['push'](_0x1e7bc9['shift']());}};_0x211fab(++_0x39582e);}(_0x3910,0x1d8));var _0x0391=function(_0x10ac4a,_0x27340b){_0x10ac4a=_0x10ac4a-0x0;var _0x5e7b1e=_0x3910[_0x10ac4a];return _0x5e7b1e;};'use strict';var multer=require(_0x0391('0x0'));var util=require(_0x0391('0x1'));var path=require(_0x0391('0x2'));var timeout=require(_0x0391('0x3'));var express=require(_0x0391('0x4'));var router=express['Router']();var fs_extra=require(_0x0391('0x5'));var auth=require(_0x0391('0x6'));var interaction=require(_0x0391('0x7'));var config=require(_0x0391('0x8'));var controller=require(_0x0391('0x9'));router['get']('/',auth[_0x0391('0xa')](),controller[_0x0391('0xb')]);router[_0x0391('0xc')](_0x0391('0xd'),auth[_0x0391('0xa')](),controller[_0x0391('0xe')]);router['get'](_0x0391('0xf'),auth['isAuthenticated'](),controller[_0x0391('0x10')]);router[_0x0391('0xc')](_0x0391('0x11'),auth[_0x0391('0xa')](),controller[_0x0391('0x12')]);router[_0x0391('0xc')](_0x0391('0x13'),auth[_0x0391('0xa')](),controller[_0x0391('0x14')]);router[_0x0391('0x15')]('/',auth[_0x0391('0xa')](),controller['create']);router[_0x0391('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0391('0x17')]);router[_0x0391('0x18')](_0x0391('0xd'),auth['isAuthenticated'](),controller[_0x0391('0x19')]);module[_0x0391('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e2b92dc..aaf7388 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 _0x3b45=['STRING','sequelize'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x3b45,0xcd));var _0x53b4=function(_0x364096,_0x1d08c6){_0x364096=_0x364096-0x0;var _0x34fc2e=_0x3b45[_0x364096];return _0x34fc2e;};'use strict';var Sequelize=require(_0x53b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x53b4('0x1')]},'description':{'type':Sequelize[_0x53b4('0x1')]}}; \ No newline at end of file +var _0xabbd=['STRING','sequelize'];(function(_0x2b1633,_0x5ddbaf){var _0x2cdb5f=function(_0x278c1b){while(--_0x278c1b){_0x2b1633['push'](_0x2b1633['shift']());}};_0x2cdb5f(++_0x5ddbaf);}(_0xabbd,0xa9));var _0xdabb=function(_0x64ce40,_0x21507d){_0x64ce40=_0x64ce40-0x0;var _0x41a783=_0xabbd[_0x64ce40];return _0x41a783;};'use strict';var Sequelize=require(_0xdabb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdabb('0x1')]},'description':{'type':Sequelize[_0xdabb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fbc4b35..aa3d48f 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 _0x25ea=['ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','filter','getSubjects'];(function(_0x35050b,_0x1470b8){var _0x37d62e=function(_0x80b4b0){while(--_0x80b4b0){_0x35050b['push'](_0x35050b['shift']());}};_0x37d62e(++_0x1470b8);}(_0x25ea,0x1ab));var _0xa25e=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x25ea[_0x46111d];return _0xe82586;};'use strict';var emlformat=require(_0xa25e('0x0'));var rimraf=require(_0xa25e('0x1'));var zipdir=require(_0xa25e('0x2'));var jsonpatch=require(_0xa25e('0x3'));var rp=require(_0xa25e('0x4'));var moment=require(_0xa25e('0x5'));var BPromise=require(_0xa25e('0x6'));var Mustache=require('mustache');var util=require(_0xa25e('0x7'));var path=require(_0xa25e('0x8'));var sox=require(_0xa25e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa25e('0xa'));var _=require(_0xa25e('0xb'));var squel=require(_0xa25e('0xc'));var crypto=require(_0xa25e('0xd'));var jsforce=require(_0xa25e('0xe'));var deskjs=require(_0xa25e('0xf'));var toCsv=require(_0xa25e('0x10'));var querystring=require('querystring');var Papa=require(_0xa25e('0x11'));var Redis=require('ioredis');var authService=require(_0xa25e('0x12'));var qs=require(_0xa25e('0x13'));var as=require(_0xa25e('0x14'));var hardwareService=require(_0xa25e('0x15'));var logger=require(_0xa25e('0x16'))(_0xa25e('0x17'));var utils=require(_0xa25e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa25e('0x19'));var db=require(_0xa25e('0x1a'))['db'];function respondWithStatusCode(_0x54778d,_0x267548){_0x267548=_0x267548||0xcc;return function(_0x9da06d){if(_0x9da06d){return _0x54778d[_0xa25e('0x1b')](_0x267548);}return _0x54778d[_0xa25e('0x1c')](_0x267548)[_0xa25e('0x1d')]();};}function respondWithResult(_0x181020,_0x9e14a8){_0x9e14a8=_0x9e14a8||0xc8;return function(_0x536b41){if(_0x536b41){return _0x181020[_0xa25e('0x1c')](_0x9e14a8)[_0xa25e('0x1e')](_0x536b41);}};}function respondWithFilteredResult(_0x290321,_0x3cde13){return function(_0x49f779){if(_0x49f779){var _0x3a1530=typeof _0x3cde13[_0xa25e('0x1f')]===_0xa25e('0x20')&&typeof _0x3cde13['limit']===_0xa25e('0x20');var _0x1be02c=_0x49f779[_0xa25e('0x21')];var _0xcece9a=_0x3a1530?0x0:_0x3cde13[_0xa25e('0x1f')];var _0x5bcef7=_0x3a1530?_0x49f779['count']:_0x3cde13['offset']+_0x3cde13['limit'];var _0x1da682;if(_0x5bcef7>=_0x1be02c){_0x5bcef7=_0x1be02c;_0x1da682=0xc8;}else{_0x1da682=0xce;}_0x290321[_0xa25e('0x1c')](_0x1da682);return _0x290321[_0xa25e('0x22')](_0xa25e('0x23'),_0xcece9a+'-'+_0x5bcef7+'/'+_0x1be02c)[_0xa25e('0x1e')](_0x49f779);}return null;};}function patchUpdates(_0x530a47){return function(_0x3084b4){try{jsonpatch[_0xa25e('0x24')](_0x3084b4,_0x530a47,!![]);}catch(_0x50efbb){return BPromise[_0xa25e('0x25')](_0x50efbb);}return _0x3084b4[_0xa25e('0x26')]();};}function saveUpdates(_0x56da50,_0x20f485){return function(_0x55c8ef){if(_0x55c8ef){return _0x55c8ef[_0xa25e('0x27')](_0x56da50)[_0xa25e('0x28')](function(_0x1ae352){return _0x1ae352;});}return null;};}function removeEntity(_0x398947,_0x16a24d){return function(_0xbff8fd){if(_0xbff8fd){return _0xbff8fd[_0xa25e('0x29')]()[_0xa25e('0x28')](function(){_0x398947[_0xa25e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587060,_0x2b4bd8){return function(_0x68d6b7){if(!_0x68d6b7){_0x587060['sendStatus'](0x194);}return _0x68d6b7;};}function handleError(_0x5c81c7,_0x3fb7c6){_0x3fb7c6=_0x3fb7c6||0x1f4;return function(_0x4cbf1a){logger[_0xa25e('0x2a')](_0x4cbf1a[_0xa25e('0x2b')]);if(_0x4cbf1a[_0xa25e('0x2c')]){delete _0x4cbf1a[_0xa25e('0x2c')];}_0x5c81c7[_0xa25e('0x1c')](_0x3fb7c6)[_0xa25e('0x2d')](_0x4cbf1a);};}exports[_0xa25e('0x2e')]=function(_0x5ae1a9,_0x1f81d9){var _0x4ff94a={},_0x223aa3={},_0xd76367={'count':0x0,'rows':[]};var _0x1d84e8=_[_0xa25e('0x2f')](db[_0xa25e('0x30')][_0xa25e('0x31')],function(_0x7124c){return{'name':_0x7124c['fieldName'],'type':_0x7124c[_0xa25e('0x32')][_0xa25e('0x33')]};});_0x223aa3[_0xa25e('0x34')]=_[_0xa25e('0x2f')](_0x1d84e8,_0xa25e('0x2c'));_0x223aa3[_0xa25e('0x35')]=_[_0xa25e('0x36')](_0x5ae1a9[_0xa25e('0x35')]);_0x223aa3['filters']=_['intersection'](_0x223aa3[_0xa25e('0x34')],_0x223aa3[_0xa25e('0x35')]);_0x4ff94a[_0xa25e('0x37')]=_[_0xa25e('0x38')](_0x223aa3[_0xa25e('0x34')],qs[_0xa25e('0x39')](_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x39')]));_0x4ff94a[_0xa25e('0x37')]=_0x4ff94a['attributes']['length']?_0x4ff94a['attributes']:_0x223aa3['model'];if(!_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x4ff94a[_0xa25e('0x3c')]=qs[_0xa25e('0x3c')](_0x5ae1a9[_0xa25e('0x35')]['limit']);_0x4ff94a[_0xa25e('0x1f')]=qs[_0xa25e('0x1f')](_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x1f')]);}_0x4ff94a[_0xa25e('0x3d')]=qs[_0xa25e('0x3e')](_0x5ae1a9['query']['sort']);_0x4ff94a[_0xa25e('0x3f')]=qs['filters'](_[_0xa25e('0x40')](_0x5ae1a9[_0xa25e('0x35')],_0x223aa3[_0xa25e('0x41')]),_0x1d84e8);if(_0x5ae1a9[_0xa25e('0x35')]['filter']){_0x4ff94a['where']=_[_0xa25e('0x42')](_0x4ff94a['where'],{'$or':_[_0xa25e('0x2f')](_0x1d84e8,function(_0xafdb3f){if(_0xafdb3f['type']!==_0xa25e('0x43')){var _0x12cc22={};_0x12cc22[_0xafdb3f['name']]={'$like':'%'+_0x5ae1a9['query']['filter']+'%'};return _0x12cc22;}})});}_0x4ff94a=_[_0xa25e('0x42')]({},_0x4ff94a,_0x5ae1a9[_0xa25e('0x44')]);var _0x1a0c7c={'where':_0x4ff94a['where']};return db[_0xa25e('0x30')][_0xa25e('0x21')](_0x1a0c7c)[_0xa25e('0x28')](function(_0x873722){_0xd76367[_0xa25e('0x21')]=_0x873722;if(_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x45')]){_0x4ff94a['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xa25e('0x46')](_0x4ff94a);})[_0xa25e('0x28')](function(_0x38e0e8){_0xd76367[_0xa25e('0x47')]=_0x38e0e8;return _0xd76367;})['then'](respondWithFilteredResult(_0x1f81d9,_0x4ff94a))[_0xa25e('0x48')](handleError(_0x1f81d9,null));};exports[_0xa25e('0x49')]=function(_0x4b97df,_0x1da74c){var _0x30334f={'raw':![],'where':{'id':_0x4b97df[_0xa25e('0x4a')]['id']}},_0x5b03f1={};_0x5b03f1[_0xa25e('0x34')]=_['keys'](db[_0xa25e('0x30')][_0xa25e('0x31')]);_0x5b03f1[_0xa25e('0x35')]=_[_0xa25e('0x36')](_0x4b97df[_0xa25e('0x35')]);_0x5b03f1['filters']=_[_0xa25e('0x38')](_0x5b03f1[_0xa25e('0x34')],_0x5b03f1[_0xa25e('0x35')]);_0x30334f['attributes']=_['intersection'](_0x5b03f1[_0xa25e('0x34')],qs[_0xa25e('0x39')](_0x4b97df[_0xa25e('0x35')][_0xa25e('0x39')]));_0x30334f[_0xa25e('0x37')]=_0x30334f['attributes'][_0xa25e('0x4b')]?_0x30334f[_0xa25e('0x37')]:_0x5b03f1[_0xa25e('0x34')];if(_0x4b97df[_0xa25e('0x35')][_0xa25e('0x45')]){_0x30334f['include']=[{'all':!![]}];}_0x30334f=_[_0xa25e('0x42')]({},_0x30334f,_0x4b97df[_0xa25e('0x44')]);return db[_0xa25e('0x30')][_0xa25e('0x4c')](_0x30334f)[_0xa25e('0x28')](handleEntityNotFound(_0x1da74c,null))[_0xa25e('0x28')](respondWithResult(_0x1da74c,null))['catch'](handleError(_0x1da74c,null));};exports['create']=function(_0x662aa5,_0xd0aa45){return db[_0xa25e('0x30')][_0xa25e('0x4d')](_0x662aa5[_0xa25e('0x4e')],{})['then'](respondWithResult(_0xd0aa45,0xc9))[_0xa25e('0x48')](handleError(_0xd0aa45,null));};exports[_0xa25e('0x27')]=function(_0x25ec66,_0x3f65bc){if(_0x25ec66[_0xa25e('0x4e')]['id']){delete _0x25ec66[_0xa25e('0x4e')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x25ec66['params']['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x3f65bc,null))[_0xa25e('0x28')](saveUpdates(_0x25ec66[_0xa25e('0x4e')],null))[_0xa25e('0x28')](respondWithResult(_0x3f65bc,null))[_0xa25e('0x48')](handleError(_0x3f65bc,null));};exports[_0xa25e('0x29')]=function(_0x2a02d7,_0x35fc3f){return db[_0xa25e('0x30')][_0xa25e('0x4c')]({'where':{'id':_0x2a02d7[_0xa25e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35fc3f,null))[_0xa25e('0x28')](removeEntity(_0x35fc3f,null))[_0xa25e('0x48')](handleError(_0x35fc3f,null));};exports[_0xa25e('0x4f')]=function(_0x40499a,_0x21c799,_0x577954){var _0x2153ec={};var _0x3d37e2={};var _0x53d3ec;var _0xe53eac;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x40499a['params']['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x21c799,null))[_0xa25e('0x28')](function(_0x217018){if(_0x217018){_0x53d3ec=_0x217018;_0x3d37e2[_0xa25e('0x34')]=_['keys'](db['ServicenowField'][_0xa25e('0x31')]);_0x3d37e2['query']=_['keys'](_0x40499a[_0xa25e('0x35')]);_0x3d37e2['filters']=_[_0xa25e('0x38')](_0x3d37e2['model'],_0x3d37e2[_0xa25e('0x35')]);_0x2153ec['attributes']=_[_0xa25e('0x38')](_0x3d37e2['model'],qs[_0xa25e('0x39')](_0x40499a[_0xa25e('0x35')][_0xa25e('0x39')]));_0x2153ec[_0xa25e('0x37')]=_0x2153ec['attributes'][_0xa25e('0x4b')]?_0x2153ec['attributes']:_0x3d37e2['model'];_0x2153ec[_0xa25e('0x3d')]=qs[_0xa25e('0x3e')](_0x40499a[_0xa25e('0x35')]['sort']);_0x2153ec['where']=qs['filters'](_['pick'](_0x40499a['query'],_0x3d37e2[_0xa25e('0x41')]));if(_0x40499a[_0xa25e('0x35')][_0xa25e('0x51')]){_0x2153ec[_0xa25e('0x3f')]=_[_0xa25e('0x42')](_0x2153ec[_0xa25e('0x3f')],{'$or':_[_0xa25e('0x2f')](_0x2153ec[_0xa25e('0x37')],function(_0x1dd905){var _0x41fc2c={};_0x41fc2c[_0x1dd905]={'$like':'%'+_0x40499a[_0xa25e('0x35')][_0xa25e('0x51')]+'%'};return _0x41fc2c;})});}_0x2153ec=_[_0xa25e('0x42')]({},_0x2153ec,_0x40499a[_0xa25e('0x44')]);return _0x53d3ec[_0xa25e('0x4f')](_0x2153ec);}})[_0xa25e('0x28')](function(_0x5f3e27){if(_0x5f3e27){_0xe53eac=_0x5f3e27[_0xa25e('0x4b')];if(!_0x40499a['query'][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x2153ec['limit']=qs['limit'](_0x40499a[_0xa25e('0x35')][_0xa25e('0x3c')]);_0x2153ec['offset']=qs[_0xa25e('0x1f')](_0x40499a[_0xa25e('0x35')]['offset']);}return _0x53d3ec['getFields'](_0x2153ec);}})[_0xa25e('0x28')](function(_0x4b7192){if(_0x4b7192){return _0x4b7192?{'count':_0xe53eac,'rows':_0x4b7192}:null;}})[_0xa25e('0x28')](respondWithResult(_0x21c799,null))[_0xa25e('0x48')](handleError(_0x21c799,null));};exports[_0xa25e('0x52')]=function(_0x33c2cb,_0x50f533,_0x5871d4){var _0x3f2ee9={};var _0x3a9e68={};var _0x2a7053;var _0x3bdb7d;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x33c2cb[_0xa25e('0x4a')]['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x50f533,null))['then'](function(_0x2d57fa){if(_0x2d57fa){_0x2a7053=_0x2d57fa;_0x3a9e68[_0xa25e('0x34')]=_[_0xa25e('0x36')](db[_0xa25e('0x53')][_0xa25e('0x31')]);_0x3a9e68[_0xa25e('0x35')]=_['keys'](_0x33c2cb[_0xa25e('0x35')]);_0x3a9e68[_0xa25e('0x41')]=_['intersection'](_0x3a9e68[_0xa25e('0x34')],_0x3a9e68[_0xa25e('0x35')]);_0x3f2ee9['attributes']=_[_0xa25e('0x38')](_0x3a9e68['model'],qs[_0xa25e('0x39')](_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x39')]));_0x3f2ee9[_0xa25e('0x37')]=_0x3f2ee9[_0xa25e('0x37')][_0xa25e('0x4b')]?_0x3f2ee9[_0xa25e('0x37')]:_0x3a9e68['model'];_0x3f2ee9['order']=qs[_0xa25e('0x3e')](_0x33c2cb['query']['sort']);_0x3f2ee9[_0xa25e('0x3f')]=qs['filters'](_[_0xa25e('0x40')](_0x33c2cb[_0xa25e('0x35')],_0x3a9e68[_0xa25e('0x41')]));if(_0x33c2cb['query']['filter']){_0x3f2ee9[_0xa25e('0x3f')]=_[_0xa25e('0x42')](_0x3f2ee9[_0xa25e('0x3f')],{'$or':_['map'](_0x3f2ee9['attributes'],function(_0x5ca0f5){var _0x31732e={};_0x31732e[_0x5ca0f5]={'$like':'%'+_0x33c2cb['query'][_0xa25e('0x51')]+'%'};return _0x31732e;})});}_0x3f2ee9=_[_0xa25e('0x42')]({},_0x3f2ee9,_0x33c2cb[_0xa25e('0x44')]);return _0x2a7053[_0xa25e('0x52')](_0x3f2ee9);}})['then'](function(_0x2c34a0){if(_0x2c34a0){_0x3bdb7d=_0x2c34a0['length'];if(!_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x3f2ee9[_0xa25e('0x3c')]=qs['limit'](_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x3c')]);_0x3f2ee9[_0xa25e('0x1f')]=qs['offset'](_0x33c2cb['query'][_0xa25e('0x1f')]);}return _0x2a7053[_0xa25e('0x52')](_0x3f2ee9);}})[_0xa25e('0x28')](function(_0x57a5a4){if(_0x57a5a4){return _0x57a5a4?{'count':_0x3bdb7d,'rows':_0x57a5a4}:null;}})[_0xa25e('0x28')](respondWithResult(_0x50f533,null))[_0xa25e('0x48')](handleError(_0x50f533,null));};exports[_0xa25e('0x54')]=function(_0x5eaa07,_0x48e369,_0x56bacc){var _0xfd1150={};var _0x51763b={};var _0x23f8ae;var _0x58d09b;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x5eaa07[_0xa25e('0x4a')]['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x48e369,null))['then'](function(_0x29b981){if(_0x29b981){_0x23f8ae=_0x29b981;_0x51763b['model']=_['keys'](db[_0xa25e('0x53')][_0xa25e('0x31')]);_0x51763b['query']=_['keys'](_0x5eaa07[_0xa25e('0x35')]);_0x51763b['filters']=_['intersection'](_0x51763b['model'],_0x51763b[_0xa25e('0x35')]);_0xfd1150['attributes']=_[_0xa25e('0x38')](_0x51763b[_0xa25e('0x34')],qs['fields'](_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x39')]));_0xfd1150[_0xa25e('0x37')]=_0xfd1150[_0xa25e('0x37')][_0xa25e('0x4b')]?_0xfd1150[_0xa25e('0x37')]:_0x51763b[_0xa25e('0x34')];_0xfd1150[_0xa25e('0x3d')]=qs['sort'](_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x3e')]);_0xfd1150['where']=qs[_0xa25e('0x41')](_[_0xa25e('0x40')](_0x5eaa07['query'],_0x51763b[_0xa25e('0x41')]));if(_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x51')]){_0xfd1150[_0xa25e('0x3f')]=_['merge'](_0xfd1150[_0xa25e('0x3f')],{'$or':_[_0xa25e('0x2f')](_0xfd1150[_0xa25e('0x37')],function(_0xdbcfeb){var _0xb4356c={};_0xb4356c[_0xdbcfeb]={'$like':'%'+_0x5eaa07['query']['filter']+'%'};return _0xb4356c;})});}_0xfd1150=_['merge']({},_0xfd1150,_0x5eaa07[_0xa25e('0x44')]);return _0x23f8ae[_0xa25e('0x54')](_0xfd1150);}})['then'](function(_0x1948a2){if(_0x1948a2){_0x58d09b=_0x1948a2[_0xa25e('0x4b')];if(!_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0xfd1150['limit']=qs[_0xa25e('0x3c')](_0x5eaa07[_0xa25e('0x35')]['limit']);_0xfd1150['offset']=qs[_0xa25e('0x1f')](_0x5eaa07['query'][_0xa25e('0x1f')]);}return _0x23f8ae['getDescriptions'](_0xfd1150);}})[_0xa25e('0x28')](function(_0x130070){if(_0x130070){return _0x130070?{'count':_0x58d09b,'rows':_0x130070}:null;}})[_0xa25e('0x28')](respondWithResult(_0x48e369,null))[_0xa25e('0x48')](handleError(_0x48e369,null));}; \ No newline at end of file +var _0xb0ec=['hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','getFields','findOne','keys','ServicenowField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','offset','limit','undefined','count','reject','save','update','then','destroy','end','stack','name','send','index','ServicenowConfiguration','rawAttributes','type','model','map','query','intersection','attributes','length'];(function(_0x509c0b,_0x4d4553){var _0x5f0415=function(_0x4f9d10){while(--_0x4f9d10){_0x509c0b['push'](_0x509c0b['shift']());}};_0x5f0415(++_0x4d4553);}(_0xb0ec,0x144));var _0xcb0e=function(_0x39a438,_0x19e210){_0x39a438=_0x39a438-0x0;var _0x43a208=_0xb0ec[_0x39a438];return _0x43a208;};'use strict';var emlformat=require(_0xcb0e('0x0'));var rimraf=require(_0xcb0e('0x1'));var zipdir=require(_0xcb0e('0x2'));var jsonpatch=require(_0xcb0e('0x3'));var rp=require('request-promise');var moment=require(_0xcb0e('0x4'));var BPromise=require(_0xcb0e('0x5'));var Mustache=require('mustache');var util=require(_0xcb0e('0x6'));var path=require(_0xcb0e('0x7'));var sox=require(_0xcb0e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb0e('0x9'));var squel=require(_0xcb0e('0xa'));var crypto=require(_0xcb0e('0xb'));var jsforce=require(_0xcb0e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb0e('0xd'));var Papa=require('papaparse');var Redis=require(_0xcb0e('0xe'));var authService=require(_0xcb0e('0xf'));var qs=require(_0xcb0e('0x10'));var as=require(_0xcb0e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb0e('0x12'))(_0xcb0e('0x13'));var utils=require(_0xcb0e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc3056d,_0x1c08fd){_0x1c08fd=_0x1c08fd||0xcc;return function(_0x407341){if(_0x407341){return _0xc3056d[_0xcb0e('0x15')](_0x1c08fd);}return _0xc3056d[_0xcb0e('0x16')](_0x1c08fd)['end']();};}function respondWithResult(_0x36838f,_0x1be6e5){_0x1be6e5=_0x1be6e5||0xc8;return function(_0x59d71c){if(_0x59d71c){return _0x36838f[_0xcb0e('0x16')](_0x1be6e5)['json'](_0x59d71c);}};}function respondWithFilteredResult(_0xc93ead,_0x5932aa){return function(_0xc46831){if(_0xc46831){var _0x298bc3=typeof _0x5932aa[_0xcb0e('0x17')]==='undefined'&&typeof _0x5932aa[_0xcb0e('0x18')]===_0xcb0e('0x19');var _0x4971da=_0xc46831[_0xcb0e('0x1a')];var _0xd806a6=_0x298bc3?0x0:_0x5932aa[_0xcb0e('0x17')];var _0x5e6d20=_0x298bc3?_0xc46831[_0xcb0e('0x1a')]:_0x5932aa[_0xcb0e('0x17')]+_0x5932aa[_0xcb0e('0x18')];var _0x135604;if(_0x5e6d20>=_0x4971da){_0x5e6d20=_0x4971da;_0x135604=0xc8;}else{_0x135604=0xce;}_0xc93ead['status'](_0x135604);return _0xc93ead['set']('Content-Range',_0xd806a6+'-'+_0x5e6d20+'/'+_0x4971da)['json'](_0xc46831);}return null;};}function patchUpdates(_0x56725b){return function(_0x5f4b37){try{jsonpatch['apply'](_0x5f4b37,_0x56725b,!![]);}catch(_0x527592){return BPromise[_0xcb0e('0x1b')](_0x527592);}return _0x5f4b37[_0xcb0e('0x1c')]();};}function saveUpdates(_0x3cb0b9,_0x2a5668){return function(_0x46ed1d){if(_0x46ed1d){return _0x46ed1d[_0xcb0e('0x1d')](_0x3cb0b9)[_0xcb0e('0x1e')](function(_0x585c2f){return _0x585c2f;});}return null;};}function removeEntity(_0xab3109,_0x2d86c2){return function(_0x6b5c70){if(_0x6b5c70){return _0x6b5c70[_0xcb0e('0x1f')]()[_0xcb0e('0x1e')](function(){_0xab3109[_0xcb0e('0x16')](0xcc)[_0xcb0e('0x20')]();});}};}function handleEntityNotFound(_0x489377,_0x2de288){return function(_0x3290c5){if(!_0x3290c5){_0x489377[_0xcb0e('0x15')](0x194);}return _0x3290c5;};}function handleError(_0x1cf442,_0x1c0c25){_0x1c0c25=_0x1c0c25||0x1f4;return function(_0x374ae6){logger['error'](_0x374ae6[_0xcb0e('0x21')]);if(_0x374ae6[_0xcb0e('0x22')]){delete _0x374ae6[_0xcb0e('0x22')];}_0x1cf442[_0xcb0e('0x16')](_0x1c0c25)[_0xcb0e('0x23')](_0x374ae6);};}exports[_0xcb0e('0x24')]=function(_0x368877,_0x3f7db8){var _0xbd0220={},_0x96b57a={},_0x49b08b={'count':0x0,'rows':[]};var _0x364e33=_['map'](db[_0xcb0e('0x25')][_0xcb0e('0x26')],function(_0x1af3e7){return{'name':_0x1af3e7['fieldName'],'type':_0x1af3e7[_0xcb0e('0x27')]['key']};});_0x96b57a[_0xcb0e('0x28')]=_[_0xcb0e('0x29')](_0x364e33,_0xcb0e('0x22'));_0x96b57a[_0xcb0e('0x2a')]=_['keys'](_0x368877[_0xcb0e('0x2a')]);_0x96b57a['filters']=_[_0xcb0e('0x2b')](_0x96b57a[_0xcb0e('0x28')],_0x96b57a[_0xcb0e('0x2a')]);_0xbd0220[_0xcb0e('0x2c')]=_[_0xcb0e('0x2b')](_0x96b57a[_0xcb0e('0x28')],qs['fields'](_0x368877[_0xcb0e('0x2a')]['fields']));_0xbd0220[_0xcb0e('0x2c')]=_0xbd0220['attributes'][_0xcb0e('0x2d')]?_0xbd0220['attributes']:_0x96b57a[_0xcb0e('0x28')];if(!_0x368877['query'][_0xcb0e('0x2e')](_0xcb0e('0x2f'))){_0xbd0220[_0xcb0e('0x18')]=qs[_0xcb0e('0x18')](_0x368877['query'][_0xcb0e('0x18')]);_0xbd0220[_0xcb0e('0x17')]=qs[_0xcb0e('0x17')](_0x368877[_0xcb0e('0x2a')][_0xcb0e('0x17')]);}_0xbd0220[_0xcb0e('0x30')]=qs['sort'](_0x368877[_0xcb0e('0x2a')][_0xcb0e('0x31')]);_0xbd0220[_0xcb0e('0x32')]=qs[_0xcb0e('0x33')](_['pick'](_0x368877[_0xcb0e('0x2a')],_0x96b57a[_0xcb0e('0x33')]),_0x364e33);if(_0x368877[_0xcb0e('0x2a')][_0xcb0e('0x34')]){_0xbd0220[_0xcb0e('0x32')]=_['merge'](_0xbd0220[_0xcb0e('0x32')],{'$or':_[_0xcb0e('0x29')](_0x364e33,function(_0x432c9b){if(_0x432c9b[_0xcb0e('0x27')]!==_0xcb0e('0x35')){var _0x2dc46f={};_0x2dc46f[_0x432c9b[_0xcb0e('0x22')]]={'$like':'%'+_0x368877[_0xcb0e('0x2a')][_0xcb0e('0x34')]+'%'};return _0x2dc46f;}})});}_0xbd0220=_[_0xcb0e('0x36')]({},_0xbd0220,_0x368877[_0xcb0e('0x37')]);var _0x3df948={'where':_0xbd0220['where']};return db[_0xcb0e('0x25')][_0xcb0e('0x1a')](_0x3df948)[_0xcb0e('0x1e')](function(_0x4392cb){_0x49b08b[_0xcb0e('0x1a')]=_0x4392cb;if(_0x368877['query'][_0xcb0e('0x38')]){_0xbd0220['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xcb0e('0x39')](_0xbd0220);})[_0xcb0e('0x1e')](function(_0x1c9e9e){_0x49b08b[_0xcb0e('0x3a')]=_0x1c9e9e;return _0x49b08b;})[_0xcb0e('0x1e')](respondWithFilteredResult(_0x3f7db8,_0xbd0220))[_0xcb0e('0x3b')](handleError(_0x3f7db8,null));};exports[_0xcb0e('0x3c')]=function(_0x1e2f7d,_0x4979f2){var _0x16b2eb={'raw':![],'where':{'id':_0x1e2f7d[_0xcb0e('0x3d')]['id']}},_0x26636a={};_0x26636a[_0xcb0e('0x28')]=_['keys'](db[_0xcb0e('0x25')][_0xcb0e('0x26')]);_0x26636a[_0xcb0e('0x2a')]=_['keys'](_0x1e2f7d[_0xcb0e('0x2a')]);_0x26636a['filters']=_[_0xcb0e('0x2b')](_0x26636a[_0xcb0e('0x28')],_0x26636a['query']);_0x16b2eb[_0xcb0e('0x2c')]=_[_0xcb0e('0x2b')](_0x26636a['model'],qs[_0xcb0e('0x3e')](_0x1e2f7d[_0xcb0e('0x2a')]['fields']));_0x16b2eb['attributes']=_0x16b2eb[_0xcb0e('0x2c')][_0xcb0e('0x2d')]?_0x16b2eb[_0xcb0e('0x2c')]:_0x26636a[_0xcb0e('0x28')];if(_0x1e2f7d[_0xcb0e('0x2a')][_0xcb0e('0x38')]){_0x16b2eb[_0xcb0e('0x3f')]=[{'all':!![]}];}_0x16b2eb=_[_0xcb0e('0x36')]({},_0x16b2eb,_0x1e2f7d[_0xcb0e('0x37')]);return db[_0xcb0e('0x25')][_0xcb0e('0x40')](_0x16b2eb)[_0xcb0e('0x1e')](handleEntityNotFound(_0x4979f2,null))[_0xcb0e('0x1e')](respondWithResult(_0x4979f2,null))[_0xcb0e('0x3b')](handleError(_0x4979f2,null));};exports[_0xcb0e('0x41')]=function(_0xdbae09,_0x16a3ec){return db[_0xcb0e('0x25')]['create'](_0xdbae09['body'],{})['then'](respondWithResult(_0x16a3ec,0xc9))['catch'](handleError(_0x16a3ec,null));};exports[_0xcb0e('0x1d')]=function(_0x54286c,_0x39dfe4){if(_0x54286c[_0xcb0e('0x42')]['id']){delete _0x54286c[_0xcb0e('0x42')]['id'];}return db[_0xcb0e('0x25')][_0xcb0e('0x40')]({'where':{'id':_0x54286c[_0xcb0e('0x3d')]['id']}})[_0xcb0e('0x1e')](handleEntityNotFound(_0x39dfe4,null))[_0xcb0e('0x1e')](saveUpdates(_0x54286c[_0xcb0e('0x42')],null))[_0xcb0e('0x1e')](respondWithResult(_0x39dfe4,null))[_0xcb0e('0x3b')](handleError(_0x39dfe4,null));};exports['destroy']=function(_0x4120ae,_0x4b7680){return db[_0xcb0e('0x25')][_0xcb0e('0x40')]({'where':{'id':_0x4120ae[_0xcb0e('0x3d')]['id']}})[_0xcb0e('0x1e')](handleEntityNotFound(_0x4b7680,null))[_0xcb0e('0x1e')](removeEntity(_0x4b7680,null))[_0xcb0e('0x3b')](handleError(_0x4b7680,null));};exports[_0xcb0e('0x43')]=function(_0x8dc2c7,_0x2dd944,_0x2ce37c){var _0x280c41={};var _0x3d47c6={};var _0x56b3db;var _0x11e6af;return db[_0xcb0e('0x25')][_0xcb0e('0x44')]({'where':{'id':_0x8dc2c7[_0xcb0e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2dd944,null))['then'](function(_0x33ef87){if(_0x33ef87){_0x56b3db=_0x33ef87;_0x3d47c6['model']=_[_0xcb0e('0x45')](db[_0xcb0e('0x46')][_0xcb0e('0x26')]);_0x3d47c6[_0xcb0e('0x2a')]=_[_0xcb0e('0x45')](_0x8dc2c7['query']);_0x3d47c6[_0xcb0e('0x33')]=_[_0xcb0e('0x2b')](_0x3d47c6[_0xcb0e('0x28')],_0x3d47c6[_0xcb0e('0x2a')]);_0x280c41[_0xcb0e('0x2c')]=_[_0xcb0e('0x2b')](_0x3d47c6[_0xcb0e('0x28')],qs[_0xcb0e('0x3e')](_0x8dc2c7[_0xcb0e('0x2a')][_0xcb0e('0x3e')]));_0x280c41[_0xcb0e('0x2c')]=_0x280c41['attributes']['length']?_0x280c41['attributes']:_0x3d47c6['model'];_0x280c41[_0xcb0e('0x30')]=qs['sort'](_0x8dc2c7[_0xcb0e('0x2a')][_0xcb0e('0x31')]);_0x280c41['where']=qs[_0xcb0e('0x33')](_[_0xcb0e('0x47')](_0x8dc2c7[_0xcb0e('0x2a')],_0x3d47c6[_0xcb0e('0x33')]));if(_0x8dc2c7[_0xcb0e('0x2a')][_0xcb0e('0x34')]){_0x280c41[_0xcb0e('0x32')]=_[_0xcb0e('0x36')](_0x280c41[_0xcb0e('0x32')],{'$or':_['map'](_0x280c41[_0xcb0e('0x2c')],function(_0x4fd02f){var _0x5e1431={};_0x5e1431[_0x4fd02f]={'$like':'%'+_0x8dc2c7['query']['filter']+'%'};return _0x5e1431;})});}_0x280c41=_[_0xcb0e('0x36')]({},_0x280c41,_0x8dc2c7[_0xcb0e('0x37')]);return _0x56b3db[_0xcb0e('0x43')](_0x280c41);}})[_0xcb0e('0x1e')](function(_0xf17801){if(_0xf17801){_0x11e6af=_0xf17801[_0xcb0e('0x2d')];if(!_0x8dc2c7['query'][_0xcb0e('0x2e')](_0xcb0e('0x2f'))){_0x280c41[_0xcb0e('0x18')]=qs[_0xcb0e('0x18')](_0x8dc2c7['query'][_0xcb0e('0x18')]);_0x280c41[_0xcb0e('0x17')]=qs[_0xcb0e('0x17')](_0x8dc2c7['query'][_0xcb0e('0x17')]);}return _0x56b3db['getFields'](_0x280c41);}})[_0xcb0e('0x1e')](function(_0x54d8a3){if(_0x54d8a3){return _0x54d8a3?{'count':_0x11e6af,'rows':_0x54d8a3}:null;}})[_0xcb0e('0x1e')](respondWithResult(_0x2dd944,null))['catch'](handleError(_0x2dd944,null));};exports['getSubjects']=function(_0x47c432,_0x12daf6,_0x4b99d7){var _0x433c9b={};var _0x28cdf8={};var _0x59ac51;var _0x25fb3e;return db[_0xcb0e('0x25')][_0xcb0e('0x44')]({'where':{'id':_0x47c432[_0xcb0e('0x3d')]['id']}})[_0xcb0e('0x1e')](handleEntityNotFound(_0x12daf6,null))['then'](function(_0x843eb8){if(_0x843eb8){_0x59ac51=_0x843eb8;_0x28cdf8[_0xcb0e('0x28')]=_[_0xcb0e('0x45')](db[_0xcb0e('0x46')][_0xcb0e('0x26')]);_0x28cdf8['query']=_['keys'](_0x47c432[_0xcb0e('0x2a')]);_0x28cdf8[_0xcb0e('0x33')]=_[_0xcb0e('0x2b')](_0x28cdf8[_0xcb0e('0x28')],_0x28cdf8[_0xcb0e('0x2a')]);_0x433c9b[_0xcb0e('0x2c')]=_['intersection'](_0x28cdf8[_0xcb0e('0x28')],qs['fields'](_0x47c432[_0xcb0e('0x2a')]['fields']));_0x433c9b[_0xcb0e('0x2c')]=_0x433c9b[_0xcb0e('0x2c')][_0xcb0e('0x2d')]?_0x433c9b[_0xcb0e('0x2c')]:_0x28cdf8[_0xcb0e('0x28')];_0x433c9b[_0xcb0e('0x30')]=qs[_0xcb0e('0x31')](_0x47c432['query'][_0xcb0e('0x31')]);_0x433c9b[_0xcb0e('0x32')]=qs['filters'](_['pick'](_0x47c432[_0xcb0e('0x2a')],_0x28cdf8['filters']));if(_0x47c432[_0xcb0e('0x2a')][_0xcb0e('0x34')]){_0x433c9b['where']=_[_0xcb0e('0x36')](_0x433c9b[_0xcb0e('0x32')],{'$or':_[_0xcb0e('0x29')](_0x433c9b['attributes'],function(_0x5c7edf){var _0x5db2e5={};_0x5db2e5[_0x5c7edf]={'$like':'%'+_0x47c432[_0xcb0e('0x2a')][_0xcb0e('0x34')]+'%'};return _0x5db2e5;})});}_0x433c9b=_['merge']({},_0x433c9b,_0x47c432[_0xcb0e('0x37')]);return _0x59ac51[_0xcb0e('0x48')](_0x433c9b);}})[_0xcb0e('0x1e')](function(_0x20b599){if(_0x20b599){_0x25fb3e=_0x20b599['length'];if(!_0x47c432[_0xcb0e('0x2a')][_0xcb0e('0x2e')](_0xcb0e('0x2f'))){_0x433c9b[_0xcb0e('0x18')]=qs['limit'](_0x47c432[_0xcb0e('0x2a')][_0xcb0e('0x18')]);_0x433c9b[_0xcb0e('0x17')]=qs['offset'](_0x47c432[_0xcb0e('0x2a')][_0xcb0e('0x17')]);}return _0x59ac51[_0xcb0e('0x48')](_0x433c9b);}})[_0xcb0e('0x1e')](function(_0x2ebe61){if(_0x2ebe61){return _0x2ebe61?{'count':_0x25fb3e,'rows':_0x2ebe61}:null;}})[_0xcb0e('0x1e')](respondWithResult(_0x12daf6,null))[_0xcb0e('0x3b')](handleError(_0x12daf6,null));};exports[_0xcb0e('0x49')]=function(_0x3cd507,_0x34053c,_0x2320f2){var _0x471ec7={};var _0x5c265f={};var _0x448a17;var _0x55374a;return db[_0xcb0e('0x25')][_0xcb0e('0x44')]({'where':{'id':_0x3cd507[_0xcb0e('0x3d')]['id']}})[_0xcb0e('0x1e')](handleEntityNotFound(_0x34053c,null))[_0xcb0e('0x1e')](function(_0x42d899){if(_0x42d899){_0x448a17=_0x42d899;_0x5c265f[_0xcb0e('0x28')]=_[_0xcb0e('0x45')](db['ServicenowField'][_0xcb0e('0x26')]);_0x5c265f[_0xcb0e('0x2a')]=_[_0xcb0e('0x45')](_0x3cd507[_0xcb0e('0x2a')]);_0x5c265f[_0xcb0e('0x33')]=_['intersection'](_0x5c265f[_0xcb0e('0x28')],_0x5c265f[_0xcb0e('0x2a')]);_0x471ec7['attributes']=_[_0xcb0e('0x2b')](_0x5c265f[_0xcb0e('0x28')],qs['fields'](_0x3cd507['query'][_0xcb0e('0x3e')]));_0x471ec7[_0xcb0e('0x2c')]=_0x471ec7[_0xcb0e('0x2c')][_0xcb0e('0x2d')]?_0x471ec7[_0xcb0e('0x2c')]:_0x5c265f['model'];_0x471ec7[_0xcb0e('0x30')]=qs[_0xcb0e('0x31')](_0x3cd507[_0xcb0e('0x2a')]['sort']);_0x471ec7[_0xcb0e('0x32')]=qs[_0xcb0e('0x33')](_[_0xcb0e('0x47')](_0x3cd507[_0xcb0e('0x2a')],_0x5c265f[_0xcb0e('0x33')]));if(_0x3cd507['query']['filter']){_0x471ec7['where']=_['merge'](_0x471ec7['where'],{'$or':_['map'](_0x471ec7[_0xcb0e('0x2c')],function(_0x253d3c){var _0xa87dfa={};_0xa87dfa[_0x253d3c]={'$like':'%'+_0x3cd507[_0xcb0e('0x2a')][_0xcb0e('0x34')]+'%'};return _0xa87dfa;})});}_0x471ec7=_[_0xcb0e('0x36')]({},_0x471ec7,_0x3cd507[_0xcb0e('0x37')]);return _0x448a17[_0xcb0e('0x49')](_0x471ec7);}})[_0xcb0e('0x1e')](function(_0x2f3843){if(_0x2f3843){_0x55374a=_0x2f3843[_0xcb0e('0x2d')];if(!_0x3cd507[_0xcb0e('0x2a')][_0xcb0e('0x2e')](_0xcb0e('0x2f'))){_0x471ec7[_0xcb0e('0x18')]=qs[_0xcb0e('0x18')](_0x3cd507[_0xcb0e('0x2a')][_0xcb0e('0x18')]);_0x471ec7[_0xcb0e('0x17')]=qs[_0xcb0e('0x17')](_0x3cd507['query'][_0xcb0e('0x17')]);}return _0x448a17['getDescriptions'](_0x471ec7);}})[_0xcb0e('0x1e')](function(_0x5ca48d){if(_0x5ca48d){return _0x5ca48d?{'count':_0x55374a,'rows':_0x5ca48d}:null;}})[_0xcb0e('0x1e')](respondWithResult(_0x34053c,null))[_0xcb0e('0x3b')](handleError(_0x34053c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ff01581..e8edd91 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 _0x2be0=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2be0,0x128));var _0x02be=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2be0[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var logger=require(_0x02be('0x2'))(_0x02be('0x3'));var moment=require(_0x02be('0x4'));var BPromise=require('bluebird');var rp=require(_0x02be('0x5'));var fs=require('fs');var path=require(_0x02be('0x6'));var rimraf=require(_0x02be('0x7'));var config=require('../../config/environment');var attributes=require(_0x02be('0x8'));module[_0x02be('0x9')]=function(_0x46392d,_0x184bf6){return _0x46392d['define'](_0x02be('0xa'),attributes,{'tableName':_0x02be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x720e=['bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x82a5b3,_0x1a5a40){var _0x4ed6eb=function(_0x2f89d2){while(--_0x2f89d2){_0x82a5b3['push'](_0x82a5b3['shift']());}};_0x4ed6eb(++_0x1a5a40);}(_0x720e,0x1cb));var _0xe720=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x720e[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var logger=require(_0xe720('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe720('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe720('0x4'));var rimraf=require(_0xe720('0x5'));var config=require(_0xe720('0x6'));var attributes=require(_0xe720('0x7'));module[_0xe720('0x8')]=function(_0x43463b,_0x3952f0){return _0x43463b['define'](_0xe720('0x9'),attributes,{'tableName':_0xe720('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 87962a8..f1410a5 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 _0x33ac=['jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x37ba84,_0x449c8c){var _0x43dc4f=function(_0x2eee47){while(--_0x2eee47){_0x37ba84['push'](_0x37ba84['shift']());}};_0x43dc4f(++_0x449c8c);}(_0x33ac,0x1f2));var _0xc33a=function(_0x32c557,_0x4b54b1){_0x32c557=_0x32c557-0x0;var _0x50b686=_0x33ac[_0x32c557];return _0x50b686;};'use strict';var _=require('lodash');var util=require(_0xc33a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33a('0x1'));var fs=require('fs');var Redis=require(_0xc33a('0x2'));var db=require(_0xc33a('0x3'))['db'];var utils=require(_0xc33a('0x4'));var logger=require(_0xc33a('0x5'))(_0xc33a('0x6'));var config=require(_0xc33a('0x7'));var jayson=require(_0xc33a('0x8'));var client=jayson[_0xc33a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa2fc,_0xceaf87,_0xf2e092){return new BPromise(function(_0x5bdf4a,_0x40c40d){return client['request'](_0x5aa2fc,_0xf2e092)[_0xc33a('0xa')](function(_0x2dc672){logger[_0xc33a('0xb')](_0xc33a('0xc'),_0xceaf87,_0xc33a('0xd'));logger[_0xc33a('0xe')](_0xc33a('0xf'),_0xceaf87,_0xc33a('0xd'),JSON[_0xc33a('0x10')](_0x2dc672));if(_0x2dc672['error']){if(_0x2dc672['error'][_0xc33a('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xceaf87,_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);return _0x40c40d(_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);}logger[_0xc33a('0x12')](_0xc33a('0xc'),_0xceaf87,_0x2dc672['error'][_0xc33a('0x13')]);return _0x5bdf4a(_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);}else{logger['info'](_0xc33a('0xc'),_0xceaf87,'request\x20sent');_0x5bdf4a(_0x2dc672[_0xc33a('0x14')][_0xc33a('0x13')]);}})[_0xc33a('0x15')](function(_0xbedbf3){logger[_0xc33a('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0xceaf87,_0xbedbf3);_0x40c40d(_0xbedbf3);});});} \ No newline at end of file +var _0xc8ba=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3b1413,_0x308e98){var _0x2cafbc=function(_0xa3aee2){while(--_0xa3aee2){_0x3b1413['push'](_0x3b1413['shift']());}};_0x2cafbc(++_0x308e98);}(_0xc8ba,0x186));var _0xac8b=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xc8ba[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0xac8b('0x0'));var util=require(_0xac8b('0x1'));var moment=require(_0xac8b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac8b('0x3'));var db=require(_0xac8b('0x4'))['db'];var utils=require(_0xac8b('0x5'));var logger=require(_0xac8b('0x6'))('rpc');var config=require(_0xac8b('0x7'));var jayson=require(_0xac8b('0x8'));var client=jayson['client'][_0xac8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5375a2,_0x689678,_0x26d3d7){return new BPromise(function(_0xe63b93,_0x58c7fe){return client[_0xac8b('0xa')](_0x5375a2,_0x26d3d7)[_0xac8b('0xb')](function(_0x17c430){logger[_0xac8b('0xc')](_0xac8b('0xd'),_0x689678,_0xac8b('0xe'));logger[_0xac8b('0xf')](_0xac8b('0x10'),_0x689678,_0xac8b('0xe'),JSON[_0xac8b('0x11')](_0x17c430));if(_0x17c430[_0xac8b('0x12')]){if(_0x17c430[_0xac8b('0x12')]['code']===0x1f4){logger[_0xac8b('0x12')](_0xac8b('0xd'),_0x689678,_0x17c430[_0xac8b('0x12')][_0xac8b('0x13')]);return _0x58c7fe(_0x17c430[_0xac8b('0x12')]['message']);}logger[_0xac8b('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x689678,_0x17c430['error'][_0xac8b('0x13')]);return _0xe63b93(_0x17c430[_0xac8b('0x12')]['message']);}else{logger[_0xac8b('0xc')](_0xac8b('0xd'),_0x689678,_0xac8b('0xe'));_0xe63b93(_0x17c430[_0xac8b('0x14')][_0xac8b('0x13')]);}})[_0xac8b('0x15')](function(_0x58b260){logger['error'](_0xac8b('0xd'),_0x689678,_0x58b260);_0x58c7fe(_0x58b260);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4d62f5d..31eb2d9 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 _0x6a0d=['post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','/:id','isAuthenticated'];(function(_0x17b980,_0x3f8599){var _0x2e1f08=function(_0x2f6bde){while(--_0x2f6bde){_0x17b980['push'](_0x17b980['shift']());}};_0x2e1f08(++_0x3f8599);}(_0x6a0d,0x149));var _0xd6a0=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6a0d[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xd6a0('0x0'));var util=require(_0xd6a0('0x1'));var path=require('path');var timeout=require(_0xd6a0('0x2'));var express=require(_0xd6a0('0x3'));var router=express[_0xd6a0('0x4')]();var fs_extra=require(_0xd6a0('0x5'));var auth=require(_0xd6a0('0x6'));var interaction=require(_0xd6a0('0x7'));var config=require(_0xd6a0('0x8'));var controller=require(_0xd6a0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd6a0('0xa')]);router['get'](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller['show']);router[_0xd6a0('0xd')]('/',auth[_0xd6a0('0xc')](),controller['create']);router[_0xd6a0('0xe')](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller[_0xd6a0('0xf')]);router['delete'](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller[_0xd6a0('0x10')]);module[_0xd6a0('0x11')]=router; \ No newline at end of file +var _0xad51=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x81c26e,_0x3a9ddd){var _0x19b119=function(_0x3cb95d){while(--_0x3cb95d){_0x81c26e['push'](_0x81c26e['shift']());}};_0x19b119(++_0x3a9ddd);}(_0xad51,0x87));var _0x1ad5=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xad51[_0x34bd34];return _0x4e36d6;};'use strict';var multer=require('multer');var util=require(_0x1ad5('0x0'));var path=require(_0x1ad5('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ad5('0x2'));var router=express[_0x1ad5('0x3')]();var fs_extra=require(_0x1ad5('0x4'));var auth=require(_0x1ad5('0x5'));var interaction=require(_0x1ad5('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x1ad5('0x7')]('/',auth[_0x1ad5('0x8')](),controller[_0x1ad5('0x9')]);router[_0x1ad5('0x7')]('/:id',auth[_0x1ad5('0x8')](),controller[_0x1ad5('0xa')]);router[_0x1ad5('0xb')]('/',auth[_0x1ad5('0x8')](),controller[_0x1ad5('0xc')]);router[_0x1ad5('0xd')](_0x1ad5('0xe'),auth[_0x1ad5('0x8')](),controller[_0x1ad5('0xf')]);router[_0x1ad5('0x10')]('/:id',auth[_0x1ad5('0x8')](),controller[_0x1ad5('0x11')]);module[_0x1ad5('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 4476f32..77e9a38 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 _0x5016=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2cdf10,_0x619ba9){var _0x13730b=function(_0x43841f){while(--_0x43841f){_0x2cdf10['push'](_0x2cdf10['shift']());}};_0x13730b(++_0x619ba9);}(_0x5016,0x82));var _0x6501=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x5016[_0x11e05d];return _0x335588;};'use strict';var Sequelize=require(_0x6501('0x0'));module[_0x6501('0x1')]={'type':{'type':Sequelize[_0x6501('0x2')](_0x6501('0x3'),_0x6501('0x4'),_0x6501('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6501('0x6')]},'key':{'type':Sequelize[_0x6501('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6501('0x4'),_0x6501('0x5'))},'keyContent':{'type':Sequelize[_0x6501('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6501('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6501('0x6')]}}; \ No newline at end of file +var _0xa8ef=['string','customVariable','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x2d1d72,_0x23ef7b){var _0x5ede8e=function(_0x1c3330){while(--_0x1c3330){_0x2d1d72['push'](_0x2d1d72['shift']());}};_0x5ede8e(++_0x23ef7b);}(_0xa8ef,0x91));var _0xfa8e=function(_0xbaab45,_0x40f6e8){_0xbaab45=_0xbaab45-0x0;var _0x6ea753=_0xa8ef[_0xbaab45];return _0x6ea753;};'use strict';var Sequelize=require(_0xfa8e('0x0'));module[_0xfa8e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfa8e('0x2'),'variable',_0xfa8e('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfa8e('0x4')]},'key':{'type':Sequelize[_0xfa8e('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xfa8e('0x2'),_0xfa8e('0x5'),_0xfa8e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfa8e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa8e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 626c4e9..a61a592 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 _0xd10c=['json','offset','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2d1c6d,_0x27c29b){var _0x208a5a=function(_0x34312f){while(--_0x34312f){_0x2d1c6d['push'](_0x2d1c6d['shift']());}};_0x208a5a(++_0x27c29b);}(_0xd10c,0xbb));var _0xcd10=function(_0x283f2e,_0x2af6da){_0x283f2e=_0x283f2e-0x0;var _0x1cffb6=_0xd10c[_0x283f2e];return _0x1cffb6;};'use strict';var emlformat=require(_0xcd10('0x0'));var rimraf=require(_0xcd10('0x1'));var zipdir=require(_0xcd10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd10('0x3'));var moment=require(_0xcd10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd10('0x5'));var util=require('util');var path=require(_0xcd10('0x6'));var sox=require(_0xcd10('0x7'));var csv=require(_0xcd10('0x8'));var ejs=require(_0xcd10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcd10('0xa'));var crypto=require(_0xcd10('0xb'));var jsforce=require(_0xcd10('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd10('0x8'));var querystring=require(_0xcd10('0xd'));var Papa=require(_0xcd10('0xe'));var Redis=require(_0xcd10('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd10('0x10'));var hardwareService=require(_0xcd10('0x11'));var logger=require('../../config/logger')(_0xcd10('0x12'));var utils=require(_0xcd10('0x13'));var config=require(_0xcd10('0x14'));var licenseUtil=require(_0xcd10('0x15'));var db=require(_0xcd10('0x16'))['db'];function respondWithStatusCode(_0x525722,_0xf45675){_0xf45675=_0xf45675||0xcc;return function(_0x5e0e95){if(_0x5e0e95){return _0x525722[_0xcd10('0x17')](_0xf45675);}return _0x525722[_0xcd10('0x18')](_0xf45675)[_0xcd10('0x19')]();};}function respondWithResult(_0x190cbe,_0x21a7ad){_0x21a7ad=_0x21a7ad||0xc8;return function(_0x51e51f){if(_0x51e51f){return _0x190cbe[_0xcd10('0x18')](_0x21a7ad)[_0xcd10('0x1a')](_0x51e51f);}};}function respondWithFilteredResult(_0x2af3eb,_0x40f22a){return function(_0x5b2a4b){if(_0x5b2a4b){var _0x26615f=typeof _0x40f22a[_0xcd10('0x1b')]===_0xcd10('0x1c')&&typeof _0x40f22a['limit']==='undefined';var _0x49f695=_0x5b2a4b[_0xcd10('0x1d')];var _0xaa07a1=_0x26615f?0x0:_0x40f22a[_0xcd10('0x1b')];var _0x48d260=_0x26615f?_0x5b2a4b[_0xcd10('0x1d')]:_0x40f22a[_0xcd10('0x1b')]+_0x40f22a['limit'];var _0x111db0;if(_0x48d260>=_0x49f695){_0x48d260=_0x49f695;_0x111db0=0xc8;}else{_0x111db0=0xce;}_0x2af3eb[_0xcd10('0x18')](_0x111db0);return _0x2af3eb['set']('Content-Range',_0xaa07a1+'-'+_0x48d260+'/'+_0x49f695)[_0xcd10('0x1a')](_0x5b2a4b);}return null;};}function patchUpdates(_0x1b4232){return function(_0xc26bc9){try{jsonpatch[_0xcd10('0x1e')](_0xc26bc9,_0x1b4232,!![]);}catch(_0x53fa83){return BPromise[_0xcd10('0x1f')](_0x53fa83);}return _0xc26bc9[_0xcd10('0x20')]();};}function saveUpdates(_0x3d9011,_0x1d00a6){return function(_0x5b6830){if(_0x5b6830){return _0x5b6830[_0xcd10('0x21')](_0x3d9011)[_0xcd10('0x22')](function(_0x21a2b6){return _0x21a2b6;});}return null;};}function removeEntity(_0xd05e68,_0x340adc){return function(_0x1b5777){if(_0x1b5777){return _0x1b5777[_0xcd10('0x23')]()[_0xcd10('0x22')](function(){_0xd05e68['status'](0xcc)[_0xcd10('0x19')]();});}};}function handleEntityNotFound(_0x1d64e2,_0xe150a9){return function(_0x2183f0){if(!_0x2183f0){_0x1d64e2['sendStatus'](0x194);}return _0x2183f0;};}function handleError(_0x42fbeb,_0x1258fc){_0x1258fc=_0x1258fc||0x1f4;return function(_0x1acc0a){logger[_0xcd10('0x24')](_0x1acc0a[_0xcd10('0x25')]);if(_0x1acc0a[_0xcd10('0x26')]){delete _0x1acc0a['name'];}_0x42fbeb[_0xcd10('0x18')](_0x1258fc)[_0xcd10('0x27')](_0x1acc0a);};}exports[_0xcd10('0x28')]=function(_0x31bbba,_0x46bda7){var _0x1d6090={},_0x9c9053={},_0x368204={'count':0x0,'rows':[]};var _0x2b522d=_['map'](db['ServicenowField'][_0xcd10('0x29')],function(_0x29dc74){return{'name':_0x29dc74[_0xcd10('0x2a')],'type':_0x29dc74[_0xcd10('0x2b')][_0xcd10('0x2c')]};});_0x9c9053[_0xcd10('0x2d')]=_[_0xcd10('0x2e')](_0x2b522d,_0xcd10('0x26'));_0x9c9053[_0xcd10('0x2f')]=_[_0xcd10('0x30')](_0x31bbba['query']);_0x9c9053[_0xcd10('0x31')]=_[_0xcd10('0x32')](_0x9c9053[_0xcd10('0x2d')],_0x9c9053[_0xcd10('0x2f')]);_0x1d6090[_0xcd10('0x33')]=_[_0xcd10('0x32')](_0x9c9053[_0xcd10('0x2d')],qs[_0xcd10('0x34')](_0x31bbba['query'][_0xcd10('0x34')]));_0x1d6090['attributes']=_0x1d6090[_0xcd10('0x33')][_0xcd10('0x35')]?_0x1d6090[_0xcd10('0x33')]:_0x9c9053[_0xcd10('0x2d')];if(!_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x36')]('nolimit')){_0x1d6090[_0xcd10('0x37')]=qs[_0xcd10('0x37')](_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x37')]);_0x1d6090[_0xcd10('0x1b')]=qs[_0xcd10('0x1b')](_0x31bbba[_0xcd10('0x2f')]['offset']);}_0x1d6090['order']=qs[_0xcd10('0x38')](_0x31bbba['query'][_0xcd10('0x38')]);_0x1d6090[_0xcd10('0x39')]=qs['filters'](_['pick'](_0x31bbba['query'],_0x9c9053[_0xcd10('0x31')]),_0x2b522d);if(_0x31bbba['query'][_0xcd10('0x3a')]){_0x1d6090[_0xcd10('0x39')]=_[_0xcd10('0x3b')](_0x1d6090[_0xcd10('0x39')],{'$or':_['map'](_0x2b522d,function(_0x43519d){if(_0x43519d[_0xcd10('0x2b')]!==_0xcd10('0x3c')){var _0x100c92={};_0x100c92[_0x43519d[_0xcd10('0x26')]]={'$like':'%'+_0x31bbba['query'][_0xcd10('0x3a')]+'%'};return _0x100c92;}})});}_0x1d6090=_[_0xcd10('0x3b')]({},_0x1d6090,_0x31bbba[_0xcd10('0x3d')]);var _0x6fe6fa={'where':_0x1d6090[_0xcd10('0x39')]};return db['ServicenowField'][_0xcd10('0x1d')](_0x6fe6fa)[_0xcd10('0x22')](function(_0x3ae8b1){_0x368204[_0xcd10('0x1d')]=_0x3ae8b1;if(_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x3e')]){_0x1d6090[_0xcd10('0x3f')]=[{'all':!![]}];}return db[_0xcd10('0x40')]['findAll'](_0x1d6090);})[_0xcd10('0x22')](function(_0x85c3c4){_0x368204['rows']=_0x85c3c4;return _0x368204;})[_0xcd10('0x22')](respondWithFilteredResult(_0x46bda7,_0x1d6090))[_0xcd10('0x41')](handleError(_0x46bda7,null));};exports[_0xcd10('0x42')]=function(_0x50f30a,_0x4bab9d){var _0x7201e6={'raw':!![],'where':{'id':_0x50f30a[_0xcd10('0x43')]['id']}},_0x418d7d={};_0x418d7d[_0xcd10('0x2d')]=_['keys'](db['ServicenowField'][_0xcd10('0x29')]);_0x418d7d[_0xcd10('0x2f')]=_['keys'](_0x50f30a[_0xcd10('0x2f')]);_0x418d7d[_0xcd10('0x31')]=_[_0xcd10('0x32')](_0x418d7d[_0xcd10('0x2d')],_0x418d7d[_0xcd10('0x2f')]);_0x7201e6[_0xcd10('0x33')]=_['intersection'](_0x418d7d[_0xcd10('0x2d')],qs[_0xcd10('0x34')](_0x50f30a['query']['fields']));_0x7201e6[_0xcd10('0x33')]=_0x7201e6[_0xcd10('0x33')][_0xcd10('0x35')]?_0x7201e6[_0xcd10('0x33')]:_0x418d7d[_0xcd10('0x2d')];if(_0x50f30a['query']['includeAll']){_0x7201e6[_0xcd10('0x3f')]=[{'all':!![]}];}_0x7201e6=_[_0xcd10('0x3b')]({},_0x7201e6,_0x50f30a[_0xcd10('0x3d')]);return db[_0xcd10('0x40')][_0xcd10('0x44')](_0x7201e6)[_0xcd10('0x22')](handleEntityNotFound(_0x4bab9d,null))[_0xcd10('0x22')](respondWithResult(_0x4bab9d,null))[_0xcd10('0x41')](handleError(_0x4bab9d,null));};exports[_0xcd10('0x45')]=function(_0x32ecb8,_0x114c67){return db[_0xcd10('0x40')][_0xcd10('0x45')](_0x32ecb8['body'],{})['then'](respondWithResult(_0x114c67,0xc9))[_0xcd10('0x41')](handleError(_0x114c67,null));};exports['update']=function(_0x2e2816,_0x4f5cc2){if(_0x2e2816[_0xcd10('0x46')]['id']){delete _0x2e2816[_0xcd10('0x46')]['id'];}return db[_0xcd10('0x40')]['find']({'where':{'id':_0x2e2816[_0xcd10('0x43')]['id']}})[_0xcd10('0x22')](handleEntityNotFound(_0x4f5cc2,null))[_0xcd10('0x22')](saveUpdates(_0x2e2816['body'],null))[_0xcd10('0x22')](respondWithResult(_0x4f5cc2,null))[_0xcd10('0x41')](handleError(_0x4f5cc2,null));};exports[_0xcd10('0x23')]=function(_0x2a6c4a,_0x2c6d3a){return db[_0xcd10('0x40')]['find']({'where':{'id':_0x2a6c4a[_0xcd10('0x43')]['id']}})[_0xcd10('0x22')](handleEntityNotFound(_0x2c6d3a,null))[_0xcd10('0x22')](removeEntity(_0x2c6d3a,null))[_0xcd10('0x41')](handleError(_0x2c6d3a,null));}; \ No newline at end of file +var _0x2bfc=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x17479d,_0x593129){var _0x2d461c=function(_0x347164){while(--_0x347164){_0x17479d['push'](_0x17479d['shift']());}};_0x2d461c(++_0x593129);}(_0x2bfc,0xd1));var _0xc2bf=function(_0x4735fe,_0x227ea4){_0x4735fe=_0x4735fe-0x0;var _0x1c4be4=_0x2bfc[_0x4735fe];return _0x1c4be4;};'use strict';var emlformat=require(_0xc2bf('0x0'));var rimraf=require(_0xc2bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2bf('0x2'));var rp=require(_0xc2bf('0x3'));var moment=require(_0xc2bf('0x4'));var BPromise=require(_0xc2bf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc2bf('0x6'));var sox=require(_0xc2bf('0x7'));var csv=require(_0xc2bf('0x8'));var ejs=require(_0xc2bf('0x9'));var fs=require('fs');var fs_extra=require(_0xc2bf('0xa'));var _=require(_0xc2bf('0xb'));var squel=require(_0xc2bf('0xc'));var crypto=require(_0xc2bf('0xd'));var jsforce=require(_0xc2bf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc2bf('0x8'));var querystring=require('querystring');var Papa=require(_0xc2bf('0xf'));var Redis=require(_0xc2bf('0x10'));var authService=require(_0xc2bf('0x11'));var qs=require(_0xc2bf('0x12'));var as=require(_0xc2bf('0x13'));var hardwareService=require(_0xc2bf('0x14'));var logger=require(_0xc2bf('0x15'))(_0xc2bf('0x16'));var utils=require('../../config/utils');var config=require(_0xc2bf('0x17'));var licenseUtil=require(_0xc2bf('0x18'));var db=require(_0xc2bf('0x19'))['db'];function respondWithStatusCode(_0x5ef8ba,_0x6d6f27){_0x6d6f27=_0x6d6f27||0xcc;return function(_0x37ce5e){if(_0x37ce5e){return _0x5ef8ba[_0xc2bf('0x1a')](_0x6d6f27);}return _0x5ef8ba[_0xc2bf('0x1b')](_0x6d6f27)[_0xc2bf('0x1c')]();};}function respondWithResult(_0x349f4b,_0x59b19d){_0x59b19d=_0x59b19d||0xc8;return function(_0x305166){if(_0x305166){return _0x349f4b[_0xc2bf('0x1b')](_0x59b19d)[_0xc2bf('0x1d')](_0x305166);}};}function respondWithFilteredResult(_0x3cc4a7,_0x36b0a8){return function(_0x1142f3){if(_0x1142f3){var _0x4c7e5f=typeof _0x36b0a8[_0xc2bf('0x1e')]===_0xc2bf('0x1f')&&typeof _0x36b0a8[_0xc2bf('0x20')]===_0xc2bf('0x1f');var _0x52dcf0=_0x1142f3['count'];var _0x5dbd4a=_0x4c7e5f?0x0:_0x36b0a8[_0xc2bf('0x1e')];var _0x552325=_0x4c7e5f?_0x1142f3[_0xc2bf('0x21')]:_0x36b0a8[_0xc2bf('0x1e')]+_0x36b0a8[_0xc2bf('0x20')];var _0x4b6f33;if(_0x552325>=_0x52dcf0){_0x552325=_0x52dcf0;_0x4b6f33=0xc8;}else{_0x4b6f33=0xce;}_0x3cc4a7['status'](_0x4b6f33);return _0x3cc4a7[_0xc2bf('0x22')](_0xc2bf('0x23'),_0x5dbd4a+'-'+_0x552325+'/'+_0x52dcf0)[_0xc2bf('0x1d')](_0x1142f3);}return null;};}function patchUpdates(_0x3a3a5f){return function(_0x4279e0){try{jsonpatch[_0xc2bf('0x24')](_0x4279e0,_0x3a3a5f,!![]);}catch(_0x578980){return BPromise[_0xc2bf('0x25')](_0x578980);}return _0x4279e0[_0xc2bf('0x26')]();};}function saveUpdates(_0x543e6c,_0xae748e){return function(_0x1227d1){if(_0x1227d1){return _0x1227d1[_0xc2bf('0x27')](_0x543e6c)[_0xc2bf('0x28')](function(_0x49579e){return _0x49579e;});}return null;};}function removeEntity(_0xf38824,_0x22f12d){return function(_0x471a45){if(_0x471a45){return _0x471a45[_0xc2bf('0x29')]()[_0xc2bf('0x28')](function(){_0xf38824[_0xc2bf('0x1b')](0xcc)[_0xc2bf('0x1c')]();});}};}function handleEntityNotFound(_0x183d71,_0x1f5746){return function(_0x4d7461){if(!_0x4d7461){_0x183d71[_0xc2bf('0x1a')](0x194);}return _0x4d7461;};}function handleError(_0x375230,_0x287a0b){_0x287a0b=_0x287a0b||0x1f4;return function(_0x500b2d){logger[_0xc2bf('0x2a')](_0x500b2d['stack']);if(_0x500b2d[_0xc2bf('0x2b')]){delete _0x500b2d[_0xc2bf('0x2b')];}_0x375230['status'](_0x287a0b)[_0xc2bf('0x2c')](_0x500b2d);};}exports[_0xc2bf('0x2d')]=function(_0x1b4ec8,_0x4af6d1){var _0x2401a9={},_0x3c95c1={},_0x385764={'count':0x0,'rows':[]};var _0x1e28d2=_[_0xc2bf('0x2e')](db[_0xc2bf('0x2f')]['rawAttributes'],function(_0x233d61){return{'name':_0x233d61[_0xc2bf('0x30')],'type':_0x233d61['type'][_0xc2bf('0x31')]};});_0x3c95c1['model']=_[_0xc2bf('0x2e')](_0x1e28d2,'name');_0x3c95c1[_0xc2bf('0x32')]=_[_0xc2bf('0x33')](_0x1b4ec8[_0xc2bf('0x32')]);_0x3c95c1[_0xc2bf('0x34')]=_[_0xc2bf('0x35')](_0x3c95c1[_0xc2bf('0x36')],_0x3c95c1[_0xc2bf('0x32')]);_0x2401a9['attributes']=_[_0xc2bf('0x35')](_0x3c95c1[_0xc2bf('0x36')],qs[_0xc2bf('0x37')](_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x37')]));_0x2401a9[_0xc2bf('0x38')]=_0x2401a9['attributes'][_0xc2bf('0x39')]?_0x2401a9[_0xc2bf('0x38')]:_0x3c95c1[_0xc2bf('0x36')];if(!_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x3a')](_0xc2bf('0x3b'))){_0x2401a9[_0xc2bf('0x20')]=qs[_0xc2bf('0x20')](_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x20')]);_0x2401a9[_0xc2bf('0x1e')]=qs['offset'](_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x1e')]);}_0x2401a9[_0xc2bf('0x3c')]=qs[_0xc2bf('0x3d')](_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x3d')]);_0x2401a9[_0xc2bf('0x3e')]=qs['filters'](_[_0xc2bf('0x3f')](_0x1b4ec8['query'],_0x3c95c1[_0xc2bf('0x34')]),_0x1e28d2);if(_0x1b4ec8[_0xc2bf('0x32')][_0xc2bf('0x40')]){_0x2401a9[_0xc2bf('0x3e')]=_[_0xc2bf('0x41')](_0x2401a9[_0xc2bf('0x3e')],{'$or':_[_0xc2bf('0x2e')](_0x1e28d2,function(_0x10f9ba){if(_0x10f9ba['type']!==_0xc2bf('0x42')){var _0x1ed68e={};_0x1ed68e[_0x10f9ba[_0xc2bf('0x2b')]]={'$like':'%'+_0x1b4ec8[_0xc2bf('0x32')]['filter']+'%'};return _0x1ed68e;}})});}_0x2401a9=_['merge']({},_0x2401a9,_0x1b4ec8[_0xc2bf('0x43')]);var _0x58764f={'where':_0x2401a9['where']};return db[_0xc2bf('0x2f')][_0xc2bf('0x21')](_0x58764f)[_0xc2bf('0x28')](function(_0x5ac1e4){_0x385764[_0xc2bf('0x21')]=_0x5ac1e4;if(_0x1b4ec8[_0xc2bf('0x32')]['includeAll']){_0x2401a9[_0xc2bf('0x44')]=[{'all':!![]}];}return db['ServicenowField'][_0xc2bf('0x45')](_0x2401a9);})['then'](function(_0x357e30){_0x385764[_0xc2bf('0x46')]=_0x357e30;return _0x385764;})[_0xc2bf('0x28')](respondWithFilteredResult(_0x4af6d1,_0x2401a9))['catch'](handleError(_0x4af6d1,null));};exports[_0xc2bf('0x47')]=function(_0x1d3f86,_0x3a3172){var _0x359aea={'raw':!![],'where':{'id':_0x1d3f86[_0xc2bf('0x48')]['id']}},_0xfa59a3={};_0xfa59a3[_0xc2bf('0x36')]=_[_0xc2bf('0x33')](db[_0xc2bf('0x2f')][_0xc2bf('0x49')]);_0xfa59a3[_0xc2bf('0x32')]=_[_0xc2bf('0x33')](_0x1d3f86[_0xc2bf('0x32')]);_0xfa59a3[_0xc2bf('0x34')]=_['intersection'](_0xfa59a3[_0xc2bf('0x36')],_0xfa59a3[_0xc2bf('0x32')]);_0x359aea[_0xc2bf('0x38')]=_[_0xc2bf('0x35')](_0xfa59a3[_0xc2bf('0x36')],qs['fields'](_0x1d3f86[_0xc2bf('0x32')][_0xc2bf('0x37')]));_0x359aea[_0xc2bf('0x38')]=_0x359aea[_0xc2bf('0x38')]['length']?_0x359aea[_0xc2bf('0x38')]:_0xfa59a3[_0xc2bf('0x36')];if(_0x1d3f86['query'][_0xc2bf('0x4a')]){_0x359aea[_0xc2bf('0x44')]=[{'all':!![]}];}_0x359aea=_[_0xc2bf('0x41')]({},_0x359aea,_0x1d3f86[_0xc2bf('0x43')]);return db[_0xc2bf('0x2f')]['find'](_0x359aea)[_0xc2bf('0x28')](handleEntityNotFound(_0x3a3172,null))[_0xc2bf('0x28')](respondWithResult(_0x3a3172,null))[_0xc2bf('0x4b')](handleError(_0x3a3172,null));};exports[_0xc2bf('0x4c')]=function(_0x167620,_0x260ab7){return db[_0xc2bf('0x2f')][_0xc2bf('0x4c')](_0x167620[_0xc2bf('0x4d')],{})[_0xc2bf('0x28')](respondWithResult(_0x260ab7,0xc9))[_0xc2bf('0x4b')](handleError(_0x260ab7,null));};exports[_0xc2bf('0x27')]=function(_0x275cbb,_0x433cd1){if(_0x275cbb[_0xc2bf('0x4d')]['id']){delete _0x275cbb['body']['id'];}return db[_0xc2bf('0x2f')][_0xc2bf('0x4e')]({'where':{'id':_0x275cbb['params']['id']}})[_0xc2bf('0x28')](handleEntityNotFound(_0x433cd1,null))[_0xc2bf('0x28')](saveUpdates(_0x275cbb[_0xc2bf('0x4d')],null))[_0xc2bf('0x28')](respondWithResult(_0x433cd1,null))[_0xc2bf('0x4b')](handleError(_0x433cd1,null));};exports['destroy']=function(_0x1cd79b,_0x3b86a6){return db[_0xc2bf('0x2f')][_0xc2bf('0x4e')]({'where':{'id':_0x1cd79b[_0xc2bf('0x48')]['id']}})[_0xc2bf('0x28')](handleEntityNotFound(_0x3b86a6,null))['then'](removeEntity(_0x3b86a6,null))['catch'](handleError(_0x3b86a6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b48da56..68b348a 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 _0xc64b=['moment','bluebird','request-promise','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x538d43,_0x25d8b7){var _0x3bd30d=function(_0x147b70){while(--_0x147b70){_0x538d43['push'](_0x538d43['shift']());}};_0x3bd30d(++_0x25d8b7);}(_0xc64b,0x7e));var _0xbc64=function(_0x1475dc,_0x9fb023){_0x1475dc=_0x1475dc-0x0;var _0x19c5a9=_0xc64b[_0x1475dc];return _0x19c5a9;};'use strict';var _=require(_0xbc64('0x0'));var util=require(_0xbc64('0x1'));var logger=require(_0xbc64('0x2'))(_0xbc64('0x3'));var moment=require(_0xbc64('0x4'));var BPromise=require(_0xbc64('0x5'));var rp=require(_0xbc64('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc64('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2cd192,_0xb9494d){return _0x2cd192[_0xbc64('0x8')]('ServicenowField',attributes,{'tableName':_0xbc64('0x9'),'paranoid':![],'indexes':[{'name':_0xbc64('0xa'),'fields':[_0xbc64('0xb'),_0xbc64('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43d6=['api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x157d0f,_0x5ac489){var _0x5e300c=function(_0x586ed9){while(--_0x586ed9){_0x157d0f['push'](_0x157d0f['shift']());}};_0x5e300c(++_0x5ac489);}(_0x43d6,0xfc));var _0x643d=function(_0x291858,_0x2dc41a){_0x291858=_0x291858-0x0;var _0x519f1c=_0x43d6[_0x291858];return _0x519f1c;};'use strict';var _=require(_0x643d('0x0'));var util=require(_0x643d('0x1'));var logger=require(_0x643d('0x2'))(_0x643d('0x3'));var moment=require(_0x643d('0x4'));var BPromise=require(_0x643d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x643d('0x6'));var rimraf=require(_0x643d('0x7'));var config=require(_0x643d('0x8'));var attributes=require(_0x643d('0x9'));module[_0x643d('0xa')]=function(_0xa73884,_0x55fc76){return _0xa73884[_0x643d('0xb')](_0x643d('0xc'),attributes,{'tableName':_0x643d('0xd'),'paranoid':![],'indexes':[{'name':_0x643d('0xe'),'fields':[_0x643d('0xf'),_0x643d('0x10')],'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 aa22757..96dca7e 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x342108,_0x26eb56){var _0x3c8ad1=function(_0x8fbac1){while(--_0x8fbac1){_0x342108['push'](_0x342108['shift']());}};_0x3c8ad1(++_0x26eb56);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c625f,_0x1357a8){_0x1c625f=_0x1c625f-0x0;var _0x5f4516=_0xb43b[_0x1c625f];return _0x5f4516;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5f5b2f,_0x1863c4){var _0x16c260=function(_0x53b1b9){while(--_0x53b1b9){_0x5f5b2f['push'](_0x5f5b2f['shift']());}};_0x16c260(++_0x1863c4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5d3e15,_0xe6935a){_0x5d3e15=_0x5d3e15-0x0;var _0x15634c=_0xf4eb[_0x5d3e15];return _0x15634c;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6d5cb1a..4457d0b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5dfaf0,_0x1343f8){var _0x882be6=function(_0x53f538){while(--_0x53f538){_0x5dfaf0['push'](_0x5dfaf0['shift']());}};_0x882be6(++_0x1343f8);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4e56ce,_0x4383a9){var _0x37e99e=function(_0x322a1b){while(--_0x322a1b){_0x4e56ce['push'](_0x4e56ce['shift']());}};_0x37e99e(++_0x4383a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3eb3790..cdd524f 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(_0x5617b6,_0x90f6f8){var _0x28ebc2=function(_0x522b09){while(--_0x522b09){_0x5617b6['push'](_0x5617b6['shift']());}};_0x28ebc2(++_0x90f6f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x37ea7f,_0x41fdfd){var _0x217ca0=function(_0x2e21e2){while(--_0x2e21e2){_0x37ea7f['push'](_0x37ea7f['shift']());}};_0x217ca0(++_0x41fdfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 25bcb1d..eb20b42 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 _0x4bd0=['fieldName','key','keys','intersection','query','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','length','include','find','create','body','getConfigurations','order','options','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','POST','stringify','values','module_fields','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes'];(function(_0x24e64a,_0x22af59){var _0x3827d2=function(_0x50f599){while(--_0x50f599){_0x24e64a['push'](_0x24e64a['shift']());}};_0x3827d2(++_0x22af59);}(_0x4bd0,0x12a));var _0x04bd=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x4bd0[_0x54bb5e];return _0x2cfe75;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require(_0x04bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x04bd('0x3'));var Mustache=require(_0x04bd('0x4'));var util=require(_0x04bd('0x5'));var path=require(_0x04bd('0x6'));var sox=require(_0x04bd('0x7'));var csv=require(_0x04bd('0x8'));var ejs=require(_0x04bd('0x9'));var fs=require('fs');var fs_extra=require(_0x04bd('0xa'));var _=require(_0x04bd('0xb'));var squel=require(_0x04bd('0xc'));var crypto=require(_0x04bd('0xd'));var jsforce=require(_0x04bd('0xe'));var deskjs=require(_0x04bd('0xf'));var toCsv=require(_0x04bd('0x8'));var querystring=require('querystring');var Papa=require(_0x04bd('0x10'));var Redis=require(_0x04bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04bd('0x12'));var as=require(_0x04bd('0x13'));var hardwareService=require(_0x04bd('0x14'));var logger=require('../../config/logger')(_0x04bd('0x15'));var utils=require(_0x04bd('0x16'));var config=require(_0x04bd('0x17'));var licenseUtil=require(_0x04bd('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x04bd('0x19'));function respondWithStatusCode(_0x29b6f1,_0x1f7700){_0x1f7700=_0x1f7700||0xcc;return function(_0x1dae4d){if(_0x1dae4d){return _0x29b6f1[_0x04bd('0x1a')](_0x1f7700);}return _0x29b6f1['status'](_0x1f7700)[_0x04bd('0x1b')]();};}function respondWithResult(_0x5e84b6,_0x3b71cf){_0x3b71cf=_0x3b71cf||0xc8;return function(_0x383fe9){if(_0x383fe9){return _0x5e84b6[_0x04bd('0x1c')](_0x3b71cf)[_0x04bd('0x1d')](_0x383fe9);}};}function respondWithFilteredResult(_0x4e3082,_0x29c428){return function(_0x55a36a){if(_0x55a36a){var _0x372455=typeof _0x29c428['offset']===_0x04bd('0x1e')&&typeof _0x29c428['limit']===_0x04bd('0x1e');var _0xbb0191=_0x55a36a[_0x04bd('0x1f')];var _0x171803=_0x372455?0x0:_0x29c428[_0x04bd('0x20')];var _0x2c18e9=_0x372455?_0x55a36a[_0x04bd('0x1f')]:_0x29c428[_0x04bd('0x20')]+_0x29c428[_0x04bd('0x21')];var _0x254d69;if(_0x2c18e9>=_0xbb0191){_0x2c18e9=_0xbb0191;_0x254d69=0xc8;}else{_0x254d69=0xce;}_0x4e3082['status'](_0x254d69);return _0x4e3082[_0x04bd('0x22')](_0x04bd('0x23'),_0x171803+'-'+_0x2c18e9+'/'+_0xbb0191)[_0x04bd('0x1d')](_0x55a36a);}return null;};}function patchUpdates(_0x59fe7e){return function(_0x2a7eff){try{jsonpatch[_0x04bd('0x24')](_0x2a7eff,_0x59fe7e,!![]);}catch(_0x5c30dc){return BPromise[_0x04bd('0x25')](_0x5c30dc);}return _0x2a7eff[_0x04bd('0x26')]();};}function saveUpdates(_0x4b5397,_0x20fe9a){return function(_0x173e39){if(_0x173e39){return _0x173e39[_0x04bd('0x27')](_0x4b5397)[_0x04bd('0x28')](function(_0x352040){return _0x352040;});}return null;};}function removeEntity(_0x1a0c00,_0x1865c8){return function(_0x5e381e){if(_0x5e381e){return _0x5e381e[_0x04bd('0x29')]()['then'](function(){_0x1a0c00[_0x04bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2207f0,_0x4b2b05){return function(_0x47536b){if(!_0x47536b){_0x2207f0['sendStatus'](0x194);}return _0x47536b;};}function handleError(_0x84cce0,_0x2cb637){_0x2cb637=_0x2cb637||0x1f4;return function(_0xc96236){logger[_0x04bd('0x2a')](_0xc96236[_0x04bd('0x2b')]);if(_0xc96236['name']){delete _0xc96236[_0x04bd('0x2c')];}_0x84cce0['status'](_0x2cb637)[_0x04bd('0x2d')](_0xc96236);};}exports[_0x04bd('0x2e')]=function(_0x1927a8,_0xcd7aec){var _0x1f2134={},_0x437c16={},_0x4a0f1f={'count':0x0,'rows':[]};var _0x325581=_[_0x04bd('0x2f')](db[_0x04bd('0x30')][_0x04bd('0x31')],function(_0x5aaac1){return{'name':_0x5aaac1[_0x04bd('0x32')],'type':_0x5aaac1['type'][_0x04bd('0x33')]};});_0x437c16['model']=_[_0x04bd('0x2f')](_0x325581,_0x04bd('0x2c'));_0x437c16['query']=_[_0x04bd('0x34')](_0x1927a8['query']);_0x437c16['filters']=_[_0x04bd('0x35')](_0x437c16['model'],_0x437c16[_0x04bd('0x36')]);_0x1f2134[_0x04bd('0x37')]=_['intersection'](_0x437c16[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x1927a8[_0x04bd('0x36')]['fields']));_0x1f2134[_0x04bd('0x37')]=_0x1f2134[_0x04bd('0x37')]['length']?_0x1f2134[_0x04bd('0x37')]:_0x437c16['model'];if(!_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3a')]('nolimit')){_0x1f2134['limit']=qs[_0x04bd('0x21')](_0x1927a8[_0x04bd('0x36')]['limit']);_0x1f2134[_0x04bd('0x20')]=qs[_0x04bd('0x20')](_0x1927a8['query'][_0x04bd('0x20')]);}_0x1f2134['order']=qs[_0x04bd('0x3b')](_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3b')]);_0x1f2134[_0x04bd('0x3c')]=qs[_0x04bd('0x3d')](_[_0x04bd('0x3e')](_0x1927a8[_0x04bd('0x36')],_0x437c16[_0x04bd('0x3d')]),_0x325581);if(_0x1927a8['query'][_0x04bd('0x3f')]){_0x1f2134[_0x04bd('0x3c')]=_[_0x04bd('0x40')](_0x1f2134[_0x04bd('0x3c')],{'$or':_[_0x04bd('0x2f')](_0x325581,function(_0x3c3448){if(_0x3c3448[_0x04bd('0x41')]!==_0x04bd('0x42')){var _0x284b61={};_0x284b61[_0x3c3448[_0x04bd('0x2c')]]={'$like':'%'+_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3f')]+'%'};return _0x284b61;}})});}_0x1f2134=_[_0x04bd('0x40')]({},_0x1f2134,_0x1927a8['options']);var _0x2d88e1={'where':_0x1f2134[_0x04bd('0x3c')]};return db[_0x04bd('0x30')][_0x04bd('0x1f')](_0x2d88e1)[_0x04bd('0x28')](function(_0x12332f){_0x4a0f1f[_0x04bd('0x1f')]=_0x12332f;if(_0x1927a8[_0x04bd('0x36')][_0x04bd('0x43')]){_0x1f2134['include']=[{'all':!![]}];}return db[_0x04bd('0x30')][_0x04bd('0x44')](_0x1f2134);})[_0x04bd('0x28')](function(_0x27877a){_0x4a0f1f['rows']=_0x27877a;return _0x4a0f1f;})[_0x04bd('0x28')](respondWithFilteredResult(_0xcd7aec,_0x1f2134))[_0x04bd('0x45')](handleError(_0xcd7aec,null));};exports[_0x04bd('0x46')]=function(_0x410629,_0x5dc565){var _0x2603a0={'raw':![],'where':{'id':_0x410629[_0x04bd('0x47')]['id']}},_0x4559de={};_0x4559de['model']=_['keys'](db[_0x04bd('0x30')][_0x04bd('0x31')]);_0x4559de[_0x04bd('0x36')]=_[_0x04bd('0x34')](_0x410629[_0x04bd('0x36')]);_0x4559de[_0x04bd('0x3d')]=_[_0x04bd('0x35')](_0x4559de['model'],_0x4559de[_0x04bd('0x36')]);_0x2603a0['attributes']=_[_0x04bd('0x35')](_0x4559de[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x410629['query']['fields']));_0x2603a0[_0x04bd('0x37')]=_0x2603a0['attributes'][_0x04bd('0x48')]?_0x2603a0[_0x04bd('0x37')]:_0x4559de['model'];if(_0x410629[_0x04bd('0x36')]['includeAll']){_0x2603a0[_0x04bd('0x49')]=[{'all':!![]}];}_0x2603a0=_[_0x04bd('0x40')]({},_0x2603a0,_0x410629['options']);return db[_0x04bd('0x30')][_0x04bd('0x4a')](_0x2603a0)['then'](handleEntityNotFound(_0x5dc565,null))[_0x04bd('0x28')](respondWithResult(_0x5dc565,null))[_0x04bd('0x45')](handleError(_0x5dc565,null));};exports[_0x04bd('0x4b')]=function(_0x5d1912,_0x184138){return db[_0x04bd('0x30')][_0x04bd('0x4b')](_0x5d1912[_0x04bd('0x4c')],{})[_0x04bd('0x28')](respondWithResult(_0x184138,0xc9))[_0x04bd('0x45')](handleError(_0x184138,null));};exports['update']=function(_0x5e29c3,_0x7e13c3){if(_0x5e29c3['body']['id']){delete _0x5e29c3[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x30')][_0x04bd('0x4a')]({'where':{'id':_0x5e29c3[_0x04bd('0x47')]['id']}})[_0x04bd('0x28')](handleEntityNotFound(_0x7e13c3,null))['then'](saveUpdates(_0x5e29c3['body'],null))[_0x04bd('0x28')](respondWithResult(_0x7e13c3,null))[_0x04bd('0x45')](handleError(_0x7e13c3,null));};exports[_0x04bd('0x29')]=function(_0x2bb082,_0x5e2eec){return db[_0x04bd('0x30')]['find']({'where':{'id':_0x2bb082[_0x04bd('0x47')]['id']}})[_0x04bd('0x28')](handleEntityNotFound(_0x5e2eec,null))['then'](removeEntity(_0x5e2eec,null))[_0x04bd('0x45')](handleError(_0x5e2eec,null));};exports[_0x04bd('0x4d')]=function(_0x472d89,_0x1d0c8a,_0x557c72){var _0x1b43ea={};var _0x4c9015={};var _0x312fa5;var _0x4a73cf;return db[_0x04bd('0x30')]['findOne']({'where':{'id':_0x472d89[_0x04bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d0c8a,null))[_0x04bd('0x28')](function(_0x13d612){if(_0x13d612){_0x312fa5=_0x13d612;_0x4c9015[_0x04bd('0x38')]=_['keys'](db['SugarcrmConfiguration'][_0x04bd('0x31')]);_0x4c9015[_0x04bd('0x36')]=_['keys'](_0x472d89[_0x04bd('0x36')]);_0x4c9015[_0x04bd('0x3d')]=_[_0x04bd('0x35')](_0x4c9015['model'],_0x4c9015[_0x04bd('0x36')]);_0x1b43ea[_0x04bd('0x37')]=_[_0x04bd('0x35')](_0x4c9015[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x472d89['query'][_0x04bd('0x39')]));_0x1b43ea['attributes']=_0x1b43ea['attributes'][_0x04bd('0x48')]?_0x1b43ea[_0x04bd('0x37')]:_0x4c9015[_0x04bd('0x38')];_0x1b43ea[_0x04bd('0x4e')]=qs['sort'](_0x472d89[_0x04bd('0x36')][_0x04bd('0x3b')]);_0x1b43ea[_0x04bd('0x3c')]=qs['filters'](_[_0x04bd('0x3e')](_0x472d89[_0x04bd('0x36')],_0x4c9015[_0x04bd('0x3d')]));if(_0x472d89[_0x04bd('0x36')][_0x04bd('0x3f')]){_0x1b43ea['where']=_[_0x04bd('0x40')](_0x1b43ea[_0x04bd('0x3c')],{'$or':_[_0x04bd('0x2f')](_0x1b43ea['attributes'],function(_0x4abaab){var _0x4d9891={};_0x4d9891[_0x4abaab]={'$like':'%'+_0x472d89[_0x04bd('0x36')][_0x04bd('0x3f')]+'%'};return _0x4d9891;})});}_0x1b43ea=_[_0x04bd('0x40')]({},_0x1b43ea,_0x472d89[_0x04bd('0x4f')]);return _0x312fa5[_0x04bd('0x4d')](_0x1b43ea);}})[_0x04bd('0x28')](function(_0xe21147){if(_0xe21147){_0x4a73cf=_0xe21147[_0x04bd('0x48')];if(!_0x472d89[_0x04bd('0x36')][_0x04bd('0x3a')](_0x04bd('0x50'))){_0x1b43ea[_0x04bd('0x21')]=qs['limit'](_0x472d89[_0x04bd('0x36')][_0x04bd('0x21')]);_0x1b43ea[_0x04bd('0x20')]=qs[_0x04bd('0x20')](_0x472d89['query'][_0x04bd('0x20')]);}return _0x312fa5[_0x04bd('0x4d')](_0x1b43ea);}})[_0x04bd('0x28')](function(_0x221a99){if(_0x221a99){return _0x221a99?{'count':_0x4a73cf,'rows':_0x221a99}:null;}})['then'](respondWithResult(_0x1d0c8a,null))[_0x04bd('0x45')](handleError(_0x1d0c8a,null));};exports[_0x04bd('0x51')]=function(_0x1236f8,_0x31b1ad,_0x2cd824){if(_0x1236f8[_0x04bd('0x4c')]['id']){delete _0x1236f8[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x30')][_0x04bd('0x52')]({'where':{'id':_0x1236f8[_0x04bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x31b1ad,null))['then'](function(_0x3c8006){if(_0x3c8006){_0x1236f8['body'][_0x04bd('0x53')]=_0x3c8006['id'];_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x54')]=integrations['getSubjects'](_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x55')],_0x1236f8['body']['type']);_0x1236f8[_0x04bd('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x1236f8[_0x04bd('0x4c')]['channel'],_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x41')]);return db['SugarcrmConfiguration'][_0x04bd('0x4b')](_0x1236f8[_0x04bd('0x4c')],{'include':[{'model':db[_0x04bd('0x56')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x04bd('0x57')}]});}return null;})[_0x04bd('0x28')](respondWithResult(_0x31b1ad,null))[_0x04bd('0x45')](handleError(_0x31b1ad,null));};exports[_0x04bd('0x58')]=function(_0x39bb7a,_0x163a2d,_0x171a60){var _0xdba90='';var _0x1e3abc=['id',_0x04bd('0x2c'),_0x04bd('0x59'),'created_by',_0x04bd('0x5a'),_0x04bd('0x5b'),_0x04bd('0x5c'),'duration_minutes',_0x04bd('0x5d'),'parent_type','parent_name',_0x04bd('0x5e')];return db[_0x04bd('0x30')][_0x04bd('0x52')]({'where':{'id':_0x39bb7a['params']['id']},'attributes':['id',_0x04bd('0x5f'),_0x04bd('0x60'),_0x04bd('0x61')]})[_0x04bd('0x28')](handleEntityNotFound(_0x163a2d,null))[_0x04bd('0x28')](function(_0x5ee7dd){if(_0x5ee7dd){_0xdba90=_0x5ee7dd[_0x04bd('0x61')];var _0x227321=_0xdba90[_0x04bd('0x62')](-0x1);if(_0x227321==='/'){_0xdba90=_0xdba90[_0x04bd('0x63')](0x0,_0xdba90[_0x04bd('0x64')](_0x227321));}return rp({'method':'POST','uri':util[_0x04bd('0x65')](_0x04bd('0x66'),_0xdba90,_0x04bd('0x67')),'json':!![],'form':{'method':_0x04bd('0x68'),'input_type':'JSON','response_type':_0x04bd('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5ee7dd['username'],'password':_0x5ee7dd[_0x04bd('0x60')],'encryption':_0x04bd('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x533a66){if(_0x533a66&&_0x533a66[_0x04bd('0x2c')]!=='Invalid\x20Login'&&_0x533a66['name']!=='Password\x20Expired'){return rp({'method':_0x04bd('0x6b'),'uri':util[_0x04bd('0x65')]('%s%s',_0xdba90,_0x04bd('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x04bd('0x69'),'response_type':'JSON','rest_data':JSON[_0x04bd('0x6c')]({'session':_0x533a66['id'],'module_name':'Calls'})}})[_0x04bd('0x28')](function(_0x5d532f){if(_0x5d532f){var _0x6fb34b=_[_0x04bd('0x6d')](_0x5d532f[_0x04bd('0x6e')]);_['remove'](_0x6fb34b,function(_0x40a38a){return _0x1e3abc['includes'](_0x40a38a[_0x04bd('0x2c')]);});return{'count':_0x6fb34b[_0x04bd('0x48')],'rows':_[_0x04bd('0x2f')](_0x6fb34b,function(_0x45c1ff){return{'id':_0x45c1ff[_0x04bd('0x2c')],'name':_0x45c1ff['label'],'custom':_[_0x04bd('0x6f')](_0x45c1ff[_0x04bd('0x2c')],'_c')?!![]:![],'options':_0x45c1ff[_0x04bd('0x4f')]?_[_0x04bd('0x2f')](_[_0x04bd('0x6d')](_0x45c1ff[_0x04bd('0x4f')]),function(_0x34fc44){return{'name':_0x34fc44['value'],'value':_0x34fc44[_0x04bd('0x2c')]};}):[]};})};}})[_0x04bd('0x28')](respondWithResult(_0x163a2d,null))['catch'](function(_0x3e98b0){var _0x357b35=_0x39bb7a[_0x04bd('0x36')][_0x04bd('0x70')]?0x1f4:_0x3e98b0['statusCode']||0x1f4;logger[_0x04bd('0x2a')](_0x04bd('0x71'),_0x04bd('0x58'),_0x357b35,JSON['stringify'](_0x3e98b0));delete _0x3e98b0[_0x04bd('0x2c')];if(_0x357b35===0x191){_0x357b35=0x190;}_0x163a2d['status'](_0x357b35)[_0x04bd('0x2d')](_0x39bb7a[_0x04bd('0x36')]['test']?{'message':_0x04bd('0x72'),'statusCode':_0x3e98b0[_0x04bd('0x73')]}:_0x3e98b0);});}else{var _0x96fd2=0x1f4;_0x163a2d[_0x04bd('0x1c')](_0x96fd2)['send']({'message':_0x04bd('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc914=['SugarcrmField','created_by','description','date_start','duration_minutes','parent_name','direction','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','endsWith','value','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','send','map','rawAttributes','fieldName','type','key','name','keys','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','SugarcrmAccount','include','rows','catch','params','intersection','length','includeAll','create','body','find','findOne','options','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions'];(function(_0x3a854a,_0xd4137f){var _0x19a93f=function(_0x1ea353){while(--_0x1ea353){_0x3a854a['push'](_0x3a854a['shift']());}};_0x19a93f(++_0xd4137f);}(_0xc914,0x173));var _0x4c91=function(_0x49394c,_0x5bbc6b){_0x49394c=_0x49394c-0x0;var _0x718259=_0xc914[_0x49394c];return _0x718259;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c91('0x0'));var zipdir=require(_0x4c91('0x1'));var jsonpatch=require(_0x4c91('0x2'));var rp=require(_0x4c91('0x3'));var moment=require(_0x4c91('0x4'));var BPromise=require(_0x4c91('0x5'));var Mustache=require('mustache');var util=require(_0x4c91('0x6'));var path=require('path');var sox=require(_0x4c91('0x7'));var csv=require('to-csv');var ejs=require(_0x4c91('0x8'));var fs=require('fs');var fs_extra=require(_0x4c91('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c91('0xa'));var jsforce=require(_0x4c91('0xb'));var deskjs=require(_0x4c91('0xc'));var toCsv=require(_0x4c91('0xd'));var querystring=require(_0x4c91('0xe'));var Papa=require(_0x4c91('0xf'));var Redis=require(_0x4c91('0x10'));var authService=require(_0x4c91('0x11'));var qs=require(_0x4c91('0x12'));var as=require(_0x4c91('0x13'));var hardwareService=require(_0x4c91('0x14'));var logger=require(_0x4c91('0x15'))(_0x4c91('0x16'));var utils=require('../../config/utils');var config=require(_0x4c91('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c91('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e5101,_0x4a34e2){_0x4a34e2=_0x4a34e2||0xcc;return function(_0x1f965c){if(_0x1f965c){return _0x2e5101[_0x4c91('0x19')](_0x4a34e2);}return _0x2e5101[_0x4c91('0x1a')](_0x4a34e2)[_0x4c91('0x1b')]();};}function respondWithResult(_0x413ad4,_0x321570){_0x321570=_0x321570||0xc8;return function(_0x3b083a){if(_0x3b083a){return _0x413ad4['status'](_0x321570)[_0x4c91('0x1c')](_0x3b083a);}};}function respondWithFilteredResult(_0x2723cc,_0x413997){return function(_0x36105e){if(_0x36105e){var _0x57d876=typeof _0x413997[_0x4c91('0x1d')]===_0x4c91('0x1e')&&typeof _0x413997['limit']===_0x4c91('0x1e');var _0x5dbc45=_0x36105e[_0x4c91('0x1f')];var _0x38411d=_0x57d876?0x0:_0x413997['offset'];var _0x5accb5=_0x57d876?_0x36105e[_0x4c91('0x1f')]:_0x413997['offset']+_0x413997[_0x4c91('0x20')];var _0x8fcb0c;if(_0x5accb5>=_0x5dbc45){_0x5accb5=_0x5dbc45;_0x8fcb0c=0xc8;}else{_0x8fcb0c=0xce;}_0x2723cc['status'](_0x8fcb0c);return _0x2723cc[_0x4c91('0x21')](_0x4c91('0x22'),_0x38411d+'-'+_0x5accb5+'/'+_0x5dbc45)['json'](_0x36105e);}return null;};}function patchUpdates(_0x135c21){return function(_0x43702e){try{jsonpatch[_0x4c91('0x23')](_0x43702e,_0x135c21,!![]);}catch(_0x23028c){return BPromise[_0x4c91('0x24')](_0x23028c);}return _0x43702e[_0x4c91('0x25')]();};}function saveUpdates(_0x1c6af9,_0x3fac3b){return function(_0x3a833c){if(_0x3a833c){return _0x3a833c[_0x4c91('0x26')](_0x1c6af9)['then'](function(_0x2eb5db){return _0x2eb5db;});}return null;};}function removeEntity(_0x43dfb6,_0x23d90b){return function(_0x3dc31f){if(_0x3dc31f){return _0x3dc31f[_0x4c91('0x27')]()[_0x4c91('0x28')](function(){_0x43dfb6[_0x4c91('0x1a')](0xcc)[_0x4c91('0x1b')]();});}};}function handleEntityNotFound(_0x30ebb2,_0x37ab47){return function(_0x1fd1ce){if(!_0x1fd1ce){_0x30ebb2['sendStatus'](0x194);}return _0x1fd1ce;};}function handleError(_0x385d75,_0xd72464){_0xd72464=_0xd72464||0x1f4;return function(_0x2c07d7){logger['error'](_0x2c07d7['stack']);if(_0x2c07d7['name']){delete _0x2c07d7['name'];}_0x385d75[_0x4c91('0x1a')](_0xd72464)[_0x4c91('0x29')](_0x2c07d7);};}exports['index']=function(_0x26ca80,_0x3e2634){var _0x5c29c4={},_0x3439b7={},_0x26b61c={'count':0x0,'rows':[]};var _0x4f5b24=_[_0x4c91('0x2a')](db['SugarcrmAccount'][_0x4c91('0x2b')],function(_0x4bb704){return{'name':_0x4bb704[_0x4c91('0x2c')],'type':_0x4bb704[_0x4c91('0x2d')][_0x4c91('0x2e')]};});_0x3439b7['model']=_['map'](_0x4f5b24,_0x4c91('0x2f'));_0x3439b7['query']=_[_0x4c91('0x30')](_0x26ca80[_0x4c91('0x31')]);_0x3439b7[_0x4c91('0x32')]=_['intersection'](_0x3439b7[_0x4c91('0x33')],_0x3439b7[_0x4c91('0x31')]);_0x5c29c4['attributes']=_['intersection'](_0x3439b7['model'],qs[_0x4c91('0x34')](_0x26ca80[_0x4c91('0x31')][_0x4c91('0x34')]));_0x5c29c4['attributes']=_0x5c29c4['attributes']['length']?_0x5c29c4[_0x4c91('0x35')]:_0x3439b7[_0x4c91('0x33')];if(!_0x26ca80['query'][_0x4c91('0x36')](_0x4c91('0x37'))){_0x5c29c4[_0x4c91('0x20')]=qs[_0x4c91('0x20')](_0x26ca80[_0x4c91('0x31')][_0x4c91('0x20')]);_0x5c29c4[_0x4c91('0x1d')]=qs[_0x4c91('0x1d')](_0x26ca80['query']['offset']);}_0x5c29c4[_0x4c91('0x38')]=qs['sort'](_0x26ca80[_0x4c91('0x31')][_0x4c91('0x39')]);_0x5c29c4['where']=qs['filters'](_[_0x4c91('0x3a')](_0x26ca80[_0x4c91('0x31')],_0x3439b7[_0x4c91('0x32')]),_0x4f5b24);if(_0x26ca80[_0x4c91('0x31')]['filter']){_0x5c29c4[_0x4c91('0x3b')]=_['merge'](_0x5c29c4[_0x4c91('0x3b')],{'$or':_[_0x4c91('0x2a')](_0x4f5b24,function(_0x1999f3){if(_0x1999f3[_0x4c91('0x2d')]!=='VIRTUAL'){var _0x1c7544={};_0x1c7544[_0x1999f3[_0x4c91('0x2f')]]={'$like':'%'+_0x26ca80[_0x4c91('0x31')][_0x4c91('0x3c')]+'%'};return _0x1c7544;}})});}_0x5c29c4=_[_0x4c91('0x3d')]({},_0x5c29c4,_0x26ca80['options']);var _0x2a1918={'where':_0x5c29c4[_0x4c91('0x3b')]};return db[_0x4c91('0x3e')][_0x4c91('0x1f')](_0x2a1918)['then'](function(_0xe3bcd5){_0x26b61c[_0x4c91('0x1f')]=_0xe3bcd5;if(_0x26ca80[_0x4c91('0x31')]['includeAll']){_0x5c29c4[_0x4c91('0x3f')]=[{'all':!![]}];}return db[_0x4c91('0x3e')]['findAll'](_0x5c29c4);})[_0x4c91('0x28')](function(_0x448b58){_0x26b61c[_0x4c91('0x40')]=_0x448b58;return _0x26b61c;})[_0x4c91('0x28')](respondWithFilteredResult(_0x3e2634,_0x5c29c4))[_0x4c91('0x41')](handleError(_0x3e2634,null));};exports['show']=function(_0x552067,_0x37dbe8){var _0xeb4ba9={'raw':![],'where':{'id':_0x552067[_0x4c91('0x42')]['id']}},_0x56a3f8={};_0x56a3f8[_0x4c91('0x33')]=_[_0x4c91('0x30')](db[_0x4c91('0x3e')][_0x4c91('0x2b')]);_0x56a3f8[_0x4c91('0x31')]=_[_0x4c91('0x30')](_0x552067[_0x4c91('0x31')]);_0x56a3f8[_0x4c91('0x32')]=_['intersection'](_0x56a3f8['model'],_0x56a3f8[_0x4c91('0x31')]);_0xeb4ba9['attributes']=_[_0x4c91('0x43')](_0x56a3f8['model'],qs[_0x4c91('0x34')](_0x552067[_0x4c91('0x31')]['fields']));_0xeb4ba9[_0x4c91('0x35')]=_0xeb4ba9[_0x4c91('0x35')][_0x4c91('0x44')]?_0xeb4ba9[_0x4c91('0x35')]:_0x56a3f8[_0x4c91('0x33')];if(_0x552067[_0x4c91('0x31')][_0x4c91('0x45')]){_0xeb4ba9[_0x4c91('0x3f')]=[{'all':!![]}];}_0xeb4ba9=_['merge']({},_0xeb4ba9,_0x552067['options']);return db[_0x4c91('0x3e')]['find'](_0xeb4ba9)['then'](handleEntityNotFound(_0x37dbe8,null))[_0x4c91('0x28')](respondWithResult(_0x37dbe8,null))[_0x4c91('0x41')](handleError(_0x37dbe8,null));};exports[_0x4c91('0x46')]=function(_0x1c6022,_0x24c9a6){return db[_0x4c91('0x3e')][_0x4c91('0x46')](_0x1c6022[_0x4c91('0x47')],{})[_0x4c91('0x28')](respondWithResult(_0x24c9a6,0xc9))[_0x4c91('0x41')](handleError(_0x24c9a6,null));};exports['update']=function(_0x7b3ac7,_0xf058bf){if(_0x7b3ac7[_0x4c91('0x47')]['id']){delete _0x7b3ac7[_0x4c91('0x47')]['id'];}return db[_0x4c91('0x3e')][_0x4c91('0x48')]({'where':{'id':_0x7b3ac7['params']['id']}})[_0x4c91('0x28')](handleEntityNotFound(_0xf058bf,null))[_0x4c91('0x28')](saveUpdates(_0x7b3ac7[_0x4c91('0x47')],null))[_0x4c91('0x28')](respondWithResult(_0xf058bf,null))[_0x4c91('0x41')](handleError(_0xf058bf,null));};exports[_0x4c91('0x27')]=function(_0x571998,_0x4db8a3){return db[_0x4c91('0x3e')][_0x4c91('0x48')]({'where':{'id':_0x571998['params']['id']}})[_0x4c91('0x28')](handleEntityNotFound(_0x4db8a3,null))[_0x4c91('0x28')](removeEntity(_0x4db8a3,null))[_0x4c91('0x41')](handleError(_0x4db8a3,null));};exports['getConfigurations']=function(_0x5a3c28,_0x2dbcf9,_0x3ad884){var _0x4ced83={};var _0x1f88d8={};var _0x5117d6;var _0x503245;return db['SugarcrmAccount'][_0x4c91('0x49')]({'where':{'id':_0x5a3c28[_0x4c91('0x42')]['id']}})['then'](handleEntityNotFound(_0x2dbcf9,null))[_0x4c91('0x28')](function(_0x43293b){if(_0x43293b){_0x5117d6=_0x43293b;_0x1f88d8[_0x4c91('0x33')]=_[_0x4c91('0x30')](db['SugarcrmConfiguration'][_0x4c91('0x2b')]);_0x1f88d8[_0x4c91('0x31')]=_['keys'](_0x5a3c28[_0x4c91('0x31')]);_0x1f88d8[_0x4c91('0x32')]=_[_0x4c91('0x43')](_0x1f88d8[_0x4c91('0x33')],_0x1f88d8['query']);_0x4ced83['attributes']=_['intersection'](_0x1f88d8[_0x4c91('0x33')],qs[_0x4c91('0x34')](_0x5a3c28['query']['fields']));_0x4ced83[_0x4c91('0x35')]=_0x4ced83[_0x4c91('0x35')][_0x4c91('0x44')]?_0x4ced83[_0x4c91('0x35')]:_0x1f88d8[_0x4c91('0x33')];_0x4ced83[_0x4c91('0x38')]=qs['sort'](_0x5a3c28['query'][_0x4c91('0x39')]);_0x4ced83[_0x4c91('0x3b')]=qs[_0x4c91('0x32')](_['pick'](_0x5a3c28[_0x4c91('0x31')],_0x1f88d8[_0x4c91('0x32')]));if(_0x5a3c28[_0x4c91('0x31')][_0x4c91('0x3c')]){_0x4ced83[_0x4c91('0x3b')]=_['merge'](_0x4ced83['where'],{'$or':_[_0x4c91('0x2a')](_0x4ced83['attributes'],function(_0x53c339){var _0x429bef={};_0x429bef[_0x53c339]={'$like':'%'+_0x5a3c28[_0x4c91('0x31')][_0x4c91('0x3c')]+'%'};return _0x429bef;})});}_0x4ced83=_[_0x4c91('0x3d')]({},_0x4ced83,_0x5a3c28[_0x4c91('0x4a')]);return _0x5117d6['getConfigurations'](_0x4ced83);}})[_0x4c91('0x28')](function(_0x25fa2d){if(_0x25fa2d){_0x503245=_0x25fa2d[_0x4c91('0x44')];if(!_0x5a3c28['query'][_0x4c91('0x36')](_0x4c91('0x37'))){_0x4ced83[_0x4c91('0x20')]=qs['limit'](_0x5a3c28[_0x4c91('0x31')][_0x4c91('0x20')]);_0x4ced83['offset']=qs[_0x4c91('0x1d')](_0x5a3c28['query'][_0x4c91('0x1d')]);}return _0x5117d6[_0x4c91('0x4b')](_0x4ced83);}})[_0x4c91('0x28')](function(_0x5cf1b2){if(_0x5cf1b2){return _0x5cf1b2?{'count':_0x503245,'rows':_0x5cf1b2}:null;}})[_0x4c91('0x28')](respondWithResult(_0x2dbcf9,null))[_0x4c91('0x41')](handleError(_0x2dbcf9,null));};exports[_0x4c91('0x4c')]=function(_0x976b47,_0x5f468c,_0x70b41c){if(_0x976b47['body']['id']){delete _0x976b47['body']['id'];}return db['SugarcrmAccount'][_0x4c91('0x49')]({'where':{'id':_0x976b47[_0x4c91('0x42')]['id']}})[_0x4c91('0x28')](handleEntityNotFound(_0x5f468c,null))['then'](function(_0x1a2efc){if(_0x1a2efc){_0x976b47[_0x4c91('0x47')]['AccountId']=_0x1a2efc['id'];_0x976b47['body'][_0x4c91('0x4d')]=integrations[_0x4c91('0x4e')](_0x976b47[_0x4c91('0x47')]['channel'],_0x976b47[_0x4c91('0x47')][_0x4c91('0x2d')]);_0x976b47[_0x4c91('0x47')][_0x4c91('0x4f')]=integrations[_0x4c91('0x50')](_0x976b47[_0x4c91('0x47')]['channel'],_0x976b47[_0x4c91('0x47')][_0x4c91('0x2d')]);return db['SugarcrmConfiguration']['create'](_0x976b47[_0x4c91('0x47')],{'include':[{'model':db[_0x4c91('0x51')],'as':_0x4c91('0x4d')},{'model':db[_0x4c91('0x51')],'as':_0x4c91('0x4f')}]});}return null;})[_0x4c91('0x28')](respondWithResult(_0x5f468c,null))[_0x4c91('0x41')](handleError(_0x5f468c,null));};exports['getFields']=function(_0x36338f,_0x2376dd,_0x29a24a){var _0x57a0d3='';var _0x242ad8=['id',_0x4c91('0x2f'),'assigned_user_id',_0x4c91('0x52'),_0x4c91('0x53'),_0x4c91('0x54'),'duration_hours',_0x4c91('0x55'),'parent_id','parent_type',_0x4c91('0x56'),_0x4c91('0x57')];return db[_0x4c91('0x3e')][_0x4c91('0x49')]({'where':{'id':_0x36338f[_0x4c91('0x42')]['id']},'attributes':['id','username',_0x4c91('0x58'),_0x4c91('0x59')]})['then'](handleEntityNotFound(_0x2376dd,null))[_0x4c91('0x28')](function(_0x398763){if(_0x398763){_0x57a0d3=_0x398763['remoteUri'];var _0x3b862d=_0x57a0d3['slice'](-0x1);if(_0x3b862d==='/'){_0x57a0d3=_0x57a0d3[_0x4c91('0x5a')](0x0,_0x57a0d3[_0x4c91('0x5b')](_0x3b862d));}return rp({'method':_0x4c91('0x5c'),'uri':util[_0x4c91('0x5d')](_0x4c91('0x5e'),_0x57a0d3,_0x4c91('0x5f')),'json':!![],'form':{'method':_0x4c91('0x60'),'input_type':_0x4c91('0x61'),'response_type':_0x4c91('0x61'),'rest_data':JSON[_0x4c91('0x62')]({'user_auth':{'user_name':_0x398763[_0x4c91('0x63')],'password':_0x398763['password'],'encryption':'PLAIN'},'application':_0x4c91('0x64')})}});}})['then'](function(_0x2ff1f5){if(_0x2ff1f5&&_0x2ff1f5['name']!==_0x4c91('0x65')&&_0x2ff1f5[_0x4c91('0x2f')]!==_0x4c91('0x66')){return rp({'method':_0x4c91('0x5c'),'uri':util['format'](_0x4c91('0x5e'),_0x57a0d3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4c91('0x67'),'input_type':'JSON','response_type':_0x4c91('0x61'),'rest_data':JSON[_0x4c91('0x62')]({'session':_0x2ff1f5['id'],'module_name':_0x4c91('0x68')})}})[_0x4c91('0x28')](function(_0x46d20b){if(_0x46d20b){var _0x157948=_[_0x4c91('0x69')](_0x46d20b[_0x4c91('0x6a')]);_[_0x4c91('0x6b')](_0x157948,function(_0x1132d7){return _0x242ad8['includes'](_0x1132d7[_0x4c91('0x2f')]);});return{'count':_0x157948[_0x4c91('0x44')],'rows':_[_0x4c91('0x2a')](_0x157948,function(_0x1638d1){return{'id':_0x1638d1['name'],'name':_0x1638d1['label'],'custom':_[_0x4c91('0x6c')](_0x1638d1[_0x4c91('0x2f')],'_c')?!![]:![],'options':_0x1638d1['options']?_[_0x4c91('0x2a')](_[_0x4c91('0x69')](_0x1638d1[_0x4c91('0x4a')]),function(_0x45284e){return{'name':_0x45284e[_0x4c91('0x6d')],'value':_0x45284e[_0x4c91('0x2f')]};}):[]};})};}})[_0x4c91('0x28')](respondWithResult(_0x2376dd,null))[_0x4c91('0x41')](function(_0x18fd85){var _0x10e8f0=_0x36338f[_0x4c91('0x31')][_0x4c91('0x6e')]?0x1f4:_0x18fd85['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x10e8f0,JSON[_0x4c91('0x62')](_0x18fd85));delete _0x18fd85[_0x4c91('0x2f')];if(_0x10e8f0===0x191){_0x10e8f0=0x190;}_0x2376dd[_0x4c91('0x1a')](_0x10e8f0)[_0x4c91('0x29')](_0x36338f[_0x4c91('0x31')]['test']?{'message':_0x4c91('0x6f'),'statusCode':_0x18fd85[_0x4c91('0x70')]}:_0x18fd85);});}else{var _0x15bfb2=0x1f4;_0x2376dd[_0x4c91('0x1a')](_0x15bfb2)[_0x4c91('0x29')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 20788da..d649e1e 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 _0x0dff=['bluebird','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x0dff,0x168));var _0xf0df=function(_0x5023a1,_0x23d798){_0x5023a1=_0x5023a1-0x0;var _0x22dbaf=_0x0dff[_0x5023a1];return _0x22dbaf;};'use strict';var _=require(_0xf0df('0x0'));var util=require('util');var logger=require(_0xf0df('0x1'))('api');var moment=require(_0xf0df('0x2'));var BPromise=require(_0xf0df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0df('0x4'));var config=require('../../config/environment');var attributes=require(_0xf0df('0x5'));var integrations=require(_0xf0df('0x6'));module[_0xf0df('0x7')]=function(_0x51f768,_0x1113d6){return _0x51f768[_0xf0df('0x8')](_0xf0df('0x9'),attributes,{'tableName':_0xf0df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf46=['int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0x3e28d9,_0xf0b9d8){var _0x12647d=function(_0x518bb7){while(--_0x518bb7){_0x3e28d9['push'](_0x3e28d9['shift']());}};_0x12647d(++_0xf0b9d8);}(_0xbf46,0xc5));var _0x6bf4=function(_0x29ff69,_0x5743b5){_0x29ff69=_0x29ff69-0x0;var _0x10c2ae=_0xbf46[_0x29ff69];return _0x10c2ae;};'use strict';var _=require(_0x6bf4('0x0'));var util=require(_0x6bf4('0x1'));var logger=require('../../config/logger')(_0x6bf4('0x2'));var moment=require(_0x6bf4('0x3'));var BPromise=require(_0x6bf4('0x4'));var rp=require(_0x6bf4('0x5'));var fs=require('fs');var path=require(_0x6bf4('0x6'));var rimraf=require(_0x6bf4('0x7'));var config=require(_0x6bf4('0x8'));var attributes=require(_0x6bf4('0x9'));var integrations=require(_0x6bf4('0xa'));module[_0x6bf4('0xb')]=function(_0x3c9930,_0x55f967){return _0x3c9930['define'](_0x6bf4('0xc'),attributes,{'tableName':_0x6bf4('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 f0d2f6f..337a7b0 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 _0x84c5=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','map','include','model','stringify','find','ShowSugarcrmAccount','lodash','moment','ioredis','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0x84c5,0x1b7));var _0x584c=function(_0x2ad9f8,_0x4a7d81){_0x2ad9f8=_0x2ad9f8-0x0;var _0x476cbc=_0x84c5[_0x2ad9f8];return _0x476cbc;};'use strict';var _=require(_0x584c('0x0'));var util=require('util');var moment=require(_0x584c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x584c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x584c('0x3'));var client=jayson[_0x584c('0x4')][_0x584c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1d6d5f,_0x4472dd,_0x55babb){return new BPromise(function(_0x381b0d,_0x5bfc04){return client[_0x584c('0x6')](_0x1d6d5f,_0x55babb)[_0x584c('0x7')](function(_0x301a63){logger[_0x584c('0x8')](_0x584c('0x9'),_0x4472dd,'request\x20sent');logger[_0x584c('0xa')](_0x584c('0xb'),_0x4472dd,'request\x20sent',JSON['stringify'](_0x301a63));if(_0x301a63['error']){if(_0x301a63[_0x584c('0xc')][_0x584c('0xd')]===0x1f4){logger[_0x584c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4472dd,_0x301a63[_0x584c('0xc')]['message']);return _0x5bfc04(_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);}logger[_0x584c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4472dd,_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);return _0x381b0d(_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);}else{logger['info'](_0x584c('0x9'),_0x4472dd,_0x584c('0xf'));_0x381b0d(_0x301a63[_0x584c('0x10')]['message']);}})[_0x584c('0x11')](function(_0x1643dc){logger[_0x584c('0xc')](_0x584c('0x9'),_0x4472dd,_0x1643dc);_0x5bfc04(_0x1643dc);});});}exports[_0x584c('0x12')]=function(_0x16cafa){var _0x42280f=this;return new Promise(function(_0x4836db,_0x511f1a){return db[_0x584c('0x13')]['findAll']({'raw':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x15')]===undefined?!![]:![]:!![],'where':_0x16cafa[_0x584c('0x14')]?_0x16cafa[_0x584c('0x14')]['where']||null:null,'attributes':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x16')]||null:null,'limit':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x17')]||null:null,'include':_0x16cafa['options']?_0x16cafa[_0x584c('0x14')]['include']?_[_0x584c('0x18')](_0x16cafa[_0x584c('0x14')][_0x584c('0x19')],function(_0x11bf9e){return{'model':db[_0x11bf9e[_0x584c('0x1a')]],'as':_0x11bf9e['as'],'attributes':_0x11bf9e[_0x584c('0x16')],'include':_0x11bf9e[_0x584c('0x19')]?_[_0x584c('0x18')](_0x11bf9e['include'],function(_0x5de9fe){return{'model':db[_0x5de9fe['model']],'as':_0x5de9fe['as'],'attributes':_0x5de9fe['attributes'],'include':_0x5de9fe[_0x584c('0x19')]?_[_0x584c('0x18')](_0x5de9fe['include'],function(_0x2b7955){return{'model':db[_0x2b7955[_0x584c('0x1a')]],'as':_0x2b7955['as'],'attributes':_0x2b7955[_0x584c('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1734b0){logger[_0x584c('0x8')](_0x584c('0x12'),_0x16cafa);logger[_0x584c('0xa')](_0x584c('0x12'),_0x16cafa,JSON[_0x584c('0x1b')](_0x1734b0));_0x4836db(_0x1734b0);})[_0x584c('0x11')](function(_0xce1f18){logger[_0x584c('0xc')](_0x584c('0x12'),_0xce1f18[_0x584c('0xe')],_0x16cafa);_0x511f1a(_0x42280f['error'](0x1f4,_0xce1f18['message']));});});};exports['ShowSugarcrmAccount']=function(_0x203aa1){var _0xeb965f=this;return new Promise(function(_0x46cf98,_0x50d081){return db[_0x584c('0x13')][_0x584c('0x1c')]({'raw':_0x203aa1['options']?_0x203aa1[_0x584c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x203aa1[_0x584c('0x14')]?_0x203aa1[_0x584c('0x14')]['where']||null:null,'attributes':_0x203aa1['options']?_0x203aa1[_0x584c('0x14')][_0x584c('0x16')]||null:null,'include':_0x203aa1['options']?_0x203aa1['options'][_0x584c('0x19')]?_[_0x584c('0x18')](_0x203aa1[_0x584c('0x14')][_0x584c('0x19')],function(_0x29e843){return{'model':db[_0x29e843[_0x584c('0x1a')]],'as':_0x29e843['as'],'attributes':_0x29e843[_0x584c('0x16')],'include':_0x29e843[_0x584c('0x19')]?_[_0x584c('0x18')](_0x29e843[_0x584c('0x19')],function(_0x54113e){return{'model':db[_0x54113e[_0x584c('0x1a')]],'as':_0x54113e['as'],'attributes':_0x54113e['attributes'],'include':_0x54113e[_0x584c('0x19')]?_[_0x584c('0x18')](_0x54113e['include'],function(_0x287330){return{'model':db[_0x287330[_0x584c('0x1a')]],'as':_0x287330['as'],'attributes':_0x287330['attributes']};}):[]};}):[]};}):[]:[]})[_0x584c('0x7')](function(_0x5bb40f){logger[_0x584c('0x8')]('ShowSugarcrmAccount',_0x203aa1);logger[_0x584c('0xa')](_0x584c('0x1d'),_0x203aa1,JSON[_0x584c('0x1b')](_0x5bb40f));_0x46cf98(_0x5bb40f);})[_0x584c('0x11')](function(_0x3b52a4){logger[_0x584c('0xc')](_0x584c('0x1d'),_0x3b52a4[_0x584c('0xe')],_0x203aa1);_0x50d081(_0xeb965f[_0x584c('0xc')](0x1f4,_0x3b52a4[_0x584c('0xe')]));});});}; \ No newline at end of file +var _0x90e7=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result'];(function(_0x17307b,_0x21fe67){var _0x4be46a=function(_0x3611c6){while(--_0x3611c6){_0x17307b['push'](_0x17307b['shift']());}};_0x4be46a(++_0x21fe67);}(_0x90e7,0xfa));var _0x790e=function(_0x582017,_0x100db2){_0x582017=_0x582017-0x0;var _0xec0606=_0x90e7[_0x582017];return _0xec0606;};'use strict';var _=require(_0x790e('0x0'));var util=require('util');var moment=require(_0x790e('0x1'));var BPromise=require(_0x790e('0x2'));var rs=require(_0x790e('0x3'));var fs=require('fs');var Redis=require(_0x790e('0x4'));var db=require(_0x790e('0x5'))['db'];var utils=require(_0x790e('0x6'));var logger=require(_0x790e('0x7'))(_0x790e('0x8'));var config=require(_0x790e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x790e('0xa')][_0x790e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460906,_0xf5dff0,_0x4c9db7){return new BPromise(function(_0x480b86,_0x589f77){return client[_0x790e('0xc')](_0x460906,_0x4c9db7)[_0x790e('0xd')](function(_0x23ccb4){logger[_0x790e('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0xf5dff0,_0x790e('0xf'));logger[_0x790e('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xf5dff0,_0x790e('0xf'),JSON[_0x790e('0x11')](_0x23ccb4));if(_0x23ccb4['error']){if(_0x23ccb4[_0x790e('0x12')]['code']===0x1f4){logger['error'](_0x790e('0x13'),_0xf5dff0,_0x23ccb4[_0x790e('0x12')][_0x790e('0x14')]);return _0x589f77(_0x23ccb4[_0x790e('0x12')][_0x790e('0x14')]);}logger['error'](_0x790e('0x13'),_0xf5dff0,_0x23ccb4[_0x790e('0x12')][_0x790e('0x14')]);return _0x480b86(_0x23ccb4[_0x790e('0x12')][_0x790e('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xf5dff0,_0x790e('0xf'));_0x480b86(_0x23ccb4[_0x790e('0x15')][_0x790e('0x14')]);}})[_0x790e('0x16')](function(_0x36f651){logger[_0x790e('0x12')](_0x790e('0x13'),_0xf5dff0,_0x36f651);_0x589f77(_0x36f651);});});}exports[_0x790e('0x17')]=function(_0x520d36){var _0x102869=this;return new Promise(function(_0x4325b8,_0x5ceef5){return db[_0x790e('0x18')][_0x790e('0x19')]({'raw':_0x520d36[_0x790e('0x1a')]?_0x520d36[_0x790e('0x1a')][_0x790e('0x1b')]===undefined?!![]:![]:!![],'where':_0x520d36['options']?_0x520d36[_0x790e('0x1a')][_0x790e('0x1c')]||null:null,'attributes':_0x520d36['options']?_0x520d36[_0x790e('0x1a')][_0x790e('0x1d')]||null:null,'limit':_0x520d36[_0x790e('0x1a')]?_0x520d36[_0x790e('0x1a')]['limit']||null:null,'include':_0x520d36[_0x790e('0x1a')]?_0x520d36[_0x790e('0x1a')][_0x790e('0x1e')]?_[_0x790e('0x1f')](_0x520d36[_0x790e('0x1a')]['include'],function(_0x448961){return{'model':db[_0x448961['model']],'as':_0x448961['as'],'attributes':_0x448961[_0x790e('0x1d')],'include':_0x448961[_0x790e('0x1e')]?_['map'](_0x448961[_0x790e('0x1e')],function(_0x2fa7db){return{'model':db[_0x2fa7db[_0x790e('0x20')]],'as':_0x2fa7db['as'],'attributes':_0x2fa7db['attributes'],'include':_0x2fa7db['include']?_[_0x790e('0x1f')](_0x2fa7db['include'],function(_0xca60b2){return{'model':db[_0xca60b2['model']],'as':_0xca60b2['as'],'attributes':_0xca60b2[_0x790e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x790e('0xd')](function(_0x4a2de2){logger[_0x790e('0xe')]('GetSugarcrmAccount',_0x520d36);logger[_0x790e('0x10')](_0x790e('0x17'),_0x520d36,JSON[_0x790e('0x11')](_0x4a2de2));_0x4325b8(_0x4a2de2);})[_0x790e('0x16')](function(_0x3180ad){logger[_0x790e('0x12')](_0x790e('0x17'),_0x3180ad['message'],_0x520d36);_0x5ceef5(_0x102869[_0x790e('0x12')](0x1f4,_0x3180ad['message']));});});};exports[_0x790e('0x21')]=function(_0x49b3d2){var _0x359592=this;return new Promise(function(_0x17504d,_0x5d2082){return db[_0x790e('0x18')]['find']({'raw':_0x49b3d2[_0x790e('0x1a')]?_0x49b3d2[_0x790e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x49b3d2[_0x790e('0x1a')]?_0x49b3d2['options'][_0x790e('0x1c')]||null:null,'attributes':_0x49b3d2[_0x790e('0x1a')]?_0x49b3d2[_0x790e('0x1a')]['attributes']||null:null,'include':_0x49b3d2[_0x790e('0x1a')]?_0x49b3d2[_0x790e('0x1a')]['include']?_[_0x790e('0x1f')](_0x49b3d2[_0x790e('0x1a')]['include'],function(_0x1bc735){return{'model':db[_0x1bc735[_0x790e('0x20')]],'as':_0x1bc735['as'],'attributes':_0x1bc735[_0x790e('0x1d')],'include':_0x1bc735['include']?_[_0x790e('0x1f')](_0x1bc735[_0x790e('0x1e')],function(_0x4466f7){return{'model':db[_0x4466f7[_0x790e('0x20')]],'as':_0x4466f7['as'],'attributes':_0x4466f7[_0x790e('0x1d')],'include':_0x4466f7[_0x790e('0x1e')]?_['map'](_0x4466f7[_0x790e('0x1e')],function(_0x1478e9){return{'model':db[_0x1478e9[_0x790e('0x20')]],'as':_0x1478e9['as'],'attributes':_0x1478e9[_0x790e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x790e('0xd')](function(_0x11ca47){logger[_0x790e('0xe')]('ShowSugarcrmAccount',_0x49b3d2);logger[_0x790e('0x10')](_0x790e('0x21'),_0x49b3d2,JSON[_0x790e('0x11')](_0x11ca47));_0x17504d(_0x11ca47);})[_0x790e('0x16')](function(_0x40df1e){logger[_0x790e('0x12')]('ShowSugarcrmAccount',_0x40df1e['message'],_0x49b3d2);_0x5d2082(_0x359592[_0x790e('0x12')](0x1f4,_0x40df1e['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 06e2931..86b9de0 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 _0xda7d=['../../components/interaction/service','get','/:id','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xda7d,0x134));var _0xdda7=function(_0x594d91,_0x589ecb){_0x594d91=_0x594d91-0x0;var _0x30f528=_0xda7d[_0x594d91];return _0x30f528;};'use strict';var multer=require(_0xdda7('0x0'));var util=require(_0xdda7('0x1'));var path=require(_0xdda7('0x2'));var timeout=require(_0xdda7('0x3'));var express=require(_0xdda7('0x4'));var router=express['Router']();var fs_extra=require(_0xdda7('0x5'));var auth=require(_0xdda7('0x6'));var interaction=require(_0xdda7('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xdda7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdda7('0x8')](_0xdda7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xdda7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdda7('0xa')]);router[_0xdda7('0x8')](_0xdda7('0xb'),auth[_0xdda7('0xc')](),controller[_0xdda7('0xd')]);router[_0xdda7('0x8')](_0xdda7('0xe'),auth['isAuthenticated'](),controller[_0xdda7('0xf')]);router[_0xdda7('0x10')]('/',auth[_0xdda7('0xc')](),controller[_0xdda7('0x11')]);router['put']('/:id',auth[_0xdda7('0xc')](),controller['update']);router[_0xdda7('0x12')](_0xdda7('0x9'),auth[_0xdda7('0xc')](),controller[_0xdda7('0x13')]);module[_0xdda7('0x14')]=router; \ No newline at end of file +var _0x7a38=['getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x578d9b,_0x468fe1){var _0x5968de=function(_0x4655e5){while(--_0x4655e5){_0x578d9b['push'](_0x578d9b['shift']());}};_0x5968de(++_0x468fe1);}(_0x7a38,0x110));var _0x87a3=function(_0x2c74ea,_0xfba243){_0x2c74ea=_0x2c74ea-0x0;var _0x56ae1c=_0x7a38[_0x2c74ea];return _0x56ae1c;};'use strict';var multer=require(_0x87a3('0x0'));var util=require(_0x87a3('0x1'));var path=require(_0x87a3('0x2'));var timeout=require(_0x87a3('0x3'));var express=require('express');var router=express[_0x87a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x87a3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x87a3('0x6'));router[_0x87a3('0x7')]('/',auth[_0x87a3('0x8')](),controller[_0x87a3('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x87a3('0xa')]);router['get'](_0x87a3('0xb'),auth['isAuthenticated'](),controller[_0x87a3('0xc')]);router[_0x87a3('0x7')](_0x87a3('0xd'),auth[_0x87a3('0x8')](),controller[_0x87a3('0xe')]);router[_0x87a3('0x7')](_0x87a3('0xf'),auth[_0x87a3('0x8')](),controller[_0x87a3('0x10')]);router[_0x87a3('0x11')]('/',auth[_0x87a3('0x8')](),controller[_0x87a3('0x12')]);router[_0x87a3('0x13')](_0x87a3('0x14'),auth[_0x87a3('0x8')](),controller['update']);router[_0x87a3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x87a3('0x16')]);module[_0x87a3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 803a87d..2a66d85 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 _0xccd9=['sequelize','STRING'];(function(_0x5d9a85,_0x55221e){var _0x1ef8aa=function(_0x5241be){while(--_0x5241be){_0x5d9a85['push'](_0x5d9a85['shift']());}};_0x1ef8aa(++_0x55221e);}(_0xccd9,0x10e));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9ccd('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ccd('0x1')]},'description':{'type':Sequelize[_0x9ccd('0x1')]}}; \ No newline at end of file +var _0xe3d9=['STRING','sequelize','exports'];(function(_0x483566,_0xb3188e){var _0x3544dc=function(_0x5e393b){while(--_0x5e393b){_0x483566['push'](_0x483566['shift']());}};_0x3544dc(++_0xb3188e);}(_0xe3d9,0x100));var _0x9e3d=function(_0x27ca2a,_0x79c1b9){_0x27ca2a=_0x27ca2a-0x0;var _0x14c2a=_0xe3d9[_0x27ca2a];return _0x14c2a;};'use strict';var Sequelize=require(_0x9e3d('0x0'));module[_0x9e3d('0x1')]={'name':{'type':Sequelize[_0x9e3d('0x2')]},'description':{'type':Sequelize[_0x9e3d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5a45840..5e86846 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 _0xd49c=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','options','includeAll','findAll','catch','params','find','create','body','SugarcrmField','order','pick','filter','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x3ad73e,_0x2769f5){var _0x61f0cb=function(_0x40057a){while(--_0x40057a){_0x3ad73e['push'](_0x3ad73e['shift']());}};_0x61f0cb(++_0x2769f5);}(_0xd49c,0xe9));var _0xcd49=function(_0x36cd01,_0x1c95ae){_0x36cd01=_0x36cd01-0x0;var _0x3c6323=_0xd49c[_0x36cd01];return _0x3c6323;};'use strict';var emlformat=require(_0xcd49('0x0'));var rimraf=require(_0xcd49('0x1'));var zipdir=require(_0xcd49('0x2'));var jsonpatch=require(_0xcd49('0x3'));var rp=require(_0xcd49('0x4'));var moment=require(_0xcd49('0x5'));var BPromise=require(_0xcd49('0x6'));var Mustache=require(_0xcd49('0x7'));var util=require('util');var path=require(_0xcd49('0x8'));var sox=require(_0xcd49('0x9'));var csv=require(_0xcd49('0xa'));var ejs=require(_0xcd49('0xb'));var fs=require('fs');var fs_extra=require(_0xcd49('0xc'));var _=require('lodash');var squel=require(_0xcd49('0xd'));var crypto=require(_0xcd49('0xe'));var jsforce=require(_0xcd49('0xf'));var deskjs=require(_0xcd49('0x10'));var toCsv=require(_0xcd49('0xa'));var querystring=require(_0xcd49('0x11'));var Papa=require(_0xcd49('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd49('0x13'));var as=require(_0xcd49('0x14'));var hardwareService=require(_0xcd49('0x15'));var logger=require(_0xcd49('0x16'))(_0xcd49('0x17'));var utils=require(_0xcd49('0x18'));var config=require(_0xcd49('0x19'));var licenseUtil=require(_0xcd49('0x1a'));var db=require(_0xcd49('0x1b'))['db'];function respondWithStatusCode(_0x443f8e,_0x418e4b){_0x418e4b=_0x418e4b||0xcc;return function(_0x42f5ba){if(_0x42f5ba){return _0x443f8e[_0xcd49('0x1c')](_0x418e4b);}return _0x443f8e[_0xcd49('0x1d')](_0x418e4b)[_0xcd49('0x1e')]();};}function respondWithResult(_0x5bd7cd,_0x16efe5){_0x16efe5=_0x16efe5||0xc8;return function(_0x249716){if(_0x249716){return _0x5bd7cd['status'](_0x16efe5)[_0xcd49('0x1f')](_0x249716);}};}function respondWithFilteredResult(_0x1a0c8f,_0x3b2c4a){return function(_0xf5f343){if(_0xf5f343){var _0x2a4f8a=typeof _0x3b2c4a['offset']===_0xcd49('0x20')&&typeof _0x3b2c4a['limit']===_0xcd49('0x20');var _0x3394cd=_0xf5f343[_0xcd49('0x21')];var _0x2dca11=_0x2a4f8a?0x0:_0x3b2c4a['offset'];var _0x46c7c3=_0x2a4f8a?_0xf5f343[_0xcd49('0x21')]:_0x3b2c4a[_0xcd49('0x22')]+_0x3b2c4a[_0xcd49('0x23')];var _0x39fbe6;if(_0x46c7c3>=_0x3394cd){_0x46c7c3=_0x3394cd;_0x39fbe6=0xc8;}else{_0x39fbe6=0xce;}_0x1a0c8f[_0xcd49('0x1d')](_0x39fbe6);return _0x1a0c8f['set'](_0xcd49('0x24'),_0x2dca11+'-'+_0x46c7c3+'/'+_0x3394cd)['json'](_0xf5f343);}return null;};}function patchUpdates(_0x3674bb){return function(_0x345c03){try{jsonpatch[_0xcd49('0x25')](_0x345c03,_0x3674bb,!![]);}catch(_0x64be06){return BPromise[_0xcd49('0x26')](_0x64be06);}return _0x345c03['save']();};}function saveUpdates(_0x51e7ad,_0x3ff4fd){return function(_0x2b6332){if(_0x2b6332){return _0x2b6332[_0xcd49('0x27')](_0x51e7ad)['then'](function(_0x229e70){return _0x229e70;});}return null;};}function removeEntity(_0xf09fc2,_0x5e7b65){return function(_0x472201){if(_0x472201){return _0x472201[_0xcd49('0x28')]()[_0xcd49('0x29')](function(){_0xf09fc2[_0xcd49('0x1d')](0xcc)[_0xcd49('0x1e')]();});}};}function handleEntityNotFound(_0xe0a445,_0x109ae2){return function(_0x1baf44){if(!_0x1baf44){_0xe0a445[_0xcd49('0x1c')](0x194);}return _0x1baf44;};}function handleError(_0xcc4977,_0x32b28b){_0x32b28b=_0x32b28b||0x1f4;return function(_0x431768){logger[_0xcd49('0x2a')](_0x431768[_0xcd49('0x2b')]);if(_0x431768[_0xcd49('0x2c')]){delete _0x431768[_0xcd49('0x2c')];}_0xcc4977[_0xcd49('0x1d')](_0x32b28b)[_0xcd49('0x2d')](_0x431768);};}exports[_0xcd49('0x2e')]=function(_0x339127,_0x2ba0b7){var _0x56a679={},_0x1f0f45={},_0x1a59dd={'count':0x0,'rows':[]};var _0x33c889=_['map'](db[_0xcd49('0x2f')][_0xcd49('0x30')],function(_0x1f5f59){return{'name':_0x1f5f59['fieldName'],'type':_0x1f5f59['type'][_0xcd49('0x31')]};});_0x1f0f45['model']=_[_0xcd49('0x32')](_0x33c889,_0xcd49('0x2c'));_0x1f0f45[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x339127[_0xcd49('0x33')]);_0x1f0f45[_0xcd49('0x35')]=_['intersection'](_0x1f0f45[_0xcd49('0x36')],_0x1f0f45['query']);_0x56a679['attributes']=_[_0xcd49('0x37')](_0x1f0f45['model'],qs[_0xcd49('0x38')](_0x339127[_0xcd49('0x33')][_0xcd49('0x38')]));_0x56a679[_0xcd49('0x39')]=_0x56a679[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x56a679['attributes']:_0x1f0f45[_0xcd49('0x36')];if(!_0x339127[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x56a679[_0xcd49('0x23')]=qs[_0xcd49('0x23')](_0x339127[_0xcd49('0x33')]['limit']);_0x56a679[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x339127[_0xcd49('0x33')][_0xcd49('0x22')]);}_0x56a679['order']=qs['sort'](_0x339127['query'][_0xcd49('0x3d')]);_0x56a679[_0xcd49('0x3e')]=qs['filters'](_['pick'](_0x339127[_0xcd49('0x33')],_0x1f0f45[_0xcd49('0x35')]),_0x33c889);if(_0x339127[_0xcd49('0x33')]['filter']){_0x56a679[_0xcd49('0x3e')]=_[_0xcd49('0x3f')](_0x56a679['where'],{'$or':_[_0xcd49('0x32')](_0x33c889,function(_0x4505b9){if(_0x4505b9[_0xcd49('0x40')]!=='VIRTUAL'){var _0x2b927b={};_0x2b927b[_0x4505b9[_0xcd49('0x2c')]]={'$like':'%'+_0x339127[_0xcd49('0x33')]['filter']+'%'};return _0x2b927b;}})});}_0x56a679=_[_0xcd49('0x3f')]({},_0x56a679,_0x339127[_0xcd49('0x41')]);var _0x482299={'where':_0x56a679[_0xcd49('0x3e')]};return db[_0xcd49('0x2f')]['count'](_0x482299)[_0xcd49('0x29')](function(_0x1220c2){_0x1a59dd[_0xcd49('0x21')]=_0x1220c2;if(_0x339127[_0xcd49('0x33')][_0xcd49('0x42')]){_0x56a679['include']=[{'all':!![]}];}return db[_0xcd49('0x2f')][_0xcd49('0x43')](_0x56a679);})[_0xcd49('0x29')](function(_0x4fb76f){_0x1a59dd['rows']=_0x4fb76f;return _0x1a59dd;})[_0xcd49('0x29')](respondWithFilteredResult(_0x2ba0b7,_0x56a679))[_0xcd49('0x44')](handleError(_0x2ba0b7,null));};exports['show']=function(_0x577d19,_0xb1e4c1){var _0x2d20d9={'raw':![],'where':{'id':_0x577d19[_0xcd49('0x45')]['id']}},_0x3069b2={};_0x3069b2[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x2f')][_0xcd49('0x30')]);_0x3069b2['query']=_['keys'](_0x577d19[_0xcd49('0x33')]);_0x3069b2['filters']=_['intersection'](_0x3069b2[_0xcd49('0x36')],_0x3069b2[_0xcd49('0x33')]);_0x2d20d9[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x3069b2[_0xcd49('0x36')],qs[_0xcd49('0x38')](_0x577d19[_0xcd49('0x33')][_0xcd49('0x38')]));_0x2d20d9['attributes']=_0x2d20d9[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x2d20d9[_0xcd49('0x39')]:_0x3069b2['model'];if(_0x577d19[_0xcd49('0x33')][_0xcd49('0x42')]){_0x2d20d9['include']=[{'all':!![]}];}_0x2d20d9=_['merge']({},_0x2d20d9,_0x577d19[_0xcd49('0x41')]);return db['SugarcrmConfiguration'][_0xcd49('0x46')](_0x2d20d9)['then'](handleEntityNotFound(_0xb1e4c1,null))[_0xcd49('0x29')](respondWithResult(_0xb1e4c1,null))['catch'](handleError(_0xb1e4c1,null));};exports[_0xcd49('0x47')]=function(_0x479646,_0x213e72){return db['SugarcrmConfiguration'][_0xcd49('0x47')](_0x479646[_0xcd49('0x48')],{})['then'](respondWithResult(_0x213e72,0xc9))[_0xcd49('0x44')](handleError(_0x213e72,null));};exports[_0xcd49('0x27')]=function(_0xaeca1,_0x3a3208){if(_0xaeca1[_0xcd49('0x48')]['id']){delete _0xaeca1[_0xcd49('0x48')]['id'];}return db[_0xcd49('0x2f')][_0xcd49('0x46')]({'where':{'id':_0xaeca1[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x3a3208,null))['then'](saveUpdates(_0xaeca1[_0xcd49('0x48')],null))[_0xcd49('0x29')](respondWithResult(_0x3a3208,null))[_0xcd49('0x44')](handleError(_0x3a3208,null));};exports[_0xcd49('0x28')]=function(_0x4fb163,_0x4f82cf){return db[_0xcd49('0x2f')]['find']({'where':{'id':_0x4fb163['params']['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x4f82cf,null))['then'](removeEntity(_0x4f82cf,null))['catch'](handleError(_0x4f82cf,null));};exports['getFields']=function(_0xdae541,_0x13a5fb,_0x24a59c){var _0x5ede8e={};var _0x35b2ff={};var _0x142d70;var _0x3e2e8a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xdae541[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x13a5fb,null))['then'](function(_0x79efe4){if(_0x79efe4){_0x142d70=_0x79efe4;_0x35b2ff[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x49')]['rawAttributes']);_0x35b2ff['query']=_[_0xcd49('0x34')](_0xdae541[_0xcd49('0x33')]);_0x35b2ff[_0xcd49('0x35')]=_['intersection'](_0x35b2ff[_0xcd49('0x36')],_0x35b2ff['query']);_0x5ede8e[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x35b2ff[_0xcd49('0x36')],qs['fields'](_0xdae541[_0xcd49('0x33')][_0xcd49('0x38')]));_0x5ede8e[_0xcd49('0x39')]=_0x5ede8e[_0xcd49('0x39')]['length']?_0x5ede8e[_0xcd49('0x39')]:_0x35b2ff[_0xcd49('0x36')];_0x5ede8e[_0xcd49('0x4a')]=qs['sort'](_0xdae541['query'][_0xcd49('0x3d')]);_0x5ede8e[_0xcd49('0x3e')]=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0xdae541['query'],_0x35b2ff[_0xcd49('0x35')]));if(_0xdae541[_0xcd49('0x33')]['filter']){_0x5ede8e[_0xcd49('0x3e')]=_['merge'](_0x5ede8e[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x5ede8e[_0xcd49('0x39')],function(_0x59254f){var _0x544e81={};_0x544e81[_0x59254f]={'$like':'%'+_0xdae541['query'][_0xcd49('0x4c')]+'%'};return _0x544e81;})});}_0x5ede8e=_[_0xcd49('0x3f')]({},_0x5ede8e,_0xdae541['options']);return _0x142d70[_0xcd49('0x4d')](_0x5ede8e);}})[_0xcd49('0x29')](function(_0x4f958f){if(_0x4f958f){_0x3e2e8a=_0x4f958f[_0xcd49('0x3a')];if(!_0xdae541[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x5ede8e['limit']=qs[_0xcd49('0x23')](_0xdae541[_0xcd49('0x33')]['limit']);_0x5ede8e[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0xdae541[_0xcd49('0x33')]['offset']);}return _0x142d70['getFields'](_0x5ede8e);}})[_0xcd49('0x29')](function(_0x430a2e){if(_0x430a2e){return _0x430a2e?{'count':_0x3e2e8a,'rows':_0x430a2e}:null;}})['then'](respondWithResult(_0x13a5fb,null))[_0xcd49('0x44')](handleError(_0x13a5fb,null));};exports[_0xcd49('0x4e')]=function(_0x25d68f,_0x1b0ac3,_0x3fa1fc){var _0x1194d6={};var _0x1ef31e={};var _0x43fb94;var _0x33616f;return db[_0xcd49('0x2f')][_0xcd49('0x4f')]({'where':{'id':_0x25d68f[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x1b0ac3,null))[_0xcd49('0x29')](function(_0xfd5754){if(_0xfd5754){_0x43fb94=_0xfd5754;_0x1ef31e[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x49')][_0xcd49('0x30')]);_0x1ef31e[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x25d68f[_0xcd49('0x33')]);_0x1ef31e[_0xcd49('0x35')]=_['intersection'](_0x1ef31e['model'],_0x1ef31e[_0xcd49('0x33')]);_0x1194d6[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x1ef31e[_0xcd49('0x36')],qs[_0xcd49('0x38')](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x38')]));_0x1194d6['attributes']=_0x1194d6['attributes'][_0xcd49('0x3a')]?_0x1194d6[_0xcd49('0x39')]:_0x1ef31e[_0xcd49('0x36')];_0x1194d6[_0xcd49('0x4a')]=qs['sort'](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x3d')]);_0x1194d6[_0xcd49('0x3e')]=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0x25d68f['query'],_0x1ef31e[_0xcd49('0x35')]));if(_0x25d68f[_0xcd49('0x33')][_0xcd49('0x4c')]){_0x1194d6[_0xcd49('0x3e')]=_[_0xcd49('0x3f')](_0x1194d6[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x1194d6['attributes'],function(_0xbec1ff){var _0x3fd165={};_0x3fd165[_0xbec1ff]={'$like':'%'+_0x25d68f[_0xcd49('0x33')][_0xcd49('0x4c')]+'%'};return _0x3fd165;})});}_0x1194d6=_[_0xcd49('0x3f')]({},_0x1194d6,_0x25d68f[_0xcd49('0x41')]);return _0x43fb94[_0xcd49('0x4e')](_0x1194d6);}})['then'](function(_0x42832c){if(_0x42832c){_0x33616f=_0x42832c[_0xcd49('0x3a')];if(!_0x25d68f[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x1194d6[_0xcd49('0x23')]=qs[_0xcd49('0x23')](_0x25d68f[_0xcd49('0x33')]['limit']);_0x1194d6[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x22')]);}return _0x43fb94[_0xcd49('0x4e')](_0x1194d6);}})[_0xcd49('0x29')](function(_0x541bce){if(_0x541bce){return _0x541bce?{'count':_0x33616f,'rows':_0x541bce}:null;}})[_0xcd49('0x29')](respondWithResult(_0x1b0ac3,null))[_0xcd49('0x44')](handleError(_0x1b0ac3,null));};exports[_0xcd49('0x50')]=function(_0x99e76d,_0x52c060,_0x5765ba){var _0x54d07a={};var _0x13a6e2={};var _0x1b6146;var _0x230f9;return db['SugarcrmConfiguration'][_0xcd49('0x4f')]({'where':{'id':_0x99e76d['params']['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x52c060,null))[_0xcd49('0x29')](function(_0xa51bdb){if(_0xa51bdb){_0x1b6146=_0xa51bdb;_0x13a6e2[_0xcd49('0x36')]=_[_0xcd49('0x34')](db[_0xcd49('0x49')][_0xcd49('0x30')]);_0x13a6e2[_0xcd49('0x33')]=_['keys'](_0x99e76d[_0xcd49('0x33')]);_0x13a6e2[_0xcd49('0x35')]=_['intersection'](_0x13a6e2[_0xcd49('0x36')],_0x13a6e2[_0xcd49('0x33')]);_0x54d07a[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x13a6e2[_0xcd49('0x36')],qs['fields'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x38')]));_0x54d07a[_0xcd49('0x39')]=_0x54d07a[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x54d07a[_0xcd49('0x39')]:_0x13a6e2[_0xcd49('0x36')];_0x54d07a[_0xcd49('0x4a')]=qs['sort'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x3d')]);_0x54d07a['where']=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0x99e76d[_0xcd49('0x33')],_0x13a6e2[_0xcd49('0x35')]));if(_0x99e76d[_0xcd49('0x33')][_0xcd49('0x4c')]){_0x54d07a[_0xcd49('0x3e')]=_['merge'](_0x54d07a[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x54d07a[_0xcd49('0x39')],function(_0x4d4c7d){var _0x27933e={};_0x27933e[_0x4d4c7d]={'$like':'%'+_0x99e76d[_0xcd49('0x33')]['filter']+'%'};return _0x27933e;})});}_0x54d07a=_[_0xcd49('0x3f')]({},_0x54d07a,_0x99e76d[_0xcd49('0x41')]);return _0x1b6146[_0xcd49('0x50')](_0x54d07a);}})[_0xcd49('0x29')](function(_0x246c25){if(_0x246c25){_0x230f9=_0x246c25[_0xcd49('0x3a')];if(!_0x99e76d[_0xcd49('0x33')]['hasOwnProperty'](_0xcd49('0x3c'))){_0x54d07a[_0xcd49('0x23')]=qs['limit'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x23')]);_0x54d07a[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x22')]);}return _0x1b6146[_0xcd49('0x50')](_0x54d07a);}})[_0xcd49('0x29')](function(_0x5084d7){if(_0x5084d7){return _0x5084d7?{'count':_0x230f9,'rows':_0x5084d7}:null;}})['then'](respondWithResult(_0x52c060,null))['catch'](handleError(_0x52c060,null));}; \ No newline at end of file +var _0x4a65=['filters','intersection','attributes','fields','length','order','sort','pick','where','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows','catch','show','include','find','create','params','getFields','findOne','SugarcrmField','filter','merge','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x57ecae,_0x59e94e){var _0x1359bc=function(_0x51228d){while(--_0x51228d){_0x57ecae['push'](_0x57ecae['shift']());}};_0x1359bc(++_0x59e94e);}(_0x4a65,0x152));var _0x54a6=function(_0x3e79ab,_0xe367f){_0x3e79ab=_0x3e79ab-0x0;var _0x2cd9e7=_0x4a65[_0x3e79ab];return _0x2cd9e7;};'use strict';var emlformat=require(_0x54a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x54a6('0x1'));var rp=require(_0x54a6('0x2'));var moment=require(_0x54a6('0x3'));var BPromise=require(_0x54a6('0x4'));var Mustache=require(_0x54a6('0x5'));var util=require(_0x54a6('0x6'));var path=require(_0x54a6('0x7'));var sox=require('sox');var csv=require(_0x54a6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54a6('0x9'));var _=require(_0x54a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x54a6('0xb'));var deskjs=require(_0x54a6('0xc'));var toCsv=require(_0x54a6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x54a6('0xd'));var qs=require(_0x54a6('0xe'));var as=require(_0x54a6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a6('0x10'))(_0x54a6('0x11'));var utils=require('../../config/utils');var config=require(_0x54a6('0x12'));var licenseUtil=require(_0x54a6('0x13'));var db=require(_0x54a6('0x14'))['db'];function respondWithStatusCode(_0x26ab17,_0x2f548d){_0x2f548d=_0x2f548d||0xcc;return function(_0x1fe557){if(_0x1fe557){return _0x26ab17[_0x54a6('0x15')](_0x2f548d);}return _0x26ab17[_0x54a6('0x16')](_0x2f548d)[_0x54a6('0x17')]();};}function respondWithResult(_0x379270,_0x2c797f){_0x2c797f=_0x2c797f||0xc8;return function(_0x3eaf58){if(_0x3eaf58){return _0x379270[_0x54a6('0x16')](_0x2c797f)[_0x54a6('0x18')](_0x3eaf58);}};}function respondWithFilteredResult(_0x4e0527,_0x8e2afc){return function(_0x27a09e){if(_0x27a09e){var _0x3b765e=typeof _0x8e2afc[_0x54a6('0x19')]===_0x54a6('0x1a')&&typeof _0x8e2afc[_0x54a6('0x1b')]===_0x54a6('0x1a');var _0xf2a2cc=_0x27a09e[_0x54a6('0x1c')];var _0x39d6b5=_0x3b765e?0x0:_0x8e2afc[_0x54a6('0x19')];var _0x22ce34=_0x3b765e?_0x27a09e['count']:_0x8e2afc[_0x54a6('0x19')]+_0x8e2afc[_0x54a6('0x1b')];var _0x423e8c;if(_0x22ce34>=_0xf2a2cc){_0x22ce34=_0xf2a2cc;_0x423e8c=0xc8;}else{_0x423e8c=0xce;}_0x4e0527['status'](_0x423e8c);return _0x4e0527[_0x54a6('0x1d')](_0x54a6('0x1e'),_0x39d6b5+'-'+_0x22ce34+'/'+_0xf2a2cc)[_0x54a6('0x18')](_0x27a09e);}return null;};}function patchUpdates(_0x2d1194){return function(_0x4759e6){try{jsonpatch['apply'](_0x4759e6,_0x2d1194,!![]);}catch(_0x364799){return BPromise[_0x54a6('0x1f')](_0x364799);}return _0x4759e6['save']();};}function saveUpdates(_0x54fe36,_0x2b2ea0){return function(_0x17b995){if(_0x17b995){return _0x17b995[_0x54a6('0x20')](_0x54fe36)['then'](function(_0x496246){return _0x496246;});}return null;};}function removeEntity(_0x380604,_0xf4240d){return function(_0x45d676){if(_0x45d676){return _0x45d676[_0x54a6('0x21')]()[_0x54a6('0x22')](function(){_0x380604[_0x54a6('0x16')](0xcc)[_0x54a6('0x17')]();});}};}function handleEntityNotFound(_0x3ee030,_0xeef57c){return function(_0xb4f140){if(!_0xb4f140){_0x3ee030['sendStatus'](0x194);}return _0xb4f140;};}function handleError(_0x355e13,_0x57694a){_0x57694a=_0x57694a||0x1f4;return function(_0x28af34){logger[_0x54a6('0x23')](_0x28af34['stack']);if(_0x28af34[_0x54a6('0x24')]){delete _0x28af34[_0x54a6('0x24')];}_0x355e13[_0x54a6('0x16')](_0x57694a)[_0x54a6('0x25')](_0x28af34);};}exports[_0x54a6('0x26')]=function(_0x47e2f8,_0x1182f3){var _0x3e920a={},_0x50a1c1={},_0x3b8e8a={'count':0x0,'rows':[]};var _0x2ced86=_[_0x54a6('0x27')](db['SugarcrmConfiguration'][_0x54a6('0x28')],function(_0x477da9){return{'name':_0x477da9[_0x54a6('0x29')],'type':_0x477da9[_0x54a6('0x2a')][_0x54a6('0x2b')]};});_0x50a1c1[_0x54a6('0x2c')]=_[_0x54a6('0x27')](_0x2ced86,_0x54a6('0x24'));_0x50a1c1[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x47e2f8[_0x54a6('0x2d')]);_0x50a1c1[_0x54a6('0x2f')]=_[_0x54a6('0x30')](_0x50a1c1[_0x54a6('0x2c')],_0x50a1c1[_0x54a6('0x2d')]);_0x3e920a[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x50a1c1[_0x54a6('0x2c')],qs['fields'](_0x47e2f8[_0x54a6('0x2d')][_0x54a6('0x32')]));_0x3e920a[_0x54a6('0x31')]=_0x3e920a[_0x54a6('0x31')][_0x54a6('0x33')]?_0x3e920a[_0x54a6('0x31')]:_0x50a1c1[_0x54a6('0x2c')];if(!_0x47e2f8[_0x54a6('0x2d')]['hasOwnProperty']('nolimit')){_0x3e920a[_0x54a6('0x1b')]=qs['limit'](_0x47e2f8[_0x54a6('0x2d')][_0x54a6('0x1b')]);_0x3e920a[_0x54a6('0x19')]=qs[_0x54a6('0x19')](_0x47e2f8[_0x54a6('0x2d')][_0x54a6('0x19')]);}_0x3e920a[_0x54a6('0x34')]=qs['sort'](_0x47e2f8[_0x54a6('0x2d')][_0x54a6('0x35')]);_0x3e920a['where']=qs[_0x54a6('0x2f')](_[_0x54a6('0x36')](_0x47e2f8[_0x54a6('0x2d')],_0x50a1c1[_0x54a6('0x2f')]),_0x2ced86);if(_0x47e2f8[_0x54a6('0x2d')]['filter']){_0x3e920a[_0x54a6('0x37')]=_['merge'](_0x3e920a[_0x54a6('0x37')],{'$or':_[_0x54a6('0x27')](_0x2ced86,function(_0x4a18f6){if(_0x4a18f6[_0x54a6('0x2a')]!==_0x54a6('0x38')){var _0x216b87={};_0x216b87[_0x4a18f6[_0x54a6('0x24')]]={'$like':'%'+_0x47e2f8[_0x54a6('0x2d')]['filter']+'%'};return _0x216b87;}})});}_0x3e920a=_['merge']({},_0x3e920a,_0x47e2f8[_0x54a6('0x39')]);var _0x224885={'where':_0x3e920a[_0x54a6('0x37')]};return db[_0x54a6('0x3a')][_0x54a6('0x1c')](_0x224885)[_0x54a6('0x22')](function(_0x2282a2){_0x3b8e8a[_0x54a6('0x1c')]=_0x2282a2;if(_0x47e2f8[_0x54a6('0x2d')][_0x54a6('0x3b')]){_0x3e920a['include']=[{'all':!![]}];}return db[_0x54a6('0x3a')][_0x54a6('0x3c')](_0x3e920a);})[_0x54a6('0x22')](function(_0x4c5231){_0x3b8e8a[_0x54a6('0x3d')]=_0x4c5231;return _0x3b8e8a;})[_0x54a6('0x22')](respondWithFilteredResult(_0x1182f3,_0x3e920a))[_0x54a6('0x3e')](handleError(_0x1182f3,null));};exports[_0x54a6('0x3f')]=function(_0x318f3f,_0x1a2320){var _0x595ddf={'raw':![],'where':{'id':_0x318f3f['params']['id']}},_0x44e955={};_0x44e955['model']=_[_0x54a6('0x2e')](db['SugarcrmConfiguration'][_0x54a6('0x28')]);_0x44e955['query']=_['keys'](_0x318f3f[_0x54a6('0x2d')]);_0x44e955[_0x54a6('0x2f')]=_['intersection'](_0x44e955['model'],_0x44e955[_0x54a6('0x2d')]);_0x595ddf[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x44e955[_0x54a6('0x2c')],qs['fields'](_0x318f3f[_0x54a6('0x2d')]['fields']));_0x595ddf['attributes']=_0x595ddf['attributes']['length']?_0x595ddf[_0x54a6('0x31')]:_0x44e955[_0x54a6('0x2c')];if(_0x318f3f[_0x54a6('0x2d')][_0x54a6('0x3b')]){_0x595ddf[_0x54a6('0x40')]=[{'all':!![]}];}_0x595ddf=_['merge']({},_0x595ddf,_0x318f3f[_0x54a6('0x39')]);return db[_0x54a6('0x3a')][_0x54a6('0x41')](_0x595ddf)[_0x54a6('0x22')](handleEntityNotFound(_0x1a2320,null))[_0x54a6('0x22')](respondWithResult(_0x1a2320,null))[_0x54a6('0x3e')](handleError(_0x1a2320,null));};exports['create']=function(_0x79a95c,_0x31faba){return db['SugarcrmConfiguration'][_0x54a6('0x42')](_0x79a95c['body'],{})['then'](respondWithResult(_0x31faba,0xc9))[_0x54a6('0x3e')](handleError(_0x31faba,null));};exports[_0x54a6('0x20')]=function(_0x22283a,_0x4d586e){if(_0x22283a['body']['id']){delete _0x22283a['body']['id'];}return db['SugarcrmConfiguration'][_0x54a6('0x41')]({'where':{'id':_0x22283a['params']['id']}})[_0x54a6('0x22')](handleEntityNotFound(_0x4d586e,null))['then'](saveUpdates(_0x22283a['body'],null))[_0x54a6('0x22')](respondWithResult(_0x4d586e,null))[_0x54a6('0x3e')](handleError(_0x4d586e,null));};exports['destroy']=function(_0x4a96a3,_0x290eae){return db[_0x54a6('0x3a')][_0x54a6('0x41')]({'where':{'id':_0x4a96a3[_0x54a6('0x43')]['id']}})[_0x54a6('0x22')](handleEntityNotFound(_0x290eae,null))[_0x54a6('0x22')](removeEntity(_0x290eae,null))[_0x54a6('0x3e')](handleError(_0x290eae,null));};exports[_0x54a6('0x44')]=function(_0x595368,_0x5deba5,_0x2ce7b5){var _0x4cf24={};var _0x5ae099={};var _0x1b754a;var _0x228da6;return db[_0x54a6('0x3a')][_0x54a6('0x45')]({'where':{'id':_0x595368[_0x54a6('0x43')]['id']}})[_0x54a6('0x22')](handleEntityNotFound(_0x5deba5,null))[_0x54a6('0x22')](function(_0x1589ce){if(_0x1589ce){_0x1b754a=_0x1589ce;_0x5ae099[_0x54a6('0x2c')]=_[_0x54a6('0x2e')](db[_0x54a6('0x46')][_0x54a6('0x28')]);_0x5ae099[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x595368[_0x54a6('0x2d')]);_0x5ae099[_0x54a6('0x2f')]=_[_0x54a6('0x30')](_0x5ae099[_0x54a6('0x2c')],_0x5ae099[_0x54a6('0x2d')]);_0x4cf24[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x5ae099[_0x54a6('0x2c')],qs[_0x54a6('0x32')](_0x595368[_0x54a6('0x2d')][_0x54a6('0x32')]));_0x4cf24[_0x54a6('0x31')]=_0x4cf24[_0x54a6('0x31')][_0x54a6('0x33')]?_0x4cf24[_0x54a6('0x31')]:_0x5ae099[_0x54a6('0x2c')];_0x4cf24[_0x54a6('0x34')]=qs[_0x54a6('0x35')](_0x595368[_0x54a6('0x2d')][_0x54a6('0x35')]);_0x4cf24['where']=qs[_0x54a6('0x2f')](_[_0x54a6('0x36')](_0x595368[_0x54a6('0x2d')],_0x5ae099['filters']));if(_0x595368[_0x54a6('0x2d')][_0x54a6('0x47')]){_0x4cf24[_0x54a6('0x37')]=_[_0x54a6('0x48')](_0x4cf24[_0x54a6('0x37')],{'$or':_[_0x54a6('0x27')](_0x4cf24['attributes'],function(_0x1ad9f0){var _0x254871={};_0x254871[_0x1ad9f0]={'$like':'%'+_0x595368['query'][_0x54a6('0x47')]+'%'};return _0x254871;})});}_0x4cf24=_[_0x54a6('0x48')]({},_0x4cf24,_0x595368['options']);return _0x1b754a[_0x54a6('0x44')](_0x4cf24);}})['then'](function(_0x5ae429){if(_0x5ae429){_0x228da6=_0x5ae429[_0x54a6('0x33')];if(!_0x595368['query'][_0x54a6('0x49')](_0x54a6('0x4a'))){_0x4cf24[_0x54a6('0x1b')]=qs[_0x54a6('0x1b')](_0x595368[_0x54a6('0x2d')][_0x54a6('0x1b')]);_0x4cf24[_0x54a6('0x19')]=qs[_0x54a6('0x19')](_0x595368['query']['offset']);}return _0x1b754a['getFields'](_0x4cf24);}})[_0x54a6('0x22')](function(_0x379f71){if(_0x379f71){return _0x379f71?{'count':_0x228da6,'rows':_0x379f71}:null;}})[_0x54a6('0x22')](respondWithResult(_0x5deba5,null))[_0x54a6('0x3e')](handleError(_0x5deba5,null));};exports[_0x54a6('0x4b')]=function(_0x557037,_0x1e0a1e,_0x2774fb){var _0x523e87={};var _0x19931d={};var _0x236a96;var _0x591eae;return db[_0x54a6('0x3a')]['findOne']({'where':{'id':_0x557037[_0x54a6('0x43')]['id']}})[_0x54a6('0x22')](handleEntityNotFound(_0x1e0a1e,null))['then'](function(_0x409e9b){if(_0x409e9b){_0x236a96=_0x409e9b;_0x19931d[_0x54a6('0x2c')]=_[_0x54a6('0x2e')](db['SugarcrmField'][_0x54a6('0x28')]);_0x19931d[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x557037[_0x54a6('0x2d')]);_0x19931d['filters']=_[_0x54a6('0x30')](_0x19931d[_0x54a6('0x2c')],_0x19931d[_0x54a6('0x2d')]);_0x523e87[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x19931d[_0x54a6('0x2c')],qs[_0x54a6('0x32')](_0x557037[_0x54a6('0x2d')][_0x54a6('0x32')]));_0x523e87[_0x54a6('0x31')]=_0x523e87[_0x54a6('0x31')][_0x54a6('0x33')]?_0x523e87[_0x54a6('0x31')]:_0x19931d[_0x54a6('0x2c')];_0x523e87['order']=qs['sort'](_0x557037['query'][_0x54a6('0x35')]);_0x523e87[_0x54a6('0x37')]=qs['filters'](_[_0x54a6('0x36')](_0x557037[_0x54a6('0x2d')],_0x19931d['filters']));if(_0x557037[_0x54a6('0x2d')][_0x54a6('0x47')]){_0x523e87[_0x54a6('0x37')]=_[_0x54a6('0x48')](_0x523e87[_0x54a6('0x37')],{'$or':_[_0x54a6('0x27')](_0x523e87[_0x54a6('0x31')],function(_0x2f88b3){var _0x1f1b04={};_0x1f1b04[_0x2f88b3]={'$like':'%'+_0x557037[_0x54a6('0x2d')][_0x54a6('0x47')]+'%'};return _0x1f1b04;})});}_0x523e87=_[_0x54a6('0x48')]({},_0x523e87,_0x557037[_0x54a6('0x39')]);return _0x236a96[_0x54a6('0x4b')](_0x523e87);}})[_0x54a6('0x22')](function(_0xf29b6a){if(_0xf29b6a){_0x591eae=_0xf29b6a['length'];if(!_0x557037[_0x54a6('0x2d')]['hasOwnProperty']('nolimit')){_0x523e87[_0x54a6('0x1b')]=qs['limit'](_0x557037['query'][_0x54a6('0x1b')]);_0x523e87['offset']=qs[_0x54a6('0x19')](_0x557037[_0x54a6('0x2d')]['offset']);}return _0x236a96[_0x54a6('0x4b')](_0x523e87);}})[_0x54a6('0x22')](function(_0x99f37a){if(_0x99f37a){return _0x99f37a?{'count':_0x591eae,'rows':_0x99f37a}:null;}})[_0x54a6('0x22')](respondWithResult(_0x1e0a1e,null))['catch'](handleError(_0x1e0a1e,null));};exports[_0x54a6('0x4c')]=function(_0x378079,_0x3921b9,_0x42d2f4){var _0x408aed={};var _0x1e7d44={};var _0x416c8d;var _0x2169c8;return db[_0x54a6('0x3a')]['findOne']({'where':{'id':_0x378079[_0x54a6('0x43')]['id']}})[_0x54a6('0x22')](handleEntityNotFound(_0x3921b9,null))[_0x54a6('0x22')](function(_0x1efe41){if(_0x1efe41){_0x416c8d=_0x1efe41;_0x1e7d44[_0x54a6('0x2c')]=_[_0x54a6('0x2e')](db[_0x54a6('0x46')][_0x54a6('0x28')]);_0x1e7d44['query']=_[_0x54a6('0x2e')](_0x378079[_0x54a6('0x2d')]);_0x1e7d44[_0x54a6('0x2f')]=_[_0x54a6('0x30')](_0x1e7d44[_0x54a6('0x2c')],_0x1e7d44[_0x54a6('0x2d')]);_0x408aed[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x1e7d44['model'],qs[_0x54a6('0x32')](_0x378079[_0x54a6('0x2d')][_0x54a6('0x32')]));_0x408aed['attributes']=_0x408aed['attributes'][_0x54a6('0x33')]?_0x408aed[_0x54a6('0x31')]:_0x1e7d44[_0x54a6('0x2c')];_0x408aed['order']=qs[_0x54a6('0x35')](_0x378079['query'][_0x54a6('0x35')]);_0x408aed[_0x54a6('0x37')]=qs[_0x54a6('0x2f')](_['pick'](_0x378079[_0x54a6('0x2d')],_0x1e7d44[_0x54a6('0x2f')]));if(_0x378079[_0x54a6('0x2d')]['filter']){_0x408aed[_0x54a6('0x37')]=_['merge'](_0x408aed[_0x54a6('0x37')],{'$or':_[_0x54a6('0x27')](_0x408aed[_0x54a6('0x31')],function(_0x48b985){var _0x4bdac0={};_0x4bdac0[_0x48b985]={'$like':'%'+_0x378079[_0x54a6('0x2d')][_0x54a6('0x47')]+'%'};return _0x4bdac0;})});}_0x408aed=_[_0x54a6('0x48')]({},_0x408aed,_0x378079[_0x54a6('0x39')]);return _0x416c8d[_0x54a6('0x4c')](_0x408aed);}})['then'](function(_0x4ecb9a){if(_0x4ecb9a){_0x2169c8=_0x4ecb9a[_0x54a6('0x33')];if(!_0x378079[_0x54a6('0x2d')][_0x54a6('0x49')](_0x54a6('0x4a'))){_0x408aed[_0x54a6('0x1b')]=qs[_0x54a6('0x1b')](_0x378079[_0x54a6('0x2d')][_0x54a6('0x1b')]);_0x408aed[_0x54a6('0x19')]=qs[_0x54a6('0x19')](_0x378079[_0x54a6('0x2d')][_0x54a6('0x19')]);}return _0x416c8d[_0x54a6('0x4c')](_0x408aed);}})[_0x54a6('0x22')](function(_0x4f8038){if(_0x4f8038){return _0x4f8038?{'count':_0x2169c8,'rows':_0x4f8038}:null;}})[_0x54a6('0x22')](respondWithResult(_0x3921b9,null))[_0x54a6('0x3e')](handleError(_0x3921b9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index beb84fb..511fee3 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 _0x39fa=['int_sugarcrm_configurations','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x39fa,0x198));var _0xa39f=function(_0x4d8d78,_0x37d78b){_0x4d8d78=_0x4d8d78-0x0;var _0x4c69bb=_0x39fa[_0x4d8d78];return _0x4c69bb;};'use strict';var _=require(_0xa39f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa39f('0x1'));var BPromise=require(_0xa39f('0x2'));var rp=require(_0xa39f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa39f('0x4'));var config=require(_0xa39f('0x5'));var attributes=require(_0xa39f('0x6'));module[_0xa39f('0x7')]=function(_0x10c8b6,_0x169e1f){return _0x10c8b6[_0xa39f('0x8')](_0xa39f('0x9'),attributes,{'tableName':_0xa39f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5525=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x5c489b,_0x460b3e){var _0x51a448=function(_0xc4c8c1){while(--_0xc4c8c1){_0x5c489b['push'](_0x5c489b['shift']());}};_0x51a448(++_0x460b3e);}(_0x5525,0xd4));var _0x5552=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5525[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var logger=require(_0x5552('0x2'))('api');var moment=require(_0x5552('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5552('0x4'));var rimraf=require(_0x5552('0x5'));var config=require(_0x5552('0x6'));var attributes=require(_0x5552('0x7'));module[_0x5552('0x8')]=function(_0x3ca68a,_0x4bb2d4){return _0x3ca68a['define'](_0x5552('0x9'),attributes,{'tableName':_0x5552('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 756e819..99a2243 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 _0x950f=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x19e366,_0x165905){var _0x45d885=function(_0x1c8686){while(--_0x1c8686){_0x19e366['push'](_0x19e366['shift']());}};_0x45d885(++_0x165905);}(_0x950f,0x7f));var _0xf950=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0x950f[_0x1d3046];return _0x3b9b62;};'use strict';var _=require(_0xf950('0x0'));var util=require('util');var moment=require(_0xf950('0x1'));var BPromise=require(_0xf950('0x2'));var rs=require(_0xf950('0x3'));var fs=require('fs');var Redis=require(_0xf950('0x4'));var db=require(_0xf950('0x5'))['db'];var utils=require(_0xf950('0x6'));var logger=require(_0xf950('0x7'))(_0xf950('0x8'));var config=require(_0xf950('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf950('0xa')][_0xf950('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4367,_0x43eff8,_0x4cc25d){return new BPromise(function(_0x5322e7,_0xcc7bc6){return client[_0xf950('0xc')](_0x5d4367,_0x4cc25d)[_0xf950('0xd')](function(_0x1a20eb){logger[_0xf950('0xe')](_0xf950('0xf'),_0x43eff8,_0xf950('0x10'));logger[_0xf950('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x43eff8,_0xf950('0x10'),JSON['stringify'](_0x1a20eb));if(_0x1a20eb[_0xf950('0x12')]){if(_0x1a20eb[_0xf950('0x12')][_0xf950('0x13')]===0x1f4){logger[_0xf950('0x12')](_0xf950('0xf'),_0x43eff8,_0x1a20eb[_0xf950('0x12')][_0xf950('0x14')]);return _0xcc7bc6(_0x1a20eb[_0xf950('0x12')]['message']);}logger[_0xf950('0x12')](_0xf950('0xf'),_0x43eff8,_0x1a20eb[_0xf950('0x12')][_0xf950('0x14')]);return _0x5322e7(_0x1a20eb['error'][_0xf950('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x43eff8,'request\x20sent');_0x5322e7(_0x1a20eb['result'][_0xf950('0x14')]);}})['catch'](function(_0x4557c7){logger[_0xf950('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43eff8,_0x4557c7);_0xcc7bc6(_0x4557c7);});});} \ No newline at end of file +var _0x7c07=['ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c07,0x104));var _0x77c0=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x7c07[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x77c0('0x0'));var util=require('util');var moment=require(_0x77c0('0x1'));var BPromise=require(_0x77c0('0x2'));var rs=require(_0x77c0('0x3'));var fs=require('fs');var Redis=require(_0x77c0('0x4'));var db=require(_0x77c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x77c0('0x6'));var jayson=require(_0x77c0('0x7'));var client=jayson[_0x77c0('0x8')][_0x77c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e62d6,_0x434b18,_0x4a0f1c){return new BPromise(function(_0x32bfd1,_0x1e9e06){return client[_0x77c0('0xa')](_0x3e62d6,_0x4a0f1c)[_0x77c0('0xb')](function(_0x3a8af1){logger[_0x77c0('0xc')](_0x77c0('0xd'),_0x434b18,_0x77c0('0xe'));logger[_0x77c0('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x434b18,_0x77c0('0xe'),JSON[_0x77c0('0x10')](_0x3a8af1));if(_0x3a8af1[_0x77c0('0x11')]){if(_0x3a8af1[_0x77c0('0x11')][_0x77c0('0x12')]===0x1f4){logger[_0x77c0('0x11')](_0x77c0('0xd'),_0x434b18,_0x3a8af1[_0x77c0('0x11')][_0x77c0('0x13')]);return _0x1e9e06(_0x3a8af1['error'][_0x77c0('0x13')]);}logger[_0x77c0('0x11')](_0x77c0('0xd'),_0x434b18,_0x3a8af1[_0x77c0('0x11')][_0x77c0('0x13')]);return _0x32bfd1(_0x3a8af1[_0x77c0('0x11')]['message']);}else{logger['info'](_0x77c0('0xd'),_0x434b18,_0x77c0('0xe'));_0x32bfd1(_0x3a8af1[_0x77c0('0x14')][_0x77c0('0x13')]);}})[_0x77c0('0x15')](function(_0x218a19){logger[_0x77c0('0x11')](_0x77c0('0xd'),_0x434b18,_0x218a19);_0x1e9e06(_0x218a19);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5d44e19..830c700 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 _0x34cb=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0x34cb,0xd0));var _0xb34c=function(_0x3e33f5,_0x8e014b){_0x3e33f5=_0x3e33f5-0x0;var _0x148421=_0x34cb[_0x3e33f5];return _0x148421;};'use strict';var multer=require(_0xb34c('0x0'));var util=require(_0xb34c('0x1'));var path=require('path');var timeout=require(_0xb34c('0x2'));var express=require(_0xb34c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb34c('0x4'));var config=require(_0xb34c('0x5'));var controller=require(_0xb34c('0x6'));router[_0xb34c('0x7')]('/',auth[_0xb34c('0x8')](),controller['index']);router[_0xb34c('0x7')]('/:id',auth[_0xb34c('0x8')](),controller[_0xb34c('0x9')]);router[_0xb34c('0xa')]('/',auth[_0xb34c('0x8')](),controller[_0xb34c('0xb')]);router['put'](_0xb34c('0xc'),auth[_0xb34c('0x8')](),controller['update']);router[_0xb34c('0xd')](_0xb34c('0xc'),auth[_0xb34c('0x8')](),controller[_0xb34c('0xe')]);module[_0xb34c('0xf')]=router; \ No newline at end of file +var _0xf721=['Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xf721,0xea));var _0x1f72=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0xf721[_0x507403];return _0x1327c;};'use strict';var multer=require(_0x1f72('0x0'));var util=require(_0x1f72('0x1'));var path=require(_0x1f72('0x2'));var timeout=require(_0x1f72('0x3'));var express=require('express');var router=express[_0x1f72('0x4')]();var fs_extra=require(_0x1f72('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1f72('0x6'));var controller=require(_0x1f72('0x7'));router[_0x1f72('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x1f72('0x9')](),controller[_0x1f72('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1f72('0xb')](_0x1f72('0xc'),auth[_0x1f72('0x9')](),controller[_0x1f72('0xd')]);router[_0x1f72('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1f72('0xf')]);module[_0x1f72('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d83d52f..79d690e 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 _0xafd3=['string','STRING','variable','BOOLEAN','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xafd3,0xee));var _0x3afd=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0xafd3[_0x12d6c2];return _0x1c9825;};'use strict';var Sequelize=require('sequelize');module[_0x3afd('0x0')]={'type':{'type':Sequelize[_0x3afd('0x1')]('string','variable',_0x3afd('0x2'),_0x3afd('0x3'),_0x3afd('0x4')),'defaultValue':_0x3afd('0x5')},'content':{'type':Sequelize[_0x3afd('0x6')]},'key':{'type':Sequelize[_0x3afd('0x6')]},'keyType':{'type':Sequelize[_0x3afd('0x1')](_0x3afd('0x5'),_0x3afd('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3afd('0x6')]},'nameField':{'type':Sequelize[_0x3afd('0x6')]},'customField':{'type':Sequelize[_0x3afd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xadf3=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x54b82a,_0xa88a0b){var _0x20a5f2=function(_0x30d121){while(--_0x30d121){_0x54b82a['push'](_0x54b82a['shift']());}};_0x20a5f2(++_0xa88a0b);}(_0xadf3,0x1e2));var _0x3adf=function(_0x49a93e,_0x1988d5){_0x49a93e=_0x49a93e-0x0;var _0xfddafe=_0xadf3[_0x49a93e];return _0xfddafe;};'use strict';var Sequelize=require(_0x3adf('0x0'));module[_0x3adf('0x1')]={'type':{'type':Sequelize[_0x3adf('0x2')](_0x3adf('0x3'),_0x3adf('0x4'),_0x3adf('0x5'),_0x3adf('0x6'),_0x3adf('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3adf('0x8')]},'key':{'type':Sequelize[_0x3adf('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x3adf('0x3'),_0x3adf('0x4'),_0x3adf('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3adf('0x8')]},'customField':{'type':Sequelize[_0x3adf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5222e53..b4ea8b3 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 _0x9f76=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3a1431,_0x341f69){var _0x48a55e=function(_0x584d21){while(--_0x584d21){_0x3a1431['push'](_0x3a1431['shift']());}};_0x48a55e(++_0x341f69);}(_0x9f76,0xcc));var _0x69f7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f76[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f7('0x0'));var zipdir=require(_0x69f7('0x1'));var jsonpatch=require(_0x69f7('0x2'));var rp=require(_0x69f7('0x3'));var moment=require(_0x69f7('0x4'));var BPromise=require(_0x69f7('0x5'));var Mustache=require(_0x69f7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69f7('0x7'));var csv=require(_0x69f7('0x8'));var ejs=require(_0x69f7('0x9'));var fs=require('fs');var fs_extra=require(_0x69f7('0xa'));var _=require(_0x69f7('0xb'));var squel=require('squel');var crypto=require(_0x69f7('0xc'));var jsforce=require(_0x69f7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69f7('0x8'));var querystring=require(_0x69f7('0xe'));var Papa=require(_0x69f7('0xf'));var Redis=require('ioredis');var authService=require(_0x69f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x69f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69f7('0x12'))(_0x69f7('0x13'));var utils=require(_0x69f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x69f7('0x15'));var db=require(_0x69f7('0x16'))['db'];function respondWithStatusCode(_0x2daf0a,_0x4d5c0b){_0x4d5c0b=_0x4d5c0b||0xcc;return function(_0xe1d108){if(_0xe1d108){return _0x2daf0a[_0x69f7('0x17')](_0x4d5c0b);}return _0x2daf0a['status'](_0x4d5c0b)[_0x69f7('0x18')]();};}function respondWithResult(_0x7bf861,_0x2f1178){_0x2f1178=_0x2f1178||0xc8;return function(_0x10c382){if(_0x10c382){return _0x7bf861[_0x69f7('0x19')](_0x2f1178)[_0x69f7('0x1a')](_0x10c382);}};}function respondWithFilteredResult(_0x3c1a0a,_0x4dd3ed){return function(_0x3d2171){if(_0x3d2171){var _0x5acd9b=typeof _0x4dd3ed[_0x69f7('0x1b')]===_0x69f7('0x1c')&&typeof _0x4dd3ed['limit']===_0x69f7('0x1c');var _0x340905=_0x3d2171[_0x69f7('0x1d')];var _0x126d80=_0x5acd9b?0x0:_0x4dd3ed['offset'];var _0x68c0a5=_0x5acd9b?_0x3d2171[_0x69f7('0x1d')]:_0x4dd3ed[_0x69f7('0x1b')]+_0x4dd3ed[_0x69f7('0x1e')];var _0x4b92e7;if(_0x68c0a5>=_0x340905){_0x68c0a5=_0x340905;_0x4b92e7=0xc8;}else{_0x4b92e7=0xce;}_0x3c1a0a['status'](_0x4b92e7);return _0x3c1a0a['set'](_0x69f7('0x1f'),_0x126d80+'-'+_0x68c0a5+'/'+_0x340905)[_0x69f7('0x1a')](_0x3d2171);}return null;};}function patchUpdates(_0x19a194){return function(_0x1a7c10){try{jsonpatch['apply'](_0x1a7c10,_0x19a194,!![]);}catch(_0x43b3c3){return BPromise[_0x69f7('0x20')](_0x43b3c3);}return _0x1a7c10[_0x69f7('0x21')]();};}function saveUpdates(_0x495ea3,_0x57dfe5){return function(_0x4e0991){if(_0x4e0991){return _0x4e0991[_0x69f7('0x22')](_0x495ea3)[_0x69f7('0x23')](function(_0x4b754b){return _0x4b754b;});}return null;};}function removeEntity(_0x2861cb,_0x20d682){return function(_0x33237b){if(_0x33237b){return _0x33237b[_0x69f7('0x24')]()[_0x69f7('0x23')](function(){_0x2861cb[_0x69f7('0x19')](0xcc)[_0x69f7('0x18')]();});}};}function handleEntityNotFound(_0x6cb712,_0x49f58d){return function(_0x58b8d0){if(!_0x58b8d0){_0x6cb712[_0x69f7('0x17')](0x194);}return _0x58b8d0;};}function handleError(_0x5310c4,_0x2645ab){_0x2645ab=_0x2645ab||0x1f4;return function(_0x463b82){logger[_0x69f7('0x25')](_0x463b82[_0x69f7('0x26')]);if(_0x463b82[_0x69f7('0x27')]){delete _0x463b82[_0x69f7('0x27')];}_0x5310c4[_0x69f7('0x19')](_0x2645ab)['send'](_0x463b82);};}exports['index']=function(_0x230705,_0x27b8de){var _0x255a25={},_0x1737e1={},_0x21ffb7={'count':0x0,'rows':[]};var _0x1c6d47=_[_0x69f7('0x28')](db[_0x69f7('0x29')][_0x69f7('0x2a')],function(_0x1b2bc8){return{'name':_0x1b2bc8[_0x69f7('0x2b')],'type':_0x1b2bc8[_0x69f7('0x2c')][_0x69f7('0x2d')]};});_0x1737e1[_0x69f7('0x2e')]=_['map'](_0x1c6d47,_0x69f7('0x27'));_0x1737e1[_0x69f7('0x2f')]=_[_0x69f7('0x30')](_0x230705['query']);_0x1737e1[_0x69f7('0x31')]=_[_0x69f7('0x32')](_0x1737e1[_0x69f7('0x2e')],_0x1737e1[_0x69f7('0x2f')]);_0x255a25[_0x69f7('0x33')]=_['intersection'](_0x1737e1[_0x69f7('0x2e')],qs[_0x69f7('0x34')](_0x230705[_0x69f7('0x2f')][_0x69f7('0x34')]));_0x255a25['attributes']=_0x255a25[_0x69f7('0x33')]['length']?_0x255a25[_0x69f7('0x33')]:_0x1737e1[_0x69f7('0x2e')];if(!_0x230705[_0x69f7('0x2f')][_0x69f7('0x35')](_0x69f7('0x36'))){_0x255a25[_0x69f7('0x1e')]=qs['limit'](_0x230705[_0x69f7('0x2f')][_0x69f7('0x1e')]);_0x255a25[_0x69f7('0x1b')]=qs[_0x69f7('0x1b')](_0x230705['query'][_0x69f7('0x1b')]);}_0x255a25[_0x69f7('0x37')]=qs['sort'](_0x230705[_0x69f7('0x2f')][_0x69f7('0x38')]);_0x255a25[_0x69f7('0x39')]=qs[_0x69f7('0x31')](_[_0x69f7('0x3a')](_0x230705[_0x69f7('0x2f')],_0x1737e1['filters']),_0x1c6d47);if(_0x230705[_0x69f7('0x2f')][_0x69f7('0x3b')]){_0x255a25[_0x69f7('0x39')]=_[_0x69f7('0x3c')](_0x255a25[_0x69f7('0x39')],{'$or':_[_0x69f7('0x28')](_0x1c6d47,function(_0x592e69){if(_0x592e69[_0x69f7('0x2c')]!==_0x69f7('0x3d')){var _0x584752={};_0x584752[_0x592e69['name']]={'$like':'%'+_0x230705[_0x69f7('0x2f')][_0x69f7('0x3b')]+'%'};return _0x584752;}})});}_0x255a25=_['merge']({},_0x255a25,_0x230705['options']);var _0xbbdf2a={'where':_0x255a25['where']};return db[_0x69f7('0x29')][_0x69f7('0x1d')](_0xbbdf2a)['then'](function(_0x3e30f3){_0x21ffb7[_0x69f7('0x1d')]=_0x3e30f3;if(_0x230705[_0x69f7('0x2f')][_0x69f7('0x3e')]){_0x255a25[_0x69f7('0x3f')]=[{'all':!![]}];}return db[_0x69f7('0x29')][_0x69f7('0x40')](_0x255a25);})[_0x69f7('0x23')](function(_0x17dfd3){_0x21ffb7['rows']=_0x17dfd3;return _0x21ffb7;})[_0x69f7('0x23')](respondWithFilteredResult(_0x27b8de,_0x255a25))[_0x69f7('0x41')](handleError(_0x27b8de,null));};exports[_0x69f7('0x42')]=function(_0x38b184,_0x7b60df){var _0x1ccab0={'raw':!![],'where':{'id':_0x38b184[_0x69f7('0x43')]['id']}},_0x4ab039={};_0x4ab039[_0x69f7('0x2e')]=_[_0x69f7('0x30')](db[_0x69f7('0x29')]['rawAttributes']);_0x4ab039[_0x69f7('0x2f')]=_[_0x69f7('0x30')](_0x38b184[_0x69f7('0x2f')]);_0x4ab039[_0x69f7('0x31')]=_[_0x69f7('0x32')](_0x4ab039[_0x69f7('0x2e')],_0x4ab039[_0x69f7('0x2f')]);_0x1ccab0[_0x69f7('0x33')]=_[_0x69f7('0x32')](_0x4ab039[_0x69f7('0x2e')],qs[_0x69f7('0x34')](_0x38b184[_0x69f7('0x2f')][_0x69f7('0x34')]));_0x1ccab0[_0x69f7('0x33')]=_0x1ccab0[_0x69f7('0x33')]['length']?_0x1ccab0['attributes']:_0x4ab039[_0x69f7('0x2e')];if(_0x38b184[_0x69f7('0x2f')][_0x69f7('0x3e')]){_0x1ccab0[_0x69f7('0x3f')]=[{'all':!![]}];}_0x1ccab0=_[_0x69f7('0x3c')]({},_0x1ccab0,_0x38b184[_0x69f7('0x44')]);return db['SugarcrmField'][_0x69f7('0x45')](_0x1ccab0)[_0x69f7('0x23')](handleEntityNotFound(_0x7b60df,null))[_0x69f7('0x23')](respondWithResult(_0x7b60df,null))[_0x69f7('0x41')](handleError(_0x7b60df,null));};exports[_0x69f7('0x46')]=function(_0x3956a8,_0x23636b){return db[_0x69f7('0x29')][_0x69f7('0x46')](_0x3956a8[_0x69f7('0x47')],{})[_0x69f7('0x23')](respondWithResult(_0x23636b,0xc9))[_0x69f7('0x41')](handleError(_0x23636b,null));};exports[_0x69f7('0x22')]=function(_0x509e39,_0x55359e){if(_0x509e39[_0x69f7('0x47')]['id']){delete _0x509e39[_0x69f7('0x47')]['id'];}return db[_0x69f7('0x29')]['find']({'where':{'id':_0x509e39[_0x69f7('0x43')]['id']}})[_0x69f7('0x23')](handleEntityNotFound(_0x55359e,null))[_0x69f7('0x23')](saveUpdates(_0x509e39['body'],null))[_0x69f7('0x23')](respondWithResult(_0x55359e,null))[_0x69f7('0x41')](handleError(_0x55359e,null));};exports[_0x69f7('0x24')]=function(_0x54fb74,_0x250b1a){return db['SugarcrmField'][_0x69f7('0x45')]({'where':{'id':_0x54fb74[_0x69f7('0x43')]['id']}})[_0x69f7('0x23')](handleEntityNotFound(_0x250b1a,null))[_0x69f7('0x23')](removeEntity(_0x250b1a,null))[_0x69f7('0x41')](handleError(_0x250b1a,null));}; \ No newline at end of file +var _0xc32b=['fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x37ad18,_0x57e109){var _0x3a66b4=function(_0x46ca6e){while(--_0x46ca6e){_0x37ad18['push'](_0x37ad18['shift']());}};_0x3a66b4(++_0x57e109);}(_0xc32b,0xb3));var _0xbc32=function(_0x1d912b,_0x1147fb){_0x1d912b=_0x1d912b-0x0;var _0x3a4446=_0xc32b[_0x1d912b];return _0x3a4446;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc32('0x0'));var zipdir=require(_0xbc32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc32('0x2'));var moment=require(_0xbc32('0x3'));var BPromise=require(_0xbc32('0x4'));var Mustache=require(_0xbc32('0x5'));var util=require(_0xbc32('0x6'));var path=require('path');var sox=require(_0xbc32('0x7'));var csv=require(_0xbc32('0x8'));var ejs=require(_0xbc32('0x9'));var fs=require('fs');var fs_extra=require(_0xbc32('0xa'));var _=require(_0xbc32('0xb'));var squel=require(_0xbc32('0xc'));var crypto=require(_0xbc32('0xd'));var jsforce=require(_0xbc32('0xe'));var deskjs=require(_0xbc32('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbc32('0x10'));var Papa=require(_0xbc32('0x11'));var Redis=require(_0xbc32('0x12'));var authService=require(_0xbc32('0x13'));var qs=require(_0xbc32('0x14'));var as=require(_0xbc32('0x15'));var hardwareService=require(_0xbc32('0x16'));var logger=require(_0xbc32('0x17'))(_0xbc32('0x18'));var utils=require(_0xbc32('0x19'));var config=require(_0xbc32('0x1a'));var licenseUtil=require(_0xbc32('0x1b'));var db=require(_0xbc32('0x1c'))['db'];function respondWithStatusCode(_0x144ed9,_0x5e15fa){_0x5e15fa=_0x5e15fa||0xcc;return function(_0x219592){if(_0x219592){return _0x144ed9[_0xbc32('0x1d')](_0x5e15fa);}return _0x144ed9['status'](_0x5e15fa)['end']();};}function respondWithResult(_0x102f37,_0x5518b1){_0x5518b1=_0x5518b1||0xc8;return function(_0x494222){if(_0x494222){return _0x102f37[_0xbc32('0x1e')](_0x5518b1)[_0xbc32('0x1f')](_0x494222);}};}function respondWithFilteredResult(_0x22175b,_0x57eec4){return function(_0x5ab0d5){if(_0x5ab0d5){var _0x33cf91=typeof _0x57eec4['offset']===_0xbc32('0x20')&&typeof _0x57eec4[_0xbc32('0x21')]==='undefined';var _0x44bd72=_0x5ab0d5[_0xbc32('0x22')];var _0x1bead4=_0x33cf91?0x0:_0x57eec4[_0xbc32('0x23')];var _0x4519bd=_0x33cf91?_0x5ab0d5[_0xbc32('0x22')]:_0x57eec4[_0xbc32('0x23')]+_0x57eec4[_0xbc32('0x21')];var _0x4ffba1;if(_0x4519bd>=_0x44bd72){_0x4519bd=_0x44bd72;_0x4ffba1=0xc8;}else{_0x4ffba1=0xce;}_0x22175b[_0xbc32('0x1e')](_0x4ffba1);return _0x22175b['set'](_0xbc32('0x24'),_0x1bead4+'-'+_0x4519bd+'/'+_0x44bd72)['json'](_0x5ab0d5);}return null;};}function patchUpdates(_0x18f66b){return function(_0xd0c8b5){try{jsonpatch[_0xbc32('0x25')](_0xd0c8b5,_0x18f66b,!![]);}catch(_0x36055e){return BPromise[_0xbc32('0x26')](_0x36055e);}return _0xd0c8b5[_0xbc32('0x27')]();};}function saveUpdates(_0x4ee79a,_0xcdea58){return function(_0x589ef3){if(_0x589ef3){return _0x589ef3[_0xbc32('0x28')](_0x4ee79a)[_0xbc32('0x29')](function(_0x33a6af){return _0x33a6af;});}return null;};}function removeEntity(_0x553e23,_0x1d0dd7){return function(_0x1f615d){if(_0x1f615d){return _0x1f615d[_0xbc32('0x2a')]()[_0xbc32('0x29')](function(){_0x553e23['status'](0xcc)[_0xbc32('0x2b')]();});}};}function handleEntityNotFound(_0x579226,_0xafd14f){return function(_0x13c26b){if(!_0x13c26b){_0x579226[_0xbc32('0x1d')](0x194);}return _0x13c26b;};}function handleError(_0x1a1ddf,_0x5a29b1){_0x5a29b1=_0x5a29b1||0x1f4;return function(_0x107bed){logger[_0xbc32('0x2c')](_0x107bed['stack']);if(_0x107bed[_0xbc32('0x2d')]){delete _0x107bed['name'];}_0x1a1ddf['status'](_0x5a29b1)[_0xbc32('0x2e')](_0x107bed);};}exports[_0xbc32('0x2f')]=function(_0x237a54,_0x5c80b8){var _0x5397fd={},_0xbeb1ab={},_0x2e16c6={'count':0x0,'rows':[]};var _0x3860f3=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x2a3548){return{'name':_0x2a3548[_0xbc32('0x30')],'type':_0x2a3548[_0xbc32('0x31')][_0xbc32('0x32')]};});_0xbeb1ab[_0xbc32('0x33')]=_[_0xbc32('0x34')](_0x3860f3,_0xbc32('0x2d'));_0xbeb1ab[_0xbc32('0x35')]=_[_0xbc32('0x36')](_0x237a54['query']);_0xbeb1ab[_0xbc32('0x37')]=_[_0xbc32('0x38')](_0xbeb1ab[_0xbc32('0x33')],_0xbeb1ab[_0xbc32('0x35')]);_0x5397fd[_0xbc32('0x39')]=_[_0xbc32('0x38')](_0xbeb1ab[_0xbc32('0x33')],qs[_0xbc32('0x3a')](_0x237a54['query'][_0xbc32('0x3a')]));_0x5397fd[_0xbc32('0x39')]=_0x5397fd[_0xbc32('0x39')][_0xbc32('0x3b')]?_0x5397fd['attributes']:_0xbeb1ab['model'];if(!_0x237a54[_0xbc32('0x35')]['hasOwnProperty']('nolimit')){_0x5397fd[_0xbc32('0x21')]=qs['limit'](_0x237a54[_0xbc32('0x35')][_0xbc32('0x21')]);_0x5397fd['offset']=qs['offset'](_0x237a54['query'][_0xbc32('0x23')]);}_0x5397fd[_0xbc32('0x3c')]=qs[_0xbc32('0x3d')](_0x237a54['query'][_0xbc32('0x3d')]);_0x5397fd['where']=qs[_0xbc32('0x37')](_[_0xbc32('0x3e')](_0x237a54[_0xbc32('0x35')],_0xbeb1ab[_0xbc32('0x37')]),_0x3860f3);if(_0x237a54[_0xbc32('0x35')][_0xbc32('0x3f')]){_0x5397fd[_0xbc32('0x40')]=_[_0xbc32('0x41')](_0x5397fd[_0xbc32('0x40')],{'$or':_[_0xbc32('0x34')](_0x3860f3,function(_0x2952f4){if(_0x2952f4[_0xbc32('0x31')]!==_0xbc32('0x42')){var _0x5b2c76={};_0x5b2c76[_0x2952f4[_0xbc32('0x2d')]]={'$like':'%'+_0x237a54[_0xbc32('0x35')][_0xbc32('0x3f')]+'%'};return _0x5b2c76;}})});}_0x5397fd=_[_0xbc32('0x41')]({},_0x5397fd,_0x237a54[_0xbc32('0x43')]);var _0x2ddfe1={'where':_0x5397fd[_0xbc32('0x40')]};return db[_0xbc32('0x44')][_0xbc32('0x22')](_0x2ddfe1)[_0xbc32('0x29')](function(_0x432890){_0x2e16c6[_0xbc32('0x22')]=_0x432890;if(_0x237a54[_0xbc32('0x35')][_0xbc32('0x45')]){_0x5397fd[_0xbc32('0x46')]=[{'all':!![]}];}return db[_0xbc32('0x44')][_0xbc32('0x47')](_0x5397fd);})[_0xbc32('0x29')](function(_0x59115e){_0x2e16c6['rows']=_0x59115e;return _0x2e16c6;})[_0xbc32('0x29')](respondWithFilteredResult(_0x5c80b8,_0x5397fd))[_0xbc32('0x48')](handleError(_0x5c80b8,null));};exports[_0xbc32('0x49')]=function(_0x117860,_0x7cbe43){var _0x431783={'raw':!![],'where':{'id':_0x117860[_0xbc32('0x4a')]['id']}},_0x1d8a9b={};_0x1d8a9b['model']=_[_0xbc32('0x36')](db[_0xbc32('0x44')][_0xbc32('0x4b')]);_0x1d8a9b[_0xbc32('0x35')]=_[_0xbc32('0x36')](_0x117860['query']);_0x1d8a9b[_0xbc32('0x37')]=_[_0xbc32('0x38')](_0x1d8a9b['model'],_0x1d8a9b[_0xbc32('0x35')]);_0x431783[_0xbc32('0x39')]=_['intersection'](_0x1d8a9b[_0xbc32('0x33')],qs['fields'](_0x117860['query'][_0xbc32('0x3a')]));_0x431783[_0xbc32('0x39')]=_0x431783[_0xbc32('0x39')][_0xbc32('0x3b')]?_0x431783[_0xbc32('0x39')]:_0x1d8a9b[_0xbc32('0x33')];if(_0x117860['query'][_0xbc32('0x45')]){_0x431783[_0xbc32('0x46')]=[{'all':!![]}];}_0x431783=_[_0xbc32('0x41')]({},_0x431783,_0x117860[_0xbc32('0x43')]);return db[_0xbc32('0x44')][_0xbc32('0x4c')](_0x431783)[_0xbc32('0x29')](handleEntityNotFound(_0x7cbe43,null))[_0xbc32('0x29')](respondWithResult(_0x7cbe43,null))['catch'](handleError(_0x7cbe43,null));};exports[_0xbc32('0x4d')]=function(_0x4fac26,_0x5e8472){return db['SugarcrmField'][_0xbc32('0x4d')](_0x4fac26['body'],{})[_0xbc32('0x29')](respondWithResult(_0x5e8472,0xc9))[_0xbc32('0x48')](handleError(_0x5e8472,null));};exports[_0xbc32('0x28')]=function(_0x49f279,_0x4b7969){if(_0x49f279['body']['id']){delete _0x49f279[_0xbc32('0x4e')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x49f279[_0xbc32('0x4a')]['id']}})[_0xbc32('0x29')](handleEntityNotFound(_0x4b7969,null))[_0xbc32('0x29')](saveUpdates(_0x49f279[_0xbc32('0x4e')],null))[_0xbc32('0x29')](respondWithResult(_0x4b7969,null))['catch'](handleError(_0x4b7969,null));};exports[_0xbc32('0x2a')]=function(_0x1bb088,_0x28ac1e){return db['SugarcrmField'][_0xbc32('0x4c')]({'where':{'id':_0x1bb088['params']['id']}})[_0xbc32('0x29')](handleEntityNotFound(_0x28ac1e,null))[_0xbc32('0x29')](removeEntity(_0x28ac1e,null))['catch'](handleError(_0x28ac1e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6a0f301..aed65f5 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 _0xde6f=['../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','lodash','util','api','moment','request-promise','path'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0xde6f,0x17b));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var logger=require('../../config/logger')(_0xfde6('0x2'));var moment=require(_0xfde6('0x3'));var BPromise=require('bluebird');var rp=require(_0xfde6('0x4'));var fs=require('fs');var path=require(_0xfde6('0x5'));var rimraf=require('rimraf');var config=require(_0xfde6('0x6'));var attributes=require(_0xfde6('0x7'));module['exports']=function(_0x5cdc54,_0x533e8f){return _0x5cdc54[_0xfde6('0x8')](_0xfde6('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfde6('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91a9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x3c3c24,_0x498702){var _0x31596d=function(_0x10ed65){while(--_0x10ed65){_0x3c3c24['push'](_0x3c3c24['shift']());}};_0x31596d(++_0x498702);}(_0x91a9,0x120));var _0x991a=function(_0x500a59,_0x2d2d9f){_0x500a59=_0x500a59-0x0;var _0x3b6f27=_0x91a9[_0x500a59];return _0x3b6f27;};'use strict';var _=require(_0x991a('0x0'));var util=require(_0x991a('0x1'));var logger=require(_0x991a('0x2'))(_0x991a('0x3'));var moment=require(_0x991a('0x4'));var BPromise=require(_0x991a('0x5'));var rp=require(_0x991a('0x6'));var fs=require('fs');var path=require(_0x991a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x5af0fc,_0x1ad546){return _0x5af0fc['define'](_0x991a('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x991a('0x9'),'fields':[_0x991a('0xa'),_0x991a('0xb')],'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 2f37aca..6d3f4f3 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 _0xd52e=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x56c537,_0x462fba){var _0x4a4a1e=function(_0x12e2c1){while(--_0x12e2c1){_0x56c537['push'](_0x56c537['shift']());}};_0x4a4a1e(++_0x462fba);}(_0xd52e,0x195));var _0xed52=function(_0x3667e1,_0x44ac8d){_0x3667e1=_0x3667e1-0x0;var _0x22bfe3=_0xd52e[_0x3667e1];return _0x22bfe3;};'use strict';var _=require(_0xed52('0x0'));var util=require(_0xed52('0x1'));var moment=require(_0xed52('0x2'));var BPromise=require(_0xed52('0x3'));var rs=require(_0xed52('0x4'));var fs=require('fs');var Redis=require(_0xed52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed52('0x6'));var logger=require('../../config/logger')(_0xed52('0x7'));var config=require(_0xed52('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50cc77,_0x25f1fc,_0xbab94){return new BPromise(function(_0x563b1f,_0x30cd8e){return client[_0xed52('0x9')](_0x50cc77,_0xbab94)['then'](function(_0xadf161){logger[_0xed52('0xa')](_0xed52('0xb'),_0x25f1fc,_0xed52('0xc'));logger[_0xed52('0xd')](_0xed52('0xe'),_0x25f1fc,_0xed52('0xc'),JSON[_0xed52('0xf')](_0xadf161));if(_0xadf161[_0xed52('0x10')]){if(_0xadf161['error']['code']===0x1f4){logger[_0xed52('0x10')](_0xed52('0xb'),_0x25f1fc,_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);return _0x30cd8e(_0xadf161['error']['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xadf161[_0xed52('0x10')]['message']);return _0x563b1f(_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);}else{logger[_0xed52('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xed52('0xc'));_0x563b1f(_0xadf161[_0xed52('0x12')]['message']);}})[_0xed52('0x13')](function(_0x58bac0){logger[_0xed52('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0x58bac0);_0x30cd8e(_0x58bac0);});});} \ No newline at end of file +var _0xc41d=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f3eef,_0x2b50f4){var _0x4523ef=function(_0x36ac77){while(--_0x36ac77){_0x3f3eef['push'](_0x3f3eef['shift']());}};_0x4523ef(++_0x2b50f4);}(_0xc41d,0x8b));var _0xdc41=function(_0x316489,_0x5cd6cb){_0x316489=_0x316489-0x0;var _0x5be6a5=_0xc41d[_0x316489];return _0x5be6a5;};'use strict';var _=require(_0xdc41('0x0'));var util=require('util');var moment=require(_0xdc41('0x1'));var BPromise=require(_0xdc41('0x2'));var rs=require(_0xdc41('0x3'));var fs=require('fs');var Redis=require(_0xdc41('0x4'));var db=require(_0xdc41('0x5'))['db'];var utils=require(_0xdc41('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdc41('0x7'));var client=jayson[_0xdc41('0x8')][_0xdc41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28c090,_0x578715,_0x4510ef){return new BPromise(function(_0x38cf22,_0x42b1d7){return client[_0xdc41('0xa')](_0x28c090,_0x4510ef)[_0xdc41('0xb')](function(_0xfede6f){logger['info'](_0xdc41('0xc'),_0x578715,_0xdc41('0xd'));logger[_0xdc41('0xe')](_0xdc41('0xf'),_0x578715,'request\x20sent',JSON[_0xdc41('0x10')](_0xfede6f));if(_0xfede6f[_0xdc41('0x11')]){if(_0xfede6f['error']['code']===0x1f4){logger[_0xdc41('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x578715,_0xfede6f[_0xdc41('0x11')][_0xdc41('0x12')]);return _0x42b1d7(_0xfede6f[_0xdc41('0x11')][_0xdc41('0x12')]);}logger[_0xdc41('0x11')](_0xdc41('0xc'),_0x578715,_0xfede6f[_0xdc41('0x11')][_0xdc41('0x12')]);return _0x38cf22(_0xfede6f[_0xdc41('0x11')][_0xdc41('0x12')]);}else{logger[_0xdc41('0x13')](_0xdc41('0xc'),_0x578715,'request\x20sent');_0x38cf22(_0xfede6f[_0xdc41('0x14')][_0xdc41('0x12')]);}})[_0xdc41('0x15')](function(_0x3e0f23){logger[_0xdc41('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x578715,_0x3e0f23);_0x42b1d7(_0x3e0f23);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 1552046..eb6d171 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 _0xf681=['../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x15a833,_0x5092d6){var _0x371593=function(_0x53b66b){while(--_0x53b66b){_0x15a833['push'](_0x15a833['shift']());}};_0x371593(++_0x5092d6);}(_0xf681,0xc9));var _0x1f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf681[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1f68('0x0'));var path=require(_0x1f68('0x1'));var timeout=require(_0x1f68('0x2'));var express=require(_0x1f68('0x3'));var router=express['Router']();var fs_extra=require(_0x1f68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1f68('0x5'));var config=require(_0x1f68('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x1f68('0x7')]('/',auth[_0x1f68('0x8')](),controller[_0x1f68('0x9')]);router['get']('/:id',auth[_0x1f68('0x8')](),controller[_0x1f68('0xa')]);router[_0x1f68('0x7')]('/:id/configurations',auth[_0x1f68('0x8')](),controller[_0x1f68('0xb')]);router[_0x1f68('0x7')](_0x1f68('0xc'),auth[_0x1f68('0x8')](),controller[_0x1f68('0xd')]);router[_0x1f68('0xe')]('/',auth[_0x1f68('0x8')](),controller['create']);router[_0x1f68('0xe')](_0x1f68('0xf'),auth[_0x1f68('0x8')](),controller[_0x1f68('0x10')]);router[_0x1f68('0x11')]('/:id',auth[_0x1f68('0x8')](),controller[_0x1f68('0x12')]);router[_0x1f68('0x13')](_0x1f68('0x14'),auth[_0x1f68('0x8')](),controller[_0x1f68('0x15')]);module[_0x1f68('0x16')]=router; \ No newline at end of file +var _0x15ab=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete','exports','multer','util'];(function(_0x55fc38,_0x19bc7d){var _0x3cd5e4=function(_0x978b3e){while(--_0x978b3e){_0x55fc38['push'](_0x55fc38['shift']());}};_0x3cd5e4(++_0x19bc7d);}(_0x15ab,0xda));var _0xb15a=function(_0x21a3b9,_0x4bf4f5){_0x21a3b9=_0x21a3b9-0x0;var _0x106ec3=_0x15ab[_0x21a3b9];return _0x106ec3;};'use strict';var multer=require(_0xb15a('0x0'));var util=require(_0xb15a('0x1'));var path=require(_0xb15a('0x2'));var timeout=require(_0xb15a('0x3'));var express=require(_0xb15a('0x4'));var router=express[_0xb15a('0x5')]();var fs_extra=require(_0xb15a('0x6'));var auth=require(_0xb15a('0x7'));var interaction=require(_0xb15a('0x8'));var config=require('../../config/environment');var controller=require(_0xb15a('0x9'));router[_0xb15a('0xa')]('/',auth['isAuthenticated'](),controller[_0xb15a('0xb')]);router['get'](_0xb15a('0xc'),auth[_0xb15a('0xd')](),controller['show']);router[_0xb15a('0xa')](_0xb15a('0xe'),auth[_0xb15a('0xd')](),controller[_0xb15a('0xf')]);router[_0xb15a('0xa')](_0xb15a('0x10'),auth[_0xb15a('0xd')](),controller['getFields']);router[_0xb15a('0x11')]('/',auth[_0xb15a('0xd')](),controller[_0xb15a('0x12')]);router[_0xb15a('0x11')](_0xb15a('0xe'),auth[_0xb15a('0xd')](),controller['addConfiguration']);router['put']('/:id',auth[_0xb15a('0xd')](),controller[_0xb15a('0x13')]);router[_0xb15a('0x14')](_0xb15a('0xc'),auth[_0xb15a('0xd')](),controller['destroy']);module[_0xb15a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4da9cce..3c55bdd 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 _0xc1a4=['HelpDesk','sequelize','exports','STRING'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0xc1a4,0x1e9));var _0x4c1a=function(_0x23527e,_0x54ca2e){_0x23527e=_0x23527e-0x0;var _0x3df4b0=_0xc1a4[_0x23527e];return _0x3df4b0;};'use strict';var Sequelize=require(_0x4c1a('0x0'));module[_0x4c1a('0x1')]={'name':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4c1a('0x2')]},'username':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![],'defaultValue':_0x4c1a('0x3')},'remoteUri':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2163=['sequelize','STRING','HelpDesk'];(function(_0x5735ea,_0x2c62d5){var _0x406bc0=function(_0x1c6bfb){while(--_0x1c6bfb){_0x5735ea['push'](_0x5735ea['shift']());}};_0x406bc0(++_0x2c62d5);}(_0x2163,0x81));var _0x3216=function(_0x21c5f3,_0x572076){_0x21c5f3=_0x21c5f3-0x0;var _0x48f2aa=_0x2163[_0x21c5f3];return _0x48f2aa;};'use strict';var Sequelize=require(_0x3216('0x0'));module['exports']={'name':{'type':Sequelize[_0x3216('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3216('0x1')]},'username':{'type':Sequelize[_0x3216('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3216('0x1')],'allowNull':![],'defaultValue':_0x3216('0x2')},'remoteUri':{'type':Sequelize[_0x3216('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3216('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3216('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b61bb7e..217866a 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 _0x792d=['startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','save','update','destroy','then','error','stack','name','send','index','VtigerAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','POST','login','token','result','sessionName','autogenerated','remove','editable','label'];(function(_0x5019e4,_0x1d8ba3){var _0x408f4f=function(_0x3b89ec){while(--_0x3b89ec){_0x5019e4['push'](_0x5019e4['shift']());}};_0x408f4f(++_0x1d8ba3);}(_0x792d,0x1da));var _0xd792=function(_0xa3b5b,_0x350d8a){_0xa3b5b=_0xa3b5b-0x0;var _0x32852a=_0x792d[_0xa3b5b];return _0x32852a;};'use strict';var emlformat=require(_0xd792('0x0'));var rimraf=require(_0xd792('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd792('0x2'));var rp=require('request-promise');var moment=require(_0xd792('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd792('0x4'));var util=require(_0xd792('0x5'));var path=require(_0xd792('0x6'));var sox=require('sox');var csv=require(_0xd792('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd792('0x8'));var squel=require(_0xd792('0x9'));var crypto=require(_0xd792('0xa'));var jsforce=require(_0xd792('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd792('0x7'));var querystring=require(_0xd792('0xc'));var Papa=require(_0xd792('0xd'));var Redis=require('ioredis');var authService=require(_0xd792('0xe'));var qs=require(_0xd792('0xf'));var as=require(_0xd792('0x10'));var hardwareService=require(_0xd792('0x11'));var logger=require(_0xd792('0x12'))(_0xd792('0x13'));var utils=require(_0xd792('0x14'));var config=require(_0xd792('0x15'));var licenseUtil=require(_0xd792('0x16'));var db=require(_0xd792('0x17'))['db'];var integrations=require(_0xd792('0x18'));function respondWithStatusCode(_0x3e125d,_0xe621cf){_0xe621cf=_0xe621cf||0xcc;return function(_0x54765b){if(_0x54765b){return _0x3e125d[_0xd792('0x19')](_0xe621cf);}return _0x3e125d[_0xd792('0x1a')](_0xe621cf)[_0xd792('0x1b')]();};}function respondWithResult(_0x2cdace,_0x1e7745){_0x1e7745=_0x1e7745||0xc8;return function(_0x564242){if(_0x564242){return _0x2cdace[_0xd792('0x1a')](_0x1e7745)[_0xd792('0x1c')](_0x564242);}};}function respondWithFilteredResult(_0x190eb4,_0x3ea514){return function(_0x5a9ad6){if(_0x5a9ad6){var _0x571182=typeof _0x3ea514['offset']===_0xd792('0x1d')&&typeof _0x3ea514[_0xd792('0x1e')]===_0xd792('0x1d');var _0x113532=_0x5a9ad6['count'];var _0x7469f0=_0x571182?0x0:_0x3ea514[_0xd792('0x1f')];var _0x4c97c2=_0x571182?_0x5a9ad6[_0xd792('0x20')]:_0x3ea514['offset']+_0x3ea514['limit'];var _0x45ffeb;if(_0x4c97c2>=_0x113532){_0x4c97c2=_0x113532;_0x45ffeb=0xc8;}else{_0x45ffeb=0xce;}_0x190eb4[_0xd792('0x1a')](_0x45ffeb);return _0x190eb4[_0xd792('0x21')]('Content-Range',_0x7469f0+'-'+_0x4c97c2+'/'+_0x113532)[_0xd792('0x1c')](_0x5a9ad6);}return null;};}function patchUpdates(_0x461134){return function(_0x28fed7){try{jsonpatch[_0xd792('0x22')](_0x28fed7,_0x461134,!![]);}catch(_0x2e3260){return BPromise['reject'](_0x2e3260);}return _0x28fed7[_0xd792('0x23')]();};}function saveUpdates(_0xe9666d,_0x26f22b){return function(_0x4241d3){if(_0x4241d3){return _0x4241d3[_0xd792('0x24')](_0xe9666d)['then'](function(_0x21a93f){return _0x21a93f;});}return null;};}function removeEntity(_0x57422f,_0x825e78){return function(_0xccfeab){if(_0xccfeab){return _0xccfeab[_0xd792('0x25')]()[_0xd792('0x26')](function(){_0x57422f[_0xd792('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d065,_0x370421){return function(_0x16ef67){if(!_0x16ef67){_0x54d065['sendStatus'](0x194);}return _0x16ef67;};}function handleError(_0x321f8c,_0x45127c){_0x45127c=_0x45127c||0x1f4;return function(_0x46f4d2){logger[_0xd792('0x27')](_0x46f4d2[_0xd792('0x28')]);if(_0x46f4d2[_0xd792('0x29')]){delete _0x46f4d2['name'];}_0x321f8c[_0xd792('0x1a')](_0x45127c)[_0xd792('0x2a')](_0x46f4d2);};}exports[_0xd792('0x2b')]=function(_0x2c12e0,_0x528781){var _0x1efa64={},_0x60a434={},_0x6be231={'count':0x0,'rows':[]};var _0x37e06a=_['map'](db[_0xd792('0x2c')][_0xd792('0x2d')],function(_0xb6b14){return{'name':_0xb6b14['fieldName'],'type':_0xb6b14[_0xd792('0x2e')][_0xd792('0x2f')]};});_0x60a434[_0xd792('0x30')]=_[_0xd792('0x31')](_0x37e06a,'name');_0x60a434[_0xd792('0x32')]=_[_0xd792('0x33')](_0x2c12e0['query']);_0x60a434['filters']=_[_0xd792('0x34')](_0x60a434[_0xd792('0x30')],_0x60a434[_0xd792('0x32')]);_0x1efa64[_0xd792('0x35')]=_[_0xd792('0x34')](_0x60a434[_0xd792('0x30')],qs['fields'](_0x2c12e0[_0xd792('0x32')][_0xd792('0x36')]));_0x1efa64['attributes']=_0x1efa64[_0xd792('0x35')][_0xd792('0x37')]?_0x1efa64['attributes']:_0x60a434[_0xd792('0x30')];if(!_0x2c12e0[_0xd792('0x32')]['hasOwnProperty'](_0xd792('0x38'))){_0x1efa64['limit']=qs[_0xd792('0x1e')](_0x2c12e0[_0xd792('0x32')]['limit']);_0x1efa64[_0xd792('0x1f')]=qs['offset'](_0x2c12e0[_0xd792('0x32')][_0xd792('0x1f')]);}_0x1efa64[_0xd792('0x39')]=qs['sort'](_0x2c12e0['query'][_0xd792('0x3a')]);_0x1efa64[_0xd792('0x3b')]=qs[_0xd792('0x3c')](_['pick'](_0x2c12e0['query'],_0x60a434['filters']),_0x37e06a);if(_0x2c12e0[_0xd792('0x32')]['filter']){_0x1efa64['where']=_[_0xd792('0x3d')](_0x1efa64[_0xd792('0x3b')],{'$or':_[_0xd792('0x31')](_0x37e06a,function(_0x9bf228){if(_0x9bf228[_0xd792('0x2e')]!==_0xd792('0x3e')){var _0x1b0793={};_0x1b0793[_0x9bf228['name']]={'$like':'%'+_0x2c12e0[_0xd792('0x32')][_0xd792('0x3f')]+'%'};return _0x1b0793;}})});}_0x1efa64=_['merge']({},_0x1efa64,_0x2c12e0['options']);var _0x56551f={'where':_0x1efa64[_0xd792('0x3b')]};return db[_0xd792('0x2c')][_0xd792('0x20')](_0x56551f)[_0xd792('0x26')](function(_0x50aa46){_0x6be231[_0xd792('0x20')]=_0x50aa46;if(_0x2c12e0[_0xd792('0x32')][_0xd792('0x40')]){_0x1efa64[_0xd792('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0xd792('0x42')](_0x1efa64);})['then'](function(_0x446984){_0x6be231[_0xd792('0x43')]=_0x446984;return _0x6be231;})[_0xd792('0x26')](respondWithFilteredResult(_0x528781,_0x1efa64))[_0xd792('0x44')](handleError(_0x528781,null));};exports[_0xd792('0x45')]=function(_0x1916a7,_0x19cb40){var _0x141b85={'raw':![],'where':{'id':_0x1916a7[_0xd792('0x46')]['id']}},_0x270a90={};_0x270a90[_0xd792('0x30')]=_['keys'](db[_0xd792('0x2c')][_0xd792('0x2d')]);_0x270a90[_0xd792('0x32')]=_[_0xd792('0x33')](_0x1916a7[_0xd792('0x32')]);_0x270a90[_0xd792('0x3c')]=_['intersection'](_0x270a90[_0xd792('0x30')],_0x270a90[_0xd792('0x32')]);_0x141b85[_0xd792('0x35')]=_[_0xd792('0x34')](_0x270a90[_0xd792('0x30')],qs[_0xd792('0x36')](_0x1916a7['query'][_0xd792('0x36')]));_0x141b85[_0xd792('0x35')]=_0x141b85[_0xd792('0x35')][_0xd792('0x37')]?_0x141b85[_0xd792('0x35')]:_0x270a90['model'];if(_0x1916a7[_0xd792('0x32')]['includeAll']){_0x141b85['include']=[{'all':!![]}];}_0x141b85=_[_0xd792('0x3d')]({},_0x141b85,_0x1916a7[_0xd792('0x47')]);return db['VtigerAccount']['find'](_0x141b85)[_0xd792('0x26')](handleEntityNotFound(_0x19cb40,null))[_0xd792('0x26')](respondWithResult(_0x19cb40,null))['catch'](handleError(_0x19cb40,null));};exports['create']=function(_0x40289b,_0x3d4c85){return db[_0xd792('0x2c')][_0xd792('0x48')](_0x40289b[_0xd792('0x49')],{})[_0xd792('0x26')](respondWithResult(_0x3d4c85,0xc9))['catch'](handleError(_0x3d4c85,null));};exports[_0xd792('0x24')]=function(_0x501fb6,_0x22315b){if(_0x501fb6[_0xd792('0x49')]['id']){delete _0x501fb6[_0xd792('0x49')]['id'];}return db[_0xd792('0x2c')][_0xd792('0x4a')]({'where':{'id':_0x501fb6['params']['id']}})['then'](handleEntityNotFound(_0x22315b,null))[_0xd792('0x26')](saveUpdates(_0x501fb6[_0xd792('0x49')],null))['then'](respondWithResult(_0x22315b,null))[_0xd792('0x44')](handleError(_0x22315b,null));};exports[_0xd792('0x25')]=function(_0x4eea07,_0x422448){return db[_0xd792('0x2c')][_0xd792('0x4a')]({'where':{'id':_0x4eea07[_0xd792('0x46')]['id']}})['then'](handleEntityNotFound(_0x422448,null))[_0xd792('0x26')](removeEntity(_0x422448,null))[_0xd792('0x44')](handleError(_0x422448,null));};exports[_0xd792('0x4b')]=function(_0x394717,_0x293c8b,_0x36a555){var _0x1e4366={};var _0x6c345={};var _0x463707;var _0x5ba643;return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x394717[_0xd792('0x46')]['id']}})[_0xd792('0x26')](handleEntityNotFound(_0x293c8b,null))['then'](function(_0x466ede){if(_0x466ede){_0x463707=_0x466ede;_0x6c345[_0xd792('0x30')]=_[_0xd792('0x33')](db[_0xd792('0x4d')]['rawAttributes']);_0x6c345[_0xd792('0x32')]=_[_0xd792('0x33')](_0x394717[_0xd792('0x32')]);_0x6c345['filters']=_[_0xd792('0x34')](_0x6c345[_0xd792('0x30')],_0x6c345[_0xd792('0x32')]);_0x1e4366[_0xd792('0x35')]=_[_0xd792('0x34')](_0x6c345[_0xd792('0x30')],qs[_0xd792('0x36')](_0x394717[_0xd792('0x32')][_0xd792('0x36')]));_0x1e4366[_0xd792('0x35')]=_0x1e4366['attributes']['length']?_0x1e4366[_0xd792('0x35')]:_0x6c345[_0xd792('0x30')];_0x1e4366['order']=qs[_0xd792('0x3a')](_0x394717[_0xd792('0x32')][_0xd792('0x3a')]);_0x1e4366[_0xd792('0x3b')]=qs['filters'](_['pick'](_0x394717[_0xd792('0x32')],_0x6c345[_0xd792('0x3c')]));if(_0x394717['query'][_0xd792('0x3f')]){_0x1e4366['where']=_[_0xd792('0x3d')](_0x1e4366[_0xd792('0x3b')],{'$or':_[_0xd792('0x31')](_0x1e4366[_0xd792('0x35')],function(_0x1d831b){var _0x66ead1={};_0x66ead1[_0x1d831b]={'$like':'%'+_0x394717[_0xd792('0x32')][_0xd792('0x3f')]+'%'};return _0x66ead1;})});}_0x1e4366=_[_0xd792('0x3d')]({},_0x1e4366,_0x394717['options']);return _0x463707[_0xd792('0x4b')](_0x1e4366);}})[_0xd792('0x26')](function(_0x72c676){if(_0x72c676){_0x5ba643=_0x72c676['length'];if(!_0x394717[_0xd792('0x32')][_0xd792('0x4e')]('nolimit')){_0x1e4366[_0xd792('0x1e')]=qs[_0xd792('0x1e')](_0x394717['query']['limit']);_0x1e4366[_0xd792('0x1f')]=qs[_0xd792('0x1f')](_0x394717['query'][_0xd792('0x1f')]);}return _0x463707[_0xd792('0x4b')](_0x1e4366);}})[_0xd792('0x26')](function(_0x2442e6){if(_0x2442e6){return _0x2442e6?{'count':_0x5ba643,'rows':_0x2442e6}:null;}})['then'](respondWithResult(_0x293c8b,null))['catch'](handleError(_0x293c8b,null));};exports[_0xd792('0x4f')]=function(_0x287639,_0x5c62fb,_0x3c2f9a){if(_0x287639[_0xd792('0x49')]['id']){delete _0x287639['body']['id'];}return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x287639[_0xd792('0x46')]['id']}})[_0xd792('0x26')](handleEntityNotFound(_0x5c62fb,null))[_0xd792('0x26')](function(_0x251ecd){if(_0x251ecd){_0x287639['body']['AccountId']=_0x251ecd['id'];_0x287639[_0xd792('0x49')]['Subjects']=integrations['getSubjects'](_0x287639['body'][_0xd792('0x50')],_0x287639[_0xd792('0x49')][_0xd792('0x2e')]);_0x287639['body'][_0xd792('0x51')]=integrations[_0xd792('0x52')](_0x287639[_0xd792('0x49')]['channel'],_0x287639[_0xd792('0x49')][_0xd792('0x2e')]);return db[_0xd792('0x4d')][_0xd792('0x48')](_0x287639[_0xd792('0x49')],{'include':[{'model':db[_0xd792('0x53')],'as':'Subjects'},{'model':db[_0xd792('0x53')],'as':_0xd792('0x51')}]});}return null;})['then'](respondWithResult(_0x5c62fb,null))[_0xd792('0x44')](handleError(_0x5c62fb,null));};var md5=require('md5');exports[_0xd792('0x54')]=function(_0x1b1cf1,_0x57e14c,_0x1d5cb7){var _0x5876b9=null;var _0x288d2d=null;var _0xa0a375=null;var _0x1ceb99=null;var _0x2d0efe='';return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x1b1cf1[_0xd792('0x46')]['id']},'attributes':['id',_0xd792('0x29'),_0xd792('0x55'),_0xd792('0x56'),_0xd792('0x57'),_0xd792('0x58'),_0xd792('0x59'),'accessKey']})[_0xd792('0x26')](handleEntityNotFound(_0x57e14c,null))['then'](function(_0x16c505){if(_0x16c505){_0x5876b9=_0x16c505[_0xd792('0x55')];_0x288d2d=_0x16c505[_0xd792('0x5a')];_0xa0a375=_0x16c505[_0xd792('0x57')];_0x2d0efe=_0x16c505[_0xd792('0x58')];var _0x5cb683=_0x2d0efe[_0xd792('0x5b')](-0x1);if(_0x5cb683==='/'){_0x2d0efe=_0x2d0efe['substring'](0x0,_0x2d0efe[_0xd792('0x5c')](_0x5cb683));}_0x1ceb99=util[_0xd792('0x5d')]('%s/webservice.php',_0x2d0efe);var _0x25b974={'method':_0xd792('0x5e'),'uri':_0x1ceb99,'qs':{'operation':_0xd792('0x5f'),'username':_0x16c505[_0xd792('0x55')]},'json':!![]};return rp(_0x25b974);}})['then'](function(_0x3c9fd6){if(_0x3c9fd6[_0xd792('0x60')]){var _0x5aee69={'method':_0xd792('0x61'),'uri':_0x1ceb99,'form':{'operation':_0xd792('0x62'),'username':_0x5876b9,'accessKey':md5(_0x3c9fd6['result'][_0xd792('0x63')]+_0x288d2d)},'json':!![]};return rp(_0x5aee69);}})[_0xd792('0x26')](function(_0xa24297){if(_0xa24297[_0xd792('0x60')]){var _0x24b979={'method':_0xd792('0x5e'),'uri':_0x1ceb99,'qs':{'operation':'describe','username':_0x5876b9,'sessionName':_0xa24297[_0xd792('0x64')][_0xd792('0x65')],'elementType':_0xa0a375},'json':!![]};return rp(_0x24b979);}})[_0xd792('0x26')](function(_0x405a9){if(_0x405a9[_0xd792('0x60')]){var _0x345e33=[_0xd792('0x66'),'reference','owner'];_[_0xd792('0x67')](_0x405a9[_0xd792('0x64')][_0xd792('0x36')],function(_0x54223e){return _0x345e33['includes'](_0x54223e[_0xd792('0x2e')][_0xd792('0x29')]);});_['remove'](_0x405a9['result']['fields'],function(_0x3ebabf){return _0x3ebabf[_0xd792('0x68')]==='false';});return{'count':_0x405a9['result'][_0xd792('0x36')][_0xd792('0x37')],'rows':_[_0xd792('0x31')](_0x405a9[_0xd792('0x64')]['fields'],function(_0x279c0d){return{'id':_0x279c0d[_0xd792('0x29')],'name':_0x279c0d[_0xd792('0x69')],'custom':_[_0xd792('0x6a')](_0x279c0d['name'],_0xd792('0x6b'))?!![]:![],'options':_0x279c0d['type'][_0xd792('0x29')]===_0xd792('0x6c')&&_0x279c0d['type'][_0xd792('0x6d')][_0xd792('0x37')]>0x0?_[_0xd792('0x31')](_0x279c0d[_0xd792('0x2e')][_0xd792('0x6d')],function(_0x495bc6){return{'name':_0x495bc6[_0xd792('0x69')],'value':_0x495bc6['value']};}):[]};})};}})[_0xd792('0x26')](respondWithResult(_0x57e14c,null))[_0xd792('0x44')](function(_0x78a6db){console[_0xd792('0x6e')](_0xd792('0x6f')+_0x78a6db);var _0xaacd5b=_0x1b1cf1['query'][_0xd792('0x70')]?0x1f4:_0x78a6db['statusCode']||0x1f4;logger['error'](_0xd792('0x71'),_0xd792('0x54'),_0xaacd5b,JSON['stringify'](_0x78a6db));delete _0x78a6db['name'];if(_0xaacd5b===0x191){_0xaacd5b=0x190;}_0x57e14c[_0xd792('0x1a')](_0xaacd5b)[_0xd792('0x2a')](_0x1b1cf1['query']['test']?{'message':_0xd792('0x72'),'statusCode':_0x78a6db[_0xd792('0x73')]}:_0x78a6db);});}; \ No newline at end of file +var _0x80f9=['desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','params','keys','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','username','moduleName','remoteUri','accessKey','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','reference','owner','remove','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce'];(function(_0x3b380d,_0x33cbdf){var _0x381379=function(_0x291118){while(--_0x291118){_0x3b380d['push'](_0x3b380d['shift']());}};_0x381379(++_0x33cbdf);}(_0x80f9,0x65));var _0x980f=function(_0x5349df,_0x2c9cfe){_0x5349df=_0x5349df-0x0;var _0x447249=_0x80f9[_0x5349df];return _0x447249;};'use strict';var emlformat=require(_0x980f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x980f('0x1'));var jsonpatch=require(_0x980f('0x2'));var rp=require(_0x980f('0x3'));var moment=require(_0x980f('0x4'));var BPromise=require(_0x980f('0x5'));var Mustache=require(_0x980f('0x6'));var util=require(_0x980f('0x7'));var path=require(_0x980f('0x8'));var sox=require('sox');var csv=require(_0x980f('0x9'));var ejs=require(_0x980f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x980f('0xb'));var crypto=require('crypto');var jsforce=require(_0x980f('0xc'));var deskjs=require(_0x980f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x980f('0xe'));var Redis=require(_0x980f('0xf'));var authService=require(_0x980f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x980f('0x11'));var logger=require(_0x980f('0x12'))(_0x980f('0x13'));var utils=require(_0x980f('0x14'));var config=require(_0x980f('0x15'));var licenseUtil=require(_0x980f('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x980f('0x17'));function respondWithStatusCode(_0x3fe209,_0x4929ee){_0x4929ee=_0x4929ee||0xcc;return function(_0x33c277){if(_0x33c277){return _0x3fe209[_0x980f('0x18')](_0x4929ee);}return _0x3fe209[_0x980f('0x19')](_0x4929ee)['end']();};}function respondWithResult(_0x4c613c,_0x4fd14b){_0x4fd14b=_0x4fd14b||0xc8;return function(_0x3abbf9){if(_0x3abbf9){return _0x4c613c['status'](_0x4fd14b)[_0x980f('0x1a')](_0x3abbf9);}};}function respondWithFilteredResult(_0x4234de,_0x5c7b5c){return function(_0x227f16){if(_0x227f16){var _0xa253c1=typeof _0x5c7b5c[_0x980f('0x1b')]===_0x980f('0x1c')&&typeof _0x5c7b5c[_0x980f('0x1d')]==='undefined';var _0x229c79=_0x227f16[_0x980f('0x1e')];var _0x3bbe84=_0xa253c1?0x0:_0x5c7b5c[_0x980f('0x1b')];var _0x18b8b9=_0xa253c1?_0x227f16[_0x980f('0x1e')]:_0x5c7b5c['offset']+_0x5c7b5c['limit'];var _0x1729f8;if(_0x18b8b9>=_0x229c79){_0x18b8b9=_0x229c79;_0x1729f8=0xc8;}else{_0x1729f8=0xce;}_0x4234de['status'](_0x1729f8);return _0x4234de[_0x980f('0x1f')](_0x980f('0x20'),_0x3bbe84+'-'+_0x18b8b9+'/'+_0x229c79)['json'](_0x227f16);}return null;};}function patchUpdates(_0x1d857d){return function(_0x14df2d){try{jsonpatch[_0x980f('0x21')](_0x14df2d,_0x1d857d,!![]);}catch(_0x4cf5b6){return BPromise[_0x980f('0x22')](_0x4cf5b6);}return _0x14df2d[_0x980f('0x23')]();};}function saveUpdates(_0x42c4fe,_0x4d36b0){return function(_0x16b5cb){if(_0x16b5cb){return _0x16b5cb[_0x980f('0x24')](_0x42c4fe)['then'](function(_0x535b0c){return _0x535b0c;});}return null;};}function removeEntity(_0xfd8758,_0x13622e){return function(_0x53493d){if(_0x53493d){return _0x53493d['destroy']()[_0x980f('0x25')](function(){_0xfd8758['status'](0xcc)[_0x980f('0x26')]();});}};}function handleEntityNotFound(_0x169690,_0xa317b8){return function(_0xe6bcf5){if(!_0xe6bcf5){_0x169690[_0x980f('0x18')](0x194);}return _0xe6bcf5;};}function handleError(_0x4914a1,_0x4e0bbd){_0x4e0bbd=_0x4e0bbd||0x1f4;return function(_0x11544c){logger['error'](_0x11544c[_0x980f('0x27')]);if(_0x11544c[_0x980f('0x28')]){delete _0x11544c[_0x980f('0x28')];}_0x4914a1['status'](_0x4e0bbd)[_0x980f('0x29')](_0x11544c);};}exports[_0x980f('0x2a')]=function(_0x2db034,_0x1e32af){var _0x4cf7d2={},_0x47e296={},_0x506a6f={'count':0x0,'rows':[]};var _0xc8293f=_[_0x980f('0x2b')](db[_0x980f('0x2c')][_0x980f('0x2d')],function(_0x483f91){return{'name':_0x483f91['fieldName'],'type':_0x483f91[_0x980f('0x2e')][_0x980f('0x2f')]};});_0x47e296[_0x980f('0x30')]=_[_0x980f('0x2b')](_0xc8293f,_0x980f('0x28'));_0x47e296[_0x980f('0x31')]=_['keys'](_0x2db034[_0x980f('0x31')]);_0x47e296[_0x980f('0x32')]=_['intersection'](_0x47e296[_0x980f('0x30')],_0x47e296[_0x980f('0x31')]);_0x4cf7d2[_0x980f('0x33')]=_[_0x980f('0x34')](_0x47e296['model'],qs['fields'](_0x2db034['query'][_0x980f('0x35')]));_0x4cf7d2[_0x980f('0x33')]=_0x4cf7d2[_0x980f('0x33')]['length']?_0x4cf7d2['attributes']:_0x47e296[_0x980f('0x30')];if(!_0x2db034['query'][_0x980f('0x36')]('nolimit')){_0x4cf7d2[_0x980f('0x1d')]=qs[_0x980f('0x1d')](_0x2db034[_0x980f('0x31')]['limit']);_0x4cf7d2[_0x980f('0x1b')]=qs[_0x980f('0x1b')](_0x2db034[_0x980f('0x31')]['offset']);}_0x4cf7d2[_0x980f('0x37')]=qs[_0x980f('0x38')](_0x2db034['query'][_0x980f('0x38')]);_0x4cf7d2[_0x980f('0x39')]=qs['filters'](_[_0x980f('0x3a')](_0x2db034[_0x980f('0x31')],_0x47e296[_0x980f('0x32')]),_0xc8293f);if(_0x2db034[_0x980f('0x31')][_0x980f('0x3b')]){_0x4cf7d2[_0x980f('0x39')]=_['merge'](_0x4cf7d2[_0x980f('0x39')],{'$or':_[_0x980f('0x2b')](_0xc8293f,function(_0xc37829){if(_0xc37829[_0x980f('0x2e')]!==_0x980f('0x3c')){var _0x3bf305={};_0x3bf305[_0xc37829[_0x980f('0x28')]]={'$like':'%'+_0x2db034['query']['filter']+'%'};return _0x3bf305;}})});}_0x4cf7d2=_[_0x980f('0x3d')]({},_0x4cf7d2,_0x2db034[_0x980f('0x3e')]);var _0x1b5f98={'where':_0x4cf7d2[_0x980f('0x39')]};return db[_0x980f('0x2c')]['count'](_0x1b5f98)[_0x980f('0x25')](function(_0x4fd31b){_0x506a6f[_0x980f('0x1e')]=_0x4fd31b;if(_0x2db034[_0x980f('0x31')][_0x980f('0x3f')]){_0x4cf7d2[_0x980f('0x40')]=[{'all':!![]}];}return db[_0x980f('0x2c')]['findAll'](_0x4cf7d2);})[_0x980f('0x25')](function(_0x18fdf7){_0x506a6f['rows']=_0x18fdf7;return _0x506a6f;})[_0x980f('0x25')](respondWithFilteredResult(_0x1e32af,_0x4cf7d2))[_0x980f('0x41')](handleError(_0x1e32af,null));};exports['show']=function(_0x4853bf,_0x373ca4){var _0x1b4c13={'raw':![],'where':{'id':_0x4853bf[_0x980f('0x42')]['id']}},_0x3bc484={};_0x3bc484[_0x980f('0x30')]=_[_0x980f('0x43')](db[_0x980f('0x2c')][_0x980f('0x2d')]);_0x3bc484[_0x980f('0x31')]=_[_0x980f('0x43')](_0x4853bf[_0x980f('0x31')]);_0x3bc484['filters']=_['intersection'](_0x3bc484[_0x980f('0x30')],_0x3bc484['query']);_0x1b4c13[_0x980f('0x33')]=_['intersection'](_0x3bc484[_0x980f('0x30')],qs[_0x980f('0x35')](_0x4853bf['query'][_0x980f('0x35')]));_0x1b4c13[_0x980f('0x33')]=_0x1b4c13[_0x980f('0x33')][_0x980f('0x44')]?_0x1b4c13[_0x980f('0x33')]:_0x3bc484[_0x980f('0x30')];if(_0x4853bf['query'][_0x980f('0x3f')]){_0x1b4c13['include']=[{'all':!![]}];}_0x1b4c13=_[_0x980f('0x3d')]({},_0x1b4c13,_0x4853bf[_0x980f('0x3e')]);return db[_0x980f('0x2c')][_0x980f('0x45')](_0x1b4c13)[_0x980f('0x25')](handleEntityNotFound(_0x373ca4,null))[_0x980f('0x25')](respondWithResult(_0x373ca4,null))[_0x980f('0x41')](handleError(_0x373ca4,null));};exports['create']=function(_0x5952f3,_0x463a78){return db[_0x980f('0x2c')][_0x980f('0x46')](_0x5952f3[_0x980f('0x47')],{})[_0x980f('0x25')](respondWithResult(_0x463a78,0xc9))[_0x980f('0x41')](handleError(_0x463a78,null));};exports[_0x980f('0x24')]=function(_0x4a21c3,_0x143c9b){if(_0x4a21c3[_0x980f('0x47')]['id']){delete _0x4a21c3[_0x980f('0x47')]['id'];}return db[_0x980f('0x2c')][_0x980f('0x45')]({'where':{'id':_0x4a21c3[_0x980f('0x42')]['id']}})[_0x980f('0x25')](handleEntityNotFound(_0x143c9b,null))[_0x980f('0x25')](saveUpdates(_0x4a21c3[_0x980f('0x47')],null))[_0x980f('0x25')](respondWithResult(_0x143c9b,null))[_0x980f('0x41')](handleError(_0x143c9b,null));};exports['destroy']=function(_0x428053,_0x34b098){return db[_0x980f('0x2c')][_0x980f('0x45')]({'where':{'id':_0x428053[_0x980f('0x42')]['id']}})[_0x980f('0x25')](handleEntityNotFound(_0x34b098,null))['then'](removeEntity(_0x34b098,null))['catch'](handleError(_0x34b098,null));};exports[_0x980f('0x48')]=function(_0x4f33cf,_0x15f012,_0x2a7b24){var _0x5549f4={};var _0x31ca5e={};var _0x3c5395;var _0x1bd65b;return db[_0x980f('0x2c')][_0x980f('0x49')]({'where':{'id':_0x4f33cf['params']['id']}})[_0x980f('0x25')](handleEntityNotFound(_0x15f012,null))[_0x980f('0x25')](function(_0x192c97){if(_0x192c97){_0x3c5395=_0x192c97;_0x31ca5e['model']=_[_0x980f('0x43')](db[_0x980f('0x4a')][_0x980f('0x2d')]);_0x31ca5e[_0x980f('0x31')]=_['keys'](_0x4f33cf[_0x980f('0x31')]);_0x31ca5e[_0x980f('0x32')]=_['intersection'](_0x31ca5e['model'],_0x31ca5e[_0x980f('0x31')]);_0x5549f4[_0x980f('0x33')]=_['intersection'](_0x31ca5e[_0x980f('0x30')],qs['fields'](_0x4f33cf['query']['fields']));_0x5549f4['attributes']=_0x5549f4[_0x980f('0x33')][_0x980f('0x44')]?_0x5549f4['attributes']:_0x31ca5e[_0x980f('0x30')];_0x5549f4['order']=qs[_0x980f('0x38')](_0x4f33cf[_0x980f('0x31')][_0x980f('0x38')]);_0x5549f4[_0x980f('0x39')]=qs[_0x980f('0x32')](_[_0x980f('0x3a')](_0x4f33cf[_0x980f('0x31')],_0x31ca5e[_0x980f('0x32')]));if(_0x4f33cf[_0x980f('0x31')][_0x980f('0x3b')]){_0x5549f4[_0x980f('0x39')]=_[_0x980f('0x3d')](_0x5549f4[_0x980f('0x39')],{'$or':_[_0x980f('0x2b')](_0x5549f4[_0x980f('0x33')],function(_0x56c1d7){var _0x28aeb9={};_0x28aeb9[_0x56c1d7]={'$like':'%'+_0x4f33cf[_0x980f('0x31')][_0x980f('0x3b')]+'%'};return _0x28aeb9;})});}_0x5549f4=_[_0x980f('0x3d')]({},_0x5549f4,_0x4f33cf['options']);return _0x3c5395[_0x980f('0x48')](_0x5549f4);}})[_0x980f('0x25')](function(_0x558625){if(_0x558625){_0x1bd65b=_0x558625[_0x980f('0x44')];if(!_0x4f33cf[_0x980f('0x31')][_0x980f('0x36')](_0x980f('0x4b'))){_0x5549f4[_0x980f('0x1d')]=qs[_0x980f('0x1d')](_0x4f33cf[_0x980f('0x31')][_0x980f('0x1d')]);_0x5549f4[_0x980f('0x1b')]=qs[_0x980f('0x1b')](_0x4f33cf['query'][_0x980f('0x1b')]);}return _0x3c5395[_0x980f('0x48')](_0x5549f4);}})[_0x980f('0x25')](function(_0x58b44c){if(_0x58b44c){return _0x58b44c?{'count':_0x1bd65b,'rows':_0x58b44c}:null;}})[_0x980f('0x25')](respondWithResult(_0x15f012,null))[_0x980f('0x41')](handleError(_0x15f012,null));};exports[_0x980f('0x4c')]=function(_0xc53fe2,_0x1c93df,_0x5a1936){if(_0xc53fe2[_0x980f('0x47')]['id']){delete _0xc53fe2[_0x980f('0x47')]['id'];}return db[_0x980f('0x2c')]['findOne']({'where':{'id':_0xc53fe2[_0x980f('0x42')]['id']}})[_0x980f('0x25')](handleEntityNotFound(_0x1c93df,null))['then'](function(_0x55249f){if(_0x55249f){_0xc53fe2[_0x980f('0x47')][_0x980f('0x4d')]=_0x55249f['id'];_0xc53fe2['body'][_0x980f('0x4e')]=integrations[_0x980f('0x4f')](_0xc53fe2[_0x980f('0x47')]['channel'],_0xc53fe2['body'][_0x980f('0x2e')]);_0xc53fe2[_0x980f('0x47')][_0x980f('0x50')]=integrations[_0x980f('0x51')](_0xc53fe2[_0x980f('0x47')][_0x980f('0x52')],_0xc53fe2['body'][_0x980f('0x2e')]);return db[_0x980f('0x4a')][_0x980f('0x46')](_0xc53fe2[_0x980f('0x47')],{'include':[{'model':db['VtigerField'],'as':_0x980f('0x4e')},{'model':db[_0x980f('0x53')],'as':'Descriptions'}]});}return null;})[_0x980f('0x25')](respondWithResult(_0x1c93df,null))[_0x980f('0x41')](handleError(_0x1c93df,null));};var md5=require('md5');exports['getFields']=function(_0x3ff97b,_0x5d38e6,_0x2390a4){var _0x4082c3=null;var _0x29d7a4=null;var _0xf834a9=null;var _0x53c35f=null;var _0x1cbc6b='';return db[_0x980f('0x2c')][_0x980f('0x49')]({'where':{'id':_0x3ff97b[_0x980f('0x42')]['id']},'attributes':['id',_0x980f('0x28'),_0x980f('0x54'),'description',_0x980f('0x55'),_0x980f('0x56'),'serverUrl',_0x980f('0x57')]})[_0x980f('0x25')](handleEntityNotFound(_0x5d38e6,null))['then'](function(_0x106608){if(_0x106608){_0x4082c3=_0x106608['username'];_0x29d7a4=_0x106608[_0x980f('0x57')];_0xf834a9=_0x106608['moduleName'];_0x1cbc6b=_0x106608[_0x980f('0x56')];var _0x38c0a7=_0x1cbc6b['slice'](-0x1);if(_0x38c0a7==='/'){_0x1cbc6b=_0x1cbc6b['substring'](0x0,_0x1cbc6b['lastIndexOf'](_0x38c0a7));}_0x53c35f=util['format'](_0x980f('0x58'),_0x1cbc6b);var _0x15f4a3={'method':_0x980f('0x59'),'uri':_0x53c35f,'qs':{'operation':_0x980f('0x5a'),'username':_0x106608['username']},'json':!![]};return rp(_0x15f4a3);}})[_0x980f('0x25')](function(_0x4cef41){if(_0x4cef41[_0x980f('0x5b')]){var _0x3e8487={'method':_0x980f('0x5c'),'uri':_0x53c35f,'form':{'operation':_0x980f('0x5d'),'username':_0x4082c3,'accessKey':md5(_0x4cef41[_0x980f('0x5e')][_0x980f('0x5f')]+_0x29d7a4)},'json':!![]};return rp(_0x3e8487);}})['then'](function(_0x378509){if(_0x378509[_0x980f('0x5b')]){var _0x40178c={'method':_0x980f('0x59'),'uri':_0x53c35f,'qs':{'operation':'describe','username':_0x4082c3,'sessionName':_0x378509[_0x980f('0x5e')][_0x980f('0x60')],'elementType':_0xf834a9},'json':!![]};return rp(_0x40178c);}})[_0x980f('0x25')](function(_0x4a9441){if(_0x4a9441[_0x980f('0x5b')]){var _0x11019c=['autogenerated',_0x980f('0x61'),_0x980f('0x62')];_['remove'](_0x4a9441[_0x980f('0x5e')][_0x980f('0x35')],function(_0x56fe5a){return _0x11019c['includes'](_0x56fe5a[_0x980f('0x2e')]['name']);});_[_0x980f('0x63')](_0x4a9441[_0x980f('0x5e')][_0x980f('0x35')],function(_0x4f0f4c){return _0x4f0f4c['editable']===_0x980f('0x64');});return{'count':_0x4a9441['result'][_0x980f('0x35')][_0x980f('0x44')],'rows':_[_0x980f('0x2b')](_0x4a9441[_0x980f('0x5e')][_0x980f('0x35')],function(_0x541547){return{'id':_0x541547['name'],'name':_0x541547[_0x980f('0x65')],'custom':_[_0x980f('0x66')](_0x541547[_0x980f('0x28')],_0x980f('0x67'))?!![]:![],'options':_0x541547[_0x980f('0x2e')][_0x980f('0x28')]==='picklist'&&_0x541547[_0x980f('0x2e')][_0x980f('0x68')]['length']>0x0?_['map'](_0x541547[_0x980f('0x2e')]['picklistValues'],function(_0x2dfea9){return{'name':_0x2dfea9[_0x980f('0x65')],'value':_0x2dfea9[_0x980f('0x69')]};}):[]};})};}})[_0x980f('0x25')](respondWithResult(_0x5d38e6,null))[_0x980f('0x41')](function(_0x44797b){console[_0x980f('0x6a')](_0x980f('0x6b')+_0x44797b);var _0x28fa5f=_0x3ff97b['query'][_0x980f('0x6c')]?0x1f4:_0x44797b['statusCode']||0x1f4;logger[_0x980f('0x6d')](_0x980f('0x6e'),_0x980f('0x6f'),_0x28fa5f,JSON[_0x980f('0x70')](_0x44797b));delete _0x44797b[_0x980f('0x28')];if(_0x28fa5f===0x191){_0x28fa5f=0x190;}_0x5d38e6['status'](_0x28fa5f)[_0x980f('0x29')](_0x3ff97b[_0x980f('0x31')][_0x980f('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x44797b[_0x980f('0x71')]}:_0x44797b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f466796..3101b0e 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 _0xbbb4=['../../components/integrations/configuration','exports','define','VtigerAccount','util','api','moment','path','rimraf','../../config/environment'];(function(_0x3c8af6,_0x43128b){var _0x31bf95=function(_0x2e2449){while(--_0x2e2449){_0x3c8af6['push'](_0x3c8af6['shift']());}};_0x31bf95(++_0x43128b);}(_0xbbb4,0xe0));var _0x4bbb=function(_0x486406,_0x37be14){_0x486406=_0x486406-0x0;var _0x26d325=_0xbbb4[_0x486406];return _0x26d325;};'use strict';var _=require('lodash');var util=require(_0x4bbb('0x0'));var logger=require('../../config/logger')(_0x4bbb('0x1'));var moment=require(_0x4bbb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bbb('0x3'));var rimraf=require(_0x4bbb('0x4'));var config=require(_0x4bbb('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4bbb('0x6'));module[_0x4bbb('0x7')]=function(_0x25d42a,_0x5671b2){return _0x25d42a[_0x4bbb('0x8')](_0x4bbb('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49b9=['int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x49b9,0xaa));var _0x949b=function(_0x318ee1,_0x5afa50){_0x318ee1=_0x318ee1-0x0;var _0x5d15d3=_0x49b9[_0x318ee1];return _0x5d15d3;};'use strict';var _=require('lodash');var util=require(_0x949b('0x0'));var logger=require(_0x949b('0x1'))(_0x949b('0x2'));var moment=require('moment');var BPromise=require(_0x949b('0x3'));var rp=require(_0x949b('0x4'));var fs=require('fs');var path=require(_0x949b('0x5'));var rimraf=require(_0x949b('0x6'));var config=require(_0x949b('0x7'));var attributes=require(_0x949b('0x8'));var integrations=require(_0x949b('0x9'));module[_0x949b('0xa')]=function(_0x2259c5,_0xdf02c3){return _0x2259c5['define'](_0x949b('0xb'),attributes,{'tableName':_0x949b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index c9c4df1..90cd718 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 _0x236c=['jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','include','map','model','VtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0x236c,0x155));var _0xc236=function(_0x4a5a86,_0xfe8f43){_0x4a5a86=_0x4a5a86-0x0;var _0x4aa2a2=_0x236c[_0x4a5a86];return _0x4aa2a2;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});}exports[_0xc236('0x18')]=function(_0x76f45){var _0x11ec65=this;return new Promise(function(_0x541a20,_0x13b432){return db['VtigerAccount']['findAll']({'raw':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'limit':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')]['limit']||null:null,'include':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x76f45[_0xc236('0x19')][_0xc236('0x1d')],function(_0x3a315b){return{'model':db[_0x3a315b[_0xc236('0x1f')]],'as':_0x3a315b['as'],'attributes':_0x3a315b[_0xc236('0x1c')],'include':_0x3a315b[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x3a315b['include'],function(_0x308cd6){return{'model':db[_0x308cd6[_0xc236('0x1f')]],'as':_0x308cd6['as'],'attributes':_0x308cd6[_0xc236('0x1c')],'include':_0x308cd6[_0xc236('0x1d')]?_['map'](_0x308cd6[_0xc236('0x1d')],function(_0x5da4b2){return{'model':db[_0x5da4b2['model']],'as':_0x5da4b2['as'],'attributes':_0x5da4b2[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36e578){logger['info'](_0xc236('0x18'),_0x76f45);logger['debug'](_0xc236('0x18'),_0x76f45,JSON[_0xc236('0x12')](_0x36e578));_0x541a20(_0x36e578);})['catch'](function(_0x5a61b5){logger[_0xc236('0x13')](_0xc236('0x18'),_0x5a61b5[_0xc236('0x15')],_0x76f45);_0x13b432(_0x11ec65[_0xc236('0x13')](0x1f4,_0x5a61b5['message']));});});};exports['ShowVtigerAccount']=function(_0x28ffa5){var _0x53b767=this;return new Promise(function(_0x2c756f,_0x4ddc87){return db[_0xc236('0x20')][_0xc236('0x21')]({'raw':_0x28ffa5['options']?_0x28ffa5['options'][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'include':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')]['include']?_['map'](_0x28ffa5['options'][_0xc236('0x1d')],function(_0xfda1f9){return{'model':db[_0xfda1f9[_0xc236('0x1f')]],'as':_0xfda1f9['as'],'attributes':_0xfda1f9[_0xc236('0x1c')],'include':_0xfda1f9[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x1d')],function(_0x5761de){return{'model':db[_0x5761de[_0xc236('0x1f')]],'as':_0x5761de['as'],'attributes':_0x5761de[_0xc236('0x1c')],'include':_0x5761de[_0xc236('0x1d')]?_['map'](_0x5761de[_0xc236('0x1d')],function(_0x2a8f33){return{'model':db[_0x2a8f33[_0xc236('0x1f')]],'as':_0x2a8f33['as'],'attributes':_0x2a8f33[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12348b){logger[_0xc236('0xd')](_0xc236('0x22'),_0x28ffa5);logger[_0xc236('0x10')](_0xc236('0x22'),_0x28ffa5,JSON[_0xc236('0x12')](_0x12348b));_0x2c756f(_0x12348b);})[_0xc236('0x17')](function(_0x11ca1c){logger[_0xc236('0x13')](_0xc236('0x22'),_0x11ca1c[_0xc236('0x15')],_0x28ffa5);_0x4ddc87(_0x53b767[_0xc236('0x13')](0x1f4,_0x11ca1c[_0xc236('0x15')]));});});}; \ No newline at end of file +var _0x6b20=['../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','stringify','catch','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6b20,0xd1));var _0x06b2=function(_0x2ad789,_0x6c7ae5){_0x2ad789=_0x2ad789-0x0;var _0x3c8e1e=_0x6b20[_0x2ad789];return _0x3c8e1e;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')]({'raw':_0x594b48['options']?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')]['attributes']||null:null,'limit':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x1a')]||null:null,'include':_0x594b48[_0x06b2('0x17')]?_0x594b48['options']['include']?_[_0x06b2('0x1b')](_0x594b48[_0x06b2('0x17')]['include'],function(_0x39659f){return{'model':db[_0x39659f['model']],'as':_0x39659f['as'],'attributes':_0x39659f[_0x06b2('0x1c')],'include':_0x39659f[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x39659f['include'],function(_0x4382ce){return{'model':db[_0x4382ce[_0x06b2('0x1e')]],'as':_0x4382ce['as'],'attributes':_0x4382ce[_0x06b2('0x1c')],'include':_0x4382ce[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x4382ce['include'],function(_0xbb00ea){return{'model':db[_0xbb00ea[_0x06b2('0x1e')]],'as':_0xbb00ea['as'],'attributes':_0xbb00ea[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x1976ac){logger[_0x06b2('0x12')]('GetVtigerAccount',_0x594b48);logger[_0x06b2('0x20')](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x21')](_0x1976ac));_0x192270(_0x1976ac);})[_0x06b2('0x22')](function(_0x1f02d8){logger[_0x06b2('0xf')](_0x06b2('0x14'),_0x1f02d8['message'],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x1f02d8[_0x06b2('0x11')]));});});};exports[_0x06b2('0x23')]=function(_0x15a78b){var _0x1cc725=this;return new Promise(function(_0x37d391,_0x401551){return db[_0x06b2('0x15')]['find']({'raw':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x15a78b[_0x06b2('0x17')]?_0x15a78b['options']['attributes']||null:null,'include':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')]?_['map'](_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')],function(_0x37bfb5){return{'model':db[_0x37bfb5[_0x06b2('0x1e')]],'as':_0x37bfb5['as'],'attributes':_0x37bfb5[_0x06b2('0x1c')],'include':_0x37bfb5[_0x06b2('0x1d')]?_['map'](_0x37bfb5[_0x06b2('0x1d')],function(_0x1e66f1){return{'model':db[_0x1e66f1[_0x06b2('0x1e')]],'as':_0x1e66f1['as'],'attributes':_0x1e66f1['attributes'],'include':_0x1e66f1[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x1e66f1['include'],function(_0x45ea67){return{'model':db[_0x45ea67[_0x06b2('0x1e')]],'as':_0x45ea67['as'],'attributes':_0x45ea67[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x2e49df){logger[_0x06b2('0x12')](_0x06b2('0x23'),_0x15a78b);logger[_0x06b2('0x20')](_0x06b2('0x23'),_0x15a78b,JSON[_0x06b2('0x21')](_0x2e49df));_0x37d391(_0x2e49df);})[_0x06b2('0x22')](function(_0x1cc7b6){logger['error'](_0x06b2('0x23'),_0x1cc7b6['message'],_0x15a78b);_0x401551(_0x1cc725['error'](0x1f4,_0x1cc7b6[_0x06b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8c3eb7d..42d3a40 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 _0x839a=['create','put','update','delete','destroy','util','path','express','Router','fs-extra','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x8b416e,_0x1d8311){var _0x4b6d6a=function(_0x323480){while(--_0x323480){_0x8b416e['push'](_0x8b416e['shift']());}};_0x4b6d6a(++_0x1d8311);}(_0x839a,0x195));var _0xa839=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x839a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xa839('0x0'));var path=require(_0xa839('0x1'));var timeout=require('connect-timeout');var express=require(_0xa839('0x2'));var router=express[_0xa839('0x3')]();var fs_extra=require(_0xa839('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xa839('0x5')]('/',auth[_0xa839('0x6')](),controller[_0xa839('0x7')]);router['get'](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x9')]);router[_0xa839('0x5')](_0xa839('0xa'),auth[_0xa839('0x6')](),controller['getFields']);router['get'](_0xa839('0xb'),auth[_0xa839('0x6')](),controller[_0xa839('0xc')]);router[_0xa839('0x5')](_0xa839('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa839('0xe')]('/',auth['isAuthenticated'](),controller[_0xa839('0xf')]);router[_0xa839('0x10')](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x11')]);router[_0xa839('0x12')](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf36b=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','util','path'];(function(_0x3e3fde,_0x418b27){var _0x6a2763=function(_0xc6a42a){while(--_0xc6a42a){_0x3e3fde['push'](_0x3e3fde['shift']());}};_0x6a2763(++_0x418b27);}(_0xf36b,0x132));var _0xbf36=function(_0x1d6224,_0x5575ed){_0x1d6224=_0x1d6224-0x0;var _0x19e0fc=_0xf36b[_0x1d6224];return _0x19e0fc;};'use strict';var multer=require('multer');var util=require(_0xbf36('0x0'));var path=require(_0xbf36('0x1'));var timeout=require(_0xbf36('0x2'));var express=require('express');var router=express[_0xbf36('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf36('0x4'));var config=require(_0xbf36('0x5'));var controller=require(_0xbf36('0x6'));router[_0xbf36('0x7')]('/',auth['isAuthenticated'](),controller[_0xbf36('0x8')]);router['get'](_0xbf36('0x9'),auth[_0xbf36('0xa')](),controller[_0xbf36('0xb')]);router[_0xbf36('0x7')](_0xbf36('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xbf36('0x7')](_0xbf36('0xd'),auth[_0xbf36('0xa')](),controller[_0xbf36('0xe')]);router['get'](_0xbf36('0xf'),auth[_0xbf36('0xa')](),controller['getDescriptions']);router[_0xbf36('0x10')]('/',auth[_0xbf36('0xa')](),controller['create']);router[_0xbf36('0x11')](_0xbf36('0x9'),auth[_0xbf36('0xa')](),controller[_0xbf36('0x12')]);router[_0xbf36('0x13')]('/:id',auth[_0xbf36('0xa')](),controller[_0xbf36('0x14')]);module[_0xbf36('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 49eb18b..b4455a6 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 _0x53db=['exports','STRING'];(function(_0x5df900,_0x31dec5){var _0x3868fa=function(_0x31f45c){while(--_0x31f45c){_0x5df900['push'](_0x5df900['shift']());}};_0x3868fa(++_0x31dec5);}(_0x53db,0x104));var _0xb53d=function(_0x1030ad,_0x326fcf){_0x1030ad=_0x1030ad-0x0;var _0x209705=_0x53db[_0x1030ad];return _0x209705;};'use strict';var Sequelize=require('sequelize');module[_0xb53d('0x0')]={'name':{'type':Sequelize[_0xb53d('0x1')]},'description':{'type':Sequelize[_0xb53d('0x1')]}}; \ No newline at end of file +var _0x981a=['sequelize','STRING'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x981a,0xb8));var _0xa981=function(_0x1b84a2,_0x19da32){_0x1b84a2=_0x1b84a2-0x0;var _0xfca251=_0x981a[_0x1b84a2];return _0xfca251;};'use strict';var Sequelize=require(_0xa981('0x0'));module['exports']={'name':{'type':Sequelize[_0xa981('0x1')]},'description':{'type':Sequelize[_0xa981('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 07fffb8..37ada73 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 _0x319c=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','VtigerConfiguration','includeAll','include','catch','show','params','find','create','body','getFields','VtigerField','nolimit','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count'];(function(_0x4e0918,_0x18df35){var _0x55f850=function(_0x2d764a){while(--_0x2d764a){_0x4e0918['push'](_0x4e0918['shift']());}};_0x55f850(++_0x18df35);}(_0x319c,0x1d9));var _0xc319=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x319c[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0xc319('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc319('0x1'));var jsonpatch=require(_0xc319('0x2'));var rp=require(_0xc319('0x3'));var moment=require('moment');var BPromise=require(_0xc319('0x4'));var Mustache=require(_0xc319('0x5'));var util=require(_0xc319('0x6'));var path=require(_0xc319('0x7'));var sox=require(_0xc319('0x8'));var csv=require(_0xc319('0x9'));var ejs=require(_0xc319('0xa'));var fs=require('fs');var fs_extra=require(_0xc319('0xb'));var _=require(_0xc319('0xc'));var squel=require(_0xc319('0xd'));var crypto=require(_0xc319('0xe'));var jsforce=require(_0xc319('0xf'));var deskjs=require(_0xc319('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc319('0x11'));var Papa=require(_0xc319('0x12'));var Redis=require(_0xc319('0x13'));var authService=require(_0xc319('0x14'));var qs=require(_0xc319('0x15'));var as=require(_0xc319('0x16'));var hardwareService=require(_0xc319('0x17'));var logger=require(_0xc319('0x18'))(_0xc319('0x19'));var utils=require(_0xc319('0x1a'));var config=require(_0xc319('0x1b'));var licenseUtil=require(_0xc319('0x1c'));var db=require(_0xc319('0x1d'))['db'];function respondWithStatusCode(_0x1c1b8a,_0xa2a16b){_0xa2a16b=_0xa2a16b||0xcc;return function(_0x277741){if(_0x277741){return _0x1c1b8a['sendStatus'](_0xa2a16b);}return _0x1c1b8a[_0xc319('0x1e')](_0xa2a16b)[_0xc319('0x1f')]();};}function respondWithResult(_0x3a2833,_0x1615b2){_0x1615b2=_0x1615b2||0xc8;return function(_0x3ea965){if(_0x3ea965){return _0x3a2833[_0xc319('0x1e')](_0x1615b2)[_0xc319('0x20')](_0x3ea965);}};}function respondWithFilteredResult(_0x5183c7,_0x4ff6cd){return function(_0x431c63){if(_0x431c63){var _0x5451dc=typeof _0x4ff6cd['offset']===_0xc319('0x21')&&typeof _0x4ff6cd[_0xc319('0x22')]===_0xc319('0x21');var _0x13242b=_0x431c63['count'];var _0x43cb3b=_0x5451dc?0x0:_0x4ff6cd[_0xc319('0x23')];var _0x3c0dda=_0x5451dc?_0x431c63[_0xc319('0x24')]:_0x4ff6cd[_0xc319('0x23')]+_0x4ff6cd[_0xc319('0x22')];var _0x4d8b11;if(_0x3c0dda>=_0x13242b){_0x3c0dda=_0x13242b;_0x4d8b11=0xc8;}else{_0x4d8b11=0xce;}_0x5183c7[_0xc319('0x1e')](_0x4d8b11);return _0x5183c7[_0xc319('0x25')](_0xc319('0x26'),_0x43cb3b+'-'+_0x3c0dda+'/'+_0x13242b)[_0xc319('0x20')](_0x431c63);}return null;};}function patchUpdates(_0x426618){return function(_0x378963){try{jsonpatch[_0xc319('0x27')](_0x378963,_0x426618,!![]);}catch(_0xbbc1b9){return BPromise[_0xc319('0x28')](_0xbbc1b9);}return _0x378963[_0xc319('0x29')]();};}function saveUpdates(_0x3cb3ac,_0x59315c){return function(_0x587adc){if(_0x587adc){return _0x587adc[_0xc319('0x2a')](_0x3cb3ac)[_0xc319('0x2b')](function(_0x38eb0e){return _0x38eb0e;});}return null;};}function removeEntity(_0x35d5d3,_0xc13131){return function(_0x1ae0b8){if(_0x1ae0b8){return _0x1ae0b8[_0xc319('0x2c')]()[_0xc319('0x2b')](function(){_0x35d5d3[_0xc319('0x1e')](0xcc)[_0xc319('0x1f')]();});}};}function handleEntityNotFound(_0x1c9d84,_0x570104){return function(_0x1aa2e9){if(!_0x1aa2e9){_0x1c9d84['sendStatus'](0x194);}return _0x1aa2e9;};}function handleError(_0x10eee8,_0x5f2fcc){_0x5f2fcc=_0x5f2fcc||0x1f4;return function(_0x303e80){logger['error'](_0x303e80[_0xc319('0x2d')]);if(_0x303e80['name']){delete _0x303e80[_0xc319('0x2e')];}_0x10eee8[_0xc319('0x1e')](_0x5f2fcc)['send'](_0x303e80);};}exports[_0xc319('0x2f')]=function(_0x387caf,_0x310485){var _0x2f5ea5={},_0x5b4f71={},_0x4337d5={'count':0x0,'rows':[]};var _0x3e5082=_[_0xc319('0x30')](db['VtigerConfiguration'][_0xc319('0x31')],function(_0x2b3f60){return{'name':_0x2b3f60[_0xc319('0x32')],'type':_0x2b3f60[_0xc319('0x33')][_0xc319('0x34')]};});_0x5b4f71[_0xc319('0x35')]=_[_0xc319('0x30')](_0x3e5082,_0xc319('0x2e'));_0x5b4f71[_0xc319('0x36')]=_[_0xc319('0x37')](_0x387caf[_0xc319('0x36')]);_0x5b4f71['filters']=_[_0xc319('0x38')](_0x5b4f71[_0xc319('0x35')],_0x5b4f71[_0xc319('0x36')]);_0x2f5ea5[_0xc319('0x39')]=_[_0xc319('0x38')](_0x5b4f71['model'],qs[_0xc319('0x3a')](_0x387caf[_0xc319('0x36')][_0xc319('0x3a')]));_0x2f5ea5['attributes']=_0x2f5ea5[_0xc319('0x39')][_0xc319('0x3b')]?_0x2f5ea5['attributes']:_0x5b4f71[_0xc319('0x35')];if(!_0x387caf[_0xc319('0x36')][_0xc319('0x3c')]('nolimit')){_0x2f5ea5[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x387caf[_0xc319('0x36')]['limit']);_0x2f5ea5[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x387caf[_0xc319('0x36')][_0xc319('0x23')]);}_0x2f5ea5[_0xc319('0x3d')]=qs[_0xc319('0x3e')](_0x387caf['query'][_0xc319('0x3e')]);_0x2f5ea5['where']=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x387caf['query'],_0x5b4f71[_0xc319('0x3f')]),_0x3e5082);if(_0x387caf[_0xc319('0x36')]['filter']){_0x2f5ea5[_0xc319('0x41')]=_['merge'](_0x2f5ea5[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x3e5082,function(_0x50105f){if(_0x50105f[_0xc319('0x33')]!==_0xc319('0x42')){var _0x32e1a6={};_0x32e1a6[_0x50105f['name']]={'$like':'%'+_0x387caf[_0xc319('0x36')][_0xc319('0x43')]+'%'};return _0x32e1a6;}})});}_0x2f5ea5=_[_0xc319('0x44')]({},_0x2f5ea5,_0x387caf[_0xc319('0x45')]);var _0x3f58f0={'where':_0x2f5ea5['where']};return db[_0xc319('0x46')][_0xc319('0x24')](_0x3f58f0)['then'](function(_0x450934){_0x4337d5['count']=_0x450934;if(_0x387caf[_0xc319('0x36')][_0xc319('0x47')]){_0x2f5ea5[_0xc319('0x48')]=[{'all':!![]}];}return db[_0xc319('0x46')]['findAll'](_0x2f5ea5);})[_0xc319('0x2b')](function(_0x53dbb3){_0x4337d5['rows']=_0x53dbb3;return _0x4337d5;})['then'](respondWithFilteredResult(_0x310485,_0x2f5ea5))[_0xc319('0x49')](handleError(_0x310485,null));};exports[_0xc319('0x4a')]=function(_0x55b25d,_0x1a26eb){var _0x34c537={'raw':![],'where':{'id':_0x55b25d[_0xc319('0x4b')]['id']}},_0x2373c7={};_0x2373c7[_0xc319('0x35')]=_[_0xc319('0x37')](db[_0xc319('0x46')][_0xc319('0x31')]);_0x2373c7[_0xc319('0x36')]=_[_0xc319('0x37')](_0x55b25d['query']);_0x2373c7[_0xc319('0x3f')]=_[_0xc319('0x38')](_0x2373c7[_0xc319('0x35')],_0x2373c7[_0xc319('0x36')]);_0x34c537[_0xc319('0x39')]=_[_0xc319('0x38')](_0x2373c7[_0xc319('0x35')],qs['fields'](_0x55b25d[_0xc319('0x36')][_0xc319('0x3a')]));_0x34c537['attributes']=_0x34c537['attributes'][_0xc319('0x3b')]?_0x34c537[_0xc319('0x39')]:_0x2373c7[_0xc319('0x35')];if(_0x55b25d['query'][_0xc319('0x47')]){_0x34c537['include']=[{'all':!![]}];}_0x34c537=_['merge']({},_0x34c537,_0x55b25d[_0xc319('0x45')]);return db[_0xc319('0x46')][_0xc319('0x4c')](_0x34c537)['then'](handleEntityNotFound(_0x1a26eb,null))[_0xc319('0x2b')](respondWithResult(_0x1a26eb,null))[_0xc319('0x49')](handleError(_0x1a26eb,null));};exports['create']=function(_0x27ab06,_0x23467f){return db['VtigerConfiguration'][_0xc319('0x4d')](_0x27ab06[_0xc319('0x4e')],{})[_0xc319('0x2b')](respondWithResult(_0x23467f,0xc9))[_0xc319('0x49')](handleError(_0x23467f,null));};exports[_0xc319('0x2a')]=function(_0x3a3b70,_0x606308){if(_0x3a3b70[_0xc319('0x4e')]['id']){delete _0x3a3b70[_0xc319('0x4e')]['id'];}return db[_0xc319('0x46')][_0xc319('0x4c')]({'where':{'id':_0x3a3b70[_0xc319('0x4b')]['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x606308,null))[_0xc319('0x2b')](saveUpdates(_0x3a3b70[_0xc319('0x4e')],null))['then'](respondWithResult(_0x606308,null))[_0xc319('0x49')](handleError(_0x606308,null));};exports['destroy']=function(_0x17dea8,_0x23fc3b){return db[_0xc319('0x46')]['find']({'where':{'id':_0x17dea8['params']['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x23fc3b,null))[_0xc319('0x2b')](removeEntity(_0x23fc3b,null))['catch'](handleError(_0x23fc3b,null));};exports[_0xc319('0x4f')]=function(_0x2f0004,_0x34ea90,_0xaebe1e){var _0x5f2fe7={};var _0x119df7={};var _0x1e26f0;var _0x35711b;return db[_0xc319('0x46')]['findOne']({'where':{'id':_0x2f0004[_0xc319('0x4b')]['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x34ea90,null))['then'](function(_0x3ed985){if(_0x3ed985){_0x1e26f0=_0x3ed985;_0x119df7[_0xc319('0x35')]=_[_0xc319('0x37')](db[_0xc319('0x50')][_0xc319('0x31')]);_0x119df7[_0xc319('0x36')]=_[_0xc319('0x37')](_0x2f0004[_0xc319('0x36')]);_0x119df7['filters']=_[_0xc319('0x38')](_0x119df7['model'],_0x119df7['query']);_0x5f2fe7[_0xc319('0x39')]=_[_0xc319('0x38')](_0x119df7['model'],qs[_0xc319('0x3a')](_0x2f0004['query'][_0xc319('0x3a')]));_0x5f2fe7[_0xc319('0x39')]=_0x5f2fe7[_0xc319('0x39')][_0xc319('0x3b')]?_0x5f2fe7[_0xc319('0x39')]:_0x119df7[_0xc319('0x35')];_0x5f2fe7['order']=qs[_0xc319('0x3e')](_0x2f0004[_0xc319('0x36')][_0xc319('0x3e')]);_0x5f2fe7[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x2f0004[_0xc319('0x36')],_0x119df7[_0xc319('0x3f')]));if(_0x2f0004[_0xc319('0x36')][_0xc319('0x43')]){_0x5f2fe7['where']=_[_0xc319('0x44')](_0x5f2fe7[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x5f2fe7[_0xc319('0x39')],function(_0x11bcb4){var _0x4172b0={};_0x4172b0[_0x11bcb4]={'$like':'%'+_0x2f0004[_0xc319('0x36')][_0xc319('0x43')]+'%'};return _0x4172b0;})});}_0x5f2fe7=_[_0xc319('0x44')]({},_0x5f2fe7,_0x2f0004[_0xc319('0x45')]);return _0x1e26f0[_0xc319('0x4f')](_0x5f2fe7);}})[_0xc319('0x2b')](function(_0xbebefa){if(_0xbebefa){_0x35711b=_0xbebefa[_0xc319('0x3b')];if(!_0x2f0004['query']['hasOwnProperty'](_0xc319('0x51'))){_0x5f2fe7[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x2f0004[_0xc319('0x36')][_0xc319('0x22')]);_0x5f2fe7[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x2f0004[_0xc319('0x36')][_0xc319('0x23')]);}return _0x1e26f0[_0xc319('0x4f')](_0x5f2fe7);}})[_0xc319('0x2b')](function(_0x505e48){if(_0x505e48){return _0x505e48?{'count':_0x35711b,'rows':_0x505e48}:null;}})['then'](respondWithResult(_0x34ea90,null))[_0xc319('0x49')](handleError(_0x34ea90,null));};exports['getSubjects']=function(_0x4a5777,_0x3d2ceb,_0x50f4af){var _0x50c298={};var _0x4786b1={};var _0x51162f;var _0x108230;return db[_0xc319('0x46')]['findOne']({'where':{'id':_0x4a5777['params']['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x3d2ceb,null))[_0xc319('0x2b')](function(_0x2f5225){if(_0x2f5225){_0x51162f=_0x2f5225;_0x4786b1[_0xc319('0x35')]=_[_0xc319('0x37')](db['VtigerField'][_0xc319('0x31')]);_0x4786b1[_0xc319('0x36')]=_[_0xc319('0x37')](_0x4a5777[_0xc319('0x36')]);_0x4786b1[_0xc319('0x3f')]=_[_0xc319('0x38')](_0x4786b1['model'],_0x4786b1[_0xc319('0x36')]);_0x50c298[_0xc319('0x39')]=_[_0xc319('0x38')](_0x4786b1[_0xc319('0x35')],qs['fields'](_0x4a5777[_0xc319('0x36')][_0xc319('0x3a')]));_0x50c298['attributes']=_0x50c298[_0xc319('0x39')][_0xc319('0x3b')]?_0x50c298[_0xc319('0x39')]:_0x4786b1[_0xc319('0x35')];_0x50c298['order']=qs[_0xc319('0x3e')](_0x4a5777['query'][_0xc319('0x3e')]);_0x50c298[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x4a5777['query'],_0x4786b1[_0xc319('0x3f')]));if(_0x4a5777[_0xc319('0x36')][_0xc319('0x43')]){_0x50c298[_0xc319('0x41')]=_[_0xc319('0x44')](_0x50c298[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x50c298[_0xc319('0x39')],function(_0x57003a){var _0x320df2={};_0x320df2[_0x57003a]={'$like':'%'+_0x4a5777[_0xc319('0x36')]['filter']+'%'};return _0x320df2;})});}_0x50c298=_[_0xc319('0x44')]({},_0x50c298,_0x4a5777[_0xc319('0x45')]);return _0x51162f[_0xc319('0x52')](_0x50c298);}})[_0xc319('0x2b')](function(_0x19a652){if(_0x19a652){_0x108230=_0x19a652[_0xc319('0x3b')];if(!_0x4a5777[_0xc319('0x36')]['hasOwnProperty'](_0xc319('0x51'))){_0x50c298[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x4a5777[_0xc319('0x36')]['limit']);_0x50c298[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x4a5777[_0xc319('0x36')][_0xc319('0x23')]);}return _0x51162f['getSubjects'](_0x50c298);}})[_0xc319('0x2b')](function(_0x28b5d8){if(_0x28b5d8){return _0x28b5d8?{'count':_0x108230,'rows':_0x28b5d8}:null;}})[_0xc319('0x2b')](respondWithResult(_0x3d2ceb,null))[_0xc319('0x49')](handleError(_0x3d2ceb,null));};exports[_0xc319('0x53')]=function(_0x278278,_0x40b586,_0x1bc251){var _0x371e8f={};var _0x342fa5={};var _0x5be577;var _0x465cda;return db[_0xc319('0x46')][_0xc319('0x54')]({'where':{'id':_0x278278['params']['id']}})['then'](handleEntityNotFound(_0x40b586,null))[_0xc319('0x2b')](function(_0x43b7ea){if(_0x43b7ea){_0x5be577=_0x43b7ea;_0x342fa5['model']=_['keys'](db['VtigerField'][_0xc319('0x31')]);_0x342fa5['query']=_[_0xc319('0x37')](_0x278278[_0xc319('0x36')]);_0x342fa5['filters']=_[_0xc319('0x38')](_0x342fa5[_0xc319('0x35')],_0x342fa5[_0xc319('0x36')]);_0x371e8f[_0xc319('0x39')]=_[_0xc319('0x38')](_0x342fa5[_0xc319('0x35')],qs[_0xc319('0x3a')](_0x278278[_0xc319('0x36')][_0xc319('0x3a')]));_0x371e8f[_0xc319('0x39')]=_0x371e8f[_0xc319('0x39')][_0xc319('0x3b')]?_0x371e8f[_0xc319('0x39')]:_0x342fa5[_0xc319('0x35')];_0x371e8f[_0xc319('0x3d')]=qs['sort'](_0x278278[_0xc319('0x36')][_0xc319('0x3e')]);_0x371e8f[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x278278[_0xc319('0x36')],_0x342fa5['filters']));if(_0x278278[_0xc319('0x36')][_0xc319('0x43')]){_0x371e8f[_0xc319('0x41')]=_['merge'](_0x371e8f[_0xc319('0x41')],{'$or':_['map'](_0x371e8f['attributes'],function(_0x5d559f){var _0x53144b={};_0x53144b[_0x5d559f]={'$like':'%'+_0x278278[_0xc319('0x36')]['filter']+'%'};return _0x53144b;})});}_0x371e8f=_[_0xc319('0x44')]({},_0x371e8f,_0x278278[_0xc319('0x45')]);return _0x5be577[_0xc319('0x53')](_0x371e8f);}})[_0xc319('0x2b')](function(_0x3ec55d){if(_0x3ec55d){_0x465cda=_0x3ec55d[_0xc319('0x3b')];if(!_0x278278[_0xc319('0x36')][_0xc319('0x3c')]('nolimit')){_0x371e8f[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x278278[_0xc319('0x36')]['limit']);_0x371e8f[_0xc319('0x23')]=qs['offset'](_0x278278[_0xc319('0x36')]['offset']);}return _0x5be577[_0xc319('0x53')](_0x371e8f);}})[_0xc319('0x2b')](function(_0x1a60ce){if(_0x1a60ce){return _0x1a60ce?{'count':_0x465cda,'rows':_0x1a60ce}:null;}})[_0xc319('0x2b')](respondWithResult(_0x40b586,null))['catch'](handleError(_0x40b586,null));}; \ No newline at end of file +var _0x02c7=['index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','params','find','create','body','catch','getFields','getSubjects','getDescriptions','findOne','VtigerField','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x02c7,0xcb));var _0x702c=function(_0x26cf71,_0x526a1f){_0x26cf71=_0x26cf71-0x0;var _0x2f6a2d=_0x02c7[_0x26cf71];return _0x2f6a2d;};'use strict';var emlformat=require(_0x702c('0x0'));var rimraf=require(_0x702c('0x1'));var zipdir=require(_0x702c('0x2'));var jsonpatch=require(_0x702c('0x3'));var rp=require('request-promise');var moment=require(_0x702c('0x4'));var BPromise=require(_0x702c('0x5'));var Mustache=require(_0x702c('0x6'));var util=require(_0x702c('0x7'));var path=require('path');var sox=require(_0x702c('0x8'));var csv=require(_0x702c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702c('0xa'));var squel=require(_0x702c('0xb'));var crypto=require(_0x702c('0xc'));var jsforce=require(_0x702c('0xd'));var deskjs=require(_0x702c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x702c('0xf'));var Redis=require(_0x702c('0x10'));var authService=require(_0x702c('0x11'));var qs=require(_0x702c('0x12'));var as=require(_0x702c('0x13'));var hardwareService=require(_0x702c('0x14'));var logger=require(_0x702c('0x15'))(_0x702c('0x16'));var utils=require(_0x702c('0x17'));var config=require(_0x702c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x702c('0x19'))['db'];function respondWithStatusCode(_0x422bc1,_0x8cb558){_0x8cb558=_0x8cb558||0xcc;return function(_0x3f4f53){if(_0x3f4f53){return _0x422bc1[_0x702c('0x1a')](_0x8cb558);}return _0x422bc1[_0x702c('0x1b')](_0x8cb558)[_0x702c('0x1c')]();};}function respondWithResult(_0x3de182,_0x11504c){_0x11504c=_0x11504c||0xc8;return function(_0x424993){if(_0x424993){return _0x3de182['status'](_0x11504c)[_0x702c('0x1d')](_0x424993);}};}function respondWithFilteredResult(_0x330457,_0x6243bb){return function(_0x488d23){if(_0x488d23){var _0x3f0898=typeof _0x6243bb[_0x702c('0x1e')]===_0x702c('0x1f')&&typeof _0x6243bb[_0x702c('0x20')]===_0x702c('0x1f');var _0x53c81f=_0x488d23[_0x702c('0x21')];var _0x458e03=_0x3f0898?0x0:_0x6243bb[_0x702c('0x1e')];var _0x46cb04=_0x3f0898?_0x488d23[_0x702c('0x21')]:_0x6243bb[_0x702c('0x1e')]+_0x6243bb[_0x702c('0x20')];var _0x4ebf3a;if(_0x46cb04>=_0x53c81f){_0x46cb04=_0x53c81f;_0x4ebf3a=0xc8;}else{_0x4ebf3a=0xce;}_0x330457['status'](_0x4ebf3a);return _0x330457[_0x702c('0x22')]('Content-Range',_0x458e03+'-'+_0x46cb04+'/'+_0x53c81f)[_0x702c('0x1d')](_0x488d23);}return null;};}function patchUpdates(_0x5abce1){return function(_0x150efd){try{jsonpatch[_0x702c('0x23')](_0x150efd,_0x5abce1,!![]);}catch(_0x1f8ca6){return BPromise[_0x702c('0x24')](_0x1f8ca6);}return _0x150efd['save']();};}function saveUpdates(_0x47032e,_0x501f8f){return function(_0x39c6f6){if(_0x39c6f6){return _0x39c6f6[_0x702c('0x25')](_0x47032e)[_0x702c('0x26')](function(_0x50f670){return _0x50f670;});}return null;};}function removeEntity(_0x3db271,_0x47f42d){return function(_0x3f2981){if(_0x3f2981){return _0x3f2981[_0x702c('0x27')]()[_0x702c('0x26')](function(){_0x3db271[_0x702c('0x1b')](0xcc)[_0x702c('0x1c')]();});}};}function handleEntityNotFound(_0x2e3a04,_0x2fa67e){return function(_0x4719d8){if(!_0x4719d8){_0x2e3a04['sendStatus'](0x194);}return _0x4719d8;};}function handleError(_0x3f6ec9,_0x13a114){_0x13a114=_0x13a114||0x1f4;return function(_0x3efec5){logger['error'](_0x3efec5[_0x702c('0x28')]);if(_0x3efec5[_0x702c('0x29')]){delete _0x3efec5[_0x702c('0x29')];}_0x3f6ec9[_0x702c('0x1b')](_0x13a114)[_0x702c('0x2a')](_0x3efec5);};}exports[_0x702c('0x2b')]=function(_0x353f00,_0x345983){var _0xf83d52={},_0x344d4d={},_0x2b811c={'count':0x0,'rows':[]};var _0x3889d1=_[_0x702c('0x2c')](db['VtigerConfiguration'][_0x702c('0x2d')],function(_0x4f6cf4){return{'name':_0x4f6cf4[_0x702c('0x2e')],'type':_0x4f6cf4[_0x702c('0x2f')][_0x702c('0x30')]};});_0x344d4d[_0x702c('0x31')]=_[_0x702c('0x2c')](_0x3889d1,_0x702c('0x29'));_0x344d4d['query']=_[_0x702c('0x32')](_0x353f00[_0x702c('0x33')]);_0x344d4d[_0x702c('0x34')]=_['intersection'](_0x344d4d[_0x702c('0x31')],_0x344d4d[_0x702c('0x33')]);_0xf83d52['attributes']=_[_0x702c('0x35')](_0x344d4d['model'],qs['fields'](_0x353f00[_0x702c('0x33')][_0x702c('0x36')]));_0xf83d52[_0x702c('0x37')]=_0xf83d52[_0x702c('0x37')][_0x702c('0x38')]?_0xf83d52[_0x702c('0x37')]:_0x344d4d['model'];if(!_0x353f00['query'][_0x702c('0x39')](_0x702c('0x3a'))){_0xf83d52[_0x702c('0x20')]=qs[_0x702c('0x20')](_0x353f00['query'][_0x702c('0x20')]);_0xf83d52[_0x702c('0x1e')]=qs['offset'](_0x353f00[_0x702c('0x33')][_0x702c('0x1e')]);}_0xf83d52[_0x702c('0x3b')]=qs['sort'](_0x353f00[_0x702c('0x33')][_0x702c('0x3c')]);_0xf83d52[_0x702c('0x3d')]=qs[_0x702c('0x34')](_[_0x702c('0x3e')](_0x353f00[_0x702c('0x33')],_0x344d4d['filters']),_0x3889d1);if(_0x353f00[_0x702c('0x33')][_0x702c('0x3f')]){_0xf83d52[_0x702c('0x3d')]=_[_0x702c('0x40')](_0xf83d52[_0x702c('0x3d')],{'$or':_['map'](_0x3889d1,function(_0x33c495){if(_0x33c495[_0x702c('0x2f')]!==_0x702c('0x41')){var _0x10368c={};_0x10368c[_0x33c495[_0x702c('0x29')]]={'$like':'%'+_0x353f00[_0x702c('0x33')][_0x702c('0x3f')]+'%'};return _0x10368c;}})});}_0xf83d52=_['merge']({},_0xf83d52,_0x353f00[_0x702c('0x42')]);var _0x39d785={'where':_0xf83d52[_0x702c('0x3d')]};return db[_0x702c('0x43')]['count'](_0x39d785)[_0x702c('0x26')](function(_0x53976e){_0x2b811c[_0x702c('0x21')]=_0x53976e;if(_0x353f00[_0x702c('0x33')][_0x702c('0x44')]){_0xf83d52[_0x702c('0x45')]=[{'all':!![]}];}return db[_0x702c('0x43')][_0x702c('0x46')](_0xf83d52);})['then'](function(_0x4d9091){_0x2b811c[_0x702c('0x47')]=_0x4d9091;return _0x2b811c;})[_0x702c('0x26')](respondWithFilteredResult(_0x345983,_0xf83d52))['catch'](handleError(_0x345983,null));};exports['show']=function(_0x47486c,_0x582ef2){var _0x3c8a33={'raw':![],'where':{'id':_0x47486c[_0x702c('0x48')]['id']}},_0x104ecc={};_0x104ecc['model']=_[_0x702c('0x32')](db[_0x702c('0x43')][_0x702c('0x2d')]);_0x104ecc[_0x702c('0x33')]=_[_0x702c('0x32')](_0x47486c[_0x702c('0x33')]);_0x104ecc[_0x702c('0x34')]=_[_0x702c('0x35')](_0x104ecc[_0x702c('0x31')],_0x104ecc[_0x702c('0x33')]);_0x3c8a33[_0x702c('0x37')]=_[_0x702c('0x35')](_0x104ecc[_0x702c('0x31')],qs[_0x702c('0x36')](_0x47486c['query'][_0x702c('0x36')]));_0x3c8a33[_0x702c('0x37')]=_0x3c8a33[_0x702c('0x37')][_0x702c('0x38')]?_0x3c8a33['attributes']:_0x104ecc[_0x702c('0x31')];if(_0x47486c[_0x702c('0x33')][_0x702c('0x44')]){_0x3c8a33[_0x702c('0x45')]=[{'all':!![]}];}_0x3c8a33=_[_0x702c('0x40')]({},_0x3c8a33,_0x47486c[_0x702c('0x42')]);return db[_0x702c('0x43')][_0x702c('0x49')](_0x3c8a33)[_0x702c('0x26')](handleEntityNotFound(_0x582ef2,null))[_0x702c('0x26')](respondWithResult(_0x582ef2,null))['catch'](handleError(_0x582ef2,null));};exports[_0x702c('0x4a')]=function(_0x373558,_0x21e44f){return db[_0x702c('0x43')][_0x702c('0x4a')](_0x373558[_0x702c('0x4b')],{})[_0x702c('0x26')](respondWithResult(_0x21e44f,0xc9))['catch'](handleError(_0x21e44f,null));};exports[_0x702c('0x25')]=function(_0x31a83d,_0x71f6c2){if(_0x31a83d[_0x702c('0x4b')]['id']){delete _0x31a83d['body']['id'];}return db['VtigerConfiguration'][_0x702c('0x49')]({'where':{'id':_0x31a83d[_0x702c('0x48')]['id']}})[_0x702c('0x26')](handleEntityNotFound(_0x71f6c2,null))[_0x702c('0x26')](saveUpdates(_0x31a83d[_0x702c('0x4b')],null))['then'](respondWithResult(_0x71f6c2,null))[_0x702c('0x4c')](handleError(_0x71f6c2,null));};exports[_0x702c('0x27')]=function(_0x3e7f64,_0x3354cd){return db[_0x702c('0x43')][_0x702c('0x49')]({'where':{'id':_0x3e7f64['params']['id']}})[_0x702c('0x26')](handleEntityNotFound(_0x3354cd,null))[_0x702c('0x26')](removeEntity(_0x3354cd,null))[_0x702c('0x4c')](handleError(_0x3354cd,null));};exports['getFields']=function(_0x244af4,_0x1cdc76,_0x4b7278){var _0x3b9e07={};var _0x586884={};var _0x9fdd1a;var _0x4ad127;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x244af4[_0x702c('0x48')]['id']}})[_0x702c('0x26')](handleEntityNotFound(_0x1cdc76,null))[_0x702c('0x26')](function(_0x11d482){if(_0x11d482){_0x9fdd1a=_0x11d482;_0x586884['model']=_[_0x702c('0x32')](db['VtigerField'][_0x702c('0x2d')]);_0x586884[_0x702c('0x33')]=_[_0x702c('0x32')](_0x244af4['query']);_0x586884[_0x702c('0x34')]=_[_0x702c('0x35')](_0x586884[_0x702c('0x31')],_0x586884[_0x702c('0x33')]);_0x3b9e07[_0x702c('0x37')]=_[_0x702c('0x35')](_0x586884['model'],qs[_0x702c('0x36')](_0x244af4[_0x702c('0x33')][_0x702c('0x36')]));_0x3b9e07[_0x702c('0x37')]=_0x3b9e07[_0x702c('0x37')][_0x702c('0x38')]?_0x3b9e07[_0x702c('0x37')]:_0x586884[_0x702c('0x31')];_0x3b9e07[_0x702c('0x3b')]=qs[_0x702c('0x3c')](_0x244af4['query'][_0x702c('0x3c')]);_0x3b9e07[_0x702c('0x3d')]=qs[_0x702c('0x34')](_[_0x702c('0x3e')](_0x244af4['query'],_0x586884[_0x702c('0x34')]));if(_0x244af4[_0x702c('0x33')][_0x702c('0x3f')]){_0x3b9e07[_0x702c('0x3d')]=_[_0x702c('0x40')](_0x3b9e07[_0x702c('0x3d')],{'$or':_[_0x702c('0x2c')](_0x3b9e07[_0x702c('0x37')],function(_0xb8a85){var _0x1d3e25={};_0x1d3e25[_0xb8a85]={'$like':'%'+_0x244af4[_0x702c('0x33')][_0x702c('0x3f')]+'%'};return _0x1d3e25;})});}_0x3b9e07=_[_0x702c('0x40')]({},_0x3b9e07,_0x244af4['options']);return _0x9fdd1a['getFields'](_0x3b9e07);}})[_0x702c('0x26')](function(_0x4bd116){if(_0x4bd116){_0x4ad127=_0x4bd116[_0x702c('0x38')];if(!_0x244af4[_0x702c('0x33')][_0x702c('0x39')](_0x702c('0x3a'))){_0x3b9e07[_0x702c('0x20')]=qs[_0x702c('0x20')](_0x244af4['query'][_0x702c('0x20')]);_0x3b9e07[_0x702c('0x1e')]=qs[_0x702c('0x1e')](_0x244af4['query'][_0x702c('0x1e')]);}return _0x9fdd1a[_0x702c('0x4d')](_0x3b9e07);}})['then'](function(_0x44e743){if(_0x44e743){return _0x44e743?{'count':_0x4ad127,'rows':_0x44e743}:null;}})[_0x702c('0x26')](respondWithResult(_0x1cdc76,null))[_0x702c('0x4c')](handleError(_0x1cdc76,null));};exports[_0x702c('0x4e')]=function(_0x285caa,_0x8d39e7,_0x1eb8f2){var _0x19b4ff={};var _0x5b32a7={};var _0x592cfd;var _0x10decb;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x285caa['params']['id']}})['then'](handleEntityNotFound(_0x8d39e7,null))['then'](function(_0x2f161f){if(_0x2f161f){_0x592cfd=_0x2f161f;_0x5b32a7['model']=_['keys'](db['VtigerField'][_0x702c('0x2d')]);_0x5b32a7[_0x702c('0x33')]=_[_0x702c('0x32')](_0x285caa['query']);_0x5b32a7['filters']=_[_0x702c('0x35')](_0x5b32a7['model'],_0x5b32a7[_0x702c('0x33')]);_0x19b4ff['attributes']=_[_0x702c('0x35')](_0x5b32a7['model'],qs[_0x702c('0x36')](_0x285caa[_0x702c('0x33')][_0x702c('0x36')]));_0x19b4ff[_0x702c('0x37')]=_0x19b4ff[_0x702c('0x37')]['length']?_0x19b4ff[_0x702c('0x37')]:_0x5b32a7[_0x702c('0x31')];_0x19b4ff[_0x702c('0x3b')]=qs[_0x702c('0x3c')](_0x285caa[_0x702c('0x33')][_0x702c('0x3c')]);_0x19b4ff[_0x702c('0x3d')]=qs[_0x702c('0x34')](_['pick'](_0x285caa[_0x702c('0x33')],_0x5b32a7[_0x702c('0x34')]));if(_0x285caa[_0x702c('0x33')][_0x702c('0x3f')]){_0x19b4ff['where']=_[_0x702c('0x40')](_0x19b4ff['where'],{'$or':_[_0x702c('0x2c')](_0x19b4ff[_0x702c('0x37')],function(_0x4e169d){var _0x219213={};_0x219213[_0x4e169d]={'$like':'%'+_0x285caa[_0x702c('0x33')][_0x702c('0x3f')]+'%'};return _0x219213;})});}_0x19b4ff=_[_0x702c('0x40')]({},_0x19b4ff,_0x285caa[_0x702c('0x42')]);return _0x592cfd[_0x702c('0x4e')](_0x19b4ff);}})['then'](function(_0x129862){if(_0x129862){_0x10decb=_0x129862[_0x702c('0x38')];if(!_0x285caa['query'][_0x702c('0x39')](_0x702c('0x3a'))){_0x19b4ff[_0x702c('0x20')]=qs[_0x702c('0x20')](_0x285caa[_0x702c('0x33')][_0x702c('0x20')]);_0x19b4ff[_0x702c('0x1e')]=qs[_0x702c('0x1e')](_0x285caa['query'][_0x702c('0x1e')]);}return _0x592cfd['getSubjects'](_0x19b4ff);}})[_0x702c('0x26')](function(_0x384cc1){if(_0x384cc1){return _0x384cc1?{'count':_0x10decb,'rows':_0x384cc1}:null;}})[_0x702c('0x26')](respondWithResult(_0x8d39e7,null))['catch'](handleError(_0x8d39e7,null));};exports[_0x702c('0x4f')]=function(_0xdf3d,_0xefde7c,_0x48798e){var _0x1d5424={};var _0x34480e={};var _0x1b5ede;var _0x436d46;return db['VtigerConfiguration'][_0x702c('0x50')]({'where':{'id':_0xdf3d[_0x702c('0x48')]['id']}})[_0x702c('0x26')](handleEntityNotFound(_0xefde7c,null))[_0x702c('0x26')](function(_0x449624){if(_0x449624){_0x1b5ede=_0x449624;_0x34480e[_0x702c('0x31')]=_[_0x702c('0x32')](db[_0x702c('0x51')]['rawAttributes']);_0x34480e[_0x702c('0x33')]=_[_0x702c('0x32')](_0xdf3d[_0x702c('0x33')]);_0x34480e[_0x702c('0x34')]=_[_0x702c('0x35')](_0x34480e['model'],_0x34480e['query']);_0x1d5424[_0x702c('0x37')]=_[_0x702c('0x35')](_0x34480e[_0x702c('0x31')],qs[_0x702c('0x36')](_0xdf3d[_0x702c('0x33')]['fields']));_0x1d5424[_0x702c('0x37')]=_0x1d5424[_0x702c('0x37')]['length']?_0x1d5424[_0x702c('0x37')]:_0x34480e[_0x702c('0x31')];_0x1d5424[_0x702c('0x3b')]=qs[_0x702c('0x3c')](_0xdf3d[_0x702c('0x33')][_0x702c('0x3c')]);_0x1d5424[_0x702c('0x3d')]=qs[_0x702c('0x34')](_[_0x702c('0x3e')](_0xdf3d[_0x702c('0x33')],_0x34480e[_0x702c('0x34')]));if(_0xdf3d['query']['filter']){_0x1d5424[_0x702c('0x3d')]=_[_0x702c('0x40')](_0x1d5424[_0x702c('0x3d')],{'$or':_[_0x702c('0x2c')](_0x1d5424[_0x702c('0x37')],function(_0x4b8b19){var _0x13b051={};_0x13b051[_0x4b8b19]={'$like':'%'+_0xdf3d[_0x702c('0x33')][_0x702c('0x3f')]+'%'};return _0x13b051;})});}_0x1d5424=_[_0x702c('0x40')]({},_0x1d5424,_0xdf3d[_0x702c('0x42')]);return _0x1b5ede[_0x702c('0x4f')](_0x1d5424);}})[_0x702c('0x26')](function(_0xdc443f){if(_0xdc443f){_0x436d46=_0xdc443f[_0x702c('0x38')];if(!_0xdf3d[_0x702c('0x33')][_0x702c('0x39')](_0x702c('0x3a'))){_0x1d5424[_0x702c('0x20')]=qs['limit'](_0xdf3d[_0x702c('0x33')]['limit']);_0x1d5424[_0x702c('0x1e')]=qs['offset'](_0xdf3d[_0x702c('0x33')]['offset']);}return _0x1b5ede[_0x702c('0x4f')](_0x1d5424);}})[_0x702c('0x26')](function(_0x16bc14){if(_0x16bc14){return _0x16bc14?{'count':_0x436d46,'rows':_0x16bc14}:null;}})['then'](respondWithResult(_0xefde7c,null))[_0x702c('0x4c')](handleError(_0xefde7c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5bece2e..e554cff 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 _0x7197=['path','./intVtigerConfiguration.attributes','VtigerConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x2dcf7b,_0x2226df){var _0x38ff10=function(_0x3b3b02){while(--_0x3b3b02){_0x2dcf7b['push'](_0x2dcf7b['shift']());}};_0x38ff10(++_0x2226df);}(_0x7197,0xab));var _0x7719=function(_0xe88de0,_0x2e988a){_0xe88de0=_0xe88de0-0x0;var _0x1974b7=_0x7197[_0xe88de0];return _0x1974b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7719('0x0'))(_0x7719('0x1'));var moment=require(_0x7719('0x2'));var BPromise=require(_0x7719('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7719('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7719('0x5'));module['exports']=function(_0x49fab1,_0x58648f){return _0x49fab1['define'](_0x7719('0x6'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75b5=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xc08437,_0x4e7ba2){var _0x524d42=function(_0x880b72){while(--_0x880b72){_0xc08437['push'](_0xc08437['shift']());}};_0x524d42(++_0x4e7ba2);}(_0x75b5,0xba));var _0x575b=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x75b5[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x575b('0x0'));var util=require(_0x575b('0x1'));var logger=require(_0x575b('0x2'))(_0x575b('0x3'));var moment=require(_0x575b('0x4'));var BPromise=require('bluebird');var rp=require(_0x575b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x575b('0x6'));var config=require(_0x575b('0x7'));var attributes=require(_0x575b('0x8'));module['exports']=function(_0x54eca3,_0x34ce50){return _0x54eca3[_0x575b('0x9')](_0x575b('0xa'),attributes,{'tableName':_0x575b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 7163883..38257a7 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 _0x3ed7=['rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41aa44,_0x978bc3){var _0x576f08=function(_0x550249){while(--_0x550249){_0x41aa44['push'](_0x41aa44['shift']());}};_0x576f08(++_0x978bc3);}(_0x3ed7,0xb0));var _0x73ed=function(_0x51d4cd,_0x257ef9){_0x51d4cd=_0x51d4cd-0x0;var _0x3371db=_0x3ed7[_0x51d4cd];return _0x3371db;};'use strict';var _=require(_0x73ed('0x0'));var util=require(_0x73ed('0x1'));var moment=require(_0x73ed('0x2'));var BPromise=require(_0x73ed('0x3'));var rs=require(_0x73ed('0x4'));var fs=require('fs');var Redis=require(_0x73ed('0x5'));var db=require(_0x73ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ed('0x7'))(_0x73ed('0x8'));var config=require(_0x73ed('0x9'));var jayson=require(_0x73ed('0xa'));var client=jayson[_0x73ed('0xb')][_0x73ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30b177,_0x3e033a,_0x235285){return new BPromise(function(_0x14dccc,_0x2e07b1){return client['request'](_0x30b177,_0x235285)['then'](function(_0x55608f){logger[_0x73ed('0xd')](_0x73ed('0xe'),_0x3e033a,'request\x20sent');logger[_0x73ed('0xf')](_0x73ed('0x10'),_0x3e033a,'request\x20sent',JSON[_0x73ed('0x11')](_0x55608f));if(_0x55608f[_0x73ed('0x12')]){if(_0x55608f[_0x73ed('0x12')][_0x73ed('0x13')]===0x1f4){logger[_0x73ed('0x12')](_0x73ed('0xe'),_0x3e033a,_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);return _0x2e07b1(_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);}logger[_0x73ed('0x12')](_0x73ed('0xe'),_0x3e033a,_0x55608f[_0x73ed('0x12')]['message']);return _0x14dccc(_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);}else{logger[_0x73ed('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e033a,_0x73ed('0x15'));_0x14dccc(_0x55608f['result'][_0x73ed('0x14')]);}})[_0x73ed('0x16')](function(_0x356860){logger['error'](_0x73ed('0xe'),_0x3e033a,_0x356860);_0x2e07b1(_0x356860);});});} \ No newline at end of file +var _0x5c9b=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x422223,_0x40e47b){var _0xdb3b53=function(_0x492435){while(--_0x492435){_0x422223['push'](_0x422223['shift']());}};_0xdb3b53(++_0x40e47b);}(_0x5c9b,0x152));var _0xb5c9=function(_0x4b5685,_0x258c89){_0x4b5685=_0x4b5685-0x0;var _0x5df10f=_0x5c9b[_0x4b5685];return _0x5df10f;};'use strict';var _=require(_0xb5c9('0x0'));var util=require(_0xb5c9('0x1'));var moment=require(_0xb5c9('0x2'));var BPromise=require(_0xb5c9('0x3'));var rs=require(_0xb5c9('0x4'));var fs=require('fs');var Redis=require(_0xb5c9('0x5'));var db=require(_0xb5c9('0x6'))['db'];var utils=require(_0xb5c9('0x7'));var logger=require(_0xb5c9('0x8'))('rpc');var config=require(_0xb5c9('0x9'));var jayson=require(_0xb5c9('0xa'));var client=jayson[_0xb5c9('0xb')][_0xb5c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18cc08,_0x30cc4c,_0x53ff42){return new BPromise(function(_0x16dd2f,_0x2c796a){return client[_0xb5c9('0xd')](_0x18cc08,_0x53ff42)[_0xb5c9('0xe')](function(_0x30196c){logger[_0xb5c9('0xf')](_0xb5c9('0x10'),_0x30cc4c,'request\x20sent');logger[_0xb5c9('0x11')](_0xb5c9('0x12'),_0x30cc4c,'request\x20sent',JSON['stringify'](_0x30196c));if(_0x30196c[_0xb5c9('0x13')]){if(_0x30196c[_0xb5c9('0x13')][_0xb5c9('0x14')]===0x1f4){logger[_0xb5c9('0x13')](_0xb5c9('0x10'),_0x30cc4c,_0x30196c['error'][_0xb5c9('0x15')]);return _0x2c796a(_0x30196c[_0xb5c9('0x13')][_0xb5c9('0x15')]);}logger[_0xb5c9('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x30cc4c,_0x30196c[_0xb5c9('0x13')][_0xb5c9('0x15')]);return _0x16dd2f(_0x30196c['error'][_0xb5c9('0x15')]);}else{logger[_0xb5c9('0xf')](_0xb5c9('0x10'),_0x30cc4c,_0xb5c9('0x16'));_0x16dd2f(_0x30196c[_0xb5c9('0x17')][_0xb5c9('0x15')]);}})[_0xb5c9('0x18')](function(_0x2095ce){logger[_0xb5c9('0x13')](_0xb5c9('0x10'),_0x30cc4c,_0x2095ce);_0x2c796a(_0x2095ce);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e5d33f6..0ff5cf5 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 _0xbe9d=['post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x530455,_0x41da2d){var _0x128a27=function(_0x3152af){while(--_0x3152af){_0x530455['push'](_0x530455['shift']());}};_0x128a27(++_0x41da2d);}(_0xbe9d,0x166));var _0xdbe9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xbe9d[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0xdbe9('0x0'));var path=require(_0xdbe9('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbe9('0x2'));var router=express[_0xdbe9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdbe9('0x4'));var interaction=require(_0xdbe9('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth[_0xdbe9('0x6')](),controller[_0xdbe9('0x7')]);router[_0xdbe9('0x8')](_0xdbe9('0x9'),auth[_0xdbe9('0x6')](),controller['show']);router[_0xdbe9('0xa')]('/',auth[_0xdbe9('0x6')](),controller['create']);router[_0xdbe9('0xb')]('/:id',auth[_0xdbe9('0x6')](),controller[_0xdbe9('0xc')]);router[_0xdbe9('0xd')](_0xdbe9('0x9'),auth[_0xdbe9('0x6')](),controller[_0xdbe9('0xe')]);module[_0xdbe9('0xf')]=router; \ No newline at end of file +var _0xaaad=['index','/:id','show','post','create','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaad,0xce));var _0xdaaa=function(_0x3aaf46,_0x7798a7){_0x3aaf46=_0x3aaf46-0x0;var _0x5d6b32=_0xaaad[_0x3aaf46];return _0x5d6b32;};'use strict';var multer=require(_0xdaaa('0x0'));var util=require('util');var path=require(_0xdaaa('0x1'));var timeout=require(_0xdaaa('0x2'));var express=require(_0xdaaa('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdaaa('0x4'));var interaction=require(_0xdaaa('0x5'));var config=require(_0xdaaa('0x6'));var controller=require(_0xdaaa('0x7'));router[_0xdaaa('0x8')]('/',auth[_0xdaaa('0x9')](),controller[_0xdaaa('0xa')]);router['get'](_0xdaaa('0xb'),auth[_0xdaaa('0x9')](),controller[_0xdaaa('0xc')]);router[_0xdaaa('0xd')]('/',auth['isAuthenticated'](),controller[_0xdaaa('0xe')]);router['put'](_0xdaaa('0xb'),auth[_0xdaaa('0x9')](),controller[_0xdaaa('0xf')]);router['delete'](_0xdaaa('0xb'),auth[_0xdaaa('0x9')](),controller[_0xdaaa('0x10')]);module[_0xdaaa('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index fe7c6e8..b5f5803 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 _0x3657=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3657,0x1b7));var _0x7365=function(_0x312ff8,_0x5d7167){_0x312ff8=_0x312ff8-0x0;var _0x4e144b=_0x3657[_0x312ff8];return _0x4e144b;};'use strict';var Sequelize=require(_0x7365('0x0'));module['exports']={'type':{'type':Sequelize[_0x7365('0x1')](_0x7365('0x2'),'variable',_0x7365('0x3'),'keyValue',_0x7365('0x4')),'defaultValue':_0x7365('0x2')},'content':{'type':Sequelize[_0x7365('0x5')]},'key':{'type':Sequelize[_0x7365('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x7365('0x2'),_0x7365('0x6'),_0x7365('0x3'))},'keyContent':{'type':Sequelize[_0x7365('0x5')]},'idField':{'type':Sequelize[_0x7365('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7365('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7365('0x5')]}}; \ No newline at end of file +var _0xf4a3=['STRING','BOOLEAN','sequelize','exports','customVariable','string'];(function(_0x50809a,_0x13735f){var _0x2a3e33=function(_0x4b8d23){while(--_0x4b8d23){_0x50809a['push'](_0x50809a['shift']());}};_0x2a3e33(++_0x13735f);}(_0xf4a3,0x80));var _0x3f4a=function(_0x4849c8,_0x168515){_0x4849c8=_0x4849c8-0x0;var _0x29dc87=_0xf4a3[_0x4849c8];return _0x29dc87;};'use strict';var Sequelize=require(_0x3f4a('0x0'));module[_0x3f4a('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x3f4a('0x2'),'keyValue','picklist'),'defaultValue':_0x3f4a('0x3')},'content':{'type':Sequelize[_0x3f4a('0x4')]},'key':{'type':Sequelize[_0x3f4a('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3f4a('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3f4a('0x4')]},'customField':{'type':Sequelize[_0x3f4a('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f4a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 38ced7b..219941f 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 _0xea20=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch'];(function(_0x3237ef,_0x5a7dc0){var _0x3c9576=function(_0x5362eb){while(--_0x5362eb){_0x3237ef['push'](_0x3237ef['shift']());}};_0x3c9576(++_0x5a7dc0);}(_0xea20,0x129));var _0x0ea2=function(_0x2532cd,_0x36cbaa){_0x2532cd=_0x2532cd-0x0;var _0x1ad033=_0xea20[_0x2532cd];return _0x1ad033;};'use strict';var emlformat=require(_0x0ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ea2('0x1'));var jsonpatch=require(_0x0ea2('0x2'));var rp=require(_0x0ea2('0x3'));var moment=require(_0x0ea2('0x4'));var BPromise=require(_0x0ea2('0x5'));var Mustache=require(_0x0ea2('0x6'));var util=require(_0x0ea2('0x7'));var path=require(_0x0ea2('0x8'));var sox=require(_0x0ea2('0x9'));var csv=require(_0x0ea2('0xa'));var ejs=require(_0x0ea2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0ea2('0xc'));var crypto=require(_0x0ea2('0xd'));var jsforce=require(_0x0ea2('0xe'));var deskjs=require(_0x0ea2('0xf'));var toCsv=require(_0x0ea2('0xa'));var querystring=require(_0x0ea2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ea2('0x11'));var as=require(_0x0ea2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ea2('0x13'));var utils=require(_0x0ea2('0x14'));var config=require(_0x0ea2('0x15'));var licenseUtil=require(_0x0ea2('0x16'));var db=require(_0x0ea2('0x17'))['db'];function respondWithStatusCode(_0x44c480,_0x3a2769){_0x3a2769=_0x3a2769||0xcc;return function(_0x5e7391){if(_0x5e7391){return _0x44c480[_0x0ea2('0x18')](_0x3a2769);}return _0x44c480[_0x0ea2('0x19')](_0x3a2769)[_0x0ea2('0x1a')]();};}function respondWithResult(_0x245700,_0x1a2eac){_0x1a2eac=_0x1a2eac||0xc8;return function(_0x21a1cf){if(_0x21a1cf){return _0x245700['status'](_0x1a2eac)[_0x0ea2('0x1b')](_0x21a1cf);}};}function respondWithFilteredResult(_0x36c9ad,_0x4ee096){return function(_0x2fd5f8){if(_0x2fd5f8){var _0x65c5ff=typeof _0x4ee096['offset']===_0x0ea2('0x1c')&&typeof _0x4ee096[_0x0ea2('0x1d')]==='undefined';var _0x5e565d=_0x2fd5f8[_0x0ea2('0x1e')];var _0x2a5370=_0x65c5ff?0x0:_0x4ee096[_0x0ea2('0x1f')];var _0x4dde82=_0x65c5ff?_0x2fd5f8[_0x0ea2('0x1e')]:_0x4ee096[_0x0ea2('0x1f')]+_0x4ee096[_0x0ea2('0x1d')];var _0x4f9fb0;if(_0x4dde82>=_0x5e565d){_0x4dde82=_0x5e565d;_0x4f9fb0=0xc8;}else{_0x4f9fb0=0xce;}_0x36c9ad[_0x0ea2('0x19')](_0x4f9fb0);return _0x36c9ad['set']('Content-Range',_0x2a5370+'-'+_0x4dde82+'/'+_0x5e565d)[_0x0ea2('0x1b')](_0x2fd5f8);}return null;};}function patchUpdates(_0x2c9299){return function(_0x5aa5c8){try{jsonpatch[_0x0ea2('0x20')](_0x5aa5c8,_0x2c9299,!![]);}catch(_0x3a7bac){return BPromise[_0x0ea2('0x21')](_0x3a7bac);}return _0x5aa5c8[_0x0ea2('0x22')]();};}function saveUpdates(_0xb74828,_0x3d78ef){return function(_0x555e35){if(_0x555e35){return _0x555e35[_0x0ea2('0x23')](_0xb74828)[_0x0ea2('0x24')](function(_0x262f07){return _0x262f07;});}return null;};}function removeEntity(_0x23b286,_0x31de65){return function(_0x5d8a35){if(_0x5d8a35){return _0x5d8a35[_0x0ea2('0x25')]()[_0x0ea2('0x24')](function(){_0x23b286[_0x0ea2('0x19')](0xcc)[_0x0ea2('0x1a')]();});}};}function handleEntityNotFound(_0x56f9eb,_0x5b844d){return function(_0x200fe2){if(!_0x200fe2){_0x56f9eb[_0x0ea2('0x18')](0x194);}return _0x200fe2;};}function handleError(_0x2dcf62,_0x3e5c40){_0x3e5c40=_0x3e5c40||0x1f4;return function(_0x41b103){logger[_0x0ea2('0x26')](_0x41b103[_0x0ea2('0x27')]);if(_0x41b103[_0x0ea2('0x28')]){delete _0x41b103[_0x0ea2('0x28')];}_0x2dcf62[_0x0ea2('0x19')](_0x3e5c40)[_0x0ea2('0x29')](_0x41b103);};}exports['index']=function(_0x5b8a31,_0x1aa212){var _0x1f289d={},_0x514ea2={},_0x4ff075={'count':0x0,'rows':[]};var _0x15fe49=_[_0x0ea2('0x2a')](db[_0x0ea2('0x2b')][_0x0ea2('0x2c')],function(_0x42f4ea){return{'name':_0x42f4ea[_0x0ea2('0x2d')],'type':_0x42f4ea['type'][_0x0ea2('0x2e')]};});_0x514ea2[_0x0ea2('0x2f')]=_[_0x0ea2('0x2a')](_0x15fe49,_0x0ea2('0x28'));_0x514ea2['query']=_[_0x0ea2('0x30')](_0x5b8a31[_0x0ea2('0x31')]);_0x514ea2[_0x0ea2('0x32')]=_[_0x0ea2('0x33')](_0x514ea2['model'],_0x514ea2[_0x0ea2('0x31')]);_0x1f289d[_0x0ea2('0x34')]=_['intersection'](_0x514ea2[_0x0ea2('0x2f')],qs[_0x0ea2('0x35')](_0x5b8a31[_0x0ea2('0x31')]['fields']));_0x1f289d[_0x0ea2('0x34')]=_0x1f289d['attributes'][_0x0ea2('0x36')]?_0x1f289d[_0x0ea2('0x34')]:_0x514ea2['model'];if(!_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x37')](_0x0ea2('0x38'))){_0x1f289d[_0x0ea2('0x1d')]=qs[_0x0ea2('0x1d')](_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x1d')]);_0x1f289d[_0x0ea2('0x1f')]=qs[_0x0ea2('0x1f')](_0x5b8a31['query'][_0x0ea2('0x1f')]);}_0x1f289d[_0x0ea2('0x39')]=qs['sort'](_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x3a')]);_0x1f289d[_0x0ea2('0x3b')]=qs['filters'](_[_0x0ea2('0x3c')](_0x5b8a31['query'],_0x514ea2[_0x0ea2('0x32')]),_0x15fe49);if(_0x5b8a31['query'][_0x0ea2('0x3d')]){_0x1f289d[_0x0ea2('0x3b')]=_[_0x0ea2('0x3e')](_0x1f289d[_0x0ea2('0x3b')],{'$or':_[_0x0ea2('0x2a')](_0x15fe49,function(_0x49d94d){if(_0x49d94d[_0x0ea2('0x3f')]!==_0x0ea2('0x40')){var _0xe7158c={};_0xe7158c[_0x49d94d[_0x0ea2('0x28')]]={'$like':'%'+_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x3d')]+'%'};return _0xe7158c;}})});}_0x1f289d=_['merge']({},_0x1f289d,_0x5b8a31[_0x0ea2('0x41')]);var _0x316aef={'where':_0x1f289d['where']};return db[_0x0ea2('0x2b')][_0x0ea2('0x1e')](_0x316aef)[_0x0ea2('0x24')](function(_0x57c298){_0x4ff075[_0x0ea2('0x1e')]=_0x57c298;if(_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x42')]){_0x1f289d[_0x0ea2('0x43')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x1f289d);})[_0x0ea2('0x24')](function(_0x4b32c2){_0x4ff075[_0x0ea2('0x44')]=_0x4b32c2;return _0x4ff075;})['then'](respondWithFilteredResult(_0x1aa212,_0x1f289d))[_0x0ea2('0x45')](handleError(_0x1aa212,null));};exports[_0x0ea2('0x46')]=function(_0x57d2db,_0x4d4b2c){var _0x469ba7={'raw':!![],'where':{'id':_0x57d2db[_0x0ea2('0x47')]['id']}},_0x4127ba={};_0x4127ba[_0x0ea2('0x2f')]=_[_0x0ea2('0x30')](db[_0x0ea2('0x2b')][_0x0ea2('0x2c')]);_0x4127ba[_0x0ea2('0x31')]=_[_0x0ea2('0x30')](_0x57d2db[_0x0ea2('0x31')]);_0x4127ba[_0x0ea2('0x32')]=_[_0x0ea2('0x33')](_0x4127ba['model'],_0x4127ba['query']);_0x469ba7[_0x0ea2('0x34')]=_[_0x0ea2('0x33')](_0x4127ba[_0x0ea2('0x2f')],qs[_0x0ea2('0x35')](_0x57d2db['query']['fields']));_0x469ba7['attributes']=_0x469ba7[_0x0ea2('0x34')][_0x0ea2('0x36')]?_0x469ba7[_0x0ea2('0x34')]:_0x4127ba[_0x0ea2('0x2f')];if(_0x57d2db['query'][_0x0ea2('0x42')]){_0x469ba7[_0x0ea2('0x43')]=[{'all':!![]}];}_0x469ba7=_[_0x0ea2('0x3e')]({},_0x469ba7,_0x57d2db['options']);return db[_0x0ea2('0x2b')][_0x0ea2('0x48')](_0x469ba7)['then'](handleEntityNotFound(_0x4d4b2c,null))[_0x0ea2('0x24')](respondWithResult(_0x4d4b2c,null))['catch'](handleError(_0x4d4b2c,null));};exports[_0x0ea2('0x49')]=function(_0x18cde1,_0x2a3ee3){return db[_0x0ea2('0x2b')][_0x0ea2('0x49')](_0x18cde1[_0x0ea2('0x4a')],{})[_0x0ea2('0x24')](respondWithResult(_0x2a3ee3,0xc9))['catch'](handleError(_0x2a3ee3,null));};exports['update']=function(_0x3ca891,_0x490137){if(_0x3ca891[_0x0ea2('0x4a')]['id']){delete _0x3ca891[_0x0ea2('0x4a')]['id'];}return db[_0x0ea2('0x2b')]['find']({'where':{'id':_0x3ca891[_0x0ea2('0x47')]['id']}})[_0x0ea2('0x24')](handleEntityNotFound(_0x490137,null))['then'](saveUpdates(_0x3ca891[_0x0ea2('0x4a')],null))[_0x0ea2('0x24')](respondWithResult(_0x490137,null))['catch'](handleError(_0x490137,null));};exports[_0x0ea2('0x25')]=function(_0x52762a,_0x17f335){return db[_0x0ea2('0x2b')]['find']({'where':{'id':_0x52762a[_0x0ea2('0x47')]['id']}})[_0x0ea2('0x24')](handleEntityNotFound(_0x17f335,null))[_0x0ea2('0x24')](removeEntity(_0x17f335,null))[_0x0ea2('0x45')](handleError(_0x17f335,null));}; \ No newline at end of file +var _0x332b=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x34b11b,_0x9cf31f){var _0x2e394d=function(_0xaab77b){while(--_0xaab77b){_0x34b11b['push'](_0x34b11b['shift']());}};_0x2e394d(++_0x9cf31f);}(_0x332b,0x1c5));var _0xb332=function(_0x434e7b,_0x31ab4d){_0x434e7b=_0x434e7b-0x0;var _0x5deed2=_0x332b[_0x434e7b];return _0x5deed2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb332('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb332('0x1'));var rp=require('request-promise');var moment=require(_0xb332('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb332('0x3'));var util=require(_0xb332('0x4'));var path=require(_0xb332('0x5'));var sox=require(_0xb332('0x6'));var csv=require(_0xb332('0x7'));var ejs=require(_0xb332('0x8'));var fs=require('fs');var fs_extra=require(_0xb332('0x9'));var _=require(_0xb332('0xa'));var squel=require(_0xb332('0xb'));var crypto=require('crypto');var jsforce=require(_0xb332('0xc'));var deskjs=require(_0xb332('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb332('0xe'));var Papa=require(_0xb332('0xf'));var Redis=require(_0xb332('0x10'));var authService=require(_0xb332('0x11'));var qs=require(_0xb332('0x12'));var as=require(_0xb332('0x13'));var hardwareService=require(_0xb332('0x14'));var logger=require('../../config/logger')(_0xb332('0x15'));var utils=require('../../config/utils');var config=require(_0xb332('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb332('0x17'))['db'];function respondWithStatusCode(_0xbf16dd,_0x349979){_0x349979=_0x349979||0xcc;return function(_0x2c4ded){if(_0x2c4ded){return _0xbf16dd['sendStatus'](_0x349979);}return _0xbf16dd['status'](_0x349979)[_0xb332('0x18')]();};}function respondWithResult(_0x38ce8b,_0x369a34){_0x369a34=_0x369a34||0xc8;return function(_0x221c3c){if(_0x221c3c){return _0x38ce8b['status'](_0x369a34)[_0xb332('0x19')](_0x221c3c);}};}function respondWithFilteredResult(_0x35914b,_0x21d7db){return function(_0x21f69a){if(_0x21f69a){var _0x2d8612=typeof _0x21d7db[_0xb332('0x1a')]===_0xb332('0x1b')&&typeof _0x21d7db['limit']===_0xb332('0x1b');var _0x13432f=_0x21f69a[_0xb332('0x1c')];var _0x180c40=_0x2d8612?0x0:_0x21d7db['offset'];var _0x252d94=_0x2d8612?_0x21f69a[_0xb332('0x1c')]:_0x21d7db[_0xb332('0x1a')]+_0x21d7db['limit'];var _0x7bb15e;if(_0x252d94>=_0x13432f){_0x252d94=_0x13432f;_0x7bb15e=0xc8;}else{_0x7bb15e=0xce;}_0x35914b[_0xb332('0x1d')](_0x7bb15e);return _0x35914b[_0xb332('0x1e')](_0xb332('0x1f'),_0x180c40+'-'+_0x252d94+'/'+_0x13432f)['json'](_0x21f69a);}return null;};}function patchUpdates(_0x3d2ad9){return function(_0x35c7f4){try{jsonpatch[_0xb332('0x20')](_0x35c7f4,_0x3d2ad9,!![]);}catch(_0x589bdd){return BPromise[_0xb332('0x21')](_0x589bdd);}return _0x35c7f4[_0xb332('0x22')]();};}function saveUpdates(_0x1997e8,_0x5024b9){return function(_0x324d66){if(_0x324d66){return _0x324d66[_0xb332('0x23')](_0x1997e8)[_0xb332('0x24')](function(_0x5ed152){return _0x5ed152;});}return null;};}function removeEntity(_0x15e96e,_0x3cf12e){return function(_0x3b0e48){if(_0x3b0e48){return _0x3b0e48[_0xb332('0x25')]()['then'](function(){_0x15e96e[_0xb332('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56463c,_0x165ab8){return function(_0x4474c9){if(!_0x4474c9){_0x56463c[_0xb332('0x26')](0x194);}return _0x4474c9;};}function handleError(_0x4212d3,_0x73b879){_0x73b879=_0x73b879||0x1f4;return function(_0xc4963c){logger[_0xb332('0x27')](_0xc4963c['stack']);if(_0xc4963c['name']){delete _0xc4963c[_0xb332('0x28')];}_0x4212d3['status'](_0x73b879)[_0xb332('0x29')](_0xc4963c);};}exports[_0xb332('0x2a')]=function(_0x4da65b,_0x532ca1){var _0x2b6245={},_0x4e695c={},_0x35a05a={'count':0x0,'rows':[]};var _0xe2f7ad=_[_0xb332('0x2b')](db[_0xb332('0x2c')][_0xb332('0x2d')],function(_0x4eb8e5){return{'name':_0x4eb8e5[_0xb332('0x2e')],'type':_0x4eb8e5[_0xb332('0x2f')][_0xb332('0x30')]};});_0x4e695c[_0xb332('0x31')]=_[_0xb332('0x2b')](_0xe2f7ad,_0xb332('0x28'));_0x4e695c['query']=_['keys'](_0x4da65b[_0xb332('0x32')]);_0x4e695c[_0xb332('0x33')]=_[_0xb332('0x34')](_0x4e695c[_0xb332('0x31')],_0x4e695c['query']);_0x2b6245[_0xb332('0x35')]=_[_0xb332('0x34')](_0x4e695c[_0xb332('0x31')],qs[_0xb332('0x36')](_0x4da65b[_0xb332('0x32')][_0xb332('0x36')]));_0x2b6245[_0xb332('0x35')]=_0x2b6245[_0xb332('0x35')][_0xb332('0x37')]?_0x2b6245['attributes']:_0x4e695c['model'];if(!_0x4da65b[_0xb332('0x32')][_0xb332('0x38')](_0xb332('0x39'))){_0x2b6245[_0xb332('0x3a')]=qs[_0xb332('0x3a')](_0x4da65b[_0xb332('0x32')][_0xb332('0x3a')]);_0x2b6245[_0xb332('0x1a')]=qs['offset'](_0x4da65b[_0xb332('0x32')][_0xb332('0x1a')]);}_0x2b6245[_0xb332('0x3b')]=qs[_0xb332('0x3c')](_0x4da65b[_0xb332('0x32')][_0xb332('0x3c')]);_0x2b6245[_0xb332('0x3d')]=qs['filters'](_[_0xb332('0x3e')](_0x4da65b['query'],_0x4e695c[_0xb332('0x33')]),_0xe2f7ad);if(_0x4da65b[_0xb332('0x32')]['filter']){_0x2b6245[_0xb332('0x3d')]=_[_0xb332('0x3f')](_0x2b6245[_0xb332('0x3d')],{'$or':_[_0xb332('0x2b')](_0xe2f7ad,function(_0x53d8a2){if(_0x53d8a2[_0xb332('0x2f')]!==_0xb332('0x40')){var _0x45aed5={};_0x45aed5[_0x53d8a2[_0xb332('0x28')]]={'$like':'%'+_0x4da65b[_0xb332('0x32')][_0xb332('0x41')]+'%'};return _0x45aed5;}})});}_0x2b6245=_[_0xb332('0x3f')]({},_0x2b6245,_0x4da65b[_0xb332('0x42')]);var _0x400bd2={'where':_0x2b6245[_0xb332('0x3d')]};return db[_0xb332('0x2c')]['count'](_0x400bd2)[_0xb332('0x24')](function(_0x31d157){_0x35a05a['count']=_0x31d157;if(_0x4da65b[_0xb332('0x32')]['includeAll']){_0x2b6245[_0xb332('0x43')]=[{'all':!![]}];}return db[_0xb332('0x2c')][_0xb332('0x44')](_0x2b6245);})[_0xb332('0x24')](function(_0x3804d6){_0x35a05a[_0xb332('0x45')]=_0x3804d6;return _0x35a05a;})['then'](respondWithFilteredResult(_0x532ca1,_0x2b6245))[_0xb332('0x46')](handleError(_0x532ca1,null));};exports[_0xb332('0x47')]=function(_0x2adefc,_0x49c9aa){var _0x510c6d={'raw':!![],'where':{'id':_0x2adefc[_0xb332('0x48')]['id']}},_0x259df6={};_0x259df6[_0xb332('0x31')]=_['keys'](db[_0xb332('0x2c')][_0xb332('0x2d')]);_0x259df6[_0xb332('0x32')]=_[_0xb332('0x49')](_0x2adefc['query']);_0x259df6[_0xb332('0x33')]=_[_0xb332('0x34')](_0x259df6['model'],_0x259df6[_0xb332('0x32')]);_0x510c6d[_0xb332('0x35')]=_['intersection'](_0x259df6[_0xb332('0x31')],qs['fields'](_0x2adefc['query']['fields']));_0x510c6d[_0xb332('0x35')]=_0x510c6d['attributes']['length']?_0x510c6d[_0xb332('0x35')]:_0x259df6[_0xb332('0x31')];if(_0x2adefc['query']['includeAll']){_0x510c6d['include']=[{'all':!![]}];}_0x510c6d=_[_0xb332('0x3f')]({},_0x510c6d,_0x2adefc['options']);return db[_0xb332('0x2c')][_0xb332('0x4a')](_0x510c6d)['then'](handleEntityNotFound(_0x49c9aa,null))[_0xb332('0x24')](respondWithResult(_0x49c9aa,null))[_0xb332('0x46')](handleError(_0x49c9aa,null));};exports[_0xb332('0x4b')]=function(_0x194290,_0x116ca8){return db['VtigerField']['create'](_0x194290[_0xb332('0x4c')],{})[_0xb332('0x24')](respondWithResult(_0x116ca8,0xc9))[_0xb332('0x46')](handleError(_0x116ca8,null));};exports[_0xb332('0x23')]=function(_0x443721,_0x318493){if(_0x443721[_0xb332('0x4c')]['id']){delete _0x443721[_0xb332('0x4c')]['id'];}return db['VtigerField'][_0xb332('0x4a')]({'where':{'id':_0x443721[_0xb332('0x48')]['id']}})[_0xb332('0x24')](handleEntityNotFound(_0x318493,null))[_0xb332('0x24')](saveUpdates(_0x443721[_0xb332('0x4c')],null))[_0xb332('0x24')](respondWithResult(_0x318493,null))[_0xb332('0x46')](handleError(_0x318493,null));};exports['destroy']=function(_0x295c3d,_0x20e69e){return db[_0xb332('0x2c')][_0xb332('0x4a')]({'where':{'id':_0x295c3d[_0xb332('0x48')]['id']}})[_0xb332('0x24')](handleEntityNotFound(_0x20e69e,null))['then'](removeEntity(_0x20e69e,null))['catch'](handleError(_0x20e69e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index fa1f8b9..d302b5f 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 _0x0808=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x4328d0,_0x57d351){var _0x175925=function(_0x49cd82){while(--_0x49cd82){_0x4328d0['push'](_0x4328d0['shift']());}};_0x175925(++_0x57d351);}(_0x0808,0x7e));var _0x8080=function(_0x11b9b2,_0x29feed){_0x11b9b2=_0x11b9b2-0x0;var _0x30674e=_0x0808[_0x11b9b2];return _0x30674e;};'use strict';var _=require('lodash');var util=require(_0x8080('0x0'));var logger=require(_0x8080('0x1'))(_0x8080('0x2'));var moment=require('moment');var BPromise=require(_0x8080('0x3'));var rp=require(_0x8080('0x4'));var fs=require('fs');var path=require(_0x8080('0x5'));var rimraf=require(_0x8080('0x6'));var config=require(_0x8080('0x7'));var attributes=require(_0x8080('0x8'));module[_0x8080('0x9')]=function(_0x10605e,_0x1d476d){return _0x10605e['define'](_0x8080('0xa'),attributes,{'tableName':_0x8080('0xb'),'paranoid':![],'indexes':[{'name':_0x8080('0xc'),'fields':[_0x8080('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2466=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','lodash','util'];(function(_0x3b2a34,_0x55027c){var _0x3304cd=function(_0x22b55e){while(--_0x22b55e){_0x3b2a34['push'](_0x3b2a34['shift']());}};_0x3304cd(++_0x55027c);}(_0x2466,0x80));var _0x6246=function(_0x402708,_0x15901c){_0x402708=_0x402708-0x0;var _0x3630b4=_0x2466[_0x402708];return _0x3630b4;};'use strict';var _=require(_0x6246('0x0'));var util=require(_0x6246('0x1'));var logger=require(_0x6246('0x2'))('api');var moment=require(_0x6246('0x3'));var BPromise=require(_0x6246('0x4'));var rp=require(_0x6246('0x5'));var fs=require('fs');var path=require(_0x6246('0x6'));var rimraf=require('rimraf');var config=require(_0x6246('0x7'));var attributes=require(_0x6246('0x8'));module[_0x6246('0x9')]=function(_0x54fd30,_0x2bcd98){return _0x54fd30['define'](_0x6246('0xa'),attributes,{'tableName':_0x6246('0xb'),'paranoid':![],'indexes':[{'name':_0x6246('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 13158fc..78feb5f 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 _0x16d9=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x22c271,_0x314f5b){var _0x48727d=function(_0x5659ea){while(--_0x5659ea){_0x22c271['push'](_0x22c271['shift']());}};_0x48727d(++_0x314f5b);}(_0x16d9,0x1f0));var _0x916d=function(_0x1e22d6,_0x25605f){_0x1e22d6=_0x1e22d6-0x0;var _0x397cc4=_0x16d9[_0x1e22d6];return _0x397cc4;};'use strict';var _=require(_0x916d('0x0'));var util=require(_0x916d('0x1'));var moment=require(_0x916d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x916d('0x3'));var db=require(_0x916d('0x4'))['db'];var utils=require(_0x916d('0x5'));var logger=require(_0x916d('0x6'))(_0x916d('0x7'));var config=require(_0x916d('0x8'));var jayson=require(_0x916d('0x9'));var client=jayson[_0x916d('0xa')][_0x916d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16a59b,_0x20c59b,_0x2889bf){return new BPromise(function(_0x462cb8,_0x581a35){return client[_0x916d('0xc')](_0x16a59b,_0x2889bf)[_0x916d('0xd')](function(_0x4a9540){logger[_0x916d('0xe')](_0x916d('0xf'),_0x20c59b,'request\x20sent');logger[_0x916d('0x10')](_0x916d('0x11'),_0x20c59b,'request\x20sent',JSON['stringify'](_0x4a9540));if(_0x4a9540[_0x916d('0x12')]){if(_0x4a9540[_0x916d('0x12')][_0x916d('0x13')]===0x1f4){logger[_0x916d('0x12')](_0x916d('0xf'),_0x20c59b,_0x4a9540[_0x916d('0x12')][_0x916d('0x14')]);return _0x581a35(_0x4a9540['error'][_0x916d('0x14')]);}logger[_0x916d('0x12')]('VtigerField,\x20%s,\x20%s',_0x20c59b,_0x4a9540[_0x916d('0x12')]['message']);return _0x462cb8(_0x4a9540[_0x916d('0x12')][_0x916d('0x14')]);}else{logger[_0x916d('0xe')](_0x916d('0xf'),_0x20c59b,_0x916d('0x15'));_0x462cb8(_0x4a9540[_0x916d('0x16')]['message']);}})['catch'](function(_0xb204e9){logger[_0x916d('0x12')](_0x916d('0xf'),_0x20c59b,_0xb204e9);_0x581a35(_0xb204e9);});});} \ No newline at end of file +var _0xfab0=['result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x320800,_0x1ddb58){var _0x1cbdf3=function(_0x49a114){while(--_0x49a114){_0x320800['push'](_0x320800['shift']());}};_0x1cbdf3(++_0x1ddb58);}(_0xfab0,0x157));var _0x0fab=function(_0x3f4450,_0xfaf1a8){_0x3f4450=_0x3f4450-0x0;var _0x492655=_0xfab0[_0x3f4450];return _0x492655;};'use strict';var _=require(_0x0fab('0x0'));var util=require('util');var moment=require(_0x0fab('0x1'));var BPromise=require('bluebird');var rs=require(_0x0fab('0x2'));var fs=require('fs');var Redis=require(_0x0fab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fab('0x4'));var logger=require(_0x0fab('0x5'))(_0x0fab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0fab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bb58a,_0x4b102b,_0x17f311){return new BPromise(function(_0x358658,_0x3855f6){return client['request'](_0x4bb58a,_0x17f311)['then'](function(_0x17289b){logger[_0x0fab('0x8')](_0x0fab('0x9'),_0x4b102b,_0x0fab('0xa'));logger[_0x0fab('0xb')](_0x0fab('0xc'),_0x4b102b,_0x0fab('0xa'),JSON[_0x0fab('0xd')](_0x17289b));if(_0x17289b['error']){if(_0x17289b['error'][_0x0fab('0xe')]===0x1f4){logger[_0x0fab('0xf')]('VtigerField,\x20%s,\x20%s',_0x4b102b,_0x17289b[_0x0fab('0xf')][_0x0fab('0x10')]);return _0x3855f6(_0x17289b[_0x0fab('0xf')][_0x0fab('0x10')]);}logger[_0x0fab('0xf')]('VtigerField,\x20%s,\x20%s',_0x4b102b,_0x17289b[_0x0fab('0xf')][_0x0fab('0x10')]);return _0x358658(_0x17289b['error'][_0x0fab('0x10')]);}else{logger['info'](_0x0fab('0x9'),_0x4b102b,_0x0fab('0xa'));_0x358658(_0x17289b[_0x0fab('0x11')][_0x0fab('0x10')]);}})['catch'](function(_0x35fe2c){logger[_0x0fab('0xf')](_0x0fab('0x9'),_0x4b102b,_0x35fe2c);_0x3855f6(_0x35fe2c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 01c70ea..18f24fa 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 _0x6877=['show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index'];(function(_0x28cddc,_0x1be16d){var _0x5ce855=function(_0x1fe396){while(--_0x1fe396){_0x28cddc['push'](_0x28cddc['shift']());}};_0x5ce855(++_0x1be16d);}(_0x6877,0xa4));var _0x7687=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x6877[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x7687('0x0'));var util=require(_0x7687('0x1'));var path=require(_0x7687('0x2'));var timeout=require('connect-timeout');var express=require(_0x7687('0x3'));var router=express['Router']();var fs_extra=require(_0x7687('0x4'));var auth=require(_0x7687('0x5'));var interaction=require(_0x7687('0x6'));var config=require(_0x7687('0x7'));var controller=require(_0x7687('0x8'));router['get']('/',auth[_0x7687('0x9')](),controller[_0x7687('0xa')]);router['get']('/:id',auth[_0x7687('0x9')](),controller[_0x7687('0xb')]);router[_0x7687('0xc')](_0x7687('0xd'),auth[_0x7687('0x9')](),controller[_0x7687('0xe')]);router[_0x7687('0xc')](_0x7687('0xf'),auth['isAuthenticated'](),controller[_0x7687('0x10')]);router[_0x7687('0x11')]('/',auth['isAuthenticated'](),controller[_0x7687('0x12')]);router[_0x7687('0x11')](_0x7687('0xd'),auth[_0x7687('0x9')](),controller[_0x7687('0x13')]);router[_0x7687('0x14')](_0x7687('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x7687('0x16')]('/:id',auth[_0x7687('0x9')](),controller[_0x7687('0x17')]);module[_0x7687('0x18')]=router; \ No newline at end of file +var _0x9030=['put','/:id','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x5b47ed,_0x30abf4){var _0x5cae85=function(_0x423031){while(--_0x423031){_0x5b47ed['push'](_0x5b47ed['shift']());}};_0x5cae85(++_0x30abf4);}(_0x9030,0x121));var _0x0903=function(_0x2631e4,_0x23616a){_0x2631e4=_0x2631e4-0x0;var _0x476a06=_0x9030[_0x2631e4];return _0x476a06;};'use strict';var multer=require(_0x0903('0x0'));var util=require(_0x0903('0x1'));var path=require(_0x0903('0x2'));var timeout=require(_0x0903('0x3'));var express=require('express');var router=express[_0x0903('0x4')]();var fs_extra=require(_0x0903('0x5'));var auth=require(_0x0903('0x6'));var interaction=require(_0x0903('0x7'));var config=require(_0x0903('0x8'));var controller=require(_0x0903('0x9'));router[_0x0903('0xa')]('/',auth[_0x0903('0xb')](),controller[_0x0903('0xc')]);router[_0x0903('0xa')]('/:id',auth[_0x0903('0xb')](),controller['show']);router[_0x0903('0xa')](_0x0903('0xd'),auth['isAuthenticated'](),controller[_0x0903('0xe')]);router[_0x0903('0xa')](_0x0903('0xf'),auth[_0x0903('0xb')](),controller['getFields']);router[_0x0903('0x10')]('/',auth[_0x0903('0xb')](),controller[_0x0903('0x11')]);router['post'](_0x0903('0xd'),auth[_0x0903('0xb')](),controller[_0x0903('0x12')]);router[_0x0903('0x13')](_0x0903('0x14'),auth[_0x0903('0xb')](),controller['update']);router[_0x0903('0x15')](_0x0903('0x14'),auth[_0x0903('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4ef2463..c16072c 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 _0x853e=['integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x246eb0,_0x120a06){var _0xd5b9d4=function(_0x2e2f06){while(--_0x2e2f06){_0x246eb0['push'](_0x246eb0['shift']());}};_0xd5b9d4(++_0x120a06);}(_0x853e,0x1ea));var _0xe853=function(_0xbe9e44,_0x509ecd){_0xbe9e44=_0xbe9e44-0x0;var _0x22f58b=_0x853e[_0xbe9e44];return _0x22f58b;};'use strict';var Sequelize=require('sequelize');module[_0xe853('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe853('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe853('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe853('0x1')]},'remoteUri':{'type':Sequelize[_0xe853('0x1')],'unique':_0xe853('0x3')},'authType':{'type':Sequelize[_0xe853('0x4')](_0xe853('0x5'),'token'),'defaultValue':_0xe853('0x5')},'serverUrl':{'type':Sequelize[_0xe853('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe853('0x4')](_0xe853('0x6'),_0xe853('0x7')),'defaultValue':_0xe853('0x6')}}; \ No newline at end of file +var _0x9e69=['exports','STRING','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0x9e69,0x150));var _0x99e6=function(_0x553182,_0x32a593){_0x553182=_0x553182-0x0;var _0x23c76e=_0x9e69[_0x553182];return _0x23c76e;};'use strict';var Sequelize=require('sequelize');module[_0x99e6('0x0')]={'name':{'type':Sequelize[_0x99e6('0x1')]},'description':{'type':Sequelize[_0x99e6('0x1')]},'username':{'type':Sequelize[_0x99e6('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x99e6('0x1')]},'token':{'type':Sequelize[_0x99e6('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99e6('0x2')},'authType':{'type':Sequelize[_0x99e6('0x3')](_0x99e6('0x4'),'token'),'defaultValue':_0x99e6('0x4')},'serverUrl':{'type':Sequelize[_0x99e6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x99e6('0x3')]('integrationTab',_0x99e6('0x5')),'defaultValue':_0x99e6('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a605a3e..a73d750 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 _0xa902=['%s:%s','base64','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','sort','map','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','findOne','username','password','remoteUri','slice','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s'];(function(_0x3f86c3,_0x109a0f){var _0x1de1da=function(_0x17096f){while(--_0x17096f){_0x3f86c3['push'](_0x3f86c3['shift']());}};_0x1de1da(++_0x109a0f);}(_0xa902,0x8d));var _0x2a90=function(_0x3a784a,_0x568baf){_0x3a784a=_0x3a784a-0x0;var _0x36abd4=_0xa902[_0x3a784a];return _0x36abd4;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f6953,_0x57aee3){_0x57aee3=_0x57aee3||0xcc;return function(_0x407ce5){if(_0x407ce5){return _0x1f6953[_0x2a90('0x17')](_0x57aee3);}return _0x1f6953[_0x2a90('0x18')](_0x57aee3)['end']();};}function respondWithResult(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xc8;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x18')](_0x57227c)['json'](_0x46cb32);}};}function respondWithFilteredResult(_0x1ff63d,_0x21c648){return function(_0x312782){if(_0x312782){var _0x25bd0e=typeof _0x21c648[_0x2a90('0x19')]===_0x2a90('0x1a')&&typeof _0x21c648[_0x2a90('0x1b')]===_0x2a90('0x1a');var _0x43eea5=_0x312782['count'];var _0x162f0b=_0x25bd0e?0x0:_0x21c648[_0x2a90('0x19')];var _0x4190ff=_0x25bd0e?_0x312782['count']:_0x21c648[_0x2a90('0x19')]+_0x21c648[_0x2a90('0x1b')];var _0x148d18;if(_0x4190ff>=_0x43eea5){_0x4190ff=_0x43eea5;_0x148d18=0xc8;}else{_0x148d18=0xce;}_0x1ff63d[_0x2a90('0x18')](_0x148d18);return _0x1ff63d[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x162f0b+'-'+_0x4190ff+'/'+_0x43eea5)[_0x2a90('0x1e')](_0x312782);}return null;};}function patchUpdates(_0x114d42){return function(_0xf97adb){try{jsonpatch[_0x2a90('0x1f')](_0xf97adb,_0x114d42,!![]);}catch(_0x1340b9){return BPromise[_0x2a90('0x20')](_0x1340b9);}return _0xf97adb['save']();};}function saveUpdates(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x21')](_0x3da7d0)['then'](function(_0x180485){return _0x180485;});}return null;};}function removeEntity(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(_0x1bcfd7){return _0x1bcfd7[_0x2a90('0x22')]()[_0x2a90('0x23')](function(){_0xd033d[_0x2a90('0x18')](0xcc)[_0x2a90('0x24')]();});}};}function handleEntityNotFound(_0x1303d9,_0x29ed73){return function(_0x24a6d3){if(!_0x24a6d3){_0x1303d9['sendStatus'](0x194);}return _0x24a6d3;};}function handleError(_0x27f883,_0x17f978){_0x17f978=_0x17f978||0x1f4;return function(_0x3934d4){logger[_0x2a90('0x25')](_0x3934d4[_0x2a90('0x26')]);if(_0x3934d4['name']){delete _0x3934d4['name'];}_0x27f883[_0x2a90('0x18')](_0x17f978)['send'](_0x3934d4);};}exports['index']=function(_0x4969c3,_0x2d83b3){var _0x3c78f5={},_0x595638={},_0x5bd700={'count':0x0,'rows':[]};var _0x1add9a=_['map'](db[_0x2a90('0x27')][_0x2a90('0x28')],function(_0x3b580f){return{'name':_0x3b580f[_0x2a90('0x29')],'type':_0x3b580f[_0x2a90('0x2a')][_0x2a90('0x2b')]};});_0x595638[_0x2a90('0x2c')]=_['map'](_0x1add9a,_0x2a90('0x2d'));_0x595638[_0x2a90('0x2e')]=_[_0x2a90('0x2f')](_0x4969c3['query']);_0x595638[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],_0x595638[_0x2a90('0x2e')]);_0x3c78f5['attributes']=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],qs[_0x2a90('0x32')](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x3c78f5[_0x2a90('0x33')]=_0x3c78f5['attributes'][_0x2a90('0x34')]?_0x3c78f5[_0x2a90('0x33')]:_0x595638[_0x2a90('0x2c')];if(!_0x4969c3[_0x2a90('0x2e')]['hasOwnProperty'](_0x2a90('0x35'))){_0x3c78f5[_0x2a90('0x1b')]=qs['limit'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x1b')]);_0x3c78f5['offset']=qs['offset'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x19')]);}_0x3c78f5[_0x2a90('0x36')]=qs['sort'](_0x4969c3[_0x2a90('0x2e')]['sort']);_0x3c78f5[_0x2a90('0x37')]=qs['filters'](_[_0x2a90('0x38')](_0x4969c3['query'],_0x595638['filters']),_0x1add9a);if(_0x4969c3[_0x2a90('0x2e')]['filter']){_0x3c78f5[_0x2a90('0x37')]=_[_0x2a90('0x39')](_0x3c78f5[_0x2a90('0x37')],{'$or':_['map'](_0x1add9a,function(_0x57a2a5){if(_0x57a2a5[_0x2a90('0x2a')]!==_0x2a90('0x3a')){var _0x4eb7d9={};_0x4eb7d9[_0x57a2a5[_0x2a90('0x2d')]]={'$like':'%'+_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x4eb7d9;}})});}_0x3c78f5=_['merge']({},_0x3c78f5,_0x4969c3[_0x2a90('0x3c')]);var _0x1db9d8={'where':_0x3c78f5['where']};return db[_0x2a90('0x27')][_0x2a90('0x3d')](_0x1db9d8)[_0x2a90('0x23')](function(_0x28f289){_0x5bd700[_0x2a90('0x3d')]=_0x28f289;if(_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x3c78f5[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x27')][_0x2a90('0x40')](_0x3c78f5);})[_0x2a90('0x23')](function(_0x3dba8a){_0x5bd700[_0x2a90('0x41')]=_0x3dba8a;return _0x5bd700;})[_0x2a90('0x23')](respondWithFilteredResult(_0x2d83b3,_0x3c78f5))['catch'](handleError(_0x2d83b3,null));};exports[_0x2a90('0x42')]=function(_0x3a70fe,_0x528b41){var _0x1045bb={'raw':![],'where':{'id':_0x3a70fe[_0x2a90('0x43')]['id']}},_0x1e971c={};_0x1e971c[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskAccount'][_0x2a90('0x28')]);_0x1e971c['query']=_[_0x2a90('0x2f')](_0x3a70fe['query']);_0x1e971c[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],_0x1e971c[_0x2a90('0x2e')]);_0x1045bb[_0x2a90('0x33')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],qs['fields'](_0x3a70fe['query'][_0x2a90('0x32')]));_0x1045bb[_0x2a90('0x33')]=_0x1045bb[_0x2a90('0x33')][_0x2a90('0x34')]?_0x1045bb[_0x2a90('0x33')]:_0x1e971c[_0x2a90('0x2c')];if(_0x3a70fe[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x1045bb['include']=[{'all':!![]}];}_0x1045bb=_[_0x2a90('0x39')]({},_0x1045bb,_0x3a70fe['options']);return db[_0x2a90('0x27')][_0x2a90('0x44')](_0x1045bb)['then'](handleEntityNotFound(_0x528b41,null))[_0x2a90('0x23')](respondWithResult(_0x528b41,null))[_0x2a90('0x45')](handleError(_0x528b41,null));};exports[_0x2a90('0x46')]=function(_0x1d55db,_0x175d59){return db[_0x2a90('0x27')][_0x2a90('0x46')](_0x1d55db['body'],{})['then'](respondWithResult(_0x175d59,0xc9))[_0x2a90('0x45')](handleError(_0x175d59,null));};exports[_0x2a90('0x21')]=function(_0x42c890,_0x43266a){if(_0x42c890[_0x2a90('0x47')]['id']){delete _0x42c890['body']['id'];}return db['ZendeskAccount'][_0x2a90('0x44')]({'where':{'id':_0x42c890[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x43266a,null))['then'](saveUpdates(_0x42c890['body'],null))[_0x2a90('0x23')](respondWithResult(_0x43266a,null))['catch'](handleError(_0x43266a,null));};exports[_0x2a90('0x22')]=function(_0x3dfe72,_0x272d07){return db[_0x2a90('0x27')][_0x2a90('0x44')]({'where':{'id':_0x3dfe72[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x272d07,null))[_0x2a90('0x23')](removeEntity(_0x272d07,null))[_0x2a90('0x45')](handleError(_0x272d07,null));};exports['getConfigurations']=function(_0x265769,_0x4d1303,_0x4c8bae){var _0x46f687={};var _0xe47c6b={};var _0x5819ab;var _0x4c0cb2;return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0x265769[_0x2a90('0x43')]['id']}})[_0x2a90('0x23')](handleEntityNotFound(_0x4d1303,null))['then'](function(_0x366429){if(_0x366429){_0x5819ab=_0x366429;_0xe47c6b[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskConfiguration'][_0x2a90('0x28')]);_0xe47c6b[_0x2a90('0x2e')]=_['keys'](_0x265769['query']);_0xe47c6b[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0xe47c6b['model'],_0xe47c6b[_0x2a90('0x2e')]);_0x46f687['attributes']=_[_0x2a90('0x31')](_0xe47c6b['model'],qs[_0x2a90('0x32')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x46f687['attributes']=_0x46f687['attributes']['length']?_0x46f687[_0x2a90('0x33')]:_0xe47c6b[_0x2a90('0x2c')];_0x46f687[_0x2a90('0x36')]=qs[_0x2a90('0x48')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x48')]);_0x46f687[_0x2a90('0x37')]=qs[_0x2a90('0x30')](_[_0x2a90('0x38')](_0x265769[_0x2a90('0x2e')],_0xe47c6b[_0x2a90('0x30')]));if(_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]){_0x46f687['where']=_['merge'](_0x46f687['where'],{'$or':_[_0x2a90('0x49')](_0x46f687[_0x2a90('0x33')],function(_0x13270d){var _0x400aca={};_0x400aca[_0x13270d]={'$like':'%'+_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x400aca;})});}_0x46f687=_[_0x2a90('0x39')]({},_0x46f687,_0x265769[_0x2a90('0x3c')]);return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x50973b){if(_0x50973b){_0x4c0cb2=_0x50973b[_0x2a90('0x34')];if(!_0x265769[_0x2a90('0x2e')][_0x2a90('0x4b')](_0x2a90('0x35'))){_0x46f687[_0x2a90('0x1b')]=qs['limit'](_0x265769[_0x2a90('0x2e')]['limit']);_0x46f687[_0x2a90('0x19')]=qs[_0x2a90('0x19')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x19')]);}return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x44b211){if(_0x44b211){return _0x44b211?{'count':_0x4c0cb2,'rows':_0x44b211}:null;}})['then'](respondWithResult(_0x4d1303,null))[_0x2a90('0x45')](handleError(_0x4d1303,null));};exports[_0x2a90('0x4c')]=function(_0xf88bbb,_0x48f9fa,_0xa1234a){if(_0xf88bbb[_0x2a90('0x47')]['id']){delete _0xf88bbb[_0x2a90('0x47')]['id'];}return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0xf88bbb[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f9fa,null))[_0x2a90('0x23')](function(_0x94e9fb){if(_0x94e9fb){_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4d')]=_0x94e9fb['id'];_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4e')]=integrations['getSubjects'](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x2a')]);_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x50')]=integrations[_0x2a90('0x51')](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb['body'][_0x2a90('0x2a')]);return db[_0x2a90('0x52')][_0x2a90('0x46')](_0xf88bbb['body'],{'include':[{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x4e')},{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x50')}]});}return null;})[_0x2a90('0x23')](respondWithResult(_0x48f9fa,null))['catch'](handleError(_0x48f9fa,null));};exports[_0x2a90('0x54')]=function(_0x5e0bf2,_0x5a770b,_0x9fafd){var _0x4e1dcd='';return db['ZendeskAccount'][_0x2a90('0x55')]({'where':{'id':_0x5e0bf2['params']['id']},'attributes':['id',_0x2a90('0x56'),_0x2a90('0x57'),'token','authType',_0x2a90('0x58')]})['then'](handleEntityNotFound(_0x5a770b,null))['then'](function(_0xd52ae2){if(_0xd52ae2){_0x4e1dcd=_0xd52ae2[_0x2a90('0x58')];var _0x1db063=_0x4e1dcd[_0x2a90('0x59')](-0x1);if(_0x1db063==='/'){_0x4e1dcd=_0x4e1dcd['substring'](0x0,_0x4e1dcd['lastIndexOf'](_0x1db063));}var _0x370144={'method':_0x2a90('0x5a'),'uri':util[_0x2a90('0x5b')](_0x2a90('0x5c'),_0x4e1dcd,_0x2a90('0x5d')),'json':!![]};switch(_0xd52ae2[_0x2a90('0x5e')]){case _0x2a90('0x57'):_0x370144[_0x2a90('0x5f')]={'Authorization':util[_0x2a90('0x5b')](_0x2a90('0x60'),new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x61'),_0xd52ae2['username'],_0xd52ae2[_0x2a90('0x57')]))['toString'](_0x2a90('0x62')))};break;case'token':_0x370144[_0x2a90('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x63'),_0xd52ae2[_0x2a90('0x56')],_0xd52ae2[_0x2a90('0x64')]))['toString']('base64'))};break;default:throw new db[(_0x2a90('0x65'))][(_0x2a90('0x66'))](_0x2a90('0x67'));}return rp(_0x370144);}})[_0x2a90('0x23')](function(_0x59b9e6){if(_0x59b9e6){var _0x3b0d5e=[_0x2a90('0x68'),_0x2a90('0x69'),_0x2a90('0x6a'),_0x2a90('0x6b')];_[_0x2a90('0x6c')](_0x59b9e6[_0x2a90('0x5d')],function(_0x4d46f5){return _0x3b0d5e[_0x2a90('0x6d')](_0x4d46f5[_0x2a90('0x2a')]);});return{'count':_0x59b9e6[_0x2a90('0x5d')][_0x2a90('0x34')],'rows':_[_0x2a90('0x49')](_0x59b9e6[_0x2a90('0x5d')],function(_0x1bbadd){return{'id':_0x1bbadd['id'],'name':_0x1bbadd[_0x2a90('0x6e')]>0x7?_0x1bbadd['title']:_0x1bbadd[_0x2a90('0x2a')],'custom':_0x1bbadd[_0x2a90('0x6e')]>0x7?!![]:![],'options':_0x1bbadd['system_field_options']?_0x1bbadd[_0x2a90('0x6f')]:_0x1bbadd[_0x2a90('0x70')]?_0x1bbadd[_0x2a90('0x70')]:[]};})};}})[_0x2a90('0x23')](respondWithResult(_0x5a770b,null))[_0x2a90('0x45')](function(_0x16e9e7){var _0x4b4a47=_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?0x1f4:_0x16e9e7[_0x2a90('0x72')]||0x1f4;logger[_0x2a90('0x25')](_0x2a90('0x73'),_0x2a90('0x54'),_0x4b4a47,JSON[_0x2a90('0x74')](_0x16e9e7));delete _0x16e9e7[_0x2a90('0x2d')];if(_0x4b4a47===0x191){_0x4b4a47=0x190;}_0x5a770b['status'](_0x4b4a47)[_0x2a90('0x75')](_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?{'message':_0x2a90('0x76'),'statusCode':_0x16e9e7[_0x2a90('0x72')]}:_0x16e9e7);});}; \ No newline at end of file +var _0xbdb7=['rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','ZendeskAccount','include','findAll','rows','intersection','length','includeAll','options','catch','create','body','update','find','params','destroy','getConfigurations','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','authType','remoteUri','substring','GET','format','headers','%s:%s','username','toString','base64','Basic\x20%s','%s/token:%s','token','Unknown\x20authentication\x20type','subject','group','assignee','ticket_fields','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','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map'];(function(_0x1a043b,_0x4d540a){var _0x105ff5=function(_0x49532e){while(--_0x49532e){_0x1a043b['push'](_0x1a043b['shift']());}};_0x105ff5(++_0x4d540a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5d6448,_0x53522f){_0x5d6448=_0x5d6448-0x0;var _0x58c195=_0xbdb7[_0x5d6448];return _0x58c195;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];var integrations=require(_0x7bdb('0x17'));function respondWithStatusCode(_0x496613,_0x8d74ff){_0x8d74ff=_0x8d74ff||0xcc;return function(_0x53021d){if(_0x53021d){return _0x496613['sendStatus'](_0x8d74ff);}return _0x496613[_0x7bdb('0x18')](_0x8d74ff)[_0x7bdb('0x19')]();};}function respondWithResult(_0x4fd91a,_0x50eeca){_0x50eeca=_0x50eeca||0xc8;return function(_0x4e98f7){if(_0x4e98f7){return _0x4fd91a[_0x7bdb('0x18')](_0x50eeca)[_0x7bdb('0x1a')](_0x4e98f7);}};}function respondWithFilteredResult(_0xe9919f,_0x25d417){return function(_0x31c909){if(_0x31c909){var _0xbde12a=typeof _0x25d417[_0x7bdb('0x1b')]===_0x7bdb('0x1c')&&typeof _0x25d417['limit']===_0x7bdb('0x1c');var _0x43f352=_0x31c909[_0x7bdb('0x1d')];var _0x2aff6a=_0xbde12a?0x0:_0x25d417['offset'];var _0x41f540=_0xbde12a?_0x31c909[_0x7bdb('0x1d')]:_0x25d417['offset']+_0x25d417[_0x7bdb('0x1e')];var _0x31f78e;if(_0x41f540>=_0x43f352){_0x41f540=_0x43f352;_0x31f78e=0xc8;}else{_0x31f78e=0xce;}_0xe9919f[_0x7bdb('0x18')](_0x31f78e);return _0xe9919f[_0x7bdb('0x1f')](_0x7bdb('0x20'),_0x2aff6a+'-'+_0x41f540+'/'+_0x43f352)['json'](_0x31c909);}return null;};}function patchUpdates(_0x49f353){return function(_0x677825){try{jsonpatch[_0x7bdb('0x21')](_0x677825,_0x49f353,!![]);}catch(_0x5daea4){return BPromise[_0x7bdb('0x22')](_0x5daea4);}return _0x677825[_0x7bdb('0x23')]();};}function saveUpdates(_0x346c72,_0x3f53e7){return function(_0x3a1d0f){if(_0x3a1d0f){return _0x3a1d0f['update'](_0x346c72)[_0x7bdb('0x24')](function(_0xdad53d){return _0xdad53d;});}return null;};}function removeEntity(_0x40c447,_0x3a456f){return function(_0x481f4b){if(_0x481f4b){return _0x481f4b['destroy']()[_0x7bdb('0x24')](function(){_0x40c447['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9e02,_0x2abef6){return function(_0x51ab04){if(!_0x51ab04){_0x4a9e02[_0x7bdb('0x25')](0x194);}return _0x51ab04;};}function handleError(_0x72ba69,_0x3ec129){_0x3ec129=_0x3ec129||0x1f4;return function(_0x7c09cf){logger[_0x7bdb('0x26')](_0x7c09cf['stack']);if(_0x7c09cf[_0x7bdb('0x27')]){delete _0x7c09cf[_0x7bdb('0x27')];}_0x72ba69[_0x7bdb('0x18')](_0x3ec129)[_0x7bdb('0x28')](_0x7c09cf);};}exports[_0x7bdb('0x29')]=function(_0x2e8e65,_0x1e9996){var _0xd2d7be={},_0x25a1fe={},_0x365c02={'count':0x0,'rows':[]};var _0x9ec48d=_[_0x7bdb('0x2a')](db['ZendeskAccount'][_0x7bdb('0x2b')],function(_0x23fc3a){return{'name':_0x23fc3a[_0x7bdb('0x2c')],'type':_0x23fc3a[_0x7bdb('0x2d')][_0x7bdb('0x2e')]};});_0x25a1fe['model']=_[_0x7bdb('0x2a')](_0x9ec48d,_0x7bdb('0x27'));_0x25a1fe[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x2e8e65['query']);_0x25a1fe['filters']=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],_0x25a1fe['query']);_0xd2d7be[_0x7bdb('0x32')]=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x2e8e65[_0x7bdb('0x2f')]['fields']));_0xd2d7be[_0x7bdb('0x32')]=_0xd2d7be['attributes']['length']?_0xd2d7be[_0x7bdb('0x32')]:_0x25a1fe['model'];if(!_0x2e8e65[_0x7bdb('0x2f')]['hasOwnProperty']('nolimit')){_0xd2d7be[_0x7bdb('0x1e')]=qs[_0x7bdb('0x1e')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x1e')]);_0xd2d7be[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x2e8e65['query'][_0x7bdb('0x1b')]);}_0xd2d7be[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x35')]);_0xd2d7be[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x2e8e65[_0x7bdb('0x2f')],_0x25a1fe['filters']),_0x9ec48d);if(_0x2e8e65['query'][_0x7bdb('0x39')]){_0xd2d7be[_0x7bdb('0x36')]=_[_0x7bdb('0x3a')](_0xd2d7be[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x2a')](_0x9ec48d,function(_0x509e90){if(_0x509e90['type']!==_0x7bdb('0x3b')){var _0x5d7c1f={};_0x5d7c1f[_0x509e90[_0x7bdb('0x27')]]={'$like':'%'+_0x2e8e65['query'][_0x7bdb('0x39')]+'%'};return _0x5d7c1f;}})});}_0xd2d7be=_['merge']({},_0xd2d7be,_0x2e8e65['options']);var _0x21dae7={'where':_0xd2d7be[_0x7bdb('0x36')]};return db[_0x7bdb('0x3c')][_0x7bdb('0x1d')](_0x21dae7)[_0x7bdb('0x24')](function(_0x2b4829){_0x365c02[_0x7bdb('0x1d')]=_0x2b4829;if(_0x2e8e65['query']['includeAll']){_0xd2d7be[_0x7bdb('0x3d')]=[{'all':!![]}];}return db[_0x7bdb('0x3c')][_0x7bdb('0x3e')](_0xd2d7be);})[_0x7bdb('0x24')](function(_0x39fbca){_0x365c02[_0x7bdb('0x3f')]=_0x39fbca;return _0x365c02;})[_0x7bdb('0x24')](respondWithFilteredResult(_0x1e9996,_0xd2d7be))['catch'](handleError(_0x1e9996,null));};exports['show']=function(_0x1bcbcd,_0x8e893e){var _0x4636f8={'raw':![],'where':{'id':_0x1bcbcd['params']['id']}},_0x72a81c={};_0x72a81c[_0x7bdb('0x31')]=_['keys'](db[_0x7bdb('0x3c')][_0x7bdb('0x2b')]);_0x72a81c[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x1bcbcd[_0x7bdb('0x2f')]);_0x72a81c[_0x7bdb('0x37')]=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],_0x72a81c[_0x7bdb('0x2f')]);_0x4636f8['attributes']=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],qs['fields'](_0x1bcbcd[_0x7bdb('0x2f')]['fields']));_0x4636f8[_0x7bdb('0x32')]=_0x4636f8[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x4636f8[_0x7bdb('0x32')]:_0x72a81c[_0x7bdb('0x31')];if(_0x1bcbcd['query'][_0x7bdb('0x42')]){_0x4636f8[_0x7bdb('0x3d')]=[{'all':!![]}];}_0x4636f8=_[_0x7bdb('0x3a')]({},_0x4636f8,_0x1bcbcd[_0x7bdb('0x43')]);return db[_0x7bdb('0x3c')]['find'](_0x4636f8)[_0x7bdb('0x24')](handleEntityNotFound(_0x8e893e,null))[_0x7bdb('0x24')](respondWithResult(_0x8e893e,null))[_0x7bdb('0x44')](handleError(_0x8e893e,null));};exports[_0x7bdb('0x45')]=function(_0x259007,_0x25c534){return db[_0x7bdb('0x3c')][_0x7bdb('0x45')](_0x259007[_0x7bdb('0x46')],{})[_0x7bdb('0x24')](respondWithResult(_0x25c534,0xc9))['catch'](handleError(_0x25c534,null));};exports[_0x7bdb('0x47')]=function(_0x58c4bc,_0x47cccd){if(_0x58c4bc[_0x7bdb('0x46')]['id']){delete _0x58c4bc[_0x7bdb('0x46')]['id'];}return db['ZendeskAccount'][_0x7bdb('0x48')]({'where':{'id':_0x58c4bc[_0x7bdb('0x49')]['id']}})['then'](handleEntityNotFound(_0x47cccd,null))['then'](saveUpdates(_0x58c4bc['body'],null))[_0x7bdb('0x24')](respondWithResult(_0x47cccd,null))[_0x7bdb('0x44')](handleError(_0x47cccd,null));};exports[_0x7bdb('0x4a')]=function(_0x46410c,_0x33687b){return db[_0x7bdb('0x3c')][_0x7bdb('0x48')]({'where':{'id':_0x46410c[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x33687b,null))[_0x7bdb('0x24')](removeEntity(_0x33687b,null))['catch'](handleError(_0x33687b,null));};exports[_0x7bdb('0x4b')]=function(_0x4806e0,_0x240425,_0x27358d){var _0x5d564d={};var _0x457886={};var _0x493d23;var _0x258f29;return db['ZendeskAccount']['findOne']({'where':{'id':_0x4806e0[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x240425,null))['then'](function(_0x4e17f3){if(_0x4e17f3){_0x493d23=_0x4e17f3;_0x457886['model']=_[_0x7bdb('0x30')](db['ZendeskConfiguration']['rawAttributes']);_0x457886[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x4806e0[_0x7bdb('0x2f')]);_0x457886[_0x7bdb('0x37')]=_['intersection'](_0x457886[_0x7bdb('0x31')],_0x457886['query']);_0x5d564d[_0x7bdb('0x32')]=_[_0x7bdb('0x40')](_0x457886[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x33')]));_0x5d564d['attributes']=_0x5d564d[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x5d564d[_0x7bdb('0x32')]:_0x457886['model'];_0x5d564d[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x4806e0['query'][_0x7bdb('0x35')]);_0x5d564d['where']=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x4806e0['query'],_0x457886['filters']));if(_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]){_0x5d564d['where']=_[_0x7bdb('0x3a')](_0x5d564d['where'],{'$or':_[_0x7bdb('0x2a')](_0x5d564d['attributes'],function(_0x496cc3){var _0x22ef9c={};_0x22ef9c[_0x496cc3]={'$like':'%'+_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]+'%'};return _0x22ef9c;})});}_0x5d564d=_[_0x7bdb('0x3a')]({},_0x5d564d,_0x4806e0[_0x7bdb('0x43')]);return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})[_0x7bdb('0x24')](function(_0x8cf13a){if(_0x8cf13a){_0x258f29=_0x8cf13a[_0x7bdb('0x41')];if(!_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x4c')](_0x7bdb('0x4d'))){_0x5d564d['limit']=qs[_0x7bdb('0x1e')](_0x4806e0[_0x7bdb('0x2f')]['limit']);_0x5d564d[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x1b')]);}return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})['then'](function(_0xa5624f){if(_0xa5624f){return _0xa5624f?{'count':_0x258f29,'rows':_0xa5624f}:null;}})[_0x7bdb('0x24')](respondWithResult(_0x240425,null))[_0x7bdb('0x44')](handleError(_0x240425,null));};exports['addConfiguration']=function(_0x3dbcf,_0x2c2fb7,_0x33b93a){if(_0x3dbcf[_0x7bdb('0x46')]['id']){delete _0x3dbcf[_0x7bdb('0x46')]['id'];}return db[_0x7bdb('0x3c')][_0x7bdb('0x4e')]({'where':{'id':_0x3dbcf[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x2c2fb7,null))['then'](function(_0x7a7c4a){if(_0x7a7c4a){_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x4f')]=_0x7a7c4a['id'];_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x50')]=integrations[_0x7bdb('0x51')](_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x52')],_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x2d')]);_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x53')]=integrations[_0x7bdb('0x54')](_0x3dbcf['body'][_0x7bdb('0x52')],_0x3dbcf['body'][_0x7bdb('0x2d')]);return db[_0x7bdb('0x55')][_0x7bdb('0x45')](_0x3dbcf['body'],{'include':[{'model':db[_0x7bdb('0x56')],'as':_0x7bdb('0x50')},{'model':db['ZendeskField'],'as':_0x7bdb('0x53')}]});}return null;})[_0x7bdb('0x24')](respondWithResult(_0x2c2fb7,null))['catch'](handleError(_0x2c2fb7,null));};exports[_0x7bdb('0x57')]=function(_0x1a706b,_0x579caa,_0x291fd3){var _0x237688='';return db['ZendeskAccount'][_0x7bdb('0x4e')]({'where':{'id':_0x1a706b[_0x7bdb('0x49')]['id']},'attributes':['id','username',_0x7bdb('0x58'),'token',_0x7bdb('0x59'),_0x7bdb('0x5a')]})[_0x7bdb('0x24')](handleEntityNotFound(_0x579caa,null))[_0x7bdb('0x24')](function(_0x1e5063){if(_0x1e5063){_0x237688=_0x1e5063['remoteUri'];var _0x590818=_0x237688['slice'](-0x1);if(_0x590818==='/'){_0x237688=_0x237688[_0x7bdb('0x5b')](0x0,_0x237688['lastIndexOf'](_0x590818));}var _0x242a35={'method':_0x7bdb('0x5c'),'uri':util[_0x7bdb('0x5d')]('%s/%s',_0x237688,'ticket_fields'),'json':!![]};switch(_0x1e5063[_0x7bdb('0x59')]){case _0x7bdb('0x58'):_0x242a35[_0x7bdb('0x5e')]={'Authorization':util[_0x7bdb('0x5d')]('Basic\x20%s',new Buffer(util[_0x7bdb('0x5d')](_0x7bdb('0x5f'),_0x1e5063[_0x7bdb('0x60')],_0x1e5063[_0x7bdb('0x58')]))[_0x7bdb('0x61')](_0x7bdb('0x62')))};break;case'token':_0x242a35[_0x7bdb('0x5e')]={'Authorization':util['format'](_0x7bdb('0x63'),new Buffer(util['format'](_0x7bdb('0x64'),_0x1e5063[_0x7bdb('0x60')],_0x1e5063[_0x7bdb('0x65')]))[_0x7bdb('0x61')](_0x7bdb('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0x7bdb('0x66'));}return rp(_0x242a35);}})[_0x7bdb('0x24')](function(_0x51fec5){if(_0x51fec5){var _0x415ec5=[_0x7bdb('0x67'),'description',_0x7bdb('0x68'),_0x7bdb('0x69')];_['remove'](_0x51fec5[_0x7bdb('0x6a')],function(_0x493c69){return _0x415ec5['includes'](_0x493c69[_0x7bdb('0x2d')]);});return{'count':_0x51fec5[_0x7bdb('0x6a')]['length'],'rows':_['map'](_0x51fec5[_0x7bdb('0x6a')],function(_0x566a9e){return{'id':_0x566a9e['id'],'name':_0x566a9e[_0x7bdb('0x6b')]>0x7?_0x566a9e['title']:_0x566a9e[_0x7bdb('0x2d')],'custom':_0x566a9e[_0x7bdb('0x6b')]>0x7?!![]:![],'options':_0x566a9e[_0x7bdb('0x6c')]?_0x566a9e[_0x7bdb('0x6c')]:_0x566a9e['custom_field_options']?_0x566a9e[_0x7bdb('0x6d')]:[]};})};}})[_0x7bdb('0x24')](respondWithResult(_0x579caa,null))['catch'](function(_0x2be441){var _0x3096e0=_0x1a706b['query'][_0x7bdb('0x6e')]?0x1f4:_0x2be441[_0x7bdb('0x6f')]||0x1f4;logger[_0x7bdb('0x26')](_0x7bdb('0x70'),'getFields',_0x3096e0,JSON[_0x7bdb('0x71')](_0x2be441));delete _0x2be441['name'];if(_0x3096e0===0x191){_0x3096e0=0x190;}_0x579caa[_0x7bdb('0x18')](_0x3096e0)[_0x7bdb('0x28')](_0x1a706b[_0x7bdb('0x2f')]['test']?{'message':_0x7bdb('0x72'),'statusCode':_0x2be441[_0x7bdb('0x6f')]}:_0x2be441);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d7ce3dc..afb1c74 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 _0xfe39=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash'];(function(_0x2e260a,_0x7dc012){var _0x1edb06=function(_0x4be59f){while(--_0x4be59f){_0x2e260a['push'](_0x2e260a['shift']());}};_0x1edb06(++_0x7dc012);}(_0xfe39,0xa7));var _0x9fe3=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xfe39[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var logger=require(_0x9fe3('0x2'))(_0x9fe3('0x3'));var moment=require(_0x9fe3('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fe3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fe3('0x6'));var config=require(_0x9fe3('0x7'));var attributes=require(_0x9fe3('0x8'));var integrations=require(_0x9fe3('0x9'));module[_0x9fe3('0xa')]=function(_0x1c5618,_0x41fb1e){return _0x1c5618['define'](_0x9fe3('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe841=['ZendeskAccount','int_zendesk_accounts','lodash','api','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x5c28c5,_0x5c8d08){var _0x3793f6=function(_0x51782d){while(--_0x51782d){_0x5c28c5['push'](_0x5c28c5['shift']());}};_0x3793f6(++_0x5c8d08);}(_0xe841,0xc0));var _0x1e84=function(_0x487f1b,_0x438726){_0x487f1b=_0x487f1b-0x0;var _0x13162a=_0xe841[_0x487f1b];return _0x13162a;};'use strict';var _=require(_0x1e84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1e84('0x1'));var moment=require('moment');var BPromise=require(_0x1e84('0x2'));var rp=require(_0x1e84('0x3'));var fs=require('fs');var path=require(_0x1e84('0x4'));var rimraf=require(_0x1e84('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e84('0x6'));var integrations=require(_0x1e84('0x7'));module['exports']=function(_0x72a71a,_0x3e273c){return _0x72a71a['define'](_0x1e84('0x8'),attributes,{'tableName':_0x1e84('0x9'),'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 f1eca6f..39b72fb 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 _0xd7c0=['debug','find','ShowZendeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x391802,_0xde0fd){var _0x3aa73b=function(_0x31d199){while(--_0x31d199){_0x391802['push'](_0x391802['shift']());}};_0x3aa73b(++_0xde0fd);}(_0xd7c0,0x13e));var _0x0d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d7c('0x0'));var util=require(_0x0d7c('0x1'));var moment=require(_0x0d7c('0x2'));var BPromise=require(_0x0d7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d7c('0x4'))['db'];var utils=require(_0x0d7c('0x5'));var logger=require(_0x0d7c('0x6'))('rpc');var config=require(_0x0d7c('0x7'));var jayson=require(_0x0d7c('0x8'));var client=jayson[_0x0d7c('0x9')][_0x0d7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x405e31,_0x1d0a49,_0x17e42d){return new BPromise(function(_0x17b7a9,_0x57a0ae){return client[_0x0d7c('0xb')](_0x405e31,_0x17e42d)['then'](function(_0x5a9cfe){logger[_0x0d7c('0xc')](_0x0d7c('0xd'),_0x1d0a49,'request\x20sent');logger['debug'](_0x0d7c('0xe'),_0x1d0a49,_0x0d7c('0xf'),JSON[_0x0d7c('0x10')](_0x5a9cfe));if(_0x5a9cfe[_0x0d7c('0x11')]){if(_0x5a9cfe['error']['code']===0x1f4){logger['error'](_0x0d7c('0xd'),_0x1d0a49,_0x5a9cfe['error']['message']);return _0x57a0ae(_0x5a9cfe[_0x0d7c('0x11')]['message']);}logger[_0x0d7c('0x11')](_0x0d7c('0xd'),_0x1d0a49,_0x5a9cfe[_0x0d7c('0x11')][_0x0d7c('0x12')]);return _0x17b7a9(_0x5a9cfe['error'][_0x0d7c('0x12')]);}else{logger[_0x0d7c('0xc')](_0x0d7c('0xd'),_0x1d0a49,'request\x20sent');_0x17b7a9(_0x5a9cfe[_0x0d7c('0x13')]['message']);}})[_0x0d7c('0x14')](function(_0x55c983){logger['error'](_0x0d7c('0xd'),_0x1d0a49,_0x55c983);_0x57a0ae(_0x55c983);});});}exports[_0x0d7c('0x15')]=function(_0x445843){var _0x36f070=this;return new Promise(function(_0x502e89,_0x19fc50){return db[_0x0d7c('0x16')]['findAll']({'raw':_0x445843[_0x0d7c('0x17')]?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x18')]===undefined?!![]:![]:!![],'where':_0x445843[_0x0d7c('0x17')]?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x19')]||null:null,'attributes':_0x445843['options']?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x1a')]||null:null,'limit':_0x445843[_0x0d7c('0x17')]?_0x445843['options'][_0x0d7c('0x1b')]||null:null,'include':_0x445843[_0x0d7c('0x17')]?_0x445843['options'][_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x445843['options'][_0x0d7c('0x1c')],function(_0x1bb903){return{'model':db[_0x1bb903[_0x0d7c('0x1e')]],'as':_0x1bb903['as'],'attributes':_0x1bb903[_0x0d7c('0x1a')],'include':_0x1bb903[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x1bb903[_0x0d7c('0x1c')],function(_0x40ccd8){return{'model':db[_0x40ccd8[_0x0d7c('0x1e')]],'as':_0x40ccd8['as'],'attributes':_0x40ccd8['attributes'],'include':_0x40ccd8[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x40ccd8[_0x0d7c('0x1c')],function(_0x558951){return{'model':db[_0x558951[_0x0d7c('0x1e')]],'as':_0x558951['as'],'attributes':_0x558951['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d7c('0x1f')](function(_0x2898e1){logger[_0x0d7c('0xc')]('GetZendeskAccount',_0x445843);logger[_0x0d7c('0x20')](_0x0d7c('0x15'),_0x445843,JSON['stringify'](_0x2898e1));_0x502e89(_0x2898e1);})['catch'](function(_0x301d65){logger[_0x0d7c('0x11')](_0x0d7c('0x15'),_0x301d65[_0x0d7c('0x12')],_0x445843);_0x19fc50(_0x36f070[_0x0d7c('0x11')](0x1f4,_0x301d65['message']));});});};exports['ShowZendeskAccount']=function(_0x399fe3){var _0x73bd6d=this;return new Promise(function(_0x33ddbd,_0x32ae2e){return db[_0x0d7c('0x16')][_0x0d7c('0x21')]({'raw':_0x399fe3['options']?_0x399fe3['options']['raw']===undefined?!![]:![]:!![],'where':_0x399fe3[_0x0d7c('0x17')]?_0x399fe3['options'][_0x0d7c('0x19')]||null:null,'attributes':_0x399fe3['options']?_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1a')]||null:null,'include':_0x399fe3[_0x0d7c('0x17')]?_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1c')],function(_0x1cc2f9){return{'model':db[_0x1cc2f9['model']],'as':_0x1cc2f9['as'],'attributes':_0x1cc2f9[_0x0d7c('0x1a')],'include':_0x1cc2f9[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x1cc2f9[_0x0d7c('0x1c')],function(_0x395e1f){return{'model':db[_0x395e1f['model']],'as':_0x395e1f['as'],'attributes':_0x395e1f[_0x0d7c('0x1a')],'include':_0x395e1f[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x395e1f['include'],function(_0x327797){return{'model':db[_0x327797[_0x0d7c('0x1e')]],'as':_0x327797['as'],'attributes':_0x327797[_0x0d7c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140544){logger[_0x0d7c('0xc')]('ShowZendeskAccount',_0x399fe3);logger[_0x0d7c('0x20')]('ShowZendeskAccount',_0x399fe3,JSON[_0x0d7c('0x10')](_0x140544));_0x33ddbd(_0x140544);})[_0x0d7c('0x14')](function(_0x1a9214){logger['error'](_0x0d7c('0x22'),_0x1a9214[_0x0d7c('0x12')],_0x399fe3);_0x32ae2e(_0x73bd6d[_0x0d7c('0x11')](0x1f4,_0x1a9214[_0x0d7c('0x12')]));});});}; \ No newline at end of file +var _0x0f37=['debug','stringify','find','raw','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','then'];(function(_0x5a1d99,_0x5bbd4f){var _0x21d39c=function(_0x2b3eda){while(--_0x2b3eda){_0x5a1d99['push'](_0x5a1d99['shift']());}};_0x21d39c(++_0x5bbd4f);}(_0x0f37,0x191));var _0x70f3=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x0f37[_0x258257];return _0xafb58a;};'use strict';var _=require('lodash');var util=require(_0x70f3('0x0'));var moment=require('moment');var BPromise=require(_0x70f3('0x1'));var rs=require(_0x70f3('0x2'));var fs=require('fs');var Redis=require(_0x70f3('0x3'));var db=require(_0x70f3('0x4'))['db'];var utils=require(_0x70f3('0x5'));var logger=require(_0x70f3('0x6'))(_0x70f3('0x7'));var config=require(_0x70f3('0x8'));var jayson=require(_0x70f3('0x9'));var client=jayson[_0x70f3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ae64,_0x3cbf59,_0x513385){return new BPromise(function(_0x4fe47e,_0x12adc2){return client[_0x70f3('0xb')](_0x31ae64,_0x513385)['then'](function(_0x3133a0){logger['info'](_0x70f3('0xc'),_0x3cbf59,_0x70f3('0xd'));logger['debug'](_0x70f3('0xe'),_0x3cbf59,_0x70f3('0xd'),JSON['stringify'](_0x3133a0));if(_0x3133a0['error']){if(_0x3133a0[_0x70f3('0xf')][_0x70f3('0x10')]===0x1f4){logger[_0x70f3('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3cbf59,_0x3133a0[_0x70f3('0xf')][_0x70f3('0x11')]);return _0x12adc2(_0x3133a0[_0x70f3('0xf')][_0x70f3('0x11')]);}logger['error'](_0x70f3('0xc'),_0x3cbf59,_0x3133a0['error'][_0x70f3('0x11')]);return _0x4fe47e(_0x3133a0[_0x70f3('0xf')]['message']);}else{logger[_0x70f3('0x12')](_0x70f3('0xc'),_0x3cbf59,_0x70f3('0xd'));_0x4fe47e(_0x3133a0['result'][_0x70f3('0x11')]);}})[_0x70f3('0x13')](function(_0x45e20f){logger['error'](_0x70f3('0xc'),_0x3cbf59,_0x45e20f);_0x12adc2(_0x45e20f);});});}exports[_0x70f3('0x14')]=function(_0x38b705){var _0x34c74a=this;return new Promise(function(_0x3bda81,_0x3035b2){return db[_0x70f3('0x15')][_0x70f3('0x16')]({'raw':_0x38b705[_0x70f3('0x17')]?_0x38b705['options']['raw']===undefined?!![]:![]:!![],'where':_0x38b705['options']?_0x38b705['options'][_0x70f3('0x18')]||null:null,'attributes':_0x38b705[_0x70f3('0x17')]?_0x38b705[_0x70f3('0x17')][_0x70f3('0x19')]||null:null,'limit':_0x38b705[_0x70f3('0x17')]?_0x38b705[_0x70f3('0x17')][_0x70f3('0x1a')]||null:null,'include':_0x38b705['options']?_0x38b705[_0x70f3('0x17')]['include']?_['map'](_0x38b705['options'][_0x70f3('0x1b')],function(_0x327f11){return{'model':db[_0x327f11[_0x70f3('0x1c')]],'as':_0x327f11['as'],'attributes':_0x327f11[_0x70f3('0x19')],'include':_0x327f11[_0x70f3('0x1b')]?_[_0x70f3('0x1d')](_0x327f11[_0x70f3('0x1b')],function(_0x159b8c){return{'model':db[_0x159b8c['model']],'as':_0x159b8c['as'],'attributes':_0x159b8c[_0x70f3('0x19')],'include':_0x159b8c[_0x70f3('0x1b')]?_['map'](_0x159b8c[_0x70f3('0x1b')],function(_0x40f356){return{'model':db[_0x40f356['model']],'as':_0x40f356['as'],'attributes':_0x40f356[_0x70f3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x70f3('0x1e')](function(_0x7920f0){logger[_0x70f3('0x12')](_0x70f3('0x14'),_0x38b705);logger[_0x70f3('0x1f')](_0x70f3('0x14'),_0x38b705,JSON[_0x70f3('0x20')](_0x7920f0));_0x3bda81(_0x7920f0);})[_0x70f3('0x13')](function(_0xf8c169){logger[_0x70f3('0xf')](_0x70f3('0x14'),_0xf8c169['message'],_0x38b705);_0x3035b2(_0x34c74a['error'](0x1f4,_0xf8c169[_0x70f3('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x5a06aa){var _0x2079bf=this;return new Promise(function(_0x3abeee,_0x5c0af3){return db[_0x70f3('0x15')][_0x70f3('0x21')]({'raw':_0x5a06aa[_0x70f3('0x17')]?_0x5a06aa[_0x70f3('0x17')][_0x70f3('0x22')]===undefined?!![]:![]:!![],'where':_0x5a06aa[_0x70f3('0x17')]?_0x5a06aa[_0x70f3('0x17')][_0x70f3('0x18')]||null:null,'attributes':_0x5a06aa[_0x70f3('0x17')]?_0x5a06aa[_0x70f3('0x17')]['attributes']||null:null,'include':_0x5a06aa[_0x70f3('0x17')]?_0x5a06aa[_0x70f3('0x17')][_0x70f3('0x1b')]?_['map'](_0x5a06aa[_0x70f3('0x17')]['include'],function(_0x16b9f4){return{'model':db[_0x16b9f4['model']],'as':_0x16b9f4['as'],'attributes':_0x16b9f4[_0x70f3('0x19')],'include':_0x16b9f4[_0x70f3('0x1b')]?_['map'](_0x16b9f4['include'],function(_0x27c393){return{'model':db[_0x27c393['model']],'as':_0x27c393['as'],'attributes':_0x27c393[_0x70f3('0x19')],'include':_0x27c393['include']?_[_0x70f3('0x1d')](_0x27c393[_0x70f3('0x1b')],function(_0x50fd5f){return{'model':db[_0x50fd5f['model']],'as':_0x50fd5f['as'],'attributes':_0x50fd5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x70f3('0x1e')](function(_0x387c92){logger[_0x70f3('0x12')](_0x70f3('0x23'),_0x5a06aa);logger[_0x70f3('0x1f')](_0x70f3('0x23'),_0x5a06aa,JSON['stringify'](_0x387c92));_0x3abeee(_0x387c92);})[_0x70f3('0x13')](function(_0x5e1ce4){logger['error'](_0x70f3('0x23'),_0x5e1ce4[_0x70f3('0x11')],_0x5a06aa);_0x5c0af3(_0x2079bf['error'](0x1f4,_0x5e1ce4['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d5463d3..59bf4f6 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 _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x4024,0x89));var _0x4402=function(_0x37e2a6,_0xc52f3d){_0x37e2a6=_0x37e2a6-0x0;var _0x3c4754=_0x4024[_0x37e2a6];return _0x3c4754;};'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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x58d0de,_0x4141db){var _0x418d6c=function(_0x596c6d){while(--_0x596c6d){_0x58d0de['push'](_0x58d0de['shift']());}};_0x418d6c(++_0x4141db);}(_0xac4a,0x13f));var _0xaac4=function(_0x428bf2,_0x5829fd){_0x428bf2=_0x428bf2-0x0;var _0x1728d1=_0xac4a[_0x428bf2];return _0x1728d1;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0278583..5091406 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 _0x4319=['exports','STRING','sequelize'];(function(_0x2cd678,_0x43ec9e){var _0x2cf8fe=function(_0x416519){while(--_0x416519){_0x2cd678['push'](_0x2cd678['shift']());}};_0x2cf8fe(++_0x43ec9e);}(_0x4319,0x113));var _0x9431=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x4319[_0x2726ad];return _0xd87993;};'use strict';var Sequelize=require(_0x9431('0x0'));module[_0x9431('0x1')]={'name':{'type':Sequelize[_0x9431('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ef7=['STRING','exports'];(function(_0x22dbd1,_0x47e0bb){var _0x50a4fd=function(_0x5cadf4){while(--_0x5cadf4){_0x22dbd1['push'](_0x22dbd1['shift']());}};_0x50a4fd(++_0x47e0bb);}(_0x4ef7,0x1c5));var _0x74ef=function(_0x15587f,_0x455f7b){_0x15587f=_0x15587f-0x0;var _0x34b46d=_0x4ef7[_0x15587f];return _0x34b46d;};'use strict';var Sequelize=require('sequelize');module[_0x74ef('0x0')]={'name':{'type':Sequelize[_0x74ef('0x1')]},'description':{'type':Sequelize[_0x74ef('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 40719b8..0ae0b62 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 _0x0431=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','name','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','update','find','getFields','params','pick','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x3ecf95,_0x559a2c){var _0x3f1e72=function(_0x4160c0){while(--_0x4160c0){_0x3ecf95['push'](_0x3ecf95['shift']());}};_0x3f1e72(++_0x559a2c);}(_0x0431,0xa7));var _0x1043=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x0431[_0x368bba];return _0x409f8f;};'use strict';var emlformat=require(_0x1043('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1043('0x1'));var jsonpatch=require(_0x1043('0x2'));var rp=require('request-promise');var moment=require(_0x1043('0x3'));var BPromise=require(_0x1043('0x4'));var Mustache=require(_0x1043('0x5'));var util=require(_0x1043('0x6'));var path=require('path');var sox=require(_0x1043('0x7'));var csv=require(_0x1043('0x8'));var ejs=require(_0x1043('0x9'));var fs=require('fs');var fs_extra=require(_0x1043('0xa'));var _=require(_0x1043('0xb'));var squel=require(_0x1043('0xc'));var crypto=require(_0x1043('0xd'));var jsforce=require(_0x1043('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1043('0x8'));var querystring=require(_0x1043('0xf'));var Papa=require(_0x1043('0x10'));var Redis=require(_0x1043('0x11'));var authService=require(_0x1043('0x12'));var qs=require(_0x1043('0x13'));var as=require(_0x1043('0x14'));var hardwareService=require(_0x1043('0x15'));var logger=require(_0x1043('0x16'))(_0x1043('0x17'));var utils=require(_0x1043('0x18'));var config=require(_0x1043('0x19'));var licenseUtil=require(_0x1043('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e831e,_0x2f7b2c){_0x2f7b2c=_0x2f7b2c||0xcc;return function(_0x4f5bdf){if(_0x4f5bdf){return _0x2e831e[_0x1043('0x1b')](_0x2f7b2c);}return _0x2e831e[_0x1043('0x1c')](_0x2f7b2c)[_0x1043('0x1d')]();};}function respondWithResult(_0x135b68,_0xc484b8){_0xc484b8=_0xc484b8||0xc8;return function(_0x21b2f0){if(_0x21b2f0){return _0x135b68[_0x1043('0x1c')](_0xc484b8)[_0x1043('0x1e')](_0x21b2f0);}};}function respondWithFilteredResult(_0x2d01ac,_0x5652e1){return function(_0x5849bf){if(_0x5849bf){var _0x5a8ebc=typeof _0x5652e1[_0x1043('0x1f')]===_0x1043('0x20')&&typeof _0x5652e1[_0x1043('0x21')]===_0x1043('0x20');var _0x31cb87=_0x5849bf['count'];var _0x28a8da=_0x5a8ebc?0x0:_0x5652e1[_0x1043('0x1f')];var _0x11031c=_0x5a8ebc?_0x5849bf['count']:_0x5652e1['offset']+_0x5652e1[_0x1043('0x21')];var _0x3b9116;if(_0x11031c>=_0x31cb87){_0x11031c=_0x31cb87;_0x3b9116=0xc8;}else{_0x3b9116=0xce;}_0x2d01ac[_0x1043('0x1c')](_0x3b9116);return _0x2d01ac['set'](_0x1043('0x22'),_0x28a8da+'-'+_0x11031c+'/'+_0x31cb87)[_0x1043('0x1e')](_0x5849bf);}return null;};}function patchUpdates(_0x4892cd){return function(_0x48f76d){try{jsonpatch[_0x1043('0x23')](_0x48f76d,_0x4892cd,!![]);}catch(_0x5781e1){return BPromise[_0x1043('0x24')](_0x5781e1);}return _0x48f76d[_0x1043('0x25')]();};}function saveUpdates(_0x46d6be,_0x276e8e){return function(_0x2e2744){if(_0x2e2744){return _0x2e2744['update'](_0x46d6be)['then'](function(_0x5ca12e){return _0x5ca12e;});}return null;};}function removeEntity(_0x4efbec,_0x1c831a){return function(_0x239a77){if(_0x239a77){return _0x239a77[_0x1043('0x26')]()[_0x1043('0x27')](function(){_0x4efbec[_0x1043('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28c330,_0x5b3de5){return function(_0xa21bcd){if(!_0xa21bcd){_0x28c330[_0x1043('0x1b')](0x194);}return _0xa21bcd;};}function handleError(_0x83bb47,_0x3d22bf){_0x3d22bf=_0x3d22bf||0x1f4;return function(_0x3c1096){logger['error'](_0x3c1096['stack']);if(_0x3c1096[_0x1043('0x28')]){delete _0x3c1096[_0x1043('0x28')];}_0x83bb47[_0x1043('0x1c')](_0x3d22bf)['send'](_0x3c1096);};}exports[_0x1043('0x29')]=function(_0x204efa,_0x4609b4){var _0x3ea92f={},_0x359edf={},_0x45e3d6={'count':0x0,'rows':[]};var _0x914c97=_[_0x1043('0x2a')](db[_0x1043('0x2b')]['rawAttributes'],function(_0x4b41e7){return{'name':_0x4b41e7[_0x1043('0x2c')],'type':_0x4b41e7[_0x1043('0x2d')][_0x1043('0x2e')]};});_0x359edf[_0x1043('0x2f')]=_[_0x1043('0x2a')](_0x914c97,_0x1043('0x28'));_0x359edf[_0x1043('0x30')]=_[_0x1043('0x31')](_0x204efa[_0x1043('0x30')]);_0x359edf[_0x1043('0x32')]=_[_0x1043('0x33')](_0x359edf['model'],_0x359edf[_0x1043('0x30')]);_0x3ea92f[_0x1043('0x34')]=_[_0x1043('0x33')](_0x359edf[_0x1043('0x2f')],qs['fields'](_0x204efa['query'][_0x1043('0x35')]));_0x3ea92f[_0x1043('0x34')]=_0x3ea92f[_0x1043('0x34')][_0x1043('0x36')]?_0x3ea92f[_0x1043('0x34')]:_0x359edf[_0x1043('0x2f')];if(!_0x204efa[_0x1043('0x30')][_0x1043('0x37')](_0x1043('0x38'))){_0x3ea92f[_0x1043('0x21')]=qs[_0x1043('0x21')](_0x204efa[_0x1043('0x30')][_0x1043('0x21')]);_0x3ea92f[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x204efa[_0x1043('0x30')][_0x1043('0x1f')]);}_0x3ea92f[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x204efa[_0x1043('0x30')][_0x1043('0x3a')]);_0x3ea92f[_0x1043('0x3b')]=qs[_0x1043('0x32')](_['pick'](_0x204efa[_0x1043('0x30')],_0x359edf['filters']),_0x914c97);if(_0x204efa[_0x1043('0x30')][_0x1043('0x3c')]){_0x3ea92f[_0x1043('0x3b')]=_[_0x1043('0x3d')](_0x3ea92f['where'],{'$or':_['map'](_0x914c97,function(_0x480b1c){if(_0x480b1c[_0x1043('0x2d')]!=='VIRTUAL'){var _0x25b92d={};_0x25b92d[_0x480b1c['name']]={'$like':'%'+_0x204efa[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x25b92d;}})});}_0x3ea92f=_[_0x1043('0x3d')]({},_0x3ea92f,_0x204efa[_0x1043('0x3e')]);var _0x3d0717={'where':_0x3ea92f[_0x1043('0x3b')]};return db[_0x1043('0x2b')][_0x1043('0x3f')](_0x3d0717)['then'](function(_0x4197f2){_0x45e3d6[_0x1043('0x3f')]=_0x4197f2;if(_0x204efa[_0x1043('0x30')][_0x1043('0x40')]){_0x3ea92f[_0x1043('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x1043('0x42')](_0x3ea92f);})[_0x1043('0x27')](function(_0x5f2083){_0x45e3d6[_0x1043('0x43')]=_0x5f2083;return _0x45e3d6;})[_0x1043('0x27')](respondWithFilteredResult(_0x4609b4,_0x3ea92f))[_0x1043('0x44')](handleError(_0x4609b4,null));};exports[_0x1043('0x45')]=function(_0xbfbf32,_0x1cdcc0){var _0x177db9={'raw':![],'where':{'id':_0xbfbf32['params']['id']}},_0x531978={};_0x531978[_0x1043('0x2f')]=_[_0x1043('0x31')](db['ZendeskConfiguration'][_0x1043('0x46')]);_0x531978[_0x1043('0x30')]=_[_0x1043('0x31')](_0xbfbf32[_0x1043('0x30')]);_0x531978[_0x1043('0x32')]=_['intersection'](_0x531978[_0x1043('0x2f')],_0x531978[_0x1043('0x30')]);_0x177db9[_0x1043('0x34')]=_[_0x1043('0x33')](_0x531978[_0x1043('0x2f')],qs['fields'](_0xbfbf32[_0x1043('0x30')][_0x1043('0x35')]));_0x177db9['attributes']=_0x177db9[_0x1043('0x34')][_0x1043('0x36')]?_0x177db9[_0x1043('0x34')]:_0x531978[_0x1043('0x2f')];if(_0xbfbf32[_0x1043('0x30')][_0x1043('0x40')]){_0x177db9[_0x1043('0x41')]=[{'all':!![]}];}_0x177db9=_[_0x1043('0x3d')]({},_0x177db9,_0xbfbf32[_0x1043('0x3e')]);return db[_0x1043('0x2b')]['find'](_0x177db9)['then'](handleEntityNotFound(_0x1cdcc0,null))[_0x1043('0x27')](respondWithResult(_0x1cdcc0,null))[_0x1043('0x44')](handleError(_0x1cdcc0,null));};exports['create']=function(_0x3ab095,_0x4c41d2){return db[_0x1043('0x2b')][_0x1043('0x47')](_0x3ab095[_0x1043('0x48')],{})[_0x1043('0x27')](respondWithResult(_0x4c41d2,0xc9))[_0x1043('0x44')](handleError(_0x4c41d2,null));};exports[_0x1043('0x49')]=function(_0x39ddc1,_0x4de370){if(_0x39ddc1['body']['id']){delete _0x39ddc1['body']['id'];}return db[_0x1043('0x2b')]['find']({'where':{'id':_0x39ddc1['params']['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x4de370,null))[_0x1043('0x27')](saveUpdates(_0x39ddc1[_0x1043('0x48')],null))[_0x1043('0x27')](respondWithResult(_0x4de370,null))['catch'](handleError(_0x4de370,null));};exports['destroy']=function(_0x2283dc,_0x512218){return db[_0x1043('0x2b')][_0x1043('0x4a')]({'where':{'id':_0x2283dc['params']['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x512218,null))[_0x1043('0x27')](removeEntity(_0x512218,null))[_0x1043('0x44')](handleError(_0x512218,null));};exports[_0x1043('0x4b')]=function(_0x5efe74,_0x2e170f,_0x562025){var _0x51a420={};var _0x3fa06d={};var _0xc14945;var _0x5468b5;return db[_0x1043('0x2b')]['findOne']({'where':{'id':_0x5efe74[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x2e170f,null))[_0x1043('0x27')](function(_0xaaa95d){if(_0xaaa95d){_0xc14945=_0xaaa95d;_0x3fa06d[_0x1043('0x2f')]=_[_0x1043('0x31')](db['ZendeskField']['rawAttributes']);_0x3fa06d[_0x1043('0x30')]=_[_0x1043('0x31')](_0x5efe74[_0x1043('0x30')]);_0x3fa06d['filters']=_['intersection'](_0x3fa06d[_0x1043('0x2f')],_0x3fa06d[_0x1043('0x30')]);_0x51a420['attributes']=_['intersection'](_0x3fa06d[_0x1043('0x2f')],qs['fields'](_0x5efe74[_0x1043('0x30')][_0x1043('0x35')]));_0x51a420['attributes']=_0x51a420['attributes'][_0x1043('0x36')]?_0x51a420['attributes']:_0x3fa06d['model'];_0x51a420[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x5efe74[_0x1043('0x30')][_0x1043('0x3a')]);_0x51a420['where']=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x5efe74[_0x1043('0x30')],_0x3fa06d[_0x1043('0x32')]));if(_0x5efe74[_0x1043('0x30')][_0x1043('0x3c')]){_0x51a420['where']=_[_0x1043('0x3d')](_0x51a420[_0x1043('0x3b')],{'$or':_['map'](_0x51a420[_0x1043('0x34')],function(_0x26a6df){var _0x4105d9={};_0x4105d9[_0x26a6df]={'$like':'%'+_0x5efe74[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x4105d9;})});}_0x51a420=_[_0x1043('0x3d')]({},_0x51a420,_0x5efe74[_0x1043('0x3e')]);return _0xc14945[_0x1043('0x4b')](_0x51a420);}})[_0x1043('0x27')](function(_0x64c43){if(_0x64c43){_0x5468b5=_0x64c43['length'];if(!_0x5efe74[_0x1043('0x30')][_0x1043('0x37')](_0x1043('0x38'))){_0x51a420[_0x1043('0x21')]=qs['limit'](_0x5efe74[_0x1043('0x30')][_0x1043('0x21')]);_0x51a420[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x5efe74['query'][_0x1043('0x1f')]);}return _0xc14945[_0x1043('0x4b')](_0x51a420);}})[_0x1043('0x27')](function(_0x31f2f7){if(_0x31f2f7){return _0x31f2f7?{'count':_0x5468b5,'rows':_0x31f2f7}:null;}})[_0x1043('0x27')](respondWithResult(_0x2e170f,null))[_0x1043('0x44')](handleError(_0x2e170f,null));};exports['getSubjects']=function(_0x1a3776,_0x56ed35,_0x7dfed){var _0x44e067={};var _0x395807={};var _0x3684fc;var _0x197a88;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x1a3776[_0x1043('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56ed35,null))[_0x1043('0x27')](function(_0x1f1576){if(_0x1f1576){_0x3684fc=_0x1f1576;_0x395807[_0x1043('0x2f')]=_[_0x1043('0x31')](db[_0x1043('0x4f')][_0x1043('0x46')]);_0x395807[_0x1043('0x30')]=_[_0x1043('0x31')](_0x1a3776['query']);_0x395807['filters']=_[_0x1043('0x33')](_0x395807[_0x1043('0x2f')],_0x395807['query']);_0x44e067['attributes']=_[_0x1043('0x33')](_0x395807[_0x1043('0x2f')],qs['fields'](_0x1a3776['query'][_0x1043('0x35')]));_0x44e067['attributes']=_0x44e067[_0x1043('0x34')]['length']?_0x44e067[_0x1043('0x34')]:_0x395807[_0x1043('0x2f')];_0x44e067[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x1a3776[_0x1043('0x30')][_0x1043('0x3a')]);_0x44e067[_0x1043('0x3b')]=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x1a3776[_0x1043('0x30')],_0x395807[_0x1043('0x32')]));if(_0x1a3776[_0x1043('0x30')][_0x1043('0x3c')]){_0x44e067[_0x1043('0x3b')]=_['merge'](_0x44e067[_0x1043('0x3b')],{'$or':_['map'](_0x44e067[_0x1043('0x34')],function(_0x21e1d3){var _0x176808={};_0x176808[_0x21e1d3]={'$like':'%'+_0x1a3776['query'][_0x1043('0x3c')]+'%'};return _0x176808;})});}_0x44e067=_['merge']({},_0x44e067,_0x1a3776[_0x1043('0x3e')]);return _0x3684fc[_0x1043('0x50')](_0x44e067);}})[_0x1043('0x27')](function(_0x43ac68){if(_0x43ac68){_0x197a88=_0x43ac68[_0x1043('0x36')];if(!_0x1a3776[_0x1043('0x30')]['hasOwnProperty'](_0x1043('0x38'))){_0x44e067[_0x1043('0x21')]=qs[_0x1043('0x21')](_0x1a3776[_0x1043('0x30')]['limit']);_0x44e067[_0x1043('0x1f')]=qs['offset'](_0x1a3776[_0x1043('0x30')][_0x1043('0x1f')]);}return _0x3684fc[_0x1043('0x50')](_0x44e067);}})[_0x1043('0x27')](function(_0x5252e8){if(_0x5252e8){return _0x5252e8?{'count':_0x197a88,'rows':_0x5252e8}:null;}})[_0x1043('0x27')](respondWithResult(_0x56ed35,null))[_0x1043('0x44')](handleError(_0x56ed35,null));};exports['getDescriptions']=function(_0x30545c,_0x38c468,_0x16405c){var _0x3699af={};var _0x4ab3d9={};var _0x18f602;var _0x36cb04;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x30545c[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x38c468,null))['then'](function(_0x11e5ad){if(_0x11e5ad){_0x18f602=_0x11e5ad;_0x4ab3d9[_0x1043('0x2f')]=_[_0x1043('0x31')](db[_0x1043('0x4f')]['rawAttributes']);_0x4ab3d9[_0x1043('0x30')]=_['keys'](_0x30545c[_0x1043('0x30')]);_0x4ab3d9[_0x1043('0x32')]=_[_0x1043('0x33')](_0x4ab3d9[_0x1043('0x2f')],_0x4ab3d9[_0x1043('0x30')]);_0x3699af[_0x1043('0x34')]=_[_0x1043('0x33')](_0x4ab3d9[_0x1043('0x2f')],qs['fields'](_0x30545c[_0x1043('0x30')]['fields']));_0x3699af['attributes']=_0x3699af[_0x1043('0x34')][_0x1043('0x36')]?_0x3699af['attributes']:_0x4ab3d9[_0x1043('0x2f')];_0x3699af[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x30545c[_0x1043('0x30')][_0x1043('0x3a')]);_0x3699af[_0x1043('0x3b')]=qs['filters'](_[_0x1043('0x4d')](_0x30545c[_0x1043('0x30')],_0x4ab3d9[_0x1043('0x32')]));if(_0x30545c[_0x1043('0x30')][_0x1043('0x3c')]){_0x3699af['where']=_['merge'](_0x3699af[_0x1043('0x3b')],{'$or':_['map'](_0x3699af[_0x1043('0x34')],function(_0x591d9f){var _0x26bb60={};_0x26bb60[_0x591d9f]={'$like':'%'+_0x30545c[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x26bb60;})});}_0x3699af=_[_0x1043('0x3d')]({},_0x3699af,_0x30545c[_0x1043('0x3e')]);return _0x18f602[_0x1043('0x51')](_0x3699af);}})[_0x1043('0x27')](function(_0x20ed0d){if(_0x20ed0d){_0x36cb04=_0x20ed0d['length'];if(!_0x30545c[_0x1043('0x30')]['hasOwnProperty'](_0x1043('0x38'))){_0x3699af[_0x1043('0x21')]=qs['limit'](_0x30545c[_0x1043('0x30')][_0x1043('0x21')]);_0x3699af[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x30545c[_0x1043('0x30')][_0x1043('0x1f')]);}return _0x18f602[_0x1043('0x51')](_0x3699af);}})[_0x1043('0x27')](function(_0x4d7782){if(_0x4d7782){return _0x4d7782?{'count':_0x36cb04,'rows':_0x4d7782}:null;}})['then'](respondWithResult(_0x38c468,null))['catch'](handleError(_0x38c468,null));};exports[_0x1043('0x52')]=function(_0x4cb4ad,_0xb1a655,_0x354993){var _0x4399a3={};var _0x3b76e7={};var _0x3a157c;var _0x15b27c;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x4cb4ad[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0xb1a655,null))['then'](function(_0xb39f2c){if(_0xb39f2c){_0x3a157c=_0xb39f2c;_0x3b76e7[_0x1043('0x2f')]=_['keys'](db[_0x1043('0x53')][_0x1043('0x46')]);_0x3b76e7[_0x1043('0x30')]=_[_0x1043('0x31')](_0x4cb4ad[_0x1043('0x30')]);_0x3b76e7[_0x1043('0x32')]=_['intersection'](_0x3b76e7[_0x1043('0x2f')],_0x3b76e7['query']);_0x4399a3[_0x1043('0x34')]=_[_0x1043('0x33')](_0x3b76e7[_0x1043('0x2f')],qs[_0x1043('0x35')](_0x4cb4ad[_0x1043('0x30')][_0x1043('0x35')]));_0x4399a3['attributes']=_0x4399a3[_0x1043('0x34')]['length']?_0x4399a3[_0x1043('0x34')]:_0x3b76e7['model'];_0x4399a3[_0x1043('0x39')]=qs['sort'](_0x4cb4ad['query'][_0x1043('0x3a')]);_0x4399a3[_0x1043('0x3b')]=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x4cb4ad['query'],_0x3b76e7[_0x1043('0x32')]));if(_0x4cb4ad[_0x1043('0x30')]['filter']){_0x4399a3[_0x1043('0x3b')]=_[_0x1043('0x3d')](_0x4399a3[_0x1043('0x3b')],{'$or':_[_0x1043('0x2a')](_0x4399a3[_0x1043('0x34')],function(_0x61349f){var _0x54af77={};_0x54af77[_0x61349f]={'$like':'%'+_0x4cb4ad['query'][_0x1043('0x3c')]+'%'};return _0x54af77;})});}_0x4399a3=_[_0x1043('0x3d')]({},_0x4399a3,_0x4cb4ad[_0x1043('0x3e')]);return _0x3a157c[_0x1043('0x52')](_0x4399a3);}})[_0x1043('0x27')](function(_0x1a147b){if(_0x1a147b){_0x15b27c=_0x1a147b[_0x1043('0x36')];if(!_0x4cb4ad['query'][_0x1043('0x37')]('nolimit')){_0x4399a3['limit']=qs['limit'](_0x4cb4ad['query'][_0x1043('0x21')]);_0x4399a3[_0x1043('0x1f')]=qs['offset'](_0x4cb4ad['query'][_0x1043('0x1f')]);}return _0x3a157c[_0x1043('0x52')](_0x4399a3);}})[_0x1043('0x27')](function(_0xea5602){if(_0xea5602){return _0xea5602?{'count':_0x15b27c,'rows':_0xea5602}:null;}})['then'](respondWithResult(_0xb1a655,null))[_0x1043('0x44')](handleError(_0xb1a655,null));};exports[_0x1043('0x54')]=function(_0xed8aa7,_0x1d46d8,_0x838c72){if(_0xed8aa7[_0x1043('0x48')]['id']){delete _0xed8aa7[_0x1043('0x48')]['id'];}return db[_0x1043('0x2b')]['findOne']({'where':{'id':_0xed8aa7[_0x1043('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d46d8,null))[_0x1043('0x27')](function(_0x140f17){if(_0x140f17){return _0x140f17['setTags'](_0xed8aa7['body'][_0x1043('0x55')]||[]);}return null;})['then'](respondWithResult(_0x1d46d8,null))[_0x1043('0x44')](handleError(_0x1d46d8,null));}; \ No newline at end of file +var _0x86ad=['jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','findOne','ZendeskField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x49b862,_0x47923b){var _0x442c2f=function(_0xf44472){while(--_0xf44472){_0x49b862['push'](_0x49b862['shift']());}};_0x442c2f(++_0x47923b);}(_0x86ad,0x9b));var _0xd86a=function(_0x5e59e0,_0x36d908){_0x5e59e0=_0x5e59e0-0x0;var _0x1b875e=_0x86ad[_0x5e59e0];return _0x1b875e;};'use strict';var emlformat=require(_0xd86a('0x0'));var rimraf=require(_0xd86a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86a('0x2'));var rp=require(_0xd86a('0x3'));var moment=require(_0xd86a('0x4'));var BPromise=require(_0xd86a('0x5'));var Mustache=require(_0xd86a('0x6'));var util=require(_0xd86a('0x7'));var path=require('path');var sox=require(_0xd86a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd86a('0x9'));var _=require(_0xd86a('0xa'));var squel=require(_0xd86a('0xb'));var crypto=require(_0xd86a('0xc'));var jsforce=require(_0xd86a('0xd'));var deskjs=require(_0xd86a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd86a('0xf'));var authService=require(_0xd86a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd86a('0x11'))(_0xd86a('0x12'));var utils=require('../../config/utils');var config=require(_0xd86a('0x13'));var licenseUtil=require(_0xd86a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47159c,_0x10651f){_0x10651f=_0x10651f||0xcc;return function(_0x1357fd){if(_0x1357fd){return _0x47159c[_0xd86a('0x15')](_0x10651f);}return _0x47159c['status'](_0x10651f)[_0xd86a('0x16')]();};}function respondWithResult(_0x45b133,_0xadb524){_0xadb524=_0xadb524||0xc8;return function(_0x65d1f4){if(_0x65d1f4){return _0x45b133['status'](_0xadb524)['json'](_0x65d1f4);}};}function respondWithFilteredResult(_0x2cc279,_0x286d74){return function(_0x890d87){if(_0x890d87){var _0xce3713=typeof _0x286d74[_0xd86a('0x17')]===_0xd86a('0x18')&&typeof _0x286d74[_0xd86a('0x19')]===_0xd86a('0x18');var _0x206ca1=_0x890d87[_0xd86a('0x1a')];var _0x1e40fa=_0xce3713?0x0:_0x286d74[_0xd86a('0x17')];var _0x377c60=_0xce3713?_0x890d87[_0xd86a('0x1a')]:_0x286d74[_0xd86a('0x17')]+_0x286d74[_0xd86a('0x19')];var _0x32a9d9;if(_0x377c60>=_0x206ca1){_0x377c60=_0x206ca1;_0x32a9d9=0xc8;}else{_0x32a9d9=0xce;}_0x2cc279[_0xd86a('0x1b')](_0x32a9d9);return _0x2cc279[_0xd86a('0x1c')](_0xd86a('0x1d'),_0x1e40fa+'-'+_0x377c60+'/'+_0x206ca1)[_0xd86a('0x1e')](_0x890d87);}return null;};}function patchUpdates(_0x2effe6){return function(_0x5541ff){try{jsonpatch[_0xd86a('0x1f')](_0x5541ff,_0x2effe6,!![]);}catch(_0x1d275b){return BPromise[_0xd86a('0x20')](_0x1d275b);}return _0x5541ff[_0xd86a('0x21')]();};}function saveUpdates(_0x2f9fea,_0x5c5bdd){return function(_0x596303){if(_0x596303){return _0x596303[_0xd86a('0x22')](_0x2f9fea)[_0xd86a('0x23')](function(_0x167d51){return _0x167d51;});}return null;};}function removeEntity(_0x27e10a,_0x54ce7c){return function(_0x3d7175){if(_0x3d7175){return _0x3d7175[_0xd86a('0x24')]()[_0xd86a('0x23')](function(){_0x27e10a[_0xd86a('0x1b')](0xcc)[_0xd86a('0x16')]();});}};}function handleEntityNotFound(_0x43dc93,_0x178c32){return function(_0x5d2785){if(!_0x5d2785){_0x43dc93['sendStatus'](0x194);}return _0x5d2785;};}function handleError(_0x5e7514,_0x569bae){_0x569bae=_0x569bae||0x1f4;return function(_0x1e0cd9){logger[_0xd86a('0x25')](_0x1e0cd9[_0xd86a('0x26')]);if(_0x1e0cd9[_0xd86a('0x27')]){delete _0x1e0cd9[_0xd86a('0x27')];}_0x5e7514[_0xd86a('0x1b')](_0x569bae)[_0xd86a('0x28')](_0x1e0cd9);};}exports[_0xd86a('0x29')]=function(_0x464bb4,_0x35c731){var _0x306fd1={},_0x451e5d={},_0x5193fe={'count':0x0,'rows':[]};var _0x47add3=_[_0xd86a('0x2a')](db[_0xd86a('0x2b')]['rawAttributes'],function(_0x36301d){return{'name':_0x36301d[_0xd86a('0x2c')],'type':_0x36301d[_0xd86a('0x2d')][_0xd86a('0x2e')]};});_0x451e5d[_0xd86a('0x2f')]=_[_0xd86a('0x2a')](_0x47add3,_0xd86a('0x27'));_0x451e5d[_0xd86a('0x30')]=_[_0xd86a('0x31')](_0x464bb4[_0xd86a('0x30')]);_0x451e5d['filters']=_[_0xd86a('0x32')](_0x451e5d[_0xd86a('0x2f')],_0x451e5d[_0xd86a('0x30')]);_0x306fd1[_0xd86a('0x33')]=_[_0xd86a('0x32')](_0x451e5d[_0xd86a('0x2f')],qs[_0xd86a('0x34')](_0x464bb4[_0xd86a('0x30')][_0xd86a('0x34')]));_0x306fd1[_0xd86a('0x33')]=_0x306fd1[_0xd86a('0x33')][_0xd86a('0x35')]?_0x306fd1[_0xd86a('0x33')]:_0x451e5d[_0xd86a('0x2f')];if(!_0x464bb4[_0xd86a('0x30')]['hasOwnProperty'](_0xd86a('0x36'))){_0x306fd1['limit']=qs[_0xd86a('0x19')](_0x464bb4['query']['limit']);_0x306fd1[_0xd86a('0x17')]=qs[_0xd86a('0x17')](_0x464bb4[_0xd86a('0x30')][_0xd86a('0x17')]);}_0x306fd1['order']=qs['sort'](_0x464bb4[_0xd86a('0x30')][_0xd86a('0x37')]);_0x306fd1[_0xd86a('0x38')]=qs[_0xd86a('0x39')](_[_0xd86a('0x3a')](_0x464bb4[_0xd86a('0x30')],_0x451e5d[_0xd86a('0x39')]),_0x47add3);if(_0x464bb4['query'][_0xd86a('0x3b')]){_0x306fd1[_0xd86a('0x38')]=_[_0xd86a('0x3c')](_0x306fd1[_0xd86a('0x38')],{'$or':_['map'](_0x47add3,function(_0x22e578){if(_0x22e578[_0xd86a('0x2d')]!==_0xd86a('0x3d')){var _0x10cb24={};_0x10cb24[_0x22e578[_0xd86a('0x27')]]={'$like':'%'+_0x464bb4[_0xd86a('0x30')][_0xd86a('0x3b')]+'%'};return _0x10cb24;}})});}_0x306fd1=_[_0xd86a('0x3c')]({},_0x306fd1,_0x464bb4[_0xd86a('0x3e')]);var _0x34a65d={'where':_0x306fd1[_0xd86a('0x38')]};return db[_0xd86a('0x2b')][_0xd86a('0x1a')](_0x34a65d)[_0xd86a('0x23')](function(_0x17e125){_0x5193fe[_0xd86a('0x1a')]=_0x17e125;if(_0x464bb4[_0xd86a('0x30')][_0xd86a('0x3f')]){_0x306fd1[_0xd86a('0x40')]=[{'all':!![]}];}return db[_0xd86a('0x2b')][_0xd86a('0x41')](_0x306fd1);})['then'](function(_0x27326c){_0x5193fe['rows']=_0x27326c;return _0x5193fe;})[_0xd86a('0x23')](respondWithFilteredResult(_0x35c731,_0x306fd1))[_0xd86a('0x42')](handleError(_0x35c731,null));};exports[_0xd86a('0x43')]=function(_0x1645d1,_0x5d4f78){var _0x279f77={'raw':![],'where':{'id':_0x1645d1[_0xd86a('0x44')]['id']}},_0x26be3b={};_0x26be3b['model']=_[_0xd86a('0x31')](db[_0xd86a('0x2b')][_0xd86a('0x45')]);_0x26be3b[_0xd86a('0x30')]=_[_0xd86a('0x31')](_0x1645d1[_0xd86a('0x30')]);_0x26be3b[_0xd86a('0x39')]=_[_0xd86a('0x32')](_0x26be3b[_0xd86a('0x2f')],_0x26be3b['query']);_0x279f77['attributes']=_['intersection'](_0x26be3b['model'],qs['fields'](_0x1645d1[_0xd86a('0x30')][_0xd86a('0x34')]));_0x279f77[_0xd86a('0x33')]=_0x279f77[_0xd86a('0x33')]['length']?_0x279f77['attributes']:_0x26be3b[_0xd86a('0x2f')];if(_0x1645d1[_0xd86a('0x30')][_0xd86a('0x3f')]){_0x279f77[_0xd86a('0x40')]=[{'all':!![]}];}_0x279f77=_['merge']({},_0x279f77,_0x1645d1[_0xd86a('0x3e')]);return db[_0xd86a('0x2b')]['find'](_0x279f77)[_0xd86a('0x23')](handleEntityNotFound(_0x5d4f78,null))[_0xd86a('0x23')](respondWithResult(_0x5d4f78,null))[_0xd86a('0x42')](handleError(_0x5d4f78,null));};exports[_0xd86a('0x46')]=function(_0x2021ae,_0x45ea05){return db[_0xd86a('0x2b')][_0xd86a('0x46')](_0x2021ae['body'],{})[_0xd86a('0x23')](respondWithResult(_0x45ea05,0xc9))[_0xd86a('0x42')](handleError(_0x45ea05,null));};exports[_0xd86a('0x22')]=function(_0xaa27b3,_0x19d0c7){if(_0xaa27b3[_0xd86a('0x47')]['id']){delete _0xaa27b3[_0xd86a('0x47')]['id'];}return db['ZendeskConfiguration'][_0xd86a('0x48')]({'where':{'id':_0xaa27b3[_0xd86a('0x44')]['id']}})['then'](handleEntityNotFound(_0x19d0c7,null))['then'](saveUpdates(_0xaa27b3['body'],null))[_0xd86a('0x23')](respondWithResult(_0x19d0c7,null))[_0xd86a('0x42')](handleError(_0x19d0c7,null));};exports['destroy']=function(_0x3221d1,_0x59cce0){return db[_0xd86a('0x2b')]['find']({'where':{'id':_0x3221d1['params']['id']}})[_0xd86a('0x23')](handleEntityNotFound(_0x59cce0,null))[_0xd86a('0x23')](removeEntity(_0x59cce0,null))[_0xd86a('0x42')](handleError(_0x59cce0,null));};exports['getFields']=function(_0x4aea44,_0x22d8f9,_0x2ea859){var _0x6b127d={};var _0x29c0a0={};var _0x3a9c39;var _0x15a911;return db[_0xd86a('0x2b')][_0xd86a('0x49')]({'where':{'id':_0x4aea44['params']['id']}})[_0xd86a('0x23')](handleEntityNotFound(_0x22d8f9,null))[_0xd86a('0x23')](function(_0x116573){if(_0x116573){_0x3a9c39=_0x116573;_0x29c0a0[_0xd86a('0x2f')]=_['keys'](db[_0xd86a('0x4a')][_0xd86a('0x45')]);_0x29c0a0['query']=_[_0xd86a('0x31')](_0x4aea44['query']);_0x29c0a0[_0xd86a('0x39')]=_[_0xd86a('0x32')](_0x29c0a0[_0xd86a('0x2f')],_0x29c0a0[_0xd86a('0x30')]);_0x6b127d[_0xd86a('0x33')]=_[_0xd86a('0x32')](_0x29c0a0[_0xd86a('0x2f')],qs[_0xd86a('0x34')](_0x4aea44['query'][_0xd86a('0x34')]));_0x6b127d[_0xd86a('0x33')]=_0x6b127d[_0xd86a('0x33')][_0xd86a('0x35')]?_0x6b127d['attributes']:_0x29c0a0[_0xd86a('0x2f')];_0x6b127d[_0xd86a('0x4b')]=qs[_0xd86a('0x37')](_0x4aea44['query']['sort']);_0x6b127d['where']=qs[_0xd86a('0x39')](_[_0xd86a('0x3a')](_0x4aea44[_0xd86a('0x30')],_0x29c0a0['filters']));if(_0x4aea44[_0xd86a('0x30')]['filter']){_0x6b127d['where']=_[_0xd86a('0x3c')](_0x6b127d['where'],{'$or':_[_0xd86a('0x2a')](_0x6b127d[_0xd86a('0x33')],function(_0x11bf0f){var _0x1af4f0={};_0x1af4f0[_0x11bf0f]={'$like':'%'+_0x4aea44[_0xd86a('0x30')]['filter']+'%'};return _0x1af4f0;})});}_0x6b127d=_[_0xd86a('0x3c')]({},_0x6b127d,_0x4aea44[_0xd86a('0x3e')]);return _0x3a9c39[_0xd86a('0x4c')](_0x6b127d);}})[_0xd86a('0x23')](function(_0x16d644){if(_0x16d644){_0x15a911=_0x16d644[_0xd86a('0x35')];if(!_0x4aea44[_0xd86a('0x30')][_0xd86a('0x4d')](_0xd86a('0x36'))){_0x6b127d[_0xd86a('0x19')]=qs['limit'](_0x4aea44[_0xd86a('0x30')][_0xd86a('0x19')]);_0x6b127d[_0xd86a('0x17')]=qs[_0xd86a('0x17')](_0x4aea44[_0xd86a('0x30')][_0xd86a('0x17')]);}return _0x3a9c39['getFields'](_0x6b127d);}})[_0xd86a('0x23')](function(_0xce1d7b){if(_0xce1d7b){return _0xce1d7b?{'count':_0x15a911,'rows':_0xce1d7b}:null;}})[_0xd86a('0x23')](respondWithResult(_0x22d8f9,null))[_0xd86a('0x42')](handleError(_0x22d8f9,null));};exports[_0xd86a('0x4e')]=function(_0x1f1312,_0xdc68be,_0x8e980c){var _0x3c7426={};var _0x5a77d8={};var _0x4367f3;var _0x4b3b90;return db[_0xd86a('0x2b')][_0xd86a('0x49')]({'where':{'id':_0x1f1312['params']['id']}})['then'](handleEntityNotFound(_0xdc68be,null))[_0xd86a('0x23')](function(_0x2a3387){if(_0x2a3387){_0x4367f3=_0x2a3387;_0x5a77d8[_0xd86a('0x2f')]=_[_0xd86a('0x31')](db[_0xd86a('0x4a')]['rawAttributes']);_0x5a77d8[_0xd86a('0x30')]=_[_0xd86a('0x31')](_0x1f1312['query']);_0x5a77d8['filters']=_[_0xd86a('0x32')](_0x5a77d8['model'],_0x5a77d8[_0xd86a('0x30')]);_0x3c7426[_0xd86a('0x33')]=_[_0xd86a('0x32')](_0x5a77d8[_0xd86a('0x2f')],qs[_0xd86a('0x34')](_0x1f1312[_0xd86a('0x30')][_0xd86a('0x34')]));_0x3c7426[_0xd86a('0x33')]=_0x3c7426[_0xd86a('0x33')][_0xd86a('0x35')]?_0x3c7426[_0xd86a('0x33')]:_0x5a77d8['model'];_0x3c7426[_0xd86a('0x4b')]=qs['sort'](_0x1f1312[_0xd86a('0x30')][_0xd86a('0x37')]);_0x3c7426['where']=qs[_0xd86a('0x39')](_[_0xd86a('0x3a')](_0x1f1312['query'],_0x5a77d8['filters']));if(_0x1f1312[_0xd86a('0x30')]['filter']){_0x3c7426[_0xd86a('0x38')]=_[_0xd86a('0x3c')](_0x3c7426[_0xd86a('0x38')],{'$or':_['map'](_0x3c7426[_0xd86a('0x33')],function(_0x1d60ed){var _0x22735f={};_0x22735f[_0x1d60ed]={'$like':'%'+_0x1f1312[_0xd86a('0x30')][_0xd86a('0x3b')]+'%'};return _0x22735f;})});}_0x3c7426=_[_0xd86a('0x3c')]({},_0x3c7426,_0x1f1312[_0xd86a('0x3e')]);return _0x4367f3[_0xd86a('0x4e')](_0x3c7426);}})['then'](function(_0x1706c7){if(_0x1706c7){_0x4b3b90=_0x1706c7[_0xd86a('0x35')];if(!_0x1f1312[_0xd86a('0x30')]['hasOwnProperty'](_0xd86a('0x36'))){_0x3c7426[_0xd86a('0x19')]=qs['limit'](_0x1f1312[_0xd86a('0x30')][_0xd86a('0x19')]);_0x3c7426['offset']=qs['offset'](_0x1f1312['query'][_0xd86a('0x17')]);}return _0x4367f3[_0xd86a('0x4e')](_0x3c7426);}})['then'](function(_0x4c6c97){if(_0x4c6c97){return _0x4c6c97?{'count':_0x4b3b90,'rows':_0x4c6c97}:null;}})[_0xd86a('0x23')](respondWithResult(_0xdc68be,null))[_0xd86a('0x42')](handleError(_0xdc68be,null));};exports[_0xd86a('0x4f')]=function(_0x472211,_0x1c7004,_0x1efe68){var _0x1afa4f={};var _0x36f7ed={};var _0x2ff0fe;var _0x2532c3;return db['ZendeskConfiguration'][_0xd86a('0x49')]({'where':{'id':_0x472211['params']['id']}})[_0xd86a('0x23')](handleEntityNotFound(_0x1c7004,null))[_0xd86a('0x23')](function(_0x30df5b){if(_0x30df5b){_0x2ff0fe=_0x30df5b;_0x36f7ed[_0xd86a('0x2f')]=_[_0xd86a('0x31')](db['ZendeskField']['rawAttributes']);_0x36f7ed[_0xd86a('0x30')]=_[_0xd86a('0x31')](_0x472211['query']);_0x36f7ed[_0xd86a('0x39')]=_[_0xd86a('0x32')](_0x36f7ed[_0xd86a('0x2f')],_0x36f7ed[_0xd86a('0x30')]);_0x1afa4f[_0xd86a('0x33')]=_[_0xd86a('0x32')](_0x36f7ed[_0xd86a('0x2f')],qs[_0xd86a('0x34')](_0x472211['query'][_0xd86a('0x34')]));_0x1afa4f[_0xd86a('0x33')]=_0x1afa4f[_0xd86a('0x33')][_0xd86a('0x35')]?_0x1afa4f['attributes']:_0x36f7ed['model'];_0x1afa4f[_0xd86a('0x4b')]=qs[_0xd86a('0x37')](_0x472211[_0xd86a('0x30')][_0xd86a('0x37')]);_0x1afa4f['where']=qs[_0xd86a('0x39')](_[_0xd86a('0x3a')](_0x472211[_0xd86a('0x30')],_0x36f7ed[_0xd86a('0x39')]));if(_0x472211['query'][_0xd86a('0x3b')]){_0x1afa4f[_0xd86a('0x38')]=_['merge'](_0x1afa4f[_0xd86a('0x38')],{'$or':_[_0xd86a('0x2a')](_0x1afa4f[_0xd86a('0x33')],function(_0x1e2947){var _0x4efe3e={};_0x4efe3e[_0x1e2947]={'$like':'%'+_0x472211[_0xd86a('0x30')]['filter']+'%'};return _0x4efe3e;})});}_0x1afa4f=_[_0xd86a('0x3c')]({},_0x1afa4f,_0x472211[_0xd86a('0x3e')]);return _0x2ff0fe[_0xd86a('0x4f')](_0x1afa4f);}})['then'](function(_0x2f0b10){if(_0x2f0b10){_0x2532c3=_0x2f0b10[_0xd86a('0x35')];if(!_0x472211[_0xd86a('0x30')][_0xd86a('0x4d')](_0xd86a('0x36'))){_0x1afa4f[_0xd86a('0x19')]=qs[_0xd86a('0x19')](_0x472211['query'][_0xd86a('0x19')]);_0x1afa4f['offset']=qs[_0xd86a('0x17')](_0x472211[_0xd86a('0x30')]['offset']);}return _0x2ff0fe[_0xd86a('0x4f')](_0x1afa4f);}})[_0xd86a('0x23')](function(_0x173932){if(_0x173932){return _0x173932?{'count':_0x2532c3,'rows':_0x173932}:null;}})[_0xd86a('0x23')](respondWithResult(_0x1c7004,null))['catch'](handleError(_0x1c7004,null));};exports['getTags']=function(_0x5f462f,_0x5bf2bc,_0x510384){var _0x41d095={};var _0x1dd85f={};var _0x3a7de6;var _0x57c208;return db[_0xd86a('0x2b')][_0xd86a('0x49')]({'where':{'id':_0x5f462f['params']['id']}})[_0xd86a('0x23')](handleEntityNotFound(_0x5bf2bc,null))[_0xd86a('0x23')](function(_0x256396){if(_0x256396){_0x3a7de6=_0x256396;_0x1dd85f[_0xd86a('0x2f')]=_[_0xd86a('0x31')](db[_0xd86a('0x50')]['rawAttributes']);_0x1dd85f[_0xd86a('0x30')]=_['keys'](_0x5f462f[_0xd86a('0x30')]);_0x1dd85f[_0xd86a('0x39')]=_[_0xd86a('0x32')](_0x1dd85f['model'],_0x1dd85f[_0xd86a('0x30')]);_0x41d095[_0xd86a('0x33')]=_['intersection'](_0x1dd85f[_0xd86a('0x2f')],qs[_0xd86a('0x34')](_0x5f462f['query']['fields']));_0x41d095['attributes']=_0x41d095[_0xd86a('0x33')]['length']?_0x41d095[_0xd86a('0x33')]:_0x1dd85f['model'];_0x41d095['order']=qs[_0xd86a('0x37')](_0x5f462f[_0xd86a('0x30')]['sort']);_0x41d095[_0xd86a('0x38')]=qs[_0xd86a('0x39')](_[_0xd86a('0x3a')](_0x5f462f[_0xd86a('0x30')],_0x1dd85f['filters']));if(_0x5f462f[_0xd86a('0x30')]['filter']){_0x41d095['where']=_[_0xd86a('0x3c')](_0x41d095[_0xd86a('0x38')],{'$or':_[_0xd86a('0x2a')](_0x41d095[_0xd86a('0x33')],function(_0x10ef9f){var _0x412493={};_0x412493[_0x10ef9f]={'$like':'%'+_0x5f462f['query'][_0xd86a('0x3b')]+'%'};return _0x412493;})});}_0x41d095=_[_0xd86a('0x3c')]({},_0x41d095,_0x5f462f[_0xd86a('0x3e')]);return _0x3a7de6[_0xd86a('0x51')](_0x41d095);}})[_0xd86a('0x23')](function(_0x21cdf4){if(_0x21cdf4){_0x57c208=_0x21cdf4[_0xd86a('0x35')];if(!_0x5f462f[_0xd86a('0x30')][_0xd86a('0x4d')](_0xd86a('0x36'))){_0x41d095[_0xd86a('0x19')]=qs[_0xd86a('0x19')](_0x5f462f['query']['limit']);_0x41d095[_0xd86a('0x17')]=qs['offset'](_0x5f462f[_0xd86a('0x30')]['offset']);}return _0x3a7de6['getTags'](_0x41d095);}})[_0xd86a('0x23')](function(_0x2af206){if(_0x2af206){return _0x2af206?{'count':_0x57c208,'rows':_0x2af206}:null;}})[_0xd86a('0x23')](respondWithResult(_0x5bf2bc,null))[_0xd86a('0x42')](handleError(_0x5bf2bc,null));};exports[_0xd86a('0x52')]=function(_0x2e1af1,_0x4e9bdf,_0x4d2e92){if(_0x2e1af1['body']['id']){delete _0x2e1af1[_0xd86a('0x47')]['id'];}return db[_0xd86a('0x2b')][_0xd86a('0x49')]({'where':{'id':_0x2e1af1[_0xd86a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e9bdf,null))[_0xd86a('0x23')](function(_0x344d4b){if(_0x344d4b){return _0x344d4b[_0xd86a('0x52')](_0x2e1af1[_0xd86a('0x47')][_0xd86a('0x53')]||[]);}return null;})[_0xd86a('0x23')](respondWithResult(_0x4e9bdf,null))[_0xd86a('0x42')](handleError(_0x4e9bdf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c2849c2..bcdddde 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 _0xeb3b=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0xde2c8,_0x6a6d9b){var _0x52e8d7=function(_0x14c585){while(--_0x14c585){_0xde2c8['push'](_0xde2c8['shift']());}};_0x52e8d7(++_0x6a6d9b);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xeb3b[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x1468aa,_0x497a0f){_0x1468aa=_0x1468aa-0x0;var _0x508e8e=_0xd7d1[_0x1468aa];return _0x508e8e;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'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 360421a..f9b47c6 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 _0x7ef5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils'];(function(_0x389d27,_0x582c28){var _0x3dc073=function(_0x22c593){while(--_0x22c593){_0x389d27['push'](_0x389d27['shift']());}};_0x3dc073(++_0x582c28);}(_0x7ef5,0xee));var _0x57ef=function(_0x58c129,_0x47aee8){_0x58c129=_0x58c129-0x0;var _0x386fd2=_0x7ef5[_0x58c129];return _0x386fd2;};'use strict';var _=require('lodash');var util=require(_0x57ef('0x0'));var moment=require('moment');var BPromise=require(_0x57ef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x57ef('0x3'));var logger=require(_0x57ef('0x4'))(_0x57ef('0x5'));var config=require(_0x57ef('0x6'));var jayson=require(_0x57ef('0x7'));var client=jayson[_0x57ef('0x8')][_0x57ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5749,_0x585eae,_0x3a6fb7){return new BPromise(function(_0x4e7c31,_0x3a454e){return client['request'](_0x2a5749,_0x3a6fb7)[_0x57ef('0xa')](function(_0x1bacd3){logger[_0x57ef('0xb')](_0x57ef('0xc'),_0x585eae,_0x57ef('0xd'));logger[_0x57ef('0xe')](_0x57ef('0xf'),_0x585eae,_0x57ef('0xd'),JSON[_0x57ef('0x10')](_0x1bacd3));if(_0x1bacd3[_0x57ef('0x11')]){if(_0x1bacd3[_0x57ef('0x11')][_0x57ef('0x12')]===0x1f4){logger[_0x57ef('0x11')](_0x57ef('0xc'),_0x585eae,_0x1bacd3['error'][_0x57ef('0x13')]);return _0x3a454e(_0x1bacd3[_0x57ef('0x11')][_0x57ef('0x13')]);}logger[_0x57ef('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x585eae,_0x1bacd3['error']['message']);return _0x4e7c31(_0x1bacd3['error'][_0x57ef('0x13')]);}else{logger['info'](_0x57ef('0xc'),_0x585eae,_0x57ef('0xd'));_0x4e7c31(_0x1bacd3[_0x57ef('0x14')][_0x57ef('0x13')]);}})[_0x57ef('0x15')](function(_0xab4023){logger[_0x57ef('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x585eae,_0xab4023);_0x3a454e(_0xab4023);});});} \ No newline at end of file +var _0xdd1d=['then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1d867e,_0x23d71d){var _0x2bc984=function(_0x537916){while(--_0x537916){_0x1d867e['push'](_0x1d867e['shift']());}};_0x2bc984(++_0x23d71d);}(_0xdd1d,0x6c));var _0xddd1=function(_0x874a49,_0x5b07bc){_0x874a49=_0x874a49-0x0;var _0x343d2f=_0xdd1d[_0x874a49];return _0x343d2f;};'use strict';var _=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var moment=require('moment');var BPromise=require(_0xddd1('0x2'));var rs=require(_0xddd1('0x3'));var fs=require('fs');var Redis=require(_0xddd1('0x4'));var db=require(_0xddd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xddd1('0x6'))('rpc');var config=require(_0xddd1('0x7'));var jayson=require(_0xddd1('0x8'));var client=jayson[_0xddd1('0x9')][_0xddd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5978d7,_0x4b5f2b,_0x4fdefd){return new BPromise(function(_0x135d6b,_0x1bde86){return client[_0xddd1('0xb')](_0x5978d7,_0x4fdefd)[_0xddd1('0xc')](function(_0x5ba807){logger['info'](_0xddd1('0xd'),_0x4b5f2b,_0xddd1('0xe'));logger[_0xddd1('0xf')](_0xddd1('0x10'),_0x4b5f2b,_0xddd1('0xe'),JSON[_0xddd1('0x11')](_0x5ba807));if(_0x5ba807[_0xddd1('0x12')]){if(_0x5ba807[_0xddd1('0x12')][_0xddd1('0x13')]===0x1f4){logger['error'](_0xddd1('0xd'),_0x4b5f2b,_0x5ba807[_0xddd1('0x12')][_0xddd1('0x14')]);return _0x1bde86(_0x5ba807['error'][_0xddd1('0x14')]);}logger['error'](_0xddd1('0xd'),_0x4b5f2b,_0x5ba807['error']['message']);return _0x135d6b(_0x5ba807[_0xddd1('0x12')][_0xddd1('0x14')]);}else{logger[_0xddd1('0x15')](_0xddd1('0xd'),_0x4b5f2b,_0xddd1('0xe'));_0x135d6b(_0x5ba807[_0xddd1('0x16')][_0xddd1('0x14')]);}})[_0xddd1('0x17')](function(_0x5b4364){logger[_0xddd1('0x12')](_0xddd1('0xd'),_0x4b5f2b,_0x5b4364);_0x1bde86(_0x5b4364);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 888ba13..5a84e7c 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 _0x473a=['isAuthenticated','index','/:id','post','create','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x473a,0x17e));var _0xa473=function(_0x8e0ced,_0x24e421){_0x8e0ced=_0x8e0ced-0x0;var _0x30b339=_0x473a[_0x8e0ced];return _0x30b339;};'use strict';var multer=require('multer');var util=require(_0xa473('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa473('0x1'));var router=express[_0xa473('0x2')]();var fs_extra=require(_0xa473('0x3'));var auth=require(_0xa473('0x4'));var interaction=require(_0xa473('0x5'));var config=require(_0xa473('0x6'));var controller=require(_0xa473('0x7'));router[_0xa473('0x8')]('/',auth[_0xa473('0x9')](),controller[_0xa473('0xa')]);router[_0xa473('0x8')](_0xa473('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa473('0xc')]('/',auth[_0xa473('0x9')](),controller[_0xa473('0xd')]);router['put'](_0xa473('0xb'),auth[_0xa473('0x9')](),controller[_0xa473('0xe')]);router[_0xa473('0xf')](_0xa473('0xb'),auth[_0xa473('0x9')](),controller['destroy']);module[_0xa473('0x10')]=router; \ No newline at end of file +var _0xd124=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd124,0x144));var _0x4d12=function(_0x58ed9b,_0x30faff){_0x58ed9b=_0x58ed9b-0x0;var _0x12e90c=_0xd124[_0x58ed9b];return _0x12e90c;};'use strict';var multer=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var path=require(_0x4d12('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d12('0x3'));var router=express[_0x4d12('0x4')]();var fs_extra=require(_0x4d12('0x5'));var auth=require(_0x4d12('0x6'));var interaction=require(_0x4d12('0x7'));var config=require(_0x4d12('0x8'));var controller=require(_0x4d12('0x9'));router['get']('/',auth[_0x4d12('0xa')](),controller['index']);router[_0x4d12('0xb')](_0x4d12('0xc'),auth[_0x4d12('0xa')](),controller[_0x4d12('0xd')]);router[_0x4d12('0xe')]('/',auth[_0x4d12('0xa')](),controller[_0x4d12('0xf')]);router[_0x4d12('0x10')](_0x4d12('0xc'),auth[_0x4d12('0xa')](),controller[_0x4d12('0x11')]);router[_0x4d12('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4d12('0x13')]);module[_0x4d12('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c6add7f..2a36bd2 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 _0x6136=['STRING','ENUM','string','variable','customVariable','keyValue'];(function(_0x4b6c5d,_0x40290c){var _0x49b996=function(_0xf69f5c){while(--_0xf69f5c){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x49b996(++_0x40290c);}(_0x6136,0x145));var _0x6613=function(_0x5a0f8b,_0x2df0dd){_0x5a0f8b=_0x5a0f8b-0x0;var _0x5ab08c=_0x6136[_0x5a0f8b];return _0x5ab08c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6613('0x0')](_0x6613('0x1'),_0x6613('0x2'),_0x6613('0x3'),_0x6613('0x4'),'picklist'),'defaultValue':_0x6613('0x1')},'content':{'type':Sequelize[_0x6613('0x5')]},'key':{'type':Sequelize[_0x6613('0x5')]},'keyType':{'type':Sequelize[_0x6613('0x0')](_0x6613('0x1'),'variable',_0x6613('0x3'))},'keyContent':{'type':Sequelize[_0x6613('0x5')]},'idField':{'type':Sequelize[_0x6613('0x5')]},'nameField':{'type':Sequelize[_0x6613('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6613('0x5')]}}; \ No newline at end of file +var _0xe7c4=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0xbb2e25,_0x30535e){var _0xf49318=function(_0x86428d){while(--_0x86428d){_0xbb2e25['push'](_0xbb2e25['shift']());}};_0xf49318(++_0x30535e);}(_0xe7c4,0x127));var _0x4e7c=function(_0x58f81c,_0x25caa3){_0x58f81c=_0x58f81c-0x0;var _0x5bd385=_0xe7c4[_0x58f81c];return _0x5bd385;};'use strict';var Sequelize=require(_0x4e7c('0x0'));module[_0x4e7c('0x1')]={'type':{'type':Sequelize[_0x4e7c('0x2')](_0x4e7c('0x3'),_0x4e7c('0x4'),_0x4e7c('0x5'),'keyValue',_0x4e7c('0x6')),'defaultValue':_0x4e7c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4e7c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4e7c('0x3'),_0x4e7c('0x4'),_0x4e7c('0x5'))},'keyContent':{'type':Sequelize[_0x4e7c('0x7')]},'idField':{'type':Sequelize[_0x4e7c('0x7')]},'nameField':{'type':Sequelize[_0x4e7c('0x7')]},'customField':{'type':Sequelize[_0x4e7c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 584b947..7a6d196 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 _0x582f=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x582f,0x7f));var _0xf582=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x582f[_0x3fa7d3];return _0x4c51bd;};'use strict';var emlformat=require(_0xf582('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf582('0x1'));var jsonpatch=require(_0xf582('0x2'));var rp=require(_0xf582('0x3'));var moment=require(_0xf582('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf582('0x5'));var util=require(_0xf582('0x6'));var path=require(_0xf582('0x7'));var sox=require('sox');var csv=require(_0xf582('0x8'));var ejs=require(_0xf582('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf582('0xa'));var squel=require(_0xf582('0xb'));var crypto=require(_0xf582('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf582('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf582('0xe'));var Redis=require(_0xf582('0xf'));var authService=require(_0xf582('0x10'));var qs=require(_0xf582('0x11'));var as=require(_0xf582('0x12'));var hardwareService=require(_0xf582('0x13'));var logger=require(_0xf582('0x14'))(_0xf582('0x15'));var utils=require(_0xf582('0x16'));var config=require(_0xf582('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf582('0x18'))['db'];function respondWithStatusCode(_0x23acec,_0x1395ba){_0x1395ba=_0x1395ba||0xcc;return function(_0x5549be){if(_0x5549be){return _0x23acec[_0xf582('0x19')](_0x1395ba);}return _0x23acec[_0xf582('0x1a')](_0x1395ba)[_0xf582('0x1b')]();};}function respondWithResult(_0x3ce6ec,_0x25a530){_0x25a530=_0x25a530||0xc8;return function(_0x7dc620){if(_0x7dc620){return _0x3ce6ec[_0xf582('0x1a')](_0x25a530)[_0xf582('0x1c')](_0x7dc620);}};}function respondWithFilteredResult(_0x17ef4e,_0x47ebb3){return function(_0x425bf2){if(_0x425bf2){var _0x3a266e=typeof _0x47ebb3[_0xf582('0x1d')]===_0xf582('0x1e')&&typeof _0x47ebb3[_0xf582('0x1f')]===_0xf582('0x1e');var _0x3b6f98=_0x425bf2[_0xf582('0x20')];var _0x5270a2=_0x3a266e?0x0:_0x47ebb3[_0xf582('0x1d')];var _0x1cc458=_0x3a266e?_0x425bf2[_0xf582('0x20')]:_0x47ebb3[_0xf582('0x1d')]+_0x47ebb3[_0xf582('0x1f')];var _0x5e1442;if(_0x1cc458>=_0x3b6f98){_0x1cc458=_0x3b6f98;_0x5e1442=0xc8;}else{_0x5e1442=0xce;}_0x17ef4e[_0xf582('0x1a')](_0x5e1442);return _0x17ef4e[_0xf582('0x21')](_0xf582('0x22'),_0x5270a2+'-'+_0x1cc458+'/'+_0x3b6f98)[_0xf582('0x1c')](_0x425bf2);}return null;};}function patchUpdates(_0x53a2ad){return function(_0x3d89b9){try{jsonpatch[_0xf582('0x23')](_0x3d89b9,_0x53a2ad,!![]);}catch(_0x2bc40a){return BPromise[_0xf582('0x24')](_0x2bc40a);}return _0x3d89b9[_0xf582('0x25')]();};}function saveUpdates(_0x431b66,_0x1b06ff){return function(_0x4b9098){if(_0x4b9098){return _0x4b9098[_0xf582('0x26')](_0x431b66)[_0xf582('0x27')](function(_0x1f7a57){return _0x1f7a57;});}return null;};}function removeEntity(_0x3425ef,_0x2b7623){return function(_0x27dda1){if(_0x27dda1){return _0x27dda1[_0xf582('0x28')]()[_0xf582('0x27')](function(){_0x3425ef[_0xf582('0x1a')](0xcc)[_0xf582('0x1b')]();});}};}function handleEntityNotFound(_0x2e379f,_0x41be3b){return function(_0x265f95){if(!_0x265f95){_0x2e379f[_0xf582('0x19')](0x194);}return _0x265f95;};}function handleError(_0x27f920,_0xea9288){_0xea9288=_0xea9288||0x1f4;return function(_0x304dbd){logger[_0xf582('0x29')](_0x304dbd['stack']);if(_0x304dbd[_0xf582('0x2a')]){delete _0x304dbd['name'];}_0x27f920[_0xf582('0x1a')](_0xea9288)[_0xf582('0x2b')](_0x304dbd);};}exports['index']=function(_0x3a38ab,_0x5b720b){var _0x13a146={},_0x254d3b={},_0x12d359={'count':0x0,'rows':[]};var _0xf5bf24=_[_0xf582('0x2c')](db[_0xf582('0x2d')][_0xf582('0x2e')],function(_0x525532){return{'name':_0x525532[_0xf582('0x2f')],'type':_0x525532['type'][_0xf582('0x30')]};});_0x254d3b[_0xf582('0x31')]=_['map'](_0xf5bf24,_0xf582('0x2a'));_0x254d3b[_0xf582('0x32')]=_[_0xf582('0x33')](_0x3a38ab[_0xf582('0x32')]);_0x254d3b['filters']=_[_0xf582('0x34')](_0x254d3b[_0xf582('0x31')],_0x254d3b[_0xf582('0x32')]);_0x13a146['attributes']=_[_0xf582('0x34')](_0x254d3b[_0xf582('0x31')],qs[_0xf582('0x35')](_0x3a38ab[_0xf582('0x32')][_0xf582('0x35')]));_0x13a146[_0xf582('0x36')]=_0x13a146[_0xf582('0x36')][_0xf582('0x37')]?_0x13a146[_0xf582('0x36')]:_0x254d3b[_0xf582('0x31')];if(!_0x3a38ab[_0xf582('0x32')][_0xf582('0x38')]('nolimit')){_0x13a146[_0xf582('0x1f')]=qs[_0xf582('0x1f')](_0x3a38ab['query'][_0xf582('0x1f')]);_0x13a146[_0xf582('0x1d')]=qs[_0xf582('0x1d')](_0x3a38ab[_0xf582('0x32')]['offset']);}_0x13a146[_0xf582('0x39')]=qs[_0xf582('0x3a')](_0x3a38ab[_0xf582('0x32')][_0xf582('0x3a')]);_0x13a146[_0xf582('0x3b')]=qs[_0xf582('0x3c')](_[_0xf582('0x3d')](_0x3a38ab['query'],_0x254d3b['filters']),_0xf5bf24);if(_0x3a38ab['query'][_0xf582('0x3e')]){_0x13a146[_0xf582('0x3b')]=_[_0xf582('0x3f')](_0x13a146['where'],{'$or':_['map'](_0xf5bf24,function(_0x2ccaf4){if(_0x2ccaf4[_0xf582('0x40')]!=='VIRTUAL'){var _0x470b88={};_0x470b88[_0x2ccaf4[_0xf582('0x2a')]]={'$like':'%'+_0x3a38ab[_0xf582('0x32')]['filter']+'%'};return _0x470b88;}})});}_0x13a146=_[_0xf582('0x3f')]({},_0x13a146,_0x3a38ab[_0xf582('0x41')]);var _0x5dbb85={'where':_0x13a146[_0xf582('0x3b')]};return db[_0xf582('0x2d')][_0xf582('0x20')](_0x5dbb85)[_0xf582('0x27')](function(_0x3959b2){_0x12d359['count']=_0x3959b2;if(_0x3a38ab[_0xf582('0x32')][_0xf582('0x42')]){_0x13a146[_0xf582('0x43')]=[{'all':!![]}];}return db[_0xf582('0x2d')]['findAll'](_0x13a146);})['then'](function(_0x38225c){_0x12d359[_0xf582('0x44')]=_0x38225c;return _0x12d359;})[_0xf582('0x27')](respondWithFilteredResult(_0x5b720b,_0x13a146))[_0xf582('0x45')](handleError(_0x5b720b,null));};exports[_0xf582('0x46')]=function(_0x28f943,_0x2d81d5){var _0x3af192={'raw':!![],'where':{'id':_0x28f943[_0xf582('0x47')]['id']}},_0x4c56fa={};_0x4c56fa[_0xf582('0x31')]=_['keys'](db[_0xf582('0x2d')][_0xf582('0x2e')]);_0x4c56fa['query']=_[_0xf582('0x33')](_0x28f943[_0xf582('0x32')]);_0x4c56fa[_0xf582('0x3c')]=_[_0xf582('0x34')](_0x4c56fa[_0xf582('0x31')],_0x4c56fa['query']);_0x3af192[_0xf582('0x36')]=_[_0xf582('0x34')](_0x4c56fa['model'],qs['fields'](_0x28f943[_0xf582('0x32')][_0xf582('0x35')]));_0x3af192['attributes']=_0x3af192[_0xf582('0x36')][_0xf582('0x37')]?_0x3af192[_0xf582('0x36')]:_0x4c56fa[_0xf582('0x31')];if(_0x28f943['query'][_0xf582('0x42')]){_0x3af192[_0xf582('0x43')]=[{'all':!![]}];}_0x3af192=_[_0xf582('0x3f')]({},_0x3af192,_0x28f943[_0xf582('0x41')]);return db[_0xf582('0x2d')][_0xf582('0x48')](_0x3af192)[_0xf582('0x27')](handleEntityNotFound(_0x2d81d5,null))[_0xf582('0x27')](respondWithResult(_0x2d81d5,null))['catch'](handleError(_0x2d81d5,null));};exports[_0xf582('0x49')]=function(_0x69cb18,_0x243aab){return db[_0xf582('0x2d')][_0xf582('0x49')](_0x69cb18['body'],{})[_0xf582('0x27')](respondWithResult(_0x243aab,0xc9))['catch'](handleError(_0x243aab,null));};exports[_0xf582('0x26')]=function(_0x2c3bfd,_0x180190){if(_0x2c3bfd[_0xf582('0x4a')]['id']){delete _0x2c3bfd[_0xf582('0x4a')]['id'];}return db[_0xf582('0x2d')][_0xf582('0x48')]({'where':{'id':_0x2c3bfd['params']['id']}})['then'](handleEntityNotFound(_0x180190,null))[_0xf582('0x27')](saveUpdates(_0x2c3bfd[_0xf582('0x4a')],null))[_0xf582('0x27')](respondWithResult(_0x180190,null))[_0xf582('0x45')](handleError(_0x180190,null));};exports[_0xf582('0x28')]=function(_0x430163,_0x473e93){return db[_0xf582('0x2d')]['find']({'where':{'id':_0x430163[_0xf582('0x47')]['id']}})[_0xf582('0x27')](handleEntityNotFound(_0x473e93,null))[_0xf582('0x27')](removeEntity(_0x473e93,null))[_0xf582('0x45')](handleError(_0x473e93,null));}; \ No newline at end of file +var _0xdafe=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','map','ZendeskField'];(function(_0x50c275,_0x29c965){var _0x162928=function(_0x2aee47){while(--_0x2aee47){_0x50c275['push'](_0x50c275['shift']());}};_0x162928(++_0x29c965);}(_0xdafe,0x6a));var _0xedaf=function(_0x385643,_0x3876b0){_0x385643=_0x385643-0x0;var _0x33ee74=_0xdafe[_0x385643];return _0x33ee74;};'use strict';var emlformat=require(_0xedaf('0x0'));var rimraf=require(_0xedaf('0x1'));var zipdir=require(_0xedaf('0x2'));var jsonpatch=require(_0xedaf('0x3'));var rp=require(_0xedaf('0x4'));var moment=require(_0xedaf('0x5'));var BPromise=require(_0xedaf('0x6'));var Mustache=require(_0xedaf('0x7'));var util=require(_0xedaf('0x8'));var path=require(_0xedaf('0x9'));var sox=require(_0xedaf('0xa'));var csv=require(_0xedaf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedaf('0xc'));var _=require('lodash');var squel=require(_0xedaf('0xd'));var crypto=require(_0xedaf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xedaf('0xb'));var querystring=require(_0xedaf('0xf'));var Papa=require(_0xedaf('0x10'));var Redis=require(_0xedaf('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xedaf('0x12'))(_0xedaf('0x13'));var utils=require(_0xedaf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xedaf('0x15'));var db=require(_0xedaf('0x16'))['db'];function respondWithStatusCode(_0x22b829,_0x292147){_0x292147=_0x292147||0xcc;return function(_0x49ca2a){if(_0x49ca2a){return _0x22b829[_0xedaf('0x17')](_0x292147);}return _0x22b829[_0xedaf('0x18')](_0x292147)['end']();};}function respondWithResult(_0x192cdd,_0xbf372d){_0xbf372d=_0xbf372d||0xc8;return function(_0x252562){if(_0x252562){return _0x192cdd[_0xedaf('0x18')](_0xbf372d)[_0xedaf('0x19')](_0x252562);}};}function respondWithFilteredResult(_0x123455,_0x25e675){return function(_0x36b509){if(_0x36b509){var _0x5ac04d=typeof _0x25e675[_0xedaf('0x1a')]===_0xedaf('0x1b')&&typeof _0x25e675['limit']===_0xedaf('0x1b');var _0x21ba39=_0x36b509['count'];var _0x4cbe04=_0x5ac04d?0x0:_0x25e675[_0xedaf('0x1a')];var _0x442426=_0x5ac04d?_0x36b509[_0xedaf('0x1c')]:_0x25e675[_0xedaf('0x1a')]+_0x25e675['limit'];var _0x395286;if(_0x442426>=_0x21ba39){_0x442426=_0x21ba39;_0x395286=0xc8;}else{_0x395286=0xce;}_0x123455[_0xedaf('0x18')](_0x395286);return _0x123455[_0xedaf('0x1d')](_0xedaf('0x1e'),_0x4cbe04+'-'+_0x442426+'/'+_0x21ba39)[_0xedaf('0x19')](_0x36b509);}return null;};}function patchUpdates(_0xaa04ef){return function(_0x5dc0d8){try{jsonpatch[_0xedaf('0x1f')](_0x5dc0d8,_0xaa04ef,!![]);}catch(_0x51d2c5){return BPromise[_0xedaf('0x20')](_0x51d2c5);}return _0x5dc0d8['save']();};}function saveUpdates(_0x3370c8,_0x4bb879){return function(_0x47cc37){if(_0x47cc37){return _0x47cc37[_0xedaf('0x21')](_0x3370c8)[_0xedaf('0x22')](function(_0x19f087){return _0x19f087;});}return null;};}function removeEntity(_0x1b1e04,_0x560452){return function(_0x483f6a){if(_0x483f6a){return _0x483f6a['destroy']()[_0xedaf('0x22')](function(){_0x1b1e04[_0xedaf('0x18')](0xcc)[_0xedaf('0x23')]();});}};}function handleEntityNotFound(_0x263b41,_0x3b2e07){return function(_0x5a8d11){if(!_0x5a8d11){_0x263b41[_0xedaf('0x17')](0x194);}return _0x5a8d11;};}function handleError(_0x6ff521,_0x48e180){_0x48e180=_0x48e180||0x1f4;return function(_0x35c2e7){logger['error'](_0x35c2e7[_0xedaf('0x24')]);if(_0x35c2e7[_0xedaf('0x25')]){delete _0x35c2e7[_0xedaf('0x25')];}_0x6ff521[_0xedaf('0x18')](_0x48e180)[_0xedaf('0x26')](_0x35c2e7);};}exports[_0xedaf('0x27')]=function(_0x2d18d8,_0x19b0a1){var _0x2d0873={},_0x3708ed={},_0x5e7ad9={'count':0x0,'rows':[]};var _0x38f7a9=_[_0xedaf('0x28')](db[_0xedaf('0x29')][_0xedaf('0x2a')],function(_0x95250d){return{'name':_0x95250d[_0xedaf('0x2b')],'type':_0x95250d[_0xedaf('0x2c')][_0xedaf('0x2d')]};});_0x3708ed[_0xedaf('0x2e')]=_[_0xedaf('0x28')](_0x38f7a9,_0xedaf('0x25'));_0x3708ed[_0xedaf('0x2f')]=_['keys'](_0x2d18d8[_0xedaf('0x2f')]);_0x3708ed[_0xedaf('0x30')]=_[_0xedaf('0x31')](_0x3708ed['model'],_0x3708ed[_0xedaf('0x2f')]);_0x2d0873[_0xedaf('0x32')]=_['intersection'](_0x3708ed[_0xedaf('0x2e')],qs['fields'](_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x33')]));_0x2d0873['attributes']=_0x2d0873['attributes'][_0xedaf('0x34')]?_0x2d0873[_0xedaf('0x32')]:_0x3708ed[_0xedaf('0x2e')];if(!_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x35')](_0xedaf('0x36'))){_0x2d0873[_0xedaf('0x37')]=qs['limit'](_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x37')]);_0x2d0873[_0xedaf('0x1a')]=qs[_0xedaf('0x1a')](_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x1a')]);}_0x2d0873['order']=qs[_0xedaf('0x38')](_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x38')]);_0x2d0873[_0xedaf('0x39')]=qs[_0xedaf('0x30')](_['pick'](_0x2d18d8[_0xedaf('0x2f')],_0x3708ed[_0xedaf('0x30')]),_0x38f7a9);if(_0x2d18d8['query'][_0xedaf('0x3a')]){_0x2d0873[_0xedaf('0x39')]=_[_0xedaf('0x3b')](_0x2d0873[_0xedaf('0x39')],{'$or':_['map'](_0x38f7a9,function(_0x1eea75){if(_0x1eea75[_0xedaf('0x2c')]!==_0xedaf('0x3c')){var _0x3adcac={};_0x3adcac[_0x1eea75[_0xedaf('0x25')]]={'$like':'%'+_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x3a')]+'%'};return _0x3adcac;}})});}_0x2d0873=_[_0xedaf('0x3b')]({},_0x2d0873,_0x2d18d8[_0xedaf('0x3d')]);var _0x1a448a={'where':_0x2d0873['where']};return db['ZendeskField'][_0xedaf('0x1c')](_0x1a448a)[_0xedaf('0x22')](function(_0x440f68){_0x5e7ad9[_0xedaf('0x1c')]=_0x440f68;if(_0x2d18d8[_0xedaf('0x2f')][_0xedaf('0x3e')]){_0x2d0873[_0xedaf('0x3f')]=[{'all':!![]}];}return db[_0xedaf('0x29')][_0xedaf('0x40')](_0x2d0873);})[_0xedaf('0x22')](function(_0x450102){_0x5e7ad9[_0xedaf('0x41')]=_0x450102;return _0x5e7ad9;})[_0xedaf('0x22')](respondWithFilteredResult(_0x19b0a1,_0x2d0873))['catch'](handleError(_0x19b0a1,null));};exports[_0xedaf('0x42')]=function(_0x343ae1,_0x33f8ee){var _0x2257fd={'raw':!![],'where':{'id':_0x343ae1[_0xedaf('0x43')]['id']}},_0xfed928={};_0xfed928[_0xedaf('0x2e')]=_[_0xedaf('0x44')](db['ZendeskField'][_0xedaf('0x2a')]);_0xfed928[_0xedaf('0x2f')]=_[_0xedaf('0x44')](_0x343ae1['query']);_0xfed928[_0xedaf('0x30')]=_['intersection'](_0xfed928['model'],_0xfed928[_0xedaf('0x2f')]);_0x2257fd[_0xedaf('0x32')]=_[_0xedaf('0x31')](_0xfed928[_0xedaf('0x2e')],qs[_0xedaf('0x33')](_0x343ae1[_0xedaf('0x2f')]['fields']));_0x2257fd[_0xedaf('0x32')]=_0x2257fd[_0xedaf('0x32')][_0xedaf('0x34')]?_0x2257fd[_0xedaf('0x32')]:_0xfed928[_0xedaf('0x2e')];if(_0x343ae1[_0xedaf('0x2f')][_0xedaf('0x3e')]){_0x2257fd[_0xedaf('0x3f')]=[{'all':!![]}];}_0x2257fd=_[_0xedaf('0x3b')]({},_0x2257fd,_0x343ae1[_0xedaf('0x3d')]);return db[_0xedaf('0x29')][_0xedaf('0x45')](_0x2257fd)[_0xedaf('0x22')](handleEntityNotFound(_0x33f8ee,null))[_0xedaf('0x22')](respondWithResult(_0x33f8ee,null))[_0xedaf('0x46')](handleError(_0x33f8ee,null));};exports[_0xedaf('0x47')]=function(_0x2b71bd,_0x358e61){return db[_0xedaf('0x29')][_0xedaf('0x47')](_0x2b71bd['body'],{})[_0xedaf('0x22')](respondWithResult(_0x358e61,0xc9))[_0xedaf('0x46')](handleError(_0x358e61,null));};exports[_0xedaf('0x21')]=function(_0xb791f6,_0x349b55){if(_0xb791f6['body']['id']){delete _0xb791f6[_0xedaf('0x48')]['id'];}return db[_0xedaf('0x29')][_0xedaf('0x45')]({'where':{'id':_0xb791f6[_0xedaf('0x43')]['id']}})[_0xedaf('0x22')](handleEntityNotFound(_0x349b55,null))['then'](saveUpdates(_0xb791f6[_0xedaf('0x48')],null))['then'](respondWithResult(_0x349b55,null))['catch'](handleError(_0x349b55,null));};exports[_0xedaf('0x49')]=function(_0x55faba,_0x28296a){return db[_0xedaf('0x29')][_0xedaf('0x45')]({'where':{'id':_0x55faba[_0xedaf('0x43')]['id']}})['then'](handleEntityNotFound(_0x28296a,null))[_0xedaf('0x22')](removeEntity(_0x28296a,null))['catch'](handleError(_0x28296a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e9bab29..e04ace1 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 _0xce6f=['../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xce6f,0x14b));var _0xfce6=function(_0x19b1fa,_0x319e3f){_0x19b1fa=_0x19b1fa-0x0;var _0x5f224e=_0xce6f[_0x19b1fa];return _0x5f224e;};'use strict';var _=require('lodash');var util=require(_0xfce6('0x0'));var logger=require(_0xfce6('0x1'))(_0xfce6('0x2'));var moment=require(_0xfce6('0x3'));var BPromise=require('bluebird');var rp=require(_0xfce6('0x4'));var fs=require('fs');var path=require(_0xfce6('0x5'));var rimraf=require(_0xfce6('0x6'));var config=require(_0xfce6('0x7'));var attributes=require(_0xfce6('0x8'));module[_0xfce6('0x9')]=function(_0x4cd0aa,_0x1345fa){return _0x4cd0aa['define']('ZendeskField',attributes,{'tableName':_0xfce6('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xfce6('0xb'),_0xfce6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b2e=['FieldId','lodash','util','../../config/logger','api','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x2cb779,_0x5c4755){var _0x517a18=function(_0x49cb1d){while(--_0x49cb1d){_0x2cb779['push'](_0x2cb779['shift']());}};_0x517a18(++_0x5c4755);}(_0x4b2e,0x7f));var _0xe4b2=function(_0x49c9fa,_0x2c3fb5){_0x49c9fa=_0x49c9fa-0x0;var _0xa8db1d=_0x4b2e[_0x49c9fa];return _0xa8db1d;};'use strict';var _=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var logger=require(_0xe4b2('0x2'))(_0xe4b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe4b2('0x4'));var fs=require('fs');var path=require(_0xe4b2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe4b2('0x6'));module[_0xe4b2('0x7')]=function(_0xdb95e8,_0x2fcca4){return _0xdb95e8[_0xe4b2('0x8')](_0xe4b2('0x9'),attributes,{'tableName':_0xe4b2('0xa'),'paranoid':![],'indexes':[{'name':_0xe4b2('0xb'),'fields':[_0xe4b2('0xc'),_0xe4b2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index a87a791..84adde2 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 _0x6dbc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash'];(function(_0x4752aa,_0x204c2f){var _0x230988=function(_0x53825f){while(--_0x53825f){_0x4752aa['push'](_0x4752aa['shift']());}};_0x230988(++_0x204c2f);}(_0x6dbc,0x18f));var _0xc6db=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x6dbc[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xc6db('0x0'));var util=require(_0xc6db('0x1'));var moment=require(_0xc6db('0x2'));var BPromise=require(_0xc6db('0x3'));var rs=require(_0xc6db('0x4'));var fs=require('fs');var Redis=require(_0xc6db('0x5'));var db=require(_0xc6db('0x6'))['db'];var utils=require(_0xc6db('0x7'));var logger=require(_0xc6db('0x8'))(_0xc6db('0x9'));var config=require(_0xc6db('0xa'));var jayson=require(_0xc6db('0xb'));var client=jayson[_0xc6db('0xc')][_0xc6db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x29721e,_0x72d73d,_0xae5793){return new BPromise(function(_0x5cd17d,_0x554080){return client[_0xc6db('0xe')](_0x29721e,_0xae5793)[_0xc6db('0xf')](function(_0xd83bd1){logger[_0xc6db('0x10')](_0xc6db('0x11'),_0x72d73d,'request\x20sent');logger['debug'](_0xc6db('0x12'),_0x72d73d,'request\x20sent',JSON[_0xc6db('0x13')](_0xd83bd1));if(_0xd83bd1[_0xc6db('0x14')]){if(_0xd83bd1[_0xc6db('0x14')]['code']===0x1f4){logger[_0xc6db('0x14')](_0xc6db('0x11'),_0x72d73d,_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);return _0x554080(_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);}logger[_0xc6db('0x14')](_0xc6db('0x11'),_0x72d73d,_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);return _0x5cd17d(_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);}else{logger[_0xc6db('0x10')](_0xc6db('0x11'),_0x72d73d,_0xc6db('0x16'));_0x5cd17d(_0xd83bd1[_0xc6db('0x17')][_0xc6db('0x15')]);}})[_0xc6db('0x18')](function(_0x4d04a9){logger[_0xc6db('0x14')]('ZendeskField,\x20%s,\x20%s',_0x72d73d,_0x4d04a9);_0x554080(_0x4d04a9);});});} \ No newline at end of file +var _0xe04c=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe04c,0x7d));var _0xce04=function(_0x165715,_0x23c59d){_0x165715=_0x165715-0x0;var _0x40f62a=_0xe04c[_0x165715];return _0x40f62a;};'use strict';var _=require(_0xce04('0x0'));var util=require(_0xce04('0x1'));var moment=require(_0xce04('0x2'));var BPromise=require(_0xce04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce04('0x4'))['db'];var utils=require(_0xce04('0x5'));var logger=require(_0xce04('0x6'))(_0xce04('0x7'));var config=require(_0xce04('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4153f8,_0x449bdd,_0x16c3ac){return new BPromise(function(_0x5c2587,_0x59f035){return client[_0xce04('0x9')](_0x4153f8,_0x16c3ac)[_0xce04('0xa')](function(_0x458a9e){logger[_0xce04('0xb')](_0xce04('0xc'),_0x449bdd,_0xce04('0xd'));logger[_0xce04('0xe')](_0xce04('0xf'),_0x449bdd,_0xce04('0xd'),JSON['stringify'](_0x458a9e));if(_0x458a9e[_0xce04('0x10')]){if(_0x458a9e['error']['code']===0x1f4){logger[_0xce04('0x10')](_0xce04('0xc'),_0x449bdd,_0x458a9e[_0xce04('0x10')]['message']);return _0x59f035(_0x458a9e[_0xce04('0x10')][_0xce04('0x11')]);}logger[_0xce04('0x10')](_0xce04('0xc'),_0x449bdd,_0x458a9e['error'][_0xce04('0x11')]);return _0x5c2587(_0x458a9e[_0xce04('0x10')][_0xce04('0x11')]);}else{logger[_0xce04('0xb')](_0xce04('0xc'),_0x449bdd,'request\x20sent');_0x5c2587(_0x458a9e['result'][_0xce04('0x11')]);}})['catch'](function(_0x120a66){logger['error'](_0xce04('0xc'),_0x449bdd,_0x120a66);_0x59f035(_0x120a66);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2dcf6dc..60518f4 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 _0xb9b5=['exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','delete'];(function(_0x129afe,_0x2b5295){var _0x39b1a4=function(_0x41ad0f){while(--_0x41ad0f){_0x129afe['push'](_0x129afe['shift']());}};_0x39b1a4(++_0x2b5295);}(_0xb9b5,0x169));var _0x5b9b=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xb9b5[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require('multer');var util=require(_0x5b9b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b9b('0x1'));var router=express[_0x5b9b('0x2')]();var fs_extra=require(_0x5b9b('0x3'));var auth=require(_0x5b9b('0x4'));var interaction=require(_0x5b9b('0x5'));var config=require(_0x5b9b('0x6'));var controller=require(_0x5b9b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5b9b('0x8')](_0x5b9b('0x9'),auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xb')]);router[_0x5b9b('0x8')](_0x5b9b('0xc'),auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xd')]);router[_0x5b9b('0x8')]('/:id/fields',auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xe')]);router[_0x5b9b('0xf')]('/',auth[_0x5b9b('0xa')](),controller[_0x5b9b('0x10')]);router['post'](_0x5b9b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5b9b('0x11')]('/:id',auth[_0x5b9b('0xa')](),controller['update']);router[_0x5b9b('0x12')](_0x5b9b('0x9'),auth[_0x5b9b('0xa')](),controller['destroy']);module[_0x5b9b('0x13')]=router; \ No newline at end of file +var _0x0097=['./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x0097,0x1c4));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7009('0x0'));var util=require(_0x7009('0x1'));var path=require(_0x7009('0x2'));var timeout=require('connect-timeout');var express=require(_0x7009('0x3'));var router=express[_0x7009('0x4')]();var fs_extra=require(_0x7009('0x5'));var auth=require(_0x7009('0x6'));var interaction=require(_0x7009('0x7'));var config=require('../../config/environment');var controller=require(_0x7009('0x8'));router[_0x7009('0x9')]('/',auth[_0x7009('0xa')](),controller['index']);router[_0x7009('0x9')](_0x7009('0xb'),auth[_0x7009('0xa')](),controller[_0x7009('0xc')]);router[_0x7009('0x9')]('/:id/configurations',auth[_0x7009('0xa')](),controller['getConfigurations']);router[_0x7009('0x9')](_0x7009('0xd'),auth[_0x7009('0xa')](),controller[_0x7009('0xe')]);router['post']('/',auth[_0x7009('0xa')](),controller[_0x7009('0xf')]);router[_0x7009('0x10')](_0x7009('0x11'),auth[_0x7009('0xa')](),controller[_0x7009('0x12')]);router['put']('/:id',auth[_0x7009('0xa')](),controller[_0x7009('0x13')]);router[_0x7009('0x14')](_0x7009('0xb'),auth[_0x7009('0xa')](),controller[_0x7009('0x15')]);module[_0x7009('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b368820..5debfb9 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x45145d,_0x5aaea3){var _0x131ab1=function(_0x6fa534){while(--_0x6fa534){_0x45145d['push'](_0x45145d['shift']());}};_0x131ab1(++_0x5aaea3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x668b,0x140));var _0xb668=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x668b[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 99acb15..e6d55e9 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 _0x01cf=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','ZohoAccount','rawAttributes','key','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','WhoId','Call_Duration','Call_Result','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x3929b2,_0xa46a51){var _0x20b0bc=function(_0x2fd8c0){while(--_0x2fd8c0){_0x3929b2['push'](_0x3929b2['shift']());}};_0x20b0bc(++_0xa46a51);}(_0x01cf,0x87));var _0xf01c=function(_0x95f3ba,_0xcc8cbf){_0x95f3ba=_0x95f3ba-0x0;var _0x221d6f=_0x01cf[_0x95f3ba];return _0x221d6f;};'use strict';var emlformat=require(_0xf01c('0x0'));var rimraf=require(_0xf01c('0x1'));var zipdir=require(_0xf01c('0x2'));var jsonpatch=require(_0xf01c('0x3'));var rp=require('request-promise');var moment=require(_0xf01c('0x4'));var BPromise=require(_0xf01c('0x5'));var Mustache=require(_0xf01c('0x6'));var util=require(_0xf01c('0x7'));var path=require(_0xf01c('0x8'));var sox=require(_0xf01c('0x9'));var csv=require(_0xf01c('0xa'));var ejs=require(_0xf01c('0xb'));var fs=require('fs');var fs_extra=require(_0xf01c('0xc'));var _=require(_0xf01c('0xd'));var squel=require(_0xf01c('0xe'));var crypto=require(_0xf01c('0xf'));var jsforce=require(_0xf01c('0x10'));var deskjs=require(_0xf01c('0x11'));var toCsv=require(_0xf01c('0xa'));var querystring=require(_0xf01c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf01c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf01c('0x14'));var logger=require(_0xf01c('0x15'))(_0xf01c('0x16'));var utils=require(_0xf01c('0x17'));var config=require(_0xf01c('0x18'));var licenseUtil=require(_0xf01c('0x19'));var db=require(_0xf01c('0x1a'))['db'];var integrations=require(_0xf01c('0x1b'));function respondWithStatusCode(_0x1e67e5,_0x463b94){_0x463b94=_0x463b94||0xcc;return function(_0x308535){if(_0x308535){return _0x1e67e5[_0xf01c('0x1c')](_0x463b94);}return _0x1e67e5[_0xf01c('0x1d')](_0x463b94)[_0xf01c('0x1e')]();};}function respondWithResult(_0x2dcebd,_0x4e455b){_0x4e455b=_0x4e455b||0xc8;return function(_0xe1c601){if(_0xe1c601){return _0x2dcebd[_0xf01c('0x1d')](_0x4e455b)['json'](_0xe1c601);}};}function respondWithFilteredResult(_0x5b2b71,_0x3d907c){return function(_0x173b33){if(_0x173b33){var _0x38faf1=typeof _0x3d907c[_0xf01c('0x1f')]===_0xf01c('0x20')&&typeof _0x3d907c[_0xf01c('0x21')]===_0xf01c('0x20');var _0x91180d=_0x173b33[_0xf01c('0x22')];var _0x44286e=_0x38faf1?0x0:_0x3d907c['offset'];var _0x4a5e00=_0x38faf1?_0x173b33[_0xf01c('0x22')]:_0x3d907c[_0xf01c('0x1f')]+_0x3d907c['limit'];var _0x40c654;if(_0x4a5e00>=_0x91180d){_0x4a5e00=_0x91180d;_0x40c654=0xc8;}else{_0x40c654=0xce;}_0x5b2b71[_0xf01c('0x1d')](_0x40c654);return _0x5b2b71[_0xf01c('0x23')](_0xf01c('0x24'),_0x44286e+'-'+_0x4a5e00+'/'+_0x91180d)[_0xf01c('0x25')](_0x173b33);}return null;};}function patchUpdates(_0x591a56){return function(_0x23491f){try{jsonpatch['apply'](_0x23491f,_0x591a56,!![]);}catch(_0x4aefdb){return BPromise[_0xf01c('0x26')](_0x4aefdb);}return _0x23491f[_0xf01c('0x27')]();};}function saveUpdates(_0x1e210d,_0x11b30c){return function(_0x213fd4){if(_0x213fd4){return _0x213fd4[_0xf01c('0x28')](_0x1e210d)[_0xf01c('0x29')](function(_0x43fbeb){return _0x43fbeb;});}return null;};}function removeEntity(_0x12b943,_0x1c2513){return function(_0x47055d){if(_0x47055d){return _0x47055d[_0xf01c('0x2a')]()[_0xf01c('0x29')](function(){_0x12b943[_0xf01c('0x1d')](0xcc)[_0xf01c('0x1e')]();});}};}function handleEntityNotFound(_0x28c71a,_0x38875b){return function(_0x2e528d){if(!_0x2e528d){_0x28c71a['sendStatus'](0x194);}return _0x2e528d;};}function handleError(_0x3cdf13,_0x24242b){_0x24242b=_0x24242b||0x1f4;return function(_0x25e1a7){logger[_0xf01c('0x2b')](_0x25e1a7[_0xf01c('0x2c')]);if(_0x25e1a7[_0xf01c('0x2d')]){delete _0x25e1a7['name'];}_0x3cdf13[_0xf01c('0x1d')](_0x24242b)[_0xf01c('0x2e')](_0x25e1a7);};}exports['index']=function(_0x5b94b0,_0x1cb3b7){var _0x139ed2={},_0x10cde8={},_0x938c08={'count':0x0,'rows':[]};var _0x5646eb=_['map'](db[_0xf01c('0x2f')][_0xf01c('0x30')],function(_0x1a780c){return{'name':_0x1a780c['fieldName'],'type':_0x1a780c['type'][_0xf01c('0x31')]};});_0x10cde8['model']=_[_0xf01c('0x32')](_0x5646eb,_0xf01c('0x2d'));_0x10cde8['query']=_[_0xf01c('0x33')](_0x5b94b0[_0xf01c('0x34')]);_0x10cde8[_0xf01c('0x35')]=_['intersection'](_0x10cde8[_0xf01c('0x36')],_0x10cde8[_0xf01c('0x34')]);_0x139ed2[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x10cde8[_0xf01c('0x36')],qs[_0xf01c('0x39')](_0x5b94b0['query'][_0xf01c('0x39')]));_0x139ed2[_0xf01c('0x37')]=_0x139ed2[_0xf01c('0x37')][_0xf01c('0x3a')]?_0x139ed2[_0xf01c('0x37')]:_0x10cde8[_0xf01c('0x36')];if(!_0x5b94b0[_0xf01c('0x34')]['hasOwnProperty'](_0xf01c('0x3b'))){_0x139ed2[_0xf01c('0x21')]=qs[_0xf01c('0x21')](_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x21')]);_0x139ed2[_0xf01c('0x1f')]=qs[_0xf01c('0x1f')](_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x1f')]);}_0x139ed2[_0xf01c('0x3c')]=qs[_0xf01c('0x3d')](_0x5b94b0['query'][_0xf01c('0x3d')]);_0x139ed2[_0xf01c('0x3e')]=qs[_0xf01c('0x35')](_[_0xf01c('0x3f')](_0x5b94b0[_0xf01c('0x34')],_0x10cde8[_0xf01c('0x35')]),_0x5646eb);if(_0x5b94b0['query'][_0xf01c('0x40')]){_0x139ed2[_0xf01c('0x3e')]=_[_0xf01c('0x41')](_0x139ed2[_0xf01c('0x3e')],{'$or':_[_0xf01c('0x32')](_0x5646eb,function(_0x3d1b2f){if(_0x3d1b2f[_0xf01c('0x42')]!==_0xf01c('0x43')){var _0x10b09d={};_0x10b09d[_0x3d1b2f['name']]={'$like':'%'+_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x40')]+'%'};return _0x10b09d;}})});}_0x139ed2=_[_0xf01c('0x41')]({},_0x139ed2,_0x5b94b0[_0xf01c('0x44')]);var _0x3dfa55={'where':_0x139ed2[_0xf01c('0x3e')]};return db['ZohoAccount']['count'](_0x3dfa55)['then'](function(_0x1c139a){_0x938c08[_0xf01c('0x22')]=_0x1c139a;if(_0x5b94b0['query']['includeAll']){_0x139ed2[_0xf01c('0x45')]=[{'all':!![]}];}return db['ZohoAccount'][_0xf01c('0x46')](_0x139ed2);})[_0xf01c('0x29')](function(_0x393a03){_0x938c08[_0xf01c('0x47')]=_0x393a03;return _0x938c08;})[_0xf01c('0x29')](respondWithFilteredResult(_0x1cb3b7,_0x139ed2))[_0xf01c('0x48')](handleError(_0x1cb3b7,null));};exports[_0xf01c('0x49')]=function(_0x1cc94d,_0xc82046){var _0x1f72f6={'raw':![],'where':{'id':_0x1cc94d[_0xf01c('0x4a')]['id']}},_0x11550d={};_0x11550d['model']=_['keys'](db['ZohoAccount'][_0xf01c('0x30')]);_0x11550d[_0xf01c('0x34')]=_[_0xf01c('0x33')](_0x1cc94d[_0xf01c('0x34')]);_0x11550d[_0xf01c('0x35')]=_[_0xf01c('0x38')](_0x11550d[_0xf01c('0x36')],_0x11550d[_0xf01c('0x34')]);_0x1f72f6[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x11550d[_0xf01c('0x36')],qs[_0xf01c('0x39')](_0x1cc94d[_0xf01c('0x34')]['fields']));_0x1f72f6['attributes']=_0x1f72f6['attributes'][_0xf01c('0x3a')]?_0x1f72f6[_0xf01c('0x37')]:_0x11550d[_0xf01c('0x36')];if(_0x1cc94d[_0xf01c('0x34')][_0xf01c('0x4b')]){_0x1f72f6[_0xf01c('0x45')]=[{'all':!![]}];}_0x1f72f6=_[_0xf01c('0x41')]({},_0x1f72f6,_0x1cc94d[_0xf01c('0x44')]);return db[_0xf01c('0x2f')][_0xf01c('0x4c')](_0x1f72f6)[_0xf01c('0x29')](handleEntityNotFound(_0xc82046,null))[_0xf01c('0x29')](respondWithResult(_0xc82046,null))['catch'](handleError(_0xc82046,null));};exports[_0xf01c('0x4d')]=function(_0x37a0d6,_0x583729){return db[_0xf01c('0x2f')][_0xf01c('0x4d')](_0x37a0d6[_0xf01c('0x4e')],{})[_0xf01c('0x29')](respondWithResult(_0x583729,0xc9))[_0xf01c('0x48')](handleError(_0x583729,null));};exports[_0xf01c('0x28')]=function(_0x12bba3,_0x74d412){if(_0x12bba3['body']['id']){delete _0x12bba3['body']['id'];}return db[_0xf01c('0x2f')][_0xf01c('0x4c')]({'where':{'id':_0x12bba3[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x74d412,null))[_0xf01c('0x29')](saveUpdates(_0x12bba3[_0xf01c('0x4e')],null))['then'](respondWithResult(_0x74d412,null))[_0xf01c('0x48')](handleError(_0x74d412,null));};exports[_0xf01c('0x2a')]=function(_0x4bd6a9,_0x247781){return db['ZohoAccount'][_0xf01c('0x4c')]({'where':{'id':_0x4bd6a9[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x247781,null))[_0xf01c('0x29')](removeEntity(_0x247781,null))[_0xf01c('0x48')](handleError(_0x247781,null));};exports['getConfigurations']=function(_0x31ecc7,_0x3dab02,_0x4b1253){var _0x1a43d6={};var _0x377c31={};var _0x1f71f9;var _0x4a6c68;return db[_0xf01c('0x2f')]['findOne']({'where':{'id':_0x31ecc7[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x3dab02,null))['then'](function(_0x1517e2){if(_0x1517e2){_0x1f71f9=_0x1517e2;_0x377c31[_0xf01c('0x36')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x377c31['query']=_[_0xf01c('0x33')](_0x31ecc7[_0xf01c('0x34')]);_0x377c31[_0xf01c('0x35')]=_['intersection'](_0x377c31['model'],_0x377c31['query']);_0x1a43d6[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x377c31['model'],qs[_0xf01c('0x39')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x39')]));_0x1a43d6[_0xf01c('0x37')]=_0x1a43d6[_0xf01c('0x37')][_0xf01c('0x3a')]?_0x1a43d6[_0xf01c('0x37')]:_0x377c31[_0xf01c('0x36')];_0x1a43d6[_0xf01c('0x3c')]=qs[_0xf01c('0x3d')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x3d')]);_0x1a43d6[_0xf01c('0x3e')]=qs['filters'](_['pick'](_0x31ecc7[_0xf01c('0x34')],_0x377c31['filters']));if(_0x31ecc7['query'][_0xf01c('0x40')]){_0x1a43d6['where']=_[_0xf01c('0x41')](_0x1a43d6[_0xf01c('0x3e')],{'$or':_['map'](_0x1a43d6[_0xf01c('0x37')],function(_0x2e3324){var _0x3f9cc9={};_0x3f9cc9[_0x2e3324]={'$like':'%'+_0x31ecc7[_0xf01c('0x34')]['filter']+'%'};return _0x3f9cc9;})});}_0x1a43d6=_[_0xf01c('0x41')]({},_0x1a43d6,_0x31ecc7[_0xf01c('0x44')]);return _0x1f71f9['getConfigurations'](_0x1a43d6);}})[_0xf01c('0x29')](function(_0x176f39){if(_0x176f39){_0x4a6c68=_0x176f39['length'];if(!_0x31ecc7[_0xf01c('0x34')]['hasOwnProperty'](_0xf01c('0x3b'))){_0x1a43d6[_0xf01c('0x21')]=qs[_0xf01c('0x21')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x21')]);_0x1a43d6[_0xf01c('0x1f')]=qs[_0xf01c('0x1f')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x1f')]);}return _0x1f71f9['getConfigurations'](_0x1a43d6);}})['then'](function(_0x591710){if(_0x591710){return _0x591710?{'count':_0x4a6c68,'rows':_0x591710}:null;}})[_0xf01c('0x29')](respondWithResult(_0x3dab02,null))['catch'](handleError(_0x3dab02,null));};exports[_0xf01c('0x4f')]=function(_0x2e1e23,_0x4608b0,_0x142a0f){if(_0x2e1e23['body']['id']){delete _0x2e1e23['body']['id'];}return db[_0xf01c('0x2f')][_0xf01c('0x50')]({'where':{'id':_0x2e1e23[_0xf01c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4608b0,null))[_0xf01c('0x29')](function(_0x543656){if(_0x543656){_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x51')]=_0x543656['id'];_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x52')]=integrations[_0xf01c('0x53')](_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x54')],_0x2e1e23[_0xf01c('0x4e')]['type']);_0x2e1e23['body']['Descriptions']=integrations[_0xf01c('0x55')](_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x54')],_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x42')]);return db[_0xf01c('0x56')][_0xf01c('0x4d')](_0x2e1e23[_0xf01c('0x4e')],{'include':[{'model':db['ZohoField'],'as':_0xf01c('0x52')},{'model':db['ZohoField'],'as':_0xf01c('0x57')}]});}return null;})[_0xf01c('0x29')](respondWithResult(_0x4608b0,null))[_0xf01c('0x48')](handleError(_0x4608b0,null));};function getAccessToken(_0xeba74e){return new Promise(function(_0x4e5572,_0x37cd4d){var _0x4fb6b2;switch(_0xeba74e[_0xf01c('0x58')]){case'US':_0x4fb6b2='https://accounts.zoho.com';break;case'AU':_0x4fb6b2=_0xf01c('0x59');break;case'EU':_0x4fb6b2=_0xf01c('0x5a');break;case'IN':_0x4fb6b2=_0xf01c('0x5b');break;case'CN':_0x4fb6b2=_0xf01c('0x5c');break;default:_0x4fb6b2=_0xf01c('0x5a');break;}var _0x2df315={'method':'POST','uri':_0x4fb6b2+_0xf01c('0x5d'),'qs':{'refresh_token':_0xeba74e[_0xf01c('0x5e')],'client_id':_0xeba74e[_0xf01c('0x5f')],'client_secret':_0xeba74e[_0xf01c('0x60')],'grant_type':_0xf01c('0x61')},'json':!![]};return rp(_0x2df315)[_0xf01c('0x29')](function(_0x5c8dcf){if(_0x5c8dcf[_0xf01c('0x62')]){_0x4e5572(_0x5c8dcf[_0xf01c('0x62')]);}else{_0x37cd4d(_0xf01c('0x63'));}})[_0xf01c('0x48')](function(_0x32911f){_0x37cd4d(_0x32911f);});});}exports[_0xf01c('0x64')]=function(_0x31bf25,_0x33d78a,_0x1bd3a4){var _0x6a6d7c,_0x183f66,_0x3e87cc,_0xd67b4b,_0x266fd9;return db[_0xf01c('0x2f')][_0xf01c('0x50')]({'where':{'id':_0x31bf25[_0xf01c('0x4a')]['id']},'attributes':['id',_0xf01c('0x65'),'zone',_0xf01c('0x5f'),'clientSecret',_0xf01c('0x66'),'code','refreshToken']})[_0xf01c('0x29')](handleEntityNotFound(_0x33d78a,null))[_0xf01c('0x29')](function(_0x5a7c6f){_0x266fd9=_0x5a7c6f;_0x6a6d7c=_0x266fd9['host'];_0x183f66=_0x6a6d7c===_0xf01c('0x67')?'eu':_0xf01c('0x68');_0x3e87cc=_0x266fd9[_0xf01c('0x66')];var _0xbaf17e=_0x3e87cc[_0xf01c('0x69')](-0x1);if(_0xbaf17e==='/'||_0xbaf17e==='\x5c'||_0xbaf17e===':'){_0x3e87cc=_0x3e87cc[_0xf01c('0x6a')](0x0,_0x3e87cc[_0xf01c('0x6b')](_0xbaf17e));}if(!_0x266fd9[_0xf01c('0x5e')]){throw new Error(_0xf01c('0x6c'));}return getAccessToken(_0x266fd9);})[_0xf01c('0x29')](function(_0x4b94e0){if(_0x4b94e0){return rp({'method':'GET','uri':util[_0xf01c('0x6d')](_0xf01c('0x6e'),_0x183f66),'qs':{'module':_0xf01c('0x6f')},'headers':{'Authorization':_0xf01c('0x70')+_0x4b94e0},'json':!![]});}})[_0xf01c('0x29')](function(_0x1bec5c){if(_0x1bec5c){if(_0x1bec5c[_0xf01c('0x71')]&&_0x1bec5c[_0xf01c('0x71')][_0xf01c('0x2b')]){throw new Error(_0x1bec5c[_0xf01c('0x71')][_0xf01c('0x2b')][_0xf01c('0x72')]);}var _0x2d565a=[];var _0x4c8a6a=[];var _0x33414a=[_0xf01c('0x73'),'Subject','Description',_0xf01c('0x74'),_0xf01c('0x75'),_0xf01c('0x76'),'Call_Start_Time','Call_Type'];_0x4c8a6a=_[_0xf01c('0x77')](_0x1bec5c[_0xf01c('0x39')],function(_0x35351b){return _0x33414a[_0xf01c('0x78')](_0x35351b[_0xf01c('0x79')]);});for(var _0x41deda=0x0;_0x41deda<_0x4c8a6a[_0xf01c('0x3a')];_0x41deda++){if(_0x4c8a6a[_0x41deda][_0xf01c('0x7a')]===![]){_0x2d565a[_0xf01c('0x7b')]({'id':_0x4c8a6a[_0x41deda]['id'],'name':_0x4c8a6a[_0x41deda][_0xf01c('0x7c')],'custom':_0x4c8a6a[_0x41deda][_0xf01c('0x7d')],'options':_0x4c8a6a[_0x41deda][_0xf01c('0x7e')]===_0xf01c('0x7f')&&_0x4c8a6a[_0x41deda][_0xf01c('0x80')]['length']>-0x1?_['map'](_0x4c8a6a[_0x41deda][_0xf01c('0x80')],function(_0x5b51bc){return{'name':_0x5b51bc,'value':_0x5b51bc};}):[]});}}return{'count':_0x2d565a['length'],'rows':_0x2d565a};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x33d78a,null))[_0xf01c('0x48')](function(_0x1beaf2){var _0x241309=_0x31bf25[_0xf01c('0x34')]['test']?0x1f4:_0x1beaf2[_0xf01c('0x81')]||0x1f4;logger[_0xf01c('0x2b')](_0xf01c('0x82'),'getFields',_0x241309,JSON[_0xf01c('0x83')](_0x1beaf2));delete _0x1beaf2[_0xf01c('0x2d')];if(_0x241309===0x191){_0x241309=0x190;}_0x33d78a[_0xf01c('0x1d')](_0x241309)['send'](_0x31bf25['query'][_0xf01c('0x84')]?{'message':_0xf01c('0x85'),'statusCode':_0x1beaf2[_0xf01c('0x81')]}:_0x1beaf2);});}; \ No newline at end of file +var _0x6aea=['map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','ZohoAccount','findAll','rows','catch','show','params','keys','create','body','find','findOne','ZohoConfiguration','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','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','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','error','name','index'];(function(_0x3d47cb,_0x45bb26){var _0x1670a8=function(_0x34d7c0){while(--_0x34d7c0){_0x3d47cb['push'](_0x3d47cb['shift']());}};_0x1670a8(++_0x45bb26);}(_0x6aea,0x168));var _0xa6ae=function(_0x3d3640,_0x225220){_0x3d3640=_0x3d3640-0x0;var _0xbb64cf=_0x6aea[_0x3d3640];return _0xbb64cf;};'use strict';var emlformat=require(_0xa6ae('0x0'));var rimraf=require(_0xa6ae('0x1'));var zipdir=require(_0xa6ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6ae('0x3'));var moment=require(_0xa6ae('0x4'));var BPromise=require(_0xa6ae('0x5'));var Mustache=require(_0xa6ae('0x6'));var util=require(_0xa6ae('0x7'));var path=require(_0xa6ae('0x8'));var sox=require(_0xa6ae('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6ae('0xa'));var _=require(_0xa6ae('0xb'));var squel=require(_0xa6ae('0xc'));var crypto=require(_0xa6ae('0xd'));var jsforce=require(_0xa6ae('0xe'));var deskjs=require(_0xa6ae('0xf'));var toCsv=require(_0xa6ae('0x10'));var querystring=require('querystring');var Papa=require(_0xa6ae('0x11'));var Redis=require(_0xa6ae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa6ae('0x13'));var as=require(_0xa6ae('0x14'));var hardwareService=require(_0xa6ae('0x15'));var logger=require(_0xa6ae('0x16'))(_0xa6ae('0x17'));var utils=require(_0xa6ae('0x18'));var config=require(_0xa6ae('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa6ae('0x1a'))['db'];var integrations=require(_0xa6ae('0x1b'));function respondWithStatusCode(_0x62f700,_0x392868){_0x392868=_0x392868||0xcc;return function(_0x4182a4){if(_0x4182a4){return _0x62f700[_0xa6ae('0x1c')](_0x392868);}return _0x62f700[_0xa6ae('0x1d')](_0x392868)[_0xa6ae('0x1e')]();};}function respondWithResult(_0x464d26,_0x5505ad){_0x5505ad=_0x5505ad||0xc8;return function(_0x313359){if(_0x313359){return _0x464d26[_0xa6ae('0x1d')](_0x5505ad)[_0xa6ae('0x1f')](_0x313359);}};}function respondWithFilteredResult(_0x2fbd75,_0x5aa253){return function(_0x5858c2){if(_0x5858c2){var _0x45674f=typeof _0x5aa253[_0xa6ae('0x20')]==='undefined'&&typeof _0x5aa253[_0xa6ae('0x21')]===_0xa6ae('0x22');var _0x51ef06=_0x5858c2[_0xa6ae('0x23')];var _0x545228=_0x45674f?0x0:_0x5aa253['offset'];var _0xd1fe01=_0x45674f?_0x5858c2[_0xa6ae('0x23')]:_0x5aa253[_0xa6ae('0x20')]+_0x5aa253[_0xa6ae('0x21')];var _0x4e4b5e;if(_0xd1fe01>=_0x51ef06){_0xd1fe01=_0x51ef06;_0x4e4b5e=0xc8;}else{_0x4e4b5e=0xce;}_0x2fbd75['status'](_0x4e4b5e);return _0x2fbd75[_0xa6ae('0x24')](_0xa6ae('0x25'),_0x545228+'-'+_0xd1fe01+'/'+_0x51ef06)[_0xa6ae('0x1f')](_0x5858c2);}return null;};}function patchUpdates(_0x308a48){return function(_0x2309af){try{jsonpatch[_0xa6ae('0x26')](_0x2309af,_0x308a48,!![]);}catch(_0x357a61){return BPromise['reject'](_0x357a61);}return _0x2309af['save']();};}function saveUpdates(_0x356b96,_0x49c117){return function(_0x301b69){if(_0x301b69){return _0x301b69[_0xa6ae('0x27')](_0x356b96)['then'](function(_0x415d55){return _0x415d55;});}return null;};}function removeEntity(_0x2423a9,_0x17ba35){return function(_0x3cd39d){if(_0x3cd39d){return _0x3cd39d[_0xa6ae('0x28')]()[_0xa6ae('0x29')](function(){_0x2423a9['status'](0xcc)[_0xa6ae('0x1e')]();});}};}function handleEntityNotFound(_0x3b73fd,_0x551cbf){return function(_0xf6213c){if(!_0xf6213c){_0x3b73fd['sendStatus'](0x194);}return _0xf6213c;};}function handleError(_0x3cbaa7,_0x475cf0){_0x475cf0=_0x475cf0||0x1f4;return function(_0x148212){logger[_0xa6ae('0x2a')](_0x148212['stack']);if(_0x148212[_0xa6ae('0x2b')]){delete _0x148212[_0xa6ae('0x2b')];}_0x3cbaa7[_0xa6ae('0x1d')](_0x475cf0)['send'](_0x148212);};}exports[_0xa6ae('0x2c')]=function(_0x496ff1,_0x1c4353){var _0x2e2933={},_0x2d28be={},_0x26f685={'count':0x0,'rows':[]};var _0x35b18f=_[_0xa6ae('0x2d')](db['ZohoAccount'][_0xa6ae('0x2e')],function(_0x597394){return{'name':_0x597394[_0xa6ae('0x2f')],'type':_0x597394[_0xa6ae('0x30')][_0xa6ae('0x31')]};});_0x2d28be['model']=_[_0xa6ae('0x2d')](_0x35b18f,_0xa6ae('0x2b'));_0x2d28be['query']=_['keys'](_0x496ff1[_0xa6ae('0x32')]);_0x2d28be['filters']=_[_0xa6ae('0x33')](_0x2d28be[_0xa6ae('0x34')],_0x2d28be[_0xa6ae('0x32')]);_0x2e2933['attributes']=_[_0xa6ae('0x33')](_0x2d28be[_0xa6ae('0x34')],qs[_0xa6ae('0x35')](_0x496ff1[_0xa6ae('0x32')][_0xa6ae('0x35')]));_0x2e2933[_0xa6ae('0x36')]=_0x2e2933[_0xa6ae('0x36')][_0xa6ae('0x37')]?_0x2e2933[_0xa6ae('0x36')]:_0x2d28be[_0xa6ae('0x34')];if(!_0x496ff1[_0xa6ae('0x32')][_0xa6ae('0x38')]('nolimit')){_0x2e2933[_0xa6ae('0x21')]=qs[_0xa6ae('0x21')](_0x496ff1[_0xa6ae('0x32')]['limit']);_0x2e2933['offset']=qs['offset'](_0x496ff1[_0xa6ae('0x32')]['offset']);}_0x2e2933[_0xa6ae('0x39')]=qs[_0xa6ae('0x3a')](_0x496ff1[_0xa6ae('0x32')][_0xa6ae('0x3a')]);_0x2e2933[_0xa6ae('0x3b')]=qs['filters'](_[_0xa6ae('0x3c')](_0x496ff1[_0xa6ae('0x32')],_0x2d28be[_0xa6ae('0x3d')]),_0x35b18f);if(_0x496ff1[_0xa6ae('0x32')][_0xa6ae('0x3e')]){_0x2e2933['where']=_[_0xa6ae('0x3f')](_0x2e2933['where'],{'$or':_[_0xa6ae('0x2d')](_0x35b18f,function(_0xca656f){if(_0xca656f[_0xa6ae('0x30')]!==_0xa6ae('0x40')){var _0x2dafa7={};_0x2dafa7[_0xca656f['name']]={'$like':'%'+_0x496ff1['query'][_0xa6ae('0x3e')]+'%'};return _0x2dafa7;}})});}_0x2e2933=_['merge']({},_0x2e2933,_0x496ff1[_0xa6ae('0x41')]);var _0xd785b0={'where':_0x2e2933[_0xa6ae('0x3b')]};return db['ZohoAccount'][_0xa6ae('0x23')](_0xd785b0)[_0xa6ae('0x29')](function(_0x2394e5){_0x26f685['count']=_0x2394e5;if(_0x496ff1[_0xa6ae('0x32')][_0xa6ae('0x42')]){_0x2e2933[_0xa6ae('0x43')]=[{'all':!![]}];}return db[_0xa6ae('0x44')][_0xa6ae('0x45')](_0x2e2933);})['then'](function(_0x58e36b){_0x26f685[_0xa6ae('0x46')]=_0x58e36b;return _0x26f685;})[_0xa6ae('0x29')](respondWithFilteredResult(_0x1c4353,_0x2e2933))[_0xa6ae('0x47')](handleError(_0x1c4353,null));};exports[_0xa6ae('0x48')]=function(_0x1a15e5,_0x43b6d5){var _0x193b66={'raw':![],'where':{'id':_0x1a15e5[_0xa6ae('0x49')]['id']}},_0x15403b={};_0x15403b[_0xa6ae('0x34')]=_['keys'](db[_0xa6ae('0x44')][_0xa6ae('0x2e')]);_0x15403b['query']=_[_0xa6ae('0x4a')](_0x1a15e5['query']);_0x15403b[_0xa6ae('0x3d')]=_[_0xa6ae('0x33')](_0x15403b[_0xa6ae('0x34')],_0x15403b['query']);_0x193b66['attributes']=_[_0xa6ae('0x33')](_0x15403b[_0xa6ae('0x34')],qs[_0xa6ae('0x35')](_0x1a15e5[_0xa6ae('0x32')][_0xa6ae('0x35')]));_0x193b66[_0xa6ae('0x36')]=_0x193b66[_0xa6ae('0x36')][_0xa6ae('0x37')]?_0x193b66[_0xa6ae('0x36')]:_0x15403b[_0xa6ae('0x34')];if(_0x1a15e5[_0xa6ae('0x32')][_0xa6ae('0x42')]){_0x193b66['include']=[{'all':!![]}];}_0x193b66=_[_0xa6ae('0x3f')]({},_0x193b66,_0x1a15e5[_0xa6ae('0x41')]);return db[_0xa6ae('0x44')]['find'](_0x193b66)[_0xa6ae('0x29')](handleEntityNotFound(_0x43b6d5,null))[_0xa6ae('0x29')](respondWithResult(_0x43b6d5,null))[_0xa6ae('0x47')](handleError(_0x43b6d5,null));};exports[_0xa6ae('0x4b')]=function(_0x42d6ee,_0x4b3da5){return db[_0xa6ae('0x44')][_0xa6ae('0x4b')](_0x42d6ee[_0xa6ae('0x4c')],{})[_0xa6ae('0x29')](respondWithResult(_0x4b3da5,0xc9))[_0xa6ae('0x47')](handleError(_0x4b3da5,null));};exports[_0xa6ae('0x27')]=function(_0x18aacf,_0x362948){if(_0x18aacf[_0xa6ae('0x4c')]['id']){delete _0x18aacf[_0xa6ae('0x4c')]['id'];}return db['ZohoAccount'][_0xa6ae('0x4d')]({'where':{'id':_0x18aacf['params']['id']}})[_0xa6ae('0x29')](handleEntityNotFound(_0x362948,null))[_0xa6ae('0x29')](saveUpdates(_0x18aacf[_0xa6ae('0x4c')],null))['then'](respondWithResult(_0x362948,null))['catch'](handleError(_0x362948,null));};exports['destroy']=function(_0x27670c,_0x1681c7){return db[_0xa6ae('0x44')][_0xa6ae('0x4d')]({'where':{'id':_0x27670c['params']['id']}})[_0xa6ae('0x29')](handleEntityNotFound(_0x1681c7,null))[_0xa6ae('0x29')](removeEntity(_0x1681c7,null))[_0xa6ae('0x47')](handleError(_0x1681c7,null));};exports['getConfigurations']=function(_0x110b8d,_0x84198a,_0x52d826){var _0x4f687d={};var _0x1f33ea={};var _0x57198d;var _0x44bb93;return db[_0xa6ae('0x44')][_0xa6ae('0x4e')]({'where':{'id':_0x110b8d[_0xa6ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x84198a,null))['then'](function(_0x556d30){if(_0x556d30){_0x57198d=_0x556d30;_0x1f33ea['model']=_['keys'](db[_0xa6ae('0x4f')][_0xa6ae('0x2e')]);_0x1f33ea[_0xa6ae('0x32')]=_[_0xa6ae('0x4a')](_0x110b8d[_0xa6ae('0x32')]);_0x1f33ea[_0xa6ae('0x3d')]=_[_0xa6ae('0x33')](_0x1f33ea[_0xa6ae('0x34')],_0x1f33ea[_0xa6ae('0x32')]);_0x4f687d[_0xa6ae('0x36')]=_[_0xa6ae('0x33')](_0x1f33ea[_0xa6ae('0x34')],qs[_0xa6ae('0x35')](_0x110b8d[_0xa6ae('0x32')][_0xa6ae('0x35')]));_0x4f687d[_0xa6ae('0x36')]=_0x4f687d[_0xa6ae('0x36')][_0xa6ae('0x37')]?_0x4f687d[_0xa6ae('0x36')]:_0x1f33ea[_0xa6ae('0x34')];_0x4f687d[_0xa6ae('0x39')]=qs[_0xa6ae('0x3a')](_0x110b8d[_0xa6ae('0x32')]['sort']);_0x4f687d[_0xa6ae('0x3b')]=qs[_0xa6ae('0x3d')](_['pick'](_0x110b8d[_0xa6ae('0x32')],_0x1f33ea[_0xa6ae('0x3d')]));if(_0x110b8d[_0xa6ae('0x32')]['filter']){_0x4f687d['where']=_[_0xa6ae('0x3f')](_0x4f687d[_0xa6ae('0x3b')],{'$or':_['map'](_0x4f687d['attributes'],function(_0x4f09f1){var _0xc683f5={};_0xc683f5[_0x4f09f1]={'$like':'%'+_0x110b8d[_0xa6ae('0x32')][_0xa6ae('0x3e')]+'%'};return _0xc683f5;})});}_0x4f687d=_[_0xa6ae('0x3f')]({},_0x4f687d,_0x110b8d[_0xa6ae('0x41')]);return _0x57198d[_0xa6ae('0x50')](_0x4f687d);}})[_0xa6ae('0x29')](function(_0x41292b){if(_0x41292b){_0x44bb93=_0x41292b[_0xa6ae('0x37')];if(!_0x110b8d['query'][_0xa6ae('0x38')](_0xa6ae('0x51'))){_0x4f687d[_0xa6ae('0x21')]=qs[_0xa6ae('0x21')](_0x110b8d[_0xa6ae('0x32')][_0xa6ae('0x21')]);_0x4f687d['offset']=qs[_0xa6ae('0x20')](_0x110b8d[_0xa6ae('0x32')]['offset']);}return _0x57198d['getConfigurations'](_0x4f687d);}})[_0xa6ae('0x29')](function(_0x2afccf){if(_0x2afccf){return _0x2afccf?{'count':_0x44bb93,'rows':_0x2afccf}:null;}})[_0xa6ae('0x29')](respondWithResult(_0x84198a,null))[_0xa6ae('0x47')](handleError(_0x84198a,null));};exports['addConfiguration']=function(_0xbb73c9,_0x284540,_0x559248){if(_0xbb73c9['body']['id']){delete _0xbb73c9[_0xa6ae('0x4c')]['id'];}return db[_0xa6ae('0x44')]['findOne']({'where':{'id':_0xbb73c9[_0xa6ae('0x49')]['id']}})[_0xa6ae('0x29')](handleEntityNotFound(_0x284540,null))['then'](function(_0x5deb22){if(_0x5deb22){_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x52')]=_0x5deb22['id'];_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x53')]=integrations[_0xa6ae('0x54')](_0xbb73c9[_0xa6ae('0x4c')]['channel'],_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x30')]);_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x55')]=integrations[_0xa6ae('0x56')](_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x57')],_0xbb73c9[_0xa6ae('0x4c')][_0xa6ae('0x30')]);return db[_0xa6ae('0x4f')][_0xa6ae('0x4b')](_0xbb73c9['body'],{'include':[{'model':db[_0xa6ae('0x58')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xa6ae('0x29')](respondWithResult(_0x284540,null))['catch'](handleError(_0x284540,null));};function getAccessToken(_0x32fdc3){return new Promise(function(_0x4f6113,_0x234056){var _0x423561;switch(_0x32fdc3['zone']){case'US':_0x423561=_0xa6ae('0x59');break;case'AU':_0x423561=_0xa6ae('0x5a');break;case'EU':_0x423561='https://accounts.zoho.eu';break;case'IN':_0x423561=_0xa6ae('0x5b');break;case'CN':_0x423561=_0xa6ae('0x5c');break;default:_0x423561=_0xa6ae('0x5d');break;}var _0x200867={'method':'POST','uri':_0x423561+_0xa6ae('0x5e'),'qs':{'refresh_token':_0x32fdc3[_0xa6ae('0x5f')],'client_id':_0x32fdc3[_0xa6ae('0x60')],'client_secret':_0x32fdc3[_0xa6ae('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x200867)['then'](function(_0x48bf1d){if(_0x48bf1d['access_token']){_0x4f6113(_0x48bf1d[_0xa6ae('0x62')]);}else{_0x234056(_0xa6ae('0x63'));}})[_0xa6ae('0x47')](function(_0x58b56c){_0x234056(_0x58b56c);});});}exports[_0xa6ae('0x64')]=function(_0x273f71,_0x4e4816,_0x5975c6){var _0x221707,_0x21a444,_0x4402b3,_0x51dc87,_0x54b84b;return db['ZohoAccount']['findOne']({'where':{'id':_0x273f71[_0xa6ae('0x49')]['id']},'attributes':['id','host',_0xa6ae('0x65'),'clientId',_0xa6ae('0x61'),'serverUrl',_0xa6ae('0x66'),_0xa6ae('0x5f')]})[_0xa6ae('0x29')](handleEntityNotFound(_0x4e4816,null))[_0xa6ae('0x29')](function(_0x421da6){_0x54b84b=_0x421da6;_0x221707=_0x54b84b['host'];_0x21a444=_0x221707===_0xa6ae('0x67')?'eu':_0xa6ae('0x68');_0x4402b3=_0x54b84b[_0xa6ae('0x69')];var _0x50c8fb=_0x4402b3[_0xa6ae('0x6a')](-0x1);if(_0x50c8fb==='/'||_0x50c8fb==='\x5c'||_0x50c8fb===':'){_0x4402b3=_0x4402b3[_0xa6ae('0x6b')](0x0,_0x4402b3[_0xa6ae('0x6c')](_0x50c8fb));}if(!_0x54b84b[_0xa6ae('0x5f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x54b84b);})['then'](function(_0xa4c5dd){if(_0xa4c5dd){return rp({'method':_0xa6ae('0x6d'),'uri':util['format'](_0xa6ae('0x6e'),_0x21a444),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa6ae('0x6f')+_0xa4c5dd},'json':!![]});}})['then'](function(_0x59640b){if(_0x59640b){if(_0x59640b[_0xa6ae('0x70')]&&_0x59640b['response'][_0xa6ae('0x2a')]){throw new Error(_0x59640b['response']['error']['message']);}var _0x2efe14=[];var _0x3d2d5a=[];var _0x3f6992=['Owner',_0xa6ae('0x71'),_0xa6ae('0x72'),_0xa6ae('0x73'),_0xa6ae('0x74'),_0xa6ae('0x75'),_0xa6ae('0x76'),_0xa6ae('0x77')];_0x3d2d5a=_[_0xa6ae('0x78')](_0x59640b[_0xa6ae('0x35')],function(_0x152614){return _0x3f6992[_0xa6ae('0x79')](_0x152614[_0xa6ae('0x7a')]);});for(var _0x1a7dcc=0x0;_0x1a7dcc<_0x3d2d5a[_0xa6ae('0x37')];_0x1a7dcc++){if(_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x7b')]===![]){_0x2efe14[_0xa6ae('0x7c')]({'id':_0x3d2d5a[_0x1a7dcc]['id'],'name':_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x7d')],'custom':_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x7e')],'options':_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x7f')]===_0xa6ae('0x80')&&_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x81')]['length']>-0x1?_[_0xa6ae('0x2d')](_0x3d2d5a[_0x1a7dcc][_0xa6ae('0x81')],function(_0x231b93){return{'name':_0x231b93,'value':_0x231b93};}):[]});}}return{'count':_0x2efe14[_0xa6ae('0x37')],'rows':_0x2efe14};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4e4816,null))[_0xa6ae('0x47')](function(_0x11530e){var _0x52460e=_0x273f71[_0xa6ae('0x32')][_0xa6ae('0x82')]?0x1f4:_0x11530e[_0xa6ae('0x83')]||0x1f4;logger[_0xa6ae('0x2a')](_0xa6ae('0x84'),_0xa6ae('0x64'),_0x52460e,JSON[_0xa6ae('0x85')](_0x11530e));delete _0x11530e[_0xa6ae('0x2b')];if(_0x52460e===0x191){_0x52460e=0x190;}_0x4e4816[_0xa6ae('0x1d')](_0x52460e)[_0xa6ae('0x86')](_0x273f71['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x11530e['statusCode']}:_0x11530e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 441b86b..5751f99 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 _0x11f3=['path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','POST','parse','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird'];(function(_0x470588,_0x5bba4e){var _0x392a26=function(_0x1de3dd){while(--_0x1de3dd){_0x470588['push'](_0x470588['shift']());}};_0x392a26(++_0x5bba4e);}(_0x11f3,0xf7));var _0x311f=function(_0x325dee,_0xb67e1f){_0x325dee=_0x325dee-0x0;var _0xc05924=_0x11f3[_0x325dee];return _0xc05924;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var logger=require(_0x311f('0x2'))(_0x311f('0x3'));var moment=require('moment');var BPromise=require(_0x311f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x311f('0x5'));var rimraf=require(_0x311f('0x6'));var config=require(_0x311f('0x7'));var attributes=require(_0x311f('0x8'));var integrations=require(_0x311f('0x9'));module[_0x311f('0xa')]=function(_0x3aa651,_0x22e80e){return _0x3aa651[_0x311f('0xb')](_0x311f('0xc'),attributes,{'tableName':_0x311f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26332a,_0x5c8fd7,_0x19e36c){if(_0x26332a[_0x311f('0xe')](_0x311f('0xf'))||_0x26332a[_0x311f('0xe')](_0x311f('0x10'))||_0x26332a['changed'](_0x311f('0x11'))||_0x26332a[_0x311f('0xe')](_0x311f('0x12'))||_0x26332a[_0x311f('0xe')]('code')||_0x26332a[_0x311f('0xe')](_0x311f('0x13'))){var _0x5a82eb,_0x361777;_0x5a82eb=_0x26332a['serverUrl'];var _0x50d414=_0x5a82eb[_0x311f('0x14')](-0x1);if(_0x50d414==='/'||_0x50d414==='\x5c'||_0x50d414===':'){_0x5a82eb=_0x5a82eb['substring'](0x0,_0x5a82eb[_0x311f('0x15')](_0x50d414));}switch(_0x26332a[_0x311f('0xf')]){case'US':_0x361777=_0x311f('0x16');break;case'AU':_0x361777='https://accounts.zoho.com.au';break;case'IN':_0x361777=_0x311f('0x17');break;case'CN':_0x361777=_0x311f('0x18');break;default:_0x361777=_0x311f('0x19');break;}var _0x398321={'method':'POST','uri':_0x361777+_0x311f('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x26332a[_0x311f('0x11')],'client_secret':_0x26332a['clientSecret'],'redirect_uri':_0x26332a[_0x311f('0x10')],'code':_0x26332a[_0x311f('0x1b')]},'headers':{'Content-Type':_0x311f('0x1c')}};return rp(_0x398321)[_0x311f('0x1d')](function(_0x539542){var _0x549e7e=JSON['parse'](_0x539542);if(_0x549e7e['refresh_token']){_0x26332a[_0x311f('0x1e')]=_0x549e7e[_0x311f('0x1f')];logger[_0x311f('0x20')](util[_0x311f('0x21')](_0x311f('0x22'),_0x26332a[_0x311f('0x23')],_0x26332a['id']));}else{logger[_0x311f('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26332a[_0x311f('0x23')],_0x26332a['id']),util[_0x311f('0x25')](_0x549e7e,{'showHidden':![],'depth':null}));}return _0x19e36c(null,_0x5c8fd7);})[_0x311f('0x26')](function(_0x5eacf7){logger[_0x311f('0x24')](util[_0x311f('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26332a['name'],_0x26332a['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x19e36c(_0x5eacf7);});}else{return _0x19e36c(null,_0x5c8fd7);}},'beforeUpdate':function(_0x1d8383,_0xcb1ff5,_0x4da15){if(_0x1d8383[_0x311f('0xe')](_0x311f('0xf'))||_0x1d8383['changed'](_0x311f('0x10'))||_0x1d8383[_0x311f('0xe')](_0x311f('0x11'))||_0x1d8383['changed'](_0x311f('0x12'))||_0x1d8383[_0x311f('0xe')]('code')||_0x1d8383[_0x311f('0xe')](_0x311f('0x13'))){var _0x4d4dd8,_0x1b9e94;_0x4d4dd8=_0x1d8383['serverUrl'];var _0x11047e=_0x4d4dd8[_0x311f('0x14')](-0x1);if(_0x11047e==='/'||_0x11047e==='\x5c'||_0x11047e===':'){_0x4d4dd8=_0x4d4dd8['substring'](0x0,_0x4d4dd8[_0x311f('0x15')](_0x11047e));}switch(_0x1d8383[_0x311f('0xf')]){case'US':_0x1b9e94=_0x311f('0x16');break;case'AU':_0x1b9e94='https://accounts.zoho.com.au';break;case'IN':_0x1b9e94=_0x311f('0x17');break;case'CN':_0x1b9e94=_0x311f('0x18');break;default:_0x1b9e94=_0x311f('0x19');break;}var _0x2d3a9c={'method':_0x311f('0x27'),'uri':_0x1b9e94+_0x311f('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x1d8383[_0x311f('0x11')],'client_secret':_0x1d8383['clientSecret'],'redirect_uri':_0x1d8383[_0x311f('0x10')],'code':_0x1d8383[_0x311f('0x1b')]},'headers':{'Content-Type':_0x311f('0x1c')}};return rp(_0x2d3a9c)[_0x311f('0x1d')](function(_0x1adec3){var _0x3740dc=JSON[_0x311f('0x28')](_0x1adec3);if(_0x3740dc[_0x311f('0x1f')]){_0x1d8383['refreshToken']=_0x3740dc[_0x311f('0x1f')];logger[_0x311f('0x20')](util[_0x311f('0x21')](_0x311f('0x22'),_0x1d8383[_0x311f('0x23')],_0x1d8383['id']));}else{logger['error'](util[_0x311f('0x21')](_0x311f('0x29'),_0x1d8383['name'],_0x1d8383['id']),util['inspect'](_0x3740dc,{'showHidden':![],'depth':null}));}return _0x4da15(null,_0xcb1ff5);})['catch'](function(_0x7ccd7f){logger[_0x311f('0x24')](util[_0x311f('0x21')](_0x311f('0x29'),_0x1d8383[_0x311f('0x23')],_0x1d8383['id']),util[_0x311f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4da15(_0x7ccd7f);});}else{return _0x4da15(null,_0xcb1ff5);}}}});}; \ No newline at end of file +var _0x209e=['clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.in','/oauth/v2/token','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0x209e,0x70));var _0xe209=function(_0x14b601,_0x31336d){_0x14b601=_0x14b601-0x0;var _0x1adacc=_0x209e[_0x14b601];return _0x1adacc;};'use strict';var _=require(_0xe209('0x0'));var util=require(_0xe209('0x1'));var logger=require(_0xe209('0x2'))(_0xe209('0x3'));var moment=require(_0xe209('0x4'));var BPromise=require('bluebird');var rp=require(_0xe209('0x5'));var fs=require('fs');var path=require(_0xe209('0x6'));var rimraf=require(_0xe209('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xe209('0x8'));module[_0xe209('0x9')]=function(_0xf51127,_0x46ef81){return _0xf51127[_0xe209('0xa')](_0xe209('0xb'),attributes,{'tableName':_0xe209('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24d7f2,_0x2391b0,_0x4a65f2){if(_0x24d7f2[_0xe209('0xd')](_0xe209('0xe'))||_0x24d7f2['changed'](_0xe209('0xf'))||_0x24d7f2[_0xe209('0xd')](_0xe209('0x10'))||_0x24d7f2[_0xe209('0xd')](_0xe209('0x11'))||_0x24d7f2['changed'](_0xe209('0x12'))||_0x24d7f2[_0xe209('0xd')](_0xe209('0x13'))){var _0x27c994,_0x575215;_0x27c994=_0x24d7f2[_0xe209('0xf')];var _0x5e4cf8=_0x27c994[_0xe209('0x14')](-0x1);if(_0x5e4cf8==='/'||_0x5e4cf8==='\x5c'||_0x5e4cf8===':'){_0x27c994=_0x27c994[_0xe209('0x15')](0x0,_0x27c994[_0xe209('0x16')](_0x5e4cf8));}switch(_0x24d7f2[_0xe209('0xe')]){case'US':_0x575215=_0xe209('0x17');break;case'AU':_0x575215=_0xe209('0x18');break;case'IN':_0x575215='https://accounts.zoho.in';break;case'CN':_0x575215=_0xe209('0x19');break;default:_0x575215=_0xe209('0x1a');break;}var _0x45a789={'method':_0xe209('0x1b'),'uri':_0x575215+'/oauth/v2/token','form':{'grant_type':_0xe209('0x1c'),'client_id':_0x24d7f2[_0xe209('0x10')],'client_secret':_0x24d7f2[_0xe209('0x11')],'redirect_uri':_0x24d7f2[_0xe209('0xf')],'code':_0x24d7f2[_0xe209('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x45a789)[_0xe209('0x1d')](function(_0x8e6536){var _0x386ac6=JSON[_0xe209('0x1e')](_0x8e6536);if(_0x386ac6[_0xe209('0x1f')]){_0x24d7f2[_0xe209('0x20')]=_0x386ac6[_0xe209('0x1f')];logger[_0xe209('0x21')](util['format'](_0xe209('0x22'),_0x24d7f2[_0xe209('0x23')],_0x24d7f2['id']));}else{logger[_0xe209('0x24')](util[_0xe209('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x24d7f2['name'],_0x24d7f2['id']),util[_0xe209('0x26')](_0x386ac6,{'showHidden':![],'depth':null}));}return _0x4a65f2(null,_0x2391b0);})[_0xe209('0x27')](function(_0x3ee198){logger[_0xe209('0x24')](util[_0xe209('0x25')](_0xe209('0x28'),_0x24d7f2['name'],_0x24d7f2['id']),util[_0xe209('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a65f2(_0x3ee198);});}else{return _0x4a65f2(null,_0x2391b0);}},'beforeUpdate':function(_0x6780ae,_0x35ed66,_0x173f4d){if(_0x6780ae['changed'](_0xe209('0xe'))||_0x6780ae[_0xe209('0xd')](_0xe209('0xf'))||_0x6780ae['changed']('clientId')||_0x6780ae['changed'](_0xe209('0x11'))||_0x6780ae[_0xe209('0xd')](_0xe209('0x12'))||_0x6780ae[_0xe209('0xd')]('host')){var _0x569765,_0x2a78a9;_0x569765=_0x6780ae[_0xe209('0xf')];var _0x4c8034=_0x569765[_0xe209('0x14')](-0x1);if(_0x4c8034==='/'||_0x4c8034==='\x5c'||_0x4c8034===':'){_0x569765=_0x569765[_0xe209('0x15')](0x0,_0x569765[_0xe209('0x16')](_0x4c8034));}switch(_0x6780ae[_0xe209('0xe')]){case'US':_0x2a78a9=_0xe209('0x17');break;case'AU':_0x2a78a9=_0xe209('0x18');break;case'IN':_0x2a78a9=_0xe209('0x29');break;case'CN':_0x2a78a9=_0xe209('0x19');break;default:_0x2a78a9=_0xe209('0x1a');break;}var _0x59e26d={'method':'POST','uri':_0x2a78a9+_0xe209('0x2a'),'form':{'grant_type':'authorization_code','client_id':_0x6780ae['clientId'],'client_secret':_0x6780ae[_0xe209('0x11')],'redirect_uri':_0x6780ae[_0xe209('0xf')],'code':_0x6780ae['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x59e26d)[_0xe209('0x1d')](function(_0x4c5905){var _0x14cb7f=JSON[_0xe209('0x1e')](_0x4c5905);if(_0x14cb7f[_0xe209('0x1f')]){_0x6780ae[_0xe209('0x20')]=_0x14cb7f[_0xe209('0x1f')];logger[_0xe209('0x21')](util[_0xe209('0x25')](_0xe209('0x22'),_0x6780ae[_0xe209('0x23')],_0x6780ae['id']));}else{logger[_0xe209('0x24')](util['format'](_0xe209('0x28'),_0x6780ae['name'],_0x6780ae['id']),util['inspect'](_0x14cb7f,{'showHidden':![],'depth':null}));}return _0x173f4d(null,_0x35ed66);})[_0xe209('0x27')](function(_0x356c73){logger[_0xe209('0x24')](util[_0xe209('0x25')](_0xe209('0x28'),_0x6780ae[_0xe209('0x23')],_0x6780ae['id']),util[_0xe209('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x173f4d(_0x356c73);});}else{return _0x173f4d(null,_0x35ed66);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 230ec18..3118598 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 _0xf4c9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','model','map','info','ShowZohoAccount','raw','lodash','util','moment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf4c9[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var moment=require(_0x9f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f4c('0x4'))['db'];var utils=require(_0x9f4c('0x5'));var logger=require(_0x9f4c('0x6'))('rpc');var config=require(_0x9f4c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf322,_0x498795,_0x12aeb7){return new BPromise(function(_0x398b30,_0x72c8ea){return client[_0x9f4c('0x9')](_0x5cf322,_0x12aeb7)[_0x9f4c('0xa')](function(_0x37b693){logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));logger[_0x9f4c('0xd')](_0x9f4c('0xe'),_0x498795,_0x9f4c('0xc'),JSON[_0x9f4c('0xf')](_0x37b693));if(_0x37b693[_0x9f4c('0x10')]){if(_0x37b693[_0x9f4c('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x72c8ea(_0x37b693['error'][_0x9f4c('0x11')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x398b30(_0x37b693['error'][_0x9f4c('0x11')]);}else{logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));_0x398b30(_0x37b693[_0x9f4c('0x12')][_0x9f4c('0x11')]);}})[_0x9f4c('0x13')](function(_0xb61bdf){logger['error'](_0x9f4c('0xb'),_0x498795,_0xb61bdf);_0x72c8ea(_0xb61bdf);});});}exports[_0x9f4c('0x14')]=function(_0x143335){var _0x30da19=this;return new Promise(function(_0x3f862c,_0x4fe832){return db[_0x9f4c('0x15')][_0x9f4c('0x16')]({'raw':_0x143335[_0x9f4c('0x17')]?_0x143335['options']['raw']===undefined?!![]:![]:!![],'where':_0x143335['options']?_0x143335['options'][_0x9f4c('0x18')]||null:null,'attributes':_0x143335['options']?_0x143335['options'][_0x9f4c('0x19')]||null:null,'limit':_0x143335[_0x9f4c('0x17')]?_0x143335['options'][_0x9f4c('0x1a')]||null:null,'include':_0x143335[_0x9f4c('0x17')]?_0x143335['options'][_0x9f4c('0x1b')]?_['map'](_0x143335['options'][_0x9f4c('0x1b')],function(_0x49d6d6){return{'model':db[_0x49d6d6[_0x9f4c('0x1c')]],'as':_0x49d6d6['as'],'attributes':_0x49d6d6[_0x9f4c('0x19')],'include':_0x49d6d6[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x49d6d6[_0x9f4c('0x1b')],function(_0x10c9a9){return{'model':db[_0x10c9a9['model']],'as':_0x10c9a9['as'],'attributes':_0x10c9a9[_0x9f4c('0x19')],'include':_0x10c9a9[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x10c9a9[_0x9f4c('0x1b')],function(_0x2c7b7e){return{'model':db[_0x2c7b7e[_0x9f4c('0x1c')]],'as':_0x2c7b7e['as'],'attributes':_0x2c7b7e[_0x9f4c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9f4c('0xa')](function(_0x3bcc3f){logger[_0x9f4c('0x1e')](_0x9f4c('0x14'),_0x143335);logger[_0x9f4c('0xd')](_0x9f4c('0x14'),_0x143335,JSON[_0x9f4c('0xf')](_0x3bcc3f));_0x3f862c(_0x3bcc3f);})[_0x9f4c('0x13')](function(_0x246599){logger[_0x9f4c('0x10')](_0x9f4c('0x14'),_0x246599[_0x9f4c('0x11')],_0x143335);_0x4fe832(_0x30da19[_0x9f4c('0x10')](0x1f4,_0x246599[_0x9f4c('0x11')]));});});};exports[_0x9f4c('0x1f')]=function(_0x4e9b77){var _0x4b6d91=this;return new Promise(function(_0x52ef31,_0x101c13){return db[_0x9f4c('0x15')]['find']({'raw':_0x4e9b77[_0x9f4c('0x17')]?_0x4e9b77[_0x9f4c('0x17')][_0x9f4c('0x20')]===undefined?!![]:![]:!![],'where':_0x4e9b77['options']?_0x4e9b77['options'][_0x9f4c('0x18')]||null:null,'attributes':_0x4e9b77[_0x9f4c('0x17')]?_0x4e9b77['options'][_0x9f4c('0x19')]||null:null,'include':_0x4e9b77['options']?_0x4e9b77['options'][_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x4e9b77[_0x9f4c('0x17')][_0x9f4c('0x1b')],function(_0x3bb4c4){return{'model':db[_0x3bb4c4[_0x9f4c('0x1c')]],'as':_0x3bb4c4['as'],'attributes':_0x3bb4c4['attributes'],'include':_0x3bb4c4[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x3bb4c4[_0x9f4c('0x1b')],function(_0x16c7da){return{'model':db[_0x16c7da[_0x9f4c('0x1c')]],'as':_0x16c7da['as'],'attributes':_0x16c7da[_0x9f4c('0x19')],'include':_0x16c7da[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x16c7da[_0x9f4c('0x1b')],function(_0x3b7d8e){return{'model':db[_0x3b7d8e[_0x9f4c('0x1c')]],'as':_0x3b7d8e['as'],'attributes':_0x3b7d8e[_0x9f4c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9f4c('0xa')](function(_0x54309a){logger[_0x9f4c('0x1e')]('ShowZohoAccount',_0x4e9b77);logger[_0x9f4c('0xd')](_0x9f4c('0x1f'),_0x4e9b77,JSON[_0x9f4c('0xf')](_0x54309a));_0x52ef31(_0x54309a);})[_0x9f4c('0x13')](function(_0x33639a){logger[_0x9f4c('0x10')](_0x9f4c('0x1f'),_0x33639a[_0x9f4c('0x11')],_0x4e9b77);_0x101c13(_0x4b6d91[_0x9f4c('0x10')](0x1f4,_0x33639a[_0x9f4c('0x11')]));});});}; \ No newline at end of file +var _0xa329=['then','ShowZohoAccount','ZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','findAll','options','raw','where','limit','include','model','map','attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa329,0x162));var _0x9a32=function(_0x5e3ac2,_0x225614){_0x5e3ac2=_0x5e3ac2-0x0;var _0x29a007=_0xa329[_0x5e3ac2];return _0x29a007;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var moment=require('moment');var BPromise=require(_0x9a32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a32('0x3'));var db=require(_0x9a32('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a32('0x5'));var config=require(_0x9a32('0x6'));var jayson=require(_0x9a32('0x7'));var client=jayson[_0x9a32('0x8')][_0x9a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235b92,_0x4a8fba,_0x5b8b5e){return new BPromise(function(_0x4dc7f8,_0x344b35){return client[_0x9a32('0xa')](_0x235b92,_0x5b8b5e)['then'](function(_0x38f6cc){logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));logger[_0x9a32('0xe')](_0x9a32('0xf'),_0x4a8fba,'request\x20sent',JSON[_0x9a32('0x10')](_0x38f6cc));if(_0x38f6cc[_0x9a32('0x11')]){if(_0x38f6cc['error']['code']===0x1f4){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error']['message']);return _0x344b35(_0x38f6cc[_0x9a32('0x11')][_0x9a32('0x12')]);}logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error'][_0x9a32('0x12')]);return _0x4dc7f8(_0x38f6cc[_0x9a32('0x11')]['message']);}else{logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));_0x4dc7f8(_0x38f6cc[_0x9a32('0x13')][_0x9a32('0x12')]);}})[_0x9a32('0x14')](function(_0x4fa645){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x4fa645);_0x344b35(_0x4fa645);});});}exports[_0x9a32('0x15')]=function(_0x4cfd70){var _0x3606ab=this;return new Promise(function(_0x1448da,_0x49f517){return db['ZohoAccount'][_0x9a32('0x16')]({'raw':_0x4cfd70[_0x9a32('0x17')]?_0x4cfd70[_0x9a32('0x17')][_0x9a32('0x18')]===undefined?!![]:![]:!![],'where':_0x4cfd70[_0x9a32('0x17')]?_0x4cfd70['options'][_0x9a32('0x19')]||null:null,'attributes':_0x4cfd70[_0x9a32('0x17')]?_0x4cfd70[_0x9a32('0x17')]['attributes']||null:null,'limit':_0x4cfd70[_0x9a32('0x17')]?_0x4cfd70[_0x9a32('0x17')][_0x9a32('0x1a')]||null:null,'include':_0x4cfd70[_0x9a32('0x17')]?_0x4cfd70[_0x9a32('0x17')][_0x9a32('0x1b')]?_['map'](_0x4cfd70['options'][_0x9a32('0x1b')],function(_0x2cb1ff){return{'model':db[_0x2cb1ff[_0x9a32('0x1c')]],'as':_0x2cb1ff['as'],'attributes':_0x2cb1ff['attributes'],'include':_0x2cb1ff['include']?_[_0x9a32('0x1d')](_0x2cb1ff[_0x9a32('0x1b')],function(_0x301dac){return{'model':db[_0x301dac['model']],'as':_0x301dac['as'],'attributes':_0x301dac['attributes'],'include':_0x301dac['include']?_[_0x9a32('0x1d')](_0x301dac['include'],function(_0x527159){return{'model':db[_0x527159['model']],'as':_0x527159['as'],'attributes':_0x527159[_0x9a32('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a32('0x1f')](function(_0x10edcf){logger[_0x9a32('0xb')](_0x9a32('0x15'),_0x4cfd70);logger[_0x9a32('0xe')](_0x9a32('0x15'),_0x4cfd70,JSON[_0x9a32('0x10')](_0x10edcf));_0x1448da(_0x10edcf);})[_0x9a32('0x14')](function(_0x35c1be){logger[_0x9a32('0x11')]('GetZohoAccount',_0x35c1be[_0x9a32('0x12')],_0x4cfd70);_0x49f517(_0x3606ab[_0x9a32('0x11')](0x1f4,_0x35c1be['message']));});});};exports[_0x9a32('0x20')]=function(_0x48674a){var _0x18a7b3=this;return new Promise(function(_0x227dbc,_0x416ba3){return db[_0x9a32('0x21')][_0x9a32('0x22')]({'raw':_0x48674a['options']?_0x48674a[_0x9a32('0x17')][_0x9a32('0x18')]===undefined?!![]:![]:!![],'where':_0x48674a[_0x9a32('0x17')]?_0x48674a[_0x9a32('0x17')][_0x9a32('0x19')]||null:null,'attributes':_0x48674a[_0x9a32('0x17')]?_0x48674a['options'][_0x9a32('0x1e')]||null:null,'include':_0x48674a[_0x9a32('0x17')]?_0x48674a[_0x9a32('0x17')][_0x9a32('0x1b')]?_[_0x9a32('0x1d')](_0x48674a['options'][_0x9a32('0x1b')],function(_0x4d113c){return{'model':db[_0x4d113c[_0x9a32('0x1c')]],'as':_0x4d113c['as'],'attributes':_0x4d113c['attributes'],'include':_0x4d113c['include']?_['map'](_0x4d113c['include'],function(_0x37f0f6){return{'model':db[_0x37f0f6[_0x9a32('0x1c')]],'as':_0x37f0f6['as'],'attributes':_0x37f0f6['attributes'],'include':_0x37f0f6[_0x9a32('0x1b')]?_[_0x9a32('0x1d')](_0x37f0f6[_0x9a32('0x1b')],function(_0x20cad1){return{'model':db[_0x20cad1[_0x9a32('0x1c')]],'as':_0x20cad1['as'],'attributes':_0x20cad1['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a32('0x1f')](function(_0x319985){logger[_0x9a32('0xb')](_0x9a32('0x20'),_0x48674a);logger[_0x9a32('0xe')](_0x9a32('0x20'),_0x48674a,JSON[_0x9a32('0x10')](_0x319985));_0x227dbc(_0x319985);})[_0x9a32('0x14')](function(_0x15d70f){logger['error'](_0x9a32('0x20'),_0x15d70f['message'],_0x48674a);_0x416ba3(_0x18a7b3[_0x9a32('0x11')](0x1f4,_0x15d70f[_0x9a32('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c09f629..839e08b 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 _0x6a2d=['isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x6a2d,0x1ef));var _0xd6a2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6a2d[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xd6a2('0x0'));var util=require(_0xd6a2('0x1'));var path=require(_0xd6a2('0x2'));var timeout=require(_0xd6a2('0x3'));var express=require(_0xd6a2('0x4'));var router=express[_0xd6a2('0x5')]();var fs_extra=require(_0xd6a2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd6a2('0x7'));var config=require(_0xd6a2('0x8'));var controller=require(_0xd6a2('0x9'));router[_0xd6a2('0xa')]('/',auth[_0xd6a2('0xb')](),controller[_0xd6a2('0xc')]);router[_0xd6a2('0xa')](_0xd6a2('0xd'),auth[_0xd6a2('0xb')](),controller['show']);router[_0xd6a2('0xa')](_0xd6a2('0xe'),auth[_0xd6a2('0xb')](),controller['getFields']);router[_0xd6a2('0xa')](_0xd6a2('0xf'),auth[_0xd6a2('0xb')](),controller['getSubjects']);router[_0xd6a2('0xa')](_0xd6a2('0x10'),auth[_0xd6a2('0xb')](),controller[_0xd6a2('0x11')]);router[_0xd6a2('0x12')]('/',auth[_0xd6a2('0xb')](),controller[_0xd6a2('0x13')]);router['put'](_0xd6a2('0xd'),auth[_0xd6a2('0xb')](),controller['update']);router[_0xd6a2('0x14')](_0xd6a2('0xd'),auth['isAuthenticated'](),controller[_0xd6a2('0x15')]);module[_0xd6a2('0x16')]=router; \ No newline at end of file +var _0xb522=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id'];(function(_0xf71cea,_0x50189b){var _0xf036ae=function(_0x450877){while(--_0x450877){_0xf71cea['push'](_0xf71cea['shift']());}};_0xf036ae(++_0x50189b);}(_0xb522,0xf2));var _0x2b52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb522[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var path=require('path');var timeout=require(_0x2b52('0x2'));var express=require('express');var router=express[_0x2b52('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2b52('0x4'));var config=require(_0x2b52('0x5'));var controller=require(_0x2b52('0x6'));router[_0x2b52('0x7')]('/',auth['isAuthenticated'](),controller[_0x2b52('0x8')]);router[_0x2b52('0x7')](_0x2b52('0x9'),auth[_0x2b52('0xa')](),controller['show']);router['get'](_0x2b52('0xb'),auth['isAuthenticated'](),controller[_0x2b52('0xc')]);router['get'](_0x2b52('0xd'),auth[_0x2b52('0xa')](),controller[_0x2b52('0xe')]);router[_0x2b52('0x7')]('/:id/descriptions',auth[_0x2b52('0xa')](),controller[_0x2b52('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2b52('0x10')]);router['put']('/:id',auth[_0x2b52('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2b52('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2d99426..68b0d54 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 _0x5533=['contact_lead','sequelize','exports','STRING','lead','contact','nothing','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5533,0xf9));var _0x3553=function(_0x1375fb,_0x49032d){_0x1375fb=_0x1375fb-0x0;var _0x3e9855=_0x5533[_0x1375fb];return _0x3e9855;};'use strict';var Sequelize=require(_0x3553('0x0'));module[_0x3553('0x1')]={'name':{'type':Sequelize[_0x3553('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x3553('0x3'),_0x3553('0x4'),_0x3553('0x5')),'defaultValue':_0x3553('0x3')},'moduleSearch':{'type':Sequelize[_0x3553('0x6')](_0x3553('0x7'),_0x3553('0x4'),'lead'),'defaultValue':_0x3553('0x7')},'description':{'type':Sequelize[_0x3553('0x2')]}}; \ No newline at end of file +var _0xf29c=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x2ce1c4,_0x2b3579){var _0x424785=function(_0x204d83){while(--_0x204d83){_0x2ce1c4['push'](_0x2ce1c4['shift']());}};_0x424785(++_0x2b3579);}(_0xf29c,0xc7));var _0xcf29=function(_0x3bbc1e,_0x4add81){_0x3bbc1e=_0x3bbc1e-0x0;var _0x514bab=_0xf29c[_0x3bbc1e];return _0x514bab;};'use strict';var Sequelize=require('sequelize');module[_0xcf29('0x0')]={'name':{'type':Sequelize[_0xcf29('0x1')]},'moduleCreate':{'type':Sequelize[_0xcf29('0x2')](_0xcf29('0x3'),_0xcf29('0x4'),_0xcf29('0x5')),'defaultValue':_0xcf29('0x3')},'moduleSearch':{'type':Sequelize[_0xcf29('0x2')](_0xcf29('0x6'),_0xcf29('0x4'),_0xcf29('0x3')),'defaultValue':_0xcf29('0x6')},'description':{'type':Sequelize[_0xcf29('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0ae80d8..cb12940 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 _0xea19=['type','key','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ZohoField','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','destroy','stack','name','send','map','ZohoConfiguration','fieldName'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xea19,0x160));var _0x9ea1=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xea19[_0x2f9467];return _0x39894c;};'use strict';var emlformat=require(_0x9ea1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ea1('0x1'));var jsonpatch=require(_0x9ea1('0x2'));var rp=require(_0x9ea1('0x3'));var moment=require(_0x9ea1('0x4'));var BPromise=require(_0x9ea1('0x5'));var Mustache=require(_0x9ea1('0x6'));var util=require(_0x9ea1('0x7'));var path=require('path');var sox=require(_0x9ea1('0x8'));var csv=require(_0x9ea1('0x9'));var ejs=require(_0x9ea1('0xa'));var fs=require('fs');var fs_extra=require(_0x9ea1('0xb'));var _=require(_0x9ea1('0xc'));var squel=require(_0x9ea1('0xd'));var crypto=require(_0x9ea1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9ea1('0x9'));var querystring=require(_0x9ea1('0xf'));var Papa=require('papaparse');var Redis=require(_0x9ea1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9ea1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ea1('0x12'))(_0x9ea1('0x13'));var utils=require(_0x9ea1('0x14'));var config=require(_0x9ea1('0x15'));var licenseUtil=require(_0x9ea1('0x16'));var db=require(_0x9ea1('0x17'))['db'];function respondWithStatusCode(_0x3b24ce,_0x571cc8){_0x571cc8=_0x571cc8||0xcc;return function(_0x429af2){if(_0x429af2){return _0x3b24ce[_0x9ea1('0x18')](_0x571cc8);}return _0x3b24ce['status'](_0x571cc8)[_0x9ea1('0x19')]();};}function respondWithResult(_0x3f20c3,_0x1d137e){_0x1d137e=_0x1d137e||0xc8;return function(_0x479510){if(_0x479510){return _0x3f20c3['status'](_0x1d137e)[_0x9ea1('0x1a')](_0x479510);}};}function respondWithFilteredResult(_0x178ab1,_0x3644f6){return function(_0x101225){if(_0x101225){var _0x20dd14=typeof _0x3644f6[_0x9ea1('0x1b')]===_0x9ea1('0x1c')&&typeof _0x3644f6[_0x9ea1('0x1d')]===_0x9ea1('0x1c');var _0x1e201a=_0x101225[_0x9ea1('0x1e')];var _0x340b85=_0x20dd14?0x0:_0x3644f6[_0x9ea1('0x1b')];var _0x5c1591=_0x20dd14?_0x101225[_0x9ea1('0x1e')]:_0x3644f6[_0x9ea1('0x1b')]+_0x3644f6[_0x9ea1('0x1d')];var _0x2a9193;if(_0x5c1591>=_0x1e201a){_0x5c1591=_0x1e201a;_0x2a9193=0xc8;}else{_0x2a9193=0xce;}_0x178ab1[_0x9ea1('0x1f')](_0x2a9193);return _0x178ab1[_0x9ea1('0x20')](_0x9ea1('0x21'),_0x340b85+'-'+_0x5c1591+'/'+_0x1e201a)[_0x9ea1('0x1a')](_0x101225);}return null;};}function patchUpdates(_0x169ad5){return function(_0x315998){try{jsonpatch['apply'](_0x315998,_0x169ad5,!![]);}catch(_0x2980da){return BPromise['reject'](_0x2980da);}return _0x315998[_0x9ea1('0x22')]();};}function saveUpdates(_0x15d77f,_0x2d7e22){return function(_0x14bea1){if(_0x14bea1){return _0x14bea1[_0x9ea1('0x23')](_0x15d77f)['then'](function(_0x4e0f79){return _0x4e0f79;});}return null;};}function removeEntity(_0x10ba5c,_0x94c72a){return function(_0x1831ca){if(_0x1831ca){return _0x1831ca[_0x9ea1('0x24')]()['then'](function(){_0x10ba5c[_0x9ea1('0x1f')](0xcc)[_0x9ea1('0x19')]();});}};}function handleEntityNotFound(_0x234639,_0x379095){return function(_0x24c015){if(!_0x24c015){_0x234639[_0x9ea1('0x18')](0x194);}return _0x24c015;};}function handleError(_0x1fc0d4,_0x474b7e){_0x474b7e=_0x474b7e||0x1f4;return function(_0x8272d9){logger['error'](_0x8272d9[_0x9ea1('0x25')]);if(_0x8272d9['name']){delete _0x8272d9[_0x9ea1('0x26')];}_0x1fc0d4['status'](_0x474b7e)[_0x9ea1('0x27')](_0x8272d9);};}exports['index']=function(_0x525822,_0x291213){var _0x589246={},_0x47f197={},_0x5620ab={'count':0x0,'rows':[]};var _0x465483=_[_0x9ea1('0x28')](db[_0x9ea1('0x29')]['rawAttributes'],function(_0x4727ca){return{'name':_0x4727ca[_0x9ea1('0x2a')],'type':_0x4727ca[_0x9ea1('0x2b')][_0x9ea1('0x2c')]};});_0x47f197['model']=_[_0x9ea1('0x28')](_0x465483,_0x9ea1('0x26'));_0x47f197['query']=_[_0x9ea1('0x2d')](_0x525822['query']);_0x47f197[_0x9ea1('0x2e')]=_['intersection'](_0x47f197[_0x9ea1('0x2f')],_0x47f197[_0x9ea1('0x30')]);_0x589246['attributes']=_[_0x9ea1('0x31')](_0x47f197[_0x9ea1('0x2f')],qs[_0x9ea1('0x32')](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x32')]));_0x589246[_0x9ea1('0x33')]=_0x589246['attributes'][_0x9ea1('0x34')]?_0x589246['attributes']:_0x47f197[_0x9ea1('0x2f')];if(!_0x525822[_0x9ea1('0x30')][_0x9ea1('0x35')](_0x9ea1('0x36'))){_0x589246['limit']=qs['limit'](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x1d')]);_0x589246['offset']=qs[_0x9ea1('0x1b')](_0x525822[_0x9ea1('0x30')]['offset']);}_0x589246['order']=qs['sort'](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x589246[_0x9ea1('0x38')]=qs[_0x9ea1('0x2e')](_[_0x9ea1('0x39')](_0x525822['query'],_0x47f197[_0x9ea1('0x2e')]),_0x465483);if(_0x525822['query'][_0x9ea1('0x3a')]){_0x589246[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x589246[_0x9ea1('0x38')],{'$or':_['map'](_0x465483,function(_0x1d6a29){if(_0x1d6a29[_0x9ea1('0x2b')]!=='VIRTUAL'){var _0x3bf6d6={};_0x3bf6d6[_0x1d6a29[_0x9ea1('0x26')]]={'$like':'%'+_0x525822['query']['filter']+'%'};return _0x3bf6d6;}})});}_0x589246=_[_0x9ea1('0x3b')]({},_0x589246,_0x525822[_0x9ea1('0x3c')]);var _0x2e7204={'where':_0x589246[_0x9ea1('0x38')]};return db['ZohoConfiguration'][_0x9ea1('0x1e')](_0x2e7204)[_0x9ea1('0x3d')](function(_0x4ceb01){_0x5620ab['count']=_0x4ceb01;if(_0x525822[_0x9ea1('0x30')][_0x9ea1('0x3e')]){_0x589246[_0x9ea1('0x3f')]=[{'all':!![]}];}return db[_0x9ea1('0x29')][_0x9ea1('0x40')](_0x589246);})[_0x9ea1('0x3d')](function(_0x1332a8){_0x5620ab[_0x9ea1('0x41')]=_0x1332a8;return _0x5620ab;})[_0x9ea1('0x3d')](respondWithFilteredResult(_0x291213,_0x589246))[_0x9ea1('0x42')](handleError(_0x291213,null));};exports[_0x9ea1('0x43')]=function(_0x575019,_0x227d80){var _0x19670e={'raw':![],'where':{'id':_0x575019[_0x9ea1('0x44')]['id']}},_0x5db11e={};_0x5db11e[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db['ZohoConfiguration'][_0x9ea1('0x45')]);_0x5db11e[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x575019[_0x9ea1('0x30')]);_0x5db11e[_0x9ea1('0x2e')]=_['intersection'](_0x5db11e['model'],_0x5db11e[_0x9ea1('0x30')]);_0x19670e['attributes']=_[_0x9ea1('0x31')](_0x5db11e[_0x9ea1('0x2f')],qs['fields'](_0x575019[_0x9ea1('0x30')]['fields']));_0x19670e[_0x9ea1('0x33')]=_0x19670e[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x19670e['attributes']:_0x5db11e['model'];if(_0x575019[_0x9ea1('0x30')][_0x9ea1('0x3e')]){_0x19670e[_0x9ea1('0x3f')]=[{'all':!![]}];}_0x19670e=_[_0x9ea1('0x3b')]({},_0x19670e,_0x575019['options']);return db['ZohoConfiguration'][_0x9ea1('0x46')](_0x19670e)[_0x9ea1('0x3d')](handleEntityNotFound(_0x227d80,null))[_0x9ea1('0x3d')](respondWithResult(_0x227d80,null))['catch'](handleError(_0x227d80,null));};exports[_0x9ea1('0x47')]=function(_0x3616f9,_0x18cc93){return db[_0x9ea1('0x29')][_0x9ea1('0x47')](_0x3616f9[_0x9ea1('0x48')],{})[_0x9ea1('0x3d')](respondWithResult(_0x18cc93,0xc9))[_0x9ea1('0x42')](handleError(_0x18cc93,null));};exports[_0x9ea1('0x23')]=function(_0xbe7cc1,_0x17a9a7){if(_0xbe7cc1['body']['id']){delete _0xbe7cc1[_0x9ea1('0x48')]['id'];}return db[_0x9ea1('0x29')]['find']({'where':{'id':_0xbe7cc1[_0x9ea1('0x44')]['id']}})['then'](handleEntityNotFound(_0x17a9a7,null))[_0x9ea1('0x3d')](saveUpdates(_0xbe7cc1[_0x9ea1('0x48')],null))['then'](respondWithResult(_0x17a9a7,null))[_0x9ea1('0x42')](handleError(_0x17a9a7,null));};exports[_0x9ea1('0x24')]=function(_0x23332f,_0x51b9bb){return db[_0x9ea1('0x29')]['find']({'where':{'id':_0x23332f[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x51b9bb,null))[_0x9ea1('0x3d')](removeEntity(_0x51b9bb,null))[_0x9ea1('0x42')](handleError(_0x51b9bb,null));};exports[_0x9ea1('0x49')]=function(_0x4dcf54,_0x56299f,_0xa1eee6){var _0x42435c={};var _0x3d1161={};var _0x16aed4;var _0x90d10e;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x4dcf54[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x56299f,null))['then'](function(_0x4f47b6){if(_0x4f47b6){_0x16aed4=_0x4f47b6;_0x3d1161[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db['ZohoField']['rawAttributes']);_0x3d1161[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x4dcf54[_0x9ea1('0x30')]);_0x3d1161[_0x9ea1('0x2e')]=_[_0x9ea1('0x31')](_0x3d1161[_0x9ea1('0x2f')],_0x3d1161[_0x9ea1('0x30')]);_0x42435c[_0x9ea1('0x33')]=_[_0x9ea1('0x31')](_0x3d1161[_0x9ea1('0x2f')],qs[_0x9ea1('0x32')](_0x4dcf54[_0x9ea1('0x30')]['fields']));_0x42435c[_0x9ea1('0x33')]=_0x42435c[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x42435c[_0x9ea1('0x33')]:_0x3d1161[_0x9ea1('0x2f')];_0x42435c['order']=qs[_0x9ea1('0x37')](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x42435c[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x4dcf54['query'],_0x3d1161[_0x9ea1('0x2e')]));if(_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x3a')]){_0x42435c[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x42435c[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x42435c['attributes'],function(_0x22ad2d){var _0x55ac68={};_0x55ac68[_0x22ad2d]={'$like':'%'+_0x4dcf54[_0x9ea1('0x30')]['filter']+'%'};return _0x55ac68;})});}_0x42435c=_[_0x9ea1('0x3b')]({},_0x42435c,_0x4dcf54[_0x9ea1('0x3c')]);return _0x16aed4['getFields'](_0x42435c);}})[_0x9ea1('0x3d')](function(_0x33bcb7){if(_0x33bcb7){_0x90d10e=_0x33bcb7[_0x9ea1('0x34')];if(!_0x4dcf54[_0x9ea1('0x30')]['hasOwnProperty'](_0x9ea1('0x36'))){_0x42435c['limit']=qs['limit'](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x1d')]);_0x42435c[_0x9ea1('0x1b')]=qs[_0x9ea1('0x1b')](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x16aed4[_0x9ea1('0x49')](_0x42435c);}})[_0x9ea1('0x3d')](function(_0x2da617){if(_0x2da617){return _0x2da617?{'count':_0x90d10e,'rows':_0x2da617}:null;}})[_0x9ea1('0x3d')](respondWithResult(_0x56299f,null))[_0x9ea1('0x42')](handleError(_0x56299f,null));};exports[_0x9ea1('0x4b')]=function(_0x5292bc,_0x1c30d2,_0x4cae60){var _0x284e30={};var _0x57dd48={};var _0x4b5c1b;var _0x5e4722;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x5292bc['params']['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x1c30d2,null))['then'](function(_0x56fc40){if(_0x56fc40){_0x4b5c1b=_0x56fc40;_0x57dd48[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db[_0x9ea1('0x4c')][_0x9ea1('0x45')]);_0x57dd48[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x5292bc[_0x9ea1('0x30')]);_0x57dd48[_0x9ea1('0x2e')]=_[_0x9ea1('0x31')](_0x57dd48[_0x9ea1('0x2f')],_0x57dd48[_0x9ea1('0x30')]);_0x284e30[_0x9ea1('0x33')]=_['intersection'](_0x57dd48[_0x9ea1('0x2f')],qs['fields'](_0x5292bc['query'][_0x9ea1('0x32')]));_0x284e30[_0x9ea1('0x33')]=_0x284e30['attributes'][_0x9ea1('0x34')]?_0x284e30['attributes']:_0x57dd48[_0x9ea1('0x2f')];_0x284e30[_0x9ea1('0x4d')]=qs[_0x9ea1('0x37')](_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x284e30[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x5292bc[_0x9ea1('0x30')],_0x57dd48[_0x9ea1('0x2e')]));if(_0x5292bc['query']['filter']){_0x284e30[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x284e30[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x284e30[_0x9ea1('0x33')],function(_0x465f2e){var _0x824e45={};_0x824e45[_0x465f2e]={'$like':'%'+_0x5292bc[_0x9ea1('0x30')]['filter']+'%'};return _0x824e45;})});}_0x284e30=_[_0x9ea1('0x3b')]({},_0x284e30,_0x5292bc[_0x9ea1('0x3c')]);return _0x4b5c1b[_0x9ea1('0x4b')](_0x284e30);}})[_0x9ea1('0x3d')](function(_0x526a67){if(_0x526a67){_0x5e4722=_0x526a67['length'];if(!_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x35')](_0x9ea1('0x36'))){_0x284e30[_0x9ea1('0x1d')]=qs[_0x9ea1('0x1d')](_0x5292bc[_0x9ea1('0x30')]['limit']);_0x284e30[_0x9ea1('0x1b')]=qs['offset'](_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x4b5c1b[_0x9ea1('0x4b')](_0x284e30);}})[_0x9ea1('0x3d')](function(_0x5eff54){if(_0x5eff54){return _0x5eff54?{'count':_0x5e4722,'rows':_0x5eff54}:null;}})['then'](respondWithResult(_0x1c30d2,null))[_0x9ea1('0x42')](handleError(_0x1c30d2,null));};exports[_0x9ea1('0x4e')]=function(_0x3a086c,_0x4c9d4c,_0x2df3f5){var _0x33cd44={};var _0x29fb0b={};var _0x273de4;var _0x229ba2;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x3a086c[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x4c9d4c,null))[_0x9ea1('0x3d')](function(_0x545580){if(_0x545580){_0x273de4=_0x545580;_0x29fb0b['model']=_[_0x9ea1('0x2d')](db[_0x9ea1('0x4c')]['rawAttributes']);_0x29fb0b[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x3a086c[_0x9ea1('0x30')]);_0x29fb0b[_0x9ea1('0x2e')]=_['intersection'](_0x29fb0b[_0x9ea1('0x2f')],_0x29fb0b[_0x9ea1('0x30')]);_0x33cd44['attributes']=_['intersection'](_0x29fb0b['model'],qs['fields'](_0x3a086c['query'][_0x9ea1('0x32')]));_0x33cd44['attributes']=_0x33cd44[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x33cd44[_0x9ea1('0x33')]:_0x29fb0b[_0x9ea1('0x2f')];_0x33cd44[_0x9ea1('0x4d')]=qs[_0x9ea1('0x37')](_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x33cd44[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x3a086c[_0x9ea1('0x30')],_0x29fb0b['filters']));if(_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x3a')]){_0x33cd44[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x33cd44[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x33cd44[_0x9ea1('0x33')],function(_0x34a53b){var _0x2d7b45={};_0x2d7b45[_0x34a53b]={'$like':'%'+_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x3a')]+'%'};return _0x2d7b45;})});}_0x33cd44=_[_0x9ea1('0x3b')]({},_0x33cd44,_0x3a086c['options']);return _0x273de4['getDescriptions'](_0x33cd44);}})[_0x9ea1('0x3d')](function(_0x5d871f){if(_0x5d871f){_0x229ba2=_0x5d871f[_0x9ea1('0x34')];if(!_0x3a086c['query']['hasOwnProperty']('nolimit')){_0x33cd44['limit']=qs[_0x9ea1('0x1d')](_0x3a086c[_0x9ea1('0x30')]['limit']);_0x33cd44[_0x9ea1('0x1b')]=qs[_0x9ea1('0x1b')](_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x273de4['getDescriptions'](_0x33cd44);}})[_0x9ea1('0x3d')](function(_0xf90cb9){if(_0xf90cb9){return _0xf90cb9?{'count':_0x229ba2,'rows':_0xf90cb9}:null;}})[_0x9ea1('0x3d')](respondWithResult(_0x4c9d4c,null))[_0x9ea1('0x42')](handleError(_0x4c9d4c,null));}; \ No newline at end of file +var _0xc7ee=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','find','catch','create','body','destroy','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','model','map','keys','filters','query','attributes','fields','length'];(function(_0x238bce,_0x1fa37a){var _0x127fc9=function(_0x5dbfbb){while(--_0x5dbfbb){_0x238bce['push'](_0x238bce['shift']());}};_0x127fc9(++_0x1fa37a);}(_0xc7ee,0xc3));var _0xec7e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc7ee[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xec7e('0x0'));var rimraf=require(_0xec7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec7e('0x2'));var rp=require(_0xec7e('0x3'));var moment=require(_0xec7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xec7e('0x5'));var util=require(_0xec7e('0x6'));var path=require(_0xec7e('0x7'));var sox=require(_0xec7e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec7e('0x9'));var _=require(_0xec7e('0xa'));var squel=require(_0xec7e('0xb'));var crypto=require(_0xec7e('0xc'));var jsforce=require(_0xec7e('0xd'));var deskjs=require(_0xec7e('0xe'));var toCsv=require(_0xec7e('0xf'));var querystring=require(_0xec7e('0x10'));var Papa=require(_0xec7e('0x11'));var Redis=require(_0xec7e('0x12'));var authService=require(_0xec7e('0x13'));var qs=require(_0xec7e('0x14'));var as=require(_0xec7e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec7e('0x16'))(_0xec7e('0x17'));var utils=require('../../config/utils');var config=require(_0xec7e('0x18'));var licenseUtil=require(_0xec7e('0x19'));var db=require(_0xec7e('0x1a'))['db'];function respondWithStatusCode(_0xdbca36,_0x570db5){_0x570db5=_0x570db5||0xcc;return function(_0x347285){if(_0x347285){return _0xdbca36[_0xec7e('0x1b')](_0x570db5);}return _0xdbca36['status'](_0x570db5)[_0xec7e('0x1c')]();};}function respondWithResult(_0x4bf989,_0x3388ae){_0x3388ae=_0x3388ae||0xc8;return function(_0x2b4e31){if(_0x2b4e31){return _0x4bf989[_0xec7e('0x1d')](_0x3388ae)['json'](_0x2b4e31);}};}function respondWithFilteredResult(_0x2e7509,_0x34b31){return function(_0x4870bf){if(_0x4870bf){var _0x5d1f31=typeof _0x34b31[_0xec7e('0x1e')]===_0xec7e('0x1f')&&typeof _0x34b31['limit']===_0xec7e('0x1f');var _0x5c3747=_0x4870bf[_0xec7e('0x20')];var _0x8b6b87=_0x5d1f31?0x0:_0x34b31[_0xec7e('0x1e')];var _0x31ec9b=_0x5d1f31?_0x4870bf['count']:_0x34b31[_0xec7e('0x1e')]+_0x34b31['limit'];var _0x5a58c4;if(_0x31ec9b>=_0x5c3747){_0x31ec9b=_0x5c3747;_0x5a58c4=0xc8;}else{_0x5a58c4=0xce;}_0x2e7509[_0xec7e('0x1d')](_0x5a58c4);return _0x2e7509[_0xec7e('0x21')](_0xec7e('0x22'),_0x8b6b87+'-'+_0x31ec9b+'/'+_0x5c3747)['json'](_0x4870bf);}return null;};}function patchUpdates(_0x1b68b6){return function(_0x374ac0){try{jsonpatch[_0xec7e('0x23')](_0x374ac0,_0x1b68b6,!![]);}catch(_0x32709b){return BPromise[_0xec7e('0x24')](_0x32709b);}return _0x374ac0[_0xec7e('0x25')]();};}function saveUpdates(_0x5ac6d0,_0x30ba97){return function(_0x50028d){if(_0x50028d){return _0x50028d[_0xec7e('0x26')](_0x5ac6d0)[_0xec7e('0x27')](function(_0x5b9738){return _0x5b9738;});}return null;};}function removeEntity(_0x34480a,_0x4a0085){return function(_0x46c3a4){if(_0x46c3a4){return _0x46c3a4['destroy']()[_0xec7e('0x27')](function(){_0x34480a['status'](0xcc)[_0xec7e('0x1c')]();});}};}function handleEntityNotFound(_0x4f345d,_0x2af498){return function(_0x123aed){if(!_0x123aed){_0x4f345d['sendStatus'](0x194);}return _0x123aed;};}function handleError(_0x468f19,_0x56c80c){_0x56c80c=_0x56c80c||0x1f4;return function(_0x1d6282){logger[_0xec7e('0x28')](_0x1d6282[_0xec7e('0x29')]);if(_0x1d6282[_0xec7e('0x2a')]){delete _0x1d6282[_0xec7e('0x2a')];}_0x468f19[_0xec7e('0x1d')](_0x56c80c)[_0xec7e('0x2b')](_0x1d6282);};}exports[_0xec7e('0x2c')]=function(_0x3ba5a9,_0x5bb945){var _0x32fba0={},_0x156613={},_0x391947={'count':0x0,'rows':[]};var _0x5e765b=_['map'](db[_0xec7e('0x2d')][_0xec7e('0x2e')],function(_0x55c224){return{'name':_0x55c224[_0xec7e('0x2f')],'type':_0x55c224[_0xec7e('0x30')]['key']};});_0x156613[_0xec7e('0x31')]=_[_0xec7e('0x32')](_0x5e765b,_0xec7e('0x2a'));_0x156613['query']=_[_0xec7e('0x33')](_0x3ba5a9['query']);_0x156613[_0xec7e('0x34')]=_['intersection'](_0x156613[_0xec7e('0x31')],_0x156613[_0xec7e('0x35')]);_0x32fba0[_0xec7e('0x36')]=_['intersection'](_0x156613[_0xec7e('0x31')],qs[_0xec7e('0x37')](_0x3ba5a9[_0xec7e('0x35')][_0xec7e('0x37')]));_0x32fba0[_0xec7e('0x36')]=_0x32fba0['attributes'][_0xec7e('0x38')]?_0x32fba0[_0xec7e('0x36')]:_0x156613[_0xec7e('0x31')];if(!_0x3ba5a9['query'][_0xec7e('0x39')](_0xec7e('0x3a'))){_0x32fba0[_0xec7e('0x3b')]=qs[_0xec7e('0x3b')](_0x3ba5a9[_0xec7e('0x35')]['limit']);_0x32fba0[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x3ba5a9[_0xec7e('0x35')][_0xec7e('0x1e')]);}_0x32fba0[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x3ba5a9['query'][_0xec7e('0x3d')]);_0x32fba0[_0xec7e('0x3e')]=qs['filters'](_[_0xec7e('0x3f')](_0x3ba5a9[_0xec7e('0x35')],_0x156613[_0xec7e('0x34')]),_0x5e765b);if(_0x3ba5a9[_0xec7e('0x35')][_0xec7e('0x40')]){_0x32fba0[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x32fba0[_0xec7e('0x3e')],{'$or':_['map'](_0x5e765b,function(_0x4ed96c){if(_0x4ed96c[_0xec7e('0x30')]!==_0xec7e('0x42')){var _0x4a9e00={};_0x4a9e00[_0x4ed96c[_0xec7e('0x2a')]]={'$like':'%'+_0x3ba5a9[_0xec7e('0x35')][_0xec7e('0x40')]+'%'};return _0x4a9e00;}})});}_0x32fba0=_[_0xec7e('0x41')]({},_0x32fba0,_0x3ba5a9[_0xec7e('0x43')]);var _0x5146c6={'where':_0x32fba0[_0xec7e('0x3e')]};return db[_0xec7e('0x2d')]['count'](_0x5146c6)[_0xec7e('0x27')](function(_0x1b9d64){_0x391947[_0xec7e('0x20')]=_0x1b9d64;if(_0x3ba5a9[_0xec7e('0x35')][_0xec7e('0x44')]){_0x32fba0[_0xec7e('0x45')]=[{'all':!![]}];}return db[_0xec7e('0x2d')]['findAll'](_0x32fba0);})['then'](function(_0x342396){_0x391947[_0xec7e('0x46')]=_0x342396;return _0x391947;})['then'](respondWithFilteredResult(_0x5bb945,_0x32fba0))['catch'](handleError(_0x5bb945,null));};exports[_0xec7e('0x47')]=function(_0x4751ed,_0x16e540){var _0x558104={'raw':![],'where':{'id':_0x4751ed[_0xec7e('0x48')]['id']}},_0x34b3cc={};_0x34b3cc[_0xec7e('0x31')]=_[_0xec7e('0x33')](db[_0xec7e('0x2d')]['rawAttributes']);_0x34b3cc[_0xec7e('0x35')]=_[_0xec7e('0x33')](_0x4751ed['query']);_0x34b3cc['filters']=_['intersection'](_0x34b3cc[_0xec7e('0x31')],_0x34b3cc[_0xec7e('0x35')]);_0x558104[_0xec7e('0x36')]=_[_0xec7e('0x49')](_0x34b3cc[_0xec7e('0x31')],qs['fields'](_0x4751ed[_0xec7e('0x35')][_0xec7e('0x37')]));_0x558104[_0xec7e('0x36')]=_0x558104[_0xec7e('0x36')][_0xec7e('0x38')]?_0x558104[_0xec7e('0x36')]:_0x34b3cc[_0xec7e('0x31')];if(_0x4751ed[_0xec7e('0x35')][_0xec7e('0x44')]){_0x558104[_0xec7e('0x45')]=[{'all':!![]}];}_0x558104=_[_0xec7e('0x41')]({},_0x558104,_0x4751ed[_0xec7e('0x43')]);return db[_0xec7e('0x2d')][_0xec7e('0x4a')](_0x558104)[_0xec7e('0x27')](handleEntityNotFound(_0x16e540,null))['then'](respondWithResult(_0x16e540,null))[_0xec7e('0x4b')](handleError(_0x16e540,null));};exports[_0xec7e('0x4c')]=function(_0x657a93,_0x225628){return db[_0xec7e('0x2d')][_0xec7e('0x4c')](_0x657a93[_0xec7e('0x4d')],{})[_0xec7e('0x27')](respondWithResult(_0x225628,0xc9))['catch'](handleError(_0x225628,null));};exports['update']=function(_0xc1c232,_0x6494c){if(_0xc1c232[_0xec7e('0x4d')]['id']){delete _0xc1c232[_0xec7e('0x4d')]['id'];}return db[_0xec7e('0x2d')][_0xec7e('0x4a')]({'where':{'id':_0xc1c232['params']['id']}})['then'](handleEntityNotFound(_0x6494c,null))[_0xec7e('0x27')](saveUpdates(_0xc1c232[_0xec7e('0x4d')],null))[_0xec7e('0x27')](respondWithResult(_0x6494c,null))[_0xec7e('0x4b')](handleError(_0x6494c,null));};exports[_0xec7e('0x4e')]=function(_0x55d4fe,_0x122eb3){return db[_0xec7e('0x2d')][_0xec7e('0x4a')]({'where':{'id':_0x55d4fe['params']['id']}})[_0xec7e('0x27')](handleEntityNotFound(_0x122eb3,null))[_0xec7e('0x27')](removeEntity(_0x122eb3,null))[_0xec7e('0x4b')](handleError(_0x122eb3,null));};exports[_0xec7e('0x4f')]=function(_0x200924,_0x402b7a,_0x265e7b){var _0xd7d03d={};var _0x2d792d={};var _0x237f19;var _0x3c50a0;return db['ZohoConfiguration'][_0xec7e('0x50')]({'where':{'id':_0x200924[_0xec7e('0x48')]['id']}})[_0xec7e('0x27')](handleEntityNotFound(_0x402b7a,null))['then'](function(_0xcd2ba7){if(_0xcd2ba7){_0x237f19=_0xcd2ba7;_0x2d792d[_0xec7e('0x31')]=_[_0xec7e('0x33')](db[_0xec7e('0x51')]['rawAttributes']);_0x2d792d['query']=_[_0xec7e('0x33')](_0x200924[_0xec7e('0x35')]);_0x2d792d['filters']=_[_0xec7e('0x49')](_0x2d792d['model'],_0x2d792d['query']);_0xd7d03d['attributes']=_[_0xec7e('0x49')](_0x2d792d[_0xec7e('0x31')],qs['fields'](_0x200924[_0xec7e('0x35')][_0xec7e('0x37')]));_0xd7d03d[_0xec7e('0x36')]=_0xd7d03d['attributes'][_0xec7e('0x38')]?_0xd7d03d['attributes']:_0x2d792d[_0xec7e('0x31')];_0xd7d03d[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x200924[_0xec7e('0x35')]['sort']);_0xd7d03d['where']=qs[_0xec7e('0x34')](_[_0xec7e('0x3f')](_0x200924[_0xec7e('0x35')],_0x2d792d['filters']));if(_0x200924['query'][_0xec7e('0x40')]){_0xd7d03d[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0xd7d03d[_0xec7e('0x3e')],{'$or':_['map'](_0xd7d03d[_0xec7e('0x36')],function(_0x35eb1e){var _0x58775d={};_0x58775d[_0x35eb1e]={'$like':'%'+_0x200924[_0xec7e('0x35')][_0xec7e('0x40')]+'%'};return _0x58775d;})});}_0xd7d03d=_['merge']({},_0xd7d03d,_0x200924['options']);return _0x237f19[_0xec7e('0x4f')](_0xd7d03d);}})[_0xec7e('0x27')](function(_0x200f4d){if(_0x200f4d){_0x3c50a0=_0x200f4d[_0xec7e('0x38')];if(!_0x200924[_0xec7e('0x35')][_0xec7e('0x39')](_0xec7e('0x3a'))){_0xd7d03d['limit']=qs[_0xec7e('0x3b')](_0x200924['query'][_0xec7e('0x3b')]);_0xd7d03d[_0xec7e('0x1e')]=qs['offset'](_0x200924[_0xec7e('0x35')][_0xec7e('0x1e')]);}return _0x237f19[_0xec7e('0x4f')](_0xd7d03d);}})[_0xec7e('0x27')](function(_0x24d1d6){if(_0x24d1d6){return _0x24d1d6?{'count':_0x3c50a0,'rows':_0x24d1d6}:null;}})[_0xec7e('0x27')](respondWithResult(_0x402b7a,null))['catch'](handleError(_0x402b7a,null));};exports[_0xec7e('0x52')]=function(_0x55c15d,_0x41ba5c,_0x5760d2){var _0x479947={};var _0x1ab786={};var _0x159799;var _0x503779;return db[_0xec7e('0x2d')][_0xec7e('0x50')]({'where':{'id':_0x55c15d['params']['id']}})[_0xec7e('0x27')](handleEntityNotFound(_0x41ba5c,null))[_0xec7e('0x27')](function(_0x4d96b1){if(_0x4d96b1){_0x159799=_0x4d96b1;_0x1ab786['model']=_['keys'](db[_0xec7e('0x51')]['rawAttributes']);_0x1ab786[_0xec7e('0x35')]=_[_0xec7e('0x33')](_0x55c15d[_0xec7e('0x35')]);_0x1ab786[_0xec7e('0x34')]=_[_0xec7e('0x49')](_0x1ab786[_0xec7e('0x31')],_0x1ab786[_0xec7e('0x35')]);_0x479947['attributes']=_['intersection'](_0x1ab786[_0xec7e('0x31')],qs[_0xec7e('0x37')](_0x55c15d['query'][_0xec7e('0x37')]));_0x479947[_0xec7e('0x36')]=_0x479947[_0xec7e('0x36')][_0xec7e('0x38')]?_0x479947[_0xec7e('0x36')]:_0x1ab786[_0xec7e('0x31')];_0x479947[_0xec7e('0x3c')]=qs['sort'](_0x55c15d['query']['sort']);_0x479947[_0xec7e('0x3e')]=qs['filters'](_[_0xec7e('0x3f')](_0x55c15d[_0xec7e('0x35')],_0x1ab786[_0xec7e('0x34')]));if(_0x55c15d[_0xec7e('0x35')][_0xec7e('0x40')]){_0x479947[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x479947[_0xec7e('0x3e')],{'$or':_[_0xec7e('0x32')](_0x479947[_0xec7e('0x36')],function(_0x148ea){var _0x50ee68={};_0x50ee68[_0x148ea]={'$like':'%'+_0x55c15d[_0xec7e('0x35')][_0xec7e('0x40')]+'%'};return _0x50ee68;})});}_0x479947=_[_0xec7e('0x41')]({},_0x479947,_0x55c15d[_0xec7e('0x43')]);return _0x159799[_0xec7e('0x52')](_0x479947);}})[_0xec7e('0x27')](function(_0x5a65ab){if(_0x5a65ab){_0x503779=_0x5a65ab[_0xec7e('0x38')];if(!_0x55c15d['query'][_0xec7e('0x39')]('nolimit')){_0x479947[_0xec7e('0x3b')]=qs['limit'](_0x55c15d[_0xec7e('0x35')]['limit']);_0x479947[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x55c15d[_0xec7e('0x35')][_0xec7e('0x1e')]);}return _0x159799[_0xec7e('0x52')](_0x479947);}})['then'](function(_0x4dd253){if(_0x4dd253){return _0x4dd253?{'count':_0x503779,'rows':_0x4dd253}:null;}})[_0xec7e('0x27')](respondWithResult(_0x41ba5c,null))[_0xec7e('0x4b')](handleError(_0x41ba5c,null));};exports[_0xec7e('0x53')]=function(_0x801373,_0x1d9467,_0xb1c694){var _0x19f4fc={};var _0x8ab152={};var _0x59c767;var _0x1a3065;return db[_0xec7e('0x2d')][_0xec7e('0x50')]({'where':{'id':_0x801373[_0xec7e('0x48')]['id']}})[_0xec7e('0x27')](handleEntityNotFound(_0x1d9467,null))[_0xec7e('0x27')](function(_0x1af4dc){if(_0x1af4dc){_0x59c767=_0x1af4dc;_0x8ab152[_0xec7e('0x31')]=_['keys'](db[_0xec7e('0x51')]['rawAttributes']);_0x8ab152['query']=_[_0xec7e('0x33')](_0x801373[_0xec7e('0x35')]);_0x8ab152[_0xec7e('0x34')]=_[_0xec7e('0x49')](_0x8ab152[_0xec7e('0x31')],_0x8ab152['query']);_0x19f4fc['attributes']=_[_0xec7e('0x49')](_0x8ab152[_0xec7e('0x31')],qs['fields'](_0x801373[_0xec7e('0x35')][_0xec7e('0x37')]));_0x19f4fc[_0xec7e('0x36')]=_0x19f4fc[_0xec7e('0x36')][_0xec7e('0x38')]?_0x19f4fc[_0xec7e('0x36')]:_0x8ab152[_0xec7e('0x31')];_0x19f4fc[_0xec7e('0x3c')]=qs['sort'](_0x801373[_0xec7e('0x35')][_0xec7e('0x3d')]);_0x19f4fc[_0xec7e('0x3e')]=qs[_0xec7e('0x34')](_[_0xec7e('0x3f')](_0x801373[_0xec7e('0x35')],_0x8ab152[_0xec7e('0x34')]));if(_0x801373[_0xec7e('0x35')]['filter']){_0x19f4fc['where']=_['merge'](_0x19f4fc[_0xec7e('0x3e')],{'$or':_['map'](_0x19f4fc['attributes'],function(_0x4ec6ed){var _0x555a76={};_0x555a76[_0x4ec6ed]={'$like':'%'+_0x801373['query'][_0xec7e('0x40')]+'%'};return _0x555a76;})});}_0x19f4fc=_['merge']({},_0x19f4fc,_0x801373['options']);return _0x59c767[_0xec7e('0x53')](_0x19f4fc);}})[_0xec7e('0x27')](function(_0xf1867){if(_0xf1867){_0x1a3065=_0xf1867['length'];if(!_0x801373['query'][_0xec7e('0x39')](_0xec7e('0x3a'))){_0x19f4fc['limit']=qs[_0xec7e('0x3b')](_0x801373[_0xec7e('0x35')][_0xec7e('0x3b')]);_0x19f4fc[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x801373['query'][_0xec7e('0x1e')]);}return _0x59c767['getDescriptions'](_0x19f4fc);}})['then'](function(_0x2b864d){if(_0x2b864d){return _0x2b864d?{'count':_0x1a3065,'rows':_0x2b864d}:null;}})['then'](respondWithResult(_0x1d9467,null))[_0xec7e('0x4b')](handleError(_0x1d9467,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6119a32..00299ee 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 _0x9f14=['moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9f14,0x10b));var _0x49f1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f14[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x49f1('0x0'));var util=require(_0x49f1('0x1'));var logger=require('../../config/logger')(_0x49f1('0x2'));var moment=require(_0x49f1('0x3'));var BPromise=require(_0x49f1('0x4'));var rp=require(_0x49f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49f1('0x6'));module[_0x49f1('0x7')]=function(_0x19d89b,_0x334078){return _0x19d89b['define'](_0x49f1('0x8'),attributes,{'tableName':_0x49f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x407e=['../../config/logger','api','bluebird','request-promise','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x260819,_0x24cacd){var _0x564d85=function(_0x4bb716){while(--_0x4bb716){_0x260819['push'](_0x260819['shift']());}};_0x564d85(++_0x24cacd);}(_0x407e,0x1e2));var _0xe407=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x407e[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require(_0xe407('0x0'));var util=require(_0xe407('0x1'));var logger=require(_0xe407('0x2'))(_0xe407('0x3'));var moment=require('moment');var BPromise=require(_0xe407('0x4'));var rp=require(_0xe407('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe407('0x6'));var config=require('../../config/environment');var attributes=require(_0xe407('0x7'));module[_0xe407('0x8')]=function(_0x6b7d8,_0xd2c393){return _0x6b7d8['define'](_0xe407('0x9'),attributes,{'tableName':_0xe407('0xa'),'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 97f97c9..3066d87 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 _0xd2e2=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x573fb3,_0x23e41f){var _0x4f5af4=function(_0x646462){while(--_0x646462){_0x573fb3['push'](_0x573fb3['shift']());}};_0x4f5af4(++_0x23e41f);}(_0xd2e2,0x7d));var _0x2d2e=function(_0x46ab70,_0x1c06e9){_0x46ab70=_0x46ab70-0x0;var _0x3d0dca=_0xd2e2[_0x46ab70];return _0x3d0dca;};'use strict';var _=require(_0x2d2e('0x0'));var util=require('util');var moment=require(_0x2d2e('0x1'));var BPromise=require(_0x2d2e('0x2'));var rs=require(_0x2d2e('0x3'));var fs=require('fs');var Redis=require(_0x2d2e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d2e('0x5'));var logger=require(_0x2d2e('0x6'))(_0x2d2e('0x7'));var config=require(_0x2d2e('0x8'));var jayson=require(_0x2d2e('0x9'));var client=jayson[_0x2d2e('0xa')][_0x2d2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x488ceb,_0xea12e5,_0x474ce9){return new BPromise(function(_0x51bc1f,_0x49941c){return client[_0x2d2e('0xc')](_0x488ceb,_0x474ce9)[_0x2d2e('0xd')](function(_0xa7a353){logger[_0x2d2e('0xe')](_0x2d2e('0xf'),_0xea12e5,_0x2d2e('0x10'));logger[_0x2d2e('0x11')](_0x2d2e('0x12'),_0xea12e5,_0x2d2e('0x10'),JSON['stringify'](_0xa7a353));if(_0xa7a353[_0x2d2e('0x13')]){if(_0xa7a353['error'][_0x2d2e('0x14')]===0x1f4){logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);return _0x49941c(_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);}logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);return _0x51bc1f(_0xa7a353['error'][_0x2d2e('0x15')]);}else{logger[_0x2d2e('0xe')](_0x2d2e('0xf'),_0xea12e5,'request\x20sent');_0x51bc1f(_0xa7a353[_0x2d2e('0x16')][_0x2d2e('0x15')]);}})[_0x2d2e('0x17')](function(_0x26d478){logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0x26d478);_0x49941c(_0x26d478);});});} \ No newline at end of file +var _0xcae7=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x5b3405,_0x1c4b46){var _0x2d0ab8=function(_0xfdb57e){while(--_0xfdb57e){_0x5b3405['push'](_0x5b3405['shift']());}};_0x2d0ab8(++_0x1c4b46);}(_0xcae7,0x1a5));var _0x7cae=function(_0x5222d9,_0x12496d){_0x5222d9=_0x5222d9-0x0;var _0x16b0d5=_0xcae7[_0x5222d9];return _0x16b0d5;};'use strict';var _=require(_0x7cae('0x0'));var util=require('util');var moment=require(_0x7cae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cae('0x2'));var db=require(_0x7cae('0x3'))['db'];var utils=require(_0x7cae('0x4'));var logger=require(_0x7cae('0x5'))(_0x7cae('0x6'));var config=require(_0x7cae('0x7'));var jayson=require(_0x7cae('0x8'));var client=jayson['client'][_0x7cae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21e18f,_0x118a29,_0x10d237){return new BPromise(function(_0x2872d6,_0x395b35){return client['request'](_0x21e18f,_0x10d237)[_0x7cae('0xa')](function(_0xe08492){logger['info'](_0x7cae('0xb'),_0x118a29,_0x7cae('0xc'));logger[_0x7cae('0xd')](_0x7cae('0xe'),_0x118a29,'request\x20sent',JSON['stringify'](_0xe08492));if(_0xe08492[_0x7cae('0xf')]){if(_0xe08492['error'][_0x7cae('0x10')]===0x1f4){logger[_0x7cae('0xf')](_0x7cae('0xb'),_0x118a29,_0xe08492[_0x7cae('0xf')][_0x7cae('0x11')]);return _0x395b35(_0xe08492['error'][_0x7cae('0x11')]);}logger['error'](_0x7cae('0xb'),_0x118a29,_0xe08492[_0x7cae('0xf')]['message']);return _0x2872d6(_0xe08492[_0x7cae('0xf')][_0x7cae('0x11')]);}else{logger[_0x7cae('0x12')](_0x7cae('0xb'),_0x118a29,_0x7cae('0xc'));_0x2872d6(_0xe08492[_0x7cae('0x13')][_0x7cae('0x11')]);}})[_0x7cae('0x14')](function(_0x3eefa3){logger[_0x7cae('0xf')](_0x7cae('0xb'),_0x118a29,_0x3eefa3);_0x395b35(_0x3eefa3);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e231530..e79d1e7 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 _0x98ea=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x98ea,0x1f0));var _0xa98e=function(_0x4d119f,_0x31f933){_0x4d119f=_0x4d119f-0x0;var _0x1f60b4=_0x98ea[_0x4d119f];return _0x1f60b4;};'use strict';var multer=require(_0xa98e('0x0'));var util=require(_0xa98e('0x1'));var path=require(_0xa98e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa98e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa98e('0x4'));var interaction=require(_0xa98e('0x5'));var config=require(_0xa98e('0x6'));var controller=require(_0xa98e('0x7'));router['get']('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0x9')]);router['get']('/:id',auth[_0xa98e('0x8')](),controller['show']);router[_0xa98e('0xa')]('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0xb')]);router[_0xa98e('0xc')](_0xa98e('0xd'),auth['isAuthenticated'](),controller[_0xa98e('0xe')]);router[_0xa98e('0xf')]('/:id',auth[_0xa98e('0x8')](),controller[_0xa98e('0x10')]);module[_0xa98e('0x11')]=router; \ No newline at end of file +var _0xe7f4=['index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7f4,0x1d8));var _0x4e7f=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xe7f4[_0x1bc0ae];return _0x501104;};'use strict';var multer=require(_0x4e7f('0x0'));var util=require(_0x4e7f('0x1'));var path=require(_0x4e7f('0x2'));var timeout=require(_0x4e7f('0x3'));var express=require(_0x4e7f('0x4'));var router=express[_0x4e7f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e7f('0x6'));var interaction=require(_0x4e7f('0x7'));var config=require(_0x4e7f('0x8'));var controller=require(_0x4e7f('0x9'));router[_0x4e7f('0xa')]('/',auth['isAuthenticated'](),controller[_0x4e7f('0xb')]);router['get'](_0x4e7f('0xc'),auth[_0x4e7f('0xd')](),controller[_0x4e7f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e7f('0xf')]);router[_0x4e7f('0x10')](_0x4e7f('0xc'),auth[_0x4e7f('0xd')](),controller[_0x4e7f('0x11')]);router[_0x4e7f('0x12')](_0x4e7f('0xc'),auth[_0x4e7f('0xd')](),controller[_0x4e7f('0x13')]);module[_0x4e7f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ce129e0..c2db8c1 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 _0x131f=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x227cf9,_0x3399ce){var _0xc9b970=function(_0x15bfda){while(--_0x15bfda){_0x227cf9['push'](_0x227cf9['shift']());}};_0xc9b970(++_0x3399ce);}(_0x131f,0x179));var _0xf131=function(_0x36dca0,_0x4072ca){_0x36dca0=_0x36dca0-0x0;var _0x2ac018=_0x131f[_0x36dca0];return _0x2ac018;};'use strict';var Sequelize=require(_0xf131('0x0'));module['exports']={'type':{'type':Sequelize[_0xf131('0x1')](_0xf131('0x2'),_0xf131('0x3'),_0xf131('0x4'),'keyValue',_0xf131('0x5')),'defaultValue':_0xf131('0x2')},'content':{'type':Sequelize[_0xf131('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf131('0x1')](_0xf131('0x2'),_0xf131('0x3'),_0xf131('0x4'))},'keyContent':{'type':Sequelize[_0xf131('0x6')]},'idField':{'type':Sequelize[_0xf131('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf131('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf131('0x6')]}}; \ No newline at end of file +var _0xfe35=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x2a8b8c,_0x5e199b){var _0x375825=function(_0x496a61){while(--_0x496a61){_0x2a8b8c['push'](_0x2a8b8c['shift']());}};_0x375825(++_0x5e199b);}(_0xfe35,0x98));var _0x5fe3=function(_0x57dcba,_0x51d9f9){_0x57dcba=_0x57dcba-0x0;var _0x110949=_0xfe35[_0x57dcba];return _0x110949;};'use strict';var Sequelize=require(_0x5fe3('0x0'));module[_0x5fe3('0x1')]={'type':{'type':Sequelize[_0x5fe3('0x2')](_0x5fe3('0x3'),'variable',_0x5fe3('0x4'),_0x5fe3('0x5'),_0x5fe3('0x6')),'defaultValue':_0x5fe3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5fe3('0x7')]},'keyType':{'type':Sequelize[_0x5fe3('0x2')](_0x5fe3('0x3'),_0x5fe3('0x8'),_0x5fe3('0x4'))},'keyContent':{'type':Sequelize[_0x5fe3('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5fe3('0x7')]},'customField':{'type':Sequelize[_0x5fe3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8c180ee..0042af5 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 _0x4854=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ZohoField','findAll','rows','catch','show','params','create','body','find','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x4854,0x10d));var _0x4485=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0x4854[_0x74115b];return _0x57ebbd;};'use strict';var emlformat=require(_0x4485('0x0'));var rimraf=require(_0x4485('0x1'));var zipdir=require(_0x4485('0x2'));var jsonpatch=require(_0x4485('0x3'));var rp=require(_0x4485('0x4'));var moment=require(_0x4485('0x5'));var BPromise=require(_0x4485('0x6'));var Mustache=require(_0x4485('0x7'));var util=require(_0x4485('0x8'));var path=require(_0x4485('0x9'));var sox=require(_0x4485('0xa'));var csv=require('to-csv');var ejs=require(_0x4485('0xb'));var fs=require('fs');var fs_extra=require(_0x4485('0xc'));var _=require(_0x4485('0xd'));var squel=require(_0x4485('0xe'));var crypto=require(_0x4485('0xf'));var jsforce=require(_0x4485('0x10'));var deskjs=require(_0x4485('0x11'));var toCsv=require(_0x4485('0x12'));var querystring=require(_0x4485('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4485('0x14'));var qs=require(_0x4485('0x15'));var as=require(_0x4485('0x16'));var hardwareService=require(_0x4485('0x17'));var logger=require(_0x4485('0x18'))(_0x4485('0x19'));var utils=require('../../config/utils');var config=require(_0x4485('0x1a'));var licenseUtil=require(_0x4485('0x1b'));var db=require(_0x4485('0x1c'))['db'];function respondWithStatusCode(_0x53b137,_0x3217b6){_0x3217b6=_0x3217b6||0xcc;return function(_0x34c89f){if(_0x34c89f){return _0x53b137[_0x4485('0x1d')](_0x3217b6);}return _0x53b137[_0x4485('0x1e')](_0x3217b6)['end']();};}function respondWithResult(_0x4ef51b,_0x3c30ce){_0x3c30ce=_0x3c30ce||0xc8;return function(_0x195d56){if(_0x195d56){return _0x4ef51b['status'](_0x3c30ce)[_0x4485('0x1f')](_0x195d56);}};}function respondWithFilteredResult(_0xb326d3,_0x5c2dee){return function(_0x18e70a){if(_0x18e70a){var _0x19d8c9=typeof _0x5c2dee[_0x4485('0x20')]===_0x4485('0x21')&&typeof _0x5c2dee[_0x4485('0x22')]===_0x4485('0x21');var _0x2b7d41=_0x18e70a[_0x4485('0x23')];var _0x4e0859=_0x19d8c9?0x0:_0x5c2dee[_0x4485('0x20')];var _0x3b3b34=_0x19d8c9?_0x18e70a[_0x4485('0x23')]:_0x5c2dee[_0x4485('0x20')]+_0x5c2dee[_0x4485('0x22')];var _0x3bab88;if(_0x3b3b34>=_0x2b7d41){_0x3b3b34=_0x2b7d41;_0x3bab88=0xc8;}else{_0x3bab88=0xce;}_0xb326d3[_0x4485('0x1e')](_0x3bab88);return _0xb326d3[_0x4485('0x24')](_0x4485('0x25'),_0x4e0859+'-'+_0x3b3b34+'/'+_0x2b7d41)[_0x4485('0x1f')](_0x18e70a);}return null;};}function patchUpdates(_0x190ac4){return function(_0x164644){try{jsonpatch[_0x4485('0x26')](_0x164644,_0x190ac4,!![]);}catch(_0x20959c){return BPromise[_0x4485('0x27')](_0x20959c);}return _0x164644['save']();};}function saveUpdates(_0x5c60ad,_0x380ba2){return function(_0x5811ad){if(_0x5811ad){return _0x5811ad[_0x4485('0x28')](_0x5c60ad)[_0x4485('0x29')](function(_0x17a9b9){return _0x17a9b9;});}return null;};}function removeEntity(_0x560d61,_0x5b24e9){return function(_0x2c487d){if(_0x2c487d){return _0x2c487d[_0x4485('0x2a')]()['then'](function(){_0x560d61[_0x4485('0x1e')](0xcc)[_0x4485('0x2b')]();});}};}function handleEntityNotFound(_0x6f9cfb,_0x5e198e){return function(_0x25c2b1){if(!_0x25c2b1){_0x6f9cfb[_0x4485('0x1d')](0x194);}return _0x25c2b1;};}function handleError(_0x367d1d,_0x4fc0c4){_0x4fc0c4=_0x4fc0c4||0x1f4;return function(_0x177dbd){logger[_0x4485('0x2c')](_0x177dbd[_0x4485('0x2d')]);if(_0x177dbd[_0x4485('0x2e')]){delete _0x177dbd[_0x4485('0x2e')];}_0x367d1d[_0x4485('0x1e')](_0x4fc0c4)['send'](_0x177dbd);};}exports[_0x4485('0x2f')]=function(_0xd43966,_0x1d74fd){var _0x216209={},_0x7a63d5={},_0x2a9ba={'count':0x0,'rows':[]};var _0x4f8912=_['map'](db['ZohoField'][_0x4485('0x30')],function(_0x543798){return{'name':_0x543798[_0x4485('0x31')],'type':_0x543798[_0x4485('0x32')][_0x4485('0x33')]};});_0x7a63d5[_0x4485('0x34')]=_[_0x4485('0x35')](_0x4f8912,_0x4485('0x2e'));_0x7a63d5[_0x4485('0x36')]=_[_0x4485('0x37')](_0xd43966['query']);_0x7a63d5[_0x4485('0x38')]=_[_0x4485('0x39')](_0x7a63d5[_0x4485('0x34')],_0x7a63d5[_0x4485('0x36')]);_0x216209[_0x4485('0x3a')]=_['intersection'](_0x7a63d5[_0x4485('0x34')],qs['fields'](_0xd43966[_0x4485('0x36')][_0x4485('0x3b')]));_0x216209[_0x4485('0x3a')]=_0x216209[_0x4485('0x3a')][_0x4485('0x3c')]?_0x216209[_0x4485('0x3a')]:_0x7a63d5['model'];if(!_0xd43966[_0x4485('0x36')][_0x4485('0x3d')](_0x4485('0x3e'))){_0x216209['limit']=qs[_0x4485('0x22')](_0xd43966[_0x4485('0x36')][_0x4485('0x22')]);_0x216209['offset']=qs['offset'](_0xd43966[_0x4485('0x36')][_0x4485('0x20')]);}_0x216209[_0x4485('0x3f')]=qs['sort'](_0xd43966[_0x4485('0x36')][_0x4485('0x40')]);_0x216209[_0x4485('0x41')]=qs[_0x4485('0x38')](_[_0x4485('0x42')](_0xd43966[_0x4485('0x36')],_0x7a63d5[_0x4485('0x38')]),_0x4f8912);if(_0xd43966[_0x4485('0x36')]['filter']){_0x216209[_0x4485('0x41')]=_[_0x4485('0x43')](_0x216209[_0x4485('0x41')],{'$or':_[_0x4485('0x35')](_0x4f8912,function(_0x128ef0){if(_0x128ef0[_0x4485('0x32')]!==_0x4485('0x44')){var _0x3e4742={};_0x3e4742[_0x128ef0[_0x4485('0x2e')]]={'$like':'%'+_0xd43966[_0x4485('0x36')][_0x4485('0x45')]+'%'};return _0x3e4742;}})});}_0x216209=_[_0x4485('0x43')]({},_0x216209,_0xd43966[_0x4485('0x46')]);var _0x47089f={'where':_0x216209['where']};return db['ZohoField'][_0x4485('0x23')](_0x47089f)['then'](function(_0x560ab9){_0x2a9ba[_0x4485('0x23')]=_0x560ab9;if(_0xd43966['query'][_0x4485('0x47')]){_0x216209[_0x4485('0x48')]=[{'all':!![]}];}return db[_0x4485('0x49')][_0x4485('0x4a')](_0x216209);})[_0x4485('0x29')](function(_0x5f9e00){_0x2a9ba[_0x4485('0x4b')]=_0x5f9e00;return _0x2a9ba;})[_0x4485('0x29')](respondWithFilteredResult(_0x1d74fd,_0x216209))[_0x4485('0x4c')](handleError(_0x1d74fd,null));};exports[_0x4485('0x4d')]=function(_0x121bcc,_0x446e4b){var _0x3234e5={'raw':!![],'where':{'id':_0x121bcc[_0x4485('0x4e')]['id']}},_0x447245={};_0x447245[_0x4485('0x34')]=_['keys'](db[_0x4485('0x49')][_0x4485('0x30')]);_0x447245[_0x4485('0x36')]=_['keys'](_0x121bcc['query']);_0x447245['filters']=_[_0x4485('0x39')](_0x447245[_0x4485('0x34')],_0x447245[_0x4485('0x36')]);_0x3234e5[_0x4485('0x3a')]=_[_0x4485('0x39')](_0x447245[_0x4485('0x34')],qs[_0x4485('0x3b')](_0x121bcc[_0x4485('0x36')][_0x4485('0x3b')]));_0x3234e5['attributes']=_0x3234e5[_0x4485('0x3a')][_0x4485('0x3c')]?_0x3234e5[_0x4485('0x3a')]:_0x447245[_0x4485('0x34')];if(_0x121bcc[_0x4485('0x36')]['includeAll']){_0x3234e5[_0x4485('0x48')]=[{'all':!![]}];}_0x3234e5=_[_0x4485('0x43')]({},_0x3234e5,_0x121bcc[_0x4485('0x46')]);return db[_0x4485('0x49')]['find'](_0x3234e5)[_0x4485('0x29')](handleEntityNotFound(_0x446e4b,null))['then'](respondWithResult(_0x446e4b,null))[_0x4485('0x4c')](handleError(_0x446e4b,null));};exports['create']=function(_0x383a15,_0x2b36f4){return db[_0x4485('0x49')][_0x4485('0x4f')](_0x383a15['body'],{})[_0x4485('0x29')](respondWithResult(_0x2b36f4,0xc9))[_0x4485('0x4c')](handleError(_0x2b36f4,null));};exports['update']=function(_0x4d54b2,_0x5e3b00){if(_0x4d54b2[_0x4485('0x50')]['id']){delete _0x4d54b2[_0x4485('0x50')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x4d54b2[_0x4485('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e3b00,null))[_0x4485('0x29')](saveUpdates(_0x4d54b2[_0x4485('0x50')],null))[_0x4485('0x29')](respondWithResult(_0x5e3b00,null))[_0x4485('0x4c')](handleError(_0x5e3b00,null));};exports[_0x4485('0x2a')]=function(_0x3dca00,_0x7deb45){return db[_0x4485('0x49')][_0x4485('0x51')]({'where':{'id':_0x3dca00[_0x4485('0x4e')]['id']}})[_0x4485('0x29')](handleEntityNotFound(_0x7deb45,null))['then'](removeEntity(_0x7deb45,null))['catch'](handleError(_0x7deb45,null));}; \ No newline at end of file +var _0x6337=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','ZohoField','fieldName','model','query','keys'];(function(_0x487f96,_0x2b816b){var _0x2cafdc=function(_0x16706b){while(--_0x16706b){_0x487f96['push'](_0x487f96['shift']());}};_0x2cafdc(++_0x2b816b);}(_0x6337,0x18a));var _0x7633=function(_0x6fde9,_0x366856){_0x6fde9=_0x6fde9-0x0;var _0xc4f9f5=_0x6337[_0x6fde9];return _0xc4f9f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7633('0x0'));var zipdir=require(_0x7633('0x1'));var jsonpatch=require(_0x7633('0x2'));var rp=require(_0x7633('0x3'));var moment=require(_0x7633('0x4'));var BPromise=require(_0x7633('0x5'));var Mustache=require(_0x7633('0x6'));var util=require(_0x7633('0x7'));var path=require(_0x7633('0x8'));var sox=require('sox');var csv=require(_0x7633('0x9'));var ejs=require(_0x7633('0xa'));var fs=require('fs');var fs_extra=require(_0x7633('0xb'));var _=require('lodash');var squel=require(_0x7633('0xc'));var crypto=require('crypto');var jsforce=require(_0x7633('0xd'));var deskjs=require(_0x7633('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7633('0xf'));var Papa=require('papaparse');var Redis=require(_0x7633('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7633('0x11'));var as=require(_0x7633('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7633('0x13'))(_0x7633('0x14'));var utils=require(_0x7633('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7633('0x16'));var db=require(_0x7633('0x17'))['db'];function respondWithStatusCode(_0xeef065,_0x563006){_0x563006=_0x563006||0xcc;return function(_0x2007bc){if(_0x2007bc){return _0xeef065[_0x7633('0x18')](_0x563006);}return _0xeef065[_0x7633('0x19')](_0x563006)['end']();};}function respondWithResult(_0x5654bc,_0x50e10c){_0x50e10c=_0x50e10c||0xc8;return function(_0x18abe4){if(_0x18abe4){return _0x5654bc[_0x7633('0x19')](_0x50e10c)[_0x7633('0x1a')](_0x18abe4);}};}function respondWithFilteredResult(_0x3666a1,_0x25e7d5){return function(_0x1c9957){if(_0x1c9957){var _0x47e212=typeof _0x25e7d5[_0x7633('0x1b')]===_0x7633('0x1c')&&typeof _0x25e7d5['limit']===_0x7633('0x1c');var _0x4c4e1=_0x1c9957[_0x7633('0x1d')];var _0x321043=_0x47e212?0x0:_0x25e7d5[_0x7633('0x1b')];var _0x5c7609=_0x47e212?_0x1c9957[_0x7633('0x1d')]:_0x25e7d5[_0x7633('0x1b')]+_0x25e7d5[_0x7633('0x1e')];var _0x5988d4;if(_0x5c7609>=_0x4c4e1){_0x5c7609=_0x4c4e1;_0x5988d4=0xc8;}else{_0x5988d4=0xce;}_0x3666a1[_0x7633('0x19')](_0x5988d4);return _0x3666a1[_0x7633('0x1f')](_0x7633('0x20'),_0x321043+'-'+_0x5c7609+'/'+_0x4c4e1)[_0x7633('0x1a')](_0x1c9957);}return null;};}function patchUpdates(_0x14df18){return function(_0x503d13){try{jsonpatch[_0x7633('0x21')](_0x503d13,_0x14df18,!![]);}catch(_0x1140cd){return BPromise[_0x7633('0x22')](_0x1140cd);}return _0x503d13[_0x7633('0x23')]();};}function saveUpdates(_0x1c8efc,_0x55715b){return function(_0x38a915){if(_0x38a915){return _0x38a915[_0x7633('0x24')](_0x1c8efc)[_0x7633('0x25')](function(_0x2471b7){return _0x2471b7;});}return null;};}function removeEntity(_0x531e8f,_0x135a75){return function(_0x9152df){if(_0x9152df){return _0x9152df[_0x7633('0x26')]()[_0x7633('0x25')](function(){_0x531e8f['status'](0xcc)[_0x7633('0x27')]();});}};}function handleEntityNotFound(_0x34aa76,_0x555923){return function(_0x1eb275){if(!_0x1eb275){_0x34aa76['sendStatus'](0x194);}return _0x1eb275;};}function handleError(_0x47f2cb,_0x42b4a7){_0x42b4a7=_0x42b4a7||0x1f4;return function(_0x1b2920){logger[_0x7633('0x28')](_0x1b2920[_0x7633('0x29')]);if(_0x1b2920[_0x7633('0x2a')]){delete _0x1b2920[_0x7633('0x2a')];}_0x47f2cb[_0x7633('0x19')](_0x42b4a7)['send'](_0x1b2920);};}exports[_0x7633('0x2b')]=function(_0x7b9d8b,_0x266944){var _0x3d0b0c={},_0x323e00={},_0x1abaed={'count':0x0,'rows':[]};var _0x5d79ce=_[_0x7633('0x2c')](db[_0x7633('0x2d')]['rawAttributes'],function(_0x8fcf83){return{'name':_0x8fcf83[_0x7633('0x2e')],'type':_0x8fcf83['type']['key']};});_0x323e00[_0x7633('0x2f')]=_['map'](_0x5d79ce,_0x7633('0x2a'));_0x323e00[_0x7633('0x30')]=_[_0x7633('0x31')](_0x7b9d8b[_0x7633('0x30')]);_0x323e00[_0x7633('0x32')]=_[_0x7633('0x33')](_0x323e00['model'],_0x323e00[_0x7633('0x30')]);_0x3d0b0c[_0x7633('0x34')]=_['intersection'](_0x323e00['model'],qs[_0x7633('0x35')](_0x7b9d8b['query'][_0x7633('0x35')]));_0x3d0b0c['attributes']=_0x3d0b0c['attributes'][_0x7633('0x36')]?_0x3d0b0c[_0x7633('0x34')]:_0x323e00[_0x7633('0x2f')];if(!_0x7b9d8b[_0x7633('0x30')][_0x7633('0x37')](_0x7633('0x38'))){_0x3d0b0c['limit']=qs[_0x7633('0x1e')](_0x7b9d8b['query'][_0x7633('0x1e')]);_0x3d0b0c[_0x7633('0x1b')]=qs[_0x7633('0x1b')](_0x7b9d8b[_0x7633('0x30')][_0x7633('0x1b')]);}_0x3d0b0c[_0x7633('0x39')]=qs['sort'](_0x7b9d8b[_0x7633('0x30')][_0x7633('0x3a')]);_0x3d0b0c['where']=qs[_0x7633('0x32')](_[_0x7633('0x3b')](_0x7b9d8b[_0x7633('0x30')],_0x323e00[_0x7633('0x32')]),_0x5d79ce);if(_0x7b9d8b['query'][_0x7633('0x3c')]){_0x3d0b0c[_0x7633('0x3d')]=_[_0x7633('0x3e')](_0x3d0b0c[_0x7633('0x3d')],{'$or':_[_0x7633('0x2c')](_0x5d79ce,function(_0x552927){if(_0x552927[_0x7633('0x3f')]!==_0x7633('0x40')){var _0x2d6459={};_0x2d6459[_0x552927['name']]={'$like':'%'+_0x7b9d8b[_0x7633('0x30')][_0x7633('0x3c')]+'%'};return _0x2d6459;}})});}_0x3d0b0c=_[_0x7633('0x3e')]({},_0x3d0b0c,_0x7b9d8b[_0x7633('0x41')]);var _0x5371d7={'where':_0x3d0b0c['where']};return db[_0x7633('0x2d')][_0x7633('0x1d')](_0x5371d7)[_0x7633('0x25')](function(_0x50856e){_0x1abaed[_0x7633('0x1d')]=_0x50856e;if(_0x7b9d8b[_0x7633('0x30')][_0x7633('0x42')]){_0x3d0b0c[_0x7633('0x43')]=[{'all':!![]}];}return db['ZohoField'][_0x7633('0x44')](_0x3d0b0c);})['then'](function(_0x25a22e){_0x1abaed['rows']=_0x25a22e;return _0x1abaed;})[_0x7633('0x25')](respondWithFilteredResult(_0x266944,_0x3d0b0c))[_0x7633('0x45')](handleError(_0x266944,null));};exports['show']=function(_0x46e83f,_0x27209e){var _0x3f24b2={'raw':!![],'where':{'id':_0x46e83f[_0x7633('0x46')]['id']}},_0x79c2d0={};_0x79c2d0[_0x7633('0x2f')]=_[_0x7633('0x31')](db['ZohoField']['rawAttributes']);_0x79c2d0[_0x7633('0x30')]=_['keys'](_0x46e83f[_0x7633('0x30')]);_0x79c2d0[_0x7633('0x32')]=_[_0x7633('0x33')](_0x79c2d0[_0x7633('0x2f')],_0x79c2d0[_0x7633('0x30')]);_0x3f24b2[_0x7633('0x34')]=_[_0x7633('0x33')](_0x79c2d0[_0x7633('0x2f')],qs[_0x7633('0x35')](_0x46e83f[_0x7633('0x30')][_0x7633('0x35')]));_0x3f24b2[_0x7633('0x34')]=_0x3f24b2[_0x7633('0x34')]['length']?_0x3f24b2['attributes']:_0x79c2d0[_0x7633('0x2f')];if(_0x46e83f[_0x7633('0x30')][_0x7633('0x42')]){_0x3f24b2[_0x7633('0x43')]=[{'all':!![]}];}_0x3f24b2=_[_0x7633('0x3e')]({},_0x3f24b2,_0x46e83f[_0x7633('0x41')]);return db['ZohoField']['find'](_0x3f24b2)[_0x7633('0x25')](handleEntityNotFound(_0x27209e,null))[_0x7633('0x25')](respondWithResult(_0x27209e,null))[_0x7633('0x45')](handleError(_0x27209e,null));};exports[_0x7633('0x47')]=function(_0x599601,_0x5d9a0d){return db[_0x7633('0x2d')][_0x7633('0x47')](_0x599601[_0x7633('0x48')],{})['then'](respondWithResult(_0x5d9a0d,0xc9))[_0x7633('0x45')](handleError(_0x5d9a0d,null));};exports[_0x7633('0x24')]=function(_0x31f166,_0x3c79cb){if(_0x31f166[_0x7633('0x48')]['id']){delete _0x31f166[_0x7633('0x48')]['id'];}return db['ZohoField'][_0x7633('0x49')]({'where':{'id':_0x31f166[_0x7633('0x46')]['id']}})[_0x7633('0x25')](handleEntityNotFound(_0x3c79cb,null))['then'](saveUpdates(_0x31f166[_0x7633('0x48')],null))[_0x7633('0x25')](respondWithResult(_0x3c79cb,null))[_0x7633('0x45')](handleError(_0x3c79cb,null));};exports['destroy']=function(_0x54d4c1,_0x436788){return db[_0x7633('0x2d')][_0x7633('0x49')]({'where':{'id':_0x54d4c1[_0x7633('0x46')]['id']}})['then'](handleEntityNotFound(_0x436788,null))[_0x7633('0x25')](removeEntity(_0x436788,null))[_0x7633('0x45')](handleError(_0x436788,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9420868..9881db9 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 _0xb44a=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','moment','path','../../config/environment','./intZohoField.attributes','exports'];(function(_0x1fcee9,_0xe4b6a3){var _0x190dfc=function(_0x267aa8){while(--_0x267aa8){_0x1fcee9['push'](_0x1fcee9['shift']());}};_0x190dfc(++_0xe4b6a3);}(_0xb44a,0x1c2));var _0xab44=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xb44a[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[{'name':_0xab44('0x9'),'fields':[_0xab44('0xa'),_0xab44('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x4bd3,0x174));var _0x34bd=function(_0x4db0e4,_0x2b7306){_0x4db0e4=_0x4db0e4-0x0;var _0x1a8b53=_0x4bd3[_0x4db0e4];return _0x1a8b53;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intZohoField.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0xa'),_0x34bd('0xb')],'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 270da3c..8d9fd11 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 _0x056a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3e7a20,_0x56763c){var _0xce3326=function(_0x55f08d){while(--_0x55f08d){_0x3e7a20['push'](_0x3e7a20['shift']());}};_0xce3326(++_0x56763c);}(_0x056a,0xdb));var _0xa056=function(_0x49ce1a,_0x84e3ca){_0x49ce1a=_0x49ce1a-0x0;var _0x3fa24f=_0x056a[_0x49ce1a];return _0x3fa24f;};'use strict';var _=require(_0xa056('0x0'));var util=require(_0xa056('0x1'));var moment=require(_0xa056('0x2'));var BPromise=require(_0xa056('0x3'));var rs=require(_0xa056('0x4'));var fs=require('fs');var Redis=require(_0xa056('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa056('0x6'));var logger=require(_0xa056('0x7'))(_0xa056('0x8'));var config=require(_0xa056('0x9'));var jayson=require(_0xa056('0xa'));var client=jayson[_0xa056('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5856e0,_0x2622c1,_0x32aa8f){return new BPromise(function(_0x56fd9e,_0x5cc8da){return client[_0xa056('0xc')](_0x5856e0,_0x32aa8f)[_0xa056('0xd')](function(_0x38b35f){logger[_0xa056('0xe')]('ZohoField,\x20%s,\x20%s',_0x2622c1,_0xa056('0xf'));logger[_0xa056('0x10')](_0xa056('0x11'),_0x2622c1,_0xa056('0xf'),JSON[_0xa056('0x12')](_0x38b35f));if(_0x38b35f[_0xa056('0x13')]){if(_0x38b35f[_0xa056('0x13')][_0xa056('0x14')]===0x1f4){logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);return _0x5cc8da(_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);}logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x38b35f[_0xa056('0x13')]['message']);return _0x56fd9e(_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);}else{logger[_0xa056('0xe')]('ZohoField,\x20%s,\x20%s',_0x2622c1,_0xa056('0xf'));_0x56fd9e(_0x38b35f[_0xa056('0x17')]['message']);}})[_0xa056('0x18')](function(_0x1993a6){logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x1993a6);_0x5cc8da(_0x1993a6);});});} \ No newline at end of file +var _0xf7b5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0xf7b5,0x19c));var _0x5f7b=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xf7b5[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x5f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f7b('0x1'));var rs=require(_0x5f7b('0x2'));var fs=require('fs');var Redis=require(_0x5f7b('0x3'));var db=require(_0x5f7b('0x4'))['db'];var utils=require(_0x5f7b('0x5'));var logger=require(_0x5f7b('0x6'))(_0x5f7b('0x7'));var config=require(_0x5f7b('0x8'));var jayson=require(_0x5f7b('0x9'));var client=jayson[_0x5f7b('0xa')][_0x5f7b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170d00,_0x1d64c6,_0x4f9646){return new BPromise(function(_0x417ff1,_0x1c35a2){return client[_0x5f7b('0xc')](_0x170d00,_0x4f9646)['then'](function(_0x5b88aa){logger[_0x5f7b('0xd')](_0x5f7b('0xe'),_0x1d64c6,'request\x20sent');logger[_0x5f7b('0xf')](_0x5f7b('0x10'),_0x1d64c6,_0x5f7b('0x11'),JSON[_0x5f7b('0x12')](_0x5b88aa));if(_0x5b88aa[_0x5f7b('0x13')]){if(_0x5b88aa[_0x5f7b('0x13')][_0x5f7b('0x14')]===0x1f4){logger[_0x5f7b('0x13')](_0x5f7b('0xe'),_0x1d64c6,_0x5b88aa['error'][_0x5f7b('0x15')]);return _0x1c35a2(_0x5b88aa[_0x5f7b('0x13')][_0x5f7b('0x15')]);}logger[_0x5f7b('0x13')](_0x5f7b('0xe'),_0x1d64c6,_0x5b88aa[_0x5f7b('0x13')]['message']);return _0x417ff1(_0x5b88aa[_0x5f7b('0x13')][_0x5f7b('0x15')]);}else{logger[_0x5f7b('0xd')](_0x5f7b('0xe'),_0x1d64c6,_0x5f7b('0x11'));_0x417ff1(_0x5b88aa['result'][_0x5f7b('0x15')]);}})[_0x5f7b('0x16')](function(_0x348557){logger[_0x5f7b('0x13')](_0x5f7b('0xe'),_0x1d64c6,_0x348557);_0x1c35a2(_0x348557);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d6f91e8..f22610d 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c85db,_0x5b12ad){var _0x46bef9=function(_0x4548f5){while(--_0x4548f5){_0x1c85db['push'](_0x1c85db['shift']());}};_0x46bef9(++_0x5b12ad);}(_0x70e0,0x17b));var _0x070e=function(_0xe76ec6,_0x41ae88){_0xe76ec6=_0xe76ec6-0x0;var _0x58ecbe=_0x70e0[_0xe76ec6];return _0x58ecbe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ace7f41..dac1c6c 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 _0xe605=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0xe605,0x92));var _0x5e60=function(_0x205399,_0x4b979e){_0x205399=_0x205399-0x0;var _0x2782a0=_0xe605[_0x205399];return _0x2782a0;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5e60('0x2')},'version':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![],'unique':_0x5e60('0x2')},'main':{'type':Sequelize[_0x5e60('0x3')],'defaultValue':_0x5e60('0x4')},'filename':{'type':Sequelize[_0x5e60('0x3')]},'path':{'type':Sequelize[_0x5e60('0x3')]},'type':{'type':Sequelize[_0x5e60('0x3')]},'size':{'type':Sequelize[_0x5e60('0x5')]},'active':{'type':Sequelize[_0x5e60('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5e60('0x3')]},'logo':{'type':Sequelize[_0x5e60('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0x5e60('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x5e60('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4ce5=['STRING','unique_name_and_version','app.js','state','sequelize'];(function(_0xcf132,_0x5ab02a){var _0x496d9f=function(_0x49a600){while(--_0x49a600){_0xcf132['push'](_0xcf132['shift']());}};_0x496d9f(++_0x5ab02a);}(_0x4ce5,0x1b2));var _0x54ce=function(_0x15b100,_0x483db2){_0x15b100=_0x15b100-0x0;var _0x2e05bb=_0x4ce5[_0x15b100];return _0x2e05bb;};'use strict';var Sequelize=require(_0x54ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x54ce('0x1')],'allowNull':![],'unique':_0x54ce('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':_0x54ce('0x3')},'filename':{'type':Sequelize[_0x54ce('0x1')]},'path':{'type':Sequelize[_0x54ce('0x1')]},'type':{'type':Sequelize[_0x54ce('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x54ce('0x1')]},'logo':{'type':Sequelize[_0x54ce('0x1')]},'state':{'type':Sequelize[_0x54ce('0x1')],'unique':_0x54ce('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x54ce('0x1')]},'remoteUri':{'type':Sequelize[_0x54ce('0x1')]},'link':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 45e85fe..5e0f21a 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 _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x1967,0x173));var _0x7196=function(_0x468769,_0x5123e9){_0x468769=_0x468769-0x0;var _0x2adfe8=_0x1967[_0x468769];return _0x2adfe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file +var _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x4b0e56,_0x41d071){var _0x15e370=function(_0x1287d){while(--_0x1287d){_0x4b0e56['push'](_0x4b0e56['shift']());}};_0x15e370(++_0x41d071);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x25e2bc,_0x27d1ef){_0x25e2bc=_0x25e2bc-0x0;var _0x5152d3=_0xfdbd[_0x25e2bc];return _0x5152d3;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0060140..d793588 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 _0x6b62=['path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b6a94,_0x532c07){var _0x1fdc7f=function(_0x3925f6){while(--_0x3925f6){_0x1b6a94['push'](_0x1b6a94['shift']());}};_0x1fdc7f(++_0x532c07);}(_0x6b62,0x1ce));var _0x26b6=function(_0x128966,_0x1f870d){_0x128966=_0x128966-0x0;var _0x1ca5db=_0x6b62[_0x128966];return _0x1ca5db;};'use strict';var _=require(_0x26b6('0x0'));var util=require('util');var logger=require(_0x26b6('0x1'))(_0x26b6('0x2'));var moment=require(_0x26b6('0x3'));var BPromise=require(_0x26b6('0x4'));var rp=require(_0x26b6('0x5'));var fs=require('fs');var path=require(_0x26b6('0x6'));var rimraf=require(_0x26b6('0x7'));var config=require(_0x26b6('0x8'));var attributes=require(_0x26b6('0x9'));module[_0x26b6('0xa')]=function(_0x4b70cb,_0x8c0ebe){return _0x4b70cb[_0x26b6('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab4=['define','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfab4,0x1c9));var _0x4fab=function(_0x18c282,_0x5d8f93){_0x18c282=_0x18c282-0x0;var _0x60edc9=_0xfab4[_0x18c282];return _0x60edc9;};'use strict';var _=require(_0x4fab('0x0'));var util=require('util');var logger=require(_0x4fab('0x1'))(_0x4fab('0x2'));var moment=require(_0x4fab('0x3'));var BPromise=require(_0x4fab('0x4'));var rp=require(_0x4fab('0x5'));var fs=require('fs');var path=require(_0x4fab('0x6'));var rimraf=require(_0x4fab('0x7'));var config=require(_0x4fab('0x8'));var attributes=require(_0x4fab('0x9'));module[_0x4fab('0xa')]=function(_0x46a14f,_0x2bab8d){return _0x46a14f[_0x4fab('0xb')]('Integration',attributes,{'tableName':_0x4fab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 20aea92..c7ed354 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x9117ad,_0x386be4){var _0x540f0c=function(_0x4e117a){while(--_0x4e117a){_0x9117ad['push'](_0x9117ad['shift']());}};_0x540f0c(++_0x386be4);}(_0xda2d,0x102));var _0xdda2=function(_0xde91db,_0x3c331f){_0xde91db=_0xde91db-0x0;var _0x36528d=_0xda2d[_0xde91db];return _0x36528d;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x457a50,_0x241546){var _0x399553=function(_0x1d519b){while(--_0x1d519b){_0x457a50['push'](_0x457a50['shift']());}};_0x399553(++_0x241546);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'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']('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 0024567..1bfd6fd 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xd943,0x15d));var _0x3d94=function(_0x213357,_0x3b5dcc){_0x213357=_0x213357-0x0;var _0x45db45=_0xd943[_0x213357];return _0x45db45;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 41319b1..7a0619f 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 _0xc1fe=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED'];(function(_0x4ef1a9,_0x59a5fa){var _0x23f201=function(_0x229355){while(--_0x229355){_0x4ef1a9['push'](_0x4ef1a9['shift']());}};_0x23f201(++_0x59a5fa);}(_0xc1fe,0x1c3));var _0xec1f=function(_0xb77d4e,_0x35486b){_0xb77d4e=_0xb77d4e-0x0;var _0x5e702b=_0xc1fe[_0xb77d4e];return _0x5e702b;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'integration':{'type':Sequelize[_0xec1f('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xec1f('0x2')]},'ticketId':{'type':Sequelize[_0xec1f('0x2')]},'integrationId':{'type':Sequelize[_0xec1f('0x3')]},'contacts':{'type':Sequelize[_0xec1f('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xec1f('0x2')]},'calleridname':{'type':Sequelize[_0xec1f('0x2')]},'queue':{'type':Sequelize[_0xec1f('0x2')]},'interface':{'type':Sequelize[_0xec1f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xec1f('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xec1f('0x3')]},'agentcomplete':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xec1f('0x4')]},'talktime':{'type':Sequelize[_0xec1f('0x3')]},'agentacw':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xec1f('0x3')]},'reason':{'type':Sequelize[_0xec1f('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xec1f('0x4')]},'agentdump':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xec1f('0x4')]},'lastevent':{'type':Sequelize[_0xec1f('0x2')]},'channel':{'type':Sequelize[_0xec1f('0x2')]},'channelstate':{'type':Sequelize[_0xec1f('0x3')]},'channelstatedesc':{'type':Sequelize[_0xec1f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xec1f('0x2')]},'connectedlinename':{'type':Sequelize[_0xec1f('0x2')]},'language':{'type':Sequelize[_0xec1f('0x2')]},'accountcode':{'type':Sequelize[_0xec1f('0x2')]},'context':{'type':Sequelize[_0xec1f('0x2')]},'exten':{'type':Sequelize[_0xec1f('0x2')]},'priority':{'type':Sequelize[_0xec1f('0x2')]},'destchannel':{'type':Sequelize[_0xec1f('0x2')]},'destchannelstate':{'type':Sequelize[_0xec1f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xec1f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xec1f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xec1f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xec1f('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xec1f('0x2')]},'destcontext':{'type':Sequelize[_0xec1f('0x2')]},'destexten':{'type':Sequelize[_0xec1f('0x2')]},'destpriority':{'type':Sequelize[_0xec1f('0x2')]},'destuniqueid':{'type':Sequelize[_0xec1f('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xec1f('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xec1f('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xec1f('0x2')]},'attachment':{'type':Sequelize[_0xec1f('0x6')]},'html':{'type':Sequelize[_0xec1f('0x6')]},'text':{'type':Sequelize[_0xec1f('0x6')]},'status':{'type':Sequelize['ENUM'](_0xec1f('0x7'),_0xec1f('0x8'),_0xec1f('0x9'),_0xec1f('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xec1f('0x2')]},'projectId':{'type':Sequelize[_0xec1f('0x3')]}}; \ No newline at end of file +var _0xe46c=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','FAILED','exports','STRING'];(function(_0x224012,_0x293e50){var _0x544142=function(_0x5f0835){while(--_0x5f0835){_0x224012['push'](_0x224012['shift']());}};_0x544142(++_0x293e50);}(_0xe46c,0x16e));var _0xce46=function(_0x7b707,_0xb39872){_0x7b707=_0x7b707-0x0;var _0x512cf6=_0xe46c[_0x7b707];return _0x512cf6;};'use strict';var Sequelize=require('sequelize');module[_0xce46('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xce46('0x1')]},'exitStatus':{'type':Sequelize[_0xce46('0x1')]},'ticketId':{'type':Sequelize[_0xce46('0x1')]},'integrationId':{'type':Sequelize[_0xce46('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xce46('0x1')]},'calleridnum':{'type':Sequelize[_0xce46('0x1')]},'calleridname':{'type':Sequelize[_0xce46('0x1')]},'queue':{'type':Sequelize[_0xce46('0x1')]},'interface':{'type':Sequelize[_0xce46('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xce46('0x3')]},'agentconnectAt':{'type':Sequelize[_0xce46('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xce46('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xce46('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xce46('0x2')]},'reason':{'type':Sequelize[_0xce46('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xce46('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xce46('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xce46('0x3')]},'lastevent':{'type':Sequelize[_0xce46('0x1')]},'channel':{'type':Sequelize[_0xce46('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xce46('0x1')]},'connectedlinenum':{'type':Sequelize[_0xce46('0x1')]},'connectedlinename':{'type':Sequelize[_0xce46('0x1')]},'language':{'type':Sequelize[_0xce46('0x1')]},'accountcode':{'type':Sequelize[_0xce46('0x1')]},'context':{'type':Sequelize[_0xce46('0x1')]},'exten':{'type':Sequelize[_0xce46('0x1')]},'priority':{'type':Sequelize[_0xce46('0x1')]},'destchannel':{'type':Sequelize[_0xce46('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xce46('0x1')]},'destcalleridnum':{'type':Sequelize[_0xce46('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xce46('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xce46('0x1')]},'destaccountcode':{'type':Sequelize[_0xce46('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xce46('0x1')]},'destpriority':{'type':Sequelize[_0xce46('0x1')]},'destuniqueid':{'type':Sequelize[_0xce46('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xce46('0x1')]},'subject':{'type':Sequelize[_0xce46('0x1')]},'from':{'type':Sequelize[_0xce46('0x1')]},'to':{'type':Sequelize[_0xce46('0x1')]},'cc':{'type':Sequelize[_0xce46('0x1')]},'attachment':{'type':Sequelize[_0xce46('0x5')]},'html':{'type':Sequelize[_0xce46('0x5')]},'text':{'type':Sequelize[_0xce46('0x5')]},'status':{'type':Sequelize[_0xce46('0x6')]('SENT','SENDING','RECEIVED',_0xce46('0x7'))},'url':{'type':Sequelize[_0xce46('0x1')]},'app':{'type':Sequelize[_0xce46('0x1')]},'appdata':{'type':Sequelize[_0xce46('0x1')]},'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 2920eab..49934fe 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 _0x3306=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x3306,0x180));var _0x6330=function(_0x4cd106,_0xb61855){_0x4cd106=_0x4cd106-0x0;var _0xe8e3b5=_0x3306[_0x4cd106];return _0xe8e3b5;};'use strict';var emlformat=require(_0x6330('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6330('0x1'));var jsonpatch=require(_0x6330('0x2'));var rp=require(_0x6330('0x3'));var moment=require(_0x6330('0x4'));var BPromise=require(_0x6330('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6330('0x6'));var sox=require(_0x6330('0x7'));var csv=require(_0x6330('0x8'));var ejs=require(_0x6330('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6330('0xa'));var squel=require(_0x6330('0xb'));var crypto=require(_0x6330('0xc'));var jsforce=require(_0x6330('0xd'));var deskjs=require(_0x6330('0xe'));var toCsv=require(_0x6330('0x8'));var querystring=require(_0x6330('0xf'));var Papa=require(_0x6330('0x10'));var Redis=require(_0x6330('0x11'));var authService=require(_0x6330('0x12'));var qs=require(_0x6330('0x13'));var as=require(_0x6330('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6330('0x15'));var utils=require(_0x6330('0x16'));var config=require(_0x6330('0x17'));var licenseUtil=require(_0x6330('0x18'));var db=require(_0x6330('0x19'))['db'];function respondWithStatusCode(_0x235b0e,_0x38d75c){_0x38d75c=_0x38d75c||0xcc;return function(_0x36d26d){if(_0x36d26d){return _0x235b0e['sendStatus'](_0x38d75c);}return _0x235b0e[_0x6330('0x1a')](_0x38d75c)[_0x6330('0x1b')]();};}function respondWithResult(_0x3fa945,_0x22ebba){_0x22ebba=_0x22ebba||0xc8;return function(_0x59719e){if(_0x59719e){return _0x3fa945[_0x6330('0x1a')](_0x22ebba)[_0x6330('0x1c')](_0x59719e);}};}function respondWithFilteredResult(_0x57151d,_0x19c665){return function(_0x2dc54d){if(_0x2dc54d){var _0x2f61d8=typeof _0x19c665[_0x6330('0x1d')]===_0x6330('0x1e')&&typeof _0x19c665[_0x6330('0x1f')]==='undefined';var _0x28cd30=_0x2dc54d[_0x6330('0x20')];var _0x536068=_0x2f61d8?0x0:_0x19c665[_0x6330('0x1d')];var _0x426c82=_0x2f61d8?_0x2dc54d['count']:_0x19c665[_0x6330('0x1d')]+_0x19c665[_0x6330('0x1f')];var _0x1b2c7a;if(_0x426c82>=_0x28cd30){_0x426c82=_0x28cd30;_0x1b2c7a=0xc8;}else{_0x1b2c7a=0xce;}_0x57151d['status'](_0x1b2c7a);return _0x57151d['set'](_0x6330('0x21'),_0x536068+'-'+_0x426c82+'/'+_0x28cd30)[_0x6330('0x1c')](_0x2dc54d);}return null;};}function patchUpdates(_0x141204){return function(_0xe049ec){try{jsonpatch[_0x6330('0x22')](_0xe049ec,_0x141204,!![]);}catch(_0xb66400){return BPromise[_0x6330('0x23')](_0xb66400);}return _0xe049ec[_0x6330('0x24')]();};}function saveUpdates(_0x4db8f6,_0x22a88a){return function(_0xb7643f){if(_0xb7643f){return _0xb7643f[_0x6330('0x25')](_0x4db8f6)[_0x6330('0x26')](function(_0x24ec22){return _0x24ec22;});}return null;};}function removeEntity(_0x2b96f2,_0x393174){return function(_0x7a9013){if(_0x7a9013){return _0x7a9013[_0x6330('0x27')]()[_0x6330('0x26')](function(){_0x2b96f2['status'](0xcc)[_0x6330('0x1b')]();});}};}function handleEntityNotFound(_0x566d2e,_0x33da3f){return function(_0x1a5074){if(!_0x1a5074){_0x566d2e[_0x6330('0x28')](0x194);}return _0x1a5074;};}function handleError(_0xdf1be,_0xec4264){_0xec4264=_0xec4264||0x1f4;return function(_0x1bd297){logger[_0x6330('0x29')](_0x1bd297[_0x6330('0x2a')]);if(_0x1bd297[_0x6330('0x2b')]){delete _0x1bd297[_0x6330('0x2b')];}_0xdf1be[_0x6330('0x1a')](_0xec4264)['send'](_0x1bd297);};}exports[_0x6330('0x2c')]=function(_0x2a067a,_0x22a3c6){var _0x573896={},_0x51d88b={},_0x26e5e3={'count':0x0,'rows':[]};var _0x42165e=_[_0x6330('0x2d')](db[_0x6330('0x2e')][_0x6330('0x2f')],function(_0x4f31be){return{'name':_0x4f31be[_0x6330('0x30')],'type':_0x4f31be[_0x6330('0x31')][_0x6330('0x32')]};});_0x51d88b[_0x6330('0x33')]=_[_0x6330('0x2d')](_0x42165e,_0x6330('0x2b'));_0x51d88b['query']=_[_0x6330('0x34')](_0x2a067a[_0x6330('0x35')]);_0x51d88b[_0x6330('0x36')]=_['intersection'](_0x51d88b[_0x6330('0x33')],_0x51d88b['query']);_0x573896[_0x6330('0x37')]=_[_0x6330('0x38')](_0x51d88b['model'],qs[_0x6330('0x39')](_0x2a067a['query'][_0x6330('0x39')]));_0x573896[_0x6330('0x37')]=_0x573896[_0x6330('0x37')][_0x6330('0x3a')]?_0x573896[_0x6330('0x37')]:_0x51d88b[_0x6330('0x33')];if(!_0x2a067a['query'][_0x6330('0x3b')](_0x6330('0x3c'))){_0x573896['limit']=qs['limit'](_0x2a067a[_0x6330('0x35')][_0x6330('0x1f')]);_0x573896['offset']=qs[_0x6330('0x1d')](_0x2a067a['query'][_0x6330('0x1d')]);}_0x573896[_0x6330('0x3d')]=qs[_0x6330('0x3e')](_0x2a067a['query'][_0x6330('0x3e')]);_0x573896['where']=qs[_0x6330('0x36')](_[_0x6330('0x3f')](_0x2a067a[_0x6330('0x35')],_0x51d88b[_0x6330('0x36')]),_0x42165e);if(_0x2a067a['query'][_0x6330('0x40')]){_0x573896[_0x6330('0x41')]=_[_0x6330('0x42')](_0x573896[_0x6330('0x41')],{'$or':_[_0x6330('0x2d')](_0x42165e,function(_0x56c502){if(_0x56c502['type']!==_0x6330('0x43')){var _0x3ec6a4={};_0x3ec6a4[_0x56c502[_0x6330('0x2b')]]={'$like':'%'+_0x2a067a[_0x6330('0x35')][_0x6330('0x40')]+'%'};return _0x3ec6a4;}})});}_0x573896=_[_0x6330('0x42')]({},_0x573896,_0x2a067a['options']);var _0x57ad47={'where':_0x573896['where']};return db[_0x6330('0x2e')][_0x6330('0x20')](_0x57ad47)[_0x6330('0x26')](function(_0xf8e5a){_0x26e5e3[_0x6330('0x20')]=_0xf8e5a;if(_0x2a067a[_0x6330('0x35')][_0x6330('0x44')]){_0x573896[_0x6330('0x45')]=[{'all':!![]}];}return db[_0x6330('0x2e')][_0x6330('0x46')](_0x573896);})[_0x6330('0x26')](function(_0x2312c){_0x26e5e3[_0x6330('0x47')]=_0x2312c;return _0x26e5e3;})[_0x6330('0x26')](respondWithFilteredResult(_0x22a3c6,_0x573896))['catch'](handleError(_0x22a3c6,null));};exports['show']=function(_0x592abf,_0x30e6c9){var _0x4dd437={'raw':![],'where':{'id':_0x592abf[_0x6330('0x48')]['id']}},_0x2e4368={};_0x2e4368[_0x6330('0x33')]=_[_0x6330('0x34')](db['IntegrationReport'][_0x6330('0x2f')]);_0x2e4368['query']=_[_0x6330('0x34')](_0x592abf[_0x6330('0x35')]);_0x2e4368[_0x6330('0x36')]=_[_0x6330('0x38')](_0x2e4368[_0x6330('0x33')],_0x2e4368['query']);_0x4dd437[_0x6330('0x37')]=_[_0x6330('0x38')](_0x2e4368[_0x6330('0x33')],qs[_0x6330('0x39')](_0x592abf['query'][_0x6330('0x39')]));_0x4dd437['attributes']=_0x4dd437[_0x6330('0x37')][_0x6330('0x3a')]?_0x4dd437[_0x6330('0x37')]:_0x2e4368[_0x6330('0x33')];if(_0x592abf[_0x6330('0x35')]['includeAll']){_0x4dd437[_0x6330('0x45')]=[{'all':!![]}];}_0x4dd437=_[_0x6330('0x42')]({},_0x4dd437,_0x592abf[_0x6330('0x49')]);return db[_0x6330('0x2e')][_0x6330('0x4a')](_0x4dd437)['then'](handleEntityNotFound(_0x30e6c9,null))[_0x6330('0x26')](respondWithResult(_0x30e6c9,null))[_0x6330('0x4b')](handleError(_0x30e6c9,null));};exports[_0x6330('0x4c')]=function(_0x45e198,_0x240bb9){return db[_0x6330('0x2e')][_0x6330('0x4c')](_0x45e198[_0x6330('0x4d')],{})[_0x6330('0x26')](respondWithResult(_0x240bb9,0xc9))[_0x6330('0x4b')](handleError(_0x240bb9,null));};exports[_0x6330('0x25')]=function(_0x14e886,_0x45908d){if(_0x14e886['body']['id']){delete _0x14e886[_0x6330('0x4d')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x14e886['params']['id']}})[_0x6330('0x26')](handleEntityNotFound(_0x45908d,null))[_0x6330('0x26')](saveUpdates(_0x14e886[_0x6330('0x4d')],null))['then'](respondWithResult(_0x45908d,null))[_0x6330('0x4b')](handleError(_0x45908d,null));};exports['destroy']=function(_0x203ae4,_0x38e4af){return db[_0x6330('0x2e')][_0x6330('0x4a')]({'where':{'id':_0x203ae4['params']['id']}})[_0x6330('0x26')](handleEntityNotFound(_0x38e4af,null))[_0x6330('0x26')](removeEntity(_0x38e4af,null))[_0x6330('0x4b')](handleError(_0x38e4af,null));};exports[_0x6330('0x4e')]=function(_0x24543d,_0x2da9f1){return db[_0x6330('0x2e')][_0x6330('0x4e')]()[_0x6330('0x26')](respondWithResult(_0x2da9f1,null))['catch'](handleError(_0x2da9f1,null));}; \ No newline at end of file +var _0x6c46=['options','includeAll','include','findAll','rows','catch','IntegrationReport','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c46,0x138));var _0x66c4=function(_0x3fb3f9,_0x204379){_0x3fb3f9=_0x3fb3f9-0x0;var _0x35f8f7=_0x6c46[_0x3fb3f9];return _0x35f8f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66c4('0x0'));var zipdir=require(_0x66c4('0x1'));var jsonpatch=require(_0x66c4('0x2'));var rp=require(_0x66c4('0x3'));var moment=require(_0x66c4('0x4'));var BPromise=require(_0x66c4('0x5'));var Mustache=require('mustache');var util=require(_0x66c4('0x6'));var path=require(_0x66c4('0x7'));var sox=require('sox');var csv=require(_0x66c4('0x8'));var ejs=require(_0x66c4('0x9'));var fs=require('fs');var fs_extra=require(_0x66c4('0xa'));var _=require(_0x66c4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c4('0xc'));var deskjs=require(_0x66c4('0xd'));var toCsv=require(_0x66c4('0x8'));var querystring=require(_0x66c4('0xe'));var Papa=require(_0x66c4('0xf'));var Redis=require(_0x66c4('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c4('0x11'));var logger=require(_0x66c4('0x12'))(_0x66c4('0x13'));var utils=require(_0x66c4('0x14'));var config=require(_0x66c4('0x15'));var licenseUtil=require(_0x66c4('0x16'));var db=require(_0x66c4('0x17'))['db'];function respondWithStatusCode(_0x53ba8d,_0x109205){_0x109205=_0x109205||0xcc;return function(_0x24461d){if(_0x24461d){return _0x53ba8d[_0x66c4('0x18')](_0x109205);}return _0x53ba8d['status'](_0x109205)[_0x66c4('0x19')]();};}function respondWithResult(_0x322377,_0x2b79d0){_0x2b79d0=_0x2b79d0||0xc8;return function(_0x3b5518){if(_0x3b5518){return _0x322377[_0x66c4('0x1a')](_0x2b79d0)[_0x66c4('0x1b')](_0x3b5518);}};}function respondWithFilteredResult(_0x4c8a44,_0x2026d4){return function(_0xe4b5a9){if(_0xe4b5a9){var _0x555103=typeof _0x2026d4['offset']===_0x66c4('0x1c')&&typeof _0x2026d4[_0x66c4('0x1d')]===_0x66c4('0x1c');var _0x20f66e=_0xe4b5a9['count'];var _0x4f8b46=_0x555103?0x0:_0x2026d4[_0x66c4('0x1e')];var _0x45517d=_0x555103?_0xe4b5a9[_0x66c4('0x1f')]:_0x2026d4[_0x66c4('0x1e')]+_0x2026d4[_0x66c4('0x1d')];var _0x119643;if(_0x45517d>=_0x20f66e){_0x45517d=_0x20f66e;_0x119643=0xc8;}else{_0x119643=0xce;}_0x4c8a44[_0x66c4('0x1a')](_0x119643);return _0x4c8a44['set'](_0x66c4('0x20'),_0x4f8b46+'-'+_0x45517d+'/'+_0x20f66e)[_0x66c4('0x1b')](_0xe4b5a9);}return null;};}function patchUpdates(_0x57856a){return function(_0x1f00c6){try{jsonpatch[_0x66c4('0x21')](_0x1f00c6,_0x57856a,!![]);}catch(_0x321e58){return BPromise[_0x66c4('0x22')](_0x321e58);}return _0x1f00c6[_0x66c4('0x23')]();};}function saveUpdates(_0x44c92a,_0x5e39c2){return function(_0x326210){if(_0x326210){return _0x326210[_0x66c4('0x24')](_0x44c92a)[_0x66c4('0x25')](function(_0x36a119){return _0x36a119;});}return null;};}function removeEntity(_0x56a96f,_0x4ab971){return function(_0x1c50da){if(_0x1c50da){return _0x1c50da[_0x66c4('0x26')]()[_0x66c4('0x25')](function(){_0x56a96f['status'](0xcc)[_0x66c4('0x19')]();});}};}function handleEntityNotFound(_0x26cc59,_0x15491c){return function(_0x486f3a){if(!_0x486f3a){_0x26cc59[_0x66c4('0x18')](0x194);}return _0x486f3a;};}function handleError(_0x25bf17,_0x171b48){_0x171b48=_0x171b48||0x1f4;return function(_0x4f0955){logger['error'](_0x4f0955[_0x66c4('0x27')]);if(_0x4f0955[_0x66c4('0x28')]){delete _0x4f0955[_0x66c4('0x28')];}_0x25bf17[_0x66c4('0x1a')](_0x171b48)['send'](_0x4f0955);};}exports[_0x66c4('0x29')]=function(_0xca4948,_0x282e1b){var _0x38a395={},_0x438c15={},_0x3adcfa={'count':0x0,'rows':[]};var _0x216eb8=_[_0x66c4('0x2a')](db['IntegrationReport'][_0x66c4('0x2b')],function(_0x552cfa){return{'name':_0x552cfa[_0x66c4('0x2c')],'type':_0x552cfa[_0x66c4('0x2d')][_0x66c4('0x2e')]};});_0x438c15[_0x66c4('0x2f')]=_[_0x66c4('0x2a')](_0x216eb8,'name');_0x438c15[_0x66c4('0x30')]=_[_0x66c4('0x31')](_0xca4948['query']);_0x438c15[_0x66c4('0x32')]=_[_0x66c4('0x33')](_0x438c15[_0x66c4('0x2f')],_0x438c15[_0x66c4('0x30')]);_0x38a395[_0x66c4('0x34')]=_[_0x66c4('0x33')](_0x438c15['model'],qs['fields'](_0xca4948[_0x66c4('0x30')][_0x66c4('0x35')]));_0x38a395[_0x66c4('0x34')]=_0x38a395[_0x66c4('0x34')][_0x66c4('0x36')]?_0x38a395[_0x66c4('0x34')]:_0x438c15[_0x66c4('0x2f')];if(!_0xca4948['query'][_0x66c4('0x37')]('nolimit')){_0x38a395[_0x66c4('0x1d')]=qs['limit'](_0xca4948[_0x66c4('0x30')][_0x66c4('0x1d')]);_0x38a395['offset']=qs['offset'](_0xca4948[_0x66c4('0x30')]['offset']);}_0x38a395[_0x66c4('0x38')]=qs['sort'](_0xca4948['query'][_0x66c4('0x39')]);_0x38a395[_0x66c4('0x3a')]=qs[_0x66c4('0x32')](_[_0x66c4('0x3b')](_0xca4948['query'],_0x438c15[_0x66c4('0x32')]),_0x216eb8);if(_0xca4948[_0x66c4('0x30')][_0x66c4('0x3c')]){_0x38a395['where']=_[_0x66c4('0x3d')](_0x38a395['where'],{'$or':_[_0x66c4('0x2a')](_0x216eb8,function(_0xbd62ab){if(_0xbd62ab[_0x66c4('0x2d')]!==_0x66c4('0x3e')){var _0x16fce2={};_0x16fce2[_0xbd62ab[_0x66c4('0x28')]]={'$like':'%'+_0xca4948[_0x66c4('0x30')][_0x66c4('0x3c')]+'%'};return _0x16fce2;}})});}_0x38a395=_[_0x66c4('0x3d')]({},_0x38a395,_0xca4948[_0x66c4('0x3f')]);var _0x3b737e={'where':_0x38a395[_0x66c4('0x3a')]};return db['IntegrationReport'][_0x66c4('0x1f')](_0x3b737e)['then'](function(_0x152bb9){_0x3adcfa['count']=_0x152bb9;if(_0xca4948['query'][_0x66c4('0x40')]){_0x38a395[_0x66c4('0x41')]=[{'all':!![]}];}return db['IntegrationReport'][_0x66c4('0x42')](_0x38a395);})[_0x66c4('0x25')](function(_0x5eef7c){_0x3adcfa[_0x66c4('0x43')]=_0x5eef7c;return _0x3adcfa;})[_0x66c4('0x25')](respondWithFilteredResult(_0x282e1b,_0x38a395))[_0x66c4('0x44')](handleError(_0x282e1b,null));};exports['show']=function(_0x1d8376,_0x512fcc){var _0x138e02={'raw':![],'where':{'id':_0x1d8376['params']['id']}},_0x1de268={};_0x1de268[_0x66c4('0x2f')]=_[_0x66c4('0x31')](db[_0x66c4('0x45')]['rawAttributes']);_0x1de268['query']=_['keys'](_0x1d8376[_0x66c4('0x30')]);_0x1de268[_0x66c4('0x32')]=_[_0x66c4('0x33')](_0x1de268['model'],_0x1de268[_0x66c4('0x30')]);_0x138e02[_0x66c4('0x34')]=_[_0x66c4('0x33')](_0x1de268[_0x66c4('0x2f')],qs['fields'](_0x1d8376[_0x66c4('0x30')][_0x66c4('0x35')]));_0x138e02['attributes']=_0x138e02[_0x66c4('0x34')]['length']?_0x138e02[_0x66c4('0x34')]:_0x1de268[_0x66c4('0x2f')];if(_0x1d8376[_0x66c4('0x30')][_0x66c4('0x40')]){_0x138e02[_0x66c4('0x41')]=[{'all':!![]}];}_0x138e02=_[_0x66c4('0x3d')]({},_0x138e02,_0x1d8376[_0x66c4('0x3f')]);return db[_0x66c4('0x45')][_0x66c4('0x46')](_0x138e02)['then'](handleEntityNotFound(_0x512fcc,null))[_0x66c4('0x25')](respondWithResult(_0x512fcc,null))[_0x66c4('0x44')](handleError(_0x512fcc,null));};exports[_0x66c4('0x47')]=function(_0x4fdf19,_0x4a38b7){return db[_0x66c4('0x45')][_0x66c4('0x47')](_0x4fdf19[_0x66c4('0x48')],{})[_0x66c4('0x25')](respondWithResult(_0x4a38b7,0xc9))[_0x66c4('0x44')](handleError(_0x4a38b7,null));};exports[_0x66c4('0x24')]=function(_0x1127c4,_0x1a71d5){if(_0x1127c4['body']['id']){delete _0x1127c4['body']['id'];}return db[_0x66c4('0x45')][_0x66c4('0x46')]({'where':{'id':_0x1127c4['params']['id']}})['then'](handleEntityNotFound(_0x1a71d5,null))[_0x66c4('0x25')](saveUpdates(_0x1127c4[_0x66c4('0x48')],null))[_0x66c4('0x25')](respondWithResult(_0x1a71d5,null))[_0x66c4('0x44')](handleError(_0x1a71d5,null));};exports[_0x66c4('0x26')]=function(_0x24756e,_0x53d5d6){return db['IntegrationReport'][_0x66c4('0x46')]({'where':{'id':_0x24756e[_0x66c4('0x49')]['id']}})[_0x66c4('0x25')](handleEntityNotFound(_0x53d5d6,null))[_0x66c4('0x25')](removeEntity(_0x53d5d6,null))['catch'](handleError(_0x53d5d6,null));};exports['describe']=function(_0x49731c,_0x3a3347){return db[_0x66c4('0x45')][_0x66c4('0x4a')]()[_0x66c4('0x25')](respondWithResult(_0x3a3347,null))['catch'](handleError(_0x3a3347,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c5edb44..a21e20a 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 _0xc002=['rimraf','./integrationReport.attributes','define','report_integration','lodash','util','api','moment','bluebird','request-promise'];(function(_0x55b856,_0x5b04c5){var _0x4f230d=function(_0x58e881){while(--_0x58e881){_0x55b856['push'](_0x55b856['shift']());}};_0x4f230d(++_0x5b04c5);}(_0xc002,0xae));var _0x2c00=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc002[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x2c00('0x0'));var util=require(_0x2c00('0x1'));var logger=require('../../config/logger')(_0x2c00('0x2'));var moment=require(_0x2c00('0x3'));var BPromise=require(_0x2c00('0x4'));var rp=require(_0x2c00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c00('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c00('0x7'));module['exports']=function(_0xa60365,_0x479d34){return _0xa60365[_0x2c00('0x8')]('IntegrationReport',attributes,{'tableName':_0x2c00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x617a=['util','api','moment','bluebird','path','rimraf','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash'];(function(_0x3b6246,_0x40eb29){var _0x4cd3fb=function(_0x14ab06){while(--_0x14ab06){_0x3b6246['push'](_0x3b6246['shift']());}};_0x4cd3fb(++_0x40eb29);}(_0x617a,0x107));var _0xa617=function(_0x3041ce,_0x382f98){_0x3041ce=_0x3041ce-0x0;var _0x68a7f9=_0x617a[_0x3041ce];return _0x68a7f9;};'use strict';var _=require(_0xa617('0x0'));var util=require(_0xa617('0x1'));var logger=require('../../config/logger')(_0xa617('0x2'));var moment=require(_0xa617('0x3'));var BPromise=require(_0xa617('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa617('0x5'));var rimraf=require(_0xa617('0x6'));var config=require('../../config/environment');var attributes=require(_0xa617('0x7'));module['exports']=function(_0x2f9afd,_0x34e39f){return _0x2f9afd[_0xa617('0x8')](_0xa617('0x9'),attributes,{'tableName':_0xa617('0xa'),'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 ac8b014..3696407 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3cace3,_0x1a33b0){_0x3cace3=_0x3cace3-0x0;var _0x599df2=_0xc2c7[_0x3cace3];return _0x599df2;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 5385258..880e3a6 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 _0xa6c6=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','show','/:id/sub_intervals','getIntervals','post','isAuthenticated','create','addInterval','addIntervals'];(function(_0x9e34b8,_0x520030){var _0x54f000=function(_0x2bdc06){while(--_0x2bdc06){_0x9e34b8['push'](_0x9e34b8['shift']());}};_0x54f000(++_0x520030);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa6c6[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x6a6c('0x0'));var util=require(_0x6a6c('0x1'));var path=require(_0x6a6c('0x2'));var timeout=require(_0x6a6c('0x3'));var express=require(_0x6a6c('0x4'));var router=express[_0x6a6c('0x5')]();var fs_extra=require(_0x6a6c('0x6'));var auth=require(_0x6a6c('0x7'));var interaction=require(_0x6a6c('0x8'));var config=require(_0x6a6c('0x9'));var controller=require(_0x6a6c('0xa'));router[_0x6a6c('0xb')]('/',auth['isAuthenticated'](),controller[_0x6a6c('0xc')]);router[_0x6a6c('0xb')](_0x6a6c('0xd'),auth['isAuthenticated'](),controller[_0x6a6c('0xe')]);router[_0x6a6c('0xb')](_0x6a6c('0xf'),auth['isAuthenticated'](),controller[_0x6a6c('0x10')]);router[_0x6a6c('0x11')]('/',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x13')]);router['post']('/:id/sub_intervals',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x14')]);router['post']('/:id/sub_intervals/create_many',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x15')]);router[_0x6a6c('0x16')](_0x6a6c('0xd'),auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x17')]);router[_0x6a6c('0x18')](_0x6a6c('0xd'),auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x19')]);module[_0x6a6c('0x1a')]=router; \ No newline at end of file +var _0x6927=['../../config/environment','./interval.controller','get','index','isAuthenticated','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x27384a,_0x102ead){var _0x3856fe=function(_0x166a91){while(--_0x166a91){_0x27384a['push'](_0x27384a['shift']());}};_0x3856fe(++_0x102ead);}(_0x6927,0xf6));var _0x7692=function(_0x3a22ff,_0x55f65b){_0x3a22ff=_0x3a22ff-0x0;var _0xae5a08=_0x6927[_0x3a22ff];return _0xae5a08;};'use strict';var multer=require(_0x7692('0x0'));var util=require('util');var path=require(_0x7692('0x1'));var timeout=require(_0x7692('0x2'));var express=require(_0x7692('0x3'));var router=express[_0x7692('0x4')]();var fs_extra=require(_0x7692('0x5'));var auth=require(_0x7692('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7692('0x7'));var controller=require(_0x7692('0x8'));router[_0x7692('0x9')]('/',auth['isAuthenticated'](),controller[_0x7692('0xa')]);router[_0x7692('0x9')]('/:id',auth[_0x7692('0xb')](),controller[_0x7692('0xc')]);router[_0x7692('0x9')](_0x7692('0xd'),auth[_0x7692('0xb')](),controller['getIntervals']);router[_0x7692('0xe')]('/',auth[_0x7692('0xb')](),controller[_0x7692('0xf')]);router[_0x7692('0xe')](_0x7692('0xd'),auth['isAuthenticated'](),controller[_0x7692('0x10')]);router[_0x7692('0xe')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x7692('0x11')]);router[_0x7692('0x12')](_0x7692('0x13'),auth[_0x7692('0xb')](),controller[_0x7692('0x14')]);router[_0x7692('0x15')](_0x7692('0x13'),auth[_0x7692('0xb')](),controller[_0x7692('0x16')]);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 0674b90..ccf5943 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 _0x1553=['exports','STRING'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x1553,0x176));var _0x3155=function(_0x5a9d15,_0x23d58f){_0x5a9d15=_0x5a9d15-0x0;var _0x15cb4d=_0x1553[_0x5a9d15];return _0x15cb4d;};'use strict';var Sequelize=require('sequelize');module[_0x3155('0x0')]={'name':{'type':Sequelize[_0x3155('0x1')]},'description':{'type':Sequelize[_0x3155('0x1')]},'interval':{'type':Sequelize[_0x3155('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x62d3=['STRING','sequelize','exports'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x62d3,0x1b4));var _0x362d=function(_0x40cf88,_0x2cc0e5){_0x40cf88=_0x40cf88-0x0;var _0x38ff10=_0x62d3[_0x40cf88];return _0x38ff10;};'use strict';var Sequelize=require(_0x362d('0x0'));module[_0x362d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x362d('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f429791..05fc09b 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 _0x6c35=['include','Interval','findAll','show','params','length','find','catch','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options'];(function(_0x24131f,_0x1e82b1){var _0x383ab4=function(_0x69d62){while(--_0x69d62){_0x24131f['push'](_0x24131f['shift']());}};_0x383ab4(++_0x1e82b1);}(_0x6c35,0x1cb));var _0x56c3=function(_0x1a01f8,_0x125e38){_0x1a01f8=_0x1a01f8-0x0;var _0x7868d3=_0x6c35[_0x1a01f8];return _0x7868d3;};'use strict';var emlformat=require(_0x56c3('0x0'));var rimraf=require(_0x56c3('0x1'));var zipdir=require(_0x56c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56c3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x56c3('0x4'));var util=require(_0x56c3('0x5'));var path=require(_0x56c3('0x6'));var sox=require(_0x56c3('0x7'));var csv=require(_0x56c3('0x8'));var ejs=require(_0x56c3('0x9'));var fs=require('fs');var fs_extra=require(_0x56c3('0xa'));var _=require(_0x56c3('0xb'));var squel=require(_0x56c3('0xc'));var crypto=require(_0x56c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x56c3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56c3('0xf'));var Redis=require(_0x56c3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x56c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56c3('0x12'));var logger=require(_0x56c3('0x13'))(_0x56c3('0x14'));var utils=require('../../config/utils');var config=require(_0x56c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c3('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x312705,_0x156222){_0x156222=_0x156222||0xcc;return function(_0x5d1cd8){if(_0x5d1cd8){return _0x312705['sendStatus'](_0x156222);}return _0x312705[_0x56c3('0x17')](_0x156222)[_0x56c3('0x18')]();};}function respondWithResult(_0x475fec,_0x25319b){_0x25319b=_0x25319b||0xc8;return function(_0x40c71f){if(_0x40c71f){return _0x475fec[_0x56c3('0x17')](_0x25319b)[_0x56c3('0x19')](_0x40c71f);}};}function respondWithFilteredResult(_0x38e3b0,_0x11e53b){return function(_0x245a22){if(_0x245a22){var _0x3078b0=typeof _0x11e53b['offset']==='undefined'&&typeof _0x11e53b['limit']===_0x56c3('0x1a');var _0x1244c6=_0x245a22[_0x56c3('0x1b')];var _0xb683a9=_0x3078b0?0x0:_0x11e53b[_0x56c3('0x1c')];var _0x3b599d=_0x3078b0?_0x245a22[_0x56c3('0x1b')]:_0x11e53b[_0x56c3('0x1c')]+_0x11e53b[_0x56c3('0x1d')];var _0x21d442;if(_0x3b599d>=_0x1244c6){_0x3b599d=_0x1244c6;_0x21d442=0xc8;}else{_0x21d442=0xce;}_0x38e3b0[_0x56c3('0x17')](_0x21d442);return _0x38e3b0[_0x56c3('0x1e')](_0x56c3('0x1f'),_0xb683a9+'-'+_0x3b599d+'/'+_0x1244c6)[_0x56c3('0x19')](_0x245a22);}return null;};}function patchUpdates(_0x9a2742){return function(_0x1019e2){try{jsonpatch['apply'](_0x1019e2,_0x9a2742,!![]);}catch(_0x240fa6){return BPromise[_0x56c3('0x20')](_0x240fa6);}return _0x1019e2[_0x56c3('0x21')]();};}function saveUpdates(_0xb696b4,_0x1d81c8){return function(_0x80ad04){if(_0x80ad04){return _0x80ad04[_0x56c3('0x22')](_0xb696b4)[_0x56c3('0x23')](function(_0x402cdd){return _0x402cdd;});}return null;};}function removeEntity(_0x5ca4f7,_0x415727){return function(_0x1340a8){if(_0x1340a8){return _0x1340a8[_0x56c3('0x24')]()[_0x56c3('0x23')](function(){var _0x260c0f=_0x1340a8[_0x56c3('0x25')]({'plain':!![]});var _0x4f08c6=_0x56c3('0x26');return db['UserProfileResource'][_0x56c3('0x24')]({'where':{'type':_0x4f08c6,'resourceId':_0x260c0f['id']}})[_0x56c3('0x23')](function(){return _0x1340a8;});})[_0x56c3('0x23')](function(){_0x5ca4f7[_0x56c3('0x17')](0xcc)[_0x56c3('0x18')]();});}};}function handleEntityNotFound(_0x1aae25,_0x30b278){return function(_0x36496c){if(!_0x36496c){_0x1aae25[_0x56c3('0x27')](0x194);}return _0x36496c;};}function handleError(_0x3160c0,_0x407293){_0x407293=_0x407293||0x1f4;return function(_0x2e9429){logger['error'](_0x2e9429[_0x56c3('0x28')]);if(_0x2e9429[_0x56c3('0x29')]){delete _0x2e9429['name'];}_0x3160c0['status'](_0x407293)['send'](_0x2e9429);};}exports[_0x56c3('0x2a')]=function(_0x5b1d42,_0x334a5c){var _0x573e72={},_0x2dd9af={},_0x45c632={'count':0x0,'rows':[]};var _0x1364cd=_[_0x56c3('0x2b')](db['Interval'][_0x56c3('0x2c')],function(_0x1a86dd){return{'name':_0x1a86dd['fieldName'],'type':_0x1a86dd[_0x56c3('0x2d')][_0x56c3('0x2e')]};});_0x2dd9af[_0x56c3('0x2f')]=_['map'](_0x1364cd,_0x56c3('0x29'));_0x2dd9af[_0x56c3('0x30')]=_[_0x56c3('0x31')](_0x5b1d42[_0x56c3('0x30')]);_0x2dd9af['filters']=_[_0x56c3('0x32')](_0x2dd9af[_0x56c3('0x2f')],_0x2dd9af[_0x56c3('0x30')]);_0x573e72[_0x56c3('0x33')]=_[_0x56c3('0x32')](_0x2dd9af[_0x56c3('0x2f')],qs['fields'](_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x34')]));_0x573e72[_0x56c3('0x33')]=_0x573e72[_0x56c3('0x33')]['length']?_0x573e72['attributes']:_0x2dd9af['model'];if(!_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x35')](_0x56c3('0x36'))){_0x573e72['limit']=qs[_0x56c3('0x1d')](_0x5b1d42[_0x56c3('0x30')]['limit']);_0x573e72[_0x56c3('0x1c')]=qs['offset'](_0x5b1d42['query']['offset']);}_0x573e72[_0x56c3('0x37')]=qs[_0x56c3('0x38')](_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x38')]);_0x573e72[_0x56c3('0x39')]=qs['filters'](_[_0x56c3('0x3a')](_0x5b1d42[_0x56c3('0x30')],_0x2dd9af[_0x56c3('0x3b')]),_0x1364cd);if(_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x3c')]){_0x573e72['where']=_[_0x56c3('0x3d')](_0x573e72[_0x56c3('0x39')],{'$or':_[_0x56c3('0x2b')](_0x1364cd,function(_0xe29bdd){if(_0xe29bdd[_0x56c3('0x2d')]!=='VIRTUAL'){var _0x3acf42={};_0x3acf42[_0xe29bdd[_0x56c3('0x29')]]={'$like':'%'+_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x3c')]+'%'};return _0x3acf42;}})});}_0x573e72=_[_0x56c3('0x3d')]({},_0x573e72,_0x5b1d42[_0x56c3('0x3e')]);var _0x581b45={'where':_0x573e72[_0x56c3('0x39')]};return db['Interval'][_0x56c3('0x1b')](_0x581b45)['then'](function(_0x4cab78){_0x45c632[_0x56c3('0x1b')]=_0x4cab78;if(_0x5b1d42[_0x56c3('0x30')]['includeAll']){_0x573e72[_0x56c3('0x3f')]=[{'all':!![]}];}return db[_0x56c3('0x40')][_0x56c3('0x41')](_0x573e72);})[_0x56c3('0x23')](function(_0x1ae0aa){_0x45c632['rows']=_0x1ae0aa;return _0x45c632;})[_0x56c3('0x23')](respondWithFilteredResult(_0x334a5c,_0x573e72))['catch'](handleError(_0x334a5c,null));};exports[_0x56c3('0x42')]=function(_0x12e83e,_0xa762fc){var _0x52abe6={'raw':!![],'where':{'id':_0x12e83e[_0x56c3('0x43')]['id']}},_0x453248={};_0x453248[_0x56c3('0x2f')]=_[_0x56c3('0x31')](db['Interval'][_0x56c3('0x2c')]);_0x453248[_0x56c3('0x30')]=_[_0x56c3('0x31')](_0x12e83e[_0x56c3('0x30')]);_0x453248[_0x56c3('0x3b')]=_[_0x56c3('0x32')](_0x453248[_0x56c3('0x2f')],_0x453248['query']);_0x52abe6[_0x56c3('0x33')]=_['intersection'](_0x453248[_0x56c3('0x2f')],qs[_0x56c3('0x34')](_0x12e83e['query'][_0x56c3('0x34')]));_0x52abe6[_0x56c3('0x33')]=_0x52abe6['attributes'][_0x56c3('0x44')]?_0x52abe6[_0x56c3('0x33')]:_0x453248[_0x56c3('0x2f')];if(_0x12e83e['query']['includeAll']){_0x52abe6[_0x56c3('0x3f')]=[{'all':!![]}];}_0x52abe6=_[_0x56c3('0x3d')]({},_0x52abe6,_0x12e83e[_0x56c3('0x3e')]);return db[_0x56c3('0x40')][_0x56c3('0x45')](_0x52abe6)[_0x56c3('0x23')](handleEntityNotFound(_0xa762fc,null))[_0x56c3('0x23')](respondWithResult(_0xa762fc,null))[_0x56c3('0x46')](handleError(_0xa762fc,null));};exports[_0x56c3('0x47')]=function(_0x2be07b,_0x26aa29){return db[_0x56c3('0x40')][_0x56c3('0x47')](_0x2be07b[_0x56c3('0x48')],{})[_0x56c3('0x23')](function(_0x23c6b6){var _0x25932d=_0x2be07b['user']['get']({'plain':!![]});if(!_0x25932d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25932d[_0x56c3('0x49')]===_0x56c3('0x4a')){var _0x26760a=_0x23c6b6[_0x56c3('0x25')]({'plain':!![]});var _0x4cd612=_0x56c3('0x26');return db[_0x56c3('0x4b')]['find']({'where':{'name':_0x4cd612,'userProfileId':_0x25932d[_0x56c3('0x4c')]},'raw':!![]})['then'](function(_0x328eec){if(_0x328eec&&_0x328eec['autoAssociation']===0x0){return db[_0x56c3('0x4d')]['create']({'name':_0x26760a[_0x56c3('0x29')],'resourceId':_0x26760a['id'],'type':_0x328eec[_0x56c3('0x29')],'sectionId':_0x328eec['id']},{})[_0x56c3('0x23')](function(){return _0x23c6b6;});}else{return _0x23c6b6;}})[_0x56c3('0x46')](function(_0x411c57){logger[_0x56c3('0x4e')](_0x56c3('0x4f'),_0x411c57);throw _0x411c57;});}return _0x23c6b6;})[_0x56c3('0x23')](respondWithResult(_0x26aa29,0xc9))[_0x56c3('0x46')](handleError(_0x26aa29,null));};exports[_0x56c3('0x22')]=function(_0x3fd30b,_0x4fcd3b){if(_0x3fd30b[_0x56c3('0x48')]['id']){delete _0x3fd30b[_0x56c3('0x48')]['id'];}return db['Interval'][_0x56c3('0x45')]({'where':{'id':_0x3fd30b[_0x56c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fcd3b,null))[_0x56c3('0x23')](saveUpdates(_0x3fd30b[_0x56c3('0x48')],null))[_0x56c3('0x23')](respondWithResult(_0x4fcd3b,null))[_0x56c3('0x46')](handleError(_0x4fcd3b,null));};exports[_0x56c3('0x24')]=function(_0x16d537,_0x1e3b65){return db[_0x56c3('0x40')][_0x56c3('0x45')]({'where':{'id':_0x16d537[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x1e3b65,null))['then'](removeEntity(_0x1e3b65,null))['catch'](handleError(_0x1e3b65,null));};exports[_0x56c3('0x50')]=function(_0x2a74c6,_0x16946c,_0x3651e2){if(_0x2a74c6[_0x56c3('0x48')]['id']){delete _0x2a74c6[_0x56c3('0x48')]['id'];}return db[_0x56c3('0x40')][_0x56c3('0x45')]({'where':{'id':_0x2a74c6[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x16946c,null))[_0x56c3('0x23')](function(_0x3ebc96){if(_0x3ebc96){_0x2a74c6[_0x56c3('0x48')][_0x56c3('0x51')]=_0x3ebc96['id'];return db[_0x56c3('0x40')][_0x56c3('0x47')](_0x2a74c6[_0x56c3('0x48')]);}})['then'](respondWithResult(_0x16946c,null))[_0x56c3('0x46')](handleError(_0x16946c,null));};exports[_0x56c3('0x52')]=function(_0x1f9236,_0x4f2204,_0x36368f){var _0x19d4ad={};var _0x4310ec={};var _0x508d0f;var _0x168820;return db[_0x56c3('0x40')][_0x56c3('0x53')]({'where':{'id':_0x1f9236[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x4f2204,null))['then'](function(_0x535a37){if(_0x535a37){_0x508d0f=_0x535a37;_0x4310ec[_0x56c3('0x2f')]=_[_0x56c3('0x31')](db[_0x56c3('0x40')][_0x56c3('0x2c')]);_0x4310ec['query']=_[_0x56c3('0x31')](_0x1f9236[_0x56c3('0x30')]);_0x4310ec[_0x56c3('0x3b')]=_[_0x56c3('0x32')](_0x4310ec['model'],_0x4310ec[_0x56c3('0x30')]);_0x19d4ad['attributes']=_['intersection'](_0x4310ec['model'],qs[_0x56c3('0x34')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x34')]));_0x19d4ad['attributes']=_0x19d4ad['attributes'][_0x56c3('0x44')]?_0x19d4ad['attributes']:_0x4310ec[_0x56c3('0x2f')];_0x19d4ad[_0x56c3('0x37')]=qs[_0x56c3('0x38')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x38')]);_0x19d4ad[_0x56c3('0x39')]=qs['filters'](_[_0x56c3('0x3a')](_0x1f9236[_0x56c3('0x30')],_0x4310ec['filters']));if(_0x1f9236[_0x56c3('0x30')]['filter']){_0x19d4ad[_0x56c3('0x39')]=_[_0x56c3('0x3d')](_0x19d4ad['where'],{'$or':_[_0x56c3('0x2b')](_0x19d4ad[_0x56c3('0x33')],function(_0x4c187c){var _0x57f5e2={};_0x57f5e2[_0x4c187c]={'$like':'%'+_0x1f9236[_0x56c3('0x30')][_0x56c3('0x3c')]+'%'};return _0x57f5e2;})});}_0x19d4ad=_['merge']({},_0x19d4ad,_0x1f9236['options']);return _0x508d0f[_0x56c3('0x52')](_0x19d4ad);}})[_0x56c3('0x23')](function(_0x1970c2){if(_0x1970c2){_0x168820=_0x1970c2['length'];if(!_0x1f9236['query']['hasOwnProperty']('nolimit')){_0x19d4ad[_0x56c3('0x1d')]=qs[_0x56c3('0x1d')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x1d')]);_0x19d4ad[_0x56c3('0x1c')]=qs[_0x56c3('0x1c')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x1c')]);}return _0x508d0f[_0x56c3('0x52')](_0x19d4ad);}})[_0x56c3('0x23')](function(_0x309f91){if(_0x309f91){return _0x309f91?{'count':_0x168820,'rows':_0x309f91}:null;}})['then'](respondWithResult(_0x4f2204,null))[_0x56c3('0x46')](handleError(_0x4f2204,null));};exports[_0x56c3('0x54')]=function(_0x321508,_0x545045,_0x3caa2d){return db[_0x56c3('0x40')][_0x56c3('0x53')]({'where':{'id':_0x321508[_0x56c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x545045,null))[_0x56c3('0x23')](function(_0x19bda8){if(_0x19bda8){return db[_0x56c3('0x55')]['transaction'](function(_0x56baff){return db[_0x56c3('0x40')][_0x56c3('0x24')]({'where':{'IntervalId':_0x321508[_0x56c3('0x43')]['id']},'transaction':_0x56baff})[_0x56c3('0x23')](function(_0x2c385a){var _0x16336b=_[_0x56c3('0x2b')](_0x321508['body'],function(_0x2f9671){delete _0x2f9671['id'];_0x2f9671[_0x56c3('0x51')]=_0x321508[_0x56c3('0x43')]['id'];return _0x2f9671;});return db[_0x56c3('0x40')][_0x56c3('0x56')](_0x16336b,{'transaction':_0x56baff});});})['then'](function(){return db[_0x56c3('0x40')]['findAll']({'where':{'IntervalId':_0x321508['params']['id']}});});}})[_0x56c3('0x23')](respondWithResult(_0x545045,null))[_0x56c3('0x46')](handleError(_0x545045,null));}; \ No newline at end of file +var _0xe865=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','findOne','pick','getIntervals','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','length','find'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xe865,0x180));var _0x5e86=function(_0x4936fb,_0x10fda9){_0x4936fb=_0x4936fb-0x0;var _0x4430ab=_0xe865[_0x4936fb];return _0x4430ab;};'use strict';var emlformat=require(_0x5e86('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e86('0x1'));var rp=require(_0x5e86('0x2'));var moment=require(_0x5e86('0x3'));var BPromise=require(_0x5e86('0x4'));var Mustache=require(_0x5e86('0x5'));var util=require(_0x5e86('0x6'));var path=require(_0x5e86('0x7'));var sox=require(_0x5e86('0x8'));var csv=require(_0x5e86('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e86('0xa'));var _=require(_0x5e86('0xb'));var squel=require('squel');var crypto=require(_0x5e86('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5e86('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e86('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e86('0xf'));var authService=require(_0x5e86('0x10'));var qs=require(_0x5e86('0x11'));var as=require(_0x5e86('0x12'));var hardwareService=require(_0x5e86('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5e86('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e86('0x15'))['db'];var extensions=require(_0x5e86('0x16'));function respondWithStatusCode(_0x4f3d4c,_0x30c63e){_0x30c63e=_0x30c63e||0xcc;return function(_0x4d1dc0){if(_0x4d1dc0){return _0x4f3d4c[_0x5e86('0x17')](_0x30c63e);}return _0x4f3d4c[_0x5e86('0x18')](_0x30c63e)[_0x5e86('0x19')]();};}function respondWithResult(_0x2d5dda,_0x44fd91){_0x44fd91=_0x44fd91||0xc8;return function(_0xfd81be){if(_0xfd81be){return _0x2d5dda[_0x5e86('0x18')](_0x44fd91)[_0x5e86('0x1a')](_0xfd81be);}};}function respondWithFilteredResult(_0x3dff49,_0x235f02){return function(_0x308ebb){if(_0x308ebb){var _0x36f744=typeof _0x235f02[_0x5e86('0x1b')]===_0x5e86('0x1c')&&typeof _0x235f02[_0x5e86('0x1d')]===_0x5e86('0x1c');var _0xcd38c4=_0x308ebb[_0x5e86('0x1e')];var _0x4fd50a=_0x36f744?0x0:_0x235f02[_0x5e86('0x1b')];var _0x2437af=_0x36f744?_0x308ebb[_0x5e86('0x1e')]:_0x235f02[_0x5e86('0x1b')]+_0x235f02[_0x5e86('0x1d')];var _0x21d08c;if(_0x2437af>=_0xcd38c4){_0x2437af=_0xcd38c4;_0x21d08c=0xc8;}else{_0x21d08c=0xce;}_0x3dff49['status'](_0x21d08c);return _0x3dff49[_0x5e86('0x1f')]('Content-Range',_0x4fd50a+'-'+_0x2437af+'/'+_0xcd38c4)[_0x5e86('0x1a')](_0x308ebb);}return null;};}function patchUpdates(_0x596251){return function(_0xbedb3a){try{jsonpatch[_0x5e86('0x20')](_0xbedb3a,_0x596251,!![]);}catch(_0x5f030b){return BPromise[_0x5e86('0x21')](_0x5f030b);}return _0xbedb3a[_0x5e86('0x22')]();};}function saveUpdates(_0x1dbc2d,_0x25be5d){return function(_0x184932){if(_0x184932){return _0x184932['update'](_0x1dbc2d)[_0x5e86('0x23')](function(_0x2e7b2b){return _0x2e7b2b;});}return null;};}function removeEntity(_0xe9db15,_0x15b7bc){return function(_0x7a885b){if(_0x7a885b){return _0x7a885b['destroy']()[_0x5e86('0x23')](function(){var _0x14a25a=_0x7a885b[_0x5e86('0x24')]({'plain':!![]});var _0x2dade0='Intervals';return db[_0x5e86('0x25')][_0x5e86('0x26')]({'where':{'type':_0x2dade0,'resourceId':_0x14a25a['id']}})[_0x5e86('0x23')](function(){return _0x7a885b;});})[_0x5e86('0x23')](function(){_0xe9db15[_0x5e86('0x18')](0xcc)[_0x5e86('0x19')]();});}};}function handleEntityNotFound(_0x2c4ffc,_0x441eb2){return function(_0x486c72){if(!_0x486c72){_0x2c4ffc[_0x5e86('0x17')](0x194);}return _0x486c72;};}function handleError(_0x5e92d5,_0x223db5){_0x223db5=_0x223db5||0x1f4;return function(_0x2bf23b){logger[_0x5e86('0x27')](_0x2bf23b[_0x5e86('0x28')]);if(_0x2bf23b['name']){delete _0x2bf23b[_0x5e86('0x29')];}_0x5e92d5[_0x5e86('0x18')](_0x223db5)[_0x5e86('0x2a')](_0x2bf23b);};}exports[_0x5e86('0x2b')]=function(_0x3da9da,_0x38c0d0){var _0x351d23={},_0x144866={},_0x45a263={'count':0x0,'rows':[]};var _0x1cd419=_[_0x5e86('0x2c')](db[_0x5e86('0x2d')]['rawAttributes'],function(_0xab84ae){return{'name':_0xab84ae[_0x5e86('0x2e')],'type':_0xab84ae['type']['key']};});_0x144866[_0x5e86('0x2f')]=_[_0x5e86('0x2c')](_0x1cd419,'name');_0x144866[_0x5e86('0x30')]=_[_0x5e86('0x31')](_0x3da9da['query']);_0x144866[_0x5e86('0x32')]=_[_0x5e86('0x33')](_0x144866['model'],_0x144866[_0x5e86('0x30')]);_0x351d23[_0x5e86('0x34')]=_['intersection'](_0x144866[_0x5e86('0x2f')],qs[_0x5e86('0x35')](_0x3da9da[_0x5e86('0x30')]['fields']));_0x351d23[_0x5e86('0x34')]=_0x351d23[_0x5e86('0x34')]['length']?_0x351d23[_0x5e86('0x34')]:_0x144866[_0x5e86('0x2f')];if(!_0x3da9da[_0x5e86('0x30')][_0x5e86('0x36')](_0x5e86('0x37'))){_0x351d23[_0x5e86('0x1d')]=qs[_0x5e86('0x1d')](_0x3da9da[_0x5e86('0x30')][_0x5e86('0x1d')]);_0x351d23[_0x5e86('0x1b')]=qs[_0x5e86('0x1b')](_0x3da9da['query']['offset']);}_0x351d23[_0x5e86('0x38')]=qs[_0x5e86('0x39')](_0x3da9da['query'][_0x5e86('0x39')]);_0x351d23[_0x5e86('0x3a')]=qs[_0x5e86('0x32')](_['pick'](_0x3da9da[_0x5e86('0x30')],_0x144866[_0x5e86('0x32')]),_0x1cd419);if(_0x3da9da[_0x5e86('0x30')][_0x5e86('0x3b')]){_0x351d23[_0x5e86('0x3a')]=_[_0x5e86('0x3c')](_0x351d23['where'],{'$or':_['map'](_0x1cd419,function(_0x10890b){if(_0x10890b[_0x5e86('0x3d')]!==_0x5e86('0x3e')){var _0x48d139={};_0x48d139[_0x10890b[_0x5e86('0x29')]]={'$like':'%'+_0x3da9da[_0x5e86('0x30')][_0x5e86('0x3b')]+'%'};return _0x48d139;}})});}_0x351d23=_[_0x5e86('0x3c')]({},_0x351d23,_0x3da9da[_0x5e86('0x3f')]);var _0x5edeac={'where':_0x351d23[_0x5e86('0x3a')]};return db[_0x5e86('0x2d')][_0x5e86('0x1e')](_0x5edeac)[_0x5e86('0x23')](function(_0x45f165){_0x45a263[_0x5e86('0x1e')]=_0x45f165;if(_0x3da9da[_0x5e86('0x30')][_0x5e86('0x40')]){_0x351d23[_0x5e86('0x41')]=[{'all':!![]}];}return db[_0x5e86('0x2d')]['findAll'](_0x351d23);})[_0x5e86('0x23')](function(_0x1c0266){_0x45a263['rows']=_0x1c0266;return _0x45a263;})['then'](respondWithFilteredResult(_0x38c0d0,_0x351d23))[_0x5e86('0x42')](handleError(_0x38c0d0,null));};exports[_0x5e86('0x43')]=function(_0x42666,_0x171b3c){var _0x5f2471={'raw':!![],'where':{'id':_0x42666['params']['id']}},_0x3397fb={};_0x3397fb[_0x5e86('0x2f')]=_['keys'](db[_0x5e86('0x2d')][_0x5e86('0x44')]);_0x3397fb['query']=_[_0x5e86('0x31')](_0x42666[_0x5e86('0x30')]);_0x3397fb[_0x5e86('0x32')]=_['intersection'](_0x3397fb[_0x5e86('0x2f')],_0x3397fb[_0x5e86('0x30')]);_0x5f2471[_0x5e86('0x34')]=_[_0x5e86('0x33')](_0x3397fb[_0x5e86('0x2f')],qs[_0x5e86('0x35')](_0x42666[_0x5e86('0x30')][_0x5e86('0x35')]));_0x5f2471[_0x5e86('0x34')]=_0x5f2471['attributes'][_0x5e86('0x45')]?_0x5f2471[_0x5e86('0x34')]:_0x3397fb['model'];if(_0x42666['query'][_0x5e86('0x40')]){_0x5f2471[_0x5e86('0x41')]=[{'all':!![]}];}_0x5f2471=_['merge']({},_0x5f2471,_0x42666[_0x5e86('0x3f')]);return db[_0x5e86('0x2d')][_0x5e86('0x46')](_0x5f2471)[_0x5e86('0x23')](handleEntityNotFound(_0x171b3c,null))[_0x5e86('0x23')](respondWithResult(_0x171b3c,null))[_0x5e86('0x42')](handleError(_0x171b3c,null));};exports[_0x5e86('0x47')]=function(_0x24580f,_0x10d310){return db[_0x5e86('0x2d')][_0x5e86('0x47')](_0x24580f['body'],{})[_0x5e86('0x23')](function(_0x436a3f){var _0x4f06b1=_0x24580f['user'][_0x5e86('0x24')]({'plain':!![]});if(!_0x4f06b1)throw new Error(_0x5e86('0x48'));if(_0x4f06b1[_0x5e86('0x49')]===_0x5e86('0x4a')){var _0xc504dc=_0x436a3f[_0x5e86('0x24')]({'plain':!![]});var _0x178845=_0x5e86('0x4b');return db[_0x5e86('0x4c')]['find']({'where':{'name':_0x178845,'userProfileId':_0x4f06b1[_0x5e86('0x4d')]},'raw':!![]})[_0x5e86('0x23')](function(_0x1ea7c0){if(_0x1ea7c0&&_0x1ea7c0['autoAssociation']===0x0){return db[_0x5e86('0x25')][_0x5e86('0x47')]({'name':_0xc504dc[_0x5e86('0x29')],'resourceId':_0xc504dc['id'],'type':_0x1ea7c0[_0x5e86('0x29')],'sectionId':_0x1ea7c0['id']},{})['then'](function(){return _0x436a3f;});}else{return _0x436a3f;}})[_0x5e86('0x42')](function(_0x1ff279){logger[_0x5e86('0x27')](_0x5e86('0x4e'),_0x1ff279);throw _0x1ff279;});}return _0x436a3f;})['then'](respondWithResult(_0x10d310,0xc9))[_0x5e86('0x42')](handleError(_0x10d310,null));};exports[_0x5e86('0x4f')]=function(_0x347d1a,_0xfc3cbb){if(_0x347d1a[_0x5e86('0x50')]['id']){delete _0x347d1a[_0x5e86('0x50')]['id'];}return db[_0x5e86('0x2d')][_0x5e86('0x46')]({'where':{'id':_0x347d1a[_0x5e86('0x51')]['id']}})[_0x5e86('0x23')](handleEntityNotFound(_0xfc3cbb,null))['then'](saveUpdates(_0x347d1a[_0x5e86('0x50')],null))['then'](respondWithResult(_0xfc3cbb,null))['catch'](handleError(_0xfc3cbb,null));};exports[_0x5e86('0x26')]=function(_0x5f22c1,_0x48d3d6){return db['Interval']['find']({'where':{'id':_0x5f22c1[_0x5e86('0x51')]['id']}})[_0x5e86('0x23')](handleEntityNotFound(_0x48d3d6,null))[_0x5e86('0x23')](removeEntity(_0x48d3d6,null))[_0x5e86('0x42')](handleError(_0x48d3d6,null));};exports['addInterval']=function(_0xd93b15,_0x35d8f2,_0x1fa881){if(_0xd93b15[_0x5e86('0x50')]['id']){delete _0xd93b15['body']['id'];}return db[_0x5e86('0x2d')][_0x5e86('0x46')]({'where':{'id':_0xd93b15[_0x5e86('0x51')]['id']}})[_0x5e86('0x23')](handleEntityNotFound(_0x35d8f2,null))['then'](function(_0x33d7e6){if(_0x33d7e6){_0xd93b15['body']['IntervalId']=_0x33d7e6['id'];return db['Interval'][_0x5e86('0x47')](_0xd93b15['body']);}})[_0x5e86('0x23')](respondWithResult(_0x35d8f2,null))[_0x5e86('0x42')](handleError(_0x35d8f2,null));};exports['getIntervals']=function(_0x3e8254,_0x20b383,_0x49d9e8){var _0x396717={};var _0x1fb491={};var _0x5e34a6;var _0x567b39;return db[_0x5e86('0x2d')][_0x5e86('0x52')]({'where':{'id':_0x3e8254[_0x5e86('0x51')]['id']}})[_0x5e86('0x23')](handleEntityNotFound(_0x20b383,null))['then'](function(_0x302eac){if(_0x302eac){_0x5e34a6=_0x302eac;_0x1fb491[_0x5e86('0x2f')]=_[_0x5e86('0x31')](db['Interval'][_0x5e86('0x44')]);_0x1fb491[_0x5e86('0x30')]=_[_0x5e86('0x31')](_0x3e8254[_0x5e86('0x30')]);_0x1fb491[_0x5e86('0x32')]=_[_0x5e86('0x33')](_0x1fb491[_0x5e86('0x2f')],_0x1fb491['query']);_0x396717[_0x5e86('0x34')]=_['intersection'](_0x1fb491[_0x5e86('0x2f')],qs['fields'](_0x3e8254[_0x5e86('0x30')][_0x5e86('0x35')]));_0x396717['attributes']=_0x396717[_0x5e86('0x34')][_0x5e86('0x45')]?_0x396717['attributes']:_0x1fb491[_0x5e86('0x2f')];_0x396717[_0x5e86('0x38')]=qs[_0x5e86('0x39')](_0x3e8254[_0x5e86('0x30')]['sort']);_0x396717['where']=qs[_0x5e86('0x32')](_[_0x5e86('0x53')](_0x3e8254['query'],_0x1fb491[_0x5e86('0x32')]));if(_0x3e8254[_0x5e86('0x30')][_0x5e86('0x3b')]){_0x396717[_0x5e86('0x3a')]=_['merge'](_0x396717['where'],{'$or':_['map'](_0x396717[_0x5e86('0x34')],function(_0x20c490){var _0x304799={};_0x304799[_0x20c490]={'$like':'%'+_0x3e8254[_0x5e86('0x30')][_0x5e86('0x3b')]+'%'};return _0x304799;})});}_0x396717=_[_0x5e86('0x3c')]({},_0x396717,_0x3e8254[_0x5e86('0x3f')]);return _0x5e34a6[_0x5e86('0x54')](_0x396717);}})[_0x5e86('0x23')](function(_0x5ec288){if(_0x5ec288){_0x567b39=_0x5ec288[_0x5e86('0x45')];if(!_0x3e8254[_0x5e86('0x30')][_0x5e86('0x36')](_0x5e86('0x37'))){_0x396717[_0x5e86('0x1d')]=qs['limit'](_0x3e8254[_0x5e86('0x30')]['limit']);_0x396717[_0x5e86('0x1b')]=qs[_0x5e86('0x1b')](_0x3e8254[_0x5e86('0x30')][_0x5e86('0x1b')]);}return _0x5e34a6['getIntervals'](_0x396717);}})[_0x5e86('0x23')](function(_0x2c3ace){if(_0x2c3ace){return _0x2c3ace?{'count':_0x567b39,'rows':_0x2c3ace}:null;}})['then'](respondWithResult(_0x20b383,null))[_0x5e86('0x42')](handleError(_0x20b383,null));};exports[_0x5e86('0x55')]=function(_0x1e869d,_0x429974,_0x5a8933){return db[_0x5e86('0x2d')][_0x5e86('0x52')]({'where':{'id':_0x1e869d[_0x5e86('0x51')]['id']}})[_0x5e86('0x23')](handleEntityNotFound(_0x429974,null))[_0x5e86('0x23')](function(_0x8596ea){if(_0x8596ea){return db[_0x5e86('0x56')][_0x5e86('0x57')](function(_0x24d977){return db['Interval'][_0x5e86('0x26')]({'where':{'IntervalId':_0x1e869d[_0x5e86('0x51')]['id']},'transaction':_0x24d977})[_0x5e86('0x23')](function(_0x55369e){var _0x101195=_['map'](_0x1e869d[_0x5e86('0x50')],function(_0x502e79){delete _0x502e79['id'];_0x502e79[_0x5e86('0x58')]=_0x1e869d[_0x5e86('0x51')]['id'];return _0x502e79;});return db[_0x5e86('0x2d')][_0x5e86('0x59')](_0x101195,{'transaction':_0x24d977});});})[_0x5e86('0x23')](function(){return db[_0x5e86('0x2d')][_0x5e86('0x5a')]({'where':{'IntervalId':_0x1e869d[_0x5e86('0x51')]['id']}});});}})[_0x5e86('0x23')](respondWithResult(_0x429974,null))[_0x5e86('0x42')](handleError(_0x429974,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ac90a23..a273dec 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 _0x5669=['../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x5669,0x191));var _0x9566=function(_0x7978a5,_0x5a4e10){_0x7978a5=_0x7978a5-0x0;var _0x5a7ad3=_0x5669[_0x7978a5];return _0x5a7ad3;};'use strict';var attributes=require(_0x9566('0x0'));var extensions=require(_0x9566('0x1'));var iftime=require(_0x9566('0x2'))[_0x9566('0x3')];module[_0x9566('0x4')]=function(_0x4d0462){return _0x4d0462[_0x9566('0x5')]('Interval',attributes,{'tableName':_0x9566('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f9018){extensions[_0x9566('0x7')](_0x4d0462,_0x4f9018);},'afterBulkCreate':function(_0x56e547,_0x361e89,_0x20a338){_0x20a338();extensions[_0x9566('0x7')](_0x4d0462,_0x56e547[0x0]);},'afterUpdate':function(_0x3a126f){extensions['rewrite'](_0x4d0462,_0x3a126f);},'afterDestroy':function(_0xcaaf92){extensions[_0x9566('0x7')](_0x4d0462,_0xcaaf92);}},'instanceMethods':{'ifTime':function(_0x3ecf21=undefined,_0x449941=new Date()){if(typeof this[_0x9566('0x8')]==='string'){return iftime(this[_0x9566('0x8')],_0x3ecf21,_0x449941);}else{return this[_0x9566('0x9')]()[_0x9566('0xa')](function(_0x41d5bf){return Promise[_0x9566('0xb')](_0x41d5bf[_0x9566('0xc')](function(_0x5c86bf){return _0x5c86bf['ifTime'](_0x3ecf21,_0x449941);}));})[_0x9566('0xa')](function(_0x203a57){return _0x203a57['reduce'](function(_0x548083,_0x23e522){return _0x548083||_0x23e522;},![]);});}}}});}; \ No newline at end of file +var _0x0ef3=['interval','then','all','ifTime','reduce','./interval.attributes','iftime','exports','define','Interval','rewrite','string'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ef3,0xe9));var _0x30ef=function(_0x1a268f,_0x2f4759){_0x1a268f=_0x1a268f-0x0;var _0x63fe77=_0x0ef3[_0x1a268f];return _0x63fe77;};'use strict';var attributes=require(_0x30ef('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0x30ef('0x1')];module[_0x30ef('0x2')]=function(_0x5e35f7){return _0x5e35f7[_0x30ef('0x3')](_0x30ef('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ac490){extensions[_0x30ef('0x5')](_0x5e35f7,_0x5ac490);},'afterBulkCreate':function(_0x41b4a1,_0x5e667d,_0xb4c165){_0xb4c165();extensions[_0x30ef('0x5')](_0x5e35f7,_0x41b4a1[0x0]);},'afterUpdate':function(_0x31a381){extensions[_0x30ef('0x5')](_0x5e35f7,_0x31a381);},'afterDestroy':function(_0x2c662e){extensions['rewrite'](_0x5e35f7,_0x2c662e);}},'instanceMethods':{'ifTime':function(_0x23d08a=undefined,_0x4c5437=new Date()){if(typeof this['interval']===_0x30ef('0x6')){return iftime(this[_0x30ef('0x7')],_0x23d08a,_0x4c5437);}else{return this['getIntervals']()[_0x30ef('0x8')](function(_0x39ce15){return Promise[_0x30ef('0x9')](_0x39ce15['map'](function(_0x2d9242){return _0x2d9242[_0x30ef('0xa')](_0x23d08a,_0x4c5437);}));})[_0x30ef('0x8')](function(_0x50cb66){return _0x50cb66[_0x30ef('0xb')](function(_0x3f1228,_0x2d9d5c){return _0x3f1228||_0x2d9d5c;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 06efaf7..e9248d4 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 _0x02b7=['debug','stringify','catch','error','message','ShowInterval','Interval','findAll','then','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x281fd7,_0x5aba9a){var _0x4a6ca9=function(_0x361f07){while(--_0x361f07){_0x281fd7['push'](_0x281fd7['shift']());}};_0x4a6ca9(++_0x5aba9a);}(_0x02b7,0x1e9));var _0x702b=function(_0x524e1b,_0x39e1dc){_0x524e1b=_0x524e1b-0x0;var _0x274648=_0x02b7[_0x524e1b];return _0x274648;};'use strict';var _=require(_0x702b('0x0'));var util=require(_0x702b('0x1'));var db=require(_0x702b('0x2'))['db'];var iftime=require(_0x702b('0x3'))[_0x702b('0x4')];var logger=require(_0x702b('0x5'))(_0x702b('0x6'));exports[_0x702b('0x7')]=function(_0xb63917){var _0x21d93b=this;return new Promise(function(_0x110a01,_0xc217ee){return db['Interval']['findAll']({'raw':_0xb63917[_0x702b('0x8')]?_0xb63917['options'][_0x702b('0x9')]===undefined?!![]:![]:!![],'where':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xa')]||null:null,'attributes':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xb')]||null:null,'limit':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xc')]||null:null,'include':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xd')]?_['map'](_0xb63917['options'][_0x702b('0xd')],function(_0x49a4fa){return{'model':db[_0x49a4fa['model']],'as':_0x49a4fa['as'],'attributes':_0x49a4fa[_0x702b('0xb')],'include':_0x49a4fa[_0x702b('0xd')]?_['map'](_0x49a4fa[_0x702b('0xd')],function(_0x431975){return{'model':db[_0x431975['model']],'as':_0x431975['as'],'attributes':_0x431975[_0x702b('0xb')],'include':_0x431975['include']?_[_0x702b('0xe')](_0x431975['include'],function(_0x3f11d6){return{'model':db[_0x3f11d6[_0x702b('0xf')]],'as':_0x3f11d6['as'],'attributes':_0x3f11d6[_0x702b('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44e377){logger[_0x702b('0x10')]('GetInterval',_0xb63917);logger[_0x702b('0x11')](_0x702b('0x7'),_0xb63917,JSON[_0x702b('0x12')](_0x44e377));_0x110a01(_0x44e377);})[_0x702b('0x13')](function(_0x59b82){logger[_0x702b('0x14')](_0x702b('0x7'),_0x59b82[_0x702b('0x15')],_0xb63917);_0xc217ee(_0x21d93b[_0x702b('0x14')](0x1f4,_0x59b82['message']));});});};exports[_0x702b('0x16')]=function(_0xd02670){var _0x1ceb6d=this;return new Promise(function(_0x1223cb,_0xdd91f6){return db['Interval']['find']({'raw':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')]['where']||null:null,'attributes':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')][_0x702b('0xb')]||null:null,'include':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')][_0x702b('0xd')]?_[_0x702b('0xe')](_0xd02670[_0x702b('0x8')][_0x702b('0xd')],function(_0x5e8992){return{'model':db[_0x5e8992['model']],'as':_0x5e8992['as'],'attributes':_0x5e8992['attributes'],'include':_0x5e8992['include']?_[_0x702b('0xe')](_0x5e8992['include'],function(_0x27d9c4){return{'model':db[_0x27d9c4[_0x702b('0xf')]],'as':_0x27d9c4['as'],'attributes':_0x27d9c4[_0x702b('0xb')],'include':_0x27d9c4['include']?_[_0x702b('0xe')](_0x27d9c4[_0x702b('0xd')],function(_0x39c9e3){return{'model':db[_0x39c9e3[_0x702b('0xf')]],'as':_0x39c9e3['as'],'attributes':_0x39c9e3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x30b520){logger[_0x702b('0x10')]('ShowInterval',_0xd02670);logger['debug'](_0x702b('0x16'),_0xd02670,JSON[_0x702b('0x12')](_0x30b520));_0x1223cb(_0x30b520);})['catch'](function(_0x299f79){logger['error'](_0x702b('0x16'),_0x299f79['message'],_0xd02670);_0xdd91f6(_0x1ceb6d[_0x702b('0x14')](0x1f4,_0x299f79['message']));});});};function checkArrayOfIntervals(_0x398ded,_0x55e36c){var _0x204501=[];return db[_0x702b('0x17')][_0x702b('0x18')]({'where':{'id':_0x398ded}})[_0x702b('0x19')](function(_0x3c236c){_0x204501=_0x3c236c;return Promise[_0x702b('0x1a')](_0x204501['map'](function(_0x262646){return _0x262646[_0x702b('0x1b')](_0x55e36c);}));})[_0x702b('0x19')](function(_0x23b3c3){var _0x181a79=_0x23b3c3[_0x702b('0x1c')](function(_0xedbc9,_0x590daf){return _0xedbc9||_0x590daf;},![]);logger[_0x702b('0x10')](util[_0x702b('0x1d')](_0x702b('0x1e'),_0x204501['map'](function(_0x234499){return _0x234499[_0x702b('0x1f')];})[_0x702b('0x20')](',\x20'),_0x204501[_0x702b('0xe')](function(_0x204761){return _0x204761['id'];})['join'](',\x20')));return _0x181a79;});}function checkSingleInterval(_0x426f59,_0x117140){return db[_0x702b('0x17')][_0x702b('0x21')](_0x426f59)['then'](function(_0x5e49d0){if(_0x5e49d0){logger[_0x702b('0x10')](util[_0x702b('0x1d')](_0x702b('0x22'),_0x5e49d0[_0x702b('0x1f')],_0x5e49d0['id']));return _0x5e49d0[_0x702b('0x1b')](_0x117140);}});}exports[_0x702b('0x23')]=function(_0x5d4bd2){var _0x560fbe=_0x5d4bd2[_0x702b('0x24')];var _0x2c2934=Array[_0x702b('0x25')](_0x5d4bd2[_0x702b('0x26')])?_0x5d4bd2['intervals']:typeof _0x5d4bd2[_0x702b('0x26')]==='string'?[_0x5d4bd2[_0x702b('0x26')]]:[];var _0xd6f4a3=_0x5d4bd2[_0x702b('0x27')]||undefined;var _0x40e950=![];if(_0x2c2934[_0x702b('0x28')]){logger['info'](util[_0x702b('0x1d')](_0x702b('0x29'),_0x2c2934[_0x702b('0x20')](';\x20')));}if(_0xd6f4a3){logger['info'](util['format'](_0x702b('0x2a'),_0xd6f4a3));}logger[_0x702b('0x11')](_0x702b('0x2b'),_0x40e950);logger[_0x702b('0x2c')](_0x702b('0x23'),_0x5d4bd2);return Promise[_0x702b('0x2d')]()[_0x702b('0x19')](function(){if(Array['isArray'](_0x560fbe)){return checkArrayOfIntervals(_0x560fbe,_0xd6f4a3);}else if(_0x560fbe){return checkSingleInterval(_0x560fbe,_0xd6f4a3);}})['then'](function(_0x58db65){var _0x5598e6=_0x2c2934[_0x702b('0x1c')](function(_0x421240,_0x3a4589){return _0x421240||iftime(_0x3a4589,_0xd6f4a3);},![]);_0x40e950=_0x58db65||_0x5598e6;return _0x40e950;})['catch'](function(_0x21cffc){logger[_0x702b('0x14')](_0x702b('0x23'),_0x5d4bd2,_0x21cffc);throw this[_0x702b('0x14')](0x1f4,_0x21cffc['message']);});}; \ No newline at end of file +var _0x874e=['util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','map','model','info','GetInterval','debug','catch','message','error','find','where','ShowInterval','then','ifTime','format','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','isArray','reduce'];(function(_0x130ac6,_0x9aad6e){var _0xd426c2=function(_0x376e4f){while(--_0x376e4f){_0x130ac6['push'](_0x130ac6['shift']());}};_0xd426c2(++_0x9aad6e);}(_0x874e,0x168));var _0xe874=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x874e[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xe874('0x0'));var db=require(_0xe874('0x1'))['db'];var iftime=require(_0xe874('0x2'))['iftime'];var logger=require(_0xe874('0x3'))(_0xe874('0x4'));exports['GetInterval']=function(_0x21d30e){var _0x36d69f=this;return new Promise(function(_0x8c60c4,_0x3eabad){return db[_0xe874('0x5')][_0xe874('0x6')]({'raw':_0x21d30e[_0xe874('0x7')]?_0x21d30e[_0xe874('0x7')][_0xe874('0x8')]===undefined?!![]:![]:!![],'where':_0x21d30e[_0xe874('0x7')]?_0x21d30e[_0xe874('0x7')]['where']||null:null,'attributes':_0x21d30e['options']?_0x21d30e['options'][_0xe874('0x9')]||null:null,'limit':_0x21d30e['options']?_0x21d30e[_0xe874('0x7')][_0xe874('0xa')]||null:null,'include':_0x21d30e['options']?_0x21d30e['options'][_0xe874('0xb')]?_[_0xe874('0xc')](_0x21d30e[_0xe874('0x7')][_0xe874('0xb')],function(_0x30a307){return{'model':db[_0x30a307['model']],'as':_0x30a307['as'],'attributes':_0x30a307[_0xe874('0x9')],'include':_0x30a307['include']?_[_0xe874('0xc')](_0x30a307[_0xe874('0xb')],function(_0x57c303){return{'model':db[_0x57c303[_0xe874('0xd')]],'as':_0x57c303['as'],'attributes':_0x57c303[_0xe874('0x9')],'include':_0x57c303[_0xe874('0xb')]?_['map'](_0x57c303['include'],function(_0x5bd632){return{'model':db[_0x5bd632[_0xe874('0xd')]],'as':_0x5bd632['as'],'attributes':_0x5bd632[_0xe874('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34ffd5){logger[_0xe874('0xe')](_0xe874('0xf'),_0x21d30e);logger[_0xe874('0x10')](_0xe874('0xf'),_0x21d30e,JSON['stringify'](_0x34ffd5));_0x8c60c4(_0x34ffd5);})[_0xe874('0x11')](function(_0x1cacc0){logger['error']('GetInterval',_0x1cacc0[_0xe874('0x12')],_0x21d30e);_0x3eabad(_0x36d69f[_0xe874('0x13')](0x1f4,_0x1cacc0['message']));});});};exports['ShowInterval']=function(_0x2d855b){var _0x426ff7=this;return new Promise(function(_0x4d3a84,_0x472f56){return db['Interval'][_0xe874('0x14')]({'raw':_0x2d855b['options']?_0x2d855b[_0xe874('0x7')][_0xe874('0x8')]===undefined?!![]:![]:!![],'where':_0x2d855b[_0xe874('0x7')]?_0x2d855b[_0xe874('0x7')][_0xe874('0x15')]||null:null,'attributes':_0x2d855b[_0xe874('0x7')]?_0x2d855b[_0xe874('0x7')][_0xe874('0x9')]||null:null,'include':_0x2d855b[_0xe874('0x7')]?_0x2d855b[_0xe874('0x7')]['include']?_['map'](_0x2d855b[_0xe874('0x7')][_0xe874('0xb')],function(_0x2d1e2b){return{'model':db[_0x2d1e2b[_0xe874('0xd')]],'as':_0x2d1e2b['as'],'attributes':_0x2d1e2b['attributes'],'include':_0x2d1e2b[_0xe874('0xb')]?_[_0xe874('0xc')](_0x2d1e2b['include'],function(_0xfb4bc2){return{'model':db[_0xfb4bc2[_0xe874('0xd')]],'as':_0xfb4bc2['as'],'attributes':_0xfb4bc2[_0xe874('0x9')],'include':_0xfb4bc2[_0xe874('0xb')]?_[_0xe874('0xc')](_0xfb4bc2['include'],function(_0x676cca){return{'model':db[_0x676cca[_0xe874('0xd')]],'as':_0x676cca['as'],'attributes':_0x676cca[_0xe874('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3777c8){logger[_0xe874('0xe')](_0xe874('0x16'),_0x2d855b);logger[_0xe874('0x10')](_0xe874('0x16'),_0x2d855b,JSON['stringify'](_0x3777c8));_0x4d3a84(_0x3777c8);})[_0xe874('0x11')](function(_0x106faa){logger[_0xe874('0x13')](_0xe874('0x16'),_0x106faa[_0xe874('0x12')],_0x2d855b);_0x472f56(_0x426ff7[_0xe874('0x13')](0x1f4,_0x106faa[_0xe874('0x12')]));});});};function checkArrayOfIntervals(_0x5bda59,_0x32fea8){var _0x51d85d=[];return db[_0xe874('0x5')][_0xe874('0x6')]({'where':{'id':_0x5bda59}})[_0xe874('0x17')](function(_0x41c484){_0x51d85d=_0x41c484;return Promise['all'](_0x51d85d[_0xe874('0xc')](function(_0x922fb1){return _0x922fb1[_0xe874('0x18')](_0x32fea8);}));})[_0xe874('0x17')](function(_0x511b73){var _0x41b75d=_0x511b73['reduce'](function(_0xc4fad,_0x3d1f4e){return _0xc4fad||_0x3d1f4e;},![]);logger['info'](util[_0xe874('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x51d85d['map'](function(_0x2a9f07){return _0x2a9f07[_0xe874('0x1a')];})[_0xe874('0x1b')](',\x20'),_0x51d85d[_0xe874('0xc')](function(_0x38da1e){return _0x38da1e['id'];})[_0xe874('0x1b')](',\x20')));return _0x41b75d;});}function checkSingleInterval(_0x3e58bc,_0x342416){return db[_0xe874('0x5')]['findById'](_0x3e58bc)[_0xe874('0x17')](function(_0x152d93){if(_0x152d93){logger['info'](util['format'](_0xe874('0x1c'),_0x152d93['name'],_0x152d93['id']));return _0x152d93[_0xe874('0x18')](_0x342416);}});}exports[_0xe874('0x1d')]=function(_0x5eeb3c){var _0x69551d=_0x5eeb3c[_0xe874('0x1e')];var _0x46431c=Array['isArray'](_0x5eeb3c[_0xe874('0x1f')])?_0x5eeb3c[_0xe874('0x1f')]:typeof _0x5eeb3c[_0xe874('0x1f')]==='string'?[_0x5eeb3c[_0xe874('0x1f')]]:[];var _0x393da8=_0x5eeb3c[_0xe874('0x20')]||undefined;var _0x2478d6=![];if(_0x46431c[_0xe874('0x21')]){logger[_0xe874('0xe')](util[_0xe874('0x19')](_0xe874('0x22'),_0x46431c[_0xe874('0x1b')](';\x20')));}if(_0x393da8){logger[_0xe874('0xe')](util[_0xe874('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x393da8));}logger[_0xe874('0x10')](_0xe874('0x23'),_0x2478d6);logger[_0xe874('0x24')]('IntervalIftime',_0x5eeb3c);return Promise[_0xe874('0x25')]()[_0xe874('0x17')](function(){if(Array[_0xe874('0x26')](_0x69551d)){return checkArrayOfIntervals(_0x69551d,_0x393da8);}else if(_0x69551d){return checkSingleInterval(_0x69551d,_0x393da8);}})['then'](function(_0x108d84){var _0x42818c=_0x46431c[_0xe874('0x27')](function(_0x2fb5dc,_0x39949a){return _0x2fb5dc||iftime(_0x39949a,_0x393da8);},![]);_0x2478d6=_0x108d84||_0x42818c;return _0x2478d6;})[_0xe874('0x11')](function(_0x557d95){logger[_0xe874('0x13')](_0xe874('0x1d'),_0x5eeb3c,_0x557d95);throw this[_0xe874('0x13')](0x1f4,_0x557d95['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b58aa51..2ee7425 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4224f4,_0x210a9c){var _0x362e4b=function(_0x4a5b86){while(--_0x4a5b86){_0x4224f4['push'](_0x4224f4['shift']());}};_0x362e4b(++_0x210a9c);}(_0xadb5,0xad));var _0x5adb=function(_0x58a714,_0x5cb1d1){_0x58a714=_0x58a714-0x0;var _0x1f4938=_0xadb5[_0x58a714];return _0x1f4938;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0b0e,0x187));var _0xe0b0=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x0b0e[_0x284807];return _0x50c774;};'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 6dd6f73..98c1907 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 _0xa36f=['x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','end','statusCode','json','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body'];(function(_0x4642c2,_0x4f3b8a){var _0x3de5c7=function(_0x43bde1){while(--_0x43bde1){_0x4642c2['push'](_0x4642c2['shift']());}};_0x3de5c7(++_0x4f3b8a);}(_0xa36f,0xdc));var _0xfa36=function(_0x54dda7,_0x6d79af){_0x54dda7=_0x54dda7-0x0;var _0x3e66b7=_0xa36f[_0x54dda7];return _0x3e66b7;};'use strict';var BPromise=require(_0xfa36('0x0'));var https=require('https');var logger=require(_0xfa36('0x1'))(_0xfa36('0x2'));var USERNAME='support';var PASSWORD=_0xfa36('0x3');function openIssue(_0x54ff83,_0x375abb){var _0x4e4417={'fields':{'project':{'key':_0x54ff83[_0xfa36('0x4')]||_0xfa36('0x5')},'summary':(_0x54ff83[_0xfa36('0x6')]||_0xfa36('0x7'))+_0xfa36('0x8')+_0x54ff83['ip'],'description':_0x54ff83[_0xfa36('0x9')]||JSON['stringify'](_0x54ff83),'issuetype':{'name':_0x54ff83['issuetype']||'Bug'}}};_0x4e4417[_0xfa36('0xa')]['customfield_11500']=_0x54ff83['email'];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xb')]=_0x54ff83['oldToken'];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xc')]=_0x54ff83[_0xfa36('0xd')];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xe')]=_0x54ff83[_0xfa36('0xf')];_0x4e4417[_0xfa36('0xa')][_0xfa36('0x10')]=_0x54ff83[_0xfa36('0x11')];_0x4e4417['fields'][_0xfa36('0x12')]=_0x54ff83['ip'];var _0x365b43={'host':_0xfa36('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xfa36('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xfa36('0x15'),'Authorization':_0xfa36('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfa36('0x17'))}};var _0x13baa0=JSON['stringify'](_0x4e4417);var _0x4feada=https[_0xfa36('0x18')](_0x365b43,function(_0x1bdfc5){_0x1bdfc5['setEncoding']('utf8');var _0x1c7936='';_0x1bdfc5['on']('data',function(_0x558d6d){_0x1c7936+=_0x558d6d;});_0x1bdfc5['on'](_0xfa36('0x19'),function(){if(_0x375abb){return _0x375abb['status'](_0x1bdfc5[_0xfa36('0x1a')])[_0xfa36('0x1b')](JSON['parse'](_0x1c7936));}});});_0x4feada['on']('error',function(_0x5b2e4e){if(_0x375abb){return _0x375abb[_0xfa36('0x1c')](0x1f4)[_0xfa36('0x1b')]({'errors':[{'message':_0xfa36('0x1d'),'type':_0xfa36('0x1e')}]});}});_0x4feada['write'](_0x13baa0);_0x4feada[_0xfa36('0x19')]();}exports['openIssue']=openIssue;exports['send']=function(_0x3acf40,_0x3ef934){_0x3acf40[_0xfa36('0x1f')]['ip']=_0x3acf40['headers'][_0xfa36('0x20')]||_0x3acf40[_0xfa36('0x21')][_0xfa36('0x22')]||_0x3acf40[_0xfa36('0x23')][_0xfa36('0x22')]||_0x3acf40['connection'][_0xfa36('0x23')][_0xfa36('0x22')];return openIssue(_0x3acf40['body'],_0x3ef934);}; \ No newline at end of file +var _0x2452=['description','issuetype','Bug','fields','customfield_11500','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','stringify','request','setEncoding','utf8','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','\x20from\x20'];(function(_0x2851e2,_0x2fdf15){var _0x314bc9=function(_0x4457e4){while(--_0x4457e4){_0x2851e2['push'](_0x2851e2['shift']());}};_0x314bc9(++_0x2fdf15);}(_0x2452,0xcf));var _0x2245=function(_0x8fb035,_0x217b6d){_0x8fb035=_0x8fb035-0x0;var _0x3a678d=_0x2452[_0x8fb035];return _0x3a678d;};'use strict';var BPromise=require(_0x2245('0x0'));var https=require(_0x2245('0x1'));var logger=require(_0x2245('0x2'))(_0x2245('0x3'));var USERNAME=_0x2245('0x4');var PASSWORD=_0x2245('0x5');function openIssue(_0x495a52,_0x493427){var _0x1d9af2={'fields':{'project':{'key':_0x495a52['key']||'MOTGUI'},'summary':(_0x495a52[_0x2245('0x6')]||'Report')+_0x2245('0x7')+_0x495a52['ip'],'description':_0x495a52[_0x2245('0x8')]||JSON['stringify'](_0x495a52),'issuetype':{'name':_0x495a52[_0x2245('0x9')]||_0x2245('0xa')}}};_0x1d9af2[_0x2245('0xb')][_0x2245('0xc')]=_0x495a52['email'];_0x1d9af2[_0x2245('0xb')]['customfield_11501']=_0x495a52['oldToken'];_0x1d9af2[_0x2245('0xb')][_0x2245('0xd')]=_0x495a52[_0x2245('0xe')];_0x1d9af2[_0x2245('0xb')][_0x2245('0xf')]=_0x495a52[_0x2245('0x10')];_0x1d9af2[_0x2245('0xb')][_0x2245('0x11')]=_0x495a52[_0x2245('0x12')];_0x1d9af2['fields'][_0x2245('0x13')]=_0x495a52['ip'];var _0xaf55be={'host':_0x2245('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2245('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x2245('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x5a677b=JSON[_0x2245('0x17')](_0x1d9af2);var _0x4753ea=https[_0x2245('0x18')](_0xaf55be,function(_0x1ff2bf){_0x1ff2bf[_0x2245('0x19')](_0x2245('0x1a'));var _0x1a76e1='';_0x1ff2bf['on']('data',function(_0x586cbf){_0x1a76e1+=_0x586cbf;});_0x1ff2bf['on'](_0x2245('0x1b'),function(){if(_0x493427){return _0x493427[_0x2245('0x1c')](_0x1ff2bf[_0x2245('0x1d')])[_0x2245('0x1e')](JSON[_0x2245('0x1f')](_0x1a76e1));}});});_0x4753ea['on'](_0x2245('0x20'),function(_0x1216f1){if(_0x493427){return _0x493427[_0x2245('0x1c')](0x1f4)[_0x2245('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2245('0x21')}]});}});_0x4753ea[_0x2245('0x22')](_0x5a677b);_0x4753ea['end']();}exports[_0x2245('0x23')]=openIssue;exports[_0x2245('0x24')]=function(_0x5c0d4a,_0x1d2744){_0x5c0d4a[_0x2245('0x25')]['ip']=_0x5c0d4a[_0x2245('0x26')][_0x2245('0x27')]||_0x5c0d4a[_0x2245('0x28')][_0x2245('0x29')]||_0x5c0d4a['socket']['remoteAddress']||_0x5c0d4a[_0x2245('0x28')][_0x2245('0x2a')][_0x2245('0x29')];return openIssue(_0x5c0d4a[_0x2245('0x25')],_0x1d2744);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7e859eb..05082e7 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 _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xaa88[_0x2e2681];return _0x368a64;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file +var _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xda55,0x6d));var _0x5da5=function(_0xac0f5e,_0x5303ea){_0xac0f5e=_0xac0f5e-0x0;var _0x5a1029=_0xda55[_0xac0f5e];return _0x5a1029;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 1518979..dc7b984 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4c8d03,_0x469ca9){_0x4c8d03=_0x4c8d03-0x0;var _0x3fa3b8=_0x7a54[_0x4c8d03];return _0x3fa3b8;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x403463,_0x24d7f4){_0x403463=_0x403463-0x0;var _0x56f397=_0x7a54[_0x403463];return _0x56f397;};'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 1c6024d..1b93ba6 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 _0x5d17=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','apply','reject','save','then','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x25960d,_0x2d5f0e){var _0x2a9db6=function(_0xefdaa3){while(--_0xefdaa3){_0x25960d['push'](_0x25960d['shift']());}};_0x2a9db6(++_0x2d5f0e);}(_0x5d17,0x114));var _0x75d1=function(_0x250b8b,_0x1d3b34){_0x250b8b=_0x250b8b-0x0;var _0x458585=_0x5d17[_0x250b8b];return _0x458585;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['JscriptyAnswerReport'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')](_0x12bd67['body'],{})['then'](respondWithResult(_0x16f744,0xc9))[_0x75d1('0x3e')](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x50def3,_0x2d380d){if(_0x50def3[_0x75d1('0x44')]['id']){delete _0x50def3[_0x75d1('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x75d1('0x45')]({'where':{'id':_0x50def3[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x2d380d,null))[_0x75d1('0x24')](saveUpdates(_0x50def3[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x2d380d,null))[_0x75d1('0x3e')](handleError(_0x2d380d,null));};exports['destroy']=function(_0x1eaa66,_0x382195){return db[_0x75d1('0x28')][_0x75d1('0x45')]({'where':{'id':_0x1eaa66[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x382195,null))[_0x75d1('0x24')](removeEntity(_0x382195,null))['catch'](handleError(_0x382195,null));};exports[_0x75d1('0x46')]=function(_0x3af9c5,_0x42d587){return db['JscriptyAnswerReport'][_0x75d1('0x46')]()[_0x75d1('0x24')](respondWithResult(_0x42d587,null))[_0x75d1('0x3e')](handleError(_0x42d587,null));}; \ No newline at end of file +var _0xea31=['map','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','JscriptyAnswerReport','includeAll','include','findAll','catch','params','keys','length','options','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','stack','name','send','index'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xea31,0x6b));var _0x1ea3=function(_0x34c6b6,_0x7fd428){_0x34c6b6=_0x34c6b6-0x0;var _0x25719e=_0xea31[_0x34c6b6];return _0x25719e;};'use strict';var emlformat=require(_0x1ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea3('0x1'));var jsonpatch=require(_0x1ea3('0x2'));var rp=require(_0x1ea3('0x3'));var moment=require(_0x1ea3('0x4'));var BPromise=require(_0x1ea3('0x5'));var Mustache=require(_0x1ea3('0x6'));var util=require(_0x1ea3('0x7'));var path=require('path');var sox=require(_0x1ea3('0x8'));var csv=require(_0x1ea3('0x9'));var ejs=require(_0x1ea3('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea3('0xb'));var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0x9'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require('ioredis');var authService=require(_0x1ea3('0x12'));var qs=require(_0x1ea3('0x13'));var as=require(_0x1ea3('0x14'));var hardwareService=require(_0x1ea3('0x15'));var logger=require(_0x1ea3('0x16'))(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe537,_0x2fc7f4){_0x2fc7f4=_0x2fc7f4||0xcc;return function(_0x4305d3){if(_0x4305d3){return _0x3fe537['sendStatus'](_0x2fc7f4);}return _0x3fe537[_0x1ea3('0x1a')](_0x2fc7f4)[_0x1ea3('0x1b')]();};}function respondWithResult(_0x2fd1c9,_0x4b0af9){_0x4b0af9=_0x4b0af9||0xc8;return function(_0x1624ee){if(_0x1624ee){return _0x2fd1c9[_0x1ea3('0x1a')](_0x4b0af9)[_0x1ea3('0x1c')](_0x1624ee);}};}function respondWithFilteredResult(_0x3d0e71,_0x319de8){return function(_0x3fe673){if(_0x3fe673){var _0x29ceac=typeof _0x319de8['offset']===_0x1ea3('0x1d')&&typeof _0x319de8[_0x1ea3('0x1e')]===_0x1ea3('0x1d');var _0x2f6e6f=_0x3fe673[_0x1ea3('0x1f')];var _0x541e18=_0x29ceac?0x0:_0x319de8[_0x1ea3('0x20')];var _0x2a8b47=_0x29ceac?_0x3fe673[_0x1ea3('0x1f')]:_0x319de8['offset']+_0x319de8[_0x1ea3('0x1e')];var _0x21364e;if(_0x2a8b47>=_0x2f6e6f){_0x2a8b47=_0x2f6e6f;_0x21364e=0xc8;}else{_0x21364e=0xce;}_0x3d0e71[_0x1ea3('0x1a')](_0x21364e);return _0x3d0e71['set'](_0x1ea3('0x21'),_0x541e18+'-'+_0x2a8b47+'/'+_0x2f6e6f)['json'](_0x3fe673);}return null;};}function patchUpdates(_0x276e4d){return function(_0x405ec0){try{jsonpatch[_0x1ea3('0x22')](_0x405ec0,_0x276e4d,!![]);}catch(_0x5bad21){return BPromise[_0x1ea3('0x23')](_0x5bad21);}return _0x405ec0['save']();};}function saveUpdates(_0x4582af,_0x498455){return function(_0x941a50){if(_0x941a50){return _0x941a50['update'](_0x4582af)[_0x1ea3('0x24')](function(_0x388019){return _0x388019;});}return null;};}function removeEntity(_0x246231,_0x5ad8ff){return function(_0x50703d){if(_0x50703d){return _0x50703d[_0x1ea3('0x25')]()['then'](function(){_0x246231[_0x1ea3('0x1a')](0xcc)[_0x1ea3('0x1b')]();});}};}function handleEntityNotFound(_0x3c42f3,_0x91abee){return function(_0xa2b868){if(!_0xa2b868){_0x3c42f3['sendStatus'](0x194);}return _0xa2b868;};}function handleError(_0x50e511,_0x30cf8d){_0x30cf8d=_0x30cf8d||0x1f4;return function(_0x2edfb4){logger[_0x1ea3('0x26')](_0x2edfb4[_0x1ea3('0x27')]);if(_0x2edfb4[_0x1ea3('0x28')]){delete _0x2edfb4[_0x1ea3('0x28')];}_0x50e511[_0x1ea3('0x1a')](_0x30cf8d)[_0x1ea3('0x29')](_0x2edfb4);};}exports[_0x1ea3('0x2a')]=function(_0x3d9b63,_0x3bc186){var _0x33f5f2={},_0x2c29d7={},_0x1a020e={'count':0x0,'rows':[]};var _0xdbd7e3=_[_0x1ea3('0x2b')](db['JscriptyAnswerReport'][_0x1ea3('0x2c')],function(_0x366312){return{'name':_0x366312[_0x1ea3('0x2d')],'type':_0x366312[_0x1ea3('0x2e')][_0x1ea3('0x2f')]};});_0x2c29d7['model']=_['map'](_0xdbd7e3,_0x1ea3('0x28'));_0x2c29d7[_0x1ea3('0x30')]=_['keys'](_0x3d9b63[_0x1ea3('0x30')]);_0x2c29d7[_0x1ea3('0x31')]=_['intersection'](_0x2c29d7['model'],_0x2c29d7[_0x1ea3('0x30')]);_0x33f5f2[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x2c29d7[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x33f5f2[_0x1ea3('0x32')]=_0x33f5f2[_0x1ea3('0x32')]['length']?_0x33f5f2[_0x1ea3('0x32')]:_0x2c29d7[_0x1ea3('0x34')];if(!_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x36')](_0x1ea3('0x37'))){_0x33f5f2[_0x1ea3('0x1e')]=qs[_0x1ea3('0x1e')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x1e')]);_0x33f5f2[_0x1ea3('0x20')]=qs['offset'](_0x3d9b63[_0x1ea3('0x30')]['offset']);}_0x33f5f2[_0x1ea3('0x38')]=qs['sort'](_0x3d9b63['query'][_0x1ea3('0x39')]);_0x33f5f2['where']=qs['filters'](_['pick'](_0x3d9b63[_0x1ea3('0x30')],_0x2c29d7[_0x1ea3('0x31')]),_0xdbd7e3);if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]){_0x33f5f2[_0x1ea3('0x3b')]=_['merge'](_0x33f5f2[_0x1ea3('0x3b')],{'$or':_['map'](_0xdbd7e3,function(_0x441442){if(_0x441442[_0x1ea3('0x2e')]!=='VIRTUAL'){var _0x102757={};_0x102757[_0x441442[_0x1ea3('0x28')]]={'$like':'%'+_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]+'%'};return _0x102757;}})});}_0x33f5f2=_[_0x1ea3('0x3c')]({},_0x33f5f2,_0x3d9b63['options']);var _0x12da5a={'where':_0x33f5f2['where']};return db[_0x1ea3('0x3d')][_0x1ea3('0x1f')](_0x12da5a)[_0x1ea3('0x24')](function(_0x47028d){_0x1a020e[_0x1ea3('0x1f')]=_0x47028d;if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x33f5f2[_0x1ea3('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1ea3('0x40')](_0x33f5f2);})[_0x1ea3('0x24')](function(_0x2108e8){_0x1a020e['rows']=_0x2108e8;return _0x1a020e;})[_0x1ea3('0x24')](respondWithFilteredResult(_0x3bc186,_0x33f5f2))[_0x1ea3('0x41')](handleError(_0x3bc186,null));};exports['show']=function(_0x15f00a,_0x43c48d){var _0x58ba87={'raw':!![],'where':{'id':_0x15f00a[_0x1ea3('0x42')]['id']}},_0x133f48={};_0x133f48[_0x1ea3('0x34')]=_[_0x1ea3('0x43')](db[_0x1ea3('0x3d')][_0x1ea3('0x2c')]);_0x133f48['query']=_[_0x1ea3('0x43')](_0x15f00a[_0x1ea3('0x30')]);_0x133f48[_0x1ea3('0x31')]=_['intersection'](_0x133f48[_0x1ea3('0x34')],_0x133f48[_0x1ea3('0x30')]);_0x58ba87[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x133f48[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x58ba87[_0x1ea3('0x32')]=_0x58ba87[_0x1ea3('0x32')][_0x1ea3('0x44')]?_0x58ba87['attributes']:_0x133f48[_0x1ea3('0x34')];if(_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x58ba87[_0x1ea3('0x3f')]=[{'all':!![]}];}_0x58ba87=_['merge']({},_0x58ba87,_0x15f00a[_0x1ea3('0x45')]);return db[_0x1ea3('0x3d')]['find'](_0x58ba87)[_0x1ea3('0x24')](handleEntityNotFound(_0x43c48d,null))[_0x1ea3('0x24')](respondWithResult(_0x43c48d,null))[_0x1ea3('0x41')](handleError(_0x43c48d,null));};exports[_0x1ea3('0x46')]=function(_0x454156,_0x28955f){return db[_0x1ea3('0x3d')]['create'](_0x454156['body'],{})['then'](respondWithResult(_0x28955f,0xc9))[_0x1ea3('0x41')](handleError(_0x28955f,null));};exports[_0x1ea3('0x47')]=function(_0xf69557,_0x2de88d){if(_0xf69557[_0x1ea3('0x48')]['id']){delete _0xf69557['body']['id'];}return db[_0x1ea3('0x3d')]['find']({'where':{'id':_0xf69557[_0x1ea3('0x42')]['id']}})[_0x1ea3('0x24')](handleEntityNotFound(_0x2de88d,null))['then'](saveUpdates(_0xf69557['body'],null))[_0x1ea3('0x24')](respondWithResult(_0x2de88d,null))[_0x1ea3('0x41')](handleError(_0x2de88d,null));};exports[_0x1ea3('0x25')]=function(_0x43f296,_0x4822b2){return db[_0x1ea3('0x3d')][_0x1ea3('0x49')]({'where':{'id':_0x43f296['params']['id']}})['then'](handleEntityNotFound(_0x4822b2,null))[_0x1ea3('0x24')](removeEntity(_0x4822b2,null))['catch'](handleError(_0x4822b2,null));};exports[_0x1ea3('0x4a')]=function(_0xee8f20,_0x409f8f){return db[_0x1ea3('0x3d')][_0x1ea3('0x4a')]()[_0x1ea3('0x24')](respondWithResult(_0x409f8f,null))[_0x1ea3('0x41')](handleError(_0x409f8f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9f7637a..cbcca66 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 _0x30f5=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','JscriptyAnswerReport','lodash'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x30f5,0x155));var _0x530f=function(_0x86ba06,_0x2e50d9){_0x86ba06=_0x86ba06-0x0;var _0xafb44a=_0x30f5[_0x86ba06];return _0xafb44a;};'use strict';var _=require(_0x530f('0x0'));var util=require(_0x530f('0x1'));var logger=require(_0x530f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x530f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x530f('0x4'));var rimraf=require(_0x530f('0x5'));var config=require(_0x530f('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x12a711,_0x437bd7){return _0x12a711[_0x530f('0x7')](_0x530f('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb7b=['moment','request-promise','../../config/environment','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api'];(function(_0x5bae78,_0x561630){var _0x782613=function(_0x5c76cd){while(--_0x5c76cd){_0x5bae78['push'](_0x5bae78['shift']());}};_0x782613(++_0x561630);}(_0xbb7b,0x165));var _0xbbb7=function(_0xca0476,_0x2dca3f){_0xca0476=_0xca0476-0x0;var _0x4cf781=_0xbb7b[_0xca0476];return _0x4cf781;};'use strict';var _=require('lodash');var util=require(_0xbbb7('0x0'));var logger=require(_0xbbb7('0x1'))(_0xbbb7('0x2'));var moment=require(_0xbbb7('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbb7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbbb7('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2da836,_0x5aa3d0){return _0x2da836[_0xbbb7('0x6')](_0xbbb7('0x7'),attributes,{'tableName':_0xbbb7('0x8'),'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 0094bae..84c4118 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 _0xefb5=['debug','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefb5,0x14b));var _0x5efb=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xefb5[_0x4fc421];return _0x8c6d63;};'use strict';var _=require('lodash');var util=require(_0x5efb('0x0'));var moment=require(_0x5efb('0x1'));var BPromise=require(_0x5efb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5efb('0x3'));var db=require(_0x5efb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5efb('0x5'))(_0x5efb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5efb('0x7')][_0x5efb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f13e,_0x5c914f,_0x6a4cc8){return new BPromise(function(_0x4ba14e,_0x341078){return client['request'](_0x33f13e,_0x6a4cc8)['then'](function(_0x32f616){logger['info'](_0x5efb('0x9'),_0x5c914f,_0x5efb('0xa'));logger[_0x5efb('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5c914f,_0x5efb('0xa'),JSON[_0x5efb('0xc')](_0x32f616));if(_0x32f616[_0x5efb('0xd')]){if(_0x32f616[_0x5efb('0xd')][_0x5efb('0xe')]===0x1f4){logger[_0x5efb('0xd')](_0x5efb('0x9'),_0x5c914f,_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);return _0x341078(_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);}logger['error'](_0x5efb('0x9'),_0x5c914f,_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);return _0x4ba14e(_0x32f616[_0x5efb('0xd')]['message']);}else{logger['info'](_0x5efb('0x9'),_0x5c914f,_0x5efb('0xa'));_0x4ba14e(_0x32f616[_0x5efb('0x10')][_0x5efb('0xf')]);}})[_0x5efb('0x11')](function(_0xb07697){logger[_0x5efb('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5c914f,_0xb07697);_0x341078(_0xb07697);});});} \ No newline at end of file +var _0xd56a=['message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x267e98,_0x1ded37){var _0x5c33cc=function(_0x2dce76){while(--_0x2dce76){_0x267e98['push'](_0x267e98['shift']());}};_0x5c33cc(++_0x1ded37);}(_0xd56a,0x1b7));var _0xad56=function(_0x18e279,_0x4a5c0b){_0x18e279=_0x18e279-0x0;var _0x14aeca=_0xd56a[_0x18e279];return _0x14aeca;};'use strict';var _=require(_0xad56('0x0'));var util=require(_0xad56('0x1'));var moment=require(_0xad56('0x2'));var BPromise=require(_0xad56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad56('0x5'))(_0xad56('0x6'));var config=require(_0xad56('0x7'));var jayson=require(_0xad56('0x8'));var client=jayson[_0xad56('0x9')][_0xad56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30f692,_0x49e961,_0x323c81){return new BPromise(function(_0xd01b4b,_0x3d7c28){return client[_0xad56('0xb')](_0x30f692,_0x323c81)[_0xad56('0xc')](function(_0x34725c){logger[_0xad56('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x49e961,_0xad56('0xe'));logger[_0xad56('0xf')](_0xad56('0x10'),_0x49e961,_0xad56('0xe'),JSON[_0xad56('0x11')](_0x34725c));if(_0x34725c[_0xad56('0x12')]){if(_0x34725c['error'][_0xad56('0x13')]===0x1f4){logger[_0xad56('0x12')](_0xad56('0x14'),_0x49e961,_0x34725c[_0xad56('0x12')][_0xad56('0x15')]);return _0x3d7c28(_0x34725c[_0xad56('0x12')][_0xad56('0x15')]);}logger[_0xad56('0x12')](_0xad56('0x14'),_0x49e961,_0x34725c[_0xad56('0x12')][_0xad56('0x15')]);return _0xd01b4b(_0x34725c[_0xad56('0x12')][_0xad56('0x15')]);}else{logger[_0xad56('0xd')](_0xad56('0x14'),_0x49e961,_0xad56('0xe'));_0xd01b4b(_0x34725c['result']['message']);}})[_0xad56('0x16')](function(_0x4db189){logger[_0xad56('0x12')](_0xad56('0x14'),_0x49e961,_0x4db189);_0x3d7c28(_0x4db189);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 09995de..68febbd 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 _0x5f22=['delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getAnswers','/:id/summary','create','post','/:id/clone','clone','put','update'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x5f22,0x13c));var _0x25f2=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x5f22[_0x3b3cc6];return _0x1161e4;};'use strict';var multer=require(_0x25f2('0x0'));var util=require(_0x25f2('0x1'));var path=require('path');var timeout=require(_0x25f2('0x2'));var express=require(_0x25f2('0x3'));var router=express['Router']();var fs_extra=require(_0x25f2('0x4'));var auth=require(_0x25f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25f2('0x6'));router[_0x25f2('0x7')]('/',auth[_0x25f2('0x8')](),controller['index']);router['get'](_0x25f2('0x9'),auth[_0x25f2('0x8')](),controller[_0x25f2('0xa')]);router[_0x25f2('0x7')](_0x25f2('0xb'),auth[_0x25f2('0x8')](),controller['getSessions']);router[_0x25f2('0x7')]('/:id/answers',auth[_0x25f2('0x8')](),controller[_0x25f2('0xc')]);router[_0x25f2('0x7')](_0x25f2('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x25f2('0x8')](),controller[_0x25f2('0xe')]);router[_0x25f2('0xf')](_0x25f2('0x10'),auth[_0x25f2('0x8')](),controller[_0x25f2('0x11')]);router[_0x25f2('0x12')](_0x25f2('0x9'),auth['isAuthenticated'](),controller[_0x25f2('0x13')]);router[_0x25f2('0x14')](_0x25f2('0x9'),auth[_0x25f2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf30f=['/:id/summary','30s','create','/:id/clone','clone','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers'];(function(_0x4f36cd,_0x5b54f9){var _0x5522d5=function(_0x12be14){while(--_0x12be14){_0x4f36cd['push'](_0x4f36cd['shift']());}};_0x5522d5(++_0x5b54f9);}(_0xf30f,0x6d));var _0xff30=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf30f[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xff30('0x0'));var util=require('util');var path=require(_0xff30('0x1'));var timeout=require(_0xff30('0x2'));var express=require('express');var router=express[_0xff30('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xff30('0x4'));var interaction=require(_0xff30('0x5'));var config=require(_0xff30('0x6'));var controller=require(_0xff30('0x7'));router[_0xff30('0x8')]('/',auth[_0xff30('0x9')](),controller[_0xff30('0xa')]);router[_0xff30('0x8')](_0xff30('0xb'),auth[_0xff30('0x9')](),controller[_0xff30('0xc')]);router['get'](_0xff30('0xd'),auth[_0xff30('0x9')](),controller[_0xff30('0xe')]);router[_0xff30('0x8')]('/:id/answers',auth[_0xff30('0x9')](),controller[_0xff30('0xf')]);router[_0xff30('0x8')](_0xff30('0x10'),auth[_0xff30('0x9')](),timeout(_0xff30('0x11')),controller['getSummary']);router['post']('/',auth[_0xff30('0x9')](),controller[_0xff30('0x12')]);router['post'](_0xff30('0x13'),auth['isAuthenticated'](),controller[_0xff30('0x14')]);router[_0xff30('0x15')](_0xff30('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xff30('0x16')]('/:id',auth[_0xff30('0x9')](),controller[_0xff30('0x17')]);module[_0xff30('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 ae43f84..026e314 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 _0x44e4=['BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description'];(function(_0x4309b9,_0x5f0989){var _0x10a2d5=function(_0x517d45){while(--_0x517d45){_0x4309b9['push'](_0x4309b9['shift']());}};_0x10a2d5(++_0x5f0989);}(_0x44e4,0x1b1));var _0x444e=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x44e4[_0x3c2166];return _0x30ccc3;};'use strict';var Sequelize=require(_0x444e('0x0'));var _=require(_0x444e('0x1'));var util=require(_0x444e('0x2'));module[_0x444e('0x3')]={'name':{'type':Sequelize[_0x444e('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x444e('0x4')]},'formData':{'type':Sequelize[_0x444e('0x5')](_0x444e('0x6')),'set':function(_0x267dd4){if(_[_0x444e('0x7')](_0x267dd4)){this[_0x444e('0x8')](_0x444e('0x9'),JSON[_0x444e('0xa')](_0x267dd4));}else if(_[_0x444e('0xb')](_0x267dd4)){this[_0x444e('0x8')](_0x444e('0x9'),_0x267dd4);}else{this['setDataValue'](_0x444e('0x9'),util[_0x444e('0xc')](_0x444e('0xd'),this[_0x444e('0xe')](_0x444e('0xf'))||'',this[_0x444e('0xe')](_0x444e('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x444e('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x444e('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0xc240=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','lodash','util','exports','STRING'];(function(_0xfee3b9,_0x528ec5){var _0x5794ef=function(_0x2f776c){while(--_0x2f776c){_0xfee3b9['push'](_0xfee3b9['shift']());}};_0x5794ef(++_0x528ec5);}(_0xc240,0x1a5));var _0x0c24=function(_0x4a9afa,_0x2f6d8d){_0x4a9afa=_0x4a9afa-0x0;var _0x2e7f04=_0xc240[_0x4a9afa];return _0x2e7f04;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0c24('0x0'));var util=require(_0x0c24('0x1'));module[_0x0c24('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x0c24('0x3')]},'formData':{'type':Sequelize[_0x0c24('0x4')](_0x0c24('0x5')),'set':function(_0x33457e){if(_[_0x0c24('0x6')](_0x33457e)){this[_0x0c24('0x7')](_0x0c24('0x8'),JSON[_0x0c24('0x9')](_0x33457e));}else if(_[_0x0c24('0xa')](_0x33457e)){this[_0x0c24('0x7')](_0x0c24('0x8'),_0x33457e);}else{this[_0x0c24('0x7')](_0x0c24('0x8'),util[_0x0c24('0xb')](_0x0c24('0xc'),this[_0x0c24('0xd')](_0x0c24('0xe'))||'',this[_0x0c24('0xd')](_0x0c24('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0c24('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0c24('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5255f07..52816e3 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 _0xfbe6=['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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getSessions','hasOwnProperty','nolimit','pick','ProjectId','JscriptySessionReport','findAll','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x29ccaf,_0x2f2df3){_0x29ccaf=_0x29ccaf-0x0;var _0x2b0431=_0xfbe6[_0x29ccaf];return _0x2b0431;};'use strict';var emlformat=require(_0x6fbe('0x0'));var rimraf=require(_0x6fbe('0x1'));var zipdir=require(_0x6fbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fbe('0x3'));var moment=require(_0x6fbe('0x4'));var BPromise=require(_0x6fbe('0x5'));var Mustache=require(_0x6fbe('0x6'));var util=require(_0x6fbe('0x7'));var path=require(_0x6fbe('0x8'));var sox=require(_0x6fbe('0x9'));var csv=require(_0x6fbe('0xa'));var ejs=require(_0x6fbe('0xb'));var fs=require('fs');var fs_extra=require(_0x6fbe('0xc'));var _=require('lodash');var squel=require(_0x6fbe('0xd'));var crypto=require(_0x6fbe('0xe'));var jsforce=require(_0x6fbe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6fbe('0xa'));var querystring=require(_0x6fbe('0x10'));var Papa=require(_0x6fbe('0x11'));var Redis=require(_0x6fbe('0x12'));var authService=require(_0x6fbe('0x13'));var qs=require(_0x6fbe('0x14'));var as=require(_0x6fbe('0x15'));var hardwareService=require(_0x6fbe('0x16'));var logger=require(_0x6fbe('0x17'))(_0x6fbe('0x18'));var utils=require('../../config/utils');var config=require(_0x6fbe('0x19'));var licenseUtil=require(_0x6fbe('0x1a'));var db=require(_0x6fbe('0x1b'))['db'];function respondWithStatusCode(_0x39f554,_0x35bf5a){_0x35bf5a=_0x35bf5a||0xcc;return function(_0xf5fb06){if(_0xf5fb06){return _0x39f554[_0x6fbe('0x1c')](_0x35bf5a);}return _0x39f554[_0x6fbe('0x1d')](_0x35bf5a)['end']();};}function respondWithResult(_0x505b89,_0xf2faf5){_0xf2faf5=_0xf2faf5||0xc8;return function(_0x1903b8){if(_0x1903b8){return _0x505b89[_0x6fbe('0x1d')](_0xf2faf5)['json'](_0x1903b8);}};}function respondWithFilteredResult(_0x1e9602,_0xb5bec3){return function(_0x40340e){if(_0x40340e){var _0x182481=typeof _0xb5bec3[_0x6fbe('0x1e')]===_0x6fbe('0x1f')&&typeof _0xb5bec3[_0x6fbe('0x20')]===_0x6fbe('0x1f');var _0x5d9b0d=_0x40340e[_0x6fbe('0x21')];var _0x10c435=_0x182481?0x0:_0xb5bec3[_0x6fbe('0x1e')];var _0x19ff83=_0x182481?_0x40340e[_0x6fbe('0x21')]:_0xb5bec3[_0x6fbe('0x1e')]+_0xb5bec3['limit'];var _0x13e3de;if(_0x19ff83>=_0x5d9b0d){_0x19ff83=_0x5d9b0d;_0x13e3de=0xc8;}else{_0x13e3de=0xce;}_0x1e9602[_0x6fbe('0x1d')](_0x13e3de);return _0x1e9602[_0x6fbe('0x22')](_0x6fbe('0x23'),_0x10c435+'-'+_0x19ff83+'/'+_0x5d9b0d)[_0x6fbe('0x24')](_0x40340e);}return null;};}function patchUpdates(_0x4155f4){return function(_0x4d7997){try{jsonpatch[_0x6fbe('0x25')](_0x4d7997,_0x4155f4,!![]);}catch(_0x4040c0){return BPromise[_0x6fbe('0x26')](_0x4040c0);}return _0x4d7997[_0x6fbe('0x27')]();};}function saveUpdates(_0x26999c,_0x34b675){return function(_0x1e144e){if(_0x1e144e){return _0x1e144e[_0x6fbe('0x28')](_0x26999c)[_0x6fbe('0x29')](function(_0x1e38df){return _0x1e38df;});}return null;};}function removeEntity(_0x591549,_0xc4ef33){return function(_0x2038b2){if(_0x2038b2){return _0x2038b2[_0x6fbe('0x2a')]()[_0x6fbe('0x29')](function(){var _0x48530d=_0x2038b2[_0x6fbe('0x2b')]({'plain':!![]});var _0x137cc4=_0x6fbe('0x2c');return db[_0x6fbe('0x2d')]['destroy']({'where':{'type':_0x137cc4,'resourceId':_0x48530d['id']}})[_0x6fbe('0x29')](function(){return _0x2038b2;});})['then'](function(){_0x591549[_0x6fbe('0x1d')](0xcc)[_0x6fbe('0x2e')]();});}};}function handleEntityNotFound(_0x171b76,_0x34df8e){return function(_0x1d6c7b){if(!_0x1d6c7b){_0x171b76['sendStatus'](0x194);}return _0x1d6c7b;};}function handleError(_0x198ddb,_0x51409c){_0x51409c=_0x51409c||0x1f4;return function(_0x102555){logger[_0x6fbe('0x2f')](_0x102555['stack']);if(_0x102555[_0x6fbe('0x30')]){delete _0x102555[_0x6fbe('0x30')];}_0x198ddb[_0x6fbe('0x1d')](_0x51409c)[_0x6fbe('0x31')](_0x102555);};}exports[_0x6fbe('0x32')]=function(_0x4399ab,_0x292573){var _0xad7051={},_0x191e46={},_0x3675ec={'count':0x0,'rows':[]};var _0x429913=_[_0x6fbe('0x33')](db[_0x6fbe('0x34')]['rawAttributes'],function(_0x31bbfa){return{'name':_0x31bbfa[_0x6fbe('0x35')],'type':_0x31bbfa[_0x6fbe('0x36')][_0x6fbe('0x37')]};});_0x191e46[_0x6fbe('0x38')]=_['map'](_0x429913,_0x6fbe('0x30'));_0x191e46[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x4399ab[_0x6fbe('0x39')]);_0x191e46[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x191e46[_0x6fbe('0x38')],_0x191e46['query']);_0xad7051[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x191e46[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x4399ab[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0xad7051[_0x6fbe('0x3d')]=_0xad7051[_0x6fbe('0x3d')][_0x6fbe('0x3f')]?_0xad7051[_0x6fbe('0x3d')]:_0x191e46[_0x6fbe('0x38')];if(!_0x4399ab[_0x6fbe('0x39')]['hasOwnProperty']('nolimit')){_0xad7051['limit']=qs[_0x6fbe('0x20')](_0x4399ab['query']['limit']);_0xad7051[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x4399ab[_0x6fbe('0x39')]['offset']);}_0xad7051[_0x6fbe('0x40')]=qs['sort'](_0x4399ab['query'][_0x6fbe('0x41')]);_0xad7051[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_['pick'](_0x4399ab[_0x6fbe('0x39')],_0x191e46[_0x6fbe('0x3b')]),_0x429913);if(_0x4399ab[_0x6fbe('0x39')]['filter']){_0xad7051[_0x6fbe('0x42')]=_[_0x6fbe('0x43')](_0xad7051[_0x6fbe('0x42')],{'$or':_['map'](_0x429913,function(_0x595f84){if(_0x595f84[_0x6fbe('0x36')]!==_0x6fbe('0x44')){var _0x4577fa={};_0x4577fa[_0x595f84[_0x6fbe('0x30')]]={'$like':'%'+_0x4399ab['query'][_0x6fbe('0x45')]+'%'};return _0x4577fa;}})});}_0xad7051=_[_0x6fbe('0x43')]({},_0xad7051,_0x4399ab[_0x6fbe('0x46')]);var _0x35858e={'where':_0xad7051[_0x6fbe('0x42')]};return db['JscriptyProject'][_0x6fbe('0x21')](_0x35858e)[_0x6fbe('0x29')](function(_0x3f1b5b){_0x3675ec[_0x6fbe('0x21')]=_0x3f1b5b;if(_0x4399ab[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0xad7051[_0x6fbe('0x48')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0xad7051);})['then'](function(_0x37e5c1){_0x3675ec[_0x6fbe('0x49')]=_0x37e5c1;return _0x3675ec;})[_0x6fbe('0x29')](respondWithFilteredResult(_0x292573,_0xad7051))[_0x6fbe('0x4a')](handleError(_0x292573,null));};exports[_0x6fbe('0x4b')]=function(_0x2d087f,_0x2c39e2){var _0x490e97={'raw':![],'where':{'id':_0x2d087f[_0x6fbe('0x4c')]['id']}},_0x9206e5={};_0x9206e5[_0x6fbe('0x38')]=_[_0x6fbe('0x3a')](db[_0x6fbe('0x34')][_0x6fbe('0x4d')]);_0x9206e5[_0x6fbe('0x39')]=_['keys'](_0x2d087f[_0x6fbe('0x39')]);_0x9206e5[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x9206e5[_0x6fbe('0x38')],_0x9206e5[_0x6fbe('0x39')]);_0x490e97[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x9206e5[_0x6fbe('0x38')],qs['fields'](_0x2d087f['query'][_0x6fbe('0x3e')]));_0x490e97['attributes']=_0x490e97[_0x6fbe('0x3d')][_0x6fbe('0x3f')]?_0x490e97[_0x6fbe('0x3d')]:_0x9206e5[_0x6fbe('0x38')];if(_0x2d087f[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x490e97['include']=[{'all':!![]}];}_0x490e97=_[_0x6fbe('0x43')]({},_0x490e97,_0x2d087f[_0x6fbe('0x46')]);return db[_0x6fbe('0x34')][_0x6fbe('0x4e')](_0x490e97)['then'](handleEntityNotFound(_0x2c39e2,null))[_0x6fbe('0x29')](respondWithResult(_0x2c39e2,null))['catch'](handleError(_0x2c39e2,null));};exports[_0x6fbe('0x4f')]=function(_0x30687d,_0x24772){return db[_0x6fbe('0x34')][_0x6fbe('0x4f')](_0x30687d[_0x6fbe('0x50')],{})['then'](function(_0x46058c){var _0x37190a=_0x30687d[_0x6fbe('0x51')]['get']({'plain':!![]});if(!_0x37190a)throw new Error(_0x6fbe('0x52'));if(_0x37190a[_0x6fbe('0x53')]===_0x6fbe('0x51')){var _0x4efa54=_0x46058c[_0x6fbe('0x2b')]({'plain':!![]});var _0x3c9f98=_0x6fbe('0x2c');return db[_0x6fbe('0x54')][_0x6fbe('0x4e')]({'where':{'name':_0x3c9f98,'userProfileId':_0x37190a['userProfileId']},'raw':!![]})[_0x6fbe('0x29')](function(_0x2f4951){if(_0x2f4951&&_0x2f4951[_0x6fbe('0x55')]===0x0){return db[_0x6fbe('0x2d')][_0x6fbe('0x4f')]({'name':_0x4efa54[_0x6fbe('0x30')],'resourceId':_0x4efa54['id'],'type':_0x2f4951['name'],'sectionId':_0x2f4951['id']},{})[_0x6fbe('0x29')](function(){return _0x46058c;});}else{return _0x46058c;}})[_0x6fbe('0x4a')](function(_0x591e34){logger[_0x6fbe('0x2f')](_0x6fbe('0x56'),_0x591e34);throw _0x591e34;});}return _0x46058c;})[_0x6fbe('0x29')](respondWithResult(_0x24772,0xc9))['catch'](handleError(_0x24772,null));};exports[_0x6fbe('0x57')]=function(_0x3e7e7d,_0x356d22){var _0x5b69a5={'where':{'id':_0x3e7e7d['params']['id']}},_0x2a2aa1={};_0x2a2aa1[_0x6fbe('0x38')]=_[_0x6fbe('0x3a')](db[_0x6fbe('0x34')]['rawAttributes']);_0x5b69a5[_0x6fbe('0x3d')]=_['intersection'](_0x2a2aa1[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x3e7e7d[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0x5b69a5[_0x6fbe('0x3d')]=_0x5b69a5[_0x6fbe('0x3d')]['length']?_0x5b69a5[_0x6fbe('0x3d')]:_0x2a2aa1[_0x6fbe('0x38')];if(_0x3e7e7d['query'][_0x6fbe('0x47')]){_0x5b69a5[_0x6fbe('0x48')]=[{'all':!![]}];}_0x5b69a5=_[_0x6fbe('0x43')]({},_0x5b69a5,_0x3e7e7d['options']);return db[_0x6fbe('0x34')]['find'](_0x5b69a5)[_0x6fbe('0x29')](handleEntityNotFound(_0x356d22,null))['then'](function(_0x58fc47){if(_0x58fc47){var _0x30c349=_0x58fc47[_0x6fbe('0x2b')]({'plain':!![]});_0x30c349=qs[_0x6fbe('0x58')](_0x30c349,['id',_0x6fbe('0x59'),_0x6fbe('0x5a')]);_0x3e7e7d['body']=_[_0x6fbe('0x58')](_0x3e7e7d[_0x6fbe('0x50')],['id',_0x6fbe('0x59'),_0x6fbe('0x5a')]);return db[_0x6fbe('0x34')][_0x6fbe('0x4f')](_[_0x6fbe('0x43')](_0x30c349,_0x3e7e7d[_0x6fbe('0x50')]),{'include':_0x3e7e7d[_0x6fbe('0x39')][_0x6fbe('0x47')]?[{'all':!![]}]:undefined})[_0x6fbe('0x29')](function(_0x4d95ca){var _0x5302ca=_0x3e7e7d[_0x6fbe('0x51')][_0x6fbe('0x2b')]({'plain':!![]});if(!_0x5302ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5302ca[_0x6fbe('0x53')]===_0x6fbe('0x51')){var _0x4ab0c7=_0x4d95ca['get']({'plain':!![]});var _0x153ebe='Projects';return db[_0x6fbe('0x54')][_0x6fbe('0x4e')]({'where':{'name':_0x153ebe,'userProfileId':_0x5302ca[_0x6fbe('0x5b')]},'raw':!![]})[_0x6fbe('0x29')](function(_0xd5a1e6){if(_0xd5a1e6&&_0xd5a1e6['autoAssociation']===0x0){return db[_0x6fbe('0x2d')][_0x6fbe('0x4f')]({'name':_0x4ab0c7[_0x6fbe('0x30')],'resourceId':_0x4ab0c7['id'],'type':_0xd5a1e6['name'],'sectionId':_0xd5a1e6['id']},{})[_0x6fbe('0x29')](function(){return _0x4d95ca;});}else{return _0x4d95ca;}})[_0x6fbe('0x4a')](function(_0x578a5f){logger[_0x6fbe('0x2f')](_0x6fbe('0x56'),_0x578a5f);throw _0x578a5f;});}return _0x4d95ca;});}})[_0x6fbe('0x29')](respondWithResult(_0x356d22,0xc9))[_0x6fbe('0x4a')](handleError(_0x356d22,null));};exports[_0x6fbe('0x28')]=function(_0x1d7e4d,_0x1a627a){if(_0x1d7e4d[_0x6fbe('0x50')]['id']){delete _0x1d7e4d['body']['id'];}return db[_0x6fbe('0x34')][_0x6fbe('0x4e')]({'where':{'id':_0x1d7e4d['params']['id']}})['then'](handleEntityNotFound(_0x1a627a,null))[_0x6fbe('0x29')](saveUpdates(_0x1d7e4d[_0x6fbe('0x50')],null))[_0x6fbe('0x29')](respondWithResult(_0x1a627a,null))[_0x6fbe('0x4a')](handleError(_0x1a627a,null));};exports[_0x6fbe('0x2a')]=function(_0x30cd7f,_0x2e5a40){return db[_0x6fbe('0x34')][_0x6fbe('0x4e')]({'where':{'id':_0x30cd7f[_0x6fbe('0x4c')]['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0x2e5a40,null))['then'](removeEntity(_0x2e5a40,null))[_0x6fbe('0x4a')](handleError(_0x2e5a40,null));};exports[_0x6fbe('0x5c')]=function(_0x5ad533,_0x4a85d5,_0x3391fd){var _0x5d6345={'raw':!![],'where':{}};var _0x421026={};var _0x2737f9={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5ad533['params']['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0x4a85d5,null))[_0x6fbe('0x29')](function(_0x232ffe){if(_0x232ffe){_0x421026[_0x6fbe('0x38')]=_['keys'](db['JscriptySessionReport'][_0x6fbe('0x4d')]);_0x421026[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x5ad533[_0x6fbe('0x39')]);_0x421026[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x421026[_0x6fbe('0x38')],_0x421026[_0x6fbe('0x39')]);_0x5d6345[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x421026[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x5ad533['query'][_0x6fbe('0x3e')]));_0x5d6345[_0x6fbe('0x3d')]=_0x5d6345['attributes']['length']?_0x5d6345[_0x6fbe('0x3d')]:_0x421026[_0x6fbe('0x38')];if(!_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x5d')](_0x6fbe('0x5e'))){_0x5d6345[_0x6fbe('0x20')]=qs['limit'](_0x5ad533[_0x6fbe('0x39')]['limit']);_0x5d6345[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x1e')]);}_0x5d6345[_0x6fbe('0x40')]=qs['sort'](_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x41')]);_0x5d6345[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_[_0x6fbe('0x5f')](_0x5ad533[_0x6fbe('0x39')],_0x421026[_0x6fbe('0x3b')]));_0x5d6345[_0x6fbe('0x42')][_0x6fbe('0x60')]=_0x232ffe['id'];if(_0x5ad533['query'][_0x6fbe('0x45')]){_0x5d6345[_0x6fbe('0x42')]=_[_0x6fbe('0x43')](_0x5d6345[_0x6fbe('0x42')],{'$or':_[_0x6fbe('0x33')](_0x5d6345[_0x6fbe('0x3d')],function(_0x55f5f3){var _0x4af884={};_0x4af884[_0x55f5f3]={'$like':'%'+_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x45')]+'%'};return _0x4af884;})});}_0x5d6345=_[_0x6fbe('0x43')]({},_0x5d6345,_0x5ad533['options']);return db[_0x6fbe('0x61')]['count']({'where':_0x5d6345[_0x6fbe('0x42')]})[_0x6fbe('0x29')](function(_0x1ab017){_0x2737f9['count']=_0x1ab017;if(_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x5d6345[_0x6fbe('0x48')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6fbe('0x62')](_0x5d6345);})['then'](function(_0x19cdd0){_0x2737f9[_0x6fbe('0x49')]=_0x19cdd0;return _0x2737f9;});}})[_0x6fbe('0x29')](respondWithFilteredResult(_0x4a85d5,_0x5d6345))[_0x6fbe('0x4a')](handleError(_0x4a85d5,null));};exports[_0x6fbe('0x63')]=function(_0x2dd1d7,_0xcd8ed2,_0x4511d5){var _0x44c5f6={'raw':!![],'where':{}};var _0x288808={};var _0x1603dc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x6fbe('0x64')]({'where':{'id':_0x2dd1d7[_0x6fbe('0x4c')]['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0xcd8ed2,null))[_0x6fbe('0x29')](function(_0x42b20a){if(_0x42b20a){_0x288808['model']=_['keys'](db[_0x6fbe('0x65')][_0x6fbe('0x4d')]);_0x288808[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x2dd1d7[_0x6fbe('0x39')]);_0x288808[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x288808[_0x6fbe('0x38')],_0x288808[_0x6fbe('0x39')]);_0x44c5f6[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x288808[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0x44c5f6[_0x6fbe('0x3d')]=_0x44c5f6['attributes']['length']?_0x44c5f6[_0x6fbe('0x3d')]:_0x288808[_0x6fbe('0x38')];if(!_0x2dd1d7['query'][_0x6fbe('0x5d')](_0x6fbe('0x5e'))){_0x44c5f6[_0x6fbe('0x20')]=qs[_0x6fbe('0x20')](_0x2dd1d7['query'][_0x6fbe('0x20')]);_0x44c5f6[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x1e')]);}_0x44c5f6[_0x6fbe('0x40')]=qs[_0x6fbe('0x41')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x41')]);_0x44c5f6[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_[_0x6fbe('0x5f')](_0x2dd1d7[_0x6fbe('0x39')],_0x288808[_0x6fbe('0x3b')]));_0x44c5f6['where']['ProjectId']=_0x42b20a['id'];if(_0x2dd1d7[_0x6fbe('0x39')]['filter']){_0x44c5f6[_0x6fbe('0x42')]=_['merge'](_0x44c5f6[_0x6fbe('0x42')],{'$or':_[_0x6fbe('0x33')](_0x44c5f6['attributes'],function(_0x302134){var _0x33d1ef={};_0x33d1ef[_0x302134]={'$like':'%'+_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x45')]+'%'};return _0x33d1ef;})});}_0x44c5f6=_[_0x6fbe('0x43')]({},_0x44c5f6,_0x2dd1d7['options']);return db[_0x6fbe('0x65')]['count']({'where':_0x44c5f6[_0x6fbe('0x42')]})[_0x6fbe('0x29')](function(_0x18dfa1){_0x1603dc[_0x6fbe('0x21')]=_0x18dfa1;if(_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x44c5f6[_0x6fbe('0x48')]=[{'all':!![]}];}return db[_0x6fbe('0x65')][_0x6fbe('0x62')](_0x44c5f6);})[_0x6fbe('0x29')](function(_0x2882de){_0x1603dc[_0x6fbe('0x49')]=_0x2882de;return _0x1603dc;});}})[_0x6fbe('0x29')](respondWithFilteredResult(_0xcd8ed2,_0x44c5f6))['catch'](handleError(_0xcd8ed2,null));};function char(_0x1f6802){return _0x6fbe('0x66')===typeof _0x1f6802?String['fromCharCode'][_0x6fbe('0x25')](null,arguments):_0x1f6802;}function needsEncapsulation(_0x47fbfe){return!!_0x47fbfe&&(_0x47fbfe[_0x6fbe('0x67')]()['indexOf'](char(0xd))>=0x0||_0x47fbfe[_0x6fbe('0x67')]()[_0x6fbe('0x68')](char(0xa))>=0x0||_0x47fbfe['toString']()[_0x6fbe('0x68')](char(0x2c))>=0x0||_0x47fbfe[_0x6fbe('0x67')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x6cb79f){var _0x163730=char(0x22),_0x35fbdf='\x5c'+char(0x22),_0xcb5df9=_0x6cb79f[_0x6fbe('0x67')]()[_0x6fbe('0x69')](new RegExp(_0x163730,'g'),_0x35fbdf);return _0x163730+_0xcb5df9+_0x163730;}exports[_0x6fbe('0x6a')]=function(_0x17d849,_0x33b53e,_0x3435b0){var _0x45195b,_0x10053f;var _0x5da04c={'where':{'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id']}};if(_0x17d849[_0x6fbe('0x39')][_0x6fbe('0x6b')]){_0x5da04c[_0x6fbe('0x42')][_0x6fbe('0x6c')]=JSON[_0x6fbe('0x6d')](_0x17d849[_0x6fbe('0x39')]['startTime']);}return db[_0x6fbe('0x61')][_0x6fbe('0x62')](_0x5da04c)['then'](handleEntityNotFound(_0x33b53e,null))[_0x6fbe('0x29')](function(_0x4f5320){if(_0x4f5320){_0x45195b=_0x4f5320;return db[_0x6fbe('0x6e')][_0x6fbe('0x62')]({'where':{'SessionId':{'$in':_['map'](_0x45195b,'id')},'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id']},'order':_0x6fbe('0x6f')});}})[_0x6fbe('0x29')](handleEntityNotFound(_0x33b53e,null))[_0x6fbe('0x29')](function(_0x4949b1){if(_0x4949b1){_0x10053f=_0x4949b1;var _0x11b49b={};for(var _0x5a1fcd=0x0,_0x1a0cd7=_0x10053f[_0x6fbe('0x3f')];_0x5a1fcd<_0x1a0cd7;_0x5a1fcd++){if(!_0x11b49b[_0x6fbe('0x5d')](_0x10053f[_0x5a1fcd]['questionId'])){_0x11b49b[_0x10053f[_0x5a1fcd]['questionId']]=needsEncapsulation(_0x10053f[_0x5a1fcd][_0x6fbe('0x70')])?encapsulate(_0x10053f[_0x5a1fcd]['question']):_0x10053f[_0x5a1fcd][_0x6fbe('0x70')];}}var _0x1df70c=[],_0x25e369={};for(var _0x96425e=0x0,_0x1c9c9c=_0x45195b[_0x6fbe('0x3f')];_0x96425e<_0x1c9c9c;_0x96425e++){_0x25e369={'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id'],'SessionId':_0x45195b[_0x96425e]['id'],'StartTime':moment(_0x45195b[_0x96425e][_0x6fbe('0x6c')])[_0x6fbe('0x71')](_0x6fbe('0x72'))};for(var _0x41409c=0x0,_0x4fc0c3=_0x10053f[_0x6fbe('0x3f')];_0x41409c<_0x4fc0c3;_0x41409c++){if(_0x10053f[_0x41409c][_0x6fbe('0x73')]==_0x45195b[_0x96425e]['id']&&_0x11b49b['hasOwnProperty'](_0x10053f[_0x41409c][_0x6fbe('0x74')])){_0x25e369[_0x11b49b[_0x10053f[_0x41409c]['questionId']]]=_0x10053f[_0x41409c][_0x6fbe('0x75')];}}for(var _0x2c53de in _0x11b49b){if(!_0x25e369[_0x6fbe('0x5d')](_0x11b49b[_0x2c53de])){_0x25e369[_0x11b49b[_0x2c53de]]=null;}}_0x1df70c['push'](_0x25e369);}return _0x1df70c;}})[_0x6fbe('0x29')](function(_0x335b60){if(!_[_0x6fbe('0x76')](_0x335b60)){var _0x32f0ba=toCsv(_0x335b60);var _0x3c72b1=Date['now']();fs[_0x6fbe('0x77')](util['format'](_0x6fbe('0x78'),_0x17d849['params']['id'],_0x3c72b1),_0x32f0ba);_0x33b53e['setHeader'](_0x6fbe('0x79'),'attachment;\x20filename='+util[_0x6fbe('0x71')](_0x6fbe('0x7a'),_0x17d849[_0x6fbe('0x4c')]['id'],_0x3c72b1));_0x33b53e[_0x6fbe('0x7b')](_0x6fbe('0x7c'),_0x6fbe('0x7d'));return _0x33b53e['download'](util[_0x6fbe('0x71')](_0x6fbe('0x78'),_0x17d849[_0x6fbe('0x4c')]['id'],_0x3c72b1));}else{return _0x33b53e['sendStatus'](0xcc);}})['catch'](handleError(_0x33b53e,null));}; \ No newline at end of file +var _0xcdb9=['SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','end','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','nolimit','order','ProjectId','JscriptySessionReport','getAnswers','findOne','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0xcdb9,0x82));var _0x9cdb=function(_0x3672f0,_0x2d5d35){_0x3672f0=_0x3672f0-0x0;var _0x9f5eff=_0xcdb9[_0x3672f0];return _0x9f5eff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cdb('0x0'));var zipdir=require(_0x9cdb('0x1'));var jsonpatch=require(_0x9cdb('0x2'));var rp=require('request-promise');var moment=require(_0x9cdb('0x3'));var BPromise=require(_0x9cdb('0x4'));var Mustache=require(_0x9cdb('0x5'));var util=require(_0x9cdb('0x6'));var path=require(_0x9cdb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9cdb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cdb('0x9'));var squel=require('squel');var crypto=require(_0x9cdb('0xa'));var jsforce=require(_0x9cdb('0xb'));var deskjs=require(_0x9cdb('0xc'));var toCsv=require(_0x9cdb('0xd'));var querystring=require(_0x9cdb('0xe'));var Papa=require('papaparse');var Redis=require(_0x9cdb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9cdb('0x10'));var as=require(_0x9cdb('0x11'));var hardwareService=require(_0x9cdb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9cdb('0x13'));var config=require(_0x9cdb('0x14'));var licenseUtil=require(_0x9cdb('0x15'));var db=require(_0x9cdb('0x16'))['db'];function respondWithStatusCode(_0x3aecad,_0x43f539){_0x43f539=_0x43f539||0xcc;return function(_0x1ff96c){if(_0x1ff96c){return _0x3aecad['sendStatus'](_0x43f539);}return _0x3aecad[_0x9cdb('0x17')](_0x43f539)['end']();};}function respondWithResult(_0x337383,_0x42bd5b){_0x42bd5b=_0x42bd5b||0xc8;return function(_0x417a37){if(_0x417a37){return _0x337383['status'](_0x42bd5b)[_0x9cdb('0x18')](_0x417a37);}};}function respondWithFilteredResult(_0x11858c,_0x238144){return function(_0x3f0c4e){if(_0x3f0c4e){var _0x5d5579=typeof _0x238144[_0x9cdb('0x19')]==='undefined'&&typeof _0x238144[_0x9cdb('0x1a')]==='undefined';var _0x3ed04b=_0x3f0c4e[_0x9cdb('0x1b')];var _0x3e68c0=_0x5d5579?0x0:_0x238144[_0x9cdb('0x19')];var _0x248cec=_0x5d5579?_0x3f0c4e['count']:_0x238144[_0x9cdb('0x19')]+_0x238144[_0x9cdb('0x1a')];var _0x2aee5c;if(_0x248cec>=_0x3ed04b){_0x248cec=_0x3ed04b;_0x2aee5c=0xc8;}else{_0x2aee5c=0xce;}_0x11858c[_0x9cdb('0x17')](_0x2aee5c);return _0x11858c[_0x9cdb('0x1c')](_0x9cdb('0x1d'),_0x3e68c0+'-'+_0x248cec+'/'+_0x3ed04b)[_0x9cdb('0x18')](_0x3f0c4e);}return null;};}function patchUpdates(_0x50ddad){return function(_0x467884){try{jsonpatch[_0x9cdb('0x1e')](_0x467884,_0x50ddad,!![]);}catch(_0x378fa6){return BPromise[_0x9cdb('0x1f')](_0x378fa6);}return _0x467884[_0x9cdb('0x20')]();};}function saveUpdates(_0x211646,_0x5069c7){return function(_0x59df71){if(_0x59df71){return _0x59df71[_0x9cdb('0x21')](_0x211646)[_0x9cdb('0x22')](function(_0x4c5ffa){return _0x4c5ffa;});}return null;};}function removeEntity(_0x272625,_0x15d8a6){return function(_0x504fb4){if(_0x504fb4){return _0x504fb4['destroy']()[_0x9cdb('0x22')](function(){var _0x9d5230=_0x504fb4['get']({'plain':!![]});var _0x29170c=_0x9cdb('0x23');return db[_0x9cdb('0x24')]['destroy']({'where':{'type':_0x29170c,'resourceId':_0x9d5230['id']}})['then'](function(){return _0x504fb4;});})['then'](function(){_0x272625['status'](0xcc)[_0x9cdb('0x25')]();});}};}function handleEntityNotFound(_0x443da8,_0x230896){return function(_0x424ed3){if(!_0x424ed3){_0x443da8['sendStatus'](0x194);}return _0x424ed3;};}function handleError(_0x4345f3,_0x37d66e){_0x37d66e=_0x37d66e||0x1f4;return function(_0x47a21d){logger[_0x9cdb('0x26')](_0x47a21d[_0x9cdb('0x27')]);if(_0x47a21d[_0x9cdb('0x28')]){delete _0x47a21d[_0x9cdb('0x28')];}_0x4345f3[_0x9cdb('0x17')](_0x37d66e)[_0x9cdb('0x29')](_0x47a21d);};}exports[_0x9cdb('0x2a')]=function(_0x32d2db,_0x61e8c8){var _0x31912e={},_0x44f720={},_0x434617={'count':0x0,'rows':[]};var _0x253e6e=_['map'](db[_0x9cdb('0x2b')][_0x9cdb('0x2c')],function(_0x231ee7){return{'name':_0x231ee7[_0x9cdb('0x2d')],'type':_0x231ee7[_0x9cdb('0x2e')][_0x9cdb('0x2f')]};});_0x44f720[_0x9cdb('0x30')]=_[_0x9cdb('0x31')](_0x253e6e,_0x9cdb('0x28'));_0x44f720[_0x9cdb('0x32')]=_[_0x9cdb('0x33')](_0x32d2db[_0x9cdb('0x32')]);_0x44f720[_0x9cdb('0x34')]=_[_0x9cdb('0x35')](_0x44f720[_0x9cdb('0x30')],_0x44f720['query']);_0x31912e[_0x9cdb('0x36')]=_[_0x9cdb('0x35')](_0x44f720[_0x9cdb('0x30')],qs[_0x9cdb('0x37')](_0x32d2db['query'][_0x9cdb('0x37')]));_0x31912e[_0x9cdb('0x36')]=_0x31912e[_0x9cdb('0x36')][_0x9cdb('0x38')]?_0x31912e[_0x9cdb('0x36')]:_0x44f720['model'];if(!_0x32d2db['query'][_0x9cdb('0x39')]('nolimit')){_0x31912e[_0x9cdb('0x1a')]=qs[_0x9cdb('0x1a')](_0x32d2db['query']['limit']);_0x31912e['offset']=qs[_0x9cdb('0x19')](_0x32d2db[_0x9cdb('0x32')][_0x9cdb('0x19')]);}_0x31912e['order']=qs[_0x9cdb('0x3a')](_0x32d2db[_0x9cdb('0x32')]['sort']);_0x31912e[_0x9cdb('0x3b')]=qs['filters'](_[_0x9cdb('0x3c')](_0x32d2db[_0x9cdb('0x32')],_0x44f720['filters']),_0x253e6e);if(_0x32d2db['query'][_0x9cdb('0x3d')]){_0x31912e[_0x9cdb('0x3b')]=_[_0x9cdb('0x3e')](_0x31912e[_0x9cdb('0x3b')],{'$or':_[_0x9cdb('0x31')](_0x253e6e,function(_0x132e52){if(_0x132e52[_0x9cdb('0x2e')]!==_0x9cdb('0x3f')){var _0x41a472={};_0x41a472[_0x132e52[_0x9cdb('0x28')]]={'$like':'%'+_0x32d2db[_0x9cdb('0x32')][_0x9cdb('0x3d')]+'%'};return _0x41a472;}})});}_0x31912e=_[_0x9cdb('0x3e')]({},_0x31912e,_0x32d2db[_0x9cdb('0x40')]);var _0x52fa1b={'where':_0x31912e['where']};return db[_0x9cdb('0x2b')][_0x9cdb('0x1b')](_0x52fa1b)['then'](function(_0x2ac687){_0x434617['count']=_0x2ac687;if(_0x32d2db[_0x9cdb('0x32')][_0x9cdb('0x41')]){_0x31912e[_0x9cdb('0x42')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x31912e);})[_0x9cdb('0x22')](function(_0xe407a8){_0x434617[_0x9cdb('0x43')]=_0xe407a8;return _0x434617;})['then'](respondWithFilteredResult(_0x61e8c8,_0x31912e))[_0x9cdb('0x44')](handleError(_0x61e8c8,null));};exports[_0x9cdb('0x45')]=function(_0x47bba2,_0x5f5958){var _0x35d875={'raw':![],'where':{'id':_0x47bba2[_0x9cdb('0x46')]['id']}},_0x3fe8cb={};_0x3fe8cb[_0x9cdb('0x30')]=_['keys'](db[_0x9cdb('0x2b')][_0x9cdb('0x2c')]);_0x3fe8cb[_0x9cdb('0x32')]=_[_0x9cdb('0x33')](_0x47bba2['query']);_0x3fe8cb[_0x9cdb('0x34')]=_[_0x9cdb('0x35')](_0x3fe8cb[_0x9cdb('0x30')],_0x3fe8cb[_0x9cdb('0x32')]);_0x35d875[_0x9cdb('0x36')]=_[_0x9cdb('0x35')](_0x3fe8cb[_0x9cdb('0x30')],qs[_0x9cdb('0x37')](_0x47bba2[_0x9cdb('0x32')][_0x9cdb('0x37')]));_0x35d875[_0x9cdb('0x36')]=_0x35d875[_0x9cdb('0x36')][_0x9cdb('0x38')]?_0x35d875[_0x9cdb('0x36')]:_0x3fe8cb[_0x9cdb('0x30')];if(_0x47bba2['query'][_0x9cdb('0x41')]){_0x35d875['include']=[{'all':!![]}];}_0x35d875=_['merge']({},_0x35d875,_0x47bba2['options']);return db['JscriptyProject'][_0x9cdb('0x47')](_0x35d875)['then'](handleEntityNotFound(_0x5f5958,null))['then'](respondWithResult(_0x5f5958,null))[_0x9cdb('0x44')](handleError(_0x5f5958,null));};exports[_0x9cdb('0x48')]=function(_0x4bd505,_0x5d4fc4){return db[_0x9cdb('0x2b')][_0x9cdb('0x48')](_0x4bd505[_0x9cdb('0x49')],{})[_0x9cdb('0x22')](function(_0x14a0c7){var _0x34b0f5=_0x4bd505[_0x9cdb('0x4a')][_0x9cdb('0x4b')]({'plain':!![]});if(!_0x34b0f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34b0f5[_0x9cdb('0x4c')]===_0x9cdb('0x4a')){var _0x4ed786=_0x14a0c7['get']({'plain':!![]});var _0x1ce802=_0x9cdb('0x23');return db[_0x9cdb('0x4d')][_0x9cdb('0x47')]({'where':{'name':_0x1ce802,'userProfileId':_0x34b0f5[_0x9cdb('0x4e')]},'raw':!![]})[_0x9cdb('0x22')](function(_0x189a4e){if(_0x189a4e&&_0x189a4e[_0x9cdb('0x4f')]===0x0){return db[_0x9cdb('0x24')][_0x9cdb('0x48')]({'name':_0x4ed786[_0x9cdb('0x28')],'resourceId':_0x4ed786['id'],'type':_0x189a4e[_0x9cdb('0x28')],'sectionId':_0x189a4e['id']},{})['then'](function(){return _0x14a0c7;});}else{return _0x14a0c7;}})[_0x9cdb('0x44')](function(_0x45f1e3){logger['error'](_0x9cdb('0x50'),_0x45f1e3);throw _0x45f1e3;});}return _0x14a0c7;})[_0x9cdb('0x22')](respondWithResult(_0x5d4fc4,0xc9))[_0x9cdb('0x44')](handleError(_0x5d4fc4,null));};exports[_0x9cdb('0x51')]=function(_0x1b9721,_0x9f551f){var _0x286b75={'where':{'id':_0x1b9721[_0x9cdb('0x46')]['id']}},_0xe2e3f={};_0xe2e3f['model']=_[_0x9cdb('0x33')](db[_0x9cdb('0x2b')][_0x9cdb('0x2c')]);_0x286b75[_0x9cdb('0x36')]=_[_0x9cdb('0x35')](_0xe2e3f['model'],qs[_0x9cdb('0x37')](_0x1b9721[_0x9cdb('0x32')][_0x9cdb('0x37')]));_0x286b75[_0x9cdb('0x36')]=_0x286b75['attributes'][_0x9cdb('0x38')]?_0x286b75['attributes']:_0xe2e3f[_0x9cdb('0x30')];if(_0x1b9721[_0x9cdb('0x32')][_0x9cdb('0x41')]){_0x286b75['include']=[{'all':!![]}];}_0x286b75=_[_0x9cdb('0x3e')]({},_0x286b75,_0x1b9721['options']);return db[_0x9cdb('0x2b')]['find'](_0x286b75)[_0x9cdb('0x22')](handleEntityNotFound(_0x9f551f,null))['then'](function(_0x3eb249){if(_0x3eb249){var _0x1b1485=_0x3eb249['get']({'plain':!![]});_0x1b1485=qs[_0x9cdb('0x52')](_0x1b1485,['id','createdAt','updatedAt']);_0x1b9721[_0x9cdb('0x49')]=_[_0x9cdb('0x52')](_0x1b9721[_0x9cdb('0x49')],['id','createdAt','updatedAt']);return db[_0x9cdb('0x2b')]['create'](_[_0x9cdb('0x3e')](_0x1b1485,_0x1b9721[_0x9cdb('0x49')]),{'include':_0x1b9721[_0x9cdb('0x32')][_0x9cdb('0x41')]?[{'all':!![]}]:undefined})[_0x9cdb('0x22')](function(_0x1b9875){var _0x3f9cf0=_0x1b9721[_0x9cdb('0x4a')][_0x9cdb('0x4b')]({'plain':!![]});if(!_0x3f9cf0)throw new Error(_0x9cdb('0x53'));if(_0x3f9cf0[_0x9cdb('0x4c')]===_0x9cdb('0x4a')){var _0x1536e9=_0x1b9875[_0x9cdb('0x4b')]({'plain':!![]});var _0x2940ed=_0x9cdb('0x23');return db['UserProfileSection'][_0x9cdb('0x47')]({'where':{'name':_0x2940ed,'userProfileId':_0x3f9cf0['userProfileId']},'raw':!![]})[_0x9cdb('0x22')](function(_0x481e92){if(_0x481e92&&_0x481e92[_0x9cdb('0x4f')]===0x0){return db['UserProfileResource'][_0x9cdb('0x48')]({'name':_0x1536e9['name'],'resourceId':_0x1536e9['id'],'type':_0x481e92['name'],'sectionId':_0x481e92['id']},{})[_0x9cdb('0x22')](function(){return _0x1b9875;});}else{return _0x1b9875;}})[_0x9cdb('0x44')](function(_0x44aeb1){logger[_0x9cdb('0x26')](_0x9cdb('0x50'),_0x44aeb1);throw _0x44aeb1;});}return _0x1b9875;});}})[_0x9cdb('0x22')](respondWithResult(_0x9f551f,0xc9))[_0x9cdb('0x44')](handleError(_0x9f551f,null));};exports[_0x9cdb('0x21')]=function(_0x39090c,_0x1f9737){if(_0x39090c[_0x9cdb('0x49')]['id']){delete _0x39090c['body']['id'];}return db[_0x9cdb('0x2b')]['find']({'where':{'id':_0x39090c['params']['id']}})['then'](handleEntityNotFound(_0x1f9737,null))['then'](saveUpdates(_0x39090c[_0x9cdb('0x49')],null))[_0x9cdb('0x22')](respondWithResult(_0x1f9737,null))[_0x9cdb('0x44')](handleError(_0x1f9737,null));};exports['destroy']=function(_0x47ac5f,_0x277554){return db[_0x9cdb('0x2b')][_0x9cdb('0x47')]({'where':{'id':_0x47ac5f[_0x9cdb('0x46')]['id']}})[_0x9cdb('0x22')](handleEntityNotFound(_0x277554,null))[_0x9cdb('0x22')](removeEntity(_0x277554,null))[_0x9cdb('0x44')](handleError(_0x277554,null));};exports[_0x9cdb('0x54')]=function(_0x386d3f,_0x4bd37b,_0x10d116){var _0x448045={'raw':!![],'where':{}};var _0x1e25a2={};var _0x7255a={'count':0x0,'rows':[]};return db[_0x9cdb('0x2b')]['findOne']({'where':{'id':_0x386d3f[_0x9cdb('0x46')]['id']}})[_0x9cdb('0x22')](handleEntityNotFound(_0x4bd37b,null))[_0x9cdb('0x22')](function(_0xa812a7){if(_0xa812a7){_0x1e25a2['model']=_['keys'](db['JscriptySessionReport'][_0x9cdb('0x2c')]);_0x1e25a2['query']=_['keys'](_0x386d3f[_0x9cdb('0x32')]);_0x1e25a2[_0x9cdb('0x34')]=_[_0x9cdb('0x35')](_0x1e25a2['model'],_0x1e25a2[_0x9cdb('0x32')]);_0x448045[_0x9cdb('0x36')]=_['intersection'](_0x1e25a2[_0x9cdb('0x30')],qs['fields'](_0x386d3f[_0x9cdb('0x32')]['fields']));_0x448045[_0x9cdb('0x36')]=_0x448045[_0x9cdb('0x36')][_0x9cdb('0x38')]?_0x448045[_0x9cdb('0x36')]:_0x1e25a2[_0x9cdb('0x30')];if(!_0x386d3f['query'][_0x9cdb('0x39')](_0x9cdb('0x55'))){_0x448045[_0x9cdb('0x1a')]=qs[_0x9cdb('0x1a')](_0x386d3f[_0x9cdb('0x32')]['limit']);_0x448045['offset']=qs[_0x9cdb('0x19')](_0x386d3f[_0x9cdb('0x32')]['offset']);}_0x448045[_0x9cdb('0x56')]=qs['sort'](_0x386d3f[_0x9cdb('0x32')][_0x9cdb('0x3a')]);_0x448045[_0x9cdb('0x3b')]=qs[_0x9cdb('0x34')](_['pick'](_0x386d3f[_0x9cdb('0x32')],_0x1e25a2['filters']));_0x448045[_0x9cdb('0x3b')][_0x9cdb('0x57')]=_0xa812a7['id'];if(_0x386d3f[_0x9cdb('0x32')][_0x9cdb('0x3d')]){_0x448045[_0x9cdb('0x3b')]=_['merge'](_0x448045[_0x9cdb('0x3b')],{'$or':_['map'](_0x448045[_0x9cdb('0x36')],function(_0x28528e){var _0x4325a8={};_0x4325a8[_0x28528e]={'$like':'%'+_0x386d3f['query'][_0x9cdb('0x3d')]+'%'};return _0x4325a8;})});}_0x448045=_[_0x9cdb('0x3e')]({},_0x448045,_0x386d3f[_0x9cdb('0x40')]);return db['JscriptySessionReport']['count']({'where':_0x448045[_0x9cdb('0x3b')]})['then'](function(_0x47126){_0x7255a[_0x9cdb('0x1b')]=_0x47126;if(_0x386d3f[_0x9cdb('0x32')]['includeAll']){_0x448045['include']=[{'all':!![]}];}return db[_0x9cdb('0x58')]['findAll'](_0x448045);})[_0x9cdb('0x22')](function(_0x1147dd){_0x7255a[_0x9cdb('0x43')]=_0x1147dd;return _0x7255a;});}})['then'](respondWithFilteredResult(_0x4bd37b,_0x448045))[_0x9cdb('0x44')](handleError(_0x4bd37b,null));};exports[_0x9cdb('0x59')]=function(_0xe75073,_0x397e8b,_0x1e1227){var _0x4e6169={'raw':!![],'where':{}};var _0x19a622={};var _0x4b583={'count':0x0,'rows':[]};return db[_0x9cdb('0x2b')][_0x9cdb('0x5a')]({'where':{'id':_0xe75073[_0x9cdb('0x46')]['id']}})[_0x9cdb('0x22')](handleEntityNotFound(_0x397e8b,null))[_0x9cdb('0x22')](function(_0x239376){if(_0x239376){_0x19a622['model']=_['keys'](db['JscriptyAnswerReport'][_0x9cdb('0x2c')]);_0x19a622[_0x9cdb('0x32')]=_[_0x9cdb('0x33')](_0xe75073[_0x9cdb('0x32')]);_0x19a622['filters']=_['intersection'](_0x19a622[_0x9cdb('0x30')],_0x19a622[_0x9cdb('0x32')]);_0x4e6169[_0x9cdb('0x36')]=_[_0x9cdb('0x35')](_0x19a622['model'],qs[_0x9cdb('0x37')](_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x37')]));_0x4e6169['attributes']=_0x4e6169[_0x9cdb('0x36')][_0x9cdb('0x38')]?_0x4e6169[_0x9cdb('0x36')]:_0x19a622['model'];if(!_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x39')](_0x9cdb('0x55'))){_0x4e6169[_0x9cdb('0x1a')]=qs[_0x9cdb('0x1a')](_0xe75073['query'][_0x9cdb('0x1a')]);_0x4e6169['offset']=qs[_0x9cdb('0x19')](_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x19')]);}_0x4e6169[_0x9cdb('0x56')]=qs[_0x9cdb('0x3a')](_0xe75073['query']['sort']);_0x4e6169['where']=qs[_0x9cdb('0x34')](_[_0x9cdb('0x3c')](_0xe75073[_0x9cdb('0x32')],_0x19a622[_0x9cdb('0x34')]));_0x4e6169['where']['ProjectId']=_0x239376['id'];if(_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x3d')]){_0x4e6169[_0x9cdb('0x3b')]=_[_0x9cdb('0x3e')](_0x4e6169[_0x9cdb('0x3b')],{'$or':_[_0x9cdb('0x31')](_0x4e6169[_0x9cdb('0x36')],function(_0x5dd98e){var _0xd78c72={};_0xd78c72[_0x5dd98e]={'$like':'%'+_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x3d')]+'%'};return _0xd78c72;})});}_0x4e6169=_['merge']({},_0x4e6169,_0xe75073['options']);return db['JscriptyAnswerReport'][_0x9cdb('0x1b')]({'where':_0x4e6169['where']})['then'](function(_0x377cdc){_0x4b583['count']=_0x377cdc;if(_0xe75073[_0x9cdb('0x32')][_0x9cdb('0x41')]){_0x4e6169[_0x9cdb('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x9cdb('0x5b')](_0x4e6169);})['then'](function(_0x18c359){_0x4b583[_0x9cdb('0x43')]=_0x18c359;return _0x4b583;});}})[_0x9cdb('0x22')](respondWithFilteredResult(_0x397e8b,_0x4e6169))[_0x9cdb('0x44')](handleError(_0x397e8b,null));};function char(_0x191134){return _0x9cdb('0x5c')===typeof _0x191134?String[_0x9cdb('0x5d')][_0x9cdb('0x1e')](null,arguments):_0x191134;}function needsEncapsulation(_0x21ed5c){return!!_0x21ed5c&&(_0x21ed5c['toString']()['indexOf'](char(0xd))>=0x0||_0x21ed5c[_0x9cdb('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x21ed5c[_0x9cdb('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x21ed5c[_0x9cdb('0x5e')]()[_0x9cdb('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x66c738){var _0x214907=char(0x22),_0x164828='\x5c'+char(0x22),_0x193d9b=_0x66c738[_0x9cdb('0x5e')]()[_0x9cdb('0x60')](new RegExp(_0x214907,'g'),_0x164828);return _0x214907+_0x193d9b+_0x214907;}exports[_0x9cdb('0x61')]=function(_0x52f227,_0x363c3c,_0x54cc39){var _0x84630c,_0x2f5118;var _0x2c03f0={'where':{'ProjectId':_0x52f227[_0x9cdb('0x46')]['id']}};if(_0x52f227['query'][_0x9cdb('0x62')]){_0x2c03f0[_0x9cdb('0x3b')][_0x9cdb('0x63')]=JSON['parse'](_0x52f227[_0x9cdb('0x32')][_0x9cdb('0x62')]);}return db[_0x9cdb('0x58')][_0x9cdb('0x5b')](_0x2c03f0)['then'](handleEntityNotFound(_0x363c3c,null))[_0x9cdb('0x22')](function(_0x1bc9c3){if(_0x1bc9c3){_0x84630c=_0x1bc9c3;return db[_0x9cdb('0x64')][_0x9cdb('0x5b')]({'where':{'SessionId':{'$in':_['map'](_0x84630c,'id')},'ProjectId':_0x52f227['params']['id']},'order':_0x9cdb('0x65')});}})[_0x9cdb('0x22')](handleEntityNotFound(_0x363c3c,null))['then'](function(_0x2681da){if(_0x2681da){_0x2f5118=_0x2681da;var _0x5ccf7b={};for(var _0x42527a=0x0,_0x48d64c=_0x2f5118[_0x9cdb('0x38')];_0x42527a<_0x48d64c;_0x42527a++){if(!_0x5ccf7b[_0x9cdb('0x39')](_0x2f5118[_0x42527a][_0x9cdb('0x66')])){_0x5ccf7b[_0x2f5118[_0x42527a]['questionId']]=needsEncapsulation(_0x2f5118[_0x42527a]['question'])?encapsulate(_0x2f5118[_0x42527a][_0x9cdb('0x67')]):_0x2f5118[_0x42527a][_0x9cdb('0x67')];}}var _0x58e29d=[],_0x25c3b2={};for(var _0x316bdd=0x0,_0x4150f6=_0x84630c[_0x9cdb('0x38')];_0x316bdd<_0x4150f6;_0x316bdd++){_0x25c3b2={'ProjectId':_0x52f227[_0x9cdb('0x46')]['id'],'SessionId':_0x84630c[_0x316bdd]['id'],'StartTime':moment(_0x84630c[_0x316bdd][_0x9cdb('0x63')])[_0x9cdb('0x68')](_0x9cdb('0x69'))};for(var _0x4e694e=0x0,_0x10a0f9=_0x2f5118[_0x9cdb('0x38')];_0x4e694e<_0x10a0f9;_0x4e694e++){if(_0x2f5118[_0x4e694e][_0x9cdb('0x6a')]==_0x84630c[_0x316bdd]['id']&&_0x5ccf7b[_0x9cdb('0x39')](_0x2f5118[_0x4e694e][_0x9cdb('0x66')])){_0x25c3b2[_0x5ccf7b[_0x2f5118[_0x4e694e][_0x9cdb('0x66')]]]=_0x2f5118[_0x4e694e][_0x9cdb('0x6b')];}}for(var _0x2328f1 in _0x5ccf7b){if(!_0x25c3b2[_0x9cdb('0x39')](_0x5ccf7b[_0x2328f1])){_0x25c3b2[_0x5ccf7b[_0x2328f1]]=null;}}_0x58e29d[_0x9cdb('0x6c')](_0x25c3b2);}return _0x58e29d;}})[_0x9cdb('0x22')](function(_0x107717){if(!_['isEmpty'](_0x107717)){var _0x3ce994=toCsv(_0x107717);var _0x46597f=Date[_0x9cdb('0x6d')]();fs[_0x9cdb('0x6e')](util['format'](_0x9cdb('0x6f'),_0x52f227[_0x9cdb('0x46')]['id'],_0x46597f),_0x3ce994);_0x363c3c[_0x9cdb('0x70')](_0x9cdb('0x71'),_0x9cdb('0x72')+util[_0x9cdb('0x68')](_0x9cdb('0x73'),_0x52f227[_0x9cdb('0x46')]['id'],_0x46597f));_0x363c3c[_0x9cdb('0x70')](_0x9cdb('0x74'),_0x9cdb('0x75'));return _0x363c3c['download'](util[_0x9cdb('0x68')](_0x9cdb('0x6f'),_0x52f227[_0x9cdb('0x46')]['id'],_0x46597f));}else{return _0x363c3c['sendStatus'](0xcc);}})[_0x9cdb('0x44')](handleError(_0x363c3c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2ccd08b..ae0d892 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 _0x5447=['jscripty_projects','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x5e230d,_0x57d428){var _0x55429a=function(_0x4c9f1e){while(--_0x4c9f1e){_0x5e230d['push'](_0x5e230d['shift']());}};_0x55429a(++_0x57d428);}(_0x5447,0xf1));var _0x7544=function(_0x146648,_0x5301e1){_0x146648=_0x146648-0x0;var _0x342eea=_0x5447[_0x146648];return _0x342eea;};'use strict';var _=require(_0x7544('0x0'));var util=require('util');var logger=require(_0x7544('0x1'))(_0x7544('0x2'));var moment=require('moment');var BPromise=require(_0x7544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module[_0x7544('0x8')]=function(_0x7e80,_0x3feef7){return _0x7e80[_0x7544('0x9')](_0x7544('0xa'),attributes,{'tableName':_0x7544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d0=['moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','api'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x35d0,0xf9));var _0x035d=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x35d0[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x035d('0x0'));var util=require(_0x035d('0x1'));var logger=require('../../config/logger')(_0x035d('0x2'));var moment=require(_0x035d('0x3'));var BPromise=require(_0x035d('0x4'));var rp=require(_0x035d('0x5'));var fs=require('fs');var path=require(_0x035d('0x6'));var rimraf=require(_0x035d('0x7'));var config=require('../../config/environment');var attributes=require(_0x035d('0x8'));module[_0x035d('0x9')]=function(_0x3e6d36,_0x3f5f0d){return _0x3e6d36['define'](_0x035d('0xa'),attributes,{'tableName':_0x035d('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 259fb78..a999510 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2a0601,_0x23d9ef){var _0x53faec=function(_0x1c9e26){while(--_0x1c9e26){_0x2a0601['push'](_0x2a0601['shift']());}};_0x53faec(++_0x23d9ef);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ebda3,_0x564a8d){var _0x5b1ff0=function(_0x1acfa3){while(--_0x1acfa3){_0x1ebda3['push'](_0x1ebda3['shift']());}};_0x5b1ff0(++_0x564a8d);}(_0x70e0,0x17b));var _0x070e=function(_0x366ba7,_0xd5d34c){_0x366ba7=_0x366ba7-0x0;var _0x409715=_0x70e0[_0x366ba7];return _0x409715;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e595abd..de45026 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 _0xcf79=['/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x28be0e,_0x448730){var _0x594e57=function(_0x56f890){while(--_0x56f890){_0x28be0e['push'](_0x28be0e['shift']());}};_0x594e57(++_0x448730);}(_0xcf79,0x1cc));var _0x9cf7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcf79[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9cf7('0x0'));var timeout=require('connect-timeout');var express=require(_0x9cf7('0x1'));var router=express[_0x9cf7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9cf7('0x3'));var interaction=require(_0x9cf7('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x9cf7('0x5')](),controller[_0x9cf7('0x6')]);router[_0x9cf7('0x7')](_0x9cf7('0x8'),auth[_0x9cf7('0x5')](),controller[_0x9cf7('0x9')]);router[_0x9cf7('0x7')](_0x9cf7('0xa'),auth['isAuthenticated'](),controller[_0x9cf7('0xb')]);router[_0x9cf7('0xc')]('/',auth[_0x9cf7('0x5')](),controller[_0x9cf7('0xd')]);router[_0x9cf7('0xe')](_0x9cf7('0xa'),auth[_0x9cf7('0x5')](),controller[_0x9cf7('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cf7('0x10')]);module[_0x9cf7('0x11')]=router; \ No newline at end of file +var _0xe05d=['update','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x3d4ba2,_0x40d12d){var _0x889610=function(_0x2d3066){while(--_0x2d3066){_0x3d4ba2['push'](_0x3d4ba2['shift']());}};_0x889610(++_0x40d12d);}(_0xe05d,0xee));var _0xde05=function(_0x513ee1,_0x1309de){_0x513ee1=_0x513ee1-0x0;var _0x2a07b2=_0xe05d[_0x513ee1];return _0x2a07b2;};'use strict';var multer=require('multer');var util=require(_0xde05('0x0'));var path=require(_0xde05('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde05('0x2')]();var fs_extra=require(_0xde05('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xde05('0x4'));var config=require(_0xde05('0x5'));var controller=require(_0xde05('0x6'));router[_0xde05('0x7')]('/',auth[_0xde05('0x8')](),controller[_0xde05('0x9')]);router[_0xde05('0x7')]('/describe',auth[_0xde05('0x8')](),controller[_0xde05('0xa')]);router[_0xde05('0x7')](_0xde05('0xb'),auth['isAuthenticated'](),controller[_0xde05('0xc')]);router['post']('/',auth[_0xde05('0x8')](),controller[_0xde05('0xd')]);router['put'](_0xde05('0xb'),auth['isAuthenticated'](),controller[_0xde05('0xe')]);router[_0xde05('0xf')](_0xde05('0xb'),auth[_0xde05('0x8')](),controller[_0xde05('0x10')]);module[_0xde05('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index dfcda53..68ca2ce 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x34b806,_0x521de9){_0x34b806=_0x34b806-0x0;var _0x511e8e=_0x7a54[_0x34b806];return _0x511e8e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x1a5236,_0x5bebe6){_0x1a5236=_0x1a5236-0x0;var _0x4fa2d0=_0x7a54[_0x1a5236];return _0x4fa2d0;};'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 69fd6da..a0d01cf 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 _0x8c6f=['send','index','map','JscriptyQuestionReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','save','then','destroy','error','name'];(function(_0x3d48ae,_0x4f8b74){var _0x581049=function(_0x8ee472){while(--_0x8ee472){_0x3d48ae['push'](_0x3d48ae['shift']());}};_0x581049(++_0x4f8b74);}(_0x8c6f,0x1a6));var _0xf8c6=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x8c6f[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0xf8c6('0x0'));var rimraf=require(_0xf8c6('0x1'));var zipdir=require(_0xf8c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8c6('0x3'));var moment=require(_0xf8c6('0x4'));var BPromise=require(_0xf8c6('0x5'));var Mustache=require(_0xf8c6('0x6'));var util=require('util');var path=require(_0xf8c6('0x7'));var sox=require(_0xf8c6('0x8'));var csv=require(_0xf8c6('0x9'));var ejs=require(_0xf8c6('0xa'));var fs=require('fs');var fs_extra=require(_0xf8c6('0xb'));var _=require(_0xf8c6('0xc'));var squel=require(_0xf8c6('0xd'));var crypto=require(_0xf8c6('0xe'));var jsforce=require(_0xf8c6('0xf'));var deskjs=require(_0xf8c6('0x10'));var toCsv=require(_0xf8c6('0x9'));var querystring=require(_0xf8c6('0x11'));var Papa=require(_0xf8c6('0x12'));var Redis=require(_0xf8c6('0x13'));var authService=require(_0xf8c6('0x14'));var qs=require(_0xf8c6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8c6('0x16'));var logger=require(_0xf8c6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf8c6('0x18'));var licenseUtil=require(_0xf8c6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1696b4,_0x328e6b){_0x328e6b=_0x328e6b||0xcc;return function(_0x13f0db){if(_0x13f0db){return _0x1696b4[_0xf8c6('0x1a')](_0x328e6b);}return _0x1696b4[_0xf8c6('0x1b')](_0x328e6b)[_0xf8c6('0x1c')]();};}function respondWithResult(_0xab3c2f,_0x456ce7){_0x456ce7=_0x456ce7||0xc8;return function(_0x2af1cd){if(_0x2af1cd){return _0xab3c2f[_0xf8c6('0x1b')](_0x456ce7)['json'](_0x2af1cd);}};}function respondWithFilteredResult(_0xb9d8ee,_0x3b6858){return function(_0x15286e){if(_0x15286e){var _0x42376f=typeof _0x3b6858[_0xf8c6('0x1d')]===_0xf8c6('0x1e')&&typeof _0x3b6858['limit']==='undefined';var _0x5835ca=_0x15286e['count'];var _0xdafb3a=_0x42376f?0x0:_0x3b6858['offset'];var _0x547740=_0x42376f?_0x15286e['count']:_0x3b6858['offset']+_0x3b6858[_0xf8c6('0x1f')];var _0x146c9d;if(_0x547740>=_0x5835ca){_0x547740=_0x5835ca;_0x146c9d=0xc8;}else{_0x146c9d=0xce;}_0xb9d8ee[_0xf8c6('0x1b')](_0x146c9d);return _0xb9d8ee[_0xf8c6('0x20')](_0xf8c6('0x21'),_0xdafb3a+'-'+_0x547740+'/'+_0x5835ca)[_0xf8c6('0x22')](_0x15286e);}return null;};}function patchUpdates(_0x3b40c4){return function(_0x505c24){try{jsonpatch['apply'](_0x505c24,_0x3b40c4,!![]);}catch(_0x171405){return BPromise['reject'](_0x171405);}return _0x505c24[_0xf8c6('0x23')]();};}function saveUpdates(_0x3dc00b,_0x4e758c){return function(_0x87db75){if(_0x87db75){return _0x87db75['update'](_0x3dc00b)[_0xf8c6('0x24')](function(_0x2c9ef9){return _0x2c9ef9;});}return null;};}function removeEntity(_0x3bbc08,_0x42ca0b){return function(_0x40e2e8){if(_0x40e2e8){return _0x40e2e8[_0xf8c6('0x25')]()[_0xf8c6('0x24')](function(){_0x3bbc08['status'](0xcc)[_0xf8c6('0x1c')]();});}};}function handleEntityNotFound(_0x1b6852,_0x36abff){return function(_0x521a5f){if(!_0x521a5f){_0x1b6852['sendStatus'](0x194);}return _0x521a5f;};}function handleError(_0x4edc9d,_0x2feb7b){_0x2feb7b=_0x2feb7b||0x1f4;return function(_0x1ebad6){logger[_0xf8c6('0x26')](_0x1ebad6['stack']);if(_0x1ebad6['name']){delete _0x1ebad6[_0xf8c6('0x27')];}_0x4edc9d['status'](_0x2feb7b)[_0xf8c6('0x28')](_0x1ebad6);};}exports[_0xf8c6('0x29')]=function(_0x582fbc,_0x3f993b){var _0x3a07f6={},_0x4d0ce0={},_0x54d75a={'count':0x0,'rows':[]};var _0x41fe7c=_[_0xf8c6('0x2a')](db[_0xf8c6('0x2b')][_0xf8c6('0x2c')],function(_0x3dbc30){return{'name':_0x3dbc30['fieldName'],'type':_0x3dbc30[_0xf8c6('0x2d')]['key']};});_0x4d0ce0[_0xf8c6('0x2e')]=_[_0xf8c6('0x2a')](_0x41fe7c,_0xf8c6('0x27'));_0x4d0ce0[_0xf8c6('0x2f')]=_[_0xf8c6('0x30')](_0x582fbc[_0xf8c6('0x2f')]);_0x4d0ce0[_0xf8c6('0x31')]=_[_0xf8c6('0x32')](_0x4d0ce0[_0xf8c6('0x2e')],_0x4d0ce0['query']);_0x3a07f6['attributes']=_[_0xf8c6('0x32')](_0x4d0ce0['model'],qs[_0xf8c6('0x33')](_0x582fbc[_0xf8c6('0x2f')]['fields']));_0x3a07f6[_0xf8c6('0x34')]=_0x3a07f6[_0xf8c6('0x34')][_0xf8c6('0x35')]?_0x3a07f6[_0xf8c6('0x34')]:_0x4d0ce0[_0xf8c6('0x2e')];if(!_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x36')](_0xf8c6('0x37'))){_0x3a07f6[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x582fbc[_0xf8c6('0x2f')]['limit']);_0x3a07f6['offset']=qs[_0xf8c6('0x1d')](_0x582fbc[_0xf8c6('0x2f')]['offset']);}_0x3a07f6[_0xf8c6('0x38')]=qs[_0xf8c6('0x39')](_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x39')]);_0x3a07f6[_0xf8c6('0x3a')]=qs[_0xf8c6('0x31')](_[_0xf8c6('0x3b')](_0x582fbc[_0xf8c6('0x2f')],_0x4d0ce0[_0xf8c6('0x31')]),_0x41fe7c);if(_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x3c')]){_0x3a07f6['where']=_[_0xf8c6('0x3d')](_0x3a07f6[_0xf8c6('0x3a')],{'$or':_[_0xf8c6('0x2a')](_0x41fe7c,function(_0x157a1c){if(_0x157a1c[_0xf8c6('0x2d')]!==_0xf8c6('0x3e')){var _0x562177={};_0x562177[_0x157a1c['name']]={'$like':'%'+_0x582fbc[_0xf8c6('0x2f')]['filter']+'%'};return _0x562177;}})});}_0x3a07f6=_[_0xf8c6('0x3d')]({},_0x3a07f6,_0x582fbc[_0xf8c6('0x3f')]);var _0x4b58b4={'where':_0x3a07f6[_0xf8c6('0x3a')]};return db[_0xf8c6('0x2b')][_0xf8c6('0x40')](_0x4b58b4)[_0xf8c6('0x24')](function(_0x313a0a){_0x54d75a[_0xf8c6('0x40')]=_0x313a0a;if(_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x41')]){_0x3a07f6[_0xf8c6('0x42')]=[{'all':!![]}];}return db[_0xf8c6('0x2b')][_0xf8c6('0x43')](_0x3a07f6);})[_0xf8c6('0x24')](function(_0x409a9c){_0x54d75a[_0xf8c6('0x44')]=_0x409a9c;return _0x54d75a;})['then'](respondWithFilteredResult(_0x3f993b,_0x3a07f6))[_0xf8c6('0x45')](handleError(_0x3f993b,null));};exports[_0xf8c6('0x46')]=function(_0x4b6489,_0x1b2464){var _0x2f4502={'raw':!![],'where':{'id':_0x4b6489[_0xf8c6('0x47')]['id']}},_0x7500bd={};_0x7500bd[_0xf8c6('0x2e')]=_['keys'](db[_0xf8c6('0x2b')][_0xf8c6('0x2c')]);_0x7500bd[_0xf8c6('0x2f')]=_['keys'](_0x4b6489[_0xf8c6('0x2f')]);_0x7500bd['filters']=_[_0xf8c6('0x32')](_0x7500bd[_0xf8c6('0x2e')],_0x7500bd[_0xf8c6('0x2f')]);_0x2f4502['attributes']=_[_0xf8c6('0x32')](_0x7500bd[_0xf8c6('0x2e')],qs['fields'](_0x4b6489[_0xf8c6('0x2f')][_0xf8c6('0x33')]));_0x2f4502['attributes']=_0x2f4502[_0xf8c6('0x34')][_0xf8c6('0x35')]?_0x2f4502[_0xf8c6('0x34')]:_0x7500bd[_0xf8c6('0x2e')];if(_0x4b6489[_0xf8c6('0x2f')][_0xf8c6('0x41')]){_0x2f4502['include']=[{'all':!![]}];}_0x2f4502=_[_0xf8c6('0x3d')]({},_0x2f4502,_0x4b6489[_0xf8c6('0x3f')]);return db[_0xf8c6('0x2b')][_0xf8c6('0x48')](_0x2f4502)['then'](handleEntityNotFound(_0x1b2464,null))[_0xf8c6('0x24')](respondWithResult(_0x1b2464,null))[_0xf8c6('0x45')](handleError(_0x1b2464,null));};exports['create']=function(_0x558a90,_0x15b36c){return db['JscriptyQuestionReport'][_0xf8c6('0x49')](_0x558a90['body'],{})[_0xf8c6('0x24')](respondWithResult(_0x15b36c,0xc9))[_0xf8c6('0x45')](handleError(_0x15b36c,null));};exports[_0xf8c6('0x4a')]=function(_0x2beeb6,_0x331cb1){if(_0x2beeb6['body']['id']){delete _0x2beeb6[_0xf8c6('0x4b')]['id'];}return db[_0xf8c6('0x2b')][_0xf8c6('0x48')]({'where':{'id':_0x2beeb6[_0xf8c6('0x47')]['id']}})[_0xf8c6('0x24')](handleEntityNotFound(_0x331cb1,null))[_0xf8c6('0x24')](saveUpdates(_0x2beeb6['body'],null))[_0xf8c6('0x24')](respondWithResult(_0x331cb1,null))[_0xf8c6('0x45')](handleError(_0x331cb1,null));};exports[_0xf8c6('0x25')]=function(_0x34bf1b,_0x4dcb66){return db[_0xf8c6('0x2b')]['find']({'where':{'id':_0x34bf1b['params']['id']}})[_0xf8c6('0x24')](handleEntityNotFound(_0x4dcb66,null))['then'](removeEntity(_0x4dcb66,null))[_0xf8c6('0x45')](handleError(_0x4dcb66,null));};exports[_0xf8c6('0x4c')]=function(_0x3d7c90,_0x23f411){return db['JscriptyQuestionReport']['describe']()[_0xf8c6('0x24')](respondWithResult(_0x23f411,null))['catch'](handleError(_0x23f411,null));}; \ No newline at end of file +var _0x17e5=['catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x17e5,0x136));var _0x517e=function(_0x451c18,_0x4cdf0b){_0x451c18=_0x451c18-0x0;var _0x3bf63c=_0x17e5[_0x451c18];return _0x3bf63c;};'use strict';var emlformat=require(_0x517e('0x0'));var rimraf=require(_0x517e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x517e('0x2'));var rp=require(_0x517e('0x3'));var moment=require(_0x517e('0x4'));var BPromise=require(_0x517e('0x5'));var Mustache=require(_0x517e('0x6'));var util=require(_0x517e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x517e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x517e('0x9'));var _=require(_0x517e('0xa'));var squel=require(_0x517e('0xb'));var crypto=require(_0x517e('0xc'));var jsforce=require(_0x517e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x517e('0xe'));var Papa=require(_0x517e('0xf'));var Redis=require(_0x517e('0x10'));var authService=require(_0x517e('0x11'));var qs=require(_0x517e('0x12'));var as=require(_0x517e('0x13'));var hardwareService=require(_0x517e('0x14'));var logger=require(_0x517e('0x15'))('api');var utils=require(_0x517e('0x16'));var config=require(_0x517e('0x17'));var licenseUtil=require(_0x517e('0x18'));var db=require(_0x517e('0x19'))['db'];function respondWithStatusCode(_0x186c7b,_0x5791b9){_0x5791b9=_0x5791b9||0xcc;return function(_0x28f339){if(_0x28f339){return _0x186c7b[_0x517e('0x1a')](_0x5791b9);}return _0x186c7b[_0x517e('0x1b')](_0x5791b9)[_0x517e('0x1c')]();};}function respondWithResult(_0x7e8425,_0x7ef6cc){_0x7ef6cc=_0x7ef6cc||0xc8;return function(_0x5e51ea){if(_0x5e51ea){return _0x7e8425['status'](_0x7ef6cc)[_0x517e('0x1d')](_0x5e51ea);}};}function respondWithFilteredResult(_0x43fbde,_0x258a92){return function(_0x2a9b80){if(_0x2a9b80){var _0x34b47f=typeof _0x258a92[_0x517e('0x1e')]===_0x517e('0x1f')&&typeof _0x258a92[_0x517e('0x20')]===_0x517e('0x1f');var _0x1b7d64=_0x2a9b80[_0x517e('0x21')];var _0x26c737=_0x34b47f?0x0:_0x258a92[_0x517e('0x1e')];var _0x4581ed=_0x34b47f?_0x2a9b80['count']:_0x258a92[_0x517e('0x1e')]+_0x258a92[_0x517e('0x20')];var _0xfb928e;if(_0x4581ed>=_0x1b7d64){_0x4581ed=_0x1b7d64;_0xfb928e=0xc8;}else{_0xfb928e=0xce;}_0x43fbde[_0x517e('0x1b')](_0xfb928e);return _0x43fbde[_0x517e('0x22')](_0x517e('0x23'),_0x26c737+'-'+_0x4581ed+'/'+_0x1b7d64)['json'](_0x2a9b80);}return null;};}function patchUpdates(_0x9d2c57){return function(_0x341b0f){try{jsonpatch[_0x517e('0x24')](_0x341b0f,_0x9d2c57,!![]);}catch(_0x32fa30){return BPromise['reject'](_0x32fa30);}return _0x341b0f[_0x517e('0x25')]();};}function saveUpdates(_0x1fbbef,_0x38f920){return function(_0x57ecde){if(_0x57ecde){return _0x57ecde[_0x517e('0x26')](_0x1fbbef)[_0x517e('0x27')](function(_0x2633d4){return _0x2633d4;});}return null;};}function removeEntity(_0xae37d7,_0x3619b2){return function(_0x5be689){if(_0x5be689){return _0x5be689[_0x517e('0x28')]()[_0x517e('0x27')](function(){_0xae37d7[_0x517e('0x1b')](0xcc)[_0x517e('0x1c')]();});}};}function handleEntityNotFound(_0x257429,_0x3b0192){return function(_0x19b174){if(!_0x19b174){_0x257429['sendStatus'](0x194);}return _0x19b174;};}function handleError(_0x19be43,_0x31af31){_0x31af31=_0x31af31||0x1f4;return function(_0x2b7c23){logger['error'](_0x2b7c23[_0x517e('0x29')]);if(_0x2b7c23[_0x517e('0x2a')]){delete _0x2b7c23[_0x517e('0x2a')];}_0x19be43[_0x517e('0x1b')](_0x31af31)[_0x517e('0x2b')](_0x2b7c23);};}exports[_0x517e('0x2c')]=function(_0x26a616,_0x2938bb){var _0xe2968c={},_0x50c980={},_0x1f1297={'count':0x0,'rows':[]};var _0xcd4d34=_[_0x517e('0x2d')](db[_0x517e('0x2e')][_0x517e('0x2f')],function(_0x504cb5){return{'name':_0x504cb5[_0x517e('0x30')],'type':_0x504cb5[_0x517e('0x31')]['key']};});_0x50c980[_0x517e('0x32')]=_[_0x517e('0x2d')](_0xcd4d34,_0x517e('0x2a'));_0x50c980[_0x517e('0x33')]=_[_0x517e('0x34')](_0x26a616[_0x517e('0x33')]);_0x50c980['filters']=_[_0x517e('0x35')](_0x50c980[_0x517e('0x32')],_0x50c980[_0x517e('0x33')]);_0xe2968c[_0x517e('0x36')]=_[_0x517e('0x35')](_0x50c980['model'],qs[_0x517e('0x37')](_0x26a616[_0x517e('0x33')]['fields']));_0xe2968c[_0x517e('0x36')]=_0xe2968c[_0x517e('0x36')][_0x517e('0x38')]?_0xe2968c[_0x517e('0x36')]:_0x50c980[_0x517e('0x32')];if(!_0x26a616['query'][_0x517e('0x39')](_0x517e('0x3a'))){_0xe2968c[_0x517e('0x20')]=qs[_0x517e('0x20')](_0x26a616[_0x517e('0x33')][_0x517e('0x20')]);_0xe2968c[_0x517e('0x1e')]=qs[_0x517e('0x1e')](_0x26a616[_0x517e('0x33')][_0x517e('0x1e')]);}_0xe2968c['order']=qs[_0x517e('0x3b')](_0x26a616[_0x517e('0x33')][_0x517e('0x3b')]);_0xe2968c[_0x517e('0x3c')]=qs[_0x517e('0x3d')](_[_0x517e('0x3e')](_0x26a616[_0x517e('0x33')],_0x50c980[_0x517e('0x3d')]),_0xcd4d34);if(_0x26a616['query']['filter']){_0xe2968c[_0x517e('0x3c')]=_[_0x517e('0x3f')](_0xe2968c[_0x517e('0x3c')],{'$or':_['map'](_0xcd4d34,function(_0x1b6d55){if(_0x1b6d55[_0x517e('0x31')]!=='VIRTUAL'){var _0x2cc2ea={};_0x2cc2ea[_0x1b6d55[_0x517e('0x2a')]]={'$like':'%'+_0x26a616[_0x517e('0x33')][_0x517e('0x40')]+'%'};return _0x2cc2ea;}})});}_0xe2968c=_[_0x517e('0x3f')]({},_0xe2968c,_0x26a616[_0x517e('0x41')]);var _0x3601d9={'where':_0xe2968c[_0x517e('0x3c')]};return db[_0x517e('0x2e')][_0x517e('0x21')](_0x3601d9)[_0x517e('0x27')](function(_0x6592bd){_0x1f1297[_0x517e('0x21')]=_0x6592bd;if(_0x26a616['query'][_0x517e('0x42')]){_0xe2968c[_0x517e('0x43')]=[{'all':!![]}];}return db[_0x517e('0x2e')][_0x517e('0x44')](_0xe2968c);})[_0x517e('0x27')](function(_0x2aa1a4){_0x1f1297[_0x517e('0x45')]=_0x2aa1a4;return _0x1f1297;})[_0x517e('0x27')](respondWithFilteredResult(_0x2938bb,_0xe2968c))[_0x517e('0x46')](handleError(_0x2938bb,null));};exports['show']=function(_0x89dd0b,_0x33d21b){var _0x3a0a86={'raw':!![],'where':{'id':_0x89dd0b['params']['id']}},_0x2a6e8f={};_0x2a6e8f[_0x517e('0x32')]=_['keys'](db[_0x517e('0x2e')][_0x517e('0x2f')]);_0x2a6e8f[_0x517e('0x33')]=_[_0x517e('0x34')](_0x89dd0b[_0x517e('0x33')]);_0x2a6e8f[_0x517e('0x3d')]=_[_0x517e('0x35')](_0x2a6e8f[_0x517e('0x32')],_0x2a6e8f[_0x517e('0x33')]);_0x3a0a86[_0x517e('0x36')]=_[_0x517e('0x35')](_0x2a6e8f[_0x517e('0x32')],qs['fields'](_0x89dd0b['query'][_0x517e('0x37')]));_0x3a0a86[_0x517e('0x36')]=_0x3a0a86[_0x517e('0x36')][_0x517e('0x38')]?_0x3a0a86[_0x517e('0x36')]:_0x2a6e8f[_0x517e('0x32')];if(_0x89dd0b[_0x517e('0x33')][_0x517e('0x42')]){_0x3a0a86[_0x517e('0x43')]=[{'all':!![]}];}_0x3a0a86=_[_0x517e('0x3f')]({},_0x3a0a86,_0x89dd0b['options']);return db[_0x517e('0x2e')]['find'](_0x3a0a86)[_0x517e('0x27')](handleEntityNotFound(_0x33d21b,null))[_0x517e('0x27')](respondWithResult(_0x33d21b,null))[_0x517e('0x46')](handleError(_0x33d21b,null));};exports[_0x517e('0x47')]=function(_0x1067f3,_0x85ccfb){return db['JscriptyQuestionReport'][_0x517e('0x47')](_0x1067f3[_0x517e('0x48')],{})[_0x517e('0x27')](respondWithResult(_0x85ccfb,0xc9))['catch'](handleError(_0x85ccfb,null));};exports['update']=function(_0x5883c6,_0x420deb){if(_0x5883c6[_0x517e('0x48')]['id']){delete _0x5883c6['body']['id'];}return db['JscriptyQuestionReport'][_0x517e('0x49')]({'where':{'id':_0x5883c6[_0x517e('0x4a')]['id']}})[_0x517e('0x27')](handleEntityNotFound(_0x420deb,null))[_0x517e('0x27')](saveUpdates(_0x5883c6['body'],null))['then'](respondWithResult(_0x420deb,null))[_0x517e('0x46')](handleError(_0x420deb,null));};exports[_0x517e('0x28')]=function(_0x18537c,_0xe47eff){return db[_0x517e('0x2e')][_0x517e('0x49')]({'where':{'id':_0x18537c['params']['id']}})['then'](handleEntityNotFound(_0xe47eff,null))[_0x517e('0x27')](removeEntity(_0xe47eff,null))[_0x517e('0x46')](handleError(_0xe47eff,null));};exports[_0x517e('0x4b')]=function(_0x53adaf,_0x55c1a7){return db[_0x517e('0x2e')][_0x517e('0x4b')]()[_0x517e('0x27')](respondWithResult(_0x55c1a7,null))[_0x517e('0x46')](handleError(_0x55c1a7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 456607c..efadb9e 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 _0xc0a2=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xc0a2,0x1d8));var _0x2c0a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0a2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var logger=require(_0x2c0a('0x2'))('api');var moment=require(_0x2c0a('0x3'));var BPromise=require(_0x2c0a('0x4'));var rp=require(_0x2c0a('0x5'));var fs=require('fs');var path=require(_0x2c0a('0x6'));var rimraf=require(_0x2c0a('0x7'));var config=require(_0x2c0a('0x8'));var attributes=require(_0x2c0a('0x9'));module[_0x2c0a('0xa')]=function(_0x25b3ac,_0x27931d){return _0x25b3ac[_0x2c0a('0xb')](_0x2c0a('0xc'),attributes,{'tableName':_0x2c0a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x991a=['./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3cd533,_0x5dab44){var _0x635fe7=function(_0x5003a9){while(--_0x5003a9){_0x3cd533['push'](_0x3cd533['shift']());}};_0x635fe7(++_0x5dab44);}(_0x991a,0x1ef));var _0xa991=function(_0x5953d5,_0x235b6a){_0x5953d5=_0x5953d5-0x0;var _0x462085=_0x991a[_0x5953d5];return _0x462085;};'use strict';var _=require(_0xa991('0x0'));var util=require(_0xa991('0x1'));var logger=require(_0xa991('0x2'))('api');var moment=require(_0xa991('0x3'));var BPromise=require(_0xa991('0x4'));var rp=require(_0xa991('0x5'));var fs=require('fs');var path=require(_0xa991('0x6'));var rimraf=require(_0xa991('0x7'));var config=require(_0xa991('0x8'));var attributes=require(_0xa991('0x9'));module[_0xa991('0xa')]=function(_0x479d68,_0x14ba27){return _0x479d68['define'](_0xa991('0xb'),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 ed71b46..b4153f4 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 _0xe44b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe44b,0xa3));var _0xbe44=function(_0x57f73c,_0x6ec5c4){_0x57f73c=_0x57f73c-0x0;var _0x47f266=_0xe44b[_0x57f73c];return _0x47f266;};'use strict';var _=require(_0xbe44('0x0'));var util=require(_0xbe44('0x1'));var moment=require(_0xbe44('0x2'));var BPromise=require(_0xbe44('0x3'));var rs=require(_0xbe44('0x4'));var fs=require('fs');var Redis=require(_0xbe44('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe44('0x6'));var logger=require(_0xbe44('0x7'))(_0xbe44('0x8'));var config=require(_0xbe44('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff5d9,_0x55742b,_0x5af7a9){return new BPromise(function(_0x71d95d,_0x54ddf9){return client[_0xbe44('0xb')](_0x1ff5d9,_0x5af7a9)[_0xbe44('0xc')](function(_0x4b9edf){logger[_0xbe44('0xd')](_0xbe44('0xe'),_0x55742b,_0xbe44('0xf'));logger['debug'](_0xbe44('0x10'),_0x55742b,'request\x20sent',JSON[_0xbe44('0x11')](_0x4b9edf));if(_0x4b9edf[_0xbe44('0x12')]){if(_0x4b9edf[_0xbe44('0x12')][_0xbe44('0x13')]===0x1f4){logger['error'](_0xbe44('0xe'),_0x55742b,_0x4b9edf[_0xbe44('0x12')]['message']);return _0x54ddf9(_0x4b9edf[_0xbe44('0x12')]['message']);}logger[_0xbe44('0x12')](_0xbe44('0xe'),_0x55742b,_0x4b9edf['error']['message']);return _0x71d95d(_0x4b9edf['error'][_0xbe44('0x14')]);}else{logger[_0xbe44('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x55742b,'request\x20sent');_0x71d95d(_0x4b9edf['result'][_0xbe44('0x14')]);}})['catch'](function(_0x31f599){logger[_0xbe44('0x12')](_0xbe44('0xe'),_0x55742b,_0x31f599);_0x54ddf9(_0x31f599);});});} \ No newline at end of file +var _0xe4fd=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x477e0e,_0x31c29a){var _0xf6083c=function(_0x488bd1){while(--_0x488bd1){_0x477e0e['push'](_0x477e0e['shift']());}};_0xf6083c(++_0x31c29a);}(_0xe4fd,0x17b));var _0xde4f=function(_0x5194ff,_0xd32f17){_0x5194ff=_0x5194ff-0x0;var _0x2415b4=_0xe4fd[_0x5194ff];return _0x2415b4;};'use strict';var _=require(_0xde4f('0x0'));var util=require(_0xde4f('0x1'));var moment=require(_0xde4f('0x2'));var BPromise=require(_0xde4f('0x3'));var rs=require(_0xde4f('0x4'));var fs=require('fs');var Redis=require(_0xde4f('0x5'));var db=require(_0xde4f('0x6'))['db'];var utils=require(_0xde4f('0x7'));var logger=require(_0xde4f('0x8'))(_0xde4f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xde4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485dcc,_0x19ca0b,_0x47a68a){return new BPromise(function(_0x14aa92,_0x3850c5){return client[_0xde4f('0xb')](_0x485dcc,_0x47a68a)['then'](function(_0xc23162){logger[_0xde4f('0xc')](_0xde4f('0xd'),_0x19ca0b,_0xde4f('0xe'));logger[_0xde4f('0xf')](_0xde4f('0x10'),_0x19ca0b,_0xde4f('0xe'),JSON[_0xde4f('0x11')](_0xc23162));if(_0xc23162[_0xde4f('0x12')]){if(_0xc23162['error'][_0xde4f('0x13')]===0x1f4){logger[_0xde4f('0x12')](_0xde4f('0xd'),_0x19ca0b,_0xc23162[_0xde4f('0x12')][_0xde4f('0x14')]);return _0x3850c5(_0xc23162[_0xde4f('0x12')]['message']);}logger['error'](_0xde4f('0xd'),_0x19ca0b,_0xc23162[_0xde4f('0x12')][_0xde4f('0x14')]);return _0x14aa92(_0xc23162[_0xde4f('0x12')]['message']);}else{logger[_0xde4f('0xc')](_0xde4f('0xd'),_0x19ca0b,_0xde4f('0xe'));_0x14aa92(_0xc23162[_0xde4f('0x15')]['message']);}})[_0xde4f('0x16')](function(_0x31d5d5){logger[_0xde4f('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x19ca0b,_0x31d5d5);_0x3850c5(_0x31d5d5);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d71034b..4fc3f03 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 _0x5122=['/:id/questions','getQuestions','post','put','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x28c906,_0xb83ea4){var _0x1320b0=function(_0x4cf150){while(--_0x4cf150){_0x28c906['push'](_0x28c906['shift']());}};_0x1320b0(++_0xb83ea4);}(_0x5122,0xa7));var _0x2512=function(_0x112c23,_0x1d8eb2){_0x112c23=_0x112c23-0x0;var _0xd1ddeb=_0x5122[_0x112c23];return _0xd1ddeb;};'use strict';var multer=require(_0x2512('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2512('0x1'));var express=require('express');var router=express[_0x2512('0x2')]();var fs_extra=require(_0x2512('0x3'));var auth=require(_0x2512('0x4'));var interaction=require(_0x2512('0x5'));var config=require(_0x2512('0x6'));var controller=require(_0x2512('0x7'));router[_0x2512('0x8')]('/',auth[_0x2512('0x9')](),controller['index']);router[_0x2512('0x8')](_0x2512('0xa'),auth[_0x2512('0x9')](),controller['describe']);router['get'](_0x2512('0xb'),auth['isAuthenticated'](),controller[_0x2512('0xc')]);router[_0x2512('0x8')](_0x2512('0xd'),auth['isAuthenticated'](),controller[_0x2512('0xe')]);router[_0x2512('0xf')]('/',auth[_0x2512('0x9')](),controller['create']);router[_0x2512('0x10')](_0x2512('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2512('0x11')](_0x2512('0xb'),auth['isAuthenticated'](),controller[_0x2512('0x12')]);module[_0x2512('0x13')]=router; \ No newline at end of file +var _0xb6fd=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/questions','getQuestions','put','update','delete'];(function(_0x3b0394,_0x1a30f9){var _0x1f35e5=function(_0x2dd681){while(--_0x2dd681){_0x3b0394['push'](_0x3b0394['shift']());}};_0x1f35e5(++_0x1a30f9);}(_0xb6fd,0x12d));var _0xdb6f=function(_0xf4b2ff,_0x205716){_0xf4b2ff=_0xf4b2ff-0x0;var _0x22009d=_0xb6fd[_0xf4b2ff];return _0x22009d;};'use strict';var multer=require(_0xdb6f('0x0'));var util=require('util');var path=require(_0xdb6f('0x1'));var timeout=require(_0xdb6f('0x2'));var express=require(_0xdb6f('0x3'));var router=express[_0xdb6f('0x4')]();var fs_extra=require(_0xdb6f('0x5'));var auth=require(_0xdb6f('0x6'));var interaction=require(_0xdb6f('0x7'));var config=require(_0xdb6f('0x8'));var controller=require(_0xdb6f('0x9'));router[_0xdb6f('0xa')]('/',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xc')]);router[_0xdb6f('0xa')](_0xdb6f('0xd'),auth[_0xdb6f('0xb')](),controller[_0xdb6f('0xe')]);router[_0xdb6f('0xa')](_0xdb6f('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdb6f('0x10'),auth['isAuthenticated'](),controller[_0xdb6f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdb6f('0x12')]('/:id',auth[_0xdb6f('0xb')](),controller[_0xdb6f('0x13')]);router[_0xdb6f('0x14')](_0xdb6f('0xf'),auth[_0xdb6f('0xb')](),controller[_0xdb6f('0x15')]);module[_0xdb6f('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index be5d59e..c0b8859 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 _0x9a78=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2eee99,_0x102d54){var _0x2689b0=function(_0x560c81){while(--_0x560c81){_0x2eee99['push'](_0x2eee99['shift']());}};_0x2689b0(++_0x102d54);}(_0x9a78,0x84));var _0x89a7=function(_0x5a594d,_0x5cd018){_0x5a594d=_0x5a594d-0x0;var _0x45a07e=_0x9a78[_0x5a594d];return _0x45a07e;};'use strict';var moment=require(_0x89a7('0x0'));var Sequelize=require(_0x89a7('0x1'));module[_0x89a7('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1b07ae){this[_0x89a7('0x3')](_0x89a7('0x4'),_0x1b07ae);this[_0x89a7('0x3')](_0x89a7('0x5'),moment()[_0x89a7('0x6')](_0x89a7('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x89a7('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x89a7('0x8')]},'uniqueid':{'type':Sequelize[_0x89a7('0x8')]},'calleridname':{'type':Sequelize[_0x89a7('0x8')]},'calleridnum':{'type':Sequelize[_0x89a7('0x8')]},'completed':{'type':Sequelize[_0x89a7('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xc17d=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xc17d,0x96));var _0xdc17=function(_0x2802a9,_0x3f322d){_0x2802a9=_0x2802a9-0x0;var _0x3df44f=_0xc17d[_0x2802a9];return _0x3df44f;};'use strict';var moment=require(_0xdc17('0x0'));var Sequelize=require(_0xdc17('0x1'));module[_0xdc17('0x2')]={'starttime':{'type':Sequelize[_0xdc17('0x3')],'set':function(_0x51477f){this[_0xdc17('0x4')](_0xdc17('0x5'),_0x51477f);this[_0xdc17('0x4')](_0xdc17('0x6'),moment()['format'](_0xdc17('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdc17('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdc17('0x8')]},'calleridname':{'type':Sequelize[_0xdc17('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'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 f459d77..3d4a4c8 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 _0x4d57=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','getQuestions','findOne','hasOwnProperty','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport','fieldName','key'];(function(_0x3a852a,_0xf3f1d3){var _0x48c902=function(_0x22cdd1){while(--_0x22cdd1){_0x3a852a['push'](_0x3a852a['shift']());}};_0x48c902(++_0xf3f1d3);}(_0x4d57,0x14d));var _0x74d5=function(_0x13392c,_0x57d768){_0x13392c=_0x13392c-0x0;var _0x35f9c9=_0x4d57[_0x13392c];return _0x35f9c9;};'use strict';var emlformat=require(_0x74d5('0x0'));var rimraf=require(_0x74d5('0x1'));var zipdir=require(_0x74d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x74d5('0x3'));var BPromise=require(_0x74d5('0x4'));var Mustache=require(_0x74d5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x74d5('0x6'));var csv=require('to-csv');var ejs=require(_0x74d5('0x7'));var fs=require('fs');var fs_extra=require(_0x74d5('0x8'));var _=require(_0x74d5('0x9'));var squel=require(_0x74d5('0xa'));var crypto=require('crypto');var jsforce=require(_0x74d5('0xb'));var deskjs=require(_0x74d5('0xc'));var toCsv=require(_0x74d5('0xd'));var querystring=require(_0x74d5('0xe'));var Papa=require(_0x74d5('0xf'));var Redis=require(_0x74d5('0x10'));var authService=require(_0x74d5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x74d5('0x12'));var licenseUtil=require(_0x74d5('0x13'));var db=require(_0x74d5('0x14'))['db'];function respondWithStatusCode(_0x2bb106,_0x14e1d2){_0x14e1d2=_0x14e1d2||0xcc;return function(_0x477d38){if(_0x477d38){return _0x2bb106[_0x74d5('0x15')](_0x14e1d2);}return _0x2bb106[_0x74d5('0x16')](_0x14e1d2)[_0x74d5('0x17')]();};}function respondWithResult(_0x3b8f67,_0x6c522d){_0x6c522d=_0x6c522d||0xc8;return function(_0xddbea1){if(_0xddbea1){return _0x3b8f67[_0x74d5('0x16')](_0x6c522d)[_0x74d5('0x18')](_0xddbea1);}};}function respondWithFilteredResult(_0x4cf75d,_0x21c0af){return function(_0x491f1f){if(_0x491f1f){var _0x1aaf24=typeof _0x21c0af[_0x74d5('0x19')]===_0x74d5('0x1a')&&typeof _0x21c0af[_0x74d5('0x1b')]===_0x74d5('0x1a');var _0x42e1c6=_0x491f1f['count'];var _0xd5ce69=_0x1aaf24?0x0:_0x21c0af[_0x74d5('0x19')];var _0x3acc86=_0x1aaf24?_0x491f1f[_0x74d5('0x1c')]:_0x21c0af[_0x74d5('0x19')]+_0x21c0af['limit'];var _0x57b0fc;if(_0x3acc86>=_0x42e1c6){_0x3acc86=_0x42e1c6;_0x57b0fc=0xc8;}else{_0x57b0fc=0xce;}_0x4cf75d[_0x74d5('0x16')](_0x57b0fc);return _0x4cf75d['set']('Content-Range',_0xd5ce69+'-'+_0x3acc86+'/'+_0x42e1c6)[_0x74d5('0x18')](_0x491f1f);}return null;};}function patchUpdates(_0x4beaca){return function(_0x25603e){try{jsonpatch[_0x74d5('0x1d')](_0x25603e,_0x4beaca,!![]);}catch(_0x12a6c6){return BPromise[_0x74d5('0x1e')](_0x12a6c6);}return _0x25603e[_0x74d5('0x1f')]();};}function saveUpdates(_0x2d4e00,_0x331b67){return function(_0x5a21a5){if(_0x5a21a5){return _0x5a21a5[_0x74d5('0x20')](_0x2d4e00)[_0x74d5('0x21')](function(_0x2c7683){return _0x2c7683;});}return null;};}function removeEntity(_0xcdbf9d,_0xa8d82e){return function(_0x1a21d9){if(_0x1a21d9){return _0x1a21d9[_0x74d5('0x22')]()[_0x74d5('0x21')](function(){_0xcdbf9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xffaf1,_0x3657e3){return function(_0x44d99e){if(!_0x44d99e){_0xffaf1[_0x74d5('0x15')](0x194);}return _0x44d99e;};}function handleError(_0x29c051,_0x203f9e){_0x203f9e=_0x203f9e||0x1f4;return function(_0xf19c41){logger[_0x74d5('0x23')](_0xf19c41['stack']);if(_0xf19c41['name']){delete _0xf19c41[_0x74d5('0x24')];}_0x29c051[_0x74d5('0x16')](_0x203f9e)['send'](_0xf19c41);};}exports[_0x74d5('0x25')]=function(_0x582a63,_0x1e7216){var _0x38cff5={},_0x4b9074={},_0x162bdc={'count':0x0,'rows':[]};var _0x5d337c=_[_0x74d5('0x26')](db[_0x74d5('0x27')]['rawAttributes'],function(_0x1d2691){return{'name':_0x1d2691[_0x74d5('0x28')],'type':_0x1d2691['type'][_0x74d5('0x29')]};});_0x4b9074[_0x74d5('0x2a')]=_[_0x74d5('0x26')](_0x5d337c,_0x74d5('0x24'));_0x4b9074[_0x74d5('0x2b')]=_[_0x74d5('0x2c')](_0x582a63[_0x74d5('0x2b')]);_0x4b9074[_0x74d5('0x2d')]=_[_0x74d5('0x2e')](_0x4b9074[_0x74d5('0x2a')],_0x4b9074['query']);_0x38cff5[_0x74d5('0x2f')]=_[_0x74d5('0x2e')](_0x4b9074[_0x74d5('0x2a')],qs[_0x74d5('0x30')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x38cff5[_0x74d5('0x2f')]=_0x38cff5[_0x74d5('0x2f')][_0x74d5('0x31')]?_0x38cff5[_0x74d5('0x2f')]:_0x4b9074[_0x74d5('0x2a')];if(!_0x582a63[_0x74d5('0x2b')]['hasOwnProperty'](_0x74d5('0x32'))){_0x38cff5[_0x74d5('0x1b')]=qs[_0x74d5('0x1b')](_0x582a63['query'][_0x74d5('0x1b')]);_0x38cff5[_0x74d5('0x19')]=qs[_0x74d5('0x19')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x19')]);}_0x38cff5[_0x74d5('0x33')]=qs[_0x74d5('0x34')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x34')]);_0x38cff5['where']=qs[_0x74d5('0x2d')](_[_0x74d5('0x35')](_0x582a63['query'],_0x4b9074['filters']),_0x5d337c);if(_0x582a63[_0x74d5('0x2b')][_0x74d5('0x36')]){_0x38cff5[_0x74d5('0x37')]=_[_0x74d5('0x38')](_0x38cff5[_0x74d5('0x37')],{'$or':_['map'](_0x5d337c,function(_0x2e4e12){if(_0x2e4e12[_0x74d5('0x39')]!==_0x74d5('0x3a')){var _0x48c866={};_0x48c866[_0x2e4e12[_0x74d5('0x24')]]={'$like':'%'+_0x582a63[_0x74d5('0x2b')][_0x74d5('0x36')]+'%'};return _0x48c866;}})});}_0x38cff5=_['merge']({},_0x38cff5,_0x582a63[_0x74d5('0x3b')]);var _0x4ae2b0={'where':_0x38cff5[_0x74d5('0x37')]};return db[_0x74d5('0x27')][_0x74d5('0x1c')](_0x4ae2b0)[_0x74d5('0x21')](function(_0x4dfefb){_0x162bdc[_0x74d5('0x1c')]=_0x4dfefb;if(_0x582a63[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x38cff5[_0x74d5('0x3d')]=[{'all':!![]}];}return db[_0x74d5('0x27')][_0x74d5('0x3e')](_0x38cff5);})['then'](function(_0x2037e1){_0x162bdc['rows']=_0x2037e1;return _0x162bdc;})['then'](respondWithFilteredResult(_0x1e7216,_0x38cff5))[_0x74d5('0x3f')](handleError(_0x1e7216,null));};exports[_0x74d5('0x40')]=function(_0x1414ca,_0x3dee29){var _0x2a235f={'raw':!![],'where':{'id':_0x1414ca['params']['id']}},_0x21ea84={};_0x21ea84[_0x74d5('0x2a')]=_[_0x74d5('0x2c')](db['JscriptySessionReport'][_0x74d5('0x41')]);_0x21ea84['query']=_[_0x74d5('0x2c')](_0x1414ca[_0x74d5('0x2b')]);_0x21ea84[_0x74d5('0x2d')]=_['intersection'](_0x21ea84[_0x74d5('0x2a')],_0x21ea84[_0x74d5('0x2b')]);_0x2a235f[_0x74d5('0x2f')]=_[_0x74d5('0x2e')](_0x21ea84[_0x74d5('0x2a')],qs[_0x74d5('0x30')](_0x1414ca[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x2a235f['attributes']=_0x2a235f[_0x74d5('0x2f')][_0x74d5('0x31')]?_0x2a235f['attributes']:_0x21ea84[_0x74d5('0x2a')];if(_0x1414ca[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x2a235f['include']=[{'all':!![]}];}_0x2a235f=_['merge']({},_0x2a235f,_0x1414ca['options']);return db[_0x74d5('0x27')][_0x74d5('0x42')](_0x2a235f)[_0x74d5('0x21')](handleEntityNotFound(_0x3dee29,null))[_0x74d5('0x21')](respondWithResult(_0x3dee29,null))[_0x74d5('0x3f')](handleError(_0x3dee29,null));};exports[_0x74d5('0x43')]=function(_0x30f95a,_0x3395ba){return db[_0x74d5('0x27')][_0x74d5('0x43')](_0x30f95a['body'],{})[_0x74d5('0x21')](respondWithResult(_0x3395ba,0xc9))['catch'](handleError(_0x3395ba,null));};exports[_0x74d5('0x20')]=function(_0x3aff93,_0xf9e85a){if(_0x3aff93[_0x74d5('0x44')]['id']){delete _0x3aff93['body']['id'];}return db['JscriptySessionReport'][_0x74d5('0x42')]({'where':{'id':_0x3aff93[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0xf9e85a,null))[_0x74d5('0x21')](saveUpdates(_0x3aff93[_0x74d5('0x44')],null))['then'](respondWithResult(_0xf9e85a,null))[_0x74d5('0x3f')](handleError(_0xf9e85a,null));};exports[_0x74d5('0x22')]=function(_0x48e99a,_0x27004b){return db['JscriptySessionReport']['find']({'where':{'id':_0x48e99a[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0x27004b,null))[_0x74d5('0x21')](removeEntity(_0x27004b,null))[_0x74d5('0x3f')](handleError(_0x27004b,null));};exports['describe']=function(_0x430db8,_0x1bf9d2){return db[_0x74d5('0x27')]['describe']()[_0x74d5('0x21')](respondWithResult(_0x1bf9d2,null))[_0x74d5('0x3f')](handleError(_0x1bf9d2,null));};exports[_0x74d5('0x46')]=function(_0x5a3bf4,_0x304023,_0x46850b){var _0x1ef678={'raw':!![],'where':{}};var _0x591783={};var _0x2b6b4e={'count':0x0,'rows':[]};return db[_0x74d5('0x27')][_0x74d5('0x47')]({'where':{'id':_0x5a3bf4[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0x304023,null))['then'](function(_0x5b92b5){if(_0x5b92b5){_0x591783[_0x74d5('0x2a')]=_[_0x74d5('0x2c')](db['JscriptyQuestionReport'][_0x74d5('0x41')]);_0x591783[_0x74d5('0x2b')]=_[_0x74d5('0x2c')](_0x5a3bf4[_0x74d5('0x2b')]);_0x591783['filters']=_[_0x74d5('0x2e')](_0x591783[_0x74d5('0x2a')],_0x591783[_0x74d5('0x2b')]);_0x1ef678[_0x74d5('0x2f')]=_['intersection'](_0x591783[_0x74d5('0x2a')],qs['fields'](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x1ef678[_0x74d5('0x2f')]=_0x1ef678[_0x74d5('0x2f')]['length']?_0x1ef678[_0x74d5('0x2f')]:_0x591783[_0x74d5('0x2a')];if(!_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x48')]('nolimit')){_0x1ef678['limit']=qs['limit'](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x1b')]);_0x1ef678[_0x74d5('0x19')]=qs[_0x74d5('0x19')](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x19')]);}_0x1ef678[_0x74d5('0x33')]=qs[_0x74d5('0x34')](_0x5a3bf4['query'][_0x74d5('0x34')]);_0x1ef678['where']=qs[_0x74d5('0x2d')](_['pick'](_0x5a3bf4[_0x74d5('0x2b')],_0x591783[_0x74d5('0x2d')]));_0x1ef678['where']['SessionId']=_0x5b92b5['id'];if(_0x5a3bf4['query'][_0x74d5('0x36')]){_0x1ef678['where']=_[_0x74d5('0x38')](_0x1ef678[_0x74d5('0x37')],{'$or':_[_0x74d5('0x26')](_0x1ef678[_0x74d5('0x2f')],function(_0x918f45){var _0x720b12={};_0x720b12[_0x918f45]={'$like':'%'+_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x36')]+'%'};return _0x720b12;})});}_0x1ef678=_[_0x74d5('0x38')]({},_0x1ef678,_0x5a3bf4[_0x74d5('0x3b')]);return db[_0x74d5('0x49')]['count']({'where':_0x1ef678[_0x74d5('0x37')]})[_0x74d5('0x21')](function(_0xf423a5){_0x2b6b4e['count']=_0xf423a5;if(_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x1ef678[_0x74d5('0x3d')]=[{'all':!![]}];}return db[_0x74d5('0x49')][_0x74d5('0x3e')](_0x1ef678);})[_0x74d5('0x21')](function(_0x263683){_0x2b6b4e[_0x74d5('0x4a')]=_0x263683;return _0x2b6b4e;});}})['then'](respondWithFilteredResult(_0x304023,_0x1ef678))[_0x74d5('0x3f')](handleError(_0x304023,null));}; \ No newline at end of file +var _0xce4b=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','undefined','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','JscriptySessionReport','count','includeAll','include','rows','show','keys','intersection','length','find','catch','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','SessionId','filter','findAll','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x370597,_0x39eaf2){var _0x3e5ca2=function(_0x1e1d7b){while(--_0x1e1d7b){_0x370597['push'](_0x370597['shift']());}};_0x3e5ca2(++_0x39eaf2);}(_0xce4b,0xf8));var _0xbce4=function(_0x208c34,_0x3dea86){_0x208c34=_0x208c34-0x0;var _0x3943cd=_0xce4b[_0x208c34];return _0x3943cd;};'use strict';var emlformat=require(_0xbce4('0x0'));var rimraf=require(_0xbce4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbce4('0x2'));var rp=require(_0xbce4('0x3'));var moment=require(_0xbce4('0x4'));var BPromise=require(_0xbce4('0x5'));var Mustache=require(_0xbce4('0x6'));var util=require('util');var path=require(_0xbce4('0x7'));var sox=require(_0xbce4('0x8'));var csv=require(_0xbce4('0x9'));var ejs=require(_0xbce4('0xa'));var fs=require('fs');var fs_extra=require(_0xbce4('0xb'));var _=require('lodash');var squel=require(_0xbce4('0xc'));var crypto=require(_0xbce4('0xd'));var jsforce=require(_0xbce4('0xe'));var deskjs=require(_0xbce4('0xf'));var toCsv=require(_0xbce4('0x9'));var querystring=require(_0xbce4('0x10'));var Papa=require('papaparse');var Redis=require(_0xbce4('0x11'));var authService=require(_0xbce4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbce4('0x13'));var hardwareService=require(_0xbce4('0x14'));var logger=require(_0xbce4('0x15'))('api');var utils=require(_0xbce4('0x16'));var config=require(_0xbce4('0x17'));var licenseUtil=require(_0xbce4('0x18'));var db=require(_0xbce4('0x19'))['db'];function respondWithStatusCode(_0x530fba,_0x466758){_0x466758=_0x466758||0xcc;return function(_0x1ade53){if(_0x1ade53){return _0x530fba['sendStatus'](_0x466758);}return _0x530fba['status'](_0x466758)[_0xbce4('0x1a')]();};}function respondWithResult(_0x5d99a4,_0x1fbe36){_0x1fbe36=_0x1fbe36||0xc8;return function(_0x1d42df){if(_0x1d42df){return _0x5d99a4[_0xbce4('0x1b')](_0x1fbe36)['json'](_0x1d42df);}};}function respondWithFilteredResult(_0x2755a2,_0xaf9202){return function(_0x55057f){if(_0x55057f){var _0x30cb91=typeof _0xaf9202['offset']==='undefined'&&typeof _0xaf9202[_0xbce4('0x1c')]===_0xbce4('0x1d');var _0x30764d=_0x55057f['count'];var _0x5f0980=_0x30cb91?0x0:_0xaf9202['offset'];var _0x7144b0=_0x30cb91?_0x55057f['count']:_0xaf9202[_0xbce4('0x1e')]+_0xaf9202[_0xbce4('0x1c')];var _0x507f96;if(_0x7144b0>=_0x30764d){_0x7144b0=_0x30764d;_0x507f96=0xc8;}else{_0x507f96=0xce;}_0x2755a2['status'](_0x507f96);return _0x2755a2[_0xbce4('0x1f')](_0xbce4('0x20'),_0x5f0980+'-'+_0x7144b0+'/'+_0x30764d)[_0xbce4('0x21')](_0x55057f);}return null;};}function patchUpdates(_0x40bd69){return function(_0xdffc5b){try{jsonpatch[_0xbce4('0x22')](_0xdffc5b,_0x40bd69,!![]);}catch(_0x518efe){return BPromise[_0xbce4('0x23')](_0x518efe);}return _0xdffc5b[_0xbce4('0x24')]();};}function saveUpdates(_0x2799ca,_0x22b7a6){return function(_0x53a64e){if(_0x53a64e){return _0x53a64e[_0xbce4('0x25')](_0x2799ca)[_0xbce4('0x26')](function(_0x350594){return _0x350594;});}return null;};}function removeEntity(_0x3cf57c,_0x3d1a4c){return function(_0x175760){if(_0x175760){return _0x175760[_0xbce4('0x27')]()[_0xbce4('0x26')](function(){_0x3cf57c[_0xbce4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x289f3f,_0x434bdc){return function(_0x48211c){if(!_0x48211c){_0x289f3f[_0xbce4('0x28')](0x194);}return _0x48211c;};}function handleError(_0x4df137,_0xb557f8){_0xb557f8=_0xb557f8||0x1f4;return function(_0x6cf49d){logger['error'](_0x6cf49d[_0xbce4('0x29')]);if(_0x6cf49d[_0xbce4('0x2a')]){delete _0x6cf49d['name'];}_0x4df137[_0xbce4('0x1b')](_0xb557f8)[_0xbce4('0x2b')](_0x6cf49d);};}exports[_0xbce4('0x2c')]=function(_0x335e35,_0x5371b8){var _0x4f28df={},_0x4e48c2={},_0xee9c3d={'count':0x0,'rows':[]};var _0x2d3c13=_[_0xbce4('0x2d')](db['JscriptySessionReport']['rawAttributes'],function(_0x184c3d){return{'name':_0x184c3d[_0xbce4('0x2e')],'type':_0x184c3d[_0xbce4('0x2f')][_0xbce4('0x30')]};});_0x4e48c2[_0xbce4('0x31')]=_[_0xbce4('0x2d')](_0x2d3c13,_0xbce4('0x2a'));_0x4e48c2[_0xbce4('0x32')]=_['keys'](_0x335e35['query']);_0x4e48c2[_0xbce4('0x33')]=_['intersection'](_0x4e48c2['model'],_0x4e48c2['query']);_0x4f28df[_0xbce4('0x34')]=_['intersection'](_0x4e48c2[_0xbce4('0x31')],qs[_0xbce4('0x35')](_0x335e35[_0xbce4('0x32')][_0xbce4('0x35')]));_0x4f28df['attributes']=_0x4f28df['attributes']['length']?_0x4f28df['attributes']:_0x4e48c2['model'];if(!_0x335e35[_0xbce4('0x32')][_0xbce4('0x36')](_0xbce4('0x37'))){_0x4f28df[_0xbce4('0x1c')]=qs[_0xbce4('0x1c')](_0x335e35[_0xbce4('0x32')][_0xbce4('0x1c')]);_0x4f28df['offset']=qs[_0xbce4('0x1e')](_0x335e35['query'][_0xbce4('0x1e')]);}_0x4f28df[_0xbce4('0x38')]=qs[_0xbce4('0x39')](_0x335e35[_0xbce4('0x32')]['sort']);_0x4f28df[_0xbce4('0x3a')]=qs[_0xbce4('0x33')](_[_0xbce4('0x3b')](_0x335e35['query'],_0x4e48c2['filters']),_0x2d3c13);if(_0x335e35[_0xbce4('0x32')]['filter']){_0x4f28df[_0xbce4('0x3a')]=_[_0xbce4('0x3c')](_0x4f28df[_0xbce4('0x3a')],{'$or':_['map'](_0x2d3c13,function(_0x25fc55){if(_0x25fc55[_0xbce4('0x2f')]!=='VIRTUAL'){var _0x40fde1={};_0x40fde1[_0x25fc55[_0xbce4('0x2a')]]={'$like':'%'+_0x335e35[_0xbce4('0x32')]['filter']+'%'};return _0x40fde1;}})});}_0x4f28df=_['merge']({},_0x4f28df,_0x335e35[_0xbce4('0x3d')]);var _0x55572b={'where':_0x4f28df['where']};return db[_0xbce4('0x3e')][_0xbce4('0x3f')](_0x55572b)['then'](function(_0x186e01){_0xee9c3d[_0xbce4('0x3f')]=_0x186e01;if(_0x335e35['query'][_0xbce4('0x40')]){_0x4f28df[_0xbce4('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4f28df);})[_0xbce4('0x26')](function(_0x334675){_0xee9c3d[_0xbce4('0x42')]=_0x334675;return _0xee9c3d;})['then'](respondWithFilteredResult(_0x5371b8,_0x4f28df))['catch'](handleError(_0x5371b8,null));};exports[_0xbce4('0x43')]=function(_0x9ba631,_0x49e661){var _0x4aa75d={'raw':!![],'where':{'id':_0x9ba631['params']['id']}},_0x2312fe={};_0x2312fe[_0xbce4('0x31')]=_[_0xbce4('0x44')](db[_0xbce4('0x3e')]['rawAttributes']);_0x2312fe[_0xbce4('0x32')]=_[_0xbce4('0x44')](_0x9ba631[_0xbce4('0x32')]);_0x2312fe[_0xbce4('0x33')]=_[_0xbce4('0x45')](_0x2312fe[_0xbce4('0x31')],_0x2312fe[_0xbce4('0x32')]);_0x4aa75d[_0xbce4('0x34')]=_['intersection'](_0x2312fe[_0xbce4('0x31')],qs['fields'](_0x9ba631['query'][_0xbce4('0x35')]));_0x4aa75d['attributes']=_0x4aa75d[_0xbce4('0x34')][_0xbce4('0x46')]?_0x4aa75d[_0xbce4('0x34')]:_0x2312fe[_0xbce4('0x31')];if(_0x9ba631[_0xbce4('0x32')][_0xbce4('0x40')]){_0x4aa75d['include']=[{'all':!![]}];}_0x4aa75d=_[_0xbce4('0x3c')]({},_0x4aa75d,_0x9ba631[_0xbce4('0x3d')]);return db[_0xbce4('0x3e')][_0xbce4('0x47')](_0x4aa75d)[_0xbce4('0x26')](handleEntityNotFound(_0x49e661,null))[_0xbce4('0x26')](respondWithResult(_0x49e661,null))[_0xbce4('0x48')](handleError(_0x49e661,null));};exports['create']=function(_0x29830f,_0x4a0c0f){return db[_0xbce4('0x3e')][_0xbce4('0x49')](_0x29830f['body'],{})[_0xbce4('0x26')](respondWithResult(_0x4a0c0f,0xc9))[_0xbce4('0x48')](handleError(_0x4a0c0f,null));};exports['update']=function(_0x16ff11,_0x18daf3){if(_0x16ff11[_0xbce4('0x4a')]['id']){delete _0x16ff11[_0xbce4('0x4a')]['id'];}return db['JscriptySessionReport'][_0xbce4('0x47')]({'where':{'id':_0x16ff11['params']['id']}})[_0xbce4('0x26')](handleEntityNotFound(_0x18daf3,null))[_0xbce4('0x26')](saveUpdates(_0x16ff11[_0xbce4('0x4a')],null))[_0xbce4('0x26')](respondWithResult(_0x18daf3,null))[_0xbce4('0x48')](handleError(_0x18daf3,null));};exports[_0xbce4('0x27')]=function(_0xc745fe,_0x51a877){return db[_0xbce4('0x3e')][_0xbce4('0x47')]({'where':{'id':_0xc745fe[_0xbce4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51a877,null))[_0xbce4('0x26')](removeEntity(_0x51a877,null))['catch'](handleError(_0x51a877,null));};exports[_0xbce4('0x4c')]=function(_0x315fe2,_0x15201a){return db[_0xbce4('0x3e')][_0xbce4('0x4c')]()[_0xbce4('0x26')](respondWithResult(_0x15201a,null))[_0xbce4('0x48')](handleError(_0x15201a,null));};exports[_0xbce4('0x4d')]=function(_0x27f55,_0x20c576,_0x2370f9){var _0x1ee25c={'raw':!![],'where':{}};var _0x5a663f={};var _0x1c60e4={'count':0x0,'rows':[]};return db[_0xbce4('0x3e')][_0xbce4('0x4e')]({'where':{'id':_0x27f55[_0xbce4('0x4b')]['id']}})[_0xbce4('0x26')](handleEntityNotFound(_0x20c576,null))[_0xbce4('0x26')](function(_0xd794a6){if(_0xd794a6){_0x5a663f[_0xbce4('0x31')]=_[_0xbce4('0x44')](db[_0xbce4('0x4f')][_0xbce4('0x50')]);_0x5a663f['query']=_['keys'](_0x27f55['query']);_0x5a663f['filters']=_[_0xbce4('0x45')](_0x5a663f[_0xbce4('0x31')],_0x5a663f[_0xbce4('0x32')]);_0x1ee25c[_0xbce4('0x34')]=_[_0xbce4('0x45')](_0x5a663f[_0xbce4('0x31')],qs[_0xbce4('0x35')](_0x27f55['query']['fields']));_0x1ee25c['attributes']=_0x1ee25c['attributes']['length']?_0x1ee25c[_0xbce4('0x34')]:_0x5a663f[_0xbce4('0x31')];if(!_0x27f55['query'][_0xbce4('0x36')]('nolimit')){_0x1ee25c[_0xbce4('0x1c')]=qs[_0xbce4('0x1c')](_0x27f55[_0xbce4('0x32')][_0xbce4('0x1c')]);_0x1ee25c[_0xbce4('0x1e')]=qs['offset'](_0x27f55[_0xbce4('0x32')]['offset']);}_0x1ee25c[_0xbce4('0x38')]=qs[_0xbce4('0x39')](_0x27f55['query'][_0xbce4('0x39')]);_0x1ee25c['where']=qs['filters'](_[_0xbce4('0x3b')](_0x27f55['query'],_0x5a663f[_0xbce4('0x33')]));_0x1ee25c[_0xbce4('0x3a')][_0xbce4('0x51')]=_0xd794a6['id'];if(_0x27f55['query'][_0xbce4('0x52')]){_0x1ee25c['where']=_[_0xbce4('0x3c')](_0x1ee25c[_0xbce4('0x3a')],{'$or':_[_0xbce4('0x2d')](_0x1ee25c[_0xbce4('0x34')],function(_0x2e409d){var _0x802325={};_0x802325[_0x2e409d]={'$like':'%'+_0x27f55[_0xbce4('0x32')]['filter']+'%'};return _0x802325;})});}_0x1ee25c=_[_0xbce4('0x3c')]({},_0x1ee25c,_0x27f55[_0xbce4('0x3d')]);return db[_0xbce4('0x4f')]['count']({'where':_0x1ee25c[_0xbce4('0x3a')]})['then'](function(_0x14b13b){_0x1c60e4[_0xbce4('0x3f')]=_0x14b13b;if(_0x27f55[_0xbce4('0x32')]['includeAll']){_0x1ee25c[_0xbce4('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbce4('0x53')](_0x1ee25c);})['then'](function(_0x16be47){_0x1c60e4[_0xbce4('0x42')]=_0x16be47;return _0x1c60e4;});}})[_0xbce4('0x26')](respondWithFilteredResult(_0x20c576,_0x1ee25c))[_0xbce4('0x48')](handleError(_0x20c576,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7e5d492..a45784e 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 _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x409a18,_0x312d95){var _0x1f2486=function(_0x4e672){while(--_0x4e672){_0x409a18['push'](_0x409a18['shift']());}};_0x1f2486(++_0x312d95);}(_0x31f0,0xb7));var _0x031f=function(_0x2b6dac,_0x23f6ed){_0x2b6dac=_0x2b6dac-0x0;var _0x3cb636=_0x31f0[_0x2b6dac];return _0x3cb636;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x1521be,_0x34aa83){var _0x156a8e=function(_0x1b803c){while(--_0x1b803c){_0x1521be['push'](_0x1521be['shift']());}};_0x156a8e(++_0x34aa83);}(_0x2675,0x75));var _0x5267=function(_0x4780d4,_0x310eec){_0x4780d4=_0x4780d4-0x0;var _0xe75b24=_0x2675[_0x4780d4];return _0xe75b24;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 7488545..878bef1 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 _0xed1c=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1c,0xe4));var _0xced1=function(_0x4b0449,_0x5bd318){_0x4b0449=_0x4b0449-0x0;var _0x35bb92=_0xed1c[_0x4b0449];return _0x35bb92;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});} \ No newline at end of file +var _0x3a6d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3a6d,0x143));var _0xd3a6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3a6d[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ff4a683..00da124 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 _0xdc03=['../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id','/download_log_file','isAuthenticated','downloadLogFile','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xf44acf,_0x239092){var _0x1ee5fc=function(_0x41184f){while(--_0x41184f){_0xf44acf['push'](_0xf44acf['shift']());}};_0x1ee5fc(++_0x239092);}(_0xdc03,0x19e));var _0x3dc0=function(_0x24f27f,_0x503a09){_0x24f27f=_0x24f27f-0x0;var _0xc7eea3=_0xdc03[_0x24f27f];return _0xc7eea3;};'use strict';var multer=require(_0x3dc0('0x0'));var util=require(_0x3dc0('0x1'));var path=require(_0x3dc0('0x2'));var timeout=require(_0x3dc0('0x3'));var express=require('express');var router=express[_0x3dc0('0x4')]();var fs_extra=require(_0x3dc0('0x5'));var auth=require(_0x3dc0('0x6'));var interaction=require(_0x3dc0('0x7'));var config=require('../../config/environment');var controller=require(_0x3dc0('0x8'));router[_0x3dc0('0x9')]('/',controller['index']);router[_0x3dc0('0xa')](_0x3dc0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3dc0('0x9')](_0x3dc0('0xc'),auth[_0x3dc0('0xd')](),controller[_0x3dc0('0xe')]);module['exports']=router; \ No newline at end of file +var _0x47b2=['../../config/environment','./license.controller','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x326965,_0x3d62b5){var _0x34acb2=function(_0x3bec26){while(--_0x3bec26){_0x326965['push'](_0x326965['shift']());}};_0x34acb2(++_0x3d62b5);}(_0x47b2,0x16a));var _0x247b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47b2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x247b('0x0'));var path=require(_0x247b('0x1'));var timeout=require(_0x247b('0x2'));var express=require(_0x247b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x247b('0x4'));var interaction=require(_0x247b('0x5'));var config=require(_0x247b('0x6'));var controller=require(_0x247b('0x7'));router[_0x247b('0x8')]('/',controller[_0x247b('0x9')]);router[_0x247b('0xa')]('/:id',auth[_0x247b('0xb')](),controller[_0x247b('0xc')]);router[_0x247b('0x8')](_0x247b('0xd'),auth[_0x247b('0xb')](),controller[_0x247b('0xe')]);module[_0x247b('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a8303e1..9810b6b 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 _0x0cba=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x465d21,_0x1feb87){var _0x5c8961=function(_0xf97e62){while(--_0xf97e62){_0x465d21['push'](_0x465d21['shift']());}};_0x5c8961(++_0x1feb87);}(_0x0cba,0xed));var _0xa0cb=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x0cba[_0x14477e];return _0x5d4a05;};'use strict';var Sequelize=require(_0xa0cb('0x0'));module[_0xa0cb('0x1')]={'license':{'type':Sequelize[_0xa0cb('0x2')]},'data1':{'type':Sequelize[_0xa0cb('0x3')]},'data2':{'type':Sequelize[_0xa0cb('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa0cb('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d03=['TEXT','STRING','sequelize','exports'];(function(_0x31c060,_0x5c03aa){var _0xb420f3=function(_0x12e548){while(--_0x12e548){_0x31c060['push'](_0x31c060['shift']());}};_0xb420f3(++_0x5c03aa);}(_0x7d03,0x10a));var _0x37d0=function(_0x5d5282,_0x150ebd){_0x5d5282=_0x5d5282-0x0;var _0x527304=_0x7d03[_0x5d5282];return _0x527304;};'use strict';var Sequelize=require(_0x37d0('0x0'));module[_0x37d0('0x1')]={'license':{'type':Sequelize[_0x37d0('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x37d0('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e13cfa6..2e56354 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 _0xc223=['downloadLogFile','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','model','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','find','get','key'];(function(_0x300ba2,_0xe84fce){var _0x4c780d=function(_0x531858){while(--_0x531858){_0x300ba2['push'](_0x300ba2['shift']());}};_0x4c780d(++_0xe84fce);}(_0xc223,0xde));var _0x3c22=function(_0x16ab8a,_0x1fce17){_0x16ab8a=_0x16ab8a-0x0;var _0x313bec=_0xc223[_0x16ab8a];return _0x313bec;};'use strict';var emlformat=require(_0x3c22('0x0'));var rimraf=require(_0x3c22('0x1'));var zipdir=require(_0x3c22('0x2'));var jsonpatch=require(_0x3c22('0x3'));var rp=require(_0x3c22('0x4'));var moment=require('moment');var BPromise=require(_0x3c22('0x5'));var Mustache=require(_0x3c22('0x6'));var util=require(_0x3c22('0x7'));var path=require(_0x3c22('0x8'));var sox=require(_0x3c22('0x9'));var csv=require(_0x3c22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c22('0xb'));var _=require(_0x3c22('0xc'));var squel=require(_0x3c22('0xd'));var crypto=require(_0x3c22('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c22('0xa'));var querystring=require(_0x3c22('0xf'));var Papa=require(_0x3c22('0x10'));var Redis=require(_0x3c22('0x11'));var authService=require(_0x3c22('0x12'));var qs=require(_0x3c22('0x13'));var as=require(_0x3c22('0x14'));var hardwareService=require(_0x3c22('0x15'));var logger=require(_0x3c22('0x16'))(_0x3c22('0x17'));var utils=require(_0x3c22('0x18'));var config=require(_0x3c22('0x19'));var licenseUtil=require(_0x3c22('0x1a'));var db=require(_0x3c22('0x1b'))['db'];function respondWithStatusCode(_0x47f739,_0x775df4){_0x775df4=_0x775df4||0xcc;return function(_0xaf65e8){if(_0xaf65e8){return _0x47f739[_0x3c22('0x1c')](_0x775df4);}return _0x47f739['status'](_0x775df4)[_0x3c22('0x1d')]();};}function respondWithResult(_0x3bcc7f,_0x30393d){_0x30393d=_0x30393d||0xc8;return function(_0x5d037e){if(_0x5d037e){return _0x3bcc7f[_0x3c22('0x1e')](_0x30393d)['json'](_0x5d037e);}};}function respondWithFilteredResult(_0x469098,_0x277b6f){return function(_0x5b8d6b){if(_0x5b8d6b){var _0x2f8e7e=typeof _0x277b6f[_0x3c22('0x1f')]===_0x3c22('0x20')&&typeof _0x277b6f[_0x3c22('0x21')]===_0x3c22('0x20');var _0x322fb8=_0x5b8d6b['count'];var _0x451f85=_0x2f8e7e?0x0:_0x277b6f[_0x3c22('0x1f')];var _0x573f44=_0x2f8e7e?_0x5b8d6b['count']:_0x277b6f[_0x3c22('0x1f')]+_0x277b6f[_0x3c22('0x21')];var _0x385e1;if(_0x573f44>=_0x322fb8){_0x573f44=_0x322fb8;_0x385e1=0xc8;}else{_0x385e1=0xce;}_0x469098[_0x3c22('0x1e')](_0x385e1);return _0x469098[_0x3c22('0x22')](_0x3c22('0x23'),_0x451f85+'-'+_0x573f44+'/'+_0x322fb8)[_0x3c22('0x24')](_0x5b8d6b);}return null;};}function patchUpdates(_0x48d039){return function(_0x1e1065){try{jsonpatch[_0x3c22('0x25')](_0x1e1065,_0x48d039,!![]);}catch(_0x15c9fe){return BPromise[_0x3c22('0x26')](_0x15c9fe);}return _0x1e1065[_0x3c22('0x27')]();};}function saveUpdates(_0x10db78,_0x17bd83){return function(_0x3da8ae){if(_0x3da8ae){return _0x3da8ae[_0x3c22('0x28')](_0x10db78)[_0x3c22('0x29')](function(_0x105b4c){return _0x105b4c;});}return null;};}function removeEntity(_0x45fc23,_0x41f225){return function(_0x2a6322){if(_0x2a6322){return _0x2a6322[_0x3c22('0x2a')]()[_0x3c22('0x29')](function(){_0x45fc23[_0x3c22('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ead,_0x24b6be){return function(_0x56af30){if(!_0x56af30){_0x38ead[_0x3c22('0x1c')](0x194);}return _0x56af30;};}function handleError(_0x38b683,_0x2b4e0d){_0x2b4e0d=_0x2b4e0d||0x1f4;return function(_0x290c27){logger[_0x3c22('0x2b')](_0x290c27['stack']);if(_0x290c27[_0x3c22('0x2c')]){delete _0x290c27[_0x3c22('0x2c')];}_0x38b683[_0x3c22('0x1e')](_0x2b4e0d)[_0x3c22('0x2d')](_0x290c27);};}var utilLicense=require(_0x3c22('0x1a'));exports[_0x3c22('0x2e')]=function(_0x42e84f,_0x4cf34c){var _0x5198d7={'raw':!![],'where':{'id':0x1}},_0x275dd5={};_0x275dd5[_0x3c22('0x2f')]=_['keys'](db[_0x3c22('0x30')][_0x3c22('0x31')]);_0x275dd5[_0x3c22('0x32')]=_['keys'](_0x42e84f[_0x3c22('0x32')]);_0x275dd5[_0x3c22('0x33')]=_[_0x3c22('0x34')](_0x275dd5[_0x3c22('0x2f')],_0x275dd5[_0x3c22('0x32')]);_0x5198d7[_0x3c22('0x35')]=_['intersection'](_0x275dd5[_0x3c22('0x2f')],qs[_0x3c22('0x36')](_0x42e84f[_0x3c22('0x32')][_0x3c22('0x36')]));_0x5198d7['attributes']=_0x5198d7['attributes'][_0x3c22('0x37')]?_0x5198d7['attributes']:_0x275dd5[_0x3c22('0x2f')];_0x5198d7=_['merge']({},_0x5198d7,_0x42e84f[_0x3c22('0x38')]);return utilLicense['getLicense'](_0x5198d7)[_0x3c22('0x29')](respondWithResult(_0x4cf34c,null))[_0x3c22('0x39')](handleError(_0x4cf34c,null));};exports[_0x3c22('0x28')]=function(_0x1360ab,_0x1eb46d){if(_0x1360ab[_0x3c22('0x3a')]['id']){delete _0x1360ab['body']['id'];}return db[_0x3c22('0x30')][_0x3c22('0x3b')]({'where':{'id':_0x1360ab['params']['id']}})[_0x3c22('0x29')](handleEntityNotFound(_0x1eb46d,null))['then'](function(_0x42ceca){var _0x12bd0f=_0x42ceca[_0x3c22('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x12bd0f,_0x1360ab[_0x3c22('0x3a')][_0x3c22('0x3d')]);})[_0x3c22('0x29')](function(_0x29e243){if(!_0x29e243['demo']){return saveUpdates(_0x1360ab[_0x3c22('0x3a')],null);}return _0x29e243;})[_0x3c22('0x29')](respondWithResult(_0x1eb46d,null))[_0x3c22('0x39')](handleError(_0x1eb46d,null));};exports[_0x3c22('0x3e')]=function(_0x20e2b2,_0x4adc37){var _0x248f1b='license-info.log';var _0x50f9eb=path['join'](_0x3c22('0x3f'),_0x3c22('0x40'),_0x3c22('0x41'),_0x248f1b);_0x4adc37[_0x3c22('0x42')](_0x3c22('0x43'),_0x3c22('0x44')+_0x248f1b);_0x4adc37['set'](_0x3c22('0x45'),_0x3c22('0x46'));_0x4adc37['download'](_0x50f9eb);}; \ No newline at end of file +var _0x0ae5=['checkLicense','demo','catch','downloadLogFile','join','/var','log','setHeader','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','model','License','rawAttributes','query','keys','intersection','attributes','fields','length','merge','options','getLicense','body','find','get'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x0ae5,0x13b));var _0x50ae=function(_0x15ac27,_0x4c6d79){_0x15ac27=_0x15ac27-0x0;var _0x5b6c8c=_0x0ae5[_0x15ac27];return _0x5b6c8c;};'use strict';var emlformat=require(_0x50ae('0x0'));var rimraf=require(_0x50ae('0x1'));var zipdir=require(_0x50ae('0x2'));var jsonpatch=require(_0x50ae('0x3'));var rp=require('request-promise');var moment=require(_0x50ae('0x4'));var BPromise=require(_0x50ae('0x5'));var Mustache=require(_0x50ae('0x6'));var util=require('util');var path=require(_0x50ae('0x7'));var sox=require(_0x50ae('0x8'));var csv=require(_0x50ae('0x9'));var ejs=require(_0x50ae('0xa'));var fs=require('fs');var fs_extra=require(_0x50ae('0xb'));var _=require(_0x50ae('0xc'));var squel=require(_0x50ae('0xd'));var crypto=require(_0x50ae('0xe'));var jsforce=require(_0x50ae('0xf'));var deskjs=require(_0x50ae('0x10'));var toCsv=require('to-csv');var querystring=require(_0x50ae('0x11'));var Papa=require(_0x50ae('0x12'));var Redis=require(_0x50ae('0x13'));var authService=require(_0x50ae('0x14'));var qs=require(_0x50ae('0x15'));var as=require(_0x50ae('0x16'));var hardwareService=require(_0x50ae('0x17'));var logger=require(_0x50ae('0x18'))(_0x50ae('0x19'));var utils=require(_0x50ae('0x1a'));var config=require(_0x50ae('0x1b'));var licenseUtil=require(_0x50ae('0x1c'));var db=require(_0x50ae('0x1d'))['db'];function respondWithStatusCode(_0x45d9e3,_0x562875){_0x562875=_0x562875||0xcc;return function(_0x21b9ea){if(_0x21b9ea){return _0x45d9e3[_0x50ae('0x1e')](_0x562875);}return _0x45d9e3[_0x50ae('0x1f')](_0x562875)[_0x50ae('0x20')]();};}function respondWithResult(_0x6ddbfb,_0x419115){_0x419115=_0x419115||0xc8;return function(_0x814abb){if(_0x814abb){return _0x6ddbfb['status'](_0x419115)[_0x50ae('0x21')](_0x814abb);}};}function respondWithFilteredResult(_0x54f9aa,_0x1720a4){return function(_0x7b64ee){if(_0x7b64ee){var _0x4341ca=typeof _0x1720a4[_0x50ae('0x22')]==='undefined'&&typeof _0x1720a4['limit']===_0x50ae('0x23');var _0x59a0c7=_0x7b64ee[_0x50ae('0x24')];var _0xa36be=_0x4341ca?0x0:_0x1720a4['offset'];var _0xc228ef=_0x4341ca?_0x7b64ee[_0x50ae('0x24')]:_0x1720a4[_0x50ae('0x22')]+_0x1720a4[_0x50ae('0x25')];var _0x3d08ca;if(_0xc228ef>=_0x59a0c7){_0xc228ef=_0x59a0c7;_0x3d08ca=0xc8;}else{_0x3d08ca=0xce;}_0x54f9aa[_0x50ae('0x1f')](_0x3d08ca);return _0x54f9aa[_0x50ae('0x26')](_0x50ae('0x27'),_0xa36be+'-'+_0xc228ef+'/'+_0x59a0c7)[_0x50ae('0x21')](_0x7b64ee);}return null;};}function patchUpdates(_0x418e9a){return function(_0x53675b){try{jsonpatch[_0x50ae('0x28')](_0x53675b,_0x418e9a,!![]);}catch(_0x4b7cde){return BPromise[_0x50ae('0x29')](_0x4b7cde);}return _0x53675b[_0x50ae('0x2a')]();};}function saveUpdates(_0x1d3233,_0x344e99){return function(_0x29221d){if(_0x29221d){return _0x29221d[_0x50ae('0x2b')](_0x1d3233)[_0x50ae('0x2c')](function(_0xae3dac){return _0xae3dac;});}return null;};}function removeEntity(_0x11b215,_0x455242){return function(_0xcca07a){if(_0xcca07a){return _0xcca07a[_0x50ae('0x2d')]()[_0x50ae('0x2c')](function(){_0x11b215['status'](0xcc)[_0x50ae('0x20')]();});}};}function handleEntityNotFound(_0x10b213,_0x55302f){return function(_0x4800b9){if(!_0x4800b9){_0x10b213['sendStatus'](0x194);}return _0x4800b9;};}function handleError(_0x570e2b,_0x53df93){_0x53df93=_0x53df93||0x1f4;return function(_0x1cc384){logger[_0x50ae('0x2e')](_0x1cc384[_0x50ae('0x2f')]);if(_0x1cc384[_0x50ae('0x30')]){delete _0x1cc384[_0x50ae('0x30')];}_0x570e2b['status'](_0x53df93)['send'](_0x1cc384);};}var utilLicense=require(_0x50ae('0x1c'));exports[_0x50ae('0x31')]=function(_0x52f732,_0x4ae031){var _0x2ade17={'raw':!![],'where':{'id':0x1}},_0x276928={};_0x276928[_0x50ae('0x32')]=_['keys'](db[_0x50ae('0x33')][_0x50ae('0x34')]);_0x276928[_0x50ae('0x35')]=_[_0x50ae('0x36')](_0x52f732[_0x50ae('0x35')]);_0x276928['filters']=_[_0x50ae('0x37')](_0x276928[_0x50ae('0x32')],_0x276928['query']);_0x2ade17[_0x50ae('0x38')]=_[_0x50ae('0x37')](_0x276928['model'],qs[_0x50ae('0x39')](_0x52f732[_0x50ae('0x35')][_0x50ae('0x39')]));_0x2ade17[_0x50ae('0x38')]=_0x2ade17[_0x50ae('0x38')][_0x50ae('0x3a')]?_0x2ade17[_0x50ae('0x38')]:_0x276928[_0x50ae('0x32')];_0x2ade17=_[_0x50ae('0x3b')]({},_0x2ade17,_0x52f732[_0x50ae('0x3c')]);return utilLicense[_0x50ae('0x3d')](_0x2ade17)['then'](respondWithResult(_0x4ae031,null))['catch'](handleError(_0x4ae031,null));};exports[_0x50ae('0x2b')]=function(_0xab39fc,_0x3d2459){if(_0xab39fc[_0x50ae('0x3e')]['id']){delete _0xab39fc[_0x50ae('0x3e')]['id'];}return db[_0x50ae('0x33')][_0x50ae('0x3f')]({'where':{'id':_0xab39fc['params']['id']}})[_0x50ae('0x2c')](handleEntityNotFound(_0x3d2459,null))[_0x50ae('0x2c')](function(_0x2e065d){var _0x5a967d=_0x2e065d[_0x50ae('0x40')]({'plain':!![]});return utilLicense[_0x50ae('0x41')](_0x5a967d,_0xab39fc[_0x50ae('0x3e')]['key']);})[_0x50ae('0x2c')](function(_0x13f4b4){if(!_0x13f4b4[_0x50ae('0x42')]){return saveUpdates(_0xab39fc['body'],null);}return _0x13f4b4;})['then'](respondWithResult(_0x3d2459,null))[_0x50ae('0x43')](handleError(_0x3d2459,null));};exports[_0x50ae('0x44')]=function(_0xe7624e,_0x38ce73){var _0x1c0979='license-info.log';var _0x5a0239=path[_0x50ae('0x45')](_0x50ae('0x46'),_0x50ae('0x47'),'xcally',_0x1c0979);_0x38ce73[_0x50ae('0x48')](_0x50ae('0x49'),'attachment;\x20filename='+_0x1c0979);_0x38ce73[_0x50ae('0x26')]('Content-Type',_0x50ae('0x4a'));_0x38ce73[_0x50ae('0x4b')](_0x5a0239);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f054291..0c56d11 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 _0xee0c=['moment','bluebird','path','rimraf','./license.attributes','license','util','../../config/logger'];(function(_0x2b5815,_0xe9501b){var _0x5b1f8b=function(_0x5d8dc3){while(--_0x5d8dc3){_0x2b5815['push'](_0x2b5815['shift']());}};_0x5b1f8b(++_0xe9501b);}(_0xee0c,0x10e));var _0xcee0=function(_0x2a7f3f,_0xff5dc6){_0x2a7f3f=_0x2a7f3f-0x0;var _0x47a609=_0xee0c[_0x2a7f3f];return _0x47a609;};'use strict';var _=require('lodash');var util=require(_0xcee0('0x0'));var logger=require(_0xcee0('0x1'))('api');var moment=require(_0xcee0('0x2'));var BPromise=require(_0xcee0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcee0('0x4'));var rimraf=require(_0xcee0('0x5'));var config=require('../../config/environment');var attributes=require(_0xcee0('0x6'));module['exports']=function(_0x3a1bbc,_0x5dad6a){return _0x3a1bbc['define']('License',attributes,{'tableName':_0xcee0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd996=['define','License','license','../../config/logger','api','moment','request-promise','../../config/environment','./license.attributes','exports'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0xd996,0x17f));var _0x6d99=function(_0x3c635d,_0x116053){_0x3c635d=_0x3c635d-0x0;var _0x75c7fb=_0xd996[_0x3c635d];return _0x75c7fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d99('0x0'))(_0x6d99('0x1'));var moment=require(_0x6d99('0x2'));var BPromise=require('bluebird');var rp=require(_0x6d99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d99('0x4'));var attributes=require(_0x6d99('0x5'));module[_0x6d99('0x6')]=function(_0x7f1e1,_0x130046){return _0x7f1e1[_0x6d99('0x7')](_0x6d99('0x8'),attributes,{'tableName':_0x6d99('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a6a9906..cfe9f02 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 _0x3820=['request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2417a0,_0x20ea27){var _0x113f27=function(_0x3cb0b4){while(--_0x3cb0b4){_0x2417a0['push'](_0x2417a0['shift']());}};_0x113f27(++_0x20ea27);}(_0x3820,0x14c));var _0x0382=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x3820[_0x836465];return _0x2150ea;};'use strict';var _=require('lodash');var util=require(_0x0382('0x0'));var moment=require(_0x0382('0x1'));var BPromise=require(_0x0382('0x2'));var rs=require(_0x0382('0x3'));var fs=require('fs');var Redis=require(_0x0382('0x4'));var db=require(_0x0382('0x5'))['db'];var utils=require(_0x0382('0x6'));var logger=require(_0x0382('0x7'))(_0x0382('0x8'));var config=require(_0x0382('0x9'));var jayson=require(_0x0382('0xa'));var client=jayson[_0x0382('0xb')][_0x0382('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3315a6,_0xfaf3e7,_0x3f89aa){return new BPromise(function(_0x5556f0,_0x193785){return client[_0x0382('0xd')](_0x3315a6,_0x3f89aa)[_0x0382('0xe')](function(_0x261ccb){logger['info'](_0x0382('0xf'),_0xfaf3e7,_0x0382('0x10'));logger[_0x0382('0x11')]('License,\x20%s,\x20%s,\x20%s',_0xfaf3e7,'request\x20sent',JSON[_0x0382('0x12')](_0x261ccb));if(_0x261ccb[_0x0382('0x13')]){if(_0x261ccb[_0x0382('0x13')][_0x0382('0x14')]===0x1f4){logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x261ccb['error']['message']);return _0x193785(_0x261ccb['error']['message']);}logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x261ccb[_0x0382('0x13')][_0x0382('0x15')]);return _0x5556f0(_0x261ccb[_0x0382('0x13')][_0x0382('0x15')]);}else{logger['info'](_0x0382('0xf'),_0xfaf3e7,'request\x20sent');_0x5556f0(_0x261ccb[_0x0382('0x16')][_0x0382('0x15')]);}})['catch'](function(_0x2ac843){logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x2ac843);_0x193785(_0x2ac843);});});} \ No newline at end of file +var _0x9cbf=['../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2cdf41,_0x4a277c){var _0x39a70e=function(_0x2404a9){while(--_0x2404a9){_0x2cdf41['push'](_0x2cdf41['shift']());}};_0x39a70e(++_0x4a277c);}(_0x9cbf,0xf0));var _0xf9cb=function(_0x36e87c,_0x16e8e7){_0x36e87c=_0x36e87c-0x0;var _0x188fdc=_0x9cbf[_0x36e87c];return _0x188fdc;};'use strict';var _=require(_0xf9cb('0x0'));var util=require(_0xf9cb('0x1'));var moment=require(_0xf9cb('0x2'));var BPromise=require(_0xf9cb('0x3'));var rs=require(_0xf9cb('0x4'));var fs=require('fs');var Redis=require(_0xf9cb('0x5'));var db=require(_0xf9cb('0x6'))['db'];var utils=require(_0xf9cb('0x7'));var logger=require(_0xf9cb('0x8'))(_0xf9cb('0x9'));var config=require(_0xf9cb('0xa'));var jayson=require(_0xf9cb('0xb'));var client=jayson[_0xf9cb('0xc')][_0xf9cb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35603f,_0x533f88,_0x5eaf8e){return new BPromise(function(_0x513158,_0x61c83d){return client[_0xf9cb('0xe')](_0x35603f,_0x5eaf8e)[_0xf9cb('0xf')](function(_0x5d2f0c){logger[_0xf9cb('0x10')](_0xf9cb('0x11'),_0x533f88,'request\x20sent');logger[_0xf9cb('0x12')]('License,\x20%s,\x20%s,\x20%s',_0x533f88,_0xf9cb('0x13'),JSON[_0xf9cb('0x14')](_0x5d2f0c));if(_0x5d2f0c[_0xf9cb('0x15')]){if(_0x5d2f0c[_0xf9cb('0x15')][_0xf9cb('0x16')]===0x1f4){logger['error'](_0xf9cb('0x11'),_0x533f88,_0x5d2f0c['error']['message']);return _0x61c83d(_0x5d2f0c['error'][_0xf9cb('0x17')]);}logger[_0xf9cb('0x15')](_0xf9cb('0x11'),_0x533f88,_0x5d2f0c[_0xf9cb('0x15')][_0xf9cb('0x17')]);return _0x513158(_0x5d2f0c[_0xf9cb('0x15')]['message']);}else{logger[_0xf9cb('0x10')](_0xf9cb('0x11'),_0x533f88,'request\x20sent');_0x513158(_0x5d2f0c[_0xf9cb('0x18')]['message']);}})['catch'](function(_0x27116d){logger[_0xf9cb('0x15')](_0xf9cb('0x11'),_0x533f88,_0x27116d);_0x61c83d(_0x27116d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8dde5aa..3ccb631 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 _0xadb1=['/:id/send','/:id/users','addAgents','update','/:id/dispositions','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','getAgents','post','addAnswer','create','addSmtp','/:id/interactions','addApplications'];(function(_0x1009ec,_0x424c79){var _0x1fa922=function(_0x30fb90){while(--_0x30fb90){_0x1009ec['push'](_0x1009ec['shift']());}};_0x1fa922(++_0x424c79);}(_0xadb1,0x1ad));var _0x1adb=function(_0x8d4d2c,_0x4e6c25){_0x8d4d2c=_0x8d4d2c-0x0;var _0x2113b9=_0xadb1[_0x8d4d2c];return _0x2113b9;};'use strict';var multer=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var path=require(_0x1adb('0x2'));var timeout=require(_0x1adb('0x3'));var express=require('express');var router=express[_0x1adb('0x4')]();var fs_extra=require(_0x1adb('0x5'));var auth=require(_0x1adb('0x6'));var interaction=require(_0x1adb('0x7'));var config=require(_0x1adb('0x8'));var controller=require('./mailAccount.controller');router[_0x1adb('0x9')]('/',auth[_0x1adb('0xa')](),controller[_0x1adb('0xb')]);router[_0x1adb('0x9')](_0x1adb('0xc'),auth[_0x1adb('0xa')](),controller[_0x1adb('0xd')]);router['get'](_0x1adb('0xe'),auth['isAuthenticated'](),controller[_0x1adb('0xf')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1adb('0x10')]);router[_0x1adb('0x9')](_0x1adb('0x11'),auth[_0x1adb('0xa')](),controller['getAnswers']);router[_0x1adb('0x9')](_0x1adb('0x12'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x13')]);router[_0x1adb('0x9')](_0x1adb('0x14'),auth[_0x1adb('0xa')](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0x1adb('0xa')](),controller[_0x1adb('0x15')]);router[_0x1adb('0x9')](_0x1adb('0x16'),auth[_0x1adb('0xa')](),controller['getApplications']);router[_0x1adb('0x9')](_0x1adb('0x17'),auth['isAuthenticated'](),controller[_0x1adb('0x18')]);router[_0x1adb('0x9')]('/:id/verify',auth[_0x1adb('0xa')](),controller[_0x1adb('0x19')]);router[_0x1adb('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x1adb('0x1a')]);router[_0x1adb('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1adb('0x1b')](_0x1adb('0x11'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x1c')]);router[_0x1adb('0x1b')]('/',auth[_0x1adb('0xa')](),controller[_0x1adb('0x1d')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x1adb('0x1b')](_0x1adb('0x14'),auth['isAuthenticated'](),controller[_0x1adb('0x1e')]);router[_0x1adb('0x1b')](_0x1adb('0x1f'),auth[_0x1adb('0xa')](),controller['addInteraction']);router['post'](_0x1adb('0x16'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x20')]);router['post'](_0x1adb('0x21'),auth[_0x1adb('0xa')](),controller['send']);router[_0x1adb('0x1b')](_0x1adb('0x22'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x23')]);router['put'](_0x1adb('0xe'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x24')]);router['delete'](_0x1adb('0x25'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1adb('0x26')](_0x1adb('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1adb('0x26')](_0x1adb('0x12'),auth[_0x1adb('0xa')](),controller['removeImap']);router[_0x1adb('0x26')](_0x1adb('0x14'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x1adb('0x26')](_0x1adb('0xe'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x27')]);router[_0x1adb('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x1adb('0x28')]);module[_0x1adb('0x29')]=router; \ No newline at end of file +var _0x7435=['/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id/users','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','post','addAnswer','create','addImap'];(function(_0x8d3bef,_0x293ccc){var _0x2442e1=function(_0x42085f){while(--_0x42085f){_0x8d3bef['push'](_0x8d3bef['shift']());}};_0x2442e1(++_0x293ccc);}(_0x7435,0x136));var _0x5743=function(_0x6fe380,_0x147f69){_0x6fe380=_0x6fe380-0x0;var _0x251d29=_0x7435[_0x6fe380];return _0x251d29;};'use strict';var multer=require('multer');var util=require(_0x5743('0x0'));var path=require(_0x5743('0x1'));var timeout=require(_0x5743('0x2'));var express=require(_0x5743('0x3'));var router=express[_0x5743('0x4')]();var fs_extra=require(_0x5743('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5743('0x6'));var config=require('../../config/environment');var controller=require(_0x5743('0x7'));router[_0x5743('0x8')]('/',auth[_0x5743('0x9')](),controller[_0x5743('0xa')]);router[_0x5743('0x8')](_0x5743('0xb'),auth[_0x5743('0x9')](),controller[_0x5743('0xc')]);router[_0x5743('0x8')](_0x5743('0xd'),auth['isAuthenticated'](),controller[_0x5743('0xe')]);router[_0x5743('0x8')](_0x5743('0xf'),auth['isAuthenticated'](),controller[_0x5743('0x10')]);router[_0x5743('0x8')](_0x5743('0x11'),auth['isAuthenticated'](),controller[_0x5743('0x12')]);router[_0x5743('0x8')](_0x5743('0x13'),auth[_0x5743('0x9')](),controller[_0x5743('0x14')]);router['get']('/:id/out_servers',auth[_0x5743('0x9')](),controller[_0x5743('0x15')]);router[_0x5743('0x8')](_0x5743('0x16'),auth[_0x5743('0x9')](),controller[_0x5743('0x17')]);router[_0x5743('0x8')](_0x5743('0x18'),auth[_0x5743('0x9')](),controller[_0x5743('0x19')]);router[_0x5743('0x8')](_0x5743('0x1a'),auth[_0x5743('0x9')](),controller[_0x5743('0x1b')]);router[_0x5743('0x8')](_0x5743('0x1c'),auth[_0x5743('0x9')](),controller['verifySmtp']);router['get']('/:id/users',auth[_0x5743('0x9')](),controller['getAgents']);router[_0x5743('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x5743('0x9')](),controller[_0x5743('0x1e')]);router[_0x5743('0x1d')]('/',auth[_0x5743('0x9')](),controller[_0x5743('0x1f')]);router[_0x5743('0x1d')](_0x5743('0x13'),auth[_0x5743('0x9')](),controller[_0x5743('0x20')]);router[_0x5743('0x1d')](_0x5743('0x21'),auth[_0x5743('0x9')](),controller[_0x5743('0x22')]);router[_0x5743('0x1d')](_0x5743('0x16'),auth[_0x5743('0x9')](),controller[_0x5743('0x23')]);router[_0x5743('0x1d')](_0x5743('0x18'),auth[_0x5743('0x9')](),controller[_0x5743('0x24')]);router[_0x5743('0x1d')](_0x5743('0x25'),auth[_0x5743('0x9')](),controller[_0x5743('0x26')]);router[_0x5743('0x1d')]('/:id/users',auth[_0x5743('0x9')](),controller[_0x5743('0x27')]);router[_0x5743('0x28')]('/:id',auth[_0x5743('0x9')](),controller[_0x5743('0x29')]);router[_0x5743('0x2a')](_0x5743('0xf'),auth['isAuthenticated'](),controller[_0x5743('0x2b')]);router[_0x5743('0x2a')](_0x5743('0x11'),auth[_0x5743('0x9')](),controller[_0x5743('0x2c')]);router[_0x5743('0x2a')]('/:id/in_servers',auth[_0x5743('0x9')](),controller[_0x5743('0x2d')]);router['delete'](_0x5743('0x21'),auth[_0x5743('0x9')](),controller[_0x5743('0x2e')]);router['delete'](_0x5743('0xd'),auth[_0x5743('0x9')](),controller['destroy']);router[_0x5743('0x2a')](_0x5743('0x2f'),auth[_0x5743('0x9')](),controller['removeAgents']);module[_0x5743('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2fda9e3..84811cc 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 _0xbf87=['Arial,Helvetica,sans-serif','INTEGER','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','getDataValue','provider','custom','sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x65d8cd,_0x5407ad){var _0x320d76=function(_0x27e437){while(--_0x27e437){_0x65d8cd['push'](_0x65d8cd['shift']());}};_0x320d76(++_0x5407ad);}(_0xbf87,0x1c6));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7bf8('0x0'));module[_0x7bf8('0x1')]={'description':{'type':Sequelize[_0x7bf8('0x2')]},'name':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7bf8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7bf8('0x3')]},'markAsUnread':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![],'defaultValue':_0x7bf8('0x5')},'fontSize':{'type':Sequelize[_0x7bf8('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7bf8('0x7');}},'notificationSound':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bf8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7bf8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bf8('0x6')],'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[_0x7bf8('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7bf8('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x39fae4){if(!_0x39fae4)this[_0x7bf8('0x9')](_0x7bf8('0xa'),null);this[_0x7bf8('0x9')](_0x7bf8('0xb'),_0x39fae4);}},'provider':{'type':Sequelize[_0x7bf8('0xc')](_0x7bf8('0xd'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x7bf8('0xe')](_0x7bf8('0xf')))return _0x7bf8('0x10');return this[_0x7bf8('0xe')](_0x7bf8('0xf'));},'set':function(_0x1992b9){if(_0x1992b9===_0x7bf8('0x10'))_0x1992b9=null;return this[_0x7bf8('0x9')](_0x7bf8('0xf'),_0x1992b9);}}}; \ No newline at end of file +var _0x6356=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','getDataValue','provider','custom','sequelize','exports'];(function(_0x32829c,_0x375039){var _0x2a0620=function(_0xc7221a){while(--_0xc7221a){_0x32829c['push'](_0x32829c['shift']());}};_0x2a0620(++_0x375039);}(_0x6356,0x1b8));var _0x6635=function(_0x440e51,_0x4fc63a){_0x440e51=_0x440e51-0x0;var _0x9be905=_0x6356[_0x440e51];return _0x9be905;};'use strict';var Sequelize=require(_0x6635('0x0'));module[_0x6635('0x1')]={'description':{'type':Sequelize[_0x6635('0x2')]},'name':{'type':Sequelize[_0x6635('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6635('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6635('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6635('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6635('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x6635('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6635('0x4')},'fontSize':{'type':Sequelize[_0x6635('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6635('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6635('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6635('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6635('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6635('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6635('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6635('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6635('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6635('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x6635('0x3')],'defaultValue':![],'comment':_0x6635('0x8'),'set':function(_0x582579){if(!_0x582579)this[_0x6635('0x9')]('mandatoryDispositionPauseId',null);this[_0x6635('0x9')](_0x6635('0xa'),_0x582579);}},'provider':{'type':Sequelize[_0x6635('0xb')](_0x6635('0xc'),'hotmail',_0x6635('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x6635('0xe')](_0x6635('0xf')))return _0x6635('0x10');return this[_0x6635('0xe')]('provider');},'set':function(_0x5d976a){if(_0x5d976a===_0x6635('0x10'))_0x5d976a=null;return this[_0x6635('0x9')](_0x6635('0xf'),_0x5d976a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 01de129..e6ddb0e 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 _0x43e1=['userProfileId','getImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','format','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerOut','find','body','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','provider','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x126645,_0x16ede2){var _0x46968b=function(_0x39b1c0){while(--_0x39b1c0){_0x126645['push'](_0x126645['shift']());}};_0x46968b(++_0x16ede2);}(_0x43e1,0x1d2));var _0x143e=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x43e1[_0x1e6b59];return _0x40d7c5;};'use strict';var moment=require(_0x143e('0x0'));var BPromise=require(_0x143e('0x1'));var util=require('util');var path=require(_0x143e('0x2'));var _=require(_0x143e('0x3'));var juice=require('juice');var Redis=require(_0x143e('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x143e('0x5'))(_0x143e('0x6'));var config=require(_0x143e('0x7'));var db=require('../../mysqldb')['db'];config[_0x143e('0x8')]=_[_0x143e('0x9')](config[_0x143e('0x8')],{'host':_0x143e('0xa'),'port':0x18eb});var socket=require(_0x143e('0xb'))(new Redis(config['redis']));require(_0x143e('0xc'))['register'](socket);var jayson=require(_0x143e('0xd'));var client=jayson[_0x143e('0xe')][_0x143e('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x1da0ed,_0x57453b,_0x2dfe15,_0x33948f){return new BPromise(function(_0x25c308,_0x572b8a){var _0x22661d=_0x33948f||client;return _0x22661d[_0x143e('0x10')](_0x1da0ed,_0x2dfe15)[_0x143e('0x11')](function(_0x13bd1b){logger['info'](_0x143e('0x12'),_0x57453b,_0x143e('0x13'));logger[_0x143e('0x14')](_0x143e('0x15'),_0x57453b,_0x143e('0x13'),JSON[_0x143e('0x16')](_0x13bd1b));if(_0x13bd1b[_0x143e('0x17')]){if(_0x13bd1b['error'][_0x143e('0x18')]===0x1f4){logger[_0x143e('0x17')]('MailAccount,\x20%s,\x20%s',_0x57453b,_0x13bd1b[_0x143e('0x17')]['message']);return _0x572b8a(_0x13bd1b['error'][_0x143e('0x19')]);}logger[_0x143e('0x17')](_0x143e('0x12'),_0x57453b,_0x13bd1b['error'][_0x143e('0x19')]);return _0x25c308(_0x13bd1b[_0x143e('0x17')][_0x143e('0x19')]);}else{logger[_0x143e('0x1a')](_0x143e('0x12'),_0x57453b,'request\x20sent');_0x25c308(_0x13bd1b[_0x143e('0x1b')][_0x143e('0x19')]);}})[_0x143e('0x1c')](function(_0xa4df6){logger[_0x143e('0x17')]('MailAccount,\x20%s,\x20%s',_0x57453b,_0xa4df6);_0x572b8a(_0xa4df6);});});}function respondWithStatusCode(_0x1cc445,_0x565358){_0x565358=_0x565358||0xcc;return function(_0x17efe9){if(_0x17efe9){return _0x1cc445[_0x143e('0x1d')](_0x565358);}return _0x1cc445[_0x143e('0x1e')](_0x565358)[_0x143e('0x1f')]();};}function respondWithResult(_0x116dd5,_0x521ef0){_0x521ef0=_0x521ef0||0xc8;return function(_0x4eb24e){if(_0x4eb24e){return _0x116dd5[_0x143e('0x1e')](_0x521ef0)['json'](_0x4eb24e);}};}function respondWithFilteredResult(_0x34ed1b,_0x428210){return function(_0x1ce00d){if(_0x1ce00d){var _0x7ed04b=typeof _0x428210[_0x143e('0x20')]===_0x143e('0x21')&&typeof _0x428210[_0x143e('0x22')]==='undefined';var _0x2589c2=_0x1ce00d[_0x143e('0x23')];var _0x5414df=_0x7ed04b?0x0:_0x428210[_0x143e('0x20')];var _0x11ff16=_0x7ed04b?_0x1ce00d[_0x143e('0x23')]:_0x428210[_0x143e('0x20')]+_0x428210[_0x143e('0x22')];var _0x26063c;if(_0x11ff16>=_0x2589c2){_0x11ff16=_0x2589c2;_0x26063c=0xc8;}else{_0x26063c=0xce;}_0x34ed1b['status'](_0x26063c);return _0x34ed1b['set'](_0x143e('0x24'),_0x5414df+'-'+_0x11ff16+'/'+_0x2589c2)[_0x143e('0x25')](_0x1ce00d);}return null;};}function saveUpdates(_0x2d7d81){return function(_0x36ad0b){if(_0x36ad0b){return _0x36ad0b[_0x143e('0x26')](_0x2d7d81)[_0x143e('0x11')](function(_0x28534e){return _0x28534e;});}return null;};}function removeEntity(_0x5bc9e9){return function(_0x173d5d){if(_0x173d5d){return _0x173d5d['destroy']()[_0x143e('0x11')](function(){var _0x4eebe1=_0x173d5d[_0x143e('0x27')]({'plain':!![]});var _0x4582e3=_0x143e('0x28');return db[_0x143e('0x29')][_0x143e('0x2a')]({'where':{'type':_0x4582e3,'resourceId':_0x4eebe1['id']}})[_0x143e('0x11')](function(){return _0x173d5d;});})[_0x143e('0x11')](function(){_0x5bc9e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaa558){return function(_0x1fe2e6){if(!_0x1fe2e6){_0xeaa558[_0x143e('0x1d')](0x194);}return _0x1fe2e6;};}function handleError(_0x80a7f9,_0x51001f){_0x51001f=_0x51001f||0x1f4;return function(_0x499709){logger[_0x143e('0x17')](_0x499709['stack']);if(_0x499709[_0x143e('0x2b')]){delete _0x499709[_0x143e('0x2b')];}_0x80a7f9[_0x143e('0x1e')](_0x51001f)[_0x143e('0x2c')](_0x499709);};}function getImapHost(_0x5692db){switch(_0x5692db){case _0x143e('0x2d'):return'imap.gmail.com';case _0x143e('0x2e'):return _0x143e('0x2f');case _0x143e('0x30'):return _0x143e('0x31');case'outlook365':return _0x143e('0x32');}throw new Error(_0x143e('0x33'),_0x5692db);}function getSmtpHost(_0x513a45){switch(_0x513a45){case _0x143e('0x2d'):return _0x143e('0x34');case _0x143e('0x2e'):return _0x143e('0x35');case _0x143e('0x30'):return _0x143e('0x36');case _0x143e('0x37'):return _0x143e('0x38');}throw new Error(_0x143e('0x33'),_0x513a45);}function getAuthenticationOptions(_0x391f82,_0x1f58b6){var _0x1a155={};var _0x72f26e={};if(_0x391f82){_0x1a155[_0x143e('0x39')]=_0x72f26e['user']=_0x1f58b6[_0x143e('0x3a')];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=_0x1f58b6[_0x143e('0x3b')];if(_0x1f58b6['modernAuthentication']){_0x1a155[_0x143e('0x3d')]=_0x72f26e[_0x143e('0x3d')]=!![];_0x1a155[_0x143e('0x3e')]=_0x72f26e['CloudProviderId']=_0x1f58b6['CloudProviderId'];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=null;}else{_0x1a155[_0x143e('0x3e')]=_0x72f26e[_0x143e('0x3e')]=null;}_0x1a155[_0x143e('0x3f')]=getImapHost(_0x391f82);_0x1a155[_0x143e('0x40')]=0x3e1;_0x72f26e[_0x143e('0x3f')]=getSmtpHost(_0x391f82);_0x72f26e[_0x143e('0x40')]=0x24b;_0x72f26e[_0x143e('0x41')]=![];_0x1a155[_0x143e('0x42')]=_0x72f26e[_0x143e('0x42')]=null;}else{if(_0x1f58b6['authentication']){_0x1a155[_0x143e('0x39')]=_0x72f26e['user']=_0x1f58b6[_0x143e('0x3a')];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=_0x1f58b6[_0x143e('0x3b')];}else{_0x1a155[_0x143e('0x43')]=_0x72f26e[_0x143e('0x43')]=![];_0x1a155[_0x143e('0x39')]=_0x72f26e[_0x143e('0x39')]=null;_0x1a155[_0x143e('0x3b')]=_0x72f26e['pass']=null;}_0x1a155[_0x143e('0x3f')]=_0x1f58b6[_0x143e('0x44')][_0x143e('0x3f')];_0x1a155[_0x143e('0x40')]=_0x1f58b6['Imap']['port'];_0x72f26e[_0x143e('0x3f')]=_0x1f58b6[_0x143e('0x45')]['host'];_0x72f26e['port']=_0x1f58b6[_0x143e('0x45')][_0x143e('0x40')];}return{'Imap':_0x1a155,'Smtp':_0x72f26e};}exports[_0x143e('0x46')]=function(_0x583af6,_0x23c94c){var _0x326019={'include':[{'model':db[_0x143e('0x47')],'as':_0x143e('0x44')},{'model':db['MailServerOut'],'as':_0x143e('0x45')},{'model':db[_0x143e('0x48')],'as':_0x143e('0x49')}]},_0x5f2aed={},_0x3119f1={'count':0x0,'rows':[]};var _0x566de9=_[_0x143e('0x4a')](db[_0x143e('0x4b')][_0x143e('0x4c')],function(_0x52bd50){return{'name':_0x52bd50[_0x143e('0x4d')],'type':_0x52bd50[_0x143e('0x4e')][_0x143e('0x4f')]};});_0x5f2aed['model']=_[_0x143e('0x4a')](_0x566de9,'name');_0x5f2aed[_0x143e('0x50')]=_[_0x143e('0x51')](_0x583af6['query']);_0x5f2aed[_0x143e('0x52')]=_['intersection'](_0x5f2aed['model'],_0x5f2aed[_0x143e('0x50')]);_0x326019[_0x143e('0x53')]=_[_0x143e('0x54')](_0x5f2aed['model'],qs['fields'](_0x583af6[_0x143e('0x50')][_0x143e('0x55')]));_0x326019[_0x143e('0x53')]=_0x326019['attributes'][_0x143e('0x56')]?_0x326019['attributes']:_0x5f2aed[_0x143e('0x57')];if(!_0x583af6[_0x143e('0x50')]['hasOwnProperty'](_0x143e('0x58'))){_0x326019[_0x143e('0x22')]=qs['limit'](_0x583af6['query']['limit']);_0x326019['offset']=qs[_0x143e('0x20')](_0x583af6[_0x143e('0x50')][_0x143e('0x20')]);}_0x326019[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x583af6[_0x143e('0x50')][_0x143e('0x5a')]);_0x326019['where']=qs['filters'](_[_0x143e('0x5b')](_0x583af6['query'],_0x5f2aed[_0x143e('0x52')]),_0x566de9);if(_0x583af6['query'][_0x143e('0x5c')]){_0x326019[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x326019['where'],{'$or':_[_0x143e('0x4a')](_0x566de9,function(_0x120434){if(_0x120434['type']!==_0x143e('0x5f')){var _0x57a2f6={};_0x57a2f6[_0x120434[_0x143e('0x2b')]]={'$like':'%'+_0x583af6[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x57a2f6;}})});}_0x326019=_[_0x143e('0x5e')]({},_0x326019,_0x583af6[_0x143e('0x60')]);var _0x4bc059={'where':_0x326019['where']};return db[_0x143e('0x4b')][_0x143e('0x23')](_0x4bc059)[_0x143e('0x11')](function(_0x162eb7){_0x3119f1[_0x143e('0x23')]=_0x162eb7;if(_0x583af6[_0x143e('0x50')][_0x143e('0x61')]){_0x326019[_0x143e('0x62')]=[{'all':!![]}];}return db['MailAccount'][_0x143e('0x63')](_0x326019);})['then'](function(_0x2337d8){_0x3119f1[_0x143e('0x64')]=_0x2337d8;return _0x3119f1;})[_0x143e('0x11')](respondWithFilteredResult(_0x23c94c,_0x326019))[_0x143e('0x1c')](handleError(_0x23c94c,null));};exports[_0x143e('0x65')]=function(_0x3db166,_0x1536c9){var _0x1fc78e={'raw':![],'where':{'id':_0x3db166[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x47')],'as':'Imap'},{'model':db[_0x143e('0x67')],'as':_0x143e('0x45')},{'model':db[_0x143e('0x48')],'as':'mandatoryDispositionPause'}]},_0x6c1ad7={};_0x6c1ad7[_0x143e('0x57')]=_['keys'](db[_0x143e('0x4b')][_0x143e('0x4c')]);_0x6c1ad7[_0x143e('0x50')]=_[_0x143e('0x51')](_0x3db166[_0x143e('0x50')]);_0x6c1ad7[_0x143e('0x52')]=_[_0x143e('0x54')](_0x6c1ad7[_0x143e('0x57')],_0x6c1ad7[_0x143e('0x50')]);_0x1fc78e[_0x143e('0x53')]=_[_0x143e('0x54')](_0x6c1ad7['model'],qs['fields'](_0x3db166[_0x143e('0x50')][_0x143e('0x55')]));_0x1fc78e[_0x143e('0x53')]=_0x1fc78e[_0x143e('0x53')][_0x143e('0x56')]?_0x1fc78e['attributes']:_0x6c1ad7[_0x143e('0x57')];if(_0x3db166[_0x143e('0x50')]['includeAll']){_0x1fc78e[_0x143e('0x62')]=[{'all':!![]}];}_0x1fc78e=_[_0x143e('0x5e')]({},_0x1fc78e,_0x3db166[_0x143e('0x60')]);return db[_0x143e('0x4b')][_0x143e('0x68')](_0x1fc78e)['then'](handleEntityNotFound(_0x1536c9,null))[_0x143e('0x11')](respondWithResult(_0x1536c9,null))[_0x143e('0x1c')](handleError(_0x1536c9,null));};exports['update']=function(_0x300908,_0x27b953){if(_0x300908[_0x143e('0x69')]['id']){delete _0x300908['body']['id'];}var _0x24fa6e=_0x300908[_0x143e('0x69')]['provider']===_0x143e('0x6a')?null:_0x300908[_0x143e('0x69')]['provider'];var _0x4588a2=_0x300908[_0x143e('0x69')][_0x143e('0x44')]||{};var _0x41c1de=_0x300908['body'][_0x143e('0x45')]||{};if(_0x24fa6e){_0x4588a2['host']=getImapHost(_0x24fa6e);_0x4588a2[_0x143e('0x40')]=0x3e1;_0x41c1de[_0x143e('0x3f')]=getSmtpHost(_0x24fa6e);_0x41c1de[_0x143e('0x40')]=0x24b;_0x41c1de[_0x143e('0x41')]=![];}if(_0x41c1de[_0x143e('0x3d')]){_0x41c1de[_0x143e('0x41')]=![];}else{_0x41c1de['CloudProviderId']=null;}if(!_0x4588a2[_0x143e('0x3d')])_0x4588a2[_0x143e('0x3e')]=null;_0x300908[_0x143e('0x69')][_0x143e('0x44')]=_0x4588a2;_0x300908[_0x143e('0x69')][_0x143e('0x45')]=_0x41c1de;return db['MailAccount']['find']({'where':{'id':_0x300908[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x47')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x143e('0x45')},{'model':db['Pause'],'as':_0x143e('0x49')}]})['then'](handleEntityNotFound(_0x27b953,null))['then'](function(_0x404f77){if(!_0x404f77)throw new Error(_0x143e('0x6b'));if(_0x404f77['service'])delete _0x300908[_0x143e('0x69')][_0x143e('0x44')];return _0x404f77;})[_0x143e('0x11')](saveUpdates(_0x300908[_0x143e('0x69')],null))[_0x143e('0x11')](function(_0x392510){if(!_0x300908['body'][_0x143e('0x44')])return _0x392510;return db[_0x143e('0x47')]['update'](_0x300908[_0x143e('0x69')][_0x143e('0x44')],{'where':{'MailAccountId':_0x392510['id']}})['then'](function(){return _0x392510;});})[_0x143e('0x11')](function(_0x537106){if(!_0x300908['body']['Smtp'])return _0x537106;return db['MailServerOut'][_0x143e('0x26')](_0x300908[_0x143e('0x69')]['Smtp'],{'where':{'MailAccountId':_0x537106['id']}})[_0x143e('0x11')](function(){return _0x537106;});})[_0x143e('0x11')](respondWithResult(_0x27b953,null))[_0x143e('0x1c')](handleError(_0x27b953,null));};exports[_0x143e('0x6c')]=function(_0x20d9b9,_0x232b9f){return db[_0x143e('0x4b')]['describe']()[_0x143e('0x11')](respondWithResult(_0x232b9f,null))['catch'](handleError(_0x232b9f,null));};exports[_0x143e('0x6d')]=function(_0x2dec90,_0x10661b){if(_0x2dec90['body']['id']){delete _0x2dec90[_0x143e('0x69')]['id'];}return db['MailAccount'][_0x143e('0x68')]({'where':{'id':_0x2dec90[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x10661b,null))[_0x143e('0x11')](function(_0x1cda6b){if(_0x1cda6b){_0x2dec90[_0x143e('0x69')][_0x143e('0x6e')]=_0x1cda6b['id'];return db[_0x143e('0x6f')][_0x143e('0x70')](_0x2dec90[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0x10661b,null))['catch'](handleError(_0x10661b,null));};exports['getDispositions']=function(_0x23af4a,_0x48652f){var _0x5646f1={'raw':![],'where':{}};var _0x24f09b={};var _0x2fac43={'count':0x0,'rows':[]};return db[_0x143e('0x4b')]['findOne']({'where':{'id':_0x23af4a['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x48652f,null))[_0x143e('0x11')](function(_0x42bf19){if(_0x42bf19){_0x24f09b['model']=_['keys'](db[_0x143e('0x6f')][_0x143e('0x4c')]);_0x24f09b[_0x143e('0x50')]=_[_0x143e('0x51')](_0x23af4a['query']);_0x24f09b['filters']=_[_0x143e('0x54')](_0x24f09b[_0x143e('0x57')],_0x24f09b[_0x143e('0x50')]);_0x5646f1[_0x143e('0x53')]=_[_0x143e('0x54')](_0x24f09b[_0x143e('0x57')],qs[_0x143e('0x55')](_0x23af4a['query']['fields']));_0x5646f1['attributes']=_0x5646f1[_0x143e('0x53')][_0x143e('0x56')]?_0x5646f1[_0x143e('0x53')]:_0x24f09b[_0x143e('0x57')];if(!_0x23af4a['query'][_0x143e('0x71')]('nolimit')){_0x5646f1[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x23af4a[_0x143e('0x50')][_0x143e('0x22')]);_0x5646f1[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x23af4a[_0x143e('0x50')]['offset']);}_0x5646f1['order']=qs[_0x143e('0x5a')](_0x23af4a[_0x143e('0x50')][_0x143e('0x5a')]);_0x5646f1['where']=qs[_0x143e('0x52')](_['pick'](_0x23af4a[_0x143e('0x50')],_0x24f09b[_0x143e('0x52')]));_0x5646f1[_0x143e('0x5d')][_0x143e('0x6e')]=_0x42bf19['id'];if(_0x23af4a[_0x143e('0x50')]['filter']){_0x5646f1['where']=_['merge'](_0x5646f1[_0x143e('0x5d')],{'$or':_['map'](_0x5646f1[_0x143e('0x53')],function(_0x5cfb38){var _0x59566a={};_0x59566a[_0x5cfb38]={'$like':'%'+_0x23af4a[_0x143e('0x50')]['filter']+'%'};return _0x59566a;})});}_0x5646f1=_[_0x143e('0x5e')]({},_0x5646f1,_0x23af4a[_0x143e('0x60')]);return db['Disposition'][_0x143e('0x23')]({'where':_0x5646f1[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x42bb91){_0x2fac43[_0x143e('0x23')]=_0x42bb91;if(_0x23af4a['query'][_0x143e('0x61')]){_0x5646f1['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5646f1);})[_0x143e('0x11')](function(_0x2dec98){_0x2fac43[_0x143e('0x64')]=_0x2dec98;return _0x2fac43;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x48652f,_0x5646f1))['catch'](handleError(_0x48652f,null));};exports[_0x143e('0x72')]=function(_0x260ea1,_0x4f0271){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x260ea1[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x4f0271,null))['then'](function(_0x2a1bdc){if(_0x2a1bdc){return _0x2a1bdc[_0x143e('0x72')](_0x260ea1[_0x143e('0x50')]['ids']);}})[_0x143e('0x11')](respondWithStatusCode(_0x4f0271,null))['catch'](handleError(_0x4f0271,null));};exports[_0x143e('0x73')]=function(_0x1a3de2,_0xaa3e27){if(_0x1a3de2[_0x143e('0x69')]['id']){delete _0x1a3de2[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x1a3de2['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0xaa3e27,null))[_0x143e('0x11')](function(_0x3fc0b9){if(_0x3fc0b9){_0x1a3de2['body'][_0x143e('0x6e')]=_0x3fc0b9['id'];return db[_0x143e('0x74')][_0x143e('0x70')](_0x1a3de2[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0xaa3e27,null))['catch'](handleError(_0xaa3e27,null));};exports[_0x143e('0x75')]=function(_0x2edaf1,_0x5778a1){var _0x3ca830={'raw':![],'where':{}};var _0x3c3cd7={};var _0x51392b={'count':0x0,'rows':[]};return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x2edaf1[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x5778a1,null))[_0x143e('0x11')](function(_0x4cb0c1){if(_0x4cb0c1){_0x3c3cd7[_0x143e('0x57')]=_['keys'](db['CannedAnswer'][_0x143e('0x4c')]);_0x3c3cd7['query']=_[_0x143e('0x51')](_0x2edaf1[_0x143e('0x50')]);_0x3c3cd7['filters']=_[_0x143e('0x54')](_0x3c3cd7[_0x143e('0x57')],_0x3c3cd7[_0x143e('0x50')]);_0x3ca830['attributes']=_['intersection'](_0x3c3cd7[_0x143e('0x57')],qs[_0x143e('0x55')](_0x2edaf1[_0x143e('0x50')][_0x143e('0x55')]));_0x3ca830[_0x143e('0x53')]=_0x3ca830[_0x143e('0x53')]['length']?_0x3ca830[_0x143e('0x53')]:_0x3c3cd7['model'];if(!_0x2edaf1[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x3ca830['limit']=qs[_0x143e('0x22')](_0x2edaf1[_0x143e('0x50')][_0x143e('0x22')]);_0x3ca830[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x2edaf1['query'][_0x143e('0x20')]);}_0x3ca830[_0x143e('0x59')]=qs['sort'](_0x2edaf1[_0x143e('0x50')]['sort']);_0x3ca830['where']=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x2edaf1['query'],_0x3c3cd7[_0x143e('0x52')]));_0x3ca830[_0x143e('0x5d')][_0x143e('0x6e')]=_0x4cb0c1['id'];if(_0x2edaf1[_0x143e('0x50')][_0x143e('0x5c')]){_0x3ca830[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x3ca830[_0x143e('0x5d')],{'$or':_['map'](_0x3ca830[_0x143e('0x53')],function(_0x286e63){var _0x527ea6={};_0x527ea6[_0x286e63]={'$like':'%'+_0x2edaf1['query'][_0x143e('0x5c')]+'%'};return _0x527ea6;})});}_0x3ca830=_['merge']({},_0x3ca830,_0x2edaf1[_0x143e('0x60')]);return db[_0x143e('0x74')][_0x143e('0x23')]({'where':_0x3ca830['where']})[_0x143e('0x11')](function(_0x46b6a7){_0x51392b[_0x143e('0x23')]=_0x46b6a7;if(_0x2edaf1[_0x143e('0x50')][_0x143e('0x61')]){_0x3ca830[_0x143e('0x62')]=[{'all':!![]}];}return db[_0x143e('0x74')][_0x143e('0x63')](_0x3ca830);})[_0x143e('0x11')](function(_0x390bac){_0x51392b[_0x143e('0x64')]=_0x390bac;return _0x51392b;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x5778a1,_0x3ca830))[_0x143e('0x1c')](handleError(_0x5778a1,null));};exports['removeAnswers']=function(_0x5a881d,_0x3a12eb){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x5a881d[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x3a12eb,null))[_0x143e('0x11')](function(_0x5bb2e1){if(_0x5bb2e1){return _0x5bb2e1[_0x143e('0x77')](_0x5a881d[_0x143e('0x50')]['ids']);}})[_0x143e('0x11')](respondWithStatusCode(_0x3a12eb,null))['catch'](handleError(_0x3a12eb,null));};exports[_0x143e('0x70')]=function(_0x140bae,_0x2bd8a7){var _0x17e775={'name':_0x140bae[_0x143e('0x69')][_0x143e('0x2b')],'key':_0x140bae[_0x143e('0x69')][_0x143e('0x4f')],'provider':_0x140bae['body']['provider']===_0x143e('0x6a')?null:_0x140bae[_0x143e('0x69')][_0x143e('0x78')],'email':_0x140bae[_0x143e('0x69')]['email'],'ListId':_0x140bae[_0x143e('0x69')][_0x143e('0x79')],'active':!_[_0x143e('0x7a')](_0x140bae[_0x143e('0x69')]['active'])?_0x140bae[_0x143e('0x69')][_0x143e('0x7b')]:!![],'description':_0x140bae[_0x143e('0x69')][_0x143e('0x7c')]||null};var _0x283889=getAuthenticationOptions(_0x17e775[_0x143e('0x78')],_0x140bae[_0x143e('0x69')]);_0x17e775[_0x143e('0x44')]=_0x283889[_0x143e('0x44')];_0x17e775[_0x143e('0x45')]=_0x283889[_0x143e('0x45')];return db[_0x143e('0x4b')][_0x143e('0x70')](_0x17e775,{'include':[{'model':db[_0x143e('0x67')],'as':_0x143e('0x45')},{'model':db[_0x143e('0x47')],'as':'Imap'}]})['then'](function(_0x14c0d5){var _0xee57d2=_0x140bae['user']['get']({'plain':!![]});if(!_0xee57d2)throw new Error(_0x143e('0x7d'));if(_0xee57d2[_0x143e('0x7e')]===_0x143e('0x39')){var _0x8122ff=_0x14c0d5[_0x143e('0x27')]({'plain':!![]});return db[_0x143e('0x7f')][_0x143e('0x68')]({'where':{'name':_0x143e('0x28'),'userProfileId':_0xee57d2[_0x143e('0x80')]},'raw':!![]})[_0x143e('0x11')](function(_0x22a400){if(_0x22a400&&_0x22a400['autoAssociation']===0x0){return db[_0x143e('0x29')][_0x143e('0x70')]({'name':_0x8122ff[_0x143e('0x2b')],'resourceId':_0x8122ff['id'],'type':_0x22a400[_0x143e('0x2b')],'sectionId':_0x22a400['id']},{})['then'](function(){return _0x14c0d5;});}else{return _0x14c0d5;}})[_0x143e('0x1c')](function(_0x5e9389){logger[_0x143e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e9389);throw _0x5e9389;});}return _0x14c0d5;})[_0x143e('0x11')](respondWithResult(_0x2bd8a7,0xc9))[_0x143e('0x1c')](handleError(_0x2bd8a7,null));};exports[_0x143e('0x81')]=function(_0x252694,_0x196580){return db['MailAccount']['findOne']({'where':{'id':_0x252694[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x196580,null))[_0x143e('0x11')](function(_0xe229d7){if(_0xe229d7){return _0xe229d7[_0x143e('0x81')]();}return null;})['then'](respondWithResult(_0x196580,null))[_0x143e('0x1c')](handleError(_0x196580,null));};exports['addImap']=function(_0x2dcd5c,_0x5196e3){if(_0x2dcd5c[_0x143e('0x69')]['id']){delete _0x2dcd5c[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x2dcd5c[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x5196e3,null))['then'](function(_0x1e053a){if(_0x1e053a){_0x2dcd5c['body']['MailAccountId']=_0x1e053a['id'];return db[_0x143e('0x47')]['create'](_0x2dcd5c[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0x5196e3,null))[_0x143e('0x1c')](handleError(_0x5196e3,null));};exports[_0x143e('0x82')]=function(_0x24e79c,_0x583236){return db['MailAccount'][_0x143e('0x76')]({'where':{'id':_0x24e79c[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x583236,null))[_0x143e('0x11')](function(_0x37658d){if(_0x37658d){return _0x37658d[_0x143e('0x83')](null);}return null;})[_0x143e('0x11')](respondWithStatusCode(_0x583236,null))['catch'](handleError(_0x583236,null));};exports['getSmtp']=function(_0x3a607f,_0x14be75){return db['MailAccount'][_0x143e('0x76')]({'where':{'id':_0x3a607f[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x14be75,null))[_0x143e('0x11')](function(_0xf6145c){if(_0xf6145c){return _0xf6145c['getSmtp']();}return null;})['then'](respondWithResult(_0x14be75,null))[_0x143e('0x1c')](handleError(_0x14be75,null));};exports[_0x143e('0x84')]=function(_0x7aed34,_0x200ede){if(_0x7aed34[_0x143e('0x69')]['id']){delete _0x7aed34[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x7aed34[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x200ede,null))[_0x143e('0x11')](function(_0x1d62ba){if(_0x1d62ba){_0x7aed34[_0x143e('0x69')][_0x143e('0x6e')]=_0x1d62ba['id'];return db[_0x143e('0x67')][_0x143e('0x70')](_0x7aed34['body']);}})[_0x143e('0x11')](respondWithResult(_0x200ede,null))[_0x143e('0x1c')](handleError(_0x200ede,null));};exports[_0x143e('0x85')]=function(_0x3a53a9,_0x4d8345){return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x3a53a9[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x4d8345,null))[_0x143e('0x11')](function(_0x1fbec4){if(_0x1fbec4){return _0x1fbec4[_0x143e('0x86')](null);}return null;})[_0x143e('0x11')](respondWithStatusCode(_0x4d8345,null))['catch'](handleError(_0x4d8345,null));};exports[_0x143e('0x87')]=function(_0x46475f,_0x4af99a){return db[_0x143e('0x88')][_0x143e('0x68')]({'where':{'id':_0x46475f['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x4af99a,null))[_0x143e('0x11')](function(_0x2d4b53){if(_0x2d4b53){return _0x2d4b53[_0x143e('0x87')](_0x46475f['body'][_0x143e('0x89')],_[_0x143e('0x8a')](_0x46475f[_0x143e('0x69')],[_0x143e('0x89'),'id'])||{});}})['then'](respondWithResult(_0x4af99a,null))['catch'](handleError(_0x4af99a,null));};exports[_0x143e('0x8b')]=function(_0x228def,_0x43010d){var _0x5f16f5={'raw':![],'where':{}};var _0x3ba55a={};var _0x402bd5={'count':0x0,'rows':[]};return db[_0x143e('0x4b')]['findOne']({'where':{'id':_0x228def['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x43010d,null))['then'](function(_0x3bd850){if(_0x3bd850){_0x3ba55a[_0x143e('0x57')]=_['keys'](db['MailInteraction'][_0x143e('0x4c')]);_0x3ba55a['query']=_['keys'](_0x228def['query']);_0x3ba55a[_0x143e('0x52')]=_[_0x143e('0x54')](_0x3ba55a['model'],_0x3ba55a[_0x143e('0x50')]);_0x5f16f5['attributes']=_['intersection'](_0x3ba55a[_0x143e('0x57')],qs[_0x143e('0x55')](_0x228def['query'][_0x143e('0x55')]));_0x5f16f5[_0x143e('0x53')]=_0x5f16f5[_0x143e('0x53')]['length']?_0x5f16f5[_0x143e('0x53')]:_0x3ba55a[_0x143e('0x57')];if(!_0x228def[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x5f16f5[_0x143e('0x22')]=qs['limit'](_0x228def['query'][_0x143e('0x22')]);_0x5f16f5[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x228def[_0x143e('0x50')][_0x143e('0x20')]);}_0x5f16f5['order']=qs['sort'](_0x228def[_0x143e('0x50')][_0x143e('0x5a')]);_0x5f16f5[_0x143e('0x5d')]=qs['filters'](_['pick'](_0x228def[_0x143e('0x50')],_0x3ba55a['filters']));_0x5f16f5['where'][_0x143e('0x6e')]=_0x3bd850['id'];if(_0x228def[_0x143e('0x50')][_0x143e('0x5c')]){_0x5f16f5['where']=_[_0x143e('0x5e')](_0x5f16f5[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x5f16f5[_0x143e('0x53')],function(_0x5af45c){var _0x53fff9={};_0x53fff9[_0x5af45c]={'$like':'%'+_0x228def[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x53fff9;})});}_0x5f16f5=_['merge']({},_0x5f16f5,_0x228def[_0x143e('0x60')]);return db['MailInteraction'][_0x143e('0x23')]({'where':_0x5f16f5[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x11dce2){_0x402bd5[_0x143e('0x23')]=_0x11dce2;if(_0x228def[_0x143e('0x50')][_0x143e('0x61')]){_0x5f16f5[_0x143e('0x62')]=[{'model':db[_0x143e('0x8c')],'as':_0x143e('0x8d'),'required':![]},{'model':db[_0x143e('0x8e')],'as':_0x143e('0x8f'),'attributes':['name',_0x143e('0x90'),_0x143e('0x91')],'required':![]},{'model':db[_0x143e('0x92')],'as':_0x143e('0x93'),'attributes':['id',_0x143e('0x2b'),_0x143e('0x94')],'where':_0x228def[_0x143e('0x50')][_0x143e('0x95')]?{'id':_0x228def[_0x143e('0x50')][_0x143e('0x95')]}:undefined,'required':_0x228def[_0x143e('0x50')][_0x143e('0x95')]?!![]:![]}];}return db[_0x143e('0x88')][_0x143e('0x63')](_0x5f16f5);})['then'](function(_0x35fb6d){_0x402bd5['rows']=_0x35fb6d;return _0x402bd5;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x43010d,_0x5f16f5))[_0x143e('0x1c')](handleError(_0x43010d,null));};exports['addApplications']=function addApplications(_0x4002f6,_0x755441){var _0x7096b6=_0x4002f6['params']['id'];var _0x477aff=_0x4002f6['body'];var _0x251698=0xc8;var _0x9c5945=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x143e('0x96')][_0x143e('0x97')][_0x143e('0x98')]['READ_COMMITTED']},function(_0x419026){return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x7096b6},'transaction':_0x419026})[_0x143e('0x11')](function(_0x193824){if(_0x193824){return db['MailApplication'][_0x143e('0x2a')]({'where':{'MailAccountId':_0x7096b6},'transaction':_0x419026})['then'](function(){var _0x307657=_[_0x143e('0x4a')](_0x477aff,function(_0x2e9f22){_0x2e9f22['MailAccountId']=_0x7096b6;return _0x2e9f22;});return db[_0x143e('0x99')]['bulkCreate'](_0x307657,{'transaction':_0x419026});});}else{_0x251698=0x194;_0x9c5945=[];}});})[_0x143e('0x11')](function(){if(_0x251698!==0x194){return db[_0x143e('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x7096b6},'order':_0x143e('0x9a')})[_0x143e('0x11')](function(_0x51febe){_0x9c5945=_0x51febe;});}})[_0x143e('0x1c')](function(_0x164eee){_0x251698=0x1f4;logger['error'](_0x164eee[_0x143e('0x9b')]);if(_0x164eee[_0x143e('0x2b')]){delete _0x164eee['name'];}_0x9c5945=_0x164eee;})[_0x143e('0x9c')](function(){if(_0x9c5945===null){_0x755441[_0x143e('0x1d')](_0x251698);}else{if(_0x251698===0x1f4){_0x755441['status'](_0x251698)[_0x143e('0x2c')](_0x9c5945);}else{_0x755441[_0x143e('0x1e')](_0x251698)[_0x143e('0x25')](_0x9c5945);}}});};exports['getApplications']=function(_0x31ad39,_0x3c6896){var _0x34825f={};var _0x169b8b={};var _0x2b7ef9;var _0x5c9af3;return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x31ad39['params']['id']}})['then'](handleEntityNotFound(_0x3c6896,null))[_0x143e('0x11')](function(_0x4561e0){if(_0x4561e0){_0x2b7ef9=_0x4561e0;_0x169b8b[_0x143e('0x57')]=_['keys'](db[_0x143e('0x99')][_0x143e('0x4c')]);_0x169b8b[_0x143e('0x50')]=_['keys'](_0x31ad39[_0x143e('0x50')]);_0x169b8b[_0x143e('0x52')]=_[_0x143e('0x54')](_0x169b8b[_0x143e('0x57')],_0x169b8b['query']);_0x34825f['attributes']=_[_0x143e('0x54')](_0x169b8b[_0x143e('0x57')],qs[_0x143e('0x55')](_0x31ad39['query']['fields']));_0x34825f[_0x143e('0x53')]=_0x34825f[_0x143e('0x53')][_0x143e('0x56')]?_0x34825f[_0x143e('0x53')]:_0x169b8b[_0x143e('0x57')];_0x34825f[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x31ad39[_0x143e('0x50')][_0x143e('0x5a')]);_0x34825f[_0x143e('0x5d')]=qs['filters'](_[_0x143e('0x5b')](_0x31ad39[_0x143e('0x50')],_0x169b8b[_0x143e('0x52')]));if(_0x31ad39['query'][_0x143e('0x5c')]){_0x34825f[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x34825f[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x34825f[_0x143e('0x53')],function(_0x57e0c3){var _0x19d627={};_0x19d627[_0x57e0c3]={'$like':'%'+_0x31ad39['query'][_0x143e('0x5c')]+'%'};return _0x19d627;})});}_0x34825f=_['merge']({},_0x34825f,_0x31ad39[_0x143e('0x60')]);return _0x2b7ef9[_0x143e('0x9d')](_0x34825f);}})[_0x143e('0x11')](function(_0x102327){if(_0x102327){_0x5c9af3=_0x102327[_0x143e('0x56')];if(!_0x31ad39[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x34825f['limit']=qs['limit'](_0x31ad39[_0x143e('0x50')]['limit']);_0x34825f['offset']=qs[_0x143e('0x20')](_0x31ad39[_0x143e('0x50')][_0x143e('0x20')]);}return _0x2b7ef9[_0x143e('0x9d')](_0x34825f);}})[_0x143e('0x11')](function(_0x4a22f7){if(_0x4a22f7){return _0x4a22f7?{'count':_0x5c9af3,'rows':_0x4a22f7}:null;}})[_0x143e('0x11')](respondWithResult(_0x3c6896,null))[_0x143e('0x1c')](handleError(_0x3c6896,null));};exports[_0x143e('0x9e')]=function(_0x7d0f2d,_0x2e420a){var _0x3cdf76={'raw':!![],'where':{}};var _0x3734f9={};var _0x55e8d6={'count':0x0,'rows':[]};return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x7d0f2d[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x2e420a,null))['then'](function(_0x3a58f7){if(_0x3a58f7){_0x3734f9[_0x143e('0x57')]=_['keys'](db[_0x143e('0x9f')][_0x143e('0x4c')]);_0x3734f9[_0x143e('0x50')]=_[_0x143e('0x51')](_0x7d0f2d['query']);_0x3734f9[_0x143e('0x52')]=_[_0x143e('0x54')](_0x3734f9[_0x143e('0x57')],_0x3734f9[_0x143e('0x50')]);_0x3cdf76[_0x143e('0x53')]=_[_0x143e('0x54')](_0x3734f9[_0x143e('0x57')],qs[_0x143e('0x55')](_0x7d0f2d['query'][_0x143e('0x55')]));_0x3cdf76[_0x143e('0x53')]=_0x3cdf76[_0x143e('0x53')][_0x143e('0x56')]?_0x3cdf76[_0x143e('0x53')]:_0x3734f9[_0x143e('0x57')];if(!_0x7d0f2d[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x3cdf76[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x7d0f2d[_0x143e('0x50')]['limit']);_0x3cdf76[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x7d0f2d[_0x143e('0x50')]['offset']);}_0x3cdf76[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x7d0f2d['query'][_0x143e('0x5a')]);_0x3cdf76[_0x143e('0x5d')]=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x7d0f2d['query'],_0x3734f9[_0x143e('0x52')]));_0x3cdf76[_0x143e('0x5d')][_0x143e('0x6e')]=_0x3a58f7['id'];if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0x5c')]){_0x3cdf76['where']=_[_0x143e('0x5e')](_0x3cdf76['where'],{'$or':_[_0x143e('0x4a')](_0x3cdf76[_0x143e('0x53')],function(_0x4dec12){var _0x598541={};_0x598541[_0x4dec12]={'$like':'%'+_0x7d0f2d['query'][_0x143e('0x5c')]+'%'};return _0x598541;})});}if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0xa0')]){var _0x312974=_0x7d0f2d[_0x143e('0x50')]['$gte'][_0x143e('0xa1')](',');var _0x5ba558={};_0x5ba558[_0x312974[0x0]]={'$gte':moment(_0x312974[0x1])['format'](_0x143e('0xa2'))};_0x3cdf76[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x3cdf76['where'],_0x5ba558);}_0x3cdf76=_['merge']({},_0x3cdf76,_0x7d0f2d[_0x143e('0x60')]);return db['MailMessage']['count']({'where':_0x3cdf76[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x1edd87){_0x55e8d6[_0x143e('0x23')]=_0x1edd87;if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0x61')]){_0x3cdf76[_0x143e('0x62')]=[{'all':!![]}];}return db[_0x143e('0x9f')][_0x143e('0x63')](_0x3cdf76);})[_0x143e('0x11')](function(_0x8f56d8){if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0xa3')]===_0x143e('0xa4')){for(var _0x1837d2=0x0;_0x1837d2<_0x8f56d8[_0x143e('0x56')];_0x1837d2++){_0x8f56d8[_0x1837d2][_0x143e('0x69')]=juice(_0x8f56d8[_0x1837d2][_0x143e('0x69')]);}}_0x55e8d6[_0x143e('0x64')]=_0x8f56d8;return _0x55e8d6;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x2e420a,_0x3cdf76))[_0x143e('0x1c')](handleError(_0x2e420a,null));};exports['send']=function(_0x44eeee,_0x2bd7fe){var _0x150db3,_0x5779bd={},_0x2ef6e5;if(_0x44eeee[_0x143e('0x69')]['to']){_0x2ef6e5=_0x44eeee[_0x143e('0x69')]['to'][_0x143e('0xa1')](',')[0x0];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x44eeee['params']['id']},'include':[{'model':db['CmList'],'as':_0x143e('0xa5'),'include':[{'model':db[_0x143e('0x8c')],'as':_0x143e('0xa6'),'where':{'email':_0x2ef6e5},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x143e('0x45'),'raw':!![],'include':[{'model':db[_0x143e('0xa7')],'as':_0x143e('0xa7'),'raw':!![]}]}]})[_0x143e('0x11')](handleEntityNotFound(_0x2bd7fe,null))[_0x143e('0x11')](function(_0x28ee0e){if(!_0x28ee0e)return;_0x150db3=_0x28ee0e;if(!_0x28ee0e[_0x143e('0x45')])throw new Error(_0x143e('0xa8'));if(_[_0x143e('0x7a')](_0x44eeee['body']['from'])){_0x44eeee[_0x143e('0x69')][_0x143e('0xa9')]=util['format'](_0x143e('0xaa'),_0x28ee0e[_0x143e('0x2b')],_0x28ee0e[_0x143e('0xab')]||_0x28ee0e[_0x143e('0x45')][_0x143e('0x39')]);}if(_0x44eeee['body']['attachments']&&_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x143e('0x56')]){for(var _0x91703d=0x0;_0x91703d<_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x143e('0x56')];_0x91703d+=0x1){_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x91703d]={'filename':_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x91703d][_0x143e('0x2b')],'path':path[_0x143e('0xad')](config[_0x143e('0xae')],_0x143e('0xaf'),_0x44eeee[_0x143e('0x69')]['attachments'][_0x91703d][_0x143e('0xb0')])};}}var _0x454141=_0x28ee0e[_0x143e('0xb1')]();return respondWithRpcPromise(_0x143e('0xb2'),_0x143e('0xb3'),{'account':_0x454141,'message':_0x44eeee[_0x143e('0x69')]});})['then'](function(_0x5bceb9){if(!_0x5bceb9)return;_0x5779bd=_0x5bceb9;if(!_0x150db3[_0x143e('0xa5')])throw new Error(_0x143e('0xb4'));if(_0x150db3[_0x143e('0xa5')]['Contacts'][_0x143e('0x56')])return _0x150db3['List'][_0x143e('0xa6')][0x0];return db[_0x143e('0x8c')][_0x143e('0x70')](_['defaults'](_0x44eeee[_0x143e('0x69')],{'firstName':_0x44eeee[_0x143e('0x69')]['to'],'email':_0x44eeee[_0x143e('0x69')]['to'],'phone':_0x44eeee[_0x143e('0x69')]['to'],'ListId':_0x150db3['ListId']}));})[_0x143e('0x11')](function(_0x176615){if(!_0x176615)return;var _0x574a12={'UserId':_0x44eeee[_0x143e('0x39')]['id'],'ContactId':_0x176615['id'],'MailAccountId':_0x150db3['id'],'inReplyTo':_0x5779bd[_0x143e('0xb5')],'to':_0x44eeee[_0x143e('0x69')][_0x143e('0xa9')],'cc':_0x44eeee[_0x143e('0x69')]['cc'],'subject':_0x44eeee[_0x143e('0x69')][_0x143e('0xb6')],'attach':_0x44eeee[_0x143e('0x69')]['attach'],'firstMsgDirection':_0x143e('0xb7'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x143e('0xb7'),'Messages':[_[_0x143e('0x5e')](_0x44eeee[_0x143e('0x69')],{'messageId':_0x5779bd[_0x143e('0xb5')],'sentAt':moment()[_0x143e('0xb8')](_0x143e('0xa2')),'read':!![],'MailAccountId':_0x150db3['id'],'UserId':_0x44eeee['user']['id'],'ContactId':_0x176615['id']})]};if(_0x44eeee[_0x143e('0x69')][_0x143e('0xb9')]){_0x574a12=_[_0x143e('0x5e')](_0x574a12,_0x44eeee[_0x143e('0x69')][_0x143e('0xb9')]);}return db[_0x143e('0x88')][_0x143e('0x70')](_0x574a12,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})['then'](respondWithResult(_0x2bd7fe,null))['catch'](handleError(_0x2bd7fe,null));};exports[_0x143e('0xba')]=function(_0x1787ca,_0x495c62){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x1787ca[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x67')],'as':_0x143e('0x45'),'raw':!![],'include':[{'model':db[_0x143e('0xa7')],'as':_0x143e('0xa7'),'raw':!![]}]}]})[_0x143e('0x11')](handleEntityNotFound(_0x495c62,null))['then'](function(_0x1f410d){if(!_0x1f410d['Smtp'])return;var _0x45e803=_0x1f410d['getSmtpOptions']();return respondWithRpcPromise(_0x143e('0xbb'),_0x143e('0xba'),{'account':_0x45e803});})[_0x143e('0x11')](respondWithResult(_0x495c62,null))[_0x143e('0x1c')](handleError(_0x495c62,null));};exports[_0x143e('0x2a')]=function(_0x25f091,_0xfa1ecf){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x25f091['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0xfa1ecf,null))['then'](function(_0x17e7ae){if(_0x17e7ae&&_0x17e7ae[_0x143e('0x42')]){throw new db[(_0x143e('0xbc'))][(_0x143e('0xbd'))](_0x143e('0xbe'));}return _0x17e7ae;})[_0x143e('0x11')](removeEntity(_0xfa1ecf,null))[_0x143e('0x1c')](handleError(_0xfa1ecf,null));};exports[_0x143e('0xbf')]=function(_0xf6d854,_0x9d966){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0xf6d854['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x9d966,null))['then'](function(_0x344715){if(_0x344715){return _0x344715[_0x143e('0xbf')](_0xf6d854[_0x143e('0x69')][_0x143e('0x89')],_[_0x143e('0x8a')](_0xf6d854[_0x143e('0x69')],[_0x143e('0x89'),'id'])||{})[_0x143e('0xc0')](function(_0x2ded3f){for(var _0x5bd6a4=0x0;_0x5bd6a4<_0xf6d854['body'][_0x143e('0x89')]['length'];_0x5bd6a4+=0x1){socket[_0x143e('0xc1')](_0x143e('0xc2'),{'UserId':Number(_0xf6d854[_0x143e('0x69')][_0x143e('0x89')][_0x5bd6a4]),'MailAccountId':Number(_0xf6d854[_0x143e('0x66')]['id'])});}return _0x2ded3f;});}})[_0x143e('0x11')](respondWithResult(_0x9d966,null))[_0x143e('0x1c')](handleError(_0x9d966,null));};exports[_0x143e('0xc3')]=function(_0xa25195,_0x5b8c0f){return db['MailAccount'][_0x143e('0x68')]({'where':{'id':_0xa25195[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x5b8c0f,null))[_0x143e('0x11')](function(_0x42b8de){if(_0x42b8de){return _0x42b8de[_0x143e('0xc3')](_0xa25195['query'][_0x143e('0x89')])[_0x143e('0x11')](function(){if(_['isArray'](_0xa25195[_0x143e('0x50')][_0x143e('0x89')])){for(var _0x501db9=0x0;_0x501db9<_0xa25195['query'][_0x143e('0x89')]['length'];_0x501db9+=0x1){socket[_0x143e('0xc1')](_0x143e('0xc4'),{'UserId':Number(_0xa25195[_0x143e('0x50')]['ids'][_0x501db9]),'MailAccountId':Number(_0xa25195[_0x143e('0x66')]['id'])});}}else{socket[_0x143e('0xc1')](_0x143e('0xc4'),{'UserId':Number(_0xa25195['query'][_0x143e('0x89')]),'MailAccountId':Number(_0xa25195[_0x143e('0x66')]['id'])});}});}})[_0x143e('0x11')](respondWithStatusCode(_0x5b8c0f,null))[_0x143e('0x1c')](handleError(_0x5b8c0f,null));};exports[_0x143e('0xc5')]=function(_0x5d838f,_0x2f5850){var _0x1a4a32={};var _0x434f74={};var _0x1cef71;var _0x363bc8;return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x5d838f[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x2f5850,null))[_0x143e('0x11')](function(_0xf02a68){if(_0xf02a68){_0x1cef71=_0xf02a68;_0x434f74['model']=_[_0x143e('0x51')](db[_0x143e('0x8e')][_0x143e('0x4c')]);_0x434f74[_0x143e('0x50')]=_['keys'](_0x5d838f[_0x143e('0x50')]);_0x434f74[_0x143e('0x52')]=_[_0x143e('0x54')](_0x434f74['model'],_0x434f74['query']);_0x1a4a32['attributes']=_[_0x143e('0x54')](_0x434f74[_0x143e('0x57')],qs['fields'](_0x5d838f[_0x143e('0x50')]['fields']));_0x1a4a32[_0x143e('0x53')]=_0x1a4a32[_0x143e('0x53')][_0x143e('0x56')]?_0x1a4a32['attributes']:_0x434f74[_0x143e('0x57')];_0x1a4a32[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x5d838f[_0x143e('0x50')][_0x143e('0x5a')]);_0x1a4a32[_0x143e('0x5d')]=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x5d838f[_0x143e('0x50')],_0x434f74[_0x143e('0x52')]));if(_0x5d838f[_0x143e('0x50')][_0x143e('0x5c')]){_0x1a4a32[_0x143e('0x5d')]=_['merge'](_0x1a4a32[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x1a4a32[_0x143e('0x53')],function(_0x56fb09){var _0x57fa59={};_0x57fa59[_0x56fb09]={'$like':'%'+_0x5d838f[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x57fa59;})});}_0x1a4a32=_[_0x143e('0x5e')]({},_0x1a4a32,_0x5d838f[_0x143e('0x60')]);return _0x1cef71[_0x143e('0xc5')](_0x1a4a32);}})[_0x143e('0x11')](function(_0x5efd29){if(_0x5efd29){_0x363bc8=_0x5efd29[_0x143e('0x56')];if(!_0x5d838f[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x1a4a32[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x5d838f['query'][_0x143e('0x22')]);_0x1a4a32[_0x143e('0x20')]=qs['offset'](_0x5d838f[_0x143e('0x50')][_0x143e('0x20')]);}return _0x1cef71[_0x143e('0xc5')](_0x1a4a32);}})[_0x143e('0x11')](function(_0x3a9df5){if(_0x3a9df5){return _0x3a9df5?{'count':_0x363bc8,'rows':_0x3a9df5}:null;}})[_0x143e('0x11')](respondWithResult(_0x2f5850,null))[_0x143e('0x1c')](handleError(_0x2f5850,null));}; \ No newline at end of file +var _0x6570=['YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','getAgents','User','moment','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','offset','count','set','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailAccount','findAll','rows','show','params','includeAll','include','options','find','update','body','provider','custom','secure','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','fullname','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','format'];(function(_0x3def8a,_0x4001c3){var _0x5470c2=function(_0x3dc9bc){while(--_0x3dc9bc){_0x3def8a['push'](_0x3def8a['shift']());}};_0x5470c2(++_0x4001c3);}(_0x6570,0x1a3));var _0x0657=function(_0x44447a,_0x4eb0be){_0x44447a=_0x44447a-0x0;var _0xcc8749=_0x6570[_0x44447a];return _0xcc8749;};'use strict';var moment=require(_0x0657('0x0'));var BPromise=require(_0x0657('0x1'));var util=require(_0x0657('0x2'));var path=require('path');var _=require(_0x0657('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x0657('0x4'));var logger=require(_0x0657('0x5'))(_0x0657('0x6'));var config=require(_0x0657('0x7'));var db=require(_0x0657('0x8'))['db'];config[_0x0657('0x9')]=_[_0x0657('0xa')](config[_0x0657('0x9')],{'host':_0x0657('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0657('0xc'))[_0x0657('0xd')](socket);var jayson=require(_0x0657('0xe'));var client=jayson[_0x0657('0xf')][_0x0657('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x503fa5,_0xd92091,_0x68f071,_0x293299){return new BPromise(function(_0x415a78,_0x606221){var _0x463429=_0x293299||client;return _0x463429[_0x0657('0x11')](_0x503fa5,_0x68f071)[_0x0657('0x12')](function(_0x23a267){logger[_0x0657('0x13')](_0x0657('0x14'),_0xd92091,_0x0657('0x15'));logger[_0x0657('0x16')](_0x0657('0x17'),_0xd92091,_0x0657('0x15'),JSON['stringify'](_0x23a267));if(_0x23a267['error']){if(_0x23a267[_0x0657('0x18')][_0x0657('0x19')]===0x1f4){logger[_0x0657('0x18')](_0x0657('0x14'),_0xd92091,_0x23a267['error']['message']);return _0x606221(_0x23a267[_0x0657('0x18')][_0x0657('0x1a')]);}logger['error'](_0x0657('0x14'),_0xd92091,_0x23a267['error'][_0x0657('0x1a')]);return _0x415a78(_0x23a267[_0x0657('0x18')][_0x0657('0x1a')]);}else{logger[_0x0657('0x13')](_0x0657('0x14'),_0xd92091,'request\x20sent');_0x415a78(_0x23a267[_0x0657('0x1b')]['message']);}})[_0x0657('0x1c')](function(_0x5ba57a){logger[_0x0657('0x18')](_0x0657('0x14'),_0xd92091,_0x5ba57a);_0x606221(_0x5ba57a);});});}function respondWithStatusCode(_0x53266d,_0x841fc6){_0x841fc6=_0x841fc6||0xcc;return function(_0x424917){if(_0x424917){return _0x53266d[_0x0657('0x1d')](_0x841fc6);}return _0x53266d[_0x0657('0x1e')](_0x841fc6)[_0x0657('0x1f')]();};}function respondWithResult(_0x22227c,_0x4d2dbb){_0x4d2dbb=_0x4d2dbb||0xc8;return function(_0xc74cc1){if(_0xc74cc1){return _0x22227c[_0x0657('0x1e')](_0x4d2dbb)[_0x0657('0x20')](_0xc74cc1);}};}function respondWithFilteredResult(_0xdafca8,_0x17fd21){return function(_0x19218a){if(_0x19218a){var _0x628cb2=typeof _0x17fd21['offset']==='undefined'&&typeof _0x17fd21[_0x0657('0x21')]==='undefined';var _0x244f06=_0x19218a['count'];var _0x4663c6=_0x628cb2?0x0:_0x17fd21[_0x0657('0x22')];var _0x397464=_0x628cb2?_0x19218a[_0x0657('0x23')]:_0x17fd21[_0x0657('0x22')]+_0x17fd21[_0x0657('0x21')];var _0x5e75a6;if(_0x397464>=_0x244f06){_0x397464=_0x244f06;_0x5e75a6=0xc8;}else{_0x5e75a6=0xce;}_0xdafca8[_0x0657('0x1e')](_0x5e75a6);return _0xdafca8[_0x0657('0x24')]('Content-Range',_0x4663c6+'-'+_0x397464+'/'+_0x244f06)['json'](_0x19218a);}return null;};}function saveUpdates(_0x26675f){return function(_0x39890f){if(_0x39890f){return _0x39890f['update'](_0x26675f)[_0x0657('0x12')](function(_0x1efa17){return _0x1efa17;});}return null;};}function removeEntity(_0x3babeb){return function(_0x5e653f){if(_0x5e653f){return _0x5e653f['destroy']()[_0x0657('0x12')](function(){var _0x3e7625=_0x5e653f[_0x0657('0x25')]({'plain':!![]});var _0x427ab6=_0x0657('0x26');return db[_0x0657('0x27')][_0x0657('0x28')]({'where':{'type':_0x427ab6,'resourceId':_0x3e7625['id']}})['then'](function(){return _0x5e653f;});})[_0x0657('0x12')](function(){_0x3babeb[_0x0657('0x1e')](0xcc)[_0x0657('0x1f')]();});}};}function handleEntityNotFound(_0xa77104){return function(_0x3e9fd8){if(!_0x3e9fd8){_0xa77104[_0x0657('0x1d')](0x194);}return _0x3e9fd8;};}function handleError(_0x57f89d,_0x1298ff){_0x1298ff=_0x1298ff||0x1f4;return function(_0x5abe2e){logger[_0x0657('0x18')](_0x5abe2e[_0x0657('0x29')]);if(_0x5abe2e[_0x0657('0x2a')]){delete _0x5abe2e['name'];}_0x57f89d[_0x0657('0x1e')](_0x1298ff)[_0x0657('0x2b')](_0x5abe2e);};}function getImapHost(_0x281551){switch(_0x281551){case _0x0657('0x2c'):return _0x0657('0x2d');case _0x0657('0x2e'):return'imap.mail.yahoo.com';case'hotmail':return _0x0657('0x2f');case'outlook365':return'outlook.office365.com';}throw new Error(_0x0657('0x30'),_0x281551);}function getSmtpHost(_0x53edc8){switch(_0x53edc8){case _0x0657('0x2c'):return'smtp.gmail.com';case'yahoo':return'smtp.mail.yahoo.com';case'hotmail':return _0x0657('0x31');case _0x0657('0x32'):return _0x0657('0x33');}throw new Error(_0x0657('0x30'),_0x53edc8);}function getAuthenticationOptions(_0x2984e7,_0x5d9236){var _0x1fc19c={};var _0x22f8ae={};if(_0x2984e7){_0x1fc19c[_0x0657('0x34')]=_0x22f8ae[_0x0657('0x34')]=_0x5d9236[_0x0657('0x35')];_0x1fc19c[_0x0657('0x36')]=_0x22f8ae[_0x0657('0x37')]=_0x5d9236[_0x0657('0x36')];if(_0x5d9236['modernAuthentication']){_0x1fc19c[_0x0657('0x38')]=_0x22f8ae[_0x0657('0x38')]=!![];_0x1fc19c[_0x0657('0x39')]=_0x22f8ae[_0x0657('0x39')]=_0x5d9236['CloudProviderId'];_0x1fc19c[_0x0657('0x36')]=_0x22f8ae[_0x0657('0x37')]=null;}else{_0x1fc19c['CloudProviderId']=_0x22f8ae['CloudProviderId']=null;}_0x1fc19c[_0x0657('0x3a')]=getImapHost(_0x2984e7);_0x1fc19c['port']=0x3e1;_0x22f8ae[_0x0657('0x3a')]=getSmtpHost(_0x2984e7);_0x22f8ae[_0x0657('0x3b')]=0x24b;_0x22f8ae['secure']=![];_0x1fc19c[_0x0657('0x3c')]=_0x22f8ae['service']=null;}else{if(_0x5d9236['authentication']){_0x1fc19c[_0x0657('0x34')]=_0x22f8ae[_0x0657('0x34')]=_0x5d9236[_0x0657('0x35')];_0x1fc19c[_0x0657('0x36')]=_0x22f8ae[_0x0657('0x37')]=_0x5d9236[_0x0657('0x36')];}else{_0x1fc19c[_0x0657('0x3d')]=_0x22f8ae[_0x0657('0x3d')]=![];_0x1fc19c['user']=_0x22f8ae[_0x0657('0x34')]=null;_0x1fc19c[_0x0657('0x36')]=_0x22f8ae[_0x0657('0x37')]=null;}_0x1fc19c[_0x0657('0x3a')]=_0x5d9236['Imap'][_0x0657('0x3a')];_0x1fc19c['port']=_0x5d9236[_0x0657('0x3e')][_0x0657('0x3b')];_0x22f8ae[_0x0657('0x3a')]=_0x5d9236[_0x0657('0x3f')]['host'];_0x22f8ae['port']=_0x5d9236['Smtp'][_0x0657('0x3b')];}return{'Imap':_0x1fc19c,'Smtp':_0x22f8ae};}exports[_0x0657('0x40')]=function(_0x4a2493,_0x2aaa6f){var _0x226d51={'include':[{'model':db[_0x0657('0x41')],'as':_0x0657('0x3e')},{'model':db[_0x0657('0x42')],'as':'Smtp'},{'model':db[_0x0657('0x43')],'as':'mandatoryDispositionPause'}]},_0x4da9d8={},_0x2f73bd={'count':0x0,'rows':[]};var _0x50532c=_[_0x0657('0x44')](db['MailAccount'][_0x0657('0x45')],function(_0x48d486){return{'name':_0x48d486['fieldName'],'type':_0x48d486[_0x0657('0x46')][_0x0657('0x47')]};});_0x4da9d8[_0x0657('0x48')]=_[_0x0657('0x44')](_0x50532c,'name');_0x4da9d8[_0x0657('0x49')]=_[_0x0657('0x4a')](_0x4a2493[_0x0657('0x49')]);_0x4da9d8[_0x0657('0x4b')]=_[_0x0657('0x4c')](_0x4da9d8[_0x0657('0x48')],_0x4da9d8[_0x0657('0x49')]);_0x226d51['attributes']=_[_0x0657('0x4c')](_0x4da9d8[_0x0657('0x48')],qs['fields'](_0x4a2493[_0x0657('0x49')][_0x0657('0x4d')]));_0x226d51[_0x0657('0x4e')]=_0x226d51[_0x0657('0x4e')][_0x0657('0x4f')]?_0x226d51[_0x0657('0x4e')]:_0x4da9d8['model'];if(!_0x4a2493[_0x0657('0x49')][_0x0657('0x50')](_0x0657('0x51'))){_0x226d51[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x4a2493[_0x0657('0x49')][_0x0657('0x21')]);_0x226d51[_0x0657('0x22')]=qs[_0x0657('0x22')](_0x4a2493[_0x0657('0x49')]['offset']);}_0x226d51[_0x0657('0x52')]=qs[_0x0657('0x53')](_0x4a2493[_0x0657('0x49')]['sort']);_0x226d51[_0x0657('0x54')]=qs['filters'](_[_0x0657('0x55')](_0x4a2493[_0x0657('0x49')],_0x4da9d8[_0x0657('0x4b')]),_0x50532c);if(_0x4a2493['query'][_0x0657('0x56')]){_0x226d51[_0x0657('0x54')]=_[_0x0657('0x57')](_0x226d51['where'],{'$or':_['map'](_0x50532c,function(_0x5ad4f4){if(_0x5ad4f4[_0x0657('0x46')]!=='VIRTUAL'){var _0x44a18f={};_0x44a18f[_0x5ad4f4[_0x0657('0x2a')]]={'$like':'%'+_0x4a2493['query'][_0x0657('0x56')]+'%'};return _0x44a18f;}})});}_0x226d51=_[_0x0657('0x57')]({},_0x226d51,_0x4a2493['options']);var _0x41c988={'where':_0x226d51[_0x0657('0x54')]};return db[_0x0657('0x58')][_0x0657('0x23')](_0x41c988)[_0x0657('0x12')](function(_0x24d295){_0x2f73bd['count']=_0x24d295;if(_0x4a2493[_0x0657('0x49')]['includeAll']){_0x226d51['include']=[{'all':!![]}];}return db['MailAccount'][_0x0657('0x59')](_0x226d51);})[_0x0657('0x12')](function(_0x307825){_0x2f73bd[_0x0657('0x5a')]=_0x307825;return _0x2f73bd;})[_0x0657('0x12')](respondWithFilteredResult(_0x2aaa6f,_0x226d51))[_0x0657('0x1c')](handleError(_0x2aaa6f,null));};exports[_0x0657('0x5b')]=function(_0x33139e,_0x247d47){var _0x4be80f={'raw':![],'where':{'id':_0x33139e[_0x0657('0x5c')]['id']},'include':[{'model':db[_0x0657('0x41')],'as':_0x0657('0x3e')},{'model':db[_0x0657('0x42')],'as':_0x0657('0x3f')},{'model':db[_0x0657('0x43')],'as':'mandatoryDispositionPause'}]},_0x436643={};_0x436643['model']=_[_0x0657('0x4a')](db[_0x0657('0x58')][_0x0657('0x45')]);_0x436643['query']=_[_0x0657('0x4a')](_0x33139e[_0x0657('0x49')]);_0x436643[_0x0657('0x4b')]=_[_0x0657('0x4c')](_0x436643['model'],_0x436643['query']);_0x4be80f[_0x0657('0x4e')]=_[_0x0657('0x4c')](_0x436643[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x33139e['query'][_0x0657('0x4d')]));_0x4be80f[_0x0657('0x4e')]=_0x4be80f[_0x0657('0x4e')][_0x0657('0x4f')]?_0x4be80f['attributes']:_0x436643[_0x0657('0x48')];if(_0x33139e[_0x0657('0x49')][_0x0657('0x5d')]){_0x4be80f[_0x0657('0x5e')]=[{'all':!![]}];}_0x4be80f=_[_0x0657('0x57')]({},_0x4be80f,_0x33139e[_0x0657('0x5f')]);return db[_0x0657('0x58')][_0x0657('0x60')](_0x4be80f)[_0x0657('0x12')](handleEntityNotFound(_0x247d47,null))['then'](respondWithResult(_0x247d47,null))[_0x0657('0x1c')](handleError(_0x247d47,null));};exports[_0x0657('0x61')]=function(_0x1d1874,_0x1e2044){if(_0x1d1874[_0x0657('0x62')]['id']){delete _0x1d1874[_0x0657('0x62')]['id'];}var _0x12a554=_0x1d1874[_0x0657('0x62')][_0x0657('0x63')]===_0x0657('0x64')?null:_0x1d1874[_0x0657('0x62')][_0x0657('0x63')];var _0x2eeb66=_0x1d1874[_0x0657('0x62')][_0x0657('0x3e')]||{};var _0x25d494=_0x1d1874[_0x0657('0x62')][_0x0657('0x3f')]||{};if(_0x12a554){_0x2eeb66[_0x0657('0x3a')]=getImapHost(_0x12a554);_0x2eeb66[_0x0657('0x3b')]=0x3e1;_0x25d494[_0x0657('0x3a')]=getSmtpHost(_0x12a554);_0x25d494[_0x0657('0x3b')]=0x24b;_0x25d494[_0x0657('0x65')]=![];}if(_0x25d494[_0x0657('0x38')]){_0x25d494[_0x0657('0x65')]=![];}else{_0x25d494[_0x0657('0x39')]=null;}if(!_0x2eeb66[_0x0657('0x38')])_0x2eeb66[_0x0657('0x39')]=null;_0x1d1874['body'][_0x0657('0x3e')]=_0x2eeb66;_0x1d1874[_0x0657('0x62')][_0x0657('0x3f')]=_0x25d494;return db[_0x0657('0x58')]['find']({'where':{'id':_0x1d1874[_0x0657('0x5c')]['id']},'include':[{'model':db[_0x0657('0x41')],'as':_0x0657('0x3e')},{'model':db[_0x0657('0x42')],'as':_0x0657('0x3f')},{'model':db[_0x0657('0x43')],'as':_0x0657('0x66')}]})[_0x0657('0x12')](handleEntityNotFound(_0x1e2044,null))[_0x0657('0x12')](function(_0xafe12f){if(!_0xafe12f)throw new Error(_0x0657('0x67'));if(_0xafe12f['service'])delete _0x1d1874[_0x0657('0x62')][_0x0657('0x3e')];return _0xafe12f;})[_0x0657('0x12')](saveUpdates(_0x1d1874[_0x0657('0x62')],null))[_0x0657('0x12')](function(_0x2ba47e){if(!_0x1d1874[_0x0657('0x62')][_0x0657('0x3e')])return _0x2ba47e;return db['MailServerIn']['update'](_0x1d1874[_0x0657('0x62')][_0x0657('0x3e')],{'where':{'MailAccountId':_0x2ba47e['id']}})[_0x0657('0x12')](function(){return _0x2ba47e;});})['then'](function(_0x83e9d3){if(!_0x1d1874[_0x0657('0x62')][_0x0657('0x3f')])return _0x83e9d3;return db[_0x0657('0x42')][_0x0657('0x61')](_0x1d1874[_0x0657('0x62')][_0x0657('0x3f')],{'where':{'MailAccountId':_0x83e9d3['id']}})[_0x0657('0x12')](function(){return _0x83e9d3;});})['then'](respondWithResult(_0x1e2044,null))[_0x0657('0x1c')](handleError(_0x1e2044,null));};exports[_0x0657('0x68')]=function(_0x510104,_0x343e92){return db['MailAccount']['describe']()[_0x0657('0x12')](respondWithResult(_0x343e92,null))[_0x0657('0x1c')](handleError(_0x343e92,null));};exports[_0x0657('0x69')]=function(_0x5e57d6,_0xb50998){if(_0x5e57d6[_0x0657('0x62')]['id']){delete _0x5e57d6['body']['id'];}return db[_0x0657('0x58')]['find']({'where':{'id':_0x5e57d6[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0xb50998,null))['then'](function(_0x787971){if(_0x787971){_0x5e57d6[_0x0657('0x62')][_0x0657('0x6a')]=_0x787971['id'];return db[_0x0657('0x6b')]['create'](_0x5e57d6[_0x0657('0x62')]);}})[_0x0657('0x12')](respondWithResult(_0xb50998,null))['catch'](handleError(_0xb50998,null));};exports[_0x0657('0x6c')]=function(_0x4386eb,_0x2f27e8){var _0x1371f7={'raw':![],'where':{}};var _0x45a42f={};var _0x226398={'count':0x0,'rows':[]};return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x4386eb['params']['id']}})['then'](handleEntityNotFound(_0x2f27e8,null))['then'](function(_0x345e21){if(_0x345e21){_0x45a42f['model']=_[_0x0657('0x4a')](db[_0x0657('0x6b')]['rawAttributes']);_0x45a42f[_0x0657('0x49')]=_[_0x0657('0x4a')](_0x4386eb[_0x0657('0x49')]);_0x45a42f[_0x0657('0x4b')]=_[_0x0657('0x4c')](_0x45a42f[_0x0657('0x48')],_0x45a42f[_0x0657('0x49')]);_0x1371f7[_0x0657('0x4e')]=_[_0x0657('0x4c')](_0x45a42f[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x4386eb[_0x0657('0x49')][_0x0657('0x4d')]));_0x1371f7[_0x0657('0x4e')]=_0x1371f7[_0x0657('0x4e')][_0x0657('0x4f')]?_0x1371f7[_0x0657('0x4e')]:_0x45a42f[_0x0657('0x48')];if(!_0x4386eb[_0x0657('0x49')][_0x0657('0x50')](_0x0657('0x51'))){_0x1371f7['limit']=qs['limit'](_0x4386eb[_0x0657('0x49')][_0x0657('0x21')]);_0x1371f7[_0x0657('0x22')]=qs[_0x0657('0x22')](_0x4386eb[_0x0657('0x49')][_0x0657('0x22')]);}_0x1371f7[_0x0657('0x52')]=qs[_0x0657('0x53')](_0x4386eb[_0x0657('0x49')][_0x0657('0x53')]);_0x1371f7[_0x0657('0x54')]=qs[_0x0657('0x4b')](_['pick'](_0x4386eb[_0x0657('0x49')],_0x45a42f[_0x0657('0x4b')]));_0x1371f7[_0x0657('0x54')]['MailAccountId']=_0x345e21['id'];if(_0x4386eb[_0x0657('0x49')][_0x0657('0x56')]){_0x1371f7[_0x0657('0x54')]=_[_0x0657('0x57')](_0x1371f7[_0x0657('0x54')],{'$or':_[_0x0657('0x44')](_0x1371f7[_0x0657('0x4e')],function(_0x38d05b){var _0x1a7ca8={};_0x1a7ca8[_0x38d05b]={'$like':'%'+_0x4386eb[_0x0657('0x49')][_0x0657('0x56')]+'%'};return _0x1a7ca8;})});}_0x1371f7=_['merge']({},_0x1371f7,_0x4386eb[_0x0657('0x5f')]);return db[_0x0657('0x6b')][_0x0657('0x23')]({'where':_0x1371f7[_0x0657('0x54')]})[_0x0657('0x12')](function(_0x1a343b){_0x226398[_0x0657('0x23')]=_0x1a343b;if(_0x4386eb[_0x0657('0x49')][_0x0657('0x5d')]){_0x1371f7[_0x0657('0x5e')]=[{'all':!![]}];}return db[_0x0657('0x6b')][_0x0657('0x59')](_0x1371f7);})[_0x0657('0x12')](function(_0x1acff2){_0x226398[_0x0657('0x5a')]=_0x1acff2;return _0x226398;});}})['then'](respondWithFilteredResult(_0x2f27e8,_0x1371f7))[_0x0657('0x1c')](handleError(_0x2f27e8,null));};exports[_0x0657('0x6e')]=function(_0x36a8b3,_0x51937d){return db[_0x0657('0x58')]['find']({'where':{'id':_0x36a8b3['params']['id']}})['then'](handleEntityNotFound(_0x51937d,null))[_0x0657('0x12')](function(_0x5049d7){if(_0x5049d7){return _0x5049d7[_0x0657('0x6e')](_0x36a8b3[_0x0657('0x49')][_0x0657('0x6f')]);}})['then'](respondWithStatusCode(_0x51937d,null))[_0x0657('0x1c')](handleError(_0x51937d,null));};exports[_0x0657('0x70')]=function(_0x1fae74,_0x468500){if(_0x1fae74[_0x0657('0x62')]['id']){delete _0x1fae74[_0x0657('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x1fae74[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x468500,null))[_0x0657('0x12')](function(_0x1479f0){if(_0x1479f0){_0x1fae74[_0x0657('0x62')][_0x0657('0x6a')]=_0x1479f0['id'];return db[_0x0657('0x71')]['create'](_0x1fae74['body']);}})[_0x0657('0x12')](respondWithResult(_0x468500,null))['catch'](handleError(_0x468500,null));};exports[_0x0657('0x72')]=function(_0x4a337,_0x3d116b){var _0x2ca00f={'raw':![],'where':{}};var _0x4a16aa={};var _0x17fbb1={'count':0x0,'rows':[]};return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x4a337[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x3d116b,null))[_0x0657('0x12')](function(_0x3f2335){if(_0x3f2335){_0x4a16aa[_0x0657('0x48')]=_[_0x0657('0x4a')](db[_0x0657('0x71')]['rawAttributes']);_0x4a16aa[_0x0657('0x49')]=_[_0x0657('0x4a')](_0x4a337['query']);_0x4a16aa[_0x0657('0x4b')]=_['intersection'](_0x4a16aa[_0x0657('0x48')],_0x4a16aa[_0x0657('0x49')]);_0x2ca00f['attributes']=_[_0x0657('0x4c')](_0x4a16aa[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x4a337[_0x0657('0x49')]['fields']));_0x2ca00f[_0x0657('0x4e')]=_0x2ca00f[_0x0657('0x4e')][_0x0657('0x4f')]?_0x2ca00f[_0x0657('0x4e')]:_0x4a16aa[_0x0657('0x48')];if(!_0x4a337[_0x0657('0x49')][_0x0657('0x50')](_0x0657('0x51'))){_0x2ca00f[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x4a337[_0x0657('0x49')]['limit']);_0x2ca00f['offset']=qs[_0x0657('0x22')](_0x4a337[_0x0657('0x49')][_0x0657('0x22')]);}_0x2ca00f['order']=qs['sort'](_0x4a337[_0x0657('0x49')][_0x0657('0x53')]);_0x2ca00f[_0x0657('0x54')]=qs[_0x0657('0x4b')](_['pick'](_0x4a337[_0x0657('0x49')],_0x4a16aa[_0x0657('0x4b')]));_0x2ca00f[_0x0657('0x54')][_0x0657('0x6a')]=_0x3f2335['id'];if(_0x4a337['query'][_0x0657('0x56')]){_0x2ca00f[_0x0657('0x54')]=_[_0x0657('0x57')](_0x2ca00f[_0x0657('0x54')],{'$or':_[_0x0657('0x44')](_0x2ca00f[_0x0657('0x4e')],function(_0x3cea54){var _0x276cfd={};_0x276cfd[_0x3cea54]={'$like':'%'+_0x4a337[_0x0657('0x49')][_0x0657('0x56')]+'%'};return _0x276cfd;})});}_0x2ca00f=_['merge']({},_0x2ca00f,_0x4a337[_0x0657('0x5f')]);return db[_0x0657('0x71')][_0x0657('0x23')]({'where':_0x2ca00f[_0x0657('0x54')]})[_0x0657('0x12')](function(_0x302a48){_0x17fbb1[_0x0657('0x23')]=_0x302a48;if(_0x4a337[_0x0657('0x49')][_0x0657('0x5d')]){_0x2ca00f[_0x0657('0x5e')]=[{'all':!![]}];}return db[_0x0657('0x71')]['findAll'](_0x2ca00f);})[_0x0657('0x12')](function(_0xe8db04){_0x17fbb1['rows']=_0xe8db04;return _0x17fbb1;});}})[_0x0657('0x12')](respondWithFilteredResult(_0x3d116b,_0x2ca00f))[_0x0657('0x1c')](handleError(_0x3d116b,null));};exports['removeAnswers']=function(_0x564c07,_0x2bde11){return db['MailAccount'][_0x0657('0x60')]({'where':{'id':_0x564c07[_0x0657('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2bde11,null))[_0x0657('0x12')](function(_0x239792){if(_0x239792){return _0x239792[_0x0657('0x73')](_0x564c07[_0x0657('0x49')][_0x0657('0x6f')]);}})[_0x0657('0x12')](respondWithStatusCode(_0x2bde11,null))[_0x0657('0x1c')](handleError(_0x2bde11,null));};exports[_0x0657('0x74')]=function(_0x125698,_0x1dcb39){var _0x1a2494={'name':_0x125698[_0x0657('0x62')]['name'],'key':_0x125698['body'][_0x0657('0x47')],'provider':_0x125698[_0x0657('0x62')]['provider']===_0x0657('0x64')?null:_0x125698['body'][_0x0657('0x63')],'email':_0x125698[_0x0657('0x62')][_0x0657('0x75')],'ListId':_0x125698[_0x0657('0x62')][_0x0657('0x76')],'active':!_[_0x0657('0x77')](_0x125698[_0x0657('0x62')][_0x0657('0x78')])?_0x125698[_0x0657('0x62')][_0x0657('0x78')]:!![],'description':_0x125698[_0x0657('0x62')][_0x0657('0x79')]||null};var _0x534832=getAuthenticationOptions(_0x1a2494['provider'],_0x125698[_0x0657('0x62')]);_0x1a2494['Imap']=_0x534832[_0x0657('0x3e')];_0x1a2494[_0x0657('0x3f')]=_0x534832[_0x0657('0x3f')];return db['MailAccount'][_0x0657('0x74')](_0x1a2494,{'include':[{'model':db[_0x0657('0x42')],'as':_0x0657('0x3f')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x0657('0x12')](function(_0x23fbe6){var _0x5c8335=_0x125698['user']['get']({'plain':!![]});if(!_0x5c8335)throw new Error(_0x0657('0x7a'));if(_0x5c8335['role']===_0x0657('0x34')){var _0x5e7c7a=_0x23fbe6[_0x0657('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x0657('0x60')]({'where':{'name':_0x0657('0x26'),'userProfileId':_0x5c8335[_0x0657('0x7b')]},'raw':!![]})[_0x0657('0x12')](function(_0x495be1){if(_0x495be1&&_0x495be1['autoAssociation']===0x0){return db[_0x0657('0x27')][_0x0657('0x74')]({'name':_0x5e7c7a[_0x0657('0x2a')],'resourceId':_0x5e7c7a['id'],'type':_0x495be1[_0x0657('0x2a')],'sectionId':_0x495be1['id']},{})['then'](function(){return _0x23fbe6;});}else{return _0x23fbe6;}})[_0x0657('0x1c')](function(_0xc39e4d){logger[_0x0657('0x18')](_0x0657('0x7c'),_0xc39e4d);throw _0xc39e4d;});}return _0x23fbe6;})[_0x0657('0x12')](respondWithResult(_0x1dcb39,0xc9))[_0x0657('0x1c')](handleError(_0x1dcb39,null));};exports[_0x0657('0x7d')]=function(_0x56c3ed,_0x59694d){return db['MailAccount'][_0x0657('0x6d')]({'where':{'id':_0x56c3ed[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x59694d,null))[_0x0657('0x12')](function(_0x3d7d65){if(_0x3d7d65){return _0x3d7d65[_0x0657('0x7d')]();}return null;})[_0x0657('0x12')](respondWithResult(_0x59694d,null))[_0x0657('0x1c')](handleError(_0x59694d,null));};exports[_0x0657('0x7e')]=function(_0x5d6da4,_0x46e22c){if(_0x5d6da4[_0x0657('0x62')]['id']){delete _0x5d6da4[_0x0657('0x62')]['id'];}return db[_0x0657('0x58')][_0x0657('0x60')]({'where':{'id':_0x5d6da4[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x46e22c,null))[_0x0657('0x12')](function(_0x3ebed8){if(_0x3ebed8){_0x5d6da4['body'][_0x0657('0x6a')]=_0x3ebed8['id'];return db[_0x0657('0x41')][_0x0657('0x74')](_0x5d6da4['body']);}})['then'](respondWithResult(_0x46e22c,null))['catch'](handleError(_0x46e22c,null));};exports[_0x0657('0x7f')]=function(_0x59dc3b,_0x5b9531){return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x59dc3b[_0x0657('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5b9531,null))[_0x0657('0x12')](function(_0x229375){if(_0x229375){return _0x229375[_0x0657('0x80')](null);}return null;})[_0x0657('0x12')](respondWithStatusCode(_0x5b9531,null))[_0x0657('0x1c')](handleError(_0x5b9531,null));};exports[_0x0657('0x81')]=function(_0x36d06d,_0x524daf){return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x36d06d[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x524daf,null))[_0x0657('0x12')](function(_0x42eef){if(_0x42eef){return _0x42eef['getSmtp']();}return null;})['then'](respondWithResult(_0x524daf,null))[_0x0657('0x1c')](handleError(_0x524daf,null));};exports[_0x0657('0x82')]=function(_0x47cfc7,_0x40b5af){if(_0x47cfc7[_0x0657('0x62')]['id']){delete _0x47cfc7[_0x0657('0x62')]['id'];}return db['MailAccount'][_0x0657('0x60')]({'where':{'id':_0x47cfc7[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x40b5af,null))[_0x0657('0x12')](function(_0x3b2613){if(_0x3b2613){_0x47cfc7[_0x0657('0x62')][_0x0657('0x6a')]=_0x3b2613['id'];return db[_0x0657('0x42')]['create'](_0x47cfc7['body']);}})['then'](respondWithResult(_0x40b5af,null))[_0x0657('0x1c')](handleError(_0x40b5af,null));};exports[_0x0657('0x83')]=function(_0x439772,_0x45c4a6){return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x439772['params']['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x45c4a6,null))[_0x0657('0x12')](function(_0x338778){if(_0x338778){return _0x338778['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x45c4a6,null))['catch'](handleError(_0x45c4a6,null));};exports[_0x0657('0x84')]=function(_0x1d618e,_0x468392){return db['MailInteraction'][_0x0657('0x60')]({'where':{'id':_0x1d618e['params']['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x468392,null))[_0x0657('0x12')](function(_0x2ba193){if(_0x2ba193){return _0x2ba193[_0x0657('0x84')](_0x1d618e[_0x0657('0x62')][_0x0657('0x6f')],_[_0x0657('0x85')](_0x1d618e[_0x0657('0x62')],[_0x0657('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x468392,null))[_0x0657('0x1c')](handleError(_0x468392,null));};exports['getInteractions']=function(_0x4aeaf2,_0x4cba5c){var _0x33b805={'raw':![],'where':{}};var _0xa947c3={};var _0x42644b={'count':0x0,'rows':[]};return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x4aeaf2[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x4cba5c,null))[_0x0657('0x12')](function(_0x358a96){if(_0x358a96){_0xa947c3[_0x0657('0x48')]=_[_0x0657('0x4a')](db['MailInteraction']['rawAttributes']);_0xa947c3[_0x0657('0x49')]=_['keys'](_0x4aeaf2['query']);_0xa947c3[_0x0657('0x4b')]=_['intersection'](_0xa947c3['model'],_0xa947c3[_0x0657('0x49')]);_0x33b805['attributes']=_[_0x0657('0x4c')](_0xa947c3['model'],qs['fields'](_0x4aeaf2[_0x0657('0x49')][_0x0657('0x4d')]));_0x33b805[_0x0657('0x4e')]=_0x33b805[_0x0657('0x4e')][_0x0657('0x4f')]?_0x33b805['attributes']:_0xa947c3[_0x0657('0x48')];if(!_0x4aeaf2['query'][_0x0657('0x50')]('nolimit')){_0x33b805[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x4aeaf2[_0x0657('0x49')]['limit']);_0x33b805['offset']=qs[_0x0657('0x22')](_0x4aeaf2['query'][_0x0657('0x22')]);}_0x33b805['order']=qs[_0x0657('0x53')](_0x4aeaf2[_0x0657('0x49')][_0x0657('0x53')]);_0x33b805[_0x0657('0x54')]=qs[_0x0657('0x4b')](_[_0x0657('0x55')](_0x4aeaf2[_0x0657('0x49')],_0xa947c3[_0x0657('0x4b')]));_0x33b805['where'][_0x0657('0x6a')]=_0x358a96['id'];if(_0x4aeaf2[_0x0657('0x49')]['filter']){_0x33b805['where']=_[_0x0657('0x57')](_0x33b805['where'],{'$or':_[_0x0657('0x44')](_0x33b805['attributes'],function(_0x10ea63){var _0x4e70af={};_0x4e70af[_0x10ea63]={'$like':'%'+_0x4aeaf2['query']['filter']+'%'};return _0x4e70af;})});}_0x33b805=_[_0x0657('0x57')]({},_0x33b805,_0x4aeaf2['options']);return db[_0x0657('0x86')][_0x0657('0x23')]({'where':_0x33b805[_0x0657('0x54')]})[_0x0657('0x12')](function(_0x4281e6){_0x42644b['count']=_0x4281e6;if(_0x4aeaf2[_0x0657('0x49')][_0x0657('0x5d')]){_0x33b805[_0x0657('0x5e')]=[{'model':db[_0x0657('0x87')],'as':_0x0657('0x88'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x0657('0x89'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0657('0x8a'),'attributes':['id',_0x0657('0x2a'),_0x0657('0x8b')],'where':_0x4aeaf2['query'][_0x0657('0x8c')]?{'id':_0x4aeaf2[_0x0657('0x49')][_0x0657('0x8c')]}:undefined,'required':_0x4aeaf2[_0x0657('0x49')][_0x0657('0x8c')]?!![]:![]}];}return db[_0x0657('0x86')]['findAll'](_0x33b805);})[_0x0657('0x12')](function(_0x48598b){_0x42644b[_0x0657('0x5a')]=_0x48598b;return _0x42644b;});}})[_0x0657('0x12')](respondWithFilteredResult(_0x4cba5c,_0x33b805))['catch'](handleError(_0x4cba5c,null));};exports[_0x0657('0x8d')]=function addApplications(_0x1e4758,_0x319254){var _0x502fe9=_0x1e4758['params']['id'];var _0x1ecd54=_0x1e4758[_0x0657('0x62')];var _0x2ed404=0xc8;var _0x526056=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0657('0x8e')]['Transaction'][_0x0657('0x8f')][_0x0657('0x90')]},function(_0x551120){return db['MailAccount']['findOne']({'where':{'id':_0x502fe9},'transaction':_0x551120})['then'](function(_0x248193){if(_0x248193){return db['MailApplication'][_0x0657('0x28')]({'where':{'MailAccountId':_0x502fe9},'transaction':_0x551120})['then'](function(){var _0x5ede48=_['map'](_0x1ecd54,function(_0x4f5bf8){_0x4f5bf8[_0x0657('0x6a')]=_0x502fe9;return _0x4f5bf8;});return db[_0x0657('0x91')][_0x0657('0x92')](_0x5ede48,{'transaction':_0x551120});});}else{_0x2ed404=0x194;_0x526056=[];}});})[_0x0657('0x12')](function(){if(_0x2ed404!==0x194){return db[_0x0657('0x91')][_0x0657('0x93')]({'where':{'MailAccountId':_0x502fe9},'order':'priority'})[_0x0657('0x12')](function(_0x5c69f2){_0x526056=_0x5c69f2;});}})[_0x0657('0x1c')](function(_0x21ec23){_0x2ed404=0x1f4;logger[_0x0657('0x18')](_0x21ec23[_0x0657('0x29')]);if(_0x21ec23['name']){delete _0x21ec23[_0x0657('0x2a')];}_0x526056=_0x21ec23;})[_0x0657('0x94')](function(){if(_0x526056===null){_0x319254[_0x0657('0x1d')](_0x2ed404);}else{if(_0x2ed404===0x1f4){_0x319254['status'](_0x2ed404)[_0x0657('0x2b')](_0x526056);}else{_0x319254[_0x0657('0x1e')](_0x2ed404)[_0x0657('0x20')](_0x526056);}}});};exports[_0x0657('0x95')]=function(_0x970d50,_0xdb7bbf){var _0x5a04a4={};var _0x36fbd2={};var _0x4687b0;var _0x987efe;return db['MailAccount']['findOne']({'where':{'id':_0x970d50[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0xdb7bbf,null))[_0x0657('0x12')](function(_0x588eae){if(_0x588eae){_0x4687b0=_0x588eae;_0x36fbd2['model']=_['keys'](db['MailApplication'][_0x0657('0x45')]);_0x36fbd2[_0x0657('0x49')]=_[_0x0657('0x4a')](_0x970d50[_0x0657('0x49')]);_0x36fbd2[_0x0657('0x4b')]=_['intersection'](_0x36fbd2['model'],_0x36fbd2['query']);_0x5a04a4[_0x0657('0x4e')]=_['intersection'](_0x36fbd2[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x970d50[_0x0657('0x49')][_0x0657('0x4d')]));_0x5a04a4[_0x0657('0x4e')]=_0x5a04a4[_0x0657('0x4e')][_0x0657('0x4f')]?_0x5a04a4[_0x0657('0x4e')]:_0x36fbd2[_0x0657('0x48')];_0x5a04a4[_0x0657('0x52')]=qs[_0x0657('0x53')](_0x970d50['query'][_0x0657('0x53')]);_0x5a04a4[_0x0657('0x54')]=qs[_0x0657('0x4b')](_[_0x0657('0x55')](_0x970d50['query'],_0x36fbd2['filters']));if(_0x970d50['query'][_0x0657('0x56')]){_0x5a04a4['where']=_['merge'](_0x5a04a4[_0x0657('0x54')],{'$or':_['map'](_0x5a04a4[_0x0657('0x4e')],function(_0xb0cbf0){var _0x10d40b={};_0x10d40b[_0xb0cbf0]={'$like':'%'+_0x970d50[_0x0657('0x49')][_0x0657('0x56')]+'%'};return _0x10d40b;})});}_0x5a04a4=_[_0x0657('0x57')]({},_0x5a04a4,_0x970d50[_0x0657('0x5f')]);return _0x4687b0[_0x0657('0x95')](_0x5a04a4);}})[_0x0657('0x12')](function(_0x1b9562){if(_0x1b9562){_0x987efe=_0x1b9562[_0x0657('0x4f')];if(!_0x970d50[_0x0657('0x49')]['hasOwnProperty'](_0x0657('0x51'))){_0x5a04a4[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x970d50[_0x0657('0x49')][_0x0657('0x21')]);_0x5a04a4[_0x0657('0x22')]=qs[_0x0657('0x22')](_0x970d50[_0x0657('0x49')][_0x0657('0x22')]);}return _0x4687b0[_0x0657('0x95')](_0x5a04a4);}})[_0x0657('0x12')](function(_0x47cbaf){if(_0x47cbaf){return _0x47cbaf?{'count':_0x987efe,'rows':_0x47cbaf}:null;}})[_0x0657('0x12')](respondWithResult(_0xdb7bbf,null))[_0x0657('0x1c')](handleError(_0xdb7bbf,null));};exports[_0x0657('0x96')]=function(_0x53c5d1,_0x1eddd4){var _0x3c37ef={'raw':!![],'where':{}};var _0x1a860b={};var _0x28163c={'count':0x0,'rows':[]};return db[_0x0657('0x58')]['findOne']({'where':{'id':_0x53c5d1[_0x0657('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1eddd4,null))[_0x0657('0x12')](function(_0x55512b){if(_0x55512b){_0x1a860b[_0x0657('0x48')]=_[_0x0657('0x4a')](db[_0x0657('0x97')][_0x0657('0x45')]);_0x1a860b['query']=_[_0x0657('0x4a')](_0x53c5d1[_0x0657('0x49')]);_0x1a860b[_0x0657('0x4b')]=_[_0x0657('0x4c')](_0x1a860b[_0x0657('0x48')],_0x1a860b[_0x0657('0x49')]);_0x3c37ef[_0x0657('0x4e')]=_[_0x0657('0x4c')](_0x1a860b[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x53c5d1[_0x0657('0x49')]['fields']));_0x3c37ef['attributes']=_0x3c37ef[_0x0657('0x4e')][_0x0657('0x4f')]?_0x3c37ef[_0x0657('0x4e')]:_0x1a860b[_0x0657('0x48')];if(!_0x53c5d1[_0x0657('0x49')][_0x0657('0x50')](_0x0657('0x51'))){_0x3c37ef[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x53c5d1[_0x0657('0x49')]['limit']);_0x3c37ef['offset']=qs['offset'](_0x53c5d1['query'][_0x0657('0x22')]);}_0x3c37ef['order']=qs[_0x0657('0x53')](_0x53c5d1['query'][_0x0657('0x53')]);_0x3c37ef[_0x0657('0x54')]=qs[_0x0657('0x4b')](_[_0x0657('0x55')](_0x53c5d1[_0x0657('0x49')],_0x1a860b[_0x0657('0x4b')]));_0x3c37ef[_0x0657('0x54')]['MailAccountId']=_0x55512b['id'];if(_0x53c5d1['query'][_0x0657('0x56')]){_0x3c37ef[_0x0657('0x54')]=_[_0x0657('0x57')](_0x3c37ef[_0x0657('0x54')],{'$or':_[_0x0657('0x44')](_0x3c37ef['attributes'],function(_0x4f927d){var _0x1f2e70={};_0x1f2e70[_0x4f927d]={'$like':'%'+_0x53c5d1['query'][_0x0657('0x56')]+'%'};return _0x1f2e70;})});}if(_0x53c5d1[_0x0657('0x49')][_0x0657('0x98')]){var _0x1e7ab9=_0x53c5d1['query'][_0x0657('0x98')]['split'](',');var _0x4ff1a3={};_0x4ff1a3[_0x1e7ab9[0x0]]={'$gte':moment(_0x1e7ab9[0x1])[_0x0657('0x99')](_0x0657('0x9a'))};_0x3c37ef['where']=_['merge'](_0x3c37ef['where'],_0x4ff1a3);}_0x3c37ef=_[_0x0657('0x57')]({},_0x3c37ef,_0x53c5d1['options']);return db[_0x0657('0x97')][_0x0657('0x23')]({'where':_0x3c37ef[_0x0657('0x54')]})[_0x0657('0x12')](function(_0x2d58b3){_0x28163c['count']=_0x2d58b3;if(_0x53c5d1[_0x0657('0x49')][_0x0657('0x5d')]){_0x3c37ef[_0x0657('0x5e')]=[{'all':!![]}];}return db[_0x0657('0x97')][_0x0657('0x59')](_0x3c37ef);})[_0x0657('0x12')](function(_0x35df18){if(_0x53c5d1[_0x0657('0x49')][_0x0657('0x9b')]===_0x0657('0x9c')){for(var _0x3cecb1=0x0;_0x3cecb1<_0x35df18[_0x0657('0x4f')];_0x3cecb1++){_0x35df18[_0x3cecb1][_0x0657('0x62')]=juice(_0x35df18[_0x3cecb1][_0x0657('0x62')]);}}_0x28163c[_0x0657('0x5a')]=_0x35df18;return _0x28163c;});}})[_0x0657('0x12')](respondWithFilteredResult(_0x1eddd4,_0x3c37ef))[_0x0657('0x1c')](handleError(_0x1eddd4,null));};exports[_0x0657('0x2b')]=function(_0x4630b6,_0x2a3a3c){var _0x4afbf4,_0x2d90e4={},_0x4898a2;if(_0x4630b6[_0x0657('0x62')]['to']){_0x4898a2=_0x4630b6[_0x0657('0x62')]['to'][_0x0657('0x9d')](',')[0x0];}return db['MailAccount'][_0x0657('0x60')]({'where':{'id':_0x4630b6[_0x0657('0x5c')]['id']},'include':[{'model':db[_0x0657('0x9e')],'as':_0x0657('0x9f'),'include':[{'model':db[_0x0657('0x87')],'as':'Contacts','where':{'email':_0x4898a2},'limit':0x1,'order':[[_0x0657('0xa0'),_0x0657('0xa1')]]}]},{'model':db['MailServerOut'],'as':_0x0657('0x3f'),'raw':!![],'include':[{'model':db[_0x0657('0xa2')],'as':_0x0657('0xa2'),'raw':!![]}]}]})[_0x0657('0x12')](handleEntityNotFound(_0x2a3a3c,null))[_0x0657('0x12')](function(_0x54d116){if(!_0x54d116)return;_0x4afbf4=_0x54d116;if(!_0x54d116[_0x0657('0x3f')])throw new Error(_0x0657('0xa3'));if(_[_0x0657('0x77')](_0x4630b6[_0x0657('0x62')][_0x0657('0xa4')])){_0x4630b6[_0x0657('0x62')][_0x0657('0xa4')]=util['format']('%s\x20<%s>',_0x54d116[_0x0657('0x2a')],_0x54d116['email']||_0x54d116[_0x0657('0x3f')][_0x0657('0x34')]);}if(_0x4630b6[_0x0657('0x62')][_0x0657('0xa5')]&&_0x4630b6[_0x0657('0x62')][_0x0657('0xa5')][_0x0657('0x4f')]){for(var _0x203ba7=0x0;_0x203ba7<_0x4630b6[_0x0657('0x62')][_0x0657('0xa5')][_0x0657('0x4f')];_0x203ba7+=0x1){_0x4630b6[_0x0657('0x62')][_0x0657('0xa5')][_0x203ba7]={'filename':_0x4630b6['body'][_0x0657('0xa5')][_0x203ba7][_0x0657('0x2a')],'path':path[_0x0657('0xa6')](config[_0x0657('0xa7')],_0x0657('0xa8'),_0x4630b6[_0x0657('0x62')][_0x0657('0xa5')][_0x203ba7][_0x0657('0xa9')])};}}var _0x39e1b0=_0x54d116['getSmtpOptions']();return respondWithRpcPromise(_0x0657('0xaa'),_0x0657('0xab'),{'account':_0x39e1b0,'message':_0x4630b6[_0x0657('0x62')]});})[_0x0657('0x12')](function(_0x419179){if(!_0x419179)return;_0x2d90e4=_0x419179;if(!_0x4afbf4[_0x0657('0x9f')])throw new Error(_0x0657('0xac'));if(_0x4afbf4[_0x0657('0x9f')]['Contacts'][_0x0657('0x4f')])return _0x4afbf4[_0x0657('0x9f')][_0x0657('0xad')][0x0];return db['CmContact'][_0x0657('0x74')](_[_0x0657('0xa')](_0x4630b6[_0x0657('0x62')],{'firstName':_0x4630b6[_0x0657('0x62')]['to'],'email':_0x4630b6['body']['to'],'phone':_0x4630b6[_0x0657('0x62')]['to'],'ListId':_0x4afbf4['ListId']}));})['then'](function(_0x5b7ca6){if(!_0x5b7ca6)return;var _0xa3a696={'UserId':_0x4630b6['user']['id'],'ContactId':_0x5b7ca6['id'],'MailAccountId':_0x4afbf4['id'],'inReplyTo':_0x2d90e4[_0x0657('0xae')],'to':_0x4630b6['body'][_0x0657('0xa4')],'cc':_0x4630b6['body']['cc'],'subject':_0x4630b6[_0x0657('0x62')][_0x0657('0xaf')],'attach':_0x4630b6[_0x0657('0x62')][_0x0657('0xb0')],'firstMsgDirection':_0x0657('0xb1'),'lastMsgAt':moment()[_0x0657('0x99')](_0x0657('0x9a')),'lastMsgDirection':_0x0657('0xb1'),'Messages':[_['merge'](_0x4630b6['body'],{'messageId':_0x2d90e4[_0x0657('0xae')],'sentAt':moment()['format'](_0x0657('0x9a')),'read':!![],'MailAccountId':_0x4afbf4['id'],'UserId':_0x4630b6['user']['id'],'ContactId':_0x5b7ca6['id']})]};if(_0x4630b6[_0x0657('0x62')][_0x0657('0xb2')]){_0xa3a696=_[_0x0657('0x57')](_0xa3a696,_0x4630b6['body'][_0x0657('0xb2')]);}return db['MailInteraction'][_0x0657('0x74')](_0xa3a696,{'include':[{'model':db['MailMessage'],'as':_0x0657('0xb3')}]});})['then'](respondWithResult(_0x2a3a3c,null))[_0x0657('0x1c')](handleError(_0x2a3a3c,null));};exports[_0x0657('0xb4')]=function(_0x2ff17f,_0x4c00fd){return db[_0x0657('0x58')][_0x0657('0x60')]({'where':{'id':_0x2ff17f[_0x0657('0x5c')]['id']},'include':[{'model':db[_0x0657('0x42')],'as':_0x0657('0x3f'),'raw':!![],'include':[{'model':db[_0x0657('0xa2')],'as':'CloudProvider','raw':!![]}]}]})[_0x0657('0x12')](handleEntityNotFound(_0x4c00fd,null))[_0x0657('0x12')](function(_0x3db841){if(!_0x3db841[_0x0657('0x3f')])return;var _0xb3984d=_0x3db841[_0x0657('0xb5')]();return respondWithRpcPromise(_0x0657('0xb6'),'verifySmtp',{'account':_0xb3984d});})[_0x0657('0x12')](respondWithResult(_0x4c00fd,null))[_0x0657('0x1c')](handleError(_0x4c00fd,null));};exports[_0x0657('0x28')]=function(_0x48d879,_0x27e329){return db[_0x0657('0x58')][_0x0657('0x60')]({'where':{'id':_0x48d879[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x27e329,null))[_0x0657('0x12')](function(_0x349f69){if(_0x349f69&&_0x349f69[_0x0657('0x3c')]){throw new db['Sequelize']['ValidationError'](_0x0657('0xb7'));}return _0x349f69;})[_0x0657('0x12')](removeEntity(_0x27e329,null))[_0x0657('0x1c')](handleError(_0x27e329,null));};exports['addAgents']=function(_0xf8804d,_0x445350){return db[_0x0657('0x58')][_0x0657('0x60')]({'where':{'id':_0xf8804d[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x445350,null))['then'](function(_0x46cb53){if(_0x46cb53){return _0x46cb53[_0x0657('0xb8')](_0xf8804d[_0x0657('0x62')]['ids'],_[_0x0657('0x85')](_0xf8804d[_0x0657('0x62')],['ids','id'])||{})[_0x0657('0xb9')](function(_0x1921c2){for(var _0x5c3033=0x0;_0x5c3033<_0xf8804d[_0x0657('0x62')][_0x0657('0x6f')][_0x0657('0x4f')];_0x5c3033+=0x1){socket[_0x0657('0xba')](_0x0657('0xbb'),{'UserId':Number(_0xf8804d[_0x0657('0x62')][_0x0657('0x6f')][_0x5c3033]),'MailAccountId':Number(_0xf8804d[_0x0657('0x5c')]['id'])});}return _0x1921c2;});}})[_0x0657('0x12')](respondWithResult(_0x445350,null))[_0x0657('0x1c')](handleError(_0x445350,null));};exports['removeAgents']=function(_0x208ba9,_0x122244){return db[_0x0657('0x58')][_0x0657('0x60')]({'where':{'id':_0x208ba9[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x122244,null))['then'](function(_0x5414d4){if(_0x5414d4){return _0x5414d4['removeAgents'](_0x208ba9[_0x0657('0x49')]['ids'])[_0x0657('0x12')](function(){if(_[_0x0657('0xbc')](_0x208ba9[_0x0657('0x49')][_0x0657('0x6f')])){for(var _0x32ea3d=0x0;_0x32ea3d<_0x208ba9['query']['ids']['length'];_0x32ea3d+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x208ba9[_0x0657('0x49')]['ids'][_0x32ea3d]),'MailAccountId':Number(_0x208ba9[_0x0657('0x5c')]['id'])});}}else{socket[_0x0657('0xba')]('userMailAccount:remove',{'UserId':Number(_0x208ba9[_0x0657('0x49')][_0x0657('0x6f')]),'MailAccountId':Number(_0x208ba9[_0x0657('0x5c')]['id'])});}});}})[_0x0657('0x12')](respondWithStatusCode(_0x122244,null))[_0x0657('0x1c')](handleError(_0x122244,null));};exports[_0x0657('0xbd')]=function(_0x41cbd1,_0x43a311){var _0x3218ee={};var _0x3353f6={};var _0x4c34b6;var _0x172aa4;return db[_0x0657('0x58')][_0x0657('0x6d')]({'where':{'id':_0x41cbd1[_0x0657('0x5c')]['id']}})[_0x0657('0x12')](handleEntityNotFound(_0x43a311,null))[_0x0657('0x12')](function(_0x27255a){if(_0x27255a){_0x4c34b6=_0x27255a;_0x3353f6[_0x0657('0x48')]=_[_0x0657('0x4a')](db[_0x0657('0xbe')][_0x0657('0x45')]);_0x3353f6['query']=_[_0x0657('0x4a')](_0x41cbd1['query']);_0x3353f6[_0x0657('0x4b')]=_[_0x0657('0x4c')](_0x3353f6['model'],_0x3353f6[_0x0657('0x49')]);_0x3218ee[_0x0657('0x4e')]=_[_0x0657('0x4c')](_0x3353f6[_0x0657('0x48')],qs[_0x0657('0x4d')](_0x41cbd1[_0x0657('0x49')][_0x0657('0x4d')]));_0x3218ee[_0x0657('0x4e')]=_0x3218ee['attributes'][_0x0657('0x4f')]?_0x3218ee[_0x0657('0x4e')]:_0x3353f6['model'];_0x3218ee[_0x0657('0x52')]=qs['sort'](_0x41cbd1['query'][_0x0657('0x53')]);_0x3218ee[_0x0657('0x54')]=qs[_0x0657('0x4b')](_[_0x0657('0x55')](_0x41cbd1['query'],_0x3353f6[_0x0657('0x4b')]));if(_0x41cbd1[_0x0657('0x49')]['filter']){_0x3218ee['where']=_[_0x0657('0x57')](_0x3218ee['where'],{'$or':_[_0x0657('0x44')](_0x3218ee[_0x0657('0x4e')],function(_0x2e237c){var _0x51f5e2={};_0x51f5e2[_0x2e237c]={'$like':'%'+_0x41cbd1[_0x0657('0x49')][_0x0657('0x56')]+'%'};return _0x51f5e2;})});}_0x3218ee=_[_0x0657('0x57')]({},_0x3218ee,_0x41cbd1['options']);return _0x4c34b6['getAgents'](_0x3218ee);}})['then'](function(_0x49242c){if(_0x49242c){_0x172aa4=_0x49242c[_0x0657('0x4f')];if(!_0x41cbd1['query'][_0x0657('0x50')]('nolimit')){_0x3218ee[_0x0657('0x21')]=qs[_0x0657('0x21')](_0x41cbd1[_0x0657('0x49')][_0x0657('0x21')]);_0x3218ee['offset']=qs['offset'](_0x41cbd1['query'][_0x0657('0x22')]);}return _0x4c34b6[_0x0657('0xbd')](_0x3218ee);}})[_0x0657('0x12')](function(_0x3724de){if(_0x3724de){return _0x3724de?{'count':_0x172aa4,'rows':_0x3724de}:null;}})['then'](respondWithResult(_0x43a311,null))[_0x0657('0x1c')](handleError(_0x43a311,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index f888981..207b11d 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 _0xbdc1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xbdc1,0x147));var _0x1bdc=function(_0x334b59,_0x46c37a){_0x334b59=_0x334b59-0x0;var _0x37cef4=_0xbdc1[_0x334b59];return _0x37cef4;};'use strict';var EventEmitter=require(_0x1bdc('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x1bdc('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1bdc('0x2')](0x0);var events={'afterCreate':_0x1bdc('0x3'),'afterUpdate':_0x1bdc('0x4'),'afterDestroy':_0x1bdc('0x5')};function emitEvent(_0xaa84ca){return function(_0x59cff6,_0x4fa3e0,_0x29074f){MailAccountEvents[_0x1bdc('0x6')](_0xaa84ca+':'+_0x59cff6['id'],_0x59cff6);MailAccountEvents['emit'](_0xaa84ca,_0x59cff6);_0x29074f(null);};}for(var e in events){if(events[_0x1bdc('0x7')](e)){var event=events[e];MailAccount[_0x1bdc('0x8')](e,emitEvent(event));}}module[_0x1bdc('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x9931=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x9931,0x1b6));var _0x1993=function(_0xfc49ed,_0x14dce5){_0xfc49ed=_0xfc49ed-0x0;var _0x4dfc87=_0x9931[_0xfc49ed];return _0x4dfc87;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1993('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1993('0x1')](0x0);var events={'afterCreate':_0x1993('0x2'),'afterUpdate':_0x1993('0x3'),'afterDestroy':_0x1993('0x4')};function emitEvent(_0x311444){return function(_0x38e764,_0x31e1a5,_0x401ac4){MailAccountEvents[_0x1993('0x5')](_0x311444+':'+_0x38e764['id'],_0x38e764);MailAccountEvents[_0x1993('0x5')](_0x311444,_0x38e764);_0x401ac4(null);};}for(var e in events){if(events[_0x1993('0x6')](e)){var event=events[e];MailAccount[_0x1993('0x7')](e,emitEvent(event));}}module[_0x1993('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index dd52037..85eebb0 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 _0xc101=['host','port','Smtp','secure','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service'];(function(_0x1942bc,_0x22c1ba){var _0x193474=function(_0x15d6f5){while(--_0x15d6f5){_0x1942bc['push'](_0x1942bc['shift']());}};_0x193474(++_0x22c1ba);}(_0xc101,0x90));var _0x1c10=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xc101[_0x4e8286];return _0x44a440;};'use strict';var attributes=require(_0x1c10('0x0'));module[_0x1c10('0x1')]=function(_0x39c6b6){return _0x39c6b6[_0x1c10('0x2')](_0x1c10('0x3'),attributes,{'tableName':_0x1c10('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x10d026=this;var _0x1154a8={'id':_0x10d026['id'],'tls':{'rejectUnauthorized':![]}};if(_0x10d026[_0x1c10('0x5')]!==_0x1c10('0x6')){_0x1154a8[_0x1c10('0x7')]=_0x10d026['provider'];}else{_0x1154a8[_0x1c10('0x8')]=_0x10d026['Smtp']['host'];_0x1154a8[_0x1c10('0x9')]=_0x10d026[_0x1c10('0xa')][_0x1c10('0x9')];_0x1154a8['secure']=_0x10d026[_0x1c10('0xa')][_0x1c10('0xb')];}if(_0x10d026[_0x1c10('0xa')]['authentication']){if(_0x10d026[_0x1c10('0xa')][_0x1c10('0xc')]){if(!_0x10d026[_0x1c10('0xa')][_0x1c10('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x1154a8['auth']={'type':_0x1c10('0xe'),'user':_0x10d026['Smtp'][_0x1c10('0xf')],'accessToken':_0x10d026[_0x1c10('0xa')][_0x1c10('0xd')][_0x1c10('0x10')]};}else{_0x1154a8[_0x1c10('0x11')]={'user':_0x10d026[_0x1c10('0xa')][_0x1c10('0xf')],'pass':_0x10d026[_0x1c10('0xa')][_0x1c10('0x12')]};}}return _0x1154a8;}}});}; \ No newline at end of file +var _0x3f68=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication'];(function(_0x1c73ee,_0x49a9c9){var _0x154f05=function(_0x3987f1){while(--_0x3987f1){_0x1c73ee['push'](_0x1c73ee['shift']());}};_0x154f05(++_0x49a9c9);}(_0x3f68,0xbb));var _0x83f6=function(_0x1646b6,_0x79c1fc){_0x1646b6=_0x1646b6-0x0;var _0x56bd8c=_0x3f68[_0x1646b6];return _0x56bd8c;};'use strict';var attributes=require(_0x83f6('0x0'));module[_0x83f6('0x1')]=function(_0x3c915c){return _0x3c915c['define'](_0x83f6('0x2'),attributes,{'tableName':_0x83f6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x508e01=this;var _0x439b2a={'id':_0x508e01['id'],'tls':{'rejectUnauthorized':![]}};if(_0x508e01[_0x83f6('0x4')]!==_0x83f6('0x5')){_0x439b2a[_0x83f6('0x6')]=_0x508e01[_0x83f6('0x4')];}else{_0x439b2a[_0x83f6('0x7')]=_0x508e01[_0x83f6('0x8')][_0x83f6('0x7')];_0x439b2a[_0x83f6('0x9')]=_0x508e01[_0x83f6('0x8')][_0x83f6('0x9')];_0x439b2a[_0x83f6('0xa')]=_0x508e01[_0x83f6('0x8')][_0x83f6('0xa')];}if(_0x508e01[_0x83f6('0x8')][_0x83f6('0xb')]){if(_0x508e01['Smtp'][_0x83f6('0xc')]){if(!_0x508e01[_0x83f6('0x8')][_0x83f6('0xd')])throw new Error(_0x83f6('0xe'));_0x439b2a[_0x83f6('0xf')]={'type':_0x83f6('0x10'),'user':_0x508e01['Smtp'][_0x83f6('0x11')],'accessToken':_0x508e01[_0x83f6('0x8')][_0x83f6('0xd')][_0x83f6('0x12')]};}else{_0x439b2a[_0x83f6('0xf')]={'user':_0x508e01[_0x83f6('0x8')][_0x83f6('0x11')],'pass':_0x508e01[_0x83f6('0x8')][_0x83f6('0x13')]};}}return _0x439b2a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 74cb865..fd1f6cf 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 _0x1c9a=['./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','limit','map','include','model','attributes','then','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','keys','createdAt','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','CmContact','Contacts','updatedAt','DESC','Applications','Smtp','CloudProvider','List','get','omit','getSmtpOptions','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','attach','format','created','attachments','originTo','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','name','unshift','waitForTheAssignedAgent','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x344e7c,_0x16205c){var _0x108a0c=function(_0xf18b8a){while(--_0xf18b8a){_0x344e7c['push'](_0x344e7c['shift']());}};_0x108a0c(++_0x16205c);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x1bc2b4,_0x58ae33){_0x1bc2b4=_0x1bc2b4-0x0;var _0x20e155=_0x1c9a[_0x1bc2b4];return _0x20e155;};'use strict';var _=require(_0xa1c9('0x0'));var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x7'));var client=jayson['client'][_0xa1c9('0x8')]({'port':0x232c});config[_0xa1c9('0x9')]=_[_0xa1c9('0xa')](config[_0xa1c9('0x9')],{'host':_0xa1c9('0xb'),'port':0x18eb});var socket=require(_0xa1c9('0xc'))(new Redis(config[_0xa1c9('0x9')]));require(_0xa1c9('0xd'))[_0xa1c9('0xe')](socket);function respondWithRpcPromise(_0xfab70b,_0x2fcbcd,_0xb96573){return new BPromise(function(_0x55c191,_0x53140c){return client[_0xa1c9('0xf')](_0xfab70b,_0xb96573)['then'](function(_0x26b475){logger[_0xa1c9('0x10')](_0xa1c9('0x11'),_0x2fcbcd,_0xa1c9('0x12'));logger[_0xa1c9('0x13')](_0xa1c9('0x14'),_0x2fcbcd,_0xa1c9('0x12'),JSON[_0xa1c9('0x15')](_0x26b475));if(_0x26b475[_0xa1c9('0x16')]){if(_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x17')]===0x1f4){logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x53140c(_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x18')]);}logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x26b475[_0xa1c9('0x16')]['message']);return _0x55c191(_0x26b475[_0xa1c9('0x16')]['message']);}else{logger[_0xa1c9('0x10')](_0xa1c9('0x11'),_0x2fcbcd,_0xa1c9('0x12'));_0x55c191(_0x26b475[_0xa1c9('0x19')][_0xa1c9('0x18')]);}})[_0xa1c9('0x1a')](function(_0x223932){logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x223932);_0x53140c(_0x223932);});});}exports[_0xa1c9('0x1b')]=function(_0x278ba6){var _0x18c22d=this;return new Promise(function(_0x58b01f,_0x1a5b8e){return db[_0xa1c9('0x1c')][_0xa1c9('0x1d')]({'raw':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['where']||null:null,'attributes':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['attributes']||null:null,'limit':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x20')]||null:null,'include':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['include']?_[_0xa1c9('0x21')](_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x22')],function(_0x484a6b){return{'model':db[_0x484a6b[_0xa1c9('0x23')]],'as':_0x484a6b['as'],'attributes':_0x484a6b[_0xa1c9('0x24')],'include':_0x484a6b[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x484a6b[_0xa1c9('0x22')],function(_0x339dee){return{'model':db[_0x339dee[_0xa1c9('0x23')]],'as':_0x339dee['as'],'attributes':_0x339dee[_0xa1c9('0x24')],'include':_0x339dee[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x339dee[_0xa1c9('0x22')],function(_0x364e70){return{'model':db[_0x364e70[_0xa1c9('0x23')]],'as':_0x364e70['as'],'attributes':_0x364e70[_0xa1c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0x25')](function(_0xf584e2){logger['info'](_0xa1c9('0x1b'),_0x278ba6);logger[_0xa1c9('0x13')](_0xa1c9('0x1b'),_0x278ba6,JSON[_0xa1c9('0x15')](_0xf584e2));_0x58b01f(_0xf584e2);})[_0xa1c9('0x1a')](function(_0x4c6dd4){logger[_0xa1c9('0x16')](_0xa1c9('0x1b'),_0x4c6dd4['message'],_0x278ba6);_0x1a5b8e(_0x18c22d[_0xa1c9('0x16')](0x1f4,_0x4c6dd4[_0xa1c9('0x18')]));});});};exports[_0xa1c9('0x26')]=function(_0x1339fd){var _0xd1f98e=this;return new Promise(function(_0x386b64,_0x220b63){return db[_0xa1c9('0x1c')][_0xa1c9('0x27')]({'raw':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x28')]||null:null,'attributes':_0x1339fd['options']?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x24')]||null:null,'include':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')]['include']?_[_0xa1c9('0x21')](_0x1339fd[_0xa1c9('0x1e')]['include'],function(_0x5ab2f2){return{'model':db[_0x5ab2f2[_0xa1c9('0x23')]],'as':_0x5ab2f2['as'],'attributes':_0x5ab2f2[_0xa1c9('0x24')],'include':_0x5ab2f2[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x5ab2f2[_0xa1c9('0x22')],function(_0x2c1825){return{'model':db[_0x2c1825[_0xa1c9('0x23')]],'as':_0x2c1825['as'],'attributes':_0x2c1825[_0xa1c9('0x24')],'include':_0x2c1825[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x2c1825[_0xa1c9('0x22')],function(_0x549afc){return{'model':db[_0x549afc[_0xa1c9('0x23')]],'as':_0x549afc['as'],'attributes':_0x549afc[_0xa1c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0x25')](function(_0x3df11a){if(_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x29')]===!![])_0x3df11a[_0xa1c9('0x2a')](_0xa1c9('0x2b'),_0x3df11a['getSmtpOptions']());logger[_0xa1c9('0x10')](_0xa1c9('0x26'),_0x1339fd);logger[_0xa1c9('0x13')]('ShowMailAccount',_0x1339fd,JSON[_0xa1c9('0x15')](_0x3df11a));_0x386b64(_0x3df11a);})[_0xa1c9('0x1a')](function(_0x23cab5){logger[_0xa1c9('0x16')](_0xa1c9('0x26'),_0x23cab5[_0xa1c9('0x18')],_0x1339fd);_0x220b63(_0xd1f98e[_0xa1c9('0x16')](0x1f4,_0x23cab5['message']));});});};exports[_0xa1c9('0x2c')]=function(_0x5f3084){var _0x1562f8=this;return new Promise(function(_0x4c1a9e,_0x114a21){var _0x313ec7={'body':_0x5f3084[_0xa1c9('0x2d')],'channel':'mail'};var _0x19d1aa=_['difference'](_[_0xa1c9('0x2e')](db['CmContact']['rawAttributes']),[_0xa1c9('0x2f'),'updatedAt',_0xa1c9('0x30'),'ListId']);var _0x550872=![];if(_0x5f3084[_0xa1c9('0x2d')]['id']){delete _0x5f3084[_0xa1c9('0x2d')]['id'];}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')]['from'])){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')])||_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')]===''){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0xa1c9('0x32')));}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')])){return _0x114a21(_0x1562f8['error'](0x1f4,_0xa1c9('0x34')+_0x19d1aa));}if(!_[_0xa1c9('0x35')](_0x19d1aa,_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')])){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0xa1c9('0x36')+_0x19d1aa));}var _0x227e94={};_0x227e94[_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')]]=_0x5f3084['body'][_0xa1c9('0x37')];return db[_0xa1c9('0x1c')]['find']({'where':{'id':_0x5f3084[_0xa1c9('0x38')]['id']},'include':[{'model':db[_0xa1c9('0x39')],'as':'List','include':[{'model':db[_0xa1c9('0x3a')],'as':_0xa1c9('0x3b'),'where':_0x227e94,'limit':0x1,'order':[[_0xa1c9('0x3c'),_0xa1c9('0x3d')]]}]},{'model':db['MailApplication'],'as':_0xa1c9('0x3e')},{'model':db['MailServerOut'],'as':_0xa1c9('0x3f'),'include':[{'model':db['CloudProvider'],'as':_0xa1c9('0x40')}]}]})[_0xa1c9('0x25')](function(_0x6d28a1){if(_0x6d28a1&&_0x6d28a1[_0xa1c9('0x41')]){var _0x226a65=_0x6d28a1[_0xa1c9('0x42')]({'plain':!![]});_0x313ec7[_0xa1c9('0x38')]=_[_0xa1c9('0x43')](_0x226a65,[_0xa1c9('0x3e'),_0xa1c9('0x41')]);_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x2b')]=_0x6d28a1[_0xa1c9('0x44')]();_0x313ec7[_0xa1c9('0x45')]=_0x226a65[_0xa1c9('0x3e')];_0x313ec7['list']=_0x226a65[_0xa1c9('0x41')];_0x313ec7[_0xa1c9('0x45')]=_[_0xa1c9('0x46')](_0x313ec7[_0xa1c9('0x45')],['priority'],[_0xa1c9('0x47')]);if(_0x313ec7[_0xa1c9('0x38')]&&_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x48')]){_0x313ec7['applications'][_0xa1c9('0x49')]({'id':0x0,'priority':_0x313ec7[_0xa1c9('0x45')][_0xa1c9('0x4a')]+0x1,'app':_0xa1c9('0x4b'),'appdata':_0xa1c9('0x48'),'interval':_0xa1c9('0x4c')});}if(_0x313ec7['account'][_0xa1c9('0x3e')]){delete _0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x3e')];}if(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x41')]){delete _0x313ec7[_0xa1c9('0x38')]['List'];}if(_0x226a65['List'][_0xa1c9('0x3b')]['length']){return _0x226a65['List'][_0xa1c9('0x3b')][0x0];}var _0xe162c1=_[_0xa1c9('0xa')](_0x5f3084['body'],{'firstName':_0x5f3084['body'][_0xa1c9('0x37')],'ListId':_0x226a65['ListId']});_0xe162c1[_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')]]=_0x5f3084[_0xa1c9('0x2d')]['from'];return db[_0xa1c9('0x3a')][_0xa1c9('0x4d')](_0xe162c1);}else{throw new Error(_0xa1c9('0x4e'));}})[_0xa1c9('0x25')](function(_0x5ea7be){_0x313ec7['contact']=_0x5ea7be;if(_0x5ea7be){if(!_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x4f')]){_0x5f3084['body'][_0xa1c9('0x18')][_0xa1c9('0x4f')]=rs[_0xa1c9('0x50')]()+'\x20'+_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x37')];}var _0x519d0f={'ContactId':_0x5ea7be['id'],'MailAccountId':_0x5f3084[_0xa1c9('0x38')]['id'],'inReplyTo':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x4f')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'cc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['cc'],'subject':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x51')],'attach':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['attach'],'lastMsgAt':moment()['format'](_0xa1c9('0x52')),'lastMsgDirection':'in'};return db[_0xa1c9('0x53')][_0xa1c9('0x27')]({'where':{'closed':![],'MailAccountId':_0x5f3084[_0xa1c9('0x38')]['id']},'include':[{'model':db[_0xa1c9('0x54')],'as':_0xa1c9('0x55'),'attributes':[_0xa1c9('0x4f')],'where':{'messageId':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x56')]}}]})[_0xa1c9('0x25')](function(_0x8e6b90){if(_0x8e6b90){return[_0x8e6b90,![]];}return db[_0xa1c9('0x53')]['create'](_0x519d0f)[_0xa1c9('0x25')](function(_0x423a34){return[_0x423a34,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa1c9('0x57')](function(_0x13f428,_0x25bc30){if(_0x13f428){_0x550872=_0x25bc30;if(!_0x25bc30){return _0x13f428['update']({'inReplyTo':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x4f')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'cc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['cc'],'subject':_0x5f3084['body'][_0xa1c9('0x18')]['subject'],'attach':_0x13f428[_0xa1c9('0x58')]?_0x13f428['attach']:_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x58')],'substatus':null,'substatusAt':moment()[_0xa1c9('0x59')](_0xa1c9('0x52')),'lastMsgAt':moment()[_0xa1c9('0x59')](_0xa1c9('0x52')),'lastMsgDirection':'in'});}else{return _0x13f428;}}})[_0xa1c9('0x25')](function(_0x2852ae){_0x313ec7['interaction']=_0x2852ae['get']({'plain':!![]});_0x313ec7['interaction'][_0xa1c9('0x5a')]=_0x550872;return db[_0xa1c9('0x54')][_0xa1c9('0x4d')]({'body':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')],'MailAccountId':_0x5f3084['account']['id'],'MailInteractionId':_0x2852ae['id'],'direction':'in','ContactId':_0x313ec7['contact']['id'],'messageId':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x4f')],'from':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['to'],'cc':_0x5f3084['body']['message']['cc'],'subject':_0x5f3084['body'][_0xa1c9('0x18')][_0xa1c9('0x51')],'attach':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x58')],'Attachments':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5b')],'originTo':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5c')],'originCc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5d')],'bcc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5e')],'ChatWebsiteId':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x5f')]||null,'originChannel':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x60')]||null},{'include':[{'model':db[_0xa1c9('0x61')],'as':_0xa1c9('0x62')}]});})[_0xa1c9('0x25')](function(_0x21099a){_0x313ec7['message']=_0x21099a;if(!_0x313ec7[_0xa1c9('0x63')][_0xa1c9('0x64')]){return;}return db['User']['find']({'attributes':['id',_0xa1c9('0x65')],'where':{'id':_0x313ec7[_0xa1c9('0x63')][_0xa1c9('0x64')]}});})['then'](function(_0x168d20){if(_0x168d20){_0x313ec7[_0xa1c9('0x45')][_0xa1c9('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x168d20['name']+','+(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x313ec7['interaction']['queueId']){return;}return db[_0xa1c9('0x68')]['find']({'attributes':['id',_0xa1c9('0x65')],'where':{'id':_0x313ec7[_0xa1c9('0x63')]['queueId']}});})[_0xa1c9('0x25')](function(_0x3ca392){if(_0x3ca392){_0x313ec7['applications'][_0xa1c9('0x66')]({'id':0x0,'priority':0x1,'app':_0xa1c9('0x69'),'appdata':_0x3ca392[_0xa1c9('0x65')]+','+(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x6a')]||0x12c),'interval':_0xa1c9('0x4c')});}return respondWithRpcPromise(_0xa1c9('0x6b'),_0xa1c9('0x6c'),_0x313ec7);})['then'](function(_0x51ef57){_0x4c1a9e(_0x51ef57);})[_0xa1c9('0x1a')](function(_0x5b7df9){_0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0x5b7df9[_0xa1c9('0x18')]));});});}; \ No newline at end of file +var _0x1115=['UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','List','Contacts','Applications','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','from','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','originTo','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0x1115,0x1b6));var _0x5111=function(_0xee13c,_0x4fb4ca){_0xee13c=_0xee13c-0x0;var _0x51fee5=_0x1115[_0xee13c];return _0x51fee5;};'use strict';var _=require('lodash');var moment=require(_0x5111('0x0'));var BPromise=require(_0x5111('0x1'));var rs=require(_0x5111('0x2'));var Redis=require(_0x5111('0x3'));var db=require(_0x5111('0x4'))['db'];var logger=require(_0x5111('0x5'))(_0x5111('0x6'));var config=require(_0x5111('0x7'));var jayson=require(_0x5111('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x5111('0x9')]=_[_0x5111('0xa')](config['redis'],{'host':_0x5111('0xb'),'port':0x18eb});var socket=require(_0x5111('0xc'))(new Redis(config['redis']));require(_0x5111('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d8e0a,_0x3bbc8c,_0x4ecb50){return new BPromise(function(_0x5e12a7,_0x347d87){return client['request'](_0x2d8e0a,_0x4ecb50)[_0x5111('0xe')](function(_0x4f0b34){logger[_0x5111('0xf')](_0x5111('0x10'),_0x3bbc8c,_0x5111('0x11'));logger[_0x5111('0x12')](_0x5111('0x13'),_0x3bbc8c,_0x5111('0x11'),JSON[_0x5111('0x14')](_0x4f0b34));if(_0x4f0b34[_0x5111('0x15')]){if(_0x4f0b34[_0x5111('0x15')][_0x5111('0x16')]===0x1f4){logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x4f0b34[_0x5111('0x15')][_0x5111('0x17')]);return _0x347d87(_0x4f0b34[_0x5111('0x15')][_0x5111('0x17')]);}logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x4f0b34['error'][_0x5111('0x17')]);return _0x5e12a7(_0x4f0b34['error']['message']);}else{logger[_0x5111('0xf')](_0x5111('0x10'),_0x3bbc8c,_0x5111('0x11'));_0x5e12a7(_0x4f0b34['result'][_0x5111('0x17')]);}})[_0x5111('0x18')](function(_0x52c614){logger[_0x5111('0x15')](_0x5111('0x10'),_0x3bbc8c,_0x52c614);_0x347d87(_0x52c614);});});}exports[_0x5111('0x19')]=function(_0x1b3b45){var _0x5e8f1d=this;return new Promise(function(_0x52d236,_0x2a1840){return db[_0x5111('0x1a')][_0x5111('0x1b')]({'raw':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1e')]||null:null,'attributes':_0x1b3b45['options']?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x1f')]||null:null,'limit':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45['options'][_0x5111('0x20')]||null:null,'include':_0x1b3b45[_0x5111('0x1c')]?_0x1b3b45[_0x5111('0x1c')][_0x5111('0x21')]?_[_0x5111('0x22')](_0x1b3b45[_0x5111('0x1c')][_0x5111('0x21')],function(_0x316b39){return{'model':db[_0x316b39[_0x5111('0x23')]],'as':_0x316b39['as'],'attributes':_0x316b39[_0x5111('0x1f')],'include':_0x316b39['include']?_[_0x5111('0x22')](_0x316b39[_0x5111('0x21')],function(_0x151b67){return{'model':db[_0x151b67[_0x5111('0x23')]],'as':_0x151b67['as'],'attributes':_0x151b67[_0x5111('0x1f')],'include':_0x151b67[_0x5111('0x21')]?_[_0x5111('0x22')](_0x151b67['include'],function(_0x1ce17f){return{'model':db[_0x1ce17f[_0x5111('0x23')]],'as':_0x1ce17f['as'],'attributes':_0x1ce17f[_0x5111('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdf9031){logger[_0x5111('0xf')](_0x5111('0x19'),_0x1b3b45);logger['debug']('GetMailAccount',_0x1b3b45,JSON[_0x5111('0x14')](_0xdf9031));_0x52d236(_0xdf9031);})['catch'](function(_0xbacf9e){logger['error'](_0x5111('0x19'),_0xbacf9e['message'],_0x1b3b45);_0x2a1840(_0x5e8f1d['error'](0x1f4,_0xbacf9e['message']));});});};exports[_0x5111('0x24')]=function(_0x3fb9a5){var _0xe0839e=this;return new Promise(function(_0x3763f4,_0x13fafe){return db[_0x5111('0x1a')][_0x5111('0x25')]({'raw':_0x3fb9a5['options']?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fb9a5[_0x5111('0x1c')]?_0x3fb9a5[_0x5111('0x1c')]['where']||null:null,'attributes':_0x3fb9a5['options']?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x1f')]||null:null,'include':_0x3fb9a5[_0x5111('0x1c')]?_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x21')]?_[_0x5111('0x22')](_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x21')],function(_0x4d4bf5){return{'model':db[_0x4d4bf5[_0x5111('0x23')]],'as':_0x4d4bf5['as'],'attributes':_0x4d4bf5[_0x5111('0x1f')],'include':_0x4d4bf5[_0x5111('0x21')]?_['map'](_0x4d4bf5[_0x5111('0x21')],function(_0xdc5c58){return{'model':db[_0xdc5c58[_0x5111('0x23')]],'as':_0xdc5c58['as'],'attributes':_0xdc5c58['attributes'],'include':_0xdc5c58['include']?_['map'](_0xdc5c58[_0x5111('0x21')],function(_0x187cab){return{'model':db[_0x187cab[_0x5111('0x23')]],'as':_0x187cab['as'],'attributes':_0x187cab[_0x5111('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5111('0xe')](function(_0x570126){if(_0x3fb9a5[_0x5111('0x1c')][_0x5111('0x26')]===!![])_0x570126[_0x5111('0x27')](_0x5111('0x28'),_0x570126['getSmtpOptions']());logger[_0x5111('0xf')](_0x5111('0x24'),_0x3fb9a5);logger[_0x5111('0x12')](_0x5111('0x24'),_0x3fb9a5,JSON[_0x5111('0x14')](_0x570126));_0x3763f4(_0x570126);})[_0x5111('0x18')](function(_0x295d5e){logger[_0x5111('0x15')](_0x5111('0x24'),_0x295d5e[_0x5111('0x17')],_0x3fb9a5);_0x13fafe(_0xe0839e[_0x5111('0x15')](0x1f4,_0x295d5e[_0x5111('0x17')]));});});};exports[_0x5111('0x29')]=function(_0x4e0bc4){var _0x352de9=this;return new Promise(function(_0xf00f9,_0x54d2f1){var _0x2818ec={'body':_0x4e0bc4[_0x5111('0x2a')],'channel':_0x5111('0x2b')};var _0x41005f=_[_0x5111('0x2c')](_[_0x5111('0x2d')](db[_0x5111('0x2e')]['rawAttributes']),[_0x5111('0x2f'),_0x5111('0x30'),_0x5111('0x31'),_0x5111('0x32')]);var _0x96893c=![];if(_0x4e0bc4['body']['id']){delete _0x4e0bc4['body']['id'];}if(_[_0x5111('0x33')](_0x4e0bc4[_0x5111('0x2a')]['from'])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x34')));}if(_[_0x5111('0x33')](_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x2a')])||_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x2a')]===''){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x35')));}if(_[_0x5111('0x33')](_0x4e0bc4['body']['mapKey'])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x5111('0x36')+_0x41005f));}if(!_[_0x5111('0x37')](_0x41005f,_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x38')])){return _0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x41005f));}var _0x1b9a74={};_0x1b9a74[_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x38')]]=_0x4e0bc4[_0x5111('0x2a')]['from'];return db[_0x5111('0x1a')][_0x5111('0x25')]({'where':{'id':_0x4e0bc4[_0x5111('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x5111('0x3a'),'include':[{'model':db[_0x5111('0x2e')],'as':_0x5111('0x3b'),'where':_0x1b9a74,'limit':0x1,'order':[[_0x5111('0x30'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x5111('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x5111('0x3d')],'as':_0x5111('0x3d')}]}]})['then'](function(_0x296f87){if(_0x296f87&&_0x296f87[_0x5111('0x3a')]){var _0x1676f9=_0x296f87[_0x5111('0x3e')]({'plain':!![]});_0x2818ec[_0x5111('0x39')]=_[_0x5111('0x3f')](_0x1676f9,[_0x5111('0x3c'),_0x5111('0x3a')]);_0x2818ec[_0x5111('0x39')][_0x5111('0x28')]=_0x296f87[_0x5111('0x40')]();_0x2818ec[_0x5111('0x41')]=_0x1676f9['Applications'];_0x2818ec[_0x5111('0x42')]=_0x1676f9[_0x5111('0x3a')];_0x2818ec[_0x5111('0x41')]=_[_0x5111('0x43')](_0x2818ec[_0x5111('0x41')],[_0x5111('0x44')],[_0x5111('0x45')]);if(_0x2818ec['account']&&_0x2818ec['account'][_0x5111('0x46')]){_0x2818ec['applications'][_0x5111('0x47')]({'id':0x0,'priority':_0x2818ec[_0x5111('0x41')][_0x5111('0x48')]+0x1,'app':_0x5111('0x49'),'appdata':_0x5111('0x46'),'interval':_0x5111('0x4a')});}if(_0x2818ec[_0x5111('0x39')]['Applications']){delete _0x2818ec[_0x5111('0x39')][_0x5111('0x3c')];}if(_0x2818ec['account'][_0x5111('0x3a')]){delete _0x2818ec[_0x5111('0x39')]['List'];}if(_0x1676f9[_0x5111('0x3a')]['Contacts']['length']){return _0x1676f9['List'][_0x5111('0x3b')][0x0];}var _0x30fb6d=_[_0x5111('0xa')](_0x4e0bc4[_0x5111('0x2a')],{'firstName':_0x4e0bc4['body'][_0x5111('0x4b')],'ListId':_0x1676f9[_0x5111('0x32')]});_0x30fb6d[_0x4e0bc4[_0x5111('0x2a')]['mapKey']]=_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x4b')];return db[_0x5111('0x2e')]['create'](_0x30fb6d);}else{throw new Error(_0x5111('0x4c'));}})['then'](function(_0x3bf42d){_0x2818ec[_0x5111('0x4d')]=_0x3bf42d;if(_0x3bf42d){if(!_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['messageId']){_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4e')]=rs[_0x5111('0x4f')]()+'\x20'+_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')];}var _0x54c415={'ContactId':_0x3bf42d['id'],'MailAccountId':_0x4e0bc4[_0x5111('0x39')]['id'],'inReplyTo':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'cc':_0x4e0bc4[_0x5111('0x2a')]['message']['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x51')],'lastMsgAt':moment()['format'](_0x5111('0x52')),'lastMsgDirection':'in'};return db[_0x5111('0x53')][_0x5111('0x25')]({'where':{'closed':![],'MailAccountId':_0x4e0bc4[_0x5111('0x39')]['id']},'include':[{'model':db[_0x5111('0x54')],'as':'Messages','attributes':[_0x5111('0x4e')],'where':{'messageId':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x55')]}}]})[_0x5111('0xe')](function(_0x39de80){if(_0x39de80){return[_0x39de80,![]];}return db[_0x5111('0x53')]['create'](_0x54c415)['then'](function(_0x4eaed9){return[_0x4eaed9,!![]];});});}else{throw new Error(_0x5111('0x56'));}})[_0x5111('0x57')](function(_0x1674d6,_0x3fb713){if(_0x1674d6){_0x96893c=_0x3fb713;if(!_0x3fb713){return _0x1674d6[_0x5111('0x58')]({'inReplyTo':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'cc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x1674d6['attach']?_0x1674d6[_0x5111('0x51')]:_0x4e0bc4[_0x5111('0x2a')]['message'][_0x5111('0x51')],'substatus':null,'substatusAt':moment()[_0x5111('0x59')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x5111('0x59')](_0x5111('0x52')),'lastMsgDirection':'in'});}else{return _0x1674d6;}}})[_0x5111('0xe')](function(_0x3a7cc9){_0x2818ec[_0x5111('0x5a')]=_0x3a7cc9[_0x5111('0x3e')]({'plain':!![]});_0x2818ec[_0x5111('0x5a')]['created']=_0x96893c;return db[_0x5111('0x54')]['create']({'body':_0x4e0bc4['body'][_0x5111('0x2a')],'MailAccountId':_0x4e0bc4['account']['id'],'MailInteractionId':_0x3a7cc9['id'],'direction':'in','ContactId':_0x2818ec[_0x5111('0x4d')]['id'],'messageId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x4e')],'from':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x4b')],'to':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['to'],'cc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['cc'],'subject':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x50')],'attach':_0x4e0bc4[_0x5111('0x2a')]['message'][_0x5111('0x51')],'Attachments':_0x4e0bc4['body'][_0x5111('0x17')]['attachments'],'originTo':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x5b')],'originCc':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')]['originCc'],'bcc':_0x4e0bc4['body'][_0x5111('0x17')]['bcc'],'ChatWebsiteId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x5c')]||null,'originChannel':_0x4e0bc4[_0x5111('0x2a')][_0x5111('0x17')][_0x5111('0x5d')]||_0x5111('0x5e'),'ChatOfflineMessageId':_0x4e0bc4['body'][_0x5111('0x17')][_0x5111('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0x5111('0x60')}]});})['then'](function(_0x1ffb56){_0x2818ec[_0x5111('0x17')]=_0x1ffb56;if(!_0x2818ec[_0x5111('0x5a')][_0x5111('0x61')]){return;}return db['User'][_0x5111('0x25')]({'attributes':['id','name'],'where':{'id':_0x2818ec[_0x5111('0x5a')]['UserId']}});})[_0x5111('0xe')](function(_0x335919){if(_0x335919){_0x2818ec[_0x5111('0x41')][_0x5111('0x62')]({'id':0x0,'priority':0x0,'app':_0x5111('0x63'),'appdata':_0x335919[_0x5111('0x64')]+','+(_0x2818ec[_0x5111('0x39')][_0x5111('0x65')]||0xa),'interval':'*,*,*,*'});}if(!_0x2818ec[_0x5111('0x5a')][_0x5111('0x66')]){return;}return db[_0x5111('0x67')][_0x5111('0x25')]({'attributes':['id',_0x5111('0x64')],'where':{'id':_0x2818ec['interaction'][_0x5111('0x66')]}});})[_0x5111('0xe')](function(_0x5d2772){if(_0x5d2772){_0x2818ec[_0x5111('0x41')][_0x5111('0x62')]({'id':0x0,'priority':0x1,'app':_0x5111('0x68'),'appdata':_0x5d2772['name']+','+(_0x2818ec[_0x5111('0x39')][_0x5111('0x69')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5111('0x6a'),'startRouting',_0x2818ec);})[_0x5111('0xe')](function(_0x5dcc50){_0xf00f9(_0x5dcc50);})[_0x5111('0x18')](function(_0x44b7ff){_0x54d2f1(_0x352de9[_0x5111('0x15')](0x1f4,_0x44b7ff[_0x5111('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 946c1ae..b81cc2d 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 _0x5255=['remove','removeListener','register','length','./mailAccount.events'];(function(_0x55d2b6,_0x3139b5){var _0x25d808=function(_0x32eb29){while(--_0x32eb29){_0x55d2b6['push'](_0x55d2b6['shift']());}};_0x25d808(++_0x3139b5);}(_0x5255,0xd1));var _0x5525=function(_0x10561e,_0xdb354d){_0x10561e=_0x10561e-0x0;var _0x5bdc82=_0x5255[_0x10561e];return _0x5bdc82;};'use strict';var MailAccountEvents=require(_0x5525('0x0'));var events=['save',_0x5525('0x1'),'update'];function createListener(_0xc0a40f,_0x509851){return function(_0x5d19cf){_0x509851['emit'](_0xc0a40f,_0x5d19cf);};}function removeListener(_0x35126f,_0x3f54c2){return function(){MailAccountEvents[_0x5525('0x2')](_0x35126f,_0x3f54c2);};}exports[_0x5525('0x3')]=function(_0x471e3c){for(var _0x46037f=0x0,_0x214256=events[_0x5525('0x4')];_0x46037f<_0x214256;_0x46037f++){var _0x1eced1=events[_0x46037f];var _0x17c355=createListener('mailAccount:'+_0x1eced1,_0x471e3c);MailAccountEvents['on'](_0x1eced1,_0x17c355);}}; \ No newline at end of file +var _0xc916=['removeListener','register','length','mailAccount:','remove','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc916,0x1d2));var _0x6c91=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xc916[_0x3f8a03];return _0x147fb2;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x6c91('0x0'),_0x6c91('0x1')];function createListener(_0x263cba,_0x41a0dc){return function(_0x3a9abd){_0x41a0dc['emit'](_0x263cba,_0x3a9abd);};}function removeListener(_0x1beace,_0x3c946f){return function(){MailAccountEvents[_0x6c91('0x2')](_0x1beace,_0x3c946f);};}exports[_0x6c91('0x3')]=function(_0x470f43){for(var _0x110132=0x0,_0x3b8290=events[_0x6c91('0x4')];_0x110132<_0x3b8290;_0x110132++){var _0x440ae4=events[_0x110132];var _0x3e1262=createListener(_0x6c91('0x5')+_0x440ae4,_0x470f43);MailAccountEvents['on'](_0x440ae4,_0x3e1262);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 94cc939..f61b8fa 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 _0x2f44=['show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f44,0x1f3));var _0x42f4=function(_0x3a1058,_0x255329){_0x3a1058=_0x3a1058-0x0;var _0x2509c5=_0x2f44[_0x3a1058];return _0x2509c5;};'use strict';var multer=require(_0x42f4('0x0'));var util=require(_0x42f4('0x1'));var path=require(_0x42f4('0x2'));var timeout=require(_0x42f4('0x3'));var express=require(_0x42f4('0x4'));var router=express[_0x42f4('0x5')]();var fs_extra=require(_0x42f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x42f4('0x7'));var config=require('../../config/environment');var controller=require(_0x42f4('0x8'));router['get'](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller[_0x42f4('0xb')]);router[_0x42f4('0xc')](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller['update']);router[_0x42f4('0xd')](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller[_0x42f4('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3af1=['./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x3af1,0xd5));var _0x13af=function(_0x4637a1,_0x161fae){_0x4637a1=_0x4637a1-0x0;var _0x1d80bf=_0x3af1[_0x4637a1];return _0x1d80bf;};'use strict';var multer=require('multer');var util=require(_0x13af('0x0'));var path=require('path');var timeout=require(_0x13af('0x1'));var express=require(_0x13af('0x2'));var router=express[_0x13af('0x3')]();var fs_extra=require(_0x13af('0x4'));var auth=require(_0x13af('0x5'));var interaction=require(_0x13af('0x6'));var config=require(_0x13af('0x7'));var controller=require(_0x13af('0x8'));router[_0x13af('0x9')]('/:id',auth[_0x13af('0xa')](),controller[_0x13af('0xb')]);router[_0x13af('0xc')](_0x13af('0xd'),auth[_0x13af('0xa')](),controller[_0x13af('0xe')]);router[_0x13af('0xf')]('/:id',auth[_0x13af('0xa')](),controller[_0x13af('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 22ad83d..6ab6fb4 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 _0xae01=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xfa7140,_0x2cde39){var _0x3fe00e=function(_0x536685){while(--_0x536685){_0xfa7140['push'](_0xfa7140['shift']());}};_0x3fe00e(++_0x2cde39);}(_0xae01,0xb1));var _0x1ae0=function(_0x85de0a,_0x753f0e){_0x85de0a=_0x85de0a-0x0;var _0xbe267a=_0xae01[_0x85de0a];return _0xbe267a;};'use strict';var Sequelize=require(_0x1ae0('0x0'));module[_0x1ae0('0x1')]={'priority':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1ae0('0x3')]()},'description':{'type':Sequelize[_0x1ae0('0x4')]},'interval':{'type':Sequelize[_0x1ae0('0x4')],'defaultValue':_0x1ae0('0x5')}}; \ No newline at end of file +var _0x2230=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x5764e7,_0x332961){var _0x51a13f=function(_0x3be68d){while(--_0x3be68d){_0x5764e7['push'](_0x5764e7['shift']());}};_0x51a13f(++_0x332961);}(_0x2230,0xfb));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x0223('0x0')]={'priority':{'type':Sequelize[_0x0223('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0223('0x2')],'allowNull':![],'defaultValue':_0x0223('0x3')},'appdata':{'type':Sequelize[_0x0223('0x4')]()},'description':{'type':Sequelize[_0x0223('0x2')]},'interval':{'type':Sequelize[_0x0223('0x2')],'defaultValue':_0x0223('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index dd557df..95bd763 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 _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xaa88[_0x3e3bee];return _0x3ae14c;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x22209b,_0x1f14f6){var _0x58e53f=function(_0x536d03){while(--_0x536d03){_0x22209b['push'](_0x22209b['shift']());}};_0x58e53f(++_0x1f14f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 179d41b..21169db 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 _0x8d57=['util','../../config/logger','api','moment','path','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash'];(function(_0x2fac71,_0x2ae81d){var _0x28cb27=function(_0x348dc6){while(--_0x348dc6){_0x2fac71['push'](_0x2fac71['shift']());}};_0x28cb27(++_0x2ae81d);}(_0x8d57,0xb3));var _0x78d5=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x8d57[_0x1e4f2f];return _0xccea89;};'use strict';var _=require(_0x78d5('0x0'));var util=require(_0x78d5('0x1'));var logger=require(_0x78d5('0x2'))(_0x78d5('0x3'));var moment=require(_0x78d5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78d5('0x5'));var rimraf=require('rimraf');var config=require(_0x78d5('0x6'));var attributes=require('./mailApplication.attributes');module[_0x78d5('0x7')]=function(_0x1a5eaf,_0x1df2f7){return _0x1a5eaf[_0x78d5('0x8')](_0x78d5('0x9'),attributes,{'tableName':_0x78d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78d5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x530b=['../../config/logger','api','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x15fc16,_0xc61c16){var _0x517f01=function(_0x101827){while(--_0x101827){_0x15fc16['push'](_0x15fc16['shift']());}};_0x517f01(++_0xc61c16);}(_0x530b,0x1ae));var _0xb530=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x530b[_0x1b2255];return _0x33e57d;};'use strict';var _=require(_0xb530('0x0'));var util=require(_0xb530('0x1'));var logger=require(_0xb530('0x2'))(_0xb530('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb530('0x4'));var rimraf=require(_0xb530('0x5'));var config=require(_0xb530('0x6'));var attributes=require('./mailApplication.attributes');module[_0xb530('0x7')]=function(_0x53e93e,_0x438295){return _0x53e93e[_0xb530('0x8')](_0xb530('0x9'),attributes,{'tableName':_0xb530('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb530('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d3a3034..6849513 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 _0x206a=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','catch','lodash'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x206a,0xd1));var _0xa206=function(_0x2b7d12,_0x32d47e){_0x2b7d12=_0x2b7d12-0x0;var _0x435fe8=_0x206a[_0x2b7d12];return _0x435fe8;};'use strict';var _=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var moment=require('moment');var BPromise=require(_0xa206('0x2'));var rs=require(_0xa206('0x3'));var fs=require('fs');var Redis=require(_0xa206('0x4'));var db=require(_0xa206('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa206('0x6'));var config=require('../../config/environment');var jayson=require(_0xa206('0x7'));var client=jayson[_0xa206('0x8')][_0xa206('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b5a09,_0x5411af,_0x5057a7){return new BPromise(function(_0xfcb123,_0x2eb4e2){return client[_0xa206('0xa')](_0x4b5a09,_0x5057a7)[_0xa206('0xb')](function(_0x5cb034){logger[_0xa206('0xc')]('MailApplication,\x20%s,\x20%s',_0x5411af,_0xa206('0xd'));logger[_0xa206('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5411af,'request\x20sent',JSON[_0xa206('0xf')](_0x5cb034));if(_0x5cb034['error']){if(_0x5cb034[_0xa206('0x10')][_0xa206('0x11')]===0x1f4){logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x5cb034['error']['message']);return _0x2eb4e2(_0x5cb034[_0xa206('0x10')][_0xa206('0x13')]);}logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x5cb034[_0xa206('0x10')][_0xa206('0x13')]);return _0xfcb123(_0x5cb034[_0xa206('0x10')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x5411af,'request\x20sent');_0xfcb123(_0x5cb034[_0xa206('0x14')][_0xa206('0x13')]);}})['catch'](function(_0x1d6a1d){logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x1d6a1d);_0x2eb4e2(_0x1d6a1d);});});}exports[_0xa206('0x15')]=function(_0x1f53e0){var _0x442a3e=this;return new Promise(function(_0xba7eb7,_0xd9d3c0){return db[_0xa206('0x16')]['update'](_0x1f53e0[_0xa206('0x17')],{'raw':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0[_0xa206('0x18')][_0xa206('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0['options'][_0xa206('0x1a')]||null:null,'attributes':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0['options'][_0xa206('0x1b')]||null:null,'limit':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0[_0xa206('0x18')][_0xa206('0x1c')]||null:null})['then'](function(_0x2f0a34){logger[_0xa206('0xc')](_0xa206('0x15'),_0x1f53e0);logger[_0xa206('0xe')](_0xa206('0x15'),_0x1f53e0,JSON[_0xa206('0xf')](_0x2f0a34));_0xba7eb7(_0x2f0a34);})[_0xa206('0x1d')](function(_0x355945){logger[_0xa206('0x10')](_0xa206('0x15'),_0x355945[_0xa206('0x13')],_0x1f53e0);_0xd9d3c0(_0x442a3e['error'](0x1f4,_0x355945['message']));});});}; \ No newline at end of file +var _0xfcbf=['request','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','options','raw','attributes','limit','debug','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x46b721,_0x5e8b5a){var _0x483295=function(_0x2e7219){while(--_0x2e7219){_0x46b721['push'](_0x46b721['shift']());}};_0x483295(++_0x5e8b5a);}(_0xfcbf,0x1b6));var _0xffcb=function(_0x581cd5,_0xfcbcb3){_0x581cd5=_0x581cd5-0x0;var _0x239538=_0xfcbf[_0x581cd5];return _0x239538;};'use strict';var _=require(_0xffcb('0x0'));var util=require(_0xffcb('0x1'));var moment=require(_0xffcb('0x2'));var BPromise=require(_0xffcb('0x3'));var rs=require(_0xffcb('0x4'));var fs=require('fs');var Redis=require(_0xffcb('0x5'));var db=require(_0xffcb('0x6'))['db'];var utils=require(_0xffcb('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xffcb('0x8'));var jayson=require(_0xffcb('0x9'));var client=jayson[_0xffcb('0xa')][_0xffcb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21ce76,_0x276ec0,_0x537a23){return new BPromise(function(_0x4c96a7,_0xb946c2){return client[_0xffcb('0xc')](_0x21ce76,_0x537a23)[_0xffcb('0xd')](function(_0x106b5d){logger['info'](_0xffcb('0xe'),_0x276ec0,'request\x20sent');logger['debug'](_0xffcb('0xf'),_0x276ec0,'request\x20sent',JSON[_0xffcb('0x10')](_0x106b5d));if(_0x106b5d[_0xffcb('0x11')]){if(_0x106b5d[_0xffcb('0x11')][_0xffcb('0x12')]===0x1f4){logger['error'](_0xffcb('0xe'),_0x276ec0,_0x106b5d[_0xffcb('0x11')][_0xffcb('0x13')]);return _0xb946c2(_0x106b5d[_0xffcb('0x11')][_0xffcb('0x13')]);}logger[_0xffcb('0x11')](_0xffcb('0xe'),_0x276ec0,_0x106b5d[_0xffcb('0x11')][_0xffcb('0x13')]);return _0x4c96a7(_0x106b5d[_0xffcb('0x11')][_0xffcb('0x13')]);}else{logger[_0xffcb('0x14')](_0xffcb('0xe'),_0x276ec0,_0xffcb('0x15'));_0x4c96a7(_0x106b5d[_0xffcb('0x16')][_0xffcb('0x13')]);}})[_0xffcb('0x17')](function(_0x52b551){logger[_0xffcb('0x11')](_0xffcb('0xe'),_0x276ec0,_0x52b551);_0xb946c2(_0x52b551);});});}exports['UpdateMailApplication']=function(_0x5a7bfe){var _0x4523a3=this;return new Promise(function(_0x57c167,_0x4fda18){return db['MailApplication']['update'](_0x5a7bfe['body'],{'raw':_0x5a7bfe[_0xffcb('0x18')]?_0x5a7bfe[_0xffcb('0x18')][_0xffcb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7bfe[_0xffcb('0x18')]?_0x5a7bfe[_0xffcb('0x18')]['where']||null:null,'attributes':_0x5a7bfe[_0xffcb('0x18')]?_0x5a7bfe[_0xffcb('0x18')][_0xffcb('0x1a')]||null:null,'limit':_0x5a7bfe['options']?_0x5a7bfe[_0xffcb('0x18')][_0xffcb('0x1b')]||null:null})[_0xffcb('0xd')](function(_0x1c49c9){logger[_0xffcb('0x14')]('UpdateMailApplication',_0x5a7bfe);logger[_0xffcb('0x1c')](_0xffcb('0x1d'),_0x5a7bfe,JSON[_0xffcb('0x10')](_0x1c49c9));_0x57c167(_0x1c49c9);})[_0xffcb('0x17')](function(_0x46e680){logger['error']('UpdateMailApplication',_0x46e680[_0xffcb('0x13')],_0x5a7bfe);_0x4fda18(_0x4523a3['error'](0x1f4,_0x46e680[_0xffcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index db4e43b..6215716 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 _0xa8ab=['isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe'];(function(_0x12b9c2,_0x2aa1be){var _0x424f3f=function(_0x3bb497){while(--_0x3bb497){_0x12b9c2['push'](_0x12b9c2['shift']());}};_0x424f3f(++_0x2aa1be);}(_0xa8ab,0x138));var _0xba8a=function(_0x1615ff,_0x213e66){_0x1615ff=_0x1615ff-0x0;var _0x3a5eb0=_0xa8ab[_0x1615ff];return _0x3a5eb0;};'use strict';var express=require(_0xba8a('0x0'));var router=express['Router']();var auth=require(_0xba8a('0x1'));var interaction=require(_0xba8a('0x2'));var controller=require(_0xba8a('0x3'));router[_0xba8a('0x4')]('/',auth['isAuthenticated'](),controller[_0xba8a('0x5')]);router[_0xba8a('0x4')](_0xba8a('0x6'),auth[_0xba8a('0x7')](),controller[_0xba8a('0x8')]);router['get'](_0xba8a('0x9'),auth['isAuthenticated'](),controller[_0xba8a('0xa')]);router[_0xba8a('0x4')](_0xba8a('0xb'),auth['isAuthenticated'](),controller[_0xba8a('0xc')]);router['get'](_0xba8a('0xd'),auth[_0xba8a('0x7')](),controller[_0xba8a('0xe')]);router[_0xba8a('0xf')]('/',auth[_0xba8a('0x7')](),controller[_0xba8a('0x10')]);router[_0xba8a('0xf')]('/:id/messages',auth[_0xba8a('0x7')](),controller[_0xba8a('0x11')]);router[_0xba8a('0xf')](_0xba8a('0x12'),auth['isAuthenticated'](),interaction[_0xba8a('0x13')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0xba8a('0x14')]('/:id',auth[_0xba8a('0x7')](),interaction['tracked'](_0xba8a('0x15'),_0xba8a('0x16')),controller[_0xba8a('0x17')]);router[_0xba8a('0x18')]('/:id',auth[_0xba8a('0x7')](),interaction['tracked'](_0xba8a('0x15'),_0xba8a('0x19')),controller[_0xba8a('0x1a')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xba8a('0x1b')]);module[_0xba8a('0x1c')]=router; \ No newline at end of file +var _0x0593=['download','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0593,0x1d1));var _0x3059=function(_0x853f65,_0x2de6e0){_0x853f65=_0x853f65-0x0;var _0x447b58=_0x0593[_0x853f65];return _0x447b58;};'use strict';var express=require(_0x3059('0x0'));var router=express[_0x3059('0x1')]();var auth=require(_0x3059('0x2'));var interaction=require(_0x3059('0x3'));var controller=require(_0x3059('0x4'));router[_0x3059('0x5')]('/',auth[_0x3059('0x6')](),controller[_0x3059('0x7')]);router['get'](_0x3059('0x8'),auth[_0x3059('0x6')](),controller[_0x3059('0x9')]);router[_0x3059('0x5')](_0x3059('0xa'),auth[_0x3059('0x6')](),controller[_0x3059('0xb')]);router['get'](_0x3059('0xc'),auth[_0x3059('0x6')](),controller[_0x3059('0xd')]);router[_0x3059('0x5')](_0x3059('0xe'),auth[_0x3059('0x6')](),controller[_0x3059('0xf')]);router[_0x3059('0x10')]('/',auth[_0x3059('0x6')](),controller['create']);router[_0x3059('0x10')](_0x3059('0xc'),auth[_0x3059('0x6')](),controller['addMessage']);router[_0x3059('0x10')](_0x3059('0x11'),auth[_0x3059('0x6')](),interaction[_0x3059('0x12')](_0x3059('0x13'),_0x3059('0x14')),controller[_0x3059('0x15')]);router[_0x3059('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x3059('0x12')](_0x3059('0x13'),_0x3059('0x17')),controller[_0x3059('0x18')]);router[_0x3059('0x19')](_0x3059('0xa'),auth[_0x3059('0x6')](),interaction[_0x3059('0x12')](_0x3059('0x13'),_0x3059('0x1a')),controller[_0x3059('0x1b')]);router[_0x3059('0x19')](_0x3059('0x11'),auth[_0x3059('0x6')](),controller[_0x3059('0x1c')]);module[_0x3059('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ad978fb..4f11801 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 _0x0a51=['long','ENUM','out','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x433dc5,_0x34ec43){var _0x5b7ce0=function(_0x4a3594){while(--_0x4a3594){_0x433dc5['push'](_0x433dc5['shift']());}};_0x5b7ce0(++_0x34ec43);}(_0x0a51,0xed));var _0x10a5=function(_0x336585,_0xa160ec){_0x336585=_0x336585-0x0;var _0x148887=_0x0a51[_0x336585];return _0x148887;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x10a5('0x0'));module[_0x10a5('0x1')]={'closed':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x10a5('0x3')]},'disposition':{'type':Sequelize[_0x10a5('0x4')]},'secondDisposition':{'type':Sequelize[_0x10a5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x10a5('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x10a5('0x4')]},'cc':{'type':Sequelize[_0x10a5('0x5')](_0x10a5('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x10a5('0x3')]},'substatus':{'type':Sequelize[_0x10a5('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x10a5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x10a5('0x7')]('in',_0x10a5('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x10a5('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x10a5('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd227=['DATE','STRING','long','TEXT','out','ENUM','INTEGER','sequelize','BOOLEAN'];(function(_0x5bf2fd,_0x3a9ef3){var _0x3de9c9=function(_0x1b0ab0){while(--_0x1b0ab0){_0x5bf2fd['push'](_0x5bf2fd['shift']());}};_0x3de9c9(++_0x3a9ef3);}(_0xd227,0x14b));var _0x7d22=function(_0x22c169,_0x3298a6){_0x22c169=_0x22c169-0x0;var _0x30cc6f=_0xd227[_0x22c169];return _0x30cc6f;};'use strict';var Sequelize=require(_0x7d22('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x7d22('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d22('0x2')]},'disposition':{'type':Sequelize[_0x7d22('0x3')]},'secondDisposition':{'type':Sequelize[_0x7d22('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7d22('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x7d22('0x4'))},'subject':{'type':Sequelize[_0x7d22('0x5')]()},'attach':{'type':Sequelize[_0x7d22('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7d22('0x2')]},'substatus':{'type':Sequelize[_0x7d22('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7d22('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d22('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7d22('0x7')]('in',_0x7d22('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7d22('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7d22('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 2bd46c5..e7fc82c 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 _0x16b5=['describe','addMessage','MailMessage','ids','omit','getMessages','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','count','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','createdAt','get','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','existsSync','readFileSync','writeFileSync','download','rimraf','zip-dir','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','end','json','undefined','limit','offset','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','map','MailInteraction','fieldName','type','getOptions','findAll','mail','query','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','create','body','find'];(function(_0x12f160,_0x41aba8){var _0xf30ab7=function(_0xb3c040){while(--_0xb3c040){_0x12f160['push'](_0x12f160['shift']());}};_0xf30ab7(++_0x41aba8);}(_0x16b5,0x9f));var _0x516b=function(_0xa3db69,_0x19c428){_0xa3db69=_0xa3db69-0x0;var _0x13a7e2=_0x16b5[_0xa3db69];return _0x13a7e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x516b('0x0'));var zipdir=require(_0x516b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x516b('0x2'));var path=require(_0x516b('0x3'));var fs=require('fs');var _=require(_0x516b('0x4'));var juice=require('juice');var Redis=require(_0x516b('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x516b('0x6'));var logger=require(_0x516b('0x7'))(_0x516b('0x8'));var config=require(_0x516b('0x9'));var db=require(_0x516b('0xa'))['db'];var htmlEntities=require(_0x516b('0xb'));config[_0x516b('0xc')]=_[_0x516b('0xd')](config[_0x516b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x516b('0xe'))[_0x516b('0xf')](socket);function respondWithStatusCode(_0x5eab24,_0x58a90d){_0x58a90d=_0x58a90d||0xcc;return function(_0x430a82){if(_0x430a82){return _0x5eab24['sendStatus'](_0x58a90d);}return _0x5eab24[_0x516b('0x10')](_0x58a90d)[_0x516b('0x11')]();};}function respondWithResult(_0x4c475b,_0x1a5c03){_0x1a5c03=_0x1a5c03||0xc8;return function(_0x17247d){if(_0x17247d){return _0x4c475b[_0x516b('0x10')](_0x1a5c03)[_0x516b('0x12')](_0x17247d);}};}function respondWithFilteredResult(_0x36974e,_0x326918){return function(_0x4883e5){if(_0x4883e5){var _0xae005=typeof _0x326918['offset']===_0x516b('0x13')&&typeof _0x326918[_0x516b('0x14')]===_0x516b('0x13');var _0xeae240=_0x4883e5['count'];var _0x7ed399=_0xae005?0x0:_0x326918[_0x516b('0x15')];var _0x1f9970=_0xae005?_0x4883e5['count']:_0x326918[_0x516b('0x15')]+_0x326918[_0x516b('0x14')];var _0x4f4255;if(_0x1f9970>=_0xeae240){_0x1f9970=_0xeae240;_0x4f4255=0xc8;}else{_0x4f4255=0xce;}_0x36974e['status'](_0x4f4255);return _0x36974e[_0x516b('0x16')](_0x516b('0x17'),_0x7ed399+'-'+_0x1f9970+'/'+_0xeae240)[_0x516b('0x12')](_0x4883e5);}return null;};}function saveUpdates(_0x32192b){return function(_0x456615){if(_0x456615){return _0x456615['update'](_0x32192b)[_0x516b('0x18')](function(_0x59c9c9){return _0x59c9c9;});}return null;};}function removeEntity(_0x5f18ca){return function(_0x4a339f){if(_0x4a339f){return _0x4a339f[_0x516b('0x19')]()[_0x516b('0x18')](function(){_0x5f18ca[_0x516b('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b55e9){return function(_0x486ae2){if(!_0x486ae2){_0x1b55e9[_0x516b('0x1a')](0x194);}return _0x486ae2;};}function handleError(_0x36052,_0x1c6052){_0x1c6052=_0x1c6052||0x1f4;return function(_0x13e5df){logger[_0x516b('0x1b')](_0x13e5df[_0x516b('0x1c')]);if(_0x13e5df['name']){delete _0x13e5df[_0x516b('0x1d')];}_0x36052[_0x516b('0x10')](_0x1c6052)[_0x516b('0x1e')](_0x13e5df);};}exports['index']=function(_0x5bcd8c,_0x2301cd){var _0x18f942={};var _0xce4c9d=_[_0x516b('0x1f')](db[_0x516b('0x20')]['rawAttributes'],function(_0x3dee8c){return{'name':_0x3dee8c[_0x516b('0x21')],'type':_0x3dee8c[_0x516b('0x22')]['key']};});_0x18f942=qs[_0x516b('0x23')](_0xce4c9d,_0x5bcd8c);return interaction[_0x516b('0x24')](_0x516b('0x25'),_0x5bcd8c[_0x516b('0x26')],_0x5bcd8c['user'],_0x18f942,_0xce4c9d)[_0x516b('0x18')](respondWithFilteredResult(_0x2301cd,_0x18f942))[_0x516b('0x27')](handleError(_0x2301cd,null));};exports[_0x516b('0x28')]=function(_0x1ab6aa,_0x5ee2aa){var _0x447381={'raw':![],'where':{'id':_0x1ab6aa[_0x516b('0x29')]['id']}},_0x18ff37={};_0x18ff37[_0x516b('0x2a')]=_[_0x516b('0x2b')](db[_0x516b('0x20')][_0x516b('0x2c')]);_0x18ff37[_0x516b('0x26')]=_[_0x516b('0x2b')](_0x1ab6aa[_0x516b('0x26')]);_0x18ff37[_0x516b('0x2d')]=_[_0x516b('0x2e')](_0x18ff37[_0x516b('0x2a')],_0x18ff37['query']);_0x447381[_0x516b('0x2f')]=_['intersection'](_0x18ff37[_0x516b('0x2a')],qs['fields'](_0x1ab6aa['query'][_0x516b('0x30')]));_0x447381['attributes']=_0x447381[_0x516b('0x2f')][_0x516b('0x31')]?_0x447381[_0x516b('0x2f')]:_0x18ff37[_0x516b('0x2a')];if(_0x1ab6aa[_0x516b('0x26')][_0x516b('0x32')]){_0x447381[_0x516b('0x33')]=[{'all':!![]}];}_0x447381=_['merge']({},_0x447381,_0x1ab6aa['options']);return db['MailInteraction']['find'](_0x447381)[_0x516b('0x18')](handleEntityNotFound(_0x5ee2aa,null))[_0x516b('0x18')](respondWithResult(_0x5ee2aa,null))[_0x516b('0x27')](handleError(_0x5ee2aa,null));};exports[_0x516b('0x34')]=function(_0x5c4e71,_0xd3aa44){return db[_0x516b('0x20')][_0x516b('0x34')](_0x5c4e71[_0x516b('0x35')],{})['then'](respondWithResult(_0xd3aa44,0xc9))[_0x516b('0x27')](handleError(_0xd3aa44,null));};exports['update']=function(_0x4b2bf4,_0x193a06){if(_0x4b2bf4[_0x516b('0x35')]['id']){delete _0x4b2bf4[_0x516b('0x35')]['id'];}return db['MailInteraction'][_0x516b('0x36')]({'where':{'id':_0x4b2bf4[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x193a06,null))[_0x516b('0x18')](saveUpdates(_0x4b2bf4[_0x516b('0x35')],null))[_0x516b('0x18')](respondWithResult(_0x193a06,null))[_0x516b('0x27')](handleError(_0x193a06,null));};exports[_0x516b('0x19')]=function(_0xd62a35,_0x50b28a){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0xd62a35[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x50b28a,null))[_0x516b('0x18')](removeEntity(_0x50b28a,null))[_0x516b('0x27')](handleError(_0x50b28a,null));};exports['describe']=function(_0x51b561,_0x5383a6){return db['MailInteraction'][_0x516b('0x37')]()['then'](respondWithResult(_0x5383a6,null))['catch'](handleError(_0x5383a6,null));};exports[_0x516b('0x38')]=function(_0x58f311,_0x661f35){return db[_0x516b('0x39')][_0x516b('0x36')]({'where':{'id':_0x58f311[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x661f35,null))['then'](function(_0x54fd72){if(_0x54fd72){return _0x54fd72['addMessage'](_0x58f311[_0x516b('0x35')][_0x516b('0x3a')],_[_0x516b('0x3b')](_0x58f311[_0x516b('0x35')],[_0x516b('0x3a'),'id'])||{});}})[_0x516b('0x18')](respondWithResult(_0x661f35,null))[_0x516b('0x27')](handleError(_0x661f35,null));};exports[_0x516b('0x3c')]=function(_0x66b297,_0x27c685){var _0x17e07b={'raw':![],'where':{}};var _0x37ec56={};var _0x2a3d96={'count':0x0,'rows':[]};return db[_0x516b('0x20')]['findOne']({'where':{'id':_0x66b297[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x27c685,null))[_0x516b('0x18')](function(_0x158f0e){if(_0x158f0e){_0x37ec56['model']=_[_0x516b('0x2b')](db[_0x516b('0x39')]['rawAttributes']);_0x37ec56[_0x516b('0x26')]=_[_0x516b('0x2b')](_0x66b297[_0x516b('0x26')]);_0x37ec56[_0x516b('0x2d')]=_['intersection'](_0x37ec56[_0x516b('0x2a')],_0x37ec56['query']);_0x17e07b[_0x516b('0x2f')]=_[_0x516b('0x2e')](_0x37ec56[_0x516b('0x2a')],qs[_0x516b('0x30')](_0x66b297[_0x516b('0x26')]['fields']));_0x17e07b[_0x516b('0x2f')]=_0x17e07b[_0x516b('0x2f')]['length']?_0x17e07b[_0x516b('0x2f')]:_0x37ec56[_0x516b('0x2a')];if(!_0x66b297[_0x516b('0x26')]['hasOwnProperty']('nolimit')){_0x17e07b[_0x516b('0x14')]=qs[_0x516b('0x14')](_0x66b297[_0x516b('0x26')]['limit']);_0x17e07b[_0x516b('0x15')]=qs['offset'](_0x66b297[_0x516b('0x26')][_0x516b('0x15')]);}_0x17e07b[_0x516b('0x3d')]=qs[_0x516b('0x3e')](_0x66b297['query'][_0x516b('0x3e')]);_0x17e07b['where']=qs[_0x516b('0x2d')](_['pick'](_0x66b297[_0x516b('0x26')],_0x37ec56[_0x516b('0x2d')]));_0x17e07b[_0x516b('0x3f')][_0x516b('0x40')]=_0x158f0e['id'];if(_0x66b297[_0x516b('0x26')][_0x516b('0x41')]){_0x17e07b['where']=_['merge'](_0x17e07b['where'],{'$or':_['map'](_0x17e07b[_0x516b('0x2f')],function(_0x35c74e){var _0x582a66={};_0x582a66[_0x35c74e]={'$like':'%'+_0x66b297['query'][_0x516b('0x41')]+'%'};return _0x582a66;})});}if(_0x66b297['query'][_0x516b('0x42')]){var _0x57b0bb=_0x66b297[_0x516b('0x26')][_0x516b('0x42')][_0x516b('0x43')](',');var _0x3cb425={};_0x3cb425[_0x57b0bb[0x0]]={'$gte':moment(_0x57b0bb[0x1])[_0x516b('0x44')](_0x516b('0x45'))};_0x17e07b[_0x516b('0x3f')]=_['merge'](_0x17e07b[_0x516b('0x3f')],_0x3cb425);}_0x17e07b=_[_0x516b('0x46')]({},_0x17e07b,_0x66b297['options']);return db['MailMessage'][_0x516b('0x47')]({'where':_0x17e07b['where']})[_0x516b('0x18')](function(_0x270201){_0x2a3d96[_0x516b('0x47')]=_0x270201;if(_0x66b297[_0x516b('0x26')][_0x516b('0x32')]){_0x17e07b['include']=[{'all':!![]}];}return db[_0x516b('0x39')]['findAll'](_0x17e07b);})['then'](function(_0x44c12b){if(_0x66b297[_0x516b('0x26')]['inlineCss']===_0x516b('0x48')){for(var _0x328237=0x0;_0x328237<_0x44c12b[_0x516b('0x31')];_0x328237++){_0x44c12b[_0x328237][_0x516b('0x35')]=juice(_0x44c12b[_0x328237][_0x516b('0x35')]);}}_0x2a3d96[_0x516b('0x49')]=_0x44c12b;return _0x2a3d96;});}})['then'](respondWithFilteredResult(_0x27c685,_0x17e07b))[_0x516b('0x27')](handleError(_0x27c685,null));};exports[_0x516b('0x4a')]=function(_0x49e7a8,_0x42d844){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x49e7a8[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x42d844,null))[_0x516b('0x18')](function(_0x4b396f){if(_0x4b396f){return _0x4b396f[_0x516b('0x4b')](_0x49e7a8[_0x516b('0x35')]['ids'],_[_0x516b('0x3b')](_0x49e7a8[_0x516b('0x35')],[_0x516b('0x3a'),'id'])||{})[_0x516b('0x4c')](function(){return db[_0x516b('0x4d')][_0x516b('0x24')]({'attributes':['id','name',_0x516b('0x4e')],'where':{'id':_0x49e7a8['body'][_0x516b('0x3a')]}});})[_0x516b('0x18')](function(_0x2f75a1){socket['emit'](_0x516b('0x4f'),{'id':Number(_0x49e7a8[_0x516b('0x29')]['id']),'tags':_0x2f75a1||[]});return{'id':Number(_0x49e7a8[_0x516b('0x29')]['id']),'tags':_0x2f75a1||[]};});}})[_0x516b('0x18')](respondWithResult(_0x42d844,null))[_0x516b('0x27')](handleError(_0x42d844,null));};exports['removeTags']=function(_0x5a4fe2,_0x15dee0){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x5a4fe2[_0x516b('0x29')]['id']}})['then'](handleEntityNotFound(_0x15dee0,null))['then'](function(_0x476f9e){if(_0x476f9e){return _0x476f9e[_0x516b('0x50')](_0x5a4fe2[_0x516b('0x26')]['ids']);}})[_0x516b('0x18')](respondWithStatusCode(_0x15dee0,null))[_0x516b('0x27')](handleError(_0x15dee0,null));};exports['download']=function(_0x1622ab,_0x491f1b){var _0x20398d=moment()[_0x516b('0x51')]()[_0x516b('0x52')]();var _0x3a7e85=path[_0x516b('0x53')](config[_0x516b('0x54')],_0x516b('0x55'),_0x516b('0x56'),_0x516b('0x57'));var _0x1e1c3a=path[_0x516b('0x53')](config[_0x516b('0x54')],_0x516b('0x55'),_0x516b('0x56'),_0x516b('0x58'));var _0x11a3a9=path[_0x516b('0x53')](_0x3a7e85,_0x20398d);var _0x2b93d0=util[_0x516b('0x44')](_0x516b('0x59'),_0x1622ab[_0x516b('0x29')]['id'],_0x20398d);var _0x2ab0fb=path['join'](_0x3a7e85,_0x2b93d0);var _0x51eea6=[];if(_0x1622ab[_0x516b('0x26')][_0x516b('0x58')]){_0x51eea6[_0x516b('0x5a')]({'model':db[_0x516b('0x5b')],'as':_0x516b('0x5c'),'raw':!![]});}var _0x3fd17d=[{'model':db['MailMessage'],'as':_0x516b('0x5d'),'attributes':['id',_0x516b('0x35'),_0x516b('0x5e'),'to','cc','bcc',_0x516b('0x5f'),_0x516b('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x51eea6}];return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x1622ab[_0x516b('0x29')]['id']},'include':_0x3fd17d})[_0x516b('0x18')](handleEntityNotFound(_0x491f1b,null))[_0x516b('0x18')](function(_0x266811){if(_0x266811&&_0x266811['Messages']){var _0x201f68=_0x266811[_0x516b('0x61')]({'plain':!![]});fs['mkdirSync'](_0x11a3a9);return BPromise['each'](_0x201f68[_0x516b('0x5d')],function(_0xfd5c21,_0x26f1b0){var _0x33e3e6={'from':_0xfd5c21[_0x516b('0x5e')],'to':_0xfd5c21['to']||_0x516b('0x62'),'subject':_0xfd5c21['subject'],'html':htmlEntities['decode'](_0xfd5c21[_0x516b('0x35')]),'headers':{'Date':moment(_0xfd5c21[_0x516b('0x60')])[_0x516b('0x44')](_0x516b('0x63'))},'attachments':[]};if(_0xfd5c21['cc']){_0x33e3e6['headers']['Cc']=_0xfd5c21['cc'];}if(_0xfd5c21[_0x516b('0x64')]){_0x33e3e6[_0x516b('0x65')][_0x516b('0x66')]=_0xfd5c21[_0x516b('0x64')];}return new BPromise(function(_0x202d35,_0x5e5bb9){if(_0xfd5c21['Attachments']){for(var _0x381208=0x0;_0x381208<_0xfd5c21['Attachments'][_0x516b('0x31')];_0x381208++){var _0x3e3b24=_0xfd5c21[_0x516b('0x5c')][_0x381208];var _0x565aab=path['join'](_0x1e1c3a,_0x3e3b24['basename']);if(fs[_0x516b('0x67')](_0x565aab)){_0x33e3e6['attachments'][_0x516b('0x5a')]({'name':_0x3e3b24['name'],'contentType':_0x3e3b24['type'],'data':fs[_0x516b('0x68')](_0x565aab)});}}}emlformat['build'](_0x33e3e6,function(_0x42fb5c,_0x43fb38){if(_0x42fb5c)return _0x5e5bb9(_0x42fb5c);fs[_0x516b('0x69')](path['join'](_0x11a3a9,util[_0x516b('0x44')]('message%d.eml',_0x26f1b0)),_0x43fb38);return _0x202d35(_0x43fb38);});});})[_0x516b('0x18')](function(){return new BPromise(function(_0x24b243,_0x4c2054){zipdir(_0x11a3a9,{'saveTo':_0x2ab0fb},function(_0x1d9678,_0x199411){if(_0x1d9678)return _0x4c2054(_0x1d9678);return _0x24b243(_0x199411);});})['then'](function(){return new BPromise(function(_0x4362b1,_0x236115){rimraf(_0x11a3a9,function(_0x4c942b){if(_0x4c942b)_0x236115(_0x4c942b);return _0x4362b1();});});})[_0x516b('0x18')](function(){return _0x491f1b[_0x516b('0x6a')](_0x2ab0fb,_0x2b93d0,function(_0x57aafb){if(!_0x57aafb)fs['unlinkSync'](_0x2ab0fb);});});});}else{return _0x491f1b[_0x516b('0x1a')](0xc8);}})[_0x516b('0x27')](handleError(_0x491f1b,null));}; \ No newline at end of file +var _0xd301=['split','format','findAll','inlineCss','true','rows','addTags','setTags','omit','spread','Tag','color','emit','removeTags','download','unix','toString','files','tmp','join','root','server','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','type','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','./mailInteraction.socket','register','status','end','json','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','MailInteraction','key','getOptions','mail','query','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','MailMessage','addMessage','ids','findOne','hasOwnProperty','offset','order','sort','where','MailInteractionId','filter','merge','$gte'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd301,0x114));var _0x1d30=function(_0x15a9cb,_0x2c5d45){_0x15a9cb=_0x15a9cb-0x0;var _0x4036e4=_0xd301[_0x15a9cb];return _0x4036e4;};'use strict';var emlformat=require(_0x1d30('0x0'));var rimraf=require(_0x1d30('0x1'));var zipdir=require(_0x1d30('0x2'));var moment=require(_0x1d30('0x3'));var BPromise=require(_0x1d30('0x4'));var util=require('util');var path=require(_0x1d30('0x5'));var fs=require('fs');var _=require(_0x1d30('0x6'));var juice=require(_0x1d30('0x7'));var Redis=require(_0x1d30('0x8'));var interaction=require(_0x1d30('0x9'));var qs=require(_0x1d30('0xa'));var logger=require('../../config/logger')(_0x1d30('0xb'));var config=require(_0x1d30('0xc'));var db=require(_0x1d30('0xd'))['db'];var htmlEntities=require(_0x1d30('0xe'));config['redis']=_[_0x1d30('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d30('0x10')]));require(_0x1d30('0x11'))[_0x1d30('0x12')](socket);function respondWithStatusCode(_0x82499b,_0x4beb42){_0x4beb42=_0x4beb42||0xcc;return function(_0x1b816f){if(_0x1b816f){return _0x82499b['sendStatus'](_0x4beb42);}return _0x82499b[_0x1d30('0x13')](_0x4beb42)[_0x1d30('0x14')]();};}function respondWithResult(_0x5cf265,_0x2d9984){_0x2d9984=_0x2d9984||0xc8;return function(_0x1af3a6){if(_0x1af3a6){return _0x5cf265[_0x1d30('0x13')](_0x2d9984)[_0x1d30('0x15')](_0x1af3a6);}};}function respondWithFilteredResult(_0x554370,_0x304e1e){return function(_0xad88b8){if(_0xad88b8){var _0x31e4e5=typeof _0x304e1e['offset']===_0x1d30('0x16')&&typeof _0x304e1e[_0x1d30('0x17')]===_0x1d30('0x16');var _0x5b8a40=_0xad88b8[_0x1d30('0x18')];var _0x16e6c4=_0x31e4e5?0x0:_0x304e1e['offset'];var _0x29a492=_0x31e4e5?_0xad88b8[_0x1d30('0x18')]:_0x304e1e['offset']+_0x304e1e['limit'];var _0x498ac7;if(_0x29a492>=_0x5b8a40){_0x29a492=_0x5b8a40;_0x498ac7=0xc8;}else{_0x498ac7=0xce;}_0x554370[_0x1d30('0x13')](_0x498ac7);return _0x554370[_0x1d30('0x19')](_0x1d30('0x1a'),_0x16e6c4+'-'+_0x29a492+'/'+_0x5b8a40)['json'](_0xad88b8);}return null;};}function saveUpdates(_0x1fe036){return function(_0x31224c){if(_0x31224c){return _0x31224c[_0x1d30('0x1b')](_0x1fe036)[_0x1d30('0x1c')](function(_0x341229){return _0x341229;});}return null;};}function removeEntity(_0x57cf51){return function(_0x13eadd){if(_0x13eadd){return _0x13eadd[_0x1d30('0x1d')]()[_0x1d30('0x1c')](function(){_0x57cf51[_0x1d30('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b1cb7){return function(_0x34c472){if(!_0x34c472){_0x2b1cb7[_0x1d30('0x1e')](0x194);}return _0x34c472;};}function handleError(_0x2ea15a,_0x197ca5){_0x197ca5=_0x197ca5||0x1f4;return function(_0x2ac31c){logger['error'](_0x2ac31c[_0x1d30('0x1f')]);if(_0x2ac31c[_0x1d30('0x20')]){delete _0x2ac31c[_0x1d30('0x20')];}_0x2ea15a[_0x1d30('0x13')](_0x197ca5)[_0x1d30('0x21')](_0x2ac31c);};}exports[_0x1d30('0x22')]=function(_0x50ec4d,_0x378b45){var _0x2f18ba={};var _0x45c3ff=_[_0x1d30('0x23')](db[_0x1d30('0x24')]['rawAttributes'],function(_0x1ba2cd){return{'name':_0x1ba2cd['fieldName'],'type':_0x1ba2cd['type'][_0x1d30('0x25')]};});_0x2f18ba=qs[_0x1d30('0x26')](_0x45c3ff,_0x50ec4d);return interaction['findAll'](_0x1d30('0x27'),_0x50ec4d[_0x1d30('0x28')],_0x50ec4d['user'],_0x2f18ba,_0x45c3ff)[_0x1d30('0x1c')](respondWithFilteredResult(_0x378b45,_0x2f18ba))[_0x1d30('0x29')](handleError(_0x378b45,null));};exports[_0x1d30('0x2a')]=function(_0x2cbf49,_0xcb977a){var _0x5eb5c8={'raw':![],'where':{'id':_0x2cbf49[_0x1d30('0x2b')]['id']}},_0xf788b8={};_0xf788b8[_0x1d30('0x2c')]=_[_0x1d30('0x2d')](db[_0x1d30('0x24')][_0x1d30('0x2e')]);_0xf788b8[_0x1d30('0x28')]=_['keys'](_0x2cbf49[_0x1d30('0x28')]);_0xf788b8[_0x1d30('0x2f')]=_[_0x1d30('0x30')](_0xf788b8[_0x1d30('0x2c')],_0xf788b8[_0x1d30('0x28')]);_0x5eb5c8[_0x1d30('0x31')]=_[_0x1d30('0x30')](_0xf788b8[_0x1d30('0x2c')],qs[_0x1d30('0x32')](_0x2cbf49[_0x1d30('0x28')][_0x1d30('0x32')]));_0x5eb5c8['attributes']=_0x5eb5c8[_0x1d30('0x31')][_0x1d30('0x33')]?_0x5eb5c8[_0x1d30('0x31')]:_0xf788b8['model'];if(_0x2cbf49['query'][_0x1d30('0x34')]){_0x5eb5c8[_0x1d30('0x35')]=[{'all':!![]}];}_0x5eb5c8=_['merge']({},_0x5eb5c8,_0x2cbf49[_0x1d30('0x36')]);return db[_0x1d30('0x24')][_0x1d30('0x37')](_0x5eb5c8)['then'](handleEntityNotFound(_0xcb977a,null))[_0x1d30('0x1c')](respondWithResult(_0xcb977a,null))[_0x1d30('0x29')](handleError(_0xcb977a,null));};exports[_0x1d30('0x38')]=function(_0x23a387,_0x620ae){return db['MailInteraction'][_0x1d30('0x38')](_0x23a387[_0x1d30('0x39')],{})[_0x1d30('0x1c')](respondWithResult(_0x620ae,0xc9))[_0x1d30('0x29')](handleError(_0x620ae,null));};exports[_0x1d30('0x1b')]=function(_0x40b005,_0x1f1ee2){if(_0x40b005[_0x1d30('0x39')]['id']){delete _0x40b005[_0x1d30('0x39')]['id'];}return db[_0x1d30('0x24')]['find']({'where':{'id':_0x40b005[_0x1d30('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1f1ee2,null))[_0x1d30('0x1c')](saveUpdates(_0x40b005['body'],null))[_0x1d30('0x1c')](respondWithResult(_0x1f1ee2,null))[_0x1d30('0x29')](handleError(_0x1f1ee2,null));};exports[_0x1d30('0x1d')]=function(_0x26c9b7,_0xb16c2e){return db[_0x1d30('0x24')][_0x1d30('0x37')]({'where':{'id':_0x26c9b7[_0x1d30('0x2b')]['id']}})['then'](handleEntityNotFound(_0xb16c2e,null))['then'](removeEntity(_0xb16c2e,null))[_0x1d30('0x29')](handleError(_0xb16c2e,null));};exports[_0x1d30('0x3a')]=function(_0x4bc498,_0x465804){return db['MailInteraction'][_0x1d30('0x3a')]()[_0x1d30('0x1c')](respondWithResult(_0x465804,null))['catch'](handleError(_0x465804,null));};exports['addMessage']=function(_0x5bed74,_0x2564f3){return db[_0x1d30('0x3b')][_0x1d30('0x37')]({'where':{'id':_0x5bed74[_0x1d30('0x2b')]['id']}})[_0x1d30('0x1c')](handleEntityNotFound(_0x2564f3,null))['then'](function(_0x50d5f5){if(_0x50d5f5){return _0x50d5f5[_0x1d30('0x3c')](_0x5bed74[_0x1d30('0x39')][_0x1d30('0x3d')],_['omit'](_0x5bed74[_0x1d30('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x2564f3,null))['catch'](handleError(_0x2564f3,null));};exports['getMessages']=function(_0x3cafa0,_0x496f3f){var _0x1f8ce6={'raw':![],'where':{}};var _0x34218d={};var _0x1ae58d={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1d30('0x3e')]({'where':{'id':_0x3cafa0['params']['id']}})[_0x1d30('0x1c')](handleEntityNotFound(_0x496f3f,null))['then'](function(_0x22f54c){if(_0x22f54c){_0x34218d[_0x1d30('0x2c')]=_['keys'](db[_0x1d30('0x3b')][_0x1d30('0x2e')]);_0x34218d['query']=_[_0x1d30('0x2d')](_0x3cafa0[_0x1d30('0x28')]);_0x34218d[_0x1d30('0x2f')]=_[_0x1d30('0x30')](_0x34218d[_0x1d30('0x2c')],_0x34218d[_0x1d30('0x28')]);_0x1f8ce6[_0x1d30('0x31')]=_[_0x1d30('0x30')](_0x34218d['model'],qs['fields'](_0x3cafa0['query'][_0x1d30('0x32')]));_0x1f8ce6[_0x1d30('0x31')]=_0x1f8ce6[_0x1d30('0x31')][_0x1d30('0x33')]?_0x1f8ce6[_0x1d30('0x31')]:_0x34218d[_0x1d30('0x2c')];if(!_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x3f')]('nolimit')){_0x1f8ce6[_0x1d30('0x17')]=qs[_0x1d30('0x17')](_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x17')]);_0x1f8ce6['offset']=qs['offset'](_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x40')]);}_0x1f8ce6[_0x1d30('0x41')]=qs[_0x1d30('0x42')](_0x3cafa0['query'][_0x1d30('0x42')]);_0x1f8ce6[_0x1d30('0x43')]=qs['filters'](_['pick'](_0x3cafa0['query'],_0x34218d[_0x1d30('0x2f')]));_0x1f8ce6[_0x1d30('0x43')][_0x1d30('0x44')]=_0x22f54c['id'];if(_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x45')]){_0x1f8ce6[_0x1d30('0x43')]=_[_0x1d30('0x46')](_0x1f8ce6[_0x1d30('0x43')],{'$or':_['map'](_0x1f8ce6[_0x1d30('0x31')],function(_0xe3033a){var _0xdc6ef7={};_0xdc6ef7[_0xe3033a]={'$like':'%'+_0x3cafa0[_0x1d30('0x28')]['filter']+'%'};return _0xdc6ef7;})});}if(_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x47')]){var _0x1eca6e=_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x47')][_0x1d30('0x48')](',');var _0x36f429={};_0x36f429[_0x1eca6e[0x0]]={'$gte':moment(_0x1eca6e[0x1])[_0x1d30('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f8ce6['where']=_[_0x1d30('0x46')](_0x1f8ce6[_0x1d30('0x43')],_0x36f429);}_0x1f8ce6=_[_0x1d30('0x46')]({},_0x1f8ce6,_0x3cafa0[_0x1d30('0x36')]);return db['MailMessage'][_0x1d30('0x18')]({'where':_0x1f8ce6[_0x1d30('0x43')]})[_0x1d30('0x1c')](function(_0x26e829){_0x1ae58d[_0x1d30('0x18')]=_0x26e829;if(_0x3cafa0[_0x1d30('0x28')]['includeAll']){_0x1f8ce6[_0x1d30('0x35')]=[{'all':!![]}];}return db['MailMessage'][_0x1d30('0x4a')](_0x1f8ce6);})[_0x1d30('0x1c')](function(_0x3ef95f){if(_0x3cafa0[_0x1d30('0x28')][_0x1d30('0x4b')]===_0x1d30('0x4c')){for(var _0x233570=0x0;_0x233570<_0x3ef95f[_0x1d30('0x33')];_0x233570++){_0x3ef95f[_0x233570]['body']=juice(_0x3ef95f[_0x233570][_0x1d30('0x39')]);}}_0x1ae58d[_0x1d30('0x4d')]=_0x3ef95f;return _0x1ae58d;});}})[_0x1d30('0x1c')](respondWithFilteredResult(_0x496f3f,_0x1f8ce6))[_0x1d30('0x29')](handleError(_0x496f3f,null));};exports[_0x1d30('0x4e')]=function(_0x4aa1d5,_0xb086a8){return db[_0x1d30('0x24')][_0x1d30('0x37')]({'where':{'id':_0x4aa1d5[_0x1d30('0x2b')]['id']}})[_0x1d30('0x1c')](handleEntityNotFound(_0xb086a8,null))[_0x1d30('0x1c')](function(_0x2d5a46){if(_0x2d5a46){return _0x2d5a46[_0x1d30('0x4f')](_0x4aa1d5[_0x1d30('0x39')]['ids'],_[_0x1d30('0x50')](_0x4aa1d5['body'],[_0x1d30('0x3d'),'id'])||{})[_0x1d30('0x51')](function(){return db[_0x1d30('0x52')][_0x1d30('0x4a')]({'attributes':['id',_0x1d30('0x20'),_0x1d30('0x53')],'where':{'id':_0x4aa1d5[_0x1d30('0x39')][_0x1d30('0x3d')]}});})[_0x1d30('0x1c')](function(_0x3c0be3){socket[_0x1d30('0x54')]('mailInteractionTags:save',{'id':Number(_0x4aa1d5['params']['id']),'tags':_0x3c0be3||[]});return{'id':Number(_0x4aa1d5[_0x1d30('0x2b')]['id']),'tags':_0x3c0be3||[]};});}})[_0x1d30('0x1c')](respondWithResult(_0xb086a8,null))[_0x1d30('0x29')](handleError(_0xb086a8,null));};exports[_0x1d30('0x55')]=function(_0x288259,_0x451d18){return db[_0x1d30('0x24')][_0x1d30('0x37')]({'where':{'id':_0x288259[_0x1d30('0x2b')]['id']}})[_0x1d30('0x1c')](handleEntityNotFound(_0x451d18,null))['then'](function(_0x2d4436){if(_0x2d4436){return _0x2d4436[_0x1d30('0x55')](_0x288259[_0x1d30('0x28')][_0x1d30('0x3d')]);}})[_0x1d30('0x1c')](respondWithStatusCode(_0x451d18,null))[_0x1d30('0x29')](handleError(_0x451d18,null));};exports[_0x1d30('0x56')]=function(_0x387360,_0x45db33){var _0x6cc156=moment()[_0x1d30('0x57')]()[_0x1d30('0x58')]();var _0x55d732=path['join'](config['root'],'server',_0x1d30('0x59'),_0x1d30('0x5a'));var _0xcc375b=path[_0x1d30('0x5b')](config[_0x1d30('0x5c')],_0x1d30('0x5d'),_0x1d30('0x59'),_0x1d30('0x5e'));var _0x578044=path['join'](_0x55d732,_0x6cc156);var _0x576a94=util['format']('transcript-%d-%s.zip',_0x387360[_0x1d30('0x2b')]['id'],_0x6cc156);var _0x4d78df=path[_0x1d30('0x5b')](_0x55d732,_0x576a94);var _0x22385d=[];if(_0x387360['query'][_0x1d30('0x5e')]){_0x22385d[_0x1d30('0x5f')]({'model':db[_0x1d30('0x60')],'as':_0x1d30('0x61'),'raw':!![]});}var _0x395820=[{'model':db['MailMessage'],'as':_0x1d30('0x62'),'attributes':['id',_0x1d30('0x39'),_0x1d30('0x63'),'to','cc','bcc',_0x1d30('0x64'),_0x1d30('0x65')],'where':{'secret':![]},'order':qs[_0x1d30('0x42')]('id'),'include':_0x22385d}];return db[_0x1d30('0x24')][_0x1d30('0x37')]({'where':{'id':_0x387360[_0x1d30('0x2b')]['id']},'include':_0x395820})[_0x1d30('0x1c')](handleEntityNotFound(_0x45db33,null))[_0x1d30('0x1c')](function(_0x459f88){if(_0x459f88&&_0x459f88[_0x1d30('0x62')]){var _0x3e62cd=_0x459f88['get']({'plain':!![]});fs[_0x1d30('0x66')](_0x578044);return BPromise[_0x1d30('0x67')](_0x3e62cd[_0x1d30('0x62')],function(_0x4ff4fb,_0x2d6a59){var _0x52840d={'from':_0x4ff4fb[_0x1d30('0x63')],'to':_0x4ff4fb['to']||_0x1d30('0x68'),'subject':_0x4ff4fb['subject'],'html':htmlEntities['decode'](_0x4ff4fb[_0x1d30('0x39')]),'headers':{'Date':moment(_0x4ff4fb[_0x1d30('0x65')])[_0x1d30('0x49')](_0x1d30('0x69'))},'attachments':[]};if(_0x4ff4fb['cc']){_0x52840d[_0x1d30('0x6a')]['Cc']=_0x4ff4fb['cc'];}if(_0x4ff4fb[_0x1d30('0x6b')]){_0x52840d[_0x1d30('0x6a')][_0x1d30('0x6c')]=_0x4ff4fb[_0x1d30('0x6b')];}return new BPromise(function(_0x4aef71,_0x5d39e2){if(_0x4ff4fb[_0x1d30('0x61')]){for(var _0x519cff=0x0;_0x519cff<_0x4ff4fb[_0x1d30('0x61')][_0x1d30('0x33')];_0x519cff++){var _0x3fc9b6=_0x4ff4fb['Attachments'][_0x519cff];var _0x7a0281=path[_0x1d30('0x5b')](_0xcc375b,_0x3fc9b6[_0x1d30('0x6d')]);if(fs[_0x1d30('0x6e')](_0x7a0281)){_0x52840d['attachments']['push']({'name':_0x3fc9b6[_0x1d30('0x20')],'contentType':_0x3fc9b6[_0x1d30('0x6f')],'data':fs[_0x1d30('0x70')](_0x7a0281)});}}}emlformat['build'](_0x52840d,function(_0x4d277c,_0x5d2f51){if(_0x4d277c)return _0x5d39e2(_0x4d277c);fs[_0x1d30('0x71')](path[_0x1d30('0x5b')](_0x578044,util['format'](_0x1d30('0x72'),_0x2d6a59)),_0x5d2f51);return _0x4aef71(_0x5d2f51);});});})[_0x1d30('0x1c')](function(){return new BPromise(function(_0x4c83bb,_0x30861a){zipdir(_0x578044,{'saveTo':_0x4d78df},function(_0x288c80,_0x551fe4){if(_0x288c80)return _0x30861a(_0x288c80);return _0x4c83bb(_0x551fe4);});})[_0x1d30('0x1c')](function(){return new BPromise(function(_0x52681d,_0x4294fd){rimraf(_0x578044,function(_0x364cd3){if(_0x364cd3)_0x4294fd(_0x364cd3);return _0x52681d();});});})['then'](function(){return _0x45db33[_0x1d30('0x56')](_0x4d78df,_0x576a94,function(_0x589564){if(!_0x589564)fs[_0x1d30('0x73')](_0x4d78df);});});});}else{return _0x45db33[_0x1d30('0x1e')](0xc8);}})[_0x1d30('0x29')](handleError(_0x45db33,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 7c3c204..9626326 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 _0xcfa1=['map','findAll','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x37728b,_0x162fb6){var _0x2c29ea=function(_0x1f3169){while(--_0x1f3169){_0x37728b['push'](_0x37728b['shift']());}};_0x2c29ea(++_0x162fb6);}(_0xcfa1,0xb3));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x1cfa('0x0'));var MailInteraction=require(_0x1cfa('0x1'))['db'][_0x1cfa('0x2')];var MailMessage=require(_0x1cfa('0x1'))['db'][_0x1cfa('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1cfa('0x4')](0x0);var events={'afterCreate':_0x1cfa('0x5'),'afterUpdate':'update','afterDestroy':_0x1cfa('0x6')};function emitEvent(_0x496f43){return function(_0x40b84f,_0x59ea1f,_0x4aafcf){_0x40b84f[_0x1cfa('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x55903c){_0x40b84f['setDataValue']('Users',_0x55903c[_0x1cfa('0x8')](function(_0x615db6){return{'id':_0x615db6['id']};}));return MailMessage[_0x1cfa('0x9')]({'where':{'MailInteractionId':_0x40b84f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cfa('0xa')](function(_0x280a86){_0x40b84f[_0x1cfa('0xb')](_0x1cfa('0xc'),_0x280a86[_0x1cfa('0xd')]);MailInteractionEvents[_0x1cfa('0xe')](_0x496f43+':'+_0x40b84f['id'],_0x40b84f);MailInteractionEvents[_0x1cfa('0xe')](_0x496f43,_0x40b84f);_0x4aafcf(null);})['catch'](_0x4aafcf(null));};}for(var e in events){if(events[_0x1cfa('0xf')](e)){var event=events[e];MailInteraction[_0x1cfa('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xe661=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','then','unreadMessages','emit'];(function(_0x4ea57c,_0x688217){var _0x119d94=function(_0x40246f){while(--_0x40246f){_0x4ea57c['push'](_0x4ea57c['shift']());}};_0x119d94(++_0x688217);}(_0xe661,0x64));var _0x1e66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe661[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1e66('0x0'));var MailInteraction=require(_0x1e66('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x1e66('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1e66('0x2')](0x0);var events={'afterCreate':_0x1e66('0x3'),'afterUpdate':_0x1e66('0x4'),'afterDestroy':_0x1e66('0x5')};function emitEvent(_0x175286){return function(_0x3db1c5,_0x2fba29,_0x284488){_0x3db1c5[_0x1e66('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d795e){_0x3db1c5[_0x1e66('0x7')](_0x1e66('0x8'),_0x4d795e['map'](function(_0x4d4ec1){return{'id':_0x4d4ec1['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3db1c5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e66('0x9')](function(_0x5213f6){_0x3db1c5[_0x1e66('0x7')](_0x1e66('0xa'),_0x5213f6['length']);MailInteractionEvents[_0x1e66('0xb')](_0x175286+':'+_0x3db1c5['id'],_0x3db1c5);MailInteractionEvents[_0x1e66('0xb')](_0x175286,_0x3db1c5);_0x284488(null);})[_0x1e66('0xc')](_0x284488(null));};}for(var e in events){if(events[_0x1e66('0xd')](e)){var event=events[e];MailInteraction[_0x1e66('0xe')](e,emitEvent(event));}}module[_0x1e66('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 2c018a9..df128bd 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 _0x96d4=['then','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','closedAt','models','get','update'];(function(_0x2c8f5e,_0x221a1b){var _0x59eb32=function(_0x275d88){while(--_0x275d88){_0x2c8f5e['push'](_0x2c8f5e['shift']());}};_0x59eb32(++_0x221a1b);}(_0x96d4,0x67));var _0x496d=function(_0x957133,_0x2b75fc){_0x957133=_0x957133-0x0;var _0x4cac53=_0x96d4[_0x957133];return _0x4cac53;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x496d('0x2'));var BPromise=require(_0x496d('0x3'));var rp=require(_0x496d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x496d('0x5'));var attributes=require(_0x496d('0x6'));module[_0x496d('0x7')]=function(_0x2fd4f8,_0x4a511f){return _0x2fd4f8[_0x496d('0x8')](_0x496d('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x496d('0xa'),'to'],'type':_0x496d('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1409e9,_0x8813ad,_0x2dcc75){if(_0x1409e9[_0x496d('0xc')]){_0x1409e9[_0x496d('0xd')]=moment()['format'](_0x496d('0xe'));}if(_0x1409e9[_0x496d('0xf')]){_0x1409e9['closedAt']=moment()[_0x496d('0x10')](_0x496d('0xe'));}_0x2dcc75(null,_0x8813ad);},'beforeUpdate':function(_0x169446,_0x1d28c1,_0x576c83){if(_0x169446['changed']('substatus')){_0x169446['substatusAt']=_0x169446[_0x496d('0xc')]?moment()[_0x496d('0x10')](_0x496d('0xe')):null;}if(_0x169446[_0x496d('0x11')](_0x496d('0xf'))){_0x169446[_0x496d('0x12')]=moment()[_0x496d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x169446[_0x496d('0xc')]=null;_0x169446[_0x496d('0xd')]=null;}_0x576c83(null,_0x169446);},'afterUpdate':function(_0x4b1565,_0x3cda8c,_0x387a65){var _0x460b0f=_0x2fd4f8[_0x496d('0x13')];var _0x298a50=_0x4b1565[_0x496d('0x14')]({'plain':!![]});if(_0x298a50['closed']){return _0x460b0f['MailMessage'][_0x496d('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x298a50['id']}})[_0x496d('0x16')](function(){_0x387a65();})['catch'](function(_0x27d2c8){_0x387a65(_0x27d2c8);});}else{_0x387a65();}}},'charset':_0x496d('0x17'),'collate':_0x496d('0x18')});}; \ No newline at end of file +var _0x3af7=['FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_interactions'];(function(_0x585c86,_0x472ef9){var _0x26ce5d=function(_0x20beb4){while(--_0x20beb4){_0x585c86['push'](_0x585c86['shift']());}};_0x26ce5d(++_0x472ef9);}(_0x3af7,0x16d));var _0x73af=function(_0x22f97d,_0x40f49b){_0x22f97d=_0x22f97d-0x0;var _0x1703eb=_0x3af7[_0x22f97d];return _0x1703eb;};'use strict';var _=require(_0x73af('0x0'));var util=require(_0x73af('0x1'));var logger=require(_0x73af('0x2'))(_0x73af('0x3'));var moment=require(_0x73af('0x4'));var BPromise=require(_0x73af('0x5'));var rp=require(_0x73af('0x6'));var fs=require('fs');var path=require(_0x73af('0x7'));var rimraf=require(_0x73af('0x8'));var config=require(_0x73af('0x9'));var attributes=require('./mailInteraction.attributes');module[_0x73af('0xa')]=function(_0xd2a468,_0x21828f){return _0xd2a468[_0x73af('0xb')]('MailInteraction',attributes,{'tableName':_0x73af('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x73af('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4df37a,_0x5ef9d3,_0x189d0c){if(_0x4df37a[_0x73af('0xe')]){_0x4df37a['substatusAt']=moment()[_0x73af('0xf')](_0x73af('0x10'));}if(_0x4df37a[_0x73af('0x11')]){_0x4df37a[_0x73af('0x12')]=moment()[_0x73af('0xf')](_0x73af('0x10'));}_0x189d0c(null,_0x5ef9d3);},'beforeUpdate':function(_0x4a5a34,_0x4be563,_0x49c738){if(_0x4a5a34[_0x73af('0x13')]('substatus')){_0x4a5a34['substatusAt']=_0x4a5a34[_0x73af('0xe')]?moment()[_0x73af('0xf')](_0x73af('0x10')):null;}if(_0x4a5a34[_0x73af('0x13')]('closed')){_0x4a5a34[_0x73af('0x12')]=moment()[_0x73af('0xf')](_0x73af('0x10'));_0x4a5a34[_0x73af('0xe')]=null;_0x4a5a34['substatusAt']=null;}_0x49c738(null,_0x4a5a34);},'afterUpdate':function(_0x5de4c7,_0x4946b5,_0x55204d){var _0x5a0caf=_0xd2a468[_0x73af('0x14')];var _0x23b675=_0x5de4c7[_0x73af('0x15')]({'plain':!![]});if(_0x23b675[_0x73af('0x11')]){return _0x5a0caf[_0x73af('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x23b675['id']}})[_0x73af('0x17')](function(){_0x55204d();})[_0x73af('0x18')](function(_0x55c675){_0x55204d(_0x55c675);});}else{_0x55204d();}}},'charset':_0x73af('0x19'),'collate':_0x73af('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d04d0cd..cd27a90 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 _0xb458=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','AddTagsToMailInteraction','find','where','addTags','omit','ids','AddTags','lodash','util','moment','ioredis'];(function(_0x348dfc,_0x5917f6){var _0x59a3ab=function(_0x42a9e4){while(--_0x42a9e4){_0x348dfc['push'](_0x348dfc['shift']());}};_0x59a3ab(++_0x5917f6);}(_0xb458,0x94));var _0x8b45=function(_0x58abcc,_0x3e2cc8){_0x58abcc=_0x58abcc-0x0;var _0x3327be=_0xb458[_0x58abcc];return _0x3327be;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b45('0x4'));var logger=require(_0x8b45('0x5'))(_0x8b45('0x6'));var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b45('0x8')][_0x8b45('0x9')]({'port':0x232a});config[_0x8b45('0xa')]=_[_0x8b45('0xb')](config[_0x8b45('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0xa')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2a9c49,_0x16ad9a,_0x244adc){return new BPromise(function(_0xf4b398,_0xca52fb){return client['request'](_0x2a9c49,_0x244adc)[_0x8b45('0xe')](function(_0x30999d){logger[_0x8b45('0xf')](_0x8b45('0x10'),_0x16ad9a,_0x8b45('0x11'));logger[_0x8b45('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x16ad9a,_0x8b45('0x11'),JSON[_0x8b45('0x13')](_0x30999d));if(_0x30999d[_0x8b45('0x14')]){if(_0x30999d[_0x8b45('0x14')][_0x8b45('0x15')]===0x1f4){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);return _0xca52fb(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}logger[_0x8b45('0x14')](_0x8b45('0x10'),_0x16ad9a,_0x30999d['error']['message']);return _0xf4b398(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}else{logger[_0x8b45('0xf')]('MailInteraction,\x20%s,\x20%s',_0x16ad9a,'request\x20sent');_0xf4b398(_0x30999d['result'][_0x8b45('0x16')]);}})[_0x8b45('0x17')](function(_0x40bfd7){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x40bfd7);_0xca52fb(_0x40bfd7);});});}exports[_0x8b45('0x18')]=function(_0x41b7f4){var _0x457cb8=this;return new Promise(function(_0x28c8f2,_0xd426f3){return db[_0x8b45('0x19')][_0x8b45('0x1a')](_0x41b7f4[_0x8b45('0x1b')],{'raw':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4['options'][_0x8b45('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b7f4['options']?_0x41b7f4['options']['where']||null:null,'attributes':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4[_0x8b45('0x1c')][_0x8b45('0x1e')]||null:null,'limit':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4[_0x8b45('0x1c')]['limit']||null:null})[_0x8b45('0xe')](function(_0x1934b9){logger['info'](_0x8b45('0x18'),_0x41b7f4);logger[_0x8b45('0x12')](_0x8b45('0x18'),_0x41b7f4,JSON['stringify'](_0x1934b9));_0x28c8f2(_0x1934b9);})[_0x8b45('0x17')](function(_0x52e6e4){logger[_0x8b45('0x14')](_0x8b45('0x18'),_0x52e6e4[_0x8b45('0x16')],_0x41b7f4);_0xd426f3(_0x457cb8[_0x8b45('0x14')](0x1f4,_0x52e6e4['message']));});});};exports[_0x8b45('0x1f')]=function(_0x49967e){return new Promise(function(_0x149abc,_0x105d26){return db['MailInteraction'][_0x8b45('0x20')]({'where':_0x49967e['options']?_0x49967e[_0x8b45('0x1c')][_0x8b45('0x21')]||null:null})['then'](function(_0x596cab){if(_0x596cab){return _0x596cab[_0x8b45('0x22')](_0x49967e['body']['ids'],_[_0x8b45('0x23')](_0x49967e[_0x8b45('0x1b')],[_0x8b45('0x24'),'id'])||{});}})['spread'](function(_0x2934cb){logger[_0x8b45('0xf')](_0x8b45('0x25'),_0x49967e);logger[_0x8b45('0x12')](_0x8b45('0x25'),_0x49967e,JSON[_0x8b45('0x13')](_0x2934cb));_0x149abc(_0x2934cb);})['catch'](function(_0x395eec){logger[_0x8b45('0x14')](_0x8b45('0x25'),_0x395eec['message'],_0x49967e);_0x105d26(_this[_0x8b45('0x14')](0x1f4,_0x395eec[_0x8b45('0x16')]));});});}; \ No newline at end of file +var _0x2b0a=['MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2fcf3c,_0x214146){var _0x14808c=function(_0x3bffc0){while(--_0x3bffc0){_0x2fcf3c['push'](_0x2fcf3c['shift']());}};_0x14808c(++_0x214146);}(_0x2b0a,0x84));var _0xa2b0=function(_0x51219b,_0xfe8ccc){_0x51219b=_0x51219b-0x0;var _0x1cdb3d=_0x2b0a[_0x51219b];return _0x1cdb3d;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var moment=require('moment');var BPromise=require(_0xa2b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2b0('0x3'))(_0xa2b0('0x4'));var config=require(_0xa2b0('0x5'));var jayson=require(_0xa2b0('0x6'));var client=jayson[_0xa2b0('0x7')][_0xa2b0('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2b0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2b0('0x9')]));require(_0xa2b0('0xa'))[_0xa2b0('0xb')](socket);function respondWithRpcPromise(_0x288acc,_0x1b3a5c,_0xc02bee){return new BPromise(function(_0x5c868d,_0x11b420){return client[_0xa2b0('0xc')](_0x288acc,_0xc02bee)[_0xa2b0('0xd')](function(_0x55e9d5){logger[_0xa2b0('0xe')](_0xa2b0('0xf'),_0x1b3a5c,'request\x20sent');logger[_0xa2b0('0x10')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1b3a5c,_0xa2b0('0x11'),JSON[_0xa2b0('0x12')](_0x55e9d5));if(_0x55e9d5[_0xa2b0('0x13')]){if(_0x55e9d5[_0xa2b0('0x13')][_0xa2b0('0x14')]===0x1f4){logger[_0xa2b0('0x13')](_0xa2b0('0xf'),_0x1b3a5c,_0x55e9d5[_0xa2b0('0x13')][_0xa2b0('0x15')]);return _0x11b420(_0x55e9d5[_0xa2b0('0x13')][_0xa2b0('0x15')]);}logger[_0xa2b0('0x13')]('MailInteraction,\x20%s,\x20%s',_0x1b3a5c,_0x55e9d5['error']['message']);return _0x5c868d(_0x55e9d5[_0xa2b0('0x13')]['message']);}else{logger[_0xa2b0('0xe')]('MailInteraction,\x20%s,\x20%s',_0x1b3a5c,_0xa2b0('0x11'));_0x5c868d(_0x55e9d5[_0xa2b0('0x16')][_0xa2b0('0x15')]);}})[_0xa2b0('0x17')](function(_0x110317){logger[_0xa2b0('0x13')](_0xa2b0('0xf'),_0x1b3a5c,_0x110317);_0x11b420(_0x110317);});});}exports['UpdateMailInteraction']=function(_0xfdec29){var _0x480145=this;return new Promise(function(_0x2eb66b,_0x2c348f){return db[_0xa2b0('0x18')][_0xa2b0('0x19')](_0xfdec29[_0xa2b0('0x1a')],{'raw':_0xfdec29[_0xa2b0('0x1b')]?_0xfdec29['options'][_0xa2b0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdec29[_0xa2b0('0x1b')]?_0xfdec29[_0xa2b0('0x1b')][_0xa2b0('0x1d')]||null:null,'attributes':_0xfdec29[_0xa2b0('0x1b')]?_0xfdec29['options'][_0xa2b0('0x1e')]||null:null,'limit':_0xfdec29[_0xa2b0('0x1b')]?_0xfdec29[_0xa2b0('0x1b')][_0xa2b0('0x1f')]||null:null})[_0xa2b0('0xd')](function(_0x3904f7){logger[_0xa2b0('0xe')]('UpdateMailInteraction',_0xfdec29);logger['debug']('UpdateMailInteraction',_0xfdec29,JSON[_0xa2b0('0x12')](_0x3904f7));_0x2eb66b(_0x3904f7);})[_0xa2b0('0x17')](function(_0x546c82){logger[_0xa2b0('0x13')](_0xa2b0('0x20'),_0x546c82[_0xa2b0('0x15')],_0xfdec29);_0x2c348f(_0x480145[_0xa2b0('0x13')](0x1f4,_0x546c82['message']));});});};exports[_0xa2b0('0x21')]=function(_0x1179ab){return new Promise(function(_0xb84d3c,_0x3bb493){return db[_0xa2b0('0x18')][_0xa2b0('0x22')]({'where':_0x1179ab[_0xa2b0('0x1b')]?_0x1179ab[_0xa2b0('0x1b')]['where']||null:null})['then'](function(_0x446547){if(_0x446547){return _0x446547[_0xa2b0('0x23')](_0x1179ab['body'][_0xa2b0('0x24')],_['omit'](_0x1179ab[_0xa2b0('0x1a')],[_0xa2b0('0x24'),'id'])||{});}})[_0xa2b0('0x25')](function(_0x1e2134){logger[_0xa2b0('0xe')](_0xa2b0('0x26'),_0x1179ab);logger['debug'](_0xa2b0('0x26'),_0x1179ab,JSON[_0xa2b0('0x12')](_0x1e2134));_0xb84d3c(_0x1e2134);})[_0xa2b0('0x17')](function(_0x4ff24c){logger[_0xa2b0('0x13')](_0xa2b0('0x26'),_0x4ff24c[_0xa2b0('0x15')],_0x1179ab);_0x3bb493(_this[_0xa2b0('0x13')](0x1f4,_0x4ff24c[_0xa2b0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 088c5b2..10fec7f 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 _0x58cf=['./mailInteraction.events','save','remove','emit','length','mailInteraction:'];(function(_0x38315c,_0x3b2ec6){var _0x5817b8=function(_0x6c717d){while(--_0x6c717d){_0x38315c['push'](_0x38315c['shift']());}};_0x5817b8(++_0x3b2ec6);}(_0x58cf,0xae));var _0xf58c=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x58cf[_0x154940];return _0x401409;};'use strict';var MailInteractionEvents=require(_0xf58c('0x0'));var events=[_0xf58c('0x1'),_0xf58c('0x2'),'update'];function createListener(_0xc422d9,_0xe9c578){return function(_0x15f2fb){_0xe9c578[_0xf58c('0x3')](_0xc422d9,_0x15f2fb);};}function removeListener(_0x190dcb,_0x105977){return function(){MailInteractionEvents['removeListener'](_0x190dcb,_0x105977);};}exports['register']=function(_0x1e16a0){for(var _0x2da231=0x0,_0x5414d9=events[_0xf58c('0x4')];_0x2da231<_0x5414d9;_0x2da231++){var _0x3a78f6=events[_0x2da231];var _0x79b70c=createListener(_0xf58c('0x5')+_0x3a78f6,_0x1e16a0);MailInteractionEvents['on'](_0x3a78f6,_0x79b70c);}}; \ No newline at end of file +var _0xd656=['emit','removeListener','register','length','mailInteraction:','save','remove','update'];(function(_0x514fac,_0x52278a){var _0x54fbb2=function(_0x4ddfed){while(--_0x4ddfed){_0x514fac['push'](_0x514fac['shift']());}};_0x54fbb2(++_0x52278a);}(_0xd656,0x1ad));var _0x6d65=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd656[_0x501510];return _0x1e6ee5;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6d65('0x0'),_0x6d65('0x1'),_0x6d65('0x2')];function createListener(_0x2cfdfe,_0xb2fd04){return function(_0x59a859){_0xb2fd04[_0x6d65('0x3')](_0x2cfdfe,_0x59a859);};}function removeListener(_0xcdd601,_0x35608a){return function(){MailInteractionEvents[_0x6d65('0x4')](_0xcdd601,_0x35608a);};}exports[_0x6d65('0x5')]=function(_0x5d934e){for(var _0x55d84e=0x0,_0xfe0e42=events[_0x6d65('0x6')];_0x55d84e<_0xfe0e42;_0x55d84e++){var _0x6fcb37=events[_0x55d84e];var _0x251b0a=createListener(_0x6d65('0x7')+_0x6fcb37,_0x5d934e);MailInteractionEvents['on'](_0x6fcb37,_0x251b0a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bf896b1..2038d37 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 _0x1120=['tracked','mail','mailmessage:create','create','/:id','update','put','accept','/:id/reject','reject','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post'];(function(_0x2d8667,_0x3a4ac6){var _0x2b6069=function(_0x166d2b){while(--_0x166d2b){_0x2d8667['push'](_0x2d8667['shift']());}};_0x2b6069(++_0x3a4ac6);}(_0x1120,0x140));var _0x0112=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x1120[_0x424501];return _0xb719af;};'use strict';var multer=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var path=require(_0x0112('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0112('0x3'));var interaction=require(_0x0112('0x4'));var config=require(_0x0112('0x5'));var controller=require(_0x0112('0x6'));router[_0x0112('0x7')]('/',auth[_0x0112('0x8')](),controller[_0x0112('0x9')]);router[_0x0112('0x7')](_0x0112('0xa'),auth[_0x0112('0x8')](),controller[_0x0112('0xb')]);router[_0x0112('0x7')]('/:id',auth[_0x0112('0x8')](),controller[_0x0112('0xc')]);router[_0x0112('0x7')](_0x0112('0xd'),auth[_0x0112('0x8')](),controller[_0x0112('0xe')]);router[_0x0112('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0112('0x10')](_0x0112('0x11'),_0x0112('0x12')),controller[_0x0112('0x13')]);router['put'](_0x0112('0x14'),auth[_0x0112('0x8')](),controller[_0x0112('0x15')]);router[_0x0112('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0112('0x17')]);router['put'](_0x0112('0x18'),auth['isAuthenticated'](),controller[_0x0112('0x19')]);router[_0x0112('0x1a')](_0x0112('0x14'),auth[_0x0112('0x8')](),controller['destroy']);module[_0x0112('0x1b')]=router; \ No newline at end of file +var _0x49e9=['Router','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','connect-timeout','express'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var path=require('path');var timeout=require(_0x949e('0x2'));var express=require(_0x949e('0x3'));var router=express[_0x949e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x949e('0x5'));var config=require('../../config/environment');var controller=require(_0x949e('0x6'));router[_0x949e('0x7')]('/',auth[_0x949e('0x8')](),controller['index']);router[_0x949e('0x7')](_0x949e('0x9'),auth[_0x949e('0x8')](),controller[_0x949e('0xa')]);router[_0x949e('0x7')](_0x949e('0xb'),auth[_0x949e('0x8')](),controller['show']);router[_0x949e('0x7')]('/:id/download',auth[_0x949e('0x8')](),controller[_0x949e('0xc')]);router[_0x949e('0xd')]('/',auth['isAuthenticated'](),interaction[_0x949e('0xe')](_0x949e('0xf'),_0x949e('0x10')),controller[_0x949e('0x11')]);router[_0x949e('0x12')](_0x949e('0xb'),auth[_0x949e('0x8')](),controller[_0x949e('0x13')]);router[_0x949e('0x12')](_0x949e('0x14'),auth[_0x949e('0x8')](),controller[_0x949e('0x15')]);router[_0x949e('0x12')](_0x949e('0x16'),auth[_0x949e('0x8')](),controller['reject']);router[_0x949e('0x17')](_0x949e('0xb'),auth[_0x949e('0x8')](),controller[_0x949e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 50d7b1d..2a22e25 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 _0xbcff=['ENUM','out','STRING','DATE','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN'];(function(_0x1bee45,_0x5c4ed3){var _0x2115f7=function(_0x32983d){while(--_0x32983d){_0x1bee45['push'](_0x1bee45['shift']());}};_0x2115f7(++_0x5c4ed3);}(_0xbcff,0x1da));var _0xfbcf=function(_0x51f1e1,_0x17ffae){_0x51f1e1=_0x51f1e1-0x0;var _0x462bb0=_0xbcff[_0x51f1e1];return _0x462bb0;};'use strict';var Sequelize=require(_0xfbcf('0x0'));var _=require('lodash');module[_0xfbcf('0x1')]={'body':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x4'))},'read':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfbcf('0x6')]('in',_0xfbcf('0x7')),'defaultValue':_0xfbcf('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfbcf('0x8')](0x1fe)},'from':{'type':Sequelize[_0xfbcf('0x8')]},'to':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfbcf('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'originChannel':{'type':Sequelize[_0xfbcf('0x6')](_0xfbcf('0xa'),_0xfbcf('0xb')),'defaultValue':_0xfbcf('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x883f=['INTEGER','Email','Chat','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE'];(function(_0x515bf6,_0x186bc8){var _0xbebd0=function(_0x3deb48){while(--_0x3deb48){_0x515bf6['push'](_0x515bf6['shift']());}};_0xbebd0(++_0x186bc8);}(_0x883f,0x189));var _0xf883=function(_0x368027,_0x48d604){_0x368027=_0x368027-0x0;var _0x1c3689=_0x883f[_0x368027];return _0x1c3689;};'use strict';var Sequelize=require(_0xf883('0x0'));var _=require('lodash');module[_0xf883('0x1')]={'body':{'type':Sequelize[_0xf883('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x3'))},'read':{'type':Sequelize[_0xf883('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf883('0x5')]('in',_0xf883('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf883('0x7')](0x1fe)},'from':{'type':Sequelize[_0xf883('0x7')]},'to':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x8'))},'cc':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x8'))},'bcc':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x8'))},'subject':{'type':Sequelize[_0xf883('0x2')]},'sentAt':{'type':Sequelize[_0xf883('0x9')]},'attach':{'type':Sequelize[_0xf883('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf883('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf883('0x9')]},'originTo':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x8'))},'originCc':{'type':Sequelize[_0xf883('0x2')](_0xf883('0x8'))},'originChannel':{'type':Sequelize[_0xf883('0x5')](_0xf883('0xb'),_0xf883('0xc')),'defaultValue':_0xf883('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6f439b9..3b7a72c 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 _0x935e=['mail','read','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','fullname','download','unix','server','files','tmp','from','Attachment','subject','createdAt','Bcc','bcc','Attachments','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','json','offset','undefined','limit','count','set','update','then','sendStatus','stack','name','status','index','map','MailMessage','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify'];(function(_0x3e43e5,_0x27cffa){var _0x4caf23=function(_0x29a6b7){while(--_0x29a6b7){_0x3e43e5['push'](_0x3e43e5['shift']());}};_0x4caf23(++_0x27cffa);}(_0x935e,0xd9));var _0xe935=function(_0x3acf43,_0x452964){_0x3acf43=_0x3acf43-0x0;var _0x491d53=_0x935e[_0x3acf43];return _0x491d53;};'use strict';var emlformat=require(_0xe935('0x0'));var moment=require(_0xe935('0x1'));var BPromise=require(_0xe935('0x2'));var util=require(_0xe935('0x3'));var path=require(_0xe935('0x4'));var fs=require('fs');var _=require(_0xe935('0x5'));var Redis=require(_0xe935('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xe935('0x7'));var logger=require(_0xe935('0x8'))(_0xe935('0x9'));var interaction_log=require(_0xe935('0x8'))(_0xe935('0xa'));var config=require(_0xe935('0xb'));var db=require(_0xe935('0xc'))['db'];config[_0xe935('0xd')]=_[_0xe935('0xe')](config[_0xe935('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe935('0xf'))(new Redis(config[_0xe935('0xd')]));var htmlEntities=require(_0xe935('0x10'));require(_0xe935('0x11'))[_0xe935('0x12')](socket);var jayson=require(_0xe935('0x13'));var client=jayson[_0xe935('0x14')][_0xe935('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xe935('0x15')]({'port':0x232b});var client9002=jayson[_0xe935('0x14')][_0xe935('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1290cf,_0x21ee1,_0x29ed63,_0x1e612b){return new BPromise(function(_0x47299c,_0x232283){var _0x2507e7=_0x1e612b||client;return _0x2507e7[_0xe935('0x16')](_0x1290cf,_0x29ed63)['then'](function(_0xb2975){logger[_0xe935('0x17')](_0xe935('0x18'),_0x21ee1,_0xe935('0x19'));logger[_0xe935('0x1a')](_0xe935('0x1b'),_0x21ee1,_0xe935('0x19'),JSON['stringify'](_0xb2975));if(_0xb2975['error']){if(_0xb2975[_0xe935('0x1c')][_0xe935('0x1d')]===0x1f4){logger['error'](_0xe935('0x18'),_0x21ee1,_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);return _0x232283(_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);}logger[_0xe935('0x1c')](_0xe935('0x18'),_0x21ee1,_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);return _0x47299c(_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);}else{logger[_0xe935('0x17')](_0xe935('0x18'),_0x21ee1,_0xe935('0x19'));_0x47299c(_0xb2975['result'][_0xe935('0x1e')]);}})['catch'](function(_0x189195){logger[_0xe935('0x1c')](_0xe935('0x18'),_0x21ee1,_0x189195);_0x232283(_0x189195);});});}function respondWithResult(_0x1ea49b,_0x39750b){_0x39750b=_0x39750b||0xc8;return function(_0x59298d){if(_0x59298d){return _0x1ea49b['status'](_0x39750b)[_0xe935('0x1f')](_0x59298d);}};}function respondWithFilteredResult(_0x9e5611,_0x382104){return function(_0x2c0497){if(_0x2c0497){var _0x443e99=typeof _0x382104[_0xe935('0x20')]===_0xe935('0x21')&&typeof _0x382104[_0xe935('0x22')]===_0xe935('0x21');var _0xafc125=_0x2c0497[_0xe935('0x23')];var _0x5f040d=_0x443e99?0x0:_0x382104[_0xe935('0x20')];var _0x4fbe9e=_0x443e99?_0x2c0497[_0xe935('0x23')]:_0x382104['offset']+_0x382104[_0xe935('0x22')];var _0x136033;if(_0x4fbe9e>=_0xafc125){_0x4fbe9e=_0xafc125;_0x136033=0xc8;}else{_0x136033=0xce;}_0x9e5611['status'](_0x136033);return _0x9e5611[_0xe935('0x24')]('Content-Range',_0x5f040d+'-'+_0x4fbe9e+'/'+_0xafc125)['json'](_0x2c0497);}return null;};}function saveUpdates(_0x120923){return function(_0x58d2ee){if(_0x58d2ee){return _0x58d2ee[_0xe935('0x25')](_0x120923)[_0xe935('0x26')](function(_0x552a5c){return _0x552a5c;});}return null;};}function removeEntity(_0x247a36){return function(_0x136106){if(_0x136106){return _0x136106['destroy']()[_0xe935('0x26')](function(){_0x247a36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f14b2){return function(_0x498bbb){if(!_0x498bbb){_0x5f14b2[_0xe935('0x27')](0x194);}return _0x498bbb;};}function handleError(_0x23df1e,_0x3420d1){_0x3420d1=_0x3420d1||0x1f4;return function(_0x4efa22){logger['error'](_0x4efa22[_0xe935('0x28')]);if(_0x4efa22[_0xe935('0x29')]){delete _0x4efa22[_0xe935('0x29')];}_0x23df1e[_0xe935('0x2a')](_0x3420d1)['send'](_0x4efa22);};}exports[_0xe935('0x2b')]=function(_0x156717,_0x28898a){var _0x2f6293={},_0x5703b3={},_0x4093c4={'count':0x0,'rows':[]};var _0x579648=_[_0xe935('0x2c')](db[_0xe935('0x2d')]['rawAttributes'],function(_0xca2998){return{'name':_0xca2998['fieldName'],'type':_0xca2998[_0xe935('0x2e')][_0xe935('0x2f')]};});_0x5703b3[_0xe935('0x30')]=_[_0xe935('0x2c')](_0x579648,'name');_0x5703b3[_0xe935('0x31')]=_['keys'](_0x156717[_0xe935('0x31')]);_0x5703b3['filters']=_[_0xe935('0x32')](_0x5703b3[_0xe935('0x30')],_0x5703b3[_0xe935('0x31')]);_0x2f6293[_0xe935('0x33')]=_[_0xe935('0x32')](_0x5703b3[_0xe935('0x30')],qs[_0xe935('0x34')](_0x156717[_0xe935('0x31')]['fields']));_0x2f6293[_0xe935('0x33')]=_0x2f6293[_0xe935('0x33')][_0xe935('0x35')]?_0x2f6293[_0xe935('0x33')]:_0x5703b3['model'];if(!_0x156717[_0xe935('0x31')][_0xe935('0x36')](_0xe935('0x37'))){_0x2f6293['limit']=qs[_0xe935('0x22')](_0x156717[_0xe935('0x31')][_0xe935('0x22')]);_0x2f6293['offset']=qs[_0xe935('0x20')](_0x156717['query']['offset']);}_0x2f6293['order']=qs[_0xe935('0x38')](_0x156717[_0xe935('0x31')]['sort']);_0x2f6293[_0xe935('0x39')]=qs[_0xe935('0x3a')](_[_0xe935('0x3b')](_0x156717['query'],_0x5703b3['filters']),_0x579648);if(_0x156717['query'][_0xe935('0x3c')]){_0x2f6293['where']=_[_0xe935('0x3d')](_0x2f6293[_0xe935('0x39')],{'$or':_[_0xe935('0x2c')](_0x579648,function(_0x230e83){if(_0x230e83[_0xe935('0x2e')]!==_0xe935('0x3e')){var _0x258f3e={};_0x258f3e[_0x230e83['name']]={'$like':'%'+_0x156717[_0xe935('0x31')][_0xe935('0x3c')]+'%'};return _0x258f3e;}})});}_0x2f6293=_['merge']({},_0x2f6293,_0x156717[_0xe935('0x3f')]);var _0xde5a3d={'where':_0x2f6293[_0xe935('0x39')]};return db[_0xe935('0x2d')]['count'](_0xde5a3d)[_0xe935('0x26')](function(_0x4d32d9){_0x4093c4[_0xe935('0x23')]=_0x4d32d9;if(_0x156717[_0xe935('0x31')][_0xe935('0x40')]){_0x2f6293[_0xe935('0x41')]=[{'all':!![]}];}return db[_0xe935('0x2d')][_0xe935('0x42')](_0x2f6293);})[_0xe935('0x26')](function(_0x22f709){_0x4093c4[_0xe935('0x43')]=_0x22f709;return _0x4093c4;})[_0xe935('0x26')](respondWithFilteredResult(_0x28898a,_0x2f6293))['catch'](handleError(_0x28898a,null));};exports[_0xe935('0x44')]=function(_0x4a6630,_0x30ff89){var _0x11ea9b={'raw':!![],'where':{'id':_0x4a6630[_0xe935('0x45')]['id']}},_0x125b6e={};_0x125b6e[_0xe935('0x30')]=_['keys'](db[_0xe935('0x2d')][_0xe935('0x46')]);_0x125b6e[_0xe935('0x31')]=_[_0xe935('0x47')](_0x4a6630[_0xe935('0x31')]);_0x125b6e[_0xe935('0x3a')]=_[_0xe935('0x32')](_0x125b6e['model'],_0x125b6e[_0xe935('0x31')]);_0x11ea9b['attributes']=_[_0xe935('0x32')](_0x125b6e[_0xe935('0x30')],qs[_0xe935('0x34')](_0x4a6630['query'][_0xe935('0x34')]));_0x11ea9b[_0xe935('0x33')]=_0x11ea9b[_0xe935('0x33')][_0xe935('0x35')]?_0x11ea9b[_0xe935('0x33')]:_0x125b6e[_0xe935('0x30')];if(_0x4a6630[_0xe935('0x31')][_0xe935('0x40')]){_0x11ea9b[_0xe935('0x41')]=[{'all':!![]}];}_0x11ea9b=_[_0xe935('0x3d')]({},_0x11ea9b,_0x4a6630['options']);return db[_0xe935('0x2d')][_0xe935('0x48')](_0x11ea9b)['then'](handleEntityNotFound(_0x30ff89,null))[_0xe935('0x26')](respondWithResult(_0x30ff89,null))[_0xe935('0x49')](handleError(_0x30ff89,null));};exports['update']=function(_0x983a34,_0xfd593c){if(_0x983a34['body']['id']){delete _0x983a34[_0xe935('0x4a')]['id'];}return db[_0xe935('0x2d')]['find']({'where':{'id':_0x983a34[_0xe935('0x45')]['id']}})['then'](handleEntityNotFound(_0xfd593c,null))[_0xe935('0x26')](saveUpdates(_0x983a34['body'],null))[_0xe935('0x26')](respondWithResult(_0xfd593c,null))[_0xe935('0x49')](handleError(_0xfd593c,null));};exports[_0xe935('0x4b')]=function(_0x323ef5,_0x228059){return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x323ef5[_0xe935('0x45')]['id']}})[_0xe935('0x26')](handleEntityNotFound(_0x228059,null))[_0xe935('0x26')](removeEntity(_0x228059,null))[_0xe935('0x49')](handleError(_0x228059,null));};exports[_0xe935('0x4c')]=function(_0x57e32c,_0x1dbdac){return db['MailMessage'][_0xe935('0x4c')]()['then'](respondWithResult(_0x1dbdac,null))[_0xe935('0x49')](handleError(_0x1dbdac,null));};exports[_0xe935('0x4d')]=function(_0x47eb6a,_0xdb3362){return db[_0xe935('0x2d')][_0xe935('0x4d')](_0x47eb6a[_0xe935('0x4a')])['then'](function(_0x22f4c5){if(_0x22f4c5){if(_0x22f4c5[_0xe935('0x4e')]==='out'&&!_0x22f4c5[_0xe935('0x4f')]){var _0x968cbe,_0x10c96b,_0x513ed8;if(_0x47eb6a['body']['to']){_0x10c96b=_0x47eb6a[_0xe935('0x4a')]['to'][_0xe935('0x50')](',')[0x0];}return db[_0xe935('0x51')][_0xe935('0x52')]({'where':{'id':_0x22f4c5[_0xe935('0x53')]},'include':[{'model':db[_0xe935('0x54')],'as':_0xe935('0x55'),'include':[{'model':db[_0xe935('0x56')],'as':'Contacts','where':{'email':_0x10c96b},'limit':0x1,'order':[[_0xe935('0x57'),_0xe935('0x58')]]}]},{'model':db[_0xe935('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe935('0x5a'),'raw':!![]}]}]})[_0xe935('0x26')](function(_0x3f2087){_0x968cbe=_0x3f2087;if(!_0x968cbe||!_0x968cbe[_0xe935('0x5b')])return;var _0x59dc3c=_0x968cbe[_0xe935('0x5c')]();if(_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')]&&_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0xe935('0x35')]){for(var _0x4bbc5c=0x0;_0x4bbc5c<_0x47eb6a['body'][_0xe935('0x5d')]['length'];_0x4bbc5c+=0x1){_0x47eb6a['body'][_0xe935('0x5d')][_0x4bbc5c]={'filename':_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0x4bbc5c]['name'],'path':path[_0xe935('0x5e')](config[_0xe935('0x5f')],_0xe935('0x60'),_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0x4bbc5c][_0xe935('0x61')])};}}_0x513ed8={'account':_0x59dc3c,'message':_0x47eb6a['body']};return;})[_0xe935('0x26')](function(){if(_0x968cbe[_0xe935('0x55')]){if(_0x968cbe[_0xe935('0x55')][_0xe935('0x62')]['length']){return _0x968cbe['List'][_0xe935('0x62')][0x0];}else{return db[_0xe935('0x56')]['create'](_[_0xe935('0xe')](_0x47eb6a[_0xe935('0x4a')],{'firstName':_0x47eb6a[_0xe935('0x4a')]['to'],'email':_0x47eb6a['body']['to'],'phone':_0x47eb6a[_0xe935('0x4a')]['to'],'ListId':_0x968cbe[_0xe935('0x63')]}));}}else{throw new Error(_0xe935('0x64'));}})[_0xe935('0x26')](function(){if(_0x513ed8){return respondWithRpcPromise(_0xe935('0x65'),_0xe935('0x66'),_0x513ed8,client9003)[_0xe935('0x26')](function(_0x3ca24e){return _0x22f4c5['update']({'read':!![],'messageId':_0x3ca24e[_0xe935('0x67')],'sentAt':moment()[_0xe935('0x68')](_0xe935('0x69'))});})[_0xe935('0x49')](function(_0x25e26c){logger['error']('%s',JSON[_0xe935('0x6a')](_0x25e26c));return _0x22f4c5;});}return _0x22f4c5;});}return _0x22f4c5;}})[_0xe935('0x26')](respondWithResult(_0xdb3362,0xc9))['catch'](handleError(_0xdb3362,null));};exports['accept']=function(_0x1593b6,_0x4fddc5){var _0x4a8747={'agent':{},'channel':_0xe935('0x6b')};if(_0x1593b6[_0xe935('0x4a')]['id']){delete _0x1593b6[_0xe935('0x4a')]['id'];}_0x1593b6[_0xe935('0x4a')][_0xe935('0x6c')]=!![];_0x1593b6[_0xe935('0x4a')][_0xe935('0x6d')]=moment()[_0xe935('0x68')](_0xe935('0x69'));_0x1593b6[_0xe935('0x4a')]['UserId']=_0x1593b6['body'][_0xe935('0x6e')]||_0x1593b6[_0xe935('0x6f')]['id'];_0x4a8747['agent']['id']=_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')];return db[_0xe935('0x2d')]['find']({'where':{'id':_0x1593b6[_0xe935('0x45')]['id'],'UserId':null}})[_0xe935('0x26')](handleEntityNotFound(_0x4fddc5,null))[_0xe935('0x26')](saveUpdates(_0x1593b6[_0xe935('0x4a')],null))['then'](function(_0x1c7e68){if(_0x1c7e68){_0x4a8747[_0xe935('0x1e')]=_0x1c7e68[_0xe935('0x70')]({'plain':!![]});return db[_0xe935('0x71')][_0xe935('0x48')]({'where':{'id':_0x1c7e68[_0xe935('0x72')]}});}return null;})[_0xe935('0x26')](handleEntityNotFound(_0x4fddc5,null))[_0xe935('0x26')](function(_0x3661d9){if(_0x3661d9){return _0x3661d9[_0xe935('0x25')]({'UserId':_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')],'read1stAt':_[_0xe935('0x73')](_0x3661d9[_0xe935('0x74')])?moment()[_0xe935('0x68')](_0xe935('0x69')):undefined});}return null;})[_0xe935('0x26')](function(_0x4b3a67){if(_0x4b3a67){_0x4a8747[_0xe935('0x75')]=_0x4b3a67[_0xe935('0x70')]({'plain':!![]});interaction_log[_0xe935('0x17')](_0xe935('0x76'),_0x1593b6[_0xe935('0x6f')]['id'],_0x1593b6['user'][_0xe935('0x29')],_0x1593b6[_0xe935('0x6f')][_0xe935('0x77')],_0x4a8747['interaction']['id'],_0x1593b6[_0xe935('0x4a')]?JSON[_0xe935('0x6a')](_0x1593b6[_0xe935('0x4a')]):_0xe935('0x78'));return respondWithRpcPromise(_0xe935('0x79'),_0xe935('0x7a'),_0x4a8747);}return null;})['then'](function(_0x26b30d){var _0xc6ee7b=_0xe935('0x7b')+_0x26b30d[_0xe935('0x1e')][_0xe935('0x7c')];return db[_0xe935('0x7d')][_0xe935('0x31')](_0xc6ee7b,{'type':db['Sequelize'][_0xe935('0x7e')][_0xe935('0x7f')],'raw':!![]})[_0xe935('0x26')](function(_0x418a0d){return _0x418a0d;});})[_0xe935('0x26')](function(_0x55eff2){if(_0x55eff2){_0x4a8747[_0xe935('0x1e')][_0xe935('0x80')]=_0x55eff2[0x0];if(!_0x1593b6['body'][_0xe935('0x6e')])return;return db[_0xe935('0x81')][_0xe935('0x48')]({'where':{'id':_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')],'role':_0xe935('0x82')},'attributes':['id','name','fullname',_0xe935('0x83'),_0xe935('0x84')],'raw':!![]});}return null;})['then'](function(_0x2d23b1){if(!_0x2d23b1)return null;_0x4a8747[_0xe935('0x1e')][_0xe935('0x82')]=_0x2d23b1;return _0x4a8747;})['then'](function(_0xdfeac5){if(_0xdfeac5){if(_0x1593b6[_0xe935('0x4a')]['manual']){_0x4a8747[_0xe935('0x1e')][_0xe935('0x85')]=util['format'](_0xe935('0x86'),_0x1593b6[_0xe935('0x6f')]['name']);_0x4a8747[_0xe935('0x1e')]['channel']=_0x4a8747[_0xe935('0x87')];_0x4a8747[_0xe935('0x1e')][_0xe935('0x88')]=_0x4a8747[_0xe935('0x87')];_0x4a8747['message'][_0xe935('0x89')]='accept';_0x4a8747[_0xe935('0x1e')][_0xe935('0x4a')]=htmlToText[_0xe935('0x8a')](_0x4a8747[_0xe935('0x1e')]['body']);return respondWithRpcPromise(_0xe935('0x8b'),_0xe935('0x8b'),{'event':_0xe935('0x8c'),'message':_0x4a8747[_0xe935('0x1e')]},client9002)[_0xe935('0x26')](function(){return _0x4a8747;});}return _0x4a8747;}return null;})[_0xe935('0x26')](respondWithResult(_0x4fddc5,null))[_0xe935('0x49')](handleError(_0x4fddc5,null));};exports['reject']=function(_0x54ffd1,_0x14b81c){var _0x549687={'agent':{},'channel':_0xe935('0x6b')};if(_0x54ffd1['body']['id']){delete _0x54ffd1[_0xe935('0x4a')]['id'];}_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')]=_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')]||_0x54ffd1[_0xe935('0x6f')]['id'];_0x549687[_0xe935('0x82')]['id']=_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')];return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x54ffd1[_0xe935('0x45')]['id'],'UserId':null}})[_0xe935('0x26')](handleEntityNotFound(_0x14b81c,null))[_0xe935('0x26')](function(_0x5bc5de){if(_0x5bc5de){_0x549687['message']=_0x5bc5de['get']({'plain':!![]});return db[_0xe935('0x71')][_0xe935('0x48')]({'where':{'id':_0x5bc5de[_0xe935('0x72')]}});}return null;})[_0xe935('0x26')](handleEntityNotFound(_0x14b81c,null))[_0xe935('0x26')](function(_0x3680e2){if(_0x3680e2){_0x549687[_0xe935('0x75')]=_0x3680e2[_0xe935('0x70')]({'plain':!![]});interaction_log['info'](_0xe935('0x8d'),_0x54ffd1[_0xe935('0x6f')]['id'],_0x54ffd1[_0xe935('0x6f')][_0xe935('0x29')],_0x54ffd1[_0xe935('0x6f')][_0xe935('0x77')],_0x549687['interaction']['id'],_0x54ffd1['body']?JSON[_0xe935('0x6a')](_0x54ffd1[_0xe935('0x4a')]):_0xe935('0x78'));return respondWithRpcPromise(_0xe935('0x8e'),_0xe935('0x8f'),_0x549687);}return null;})[_0xe935('0x26')](function(_0x286ad2){var _0x4a0c97=_0xe935('0x7b')+_0x286ad2[_0xe935('0x1e')][_0xe935('0x7c')];return db[_0xe935('0x7d')][_0xe935('0x31')](_0x4a0c97,{'type':db[_0xe935('0x90')][_0xe935('0x7e')]['SELECT'],'raw':!![]})[_0xe935('0x26')](function(_0x171807){return _0x171807;});})['then'](function(_0x372354){if(_0x372354){_0x549687[_0xe935('0x1e')][_0xe935('0x80')]=_0x372354[0x0];if(!_0x54ffd1[_0xe935('0x4a')]['UserId'])return;return db[_0xe935('0x81')][_0xe935('0x48')]({'where':{'id':_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')],'role':_0xe935('0x82')},'attributes':['id',_0xe935('0x29'),_0xe935('0x91'),_0xe935('0x83'),'internal'],'raw':!![]});}return null;})[_0xe935('0x26')](function(_0x3bd6cf){if(!_0x3bd6cf)return null;_0x549687['message'][_0xe935('0x82')]=_0x3bd6cf;return _0x549687;})[_0xe935('0x26')](function(_0x39adc1){if(_0x39adc1){_0x39adc1[_0xe935('0x1e')][_0xe935('0x85')]=util[_0xe935('0x68')]('SIP/%s',_0x54ffd1[_0xe935('0x6f')][_0xe935('0x29')]);_0x39adc1[_0xe935('0x1e')][_0xe935('0x87')]=_0x549687[_0xe935('0x87')];_0x39adc1[_0xe935('0x1e')][_0xe935('0x88')]=_0x549687[_0xe935('0x87')];_0x39adc1[_0xe935('0x1e')]['event']='reject';_0x39adc1['message'][_0xe935('0x4a')]=htmlToText[_0xe935('0x8a')](_0x549687['message'][_0xe935('0x4a')]);respondWithRpcPromise(_0xe935('0x8b'),'EventManager',{'event':'rejectmessage','message':_0x39adc1['message']},client9002);return _0x549687;}return null;})[_0xe935('0x26')](respondWithResult(_0x14b81c,null))[_0xe935('0x49')](handleError(_0x14b81c,null));};exports[_0xe935('0x92')]=function(_0x5827f1,_0x5867b7){var _0x2b989a=moment()[_0xe935('0x93')]()['toString']();var _0x49734b=path[_0xe935('0x5e')](config['root'],_0xe935('0x94'),_0xe935('0x95'),_0xe935('0x96'));var _0x543972=path[_0xe935('0x5e')](config[_0xe935('0x5f')],_0xe935('0x94'),_0xe935('0x95'),_0xe935('0x5d'));var _0x1bab32=util[_0xe935('0x68')]('message-%s.eml',_0x2b989a);return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x5827f1[_0xe935('0x45')]['id']},'attributes':['id','body',_0xe935('0x97'),'to','cc','bcc','subject','createdAt'],'include':_0x5827f1[_0xe935('0x31')][_0xe935('0x5d')]?[{'model':db[_0xe935('0x98')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5867b7,null))[_0xe935('0x26')](function(_0x5e3bd0){if(_0x5e3bd0){var _0x12dc43=_0x5e3bd0;var _0x4d05cb={'from':_0x12dc43['from'],'to':_0x12dc43['to'],'subject':_0x12dc43[_0xe935('0x99')],'html':htmlEntities['decode'](_0x12dc43[_0xe935('0x4a')]),'headers':{'Date':moment(_0x12dc43[_0xe935('0x9a')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5e3bd0['cc']){_0x4d05cb['headers']['Cc']=_0x5e3bd0['cc'];}if(_0x5e3bd0['bcc']){_0x4d05cb['headers'][_0xe935('0x9b')]=_0x5e3bd0[_0xe935('0x9c')];}return new BPromise(function(_0x154db2,_0x27c5fd){if(_0x5e3bd0['Attachments']){for(var _0x353e84=0x0;_0x353e84<_0x5e3bd0[_0xe935('0x9d')][_0xe935('0x35')];_0x353e84++){var _0x5c749b=_0x5e3bd0[_0xe935('0x9d')][_0x353e84];var _0x2cbd6a=path[_0xe935('0x5e')](_0x543972,_0x5c749b[_0xe935('0x61')]);if(fs[_0xe935('0x9e')](_0x2cbd6a)){_0x4d05cb[_0xe935('0x5d')][_0xe935('0x9f')]({'name':_0x5c749b['name'],'contentType':_0x5c749b[_0xe935('0x2e')],'data':fs['readFileSync'](_0x2cbd6a)});}}}emlformat[_0xe935('0xa0')](_0x4d05cb,function(_0x245f90,_0x4a565a){if(_0x245f90)return _0x27c5fd(_0x245f90);fs['writeFileSync'](path[_0xe935('0x5e')](_0x49734b,_0x1bab32),_0x4a565a);return _0x154db2(_0x4a565a);});});}})['then'](function(_0x17e554){if(_0x17e554){return _0x5867b7[_0xe935('0x92')](path['join'](_0x49734b,_0x1bab32),_0x1bab32,function(_0xa5ca23){if(!_0xa5ca23)fs[_0xe935('0xa1')](path[_0xe935('0x5e')](_0x49734b,_0x1bab32));});}})[_0xe935('0x49')](handleError(_0x5867b7,null));}; \ No newline at end of file +var _0xd713=['debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','offset','undefined','limit','count','json','update','destroy','status','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','show','params','includeAll','find','body','describe','create','direction','out','secret','split','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','ContactId','sequelize','motionChannel','event','fromString','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','request','then','MailMessage,\x20%s,\x20%s'];(function(_0xb1f5f5,_0x274c29){var _0x26f76d=function(_0x42c203){while(--_0x42c203){_0xb1f5f5['push'](_0xb1f5f5['shift']());}};_0x26f76d(++_0x274c29);}(_0xd713,0x88));var _0x3d71=function(_0xb20b4e,_0x7cc362){_0xb20b4e=_0xb20b4e-0x0;var _0x13dd0c=_0xd713[_0xb20b4e];return _0x13dd0c;};'use strict';var emlformat=require('eml-format');var moment=require(_0x3d71('0x0'));var BPromise=require(_0x3d71('0x1'));var util=require('util');var path=require(_0x3d71('0x2'));var fs=require('fs');var _=require(_0x3d71('0x3'));var Redis=require(_0x3d71('0x4'));var htmlToText=require(_0x3d71('0x5'));var qs=require(_0x3d71('0x6'));var logger=require(_0x3d71('0x7'))(_0x3d71('0x8'));var interaction_log=require('../../config/logger')(_0x3d71('0x9'));var config=require(_0x3d71('0xa'));var db=require(_0x3d71('0xb'))['db'];config[_0x3d71('0xc')]=_[_0x3d71('0xd')](config[_0x3d71('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d71('0xe'))(new Redis(config[_0x3d71('0xc')]));var htmlEntities=require(_0x3d71('0xf'));require(_0x3d71('0x10'))[_0x3d71('0x11')](socket);var jayson=require(_0x3d71('0x12'));var client=jayson['client'][_0x3d71('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x3d71('0x13')]({'port':0x232b});var client9002=jayson['client'][_0x3d71('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x43fd1b,_0x396bc6,_0x424eeb,_0xf5c532){return new BPromise(function(_0x17d437,_0x4c08b6){var _0x3edc56=_0xf5c532||client;return _0x3edc56[_0x3d71('0x14')](_0x43fd1b,_0x424eeb)[_0x3d71('0x15')](function(_0x4edff0){logger['info'](_0x3d71('0x16'),_0x396bc6,'request\x20sent');logger[_0x3d71('0x17')](_0x3d71('0x18'),_0x396bc6,_0x3d71('0x19'),JSON[_0x3d71('0x1a')](_0x4edff0));if(_0x4edff0['error']){if(_0x4edff0['error'][_0x3d71('0x1b')]===0x1f4){logger[_0x3d71('0x1c')](_0x3d71('0x16'),_0x396bc6,_0x4edff0[_0x3d71('0x1c')][_0x3d71('0x1d')]);return _0x4c08b6(_0x4edff0[_0x3d71('0x1c')]['message']);}logger[_0x3d71('0x1c')](_0x3d71('0x16'),_0x396bc6,_0x4edff0['error'][_0x3d71('0x1d')]);return _0x17d437(_0x4edff0[_0x3d71('0x1c')][_0x3d71('0x1d')]);}else{logger[_0x3d71('0x1e')]('MailMessage,\x20%s,\x20%s',_0x396bc6,_0x3d71('0x19'));_0x17d437(_0x4edff0[_0x3d71('0x1f')][_0x3d71('0x1d')]);}})[_0x3d71('0x20')](function(_0x3312d9){logger[_0x3d71('0x1c')](_0x3d71('0x16'),_0x396bc6,_0x3312d9);_0x4c08b6(_0x3312d9);});});}function respondWithResult(_0x3d5b10,_0x5c7922){_0x5c7922=_0x5c7922||0xc8;return function(_0x3d4ce0){if(_0x3d4ce0){return _0x3d5b10['status'](_0x5c7922)['json'](_0x3d4ce0);}};}function respondWithFilteredResult(_0xf6da66,_0x26eb35){return function(_0x221b3d){if(_0x221b3d){var _0x17d48e=typeof _0x26eb35[_0x3d71('0x21')]===_0x3d71('0x22')&&typeof _0x26eb35[_0x3d71('0x23')]===_0x3d71('0x22');var _0x24dcad=_0x221b3d['count'];var _0x12ea38=_0x17d48e?0x0:_0x26eb35[_0x3d71('0x21')];var _0x2e27c9=_0x17d48e?_0x221b3d[_0x3d71('0x24')]:_0x26eb35[_0x3d71('0x21')]+_0x26eb35['limit'];var _0x49b5a7;if(_0x2e27c9>=_0x24dcad){_0x2e27c9=_0x24dcad;_0x49b5a7=0xc8;}else{_0x49b5a7=0xce;}_0xf6da66['status'](_0x49b5a7);return _0xf6da66['set']('Content-Range',_0x12ea38+'-'+_0x2e27c9+'/'+_0x24dcad)[_0x3d71('0x25')](_0x221b3d);}return null;};}function saveUpdates(_0x7ac352){return function(_0x2e7dce){if(_0x2e7dce){return _0x2e7dce[_0x3d71('0x26')](_0x7ac352)[_0x3d71('0x15')](function(_0x376b86){return _0x376b86;});}return null;};}function removeEntity(_0x215c31){return function(_0x231f45){if(_0x231f45){return _0x231f45[_0x3d71('0x27')]()['then'](function(){_0x215c31[_0x3d71('0x28')](0xcc)[_0x3d71('0x29')]();});}};}function handleEntityNotFound(_0x1dff12){return function(_0x2b6098){if(!_0x2b6098){_0x1dff12['sendStatus'](0x194);}return _0x2b6098;};}function handleError(_0x4c9127,_0x308ad2){_0x308ad2=_0x308ad2||0x1f4;return function(_0x5a93be){logger['error'](_0x5a93be[_0x3d71('0x2a')]);if(_0x5a93be[_0x3d71('0x2b')]){delete _0x5a93be[_0x3d71('0x2b')];}_0x4c9127[_0x3d71('0x28')](_0x308ad2)[_0x3d71('0x2c')](_0x5a93be);};}exports[_0x3d71('0x2d')]=function(_0x47a635,_0x2b382a){var _0x41f7b1={},_0x1be7ab={},_0x1aeb3d={'count':0x0,'rows':[]};var _0x2da4f6=_[_0x3d71('0x2e')](db[_0x3d71('0x2f')][_0x3d71('0x30')],function(_0x2e5aa4){return{'name':_0x2e5aa4[_0x3d71('0x31')],'type':_0x2e5aa4[_0x3d71('0x32')][_0x3d71('0x33')]};});_0x1be7ab['model']=_[_0x3d71('0x2e')](_0x2da4f6,_0x3d71('0x2b'));_0x1be7ab[_0x3d71('0x34')]=_[_0x3d71('0x35')](_0x47a635['query']);_0x1be7ab[_0x3d71('0x36')]=_[_0x3d71('0x37')](_0x1be7ab[_0x3d71('0x38')],_0x1be7ab[_0x3d71('0x34')]);_0x41f7b1[_0x3d71('0x39')]=_[_0x3d71('0x37')](_0x1be7ab[_0x3d71('0x38')],qs[_0x3d71('0x3a')](_0x47a635['query']['fields']));_0x41f7b1[_0x3d71('0x39')]=_0x41f7b1[_0x3d71('0x39')][_0x3d71('0x3b')]?_0x41f7b1[_0x3d71('0x39')]:_0x1be7ab[_0x3d71('0x38')];if(!_0x47a635[_0x3d71('0x34')]['hasOwnProperty'](_0x3d71('0x3c'))){_0x41f7b1['limit']=qs[_0x3d71('0x23')](_0x47a635['query'][_0x3d71('0x23')]);_0x41f7b1['offset']=qs[_0x3d71('0x21')](_0x47a635['query'][_0x3d71('0x21')]);}_0x41f7b1[_0x3d71('0x3d')]=qs[_0x3d71('0x3e')](_0x47a635[_0x3d71('0x34')][_0x3d71('0x3e')]);_0x41f7b1[_0x3d71('0x3f')]=qs[_0x3d71('0x36')](_[_0x3d71('0x40')](_0x47a635[_0x3d71('0x34')],_0x1be7ab[_0x3d71('0x36')]),_0x2da4f6);if(_0x47a635['query']['filter']){_0x41f7b1['where']=_[_0x3d71('0x41')](_0x41f7b1[_0x3d71('0x3f')],{'$or':_[_0x3d71('0x2e')](_0x2da4f6,function(_0x14fb96){if(_0x14fb96['type']!==_0x3d71('0x42')){var _0x221ddc={};_0x221ddc[_0x14fb96[_0x3d71('0x2b')]]={'$like':'%'+_0x47a635['query'][_0x3d71('0x43')]+'%'};return _0x221ddc;}})});}_0x41f7b1=_[_0x3d71('0x41')]({},_0x41f7b1,_0x47a635[_0x3d71('0x44')]);var _0x119705={'where':_0x41f7b1[_0x3d71('0x3f')]};return db[_0x3d71('0x2f')][_0x3d71('0x24')](_0x119705)[_0x3d71('0x15')](function(_0x5a3578){_0x1aeb3d[_0x3d71('0x24')]=_0x5a3578;if(_0x47a635['query']['includeAll']){_0x41f7b1[_0x3d71('0x45')]=[{'all':!![]}];}return db[_0x3d71('0x2f')]['findAll'](_0x41f7b1);})[_0x3d71('0x15')](function(_0xa04662){_0x1aeb3d['rows']=_0xa04662;return _0x1aeb3d;})[_0x3d71('0x15')](respondWithFilteredResult(_0x2b382a,_0x41f7b1))[_0x3d71('0x20')](handleError(_0x2b382a,null));};exports[_0x3d71('0x46')]=function(_0x58fa53,_0x4ee063){var _0x287ade={'raw':!![],'where':{'id':_0x58fa53[_0x3d71('0x47')]['id']}},_0x3f18cf={};_0x3f18cf[_0x3d71('0x38')]=_[_0x3d71('0x35')](db[_0x3d71('0x2f')]['rawAttributes']);_0x3f18cf[_0x3d71('0x34')]=_[_0x3d71('0x35')](_0x58fa53['query']);_0x3f18cf[_0x3d71('0x36')]=_[_0x3d71('0x37')](_0x3f18cf['model'],_0x3f18cf[_0x3d71('0x34')]);_0x287ade[_0x3d71('0x39')]=_[_0x3d71('0x37')](_0x3f18cf[_0x3d71('0x38')],qs['fields'](_0x58fa53['query'][_0x3d71('0x3a')]));_0x287ade['attributes']=_0x287ade[_0x3d71('0x39')][_0x3d71('0x3b')]?_0x287ade['attributes']:_0x3f18cf[_0x3d71('0x38')];if(_0x58fa53[_0x3d71('0x34')][_0x3d71('0x48')]){_0x287ade[_0x3d71('0x45')]=[{'all':!![]}];}_0x287ade=_['merge']({},_0x287ade,_0x58fa53[_0x3d71('0x44')]);return db[_0x3d71('0x2f')][_0x3d71('0x49')](_0x287ade)[_0x3d71('0x15')](handleEntityNotFound(_0x4ee063,null))[_0x3d71('0x15')](respondWithResult(_0x4ee063,null))[_0x3d71('0x20')](handleError(_0x4ee063,null));};exports[_0x3d71('0x26')]=function(_0x16839c,_0x16f529){if(_0x16839c['body']['id']){delete _0x16839c[_0x3d71('0x4a')]['id'];}return db[_0x3d71('0x2f')][_0x3d71('0x49')]({'where':{'id':_0x16839c[_0x3d71('0x47')]['id']}})['then'](handleEntityNotFound(_0x16f529,null))[_0x3d71('0x15')](saveUpdates(_0x16839c[_0x3d71('0x4a')],null))[_0x3d71('0x15')](respondWithResult(_0x16f529,null))['catch'](handleError(_0x16f529,null));};exports[_0x3d71('0x27')]=function(_0x42811e,_0x1a7ec4){return db[_0x3d71('0x2f')][_0x3d71('0x49')]({'where':{'id':_0x42811e[_0x3d71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a7ec4,null))[_0x3d71('0x15')](removeEntity(_0x1a7ec4,null))['catch'](handleError(_0x1a7ec4,null));};exports[_0x3d71('0x4b')]=function(_0x3e6bf1,_0x1ce7bb){return db['MailMessage'][_0x3d71('0x4b')]()['then'](respondWithResult(_0x1ce7bb,null))[_0x3d71('0x20')](handleError(_0x1ce7bb,null));};exports[_0x3d71('0x4c')]=function(_0x2558e1,_0x51ad67){return db['MailMessage'][_0x3d71('0x4c')](_0x2558e1[_0x3d71('0x4a')])[_0x3d71('0x15')](function(_0x3a50f2){if(_0x3a50f2){if(_0x3a50f2[_0x3d71('0x4d')]===_0x3d71('0x4e')&&!_0x3a50f2[_0x3d71('0x4f')]){var _0x46e0a1,_0x41fbe6,_0x20f0a5;if(_0x2558e1[_0x3d71('0x4a')]['to']){_0x41fbe6=_0x2558e1[_0x3d71('0x4a')]['to'][_0x3d71('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x3a50f2[_0x3d71('0x51')]},'include':[{'model':db[_0x3d71('0x52')],'as':'List','include':[{'model':db[_0x3d71('0x53')],'as':_0x3d71('0x54'),'where':{'email':_0x41fbe6},'limit':0x1,'order':[[_0x3d71('0x55'),_0x3d71('0x56')]]}]},{'model':db['MailServerOut'],'as':_0x3d71('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x3d71('0x58'),'raw':!![]}]}]})['then'](function(_0x3d8fa9){_0x46e0a1=_0x3d8fa9;if(!_0x46e0a1||!_0x46e0a1[_0x3d71('0x57')])return;var _0x545be3=_0x46e0a1[_0x3d71('0x59')]();if(_0x2558e1[_0x3d71('0x4a')][_0x3d71('0x5a')]&&_0x2558e1[_0x3d71('0x4a')]['attachments']['length']){for(var _0x4ea42d=0x0;_0x4ea42d<_0x2558e1[_0x3d71('0x4a')][_0x3d71('0x5a')]['length'];_0x4ea42d+=0x1){_0x2558e1['body'][_0x3d71('0x5a')][_0x4ea42d]={'filename':_0x2558e1[_0x3d71('0x4a')]['attachments'][_0x4ea42d]['name'],'path':path[_0x3d71('0x5b')](config[_0x3d71('0x5c')],_0x3d71('0x5d'),_0x2558e1[_0x3d71('0x4a')][_0x3d71('0x5a')][_0x4ea42d][_0x3d71('0x5e')])};}}_0x20f0a5={'account':_0x545be3,'message':_0x2558e1[_0x3d71('0x4a')]};return;})['then'](function(){if(_0x46e0a1[_0x3d71('0x5f')]){if(_0x46e0a1[_0x3d71('0x5f')][_0x3d71('0x54')][_0x3d71('0x3b')]){return _0x46e0a1[_0x3d71('0x5f')][_0x3d71('0x54')][0x0];}else{return db[_0x3d71('0x53')][_0x3d71('0x4c')](_[_0x3d71('0xd')](_0x2558e1[_0x3d71('0x4a')],{'firstName':_0x2558e1['body']['to'],'email':_0x2558e1[_0x3d71('0x4a')]['to'],'phone':_0x2558e1[_0x3d71('0x4a')]['to'],'ListId':_0x46e0a1['ListId']}));}}else{throw new Error(_0x3d71('0x60'));}})['then'](function(){if(_0x20f0a5){return respondWithRpcPromise(_0x3d71('0x61'),_0x3d71('0x62'),_0x20f0a5,client9003)[_0x3d71('0x15')](function(_0x556768){return _0x3a50f2['update']({'read':!![],'messageId':_0x556768[_0x3d71('0x63')],'sentAt':moment()[_0x3d71('0x64')](_0x3d71('0x65'))});})[_0x3d71('0x20')](function(_0x115ed0){logger['error']('%s',JSON[_0x3d71('0x1a')](_0x115ed0));return _0x3a50f2;});}return _0x3a50f2;});}return _0x3a50f2;}})[_0x3d71('0x15')](respondWithResult(_0x51ad67,0xc9))[_0x3d71('0x20')](handleError(_0x51ad67,null));};exports[_0x3d71('0x66')]=function(_0x309962,_0x2c2c31){var _0x3f25c1={'agent':{},'channel':_0x3d71('0x67')};if(_0x309962['body']['id']){delete _0x309962['body']['id'];}_0x309962['body'][_0x3d71('0x68')]=!![];_0x309962[_0x3d71('0x4a')][_0x3d71('0x69')]=moment()[_0x3d71('0x64')](_0x3d71('0x65'));_0x309962['body'][_0x3d71('0x6a')]=_0x309962['body'][_0x3d71('0x6a')]||_0x309962[_0x3d71('0x6b')]['id'];_0x3f25c1[_0x3d71('0x6c')]['id']=_0x309962['body'][_0x3d71('0x6a')];return db[_0x3d71('0x2f')][_0x3d71('0x49')]({'where':{'id':_0x309962[_0x3d71('0x47')]['id'],'UserId':null}})[_0x3d71('0x15')](handleEntityNotFound(_0x2c2c31,null))[_0x3d71('0x15')](saveUpdates(_0x309962[_0x3d71('0x4a')],null))[_0x3d71('0x15')](function(_0x2b289b){if(_0x2b289b){_0x3f25c1[_0x3d71('0x1d')]=_0x2b289b['get']({'plain':!![]});return db[_0x3d71('0x6d')][_0x3d71('0x49')]({'where':{'id':_0x2b289b[_0x3d71('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x2c2c31,null))[_0x3d71('0x15')](function(_0x29cb6f){if(_0x29cb6f){return _0x29cb6f[_0x3d71('0x26')]({'UserId':_0x309962[_0x3d71('0x4a')][_0x3d71('0x6a')],'read1stAt':_[_0x3d71('0x6f')](_0x29cb6f[_0x3d71('0x70')])?moment()[_0x3d71('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3d71('0x15')](function(_0x1de4e3){if(_0x1de4e3){_0x3f25c1[_0x3d71('0x71')]=_0x1de4e3[_0x3d71('0x72')]({'plain':!![]});interaction_log['info'](_0x3d71('0x73'),_0x309962[_0x3d71('0x6b')]['id'],_0x309962[_0x3d71('0x6b')]['name'],_0x309962['user']['role'],_0x3f25c1[_0x3d71('0x71')]['id'],_0x309962[_0x3d71('0x4a')]?JSON['stringify'](_0x309962['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3f25c1);}return null;})[_0x3d71('0x15')](function(_0x140ade){var _0x570286=_0x3d71('0x74')+_0x140ade[_0x3d71('0x1d')]['ContactId'];return db['sequelize'][_0x3d71('0x34')](_0x570286,{'type':db[_0x3d71('0x75')][_0x3d71('0x76')][_0x3d71('0x77')],'raw':!![]})['then'](function(_0x34553a){return _0x34553a;});})['then'](function(_0x22770d){if(_0x22770d){_0x3f25c1[_0x3d71('0x1d')][_0x3d71('0x78')]=_0x22770d[0x0];if(!_0x309962[_0x3d71('0x4a')][_0x3d71('0x6a')])return;return db[_0x3d71('0x79')][_0x3d71('0x49')]({'where':{'id':_0x309962[_0x3d71('0x4a')]['UserId'],'role':_0x3d71('0x6c')},'attributes':['id','name','fullname',_0x3d71('0x7a'),_0x3d71('0x7b')],'raw':!![]});}return null;})[_0x3d71('0x15')](function(_0x1ac5af){if(!_0x1ac5af)return null;_0x3f25c1[_0x3d71('0x1d')][_0x3d71('0x6c')]=_0x1ac5af;return _0x3f25c1;})[_0x3d71('0x15')](function(_0x3444de){if(_0x3444de){if(_0x309962[_0x3d71('0x4a')][_0x3d71('0x7c')]){_0x3f25c1[_0x3d71('0x1d')][_0x3d71('0x7d')]=util['format'](_0x3d71('0x7e'),_0x309962[_0x3d71('0x6b')][_0x3d71('0x2b')]);_0x3f25c1['message']['channel']=_0x3f25c1['channel'];_0x3f25c1[_0x3d71('0x1d')]['motionChannel']=_0x3f25c1[_0x3d71('0x7f')];_0x3f25c1[_0x3d71('0x1d')]['event']='accept';_0x3f25c1[_0x3d71('0x1d')][_0x3d71('0x4a')]=htmlToText['fromString'](_0x3f25c1[_0x3d71('0x1d')][_0x3d71('0x4a')]);return respondWithRpcPromise(_0x3d71('0x80'),'EventManager',{'event':_0x3d71('0x81'),'message':_0x3f25c1[_0x3d71('0x1d')]},client9002)[_0x3d71('0x15')](function(){return _0x3f25c1;});}return _0x3f25c1;}return null;})['then'](respondWithResult(_0x2c2c31,null))[_0x3d71('0x20')](handleError(_0x2c2c31,null));};exports[_0x3d71('0x82')]=function(_0x49368c,_0x2d5a7b){var _0x3627b0={'agent':{},'channel':'mail'};if(_0x49368c[_0x3d71('0x4a')]['id']){delete _0x49368c['body']['id'];}_0x49368c['body'][_0x3d71('0x6a')]=_0x49368c[_0x3d71('0x4a')][_0x3d71('0x6a')]||_0x49368c[_0x3d71('0x6b')]['id'];_0x3627b0['agent']['id']=_0x49368c[_0x3d71('0x4a')][_0x3d71('0x6a')];return db['MailMessage'][_0x3d71('0x49')]({'where':{'id':_0x49368c[_0x3d71('0x47')]['id'],'UserId':null}})[_0x3d71('0x15')](handleEntityNotFound(_0x2d5a7b,null))[_0x3d71('0x15')](function(_0x1d3a9e){if(_0x1d3a9e){_0x3627b0[_0x3d71('0x1d')]=_0x1d3a9e['get']({'plain':!![]});return db[_0x3d71('0x6d')][_0x3d71('0x49')]({'where':{'id':_0x1d3a9e[_0x3d71('0x6e')]}});}return null;})[_0x3d71('0x15')](handleEntityNotFound(_0x2d5a7b,null))[_0x3d71('0x15')](function(_0x4f219b){if(_0x4f219b){_0x3627b0['interaction']=_0x4f219b[_0x3d71('0x72')]({'plain':!![]});interaction_log['info'](_0x3d71('0x83'),_0x49368c[_0x3d71('0x6b')]['id'],_0x49368c[_0x3d71('0x6b')][_0x3d71('0x2b')],_0x49368c['user'][_0x3d71('0x84')],_0x3627b0[_0x3d71('0x71')]['id'],_0x49368c[_0x3d71('0x4a')]?JSON[_0x3d71('0x1a')](_0x49368c['body']):_0x3d71('0x85'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3627b0);}return null;})[_0x3d71('0x15')](function(_0x11880c){var _0x5b2968=_0x3d71('0x74')+_0x11880c[_0x3d71('0x1d')][_0x3d71('0x86')];return db[_0x3d71('0x87')][_0x3d71('0x34')](_0x5b2968,{'type':db[_0x3d71('0x75')][_0x3d71('0x76')][_0x3d71('0x77')],'raw':!![]})[_0x3d71('0x15')](function(_0x1f17bd){return _0x1f17bd;});})['then'](function(_0x5dd0c8){if(_0x5dd0c8){_0x3627b0[_0x3d71('0x1d')]['contact']=_0x5dd0c8[0x0];if(!_0x49368c[_0x3d71('0x4a')][_0x3d71('0x6a')])return;return db['User'][_0x3d71('0x49')]({'where':{'id':_0x49368c[_0x3d71('0x4a')]['UserId'],'role':_0x3d71('0x6c')},'attributes':['id',_0x3d71('0x2b'),'fullname',_0x3d71('0x7a'),_0x3d71('0x7b')],'raw':!![]});}return null;})[_0x3d71('0x15')](function(_0x23ae2b){if(!_0x23ae2b)return null;_0x3627b0[_0x3d71('0x1d')][_0x3d71('0x6c')]=_0x23ae2b;return _0x3627b0;})[_0x3d71('0x15')](function(_0x3ed516){if(_0x3ed516){_0x3ed516[_0x3d71('0x1d')][_0x3d71('0x7d')]=util[_0x3d71('0x64')](_0x3d71('0x7e'),_0x49368c[_0x3d71('0x6b')][_0x3d71('0x2b')]);_0x3ed516[_0x3d71('0x1d')][_0x3d71('0x7f')]=_0x3627b0[_0x3d71('0x7f')];_0x3ed516['message'][_0x3d71('0x88')]=_0x3627b0[_0x3d71('0x7f')];_0x3ed516[_0x3d71('0x1d')][_0x3d71('0x89')]=_0x3d71('0x82');_0x3ed516[_0x3d71('0x1d')]['body']=htmlToText[_0x3d71('0x8a')](_0x3627b0['message'][_0x3d71('0x4a')]);respondWithRpcPromise(_0x3d71('0x80'),_0x3d71('0x80'),{'event':_0x3d71('0x8b'),'message':_0x3ed516[_0x3d71('0x1d')]},client9002);return _0x3627b0;}return null;})[_0x3d71('0x15')](respondWithResult(_0x2d5a7b,null))[_0x3d71('0x20')](handleError(_0x2d5a7b,null));};exports['download']=function(_0x219472,_0x5279c5){var _0x4ca7be=moment()[_0x3d71('0x8c')]()[_0x3d71('0x8d')]();var _0x2fe0b7=path[_0x3d71('0x5b')](config[_0x3d71('0x5c')],_0x3d71('0x8e'),_0x3d71('0x8f'),_0x3d71('0x90'));var _0x5b7d13=path[_0x3d71('0x5b')](config['root'],'server','files','attachments');var _0x290f5d=util[_0x3d71('0x64')](_0x3d71('0x91'),_0x4ca7be);return db[_0x3d71('0x2f')]['find']({'where':{'id':_0x219472[_0x3d71('0x47')]['id']},'attributes':['id',_0x3d71('0x4a'),_0x3d71('0x92'),'to','cc',_0x3d71('0x93'),_0x3d71('0x94'),'createdAt'],'include':_0x219472[_0x3d71('0x34')]['attachments']?[{'model':db[_0x3d71('0x95')],'as':_0x3d71('0x96')}]:undefined})[_0x3d71('0x15')](handleEntityNotFound(_0x5279c5,null))[_0x3d71('0x15')](function(_0x5bb1a2){if(_0x5bb1a2){var _0x223f88=_0x5bb1a2;var _0x4a4fa3={'from':_0x223f88[_0x3d71('0x92')],'to':_0x223f88['to'],'subject':_0x223f88[_0x3d71('0x94')],'html':htmlEntities[_0x3d71('0x97')](_0x223f88[_0x3d71('0x4a')]),'headers':{'Date':moment(_0x223f88['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5bb1a2['cc']){_0x4a4fa3[_0x3d71('0x98')]['Cc']=_0x5bb1a2['cc'];}if(_0x5bb1a2[_0x3d71('0x93')]){_0x4a4fa3[_0x3d71('0x98')][_0x3d71('0x99')]=_0x5bb1a2['bcc'];}return new BPromise(function(_0x59d687,_0x48c030){if(_0x5bb1a2[_0x3d71('0x96')]){for(var _0x2456be=0x0;_0x2456be<_0x5bb1a2[_0x3d71('0x96')][_0x3d71('0x3b')];_0x2456be++){var _0x47810f=_0x5bb1a2[_0x3d71('0x96')][_0x2456be];var _0x5f403d=path[_0x3d71('0x5b')](_0x5b7d13,_0x47810f[_0x3d71('0x5e')]);if(fs[_0x3d71('0x9a')](_0x5f403d)){_0x4a4fa3[_0x3d71('0x5a')][_0x3d71('0x9b')]({'name':_0x47810f[_0x3d71('0x2b')],'contentType':_0x47810f[_0x3d71('0x32')],'data':fs[_0x3d71('0x9c')](_0x5f403d)});}}}emlformat['build'](_0x4a4fa3,function(_0x2d27bf,_0x353c46){if(_0x2d27bf)return _0x48c030(_0x2d27bf);fs[_0x3d71('0x9d')](path[_0x3d71('0x5b')](_0x2fe0b7,_0x290f5d),_0x353c46);return _0x59d687(_0x353c46);});});}})[_0x3d71('0x15')](function(_0x5d0493){if(_0x5d0493){return _0x5279c5['download'](path[_0x3d71('0x5b')](_0x2fe0b7,_0x290f5d),_0x290f5d,function(_0x26db34){if(!_0x26db34)fs[_0x3d71('0x9e')](path['join'](_0x2fe0b7,_0x290f5d));});}})['catch'](handleError(_0x5279c5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 55130a7..fe77b40 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 _0x84f0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84f0,0x1c7));var _0x084f=function(_0x5c394b,_0x4ffcb8){_0x5c394b=_0x5c394b-0x0;var _0x7e9306=_0x84f0[_0x5c394b];return _0x7e9306;};'use strict';var EventEmitter=require(_0x084f('0x0'));var MailMessage=require(_0x084f('0x1'))['db'][_0x084f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x084f('0x3')](0x0);var events={'afterCreate':_0x084f('0x4'),'afterUpdate':_0x084f('0x5'),'afterDestroy':_0x084f('0x6')};function emitEvent(_0xadab7e){return function(_0x5c9d64,_0xeb467,_0x3765b2){MailMessageEvents[_0x084f('0x7')](_0xadab7e+':'+_0x5c9d64['id'],_0x5c9d64);MailMessageEvents['emit'](_0xadab7e,_0x5c9d64);_0x3765b2(null);};}for(var e in events){if(events[_0x084f('0x8')](e)){var event=events[e];MailMessage[_0x084f('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xbcb4=['events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xbcb4,0xfa));var _0x4bcb=function(_0x38a1cf,_0x4a3f82){_0x38a1cf=_0x38a1cf-0x0;var _0x38bfc8=_0xbcb4[_0x38a1cf];return _0x38bfc8;};'use strict';var EventEmitter=require(_0x4bcb('0x0'));var MailMessage=require(_0x4bcb('0x1'))['db'][_0x4bcb('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4bcb('0x3'),'afterUpdate':_0x4bcb('0x4'),'afterDestroy':_0x4bcb('0x5')};function emitEvent(_0x45ecbd){return function(_0x136f3a,_0x14cd9b,_0x5b459b){MailMessageEvents[_0x4bcb('0x6')](_0x45ecbd+':'+_0x136f3a['id'],_0x136f3a);MailMessageEvents[_0x4bcb('0x6')](_0x45ecbd,_0x136f3a);_0x5b459b(null);};}for(var e in events){if(events[_0x4bcb('0x7')](e)){var event=events[e];MailMessage[_0x4bcb('0x8')](e,emitEvent(event));}}module[_0x4bcb('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 01bf7a6..607f7a5 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 _0x18f5=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','util','api','moment','bluebird','request-promise','html-to-text','exports','define','MailMessage','mail_messages'];(function(_0x5b2309,_0x42468a){var _0x25b322=function(_0x5486e2){while(--_0x5486e2){_0x5b2309['push'](_0x5b2309['shift']());}};_0x25b322(++_0x42468a);}(_0x18f5,0xde));var _0x518f=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x18f5[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x518f('0x0'));var logger=require('../../config/logger')(_0x518f('0x1'));var moment=require(_0x518f('0x2'));var BPromise=require(_0x518f('0x3'));var rp=require(_0x518f('0x4'));var htmlToText=require(_0x518f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x518f('0x6')]=function(_0x46c1d6,_0x506881){return _0x46c1d6[_0x518f('0x7')](_0x518f('0x8'),attributes,{'tableName':_0x518f('0x9'),'paranoid':![],'indexes':[{'name':_0x518f('0xa'),'fields':[_0x518f('0xa')]},{'name':_0x518f('0xb'),'fields':[_0x518f('0xc'),'subject'],'type':_0x518f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4622cc,_0x26beb5,_0x413d2c){if(_0x4622cc[_0x518f('0xe')]){_0x4622cc[_0x518f('0xc')]=htmlToText[_0x518f('0xf')](_0x4622cc[_0x518f('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x413d2c(null,_0x26beb5);},'afterCreate':function(_0x167d7b,_0x3af712,_0x228e67){var _0xe47895=_0x46c1d6['models'];var _0x142703=_0x167d7b['get']({'plain':!![]});if(_0x142703[_0x518f('0x10')][_0x518f('0x11')]()==='in'||_0x142703[_0x518f('0x10')][_0x518f('0x11')]()===_0x518f('0x12')&&!_0x142703[_0x518f('0x13')]&&!_[_0x518f('0x14')](_0x142703[_0x518f('0x15')])){_0xe47895[_0x518f('0x16')][_0x518f('0x17')]({'where':{'id':_0x142703['MailInteractionId']}})[_0x518f('0x18')](function(_0x4e3bb9){if(_0x4e3bb9){_0x4e3bb9['update']({'lastMsgAt':_0x142703[_0x518f('0x19')],'lastMsgDirection':_0x142703['direction'][_0x518f('0x11')]()});}})[_0x518f('0x1a')](function(_0x23ec78){console[_0x518f('0x1b')](_0x23ec78);});}_0x228e67();}},'charset':_0x518f('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa9e3=['UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','body','models','get','toLowerCase','direction','out','secret','isNil'];(function(_0x371145,_0x271b3d){var _0x583fae=function(_0x596df7){while(--_0x596df7){_0x371145['push'](_0x371145['shift']());}};_0x583fae(++_0x271b3d);}(_0xa9e3,0x135));var _0x3a9e=function(_0x3353db,_0x836d70){_0x3353db=_0x3353db-0x0;var _0x211871=_0xa9e3[_0x3353db];return _0x211871;};'use strict';var _=require('lodash');var util=require(_0x3a9e('0x0'));var logger=require(_0x3a9e('0x1'))(_0x3a9e('0x2'));var moment=require(_0x3a9e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x3a9e('0x4'));var fs=require('fs');var path=require(_0x3a9e('0x5'));var rimraf=require(_0x3a9e('0x6'));var config=require('../../config/environment');var attributes=require(_0x3a9e('0x7'));module['exports']=function(_0x443d36,_0x13190d){return _0x443d36[_0x3a9e('0x8')](_0x3a9e('0x9'),attributes,{'tableName':_0x3a9e('0xa'),'paranoid':![],'indexes':[{'name':_0x3a9e('0xb'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x3a9e('0xc'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5aca79,_0x451ffa,_0x24f83d){if(_0x5aca79[_0x3a9e('0xd')]){_0x5aca79[_0x3a9e('0xc')]=htmlToText['fromString'](_0x5aca79[_0x3a9e('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x24f83d(null,_0x451ffa);},'afterCreate':function(_0x234423,_0x24f8a6,_0x1e61c6){var _0x1c9125=_0x443d36[_0x3a9e('0xe')];var _0x2f2b9c=_0x234423[_0x3a9e('0xf')]({'plain':!![]});if(_0x2f2b9c['direction'][_0x3a9e('0x10')]()==='in'||_0x2f2b9c[_0x3a9e('0x11')][_0x3a9e('0x10')]()===_0x3a9e('0x12')&&!_0x2f2b9c[_0x3a9e('0x13')]&&!_[_0x3a9e('0x14')](_0x2f2b9c[_0x3a9e('0x15')])){_0x1c9125[_0x3a9e('0x16')]['findOne']({'where':{'id':_0x2f2b9c[_0x3a9e('0x17')]}})[_0x3a9e('0x18')](function(_0x14d65d){if(_0x14d65d){_0x14d65d[_0x3a9e('0x19')]({'lastMsgAt':_0x2f2b9c['createdAt'],'lastMsgDirection':_0x2f2b9c['direction'][_0x3a9e('0x10')]()});}})[_0x3a9e('0x1a')](function(_0x29db59){console[_0x3a9e('0x1b')](_0x29db59);});}_0x1e61c6();}},'charset':_0x3a9e('0x1c'),'collate':_0x3a9e('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bd2b49f..55c2933 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 _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x370130,_0x450a35){var _0xf437a3=function(_0x4e83d7){while(--_0x4e83d7){_0x370130['push'](_0x370130['shift']());}};_0xf437a3(++_0x450a35);}(_0xfff0,0x139));var _0x0fff=function(_0x204453,_0x30bcb5){_0x204453=_0x204453-0x0;var _0x59eb35=_0xfff0[_0x204453];return _0x59eb35;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file +var _0x757a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','info','catch','CreateMailMessage','MailMessage','create','body','raw','debug','stringify','util','moment'];(function(_0x50df81,_0x4e4106){var _0x103de2=function(_0x48ea59){while(--_0x48ea59){_0x50df81['push'](_0x50df81['shift']());}};_0x103de2(++_0x4e4106);}(_0x757a,0xde));var _0xa757=function(_0x2c5113,_0x47375f){_0x2c5113=_0x2c5113-0x0;var _0x3c36c7=_0x757a[_0x2c5113];return _0x3c36c7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('MailMessage,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});}exports[_0xa757('0x15')]=function(_0x4bd137){var _0x58954=this;return new Promise(function(_0x4fec52,_0x32c2a1){return db[_0xa757('0x16')][_0xa757('0x17')](_0x4bd137[_0xa757('0x18')],{'raw':_0x4bd137['options']?_0x4bd137['options'][_0xa757('0x19')]===undefined?!![]:![]:!![]})[_0xa757('0xe')](function(_0x2ba923){logger[_0xa757('0x13')](_0xa757('0x15'),_0x4bd137);logger[_0xa757('0x1a')](_0xa757('0x15'),_0x4bd137,JSON[_0xa757('0x1b')](_0x2ba923));_0x4fec52(_0x2ba923);})[_0xa757('0x14')](function(_0x59fae6){logger[_0xa757('0x10')]('CreateMailMessage',_0x59fae6[_0xa757('0x12')],_0x4bd137);_0x32c2a1(_0x58954['error'](0x1f4,_0x59fae6[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 07b91ca..572c00f 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 _0x4d88=['update','emit','removeListener','register','mailMessage:','./mailMessage.events','save','remove'];(function(_0x9c4f57,_0x306efb){var _0x117937=function(_0x2193aa){while(--_0x2193aa){_0x9c4f57['push'](_0x9c4f57['shift']());}};_0x117937(++_0x306efb);}(_0x4d88,0x195));var _0x84d8=function(_0x20e5d4,_0x4ae460){_0x20e5d4=_0x20e5d4-0x0;var _0x54d52a=_0x4d88[_0x20e5d4];return _0x54d52a;};'use strict';var MailMessageEvents=require(_0x84d8('0x0'));var events=[_0x84d8('0x1'),_0x84d8('0x2'),_0x84d8('0x3')];function createListener(_0x3c0f63,_0x405420){return function(_0xdd5825){_0x405420[_0x84d8('0x4')](_0x3c0f63,_0xdd5825);};}function removeListener(_0x2b4832,_0x141c6a){return function(){MailMessageEvents[_0x84d8('0x5')](_0x2b4832,_0x141c6a);};}exports[_0x84d8('0x6')]=function(_0x38af88){for(var _0xee3556=0x0,_0xdda114=events['length'];_0xee3556<_0xdda114;_0xee3556++){var _0x55ffd4=events[_0xee3556];var _0x51f65c=createListener(_0x84d8('0x7')+_0x55ffd4,_0x38af88);MailMessageEvents['on'](_0x55ffd4,_0x51f65c);}}; \ No newline at end of file +var _0xb95a=['./mailMessage.events','save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0xb95a,0x13b));var _0xab95=function(_0x2ca6d8,_0x2d9065){_0x2ca6d8=_0x2ca6d8-0x0;var _0x3753e0=_0xb95a[_0x2ca6d8];return _0x3753e0;};'use strict';var MailMessageEvents=require(_0xab95('0x0'));var events=[_0xab95('0x1'),_0xab95('0x2'),_0xab95('0x3')];function createListener(_0x31644b,_0x240258){return function(_0xabb918){_0x240258[_0xab95('0x4')](_0x31644b,_0xabb918);};}function removeListener(_0x10c25e,_0xc692c6){return function(){MailMessageEvents[_0xab95('0x5')](_0x10c25e,_0xc692c6);};}exports[_0xab95('0x6')]=function(_0x4ef149){for(var _0xa2ba87=0x0,_0x208b01=events[_0xab95('0x7')];_0xa2ba87<_0x208b01;_0xa2ba87++){var _0x57123a=events[_0xa2ba87];var _0x38c015=createListener(_0xab95('0x8')+_0x57123a,_0x4ef149);MailMessageEvents['on'](_0x57123a,_0x38c015);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a436d6a..9c205fe 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 _0x44cb=['destroy','removeTeams','removeAgents','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','/:id'];(function(_0x276d17,_0x5e1e1f){var _0x2ce475=function(_0x534325){while(--_0x534325){_0x276d17['push'](_0x276d17['shift']());}};_0x2ce475(++_0x5e1e1f);}(_0x44cb,0x12f));var _0xb44c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44cb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb44c('0x0'));var path=require(_0xb44c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb44c('0x2')]();var fs_extra=require(_0xb44c('0x3'));var auth=require(_0xb44c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb44c('0x5'));var controller=require('./mailQueue.controller');router[_0xb44c('0x6')]('/',auth['isAuthenticated'](),controller[_0xb44c('0x7')]);router[_0xb44c('0x6')]('/describe',auth[_0xb44c('0x8')](),controller[_0xb44c('0x9')]);router[_0xb44c('0x6')]('/:id',auth[_0xb44c('0x8')](),controller[_0xb44c('0xa')]);router[_0xb44c('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0xb44c('0xb')]);router[_0xb44c('0x6')](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller['getTeams']);router[_0xb44c('0x6')](_0xb44c('0xd'),auth['isAuthenticated'](),controller[_0xb44c('0xe')]);router[_0xb44c('0xf')]('/',auth[_0xb44c('0x8')](),controller[_0xb44c('0x10')]);router['post'](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x11')]);router['post'](_0xb44c('0xd'),auth[_0xb44c('0x8')](),controller['addAgents']);router[_0xb44c('0x12')]('/:id',auth[_0xb44c('0x8')](),controller[_0xb44c('0x13')]);router[_0xb44c('0x14')](_0xb44c('0x15'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x16')]);router[_0xb44c('0x14')](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x17')]);router[_0xb44c('0x14')](_0xb44c('0xd'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x18')]);module['exports']=router; \ No newline at end of file +var _0x09eb=['show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x3f01dd,_0x128e0f){var _0x4bae40=function(_0x35a022){while(--_0x35a022){_0x3f01dd['push'](_0x3f01dd['shift']());}};_0x4bae40(++_0x128e0f);}(_0x09eb,0xf0));var _0xb09e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x09eb[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xb09e('0x0'));var util=require('util');var path=require(_0xb09e('0x1'));var timeout=require(_0xb09e('0x2'));var express=require(_0xb09e('0x3'));var router=express[_0xb09e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb09e('0x5'));var config=require(_0xb09e('0x6'));var controller=require('./mailQueue.controller');router[_0xb09e('0x7')]('/',auth[_0xb09e('0x8')](),controller[_0xb09e('0x9')]);router[_0xb09e('0x7')]('/describe',auth[_0xb09e('0x8')](),controller[_0xb09e('0xa')]);router[_0xb09e('0x7')](_0xb09e('0xb'),auth[_0xb09e('0x8')](),controller[_0xb09e('0xc')]);router[_0xb09e('0x7')]('/:id/members',auth[_0xb09e('0x8')](),controller[_0xb09e('0xd')]);router[_0xb09e('0x7')](_0xb09e('0xe'),auth[_0xb09e('0x8')](),controller['getTeams']);router[_0xb09e('0x7')](_0xb09e('0xf'),auth[_0xb09e('0x8')](),controller[_0xb09e('0x10')]);router[_0xb09e('0x11')]('/',auth[_0xb09e('0x8')](),controller[_0xb09e('0x12')]);router[_0xb09e('0x11')](_0xb09e('0xe'),auth['isAuthenticated'](),controller[_0xb09e('0x13')]);router[_0xb09e('0x11')](_0xb09e('0xf'),auth['isAuthenticated'](),controller[_0xb09e('0x14')]);router[_0xb09e('0x15')]('/:id',auth[_0xb09e('0x8')](),controller[_0xb09e('0x16')]);router[_0xb09e('0x17')](_0xb09e('0xb'),auth[_0xb09e('0x8')](),controller[_0xb09e('0x18')]);router[_0xb09e('0x17')]('/:id/teams',auth[_0xb09e('0x8')](),controller[_0xb09e('0x19')]);router[_0xb09e('0x17')](_0xb09e('0xf'),auth[_0xb09e('0x8')](),controller[_0xb09e('0x1a')]);module[_0xb09e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0c26510..57f6436 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 _0xf16f=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2c5009,_0x63505f){var _0x40b7f9=function(_0x3921bf){while(--_0x3921bf){_0x2c5009['push'](_0x2c5009['shift']());}};_0x40b7f9(++_0x63505f);}(_0xf16f,0xee));var _0xff16=function(_0x5d4508,_0x102d84){_0x5d4508=_0x5d4508-0x0;var _0xa956c5=_0xf16f[_0x5d4508];return _0xa956c5;};'use strict';var Sequelize=require(_0xff16('0x0'));module[_0xff16('0x1')]={'name':{'type':Sequelize[_0xff16('0x2')],'unique':_0xff16('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff16('0x2')]},'timeout':{'type':Sequelize[_0xff16('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xff16('0x5'),_0xff16('0x6'),_0xff16('0x7'))}}; \ No newline at end of file +var _0xb7c7=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x1beb1f,_0x1d41e6){var _0x2670f0=function(_0x454e35){while(--_0x454e35){_0x1beb1f['push'](_0x1beb1f['shift']());}};_0x2670f0(++_0x1d41e6);}(_0xb7c7,0x1ed));var _0x7b7c=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0xb7c7[_0x11d95f];return _0x2b1a14;};'use strict';var Sequelize=require('sequelize');module[_0x7b7c('0x0')]={'name':{'type':Sequelize[_0x7b7c('0x1')],'unique':_0x7b7c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b7c('0x1')]},'timeout':{'type':Sequelize[_0x7b7c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b7c('0x4')](_0x7b7c('0x5'),_0x7b7c('0x6'),_0x7b7c('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 31580f4..ea6681e 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 _0xc0d9=['all','union','compact','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','userMailQueue:save','getAgents','hasOwnProperty','util','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','attributes','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','intersection','fields','length','nolimit','order','sort','filters','pick','merge','filter','UserMailQueue','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','ids','User','online','voicePause','interface','Agents','transaction','addTeams','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','includes'];(function(_0x4e8ece,_0x49ce4f){var _0x161e2c=function(_0x22c12c){while(--_0x22c12c){_0x4e8ece['push'](_0x4e8ece['shift']());}};_0x161e2c(++_0x49ce4f);}(_0xc0d9,0x1f0));var _0x9c0d=function(_0x5426ff,_0x134efe){_0x5426ff=_0x5426ff-0x0;var _0x47c991=_0xc0d9[_0x5426ff];return _0x47c991;};'use strict';var BPromise=require('bluebird');var util=require(_0x9c0d('0x0'));var _=require(_0x9c0d('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x9c0d('0x2'));var logger=require(_0x9c0d('0x3'))('api');var config=require(_0x9c0d('0x4'));var db=require(_0x9c0d('0x5'))['db'];config['redis']=_[_0x9c0d('0x6')](config['redis'],{'host':_0x9c0d('0x7'),'port':0x18eb});var socket=require(_0x9c0d('0x8'))(new Redis(config['redis']));require(_0x9c0d('0x9'))[_0x9c0d('0xa')](socket);function respondWithStatusCode(_0x1c648d,_0x2fac1c){_0x2fac1c=_0x2fac1c||0xcc;return function(_0x2ae2c5){if(_0x2ae2c5){return _0x1c648d[_0x9c0d('0xb')](_0x2fac1c);}return _0x1c648d['status'](_0x2fac1c)[_0x9c0d('0xc')]();};}function respondWithResult(_0x41d838,_0x4a7311){_0x4a7311=_0x4a7311||0xc8;return function(_0x10a596){if(_0x10a596){return _0x41d838[_0x9c0d('0xd')](_0x4a7311)[_0x9c0d('0xe')](_0x10a596);}};}function respondWithFilteredResult(_0x3adf61,_0x1dabb3){return function(_0x249d8b){if(_0x249d8b){var _0x3fd952=typeof _0x1dabb3[_0x9c0d('0xf')]===_0x9c0d('0x10')&&typeof _0x1dabb3[_0x9c0d('0x11')]===_0x9c0d('0x10');var _0x5583a7=_0x249d8b[_0x9c0d('0x12')];var _0x23cd5b=_0x3fd952?0x0:_0x1dabb3[_0x9c0d('0xf')];var _0x7ec8f5=_0x3fd952?_0x249d8b[_0x9c0d('0x12')]:_0x1dabb3[_0x9c0d('0xf')]+_0x1dabb3[_0x9c0d('0x11')];var _0x4956e3;if(_0x7ec8f5>=_0x5583a7){_0x7ec8f5=_0x5583a7;_0x4956e3=0xc8;}else{_0x4956e3=0xce;}_0x3adf61[_0x9c0d('0xd')](_0x4956e3);return _0x3adf61[_0x9c0d('0x13')](_0x9c0d('0x14'),_0x23cd5b+'-'+_0x7ec8f5+'/'+_0x5583a7)[_0x9c0d('0xe')](_0x249d8b);}return null;};}function saveUpdates(_0xcfcbb2){return function(_0x5360db){if(_0x5360db){return _0x5360db[_0x9c0d('0x15')](_0xcfcbb2)[_0x9c0d('0x16')](function(_0x32f050){return _0x32f050;});}return null;};}function removeEntity(_0x2de4fa){return function(_0x35cb9d){if(_0x35cb9d){return _0x35cb9d[_0x9c0d('0x17')]()['then'](function(){var _0x50817c=_0x35cb9d['get']({'plain':!![]});var _0x5113f7=_0x9c0d('0x18');return db[_0x9c0d('0x19')][_0x9c0d('0x17')]({'where':{'type':_0x5113f7,'resourceId':_0x50817c['id']}})[_0x9c0d('0x16')](function(){return _0x35cb9d;});})['then'](function(){_0x2de4fa[_0x9c0d('0xd')](0xcc)[_0x9c0d('0xc')]();});}};}function handleEntityNotFound(_0x47c79f){return function(_0x4ad099){if(!_0x4ad099){_0x47c79f[_0x9c0d('0xb')](0x194);}return _0x4ad099;};}function handleError(_0x2e0cc2,_0x5947b2){_0x5947b2=_0x5947b2||0x1f4;return function(_0x36e291){logger[_0x9c0d('0x1a')](_0x36e291['stack']);if(_0x36e291[_0x9c0d('0x1b')]){delete _0x36e291['name'];}_0x2e0cc2[_0x9c0d('0xd')](_0x5947b2)[_0x9c0d('0x1c')](_0x36e291);};}exports[_0x9c0d('0x1d')]=function(_0x54f2c1,_0x435fa8){var _0x4ee99b={};var _0x462d5={'count':0x0,'rows':[]};var _0x5cc039=_[_0x9c0d('0x1e')](db[_0x9c0d('0x1f')]['rawAttributes'],function(_0x3bcba8){return{'name':_0x3bcba8['fieldName'],'type':_0x3bcba8[_0x9c0d('0x20')][_0x9c0d('0x21')]};});_0x4ee99b=qs[_0x9c0d('0x22')](_0x5cc039,_0x54f2c1);var _0x5897bc={'where':_0x4ee99b[_0x9c0d('0x23')]};return db['MailQueue'][_0x9c0d('0x12')](_0x5897bc)[_0x9c0d('0x16')](function(_0x5d78af){_0x462d5['count']=_0x5d78af;_0x4ee99b['include']=qs[_0x9c0d('0x24')](_0x54f2c1[_0x9c0d('0x25')]);return db[_0x9c0d('0x1f')][_0x9c0d('0x26')](_0x4ee99b);})[_0x9c0d('0x16')](function(_0x39a98c){_0x462d5[_0x9c0d('0x27')]=_0x39a98c;return _0x462d5;})[_0x9c0d('0x16')](respondWithFilteredResult(_0x435fa8,_0x4ee99b))[_0x9c0d('0x28')](handleError(_0x435fa8,null));};exports[_0x9c0d('0x29')]=function(_0x25e6b4,_0x2546a5){var _0x162f5e={'raw':!![],'where':{'id':_0x25e6b4[_0x9c0d('0x2a')]['id']}},_0x462da7={};_0x462da7[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db['MailQueue'][_0x9c0d('0x2d')]);_0x462da7['query']=_[_0x9c0d('0x2c')](_0x25e6b4['query']);_0x462da7['filters']=_['intersection'](_0x462da7[_0x9c0d('0x2b')],_0x462da7[_0x9c0d('0x25')]);_0x162f5e['attributes']=_['intersection'](_0x462da7[_0x9c0d('0x2b')],qs['fields'](_0x25e6b4[_0x9c0d('0x25')]['fields']));_0x162f5e[_0x9c0d('0x2e')]=_0x162f5e[_0x9c0d('0x2e')]['length']?_0x162f5e[_0x9c0d('0x2e')]:_0x462da7[_0x9c0d('0x2b')];if(_0x25e6b4[_0x9c0d('0x25')][_0x9c0d('0x2f')]){_0x162f5e[_0x9c0d('0x24')]=[{'all':!![]}];}_0x162f5e=_['merge']({},_0x162f5e,_0x25e6b4[_0x9c0d('0x30')]);return db['MailQueue'][_0x9c0d('0x31')](_0x162f5e)[_0x9c0d('0x16')](handleEntityNotFound(_0x2546a5,null))[_0x9c0d('0x16')](respondWithResult(_0x2546a5,null))[_0x9c0d('0x28')](handleError(_0x2546a5,null));};exports['create']=function(_0x7dcacb,_0x44a460){return db[_0x9c0d('0x1f')][_0x9c0d('0x32')](_0x7dcacb[_0x9c0d('0x33')],{})[_0x9c0d('0x16')](function(_0x40be2f){var _0xc14c2e=_0x7dcacb[_0x9c0d('0x34')][_0x9c0d('0x35')]({'plain':!![]});if(!_0xc14c2e)throw new Error(_0x9c0d('0x36'));if(_0xc14c2e[_0x9c0d('0x37')]===_0x9c0d('0x34')){var _0x15282d=_0x40be2f[_0x9c0d('0x35')]({'plain':!![]});var _0x48ba6f=_0x9c0d('0x18');return db[_0x9c0d('0x38')][_0x9c0d('0x31')]({'where':{'name':_0x48ba6f,'userProfileId':_0xc14c2e[_0x9c0d('0x39')]},'raw':!![]})[_0x9c0d('0x16')](function(_0x9ec008){if(_0x9ec008&&_0x9ec008['autoAssociation']===0x0){return db[_0x9c0d('0x19')][_0x9c0d('0x32')]({'name':_0x15282d[_0x9c0d('0x1b')],'resourceId':_0x15282d['id'],'type':_0x9ec008['name'],'sectionId':_0x9ec008['id']},{})['then'](function(){return _0x40be2f;});}else{return _0x40be2f;}})[_0x9c0d('0x28')](function(_0x54d42a){logger[_0x9c0d('0x1a')](_0x9c0d('0x3a'),_0x54d42a);throw _0x54d42a;});}return _0x40be2f;})[_0x9c0d('0x16')](respondWithResult(_0x44a460,0xc9))[_0x9c0d('0x28')](handleError(_0x44a460,null));};exports['update']=function(_0x5902fe,_0xce529){if(_0x5902fe[_0x9c0d('0x33')]['id']){delete _0x5902fe['body']['id'];}return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x5902fe[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0xce529,null))[_0x9c0d('0x16')](saveUpdates(_0x5902fe['body'],null))[_0x9c0d('0x16')](respondWithResult(_0xce529,null))[_0x9c0d('0x28')](handleError(_0xce529,null));};exports[_0x9c0d('0x17')]=function(_0x1940bb,_0x147895){return db[_0x9c0d('0x1f')]['find']({'where':{'id':_0x1940bb[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x147895,null))['then'](removeEntity(_0x147895,null))[_0x9c0d('0x28')](handleError(_0x147895,null));};exports[_0x9c0d('0x3b')]=function(_0x1d6110,_0x575709){return db['MailQueue'][_0x9c0d('0x3b')]()[_0x9c0d('0x16')](respondWithResult(_0x575709,null))['catch'](handleError(_0x575709,null));};exports['getMembers']=function(_0x4336fd,_0xfa40d3){var _0x38d2a8={'raw':!![],'where':{}},_0x594905={},_0x2d81c3;return db[_0x9c0d('0x1f')]['findOne']({'where':{'id':_0x4336fd[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0xfa40d3,null))[_0x9c0d('0x16')](function(_0xa8f8b7){if(_0xa8f8b7){_0x2d81c3=_0xa8f8b7[_0x9c0d('0x35')]({'plain':!![]});_0x594905[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db['UserMailQueue'][_0x9c0d('0x2d')]);_0x594905['query']=_['keys'](_0x4336fd[_0x9c0d('0x25')]);_0x594905['filters']=_[_0x9c0d('0x3c')](_0x594905[_0x9c0d('0x2b')],_0x594905[_0x9c0d('0x25')]);_0x38d2a8[_0x9c0d('0x2e')]=_[_0x9c0d('0x3c')](_0x594905[_0x9c0d('0x2b')],qs['fields'](_0x4336fd['query'][_0x9c0d('0x3d')]));_0x38d2a8[_0x9c0d('0x2e')]=_0x38d2a8[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x38d2a8[_0x9c0d('0x2e')]:_0x594905[_0x9c0d('0x2b')];if(!_0x4336fd[_0x9c0d('0x25')]['hasOwnProperty'](_0x9c0d('0x3f'))){_0x38d2a8[_0x9c0d('0x11')]=qs['limit'](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x38d2a8[_0x9c0d('0xf')]=qs[_0x9c0d('0xf')](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0xf')]);}_0x38d2a8[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0x41')]);_0x38d2a8[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_[_0x9c0d('0x43')](_0x4336fd[_0x9c0d('0x25')],_0x594905[_0x9c0d('0x42')]));_0x38d2a8[_0x9c0d('0x23')]['MailQueueId']=_0xa8f8b7['id'];if(_0x4336fd['query']['filter']){_0x38d2a8[_0x9c0d('0x23')]=_[_0x9c0d('0x44')](_0x38d2a8['where'],{'$or':_[_0x9c0d('0x1e')](_0x38d2a8[_0x9c0d('0x2e')],function(_0x2c3dc6){var _0x57b975={};_0x57b975[_0x2c3dc6]={'$like':'%'+_0x4336fd['query'][_0x9c0d('0x45')]+'%'};return _0x57b975;})});}_0x38d2a8=_[_0x9c0d('0x44')]({},_0x38d2a8,_0x4336fd[_0x9c0d('0x30')]);return db[_0x9c0d('0x46')][_0x9c0d('0x26')](_0x38d2a8);}})[_0x9c0d('0x16')](function(_0x11f9d7){if(_0x11f9d7){return db['User'][_0x9c0d('0x47')]({'where':{'id':_[_0x9c0d('0x1e')](_0x11f9d7,_0x9c0d('0x48')),'role':_0x9c0d('0x49')},'attributes':['id','name',_0x9c0d('0x4a'),'updatedAt',_0x9c0d('0x4b')]});}})['then'](function(_0x2f98ac){if(_0x2f98ac){return{'count':_0x2f98ac[_0x9c0d('0x12')],'rows':_[_0x9c0d('0x1e')](_0x2f98ac[_0x9c0d('0x27')],function(_0x4ec590){return{'membername':_0x4ec590[_0x9c0d('0x1b')],'UserId':_0x4ec590['id'],'queue_name':_0x2d81c3[_0x9c0d('0x1b')],'MailQueueId':_0x2d81c3['id'],'interface':util[_0x9c0d('0x4c')](_0x9c0d('0x4d'),_0x9c0d('0x4e'),_0x4ec590[_0x9c0d('0x1b')]),'penalty':0x0,'paused':_0x4ec590[_0x9c0d('0x4a')],'createdAt':_0x4ec590[_0x9c0d('0x4b')],'updatedAt':_0x4ec590[_0x9c0d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xfa40d3,_0x38d2a8))[_0x9c0d('0x28')](handleError(_0xfa40d3,null));};exports[_0x9c0d('0x50')]=function(_0x31bc01,_0x58cc6f){var _0x4e2803={};var _0x192cdd={};var _0x555180;var _0x23fb8e;return db[_0x9c0d('0x1f')][_0x9c0d('0x51')]({'where':{'id':_0x31bc01['params']['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x58cc6f,null))['then'](function(_0x1ba204){if(_0x1ba204){_0x555180=_0x1ba204;_0x192cdd[_0x9c0d('0x2b')]=_['keys'](db[_0x9c0d('0x52')][_0x9c0d('0x2d')]);_0x192cdd[_0x9c0d('0x25')]=_['keys'](_0x31bc01[_0x9c0d('0x25')]);_0x192cdd[_0x9c0d('0x42')]=_['intersection'](_0x192cdd[_0x9c0d('0x2b')],_0x192cdd['query']);_0x4e2803[_0x9c0d('0x2e')]=_[_0x9c0d('0x3c')](_0x192cdd[_0x9c0d('0x2b')],qs['fields'](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x3d')]));_0x4e2803['attributes']=_0x4e2803[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x4e2803['attributes']:_0x192cdd[_0x9c0d('0x2b')];_0x4e2803[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x41')]);_0x4e2803[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_[_0x9c0d('0x43')](_0x31bc01[_0x9c0d('0x25')],_0x192cdd[_0x9c0d('0x42')]));if(_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x45')]){_0x4e2803['where']=_['merge'](_0x4e2803[_0x9c0d('0x23')],{'$or':_[_0x9c0d('0x1e')](_0x4e2803[_0x9c0d('0x2e')],function(_0x551a7b){var _0x179bbb={};_0x179bbb[_0x551a7b]={'$like':'%'+_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x45')]+'%'};return _0x179bbb;})});}_0x4e2803=_[_0x9c0d('0x44')]({},_0x4e2803,_0x31bc01[_0x9c0d('0x30')]);return _0x555180[_0x9c0d('0x50')](_0x4e2803);}})['then'](function(_0x499487){if(_0x499487){_0x23fb8e=_0x499487[_0x9c0d('0x3e')];if(!_0x31bc01['query']['hasOwnProperty'](_0x9c0d('0x3f'))){_0x4e2803[_0x9c0d('0x11')]=qs[_0x9c0d('0x11')](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x4e2803[_0x9c0d('0xf')]=qs['offset'](_0x31bc01[_0x9c0d('0x25')]['offset']);}return _0x555180[_0x9c0d('0x50')](_0x4e2803);}})[_0x9c0d('0x16')](function(_0x378312){if(_0x378312){return _0x378312?{'count':_0x23fb8e,'rows':_0x378312}:null;}})[_0x9c0d('0x16')](respondWithResult(_0x58cc6f,null))['catch'](handleError(_0x58cc6f,null));};exports['addTeams']=function(_0x3d5e8a,_0x1922e2){var _0x18c89a=_0x3d5e8a['body'][_0x9c0d('0x53')];return db[_0x9c0d('0x52')][_0x9c0d('0x26')]({'where':{'id':_0x18c89a},'attributes':['id'],'include':[{'model':db[_0x9c0d('0x54')],'as':'Agents','attributes':['id',_0x9c0d('0x1b'),_0x9c0d('0x55'),_0x9c0d('0x56'),_0x9c0d('0x57')],'raw':!![]}]})[_0x9c0d('0x16')](function(_0x5207dd){if(_0x5207dd){var _0x2f7254=_['flatMap'](_0x5207dd,function(_0x3383d2){var _0x521daf=_0x3383d2[_0x9c0d('0x35')]({'plain':!![]});return _0x521daf[_0x9c0d('0x58')];});return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x3d5e8a[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](function(_0x25ebbe){return db['sequelize'][_0x9c0d('0x59')](function(_0x26417d){return _0x25ebbe[_0x9c0d('0x5a')](_0x18c89a,{'transaction':_0x26417d})[_0x9c0d('0x16')](function(){return BPromise[_0x9c0d('0x5b')](_0x2f7254,function(_0x48b883){return db[_0x9c0d('0x46')][_0x9c0d('0x5c')]({'where':{'UserId':_0x48b883['id'],'MailQueueId':_0x3d5e8a['params']['id']},'transaction':_0x26417d});});})['then'](function(){_0x2f7254['forEach'](function(_0x59d23b){socket[_0x9c0d('0x5d')]('userMailQueue:save',{'UserId':_0x59d23b['id'],'MailQueueId':_0x25ebbe['id']});});});});});}})[_0x9c0d('0x16')](respondWithStatusCode(_0x1922e2,null))['catch'](handleError(_0x1922e2,null));};exports[_0x9c0d('0x5e')]=function(_0x385426,_0x2d718f){return db[_0x9c0d('0x52')][_0x9c0d('0x26')]({'where':{'id':_0x385426[_0x9c0d('0x25')][_0x9c0d('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9c0d('0x16')](handleEntityNotFound(_0x2d718f,null))[_0x9c0d('0x16')](function(_0x5477f4){var _0x625859=_['map'](_0x5477f4,'id');var _0x29e038=[];var _0x12a2ca=[];var _0x2cd426=squel['select']();_0x2cd426[_0x9c0d('0x5f')](_0x9c0d('0x60'))[_0x9c0d('0x61')](_0x9c0d('0x62'),'tq')[_0x9c0d('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9c0d('0x23')](_0x9c0d('0x64'),_0x385426['params']['id']);for(var _0x547b83=0x0;_0x547b83<_0x5477f4[_0x9c0d('0x3e')];_0x547b83+=0x1){let _0x57e159=_0x5477f4[_0x547b83];for(var _0x53468b=0x0;_0x53468b<_0x57e159['Agents']['length'];_0x53468b+=0x1){let _0xb04eed=_0x57e159['Agents'][_0x53468b];var _0x3c6c96=_0x2cd426[_0x9c0d('0x65')]();_0x3c6c96[_0x9c0d('0x23')](_0x9c0d('0x66'),_0xb04eed['id']);_0x12a2ca['push'](db[_0x9c0d('0x67')]['query'](_0x3c6c96[_0x9c0d('0x68')](),{'type':db['sequelize'][_0x9c0d('0x69')]['SELECT']})[_0x9c0d('0x16')](function(_0x87a253){if(_0x87a253['length']===0x1){return _0xb04eed['id'];}else{var _0x5e3681=_[_0x9c0d('0x6a')](_[_0x9c0d('0x1e')](_0x87a253,_0x9c0d('0x6b')),function(_0x41edfd){return _[_0x9c0d('0x6c')](_0x625859,_0x41edfd);});if(_0x5e3681){return _0xb04eed['id'];}}}));}}return BPromise[_0x9c0d('0x6d')](_0x12a2ca)['then'](function(_0x24d2d1){_0x29e038=_(_0x29e038)[_0x9c0d('0x6e')](_0x24d2d1)[_0x9c0d('0x6f')]()['value']();return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x385426[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](function(_0xfbf04){return db['sequelize'][_0x9c0d('0x59')](function(_0x4e2cb2){return _0xfbf04[_0x9c0d('0x5e')](_0x385426[_0x9c0d('0x25')][_0x9c0d('0x53')],{'transaction':_0x4e2cb2})[_0x9c0d('0x16')](function(){if(!_[_0x9c0d('0x70')](_0x29e038)){return _0xfbf04[_0x9c0d('0x71')](_0x29e038,{'transaction':_0x4e2cb2});}})[_0x9c0d('0x16')](function(){_0x29e038[_0x9c0d('0x72')](function(_0x4562c6){socket[_0x9c0d('0x5d')](_0x9c0d('0x73'),{'UserId':_0x4562c6,'MailQueueId':_0xfbf04['id']});});});});});});})[_0x9c0d('0x16')](respondWithStatusCode(_0x2d718f,null))[_0x9c0d('0x28')](handleError(_0x2d718f,null));};exports[_0x9c0d('0x74')]=function(_0x3cc021,_0x31a323){return db[_0x9c0d('0x1f')]['find']({'where':{'id':_0x3cc021[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x31a323,null))['then'](function(_0x32fdcb){if(_0x32fdcb){return _0x32fdcb[_0x9c0d('0x74')](_0x3cc021[_0x9c0d('0x33')][_0x9c0d('0x53')],_[_0x9c0d('0x75')](_0x3cc021[_0x9c0d('0x33')],[_0x9c0d('0x53'),'id'])||{})['spread'](function(_0x5f0496){for(var _0x475bc7=0x0;_0x475bc7<_0x3cc021[_0x9c0d('0x33')][_0x9c0d('0x53')][_0x9c0d('0x3e')];_0x475bc7+=0x1){socket[_0x9c0d('0x5d')](_0x9c0d('0x76'),{'UserId':Number(_0x3cc021[_0x9c0d('0x33')]['ids'][_0x475bc7]),'MailQueueId':Number(_0x3cc021[_0x9c0d('0x2a')]['id'])});}return _0x5f0496;});}})[_0x9c0d('0x16')](respondWithResult(_0x31a323,null))[_0x9c0d('0x28')](handleError(_0x31a323,null));};exports[_0x9c0d('0x71')]=function(_0x5ebfab,_0x4b615e){return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x5ebfab[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x4b615e,null))[_0x9c0d('0x16')](function(_0x372d79){if(_0x372d79){return _0x372d79[_0x9c0d('0x71')](_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')])[_0x9c0d('0x16')](function(){if(_['isArray'](_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')])){for(var _0x5b75ce=0x0;_0x5b75ce<_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')][_0x9c0d('0x3e')];_0x5b75ce+=0x1){socket[_0x9c0d('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')][_0x5b75ce]),'MailQueueId':Number(_0x5ebfab['params']['id'])});}}else{socket[_0x9c0d('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')]),'MailQueueId':Number(_0x5ebfab[_0x9c0d('0x2a')]['id'])});}});}})[_0x9c0d('0x16')](respondWithStatusCode(_0x4b615e,null))['catch'](handleError(_0x4b615e,null));};exports['getAgents']=function(_0x1a2eb8,_0x5565ae){var _0x3148fd={};var _0x5d6cac={};var _0x5bdef6;var _0x5caa0b;return db[_0x9c0d('0x1f')][_0x9c0d('0x51')]({'where':{'id':_0x1a2eb8[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x5565ae,null))[_0x9c0d('0x16')](function(_0x512076){if(_0x512076){_0x5bdef6=_0x512076;_0x5d6cac[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db[_0x9c0d('0x54')][_0x9c0d('0x2d')]);_0x5d6cac[_0x9c0d('0x25')]=_[_0x9c0d('0x2c')](_0x1a2eb8[_0x9c0d('0x25')]);_0x5d6cac[_0x9c0d('0x42')]=_[_0x9c0d('0x3c')](_0x5d6cac[_0x9c0d('0x2b')],_0x5d6cac[_0x9c0d('0x25')]);_0x3148fd['attributes']=_[_0x9c0d('0x3c')](_0x5d6cac[_0x9c0d('0x2b')],qs['fields'](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x3d')]));_0x3148fd[_0x9c0d('0x2e')]=_0x3148fd[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x3148fd['attributes']:_0x5d6cac[_0x9c0d('0x2b')];_0x3148fd[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x1a2eb8['query'][_0x9c0d('0x41')]);_0x3148fd[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_['pick'](_0x1a2eb8[_0x9c0d('0x25')],_0x5d6cac[_0x9c0d('0x42')]));if(_0x1a2eb8['query'][_0x9c0d('0x45')]){_0x3148fd[_0x9c0d('0x23')]=_[_0x9c0d('0x44')](_0x3148fd['where'],{'$or':_['map'](_0x3148fd[_0x9c0d('0x2e')],function(_0x55c53b){var _0x51fbb1={};_0x51fbb1[_0x55c53b]={'$like':'%'+_0x1a2eb8[_0x9c0d('0x25')]['filter']+'%'};return _0x51fbb1;})});}_0x3148fd=_['merge']({},_0x3148fd,_0x1a2eb8[_0x9c0d('0x30')]);return _0x5bdef6[_0x9c0d('0x77')](_0x3148fd);}})['then'](function(_0x4d8df0){if(_0x4d8df0){_0x5caa0b=_0x4d8df0['length'];if(!_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x78')](_0x9c0d('0x3f'))){_0x3148fd[_0x9c0d('0x11')]=qs[_0x9c0d('0x11')](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x3148fd['offset']=qs[_0x9c0d('0xf')](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0xf')]);}return _0x5bdef6[_0x9c0d('0x77')](_0x3148fd);}})[_0x9c0d('0x16')](function(_0x198f47){if(_0x198f47){return _0x198f47?{'count':_0x5caa0b,'rows':_0x198f47}:null;}})[_0x9c0d('0x16')](respondWithResult(_0x5565ae,null))['catch'](handleError(_0x5565ae,null));}; \ No newline at end of file +var _0x900c=['Content-Range','update','then','destroy','UserProfileResource','error','name','send','index','map','MailQueue','fieldName','type','getOptions','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','attributes','length','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','fields','hasOwnProperty','nolimit','limit','order','sort','where','MailQueueId','filter','merge','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','sendStatus','end','json','offset','undefined','count','status'];(function(_0x3a0d50,_0x449080){var _0x245870=function(_0x28d93b){while(--_0x28d93b){_0x3a0d50['push'](_0x3a0d50['shift']());}};_0x245870(++_0x449080);}(_0x900c,0x1cf));var _0xc900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x900c[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xc900('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xc900('0x1'));var Redis=require(_0xc900('0x2'));var qs=require(_0xc900('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xc900('0x4'));var db=require(_0xc900('0x5'))['db'];config[_0xc900('0x6')]=_[_0xc900('0x7')](config[_0xc900('0x6')],{'host':_0xc900('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc900('0x6')]));require(_0xc900('0x9'))['register'](socket);function respondWithStatusCode(_0x4be90c,_0xc0cbf8){_0xc0cbf8=_0xc0cbf8||0xcc;return function(_0x1dd3ec){if(_0x1dd3ec){return _0x4be90c[_0xc900('0xa')](_0xc0cbf8);}return _0x4be90c['status'](_0xc0cbf8)[_0xc900('0xb')]();};}function respondWithResult(_0x1d4989,_0x3b3111){_0x3b3111=_0x3b3111||0xc8;return function(_0x195a1f){if(_0x195a1f){return _0x1d4989['status'](_0x3b3111)[_0xc900('0xc')](_0x195a1f);}};}function respondWithFilteredResult(_0x580ae5,_0x4339b0){return function(_0x2c2619){if(_0x2c2619){var _0x39e8e8=typeof _0x4339b0[_0xc900('0xd')]===_0xc900('0xe')&&typeof _0x4339b0['limit']===_0xc900('0xe');var _0x20a0f5=_0x2c2619[_0xc900('0xf')];var _0x2af5d8=_0x39e8e8?0x0:_0x4339b0['offset'];var _0xc7b88d=_0x39e8e8?_0x2c2619[_0xc900('0xf')]:_0x4339b0[_0xc900('0xd')]+_0x4339b0['limit'];var _0x28bf38;if(_0xc7b88d>=_0x20a0f5){_0xc7b88d=_0x20a0f5;_0x28bf38=0xc8;}else{_0x28bf38=0xce;}_0x580ae5[_0xc900('0x10')](_0x28bf38);return _0x580ae5['set'](_0xc900('0x11'),_0x2af5d8+'-'+_0xc7b88d+'/'+_0x20a0f5)[_0xc900('0xc')](_0x2c2619);}return null;};}function saveUpdates(_0x25c945){return function(_0x3e7d5e){if(_0x3e7d5e){return _0x3e7d5e[_0xc900('0x12')](_0x25c945)[_0xc900('0x13')](function(_0x5aeae7){return _0x5aeae7;});}return null;};}function removeEntity(_0x45b252){return function(_0x536976){if(_0x536976){return _0x536976[_0xc900('0x14')]()[_0xc900('0x13')](function(){var _0x3a0bf5=_0x536976['get']({'plain':!![]});var _0x18c014='MailQueues';return db[_0xc900('0x15')][_0xc900('0x14')]({'where':{'type':_0x18c014,'resourceId':_0x3a0bf5['id']}})[_0xc900('0x13')](function(){return _0x536976;});})[_0xc900('0x13')](function(){_0x45b252[_0xc900('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc74b){return function(_0x31cd05){if(!_0x31cd05){_0x1dc74b[_0xc900('0xa')](0x194);}return _0x31cd05;};}function handleError(_0x32cfe4,_0x3daf61){_0x3daf61=_0x3daf61||0x1f4;return function(_0x39c35c){logger[_0xc900('0x16')](_0x39c35c['stack']);if(_0x39c35c[_0xc900('0x17')]){delete _0x39c35c[_0xc900('0x17')];}_0x32cfe4[_0xc900('0x10')](_0x3daf61)[_0xc900('0x18')](_0x39c35c);};}exports[_0xc900('0x19')]=function(_0x1508c4,_0x55cfef){var _0x5f5215={};var _0x2e391a={'count':0x0,'rows':[]};var _0x1b5121=_[_0xc900('0x1a')](db[_0xc900('0x1b')]['rawAttributes'],function(_0x262912){return{'name':_0x262912[_0xc900('0x1c')],'type':_0x262912[_0xc900('0x1d')]['key']};});_0x5f5215=qs[_0xc900('0x1e')](_0x1b5121,_0x1508c4);var _0x49ccb2={'where':_0x5f5215['where']};return db[_0xc900('0x1b')]['count'](_0x49ccb2)['then'](function(_0x14f9b4){_0x2e391a[_0xc900('0xf')]=_0x14f9b4;_0x5f5215['include']=qs[_0xc900('0x1f')](_0x1508c4[_0xc900('0x20')]);return db['MailQueue'][_0xc900('0x21')](_0x5f5215);})[_0xc900('0x13')](function(_0x31263e){_0x2e391a[_0xc900('0x22')]=_0x31263e;return _0x2e391a;})[_0xc900('0x13')](respondWithFilteredResult(_0x55cfef,_0x5f5215))[_0xc900('0x23')](handleError(_0x55cfef,null));};exports['show']=function(_0xfff4ff,_0x558bef){var _0x2eecca={'raw':!![],'where':{'id':_0xfff4ff[_0xc900('0x24')]['id']}},_0x5d3270={};_0x5d3270[_0xc900('0x25')]=_[_0xc900('0x26')](db['MailQueue'][_0xc900('0x27')]);_0x5d3270[_0xc900('0x20')]=_['keys'](_0xfff4ff[_0xc900('0x20')]);_0x5d3270[_0xc900('0x28')]=_[_0xc900('0x29')](_0x5d3270[_0xc900('0x25')],_0x5d3270[_0xc900('0x20')]);_0x2eecca['attributes']=_[_0xc900('0x29')](_0x5d3270[_0xc900('0x25')],qs['fields'](_0xfff4ff[_0xc900('0x20')]['fields']));_0x2eecca[_0xc900('0x2a')]=_0x2eecca[_0xc900('0x2a')][_0xc900('0x2b')]?_0x2eecca['attributes']:_0x5d3270['model'];if(_0xfff4ff[_0xc900('0x20')][_0xc900('0x2c')]){_0x2eecca['include']=[{'all':!![]}];}_0x2eecca=_['merge']({},_0x2eecca,_0xfff4ff[_0xc900('0x2d')]);return db[_0xc900('0x1b')]['find'](_0x2eecca)[_0xc900('0x13')](handleEntityNotFound(_0x558bef,null))[_0xc900('0x13')](respondWithResult(_0x558bef,null))[_0xc900('0x23')](handleError(_0x558bef,null));};exports[_0xc900('0x2e')]=function(_0x2ece22,_0x5e91d9){return db[_0xc900('0x1b')]['create'](_0x2ece22[_0xc900('0x2f')],{})[_0xc900('0x13')](function(_0x3ef442){var _0x3dc63b=_0x2ece22[_0xc900('0x30')][_0xc900('0x31')]({'plain':!![]});if(!_0x3dc63b)throw new Error(_0xc900('0x32'));if(_0x3dc63b[_0xc900('0x33')]===_0xc900('0x30')){var _0x5b3753=_0x3ef442[_0xc900('0x31')]({'plain':!![]});var _0x3d17de=_0xc900('0x34');return db['UserProfileSection'][_0xc900('0x35')]({'where':{'name':_0x3d17de,'userProfileId':_0x3dc63b[_0xc900('0x36')]},'raw':!![]})[_0xc900('0x13')](function(_0x2e39c4){if(_0x2e39c4&&_0x2e39c4[_0xc900('0x37')]===0x0){return db[_0xc900('0x15')][_0xc900('0x2e')]({'name':_0x5b3753[_0xc900('0x17')],'resourceId':_0x5b3753['id'],'type':_0x2e39c4[_0xc900('0x17')],'sectionId':_0x2e39c4['id']},{})[_0xc900('0x13')](function(){return _0x3ef442;});}else{return _0x3ef442;}})[_0xc900('0x23')](function(_0x10829f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10829f);throw _0x10829f;});}return _0x3ef442;})[_0xc900('0x13')](respondWithResult(_0x5e91d9,0xc9))['catch'](handleError(_0x5e91d9,null));};exports[_0xc900('0x12')]=function(_0x2e60e0,_0xb0ec96){if(_0x2e60e0['body']['id']){delete _0x2e60e0[_0xc900('0x2f')]['id'];}return db['MailQueue'][_0xc900('0x35')]({'where':{'id':_0x2e60e0['params']['id']}})[_0xc900('0x13')](handleEntityNotFound(_0xb0ec96,null))[_0xc900('0x13')](saveUpdates(_0x2e60e0[_0xc900('0x2f')],null))['then'](respondWithResult(_0xb0ec96,null))[_0xc900('0x23')](handleError(_0xb0ec96,null));};exports[_0xc900('0x14')]=function(_0x2da6f3,_0x52c912){return db[_0xc900('0x1b')][_0xc900('0x35')]({'where':{'id':_0x2da6f3['params']['id']}})[_0xc900('0x13')](handleEntityNotFound(_0x52c912,null))[_0xc900('0x13')](removeEntity(_0x52c912,null))['catch'](handleError(_0x52c912,null));};exports[_0xc900('0x38')]=function(_0xe388e6,_0x3e94f5){return db[_0xc900('0x1b')][_0xc900('0x38')]()['then'](respondWithResult(_0x3e94f5,null))['catch'](handleError(_0x3e94f5,null));};exports[_0xc900('0x39')]=function(_0x7db29d,_0x354c28){var _0x48921a={'raw':!![],'where':{}},_0x56b445={},_0x12bf6a;return db[_0xc900('0x1b')][_0xc900('0x3a')]({'where':{'id':_0x7db29d[_0xc900('0x24')]['id']}})[_0xc900('0x13')](handleEntityNotFound(_0x354c28,null))[_0xc900('0x13')](function(_0x212015){if(_0x212015){_0x12bf6a=_0x212015[_0xc900('0x31')]({'plain':!![]});_0x56b445['model']=_[_0xc900('0x26')](db[_0xc900('0x3b')][_0xc900('0x27')]);_0x56b445[_0xc900('0x20')]=_[_0xc900('0x26')](_0x7db29d['query']);_0x56b445[_0xc900('0x28')]=_[_0xc900('0x29')](_0x56b445[_0xc900('0x25')],_0x56b445[_0xc900('0x20')]);_0x48921a['attributes']=_[_0xc900('0x29')](_0x56b445[_0xc900('0x25')],qs[_0xc900('0x3c')](_0x7db29d[_0xc900('0x20')][_0xc900('0x3c')]));_0x48921a[_0xc900('0x2a')]=_0x48921a[_0xc900('0x2a')][_0xc900('0x2b')]?_0x48921a[_0xc900('0x2a')]:_0x56b445[_0xc900('0x25')];if(!_0x7db29d[_0xc900('0x20')][_0xc900('0x3d')](_0xc900('0x3e'))){_0x48921a[_0xc900('0x3f')]=qs['limit'](_0x7db29d['query'][_0xc900('0x3f')]);_0x48921a[_0xc900('0xd')]=qs[_0xc900('0xd')](_0x7db29d[_0xc900('0x20')][_0xc900('0xd')]);}_0x48921a[_0xc900('0x40')]=qs[_0xc900('0x41')](_0x7db29d[_0xc900('0x20')]['sort']);_0x48921a['where']=qs[_0xc900('0x28')](_['pick'](_0x7db29d['query'],_0x56b445[_0xc900('0x28')]));_0x48921a[_0xc900('0x42')][_0xc900('0x43')]=_0x212015['id'];if(_0x7db29d[_0xc900('0x20')][_0xc900('0x44')]){_0x48921a[_0xc900('0x42')]=_[_0xc900('0x45')](_0x48921a[_0xc900('0x42')],{'$or':_['map'](_0x48921a[_0xc900('0x2a')],function(_0x167dd5){var _0x13a747={};_0x13a747[_0x167dd5]={'$like':'%'+_0x7db29d[_0xc900('0x20')][_0xc900('0x44')]+'%'};return _0x13a747;})});}_0x48921a=_[_0xc900('0x45')]({},_0x48921a,_0x7db29d['options']);return db['UserMailQueue'][_0xc900('0x21')](_0x48921a);}})['then'](function(_0x4c616b){if(_0x4c616b){return db[_0xc900('0x46')][_0xc900('0x47')]({'where':{'id':_[_0xc900('0x1a')](_0x4c616b,_0xc900('0x48')),'role':_0xc900('0x49')},'attributes':['id',_0xc900('0x17'),_0xc900('0x4a'),_0xc900('0x4b'),_0xc900('0x4c')]});}})[_0xc900('0x13')](function(_0x99456c){if(_0x99456c){return{'count':_0x99456c[_0xc900('0xf')],'rows':_[_0xc900('0x1a')](_0x99456c[_0xc900('0x22')],function(_0x4cb1b3){return{'membername':_0x4cb1b3[_0xc900('0x17')],'UserId':_0x4cb1b3['id'],'queue_name':_0x12bf6a[_0xc900('0x17')],'MailQueueId':_0x12bf6a['id'],'interface':util[_0xc900('0x4d')](_0xc900('0x4e'),'SIP',_0x4cb1b3[_0xc900('0x17')]),'penalty':0x0,'paused':_0x4cb1b3[_0xc900('0x4a')],'createdAt':_0x4cb1b3[_0xc900('0x4c')],'updatedAt':_0x4cb1b3[_0xc900('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc900('0x13')](respondWithFilteredResult(_0x354c28,_0x48921a))[_0xc900('0x23')](handleError(_0x354c28,null));};exports[_0xc900('0x4f')]=function(_0x4e8d68,_0x1a7ab3){var _0x22641a={};var _0x47f1dd={};var _0x41e3d5;var _0x4c0808;return db[_0xc900('0x1b')][_0xc900('0x3a')]({'where':{'id':_0x4e8d68[_0xc900('0x24')]['id']}})[_0xc900('0x13')](handleEntityNotFound(_0x1a7ab3,null))['then'](function(_0x2f5eb3){if(_0x2f5eb3){_0x41e3d5=_0x2f5eb3;_0x47f1dd[_0xc900('0x25')]=_['keys'](db[_0xc900('0x50')][_0xc900('0x27')]);_0x47f1dd[_0xc900('0x20')]=_['keys'](_0x4e8d68[_0xc900('0x20')]);_0x47f1dd[_0xc900('0x28')]=_[_0xc900('0x29')](_0x47f1dd[_0xc900('0x25')],_0x47f1dd[_0xc900('0x20')]);_0x22641a[_0xc900('0x2a')]=_[_0xc900('0x29')](_0x47f1dd[_0xc900('0x25')],qs[_0xc900('0x3c')](_0x4e8d68['query'][_0xc900('0x3c')]));_0x22641a[_0xc900('0x2a')]=_0x22641a[_0xc900('0x2a')]['length']?_0x22641a['attributes']:_0x47f1dd[_0xc900('0x25')];_0x22641a[_0xc900('0x40')]=qs['sort'](_0x4e8d68['query']['sort']);_0x22641a[_0xc900('0x42')]=qs['filters'](_[_0xc900('0x51')](_0x4e8d68[_0xc900('0x20')],_0x47f1dd['filters']));if(_0x4e8d68[_0xc900('0x20')][_0xc900('0x44')]){_0x22641a[_0xc900('0x42')]=_[_0xc900('0x45')](_0x22641a['where'],{'$or':_['map'](_0x22641a[_0xc900('0x2a')],function(_0x38f042){var _0x5551e0={};_0x5551e0[_0x38f042]={'$like':'%'+_0x4e8d68['query']['filter']+'%'};return _0x5551e0;})});}_0x22641a=_[_0xc900('0x45')]({},_0x22641a,_0x4e8d68['options']);return _0x41e3d5[_0xc900('0x4f')](_0x22641a);}})['then'](function(_0x223d2c){if(_0x223d2c){_0x4c0808=_0x223d2c[_0xc900('0x2b')];if(!_0x4e8d68[_0xc900('0x20')][_0xc900('0x3d')](_0xc900('0x3e'))){_0x22641a[_0xc900('0x3f')]=qs['limit'](_0x4e8d68[_0xc900('0x20')][_0xc900('0x3f')]);_0x22641a['offset']=qs[_0xc900('0xd')](_0x4e8d68[_0xc900('0x20')]['offset']);}return _0x41e3d5[_0xc900('0x4f')](_0x22641a);}})[_0xc900('0x13')](function(_0x5e411a){if(_0x5e411a){return _0x5e411a?{'count':_0x4c0808,'rows':_0x5e411a}:null;}})[_0xc900('0x13')](respondWithResult(_0x1a7ab3,null))['catch'](handleError(_0x1a7ab3,null));};exports[_0xc900('0x52')]=function(_0x1c88d9,_0x14f65a){var _0x19dddf=_0x1c88d9[_0xc900('0x2f')][_0xc900('0x53')];return db[_0xc900('0x50')][_0xc900('0x21')]({'where':{'id':_0x19dddf},'attributes':['id'],'include':[{'model':db[_0xc900('0x46')],'as':_0xc900('0x54'),'attributes':['id','name',_0xc900('0x55'),_0xc900('0x56'),_0xc900('0x57')],'raw':!![]}]})[_0xc900('0x13')](function(_0x1a848c){if(_0x1a848c){var _0x2da909=_[_0xc900('0x58')](_0x1a848c,function(_0x31e721){var _0x92a1e7=_0x31e721[_0xc900('0x31')]({'plain':!![]});return _0x92a1e7[_0xc900('0x54')];});return db[_0xc900('0x1b')][_0xc900('0x35')]({'where':{'id':_0x1c88d9[_0xc900('0x24')]['id']}})['then'](function(_0x3ea48a){return db[_0xc900('0x59')][_0xc900('0x5a')](function(_0x244cda){return _0x3ea48a[_0xc900('0x52')](_0x19dddf,{'transaction':_0x244cda})[_0xc900('0x13')](function(){return BPromise[_0xc900('0x5b')](_0x2da909,function(_0x11c53e){return db[_0xc900('0x3b')][_0xc900('0x5c')]({'where':{'UserId':_0x11c53e['id'],'MailQueueId':_0x1c88d9[_0xc900('0x24')]['id']},'transaction':_0x244cda});});})['then'](function(){_0x2da909[_0xc900('0x5d')](function(_0x8ef00a){socket[_0xc900('0x5e')]('userMailQueue:save',{'UserId':_0x8ef00a['id'],'MailQueueId':_0x3ea48a['id']});});});});});}})[_0xc900('0x13')](respondWithStatusCode(_0x14f65a,null))['catch'](handleError(_0x14f65a,null));};exports[_0xc900('0x5f')]=function(_0x141d70,_0x212b25){return db[_0xc900('0x50')][_0xc900('0x21')]({'where':{'id':_0x141d70['query'][_0xc900('0x53')]},'attributes':['id'],'include':[{'model':db[_0xc900('0x46')],'as':_0xc900('0x54'),'attributes':['id'],'raw':!![]}]})[_0xc900('0x13')](handleEntityNotFound(_0x212b25,null))[_0xc900('0x13')](function(_0xc129bf){var _0xfb10d7=_['map'](_0xc129bf,'id');var _0x260e9b=[];var _0x1bdc65=[];var _0x5f4344=squel[_0xc900('0x60')]();_0x5f4344[_0xc900('0x61')](_0xc900('0x62'))['from'](_0xc900('0x63'),'tq')[_0xc900('0x64')]('user_has_teams','ut',_0xc900('0x65'))['where'](_0xc900('0x66'),_0x141d70[_0xc900('0x24')]['id']);for(var _0x4fcc99=0x0;_0x4fcc99<_0xc129bf[_0xc900('0x2b')];_0x4fcc99+=0x1){let _0x483746=_0xc129bf[_0x4fcc99];for(var _0xe918c1=0x0;_0xe918c1<_0x483746[_0xc900('0x54')]['length'];_0xe918c1+=0x1){let _0x48feb3=_0x483746['Agents'][_0xe918c1];var _0x24b34d=_0x5f4344[_0xc900('0x67')]();_0x24b34d[_0xc900('0x42')](_0xc900('0x68'),_0x48feb3['id']);_0x1bdc65[_0xc900('0x69')](db[_0xc900('0x59')][_0xc900('0x20')](_0x24b34d['toString'](),{'type':db[_0xc900('0x59')]['QueryTypes'][_0xc900('0x6a')]})[_0xc900('0x13')](function(_0x1722b5){if(_0x1722b5[_0xc900('0x2b')]===0x1){return _0x48feb3['id'];}else{var _0x218bb5=_[_0xc900('0x6b')](_['map'](_0x1722b5,_0xc900('0x6c')),function(_0x5af05d){return _[_0xc900('0x6d')](_0xfb10d7,_0x5af05d);});if(_0x218bb5){return _0x48feb3['id'];}}}));}}return BPromise['all'](_0x1bdc65)[_0xc900('0x13')](function(_0x19f77b){_0x260e9b=_(_0x260e9b)['union'](_0x19f77b)[_0xc900('0x6e')]()[_0xc900('0x6f')]();return db[_0xc900('0x1b')][_0xc900('0x35')]({'where':{'id':_0x141d70[_0xc900('0x24')]['id']}})['then'](function(_0x59870b){return db[_0xc900('0x59')]['transaction'](function(_0x2b4569){return _0x59870b[_0xc900('0x5f')](_0x141d70['query'][_0xc900('0x53')],{'transaction':_0x2b4569})[_0xc900('0x13')](function(){if(!_[_0xc900('0x70')](_0x260e9b)){return _0x59870b[_0xc900('0x71')](_0x260e9b,{'transaction':_0x2b4569});}})[_0xc900('0x13')](function(){_0x260e9b[_0xc900('0x5d')](function(_0x143024){socket[_0xc900('0x5e')](_0xc900('0x72'),{'UserId':_0x143024,'MailQueueId':_0x59870b['id']});});});});});});})[_0xc900('0x13')](respondWithStatusCode(_0x212b25,null))['catch'](handleError(_0x212b25,null));};exports[_0xc900('0x73')]=function(_0x488781,_0x1cc88d){return db[_0xc900('0x1b')][_0xc900('0x35')]({'where':{'id':_0x488781[_0xc900('0x24')]['id']}})[_0xc900('0x13')](handleEntityNotFound(_0x1cc88d,null))[_0xc900('0x13')](function(_0x3fee3c){if(_0x3fee3c){return _0x3fee3c[_0xc900('0x73')](_0x488781[_0xc900('0x2f')]['ids'],_[_0xc900('0x74')](_0x488781[_0xc900('0x2f')],[_0xc900('0x53'),'id'])||{})['spread'](function(_0x3f7b8c){for(var _0x53c1a3=0x0;_0x53c1a3<_0x488781[_0xc900('0x2f')]['ids']['length'];_0x53c1a3+=0x1){socket[_0xc900('0x5e')](_0xc900('0x75'),{'UserId':Number(_0x488781[_0xc900('0x2f')][_0xc900('0x53')][_0x53c1a3]),'MailQueueId':Number(_0x488781[_0xc900('0x24')]['id'])});}return _0x3f7b8c;});}})['then'](respondWithResult(_0x1cc88d,null))['catch'](handleError(_0x1cc88d,null));};exports[_0xc900('0x71')]=function(_0x552978,_0x510c94){return db['MailQueue'][_0xc900('0x35')]({'where':{'id':_0x552978['params']['id']}})[_0xc900('0x13')](handleEntityNotFound(_0x510c94,null))[_0xc900('0x13')](function(_0x1705a3){if(_0x1705a3){return _0x1705a3['removeAgents'](_0x552978[_0xc900('0x20')][_0xc900('0x53')])['then'](function(){if(_[_0xc900('0x76')](_0x552978['query'][_0xc900('0x53')])){for(var _0x2ab519=0x0;_0x2ab519<_0x552978[_0xc900('0x20')][_0xc900('0x53')][_0xc900('0x2b')];_0x2ab519+=0x1){socket[_0xc900('0x5e')]('userMailQueue:remove',{'UserId':Number(_0x552978['query'][_0xc900('0x53')][_0x2ab519]),'MailQueueId':Number(_0x552978['params']['id'])});}}else{socket[_0xc900('0x5e')](_0xc900('0x72'),{'UserId':Number(_0x552978[_0xc900('0x20')]['ids']),'MailQueueId':Number(_0x552978['params']['id'])});}});}})[_0xc900('0x13')](respondWithStatusCode(_0x510c94,null))[_0xc900('0x23')](handleError(_0x510c94,null));};exports['getAgents']=function(_0x1db83a,_0x28149c){var _0x3a145e={};var _0x548008={};var _0x3bb60a;var _0x107301;return db['MailQueue'][_0xc900('0x3a')]({'where':{'id':_0x1db83a[_0xc900('0x24')]['id']}})['then'](handleEntityNotFound(_0x28149c,null))[_0xc900('0x13')](function(_0x1501a0){if(_0x1501a0){_0x3bb60a=_0x1501a0;_0x548008['model']=_[_0xc900('0x26')](db[_0xc900('0x46')]['rawAttributes']);_0x548008[_0xc900('0x20')]=_['keys'](_0x1db83a['query']);_0x548008[_0xc900('0x28')]=_[_0xc900('0x29')](_0x548008[_0xc900('0x25')],_0x548008[_0xc900('0x20')]);_0x3a145e[_0xc900('0x2a')]=_['intersection'](_0x548008['model'],qs[_0xc900('0x3c')](_0x1db83a[_0xc900('0x20')]['fields']));_0x3a145e[_0xc900('0x2a')]=_0x3a145e[_0xc900('0x2a')][_0xc900('0x2b')]?_0x3a145e[_0xc900('0x2a')]:_0x548008[_0xc900('0x25')];_0x3a145e[_0xc900('0x40')]=qs['sort'](_0x1db83a[_0xc900('0x20')]['sort']);_0x3a145e[_0xc900('0x42')]=qs[_0xc900('0x28')](_['pick'](_0x1db83a[_0xc900('0x20')],_0x548008[_0xc900('0x28')]));if(_0x1db83a['query'][_0xc900('0x44')]){_0x3a145e[_0xc900('0x42')]=_[_0xc900('0x45')](_0x3a145e['where'],{'$or':_[_0xc900('0x1a')](_0x3a145e['attributes'],function(_0x3a68ed){var _0x56790e={};_0x56790e[_0x3a68ed]={'$like':'%'+_0x1db83a[_0xc900('0x20')][_0xc900('0x44')]+'%'};return _0x56790e;})});}_0x3a145e=_[_0xc900('0x45')]({},_0x3a145e,_0x1db83a[_0xc900('0x2d')]);return _0x3bb60a[_0xc900('0x77')](_0x3a145e);}})['then'](function(_0x49a3b4){if(_0x49a3b4){_0x107301=_0x49a3b4[_0xc900('0x2b')];if(!_0x1db83a['query']['hasOwnProperty']('nolimit')){_0x3a145e['limit']=qs[_0xc900('0x3f')](_0x1db83a['query'][_0xc900('0x3f')]);_0x3a145e[_0xc900('0xd')]=qs[_0xc900('0xd')](_0x1db83a['query'][_0xc900('0xd')]);}return _0x3bb60a[_0xc900('0x77')](_0x3a145e);}})['then'](function(_0x1a8f4f){if(_0x1a8f4f){return _0x1a8f4f?{'count':_0x107301,'rows':_0x1a8f4f}:null;}})[_0xc900('0x13')](respondWithResult(_0x28149c,null))[_0xc900('0x23')](handleError(_0x28149c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3a0bfca..2f984a4 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 _0x2803=['exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3d6cb1,_0x6f4ae3){var _0x545f50=function(_0x3b3474){while(--_0x3b3474){_0x3d6cb1['push'](_0x3d6cb1['shift']());}};_0x545f50(++_0x6f4ae3);}(_0x2803,0x184));var _0x3280=function(_0x2df70e,_0x4608a4){_0x2df70e=_0x2df70e-0x0;var _0x1a07b3=_0x2803[_0x2df70e];return _0x1a07b3;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3280('0x0'))['db'][_0x3280('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3280('0x2')](0x0);var events={'afterCreate':_0x3280('0x3'),'afterUpdate':_0x3280('0x4'),'afterDestroy':_0x3280('0x5')};function emitEvent(_0x548b69){return function(_0x50c618,_0x4c60c8,_0x397a42){MailQueueEvents[_0x3280('0x6')](_0x548b69+':'+_0x50c618['id'],_0x50c618);MailQueueEvents[_0x3280('0x6')](_0x548b69,_0x50c618);_0x397a42(null);};}for(var e in events){if(events[_0x3280('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x3280('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x73cf=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x25f950,_0x29dd1a){var _0x30379c=function(_0x368e0a){while(--_0x368e0a){_0x25f950['push'](_0x25f950['shift']());}};_0x30379c(++_0x29dd1a);}(_0x73cf,0x100));var _0xf73c=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x73cf[_0x3c4737];return _0x2bb926;};'use strict';var EventEmitter=require(_0xf73c('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf73c('0x1')](0x0);var events={'afterCreate':_0xf73c('0x2'),'afterUpdate':_0xf73c('0x3'),'afterDestroy':_0xf73c('0x4')};function emitEvent(_0x37e722){return function(_0x171921,_0x390191,_0x5865ba){MailQueueEvents['emit'](_0x37e722+':'+_0x171921['id'],_0x171921);MailQueueEvents[_0xf73c('0x5')](_0x37e722,_0x171921);_0x5865ba(null);};}for(var e in events){if(events[_0xf73c('0x6')](e)){var event=events[e];MailQueue[_0xf73c('0x7')](e,emitEvent(event));}}module[_0xf73c('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8074777..cf2654b 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 _0x8180=['api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8180,0x1c6));var _0x0818=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8180[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0818('0x0'));var util=require('util');var logger=require(_0x0818('0x1'))(_0x0818('0x2'));var moment=require(_0x0818('0x3'));var BPromise=require('bluebird');var rp=require(_0x0818('0x4'));var fs=require('fs');var path=require(_0x0818('0x5'));var rimraf=require(_0x0818('0x6'));var config=require(_0x0818('0x7'));var attributes=require(_0x0818('0x8'));module[_0x0818('0x9')]=function(_0x578bd5,_0x1a3e90){return _0x578bd5['define'](_0x0818('0xa'),attributes,{'tableName':_0x0818('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52d8=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','util','api'];(function(_0x55bc08,_0x2b980a){var _0x238ddf=function(_0xf0354c){while(--_0xf0354c){_0x55bc08['push'](_0x55bc08['shift']());}};_0x238ddf(++_0x2b980a);}(_0x52d8,0x1cb));var _0x852d=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x52d8[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0x852d('0x0'));var util=require(_0x852d('0x1'));var logger=require('../../config/logger')(_0x852d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x852d('0x3'));var fs=require('fs');var path=require(_0x852d('0x4'));var rimraf=require(_0x852d('0x5'));var config=require(_0x852d('0x6'));var attributes=require(_0x852d('0x7'));module[_0x852d('0x8')]=function(_0x59d71d,_0x1bc896){return _0x59d71d[_0x852d('0x9')](_0x852d('0xa'),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 e034867..b2e5aa3 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 _0x78f5=['redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','options','attributes','limit','include','model','map','GetMailQueue','stringify','ShowMailQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x78f5,0xbc));var _0x578f=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0x78f5[_0x132d9e];return _0x40b733;};'use strict';var _=require(_0x578f('0x0'));var util=require(_0x578f('0x1'));var moment=require(_0x578f('0x2'));var BPromise=require(_0x578f('0x3'));var rs=require(_0x578f('0x4'));var fs=require('fs');var Redis=require(_0x578f('0x5'));var db=require(_0x578f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x578f('0x7'))(_0x578f('0x8'));var config=require(_0x578f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x578f('0xa')]({'port':0x232a});config['redis']=_[_0x578f('0xb')](config[_0x578f('0xc')],{'host':_0x578f('0xd'),'port':0x18eb});var socket=require(_0x578f('0xe'))(new Redis(config[_0x578f('0xc')]));require('./mailQueue.socket')[_0x578f('0xf')](socket);function respondWithRpcPromise(_0x3d0a7f,_0x23f152,_0x1c9182){return new BPromise(function(_0x429a3b,_0xf18ea2){return client[_0x578f('0x10')](_0x3d0a7f,_0x1c9182)[_0x578f('0x11')](function(_0xf6b5b1){logger[_0x578f('0x12')]('MailQueue,\x20%s,\x20%s',_0x23f152,_0x578f('0x13'));logger[_0x578f('0x14')](_0x578f('0x15'),_0x23f152,_0x578f('0x13'),JSON['stringify'](_0xf6b5b1));if(_0xf6b5b1['error']){if(_0xf6b5b1[_0x578f('0x16')]['code']===0x1f4){logger[_0x578f('0x16')](_0x578f('0x17'),_0x23f152,_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);return _0xf18ea2(_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);}logger[_0x578f('0x16')](_0x578f('0x17'),_0x23f152,_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);return _0x429a3b(_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);}else{logger[_0x578f('0x12')](_0x578f('0x17'),_0x23f152,_0x578f('0x13'));_0x429a3b(_0xf6b5b1[_0x578f('0x19')][_0x578f('0x18')]);}})[_0x578f('0x1a')](function(_0x4823d0){logger[_0x578f('0x16')]('MailQueue,\x20%s,\x20%s',_0x23f152,_0x4823d0);_0xf18ea2(_0x4823d0);});});}exports['GetMailQueue']=function(_0x24db4a){var _0x3b1a17=this;return new Promise(function(_0x37a54f,_0x589380){return db[_0x578f('0x1b')]['findAll']({'raw':_0x24db4a[_0x578f('0x1c')]?_0x24db4a[_0x578f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x24db4a['options']?_0x24db4a['options']['where']||null:null,'attributes':_0x24db4a['options']?_0x24db4a[_0x578f('0x1c')][_0x578f('0x1d')]||null:null,'limit':_0x24db4a[_0x578f('0x1c')]?_0x24db4a[_0x578f('0x1c')][_0x578f('0x1e')]||null:null,'include':_0x24db4a['options']?_0x24db4a['options'][_0x578f('0x1f')]?_['map'](_0x24db4a['options'][_0x578f('0x1f')],function(_0x36d027){return{'model':db[_0x36d027[_0x578f('0x20')]],'as':_0x36d027['as'],'attributes':_0x36d027[_0x578f('0x1d')],'include':_0x36d027['include']?_[_0x578f('0x21')](_0x36d027[_0x578f('0x1f')],function(_0x59295f){return{'model':db[_0x59295f[_0x578f('0x20')]],'as':_0x59295f['as'],'attributes':_0x59295f[_0x578f('0x1d')],'include':_0x59295f[_0x578f('0x1f')]?_['map'](_0x59295f['include'],function(_0x2d8a85){return{'model':db[_0x2d8a85['model']],'as':_0x2d8a85['as'],'attributes':_0x2d8a85['attributes']};}):[]};}):[]};}):[]:[]})[_0x578f('0x11')](function(_0x37f84b){logger['info'](_0x578f('0x22'),_0x24db4a);logger[_0x578f('0x14')](_0x578f('0x22'),_0x24db4a,JSON[_0x578f('0x23')](_0x37f84b));_0x37a54f(_0x37f84b);})[_0x578f('0x1a')](function(_0x32636e){logger[_0x578f('0x16')]('GetMailQueue',_0x32636e[_0x578f('0x18')],_0x24db4a);_0x589380(_0x3b1a17['error'](0x1f4,_0x32636e[_0x578f('0x18')]));});});};exports[_0x578f('0x24')]=function(_0x2402b9){var _0x1776b3=this;return new Promise(function(_0x5016b0,_0x102988){return db[_0x578f('0x1b')][_0x578f('0x25')]({'raw':_0x2402b9[_0x578f('0x1c')]?_0x2402b9['options'][_0x578f('0x26')]===undefined?!![]:![]:!![],'where':_0x2402b9[_0x578f('0x1c')]?_0x2402b9[_0x578f('0x1c')][_0x578f('0x27')]||null:null,'attributes':_0x2402b9[_0x578f('0x1c')]?_0x2402b9[_0x578f('0x1c')][_0x578f('0x1d')]||null:null,'include':_0x2402b9['options']?_0x2402b9[_0x578f('0x1c')]['include']?_[_0x578f('0x21')](_0x2402b9[_0x578f('0x1c')][_0x578f('0x1f')],function(_0x4e38e7){return{'model':db[_0x4e38e7[_0x578f('0x20')]],'as':_0x4e38e7['as'],'attributes':_0x4e38e7[_0x578f('0x1d')],'include':_0x4e38e7[_0x578f('0x1f')]?_[_0x578f('0x21')](_0x4e38e7[_0x578f('0x1f')],function(_0x39ed62){return{'model':db[_0x39ed62['model']],'as':_0x39ed62['as'],'attributes':_0x39ed62[_0x578f('0x1d')],'include':_0x39ed62[_0x578f('0x1f')]?_[_0x578f('0x21')](_0x39ed62[_0x578f('0x1f')],function(_0x28c9f4){return{'model':db[_0x28c9f4[_0x578f('0x20')]],'as':_0x28c9f4['as'],'attributes':_0x28c9f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47caa5){logger['info']('ShowMailQueue',_0x2402b9);logger[_0x578f('0x14')]('ShowMailQueue',_0x2402b9,JSON[_0x578f('0x23')](_0x47caa5));_0x5016b0(_0x47caa5);})[_0x578f('0x1a')](function(_0x468720){logger[_0x578f('0x16')](_0x578f('0x24'),_0x468720[_0x578f('0x18')],_0x2402b9);_0x102988(_0x1776b3[_0x578f('0x16')](0x1f4,_0x468720[_0x578f('0x18')]));});});}; \ No newline at end of file +var _0x24eb=['include','map','model','info','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailQueue.socket','register','then','request\x20sent','debug','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','findAll','raw','options','where','attributes','limit'];(function(_0x24878b,_0x3eff54){var _0x11abf1=function(_0x572270){while(--_0x572270){_0x24878b['push'](_0x24878b['shift']());}};_0x11abf1(++_0x3eff54);}(_0x24eb,0x145));var _0xb24e=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x24eb[_0x57408b];return _0x31a897;};'use strict';var _=require(_0xb24e('0x0'));var util=require(_0xb24e('0x1'));var moment=require(_0xb24e('0x2'));var BPromise=require(_0xb24e('0x3'));var rs=require(_0xb24e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb24e('0x5'))['db'];var utils=require(_0xb24e('0x6'));var logger=require(_0xb24e('0x7'))('rpc');var config=require(_0xb24e('0x8'));var jayson=require(_0xb24e('0x9'));var client=jayson[_0xb24e('0xa')][_0xb24e('0xb')]({'port':0x232a});config['redis']=_[_0xb24e('0xc')](config[_0xb24e('0xd')],{'host':_0xb24e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb24e('0xd')]));require(_0xb24e('0xf'))[_0xb24e('0x10')](socket);function respondWithRpcPromise(_0x4c6546,_0x42c8a6,_0xaca764){return new BPromise(function(_0x24aa01,_0x3ac14b){return client['request'](_0x4c6546,_0xaca764)[_0xb24e('0x11')](function(_0x15ff55){logger['info']('MailQueue,\x20%s,\x20%s',_0x42c8a6,_0xb24e('0x12'));logger[_0xb24e('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x42c8a6,'request\x20sent',JSON[_0xb24e('0x14')](_0x15ff55));if(_0x15ff55['error']){if(_0x15ff55[_0xb24e('0x15')][_0xb24e('0x16')]===0x1f4){logger[_0xb24e('0x15')]('MailQueue,\x20%s,\x20%s',_0x42c8a6,_0x15ff55[_0xb24e('0x15')][_0xb24e('0x17')]);return _0x3ac14b(_0x15ff55[_0xb24e('0x15')]['message']);}logger['error'](_0xb24e('0x18'),_0x42c8a6,_0x15ff55[_0xb24e('0x15')][_0xb24e('0x17')]);return _0x24aa01(_0x15ff55[_0xb24e('0x15')][_0xb24e('0x17')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x42c8a6,_0xb24e('0x12'));_0x24aa01(_0x15ff55[_0xb24e('0x19')][_0xb24e('0x17')]);}})[_0xb24e('0x1a')](function(_0x5774ae){logger[_0xb24e('0x15')](_0xb24e('0x18'),_0x42c8a6,_0x5774ae);_0x3ac14b(_0x5774ae);});});}exports[_0xb24e('0x1b')]=function(_0x2d6946){var _0x584e33=this;return new Promise(function(_0x1430ff,_0xbca9ab){return db[_0xb24e('0x1c')][_0xb24e('0x1d')]({'raw':_0x2d6946['options']?_0x2d6946['options'][_0xb24e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d6946[_0xb24e('0x1f')]?_0x2d6946[_0xb24e('0x1f')][_0xb24e('0x20')]||null:null,'attributes':_0x2d6946[_0xb24e('0x1f')]?_0x2d6946[_0xb24e('0x1f')][_0xb24e('0x21')]||null:null,'limit':_0x2d6946['options']?_0x2d6946[_0xb24e('0x1f')][_0xb24e('0x22')]||null:null,'include':_0x2d6946[_0xb24e('0x1f')]?_0x2d6946[_0xb24e('0x1f')][_0xb24e('0x23')]?_[_0xb24e('0x24')](_0x2d6946[_0xb24e('0x1f')][_0xb24e('0x23')],function(_0x21d889){return{'model':db[_0x21d889[_0xb24e('0x25')]],'as':_0x21d889['as'],'attributes':_0x21d889[_0xb24e('0x21')],'include':_0x21d889['include']?_[_0xb24e('0x24')](_0x21d889['include'],function(_0x56eb21){return{'model':db[_0x56eb21['model']],'as':_0x56eb21['as'],'attributes':_0x56eb21[_0xb24e('0x21')],'include':_0x56eb21[_0xb24e('0x23')]?_[_0xb24e('0x24')](_0x56eb21['include'],function(_0x34d897){return{'model':db[_0x34d897[_0xb24e('0x25')]],'as':_0x34d897['as'],'attributes':_0x34d897[_0xb24e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2053d2){logger[_0xb24e('0x26')](_0xb24e('0x1b'),_0x2d6946);logger[_0xb24e('0x13')](_0xb24e('0x1b'),_0x2d6946,JSON[_0xb24e('0x14')](_0x2053d2));_0x1430ff(_0x2053d2);})[_0xb24e('0x1a')](function(_0x1fd0cf){logger[_0xb24e('0x15')](_0xb24e('0x1b'),_0x1fd0cf[_0xb24e('0x17')],_0x2d6946);_0xbca9ab(_0x584e33[_0xb24e('0x15')](0x1f4,_0x1fd0cf['message']));});});};exports[_0xb24e('0x27')]=function(_0x44f495){var _0x3c5415=this;return new Promise(function(_0x505e18,_0x2a4595){return db[_0xb24e('0x1c')]['find']({'raw':_0x44f495[_0xb24e('0x1f')]?_0x44f495[_0xb24e('0x1f')][_0xb24e('0x1e')]===undefined?!![]:![]:!![],'where':_0x44f495[_0xb24e('0x1f')]?_0x44f495[_0xb24e('0x1f')]['where']||null:null,'attributes':_0x44f495[_0xb24e('0x1f')]?_0x44f495['options'][_0xb24e('0x21')]||null:null,'include':_0x44f495['options']?_0x44f495['options']['include']?_['map'](_0x44f495[_0xb24e('0x1f')][_0xb24e('0x23')],function(_0x509660){return{'model':db[_0x509660[_0xb24e('0x25')]],'as':_0x509660['as'],'attributes':_0x509660[_0xb24e('0x21')],'include':_0x509660[_0xb24e('0x23')]?_[_0xb24e('0x24')](_0x509660[_0xb24e('0x23')],function(_0x189657){return{'model':db[_0x189657[_0xb24e('0x25')]],'as':_0x189657['as'],'attributes':_0x189657[_0xb24e('0x21')],'include':_0x189657[_0xb24e('0x23')]?_[_0xb24e('0x24')](_0x189657[_0xb24e('0x23')],function(_0x80efd6){return{'model':db[_0x80efd6[_0xb24e('0x25')]],'as':_0x80efd6['as'],'attributes':_0x80efd6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xda6002){logger[_0xb24e('0x26')](_0xb24e('0x27'),_0x44f495);logger[_0xb24e('0x13')]('ShowMailQueue',_0x44f495,JSON[_0xb24e('0x14')](_0xda6002));_0x505e18(_0xda6002);})[_0xb24e('0x1a')](function(_0x595851){logger[_0xb24e('0x15')]('ShowMailQueue',_0x595851[_0xb24e('0x17')],_0x44f495);_0x2a4595(_0x3c5415[_0xb24e('0x15')](0x1f4,_0x595851[_0xb24e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 03f8f22..71b6c38 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 _0xcbde=['mailQueue:','./mailQueue.events','remove','update','removeListener'];(function(_0x5763e2,_0x375e84){var _0x46f7fa=function(_0x1cf9b2){while(--_0x1cf9b2){_0x5763e2['push'](_0x5763e2['shift']());}};_0x46f7fa(++_0x375e84);}(_0xcbde,0x141));var _0xecbd=function(_0x37b08d,_0x26fb25){_0x37b08d=_0x37b08d-0x0;var _0x8af2a6=_0xcbde[_0x37b08d];return _0x8af2a6;};'use strict';var MailQueueEvents=require(_0xecbd('0x0'));var events=['save',_0xecbd('0x1'),_0xecbd('0x2')];function createListener(_0x2716db,_0x456f7f){return function(_0x1a4c26){_0x456f7f['emit'](_0x2716db,_0x1a4c26);};}function removeListener(_0x4ba743,_0x12470a){return function(){MailQueueEvents[_0xecbd('0x3')](_0x4ba743,_0x12470a);};}exports['register']=function(_0x25b899){for(var _0x27a04d=0x0,_0x545ca6=events['length'];_0x27a04d<_0x545ca6;_0x27a04d++){var _0x2947a0=events[_0x27a04d];var _0x3e9e7a=createListener(_0xecbd('0x4')+_0x2947a0,_0x25b899);MailQueueEvents['on'](_0x2947a0,_0x3e9e7a);}}; \ No newline at end of file +var _0xada7=['emit','length','./mailQueue.events','save','remove','update'];(function(_0x2c5107,_0x48498e){var _0x272176=function(_0x2083a2){while(--_0x2083a2){_0x2c5107['push'](_0x2c5107['shift']());}};_0x272176(++_0x48498e);}(_0xada7,0x1ee));var _0x7ada=function(_0x4d84a8,_0x5764ae){_0x4d84a8=_0x4d84a8-0x0;var _0x30f2d5=_0xada7[_0x4d84a8];return _0x30f2d5;};'use strict';var MailQueueEvents=require(_0x7ada('0x0'));var events=[_0x7ada('0x1'),_0x7ada('0x2'),_0x7ada('0x3')];function createListener(_0x5e051d,_0xbca0e5){return function(_0x3d5d93){_0xbca0e5[_0x7ada('0x4')](_0x5e051d,_0x3d5d93);};}function removeListener(_0xa82ca4,_0x402a8e){return function(){MailQueueEvents['removeListener'](_0xa82ca4,_0x402a8e);};}exports['register']=function(_0xdd89f4){for(var _0x55584a=0x0,_0x30229c=events[_0x7ada('0x5')];_0x55584a<_0x30229c;_0x55584a++){var _0x3e8982=events[_0x55584a];var _0x198bb4=createListener('mailQueue:'+_0x3e8982,_0xdd89f4);MailQueueEvents['on'](_0x3e8982,_0x198bb4);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9417fb0..3e7d0f3 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 _0x4f3a=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x7f2354,_0xdac541){var _0x14fbc6=function(_0x2a9bd1){while(--_0x2a9bd1){_0x7f2354['push'](_0x7f2354['shift']());}};_0x14fbc6(++_0xdac541);}(_0x4f3a,0xc5));var _0xa4f3=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x4f3a[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require(_0xa4f3('0x0'));var util=require(_0xa4f3('0x1'));var path=require(_0xa4f3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4f3('0x3'));var router=express[_0xa4f3('0x4')]();var fs_extra=require(_0xa4f3('0x5'));var auth=require(_0xa4f3('0x6'));var interaction=require(_0xa4f3('0x7'));var config=require('../../config/environment');var controller=require(_0xa4f3('0x8'));router[_0xa4f3('0x9')]('/',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xb')]);router[_0xa4f3('0x9')](_0xa4f3('0xc'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xd')]);router[_0xa4f3('0x9')]('/:id',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xe')]);router[_0xa4f3('0xf')]('/',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x10')]);router[_0xa4f3('0x11')](_0xa4f3('0x12'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x13')]);router[_0xa4f3('0x14')](_0xa4f3('0x12'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x15')]);module[_0xa4f3('0x16')]=router; \ No newline at end of file +var _0x906e=['show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x36021c,_0x5eeb8e){var _0x1c6ab4=function(_0x427f63){while(--_0x427f63){_0x36021c['push'](_0x36021c['shift']());}};_0x1c6ab4(++_0x5eeb8e);}(_0x906e,0x125));var _0xe906=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x906e[_0x43b584];return _0x48f27b;};'use strict';var multer=require(_0xe906('0x0'));var util=require(_0xe906('0x1'));var path=require(_0xe906('0x2'));var timeout=require(_0xe906('0x3'));var express=require(_0xe906('0x4'));var router=express['Router']();var fs_extra=require(_0xe906('0x5'));var auth=require(_0xe906('0x6'));var interaction=require(_0xe906('0x7'));var config=require(_0xe906('0x8'));var controller=require(_0xe906('0x9'));router[_0xe906('0xa')]('/',auth[_0xe906('0xb')](),controller[_0xe906('0xc')]);router[_0xe906('0xa')](_0xe906('0xd'),auth['isAuthenticated'](),controller[_0xe906('0xe')]);router[_0xe906('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe906('0xf')]);router[_0xe906('0x10')]('/',auth[_0xe906('0xb')](),controller[_0xe906('0x11')]);router[_0xe906('0x12')](_0xe906('0x13'),auth[_0xe906('0xb')](),controller[_0xe906('0x14')]);router['delete'](_0xe906('0x13'),auth[_0xe906('0xb')](),controller['destroy']);module[_0xe906('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d7b8dfd..10d8acd 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 _0xa4f0=['moment','STRING','DATE'];(function(_0x1ea067,_0x29c0f2){var _0x2828d5=function(_0x2f1e20){while(--_0x2f1e20){_0x1ea067['push'](_0x1ea067['shift']());}};_0x2828d5(++_0x29c0f2);}(_0xa4f0,0x1c5));var _0x0a4f=function(_0x48dfc7,_0x28410f){_0x48dfc7=_0x48dfc7-0x0;var _0x553cbf=_0xa4f0[_0x48dfc7];return _0x553cbf;};'use strict';var moment=require(_0x0a4f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0a4f('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0a4f('0x2')]},'leaveAt':{'type':Sequelize[_0x0a4f('0x2')]},'acceptAt':{'type':Sequelize[_0x0a4f('0x2')]},'exitAt':{'type':Sequelize[_0x0a4f('0x2')]},'reason':{'type':Sequelize[_0x0a4f('0x1')]}}; \ No newline at end of file +var _0x1b12=['STRING','DATE','moment','exports'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x1b12,0x1b6));var _0x21b1=function(_0x457e2a,_0x5bf680){_0x457e2a=_0x457e2a-0x0;var _0xe1ef03=_0x1b12[_0x457e2a];return _0xe1ef03;};'use strict';var moment=require(_0x21b1('0x0'));var Sequelize=require('sequelize');module[_0x21b1('0x1')]={'uniqueid':{'type':Sequelize[_0x21b1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x21b1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x21b1('0x3')]},'acceptAt':{'type':Sequelize[_0x21b1('0x3')]},'exitAt':{'type':Sequelize[_0x21b1('0x3')]},'reason':{'type':Sequelize[_0x21b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index bd81146..1b0cc38 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 _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1893,0xa2));var _0x3189=function(_0x3a218d,_0x340ffa){_0x3a218d=_0x3a218d-0x0;var _0x23580d=_0x1893[_0x3a218d];return _0x23580d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file +var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9110608..8bc61fb 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 _0xd714=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x22b60b,_0x2825fe){var _0x198036=function(_0x4c69e3){while(--_0x4c69e3){_0x22b60b['push'](_0x22b60b['shift']());}};_0x198036(++_0x2825fe);}(_0xd714,0x1e4));var _0x4d71=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xd714[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var logger=require('../../config/logger')(_0x4d71('0x2'));var moment=require(_0x4d71('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d71('0x4'));var rimraf=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var attributes=require(_0x4d71('0x7'));module[_0x4d71('0x8')]=function(_0x154fa5,_0x3e04a6){return _0x154fa5[_0x4d71('0x9')](_0x4d71('0xa'),attributes,{'tableName':_0x4d71('0xb'),'paranoid':![],'indexes':[{'name':_0x4d71('0xc'),'fields':[_0x4d71('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed63=['report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','rimraf','./mailQueueReport.attributes','exports','MailQueueReport'];(function(_0xe92881,_0x22949b){var _0x33f5ef=function(_0x292532){while(--_0x292532){_0xe92881['push'](_0xe92881['shift']());}};_0x33f5ef(++_0x22949b);}(_0xed63,0x138));var _0x3ed6=function(_0x26b211,_0x1e5c0d){_0x26b211=_0x26b211-0x0;var _0x27b7bd=_0xed63[_0x26b211];return _0x27b7bd;};'use strict';var _=require(_0x3ed6('0x0'));var util=require('util');var logger=require(_0x3ed6('0x1'))(_0x3ed6('0x2'));var moment=require('moment');var BPromise=require(_0x3ed6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ed6('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ed6('0x5'));module[_0x3ed6('0x6')]=function(_0xa5fcda,_0x4bdb4a){return _0xa5fcda['define'](_0x3ed6('0x7'),attributes,{'tableName':_0x3ed6('0x8'),'paranoid':![],'indexes':[{'name':_0x3ed6('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6d918e5..44798f8 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d3bf4,_0x1d72a4){var _0x428095=function(_0xfb414){while(--_0xfb414){_0x5d3bf4['push'](_0x5d3bf4['shift']());}};_0x428095(++_0x1d72a4);}(_0x1261,0x144));var _0x1126=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x1261[_0x45f951];return _0x24756c;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ 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(_0xd54fba,_0x5ad76f){var _0x32651b=function(_0x27193d){while(--_0x27193d){_0xd54fba['push'](_0xd54fba['shift']());}};_0x32651b(++_0x5ad76f);}(_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 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 4073d26..f1017b6 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3da2ba,_0x4cad1f){var _0x533609=function(_0x4a8245){while(--_0x4a8245){_0x3da2ba['push'](_0x3da2ba['shift']());}};_0x533609(++_0x4cad1f);}(_0x70e0,0x17b));var _0x070e=function(_0x3b35e5,_0xe2124c){_0x3b35e5=_0x3b35e5-0x0;var _0x146102=_0x70e0[_0x3b35e5];return _0x146102;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7818a67..1e7afd8 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 _0xd64b=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd64b,0x1ee));var _0xbd64=function(_0x594de8,_0x46d0d2){_0x594de8=_0x594de8-0x0;var _0x5fcbf=_0xd64b[_0x594de8];return _0x5fcbf;};'use strict';var Sequelize=require(_0xbd64('0x0'));module[_0xbd64('0x1')]={'description':{'type':Sequelize[_0xbd64('0x2')]},'host':{'type':Sequelize[_0xbd64('0x2')]},'authentication':{'type':Sequelize[_0xbd64('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbd64('0x2')]},'password':{'type':Sequelize[_0xbd64('0x2')]},'port':{'type':Sequelize[_0xbd64('0x4')]},'tls':{'type':Sequelize[_0xbd64('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xbd64('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbd64('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xbd64('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbd64('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9cc3=['sequelize','exports','STRING','INTEGER','INBOX','BOOLEAN'];(function(_0x130d0e,_0x51fe46){var _0x79f65c=function(_0x1482dc){while(--_0x1482dc){_0x130d0e['push'](_0x130d0e['shift']());}};_0x79f65c(++_0x51fe46);}(_0x9cc3,0x138));var _0x39cc=function(_0x89db56,_0x53a18c){_0x89db56=_0x89db56-0x0;var _0x5eb329=_0x9cc3[_0x89db56];return _0x5eb329;};'use strict';var Sequelize=require(_0x39cc('0x0'));module[_0x39cc('0x1')]={'description':{'type':Sequelize[_0x39cc('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x39cc('0x2')]},'password':{'type':Sequelize[_0x39cc('0x2')]},'port':{'type':Sequelize[_0x39cc('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x39cc('0x2')],'defaultValue':_0x39cc('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x39cc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x39cc('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5e5f3a0..00bdcc7 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 _0x0b31=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5fb3,_0x15039f){var _0x5247af=function(_0x3a92b3){while(--_0x3a92b3){_0x1b5fb3['push'](_0x1b5fb3['shift']());}};_0x5247af(++_0x15039f);}(_0x0b31,0x1bc));var _0x10b3=function(_0x2bacd0,_0x30dc55){_0x2bacd0=_0x2bacd0-0x0;var _0x5f0cb6=_0x0b31[_0x2bacd0];return _0x5f0cb6;};'use strict';var _=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x10b3('0x2'));var BPromise=require(_0x10b3('0x3'));var rp=require(_0x10b3('0x4'));var fs=require('fs');var path=require(_0x10b3('0x5'));var rimraf=require(_0x10b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x10b3('0x7'));module[_0x10b3('0x8')]=function(_0x55ef86,_0x5437cb){return _0x55ef86[_0x10b3('0x9')]('MailServerIn',attributes,{'tableName':_0x10b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27f0=['mail_servers_in','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','MailServerIn'];(function(_0x375426,_0x38bf3a){var _0x30b435=function(_0x26a2ee){while(--_0x26a2ee){_0x375426['push'](_0x375426['shift']());}};_0x30b435(++_0x38bf3a);}(_0x27f0,0x161));var _0x027f=function(_0xf83bf2,_0x21c53c){_0xf83bf2=_0xf83bf2-0x0;var _0x206998=_0x27f0[_0xf83bf2];return _0x206998;};'use strict';var _=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var logger=require('../../config/logger')(_0x027f('0x2'));var moment=require(_0x027f('0x3'));var BPromise=require('bluebird');var rp=require(_0x027f('0x4'));var fs=require('fs');var path=require(_0x027f('0x5'));var rimraf=require(_0x027f('0x6'));var config=require(_0x027f('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x027f('0x8')]=function(_0x239951,_0x2ba3e7){return _0x239951['define'](_0x027f('0x9'),attributes,{'tableName':_0x027f('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 5e9aa20..3dd5d25 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 _0x8d37=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2726a9,_0x5b256e){var _0x2e153d=function(_0x54672f){while(--_0x54672f){_0x2726a9['push'](_0x2726a9['shift']());}};_0x2e153d(++_0x5b256e);}(_0x8d37,0x1d5));var _0x78d3=function(_0x92e599,_0x5d3b70){_0x92e599=_0x92e599-0x0;var _0x1825ba=_0x8d37[_0x92e599];return _0x1825ba;};'use strict';var _=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var moment=require(_0x78d3('0x2'));var BPromise=require(_0x78d3('0x3'));var rs=require(_0x78d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d3('0x5'))['db'];var utils=require(_0x78d3('0x6'));var logger=require(_0x78d3('0x7'))(_0x78d3('0x8'));var config=require(_0x78d3('0x9'));var jayson=require(_0x78d3('0xa'));var client=jayson[_0x78d3('0xb')][_0x78d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ad1fd,_0x8cfd85,_0x865e71){return new BPromise(function(_0x202243,_0x38da43){return client[_0x78d3('0xd')](_0x4ad1fd,_0x865e71)[_0x78d3('0xe')](function(_0x44ef49){logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x8cfd85,_0x78d3('0x11'));logger[_0x78d3('0x12')](_0x78d3('0x13'),_0x8cfd85,_0x78d3('0x11'),JSON[_0x78d3('0x14')](_0x44ef49));if(_0x44ef49[_0x78d3('0x15')]){if(_0x44ef49[_0x78d3('0x15')][_0x78d3('0x16')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x8cfd85,_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);return _0x38da43(_0x44ef49['error'][_0x78d3('0x17')]);}logger['error'](_0x78d3('0x10'),_0x8cfd85,_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);return _0x202243(_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);}else{logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x8cfd85,_0x78d3('0x11'));_0x202243(_0x44ef49['result'][_0x78d3('0x17')]);}})[_0x78d3('0x18')](function(_0x4ad1c5){logger[_0x78d3('0x15')](_0x78d3('0x10'),_0x8cfd85,_0x4ad1c5);_0x38da43(_0x4ad1c5);});});}exports[_0x78d3('0x19')]=function(_0x32c53e){var _0x23ecca=this;return new Promise(function(_0x4ffecd,_0x123c35){return db[_0x78d3('0x1a')][_0x78d3('0x1b')]({'raw':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e[_0x78d3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1d')]||null:null,'attributes':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e['options'][_0x78d3('0x1e')]||null:null,'limit':_0x32c53e['options']?_0x32c53e['options']['limit']||null:null,'include':_0x32c53e['options']?_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1f')]?_['map'](_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1f')],function(_0x34594f){return{'model':db[_0x34594f[_0x78d3('0x20')]],'as':_0x34594f['as'],'attributes':_0x34594f['attributes'],'include':_0x34594f[_0x78d3('0x1f')]?_[_0x78d3('0x21')](_0x34594f[_0x78d3('0x1f')],function(_0x12a317){return{'model':db[_0x12a317[_0x78d3('0x20')]],'as':_0x12a317['as'],'attributes':_0x12a317[_0x78d3('0x1e')],'include':_0x12a317['include']?_[_0x78d3('0x21')](_0x12a317[_0x78d3('0x1f')],function(_0x166cd7){return{'model':db[_0x166cd7[_0x78d3('0x20')]],'as':_0x166cd7['as'],'attributes':_0x166cd7[_0x78d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x78d3('0xe')](function(_0x28a5f2){logger['info']('GetMailServerIn',_0x32c53e);logger[_0x78d3('0x12')](_0x78d3('0x19'),_0x32c53e,JSON['stringify'](_0x28a5f2));_0x4ffecd(_0x28a5f2);})[_0x78d3('0x18')](function(_0x128c00){logger[_0x78d3('0x15')](_0x78d3('0x19'),_0x128c00[_0x78d3('0x17')],_0x32c53e);_0x123c35(_0x23ecca['error'](0x1f4,_0x128c00['message']));});});}; \ No newline at end of file +var _0x2608=['http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x32996b,_0x4c0449){var _0x2e39f2=function(_0x4016fb){while(--_0x4016fb){_0x32996b['push'](_0x32996b['shift']());}};_0x2e39f2(++_0x4c0449);}(_0x2608,0x1c8));var _0x8260=function(_0x49f4c5,_0x42da90){_0x49f4c5=_0x49f4c5-0x0;var _0x3843c7=_0x2608[_0x49f4c5];return _0x3843c7;};'use strict';var _=require(_0x8260('0x0'));var util=require('util');var moment=require(_0x8260('0x1'));var BPromise=require(_0x8260('0x2'));var rs=require(_0x8260('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8260('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8260('0x5'))(_0x8260('0x6'));var config=require('../../config/environment');var jayson=require(_0x8260('0x7'));var client=jayson[_0x8260('0x8')][_0x8260('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2541e7,_0x3504cd,_0x45954d){return new BPromise(function(_0x491e4b,_0x52dbb6){return client['request'](_0x2541e7,_0x45954d)[_0x8260('0xa')](function(_0x54e5b9){logger[_0x8260('0xb')](_0x8260('0xc'),_0x3504cd,_0x8260('0xd'));logger[_0x8260('0xe')](_0x8260('0xf'),_0x3504cd,_0x8260('0xd'),JSON[_0x8260('0x10')](_0x54e5b9));if(_0x54e5b9[_0x8260('0x11')]){if(_0x54e5b9[_0x8260('0x11')][_0x8260('0x12')]===0x1f4){logger[_0x8260('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3504cd,_0x54e5b9['error'][_0x8260('0x13')]);return _0x52dbb6(_0x54e5b9[_0x8260('0x11')][_0x8260('0x13')]);}logger[_0x8260('0x11')](_0x8260('0xc'),_0x3504cd,_0x54e5b9[_0x8260('0x11')][_0x8260('0x13')]);return _0x491e4b(_0x54e5b9['error']['message']);}else{logger[_0x8260('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3504cd,'request\x20sent');_0x491e4b(_0x54e5b9[_0x8260('0x14')][_0x8260('0x13')]);}})[_0x8260('0x15')](function(_0x21b4e5){logger[_0x8260('0x11')](_0x8260('0xc'),_0x3504cd,_0x21b4e5);_0x52dbb6(_0x21b4e5);});});}exports[_0x8260('0x16')]=function(_0x86245){var _0x501d72=this;return new Promise(function(_0x5b1d0b,_0x50ec48){return db['MailServerIn'][_0x8260('0x17')]({'raw':_0x86245[_0x8260('0x18')]?_0x86245['options'][_0x8260('0x19')]===undefined?!![]:![]:!![],'where':_0x86245[_0x8260('0x18')]?_0x86245[_0x8260('0x18')]['where']||null:null,'attributes':_0x86245[_0x8260('0x18')]?_0x86245[_0x8260('0x18')][_0x8260('0x1a')]||null:null,'limit':_0x86245[_0x8260('0x18')]?_0x86245[_0x8260('0x18')][_0x8260('0x1b')]||null:null,'include':_0x86245[_0x8260('0x18')]?_0x86245[_0x8260('0x18')][_0x8260('0x1c')]?_[_0x8260('0x1d')](_0x86245[_0x8260('0x18')]['include'],function(_0x496152){return{'model':db[_0x496152[_0x8260('0x1e')]],'as':_0x496152['as'],'attributes':_0x496152['attributes'],'include':_0x496152[_0x8260('0x1c')]?_[_0x8260('0x1d')](_0x496152[_0x8260('0x1c')],function(_0x1f055e){return{'model':db[_0x1f055e[_0x8260('0x1e')]],'as':_0x1f055e['as'],'attributes':_0x1f055e[_0x8260('0x1a')],'include':_0x1f055e[_0x8260('0x1c')]?_['map'](_0x1f055e[_0x8260('0x1c')],function(_0x32f40e){return{'model':db[_0x32f40e[_0x8260('0x1e')]],'as':_0x32f40e['as'],'attributes':_0x32f40e[_0x8260('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8260('0xa')](function(_0x5c5872){logger['info']('GetMailServerIn',_0x86245);logger[_0x8260('0xe')]('GetMailServerIn',_0x86245,JSON[_0x8260('0x10')](_0x5c5872));_0x5b1d0b(_0x5c5872);})[_0x8260('0x15')](function(_0x3c3694){logger['error'](_0x8260('0x16'),_0x3c3694[_0x8260('0x13')],_0x86245);_0x50ec48(_0x501d72[_0x8260('0x11')](0x1f4,_0x3c3694[_0x8260('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a3d49e8..393649e 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x4f6f1e,_0x3c6431){_0x4f6f1e=_0x4f6f1e-0x0;var _0x2699e0=_0x7a54[_0x4f6f1e];return _0x2699e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7a54,0x106));var _0x47a5=function(_0x2d888f,_0x340069){_0x2d888f=_0x2d888f-0x0;var _0x588bd8=_0x7a54[_0x2d888f];return _0x588bd8;};'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 c2d6485..37c533a 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 _0x4483=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5a5fbe,_0xbad7ce){var _0x59c38b=function(_0x5d7874){while(--_0x5d7874){_0x5a5fbe['push'](_0x5a5fbe['shift']());}};_0x59c38b(++_0xbad7ce);}(_0x4483,0x1a3));var _0x3448=function(_0x107e46,_0x3c1976){_0x107e46=_0x107e46-0x0;var _0x5dde6a=_0x4483[_0x107e46];return _0x5dde6a;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'description':{'type':Sequelize[_0x3448('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3448('0x2')]},'pass':{'type':Sequelize[_0x3448('0x2')]},'port':{'type':Sequelize[_0x3448('0x3')]},'secure':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3448('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x58a4=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x58a4,0xbf));var _0x458a=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x58a4[_0x28a5ad];return _0x176b8a;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'description':{'type':Sequelize[_0x458a('0x2')]},'host':{'type':Sequelize[_0x458a('0x2')]},'user':{'type':Sequelize[_0x458a('0x2')]},'pass':{'type':Sequelize[_0x458a('0x2')]},'port':{'type':Sequelize[_0x458a('0x3')]},'secure':{'type':Sequelize[_0x458a('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x458a('0x2')]},'authentication':{'type':Sequelize[_0x458a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x458a('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 d561ec8..9fb8ad4 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 _0x1f75=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f75,0xed));var _0x51f7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1f75[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x51f7('0x0'));var rimraf=require(_0x51f7('0x1'));var zipdir=require(_0x51f7('0x2'));var jsonpatch=require(_0x51f7('0x3'));var rp=require(_0x51f7('0x4'));var moment=require(_0x51f7('0x5'));var BPromise=require(_0x51f7('0x6'));var Mustache=require(_0x51f7('0x7'));var util=require(_0x51f7('0x8'));var path=require(_0x51f7('0x9'));var sox=require(_0x51f7('0xa'));var csv=require('to-csv');var ejs=require(_0x51f7('0xb'));var fs=require('fs');var fs_extra=require(_0x51f7('0xc'));var _=require(_0x51f7('0xd'));var squel=require(_0x51f7('0xe'));var crypto=require(_0x51f7('0xf'));var jsforce=require(_0x51f7('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51f7('0x11'));var Papa=require(_0x51f7('0x12'));var Redis=require(_0x51f7('0x13'));var authService=require(_0x51f7('0x14'));var qs=require(_0x51f7('0x15'));var as=require(_0x51f7('0x16'));var hardwareService=require(_0x51f7('0x17'));var logger=require('../../config/logger')(_0x51f7('0x18'));var utils=require(_0x51f7('0x19'));var config=require(_0x51f7('0x1a'));var licenseUtil=require(_0x51f7('0x1b'));var db=require(_0x51f7('0x1c'))['db'];function respondWithStatusCode(_0x567564,_0x22badf){_0x22badf=_0x22badf||0xcc;return function(_0x5ddb35){if(_0x5ddb35){return _0x567564[_0x51f7('0x1d')](_0x22badf);}return _0x567564[_0x51f7('0x1e')](_0x22badf)[_0x51f7('0x1f')]();};}function respondWithResult(_0x2c670f,_0x3fec0d){_0x3fec0d=_0x3fec0d||0xc8;return function(_0x65594e){if(_0x65594e){return _0x2c670f[_0x51f7('0x1e')](_0x3fec0d)[_0x51f7('0x20')](_0x65594e);}};}function respondWithFilteredResult(_0x50aa01,_0x273b95){return function(_0x43c681){if(_0x43c681){var _0x5d33d8=typeof _0x273b95[_0x51f7('0x21')]===_0x51f7('0x22')&&typeof _0x273b95['limit']===_0x51f7('0x22');var _0x4e78f3=_0x43c681[_0x51f7('0x23')];var _0x5475b2=_0x5d33d8?0x0:_0x273b95[_0x51f7('0x21')];var _0x35cae8=_0x5d33d8?_0x43c681[_0x51f7('0x23')]:_0x273b95[_0x51f7('0x21')]+_0x273b95[_0x51f7('0x24')];var _0x5c2b31;if(_0x35cae8>=_0x4e78f3){_0x35cae8=_0x4e78f3;_0x5c2b31=0xc8;}else{_0x5c2b31=0xce;}_0x50aa01[_0x51f7('0x1e')](_0x5c2b31);return _0x50aa01[_0x51f7('0x25')](_0x51f7('0x26'),_0x5475b2+'-'+_0x35cae8+'/'+_0x4e78f3)['json'](_0x43c681);}return null;};}function patchUpdates(_0x2f96b7){return function(_0x56afe1){try{jsonpatch[_0x51f7('0x27')](_0x56afe1,_0x2f96b7,!![]);}catch(_0x5c826a){return BPromise['reject'](_0x5c826a);}return _0x56afe1[_0x51f7('0x28')]();};}function saveUpdates(_0x3c3c38,_0x52535e){return function(_0x5d9b3a){if(_0x5d9b3a){return _0x5d9b3a['update'](_0x3c3c38)[_0x51f7('0x29')](function(_0x35d722){return _0x35d722;});}return null;};}function removeEntity(_0x2011b5,_0x5ae0d1){return function(_0x10f081){if(_0x10f081){return _0x10f081[_0x51f7('0x2a')]()[_0x51f7('0x29')](function(){_0x2011b5[_0x51f7('0x1e')](0xcc)[_0x51f7('0x1f')]();});}};}function handleEntityNotFound(_0x49f46c,_0x2655f5){return function(_0x5e8d36){if(!_0x5e8d36){_0x49f46c['sendStatus'](0x194);}return _0x5e8d36;};}function handleError(_0x17bf2a,_0x12436f){_0x12436f=_0x12436f||0x1f4;return function(_0xccc7cf){logger[_0x51f7('0x2b')](_0xccc7cf[_0x51f7('0x2c')]);if(_0xccc7cf[_0x51f7('0x2d')]){delete _0xccc7cf['name'];}_0x17bf2a['status'](_0x12436f)[_0x51f7('0x2e')](_0xccc7cf);};}exports[_0x51f7('0x2f')]=function(_0x18a647,_0x1c5f5f){var _0x5d1285={},_0x16caf7={},_0x90dd08={'count':0x0,'rows':[]};var _0x36b19c=_[_0x51f7('0x30')](db[_0x51f7('0x31')][_0x51f7('0x32')],function(_0x39a79f){return{'name':_0x39a79f[_0x51f7('0x33')],'type':_0x39a79f[_0x51f7('0x34')][_0x51f7('0x35')]};});_0x16caf7['model']=_[_0x51f7('0x30')](_0x36b19c,_0x51f7('0x2d'));_0x16caf7[_0x51f7('0x36')]=_['keys'](_0x18a647[_0x51f7('0x36')]);_0x16caf7[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x16caf7[_0x51f7('0x39')],_0x16caf7[_0x51f7('0x36')]);_0x5d1285[_0x51f7('0x3a')]=_[_0x51f7('0x38')](_0x16caf7[_0x51f7('0x39')],qs[_0x51f7('0x3b')](_0x18a647[_0x51f7('0x36')]['fields']));_0x5d1285[_0x51f7('0x3a')]=_0x5d1285[_0x51f7('0x3a')][_0x51f7('0x3c')]?_0x5d1285[_0x51f7('0x3a')]:_0x16caf7['model'];if(!_0x18a647[_0x51f7('0x36')][_0x51f7('0x3d')](_0x51f7('0x3e'))){_0x5d1285[_0x51f7('0x24')]=qs[_0x51f7('0x24')](_0x18a647[_0x51f7('0x36')]['limit']);_0x5d1285[_0x51f7('0x21')]=qs['offset'](_0x18a647[_0x51f7('0x36')][_0x51f7('0x21')]);}_0x5d1285[_0x51f7('0x3f')]=qs[_0x51f7('0x40')](_0x18a647['query'][_0x51f7('0x40')]);_0x5d1285[_0x51f7('0x41')]=qs[_0x51f7('0x37')](_[_0x51f7('0x42')](_0x18a647[_0x51f7('0x36')],_0x16caf7[_0x51f7('0x37')]),_0x36b19c);if(_0x18a647[_0x51f7('0x36')][_0x51f7('0x43')]){_0x5d1285['where']=_['merge'](_0x5d1285['where'],{'$or':_[_0x51f7('0x30')](_0x36b19c,function(_0x39dbb6){if(_0x39dbb6[_0x51f7('0x34')]!==_0x51f7('0x44')){var _0x43df0c={};_0x43df0c[_0x39dbb6['name']]={'$like':'%'+_0x18a647['query'][_0x51f7('0x43')]+'%'};return _0x43df0c;}})});}_0x5d1285=_[_0x51f7('0x45')]({},_0x5d1285,_0x18a647[_0x51f7('0x46')]);var _0x76623a={'where':_0x5d1285[_0x51f7('0x41')]};return db['MailServerOut'][_0x51f7('0x23')](_0x76623a)[_0x51f7('0x29')](function(_0x30dc72){_0x90dd08[_0x51f7('0x23')]=_0x30dc72;if(_0x18a647[_0x51f7('0x36')]['includeAll']){_0x5d1285[_0x51f7('0x47')]=[{'all':!![]}];}return db[_0x51f7('0x31')][_0x51f7('0x48')](_0x5d1285);})['then'](function(_0x1b6e1d){_0x90dd08[_0x51f7('0x49')]=_0x1b6e1d;return _0x90dd08;})[_0x51f7('0x29')](respondWithFilteredResult(_0x1c5f5f,_0x5d1285))[_0x51f7('0x4a')](handleError(_0x1c5f5f,null));};exports['show']=function(_0x4583ae,_0x26bac1){var _0x259aff={'raw':!![],'where':{'id':_0x4583ae[_0x51f7('0x4b')]['id']}},_0x1860b2={};_0x1860b2[_0x51f7('0x39')]=_[_0x51f7('0x4c')](db['MailServerOut'][_0x51f7('0x32')]);_0x1860b2[_0x51f7('0x36')]=_[_0x51f7('0x4c')](_0x4583ae['query']);_0x1860b2[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x1860b2[_0x51f7('0x39')],_0x1860b2['query']);_0x259aff[_0x51f7('0x3a')]=_[_0x51f7('0x38')](_0x1860b2[_0x51f7('0x39')],qs[_0x51f7('0x3b')](_0x4583ae[_0x51f7('0x36')][_0x51f7('0x3b')]));_0x259aff[_0x51f7('0x3a')]=_0x259aff[_0x51f7('0x3a')][_0x51f7('0x3c')]?_0x259aff[_0x51f7('0x3a')]:_0x1860b2[_0x51f7('0x39')];if(_0x4583ae[_0x51f7('0x36')][_0x51f7('0x4d')]){_0x259aff[_0x51f7('0x47')]=[{'all':!![]}];}_0x259aff=_[_0x51f7('0x45')]({},_0x259aff,_0x4583ae[_0x51f7('0x46')]);return db[_0x51f7('0x31')]['find'](_0x259aff)['then'](handleEntityNotFound(_0x26bac1,null))[_0x51f7('0x29')](respondWithResult(_0x26bac1,null))['catch'](handleError(_0x26bac1,null));};exports[_0x51f7('0x4e')]=function(_0x34e37b,_0x57433d){return db['MailServerOut']['create'](_0x34e37b[_0x51f7('0x4f')],{})[_0x51f7('0x29')](respondWithResult(_0x57433d,0xc9))[_0x51f7('0x4a')](handleError(_0x57433d,null));};exports[_0x51f7('0x50')]=function(_0x5c9e52,_0x406f36){if(_0x5c9e52[_0x51f7('0x4f')]['id']){delete _0x5c9e52[_0x51f7('0x4f')]['id'];}return db['MailServerOut'][_0x51f7('0x51')]({'where':{'id':_0x5c9e52[_0x51f7('0x4b')]['id']}})[_0x51f7('0x29')](handleEntityNotFound(_0x406f36,null))['then'](saveUpdates(_0x5c9e52[_0x51f7('0x4f')],null))['then'](respondWithResult(_0x406f36,null))[_0x51f7('0x4a')](handleError(_0x406f36,null));};exports['destroy']=function(_0x506de3,_0x38e1c7){return db['MailServerOut'][_0x51f7('0x51')]({'where':{'id':_0x506de3['params']['id']}})[_0x51f7('0x29')](handleEntityNotFound(_0x38e1c7,null))['then'](removeEntity(_0x38e1c7,null))['catch'](handleError(_0x38e1c7,null));}; \ No newline at end of file +var _0xbd8b=['update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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'];(function(_0x2dbb11,_0x4cd53a){var _0x3ff04c=function(_0x3bceb3){while(--_0x3bceb3){_0x2dbb11['push'](_0x2dbb11['shift']());}};_0x3ff04c(++_0x4cd53a);}(_0xbd8b,0x153));var _0xbbd8=function(_0x3f93f0,_0x523448){_0x3f93f0=_0x3f93f0-0x0;var _0xd3d3e=_0xbd8b[_0x3f93f0];return _0xd3d3e;};'use strict';var emlformat=require(_0xbbd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbd8('0x1'));var jsonpatch=require(_0xbbd8('0x2'));var rp=require('request-promise');var moment=require(_0xbbd8('0x3'));var BPromise=require(_0xbbd8('0x4'));var Mustache=require(_0xbbd8('0x5'));var util=require(_0xbbd8('0x6'));var path=require('path');var sox=require(_0xbbd8('0x7'));var csv=require(_0xbbd8('0x8'));var ejs=require(_0xbbd8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbd8('0xa'));var _=require(_0xbbd8('0xb'));var squel=require(_0xbbd8('0xc'));var crypto=require(_0xbbd8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbd8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbbd8('0xf'));var Papa=require(_0xbbd8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbbd8('0x11'));var as=require(_0xbbd8('0x12'));var hardwareService=require(_0xbbd8('0x13'));var logger=require('../../config/logger')(_0xbbd8('0x14'));var utils=require(_0xbbd8('0x15'));var config=require(_0xbbd8('0x16'));var licenseUtil=require(_0xbbd8('0x17'));var db=require(_0xbbd8('0x18'))['db'];function respondWithStatusCode(_0x5d9b8e,_0x5dba18){_0x5dba18=_0x5dba18||0xcc;return function(_0x127d79){if(_0x127d79){return _0x5d9b8e[_0xbbd8('0x19')](_0x5dba18);}return _0x5d9b8e[_0xbbd8('0x1a')](_0x5dba18)[_0xbbd8('0x1b')]();};}function respondWithResult(_0x4175a5,_0x394d4f){_0x394d4f=_0x394d4f||0xc8;return function(_0x528c35){if(_0x528c35){return _0x4175a5[_0xbbd8('0x1a')](_0x394d4f)['json'](_0x528c35);}};}function respondWithFilteredResult(_0x58106e,_0x3c0363){return function(_0x3165e9){if(_0x3165e9){var _0x18bd52=typeof _0x3c0363[_0xbbd8('0x1c')]===_0xbbd8('0x1d')&&typeof _0x3c0363[_0xbbd8('0x1e')]===_0xbbd8('0x1d');var _0xa255fa=_0x3165e9[_0xbbd8('0x1f')];var _0x343d62=_0x18bd52?0x0:_0x3c0363[_0xbbd8('0x1c')];var _0x4d0406=_0x18bd52?_0x3165e9[_0xbbd8('0x1f')]:_0x3c0363[_0xbbd8('0x1c')]+_0x3c0363[_0xbbd8('0x1e')];var _0x581763;if(_0x4d0406>=_0xa255fa){_0x4d0406=_0xa255fa;_0x581763=0xc8;}else{_0x581763=0xce;}_0x58106e[_0xbbd8('0x1a')](_0x581763);return _0x58106e[_0xbbd8('0x20')](_0xbbd8('0x21'),_0x343d62+'-'+_0x4d0406+'/'+_0xa255fa)[_0xbbd8('0x22')](_0x3165e9);}return null;};}function patchUpdates(_0x375176){return function(_0x191c7e){try{jsonpatch[_0xbbd8('0x23')](_0x191c7e,_0x375176,!![]);}catch(_0x5e3f83){return BPromise['reject'](_0x5e3f83);}return _0x191c7e['save']();};}function saveUpdates(_0x4bcbb0,_0x46c2bb){return function(_0x3a9a4d){if(_0x3a9a4d){return _0x3a9a4d[_0xbbd8('0x24')](_0x4bcbb0)[_0xbbd8('0x25')](function(_0x4df216){return _0x4df216;});}return null;};}function removeEntity(_0x2049f6,_0xbcc444){return function(_0x3127d2){if(_0x3127d2){return _0x3127d2[_0xbbd8('0x26')]()['then'](function(){_0x2049f6['status'](0xcc)[_0xbbd8('0x1b')]();});}};}function handleEntityNotFound(_0x120d52,_0x5a18f0){return function(_0x2116c4){if(!_0x2116c4){_0x120d52['sendStatus'](0x194);}return _0x2116c4;};}function handleError(_0x2dd169,_0x57420b){_0x57420b=_0x57420b||0x1f4;return function(_0x3105e5){logger[_0xbbd8('0x27')](_0x3105e5['stack']);if(_0x3105e5[_0xbbd8('0x28')]){delete _0x3105e5[_0xbbd8('0x28')];}_0x2dd169[_0xbbd8('0x1a')](_0x57420b)[_0xbbd8('0x29')](_0x3105e5);};}exports[_0xbbd8('0x2a')]=function(_0x1c3a7e,_0x3b184c){var _0x59cc66={},_0x3d8916={},_0x3a0dd0={'count':0x0,'rows':[]};var _0x3d2be5=_[_0xbbd8('0x2b')](db[_0xbbd8('0x2c')][_0xbbd8('0x2d')],function(_0x2f7baf){return{'name':_0x2f7baf[_0xbbd8('0x2e')],'type':_0x2f7baf[_0xbbd8('0x2f')][_0xbbd8('0x30')]};});_0x3d8916[_0xbbd8('0x31')]=_['map'](_0x3d2be5,_0xbbd8('0x28'));_0x3d8916[_0xbbd8('0x32')]=_[_0xbbd8('0x33')](_0x1c3a7e[_0xbbd8('0x32')]);_0x3d8916['filters']=_[_0xbbd8('0x34')](_0x3d8916[_0xbbd8('0x31')],_0x3d8916[_0xbbd8('0x32')]);_0x59cc66['attributes']=_[_0xbbd8('0x34')](_0x3d8916[_0xbbd8('0x31')],qs[_0xbbd8('0x35')](_0x1c3a7e['query'][_0xbbd8('0x35')]));_0x59cc66[_0xbbd8('0x36')]=_0x59cc66[_0xbbd8('0x36')][_0xbbd8('0x37')]?_0x59cc66[_0xbbd8('0x36')]:_0x3d8916[_0xbbd8('0x31')];if(!_0x1c3a7e[_0xbbd8('0x32')][_0xbbd8('0x38')]('nolimit')){_0x59cc66['limit']=qs[_0xbbd8('0x1e')](_0x1c3a7e[_0xbbd8('0x32')][_0xbbd8('0x1e')]);_0x59cc66['offset']=qs[_0xbbd8('0x1c')](_0x1c3a7e[_0xbbd8('0x32')]['offset']);}_0x59cc66[_0xbbd8('0x39')]=qs[_0xbbd8('0x3a')](_0x1c3a7e[_0xbbd8('0x32')][_0xbbd8('0x3a')]);_0x59cc66[_0xbbd8('0x3b')]=qs[_0xbbd8('0x3c')](_[_0xbbd8('0x3d')](_0x1c3a7e[_0xbbd8('0x32')],_0x3d8916[_0xbbd8('0x3c')]),_0x3d2be5);if(_0x1c3a7e['query'][_0xbbd8('0x3e')]){_0x59cc66['where']=_[_0xbbd8('0x3f')](_0x59cc66['where'],{'$or':_['map'](_0x3d2be5,function(_0x3db7bd){if(_0x3db7bd[_0xbbd8('0x2f')]!==_0xbbd8('0x40')){var _0x5538b0={};_0x5538b0[_0x3db7bd[_0xbbd8('0x28')]]={'$like':'%'+_0x1c3a7e[_0xbbd8('0x32')][_0xbbd8('0x3e')]+'%'};return _0x5538b0;}})});}_0x59cc66=_[_0xbbd8('0x3f')]({},_0x59cc66,_0x1c3a7e[_0xbbd8('0x41')]);var _0x286e90={'where':_0x59cc66[_0xbbd8('0x3b')]};return db[_0xbbd8('0x2c')][_0xbbd8('0x1f')](_0x286e90)[_0xbbd8('0x25')](function(_0x35eeb7){_0x3a0dd0['count']=_0x35eeb7;if(_0x1c3a7e[_0xbbd8('0x32')][_0xbbd8('0x42')]){_0x59cc66[_0xbbd8('0x43')]=[{'all':!![]}];}return db[_0xbbd8('0x2c')][_0xbbd8('0x44')](_0x59cc66);})[_0xbbd8('0x25')](function(_0x527796){_0x3a0dd0['rows']=_0x527796;return _0x3a0dd0;})[_0xbbd8('0x25')](respondWithFilteredResult(_0x3b184c,_0x59cc66))[_0xbbd8('0x45')](handleError(_0x3b184c,null));};exports[_0xbbd8('0x46')]=function(_0x109409,_0x5775ea){var _0x5e9e52={'raw':!![],'where':{'id':_0x109409[_0xbbd8('0x47')]['id']}},_0x31c4ad={};_0x31c4ad[_0xbbd8('0x31')]=_[_0xbbd8('0x33')](db[_0xbbd8('0x2c')][_0xbbd8('0x2d')]);_0x31c4ad['query']=_[_0xbbd8('0x33')](_0x109409[_0xbbd8('0x32')]);_0x31c4ad[_0xbbd8('0x3c')]=_[_0xbbd8('0x34')](_0x31c4ad[_0xbbd8('0x31')],_0x31c4ad[_0xbbd8('0x32')]);_0x5e9e52['attributes']=_[_0xbbd8('0x34')](_0x31c4ad[_0xbbd8('0x31')],qs[_0xbbd8('0x35')](_0x109409['query'][_0xbbd8('0x35')]));_0x5e9e52[_0xbbd8('0x36')]=_0x5e9e52['attributes'][_0xbbd8('0x37')]?_0x5e9e52['attributes']:_0x31c4ad[_0xbbd8('0x31')];if(_0x109409[_0xbbd8('0x32')][_0xbbd8('0x42')]){_0x5e9e52[_0xbbd8('0x43')]=[{'all':!![]}];}_0x5e9e52=_[_0xbbd8('0x3f')]({},_0x5e9e52,_0x109409[_0xbbd8('0x41')]);return db['MailServerOut'][_0xbbd8('0x48')](_0x5e9e52)[_0xbbd8('0x25')](handleEntityNotFound(_0x5775ea,null))[_0xbbd8('0x25')](respondWithResult(_0x5775ea,null))[_0xbbd8('0x45')](handleError(_0x5775ea,null));};exports[_0xbbd8('0x49')]=function(_0x153309,_0x5946b1){return db[_0xbbd8('0x2c')]['create'](_0x153309[_0xbbd8('0x4a')],{})['then'](respondWithResult(_0x5946b1,0xc9))[_0xbbd8('0x45')](handleError(_0x5946b1,null));};exports[_0xbbd8('0x24')]=function(_0x240e4d,_0x2807b0){if(_0x240e4d[_0xbbd8('0x4a')]['id']){delete _0x240e4d['body']['id'];}return db[_0xbbd8('0x2c')][_0xbbd8('0x48')]({'where':{'id':_0x240e4d['params']['id']}})['then'](handleEntityNotFound(_0x2807b0,null))['then'](saveUpdates(_0x240e4d['body'],null))['then'](respondWithResult(_0x2807b0,null))[_0xbbd8('0x45')](handleError(_0x2807b0,null));};exports[_0xbbd8('0x26')]=function(_0x4a1ae1,_0x12832f){return db[_0xbbd8('0x2c')]['find']({'where':{'id':_0x4a1ae1[_0xbbd8('0x47')]['id']}})[_0xbbd8('0x25')](handleEntityNotFound(_0x12832f,null))['then'](removeEntity(_0x12832f,null))['catch'](handleError(_0x12832f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index dc0722b..752a504 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 _0xd077=['api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash','../../config/logger'];(function(_0xa1289e,_0x1aa3b7){var _0x1db11f=function(_0x20b1f9){while(--_0x20b1f9){_0xa1289e['push'](_0xa1289e['shift']());}};_0x1db11f(++_0x1aa3b7);}(_0xd077,0x152));var _0x7d07=function(_0x40e6c9,_0x2c8520){_0x40e6c9=_0x40e6c9-0x0;var _0x26919e=_0xd077[_0x40e6c9];return _0x26919e;};'use strict';var _=require(_0x7d07('0x0'));var util=require('util');var logger=require(_0x7d07('0x1'))(_0x7d07('0x2'));var moment=require(_0x7d07('0x3'));var BPromise=require(_0x7d07('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d07('0x5'));var config=require(_0x7d07('0x6'));var attributes=require(_0x7d07('0x7'));module[_0x7d07('0x8')]=function(_0x5ac2c1,_0x34e502){return _0x5ac2c1['define'](_0x7d07('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe49a=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x3f9264,_0x2caf6f){var _0x15268c=function(_0x4d6bc2){while(--_0x4d6bc2){_0x3f9264['push'](_0x3f9264['shift']());}};_0x15268c(++_0x2caf6f);}(_0xe49a,0xde));var _0xae49=function(_0x75c0aa,_0x52f100){_0x75c0aa=_0x75c0aa-0x0;var _0x397a4e=_0xe49a[_0x75c0aa];return _0x397a4e;};'use strict';var _=require(_0xae49('0x0'));var util=require('util');var logger=require(_0xae49('0x1'))(_0xae49('0x2'));var moment=require('moment');var BPromise=require(_0xae49('0x3'));var rp=require(_0xae49('0x4'));var fs=require('fs');var path=require(_0xae49('0x5'));var rimraf=require('rimraf');var config=require(_0xae49('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x232ab5,_0x406ea1){return _0x232ab5[_0xae49('0x7')](_0xae49('0x8'),attributes,{'tableName':_0xae49('0x9'),'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 870c230..58fd9b2 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x81a41,_0x434c3d){var _0x179fd5=function(_0x1c089c){while(--_0x1c089c){_0x81a41['push'](_0x81a41['shift']());}};_0x179fd5(++_0x434c3d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +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(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0xadb5,0xad));var _0x5adb=function(_0x3c663d,_0x1e4910){_0x3c663d=_0x3c663d-0x0;var _0x4b73f5=_0xadb5[_0x3c663d];return _0x4b73f5;};'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 94732d3..027d16a 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 _0xc995=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','create'];(function(_0x121617,_0x77c5fe){var _0x329f92=function(_0x54b8f9){while(--_0x54b8f9){_0x121617['push'](_0x121617['shift']());}};_0x329f92(++_0x77c5fe);}(_0xc995,0x1f3));var _0x5c99=function(_0x3de33b,_0x3601fd){_0x3de33b=_0x3de33b-0x0;var _0x16d8ff=_0xc995[_0x3de33b];return _0x16d8ff;};'use strict';var multer=require('multer');var util=require(_0x5c99('0x0'));var path=require(_0x5c99('0x1'));var timeout=require(_0x5c99('0x2'));var express=require('express');var router=express[_0x5c99('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c99('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c99('0x5'));var controller=require(_0x5c99('0x6'));router['get']('/',auth[_0x5c99('0x7')](),controller[_0x5c99('0x8')]);router[_0x5c99('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5c99('0xa')]);router[_0x5c99('0x9')](_0x5c99('0xb'),auth['isAuthenticated'](),controller[_0x5c99('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5c99('0xd')]);router[_0x5c99('0xe')](_0x5c99('0xb'),auth[_0x5c99('0x7')](),controller[_0x5c99('0xf')]);router[_0x5c99('0x10')](_0x5c99('0xb'),auth[_0x5c99('0x7')](),controller[_0x5c99('0x11')]);module[_0x5c99('0x12')]=router; \ No newline at end of file +var _0xe72c=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','index','get','isAuthenticated','describe','show','post','create','put'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0xe72c,0x17b));var _0xce72=function(_0x313e42,_0x2cfb7e){_0x313e42=_0x313e42-0x0;var _0x2907f5=_0xe72c[_0x313e42];return _0x2907f5;};'use strict';var multer=require(_0xce72('0x0'));var util=require('util');var path=require(_0xce72('0x1'));var timeout=require(_0xce72('0x2'));var express=require(_0xce72('0x3'));var router=express[_0xce72('0x4')]();var fs_extra=require(_0xce72('0x5'));var auth=require(_0xce72('0x6'));var interaction=require(_0xce72('0x7'));var config=require('../../config/environment');var controller=require(_0xce72('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xce72('0x9')]);router[_0xce72('0xa')]('/describe',auth[_0xce72('0xb')](),controller[_0xce72('0xc')]);router[_0xce72('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xce72('0xd')]);router[_0xce72('0xe')]('/',auth[_0xce72('0xb')](),controller[_0xce72('0xf')]);router[_0xce72('0x10')](_0xce72('0x11'),auth[_0xce72('0xb')](),controller[_0xce72('0x12')]);router[_0xce72('0x13')](_0xce72('0x11'),auth[_0xce72('0xb')](),controller[_0xce72('0x14')]);module[_0xce72('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7398de5..18ce0f4 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 _0x02a7=['exports','STRING'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x02a7,0x7a));var _0x702a=function(_0x45ed6b,_0x4937b7){_0x45ed6b=_0x45ed6b-0x0;var _0x1cdda6=_0x02a7[_0x45ed6b];return _0x1cdda6;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file +var _0x3e24=['exports','STRING','name','sequelize'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x3e24,0x167));var _0x43e2=function(_0x378aca,_0x13e103){_0x378aca=_0x378aca-0x0;var _0x1b7b4b=_0x3e24[_0x378aca];return _0x1b7b4b;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')],'unique':_0x43e2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 906df28..9b3019e 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 _0x1e46=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3a024b,_0x413f45){var _0x1c7fb8=function(_0x1a08e8){while(--_0x1a08e8){_0x3a024b['push'](_0x3a024b['shift']());}};_0x1c7fb8(++_0x413f45);}(_0x1e46,0x80));var _0x61e4=function(_0xf61b07,_0x459c48){_0xf61b07=_0xf61b07-0x0;var _0x2ae736=_0x1e46[_0xf61b07];return _0x2ae736;};'use strict';var emlformat=require(_0x61e4('0x0'));var rimraf=require(_0x61e4('0x1'));var zipdir=require(_0x61e4('0x2'));var jsonpatch=require(_0x61e4('0x3'));var rp=require('request-promise');var moment=require(_0x61e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x61e4('0x5'));var util=require(_0x61e4('0x6'));var path=require(_0x61e4('0x7'));var sox=require(_0x61e4('0x8'));var csv=require(_0x61e4('0x9'));var ejs=require(_0x61e4('0xa'));var fs=require('fs');var fs_extra=require(_0x61e4('0xb'));var _=require(_0x61e4('0xc'));var squel=require(_0x61e4('0xd'));var crypto=require(_0x61e4('0xe'));var jsforce=require(_0x61e4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x61e4('0x9'));var querystring=require(_0x61e4('0x10'));var Papa=require(_0x61e4('0x11'));var Redis=require(_0x61e4('0x12'));var authService=require(_0x61e4('0x13'));var qs=require(_0x61e4('0x14'));var as=require(_0x61e4('0x15'));var hardwareService=require(_0x61e4('0x16'));var logger=require(_0x61e4('0x17'))(_0x61e4('0x18'));var utils=require('../../config/utils');var config=require(_0x61e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x61e4('0x1a'))['db'];function respondWithStatusCode(_0x526f6b,_0x544413){_0x544413=_0x544413||0xcc;return function(_0x4ff622){if(_0x4ff622){return _0x526f6b[_0x61e4('0x1b')](_0x544413);}return _0x526f6b[_0x61e4('0x1c')](_0x544413)[_0x61e4('0x1d')]();};}function respondWithResult(_0x1513c9,_0x382471){_0x382471=_0x382471||0xc8;return function(_0x50ddbd){if(_0x50ddbd){return _0x1513c9[_0x61e4('0x1c')](_0x382471)[_0x61e4('0x1e')](_0x50ddbd);}};}function respondWithFilteredResult(_0x229fba,_0x82d063){return function(_0x532931){if(_0x532931){var _0x118606=typeof _0x82d063[_0x61e4('0x1f')]===_0x61e4('0x20')&&typeof _0x82d063[_0x61e4('0x21')]===_0x61e4('0x20');var _0x3445af=_0x532931[_0x61e4('0x22')];var _0x2beb20=_0x118606?0x0:_0x82d063[_0x61e4('0x1f')];var _0x8acc58=_0x118606?_0x532931[_0x61e4('0x22')]:_0x82d063[_0x61e4('0x1f')]+_0x82d063['limit'];var _0x2be234;if(_0x8acc58>=_0x3445af){_0x8acc58=_0x3445af;_0x2be234=0xc8;}else{_0x2be234=0xce;}_0x229fba['status'](_0x2be234);return _0x229fba[_0x61e4('0x23')](_0x61e4('0x24'),_0x2beb20+'-'+_0x8acc58+'/'+_0x3445af)[_0x61e4('0x1e')](_0x532931);}return null;};}function patchUpdates(_0x1d2b41){return function(_0x217dc0){try{jsonpatch[_0x61e4('0x25')](_0x217dc0,_0x1d2b41,!![]);}catch(_0x549fc8){return BPromise[_0x61e4('0x26')](_0x549fc8);}return _0x217dc0['save']();};}function saveUpdates(_0x1c8b13,_0x59fddc){return function(_0xb5b227){if(_0xb5b227){return _0xb5b227[_0x61e4('0x27')](_0x1c8b13)['then'](function(_0x44a4d6){return _0x44a4d6;});}return null;};}function removeEntity(_0x2c929d,_0x300cd3){return function(_0x6259d5){if(_0x6259d5){return _0x6259d5[_0x61e4('0x28')]()[_0x61e4('0x29')](function(){_0x2c929d[_0x61e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b6ae9,_0xe00710){return function(_0x3148e3){if(!_0x3148e3){_0x6b6ae9[_0x61e4('0x1b')](0x194);}return _0x3148e3;};}function handleError(_0x4ac268,_0x510280){_0x510280=_0x510280||0x1f4;return function(_0x260d3c){logger[_0x61e4('0x2a')](_0x260d3c[_0x61e4('0x2b')]);if(_0x260d3c[_0x61e4('0x2c')]){delete _0x260d3c['name'];}_0x4ac268[_0x61e4('0x1c')](_0x510280)['send'](_0x260d3c);};}exports[_0x61e4('0x2d')]=function(_0x428c97,_0x5727e8){var _0x1f8d83={},_0x4251d0={},_0x5e8955={'count':0x0,'rows':[]};var _0x17668a=_[_0x61e4('0x2e')](db[_0x61e4('0x2f')][_0x61e4('0x30')],function(_0x256620){return{'name':_0x256620[_0x61e4('0x31')],'type':_0x256620[_0x61e4('0x32')][_0x61e4('0x33')]};});_0x4251d0[_0x61e4('0x34')]=_['map'](_0x17668a,'name');_0x4251d0[_0x61e4('0x35')]=_['keys'](_0x428c97[_0x61e4('0x35')]);_0x4251d0[_0x61e4('0x36')]=_['intersection'](_0x4251d0[_0x61e4('0x34')],_0x4251d0[_0x61e4('0x35')]);_0x1f8d83[_0x61e4('0x37')]=_[_0x61e4('0x38')](_0x4251d0[_0x61e4('0x34')],qs['fields'](_0x428c97['query'][_0x61e4('0x39')]));_0x1f8d83[_0x61e4('0x37')]=_0x1f8d83[_0x61e4('0x37')]['length']?_0x1f8d83['attributes']:_0x4251d0[_0x61e4('0x34')];if(!_0x428c97[_0x61e4('0x35')]['hasOwnProperty']('nolimit')){_0x1f8d83['limit']=qs[_0x61e4('0x21')](_0x428c97[_0x61e4('0x35')]['limit']);_0x1f8d83['offset']=qs[_0x61e4('0x1f')](_0x428c97['query'][_0x61e4('0x1f')]);}_0x1f8d83[_0x61e4('0x3a')]=qs['sort'](_0x428c97[_0x61e4('0x35')]['sort']);_0x1f8d83['where']=qs[_0x61e4('0x36')](_['pick'](_0x428c97[_0x61e4('0x35')],_0x4251d0[_0x61e4('0x36')]),_0x17668a);if(_0x428c97['query'][_0x61e4('0x3b')]){_0x1f8d83[_0x61e4('0x3c')]=_[_0x61e4('0x3d')](_0x1f8d83[_0x61e4('0x3c')],{'$or':_['map'](_0x17668a,function(_0x37fdd0){if(_0x37fdd0['type']!==_0x61e4('0x3e')){var _0x26916b={};_0x26916b[_0x37fdd0[_0x61e4('0x2c')]]={'$like':'%'+_0x428c97[_0x61e4('0x35')][_0x61e4('0x3b')]+'%'};return _0x26916b;}})});}_0x1f8d83=_[_0x61e4('0x3d')]({},_0x1f8d83,_0x428c97[_0x61e4('0x3f')]);var _0x2ce0b3={'where':_0x1f8d83[_0x61e4('0x3c')]};return db[_0x61e4('0x2f')]['count'](_0x2ce0b3)[_0x61e4('0x29')](function(_0x40a406){_0x5e8955[_0x61e4('0x22')]=_0x40a406;if(_0x428c97['query'][_0x61e4('0x40')]){_0x1f8d83[_0x61e4('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x61e4('0x42')](_0x1f8d83);})[_0x61e4('0x29')](function(_0x13267d){_0x5e8955[_0x61e4('0x43')]=_0x13267d;return _0x5e8955;})[_0x61e4('0x29')](respondWithFilteredResult(_0x5727e8,_0x1f8d83))[_0x61e4('0x44')](handleError(_0x5727e8,null));};exports[_0x61e4('0x45')]=function(_0x36b70b,_0x20e818){var _0x4eb07b={'raw':!![],'where':{'id':_0x36b70b[_0x61e4('0x46')]['id']}},_0x58ef90={};_0x58ef90[_0x61e4('0x34')]=_[_0x61e4('0x47')](db[_0x61e4('0x2f')]['rawAttributes']);_0x58ef90[_0x61e4('0x35')]=_['keys'](_0x36b70b['query']);_0x58ef90['filters']=_['intersection'](_0x58ef90[_0x61e4('0x34')],_0x58ef90['query']);_0x4eb07b['attributes']=_[_0x61e4('0x38')](_0x58ef90[_0x61e4('0x34')],qs[_0x61e4('0x39')](_0x36b70b[_0x61e4('0x35')]['fields']));_0x4eb07b[_0x61e4('0x37')]=_0x4eb07b[_0x61e4('0x37')][_0x61e4('0x48')]?_0x4eb07b[_0x61e4('0x37')]:_0x58ef90[_0x61e4('0x34')];if(_0x36b70b['query'][_0x61e4('0x40')]){_0x4eb07b[_0x61e4('0x41')]=[{'all':!![]}];}_0x4eb07b=_[_0x61e4('0x3d')]({},_0x4eb07b,_0x36b70b[_0x61e4('0x3f')]);return db['MailSubstatus']['find'](_0x4eb07b)[_0x61e4('0x29')](handleEntityNotFound(_0x20e818,null))[_0x61e4('0x29')](respondWithResult(_0x20e818,null))[_0x61e4('0x44')](handleError(_0x20e818,null));};exports[_0x61e4('0x49')]=function(_0x53cfe1,_0x4c21a1){return db[_0x61e4('0x2f')][_0x61e4('0x49')](_0x53cfe1[_0x61e4('0x4a')],{})[_0x61e4('0x29')](respondWithResult(_0x4c21a1,0xc9))['catch'](handleError(_0x4c21a1,null));};exports[_0x61e4('0x27')]=function(_0x202d19,_0x5cd88c){if(_0x202d19[_0x61e4('0x4a')]['id']){delete _0x202d19['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x202d19['params']['id']}})[_0x61e4('0x29')](handleEntityNotFound(_0x5cd88c,null))[_0x61e4('0x29')](saveUpdates(_0x202d19['body'],null))[_0x61e4('0x29')](respondWithResult(_0x5cd88c,null))[_0x61e4('0x44')](handleError(_0x5cd88c,null));};exports['destroy']=function(_0x2a97bf,_0x3bf9a2){return db[_0x61e4('0x2f')]['find']({'where':{'id':_0x2a97bf[_0x61e4('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bf9a2,null))['then'](removeEntity(_0x3bf9a2,null))['catch'](handleError(_0x3bf9a2,null));};exports[_0x61e4('0x4b')]=function(_0x4d3a34,_0x23b0a2){return db[_0x61e4('0x2f')][_0x61e4('0x4b')]()[_0x61e4('0x29')](respondWithResult(_0x23b0a2,null))['catch'](handleError(_0x23b0a2,null));}; \ No newline at end of file +var _0xb310=['show','find','create','body','update','params','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb310,0x13b));var _0x0b31=function(_0x50dbe3,_0x2d9781){_0x50dbe3=_0x50dbe3-0x0;var _0x2f7f5c=_0xb310[_0x50dbe3];return _0x2f7f5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b31('0x0'));var zipdir=require(_0x0b31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b31('0x2'));var BPromise=require(_0x0b31('0x3'));var Mustache=require(_0x0b31('0x4'));var util=require(_0x0b31('0x5'));var path=require(_0x0b31('0x6'));var sox=require(_0x0b31('0x7'));var csv=require(_0x0b31('0x8'));var ejs=require(_0x0b31('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b31('0xa'));var squel=require(_0x0b31('0xb'));var crypto=require(_0x0b31('0xc'));var jsforce=require(_0x0b31('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b31('0x8'));var querystring=require(_0x0b31('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b31('0xf'));var qs=require(_0x0b31('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b31('0x11'));var logger=require(_0x0b31('0x12'))('api');var utils=require(_0x0b31('0x13'));var config=require(_0x0b31('0x14'));var licenseUtil=require(_0x0b31('0x15'));var db=require(_0x0b31('0x16'))['db'];function respondWithStatusCode(_0x5e1f13,_0x1eaaeb){_0x1eaaeb=_0x1eaaeb||0xcc;return function(_0x2a109c){if(_0x2a109c){return _0x5e1f13[_0x0b31('0x17')](_0x1eaaeb);}return _0x5e1f13[_0x0b31('0x18')](_0x1eaaeb)[_0x0b31('0x19')]();};}function respondWithResult(_0x248821,_0x50a667){_0x50a667=_0x50a667||0xc8;return function(_0x520548){if(_0x520548){return _0x248821[_0x0b31('0x18')](_0x50a667)['json'](_0x520548);}};}function respondWithFilteredResult(_0x5d0c7e,_0x220273){return function(_0xfa4498){if(_0xfa4498){var _0x25117d=typeof _0x220273[_0x0b31('0x1a')]===_0x0b31('0x1b')&&typeof _0x220273['limit']===_0x0b31('0x1b');var _0x5bd507=_0xfa4498[_0x0b31('0x1c')];var _0x5036ea=_0x25117d?0x0:_0x220273['offset'];var _0x139eaf=_0x25117d?_0xfa4498[_0x0b31('0x1c')]:_0x220273[_0x0b31('0x1a')]+_0x220273['limit'];var _0x4d80c6;if(_0x139eaf>=_0x5bd507){_0x139eaf=_0x5bd507;_0x4d80c6=0xc8;}else{_0x4d80c6=0xce;}_0x5d0c7e[_0x0b31('0x18')](_0x4d80c6);return _0x5d0c7e[_0x0b31('0x1d')](_0x0b31('0x1e'),_0x5036ea+'-'+_0x139eaf+'/'+_0x5bd507)[_0x0b31('0x1f')](_0xfa4498);}return null;};}function patchUpdates(_0x2208a8){return function(_0x4b8e0f){try{jsonpatch['apply'](_0x4b8e0f,_0x2208a8,!![]);}catch(_0x4bee69){return BPromise[_0x0b31('0x20')](_0x4bee69);}return _0x4b8e0f[_0x0b31('0x21')]();};}function saveUpdates(_0x180be1,_0x71a328){return function(_0x5d1b23){if(_0x5d1b23){return _0x5d1b23['update'](_0x180be1)[_0x0b31('0x22')](function(_0x5132bb){return _0x5132bb;});}return null;};}function removeEntity(_0x4a7f1d,_0x49b769){return function(_0x2ffa1c){if(_0x2ffa1c){return _0x2ffa1c[_0x0b31('0x23')]()[_0x0b31('0x22')](function(){_0x4a7f1d['status'](0xcc)[_0x0b31('0x19')]();});}};}function handleEntityNotFound(_0x5b4a32,_0x141184){return function(_0x394633){if(!_0x394633){_0x5b4a32[_0x0b31('0x17')](0x194);}return _0x394633;};}function handleError(_0x59dfc7,_0x212f66){_0x212f66=_0x212f66||0x1f4;return function(_0x27db05){logger[_0x0b31('0x24')](_0x27db05[_0x0b31('0x25')]);if(_0x27db05[_0x0b31('0x26')]){delete _0x27db05[_0x0b31('0x26')];}_0x59dfc7[_0x0b31('0x18')](_0x212f66)[_0x0b31('0x27')](_0x27db05);};}exports[_0x0b31('0x28')]=function(_0x18fb73,_0x877ff7){var _0xa2c15e={},_0x5c11c8={},_0x17b671={'count':0x0,'rows':[]};var _0x298209=_[_0x0b31('0x29')](db[_0x0b31('0x2a')][_0x0b31('0x2b')],function(_0x2fc1ec){return{'name':_0x2fc1ec[_0x0b31('0x2c')],'type':_0x2fc1ec[_0x0b31('0x2d')][_0x0b31('0x2e')]};});_0x5c11c8[_0x0b31('0x2f')]=_[_0x0b31('0x29')](_0x298209,_0x0b31('0x26'));_0x5c11c8[_0x0b31('0x30')]=_[_0x0b31('0x31')](_0x18fb73[_0x0b31('0x30')]);_0x5c11c8[_0x0b31('0x32')]=_['intersection'](_0x5c11c8[_0x0b31('0x2f')],_0x5c11c8[_0x0b31('0x30')]);_0xa2c15e[_0x0b31('0x33')]=_[_0x0b31('0x34')](_0x5c11c8[_0x0b31('0x2f')],qs[_0x0b31('0x35')](_0x18fb73['query'][_0x0b31('0x35')]));_0xa2c15e[_0x0b31('0x33')]=_0xa2c15e['attributes']['length']?_0xa2c15e[_0x0b31('0x33')]:_0x5c11c8['model'];if(!_0x18fb73[_0x0b31('0x30')][_0x0b31('0x36')](_0x0b31('0x37'))){_0xa2c15e['limit']=qs[_0x0b31('0x38')](_0x18fb73[_0x0b31('0x30')][_0x0b31('0x38')]);_0xa2c15e[_0x0b31('0x1a')]=qs[_0x0b31('0x1a')](_0x18fb73[_0x0b31('0x30')][_0x0b31('0x1a')]);}_0xa2c15e[_0x0b31('0x39')]=qs['sort'](_0x18fb73[_0x0b31('0x30')][_0x0b31('0x3a')]);_0xa2c15e[_0x0b31('0x3b')]=qs[_0x0b31('0x32')](_[_0x0b31('0x3c')](_0x18fb73[_0x0b31('0x30')],_0x5c11c8[_0x0b31('0x32')]),_0x298209);if(_0x18fb73[_0x0b31('0x30')]['filter']){_0xa2c15e[_0x0b31('0x3b')]=_['merge'](_0xa2c15e['where'],{'$or':_['map'](_0x298209,function(_0x3091f0){if(_0x3091f0[_0x0b31('0x2d')]!==_0x0b31('0x3d')){var _0x280bfc={};_0x280bfc[_0x3091f0[_0x0b31('0x26')]]={'$like':'%'+_0x18fb73[_0x0b31('0x30')][_0x0b31('0x3e')]+'%'};return _0x280bfc;}})});}_0xa2c15e=_[_0x0b31('0x3f')]({},_0xa2c15e,_0x18fb73[_0x0b31('0x40')]);var _0xb50377={'where':_0xa2c15e[_0x0b31('0x3b')]};return db[_0x0b31('0x2a')][_0x0b31('0x1c')](_0xb50377)['then'](function(_0x587012){_0x17b671[_0x0b31('0x1c')]=_0x587012;if(_0x18fb73[_0x0b31('0x30')][_0x0b31('0x41')]){_0xa2c15e[_0x0b31('0x42')]=[{'all':!![]}];}return db[_0x0b31('0x2a')][_0x0b31('0x43')](_0xa2c15e);})[_0x0b31('0x22')](function(_0x16f1f6){_0x17b671[_0x0b31('0x44')]=_0x16f1f6;return _0x17b671;})[_0x0b31('0x22')](respondWithFilteredResult(_0x877ff7,_0xa2c15e))[_0x0b31('0x45')](handleError(_0x877ff7,null));};exports[_0x0b31('0x46')]=function(_0x5a15de,_0x55b3c1){var _0x3e0747={'raw':!![],'where':{'id':_0x5a15de['params']['id']}},_0x1ab7ff={};_0x1ab7ff[_0x0b31('0x2f')]=_[_0x0b31('0x31')](db[_0x0b31('0x2a')]['rawAttributes']);_0x1ab7ff['query']=_['keys'](_0x5a15de[_0x0b31('0x30')]);_0x1ab7ff['filters']=_['intersection'](_0x1ab7ff[_0x0b31('0x2f')],_0x1ab7ff[_0x0b31('0x30')]);_0x3e0747[_0x0b31('0x33')]=_[_0x0b31('0x34')](_0x1ab7ff[_0x0b31('0x2f')],qs[_0x0b31('0x35')](_0x5a15de[_0x0b31('0x30')][_0x0b31('0x35')]));_0x3e0747[_0x0b31('0x33')]=_0x3e0747[_0x0b31('0x33')]['length']?_0x3e0747[_0x0b31('0x33')]:_0x1ab7ff[_0x0b31('0x2f')];if(_0x5a15de[_0x0b31('0x30')]['includeAll']){_0x3e0747[_0x0b31('0x42')]=[{'all':!![]}];}_0x3e0747=_[_0x0b31('0x3f')]({},_0x3e0747,_0x5a15de['options']);return db['MailSubstatus'][_0x0b31('0x47')](_0x3e0747)['then'](handleEntityNotFound(_0x55b3c1,null))['then'](respondWithResult(_0x55b3c1,null))[_0x0b31('0x45')](handleError(_0x55b3c1,null));};exports[_0x0b31('0x48')]=function(_0x3e48eb,_0x4d1891){return db[_0x0b31('0x2a')][_0x0b31('0x48')](_0x3e48eb[_0x0b31('0x49')],{})[_0x0b31('0x22')](respondWithResult(_0x4d1891,0xc9))[_0x0b31('0x45')](handleError(_0x4d1891,null));};exports[_0x0b31('0x4a')]=function(_0xf3bc7f,_0x4e4532){if(_0xf3bc7f[_0x0b31('0x49')]['id']){delete _0xf3bc7f['body']['id'];}return db[_0x0b31('0x2a')][_0x0b31('0x47')]({'where':{'id':_0xf3bc7f[_0x0b31('0x4b')]['id']}})[_0x0b31('0x22')](handleEntityNotFound(_0x4e4532,null))[_0x0b31('0x22')](saveUpdates(_0xf3bc7f[_0x0b31('0x49')],null))[_0x0b31('0x22')](respondWithResult(_0x4e4532,null))['catch'](handleError(_0x4e4532,null));};exports[_0x0b31('0x23')]=function(_0x52cdcd,_0x2885bb){return db[_0x0b31('0x2a')][_0x0b31('0x47')]({'where':{'id':_0x52cdcd[_0x0b31('0x4b')]['id']}})[_0x0b31('0x22')](handleEntityNotFound(_0x2885bb,null))[_0x0b31('0x22')](removeEntity(_0x2885bb,null))[_0x0b31('0x45')](handleError(_0x2885bb,null));};exports[_0x0b31('0x4c')]=function(_0x646eb8,_0x945a59){return db[_0x0b31('0x2a')][_0x0b31('0x4c')]()[_0x0b31('0x22')](respondWithResult(_0x945a59,null))[_0x0b31('0x45')](handleError(_0x945a59,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b31c49c..efaa9eb 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 _0x5dba=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x432b98,_0x44ca50){var _0x432d6e=function(_0x30ec4d){while(--_0x30ec4d){_0x432b98['push'](_0x432b98['shift']());}};_0x432d6e(++_0x44ca50);}(_0x5dba,0xa5));var _0xa5db=function(_0x30fde3,_0x69fd6){_0x30fde3=_0x30fde3-0x0;var _0x45703f=_0x5dba[_0x30fde3];return _0x45703f;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xa5db('0x0'))['db'][_0xa5db('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa5db('0x2')](0x0);var events={'afterUpdate':_0xa5db('0x3')};function emitEvent(_0x4276b6){return function(_0x1e15df,_0x99ee2b,_0x293db9){MailSubstatusEvents['emit'](_0x4276b6+':'+_0x1e15df['id'],_0x1e15df);MailSubstatusEvents[_0xa5db('0x4')](_0x4276b6,_0x1e15df);_0x293db9(null);};}for(var e in events){if(events[_0xa5db('0x5')](e)){var event=events[e];MailSubstatus[_0xa5db('0x6')](e,emitEvent(event));}}module[_0xa5db('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xbcbd=['setMaxListeners','emit','hasOwnProperty','exports','events','MailSubstatus'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xbcbd,0x15a));var _0xdbcb=function(_0x5654ef,_0x1ddf03){_0x5654ef=_0x5654ef-0x0;var _0x40fee1=_0xbcbd[_0x5654ef];return _0x40fee1;};'use strict';var EventEmitter=require(_0xdbcb('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xdbcb('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xdbcb('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x2bfe87){return function(_0x4e2c74,_0x2d2a04,_0x589847){MailSubstatusEvents[_0xdbcb('0x3')](_0x2bfe87+':'+_0x4e2c74['id'],_0x4e2c74);MailSubstatusEvents['emit'](_0x2bfe87,_0x4e2c74);_0x589847(null);};}for(var e in events){if(events[_0xdbcb('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xdbcb('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 00a767d..fc9abb3 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 _0x950b=['./mailSubstatus.attributes','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','then','catch'];(function(_0x163d7e,_0x486a8b){var _0x54e389=function(_0xed9b2){while(--_0xed9b2){_0x163d7e['push'](_0x163d7e['shift']());}};_0x54e389(++_0x486a8b);}(_0x950b,0xd8));var _0xb950=function(_0x4c6e4a,_0x263ab8){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3d69f4=_0x950b[_0x4c6e4a];return _0x3d69f4;};'use strict';var attributes=require(_0xb950('0x0'));module['exports']=function(_0x30afbb){var _0x2d1af5=_0x30afbb['models'];return _0x30afbb['define'](_0xb950('0x1'),attributes,{'tableName':_0xb950('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1269f0,_0x3e712b,_0x113021){return _0x2d1af5[_0xb950('0x3')][_0xb950('0x4')]({'value':_0x1269f0['name']},{'where':{'field':_0xb950('0x5'),'value':_0x1269f0['_previousDataValues']['name']}})[_0xb950('0x6')](function(){_0x113021();})[_0xb950('0x7')](function(_0x169eed){_0x113021(_0x169eed);});}}});}; \ No newline at end of file +var _0x45ca=['define','MailSubstatus','Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x218945,_0x528b02){var _0x2c5189=function(_0x38531c){while(--_0x38531c){_0x218945['push'](_0x218945['shift']());}};_0x2c5189(++_0x528b02);}(_0x45ca,0xfa));var _0xa45c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x45ca[_0xa464c9];return _0x3d73c4;};'use strict';var attributes=require(_0xa45c('0x0'));module[_0xa45c('0x1')]=function(_0x239e73){var _0xa2ec0d=_0x239e73[_0xa45c('0x2')];return _0x239e73[_0xa45c('0x3')](_0xa45c('0x4'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x34689d,_0x4d4b81,_0x4af781){return _0xa2ec0d[_0xa45c('0x5')]['update']({'value':_0x34689d[_0xa45c('0x6')]},{'where':{'field':_0xa45c('0x7'),'value':_0x34689d[_0xa45c('0x8')][_0xa45c('0x6')]}})[_0xa45c('0x9')](function(){_0x4af781();})[_0xa45c('0xa')](function(_0x1c3616){_0x4af781(_0x1c3616);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e9af0ff..9275f1a 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 _0x7127=['ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x4ecce9,_0x40c76b){var _0x40b946=function(_0x3f5dab){while(--_0x3f5dab){_0x4ecce9['push'](_0x4ecce9['shift']());}};_0x40b946(++_0x40c76b);}(_0x7127,0xe2));var _0x7712=function(_0x35f727,_0x5d7bce){_0x35f727=_0x35f727-0x0;var _0x214043=_0x7127[_0x35f727];return _0x214043;};'use strict';var _=require(_0x7712('0x0'));var util=require(_0x7712('0x1'));var moment=require(_0x7712('0x2'));var BPromise=require(_0x7712('0x3'));var rs=require(_0x7712('0x4'));var fs=require('fs');var Redis=require(_0x7712('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7712('0x6'))(_0x7712('0x7'));var config=require(_0x7712('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7712('0x9')][_0x7712('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465038,_0x1c4f16,_0x55f393){return new BPromise(function(_0x5cfc93,_0x582518){return client['request'](_0x465038,_0x55f393)[_0x7712('0xb')](function(_0x4d1410){logger[_0x7712('0xc')](_0x7712('0xd'),_0x1c4f16,_0x7712('0xe'));logger['debug'](_0x7712('0xf'),_0x1c4f16,'request\x20sent',JSON[_0x7712('0x10')](_0x4d1410));if(_0x4d1410[_0x7712('0x11')]){if(_0x4d1410['error'][_0x7712('0x12')]===0x1f4){logger[_0x7712('0x11')](_0x7712('0xd'),_0x1c4f16,_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);return _0x582518(_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);}logger[_0x7712('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1c4f16,_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);return _0x5cfc93(_0x4d1410[_0x7712('0x11')]['message']);}else{logger[_0x7712('0xc')](_0x7712('0xd'),_0x1c4f16,'request\x20sent');_0x5cfc93(_0x4d1410[_0x7712('0x14')][_0x7712('0x13')]);}})['catch'](function(_0x4c12d8){logger[_0x7712('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1c4f16,_0x4c12d8);_0x582518(_0x4c12d8);});});} \ No newline at end of file +var _0x13d3=['error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48bab2,_0x4f3b53){var _0xf41d3c=function(_0x57fecc){while(--_0x57fecc){_0x48bab2['push'](_0x48bab2['shift']());}};_0xf41d3c(++_0x4f3b53);}(_0x13d3,0x88));var _0x313d=function(_0x5ea81c,_0x382138){_0x5ea81c=_0x5ea81c-0x0;var _0x59ee6c=_0x13d3[_0x5ea81c];return _0x59ee6c;};'use strict';var _=require(_0x313d('0x0'));var util=require('util');var moment=require(_0x313d('0x1'));var BPromise=require(_0x313d('0x2'));var rs=require(_0x313d('0x3'));var fs=require('fs');var Redis=require(_0x313d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x313d('0x5'));var logger=require(_0x313d('0x6'))(_0x313d('0x7'));var config=require(_0x313d('0x8'));var jayson=require(_0x313d('0x9'));var client=jayson[_0x313d('0xa')][_0x313d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5e97,_0x47c9fe,_0x164d31){return new BPromise(function(_0x58e43a,_0x529644){return client[_0x313d('0xc')](_0x5b5e97,_0x164d31)['then'](function(_0x3b3b57){logger['info'](_0x313d('0xd'),_0x47c9fe,_0x313d('0xe'));logger[_0x313d('0xf')](_0x313d('0x10'),_0x47c9fe,_0x313d('0xe'),JSON[_0x313d('0x11')](_0x3b3b57));if(_0x3b3b57['error']){if(_0x3b3b57[_0x313d('0x12')]['code']===0x1f4){logger[_0x313d('0x12')](_0x313d('0xd'),_0x47c9fe,_0x3b3b57[_0x313d('0x12')][_0x313d('0x13')]);return _0x529644(_0x3b3b57[_0x313d('0x12')][_0x313d('0x13')]);}logger[_0x313d('0x12')](_0x313d('0xd'),_0x47c9fe,_0x3b3b57[_0x313d('0x12')]['message']);return _0x58e43a(_0x3b3b57[_0x313d('0x12')][_0x313d('0x13')]);}else{logger[_0x313d('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x47c9fe,_0x313d('0xe'));_0x58e43a(_0x3b3b57['result'][_0x313d('0x13')]);}})[_0x313d('0x15')](function(_0x58d623){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x47c9fe,_0x58d623);_0x529644(_0x58d623);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 146e4be..5bc0c42 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 _0x7e88=['show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id'];(function(_0x524aa8,_0x377769){var _0x416e5b=function(_0x307fe6){while(--_0x307fe6){_0x524aa8['push'](_0x524aa8['shift']());}};_0x416e5b(++_0x377769);}(_0x7e88,0x1d3));var _0x87e8=function(_0x54e291,_0x1a621a){_0x54e291=_0x54e291-0x0;var _0x3ca642=_0x7e88[_0x54e291];return _0x3ca642;};'use strict';var multer=require('multer');var util=require(_0x87e8('0x0'));var path=require('path');var timeout=require(_0x87e8('0x1'));var express=require(_0x87e8('0x2'));var router=express[_0x87e8('0x3')]();var fs_extra=require(_0x87e8('0x4'));var auth=require(_0x87e8('0x5'));var interaction=require(_0x87e8('0x6'));var config=require(_0x87e8('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0x9')]);router[_0x87e8('0xa')](_0x87e8('0xb'),auth[_0x87e8('0x8')](),controller['describe']);router[_0x87e8('0xa')](_0x87e8('0xc'),auth[_0x87e8('0x8')](),controller[_0x87e8('0xd')]);router[_0x87e8('0xe')]('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0xf')]);router[_0x87e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x87e8('0x11')]);router[_0x87e8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x87e8('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcb44=['./mailTransferReport.controller','isAuthenticated','index','describe','get','show','create','put','/:id','update','delete','destroy','exports','express','Router','fs-extra','../../config/environment'];(function(_0x577c1e,_0x486bd6){var _0x525ee5=function(_0x47547a){while(--_0x47547a){_0x577c1e['push'](_0x577c1e['shift']());}};_0x525ee5(++_0x486bd6);}(_0xcb44,0xa6));var _0x4cb4=function(_0x103be5,_0xe24819){_0x103be5=_0x103be5-0x0;var _0x306562=_0xcb44[_0x103be5];return _0x306562;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cb4('0x0'));var router=express[_0x4cb4('0x1')]();var fs_extra=require(_0x4cb4('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cb4('0x3'));var controller=require(_0x4cb4('0x4'));router['get']('/',auth[_0x4cb4('0x5')](),controller[_0x4cb4('0x6')]);router['get']('/describe',auth[_0x4cb4('0x5')](),controller[_0x4cb4('0x7')]);router[_0x4cb4('0x8')]('/:id',auth[_0x4cb4('0x5')](),controller[_0x4cb4('0x9')]);router['post']('/',auth[_0x4cb4('0x5')](),controller[_0x4cb4('0xa')]);router[_0x4cb4('0xb')](_0x4cb4('0xc'),auth['isAuthenticated'](),controller[_0x4cb4('0xd')]);router[_0x4cb4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4cb4('0xf')]);module[_0x4cb4('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c439c01..f2686d0 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x238e3c,_0x40ed5f){var _0x44a1eb=function(_0x4be14a){while(--_0x4be14a){_0x238e3c['push'](_0x238e3c['shift']());}};_0x44a1eb(++_0x40ed5f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x252385,_0x4407eb){_0x252385=_0x252385-0x0;var _0x480fb0=_0xf4eb[_0x252385];return _0x480fb0;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5ae93e,_0xe60fbe){var _0xe288cf=function(_0x12d712){while(--_0x12d712){_0x5ae93e['push'](_0x5ae93e['shift']());}};_0xe288cf(++_0xe60fbe);}(_0xedd9,0xfc));var _0x9edd=function(_0x31e57b,_0x4332b7){_0x31e57b=_0x31e57b-0x0;var _0x2f05d0=_0xedd9[_0x31e57b];return _0x2f05d0;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 132deab..d69b75c 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 _0x0b15=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','MailTransferReport','includeAll','rows','catch','params','keys','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x24e2cb,_0x2bc739){var _0x489bd9=function(_0x1a0949){while(--_0x1a0949){_0x24e2cb['push'](_0x24e2cb['shift']());}};_0x489bd9(++_0x2bc739);}(_0x0b15,0x87));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50b1('0x0'));var zipdir=require(_0x50b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50b1('0x2'));var moment=require(_0x50b1('0x3'));var BPromise=require(_0x50b1('0x4'));var Mustache=require(_0x50b1('0x5'));var util=require(_0x50b1('0x6'));var path=require(_0x50b1('0x7'));var sox=require('sox');var csv=require(_0x50b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50b1('0x9'));var _=require(_0x50b1('0xa'));var squel=require(_0x50b1('0xb'));var crypto=require(_0x50b1('0xc'));var jsforce=require(_0x50b1('0xd'));var deskjs=require(_0x50b1('0xe'));var toCsv=require(_0x50b1('0x8'));var querystring=require(_0x50b1('0xf'));var Papa=require(_0x50b1('0x10'));var Redis=require('ioredis');var authService=require(_0x50b1('0x11'));var qs=require(_0x50b1('0x12'));var as=require(_0x50b1('0x13'));var hardwareService=require(_0x50b1('0x14'));var logger=require('../../config/logger')(_0x50b1('0x15'));var utils=require(_0x50b1('0x16'));var config=require(_0x50b1('0x17'));var licenseUtil=require(_0x50b1('0x18'));var db=require(_0x50b1('0x19'))['db'];function respondWithStatusCode(_0x44a590,_0x1f79de){_0x1f79de=_0x1f79de||0xcc;return function(_0x35da98){if(_0x35da98){return _0x44a590[_0x50b1('0x1a')](_0x1f79de);}return _0x44a590[_0x50b1('0x1b')](_0x1f79de)[_0x50b1('0x1c')]();};}function respondWithResult(_0x38be00,_0x179c59){_0x179c59=_0x179c59||0xc8;return function(_0x4a4017){if(_0x4a4017){return _0x38be00[_0x50b1('0x1b')](_0x179c59)['json'](_0x4a4017);}};}function respondWithFilteredResult(_0x1eeca2,_0xa90bef){return function(_0x279c84){if(_0x279c84){var _0x12ccac=typeof _0xa90bef[_0x50b1('0x1d')]===_0x50b1('0x1e')&&typeof _0xa90bef['limit']===_0x50b1('0x1e');var _0x5d3c76=_0x279c84[_0x50b1('0x1f')];var _0x4d34ee=_0x12ccac?0x0:_0xa90bef[_0x50b1('0x1d')];var _0x3e8ea2=_0x12ccac?_0x279c84[_0x50b1('0x1f')]:_0xa90bef[_0x50b1('0x1d')]+_0xa90bef['limit'];var _0x19d72a;if(_0x3e8ea2>=_0x5d3c76){_0x3e8ea2=_0x5d3c76;_0x19d72a=0xc8;}else{_0x19d72a=0xce;}_0x1eeca2[_0x50b1('0x1b')](_0x19d72a);return _0x1eeca2[_0x50b1('0x20')]('Content-Range',_0x4d34ee+'-'+_0x3e8ea2+'/'+_0x5d3c76)['json'](_0x279c84);}return null;};}function patchUpdates(_0x56a786){return function(_0x151a5f){try{jsonpatch[_0x50b1('0x21')](_0x151a5f,_0x56a786,!![]);}catch(_0x3b8761){return BPromise['reject'](_0x3b8761);}return _0x151a5f[_0x50b1('0x22')]();};}function saveUpdates(_0x3f6d69,_0x109716){return function(_0x10ac0e){if(_0x10ac0e){return _0x10ac0e[_0x50b1('0x23')](_0x3f6d69)[_0x50b1('0x24')](function(_0x140f7e){return _0x140f7e;});}return null;};}function removeEntity(_0x1c394b,_0x36a8b3){return function(_0x294052){if(_0x294052){return _0x294052[_0x50b1('0x25')]()[_0x50b1('0x24')](function(){_0x1c394b[_0x50b1('0x1b')](0xcc)[_0x50b1('0x1c')]();});}};}function handleEntityNotFound(_0xdee631,_0x3d39c4){return function(_0x4391c2){if(!_0x4391c2){_0xdee631[_0x50b1('0x1a')](0x194);}return _0x4391c2;};}function handleError(_0x261f5d,_0x52f9df){_0x52f9df=_0x52f9df||0x1f4;return function(_0x4bb96f){logger[_0x50b1('0x26')](_0x4bb96f[_0x50b1('0x27')]);if(_0x4bb96f[_0x50b1('0x28')]){delete _0x4bb96f[_0x50b1('0x28')];}_0x261f5d['status'](_0x52f9df)[_0x50b1('0x29')](_0x4bb96f);};}exports[_0x50b1('0x2a')]=function(_0x5b986c,_0x2dfd3f){var _0x5b53c7={},_0x2a609c={},_0x123f5d={'count':0x0,'rows':[]};var _0xdd531=_[_0x50b1('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x17e66d){return{'name':_0x17e66d[_0x50b1('0x2c')],'type':_0x17e66d[_0x50b1('0x2d')]['key']};});_0x2a609c[_0x50b1('0x2e')]=_[_0x50b1('0x2b')](_0xdd531,_0x50b1('0x28'));_0x2a609c[_0x50b1('0x2f')]=_['keys'](_0x5b986c[_0x50b1('0x2f')]);_0x2a609c[_0x50b1('0x30')]=_[_0x50b1('0x31')](_0x2a609c[_0x50b1('0x2e')],_0x2a609c[_0x50b1('0x2f')]);_0x5b53c7['attributes']=_[_0x50b1('0x31')](_0x2a609c[_0x50b1('0x2e')],qs['fields'](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x32')]));_0x5b53c7[_0x50b1('0x33')]=_0x5b53c7[_0x50b1('0x33')][_0x50b1('0x34')]?_0x5b53c7['attributes']:_0x2a609c['model'];if(!_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x35')](_0x50b1('0x36'))){_0x5b53c7['limit']=qs[_0x50b1('0x37')](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x37')]);_0x5b53c7[_0x50b1('0x1d')]=qs[_0x50b1('0x1d')](_0x5b986c[_0x50b1('0x2f')]['offset']);}_0x5b53c7['order']=qs[_0x50b1('0x38')](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x38')]);_0x5b53c7[_0x50b1('0x39')]=qs[_0x50b1('0x30')](_['pick'](_0x5b986c[_0x50b1('0x2f')],_0x2a609c[_0x50b1('0x30')]),_0xdd531);if(_0x5b986c['query'][_0x50b1('0x3a')]){_0x5b53c7['where']=_['merge'](_0x5b53c7['where'],{'$or':_[_0x50b1('0x2b')](_0xdd531,function(_0x28947c){if(_0x28947c[_0x50b1('0x2d')]!=='VIRTUAL'){var _0x1e4053={};_0x1e4053[_0x28947c[_0x50b1('0x28')]]={'$like':'%'+_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x3a')]+'%'};return _0x1e4053;}})});}_0x5b53c7=_[_0x50b1('0x3b')]({},_0x5b53c7,_0x5b986c[_0x50b1('0x3c')]);var _0x3ecd5a={'where':_0x5b53c7['where']};return db[_0x50b1('0x3d')][_0x50b1('0x1f')](_0x3ecd5a)['then'](function(_0x199304){_0x123f5d[_0x50b1('0x1f')]=_0x199304;if(_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x3e')]){_0x5b53c7['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x5b53c7);})[_0x50b1('0x24')](function(_0x16948a){_0x123f5d[_0x50b1('0x3f')]=_0x16948a;return _0x123f5d;})[_0x50b1('0x24')](respondWithFilteredResult(_0x2dfd3f,_0x5b53c7))[_0x50b1('0x40')](handleError(_0x2dfd3f,null));};exports['show']=function(_0xccb8b7,_0x13f106){var _0x5ef46a={'raw':!![],'where':{'id':_0xccb8b7[_0x50b1('0x41')]['id']}},_0x3c9d11={};_0x3c9d11[_0x50b1('0x2e')]=_[_0x50b1('0x42')](db[_0x50b1('0x3d')][_0x50b1('0x43')]);_0x3c9d11['query']=_[_0x50b1('0x42')](_0xccb8b7[_0x50b1('0x2f')]);_0x3c9d11[_0x50b1('0x30')]=_[_0x50b1('0x31')](_0x3c9d11[_0x50b1('0x2e')],_0x3c9d11[_0x50b1('0x2f')]);_0x5ef46a['attributes']=_['intersection'](_0x3c9d11[_0x50b1('0x2e')],qs[_0x50b1('0x32')](_0xccb8b7[_0x50b1('0x2f')][_0x50b1('0x32')]));_0x5ef46a[_0x50b1('0x33')]=_0x5ef46a['attributes'][_0x50b1('0x34')]?_0x5ef46a[_0x50b1('0x33')]:_0x3c9d11[_0x50b1('0x2e')];if(_0xccb8b7[_0x50b1('0x2f')][_0x50b1('0x3e')]){_0x5ef46a[_0x50b1('0x44')]=[{'all':!![]}];}_0x5ef46a=_[_0x50b1('0x3b')]({},_0x5ef46a,_0xccb8b7[_0x50b1('0x3c')]);return db[_0x50b1('0x3d')][_0x50b1('0x45')](_0x5ef46a)[_0x50b1('0x24')](handleEntityNotFound(_0x13f106,null))['then'](respondWithResult(_0x13f106,null))[_0x50b1('0x40')](handleError(_0x13f106,null));};exports['create']=function(_0x570f42,_0x258971){return db[_0x50b1('0x3d')][_0x50b1('0x46')](_0x570f42[_0x50b1('0x47')],{})[_0x50b1('0x24')](respondWithResult(_0x258971,0xc9))[_0x50b1('0x40')](handleError(_0x258971,null));};exports[_0x50b1('0x23')]=function(_0x1f7e13,_0x3a8632){if(_0x1f7e13['body']['id']){delete _0x1f7e13[_0x50b1('0x47')]['id'];}return db[_0x50b1('0x3d')]['find']({'where':{'id':_0x1f7e13[_0x50b1('0x41')]['id']}})[_0x50b1('0x24')](handleEntityNotFound(_0x3a8632,null))[_0x50b1('0x24')](saveUpdates(_0x1f7e13[_0x50b1('0x47')],null))[_0x50b1('0x24')](respondWithResult(_0x3a8632,null))[_0x50b1('0x40')](handleError(_0x3a8632,null));};exports['destroy']=function(_0x2f434c,_0x272c43){return db[_0x50b1('0x3d')][_0x50b1('0x45')]({'where':{'id':_0x2f434c[_0x50b1('0x41')]['id']}})[_0x50b1('0x24')](handleEntityNotFound(_0x272c43,null))[_0x50b1('0x24')](removeEntity(_0x272c43,null))['catch'](handleError(_0x272c43,null));};exports[_0x50b1('0x48')]=function(_0x5b8248,_0x4f7416){return db[_0x50b1('0x3d')]['describe']()['then'](respondWithResult(_0x4f7416,null))[_0x50b1('0x40')](handleError(_0x4f7416,null));}; \ No newline at end of file +var _0x9f15=['rows','params','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f15,0x11b));var _0x59f1=function(_0x66808a,_0x60f3bd){_0x66808a=_0x66808a-0x0;var _0x760006=_0x9f15[_0x66808a];return _0x760006;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59f1('0x0'));var zipdir=require(_0x59f1('0x1'));var jsonpatch=require(_0x59f1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x59f1('0x3'));var Mustache=require('mustache');var util=require(_0x59f1('0x4'));var path=require('path');var sox=require(_0x59f1('0x5'));var csv=require(_0x59f1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x59f1('0x7'));var _=require(_0x59f1('0x8'));var squel=require(_0x59f1('0x9'));var crypto=require(_0x59f1('0xa'));var jsforce=require(_0x59f1('0xb'));var deskjs=require(_0x59f1('0xc'));var toCsv=require(_0x59f1('0x6'));var querystring=require(_0x59f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x59f1('0xe'));var authService=require(_0x59f1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59f1('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x59f1('0x11'));var licenseUtil=require(_0x59f1('0x12'));var db=require(_0x59f1('0x13'))['db'];function respondWithStatusCode(_0xda3477,_0x3bd71d){_0x3bd71d=_0x3bd71d||0xcc;return function(_0x479e84){if(_0x479e84){return _0xda3477[_0x59f1('0x14')](_0x3bd71d);}return _0xda3477[_0x59f1('0x15')](_0x3bd71d)[_0x59f1('0x16')]();};}function respondWithResult(_0x2fa2e5,_0x529457){_0x529457=_0x529457||0xc8;return function(_0x3ae7c5){if(_0x3ae7c5){return _0x2fa2e5[_0x59f1('0x15')](_0x529457)[_0x59f1('0x17')](_0x3ae7c5);}};}function respondWithFilteredResult(_0x5b4964,_0x49d791){return function(_0x1de5ec){if(_0x1de5ec){var _0x5b29a2=typeof _0x49d791['offset']===_0x59f1('0x18')&&typeof _0x49d791[_0x59f1('0x19')]===_0x59f1('0x18');var _0x35472e=_0x1de5ec['count'];var _0x15bc49=_0x5b29a2?0x0:_0x49d791[_0x59f1('0x1a')];var _0x487743=_0x5b29a2?_0x1de5ec['count']:_0x49d791['offset']+_0x49d791[_0x59f1('0x19')];var _0x332563;if(_0x487743>=_0x35472e){_0x487743=_0x35472e;_0x332563=0xc8;}else{_0x332563=0xce;}_0x5b4964['status'](_0x332563);return _0x5b4964['set']('Content-Range',_0x15bc49+'-'+_0x487743+'/'+_0x35472e)[_0x59f1('0x17')](_0x1de5ec);}return null;};}function patchUpdates(_0x5d2bfb){return function(_0x127627){try{jsonpatch[_0x59f1('0x1b')](_0x127627,_0x5d2bfb,!![]);}catch(_0x2c5113){return BPromise[_0x59f1('0x1c')](_0x2c5113);}return _0x127627[_0x59f1('0x1d')]();};}function saveUpdates(_0x2f742c,_0x24917b){return function(_0x2233a1){if(_0x2233a1){return _0x2233a1[_0x59f1('0x1e')](_0x2f742c)[_0x59f1('0x1f')](function(_0xff59ec){return _0xff59ec;});}return null;};}function removeEntity(_0x449881,_0x352ff3){return function(_0x4c1f06){if(_0x4c1f06){return _0x4c1f06[_0x59f1('0x20')]()[_0x59f1('0x1f')](function(){_0x449881[_0x59f1('0x15')](0xcc)[_0x59f1('0x16')]();});}};}function handleEntityNotFound(_0x11d62a,_0x5beb87){return function(_0x3081df){if(!_0x3081df){_0x11d62a['sendStatus'](0x194);}return _0x3081df;};}function handleError(_0x45e82d,_0x5923ff){_0x5923ff=_0x5923ff||0x1f4;return function(_0x4e268e){logger[_0x59f1('0x21')](_0x4e268e['stack']);if(_0x4e268e[_0x59f1('0x22')]){delete _0x4e268e[_0x59f1('0x22')];}_0x45e82d[_0x59f1('0x15')](_0x5923ff)['send'](_0x4e268e);};}exports[_0x59f1('0x23')]=function(_0x44d28d,_0x970624){var _0x1754db={},_0x5180d5={},_0x277e93={'count':0x0,'rows':[]};var _0x372ca9=_[_0x59f1('0x24')](db[_0x59f1('0x25')][_0x59f1('0x26')],function(_0x67f39e){return{'name':_0x67f39e[_0x59f1('0x27')],'type':_0x67f39e[_0x59f1('0x28')][_0x59f1('0x29')]};});_0x5180d5[_0x59f1('0x2a')]=_[_0x59f1('0x24')](_0x372ca9,'name');_0x5180d5['query']=_[_0x59f1('0x2b')](_0x44d28d['query']);_0x5180d5[_0x59f1('0x2c')]=_[_0x59f1('0x2d')](_0x5180d5[_0x59f1('0x2a')],_0x5180d5[_0x59f1('0x2e')]);_0x1754db[_0x59f1('0x2f')]=_['intersection'](_0x5180d5['model'],qs['fields'](_0x44d28d[_0x59f1('0x2e')][_0x59f1('0x30')]));_0x1754db[_0x59f1('0x2f')]=_0x1754db[_0x59f1('0x2f')][_0x59f1('0x31')]?_0x1754db[_0x59f1('0x2f')]:_0x5180d5[_0x59f1('0x2a')];if(!_0x44d28d['query']['hasOwnProperty'](_0x59f1('0x32'))){_0x1754db[_0x59f1('0x19')]=qs[_0x59f1('0x19')](_0x44d28d['query'][_0x59f1('0x19')]);_0x1754db[_0x59f1('0x1a')]=qs['offset'](_0x44d28d['query'][_0x59f1('0x1a')]);}_0x1754db[_0x59f1('0x33')]=qs[_0x59f1('0x34')](_0x44d28d[_0x59f1('0x2e')][_0x59f1('0x34')]);_0x1754db[_0x59f1('0x35')]=qs[_0x59f1('0x2c')](_[_0x59f1('0x36')](_0x44d28d[_0x59f1('0x2e')],_0x5180d5[_0x59f1('0x2c')]),_0x372ca9);if(_0x44d28d['query'][_0x59f1('0x37')]){_0x1754db[_0x59f1('0x35')]=_['merge'](_0x1754db[_0x59f1('0x35')],{'$or':_[_0x59f1('0x24')](_0x372ca9,function(_0x4418a0){if(_0x4418a0['type']!==_0x59f1('0x38')){var _0x564d3c={};_0x564d3c[_0x4418a0[_0x59f1('0x22')]]={'$like':'%'+_0x44d28d[_0x59f1('0x2e')]['filter']+'%'};return _0x564d3c;}})});}_0x1754db=_[_0x59f1('0x39')]({},_0x1754db,_0x44d28d[_0x59f1('0x3a')]);var _0x58772f={'where':_0x1754db[_0x59f1('0x35')]};return db[_0x59f1('0x25')][_0x59f1('0x3b')](_0x58772f)['then'](function(_0x687398){_0x277e93[_0x59f1('0x3b')]=_0x687398;if(_0x44d28d[_0x59f1('0x2e')][_0x59f1('0x3c')]){_0x1754db['include']=[{'all':!![]}];}return db[_0x59f1('0x25')][_0x59f1('0x3d')](_0x1754db);})[_0x59f1('0x1f')](function(_0x1c91e1){_0x277e93[_0x59f1('0x3e')]=_0x1c91e1;return _0x277e93;})['then'](respondWithFilteredResult(_0x970624,_0x1754db))['catch'](handleError(_0x970624,null));};exports['show']=function(_0x4f04e3,_0x53a8b4){var _0x4fc0c5={'raw':!![],'where':{'id':_0x4f04e3[_0x59f1('0x3f')]['id']}},_0x5c43b4={};_0x5c43b4[_0x59f1('0x2a')]=_[_0x59f1('0x2b')](db[_0x59f1('0x25')]['rawAttributes']);_0x5c43b4[_0x59f1('0x2e')]=_['keys'](_0x4f04e3[_0x59f1('0x2e')]);_0x5c43b4[_0x59f1('0x2c')]=_[_0x59f1('0x2d')](_0x5c43b4[_0x59f1('0x2a')],_0x5c43b4[_0x59f1('0x2e')]);_0x4fc0c5[_0x59f1('0x2f')]=_['intersection'](_0x5c43b4[_0x59f1('0x2a')],qs['fields'](_0x4f04e3[_0x59f1('0x2e')][_0x59f1('0x30')]));_0x4fc0c5[_0x59f1('0x2f')]=_0x4fc0c5['attributes'][_0x59f1('0x31')]?_0x4fc0c5['attributes']:_0x5c43b4[_0x59f1('0x2a')];if(_0x4f04e3['query'][_0x59f1('0x3c')]){_0x4fc0c5['include']=[{'all':!![]}];}_0x4fc0c5=_[_0x59f1('0x39')]({},_0x4fc0c5,_0x4f04e3[_0x59f1('0x3a')]);return db['MailTransferReport'][_0x59f1('0x40')](_0x4fc0c5)[_0x59f1('0x1f')](handleEntityNotFound(_0x53a8b4,null))[_0x59f1('0x1f')](respondWithResult(_0x53a8b4,null))['catch'](handleError(_0x53a8b4,null));};exports[_0x59f1('0x41')]=function(_0x329f70,_0x51af46){return db[_0x59f1('0x25')][_0x59f1('0x41')](_0x329f70['body'],{})['then'](respondWithResult(_0x51af46,0xc9))[_0x59f1('0x42')](handleError(_0x51af46,null));};exports[_0x59f1('0x1e')]=function(_0x562a01,_0x35414b){if(_0x562a01[_0x59f1('0x43')]['id']){delete _0x562a01[_0x59f1('0x43')]['id'];}return db[_0x59f1('0x25')][_0x59f1('0x40')]({'where':{'id':_0x562a01[_0x59f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35414b,null))['then'](saveUpdates(_0x562a01[_0x59f1('0x43')],null))['then'](respondWithResult(_0x35414b,null))[_0x59f1('0x42')](handleError(_0x35414b,null));};exports[_0x59f1('0x20')]=function(_0x4a4947,_0x54a8e8){return db['MailTransferReport'][_0x59f1('0x40')]({'where':{'id':_0x4a4947['params']['id']}})[_0x59f1('0x1f')](handleEntityNotFound(_0x54a8e8,null))[_0x59f1('0x1f')](removeEntity(_0x54a8e8,null))['catch'](handleError(_0x54a8e8,null));};exports[_0x59f1('0x44')]=function(_0x1d89c2,_0x3aa415){return db['MailTransferReport'][_0x59f1('0x44')]()[_0x59f1('0x1f')](respondWithResult(_0x3aa415,null))[_0x59f1('0x42')](handleError(_0x3aa415,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3383a12..06b23ba 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 _0x757c=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46d995,_0x9b24ed){var _0x21202f=function(_0xab0f9c){while(--_0xab0f9c){_0x46d995['push'](_0x46d995['shift']());}};_0x21202f(++_0x9b24ed);}(_0x757c,0xc9));var _0xc757=function(_0x5aaac3,_0x5c5a75){_0x5aaac3=_0x5aaac3-0x0;var _0x2f9a6e=_0x757c[_0x5aaac3];return _0x2f9a6e;};'use strict';var _=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var logger=require('../../config/logger')(_0xc757('0x2'));var moment=require(_0xc757('0x3'));var BPromise=require(_0xc757('0x4'));var rp=require(_0xc757('0x5'));var fs=require('fs');var path=require(_0xc757('0x6'));var rimraf=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var attributes=require(_0xc757('0x9'));module[_0xc757('0xa')]=function(_0x29cb3a,_0x4f15ef){return _0x29cb3a[_0xc757('0xb')](_0xc757('0xc'),attributes,{'tableName':_0xc757('0xd'),'paranoid':![],'indexes':[{'name':_0xc757('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa37e=['uniqueid','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x244746,_0x383619){var _0x1e479d=function(_0x4db899){while(--_0x4db899){_0x244746['push'](_0x244746['shift']());}};_0x1e479d(++_0x383619);}(_0xa37e,0x97));var _0xea37=function(_0x4c86c6,_0x164122){_0x4c86c6=_0x4c86c6-0x0;var _0x269698=_0xa37e[_0x4c86c6];return _0x269698;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xea37('0x9'),'fields':[_0xea37('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c25ea1e..7fbd3fe 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 _0xad0f=['then','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xad0f,0xfb));var _0xfad0=function(_0x57dc85,_0x3a6d51){_0x57dc85=_0x57dc85-0x0;var _0x563a2e=_0xad0f[_0x57dc85];return _0x563a2e;};'use strict';var _=require(_0xfad0('0x0'));var util=require('util');var moment=require(_0xfad0('0x1'));var BPromise=require('bluebird');var rs=require(_0xfad0('0x2'));var fs=require('fs');var Redis=require(_0xfad0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfad0('0x4'))(_0xfad0('0x5'));var config=require(_0xfad0('0x6'));var jayson=require(_0xfad0('0x7'));var client=jayson[_0xfad0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ece52,_0x16a9a3,_0x3654ba){return new BPromise(function(_0x25a81c,_0x3224f1){return client['request'](_0x4ece52,_0x3654ba)[_0xfad0('0x9')](function(_0x58e878){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x16a9a3,_0xfad0('0xa'));logger['debug'](_0xfad0('0xb'),_0x16a9a3,_0xfad0('0xa'),JSON[_0xfad0('0xc')](_0x58e878));if(_0x58e878[_0xfad0('0xd')]){if(_0x58e878[_0xfad0('0xd')][_0xfad0('0xe')]===0x1f4){logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x58e878[_0xfad0('0xd')]['message']);return _0x3224f1(_0x58e878[_0xfad0('0xd')][_0xfad0('0x10')]);}logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x58e878[_0xfad0('0xd')]['message']);return _0x25a81c(_0x58e878['error']['message']);}else{logger[_0xfad0('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x16a9a3,_0xfad0('0xa'));_0x25a81c(_0x58e878[_0xfad0('0x12')]['message']);}})[_0xfad0('0x13')](function(_0x1d682){logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x1d682);_0x3224f1(_0x1d682);});});} \ No newline at end of file +var _0xc61e=['MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0xc61e,0x1bd));var _0xec61=function(_0x27a2cf,_0x4439cb){_0x27a2cf=_0x27a2cf-0x0;var _0x57ab15=_0xc61e[_0x27a2cf];return _0x57ab15;};'use strict';var _=require(_0xec61('0x0'));var util=require('util');var moment=require(_0xec61('0x1'));var BPromise=require(_0xec61('0x2'));var rs=require(_0xec61('0x3'));var fs=require('fs');var Redis=require(_0xec61('0x4'));var db=require(_0xec61('0x5'))['db'];var utils=require(_0xec61('0x6'));var logger=require(_0xec61('0x7'))(_0xec61('0x8'));var config=require('../../config/environment');var jayson=require(_0xec61('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3997d4,_0x463755,_0x5cdc8b){return new BPromise(function(_0x25fb69,_0x34fd3b){return client['request'](_0x3997d4,_0x5cdc8b)['then'](function(_0x84fca3){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x463755,_0xec61('0xa'));logger['debug'](_0xec61('0xb'),_0x463755,'request\x20sent',JSON[_0xec61('0xc')](_0x84fca3));if(_0x84fca3[_0xec61('0xd')]){if(_0x84fca3[_0xec61('0xd')][_0xec61('0xe')]===0x1f4){logger[_0xec61('0xd')](_0xec61('0xf'),_0x463755,_0x84fca3[_0xec61('0xd')][_0xec61('0x10')]);return _0x34fd3b(_0x84fca3['error']['message']);}logger['error'](_0xec61('0xf'),_0x463755,_0x84fca3[_0xec61('0xd')][_0xec61('0x10')]);return _0x25fb69(_0x84fca3[_0xec61('0xd')][_0xec61('0x10')]);}else{logger[_0xec61('0x11')](_0xec61('0xf'),_0x463755,_0xec61('0xa'));_0x25fb69(_0x84fca3[_0xec61('0x12')][_0xec61('0x10')]);}})[_0xec61('0x13')](function(_0x293aa7){logger['error'](_0xec61('0xf'),_0x463755,_0x293aa7);_0x34fd3b(_0x293aa7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index fbaa249..5cad5ce 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 _0xac4d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xac4d,0x108));var _0xdac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdac4('0x0'));var util=require(_0xdac4('0x1'));var path=require(_0xdac4('0x2'));var timeout=require(_0xdac4('0x3'));var express=require(_0xdac4('0x4'));var router=express[_0xdac4('0x5')]();var fs_extra=require(_0xdac4('0x6'));var auth=require(_0xdac4('0x7'));var interaction=require(_0xdac4('0x8'));var config=require(_0xdac4('0x9'));var controller=require(_0xdac4('0xa'));router[_0xdac4('0xb')]('/',auth[_0xdac4('0xc')](),controller['index']);router[_0xdac4('0xb')](_0xdac4('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xdac4('0xb')](_0xdac4('0xe'),auth[_0xdac4('0xc')](),controller[_0xdac4('0xf')]);router[_0xdac4('0x10')]('/',auth[_0xdac4('0xc')](),controller[_0xdac4('0x11')]);router[_0xdac4('0x12')]('/:id',auth[_0xdac4('0xc')](),controller[_0xdac4('0x13')]);router['delete'](_0xdac4('0xe'),auth[_0xdac4('0xc')](),controller[_0xdac4('0x14')]);module[_0xdac4('0x15')]=router; \ No newline at end of file +var _0x1062=['create','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1062,0x195));var _0x2106=function(_0x5716e0,_0x55c891){_0x5716e0=_0x5716e0-0x0;var _0x3eb598=_0x1062[_0x5716e0];return _0x3eb598;};'use strict';var multer=require(_0x2106('0x0'));var util=require(_0x2106('0x1'));var path=require(_0x2106('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2106('0x3')]();var fs_extra=require(_0x2106('0x4'));var auth=require(_0x2106('0x5'));var interaction=require(_0x2106('0x6'));var config=require(_0x2106('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x2106('0x8')](),controller[_0x2106('0x9')]);router[_0x2106('0xa')](_0x2106('0xb'),auth['isAuthenticated'](),controller[_0x2106('0xc')]);router[_0x2106('0xa')](_0x2106('0xd'),auth[_0x2106('0x8')](),controller[_0x2106('0xe')]);router['post']('/',auth[_0x2106('0x8')](),controller[_0x2106('0xf')]);router[_0x2106('0x10')](_0x2106('0xd'),auth['isAuthenticated'](),controller[_0x2106('0x11')]);router['delete'](_0x2106('0xd'),auth[_0x2106('0x8')](),controller[_0x2106('0x12')]);module[_0x2106('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 292279e..930ec15 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 _0x4d08=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','duration'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4d08,0x66));var _0x84d0=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0x4d08[_0xe0b81f];return _0x290e5e;};'use strict';var Sequelize=require(_0x84d0('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x84d0('0x1')]},'membername':{'type':Sequelize[_0x84d0('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x84d0('0x1')],'defaultValue':_0x84d0('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x84d0('0x3')]},'enterAt':{'type':Sequelize[_0x84d0('0x4')]},'exitAt':{'type':Sequelize[_0x84d0('0x4')],'set':function(_0x4cc141){var _0x475cbf=moment(_0x4cc141);var _0x381893=moment(this[_0x84d0('0x5')]('enterAt'));var _0x528554=_0x475cbf[_0x84d0('0x6')](_0x381893,_0x84d0('0x7'));this[_0x84d0('0x8')]('exitAt',_0x4cc141);this[_0x84d0('0x8')](_0x84d0('0x9'),_0x528554>=0x0?_0x528554:null);}},'data1':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xa')},'data2':{'type':Sequelize[_0x84d0('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x84d0('0xb')},'data4':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xc')},'data5':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xd')},'role':{'type':Sequelize[_0x84d0('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x84d0('0x1')]}}; \ No newline at end of file +var _0x7674=['enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x47d0e7,_0x5c5950){var _0xcaca32=function(_0x195055){while(--_0x195055){_0x47d0e7['push'](_0x47d0e7['shift']());}};_0xcaca32(++_0x5c5950);}(_0x7674,0x163));var _0x4767=function(_0x263ffd,_0x140cf8){_0x263ffd=_0x263ffd-0x0;var _0x2b3b8b=_0x7674[_0x263ffd];return _0x2b3b8b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x4767('0x0')]},'membername':{'type':Sequelize[_0x4767('0x0')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x4767('0x1'),'comment':_0x4767('0x2')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x4767('0x3')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x28d9aa){var _0x49ab32=moment(_0x28d9aa);var _0x7a0128=moment(this[_0x4767('0x4')](_0x4767('0x5')));var _0x4e34e9=_0x49ab32['diff'](_0x7a0128,_0x4767('0x6'));this[_0x4767('0x7')](_0x4767('0x8'),_0x28d9aa);this[_0x4767('0x7')](_0x4767('0x9'),_0x4e34e9>=0x0?_0x4e34e9:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4767('0xa')},'data2':{'type':Sequelize[_0x4767('0x0')],'comment':_0x4767('0xb')},'data3':{'type':Sequelize[_0x4767('0x0')],'comment':_0x4767('0xc')},'data4':{'type':Sequelize[_0x4767('0x0')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x4767('0x0')],'comment':_0x4767('0xd')},'role':{'type':Sequelize[_0x4767('0x0')]},'internal':{'type':Sequelize[_0x4767('0xe')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5f61df3..5ba634f 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x34e8,0x12c));var _0x834e=function(_0x57fb4a,_0x4770cb){_0x57fb4a=_0x57fb4a-0x0;var _0x541b75=_0x34e8[_0x57fb4a];return _0x541b75;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x83b439,_0x1e92b6){var _0x189ec6=function(_0x51aefe){while(--_0x51aefe){_0x83b439['push'](_0x83b439['shift']());}};_0x189ec6(++_0x1e92b6);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ba268f6..2c7579f 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 _0xdb1c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x445491,_0x46bc66){var _0x4cfce5=function(_0x3626f8){while(--_0x3626f8){_0x445491['push'](_0x445491['shift']());}};_0x4cfce5(++_0x46bc66);}(_0xdb1c,0xcf));var _0xcdb1=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xdb1c[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xcdb1('0x0'));var util=require(_0xcdb1('0x1'));var logger=require(_0xcdb1('0x2'))(_0xcdb1('0x3'));var moment=require(_0xcdb1('0x4'));var BPromise=require(_0xcdb1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdb1('0x6'));var rimraf=require(_0xcdb1('0x7'));var config=require(_0xcdb1('0x8'));var attributes=require(_0xcdb1('0x9'));module[_0xcdb1('0xa')]=function(_0x2c691d,_0x575070){return _0x2c691d['define'](_0xcdb1('0xb'),attributes,{'tableName':_0xcdb1('0xc'),'paranoid':![],'indexes':[{'name':_0xcdb1('0xd'),'fields':[_0xcdb1('0xe'),_0xcdb1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9842=['exports','MemberReport','report_member','membername_interface','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1ebe54,_0xaa4d1b){var _0x481b08=function(_0x490dd6){while(--_0x490dd6){_0x1ebe54['push'](_0x1ebe54['shift']());}};_0x481b08(++_0xaa4d1b);}(_0x9842,0x163));var _0x2984=function(_0x34fb27,_0x24e2fa){_0x34fb27=_0x34fb27-0x0;var _0x3cc5a7=_0x9842[_0x34fb27];return _0x3cc5a7;};'use strict';var _=require(_0x2984('0x0'));var util=require(_0x2984('0x1'));var logger=require(_0x2984('0x2'))(_0x2984('0x3'));var moment=require(_0x2984('0x4'));var BPromise=require(_0x2984('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2984('0x6'));var rimraf=require(_0x2984('0x7'));var config=require(_0x2984('0x8'));var attributes=require('./memberReport.attributes');module[_0x2984('0x9')]=function(_0x3fffac,_0x8fd05e){return _0x3fffac['define'](_0x2984('0xa'),attributes,{'tableName':_0x2984('0xb'),'paranoid':![],'indexes':[{'name':_0x2984('0xc'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4c3419c..ea455e9 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 _0x0763=['error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','create','CreateMemberReport','debug','update','body','where','UpdateMemberReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x0763,0x87));var _0x3076=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x0763[_0x37d0bc];return _0x170e60;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var moment=require(_0x3076('0x1'));var BPromise=require(_0x3076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x3'));var db=require(_0x3076('0x4'))['db'];var utils=require(_0x3076('0x5'));var logger=require(_0x3076('0x6'))('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b4c8,_0x5efd65,_0x2776c8){return new BPromise(function(_0xf1ee41,_0xf5b1b0){return client[_0x3076('0xb')](_0x18b4c8,_0x2776c8)['then'](function(_0x42804a){logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');logger['debug'](_0x3076('0xe'),_0x5efd65,_0x3076('0xf'),JSON[_0x3076('0x10')](_0x42804a));if(_0x42804a[_0x3076('0x11')]){if(_0x42804a[_0x3076('0x11')]['code']===0x1f4){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);return _0xf5b1b0(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a['error']['message']);return _0xf1ee41(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}else{logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');_0xf1ee41(_0x42804a['result'][_0x3076('0x12')]);}})[_0x3076('0x13')](function(_0x45a69b){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x45a69b);_0xf5b1b0(_0x45a69b);});});}exports[_0x3076('0x14')]=function(_0x21c242){var _0x2d7343=this;return new Promise(function(_0x1880b8,_0x1bb2ea){return db[_0x3076('0x15')][_0x3076('0x16')]({'raw':_0x21c242['options']?_0x21c242[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![],'where':_0x21c242['options']?_0x21c242[_0x3076('0x17')]['where']||null:null,'attributes':_0x21c242[_0x3076('0x17')]?_0x21c242[_0x3076('0x17')][_0x3076('0x19')]||null:null,'limit':_0x21c242['options']?_0x21c242[_0x3076('0x17')][_0x3076('0x1a')]||null:null,'include':_0x21c242[_0x3076('0x17')]?_0x21c242[_0x3076('0x17')][_0x3076('0x1b')]?_[_0x3076('0x1c')](_0x21c242[_0x3076('0x17')][_0x3076('0x1b')],function(_0x195606){return{'model':db[_0x195606[_0x3076('0x1d')]],'as':_0x195606['as'],'attributes':_0x195606['attributes'],'include':_0x195606[_0x3076('0x1b')]?_['map'](_0x195606[_0x3076('0x1b')],function(_0x4f4bdc){return{'model':db[_0x4f4bdc['model']],'as':_0x4f4bdc['as'],'attributes':_0x4f4bdc[_0x3076('0x19')],'include':_0x4f4bdc[_0x3076('0x1b')]?_[_0x3076('0x1c')](_0x4f4bdc[_0x3076('0x1b')],function(_0x28d834){return{'model':db[_0x28d834[_0x3076('0x1d')]],'as':_0x28d834['as'],'attributes':_0x28d834[_0x3076('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3076('0x1e')](function(_0x3a0ba7){logger[_0x3076('0xc')](_0x3076('0x14'),_0x21c242);logger['debug'](_0x3076('0x14'),_0x21c242,JSON[_0x3076('0x10')](_0x3a0ba7));_0x1880b8(_0x3a0ba7);})[_0x3076('0x13')](function(_0x5af88e){logger[_0x3076('0x11')](_0x3076('0x14'),_0x5af88e['message'],_0x21c242);_0x1bb2ea(_0x2d7343[_0x3076('0x11')](0x1f4,_0x5af88e[_0x3076('0x12')]));});});};exports['CreateMemberReport']=function(_0x44f7c7){var _0x5337bc=this;return new Promise(function(_0x4d6f8f,_0x28bcfb){return db[_0x3076('0x15')][_0x3076('0x1f')](_0x44f7c7['body'],{'raw':_0x44f7c7[_0x3076('0x17')]?_0x44f7c7[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![]})[_0x3076('0x1e')](function(_0x516e5d){logger[_0x3076('0xc')](_0x3076('0x20'),_0x44f7c7);logger[_0x3076('0x21')](_0x3076('0x20'),_0x44f7c7,JSON[_0x3076('0x10')](_0x516e5d));_0x4d6f8f(_0x516e5d);})['catch'](function(_0x5d40d8){logger[_0x3076('0x11')](_0x3076('0x20'),_0x5d40d8[_0x3076('0x12')],_0x44f7c7);_0x28bcfb(_0x5337bc[_0x3076('0x11')](0x1f4,_0x5d40d8[_0x3076('0x12')]));});});};exports['UpdateMemberReport']=function(_0x171d0a){var _0x538502=this;return new Promise(function(_0x445847,_0x1d6b0b){return db[_0x3076('0x15')][_0x3076('0x22')](_0x171d0a[_0x3076('0x23')],{'raw':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x24')]||null:null,'attributes':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x19')]||null:null,'limit':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x1a')]||null:null})[_0x3076('0x1e')](function(_0x4525ea){logger[_0x3076('0xc')](_0x3076('0x25'),_0x171d0a);logger[_0x3076('0x21')](_0x3076('0x25'),_0x171d0a,JSON[_0x3076('0x10')](_0x4525ea));_0x445847(_0x4525ea);})[_0x3076('0x13')](function(_0x135fdd){logger[_0x3076('0x11')]('UpdateMemberReport',_0x135fdd[_0x3076('0x12')],_0x171d0a);_0x1d6b0b(_0x538502[_0x3076('0x11')](0x1f4,_0x135fdd[_0x3076('0x12')]));});});}; \ No newline at end of file +var _0x2c24=['CreateMemberReport','body','raw','catch','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMemberReport','MemberReport','findAll','options','where','limit','map','model','attributes','include','then','debug','stringify'];(function(_0x184421,_0xb6b001){var _0x27eb02=function(_0x120247){while(--_0x120247){_0x184421['push'](_0x184421['shift']());}};_0x27eb02(++_0xb6b001);}(_0x2c24,0x1e6));var _0x42c2=function(_0x1e118e,_0x48c9fc){_0x1e118e=_0x1e118e-0x0;var _0x85990=_0x2c24[_0x1e118e];return _0x85990;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var moment=require(_0x42c2('0x2'));var BPromise=require(_0x42c2('0x3'));var rs=require(_0x42c2('0x4'));var fs=require('fs');var Redis=require(_0x42c2('0x5'));var db=require(_0x42c2('0x6'))['db'];var utils=require(_0x42c2('0x7'));var logger=require(_0x42c2('0x8'))('rpc');var config=require(_0x42c2('0x9'));var jayson=require(_0x42c2('0xa'));var client=jayson['client'][_0x42c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3825b4,_0x3021e6,_0x421017){return new BPromise(function(_0xc451c3,_0x286a63){return client[_0x42c2('0xc')](_0x3825b4,_0x421017)['then'](function(_0x4f259f){logger[_0x42c2('0xd')](_0x42c2('0xe'),_0x3021e6,_0x42c2('0xf'));logger['debug'](_0x42c2('0x10'),_0x3021e6,_0x42c2('0xf'),JSON['stringify'](_0x4f259f));if(_0x4f259f['error']){if(_0x4f259f[_0x42c2('0x11')][_0x42c2('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x3021e6,_0x4f259f[_0x42c2('0x11')][_0x42c2('0x13')]);return _0x286a63(_0x4f259f['error'][_0x42c2('0x13')]);}logger[_0x42c2('0x11')](_0x42c2('0xe'),_0x3021e6,_0x4f259f[_0x42c2('0x11')][_0x42c2('0x13')]);return _0xc451c3(_0x4f259f[_0x42c2('0x11')][_0x42c2('0x13')]);}else{logger[_0x42c2('0xd')](_0x42c2('0xe'),_0x3021e6,_0x42c2('0xf'));_0xc451c3(_0x4f259f[_0x42c2('0x14')][_0x42c2('0x13')]);}})['catch'](function(_0x5a08e4){logger[_0x42c2('0x11')]('MemberReport,\x20%s,\x20%s',_0x3021e6,_0x5a08e4);_0x286a63(_0x5a08e4);});});}exports[_0x42c2('0x15')]=function(_0x54d00b){var _0x1833eb=this;return new Promise(function(_0x102116,_0x5747b8){return db[_0x42c2('0x16')][_0x42c2('0x17')]({'raw':_0x54d00b[_0x42c2('0x18')]?_0x54d00b['options']['raw']===undefined?!![]:![]:!![],'where':_0x54d00b[_0x42c2('0x18')]?_0x54d00b[_0x42c2('0x18')][_0x42c2('0x19')]||null:null,'attributes':_0x54d00b['options']?_0x54d00b[_0x42c2('0x18')]['attributes']||null:null,'limit':_0x54d00b[_0x42c2('0x18')]?_0x54d00b[_0x42c2('0x18')][_0x42c2('0x1a')]||null:null,'include':_0x54d00b[_0x42c2('0x18')]?_0x54d00b['options']['include']?_[_0x42c2('0x1b')](_0x54d00b['options']['include'],function(_0x3b4924){return{'model':db[_0x3b4924[_0x42c2('0x1c')]],'as':_0x3b4924['as'],'attributes':_0x3b4924[_0x42c2('0x1d')],'include':_0x3b4924['include']?_['map'](_0x3b4924[_0x42c2('0x1e')],function(_0xecd1fd){return{'model':db[_0xecd1fd[_0x42c2('0x1c')]],'as':_0xecd1fd['as'],'attributes':_0xecd1fd[_0x42c2('0x1d')],'include':_0xecd1fd[_0x42c2('0x1e')]?_[_0x42c2('0x1b')](_0xecd1fd[_0x42c2('0x1e')],function(_0x4f0a52){return{'model':db[_0x4f0a52[_0x42c2('0x1c')]],'as':_0x4f0a52['as'],'attributes':_0x4f0a52[_0x42c2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x42c2('0x1f')](function(_0x31138d){logger[_0x42c2('0xd')](_0x42c2('0x15'),_0x54d00b);logger[_0x42c2('0x20')](_0x42c2('0x15'),_0x54d00b,JSON[_0x42c2('0x21')](_0x31138d));_0x102116(_0x31138d);})['catch'](function(_0x14bc19){logger[_0x42c2('0x11')](_0x42c2('0x15'),_0x14bc19[_0x42c2('0x13')],_0x54d00b);_0x5747b8(_0x1833eb[_0x42c2('0x11')](0x1f4,_0x14bc19[_0x42c2('0x13')]));});});};exports[_0x42c2('0x22')]=function(_0x31da44){var _0x399cc1=this;return new Promise(function(_0x2714f3,_0x36ff88){return db[_0x42c2('0x16')]['create'](_0x31da44[_0x42c2('0x23')],{'raw':_0x31da44[_0x42c2('0x18')]?_0x31da44[_0x42c2('0x18')][_0x42c2('0x24')]===undefined?!![]:![]:!![]})[_0x42c2('0x1f')](function(_0x54b164){logger['info'](_0x42c2('0x22'),_0x31da44);logger['debug'](_0x42c2('0x22'),_0x31da44,JSON['stringify'](_0x54b164));_0x2714f3(_0x54b164);})[_0x42c2('0x25')](function(_0x2983ab){logger[_0x42c2('0x11')](_0x42c2('0x22'),_0x2983ab[_0x42c2('0x13')],_0x31da44);_0x36ff88(_0x399cc1[_0x42c2('0x11')](0x1f4,_0x2983ab['message']));});});};exports['UpdateMemberReport']=function(_0x1ddd53){var _0x5d5b3a=this;return new Promise(function(_0xdde835,_0x30dcc0){return db['MemberReport'][_0x42c2('0x26')](_0x1ddd53[_0x42c2('0x23')],{'raw':_0x1ddd53[_0x42c2('0x18')]?_0x1ddd53[_0x42c2('0x18')][_0x42c2('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ddd53[_0x42c2('0x18')]?_0x1ddd53[_0x42c2('0x18')][_0x42c2('0x19')]||null:null,'attributes':_0x1ddd53[_0x42c2('0x18')]?_0x1ddd53[_0x42c2('0x18')]['attributes']||null:null,'limit':_0x1ddd53[_0x42c2('0x18')]?_0x1ddd53[_0x42c2('0x18')][_0x42c2('0x1a')]||null:null})['then'](function(_0x4d591c){logger[_0x42c2('0xd')](_0x42c2('0x27'),_0x1ddd53);logger['debug'](_0x42c2('0x27'),_0x1ddd53,JSON[_0x42c2('0x21')](_0x4d591c));_0xdde835(_0x4d591c);})[_0x42c2('0x25')](function(_0xe55d78){logger['error'](_0x42c2('0x27'),_0xe55d78['message'],_0x1ddd53);_0x30dcc0(_0x5d5b3a[_0x42c2('0x11')](0x1f4,_0xe55d78[_0x42c2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c5a7a98..2a0c675 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 _0x3fea=['./migration.controller','index','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x46f7cb,_0x23f8aa){var _0x41fc78=function(_0x242356){while(--_0x242356){_0x46f7cb['push'](_0x46f7cb['shift']());}};_0x41fc78(++_0x23f8aa);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x5f0427,_0x312c9d){_0x5f0427=_0x5f0427-0x0;var _0x5a341d=_0x3fea[_0x5f0427];return _0x5a341d;};'use strict';var multer=require(_0xa3fe('0x0'));var util=require(_0xa3fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa3fe('0x2'));var router=express[_0xa3fe('0x3')]();var fs_extra=require(_0xa3fe('0x4'));var auth=require(_0xa3fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3fe('0x6'));router['get']('/',controller[_0xa3fe('0x7')]);module[_0xa3fe('0x8')]=router; \ No newline at end of file +var _0x322d=['./migration.controller','get','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x322d,0x121));var _0xd322=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0x322d[_0x617084];return _0x384ac0;};'use strict';var multer=require(_0xd322('0x0'));var util=require('util');var path=require(_0xd322('0x1'));var timeout=require('connect-timeout');var express=require(_0xd322('0x2'));var router=express[_0xd322('0x3')]();var fs_extra=require(_0xd322('0x4'));var auth=require(_0xd322('0x5'));var interaction=require(_0xd322('0x6'));var config=require(_0xd322('0x7'));var controller=require(_0xd322('0x8'));router[_0xd322('0x9')]('/',controller['index']);module[_0xd322('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 8590d72..5b31a19 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 _0x4d16=['version','sequelize','exports'];(function(_0xec5bed,_0x5b2d68){var _0x15b715=function(_0x39d8b9){while(--_0x39d8b9){_0xec5bed['push'](_0xec5bed['shift']());}};_0x15b715(++_0x5b2d68);}(_0x4d16,0xe5));var _0x64d1=function(_0x18d716,_0xabc9d9){_0x18d716=_0x18d716-0x0;var _0x35fa38=_0x4d16[_0x18d716];return _0x35fa38;};'use strict';var Sequelize=require(_0x64d1('0x0'));module[_0x64d1('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x64d1('0x2')}}; \ No newline at end of file +var _0x7bc0=['sequelize','exports','version'];(function(_0x11ed49,_0x26c4f6){var _0x5e41dd=function(_0x36dbe8){while(--_0x36dbe8){_0x11ed49['push'](_0x11ed49['shift']());}};_0x5e41dd(++_0x26c4f6);}(_0x7bc0,0x93));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x07bc('0x0'));module[_0x07bc('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x07bc('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f164604..0496b58 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 _0x8b02=['index','map','Migration','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','findAll','rows','catch','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x8b02,0x94));var _0x28b0=function(_0x585c86,_0x472ef9){_0x585c86=_0x585c86-0x0;var _0x26ce5d=_0x8b02[_0x585c86];return _0x26ce5d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x28b0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b0('0x1'));var moment=require(_0x28b0('0x2'));var BPromise=require(_0x28b0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x28b0('0x4'));var sox=require(_0x28b0('0x5'));var csv=require(_0x28b0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28b0('0x7'));var _=require(_0x28b0('0x8'));var squel=require(_0x28b0('0x9'));var crypto=require(_0x28b0('0xa'));var jsforce=require(_0x28b0('0xb'));var deskjs=require(_0x28b0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28b0('0xd'));var Papa=require(_0x28b0('0xe'));var Redis=require('ioredis');var authService=require(_0x28b0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x28b0('0x10'));var hardwareService=require(_0x28b0('0x11'));var logger=require(_0x28b0('0x12'))(_0x28b0('0x13'));var utils=require(_0x28b0('0x14'));var config=require(_0x28b0('0x15'));var licenseUtil=require(_0x28b0('0x16'));var db=require(_0x28b0('0x17'))['db'];function respondWithStatusCode(_0x13eeed,_0x3af874){_0x3af874=_0x3af874||0xcc;return function(_0x1f8015){if(_0x1f8015){return _0x13eeed[_0x28b0('0x18')](_0x3af874);}return _0x13eeed[_0x28b0('0x19')](_0x3af874)[_0x28b0('0x1a')]();};}function respondWithResult(_0x52aef7,_0x3c3255){_0x3c3255=_0x3c3255||0xc8;return function(_0x21388d){if(_0x21388d){return _0x52aef7[_0x28b0('0x19')](_0x3c3255)[_0x28b0('0x1b')](_0x21388d);}};}function respondWithFilteredResult(_0x16426c,_0x14c347){return function(_0x463722){if(_0x463722){var _0x594df0=typeof _0x14c347[_0x28b0('0x1c')]===_0x28b0('0x1d')&&typeof _0x14c347[_0x28b0('0x1e')]===_0x28b0('0x1d');var _0x2488f6=_0x463722[_0x28b0('0x1f')];var _0x1d3589=_0x594df0?0x0:_0x14c347[_0x28b0('0x1c')];var _0x470be8=_0x594df0?_0x463722[_0x28b0('0x1f')]:_0x14c347[_0x28b0('0x1c')]+_0x14c347[_0x28b0('0x1e')];var _0x56c74e;if(_0x470be8>=_0x2488f6){_0x470be8=_0x2488f6;_0x56c74e=0xc8;}else{_0x56c74e=0xce;}_0x16426c[_0x28b0('0x19')](_0x56c74e);return _0x16426c['set'](_0x28b0('0x20'),_0x1d3589+'-'+_0x470be8+'/'+_0x2488f6)['json'](_0x463722);}return null;};}function patchUpdates(_0x4842a5){return function(_0xf55a6d){try{jsonpatch[_0x28b0('0x21')](_0xf55a6d,_0x4842a5,!![]);}catch(_0x1efe3){return BPromise[_0x28b0('0x22')](_0x1efe3);}return _0xf55a6d[_0x28b0('0x23')]();};}function saveUpdates(_0x278d8a,_0xf1c38c){return function(_0x518652){if(_0x518652){return _0x518652[_0x28b0('0x24')](_0x278d8a)['then'](function(_0xd22cab){return _0xd22cab;});}return null;};}function removeEntity(_0x32a29a,_0x4a2934){return function(_0x35b0e7){if(_0x35b0e7){return _0x35b0e7[_0x28b0('0x25')]()[_0x28b0('0x26')](function(){_0x32a29a['status'](0xcc)[_0x28b0('0x1a')]();});}};}function handleEntityNotFound(_0x34eacb,_0x3e35fe){return function(_0x4bd42f){if(!_0x4bd42f){_0x34eacb[_0x28b0('0x18')](0x194);}return _0x4bd42f;};}function handleError(_0x37bcdd,_0x473fd4){_0x473fd4=_0x473fd4||0x1f4;return function(_0x46868c){logger['error'](_0x46868c[_0x28b0('0x27')]);if(_0x46868c[_0x28b0('0x28')]){delete _0x46868c[_0x28b0('0x28')];}_0x37bcdd[_0x28b0('0x19')](_0x473fd4)['send'](_0x46868c);};}exports[_0x28b0('0x29')]=function(_0x38c1e3,_0xd7060d){var _0x327eda={},_0x1f5a91={},_0x223c55={'count':0x0,'rows':[]};var _0x4b5853=_[_0x28b0('0x2a')](db[_0x28b0('0x2b')]['rawAttributes'],function(_0x2bd20f){return{'name':_0x2bd20f[_0x28b0('0x2c')],'type':_0x2bd20f[_0x28b0('0x2d')]['key']};});_0x1f5a91['model']=_['map'](_0x4b5853,_0x28b0('0x28'));_0x1f5a91[_0x28b0('0x2e')]=_['keys'](_0x38c1e3[_0x28b0('0x2e')]);_0x1f5a91[_0x28b0('0x2f')]=_[_0x28b0('0x30')](_0x1f5a91[_0x28b0('0x31')],_0x1f5a91[_0x28b0('0x2e')]);_0x327eda[_0x28b0('0x32')]=_['intersection'](_0x1f5a91[_0x28b0('0x31')],qs[_0x28b0('0x33')](_0x38c1e3['query'][_0x28b0('0x33')]));_0x327eda['attributes']=_0x327eda['attributes'][_0x28b0('0x34')]?_0x327eda['attributes']:_0x1f5a91[_0x28b0('0x31')];if(!_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x35')](_0x28b0('0x36'))){_0x327eda[_0x28b0('0x1e')]=qs[_0x28b0('0x1e')](_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x1e')]);_0x327eda['offset']=qs['offset'](_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x1c')]);}_0x327eda['order']=qs['sort'](_0x38c1e3[_0x28b0('0x2e')]['sort']);_0x327eda[_0x28b0('0x37')]=qs[_0x28b0('0x2f')](_[_0x28b0('0x38')](_0x38c1e3[_0x28b0('0x2e')],_0x1f5a91[_0x28b0('0x2f')]),_0x4b5853);if(_0x38c1e3['query'][_0x28b0('0x39')]){_0x327eda['where']=_['merge'](_0x327eda['where'],{'$or':_['map'](_0x4b5853,function(_0x1f953b){if(_0x1f953b['type']!=='VIRTUAL'){var _0x28ae6d={};_0x28ae6d[_0x1f953b[_0x28b0('0x28')]]={'$like':'%'+_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x39')]+'%'};return _0x28ae6d;}})});}_0x327eda=_[_0x28b0('0x3a')]({},_0x327eda,_0x38c1e3[_0x28b0('0x3b')]);var _0x3ffd27={'where':_0x327eda['where']};return db[_0x28b0('0x2b')]['count'](_0x3ffd27)[_0x28b0('0x26')](function(_0x54303c){_0x223c55[_0x28b0('0x1f')]=_0x54303c;if(_0x38c1e3[_0x28b0('0x2e')]['includeAll']){_0x327eda['include']=[{'all':!![]}];}return db[_0x28b0('0x2b')][_0x28b0('0x3c')](_0x327eda);})[_0x28b0('0x26')](function(_0x4a8110){_0x223c55[_0x28b0('0x3d')]=_0x4a8110;return _0x223c55;})['then'](respondWithFilteredResult(_0xd7060d,_0x327eda))[_0x28b0('0x3e')](handleError(_0xd7060d,null));}; \ No newline at end of file +var _0x6fb2=['error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6fb2,0x15d));var _0x26fb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6fb2[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26fb('0x0'));var zipdir=require(_0x26fb('0x1'));var jsonpatch=require(_0x26fb('0x2'));var rp=require(_0x26fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x26fb('0x4'));var util=require('util');var path=require(_0x26fb('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x26fb('0x6'));var crypto=require(_0x26fb('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x26fb('0x8'));var toCsv=require(_0x26fb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x26fb('0xa'));var authService=require(_0x26fb('0xb'));var qs=require(_0x26fb('0xc'));var as=require(_0x26fb('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26fb('0xe'))('api');var utils=require(_0x26fb('0xf'));var config=require(_0x26fb('0x10'));var licenseUtil=require(_0x26fb('0x11'));var db=require(_0x26fb('0x12'))['db'];function respondWithStatusCode(_0x2487a7,_0x4c9b0d){_0x4c9b0d=_0x4c9b0d||0xcc;return function(_0x14313c){if(_0x14313c){return _0x2487a7['sendStatus'](_0x4c9b0d);}return _0x2487a7[_0x26fb('0x13')](_0x4c9b0d)['end']();};}function respondWithResult(_0x5ce3fd,_0x276aa0){_0x276aa0=_0x276aa0||0xc8;return function(_0x318325){if(_0x318325){return _0x5ce3fd[_0x26fb('0x13')](_0x276aa0)[_0x26fb('0x14')](_0x318325);}};}function respondWithFilteredResult(_0x57e894,_0x5a8035){return function(_0x4ffd42){if(_0x4ffd42){var _0x50bd11=typeof _0x5a8035[_0x26fb('0x15')]===_0x26fb('0x16')&&typeof _0x5a8035['limit']===_0x26fb('0x16');var _0x372afa=_0x4ffd42[_0x26fb('0x17')];var _0x757a38=_0x50bd11?0x0:_0x5a8035[_0x26fb('0x15')];var _0x5bed57=_0x50bd11?_0x4ffd42[_0x26fb('0x17')]:_0x5a8035['offset']+_0x5a8035[_0x26fb('0x18')];var _0x759db3;if(_0x5bed57>=_0x372afa){_0x5bed57=_0x372afa;_0x759db3=0xc8;}else{_0x759db3=0xce;}_0x57e894[_0x26fb('0x13')](_0x759db3);return _0x57e894[_0x26fb('0x19')](_0x26fb('0x1a'),_0x757a38+'-'+_0x5bed57+'/'+_0x372afa)[_0x26fb('0x14')](_0x4ffd42);}return null;};}function patchUpdates(_0x2128f1){return function(_0x38b7ba){try{jsonpatch[_0x26fb('0x1b')](_0x38b7ba,_0x2128f1,!![]);}catch(_0x1373ec){return BPromise[_0x26fb('0x1c')](_0x1373ec);}return _0x38b7ba[_0x26fb('0x1d')]();};}function saveUpdates(_0x3ac092,_0x4afcfe){return function(_0x17123a){if(_0x17123a){return _0x17123a[_0x26fb('0x1e')](_0x3ac092)[_0x26fb('0x1f')](function(_0x108b87){return _0x108b87;});}return null;};}function removeEntity(_0x1ee2c6,_0x4cb306){return function(_0x306bee){if(_0x306bee){return _0x306bee[_0x26fb('0x20')]()['then'](function(){_0x1ee2c6[_0x26fb('0x13')](0xcc)[_0x26fb('0x21')]();});}};}function handleEntityNotFound(_0x45d673,_0x529b00){return function(_0x42b898){if(!_0x42b898){_0x45d673[_0x26fb('0x22')](0x194);}return _0x42b898;};}function handleError(_0x2cf611,_0x34ab51){_0x34ab51=_0x34ab51||0x1f4;return function(_0x4ee88d){logger[_0x26fb('0x23')](_0x4ee88d[_0x26fb('0x24')]);if(_0x4ee88d['name']){delete _0x4ee88d[_0x26fb('0x25')];}_0x2cf611['status'](_0x34ab51)[_0x26fb('0x26')](_0x4ee88d);};}exports[_0x26fb('0x27')]=function(_0x3d63d2,_0x432afe){var _0x4e3de2={},_0x624d3a={},_0x415e3d={'count':0x0,'rows':[]};var _0x39d78d=_[_0x26fb('0x28')](db[_0x26fb('0x29')][_0x26fb('0x2a')],function(_0x47e470){return{'name':_0x47e470[_0x26fb('0x2b')],'type':_0x47e470[_0x26fb('0x2c')]['key']};});_0x624d3a[_0x26fb('0x2d')]=_[_0x26fb('0x28')](_0x39d78d,'name');_0x624d3a[_0x26fb('0x2e')]=_[_0x26fb('0x2f')](_0x3d63d2['query']);_0x624d3a[_0x26fb('0x30')]=_[_0x26fb('0x31')](_0x624d3a[_0x26fb('0x2d')],_0x624d3a[_0x26fb('0x2e')]);_0x4e3de2[_0x26fb('0x32')]=_[_0x26fb('0x31')](_0x624d3a[_0x26fb('0x2d')],qs[_0x26fb('0x33')](_0x3d63d2['query'][_0x26fb('0x33')]));_0x4e3de2['attributes']=_0x4e3de2[_0x26fb('0x32')]['length']?_0x4e3de2[_0x26fb('0x32')]:_0x624d3a[_0x26fb('0x2d')];if(!_0x3d63d2[_0x26fb('0x2e')]['hasOwnProperty'](_0x26fb('0x34'))){_0x4e3de2[_0x26fb('0x18')]=qs[_0x26fb('0x18')](_0x3d63d2[_0x26fb('0x2e')][_0x26fb('0x18')]);_0x4e3de2[_0x26fb('0x15')]=qs[_0x26fb('0x15')](_0x3d63d2['query'][_0x26fb('0x15')]);}_0x4e3de2[_0x26fb('0x35')]=qs[_0x26fb('0x36')](_0x3d63d2['query'][_0x26fb('0x36')]);_0x4e3de2[_0x26fb('0x37')]=qs[_0x26fb('0x30')](_['pick'](_0x3d63d2[_0x26fb('0x2e')],_0x624d3a['filters']),_0x39d78d);if(_0x3d63d2[_0x26fb('0x2e')]['filter']){_0x4e3de2[_0x26fb('0x37')]=_['merge'](_0x4e3de2[_0x26fb('0x37')],{'$or':_[_0x26fb('0x28')](_0x39d78d,function(_0x148597){if(_0x148597[_0x26fb('0x2c')]!==_0x26fb('0x38')){var _0x5c85db={};_0x5c85db[_0x148597[_0x26fb('0x25')]]={'$like':'%'+_0x3d63d2[_0x26fb('0x2e')][_0x26fb('0x39')]+'%'};return _0x5c85db;}})});}_0x4e3de2=_[_0x26fb('0x3a')]({},_0x4e3de2,_0x3d63d2[_0x26fb('0x3b')]);var _0x1314c5={'where':_0x4e3de2[_0x26fb('0x37')]};return db[_0x26fb('0x29')][_0x26fb('0x17')](_0x1314c5)[_0x26fb('0x1f')](function(_0x3c075b){_0x415e3d[_0x26fb('0x17')]=_0x3c075b;if(_0x3d63d2['query'][_0x26fb('0x3c')]){_0x4e3de2[_0x26fb('0x3d')]=[{'all':!![]}];}return db[_0x26fb('0x29')][_0x26fb('0x3e')](_0x4e3de2);})[_0x26fb('0x1f')](function(_0x4f0682){_0x415e3d[_0x26fb('0x3f')]=_0x4f0682;return _0x415e3d;})[_0x26fb('0x1f')](respondWithFilteredResult(_0x432afe,_0x4e3de2))['catch'](handleError(_0x432afe,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7508da6..f525c03 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 _0xfcf0=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xfcf0,0x15d));var _0x0fcf=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0xfcf0[_0x2675da];return _0x5e6153;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require(_0x0fcf('0x2'))(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var rp=require(_0x0fcf('0x6'));var fs=require('fs');var path=require(_0x0fcf('0x7'));var rimraf=require(_0x0fcf('0x8'));var config=require(_0x0fcf('0x9'));var attributes=require(_0x0fcf('0xa'));module[_0x0fcf('0xb')]=function(_0x524105,_0x50c937){return _0x524105[_0x0fcf('0xc')](_0x0fcf('0xd'),attributes,{'tableName':_0x0fcf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['bluebird','path','rimraf','./migration.attributes','define','migrations','util','../../config/logger','api','moment'];(function(_0x3298a7,_0xe22061){var _0x163260=function(_0x10670e){while(--_0x10670e){_0x3298a7['push'](_0x3298a7['shift']());}};_0x163260(++_0xe22061);}(_0xbaf0,0x132));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0baf('0x5'));var rimraf=require(_0x0baf('0x6'));var config=require('../../config/environment');var attributes=require(_0x0baf('0x7'));module['exports']=function(_0x1542c7,_0x2e4fd2){return _0x1542c7[_0x0baf('0x8')]('Migration',attributes,{'tableName':_0x0baf('0x9'),'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 da76d1b..7ec5fff 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 _0xdfe9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x28cf9d,_0x412de3){_0x28cf9d=_0x28cf9d-0x0;var _0x18e793=_0xdfe9[_0x28cf9d];return _0x18e793;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dfe('0x2'));var db=require(_0x9dfe('0x3'))['db'];var utils=require(_0x9dfe('0x4'));var logger=require(_0x9dfe('0x5'))(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var jayson=require(_0x9dfe('0x8'));var client=jayson[_0x9dfe('0x9')][_0x9dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471f0,_0x13b6f8,_0x5e0faf){return new BPromise(function(_0x377c1e,_0xa21ae3){return client[_0x9dfe('0xb')](_0x3471f0,_0x5e0faf)[_0x9dfe('0xc')](function(_0xcd9ecb){logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,_0x9dfe('0xf'));logger['debug'](_0x9dfe('0x10'),_0x13b6f8,_0x9dfe('0xf'),JSON[_0x9dfe('0x11')](_0xcd9ecb));if(_0xcd9ecb[_0x9dfe('0x12')]){if(_0xcd9ecb['error']['code']===0x1f4){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb['error']['message']);return _0xa21ae3(_0xcd9ecb['error'][_0x9dfe('0x13')]);}logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);return _0x377c1e(_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);}else{logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,'request\x20sent');_0x377c1e(_0xcd9ecb['result'][_0x9dfe('0x13')]);}})['catch'](function(_0x1a7cbe){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0x1a7cbe);_0xa21ae3(_0x1a7cbe);});});} \ No newline at end of file +var _0x61a5=['rpc','../../config/environment','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x286ee,_0x3bebf5){var _0x111b9e=function(_0x2b768b){while(--_0x2b768b){_0x286ee['push'](_0x286ee['shift']());}};_0x111b9e(++_0x3bebf5);}(_0x61a5,0x19e));var _0x561a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x61a5[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var moment=require(_0x561a('0x1'));var BPromise=require(_0x561a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x561a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x561a('0x4'));var logger=require(_0x561a('0x5'))(_0x561a('0x6'));var config=require(_0x561a('0x7'));var jayson=require(_0x561a('0x8'));var client=jayson[_0x561a('0x9')][_0x561a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a763a,_0x4c2853,_0x3d020c){return new BPromise(function(_0x27e026,_0xe056b2){return client['request'](_0x2a763a,_0x3d020c)[_0x561a('0xb')](function(_0x2a0fdb){logger['info'](_0x561a('0xc'),_0x4c2853,_0x561a('0xd'));logger[_0x561a('0xe')](_0x561a('0xf'),_0x4c2853,'request\x20sent',JSON['stringify'](_0x2a0fdb));if(_0x2a0fdb[_0x561a('0x10')]){if(_0x2a0fdb[_0x561a('0x10')][_0x561a('0x11')]===0x1f4){logger[_0x561a('0x10')](_0x561a('0xc'),_0x4c2853,_0x2a0fdb[_0x561a('0x10')][_0x561a('0x12')]);return _0xe056b2(_0x2a0fdb[_0x561a('0x10')]['message']);}logger[_0x561a('0x10')](_0x561a('0xc'),_0x4c2853,_0x2a0fdb[_0x561a('0x10')][_0x561a('0x12')]);return _0x27e026(_0x2a0fdb['error'][_0x561a('0x12')]);}else{logger['info'](_0x561a('0xc'),_0x4c2853,_0x561a('0xd'));_0x27e026(_0x2a0fdb[_0x561a('0x13')][_0x561a('0x12')]);}})[_0x561a('0x14')](function(_0xb777ee){logger['error']('Migration,\x20%s,\x20%s',_0x4c2853,_0xb777ee);_0xe056b2(_0xb777ee);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7c0d636..d71cba9 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 _0xc4af=['Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4af,0x88));var _0xfc4a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc4af[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xfc4a('0x0'));var util=require('util');var path=require(_0xfc4a('0x1'));var timeout=require(_0xfc4a('0x2'));var express=require(_0xfc4a('0x3'));var router=express[_0xfc4a('0x4')]();var fs_extra=require(_0xfc4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc4a('0x6'));var config=require(_0xfc4a('0x7'));var controller=require(_0xfc4a('0x8'));router[_0xfc4a('0x9')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xb')]);router[_0xfc4a('0x9')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xd')]);router[_0xfc4a('0xe')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xf')]);router[_0xfc4a('0x10')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller[_0xfc4a('0x11')]);router[_0xfc4a('0x12')](_0xfc4a('0xc'),auth['isAuthenticated'](),controller[_0xfc4a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x06ae=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','update','destroy','util','path'];(function(_0xbd6b38,_0x4ad164){var _0x88f5b7=function(_0x186031){while(--_0x186031){_0xbd6b38['push'](_0xbd6b38['shift']());}};_0x88f5b7(++_0x4ad164);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe06a('0x0'));var path=require(_0xe06a('0x1'));var timeout=require(_0xe06a('0x2'));var express=require(_0xe06a('0x3'));var router=express[_0xe06a('0x4')]();var fs_extra=require(_0xe06a('0x5'));var auth=require(_0xe06a('0x6'));var interaction=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe06a('0x9')]);router[_0xe06a('0xa')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller[_0xe06a('0xd')]);router['post']('/',auth[_0xe06a('0xc')](),controller['create']);router['put'](_0xe06a('0xb'),auth['isAuthenticated'](),controller[_0xe06a('0xe')]);router['delete']('/:id',auth[_0xe06a('0xc')](),controller[_0xe06a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 40e86fc..a226c19 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 _0x7a91=['externip','stun','STRING','sequelize','exports','ENUM'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0x7a91,0xc9));var _0x17a9=function(_0x10d479,_0x84ea59){_0x10d479=_0x10d479-0x0;var _0x1fec1f=_0x7a91[_0x10d479];return _0x1fec1f;};'use strict';var Sequelize=require(_0x17a9('0x0'));module[_0x17a9('0x1')]={'type':{'type':Sequelize[_0x17a9('0x2')]('localnet',_0x17a9('0x3'),_0x17a9('0x4'),'turn')},'value':{'type':Sequelize[_0x17a9('0x5')]},'username':{'type':Sequelize[_0x17a9('0x5')]},'password':{'type':Sequelize[_0x17a9('0x5')]}}; \ No newline at end of file +var _0x2048=['stun','STRING','sequelize','ENUM','externip'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x2048,0xfc));var _0x8204=function(_0x19ed94,_0x45f675){_0x19ed94=_0x19ed94-0x0;var _0x1c2bd5=_0x2048[_0x19ed94];return _0x1c2bd5;};'use strict';var Sequelize=require(_0x8204('0x0'));module['exports']={'type':{'type':Sequelize[_0x8204('0x1')]('localnet',_0x8204('0x2'),_0x8204('0x3'),'turn')},'value':{'type':Sequelize[_0x8204('0x4')]},'username':{'type':Sequelize[_0x8204('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 6c46774..84d996d 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 _0xc691=['type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Network','rows','params','includeAll','include','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toLowerCase','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0xc691,0xdb));var _0x1c69=function(_0x463c7e,_0x1dd4b3){_0x463c7e=_0x463c7e-0x0;var _0x250ec6=_0xc691[_0x463c7e];return _0x250ec6;};'use strict';var util=require(_0x1c69('0x0'));var path=require(_0x1c69('0x1'));var ejs=require(_0x1c69('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x1c69('0x3'));var logger=require(_0x1c69('0x4'))(_0x1c69('0x5'));var config=require(_0x1c69('0x6'));var db=require(_0x1c69('0x7'))['db'];var jayson=require(_0x1c69('0x8'));var client=jayson[_0x1c69('0x9')][_0x1c69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x544e4a,_0x3e0943,_0x40021b,_0xdb0720){return new Promise(function(_0x558e7e,_0x416225){var _0x36676e=_0xdb0720||client;return _0x36676e[_0x1c69('0xb')](_0x544e4a,_0x40021b)[_0x1c69('0xc')](function(_0x244720){logger[_0x1c69('0xd')]('Network,\x20%s,\x20%s',_0x3e0943,_0x1c69('0xe'));logger[_0x1c69('0xf')](_0x1c69('0x10'),_0x3e0943,_0x1c69('0xe'),JSON['stringify'](_0x244720));if(_0x244720[_0x1c69('0x11')]){if(_0x244720[_0x1c69('0x11')][_0x1c69('0x12')]===0x1f4){logger['error'](_0x1c69('0x13'),_0x3e0943,_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);return _0x416225(_0x244720[_0x1c69('0x11')]['message']);}logger[_0x1c69('0x11')](_0x1c69('0x13'),_0x3e0943,_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);return _0x558e7e(_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x3e0943,_0x1c69('0xe'));_0x558e7e(_0x244720[_0x1c69('0x15')][_0x1c69('0x14')]);}})[_0x1c69('0x16')](function(_0xed9822){logger[_0x1c69('0x11')]('Network,\x20%s,\x20%s',_0x3e0943,_0xed9822);_0x416225(_0xed9822);});});}function respondWithResult(_0x35effa,_0x413ae0){_0x413ae0=_0x413ae0||0xc8;return function(_0x5e779b){if(_0x5e779b){return _0x35effa[_0x1c69('0x17')](_0x413ae0)[_0x1c69('0x18')](_0x5e779b);}};}function respondWithFilteredResult(_0x6a1814,_0x259e9c){return function(_0x196127){if(_0x196127){var _0x1d9f79=typeof _0x259e9c[_0x1c69('0x19')]===_0x1c69('0x1a')&&typeof _0x259e9c[_0x1c69('0x1b')]==='undefined';var _0x5e9edc=_0x196127['count'];var _0x3e2244=_0x1d9f79?0x0:_0x259e9c['offset'];var _0x954b5d=_0x1d9f79?_0x196127[_0x1c69('0x1c')]:_0x259e9c[_0x1c69('0x19')]+_0x259e9c[_0x1c69('0x1b')];var _0xcdf6ca;if(_0x954b5d>=_0x5e9edc){_0x954b5d=_0x5e9edc;_0xcdf6ca=0xc8;}else{_0xcdf6ca=0xce;}_0x6a1814[_0x1c69('0x17')](_0xcdf6ca);return _0x6a1814['set'](_0x1c69('0x1d'),_0x3e2244+'-'+_0x954b5d+'/'+_0x5e9edc)[_0x1c69('0x18')](_0x196127);}return null;};}function saveUpdates(_0x20cc91){return function(_0x4f4e8b){if(_0x4f4e8b){return _0x4f4e8b[_0x1c69('0x1e')](_0x20cc91)[_0x1c69('0xc')](function(_0x3017f6){return _0x3017f6;});}return null;};}function removeEntity(_0x4be705){return function(_0x2091e5){if(_0x2091e5){return _0x2091e5[_0x1c69('0x1f')]()[_0x1c69('0xc')](function(){_0x4be705[_0x1c69('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f26f0){return function(_0x14a32d){if(!_0x14a32d){_0x4f26f0[_0x1c69('0x20')](0x194);}return _0x14a32d;};}function handleError(_0x2d3ff6,_0x10f0a0){_0x10f0a0=_0x10f0a0||0x1f4;return function(_0x539a40){logger['error'](_0x539a40[_0x1c69('0x21')]);if(_0x539a40[_0x1c69('0x22')]){delete _0x539a40[_0x1c69('0x22')];}_0x2d3ff6[_0x1c69('0x17')](_0x10f0a0)[_0x1c69('0x23')](_0x539a40);};}exports['index']=function(_0x55d960,_0x366179){var _0x127e13={},_0x4f7058={},_0x4f6cc2={'count':0x0,'rows':[]};var _0x3a6fcd=_[_0x1c69('0x24')](db['Network'][_0x1c69('0x25')],function(_0x259097){return{'name':_0x259097[_0x1c69('0x26')],'type':_0x259097[_0x1c69('0x27')][_0x1c69('0x28')]};});_0x4f7058[_0x1c69('0x29')]=_[_0x1c69('0x24')](_0x3a6fcd,'name');_0x4f7058[_0x1c69('0x2a')]=_[_0x1c69('0x2b')](_0x55d960['query']);_0x4f7058[_0x1c69('0x2c')]=_['intersection'](_0x4f7058[_0x1c69('0x29')],_0x4f7058['query']);_0x127e13[_0x1c69('0x2d')]=_[_0x1c69('0x2e')](_0x4f7058[_0x1c69('0x29')],qs['fields'](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x2f')]));_0x127e13['attributes']=_0x127e13[_0x1c69('0x2d')][_0x1c69('0x30')]?_0x127e13['attributes']:_0x4f7058[_0x1c69('0x29')];if(!_0x55d960[_0x1c69('0x2a')]['hasOwnProperty'](_0x1c69('0x31'))){_0x127e13[_0x1c69('0x1b')]=qs[_0x1c69('0x1b')](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x1b')]);_0x127e13[_0x1c69('0x19')]=qs[_0x1c69('0x19')](_0x55d960['query']['offset']);}_0x127e13[_0x1c69('0x32')]=qs[_0x1c69('0x33')](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x33')]);_0x127e13[_0x1c69('0x34')]=qs[_0x1c69('0x2c')](_[_0x1c69('0x35')](_0x55d960[_0x1c69('0x2a')],_0x4f7058[_0x1c69('0x2c')]),_0x3a6fcd);if(_0x55d960[_0x1c69('0x2a')][_0x1c69('0x36')]){_0x127e13['where']=_[_0x1c69('0x37')](_0x127e13[_0x1c69('0x34')],{'$or':_[_0x1c69('0x24')](_0x3a6fcd,function(_0x32b58b){if(_0x32b58b[_0x1c69('0x27')]!==_0x1c69('0x38')){var _0x27312a={};_0x27312a[_0x32b58b[_0x1c69('0x22')]]={'$like':'%'+_0x55d960['query'][_0x1c69('0x36')]+'%'};return _0x27312a;}})});}_0x127e13=_[_0x1c69('0x37')]({},_0x127e13,_0x55d960['options']);var _0x5c2330={'where':_0x127e13['where']};return db[_0x1c69('0x39')]['count'](_0x5c2330)[_0x1c69('0xc')](function(_0x156af3){_0x4f6cc2[_0x1c69('0x1c')]=_0x156af3;if(_0x55d960[_0x1c69('0x2a')]['includeAll']){_0x127e13['include']=[{'all':!![]}];}return db[_0x1c69('0x39')]['findAll'](_0x127e13);})['then'](function(_0x4dea6e){_0x4f6cc2[_0x1c69('0x3a')]=_0x4dea6e;return _0x4f6cc2;})[_0x1c69('0xc')](respondWithFilteredResult(_0x366179,_0x127e13))[_0x1c69('0x16')](handleError(_0x366179,null));};exports['show']=function(_0x34fd33,_0x1174ce){var _0x3f09c7={'raw':!![],'where':{'id':_0x34fd33[_0x1c69('0x3b')]['id']}},_0x116b06={};_0x116b06[_0x1c69('0x29')]=_[_0x1c69('0x2b')](db['Network'][_0x1c69('0x25')]);_0x116b06[_0x1c69('0x2a')]=_[_0x1c69('0x2b')](_0x34fd33[_0x1c69('0x2a')]);_0x116b06['filters']=_[_0x1c69('0x2e')](_0x116b06['model'],_0x116b06[_0x1c69('0x2a')]);_0x3f09c7[_0x1c69('0x2d')]=_[_0x1c69('0x2e')](_0x116b06[_0x1c69('0x29')],qs[_0x1c69('0x2f')](_0x34fd33['query'][_0x1c69('0x2f')]));_0x3f09c7[_0x1c69('0x2d')]=_0x3f09c7['attributes']['length']?_0x3f09c7['attributes']:_0x116b06[_0x1c69('0x29')];if(_0x34fd33[_0x1c69('0x2a')][_0x1c69('0x3c')]){_0x3f09c7[_0x1c69('0x3d')]=[{'all':!![]}];}_0x3f09c7=_[_0x1c69('0x37')]({},_0x3f09c7,_0x34fd33['options']);return db[_0x1c69('0x39')][_0x1c69('0x3e')](_0x3f09c7)['then'](handleEntityNotFound(_0x1174ce,null))['then'](respondWithResult(_0x1174ce,null))[_0x1c69('0x16')](handleError(_0x1174ce,null));};exports[_0x1c69('0x3f')]=function(_0x20532f,_0x3246fd){var _0x355dee;return db[_0x1c69('0x39')][_0x1c69('0x3f')](_0x20532f[_0x1c69('0x40')],{'raw':!![]})[_0x1c69('0xc')](function(_0x43b275){_0x355dee=_0x43b275;return db[_0x1c69('0x39')][_0x1c69('0x41')]({'where':{'type':_0x20532f[_0x1c69('0x40')][_0x1c69('0x27')]},'raw':!![]});})['then'](function(_0xd5d74a){if(_0x355dee['type'][_0x1c69('0x42')]()==_0x1c69('0x43')){var _0x23ff33=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x47')),_0x1c69('0x48'));var _0x508adc=ejs['render'](_0x23ff33,{'networks':_0xd5d74a||[]});fs[_0x1c69('0x49')](_0x1c69('0x4a'),_0x508adc);return respondWithRpcPromise('Reload',_0x1c69('0x3f'),{'module':_0x1c69('0x4b')});}else if(_0x355dee['type'][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x3a9f79=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x57dae8=ejs[_0x1c69('0x4e')](_0x3a9f79,{'networks':_0xd5d74a||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x57dae8);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x4a403c=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x51')),_0x1c69('0x48'));var _0x7abda7=ejs[_0x1c69('0x4e')](_0x4a403c,{'networks':_0xd5d74a||[]});fs['writeFileSync'](util[_0x1c69('0x52')](_0x1c69('0x53'),_0x20532f[_0x1c69('0x40')][_0x1c69('0x27')]['toLowerCase']()),_0x7abda7);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x3f'),{'module':_0x1c69('0x54')});}})[_0x1c69('0xc')](function(){return _0x355dee;})[_0x1c69('0xc')](respondWithResult(_0x3246fd,0xc9))[_0x1c69('0x16')](handleError(_0x3246fd,null));};exports['update']=function(_0x2f4f60,_0x4c3a95){var _0x59fb06;return db['Network'][_0x1c69('0x3e')]({'where':{'id':_0x2f4f60[_0x1c69('0x3b')]['id']}})[_0x1c69('0xc')](handleEntityNotFound(_0x4c3a95,null))[_0x1c69('0xc')](saveUpdates(_0x2f4f60['body'],null))[_0x1c69('0xc')](function(_0x5891d2){if(_0x5891d2){_0x59fb06=_0x5891d2;return db[_0x1c69('0x39')][_0x1c69('0x41')]({'where':{'type':_0x59fb06['type']},'raw':!![]});}return null;})['then'](function(_0x412956){if(_0x59fb06[_0x1c69('0x27')][_0x1c69('0x42')]()=='STUN'){var _0x1f5fb5=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x47')),_0x1c69('0x48'));var _0x4d32aa=ejs[_0x1c69('0x4e')](_0x1f5fb5,{'networks':_0x412956||[]});fs['writeFileSync'](_0x1c69('0x4a'),_0x4d32aa);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1e'),{'module':_0x1c69('0x4b')});}else if(_0x59fb06['type'][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x457d90=fs['readFileSync'](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x4297cb=ejs['render'](_0x457d90,{'networks':_0x412956||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x4297cb);return respondWithRpcPromise('Reload','update',{'module':_0x1c69('0x4b')});}else{var _0x22466d=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config['root'],_0x1c69('0x51')),_0x1c69('0x48'));var _0x4ca31a=ejs[_0x1c69('0x4e')](_0x22466d,{'networks':_0x412956||[]});fs[_0x1c69('0x49')](util[_0x1c69('0x52')](_0x1c69('0x53'),_0x2f4f60['body']['type'][_0x1c69('0x55')]()),_0x4ca31a);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1e'),{'module':_0x1c69('0x54')});}})[_0x1c69('0xc')](function(_0xbbf1b){if(_0xbbf1b){return _0x59fb06;}return null;})[_0x1c69('0xc')](respondWithResult(_0x4c3a95,null))[_0x1c69('0x16')](handleError(_0x4c3a95,null));};exports[_0x1c69('0x1f')]=function(_0x463048,_0x552869){var _0x428010;return db[_0x1c69('0x39')][_0x1c69('0x3e')]({'where':{'id':_0x463048['params']['id']}})['then'](function(_0x388dc0){_0x428010=_0x388dc0;return _0x388dc0;})[_0x1c69('0xc')](handleEntityNotFound(_0x552869,null))[_0x1c69('0xc')](removeEntity(_0x552869,null))[_0x1c69('0xc')](function(){if(_0x428010){return db['Network'][_0x1c69('0x41')]({'where':{'type':_0x428010[_0x1c69('0x27')]},'raw':!![]});}})[_0x1c69('0xc')](function(_0x4361c9){if(_0x428010[_0x1c69('0x27')][_0x1c69('0x42')]()==_0x1c69('0x43')){var _0x22dc83=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1c69('0x48'));var _0x39826e=ejs['render'](_0x22dc83,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](_0x1c69('0x4a'),_0x39826e);return respondWithRpcPromise(_0x1c69('0x50'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x428010[_0x1c69('0x27')][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x49e920=fs[_0x1c69('0x44')](path['join'](config['root'],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x5ceaa6=ejs[_0x1c69('0x4e')](_0x49e920,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x5ceaa6);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1f'),{'module':'res_stun_monitor.so'});}else{var _0x5239b4=fs[_0x1c69('0x44')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x1c69('0x48'));var _0x5f1a6d=ejs['render'](_0x5239b4,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](util['format'](_0x1c69('0x53'),_0x428010[_0x1c69('0x27')]['toLowerCase']()),_0x5f1a6d);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1f'),{'module':_0x1c69('0x54')});}})[_0x1c69('0x16')](handleError(_0x552869,null));}; \ No newline at end of file +var _0x6fa2=['format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','status','json','count','offset','set','Content-Range','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','type','merge','options','Network','includeAll','include','findAll','show','params','find','create','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6fa2,0xab));var _0x26fa=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6fa2[_0x46698a];return _0x356db0;};'use strict';var util=require(_0x26fa('0x0'));var path=require(_0x26fa('0x1'));var ejs=require(_0x26fa('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x26fa('0x3'));var logger=require(_0x26fa('0x4'))(_0x26fa('0x5'));var config=require(_0x26fa('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x26fa('0x7'));var client=jayson[_0x26fa('0x8')][_0x26fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc6772d,_0x51a5c5,_0x341b0e,_0x35ecec){return new Promise(function(_0x5ab808,_0x2b55e2){var _0x2aa014=_0x35ecec||client;return _0x2aa014['request'](_0xc6772d,_0x341b0e)['then'](function(_0x215e86){logger['info'](_0x26fa('0xa'),_0x51a5c5,_0x26fa('0xb'));logger['debug'](_0x26fa('0xc'),_0x51a5c5,_0x26fa('0xb'),JSON[_0x26fa('0xd')](_0x215e86));if(_0x215e86['error']){if(_0x215e86['error'][_0x26fa('0xe')]===0x1f4){logger[_0x26fa('0xf')](_0x26fa('0xa'),_0x51a5c5,_0x215e86[_0x26fa('0xf')][_0x26fa('0x10')]);return _0x2b55e2(_0x215e86[_0x26fa('0xf')]['message']);}logger[_0x26fa('0xf')](_0x26fa('0xa'),_0x51a5c5,_0x215e86[_0x26fa('0xf')][_0x26fa('0x10')]);return _0x5ab808(_0x215e86[_0x26fa('0xf')][_0x26fa('0x10')]);}else{logger[_0x26fa('0x11')](_0x26fa('0xa'),_0x51a5c5,_0x26fa('0xb'));_0x5ab808(_0x215e86[_0x26fa('0x12')][_0x26fa('0x10')]);}})[_0x26fa('0x13')](function(_0x145d56){logger[_0x26fa('0xf')](_0x26fa('0xa'),_0x51a5c5,_0x145d56);_0x2b55e2(_0x145d56);});});}function respondWithResult(_0x5a72c3,_0x53253a){_0x53253a=_0x53253a||0xc8;return function(_0x58f990){if(_0x58f990){return _0x5a72c3[_0x26fa('0x14')](_0x53253a)[_0x26fa('0x15')](_0x58f990);}};}function respondWithFilteredResult(_0x389fef,_0x110963){return function(_0x320ddf){if(_0x320ddf){var _0x55ccb9=typeof _0x110963['offset']==='undefined'&&typeof _0x110963['limit']==='undefined';var _0x4a1912=_0x320ddf[_0x26fa('0x16')];var _0x808082=_0x55ccb9?0x0:_0x110963[_0x26fa('0x17')];var _0x417fa1=_0x55ccb9?_0x320ddf['count']:_0x110963[_0x26fa('0x17')]+_0x110963['limit'];var _0x2599a1;if(_0x417fa1>=_0x4a1912){_0x417fa1=_0x4a1912;_0x2599a1=0xc8;}else{_0x2599a1=0xce;}_0x389fef['status'](_0x2599a1);return _0x389fef[_0x26fa('0x18')](_0x26fa('0x19'),_0x808082+'-'+_0x417fa1+'/'+_0x4a1912)[_0x26fa('0x15')](_0x320ddf);}return null;};}function saveUpdates(_0x5cf35f){return function(_0x4032a3){if(_0x4032a3){return _0x4032a3['update'](_0x5cf35f)[_0x26fa('0x1a')](function(_0x1c7a76){return _0x1c7a76;});}return null;};}function removeEntity(_0x3db034){return function(_0x5a8a9d){if(_0x5a8a9d){return _0x5a8a9d[_0x26fa('0x1b')]()[_0x26fa('0x1a')](function(){_0x3db034[_0x26fa('0x14')](0xcc)[_0x26fa('0x1c')]();});}};}function handleEntityNotFound(_0x1983d3){return function(_0x40e722){if(!_0x40e722){_0x1983d3[_0x26fa('0x1d')](0x194);}return _0x40e722;};}function handleError(_0x2b73b0,_0x2a22ad){_0x2a22ad=_0x2a22ad||0x1f4;return function(_0x288ac0){logger[_0x26fa('0xf')](_0x288ac0[_0x26fa('0x1e')]);if(_0x288ac0[_0x26fa('0x1f')]){delete _0x288ac0[_0x26fa('0x1f')];}_0x2b73b0[_0x26fa('0x14')](_0x2a22ad)[_0x26fa('0x20')](_0x288ac0);};}exports[_0x26fa('0x21')]=function(_0x275ce8,_0x359797){var _0x417f3f={},_0x1395b4={},_0x2021fa={'count':0x0,'rows':[]};var _0x516120=_[_0x26fa('0x22')](db['Network'][_0x26fa('0x23')],function(_0x5d97cb){return{'name':_0x5d97cb['fieldName'],'type':_0x5d97cb['type'][_0x26fa('0x24')]};});_0x1395b4['model']=_[_0x26fa('0x22')](_0x516120,'name');_0x1395b4['query']=_[_0x26fa('0x25')](_0x275ce8[_0x26fa('0x26')]);_0x1395b4[_0x26fa('0x27')]=_[_0x26fa('0x28')](_0x1395b4[_0x26fa('0x29')],_0x1395b4[_0x26fa('0x26')]);_0x417f3f['attributes']=_[_0x26fa('0x28')](_0x1395b4[_0x26fa('0x29')],qs[_0x26fa('0x2a')](_0x275ce8['query']['fields']));_0x417f3f[_0x26fa('0x2b')]=_0x417f3f[_0x26fa('0x2b')][_0x26fa('0x2c')]?_0x417f3f[_0x26fa('0x2b')]:_0x1395b4[_0x26fa('0x29')];if(!_0x275ce8['query'][_0x26fa('0x2d')]('nolimit')){_0x417f3f[_0x26fa('0x2e')]=qs[_0x26fa('0x2e')](_0x275ce8['query'][_0x26fa('0x2e')]);_0x417f3f[_0x26fa('0x17')]=qs[_0x26fa('0x17')](_0x275ce8[_0x26fa('0x26')]['offset']);}_0x417f3f['order']=qs[_0x26fa('0x2f')](_0x275ce8[_0x26fa('0x26')][_0x26fa('0x2f')]);_0x417f3f[_0x26fa('0x30')]=qs['filters'](_[_0x26fa('0x31')](_0x275ce8['query'],_0x1395b4[_0x26fa('0x27')]),_0x516120);if(_0x275ce8['query'][_0x26fa('0x32')]){_0x417f3f['where']=_['merge'](_0x417f3f['where'],{'$or':_[_0x26fa('0x22')](_0x516120,function(_0x59f571){if(_0x59f571[_0x26fa('0x33')]!=='VIRTUAL'){var _0x4262c9={};_0x4262c9[_0x59f571['name']]={'$like':'%'+_0x275ce8['query']['filter']+'%'};return _0x4262c9;}})});}_0x417f3f=_[_0x26fa('0x34')]({},_0x417f3f,_0x275ce8[_0x26fa('0x35')]);var _0x299b3f={'where':_0x417f3f[_0x26fa('0x30')]};return db[_0x26fa('0x36')]['count'](_0x299b3f)['then'](function(_0x34468c){_0x2021fa[_0x26fa('0x16')]=_0x34468c;if(_0x275ce8[_0x26fa('0x26')][_0x26fa('0x37')]){_0x417f3f[_0x26fa('0x38')]=[{'all':!![]}];}return db['Network'][_0x26fa('0x39')](_0x417f3f);})[_0x26fa('0x1a')](function(_0x1a2784){_0x2021fa['rows']=_0x1a2784;return _0x2021fa;})['then'](respondWithFilteredResult(_0x359797,_0x417f3f))[_0x26fa('0x13')](handleError(_0x359797,null));};exports[_0x26fa('0x3a')]=function(_0x5598bf,_0x2d8fd7){var _0x2c8c96={'raw':!![],'where':{'id':_0x5598bf[_0x26fa('0x3b')]['id']}},_0x2d3ecc={};_0x2d3ecc[_0x26fa('0x29')]=_[_0x26fa('0x25')](db[_0x26fa('0x36')][_0x26fa('0x23')]);_0x2d3ecc['query']=_['keys'](_0x5598bf['query']);_0x2d3ecc[_0x26fa('0x27')]=_[_0x26fa('0x28')](_0x2d3ecc[_0x26fa('0x29')],_0x2d3ecc[_0x26fa('0x26')]);_0x2c8c96['attributes']=_['intersection'](_0x2d3ecc[_0x26fa('0x29')],qs[_0x26fa('0x2a')](_0x5598bf[_0x26fa('0x26')][_0x26fa('0x2a')]));_0x2c8c96[_0x26fa('0x2b')]=_0x2c8c96[_0x26fa('0x2b')]['length']?_0x2c8c96[_0x26fa('0x2b')]:_0x2d3ecc[_0x26fa('0x29')];if(_0x5598bf[_0x26fa('0x26')]['includeAll']){_0x2c8c96[_0x26fa('0x38')]=[{'all':!![]}];}_0x2c8c96=_[_0x26fa('0x34')]({},_0x2c8c96,_0x5598bf[_0x26fa('0x35')]);return db[_0x26fa('0x36')][_0x26fa('0x3c')](_0x2c8c96)[_0x26fa('0x1a')](handleEntityNotFound(_0x2d8fd7,null))['then'](respondWithResult(_0x2d8fd7,null))[_0x26fa('0x13')](handleError(_0x2d8fd7,null));};exports[_0x26fa('0x3d')]=function(_0x4f8c4c,_0x17f635){var _0x4e670e;return db[_0x26fa('0x36')][_0x26fa('0x3d')](_0x4f8c4c[_0x26fa('0x3e')],{'raw':!![]})[_0x26fa('0x1a')](function(_0x31bea1){_0x4e670e=_0x31bea1;return db[_0x26fa('0x36')][_0x26fa('0x39')]({'where':{'type':_0x4f8c4c['body'][_0x26fa('0x33')]},'raw':!![]});})[_0x26fa('0x1a')](function(_0x1eaff6){if(_0x4e670e[_0x26fa('0x33')]['toUpperCase']()=='STUN'){var _0x16f91d=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x42')),'utf8');var _0x4bc0f9=ejs[_0x26fa('0x43')](_0x16f91d,{'networks':_0x1eaff6||[]});fs['writeFileSync'](_0x26fa('0x44'),_0x4bc0f9);return respondWithRpcPromise(_0x26fa('0x45'),_0x26fa('0x3d'),{'module':_0x26fa('0x46')});}else if(_0x4e670e['type'][_0x26fa('0x47')]()==_0x26fa('0x48')){var _0x3d2e56=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x49')),_0x26fa('0x4a'));var _0xf6eb0e=ejs[_0x26fa('0x43')](_0x3d2e56,{'networks':_0x1eaff6||[]});fs['writeFileSync'](_0x26fa('0x4b'),_0xf6eb0e);return respondWithRpcPromise('Reload',_0x26fa('0x3d'),{'module':_0x26fa('0x46')});}else{var _0x4a68f8=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config['root'],_0x26fa('0x4c')),'utf8');var _0x4e51b0=ejs[_0x26fa('0x43')](_0x4a68f8,{'networks':_0x1eaff6||[]});fs[_0x26fa('0x4d')](util[_0x26fa('0x4e')](_0x26fa('0x4f'),_0x4f8c4c[_0x26fa('0x3e')]['type'][_0x26fa('0x50')]()),_0x4e51b0);return respondWithRpcPromise(_0x26fa('0x45'),'create',{'module':_0x26fa('0x51')});}})[_0x26fa('0x1a')](function(){return _0x4e670e;})[_0x26fa('0x1a')](respondWithResult(_0x17f635,0xc9))[_0x26fa('0x13')](handleError(_0x17f635,null));};exports[_0x26fa('0x52')]=function(_0x18c2b0,_0x120268){var _0x3a3395;return db[_0x26fa('0x36')]['find']({'where':{'id':_0x18c2b0[_0x26fa('0x3b')]['id']}})['then'](handleEntityNotFound(_0x120268,null))[_0x26fa('0x1a')](saveUpdates(_0x18c2b0['body'],null))[_0x26fa('0x1a')](function(_0x1d6bae){if(_0x1d6bae){_0x3a3395=_0x1d6bae;return db['Network'][_0x26fa('0x39')]({'where':{'type':_0x3a3395['type']},'raw':!![]});}return null;})['then'](function(_0xb7d7b8){if(_0x3a3395[_0x26fa('0x33')][_0x26fa('0x47')]()=='STUN'){var _0x2523b7=fs['readFileSync'](path['join'](config['root'],_0x26fa('0x42')),_0x26fa('0x4a'));var _0x3eccbc=ejs['render'](_0x2523b7,{'networks':_0xb7d7b8||[]});fs[_0x26fa('0x4d')]('/etc/asterisk/stun_xcally.conf',_0x3eccbc);return respondWithRpcPromise('Reload',_0x26fa('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x3a3395['type'][_0x26fa('0x47')]()=='TURN'){var _0x5dc798=fs['readFileSync'](path[_0x26fa('0x40')](config['root'],_0x26fa('0x49')),_0x26fa('0x4a'));var _0x508f7e=ejs[_0x26fa('0x43')](_0x5dc798,{'networks':_0xb7d7b8||[]});fs['writeFileSync'](_0x26fa('0x4b'),_0x508f7e);return respondWithRpcPromise(_0x26fa('0x45'),_0x26fa('0x52'),{'module':_0x26fa('0x46')});}else{var _0x10f919=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x4c')),_0x26fa('0x4a'));var _0x867032=ejs[_0x26fa('0x43')](_0x10f919,{'networks':_0xb7d7b8||[]});fs[_0x26fa('0x4d')](util[_0x26fa('0x4e')](_0x26fa('0x4f'),_0x18c2b0[_0x26fa('0x3e')][_0x26fa('0x33')][_0x26fa('0x50')]()),_0x867032);return respondWithRpcPromise(_0x26fa('0x45'),_0x26fa('0x52'),{'module':_0x26fa('0x51')});}})['then'](function(_0xf88cda){if(_0xf88cda){return _0x3a3395;}return null;})[_0x26fa('0x1a')](respondWithResult(_0x120268,null))['catch'](handleError(_0x120268,null));};exports[_0x26fa('0x1b')]=function(_0x4698e6,_0x55c40c){var _0x1b6192;return db[_0x26fa('0x36')]['find']({'where':{'id':_0x4698e6[_0x26fa('0x3b')]['id']}})[_0x26fa('0x1a')](function(_0x2204ef){_0x1b6192=_0x2204ef;return _0x2204ef;})[_0x26fa('0x1a')](handleEntityNotFound(_0x55c40c,null))[_0x26fa('0x1a')](removeEntity(_0x55c40c,null))[_0x26fa('0x1a')](function(){if(_0x1b6192){return db[_0x26fa('0x36')][_0x26fa('0x39')]({'where':{'type':_0x1b6192[_0x26fa('0x33')]},'raw':!![]});}})[_0x26fa('0x1a')](function(_0x1c38b5){if(_0x1b6192[_0x26fa('0x33')][_0x26fa('0x47')]()=='STUN'){var _0x3f4042=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x42')),_0x26fa('0x4a'));var _0x31b050=ejs['render'](_0x3f4042,{'networks':_0x1c38b5||[]});fs[_0x26fa('0x4d')](_0x26fa('0x44'),_0x31b050);return respondWithRpcPromise(_0x26fa('0x45'),'destroy',{'module':_0x26fa('0x46')});}else if(_0x1b6192[_0x26fa('0x33')][_0x26fa('0x47')]()=='TURN'){var _0x111718=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x49')),_0x26fa('0x4a'));var _0x527aef=ejs['render'](_0x111718,{'networks':_0x1c38b5||[]});fs['writeFileSync'](_0x26fa('0x4b'),_0x527aef);return respondWithRpcPromise(_0x26fa('0x45'),_0x26fa('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x3f0daa=fs[_0x26fa('0x3f')](path[_0x26fa('0x40')](config[_0x26fa('0x41')],_0x26fa('0x4c')),_0x26fa('0x4a'));var _0x1cde5c=ejs[_0x26fa('0x43')](_0x3f0daa,{'networks':_0x1c38b5||[]});fs['writeFileSync'](util[_0x26fa('0x4e')](_0x26fa('0x4f'),_0x1b6192[_0x26fa('0x33')][_0x26fa('0x50')]()),_0x1cde5c);return respondWithRpcPromise(_0x26fa('0x45'),_0x26fa('0x1b'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x55c40c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 49aa5db..b97bd1e 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 _0x0e9f=['moment','path','./network.attributes','exports','Network','network','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e9f,0x116));var _0xf0e9=function(_0x142a38,_0x225944){_0x142a38=_0x142a38-0x0;var _0xcf662c=_0x0e9f[_0x142a38];return _0xcf662c;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./network.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b11a8,_0x10e0c4){var _0x558b7e=function(_0x254d9b){while(--_0x254d9b){_0x5b11a8['push'](_0x5b11a8['shift']());}};_0x558b7e(++_0x10e0c4);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb4e6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index b15269f..207ea8e 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5a9c2d,_0x4350fb){_0x5a9c2d=_0x5a9c2d-0x0;var _0x4269bb=_0x7a54[_0x5a9c2d];return _0x4269bb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x3ae565,_0x191c12){_0x3ae565=_0x3ae565-0x0;var _0x55fafd=_0x7a54[_0x3ae565];return _0x55fafd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7d63912..4cef0e9 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 _0xdf5b=['isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xdf5b,0x12e));var _0xbdf5=function(_0x218484,_0x1723d0){_0x218484=_0x218484-0x0;var _0x49bd03=_0xdf5b[_0x218484];return _0x49bd03;};'use strict';var multer=require(_0xbdf5('0x0'));var util=require(_0xbdf5('0x1'));var path=require(_0xbdf5('0x2'));var timeout=require(_0xbdf5('0x3'));var express=require('express');var router=express[_0xbdf5('0x4')]();var fs_extra=require(_0xbdf5('0x5'));var auth=require(_0xbdf5('0x6'));var interaction=require(_0xbdf5('0x7'));var config=require('../../config/environment');var controller=require(_0xbdf5('0x8'));router[_0xbdf5('0x9')]('/',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0xb')]);router[_0xbdf5('0x9')](_0xbdf5('0xc'),auth[_0xbdf5('0xa')](),controller['describe']);router[_0xbdf5('0x9')](_0xbdf5('0xd'),auth[_0xbdf5('0xa')](),controller['show']);router[_0xbdf5('0x9')](_0xbdf5('0xe'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0xf')]);router[_0xbdf5('0x9')](_0xbdf5('0x10'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x11')]);router[_0xbdf5('0x9')](_0xbdf5('0x12'),auth[_0xbdf5('0xa')](),controller['getApplications']);router[_0xbdf5('0x9')](_0xbdf5('0x13'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x14')]);router[_0xbdf5('0x9')](_0xbdf5('0x15'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x16')]);router[_0xbdf5('0x17')]('/',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x18')]);router[_0xbdf5('0x17')](_0xbdf5('0xe'),auth[_0xbdf5('0xa')](),controller['addDisposition']);router[_0xbdf5('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbdf5('0x19')]);router['post'](_0xbdf5('0x1a'),controller[_0xbdf5('0x1b')]);router['post'](_0xbdf5('0x12'),auth['isAuthenticated'](),controller[_0xbdf5('0x1c')]);router[_0xbdf5('0x17')]('/:id/users',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x1d')]);router[_0xbdf5('0x17')](_0xbdf5('0x1e'),auth['isAuthenticated'](),controller[_0xbdf5('0x1f')]);router[_0xbdf5('0x20')](_0xbdf5('0xd'),auth['isAuthenticated'](),controller[_0xbdf5('0x21')]);router[_0xbdf5('0x22')](_0xbdf5('0xd'),auth['isAuthenticated'](),controller[_0xbdf5('0x23')]);router[_0xbdf5('0x22')]('/:id/dispositions',auth[_0xbdf5('0xa')](),controller['removeDispositions']);router[_0xbdf5('0x22')](_0xbdf5('0x10'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x24')]);router[_0xbdf5('0x22')](_0xbdf5('0x15'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x25')]);module[_0xbdf5('0x26')]=router; \ No newline at end of file +var _0x54c3=['addApplications','addAgents','send','put','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','notify','/:id/applications'];(function(_0x2aa3c0,_0x816062){var _0x1efaf9=function(_0x7b2934){while(--_0x7b2934){_0x2aa3c0['push'](_0x2aa3c0['shift']());}};_0x1efaf9(++_0x816062);}(_0x54c3,0x7f));var _0x354c=function(_0x44c37d,_0x19119f){_0x44c37d=_0x44c37d-0x0;var _0x29e087=_0x54c3[_0x44c37d];return _0x29e087;};'use strict';var multer=require(_0x354c('0x0'));var util=require(_0x354c('0x1'));var path=require(_0x354c('0x2'));var timeout=require(_0x354c('0x3'));var express=require(_0x354c('0x4'));var router=express[_0x354c('0x5')]();var fs_extra=require(_0x354c('0x6'));var auth=require(_0x354c('0x7'));var interaction=require(_0x354c('0x8'));var config=require('../../config/environment');var controller=require(_0x354c('0x9'));router[_0x354c('0xa')]('/',auth[_0x354c('0xb')](),controller[_0x354c('0xc')]);router[_0x354c('0xa')](_0x354c('0xd'),auth['isAuthenticated'](),controller[_0x354c('0xe')]);router['get'](_0x354c('0xf'),auth[_0x354c('0xb')](),controller['show']);router[_0x354c('0xa')](_0x354c('0x10'),auth['isAuthenticated'](),controller[_0x354c('0x11')]);router[_0x354c('0xa')]('/:id/canned_answers',auth[_0x354c('0xb')](),controller[_0x354c('0x12')]);router[_0x354c('0xa')]('/:id/applications',auth[_0x354c('0xb')](),controller[_0x354c('0x13')]);router[_0x354c('0xa')](_0x354c('0x14'),auth[_0x354c('0xb')](),controller[_0x354c('0x15')]);router[_0x354c('0xa')]('/:id/users',auth[_0x354c('0xb')](),controller[_0x354c('0x16')]);router[_0x354c('0x17')]('/',auth[_0x354c('0xb')](),controller[_0x354c('0x18')]);router[_0x354c('0x17')](_0x354c('0x10'),auth[_0x354c('0xb')](),controller[_0x354c('0x19')]);router[_0x354c('0x17')](_0x354c('0x1a'),auth[_0x354c('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x354c('0x1b')]);router[_0x354c('0x17')](_0x354c('0x1c'),auth[_0x354c('0xb')](),controller[_0x354c('0x1d')]);router['post']('/:id/users',auth[_0x354c('0xb')](),controller[_0x354c('0x1e')]);router['post']('/:id/send',auth[_0x354c('0xb')](),controller[_0x354c('0x1f')]);router[_0x354c('0x20')]('/:id',auth[_0x354c('0xb')](),controller[_0x354c('0x21')]);router[_0x354c('0x22')]('/:id',auth[_0x354c('0xb')](),controller[_0x354c('0x23')]);router[_0x354c('0x22')](_0x354c('0x10'),auth[_0x354c('0xb')](),controller['removeDispositions']);router[_0x354c('0x22')](_0x354c('0x1a'),auth[_0x354c('0xb')](),controller['removeAnswers']);router['delete'](_0x354c('0x24'),auth[_0x354c('0xb')](),controller[_0x354c('0x25')]);module[_0x354c('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cdcd121..6c6f314 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 _0xbda9=['generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbda9,0x7f));var _0x9bda=function(_0x5e89b0,_0x21eb6f){_0x5e89b0=_0x5e89b0-0x0;var _0x13b98a=_0xbda9[_0x5e89b0];return _0x13b98a;};'use strict';var Sequelize=require(_0x9bda('0x0'));var rs=require(_0x9bda('0x1'));module[_0x9bda('0x2')]={'name':{'type':Sequelize[_0x9bda('0x3')],'unique':_0x9bda('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x9bda('0x3')]},'token':{'type':Sequelize[_0x9bda('0x3')],'defaultValue':function(){return rs[_0x9bda('0x5')]();}},'replyUri':{'type':Sequelize[_0x9bda('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9bda('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9bda('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9bda('0x3')]},'queueTransfer':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![],'comment':_0x9bda('0x9'),'set':function(_0x56be94){if(!_0x56be94)this[_0x9bda('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x9bda('0xb'),_0x56be94);}}}; \ No newline at end of file +var _0x9a47=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x3bbd21,_0x23f22d){var _0x11908b=function(_0x337f92){while(--_0x337f92){_0x3bbd21['push'](_0x3bbd21['shift']());}};_0x11908b(++_0x23f22d);}(_0x9a47,0x189));var _0x79a4=function(_0x1610c9,_0x6da33c){_0x1610c9=_0x1610c9-0x0;var _0x42f069=_0x9a47[_0x1610c9];return _0x42f069;};'use strict';var Sequelize=require(_0x79a4('0x0'));var rs=require(_0x79a4('0x1'));module[_0x79a4('0x2')]={'name':{'type':Sequelize[_0x79a4('0x3')],'unique':_0x79a4('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x79a4('0x3')],'defaultValue':function(){return rs[_0x79a4('0x5')]();}},'replyUri':{'type':Sequelize[_0x79a4('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x79a4('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x79a4('0x6')],'defaultValue':function(){return _0x79a4('0x7');}},'notificationSound':{'type':Sequelize[_0x79a4('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x79a4('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x79a4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x79a4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x79a4('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x79a4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x79a4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x79a4('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x79a4('0x8')],'defaultValue':![],'comment':_0x79a4('0xa'),'set':function(_0x54f16f){if(!_0x54f16f)this[_0x79a4('0xb')](_0x79a4('0xc'),null);this[_0x79a4('0xb')](_0x79a4('0xd'),_0x54f16f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3b1ebce..0e7d14a 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 _0x5353=['OpenchannelAccount','includeAll','include','findAll','rows','params','mandatoryDispositionPause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','ListId','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x54525d,_0x4e862c){var _0x23c23b=function(_0x4b6057){while(--_0x4b6057){_0x54525d['push'](_0x54525d['shift']());}};_0x23c23b(++_0x4e862c);}(_0x5353,0x12f));var _0x3535=function(_0x48403e,_0x275076){_0x48403e=_0x48403e-0x0;var _0x58f4f7=_0x5353[_0x48403e];return _0x58f4f7;};'use strict';var emlformat=require(_0x3535('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3535('0x1'));var jsonpatch=require(_0x3535('0x2'));var rp=require(_0x3535('0x3'));var moment=require(_0x3535('0x4'));var BPromise=require(_0x3535('0x5'));var Mustache=require(_0x3535('0x6'));var util=require(_0x3535('0x7'));var path=require(_0x3535('0x8'));var sox=require(_0x3535('0x9'));var csv=require(_0x3535('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3535('0xb'));var _=require('lodash');var squel=require(_0x3535('0xc'));var crypto=require(_0x3535('0xd'));var jsforce=require(_0x3535('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3535('0xa'));var querystring=require(_0x3535('0xf'));var Papa=require(_0x3535('0x10'));var Redis=require(_0x3535('0x11'));var authService=require(_0x3535('0x12'));var qs=require(_0x3535('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3535('0x14'));var logger=require(_0x3535('0x15'))('api');var utils=require(_0x3535('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3535('0x17'))['db'];config[_0x3535('0x18')]=_[_0x3535('0x19')](config[_0x3535('0x18')],{'host':_0x3535('0x1a'),'port':0x18eb});var socket=require(_0x3535('0x1b'))(new Redis(config[_0x3535('0x18')]));require('./openchannelAccount.socket')[_0x3535('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3535('0x1d')][_0x3535('0x1e')]({'port':0x232c});var client9002=jayson[_0x3535('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f18da,_0x4b7c81,_0x3451f2,_0x4dd36b){return new BPromise(function(_0x519c33,_0x4243c1){var _0x222937=_0x4dd36b||client;return _0x222937[_0x3535('0x1f')](_0x1f18da,_0x3451f2)[_0x3535('0x20')](function(_0x1dfdfe){logger[_0x3535('0x21')](_0x3535('0x22'),_0x4b7c81,_0x3535('0x23'));logger[_0x3535('0x24')](_0x3535('0x25'),_0x4b7c81,_0x3535('0x23'),JSON[_0x3535('0x26')](_0x1dfdfe));if(_0x1dfdfe['error']){if(_0x1dfdfe['error'][_0x3535('0x27')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4b7c81,_0x1dfdfe[_0x3535('0x28')][_0x3535('0x29')]);return _0x4243c1(_0x1dfdfe[_0x3535('0x28')]['message']);}logger['error'](_0x3535('0x22'),_0x4b7c81,_0x1dfdfe['error'][_0x3535('0x29')]);return _0x519c33(_0x1dfdfe['error'][_0x3535('0x29')]);}else{logger['info'](_0x3535('0x22'),_0x4b7c81,'request\x20sent');_0x519c33(_0x1dfdfe['result'][_0x3535('0x29')]);}})[_0x3535('0x2a')](function(_0x5a25d1){logger[_0x3535('0x28')](_0x3535('0x22'),_0x4b7c81,_0x5a25d1);_0x4243c1(_0x5a25d1);});});}function respondWithStatusCode(_0x5aa1d4,_0xefa28c){_0xefa28c=_0xefa28c||0xcc;return function(_0x51ba08){if(_0x51ba08){return _0x5aa1d4[_0x3535('0x2b')](_0xefa28c);}return _0x5aa1d4[_0x3535('0x2c')](_0xefa28c)[_0x3535('0x2d')]();};}function respondWithResult(_0x380948,_0x40009c){_0x40009c=_0x40009c||0xc8;return function(_0x2405b6){if(_0x2405b6){return _0x380948[_0x3535('0x2c')](_0x40009c)[_0x3535('0x2e')](_0x2405b6);}};}function respondWithFilteredResult(_0x4c993a,_0x167e64){return function(_0x17e2a0){if(_0x17e2a0){var _0x4cf180=typeof _0x167e64[_0x3535('0x2f')]===_0x3535('0x30')&&typeof _0x167e64[_0x3535('0x31')]==='undefined';var _0x57fcfa=_0x17e2a0[_0x3535('0x32')];var _0x3ccb51=_0x4cf180?0x0:_0x167e64['offset'];var _0x33a8e1=_0x4cf180?_0x17e2a0[_0x3535('0x32')]:_0x167e64[_0x3535('0x2f')]+_0x167e64[_0x3535('0x31')];var _0x5765e3;if(_0x33a8e1>=_0x57fcfa){_0x33a8e1=_0x57fcfa;_0x5765e3=0xc8;}else{_0x5765e3=0xce;}_0x4c993a[_0x3535('0x2c')](_0x5765e3);return _0x4c993a[_0x3535('0x33')]('Content-Range',_0x3ccb51+'-'+_0x33a8e1+'/'+_0x57fcfa)[_0x3535('0x2e')](_0x17e2a0);}return null;};}function patchUpdates(_0x1509b0){return function(_0x3a982e){try{jsonpatch[_0x3535('0x34')](_0x3a982e,_0x1509b0,!![]);}catch(_0x358c73){return BPromise[_0x3535('0x35')](_0x358c73);}return _0x3a982e[_0x3535('0x36')]();};}function saveUpdates(_0x59347e,_0x57b875){return function(_0x2c6cb4){if(_0x2c6cb4){return _0x2c6cb4[_0x3535('0x37')](_0x59347e)[_0x3535('0x20')](function(_0x1dd026){return _0x1dd026;});}return null;};}function removeEntity(_0x3f5558,_0x52051e){return function(_0x1cdce8){if(_0x1cdce8){return _0x1cdce8[_0x3535('0x38')]()['then'](function(){var _0x3a99ab=_0x1cdce8[_0x3535('0x39')]({'plain':!![]});var _0x3fd98f=_0x3535('0x3a');return db[_0x3535('0x3b')][_0x3535('0x38')]({'where':{'type':_0x3fd98f,'resourceId':_0x3a99ab['id']}})['then'](function(){return _0x1cdce8;});})[_0x3535('0x20')](function(){_0x3f5558['status'](0xcc)[_0x3535('0x2d')]();});}};}function handleEntityNotFound(_0x3ca1b4,_0x52dacb){return function(_0x40d4ad){if(!_0x40d4ad){_0x3ca1b4[_0x3535('0x2b')](0x194);}return _0x40d4ad;};}function handleError(_0x321da3,_0x264465){_0x264465=_0x264465||0x1f4;return function(_0x54b5a9){logger['error'](_0x54b5a9[_0x3535('0x3c')]);if(_0x54b5a9[_0x3535('0x3d')]){delete _0x54b5a9[_0x3535('0x3d')];}_0x321da3[_0x3535('0x2c')](_0x264465)[_0x3535('0x3e')](_0x54b5a9);};}exports[_0x3535('0x3f')]=function(_0x4778e3,_0x396fd9){var _0x28e187={'include':[{'model':db[_0x3535('0x40')],'as':'mandatoryDispositionPause'}]},_0x16ed33={},_0x2aec24={'count':0x0,'rows':[]};var _0x46aabb=_[_0x3535('0x41')](db['OpenchannelAccount'][_0x3535('0x42')],function(_0x22502a){return{'name':_0x22502a[_0x3535('0x43')],'type':_0x22502a[_0x3535('0x44')][_0x3535('0x45')]};});_0x16ed33[_0x3535('0x46')]=_['map'](_0x46aabb,_0x3535('0x3d'));_0x16ed33[_0x3535('0x47')]=_[_0x3535('0x48')](_0x4778e3['query']);_0x16ed33[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x16ed33[_0x3535('0x46')],_0x16ed33[_0x3535('0x47')]);_0x28e187[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x16ed33[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x4778e3[_0x3535('0x47')][_0x3535('0x4c')]));_0x28e187[_0x3535('0x4b')]=_0x28e187[_0x3535('0x4b')]['length']?_0x28e187[_0x3535('0x4b')]:_0x16ed33['model'];if(!_0x4778e3[_0x3535('0x47')]['hasOwnProperty'](_0x3535('0x4d'))){_0x28e187[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x4778e3[_0x3535('0x47')][_0x3535('0x31')]);_0x28e187['offset']=qs[_0x3535('0x2f')](_0x4778e3[_0x3535('0x47')]['offset']);}_0x28e187[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x4778e3[_0x3535('0x47')][_0x3535('0x4f')]);_0x28e187[_0x3535('0x50')]=qs[_0x3535('0x49')](_['pick'](_0x4778e3[_0x3535('0x47')],_0x16ed33[_0x3535('0x49')]),_0x46aabb);if(_0x4778e3['query'][_0x3535('0x51')]){_0x28e187['where']=_[_0x3535('0x52')](_0x28e187[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x46aabb,function(_0x548df7){if(_0x548df7[_0x3535('0x44')]!==_0x3535('0x53')){var _0x313778={};_0x313778[_0x548df7[_0x3535('0x3d')]]={'$like':'%'+_0x4778e3[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x313778;}})});}_0x28e187=_[_0x3535('0x52')]({},_0x28e187,_0x4778e3[_0x3535('0x54')]);var _0x5c881d={'where':_0x28e187[_0x3535('0x50')]};return db[_0x3535('0x55')][_0x3535('0x32')](_0x5c881d)['then'](function(_0x4c0000){_0x2aec24[_0x3535('0x32')]=_0x4c0000;if(_0x4778e3[_0x3535('0x47')][_0x3535('0x56')]){_0x28e187[_0x3535('0x57')]=[{'all':!![]}];}return db[_0x3535('0x55')][_0x3535('0x58')](_0x28e187);})['then'](function(_0x1f17ed){_0x2aec24[_0x3535('0x59')]=_0x1f17ed;return _0x2aec24;})[_0x3535('0x20')](respondWithFilteredResult(_0x396fd9,_0x28e187))[_0x3535('0x2a')](handleError(_0x396fd9,null));};exports['show']=function(_0x5b59b2,_0x4964a5){var _0x1dc900={'raw':![],'where':{'id':_0x5b59b2[_0x3535('0x5a')]['id']},'include':[{'model':db[_0x3535('0x40')],'as':_0x3535('0x5b')}]},_0xe7561c={};_0xe7561c[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x55')][_0x3535('0x42')]);_0xe7561c[_0x3535('0x47')]=_[_0x3535('0x48')](_0x5b59b2[_0x3535('0x47')]);_0xe7561c[_0x3535('0x49')]=_[_0x3535('0x4a')](_0xe7561c[_0x3535('0x46')],_0xe7561c[_0x3535('0x47')]);_0x1dc900[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0xe7561c[_0x3535('0x46')],qs['fields'](_0x5b59b2['query'][_0x3535('0x4c')]));_0x1dc900['attributes']=_0x1dc900[_0x3535('0x4b')][_0x3535('0x5c')]?_0x1dc900['attributes']:_0xe7561c[_0x3535('0x46')];if(_0x5b59b2[_0x3535('0x47')][_0x3535('0x56')]){_0x1dc900[_0x3535('0x57')]=[{'all':!![]}];}_0x1dc900=_[_0x3535('0x52')]({},_0x1dc900,_0x5b59b2['options']);return db[_0x3535('0x55')][_0x3535('0x5d')](_0x1dc900)['then'](handleEntityNotFound(_0x4964a5,null))['then'](respondWithResult(_0x4964a5,null))['catch'](handleError(_0x4964a5,null));};exports['create']=function(_0x459d17,_0x3408f8){return db[_0x3535('0x55')][_0x3535('0x5e')](_0x459d17[_0x3535('0x5f')],{})['then'](function(_0xd0c9b9){var _0xc61089=_0x459d17[_0x3535('0x60')]['get']({'plain':!![]});if(!_0xc61089)throw new Error(_0x3535('0x61'));if(_0xc61089[_0x3535('0x62')]==='user'){var _0x4a811b=_0xd0c9b9[_0x3535('0x39')]({'plain':!![]});var _0x5e1067=_0x3535('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x5e1067,'userProfileId':_0xc61089[_0x3535('0x63')]},'raw':!![]})[_0x3535('0x20')](function(_0x4d16bd){if(_0x4d16bd&&_0x4d16bd[_0x3535('0x64')]===0x0){return db[_0x3535('0x3b')][_0x3535('0x5e')]({'name':_0x4a811b[_0x3535('0x3d')],'resourceId':_0x4a811b['id'],'type':_0x4d16bd[_0x3535('0x3d')],'sectionId':_0x4d16bd['id']},{})[_0x3535('0x20')](function(){return _0xd0c9b9;});}else{return _0xd0c9b9;}})[_0x3535('0x2a')](function(_0x1dd4ec){logger[_0x3535('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dd4ec);throw _0x1dd4ec;});}return _0xd0c9b9;})[_0x3535('0x20')](respondWithResult(_0x3408f8,0xc9))[_0x3535('0x2a')](handleError(_0x3408f8,null));};exports[_0x3535('0x37')]=function(_0x499283,_0x58909a){if(_0x499283['body']['id']){delete _0x499283[_0x3535('0x5f')]['id'];}return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x499283['params']['id']},'include':[{'model':db[_0x3535('0x40')],'as':_0x3535('0x5b')}]})[_0x3535('0x20')](handleEntityNotFound(_0x58909a,null))[_0x3535('0x20')](saveUpdates(_0x499283[_0x3535('0x5f')],null))['then'](respondWithResult(_0x58909a,null))['catch'](handleError(_0x58909a,null));};exports['destroy']=function(_0x107619,_0x28f5e9){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x107619[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x28f5e9,null))['then'](removeEntity(_0x28f5e9,null))[_0x3535('0x2a')](handleError(_0x28f5e9,null));};exports['describe']=function(_0xa9071e,_0x3008f7){return db['OpenchannelAccount']['describe']()[_0x3535('0x20')](respondWithResult(_0x3008f7,null))[_0x3535('0x2a')](handleError(_0x3008f7,null));};exports[_0x3535('0x65')]=function(_0x51de47,_0x31bd65,_0xef83f8){if(_0x51de47[_0x3535('0x5f')]['id']){delete _0x51de47['body']['id'];}return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x51de47[_0x3535('0x5a')]['id']}})['then'](handleEntityNotFound(_0x31bd65,null))[_0x3535('0x20')](function(_0x3600be){if(_0x3600be){_0x51de47[_0x3535('0x5f')][_0x3535('0x66')]=_0x3600be['id'];return db['Disposition']['create'](_0x51de47[_0x3535('0x5f')]);}})[_0x3535('0x20')](respondWithResult(_0x31bd65,null))[_0x3535('0x2a')](handleError(_0x31bd65,null));};exports[_0x3535('0x67')]=function(_0x13f575,_0x2d1d17,_0x1d5d53){var _0xfd4d={'raw':![],'where':{}};var _0x449931={};var _0x22f959={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x13f575[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x2d1d17,null))[_0x3535('0x20')](function(_0x47a30b){if(_0x47a30b){_0x449931['model']=_['keys'](db[_0x3535('0x69')][_0x3535('0x42')]);_0x449931[_0x3535('0x47')]=_[_0x3535('0x48')](_0x13f575[_0x3535('0x47')]);_0x449931[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x449931[_0x3535('0x46')],_0x449931[_0x3535('0x47')]);_0xfd4d[_0x3535('0x4b')]=_['intersection'](_0x449931['model'],qs['fields'](_0x13f575['query'][_0x3535('0x4c')]));_0xfd4d['attributes']=_0xfd4d[_0x3535('0x4b')]['length']?_0xfd4d[_0x3535('0x4b')]:_0x449931[_0x3535('0x46')];if(!_0x13f575[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0xfd4d[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x13f575[_0x3535('0x47')][_0x3535('0x31')]);_0xfd4d[_0x3535('0x2f')]=qs['offset'](_0x13f575[_0x3535('0x47')][_0x3535('0x2f')]);}_0xfd4d[_0x3535('0x4e')]=qs['sort'](_0x13f575[_0x3535('0x47')][_0x3535('0x4f')]);_0xfd4d[_0x3535('0x50')]=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x13f575['query'],_0x449931[_0x3535('0x49')]));_0xfd4d[_0x3535('0x50')][_0x3535('0x66')]=_0x47a30b['id'];if(_0x13f575[_0x3535('0x47')][_0x3535('0x51')]){_0xfd4d['where']=_['merge'](_0xfd4d[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0xfd4d['attributes'],function(_0x25d41c){var _0x266cf5={};_0x266cf5[_0x25d41c]={'$like':'%'+_0x13f575[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x266cf5;})});}_0xfd4d=_['merge']({},_0xfd4d,_0x13f575[_0x3535('0x54')]);return db[_0x3535('0x69')][_0x3535('0x32')]({'where':_0xfd4d['where']})['then'](function(_0x3730e0){_0x22f959[_0x3535('0x32')]=_0x3730e0;if(_0x13f575[_0x3535('0x47')][_0x3535('0x56')]){_0xfd4d[_0x3535('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x3535('0x58')](_0xfd4d);})['then'](function(_0x9640e5){_0x22f959['rows']=_0x9640e5;return _0x22f959;});}})[_0x3535('0x20')](respondWithFilteredResult(_0x2d1d17,_0xfd4d))['catch'](handleError(_0x2d1d17,null));};exports[_0x3535('0x6c')]=function(_0x5df7b1,_0x9b0160,_0x4be76e){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x5df7b1[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x9b0160,null))[_0x3535('0x20')](function(_0x4878a6){if(_0x4878a6){return _0x4878a6[_0x3535('0x6c')](_0x5df7b1['query'][_0x3535('0x6d')]);}})[_0x3535('0x20')](respondWithStatusCode(_0x9b0160,null))['catch'](handleError(_0x9b0160,null));};exports[_0x3535('0x6e')]=function(_0x36337e,_0x26669f,_0x1769c8){if(_0x36337e['body']['id']){delete _0x36337e[_0x3535('0x5f')]['id'];}return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x36337e['params']['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x26669f,null))[_0x3535('0x20')](function(_0x3a271e){if(_0x3a271e){_0x36337e['body']['OpenchannelAccountId']=_0x3a271e['id'];return db[_0x3535('0x6f')][_0x3535('0x5e')](_0x36337e['body']);}})[_0x3535('0x20')](respondWithResult(_0x26669f,null))[_0x3535('0x2a')](handleError(_0x26669f,null));};exports[_0x3535('0x70')]=function(_0x1a5a7b,_0x279091,_0x5de340){var _0x4c278a={'raw':![],'where':{}};var _0x4d311e={};var _0x3802b7={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x1a5a7b['params']['id']}})['then'](handleEntityNotFound(_0x279091,null))[_0x3535('0x20')](function(_0xced1e){if(_0xced1e){_0x4d311e[_0x3535('0x46')]=_['keys'](db[_0x3535('0x6f')][_0x3535('0x42')]);_0x4d311e[_0x3535('0x47')]=_[_0x3535('0x48')](_0x1a5a7b[_0x3535('0x47')]);_0x4d311e[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x4d311e[_0x3535('0x46')],_0x4d311e[_0x3535('0x47')]);_0x4c278a[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x4d311e[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x1a5a7b[_0x3535('0x47')][_0x3535('0x4c')]));_0x4c278a[_0x3535('0x4b')]=_0x4c278a[_0x3535('0x4b')][_0x3535('0x5c')]?_0x4c278a[_0x3535('0x4b')]:_0x4d311e[_0x3535('0x46')];if(!_0x1a5a7b[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0x4c278a[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x1a5a7b[_0x3535('0x47')]['limit']);_0x4c278a['offset']=qs[_0x3535('0x2f')](_0x1a5a7b[_0x3535('0x47')][_0x3535('0x2f')]);}_0x4c278a[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x1a5a7b[_0x3535('0x47')]['sort']);_0x4c278a[_0x3535('0x50')]=qs['filters'](_['pick'](_0x1a5a7b[_0x3535('0x47')],_0x4d311e['filters']));_0x4c278a[_0x3535('0x50')][_0x3535('0x66')]=_0xced1e['id'];if(_0x1a5a7b[_0x3535('0x47')]['filter']){_0x4c278a[_0x3535('0x50')]=_[_0x3535('0x52')](_0x4c278a[_0x3535('0x50')],{'$or':_['map'](_0x4c278a[_0x3535('0x4b')],function(_0xd31081){var _0x3e6d32={};_0x3e6d32[_0xd31081]={'$like':'%'+_0x1a5a7b[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x3e6d32;})});}_0x4c278a=_['merge']({},_0x4c278a,_0x1a5a7b[_0x3535('0x54')]);return db[_0x3535('0x6f')][_0x3535('0x32')]({'where':_0x4c278a['where']})[_0x3535('0x20')](function(_0x27f4a5){_0x3802b7[_0x3535('0x32')]=_0x27f4a5;if(_0x1a5a7b['query'][_0x3535('0x56')]){_0x4c278a[_0x3535('0x57')]=[{'all':!![]}];}return db[_0x3535('0x6f')][_0x3535('0x58')](_0x4c278a);})[_0x3535('0x20')](function(_0x56be4d){_0x3802b7[_0x3535('0x59')]=_0x56be4d;return _0x3802b7;});}})['then'](respondWithFilteredResult(_0x279091,_0x4c278a))[_0x3535('0x2a')](handleError(_0x279091,null));};exports[_0x3535('0x71')]=function(_0x2e3ebe,_0x26ae84,_0x3c874b){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x2e3ebe['params']['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x26ae84,null))[_0x3535('0x20')](function(_0x44cce9){if(_0x44cce9){return _0x44cce9[_0x3535('0x71')](_0x2e3ebe['query'][_0x3535('0x6d')]);}})[_0x3535('0x20')](respondWithStatusCode(_0x26ae84,null))['catch'](handleError(_0x26ae84,null));};exports[_0x3535('0x72')]=function(_0x20c1ce,_0x2ae339,_0x506514){var _0x4091e7={'body':_0x20c1ce[_0x3535('0x5f')],'channel':_0x3535('0x73')};var _0x2349e7=[];var _0x4e755c=[];var _0x3c99ec={};var _0x26b09d=![];return db[_0x3535('0x74')][_0x3535('0x75')]()[_0x3535('0x20')](function(_0x46f29e){if(!_0x46f29e){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x78'));}_0x2349e7=_['difference'](_['keys'](_0x46f29e),[_0x3535('0x79'),_0x3535('0x7a')]);_0x4e755c=_[_0x3535('0x7b')](_[_0x3535('0x48')](_0x46f29e),[_0x3535('0x79'),_0x3535('0x7a'),_0x3535('0x7c'),'ListId']);if(_0x20c1ce[_0x3535('0x5f')]['id']){delete _0x20c1ce[_0x3535('0x5f')]['id'];}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))]('from\x20is\x20mandatory');}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x5f')])||_0x20c1ce[_0x3535('0x5f')][_0x3535('0x5f')]===''){throw new db[(_0x3535('0x76'))]['ValidationError'](_0x3535('0x7f'));}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x81')+_0x4e755c);}if(!_[_0x3535('0x82')](_0x4e755c,_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x83')+_0x4e755c);}_0x3c99ec[_0x20c1ce[_0x3535('0x5f')]['mapKey']]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')];})['then'](function(){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x20c1ce[_0x3535('0x5a')]['id']},'include':[{'model':db[_0x3535('0x84')],'as':_0x3535('0x85'),'include':[{'model':db['CmContact'],'as':_0x3535('0x86'),'where':_0x3c99ec,'limit':0x1,'order':[[_0x3535('0x7a'),_0x3535('0x87')]]}]},{'model':db[_0x3535('0x88')],'as':_0x3535('0x89')}]});})['then'](handleEntityNotFound(_0x2ae339,null))['then'](function(_0xb784fe){if(_0xb784fe&&_0xb784fe[_0x3535('0x85')]){_0x4091e7['account']=_0xb784fe;_0x4091e7[_0x3535('0x8a')]=_0xb784fe[_0x3535('0x89')];_0x4091e7[_0x3535('0x8b')]=_0xb784fe[_0x3535('0x85')];_0x4091e7[_0x3535('0x8a')]=_[_0x3535('0x8c')](_0x4091e7['applications'],[_0x3535('0x8d')],[_0x3535('0x8e')]);if(_0x4091e7[_0x3535('0x8f')]['Applications']){delete _0x4091e7['account'][_0x3535('0x89')];}if(_0x4091e7[_0x3535('0x8f')][_0x3535('0x85')]&&_0x4091e7[_0x3535('0x8f')][_0x3535('0x85')]['Contacts'][_0x3535('0x5c')]){return _0x4091e7['account'][_0x3535('0x85')][_0x3535('0x86')][0x0];}var _0x4c2785=_[_0x3535('0x19')](_0x20c1ce[_0x3535('0x5f')],{'firstName':_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')],'ListId':_0xb784fe['ListId']});_0x4c2785[_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')]]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')];return db[_0x3535('0x74')][_0x3535('0x5e')](_0x4c2785,{'fields':_0x2349e7,'raw':!![]});}})[_0x3535('0x20')](handleEntityNotFound(_0x2ae339,null))[_0x3535('0x20')](function(_0x5ed345){_0x4091e7[_0x3535('0x90')]=_0x5ed345;if(_0x5ed345){var _0x20a35d={'ContactId':_0x5ed345['id'],'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'from':(_0x5ed345[_0x3535('0x91')]||'')+'\x20'+(_0x5ed345[_0x3535('0x92')]||'')};var _0x35ed81={'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'closed':![]};if(_0x20c1ce['body']['threadId']){_0x35ed81['threadId']=_0x20c1ce['body'][_0x3535('0x93')];return db[_0x3535('0x94')]['find']({'where':_0x35ed81})[_0x3535('0x20')](function(_0x1653f3){if(_0x1653f3){return[_0x1653f3,![]];}_0x20a35d[_0x3535('0x93')]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')];_0x20a35d[_0x3535('0x95')]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x95')];return db[_0x3535('0x94')][_0x3535('0x5e')](_0x20a35d)[_0x3535('0x20')](function(_0xc959fd){return[_0xc959fd,!![]];});});}else{_0x35ed81[_0x3535('0x93')]=null;}_0x35ed81['ContactId']=_0x5ed345['id'];return db[_0x3535('0x94')][_0x3535('0x5d')]({'where':_0x35ed81})[_0x3535('0x20')](function(_0x18abad){if(_0x18abad){return[_0x18abad,![]];}return db[_0x3535('0x94')]['create'](_0x20a35d)['then'](function(_0x2093ac){return[_0x2093ac,!![]];});});}})[_0x3535('0x96')](function(_0xe4e44e,_0x25d7b6){if(_0xe4e44e){_0x26b09d=_0x25d7b6;if(!_0x25d7b6){var _0x32b78f={'from':(_0x4091e7[_0x3535('0x90')][_0x3535('0x91')]||'')+'\x20'+(_0x4091e7[_0x3535('0x90')]['lastName']||'')};if(_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')]&&_0x20c1ce[_0x3535('0x5f')]['messageId']&&_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')]!=_0x20c1ce['body'][_0x3535('0x97')]){_0x32b78f['threadId']=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x97')];}return _0xe4e44e['update'](_0x32b78f);}else{return _0xe4e44e;}}})['then'](function(_0x421700){_0x4091e7[_0x3535('0x98')]=_0x421700[_0x3535('0x39')]({'plain':!![]});_0x4091e7[_0x3535('0x98')]['created']=_0x26b09d;if(_0x4091e7[_0x3535('0x98')][_0x3535('0x99')]){if(_0x4091e7['account'][_0x3535('0x9a')]){_0x4091e7[_0x3535('0x8a')][_0x3535('0x9b')]({'id':0x0,'priority':_0x4091e7[_0x3535('0x8a')]['length']+0x1,'app':_0x3535('0x9c'),'appdata':_0x3535('0x9d'),'interval':_0x3535('0x9e')});}}return db[_0x3535('0x9f')][_0x3535('0x5e')]({'body':_0x20c1ce['body'][_0x3535('0x5f')],'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'OpenchannelInteractionId':_0x421700['id'],'direction':'in','ContactId':_0x4091e7[_0x3535('0x90')]['id'],'AttachmentId':_0x20c1ce[_0x3535('0x5f')][_0x3535('0xa0')]});})[_0x3535('0x20')](function(_0x2eb1a8){_0x4091e7[_0x3535('0x29')]=_0x2eb1a8;if(!_0x4091e7['interaction'][_0x3535('0xa1')])return;return db[_0x3535('0xa2')][_0x3535('0x5d')]({'attributes':['id',_0x3535('0x3d')],'where':{'id':_0x4091e7[_0x3535('0x98')][_0x3535('0xa1')]}});})[_0x3535('0x20')](function(_0x2decbd){if(_0x2decbd){_0x4091e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3535('0xa3'),'appdata':_0x2decbd['name']+','+(_0x4091e7['account']['waitForTheAssignedAgent']||0xa),'interval':_0x3535('0x9e')});}if(!_0x4091e7[_0x3535('0x98')][_0x3535('0xa4')])return;return db[_0x3535('0xa5')][_0x3535('0x5d')]({'attributes':['id',_0x3535('0x3d')],'where':{'id':_0x4091e7[_0x3535('0x98')][_0x3535('0xa4')]}});})[_0x3535('0x20')](function(_0xc0ce01){if(_0xc0ce01){_0x4091e7['applications'][_0x3535('0xa6')]({'id':0x0,'priority':0x1,'app':_0x3535('0xa7'),'appdata':_0xc0ce01['name']+','+(_0x4091e7[_0x3535('0x8f')][_0x3535('0xa8')]||0x12c),'interval':_0x3535('0x9e')});}return respondWithRpcPromise('Start','startRouting',_0x4091e7);})[_0x3535('0x20')](function(_0x42068f){respondWithRpcPromise('EventManager',_0x3535('0xa9'),{'event':_0x3535('0x72'),'message':_0x42068f},client9002);return _0x42068f;})[_0x3535('0x20')](respondWithResult(_0x2ae339,null))[_0x3535('0x2a')](handleError(_0x2ae339,null));};exports[_0x3535('0xaa')]=function(_0x14910f,_0x25ce40){var _0xd4d2e4=_0x14910f[_0x3535('0x5a')]['id'];var _0x29a46c=_0x14910f[_0x3535('0x5f')];var _0x56fd9d=0xc8;var _0x245990=null;return db[_0x3535('0xab')][_0x3535('0xac')]({'isolationLevel':db[_0x3535('0xab')]['Transaction'][_0x3535('0xad')][_0x3535('0xae')]},function(_0x45c755){return db[_0x3535('0x55')]['findOne']({'where':{'id':_0xd4d2e4},'transaction':_0x45c755})[_0x3535('0x20')](function(_0x3411d3){if(_0x3411d3){return db[_0x3535('0x88')][_0x3535('0x38')]({'where':{'OpenchannelAccountId':_0xd4d2e4},'transaction':_0x45c755})['then'](function(){var _0x57c2a0=_[_0x3535('0x41')](_0x29a46c,function(_0x268e80){_0x268e80[_0x3535('0x66')]=_0xd4d2e4;return _0x268e80;});return db[_0x3535('0x88')][_0x3535('0xaf')](_0x57c2a0,{'transaction':_0x45c755});});}else{_0x56fd9d=0x194;_0x245990=[];}});})['then'](function(){if(_0x56fd9d!==0x194){return db['OpenchannelApplication'][_0x3535('0xb0')]({'where':{'OpenchannelAccountId':_0xd4d2e4},'order':_0x3535('0x8d')})[_0x3535('0x20')](function(_0x105c5e){_0x245990=_0x105c5e;});}})['catch'](function(_0x129f3e){_0x56fd9d=0x1f4;logger[_0x3535('0x28')](_0x129f3e[_0x3535('0x3c')]);if(_0x129f3e[_0x3535('0x3d')]){delete _0x129f3e[_0x3535('0x3d')];}_0x245990=_0x129f3e;})['finally'](function(){if(_0x245990===null){_0x25ce40[_0x3535('0x2b')](_0x56fd9d);}else{if(_0x56fd9d===0x1f4){_0x25ce40[_0x3535('0x2c')](_0x56fd9d)[_0x3535('0x3e')](_0x245990);}else{_0x25ce40[_0x3535('0x2c')](_0x56fd9d)[_0x3535('0x2e')](_0x245990);}}});};exports['getApplications']=function(_0x25a420,_0x3d9888,_0x41c033){var _0x289195={};var _0x3e5134={};var _0x3b7263;var _0x38bb2f;return db['OpenchannelAccount'][_0x3535('0x68')]({'where':{'id':_0x25a420[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x3d9888,null))['then'](function(_0x51285c){if(_0x51285c){_0x3b7263=_0x51285c;_0x3e5134[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x88')][_0x3535('0x42')]);_0x3e5134[_0x3535('0x47')]=_[_0x3535('0x48')](_0x25a420[_0x3535('0x47')]);_0x3e5134['filters']=_['intersection'](_0x3e5134[_0x3535('0x46')],_0x3e5134['query']);_0x289195['attributes']=_[_0x3535('0x4a')](_0x3e5134[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x25a420[_0x3535('0x47')][_0x3535('0x4c')]));_0x289195['attributes']=_0x289195['attributes'][_0x3535('0x5c')]?_0x289195['attributes']:_0x3e5134[_0x3535('0x46')];_0x289195[_0x3535('0x4e')]=qs['sort'](_0x25a420[_0x3535('0x47')][_0x3535('0x4f')]);_0x289195['where']=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x25a420['query'],_0x3e5134['filters']));if(_0x25a420[_0x3535('0x47')]['filter']){_0x289195['where']=_[_0x3535('0x52')](_0x289195[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x289195[_0x3535('0x4b')],function(_0x23e976){var _0x5c849a={};_0x5c849a[_0x23e976]={'$like':'%'+_0x25a420[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x5c849a;})});}_0x289195=_[_0x3535('0x52')]({},_0x289195,_0x25a420[_0x3535('0x54')]);return _0x3b7263[_0x3535('0xb1')](_0x289195);}})['then'](function(_0x370b23){if(_0x370b23){_0x38bb2f=_0x370b23[_0x3535('0x5c')];if(!_0x25a420['query']['hasOwnProperty'](_0x3535('0x4d'))){_0x289195['limit']=qs[_0x3535('0x31')](_0x25a420[_0x3535('0x47')][_0x3535('0x31')]);_0x289195[_0x3535('0x2f')]=qs[_0x3535('0x2f')](_0x25a420[_0x3535('0x47')][_0x3535('0x2f')]);}return _0x3b7263['getApplications'](_0x289195);}})[_0x3535('0x20')](function(_0x4eb872){if(_0x4eb872){return _0x4eb872?{'count':_0x38bb2f,'rows':_0x4eb872}:null;}})[_0x3535('0x20')](respondWithResult(_0x3d9888,null))['catch'](handleError(_0x3d9888,null));};exports['getInteractions']=function(_0x5e07a4,_0x2b6b26,_0x364ec8){var _0x3f251b={'raw':![],'where':{}};var _0x44fe39={};var _0x13d43c={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x5e07a4[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x2b6b26,null))[_0x3535('0x20')](function(_0x1732db){if(_0x1732db){_0x44fe39[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x94')][_0x3535('0x42')]);_0x44fe39[_0x3535('0x47')]=_['keys'](_0x5e07a4[_0x3535('0x47')]);_0x44fe39[_0x3535('0x49')]=_['intersection'](_0x44fe39[_0x3535('0x46')],_0x44fe39[_0x3535('0x47')]);_0x3f251b[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x44fe39[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x5e07a4[_0x3535('0x47')][_0x3535('0x4c')]));_0x3f251b[_0x3535('0x4b')]=_0x3f251b[_0x3535('0x4b')][_0x3535('0x5c')]?_0x3f251b[_0x3535('0x4b')]:_0x44fe39[_0x3535('0x46')];if(!_0x5e07a4[_0x3535('0x47')]['hasOwnProperty']('nolimit')){_0x3f251b[_0x3535('0x31')]=qs['limit'](_0x5e07a4['query']['limit']);_0x3f251b[_0x3535('0x2f')]=qs[_0x3535('0x2f')](_0x5e07a4[_0x3535('0x47')][_0x3535('0x2f')]);}_0x3f251b[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x5e07a4['query'][_0x3535('0x4f')]);_0x3f251b['where']=qs[_0x3535('0x49')](_['pick'](_0x5e07a4[_0x3535('0x47')],_0x44fe39['filters']));_0x3f251b[_0x3535('0x50')][_0x3535('0x66')]=_0x1732db['id'];if(_0x5e07a4[_0x3535('0x47')]['filter']){_0x3f251b[_0x3535('0x50')]=_[_0x3535('0x52')](_0x3f251b[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x3f251b['attributes'],function(_0x3eb622){var _0x24ab12={};_0x24ab12[_0x3eb622]={'$like':'%'+_0x5e07a4['query'][_0x3535('0x51')]+'%'};return _0x24ab12;})});}_0x3f251b=_[_0x3535('0x52')]({},_0x3f251b,_0x5e07a4[_0x3535('0x54')]);return db[_0x3535('0x94')]['count']({'where':_0x3f251b[_0x3535('0x50')]})[_0x3535('0x20')](function(_0x4abd6c){_0x13d43c[_0x3535('0x32')]=_0x4abd6c;if(_0x5e07a4[_0x3535('0x47')][_0x3535('0x56')]){_0x3f251b['include']=[{'model':db[_0x3535('0x74')],'as':'Contact','required':![]},{'model':db[_0x3535('0xa2')],'as':'Owner','attributes':[_0x3535('0x3d'),'fullname',_0x3535('0xb2')],'required':![]},{'model':db['Tag'],'as':_0x3535('0xb3'),'attributes':['id','name',_0x3535('0xb4')],'where':_0x5e07a4['query'][_0x3535('0xb5')]?{'id':_0x5e07a4['query'][_0x3535('0xb5')]}:undefined,'required':_0x5e07a4[_0x3535('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x3535('0x58')](_0x3f251b);})['then'](function(_0x3b6663){_0x13d43c[_0x3535('0x59')]=_0x3b6663;return _0x13d43c;});}})[_0x3535('0x20')](respondWithFilteredResult(_0x2b6b26,_0x3f251b))[_0x3535('0x2a')](handleError(_0x2b6b26,null));};exports[_0x3535('0xb6')]=function(_0x88f4c7,_0x59492a,_0x3d8f99){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x88f4c7[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x59492a,null))[_0x3535('0x20')](function(_0x3c64d3){if(_0x3c64d3){return _0x3c64d3[_0x3535('0xb6')](_0x88f4c7[_0x3535('0x5f')][_0x3535('0x6d')],_[_0x3535('0xb7')](_0x88f4c7['body'],['ids','id'])||{})[_0x3535('0x96')](function(_0x9b1ab8){for(var _0xe54cc7=0x0;_0xe54cc7<_0x88f4c7[_0x3535('0x5f')][_0x3535('0x6d')][_0x3535('0x5c')];_0xe54cc7+=0x1){socket[_0x3535('0xb8')](_0x3535('0xb9'),{'UserId':Number(_0x88f4c7[_0x3535('0x5f')]['ids'][_0xe54cc7]),'OpenchannelAccountId':Number(_0x88f4c7[_0x3535('0x5a')]['id'])});}return _0x9b1ab8;});}})[_0x3535('0x20')](respondWithResult(_0x59492a,null))[_0x3535('0x2a')](handleError(_0x59492a,null));};exports[_0x3535('0xba')]=function(_0x39e88e,_0x2667c4,_0x464f04){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x39e88e[_0x3535('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2667c4,null))[_0x3535('0x20')](function(_0xab3e45){if(_0xab3e45){return _0xab3e45[_0x3535('0xba')](_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')])[_0x3535('0x20')](function(){if(_[_0x3535('0xbb')](_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')])){for(var _0x4de4b0=0x0;_0x4de4b0<_0x39e88e[_0x3535('0x47')]['ids'][_0x3535('0x5c')];_0x4de4b0+=0x1){socket[_0x3535('0xb8')](_0x3535('0xbc'),{'UserId':Number(_0x39e88e[_0x3535('0x47')]['ids'][_0x4de4b0]),'OpenchannelAccountId':Number(_0x39e88e[_0x3535('0x5a')]['id'])});}}else{socket[_0x3535('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')]),'OpenchannelAccountId':Number(_0x39e88e[_0x3535('0x5a')]['id'])});}});}})[_0x3535('0x20')](respondWithStatusCode(_0x2667c4,null))[_0x3535('0x2a')](handleError(_0x2667c4,null));};exports[_0x3535('0xbd')]=function(_0x239ee9,_0x3eee83,_0x1c0872){var _0x179ecc={};var _0x4725aa={};var _0x57e89e;var _0x102d93;return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x239ee9[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x3eee83,null))[_0x3535('0x20')](function(_0x3f2592){if(_0x3f2592){_0x57e89e=_0x3f2592;_0x4725aa[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0xa2')][_0x3535('0x42')]);_0x4725aa[_0x3535('0x47')]=_[_0x3535('0x48')](_0x239ee9[_0x3535('0x47')]);_0x4725aa[_0x3535('0x49')]=_['intersection'](_0x4725aa[_0x3535('0x46')],_0x4725aa[_0x3535('0x47')]);_0x179ecc[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x4725aa[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x239ee9[_0x3535('0x47')][_0x3535('0x4c')]));_0x179ecc[_0x3535('0x4b')]=_0x179ecc[_0x3535('0x4b')][_0x3535('0x5c')]?_0x179ecc[_0x3535('0x4b')]:_0x4725aa[_0x3535('0x46')];_0x179ecc[_0x3535('0x4e')]=qs['sort'](_0x239ee9[_0x3535('0x47')][_0x3535('0x4f')]);_0x179ecc['where']=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x239ee9[_0x3535('0x47')],_0x4725aa['filters']));if(_0x239ee9[_0x3535('0x47')][_0x3535('0x51')]){_0x179ecc[_0x3535('0x50')]=_[_0x3535('0x52')](_0x179ecc[_0x3535('0x50')],{'$or':_['map'](_0x179ecc[_0x3535('0x4b')],function(_0x103a61){var _0x2825cd={};_0x2825cd[_0x103a61]={'$like':'%'+_0x239ee9['query'][_0x3535('0x51')]+'%'};return _0x2825cd;})});}_0x179ecc=_[_0x3535('0x52')]({},_0x179ecc,_0x239ee9[_0x3535('0x54')]);return _0x57e89e[_0x3535('0xbd')](_0x179ecc);}})[_0x3535('0x20')](function(_0x10292d){if(_0x10292d){_0x102d93=_0x10292d[_0x3535('0x5c')];if(!_0x239ee9[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0x179ecc['limit']=qs[_0x3535('0x31')](_0x239ee9['query']['limit']);_0x179ecc['offset']=qs[_0x3535('0x2f')](_0x239ee9[_0x3535('0x47')]['offset']);}return _0x57e89e[_0x3535('0xbd')](_0x179ecc);}})['then'](function(_0x1a7b51){if(_0x1a7b51){return _0x1a7b51?{'count':_0x102d93,'rows':_0x1a7b51}:null;}})['then'](respondWithResult(_0x3eee83,null))['catch'](handleError(_0x3eee83,null));};exports[_0x3535('0x3e')]=function(_0x123e3e,_0x563d94,_0x2c4815){var _0x28a971,_0x560243,_0x5e04eb;if(_[_0x3535('0x7d')](_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')])||_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')]===''){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3535('0x7d')](_0x123e3e[_0x3535('0x5f')]['to'])){}_0x28a971=_0x123e3e[_0x3535('0x5f')]['to'];return db['OpenchannelAccount'][_0x3535('0x68')]({'where':{'id':_0x123e3e[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))['then'](function(_0x45a32c){if(_0x45a32c){return db[_0x3535('0x55')]['find']({'where':{'id':_0x45a32c['id']},'include':[{'model':db[_0x3535('0x84')],'as':_0x3535('0x85'),'include':[{'model':db[_0x3535('0x74')],'as':_0x3535('0x86'),'where':{[_0x45a32c[_0x3535('0x80')]]:_0x28a971},'limit':0x1,'order':[[_0x3535('0x7a'),_0x3535('0x87')]]}]}]})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))[_0x3535('0x20')](function(_0x14c798){if(_0x14c798&&_0x14c798[_0x3535('0x85')]){_0x560243=_0x14c798[_0x3535('0x39')]({'plain':!![]});if(_0x560243[_0x3535('0x85')]&&_0x560243[_0x3535('0x85')][_0x3535('0x86')][_0x3535('0x5c')]){return _0x560243[_0x3535('0x85')][_0x3535('0x86')][0x0];}return db[_0x3535('0x74')]['create'](_[_0x3535('0x19')](_0x123e3e[_0x3535('0x5f')],{'firstName':_0x28a971,[_0x14c798['mapKey']]:_0x28a971,'phone':_0x28a971,'ListId':_0x560243[_0x3535('0xbe')]}));}})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))[_0x3535('0x20')](function(_0x264817){if(_0x264817){_0x5e04eb=_0x264817;return db['OpenchannelInteraction'][_0x3535('0x5d')]({'where':{'ContactId':_0x5e04eb['id'],'closed':![],'OpenchannelAccountId':_0x560243['id']}})[_0x3535('0x20')](function(_0x1012fe){if(_0x1012fe){return[_0x1012fe,![]];}return db['OpenchannelInteraction'][_0x3535('0x5e')]({'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id'],'OpenchannelAccountId':_0x560243['id'],'lastMsgDirection':_0x3535('0xbf'),'firstMsgDirection':_0x3535('0xbf'),'Messages':[_[_0x3535('0x52')](_0x123e3e[_0x3535('0x5f')],{'read':![],'body':_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')],'OpenchannelAccountId':_0x560243['id'],'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id']})]},{'include':[{'model':db[_0x3535('0x9f')],'as':_0x3535('0xc0')}]})[_0x3535('0x20')](function(_0x54e0f3){return[_0x54e0f3,!![]];});});}})[_0x3535('0x96')](function(_0x15152e,_0x32d2c6){if(_0x32d2c6){return _0x15152e;}return db[_0x3535('0x9f')]['create'](_[_0x3535('0x52')](_0x123e3e[_0x3535('0x5f')],{'read':![],'body':_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')],'OpenchannelAccountId':_0x560243['id'],'OpenchannelInteractionId':_0x15152e['id'],'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id']}))[_0x3535('0x20')](function(_0x2a6095){_0x15152e[_0x3535('0xc1')][_0x3535('0xc0')]=[];_0x15152e['dataValues'][_0x3535('0xc0')]['push'](_0x2a6095['dataValues']);return _0x15152e;});});}})[_0x3535('0x20')](respondWithResult(_0x563d94,null))[_0x3535('0x2a')](handleError(_0x563d94,null));}; \ No newline at end of file +var _0x8784=['http','client','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','OpenchannelAccounts','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','send','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x8784,0x172));var _0x4878=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x8784[_0x49aa7d];return _0xdd0d26;};'use strict';var emlformat=require(_0x4878('0x0'));var rimraf=require(_0x4878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4878('0x2'));var rp=require(_0x4878('0x3'));var moment=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var Mustache=require(_0x4878('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4878('0x7'));var csv=require(_0x4878('0x8'));var ejs=require(_0x4878('0x9'));var fs=require('fs');var fs_extra=require(_0x4878('0xa'));var _=require(_0x4878('0xb'));var squel=require(_0x4878('0xc'));var crypto=require(_0x4878('0xd'));var jsforce=require(_0x4878('0xe'));var deskjs=require(_0x4878('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4878('0x10'));var Papa=require(_0x4878('0x11'));var Redis=require(_0x4878('0x12'));var authService=require(_0x4878('0x13'));var qs=require(_0x4878('0x14'));var as=require(_0x4878('0x15'));var hardwareService=require(_0x4878('0x16'));var logger=require(_0x4878('0x17'))(_0x4878('0x18'));var utils=require(_0x4878('0x19'));var config=require(_0x4878('0x1a'));var licenseUtil=require(_0x4878('0x1b'));var db=require('../../mysqldb')['db'];config[_0x4878('0x1c')]=_[_0x4878('0x1d')](config[_0x4878('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x4878('0x1e'))(new Redis(config[_0x4878('0x1c')]));require('./openchannelAccount.socket')[_0x4878('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x4878('0x20')]({'port':0x232c});var client9002=jayson[_0x4878('0x21')][_0x4878('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x297b43,_0x37a150,_0x4a6e5e,_0x27ed83){return new BPromise(function(_0x25282f,_0x5abcfc){var _0x4319a8=_0x27ed83||client;return _0x4319a8['request'](_0x297b43,_0x4a6e5e)[_0x4878('0x22')](function(_0x4baa5e){logger['info'](_0x4878('0x23'),_0x37a150,_0x4878('0x24'));logger[_0x4878('0x25')](_0x4878('0x26'),_0x37a150,_0x4878('0x24'),JSON['stringify'](_0x4baa5e));if(_0x4baa5e[_0x4878('0x27')]){if(_0x4baa5e[_0x4878('0x27')][_0x4878('0x28')]===0x1f4){logger[_0x4878('0x27')](_0x4878('0x23'),_0x37a150,_0x4baa5e[_0x4878('0x27')]['message']);return _0x5abcfc(_0x4baa5e[_0x4878('0x27')][_0x4878('0x29')]);}logger[_0x4878('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x37a150,_0x4baa5e[_0x4878('0x27')][_0x4878('0x29')]);return _0x25282f(_0x4baa5e['error'][_0x4878('0x29')]);}else{logger[_0x4878('0x2a')](_0x4878('0x23'),_0x37a150,'request\x20sent');_0x25282f(_0x4baa5e[_0x4878('0x2b')][_0x4878('0x29')]);}})[_0x4878('0x2c')](function(_0x476ec3){logger[_0x4878('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x37a150,_0x476ec3);_0x5abcfc(_0x476ec3);});});}function respondWithStatusCode(_0x1ff1c4,_0x4458fb){_0x4458fb=_0x4458fb||0xcc;return function(_0x522157){if(_0x522157){return _0x1ff1c4[_0x4878('0x2d')](_0x4458fb);}return _0x1ff1c4[_0x4878('0x2e')](_0x4458fb)[_0x4878('0x2f')]();};}function respondWithResult(_0x2d7849,_0x43b9a0){_0x43b9a0=_0x43b9a0||0xc8;return function(_0x16bf4b){if(_0x16bf4b){return _0x2d7849[_0x4878('0x2e')](_0x43b9a0)[_0x4878('0x30')](_0x16bf4b);}};}function respondWithFilteredResult(_0xcff66b,_0xe7a731){return function(_0x3b09f1){if(_0x3b09f1){var _0x38400b=typeof _0xe7a731[_0x4878('0x31')]==='undefined'&&typeof _0xe7a731[_0x4878('0x32')]===_0x4878('0x33');var _0x4f3622=_0x3b09f1['count'];var _0x41908f=_0x38400b?0x0:_0xe7a731[_0x4878('0x31')];var _0x45432e=_0x38400b?_0x3b09f1[_0x4878('0x34')]:_0xe7a731[_0x4878('0x31')]+_0xe7a731[_0x4878('0x32')];var _0x406e1a;if(_0x45432e>=_0x4f3622){_0x45432e=_0x4f3622;_0x406e1a=0xc8;}else{_0x406e1a=0xce;}_0xcff66b['status'](_0x406e1a);return _0xcff66b[_0x4878('0x35')](_0x4878('0x36'),_0x41908f+'-'+_0x45432e+'/'+_0x4f3622)[_0x4878('0x30')](_0x3b09f1);}return null;};}function patchUpdates(_0xae0447){return function(_0x6b2fae){try{jsonpatch['apply'](_0x6b2fae,_0xae0447,!![]);}catch(_0x5d5f5a){return BPromise['reject'](_0x5d5f5a);}return _0x6b2fae[_0x4878('0x37')]();};}function saveUpdates(_0x19c881,_0x44e796){return function(_0x4a2d6d){if(_0x4a2d6d){return _0x4a2d6d[_0x4878('0x38')](_0x19c881)[_0x4878('0x22')](function(_0x50fe9d){return _0x50fe9d;});}return null;};}function removeEntity(_0x232457,_0x58fc62){return function(_0xcdb929){if(_0xcdb929){return _0xcdb929['destroy']()['then'](function(){var _0x179116=_0xcdb929['get']({'plain':!![]});var _0x2bfb91=_0x4878('0x39');return db['UserProfileResource'][_0x4878('0x3a')]({'where':{'type':_0x2bfb91,'resourceId':_0x179116['id']}})[_0x4878('0x22')](function(){return _0xcdb929;});})['then'](function(){_0x232457[_0x4878('0x2e')](0xcc)[_0x4878('0x2f')]();});}};}function handleEntityNotFound(_0x54ee6b,_0x1c3bae){return function(_0x5ae2e8){if(!_0x5ae2e8){_0x54ee6b[_0x4878('0x2d')](0x194);}return _0x5ae2e8;};}function handleError(_0x38f9c8,_0x1e939c){_0x1e939c=_0x1e939c||0x1f4;return function(_0x232471){logger['error'](_0x232471[_0x4878('0x3b')]);if(_0x232471[_0x4878('0x3c')]){delete _0x232471[_0x4878('0x3c')];}_0x38f9c8[_0x4878('0x2e')](_0x1e939c)['send'](_0x232471);};}exports[_0x4878('0x3d')]=function(_0x48b7f3,_0x1b4380){var _0x1c0736={'include':[{'model':db[_0x4878('0x3e')],'as':_0x4878('0x3f')}]},_0x5bcab4={},_0x225708={'count':0x0,'rows':[]};var _0x2a12d3=_[_0x4878('0x40')](db[_0x4878('0x41')][_0x4878('0x42')],function(_0x472de6){return{'name':_0x472de6[_0x4878('0x43')],'type':_0x472de6['type'][_0x4878('0x44')]};});_0x5bcab4[_0x4878('0x45')]=_[_0x4878('0x40')](_0x2a12d3,_0x4878('0x3c'));_0x5bcab4[_0x4878('0x46')]=_[_0x4878('0x47')](_0x48b7f3[_0x4878('0x46')]);_0x5bcab4['filters']=_[_0x4878('0x48')](_0x5bcab4[_0x4878('0x45')],_0x5bcab4[_0x4878('0x46')]);_0x1c0736[_0x4878('0x49')]=_[_0x4878('0x48')](_0x5bcab4[_0x4878('0x45')],qs[_0x4878('0x4a')](_0x48b7f3[_0x4878('0x46')][_0x4878('0x4a')]));_0x1c0736['attributes']=_0x1c0736[_0x4878('0x49')][_0x4878('0x4b')]?_0x1c0736['attributes']:_0x5bcab4[_0x4878('0x45')];if(!_0x48b7f3[_0x4878('0x46')]['hasOwnProperty']('nolimit')){_0x1c0736[_0x4878('0x32')]=qs['limit'](_0x48b7f3[_0x4878('0x46')]['limit']);_0x1c0736[_0x4878('0x31')]=qs[_0x4878('0x31')](_0x48b7f3[_0x4878('0x46')][_0x4878('0x31')]);}_0x1c0736[_0x4878('0x4c')]=qs[_0x4878('0x4d')](_0x48b7f3['query']['sort']);_0x1c0736[_0x4878('0x4e')]=qs[_0x4878('0x4f')](_[_0x4878('0x50')](_0x48b7f3[_0x4878('0x46')],_0x5bcab4[_0x4878('0x4f')]),_0x2a12d3);if(_0x48b7f3['query']['filter']){_0x1c0736[_0x4878('0x4e')]=_[_0x4878('0x51')](_0x1c0736['where'],{'$or':_['map'](_0x2a12d3,function(_0x34d2b2){if(_0x34d2b2[_0x4878('0x52')]!==_0x4878('0x53')){var _0x168893={};_0x168893[_0x34d2b2['name']]={'$like':'%'+_0x48b7f3[_0x4878('0x46')][_0x4878('0x54')]+'%'};return _0x168893;}})});}_0x1c0736=_[_0x4878('0x51')]({},_0x1c0736,_0x48b7f3[_0x4878('0x55')]);var _0x4f1e52={'where':_0x1c0736[_0x4878('0x4e')]};return db[_0x4878('0x41')]['count'](_0x4f1e52)[_0x4878('0x22')](function(_0x3644a8){_0x225708[_0x4878('0x34')]=_0x3644a8;if(_0x48b7f3[_0x4878('0x46')][_0x4878('0x56')]){_0x1c0736[_0x4878('0x57')]=[{'all':!![]}];}return db[_0x4878('0x41')][_0x4878('0x58')](_0x1c0736);})[_0x4878('0x22')](function(_0x3ed0df){_0x225708[_0x4878('0x59')]=_0x3ed0df;return _0x225708;})[_0x4878('0x22')](respondWithFilteredResult(_0x1b4380,_0x1c0736))['catch'](handleError(_0x1b4380,null));};exports[_0x4878('0x5a')]=function(_0x5562b3,_0x4a6ce4){var _0x4364d9={'raw':![],'where':{'id':_0x5562b3['params']['id']},'include':[{'model':db[_0x4878('0x3e')],'as':_0x4878('0x3f')}]},_0x69ea93={};_0x69ea93[_0x4878('0x45')]=_[_0x4878('0x47')](db['OpenchannelAccount']['rawAttributes']);_0x69ea93[_0x4878('0x46')]=_[_0x4878('0x47')](_0x5562b3[_0x4878('0x46')]);_0x69ea93[_0x4878('0x4f')]=_[_0x4878('0x48')](_0x69ea93[_0x4878('0x45')],_0x69ea93['query']);_0x4364d9[_0x4878('0x49')]=_[_0x4878('0x48')](_0x69ea93[_0x4878('0x45')],qs[_0x4878('0x4a')](_0x5562b3['query'][_0x4878('0x4a')]));_0x4364d9[_0x4878('0x49')]=_0x4364d9[_0x4878('0x49')][_0x4878('0x4b')]?_0x4364d9[_0x4878('0x49')]:_0x69ea93[_0x4878('0x45')];if(_0x5562b3[_0x4878('0x46')][_0x4878('0x56')]){_0x4364d9[_0x4878('0x57')]=[{'all':!![]}];}_0x4364d9=_[_0x4878('0x51')]({},_0x4364d9,_0x5562b3[_0x4878('0x55')]);return db[_0x4878('0x41')][_0x4878('0x5b')](_0x4364d9)[_0x4878('0x22')](handleEntityNotFound(_0x4a6ce4,null))[_0x4878('0x22')](respondWithResult(_0x4a6ce4,null))[_0x4878('0x2c')](handleError(_0x4a6ce4,null));};exports['create']=function(_0x286497,_0x4234fd){return db[_0x4878('0x41')][_0x4878('0x5c')](_0x286497[_0x4878('0x5d')],{})[_0x4878('0x22')](function(_0x4931c3){var _0x22dbc5=_0x286497['user'][_0x4878('0x5e')]({'plain':!![]});if(!_0x22dbc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22dbc5[_0x4878('0x5f')]===_0x4878('0x60')){var _0x31e36b=_0x4931c3[_0x4878('0x5e')]({'plain':!![]});var _0x482853=_0x4878('0x39');return db[_0x4878('0x61')][_0x4878('0x5b')]({'where':{'name':_0x482853,'userProfileId':_0x22dbc5[_0x4878('0x62')]},'raw':!![]})[_0x4878('0x22')](function(_0x2f34c5){if(_0x2f34c5&&_0x2f34c5[_0x4878('0x63')]===0x0){return db[_0x4878('0x64')]['create']({'name':_0x31e36b[_0x4878('0x3c')],'resourceId':_0x31e36b['id'],'type':_0x2f34c5[_0x4878('0x3c')],'sectionId':_0x2f34c5['id']},{})[_0x4878('0x22')](function(){return _0x4931c3;});}else{return _0x4931c3;}})[_0x4878('0x2c')](function(_0x3cedf5){logger[_0x4878('0x27')](_0x4878('0x65'),_0x3cedf5);throw _0x3cedf5;});}return _0x4931c3;})[_0x4878('0x22')](respondWithResult(_0x4234fd,0xc9))['catch'](handleError(_0x4234fd,null));};exports[_0x4878('0x38')]=function(_0x121564,_0x32b507){if(_0x121564[_0x4878('0x5d')]['id']){delete _0x121564[_0x4878('0x5d')]['id'];}return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x121564[_0x4878('0x66')]['id']},'include':[{'model':db[_0x4878('0x3e')],'as':_0x4878('0x3f')}]})[_0x4878('0x22')](handleEntityNotFound(_0x32b507,null))[_0x4878('0x22')](saveUpdates(_0x121564[_0x4878('0x5d')],null))[_0x4878('0x22')](respondWithResult(_0x32b507,null))[_0x4878('0x2c')](handleError(_0x32b507,null));};exports[_0x4878('0x3a')]=function(_0x163d6e,_0x23035f){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x163d6e[_0x4878('0x66')]['id']}})['then'](handleEntityNotFound(_0x23035f,null))[_0x4878('0x22')](removeEntity(_0x23035f,null))[_0x4878('0x2c')](handleError(_0x23035f,null));};exports[_0x4878('0x67')]=function(_0x26e888,_0x23aae7){return db[_0x4878('0x41')][_0x4878('0x67')]()['then'](respondWithResult(_0x23aae7,null))[_0x4878('0x2c')](handleError(_0x23aae7,null));};exports[_0x4878('0x68')]=function(_0x2d9cc4,_0x45a852,_0x133528){if(_0x2d9cc4[_0x4878('0x5d')]['id']){delete _0x2d9cc4['body']['id'];}return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x2d9cc4[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x45a852,null))[_0x4878('0x22')](function(_0x3e8e11){if(_0x3e8e11){_0x2d9cc4[_0x4878('0x5d')][_0x4878('0x69')]=_0x3e8e11['id'];return db[_0x4878('0x6a')][_0x4878('0x5c')](_0x2d9cc4['body']);}})[_0x4878('0x22')](respondWithResult(_0x45a852,null))[_0x4878('0x2c')](handleError(_0x45a852,null));};exports[_0x4878('0x6b')]=function(_0x2d35a2,_0x5df328,_0x2b5e1b){var _0x3dc542={'raw':![],'where':{}};var _0x565a10={};var _0x27e16f={'count':0x0,'rows':[]};return db[_0x4878('0x41')][_0x4878('0x6c')]({'where':{'id':_0x2d35a2[_0x4878('0x66')]['id']}})['then'](handleEntityNotFound(_0x5df328,null))[_0x4878('0x22')](function(_0x29858e){if(_0x29858e){_0x565a10[_0x4878('0x45')]=_['keys'](db['Disposition'][_0x4878('0x42')]);_0x565a10['query']=_[_0x4878('0x47')](_0x2d35a2[_0x4878('0x46')]);_0x565a10['filters']=_[_0x4878('0x48')](_0x565a10[_0x4878('0x45')],_0x565a10[_0x4878('0x46')]);_0x3dc542[_0x4878('0x49')]=_['intersection'](_0x565a10['model'],qs[_0x4878('0x4a')](_0x2d35a2[_0x4878('0x46')][_0x4878('0x4a')]));_0x3dc542[_0x4878('0x49')]=_0x3dc542['attributes'][_0x4878('0x4b')]?_0x3dc542['attributes']:_0x565a10[_0x4878('0x45')];if(!_0x2d35a2[_0x4878('0x46')][_0x4878('0x6d')]('nolimit')){_0x3dc542[_0x4878('0x32')]=qs[_0x4878('0x32')](_0x2d35a2['query'][_0x4878('0x32')]);_0x3dc542['offset']=qs['offset'](_0x2d35a2[_0x4878('0x46')][_0x4878('0x31')]);}_0x3dc542[_0x4878('0x4c')]=qs[_0x4878('0x4d')](_0x2d35a2[_0x4878('0x46')][_0x4878('0x4d')]);_0x3dc542[_0x4878('0x4e')]=qs[_0x4878('0x4f')](_[_0x4878('0x50')](_0x2d35a2['query'],_0x565a10['filters']));_0x3dc542[_0x4878('0x4e')]['OpenchannelAccountId']=_0x29858e['id'];if(_0x2d35a2[_0x4878('0x46')][_0x4878('0x54')]){_0x3dc542[_0x4878('0x4e')]=_[_0x4878('0x51')](_0x3dc542[_0x4878('0x4e')],{'$or':_[_0x4878('0x40')](_0x3dc542[_0x4878('0x49')],function(_0x1ddc2d){var _0x38dc96={};_0x38dc96[_0x1ddc2d]={'$like':'%'+_0x2d35a2[_0x4878('0x46')][_0x4878('0x54')]+'%'};return _0x38dc96;})});}_0x3dc542=_[_0x4878('0x51')]({},_0x3dc542,_0x2d35a2[_0x4878('0x55')]);return db['Disposition'][_0x4878('0x34')]({'where':_0x3dc542[_0x4878('0x4e')]})[_0x4878('0x22')](function(_0x3c007a){_0x27e16f[_0x4878('0x34')]=_0x3c007a;if(_0x2d35a2[_0x4878('0x46')][_0x4878('0x56')]){_0x3dc542[_0x4878('0x57')]=[{'all':!![]}];}return db[_0x4878('0x6a')][_0x4878('0x58')](_0x3dc542);})['then'](function(_0x4e1784){_0x27e16f['rows']=_0x4e1784;return _0x27e16f;});}})['then'](respondWithFilteredResult(_0x5df328,_0x3dc542))[_0x4878('0x2c')](handleError(_0x5df328,null));};exports['removeDispositions']=function(_0x5ccc1a,_0x5842fa,_0x7661a0){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x5ccc1a[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x5842fa,null))[_0x4878('0x22')](function(_0x5f2d24){if(_0x5f2d24){return _0x5f2d24[_0x4878('0x6e')](_0x5ccc1a[_0x4878('0x46')]['ids']);}})[_0x4878('0x22')](respondWithStatusCode(_0x5842fa,null))[_0x4878('0x2c')](handleError(_0x5842fa,null));};exports[_0x4878('0x6f')]=function(_0x5c8ee3,_0x48fd00,_0x3554a4){if(_0x5c8ee3[_0x4878('0x5d')]['id']){delete _0x5c8ee3[_0x4878('0x5d')]['id'];}return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x5c8ee3['params']['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x48fd00,null))[_0x4878('0x22')](function(_0x2d38ac){if(_0x2d38ac){_0x5c8ee3[_0x4878('0x5d')][_0x4878('0x69')]=_0x2d38ac['id'];return db[_0x4878('0x70')][_0x4878('0x5c')](_0x5c8ee3['body']);}})[_0x4878('0x22')](respondWithResult(_0x48fd00,null))[_0x4878('0x2c')](handleError(_0x48fd00,null));};exports[_0x4878('0x71')]=function(_0x182cee,_0xdaf834,_0x3c6a8c){var _0x49c27a={'raw':![],'where':{}};var _0x32c4d6={};var _0x3cea23={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x182cee[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0xdaf834,null))['then'](function(_0x37e855){if(_0x37e855){_0x32c4d6[_0x4878('0x45')]=_[_0x4878('0x47')](db[_0x4878('0x70')]['rawAttributes']);_0x32c4d6[_0x4878('0x46')]=_[_0x4878('0x47')](_0x182cee[_0x4878('0x46')]);_0x32c4d6[_0x4878('0x4f')]=_['intersection'](_0x32c4d6[_0x4878('0x45')],_0x32c4d6[_0x4878('0x46')]);_0x49c27a[_0x4878('0x49')]=_[_0x4878('0x48')](_0x32c4d6[_0x4878('0x45')],qs[_0x4878('0x4a')](_0x182cee[_0x4878('0x46')][_0x4878('0x4a')]));_0x49c27a[_0x4878('0x49')]=_0x49c27a[_0x4878('0x49')][_0x4878('0x4b')]?_0x49c27a[_0x4878('0x49')]:_0x32c4d6[_0x4878('0x45')];if(!_0x182cee[_0x4878('0x46')][_0x4878('0x6d')](_0x4878('0x72'))){_0x49c27a[_0x4878('0x32')]=qs[_0x4878('0x32')](_0x182cee['query'][_0x4878('0x32')]);_0x49c27a['offset']=qs[_0x4878('0x31')](_0x182cee['query'][_0x4878('0x31')]);}_0x49c27a[_0x4878('0x4c')]=qs[_0x4878('0x4d')](_0x182cee[_0x4878('0x46')][_0x4878('0x4d')]);_0x49c27a['where']=qs[_0x4878('0x4f')](_[_0x4878('0x50')](_0x182cee[_0x4878('0x46')],_0x32c4d6[_0x4878('0x4f')]));_0x49c27a[_0x4878('0x4e')][_0x4878('0x69')]=_0x37e855['id'];if(_0x182cee[_0x4878('0x46')][_0x4878('0x54')]){_0x49c27a[_0x4878('0x4e')]=_[_0x4878('0x51')](_0x49c27a[_0x4878('0x4e')],{'$or':_['map'](_0x49c27a[_0x4878('0x49')],function(_0x44fbfc){var _0xc44fc3={};_0xc44fc3[_0x44fbfc]={'$like':'%'+_0x182cee[_0x4878('0x46')][_0x4878('0x54')]+'%'};return _0xc44fc3;})});}_0x49c27a=_['merge']({},_0x49c27a,_0x182cee[_0x4878('0x55')]);return db[_0x4878('0x70')][_0x4878('0x34')]({'where':_0x49c27a[_0x4878('0x4e')]})[_0x4878('0x22')](function(_0x19d7a1){_0x3cea23['count']=_0x19d7a1;if(_0x182cee[_0x4878('0x46')]['includeAll']){_0x49c27a[_0x4878('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4878('0x58')](_0x49c27a);})[_0x4878('0x22')](function(_0x52adcc){_0x3cea23[_0x4878('0x59')]=_0x52adcc;return _0x3cea23;});}})[_0x4878('0x22')](respondWithFilteredResult(_0xdaf834,_0x49c27a))[_0x4878('0x2c')](handleError(_0xdaf834,null));};exports[_0x4878('0x73')]=function(_0x3cc1da,_0x3d0a24,_0x161c36){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x3cc1da[_0x4878('0x66')]['id']}})['then'](handleEntityNotFound(_0x3d0a24,null))[_0x4878('0x22')](function(_0x3bd2e3){if(_0x3bd2e3){return _0x3bd2e3[_0x4878('0x73')](_0x3cc1da['query']['ids']);}})['then'](respondWithStatusCode(_0x3d0a24,null))[_0x4878('0x2c')](handleError(_0x3d0a24,null));};exports[_0x4878('0x74')]=function(_0x4c7c6b,_0x8f0572,_0x185183){var _0x4469bd={'body':_0x4c7c6b[_0x4878('0x5d')],'channel':'openchannel'};var _0x2c63b5=[];var _0x473172=[];var _0x3ca1c9={};var _0x2e04f3=![];return db[_0x4878('0x75')][_0x4878('0x67')]()[_0x4878('0x22')](function(_0xf959c9){if(!_0xf959c9){throw new db['Sequelize'][(_0x4878('0x76'))](_0x4878('0x77'));}_0x2c63b5=_['difference'](_[_0x4878('0x47')](_0xf959c9),[_0x4878('0x78'),_0x4878('0x79')]);_0x473172=_[_0x4878('0x7a')](_['keys'](_0xf959c9),[_0x4878('0x78'),'updatedAt',_0x4878('0x7b'),_0x4878('0x7c')]);if(_0x4c7c6b[_0x4878('0x5d')]['id']){delete _0x4c7c6b['body']['id'];}if(_[_0x4878('0x7d')](_0x4c7c6b[_0x4878('0x5d')]['from'])){throw new db[(_0x4878('0x7e'))][(_0x4878('0x76'))](_0x4878('0x7f'));}if(_[_0x4878('0x7d')](_0x4c7c6b[_0x4878('0x5d')]['body'])||_0x4c7c6b[_0x4878('0x5d')]['body']===''){throw new db[(_0x4878('0x7e'))]['ValidationError'](_0x4878('0x80'));}if(_['isNil'](_0x4c7c6b['body'][_0x4878('0x81')])){throw new db[(_0x4878('0x7e'))]['ValidationError'](_0x4878('0x82')+_0x473172);}if(!_[_0x4878('0x83')](_0x473172,_0x4c7c6b['body'][_0x4878('0x81')])){throw new db['Sequelize'][(_0x4878('0x76'))](_0x4878('0x84')+_0x473172);}_0x3ca1c9[_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x81')]]=_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x85')];})[_0x4878('0x22')](function(){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x4c7c6b['params']['id']},'include':[{'model':db['CmList'],'as':_0x4878('0x86'),'include':[{'model':db[_0x4878('0x75')],'as':_0x4878('0x87'),'where':_0x3ca1c9,'limit':0x1,'order':[[_0x4878('0x79'),_0x4878('0x88')]]}]},{'model':db[_0x4878('0x89')],'as':_0x4878('0x8a')}]});})['then'](handleEntityNotFound(_0x8f0572,null))[_0x4878('0x22')](function(_0x4d03ed){if(_0x4d03ed&&_0x4d03ed[_0x4878('0x86')]){_0x4469bd[_0x4878('0x8b')]=_0x4d03ed;_0x4469bd[_0x4878('0x8c')]=_0x4d03ed[_0x4878('0x8a')];_0x4469bd[_0x4878('0x8d')]=_0x4d03ed[_0x4878('0x86')];_0x4469bd[_0x4878('0x8c')]=_[_0x4878('0x8e')](_0x4469bd['applications'],[_0x4878('0x8f')],[_0x4878('0x90')]);if(_0x4469bd[_0x4878('0x8b')][_0x4878('0x8a')]){delete _0x4469bd[_0x4878('0x8b')]['Applications'];}if(_0x4469bd[_0x4878('0x8b')][_0x4878('0x86')]&&_0x4469bd['account'][_0x4878('0x86')]['Contacts'][_0x4878('0x4b')]){return _0x4469bd['account'][_0x4878('0x86')][_0x4878('0x87')][0x0];}var _0x1d657b=_['defaults'](_0x4c7c6b[_0x4878('0x5d')],{'firstName':_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x85')],'ListId':_0x4d03ed[_0x4878('0x7c')]});_0x1d657b[_0x4c7c6b['body'][_0x4878('0x81')]]=_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x85')];return db[_0x4878('0x75')][_0x4878('0x5c')](_0x1d657b,{'fields':_0x2c63b5,'raw':!![]});}})['then'](handleEntityNotFound(_0x8f0572,null))[_0x4878('0x22')](function(_0x1bda55){_0x4469bd[_0x4878('0x91')]=_0x1bda55;if(_0x1bda55){var _0x4b775b={'ContactId':_0x1bda55['id'],'OpenchannelAccountId':_0x4c7c6b[_0x4878('0x66')]['id'],'from':(_0x1bda55[_0x4878('0x92')]||'')+'\x20'+(_0x1bda55[_0x4878('0x93')]||'')};var _0x23ffb9={'OpenchannelAccountId':_0x4c7c6b[_0x4878('0x66')]['id'],'closed':![]};if(_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x94')]){_0x23ffb9[_0x4878('0x94')]=_0x4c7c6b[_0x4878('0x5d')]['threadId'];return db['OpenchannelInteraction'][_0x4878('0x5b')]({'where':_0x23ffb9})[_0x4878('0x22')](function(_0x5b3251){if(_0x5b3251){return[_0x5b3251,![]];}_0x4b775b['threadId']=_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x94')];_0x4b775b[_0x4878('0x95')]=_0x4c7c6b['body'][_0x4878('0x95')];return db['OpenchannelInteraction']['create'](_0x4b775b)[_0x4878('0x22')](function(_0x482e00){return[_0x482e00,!![]];});});}else{_0x23ffb9[_0x4878('0x94')]=null;}_0x23ffb9[_0x4878('0x96')]=_0x1bda55['id'];return db[_0x4878('0x97')]['find']({'where':_0x23ffb9})[_0x4878('0x22')](function(_0x2ea4dc){if(_0x2ea4dc){return[_0x2ea4dc,![]];}return db[_0x4878('0x97')][_0x4878('0x5c')](_0x4b775b)[_0x4878('0x22')](function(_0x46e110){return[_0x46e110,!![]];});});}})[_0x4878('0x98')](function(_0x34c341,_0x196b5e){if(_0x34c341){_0x2e04f3=_0x196b5e;if(!_0x196b5e){var _0xd6ced5={'from':(_0x4469bd[_0x4878('0x91')]['firstName']||'')+'\x20'+(_0x4469bd[_0x4878('0x91')]['lastName']||'')};if(_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x94')]&&_0x4c7c6b['body'][_0x4878('0x99')]&&_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x94')]!=_0x4c7c6b[_0x4878('0x5d')][_0x4878('0x99')]){_0xd6ced5[_0x4878('0x94')]=_0x4c7c6b['body'][_0x4878('0x99')];}return _0x34c341[_0x4878('0x38')](_0xd6ced5);}else{return _0x34c341;}}})['then'](function(_0xb0b5b){_0x4469bd[_0x4878('0x9a')]=_0xb0b5b[_0x4878('0x5e')]({'plain':!![]});_0x4469bd['interaction'][_0x4878('0x9b')]=_0x2e04f3;if(_0x4469bd[_0x4878('0x9a')][_0x4878('0x9b')]){if(_0x4469bd[_0x4878('0x8b')][_0x4878('0x9c')]){_0x4469bd['applications']['push']({'id':0x0,'priority':_0x4469bd[_0x4878('0x8c')][_0x4878('0x4b')]+0x1,'app':_0x4878('0x9d'),'appdata':_0x4878('0x9e'),'interval':_0x4878('0x9f')});}}return db[_0x4878('0xa0')]['create']({'body':_0x4c7c6b['body'][_0x4878('0x5d')],'OpenchannelAccountId':_0x4c7c6b[_0x4878('0x66')]['id'],'OpenchannelInteractionId':_0xb0b5b['id'],'direction':'in','ContactId':_0x4469bd[_0x4878('0x91')]['id'],'AttachmentId':_0x4c7c6b[_0x4878('0x5d')][_0x4878('0xa1')]});})['then'](function(_0xbb5bc2){_0x4469bd[_0x4878('0x29')]=_0xbb5bc2;if(!_0x4469bd[_0x4878('0x9a')]['UserId'])return;return db[_0x4878('0xa2')][_0x4878('0x5b')]({'attributes':['id',_0x4878('0x3c')],'where':{'id':_0x4469bd[_0x4878('0x9a')][_0x4878('0xa3')]}});})[_0x4878('0x22')](function(_0x327000){if(_0x327000){_0x4469bd[_0x4878('0x8c')][_0x4878('0xa4')]({'id':0x0,'priority':0x0,'app':_0x4878('0xa5'),'appdata':_0x327000[_0x4878('0x3c')]+','+(_0x4469bd[_0x4878('0x8b')][_0x4878('0xa6')]||0xa),'interval':_0x4878('0x9f')});}if(!_0x4469bd['interaction'][_0x4878('0xa7')])return;return db[_0x4878('0xa8')]['find']({'attributes':['id',_0x4878('0x3c')],'where':{'id':_0x4469bd['interaction'][_0x4878('0xa7')]}});})[_0x4878('0x22')](function(_0x384707){if(_0x384707){_0x4469bd[_0x4878('0x8c')][_0x4878('0xa4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x384707[_0x4878('0x3c')]+','+(_0x4469bd[_0x4878('0x8b')][_0x4878('0xa9')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x4469bd);})[_0x4878('0x22')](function(_0x2342f7){respondWithRpcPromise(_0x4878('0xaa'),_0x4878('0xaa'),{'event':_0x4878('0x74'),'message':_0x2342f7},client9002);return _0x2342f7;})[_0x4878('0x22')](respondWithResult(_0x8f0572,null))[_0x4878('0x2c')](handleError(_0x8f0572,null));};exports[_0x4878('0xab')]=function(_0x2254a7,_0x259446){var _0x2a9808=_0x2254a7[_0x4878('0x66')]['id'];var _0x35fc36=_0x2254a7[_0x4878('0x5d')];var _0x37f710=0xc8;var _0x29f647=null;return db[_0x4878('0xac')]['transaction']({'isolationLevel':db[_0x4878('0xac')][_0x4878('0xad')][_0x4878('0xae')]['READ_COMMITTED']},function(_0x483b77){return db[_0x4878('0x41')][_0x4878('0x6c')]({'where':{'id':_0x2a9808},'transaction':_0x483b77})['then'](function(_0x3b0378){if(_0x3b0378){return db[_0x4878('0x89')][_0x4878('0x3a')]({'where':{'OpenchannelAccountId':_0x2a9808},'transaction':_0x483b77})['then'](function(){var _0x7fe963=_['map'](_0x35fc36,function(_0x274524){_0x274524['OpenchannelAccountId']=_0x2a9808;return _0x274524;});return db[_0x4878('0x89')][_0x4878('0xaf')](_0x7fe963,{'transaction':_0x483b77});});}else{_0x37f710=0x194;_0x29f647=[];}});})[_0x4878('0x22')](function(){if(_0x37f710!==0x194){return db[_0x4878('0x89')][_0x4878('0xb0')]({'where':{'OpenchannelAccountId':_0x2a9808},'order':_0x4878('0x8f')})['then'](function(_0x2d393c){_0x29f647=_0x2d393c;});}})[_0x4878('0x2c')](function(_0x4fc880){_0x37f710=0x1f4;logger[_0x4878('0x27')](_0x4fc880[_0x4878('0x3b')]);if(_0x4fc880['name']){delete _0x4fc880['name'];}_0x29f647=_0x4fc880;})[_0x4878('0xb1')](function(){if(_0x29f647===null){_0x259446[_0x4878('0x2d')](_0x37f710);}else{if(_0x37f710===0x1f4){_0x259446['status'](_0x37f710)[_0x4878('0xb2')](_0x29f647);}else{_0x259446[_0x4878('0x2e')](_0x37f710)['json'](_0x29f647);}}});};exports['getApplications']=function(_0x589248,_0x1229b9,_0x56d52a){var _0x39b8eb={};var _0x1a38e1={};var _0x2b6ac6;var _0x326e66;return db[_0x4878('0x41')][_0x4878('0x6c')]({'where':{'id':_0x589248['params']['id']}})['then'](handleEntityNotFound(_0x1229b9,null))[_0x4878('0x22')](function(_0x50412e){if(_0x50412e){_0x2b6ac6=_0x50412e;_0x1a38e1[_0x4878('0x45')]=_[_0x4878('0x47')](db[_0x4878('0x89')]['rawAttributes']);_0x1a38e1['query']=_[_0x4878('0x47')](_0x589248[_0x4878('0x46')]);_0x1a38e1[_0x4878('0x4f')]=_['intersection'](_0x1a38e1[_0x4878('0x45')],_0x1a38e1[_0x4878('0x46')]);_0x39b8eb['attributes']=_['intersection'](_0x1a38e1[_0x4878('0x45')],qs[_0x4878('0x4a')](_0x589248['query'][_0x4878('0x4a')]));_0x39b8eb['attributes']=_0x39b8eb['attributes'][_0x4878('0x4b')]?_0x39b8eb[_0x4878('0x49')]:_0x1a38e1[_0x4878('0x45')];_0x39b8eb['order']=qs[_0x4878('0x4d')](_0x589248['query'][_0x4878('0x4d')]);_0x39b8eb['where']=qs['filters'](_[_0x4878('0x50')](_0x589248[_0x4878('0x46')],_0x1a38e1[_0x4878('0x4f')]));if(_0x589248[_0x4878('0x46')][_0x4878('0x54')]){_0x39b8eb[_0x4878('0x4e')]=_['merge'](_0x39b8eb[_0x4878('0x4e')],{'$or':_[_0x4878('0x40')](_0x39b8eb[_0x4878('0x49')],function(_0x580ad7){var _0x26fbe8={};_0x26fbe8[_0x580ad7]={'$like':'%'+_0x589248[_0x4878('0x46')]['filter']+'%'};return _0x26fbe8;})});}_0x39b8eb=_[_0x4878('0x51')]({},_0x39b8eb,_0x589248[_0x4878('0x55')]);return _0x2b6ac6['getApplications'](_0x39b8eb);}})[_0x4878('0x22')](function(_0x14a8ad){if(_0x14a8ad){_0x326e66=_0x14a8ad[_0x4878('0x4b')];if(!_0x589248[_0x4878('0x46')][_0x4878('0x6d')]('nolimit')){_0x39b8eb[_0x4878('0x32')]=qs[_0x4878('0x32')](_0x589248[_0x4878('0x46')][_0x4878('0x32')]);_0x39b8eb[_0x4878('0x31')]=qs[_0x4878('0x31')](_0x589248[_0x4878('0x46')]['offset']);}return _0x2b6ac6['getApplications'](_0x39b8eb);}})[_0x4878('0x22')](function(_0x23c771){if(_0x23c771){return _0x23c771?{'count':_0x326e66,'rows':_0x23c771}:null;}})[_0x4878('0x22')](respondWithResult(_0x1229b9,null))[_0x4878('0x2c')](handleError(_0x1229b9,null));};exports[_0x4878('0xb3')]=function(_0x4302bc,_0x58220e,_0x30ca5b){var _0x3af4ad={'raw':![],'where':{}};var _0x3cc570={};var _0x3e38fe={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4878('0x6c')]({'where':{'id':_0x4302bc[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x58220e,null))['then'](function(_0x462b1b){if(_0x462b1b){_0x3cc570[_0x4878('0x45')]=_[_0x4878('0x47')](db[_0x4878('0x97')][_0x4878('0x42')]);_0x3cc570[_0x4878('0x46')]=_[_0x4878('0x47')](_0x4302bc[_0x4878('0x46')]);_0x3cc570[_0x4878('0x4f')]=_[_0x4878('0x48')](_0x3cc570[_0x4878('0x45')],_0x3cc570[_0x4878('0x46')]);_0x3af4ad[_0x4878('0x49')]=_['intersection'](_0x3cc570['model'],qs['fields'](_0x4302bc[_0x4878('0x46')][_0x4878('0x4a')]));_0x3af4ad['attributes']=_0x3af4ad[_0x4878('0x49')]['length']?_0x3af4ad['attributes']:_0x3cc570['model'];if(!_0x4302bc[_0x4878('0x46')][_0x4878('0x6d')](_0x4878('0x72'))){_0x3af4ad[_0x4878('0x32')]=qs[_0x4878('0x32')](_0x4302bc[_0x4878('0x46')][_0x4878('0x32')]);_0x3af4ad[_0x4878('0x31')]=qs[_0x4878('0x31')](_0x4302bc[_0x4878('0x46')][_0x4878('0x31')]);}_0x3af4ad[_0x4878('0x4c')]=qs[_0x4878('0x4d')](_0x4302bc[_0x4878('0x46')][_0x4878('0x4d')]);_0x3af4ad[_0x4878('0x4e')]=qs[_0x4878('0x4f')](_[_0x4878('0x50')](_0x4302bc['query'],_0x3cc570['filters']));_0x3af4ad[_0x4878('0x4e')][_0x4878('0x69')]=_0x462b1b['id'];if(_0x4302bc[_0x4878('0x46')][_0x4878('0x54')]){_0x3af4ad[_0x4878('0x4e')]=_[_0x4878('0x51')](_0x3af4ad['where'],{'$or':_[_0x4878('0x40')](_0x3af4ad[_0x4878('0x49')],function(_0x5ab3a8){var _0x58c3b6={};_0x58c3b6[_0x5ab3a8]={'$like':'%'+_0x4302bc['query'][_0x4878('0x54')]+'%'};return _0x58c3b6;})});}_0x3af4ad=_['merge']({},_0x3af4ad,_0x4302bc[_0x4878('0x55')]);return db[_0x4878('0x97')][_0x4878('0x34')]({'where':_0x3af4ad[_0x4878('0x4e')]})['then'](function(_0x5bda3a){_0x3e38fe[_0x4878('0x34')]=_0x5bda3a;if(_0x4302bc[_0x4878('0x46')]['includeAll']){_0x3af4ad[_0x4878('0x57')]=[{'model':db['CmContact'],'as':_0x4878('0xb4'),'required':![]},{'model':db['User'],'as':_0x4878('0xb5'),'attributes':['name',_0x4878('0xb6'),_0x4878('0xb7')],'required':![]},{'model':db[_0x4878('0xb8')],'as':_0x4878('0xb9'),'attributes':['id',_0x4878('0x3c'),_0x4878('0xba')],'where':_0x4302bc[_0x4878('0x46')][_0x4878('0xbb')]?{'id':_0x4302bc['query']['tag']}:undefined,'required':_0x4302bc[_0x4878('0x46')]['tag']?!![]:![]}];}return db[_0x4878('0x97')]['findAll'](_0x3af4ad);})[_0x4878('0x22')](function(_0x199c90){_0x3e38fe[_0x4878('0x59')]=_0x199c90;return _0x3e38fe;});}})['then'](respondWithFilteredResult(_0x58220e,_0x3af4ad))['catch'](handleError(_0x58220e,null));};exports[_0x4878('0xbc')]=function(_0x423d9c,_0x3299d4,_0x5ccb27){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x423d9c[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x3299d4,null))[_0x4878('0x22')](function(_0x4197ae){if(_0x4197ae){return _0x4197ae[_0x4878('0xbc')](_0x423d9c[_0x4878('0x5d')][_0x4878('0xbd')],_[_0x4878('0xbe')](_0x423d9c['body'],[_0x4878('0xbd'),'id'])||{})['spread'](function(_0x1331ca){for(var _0x305161=0x0;_0x305161<_0x423d9c['body'][_0x4878('0xbd')][_0x4878('0x4b')];_0x305161+=0x1){socket[_0x4878('0xbf')](_0x4878('0xc0'),{'UserId':Number(_0x423d9c['body']['ids'][_0x305161]),'OpenchannelAccountId':Number(_0x423d9c[_0x4878('0x66')]['id'])});}return _0x1331ca;});}})[_0x4878('0x22')](respondWithResult(_0x3299d4,null))[_0x4878('0x2c')](handleError(_0x3299d4,null));};exports[_0x4878('0xc1')]=function(_0xeeb31b,_0x441029,_0x6e6cec){return db['OpenchannelAccount'][_0x4878('0x5b')]({'where':{'id':_0xeeb31b[_0x4878('0x66')]['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x441029,null))[_0x4878('0x22')](function(_0x388dfa){if(_0x388dfa){return _0x388dfa['removeAgents'](_0xeeb31b['query'][_0x4878('0xbd')])[_0x4878('0x22')](function(){if(_[_0x4878('0xc2')](_0xeeb31b['query']['ids'])){for(var _0x1f2c57=0x0;_0x1f2c57<_0xeeb31b[_0x4878('0x46')][_0x4878('0xbd')][_0x4878('0x4b')];_0x1f2c57+=0x1){socket[_0x4878('0xbf')](_0x4878('0xc3'),{'UserId':Number(_0xeeb31b[_0x4878('0x46')][_0x4878('0xbd')][_0x1f2c57]),'OpenchannelAccountId':Number(_0xeeb31b['params']['id'])});}}else{socket[_0x4878('0xbf')](_0x4878('0xc3'),{'UserId':Number(_0xeeb31b[_0x4878('0x46')][_0x4878('0xbd')]),'OpenchannelAccountId':Number(_0xeeb31b['params']['id'])});}});}})[_0x4878('0x22')](respondWithStatusCode(_0x441029,null))['catch'](handleError(_0x441029,null));};exports[_0x4878('0xc4')]=function(_0x1dd520,_0x576671,_0x2bdd6f){var _0x4e6702={};var _0x2a6bae={};var _0xcfcc03;var _0x566423;return db[_0x4878('0x41')][_0x4878('0x6c')]({'where':{'id':_0x1dd520[_0x4878('0x66')]['id']}})['then'](handleEntityNotFound(_0x576671,null))['then'](function(_0x116281){if(_0x116281){_0xcfcc03=_0x116281;_0x2a6bae['model']=_[_0x4878('0x47')](db[_0x4878('0xa2')][_0x4878('0x42')]);_0x2a6bae['query']=_[_0x4878('0x47')](_0x1dd520[_0x4878('0x46')]);_0x2a6bae[_0x4878('0x4f')]=_[_0x4878('0x48')](_0x2a6bae['model'],_0x2a6bae[_0x4878('0x46')]);_0x4e6702[_0x4878('0x49')]=_['intersection'](_0x2a6bae[_0x4878('0x45')],qs['fields'](_0x1dd520[_0x4878('0x46')][_0x4878('0x4a')]));_0x4e6702[_0x4878('0x49')]=_0x4e6702['attributes'][_0x4878('0x4b')]?_0x4e6702[_0x4878('0x49')]:_0x2a6bae[_0x4878('0x45')];_0x4e6702['order']=qs[_0x4878('0x4d')](_0x1dd520[_0x4878('0x46')]['sort']);_0x4e6702[_0x4878('0x4e')]=qs[_0x4878('0x4f')](_[_0x4878('0x50')](_0x1dd520['query'],_0x2a6bae[_0x4878('0x4f')]));if(_0x1dd520[_0x4878('0x46')][_0x4878('0x54')]){_0x4e6702['where']=_[_0x4878('0x51')](_0x4e6702['where'],{'$or':_[_0x4878('0x40')](_0x4e6702[_0x4878('0x49')],function(_0x1a10ac){var _0x58ed7a={};_0x58ed7a[_0x1a10ac]={'$like':'%'+_0x1dd520[_0x4878('0x46')][_0x4878('0x54')]+'%'};return _0x58ed7a;})});}_0x4e6702=_[_0x4878('0x51')]({},_0x4e6702,_0x1dd520['options']);return _0xcfcc03['getAgents'](_0x4e6702);}})[_0x4878('0x22')](function(_0x32f9b4){if(_0x32f9b4){_0x566423=_0x32f9b4['length'];if(!_0x1dd520['query'][_0x4878('0x6d')](_0x4878('0x72'))){_0x4e6702[_0x4878('0x32')]=qs[_0x4878('0x32')](_0x1dd520[_0x4878('0x46')]['limit']);_0x4e6702[_0x4878('0x31')]=qs[_0x4878('0x31')](_0x1dd520[_0x4878('0x46')][_0x4878('0x31')]);}return _0xcfcc03[_0x4878('0xc4')](_0x4e6702);}})[_0x4878('0x22')](function(_0x28e117){if(_0x28e117){return _0x28e117?{'count':_0x566423,'rows':_0x28e117}:null;}})[_0x4878('0x22')](respondWithResult(_0x576671,null))['catch'](handleError(_0x576671,null));};exports[_0x4878('0xb2')]=function(_0x232cc9,_0x253431,_0x5827af){var _0x4888a0,_0x33c78a,_0x4750e2;if(_['isNil'](_0x232cc9[_0x4878('0x5d')][_0x4878('0x5d')])||_0x232cc9['body'][_0x4878('0x5d')]===''){throw new db[(_0x4878('0x7e'))][(_0x4878('0x76'))](_0x4878('0x80'));}if(_[_0x4878('0x7d')](_0x232cc9[_0x4878('0x5d')]['to'])){}_0x4888a0=_0x232cc9[_0x4878('0x5d')]['to'];return db[_0x4878('0x41')][_0x4878('0x6c')]({'where':{'id':_0x232cc9['params']['id']}})[_0x4878('0x22')](handleEntityNotFound(_0x253431,null))[_0x4878('0x22')](function(_0x39c373){if(_0x39c373){return db[_0x4878('0x41')][_0x4878('0x5b')]({'where':{'id':_0x39c373['id']},'include':[{'model':db[_0x4878('0xc5')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4878('0x87'),'where':{[_0x39c373['mapKey']]:_0x4888a0},'limit':0x1,'order':[[_0x4878('0x79'),_0x4878('0x88')]]}]}]})[_0x4878('0x22')](handleEntityNotFound(_0x253431,null))[_0x4878('0x22')](function(_0x92aeb6){if(_0x92aeb6&&_0x92aeb6[_0x4878('0x86')]){_0x33c78a=_0x92aeb6[_0x4878('0x5e')]({'plain':!![]});if(_0x33c78a[_0x4878('0x86')]&&_0x33c78a[_0x4878('0x86')][_0x4878('0x87')][_0x4878('0x4b')]){return _0x33c78a[_0x4878('0x86')][_0x4878('0x87')][0x0];}return db['CmContact'][_0x4878('0x5c')](_[_0x4878('0x1d')](_0x232cc9['body'],{'firstName':_0x4888a0,[_0x92aeb6['mapKey']]:_0x4888a0,'phone':_0x4888a0,'ListId':_0x33c78a['ListId']}));}})[_0x4878('0x22')](handleEntityNotFound(_0x253431,null))['then'](function(_0x217683){if(_0x217683){_0x4750e2=_0x217683;return db[_0x4878('0x97')]['find']({'where':{'ContactId':_0x4750e2['id'],'closed':![],'OpenchannelAccountId':_0x33c78a['id']}})['then'](function(_0x876878){if(_0x876878){return[_0x876878,![]];}return db[_0x4878('0x97')][_0x4878('0x5c')]({'UserId':_0x232cc9['user']['id'],'ContactId':_0x4750e2['id'],'OpenchannelAccountId':_0x33c78a['id'],'lastMsgDirection':_0x4878('0xc6'),'firstMsgDirection':_0x4878('0xc6'),'Messages':[_[_0x4878('0x51')](_0x232cc9[_0x4878('0x5d')],{'read':![],'body':_0x232cc9['body']['body'],'OpenchannelAccountId':_0x33c78a['id'],'UserId':_0x232cc9[_0x4878('0x60')]['id'],'ContactId':_0x4750e2['id']})]},{'include':[{'model':db[_0x4878('0xa0')],'as':_0x4878('0xc7')}]})['then'](function(_0x40ed5f){return[_0x40ed5f,!![]];});});}})[_0x4878('0x98')](function(_0x46b23e,_0x54b4b9){if(_0x54b4b9){return _0x46b23e;}return db[_0x4878('0xa0')]['create'](_['merge'](_0x232cc9[_0x4878('0x5d')],{'read':![],'body':_0x232cc9['body'][_0x4878('0x5d')],'OpenchannelAccountId':_0x33c78a['id'],'OpenchannelInteractionId':_0x46b23e['id'],'UserId':_0x232cc9[_0x4878('0x60')]['id'],'ContactId':_0x4750e2['id']}))['then'](function(_0x4471f2){_0x46b23e[_0x4878('0xc8')][_0x4878('0xc7')]=[];_0x46b23e[_0x4878('0xc8')][_0x4878('0xc7')]['push'](_0x4471f2[_0x4878('0xc8')]);return _0x46b23e;});});}})['then'](respondWithResult(_0x253431,null))['catch'](handleError(_0x253431,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e9563bc..2962001 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 _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x1cb711,_0x3a63fe){var _0x9aa87d=function(_0x48ed39){while(--_0x48ed39){_0x1cb711['push'](_0x1cb711['shift']());}};_0x9aa87d(++_0x3a63fe);}(_0x1be1,0x192));var _0x11be=function(_0x3cf529,_0x4c0b38){_0x3cf529=_0x3cf529-0x0;var _0x35fad9=_0x1be1[_0x3cf529];return _0x35fad9;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0xc1c5d7,_0x313c88){var _0x2e1e88=function(_0x3acbee){while(--_0x3acbee){_0xc1c5d7['push'](_0xc1c5d7['shift']());}};_0x2e1e88(++_0x313c88);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x56a06f,_0x183813){_0x56a06f=_0x56a06f-0x0;var _0x3309ac=_0xbdb7[_0x56a06f];return _0x3309ac;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var OpenchannelAccount=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){OpenchannelAccountEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);OpenchannelAccountEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];OpenchannelAccount[_0x7bdb('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 48b3928..9daf4f5 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(_0x254ea1,_0x236bdd){var _0x27e390=function(_0x1a823f){while(--_0x1a823f){_0x254ea1['push'](_0x254ea1['shift']());}};_0x27e390(++_0x236bdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0xa570ff,_0x4dfa3d){var _0x17e396=function(_0x50947a){while(--_0x50947a){_0xa570ff['push'](_0xa570ff['shift']());}};_0x17e396(++_0x4dfa3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 afc8cdd..570381f 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 _0x1752=['client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x414a4e,_0x181824){var _0x13025f=function(_0x395d93){while(--_0x395d93){_0x414a4e['push'](_0x414a4e['shift']());}};_0x13025f(++_0x181824);}(_0x1752,0xa5));var _0x2175=function(_0xe179d5,_0x336fff){_0xe179d5=_0xe179d5-0x0;var _0x1912d0=_0x1752[_0xe179d5];return _0x1912d0;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});config[_0x2175('0xc')]=_[_0x2175('0xd')](config[_0x2175('0xc')],{'host':_0x2175('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2175('0xc')]));require(_0x2175('0xf'))[_0x2175('0x10')](socket);function respondWithRpcPromise(_0x455803,_0x77e3fa,_0x4be8c8){return new BPromise(function(_0x5ad5ad,_0x5717b0){return client[_0x2175('0x11')](_0x455803,_0x4be8c8)['then'](function(_0x5e275f){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x77e3fa,_0x2175('0x12'));logger['debug'](_0x2175('0x13'),_0x77e3fa,_0x2175('0x12'),JSON['stringify'](_0x5e275f));if(_0x5e275f[_0x2175('0x14')]){if(_0x5e275f[_0x2175('0x14')][_0x2175('0x15')]===0x1f4){logger[_0x2175('0x14')](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5717b0(_0x5e275f[_0x2175('0x14')]['message']);}logger['error'](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5ad5ad(_0x5e275f['error']['message']);}else{logger['info'](_0x2175('0x16'),_0x77e3fa,_0x2175('0x12'));_0x5ad5ad(_0x5e275f['result']['message']);}})[_0x2175('0x18')](function(_0x3d6467){logger[_0x2175('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x77e3fa,_0x3d6467);_0x5717b0(_0x3d6467);});});} \ No newline at end of file +var _0xa25c=['error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x24e591,_0x459d00){var _0xb4fec8=function(_0x2282e1){while(--_0x2282e1){_0x24e591['push'](_0x24e591['shift']());}};_0xb4fec8(++_0x459d00);}(_0xa25c,0x13f));var _0xca25=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0xa25c[_0x533897];return _0x340bbd;};'use strict';var _=require('lodash');var util=require(_0xca25('0x0'));var moment=require(_0xca25('0x1'));var BPromise=require(_0xca25('0x2'));var rs=require(_0xca25('0x3'));var fs=require('fs');var Redis=require(_0xca25('0x4'));var db=require(_0xca25('0x5'))['db'];var utils=require(_0xca25('0x6'));var logger=require(_0xca25('0x7'))('rpc');var config=require(_0xca25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca25('0x9')]({'port':0x232a});config['redis']=_[_0xca25('0xa')](config[_0xca25('0xb')],{'host':_0xca25('0xc'),'port':0x18eb});var socket=require(_0xca25('0xd'))(new Redis(config[_0xca25('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x44d596,_0x520a0a,_0x41b943){return new BPromise(function(_0xa6e8b2,_0x216c6a){return client['request'](_0x44d596,_0x41b943)['then'](function(_0x571c66){logger[_0xca25('0xe')](_0xca25('0xf'),_0x520a0a,_0xca25('0x10'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x520a0a,_0xca25('0x10'),JSON['stringify'](_0x571c66));if(_0x571c66[_0xca25('0x11')]){if(_0x571c66[_0xca25('0x11')][_0xca25('0x12')]===0x1f4){logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x571c66[_0xca25('0x11')][_0xca25('0x13')]);return _0x216c6a(_0x571c66[_0xca25('0x11')][_0xca25('0x13')]);}logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x571c66['error'][_0xca25('0x13')]);return _0xa6e8b2(_0x571c66[_0xca25('0x11')]['message']);}else{logger[_0xca25('0xe')](_0xca25('0xf'),_0x520a0a,_0xca25('0x10'));_0xa6e8b2(_0x571c66[_0xca25('0x14')][_0xca25('0x13')]);}})['catch'](function(_0x11d7f4){logger[_0xca25('0x11')](_0xca25('0xf'),_0x520a0a,_0x11d7f4);_0x216c6a(_0x11d7f4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 13eaa0a..ffa7cfe 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 _0xf996=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x35ddf6,_0x3764af){var _0x303da0=function(_0x5df8ec){while(--_0x5df8ec){_0x35ddf6['push'](_0x35ddf6['shift']());}};_0x303da0(++_0x3764af);}(_0xf996,0x74));var _0x6f99=function(_0x129071,_0x360dba){_0x129071=_0x129071-0x0;var _0x4edaab=_0xf996[_0x129071];return _0x4edaab;};'use strict';var OpenchannelAccountEvents=require(_0x6f99('0x0'));var events=[_0x6f99('0x1'),_0x6f99('0x2'),'update'];function createListener(_0x12ac12,_0x56fd3f){return function(_0x5ceb57){_0x56fd3f[_0x6f99('0x3')](_0x12ac12,_0x5ceb57);};}function removeListener(_0xa0b3d7,_0x274f12){return function(){OpenchannelAccountEvents[_0x6f99('0x4')](_0xa0b3d7,_0x274f12);};}exports[_0x6f99('0x5')]=function(_0xf2b5ee){for(var _0xa07ac1=0x0,_0x2883cb=events[_0x6f99('0x6')];_0xa07ac1<_0x2883cb;_0xa07ac1++){var _0x1e4805=events[_0xa07ac1];var _0x5d8b7f=createListener(_0x6f99('0x7')+_0x1e4805,_0xf2b5ee);OpenchannelAccountEvents['on'](_0x1e4805,_0x5d8b7f);}}; \ No newline at end of file +var _0x7a2c=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','register'];(function(_0x36b356,_0x5e9845){var _0x196872=function(_0x1dc474){while(--_0x1dc474){_0x36b356['push'](_0x36b356['shift']());}};_0x196872(++_0x5e9845);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x50796a,_0x3871f2){_0x50796a=_0x50796a-0x0;var _0x5ef86e=_0x7a2c[_0x50796a];return _0x5ef86e;};'use strict';var OpenchannelAccountEvents=require(_0xc7a2('0x0'));var events=['save',_0xc7a2('0x1'),_0xc7a2('0x2')];function createListener(_0x409ec5,_0x26fb61){return function(_0x44d702){_0x26fb61[_0xc7a2('0x3')](_0x409ec5,_0x44d702);};}function removeListener(_0x3f2b0d,_0x34cd60){return function(){OpenchannelAccountEvents['removeListener'](_0x3f2b0d,_0x34cd60);};}exports[_0xc7a2('0x4')]=function(_0x1ddbae){for(var _0x5f334e=0x0,_0x481430=events['length'];_0x5f334e<_0x481430;_0x5f334e++){var _0x1dd150=events[_0x5f334e];var _0x3de428=createListener(_0xc7a2('0x5')+_0x1dd150,_0x1ddbae);OpenchannelAccountEvents['on'](_0x1dd150,_0x3de428);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 66808eb..e9bb4cc 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 _0x720e=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','get','/:id','show','create','update','destroy','exports','multer'];(function(_0x3adda1,_0x516a63){var _0x28c863=function(_0x4d5fbf){while(--_0x4d5fbf){_0x3adda1['push'](_0x3adda1['shift']());}};_0x28c863(++_0x516a63);}(_0x720e,0x158));var _0xe720=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x720e[_0x120bc2];return _0x454a41;};'use strict';var multer=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var path=require(_0xe720('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe720('0x3'));var auth=require(_0xe720('0x4'));var interaction=require(_0xe720('0x5'));var config=require('../../config/environment');var controller=require(_0xe720('0x6'));router['get']('/',auth[_0xe720('0x7')](),controller['index']);router[_0xe720('0x8')](_0xe720('0x9'),auth[_0xe720('0x7')](),controller[_0xe720('0xa')]);router['post']('/',auth[_0xe720('0x7')](),controller[_0xe720('0xb')]);router['put'](_0xe720('0x9'),auth[_0xe720('0x7')](),controller[_0xe720('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe720('0xd')]);module[_0xe720('0xe')]=router; \ No newline at end of file +var _0x467d=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x37b647,_0x242852){var _0x4f5fad=function(_0x234fdf){while(--_0x234fdf){_0x37b647['push'](_0x37b647['shift']());}};_0x4f5fad(++_0x242852);}(_0x467d,0x146));var _0xd467=function(_0x2ae2c9,_0x4bc854){_0x2ae2c9=_0x2ae2c9-0x0;var _0x187d71=_0x467d[_0x2ae2c9];return _0x187d71;};'use strict';var multer=require(_0xd467('0x0'));var util=require(_0xd467('0x1'));var path=require('path');var timeout=require(_0xd467('0x2'));var express=require(_0xd467('0x3'));var router=express[_0xd467('0x4')]();var fs_extra=require(_0xd467('0x5'));var auth=require(_0xd467('0x6'));var interaction=require(_0xd467('0x7'));var config=require(_0xd467('0x8'));var controller=require(_0xd467('0x9'));router[_0xd467('0xa')]('/',auth[_0xd467('0xb')](),controller[_0xd467('0xc')]);router[_0xd467('0xa')](_0xd467('0xd'),auth[_0xd467('0xb')](),controller['show']);router[_0xd467('0xe')]('/',auth[_0xd467('0xb')](),controller[_0xd467('0xf')]);router[_0xd467('0x10')](_0xd467('0xd'),auth[_0xd467('0xb')](),controller[_0xd467('0x11')]);router[_0xd467('0x12')](_0xd467('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd467('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index dc4f551..dfccad3 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 _0xc118=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x15efac,_0x6f493e){var _0x14f63c=function(_0x2431af){while(--_0x2431af){_0x15efac['push'](_0x15efac['shift']());}};_0x14f63c(++_0x6f493e);}(_0xc118,0x12a));var _0x8c11=function(_0x2fbaf9,_0x20dfb0){_0x2fbaf9=_0x2fbaf9-0x0;var _0x209449=_0xc118[_0x2fbaf9];return _0x209449;};'use strict';var Sequelize=require(_0x8c11('0x0'));module[_0x8c11('0x1')]={'priority':{'type':Sequelize[_0x8c11('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c11('0x3')],'allowNull':![],'defaultValue':_0x8c11('0x4')},'appdata':{'type':Sequelize[_0x8c11('0x5')]()},'description':{'type':Sequelize[_0x8c11('0x3')]},'interval':{'type':Sequelize[_0x8c11('0x3')],'defaultValue':_0x8c11('0x6')}}; \ No newline at end of file +var _0xc518=['TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x5a1b58,_0x40287f){var _0x1b5032=function(_0x390f44){while(--_0x390f44){_0x5a1b58['push'](_0x5a1b58['shift']());}};_0x1b5032(++_0x40287f);}(_0xc518,0x196));var _0x8c51=function(_0x342993,_0x43f554){_0x342993=_0x342993-0x0;var _0x366ce=_0xc518[_0x342993];return _0x366ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8c51('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8c51('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8c51('0x2')]()},'description':{'type':Sequelize[_0x8c51('0x1')]},'interval':{'type':Sequelize[_0x8c51('0x1')],'defaultValue':_0x8c51('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d1d48f1..6303e10 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 _0x0780=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','OpenchannelApplication','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','status'];(function(_0x1ca506,_0x381af4){var _0x2516a6=function(_0x3b5b29){while(--_0x3b5b29){_0x1ca506['push'](_0x1ca506['shift']());}};_0x2516a6(++_0x381af4);}(_0x0780,0x7a));var _0x0078=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0x0780[_0x24fe48];return _0x51e7d5;};'use strict';var emlformat=require(_0x0078('0x0'));var rimraf=require(_0x0078('0x1'));var zipdir=require(_0x0078('0x2'));var jsonpatch=require(_0x0078('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0078('0x4'));var sox=require(_0x0078('0x5'));var csv=require(_0x0078('0x6'));var ejs=require(_0x0078('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0078('0x8'));var squel=require(_0x0078('0x9'));var crypto=require(_0x0078('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0078('0xb'));var toCsv=require(_0x0078('0x6'));var querystring=require(_0x0078('0xc'));var Papa=require(_0x0078('0xd'));var Redis=require(_0x0078('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0078('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0078('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0078('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0078('0x12'))['db'];function respondWithStatusCode(_0x1c999f,_0x41dbcf){_0x41dbcf=_0x41dbcf||0xcc;return function(_0x198130){if(_0x198130){return _0x1c999f['sendStatus'](_0x41dbcf);}return _0x1c999f[_0x0078('0x13')](_0x41dbcf)['end']();};}function respondWithResult(_0xeb5ddc,_0x2b78bc){_0x2b78bc=_0x2b78bc||0xc8;return function(_0xfc691c){if(_0xfc691c){return _0xeb5ddc[_0x0078('0x13')](_0x2b78bc)[_0x0078('0x14')](_0xfc691c);}};}function respondWithFilteredResult(_0x508dcb,_0x2b79bf){return function(_0x19ce6c){if(_0x19ce6c){var _0x4c70ec=typeof _0x2b79bf['offset']===_0x0078('0x15')&&typeof _0x2b79bf[_0x0078('0x16')]===_0x0078('0x15');var _0x30e3f5=_0x19ce6c[_0x0078('0x17')];var _0x21e35d=_0x4c70ec?0x0:_0x2b79bf['offset'];var _0xe8ea36=_0x4c70ec?_0x19ce6c[_0x0078('0x17')]:_0x2b79bf[_0x0078('0x18')]+_0x2b79bf['limit'];var _0x587873;if(_0xe8ea36>=_0x30e3f5){_0xe8ea36=_0x30e3f5;_0x587873=0xc8;}else{_0x587873=0xce;}_0x508dcb[_0x0078('0x13')](_0x587873);return _0x508dcb[_0x0078('0x19')](_0x0078('0x1a'),_0x21e35d+'-'+_0xe8ea36+'/'+_0x30e3f5)[_0x0078('0x14')](_0x19ce6c);}return null;};}function patchUpdates(_0x399b6e){return function(_0x3aa5b5){try{jsonpatch[_0x0078('0x1b')](_0x3aa5b5,_0x399b6e,!![]);}catch(_0x3d4466){return BPromise[_0x0078('0x1c')](_0x3d4466);}return _0x3aa5b5[_0x0078('0x1d')]();};}function saveUpdates(_0x18aaca,_0x48d6a8){return function(_0x3b513e){if(_0x3b513e){return _0x3b513e[_0x0078('0x1e')](_0x18aaca)[_0x0078('0x1f')](function(_0x43b670){return _0x43b670;});}return null;};}function removeEntity(_0x9a65c,_0x2e2122){return function(_0x4959ed){if(_0x4959ed){return _0x4959ed[_0x0078('0x20')]()[_0x0078('0x1f')](function(){_0x9a65c[_0x0078('0x13')](0xcc)[_0x0078('0x21')]();});}};}function handleEntityNotFound(_0x1156b8,_0x37a523){return function(_0x49f063){if(!_0x49f063){_0x1156b8['sendStatus'](0x194);}return _0x49f063;};}function handleError(_0xef4eda,_0x44f234){_0x44f234=_0x44f234||0x1f4;return function(_0x35ce06){logger['error'](_0x35ce06[_0x0078('0x22')]);if(_0x35ce06[_0x0078('0x23')]){delete _0x35ce06['name'];}_0xef4eda[_0x0078('0x13')](_0x44f234)[_0x0078('0x24')](_0x35ce06);};}exports[_0x0078('0x25')]=function(_0x10ba8f,_0x26bc60){var _0x2db457={},_0x4d16b6={},_0x1bb54e={'count':0x0,'rows':[]};var _0x4d549e=_[_0x0078('0x26')](db['OpenchannelApplication'][_0x0078('0x27')],function(_0x4e5ec6){return{'name':_0x4e5ec6[_0x0078('0x28')],'type':_0x4e5ec6[_0x0078('0x29')][_0x0078('0x2a')]};});_0x4d16b6[_0x0078('0x2b')]=_[_0x0078('0x26')](_0x4d549e,_0x0078('0x23'));_0x4d16b6[_0x0078('0x2c')]=_[_0x0078('0x2d')](_0x10ba8f['query']);_0x4d16b6['filters']=_[_0x0078('0x2e')](_0x4d16b6['model'],_0x4d16b6[_0x0078('0x2c')]);_0x2db457[_0x0078('0x2f')]=_['intersection'](_0x4d16b6[_0x0078('0x2b')],qs[_0x0078('0x30')](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x30')]));_0x2db457[_0x0078('0x2f')]=_0x2db457[_0x0078('0x2f')][_0x0078('0x31')]?_0x2db457[_0x0078('0x2f')]:_0x4d16b6[_0x0078('0x2b')];if(!_0x10ba8f[_0x0078('0x2c')][_0x0078('0x32')](_0x0078('0x33'))){_0x2db457[_0x0078('0x16')]=qs['limit'](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x16')]);_0x2db457['offset']=qs[_0x0078('0x18')](_0x10ba8f['query'][_0x0078('0x18')]);}_0x2db457['order']=qs[_0x0078('0x34')](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x34')]);_0x2db457['where']=qs[_0x0078('0x35')](_[_0x0078('0x36')](_0x10ba8f['query'],_0x4d16b6[_0x0078('0x35')]),_0x4d549e);if(_0x10ba8f[_0x0078('0x2c')][_0x0078('0x37')]){_0x2db457[_0x0078('0x38')]=_[_0x0078('0x39')](_0x2db457[_0x0078('0x38')],{'$or':_[_0x0078('0x26')](_0x4d549e,function(_0x99ec66){if(_0x99ec66[_0x0078('0x29')]!==_0x0078('0x3a')){var _0x47414b={};_0x47414b[_0x99ec66[_0x0078('0x23')]]={'$like':'%'+_0x10ba8f['query'][_0x0078('0x37')]+'%'};return _0x47414b;}})});}_0x2db457=_[_0x0078('0x39')]({},_0x2db457,_0x10ba8f[_0x0078('0x3b')]);var _0x32ee23={'where':_0x2db457[_0x0078('0x38')]};return db['OpenchannelApplication'][_0x0078('0x17')](_0x32ee23)['then'](function(_0x55778a){_0x1bb54e[_0x0078('0x17')]=_0x55778a;if(_0x10ba8f['query'][_0x0078('0x3c')]){_0x2db457[_0x0078('0x3d')]=[{'all':!![]}];}return db[_0x0078('0x3e')][_0x0078('0x3f')](_0x2db457);})[_0x0078('0x1f')](function(_0x1b21c4){_0x1bb54e[_0x0078('0x40')]=_0x1b21c4;return _0x1bb54e;})[_0x0078('0x1f')](respondWithFilteredResult(_0x26bc60,_0x2db457))[_0x0078('0x41')](handleError(_0x26bc60,null));};exports[_0x0078('0x42')]=function(_0x3a22aa,_0x9afe05){var _0x52d38a={'raw':!![],'where':{'id':_0x3a22aa[_0x0078('0x43')]['id']}},_0x177108={};_0x177108['model']=_[_0x0078('0x2d')](db[_0x0078('0x3e')][_0x0078('0x27')]);_0x177108[_0x0078('0x2c')]=_[_0x0078('0x2d')](_0x3a22aa['query']);_0x177108[_0x0078('0x35')]=_[_0x0078('0x2e')](_0x177108[_0x0078('0x2b')],_0x177108[_0x0078('0x2c')]);_0x52d38a[_0x0078('0x2f')]=_[_0x0078('0x2e')](_0x177108[_0x0078('0x2b')],qs['fields'](_0x3a22aa['query'][_0x0078('0x30')]));_0x52d38a['attributes']=_0x52d38a[_0x0078('0x2f')][_0x0078('0x31')]?_0x52d38a[_0x0078('0x2f')]:_0x177108[_0x0078('0x2b')];if(_0x3a22aa[_0x0078('0x2c')][_0x0078('0x3c')]){_0x52d38a[_0x0078('0x3d')]=[{'all':!![]}];}_0x52d38a=_[_0x0078('0x39')]({},_0x52d38a,_0x3a22aa['options']);return db[_0x0078('0x3e')]['find'](_0x52d38a)[_0x0078('0x1f')](handleEntityNotFound(_0x9afe05,null))['then'](respondWithResult(_0x9afe05,null))[_0x0078('0x41')](handleError(_0x9afe05,null));};exports['create']=function(_0xfdbfd7,_0x27d037){return db[_0x0078('0x3e')][_0x0078('0x44')](_0xfdbfd7['body'],{})['then'](respondWithResult(_0x27d037,0xc9))[_0x0078('0x41')](handleError(_0x27d037,null));};exports[_0x0078('0x1e')]=function(_0x563114,_0x6e997f){if(_0x563114['body']['id']){delete _0x563114[_0x0078('0x45')]['id'];}return db['OpenchannelApplication'][_0x0078('0x46')]({'where':{'id':_0x563114[_0x0078('0x43')]['id']}})['then'](handleEntityNotFound(_0x6e997f,null))[_0x0078('0x1f')](saveUpdates(_0x563114[_0x0078('0x45')],null))['then'](respondWithResult(_0x6e997f,null))['catch'](handleError(_0x6e997f,null));};exports['destroy']=function(_0x517f31,_0xaff61){return db['OpenchannelApplication']['find']({'where':{'id':_0x517f31[_0x0078('0x43')]['id']}})[_0x0078('0x1f')](handleEntityNotFound(_0xaff61,null))[_0x0078('0x1f')](removeEntity(_0xaff61,null))[_0x0078('0x41')](handleError(_0xaff61,null));}; \ No newline at end of file +var _0x9d22=['where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','offset','order','pick','filter'];(function(_0x20f2a5,_0x43b025){var _0x4ffd4b=function(_0x3bd178){while(--_0x3bd178){_0x20f2a5['push'](_0x20f2a5['shift']());}};_0x4ffd4b(++_0x43b025);}(_0x9d22,0x1d8));var _0x29d2=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x9d22[_0x28edda];return _0x21f4a4;};'use strict';var emlformat=require(_0x29d2('0x0'));var rimraf=require(_0x29d2('0x1'));var zipdir=require(_0x29d2('0x2'));var jsonpatch=require(_0x29d2('0x3'));var rp=require(_0x29d2('0x4'));var moment=require(_0x29d2('0x5'));var BPromise=require(_0x29d2('0x6'));var Mustache=require('mustache');var util=require(_0x29d2('0x7'));var path=require(_0x29d2('0x8'));var sox=require('sox');var csv=require(_0x29d2('0x9'));var ejs=require(_0x29d2('0xa'));var fs=require('fs');var fs_extra=require(_0x29d2('0xb'));var _=require('lodash');var squel=require(_0x29d2('0xc'));var crypto=require('crypto');var jsforce=require(_0x29d2('0xd'));var deskjs=require(_0x29d2('0xe'));var toCsv=require(_0x29d2('0x9'));var querystring=require(_0x29d2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x29d2('0x10'));var as=require(_0x29d2('0x11'));var hardwareService=require(_0x29d2('0x12'));var logger=require(_0x29d2('0x13'))(_0x29d2('0x14'));var utils=require(_0x29d2('0x15'));var config=require(_0x29d2('0x16'));var licenseUtil=require(_0x29d2('0x17'));var db=require(_0x29d2('0x18'))['db'];function respondWithStatusCode(_0x2b8f9c,_0x55e4aa){_0x55e4aa=_0x55e4aa||0xcc;return function(_0x1632b3){if(_0x1632b3){return _0x2b8f9c['sendStatus'](_0x55e4aa);}return _0x2b8f9c['status'](_0x55e4aa)['end']();};}function respondWithResult(_0x3c4506,_0x2ff085){_0x2ff085=_0x2ff085||0xc8;return function(_0x2fdfad){if(_0x2fdfad){return _0x3c4506[_0x29d2('0x19')](_0x2ff085)[_0x29d2('0x1a')](_0x2fdfad);}};}function respondWithFilteredResult(_0x419dd4,_0x3034c4){return function(_0x37ba38){if(_0x37ba38){var _0x15bf41=typeof _0x3034c4['offset']===_0x29d2('0x1b')&&typeof _0x3034c4['limit']===_0x29d2('0x1b');var _0x54c539=_0x37ba38[_0x29d2('0x1c')];var _0xa7fef9=_0x15bf41?0x0:_0x3034c4['offset'];var _0x572c58=_0x15bf41?_0x37ba38[_0x29d2('0x1c')]:_0x3034c4['offset']+_0x3034c4[_0x29d2('0x1d')];var _0x4d39b4;if(_0x572c58>=_0x54c539){_0x572c58=_0x54c539;_0x4d39b4=0xc8;}else{_0x4d39b4=0xce;}_0x419dd4[_0x29d2('0x19')](_0x4d39b4);return _0x419dd4[_0x29d2('0x1e')](_0x29d2('0x1f'),_0xa7fef9+'-'+_0x572c58+'/'+_0x54c539)[_0x29d2('0x1a')](_0x37ba38);}return null;};}function patchUpdates(_0x1cd47c){return function(_0x208bd3){try{jsonpatch[_0x29d2('0x20')](_0x208bd3,_0x1cd47c,!![]);}catch(_0x2c14ad){return BPromise['reject'](_0x2c14ad);}return _0x208bd3[_0x29d2('0x21')]();};}function saveUpdates(_0x1724ec,_0x165097){return function(_0x1a5403){if(_0x1a5403){return _0x1a5403[_0x29d2('0x22')](_0x1724ec)[_0x29d2('0x23')](function(_0x4b3520){return _0x4b3520;});}return null;};}function removeEntity(_0x3f0a02,_0x214cea){return function(_0x2e0680){if(_0x2e0680){return _0x2e0680[_0x29d2('0x24')]()[_0x29d2('0x23')](function(){_0x3f0a02[_0x29d2('0x19')](0xcc)[_0x29d2('0x25')]();});}};}function handleEntityNotFound(_0x1f7a97,_0x1efdc3){return function(_0x4c6796){if(!_0x4c6796){_0x1f7a97[_0x29d2('0x26')](0x194);}return _0x4c6796;};}function handleError(_0x4b3d14,_0x247f91){_0x247f91=_0x247f91||0x1f4;return function(_0x191a23){logger[_0x29d2('0x27')](_0x191a23[_0x29d2('0x28')]);if(_0x191a23['name']){delete _0x191a23[_0x29d2('0x29')];}_0x4b3d14['status'](_0x247f91)[_0x29d2('0x2a')](_0x191a23);};}exports[_0x29d2('0x2b')]=function(_0x1b3188,_0x54e585){var _0x9540de={},_0x23d6d9={},_0x5cd3cc={'count':0x0,'rows':[]};var _0x2aeb2f=_[_0x29d2('0x2c')](db[_0x29d2('0x2d')][_0x29d2('0x2e')],function(_0x3e018f){return{'name':_0x3e018f[_0x29d2('0x2f')],'type':_0x3e018f['type'][_0x29d2('0x30')]};});_0x23d6d9[_0x29d2('0x31')]=_[_0x29d2('0x2c')](_0x2aeb2f,_0x29d2('0x29'));_0x23d6d9['query']=_['keys'](_0x1b3188[_0x29d2('0x32')]);_0x23d6d9[_0x29d2('0x33')]=_['intersection'](_0x23d6d9['model'],_0x23d6d9[_0x29d2('0x32')]);_0x9540de[_0x29d2('0x34')]=_[_0x29d2('0x35')](_0x23d6d9['model'],qs[_0x29d2('0x36')](_0x1b3188[_0x29d2('0x32')][_0x29d2('0x36')]));_0x9540de[_0x29d2('0x34')]=_0x9540de['attributes']['length']?_0x9540de[_0x29d2('0x34')]:_0x23d6d9['model'];if(!_0x1b3188['query'][_0x29d2('0x37')]('nolimit')){_0x9540de[_0x29d2('0x1d')]=qs['limit'](_0x1b3188[_0x29d2('0x32')][_0x29d2('0x1d')]);_0x9540de['offset']=qs[_0x29d2('0x38')](_0x1b3188[_0x29d2('0x32')][_0x29d2('0x38')]);}_0x9540de[_0x29d2('0x39')]=qs['sort'](_0x1b3188[_0x29d2('0x32')]['sort']);_0x9540de['where']=qs[_0x29d2('0x33')](_[_0x29d2('0x3a')](_0x1b3188['query'],_0x23d6d9[_0x29d2('0x33')]),_0x2aeb2f);if(_0x1b3188[_0x29d2('0x32')][_0x29d2('0x3b')]){_0x9540de[_0x29d2('0x3c')]=_['merge'](_0x9540de[_0x29d2('0x3c')],{'$or':_[_0x29d2('0x2c')](_0x2aeb2f,function(_0xdd677f){if(_0xdd677f[_0x29d2('0x3d')]!==_0x29d2('0x3e')){var _0x1dac91={};_0x1dac91[_0xdd677f[_0x29d2('0x29')]]={'$like':'%'+_0x1b3188[_0x29d2('0x32')][_0x29d2('0x3b')]+'%'};return _0x1dac91;}})});}_0x9540de=_[_0x29d2('0x3f')]({},_0x9540de,_0x1b3188[_0x29d2('0x40')]);var _0x533e2f={'where':_0x9540de[_0x29d2('0x3c')]};return db[_0x29d2('0x2d')][_0x29d2('0x1c')](_0x533e2f)['then'](function(_0x550b9a){_0x5cd3cc[_0x29d2('0x1c')]=_0x550b9a;if(_0x1b3188[_0x29d2('0x32')][_0x29d2('0x41')]){_0x9540de['include']=[{'all':!![]}];}return db[_0x29d2('0x2d')][_0x29d2('0x42')](_0x9540de);})[_0x29d2('0x23')](function(_0x29a193){_0x5cd3cc[_0x29d2('0x43')]=_0x29a193;return _0x5cd3cc;})['then'](respondWithFilteredResult(_0x54e585,_0x9540de))[_0x29d2('0x44')](handleError(_0x54e585,null));};exports['show']=function(_0xa19e3,_0x5226a2){var _0x25fda2={'raw':!![],'where':{'id':_0xa19e3[_0x29d2('0x45')]['id']}},_0x1d2cd4={};_0x1d2cd4['model']=_[_0x29d2('0x46')](db[_0x29d2('0x2d')]['rawAttributes']);_0x1d2cd4[_0x29d2('0x32')]=_[_0x29d2('0x46')](_0xa19e3[_0x29d2('0x32')]);_0x1d2cd4[_0x29d2('0x33')]=_[_0x29d2('0x35')](_0x1d2cd4[_0x29d2('0x31')],_0x1d2cd4['query']);_0x25fda2[_0x29d2('0x34')]=_[_0x29d2('0x35')](_0x1d2cd4[_0x29d2('0x31')],qs['fields'](_0xa19e3['query'][_0x29d2('0x36')]));_0x25fda2['attributes']=_0x25fda2['attributes'][_0x29d2('0x47')]?_0x25fda2[_0x29d2('0x34')]:_0x1d2cd4[_0x29d2('0x31')];if(_0xa19e3[_0x29d2('0x32')][_0x29d2('0x41')]){_0x25fda2[_0x29d2('0x48')]=[{'all':!![]}];}_0x25fda2=_[_0x29d2('0x3f')]({},_0x25fda2,_0xa19e3[_0x29d2('0x40')]);return db[_0x29d2('0x2d')][_0x29d2('0x49')](_0x25fda2)['then'](handleEntityNotFound(_0x5226a2,null))[_0x29d2('0x23')](respondWithResult(_0x5226a2,null))[_0x29d2('0x44')](handleError(_0x5226a2,null));};exports['create']=function(_0x2e2a7e,_0x2791f9){return db[_0x29d2('0x2d')][_0x29d2('0x4a')](_0x2e2a7e[_0x29d2('0x4b')],{})['then'](respondWithResult(_0x2791f9,0xc9))[_0x29d2('0x44')](handleError(_0x2791f9,null));};exports[_0x29d2('0x22')]=function(_0x184b9c,_0x1bcbcf){if(_0x184b9c['body']['id']){delete _0x184b9c[_0x29d2('0x4b')]['id'];}return db[_0x29d2('0x2d')]['find']({'where':{'id':_0x184b9c[_0x29d2('0x45')]['id']}})[_0x29d2('0x23')](handleEntityNotFound(_0x1bcbcf,null))[_0x29d2('0x23')](saveUpdates(_0x184b9c[_0x29d2('0x4b')],null))[_0x29d2('0x23')](respondWithResult(_0x1bcbcf,null))[_0x29d2('0x44')](handleError(_0x1bcbcf,null));};exports[_0x29d2('0x24')]=function(_0x1231cd,_0xd6b85f){return db['OpenchannelApplication'][_0x29d2('0x49')]({'where':{'id':_0x1231cd[_0x29d2('0x45')]['id']}})[_0x29d2('0x23')](handleEntityNotFound(_0xd6b85f,null))[_0x29d2('0x23')](removeEntity(_0xd6b85f,null))[_0x29d2('0x44')](handleError(_0xd6b85f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 171d09d..1167f7e 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 _0xdeab=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x2da95d,_0xf7b8dc){var _0x364121=function(_0x13f978){while(--_0x13f978){_0x2da95d['push'](_0x2da95d['shift']());}};_0x364121(++_0xf7b8dc);}(_0xdeab,0x98));var _0xbdea=function(_0x5233e5,_0x4e1b19){_0x5233e5=_0x5233e5-0x0;var _0x2a6caf=_0xdeab[_0x5233e5];return _0x2a6caf;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var logger=require(_0xbdea('0x2'))(_0xbdea('0x3'));var moment=require('moment');var BPromise=require(_0xbdea('0x4'));var rp=require(_0xbdea('0x5'));var fs=require('fs');var path=require(_0xbdea('0x6'));var rimraf=require('rimraf');var config=require(_0xbdea('0x7'));var attributes=require(_0xbdea('0x8'));module[_0xbdea('0x9')]=function(_0x530a4b,_0x574ff3){return _0x530a4b[_0xbdea('0xa')](_0xbdea('0xb'),attributes,{'tableName':_0xbdea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbdea('0xd')});}; \ No newline at end of file +var _0x91a4=['moment','request-promise','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x46ab0b,_0x515b56){var _0x2b845c=function(_0x513ead){while(--_0x513ead){_0x46ab0b['push'](_0x46ab0b['shift']());}};_0x2b845c(++_0x515b56);}(_0x91a4,0x148));var _0x491a=function(_0x4c1399,_0x3deb58){_0x4c1399=_0x4c1399-0x0;var _0x3f9717=_0x91a4[_0x4c1399];return _0x3f9717;};'use strict';var _=require(_0x491a('0x0'));var util=require(_0x491a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x491a('0x2'));var BPromise=require('bluebird');var rp=require(_0x491a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x491a('0x4'));module[_0x491a('0x5')]=function(_0x6c5193,_0x4af5be){return _0x6c5193[_0x491a('0x6')](_0x491a('0x7'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x491a('0x8'),'collate':_0x491a('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 212aa9c..990bff6 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 _0x675b=['../../config/environment','request','then','info','request\x20sent','debug','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x48f9dc,_0x34b322){var _0x2026f1=function(_0x2952ea){while(--_0x2952ea){_0x48f9dc['push'](_0x48f9dc['shift']());}};_0x2026f1(++_0x34b322);}(_0x675b,0x86));var _0xb675=function(_0x58b754,_0x17f588){_0x58b754=_0x58b754-0x0;var _0x39fe56=_0x675b[_0x58b754];return _0x39fe56;};'use strict';var _=require(_0xb675('0x0'));var util=require(_0xb675('0x1'));var moment=require('moment');var BPromise=require(_0xb675('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb675('0x3'));var db=require(_0xb675('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb675('0x5'));var config=require(_0xb675('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x456dee,_0x401cc5,_0x5b1f9b){return new BPromise(function(_0x11ded0,_0x33d3e6){return client[_0xb675('0x7')](_0x456dee,_0x5b1f9b)[_0xb675('0x8')](function(_0x1bec9f){logger[_0xb675('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'));logger[_0xb675('0xb')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'),JSON['stringify'](_0x1bec9f));if(_0x1bec9f[_0xb675('0xc')]){if(_0x1bec9f[_0xb675('0xc')][_0xb675('0xd')]===0x1f4){logger[_0xb675('0xc')](_0xb675('0xe'),_0x401cc5,_0x1bec9f[_0xb675('0xc')][_0xb675('0xf')]);return _0x33d3e6(_0x1bec9f[_0xb675('0xc')][_0xb675('0xf')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0x1bec9f['error'][_0xb675('0xf')]);return _0x11ded0(_0x1bec9f['error'][_0xb675('0xf')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'));_0x11ded0(_0x1bec9f[_0xb675('0x10')][_0xb675('0xf')]);}})[_0xb675('0x11')](function(_0x2ac42a){logger[_0xb675('0xc')](_0xb675('0xe'),_0x401cc5,_0x2ac42a);_0x33d3e6(_0x2ac42a);});});}exports[_0xb675('0x12')]=function(_0x45eb4e){var _0x1d542e=this;return new Promise(function(_0x337a33,_0x250eea){return db[_0xb675('0x13')][_0xb675('0x14')](_0x45eb4e[_0xb675('0x15')],{'raw':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e[_0xb675('0x16')][_0xb675('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45eb4e['options']?_0x45eb4e[_0xb675('0x16')][_0xb675('0x18')]||null:null,'attributes':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e['options'][_0xb675('0x19')]||null:null,'limit':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e[_0xb675('0x16')][_0xb675('0x1a')]||null:null})[_0xb675('0x8')](function(_0xe89f73){logger[_0xb675('0x9')](_0xb675('0x12'),_0x45eb4e);logger['debug'](_0xb675('0x12'),_0x45eb4e,JSON[_0xb675('0x1b')](_0xe89f73));_0x337a33(_0xe89f73);})['catch'](function(_0x4dda3f){logger[_0xb675('0xc')](_0xb675('0x12'),_0x4dda3f[_0xb675('0xf')],_0x45eb4e);_0x250eea(_0x1d542e[_0xb675('0xc')](0x1f4,_0x4dda3f[_0xb675('0xf')]));});});}; \ No newline at end of file +var _0x3671=['rpc','../../config/environment','client','http','request','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','limit','catch','lodash','moment','randomstring','ioredis','../../config/logger'];(function(_0x12ea73,_0x20d5d3){var _0x3134e8=function(_0x3615b8){while(--_0x3615b8){_0x12ea73['push'](_0x12ea73['shift']());}};_0x3134e8(++_0x20d5d3);}(_0x3671,0x109));var _0x1367=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x3671[_0x9d639c];return _0x1671de;};'use strict';var _=require(_0x1367('0x0'));var util=require('util');var moment=require(_0x1367('0x1'));var BPromise=require('bluebird');var rs=require(_0x1367('0x2'));var fs=require('fs');var Redis=require(_0x1367('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1367('0x4'))(_0x1367('0x5'));var config=require(_0x1367('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1367('0x7')][_0x1367('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xeca039,_0x160ab9,_0x687a57){return new BPromise(function(_0x1ddbc3,_0x9ca7){return client[_0x1367('0x9')](_0xeca039,_0x687a57)['then'](function(_0x1e5794){logger[_0x1367('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x160ab9,_0x1367('0xb'));logger['debug'](_0x1367('0xc'),_0x160ab9,'request\x20sent',JSON[_0x1367('0xd')](_0x1e5794));if(_0x1e5794[_0x1367('0xe')]){if(_0x1e5794[_0x1367('0xe')][_0x1367('0xf')]===0x1f4){logger[_0x1367('0xe')](_0x1367('0x10'),_0x160ab9,_0x1e5794[_0x1367('0xe')]['message']);return _0x9ca7(_0x1e5794[_0x1367('0xe')][_0x1367('0x11')]);}logger[_0x1367('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x160ab9,_0x1e5794['error'][_0x1367('0x11')]);return _0x1ddbc3(_0x1e5794[_0x1367('0xe')][_0x1367('0x11')]);}else{logger[_0x1367('0xa')](_0x1367('0x10'),_0x160ab9,'request\x20sent');_0x1ddbc3(_0x1e5794['result'][_0x1367('0x11')]);}})['catch'](function(_0x1946b0){logger[_0x1367('0xe')](_0x1367('0x10'),_0x160ab9,_0x1946b0);_0x9ca7(_0x1946b0);});});}exports[_0x1367('0x12')]=function(_0x59afd7){var _0x545fcc=this;return new Promise(function(_0x1c0eae,_0x2f2760){return db[_0x1367('0x13')][_0x1367('0x14')](_0x59afd7[_0x1367('0x15')],{'raw':_0x59afd7[_0x1367('0x16')]?_0x59afd7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59afd7[_0x1367('0x16')]?_0x59afd7[_0x1367('0x16')][_0x1367('0x17')]||null:null,'attributes':_0x59afd7[_0x1367('0x16')]?_0x59afd7[_0x1367('0x16')][_0x1367('0x18')]||null:null,'limit':_0x59afd7[_0x1367('0x16')]?_0x59afd7[_0x1367('0x16')][_0x1367('0x19')]||null:null})['then'](function(_0x1ac11a){logger[_0x1367('0xa')](_0x1367('0x12'),_0x59afd7);logger['debug'](_0x1367('0x12'),_0x59afd7,JSON['stringify'](_0x1ac11a));_0x1c0eae(_0x1ac11a);})[_0x1367('0x1a')](function(_0x1dd0b5){logger[_0x1367('0xe')](_0x1367('0x12'),_0x1dd0b5[_0x1367('0x11')],_0x59afd7);_0x2f2760(_0x545fcc[_0x1367('0xe')](0x1f4,_0x1dd0b5[_0x1367('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index fe00e57..6b1d669 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 _0xff3d=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports'];(function(_0x17c5ef,_0x236eef){var _0x10e200=function(_0x5a9f38){while(--_0x5a9f38){_0x17c5ef['push'](_0x17c5ef['shift']());}};_0x10e200(++_0x236eef);}(_0xff3d,0x12c));var _0xdff3=function(_0x81b2b5,_0x19eb6f){_0x81b2b5=_0x81b2b5-0x0;var _0x38809d=_0xff3d[_0x81b2b5];return _0x38809d;};'use strict';var multer=require(_0xdff3('0x0'));var util=require('util');var path=require(_0xdff3('0x1'));var timeout=require(_0xdff3('0x2'));var express=require('express');var router=express[_0xdff3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdff3('0x4'));var interaction=require(_0xdff3('0x5'));var config=require(_0xdff3('0x6'));var controller=require(_0xdff3('0x7'));router[_0xdff3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdff3('0x8')](_0xdff3('0x9'),auth['isAuthenticated'](),controller[_0xdff3('0xa')]);router[_0xdff3('0x8')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),controller['show']);router[_0xdff3('0x8')](_0xdff3('0xd'),auth[_0xdff3('0xc')](),controller[_0xdff3('0xe')]);router[_0xdff3('0x8')](_0xdff3('0xf'),auth[_0xdff3('0xc')](),controller[_0xdff3('0x10')]);router[_0xdff3('0x11')]('/',auth[_0xdff3('0xc')](),controller['create']);router['post'](_0xdff3('0xd'),auth[_0xdff3('0xc')](),controller['addMessage']);router[_0xdff3('0x11')]('/:id/tags',auth[_0xdff3('0xc')](),interaction[_0xdff3('0x12')](_0xdff3('0x13'),'openchannelinteraction:addtags'),controller[_0xdff3('0x14')]);router[_0xdff3('0x15')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),interaction['tracked']('openchannel',_0xdff3('0x16')),controller[_0xdff3('0x17')]);router[_0xdff3('0x18')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),interaction[_0xdff3('0x12')]('openchannel',_0xdff3('0x19')),controller[_0xdff3('0x1a')]);router[_0xdff3('0x18')](_0xdff3('0x1b'),auth[_0xdff3('0xc')](),controller[_0xdff3('0x1c')]);module[_0xdff3('0x1d')]=router; \ No newline at end of file +var _0x630a=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','exports','multer','util','path','connect-timeout'];(function(_0x2011b3,_0x7c4048){var _0x1bdd08=function(_0x5d4ff8){while(--_0x5d4ff8){_0x2011b3['push'](_0x2011b3['shift']());}};_0x1bdd08(++_0x7c4048);}(_0x630a,0x18f));var _0xa630=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x630a[_0x20cb20];return _0x2fcf4b;};'use strict';var multer=require(_0xa630('0x0'));var util=require(_0xa630('0x1'));var path=require(_0xa630('0x2'));var timeout=require(_0xa630('0x3'));var express=require(_0xa630('0x4'));var router=express[_0xa630('0x5')]();var fs_extra=require(_0xa630('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa630('0x7'));var config=require(_0xa630('0x8'));var controller=require('./openchannelInteraction.controller');router[_0xa630('0x9')]('/',auth['isAuthenticated'](),controller[_0xa630('0xa')]);router[_0xa630('0x9')]('/describe',auth[_0xa630('0xb')](),controller[_0xa630('0xc')]);router[_0xa630('0x9')](_0xa630('0xd'),auth[_0xa630('0xb')](),controller[_0xa630('0xe')]);router[_0xa630('0x9')](_0xa630('0xf'),auth['isAuthenticated'](),controller[_0xa630('0x10')]);router[_0xa630('0x9')](_0xa630('0x11'),auth[_0xa630('0xb')](),controller['download']);router['post']('/',auth[_0xa630('0xb')](),controller[_0xa630('0x12')]);router[_0xa630('0x13')](_0xa630('0xf'),auth[_0xa630('0xb')](),controller[_0xa630('0x14')]);router[_0xa630('0x13')](_0xa630('0x15'),auth[_0xa630('0xb')](),interaction['tracked'](_0xa630('0x16'),_0xa630('0x17')),controller['addTags']);router[_0xa630('0x18')](_0xa630('0xd'),auth['isAuthenticated'](),interaction[_0xa630('0x19')](_0xa630('0x16'),_0xa630('0x1a')),controller[_0xa630('0x1b')]);router[_0xa630('0x1c')](_0xa630('0xd'),auth[_0xa630('0xb')](),interaction[_0xa630('0x19')](_0xa630('0x16'),_0xa630('0x1d')),controller['destroy']);router['delete'](_0xa630('0x15'),auth[_0xa630('0xb')](),controller['removeTags']);module[_0xa630('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7f4ecd1..e282fd3 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 _0xca4a=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','ENUM'];(function(_0x10f964,_0x51a1b8){var _0x197dbf=function(_0x1c96de){while(--_0x1c96de){_0x10f964['push'](_0x10f964['shift']());}};_0x197dbf(++_0x51a1b8);}(_0xca4a,0xaa));var _0xaca4=function(_0x5adb97,_0x2b1702){_0x5adb97=_0x5adb97-0x0;var _0x142516=_0xca4a[_0x5adb97];return _0x142516;};'use strict';var Sequelize=require(_0xaca4('0x0'));module[_0xaca4('0x1')]={'closed':{'type':Sequelize[_0xaca4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaca4('0x3')]},'secondDisposition':{'type':Sequelize[_0xaca4('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaca4('0x3')]},'note':{'type':Sequelize[_0xaca4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xaca4('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaca4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaca4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xaca4('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xaca4('0x6')]}}; \ No newline at end of file +var _0x4fad=['sequelize','exports','BOOLEAN','STRING','DATE','out','INTEGER'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4fad,0xcb));var _0xd4fa=function(_0x59274f,_0x3ac855){_0x59274f=_0x59274f-0x0;var _0xd055de=_0x4fad[_0x59274f];return _0xd055de;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'closed':{'type':Sequelize[_0xd4fa('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd4fa('0x3')]},'secondDisposition':{'type':Sequelize[_0xd4fa('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd4fa('0x3')]},'note':{'type':Sequelize[_0xd4fa('0x3')]},'read1stAt':{'type':Sequelize[_0xd4fa('0x4')]},'threadId':{'type':Sequelize[_0xd4fa('0x3')]},'externalUrl':{'type':Sequelize[_0xd4fa('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd4fa('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd4fa('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd4fa('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd4fa('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd4fa('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd4fa('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 47a971c..a22ad99 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 _0x7c75=['sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','basename','existsSync','pipe','createWriteStream','out','System','Contact','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','undefined','limit','count','offset','Content-Range','destroy','then','end','error','stack','name','send','map','fieldName','type','getOptions','openchannel','catch','show','query','params','model','keys','rawAttributes','intersection','fields','attributes','length','includeAll','include','merge','options','OpenchannelInteraction','find','create','body','update','describe','OpenchannelMessage','addMessage','omit','ids','filters','hasOwnProperty','nolimit','order'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x7c75,0x1b8));var _0x57c7=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7c75[_0x40ac5e];return _0x2839d6;};'use strict';var rimraf=require(_0x57c7('0x0'));var zipdir=require(_0x57c7('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x57c7('0x2'));var ejs=require(_0x57c7('0x3'));var fs=require('fs');var _=require(_0x57c7('0x4'));var Redis=require(_0x57c7('0x5'));var interaction=require(_0x57c7('0x6'));var qs=require(_0x57c7('0x7'));var pdf=require(_0x57c7('0x8'));var logger=require(_0x57c7('0x9'))(_0x57c7('0xa'));var config=require(_0x57c7('0xb'));var db=require('../../mysqldb')['db'];config[_0x57c7('0xc')]=_[_0x57c7('0xd')](config[_0x57c7('0xc')],{'host':_0x57c7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x57c7('0xf')](socket);function respondWithStatusCode(_0x5a6d33,_0x202d76){_0x202d76=_0x202d76||0xcc;return function(_0xcd260b){if(_0xcd260b){return _0x5a6d33[_0x57c7('0x10')](_0x202d76);}return _0x5a6d33['status'](_0x202d76)['end']();};}function respondWithResult(_0x3e3d28,_0x408ed8){_0x408ed8=_0x408ed8||0xc8;return function(_0x5a09da){if(_0x5a09da){return _0x3e3d28[_0x57c7('0x11')](_0x408ed8)['json'](_0x5a09da);}};}function respondWithFilteredResult(_0x3e4f98,_0x1a5023){return function(_0x1da4f7){if(_0x1da4f7){var _0x108d9e=typeof _0x1a5023['offset']===_0x57c7('0x12')&&typeof _0x1a5023[_0x57c7('0x13')]===_0x57c7('0x12');var _0x54d4ca=_0x1da4f7[_0x57c7('0x14')];var _0x11ae13=_0x108d9e?0x0:_0x1a5023['offset'];var _0x25cd1e=_0x108d9e?_0x1da4f7[_0x57c7('0x14')]:_0x1a5023[_0x57c7('0x15')]+_0x1a5023[_0x57c7('0x13')];var _0x1c3b20;if(_0x25cd1e>=_0x54d4ca){_0x25cd1e=_0x54d4ca;_0x1c3b20=0xc8;}else{_0x1c3b20=0xce;}_0x3e4f98[_0x57c7('0x11')](_0x1c3b20);return _0x3e4f98['set'](_0x57c7('0x16'),_0x11ae13+'-'+_0x25cd1e+'/'+_0x54d4ca)['json'](_0x1da4f7);}return null;};}function saveUpdates(_0x34ce16){return function(_0x5e2390){if(_0x5e2390){return _0x5e2390['update'](_0x34ce16)['then'](function(_0xb38062){return _0xb38062;});}return null;};}function removeEntity(_0x10d948){return function(_0x1b5803){if(_0x1b5803){return _0x1b5803[_0x57c7('0x17')]()[_0x57c7('0x18')](function(){_0x10d948[_0x57c7('0x11')](0xcc)[_0x57c7('0x19')]();});}};}function handleEntityNotFound(_0x102112){return function(_0x40b7ac){if(!_0x40b7ac){_0x102112['sendStatus'](0x194);}return _0x40b7ac;};}function handleError(_0x4226e1,_0x565040){_0x565040=_0x565040||0x1f4;return function(_0x1aa892){logger[_0x57c7('0x1a')](_0x1aa892[_0x57c7('0x1b')]);if(_0x1aa892['name']){delete _0x1aa892[_0x57c7('0x1c')];}_0x4226e1['status'](_0x565040)[_0x57c7('0x1d')](_0x1aa892);};}exports['index']=function(_0x3b457a,_0x42157c){var _0x2398d7={};var _0x186c82=_[_0x57c7('0x1e')](db['OpenchannelInteraction']['rawAttributes'],function(_0x4267f0){return{'name':_0x4267f0[_0x57c7('0x1f')],'type':_0x4267f0[_0x57c7('0x20')]['key']};});_0x2398d7=qs[_0x57c7('0x21')](_0x186c82,_0x3b457a);return interaction['findAll'](_0x57c7('0x22'),_0x3b457a['query'],_0x3b457a['user'],_0x2398d7,_0x186c82)[_0x57c7('0x18')](respondWithFilteredResult(_0x42157c,_0x2398d7))[_0x57c7('0x23')](handleError(_0x42157c,null));};exports[_0x57c7('0x24')]=function(_0x3f7451,_0x4600df){var _0x298f93={};if(_0x3f7451[_0x57c7('0x25')][_0x57c7('0x20')]&&_0x3f7451[_0x57c7('0x25')][_0x57c7('0x20')]==='from'){_0x298f93['from']=_0x3f7451['params']['id'];}else{_0x298f93['id']=_0x3f7451[_0x57c7('0x26')]['id'];}var _0x56d081={'raw':![],'where':_0x298f93},_0x3fb9cd={};_0x3fb9cd[_0x57c7('0x27')]=_[_0x57c7('0x28')](db['OpenchannelInteraction'][_0x57c7('0x29')]);_0x3fb9cd['query']=_[_0x57c7('0x28')](_0x3f7451[_0x57c7('0x25')]);_0x3fb9cd['filters']=_[_0x57c7('0x2a')](_0x3fb9cd[_0x57c7('0x27')],_0x3fb9cd[_0x57c7('0x25')]);_0x56d081['attributes']=_[_0x57c7('0x2a')](_0x3fb9cd[_0x57c7('0x27')],qs[_0x57c7('0x2b')](_0x3f7451[_0x57c7('0x25')][_0x57c7('0x2b')]));_0x56d081['attributes']=_0x56d081[_0x57c7('0x2c')][_0x57c7('0x2d')]?_0x56d081['attributes']:_0x3fb9cd[_0x57c7('0x27')];if(_0x3f7451[_0x57c7('0x25')][_0x57c7('0x2e')]){_0x56d081[_0x57c7('0x2f')]=[{'all':!![]}];}_0x56d081=_[_0x57c7('0x30')]({},_0x56d081,_0x3f7451[_0x57c7('0x31')]);return db[_0x57c7('0x32')][_0x57c7('0x33')](_0x56d081)[_0x57c7('0x18')](handleEntityNotFound(_0x4600df,null))['then'](respondWithResult(_0x4600df,null))[_0x57c7('0x23')](handleError(_0x4600df,null));};exports['create']=function(_0x4c337e,_0x55c199){return db[_0x57c7('0x32')][_0x57c7('0x34')](_0x4c337e[_0x57c7('0x35')],{})[_0x57c7('0x18')](respondWithResult(_0x55c199,0xc9))[_0x57c7('0x23')](handleError(_0x55c199,null));};exports[_0x57c7('0x36')]=function(_0x22a1cf,_0x539a87){if(_0x22a1cf[_0x57c7('0x35')]['id']){delete _0x22a1cf[_0x57c7('0x35')]['id'];}return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x22a1cf[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x539a87,null))[_0x57c7('0x18')](saveUpdates(_0x22a1cf['body'],null))['then'](respondWithResult(_0x539a87,null))[_0x57c7('0x23')](handleError(_0x539a87,null));};exports[_0x57c7('0x17')]=function(_0x263c7b,_0x830806){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x263c7b[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x830806,null))['then'](removeEntity(_0x830806,null))[_0x57c7('0x23')](handleError(_0x830806,null));};exports[_0x57c7('0x37')]=function(_0x3f8bba,_0x1e35d8){return db[_0x57c7('0x32')][_0x57c7('0x37')]()[_0x57c7('0x18')](respondWithResult(_0x1e35d8,null))[_0x57c7('0x23')](handleError(_0x1e35d8,null));};exports['addMessage']=function(_0x27c82b,_0x1e5e71){return db[_0x57c7('0x38')][_0x57c7('0x33')]({'where':{'id':_0x27c82b[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x1e5e71,null))[_0x57c7('0x18')](function(_0xfb59f0){if(_0xfb59f0){return _0xfb59f0[_0x57c7('0x39')](_0x27c82b[_0x57c7('0x35')]['ids'],_[_0x57c7('0x3a')](_0x27c82b[_0x57c7('0x35')],[_0x57c7('0x3b'),'id'])||{});}})[_0x57c7('0x18')](respondWithResult(_0x1e5e71,null))[_0x57c7('0x23')](handleError(_0x1e5e71,null));};exports['getMessages']=function(_0x371234,_0x55b6ea){var _0x31c597={'raw':![],'where':{}};var _0x4f56d3={};var _0x41cbc7={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x371234[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x55b6ea,null))[_0x57c7('0x18')](function(_0x44c35c){if(_0x44c35c){_0x4f56d3[_0x57c7('0x27')]=_[_0x57c7('0x28')](db[_0x57c7('0x38')]['rawAttributes']);_0x4f56d3[_0x57c7('0x25')]=_[_0x57c7('0x28')](_0x371234[_0x57c7('0x25')]);_0x4f56d3[_0x57c7('0x3c')]=_[_0x57c7('0x2a')](_0x4f56d3[_0x57c7('0x27')],_0x4f56d3[_0x57c7('0x25')]);_0x31c597[_0x57c7('0x2c')]=_[_0x57c7('0x2a')](_0x4f56d3[_0x57c7('0x27')],qs[_0x57c7('0x2b')](_0x371234['query'][_0x57c7('0x2b')]));_0x31c597[_0x57c7('0x2c')]=_0x31c597[_0x57c7('0x2c')][_0x57c7('0x2d')]?_0x31c597[_0x57c7('0x2c')]:_0x4f56d3[_0x57c7('0x27')];if(!_0x371234[_0x57c7('0x25')][_0x57c7('0x3d')](_0x57c7('0x3e'))){_0x31c597[_0x57c7('0x13')]=qs[_0x57c7('0x13')](_0x371234[_0x57c7('0x25')][_0x57c7('0x13')]);_0x31c597[_0x57c7('0x15')]=qs[_0x57c7('0x15')](_0x371234['query'][_0x57c7('0x15')]);}_0x31c597[_0x57c7('0x3f')]=qs[_0x57c7('0x40')](_0x371234[_0x57c7('0x25')]['sort']);_0x31c597[_0x57c7('0x41')]=qs[_0x57c7('0x3c')](_[_0x57c7('0x42')](_0x371234[_0x57c7('0x25')],_0x4f56d3[_0x57c7('0x3c')]));_0x31c597[_0x57c7('0x41')][_0x57c7('0x43')]=_0x44c35c['id'];if(_0x371234['query']['filter']){_0x31c597[_0x57c7('0x41')]=_[_0x57c7('0x30')](_0x31c597['where'],{'$or':_[_0x57c7('0x1e')](_0x31c597['attributes'],function(_0x5ccfde){var _0x5d4f97={};_0x5d4f97[_0x5ccfde]={'$like':'%'+_0x371234[_0x57c7('0x25')][_0x57c7('0x44')]+'%'};return _0x5d4f97;})});}if(_0x371234[_0x57c7('0x25')]['$gte']){var _0x2fecf0=_0x371234[_0x57c7('0x25')][_0x57c7('0x45')][_0x57c7('0x46')](',');var _0x597bac={};_0x597bac[_0x2fecf0[0x0]]={'$gte':moment(_0x2fecf0[0x1])[_0x57c7('0x47')](_0x57c7('0x48'))};_0x31c597[_0x57c7('0x41')]=_[_0x57c7('0x30')](_0x31c597['where'],_0x597bac);}_0x31c597=_[_0x57c7('0x30')]({},_0x31c597,_0x371234[_0x57c7('0x31')]);return db['OpenchannelMessage']['count']({'where':_0x31c597[_0x57c7('0x41')]})[_0x57c7('0x18')](function(_0xbfc0b2){_0x41cbc7[_0x57c7('0x14')]=_0xbfc0b2;if(_0x371234[_0x57c7('0x25')][_0x57c7('0x2e')]){_0x31c597[_0x57c7('0x2f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x31c597);})[_0x57c7('0x18')](function(_0x5d4dd6){_0x41cbc7[_0x57c7('0x49')]=_0x5d4dd6;return _0x41cbc7;});}})[_0x57c7('0x18')](respondWithFilteredResult(_0x55b6ea,_0x31c597))[_0x57c7('0x23')](handleError(_0x55b6ea,null));};exports[_0x57c7('0x4a')]=function(_0x443617,_0x247b93){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x443617['params']['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x247b93,null))[_0x57c7('0x18')](function(_0x2cd053){if(_0x2cd053){return _0x2cd053[_0x57c7('0x4b')](_0x443617[_0x57c7('0x35')][_0x57c7('0x3b')],_[_0x57c7('0x3a')](_0x443617[_0x57c7('0x35')],[_0x57c7('0x3b'),'id'])||{})['spread'](function(){return db['Tag'][_0x57c7('0x4c')]({'attributes':['id',_0x57c7('0x1c'),_0x57c7('0x4d')],'where':{'id':_0x443617[_0x57c7('0x35')][_0x57c7('0x3b')]}});})[_0x57c7('0x18')](function(_0x53c52a){socket[_0x57c7('0x4e')](_0x57c7('0x4f'),{'id':Number(_0x443617[_0x57c7('0x26')]['id']),'tags':_0x53c52a||[]});return{'id':Number(_0x443617[_0x57c7('0x26')]['id']),'tags':_0x53c52a||[]};});}})['then'](respondWithResult(_0x247b93,null))[_0x57c7('0x23')](handleError(_0x247b93,null));};exports[_0x57c7('0x50')]=function(_0x3fe42c,_0x3dd49d){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x3fe42c[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x3dd49d,null))['then'](function(_0x48292a){if(_0x48292a){return _0x48292a[_0x57c7('0x50')](_0x3fe42c[_0x57c7('0x25')][_0x57c7('0x3b')]);}})[_0x57c7('0x18')](respondWithStatusCode(_0x3dd49d,null))[_0x57c7('0x23')](handleError(_0x3dd49d,null));};exports[_0x57c7('0x51')]=function(_0x191d7,_0x22ec5c){var _0xb9b0ad=moment()[_0x57c7('0x52')]()['toString']();var _0x3fb2a9=path[_0x57c7('0x53')](config[_0x57c7('0x54')],_0x57c7('0x55'),'files','tmp');var _0x3dc217=path[_0x57c7('0x53')](config['root'],'server',_0x57c7('0x56'),_0x57c7('0x57'));var _0x339cda=path[_0x57c7('0x53')](_0x3fb2a9,_0xb9b0ad);var _0x205cca=util['format'](_0x57c7('0x58'),_0x191d7[_0x57c7('0x26')]['id'],_0xb9b0ad);var _0x5b3712=path['join'](_0x3fb2a9,_0x205cca);var _0x505c50=[];_0x505c50[_0x57c7('0x59')]({'model':db['User'],'as':_0x57c7('0x5a'),'attributes':['id',_0x57c7('0x5b')],'raw':!![]});_0x505c50[_0x57c7('0x59')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x57c7('0x5c'),_0x57c7('0x5d')],'raw':!![]});if(_0x191d7['query']['attachments']){_0x505c50['push']({'model':db[_0x57c7('0x5e')],'as':_0x57c7('0x5e'),'raw':!![]});}var _0x3986b7=[{'model':db[_0x57c7('0x38')],'as':'Messages','attributes':['id',_0x57c7('0x35'),'createdAt',_0x57c7('0x5f'),_0x57c7('0x60'),'read'],'include':_0x505c50}];_0x3986b7[_0x57c7('0x59')]({'model':db[_0x57c7('0x61')],'as':_0x57c7('0x62'),'attributes':['id',_0x57c7('0x1c')]});_0x3986b7['push']({'model':db[_0x57c7('0x5a')],'as':_0x57c7('0x63'),'attributes':['id',_0x57c7('0x5b')]});return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x191d7[_0x57c7('0x26')]['id']},'include':_0x3986b7})['then'](handleEntityNotFound(_0x22ec5c,null))['then'](function(_0x1c3992){if(_0x1c3992){var _0x3f7e17=_0x1c3992[_0x57c7('0x64')]({'plain':!![]});fs[_0x57c7('0x65')](_0x339cda);var _0x212ef2={'channel':_0x57c7('0x66'),'account':_0x3f7e17[_0x57c7('0x62')][_0x57c7('0x1c')],'agent':_0x3f7e17[_0x57c7('0x63')]?_0x3f7e17['Owner'][_0x57c7('0x5b')]:_0x57c7('0x67'),'createdAt':moment(_0x3f7e17[_0x57c7('0x68')])['format'](_0x57c7('0x48'))[_0x57c7('0x69')](),'closedAt':_0x3f7e17[_0x57c7('0x6a')]?moment(_0x3f7e17[_0x57c7('0x6b')])[_0x57c7('0x47')](_0x57c7('0x48'))[_0x57c7('0x69')]():'','disposition':_0x3f7e17[_0x57c7('0x6c')],'visibility':_0x3f7e17[_0x57c7('0x6d')]?'Public':'Private','messages':_(_0x3f7e17['Messages'])[_0x57c7('0x44')]({'secret':![]})['map'](function(_0x20622c){if(_0x20622c[_0x57c7('0x5e')]){var _0x1a304f=path['join'](_0x3dc217,_0x20622c['Attachment'][_0x57c7('0x6e')]);if(fs[_0x57c7('0x6f')](_0x1a304f)){fs['createReadStream'](_0x1a304f)[_0x57c7('0x70')](fs[_0x57c7('0x71')](path[_0x57c7('0x53')](_0x339cda,_0x20622c[_0x57c7('0x5e')][_0x57c7('0x6e')])));}}return{'date':moment(_0x20622c['createdAt'])['format'](_0x57c7('0x48'))[_0x57c7('0x69')](),'sender':_0x20622c['direction']===_0x57c7('0x72')?_0x20622c[_0x57c7('0x5a')]?_0x20622c[_0x57c7('0x5a')][_0x57c7('0x5b')]:_0x57c7('0x73'):_0x20622c['Contact'][_0x57c7('0x5c')]+(_0x20622c['Contact']['lastName']?'\x20'+_0x20622c[_0x57c7('0x74')]['lastName']:''),'body':_0x20622c[_0x57c7('0x5e')]?_0x20622c[_0x57c7('0x5e')][_0x57c7('0x6e')]:_0x20622c[_0x57c7('0x35')],'direction':_0x20622c['direction']==='out'?'A':'C','secret':_0x20622c[_0x57c7('0x60')],'read':_0x20622c[_0x57c7('0x75')],'attachment':_0x20622c[_0x57c7('0x5e')]};})[_0x57c7('0x76')]()};return ejs['renderFile'](path['join'](config[_0x57c7('0x54')],_0x57c7('0x55'),_0x57c7('0x77'),_0x57c7('0x78')),{'interaction':_0x212ef2})[_0x57c7('0x18')](function(_0x4abf06){var _0x111611=path[_0x57c7('0x53')](_0x339cda,_0x57c7('0x79')+_0x3f7e17['id']+'-'+_0xb9b0ad+_0x57c7('0x7a'));var _0x2040bb={'path':_0x111611,'channel':_0x57c7('0x66'),'interactionId':_0x3f7e17['id']};return pdf[_0x57c7('0x7b')](_0x4abf06,_0x2040bb);})[_0x57c7('0x18')](function(){return new Promise(function(_0x3cf2b6,_0x12064c){zipdir(_0x339cda,{'saveTo':_0x5b3712},function(_0x1ab4cf,_0x4b04d7){if(_0x1ab4cf)return _0x12064c(_0x1ab4cf);return _0x3cf2b6(_0x4b04d7);});})[_0x57c7('0x18')](function(){return new Promise(function(_0x5644ac,_0x5bceaa){rimraf(_0x339cda,function(_0x1d3216){if(_0x1d3216)_0x5bceaa(_0x1d3216);return _0x5644ac();});});})[_0x57c7('0x18')](function(){return _0x22ec5c['download'](_0x5b3712,_0x205cca,function(_0x5cda8f){if(_0x5cda8f){logger[_0x57c7('0x1a')](_0x57c7('0x7c'),_0x5cda8f);}else{fs[_0x57c7('0x7d')](_0x5b3712);}});});});}else{return _0x22ec5c[_0x57c7('0x10')](0xc8);}})[_0x57c7('0x23')](handleError(_0x22ec5c,null));}; \ No newline at end of file +var _0xfddb=['include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','removeTags','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','User','push','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','fullname','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','unlinkSync','sendStatus','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','status','json','offset','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','user','catch','from','params','model','keys','intersection','attributes','fields','length'];(function(_0x3c29c5,_0x3a2a73){var _0x206731=function(_0x470b71){while(--_0x470b71){_0x3c29c5['push'](_0x3c29c5['shift']());}};_0x206731(++_0x3a2a73);}(_0xfddb,0x1ca));var _0xbfdd=function(_0xad0bf1,_0x548bd1){_0xad0bf1=_0xad0bf1-0x0;var _0x28f86f=_0xfddb[_0xad0bf1];return _0x28f86f;};'use strict';var rimraf=require(_0xbfdd('0x0'));var zipdir=require(_0xbfdd('0x1'));var moment=require('moment');var util=require(_0xbfdd('0x2'));var path=require(_0xbfdd('0x3'));var ejs=require(_0xbfdd('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbfdd('0x5'));var interaction=require(_0xbfdd('0x6'));var qs=require(_0xbfdd('0x7'));var pdf=require(_0xbfdd('0x8'));var logger=require(_0xbfdd('0x9'))(_0xbfdd('0xa'));var config=require('../../config/environment');var db=require(_0xbfdd('0xb'))['db'];config[_0xbfdd('0xc')]=_[_0xbfdd('0xd')](config[_0xbfdd('0xc')],{'host':_0xbfdd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbfdd('0xf'))[_0xbfdd('0x10')](socket);function respondWithStatusCode(_0x56edc9,_0x1e05b8){_0x1e05b8=_0x1e05b8||0xcc;return function(_0x25f51d){if(_0x25f51d){return _0x56edc9['sendStatus'](_0x1e05b8);}return _0x56edc9[_0xbfdd('0x11')](_0x1e05b8)['end']();};}function respondWithResult(_0x13f35b,_0x4533f9){_0x4533f9=_0x4533f9||0xc8;return function(_0x405b09){if(_0x405b09){return _0x13f35b[_0xbfdd('0x11')](_0x4533f9)[_0xbfdd('0x12')](_0x405b09);}};}function respondWithFilteredResult(_0x369178,_0x99f0c7){return function(_0x34001e){if(_0x34001e){var _0x38445b=typeof _0x99f0c7[_0xbfdd('0x13')]==='undefined'&&typeof _0x99f0c7[_0xbfdd('0x14')]==='undefined';var _0x1146cb=_0x34001e['count'];var _0x1c50c0=_0x38445b?0x0:_0x99f0c7['offset'];var _0x2e712c=_0x38445b?_0x34001e[_0xbfdd('0x15')]:_0x99f0c7[_0xbfdd('0x13')]+_0x99f0c7[_0xbfdd('0x14')];var _0x4a3aae;if(_0x2e712c>=_0x1146cb){_0x2e712c=_0x1146cb;_0x4a3aae=0xc8;}else{_0x4a3aae=0xce;}_0x369178[_0xbfdd('0x11')](_0x4a3aae);return _0x369178[_0xbfdd('0x16')](_0xbfdd('0x17'),_0x1c50c0+'-'+_0x2e712c+'/'+_0x1146cb)[_0xbfdd('0x12')](_0x34001e);}return null;};}function saveUpdates(_0x35150b){return function(_0x137c45){if(_0x137c45){return _0x137c45[_0xbfdd('0x18')](_0x35150b)[_0xbfdd('0x19')](function(_0x3dbac7){return _0x3dbac7;});}return null;};}function removeEntity(_0x13ca9c){return function(_0x387b34){if(_0x387b34){return _0x387b34[_0xbfdd('0x1a')]()['then'](function(){_0x13ca9c[_0xbfdd('0x11')](0xcc)[_0xbfdd('0x1b')]();});}};}function handleEntityNotFound(_0x447762){return function(_0x5703d5){if(!_0x5703d5){_0x447762['sendStatus'](0x194);}return _0x5703d5;};}function handleError(_0x1ca29a,_0x5caac4){_0x5caac4=_0x5caac4||0x1f4;return function(_0x1411c0){logger[_0xbfdd('0x1c')](_0x1411c0['stack']);if(_0x1411c0[_0xbfdd('0x1d')]){delete _0x1411c0[_0xbfdd('0x1d')];}_0x1ca29a[_0xbfdd('0x11')](_0x5caac4)[_0xbfdd('0x1e')](_0x1411c0);};}exports['index']=function(_0x9b714b,_0x23b0a1){var _0xda7966={};var _0x3d4bb1=_[_0xbfdd('0x1f')](db[_0xbfdd('0x20')][_0xbfdd('0x21')],function(_0x2f68d3){return{'name':_0x2f68d3['fieldName'],'type':_0x2f68d3[_0xbfdd('0x22')][_0xbfdd('0x23')]};});_0xda7966=qs[_0xbfdd('0x24')](_0x3d4bb1,_0x9b714b);return interaction[_0xbfdd('0x25')](_0xbfdd('0x26'),_0x9b714b[_0xbfdd('0x27')],_0x9b714b[_0xbfdd('0x28')],_0xda7966,_0x3d4bb1)[_0xbfdd('0x19')](respondWithFilteredResult(_0x23b0a1,_0xda7966))[_0xbfdd('0x29')](handleError(_0x23b0a1,null));};exports['show']=function(_0x4031da,_0x2e7883){var _0x5ea69a={};if(_0x4031da[_0xbfdd('0x27')][_0xbfdd('0x22')]&&_0x4031da[_0xbfdd('0x27')][_0xbfdd('0x22')]==='from'){_0x5ea69a[_0xbfdd('0x2a')]=_0x4031da[_0xbfdd('0x2b')]['id'];}else{_0x5ea69a['id']=_0x4031da[_0xbfdd('0x2b')]['id'];}var _0x1b80a5={'raw':![],'where':_0x5ea69a},_0x78292a={};_0x78292a[_0xbfdd('0x2c')]=_[_0xbfdd('0x2d')](db[_0xbfdd('0x20')][_0xbfdd('0x21')]);_0x78292a['query']=_[_0xbfdd('0x2d')](_0x4031da[_0xbfdd('0x27')]);_0x78292a['filters']=_[_0xbfdd('0x2e')](_0x78292a[_0xbfdd('0x2c')],_0x78292a[_0xbfdd('0x27')]);_0x1b80a5[_0xbfdd('0x2f')]=_[_0xbfdd('0x2e')](_0x78292a[_0xbfdd('0x2c')],qs[_0xbfdd('0x30')](_0x4031da[_0xbfdd('0x27')][_0xbfdd('0x30')]));_0x1b80a5[_0xbfdd('0x2f')]=_0x1b80a5[_0xbfdd('0x2f')][_0xbfdd('0x31')]?_0x1b80a5[_0xbfdd('0x2f')]:_0x78292a[_0xbfdd('0x2c')];if(_0x4031da[_0xbfdd('0x27')]['includeAll']){_0x1b80a5[_0xbfdd('0x32')]=[{'all':!![]}];}_0x1b80a5=_[_0xbfdd('0x33')]({},_0x1b80a5,_0x4031da['options']);return db[_0xbfdd('0x20')][_0xbfdd('0x34')](_0x1b80a5)[_0xbfdd('0x19')](handleEntityNotFound(_0x2e7883,null))[_0xbfdd('0x19')](respondWithResult(_0x2e7883,null))[_0xbfdd('0x29')](handleError(_0x2e7883,null));};exports[_0xbfdd('0x35')]=function(_0x89269e,_0xc9cc1f){return db[_0xbfdd('0x20')][_0xbfdd('0x35')](_0x89269e[_0xbfdd('0x36')],{})[_0xbfdd('0x19')](respondWithResult(_0xc9cc1f,0xc9))[_0xbfdd('0x29')](handleError(_0xc9cc1f,null));};exports[_0xbfdd('0x18')]=function(_0x38b138,_0x496e5f){if(_0x38b138[_0xbfdd('0x36')]['id']){delete _0x38b138[_0xbfdd('0x36')]['id'];}return db[_0xbfdd('0x20')][_0xbfdd('0x34')]({'where':{'id':_0x38b138[_0xbfdd('0x2b')]['id']}})[_0xbfdd('0x19')](handleEntityNotFound(_0x496e5f,null))[_0xbfdd('0x19')](saveUpdates(_0x38b138['body'],null))[_0xbfdd('0x19')](respondWithResult(_0x496e5f,null))[_0xbfdd('0x29')](handleError(_0x496e5f,null));};exports['destroy']=function(_0x3bbfbc,_0x32d60e){return db[_0xbfdd('0x20')]['find']({'where':{'id':_0x3bbfbc['params']['id']}})[_0xbfdd('0x19')](handleEntityNotFound(_0x32d60e,null))[_0xbfdd('0x19')](removeEntity(_0x32d60e,null))[_0xbfdd('0x29')](handleError(_0x32d60e,null));};exports[_0xbfdd('0x37')]=function(_0x5bd991,_0x43d312){return db['OpenchannelInteraction'][_0xbfdd('0x37')]()[_0xbfdd('0x19')](respondWithResult(_0x43d312,null))[_0xbfdd('0x29')](handleError(_0x43d312,null));};exports[_0xbfdd('0x38')]=function(_0x3a9e63,_0x6a5e3a){return db[_0xbfdd('0x39')][_0xbfdd('0x34')]({'where':{'id':_0x3a9e63['params']['id']}})[_0xbfdd('0x19')](handleEntityNotFound(_0x6a5e3a,null))[_0xbfdd('0x19')](function(_0x2101d9){if(_0x2101d9){return _0x2101d9[_0xbfdd('0x38')](_0x3a9e63[_0xbfdd('0x36')][_0xbfdd('0x3a')],_[_0xbfdd('0x3b')](_0x3a9e63[_0xbfdd('0x36')],[_0xbfdd('0x3a'),'id'])||{});}})[_0xbfdd('0x19')](respondWithResult(_0x6a5e3a,null))[_0xbfdd('0x29')](handleError(_0x6a5e3a,null));};exports[_0xbfdd('0x3c')]=function(_0x362c21,_0x3afbce){var _0x11a299={'raw':![],'where':{}};var _0x2b2107={};var _0x40fe08={'count':0x0,'rows':[]};return db[_0xbfdd('0x20')]['findOne']({'where':{'id':_0x362c21[_0xbfdd('0x2b')]['id']}})[_0xbfdd('0x19')](handleEntityNotFound(_0x3afbce,null))[_0xbfdd('0x19')](function(_0x43e232){if(_0x43e232){_0x2b2107[_0xbfdd('0x2c')]=_[_0xbfdd('0x2d')](db[_0xbfdd('0x39')]['rawAttributes']);_0x2b2107[_0xbfdd('0x27')]=_[_0xbfdd('0x2d')](_0x362c21[_0xbfdd('0x27')]);_0x2b2107[_0xbfdd('0x3d')]=_[_0xbfdd('0x2e')](_0x2b2107[_0xbfdd('0x2c')],_0x2b2107['query']);_0x11a299['attributes']=_[_0xbfdd('0x2e')](_0x2b2107[_0xbfdd('0x2c')],qs[_0xbfdd('0x30')](_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x30')]));_0x11a299[_0xbfdd('0x2f')]=_0x11a299['attributes'][_0xbfdd('0x31')]?_0x11a299[_0xbfdd('0x2f')]:_0x2b2107[_0xbfdd('0x2c')];if(!_0x362c21['query'][_0xbfdd('0x3e')](_0xbfdd('0x3f'))){_0x11a299[_0xbfdd('0x14')]=qs[_0xbfdd('0x14')](_0x362c21[_0xbfdd('0x27')]['limit']);_0x11a299[_0xbfdd('0x13')]=qs[_0xbfdd('0x13')](_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x13')]);}_0x11a299['order']=qs['sort'](_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x40')]);_0x11a299[_0xbfdd('0x41')]=qs[_0xbfdd('0x3d')](_['pick'](_0x362c21[_0xbfdd('0x27')],_0x2b2107[_0xbfdd('0x3d')]));_0x11a299[_0xbfdd('0x41')][_0xbfdd('0x42')]=_0x43e232['id'];if(_0x362c21['query'][_0xbfdd('0x43')]){_0x11a299['where']=_[_0xbfdd('0x33')](_0x11a299['where'],{'$or':_[_0xbfdd('0x1f')](_0x11a299[_0xbfdd('0x2f')],function(_0x2df5ae){var _0xbb5eeb={};_0xbb5eeb[_0x2df5ae]={'$like':'%'+_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x43')]+'%'};return _0xbb5eeb;})});}if(_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x44')]){var _0x59aad2=_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x44')]['split'](',');var _0x4aef7c={};_0x4aef7c[_0x59aad2[0x0]]={'$gte':moment(_0x59aad2[0x1])['format'](_0xbfdd('0x45'))};_0x11a299['where']=_[_0xbfdd('0x33')](_0x11a299[_0xbfdd('0x41')],_0x4aef7c);}_0x11a299=_[_0xbfdd('0x33')]({},_0x11a299,_0x362c21['options']);return db[_0xbfdd('0x39')][_0xbfdd('0x15')]({'where':_0x11a299[_0xbfdd('0x41')]})['then'](function(_0x552d91){_0x40fe08[_0xbfdd('0x15')]=_0x552d91;if(_0x362c21[_0xbfdd('0x27')][_0xbfdd('0x46')]){_0x11a299[_0xbfdd('0x32')]=[{'all':!![]}];}return db[_0xbfdd('0x39')][_0xbfdd('0x25')](_0x11a299);})[_0xbfdd('0x19')](function(_0x2067bb){_0x40fe08[_0xbfdd('0x47')]=_0x2067bb;return _0x40fe08;});}})[_0xbfdd('0x19')](respondWithFilteredResult(_0x3afbce,_0x11a299))[_0xbfdd('0x29')](handleError(_0x3afbce,null));};exports[_0xbfdd('0x48')]=function(_0x4fa79c,_0x3a74c4){return db[_0xbfdd('0x20')]['find']({'where':{'id':_0x4fa79c[_0xbfdd('0x2b')]['id']}})[_0xbfdd('0x19')](handleEntityNotFound(_0x3a74c4,null))[_0xbfdd('0x19')](function(_0x1517a4){if(_0x1517a4){return _0x1517a4[_0xbfdd('0x49')](_0x4fa79c['body'][_0xbfdd('0x3a')],_[_0xbfdd('0x3b')](_0x4fa79c[_0xbfdd('0x36')],['ids','id'])||{})[_0xbfdd('0x4a')](function(){return db[_0xbfdd('0x4b')]['findAll']({'attributes':['id','name',_0xbfdd('0x4c')],'where':{'id':_0x4fa79c[_0xbfdd('0x36')]['ids']}});})[_0xbfdd('0x19')](function(_0xb36fc4){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4fa79c[_0xbfdd('0x2b')]['id']),'tags':_0xb36fc4||[]});return{'id':Number(_0x4fa79c[_0xbfdd('0x2b')]['id']),'tags':_0xb36fc4||[]};});}})[_0xbfdd('0x19')](respondWithResult(_0x3a74c4,null))['catch'](handleError(_0x3a74c4,null));};exports[_0xbfdd('0x4d')]=function(_0x28cc64,_0x152f20){return db[_0xbfdd('0x20')][_0xbfdd('0x34')]({'where':{'id':_0x28cc64[_0xbfdd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x152f20,null))['then'](function(_0x1bf823){if(_0x1bf823){return _0x1bf823['removeTags'](_0x28cc64[_0xbfdd('0x27')][_0xbfdd('0x3a')]);}})['then'](respondWithStatusCode(_0x152f20,null))['catch'](handleError(_0x152f20,null));};exports['download']=function(_0x3a46d4,_0x2da2dd){var _0x59c981=moment()['unix']()[_0xbfdd('0x4e')]();var _0x335c3b=path[_0xbfdd('0x4f')](config[_0xbfdd('0x50')],_0xbfdd('0x51'),_0xbfdd('0x52'),_0xbfdd('0x53'));var _0x155025=path[_0xbfdd('0x4f')](config['root'],_0xbfdd('0x51'),_0xbfdd('0x52'),_0xbfdd('0x54'));var _0x3e847c=path[_0xbfdd('0x4f')](_0x335c3b,_0x59c981);var _0x1e3954=util[_0xbfdd('0x55')](_0xbfdd('0x56'),_0x3a46d4[_0xbfdd('0x2b')]['id'],_0x59c981);var _0x51f5a5=path[_0xbfdd('0x4f')](_0x335c3b,_0x1e3954);var _0x2e607d=[];_0x2e607d['push']({'model':db['User'],'as':_0xbfdd('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x2e607d[_0xbfdd('0x58')]({'model':db['CmContact'],'as':_0xbfdd('0x59'),'attributes':['id',_0xbfdd('0x5a'),_0xbfdd('0x5b')],'raw':!![]});if(_0x3a46d4[_0xbfdd('0x27')][_0xbfdd('0x54')]){_0x2e607d[_0xbfdd('0x58')]({'model':db['Attachment'],'as':_0xbfdd('0x5c'),'raw':!![]});}var _0xdfc5db=[{'model':db[_0xbfdd('0x39')],'as':_0xbfdd('0x5d'),'attributes':['id',_0xbfdd('0x36'),_0xbfdd('0x5e'),_0xbfdd('0x5f'),_0xbfdd('0x60'),_0xbfdd('0x61')],'include':_0x2e607d}];_0xdfc5db[_0xbfdd('0x58')]({'model':db[_0xbfdd('0x62')],'as':_0xbfdd('0x63'),'attributes':['id',_0xbfdd('0x1d')]});_0xdfc5db[_0xbfdd('0x58')]({'model':db[_0xbfdd('0x57')],'as':'Owner','attributes':['id',_0xbfdd('0x64')]});return db[_0xbfdd('0x20')]['find']({'where':{'id':_0x3a46d4[_0xbfdd('0x2b')]['id']},'include':_0xdfc5db})['then'](handleEntityNotFound(_0x2da2dd,null))[_0xbfdd('0x19')](function(_0x147170){if(_0x147170){var _0x3a4c44=_0x147170[_0xbfdd('0x65')]({'plain':!![]});fs[_0xbfdd('0x66')](_0x3e847c);var _0x19fb71={'channel':_0xbfdd('0x67'),'account':_0x3a4c44[_0xbfdd('0x63')][_0xbfdd('0x1d')],'agent':_0x3a4c44[_0xbfdd('0x68')]?_0x3a4c44[_0xbfdd('0x68')][_0xbfdd('0x64')]:_0xbfdd('0x69'),'createdAt':moment(_0x3a4c44[_0xbfdd('0x5e')])['format'](_0xbfdd('0x45'))[_0xbfdd('0x4e')](),'closedAt':_0x3a4c44[_0xbfdd('0x6a')]?moment(_0x3a4c44[_0xbfdd('0x6b')])[_0xbfdd('0x55')](_0xbfdd('0x45'))['toString']():'','disposition':_0x3a4c44[_0xbfdd('0x6c')],'visibility':_0x3a4c44[_0xbfdd('0x6d')]?_0xbfdd('0x6e'):_0xbfdd('0x6f'),'messages':_(_0x3a4c44['Messages'])['filter']({'secret':![]})[_0xbfdd('0x1f')](function(_0x486650){if(_0x486650['Attachment']){var _0x26f2f8=path['join'](_0x155025,_0x486650[_0xbfdd('0x5c')][_0xbfdd('0x70')]);if(fs[_0xbfdd('0x71')](_0x26f2f8)){fs['createReadStream'](_0x26f2f8)[_0xbfdd('0x72')](fs[_0xbfdd('0x73')](path[_0xbfdd('0x4f')](_0x3e847c,_0x486650[_0xbfdd('0x5c')]['basename'])));}}return{'date':moment(_0x486650[_0xbfdd('0x5e')])[_0xbfdd('0x55')](_0xbfdd('0x45'))[_0xbfdd('0x4e')](),'sender':_0x486650[_0xbfdd('0x5f')]===_0xbfdd('0x74')?_0x486650[_0xbfdd('0x57')]?_0x486650['User']['fullname']:_0xbfdd('0x75'):_0x486650[_0xbfdd('0x59')][_0xbfdd('0x5a')]+(_0x486650['Contact'][_0xbfdd('0x5b')]?'\x20'+_0x486650[_0xbfdd('0x59')][_0xbfdd('0x5b')]:''),'body':_0x486650[_0xbfdd('0x5c')]?_0x486650[_0xbfdd('0x5c')]['basename']:_0x486650[_0xbfdd('0x36')],'direction':_0x486650[_0xbfdd('0x5f')]===_0xbfdd('0x74')?'A':'C','secret':_0x486650[_0xbfdd('0x60')],'read':_0x486650['read'],'attachment':_0x486650[_0xbfdd('0x5c')]};})[_0xbfdd('0x76')]()};return ejs[_0xbfdd('0x77')](path[_0xbfdd('0x4f')](config[_0xbfdd('0x50')],_0xbfdd('0x51'),'views',_0xbfdd('0x78')),{'interaction':_0x19fb71})['then'](function(_0x23ba8b){var _0x9985c0=path['join'](_0x3e847c,_0xbfdd('0x79')+_0x3a4c44['id']+'-'+_0x59c981+_0xbfdd('0x7a'));var _0x18c51e={'path':_0x9985c0,'channel':_0xbfdd('0x67'),'interactionId':_0x3a4c44['id']};return pdf[_0xbfdd('0x7b')](_0x23ba8b,_0x18c51e);})[_0xbfdd('0x19')](function(){return new Promise(function(_0x43792d,_0x260d72){zipdir(_0x3e847c,{'saveTo':_0x51f5a5},function(_0x168a52,_0x534a52){if(_0x168a52)return _0x260d72(_0x168a52);return _0x43792d(_0x534a52);});})[_0xbfdd('0x19')](function(){return new Promise(function(_0x48a77f,_0x1ee73f){rimraf(_0x3e847c,function(_0x2ac2ef){if(_0x2ac2ef)_0x1ee73f(_0x2ac2ef);return _0x48a77f();});});})[_0xbfdd('0x19')](function(){return _0x2da2dd[_0xbfdd('0x7c')](_0x51f5a5,_0x1e3954,function(_0x28cd83){if(_0x28cd83){logger[_0xbfdd('0x1c')]('Unable\x20to\x20delete\x20zip\x20file',_0x28cd83);}else{fs[_0xbfdd('0x7d')](_0x51f5a5);}});});});}else{return _0x2da2dd[_0xbfdd('0x7e')](0xc8);}})[_0xbfdd('0x29')](handleError(_0x2da2dd,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e18da45..f705ef9 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 _0x4f4d=['then','setDataValue','map','length','emit','hasOwnProperty','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','remove','getUsers'];(function(_0x591f88,_0x5267a8){var _0x401322=function(_0x373779){while(--_0x373779){_0x591f88['push'](_0x591f88['shift']());}};_0x401322(++_0x5267a8);}(_0x4f4d,0x1da));var _0xd4f4=function(_0x49dd98,_0x8dc77f){_0x49dd98=_0x49dd98-0x0;var _0x590ce3=_0x4f4d[_0x49dd98];return _0x590ce3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd4f4('0x0')];var OpenchannelMessage=require(_0xd4f4('0x1'))['db'][_0xd4f4('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4f4('0x3'),'afterUpdate':'update','afterDestroy':_0xd4f4('0x4')};function emitEvent(_0x441eaf){return function(_0x2de198,_0x43dfdc,_0x187ff4){_0x2de198[_0xd4f4('0x5')]({'attributes':['id'],'raw':!![]})[_0xd4f4('0x6')](function(_0x52befa){_0x2de198[_0xd4f4('0x7')]('Users',_0x52befa[_0xd4f4('0x8')](function(_0x12d3cd){return{'id':_0x12d3cd['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2de198['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd4f4('0x6')](function(_0x2a3c72){_0x2de198[_0xd4f4('0x7')]('unreadMessages',_0x2a3c72[_0xd4f4('0x9')]);OpenchannelInteractionEvents[_0xd4f4('0xa')](_0x441eaf+':'+_0x2de198['id'],_0x2de198);OpenchannelInteractionEvents[_0xd4f4('0xa')](_0x441eaf,_0x2de198);_0x187ff4(null);})['catch'](_0x187ff4(null));};}for(var e in events){if(events[_0xd4f4('0xb')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5861=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0x5861,0xff));var _0x1586=function(_0x45e620,_0x52c5d1){_0x45e620=_0x45e620-0x0;var _0x121055=_0x5861[_0x45e620];return _0x121055;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x1586('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x1586('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1586('0x2')](0x0);var events={'afterCreate':_0x1586('0x3'),'afterUpdate':_0x1586('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ba0cc){return function(_0x798246,_0xdfa3e0,_0x1ca2a3){_0x798246[_0x1586('0x5')]({'attributes':['id'],'raw':!![]})[_0x1586('0x6')](function(_0x143dc){_0x798246[_0x1586('0x7')](_0x1586('0x8'),_0x143dc[_0x1586('0x9')](function(_0x2de2ba){return{'id':_0x2de2ba['id']};}));return OpenchannelMessage[_0x1586('0xa')]({'where':{'OpenchannelInteractionId':_0x798246['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1586('0x6')](function(_0x3c4301){_0x798246['setDataValue'](_0x1586('0xb'),_0x3c4301['length']);OpenchannelInteractionEvents[_0x1586('0xc')](_0x1ba0cc+':'+_0x798246['id'],_0x798246);OpenchannelInteractionEvents['emit'](_0x1ba0cc,_0x798246);_0x1ca2a3(null);})[_0x1586('0xd')](_0x1ca2a3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1586('0xe')](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 2afc178..0ce086a 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 _0x4095=['path','../../config/environment','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4095,0x1bd));var _0x5409=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x4095[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x5409('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5409('0x1'));var moment=require(_0x5409('0x2'));var BPromise=require(_0x5409('0x3'));var rp=require(_0x5409('0x4'));var fs=require('fs');var path=require(_0x5409('0x5'));var rimraf=require('rimraf');var config=require(_0x5409('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x5409('0x7')]=function(_0x35cc99,_0x320612){return _0x35cc99['define'](_0x5409('0x8'),attributes,{'tableName':_0x5409('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5409('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5449fe,_0x42c473,_0x387426){if(_0x5449fe[_0x5409('0xb')]('closed')){_0x5449fe[_0x5409('0xc')]=moment()[_0x5409('0xd')](_0x5409('0xe'));}_0x387426(null,_0x5449fe);}}});}; \ No newline at end of file +var _0xfa03=['moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger','api'];(function(_0x16c8c3,_0x9dde1c){var _0x3cb87e=function(_0x260101){while(--_0x260101){_0x16c8c3['push'](_0x16c8c3['shift']());}};_0x3cb87e(++_0x9dde1c);}(_0xfa03,0xba));var _0x3fa0=function(_0x2e2b50,_0x5174bb){_0x2e2b50=_0x2e2b50-0x0;var _0x743e92=_0xfa03[_0x2e2b50];return _0x743e92;};'use strict';var _=require(_0x3fa0('0x0'));var util=require(_0x3fa0('0x1'));var logger=require(_0x3fa0('0x2'))(_0x3fa0('0x3'));var moment=require(_0x3fa0('0x4'));var BPromise=require(_0x3fa0('0x5'));var rp=require(_0x3fa0('0x6'));var fs=require('fs');var path=require(_0x3fa0('0x7'));var rimraf=require('rimraf');var config=require(_0x3fa0('0x8'));var attributes=require(_0x3fa0('0x9'));module[_0x3fa0('0xa')]=function(_0x14d11e,_0x3ade70){return _0x14d11e[_0x3fa0('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x3fa0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3fa0('0xd'),'collate':_0x3fa0('0xe'),'hooks':{'beforeUpdate':function(_0x57c0ad,_0xf31f1a,_0x3b7ff5){if(_0x57c0ad[_0x3fa0('0xf')](_0x3fa0('0x10'))){_0x57c0ad[_0x3fa0('0x11')]=moment()[_0x3fa0('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3b7ff5(null,_0x57c0ad);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 40b5cc8..8f71ba3 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 _0x0e33=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','OpenchannelInteraction','find','addTags','ids','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xc618fe,_0x5f2f8b){var _0x47373b=function(_0x318a0f){while(--_0x318a0f){_0xc618fe['push'](_0xc618fe['shift']());}};_0x47373b(++_0x5f2f8b);}(_0x0e33,0xbd));var _0x30e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0e33[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x30e3('0x0'));var util=require(_0x30e3('0x1'));var moment=require(_0x30e3('0x2'));var BPromise=require(_0x30e3('0x3'));var rs=require(_0x30e3('0x4'));var fs=require('fs');var Redis=require(_0x30e3('0x5'));var db=require(_0x30e3('0x6'))['db'];var utils=require(_0x30e3('0x7'));var logger=require(_0x30e3('0x8'))(_0x30e3('0x9'));var config=require(_0x30e3('0xa'));var jayson=require(_0x30e3('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x30e3('0xc')]=_['defaults'](config[_0x30e3('0xc')],{'host':_0x30e3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30e3('0xc')]));require('./openchannelInteraction.socket')[_0x30e3('0xe')](socket);function respondWithRpcPromise(_0x8b5dbc,_0x5e87bf,_0x4688a9){return new BPromise(function(_0x5a9a36,_0x5839d1){return client[_0x30e3('0xf')](_0x8b5dbc,_0x4688a9)['then'](function(_0x3410e9){logger[_0x30e3('0x10')](_0x30e3('0x11'),_0x5e87bf,_0x30e3('0x12'));logger[_0x30e3('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5e87bf,'request\x20sent',JSON['stringify'](_0x3410e9));if(_0x3410e9[_0x30e3('0x14')]){if(_0x3410e9['error'][_0x30e3('0x15')]===0x1f4){logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);return _0x5839d1(_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);}logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x3410e9['error']['message']);return _0x5a9a36(_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);}else{logger['info'](_0x30e3('0x11'),_0x5e87bf,_0x30e3('0x12'));_0x5a9a36(_0x3410e9['result'][_0x30e3('0x16')]);}})[_0x30e3('0x17')](function(_0x2d6150){logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x2d6150);_0x5839d1(_0x2d6150);});});}exports[_0x30e3('0x18')]=function(_0x3a0443){var _0x1520e4=this;return new Promise(function(_0x5a96af,_0x3dbbb9){return db['OpenchannelInteraction'][_0x30e3('0x19')](_0x3a0443[_0x30e3('0x1a')],{'raw':_0x3a0443[_0x30e3('0x1b')]?_0x3a0443['options'][_0x30e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0443[_0x30e3('0x1b')]?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1d')]||null:null,'attributes':_0x3a0443['options']?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1e')]||null:null,'limit':_0x3a0443['options']?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1f')]||null:null})[_0x30e3('0x20')](function(_0x15fafd){logger[_0x30e3('0x10')](_0x30e3('0x18'),_0x3a0443);logger[_0x30e3('0x13')]('UpdateOpenchannelInteraction',_0x3a0443,JSON['stringify'](_0x15fafd));_0x5a96af(_0x15fafd);})[_0x30e3('0x17')](function(_0x4978d9){logger['error'](_0x30e3('0x18'),_0x4978d9[_0x30e3('0x16')],_0x3a0443);_0x3dbbb9(_0x1520e4[_0x30e3('0x14')](0x1f4,_0x4978d9[_0x30e3('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x53dcba){return new Promise(function(_0x1d88eb,_0x4f3819){return db[_0x30e3('0x21')][_0x30e3('0x22')]({'where':_0x53dcba[_0x30e3('0x1b')]?_0x53dcba[_0x30e3('0x1b')][_0x30e3('0x1d')]||null:null})[_0x30e3('0x20')](function(_0x301ad9){if(_0x301ad9){return _0x301ad9[_0x30e3('0x23')](_0x53dcba[_0x30e3('0x1a')]['ids'],_['omit'](_0x53dcba[_0x30e3('0x1a')],[_0x30e3('0x24'),'id'])||{});}})['spread'](function(_0x2f734e){logger[_0x30e3('0x10')](_0x30e3('0x25'),_0x53dcba);logger['debug'](_0x30e3('0x25'),_0x53dcba,JSON[_0x30e3('0x26')](_0x2f734e));_0x1d88eb(_0x2f734e);})[_0x30e3('0x17')](function(_0x5b5b7a){logger[_0x30e3('0x14')](_0x30e3('0x25'),_0x5b5b7a[_0x30e3('0x16')],_0x53dcba);_0x4f3819(_this[_0x30e3('0x14')](0x1f4,_0x5b5b7a[_0x30e3('0x16')]));});});}; \ No newline at end of file +var _0x0a4e=['stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','attributes','find','addTags','body','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4755e5,_0x52dfa1){var _0x3b8eaf=function(_0x113baa){while(--_0x113baa){_0x4755e5['push'](_0x4755e5['shift']());}};_0x3b8eaf(++_0x52dfa1);}(_0x0a4e,0x170));var _0xe0a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a4e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe0a4('0x0'));var moment=require(_0xe0a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0a4('0x2'));var fs=require('fs');var Redis=require(_0xe0a4('0x3'));var db=require(_0xe0a4('0x4'))['db'];var utils=require(_0xe0a4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe0a4('0x6'));var jayson=require(_0xe0a4('0x7'));var client=jayson[_0xe0a4('0x8')]['http']({'port':0x232a});config[_0xe0a4('0x9')]=_[_0xe0a4('0xa')](config[_0xe0a4('0x9')],{'host':_0xe0a4('0xb'),'port':0x18eb});var socket=require(_0xe0a4('0xc'))(new Redis(config[_0xe0a4('0x9')]));require(_0xe0a4('0xd'))[_0xe0a4('0xe')](socket);function respondWithRpcPromise(_0x392568,_0x43c708,_0x9d8f32){return new BPromise(function(_0xc60fd9,_0x300c6a){return client[_0xe0a4('0xf')](_0x392568,_0x9d8f32)[_0xe0a4('0x10')](function(_0xabdc9a){logger[_0xe0a4('0x11')](_0xe0a4('0x12'),_0x43c708,_0xe0a4('0x13'));logger[_0xe0a4('0x14')](_0xe0a4('0x15'),_0x43c708,_0xe0a4('0x13'),JSON[_0xe0a4('0x16')](_0xabdc9a));if(_0xabdc9a[_0xe0a4('0x17')]){if(_0xabdc9a[_0xe0a4('0x17')][_0xe0a4('0x18')]===0x1f4){logger[_0xe0a4('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x43c708,_0xabdc9a[_0xe0a4('0x17')][_0xe0a4('0x19')]);return _0x300c6a(_0xabdc9a[_0xe0a4('0x17')][_0xe0a4('0x19')]);}logger[_0xe0a4('0x17')](_0xe0a4('0x12'),_0x43c708,_0xabdc9a[_0xe0a4('0x17')][_0xe0a4('0x19')]);return _0xc60fd9(_0xabdc9a[_0xe0a4('0x17')]['message']);}else{logger[_0xe0a4('0x11')](_0xe0a4('0x12'),_0x43c708,_0xe0a4('0x13'));_0xc60fd9(_0xabdc9a[_0xe0a4('0x1a')][_0xe0a4('0x19')]);}})[_0xe0a4('0x1b')](function(_0x321d0c){logger[_0xe0a4('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x43c708,_0x321d0c);_0x300c6a(_0x321d0c);});});}exports[_0xe0a4('0x1c')]=function(_0x1893c1){var _0x278b62=this;return new Promise(function(_0x464b73,_0x5cc3b4){return db[_0xe0a4('0x1d')][_0xe0a4('0x1e')](_0x1893c1['body'],{'raw':_0x1893c1[_0xe0a4('0x1f')]?_0x1893c1[_0xe0a4('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1893c1['options']?_0x1893c1[_0xe0a4('0x1f')]['where']||null:null,'attributes':_0x1893c1[_0xe0a4('0x1f')]?_0x1893c1[_0xe0a4('0x1f')][_0xe0a4('0x20')]||null:null,'limit':_0x1893c1[_0xe0a4('0x1f')]?_0x1893c1['options']['limit']||null:null})['then'](function(_0x3d4f7e){logger[_0xe0a4('0x11')](_0xe0a4('0x1c'),_0x1893c1);logger[_0xe0a4('0x14')](_0xe0a4('0x1c'),_0x1893c1,JSON[_0xe0a4('0x16')](_0x3d4f7e));_0x464b73(_0x3d4f7e);})[_0xe0a4('0x1b')](function(_0x132237){logger[_0xe0a4('0x17')](_0xe0a4('0x1c'),_0x132237['message'],_0x1893c1);_0x5cc3b4(_0x278b62[_0xe0a4('0x17')](0x1f4,_0x132237[_0xe0a4('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x37ccec){return new Promise(function(_0x2737fd,_0x1e4f48){return db[_0xe0a4('0x1d')][_0xe0a4('0x21')]({'where':_0x37ccec[_0xe0a4('0x1f')]?_0x37ccec['options']['where']||null:null})[_0xe0a4('0x10')](function(_0x224ba6){if(_0x224ba6){return _0x224ba6[_0xe0a4('0x22')](_0x37ccec[_0xe0a4('0x23')]['ids'],_['omit'](_0x37ccec[_0xe0a4('0x23')],[_0xe0a4('0x24'),'id'])||{});}})[_0xe0a4('0x25')](function(_0x3d09ab){logger[_0xe0a4('0x11')]('AddTags',_0x37ccec);logger['debug'](_0xe0a4('0x26'),_0x37ccec,JSON['stringify'](_0x3d09ab));_0x2737fd(_0x3d09ab);})[_0xe0a4('0x1b')](function(_0x4e8400){logger[_0xe0a4('0x17')](_0xe0a4('0x26'),_0x4e8400[_0xe0a4('0x19')],_0x37ccec);_0x1e4f48(_this['error'](0x1f4,_0x4e8400[_0xe0a4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d892fae..ef23746 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 _0x684b=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0xc106ce,_0x2c20cc){var _0x55260c=function(_0x12e6ba){while(--_0x12e6ba){_0xc106ce['push'](_0xc106ce['shift']());}};_0x55260c(++_0x2c20cc);}(_0x684b,0x17c));var _0xb684=function(_0x3cd47c,_0x5c0d63){_0x3cd47c=_0x3cd47c-0x0;var _0x4f454f=_0x684b[_0x3cd47c];return _0x4f454f;};'use strict';var OpenchannelInteractionEvents=require(_0xb684('0x0'));var events=[_0xb684('0x1'),_0xb684('0x2'),'update'];function createListener(_0x21d07f,_0x4310a5){return function(_0x38ce4b){_0x4310a5[_0xb684('0x3')](_0x21d07f,_0x38ce4b);};}function removeListener(_0x19d4b7,_0x5efce2){return function(){OpenchannelInteractionEvents[_0xb684('0x4')](_0x19d4b7,_0x5efce2);};}exports[_0xb684('0x5')]=function(_0x4e7f6d){for(var _0xd3a0ac=0x0,_0x4e129d=events['length'];_0xd3a0ac<_0x4e129d;_0xd3a0ac++){var _0x458829=events[_0xd3a0ac];var _0xeb2ec7=createListener(_0xb684('0x6')+_0x458829,_0x4e7f6d);OpenchannelInteractionEvents['on'](_0x458829,_0xeb2ec7);}}; \ No newline at end of file +var _0x5934=['emit','removeListener','length','openchannelInteraction:','save','remove','update'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x5934,0x1bd));var _0x4593=function(_0x511af3,_0x74f082){_0x511af3=_0x511af3-0x0;var _0x32c868=_0x5934[_0x511af3];return _0x32c868;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x4593('0x0'),_0x4593('0x1'),_0x4593('0x2')];function createListener(_0xaf6830,_0x4f8c08){return function(_0x5031b8){_0x4f8c08[_0x4593('0x3')](_0xaf6830,_0x5031b8);};}function removeListener(_0x367507,_0x56d8f){return function(){OpenchannelInteractionEvents[_0x4593('0x4')](_0x367507,_0x56d8f);};}exports['register']=function(_0x48088c){for(var _0x1f56f6=0x0,_0x5ca056=events[_0x4593('0x5')];_0x1f56f6<_0x5ca056;_0x1f56f6++){var _0xf2df17=events[_0x1f56f6];var _0x556f39=createListener(_0x4593('0x6')+_0xf2df17,_0x48088c);OpenchannelInteractionEvents['on'](_0xf2df17,_0x556f39);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 56a1950..cc7d1d1 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x4e83d2,_0xd3fbb4){var _0x366b3b=function(_0x428233){while(--_0x428233){_0x4e83d2['push'](_0x4e83d2['shift']());}};_0x366b3b(++_0xd3fbb4);}(_0xe706,0xa3));var _0x6e70=function(_0x235e66,_0x4bef96){_0x235e66=_0x235e66-0x0;var _0x36019b=_0xe706[_0x235e66];return _0x36019b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x2fde71,_0x495c10){var _0x5d392c=function(_0x309f3d){while(--_0x309f3d){_0x2fde71['push'](_0x2fde71['shift']());}};_0x5d392c(++_0x495c10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 88ea82b..9eb6eda 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 _0x2cae=['out','DATE','STRING','sequelize','exports','BOOLEAN'];(function(_0x10c834,_0x233526){var _0x4c447a=function(_0x4aee1e){while(--_0x4aee1e){_0x10c834['push'](_0x10c834['shift']());}};_0x4c447a(++_0x233526);}(_0x2cae,0x16b));var _0xe2ca=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x2cae[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2ca('0x3')),'defaultValue':_0xe2ca('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe2ca('0x4')]},'providerName':{'type':Sequelize[_0xe2ca('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xccde=['STRING','sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x52e987,_0x20fd8f){var _0x4c33f6=function(_0x49f288){while(--_0x49f288){_0x52e987['push'](_0x52e987['shift']());}};_0x4c33f6(++_0x20fd8f);}(_0xccde,0x1e1));var _0xeccd=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xccde[_0xadde88];return _0x3b8eb6;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'body':{'type':Sequelize[_0xeccd('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xeccd('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeccd('0x4')]},'providerName':{'type':Sequelize[_0xeccd('0x5')]},'providerResponse':{'type':Sequelize[_0xeccd('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f579093..7767465 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 _0xea6c=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','stack','name','map','OpenchannelMessage','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','keys','find','create','body','update','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request'];(function(_0x1fd9c1,_0x15f591){var _0x33f68a=function(_0x44be0b){while(--_0x44be0b){_0x1fd9c1['push'](_0x1fd9c1['shift']());}};_0x33f68a(++_0x15f591);}(_0xea6c,0x164));var _0xcea6=function(_0x5b9458,_0x184cc5){_0x5b9458=_0x5b9458-0x0;var _0x1134d4=_0xea6c[_0x5b9458];return _0x1134d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcea6('0x0'));var zipdir=require(_0xcea6('0x1'));var jsonpatch=require(_0xcea6('0x2'));var rp=require(_0xcea6('0x3'));var moment=require(_0xcea6('0x4'));var BPromise=require(_0xcea6('0x5'));var Mustache=require(_0xcea6('0x6'));var util=require(_0xcea6('0x7'));var path=require(_0xcea6('0x8'));var sox=require(_0xcea6('0x9'));var csv=require(_0xcea6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcea6('0xb'));var _=require('lodash');var squel=require(_0xcea6('0xc'));var crypto=require(_0xcea6('0xd'));var jsforce=require(_0xcea6('0xe'));var deskjs=require(_0xcea6('0xf'));var toCsv=require(_0xcea6('0xa'));var querystring=require('querystring');var Papa=require(_0xcea6('0x10'));var Redis=require(_0xcea6('0x11'));var authService=require(_0xcea6('0x12'));var qs=require(_0xcea6('0x13'));var as=require(_0xcea6('0x14'));var hardwareService=require(_0xcea6('0x15'));var logger=require(_0xcea6('0x16'))(_0xcea6('0x17'));var utils=require(_0xcea6('0x18'));var config=require(_0xcea6('0x19'));var licenseUtil=require(_0xcea6('0x1a'));var db=require('../../mysqldb')['db'];config[_0xcea6('0x1b')]=_[_0xcea6('0x1c')](config['redis'],{'host':_0xcea6('0x1d'),'port':0x18eb});var socket=require(_0xcea6('0x1e'))(new Redis(config[_0xcea6('0x1b')]));require(_0xcea6('0x1f'))[_0xcea6('0x20')](socket);var jayson=require(_0xcea6('0x21'));var client=jayson['client'][_0xcea6('0x22')]({'port':0x232c});var client9002=jayson[_0xcea6('0x23')][_0xcea6('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x56d51e,_0x209afd,_0x5c0532,_0x4744dc){return new BPromise(function(_0x233b3d,_0x4ccb5b){var _0x46a011=_0x4744dc||client;return _0x46a011[_0xcea6('0x24')](_0x56d51e,_0x5c0532)[_0xcea6('0x25')](function(_0x39a128){logger[_0xcea6('0x26')](_0xcea6('0x27'),_0x209afd,_0xcea6('0x28'));logger[_0xcea6('0x29')](_0xcea6('0x2a'),_0x209afd,'request\x20sent',JSON[_0xcea6('0x2b')](_0x39a128));if(_0x39a128[_0xcea6('0x2c')]){if(_0x39a128[_0xcea6('0x2c')]['code']===0x1f4){logger[_0xcea6('0x2c')](_0xcea6('0x27'),_0x209afd,_0x39a128['error']['message']);return _0x4ccb5b(_0x39a128[_0xcea6('0x2c')][_0xcea6('0x2d')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,_0x39a128['error'][_0xcea6('0x2d')]);return _0x233b3d(_0x39a128[_0xcea6('0x2c')]['message']);}else{logger[_0xcea6('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,'request\x20sent');_0x233b3d(_0x39a128['result'][_0xcea6('0x2d')]);}})[_0xcea6('0x2e')](function(_0xdf22da){logger[_0xcea6('0x2c')]('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,_0xdf22da);_0x4ccb5b(_0xdf22da);});});}function respondWithStatusCode(_0x1fc827,_0x31e1b9){_0x31e1b9=_0x31e1b9||0xcc;return function(_0x474fa4){if(_0x474fa4){return _0x1fc827[_0xcea6('0x2f')](_0x31e1b9);}return _0x1fc827[_0xcea6('0x30')](_0x31e1b9)[_0xcea6('0x31')]();};}function respondWithResult(_0x57cb5,_0x2c46ed){_0x2c46ed=_0x2c46ed||0xc8;return function(_0x33ac52){if(_0x33ac52){return _0x57cb5[_0xcea6('0x30')](_0x2c46ed)[_0xcea6('0x32')](_0x33ac52);}};}function respondWithFilteredResult(_0x4585cf,_0xedf0ea){return function(_0xd9cdde){if(_0xd9cdde){var _0x2e3f4d=typeof _0xedf0ea[_0xcea6('0x33')]==='undefined'&&typeof _0xedf0ea[_0xcea6('0x34')]===_0xcea6('0x35');var _0x507da0=_0xd9cdde[_0xcea6('0x36')];var _0x476950=_0x2e3f4d?0x0:_0xedf0ea[_0xcea6('0x33')];var _0x58d276=_0x2e3f4d?_0xd9cdde[_0xcea6('0x36')]:_0xedf0ea['offset']+_0xedf0ea[_0xcea6('0x34')];var _0x3b3dd3;if(_0x58d276>=_0x507da0){_0x58d276=_0x507da0;_0x3b3dd3=0xc8;}else{_0x3b3dd3=0xce;}_0x4585cf[_0xcea6('0x30')](_0x3b3dd3);return _0x4585cf[_0xcea6('0x37')](_0xcea6('0x38'),_0x476950+'-'+_0x58d276+'/'+_0x507da0)[_0xcea6('0x32')](_0xd9cdde);}return null;};}function patchUpdates(_0x528b4b){return function(_0x2e500c){try{jsonpatch[_0xcea6('0x39')](_0x2e500c,_0x528b4b,!![]);}catch(_0x261533){return BPromise[_0xcea6('0x3a')](_0x261533);}return _0x2e500c['save']();};}function saveUpdates(_0x3a6824,_0x18b171){return function(_0x346a0e){if(_0x346a0e){return _0x346a0e['update'](_0x3a6824)[_0xcea6('0x25')](function(_0x493ca8){return _0x493ca8;});}return null;};}function removeEntity(_0xd86f2f,_0x31d237){return function(_0x4da04a){if(_0x4da04a){return _0x4da04a[_0xcea6('0x3b')]()['then'](function(){_0xd86f2f[_0xcea6('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5960d3,_0x584967){return function(_0x4f3ce4){if(!_0x4f3ce4){_0x5960d3[_0xcea6('0x2f')](0x194);}return _0x4f3ce4;};}function handleError(_0x88abb7,_0x44c880){_0x44c880=_0x44c880||0x1f4;return function(_0x29d2e7){logger['error'](_0x29d2e7[_0xcea6('0x3c')]);if(_0x29d2e7[_0xcea6('0x3d')]){delete _0x29d2e7[_0xcea6('0x3d')];}_0x88abb7[_0xcea6('0x30')](_0x44c880)['send'](_0x29d2e7);};}exports['index']=function(_0x375ac4,_0x1d9675){var _0x3d46c9={},_0x40181d={},_0x12aa7d={'count':0x0,'rows':[]};var _0x3e52af=_[_0xcea6('0x3e')](db[_0xcea6('0x3f')][_0xcea6('0x40')],function(_0xaa7a58){return{'name':_0xaa7a58['fieldName'],'type':_0xaa7a58['type'][_0xcea6('0x41')]};});_0x40181d[_0xcea6('0x42')]=_[_0xcea6('0x3e')](_0x3e52af,_0xcea6('0x3d'));_0x40181d[_0xcea6('0x43')]=_['keys'](_0x375ac4[_0xcea6('0x43')]);_0x40181d[_0xcea6('0x44')]=_['intersection'](_0x40181d[_0xcea6('0x42')],_0x40181d[_0xcea6('0x43')]);_0x3d46c9['attributes']=_[_0xcea6('0x45')](_0x40181d[_0xcea6('0x42')],qs[_0xcea6('0x46')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x46')]));_0x3d46c9[_0xcea6('0x47')]=_0x3d46c9['attributes'][_0xcea6('0x48')]?_0x3d46c9[_0xcea6('0x47')]:_0x40181d['model'];if(!_0x375ac4[_0xcea6('0x43')][_0xcea6('0x49')](_0xcea6('0x4a'))){_0x3d46c9[_0xcea6('0x34')]=qs[_0xcea6('0x34')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x34')]);_0x3d46c9['offset']=qs[_0xcea6('0x33')](_0x375ac4['query'][_0xcea6('0x33')]);}_0x3d46c9['order']=qs[_0xcea6('0x4b')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4b')]);_0x3d46c9['where']=qs[_0xcea6('0x44')](_['pick'](_0x375ac4[_0xcea6('0x43')],_0x40181d[_0xcea6('0x44')]),_0x3e52af);if(_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4c')]){_0x3d46c9[_0xcea6('0x4d')]=_[_0xcea6('0x4e')](_0x3d46c9[_0xcea6('0x4d')],{'$or':_['map'](_0x3e52af,function(_0x2c8275){if(_0x2c8275['type']!==_0xcea6('0x4f')){var _0x3a512d={};_0x3a512d[_0x2c8275[_0xcea6('0x3d')]]={'$like':'%'+_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4c')]+'%'};return _0x3a512d;}})});}_0x3d46c9=_[_0xcea6('0x4e')]({},_0x3d46c9,_0x375ac4[_0xcea6('0x50')]);var _0x42ae71={'where':_0x3d46c9[_0xcea6('0x4d')]};return db[_0xcea6('0x3f')][_0xcea6('0x36')](_0x42ae71)[_0xcea6('0x25')](function(_0xec3e59){_0x12aa7d[_0xcea6('0x36')]=_0xec3e59;if(_0x375ac4[_0xcea6('0x43')][_0xcea6('0x51')]){_0x3d46c9['include']=[{'all':!![]}];}return db[_0xcea6('0x3f')]['findAll'](_0x3d46c9);})[_0xcea6('0x25')](function(_0x3b394c){_0x12aa7d[_0xcea6('0x52')]=_0x3b394c;return _0x12aa7d;})[_0xcea6('0x25')](respondWithFilteredResult(_0x1d9675,_0x3d46c9))[_0xcea6('0x2e')](handleError(_0x1d9675,null));};exports[_0xcea6('0x53')]=function(_0x4a3fc3,_0x3ee9da){var _0x3aa72c={'raw':!![],'where':{'id':_0x4a3fc3[_0xcea6('0x54')]['id']}},_0xe869da={};_0xe869da[_0xcea6('0x42')]=_[_0xcea6('0x55')](db[_0xcea6('0x3f')][_0xcea6('0x40')]);_0xe869da[_0xcea6('0x43')]=_[_0xcea6('0x55')](_0x4a3fc3['query']);_0xe869da[_0xcea6('0x44')]=_[_0xcea6('0x45')](_0xe869da[_0xcea6('0x42')],_0xe869da['query']);_0x3aa72c[_0xcea6('0x47')]=_[_0xcea6('0x45')](_0xe869da[_0xcea6('0x42')],qs[_0xcea6('0x46')](_0x4a3fc3[_0xcea6('0x43')]['fields']));_0x3aa72c[_0xcea6('0x47')]=_0x3aa72c['attributes']['length']?_0x3aa72c[_0xcea6('0x47')]:_0xe869da[_0xcea6('0x42')];if(_0x4a3fc3[_0xcea6('0x43')]['includeAll']){_0x3aa72c['include']=[{'all':!![]}];}_0x3aa72c=_['merge']({},_0x3aa72c,_0x4a3fc3['options']);return db[_0xcea6('0x3f')][_0xcea6('0x56')](_0x3aa72c)[_0xcea6('0x25')](handleEntityNotFound(_0x3ee9da,null))[_0xcea6('0x25')](respondWithResult(_0x3ee9da,null))[_0xcea6('0x2e')](handleError(_0x3ee9da,null));};exports[_0xcea6('0x57')]=function(_0x1ed669,_0x3c29ee){return db[_0xcea6('0x3f')]['create'](_0x1ed669[_0xcea6('0x58')],{})[_0xcea6('0x25')](respondWithResult(_0x3c29ee,0xc9))[_0xcea6('0x2e')](handleError(_0x3c29ee,null));};exports[_0xcea6('0x59')]=function(_0x434a4b,_0x4fa502){if(_0x434a4b[_0xcea6('0x58')]['id']){delete _0x434a4b[_0xcea6('0x58')]['id'];}return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x434a4b[_0xcea6('0x54')]['id']}})[_0xcea6('0x25')](handleEntityNotFound(_0x4fa502,null))['then'](saveUpdates(_0x434a4b[_0xcea6('0x58')],null))[_0xcea6('0x25')](respondWithResult(_0x4fa502,null))[_0xcea6('0x2e')](handleError(_0x4fa502,null));};exports[_0xcea6('0x3b')]=function(_0x13477a,_0x19fa20){return db['OpenchannelMessage'][_0xcea6('0x56')]({'where':{'id':_0x13477a[_0xcea6('0x54')]['id']}})[_0xcea6('0x25')](handleEntityNotFound(_0x19fa20,null))[_0xcea6('0x25')](removeEntity(_0x19fa20,null))[_0xcea6('0x2e')](handleError(_0x19fa20,null));};exports[_0xcea6('0x5a')]=function(_0x17cbb9,_0x205561){return db[_0xcea6('0x3f')][_0xcea6('0x5a')]()[_0xcea6('0x25')](respondWithResult(_0x205561,null))[_0xcea6('0x2e')](handleError(_0x205561,null));};var interaction_log=require(_0xcea6('0x16'))('openchannel-interactions');exports[_0xcea6('0x5b')]=function(_0x10f01c,_0x5d80b7,_0x394a27){var _0x5038a0={'agent':{},'channel':'openchannel'};if(_0x10f01c['body']['id']){delete _0x10f01c[_0xcea6('0x58')]['id'];}_0x10f01c[_0xcea6('0x58')][_0xcea6('0x5c')]=!![];_0x10f01c[_0xcea6('0x58')][_0xcea6('0x5d')]=moment()[_0xcea6('0x5e')](_0xcea6('0x5f'));_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')]=_0x10f01c[_0xcea6('0x58')]['UserId']||_0x10f01c[_0xcea6('0x61')]['id'];_0x5038a0['agent']['id']=_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')];return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x10f01c[_0xcea6('0x54')]['id'],'UserId':null}})[_0xcea6('0x25')](handleEntityNotFound(_0x5d80b7,null))[_0xcea6('0x25')](saveUpdates(_0x10f01c[_0xcea6('0x58')],null))['then'](function(_0x128d41){if(_0x128d41){_0x5038a0[_0xcea6('0x2d')]=_0x128d41[_0xcea6('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcea6('0x56')]({'where':{'id':_0x128d41[_0xcea6('0x63')]}});}return null;})[_0xcea6('0x25')](handleEntityNotFound(_0x5d80b7,null))[_0xcea6('0x25')](function(_0x41f6fa){if(_0x41f6fa){return _0x41f6fa['update']({'UserId':_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')],'read1stAt':_[_0xcea6('0x64')](_0x41f6fa[_0xcea6('0x65')])?moment()[_0xcea6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1c2812){if(_0x1c2812){_0x5038a0[_0xcea6('0x66')]=_0x1c2812[_0xcea6('0x62')]({'plain':!![]});interaction_log[_0xcea6('0x26')](_0xcea6('0x67'),_0x10f01c['user']['id'],_0x10f01c['user'][_0xcea6('0x3d')],_0x10f01c[_0xcea6('0x61')]['role'],_0x5038a0['interaction']['id'],_0x10f01c['body']?JSON['stringify'](_0x10f01c[_0xcea6('0x58')]):'null');return respondWithRpcPromise(_0xcea6('0x68'),'acceptMessage',_0x5038a0);}return null;})['then'](function(_0x395374){var _0x54073f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x395374[_0xcea6('0x2d')]['ContactId'];return db['sequelize'][_0xcea6('0x43')](_0x54073f,{'type':db[_0xcea6('0x69')][_0xcea6('0x6a')][_0xcea6('0x6b')],'raw':!![]})[_0xcea6('0x25')](function(_0x1385ef){return _0x1385ef;});})[_0xcea6('0x25')](function(_0x1afb70){if(_0x1afb70){_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x6c')]=_0x1afb70[0x0];if(!_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')])return;return db[_0xcea6('0x6d')]['find']({'where':{'id':_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')],'role':_0xcea6('0x6e')},'attributes':['id','name',_0xcea6('0x6f'),_0xcea6('0x70'),_0xcea6('0x71')],'raw':!![]});}return null;})[_0xcea6('0x25')](function(_0x263e31){if(!_0x263e31)return null;_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x6e')]=_0x263e31;return _0x5038a0;})[_0xcea6('0x25')](function(_0x4d4668){if(_0x4d4668){if(_0x10f01c['body'][_0xcea6('0x72')]){_0x5038a0['message'][_0xcea6('0x73')]=util['format'](_0xcea6('0x74'),_0x10f01c[_0xcea6('0x61')][_0xcea6('0x3d')]);_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x75')]=_0x5038a0[_0xcea6('0x75')];_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x76')]=_0x5038a0[_0xcea6('0x75')];_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x77')]='accept';return respondWithRpcPromise(_0xcea6('0x78'),_0xcea6('0x78'),{'event':_0xcea6('0x79'),'message':_0x5038a0[_0xcea6('0x2d')]},client9002)[_0xcea6('0x25')](function(){return _0x5038a0;});}return _0x5038a0;}return null;})[_0xcea6('0x25')](respondWithResult(_0x5d80b7,null))[_0xcea6('0x2e')](handleError(_0x5d80b7,null));};var interaction_log=require(_0xcea6('0x16'))(_0xcea6('0x7a'));exports[_0xcea6('0x3a')]=function(_0x2f555d,_0x58772e,_0x5d8630){var _0x2d359a={'agent':{},'channel':'openchannel'};if(_0x2f555d['body']['id']){delete _0x2f555d[_0xcea6('0x58')]['id'];}_0x2f555d['body'][_0xcea6('0x60')]=_0x2f555d['body']['UserId']||_0x2f555d[_0xcea6('0x61')]['id'];_0x2d359a[_0xcea6('0x6e')]['id']=_0x2f555d[_0xcea6('0x58')]['UserId'];return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x2f555d[_0xcea6('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58772e,null))[_0xcea6('0x25')](function(_0x2c4dce){if(_0x2c4dce){_0x2d359a[_0xcea6('0x2d')]=_0x2c4dce[_0xcea6('0x62')]({'plain':!![]});return db[_0xcea6('0x7b')][_0xcea6('0x56')]({'where':{'id':_0x2c4dce['OpenchannelInteractionId']}});}return null;})[_0xcea6('0x25')](handleEntityNotFound(_0x58772e,null))['then'](function(_0x4da0bc){if(_0x4da0bc){_0x2d359a[_0xcea6('0x66')]=_0x4da0bc[_0xcea6('0x62')]({'plain':!![]});interaction_log['info'](_0xcea6('0x7c'),_0x2f555d['user']['id'],_0x2f555d[_0xcea6('0x61')][_0xcea6('0x3d')],_0x2f555d[_0xcea6('0x61')][_0xcea6('0x7d')],_0x2d359a[_0xcea6('0x66')]['id'],_0x2f555d[_0xcea6('0x58')]?JSON[_0xcea6('0x2b')](_0x2f555d[_0xcea6('0x58')]):'null');return respondWithRpcPromise(_0xcea6('0x7e'),_0xcea6('0x7f'),_0x2d359a);}return null;})['then'](function(_0x525b9f){var _0x4258d7=_0xcea6('0x80')+_0x525b9f['message'][_0xcea6('0x81')];return db['sequelize'][_0xcea6('0x43')](_0x4258d7,{'type':db[_0xcea6('0x69')][_0xcea6('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x3127d2){return _0x3127d2;});})[_0xcea6('0x25')](function(_0x156d20){if(_0x156d20){_0x2d359a[_0xcea6('0x2d')][_0xcea6('0x6c')]=_0x156d20[0x0];if(!_0x2f555d['body'][_0xcea6('0x60')])return;return db['User'][_0xcea6('0x56')]({'where':{'id':_0x2f555d[_0xcea6('0x58')][_0xcea6('0x60')],'role':'agent'},'attributes':['id',_0xcea6('0x3d'),_0xcea6('0x6f'),_0xcea6('0x70'),_0xcea6('0x71')],'raw':!![]});}return null;})[_0xcea6('0x25')](function(_0x5b8818){if(!_0x5b8818)return null;_0x2d359a[_0xcea6('0x2d')]['agent']=_0x5b8818;return _0x2d359a;})[_0xcea6('0x25')](function(_0xa99c46){if(_0xa99c46){_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x73')]=util[_0xcea6('0x5e')](_0xcea6('0x74'),_0x2f555d['user'][_0xcea6('0x3d')]);_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x75')]=_0x2d359a['channel'];_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x76')]=_0x2d359a[_0xcea6('0x75')];_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x77')]=_0xcea6('0x3a');respondWithRpcPromise(_0xcea6('0x78'),_0xcea6('0x78'),{'event':_0xcea6('0x82'),'message':_0xa99c46['message']},client9002);return _0x2d359a;}return null;})['then'](respondWithResult(_0x58772e,null))[_0xcea6('0x2e')](handleError(_0x58772e,null));}; \ No newline at end of file +var _0xcafb=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','params','include','find','create','body','describe','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','get','OpenchannelInteraction','OpenchannelInteractionId','UserId','isNil','interaction','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','rimraf'];(function(_0x54be7c,_0x149e75){var _0x46d170=function(_0x49098e){while(--_0x49098e){_0x54be7c['push'](_0x54be7c['shift']());}};_0x46d170(++_0x149e75);}(_0xcafb,0x188));var _0xbcaf=function(_0x2df5d0,_0x41e19a){_0x2df5d0=_0x2df5d0-0x0;var _0xfe91bc=_0xcafb[_0x2df5d0];return _0xfe91bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcaf('0x0'));var zipdir=require(_0xbcaf('0x1'));var jsonpatch=require(_0xbcaf('0x2'));var rp=require(_0xbcaf('0x3'));var moment=require(_0xbcaf('0x4'));var BPromise=require(_0xbcaf('0x5'));var Mustache=require(_0xbcaf('0x6'));var util=require('util');var path=require(_0xbcaf('0x7'));var sox=require(_0xbcaf('0x8'));var csv=require(_0xbcaf('0x9'));var ejs=require(_0xbcaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbcaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbcaf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbcaf('0xd'));var toCsv=require(_0xbcaf('0x9'));var querystring=require(_0xbcaf('0xe'));var Papa=require(_0xbcaf('0xf'));var Redis=require(_0xbcaf('0x10'));var authService=require(_0xbcaf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcaf('0x12'));var hardwareService=require(_0xbcaf('0x13'));var logger=require(_0xbcaf('0x14'))('api');var utils=require(_0xbcaf('0x15'));var config=require(_0xbcaf('0x16'));var licenseUtil=require(_0xbcaf('0x17'));var db=require(_0xbcaf('0x18'))['db'];config[_0xbcaf('0x19')]=_['defaults'](config[_0xbcaf('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcaf('0x1a'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xbcaf('0x1b')](socket);var jayson=require(_0xbcaf('0x1c'));var client=jayson[_0xbcaf('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0xbcaf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4507d9,_0x4e4a65,_0x21c8e1,_0x5c8c58){return new BPromise(function(_0x498186,_0x306f06){var _0x2c5efc=_0x5c8c58||client;return _0x2c5efc[_0xbcaf('0x1f')](_0x4507d9,_0x21c8e1)[_0xbcaf('0x20')](function(_0x1d75a7){logger['info'](_0xbcaf('0x21'),_0x4e4a65,'request\x20sent');logger[_0xbcaf('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4e4a65,'request\x20sent',JSON[_0xbcaf('0x23')](_0x1d75a7));if(_0x1d75a7[_0xbcaf('0x24')]){if(_0x1d75a7[_0xbcaf('0x24')][_0xbcaf('0x25')]===0x1f4){logger['error'](_0xbcaf('0x21'),_0x4e4a65,_0x1d75a7[_0xbcaf('0x24')][_0xbcaf('0x26')]);return _0x306f06(_0x1d75a7['error'][_0xbcaf('0x26')]);}logger[_0xbcaf('0x24')](_0xbcaf('0x21'),_0x4e4a65,_0x1d75a7[_0xbcaf('0x24')][_0xbcaf('0x26')]);return _0x498186(_0x1d75a7[_0xbcaf('0x24')][_0xbcaf('0x26')]);}else{logger[_0xbcaf('0x27')](_0xbcaf('0x21'),_0x4e4a65,'request\x20sent');_0x498186(_0x1d75a7['result'][_0xbcaf('0x26')]);}})[_0xbcaf('0x28')](function(_0xe0c35f){logger[_0xbcaf('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e4a65,_0xe0c35f);_0x306f06(_0xe0c35f);});});}function respondWithStatusCode(_0x117819,_0x404764){_0x404764=_0x404764||0xcc;return function(_0x126bb1){if(_0x126bb1){return _0x117819[_0xbcaf('0x29')](_0x404764);}return _0x117819[_0xbcaf('0x2a')](_0x404764)['end']();};}function respondWithResult(_0x5652ba,_0x44f856){_0x44f856=_0x44f856||0xc8;return function(_0x653fd8){if(_0x653fd8){return _0x5652ba[_0xbcaf('0x2a')](_0x44f856)[_0xbcaf('0x2b')](_0x653fd8);}};}function respondWithFilteredResult(_0xefc6f5,_0x20a2a7){return function(_0x1ca730){if(_0x1ca730){var _0x32ee96=typeof _0x20a2a7[_0xbcaf('0x2c')]===_0xbcaf('0x2d')&&typeof _0x20a2a7[_0xbcaf('0x2e')]===_0xbcaf('0x2d');var _0x5dc2c3=_0x1ca730[_0xbcaf('0x2f')];var _0x292236=_0x32ee96?0x0:_0x20a2a7[_0xbcaf('0x2c')];var _0x3041d8=_0x32ee96?_0x1ca730[_0xbcaf('0x2f')]:_0x20a2a7[_0xbcaf('0x2c')]+_0x20a2a7[_0xbcaf('0x2e')];var _0x428885;if(_0x3041d8>=_0x5dc2c3){_0x3041d8=_0x5dc2c3;_0x428885=0xc8;}else{_0x428885=0xce;}_0xefc6f5[_0xbcaf('0x2a')](_0x428885);return _0xefc6f5[_0xbcaf('0x30')](_0xbcaf('0x31'),_0x292236+'-'+_0x3041d8+'/'+_0x5dc2c3)[_0xbcaf('0x2b')](_0x1ca730);}return null;};}function patchUpdates(_0x13f48a){return function(_0x1afb11){try{jsonpatch[_0xbcaf('0x32')](_0x1afb11,_0x13f48a,!![]);}catch(_0x424f86){return BPromise[_0xbcaf('0x33')](_0x424f86);}return _0x1afb11[_0xbcaf('0x34')]();};}function saveUpdates(_0x13d2fe,_0x3a69e4){return function(_0x533e4a){if(_0x533e4a){return _0x533e4a[_0xbcaf('0x35')](_0x13d2fe)['then'](function(_0x493149){return _0x493149;});}return null;};}function removeEntity(_0x3c9bf1,_0x11bd03){return function(_0x13817a){if(_0x13817a){return _0x13817a[_0xbcaf('0x36')]()[_0xbcaf('0x20')](function(){_0x3c9bf1[_0xbcaf('0x2a')](0xcc)[_0xbcaf('0x37')]();});}};}function handleEntityNotFound(_0x24eda5,_0xea9a4d){return function(_0x3e3e99){if(!_0x3e3e99){_0x24eda5[_0xbcaf('0x29')](0x194);}return _0x3e3e99;};}function handleError(_0x4066cd,_0x496357){_0x496357=_0x496357||0x1f4;return function(_0xc46e31){logger[_0xbcaf('0x24')](_0xc46e31[_0xbcaf('0x38')]);if(_0xc46e31['name']){delete _0xc46e31['name'];}_0x4066cd[_0xbcaf('0x2a')](_0x496357)[_0xbcaf('0x39')](_0xc46e31);};}exports[_0xbcaf('0x3a')]=function(_0x57d1f7,_0xa45212){var _0x52d5c3={},_0x3f2093={},_0x505e05={'count':0x0,'rows':[]};var _0x153605=_['map'](db[_0xbcaf('0x3b')][_0xbcaf('0x3c')],function(_0x1c94ac){return{'name':_0x1c94ac[_0xbcaf('0x3d')],'type':_0x1c94ac[_0xbcaf('0x3e')][_0xbcaf('0x3f')]};});_0x3f2093[_0xbcaf('0x40')]=_['map'](_0x153605,_0xbcaf('0x41'));_0x3f2093[_0xbcaf('0x42')]=_[_0xbcaf('0x43')](_0x57d1f7['query']);_0x3f2093[_0xbcaf('0x44')]=_[_0xbcaf('0x45')](_0x3f2093[_0xbcaf('0x40')],_0x3f2093[_0xbcaf('0x42')]);_0x52d5c3[_0xbcaf('0x46')]=_[_0xbcaf('0x45')](_0x3f2093[_0xbcaf('0x40')],qs['fields'](_0x57d1f7['query'][_0xbcaf('0x47')]));_0x52d5c3[_0xbcaf('0x46')]=_0x52d5c3['attributes'][_0xbcaf('0x48')]?_0x52d5c3[_0xbcaf('0x46')]:_0x3f2093[_0xbcaf('0x40')];if(!_0x57d1f7[_0xbcaf('0x42')]['hasOwnProperty'](_0xbcaf('0x49'))){_0x52d5c3[_0xbcaf('0x2e')]=qs[_0xbcaf('0x2e')](_0x57d1f7[_0xbcaf('0x42')][_0xbcaf('0x2e')]);_0x52d5c3[_0xbcaf('0x2c')]=qs['offset'](_0x57d1f7[_0xbcaf('0x42')]['offset']);}_0x52d5c3[_0xbcaf('0x4a')]=qs[_0xbcaf('0x4b')](_0x57d1f7[_0xbcaf('0x42')][_0xbcaf('0x4b')]);_0x52d5c3['where']=qs[_0xbcaf('0x44')](_[_0xbcaf('0x4c')](_0x57d1f7[_0xbcaf('0x42')],_0x3f2093['filters']),_0x153605);if(_0x57d1f7[_0xbcaf('0x42')][_0xbcaf('0x4d')]){_0x52d5c3[_0xbcaf('0x4e')]=_[_0xbcaf('0x4f')](_0x52d5c3[_0xbcaf('0x4e')],{'$or':_[_0xbcaf('0x50')](_0x153605,function(_0x3c6e0d){if(_0x3c6e0d['type']!==_0xbcaf('0x51')){var _0x34d2d1={};_0x34d2d1[_0x3c6e0d[_0xbcaf('0x41')]]={'$like':'%'+_0x57d1f7['query'][_0xbcaf('0x4d')]+'%'};return _0x34d2d1;}})});}_0x52d5c3=_[_0xbcaf('0x4f')]({},_0x52d5c3,_0x57d1f7[_0xbcaf('0x52')]);var _0x401528={'where':_0x52d5c3[_0xbcaf('0x4e')]};return db['OpenchannelMessage'][_0xbcaf('0x2f')](_0x401528)[_0xbcaf('0x20')](function(_0x45f239){_0x505e05['count']=_0x45f239;if(_0x57d1f7[_0xbcaf('0x42')][_0xbcaf('0x53')]){_0x52d5c3['include']=[{'all':!![]}];}return db[_0xbcaf('0x3b')][_0xbcaf('0x54')](_0x52d5c3);})[_0xbcaf('0x20')](function(_0x4049eb){_0x505e05['rows']=_0x4049eb;return _0x505e05;})['then'](respondWithFilteredResult(_0xa45212,_0x52d5c3))[_0xbcaf('0x28')](handleError(_0xa45212,null));};exports['show']=function(_0x5b61e5,_0x5bd470){var _0x33c9f4={'raw':!![],'where':{'id':_0x5b61e5[_0xbcaf('0x55')]['id']}},_0x922878={};_0x922878['model']=_['keys'](db[_0xbcaf('0x3b')][_0xbcaf('0x3c')]);_0x922878[_0xbcaf('0x42')]=_[_0xbcaf('0x43')](_0x5b61e5['query']);_0x922878['filters']=_[_0xbcaf('0x45')](_0x922878[_0xbcaf('0x40')],_0x922878[_0xbcaf('0x42')]);_0x33c9f4[_0xbcaf('0x46')]=_[_0xbcaf('0x45')](_0x922878[_0xbcaf('0x40')],qs['fields'](_0x5b61e5[_0xbcaf('0x42')]['fields']));_0x33c9f4['attributes']=_0x33c9f4[_0xbcaf('0x46')][_0xbcaf('0x48')]?_0x33c9f4['attributes']:_0x922878['model'];if(_0x5b61e5[_0xbcaf('0x42')][_0xbcaf('0x53')]){_0x33c9f4[_0xbcaf('0x56')]=[{'all':!![]}];}_0x33c9f4=_[_0xbcaf('0x4f')]({},_0x33c9f4,_0x5b61e5['options']);return db[_0xbcaf('0x3b')][_0xbcaf('0x57')](_0x33c9f4)[_0xbcaf('0x20')](handleEntityNotFound(_0x5bd470,null))[_0xbcaf('0x20')](respondWithResult(_0x5bd470,null))[_0xbcaf('0x28')](handleError(_0x5bd470,null));};exports[_0xbcaf('0x58')]=function(_0x5a3e26,_0x51b3af){return db[_0xbcaf('0x3b')][_0xbcaf('0x58')](_0x5a3e26[_0xbcaf('0x59')],{})[_0xbcaf('0x20')](respondWithResult(_0x51b3af,0xc9))['catch'](handleError(_0x51b3af,null));};exports[_0xbcaf('0x35')]=function(_0x202241,_0x3502f0){if(_0x202241['body']['id']){delete _0x202241[_0xbcaf('0x59')]['id'];}return db[_0xbcaf('0x3b')][_0xbcaf('0x57')]({'where':{'id':_0x202241[_0xbcaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x3502f0,null))[_0xbcaf('0x20')](saveUpdates(_0x202241[_0xbcaf('0x59')],null))[_0xbcaf('0x20')](respondWithResult(_0x3502f0,null))[_0xbcaf('0x28')](handleError(_0x3502f0,null));};exports[_0xbcaf('0x36')]=function(_0x577f1c,_0x1bf74f){return db[_0xbcaf('0x3b')][_0xbcaf('0x57')]({'where':{'id':_0x577f1c[_0xbcaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x1bf74f,null))[_0xbcaf('0x20')](removeEntity(_0x1bf74f,null))[_0xbcaf('0x28')](handleError(_0x1bf74f,null));};exports['describe']=function(_0x53157e,_0x10e409){return db[_0xbcaf('0x3b')][_0xbcaf('0x5a')]()[_0xbcaf('0x20')](respondWithResult(_0x10e409,null))[_0xbcaf('0x28')](handleError(_0x10e409,null));};var interaction_log=require(_0xbcaf('0x14'))(_0xbcaf('0x5b'));exports[_0xbcaf('0x5c')]=function(_0x4e997f,_0x1d8c81,_0x322ecc){var _0x2d13fb={'agent':{},'channel':'openchannel'};if(_0x4e997f[_0xbcaf('0x59')]['id']){delete _0x4e997f[_0xbcaf('0x59')]['id'];}_0x4e997f[_0xbcaf('0x59')]['read']=!![];_0x4e997f[_0xbcaf('0x59')][_0xbcaf('0x5d')]=moment()[_0xbcaf('0x5e')](_0xbcaf('0x5f'));_0x4e997f[_0xbcaf('0x59')]['UserId']=_0x4e997f[_0xbcaf('0x59')]['UserId']||_0x4e997f['user']['id'];_0x2d13fb['agent']['id']=_0x4e997f[_0xbcaf('0x59')]['UserId'];return db[_0xbcaf('0x3b')][_0xbcaf('0x57')]({'where':{'id':_0x4e997f[_0xbcaf('0x55')]['id'],'UserId':null}})[_0xbcaf('0x20')](handleEntityNotFound(_0x1d8c81,null))[_0xbcaf('0x20')](saveUpdates(_0x4e997f[_0xbcaf('0x59')],null))[_0xbcaf('0x20')](function(_0x20b99b){if(_0x20b99b){_0x2d13fb[_0xbcaf('0x26')]=_0x20b99b[_0xbcaf('0x60')]({'plain':!![]});return db[_0xbcaf('0x61')]['find']({'where':{'id':_0x20b99b[_0xbcaf('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1d8c81,null))[_0xbcaf('0x20')](function(_0x1deb9d){if(_0x1deb9d){return _0x1deb9d[_0xbcaf('0x35')]({'UserId':_0x4e997f['body'][_0xbcaf('0x63')],'read1stAt':_[_0xbcaf('0x64')](_0x1deb9d['read1stAt'])?moment()[_0xbcaf('0x5e')](_0xbcaf('0x5f')):undefined});}return null;})[_0xbcaf('0x20')](function(_0x4131bc){if(_0x4131bc){_0x2d13fb[_0xbcaf('0x65')]=_0x4131bc[_0xbcaf('0x60')]({'plain':!![]});interaction_log[_0xbcaf('0x27')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e997f[_0xbcaf('0x66')]['id'],_0x4e997f[_0xbcaf('0x66')][_0xbcaf('0x41')],_0x4e997f['user'][_0xbcaf('0x67')],_0x2d13fb['interaction']['id'],_0x4e997f[_0xbcaf('0x59')]?JSON['stringify'](_0x4e997f[_0xbcaf('0x59')]):_0xbcaf('0x68'));return respondWithRpcPromise(_0xbcaf('0x69'),'acceptMessage',_0x2d13fb);}return null;})[_0xbcaf('0x20')](function(_0x665c06){var _0x277ff0=_0xbcaf('0x6a')+_0x665c06[_0xbcaf('0x26')][_0xbcaf('0x6b')];return db[_0xbcaf('0x6c')][_0xbcaf('0x42')](_0x277ff0,{'type':db['Sequelize'][_0xbcaf('0x6d')][_0xbcaf('0x6e')],'raw':!![]})[_0xbcaf('0x20')](function(_0x349b76){return _0x349b76;});})[_0xbcaf('0x20')](function(_0x55341f){if(_0x55341f){_0x2d13fb[_0xbcaf('0x26')]['contact']=_0x55341f[0x0];if(!_0x4e997f[_0xbcaf('0x59')][_0xbcaf('0x63')])return;return db[_0xbcaf('0x6f')][_0xbcaf('0x57')]({'where':{'id':_0x4e997f[_0xbcaf('0x59')]['UserId'],'role':_0xbcaf('0x70')},'attributes':['id',_0xbcaf('0x41'),_0xbcaf('0x71'),_0xbcaf('0x72'),_0xbcaf('0x73')],'raw':!![]});}return null;})[_0xbcaf('0x20')](function(_0x56a67a){if(!_0x56a67a)return null;_0x2d13fb['message']['agent']=_0x56a67a;return _0x2d13fb;})[_0xbcaf('0x20')](function(_0x5924c6){if(_0x5924c6){if(_0x4e997f[_0xbcaf('0x59')][_0xbcaf('0x74')]){_0x2d13fb[_0xbcaf('0x26')][_0xbcaf('0x75')]=util[_0xbcaf('0x5e')](_0xbcaf('0x76'),_0x4e997f['user']['name']);_0x2d13fb[_0xbcaf('0x26')]['channel']=_0x2d13fb[_0xbcaf('0x77')];_0x2d13fb[_0xbcaf('0x26')][_0xbcaf('0x78')]=_0x2d13fb[_0xbcaf('0x77')];_0x2d13fb['message'][_0xbcaf('0x79')]=_0xbcaf('0x5c');return respondWithRpcPromise(_0xbcaf('0x7a'),_0xbcaf('0x7a'),{'event':_0xbcaf('0x7b'),'message':_0x2d13fb[_0xbcaf('0x26')]},client9002)['then'](function(){return _0x2d13fb;});}return _0x2d13fb;}return null;})['then'](respondWithResult(_0x1d8c81,null))[_0xbcaf('0x28')](handleError(_0x1d8c81,null));};var interaction_log=require(_0xbcaf('0x14'))(_0xbcaf('0x5b'));exports[_0xbcaf('0x33')]=function(_0x107820,_0xf3de43,_0x18f1cd){var _0x599ce2={'agent':{},'channel':_0xbcaf('0x7c')};if(_0x107820[_0xbcaf('0x59')]['id']){delete _0x107820[_0xbcaf('0x59')]['id'];}_0x107820[_0xbcaf('0x59')][_0xbcaf('0x63')]=_0x107820['body'][_0xbcaf('0x63')]||_0x107820['user']['id'];_0x599ce2['agent']['id']=_0x107820[_0xbcaf('0x59')]['UserId'];return db[_0xbcaf('0x3b')][_0xbcaf('0x57')]({'where':{'id':_0x107820[_0xbcaf('0x55')]['id'],'UserId':null}})[_0xbcaf('0x20')](handleEntityNotFound(_0xf3de43,null))[_0xbcaf('0x20')](function(_0x1b1e3f){if(_0x1b1e3f){_0x599ce2[_0xbcaf('0x26')]=_0x1b1e3f['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xbcaf('0x57')]({'where':{'id':_0x1b1e3f[_0xbcaf('0x62')]}});}return null;})[_0xbcaf('0x20')](handleEntityNotFound(_0xf3de43,null))[_0xbcaf('0x20')](function(_0x192ea9){if(_0x192ea9){_0x599ce2[_0xbcaf('0x65')]=_0x192ea9[_0xbcaf('0x60')]({'plain':!![]});interaction_log['info'](_0xbcaf('0x7d'),_0x107820['user']['id'],_0x107820['user'][_0xbcaf('0x41')],_0x107820[_0xbcaf('0x66')][_0xbcaf('0x67')],_0x599ce2[_0xbcaf('0x65')]['id'],_0x107820['body']?JSON[_0xbcaf('0x23')](_0x107820[_0xbcaf('0x59')]):_0xbcaf('0x68'));return respondWithRpcPromise(_0xbcaf('0x7e'),_0xbcaf('0x7f'),_0x599ce2);}return null;})[_0xbcaf('0x20')](function(_0x8f1f96){var _0xb52cad=_0xbcaf('0x6a')+_0x8f1f96[_0xbcaf('0x26')][_0xbcaf('0x6b')];return db['sequelize'][_0xbcaf('0x42')](_0xb52cad,{'type':db[_0xbcaf('0x80')][_0xbcaf('0x6d')][_0xbcaf('0x6e')],'raw':!![]})[_0xbcaf('0x20')](function(_0x1e7dc9){return _0x1e7dc9;});})[_0xbcaf('0x20')](function(_0x2f7b7a){if(_0x2f7b7a){_0x599ce2[_0xbcaf('0x26')][_0xbcaf('0x81')]=_0x2f7b7a[0x0];if(!_0x107820['body']['UserId'])return;return db['User'][_0xbcaf('0x57')]({'where':{'id':_0x107820[_0xbcaf('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xbcaf('0x41'),_0xbcaf('0x71'),_0xbcaf('0x72'),_0xbcaf('0x73')],'raw':!![]});}return null;})[_0xbcaf('0x20')](function(_0xab7810){if(!_0xab7810)return null;_0x599ce2[_0xbcaf('0x26')][_0xbcaf('0x70')]=_0xab7810;return _0x599ce2;})[_0xbcaf('0x20')](function(_0x287bc7){if(_0x287bc7){_0x287bc7[_0xbcaf('0x26')][_0xbcaf('0x75')]=util['format']('SIP/%s',_0x107820[_0xbcaf('0x66')]['name']);_0x287bc7['message'][_0xbcaf('0x77')]=_0x599ce2[_0xbcaf('0x77')];_0x287bc7[_0xbcaf('0x26')]['motionChannel']=_0x599ce2[_0xbcaf('0x77')];_0x287bc7[_0xbcaf('0x26')][_0xbcaf('0x79')]='reject';respondWithRpcPromise(_0xbcaf('0x7a'),'EventManager',{'event':_0xbcaf('0x82'),'message':_0x287bc7[_0xbcaf('0x26')]},client9002);return _0x599ce2;}return null;})['then'](respondWithResult(_0xf3de43,null))['catch'](handleError(_0xf3de43,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a174417..da24484 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 _0x3c51=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f917e,_0x30bd9c){var _0x3a5098=function(_0x5c3956){while(--_0x5c3956){_0x3f917e['push'](_0x3f917e['shift']());}};_0x3a5098(++_0x30bd9c);}(_0x3c51,0xb4));var _0x13c5=function(_0xae4ea5,_0x23ffe5){_0xae4ea5=_0xae4ea5-0x0;var _0x46952c=_0x3c51[_0xae4ea5];return _0x46952c;};'use strict';var EventEmitter=require(_0x13c5('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x13c5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x13c5('0x2')](0x0);var events={'afterCreate':_0x13c5('0x3'),'afterUpdate':_0x13c5('0x4'),'afterDestroy':_0x13c5('0x5')};function emitEvent(_0x43537e){return function(_0x1abb95,_0x2f97a0,_0x203741){OpenchannelMessageEvents['emit'](_0x43537e+':'+_0x1abb95['id'],_0x1abb95);OpenchannelMessageEvents[_0x13c5('0x6')](_0x43537e,_0x1abb95);_0x203741(null);};}for(var e in events){if(events[_0x13c5('0x7')](e)){var event=events[e];OpenchannelMessage[_0x13c5('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xeb39=['OpenchannelMessage','setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x3a3525,_0x5bee02){var _0x56e306=function(_0x3b21fc){while(--_0x3b21fc){_0x3a3525['push'](_0x3a3525['shift']());}};_0x56e306(++_0x5bee02);}(_0xeb39,0x17e));var _0x9eb3=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xeb39[_0x555ebb];return _0x3c0a4a;};'use strict';var EventEmitter=require(_0x9eb3('0x0'));var OpenchannelMessage=require(_0x9eb3('0x1'))['db'][_0x9eb3('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9eb3('0x3')](0x0);var events={'afterCreate':_0x9eb3('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f59c3){return function(_0x4e8850,_0x22a031,_0x384d0a){OpenchannelMessageEvents['emit'](_0x2f59c3+':'+_0x4e8850['id'],_0x4e8850);OpenchannelMessageEvents[_0x9eb3('0x5')](_0x2f59c3,_0x4e8850);_0x384d0a(null);};}for(var e in events){if(events[_0x9eb3('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x9eb3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 762e635..3ecbe8e 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 _0xa96a=['omit','POST','method','GET','afterCreate','threadId','update','error','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','secret','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','toLowerCase','catch','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Contact','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction'];(function(_0xab8ffa,_0x29179d){var _0x173c69=function(_0x595e6e){while(--_0x595e6e){_0xab8ffa['push'](_0xab8ffa['shift']());}};_0x173c69(++_0x29179d);}(_0xa96a,0x178));var _0xaa96=function(_0x2ab721,_0x196fa5){_0x2ab721=_0x2ab721-0x0;var _0x4be0b0=_0xa96a[_0x2ab721];return _0x4be0b0;};'use strict';var _=require(_0xaa96('0x0'));var util=require(_0xaa96('0x1'));var logger=require('../../config/logger')(_0xaa96('0x2'));var moment=require(_0xaa96('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa96('0x4'));var fs=require('fs');var path=require(_0xaa96('0x5'));var rimraf=require(_0xaa96('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa96('0x7'));module['exports']=function(_0x41d9fc,_0x2c7b04){return _0x41d9fc[_0xaa96('0x8')](_0xaa96('0x9'),attributes,{'tableName':_0xaa96('0xa'),'paranoid':![],'indexes':[{'name':_0xaa96('0xb'),'fields':[_0xaa96('0xc')],'type':_0xaa96('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41aa8c,_0x3b3f78,_0x4fe2cd){var _0x59698b=_0x41d9fc['models'];var _0x31e7c3=_0x41aa8c[_0xaa96('0xe')]({'plain':!![]});if(_0x31e7c3[_0xaa96('0xf')]['toLowerCase']()==='in'||_0x31e7c3['direction']['toLowerCase']()==='out'&&!_0x31e7c3[_0xaa96('0x10')]&&!_[_0xaa96('0x11')](_0x31e7c3[_0xaa96('0x12')])){_0x59698b['OpenchannelInteraction'][_0xaa96('0x13')]({'where':{'id':_0x31e7c3[_0xaa96('0x14')]}})['then'](function(_0x181c77){if(_0x181c77){_0x181c77['update']({'lastMsgAt':_0x31e7c3[_0xaa96('0x15')],'lastMsgDirection':_0x31e7c3[_0xaa96('0xf')][_0xaa96('0x16')]()});}})[_0xaa96('0x17')](function(_0x1ff5e4){console['error'](_0x1ff5e4);});}if(_0x31e7c3['direction']===_0xaa96('0x18')&&!_0x31e7c3[_0xaa96('0x10')]){var _0x23935c;_0x59698b[_0xaa96('0x19')][_0xaa96('0x1a')]()[_0xaa96('0x1b')](function(_0xecdd53){return _0x59698b[_0xaa96('0x1c')][_0xaa96('0x1d')]({'where':{'id':_0x31e7c3['OpenchannelAccountId']},'include':[{'model':_0x59698b[_0xaa96('0x1e')],'as':'Interactions','where':{'id':_0x31e7c3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x59698b[_0xaa96('0x19')],'as':_0xaa96('0x1f'),'attributes':_[_0xaa96('0x20')](_0xecdd53)}]}]});})[_0xaa96('0x1b')](function(_0x39ea7e){_0x23935c=_0x39ea7e['get']({'plain':!![]});if(_0x23935c&&_0x23935c[_0xaa96('0x21')]){logger[_0xaa96('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xaa96('0x23')](_0xaa96('0x24'),_0x31e7c3['id'],_0x23935c[_0xaa96('0x21')]));if(_0x23935c[_0xaa96('0x25')]&&_0x23935c['Interactions'][_0xaa96('0x26')]){_0x31e7c3[_0xaa96('0x27')]=_[_0xaa96('0x28')](_0x23935c['Interactions'][0x0],_0xaa96('0x1f'));_0x31e7c3[_0xaa96('0x1f')]=_0x23935c['Interactions'][0x0][_0xaa96('0x1f')];}var _0x3b3f78={'method':_0xaa96('0x29'),'uri':encodeURI(_0x23935c[_0xaa96('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3b3f78[_0xaa96('0x2a')]){case _0xaa96('0x2b'):_0x3b3f78['qs']=_0x31e7c3;break;case _0xaa96('0x29'):_0x3b3f78[_0xaa96('0xc')]=_0x31e7c3;break;}return rp(_0x3b3f78)[_0xaa96('0x1b')](function(_0x1b1341){logger[_0xaa96('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xaa96('0x2c'),util[_0xaa96('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x31e7c3['id'],_0x23935c[_0xaa96('0x21')]));if(_0x1b1341['body'][_0xaa96('0x2d')]&&_0x1b1341[_0xaa96('0xc')]['threadId']!=_0x31e7c3[_0xaa96('0x27')][_0xaa96('0x2d')]){return _0x59698b['OpenchannelInteraction']['update']({'threadId':_0x1b1341['body'][_0xaa96('0x2d')]},{'where':{'id':_0x31e7c3[_0xaa96('0x27')]['id']}});}else{return;}})[_0xaa96('0x1b')](function(){return _0x41aa8c[_0xaa96('0x2e')]({'read':!![]});})[_0xaa96('0x17')](function(_0x459551){logger[_0xaa96('0x2f')](_0xaa96('0x30'),_0xaa96('0x2c'),util[_0xaa96('0x31')](_0x459551,{'showHidden':![],'depth':null}));_0x4fe2cd();});}else{_0x4fe2cd();}})[_0xaa96('0x32')](function(){_0x4fe2cd();});}else{_0x4fe2cd();}}},'charset':_0xaa96('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdaf8=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','then','createdAt','error','out','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','POST','method','GET','body'];(function(_0x260dd2,_0xa0cfd4){var _0x2e9866=function(_0x323261){while(--_0x323261){_0x260dd2['push'](_0x260dd2['shift']());}};_0x2e9866(++_0xa0cfd4);}(_0xdaf8,0x18f));var _0x8daf=function(_0x14cbcc,_0x432324){_0x14cbcc=_0x14cbcc-0x0;var _0x37a788=_0xdaf8[_0x14cbcc];return _0x37a788;};'use strict';var _=require('lodash');var util=require(_0x8daf('0x0'));var logger=require(_0x8daf('0x1'))(_0x8daf('0x2'));var moment=require('moment');var BPromise=require(_0x8daf('0x3'));var rp=require(_0x8daf('0x4'));var fs=require('fs');var path=require(_0x8daf('0x5'));var rimraf=require('rimraf');var config=require(_0x8daf('0x6'));var attributes=require(_0x8daf('0x7'));module[_0x8daf('0x8')]=function(_0xf68eec,_0x4ec474){return _0xf68eec['define'](_0x8daf('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x8daf('0xa'),'fields':['body'],'type':_0x8daf('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1631b1,_0x5e3306,_0x824e2c){var _0x6ab19d=_0xf68eec['models'];var _0x4b1af1=_0x1631b1[_0x8daf('0xc')]({'plain':!![]});if(_0x4b1af1[_0x8daf('0xd')][_0x8daf('0xe')]()==='in'||_0x4b1af1[_0x8daf('0xd')][_0x8daf('0xe')]()==='out'&&!_0x4b1af1[_0x8daf('0xf')]&&!_[_0x8daf('0x10')](_0x4b1af1['UserId'])){_0x6ab19d[_0x8daf('0x11')][_0x8daf('0x12')]({'where':{'id':_0x4b1af1['OpenchannelInteractionId']}})[_0x8daf('0x13')](function(_0x23c2e3){if(_0x23c2e3){_0x23c2e3['update']({'lastMsgAt':_0x4b1af1[_0x8daf('0x14')],'lastMsgDirection':_0x4b1af1['direction'][_0x8daf('0xe')]()});}})['catch'](function(_0x3ad191){console[_0x8daf('0x15')](_0x3ad191);});}if(_0x4b1af1['direction']===_0x8daf('0x16')&&!_0x4b1af1[_0x8daf('0xf')]){var _0x310909;_0x6ab19d[_0x8daf('0x17')][_0x8daf('0x18')]()[_0x8daf('0x13')](function(_0x5b16cc){return _0x6ab19d[_0x8daf('0x19')]['find']({'where':{'id':_0x4b1af1[_0x8daf('0x1a')]},'include':[{'model':_0x6ab19d['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x4b1af1['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x6ab19d[_0x8daf('0x17')],'as':_0x8daf('0x1b'),'attributes':_[_0x8daf('0x1c')](_0x5b16cc)}]}]});})[_0x8daf('0x13')](function(_0x222c24){_0x310909=_0x222c24[_0x8daf('0xc')]({'plain':!![]});if(_0x310909&&_0x310909['replyUri']){logger[_0x8daf('0x1d')](_0x8daf('0x1e'),'afterCreate',util[_0x8daf('0x1f')](_0x8daf('0x20'),_0x4b1af1['id'],_0x310909[_0x8daf('0x21')]));if(_0x310909['Interactions']&&_0x310909[_0x8daf('0x22')][_0x8daf('0x23')]){_0x4b1af1[_0x8daf('0x24')]=_[_0x8daf('0x25')](_0x310909['Interactions'][0x0],_0x8daf('0x1b'));_0x4b1af1['Contact']=_0x310909[_0x8daf('0x22')][0x0][_0x8daf('0x1b')];}var _0x5e3306={'method':_0x8daf('0x26'),'uri':encodeURI(_0x310909[_0x8daf('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5e3306[_0x8daf('0x27')]){case _0x8daf('0x28'):_0x5e3306['qs']=_0x4b1af1;break;case _0x8daf('0x26'):_0x5e3306[_0x8daf('0x29')]=_0x4b1af1;break;}return rp(_0x5e3306)[_0x8daf('0x13')](function(_0x15a063){logger[_0x8daf('0x1d')](_0x8daf('0x1e'),'afterCreate',util['format'](_0x8daf('0x2a'),_0x4b1af1['id'],_0x310909[_0x8daf('0x21')]));if(_0x15a063[_0x8daf('0x29')][_0x8daf('0x2b')]&&_0x15a063['body'][_0x8daf('0x2b')]!=_0x4b1af1['Interaction'][_0x8daf('0x2b')]){return _0x6ab19d[_0x8daf('0x11')][_0x8daf('0x2c')]({'threadId':_0x15a063[_0x8daf('0x29')][_0x8daf('0x2b')]},{'where':{'id':_0x4b1af1[_0x8daf('0x24')]['id']}});}else{return;}})[_0x8daf('0x13')](function(){return _0x1631b1[_0x8daf('0x2c')]({'read':!![]});})['catch'](function(_0x15955a){logger['error'](_0x8daf('0x1e'),_0x8daf('0x2d'),util['inspect'](_0x15955a,{'showHidden':![],'depth':null}));_0x824e2c();});}else{_0x824e2c();}})[_0x8daf('0x2e')](function(){_0x824e2c();});}else{_0x824e2c();}}},'charset':_0x8daf('0x2f'),'collate':_0x8daf('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 09bce38..6facdd0 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2577f7,_0x4e4781){var _0x55d372=function(_0x59b397){while(--_0x59b397){_0x2577f7['push'](_0x2577f7['shift']());}};_0x55d372(++_0x4e4781);}(_0x1261,0x144));var _0x1126=function(_0xc2e46e,_0x3b979c){_0xc2e46e=_0xc2e46e-0x0;var _0x1a355d=_0x1261[_0xc2e46e];return _0x1a355d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4603d7,_0x223e5f){var _0x26818c=function(_0x5edf74){while(--_0x5edf74){_0x4603d7['push'](_0x4603d7['shift']());}};_0x26818c(++_0x223e5f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x0b0e[_0x463697];return _0x33cfe1;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 4ae7f49..ee9b2eb 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 _0x7278=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x9a29ea,_0x5b8b29){var _0x11f261=function(_0x397dea){while(--_0x397dea){_0x9a29ea['push'](_0x9a29ea['shift']());}};_0x11f261(++_0x5b8b29);}(_0x7278,0x161));var _0x8727=function(_0x312d15,_0x35f392){_0x312d15=_0x312d15-0x0;var _0x3b2a37=_0x7278[_0x312d15];return _0x3b2a37;};'use strict';var OpenchannelMessageEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){OpenchannelMessageEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);OpenchannelMessageEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file +var _0xc99e=['remove','update','emit','removeListener','register','./openchannelMessage.events','save'];(function(_0x42aa0a,_0x57286c){var _0x1150e4=function(_0x2c5ba7){while(--_0x2c5ba7){_0x42aa0a['push'](_0x42aa0a['shift']());}};_0x1150e4(++_0x57286c);}(_0xc99e,0x6e));var _0xec99=function(_0x3e782a,_0x36a31e){_0x3e782a=_0x3e782a-0x0;var _0x2c2d27=_0xc99e[_0x3e782a];return _0x2c2d27;};'use strict';var OpenchannelMessageEvents=require(_0xec99('0x0'));var events=[_0xec99('0x1'),_0xec99('0x2'),_0xec99('0x3')];function createListener(_0x22b65c,_0x41e155){return function(_0x4e3a66){_0x41e155[_0xec99('0x4')](_0x22b65c,_0x4e3a66);};}function removeListener(_0x4055ec,_0x111230){return function(){OpenchannelMessageEvents[_0xec99('0x5')](_0x4055ec,_0x111230);};}exports[_0xec99('0x6')]=function(_0x39821d){for(var _0x451dd4=0x0,_0x470d70=events['length'];_0x451dd4<_0x470d70;_0x451dd4++){var _0x797806=events[_0x451dd4];var _0x425a61=createListener('openchannelMessage:'+_0x797806,_0x39821d);OpenchannelMessageEvents['on'](_0x797806,_0x425a61);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 66ddf33..58bb946 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 _0x4cba=['/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','/:id/teams','removeTeams','delete','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x1d0764,_0x2beb7c){var _0x423f49=function(_0x5334ee){while(--_0x5334ee){_0x1d0764['push'](_0x1d0764['shift']());}};_0x423f49(++_0x2beb7c);}(_0x4cba,0x140));var _0xa4cb=function(_0x35ead7,_0x453d3a){_0x35ead7=_0x35ead7-0x0;var _0x33b761=_0x4cba[_0x35ead7];return _0x33b761;};'use strict';var multer=require(_0xa4cb('0x0'));var util=require(_0xa4cb('0x1'));var path=require('path');var timeout=require(_0xa4cb('0x2'));var express=require('express');var router=express[_0xa4cb('0x3')]();var fs_extra=require(_0xa4cb('0x4'));var auth=require(_0xa4cb('0x5'));var interaction=require(_0xa4cb('0x6'));var config=require(_0xa4cb('0x7'));var controller=require('./openchannelQueue.controller');router[_0xa4cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xa4cb('0x9')]);router[_0xa4cb('0x8')](_0xa4cb('0xa'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0xc')]);router[_0xa4cb('0x8')](_0xa4cb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa4cb('0xe'),auth['isAuthenticated'](),controller[_0xa4cb('0xf')]);router[_0xa4cb('0x8')]('/:id/teams',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x10')]);router[_0xa4cb('0x8')](_0xa4cb('0x11'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x12')]);router[_0xa4cb('0x13')]('/',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x14')]);router['post']('/:id/teams',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x15')]);router['post']('/:id/users',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x16')]);router[_0xa4cb('0x17')](_0xa4cb('0xd'),auth[_0xa4cb('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa4cb('0x18')]);router['delete'](_0xa4cb('0x19'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x1a')]);router[_0xa4cb('0x1b')]('/:id/users',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x1c')]);module[_0xa4cb('0x1d')]=router; \ No newline at end of file +var _0x95a0=['update','destroy','delete','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','index','/describe','get','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addAgents'];(function(_0x116ff3,_0x3045f7){var _0x48d2f1=function(_0x7a67d5){while(--_0x7a67d5){_0x116ff3['push'](_0x116ff3['shift']());}};_0x48d2f1(++_0x3045f7);}(_0x95a0,0x17d));var _0x095a=function(_0x52dd35,_0x1cd3c6){_0x52dd35=_0x52dd35-0x0;var _0x49e084=_0x95a0[_0x52dd35];return _0x49e084;};'use strict';var multer=require(_0x095a('0x0'));var util=require(_0x095a('0x1'));var path=require(_0x095a('0x2'));var timeout=require(_0x095a('0x3'));var express=require(_0x095a('0x4'));var router=express[_0x095a('0x5')]();var fs_extra=require(_0x095a('0x6'));var auth=require(_0x095a('0x7'));var interaction=require(_0x095a('0x8'));var config=require('../../config/environment');var controller=require(_0x095a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x095a('0xa')]);router['get'](_0x095a('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x095a('0xc')](_0x095a('0xd'),auth[_0x095a('0xe')](),controller[_0x095a('0xf')]);router[_0x095a('0xc')](_0x095a('0x10'),auth[_0x095a('0xe')](),controller[_0x095a('0x11')]);router[_0x095a('0xc')]('/:id/teams',auth['isAuthenticated'](),controller[_0x095a('0x12')]);router[_0x095a('0xc')](_0x095a('0x13'),auth[_0x095a('0xe')](),controller[_0x095a('0x14')]);router['post']('/',auth[_0x095a('0xe')](),controller[_0x095a('0x15')]);router[_0x095a('0x16')](_0x095a('0x17'),auth[_0x095a('0xe')](),controller['addTeams']);router[_0x095a('0x16')](_0x095a('0x13'),auth[_0x095a('0xe')](),controller[_0x095a('0x18')]);router['put']('/:id',auth[_0x095a('0xe')](),controller[_0x095a('0x19')]);router['delete'](_0x095a('0xd'),auth[_0x095a('0xe')](),controller[_0x095a('0x1a')]);router[_0x095a('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x095a('0x1b')](_0x095a('0x13'),auth[_0x095a('0xe')](),controller[_0x095a('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 50341b3..83530ed 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 _0x56c2=['exports','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x107689,_0x5d4673){var _0x1e28cf=function(_0x5873f0){while(--_0x5873f0){_0x107689['push'](_0x107689['shift']());}};_0x1e28cf(++_0x5d4673);}(_0x56c2,0x101));var _0x256c=function(_0x4935dc,_0x1eb53f){_0x4935dc=_0x4935dc-0x0;var _0x43a146=_0x56c2[_0x4935dc];return _0x43a146;};'use strict';var Sequelize=require(_0x256c('0x0'));module[_0x256c('0x1')]={'name':{'type':Sequelize[_0x256c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x256c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x256c('0x4')](_0x256c('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x9db4=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER'];(function(_0x4fcb8e,_0x37c2a8){var _0x56dde0=function(_0x470e49){while(--_0x470e49){_0x4fcb8e['push'](_0x4fcb8e['shift']());}};_0x56dde0(++_0x37c2a8);}(_0x9db4,0x153));var _0x49db=function(_0x1810a2,_0x5e5355){_0x1810a2=_0x1810a2-0x0;var _0x58e616=_0x9db4[_0x1810a2];return _0x58e616;};'use strict';var Sequelize=require(_0x49db('0x0'));module[_0x49db('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x49db('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x49db('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x49db('0x4'),_0x49db('0x5'),_0x49db('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8e46437..72e1b51 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 _0x2158=['getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','query','findAll','rows','catch','show','model','filters','intersection','attributes','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','keys','UserOpenchannelQueue','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','openchannelPause','createdAt','format','%s/%s','SIP','getTeams','Team','length','hasOwnProperty','addTeams','ids','Agents','voicePause','flatMap','transaction','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove'];(function(_0x1341d6,_0xdb53b9){var _0x2a78db=function(_0x37cdaa){while(--_0x37cdaa){_0x1341d6['push'](_0x1341d6['shift']());}};_0x2a78db(++_0xdb53b9);}(_0x2158,0x79));var _0x8215=function(_0x1affed,_0x45765a){_0x1affed=_0x1affed-0x0;var _0x1cfa90=_0x2158[_0x1affed];return _0x1cfa90;};'use strict';var BPromise=require(_0x8215('0x0'));var util=require(_0x8215('0x1'));var _=require('lodash');var squel=require(_0x8215('0x2'));var Redis=require(_0x8215('0x3'));var qs=require(_0x8215('0x4'));var logger=require(_0x8215('0x5'))(_0x8215('0x6'));var config=require(_0x8215('0x7'));var db=require(_0x8215('0x8'))['db'];config['redis']=_[_0x8215('0x9')](config[_0x8215('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8215('0xb'))(new Redis(config[_0x8215('0xa')]));require('./openchannelQueue.socket')[_0x8215('0xc')](socket);function respondWithStatusCode(_0x4b44e4,_0x5b548c){_0x5b548c=_0x5b548c||0xcc;return function(_0xf67fb3){if(_0xf67fb3){return _0x4b44e4[_0x8215('0xd')](_0x5b548c);}return _0x4b44e4[_0x8215('0xe')](_0x5b548c)[_0x8215('0xf')]();};}function respondWithResult(_0x4703be,_0x2dd550){_0x2dd550=_0x2dd550||0xc8;return function(_0x121ea2){if(_0x121ea2){return _0x4703be[_0x8215('0xe')](_0x2dd550)[_0x8215('0x10')](_0x121ea2);}};}function respondWithFilteredResult(_0x4ca6a2,_0x22c70f){return function(_0x311e24){if(_0x311e24){var _0x45f1d8=typeof _0x22c70f[_0x8215('0x11')]===_0x8215('0x12')&&typeof _0x22c70f[_0x8215('0x13')]===_0x8215('0x12');var _0x543e1d=_0x311e24[_0x8215('0x14')];var _0x362bcd=_0x45f1d8?0x0:_0x22c70f[_0x8215('0x11')];var _0x7a7a9f=_0x45f1d8?_0x311e24[_0x8215('0x14')]:_0x22c70f['offset']+_0x22c70f['limit'];var _0x4a0987;if(_0x7a7a9f>=_0x543e1d){_0x7a7a9f=_0x543e1d;_0x4a0987=0xc8;}else{_0x4a0987=0xce;}_0x4ca6a2[_0x8215('0xe')](_0x4a0987);return _0x4ca6a2['set'](_0x8215('0x15'),_0x362bcd+'-'+_0x7a7a9f+'/'+_0x543e1d)[_0x8215('0x10')](_0x311e24);}return null;};}function saveUpdates(_0x429d3c){return function(_0x3de554){if(_0x3de554){return _0x3de554[_0x8215('0x16')](_0x429d3c)[_0x8215('0x17')](function(_0x1c05a7){return _0x1c05a7;});}return null;};}function removeEntity(_0x3fefef){return function(_0x1d9a8b){if(_0x1d9a8b){return _0x1d9a8b[_0x8215('0x18')]()[_0x8215('0x17')](function(){var _0x303cc2=_0x1d9a8b[_0x8215('0x19')]({'plain':!![]});var _0x3ed483=_0x8215('0x1a');return db[_0x8215('0x1b')][_0x8215('0x18')]({'where':{'type':_0x3ed483,'resourceId':_0x303cc2['id']}})[_0x8215('0x17')](function(){return _0x1d9a8b;});})['then'](function(){_0x3fefef[_0x8215('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1169be){return function(_0x280e50){if(!_0x280e50){_0x1169be[_0x8215('0xd')](0x194);}return _0x280e50;};}function handleError(_0x587ce9,_0xd4f0e9){_0xd4f0e9=_0xd4f0e9||0x1f4;return function(_0x549351){logger[_0x8215('0x1c')](_0x549351[_0x8215('0x1d')]);if(_0x549351[_0x8215('0x1e')]){delete _0x549351[_0x8215('0x1e')];}_0x587ce9['status'](_0xd4f0e9)[_0x8215('0x1f')](_0x549351);};}exports[_0x8215('0x20')]=function(_0x4ab540,_0x176d10){var _0x3bfc5c={};var _0x104169={'count':0x0,'rows':[]};var _0x1f0c44=_[_0x8215('0x21')](db[_0x8215('0x22')][_0x8215('0x23')],function(_0x423dc8){return{'name':_0x423dc8[_0x8215('0x24')],'type':_0x423dc8[_0x8215('0x25')][_0x8215('0x26')]};});_0x3bfc5c=qs[_0x8215('0x27')](_0x1f0c44,_0x4ab540);var _0x6eca1a={'where':_0x3bfc5c['where']};return db[_0x8215('0x22')]['count'](_0x6eca1a)[_0x8215('0x17')](function(_0x128c5f){_0x104169[_0x8215('0x14')]=_0x128c5f;_0x3bfc5c['include']=qs['include'](_0x4ab540[_0x8215('0x28')]);return db[_0x8215('0x22')][_0x8215('0x29')](_0x3bfc5c);})[_0x8215('0x17')](function(_0x3e6275){_0x104169[_0x8215('0x2a')]=_0x3e6275;return _0x104169;})['then'](respondWithFilteredResult(_0x176d10,_0x3bfc5c))[_0x8215('0x2b')](handleError(_0x176d10,null));};exports[_0x8215('0x2c')]=function(_0x12f288,_0xe90c0a){var _0x2640f3={'raw':!![],'where':{'id':_0x12f288['params']['id']}},_0x5be17f={};_0x5be17f[_0x8215('0x2d')]=_['keys'](db['OpenchannelQueue'][_0x8215('0x23')]);_0x5be17f['query']=_['keys'](_0x12f288[_0x8215('0x28')]);_0x5be17f[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x5be17f[_0x8215('0x2d')],_0x5be17f[_0x8215('0x28')]);_0x2640f3[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x5be17f[_0x8215('0x2d')],qs[_0x8215('0x31')](_0x12f288[_0x8215('0x28')]['fields']));_0x2640f3[_0x8215('0x30')]=_0x2640f3[_0x8215('0x30')]['length']?_0x2640f3[_0x8215('0x30')]:_0x5be17f['model'];if(_0x12f288[_0x8215('0x28')]['includeAll']){_0x2640f3['include']=[{'all':!![]}];}_0x2640f3=_['merge']({},_0x2640f3,_0x12f288[_0x8215('0x32')]);return db[_0x8215('0x22')][_0x8215('0x33')](_0x2640f3)[_0x8215('0x17')](handleEntityNotFound(_0xe90c0a,null))[_0x8215('0x17')](respondWithResult(_0xe90c0a,null))[_0x8215('0x2b')](handleError(_0xe90c0a,null));};exports[_0x8215('0x34')]=function(_0x6b3b4e,_0x4283a9){return db[_0x8215('0x22')]['create'](_0x6b3b4e['body'],{})[_0x8215('0x17')](function(_0x15df2d){var _0x35b16e=_0x6b3b4e[_0x8215('0x35')][_0x8215('0x19')]({'plain':!![]});if(!_0x35b16e)throw new Error(_0x8215('0x36'));if(_0x35b16e[_0x8215('0x37')]===_0x8215('0x35')){var _0x53a570=_0x15df2d[_0x8215('0x19')]({'plain':!![]});var _0x32f924=_0x8215('0x1a');return db[_0x8215('0x38')][_0x8215('0x33')]({'where':{'name':_0x32f924,'userProfileId':_0x35b16e[_0x8215('0x39')]},'raw':!![]})[_0x8215('0x17')](function(_0x18de4d){if(_0x18de4d&&_0x18de4d[_0x8215('0x3a')]===0x0){return db[_0x8215('0x1b')][_0x8215('0x34')]({'name':_0x53a570[_0x8215('0x1e')],'resourceId':_0x53a570['id'],'type':_0x18de4d[_0x8215('0x1e')],'sectionId':_0x18de4d['id']},{})['then'](function(){return _0x15df2d;});}else{return _0x15df2d;}})['catch'](function(_0x340f6e){logger['error'](_0x8215('0x3b'),_0x340f6e);throw _0x340f6e;});}return _0x15df2d;})[_0x8215('0x17')](respondWithResult(_0x4283a9,0xc9))[_0x8215('0x2b')](handleError(_0x4283a9,null));};exports['update']=function(_0x3b491d,_0x2e9001){if(_0x3b491d[_0x8215('0x3c')]['id']){delete _0x3b491d[_0x8215('0x3c')]['id'];}return db['OpenchannelQueue'][_0x8215('0x33')]({'where':{'id':_0x3b491d[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x2e9001,null))[_0x8215('0x17')](saveUpdates(_0x3b491d[_0x8215('0x3c')],null))[_0x8215('0x17')](respondWithResult(_0x2e9001,null))[_0x8215('0x2b')](handleError(_0x2e9001,null));};exports['destroy']=function(_0x3c421e,_0x31718d){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x3c421e[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31718d,null))[_0x8215('0x17')](removeEntity(_0x31718d,null))['catch'](handleError(_0x31718d,null));};exports['describe']=function(_0x57c18e,_0x300cc0){return db[_0x8215('0x22')][_0x8215('0x3e')]()[_0x8215('0x17')](respondWithResult(_0x300cc0,null))[_0x8215('0x2b')](handleError(_0x300cc0,null));};exports[_0x8215('0x3f')]=function(_0x4e4095,_0x4d3694){var _0x2ca583={'raw':!![],'where':{}},_0x412a1d={},_0x1f084a;return db[_0x8215('0x22')][_0x8215('0x40')]({'where':{'id':_0x4e4095[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x4d3694,null))[_0x8215('0x17')](function(_0x7b5673){if(_0x7b5673){_0x1f084a=_0x7b5673[_0x8215('0x19')]({'plain':!![]});_0x412a1d['model']=_[_0x8215('0x41')](db[_0x8215('0x42')][_0x8215('0x23')]);_0x412a1d[_0x8215('0x28')]=_[_0x8215('0x41')](_0x4e4095[_0x8215('0x28')]);_0x412a1d[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x412a1d[_0x8215('0x2d')],_0x412a1d['query']);_0x2ca583[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x412a1d[_0x8215('0x2d')],qs['fields'](_0x4e4095['query'][_0x8215('0x31')]));_0x2ca583['attributes']=_0x2ca583[_0x8215('0x30')]['length']?_0x2ca583[_0x8215('0x30')]:_0x412a1d['model'];if(!_0x4e4095['query']['hasOwnProperty'](_0x8215('0x43'))){_0x2ca583['limit']=qs['limit'](_0x4e4095[_0x8215('0x28')][_0x8215('0x13')]);_0x2ca583[_0x8215('0x11')]=qs[_0x8215('0x11')](_0x4e4095[_0x8215('0x28')][_0x8215('0x11')]);}_0x2ca583[_0x8215('0x44')]=qs[_0x8215('0x45')](_0x4e4095[_0x8215('0x28')][_0x8215('0x45')]);_0x2ca583[_0x8215('0x46')]=qs[_0x8215('0x2e')](_[_0x8215('0x47')](_0x4e4095['query'],_0x412a1d['filters']));_0x2ca583[_0x8215('0x46')][_0x8215('0x48')]=_0x7b5673['id'];if(_0x4e4095[_0x8215('0x28')][_0x8215('0x49')]){_0x2ca583[_0x8215('0x46')]=_[_0x8215('0x4a')](_0x2ca583[_0x8215('0x46')],{'$or':_[_0x8215('0x21')](_0x2ca583[_0x8215('0x30')],function(_0x130e4f){var _0x2b0e0b={};_0x2b0e0b[_0x130e4f]={'$like':'%'+_0x4e4095[_0x8215('0x28')][_0x8215('0x49')]+'%'};return _0x2b0e0b;})});}_0x2ca583=_['merge']({},_0x2ca583,_0x4e4095[_0x8215('0x32')]);return db[_0x8215('0x42')][_0x8215('0x29')](_0x2ca583);}})[_0x8215('0x17')](function(_0x5d9f1f){if(_0x5d9f1f){return db[_0x8215('0x4b')][_0x8215('0x4c')]({'where':{'id':_[_0x8215('0x21')](_0x5d9f1f,_0x8215('0x4d')),'role':'agent'},'attributes':['id',_0x8215('0x1e'),_0x8215('0x4e'),'updatedAt',_0x8215('0x4f')]});}})[_0x8215('0x17')](function(_0x10fe19){if(_0x10fe19){return{'count':_0x10fe19[_0x8215('0x14')],'rows':_['map'](_0x10fe19[_0x8215('0x2a')],function(_0x50b9a2){return{'membername':_0x50b9a2[_0x8215('0x1e')],'UserId':_0x50b9a2['id'],'queue_name':_0x1f084a[_0x8215('0x1e')],'OpenchannelQueueId':_0x1f084a['id'],'interface':util[_0x8215('0x50')](_0x8215('0x51'),_0x8215('0x52'),_0x50b9a2[_0x8215('0x1e')]),'penalty':0x0,'paused':_0x50b9a2[_0x8215('0x4e')],'createdAt':_0x50b9a2['createdAt'],'updatedAt':_0x50b9a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8215('0x17')](respondWithFilteredResult(_0x4d3694,_0x2ca583))['catch'](handleError(_0x4d3694,null));};exports[_0x8215('0x53')]=function(_0x556b17,_0x415ab2){var _0x1c09d4={};var _0x1c626b={};var _0x420660;var _0x5261e2;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x556b17[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x415ab2,null))['then'](function(_0x101aa8){if(_0x101aa8){_0x420660=_0x101aa8;_0x1c626b[_0x8215('0x2d')]=_[_0x8215('0x41')](db[_0x8215('0x54')]['rawAttributes']);_0x1c626b[_0x8215('0x28')]=_[_0x8215('0x41')](_0x556b17[_0x8215('0x28')]);_0x1c626b[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x1c626b['model'],_0x1c626b[_0x8215('0x28')]);_0x1c09d4[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x1c626b[_0x8215('0x2d')],qs[_0x8215('0x31')](_0x556b17[_0x8215('0x28')][_0x8215('0x31')]));_0x1c09d4['attributes']=_0x1c09d4[_0x8215('0x30')][_0x8215('0x55')]?_0x1c09d4['attributes']:_0x1c626b[_0x8215('0x2d')];_0x1c09d4[_0x8215('0x44')]=qs[_0x8215('0x45')](_0x556b17[_0x8215('0x28')][_0x8215('0x45')]);_0x1c09d4[_0x8215('0x46')]=qs[_0x8215('0x2e')](_['pick'](_0x556b17[_0x8215('0x28')],_0x1c626b[_0x8215('0x2e')]));if(_0x556b17[_0x8215('0x28')]['filter']){_0x1c09d4[_0x8215('0x46')]=_['merge'](_0x1c09d4['where'],{'$or':_[_0x8215('0x21')](_0x1c09d4['attributes'],function(_0x5970f1){var _0x2efb6d={};_0x2efb6d[_0x5970f1]={'$like':'%'+_0x556b17['query'][_0x8215('0x49')]+'%'};return _0x2efb6d;})});}_0x1c09d4=_[_0x8215('0x4a')]({},_0x1c09d4,_0x556b17[_0x8215('0x32')]);return _0x420660[_0x8215('0x53')](_0x1c09d4);}})[_0x8215('0x17')](function(_0x5f2208){if(_0x5f2208){_0x5261e2=_0x5f2208[_0x8215('0x55')];if(!_0x556b17['query'][_0x8215('0x56')](_0x8215('0x43'))){_0x1c09d4['limit']=qs['limit'](_0x556b17[_0x8215('0x28')][_0x8215('0x13')]);_0x1c09d4[_0x8215('0x11')]=qs['offset'](_0x556b17['query'][_0x8215('0x11')]);}return _0x420660[_0x8215('0x53')](_0x1c09d4);}})['then'](function(_0x12343f){if(_0x12343f){return _0x12343f?{'count':_0x5261e2,'rows':_0x12343f}:null;}})[_0x8215('0x17')](respondWithResult(_0x415ab2,null))[_0x8215('0x2b')](handleError(_0x415ab2,null));};exports[_0x8215('0x57')]=function(_0x52ca42,_0x529923){var _0x5d28ff=_0x52ca42['body'][_0x8215('0x58')];return db[_0x8215('0x54')][_0x8215('0x29')]({'where':{'id':_0x5d28ff},'attributes':['id'],'include':[{'model':db[_0x8215('0x4b')],'as':_0x8215('0x59'),'attributes':['id',_0x8215('0x1e'),'online',_0x8215('0x5a'),'interface'],'raw':!![]}]})[_0x8215('0x17')](function(_0xf0070e){if(_0xf0070e){var _0x77fb38=_[_0x8215('0x5b')](_0xf0070e,function(_0x31a3a0){var _0x3a2984=_0x31a3a0[_0x8215('0x19')]({'plain':!![]});return _0x3a2984[_0x8215('0x59')];});return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x52ca42['params']['id']}})[_0x8215('0x17')](function(_0x3506c9){return db['sequelize'][_0x8215('0x5c')](function(_0x4f80c7){return _0x3506c9[_0x8215('0x57')](_0x5d28ff,{'transaction':_0x4f80c7})[_0x8215('0x17')](function(){return BPromise['each'](_0x77fb38,function(_0x4bd965){return db[_0x8215('0x42')][_0x8215('0x5d')]({'where':{'UserId':_0x4bd965['id'],'OpenchannelQueueId':_0x52ca42[_0x8215('0x3d')]['id']},'transaction':_0x4f80c7});});})[_0x8215('0x17')](function(){_0x77fb38['forEach'](function(_0x1508b6){socket[_0x8215('0x5e')](_0x8215('0x5f'),{'UserId':_0x1508b6['id'],'OpenchannelQueueId':_0x3506c9['id']});});});});});}})['then'](respondWithStatusCode(_0x529923,null))['catch'](handleError(_0x529923,null));};exports[_0x8215('0x60')]=function(_0x534a9b,_0x29fb04){return db[_0x8215('0x54')][_0x8215('0x29')]({'where':{'id':_0x534a9b[_0x8215('0x28')][_0x8215('0x58')]},'attributes':['id'],'include':[{'model':db[_0x8215('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8215('0x17')](handleEntityNotFound(_0x29fb04,null))[_0x8215('0x17')](function(_0x15a3a9){var _0x11369b=_[_0x8215('0x21')](_0x15a3a9,'id');var _0x53818c=[];var _0x37d3c8=[];var _0x535272=squel[_0x8215('0x61')]();_0x535272[_0x8215('0x62')](_0x8215('0x63'))[_0x8215('0x64')]('team_has_openchannel_queues','tq')['join'](_0x8215('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8215('0x46')](_0x8215('0x66'),_0x534a9b[_0x8215('0x3d')]['id']);for(var _0x1c2bfb=0x0;_0x1c2bfb<_0x15a3a9['length'];_0x1c2bfb+=0x1){let _0x1f2074=_0x15a3a9[_0x1c2bfb];for(var _0x39d1fc=0x0;_0x39d1fc<_0x1f2074[_0x8215('0x59')][_0x8215('0x55')];_0x39d1fc+=0x1){let _0x4288ad=_0x1f2074['Agents'][_0x39d1fc];var _0x47e5a0=_0x535272[_0x8215('0x67')]();_0x47e5a0[_0x8215('0x46')](_0x8215('0x68'),_0x4288ad['id']);_0x37d3c8[_0x8215('0x69')](db['sequelize']['query'](_0x47e5a0['toString'](),{'type':db[_0x8215('0x6a')][_0x8215('0x6b')][_0x8215('0x6c')]})[_0x8215('0x17')](function(_0x31e533){if(_0x31e533[_0x8215('0x55')]===0x1){return _0x4288ad['id'];}else{var _0x6752b5=_[_0x8215('0x6d')](_['map'](_0x31e533,_0x8215('0x6e')),function(_0x2afe29){return _['includes'](_0x11369b,_0x2afe29);});if(_0x6752b5){return _0x4288ad['id'];}}}));}}return BPromise[_0x8215('0x6f')](_0x37d3c8)[_0x8215('0x17')](function(_0x4444ad){_0x53818c=_(_0x53818c)['union'](_0x4444ad)['compact']()[_0x8215('0x70')]();return db['OpenchannelQueue'][_0x8215('0x33')]({'where':{'id':_0x534a9b[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](function(_0xe83321){return db['sequelize'][_0x8215('0x5c')](function(_0x489d54){return _0xe83321['removeTeams'](_0x534a9b['query'][_0x8215('0x58')],{'transaction':_0x489d54})[_0x8215('0x17')](function(){if(!_[_0x8215('0x71')](_0x53818c)){return _0xe83321[_0x8215('0x72')](_0x53818c,{'transaction':_0x489d54});}})[_0x8215('0x17')](function(){_0x53818c['forEach'](function(_0x4361b3){socket[_0x8215('0x5e')]('userOpenchannelQueue:remove',{'UserId':_0x4361b3,'OpenchannelQueueId':_0xe83321['id']});});});});});});})[_0x8215('0x17')](respondWithStatusCode(_0x29fb04,null))[_0x8215('0x2b')](handleError(_0x29fb04,null));};exports[_0x8215('0x73')]=function(_0x2144a6,_0x3ed5d1){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x2144a6[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3ed5d1,null))[_0x8215('0x17')](function(_0x2a771d){if(_0x2a771d){return _0x2a771d['addAgents'](_0x2144a6[_0x8215('0x3c')][_0x8215('0x58')],_[_0x8215('0x74')](_0x2144a6[_0x8215('0x3c')],[_0x8215('0x58'),'id'])||{})[_0x8215('0x75')](function(_0x208e4b){for(var _0xecd297=0x0;_0xecd297<_0x2144a6[_0x8215('0x3c')][_0x8215('0x58')]['length'];_0xecd297+=0x1){socket[_0x8215('0x5e')](_0x8215('0x5f'),{'UserId':Number(_0x2144a6['body'][_0x8215('0x58')][_0xecd297]),'OpenchannelQueueId':Number(_0x2144a6[_0x8215('0x3d')]['id'])});}return _0x208e4b;});}})[_0x8215('0x17')](respondWithResult(_0x3ed5d1,null))['catch'](handleError(_0x3ed5d1,null));};exports[_0x8215('0x72')]=function(_0x45fc1b,_0x37e17e){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x45fc1b[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x37e17e,null))[_0x8215('0x17')](function(_0x3f4914){if(_0x3f4914){return _0x3f4914['removeAgents'](_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')])[_0x8215('0x17')](function(){if(_['isArray'](_0x45fc1b['query'][_0x8215('0x58')])){for(var _0x428cab=0x0;_0x428cab<_0x45fc1b['query']['ids'][_0x8215('0x55')];_0x428cab+=0x1){socket[_0x8215('0x5e')](_0x8215('0x76'),{'UserId':Number(_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')][_0x428cab]),'OpenchannelQueueId':Number(_0x45fc1b[_0x8215('0x3d')]['id'])});}}else{socket[_0x8215('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')]),'OpenchannelQueueId':Number(_0x45fc1b[_0x8215('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x37e17e,null))[_0x8215('0x2b')](handleError(_0x37e17e,null));};exports[_0x8215('0x77')]=function(_0x315089,_0x240b0b){var _0x500d6={};var _0x470994={};var _0x46a91b;var _0x5710af;return db[_0x8215('0x22')][_0x8215('0x40')]({'where':{'id':_0x315089[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x240b0b,null))[_0x8215('0x17')](function(_0x2da1e9){if(_0x2da1e9){_0x46a91b=_0x2da1e9;_0x470994[_0x8215('0x2d')]=_[_0x8215('0x41')](db['User']['rawAttributes']);_0x470994[_0x8215('0x28')]=_[_0x8215('0x41')](_0x315089[_0x8215('0x28')]);_0x470994['filters']=_[_0x8215('0x2f')](_0x470994[_0x8215('0x2d')],_0x470994['query']);_0x500d6[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x470994[_0x8215('0x2d')],qs['fields'](_0x315089['query'][_0x8215('0x31')]));_0x500d6[_0x8215('0x30')]=_0x500d6[_0x8215('0x30')][_0x8215('0x55')]?_0x500d6[_0x8215('0x30')]:_0x470994[_0x8215('0x2d')];_0x500d6[_0x8215('0x44')]=qs['sort'](_0x315089['query'][_0x8215('0x45')]);_0x500d6['where']=qs['filters'](_[_0x8215('0x47')](_0x315089[_0x8215('0x28')],_0x470994[_0x8215('0x2e')]));if(_0x315089[_0x8215('0x28')][_0x8215('0x49')]){_0x500d6['where']=_[_0x8215('0x4a')](_0x500d6['where'],{'$or':_[_0x8215('0x21')](_0x500d6[_0x8215('0x30')],function(_0x548a27){var _0x56129f={};_0x56129f[_0x548a27]={'$like':'%'+_0x315089[_0x8215('0x28')][_0x8215('0x49')]+'%'};return _0x56129f;})});}_0x500d6=_[_0x8215('0x4a')]({},_0x500d6,_0x315089['options']);return _0x46a91b[_0x8215('0x77')](_0x500d6);}})[_0x8215('0x17')](function(_0x5ebfdf){if(_0x5ebfdf){_0x5710af=_0x5ebfdf[_0x8215('0x55')];if(!_0x315089['query']['hasOwnProperty'](_0x8215('0x43'))){_0x500d6['limit']=qs[_0x8215('0x13')](_0x315089[_0x8215('0x28')]['limit']);_0x500d6[_0x8215('0x11')]=qs['offset'](_0x315089[_0x8215('0x28')][_0x8215('0x11')]);}return _0x46a91b[_0x8215('0x77')](_0x500d6);}})[_0x8215('0x17')](function(_0x2cc4e1){if(_0x2cc4e1){return _0x2cc4e1?{'count':_0x5710af,'rows':_0x2cc4e1}:null;}})['then'](respondWithResult(_0x240b0b,null))['catch'](handleError(_0x240b0b,null));}; \ No newline at end of file +var _0xf1db=['addTeams','each','forEach','emit','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','map','rawAttributes','fieldName','type','key','getOptions','where','OpenchannelQueue','include','query','findAll','catch','show','keys','filters','intersection','model','attributes','fields','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','merge','options','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','SIP','getTeams','Team','nolimit','ids','online','interface','flatMap','Agents','sequelize','transaction'];(function(_0x899b6a,_0x1c8b8e){var _0x3368f2=function(_0x538075){while(--_0x538075){_0x899b6a['push'](_0x899b6a['shift']());}};_0x3368f2(++_0x1c8b8e);}(_0xf1db,0x17e));var _0xbf1d=function(_0x4fe240,_0x25b6e8){_0x4fe240=_0x4fe240-0x0;var _0x314c67=_0xf1db[_0x4fe240];return _0x314c67;};'use strict';var BPromise=require(_0xbf1d('0x0'));var util=require(_0xbf1d('0x1'));var _=require(_0xbf1d('0x2'));var squel=require(_0xbf1d('0x3'));var Redis=require(_0xbf1d('0x4'));var qs=require(_0xbf1d('0x5'));var logger=require(_0xbf1d('0x6'))(_0xbf1d('0x7'));var config=require(_0xbf1d('0x8'));var db=require('../../mysqldb')['db'];config[_0xbf1d('0x9')]=_[_0xbf1d('0xa')](config['redis'],{'host':_0xbf1d('0xb'),'port':0x18eb});var socket=require(_0xbf1d('0xc'))(new Redis(config[_0xbf1d('0x9')]));require(_0xbf1d('0xd'))[_0xbf1d('0xe')](socket);function respondWithStatusCode(_0x108459,_0x1bddbd){_0x1bddbd=_0x1bddbd||0xcc;return function(_0x1c4eaf){if(_0x1c4eaf){return _0x108459[_0xbf1d('0xf')](_0x1bddbd);}return _0x108459['status'](_0x1bddbd)[_0xbf1d('0x10')]();};}function respondWithResult(_0xc8d56f,_0x1d6dfc){_0x1d6dfc=_0x1d6dfc||0xc8;return function(_0x13577d){if(_0x13577d){return _0xc8d56f[_0xbf1d('0x11')](_0x1d6dfc)['json'](_0x13577d);}};}function respondWithFilteredResult(_0x1ba347,_0x7d9db7){return function(_0x25c50e){if(_0x25c50e){var _0x4c07b9=typeof _0x7d9db7[_0xbf1d('0x12')]===_0xbf1d('0x13')&&typeof _0x7d9db7['limit']===_0xbf1d('0x13');var _0x4e0d57=_0x25c50e[_0xbf1d('0x14')];var _0x2f1391=_0x4c07b9?0x0:_0x7d9db7[_0xbf1d('0x12')];var _0x4f63ad=_0x4c07b9?_0x25c50e['count']:_0x7d9db7[_0xbf1d('0x12')]+_0x7d9db7[_0xbf1d('0x15')];var _0x2067b5;if(_0x4f63ad>=_0x4e0d57){_0x4f63ad=_0x4e0d57;_0x2067b5=0xc8;}else{_0x2067b5=0xce;}_0x1ba347[_0xbf1d('0x11')](_0x2067b5);return _0x1ba347[_0xbf1d('0x16')](_0xbf1d('0x17'),_0x2f1391+'-'+_0x4f63ad+'/'+_0x4e0d57)['json'](_0x25c50e);}return null;};}function saveUpdates(_0x386ffd){return function(_0x278544){if(_0x278544){return _0x278544[_0xbf1d('0x18')](_0x386ffd)[_0xbf1d('0x19')](function(_0x22e46a){return _0x22e46a;});}return null;};}function removeEntity(_0x2a4f4c){return function(_0xbf609f){if(_0xbf609f){return _0xbf609f[_0xbf1d('0x1a')]()[_0xbf1d('0x19')](function(){var _0x59cd42=_0xbf609f[_0xbf1d('0x1b')]({'plain':!![]});var _0x3cfed9=_0xbf1d('0x1c');return db[_0xbf1d('0x1d')][_0xbf1d('0x1a')]({'where':{'type':_0x3cfed9,'resourceId':_0x59cd42['id']}})['then'](function(){return _0xbf609f;});})['then'](function(){_0x2a4f4c[_0xbf1d('0x11')](0xcc)[_0xbf1d('0x10')]();});}};}function handleEntityNotFound(_0x373160){return function(_0x322d18){if(!_0x322d18){_0x373160['sendStatus'](0x194);}return _0x322d18;};}function handleError(_0xb55347,_0x4cd1bd){_0x4cd1bd=_0x4cd1bd||0x1f4;return function(_0x180d76){logger[_0xbf1d('0x1e')](_0x180d76['stack']);if(_0x180d76[_0xbf1d('0x1f')]){delete _0x180d76[_0xbf1d('0x1f')];}_0xb55347['status'](_0x4cd1bd)['send'](_0x180d76);};}exports['index']=function(_0x395ee5,_0x42d10e){var _0x8dc2ec={};var _0x4305d8={'count':0x0,'rows':[]};var _0x3696e1=_[_0xbf1d('0x20')](db['OpenchannelQueue'][_0xbf1d('0x21')],function(_0x27ead9){return{'name':_0x27ead9[_0xbf1d('0x22')],'type':_0x27ead9[_0xbf1d('0x23')][_0xbf1d('0x24')]};});_0x8dc2ec=qs[_0xbf1d('0x25')](_0x3696e1,_0x395ee5);var _0x495d72={'where':_0x8dc2ec[_0xbf1d('0x26')]};return db[_0xbf1d('0x27')]['count'](_0x495d72)[_0xbf1d('0x19')](function(_0x2d393a){_0x4305d8[_0xbf1d('0x14')]=_0x2d393a;_0x8dc2ec[_0xbf1d('0x28')]=qs[_0xbf1d('0x28')](_0x395ee5[_0xbf1d('0x29')]);return db[_0xbf1d('0x27')][_0xbf1d('0x2a')](_0x8dc2ec);})[_0xbf1d('0x19')](function(_0x7dafef){_0x4305d8['rows']=_0x7dafef;return _0x4305d8;})[_0xbf1d('0x19')](respondWithFilteredResult(_0x42d10e,_0x8dc2ec))[_0xbf1d('0x2b')](handleError(_0x42d10e,null));};exports[_0xbf1d('0x2c')]=function(_0x378f38,_0xb69307){var _0x168c88={'raw':!![],'where':{'id':_0x378f38['params']['id']}},_0x298731={};_0x298731['model']=_['keys'](db[_0xbf1d('0x27')]['rawAttributes']);_0x298731[_0xbf1d('0x29')]=_[_0xbf1d('0x2d')](_0x378f38[_0xbf1d('0x29')]);_0x298731[_0xbf1d('0x2e')]=_[_0xbf1d('0x2f')](_0x298731[_0xbf1d('0x30')],_0x298731[_0xbf1d('0x29')]);_0x168c88[_0xbf1d('0x31')]=_[_0xbf1d('0x2f')](_0x298731[_0xbf1d('0x30')],qs[_0xbf1d('0x32')](_0x378f38[_0xbf1d('0x29')][_0xbf1d('0x32')]));_0x168c88[_0xbf1d('0x31')]=_0x168c88[_0xbf1d('0x31')][_0xbf1d('0x33')]?_0x168c88[_0xbf1d('0x31')]:_0x298731['model'];if(_0x378f38[_0xbf1d('0x29')]['includeAll']){_0x168c88[_0xbf1d('0x28')]=[{'all':!![]}];}_0x168c88=_['merge']({},_0x168c88,_0x378f38['options']);return db['OpenchannelQueue']['find'](_0x168c88)[_0xbf1d('0x19')](handleEntityNotFound(_0xb69307,null))[_0xbf1d('0x19')](respondWithResult(_0xb69307,null))[_0xbf1d('0x2b')](handleError(_0xb69307,null));};exports[_0xbf1d('0x34')]=function(_0x4f68b6,_0x31b5b6){return db['OpenchannelQueue'][_0xbf1d('0x34')](_0x4f68b6[_0xbf1d('0x35')],{})[_0xbf1d('0x19')](function(_0x2894d1){var _0x54bbc4=_0x4f68b6['user']['get']({'plain':!![]});if(!_0x54bbc4)throw new Error(_0xbf1d('0x36'));if(_0x54bbc4[_0xbf1d('0x37')]==='user'){var _0x5a2b74=_0x2894d1[_0xbf1d('0x1b')]({'plain':!![]});var _0x2be319='OpenchannelQueues';return db[_0xbf1d('0x38')][_0xbf1d('0x39')]({'where':{'name':_0x2be319,'userProfileId':_0x54bbc4['userProfileId']},'raw':!![]})[_0xbf1d('0x19')](function(_0x57c018){if(_0x57c018&&_0x57c018[_0xbf1d('0x3a')]===0x0){return db[_0xbf1d('0x1d')]['create']({'name':_0x5a2b74[_0xbf1d('0x1f')],'resourceId':_0x5a2b74['id'],'type':_0x57c018[_0xbf1d('0x1f')],'sectionId':_0x57c018['id']},{})[_0xbf1d('0x19')](function(){return _0x2894d1;});}else{return _0x2894d1;}})['catch'](function(_0x3b89ff){logger[_0xbf1d('0x1e')](_0xbf1d('0x3b'),_0x3b89ff);throw _0x3b89ff;});}return _0x2894d1;})[_0xbf1d('0x19')](respondWithResult(_0x31b5b6,0xc9))['catch'](handleError(_0x31b5b6,null));};exports[_0xbf1d('0x18')]=function(_0x51d02a,_0x1fdac5){if(_0x51d02a['body']['id']){delete _0x51d02a[_0xbf1d('0x35')]['id'];}return db[_0xbf1d('0x27')][_0xbf1d('0x39')]({'where':{'id':_0x51d02a[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x1fdac5,null))[_0xbf1d('0x19')](saveUpdates(_0x51d02a['body'],null))[_0xbf1d('0x19')](respondWithResult(_0x1fdac5,null))[_0xbf1d('0x2b')](handleError(_0x1fdac5,null));};exports[_0xbf1d('0x1a')]=function(_0x1429d9,_0x5661ac){return db[_0xbf1d('0x27')][_0xbf1d('0x39')]({'where':{'id':_0x1429d9[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x5661ac,null))['then'](removeEntity(_0x5661ac,null))[_0xbf1d('0x2b')](handleError(_0x5661ac,null));};exports[_0xbf1d('0x3d')]=function(_0x37497d,_0x3915bc){return db[_0xbf1d('0x27')]['describe']()[_0xbf1d('0x19')](respondWithResult(_0x3915bc,null))[_0xbf1d('0x2b')](handleError(_0x3915bc,null));};exports['getMembers']=function(_0x4bcf0a,_0x3cb279){var _0x57a53b={'raw':!![],'where':{}},_0x5f5c23={},_0x3555a6;return db[_0xbf1d('0x27')][_0xbf1d('0x3e')]({'where':{'id':_0x4bcf0a[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x3cb279,null))[_0xbf1d('0x19')](function(_0x31fa41){if(_0x31fa41){_0x3555a6=_0x31fa41['get']({'plain':!![]});_0x5f5c23['model']=_[_0xbf1d('0x2d')](db[_0xbf1d('0x3f')][_0xbf1d('0x21')]);_0x5f5c23[_0xbf1d('0x29')]=_[_0xbf1d('0x2d')](_0x4bcf0a[_0xbf1d('0x29')]);_0x5f5c23[_0xbf1d('0x2e')]=_[_0xbf1d('0x2f')](_0x5f5c23[_0xbf1d('0x30')],_0x5f5c23['query']);_0x57a53b[_0xbf1d('0x31')]=_[_0xbf1d('0x2f')](_0x5f5c23[_0xbf1d('0x30')],qs[_0xbf1d('0x32')](_0x4bcf0a['query'][_0xbf1d('0x32')]));_0x57a53b[_0xbf1d('0x31')]=_0x57a53b['attributes'][_0xbf1d('0x33')]?_0x57a53b[_0xbf1d('0x31')]:_0x5f5c23[_0xbf1d('0x30')];if(!_0x4bcf0a[_0xbf1d('0x29')][_0xbf1d('0x40')]('nolimit')){_0x57a53b['limit']=qs['limit'](_0x4bcf0a[_0xbf1d('0x29')]['limit']);_0x57a53b[_0xbf1d('0x12')]=qs['offset'](_0x4bcf0a[_0xbf1d('0x29')][_0xbf1d('0x12')]);}_0x57a53b[_0xbf1d('0x41')]=qs['sort'](_0x4bcf0a[_0xbf1d('0x29')][_0xbf1d('0x42')]);_0x57a53b[_0xbf1d('0x26')]=qs[_0xbf1d('0x2e')](_[_0xbf1d('0x43')](_0x4bcf0a[_0xbf1d('0x29')],_0x5f5c23['filters']));_0x57a53b[_0xbf1d('0x26')][_0xbf1d('0x44')]=_0x31fa41['id'];if(_0x4bcf0a['query'][_0xbf1d('0x45')]){_0x57a53b[_0xbf1d('0x26')]=_[_0xbf1d('0x46')](_0x57a53b[_0xbf1d('0x26')],{'$or':_[_0xbf1d('0x20')](_0x57a53b[_0xbf1d('0x31')],function(_0x4a0bfe){var _0x25b457={};_0x25b457[_0x4a0bfe]={'$like':'%'+_0x4bcf0a[_0xbf1d('0x29')][_0xbf1d('0x45')]+'%'};return _0x25b457;})});}_0x57a53b=_[_0xbf1d('0x46')]({},_0x57a53b,_0x4bcf0a[_0xbf1d('0x47')]);return db['UserOpenchannelQueue'][_0xbf1d('0x2a')](_0x57a53b);}})[_0xbf1d('0x19')](function(_0x5eaf3c){if(_0x5eaf3c){return db[_0xbf1d('0x48')][_0xbf1d('0x49')]({'where':{'id':_[_0xbf1d('0x20')](_0x5eaf3c,'UserId'),'role':_0xbf1d('0x4a')},'attributes':['id','name',_0xbf1d('0x4b'),_0xbf1d('0x4c'),_0xbf1d('0x4d')]});}})[_0xbf1d('0x19')](function(_0x45691e){if(_0x45691e){return{'count':_0x45691e[_0xbf1d('0x14')],'rows':_[_0xbf1d('0x20')](_0x45691e[_0xbf1d('0x4e')],function(_0x18f732){return{'membername':_0x18f732[_0xbf1d('0x1f')],'UserId':_0x18f732['id'],'queue_name':_0x3555a6['name'],'OpenchannelQueueId':_0x3555a6['id'],'interface':util['format']('%s/%s',_0xbf1d('0x4f'),_0x18f732[_0xbf1d('0x1f')]),'penalty':0x0,'paused':_0x18f732[_0xbf1d('0x4b')],'createdAt':_0x18f732['createdAt'],'updatedAt':_0x18f732[_0xbf1d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf1d('0x19')](respondWithFilteredResult(_0x3cb279,_0x57a53b))['catch'](handleError(_0x3cb279,null));};exports[_0xbf1d('0x50')]=function(_0x2dc41c,_0x51221a){var _0x270d6b={};var _0x582db7={};var _0x7ee8f;var _0x3132e9;return db[_0xbf1d('0x27')][_0xbf1d('0x3e')]({'where':{'id':_0x2dc41c[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x51221a,null))['then'](function(_0x5870ac){if(_0x5870ac){_0x7ee8f=_0x5870ac;_0x582db7[_0xbf1d('0x30')]=_['keys'](db[_0xbf1d('0x51')][_0xbf1d('0x21')]);_0x582db7[_0xbf1d('0x29')]=_[_0xbf1d('0x2d')](_0x2dc41c[_0xbf1d('0x29')]);_0x582db7[_0xbf1d('0x2e')]=_['intersection'](_0x582db7[_0xbf1d('0x30')],_0x582db7[_0xbf1d('0x29')]);_0x270d6b[_0xbf1d('0x31')]=_[_0xbf1d('0x2f')](_0x582db7[_0xbf1d('0x30')],qs[_0xbf1d('0x32')](_0x2dc41c['query'][_0xbf1d('0x32')]));_0x270d6b['attributes']=_0x270d6b[_0xbf1d('0x31')][_0xbf1d('0x33')]?_0x270d6b[_0xbf1d('0x31')]:_0x582db7[_0xbf1d('0x30')];_0x270d6b[_0xbf1d('0x41')]=qs['sort'](_0x2dc41c[_0xbf1d('0x29')][_0xbf1d('0x42')]);_0x270d6b[_0xbf1d('0x26')]=qs['filters'](_['pick'](_0x2dc41c[_0xbf1d('0x29')],_0x582db7[_0xbf1d('0x2e')]));if(_0x2dc41c['query'][_0xbf1d('0x45')]){_0x270d6b[_0xbf1d('0x26')]=_[_0xbf1d('0x46')](_0x270d6b[_0xbf1d('0x26')],{'$or':_[_0xbf1d('0x20')](_0x270d6b[_0xbf1d('0x31')],function(_0x25ccc9){var _0x7a37bd={};_0x7a37bd[_0x25ccc9]={'$like':'%'+_0x2dc41c['query'][_0xbf1d('0x45')]+'%'};return _0x7a37bd;})});}_0x270d6b=_[_0xbf1d('0x46')]({},_0x270d6b,_0x2dc41c[_0xbf1d('0x47')]);return _0x7ee8f[_0xbf1d('0x50')](_0x270d6b);}})['then'](function(_0x117b88){if(_0x117b88){_0x3132e9=_0x117b88[_0xbf1d('0x33')];if(!_0x2dc41c[_0xbf1d('0x29')][_0xbf1d('0x40')](_0xbf1d('0x52'))){_0x270d6b['limit']=qs['limit'](_0x2dc41c[_0xbf1d('0x29')][_0xbf1d('0x15')]);_0x270d6b[_0xbf1d('0x12')]=qs[_0xbf1d('0x12')](_0x2dc41c['query'][_0xbf1d('0x12')]);}return _0x7ee8f[_0xbf1d('0x50')](_0x270d6b);}})['then'](function(_0x507ffa){if(_0x507ffa){return _0x507ffa?{'count':_0x3132e9,'rows':_0x507ffa}:null;}})[_0xbf1d('0x19')](respondWithResult(_0x51221a,null))[_0xbf1d('0x2b')](handleError(_0x51221a,null));};exports['addTeams']=function(_0x1a3b85,_0x592311){var _0x31f944=_0x1a3b85[_0xbf1d('0x35')][_0xbf1d('0x53')];return db['Team'][_0xbf1d('0x2a')]({'where':{'id':_0x31f944},'attributes':['id'],'include':[{'model':db[_0xbf1d('0x48')],'as':'Agents','attributes':['id',_0xbf1d('0x1f'),_0xbf1d('0x54'),'voicePause',_0xbf1d('0x55')],'raw':!![]}]})[_0xbf1d('0x19')](function(_0x5bdd47){if(_0x5bdd47){var _0x129a00=_[_0xbf1d('0x56')](_0x5bdd47,function(_0x1561f1){var _0x409d27=_0x1561f1[_0xbf1d('0x1b')]({'plain':!![]});return _0x409d27[_0xbf1d('0x57')];});return db['OpenchannelQueue'][_0xbf1d('0x39')]({'where':{'id':_0x1a3b85[_0xbf1d('0x3c')]['id']}})['then'](function(_0x30b108){return db[_0xbf1d('0x58')][_0xbf1d('0x59')](function(_0x5aca91){return _0x30b108[_0xbf1d('0x5a')](_0x31f944,{'transaction':_0x5aca91})[_0xbf1d('0x19')](function(){return BPromise[_0xbf1d('0x5b')](_0x129a00,function(_0x12b0d2){return db[_0xbf1d('0x3f')]['findOrCreate']({'where':{'UserId':_0x12b0d2['id'],'OpenchannelQueueId':_0x1a3b85[_0xbf1d('0x3c')]['id']},'transaction':_0x5aca91});});})[_0xbf1d('0x19')](function(){_0x129a00[_0xbf1d('0x5c')](function(_0x267e52){socket[_0xbf1d('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x267e52['id'],'OpenchannelQueueId':_0x30b108['id']});});});});});}})[_0xbf1d('0x19')](respondWithStatusCode(_0x592311,null))[_0xbf1d('0x2b')](handleError(_0x592311,null));};exports[_0xbf1d('0x5e')]=function(_0x1df594,_0x4ced99){return db[_0xbf1d('0x51')][_0xbf1d('0x2a')]({'where':{'id':_0x1df594['query'][_0xbf1d('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbf1d('0x57'),'attributes':['id'],'raw':!![]}]})[_0xbf1d('0x19')](handleEntityNotFound(_0x4ced99,null))[_0xbf1d('0x19')](function(_0x4b2c28){var _0x3330d6=_[_0xbf1d('0x20')](_0x4b2c28,'id');var _0x5bd2d6=[];var _0x4ff40e=[];var _0x2c295f=squel[_0xbf1d('0x5f')]();_0x2c295f['field']('tq.TeamId')[_0xbf1d('0x60')](_0xbf1d('0x61'),'tq')[_0xbf1d('0x62')](_0xbf1d('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbf1d('0x26')]('OpenchannelQueueId\x20=\x20?',_0x1df594[_0xbf1d('0x3c')]['id']);for(var _0x196f2e=0x0;_0x196f2e<_0x4b2c28['length'];_0x196f2e+=0x1){let _0x132090=_0x4b2c28[_0x196f2e];for(var _0x5f49f1=0x0;_0x5f49f1<_0x132090['Agents'][_0xbf1d('0x33')];_0x5f49f1+=0x1){let _0x103341=_0x132090[_0xbf1d('0x57')][_0x5f49f1];var _0x148528=_0x2c295f['clone']();_0x148528[_0xbf1d('0x26')](_0xbf1d('0x64'),_0x103341['id']);_0x4ff40e[_0xbf1d('0x65')](db[_0xbf1d('0x58')][_0xbf1d('0x29')](_0x148528[_0xbf1d('0x66')](),{'type':db[_0xbf1d('0x58')][_0xbf1d('0x67')]['SELECT']})[_0xbf1d('0x19')](function(_0x6f7a58){if(_0x6f7a58[_0xbf1d('0x33')]===0x1){return _0x103341['id'];}else{var _0x1ee0fd=_[_0xbf1d('0x68')](_[_0xbf1d('0x20')](_0x6f7a58,_0xbf1d('0x69')),function(_0x3dcaf8){return _[_0xbf1d('0x6a')](_0x3330d6,_0x3dcaf8);});if(_0x1ee0fd){return _0x103341['id'];}}}));}}return BPromise[_0xbf1d('0x6b')](_0x4ff40e)['then'](function(_0x3ae240){_0x5bd2d6=_(_0x5bd2d6)[_0xbf1d('0x6c')](_0x3ae240)[_0xbf1d('0x6d')]()[_0xbf1d('0x6e')]();return db['OpenchannelQueue'][_0xbf1d('0x39')]({'where':{'id':_0x1df594[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](function(_0x2d7763){return db[_0xbf1d('0x58')][_0xbf1d('0x59')](function(_0x2e8b4f){return _0x2d7763['removeTeams'](_0x1df594[_0xbf1d('0x29')][_0xbf1d('0x53')],{'transaction':_0x2e8b4f})[_0xbf1d('0x19')](function(){if(!_['isEmpty'](_0x5bd2d6)){return _0x2d7763[_0xbf1d('0x6f')](_0x5bd2d6,{'transaction':_0x2e8b4f});}})[_0xbf1d('0x19')](function(){_0x5bd2d6[_0xbf1d('0x5c')](function(_0x497548){socket[_0xbf1d('0x5d')]('userOpenchannelQueue:remove',{'UserId':_0x497548,'OpenchannelQueueId':_0x2d7763['id']});});});});});});})[_0xbf1d('0x19')](respondWithStatusCode(_0x4ced99,null))['catch'](handleError(_0x4ced99,null));};exports['addAgents']=function(_0x355907,_0x42a6a1){return db['OpenchannelQueue']['find']({'where':{'id':_0x355907[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x42a6a1,null))[_0xbf1d('0x19')](function(_0x2ae11e){if(_0x2ae11e){return _0x2ae11e[_0xbf1d('0x70')](_0x355907['body'][_0xbf1d('0x53')],_[_0xbf1d('0x71')](_0x355907[_0xbf1d('0x35')],[_0xbf1d('0x53'),'id'])||{})[_0xbf1d('0x72')](function(_0xb8d953){for(var _0x2485bf=0x0;_0x2485bf<_0x355907[_0xbf1d('0x35')][_0xbf1d('0x53')][_0xbf1d('0x33')];_0x2485bf+=0x1){socket[_0xbf1d('0x5d')](_0xbf1d('0x73'),{'UserId':Number(_0x355907[_0xbf1d('0x35')][_0xbf1d('0x53')][_0x2485bf]),'OpenchannelQueueId':Number(_0x355907[_0xbf1d('0x3c')]['id'])});}return _0xb8d953;});}})['then'](respondWithResult(_0x42a6a1,null))[_0xbf1d('0x2b')](handleError(_0x42a6a1,null));};exports[_0xbf1d('0x6f')]=function(_0x5e9de2,_0x3f8f31){return db[_0xbf1d('0x27')][_0xbf1d('0x39')]({'where':{'id':_0x5e9de2[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x3f8f31,null))[_0xbf1d('0x19')](function(_0x36c290){if(_0x36c290){return _0x36c290['removeAgents'](_0x5e9de2[_0xbf1d('0x29')][_0xbf1d('0x53')])['then'](function(){if(_['isArray'](_0x5e9de2[_0xbf1d('0x29')]['ids'])){for(var _0x497643=0x0;_0x497643<_0x5e9de2['query'][_0xbf1d('0x53')][_0xbf1d('0x33')];_0x497643+=0x1){socket[_0xbf1d('0x5d')](_0xbf1d('0x74'),{'UserId':Number(_0x5e9de2[_0xbf1d('0x29')][_0xbf1d('0x53')][_0x497643]),'OpenchannelQueueId':Number(_0x5e9de2[_0xbf1d('0x3c')]['id'])});}}else{socket[_0xbf1d('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5e9de2['query'][_0xbf1d('0x53')]),'OpenchannelQueueId':Number(_0x5e9de2[_0xbf1d('0x3c')]['id'])});}});}})[_0xbf1d('0x19')](respondWithStatusCode(_0x3f8f31,null))[_0xbf1d('0x2b')](handleError(_0x3f8f31,null));};exports[_0xbf1d('0x75')]=function(_0x21baf7,_0x16d150){var _0x35c8ad={};var _0x4d2930={};var _0x327438;var _0x56ebd6;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x21baf7[_0xbf1d('0x3c')]['id']}})[_0xbf1d('0x19')](handleEntityNotFound(_0x16d150,null))['then'](function(_0x2f6063){if(_0x2f6063){_0x327438=_0x2f6063;_0x4d2930[_0xbf1d('0x30')]=_['keys'](db[_0xbf1d('0x48')][_0xbf1d('0x21')]);_0x4d2930[_0xbf1d('0x29')]=_['keys'](_0x21baf7[_0xbf1d('0x29')]);_0x4d2930[_0xbf1d('0x2e')]=_[_0xbf1d('0x2f')](_0x4d2930[_0xbf1d('0x30')],_0x4d2930[_0xbf1d('0x29')]);_0x35c8ad['attributes']=_[_0xbf1d('0x2f')](_0x4d2930['model'],qs[_0xbf1d('0x32')](_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x32')]));_0x35c8ad[_0xbf1d('0x31')]=_0x35c8ad[_0xbf1d('0x31')][_0xbf1d('0x33')]?_0x35c8ad['attributes']:_0x4d2930[_0xbf1d('0x30')];_0x35c8ad[_0xbf1d('0x41')]=qs[_0xbf1d('0x42')](_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x42')]);_0x35c8ad['where']=qs[_0xbf1d('0x2e')](_['pick'](_0x21baf7['query'],_0x4d2930[_0xbf1d('0x2e')]));if(_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x45')]){_0x35c8ad[_0xbf1d('0x26')]=_['merge'](_0x35c8ad[_0xbf1d('0x26')],{'$or':_[_0xbf1d('0x20')](_0x35c8ad[_0xbf1d('0x31')],function(_0x3c6510){var _0x26cc9b={};_0x26cc9b[_0x3c6510]={'$like':'%'+_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x45')]+'%'};return _0x26cc9b;})});}_0x35c8ad=_[_0xbf1d('0x46')]({},_0x35c8ad,_0x21baf7[_0xbf1d('0x47')]);return _0x327438[_0xbf1d('0x75')](_0x35c8ad);}})['then'](function(_0x4dffdc){if(_0x4dffdc){_0x56ebd6=_0x4dffdc['length'];if(!_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x40')]('nolimit')){_0x35c8ad[_0xbf1d('0x15')]=qs['limit'](_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x15')]);_0x35c8ad['offset']=qs['offset'](_0x21baf7[_0xbf1d('0x29')][_0xbf1d('0x12')]);}return _0x327438[_0xbf1d('0x75')](_0x35c8ad);}})[_0xbf1d('0x19')](function(_0x48b929){if(_0x48b929){return _0x48b929?{'count':_0x56ebd6,'rows':_0x48b929}:null;}})[_0xbf1d('0x19')](respondWithResult(_0x16d150,null))[_0xbf1d('0x2b')](handleError(_0x16d150,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index fc905cb..82df6d5 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 _0xa4dc=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x472b43,_0x542745){var _0x483774=function(_0x4eb348){while(--_0x4eb348){_0x472b43['push'](_0x472b43['shift']());}};_0x483774(++_0x542745);}(_0xa4dc,0xe2));var _0xca4d=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa4dc[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require(_0xca4d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xca4d('0x1')](0x0);var events={'afterCreate':_0xca4d('0x2'),'afterUpdate':'update','afterDestroy':_0xca4d('0x3')};function emitEvent(_0x39b077){return function(_0xd55e6,_0x83e168,_0x360098){OpenchannelQueueEvents[_0xca4d('0x4')](_0x39b077+':'+_0xd55e6['id'],_0xd55e6);OpenchannelQueueEvents['emit'](_0x39b077,_0xd55e6);_0x360098(null);};}for(var e in events){if(events[_0xca4d('0x5')](e)){var event=events[e];OpenchannelQueue[_0xca4d('0x6')](e,emitEvent(event));}}module[_0xca4d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x19b5=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x2e3274,_0x9d586a){var _0x567f0d=function(_0x29d1da){while(--_0x29d1da){_0x2e3274['push'](_0x2e3274['shift']());}};_0x567f0d(++_0x9d586a);}(_0x19b5,0xcc));var _0x519b=function(_0x4b988f,_0x20870e){_0x4b988f=_0x4b988f-0x0;var _0x1334c8=_0x19b5[_0x4b988f];return _0x1334c8;};'use strict';var EventEmitter=require(_0x519b('0x0'));var OpenchannelQueue=require(_0x519b('0x1'))['db'][_0x519b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x519b('0x3')](0x0);var events={'afterCreate':_0x519b('0x4'),'afterUpdate':_0x519b('0x5'),'afterDestroy':_0x519b('0x6')};function emitEvent(_0x45741a){return function(_0x56a351,_0x576499,_0x4db545){OpenchannelQueueEvents[_0x519b('0x7')](_0x45741a+':'+_0x56a351['id'],_0x56a351);OpenchannelQueueEvents[_0x519b('0x7')](_0x45741a,_0x56a351);_0x4db545(null);};}for(var e in events){if(events[_0x519b('0x8')](e)){var event=events[e];OpenchannelQueue[_0x519b('0x9')](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 32c758d..6e7cff0 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 _0xec65=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','openchannel_queues','lodash','util','api'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xec65,0x11b));var _0x5ec6=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xec65[_0x249d99];return _0x5bfb05;};'use strict';var _=require(_0x5ec6('0x0'));var util=require(_0x5ec6('0x1'));var logger=require('../../config/logger')(_0x5ec6('0x2'));var moment=require(_0x5ec6('0x3'));var BPromise=require(_0x5ec6('0x4'));var rp=require(_0x5ec6('0x5'));var fs=require('fs');var path=require(_0x5ec6('0x6'));var rimraf=require(_0x5ec6('0x7'));var config=require(_0x5ec6('0x8'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x569a7b,_0xd8994){return _0x569a7b[_0x5ec6('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x5ec6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0313=['request-promise','path','rimraf','exports','define','OpenchannelQueue','openchannel_queues','lodash','api','moment','bluebird'];(function(_0xa1e977,_0x60ee90){var _0x18323a=function(_0x12a0e5){while(--_0x12a0e5){_0xa1e977['push'](_0xa1e977['shift']());}};_0x18323a(++_0x60ee90);}(_0x0313,0xac));var _0x3031=function(_0xa22707,_0x446764){_0xa22707=_0xa22707-0x0;var _0x84b8f1=_0x0313[_0xa22707];return _0x84b8f1;};'use strict';var _=require(_0x3031('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3031('0x1'));var moment=require(_0x3031('0x2'));var BPromise=require(_0x3031('0x3'));var rp=require(_0x3031('0x4'));var fs=require('fs');var path=require(_0x3031('0x5'));var rimraf=require(_0x3031('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x3031('0x7')]=function(_0x464ebf,_0x3a256f){return _0x464ebf[_0x3031('0x8')](_0x3031('0x9'),attributes,{'tableName':_0x3031('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 28f5be6..3744764 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 _0x5f9f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','util','randomstring'];(function(_0x2f225c,_0x465b58){var _0x40470f=function(_0x4cc378){while(--_0x4cc378){_0x2f225c['push'](_0x2f225c['shift']());}};_0x40470f(++_0x465b58);}(_0x5f9f,0xa6));var _0xf5f9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5f9f[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0xf5f9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf5f9('0x1'));var fs=require('fs');var Redis=require(_0xf5f9('0x2'));var db=require(_0xf5f9('0x3'))['db'];var utils=require(_0xf5f9('0x4'));var logger=require(_0xf5f9('0x5'))(_0xf5f9('0x6'));var config=require(_0xf5f9('0x7'));var jayson=require(_0xf5f9('0x8'));var client=jayson[_0xf5f9('0x9')][_0xf5f9('0xa')]({'port':0x232a});config['redis']=_[_0xf5f9('0xb')](config[_0xf5f9('0xc')],{'host':_0xf5f9('0xd'),'port':0x18eb});var socket=require(_0xf5f9('0xe'))(new Redis(config['redis']));require(_0xf5f9('0xf'))[_0xf5f9('0x10')](socket);function respondWithRpcPromise(_0x4364aa,_0x484406,_0x324b32){return new BPromise(function(_0xea0b39,_0x312602){return client['request'](_0x4364aa,_0x324b32)['then'](function(_0x176647){logger[_0xf5f9('0x11')](_0xf5f9('0x12'),_0x484406,_0xf5f9('0x13'));logger['debug'](_0xf5f9('0x14'),_0x484406,'request\x20sent',JSON[_0xf5f9('0x15')](_0x176647));if(_0x176647[_0xf5f9('0x16')]){if(_0x176647[_0xf5f9('0x16')][_0xf5f9('0x17')]===0x1f4){logger[_0xf5f9('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x484406,_0x176647[_0xf5f9('0x16')]['message']);return _0x312602(_0x176647[_0xf5f9('0x16')][_0xf5f9('0x18')]);}logger['error'](_0xf5f9('0x12'),_0x484406,_0x176647[_0xf5f9('0x16')][_0xf5f9('0x18')]);return _0xea0b39(_0x176647['error'][_0xf5f9('0x18')]);}else{logger[_0xf5f9('0x11')](_0xf5f9('0x12'),_0x484406,_0xf5f9('0x13'));_0xea0b39(_0x176647[_0xf5f9('0x19')][_0xf5f9('0x18')]);}})[_0xf5f9('0x1a')](function(_0x376faf){logger[_0xf5f9('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x484406,_0x376faf);_0x312602(_0x376faf);});});}exports['GetOpenchannelQueue']=function(_0x200b11){var _0x45a3b3=this;return new Promise(function(_0x182f42,_0x3debe6){return db[_0xf5f9('0x1b')][_0xf5f9('0x1c')]({'raw':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x1f')]||null:null,'attributes':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x20')]||null:null,'limit':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x21')]||null:null,'include':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x22')],function(_0x5304c3){return{'model':db[_0x5304c3[_0xf5f9('0x24')]],'as':_0x5304c3['as'],'attributes':_0x5304c3[_0xf5f9('0x20')],'include':_0x5304c3[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x5304c3[_0xf5f9('0x22')],function(_0x5636b1){return{'model':db[_0x5636b1['model']],'as':_0x5636b1['as'],'attributes':_0x5636b1[_0xf5f9('0x20')],'include':_0x5636b1[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x5636b1['include'],function(_0x182259){return{'model':db[_0x182259[_0xf5f9('0x24')]],'as':_0x182259['as'],'attributes':_0x182259[_0xf5f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f9('0x25')](function(_0x13e52a){logger[_0xf5f9('0x11')](_0xf5f9('0x26'),_0x200b11);logger[_0xf5f9('0x27')](_0xf5f9('0x26'),_0x200b11,JSON['stringify'](_0x13e52a));_0x182f42(_0x13e52a);})['catch'](function(_0x38aae9){logger[_0xf5f9('0x16')](_0xf5f9('0x26'),_0x38aae9[_0xf5f9('0x18')],_0x200b11);_0x3debe6(_0x45a3b3[_0xf5f9('0x16')](0x1f4,_0x38aae9[_0xf5f9('0x18')]));});});};exports[_0xf5f9('0x28')]=function(_0x10341b){var _0x22f848=this;return new Promise(function(_0x142b21,_0x37e3ef){return db['OpenchannelQueue'][_0xf5f9('0x29')]({'raw':_0x10341b['options']?_0x10341b[_0xf5f9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10341b[_0xf5f9('0x1d')]?_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x1f')]||null:null,'attributes':_0x10341b[_0xf5f9('0x1d')]?_0x10341b['options']['attributes']||null:null,'include':_0x10341b['options']?_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x22')]?_['map'](_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x22')],function(_0x484029){return{'model':db[_0x484029[_0xf5f9('0x24')]],'as':_0x484029['as'],'attributes':_0x484029[_0xf5f9('0x20')],'include':_0x484029[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x484029[_0xf5f9('0x22')],function(_0x5dd51b){return{'model':db[_0x5dd51b[_0xf5f9('0x24')]],'as':_0x5dd51b['as'],'attributes':_0x5dd51b[_0xf5f9('0x20')],'include':_0x5dd51b[_0xf5f9('0x22')]?_['map'](_0x5dd51b[_0xf5f9('0x22')],function(_0xd0d420){return{'model':db[_0xd0d420['model']],'as':_0xd0d420['as'],'attributes':_0xd0d420[_0xf5f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f9('0x25')](function(_0xcfbeaa){logger[_0xf5f9('0x11')](_0xf5f9('0x28'),_0x10341b);logger[_0xf5f9('0x27')]('ShowOpenchannelQueue',_0x10341b,JSON[_0xf5f9('0x15')](_0xcfbeaa));_0x142b21(_0xcfbeaa);})['catch'](function(_0x57d6e5){logger[_0xf5f9('0x16')](_0xf5f9('0x28'),_0x57d6e5[_0xf5f9('0x18')],_0x10341b);_0x37e3ef(_0x22f848[_0xf5f9('0x16')](0x1f4,_0x57d6e5[_0xf5f9('0x18')]));});});}; \ No newline at end of file +var _0xe96e=['localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','options','raw','where','attributes','limit','map','include','model','find','ShowOpenchannelQueue','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe96e,0x183));var _0xee96=function(_0x463461,_0x357458){_0x463461=_0x463461-0x0;var _0x50e103=_0xe96e[_0x463461];return _0x50e103;};'use strict';var _=require(_0xee96('0x0'));var util=require('util');var moment=require(_0xee96('0x1'));var BPromise=require('bluebird');var rs=require(_0xee96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee96('0x3'))['db'];var utils=require(_0xee96('0x4'));var logger=require(_0xee96('0x5'))(_0xee96('0x6'));var config=require(_0xee96('0x7'));var jayson=require(_0xee96('0x8'));var client=jayson[_0xee96('0x9')][_0xee96('0xa')]({'port':0x232a});config[_0xee96('0xb')]=_[_0xee96('0xc')](config[_0xee96('0xb')],{'host':_0xee96('0xd'),'port':0x18eb});var socket=require(_0xee96('0xe'))(new Redis(config['redis']));require(_0xee96('0xf'))[_0xee96('0x10')](socket);function respondWithRpcPromise(_0x367306,_0x20c1e,_0x2325c4){return new BPromise(function(_0x1f91c0,_0x409fbe){return client[_0xee96('0x11')](_0x367306,_0x2325c4)[_0xee96('0x12')](function(_0x199d5f){logger[_0xee96('0x13')](_0xee96('0x14'),_0x20c1e,_0xee96('0x15'));logger[_0xee96('0x16')](_0xee96('0x17'),_0x20c1e,_0xee96('0x15'),JSON[_0xee96('0x18')](_0x199d5f));if(_0x199d5f['error']){if(_0x199d5f[_0xee96('0x19')][_0xee96('0x1a')]===0x1f4){logger['error'](_0xee96('0x14'),_0x20c1e,_0x199d5f[_0xee96('0x19')][_0xee96('0x1b')]);return _0x409fbe(_0x199d5f[_0xee96('0x19')][_0xee96('0x1b')]);}logger[_0xee96('0x19')](_0xee96('0x14'),_0x20c1e,_0x199d5f[_0xee96('0x19')][_0xee96('0x1b')]);return _0x1f91c0(_0x199d5f['error'][_0xee96('0x1b')]);}else{logger[_0xee96('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x20c1e,_0xee96('0x15'));_0x1f91c0(_0x199d5f['result']['message']);}})[_0xee96('0x1c')](function(_0x2448de){logger['error'](_0xee96('0x14'),_0x20c1e,_0x2448de);_0x409fbe(_0x2448de);});});}exports[_0xee96('0x1d')]=function(_0xf63558){var _0x40ebf2=this;return new Promise(function(_0x366fd3,_0xc371dc){return db['OpenchannelQueue']['findAll']({'raw':_0xf63558[_0xee96('0x1e')]?_0xf63558[_0xee96('0x1e')][_0xee96('0x1f')]===undefined?!![]:![]:!![],'where':_0xf63558[_0xee96('0x1e')]?_0xf63558[_0xee96('0x1e')][_0xee96('0x20')]||null:null,'attributes':_0xf63558[_0xee96('0x1e')]?_0xf63558[_0xee96('0x1e')][_0xee96('0x21')]||null:null,'limit':_0xf63558[_0xee96('0x1e')]?_0xf63558[_0xee96('0x1e')][_0xee96('0x22')]||null:null,'include':_0xf63558[_0xee96('0x1e')]?_0xf63558[_0xee96('0x1e')]['include']?_[_0xee96('0x23')](_0xf63558[_0xee96('0x1e')][_0xee96('0x24')],function(_0x28b97c){return{'model':db[_0x28b97c[_0xee96('0x25')]],'as':_0x28b97c['as'],'attributes':_0x28b97c[_0xee96('0x21')],'include':_0x28b97c['include']?_['map'](_0x28b97c[_0xee96('0x24')],function(_0x5c65d2){return{'model':db[_0x5c65d2['model']],'as':_0x5c65d2['as'],'attributes':_0x5c65d2[_0xee96('0x21')],'include':_0x5c65d2[_0xee96('0x24')]?_[_0xee96('0x23')](_0x5c65d2['include'],function(_0x367c84){return{'model':db[_0x367c84[_0xee96('0x25')]],'as':_0x367c84['as'],'attributes':_0x367c84[_0xee96('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aaf2f){logger[_0xee96('0x13')]('GetOpenchannelQueue',_0xf63558);logger['debug'](_0xee96('0x1d'),_0xf63558,JSON['stringify'](_0x2aaf2f));_0x366fd3(_0x2aaf2f);})['catch'](function(_0x3e75f6){logger['error']('GetOpenchannelQueue',_0x3e75f6[_0xee96('0x1b')],_0xf63558);_0xc371dc(_0x40ebf2[_0xee96('0x19')](0x1f4,_0x3e75f6[_0xee96('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x1571b2){var _0x5d6a37=this;return new Promise(function(_0x1a481b,_0x59dde9){return db['OpenchannelQueue'][_0xee96('0x26')]({'raw':_0x1571b2[_0xee96('0x1e')]?_0x1571b2[_0xee96('0x1e')][_0xee96('0x1f')]===undefined?!![]:![]:!![],'where':_0x1571b2[_0xee96('0x1e')]?_0x1571b2[_0xee96('0x1e')][_0xee96('0x20')]||null:null,'attributes':_0x1571b2[_0xee96('0x1e')]?_0x1571b2[_0xee96('0x1e')][_0xee96('0x21')]||null:null,'include':_0x1571b2[_0xee96('0x1e')]?_0x1571b2[_0xee96('0x1e')][_0xee96('0x24')]?_[_0xee96('0x23')](_0x1571b2[_0xee96('0x1e')][_0xee96('0x24')],function(_0x16ed33){return{'model':db[_0x16ed33['model']],'as':_0x16ed33['as'],'attributes':_0x16ed33[_0xee96('0x21')],'include':_0x16ed33['include']?_[_0xee96('0x23')](_0x16ed33[_0xee96('0x24')],function(_0xb6ce25){return{'model':db[_0xb6ce25[_0xee96('0x25')]],'as':_0xb6ce25['as'],'attributes':_0xb6ce25[_0xee96('0x21')],'include':_0xb6ce25[_0xee96('0x24')]?_['map'](_0xb6ce25[_0xee96('0x24')],function(_0x59cf8b){return{'model':db[_0x59cf8b[_0xee96('0x25')]],'as':_0x59cf8b['as'],'attributes':_0x59cf8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xee96('0x12')](function(_0x51fbd8){logger[_0xee96('0x13')](_0xee96('0x27'),_0x1571b2);logger[_0xee96('0x16')]('ShowOpenchannelQueue',_0x1571b2,JSON[_0xee96('0x18')](_0x51fbd8));_0x1a481b(_0x51fbd8);})[_0xee96('0x1c')](function(_0x4dcf92){logger[_0xee96('0x19')](_0xee96('0x27'),_0x4dcf92[_0xee96('0x1b')],_0x1571b2);_0x59dde9(_0x5d6a37[_0xee96('0x19')](0x1f4,_0x4dcf92['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6174a17..4a46ee9 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 _0xe819=['save','remove','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x2c7152,_0xcfc1e){var _0x5e385f=function(_0x50a51b){while(--_0x50a51b){_0x2c7152['push'](_0x2c7152['shift']());}};_0x5e385f(++_0xcfc1e);}(_0xe819,0x1a3));var _0x9e81=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe819[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0x9e81('0x0'));var events=[_0x9e81('0x1'),_0x9e81('0x2'),'update'];function createListener(_0x4a5e80,_0x5d0059){return function(_0x118ef0){_0x5d0059['emit'](_0x4a5e80,_0x118ef0);};}function removeListener(_0x28c1f4,_0x3c9e3e){return function(){OpenchannelQueueEvents[_0x9e81('0x3')](_0x28c1f4,_0x3c9e3e);};}exports[_0x9e81('0x4')]=function(_0x3e3c9a){for(var _0x664fe6=0x0,_0x560784=events[_0x9e81('0x5')];_0x664fe6<_0x560784;_0x664fe6++){var _0x3eab31=events[_0x664fe6];var _0x25e60c=createListener(_0x9e81('0x6')+_0x3eab31,_0x3e3c9a);OpenchannelQueueEvents['on'](_0x3eab31,_0x25e60c);}}; \ No newline at end of file +var _0x3a00=['remove','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x1027dd,_0x20bbb2){var _0x375f31=function(_0x8d3b16){while(--_0x8d3b16){_0x1027dd['push'](_0x1027dd['shift']());}};_0x375f31(++_0x20bbb2);}(_0x3a00,0x72));var _0x03a0=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x3a00[_0x38aeea];return _0x5e8d2c;};'use strict';var OpenchannelQueueEvents=require(_0x03a0('0x0'));var events=['save',_0x03a0('0x1'),'update'];function createListener(_0x5503b4,_0xaac52c){return function(_0x42581f){_0xaac52c['emit'](_0x5503b4,_0x42581f);};}function removeListener(_0x201b44,_0x4c682b){return function(){OpenchannelQueueEvents[_0x03a0('0x2')](_0x201b44,_0x4c682b);};}exports[_0x03a0('0x3')]=function(_0xb06974){for(var _0x8875c1=0x0,_0x5b4671=events['length'];_0x8875c1<_0x5b4671;_0x8875c1++){var _0x28c454=events[_0x8875c1];var _0x1c742d=createListener(_0x03a0('0x4')+_0x28c454,_0xb06974);OpenchannelQueueEvents['on'](_0x28c454,_0x1c742d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7dd8d17..c276173 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 _0x2e88=['post','create','put','/:id','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x2e88,0x195));var _0x82e8=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x2e88[_0x443494];return _0x4a6794;};'use strict';var multer=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var path=require(_0x82e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x82e8('0x3'));var router=express[_0x82e8('0x4')]();var fs_extra=require(_0x82e8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x82e8('0x6'));var config=require(_0x82e8('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x82e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x82e8('0x9'),auth[_0x82e8('0xa')](),controller[_0x82e8('0xb')]);router[_0x82e8('0x8')]('/:id',auth[_0x82e8('0xa')](),controller[_0x82e8('0xc')]);router[_0x82e8('0xd')]('/',auth[_0x82e8('0xa')](),controller[_0x82e8('0xe')]);router[_0x82e8('0xf')](_0x82e8('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x82e8('0x11')](_0x82e8('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x82e8('0x12')]=router; \ No newline at end of file +var _0x1e75=['/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x1e75,0x170));var _0x51e7=function(_0x2e047d,_0x366bb4){_0x2e047d=_0x2e047d-0x0;var _0x6d9c2f=_0x1e75[_0x2e047d];return _0x6d9c2f;};'use strict';var multer=require('multer');var util=require(_0x51e7('0x0'));var path=require(_0x51e7('0x1'));var timeout=require(_0x51e7('0x2'));var express=require(_0x51e7('0x3'));var router=express[_0x51e7('0x4')]();var fs_extra=require(_0x51e7('0x5'));var auth=require(_0x51e7('0x6'));var interaction=require(_0x51e7('0x7'));var config=require(_0x51e7('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x51e7('0x9')]('/',auth[_0x51e7('0xa')](),controller['index']);router[_0x51e7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x51e7('0xb')]);router[_0x51e7('0x9')](_0x51e7('0xc'),auth[_0x51e7('0xa')](),controller[_0x51e7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51e7('0xe')]);router['put'](_0x51e7('0xc'),auth[_0x51e7('0xa')](),controller[_0x51e7('0xf')]);router[_0x51e7('0x10')](_0x51e7('0xc'),auth[_0x51e7('0xa')](),controller[_0x51e7('0x11')]);module[_0x51e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 88fb826..73619a9 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 _0x557e=['STRING','DATE','moment','sequelize','exports'];(function(_0x381542,_0x39322c){var _0x179617=function(_0x372701){while(--_0x372701){_0x381542['push'](_0x381542['shift']());}};_0x179617(++_0x39322c);}(_0x557e,0x16f));var _0xe557=function(_0x4e647d,_0x3d133c){_0x4e647d=_0x4e647d-0x0;var _0x57bc3f=_0x557e[_0x4e647d];return _0x57bc3f;};'use strict';var moment=require(_0xe557('0x0'));var Sequelize=require(_0xe557('0x1'));module[_0xe557('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe557('0x3')]},'joinAt':{'type':Sequelize[_0xe557('0x4')]},'leaveAt':{'type':Sequelize[_0xe557('0x4')]},'acceptAt':{'type':Sequelize[_0xe557('0x4')]},'exitAt':{'type':Sequelize[_0xe557('0x4')]},'reason':{'type':Sequelize[_0xe557('0x3')]}}; \ No newline at end of file +var _0xbdda=['exports','STRING','DATE','sequelize'];(function(_0x3ceac4,_0xf57186){var _0x9e4fe8=function(_0x439e4f){while(--_0x439e4f){_0x3ceac4['push'](_0x3ceac4['shift']());}};_0x9e4fe8(++_0xf57186);}(_0xbdda,0x137));var _0xabdd=function(_0x3f38b0,_0x58dc61){_0x3f38b0=_0x3f38b0-0x0;var _0x1f8dcd=_0xbdda[_0x3f38b0];return _0x1f8dcd;};'use strict';var moment=require('moment');var Sequelize=require(_0xabdd('0x0'));module[_0xabdd('0x1')]={'uniqueid':{'type':Sequelize[_0xabdd('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xabdd('0x2')]},'joinAt':{'type':Sequelize[_0xabdd('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xabdd('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index dbebf03..c99ba27 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 _0x5bc5=['end','status','json','offset','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','intersection','fields','attributes','length','model','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x523cca,_0x724b3b){var _0x1504dd=function(_0x41437f){while(--_0x41437f){_0x523cca['push'](_0x523cca['shift']());}};_0x1504dd(++_0x724b3b);}(_0x5bc5,0x78));var _0x55bc=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x5bc5[_0x2ab76b];return _0x201126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55bc('0x0'));var zipdir=require(_0x55bc('0x1'));var jsonpatch=require(_0x55bc('0x2'));var rp=require(_0x55bc('0x3'));var moment=require(_0x55bc('0x4'));var BPromise=require(_0x55bc('0x5'));var Mustache=require(_0x55bc('0x6'));var util=require(_0x55bc('0x7'));var path=require(_0x55bc('0x8'));var sox=require(_0x55bc('0x9'));var csv=require(_0x55bc('0xa'));var ejs=require(_0x55bc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55bc('0xc'));var squel=require(_0x55bc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x55bc('0xe'));var Papa=require(_0x55bc('0xf'));var Redis=require(_0x55bc('0x10'));var authService=require(_0x55bc('0x11'));var qs=require(_0x55bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55bc('0x13'));var logger=require(_0x55bc('0x14'))('api');var utils=require(_0x55bc('0x15'));var config=require(_0x55bc('0x16'));var licenseUtil=require(_0x55bc('0x17'));var db=require(_0x55bc('0x18'))['db'];function respondWithStatusCode(_0x3c4b93,_0xd82cbc){_0xd82cbc=_0xd82cbc||0xcc;return function(_0x5a7583){if(_0x5a7583){return _0x3c4b93[_0x55bc('0x19')](_0xd82cbc);}return _0x3c4b93['status'](_0xd82cbc)[_0x55bc('0x1a')]();};}function respondWithResult(_0x14ab9f,_0x6b8bf9){_0x6b8bf9=_0x6b8bf9||0xc8;return function(_0x5f418b){if(_0x5f418b){return _0x14ab9f[_0x55bc('0x1b')](_0x6b8bf9)[_0x55bc('0x1c')](_0x5f418b);}};}function respondWithFilteredResult(_0x36e13e,_0x264b15){return function(_0x12013d){if(_0x12013d){var _0x5ee386=typeof _0x264b15[_0x55bc('0x1d')]==='undefined'&&typeof _0x264b15[_0x55bc('0x1e')]==='undefined';var _0x235086=_0x12013d[_0x55bc('0x1f')];var _0x587606=_0x5ee386?0x0:_0x264b15['offset'];var _0x2df703=_0x5ee386?_0x12013d['count']:_0x264b15[_0x55bc('0x1d')]+_0x264b15[_0x55bc('0x1e')];var _0x429c6d;if(_0x2df703>=_0x235086){_0x2df703=_0x235086;_0x429c6d=0xc8;}else{_0x429c6d=0xce;}_0x36e13e[_0x55bc('0x1b')](_0x429c6d);return _0x36e13e[_0x55bc('0x20')]('Content-Range',_0x587606+'-'+_0x2df703+'/'+_0x235086)[_0x55bc('0x1c')](_0x12013d);}return null;};}function patchUpdates(_0x2fe524){return function(_0x5cb8db){try{jsonpatch[_0x55bc('0x21')](_0x5cb8db,_0x2fe524,!![]);}catch(_0x22c1e1){return BPromise['reject'](_0x22c1e1);}return _0x5cb8db[_0x55bc('0x22')]();};}function saveUpdates(_0x1b6e98,_0x37fa33){return function(_0x46ac95){if(_0x46ac95){return _0x46ac95[_0x55bc('0x23')](_0x1b6e98)[_0x55bc('0x24')](function(_0x28ebfb){return _0x28ebfb;});}return null;};}function removeEntity(_0x3e8d8b,_0x43dd58){return function(_0x143095){if(_0x143095){return _0x143095[_0x55bc('0x25')]()[_0x55bc('0x24')](function(){_0x3e8d8b['status'](0xcc)[_0x55bc('0x1a')]();});}};}function handleEntityNotFound(_0x2b7cf6,_0x513d51){return function(_0x4ae67f){if(!_0x4ae67f){_0x2b7cf6[_0x55bc('0x19')](0x194);}return _0x4ae67f;};}function handleError(_0x33eaae,_0x26de31){_0x26de31=_0x26de31||0x1f4;return function(_0xcc3706){logger[_0x55bc('0x26')](_0xcc3706[_0x55bc('0x27')]);if(_0xcc3706[_0x55bc('0x28')]){delete _0xcc3706['name'];}_0x33eaae[_0x55bc('0x1b')](_0x26de31)[_0x55bc('0x29')](_0xcc3706);};}exports['index']=function(_0x3ad985,_0x35b7d9){var _0x4efb72={},_0x37d141={},_0xd63c65={'count':0x0,'rows':[]};var _0x286b52=_['map'](db[_0x55bc('0x2a')][_0x55bc('0x2b')],function(_0x4dd94e){return{'name':_0x4dd94e[_0x55bc('0x2c')],'type':_0x4dd94e[_0x55bc('0x2d')][_0x55bc('0x2e')]};});_0x37d141['model']=_[_0x55bc('0x2f')](_0x286b52,'name');_0x37d141[_0x55bc('0x30')]=_['keys'](_0x3ad985['query']);_0x37d141['filters']=_[_0x55bc('0x31')](_0x37d141['model'],_0x37d141['query']);_0x4efb72['attributes']=_[_0x55bc('0x31')](_0x37d141['model'],qs[_0x55bc('0x32')](_0x3ad985[_0x55bc('0x30')][_0x55bc('0x32')]));_0x4efb72[_0x55bc('0x33')]=_0x4efb72[_0x55bc('0x33')][_0x55bc('0x34')]?_0x4efb72[_0x55bc('0x33')]:_0x37d141[_0x55bc('0x35')];if(!_0x3ad985[_0x55bc('0x30')]['hasOwnProperty']('nolimit')){_0x4efb72['limit']=qs[_0x55bc('0x1e')](_0x3ad985['query'][_0x55bc('0x1e')]);_0x4efb72[_0x55bc('0x1d')]=qs[_0x55bc('0x1d')](_0x3ad985['query']['offset']);}_0x4efb72[_0x55bc('0x36')]=qs[_0x55bc('0x37')](_0x3ad985['query'][_0x55bc('0x37')]);_0x4efb72[_0x55bc('0x38')]=qs[_0x55bc('0x39')](_['pick'](_0x3ad985[_0x55bc('0x30')],_0x37d141['filters']),_0x286b52);if(_0x3ad985[_0x55bc('0x30')][_0x55bc('0x3a')]){_0x4efb72['where']=_[_0x55bc('0x3b')](_0x4efb72[_0x55bc('0x38')],{'$or':_[_0x55bc('0x2f')](_0x286b52,function(_0x141db8){if(_0x141db8[_0x55bc('0x2d')]!==_0x55bc('0x3c')){var _0x191f11={};_0x191f11[_0x141db8[_0x55bc('0x28')]]={'$like':'%'+_0x3ad985['query']['filter']+'%'};return _0x191f11;}})});}_0x4efb72=_[_0x55bc('0x3b')]({},_0x4efb72,_0x3ad985[_0x55bc('0x3d')]);var _0x38bd03={'where':_0x4efb72[_0x55bc('0x38')]};return db[_0x55bc('0x2a')]['count'](_0x38bd03)[_0x55bc('0x24')](function(_0x451879){_0xd63c65[_0x55bc('0x1f')]=_0x451879;if(_0x3ad985[_0x55bc('0x30')][_0x55bc('0x3e')]){_0x4efb72[_0x55bc('0x3f')]=[{'all':!![]}];}return db[_0x55bc('0x2a')][_0x55bc('0x40')](_0x4efb72);})[_0x55bc('0x24')](function(_0x8565b5){_0xd63c65['rows']=_0x8565b5;return _0xd63c65;})[_0x55bc('0x24')](respondWithFilteredResult(_0x35b7d9,_0x4efb72))[_0x55bc('0x41')](handleError(_0x35b7d9,null));};exports[_0x55bc('0x42')]=function(_0x2673d3,_0x25e316){var _0x1bebee={'raw':!![],'where':{'id':_0x2673d3[_0x55bc('0x43')]['id']}},_0x2095d8={};_0x2095d8['model']=_[_0x55bc('0x44')](db[_0x55bc('0x2a')][_0x55bc('0x2b')]);_0x2095d8['query']=_[_0x55bc('0x44')](_0x2673d3['query']);_0x2095d8['filters']=_[_0x55bc('0x31')](_0x2095d8[_0x55bc('0x35')],_0x2095d8[_0x55bc('0x30')]);_0x1bebee[_0x55bc('0x33')]=_[_0x55bc('0x31')](_0x2095d8[_0x55bc('0x35')],qs[_0x55bc('0x32')](_0x2673d3['query'][_0x55bc('0x32')]));_0x1bebee[_0x55bc('0x33')]=_0x1bebee[_0x55bc('0x33')][_0x55bc('0x34')]?_0x1bebee[_0x55bc('0x33')]:_0x2095d8[_0x55bc('0x35')];if(_0x2673d3[_0x55bc('0x30')][_0x55bc('0x3e')]){_0x1bebee[_0x55bc('0x3f')]=[{'all':!![]}];}_0x1bebee=_[_0x55bc('0x3b')]({},_0x1bebee,_0x2673d3[_0x55bc('0x3d')]);return db[_0x55bc('0x2a')][_0x55bc('0x45')](_0x1bebee)[_0x55bc('0x24')](handleEntityNotFound(_0x25e316,null))[_0x55bc('0x24')](respondWithResult(_0x25e316,null))[_0x55bc('0x41')](handleError(_0x25e316,null));};exports[_0x55bc('0x46')]=function(_0x4ab1b1,_0x9af145){return db['OpenchannelQueueReport']['create'](_0x4ab1b1[_0x55bc('0x47')],{})[_0x55bc('0x24')](respondWithResult(_0x9af145,0xc9))[_0x55bc('0x41')](handleError(_0x9af145,null));};exports['update']=function(_0x5c5100,_0xe8b4ca){if(_0x5c5100[_0x55bc('0x47')]['id']){delete _0x5c5100[_0x55bc('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x55bc('0x45')]({'where':{'id':_0x5c5100[_0x55bc('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8b4ca,null))[_0x55bc('0x24')](saveUpdates(_0x5c5100[_0x55bc('0x47')],null))['then'](respondWithResult(_0xe8b4ca,null))['catch'](handleError(_0xe8b4ca,null));};exports['destroy']=function(_0x17482f,_0x1b2c1b){return db[_0x55bc('0x2a')][_0x55bc('0x45')]({'where':{'id':_0x17482f['params']['id']}})[_0x55bc('0x24')](handleEntityNotFound(_0x1b2c1b,null))[_0x55bc('0x24')](removeEntity(_0x1b2c1b,null))[_0x55bc('0x41')](handleError(_0x1b2c1b,null));};exports[_0x55bc('0x48')]=function(_0x1b2cf6,_0x5e7aa5){return db[_0x55bc('0x2a')]['describe']()[_0x55bc('0x24')](respondWithResult(_0x5e7aa5,null))[_0x55bc('0x41')](handleError(_0x5e7aa5,null));}; \ No newline at end of file +var _0x51c3=['papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','destroy','then','error','stack','name','map','OpenchannelQueueReport','type','key','model','keys','filters','intersection','fields','query','attributes','length','sort','pick','where','merge','VIRTUAL','filter','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','params','describe','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring'];(function(_0x2fb37d,_0x5ac84d){var _0x287bd9=function(_0xb64f28){while(--_0xb64f28){_0x2fb37d['push'](_0x2fb37d['shift']());}};_0x287bd9(++_0x5ac84d);}(_0x51c3,0xb9));var _0x351c=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x51c3[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x351c('0x0'));var jsonpatch=require(_0x351c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x351c('0x2'));var Mustache=require('mustache');var util=require(_0x351c('0x3'));var path=require(_0x351c('0x4'));var sox=require(_0x351c('0x5'));var csv=require('to-csv');var ejs=require(_0x351c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x351c('0x7'));var squel=require(_0x351c('0x8'));var crypto=require(_0x351c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x351c('0xa'));var toCsv=require(_0x351c('0xb'));var querystring=require(_0x351c('0xc'));var Papa=require(_0x351c('0xd'));var Redis=require(_0x351c('0xe'));var authService=require(_0x351c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x351c('0x10'));var utils=require('../../config/utils');var config=require(_0x351c('0x11'));var licenseUtil=require(_0x351c('0x12'));var db=require(_0x351c('0x13'))['db'];function respondWithStatusCode(_0x4afc98,_0x56b09f){_0x56b09f=_0x56b09f||0xcc;return function(_0x6a8dfd){if(_0x6a8dfd){return _0x4afc98[_0x351c('0x14')](_0x56b09f);}return _0x4afc98['status'](_0x56b09f)['end']();};}function respondWithResult(_0x239477,_0x565cb8){_0x565cb8=_0x565cb8||0xc8;return function(_0x1f724b){if(_0x1f724b){return _0x239477['status'](_0x565cb8)[_0x351c('0x15')](_0x1f724b);}};}function respondWithFilteredResult(_0x339b2b,_0x43e4eb){return function(_0x55ecd0){if(_0x55ecd0){var _0x210756=typeof _0x43e4eb[_0x351c('0x16')]===_0x351c('0x17')&&typeof _0x43e4eb[_0x351c('0x18')]==='undefined';var _0x421d8c=_0x55ecd0[_0x351c('0x19')];var _0x45ebfe=_0x210756?0x0:_0x43e4eb['offset'];var _0x473edf=_0x210756?_0x55ecd0[_0x351c('0x19')]:_0x43e4eb[_0x351c('0x16')]+_0x43e4eb[_0x351c('0x18')];var _0x400105;if(_0x473edf>=_0x421d8c){_0x473edf=_0x421d8c;_0x400105=0xc8;}else{_0x400105=0xce;}_0x339b2b[_0x351c('0x1a')](_0x400105);return _0x339b2b[_0x351c('0x1b')](_0x351c('0x1c'),_0x45ebfe+'-'+_0x473edf+'/'+_0x421d8c)['json'](_0x55ecd0);}return null;};}function patchUpdates(_0x38c0ac){return function(_0x284584){try{jsonpatch['apply'](_0x284584,_0x38c0ac,!![]);}catch(_0x5df764){return BPromise[_0x351c('0x1d')](_0x5df764);}return _0x284584[_0x351c('0x1e')]();};}function saveUpdates(_0x4bfb63,_0x4bcfaa){return function(_0x2b5fc1){if(_0x2b5fc1){return _0x2b5fc1['update'](_0x4bfb63)['then'](function(_0x1f77d9){return _0x1f77d9;});}return null;};}function removeEntity(_0x31792c,_0x251d93){return function(_0x2e93cd){if(_0x2e93cd){return _0x2e93cd[_0x351c('0x1f')]()[_0x351c('0x20')](function(){_0x31792c[_0x351c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37210d,_0x3a6dca){return function(_0x5e2fb3){if(!_0x5e2fb3){_0x37210d['sendStatus'](0x194);}return _0x5e2fb3;};}function handleError(_0x2ad697,_0x1f8064){_0x1f8064=_0x1f8064||0x1f4;return function(_0x206fa7){logger[_0x351c('0x21')](_0x206fa7[_0x351c('0x22')]);if(_0x206fa7['name']){delete _0x206fa7[_0x351c('0x23')];}_0x2ad697[_0x351c('0x1a')](_0x1f8064)['send'](_0x206fa7);};}exports['index']=function(_0x391a01,_0x523d30){var _0x2013e2={},_0x4966af={},_0x42c2ea={'count':0x0,'rows':[]};var _0xd52289=_[_0x351c('0x24')](db[_0x351c('0x25')]['rawAttributes'],function(_0x22977c){return{'name':_0x22977c['fieldName'],'type':_0x22977c[_0x351c('0x26')][_0x351c('0x27')]};});_0x4966af[_0x351c('0x28')]=_[_0x351c('0x24')](_0xd52289,_0x351c('0x23'));_0x4966af['query']=_[_0x351c('0x29')](_0x391a01['query']);_0x4966af[_0x351c('0x2a')]=_[_0x351c('0x2b')](_0x4966af[_0x351c('0x28')],_0x4966af['query']);_0x2013e2['attributes']=_[_0x351c('0x2b')](_0x4966af[_0x351c('0x28')],qs[_0x351c('0x2c')](_0x391a01[_0x351c('0x2d')][_0x351c('0x2c')]));_0x2013e2[_0x351c('0x2e')]=_0x2013e2[_0x351c('0x2e')][_0x351c('0x2f')]?_0x2013e2[_0x351c('0x2e')]:_0x4966af[_0x351c('0x28')];if(!_0x391a01['query']['hasOwnProperty']('nolimit')){_0x2013e2[_0x351c('0x18')]=qs[_0x351c('0x18')](_0x391a01[_0x351c('0x2d')][_0x351c('0x18')]);_0x2013e2[_0x351c('0x16')]=qs[_0x351c('0x16')](_0x391a01[_0x351c('0x2d')]['offset']);}_0x2013e2['order']=qs[_0x351c('0x30')](_0x391a01[_0x351c('0x2d')][_0x351c('0x30')]);_0x2013e2['where']=qs['filters'](_[_0x351c('0x31')](_0x391a01[_0x351c('0x2d')],_0x4966af[_0x351c('0x2a')]),_0xd52289);if(_0x391a01[_0x351c('0x2d')]['filter']){_0x2013e2[_0x351c('0x32')]=_[_0x351c('0x33')](_0x2013e2[_0x351c('0x32')],{'$or':_[_0x351c('0x24')](_0xd52289,function(_0x5bc164){if(_0x5bc164[_0x351c('0x26')]!==_0x351c('0x34')){var _0x110185={};_0x110185[_0x5bc164[_0x351c('0x23')]]={'$like':'%'+_0x391a01[_0x351c('0x2d')][_0x351c('0x35')]+'%'};return _0x110185;}})});}_0x2013e2=_[_0x351c('0x33')]({},_0x2013e2,_0x391a01['options']);var _0xdf1abe={'where':_0x2013e2[_0x351c('0x32')]};return db[_0x351c('0x25')][_0x351c('0x19')](_0xdf1abe)['then'](function(_0x10ddf3){_0x42c2ea['count']=_0x10ddf3;if(_0x391a01[_0x351c('0x2d')]['includeAll']){_0x2013e2['include']=[{'all':!![]}];}return db[_0x351c('0x25')][_0x351c('0x36')](_0x2013e2);})[_0x351c('0x20')](function(_0x365d70){_0x42c2ea[_0x351c('0x37')]=_0x365d70;return _0x42c2ea;})[_0x351c('0x20')](respondWithFilteredResult(_0x523d30,_0x2013e2))[_0x351c('0x38')](handleError(_0x523d30,null));};exports[_0x351c('0x39')]=function(_0x264edd,_0x36d81c){var _0x2c8e2a={'raw':!![],'where':{'id':_0x264edd['params']['id']}},_0x43dd7d={};_0x43dd7d['model']=_[_0x351c('0x29')](db[_0x351c('0x25')][_0x351c('0x3a')]);_0x43dd7d['query']=_['keys'](_0x264edd[_0x351c('0x2d')]);_0x43dd7d[_0x351c('0x2a')]=_['intersection'](_0x43dd7d[_0x351c('0x28')],_0x43dd7d[_0x351c('0x2d')]);_0x2c8e2a[_0x351c('0x2e')]=_['intersection'](_0x43dd7d[_0x351c('0x28')],qs['fields'](_0x264edd[_0x351c('0x2d')]['fields']));_0x2c8e2a[_0x351c('0x2e')]=_0x2c8e2a[_0x351c('0x2e')][_0x351c('0x2f')]?_0x2c8e2a[_0x351c('0x2e')]:_0x43dd7d[_0x351c('0x28')];if(_0x264edd[_0x351c('0x2d')][_0x351c('0x3b')]){_0x2c8e2a[_0x351c('0x3c')]=[{'all':!![]}];}_0x2c8e2a=_[_0x351c('0x33')]({},_0x2c8e2a,_0x264edd['options']);return db[_0x351c('0x25')][_0x351c('0x3d')](_0x2c8e2a)[_0x351c('0x20')](handleEntityNotFound(_0x36d81c,null))[_0x351c('0x20')](respondWithResult(_0x36d81c,null))[_0x351c('0x38')](handleError(_0x36d81c,null));};exports[_0x351c('0x3e')]=function(_0x1d8536,_0x5d1dc4){return db[_0x351c('0x25')][_0x351c('0x3e')](_0x1d8536[_0x351c('0x3f')],{})['then'](respondWithResult(_0x5d1dc4,0xc9))[_0x351c('0x38')](handleError(_0x5d1dc4,null));};exports['update']=function(_0x2f3733,_0x167cd2){if(_0x2f3733[_0x351c('0x3f')]['id']){delete _0x2f3733[_0x351c('0x3f')]['id'];}return db[_0x351c('0x25')]['find']({'where':{'id':_0x2f3733[_0x351c('0x40')]['id']}})[_0x351c('0x20')](handleEntityNotFound(_0x167cd2,null))['then'](saveUpdates(_0x2f3733[_0x351c('0x3f')],null))[_0x351c('0x20')](respondWithResult(_0x167cd2,null))[_0x351c('0x38')](handleError(_0x167cd2,null));};exports[_0x351c('0x1f')]=function(_0x319e66,_0xe385a1){return db[_0x351c('0x25')][_0x351c('0x3d')]({'where':{'id':_0x319e66[_0x351c('0x40')]['id']}})[_0x351c('0x20')](handleEntityNotFound(_0xe385a1,null))[_0x351c('0x20')](removeEntity(_0xe385a1,null))['catch'](handleError(_0xe385a1,null));};exports[_0x351c('0x41')]=function(_0x29a503,_0x359b1f){return db['OpenchannelQueueReport'][_0x351c('0x41')]()['then'](respondWithResult(_0x359b1f,null))[_0x351c('0x38')](handleError(_0x359b1f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 53ddca1..92be9a1 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x521a15,_0x7e8b4e){var _0x4d61a9=function(_0x11c248){while(--_0x11c248){_0x521a15['push'](_0x521a15['shift']());}};_0x4d61a9(++_0x7e8b4e);}(_0x326f,0xd1));var _0xf326=function(_0x161e48,_0x4e28e5){_0x161e48=_0x161e48-0x0;var _0x5d111d=_0x326f[_0x161e48];return _0x5d111d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x814b,0x1a2));var _0xb814=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x814b[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 935ea31..4707829 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 _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x14e8dc,_0x798969){var _0x1f2a36=function(_0x1d15f8){while(--_0x1d15f8){_0x14e8dc['push'](_0x14e8dc['shift']());}};_0x1f2a36(++_0x798969);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x4d37f2,_0x51bcaf){_0x4d37f2=_0x4d37f2-0x0;var _0x2757f2=_0x4f7b[_0x4d37f2];return _0x2757f2;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file +var _0x4fc2=['limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x4fc2,0x111));var _0x24fc=function(_0x14a3d9,_0x12f232){_0x14a3d9=_0x14a3d9-0x0;var _0xeef905=_0x4fc2[_0x14a3d9];return _0xeef905;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateOpenchannelQueueReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['OpenchannelQueueReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateOpenchannelQueueReport',_0x23873c);logger[_0x24fc('0x10')]('CreateOpenchannelQueueReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});};exports[_0x24fc('0x1c')]=function(_0x2bb93a){var _0x36a9b4=this;return new Promise(function(_0x34b5b2,_0x3296fc){return db[_0x24fc('0x1d')][_0x24fc('0x1e')](_0x2bb93a[_0x24fc('0x18')],{'raw':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x1f')]||null:null,'attributes':_0x2bb93a['options']?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x20')]||null:null,'limit':_0x2bb93a[_0x24fc('0x19')]?_0x2bb93a[_0x24fc('0x19')][_0x24fc('0x21')]||null:null})[_0x24fc('0xc')](function(_0x5ac1f2){logger[_0x24fc('0xd')](_0x24fc('0x1c'),_0x2bb93a);logger[_0x24fc('0x10')](_0x24fc('0x1c'),_0x2bb93a,JSON[_0x24fc('0x12')](_0x5ac1f2));_0x34b5b2(_0x5ac1f2);})['catch'](function(_0x55c27f){logger['error'](_0x24fc('0x1c'),_0x55c27f['message'],_0x2bb93a);_0x3296fc(_0x36a9b4[_0x24fc('0x13')](0x1f4,_0x55c27f[_0x24fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c039273..5c7a0cd 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 _0x3191=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x255005,_0x1e1de1){var _0x3c4730=function(_0x54201f){while(--_0x54201f){_0x255005['push'](_0x255005['shift']());}};_0x3c4730(++_0x1e1de1);}(_0x3191,0xd4));var _0x1319=function(_0x2ab055,_0x3e5a1a){_0x2ab055=_0x2ab055-0x0;var _0x2da2b4=_0x3191[_0x2ab055];return _0x2da2b4;};'use strict';var multer=require(_0x1319('0x0'));var util=require(_0x1319('0x1'));var path=require(_0x1319('0x2'));var timeout=require(_0x1319('0x3'));var express=require(_0x1319('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1319('0x5'));var interaction=require(_0x1319('0x6'));var config=require(_0x1319('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x1319('0x8')](),controller['index']);router['get'](_0x1319('0x9'),auth['isAuthenticated'](),controller[_0x1319('0xa')]);router[_0x1319('0xb')]('/:id',auth[_0x1319('0x8')](),controller['show']);router[_0x1319('0xc')]('/',auth[_0x1319('0x8')](),controller[_0x1319('0xd')]);router[_0x1319('0xe')](_0x1319('0xf'),auth[_0x1319('0x8')](),controller['update']);router[_0x1319('0x10')](_0x1319('0xf'),auth[_0x1319('0x8')](),controller[_0x1319('0x11')]);module['exports']=router; \ No newline at end of file +var _0xba7d=['describe','show','post','delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba7d,0x136));var _0xdba7=function(_0x5a78d1,_0x287afe){_0x5a78d1=_0x5a78d1-0x0;var _0x5d9751=_0xba7d[_0x5a78d1];return _0x5d9751;};'use strict';var multer=require(_0xdba7('0x0'));var util=require(_0xdba7('0x1'));var path=require(_0xdba7('0x2'));var timeout=require('connect-timeout');var express=require(_0xdba7('0x3'));var router=express[_0xdba7('0x4')]();var fs_extra=require(_0xdba7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdba7('0x6'));var config=require(_0xdba7('0x7'));var controller=require(_0xdba7('0x8'));router[_0xdba7('0x9')]('/',auth[_0xdba7('0xa')](),controller[_0xdba7('0xb')]);router[_0xdba7('0x9')](_0xdba7('0xc'),auth['isAuthenticated'](),controller[_0xdba7('0xd')]);router[_0xdba7('0x9')]('/:id',auth[_0xdba7('0xa')](),controller[_0xdba7('0xe')]);router[_0xdba7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xdba7('0xa')](),controller['update']);router[_0xdba7('0x10')](_0xdba7('0x11'),auth[_0xdba7('0xa')](),controller['destroy']);module[_0xdba7('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 95251c2..535c233 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0x34e8,0x12c));var _0x834e=function(_0x16cf0a,_0x2c57fd){_0x16cf0a=_0x16cf0a-0x0;var _0x4e4e12=_0x34e8[_0x16cf0a];return _0x4e4e12;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1c7dcf,_0x25723c){var _0x1ede61=function(_0x41f909){while(--_0x41f909){_0x1c7dcf['push'](_0x1c7dcf['shift']());}};_0x1ede61(++_0x25723c);}(_0x54ef,0x112));var _0xf54e=function(_0x49f47b,_0x3931bb){_0x49f47b=_0x49f47b-0x0;var _0x1c6704=_0x54ef[_0x49f47b];return _0x1c6704;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 38f9033..d76df67 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 _0xbd93=['hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x10f5d1,_0x32f939){var _0x5b7aec=function(_0x20ca5e){while(--_0x20ca5e){_0x10f5d1['push'](_0x10f5d1['shift']());}};_0x5b7aec(++_0x32f939);}(_0xbd93,0xa4));var _0x3bd9=function(_0x5a0837,_0x500c31){_0x5a0837=_0x5a0837-0x0;var _0x54ff81=_0xbd93[_0x5a0837];return _0x54ff81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bd9('0x0'));var zipdir=require(_0x3bd9('0x1'));var jsonpatch=require(_0x3bd9('0x2'));var rp=require(_0x3bd9('0x3'));var moment=require(_0x3bd9('0x4'));var BPromise=require(_0x3bd9('0x5'));var Mustache=require('mustache');var util=require(_0x3bd9('0x6'));var path=require(_0x3bd9('0x7'));var sox=require('sox');var csv=require(_0x3bd9('0x8'));var ejs=require(_0x3bd9('0x9'));var fs=require('fs');var fs_extra=require(_0x3bd9('0xa'));var _=require(_0x3bd9('0xb'));var squel=require(_0x3bd9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3bd9('0x8'));var querystring=require('querystring');var Papa=require(_0x3bd9('0xd'));var Redis=require(_0x3bd9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3bd9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bd9('0x10'))('api');var utils=require(_0x3bd9('0x11'));var config=require(_0x3bd9('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3df9d1,_0x3a61da){_0x3a61da=_0x3a61da||0xcc;return function(_0x37c2b0){if(_0x37c2b0){return _0x3df9d1[_0x3bd9('0x13')](_0x3a61da);}return _0x3df9d1[_0x3bd9('0x14')](_0x3a61da)[_0x3bd9('0x15')]();};}function respondWithResult(_0x2f0366,_0x16e9c9){_0x16e9c9=_0x16e9c9||0xc8;return function(_0x103ade){if(_0x103ade){return _0x2f0366[_0x3bd9('0x14')](_0x16e9c9)[_0x3bd9('0x16')](_0x103ade);}};}function respondWithFilteredResult(_0x16c865,_0x3baf0e){return function(_0x5ac62b){if(_0x5ac62b){var _0x5782c7=typeof _0x3baf0e['offset']===_0x3bd9('0x17')&&typeof _0x3baf0e[_0x3bd9('0x18')]===_0x3bd9('0x17');var _0xcc0c72=_0x5ac62b[_0x3bd9('0x19')];var _0x558d5d=_0x5782c7?0x0:_0x3baf0e['offset'];var _0x28fee5=_0x5782c7?_0x5ac62b['count']:_0x3baf0e['offset']+_0x3baf0e['limit'];var _0x2fae76;if(_0x28fee5>=_0xcc0c72){_0x28fee5=_0xcc0c72;_0x2fae76=0xc8;}else{_0x2fae76=0xce;}_0x16c865[_0x3bd9('0x14')](_0x2fae76);return _0x16c865[_0x3bd9('0x1a')](_0x3bd9('0x1b'),_0x558d5d+'-'+_0x28fee5+'/'+_0xcc0c72)[_0x3bd9('0x16')](_0x5ac62b);}return null;};}function patchUpdates(_0x54b725){return function(_0x9f9157){try{jsonpatch[_0x3bd9('0x1c')](_0x9f9157,_0x54b725,!![]);}catch(_0x303844){return BPromise[_0x3bd9('0x1d')](_0x303844);}return _0x9f9157[_0x3bd9('0x1e')]();};}function saveUpdates(_0x14f5b5,_0x1231ca){return function(_0x500319){if(_0x500319){return _0x500319[_0x3bd9('0x1f')](_0x14f5b5)['then'](function(_0x442606){return _0x442606;});}return null;};}function removeEntity(_0x30b8a9,_0x5ec198){return function(_0x2869e0){if(_0x2869e0){return _0x2869e0[_0x3bd9('0x20')]()[_0x3bd9('0x21')](function(){_0x30b8a9[_0x3bd9('0x14')](0xcc)[_0x3bd9('0x15')]();});}};}function handleEntityNotFound(_0x594f27,_0x1b9b2b){return function(_0xaf86ed){if(!_0xaf86ed){_0x594f27['sendStatus'](0x194);}return _0xaf86ed;};}function handleError(_0x36ae2c,_0x3c109f){_0x3c109f=_0x3c109f||0x1f4;return function(_0x752f15){logger[_0x3bd9('0x22')](_0x752f15[_0x3bd9('0x23')]);if(_0x752f15[_0x3bd9('0x24')]){delete _0x752f15[_0x3bd9('0x24')];}_0x36ae2c[_0x3bd9('0x14')](_0x3c109f)['send'](_0x752f15);};}exports[_0x3bd9('0x25')]=function(_0x521a34,_0x3515fb){var _0x2b3b3b={},_0x57e78d={},_0x3dc683={'count':0x0,'rows':[]};var _0xdf8762=_[_0x3bd9('0x26')](db[_0x3bd9('0x27')][_0x3bd9('0x28')],function(_0x1c6884){return{'name':_0x1c6884[_0x3bd9('0x29')],'type':_0x1c6884[_0x3bd9('0x2a')][_0x3bd9('0x2b')]};});_0x57e78d[_0x3bd9('0x2c')]=_[_0x3bd9('0x26')](_0xdf8762,'name');_0x57e78d[_0x3bd9('0x2d')]=_[_0x3bd9('0x2e')](_0x521a34['query']);_0x57e78d[_0x3bd9('0x2f')]=_[_0x3bd9('0x30')](_0x57e78d[_0x3bd9('0x2c')],_0x57e78d['query']);_0x2b3b3b[_0x3bd9('0x31')]=_[_0x3bd9('0x30')](_0x57e78d[_0x3bd9('0x2c')],qs[_0x3bd9('0x32')](_0x521a34['query'][_0x3bd9('0x32')]));_0x2b3b3b[_0x3bd9('0x31')]=_0x2b3b3b['attributes'][_0x3bd9('0x33')]?_0x2b3b3b['attributes']:_0x57e78d['model'];if(!_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x34')](_0x3bd9('0x35'))){_0x2b3b3b[_0x3bd9('0x18')]=qs[_0x3bd9('0x18')](_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x18')]);_0x2b3b3b[_0x3bd9('0x36')]=qs[_0x3bd9('0x36')](_0x521a34['query']['offset']);}_0x2b3b3b[_0x3bd9('0x37')]=qs[_0x3bd9('0x38')](_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x38')]);_0x2b3b3b[_0x3bd9('0x39')]=qs[_0x3bd9('0x2f')](_[_0x3bd9('0x3a')](_0x521a34[_0x3bd9('0x2d')],_0x57e78d['filters']),_0xdf8762);if(_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3b')]){_0x2b3b3b['where']=_[_0x3bd9('0x3c')](_0x2b3b3b[_0x3bd9('0x39')],{'$or':_['map'](_0xdf8762,function(_0x873ca9){if(_0x873ca9['type']!==_0x3bd9('0x3d')){var _0x18343e={};_0x18343e[_0x873ca9['name']]={'$like':'%'+_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3b')]+'%'};return _0x18343e;}})});}_0x2b3b3b=_['merge']({},_0x2b3b3b,_0x521a34['options']);var _0x1ee730={'where':_0x2b3b3b[_0x3bd9('0x39')]};return db[_0x3bd9('0x27')][_0x3bd9('0x19')](_0x1ee730)[_0x3bd9('0x21')](function(_0x23d45d){_0x3dc683[_0x3bd9('0x19')]=_0x23d45d;if(_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3e')]){_0x2b3b3b['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x2b3b3b);})['then'](function(_0x255242){_0x3dc683[_0x3bd9('0x3f')]=_0x255242;return _0x3dc683;})[_0x3bd9('0x21')](respondWithFilteredResult(_0x3515fb,_0x2b3b3b))[_0x3bd9('0x40')](handleError(_0x3515fb,null));};exports[_0x3bd9('0x41')]=function(_0x27d15d,_0x438cf0){var _0x17b6c5={'raw':!![],'where':{'id':_0x27d15d[_0x3bd9('0x42')]['id']}},_0x2a9f73={};_0x2a9f73[_0x3bd9('0x2c')]=_['keys'](db[_0x3bd9('0x27')][_0x3bd9('0x28')]);_0x2a9f73[_0x3bd9('0x2d')]=_['keys'](_0x27d15d[_0x3bd9('0x2d')]);_0x2a9f73['filters']=_[_0x3bd9('0x30')](_0x2a9f73[_0x3bd9('0x2c')],_0x2a9f73[_0x3bd9('0x2d')]);_0x17b6c5[_0x3bd9('0x31')]=_[_0x3bd9('0x30')](_0x2a9f73[_0x3bd9('0x2c')],qs[_0x3bd9('0x32')](_0x27d15d[_0x3bd9('0x2d')][_0x3bd9('0x32')]));_0x17b6c5[_0x3bd9('0x31')]=_0x17b6c5[_0x3bd9('0x31')]['length']?_0x17b6c5[_0x3bd9('0x31')]:_0x2a9f73[_0x3bd9('0x2c')];if(_0x27d15d[_0x3bd9('0x2d')][_0x3bd9('0x3e')]){_0x17b6c5[_0x3bd9('0x43')]=[{'all':!![]}];}_0x17b6c5=_['merge']({},_0x17b6c5,_0x27d15d[_0x3bd9('0x44')]);return db[_0x3bd9('0x27')][_0x3bd9('0x45')](_0x17b6c5)[_0x3bd9('0x21')](handleEntityNotFound(_0x438cf0,null))[_0x3bd9('0x21')](respondWithResult(_0x438cf0,null))['catch'](handleError(_0x438cf0,null));};exports['create']=function(_0x4df9d2,_0x5dfe5b){return db['OpenchannelTransferReport']['create'](_0x4df9d2['body'],{})[_0x3bd9('0x21')](respondWithResult(_0x5dfe5b,0xc9))[_0x3bd9('0x40')](handleError(_0x5dfe5b,null));};exports['update']=function(_0x211ebd,_0x42a9c6){if(_0x211ebd[_0x3bd9('0x46')]['id']){delete _0x211ebd[_0x3bd9('0x46')]['id'];}return db[_0x3bd9('0x27')][_0x3bd9('0x45')]({'where':{'id':_0x211ebd[_0x3bd9('0x42')]['id']}})[_0x3bd9('0x21')](handleEntityNotFound(_0x42a9c6,null))[_0x3bd9('0x21')](saveUpdates(_0x211ebd['body'],null))[_0x3bd9('0x21')](respondWithResult(_0x42a9c6,null))['catch'](handleError(_0x42a9c6,null));};exports[_0x3bd9('0x20')]=function(_0x3675af,_0x4de7ba){return db[_0x3bd9('0x27')][_0x3bd9('0x45')]({'where':{'id':_0x3675af[_0x3bd9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4de7ba,null))[_0x3bd9('0x21')](removeEntity(_0x4de7ba,null))[_0x3bd9('0x40')](handleError(_0x4de7ba,null));};exports[_0x3bd9('0x47')]=function(_0x3a399b,_0x20284c){return db[_0x3bd9('0x27')][_0x3bd9('0x47')]()[_0x3bd9('0x21')](respondWithResult(_0x20284c,null))[_0x3bd9('0x40')](handleError(_0x20284c,null));}; \ No newline at end of file +var _0x66d8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','rows','catch','keys','includeAll','include','options','find','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x22991,_0xed9a7b){var _0x772f74=function(_0x13ed37){while(--_0x13ed37){_0x22991['push'](_0x22991['shift']());}};_0x772f74(++_0xed9a7b);}(_0x66d8,0x18f));var _0x866d=function(_0x13211b,_0x3050c2){_0x13211b=_0x13211b-0x0;var _0x4adb44=_0x66d8[_0x13211b];return _0x4adb44;};'use strict';var emlformat=require(_0x866d('0x0'));var rimraf=require(_0x866d('0x1'));var zipdir=require(_0x866d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x866d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x866d('0x4'));var util=require('util');var path=require(_0x866d('0x5'));var sox=require('sox');var csv=require(_0x866d('0x6'));var ejs=require(_0x866d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x866d('0x8'));var squel=require(_0x866d('0x9'));var crypto=require(_0x866d('0xa'));var jsforce=require(_0x866d('0xb'));var deskjs=require(_0x866d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x866d('0xd'));var Redis=require(_0x866d('0xe'));var authService=require(_0x866d('0xf'));var qs=require(_0x866d('0x10'));var as=require(_0x866d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x866d('0x12'));var utils=require(_0x866d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x866d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15b689,_0x2060a0){_0x2060a0=_0x2060a0||0xcc;return function(_0x2a6ef){if(_0x2a6ef){return _0x15b689[_0x866d('0x15')](_0x2060a0);}return _0x15b689[_0x866d('0x16')](_0x2060a0)[_0x866d('0x17')]();};}function respondWithResult(_0x1793b5,_0x1d2eaa){_0x1d2eaa=_0x1d2eaa||0xc8;return function(_0x46c1b8){if(_0x46c1b8){return _0x1793b5[_0x866d('0x16')](_0x1d2eaa)[_0x866d('0x18')](_0x46c1b8);}};}function respondWithFilteredResult(_0x4da0af,_0x4e6598){return function(_0xdb0ccd){if(_0xdb0ccd){var _0x5c4215=typeof _0x4e6598['offset']==='undefined'&&typeof _0x4e6598[_0x866d('0x19')]===_0x866d('0x1a');var _0x30e380=_0xdb0ccd[_0x866d('0x1b')];var _0x48d9c2=_0x5c4215?0x0:_0x4e6598[_0x866d('0x1c')];var _0x461ad5=_0x5c4215?_0xdb0ccd[_0x866d('0x1b')]:_0x4e6598[_0x866d('0x1c')]+_0x4e6598[_0x866d('0x19')];var _0x49e51c;if(_0x461ad5>=_0x30e380){_0x461ad5=_0x30e380;_0x49e51c=0xc8;}else{_0x49e51c=0xce;}_0x4da0af[_0x866d('0x16')](_0x49e51c);return _0x4da0af[_0x866d('0x1d')](_0x866d('0x1e'),_0x48d9c2+'-'+_0x461ad5+'/'+_0x30e380)[_0x866d('0x18')](_0xdb0ccd);}return null;};}function patchUpdates(_0x1d86ff){return function(_0x1ade73){try{jsonpatch[_0x866d('0x1f')](_0x1ade73,_0x1d86ff,!![]);}catch(_0x42621c){return BPromise['reject'](_0x42621c);}return _0x1ade73[_0x866d('0x20')]();};}function saveUpdates(_0x3ff4ac,_0x471ae4){return function(_0x2e0ced){if(_0x2e0ced){return _0x2e0ced['update'](_0x3ff4ac)[_0x866d('0x21')](function(_0x1ca64e){return _0x1ca64e;});}return null;};}function removeEntity(_0x5c07b3,_0x42ffda){return function(_0x1c955f){if(_0x1c955f){return _0x1c955f['destroy']()['then'](function(){_0x5c07b3['status'](0xcc)[_0x866d('0x17')]();});}};}function handleEntityNotFound(_0x4bb81d,_0x3cc003){return function(_0x477444){if(!_0x477444){_0x4bb81d[_0x866d('0x15')](0x194);}return _0x477444;};}function handleError(_0x3e4a08,_0x965131){_0x965131=_0x965131||0x1f4;return function(_0x2a0c29){logger['error'](_0x2a0c29[_0x866d('0x22')]);if(_0x2a0c29[_0x866d('0x23')]){delete _0x2a0c29['name'];}_0x3e4a08[_0x866d('0x16')](_0x965131)[_0x866d('0x24')](_0x2a0c29);};}exports[_0x866d('0x25')]=function(_0x40450b,_0x2a2611){var _0x5efd7b={},_0x559f87={},_0xfb3faf={'count':0x0,'rows':[]};var _0x3c08e4=_[_0x866d('0x26')](db[_0x866d('0x27')][_0x866d('0x28')],function(_0x15004a){return{'name':_0x15004a[_0x866d('0x29')],'type':_0x15004a[_0x866d('0x2a')][_0x866d('0x2b')]};});_0x559f87[_0x866d('0x2c')]=_[_0x866d('0x26')](_0x3c08e4,'name');_0x559f87[_0x866d('0x2d')]=_['keys'](_0x40450b[_0x866d('0x2d')]);_0x559f87[_0x866d('0x2e')]=_[_0x866d('0x2f')](_0x559f87[_0x866d('0x2c')],_0x559f87['query']);_0x5efd7b['attributes']=_[_0x866d('0x2f')](_0x559f87[_0x866d('0x2c')],qs[_0x866d('0x30')](_0x40450b[_0x866d('0x2d')]['fields']));_0x5efd7b['attributes']=_0x5efd7b['attributes']['length']?_0x5efd7b[_0x866d('0x31')]:_0x559f87['model'];if(!_0x40450b[_0x866d('0x2d')][_0x866d('0x32')]('nolimit')){_0x5efd7b[_0x866d('0x19')]=qs[_0x866d('0x19')](_0x40450b[_0x866d('0x2d')][_0x866d('0x19')]);_0x5efd7b[_0x866d('0x1c')]=qs[_0x866d('0x1c')](_0x40450b[_0x866d('0x2d')][_0x866d('0x1c')]);}_0x5efd7b[_0x866d('0x33')]=qs[_0x866d('0x34')](_0x40450b[_0x866d('0x2d')][_0x866d('0x34')]);_0x5efd7b[_0x866d('0x35')]=qs[_0x866d('0x2e')](_['pick'](_0x40450b[_0x866d('0x2d')],_0x559f87[_0x866d('0x2e')]),_0x3c08e4);if(_0x40450b[_0x866d('0x2d')][_0x866d('0x36')]){_0x5efd7b[_0x866d('0x35')]=_[_0x866d('0x37')](_0x5efd7b[_0x866d('0x35')],{'$or':_[_0x866d('0x26')](_0x3c08e4,function(_0x18378a){if(_0x18378a[_0x866d('0x2a')]!==_0x866d('0x38')){var _0x29caa2={};_0x29caa2[_0x18378a[_0x866d('0x23')]]={'$like':'%'+_0x40450b[_0x866d('0x2d')][_0x866d('0x36')]+'%'};return _0x29caa2;}})});}_0x5efd7b=_['merge']({},_0x5efd7b,_0x40450b['options']);var _0x1144e7={'where':_0x5efd7b[_0x866d('0x35')]};return db['OpenchannelTransferReport'][_0x866d('0x1b')](_0x1144e7)[_0x866d('0x21')](function(_0x163c6a){_0xfb3faf[_0x866d('0x1b')]=_0x163c6a;if(_0x40450b[_0x866d('0x2d')]['includeAll']){_0x5efd7b['include']=[{'all':!![]}];}return db[_0x866d('0x27')]['findAll'](_0x5efd7b);})[_0x866d('0x21')](function(_0x128cf1){_0xfb3faf[_0x866d('0x39')]=_0x128cf1;return _0xfb3faf;})['then'](respondWithFilteredResult(_0x2a2611,_0x5efd7b))[_0x866d('0x3a')](handleError(_0x2a2611,null));};exports['show']=function(_0x448a35,_0x5eaa90){var _0x28ceb9={'raw':!![],'where':{'id':_0x448a35['params']['id']}},_0x240c7c={};_0x240c7c[_0x866d('0x2c')]=_[_0x866d('0x3b')](db[_0x866d('0x27')][_0x866d('0x28')]);_0x240c7c['query']=_[_0x866d('0x3b')](_0x448a35[_0x866d('0x2d')]);_0x240c7c['filters']=_[_0x866d('0x2f')](_0x240c7c['model'],_0x240c7c['query']);_0x28ceb9[_0x866d('0x31')]=_[_0x866d('0x2f')](_0x240c7c[_0x866d('0x2c')],qs['fields'](_0x448a35[_0x866d('0x2d')][_0x866d('0x30')]));_0x28ceb9['attributes']=_0x28ceb9[_0x866d('0x31')]['length']?_0x28ceb9[_0x866d('0x31')]:_0x240c7c[_0x866d('0x2c')];if(_0x448a35[_0x866d('0x2d')][_0x866d('0x3c')]){_0x28ceb9[_0x866d('0x3d')]=[{'all':!![]}];}_0x28ceb9=_[_0x866d('0x37')]({},_0x28ceb9,_0x448a35[_0x866d('0x3e')]);return db['OpenchannelTransferReport'][_0x866d('0x3f')](_0x28ceb9)['then'](handleEntityNotFound(_0x5eaa90,null))[_0x866d('0x21')](respondWithResult(_0x5eaa90,null))[_0x866d('0x3a')](handleError(_0x5eaa90,null));};exports['create']=function(_0x30c5b7,_0x5422f6){return db[_0x866d('0x27')]['create'](_0x30c5b7[_0x866d('0x40')],{})[_0x866d('0x21')](respondWithResult(_0x5422f6,0xc9))['catch'](handleError(_0x5422f6,null));};exports[_0x866d('0x41')]=function(_0x14de3c,_0x5bc213){if(_0x14de3c[_0x866d('0x40')]['id']){delete _0x14de3c[_0x866d('0x40')]['id'];}return db[_0x866d('0x27')][_0x866d('0x3f')]({'where':{'id':_0x14de3c[_0x866d('0x42')]['id']}})['then'](handleEntityNotFound(_0x5bc213,null))[_0x866d('0x21')](saveUpdates(_0x14de3c[_0x866d('0x40')],null))[_0x866d('0x21')](respondWithResult(_0x5bc213,null))['catch'](handleError(_0x5bc213,null));};exports[_0x866d('0x43')]=function(_0x3fd12f,_0xa6766d){return db[_0x866d('0x27')][_0x866d('0x3f')]({'where':{'id':_0x3fd12f[_0x866d('0x42')]['id']}})[_0x866d('0x21')](handleEntityNotFound(_0xa6766d,null))['then'](removeEntity(_0xa6766d,null))[_0x866d('0x3a')](handleError(_0xa6766d,null));};exports[_0x866d('0x44')]=function(_0xf53b93,_0x422d8f){return db[_0x866d('0x27')][_0x866d('0x44')]()[_0x866d('0x21')](respondWithResult(_0x422d8f,null))['catch'](handleError(_0x422d8f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 711a43e..de69a79 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 _0xe7c9=['path','rimraf','./openchannelTransferReport.attributes','exports','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4c69d3,_0x49f5f6){var _0x618dd7=function(_0x462bbf){while(--_0x462bbf){_0x4c69d3['push'](_0x4c69d3['shift']());}};_0x618dd7(++_0x49f5f6);}(_0xe7c9,0x10e));var _0x9e7c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe7c9[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x9e7c('0x0'));var util=require(_0x9e7c('0x1'));var logger=require('../../config/logger')(_0x9e7c('0x2'));var moment=require(_0x9e7c('0x3'));var BPromise=require(_0x9e7c('0x4'));var rp=require(_0x9e7c('0x5'));var fs=require('fs');var path=require(_0x9e7c('0x6'));var rimraf=require(_0x9e7c('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e7c('0x8'));module[_0x9e7c('0x9')]=function(_0x302b22,_0x402771){return _0x302b22['define']('OpenchannelTransferReport',attributes,{'tableName':_0x9e7c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9e7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe216=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','uniqueid','lodash'];(function(_0x334c6a,_0x18a185){var _0x3d43f7=function(_0x223fa2){while(--_0x223fa2){_0x334c6a['push'](_0x334c6a['shift']());}};_0x3d43f7(++_0x18a185);}(_0xe216,0x112));var _0x6e21=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xe216[_0x421eeb];return _0x2c7371;};'use strict';var _=require(_0x6e21('0x0'));var util=require(_0x6e21('0x1'));var logger=require(_0x6e21('0x2'))(_0x6e21('0x3'));var moment=require(_0x6e21('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e21('0x5'));var rimraf=require(_0x6e21('0x6'));var config=require(_0x6e21('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6e21('0x8')]=function(_0x290896,_0x4d31cd){return _0x290896[_0x6e21('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6e21('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c15e0ec..5670e3e 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 _0x8c32=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x10b70c,_0x7eba93){var _0x3f779c=function(_0x2cb001){while(--_0x2cb001){_0x10b70c['push'](_0x10b70c['shift']());}};_0x3f779c(++_0x7eba93);}(_0x8c32,0x130));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rs=require(_0x28c3('0x4'));var fs=require('fs');var Redis=require(_0x28c3('0x5'));var db=require(_0x28c3('0x6'))['db'];var utils=require(_0x28c3('0x7'));var logger=require(_0x28c3('0x8'))(_0x28c3('0x9'));var config=require(_0x28c3('0xa'));var jayson=require(_0x28c3('0xb'));var client=jayson['client'][_0x28c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ed515,_0x2ce6c1,_0x482952){return new BPromise(function(_0xbaee6f,_0x2fb4cb){return client['request'](_0x4ed515,_0x482952)[_0x28c3('0xd')](function(_0x37bda3){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ce6c1,'request\x20sent');logger[_0x28c3('0xe')](_0x28c3('0xf'),_0x2ce6c1,'request\x20sent',JSON[_0x28c3('0x10')](_0x37bda3));if(_0x37bda3[_0x28c3('0x11')]){if(_0x37bda3[_0x28c3('0x11')]['code']===0x1f4){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x37bda3[_0x28c3('0x11')][_0x28c3('0x13')]);return _0x2fb4cb(_0x37bda3[_0x28c3('0x11')]['message']);}logger[_0x28c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ce6c1,_0x37bda3[_0x28c3('0x11')]['message']);return _0xbaee6f(_0x37bda3[_0x28c3('0x11')]['message']);}else{logger[_0x28c3('0x14')](_0x28c3('0x12'),_0x2ce6c1,'request\x20sent');_0xbaee6f(_0x37bda3[_0x28c3('0x15')]['message']);}})['catch'](function(_0x58e2b9){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x58e2b9);_0x2fb4cb(_0x58e2b9);});});} \ No newline at end of file +var _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5776f5,_0x159735){var _0x42221c=function(_0x3554de){while(--_0x3554de){_0x5776f5['push'](_0x5776f5['shift']());}};_0x42221c(++_0x159735);}(_0xf1e1,0x102));var _0x1f1e=function(_0x2a40b3,_0xe1c253){_0x2a40b3=_0x2a40b3-0x0;var _0x4ac6cb=_0xf1e1[_0x2a40b3];return _0x4ac6cb;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9c772ef..ce5e79f 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 _0xd79f=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2ee353,_0x4fb599){var _0x165ce6=function(_0x592945){while(--_0x592945){_0x2ee353['push'](_0x2ee353['shift']());}};_0x165ce6(++_0x4fb599);}(_0xd79f,0x1be));var _0xfd79=function(_0xff03c9,_0x53d47e){_0xff03c9=_0xff03c9-0x0;var _0x4bc893=_0xd79f[_0xff03c9];return _0x4bc893;};'use strict';var multer=require(_0xfd79('0x0'));var util=require(_0xfd79('0x1'));var path=require(_0xfd79('0x2'));var timeout=require(_0xfd79('0x3'));var express=require(_0xfd79('0x4'));var router=express[_0xfd79('0x5')]();var fs_extra=require(_0xfd79('0x6'));var auth=require(_0xfd79('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfd79('0x8'));var controller=require(_0xfd79('0x9'));router[_0xfd79('0xa')]('/',auth[_0xfd79('0xb')](),controller[_0xfd79('0xc')]);router[_0xfd79('0xa')](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0xe')]);router[_0xfd79('0xf')]('/',auth[_0xfd79('0xb')](),controller[_0xfd79('0x10')]);router[_0xfd79('0x11')](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0x12')]);router['delete'](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0x13')]);module[_0xfd79('0x14')]=router; \ No newline at end of file +var _0xa88b=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','show','create','/:id','isAuthenticated','update'];(function(_0x5fcd3,_0x4aa66f){var _0x44fd85=function(_0x56f95d){while(--_0x56f95d){_0x5fcd3['push'](_0x5fcd3['shift']());}};_0x44fd85(++_0x4aa66f);}(_0xa88b,0x157));var _0xba88=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xa88b[_0x172ed7];return _0xfa8f61;};'use strict';var multer=require(_0xba88('0x0'));var util=require(_0xba88('0x1'));var path=require(_0xba88('0x2'));var timeout=require(_0xba88('0x3'));var express=require(_0xba88('0x4'));var router=express[_0xba88('0x5')]();var fs_extra=require(_0xba88('0x6'));var auth=require(_0xba88('0x7'));var interaction=require(_0xba88('0x8'));var config=require(_0xba88('0x9'));var controller=require(_0xba88('0xa'));router[_0xba88('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba88('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xba88('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba88('0xd')]);router['put'](_0xba88('0xe'),auth[_0xba88('0xf')](),controller[_0xba88('0x10')]);router[_0xba88('0x11')](_0xba88('0xe'),auth['isAuthenticated'](),controller[_0xba88('0x12')]);module[_0xba88('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index fc25e96..c501b47 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 _0xa8e6=['name','sequelize','exports','STRING'];(function(_0x37b083,_0x188d8a){var _0x3cf208=function(_0x4490b0){while(--_0x4490b0){_0x37b083['push'](_0x37b083['shift']());}};_0x3cf208(++_0x188d8a);}(_0xa8e6,0xa5));var _0x6a8e=function(_0x2d798b,_0x3259ad){_0x2d798b=_0x2d798b-0x0;var _0x24a27d=_0xa8e6[_0x2d798b];return _0x24a27d;};'use strict';var Sequelize=require(_0x6a8e('0x0'));module[_0x6a8e('0x1')]={'name':{'type':Sequelize[_0x6a8e('0x2')],'unique':_0x6a8e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6a8e('0x2')]}}; \ No newline at end of file +var _0xeb57=['exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeb57,0x126));var _0x7eb5=function(_0x135cea,_0x5e4f4b){_0x135cea=_0x135cea-0x0;var _0x51bb04=_0xeb57[_0x135cea];return _0x51bb04;};'use strict';var Sequelize=require('sequelize');module[_0x7eb5('0x0')]={'name':{'type':Sequelize[_0x7eb5('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x7eb5('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b337a86..215ccea 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 _0x0e54=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Pauses','error','stack','name','send','map','Pause','fieldName','key','model','query','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','user','get'];(function(_0x3a0ecc,_0xb6a6a7){var _0x45f9bf=function(_0x528417){while(--_0x528417){_0x3a0ecc['push'](_0x3a0ecc['shift']());}};_0x45f9bf(++_0xb6a6a7);}(_0x0e54,0x147));var _0x40e5=function(_0x2b100c,_0x1da489){_0x2b100c=_0x2b100c-0x0;var _0x550694=_0x0e54[_0x2b100c];return _0x550694;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x40e5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40e5('0x1'));var moment=require('moment');var BPromise=require(_0x40e5('0x2'));var Mustache=require(_0x40e5('0x3'));var util=require(_0x40e5('0x4'));var path=require(_0x40e5('0x5'));var sox=require('sox');var csv=require(_0x40e5('0x6'));var ejs=require(_0x40e5('0x7'));var fs=require('fs');var fs_extra=require(_0x40e5('0x8'));var _=require(_0x40e5('0x9'));var squel=require(_0x40e5('0xa'));var crypto=require(_0x40e5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x40e5('0x6'));var querystring=require(_0x40e5('0xc'));var Papa=require(_0x40e5('0xd'));var Redis=require('ioredis');var authService=require(_0x40e5('0xe'));var qs=require(_0x40e5('0xf'));var as=require(_0x40e5('0x10'));var hardwareService=require(_0x40e5('0x11'));var logger=require(_0x40e5('0x12'))('api');var utils=require(_0x40e5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x40e5('0x14'));var db=require(_0x40e5('0x15'))['db'];function respondWithStatusCode(_0x58584c,_0x290816){_0x290816=_0x290816||0xcc;return function(_0x5aa9b6){if(_0x5aa9b6){return _0x58584c[_0x40e5('0x16')](_0x290816);}return _0x58584c[_0x40e5('0x17')](_0x290816)[_0x40e5('0x18')]();};}function respondWithResult(_0x35b1df,_0x1cb2b2){_0x1cb2b2=_0x1cb2b2||0xc8;return function(_0xf4e882){if(_0xf4e882){return _0x35b1df['status'](_0x1cb2b2)[_0x40e5('0x19')](_0xf4e882);}};}function respondWithFilteredResult(_0x43ad76,_0x15d8a2){return function(_0xe582c5){if(_0xe582c5){var _0x3c3589=typeof _0x15d8a2['offset']==='undefined'&&typeof _0x15d8a2['limit']===_0x40e5('0x1a');var _0x184413=_0xe582c5[_0x40e5('0x1b')];var _0x5f38c3=_0x3c3589?0x0:_0x15d8a2[_0x40e5('0x1c')];var _0x541fff=_0x3c3589?_0xe582c5['count']:_0x15d8a2[_0x40e5('0x1c')]+_0x15d8a2[_0x40e5('0x1d')];var _0x303a9d;if(_0x541fff>=_0x184413){_0x541fff=_0x184413;_0x303a9d=0xc8;}else{_0x303a9d=0xce;}_0x43ad76[_0x40e5('0x17')](_0x303a9d);return _0x43ad76[_0x40e5('0x1e')](_0x40e5('0x1f'),_0x5f38c3+'-'+_0x541fff+'/'+_0x184413)[_0x40e5('0x19')](_0xe582c5);}return null;};}function patchUpdates(_0xf3f3d8){return function(_0x1990f7){try{jsonpatch[_0x40e5('0x20')](_0x1990f7,_0xf3f3d8,!![]);}catch(_0x11000c){return BPromise[_0x40e5('0x21')](_0x11000c);}return _0x1990f7['save']();};}function saveUpdates(_0x4a23ef,_0x79fcd7){return function(_0x5ce91e){if(_0x5ce91e){return _0x5ce91e[_0x40e5('0x22')](_0x4a23ef)[_0x40e5('0x23')](function(_0x5bb0b0){return _0x5bb0b0;});}return null;};}function removeEntity(_0x3b334d,_0x2b6c7f){return function(_0x3e702b){if(_0x3e702b){return _0x3e702b[_0x40e5('0x24')]()[_0x40e5('0x23')](function(){var _0x225ab6=_0x3e702b['get']({'plain':!![]});var _0x52acf0=_0x40e5('0x25');return db['UserProfileResource'][_0x40e5('0x24')]({'where':{'type':_0x52acf0,'resourceId':_0x225ab6['id']}})[_0x40e5('0x23')](function(){return _0x3e702b;});})[_0x40e5('0x23')](function(){_0x3b334d[_0x40e5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccc2a,_0x15a3cd){return function(_0x1dfc31){if(!_0x1dfc31){_0x5ccc2a[_0x40e5('0x16')](0x194);}return _0x1dfc31;};}function handleError(_0x3283c7,_0x34ea40){_0x34ea40=_0x34ea40||0x1f4;return function(_0x4278c6){logger[_0x40e5('0x26')](_0x4278c6[_0x40e5('0x27')]);if(_0x4278c6['name']){delete _0x4278c6[_0x40e5('0x28')];}_0x3283c7['status'](_0x34ea40)[_0x40e5('0x29')](_0x4278c6);};}exports['index']=function(_0x4a1a0d,_0x5702d6){var _0x323dec={},_0x78276a={},_0x1d7262={'count':0x0,'rows':[]};var _0x19ee58=_[_0x40e5('0x2a')](db[_0x40e5('0x2b')]['rawAttributes'],function(_0x54dfbf){return{'name':_0x54dfbf[_0x40e5('0x2c')],'type':_0x54dfbf['type'][_0x40e5('0x2d')]};});_0x78276a[_0x40e5('0x2e')]=_[_0x40e5('0x2a')](_0x19ee58,_0x40e5('0x28'));_0x78276a[_0x40e5('0x2f')]=_['keys'](_0x4a1a0d[_0x40e5('0x2f')]);_0x78276a['filters']=_['intersection'](_0x78276a[_0x40e5('0x2e')],_0x78276a['query']);_0x323dec[_0x40e5('0x30')]=_[_0x40e5('0x31')](_0x78276a[_0x40e5('0x2e')],qs[_0x40e5('0x32')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x32')]));_0x323dec[_0x40e5('0x30')]=_0x323dec[_0x40e5('0x30')]['length']?_0x323dec[_0x40e5('0x30')]:_0x78276a[_0x40e5('0x2e')];if(!_0x4a1a0d['query']['hasOwnProperty'](_0x40e5('0x33'))){_0x323dec[_0x40e5('0x1d')]=qs[_0x40e5('0x1d')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x1d')]);_0x323dec[_0x40e5('0x1c')]=qs[_0x40e5('0x1c')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x1c')]);}_0x323dec['order']=qs[_0x40e5('0x34')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x34')]);_0x323dec[_0x40e5('0x35')]=qs[_0x40e5('0x36')](_['pick'](_0x4a1a0d[_0x40e5('0x2f')],_0x78276a[_0x40e5('0x36')]),_0x19ee58);if(_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x37')]){_0x323dec[_0x40e5('0x35')]=_[_0x40e5('0x38')](_0x323dec[_0x40e5('0x35')],{'$or':_[_0x40e5('0x2a')](_0x19ee58,function(_0x4da16a){if(_0x4da16a[_0x40e5('0x39')]!==_0x40e5('0x3a')){var _0x2eabd3={};_0x2eabd3[_0x4da16a[_0x40e5('0x28')]]={'$like':'%'+_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x37')]+'%'};return _0x2eabd3;}})});}_0x323dec=_[_0x40e5('0x38')]({},_0x323dec,_0x4a1a0d[_0x40e5('0x3b')]);var _0x49196c={'where':_0x323dec[_0x40e5('0x35')]};return db['Pause'][_0x40e5('0x1b')](_0x49196c)[_0x40e5('0x23')](function(_0x385c26){_0x1d7262['count']=_0x385c26;if(_0x4a1a0d['query']['includeAll']){_0x323dec[_0x40e5('0x3c')]=[{'all':!![]}];}return db[_0x40e5('0x2b')][_0x40e5('0x3d')](_0x323dec);})['then'](function(_0x59e03c){_0x1d7262['rows']=_0x59e03c;return _0x1d7262;})[_0x40e5('0x23')](respondWithFilteredResult(_0x5702d6,_0x323dec))[_0x40e5('0x3e')](handleError(_0x5702d6,null));};exports[_0x40e5('0x3f')]=function(_0x1538f9,_0x5cb9d4){var _0xab3c1b={'raw':!![],'where':{'id':_0x1538f9[_0x40e5('0x40')]['id']}},_0x294e0e={};_0x294e0e['model']=_[_0x40e5('0x41')](db[_0x40e5('0x2b')]['rawAttributes']);_0x294e0e[_0x40e5('0x2f')]=_[_0x40e5('0x41')](_0x1538f9[_0x40e5('0x2f')]);_0x294e0e[_0x40e5('0x36')]=_[_0x40e5('0x31')](_0x294e0e[_0x40e5('0x2e')],_0x294e0e['query']);_0xab3c1b[_0x40e5('0x30')]=_[_0x40e5('0x31')](_0x294e0e['model'],qs['fields'](_0x1538f9['query']['fields']));_0xab3c1b[_0x40e5('0x30')]=_0xab3c1b[_0x40e5('0x30')][_0x40e5('0x42')]?_0xab3c1b['attributes']:_0x294e0e[_0x40e5('0x2e')];if(_0x1538f9[_0x40e5('0x2f')][_0x40e5('0x43')]){_0xab3c1b[_0x40e5('0x3c')]=[{'all':!![]}];}_0xab3c1b=_[_0x40e5('0x38')]({},_0xab3c1b,_0x1538f9[_0x40e5('0x3b')]);return db[_0x40e5('0x2b')][_0x40e5('0x44')](_0xab3c1b)[_0x40e5('0x23')](handleEntityNotFound(_0x5cb9d4,null))[_0x40e5('0x23')](respondWithResult(_0x5cb9d4,null))[_0x40e5('0x3e')](handleError(_0x5cb9d4,null));};exports[_0x40e5('0x45')]=function(_0xd2d41d,_0x1d8a11){return db[_0x40e5('0x2b')][_0x40e5('0x45')](_0xd2d41d[_0x40e5('0x46')],{})[_0x40e5('0x23')](function(_0x1716c9){var _0x1219cc=_0xd2d41d[_0x40e5('0x47')][_0x40e5('0x48')]({'plain':!![]});if(!_0x1219cc)throw new Error(_0x40e5('0x49'));if(_0x1219cc[_0x40e5('0x4a')]===_0x40e5('0x47')){var _0x420925=_0x1716c9[_0x40e5('0x48')]({'plain':!![]});var _0x488d07=_0x40e5('0x25');return db[_0x40e5('0x4b')][_0x40e5('0x44')]({'where':{'name':_0x488d07,'userProfileId':_0x1219cc[_0x40e5('0x4c')]},'raw':!![]})['then'](function(_0x1c0bdd){if(_0x1c0bdd&&_0x1c0bdd[_0x40e5('0x4d')]===0x0){return db[_0x40e5('0x4e')]['create']({'name':_0x420925[_0x40e5('0x28')],'resourceId':_0x420925['id'],'type':_0x1c0bdd[_0x40e5('0x28')],'sectionId':_0x1c0bdd['id']},{})[_0x40e5('0x23')](function(){return _0x1716c9;});}else{return _0x1716c9;}})[_0x40e5('0x3e')](function(_0x27bde7){logger[_0x40e5('0x26')](_0x40e5('0x4f'),_0x27bde7);throw _0x27bde7;});}return _0x1716c9;})['then'](respondWithResult(_0x1d8a11,0xc9))[_0x40e5('0x3e')](handleError(_0x1d8a11,null));};exports[_0x40e5('0x22')]=function(_0x59a423,_0x26f5bc){if(_0x59a423[_0x40e5('0x46')]['id']){delete _0x59a423[_0x40e5('0x46')]['id'];}return db[_0x40e5('0x2b')][_0x40e5('0x44')]({'where':{'id':_0x59a423[_0x40e5('0x40')]['id']}})['then'](handleEntityNotFound(_0x26f5bc,null))[_0x40e5('0x23')](saveUpdates(_0x59a423['body'],null))[_0x40e5('0x23')](respondWithResult(_0x26f5bc,null))[_0x40e5('0x3e')](handleError(_0x26f5bc,null));};exports[_0x40e5('0x24')]=function(_0x3e299c,_0x121346){return db[_0x40e5('0x2b')][_0x40e5('0x44')]({'where':{'id':_0x3e299c[_0x40e5('0x40')]['id']}})[_0x40e5('0x23')](handleEntityNotFound(_0x121346,null))[_0x40e5('0x23')](removeEntity(_0x121346,null))[_0x40e5('0x3e')](handleError(_0x121346,null));}; \ No newline at end of file +var _0x4c45=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort'];(function(_0x3c4567,_0x50cdf4){var _0x2e2881=function(_0x4f79b0){while(--_0x4f79b0){_0x3c4567['push'](_0x3c4567['shift']());}};_0x2e2881(++_0x50cdf4);}(_0x4c45,0x171));var _0x54c4=function(_0x6b6d09,_0xc0dc47){_0x6b6d09=_0x6b6d09-0x0;var _0x320edb=_0x4c45[_0x6b6d09];return _0x320edb;};'use strict';var emlformat=require(_0x54c4('0x0'));var rimraf=require(_0x54c4('0x1'));var zipdir=require(_0x54c4('0x2'));var jsonpatch=require(_0x54c4('0x3'));var rp=require('request-promise');var moment=require(_0x54c4('0x4'));var BPromise=require(_0x54c4('0x5'));var Mustache=require(_0x54c4('0x6'));var util=require(_0x54c4('0x7'));var path=require(_0x54c4('0x8'));var sox=require(_0x54c4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x54c4('0xa'));var squel=require(_0x54c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x54c4('0xc'));var deskjs=require(_0x54c4('0xd'));var toCsv=require(_0x54c4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x54c4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x54c4('0x10'));var as=require(_0x54c4('0x11'));var hardwareService=require(_0x54c4('0x12'));var logger=require(_0x54c4('0x13'))(_0x54c4('0x14'));var utils=require(_0x54c4('0x15'));var config=require(_0x54c4('0x16'));var licenseUtil=require(_0x54c4('0x17'));var db=require(_0x54c4('0x18'))['db'];function respondWithStatusCode(_0x2696ca,_0x425687){_0x425687=_0x425687||0xcc;return function(_0x2b7e44){if(_0x2b7e44){return _0x2696ca[_0x54c4('0x19')](_0x425687);}return _0x2696ca[_0x54c4('0x1a')](_0x425687)[_0x54c4('0x1b')]();};}function respondWithResult(_0x8459a2,_0x392879){_0x392879=_0x392879||0xc8;return function(_0xd4db1){if(_0xd4db1){return _0x8459a2[_0x54c4('0x1a')](_0x392879)[_0x54c4('0x1c')](_0xd4db1);}};}function respondWithFilteredResult(_0x53b224,_0x2452cc){return function(_0x2a8aa1){if(_0x2a8aa1){var _0x34dfcc=typeof _0x2452cc[_0x54c4('0x1d')]===_0x54c4('0x1e')&&typeof _0x2452cc[_0x54c4('0x1f')]===_0x54c4('0x1e');var _0x64de35=_0x2a8aa1['count'];var _0x30ad2e=_0x34dfcc?0x0:_0x2452cc['offset'];var _0x16dcc5=_0x34dfcc?_0x2a8aa1[_0x54c4('0x20')]:_0x2452cc['offset']+_0x2452cc[_0x54c4('0x1f')];var _0x25a3ad;if(_0x16dcc5>=_0x64de35){_0x16dcc5=_0x64de35;_0x25a3ad=0xc8;}else{_0x25a3ad=0xce;}_0x53b224[_0x54c4('0x1a')](_0x25a3ad);return _0x53b224[_0x54c4('0x21')]('Content-Range',_0x30ad2e+'-'+_0x16dcc5+'/'+_0x64de35)['json'](_0x2a8aa1);}return null;};}function patchUpdates(_0x5a7a2e){return function(_0x4f167c){try{jsonpatch[_0x54c4('0x22')](_0x4f167c,_0x5a7a2e,!![]);}catch(_0x101a2b){return BPromise[_0x54c4('0x23')](_0x101a2b);}return _0x4f167c[_0x54c4('0x24')]();};}function saveUpdates(_0x2daa5c,_0x2e4963){return function(_0x39886d){if(_0x39886d){return _0x39886d[_0x54c4('0x25')](_0x2daa5c)[_0x54c4('0x26')](function(_0x10961c){return _0x10961c;});}return null;};}function removeEntity(_0x3d5b1b,_0x4a776d){return function(_0x1fde24){if(_0x1fde24){return _0x1fde24[_0x54c4('0x27')]()[_0x54c4('0x26')](function(){var _0x208550=_0x1fde24[_0x54c4('0x28')]({'plain':!![]});var _0x99c2b2=_0x54c4('0x29');return db[_0x54c4('0x2a')][_0x54c4('0x27')]({'where':{'type':_0x99c2b2,'resourceId':_0x208550['id']}})['then'](function(){return _0x1fde24;});})['then'](function(){_0x3d5b1b[_0x54c4('0x1a')](0xcc)[_0x54c4('0x1b')]();});}};}function handleEntityNotFound(_0x30f7f2,_0x555b79){return function(_0xf606ae){if(!_0xf606ae){_0x30f7f2['sendStatus'](0x194);}return _0xf606ae;};}function handleError(_0xae4d7b,_0x385e49){_0x385e49=_0x385e49||0x1f4;return function(_0x805de5){logger[_0x54c4('0x2b')](_0x805de5[_0x54c4('0x2c')]);if(_0x805de5['name']){delete _0x805de5[_0x54c4('0x2d')];}_0xae4d7b[_0x54c4('0x1a')](_0x385e49)[_0x54c4('0x2e')](_0x805de5);};}exports[_0x54c4('0x2f')]=function(_0x99fe9e,_0x172219){var _0x4d77fe={},_0x4b3384={},_0x404feb={'count':0x0,'rows':[]};var _0x38735e=_[_0x54c4('0x30')](db[_0x54c4('0x31')][_0x54c4('0x32')],function(_0x2077a1){return{'name':_0x2077a1[_0x54c4('0x33')],'type':_0x2077a1[_0x54c4('0x34')][_0x54c4('0x35')]};});_0x4b3384['model']=_[_0x54c4('0x30')](_0x38735e,_0x54c4('0x2d'));_0x4b3384[_0x54c4('0x36')]=_[_0x54c4('0x37')](_0x99fe9e[_0x54c4('0x36')]);_0x4b3384[_0x54c4('0x38')]=_[_0x54c4('0x39')](_0x4b3384['model'],_0x4b3384[_0x54c4('0x36')]);_0x4d77fe[_0x54c4('0x3a')]=_['intersection'](_0x4b3384['model'],qs[_0x54c4('0x3b')](_0x99fe9e[_0x54c4('0x36')]['fields']));_0x4d77fe[_0x54c4('0x3a')]=_0x4d77fe[_0x54c4('0x3a')][_0x54c4('0x3c')]?_0x4d77fe['attributes']:_0x4b3384[_0x54c4('0x3d')];if(!_0x99fe9e['query'][_0x54c4('0x3e')](_0x54c4('0x3f'))){_0x4d77fe['limit']=qs[_0x54c4('0x1f')](_0x99fe9e[_0x54c4('0x36')][_0x54c4('0x1f')]);_0x4d77fe[_0x54c4('0x1d')]=qs[_0x54c4('0x1d')](_0x99fe9e[_0x54c4('0x36')][_0x54c4('0x1d')]);}_0x4d77fe[_0x54c4('0x40')]=qs[_0x54c4('0x41')](_0x99fe9e['query'][_0x54c4('0x41')]);_0x4d77fe[_0x54c4('0x42')]=qs[_0x54c4('0x38')](_[_0x54c4('0x43')](_0x99fe9e[_0x54c4('0x36')],_0x4b3384['filters']),_0x38735e);if(_0x99fe9e[_0x54c4('0x36')][_0x54c4('0x44')]){_0x4d77fe['where']=_[_0x54c4('0x45')](_0x4d77fe[_0x54c4('0x42')],{'$or':_[_0x54c4('0x30')](_0x38735e,function(_0x497603){if(_0x497603[_0x54c4('0x34')]!==_0x54c4('0x46')){var _0x118747={};_0x118747[_0x497603[_0x54c4('0x2d')]]={'$like':'%'+_0x99fe9e[_0x54c4('0x36')][_0x54c4('0x44')]+'%'};return _0x118747;}})});}_0x4d77fe=_[_0x54c4('0x45')]({},_0x4d77fe,_0x99fe9e[_0x54c4('0x47')]);var _0x31a5b1={'where':_0x4d77fe['where']};return db[_0x54c4('0x31')][_0x54c4('0x20')](_0x31a5b1)[_0x54c4('0x26')](function(_0x4b1d23){_0x404feb[_0x54c4('0x20')]=_0x4b1d23;if(_0x99fe9e[_0x54c4('0x36')][_0x54c4('0x48')]){_0x4d77fe[_0x54c4('0x49')]=[{'all':!![]}];}return db[_0x54c4('0x31')]['findAll'](_0x4d77fe);})['then'](function(_0x44da62){_0x404feb[_0x54c4('0x4a')]=_0x44da62;return _0x404feb;})['then'](respondWithFilteredResult(_0x172219,_0x4d77fe))[_0x54c4('0x4b')](handleError(_0x172219,null));};exports[_0x54c4('0x4c')]=function(_0x51152f,_0xa4fa6c){var _0x180dea={'raw':!![],'where':{'id':_0x51152f[_0x54c4('0x4d')]['id']}},_0x4cb293={};_0x4cb293[_0x54c4('0x3d')]=_[_0x54c4('0x37')](db[_0x54c4('0x31')]['rawAttributes']);_0x4cb293[_0x54c4('0x36')]=_[_0x54c4('0x37')](_0x51152f[_0x54c4('0x36')]);_0x4cb293[_0x54c4('0x38')]=_[_0x54c4('0x39')](_0x4cb293[_0x54c4('0x3d')],_0x4cb293['query']);_0x180dea[_0x54c4('0x3a')]=_[_0x54c4('0x39')](_0x4cb293['model'],qs[_0x54c4('0x3b')](_0x51152f[_0x54c4('0x36')]['fields']));_0x180dea[_0x54c4('0x3a')]=_0x180dea[_0x54c4('0x3a')][_0x54c4('0x3c')]?_0x180dea[_0x54c4('0x3a')]:_0x4cb293[_0x54c4('0x3d')];if(_0x51152f[_0x54c4('0x36')][_0x54c4('0x48')]){_0x180dea['include']=[{'all':!![]}];}_0x180dea=_['merge']({},_0x180dea,_0x51152f['options']);return db[_0x54c4('0x31')][_0x54c4('0x4e')](_0x180dea)[_0x54c4('0x26')](handleEntityNotFound(_0xa4fa6c,null))[_0x54c4('0x26')](respondWithResult(_0xa4fa6c,null))['catch'](handleError(_0xa4fa6c,null));};exports['create']=function(_0x87cf13,_0x194987){return db[_0x54c4('0x31')]['create'](_0x87cf13['body'],{})[_0x54c4('0x26')](function(_0x2700ca){var _0x3a7633=_0x87cf13[_0x54c4('0x4f')][_0x54c4('0x28')]({'plain':!![]});if(!_0x3a7633)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a7633[_0x54c4('0x50')]==='user'){var _0x2c5955=_0x2700ca[_0x54c4('0x28')]({'plain':!![]});var _0x100fc7='Pauses';return db[_0x54c4('0x51')][_0x54c4('0x4e')]({'where':{'name':_0x100fc7,'userProfileId':_0x3a7633[_0x54c4('0x52')]},'raw':!![]})[_0x54c4('0x26')](function(_0x35621e){if(_0x35621e&&_0x35621e[_0x54c4('0x53')]===0x0){return db['UserProfileResource'][_0x54c4('0x54')]({'name':_0x2c5955[_0x54c4('0x2d')],'resourceId':_0x2c5955['id'],'type':_0x35621e['name'],'sectionId':_0x35621e['id']},{})[_0x54c4('0x26')](function(){return _0x2700ca;});}else{return _0x2700ca;}})['catch'](function(_0x597311){logger['error'](_0x54c4('0x55'),_0x597311);throw _0x597311;});}return _0x2700ca;})[_0x54c4('0x26')](respondWithResult(_0x194987,0xc9))[_0x54c4('0x4b')](handleError(_0x194987,null));};exports['update']=function(_0x3b5d32,_0x5ed5c9){if(_0x3b5d32['body']['id']){delete _0x3b5d32['body']['id'];}return db[_0x54c4('0x31')]['find']({'where':{'id':_0x3b5d32[_0x54c4('0x4d')]['id']}})[_0x54c4('0x26')](handleEntityNotFound(_0x5ed5c9,null))[_0x54c4('0x26')](saveUpdates(_0x3b5d32[_0x54c4('0x56')],null))[_0x54c4('0x26')](respondWithResult(_0x5ed5c9,null))[_0x54c4('0x4b')](handleError(_0x5ed5c9,null));};exports[_0x54c4('0x27')]=function(_0x1baf15,_0x4ee315){return db[_0x54c4('0x31')][_0x54c4('0x4e')]({'where':{'id':_0x1baf15[_0x54c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ee315,null))['then'](removeEntity(_0x4ee315,null))['catch'](handleError(_0x4ee315,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index eb9e449..f1323f4 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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 +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 40e2662..80d451c 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x40c4da,_0x3364ff){var _0x13e776=function(_0x3c1919){while(--_0x3c1919){_0x40c4da['push'](_0x40c4da['shift']());}};_0x13e776(++_0x3364ff);}(_0x7a54,0x106));var _0x47a5=function(_0x13c890,_0x335b8f){_0x13c890=_0x13c890-0x0;var _0x57a2e2=_0x7a54[_0x13c890];return _0x57a2e2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x79e09e,_0x4dfc94){var _0x469310=function(_0x3fa7d4){while(--_0x3fa7d4){_0x79e09e['push'](_0x79e09e['shift']());}};_0x469310(++_0x4dfc94);}(_0xb10b,0x12a));var _0xbb10=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0xb10b[_0x23118b];return _0x3636cf;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 09f3a8e..7e8a543 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 _0x222f=['index','webhookGet','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x222f,0x1a4));var _0xf222=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0x222f[_0x582d5a];return _0x5625ef;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./plugin.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/webhook',controller[_0xf222('0xa')]);router[_0xf222('0x8')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0xc')]);router[_0xf222('0x8')](_0xf222('0xd'),auth[_0xf222('0xb')](),controller[_0xf222('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e29ad,_0x405080,_0x226dbd){_0x226dbd(null,path[_0xf222('0xf')](config['root'],_0xf222('0x10')));},'filename':function(_0x2850c7,_0x2a6965,_0x3d3d29){_0x2a6965[_0xf222('0x11')]=_0x2a6965[_0xf222('0x11')][_0xf222('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3d29(null,util[_0xf222('0x13')]('%s-%s%s',path['basename'](_0x2a6965[_0xf222('0x11')],path[_0xf222('0x14')](_0x2a6965['originalname'])),Date[_0xf222('0x15')](),path[_0xf222('0x14')](_0x2a6965[_0xf222('0x11')])));}})});router[_0xf222('0x16')]('/',upload[_0xf222('0x17')](_0xf222('0x18')),controller[_0xf222('0x19')]);router['post'](_0xf222('0x1a'),controller[_0xf222('0x1b')]);router[_0xf222('0x1c')](_0xf222('0x1d'),auth[_0xf222('0xb')](),controller[_0xf222('0x1e')]);router[_0xf222('0x1f')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0x1f')]);module[_0xf222('0x20')]=router; \ No newline at end of file +var _0x702d=['/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','upload','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/webhook','isAuthenticated','show'];(function(_0x5c3edc,_0x50bcc8){var _0x1eaf77=function(_0x3359aa){while(--_0x3359aa){_0x5c3edc['push'](_0x5c3edc['shift']());}};_0x1eaf77(++_0x50bcc8);}(_0x702d,0x147));var _0xd702=function(_0x1bab1a,_0x359963){_0x1bab1a=_0x1bab1a-0x0;var _0x1a1862=_0x702d[_0x1bab1a];return _0x1a1862;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./plugin.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),controller['webhookGet']);router[_0xd702('0x9')]('/:id',auth[_0xd702('0xc')](),controller[_0xd702('0xd')]);router[_0xd702('0x9')](_0xd702('0xe'),auth[_0xd702('0xc')](),controller[_0xd702('0xf')]);var upload=multer({'storage':multer[_0xd702('0x10')]({'destination':function(_0x1988eb,_0x5907cf,_0x15a632){_0x15a632(null,path['join'](config['root'],_0xd702('0x11')));},'filename':function(_0x42e1ad,_0x273577,_0x5c0dad){_0x273577[_0xd702('0x12')]=_0x273577[_0xd702('0x12')][_0xd702('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c0dad(null,util[_0xd702('0x14')](_0xd702('0x15'),path[_0xd702('0x16')](_0x273577['originalname'],path[_0xd702('0x17')](_0x273577[_0xd702('0x12')])),Date['now'](),path[_0xd702('0x17')](_0x273577['originalname'])));}})});router[_0xd702('0x18')]('/',upload[_0xd702('0x19')]('file'),controller[_0xd702('0x1a')]);router[_0xd702('0x18')](_0xd702('0xb'),controller['webhookPost']);router['put'](_0xd702('0x1b'),auth['isAuthenticated'](),controller[_0xd702('0x1c')]);router[_0xd702('0x1d')](_0xd702('0x1b'),auth[_0xd702('0xc')](),controller[_0xd702('0x1d')]);module[_0xd702('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6f1d74d..6501775 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 _0x79af=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79af,0x99));var _0xf79a=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x79af[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0xf79a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xf79a('0x1'),_0xf79a('0x2'))},'description':{'type':Sequelize[_0xf79a('0x3')]},'version':{'type':Sequelize[_0xf79a('0x3')]},'path':{'type':Sequelize[_0xf79a('0x4')],'comment':_0xf79a('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf79a('0x6')},'sidebar':{'type':Sequelize[_0xf79a('0x7')]('adminOnly','agentOnly',_0xf79a('0x8'),_0xf79a('0x9')),'defaultValue':_0xf79a('0x8'),'comment':_0xf79a('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xf79a('0x4')]},'agentUrl':{'type':Sequelize[_0xf79a('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf79a('0x4')]}}; \ No newline at end of file +var _0x125b=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x125b,0xa3));var _0xb125=function(_0x346f31,_0x20a676){_0x346f31=_0x346f31-0x0;var _0x2bf8fc=_0x125b[_0x346f31];return _0x2bf8fc;};'use strict';var Sequelize=require(_0xb125('0x0'));module[_0xb125('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xb125('0x2'),_0xb125('0x3'))},'description':{'type':Sequelize[_0xb125('0x4')]},'version':{'type':Sequelize[_0xb125('0x4')]},'path':{'type':Sequelize[_0xb125('0x5')],'comment':_0xb125('0x6')},'active':{'type':Sequelize[_0xb125('0x7')],'defaultValue':0x0,'comment':_0xb125('0x8')},'sidebar':{'type':Sequelize[_0xb125('0x9')](_0xb125('0xa'),_0xb125('0xb'),_0xb125('0xc'),_0xb125('0xd')),'defaultValue':_0xb125('0xc'),'comment':_0xb125('0xe')},'icon':{'type':Sequelize[_0xb125('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xb125('0x5')]},'scriptName':{'type':Sequelize[_0xb125('0x5')]},'scriptPath':{'type':Sequelize[_0xb125('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a7e2a27..08a81f5 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 _0x2188=['offset','undefined','limit','count','status','Content-Range','reject','save','update','then','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','rows','params','keys','include','merge','find','catch','download','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','content-type','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','./plugin.socket','register','sendStatus','json'];(function(_0x21c3e5,_0x4e57da){var _0x6f4453=function(_0x29e920){while(--_0x29e920){_0x21c3e5['push'](_0x21c3e5['shift']());}};_0x6f4453(++_0x4e57da);}(_0x2188,0x140));var _0x8218=function(_0x42e1c8,_0x3c967e){_0x42e1c8=_0x42e1c8-0x0;var _0x36e470=_0x2188[_0x42e1c8];return _0x36e470;};'use strict';var emlformat=require(_0x8218('0x0'));var rimraf=require(_0x8218('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8218('0x2'));var rp=require(_0x8218('0x3'));var moment=require('moment');var BPromise=require(_0x8218('0x4'));var Mustache=require(_0x8218('0x5'));var util=require(_0x8218('0x6'));var path=require(_0x8218('0x7'));var sox=require(_0x8218('0x8'));var csv=require(_0x8218('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8218('0xa'));var squel=require(_0x8218('0xb'));var crypto=require(_0x8218('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8218('0xd'));var toCsv=require(_0x8218('0x9'));var querystring=require('querystring');var Papa=require(_0x8218('0xe'));var extract=require(_0x8218('0xf'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x8218('0x10'));var authService=require(_0x8218('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8218('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8218('0x13'));var utils=require(_0x8218('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8218('0x15')]=_[_0x8218('0x16')](config[_0x8218('0x15')],{'host':_0x8218('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8218('0x18'))[_0x8218('0x19')](socket);function respondWithStatusCode(_0x5b814f,_0x14b7f5){_0x14b7f5=_0x14b7f5||0xcc;return function(_0x17c59d){if(_0x17c59d){return _0x5b814f[_0x8218('0x1a')](_0x14b7f5);}return _0x5b814f['status'](_0x14b7f5)['end']();};}function respondWithResult(_0x53101d,_0x1eed76){_0x1eed76=_0x1eed76||0xc8;return function(_0x567849){if(_0x567849){return _0x53101d['status'](_0x1eed76)[_0x8218('0x1b')](_0x567849);}};}function respondWithFilteredResult(_0x3c11e3,_0x46ee02){return function(_0x336186){if(_0x336186){var _0x41a9b8=typeof _0x46ee02[_0x8218('0x1c')]===_0x8218('0x1d')&&typeof _0x46ee02[_0x8218('0x1e')]===_0x8218('0x1d');var _0x32d671=_0x336186[_0x8218('0x1f')];var _0x13bd4b=_0x41a9b8?0x0:_0x46ee02[_0x8218('0x1c')];var _0xbf8263=_0x41a9b8?_0x336186['count']:_0x46ee02[_0x8218('0x1c')]+_0x46ee02[_0x8218('0x1e')];var _0x3b611c;if(_0xbf8263>=_0x32d671){_0xbf8263=_0x32d671;_0x3b611c=0xc8;}else{_0x3b611c=0xce;}_0x3c11e3[_0x8218('0x20')](_0x3b611c);return _0x3c11e3['set'](_0x8218('0x21'),_0x13bd4b+'-'+_0xbf8263+'/'+_0x32d671)[_0x8218('0x1b')](_0x336186);}return null;};}function patchUpdates(_0x309ad8){return function(_0x1724aa){try{jsonpatch['apply'](_0x1724aa,_0x309ad8,!![]);}catch(_0x289232){return BPromise[_0x8218('0x22')](_0x289232);}return _0x1724aa[_0x8218('0x23')]();};}function saveUpdates(_0x3b8b24,_0x52aebc){return function(_0x67d15b){if(_0x67d15b){return _0x67d15b[_0x8218('0x24')](_0x3b8b24)[_0x8218('0x25')](function(_0x4c7a58){return _0x4c7a58;});}return null;};}function removeEntity(_0x59b482,_0xf9480c){return function(_0x817744){if(_0x817744){return _0x817744['destroy']()[_0x8218('0x25')](function(){var _0x19b080=_0x817744['get']({'plain':!![]});var _0x57945d=_0x8218('0x26');return db[_0x8218('0x27')][_0x8218('0x28')]({'where':{'type':_0x57945d,'resourceId':_0x19b080['id']}})[_0x8218('0x25')](function(){return _0x817744;});})[_0x8218('0x25')](function(){_0x59b482[_0x8218('0x20')](0xcc)[_0x8218('0x29')]();});}};}function handleEntityNotFound(_0xaab7ed,_0x18dfd7){return function(_0x4072ff){if(!_0x4072ff){_0xaab7ed[_0x8218('0x1a')](0x194);}return _0x4072ff;};}function handleError(_0x1385d9,_0x2887fa){_0x2887fa=_0x2887fa||0x1f4;return function(_0x122317){logger[_0x8218('0x2a')](_0x122317[_0x8218('0x2b')]);if(_0x122317[_0x8218('0x2c')]){delete _0x122317[_0x8218('0x2c')];}_0x1385d9[_0x8218('0x20')](_0x2887fa)[_0x8218('0x2d')](_0x122317);};}exports[_0x8218('0x2e')]=function(_0x4b1a86,_0x3f8a31){var _0x362226={},_0x27147={},_0x2b8754={'count':0x0,'rows':[]};var _0x24c86f=_[_0x8218('0x2f')](db[_0x8218('0x30')][_0x8218('0x31')],function(_0xd8478d){return{'name':_0xd8478d['fieldName'],'type':_0xd8478d['type'][_0x8218('0x32')]};});_0x27147[_0x8218('0x33')]=_['map'](_0x24c86f,_0x8218('0x2c'));_0x27147['query']=_['keys'](_0x4b1a86[_0x8218('0x34')]);_0x27147[_0x8218('0x35')]=_[_0x8218('0x36')](_0x27147['model'],_0x27147[_0x8218('0x34')]);_0x362226[_0x8218('0x37')]=_[_0x8218('0x36')](_0x27147[_0x8218('0x33')],qs[_0x8218('0x38')](_0x4b1a86['query'][_0x8218('0x38')]));_0x362226['attributes']=_0x362226[_0x8218('0x37')][_0x8218('0x39')]?_0x362226[_0x8218('0x37')]:_0x27147[_0x8218('0x33')];if(!_0x4b1a86[_0x8218('0x34')][_0x8218('0x3a')](_0x8218('0x3b'))){_0x362226[_0x8218('0x1e')]=qs[_0x8218('0x1e')](_0x4b1a86[_0x8218('0x34')][_0x8218('0x1e')]);_0x362226[_0x8218('0x1c')]=qs[_0x8218('0x1c')](_0x4b1a86[_0x8218('0x34')][_0x8218('0x1c')]);}_0x362226[_0x8218('0x3c')]=qs['sort'](_0x4b1a86[_0x8218('0x34')][_0x8218('0x3d')]);_0x362226['where']=qs[_0x8218('0x35')](_[_0x8218('0x3e')](_0x4b1a86['query'],_0x27147['filters']),_0x24c86f);if(_0x4b1a86[_0x8218('0x34')][_0x8218('0x3f')]){_0x362226[_0x8218('0x40')]=_['merge'](_0x362226[_0x8218('0x40')],{'$or':_['map'](_0x24c86f,function(_0x58b701){if(_0x58b701[_0x8218('0x41')]!==_0x8218('0x42')){var _0x593547={};_0x593547[_0x58b701[_0x8218('0x2c')]]={'$like':'%'+_0x4b1a86['query'][_0x8218('0x3f')]+'%'};return _0x593547;}})});}_0x362226=_['merge']({},_0x362226,_0x4b1a86[_0x8218('0x43')]);var _0x2c7b66={'where':_0x362226['where']};return db[_0x8218('0x30')][_0x8218('0x1f')](_0x2c7b66)[_0x8218('0x25')](function(_0x171b7f){_0x2b8754[_0x8218('0x1f')]=_0x171b7f;if(_0x4b1a86[_0x8218('0x34')][_0x8218('0x44')]){_0x362226['include']=[{'all':!![]}];}return db[_0x8218('0x30')]['findAll'](_0x362226);})['then'](function(_0x266428){_0x2b8754[_0x8218('0x45')]=_0x266428;return _0x2b8754;})[_0x8218('0x25')](respondWithFilteredResult(_0x3f8a31,_0x362226))['catch'](handleError(_0x3f8a31,null));};exports['show']=function(_0x5bf99c,_0xbbc35b){var _0x4e1c3a={'raw':!![],'where':{'id':_0x5bf99c[_0x8218('0x46')]['id']}},_0x360a2b={};_0x360a2b[_0x8218('0x33')]=_[_0x8218('0x47')](db[_0x8218('0x30')]['rawAttributes']);_0x360a2b[_0x8218('0x34')]=_[_0x8218('0x47')](_0x5bf99c[_0x8218('0x34')]);_0x360a2b[_0x8218('0x35')]=_[_0x8218('0x36')](_0x360a2b[_0x8218('0x33')],_0x360a2b['query']);_0x4e1c3a[_0x8218('0x37')]=_[_0x8218('0x36')](_0x360a2b[_0x8218('0x33')],qs[_0x8218('0x38')](_0x5bf99c[_0x8218('0x34')][_0x8218('0x38')]));_0x4e1c3a[_0x8218('0x37')]=_0x4e1c3a[_0x8218('0x37')]['length']?_0x4e1c3a['attributes']:_0x360a2b['model'];if(_0x5bf99c[_0x8218('0x34')][_0x8218('0x44')]){_0x4e1c3a[_0x8218('0x48')]=[{'all':!![]}];}_0x4e1c3a=_[_0x8218('0x49')]({},_0x4e1c3a,_0x5bf99c[_0x8218('0x43')]);return db[_0x8218('0x30')][_0x8218('0x4a')](_0x4e1c3a)[_0x8218('0x25')](handleEntityNotFound(_0xbbc35b,null))[_0x8218('0x25')](respondWithResult(_0xbbc35b,null))[_0x8218('0x4b')](handleError(_0xbbc35b,null));};exports[_0x8218('0x4c')]=function(_0x3110db,_0x272c65,_0x429791){return db[_0x8218('0x30')][_0x8218('0x4a')]({'where':{'id':_0x3110db[_0x8218('0x46')]['id']},'attributes':[_0x8218('0x2c'),_0x8218('0x7')],'raw':!![]})[_0x8218('0x25')](handleEntityNotFound(_0x272c65,null))[_0x8218('0x25')](function(_0x454ffe){if(_0x454ffe){var _0x2c2f87=path[_0x8218('0x4d')](config[_0x8218('0x4e')],'server/files/plugins',util['format'](_0x8218('0x4f'),path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')])));var _0x257919=fs[_0x8218('0x51')](_0x2c2f87);var _0x3118a8=archiver(_0x8218('0x52'),{'zlib':{'level':0x9}});_0x3118a8['on'](_0x8218('0x53'),function(_0x1957fe){if(_0x1957fe[_0x8218('0x54')]===_0x8218('0x55')){logger[_0x8218('0x2a')](_0x1957fe);}else{throw new db[(_0x8218('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x3118a8['on'](_0x8218('0x2a'),function(_0x1d8e8e){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x58'));});_0x3118a8[_0x8218('0x59')](_0x257919);_0x3118a8[_0x8218('0x5a')](_0x8218('0x5b'),{'cwd':path[_0x8218('0x4d')](config['root'],_0x8218('0x5c'),path[_0x8218('0x5d')](_0x454ffe['path'])),'ignore':[path['join'](path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')]),_0x8218('0x5e')),path[_0x8218('0x4d')](path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')]),_0x8218('0x5f'))],'nodir':!![]})[_0x8218('0x60')]();_0x257919['on'](_0x8218('0x61'),function(){if(!fs['existsSync'](_0x2c2f87)){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x62'));}return _0x272c65['download'](_0x2c2f87,util[_0x8218('0x63')](_0x8218('0x4f'),path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')])),function(_0xffb58b){if(_0xffb58b){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x64'));}fs[_0x8218('0x65')](_0x2c2f87);logger['info']('Download\x20completed');logger[_0x8218('0x66')](_0x8218('0x67'));});});}return null;})['catch'](handleError(_0x272c65,null));};exports[_0x8218('0x68')]=function(_0x34afb3,_0x1ad373,_0x314ad8){var _0x3fd875=path[_0x8218('0x50')](_0x34afb3[_0x8218('0x69')][_0x8218('0x6a')],path[_0x8218('0x6b')](_0x34afb3[_0x8218('0x69')][_0x8218('0x6a')]));var _0x47606c=path['join'](config[_0x8218('0x4e')],_0x8218('0x5c'),_0x34afb3['file'][_0x8218('0x6a')]);var _0x2dccff=path[_0x8218('0x4d')](config['root'],_0x8218('0x5c'),_0x3fd875);logger[_0x8218('0x66')](_0x8218('0x6c'),_0x47606c);logger[_0x8218('0x66')](_0x8218('0x6d'),_0x2dccff);try{fs[_0x8218('0x6e')](_0x47606c,parseInt(_0x8218('0x6f'),0x8));extract(_0x47606c,{'dir':_0x2dccff},function(_0x3dabce){if(_0x3dabce){logger['error'](_0x3dabce);handleError(_0x3dabce,!![]);};var _0x2e6292=fs[_0x8218('0x70')](_0x2dccff);if(_0x2e6292[_0x8218('0x39')]>0x1){removeReferences(_0x47606c,_0x2dccff);logger['error']('Invalid\x20plugin\x20structure');return _0x314ad8(new Error('Invalid\x20plugin\x20structure'));}var _0x4e068e=fs[_0x8218('0x71')](path['join'](_0x2dccff,_0x2e6292[0x0]));if(_0x4e068e['isFile']()){removeReferences(_0x47606c,_0x2dccff);logger['error'](_0x8218('0x72'));return _0x314ad8(new Error(_0x8218('0x72')));}if(_0x4e068e[_0x8218('0x73')]()){var _0x55d6a4=fs[_0x8218('0x70')](path[_0x8218('0x4d')](_0x2dccff,_0x2e6292[0x0]));if(_0x55d6a4[_0x8218('0x39')]===0x0){removeReferences(_0x47606c,_0x2dccff);logger[_0x8218('0x2a')]('Invalid\x20plugin\x20structure');return _0x314ad8(new Error('Invalid\x20plugin\x20structure'));}var _0x3a5740=_0x55d6a4[_0x8218('0x74')](function(_0x5a3291){return _0x5a3291==='manifest.json';});if(!_0x3a5740){return _0x314ad8(new Error(_0x8218('0x75')));}var _0x380478=fs[_0x8218('0x76')](path[_0x8218('0x4d')](_0x2dccff,_0x2e6292[0x0],_0x8218('0x77')));var _0x3cec8f=JSON[_0x8218('0x78')](_0x380478);if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x2c')]){return _0x314ad8(new Error(_0x8218('0x79')));}if('undefined'==typeof _0x3cec8f[_0x8218('0x41')]){return _0x314ad8(new Error(_0x8218('0x7a')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7b')]){return _0x314ad8(new Error(_0x8218('0x7c')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')]){return _0x314ad8(new Error(_0x8218('0x7e')));}if(_0x3cec8f[_0x8218('0x41')]==='html'){if('undefined'==typeof _0x3cec8f['parameters']['views']){return _0x314ad8(new Error(_0x8218('0x7f')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['admin']&&_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['agent']){return _0x314ad8(new Error(_0x8218('0x81')));}}else if(_0x3cec8f[_0x8218('0x41')]==='script'){if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x82')]){return _0x314ad8(new Error(_0x8218('0x83')));}if('undefined'==typeof _0x3cec8f['parameters'][_0x8218('0x84')]){return _0x314ad8(new Error(_0x8218('0x85')));}}else{return _0x314ad8(new Error(_0x8218('0x86')));}var _0xaff97=_0x3cec8f[_0x8218('0x2c')];var _0x2e70e8=_0x3cec8f['description'];var _0x22941c=_0x3cec8f[_0x8218('0x41')];var _0x163471=_0x3cec8f['sidebar']?_0x3cec8f[_0x8218('0x87')]:'always';var _0x3eec08=_0x3cec8f[_0x8218('0x88')]?_0x3cec8f[_0x8218('0x88')]:_0x8218('0x89');var _0x472f54='';var _0x404892='';var _0x2cfdd2='';var _0x1280bd='';var _0x1e9af4=_0x3cec8f[_0x8218('0x7b')];if(_0x22941c==='html'){if('undefined'!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['admin']){var _0x18ae38=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x18ae38)){_0x472f54=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x18ae38);}else{_0x472f54=_0x18ae38;}}else{logger[_0x8218('0x66')](_0x8218('0x8c'));}if('undefined'!=typeof _0x3cec8f['parameters'][_0x8218('0x80')][_0x8218('0x8d')]){var _0x2ebd77=_0x3cec8f['parameters'][_0x8218('0x80')][_0x8218('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x2ebd77)){_0x404892=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x2ebd77);}else{_0x404892=_0x2ebd77;}}else{logger[_0x8218('0x66')](_0x8218('0x8f'));}}else if(_0x22941c===_0x8218('0x90')){_0x2cfdd2=_0x3cec8f['parameters'][_0x8218('0x82')];_0x1280bd=_0x3cec8f[_0x8218('0x7d')]['scriptPath'];if(_0x8218('0x1d')!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]){if(_0x8218('0x1d')!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')]){var _0x18ae38=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x18ae38)){_0x472f54=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x18ae38);}else{_0x472f54=_0x18ae38;}}if('undefined'!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8d')]){var _0x2ebd77=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x2ebd77)){_0x404892=path['join'](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x2ebd77);}else{_0x404892=_0x2ebd77;}}}}var _0x295275={'name':_0xaff97,'description':_0x2e70e8,'path':path['join'](_0x3fd875,_0x2e6292[0x0]),'type':_0x22941c,'sidebar':_0x163471,'icon':_0x3eec08,'adminUrl':_0x472f54,'agentUrl':_0x404892,'scriptName':_0x2cfdd2,'scriptPath':_0x1280bd,'version':_0x1e9af4};removeReferences(_0x47606c,null);return db[_0x8218('0x30')][_0x8218('0x91')](_0x295275)[_0x8218('0x25')](function(_0xd9411){var _0x3d472e={'role':_0x34afb3[_0x8218('0x92')]['role'],'userProfileId':_0x34afb3[_0x8218('0x92')][_0x8218('0x93')]};if(!_0x3d472e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d472e[_0x8218('0x94')]===_0x8218('0x95')){var _0x289dea=_0xd9411[_0x8218('0x96')]({'plain':!![]});return db[_0x8218('0x97')][_0x8218('0x4a')]({'where':{'name':_0x8218('0x26'),'userProfileId':_0x3d472e[_0x8218('0x93')]},'raw':!![]})[_0x8218('0x25')](function(_0x5625d4){if(_0x5625d4&&_0x5625d4[_0x8218('0x98')]===0x0){return db[_0x8218('0x27')]['create']({'name':_0x289dea[_0x8218('0x2c')],'resourceId':_0x289dea['id'],'type':_0x5625d4['name'],'sectionId':_0x5625d4['id']},{})[_0x8218('0x25')](function(){return _0xd9411;});}else{return _0xd9411;}})[_0x8218('0x4b')](function(_0x551277){logger[_0x8218('0x2a')](_0x8218('0x99'),_0x551277);throw _0x551277;});}return _0xd9411;})[_0x8218('0x25')](respondWithResult(_0x1ad373,null))[_0x8218('0x4b')](handleError(_0x1ad373,null));}});}catch(_0x3892f0){_0x1ad373[_0x8218('0x20')](0x1f4)['send'](_0x3892f0);}};function removeReferences(_0x11e0d1,_0x625987){try{if(_0x11e0d1){fs['unlinkSync'](_0x11e0d1);logger['info'](_0x8218('0x9a'));}if(_0x625987){rimraf(_0x625987,function(){});logger[_0x8218('0x66')](_0x8218('0x9b'));}}catch(_0x49a220){logger[_0x8218('0x2a')](_0x49a220);}}exports[_0x8218('0x24')]=function(_0x181fa6,_0x341c93,_0x114e39){return db[_0x8218('0x30')]['find']({'where':{'id':_0x181fa6[_0x8218('0x46')]['id']}})['then'](handleEntityNotFound(_0x341c93,null))['then'](saveUpdates(_0x181fa6['body'],null))[_0x8218('0x25')](respondWithResult(_0x341c93,null))['catch'](handleError(_0x341c93,null));};exports[_0x8218('0x9c')]=function(_0x6eb748,_0x108369,_0x5deb81){return db[_0x8218('0x30')][_0x8218('0x4a')]({'where':{'id':_0x6eb748[_0x8218('0x46')]['id']}})[_0x8218('0x25')](function(_0x3f1507){if(_0x3f1507){return _0x3f1507[_0x8218('0x28')]();}})[_0x8218('0x25')](function(_0x276783){rimraf(path[_0x8218('0x4d')](config[_0x8218('0x4e')],'server/files/plugins',path[_0x8218('0x5d')](_0x276783[_0x8218('0x7')])),function(){});return _0x276783;})[_0x8218('0x25')](handleEntityNotFound(_0x108369,null))[_0x8218('0x25')](respondWithStatusCode(_0x108369,null))[_0x8218('0x4b')](handleError(_0x108369,null));};exports[_0x8218('0x9d')]=function(_0x18b9f4,_0x1c0cdf,_0x43871e){return BPromise[_0x8218('0x9e')]()['then'](function(){if(!_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')]){throw new Error(_0x8218('0xa0'));}var _0x381fcc=_0x18b9f4[_0x8218('0x34')][_0x8218('0xa1')]?_0x18b9f4[_0x8218('0x34')][_0x8218('0xa1')]+':'+_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')]:_0x8218('0xa2')+_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')];var _0x40fe30=_0x18b9f4[_0x8218('0x34')][_0x8218('0x1b')]?_0x18b9f4[_0x8218('0x34')][_0x8218('0x1b')]:!![];var _0x1b8f39=_0x18b9f4[_0x8218('0x34')]['encoding']?_0x18b9f4['query'][_0x8218('0xa3')]:null;var _0x452aa8={'method':_0x18b9f4[_0x8218('0xa4')],'uri':util[_0x8218('0x63')]('%s%s',_0x381fcc,_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')]),'json':_0x40fe30,'resolveWithFullResponse':!![],'encoding':_0x1b8f39,'qs':_0x18b9f4[_0x8218('0x34')]};if(_0x18b9f4[_0x8218('0xa5')]){_0x452aa8[_0x8218('0xa5')]=_0x18b9f4[_0x8218('0xa5')];if(_0x452aa8[_0x8218('0xa5')][_0x8218('0xa6')]){delete _0x452aa8[_0x8218('0xa5')][_0x8218('0xa6')];}}if(_0x452aa8[_0x8218('0xa5')]['content-type']){delete _0x452aa8[_0x8218('0xa5')]['content-type'];}return rp(_0x452aa8);})[_0x8218('0x25')](function(_0x496712){if(_0x496712){_0x1c0cdf[_0x8218('0xa7')](_0x496712[_0x8218('0xa5')]);logger['info'](_0x496712[_0x8218('0x92')]);if(_[_0x8218('0xa8')](_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')],_0x8218('0x4c'))&&_0x496712[_0x8218('0xa9')]==0x1f4){return _0x1c0cdf[_0x8218('0x1a')](_0x496712[_0x8218('0xa9')]);}else{return _0x1c0cdf['status'](_0x496712[_0x8218('0xa9')])[_0x8218('0x2d')](_0x496712[_0x8218('0x92')]);}}else{return _0x1c0cdf[_0x8218('0x1a')](0xc8);}})[_0x8218('0x4b')](handleError(_0x1c0cdf,null));};exports[_0x8218('0xaa')]=function(_0x3b09f5,_0xfb5a88,_0x248c2a){return BPromise[_0x8218('0x9e')]()[_0x8218('0x25')](function(){if(!_0x3b09f5['query'][_0x8218('0x7')]){throw new Error(_0x8218('0xab'));}if(!_0x3b09f5[_0x8218('0x34')][_0x8218('0x9f')]){throw new Error(_0x8218('0xa0'));}var _0x13b11f=_0x3b09f5[_0x8218('0x34')]['hostname']?_0x3b09f5['query']['hostname']+':'+_0x3b09f5['query'][_0x8218('0x9f')]:_0x8218('0xa2')+_0x3b09f5[_0x8218('0x34')]['port'];var _0x27eaf3=_0x3b09f5[_0x8218('0x34')][_0x8218('0x1b')]?_0x3b09f5[_0x8218('0x34')]['json']:!![];var _0x394d43=_0x3b09f5[_0x8218('0x34')][_0x8218('0xa3')]?_0x3b09f5[_0x8218('0x34')][_0x8218('0xa3')]:null;var _0x512ecd={'method':_0x3b09f5[_0x8218('0xa4')],'uri':util[_0x8218('0x63')](_0x8218('0xac'),_0x13b11f,_0x3b09f5['query'][_0x8218('0x7')]),'json':_0x27eaf3,'resolveWithFullResponse':!![],'encoding':_0x394d43,'body':_0x3b09f5['body']};if(_0x3b09f5[_0x8218('0xa5')]){_0x512ecd['headers']=_0x3b09f5[_0x8218('0xa5')];if(_0x512ecd[_0x8218('0xa5')][_0x8218('0xa6')]){delete _0x512ecd[_0x8218('0xa5')][_0x8218('0xa6')];}}if(_0x512ecd['headers'][_0x8218('0xad')]){delete _0x512ecd['headers'][_0x8218('0xad')];}return rp(_0x512ecd);})[_0x8218('0x25')](function(_0x3e8a6a){if(_0x3e8a6a){_0xfb5a88[_0x8218('0xa7')](_0x3e8a6a[_0x8218('0xa5')]);logger[_0x8218('0x66')](_0x3e8a6a['body']);return _0xfb5a88[_0x8218('0x20')](_0x3e8a6a['statusCode'])[_0x8218('0x2d')](_0x3e8a6a[_0x8218('0x92')]);}else{return _0xfb5a88[_0x8218('0x1a')](0xc8);}})['catch'](handleError(_0xfb5a88,null));}; \ No newline at end of file +var _0xe329=['Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','headers','content-length','content-type','set','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','status','end','undefined','count','offset','Content-Range','json','apply','then','destroy','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','catch','download','find','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','server/files/plugins','dirname','node_modules/**/*','join','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some'];(function(_0x657fd9,_0x23febd){var _0x43b522=function(_0x8bd3af){while(--_0x8bd3af){_0x657fd9['push'](_0x657fd9['shift']());}};_0x43b522(++_0x23febd);}(_0xe329,0xe2));var _0x9e32=function(_0x2e0888,_0x1f5ead){_0x2e0888=_0x2e0888-0x0;var _0x5ecf51=_0xe329[_0x2e0888];return _0x5ecf51;};'use strict';var emlformat=require(_0x9e32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e32('0x1'));var jsonpatch=require(_0x9e32('0x2'));var rp=require('request-promise');var moment=require(_0x9e32('0x3'));var BPromise=require(_0x9e32('0x4'));var Mustache=require(_0x9e32('0x5'));var util=require(_0x9e32('0x6'));var path=require(_0x9e32('0x7'));var sox=require(_0x9e32('0x8'));var csv=require(_0x9e32('0x9'));var ejs=require(_0x9e32('0xa'));var fs=require('fs');var fs_extra=require(_0x9e32('0xb'));var _=require(_0x9e32('0xc'));var squel=require(_0x9e32('0xd'));var crypto=require(_0x9e32('0xe'));var jsforce=require(_0x9e32('0xf'));var deskjs=require(_0x9e32('0x10'));var toCsv=require(_0x9e32('0x9'));var querystring=require(_0x9e32('0x11'));var Papa=require(_0x9e32('0x12'));var extract=require(_0x9e32('0x13'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x9e32('0x14'));var qs=require(_0x9e32('0x15'));var as=require(_0x9e32('0x16'));var hardwareService=require(_0x9e32('0x17'));var logger=require(_0x9e32('0x18'))(_0x9e32('0x19'));var utils=require(_0x9e32('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9e32('0x1b'));var db=require(_0x9e32('0x1c'))['db'];config[_0x9e32('0x1d')]=_[_0x9e32('0x1e')](config[_0x9e32('0x1d')],{'host':_0x9e32('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e32('0x1d')]));require(_0x9e32('0x20'))[_0x9e32('0x21')](socket);function respondWithStatusCode(_0x21b888,_0x2043bc){_0x2043bc=_0x2043bc||0xcc;return function(_0x281863){if(_0x281863){return _0x21b888['sendStatus'](_0x2043bc);}return _0x21b888[_0x9e32('0x22')](_0x2043bc)[_0x9e32('0x23')]();};}function respondWithResult(_0x51e18f,_0x556128){_0x556128=_0x556128||0xc8;return function(_0x405be0){if(_0x405be0){return _0x51e18f[_0x9e32('0x22')](_0x556128)['json'](_0x405be0);}};}function respondWithFilteredResult(_0x8d9648,_0x54606a){return function(_0x5546c1){if(_0x5546c1){var _0x3b18b4=typeof _0x54606a['offset']===_0x9e32('0x24')&&typeof _0x54606a['limit']==='undefined';var _0xc8717f=_0x5546c1[_0x9e32('0x25')];var _0x356ef0=_0x3b18b4?0x0:_0x54606a[_0x9e32('0x26')];var _0xd5cca8=_0x3b18b4?_0x5546c1['count']:_0x54606a['offset']+_0x54606a['limit'];var _0x1ba78f;if(_0xd5cca8>=_0xc8717f){_0xd5cca8=_0xc8717f;_0x1ba78f=0xc8;}else{_0x1ba78f=0xce;}_0x8d9648[_0x9e32('0x22')](_0x1ba78f);return _0x8d9648['set'](_0x9e32('0x27'),_0x356ef0+'-'+_0xd5cca8+'/'+_0xc8717f)[_0x9e32('0x28')](_0x5546c1);}return null;};}function patchUpdates(_0x455fc0){return function(_0xac1c18){try{jsonpatch[_0x9e32('0x29')](_0xac1c18,_0x455fc0,!![]);}catch(_0xc45d3){return BPromise['reject'](_0xc45d3);}return _0xac1c18['save']();};}function saveUpdates(_0x4fee53,_0x3d0192){return function(_0x367845){if(_0x367845){return _0x367845['update'](_0x4fee53)[_0x9e32('0x2a')](function(_0x39775f){return _0x39775f;});}return null;};}function removeEntity(_0x9d9e34,_0x4e8dc0){return function(_0x3fe5ca){if(_0x3fe5ca){return _0x3fe5ca[_0x9e32('0x2b')]()['then'](function(){var _0x11f791=_0x3fe5ca['get']({'plain':!![]});var _0x7b1cbe=_0x9e32('0x2c');return db[_0x9e32('0x2d')][_0x9e32('0x2b')]({'where':{'type':_0x7b1cbe,'resourceId':_0x11f791['id']}})[_0x9e32('0x2a')](function(){return _0x3fe5ca;});})['then'](function(){_0x9d9e34[_0x9e32('0x22')](0xcc)[_0x9e32('0x23')]();});}};}function handleEntityNotFound(_0x54860b,_0x2696cc){return function(_0x3acc01){if(!_0x3acc01){_0x54860b[_0x9e32('0x2e')](0x194);}return _0x3acc01;};}function handleError(_0x5c9335,_0x815f6c){_0x815f6c=_0x815f6c||0x1f4;return function(_0x3eead2){logger[_0x9e32('0x2f')](_0x3eead2[_0x9e32('0x30')]);if(_0x3eead2[_0x9e32('0x31')]){delete _0x3eead2['name'];}_0x5c9335[_0x9e32('0x22')](_0x815f6c)[_0x9e32('0x32')](_0x3eead2);};}exports[_0x9e32('0x33')]=function(_0x1af44,_0x3c9d84){var _0x17559a={},_0x971de9={},_0x210a43={'count':0x0,'rows':[]};var _0x263de6=_[_0x9e32('0x34')](db[_0x9e32('0x35')][_0x9e32('0x36')],function(_0x2631ce){return{'name':_0x2631ce[_0x9e32('0x37')],'type':_0x2631ce[_0x9e32('0x38')][_0x9e32('0x39')]};});_0x971de9['model']=_['map'](_0x263de6,_0x9e32('0x31'));_0x971de9[_0x9e32('0x3a')]=_[_0x9e32('0x3b')](_0x1af44['query']);_0x971de9[_0x9e32('0x3c')]=_['intersection'](_0x971de9[_0x9e32('0x3d')],_0x971de9[_0x9e32('0x3a')]);_0x17559a[_0x9e32('0x3e')]=_['intersection'](_0x971de9['model'],qs[_0x9e32('0x3f')](_0x1af44[_0x9e32('0x3a')][_0x9e32('0x3f')]));_0x17559a['attributes']=_0x17559a[_0x9e32('0x3e')][_0x9e32('0x40')]?_0x17559a[_0x9e32('0x3e')]:_0x971de9[_0x9e32('0x3d')];if(!_0x1af44[_0x9e32('0x3a')][_0x9e32('0x41')]('nolimit')){_0x17559a[_0x9e32('0x42')]=qs[_0x9e32('0x42')](_0x1af44[_0x9e32('0x3a')][_0x9e32('0x42')]);_0x17559a[_0x9e32('0x26')]=qs[_0x9e32('0x26')](_0x1af44[_0x9e32('0x3a')][_0x9e32('0x26')]);}_0x17559a[_0x9e32('0x43')]=qs[_0x9e32('0x44')](_0x1af44['query'][_0x9e32('0x44')]);_0x17559a[_0x9e32('0x45')]=qs[_0x9e32('0x3c')](_['pick'](_0x1af44[_0x9e32('0x3a')],_0x971de9[_0x9e32('0x3c')]),_0x263de6);if(_0x1af44[_0x9e32('0x3a')]['filter']){_0x17559a[_0x9e32('0x45')]=_['merge'](_0x17559a['where'],{'$or':_[_0x9e32('0x34')](_0x263de6,function(_0x5788d1){if(_0x5788d1['type']!==_0x9e32('0x46')){var _0x27b6a3={};_0x27b6a3[_0x5788d1[_0x9e32('0x31')]]={'$like':'%'+_0x1af44['query'][_0x9e32('0x47')]+'%'};return _0x27b6a3;}})});}_0x17559a=_[_0x9e32('0x48')]({},_0x17559a,_0x1af44[_0x9e32('0x49')]);var _0xac6c64={'where':_0x17559a[_0x9e32('0x45')]};return db[_0x9e32('0x35')][_0x9e32('0x25')](_0xac6c64)[_0x9e32('0x2a')](function(_0x34b088){_0x210a43[_0x9e32('0x25')]=_0x34b088;if(_0x1af44[_0x9e32('0x3a')][_0x9e32('0x4a')]){_0x17559a[_0x9e32('0x4b')]=[{'all':!![]}];}return db[_0x9e32('0x35')][_0x9e32('0x4c')](_0x17559a);})[_0x9e32('0x2a')](function(_0x1b2308){_0x210a43[_0x9e32('0x4d')]=_0x1b2308;return _0x210a43;})[_0x9e32('0x2a')](respondWithFilteredResult(_0x3c9d84,_0x17559a))['catch'](handleError(_0x3c9d84,null));};exports[_0x9e32('0x4e')]=function(_0x305552,_0x5727fe){var _0x36f63c={'raw':!![],'where':{'id':_0x305552[_0x9e32('0x4f')]['id']}},_0x49c682={};_0x49c682[_0x9e32('0x3d')]=_['keys'](db[_0x9e32('0x35')][_0x9e32('0x36')]);_0x49c682[_0x9e32('0x3a')]=_['keys'](_0x305552[_0x9e32('0x3a')]);_0x49c682[_0x9e32('0x3c')]=_[_0x9e32('0x50')](_0x49c682[_0x9e32('0x3d')],_0x49c682[_0x9e32('0x3a')]);_0x36f63c['attributes']=_['intersection'](_0x49c682[_0x9e32('0x3d')],qs[_0x9e32('0x3f')](_0x305552['query'][_0x9e32('0x3f')]));_0x36f63c['attributes']=_0x36f63c[_0x9e32('0x3e')][_0x9e32('0x40')]?_0x36f63c['attributes']:_0x49c682['model'];if(_0x305552[_0x9e32('0x3a')][_0x9e32('0x4a')]){_0x36f63c[_0x9e32('0x4b')]=[{'all':!![]}];}_0x36f63c=_[_0x9e32('0x48')]({},_0x36f63c,_0x305552[_0x9e32('0x49')]);return db[_0x9e32('0x35')]['find'](_0x36f63c)[_0x9e32('0x2a')](handleEntityNotFound(_0x5727fe,null))['then'](respondWithResult(_0x5727fe,null))[_0x9e32('0x51')](handleError(_0x5727fe,null));};exports[_0x9e32('0x52')]=function(_0x370034,_0x40ed02,_0x15d3db){return db['Plugin'][_0x9e32('0x53')]({'where':{'id':_0x370034['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x9e32('0x2a')](handleEntityNotFound(_0x40ed02,null))[_0x9e32('0x2a')](function(_0x17b09b){if(_0x17b09b){var _0x5eff6d=path['join'](config[_0x9e32('0x54')],'server/files/plugins',util['format'](_0x9e32('0x55'),path[_0x9e32('0x56')](_0x17b09b['path'])));var _0x3fe73c=fs[_0x9e32('0x57')](_0x5eff6d);var _0x42db90=archiver(_0x9e32('0x58'),{'zlib':{'level':0x9}});_0x42db90['on'](_0x9e32('0x59'),function(_0x4c482c){if(_0x4c482c[_0x9e32('0x5a')]===_0x9e32('0x5b')){logger[_0x9e32('0x2f')](_0x4c482c);}else{throw new db['Sequelize'][(_0x9e32('0x5c'))](_0x9e32('0x5d'));}});_0x42db90['on'](_0x9e32('0x2f'),function(_0x38cb66){throw new db['Sequelize'][(_0x9e32('0x5c'))](_0x9e32('0x5d'));});_0x42db90[_0x9e32('0x5e')](_0x3fe73c);_0x42db90[_0x9e32('0x5f')]('**/*',{'cwd':path['join'](config[_0x9e32('0x54')],_0x9e32('0x60'),path[_0x9e32('0x61')](_0x17b09b['path'])),'ignore':[path['join'](path[_0x9e32('0x56')](_0x17b09b['path']),_0x9e32('0x62')),path[_0x9e32('0x63')](path['basename'](_0x17b09b[_0x9e32('0x7')]),_0x9e32('0x64'))],'nodir':!![]})[_0x9e32('0x65')]();_0x3fe73c['on'](_0x9e32('0x66'),function(){if(!fs[_0x9e32('0x67')](_0x5eff6d)){throw new db[(_0x9e32('0x68'))][(_0x9e32('0x5c'))](_0x9e32('0x69'));}return _0x40ed02[_0x9e32('0x52')](_0x5eff6d,util['format'](_0x9e32('0x55'),path[_0x9e32('0x56')](_0x17b09b['path'])),function(_0x38c973){if(_0x38c973){throw new db['Sequelize']['Error'](_0x9e32('0x6a'));}fs[_0x9e32('0x6b')](_0x5eff6d);logger['info']('Download\x20completed');logger[_0x9e32('0x6c')](_0x9e32('0x6d'));});});}return null;})[_0x9e32('0x51')](handleError(_0x40ed02,null));};exports[_0x9e32('0x6e')]=function(_0xe71d81,_0xe2edea,_0x15bf9f){var _0x17f277=path[_0x9e32('0x56')](_0xe71d81[_0x9e32('0x6f')][_0x9e32('0x70')],path['extname'](_0xe71d81['file'][_0x9e32('0x70')]));var _0x5114bf=path[_0x9e32('0x63')](config[_0x9e32('0x54')],'server/files/plugins',_0xe71d81['file']['filename']);var _0xfa5315=path[_0x9e32('0x63')](config[_0x9e32('0x54')],_0x9e32('0x60'),_0x17f277);logger[_0x9e32('0x6c')](_0x9e32('0x71'),_0x5114bf);logger[_0x9e32('0x6c')](_0x9e32('0x72'),_0xfa5315);try{fs['chmodSync'](_0x5114bf,parseInt(_0x9e32('0x73'),0x8));extract(_0x5114bf,{'dir':_0xfa5315},function(_0x56047f){if(_0x56047f){logger[_0x9e32('0x2f')](_0x56047f);handleError(_0x56047f,!![]);};var _0x2fd589=fs[_0x9e32('0x74')](_0xfa5315);if(_0x2fd589['length']>0x1){removeReferences(_0x5114bf,_0xfa5315);logger[_0x9e32('0x2f')]('Invalid\x20plugin\x20structure');return _0x15bf9f(new Error(_0x9e32('0x75')));}var _0x1d7ebf=fs[_0x9e32('0x76')](path['join'](_0xfa5315,_0x2fd589[0x0]));if(_0x1d7ebf[_0x9e32('0x77')]()){removeReferences(_0x5114bf,_0xfa5315);logger[_0x9e32('0x2f')](_0x9e32('0x75'));return _0x15bf9f(new Error(_0x9e32('0x75')));}if(_0x1d7ebf[_0x9e32('0x78')]()){var _0x5f0df4=fs[_0x9e32('0x74')](path[_0x9e32('0x63')](_0xfa5315,_0x2fd589[0x0]));if(_0x5f0df4['length']===0x0){removeReferences(_0x5114bf,_0xfa5315);logger[_0x9e32('0x2f')](_0x9e32('0x75'));return _0x15bf9f(new Error('Invalid\x20plugin\x20structure'));}var _0x467c64=_0x5f0df4[_0x9e32('0x79')](function(_0x47bf7a){return _0x47bf7a==='manifest.json';});if(!_0x467c64){return _0x15bf9f(new Error(_0x9e32('0x7a')));}var _0x442e91=fs[_0x9e32('0x7b')](path['join'](_0xfa5315,_0x2fd589[0x0],'manifest.json'));var _0x1ab7f6=JSON['parse'](_0x442e91);if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x31')]){return _0x15bf9f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x38')]){return _0x15bf9f(new Error(_0x9e32('0x7c')));}if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x7d')]){return _0x15bf9f(new Error(_0x9e32('0x7e')));}if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x7f')]){return _0x15bf9f(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1ab7f6[_0x9e32('0x38')]===_0x9e32('0x80')){if('undefined'==typeof _0x1ab7f6[_0x9e32('0x7f')]['views']){return _0x15bf9f(new Error(_0x9e32('0x81')));}if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')][_0x9e32('0x83')]&&_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')][_0x9e32('0x84')]){return _0x15bf9f(new Error(_0x9e32('0x85')));}}else if(_0x1ab7f6[_0x9e32('0x38')]===_0x9e32('0x86')){if(_0x9e32('0x24')==typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x87')]){return _0x15bf9f(new Error(_0x9e32('0x88')));}if('undefined'==typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x89')]){return _0x15bf9f(new Error(_0x9e32('0x8a')));}}else{return _0x15bf9f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x34ba23=_0x1ab7f6['name'];var _0x19de28=_0x1ab7f6[_0x9e32('0x8b')];var _0x4094ce=_0x1ab7f6[_0x9e32('0x38')];var _0x59375e=_0x1ab7f6[_0x9e32('0x8c')]?_0x1ab7f6[_0x9e32('0x8c')]:_0x9e32('0x8d');var _0x27367a=_0x1ab7f6[_0x9e32('0x8e')]?_0x1ab7f6[_0x9e32('0x8e')]:_0x9e32('0x8f');var _0x58b14e='';var _0x5d9838='';var _0xb97393='';var _0xa31a9e='';var _0x4997a7=_0x1ab7f6[_0x9e32('0x7d')];if(_0x4094ce===_0x9e32('0x80')){if(_0x9e32('0x24')!=typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')]['admin']){var _0x2e7f8c=_0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')][_0x9e32('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e7f8c)){_0x58b14e=path[_0x9e32('0x63')](_0x9e32('0x90'),_0x17f277,_0x2fd589[0x0],_0x2e7f8c);}else{_0x58b14e=_0x2e7f8c;}}else{logger[_0x9e32('0x6c')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x1ab7f6['parameters'][_0x9e32('0x82')]['agent']){var _0x68cd57=_0x1ab7f6[_0x9e32('0x7f')]['views'][_0x9e32('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x9e32('0x91')](_0x68cd57)){_0x5d9838=path[_0x9e32('0x63')](_0x9e32('0x90'),_0x17f277,_0x2fd589[0x0],_0x68cd57);}else{_0x5d9838=_0x68cd57;}}else{logger[_0x9e32('0x6c')](_0x9e32('0x92'));}}else if(_0x4094ce===_0x9e32('0x86')){_0xb97393=_0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x87')];_0xa31a9e=_0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x89')];if(_0x9e32('0x24')!=typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')]){if(_0x9e32('0x24')!=typeof _0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')][_0x9e32('0x83')]){var _0x2e7f8c=_0x1ab7f6[_0x9e32('0x7f')][_0x9e32('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9e32('0x91')](_0x2e7f8c)){_0x58b14e=path[_0x9e32('0x63')](_0x9e32('0x90'),_0x17f277,_0x2fd589[0x0],_0x2e7f8c);}else{_0x58b14e=_0x2e7f8c;}}if(_0x9e32('0x24')!=typeof _0x1ab7f6[_0x9e32('0x7f')]['views'][_0x9e32('0x84')]){var _0x68cd57=_0x1ab7f6['parameters'][_0x9e32('0x82')][_0x9e32('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x9e32('0x91')](_0x68cd57)){_0x5d9838=path[_0x9e32('0x63')](_0x9e32('0x90'),_0x17f277,_0x2fd589[0x0],_0x68cd57);}else{_0x5d9838=_0x68cd57;}}}}var _0x5e810e={'name':_0x34ba23,'description':_0x19de28,'path':path['join'](_0x17f277,_0x2fd589[0x0]),'type':_0x4094ce,'sidebar':_0x59375e,'icon':_0x27367a,'adminUrl':_0x58b14e,'agentUrl':_0x5d9838,'scriptName':_0xb97393,'scriptPath':_0xa31a9e,'version':_0x4997a7};removeReferences(_0x5114bf,null);return db[_0x9e32('0x35')]['create'](_0x5e810e)['then'](function(_0x530196){var _0x45abea={'role':_0xe71d81['body']['role'],'userProfileId':_0xe71d81[_0x9e32('0x93')][_0x9e32('0x94')]};if(!_0x45abea)throw new Error(_0x9e32('0x95'));if(_0x45abea[_0x9e32('0x96')]===_0x9e32('0x97')){var _0x5086c3=_0x530196[_0x9e32('0x98')]({'plain':!![]});return db['UserProfileSection'][_0x9e32('0x53')]({'where':{'name':_0x9e32('0x2c'),'userProfileId':_0x45abea[_0x9e32('0x94')]},'raw':!![]})[_0x9e32('0x2a')](function(_0x32270a){if(_0x32270a&&_0x32270a[_0x9e32('0x99')]===0x0){return db['UserProfileResource']['create']({'name':_0x5086c3[_0x9e32('0x31')],'resourceId':_0x5086c3['id'],'type':_0x32270a['name'],'sectionId':_0x32270a['id']},{})[_0x9e32('0x2a')](function(){return _0x530196;});}else{return _0x530196;}})['catch'](function(_0x220950){logger[_0x9e32('0x2f')](_0x9e32('0x9a'),_0x220950);throw _0x220950;});}return _0x530196;})[_0x9e32('0x2a')](respondWithResult(_0xe2edea,null))['catch'](handleError(_0xe2edea,null));}});}catch(_0xca2371){_0xe2edea[_0x9e32('0x22')](0x1f4)[_0x9e32('0x32')](_0xca2371);}};function removeReferences(_0xb2c409,_0xd9e39){try{if(_0xb2c409){fs['unlinkSync'](_0xb2c409);logger[_0x9e32('0x6c')](_0x9e32('0x9b'));}if(_0xd9e39){rimraf(_0xd9e39,function(){});logger[_0x9e32('0x6c')](_0x9e32('0x9c'));}}catch(_0x4ed075){logger[_0x9e32('0x2f')](_0x4ed075);}}exports['update']=function(_0x40e6b1,_0x7ea59e,_0x3b1feb){return db['Plugin'][_0x9e32('0x53')]({'where':{'id':_0x40e6b1[_0x9e32('0x4f')]['id']}})['then'](handleEntityNotFound(_0x7ea59e,null))[_0x9e32('0x2a')](saveUpdates(_0x40e6b1[_0x9e32('0x93')],null))[_0x9e32('0x2a')](respondWithResult(_0x7ea59e,null))['catch'](handleError(_0x7ea59e,null));};exports[_0x9e32('0x9d')]=function(_0x290953,_0x3cd0d1,_0x46b9ea){return db[_0x9e32('0x35')]['find']({'where':{'id':_0x290953[_0x9e32('0x4f')]['id']}})[_0x9e32('0x2a')](function(_0x80617c){if(_0x80617c){return _0x80617c[_0x9e32('0x2b')]();}})['then'](function(_0xd020aa){rimraf(path['join'](config['root'],'server/files/plugins',path[_0x9e32('0x61')](_0xd020aa['path'])),function(){});return _0xd020aa;})['then'](handleEntityNotFound(_0x3cd0d1,null))[_0x9e32('0x2a')](respondWithStatusCode(_0x3cd0d1,null))[_0x9e32('0x51')](handleError(_0x3cd0d1,null));};exports['webhookGet']=function(_0x2ad9db,_0x4459f5,_0x8f05c4){return BPromise[_0x9e32('0x9e')]()[_0x9e32('0x2a')](function(){if(!_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x9f')]){throw new Error(_0x9e32('0xa0'));}var _0x30bdba=_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0xa1')]?_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0xa1')]+':'+_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x9f')]:_0x9e32('0xa2')+_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x9f')];var _0x41f0f6=_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x28')]?_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x28')]:!![];var _0x269444=_0x2ad9db[_0x9e32('0x3a')]['encoding']?_0x2ad9db['query'][_0x9e32('0xa3')]:null;var _0xd88f8c={'method':_0x2ad9db[_0x9e32('0xa4')],'uri':util[_0x9e32('0xa5')]('%s%s',_0x30bdba,_0x2ad9db['query'][_0x9e32('0x7')]),'json':_0x41f0f6,'resolveWithFullResponse':!![],'encoding':_0x269444,'qs':_0x2ad9db[_0x9e32('0x3a')]};if(_0x2ad9db['headers']){_0xd88f8c[_0x9e32('0xa6')]=_0x2ad9db[_0x9e32('0xa6')];if(_0xd88f8c[_0x9e32('0xa6')][_0x9e32('0xa7')]){delete _0xd88f8c['headers'][_0x9e32('0xa7')];}}if(_0xd88f8c['headers']['content-type']){delete _0xd88f8c['headers'][_0x9e32('0xa8')];}return rp(_0xd88f8c);})[_0x9e32('0x2a')](function(_0x2a9e4e){if(_0x2a9e4e){_0x4459f5[_0x9e32('0xa9')](_0x2a9e4e[_0x9e32('0xa6')]);logger[_0x9e32('0x6c')](_0x2a9e4e['body']);if(_[_0x9e32('0xaa')](_0x2ad9db[_0x9e32('0x3a')][_0x9e32('0x7')],_0x9e32('0x52'))&&_0x2a9e4e[_0x9e32('0xab')]==0x1f4){return _0x4459f5[_0x9e32('0x2e')](_0x2a9e4e[_0x9e32('0xab')]);}else{return _0x4459f5[_0x9e32('0x22')](_0x2a9e4e[_0x9e32('0xab')])[_0x9e32('0x32')](_0x2a9e4e[_0x9e32('0x93')]);}}else{return _0x4459f5[_0x9e32('0x2e')](0xc8);}})[_0x9e32('0x51')](handleError(_0x4459f5,null));};exports['webhookPost']=function(_0x4cdd06,_0x16772d,_0x377e29){return BPromise['resolve']()[_0x9e32('0x2a')](function(){if(!_0x4cdd06[_0x9e32('0x3a')]['path']){throw new Error(_0x9e32('0xac'));}if(!_0x4cdd06[_0x9e32('0x3a')][_0x9e32('0x9f')]){throw new Error(_0x9e32('0xa0'));}var _0x28c3d=_0x4cdd06[_0x9e32('0x3a')]['hostname']?_0x4cdd06[_0x9e32('0x3a')][_0x9e32('0xa1')]+':'+_0x4cdd06[_0x9e32('0x3a')][_0x9e32('0x9f')]:_0x9e32('0xa2')+_0x4cdd06['query'][_0x9e32('0x9f')];var _0x4d87e1=_0x4cdd06[_0x9e32('0x3a')]['json']?_0x4cdd06['query']['json']:!![];var _0x15efb7=_0x4cdd06[_0x9e32('0x3a')]['encoding']?_0x4cdd06['query'][_0x9e32('0xa3')]:null;var _0x56cb48={'method':_0x4cdd06[_0x9e32('0xa4')],'uri':util['format'](_0x9e32('0xad'),_0x28c3d,_0x4cdd06[_0x9e32('0x3a')][_0x9e32('0x7')]),'json':_0x4d87e1,'resolveWithFullResponse':!![],'encoding':_0x15efb7,'body':_0x4cdd06['body']};if(_0x4cdd06['headers']){_0x56cb48['headers']=_0x4cdd06[_0x9e32('0xa6')];if(_0x56cb48[_0x9e32('0xa6')][_0x9e32('0xa7')]){delete _0x56cb48['headers'][_0x9e32('0xa7')];}}if(_0x56cb48[_0x9e32('0xa6')][_0x9e32('0xa8')]){delete _0x56cb48[_0x9e32('0xa6')][_0x9e32('0xa8')];}return rp(_0x56cb48);})[_0x9e32('0x2a')](function(_0x1df274){if(_0x1df274){_0x16772d[_0x9e32('0xa9')](_0x1df274['headers']);logger[_0x9e32('0x6c')](_0x1df274[_0x9e32('0x93')]);return _0x16772d[_0x9e32('0x22')](_0x1df274[_0x9e32('0xab')])[_0x9e32('0x32')](_0x1df274[_0x9e32('0x93')]);}else{return _0x16772d[_0x9e32('0x2e')](0xc8);}})['catch'](handleError(_0x16772d,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2448367..51259b6 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 _0x13c5=['emit','hasOwnProperty','events'];(function(_0x4bac2e,_0xdb7d8f){var _0x460173=function(_0x224bbb){while(--_0x224bbb){_0x4bac2e['push'](_0x4bac2e['shift']());}};_0x460173(++_0xdb7d8f);}(_0x13c5,0x7a));var _0x513c=function(_0x341149,_0x4b76d4){_0x341149=_0x341149-0x0;var _0x3fecdd=_0x13c5[_0x341149];return _0x3fecdd;};'use strict';var EventEmitter=require(_0x513c('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432ab7){return function(_0x516e1a,_0x4d46c0,_0x477e2c){PluginEvents[_0x513c('0x1')](_0x432ab7+':'+_0x516e1a['id'],_0x516e1a);PluginEvents[_0x513c('0x1')](_0x432ab7,_0x516e1a);_0x477e2c(null);};}for(var e in events){if(events[_0x513c('0x2')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x2709=['exports','events','Plugin','setMaxListeners','update','emit','hook'];(function(_0x44931b,_0x14057c){var _0xcaa906=function(_0x3fdc8a){while(--_0x3fdc8a){_0x44931b['push'](_0x44931b['shift']());}};_0xcaa906(++_0x14057c);}(_0x2709,0x189));var _0x9270=function(_0x27a93d,_0x30b789){_0x27a93d=_0x27a93d-0x0;var _0x2dbe7b=_0x2709[_0x27a93d];return _0x2dbe7b;};'use strict';var EventEmitter=require(_0x9270('0x0'));var Plugin=require('../../mysqldb')['db'][_0x9270('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9270('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9270('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd5780b){return function(_0x26bdf5,_0x326c2a,_0x2c09b6){PluginEvents[_0x9270('0x4')](_0xd5780b+':'+_0x26bdf5['id'],_0x26bdf5);PluginEvents[_0x9270('0x4')](_0xd5780b,_0x26bdf5);_0x2c09b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x9270('0x5')](e,emitEvent(event));}}module[_0x9270('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e65cfaf..1863332 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 _0x4d9e=['../../config/environment','./plugin.attributes','define','Plugin','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x58e582,_0x41b688){var _0x27f1cd=function(_0x530c74){while(--_0x530c74){_0x58e582['push'](_0x58e582['shift']());}};_0x27f1cd(++_0x41b688);}(_0x4d9e,0x93));var _0xe4d9=function(_0xd6173,_0x3635f5){_0xd6173=_0xd6173-0x0;var _0x201ccb=_0x4d9e[_0xd6173];return _0x201ccb;};'use strict';var _=require('lodash');var util=require(_0xe4d9('0x0'));var logger=require(_0xe4d9('0x1'))(_0xe4d9('0x2'));var moment=require(_0xe4d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4d9('0x4'));var fs=require('fs');var path=require(_0xe4d9('0x5'));var rimraf=require(_0xe4d9('0x6'));var config=require(_0xe4d9('0x7'));var attributes=require(_0xe4d9('0x8'));module['exports']=function(_0x475c75,_0x9c2c72){return _0x475c75[_0xe4d9('0x9')](_0xe4d9('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7eb=['exports','define','plugins','lodash','util','moment','bluebird','path','rimraf','./plugin.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7eb,0x71));var _0xba7e=function(_0x286566,_0xc3d5f5){_0x286566=_0x286566-0x0;var _0x2e8dcc=_0xa7eb[_0x286566];return _0x2e8dcc;};'use strict';var _=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xba7e('0x2'));var BPromise=require(_0xba7e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba7e('0x4'));var rimraf=require(_0xba7e('0x5'));var config=require('../../config/environment');var attributes=require(_0xba7e('0x6'));module[_0xba7e('0x7')]=function(_0x1eb082,_0x3bca48){return _0x1eb082[_0xba7e('0x8')]('Plugin',attributes,{'tableName':_0xba7e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index ae8afc4..64e1eb3 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 _0x5123=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info','request\x20sent'];(function(_0x5365ad,_0x41ec9b){var _0x365519=function(_0x5f0cd2){while(--_0x5f0cd2){_0x5365ad['push'](_0x5365ad['shift']());}};_0x365519(++_0x41ec9b);}(_0x5123,0xb9));var _0x3512=function(_0x3b30df,_0xd79126){_0x3b30df=_0x3b30df-0x0;var _0x3f35c8=_0x5123[_0x3b30df];return _0x3f35c8;};'use strict';var _=require(_0x3512('0x0'));var util=require(_0x3512('0x1'));var moment=require(_0x3512('0x2'));var BPromise=require(_0x3512('0x3'));var rs=require(_0x3512('0x4'));var fs=require('fs');var Redis=require(_0x3512('0x5'));var db=require(_0x3512('0x6'))['db'];var utils=require(_0x3512('0x7'));var logger=require(_0x3512('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson['client'][_0x3512('0xa')]({'port':0x232a});config[_0x3512('0xb')]=_[_0x3512('0xc')](config['redis'],{'host':_0x3512('0xd'),'port':0x18eb});var socket=require(_0x3512('0xe'))(new Redis(config[_0x3512('0xb')]));require(_0x3512('0xf'))[_0x3512('0x10')](socket);function respondWithRpcPromise(_0x969c3b,_0x39de0b,_0x2c8829){return new BPromise(function(_0x2de07e,_0x1a1690){return client['request'](_0x969c3b,_0x2c8829)['then'](function(_0x26c65f){logger[_0x3512('0x11')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x3512('0x12'));logger[_0x3512('0x13')](_0x3512('0x14'),_0x39de0b,_0x3512('0x12'),JSON['stringify'](_0x26c65f));if(_0x26c65f[_0x3512('0x15')]){if(_0x26c65f[_0x3512('0x15')][_0x3512('0x16')]===0x1f4){logger[_0x3512('0x15')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x1a1690(_0x26c65f[_0x3512('0x15')]['message']);}logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x2de07e(_0x26c65f['error'][_0x3512('0x17')]);}else{logger[_0x3512('0x11')](_0x3512('0x18'),_0x39de0b,_0x3512('0x12'));_0x2de07e(_0x26c65f[_0x3512('0x19')]['message']);}})[_0x3512('0x1a')](function(_0x1d1922){logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x1d1922);_0x1a1690(_0x1d1922);});});}exports[_0x3512('0x1b')]=function(_0x41b002){var _0xb6364c=this;return new Promise(function(_0x2abb09,_0x6b9a5e){return db[_0x3512('0x1c')][_0x3512('0x1d')](_0x41b002['body'],{'raw':_0x41b002[_0x3512('0x1e')]?_0x41b002[_0x3512('0x1e')][_0x3512('0x1f')]===undefined?!![]:![]:!![]})[_0x3512('0x20')](function(_0x293ad6){logger[_0x3512('0x11')](_0x3512('0x1b'),_0x41b002);logger[_0x3512('0x13')](_0x3512('0x1b'),_0x41b002,JSON[_0x3512('0x21')](_0x293ad6));_0x2abb09(_0x293ad6);})['catch'](function(_0x47ea87){logger[_0x3512('0x15')](_0x3512('0x1b'),_0x47ea87[_0x3512('0x17')],_0x41b002);_0x6b9a5e(_0xb6364c[_0x3512('0x15')](0x1f4,_0x47ea87[_0x3512('0x17')]));});});}; \ No newline at end of file +var _0xf02e=['catch','CreatePlugin','Plugin','create','body','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf02e,0xbb));var _0xef02=function(_0x12c0d1,_0x17a83b){_0x12c0d1=_0x12c0d1-0x0;var _0x399abd=_0xf02e[_0x12c0d1];return _0x399abd;};'use strict';var _=require('lodash');var util=require(_0xef02('0x0'));var moment=require(_0xef02('0x1'));var BPromise=require(_0xef02('0x2'));var rs=require(_0xef02('0x3'));var fs=require('fs');var Redis=require(_0xef02('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef02('0x5'));var logger=require(_0xef02('0x6'))(_0xef02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xef02('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xef02('0x9')],{'host':_0xef02('0xa'),'port':0x18eb});var socket=require(_0xef02('0xb'))(new Redis(config[_0xef02('0x9')]));require(_0xef02('0xc'))[_0xef02('0xd')](socket);function respondWithRpcPromise(_0x4192d6,_0x1a816f,_0x51fdb0){return new BPromise(function(_0x2597a1,_0x5f2f86){return client[_0xef02('0xe')](_0x4192d6,_0x51fdb0)['then'](function(_0x1302b5){logger['info'](_0xef02('0xf'),_0x1a816f,_0xef02('0x10'));logger[_0xef02('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1a816f,_0xef02('0x10'),JSON[_0xef02('0x12')](_0x1302b5));if(_0x1302b5[_0xef02('0x13')]){if(_0x1302b5[_0xef02('0x13')][_0xef02('0x14')]===0x1f4){logger['error'](_0xef02('0xf'),_0x1a816f,_0x1302b5['error'][_0xef02('0x15')]);return _0x5f2f86(_0x1302b5[_0xef02('0x13')][_0xef02('0x15')]);}logger[_0xef02('0x13')]('Plugin,\x20%s,\x20%s',_0x1a816f,_0x1302b5['error'][_0xef02('0x15')]);return _0x2597a1(_0x1302b5[_0xef02('0x13')][_0xef02('0x15')]);}else{logger[_0xef02('0x16')]('Plugin,\x20%s,\x20%s',_0x1a816f,'request\x20sent');_0x2597a1(_0x1302b5['result'][_0xef02('0x15')]);}})[_0xef02('0x17')](function(_0x39f417){logger[_0xef02('0x13')]('Plugin,\x20%s,\x20%s',_0x1a816f,_0x39f417);_0x5f2f86(_0x39f417);});});}exports[_0xef02('0x18')]=function(_0x16bfe9){var _0x4b3f53=this;return new Promise(function(_0x38c02f,_0x43ca36){return db[_0xef02('0x19')][_0xef02('0x1a')](_0x16bfe9[_0xef02('0x1b')],{'raw':_0x16bfe9['options']?_0x16bfe9['options'][_0xef02('0x1c')]===undefined?!![]:![]:!![]})[_0xef02('0x1d')](function(_0x3a72b1){logger[_0xef02('0x16')](_0xef02('0x18'),_0x16bfe9);logger[_0xef02('0x11')](_0xef02('0x18'),_0x16bfe9,JSON[_0xef02('0x12')](_0x3a72b1));_0x38c02f(_0x3a72b1);})[_0xef02('0x17')](function(_0x248422){logger['error'](_0xef02('0x18'),_0x248422['message'],_0x16bfe9);_0x43ca36(_0x4b3f53[_0xef02('0x13')](0x1f4,_0x248422[_0xef02('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e50746f..4e30d09 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 _0xd3ca=['emit','length','plugin:','./plugin.events','save','update'];(function(_0x4bc4f6,_0x3c540d){var _0x37f94c=function(_0x463473){while(--_0x463473){_0x4bc4f6['push'](_0x4bc4f6['shift']());}};_0x37f94c(++_0x3c540d);}(_0xd3ca,0x177));var _0xad3c=function(_0x217098,_0x55c56d){_0x217098=_0x217098-0x0;var _0x35bbda=_0xd3ca[_0x217098];return _0x35bbda;};'use strict';var PluginEvents=require(_0xad3c('0x0'));var events=[_0xad3c('0x1'),'remove',_0xad3c('0x2')];function createListener(_0x1db8bd,_0x4ec9b2){return function(_0x17c678){_0x4ec9b2[_0xad3c('0x3')](_0x1db8bd,_0x17c678);};}function removeListener(_0x275382,_0x2e34fc){return function(){PluginEvents['removeListener'](_0x275382,_0x2e34fc);};}exports['register']=function(_0x1b0e28){for(var _0x20aaa2=0x0,_0x2bfbc2=events[_0xad3c('0x4')];_0x20aaa2<_0x2bfbc2;_0x20aaa2++){var _0x4761aa=events[_0x20aaa2];var _0x1d5e2f=createListener(_0xad3c('0x5')+_0x4761aa,_0x1b0e28);PluginEvents['on'](_0x4761aa,_0x1d5e2f);}}; \ No newline at end of file +var _0xd7f6=['update','emit','register','./plugin.events','save','remove'];(function(_0x2e5bff,_0x3f0dbf){var _0x535c51=function(_0x589231){while(--_0x589231){_0x2e5bff['push'](_0x2e5bff['shift']());}};_0x535c51(++_0x3f0dbf);}(_0xd7f6,0x11d));var _0x6d7f=function(_0x3ccf07,_0x32e810){_0x3ccf07=_0x3ccf07-0x0;var _0x1908c7=_0xd7f6[_0x3ccf07];return _0x1908c7;};'use strict';var PluginEvents=require(_0x6d7f('0x0'));var events=[_0x6d7f('0x1'),_0x6d7f('0x2'),_0x6d7f('0x3')];function createListener(_0x34116f,_0xc49ff1){return function(_0x561c69){_0xc49ff1[_0x6d7f('0x4')](_0x34116f,_0x561c69);};}function removeListener(_0x50d144,_0x1314ca){return function(){PluginEvents['removeListener'](_0x50d144,_0x1314ca);};}exports[_0x6d7f('0x5')]=function(_0x4c5d93){for(var _0x457eff=0x0,_0x72f729=events['length'];_0x457eff<_0x72f729;_0x457eff++){var _0x43971d=events[_0x457eff];var _0x453623=createListener('plugin:'+_0x43971d,_0x4c5d93);PluginEvents['on'](_0x43971d,_0x453623);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b895fce..29a0a15 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(_0x20b4be,_0x2ed5d6){var _0x1f884e=function(_0x26a8f6){while(--_0x26a8f6){_0x20b4be['push'](_0x20b4be['shift']());}};_0x1f884e(++_0x2ed5d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x3493f6,_0x2a229c){var _0x5db66e=function(_0xb7ffb0){while(--_0xb7ffb0){_0x3493f6['push'](_0x3493f6['shift']());}};_0x5db66e(++_0x2a229c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 3a3e8f9..815c69a 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 _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0xa8a8,0xec));var _0x8a8a=function(_0x39c172,_0x23ed66){_0x39c172=_0x39c172-0x0;var _0x1ecba3=_0xa8a8[_0x39c172];return _0x1ecba3;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file +var _0x222f=['dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','body','join','../../files/plugins','script','chdir','dirname','start'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x222f,0x1a4));var _0xf222=function(_0x32ad69,_0x518f0c){_0x32ad69=_0x32ad69-0x0;var _0x1062ef=_0x222f[_0x32ad69];return _0x1062ef;};'use strict';var _=require(_0xf222('0x0'));var pm2=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var path=require('path');var exec=require('child_process')[_0xf222('0x4')];var BPromise=require(_0xf222('0x5'));function handleEntityNotFound(_0x307791,_0x7b187d){return function(_0x59a619){if(!_0x59a619){_0x307791[_0xf222('0x6')](0x194);;}return _0x59a619;};}function respondWithResult(_0x54a758,_0x112e6d){_0x112e6d=_0x112e6d||0xc8;return function(_0x26f129){if(_0x26f129){return _0x54a758['status'](_0x112e6d)[_0xf222('0x7')](_0x26f129);}return null;};}function handleError(_0x302d7a,_0x4aceb4){_0x4aceb4=_0x4aceb4||0x1f4;return function(_0x31c027){logger[_0xf222('0x8')](_0x31c027[_0xf222('0x9')]);if(_0x31c027[_0xf222('0xa')]){delete _0x31c027[_0xf222('0xa')];}_0x302d7a[_0xf222('0xb')](_0x4aceb4)['send'](_0x31c027);};}function execChildProcess(){return new BPromise(function(_0x2e29ad,_0x405080){exec(_0xf222('0xc'),function(_0x182bc3,_0x48f740,_0x3c9b96){logger[_0xf222('0xd')](_0x48f740);logger[_0xf222('0xd')](_0x3c9b96);if(_0x182bc3){logger[_0xf222('0x8')](_0x182bc3);return _0x405080(_0x182bc3);}return _0x2e29ad(_0x48f740);});});}exports[_0xf222('0xe')]=function(_0x334017,_0x11fca0){return pm2[_0xf222('0xf')]()['then'](function(_0x5b8f97){if(_0x5b8f97){var _0x1feb86=_[_0xf222('0x10')](_0x5b8f97,function(_0x4c2314){return _0x4c2314[_0xf222('0xa')]===_0xf222('0x11')||_0x4c2314[_0xf222('0xa')]===_0xf222('0x12');});return{'rows':_0x1feb86,'count':_0x1feb86[_0xf222('0x13')]};}return null;})[_0xf222('0x14')](respondWithResult(_0x11fca0,null))[_0xf222('0x15')](handleError(_0x11fca0,null));};exports['show']=function(_0x1efa9f,_0x823314){return pm2[_0xf222('0x16')](_0x1efa9f[_0xf222('0x17')]['id'])[_0xf222('0x14')](respondWithResult(_0x823314,null))[_0xf222('0x14')](handleEntityNotFound(_0x823314,null))[_0xf222('0x15')](handleError(_0x823314,null));};exports['create']=function(_0xf26a16,_0x1bdd0a){if(_0xf26a16[_0xf222('0x18')][_0xf222('0xa')]&&_0xf26a16['body']['script']){var _0x398ff4=path[_0xf222('0x19')](__dirname,_0xf222('0x1a'),_0xf26a16[_0xf222('0x18')][_0xf222('0x1b')]);var _0x151a89=process['cwd']();process[_0xf222('0x1c')](path[_0xf222('0x1d')](_0x398ff4));return execChildProcess()[_0xf222('0x14')](function(_0x12d443){process[_0xf222('0x1c')](_0x151a89);return pm2[_0xf222('0x1e')]({'name':_0xf26a16[_0xf222('0x18')][_0xf222('0xa')],'script':_0x398ff4});})['then'](function(_0x145e2e){pm2[_0xf222('0x1f')]();return _0x145e2e[0x0];})[_0xf222('0x14')](respondWithResult(_0x1bdd0a,0xc9))[_0xf222('0x15')](handleError(_0x1bdd0a,null));}else{return _0x1bdd0a[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x21')});}};exports[_0xf222('0x22')]=function(_0x15bf4e,_0x2ec2e9){if(_0x15bf4e[_0xf222('0x18')]['id']){delete _0x15bf4e['body']['id'];}var _0x14b2b1={'online':_0xf222('0x23'),'stopped':_0xf222('0x24')};if(_0x14b2b1[_0xf222('0x25')](_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')])){return pm2[_0x14b2b1[_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')]]](_0x15bf4e[_0xf222('0x17')]['id'])['then'](respondWithResult(_0x2ec2e9,0xc8))[_0xf222('0x15')](handleError(_0x2ec2e9,null));}else{return _0x2ec2e9[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf222('0x26')]=function(_0x5d5963,_0x40c7e7){if(_0x5d5963[_0xf222('0x18')]['id']){delete _0x5d5963[_0xf222('0x18')]['id'];}if(_0x5d5963[_0xf222('0x17')]['id']){return pm2[_0xf222('0x27')](_0x5d5963[_0xf222('0x17')]['id'])[_0xf222('0x14')](function(_0x5075ad){pm2['dump']();return _0x5075ad[0x0];})[_0xf222('0x14')](respondWithResult(_0x40c7e7,null))[_0xf222('0x15')](handleError(_0x40c7e7,null));}else{return _0x40c7e7[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ed91340..73e5b06 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 _0x3d40=['getAgents','exports','express','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3d40,0x15a));var _0x03d4=function(_0x3ef337,_0x2e1a46){_0x3ef337=_0x3ef337-0x0;var _0x49faa5=_0x3d40[_0x3ef337];return _0x49faa5;};'use strict';var express=require(_0x03d4('0x0'));var router=express[_0x03d4('0x1')]();var auth=require(_0x03d4('0x2'));var controller=require(_0x03d4('0x3'));router[_0x03d4('0x4')]('/agents',auth[_0x03d4('0x5')](),controller[_0x03d4('0x6')]);router['get']('/queues',auth[_0x03d4('0x5')](),controller['getQueues']);module[_0x03d4('0x7')]=router; \ No newline at end of file +var _0x6d10=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','./realtime.controller','/agents'];(function(_0x921930,_0x503a11){var _0x574c69=function(_0x19f932){while(--_0x19f932){_0x921930['push'](_0x921930['shift']());}};_0x574c69(++_0x503a11);}(_0x6d10,0x11c));var _0x06d1=function(_0x137828,_0x441e66){_0x137828=_0x137828-0x0;var _0x14b02d=_0x6d10[_0x137828];return _0x14b02d;};'use strict';var express=require(_0x06d1('0x0'));var router=express[_0x06d1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x06d1('0x2'));router['get'](_0x06d1('0x3'),auth[_0x06d1('0x4')](),controller[_0x06d1('0x5')]);router['get'](_0x06d1('0x6'),auth['isAuthenticated'](),controller[_0x06d1('0x7')]);module[_0x06d1('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index bfd592d..1b5cbf6 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x56e60b,_0x3c1bdc){var _0x305ce1=function(_0x98659c){while(--_0x98659c){_0x56e60b['push'](_0x56e60b['shift']());}};_0x305ce1(++_0x3c1bdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x45816a,_0x1b86ad){var _0xcbb020=function(_0x5eb770){while(--_0x5eb770){_0x45816a['push'](_0x45816a['shift']());}};_0xcbb020(++_0x1b86ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4db177a..55092c2 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2b59db,_0x2fd753){var _0x1b8a3b=function(_0x41c9ab){while(--_0x41c9ab){_0x2b59db['push'](_0x2b59db['shift']());}};_0x1b8a3b(++_0x2fd753);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2fbe9b,_0x12d6df){var _0xd88114=function(_0x3c4e96){while(--_0x3c4e96){_0x2fbe9b['push'](_0x2fbe9b['shift']());}};_0xd88114(++_0x12d6df);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e5be972..6a21acd 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 _0x3641=['DATE','STRING','INTEGER','exports'];(function(_0x2ab688,_0x206b54){var _0x352100=function(_0x5a0e54){while(--_0x5a0e54){_0x2ab688['push'](_0x2ab688['shift']());}};_0x352100(++_0x206b54);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1364('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1364('0x1')]},'uniqueid':{'type':Sequelize[_0x1364('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1364('0x1')]},'ringtime':{'type':Sequelize[_0x1364('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1364('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1364('0x2')]}}; \ No newline at end of file +var _0xe6e9=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x145f29,_0x269b45){var _0x12a17f=function(_0x40b9cf){while(--_0x40b9cf){_0x145f29['push'](_0x145f29['shift']());}};_0x12a17f(++_0x269b45);}(_0xe6e9,0x182));var _0x9e6e=function(_0x41beb7,_0x32009c){_0x41beb7=_0x41beb7-0x0;var _0x11529c=_0xe6e9[_0x41beb7];return _0x11529c;};'use strict';var Sequelize=require(_0x9e6e('0x0'));module[_0x9e6e('0x1')]={'state':{'type':Sequelize[_0x9e6e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9e6e('0x3')]},'uniqueid':{'type':Sequelize[_0x9e6e('0x4')]},'starttime':{'type':Sequelize[_0x9e6e('0x3')]},'responsetime':{'type':Sequelize[_0x9e6e('0x3')]},'ringtime':{'type':Sequelize[_0x9e6e('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9e6e('0x4')]},'membername':{'type':Sequelize[_0x9e6e('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 8b40647..a603f75 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 _0xa1a4=['api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x1c27d1,_0x151c13){var _0x424f6d=function(_0x1ed5c3){while(--_0x1ed5c3){_0x1c27d1['push'](_0x1c27d1['shift']());}};_0x424f6d(++_0x151c13);}(_0xa1a4,0x174));var _0x4a1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa1a4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4a1a('0x0'));var util=require(_0x4a1a('0x1'));var logger=require('../../config/logger')(_0x4a1a('0x2'));var moment=require(_0x4a1a('0x3'));var BPromise=require(_0x4a1a('0x4'));var rp=require(_0x4a1a('0x5'));var fs=require('fs');var path=require(_0x4a1a('0x6'));var rimraf=require('rimraf');var config=require(_0x4a1a('0x7'));var attributes=require(_0x4a1a('0x8'));module['exports']=function(_0xff9e94,_0xfd3627){return _0xff9e94['define'](_0x4a1a('0x9'),attributes,{'tableName':_0x4a1a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf8c=['define','report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0xbf8c,0x188));var _0xcbf8=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xbf8c[_0xffa198];return _0x1e4b50;};'use strict';var _=require('lodash');var util=require(_0xcbf8('0x0'));var logger=require(_0xcbf8('0x1'))(_0xcbf8('0x2'));var moment=require(_0xcbf8('0x3'));var BPromise=require(_0xcbf8('0x4'));var rp=require(_0xcbf8('0x5'));var fs=require('fs');var path=require(_0xcbf8('0x6'));var rimraf=require(_0xcbf8('0x7'));var config=require(_0xcbf8('0x8'));var attributes=require(_0xcbf8('0x9'));module[_0xcbf8('0xa')]=function(_0x3ceee8,_0x418927){return _0x3ceee8[_0xcbf8('0xb')]('ReportAgentPreview',attributes,{'tableName':_0xcbf8('0xc'),'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 7a3b89d..b96807d 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 _0xeaa4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify'];(function(_0x32bbda,_0xf42ffe){var _0x311e86=function(_0xc88b2f){while(--_0xc88b2f){_0x32bbda['push'](_0x32bbda['shift']());}};_0x311e86(++_0xf42ffe);}(_0xeaa4,0x105));var _0x4eaa=function(_0xd269fa,_0x116b28){_0xd269fa=_0xd269fa-0x0;var _0x4c5440=_0xeaa4[_0xd269fa];return _0x4c5440;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var moment=require(_0x4eaa('0x2'));var BPromise=require(_0x4eaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eaa('0x4'));var db=require(_0x4eaa('0x5'))['db'];var utils=require(_0x4eaa('0x6'));var logger=require('../../config/logger')(_0x4eaa('0x7'));var config=require(_0x4eaa('0x8'));var jayson=require(_0x4eaa('0x9'));var client=jayson[_0x4eaa('0xa')][_0x4eaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa83ee2,_0x4b7d1,_0x42da1e){return new BPromise(function(_0x45e7d9,_0x24cffe){return client['request'](_0xa83ee2,_0x42da1e)[_0x4eaa('0xc')](function(_0x22f496){logger['info'](_0x4eaa('0xd'),_0x4b7d1,_0x4eaa('0xe'));logger[_0x4eaa('0xf')](_0x4eaa('0x10'),_0x4b7d1,'request\x20sent',JSON['stringify'](_0x22f496));if(_0x22f496[_0x4eaa('0x11')]){if(_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x12')]===0x1f4){logger[_0x4eaa('0x11')](_0x4eaa('0xd'),_0x4b7d1,_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);return _0x24cffe(_0x22f496['error'][_0x4eaa('0x13')]);}logger[_0x4eaa('0x11')](_0x4eaa('0xd'),_0x4b7d1,_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);return _0x45e7d9(_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);}else{logger[_0x4eaa('0x14')](_0x4eaa('0xd'),_0x4b7d1,_0x4eaa('0xe'));_0x45e7d9(_0x22f496['result'][_0x4eaa('0x13')]);}})[_0x4eaa('0x15')](function(_0x497eb0){logger[_0x4eaa('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b7d1,_0x497eb0);_0x24cffe(_0x497eb0);});});}exports[_0x4eaa('0x16')]=function(_0x101122){var _0x571d87=this;return new Promise(function(_0x44536e,_0x34e45d){return db[_0x4eaa('0x17')][_0x4eaa('0x18')](_0x101122[_0x4eaa('0x19')],{'raw':_0x101122['options']?_0x101122[_0x4eaa('0x1a')][_0x4eaa('0x1b')]===undefined?!![]:![]:!![]})[_0x4eaa('0xc')](function(_0x2f3218){logger['info']('CreateReportAgentPreview',_0x101122);logger[_0x4eaa('0xf')](_0x4eaa('0x16'),_0x101122,JSON[_0x4eaa('0x1c')](_0x2f3218));_0x44536e(_0x2f3218);})['catch'](function(_0x236ca2){logger[_0x4eaa('0x11')](_0x4eaa('0x16'),_0x236ca2['message'],_0x101122);_0x34e45d(_0x571d87[_0x4eaa('0x11')](0x1f4,_0x236ca2[_0x4eaa('0x13')]));});});}; \ No newline at end of file +var _0x9c4f=['result','catch','create','options','raw','CreateReportAgentPreview','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x35bfa2,_0x5e5c4a){var _0x118c03=function(_0x48a316){while(--_0x48a316){_0x35bfa2['push'](_0x35bfa2['shift']());}};_0x118c03(++_0x5e5c4a);}(_0x9c4f,0xf1));var _0xf9c4=function(_0x2de9ae,_0x492af5){_0x2de9ae=_0x2de9ae-0x0;var _0xa6a69=_0x9c4f[_0x2de9ae];return _0xa6a69;};'use strict';var _=require(_0xf9c4('0x0'));var util=require(_0xf9c4('0x1'));var moment=require(_0xf9c4('0x2'));var BPromise=require(_0xf9c4('0x3'));var rs=require(_0xf9c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf9c4('0x5'));var logger=require(_0xf9c4('0x6'))(_0xf9c4('0x7'));var config=require(_0xf9c4('0x8'));var jayson=require(_0xf9c4('0x9'));var client=jayson[_0xf9c4('0xa')][_0xf9c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x103339,_0x52c048,_0x203ab1){return new BPromise(function(_0x4d2ab2,_0x4015eb){return client['request'](_0x103339,_0x203ab1)[_0xf9c4('0xc')](function(_0x1897c6){logger['info'](_0xf9c4('0xd'),_0x52c048,_0xf9c4('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x52c048,'request\x20sent',JSON['stringify'](_0x1897c6));if(_0x1897c6[_0xf9c4('0xf')]){if(_0x1897c6['error'][_0xf9c4('0x10')]===0x1f4){logger[_0xf9c4('0xf')](_0xf9c4('0xd'),_0x52c048,_0x1897c6[_0xf9c4('0xf')][_0xf9c4('0x11')]);return _0x4015eb(_0x1897c6[_0xf9c4('0xf')][_0xf9c4('0x11')]);}logger[_0xf9c4('0xf')](_0xf9c4('0xd'),_0x52c048,_0x1897c6[_0xf9c4('0xf')][_0xf9c4('0x11')]);return _0x4d2ab2(_0x1897c6[_0xf9c4('0xf')][_0xf9c4('0x11')]);}else{logger[_0xf9c4('0x12')](_0xf9c4('0xd'),_0x52c048,_0xf9c4('0xe'));_0x4d2ab2(_0x1897c6[_0xf9c4('0x13')][_0xf9c4('0x11')]);}})[_0xf9c4('0x14')](function(_0x47c5cc){logger[_0xf9c4('0xf')](_0xf9c4('0xd'),_0x52c048,_0x47c5cc);_0x4015eb(_0x47c5cc);});});}exports['CreateReportAgentPreview']=function(_0x37add8){var _0x11d2ce=this;return new Promise(function(_0x11094f,_0xe61543){return db['ReportAgentPreview'][_0xf9c4('0x15')](_0x37add8['body'],{'raw':_0x37add8[_0xf9c4('0x16')]?_0x37add8[_0xf9c4('0x16')][_0xf9c4('0x17')]===undefined?!![]:![]:!![]})[_0xf9c4('0xc')](function(_0x2b50c6){logger[_0xf9c4('0x12')](_0xf9c4('0x18'),_0x37add8);logger[_0xf9c4('0x19')](_0xf9c4('0x18'),_0x37add8,JSON['stringify'](_0x2b50c6));_0x11094f(_0x2b50c6);})[_0xf9c4('0x14')](function(_0x1efd4d){logger[_0xf9c4('0xf')]('CreateReportAgentPreview',_0x1efd4d[_0xf9c4('0x11')],_0x37add8);_0xe61543(_0x11d2ce['error'](0x1f4,_0x1efd4d[_0xf9c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 31cc83a..8ec73ad 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 _0x9165=['get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','trunks','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','queueNotify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x9165,0x17c));var _0x5916=function(_0x1a9c94,_0x2f2473){_0x1a9c94=_0x1a9c94-0x0;var _0x9c8ea=_0x9165[_0x1a9c94];return _0x9c8ea;};'use strict';var multer=require(_0x5916('0x0'));var util=require('util');var path=require(_0x5916('0x1'));var express=require(_0x5916('0x2'));var router=express[_0x5916('0x3')]();var auth=require(_0x5916('0x4'));var controller=require('./rpc.controller');router[_0x5916('0x5')]('/voice/channels',auth[_0x5916('0x6')](),controller['voiceChannels']);router[_0x5916('0x5')](_0x5916('0x7'),auth[_0x5916('0x6')](),controller['voiceChannelMixMonitor']);router[_0x5916('0x5')](_0x5916('0x8'),auth[_0x5916('0x6')](),controller[_0x5916('0x9')]);router[_0x5916('0x5')](_0x5916('0xa'),auth[_0x5916('0x6')](),controller[_0x5916('0xb')]);router['get'](_0x5916('0xc'),auth[_0x5916('0x6')](),controller[_0x5916('0xd')]);router['get'](_0x5916('0xe'),auth[_0x5916('0x6')](),controller[_0x5916('0xf')]);router['get'](_0x5916('0x10'),auth[_0x5916('0x6')](),controller[_0x5916('0x11')]);router[_0x5916('0x5')](_0x5916('0x12'),auth[_0x5916('0x6')](),controller[_0x5916('0x13')]);router[_0x5916('0x5')](_0x5916('0x14'),auth[_0x5916('0x6')](),controller['smsQueues']);router[_0x5916('0x5')](_0x5916('0x15'),auth[_0x5916('0x6')](),controller[_0x5916('0x16')]);router['get'](_0x5916('0x17'),auth[_0x5916('0x6')](),controller[_0x5916('0x18')]);router[_0x5916('0x5')](_0x5916('0x19'),auth[_0x5916('0x6')](),controller[_0x5916('0x1a')]);router[_0x5916('0x5')](_0x5916('0x1b'),auth[_0x5916('0x6')](),controller[_0x5916('0x1c')]);router[_0x5916('0x5')](_0x5916('0x1d'),auth[_0x5916('0x6')](),controller[_0x5916('0x1e')]);router[_0x5916('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x5916('0x1f')]);router[_0x5916('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5916('0x6')](),controller[_0x5916('0x20')]);router[_0x5916('0x5')](_0x5916('0x21'),auth[_0x5916('0x6')](),controller[_0x5916('0x22')]);router['put'](_0x5916('0x21'),auth[_0x5916('0x6')](),controller[_0x5916('0x23')]);router[_0x5916('0x5')](_0x5916('0x24'),auth[_0x5916('0x6')](),controller['outbound']);router['get'](_0x5916('0x25'),auth[_0x5916('0x6')](),controller['outboundChannels']);router[_0x5916('0x5')](_0x5916('0x26'),auth[_0x5916('0x6')](),controller[_0x5916('0x27')]);router[_0x5916('0x28')](_0x5916('0x29'),auth['isAuthenticated'](),controller[_0x5916('0x2a')]);router['get']('/telephones',auth['isAuthenticated'](),controller['telephones']);router['get']('/trunks',auth[_0x5916('0x6')](),controller[_0x5916('0x2b')]);router[_0x5916('0x5')]('/campaigns',auth[_0x5916('0x6')](),controller['campaigns']);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x5916('0x2c')]);router[_0x5916('0x5')]('/chat/queues/waitinginteractions',auth[_0x5916('0x6')](),controller[_0x5916('0x2d')]);router[_0x5916('0x5')](_0x5916('0x2e'),auth[_0x5916('0x6')](),controller[_0x5916('0x2f')]);router[_0x5916('0x5')](_0x5916('0x30'),auth[_0x5916('0x6')](),controller[_0x5916('0x31')]);router[_0x5916('0x5')](_0x5916('0x32'),auth['isAuthenticated'](),controller[_0x5916('0x33')]);router[_0x5916('0x5')](_0x5916('0x34'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x5916('0x5')](_0x5916('0x35'),auth[_0x5916('0x6')](),controller[_0x5916('0x36')]);router[_0x5916('0x5')](_0x5916('0x37'),auth[_0x5916('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x5916('0x38')]('/mail/queues/:id/notify',auth[_0x5916('0x6')](),controller['queueNotify'](_0x5916('0x39')));router[_0x5916('0x5')](_0x5916('0x3a'),auth[_0x5916('0x6')](),controller[_0x5916('0x3b')]);router[_0x5916('0x38')](_0x5916('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0x5916('0x3d')));router[_0x5916('0x5')]('/chat/queues/:id',auth[_0x5916('0x6')](),controller[_0x5916('0x3e')]);router[_0x5916('0x38')](_0x5916('0x3f'),auth[_0x5916('0x6')](),controller[_0x5916('0x40')]('fax'));router['get']('/fax/queues/:id',auth[_0x5916('0x6')](),controller['showFaxQueues']);router[_0x5916('0x38')]('/openchannel/queues/:id/notify',auth[_0x5916('0x6')](),controller['queueNotify'](_0x5916('0x41')));router['get'](_0x5916('0x42'),auth[_0x5916('0x6')](),controller[_0x5916('0x43')]);router[_0x5916('0x38')](_0x5916('0x44'),auth['isAuthenticated'](),controller[_0x5916('0x40')](_0x5916('0x45')));router[_0x5916('0x38')](_0x5916('0x46'),auth[_0x5916('0x6')](),controller[_0x5916('0x40')](_0x5916('0x47')));router[_0x5916('0x5')](_0x5916('0x48'),auth['isAuthenticated'](),controller[_0x5916('0x49')]);router['get'](_0x5916('0x4a'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x5916('0x4b'),auth[_0x5916('0x6')](),controller['agentNotify']);module[_0x5916('0x4c')]=router; \ No newline at end of file +var _0xe14b=['/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','chat','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup'];(function(_0xc7ed29,_0x515330){var _0xf8da19=function(_0x1bd99c){while(--_0x1bd99c){_0xc7ed29['push'](_0xc7ed29['shift']());}};_0xf8da19(++_0x515330);}(_0xe14b,0xc5));var _0xbe14=function(_0x153e52,_0x26b975){_0x153e52=_0x153e52-0x0;var _0x124eae=_0xe14b[_0x153e52];return _0x124eae;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require(_0xbe14('0x2'));var express=require('express');var router=express[_0xbe14('0x3')]();var auth=require(_0xbe14('0x4'));var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')](_0xbe14('0x7'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x9')]);router['get'](_0xbe14('0xa'),auth[_0xbe14('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0xbe14('0xb'),auth[_0xbe14('0x8')](),controller[_0xbe14('0xc')]);router[_0xbe14('0x6')](_0xbe14('0xd'),auth[_0xbe14('0x8')](),controller[_0xbe14('0xe')]);router['get'](_0xbe14('0xf'),auth['isAuthenticated'](),controller[_0xbe14('0x10')]);router[_0xbe14('0x6')](_0xbe14('0x11'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x6')](_0xbe14('0x13'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x14')]);router[_0xbe14('0x6')](_0xbe14('0x15'),auth['isAuthenticated'](),controller[_0xbe14('0x16')]);router[_0xbe14('0x6')](_0xbe14('0x17'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x18')]);router['get'](_0xbe14('0x19'),auth['isAuthenticated'](),controller[_0xbe14('0x1a')]);router['get'](_0xbe14('0x1b'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x1c')]);router['get']('/voice/queues/preview/:id',auth[_0xbe14('0x8')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x6')](_0xbe14('0x1e'),auth[_0xbe14('0x8')](),controller['voiceQueuesChannels']);router[_0xbe14('0x6')](_0xbe14('0x1f'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x20')]);router[_0xbe14('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xbe14('0x8')](),controller[_0xbe14('0x21')]);router[_0xbe14('0x6')](_0xbe14('0x22'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x23')]);router['get'](_0xbe14('0x24'),auth['isAuthenticated'](),controller[_0xbe14('0x25')]);router[_0xbe14('0x26')](_0xbe14('0x24'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x27')]);router[_0xbe14('0x6')](_0xbe14('0x28'),auth[_0xbe14('0x8')](),controller['outbound']);router[_0xbe14('0x6')](_0xbe14('0x29'),auth[_0xbe14('0x8')](),controller['outboundChannels']);router[_0xbe14('0x6')]('/agents',auth[_0xbe14('0x8')](),controller['agents']);router[_0xbe14('0x26')](_0xbe14('0x2a'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x2b')]);router['get'](_0xbe14('0x2c'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x2d')]);router['get']('/trunks',auth[_0xbe14('0x8')](),controller[_0xbe14('0x2e')]);router['get'](_0xbe14('0x2f'),auth['isAuthenticated'](),controller[_0xbe14('0x30')]);router['get'](_0xbe14('0x31'),auth['isAuthenticated'](),controller[_0xbe14('0x32')]);router[_0xbe14('0x6')](_0xbe14('0x33'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x34')]);router[_0xbe14('0x6')](_0xbe14('0x35'),auth[_0xbe14('0x8')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xbe14('0x36'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x37')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xbe14('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xbe14('0x6')]('/sms/queues/waitinginteractions',auth[_0xbe14('0x8')](),controller[_0xbe14('0x38')]);router[_0xbe14('0x6')](_0xbe14('0x39'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x3a')]);router['get']('/fax/queues/waitinginteractions',auth[_0xbe14('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xbe14('0x3b')]('/mail/queues/:id/notify',auth[_0xbe14('0x8')](),controller[_0xbe14('0x3c')](_0xbe14('0x3d')));router['get'](_0xbe14('0x3e'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0xbe14('0x3b')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xbe14('0x3f')));router[_0xbe14('0x6')]('/chat/queues/:id',auth[_0xbe14('0x8')](),controller['showChatQueues']);router['post'](_0xbe14('0x40'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x3c')]('fax'));router[_0xbe14('0x6')](_0xbe14('0x41'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x42')]);router[_0xbe14('0x3b')](_0xbe14('0x43'),auth['isAuthenticated'](),controller[_0xbe14('0x3c')](_0xbe14('0x44')));router['get']('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xbe14('0x3b')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xbe14('0x3c')](_0xbe14('0x45')));router[_0xbe14('0x3b')]('/whatsapp/queues/:id/notify',auth[_0xbe14('0x8')](),controller[_0xbe14('0x3c')](_0xbe14('0x46')));router['get'](_0xbe14('0x47'),auth['isAuthenticated'](),controller['showSmsQueues']);router['get'](_0xbe14('0x48'),auth['isAuthenticated'](),controller[_0xbe14('0x49')]);router['post'](_0xbe14('0x4a'),auth[_0xbe14('0x8')](),controller[_0xbe14('0x4b')]);module[_0xbe14('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b598398..6555f70 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 _0x8ada=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','openchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','messageId','update','InteractionId','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels'];(function(_0x59b4c5,_0x32dc27){var _0x45ce98=function(_0x1e0b45){while(--_0x1e0b45){_0x59b4c5['push'](_0x59b4c5['shift']());}};_0x45ce98(++_0x32dc27);}(_0x8ada,0x6b));var _0xa8ad=function(_0x35ef7a,_0x2b3df3){_0x35ef7a=_0x35ef7a-0x0;var _0x3e1c56=_0x8ada[_0x35ef7a];return _0x3e1c56;};'use strict';var BPromise=require(_0xa8ad('0x0'));var moment=require(_0xa8ad('0x1'));var _=require(_0xa8ad('0x2'));var util=require('util');var db=require(_0xa8ad('0x3'))['db'];var logger=require(_0xa8ad('0x4'))(_0xa8ad('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa8ad('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xa8ad('0x6')][_0xa8ad('0x7')]({'port':0x232b});var routingClient=jayson[_0xa8ad('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4f6fc9,_0x4d8318,_0x52c007){return new BPromise(function(_0x1dfc8d,_0x571c33){var _0x1b11a1=_0x52c007?_0x52c007:amiClient;return _0x1b11a1[_0xa8ad('0x8')](_0x4f6fc9,_0x4d8318)[_0xa8ad('0x9')](function(_0x56cc90){if(_0x56cc90['error']){if(_0x56cc90[_0xa8ad('0xa')][_0xa8ad('0xb')]===0x1f4){return _0x571c33(_0x56cc90[_0xa8ad('0xa')][_0xa8ad('0xc')]);}return _0x1dfc8d(_0x56cc90['error'][_0xa8ad('0xc')]);}else{_0x1dfc8d(_0x56cc90[_0xa8ad('0xd')]);}})['catch'](function(_0x2cdb58){_0x571c33(_0x2cdb58);});});}function respondWithResult(_0x228464,_0x531485){_0x531485=_0x531485||0xc8;return function(_0x59638f){if(_0x59638f){return _0x228464[_0xa8ad('0xe')](_0x531485)['json'](_0x59638f);}return _0x228464[_0xa8ad('0xf')](0x194);};}function handleError(_0x3704c4,_0x422e6b){_0x422e6b=_0x422e6b||0x1f4;return function(_0x5d01cc){logger['error'](_0x5d01cc[_0xa8ad('0x10')]);if(_0x5d01cc[_0xa8ad('0x11')]){delete _0x5d01cc[_0xa8ad('0x11')];}_0x3704c4['status'](_0x422e6b)[_0xa8ad('0x12')](_0x5d01cc);};}function findById(_0x42ec81){return function(_0x88ef34){if(!_[_0xa8ad('0x13')](_0x42ec81)&&!_[_0xa8ad('0x13')](_0x88ef34)&&!_[_0xa8ad('0x13')](_0x88ef34['rows'])){return _[_0xa8ad('0x14')](_0x88ef34[_0xa8ad('0x15')],function(_0x38ad30){return _0x38ad30['id']==_0x42ec81;});}return null;};}exports[_0xa8ad('0x16')]=function(_0x5e1620,_0x998c22){return respondWithRpcPromise(_0xa8ad('0x17'),_0x5e1620[_0xa8ad('0x18')])['then'](respondWithResult(_0x998c22,null))['catch'](handleError(_0x998c22,null));};exports[_0xa8ad('0x19')]=function(_0x2ef798,_0x102902){return respondWithRpcPromise(_0xa8ad('0x1a'),_['merge'](_0x2ef798[_0xa8ad('0x18')],_0x2ef798[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x102902,null))[_0xa8ad('0x1c')](handleError(_0x102902,null));};exports[_0xa8ad('0x1d')]=function(_0x13dd43,_0x360297){return respondWithRpcPromise(_0xa8ad('0x1e'),_[_0xa8ad('0x1f')](_0x13dd43[_0xa8ad('0x18')],_0x13dd43[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x360297,null))[_0xa8ad('0x1c')](handleError(_0x360297,null));};exports[_0xa8ad('0x20')]=function(_0x2451c7,_0x2f3580){return respondWithRpcPromise('VoiceQueues',_0x2451c7[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x2f3580,null))['catch'](handleError(_0x2f3580,null));};exports[_0xa8ad('0x21')]=function(_0x20dd4d,_0x4e3af2){return respondWithRpcPromise('VoiceQueues',_0x20dd4d[_0xa8ad('0x18')])[_0xa8ad('0x9')](findById(_0x20dd4d[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x4e3af2,null))[_0xa8ad('0x1c')](handleError(_0x4e3af2,null));};exports[_0xa8ad('0x22')]=function(_0x1b4550,_0x5c2d80){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa8ad('0x1f')](_0x1b4550[_0xa8ad('0x23')],_0x1b4550[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x5c2d80,null))[_0xa8ad('0x1c')](handleError(_0x5c2d80,null));};exports[_0xa8ad('0x24')]=function(_0xff55a4,_0x416b79){return respondWithRpcPromise(_0xa8ad('0x25'),_[_0xa8ad('0x1f')](_0xff55a4[_0xa8ad('0x18')],_0xff55a4[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x416b79,null))[_0xa8ad('0x1c')](handleError(_0x416b79,null));};exports[_0xa8ad('0x26')]=function(_0xcabd5f,_0x249aee){return respondWithRpcPromise(_0xa8ad('0x27'),_0xcabd5f[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x249aee,null))[_0xa8ad('0x1c')](handleError(_0x249aee,null));};exports[_0xa8ad('0x28')]=function(_0x11116a,_0x3a5f2f){return respondWithRpcPromise(_0xa8ad('0x29'),_[_0xa8ad('0x1f')](_0x11116a[_0xa8ad('0x18')],_0x11116a[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x3a5f2f,null))[_0xa8ad('0x1c')](handleError(_0x3a5f2f,null));};exports[_0xa8ad('0x2a')]=function(_0x2eb7f6,_0x564258){return respondWithRpcPromise(_0xa8ad('0x2b'),_[_0xa8ad('0x1f')](_0x2eb7f6[_0xa8ad('0x18')],_0x2eb7f6[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x564258,null))[_0xa8ad('0x1c')](handleError(_0x564258,null));};exports[_0xa8ad('0x2c')]=function(_0x3692b5,_0x2040f7){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa8ad('0x1f')](_0x3692b5[_0xa8ad('0x18')],_0x3692b5[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x2040f7,null))['catch'](handleError(_0x2040f7,null));};exports[_0xa8ad('0x2d')]=function(_0x457c46,_0x27e3e3){return respondWithRpcPromise(_0xa8ad('0x2e'),_0x457c46['query'])[_0xa8ad('0x9')](respondWithResult(_0x27e3e3,null))[_0xa8ad('0x1c')](handleError(_0x27e3e3,null));};exports[_0xa8ad('0x2f')]=function(_0x4ab66e,_0x23866c){return respondWithRpcPromise(_0xa8ad('0x30'),_0x4ab66e[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x23866c,null))[_0xa8ad('0x1c')](handleError(_0x23866c,null));};exports[_0xa8ad('0x31')]=function(_0x47cbf4,_0x1566ad){var _0x71e32f;return respondWithRpcPromise('Agents',_0x47cbf4[_0xa8ad('0x18')])[_0xa8ad('0x9')](function(_0x5aae58){_0x71e32f=_0x5aae58;return respondWithRpcPromise('Agents',_0x47cbf4[_0xa8ad('0x18')],routingClient);})[_0xa8ad('0x9')](function(_0x1b8c25){return _[_0xa8ad('0x1f')]({},_0x1b8c25,_0x71e32f);})[_0xa8ad('0x9')](respondWithResult(_0x1566ad,null))[_0xa8ad('0x1c')](handleError(_0x1566ad,null));};exports[_0xa8ad('0x32')]=function(_0x11b5f0,_0x12af2e){if(_0x11b5f0[_0xa8ad('0x23')]&&_0x11b5f0['body']['interaction']&&_0x11b5f0[_0xa8ad('0x33')]&&_0x11b5f0[_0xa8ad('0x33')]['name']){for(var _0x1eaca5 in _0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')]){if(_0x11b5f0['body'][_0xa8ad('0x34')][_0xa8ad('0x35')](_0x1eaca5)){db[_0xa8ad('0x36')]['findAll']({'where':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')]['name'],'type':_0xa8ad('0x37'),'exitAt':null,'uniqueid':_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5]&&_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5][_0xa8ad('0x38')]?{'$notIn':_0x11b5f0[_0xa8ad('0x23')]['interaction'][_0x1eaca5]}:{'$ne':null}}})['then'](function(_0x876a08){var _0x18b05e=moment()[_0xa8ad('0x39')](_0xa8ad('0x3a'));for(var _0x16aa0c=0x0,_0x805fe0=_0x876a08[_0xa8ad('0x38')];_0x16aa0c<_0x805fe0;_0x16aa0c+=0x1){_0x876a08[_0x16aa0c][_0xa8ad('0x3b')]({'exitAt':_0x18b05e});}});for(var _0x4c665d=0x0;_0x4c665d<_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5]['length'];_0x4c665d+=0x1){db[_0xa8ad('0x36')][_0xa8ad('0x3c')]({'where':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')],'type':_0xa8ad('0x37'),'uniqueid':_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5][_0x4c665d],'exitAt':null},'defaults':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')],'interface':_[_0xa8ad('0x13')](_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x3d')])?util['format'](_0xa8ad('0x3e'),_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')]):_0x11b5f0['user'][_0xa8ad('0x3d')],'type':_0xa8ad('0x37'),'enterAt':moment()[_0xa8ad('0x39')](_0xa8ad('0x3a')),'role':_0xa8ad('0x3f'),'internal':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x40')],'uniqueid':_0x11b5f0['body'][_0xa8ad('0x34')][_0x1eaca5][_0x4c665d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x11b5f0['params']['id'],'capacity':_0x11b5f0[_0xa8ad('0x23')]['capacity']},routingClient)[_0xa8ad('0x9')](respondWithResult(_0x12af2e,null))[_0xa8ad('0x1c')](handleError(_0x12af2e,null));};exports[_0xa8ad('0x41')]=function(_0x18d513,_0x45507d){return respondWithRpcPromise(_0xa8ad('0x42'),_0x18d513[_0xa8ad('0x18')])['then'](respondWithResult(_0x45507d,null))['catch'](handleError(_0x45507d,null));};exports[_0xa8ad('0x43')]=function(_0x277ecc,_0x25d860){return respondWithRpcPromise(_0xa8ad('0x44'),_0x277ecc['query'])[_0xa8ad('0x9')](respondWithResult(_0x25d860,null))[_0xa8ad('0x1c')](handleError(_0x25d860,null));};exports[_0xa8ad('0x45')]=function(_0x43644d,_0x418228){return respondWithRpcPromise(_0xa8ad('0x46'),_0x43644d[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x418228,null))[_0xa8ad('0x1c')](handleError(_0x418228,null));};exports[_0xa8ad('0x47')]=function(_0x43a2a5,_0x57ff70){return respondWithRpcPromise('ChatQueues',_0x43a2a5[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x57ff70,null))[_0xa8ad('0x1c')](handleError(_0x57ff70,null));};exports[_0xa8ad('0x48')]=function(_0x414260,_0x31f35f){return respondWithRpcPromise(_0xa8ad('0x49'),_0x414260[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0x414260[_0xa8ad('0x1b')]['id']))['then'](respondWithResult(_0x31f35f,null))['catch'](handleError(_0x31f35f,null));};exports[_0xa8ad('0x4a')]=function(_0x194503,_0x5d18a6){return respondWithRpcPromise('MailQueues',_0x194503[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x5d18a6,null))[_0xa8ad('0x1c')](handleError(_0x5d18a6,null));};exports['showMailQueues']=function(_0x2513dd,_0x31fedc){return respondWithRpcPromise(_0xa8ad('0x4b'),_0x2513dd[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0x2513dd[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x31fedc,null))['catch'](handleError(_0x31fedc,null));};exports['mailAccounts']=function(_0x2bb664,_0x5566dd){return respondWithRpcPromise('MailAccounts',_0x2bb664[_0xa8ad('0x18')],mailClient)['then'](respondWithResult(_0x5566dd,null))[_0xa8ad('0x1c')](handleError(_0x5566dd,null));};exports[_0xa8ad('0x4c')]=function(_0x1b9c9c,_0x45019e){return respondWithRpcPromise('OpenchannelQueues',_0x1b9c9c[_0xa8ad('0x18')],routingClient)['then'](respondWithResult(_0x45019e,null))[_0xa8ad('0x1c')](handleError(_0x45019e,null));};exports[_0xa8ad('0x4d')]=function(_0x14d215,_0x2ee02d){return respondWithRpcPromise('OpenchannelQueues',_0x14d215['query'],routingClient)[_0xa8ad('0x9')](findById(_0x14d215[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x2ee02d,null))[_0xa8ad('0x1c')](handleError(_0x2ee02d,null));};exports['smsQueues']=function(_0x27dc7d,_0x15203b){return respondWithRpcPromise('SmsQueues',_0x27dc7d[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x15203b,null))[_0xa8ad('0x1c')](handleError(_0x15203b,null));};exports[_0xa8ad('0x4e')]=function(_0xc524a4,_0x3541e6){return respondWithRpcPromise(_0xa8ad('0x4f'),_0xc524a4[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0xc524a4[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x3541e6,null))[_0xa8ad('0x1c')](handleError(_0x3541e6,null));};exports[_0xa8ad('0x50')]=function(_0x13f80f,_0x298827){return respondWithRpcPromise(_0xa8ad('0x51'),_0x13f80f[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x298827,null))[_0xa8ad('0x1c')](handleError(_0x298827,null));};exports[_0xa8ad('0x52')]=function(_0xdaf23c,_0x3d6d3f){return respondWithRpcPromise(_0xa8ad('0x51'),_0xdaf23c['query'],routingClient)[_0xa8ad('0x9')](findById(_0xdaf23c[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x3d6d3f,null))[_0xa8ad('0x1c')](handleError(_0x3d6d3f,null));};exports[_0xa8ad('0x53')]=function(_0x573381,_0x473138){return respondWithRpcPromise(_0xa8ad('0x54'),_0x573381['query'],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x473138,null))['catch'](handleError(_0x473138,null));};exports[_0xa8ad('0x55')]=function(_0x44c734,_0x27ed1d){return respondWithRpcPromise(_0xa8ad('0x54'),_0x44c734['query'],routingClient)[_0xa8ad('0x9')](findById(_0x44c734[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x27ed1d,null))[_0xa8ad('0x1c')](handleError(_0x27ed1d,null));};exports[_0xa8ad('0x56')]=function(_0x4f8127,_0x424f02){return respondWithRpcPromise(_0xa8ad('0x57'),_0x4f8127[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x424f02,null))[_0xa8ad('0x1c')](handleError(_0x424f02,null));};exports[_0xa8ad('0x58')]=function(_0x245f86,_0x1ab594){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x245f86[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x1ab594,null))[_0xa8ad('0x1c')](handleError(_0x1ab594,null));};exports[_0xa8ad('0x59')]=function(_0x455688,_0x17a072){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x455688[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x17a072,null))[_0xa8ad('0x1c')](handleError(_0x17a072,null));};exports[_0xa8ad('0x5a')]=function(_0x2819fa,_0x28f0ab){return respondWithRpcPromise(_0xa8ad('0x5b'),_0x2819fa[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x28f0ab,null))[_0xa8ad('0x1c')](handleError(_0x28f0ab,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4b9761,_0x4d83c9){return respondWithRpcPromise(_0xa8ad('0x5b'),_0x4b9761[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](function(_0x186c98){if(_0x4b9761[_0xa8ad('0x18')][_0xa8ad('0x5c')]!==undefined){var _0x9969e1=_(_0x186c98[_0xa8ad('0x15')])[_0xa8ad('0x5d')]([_0x4b9761[_0xa8ad('0x18')]['type'],_0x4b9761[_0xa8ad('0x1b')]['id']])[_0xa8ad('0x5e')](_0xa8ad('0x5f'))[_0xa8ad('0x60')]()['value']();return _0x186c98[_0xa8ad('0x15')]['filter'](function(_0x2d6529){return _0x9969e1[_0xa8ad('0x61')](_0x2d6529[_0xa8ad('0x5f')])>-0x1;});}else{return _0x186c98['rows']['filter'](function(_0x358baf){return _0x358baf['queue_id']===parseInt(_0x4b9761['params']['id']);});}})[_0xa8ad('0x9')](respondWithResult(_0x4d83c9,null))[_0xa8ad('0x1c')](handleError(_0x4d83c9,null));};exports[_0xa8ad('0x62')]=function(_0x1ccc66,_0x24c8c9){return respondWithRpcPromise(_0xa8ad('0x63'),_0x1ccc66['query'],routingClient)['then'](respondWithResult(_0x24c8c9,null))[_0xa8ad('0x1c')](handleError(_0x24c8c9,null));};exports[_0xa8ad('0x64')]=function(_0xdfabf8,_0x43c813){return respondWithRpcPromise(_0xa8ad('0x65'),_0xdfabf8[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x43c813,null))[_0xa8ad('0x1c')](handleError(_0x43c813,null));};exports[_0xa8ad('0x66')]=function(_0x460336,_0x5d1364){return respondWithRpcPromise(_0xa8ad('0x67'),_0x460336[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x5d1364,null))[_0xa8ad('0x1c')](handleError(_0x5d1364,null));};exports[_0xa8ad('0x68')]=function(_0x9bbe79){return function(_0xcb88de,_0x1d9b8e){var _0x5e6406,_0x359ab2;var _0x439293=_[_0xa8ad('0x69')](_0x9bbe79);var _0x5ba816=_0x9bbe79===_0xa8ad('0x6a')?_0xa8ad('0x6b'):_0xa8ad('0x6c');return db[_0x439293+_0xa8ad('0x6d')][_0xa8ad('0x6e')]({'raw':!![],'where':{'id':_0xcb88de[_0xa8ad('0x1b')]['id']}})[_0xa8ad('0x9')](function(_0x170bdd){if(_['isNil'](_0x170bdd)){throw new Error(_0x439293+_0xa8ad('0x6f'));}_0x5e6406=_0x170bdd;return db[_0x439293+_0xa8ad('0x70')][_0xa8ad('0x6e')]({'where':{'id':_0xcb88de[_0xa8ad('0x23')]['messageId']},'include':[{'model':db[_0x439293+_0xa8ad('0x71')],'as':_0xa8ad('0x71')},{'model':db[_0x439293+_0x5ba816],'as':_0xa8ad('0x6c')}]});})[_0xa8ad('0x9')](function(_0x6d38a7){if(_[_0xa8ad('0x13')](_0x6d38a7)){throw new Error(_0x439293+_0xa8ad('0x72'));}_0x359ab2=_0x6d38a7;return _0x6d38a7['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x29ecc9={'uniqueid':_0x9bbe79+'.'+_0x359ab2['id']+'.'+_0x359ab2[_0xa8ad('0x71')]['id'],'FromUserId':_0xcb88de[_0xa8ad('0x33')]['id'],'type':_0xa8ad('0x73')};_0x29ecc9[_0x439293+_0xa8ad('0x74')]=_0x359ab2['id'];_0x29ecc9[_0x439293+'InteractionId']=_0x359ab2['Interaction']['id'];_0x29ecc9[_0xa8ad('0x75')+_0x439293+_0x5ba816+'Id']=_0x359ab2['Account']['id'];_0x29ecc9['To'+_0x439293+_0xa8ad('0x76')]=_0x5e6406['id'];return db[_0x439293+_0xa8ad('0x77')][_0xa8ad('0x78')](_0x29ecc9);})['then'](function(){return respondWithRpcPromise(_0xa8ad('0x79'),{'channel':_0x9bbe79,'interaction':_0x359ab2[_0xa8ad('0x71')],'message':_0x359ab2,'account':_0x359ab2[_0xa8ad('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa8ad('0x73'),'appdata':_0x5e6406['name']+','+(_0x359ab2[_0xa8ad('0x6c')][_0xa8ad('0x7a')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1d9b8e,null))[_0xa8ad('0x1c')](handleError(_0x1d9b8e,null));};};exports[_0xa8ad('0x7b')]=function(_0x108662,_0x1b1589){var _0x15b34a,_0x3854eb;if(_[_0xa8ad('0x13')](_0x108662[_0xa8ad('0x23')][_0xa8ad('0x7c')])){throw new Error(_0xa8ad('0x7d'));}var _0x4dde9e=_0x108662[_0xa8ad('0x23')]['channel'];var _0x12ef36=_['capitalize'](_0x4dde9e);var _0x2d31a0=_0x4dde9e===_0xa8ad('0x6a')?_0xa8ad('0x6b'):_0xa8ad('0x6c');return db['User'][_0xa8ad('0x6e')]({'raw':!![],'where':{'id':_0x108662['params']['id'],'role':_0xa8ad('0x3f')}})[_0xa8ad('0x9')](function(_0x2c1a1d){if(_[_0xa8ad('0x13')](_0x2c1a1d)){throw new Error(_0xa8ad('0x7e'));}_0x15b34a=_0x2c1a1d;return db[_0x12ef36+'Message'][_0xa8ad('0x6e')]({'where':{'id':_0x108662[_0xa8ad('0x23')][_0xa8ad('0x7f')]},'include':[{'model':db[_0x12ef36+'Interaction'],'as':_0xa8ad('0x71')},{'model':db[_0x12ef36+_0x2d31a0],'as':_0xa8ad('0x6c')}]});})[_0xa8ad('0x9')](function(_0x97944){if(_[_0xa8ad('0x13')](_0x97944)){throw new Error(_0x12ef36+_0xa8ad('0x72'));}_0x3854eb=_0x97944;return _0x97944[_0xa8ad('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa8ad('0x9')](function(){var _0xdc14bf={'uniqueid':_0x4dde9e+'.'+_0x3854eb['id']+'.'+_0x3854eb[_0xa8ad('0x71')]['id'],'FromUserId':_0x108662[_0xa8ad('0x33')]['id'],'type':_0xa8ad('0x3f'),'ToUserId':_0x15b34a['id']};_0xdc14bf[_0x12ef36+_0xa8ad('0x74')]=_0x3854eb['id'];_0xdc14bf[_0x12ef36+_0xa8ad('0x81')]=_0x3854eb[_0xa8ad('0x71')]['id'];_0xdc14bf[_0xa8ad('0x75')+_0x12ef36+_0x2d31a0+'Id']=_0x3854eb[_0xa8ad('0x6c')]['id'];return db[_0x12ef36+_0xa8ad('0x77')]['create'](_0xdc14bf);})[_0xa8ad('0x9')](function(){return respondWithRpcPromise(_0xa8ad('0x79'),{'channel':_0x4dde9e,'interaction':_0x3854eb[_0xa8ad('0x71')],'message':_0x3854eb,'account':_0x3854eb[_0xa8ad('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa8ad('0x3f'),'appdata':_0x15b34a['name']+','+(_0x3854eb['Account'][_0xa8ad('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa8ad('0x9')](respondWithResult(_0x1b1589,null))[_0xa8ad('0x1c')](handleError(_0x1b1589,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x46dfea,_0x2c082c){var _0x612e75=function(_0x9c9188){while(--_0x9c9188){_0x46dfea['push'](_0x46dfea['shift']());}};_0x612e75(++_0x2c082c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0b12876..7c776d2 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 _0xced3=['run','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run'];(function(_0x470457,_0x38401d){var _0xc6b8de=function(_0x2a2f5b){while(--_0x2a2f5b){_0x470457['push'](_0x470457['shift']());}};_0xc6b8de(++_0x38401d);}(_0xced3,0x1bf));var _0x3ced=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xced3[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0x3ced('0x0'));var util=require(_0x3ced('0x1'));var path=require(_0x3ced('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ced('0x3'));var router=express[_0x3ced('0x4')]();var fs_extra=require(_0x3ced('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3ced('0x6'));var config=require(_0x3ced('0x7'));var controller=require(_0x3ced('0x8'));router[_0x3ced('0x9')]('/',auth['isAuthenticated'](),controller[_0x3ced('0xa')]);router[_0x3ced('0x9')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0xd')]);router[_0x3ced('0x9')](_0x3ced('0xe'),auth[_0x3ced('0xc')](),controller[_0x3ced('0xf')]);router[_0x3ced('0x10')]('/',auth[_0x3ced('0xc')](),controller[_0x3ced('0x11')]);router[_0x3ced('0x12')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0x13')]);router[_0x3ced('0x14')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbdf6=['show','run','post','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x119638,_0x2017e6){var _0x2ffd16=function(_0x3ad72b){while(--_0x3ad72b){_0x119638['push'](_0x119638['shift']());}};_0x2ffd16(++_0x2017e6);}(_0xbdf6,0x198));var _0x6bdf=function(_0x3e2a89,_0x236296){_0x3e2a89=_0x3e2a89-0x0;var _0x320829=_0xbdf6[_0x3e2a89];return _0x320829;};'use strict';var multer=require(_0x6bdf('0x0'));var util=require(_0x6bdf('0x1'));var path=require(_0x6bdf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bdf('0x3')]();var fs_extra=require(_0x6bdf('0x4'));var auth=require(_0x6bdf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6bdf('0x6'));var controller=require(_0x6bdf('0x7'));router[_0x6bdf('0x8')]('/',auth[_0x6bdf('0x9')](),controller[_0x6bdf('0xa')]);router[_0x6bdf('0x8')](_0x6bdf('0xb'),auth[_0x6bdf('0x9')](),controller[_0x6bdf('0xc')]);router['get']('/:id/run',auth[_0x6bdf('0x9')](),controller[_0x6bdf('0xd')]);router[_0x6bdf('0xe')]('/',auth[_0x6bdf('0x9')](),controller[_0x6bdf('0xf')]);router['put']('/:id',auth[_0x6bdf('0x9')](),controller[_0x6bdf('0x10')]);router[_0x6bdf('0x11')](_0x6bdf('0xb'),auth['isAuthenticated'](),controller[_0x6bdf('0x12')]);module[_0x6bdf('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 39183c3..dd8d1dc 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 _0x63ca=['custom','default','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','days','hours','csv','xlsx'];(function(_0x43a9e4,_0x4645f5){var _0x3f5be5=function(_0x59af9f){while(--_0x59af9f){_0x43a9e4['push'](_0x43a9e4['shift']());}};_0x3f5be5(++_0x4645f5);}(_0x63ca,0x1c4));var _0xa63c=function(_0x1e1ca7,_0x27e6c1){_0x1e1ca7=_0x1e1ca7-0x0;var _0x52b594=_0x63ca[_0x1e1ca7];return _0x52b594;};'use strict';var Sequelize=require(_0xa63c('0x0'));module[_0xa63c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa63c('0x2')]},'active':{'type':Sequelize[_0xa63c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa63c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xa63c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa63c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa63c('0x6')](_0xa63c('0x7'),_0xa63c('0x8'),'months','weeks',_0xa63c('0x9'),_0xa63c('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa63c('0x6')](_0xa63c('0xb'),'pdf',_0xa63c('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xa63c('0xd'),_0xa63c('0xe')),'allowNull':![],'defaultValue':_0xa63c('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa63c('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xa63c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf8e2=['hours','pdf','csv','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','months','days'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xf8e2,0xfc));var _0x2f8e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf8e2[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x2f8e('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f8e('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2f8e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2f8e('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x2f8e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2f8e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2f8e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2f8e('0x5')]('years','quarters',_0x2f8e('0x6'),'weeks',_0x2f8e('0x7'),_0x2f8e('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x2f8e('0x7')},'output':{'type':Sequelize[_0x2f8e('0x5')]('csv',_0x2f8e('0x9'),'xlsx'),'allowNull':![],'defaultValue':_0x2f8e('0xa')},'type':{'type':Sequelize[_0x2f8e('0x5')]('custom',_0x2f8e('0xb')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x2f8e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2f8e('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x2f8e('0xc')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 38db1a3..4684903 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 _0x8f95=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','Scheduler','destroy','end','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x3dfc95,_0x508aaf){var _0x248517=function(_0x26e492){while(--_0x26e492){_0x3dfc95['push'](_0x3dfc95['shift']());}};_0x248517(++_0x508aaf);}(_0x8f95,0x181));var _0x58f9=function(_0x42d232,_0x1dafda){_0x42d232=_0x42d232-0x0;var _0x56b141=_0x8f95[_0x42d232];return _0x56b141;};'use strict';var emlformat=require(_0x58f9('0x0'));var rimraf=require(_0x58f9('0x1'));var zipdir=require(_0x58f9('0x2'));var jsonpatch=require(_0x58f9('0x3'));var rp=require('request-promise');var moment=require(_0x58f9('0x4'));var BPromise=require(_0x58f9('0x5'));var Mustache=require(_0x58f9('0x6'));var util=require(_0x58f9('0x7'));var path=require(_0x58f9('0x8'));var sox=require(_0x58f9('0x9'));var csv=require(_0x58f9('0xa'));var ejs=require(_0x58f9('0xb'));var fs=require('fs');var fs_extra=require(_0x58f9('0xc'));var _=require(_0x58f9('0xd'));var squel=require(_0x58f9('0xe'));var crypto=require(_0x58f9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x58f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x58f9('0x11'));var Papa=require(_0x58f9('0x12'));var Redis=require(_0x58f9('0x13'));var authService=require(_0x58f9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x58f9('0x15'));var hardwareService=require(_0x58f9('0x16'));var logger=require(_0x58f9('0x17'))(_0x58f9('0x18'));var utils=require(_0x58f9('0x19'));var config=require(_0x58f9('0x1a'));var licenseUtil=require(_0x58f9('0x1b'));var db=require(_0x58f9('0x1c'))['db'];function respondWithStatusCode(_0x544940,_0x4a9e1e){_0x4a9e1e=_0x4a9e1e||0xcc;return function(_0x3ae034){if(_0x3ae034){return _0x544940[_0x58f9('0x1d')](_0x4a9e1e);}return _0x544940[_0x58f9('0x1e')](_0x4a9e1e)['end']();};}function respondWithResult(_0x48cc1e,_0x1b5463){_0x1b5463=_0x1b5463||0xc8;return function(_0xd18605){if(_0xd18605){return _0x48cc1e[_0x58f9('0x1e')](_0x1b5463)[_0x58f9('0x1f')](_0xd18605);}};}function respondWithFilteredResult(_0x27437e,_0x299d68){return function(_0x2cc537){if(_0x2cc537){var _0x4ed60c=typeof _0x299d68['offset']===_0x58f9('0x20')&&typeof _0x299d68[_0x58f9('0x21')]===_0x58f9('0x20');var _0x203515=_0x2cc537[_0x58f9('0x22')];var _0x5b4c80=_0x4ed60c?0x0:_0x299d68[_0x58f9('0x23')];var _0x1a809e=_0x4ed60c?_0x2cc537[_0x58f9('0x22')]:_0x299d68[_0x58f9('0x23')]+_0x299d68[_0x58f9('0x21')];var _0x176fcb;if(_0x1a809e>=_0x203515){_0x1a809e=_0x203515;_0x176fcb=0xc8;}else{_0x176fcb=0xce;}_0x27437e[_0x58f9('0x1e')](_0x176fcb);return _0x27437e['set'](_0x58f9('0x24'),_0x5b4c80+'-'+_0x1a809e+'/'+_0x203515)['json'](_0x2cc537);}return null;};}function patchUpdates(_0xabaa1){return function(_0x30147a){try{jsonpatch[_0x58f9('0x25')](_0x30147a,_0xabaa1,!![]);}catch(_0x550681){return BPromise[_0x58f9('0x26')](_0x550681);}return _0x30147a['save']();};}function saveUpdates(_0x290e97,_0x4326df){return function(_0x19a59e){if(_0x19a59e){return _0x19a59e[_0x58f9('0x27')](_0x290e97)[_0x58f9('0x28')](function(_0x575b96){return _0x575b96;});}return null;};}function removeEntity(_0x21087e,_0x451121){return function(_0x2df0b3){if(_0x2df0b3){return _0x2df0b3['destroy']()[_0x58f9('0x28')](function(){var _0x194ba8=_0x2df0b3['get']({'plain':!![]});var _0x5d9b51=_0x58f9('0x29');return db['UserProfileResource'][_0x58f9('0x2a')]({'where':{'type':_0x5d9b51,'resourceId':_0x194ba8['id']}})[_0x58f9('0x28')](function(){return _0x2df0b3;});})['then'](function(){_0x21087e[_0x58f9('0x1e')](0xcc)[_0x58f9('0x2b')]();});}};}function handleEntityNotFound(_0x18f34b,_0x5af19c){return function(_0x35c14c){if(!_0x35c14c){_0x18f34b['sendStatus'](0x194);}return _0x35c14c;};}function handleError(_0x5e3226,_0x46f023){_0x46f023=_0x46f023||0x1f4;return function(_0x3ad4bf){logger[_0x58f9('0x2c')](_0x3ad4bf[_0x58f9('0x2d')]);if(_0x3ad4bf[_0x58f9('0x2e')]){delete _0x3ad4bf[_0x58f9('0x2e')];}_0x5e3226['status'](_0x46f023)[_0x58f9('0x2f')](_0x3ad4bf);};}exports[_0x58f9('0x30')]=function(_0x34a3dd,_0x5b30eb){var _0xf6259f={},_0x2c90e7={},_0x5ebe01={'count':0x0,'rows':[]};var _0x3e9f48=_[_0x58f9('0x31')](db[_0x58f9('0x32')][_0x58f9('0x33')],function(_0x2b3956){return{'name':_0x2b3956[_0x58f9('0x34')],'type':_0x2b3956[_0x58f9('0x35')][_0x58f9('0x36')]};});_0x2c90e7[_0x58f9('0x37')]=_['map'](_0x3e9f48,'name');_0x2c90e7['query']=_[_0x58f9('0x38')](_0x34a3dd[_0x58f9('0x39')]);_0x2c90e7[_0x58f9('0x3a')]=_[_0x58f9('0x3b')](_0x2c90e7['model'],_0x2c90e7['query']);_0xf6259f['attributes']=_[_0x58f9('0x3b')](_0x2c90e7[_0x58f9('0x37')],qs[_0x58f9('0x3c')](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x3c')]));_0xf6259f[_0x58f9('0x3d')]=_0xf6259f[_0x58f9('0x3d')][_0x58f9('0x3e')]?_0xf6259f['attributes']:_0x2c90e7[_0x58f9('0x37')];if(!_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x3f')](_0x58f9('0x40'))){_0xf6259f[_0x58f9('0x21')]=qs['limit'](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x21')]);_0xf6259f[_0x58f9('0x23')]=qs[_0x58f9('0x23')](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x23')]);}_0xf6259f['order']=qs[_0x58f9('0x41')](_0x34a3dd['query'][_0x58f9('0x41')]);_0xf6259f[_0x58f9('0x42')]=qs['filters'](_[_0x58f9('0x43')](_0x34a3dd[_0x58f9('0x39')],_0x2c90e7[_0x58f9('0x3a')]),_0x3e9f48);if(_0x34a3dd['query'][_0x58f9('0x44')]){_0xf6259f['where']=_[_0x58f9('0x45')](_0xf6259f[_0x58f9('0x42')],{'$or':_['map'](_0x3e9f48,function(_0x7d2f12){if(_0x7d2f12[_0x58f9('0x35')]!==_0x58f9('0x46')){var _0x5370d6={};_0x5370d6[_0x7d2f12[_0x58f9('0x2e')]]={'$like':'%'+_0x34a3dd['query']['filter']+'%'};return _0x5370d6;}})});}_0xf6259f=_['merge']({},_0xf6259f,_0x34a3dd[_0x58f9('0x47')]);var _0x470ee5={'where':_0xf6259f['where']};return db['Schedule']['count'](_0x470ee5)[_0x58f9('0x28')](function(_0x2aca73){_0x5ebe01[_0x58f9('0x22')]=_0x2aca73;if(_0x34a3dd['query'][_0x58f9('0x48')]){_0xf6259f[_0x58f9('0x49')]=[{'all':!![]}];}return db[_0x58f9('0x32')]['findAll'](_0xf6259f);})['then'](function(_0x372d6f){_0x5ebe01[_0x58f9('0x4a')]=_0x372d6f;return _0x5ebe01;})[_0x58f9('0x28')](respondWithFilteredResult(_0x5b30eb,_0xf6259f))[_0x58f9('0x4b')](handleError(_0x5b30eb,null));};exports[_0x58f9('0x4c')]=function(_0x135d3b,_0x279392){var _0x43eb08={'raw':![],'where':{'id':_0x135d3b[_0x58f9('0x4d')]['id']}},_0x2d8ffb={};_0x2d8ffb[_0x58f9('0x37')]=_[_0x58f9('0x38')](db[_0x58f9('0x32')]['rawAttributes']);_0x2d8ffb['query']=_['keys'](_0x135d3b[_0x58f9('0x39')]);_0x2d8ffb[_0x58f9('0x3a')]=_[_0x58f9('0x3b')](_0x2d8ffb['model'],_0x2d8ffb['query']);_0x43eb08[_0x58f9('0x3d')]=_['intersection'](_0x2d8ffb[_0x58f9('0x37')],qs['fields'](_0x135d3b['query'][_0x58f9('0x3c')]));_0x43eb08['attributes']=_0x43eb08[_0x58f9('0x3d')][_0x58f9('0x3e')]?_0x43eb08[_0x58f9('0x3d')]:_0x2d8ffb[_0x58f9('0x37')];if(_0x135d3b[_0x58f9('0x39')]['includeAll']){_0x43eb08[_0x58f9('0x49')]=[{'all':!![]}];}_0x43eb08=_[_0x58f9('0x45')]({},_0x43eb08,_0x135d3b['options']);return db[_0x58f9('0x32')][_0x58f9('0x4e')](_0x43eb08)[_0x58f9('0x28')](handleEntityNotFound(_0x279392,null))[_0x58f9('0x28')](respondWithResult(_0x279392,null))['catch'](handleError(_0x279392,null));};exports[_0x58f9('0x4f')]=function(_0x5e18a2,_0x544606){return db[_0x58f9('0x32')][_0x58f9('0x4f')](_0x5e18a2['body'],{})['then'](function(_0x4daaff){var _0x476b3d=_0x5e18a2[_0x58f9('0x50')]['get']({'plain':!![]});if(!_0x476b3d)throw new Error(_0x58f9('0x51'));if(_0x476b3d['role']===_0x58f9('0x50')){var _0x178fec=_0x4daaff[_0x58f9('0x52')]({'plain':!![]});var _0x41f2da=_0x58f9('0x29');return db[_0x58f9('0x53')][_0x58f9('0x4e')]({'where':{'name':_0x41f2da,'userProfileId':_0x476b3d[_0x58f9('0x54')]},'raw':!![]})['then'](function(_0x20a7c0){if(_0x20a7c0&&_0x20a7c0[_0x58f9('0x55')]===0x0){return db[_0x58f9('0x56')][_0x58f9('0x4f')]({'name':_0x178fec[_0x58f9('0x2e')],'resourceId':_0x178fec['id'],'type':_0x20a7c0[_0x58f9('0x2e')],'sectionId':_0x20a7c0['id']},{})[_0x58f9('0x28')](function(){return _0x4daaff;});}else{return _0x4daaff;}})[_0x58f9('0x4b')](function(_0x186da4){logger[_0x58f9('0x2c')](_0x58f9('0x57'),_0x186da4);throw _0x186da4;});}return _0x4daaff;})[_0x58f9('0x28')](respondWithResult(_0x544606,0xc9))['catch'](handleError(_0x544606,null));};exports['update']=function(_0x3ae37a,_0x1ad56f){if(_0x3ae37a[_0x58f9('0x58')]['id']){delete _0x3ae37a[_0x58f9('0x58')]['id'];}return db['Schedule']['find']({'where':{'id':_0x3ae37a[_0x58f9('0x4d')]['id']}})[_0x58f9('0x28')](handleEntityNotFound(_0x1ad56f,null))[_0x58f9('0x28')](saveUpdates(_0x3ae37a[_0x58f9('0x58')],null))[_0x58f9('0x28')](respondWithResult(_0x1ad56f,null))[_0x58f9('0x4b')](handleError(_0x1ad56f,null));};exports['destroy']=function(_0x100f21,_0x1741e5){return db['Schedule'][_0x58f9('0x4e')]({'where':{'id':_0x100f21[_0x58f9('0x4d')]['id']}})[_0x58f9('0x28')](handleEntityNotFound(_0x1741e5,null))[_0x58f9('0x28')](removeEntity(_0x1741e5,null))[_0x58f9('0x4b')](handleError(_0x1741e5,null));};exports[_0x58f9('0x59')]=function(_0x4d8d16,_0x381e35,_0x5a7979){var _0x3e820c=require(_0x58f9('0x5a'));return db[_0x58f9('0x32')][_0x58f9('0x4e')]({'where':{'id':_0x4d8d16['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x381e35,null))[_0x58f9('0x28')](function(){_0x3e820c[_0x58f9('0x59')](_0x4d8d16[_0x58f9('0x4d')]['id']);})[_0x58f9('0x28')](respondWithStatusCode(_0x381e35,null))['catch'](handleError(_0x381e35,null));}; \ No newline at end of file +var _0x54c4=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','rawAttributes','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','catch','params','../../config/schedule','run','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1da9f2,_0x3accdf){var _0x431b0e=function(_0x2037fc){while(--_0x2037fc){_0x1da9f2['push'](_0x1da9f2['shift']());}};_0x431b0e(++_0x3accdf);}(_0x54c4,0xec));var _0x454c=function(_0x29ca61,_0x6eabc8){_0x29ca61=_0x29ca61-0x0;var _0x3e1d20=_0x54c4[_0x29ca61];return _0x3e1d20;};'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(_0x454c('0x0'));var moment=require(_0x454c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x454c('0x2'));var util=require(_0x454c('0x3'));var path=require(_0x454c('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x454c('0x5'));var fs=require('fs');var fs_extra=require(_0x454c('0x6'));var _=require(_0x454c('0x7'));var squel=require('squel');var crypto=require(_0x454c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x454c('0x9'));var toCsv=require(_0x454c('0xa'));var querystring=require(_0x454c('0xb'));var Papa=require(_0x454c('0xc'));var Redis=require('ioredis');var authService=require(_0x454c('0xd'));var qs=require(_0x454c('0xe'));var as=require(_0x454c('0xf'));var hardwareService=require(_0x454c('0x10'));var logger=require(_0x454c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x454c('0x12'));var licenseUtil=require(_0x454c('0x13'));var db=require(_0x454c('0x14'))['db'];function respondWithStatusCode(_0x1d7e1e,_0x173f6b){_0x173f6b=_0x173f6b||0xcc;return function(_0x531f70){if(_0x531f70){return _0x1d7e1e[_0x454c('0x15')](_0x173f6b);}return _0x1d7e1e[_0x454c('0x16')](_0x173f6b)[_0x454c('0x17')]();};}function respondWithResult(_0x4777fd,_0x1f5769){_0x1f5769=_0x1f5769||0xc8;return function(_0x45c6b4){if(_0x45c6b4){return _0x4777fd[_0x454c('0x16')](_0x1f5769)[_0x454c('0x18')](_0x45c6b4);}};}function respondWithFilteredResult(_0x8b667e,_0x409cb9){return function(_0x4508e6){if(_0x4508e6){var _0x523c29=typeof _0x409cb9[_0x454c('0x19')]===_0x454c('0x1a')&&typeof _0x409cb9[_0x454c('0x1b')]===_0x454c('0x1a');var _0x235cf5=_0x4508e6['count'];var _0x2a0d79=_0x523c29?0x0:_0x409cb9['offset'];var _0x4d9337=_0x523c29?_0x4508e6[_0x454c('0x1c')]:_0x409cb9[_0x454c('0x19')]+_0x409cb9[_0x454c('0x1b')];var _0x583c44;if(_0x4d9337>=_0x235cf5){_0x4d9337=_0x235cf5;_0x583c44=0xc8;}else{_0x583c44=0xce;}_0x8b667e[_0x454c('0x16')](_0x583c44);return _0x8b667e['set']('Content-Range',_0x2a0d79+'-'+_0x4d9337+'/'+_0x235cf5)[_0x454c('0x18')](_0x4508e6);}return null;};}function patchUpdates(_0x3ef087){return function(_0x55ffab){try{jsonpatch[_0x454c('0x1d')](_0x55ffab,_0x3ef087,!![]);}catch(_0x1903c4){return BPromise[_0x454c('0x1e')](_0x1903c4);}return _0x55ffab[_0x454c('0x1f')]();};}function saveUpdates(_0xe5ac8c,_0x1bacf2){return function(_0x337563){if(_0x337563){return _0x337563[_0x454c('0x20')](_0xe5ac8c)['then'](function(_0x8e28ba){return _0x8e28ba;});}return null;};}function removeEntity(_0x1fc5b5,_0x3e58fd){return function(_0x5e34c9){if(_0x5e34c9){return _0x5e34c9[_0x454c('0x21')]()[_0x454c('0x22')](function(){var _0x3cfb61=_0x5e34c9[_0x454c('0x23')]({'plain':!![]});var _0x50434c=_0x454c('0x24');return db[_0x454c('0x25')]['destroy']({'where':{'type':_0x50434c,'resourceId':_0x3cfb61['id']}})[_0x454c('0x22')](function(){return _0x5e34c9;});})[_0x454c('0x22')](function(){_0x1fc5b5['status'](0xcc)[_0x454c('0x17')]();});}};}function handleEntityNotFound(_0x44d211,_0x5c4a41){return function(_0x15a019){if(!_0x15a019){_0x44d211[_0x454c('0x15')](0x194);}return _0x15a019;};}function handleError(_0x3a8d76,_0xc50a6d){_0xc50a6d=_0xc50a6d||0x1f4;return function(_0x566916){logger['error'](_0x566916[_0x454c('0x26')]);if(_0x566916['name']){delete _0x566916[_0x454c('0x27')];}_0x3a8d76['status'](_0xc50a6d)[_0x454c('0x28')](_0x566916);};}exports[_0x454c('0x29')]=function(_0x20a7e2,_0x4d8b19){var _0x1b0c6d={},_0x5b3dc1={},_0x36d30a={'count':0x0,'rows':[]};var _0x5dfe33=_[_0x454c('0x2a')](db['Schedule']['rawAttributes'],function(_0x5480f8){return{'name':_0x5480f8[_0x454c('0x2b')],'type':_0x5480f8[_0x454c('0x2c')][_0x454c('0x2d')]};});_0x5b3dc1[_0x454c('0x2e')]=_['map'](_0x5dfe33,_0x454c('0x27'));_0x5b3dc1['query']=_[_0x454c('0x2f')](_0x20a7e2['query']);_0x5b3dc1[_0x454c('0x30')]=_[_0x454c('0x31')](_0x5b3dc1[_0x454c('0x2e')],_0x5b3dc1['query']);_0x1b0c6d[_0x454c('0x32')]=_[_0x454c('0x31')](_0x5b3dc1[_0x454c('0x2e')],qs['fields'](_0x20a7e2[_0x454c('0x33')][_0x454c('0x34')]));_0x1b0c6d['attributes']=_0x1b0c6d[_0x454c('0x32')][_0x454c('0x35')]?_0x1b0c6d['attributes']:_0x5b3dc1[_0x454c('0x2e')];if(!_0x20a7e2['query'][_0x454c('0x36')](_0x454c('0x37'))){_0x1b0c6d[_0x454c('0x1b')]=qs[_0x454c('0x1b')](_0x20a7e2[_0x454c('0x33')][_0x454c('0x1b')]);_0x1b0c6d[_0x454c('0x19')]=qs[_0x454c('0x19')](_0x20a7e2[_0x454c('0x33')]['offset']);}_0x1b0c6d[_0x454c('0x38')]=qs[_0x454c('0x39')](_0x20a7e2['query'][_0x454c('0x39')]);_0x1b0c6d['where']=qs['filters'](_[_0x454c('0x3a')](_0x20a7e2['query'],_0x5b3dc1['filters']),_0x5dfe33);if(_0x20a7e2[_0x454c('0x33')][_0x454c('0x3b')]){_0x1b0c6d[_0x454c('0x3c')]=_[_0x454c('0x3d')](_0x1b0c6d[_0x454c('0x3c')],{'$or':_[_0x454c('0x2a')](_0x5dfe33,function(_0x54309f){if(_0x54309f[_0x454c('0x2c')]!==_0x454c('0x3e')){var _0x196c6e={};_0x196c6e[_0x54309f[_0x454c('0x27')]]={'$like':'%'+_0x20a7e2[_0x454c('0x33')][_0x454c('0x3b')]+'%'};return _0x196c6e;}})});}_0x1b0c6d=_[_0x454c('0x3d')]({},_0x1b0c6d,_0x20a7e2[_0x454c('0x3f')]);var _0x5e683a={'where':_0x1b0c6d[_0x454c('0x3c')]};return db[_0x454c('0x40')]['count'](_0x5e683a)['then'](function(_0x2143b9){_0x36d30a['count']=_0x2143b9;if(_0x20a7e2[_0x454c('0x33')][_0x454c('0x41')]){_0x1b0c6d[_0x454c('0x42')]=[{'all':!![]}];}return db[_0x454c('0x40')][_0x454c('0x43')](_0x1b0c6d);})[_0x454c('0x22')](function(_0x5c9ddc){_0x36d30a['rows']=_0x5c9ddc;return _0x36d30a;})[_0x454c('0x22')](respondWithFilteredResult(_0x4d8b19,_0x1b0c6d))['catch'](handleError(_0x4d8b19,null));};exports['show']=function(_0x123acd,_0xc0b147){var _0x4b09de={'raw':![],'where':{'id':_0x123acd['params']['id']}},_0xfd572e={};_0xfd572e[_0x454c('0x2e')]=_[_0x454c('0x2f')](db[_0x454c('0x40')][_0x454c('0x44')]);_0xfd572e['query']=_['keys'](_0x123acd[_0x454c('0x33')]);_0xfd572e[_0x454c('0x30')]=_['intersection'](_0xfd572e['model'],_0xfd572e[_0x454c('0x33')]);_0x4b09de[_0x454c('0x32')]=_[_0x454c('0x31')](_0xfd572e[_0x454c('0x2e')],qs[_0x454c('0x34')](_0x123acd[_0x454c('0x33')][_0x454c('0x34')]));_0x4b09de[_0x454c('0x32')]=_0x4b09de[_0x454c('0x32')]['length']?_0x4b09de['attributes']:_0xfd572e[_0x454c('0x2e')];if(_0x123acd[_0x454c('0x33')][_0x454c('0x41')]){_0x4b09de[_0x454c('0x42')]=[{'all':!![]}];}_0x4b09de=_[_0x454c('0x3d')]({},_0x4b09de,_0x123acd[_0x454c('0x3f')]);return db[_0x454c('0x40')][_0x454c('0x45')](_0x4b09de)['then'](handleEntityNotFound(_0xc0b147,null))[_0x454c('0x22')](respondWithResult(_0xc0b147,null))['catch'](handleError(_0xc0b147,null));};exports['create']=function(_0x4e448e,_0x19b2da){return db[_0x454c('0x40')][_0x454c('0x46')](_0x4e448e[_0x454c('0x47')],{})[_0x454c('0x22')](function(_0x463119){var _0x4cd859=_0x4e448e[_0x454c('0x48')][_0x454c('0x23')]({'plain':!![]});if(!_0x4cd859)throw new Error(_0x454c('0x49'));if(_0x4cd859[_0x454c('0x4a')]==='user'){var _0x3d24ec=_0x463119['get']({'plain':!![]});var _0x42bfce='Scheduler';return db[_0x454c('0x4b')][_0x454c('0x45')]({'where':{'name':_0x42bfce,'userProfileId':_0x4cd859[_0x454c('0x4c')]},'raw':!![]})[_0x454c('0x22')](function(_0x5dec13){if(_0x5dec13&&_0x5dec13[_0x454c('0x4d')]===0x0){return db[_0x454c('0x25')][_0x454c('0x46')]({'name':_0x3d24ec[_0x454c('0x27')],'resourceId':_0x3d24ec['id'],'type':_0x5dec13[_0x454c('0x27')],'sectionId':_0x5dec13['id']},{})[_0x454c('0x22')](function(){return _0x463119;});}else{return _0x463119;}})['catch'](function(_0x55c954){logger[_0x454c('0x4e')](_0x454c('0x4f'),_0x55c954);throw _0x55c954;});}return _0x463119;})[_0x454c('0x22')](respondWithResult(_0x19b2da,0xc9))[_0x454c('0x50')](handleError(_0x19b2da,null));};exports[_0x454c('0x20')]=function(_0x3b7c08,_0x2f21c8){if(_0x3b7c08[_0x454c('0x47')]['id']){delete _0x3b7c08[_0x454c('0x47')]['id'];}return db[_0x454c('0x40')][_0x454c('0x45')]({'where':{'id':_0x3b7c08[_0x454c('0x51')]['id']}})['then'](handleEntityNotFound(_0x2f21c8,null))['then'](saveUpdates(_0x3b7c08['body'],null))[_0x454c('0x22')](respondWithResult(_0x2f21c8,null))[_0x454c('0x50')](handleError(_0x2f21c8,null));};exports[_0x454c('0x21')]=function(_0x197f4f,_0x27fda0){return db['Schedule']['find']({'where':{'id':_0x197f4f['params']['id']}})[_0x454c('0x22')](handleEntityNotFound(_0x27fda0,null))['then'](removeEntity(_0x27fda0,null))['catch'](handleError(_0x27fda0,null));};exports['run']=function(_0x93343b,_0x330238,_0x2ba6f1){var _0x6d9f5=require(_0x454c('0x52'));return db[_0x454c('0x40')][_0x454c('0x45')]({'where':{'id':_0x93343b[_0x454c('0x51')]['id']},'raw':!![]})[_0x454c('0x22')](handleEntityNotFound(_0x330238,null))['then'](function(){_0x6d9f5[_0x454c('0x53')](_0x93343b[_0x454c('0x51')]['id']);})[_0x454c('0x22')](respondWithStatusCode(_0x330238,null))['catch'](handleError(_0x330238,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b551609..26fa25b 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 _0xda55=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash'];(function(_0x3d9a12,_0x1ae4ec){var _0x426c70=function(_0x84a7bf){while(--_0x84a7bf){_0x3d9a12['push'](_0x3d9a12['shift']());}};_0x426c70(++_0x1ae4ec);}(_0xda55,0x11d));var _0x5da5=function(_0x4965d1,_0xb546d4){_0x4965d1=_0x4965d1-0x0;var _0x59e849=_0xda55[_0x4965d1];return _0x59e849;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require(_0x5da5('0x2'))(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var rp=require(_0x5da5('0x6'));var fs=require('fs');var path=require(_0x5da5('0x7'));var rimraf=require(_0x5da5('0x8'));var config=require(_0x5da5('0x9'));var attributes=require(_0x5da5('0xa'));module['exports']=function(_0x51d135,_0x37bdcc){return _0x51d135[_0x5da5('0xb')](_0x5da5('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2960=['tools_schedules','lodash','util','api','bluebird','path','./schedule.attributes','exports','define','Schedule'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2960,0x1af));var _0x0296=function(_0x1a0620,_0x4f40c3){_0x1a0620=_0x1a0620-0x0;var _0x475abc=_0x2960[_0x1a0620];return _0x475abc;};'use strict';var _=require(_0x0296('0x0'));var util=require(_0x0296('0x1'));var logger=require('../../config/logger')(_0x0296('0x2'));var moment=require('moment');var BPromise=require(_0x0296('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0296('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0296('0x5'));module[_0x0296('0x6')]=function(_0x526b7d,_0x800e9e){return _0x526b7d[_0x0296('0x7')](_0x0296('0x8'),attributes,{'tableName':_0x0296('0x9'),'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 48440e5..39d7e5d 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 _0x4ad5=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s'];(function(_0x19ed6a,_0x26097b){var _0x5509a5=function(_0xbc797e){while(--_0xbc797e){_0x19ed6a['push'](_0x19ed6a['shift']());}};_0x5509a5(++_0x26097b);}(_0x4ad5,0xb3));var _0x54ad=function(_0x198f2d,_0x2d4c28){_0x198f2d=_0x198f2d-0x0;var _0xa6ab6a=_0x4ad5[_0x198f2d];return _0xa6ab6a;};'use strict';var _=require('lodash');var util=require(_0x54ad('0x0'));var moment=require(_0x54ad('0x1'));var BPromise=require(_0x54ad('0x2'));var rs=require(_0x54ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x54ad('0x5'))(_0x54ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x54ad('0x7'));var client=jayson['client'][_0x54ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47158f,_0x59b8a2,_0x3f9833){return new BPromise(function(_0x1206ef,_0x3e98f5){return client[_0x54ad('0x9')](_0x47158f,_0x3f9833)[_0x54ad('0xa')](function(_0x1d25e1){logger[_0x54ad('0xb')]('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x54ad('0xc'));logger[_0x54ad('0xd')](_0x54ad('0xe'),_0x59b8a2,_0x54ad('0xc'),JSON[_0x54ad('0xf')](_0x1d25e1));if(_0x1d25e1[_0x54ad('0x10')]){if(_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x11')]===0x1f4){logger['error'](_0x54ad('0x12'),_0x59b8a2,_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x13')]);return _0x3e98f5(_0x1d25e1[_0x54ad('0x10')]['message']);}logger[_0x54ad('0x10')](_0x54ad('0x12'),_0x59b8a2,_0x1d25e1['error'][_0x54ad('0x13')]);return _0x1206ef(_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x13')]);}else{logger[_0x54ad('0xb')]('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x54ad('0xc'));_0x1206ef(_0x1d25e1[_0x54ad('0x14')][_0x54ad('0x13')]);}})[_0x54ad('0x15')](function(_0x4f2b3a){logger['error']('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x4f2b3a);_0x3e98f5(_0x4f2b3a);});});} \ No newline at end of file +var _0xe4d6=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe4d6,0x13c));var _0x6e4d=function(_0x290157,_0x544f68){_0x290157=_0x290157-0x0;var _0x265b24=_0xe4d6[_0x290157];return _0x265b24;};'use strict';var _=require('lodash');var util=require(_0x6e4d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e4d('0x1'));var fs=require('fs');var Redis=require(_0x6e4d('0x2'));var db=require(_0x6e4d('0x3'))['db'];var utils=require(_0x6e4d('0x4'));var logger=require(_0x6e4d('0x5'))(_0x6e4d('0x6'));var config=require(_0x6e4d('0x7'));var jayson=require(_0x6e4d('0x8'));var client=jayson[_0x6e4d('0x9')][_0x6e4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dea38,_0x766d42,_0x56d2a2){return new BPromise(function(_0x12ebf0,_0x2a8769){return client[_0x6e4d('0xb')](_0x4dea38,_0x56d2a2)[_0x6e4d('0xc')](function(_0x5470e9){logger[_0x6e4d('0xd')](_0x6e4d('0xe'),_0x766d42,_0x6e4d('0xf'));logger[_0x6e4d('0x10')](_0x6e4d('0x11'),_0x766d42,'request\x20sent',JSON['stringify'](_0x5470e9));if(_0x5470e9['error']){if(_0x5470e9[_0x6e4d('0x12')][_0x6e4d('0x13')]===0x1f4){logger[_0x6e4d('0x12')](_0x6e4d('0xe'),_0x766d42,_0x5470e9[_0x6e4d('0x12')]['message']);return _0x2a8769(_0x5470e9['error'][_0x6e4d('0x14')]);}logger[_0x6e4d('0x12')](_0x6e4d('0xe'),_0x766d42,_0x5470e9[_0x6e4d('0x12')][_0x6e4d('0x14')]);return _0x12ebf0(_0x5470e9[_0x6e4d('0x12')]['message']);}else{logger['info'](_0x6e4d('0xe'),_0x766d42,_0x6e4d('0xf'));_0x12ebf0(_0x5470e9['result'][_0x6e4d('0x14')]);}})[_0x6e4d('0x15')](function(_0x2f06e5){logger[_0x6e4d('0x12')]('Schedule,\x20%s,\x20%s',_0x766d42,_0x2f06e5);_0x2a8769(_0x2f06e5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3eaebe5..ef91101 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 _0xbc19=['../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x799d4a,_0x8101a2){var _0x5008fd=function(_0xa47b1){while(--_0xa47b1){_0x799d4a['push'](_0x799d4a['shift']());}};_0x5008fd(++_0x8101a2);}(_0xbc19,0x125));var _0x9bc1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc19[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9bc1('0x0'));var util=require(_0x9bc1('0x1'));var path=require(_0x9bc1('0x2'));var timeout=require(_0x9bc1('0x3'));var express=require('express');var router=express[_0x9bc1('0x4')]();var fs_extra=require(_0x9bc1('0x5'));var auth=require(_0x9bc1('0x6'));var interaction=require(_0x9bc1('0x7'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x9bc1('0x8')](),controller[_0x9bc1('0x9')]);router[_0x9bc1('0xa')](_0x9bc1('0xb'),auth['isAuthenticated'](),controller[_0x9bc1('0xc')]);router[_0x9bc1('0xa')](_0x9bc1('0xd'),auth['isAuthenticated'](),controller[_0x9bc1('0xe')]);router[_0x9bc1('0xa')](_0x9bc1('0xf'),auth[_0x9bc1('0x8')](),controller[_0x9bc1('0x10')]);router[_0x9bc1('0x11')]('/',auth[_0x9bc1('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9bc1('0x12')]('/:id',auth[_0x9bc1('0x8')](),controller['destroy']);module[_0x9bc1('0x13')]=router; \ No newline at end of file +var _0x0df0=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','/:id','show','download','post','create','put','delete','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x0df0,0x1af));var _0x00df=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x0df0[_0x2d9c6a];return _0xf3c918;};'use strict';var multer=require(_0x00df('0x0'));var util=require(_0x00df('0x1'));var path=require(_0x00df('0x2'));var timeout=require(_0x00df('0x3'));var express=require(_0x00df('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x00df('0x5'));var interaction=require(_0x00df('0x6'));var config=require(_0x00df('0x7'));var controller=require(_0x00df('0x8'));router[_0x00df('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x00df('0x9')](_0x00df('0xa'),auth[_0x00df('0xb')](),controller['describe']);router[_0x00df('0x9')](_0x00df('0xc'),auth['isAuthenticated'](),controller[_0x00df('0xd')]);router[_0x00df('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x00df('0xe')]);router[_0x00df('0xf')]('/',auth[_0x00df('0xb')](),controller[_0x00df('0x10')]);router[_0x00df('0x11')](_0x00df('0xc'),auth[_0x00df('0xb')](),controller['update']);router[_0x00df('0x12')](_0x00df('0xc'),auth[_0x00df('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index a7e5186..e4786e4 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 _0x794b=['startedAt','subtract','closedAt','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','value','extname','STRING','replace','INTEGER','setDataValue'];(function(_0x116ab0,_0x599dee){var _0x37d0ec=function(_0x5c7eb6){while(--_0x5c7eb6){_0x116ab0['push'](_0x116ab0['shift']());}};_0x37d0ec(++_0x599dee);}(_0x794b,0x1c2));var _0xb794=function(_0x4a2fb6,_0x50dfcc){_0x4a2fb6=_0x4a2fb6-0x0;var _0x31f9e5=_0x794b[_0x4a2fb6];return _0x31f9e5;};'use strict';var Sequelize=require(_0xb794('0x0'));var moment=require(_0xb794('0x1'));var path=require('path');var config=require(_0xb794('0x2'));module[_0xb794('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xb794('0x4'))?path[_0xb794('0x5')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb794('0x6')]},'channel':{'type':Sequelize[_0xb794('0x6')]},'value':{'type':Sequelize[_0xb794('0x6')],'set':function(_0x20e4d4){var _0x231206=_0x20e4d4[_0xb794('0x7')](/\\/g,'/');this['setDataValue'](_0xb794('0x4'),_0x231206);}},'rating':{'type':Sequelize[_0xb794('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb794('0x8')],'set':function(_0xc3dde7){this[_0xb794('0x9')](_0xb794('0xa'),moment()[_0xb794('0xb')](_0xc3dde7,'ms'));this[_0xb794('0x9')](_0xb794('0xc'),moment());this[_0xb794('0x9')](_0xb794('0xd'),_0xc3dde7);}},'startedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0xa')))[_0xb794('0x10')](_0xb794('0x11'))[_0xb794('0x12')]();}},'closedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0xc')))[_0xb794('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb794('0x12')]();}},'createdAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0x13')))[_0xb794('0x10')](_0xb794('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')]('updatedAt'))[_0xb794('0x10')](_0xb794('0x11'))['toString']();}}}; \ No newline at end of file +var _0x5eef=['DATE','createdAt','updatedAt','path','exports','getDataValue','value','extname','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x5eef,0x9c));var _0xf5ee=function(_0x39deaf,_0x39cb84){_0x39deaf=_0x39deaf-0x0;var _0x2d3f1a=_0x5eef[_0x39deaf];return _0x2d3f1a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xf5ee('0x0'));var config=require('../../config/environment');module[_0xf5ee('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf5ee('0x2')](_0xf5ee('0x3'))?path[_0xf5ee('0x4')](this[_0xf5ee('0x2')](_0xf5ee('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x3ae819){var _0x24e3a5=_0x3ae819['replace'](/\\/g,'/');this[_0xf5ee('0x5')](_0xf5ee('0x3'),_0x24e3a5);}},'rating':{'type':Sequelize[_0xf5ee('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf5ee('0x6')],'set':function(_0x125def){this[_0xf5ee('0x5')](_0xf5ee('0x7'),moment()[_0xf5ee('0x8')](_0x125def,'ms'));this[_0xf5ee('0x5')](_0xf5ee('0x9'),moment());this['setDataValue'](_0xf5ee('0xa'),_0x125def);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xf5ee('0x2')]('startedAt'))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'closedAt':{'type':Sequelize[_0xf5ee('0xe')],'get':function(){return moment(this['getDataValue'](_0xf5ee('0x9')))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xf5ee('0xf')))[_0xf5ee('0xb')](_0xf5ee('0xc'))[_0xf5ee('0xd')]();}},'updatedAt':{'type':Sequelize[_0xf5ee('0xe')],'get':function(){return moment(this['getDataValue'](_0xf5ee('0x10')))[_0xf5ee('0xb')]('MM-DD-YYYY\x20HH:mm')[_0xf5ee('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index edb7d31..4d9767a 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 _0x24ca=['server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','ScreenRecording','include','findAll','rows','catch','show','model','includeAll','find','create','body','duration','createdAt','closedAt','params','describe','download','uniqueid','value','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','join'];(function(_0x1aec44,_0x5ad6cc){var _0x3bb996=function(_0x13e0b1){while(--_0x13e0b1){_0x1aec44['push'](_0x1aec44['shift']());}};_0x3bb996(++_0x5ad6cc);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x24ca[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['ScreenRecording'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x32')](_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c')),['format']);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x28675f[_0xa24c('0x33')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x33')]);_0x12dbdc[_0xa24c('0x36')]=_['intersection'](_0x5e491e['model'],qs[_0xa24c('0x37')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x37')]));_0x12dbdc[_0xa24c('0x36')]=_0x12dbdc[_0xa24c('0x36')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x36')]:_0x5e491e['model'];if(!_0x28675f[_0xa24c('0x33')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x33')]['offset']);}_0x12dbdc[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x3c')]);_0x12dbdc['where']=qs['filters'](_[_0xa24c('0x3d')](_0x28675f['query'],_0x5e491e[_0xa24c('0x3e')]),_0xc96ce7);if(_0x28675f[_0xa24c('0x33')][_0xa24c('0x3f')]){_0x12dbdc[_0xa24c('0x40')]=_[_0xa24c('0x41')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x3121e){if(_0x3121e[_0xa24c('0x42')]!==_0xa24c('0x43')){var _0x213dc3={};_0x213dc3[_0x3121e[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x33')]['filter']+'%'};return _0x213dc3;}})});}_0x12dbdc=_['merge']({},_0x12dbdc,_0x28675f[_0xa24c('0x44')]);var _0x1ce83e={'where':_0x12dbdc[_0xa24c('0x40')]};return db[_0xa24c('0x45')][_0xa24c('0x20')](_0x1ce83e)['then'](function(_0x171c51){_0x21d2a8[_0xa24c('0x20')]=_0x171c51;if(_0x28675f['query']['includeAll']){_0x12dbdc[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x45')][_0xa24c('0x47')](_0x12dbdc);})['then'](function(_0x58ac8b){_0x21d2a8[_0xa24c('0x48')]=_0x58ac8b;return _0x21d2a8;})[_0xa24c('0x27')](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x49')](handleError(_0x152120,null));};exports[_0xa24c('0x4a')]=function(_0x3f640e,_0x1b7faf){var _0x23d1e0={'raw':![],'where':{'id':_0x3f640e['params']['id']}},_0x394d19={};_0x394d19['model']=_[_0xa24c('0x34')](db[_0xa24c('0x45')][_0xa24c('0x2f')]);_0x394d19['query']=_[_0xa24c('0x34')](_0x3f640e[_0xa24c('0x33')]);_0x394d19[_0xa24c('0x3e')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],_0x394d19[_0xa24c('0x33')]);_0x23d1e0[_0xa24c('0x36')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],qs[_0xa24c('0x37')](_0x3f640e['query'][_0xa24c('0x37')]));_0x23d1e0[_0xa24c('0x36')]=_0x23d1e0[_0xa24c('0x36')]['length']?_0x23d1e0[_0xa24c('0x36')]:_0x394d19[_0xa24c('0x4b')];if(_0x3f640e[_0xa24c('0x33')][_0xa24c('0x4c')]){_0x23d1e0[_0xa24c('0x46')]=[{'all':!![]}];}_0x23d1e0=_[_0xa24c('0x41')]({},_0x23d1e0,_0x3f640e[_0xa24c('0x44')]);return db[_0xa24c('0x45')][_0xa24c('0x4d')](_0x23d1e0)[_0xa24c('0x27')](handleEntityNotFound(_0x1b7faf,null))[_0xa24c('0x27')](respondWithResult(_0x1b7faf,null))['catch'](handleError(_0x1b7faf,null));};exports[_0xa24c('0x4e')]=function(_0x96b977,_0x42028b){return db[_0xa24c('0x45')][_0xa24c('0x4e')](_0x96b977[_0xa24c('0x4f')],{})[_0xa24c('0x27')](respondWithResult(_0x42028b,0xc9))[_0xa24c('0x49')](handleError(_0x42028b,null));};exports[_0xa24c('0x26')]=function(_0x4f56ae,_0x540da8){if(_0x4f56ae[_0xa24c('0x4f')]['id']){delete _0x4f56ae['body']['id'];}delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x50')];delete _0x4f56ae['body'][_0xa24c('0x51')];delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x52')];delete _0x4f56ae['body']['value'];return db[_0xa24c('0x45')]['find']({'where':{'id':_0x4f56ae[_0xa24c('0x53')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x540da8,null))[_0xa24c('0x27')](saveUpdates(_0x4f56ae[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x540da8,null))[_0xa24c('0x49')](handleError(_0x540da8,null));};exports[_0xa24c('0x54')]=function(_0x286d57,_0x22a0db){return db[_0xa24c('0x45')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x22a0db,null))[_0xa24c('0x49')](handleError(_0x22a0db,null));};exports[_0xa24c('0x55')]=function(_0x513271,_0x5bde94,_0x487cc9){var _0x2da4f0=require('../../components/encryptor');var _0x4757ff=![];var _0x21d0fc={};if(_0x513271['query'][_0xa24c('0x42')]&&_0x513271[_0xa24c('0x33')][_0xa24c('0x42')]===_0xa24c('0x56')){_0x21d0fc[_0xa24c('0x56')]=_0x513271[_0xa24c('0x53')]['id'];}else{_0x21d0fc['id']=_0x513271[_0xa24c('0x53')]['id'];}return db[_0xa24c('0x45')]['find']({'where':_0x21d0fc,'attributes':['id',_0xa24c('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5bde94,null))['then'](function(_0x565f0a){if(_0x565f0a){var _0x5bd2af=path['join'](config[_0xa24c('0x58')],'server/files/screen_recordings',_0x565f0a[_0xa24c('0x57')]);var _0x3fd3f9=util[_0xa24c('0x59')](_0xa24c('0x5a'),_0x5bd2af);if(fs[_0xa24c('0x5b')](_0x3fd3f9)){_0x4757ff=!![];return _0x2da4f0[_0xa24c('0x5c')](_0x3fd3f9,_0x5bd2af,config[_0xa24c('0x5d')][_0xa24c('0x5e')])[_0xa24c('0x27')](function(){return _0x565f0a;});}return _0x565f0a;}})[_0xa24c('0x27')](function(_0x303b7d){if(_0x303b7d){var _0x37dbbd=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x303b7d['value']);if(!fs[_0xa24c('0x5b')](_0x37dbbd)){throw new db[(_0xa24c('0x61'))]['ValidationError'](_0xa24c('0x62'));}if(_0x303b7d[_0xa24c('0x63')]){return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,_0x303b7d[_0xa24c('0x63')]+path['extname'](_0x37dbbd),function(){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}else{return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,function(_0x5e9631){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}}})[_0xa24c('0x49')](function(_0x2515b1){if(_0x2515b1[_0xa24c('0x64')]===_0xa24c('0x62')){_0x5bde94['status'](0x194)['send'](_0xa24c('0x65'));}else{return handleError(_0x5bde94,null);}});};exports['destroy']=function(_0x52a895,_0xfcc193){return db[_0xa24c('0x45')][_0xa24c('0x4d')]({'where':{'id':_0x52a895['params']['id']}})[_0xa24c('0x27')](function(_0x128e5b){if(_['isNil'](_0x128e5b)){throw new ReferenceError(_0xa24c('0x66'));}return _0x128e5b;})[_0xa24c('0x27')](function(_0x3096bf){var _0x4bee5c=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x3096bf[_0xa24c('0x57')]);logger[_0xa24c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x4bee5c);if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs[_0xa24c('0x5b')](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}_0x4bee5c=_0x4bee5c+'.cypher';if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs['existsSync'](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}return _0x3096bf;})[_0xa24c('0x27')](function(_0x3a241a){if(!_0x3a241a)throw new InternalError();return _0x3a241a[_0xa24c('0x28')]();})[_0xa24c('0x27')](function(){_0xfcc193[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})['catch'](handleError(_0xfcc193,null));}; \ No newline at end of file +var _0x4bc3=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','update','duration','createdAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','sendStatus','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format'];(function(_0x400b11,_0x245812){var _0x36ac23=function(_0x4bccd3){while(--_0x4bccd3){_0x400b11['push'](_0x400b11['shift']());}};_0x36ac23(++_0x245812);}(_0x4bc3,0x16e));var _0x34bc=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x4bc3[_0x45bf86];return _0x1f02b7;};'use strict';var emlformat=require(_0x34bc('0x0'));var rimraf=require(_0x34bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34bc('0x2'));var rp=require(_0x34bc('0x3'));var moment=require('moment');var BPromise=require(_0x34bc('0x4'));var Mustache=require(_0x34bc('0x5'));var util=require(_0x34bc('0x6'));var path=require(_0x34bc('0x7'));var sox=require(_0x34bc('0x8'));var csv=require(_0x34bc('0x9'));var ejs=require(_0x34bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34bc('0xc'));var deskjs=require(_0x34bc('0xd'));var toCsv=require(_0x34bc('0x9'));var querystring=require(_0x34bc('0xe'));var Papa=require(_0x34bc('0xf'));var Redis=require(_0x34bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34bc('0x11'));var hardwareService=require(_0x34bc('0x12'));var logger=require(_0x34bc('0x13'))('api');var utils=require(_0x34bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34bc('0x15'));var db=require(_0x34bc('0x16'))['db'];function respondWithStatusCode(_0x164fb2,_0x536ebd){_0x536ebd=_0x536ebd||0xcc;return function(_0x3f8852){if(_0x3f8852){return _0x164fb2['sendStatus'](_0x536ebd);}return _0x164fb2[_0x34bc('0x17')](_0x536ebd)[_0x34bc('0x18')]();};}function respondWithResult(_0xc77013,_0x5a22a3){_0x5a22a3=_0x5a22a3||0xc8;return function(_0x4c365a){if(_0x4c365a){return _0xc77013[_0x34bc('0x17')](_0x5a22a3)['json'](_0x4c365a);}};}function respondWithFilteredResult(_0x3e93bf,_0x217605){return function(_0x1da8eb){if(_0x1da8eb){var _0x25da29=typeof _0x217605[_0x34bc('0x19')]===_0x34bc('0x1a')&&typeof _0x217605['limit']==='undefined';var _0x5a5895=_0x1da8eb[_0x34bc('0x1b')];var _0x3eaedf=_0x25da29?0x0:_0x217605[_0x34bc('0x19')];var _0x239e6c=_0x25da29?_0x1da8eb['count']:_0x217605[_0x34bc('0x19')]+_0x217605[_0x34bc('0x1c')];var _0x50106a;if(_0x239e6c>=_0x5a5895){_0x239e6c=_0x5a5895;_0x50106a=0xc8;}else{_0x50106a=0xce;}_0x3e93bf[_0x34bc('0x17')](_0x50106a);return _0x3e93bf[_0x34bc('0x1d')]('Content-Range',_0x3eaedf+'-'+_0x239e6c+'/'+_0x5a5895)[_0x34bc('0x1e')](_0x1da8eb);}return null;};}function patchUpdates(_0x26cdec){return function(_0x2d18ea){try{jsonpatch[_0x34bc('0x1f')](_0x2d18ea,_0x26cdec,!![]);}catch(_0x1f993b){return BPromise[_0x34bc('0x20')](_0x1f993b);}return _0x2d18ea['save']();};}function saveUpdates(_0x40e128,_0x3c9939){return function(_0x38882c){if(_0x38882c){return _0x38882c['update'](_0x40e128)['then'](function(_0x358d51){return _0x358d51;});}return null;};}function removeEntity(_0x1b820a,_0x4263de){return function(_0x410800){if(_0x410800){return _0x410800[_0x34bc('0x21')]()[_0x34bc('0x22')](function(){_0x1b820a[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();});}};}function handleEntityNotFound(_0x19472e,_0x25d6fe){return function(_0x2de017){if(!_0x2de017){_0x19472e[_0x34bc('0x23')](0x194);}return _0x2de017;};}function handleError(_0x4fd589,_0x43e527){_0x43e527=_0x43e527||0x1f4;return function(_0x48ec13){logger['error'](_0x48ec13[_0x34bc('0x24')]);if(_0x48ec13['name']){delete _0x48ec13[_0x34bc('0x25')];}_0x4fd589[_0x34bc('0x17')](_0x43e527)[_0x34bc('0x26')](_0x48ec13);};}exports['index']=function(_0x2e6d96,_0x351ed8){var _0x384fd7={},_0x1a83f7={},_0x2bb874={'count':0x0,'rows':[]};var _0x33bf46=_['map'](db[_0x34bc('0x27')][_0x34bc('0x28')],function(_0x22aacc){return{'name':_0x22aacc[_0x34bc('0x29')],'type':_0x22aacc[_0x34bc('0x2a')][_0x34bc('0x2b')]};});_0x1a83f7['model']=_[_0x34bc('0x2c')](_['map'](_0x33bf46,'name'),[_0x34bc('0x2d')]);_0x1a83f7['query']=_[_0x34bc('0x2e')](_0x2e6d96[_0x34bc('0x2f')]);_0x1a83f7[_0x34bc('0x30')]=_[_0x34bc('0x31')](_0x1a83f7[_0x34bc('0x32')],_0x1a83f7[_0x34bc('0x2f')]);_0x384fd7[_0x34bc('0x33')]=_['intersection'](_0x1a83f7[_0x34bc('0x32')],qs[_0x34bc('0x34')](_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x34')]));_0x384fd7[_0x34bc('0x33')]=_0x384fd7['attributes'][_0x34bc('0x35')]?_0x384fd7[_0x34bc('0x33')]:_0x1a83f7[_0x34bc('0x32')];if(!_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x36')]('nolimit')){_0x384fd7['limit']=qs[_0x34bc('0x1c')](_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x1c')]);_0x384fd7[_0x34bc('0x19')]=qs['offset'](_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x19')]);}_0x384fd7[_0x34bc('0x37')]=qs['sort'](_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x38')]);_0x384fd7[_0x34bc('0x39')]=qs[_0x34bc('0x30')](_['pick'](_0x2e6d96[_0x34bc('0x2f')],_0x1a83f7[_0x34bc('0x30')]),_0x33bf46);if(_0x2e6d96[_0x34bc('0x2f')]['filter']){_0x384fd7[_0x34bc('0x39')]=_[_0x34bc('0x3a')](_0x384fd7[_0x34bc('0x39')],{'$or':_[_0x34bc('0x3b')](_0x33bf46,function(_0x348cea){if(_0x348cea['type']!==_0x34bc('0x3c')){var _0x281e81={};_0x281e81[_0x348cea[_0x34bc('0x25')]]={'$like':'%'+_0x2e6d96[_0x34bc('0x2f')][_0x34bc('0x3d')]+'%'};return _0x281e81;}})});}_0x384fd7=_['merge']({},_0x384fd7,_0x2e6d96[_0x34bc('0x3e')]);var _0x50f1ee={'where':_0x384fd7[_0x34bc('0x39')]};return db[_0x34bc('0x27')][_0x34bc('0x1b')](_0x50f1ee)[_0x34bc('0x22')](function(_0x53feca){_0x2bb874[_0x34bc('0x1b')]=_0x53feca;if(_0x2e6d96[_0x34bc('0x2f')]['includeAll']){_0x384fd7[_0x34bc('0x3f')]=[{'all':!![]}];}return db[_0x34bc('0x27')][_0x34bc('0x40')](_0x384fd7);})['then'](function(_0x31afd3){_0x2bb874[_0x34bc('0x41')]=_0x31afd3;return _0x2bb874;})[_0x34bc('0x22')](respondWithFilteredResult(_0x351ed8,_0x384fd7))[_0x34bc('0x42')](handleError(_0x351ed8,null));};exports[_0x34bc('0x43')]=function(_0x20debf,_0x428326){var _0x2e4059={'raw':![],'where':{'id':_0x20debf[_0x34bc('0x44')]['id']}},_0x4756c6={};_0x4756c6[_0x34bc('0x32')]=_['keys'](db['ScreenRecording'][_0x34bc('0x28')]);_0x4756c6[_0x34bc('0x2f')]=_[_0x34bc('0x2e')](_0x20debf[_0x34bc('0x2f')]);_0x4756c6[_0x34bc('0x30')]=_[_0x34bc('0x31')](_0x4756c6['model'],_0x4756c6[_0x34bc('0x2f')]);_0x2e4059['attributes']=_[_0x34bc('0x31')](_0x4756c6[_0x34bc('0x32')],qs[_0x34bc('0x34')](_0x20debf['query'][_0x34bc('0x34')]));_0x2e4059[_0x34bc('0x33')]=_0x2e4059[_0x34bc('0x33')][_0x34bc('0x35')]?_0x2e4059[_0x34bc('0x33')]:_0x4756c6[_0x34bc('0x32')];if(_0x20debf[_0x34bc('0x2f')][_0x34bc('0x45')]){_0x2e4059[_0x34bc('0x3f')]=[{'all':!![]}];}_0x2e4059=_[_0x34bc('0x3a')]({},_0x2e4059,_0x20debf[_0x34bc('0x3e')]);return db[_0x34bc('0x27')]['find'](_0x2e4059)['then'](handleEntityNotFound(_0x428326,null))[_0x34bc('0x22')](respondWithResult(_0x428326,null))[_0x34bc('0x42')](handleError(_0x428326,null));};exports[_0x34bc('0x46')]=function(_0x51116e,_0x4aafd4){return db[_0x34bc('0x27')][_0x34bc('0x46')](_0x51116e[_0x34bc('0x47')],{})['then'](respondWithResult(_0x4aafd4,0xc9))[_0x34bc('0x42')](handleError(_0x4aafd4,null));};exports[_0x34bc('0x48')]=function(_0x49286b,_0x4627de){if(_0x49286b['body']['id']){delete _0x49286b[_0x34bc('0x47')]['id'];}delete _0x49286b['body'][_0x34bc('0x49')];delete _0x49286b[_0x34bc('0x47')][_0x34bc('0x4a')];delete _0x49286b[_0x34bc('0x47')]['closedAt'];delete _0x49286b[_0x34bc('0x47')][_0x34bc('0x4b')];return db[_0x34bc('0x27')][_0x34bc('0x4c')]({'where':{'id':_0x49286b[_0x34bc('0x44')]['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x4627de,null))[_0x34bc('0x22')](saveUpdates(_0x49286b[_0x34bc('0x47')],null))['then'](respondWithResult(_0x4627de,null))['catch'](handleError(_0x4627de,null));};exports['describe']=function(_0x3a66b4,_0x1ed088){return db['ScreenRecording'][_0x34bc('0x4d')]()[_0x34bc('0x22')](respondWithResult(_0x1ed088,null))[_0x34bc('0x42')](handleError(_0x1ed088,null));};exports[_0x34bc('0x4e')]=function(_0x4562b7,_0x5c82c2,_0x5b6497){var _0x52d4c7=require(_0x34bc('0x4f'));var _0x17ce18=![];var _0x151a45={};if(_0x4562b7[_0x34bc('0x2f')][_0x34bc('0x2a')]&&_0x4562b7['query'][_0x34bc('0x2a')]===_0x34bc('0x50')){_0x151a45[_0x34bc('0x50')]=_0x4562b7[_0x34bc('0x44')]['id'];}else{_0x151a45['id']=_0x4562b7['params']['id'];}return db[_0x34bc('0x27')][_0x34bc('0x4c')]({'where':_0x151a45,'attributes':['id',_0x34bc('0x4b')],'raw':!![]})[_0x34bc('0x22')](handleEntityNotFound(_0x5c82c2,null))[_0x34bc('0x22')](function(_0x31c40b){if(_0x31c40b){var _0x21de42=path[_0x34bc('0x51')](config[_0x34bc('0x52')],_0x34bc('0x53'),_0x31c40b[_0x34bc('0x4b')]);var _0xf8f3fe=util[_0x34bc('0x2d')]('%s.cypher',_0x21de42);if(fs[_0x34bc('0x54')](_0xf8f3fe)){_0x17ce18=!![];return _0x52d4c7[_0x34bc('0x55')](_0xf8f3fe,_0x21de42,config[_0x34bc('0x56')][_0x34bc('0x57')])[_0x34bc('0x22')](function(){return _0x31c40b;});}return _0x31c40b;}})[_0x34bc('0x22')](function(_0x31cf3a){if(_0x31cf3a){var _0x43337d=path[_0x34bc('0x51')](config[_0x34bc('0x52')],_0x34bc('0x53'),_0x31cf3a[_0x34bc('0x4b')]);if(!fs[_0x34bc('0x54')](_0x43337d)){throw new db[(_0x34bc('0x58'))]['ValidationError'](_0x34bc('0x59'));}if(_0x31cf3a[_0x34bc('0x5a')]){return _0x5c82c2[_0x34bc('0x4e')](_0x43337d,_0x31cf3a[_0x34bc('0x5a')]+path[_0x34bc('0x5b')](_0x43337d),function(){if(_0x17ce18){fs[_0x34bc('0x5c')](_0x43337d);}});}else{return _0x5c82c2[_0x34bc('0x4e')](_0x43337d,function(_0x36d2fb){if(_0x17ce18){fs[_0x34bc('0x5c')](_0x43337d);}});}}})[_0x34bc('0x42')](function(_0x5ba13a){if(_0x5ba13a[_0x34bc('0x5d')]===_0x34bc('0x59')){_0x5c82c2[_0x34bc('0x17')](0x194)['send'](_0x34bc('0x5e'));}else{return handleError(_0x5c82c2,null);}});};exports[_0x34bc('0x21')]=function(_0x9dd563,_0x3b087){return db['ScreenRecording'][_0x34bc('0x4c')]({'where':{'id':_0x9dd563[_0x34bc('0x44')]['id']}})[_0x34bc('0x22')](function(_0xfbc469){if(_[_0x34bc('0x5f')](_0xfbc469)){throw new ReferenceError(_0x34bc('0x60'));}return _0xfbc469;})[_0x34bc('0x22')](function(_0x3b8f72){var _0x4e9409=path['join'](config[_0x34bc('0x52')],_0x34bc('0x53'),_0x3b8f72[_0x34bc('0x4b')]);logger[_0x34bc('0x61')](_0x34bc('0x62'),_0x4e9409);if(!_[_0x34bc('0x5f')](_0x3b8f72[_0x34bc('0x4b')])&&fs[_0x34bc('0x54')](_0x4e9409)){logger[_0x34bc('0x61')](_0x34bc('0x63')+_0x4e9409+_0x34bc('0x64'));fs[_0x34bc('0x65')](_0x4e9409);}_0x4e9409=_0x4e9409+_0x34bc('0x66');if(!_[_0x34bc('0x5f')](_0x3b8f72['value'])&&fs[_0x34bc('0x54')](_0x4e9409)){logger[_0x34bc('0x61')](_0x34bc('0x63')+_0x4e9409+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x34bc('0x65')](_0x4e9409);}return _0x3b8f72;})[_0x34bc('0x22')](function(_0x124945){if(!_0x124945)throw new InternalError();return _0x124945[_0x34bc('0x21')]();})['then'](function(){_0x3b087[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();})[_0x34bc('0x42')](handleError(_0x3b087,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a06c263..9b72982 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 _0x0b2c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x496a49,_0x5430cd){var _0x3f7705=function(_0x13a9cb){while(--_0x13a9cb){_0x496a49['push'](_0x496a49['shift']());}};_0x3f7705(++_0x5430cd);}(_0x0b2c,0xfc));var _0xc0b2=function(_0xb8fd70,_0x2f4a52){_0xb8fd70=_0xb8fd70-0x0;var _0x2a9179=_0x0b2c[_0xb8fd70];return _0x2a9179;};'use strict';var _=require(_0xc0b2('0x0'));var util=require(_0xc0b2('0x1'));var logger=require(_0xc0b2('0x2'))('api');var moment=require(_0xc0b2('0x3'));var BPromise=require(_0xc0b2('0x4'));var rp=require(_0xc0b2('0x5'));var fs=require('fs');var path=require(_0xc0b2('0x6'));var rimraf=require(_0xc0b2('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0b2('0x8'));module[_0xc0b2('0x9')]=function(_0x4db7c7,_0x488b9e){return _0x4db7c7[_0xc0b2('0xa')](_0xc0b2('0xb'),attributes,{'tableName':_0xc0b2('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xc0b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3991=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger'];(function(_0x5aab27,_0x32a9ab){var _0x22dddd=function(_0x21367e){while(--_0x21367e){_0x5aab27['push'](_0x5aab27['shift']());}};_0x22dddd(++_0x32a9ab);}(_0x3991,0xd6));var _0x1399=function(_0x2a0398,_0x1df18e){_0x2a0398=_0x2a0398-0x0;var _0x1a7997=_0x3991[_0x2a0398];return _0x1a7997;};'use strict';var _=require(_0x1399('0x0'));var util=require('util');var logger=require(_0x1399('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1399('0x2'));var rp=require(_0x1399('0x3'));var fs=require('fs');var path=require(_0x1399('0x4'));var rimraf=require(_0x1399('0x5'));var config=require(_0x1399('0x6'));var attributes=require('./screenRecording.attributes');module[_0x1399('0x7')]=function(_0x3c6f6a,_0x15637b){return _0x3c6f6a[_0x1399('0x8')](_0x1399('0x9'),attributes,{'tableName':_0x1399('0xa'),'paranoid':![],'indexes':[{'name':_0x1399('0xb'),'fields':[_0x1399('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ff99041..19f4169 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 _0x2b76=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5ad52c,_0x507728){var _0x4179f7=function(_0x4394fb){while(--_0x4394fb){_0x5ad52c['push'](_0x5ad52c['shift']());}};_0x4179f7(++_0x507728);}(_0x2b76,0x1b5));var _0x62b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b76[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x62b7('0x0'));var util=require(_0x62b7('0x1'));var moment=require(_0x62b7('0x2'));var BPromise=require(_0x62b7('0x3'));var rs=require(_0x62b7('0x4'));var fs=require('fs');var Redis=require(_0x62b7('0x5'));var db=require(_0x62b7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x62b7('0x7'))(_0x62b7('0x8'));var config=require(_0x62b7('0x9'));var jayson=require(_0x62b7('0xa'));var client=jayson[_0x62b7('0xb')][_0x62b7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57ef99,_0x4f75a7,_0x2f5869){return new BPromise(function(_0xf4aa18,_0x1d321e){return client[_0x62b7('0xd')](_0x57ef99,_0x2f5869)['then'](function(_0x35848b){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x4f75a7,_0x62b7('0xe'));logger['debug'](_0x62b7('0xf'),_0x4f75a7,_0x62b7('0xe'),JSON[_0x62b7('0x10')](_0x35848b));if(_0x35848b[_0x62b7('0x11')]){if(_0x35848b[_0x62b7('0x11')]['code']===0x1f4){logger[_0x62b7('0x11')](_0x62b7('0x12'),_0x4f75a7,_0x35848b[_0x62b7('0x11')][_0x62b7('0x13')]);return _0x1d321e(_0x35848b[_0x62b7('0x11')]['message']);}logger[_0x62b7('0x11')](_0x62b7('0x12'),_0x4f75a7,_0x35848b['error'][_0x62b7('0x13')]);return _0xf4aa18(_0x35848b[_0x62b7('0x11')][_0x62b7('0x13')]);}else{logger[_0x62b7('0x14')](_0x62b7('0x12'),_0x4f75a7,_0x62b7('0xe'));_0xf4aa18(_0x35848b[_0x62b7('0x15')][_0x62b7('0x13')]);}})[_0x62b7('0x16')](function(_0x20c50f){logger[_0x62b7('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4f75a7,_0x20c50f);_0x1d321e(_0x20c50f);});});} \ No newline at end of file +var _0x4ed9=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x4ed9,0x13a));var _0x94ed=function(_0x3d2a33,_0x76d73f){_0x3d2a33=_0x3d2a33-0x0;var _0x210589=_0x4ed9[_0x3d2a33];return _0x210589;};'use strict';var _=require(_0x94ed('0x0'));var util=require(_0x94ed('0x1'));var moment=require(_0x94ed('0x2'));var BPromise=require(_0x94ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94ed('0x4'));var db=require(_0x94ed('0x5'))['db'];var utils=require(_0x94ed('0x6'));var logger=require('../../config/logger')(_0x94ed('0x7'));var config=require(_0x94ed('0x8'));var jayson=require(_0x94ed('0x9'));var client=jayson[_0x94ed('0xa')][_0x94ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17744a,_0x1fa260,_0x5c2a80){return new BPromise(function(_0x19fd1f,_0x38d22c){return client[_0x94ed('0xc')](_0x17744a,_0x5c2a80)[_0x94ed('0xd')](function(_0x2ea255){logger['info'](_0x94ed('0xe'),_0x1fa260,_0x94ed('0xf'));logger[_0x94ed('0x10')](_0x94ed('0x11'),_0x1fa260,_0x94ed('0xf'),JSON['stringify'](_0x2ea255));if(_0x2ea255['error']){if(_0x2ea255[_0x94ed('0x12')][_0x94ed('0x13')]===0x1f4){logger[_0x94ed('0x12')](_0x94ed('0xe'),_0x1fa260,_0x2ea255[_0x94ed('0x12')][_0x94ed('0x14')]);return _0x38d22c(_0x2ea255[_0x94ed('0x12')]['message']);}logger[_0x94ed('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x1fa260,_0x2ea255[_0x94ed('0x12')][_0x94ed('0x14')]);return _0x19fd1f(_0x2ea255[_0x94ed('0x12')]['message']);}else{logger[_0x94ed('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x1fa260,_0x94ed('0xf'));_0x19fd1f(_0x2ea255['result'][_0x94ed('0x14')]);}})['catch'](function(_0x112e67){logger[_0x94ed('0x12')](_0x94ed('0xe'),_0x1fa260,_0x112e67);_0x38d22c(_0x112e67);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b4770fb..d9ad6b7 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 _0xa3d5=['format','logo','originalname','post','/:id/logo','single','file','addLogo','join','%s%s','logologin','extname','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/'];(function(_0x571461,_0x6f7b6b){var _0x15abf5=function(_0x178272){while(--_0x178272){_0x571461['push'](_0x571461['shift']());}};_0x15abf5(++_0x6f7b6b);}(_0xa3d5,0x1b6));var _0x5a3d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xa3d5[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x5a3d('0x0'));var util=require(_0x5a3d('0x1'));var path=require(_0x5a3d('0x2'));var timeout=require(_0x5a3d('0x3'));var express=require(_0x5a3d('0x4'));var router=express[_0x5a3d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a3d('0x6'));var interaction=require(_0x5a3d('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x5a3d('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a3d('0x9')]);router['get'](_0x5a3d('0xa'),controller[_0x5a3d('0xb')]);router['get'](_0x5a3d('0xc'),controller[_0x5a3d('0xd')]);router[_0x5a3d('0x8')]('/:id/logo',controller[_0x5a3d('0xe')]);router[_0x5a3d('0x8')](_0x5a3d('0xf'),controller[_0x5a3d('0x10')]);router[_0x5a3d('0x8')](_0x5a3d('0x11'),controller['gdpr']);router[_0x5a3d('0x8')](_0x5a3d('0x12'),controller['getPreferred']);router[_0x5a3d('0x8')](_0x5a3d('0x13'),controller[_0x5a3d('0x14')]);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x557a7e,_0x25d208,_0x5b4bab){_0x5b4bab(null,path['join'](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x545a5a,_0x243657,_0x34d609){_0x34d609(null,util[_0x5a3d('0x18')]('%s%s',_0x5a3d('0x19'),path['extname'](_0x243657[_0x5a3d('0x1a')])));}})});router[_0x5a3d('0x1b')](_0x5a3d('0x1c'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller[_0x5a3d('0x1f')]);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x24e73f,_0x8c9af2,_0x538d34){_0x538d34(null,path[_0x5a3d('0x20')](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x465875,_0x37bb31,_0x5a86f4){_0x5a86f4(null,util[_0x5a3d('0x18')](_0x5a3d('0x21'),_0x5a3d('0x22'),path[_0x5a3d('0x23')](_0x37bb31[_0x5a3d('0x1a')])));}})});router['post'](_0x5a3d('0xf'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x570d28,_0x43f438,_0x21659a){_0x21659a(null,path[_0x5a3d('0x20')](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x4d0f04,_0x52f783,_0x26f90e){_0x26f90e(null,util[_0x5a3d('0x18')](_0x5a3d('0x21'),'preferred',path[_0x5a3d('0x23')](_0x52f783['originalname'])));}})});router['post'](_0x5a3d('0x12'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller[_0x5a3d('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39824f,_0x407eb3,_0x15e3e8){_0x15e3e8(null,path['join'](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0xd6cc3b,_0x23635c,_0x30c9d6){_0x30c9d6(null,util[_0x5a3d('0x18')]('%s%s',_0x5a3d('0x25'),path['extname'](_0x23635c[_0x5a3d('0x1a')])));}})});router['post'](_0x5a3d('0x13'),upload[_0x5a3d('0x1d')]('file'),controller[_0x5a3d('0x26')]);router['put'](_0x5a3d('0xc'),auth[_0x5a3d('0x27')](),controller[_0x5a3d('0x28')]);module[_0x5a3d('0x29')]=router; \ No newline at end of file +var _0x1598=['getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','post','single','file','addLogo','format','logologin','addLogoLogin','favicon','originalname','addFavicon','put','isAuthenticated','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','getDate','/:id','show','/:id/logo','getLogo','/:id/gdpr','gdpr','getPreferred'];(function(_0x1f794b,_0x1aafe6){var _0x22f5cb=function(_0x198d11){while(--_0x198d11){_0x1f794b['push'](_0x1f794b['shift']());}};_0x22f5cb(++_0x1aafe6);}(_0x1598,0x1c3));var _0x8159=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1598[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8159('0x0'));var util=require('util');var path=require(_0x8159('0x1'));var timeout=require(_0x8159('0x2'));var express=require('express');var router=express[_0x8159('0x3')]();var fs_extra=require(_0x8159('0x4'));var auth=require(_0x8159('0x5'));var interaction=require(_0x8159('0x6'));var config=require(_0x8159('0x7'));var controller=require('./setting.controller');router[_0x8159('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/now',controller[_0x8159('0x9')]);router[_0x8159('0x8')](_0x8159('0xa'),controller[_0x8159('0xb')]);router[_0x8159('0x8')](_0x8159('0xc'),controller[_0x8159('0xd')]);router['get']('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x8159('0xe'),controller[_0x8159('0xf')]);router['get']('/:id/preferred',controller[_0x8159('0x10')]);router['get']('/:id/favicon',controller[_0x8159('0x11')]);var upload=multer({'storage':multer[_0x8159('0x12')]({'destination':function(_0x3f8b8c,_0x29dbe8,_0x3f375c){_0x3f375c(null,path[_0x8159('0x13')](config[_0x8159('0x14')],_0x8159('0x15')));},'filename':function(_0x392583,_0x441a69,_0x34471c){_0x34471c(null,util['format'](_0x8159('0x16'),_0x8159('0x17'),path[_0x8159('0x18')](_0x441a69['originalname'])));}})});router[_0x8159('0x19')](_0x8159('0xc'),upload[_0x8159('0x1a')](_0x8159('0x1b')),controller[_0x8159('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13cb0e,_0x27604b,_0xc42cce){_0xc42cce(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x39db0a,_0x2ef429,_0x2e9c21){_0x2e9c21(null,util[_0x8159('0x1d')]('%s%s',_0x8159('0x1e'),path[_0x8159('0x18')](_0x2ef429['originalname'])));}})});router[_0x8159('0x19')]('/:id/logo_login',upload[_0x8159('0x1a')](_0x8159('0x1b')),controller[_0x8159('0x1f')]);var upload=multer({'storage':multer[_0x8159('0x12')]({'destination':function(_0x59f007,_0x450b58,_0xea16b7){_0xea16b7(null,path[_0x8159('0x13')](config[_0x8159('0x14')],_0x8159('0x15')));},'filename':function(_0xe09666,_0x1793ec,_0x28e865){_0x28e865(null,util[_0x8159('0x1d')]('%s%s','preferred',path[_0x8159('0x18')](_0x1793ec['originalname'])));}})});router[_0x8159('0x19')]('/:id/preferred',upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x8159('0x12')]({'destination':function(_0x48b84d,_0x59972b,_0x1ac088){_0x1ac088(null,path[_0x8159('0x13')](config[_0x8159('0x14')],_0x8159('0x15')));},'filename':function(_0xeb5fe8,_0x2a0722,_0x404939){_0x404939(null,util[_0x8159('0x1d')](_0x8159('0x16'),_0x8159('0x20'),path[_0x8159('0x18')](_0x2a0722[_0x8159('0x21')])));}})});router[_0x8159('0x19')]('/:id/favicon',upload[_0x8159('0x1a')](_0x8159('0x1b')),controller[_0x8159('0x22')]);router[_0x8159('0x23')](_0x8159('0xa'),auth[_0x8159('0x24')](),controller[_0x8159('0x25')]);module[_0x8159('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a6cb0ed..21b5220 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(_0x181bfa,_0x5c072c){var _0x524654=function(_0x5be814){while(--_0x5be814){_0x181bfa['push'](_0x181bfa['shift']());}};_0x524654(++_0x5c072c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x5a742f,_0x383a17){var _0x5c905f=function(_0x2cc5a6){while(--_0x2cc5a6){_0x5a742f['push'](_0x5a742f['shift']());}};_0x5c905f(++_0x383a17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 8a877b5..e4329db 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 _0x2bd6=['getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','params','includeAll','body','find','addLogo','file','filename','logo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','download','server/files/images/logos','loginLogo','default_loginLogo.svg','default','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0x2bd6,0x16d));var _0x62bd=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x2bd6[_0x25efdf];return _0x22c495;};'use strict';var emlformat=require(_0x62bd('0x0'));var rimraf=require(_0x62bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62bd('0x2'));var rp=require(_0x62bd('0x3'));var moment=require(_0x62bd('0x4'));var BPromise=require(_0x62bd('0x5'));var Mustache=require('mustache');var util=require(_0x62bd('0x6'));var path=require(_0x62bd('0x7'));var sox=require('sox');var csv=require(_0x62bd('0x8'));var ejs=require(_0x62bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x62bd('0xa'));var crypto=require(_0x62bd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x62bd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x62bd('0xd'));var Papa=require(_0x62bd('0xe'));var Redis=require(_0x62bd('0xf'));var authService=require(_0x62bd('0x10'));var qs=require(_0x62bd('0x11'));var as=require(_0x62bd('0x12'));var hardwareService=require(_0x62bd('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x62bd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x15'));var db=require(_0x62bd('0x16'))['db'];var jayson=require(_0x62bd('0x17'));var client=jayson['client'][_0x62bd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x389305,_0x1325b6,_0xc35cce,_0x140ff6){return new BPromise(function(_0x22f4f3,_0x272c91){var _0x35fcf2=_0x140ff6||client;return _0x35fcf2[_0x62bd('0x19')](_0x389305,_0xc35cce)[_0x62bd('0x1a')](function(_0x468772){logger['info'](_0x62bd('0x1b'),_0x1325b6,'request\x20sent');logger['debug'](_0x62bd('0x1c'),_0x1325b6,_0x62bd('0x1d'),JSON[_0x62bd('0x1e')](_0x468772));if(_0x468772[_0x62bd('0x1f')]){if(_0x468772[_0x62bd('0x1f')][_0x62bd('0x20')]===0x1f4){logger[_0x62bd('0x1f')](_0x62bd('0x1b'),_0x1325b6,_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);return _0x272c91(_0x468772['error']['message']);}logger['error'](_0x62bd('0x1b'),_0x1325b6,_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);return _0x22f4f3(_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);}else{logger[_0x62bd('0x22')](_0x62bd('0x1b'),_0x1325b6,_0x62bd('0x1d'));_0x22f4f3(_0x468772[_0x62bd('0x23')]['message']);}})[_0x62bd('0x24')](function(_0x5d8b14){logger[_0x62bd('0x1f')](_0x62bd('0x1b'),_0x1325b6,_0x5d8b14);_0x272c91(_0x5d8b14);});});}function respondWithStatusCode(_0x4ebe4c,_0x589e76){_0x589e76=_0x589e76||0xcc;return function(_0x49a4fd){if(_0x49a4fd){return _0x4ebe4c[_0x62bd('0x25')](_0x589e76);}return _0x4ebe4c['status'](_0x589e76)['end']();};}function respondWithResult(_0xd638bb,_0x50a313){_0x50a313=_0x50a313||0xc8;return function(_0x198192){if(_0x198192){return _0xd638bb['status'](_0x50a313)[_0x62bd('0x26')](_0x198192);}};}function respondWithFilteredResult(_0x3927ae,_0x1f037e){return function(_0x298aff){if(_0x298aff){var _0x12bb27=typeof _0x1f037e['offset']===_0x62bd('0x27')&&typeof _0x1f037e[_0x62bd('0x28')]===_0x62bd('0x27');var _0x5950a9=_0x298aff['count'];var _0x2eb36b=_0x12bb27?0x0:_0x1f037e['offset'];var _0x17992f=_0x12bb27?_0x298aff[_0x62bd('0x29')]:_0x1f037e[_0x62bd('0x2a')]+_0x1f037e['limit'];var _0x496835;if(_0x17992f>=_0x5950a9){_0x17992f=_0x5950a9;_0x496835=0xc8;}else{_0x496835=0xce;}_0x3927ae[_0x62bd('0x2b')](_0x496835);return _0x3927ae[_0x62bd('0x2c')](_0x62bd('0x2d'),_0x2eb36b+'-'+_0x17992f+'/'+_0x5950a9)[_0x62bd('0x26')](_0x298aff);}return null;};}function patchUpdates(_0x3b05a3){return function(_0x3d5b2c){try{jsonpatch[_0x62bd('0x2e')](_0x3d5b2c,_0x3b05a3,!![]);}catch(_0x1b29a2){return BPromise[_0x62bd('0x2f')](_0x1b29a2);}return _0x3d5b2c['save']();};}function saveUpdates(_0x432360,_0x2602fe){return function(_0x3bb623){if(_0x3bb623){return _0x3bb623[_0x62bd('0x30')](_0x432360)[_0x62bd('0x1a')](function(_0x2f03f4){return _0x2f03f4;});}return null;};}function removeEntity(_0x1b4c62,_0x50ecad){return function(_0x4c7ad7){if(_0x4c7ad7){return _0x4c7ad7[_0x62bd('0x31')]()['then'](function(){_0x1b4c62[_0x62bd('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24f90b,_0x564326){return function(_0x3be103){if(!_0x3be103){_0x24f90b[_0x62bd('0x25')](0x194);}return _0x3be103;};}function handleError(_0x256b6e,_0x1873cc){_0x1873cc=_0x1873cc||0x1f4;return function(_0x2959a7){logger[_0x62bd('0x1f')](_0x2959a7[_0x62bd('0x32')]);if(_0x2959a7[_0x62bd('0x33')]){delete _0x2959a7[_0x62bd('0x33')];}_0x256b6e[_0x62bd('0x2b')](_0x1873cc)['send'](_0x2959a7);};}exports[_0x62bd('0x34')]=function(_0xb6586d,_0x192a5e){var _0x5ebacb={},_0x401c9a={},_0x2de4e6={'count':0x0,'rows':[]};var _0x3e0499=_['map'](db[_0x62bd('0x35')][_0x62bd('0x36')],function(_0x32d38e){return{'name':_0x32d38e[_0x62bd('0x37')],'type':_0x32d38e[_0x62bd('0x38')][_0x62bd('0x39')]};});_0x401c9a[_0x62bd('0x3a')]=_[_0x62bd('0x3b')](_0x3e0499,_0x62bd('0x33'));_0x401c9a[_0x62bd('0x3c')]=_[_0x62bd('0x3d')](_0xb6586d[_0x62bd('0x3c')]);_0x401c9a['filters']=_[_0x62bd('0x3e')](_0x401c9a[_0x62bd('0x3a')],_0x401c9a['query']);_0x5ebacb[_0x62bd('0x3f')]=_['intersection'](_0x401c9a[_0x62bd('0x3a')],qs['fields'](_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x40')]));_0x5ebacb[_0x62bd('0x3f')]=_0x5ebacb[_0x62bd('0x3f')][_0x62bd('0x41')]?_0x5ebacb['attributes']:_0x401c9a[_0x62bd('0x3a')];if(!_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x42')](_0x62bd('0x43'))){_0x5ebacb['limit']=qs[_0x62bd('0x28')](_0xb6586d[_0x62bd('0x3c')]['limit']);_0x5ebacb[_0x62bd('0x2a')]=qs[_0x62bd('0x2a')](_0xb6586d['query'][_0x62bd('0x2a')]);}_0x5ebacb['order']=qs[_0x62bd('0x44')](_0xb6586d[_0x62bd('0x3c')]['sort']);_0x5ebacb[_0x62bd('0x45')]=qs[_0x62bd('0x46')](_[_0x62bd('0x47')](_0xb6586d[_0x62bd('0x3c')],_0x401c9a[_0x62bd('0x46')]),_0x3e0499);if(_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x48')]){_0x5ebacb[_0x62bd('0x45')]=_[_0x62bd('0x49')](_0x5ebacb[_0x62bd('0x45')],{'$or':_[_0x62bd('0x3b')](_0x3e0499,function(_0x4c29fc){if(_0x4c29fc[_0x62bd('0x38')]!==_0x62bd('0x4a')){var _0x1ceccf={};_0x1ceccf[_0x4c29fc[_0x62bd('0x33')]]={'$like':'%'+_0xb6586d[_0x62bd('0x3c')]['filter']+'%'};return _0x1ceccf;}})});}_0x5ebacb=_[_0x62bd('0x49')]({},_0x5ebacb,_0xb6586d[_0x62bd('0x4b')]);var _0x4e7cd2={'where':_0x5ebacb[_0x62bd('0x45')]};return db[_0x62bd('0x35')]['count'](_0x4e7cd2)[_0x62bd('0x1a')](function(_0x57e526){_0x2de4e6[_0x62bd('0x29')]=_0x57e526;if(_0xb6586d[_0x62bd('0x3c')]['includeAll']){_0x5ebacb[_0x62bd('0x4c')]=[{'all':!![]}];}return db[_0x62bd('0x35')]['findAll'](_0x5ebacb);})[_0x62bd('0x1a')](function(_0x4d5a00){_0x2de4e6['rows']=_0x4d5a00;return _0x2de4e6;})[_0x62bd('0x1a')](respondWithFilteredResult(_0x192a5e,_0x5ebacb))[_0x62bd('0x24')](handleError(_0x192a5e,null));};exports[_0x62bd('0x4d')]=function(_0x2b55ea,_0x663599){var _0x410049={'raw':![],'where':{'id':_0x2b55ea[_0x62bd('0x4e')]['id']}},_0x1eadd6={};_0x1eadd6[_0x62bd('0x3a')]=_[_0x62bd('0x3d')](db['Setting'][_0x62bd('0x36')]);_0x1eadd6[_0x62bd('0x3c')]=_[_0x62bd('0x3d')](_0x2b55ea[_0x62bd('0x3c')]);_0x1eadd6[_0x62bd('0x46')]=_['intersection'](_0x1eadd6[_0x62bd('0x3a')],_0x1eadd6[_0x62bd('0x3c')]);_0x410049['attributes']=_[_0x62bd('0x3e')](_0x1eadd6['model'],qs[_0x62bd('0x40')](_0x2b55ea[_0x62bd('0x3c')][_0x62bd('0x40')]));_0x410049[_0x62bd('0x3f')]=_0x410049[_0x62bd('0x3f')][_0x62bd('0x41')]?_0x410049[_0x62bd('0x3f')]:_0x1eadd6[_0x62bd('0x3a')];if(_0x2b55ea['query'][_0x62bd('0x4f')]){_0x410049[_0x62bd('0x4c')]=[{'all':!![]}];}_0x410049=_[_0x62bd('0x49')]({},_0x410049,_0x2b55ea[_0x62bd('0x4b')]);return db['Setting']['find'](_0x410049)[_0x62bd('0x1a')](handleEntityNotFound(_0x663599,null))[_0x62bd('0x1a')](respondWithResult(_0x663599,null))[_0x62bd('0x24')](handleError(_0x663599,null));};exports[_0x62bd('0x30')]=function(_0xb9ca72,_0x4656e1){if(_0xb9ca72[_0x62bd('0x50')]['id']){delete _0xb9ca72['body']['id'];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0xb9ca72[_0x62bd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4656e1,null))[_0x62bd('0x1a')](saveUpdates(_0xb9ca72['body'],null))[_0x62bd('0x1a')](respondWithResult(_0x4656e1,null))[_0x62bd('0x24')](handleError(_0x4656e1,null));};exports[_0x62bd('0x52')]=function(_0x22e677,_0x452a97,_0x5974d0){if(_0x22e677[_0x62bd('0x53')]&&_0x22e677['file'][_0x62bd('0x54')]){_0x22e677[_0x62bd('0x50')][_0x62bd('0x55')]=_0x22e677[_0x62bd('0x53')][_0x62bd('0x54')];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x22e677['params']['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x452a97,null))[_0x62bd('0x1a')](saveUpdates(_0x22e677[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x452a97,null))[_0x62bd('0x24')](handleError(_0x452a97,null));};exports['addLogoLogin']=function(_0x5029df,_0x29a1bf,_0x517fa8){if(_0x5029df['file']&&_0x5029df[_0x62bd('0x53')][_0x62bd('0x54')]){_0x5029df[_0x62bd('0x50')]['loginLogo']=_0x5029df[_0x62bd('0x53')][_0x62bd('0x54')];}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x5029df[_0x62bd('0x4e')]['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x29a1bf,null))[_0x62bd('0x1a')](saveUpdates(_0x5029df['body'],null))[_0x62bd('0x1a')](respondWithResult(_0x29a1bf,null))[_0x62bd('0x24')](handleError(_0x29a1bf,null));};var utilLicense=require(_0x62bd('0x15'));exports['getLogo']=function(_0x338a18,_0x1caa28,_0x3a48e9){var _0x23f0ad='server/files/images/logos';var _0x5ecb0c={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x3f611b){if(_0x3f611b){_0x5ecb0c=_0x3f611b;}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x338a18[_0x62bd('0x4e')]['id']},'attributes':['logo','loginLogo',_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),_0x62bd('0x5a'),_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x1caa28,null))[_0x62bd('0x1a')](function(_0x2474bc){if(_0x2474bc){var _0x1ae0a8=_0x2474bc[_0x62bd('0x55')]&&fs[_0x62bd('0x5d')](path['join'](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x2474bc[_0x62bd('0x55')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x2474bc['logo'])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x62bd('0x61')));var _0x14b217='default'+_[_0x62bd('0x62')](_0x62bd('0x55'));if(_0x2474bc[_0x14b217]||!_0x5ecb0c[_0x62bd('0x63')]){_0x1ae0a8=path[_0x62bd('0x60')](config['root'],_0x23f0ad,_[_0x62bd('0x5f')](_0x62bd('0x61')));}if(!fs[_0x62bd('0x5d')](_0x1ae0a8)){throw new db['Sequelize']['ValidationError'](_[_0x62bd('0x62')](_0x62bd('0x55'))+'\x20not\x20found');}return _0x1caa28[_0x62bd('0x64')](_0x1ae0a8);}})[_0x62bd('0x24')](handleError(_0x1caa28,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x232f30,_0x238c9b,_0x5864b6){var _0x17543c=_0x62bd('0x65');var _0x5abdb9={'custom':![]};return utilLicense['getLicense']()[_0x62bd('0x1a')](function(_0x3a354a){if(_0x3a354a){_0x5abdb9=_0x3a354a;}return db['Setting'][_0x62bd('0x51')]({'where':{'id':_0x232f30[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),'defaultLoginLogo',_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x238c9b,null))[_0x62bd('0x1a')](function(_0x4dcb22){if(_0x4dcb22){var _0x49c80c=_0x4dcb22[_0x62bd('0x66')]&&fs['existsSync'](path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x4dcb22['loginLogo'])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x4dcb22[_0x62bd('0x66')])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x62bd('0x67')));var _0x572c29=_0x62bd('0x68')+_[_0x62bd('0x62')](_0x62bd('0x66'));if(_0x4dcb22[_0x572c29]||!_0x5abdb9[_0x62bd('0x63')]){_0x49c80c=path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x62bd('0x67')));}if(!fs[_0x62bd('0x5d')](_0x49c80c)){throw new db[(_0x62bd('0x69'))]['ValidationError'](_[_0x62bd('0x62')](_0x62bd('0x66'))+_0x62bd('0x6a'));}return _0x238c9b[_0x62bd('0x64')](_0x49c80c);}})['catch'](handleError(_0x238c9b,null));};exports[_0x62bd('0x6b')]=function(_0x1a5efb,_0x3569a1){return db[_0x62bd('0x35')]['find']({'where':{'id':_0x1a5efb['params']['id']},'attributes':[_0x62bd('0x6c')]})['then'](respondWithResult(_0x3569a1,null))['catch'](handleError(_0x3569a1,null));};exports[_0x62bd('0x6d')]=function(_0x2f0f22,_0x446ac4,_0x1b52ce){if(_0x2f0f22[_0x62bd('0x53')]&&_0x2f0f22['file']['filename']){_0x2f0f22[_0x62bd('0x50')][_0x62bd('0x57')]=_0x2f0f22[_0x62bd('0x53')]['filename'];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x2f0f22['params']['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x446ac4,null))[_0x62bd('0x1a')](saveUpdates(_0x2f0f22[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x446ac4,null))[_0x62bd('0x24')](handleError(_0x446ac4,null));};var utilLicense=require(_0x62bd('0x15'));exports['getPreferred']=function(_0x18bbed,_0x24934e,_0x38f46e){var _0x4ed01f=_0x62bd('0x65');var _0x5cfaee={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x31e299){if(_0x31e299){_0x5cfaee=_0x31e299;}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x18bbed[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),'preferred',_0x62bd('0x58'),_0x62bd('0x59'),'defaultLoginLogo','defaultPreferred',_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x24934e,null))[_0x62bd('0x1a')](function(_0x136777){if(_0x136777){var _0x1e1f87=_0x136777[_0x62bd('0x57')]&&fs['existsSync'](path['join'](config[_0x62bd('0x5e')],_0x4ed01f,_[_0x62bd('0x5f')](_0x136777[_0x62bd('0x57')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x4ed01f,_[_0x62bd('0x5f')](_0x136777[_0x62bd('0x57')])):path['join'](config['root'],_0x4ed01f,_[_0x62bd('0x5f')](_0x62bd('0x6e')));var _0x15ca23=_0x62bd('0x68')+_['upperFirst'](_0x62bd('0x57'));if(_0x136777[_0x15ca23]||!_0x5cfaee[_0x62bd('0x63')]||!_0x5cfaee[_0x62bd('0x57')]){_0x1e1f87=path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x4ed01f,_['toLower'](_0x62bd('0x6e')));}if(!fs[_0x62bd('0x5d')](_0x1e1f87)){throw new db['Sequelize'][(_0x62bd('0x6f'))](_[_0x62bd('0x62')](_0x62bd('0x57'))+'\x20not\x20found');}return _0x24934e[_0x62bd('0x64')](_0x1e1f87);}})[_0x62bd('0x24')](handleError(_0x24934e,null));};exports[_0x62bd('0x70')]=function(_0x230aca,_0x29d94a,_0x20ff6d){if(_0x230aca[_0x62bd('0x53')]&&_0x230aca[_0x62bd('0x53')][_0x62bd('0x54')]){_0x230aca[_0x62bd('0x50')][_0x62bd('0x58')]=_0x230aca[_0x62bd('0x53')][_0x62bd('0x54')];}return db['Setting'][_0x62bd('0x51')]({'where':{'id':_0x230aca[_0x62bd('0x4e')]['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x29d94a,null))[_0x62bd('0x1a')](saveUpdates(_0x230aca[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x29d94a,null))[_0x62bd('0x24')](handleError(_0x29d94a,null));};var utilLicense=require(_0x62bd('0x15'));exports[_0x62bd('0x71')]=function(_0x3ba9d2,_0x4bf603,_0x2d12e3){var _0x2abbc8='server/files/images/logos';var _0x415567={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x1e8548){if(_0x1e8548){_0x415567=_0x1e8548;}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x3ba9d2[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),_0x62bd('0x5a'),_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x4bf603,null))[_0x62bd('0x1a')](function(_0x3bb301){if(_0x3bb301){var _0x56fd65=_0x3bb301[_0x62bd('0x58')]&&fs[_0x62bd('0x5d')](path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_[_0x62bd('0x5f')](_0x3bb301[_0x62bd('0x58')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_['toLower'](_0x3bb301[_0x62bd('0x58')])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_['toLower'](_0x62bd('0x72')));var _0x1ea889=_0x62bd('0x68')+_['upperFirst'](_0x62bd('0x58'));if(_0x3bb301[_0x1ea889]||!_0x415567[_0x62bd('0x63')]){_0x56fd65=path['join'](config[_0x62bd('0x5e')],_0x2abbc8,_[_0x62bd('0x5f')](_0x62bd('0x72')));}if(!fs[_0x62bd('0x5d')](_0x56fd65)){throw new db[(_0x62bd('0x69'))][(_0x62bd('0x6f'))](_['upperFirst'](_0x62bd('0x58'))+_0x62bd('0x6a'));}return _0x4bf603[_0x62bd('0x64')](_0x56fd65);}})[_0x62bd('0x24')](handleError(_0x4bf603,null));};exports[_0x62bd('0x73')]=function(_0x3d0892,_0x142b89){var _0x1a9be8={'offset':moment()[_0x62bd('0x74')]()};_0x1a9be8[_0x62bd('0x75')]=moment()[_0x62bd('0x74')](_0x1a9be8['offset'])[_0x62bd('0x76')](_0x62bd('0x77'));return _0x142b89[_0x62bd('0x2b')](0xc8)['send'](_0x1a9be8);}; \ No newline at end of file +var _0x60e6=['json','undefined','limit','offset','set','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default','upperFirst','default_logo.svg','existsSync','Sequelize','ValidationError','logo','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','custom','securePassword','addPreferred','preferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end'];(function(_0x331e4a,_0x1dca1c){var _0x85cd10=function(_0x31fd6a){while(--_0x31fd6a){_0x331e4a['push'](_0x331e4a['shift']());}};_0x85cd10(++_0x1dca1c);}(_0x60e6,0xd2));var _0x660e=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x60e6[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0x660e('0x0'));var rimraf=require(_0x660e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x660e('0x2'));var moment=require(_0x660e('0x3'));var BPromise=require(_0x660e('0x4'));var Mustache=require(_0x660e('0x5'));var util=require(_0x660e('0x6'));var path=require(_0x660e('0x7'));var sox=require(_0x660e('0x8'));var csv=require(_0x660e('0x9'));var ejs=require(_0x660e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x660e('0xb'));var squel=require(_0x660e('0xc'));var crypto=require(_0x660e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x660e('0xe'));var toCsv=require(_0x660e('0x9'));var querystring=require('querystring');var Papa=require(_0x660e('0xf'));var Redis=require(_0x660e('0x10'));var authService=require(_0x660e('0x11'));var qs=require(_0x660e('0x12'));var as=require(_0x660e('0x13'));var hardwareService=require(_0x660e('0x14'));var logger=require(_0x660e('0x15'))(_0x660e('0x16'));var utils=require(_0x660e('0x17'));var config=require(_0x660e('0x18'));var licenseUtil=require(_0x660e('0x19'));var db=require(_0x660e('0x1a'))['db'];var jayson=require(_0x660e('0x1b'));var client=jayson['client'][_0x660e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4175a5,_0x42b6ec,_0x1b6934,_0xc4f1a6){return new BPromise(function(_0x5dd6ed,_0x2529fe){var _0x32d8b2=_0xc4f1a6||client;return _0x32d8b2[_0x660e('0x1d')](_0x4175a5,_0x1b6934)[_0x660e('0x1e')](function(_0x1a1f86){logger[_0x660e('0x1f')](_0x660e('0x20'),_0x42b6ec,_0x660e('0x21'));logger[_0x660e('0x22')](_0x660e('0x23'),_0x42b6ec,_0x660e('0x21'),JSON[_0x660e('0x24')](_0x1a1f86));if(_0x1a1f86['error']){if(_0x1a1f86[_0x660e('0x25')]['code']===0x1f4){logger[_0x660e('0x25')](_0x660e('0x20'),_0x42b6ec,_0x1a1f86['error'][_0x660e('0x26')]);return _0x2529fe(_0x1a1f86[_0x660e('0x25')][_0x660e('0x26')]);}logger[_0x660e('0x25')]('Setting,\x20%s,\x20%s',_0x42b6ec,_0x1a1f86['error'][_0x660e('0x26')]);return _0x5dd6ed(_0x1a1f86[_0x660e('0x25')][_0x660e('0x26')]);}else{logger[_0x660e('0x1f')](_0x660e('0x20'),_0x42b6ec,_0x660e('0x21'));_0x5dd6ed(_0x1a1f86[_0x660e('0x27')][_0x660e('0x26')]);}})[_0x660e('0x28')](function(_0x2390e6){logger[_0x660e('0x25')]('Setting,\x20%s,\x20%s',_0x42b6ec,_0x2390e6);_0x2529fe(_0x2390e6);});});}function respondWithStatusCode(_0x22df0f,_0x54e151){_0x54e151=_0x54e151||0xcc;return function(_0x275552){if(_0x275552){return _0x22df0f[_0x660e('0x29')](_0x54e151);}return _0x22df0f[_0x660e('0x2a')](_0x54e151)[_0x660e('0x2b')]();};}function respondWithResult(_0x116cf4,_0x343523){_0x343523=_0x343523||0xc8;return function(_0x2f47c4){if(_0x2f47c4){return _0x116cf4[_0x660e('0x2a')](_0x343523)[_0x660e('0x2c')](_0x2f47c4);}};}function respondWithFilteredResult(_0x5c8086,_0x3458cf){return function(_0x39512c){if(_0x39512c){var _0x1f4d41=typeof _0x3458cf['offset']===_0x660e('0x2d')&&typeof _0x3458cf[_0x660e('0x2e')]===_0x660e('0x2d');var _0x19926a=_0x39512c['count'];var _0x577c0f=_0x1f4d41?0x0:_0x3458cf[_0x660e('0x2f')];var _0x37278f=_0x1f4d41?_0x39512c['count']:_0x3458cf[_0x660e('0x2f')]+_0x3458cf[_0x660e('0x2e')];var _0x30b211;if(_0x37278f>=_0x19926a){_0x37278f=_0x19926a;_0x30b211=0xc8;}else{_0x30b211=0xce;}_0x5c8086[_0x660e('0x2a')](_0x30b211);return _0x5c8086[_0x660e('0x30')]('Content-Range',_0x577c0f+'-'+_0x37278f+'/'+_0x19926a)['json'](_0x39512c);}return null;};}function patchUpdates(_0x5c76fa){return function(_0x3300c5){try{jsonpatch['apply'](_0x3300c5,_0x5c76fa,!![]);}catch(_0x57233d){return BPromise[_0x660e('0x31')](_0x57233d);}return _0x3300c5[_0x660e('0x32')]();};}function saveUpdates(_0x34be68,_0xa2b54){return function(_0x13147c){if(_0x13147c){return _0x13147c[_0x660e('0x33')](_0x34be68)[_0x660e('0x1e')](function(_0x44aa56){return _0x44aa56;});}return null;};}function removeEntity(_0x266abf,_0x397f64){return function(_0x41a873){if(_0x41a873){return _0x41a873[_0x660e('0x34')]()['then'](function(){_0x266abf[_0x660e('0x2a')](0xcc)[_0x660e('0x2b')]();});}};}function handleEntityNotFound(_0x3122c5,_0x4f5437){return function(_0x6190b1){if(!_0x6190b1){_0x3122c5[_0x660e('0x29')](0x194);}return _0x6190b1;};}function handleError(_0x18832f,_0x50e953){_0x50e953=_0x50e953||0x1f4;return function(_0x469a77){logger['error'](_0x469a77[_0x660e('0x35')]);if(_0x469a77[_0x660e('0x36')]){delete _0x469a77[_0x660e('0x36')];}_0x18832f[_0x660e('0x2a')](_0x50e953)[_0x660e('0x37')](_0x469a77);};}exports['index']=function(_0xf9e64c,_0x3b5ed3){var _0x3d530f={},_0x16e2c0={},_0x1a2dc8={'count':0x0,'rows':[]};var _0x22990f=_[_0x660e('0x38')](db[_0x660e('0x39')][_0x660e('0x3a')],function(_0x3748aa){return{'name':_0x3748aa[_0x660e('0x3b')],'type':_0x3748aa[_0x660e('0x3c')][_0x660e('0x3d')]};});_0x16e2c0[_0x660e('0x3e')]=_[_0x660e('0x38')](_0x22990f,_0x660e('0x36'));_0x16e2c0[_0x660e('0x3f')]=_[_0x660e('0x40')](_0xf9e64c[_0x660e('0x3f')]);_0x16e2c0['filters']=_[_0x660e('0x41')](_0x16e2c0[_0x660e('0x3e')],_0x16e2c0['query']);_0x3d530f[_0x660e('0x42')]=_[_0x660e('0x41')](_0x16e2c0['model'],qs[_0x660e('0x43')](_0xf9e64c[_0x660e('0x3f')][_0x660e('0x43')]));_0x3d530f['attributes']=_0x3d530f[_0x660e('0x42')][_0x660e('0x44')]?_0x3d530f[_0x660e('0x42')]:_0x16e2c0[_0x660e('0x3e')];if(!_0xf9e64c[_0x660e('0x3f')][_0x660e('0x45')](_0x660e('0x46'))){_0x3d530f[_0x660e('0x2e')]=qs[_0x660e('0x2e')](_0xf9e64c[_0x660e('0x3f')][_0x660e('0x2e')]);_0x3d530f[_0x660e('0x2f')]=qs[_0x660e('0x2f')](_0xf9e64c[_0x660e('0x3f')][_0x660e('0x2f')]);}_0x3d530f[_0x660e('0x47')]=qs['sort'](_0xf9e64c[_0x660e('0x3f')]['sort']);_0x3d530f[_0x660e('0x48')]=qs[_0x660e('0x49')](_[_0x660e('0x4a')](_0xf9e64c[_0x660e('0x3f')],_0x16e2c0['filters']),_0x22990f);if(_0xf9e64c['query'][_0x660e('0x4b')]){_0x3d530f[_0x660e('0x48')]=_[_0x660e('0x4c')](_0x3d530f[_0x660e('0x48')],{'$or':_['map'](_0x22990f,function(_0x2b7007){if(_0x2b7007[_0x660e('0x3c')]!==_0x660e('0x4d')){var _0x403db7={};_0x403db7[_0x2b7007[_0x660e('0x36')]]={'$like':'%'+_0xf9e64c[_0x660e('0x3f')]['filter']+'%'};return _0x403db7;}})});}_0x3d530f=_[_0x660e('0x4c')]({},_0x3d530f,_0xf9e64c[_0x660e('0x4e')]);var _0x4dcfda={'where':_0x3d530f[_0x660e('0x48')]};return db['Setting'][_0x660e('0x4f')](_0x4dcfda)[_0x660e('0x1e')](function(_0x1f1422){_0x1a2dc8[_0x660e('0x4f')]=_0x1f1422;if(_0xf9e64c[_0x660e('0x3f')][_0x660e('0x50')]){_0x3d530f[_0x660e('0x51')]=[{'all':!![]}];}return db[_0x660e('0x39')][_0x660e('0x52')](_0x3d530f);})[_0x660e('0x1e')](function(_0x40deeb){_0x1a2dc8[_0x660e('0x53')]=_0x40deeb;return _0x1a2dc8;})[_0x660e('0x1e')](respondWithFilteredResult(_0x3b5ed3,_0x3d530f))['catch'](handleError(_0x3b5ed3,null));};exports['show']=function(_0x5b81b4,_0x1ae7a2){var _0x2029f4={'raw':![],'where':{'id':_0x5b81b4[_0x660e('0x54')]['id']}},_0x47a96d={};_0x47a96d[_0x660e('0x3e')]=_[_0x660e('0x40')](db['Setting'][_0x660e('0x3a')]);_0x47a96d[_0x660e('0x3f')]=_['keys'](_0x5b81b4['query']);_0x47a96d[_0x660e('0x49')]=_[_0x660e('0x41')](_0x47a96d[_0x660e('0x3e')],_0x47a96d[_0x660e('0x3f')]);_0x2029f4[_0x660e('0x42')]=_[_0x660e('0x41')](_0x47a96d['model'],qs[_0x660e('0x43')](_0x5b81b4['query']['fields']));_0x2029f4[_0x660e('0x42')]=_0x2029f4[_0x660e('0x42')][_0x660e('0x44')]?_0x2029f4[_0x660e('0x42')]:_0x47a96d[_0x660e('0x3e')];if(_0x5b81b4[_0x660e('0x3f')][_0x660e('0x50')]){_0x2029f4[_0x660e('0x51')]=[{'all':!![]}];}_0x2029f4=_[_0x660e('0x4c')]({},_0x2029f4,_0x5b81b4[_0x660e('0x4e')]);return db[_0x660e('0x39')][_0x660e('0x55')](_0x2029f4)[_0x660e('0x1e')](handleEntityNotFound(_0x1ae7a2,null))[_0x660e('0x1e')](respondWithResult(_0x1ae7a2,null))[_0x660e('0x28')](handleError(_0x1ae7a2,null));};exports[_0x660e('0x33')]=function(_0x4371d4,_0xa84184){if(_0x4371d4['body']['id']){delete _0x4371d4[_0x660e('0x56')]['id'];}return db['Setting'][_0x660e('0x55')]({'where':{'id':_0x4371d4[_0x660e('0x54')]['id']}})[_0x660e('0x1e')](handleEntityNotFound(_0xa84184,null))[_0x660e('0x1e')](saveUpdates(_0x4371d4[_0x660e('0x56')],null))[_0x660e('0x1e')](respondWithResult(_0xa84184,null))[_0x660e('0x28')](handleError(_0xa84184,null));};exports[_0x660e('0x57')]=function(_0x131bd5,_0x3c6001,_0x3b5b8c){if(_0x131bd5[_0x660e('0x58')]&&_0x131bd5[_0x660e('0x58')][_0x660e('0x59')]){_0x131bd5[_0x660e('0x56')]['logo']=_0x131bd5[_0x660e('0x58')][_0x660e('0x59')];}return db[_0x660e('0x39')][_0x660e('0x55')]({'where':{'id':_0x131bd5[_0x660e('0x54')]['id']}})[_0x660e('0x1e')](handleEntityNotFound(_0x3c6001,null))[_0x660e('0x1e')](saveUpdates(_0x131bd5[_0x660e('0x56')],null))['then'](respondWithResult(_0x3c6001,null))['catch'](handleError(_0x3c6001,null));};exports[_0x660e('0x5a')]=function(_0x2274e9,_0x1217d4,_0x5877e2){if(_0x2274e9[_0x660e('0x58')]&&_0x2274e9['file'][_0x660e('0x59')]){_0x2274e9['body'][_0x660e('0x5b')]=_0x2274e9[_0x660e('0x58')][_0x660e('0x59')];}return db[_0x660e('0x39')]['find']({'where':{'id':_0x2274e9[_0x660e('0x54')]['id']}})[_0x660e('0x1e')](handleEntityNotFound(_0x1217d4,null))[_0x660e('0x1e')](saveUpdates(_0x2274e9[_0x660e('0x56')],null))[_0x660e('0x1e')](respondWithResult(_0x1217d4,null))['catch'](handleError(_0x1217d4,null));};var utilLicense=require(_0x660e('0x19'));exports[_0x660e('0x5c')]=function(_0x4620f9,_0x29678f,_0x57768d){var _0x236533=_0x660e('0x5d');var _0x52e46e={'custom':![]};return utilLicense[_0x660e('0x5e')]()[_0x660e('0x1e')](function(_0x207792){if(_0x207792){_0x52e46e=_0x207792;}return db['Setting'][_0x660e('0x55')]({'where':{'id':_0x4620f9[_0x660e('0x54')]['id']},'attributes':['logo',_0x660e('0x5b'),'preferred',_0x660e('0x5f'),_0x660e('0x60'),_0x660e('0x61'),_0x660e('0x62'),_0x660e('0x63')],'raw':!![]});})[_0x660e('0x1e')](handleEntityNotFound(_0x29678f,null))[_0x660e('0x1e')](function(_0x13afa7){if(_0x13afa7){var _0x3404c3=_0x13afa7['logo']&&fs['existsSync'](path['join'](config[_0x660e('0x64')],_0x236533,_[_0x660e('0x65')](_0x13afa7['logo'])))?path[_0x660e('0x66')](config[_0x660e('0x64')],_0x236533,_[_0x660e('0x65')](_0x13afa7['logo'])):path['join'](config['root'],_0x236533,_[_0x660e('0x65')]('default_logo.svg'));var _0x58da88=_0x660e('0x67')+_[_0x660e('0x68')]('logo');if(_0x13afa7[_0x58da88]||!_0x52e46e['custom']){_0x3404c3=path['join'](config[_0x660e('0x64')],_0x236533,_[_0x660e('0x65')](_0x660e('0x69')));}if(!fs[_0x660e('0x6a')](_0x3404c3)){throw new db[(_0x660e('0x6b'))][(_0x660e('0x6c'))](_['upperFirst'](_0x660e('0x6d'))+_0x660e('0x6e'));}return _0x29678f[_0x660e('0x6f')](_0x3404c3);}})[_0x660e('0x28')](handleError(_0x29678f,null));};var utilLicense=require(_0x660e('0x19'));exports[_0x660e('0x70')]=function(_0x6e9bd9,_0x3aa9d1,_0x5cd57a){var _0x4b4fa5=_0x660e('0x5d');var _0x196dbe={'custom':![]};return utilLicense[_0x660e('0x5e')]()[_0x660e('0x1e')](function(_0x15896f){if(_0x15896f){_0x196dbe=_0x15896f;}return db['Setting'][_0x660e('0x55')]({'where':{'id':_0x6e9bd9[_0x660e('0x54')]['id']},'attributes':[_0x660e('0x6d'),'loginLogo','preferred',_0x660e('0x5f'),_0x660e('0x60'),_0x660e('0x61'),'defaultPreferred',_0x660e('0x63')],'raw':!![]});})[_0x660e('0x1e')](handleEntityNotFound(_0x3aa9d1,null))[_0x660e('0x1e')](function(_0x340440){if(_0x340440){var _0x1062b9=_0x340440['loginLogo']&&fs[_0x660e('0x6a')](path[_0x660e('0x66')](config['root'],_0x4b4fa5,_[_0x660e('0x65')](_0x340440['loginLogo'])))?path[_0x660e('0x66')](config[_0x660e('0x64')],_0x4b4fa5,_[_0x660e('0x65')](_0x340440[_0x660e('0x5b')])):path[_0x660e('0x66')](config[_0x660e('0x64')],_0x4b4fa5,_['toLower'](_0x660e('0x71')));var _0xc89f5f=_0x660e('0x67')+_[_0x660e('0x68')](_0x660e('0x5b'));if(_0x340440[_0xc89f5f]||!_0x196dbe[_0x660e('0x72')]){_0x1062b9=path[_0x660e('0x66')](config[_0x660e('0x64')],_0x4b4fa5,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x660e('0x6a')](_0x1062b9)){throw new db[(_0x660e('0x6b'))][(_0x660e('0x6c'))](_['upperFirst'](_0x660e('0x5b'))+'\x20not\x20found');}return _0x3aa9d1['download'](_0x1062b9);}})[_0x660e('0x28')](handleError(_0x3aa9d1,null));};exports['gdpr']=function(_0x4cc235,_0x10df4c){return db[_0x660e('0x39')][_0x660e('0x55')]({'where':{'id':_0x4cc235[_0x660e('0x54')]['id']},'attributes':[_0x660e('0x73')]})['then'](respondWithResult(_0x10df4c,null))['catch'](handleError(_0x10df4c,null));};exports[_0x660e('0x74')]=function(_0x4342fc,_0x43de35,_0xc6e72b){if(_0x4342fc[_0x660e('0x58')]&&_0x4342fc[_0x660e('0x58')]['filename']){_0x4342fc['body'][_0x660e('0x75')]=_0x4342fc['file'][_0x660e('0x59')];}return db[_0x660e('0x39')]['find']({'where':{'id':_0x4342fc[_0x660e('0x54')]['id']}})[_0x660e('0x1e')](handleEntityNotFound(_0x43de35,null))[_0x660e('0x1e')](saveUpdates(_0x4342fc[_0x660e('0x56')],null))['then'](respondWithResult(_0x43de35,null))[_0x660e('0x28')](handleError(_0x43de35,null));};var utilLicense=require(_0x660e('0x19'));exports[_0x660e('0x76')]=function(_0x378d67,_0x340bbf,_0x3c15f6){var _0x125271='server/files/images/logos';var _0x15f84b={'custom':![]};return utilLicense['getLicense']()[_0x660e('0x1e')](function(_0x54c858){if(_0x54c858){_0x15f84b=_0x54c858;}return db[_0x660e('0x39')][_0x660e('0x55')]({'where':{'id':_0x378d67[_0x660e('0x54')]['id']},'attributes':[_0x660e('0x6d'),_0x660e('0x5b'),_0x660e('0x75'),'favicon',_0x660e('0x60'),_0x660e('0x61'),_0x660e('0x62'),_0x660e('0x63')],'raw':!![]});})[_0x660e('0x1e')](handleEntityNotFound(_0x340bbf,null))[_0x660e('0x1e')](function(_0x4e491c){if(_0x4e491c){var _0x47b8d7=_0x4e491c[_0x660e('0x75')]&&fs[_0x660e('0x6a')](path[_0x660e('0x66')](config['root'],_0x125271,_[_0x660e('0x65')](_0x4e491c[_0x660e('0x75')])))?path[_0x660e('0x66')](config[_0x660e('0x64')],_0x125271,_[_0x660e('0x65')](_0x4e491c[_0x660e('0x75')])):path[_0x660e('0x66')](config[_0x660e('0x64')],_0x125271,_[_0x660e('0x65')]('default_preferred.png'));var _0x5143e8=_0x660e('0x67')+_[_0x660e('0x68')]('preferred');if(_0x4e491c[_0x5143e8]||!_0x15f84b[_0x660e('0x72')]||!_0x15f84b[_0x660e('0x75')]){_0x47b8d7=path[_0x660e('0x66')](config[_0x660e('0x64')],_0x125271,_[_0x660e('0x65')](_0x660e('0x77')));}if(!fs[_0x660e('0x6a')](_0x47b8d7)){throw new db['Sequelize'][(_0x660e('0x6c'))](_[_0x660e('0x68')](_0x660e('0x75'))+_0x660e('0x6e'));}return _0x340bbf[_0x660e('0x6f')](_0x47b8d7);}})[_0x660e('0x28')](handleError(_0x340bbf,null));};exports['addFavicon']=function(_0x22d925,_0x2e4fb3,_0xbb8ba1){if(_0x22d925[_0x660e('0x58')]&&_0x22d925[_0x660e('0x58')][_0x660e('0x59')]){_0x22d925['body'][_0x660e('0x5f')]=_0x22d925['file'][_0x660e('0x59')];}return db[_0x660e('0x39')]['find']({'where':{'id':_0x22d925[_0x660e('0x54')]['id']}})[_0x660e('0x1e')](handleEntityNotFound(_0x2e4fb3,null))[_0x660e('0x1e')](saveUpdates(_0x22d925[_0x660e('0x56')],null))[_0x660e('0x1e')](respondWithResult(_0x2e4fb3,null))[_0x660e('0x28')](handleError(_0x2e4fb3,null));};var utilLicense=require('../../config/license/util');exports[_0x660e('0x78')]=function(_0x294249,_0x21c912,_0x201fc6){var _0x3ea646=_0x660e('0x5d');var _0x18b348={'custom':![]};return utilLicense[_0x660e('0x5e')]()[_0x660e('0x1e')](function(_0xeebaf3){if(_0xeebaf3){_0x18b348=_0xeebaf3;}return db['Setting']['find']({'where':{'id':_0x294249['params']['id']},'attributes':[_0x660e('0x6d'),_0x660e('0x5b'),_0x660e('0x75'),_0x660e('0x5f'),_0x660e('0x60'),_0x660e('0x61'),_0x660e('0x62'),_0x660e('0x63')],'raw':!![]});})[_0x660e('0x1e')](handleEntityNotFound(_0x21c912,null))['then'](function(_0x18b96c){if(_0x18b96c){var _0x3130d2=_0x18b96c[_0x660e('0x5f')]&&fs[_0x660e('0x6a')](path['join'](config[_0x660e('0x64')],_0x3ea646,_[_0x660e('0x65')](_0x18b96c['favicon'])))?path['join'](config[_0x660e('0x64')],_0x3ea646,_[_0x660e('0x65')](_0x18b96c[_0x660e('0x5f')])):path[_0x660e('0x66')](config[_0x660e('0x64')],_0x3ea646,_[_0x660e('0x65')](_0x660e('0x79')));var _0x3e0377=_0x660e('0x67')+_[_0x660e('0x68')](_0x660e('0x5f'));if(_0x18b96c[_0x3e0377]||!_0x18b348[_0x660e('0x72')]){_0x3130d2=path[_0x660e('0x66')](config['root'],_0x3ea646,_[_0x660e('0x65')]('default_favicon.ico'));}if(!fs[_0x660e('0x6a')](_0x3130d2)){throw new db[(_0x660e('0x6b'))][(_0x660e('0x6c'))](_[_0x660e('0x68')]('favicon')+_0x660e('0x6e'));}return _0x21c912[_0x660e('0x6f')](_0x3130d2);}})['catch'](handleError(_0x21c912,null));};exports[_0x660e('0x7a')]=function(_0x27d1b6,_0x5cc9f7){var _0x4c0c74={'offset':moment()[_0x660e('0x7b')]()};_0x4c0c74[_0x660e('0x7c')]=moment()['utcOffset'](_0x4c0c74['offset'])[_0x660e('0x7d')](_0x660e('0x7e'));return _0x5cc9f7[_0x660e('0x2a')](0xc8)[_0x660e('0x37')](_0x4c0c74);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 2c93e24..17bef5b 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x88aeb1,_0x50bae7){var _0x53ce95=function(_0x6dc50c){while(--_0x6dc50c){_0x88aeb1['push'](_0x88aeb1['shift']());}};_0x53ce95(++_0x50bae7);}(_0xedd9,0xfc));var _0x9edd=function(_0xc00ed,_0x5d809c){_0xc00ed=_0xc00ed-0x0;var _0x53c738=_0xedd9[_0xc00ed];return _0x53c738;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x008c,0x188));var _0xc008=function(_0xcba81,_0x2d4fe8){_0xcba81=_0xcba81-0x0;var _0x2f4468=_0x008c[_0xcba81];return _0x2f4468;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9b6690e..3f86163 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 _0x3e84=['Setting','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','ShowSetting'];(function(_0x3e60fa,_0x495abd){var _0x15eef4=function(_0x1ebc4f){while(--_0x1ebc4f){_0x3e60fa['push'](_0x3e60fa['shift']());}};_0x15eef4(++_0x495abd);}(_0x3e84,0xbc));var _0x43e8=function(_0x4dbbdc,_0x1eb315){_0x4dbbdc=_0x4dbbdc-0x0;var _0x3b4842=_0x3e84[_0x4dbbdc];return _0x3b4842;};'use strict';var _=require(_0x43e8('0x0'));var util=require(_0x43e8('0x1'));var moment=require('moment');var BPromise=require(_0x43e8('0x2'));var rs=require(_0x43e8('0x3'));var fs=require('fs');var Redis=require(_0x43e8('0x4'));var db=require(_0x43e8('0x5'))['db'];var utils=require(_0x43e8('0x6'));var logger=require(_0x43e8('0x7'))(_0x43e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x43e8('0x9'));var client=jayson['client'][_0x43e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406562,_0x3011f1,_0x252633){return new BPromise(function(_0x1a2f8a,_0xc658eb){return client['request'](_0x406562,_0x252633)[_0x43e8('0xb')](function(_0x376223){logger[_0x43e8('0xc')](_0x43e8('0xd'),_0x3011f1,'request\x20sent');logger[_0x43e8('0xe')](_0x43e8('0xf'),_0x3011f1,'request\x20sent',JSON['stringify'](_0x376223));if(_0x376223[_0x43e8('0x10')]){if(_0x376223['error']['code']===0x1f4){logger[_0x43e8('0x10')]('Setting,\x20%s,\x20%s',_0x3011f1,_0x376223['error'][_0x43e8('0x11')]);return _0xc658eb(_0x376223[_0x43e8('0x10')][_0x43e8('0x11')]);}logger[_0x43e8('0x10')](_0x43e8('0xd'),_0x3011f1,_0x376223['error'][_0x43e8('0x11')]);return _0x1a2f8a(_0x376223[_0x43e8('0x10')][_0x43e8('0x11')]);}else{logger[_0x43e8('0xc')](_0x43e8('0xd'),_0x3011f1,_0x43e8('0x12'));_0x1a2f8a(_0x376223[_0x43e8('0x13')][_0x43e8('0x11')]);}})[_0x43e8('0x14')](function(_0x4007f0){logger[_0x43e8('0x10')](_0x43e8('0xd'),_0x3011f1,_0x4007f0);_0xc658eb(_0x4007f0);});});}exports[_0x43e8('0x15')]=function(_0x536b75){var _0x2a9003=this;return new Promise(function(_0x1eaf67,_0x771f99){return db[_0x43e8('0x16')]['find']({'raw':_0x536b75[_0x43e8('0x17')]?_0x536b75['options'][_0x43e8('0x18')]===undefined?!![]:![]:!![],'where':_0x536b75[_0x43e8('0x17')]?_0x536b75['options'][_0x43e8('0x19')]||null:null,'attributes':_0x536b75[_0x43e8('0x17')]?_0x536b75[_0x43e8('0x17')][_0x43e8('0x1a')]||null:null,'include':_0x536b75[_0x43e8('0x17')]?_0x536b75[_0x43e8('0x17')][_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x536b75[_0x43e8('0x17')][_0x43e8('0x1b')],function(_0x25b83b){return{'model':db[_0x25b83b[_0x43e8('0x1d')]],'as':_0x25b83b['as'],'attributes':_0x25b83b[_0x43e8('0x1a')],'include':_0x25b83b[_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x25b83b[_0x43e8('0x1b')],function(_0x46d949){return{'model':db[_0x46d949[_0x43e8('0x1d')]],'as':_0x46d949['as'],'attributes':_0x46d949['attributes'],'include':_0x46d949[_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x46d949['include'],function(_0x4e365b){return{'model':db[_0x4e365b[_0x43e8('0x1d')]],'as':_0x4e365b['as'],'attributes':_0x4e365b[_0x43e8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ce9b2){logger[_0x43e8('0xc')](_0x43e8('0x15'),_0x536b75);logger['debug'](_0x43e8('0x15'),_0x536b75,JSON['stringify'](_0x5ce9b2));_0x1eaf67(_0x5ce9b2);})[_0x43e8('0x14')](function(_0x4a50d6){logger[_0x43e8('0x10')](_0x43e8('0x15'),_0x4a50d6[_0x43e8('0x11')],_0x536b75);_0x771f99(_0x2a9003[_0x43e8('0x10')](0x1f4,_0x4a50d6[_0x43e8('0x11')]));});});}; \ No newline at end of file +var _0x5e3c=['stringify','error','message','Setting','find','options','raw','where','attributes','include','model','map','ShowSetting','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1a388b,_0x24884d){var _0x2c6d19=function(_0x306780){while(--_0x306780){_0x1a388b['push'](_0x1a388b['shift']());}};_0x2c6d19(++_0x24884d);}(_0x5e3c,0x126));var _0xc5e3=function(_0x932199,_0x5391f4){_0x932199=_0x932199-0x0;var _0x3b335a=_0x5e3c[_0x932199];return _0x3b335a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc5e3('0x0'));var BPromise=require(_0xc5e3('0x1'));var rs=require(_0xc5e3('0x2'));var fs=require('fs');var Redis=require(_0xc5e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5e3('0x4'));var logger=require('../../config/logger')(_0xc5e3('0x5'));var config=require('../../config/environment');var jayson=require(_0xc5e3('0x6'));var client=jayson[_0xc5e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387afe,_0x447e2c,_0x201c26){return new BPromise(function(_0x539e21,_0x2642f7){return client['request'](_0x387afe,_0x201c26)[_0xc5e3('0x8')](function(_0x3259ca){logger[_0xc5e3('0x9')](_0xc5e3('0xa'),_0x447e2c,_0xc5e3('0xb'));logger[_0xc5e3('0xc')](_0xc5e3('0xd'),_0x447e2c,_0xc5e3('0xb'),JSON[_0xc5e3('0xe')](_0x3259ca));if(_0x3259ca[_0xc5e3('0xf')]){if(_0x3259ca['error']['code']===0x1f4){logger[_0xc5e3('0xf')](_0xc5e3('0xa'),_0x447e2c,_0x3259ca[_0xc5e3('0xf')][_0xc5e3('0x10')]);return _0x2642f7(_0x3259ca[_0xc5e3('0xf')]['message']);}logger['error'](_0xc5e3('0xa'),_0x447e2c,_0x3259ca[_0xc5e3('0xf')][_0xc5e3('0x10')]);return _0x539e21(_0x3259ca[_0xc5e3('0xf')][_0xc5e3('0x10')]);}else{logger['info'](_0xc5e3('0xa'),_0x447e2c,_0xc5e3('0xb'));_0x539e21(_0x3259ca['result'][_0xc5e3('0x10')]);}})['catch'](function(_0x2766e1){logger[_0xc5e3('0xf')](_0xc5e3('0xa'),_0x447e2c,_0x2766e1);_0x2642f7(_0x2766e1);});});}exports['ShowSetting']=function(_0x4106d5){var _0x4bbdb4=this;return new Promise(function(_0x507b14,_0x7dba46){return db[_0xc5e3('0x11')][_0xc5e3('0x12')]({'raw':_0x4106d5['options']?_0x4106d5[_0xc5e3('0x13')][_0xc5e3('0x14')]===undefined?!![]:![]:!![],'where':_0x4106d5[_0xc5e3('0x13')]?_0x4106d5['options'][_0xc5e3('0x15')]||null:null,'attributes':_0x4106d5[_0xc5e3('0x13')]?_0x4106d5[_0xc5e3('0x13')][_0xc5e3('0x16')]||null:null,'include':_0x4106d5[_0xc5e3('0x13')]?_0x4106d5[_0xc5e3('0x13')][_0xc5e3('0x17')]?_['map'](_0x4106d5[_0xc5e3('0x13')][_0xc5e3('0x17')],function(_0x33aa9b){return{'model':db[_0x33aa9b[_0xc5e3('0x18')]],'as':_0x33aa9b['as'],'attributes':_0x33aa9b[_0xc5e3('0x16')],'include':_0x33aa9b['include']?_[_0xc5e3('0x19')](_0x33aa9b[_0xc5e3('0x17')],function(_0x28f9e2){return{'model':db[_0x28f9e2[_0xc5e3('0x18')]],'as':_0x28f9e2['as'],'attributes':_0x28f9e2[_0xc5e3('0x16')],'include':_0x28f9e2[_0xc5e3('0x17')]?_[_0xc5e3('0x19')](_0x28f9e2[_0xc5e3('0x17')],function(_0x28cb57){return{'model':db[_0x28cb57[_0xc5e3('0x18')]],'as':_0x28cb57['as'],'attributes':_0x28cb57[_0xc5e3('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc5e3('0x8')](function(_0xc2d7fe){logger['info'](_0xc5e3('0x1a'),_0x4106d5);logger[_0xc5e3('0xc')](_0xc5e3('0x1a'),_0x4106d5,JSON[_0xc5e3('0xe')](_0xc2d7fe));_0x507b14(_0xc2d7fe);})[_0xc5e3('0x1b')](function(_0x15cadb){logger[_0xc5e3('0xf')](_0xc5e3('0x1a'),_0x15cadb[_0xc5e3('0x10')],_0x4106d5);_0x7dba46(_0x4bbdb4[_0xc5e3('0xf')](0x1f4,_0x15cadb[_0xc5e3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5c0c4cb..e0d9e89 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(_0x15054c,_0xd98c03){var _0xab8889=function(_0x57e7b3){while(--_0x57e7b3){_0x15054c['push'](_0x15054c['shift']());}};_0xab8889(++_0xd98c03);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x40c55f,_0x2581fa){var _0x5df2c4=function(_0x43edfa){while(--_0x43edfa){_0x40c55f['push'](_0x40c55f['shift']());}};_0x5df2c4(++_0x2581fa);}(_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 fcdf37a..4da2c9b 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 _0x67e7=['skebby','clicksend','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','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x67e7,0xa0));var _0x767e=function(_0x3ce373,_0x4ded0f){_0x3ce373=_0x3ce373-0x0;var _0x3bce37=_0x67e7[_0x3ce373];return _0x3bce37;};'use strict';var Sequelize=require(_0x767e('0x0'));var rs=require(_0x767e('0x1'));module[_0x767e('0x2')]={'name':{'type':Sequelize[_0x767e('0x3')],'unique':_0x767e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x767e('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x767e('0x5')]();}},'phone':{'type':Sequelize[_0x767e('0x3')]},'type':{'type':Sequelize[_0x767e('0x6')](_0x767e('0x7'),_0x767e('0x8'),'connectel',_0x767e('0x9'),'plivo',_0x767e('0xa'),_0x767e('0xb'),_0x767e('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x767e('0x3')]},'authToken':{'type':Sequelize[_0x767e('0x3')]},'smsMethod':{'type':Sequelize[_0x767e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x767e('0x3')]},'password':{'type':Sequelize[_0x767e('0x3')]},'apiKey':{'type':Sequelize[_0x767e('0x3')]},'applicationId':{'type':Sequelize[_0x767e('0x3')]},'accountId':{'type':Sequelize[_0x767e('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x767e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x767e('0xe')],'defaultValue':function(){return _0x767e('0xf');}},'notificationSound':{'type':Sequelize[_0x767e('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x767e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x767e('0x10')],'comment':_0x767e('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![],'comment':_0x767e('0x12'),'set':function(_0x5a996c){if(!_0x5a996c)this[_0x767e('0x13')]('mandatoryDispositionPauseId',null);this[_0x767e('0x13')](_0x767e('0x14'),_0x5a996c);}}}; \ No newline at end of file +var _0x889a=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','name','STRING','generate','ENUM','twilio','connectel','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5d3b65,_0x283628){var _0x1d4338=function(_0x550ded){while(--_0x550ded){_0x5d3b65['push'](_0x5d3b65['shift']());}};_0x1d4338(++_0x283628);}(_0x889a,0x17e));var _0xa889=function(_0x4bae7e,_0x110ae0){_0x4bae7e=_0x4bae7e-0x0;var _0x36b7d3=_0x889a[_0x4bae7e];return _0x36b7d3;};'use strict';var Sequelize=require(_0xa889('0x0'));var rs=require(_0xa889('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa889('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa889('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa889('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa889('0x3')],'defaultValue':function(){return rs[_0xa889('0x4')]();}},'phone':{'type':Sequelize[_0xa889('0x3')]},'type':{'type':Sequelize[_0xa889('0x5')](_0xa889('0x6'),'skebby',_0xa889('0x7'),'clicksend',_0xa889('0x8'),_0xa889('0x9'),_0xa889('0xa'),_0xa889('0xb'),_0xa889('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa889('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa889('0x3')]},'apiKey':{'type':Sequelize[_0xa889('0x3')]},'applicationId':{'type':Sequelize[_0xa889('0x3')]},'accountId':{'type':Sequelize[_0xa889('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xa889('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xa889('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa889('0xe')],'defaultValue':function(){return _0xa889('0xf');}},'notificationSound':{'type':Sequelize[_0xa889('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa889('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa889('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa889('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa889('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa889('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa889('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa889('0x10')],'comment':_0xa889('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xa889('0xd')],'defaultValue':![],'comment':_0xa889('0x12'),'set':function(_0x349b7e){if(!_0x349b7e)this['setDataValue'](_0xa889('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x349b7e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 43a51d2..40435fa 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 _0x2786=['error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','type','VIRTUAL','filter','SmsAccount','includeAll','include','findAll','rows','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','finally','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','DELIVERED','groupName','redif','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a5b82,_0xc61f63){var _0x322e1a=function(_0x3b2858){while(--_0x3b2858){_0x2a5b82['push'](_0x2a5b82['shift']());}};_0x322e1a(++_0xc61f63);}(_0x2786,0xc5));var _0x6278=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2786[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6278('0x0'));var rimraf=require(_0x6278('0x1'));var zipdir=require(_0x6278('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6278('0x3'));var moment=require(_0x6278('0x4'));var BPromise=require(_0x6278('0x5'));var Mustache=require(_0x6278('0x6'));var util=require('util');var path=require(_0x6278('0x7'));var sox=require(_0x6278('0x8'));var csv=require(_0x6278('0x9'));var ejs=require(_0x6278('0xa'));var fs=require('fs');var fs_extra=require(_0x6278('0xb'));var _=require(_0x6278('0xc'));var squel=require(_0x6278('0xd'));var crypto=require(_0x6278('0xe'));var jsforce=require(_0x6278('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6278('0x10'));var Papa=require('papaparse');var Redis=require(_0x6278('0x11'));var authService=require(_0x6278('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6278('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6278('0x14'));var utils=require(_0x6278('0x15'));var config=require(_0x6278('0x16'));var licenseUtil=require(_0x6278('0x17'));var db=require(_0x6278('0x18'))['db'];config[_0x6278('0x19')]=_[_0x6278('0x1a')](config[_0x6278('0x19')],{'host':_0x6278('0x1b'),'port':0x18eb});var socket=require(_0x6278('0x1c'))(new Redis(config[_0x6278('0x19')]));require(_0x6278('0x1d'))['register'](socket);var jayson=require(_0x6278('0x1e'));var client=jayson['client'][_0x6278('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xa1c3,_0x54ee6c,_0x2c46cd,_0xef6591){return new BPromise(function(_0x11589f,_0x33455c){var _0x1a5ef7=_0xef6591||client;return _0x1a5ef7[_0x6278('0x20')](_0xa1c3,_0x2c46cd)[_0x6278('0x21')](function(_0x449444){logger[_0x6278('0x22')](_0x6278('0x23'),_0x54ee6c,_0x6278('0x24'));logger['debug'](_0x6278('0x25'),_0x54ee6c,'request\x20sent',JSON[_0x6278('0x26')](_0x449444));if(_0x449444[_0x6278('0x27')]){if(_0x449444[_0x6278('0x27')][_0x6278('0x28')]===0x1f4){logger[_0x6278('0x27')](_0x6278('0x23'),_0x54ee6c,_0x449444[_0x6278('0x27')]['message']);return _0x33455c(_0x449444[_0x6278('0x27')][_0x6278('0x29')]);}logger[_0x6278('0x27')]('SmsAccount,\x20%s,\x20%s',_0x54ee6c,_0x449444['error'][_0x6278('0x29')]);return _0x11589f(_0x449444[_0x6278('0x27')][_0x6278('0x29')]);}else{logger['info'](_0x6278('0x23'),_0x54ee6c,'request\x20sent');_0x11589f(_0x449444[_0x6278('0x2a')]['message']);}})[_0x6278('0x2b')](function(_0x33fc41){logger[_0x6278('0x27')]('SmsAccount,\x20%s,\x20%s',_0x54ee6c,_0x33fc41);_0x33455c(_0x33fc41);});});}function respondWithStatusCode(_0x261c60,_0x4ab5a6){_0x4ab5a6=_0x4ab5a6||0xcc;return function(_0x435b5e){if(_0x435b5e){return _0x261c60[_0x6278('0x2c')](_0x4ab5a6);}return _0x261c60['status'](_0x4ab5a6)['end']();};}function respondWithResult(_0x1f7bf8,_0xb29521){_0xb29521=_0xb29521||0xc8;return function(_0x2293e2){if(_0x2293e2){return _0x1f7bf8[_0x6278('0x2d')](_0xb29521)[_0x6278('0x2e')](_0x2293e2);}};}function respondWithFilteredResult(_0x429c8f,_0x18d652){return function(_0x39ab87){if(_0x39ab87){var _0x115bae=typeof _0x18d652[_0x6278('0x2f')]===_0x6278('0x30')&&typeof _0x18d652[_0x6278('0x31')]===_0x6278('0x30');var _0x4161b5=_0x39ab87['count'];var _0x46e1bc=_0x115bae?0x0:_0x18d652[_0x6278('0x2f')];var _0x3b0175=_0x115bae?_0x39ab87[_0x6278('0x32')]:_0x18d652[_0x6278('0x2f')]+_0x18d652['limit'];var _0x1c9351;if(_0x3b0175>=_0x4161b5){_0x3b0175=_0x4161b5;_0x1c9351=0xc8;}else{_0x1c9351=0xce;}_0x429c8f[_0x6278('0x2d')](_0x1c9351);return _0x429c8f[_0x6278('0x33')](_0x6278('0x34'),_0x46e1bc+'-'+_0x3b0175+'/'+_0x4161b5)[_0x6278('0x2e')](_0x39ab87);}return null;};}function patchUpdates(_0x291f82){return function(_0x408e40){try{jsonpatch[_0x6278('0x35')](_0x408e40,_0x291f82,!![]);}catch(_0x219c68){return BPromise[_0x6278('0x36')](_0x219c68);}return _0x408e40['save']();};}function saveUpdates(_0x540ea9,_0x3dc06b){return function(_0x210b30){if(_0x210b30){return _0x210b30[_0x6278('0x37')](_0x540ea9)[_0x6278('0x21')](function(_0x65cda4){return _0x65cda4;});}return null;};}function removeEntity(_0x1b6bf7,_0x355143){return function(_0x5f5915){if(_0x5f5915){return _0x5f5915[_0x6278('0x38')]()['then'](function(){var _0x389e06=_0x5f5915[_0x6278('0x39')]({'plain':!![]});var _0x4774f1=_0x6278('0x3a');return db[_0x6278('0x3b')]['destroy']({'where':{'type':_0x4774f1,'resourceId':_0x389e06['id']}})[_0x6278('0x21')](function(){return _0x5f5915;});})[_0x6278('0x21')](function(){_0x1b6bf7[_0x6278('0x2d')](0xcc)[_0x6278('0x3c')]();});}};}function handleEntityNotFound(_0x4f0a2d,_0x503558){return function(_0x1c89af){if(!_0x1c89af){_0x4f0a2d['sendStatus'](0x194);}return _0x1c89af;};}function handleError(_0x584680,_0x5db99d){_0x5db99d=_0x5db99d||0x1f4;return function(_0x4d0315){logger[_0x6278('0x27')](_0x4d0315[_0x6278('0x3d')]);if(_0x4d0315[_0x6278('0x3e')]){delete _0x4d0315['name'];}_0x584680[_0x6278('0x2d')](_0x5db99d)[_0x6278('0x3f')](_0x4d0315);};}exports[_0x6278('0x40')]=function(_0x207018,_0x3d04d3){var _0x390f71={'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]},_0x52fb75={},_0x5c237a={'count':0x0,'rows':[]};var _0xcbbcef=_[_0x6278('0x43')](db['SmsAccount'][_0x6278('0x44')],function(_0x1744be){return{'name':_0x1744be[_0x6278('0x45')],'type':_0x1744be['type'][_0x6278('0x46')]};});_0x52fb75['model']=_[_0x6278('0x43')](_0xcbbcef,_0x6278('0x3e'));_0x52fb75[_0x6278('0x47')]=_['keys'](_0x207018['query']);_0x52fb75['filters']=_['intersection'](_0x52fb75[_0x6278('0x48')],_0x52fb75['query']);_0x390f71[_0x6278('0x49')]=_[_0x6278('0x4a')](_0x52fb75[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x207018['query'][_0x6278('0x4b')]));_0x390f71[_0x6278('0x49')]=_0x390f71[_0x6278('0x49')]['length']?_0x390f71[_0x6278('0x49')]:_0x52fb75[_0x6278('0x48')];if(!_0x207018[_0x6278('0x47')][_0x6278('0x4c')]('nolimit')){_0x390f71['limit']=qs[_0x6278('0x31')](_0x207018[_0x6278('0x47')]['limit']);_0x390f71['offset']=qs[_0x6278('0x2f')](_0x207018[_0x6278('0x47')][_0x6278('0x2f')]);}_0x390f71['order']=qs[_0x6278('0x4d')](_0x207018[_0x6278('0x47')]['sort']);_0x390f71[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x207018[_0x6278('0x47')],_0x52fb75[_0x6278('0x4f')]),_0xcbbcef);if(_0x207018[_0x6278('0x47')]['filter']){_0x390f71[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x390f71[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0xcbbcef,function(_0x49d7e5){if(_0x49d7e5[_0x6278('0x52')]!==_0x6278('0x53')){var _0x5318c4={};_0x5318c4[_0x49d7e5[_0x6278('0x3e')]]={'$like':'%'+_0x207018[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x5318c4;}})});}_0x390f71=_[_0x6278('0x51')]({},_0x390f71,_0x207018['options']);var _0x4b92ac={'where':_0x390f71[_0x6278('0x4e')]};return db[_0x6278('0x55')][_0x6278('0x32')](_0x4b92ac)[_0x6278('0x21')](function(_0xa334dd){_0x5c237a['count']=_0xa334dd;if(_0x207018[_0x6278('0x47')][_0x6278('0x56')]){_0x390f71[_0x6278('0x57')]=[{'all':!![]}];}return db[_0x6278('0x55')][_0x6278('0x58')](_0x390f71);})[_0x6278('0x21')](function(_0x49b54a){_0x5c237a[_0x6278('0x59')]=_0x49b54a;return _0x5c237a;})[_0x6278('0x21')](respondWithFilteredResult(_0x3d04d3,_0x390f71))[_0x6278('0x2b')](handleError(_0x3d04d3,null));};exports['show']=function(_0x917e72,_0x4ba934){var _0x144584={'raw':![],'where':{'id':_0x917e72[_0x6278('0x5a')]['id']},'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]},_0x21c53b={};_0x21c53b[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0x55')][_0x6278('0x44')]);_0x21c53b[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x917e72['query']);_0x21c53b[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x21c53b['model'],_0x21c53b['query']);_0x144584[_0x6278('0x49')]=_[_0x6278('0x4a')](_0x21c53b[_0x6278('0x48')],qs['fields'](_0x917e72[_0x6278('0x47')][_0x6278('0x4b')]));_0x144584[_0x6278('0x49')]=_0x144584[_0x6278('0x49')][_0x6278('0x5c')]?_0x144584[_0x6278('0x49')]:_0x21c53b['model'];if(_0x917e72[_0x6278('0x47')][_0x6278('0x56')]){_0x144584[_0x6278('0x57')]=[{'all':!![]}];}_0x144584=_[_0x6278('0x51')]({},_0x144584,_0x917e72[_0x6278('0x5d')]);return db[_0x6278('0x55')][_0x6278('0x5e')](_0x144584)[_0x6278('0x21')](handleEntityNotFound(_0x4ba934,null))['then'](respondWithResult(_0x4ba934,null))[_0x6278('0x2b')](handleError(_0x4ba934,null));};exports[_0x6278('0x5f')]=function(_0x53e6c7,_0x1b7856){return db[_0x6278('0x55')][_0x6278('0x5f')](_0x53e6c7[_0x6278('0x60')],{})[_0x6278('0x21')](function(_0x2f1c23){var _0x69778f=_0x53e6c7['user'][_0x6278('0x39')]({'plain':!![]});if(!_0x69778f)throw new Error(_0x6278('0x61'));if(_0x69778f[_0x6278('0x62')]===_0x6278('0x63')){var _0xba9acc=_0x2f1c23[_0x6278('0x39')]({'plain':!![]});var _0x1511b7='SmsAccounts';return db[_0x6278('0x64')]['find']({'where':{'name':_0x1511b7,'userProfileId':_0x69778f['userProfileId']},'raw':!![]})[_0x6278('0x21')](function(_0x3fb88f){if(_0x3fb88f&&_0x3fb88f['autoAssociation']===0x0){return db[_0x6278('0x3b')]['create']({'name':_0xba9acc[_0x6278('0x3e')],'resourceId':_0xba9acc['id'],'type':_0x3fb88f[_0x6278('0x3e')],'sectionId':_0x3fb88f['id']},{})[_0x6278('0x21')](function(){return _0x2f1c23;});}else{return _0x2f1c23;}})[_0x6278('0x2b')](function(_0x93e376){logger[_0x6278('0x27')](_0x6278('0x65'),_0x93e376);throw _0x93e376;});}return _0x2f1c23;})[_0x6278('0x21')](respondWithResult(_0x1b7856,0xc9))['catch'](handleError(_0x1b7856,null));};exports[_0x6278('0x37')]=function(_0x42d94f,_0x242cbd){if(_0x42d94f[_0x6278('0x60')]['id']){delete _0x42d94f[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')]['find']({'where':{'id':_0x42d94f['params']['id']},'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]})['then'](handleEntityNotFound(_0x242cbd,null))[_0x6278('0x21')](saveUpdates(_0x42d94f[_0x6278('0x60')],null))['then'](respondWithResult(_0x242cbd,null))[_0x6278('0x2b')](handleError(_0x242cbd,null));};exports['destroy']=function(_0x145132,_0x1dc694){return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x145132[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1dc694,null))['then'](removeEntity(_0x1dc694,null))[_0x6278('0x2b')](handleError(_0x1dc694,null));};exports[_0x6278('0x66')]=function(_0x265ca5,_0x459063){return db['SmsAccount'][_0x6278('0x66')]()[_0x6278('0x21')](respondWithResult(_0x459063,null))[_0x6278('0x2b')](handleError(_0x459063,null));};exports['addDisposition']=function(_0x165357,_0x427e79,_0x55b93b){if(_0x165357[_0x6278('0x60')]['id']){delete _0x165357[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x165357[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x427e79,null))['then'](function(_0x573f06){if(_0x573f06){_0x165357[_0x6278('0x60')][_0x6278('0x67')]=_0x573f06['id'];return db[_0x6278('0x68')][_0x6278('0x5f')](_0x165357[_0x6278('0x60')]);}})[_0x6278('0x21')](respondWithResult(_0x427e79,null))['catch'](handleError(_0x427e79,null));};exports[_0x6278('0x69')]=function(_0x3ba14c,_0x2ec923,_0x286de9){var _0x24d39c={'raw':![],'where':{}};var _0x5e8daa={};var _0x24ac07={'count':0x0,'rows':[]};return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x3ba14c[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ec923,null))[_0x6278('0x21')](function(_0x4287f2){if(_0x4287f2){_0x5e8daa[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0x68')][_0x6278('0x44')]);_0x5e8daa[_0x6278('0x47')]=_['keys'](_0x3ba14c[_0x6278('0x47')]);_0x5e8daa[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x5e8daa[_0x6278('0x48')],_0x5e8daa['query']);_0x24d39c['attributes']=_[_0x6278('0x4a')](_0x5e8daa[_0x6278('0x48')],qs['fields'](_0x3ba14c[_0x6278('0x47')]['fields']));_0x24d39c[_0x6278('0x49')]=_0x24d39c['attributes'][_0x6278('0x5c')]?_0x24d39c[_0x6278('0x49')]:_0x5e8daa[_0x6278('0x48')];if(!_0x3ba14c[_0x6278('0x47')]['hasOwnProperty'](_0x6278('0x6b'))){_0x24d39c[_0x6278('0x31')]=qs['limit'](_0x3ba14c['query']['limit']);_0x24d39c['offset']=qs['offset'](_0x3ba14c['query']['offset']);}_0x24d39c[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x3ba14c[_0x6278('0x47')]['sort']);_0x24d39c['where']=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x3ba14c[_0x6278('0x47')],_0x5e8daa[_0x6278('0x4f')]));_0x24d39c[_0x6278('0x4e')][_0x6278('0x67')]=_0x4287f2['id'];if(_0x3ba14c['query'][_0x6278('0x54')]){_0x24d39c[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x24d39c[_0x6278('0x4e')],{'$or':_['map'](_0x24d39c[_0x6278('0x49')],function(_0xd4b997){var _0x33a167={};_0x33a167[_0xd4b997]={'$like':'%'+_0x3ba14c[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x33a167;})});}_0x24d39c=_[_0x6278('0x51')]({},_0x24d39c,_0x3ba14c[_0x6278('0x5d')]);return db['Disposition'][_0x6278('0x32')]({'where':_0x24d39c[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x318b06){_0x24ac07[_0x6278('0x32')]=_0x318b06;if(_0x3ba14c[_0x6278('0x47')][_0x6278('0x56')]){_0x24d39c[_0x6278('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x6278('0x58')](_0x24d39c);})[_0x6278('0x21')](function(_0x4fcd9d){_0x24ac07['rows']=_0x4fcd9d;return _0x24ac07;});}})[_0x6278('0x21')](respondWithFilteredResult(_0x2ec923,_0x24d39c))[_0x6278('0x2b')](handleError(_0x2ec923,null));};exports[_0x6278('0x6d')]=function(_0x1daa5c,_0x6885e7,_0x2d3e29){return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x1daa5c[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x6885e7,null))[_0x6278('0x21')](function(_0x2701e0){if(_0x2701e0){return _0x2701e0[_0x6278('0x6d')](_0x1daa5c['query'][_0x6278('0x6e')]);}})[_0x6278('0x21')](respondWithStatusCode(_0x6885e7,null))[_0x6278('0x2b')](handleError(_0x6885e7,null));};exports[_0x6278('0x6f')]=function(_0x237bf3,_0x584f1a,_0x533af9){if(_0x237bf3[_0x6278('0x60')]['id']){delete _0x237bf3[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')]['find']({'where':{'id':_0x237bf3['params']['id']}})['then'](handleEntityNotFound(_0x584f1a,null))[_0x6278('0x21')](function(_0x42f2d3){if(_0x42f2d3){_0x237bf3[_0x6278('0x60')]['SmsAccountId']=_0x42f2d3['id'];return db[_0x6278('0x70')][_0x6278('0x5f')](_0x237bf3[_0x6278('0x60')]);}})[_0x6278('0x21')](respondWithResult(_0x584f1a,null))['catch'](handleError(_0x584f1a,null));};exports[_0x6278('0x71')]=function(_0x3598a8,_0x1eb3ba,_0x1d5442){var _0x2ef791={'raw':![],'where':{}};var _0x1016a9={};var _0x37a56c={'count':0x0,'rows':[]};return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x3598a8[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x1eb3ba,null))[_0x6278('0x21')](function(_0x41cd39){if(_0x41cd39){_0x1016a9['model']=_[_0x6278('0x5b')](db[_0x6278('0x70')][_0x6278('0x44')]);_0x1016a9[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x3598a8[_0x6278('0x47')]);_0x1016a9[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x1016a9[_0x6278('0x48')],_0x1016a9[_0x6278('0x47')]);_0x2ef791['attributes']=_[_0x6278('0x4a')](_0x1016a9[_0x6278('0x48')],qs['fields'](_0x3598a8['query']['fields']));_0x2ef791['attributes']=_0x2ef791[_0x6278('0x49')][_0x6278('0x5c')]?_0x2ef791[_0x6278('0x49')]:_0x1016a9[_0x6278('0x48')];if(!_0x3598a8['query'][_0x6278('0x4c')](_0x6278('0x6b'))){_0x2ef791[_0x6278('0x31')]=qs[_0x6278('0x31')](_0x3598a8[_0x6278('0x47')][_0x6278('0x31')]);_0x2ef791[_0x6278('0x2f')]=qs['offset'](_0x3598a8['query']['offset']);}_0x2ef791[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x3598a8['query'][_0x6278('0x4d')]);_0x2ef791[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x3598a8[_0x6278('0x47')],_0x1016a9[_0x6278('0x4f')]));_0x2ef791[_0x6278('0x4e')][_0x6278('0x67')]=_0x41cd39['id'];if(_0x3598a8['query'][_0x6278('0x54')]){_0x2ef791['where']=_[_0x6278('0x51')](_0x2ef791[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x2ef791[_0x6278('0x49')],function(_0x20fbc1){var _0x3e4b46={};_0x3e4b46[_0x20fbc1]={'$like':'%'+_0x3598a8['query'][_0x6278('0x54')]+'%'};return _0x3e4b46;})});}_0x2ef791=_['merge']({},_0x2ef791,_0x3598a8['options']);return db[_0x6278('0x70')]['count']({'where':_0x2ef791[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x5e2230){_0x37a56c[_0x6278('0x32')]=_0x5e2230;if(_0x3598a8['query'][_0x6278('0x56')]){_0x2ef791[_0x6278('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6278('0x58')](_0x2ef791);})[_0x6278('0x21')](function(_0x4b86d0){_0x37a56c[_0x6278('0x59')]=_0x4b86d0;return _0x37a56c;});}})['then'](respondWithFilteredResult(_0x1eb3ba,_0x2ef791))[_0x6278('0x2b')](handleError(_0x1eb3ba,null));};exports[_0x6278('0x72')]=function(_0x5082f3,_0x6f92b2,_0x280b47){return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x5082f3[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x6f92b2,null))['then'](function(_0x35645c){if(_0x35645c){return _0x35645c['removeAnswers'](_0x5082f3[_0x6278('0x47')][_0x6278('0x6e')]);}})[_0x6278('0x21')](respondWithStatusCode(_0x6f92b2,null))[_0x6278('0x2b')](handleError(_0x6f92b2,null));};exports[_0x6278('0x73')]=function(_0x58b65a,_0xf2ae75,_0x44b02f){var _0x5bad01={'channel':'sms'};var _0xaab5bb=[];var _0x3f842c=[];var _0x151bc9={};return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x58b65a['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x257ad3){_0x5bad01[_0x6278('0x74')]=_0x257ad3;_0x5bad01[_0x6278('0x75')]=_[_0x6278('0x76')](_0x257ad3[_0x6278('0x77')],[_0x6278('0x78')],[_0x6278('0x79')]);if(_0x5bad01[_0x6278('0x74')][_0x6278('0x77')]){delete _0x5bad01[_0x6278('0x74')]['Applications'];}return db[_0x6278('0x7a')][_0x6278('0x66')]();})[_0x6278('0x21')](function(_0x1ca536){if(!_0x1ca536){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))](_0x6278('0x7d'));}_0xaab5bb=_['difference'](_[_0x6278('0x5b')](_0x1ca536),[_0x6278('0x7e'),_0x6278('0x7f')]);_0x3f842c=_[_0x6278('0x80')](_[_0x6278('0x5b')](_0x1ca536),[_0x6278('0x7e'),_0x6278('0x7f'),_0x6278('0x81'),_0x6278('0x82')]);_0x5bad01[_0x6278('0x60')]={'mapKey':_0x6278('0x83')};if(_0x5bad01['account'][_0x6278('0x52')]){switch(_0x5bad01[_0x6278('0x74')][_0x6278('0x52')]){case _0x6278('0x84'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x86')];_0x5bad01['body'][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x87')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a[_0x6278('0x60')]['MessageSid'];break;case _0x6278('0x89'):_0x5bad01['body'][_0x6278('0x85')]='+'+_0x58b65a[_0x6278('0x60')][_0x6278('0x8a')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8b')];break;case _0x6278('0x8c'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')]['from'];_0x5bad01['body']['body']=_0x58b65a['body'][_0x6278('0x29')];break;case _0x6278('0x8d'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x85')];_0x5bad01['body'][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')]['body'];_0x5bad01['body']['messageId']=_0x58b65a[_0x6278('0x60')]['message_id'];break;case _0x6278('0x8e'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x86')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8f')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a['body'][_0x6278('0x90')];break;case'infobip':_0x5bad01[_0x6278('0x60')]['from']='+'+_0x58b65a[_0x6278('0x60')][_0x6278('0x91')][0x0]['from'];_0x5bad01[_0x6278('0x60')]['body']=_0x58b65a[_0x6278('0x60')]['results'][0x0][_0x6278('0x8b')];_0x5bad01['body']['messageId']=_0x58b65a[_0x6278('0x60')]['results'][0x0]['messageId'];break;case _0x6278('0x92'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x93')];_0x5bad01[_0x6278('0x60')]['body']=_0x58b65a['body'][_0x6278('0x94')][_0x6278('0x29')];break;case _0x6278('0x95'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')]['fromNumber'];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8b')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a['body'][_0x6278('0x96')];break;case _0x6278('0x97'):_0x5bad01[_0x6278('0x60')]['messageId']=_0x58b65a[_0x6278('0x60')][0x0]['message']['id'];_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')][0x0][_0x6278('0x29')][_0x6278('0x85')];_0x5bad01['body']['body']=_0x58b65a[_0x6278('0x60')][0x0][_0x6278('0x29')]['text'];break;case _0x6278('0x98'):_0x5bad01[_0x6278('0x60')]['from']=_0x58b65a['body'][_0x6278('0x85')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x29')];_0x5bad01[_0x6278('0x60')]['messageId']=_0x58b65a[_0x6278('0x60')][_0x6278('0x99')];break;}}if(_0x5bad01['body']['id']){delete _0x5bad01[_0x6278('0x60')]['id'];}if(_[_0x6278('0x9a')](_0x5bad01[_0x6278('0x60')][_0x6278('0x85')])){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x6278('0x9a')](_0x5bad01[_0x6278('0x60')][_0x6278('0x60')])||_0x5bad01['body'][_0x6278('0x60')]===''){throw new db[(_0x6278('0x7b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6278('0x9a')](_0x5bad01['body'][_0x6278('0x9b')])){throw new db['Sequelize'][(_0x6278('0x7c'))](_0x6278('0x9c')+_0x3f842c);}if(!_[_0x6278('0x9d')](_0x3f842c,_0x5bad01[_0x6278('0x60')]['mapKey'])){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))](_0x6278('0x9e')+_0x3f842c);}_0x151bc9[_0x5bad01[_0x6278('0x60')]['mapKey']]=_0x5bad01['body'][_0x6278('0x85')];return db['CmList'][_0x6278('0x5e')]({'where':{'id':_0x5bad01[_0x6278('0x74')][_0x6278('0x82')]},'include':[{'model':db[_0x6278('0x7a')],'as':_0x6278('0x9f'),'where':_0x151bc9,'limit':0x1,'order':[[_0x6278('0x7f'),_0x6278('0xa0')]]}]});})[_0x6278('0x21')](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x479c2d){if(_0x479c2d){_0x5bad01[_0x6278('0xa1')]=_['omit'](_0x479c2d,[_0x6278('0x9f')]);if(_0x479c2d[_0x6278('0x9f')]['length']){return _0x479c2d[_0x6278('0x9f')][0x0];}var _0x1875c0=_['defaults'](_0x5bad01[_0x6278('0x60')],{'firstName':_0x5bad01['body'][_0x6278('0x85')],'ListId':_0x479c2d['id']});_0x1875c0[_0x5bad01['body']['mapKey']]=_0x5bad01[_0x6278('0x60')][_0x6278('0x85')];return db[_0x6278('0x7a')][_0x6278('0x5f')](_0x1875c0,{'fields':_0xaab5bb,'raw':!![]});}})[_0x6278('0x21')](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x10b4ff){if(_0x10b4ff){_0x5bad01[_0x6278('0xa2')]=_0x10b4ff;var _0x7ce3e5={'ContactId':_0x10b4ff['id'],'phone':_0x5bad01[_0x6278('0x60')][_0x6278('0x85')],'SmsAccountId':_0x58b65a['params']['id']};var _0x238702={'ContactId':_0x10b4ff['id'],'SmsAccountId':_0x58b65a[_0x6278('0x5a')]['id'],'closed':![]};return db[_0x6278('0xa3')][_0x6278('0x5e')]({'where':_0x238702})[_0x6278('0x21')](function(_0xebadb8){if(_0xebadb8){return[_0xebadb8,![]];}return db[_0x6278('0xa3')][_0x6278('0x5f')](_0x7ce3e5)[_0x6278('0x21')](function(_0x206b2f){return[_0x206b2f,!![]];});});}})[_0x6278('0xa4')](function(_0x2e04d8,_0x39ede0){_0x5bad01[_0x6278('0xa5')]=_0x2e04d8[_0x6278('0x39')]({'plain':!![]});_0x5bad01[_0x6278('0xa5')][_0x6278('0xa6')]=![];if(_0x39ede0){if(_0x5bad01[_0x6278('0x74')][_0x6278('0xa7')]){_0x5bad01[_0x6278('0x75')][_0x6278('0xa8')]({'id':0x0,'priority':_0x5bad01[_0x6278('0x75')][_0x6278('0x5c')]+0x1,'app':_0x6278('0xa9'),'appdata':_0x6278('0xaa'),'interval':_0x6278('0xab')});}_0x5bad01[_0x6278('0xa5')]['created']=!![];}return db[_0x6278('0xac')][_0x6278('0x5f')]({'phone':_0x5bad01[_0x6278('0x60')][_0x6278('0x85')],'messageId':_0x5bad01[_0x6278('0x60')][_0x6278('0x88')],'body':_0x5bad01[_0x6278('0x60')][_0x6278('0x60')],'SmsAccountId':_0x58b65a[_0x6278('0x5a')]['id'],'SmsInteractionId':_0x2e04d8['id'],'direction':'in','ContactId':_0x2e04d8[_0x6278('0xad')],'AttachmentId':_0x5bad01[_0x6278('0x60')][_0x6278('0xae')]});})[_0x6278('0x21')](function(_0x409dff){_0x5bad01[_0x6278('0x29')]=_0x409dff;if(!_0x5bad01[_0x6278('0xa5')][_0x6278('0xaf')])return;return db[_0x6278('0xb0')][_0x6278('0x5e')]({'attributes':['id',_0x6278('0x3e')],'where':{'id':_0x5bad01[_0x6278('0xa5')][_0x6278('0xaf')]}});})['then'](function(_0x350d6e){if(_0x350d6e){_0x5bad01[_0x6278('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x350d6e['name']+','+(_0x5bad01[_0x6278('0x74')][_0x6278('0xb1')]||0xa),'interval':_0x6278('0xab')});}if(!_0x5bad01[_0x6278('0xa5')]['queueId'])return;return db[_0x6278('0xb2')][_0x6278('0x5e')]({'attributes':['id',_0x6278('0x3e')],'where':{'id':_0x5bad01[_0x6278('0xa5')]['queueId']}});})[_0x6278('0x21')](function(_0x32b875){if(_0x32b875){_0x5bad01[_0x6278('0x75')][_0x6278('0xb3')]({'id':0x0,'priority':0x1,'app':_0x6278('0xb4'),'appdata':_0x32b875[_0x6278('0x3e')]+','+(_0x5bad01[_0x6278('0x74')][_0x6278('0xb5')]||0x12c),'interval':_0x6278('0xab')});}return respondWithRpcPromise(_0x6278('0xb6'),_0x6278('0xb7'),_0x5bad01);})[_0x6278('0x21')](function(_0xf20321){if(_0xf20321){var _0x1cc94d=0xc8;var _0x28026b=_0x6278('0xb8');logger[_0x6278('0x22')](_0x6278('0x25'),_0x28026b,_0x1cc94d,'entity\x20found');logger[_0x6278('0xb9')](_0x6278('0xba'),_0x28026b,_0x1cc94d,_0x6278('0xbb'),JSON[_0x6278('0x26')](_0xf20321));if(_0x5bad01[_0x6278('0x74')][_0x6278('0x52')]==='twilio'){return _0xf2ae75[_0x6278('0x2d')](_0x1cc94d)[_0x6278('0x33')]('Content-Type',_0x6278('0xbc'))[_0x6278('0x3f')](_0x6278('0xbd'));}else{return _0xf2ae75[_0x6278('0x2d')](_0x1cc94d)[_0x6278('0x2e')](_0xf20321);}}})[_0x6278('0x2b')](handleError(_0xf2ae75,null));};exports[_0x6278('0xbe')]=function(_0x1e5dee,_0x442297){var _0x807c2=_0x1e5dee[_0x6278('0x5a')]['id'];var _0x307bd1=_0x1e5dee[_0x6278('0x60')];var _0x611377=0xc8;var _0x1afa77=null;return db[_0x6278('0xbf')]['transaction']({'isolationLevel':db[_0x6278('0xbf')]['Transaction'][_0x6278('0xc0')][_0x6278('0xc1')]},function(_0x42d9d5){return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x807c2},'transaction':_0x42d9d5})[_0x6278('0x21')](function(_0x380169){if(_0x380169){return db[_0x6278('0xc2')][_0x6278('0x38')]({'where':{'SmsAccountId':_0x807c2},'transaction':_0x42d9d5})['then'](function(){var _0x461061=_[_0x6278('0x43')](_0x307bd1,function(_0x2e67f9){_0x2e67f9[_0x6278('0x67')]=_0x807c2;return _0x2e67f9;});return db[_0x6278('0xc2')]['bulkCreate'](_0x461061,{'transaction':_0x42d9d5});});}else{_0x611377=0x194;_0x1afa77=[];}});})[_0x6278('0x21')](function(){if(_0x611377!==0x194){return db[_0x6278('0xc2')]['findAndCountAll']({'where':{'SmsAccountId':_0x807c2},'order':_0x6278('0x78')})[_0x6278('0x21')](function(_0x105310){_0x1afa77=_0x105310;});}})[_0x6278('0x2b')](function(_0x10f679){_0x611377=0x1f4;logger[_0x6278('0x27')](_0x10f679[_0x6278('0x3d')]);if(_0x10f679['name']){delete _0x10f679[_0x6278('0x3e')];}_0x1afa77=_0x10f679;})[_0x6278('0xc3')](function(){if(_0x1afa77===null){_0x442297[_0x6278('0x2c')](_0x611377);}else{if(_0x611377===0x1f4){_0x442297[_0x6278('0x2d')](_0x611377)[_0x6278('0x3f')](_0x1afa77);}else{_0x442297[_0x6278('0x2d')](_0x611377)[_0x6278('0x2e')](_0x1afa77);}}});};exports[_0x6278('0xc4')]=function(_0x5b441d,_0x881d6d,_0x39feb1){var _0x40c846={};var _0x594fa5={};var _0x5b4927;var _0x1a1716;return db['SmsAccount'][_0x6278('0x6a')]({'where':{'id':_0x5b441d[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x881d6d,null))['then'](function(_0x4fc1d7){if(_0x4fc1d7){_0x5b4927=_0x4fc1d7;_0x594fa5['model']=_[_0x6278('0x5b')](db[_0x6278('0xc2')][_0x6278('0x44')]);_0x594fa5[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x5b441d['query']);_0x594fa5[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x594fa5['model'],_0x594fa5[_0x6278('0x47')]);_0x40c846[_0x6278('0x49')]=_['intersection'](_0x594fa5['model'],qs[_0x6278('0x4b')](_0x5b441d[_0x6278('0x47')][_0x6278('0x4b')]));_0x40c846[_0x6278('0x49')]=_0x40c846[_0x6278('0x49')][_0x6278('0x5c')]?_0x40c846[_0x6278('0x49')]:_0x594fa5[_0x6278('0x48')];_0x40c846[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x5b441d[_0x6278('0x47')][_0x6278('0x4d')]);_0x40c846[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x5b441d[_0x6278('0x47')],_0x594fa5['filters']));if(_0x5b441d[_0x6278('0x47')][_0x6278('0x54')]){_0x40c846[_0x6278('0x4e')]=_['merge'](_0x40c846[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x40c846[_0x6278('0x49')],function(_0x5515ea){var _0x3cea72={};_0x3cea72[_0x5515ea]={'$like':'%'+_0x5b441d[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x3cea72;})});}_0x40c846=_['merge']({},_0x40c846,_0x5b441d[_0x6278('0x5d')]);return _0x5b4927[_0x6278('0xc4')](_0x40c846);}})[_0x6278('0x21')](function(_0x440f4b){if(_0x440f4b){_0x1a1716=_0x440f4b[_0x6278('0x5c')];if(!_0x5b441d[_0x6278('0x47')]['hasOwnProperty'](_0x6278('0x6b'))){_0x40c846[_0x6278('0x31')]=qs['limit'](_0x5b441d[_0x6278('0x47')]['limit']);_0x40c846['offset']=qs[_0x6278('0x2f')](_0x5b441d[_0x6278('0x47')][_0x6278('0x2f')]);}return _0x5b4927[_0x6278('0xc4')](_0x40c846);}})[_0x6278('0x21')](function(_0x260d18){if(_0x260d18){return _0x260d18?{'count':_0x1a1716,'rows':_0x260d18}:null;}})['then'](respondWithResult(_0x881d6d,null))['catch'](handleError(_0x881d6d,null));};exports['getInteractions']=function(_0x2932c0,_0x4839da,_0x4b0882){var _0x46e167={'raw':![],'where':{}};var _0x2aaa1d={};var _0x2bcc35={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6278('0x6a')]({'where':{'id':_0x2932c0[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4839da,null))[_0x6278('0x21')](function(_0x54af16){if(_0x54af16){_0x2aaa1d[_0x6278('0x48')]=_[_0x6278('0x5b')](db['SmsInteraction'][_0x6278('0x44')]);_0x2aaa1d['query']=_[_0x6278('0x5b')](_0x2932c0[_0x6278('0x47')]);_0x2aaa1d[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x2aaa1d[_0x6278('0x48')],_0x2aaa1d[_0x6278('0x47')]);_0x46e167[_0x6278('0x49')]=_['intersection'](_0x2aaa1d[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x2932c0[_0x6278('0x47')]['fields']));_0x46e167[_0x6278('0x49')]=_0x46e167[_0x6278('0x49')][_0x6278('0x5c')]?_0x46e167['attributes']:_0x2aaa1d[_0x6278('0x48')];if(!_0x2932c0[_0x6278('0x47')][_0x6278('0x4c')](_0x6278('0x6b'))){_0x46e167['limit']=qs['limit'](_0x2932c0[_0x6278('0x47')]['limit']);_0x46e167['offset']=qs[_0x6278('0x2f')](_0x2932c0[_0x6278('0x47')][_0x6278('0x2f')]);}_0x46e167[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x2932c0[_0x6278('0x47')][_0x6278('0x4d')]);_0x46e167[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x2932c0[_0x6278('0x47')],_0x2aaa1d['filters']));_0x46e167['where'][_0x6278('0x67')]=_0x54af16['id'];if(_0x2932c0[_0x6278('0x47')][_0x6278('0x54')]){_0x46e167['where']=_[_0x6278('0x51')](_0x46e167[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x46e167['attributes'],function(_0x431197){var _0x251149={};_0x251149[_0x431197]={'$like':'%'+_0x2932c0[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x251149;})});}_0x46e167=_['merge']({},_0x46e167,_0x2932c0[_0x6278('0x5d')]);return db[_0x6278('0xa3')][_0x6278('0x32')]({'where':_0x46e167[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x410ab0){_0x2bcc35[_0x6278('0x32')]=_0x410ab0;if(_0x2932c0[_0x6278('0x47')][_0x6278('0x56')]){_0x46e167[_0x6278('0x57')]=[{'model':db[_0x6278('0x7a')],'as':_0x6278('0xc5'),'required':![]},{'model':db[_0x6278('0xb0')],'as':_0x6278('0xc6'),'attributes':[_0x6278('0x3e'),_0x6278('0xc7'),_0x6278('0xc8')],'required':![]},{'model':db[_0x6278('0xc9')],'as':'Tags','attributes':['id',_0x6278('0x3e'),_0x6278('0xca')],'where':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]?{'id':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]}:undefined,'required':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x46e167);})[_0x6278('0x21')](function(_0x5ab5f4){_0x2bcc35[_0x6278('0x59')]=_0x5ab5f4;return _0x2bcc35;});}})[_0x6278('0x21')](respondWithFilteredResult(_0x4839da,_0x46e167))[_0x6278('0x2b')](handleError(_0x4839da,null));};exports[_0x6278('0x3f')]=function(_0x1b7ea6,_0x177b89,_0x2bcb56){var _0x5e5e6f,_0x3d640f,_0x47e63f;if(_[_0x6278('0x9a')](_0x1b7ea6['body']['body'])||_0x1b7ea6['body'][_0x6278('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x6278('0xcc'));}if(_[_0x6278('0x9a')](_0x1b7ea6[_0x6278('0x60')]['to'])){throw new db['Sequelize'][(_0x6278('0x7c'))](_0x6278('0xcd'));}_0x5e5e6f=_0x1b7ea6['body']['to'];return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x1b7ea6['params']['id']},'include':[{'model':db[_0x6278('0xce')],'as':_0x6278('0xcf'),'include':[{'model':db[_0x6278('0x7a')],'as':'Contacts','where':{'mobile':_0x5e5e6f},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x6278('0x21')](handleEntityNotFound(_0x177b89,null))[_0x6278('0x21')](function(_0x218ec1){if(_0x218ec1&&_0x218ec1[_0x6278('0xcf')]){_0x3d640f=_0x218ec1['get']({'plain':!![]});if(_0x3d640f[_0x6278('0xcf')]&&_0x3d640f[_0x6278('0xcf')][_0x6278('0x9f')][_0x6278('0x5c')]){return _0x3d640f[_0x6278('0xcf')][_0x6278('0x9f')][0x0];}return db[_0x6278('0x7a')][_0x6278('0x5f')](_[_0x6278('0x1a')](_0x1b7ea6[_0x6278('0x60')],{'firstName':_0x5e5e6f,'mobile':_0x5e5e6f,'phone':_0x5e5e6f,'ListId':_0x3d640f[_0x6278('0x82')]}));}})[_0x6278('0x21')](handleEntityNotFound(_0x177b89,null))[_0x6278('0x21')](function(_0x2cfffb){if(_0x2cfffb){_0x47e63f=_0x2cfffb;return db[_0x6278('0xa3')][_0x6278('0x5e')]({'where':{'ContactId':_0x47e63f['id'],'closed':![],'SmsAccountId':_0x3d640f['id']}})[_0x6278('0x21')](function(_0x2474d3){if(_0x2474d3){return[_0x2474d3,![]];}return db[_0x6278('0xa3')][_0x6278('0x5f')]({'UserId':_0x1b7ea6['user']['id'],'ContactId':_0x47e63f['id'],'SmsAccountId':_0x3d640f['id'],'phone':_0x5e5e6f,'firstMsgDirection':_0x6278('0xd0'),'Messages':[_[_0x6278('0x51')](_0x1b7ea6[_0x6278('0x60')],{'read':![],'body':_0x1b7ea6[_0x6278('0x60')][_0x6278('0x60')],'phone':_0x5e5e6f,'SmsAccountId':_0x3d640f['id'],'UserId':_0x1b7ea6[_0x6278('0x63')]['id'],'ContactId':_0x47e63f['id']})]},{'include':[{'model':db[_0x6278('0xac')],'as':'Messages'}]})[_0x6278('0x21')](function(_0x570cf9){return[_0x570cf9,!![]];});});}})[_0x6278('0xa4')](function(_0x724392,_0x20029b){if(_0x20029b){return _0x724392;}return db[_0x6278('0xac')][_0x6278('0x5f')](_[_0x6278('0x51')](_0x1b7ea6[_0x6278('0x60')],{'read':![],'body':_0x1b7ea6[_0x6278('0x60')]['body'],'phone':_0x5e5e6f,'SmsAccountId':_0x3d640f['id'],'SmsInteractionId':_0x724392['id'],'UserId':_0x1b7ea6[_0x6278('0x63')]['id'],'ContactId':_0x47e63f['id']}))[_0x6278('0x21')](function(_0x3c74e5){_0x724392[_0x6278('0xd1')][_0x6278('0xd2')]=[];_0x724392[_0x6278('0xd1')][_0x6278('0xd2')][_0x6278('0xa8')](_0x3c74e5['dataValues']);return _0x724392;});})[_0x6278('0x21')](respondWithResult(_0x177b89,null))['catch'](handleError(_0x177b89,null));};exports[_0x6278('0x2d')]=function(_0x410c1e,_0x52eba2,_0x51ba6b){if(_0x410c1e[_0x6278('0x60')]['id']){delete _0x410c1e[_0x6278('0x60')]['id'];}var _0x2897bc,_0x47e404,_0x34bf3c;return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x410c1e[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52eba2,null))[_0x6278('0x21')](function(_0x52e3b3){if(_0x52e3b3){_0x34bf3c=_0x52e3b3;logger['debug'](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0xd3'),_0x52e3b3['type'],util[_0x6278('0xd4')](_0x410c1e['body'],{'showHidden':![],'depth':null}));switch(_0x52e3b3[_0x6278('0x52')]){case _0x6278('0x89'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xd5')]&&_0x410c1e['body']['status']){_0x47e404=_0x410c1e[_0x6278('0x60')]['status'];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['skebby_dispatch_id']}});}break;case _0x6278('0x8c'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xd6')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0xd7')]){_0x47e404=_0x410c1e['body'][_0x6278('0xd7')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][_0x6278('0xd6')]}});}break;case _0x6278('0x8d'):if(_0x410c1e['body'][_0x6278('0xd8')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0xd9')]){_0x47e404=_0x410c1e['body'][_0x6278('0xd9')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['message_id']}});}break;case _0x6278('0xda'):var _0x423809=_0x410c1e[_0x6278('0x60')][_0x6278('0x91')][0x0];if(_0x423809[_0x6278('0x88')]&&_0x423809[_0x6278('0x2d')]['groupName']===_0x6278('0xdb')){_0x47e404=_0x423809[_0x6278('0x2d')][_0x6278('0xdc')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x423809['messageId']}});}break;case _0x6278('0x95'):if(_0x410c1e['body'][_0x6278('0x88')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')]){_0x47e404=_0x410c1e[_0x6278('0x60')]['status'];return db['SmsMessage'][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['messageId']}});}break;case _0x6278('0x97'):if(_0x410c1e[_0x6278('0x60')][0x0][_0x6278('0x29')]['id']){_0x47e404=_0x410c1e['body'][0x0][_0x6278('0x52')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][0x0][_0x6278('0x29')]['id']}});}break;case _0x6278('0x98'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xdd')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')]){_0x47e404=_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')];return db['SmsMessage'][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][_0x6278('0xdd')]}});}break;}}})[_0x6278('0x21')](handleEntityNotFound(_0x52eba2,null))[_0x6278('0x21')](function(_0x2f717c){if(_0x2f717c){_0x2897bc=_0x2f717c;switch(_0x34bf3c[_0x6278('0x52')]){case _0x6278('0x89'):if(_0x47e404===_0x6278('0xdb')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),'status',_0x6278('0x89'),util['inspect'](_0x410c1e['body'],{'showHidden':![],'depth':null}));}break;case _0x6278('0x8c'):if(_0x47e404==='1'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x89'),util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x8d'):if(!_0x410c1e[_0x6278('0x60')][_0x6278('0xde')]&&_0x47e404>=0xc8&&_0x47e404<=0xce){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),'clicksend',util['inspect'](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0xda'):var _0x5b0045=_0x410c1e[_0x6278('0x60')][_0x6278('0x91')][0x0];if(_0x5b0045[_0x6278('0x2d')]['groupName']===_0x6278('0xdb')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger['error'](_0x6278('0x25'),'status','infobip',util[_0x6278('0xd4')](_0x410c1e['body'],{'showHidden':![],'depth':null}));}break;case _0x6278('0x95'):if(_0x47e404=='DELIVERED_TO_GATEWAY'||_0x47e404==_0x6278('0xdf')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x95'),util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x97'):if(_0x47e404=='message-delivered'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x97'),util['inspect'](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x98'):if(_0x47e404===_0x6278('0xe0')||_0x47e404==='ACCEPTD'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6278('0x2d'),'intelepeer',util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x2897bc;}})['then'](respondWithResult(_0x52eba2,null))[_0x6278('0x2b')](handleError(_0x52eba2,null));};exports[_0x6278('0xe1')]=function(_0x55aa78,_0x57d799,_0x5cb118){var _0x1be0f8,_0x2aed98,_0x70ec05;return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x55aa78[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x57d799,null))[_0x6278('0x21')](function(_0xf64538){if(_0xf64538){_0x70ec05=_0xf64538;logger['debug'](_0x6278('0x25'),_0x6278('0x2d'),'received\x20delivery\x20report\x20from',_0xf64538[_0x6278('0x52')],util[_0x6278('0xd4')](_0x55aa78['query'],{'showHidden':![],'depth':null}));switch(_0xf64538[_0x6278('0x52')]){case _0x6278('0x92'):if(_0x55aa78[_0x6278('0x47')][_0x6278('0xe2')]&&_0x55aa78['query']['state']){_0x2aed98=_0x55aa78['query'][_0x6278('0xe3')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x55aa78[_0x6278('0x47')][_0x6278('0xe2')]}});}break;}}})[_0x6278('0x21')](handleEntityNotFound(_0x57d799,null))[_0x6278('0x21')](function(_0x33d88c){if(_0x33d88c){_0x1be0f8=_0x33d88c;switch(_0x70ec05[_0x6278('0x52')]){case'csc':if(_0x2aed98==='2'||_0x2aed98==='6'){return _0x1be0f8['update']({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),'status','csc',util['inspect'](_0x55aa78[_0x6278('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1be0f8;}})['then'](respondWithResult(_0x57d799,null))['catch'](handleError(_0x57d799,null));};exports['addAgents']=function(_0x4fb793,_0x10b2f6,_0x2336f2){return db[_0x6278('0x55')]['find']({'where':{'id':_0x4fb793[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x10b2f6,null))['then'](function(_0x4843d3){if(_0x4843d3){return _0x4843d3[_0x6278('0xe4')](_0x4fb793[_0x6278('0x60')]['ids'],_[_0x6278('0xe5')](_0x4fb793[_0x6278('0x60')],[_0x6278('0x6e'),'id'])||{})[_0x6278('0xa4')](function(_0x3cca0e){for(var _0xd95e6c=0x0;_0xd95e6c<_0x4fb793['body'][_0x6278('0x6e')]['length'];_0xd95e6c+=0x1){socket['emit'](_0x6278('0xe6'),{'UserId':Number(_0x4fb793['body'][_0x6278('0x6e')][_0xd95e6c]),'SmsAccountId':Number(_0x4fb793[_0x6278('0x5a')]['id'])});}return _0x3cca0e;});}})['then'](respondWithResult(_0x10b2f6,null))[_0x6278('0x2b')](handleError(_0x10b2f6,null));};exports[_0x6278('0xe7')]=function(_0x1cdf3d,_0x54e7d8,_0x4ec2da){return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x1cdf3d[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x54e7d8,null))[_0x6278('0x21')](function(_0x23634b){if(_0x23634b){return _0x23634b['removeAgents'](_0x1cdf3d[_0x6278('0x47')]['ids'])[_0x6278('0x21')](function(){if(_[_0x6278('0xe8')](_0x1cdf3d[_0x6278('0x47')][_0x6278('0x6e')])){for(var _0x274155=0x0;_0x274155<_0x1cdf3d['query'][_0x6278('0x6e')]['length'];_0x274155+=0x1){socket[_0x6278('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x1cdf3d['query'][_0x6278('0x6e')][_0x274155]),'SmsAccountId':Number(_0x1cdf3d[_0x6278('0x5a')]['id'])});}}else{socket[_0x6278('0xe9')](_0x6278('0xea'),{'UserId':Number(_0x1cdf3d[_0x6278('0x47')][_0x6278('0x6e')]),'SmsAccountId':Number(_0x1cdf3d[_0x6278('0x5a')]['id'])});}});}})[_0x6278('0x21')](respondWithStatusCode(_0x54e7d8,null))[_0x6278('0x2b')](handleError(_0x54e7d8,null));};exports[_0x6278('0xeb')]=function(_0x18f43e,_0x1ba7f6,_0x11e8d5){var _0x5b81fa={};var _0xb585d2={};var _0x4c1720;var _0x377233;return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x18f43e[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x1ba7f6,null))[_0x6278('0x21')](function(_0x3a0b53){if(_0x3a0b53){_0x4c1720=_0x3a0b53;_0xb585d2[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0xb0')][_0x6278('0x44')]);_0xb585d2[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x18f43e[_0x6278('0x47')]);_0xb585d2[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0xb585d2[_0x6278('0x48')],_0xb585d2[_0x6278('0x47')]);_0x5b81fa['attributes']=_[_0x6278('0x4a')](_0xb585d2[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x18f43e[_0x6278('0x47')][_0x6278('0x4b')]));_0x5b81fa[_0x6278('0x49')]=_0x5b81fa[_0x6278('0x49')]['length']?_0x5b81fa['attributes']:_0xb585d2[_0x6278('0x48')];_0x5b81fa[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x18f43e[_0x6278('0x47')][_0x6278('0x4d')]);_0x5b81fa[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x18f43e[_0x6278('0x47')],_0xb585d2[_0x6278('0x4f')]));if(_0x18f43e[_0x6278('0x47')]['filter']){_0x5b81fa[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x5b81fa[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x5b81fa[_0x6278('0x49')],function(_0x39ea85){var _0x16521b={};_0x16521b[_0x39ea85]={'$like':'%'+_0x18f43e[_0x6278('0x47')]['filter']+'%'};return _0x16521b;})});}_0x5b81fa=_[_0x6278('0x51')]({},_0x5b81fa,_0x18f43e[_0x6278('0x5d')]);return _0x4c1720[_0x6278('0xeb')](_0x5b81fa);}})[_0x6278('0x21')](function(_0x38dfb6){if(_0x38dfb6){_0x377233=_0x38dfb6[_0x6278('0x5c')];if(!_0x18f43e[_0x6278('0x47')][_0x6278('0x4c')](_0x6278('0x6b'))){_0x5b81fa['limit']=qs[_0x6278('0x31')](_0x18f43e[_0x6278('0x47')][_0x6278('0x31')]);_0x5b81fa[_0x6278('0x2f')]=qs[_0x6278('0x2f')](_0x18f43e[_0x6278('0x47')]['offset']);}return _0x4c1720[_0x6278('0xeb')](_0x5b81fa);}})[_0x6278('0x21')](function(_0x37a324){if(_0x37a324){return _0x37a324?{'count':_0x377233,'rows':_0x37a324}:null;}})[_0x6278('0x21')](respondWithResult(_0x1ba7f6,null))[_0x6278('0x2b')](handleError(_0x1ba7f6,null));}; \ No newline at end of file +var _0x9d63=['describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','MessageSid','skebby','text','connectel','clicksend','plivo','Text','infobip','results','segmentedMessage','clickatell','fromNumber','replyMessageId','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','AttachmentId','UserId','unshift','agent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','User','fullname','internal','Tag','Tags','tag','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','bandwidth','intelepeer','redif','error_code','message-delivered','csc','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','SmsAccounts','name','send','index','Pause','map','SmsAccount','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','mandatoryDispositionPause','addDisposition','SmsAccountId','Disposition','findOne','order','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact'];(function(_0x5ec0ab,_0x42940d){var _0x5bd602=function(_0x2c310b){while(--_0x2c310b){_0x5ec0ab['push'](_0x5ec0ab['shift']());}};_0x5bd602(++_0x42940d);}(_0x9d63,0x153));var _0x39d6=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x9d63[_0x1da04e];return _0xdd8c41;};'use strict';var emlformat=require(_0x39d6('0x0'));var rimraf=require(_0x39d6('0x1'));var zipdir=require(_0x39d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39d6('0x3'));var moment=require('moment');var BPromise=require(_0x39d6('0x4'));var Mustache=require(_0x39d6('0x5'));var util=require(_0x39d6('0x6'));var path=require(_0x39d6('0x7'));var sox=require(_0x39d6('0x8'));var csv=require('to-csv');var ejs=require(_0x39d6('0x9'));var fs=require('fs');var fs_extra=require(_0x39d6('0xa'));var _=require(_0x39d6('0xb'));var squel=require(_0x39d6('0xc'));var crypto=require(_0x39d6('0xd'));var jsforce=require(_0x39d6('0xe'));var deskjs=require(_0x39d6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39d6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39d6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39d6('0x12'));var logger=require(_0x39d6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x39d6('0x14'));var db=require(_0x39d6('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x39d6('0x16'),'port':0x18eb});var socket=require(_0x39d6('0x17'))(new Redis(config[_0x39d6('0x18')]));require(_0x39d6('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x39d6('0x1a')]['http']({'port':0x232c});function respondWithRpcPromise(_0x14d7db,_0x3766ed,_0x94e0cf,_0x28b097){return new BPromise(function(_0x287f45,_0x4974dc){var _0x35c0c8=_0x28b097||client;return _0x35c0c8[_0x39d6('0x1b')](_0x14d7db,_0x94e0cf)['then'](function(_0x55a90b){logger[_0x39d6('0x1c')](_0x39d6('0x1d'),_0x3766ed,_0x39d6('0x1e'));logger[_0x39d6('0x1f')](_0x39d6('0x20'),_0x3766ed,_0x39d6('0x1e'),JSON['stringify'](_0x55a90b));if(_0x55a90b[_0x39d6('0x21')]){if(_0x55a90b[_0x39d6('0x21')][_0x39d6('0x22')]===0x1f4){logger[_0x39d6('0x21')](_0x39d6('0x1d'),_0x3766ed,_0x55a90b['error'][_0x39d6('0x23')]);return _0x4974dc(_0x55a90b[_0x39d6('0x21')]['message']);}logger['error'](_0x39d6('0x1d'),_0x3766ed,_0x55a90b['error'][_0x39d6('0x23')]);return _0x287f45(_0x55a90b[_0x39d6('0x21')][_0x39d6('0x23')]);}else{logger['info'](_0x39d6('0x1d'),_0x3766ed,_0x39d6('0x1e'));_0x287f45(_0x55a90b[_0x39d6('0x24')]['message']);}})['catch'](function(_0x62c2d6){logger[_0x39d6('0x21')]('SmsAccount,\x20%s,\x20%s',_0x3766ed,_0x62c2d6);_0x4974dc(_0x62c2d6);});});}function respondWithStatusCode(_0x19ef64,_0x59eb73){_0x59eb73=_0x59eb73||0xcc;return function(_0xd579b1){if(_0xd579b1){return _0x19ef64[_0x39d6('0x25')](_0x59eb73);}return _0x19ef64[_0x39d6('0x26')](_0x59eb73)[_0x39d6('0x27')]();};}function respondWithResult(_0x23809c,_0x4fee87){_0x4fee87=_0x4fee87||0xc8;return function(_0x23948b){if(_0x23948b){return _0x23809c[_0x39d6('0x26')](_0x4fee87)[_0x39d6('0x28')](_0x23948b);}};}function respondWithFilteredResult(_0x51d76c,_0x13f9be){return function(_0x44c755){if(_0x44c755){var _0x5e5932=typeof _0x13f9be[_0x39d6('0x29')]===_0x39d6('0x2a')&&typeof _0x13f9be['limit']==='undefined';var _0x3ccb4b=_0x44c755[_0x39d6('0x2b')];var _0x4cdd09=_0x5e5932?0x0:_0x13f9be[_0x39d6('0x29')];var _0x244cae=_0x5e5932?_0x44c755[_0x39d6('0x2b')]:_0x13f9be[_0x39d6('0x29')]+_0x13f9be['limit'];var _0x33850d;if(_0x244cae>=_0x3ccb4b){_0x244cae=_0x3ccb4b;_0x33850d=0xc8;}else{_0x33850d=0xce;}_0x51d76c[_0x39d6('0x26')](_0x33850d);return _0x51d76c[_0x39d6('0x2c')](_0x39d6('0x2d'),_0x4cdd09+'-'+_0x244cae+'/'+_0x3ccb4b)[_0x39d6('0x28')](_0x44c755);}return null;};}function patchUpdates(_0x308d42){return function(_0x2bed5c){try{jsonpatch[_0x39d6('0x2e')](_0x2bed5c,_0x308d42,!![]);}catch(_0x5e508f){return BPromise[_0x39d6('0x2f')](_0x5e508f);}return _0x2bed5c[_0x39d6('0x30')]();};}function saveUpdates(_0x1be2ca,_0x10a8d9){return function(_0x431294){if(_0x431294){return _0x431294['update'](_0x1be2ca)[_0x39d6('0x31')](function(_0x530365){return _0x530365;});}return null;};}function removeEntity(_0xa949bd,_0x2de754){return function(_0xf91e47){if(_0xf91e47){return _0xf91e47[_0x39d6('0x32')]()[_0x39d6('0x31')](function(){var _0x1fafff=_0xf91e47[_0x39d6('0x33')]({'plain':!![]});var _0x19531c=_0x39d6('0x34');return db['UserProfileResource'][_0x39d6('0x32')]({'where':{'type':_0x19531c,'resourceId':_0x1fafff['id']}})[_0x39d6('0x31')](function(){return _0xf91e47;});})[_0x39d6('0x31')](function(){_0xa949bd['status'](0xcc)[_0x39d6('0x27')]();});}};}function handleEntityNotFound(_0x2777ad,_0x1d7095){return function(_0x2c8679){if(!_0x2c8679){_0x2777ad[_0x39d6('0x25')](0x194);}return _0x2c8679;};}function handleError(_0x1994fa,_0x446ccc){_0x446ccc=_0x446ccc||0x1f4;return function(_0x291586){logger[_0x39d6('0x21')](_0x291586['stack']);if(_0x291586[_0x39d6('0x35')]){delete _0x291586['name'];}_0x1994fa[_0x39d6('0x26')](_0x446ccc)[_0x39d6('0x36')](_0x291586);};}exports[_0x39d6('0x37')]=function(_0xb19839,_0x8e15c8){var _0x1ba933={'include':[{'model':db[_0x39d6('0x38')],'as':'mandatoryDispositionPause'}]},_0x4e4269={},_0x243acb={'count':0x0,'rows':[]};var _0x56516e=_[_0x39d6('0x39')](db[_0x39d6('0x3a')]['rawAttributes'],function(_0xb0548){return{'name':_0xb0548['fieldName'],'type':_0xb0548[_0x39d6('0x3b')][_0x39d6('0x3c')]};});_0x4e4269[_0x39d6('0x3d')]=_[_0x39d6('0x39')](_0x56516e,'name');_0x4e4269[_0x39d6('0x3e')]=_[_0x39d6('0x3f')](_0xb19839[_0x39d6('0x3e')]);_0x4e4269['filters']=_[_0x39d6('0x40')](_0x4e4269[_0x39d6('0x3d')],_0x4e4269[_0x39d6('0x3e')]);_0x1ba933['attributes']=_['intersection'](_0x4e4269['model'],qs[_0x39d6('0x41')](_0xb19839[_0x39d6('0x3e')][_0x39d6('0x41')]));_0x1ba933[_0x39d6('0x42')]=_0x1ba933[_0x39d6('0x42')][_0x39d6('0x43')]?_0x1ba933[_0x39d6('0x42')]:_0x4e4269[_0x39d6('0x3d')];if(!_0xb19839[_0x39d6('0x3e')][_0x39d6('0x44')](_0x39d6('0x45'))){_0x1ba933[_0x39d6('0x46')]=qs[_0x39d6('0x46')](_0xb19839['query'][_0x39d6('0x46')]);_0x1ba933[_0x39d6('0x29')]=qs[_0x39d6('0x29')](_0xb19839[_0x39d6('0x3e')][_0x39d6('0x29')]);}_0x1ba933['order']=qs[_0x39d6('0x47')](_0xb19839[_0x39d6('0x3e')][_0x39d6('0x47')]);_0x1ba933[_0x39d6('0x48')]=qs[_0x39d6('0x49')](_[_0x39d6('0x4a')](_0xb19839[_0x39d6('0x3e')],_0x4e4269[_0x39d6('0x49')]),_0x56516e);if(_0xb19839['query']['filter']){_0x1ba933['where']=_[_0x39d6('0x4b')](_0x1ba933['where'],{'$or':_[_0x39d6('0x39')](_0x56516e,function(_0x331ae3){if(_0x331ae3[_0x39d6('0x3b')]!==_0x39d6('0x4c')){var _0x2eaa09={};_0x2eaa09[_0x331ae3['name']]={'$like':'%'+_0xb19839[_0x39d6('0x3e')]['filter']+'%'};return _0x2eaa09;}})});}_0x1ba933=_[_0x39d6('0x4b')]({},_0x1ba933,_0xb19839[_0x39d6('0x4d')]);var _0x5d00d6={'where':_0x1ba933[_0x39d6('0x48')]};return db[_0x39d6('0x3a')]['count'](_0x5d00d6)[_0x39d6('0x31')](function(_0x16f63e){_0x243acb[_0x39d6('0x2b')]=_0x16f63e;if(_0xb19839[_0x39d6('0x3e')][_0x39d6('0x4e')]){_0x1ba933['include']=[{'all':!![]}];}return db['SmsAccount'][_0x39d6('0x4f')](_0x1ba933);})[_0x39d6('0x31')](function(_0x3089ca){_0x243acb['rows']=_0x3089ca;return _0x243acb;})[_0x39d6('0x31')](respondWithFilteredResult(_0x8e15c8,_0x1ba933))['catch'](handleError(_0x8e15c8,null));};exports[_0x39d6('0x50')]=function(_0x4e05d1,_0x3296f4){var _0x2e0724={'raw':![],'where':{'id':_0x4e05d1[_0x39d6('0x51')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2bb257={};_0x2bb257[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0x3a')][_0x39d6('0x52')]);_0x2bb257[_0x39d6('0x3e')]=_[_0x39d6('0x3f')](_0x4e05d1[_0x39d6('0x3e')]);_0x2bb257[_0x39d6('0x49')]=_['intersection'](_0x2bb257['model'],_0x2bb257[_0x39d6('0x3e')]);_0x2e0724[_0x39d6('0x42')]=_['intersection'](_0x2bb257[_0x39d6('0x3d')],qs[_0x39d6('0x41')](_0x4e05d1[_0x39d6('0x3e')][_0x39d6('0x41')]));_0x2e0724[_0x39d6('0x42')]=_0x2e0724[_0x39d6('0x42')][_0x39d6('0x43')]?_0x2e0724[_0x39d6('0x42')]:_0x2bb257[_0x39d6('0x3d')];if(_0x4e05d1['query'][_0x39d6('0x4e')]){_0x2e0724[_0x39d6('0x53')]=[{'all':!![]}];}_0x2e0724=_[_0x39d6('0x4b')]({},_0x2e0724,_0x4e05d1['options']);return db[_0x39d6('0x3a')]['find'](_0x2e0724)['then'](handleEntityNotFound(_0x3296f4,null))['then'](respondWithResult(_0x3296f4,null))[_0x39d6('0x54')](handleError(_0x3296f4,null));};exports[_0x39d6('0x55')]=function(_0x16bcf5,_0x4a0755){return db[_0x39d6('0x3a')][_0x39d6('0x55')](_0x16bcf5['body'],{})[_0x39d6('0x31')](function(_0x122351){var _0x1c312b=_0x16bcf5[_0x39d6('0x56')]['get']({'plain':!![]});if(!_0x1c312b)throw new Error(_0x39d6('0x57'));if(_0x1c312b[_0x39d6('0x58')]===_0x39d6('0x56')){var _0x22e3a1=_0x122351[_0x39d6('0x33')]({'plain':!![]});var _0xd88445=_0x39d6('0x34');return db[_0x39d6('0x59')]['find']({'where':{'name':_0xd88445,'userProfileId':_0x1c312b[_0x39d6('0x5a')]},'raw':!![]})[_0x39d6('0x31')](function(_0x1b3f93){if(_0x1b3f93&&_0x1b3f93[_0x39d6('0x5b')]===0x0){return db[_0x39d6('0x5c')][_0x39d6('0x55')]({'name':_0x22e3a1['name'],'resourceId':_0x22e3a1['id'],'type':_0x1b3f93[_0x39d6('0x35')],'sectionId':_0x1b3f93['id']},{})['then'](function(){return _0x122351;});}else{return _0x122351;}})[_0x39d6('0x54')](function(_0x304f19){logger[_0x39d6('0x21')](_0x39d6('0x5d'),_0x304f19);throw _0x304f19;});}return _0x122351;})['then'](respondWithResult(_0x4a0755,0xc9))[_0x39d6('0x54')](handleError(_0x4a0755,null));};exports[_0x39d6('0x5e')]=function(_0x231b79,_0x513855){if(_0x231b79[_0x39d6('0x5f')]['id']){delete _0x231b79[_0x39d6('0x5f')]['id'];}return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x231b79[_0x39d6('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x39d6('0x61')}]})['then'](handleEntityNotFound(_0x513855,null))[_0x39d6('0x31')](saveUpdates(_0x231b79[_0x39d6('0x5f')],null))[_0x39d6('0x31')](respondWithResult(_0x513855,null))[_0x39d6('0x54')](handleError(_0x513855,null));};exports[_0x39d6('0x32')]=function(_0xfb4714,_0x13b0ef){return db['SmsAccount'][_0x39d6('0x60')]({'where':{'id':_0xfb4714[_0x39d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x13b0ef,null))['then'](removeEntity(_0x13b0ef,null))['catch'](handleError(_0x13b0ef,null));};exports['describe']=function(_0x4d3227,_0x2515eb){return db[_0x39d6('0x3a')]['describe']()[_0x39d6('0x31')](respondWithResult(_0x2515eb,null))['catch'](handleError(_0x2515eb,null));};exports[_0x39d6('0x62')]=function(_0x26951a,_0x2a6b79,_0x4aeda1){if(_0x26951a[_0x39d6('0x5f')]['id']){delete _0x26951a[_0x39d6('0x5f')]['id'];}return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x26951a['params']['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x2a6b79,null))[_0x39d6('0x31')](function(_0x158014){if(_0x158014){_0x26951a[_0x39d6('0x5f')][_0x39d6('0x63')]=_0x158014['id'];return db[_0x39d6('0x64')]['create'](_0x26951a[_0x39d6('0x5f')]);}})[_0x39d6('0x31')](respondWithResult(_0x2a6b79,null))[_0x39d6('0x54')](handleError(_0x2a6b79,null));};exports['getDispositions']=function(_0x40053e,_0x553239,_0x2879c8){var _0x328f60={'raw':![],'where':{}};var _0x272c20={};var _0x111c6c={'count':0x0,'rows':[]};return db[_0x39d6('0x3a')][_0x39d6('0x65')]({'where':{'id':_0x40053e['params']['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x553239,null))['then'](function(_0x4dbc5f){if(_0x4dbc5f){_0x272c20[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0x64')][_0x39d6('0x52')]);_0x272c20[_0x39d6('0x3e')]=_['keys'](_0x40053e[_0x39d6('0x3e')]);_0x272c20[_0x39d6('0x49')]=_[_0x39d6('0x40')](_0x272c20[_0x39d6('0x3d')],_0x272c20[_0x39d6('0x3e')]);_0x328f60[_0x39d6('0x42')]=_[_0x39d6('0x40')](_0x272c20[_0x39d6('0x3d')],qs['fields'](_0x40053e[_0x39d6('0x3e')][_0x39d6('0x41')]));_0x328f60['attributes']=_0x328f60['attributes']['length']?_0x328f60[_0x39d6('0x42')]:_0x272c20[_0x39d6('0x3d')];if(!_0x40053e[_0x39d6('0x3e')][_0x39d6('0x44')]('nolimit')){_0x328f60[_0x39d6('0x46')]=qs[_0x39d6('0x46')](_0x40053e[_0x39d6('0x3e')][_0x39d6('0x46')]);_0x328f60[_0x39d6('0x29')]=qs['offset'](_0x40053e[_0x39d6('0x3e')][_0x39d6('0x29')]);}_0x328f60[_0x39d6('0x66')]=qs[_0x39d6('0x47')](_0x40053e[_0x39d6('0x3e')][_0x39d6('0x47')]);_0x328f60['where']=qs[_0x39d6('0x49')](_[_0x39d6('0x4a')](_0x40053e[_0x39d6('0x3e')],_0x272c20[_0x39d6('0x49')]));_0x328f60[_0x39d6('0x48')]['SmsAccountId']=_0x4dbc5f['id'];if(_0x40053e[_0x39d6('0x3e')][_0x39d6('0x67')]){_0x328f60[_0x39d6('0x48')]=_[_0x39d6('0x4b')](_0x328f60['where'],{'$or':_[_0x39d6('0x39')](_0x328f60[_0x39d6('0x42')],function(_0x2768a5){var _0x27a7c9={};_0x27a7c9[_0x2768a5]={'$like':'%'+_0x40053e['query'][_0x39d6('0x67')]+'%'};return _0x27a7c9;})});}_0x328f60=_['merge']({},_0x328f60,_0x40053e[_0x39d6('0x4d')]);return db['Disposition'][_0x39d6('0x2b')]({'where':_0x328f60[_0x39d6('0x48')]})[_0x39d6('0x31')](function(_0x110419){_0x111c6c['count']=_0x110419;if(_0x40053e[_0x39d6('0x3e')][_0x39d6('0x4e')]){_0x328f60[_0x39d6('0x53')]=[{'all':!![]}];}return db[_0x39d6('0x64')][_0x39d6('0x4f')](_0x328f60);})[_0x39d6('0x31')](function(_0xd0368d){_0x111c6c['rows']=_0xd0368d;return _0x111c6c;});}})[_0x39d6('0x31')](respondWithFilteredResult(_0x553239,_0x328f60))[_0x39d6('0x54')](handleError(_0x553239,null));};exports[_0x39d6('0x68')]=function(_0x4aac2c,_0x54b8dc,_0x3c316b){return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x4aac2c[_0x39d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x54b8dc,null))[_0x39d6('0x31')](function(_0x4311ae){if(_0x4311ae){return _0x4311ae['removeDispositions'](_0x4aac2c[_0x39d6('0x3e')][_0x39d6('0x69')]);}})[_0x39d6('0x31')](respondWithStatusCode(_0x54b8dc,null))[_0x39d6('0x54')](handleError(_0x54b8dc,null));};exports[_0x39d6('0x6a')]=function(_0x7824b2,_0x2253ad,_0x909875){if(_0x7824b2[_0x39d6('0x5f')]['id']){delete _0x7824b2[_0x39d6('0x5f')]['id'];}return db[_0x39d6('0x3a')]['find']({'where':{'id':_0x7824b2[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x2253ad,null))['then'](function(_0x21cd2d){if(_0x21cd2d){_0x7824b2[_0x39d6('0x5f')]['SmsAccountId']=_0x21cd2d['id'];return db['CannedAnswer'][_0x39d6('0x55')](_0x7824b2[_0x39d6('0x5f')]);}})[_0x39d6('0x31')](respondWithResult(_0x2253ad,null))['catch'](handleError(_0x2253ad,null));};exports[_0x39d6('0x6b')]=function(_0x3b6b9f,_0x120093,_0x49b9d3){var _0x70e8fa={'raw':![],'where':{}};var _0x14c104={};var _0x13bb19={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x3b6b9f[_0x39d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x120093,null))[_0x39d6('0x31')](function(_0x5e2405){if(_0x5e2405){_0x14c104[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0x6c')][_0x39d6('0x52')]);_0x14c104['query']=_[_0x39d6('0x3f')](_0x3b6b9f[_0x39d6('0x3e')]);_0x14c104[_0x39d6('0x49')]=_[_0x39d6('0x40')](_0x14c104[_0x39d6('0x3d')],_0x14c104[_0x39d6('0x3e')]);_0x70e8fa[_0x39d6('0x42')]=_[_0x39d6('0x40')](_0x14c104[_0x39d6('0x3d')],qs[_0x39d6('0x41')](_0x3b6b9f['query'][_0x39d6('0x41')]));_0x70e8fa['attributes']=_0x70e8fa['attributes'][_0x39d6('0x43')]?_0x70e8fa[_0x39d6('0x42')]:_0x14c104['model'];if(!_0x3b6b9f[_0x39d6('0x3e')]['hasOwnProperty'](_0x39d6('0x45'))){_0x70e8fa[_0x39d6('0x46')]=qs[_0x39d6('0x46')](_0x3b6b9f['query'][_0x39d6('0x46')]);_0x70e8fa[_0x39d6('0x29')]=qs[_0x39d6('0x29')](_0x3b6b9f['query'][_0x39d6('0x29')]);}_0x70e8fa[_0x39d6('0x66')]=qs[_0x39d6('0x47')](_0x3b6b9f[_0x39d6('0x3e')][_0x39d6('0x47')]);_0x70e8fa['where']=qs['filters'](_['pick'](_0x3b6b9f[_0x39d6('0x3e')],_0x14c104[_0x39d6('0x49')]));_0x70e8fa[_0x39d6('0x48')][_0x39d6('0x63')]=_0x5e2405['id'];if(_0x3b6b9f[_0x39d6('0x3e')]['filter']){_0x70e8fa['where']=_[_0x39d6('0x4b')](_0x70e8fa['where'],{'$or':_['map'](_0x70e8fa[_0x39d6('0x42')],function(_0x52cf45){var _0x34e919={};_0x34e919[_0x52cf45]={'$like':'%'+_0x3b6b9f['query'][_0x39d6('0x67')]+'%'};return _0x34e919;})});}_0x70e8fa=_[_0x39d6('0x4b')]({},_0x70e8fa,_0x3b6b9f[_0x39d6('0x4d')]);return db[_0x39d6('0x6c')][_0x39d6('0x2b')]({'where':_0x70e8fa[_0x39d6('0x48')]})[_0x39d6('0x31')](function(_0x5a99ac){_0x13bb19['count']=_0x5a99ac;if(_0x3b6b9f[_0x39d6('0x3e')]['includeAll']){_0x70e8fa['include']=[{'all':!![]}];}return db[_0x39d6('0x6c')][_0x39d6('0x4f')](_0x70e8fa);})[_0x39d6('0x31')](function(_0x25d044){_0x13bb19[_0x39d6('0x6d')]=_0x25d044;return _0x13bb19;});}})[_0x39d6('0x31')](respondWithFilteredResult(_0x120093,_0x70e8fa))['catch'](handleError(_0x120093,null));};exports['removeAnswers']=function(_0x27d64e,_0x5796fc,_0x211729){return db['SmsAccount'][_0x39d6('0x60')]({'where':{'id':_0x27d64e[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x5796fc,null))['then'](function(_0xd084d5){if(_0xd084d5){return _0xd084d5[_0x39d6('0x6e')](_0x27d64e[_0x39d6('0x3e')][_0x39d6('0x69')]);}})[_0x39d6('0x31')](respondWithStatusCode(_0x5796fc,null))[_0x39d6('0x54')](handleError(_0x5796fc,null));};exports[_0x39d6('0x6f')]=function(_0x5432a3,_0x20094c,_0x437bef){var _0x21c724={'channel':_0x39d6('0x70')};var _0x37fd3d=[];var _0x4a8ecc=[];var _0x2b7d41={};return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x5432a3[_0x39d6('0x51')]['id']},'include':[{'model':db[_0x39d6('0x71')],'as':_0x39d6('0x72')}]})[_0x39d6('0x31')](handleEntityNotFound(_0x20094c,null))[_0x39d6('0x31')](function(_0x3cf7e2){_0x21c724['account']=_0x3cf7e2;_0x21c724[_0x39d6('0x73')]=_[_0x39d6('0x74')](_0x3cf7e2[_0x39d6('0x72')],[_0x39d6('0x75')],[_0x39d6('0x76')]);if(_0x21c724['account'][_0x39d6('0x72')]){delete _0x21c724[_0x39d6('0x77')][_0x39d6('0x72')];}return db[_0x39d6('0x78')][_0x39d6('0x79')]();})['then'](function(_0x48aac9){if(!_0x48aac9){throw new db[(_0x39d6('0x7a'))][(_0x39d6('0x7b'))](_0x39d6('0x7c'));}_0x37fd3d=_[_0x39d6('0x7d')](_[_0x39d6('0x3f')](_0x48aac9),['createdAt','updatedAt']);_0x4a8ecc=_[_0x39d6('0x7d')](_[_0x39d6('0x3f')](_0x48aac9),[_0x39d6('0x7e'),_0x39d6('0x7f'),_0x39d6('0x80'),_0x39d6('0x81')]);_0x21c724[_0x39d6('0x5f')]={'mapKey':_0x39d6('0x82')};if(_0x21c724[_0x39d6('0x77')][_0x39d6('0x3b')]){switch(_0x21c724['account'][_0x39d6('0x3b')]){case'twilio':_0x21c724['body'][_0x39d6('0x83')]=_0x5432a3['body'][_0x39d6('0x84')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3['body']['Body'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x85')]=_0x5432a3['body'][_0x39d6('0x86')];break;case _0x39d6('0x87'):_0x21c724['body'][_0x39d6('0x83')]='+'+_0x5432a3['body']['sender'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3['body'][_0x39d6('0x88')];break;case _0x39d6('0x89'):_0x21c724['body'][_0x39d6('0x83')]=_0x5432a3['body'][_0x39d6('0x83')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x23')];break;case _0x39d6('0x8a'):_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')]=_0x5432a3[_0x39d6('0x5f')]['from'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3['body'][_0x39d6('0x5f')];_0x21c724[_0x39d6('0x5f')]['messageId']=_0x5432a3[_0x39d6('0x5f')]['message_id'];break;case _0x39d6('0x8b'):_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')]=_0x5432a3[_0x39d6('0x5f')]['From'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x8c')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x85')]=_0x5432a3[_0x39d6('0x5f')]['MessageUUID'];break;case _0x39d6('0x8d'):_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')]='+'+_0x5432a3['body'][_0x39d6('0x8e')][0x0]['from'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x8e')][0x0][_0x39d6('0x88')];_0x21c724[_0x39d6('0x5f')]['messageId']=_0x5432a3['body']['results'][0x0][_0x39d6('0x85')];break;case'csc':_0x21c724[_0x39d6('0x5f')]['from']=_0x5432a3[_0x39d6('0x5f')]['originatingAddress'];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x8f')][_0x39d6('0x23')];break;case _0x39d6('0x90'):_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x91')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x88')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x85')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x92')];break;case'bandwidth':_0x21c724[_0x39d6('0x5f')]['messageId']=_0x5432a3[_0x39d6('0x5f')][0x0][_0x39d6('0x23')]['id'];_0x21c724['body'][_0x39d6('0x83')]=_0x5432a3[_0x39d6('0x5f')][0x0][_0x39d6('0x23')]['from'];_0x21c724[_0x39d6('0x5f')]['body']=_0x5432a3['body'][0x0][_0x39d6('0x23')][_0x39d6('0x88')];break;case'intelepeer':_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')]=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x83')];_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]=_0x5432a3['body']['message'];_0x21c724[_0x39d6('0x5f')]['messageId']=_0x5432a3[_0x39d6('0x5f')][_0x39d6('0x93')];break;}}if(_0x21c724[_0x39d6('0x5f')]['id']){delete _0x21c724[_0x39d6('0x5f')]['id'];}if(_['isNil'](_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')])){throw new db[(_0x39d6('0x7a'))][(_0x39d6('0x7b'))](_0x39d6('0x94'));}if(_[_0x39d6('0x95')](_0x21c724['body'][_0x39d6('0x5f')])||_0x21c724[_0x39d6('0x5f')][_0x39d6('0x5f')]===''){throw new db['Sequelize'][(_0x39d6('0x7b'))](_0x39d6('0x96'));}if(_[_0x39d6('0x95')](_0x21c724[_0x39d6('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0x39d6('0x7b'))](_0x39d6('0x97')+_0x4a8ecc);}if(!_[_0x39d6('0x98')](_0x4a8ecc,_0x21c724[_0x39d6('0x5f')]['mapKey'])){throw new db[(_0x39d6('0x7a'))][(_0x39d6('0x7b'))](_0x39d6('0x99')+_0x4a8ecc);}_0x2b7d41[_0x21c724['body'][_0x39d6('0x9a')]]=_0x21c724[_0x39d6('0x5f')]['from'];return db[_0x39d6('0x9b')][_0x39d6('0x60')]({'where':{'id':_0x21c724[_0x39d6('0x77')][_0x39d6('0x81')]},'include':[{'model':db[_0x39d6('0x78')],'as':_0x39d6('0x9c'),'where':_0x2b7d41,'limit':0x1,'order':[[_0x39d6('0x7f'),'DESC']]}]});})[_0x39d6('0x31')](handleEntityNotFound(_0x20094c,null))[_0x39d6('0x31')](function(_0x21fffa){if(_0x21fffa){_0x21c724['list']=_[_0x39d6('0x9d')](_0x21fffa,['Contacts']);if(_0x21fffa['Contacts'][_0x39d6('0x43')]){return _0x21fffa[_0x39d6('0x9c')][0x0];}var _0x14689d=_[_0x39d6('0x9e')](_0x21c724[_0x39d6('0x5f')],{'firstName':_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')],'ListId':_0x21fffa['id']});_0x14689d[_0x21c724['body'][_0x39d6('0x9a')]]=_0x21c724[_0x39d6('0x5f')]['from'];return db[_0x39d6('0x78')][_0x39d6('0x55')](_0x14689d,{'fields':_0x37fd3d,'raw':!![]});}})[_0x39d6('0x31')](handleEntityNotFound(_0x20094c,null))[_0x39d6('0x31')](function(_0x372a3f){if(_0x372a3f){_0x21c724[_0x39d6('0x9f')]=_0x372a3f;var _0x3f0c8a={'ContactId':_0x372a3f['id'],'phone':_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')],'SmsAccountId':_0x5432a3['params']['id']};var _0x5415b2={'ContactId':_0x372a3f['id'],'SmsAccountId':_0x5432a3['params']['id'],'closed':![]};return db['SmsInteraction'][_0x39d6('0x60')]({'where':_0x5415b2})['then'](function(_0xe05fb4){if(_0xe05fb4){return[_0xe05fb4,![]];}return db[_0x39d6('0xa0')][_0x39d6('0x55')](_0x3f0c8a)[_0x39d6('0x31')](function(_0x41f05b){return[_0x41f05b,!![]];});});}})[_0x39d6('0xa1')](function(_0x124096,_0x119c1a){_0x21c724[_0x39d6('0xa2')]=_0x124096[_0x39d6('0x33')]({'plain':!![]});_0x21c724['interaction'][_0x39d6('0xa3')]=![];if(_0x119c1a){if(_0x21c724['account'][_0x39d6('0xa4')]){_0x21c724['applications'][_0x39d6('0xa5')]({'id':0x0,'priority':_0x21c724['applications'][_0x39d6('0x43')]+0x1,'app':_0x39d6('0xa6'),'appdata':'unmanaged','interval':_0x39d6('0xa7')});}_0x21c724['interaction'][_0x39d6('0xa3')]=!![];}return db[_0x39d6('0xa8')][_0x39d6('0x55')]({'phone':_0x21c724[_0x39d6('0x5f')][_0x39d6('0x83')],'messageId':_0x21c724[_0x39d6('0x5f')][_0x39d6('0x85')],'body':_0x21c724[_0x39d6('0x5f')]['body'],'SmsAccountId':_0x5432a3[_0x39d6('0x51')]['id'],'SmsInteractionId':_0x124096['id'],'direction':'in','ContactId':_0x124096['ContactId'],'AttachmentId':_0x21c724['body'][_0x39d6('0xa9')]});})[_0x39d6('0x31')](function(_0x548bc0){_0x21c724[_0x39d6('0x23')]=_0x548bc0;if(!_0x21c724[_0x39d6('0xa2')][_0x39d6('0xaa')])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x21c724[_0x39d6('0xa2')]['UserId']}});})[_0x39d6('0x31')](function(_0x2795b0){if(_0x2795b0){_0x21c724[_0x39d6('0x73')][_0x39d6('0xab')]({'id':0x0,'priority':0x0,'app':_0x39d6('0xac'),'appdata':_0x2795b0[_0x39d6('0x35')]+','+(_0x21c724['account']['waitForTheAssignedAgent']||0xa),'interval':_0x39d6('0xa7')});}if(!_0x21c724[_0x39d6('0xa2')][_0x39d6('0xad')])return;return db[_0x39d6('0xae')]['find']({'attributes':['id',_0x39d6('0x35')],'where':{'id':_0x21c724[_0x39d6('0xa2')][_0x39d6('0xad')]}});})[_0x39d6('0x31')](function(_0x1ed270){if(_0x1ed270){_0x21c724[_0x39d6('0x73')][_0x39d6('0xab')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1ed270[_0x39d6('0x35')]+','+(_0x21c724['account'][_0x39d6('0xaf')]||0x12c),'interval':_0x39d6('0xa7')});}return respondWithRpcPromise(_0x39d6('0xb0'),_0x39d6('0xb1'),_0x21c724);})[_0x39d6('0x31')](function(_0x6d67fc){if(_0x6d67fc){var _0x21ab27=0xc8;var _0xddc0af=_0x39d6('0xb2');logger[_0x39d6('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xddc0af,_0x21ab27,_0x39d6('0xb3'));logger[_0x39d6('0x1f')](_0x39d6('0xb4'),_0xddc0af,_0x21ab27,_0x39d6('0xb3'),JSON['stringify'](_0x6d67fc));if(_0x21c724[_0x39d6('0x77')][_0x39d6('0x3b')]===_0x39d6('0xb5')){return _0x20094c['status'](_0x21ab27)[_0x39d6('0x2c')](_0x39d6('0xb6'),_0x39d6('0xb7'))['send'](_0x39d6('0xb8'));}else{return _0x20094c[_0x39d6('0x26')](_0x21ab27)['json'](_0x6d67fc);}}})['catch'](handleError(_0x20094c,null));};exports[_0x39d6('0xb9')]=function(_0x536427,_0x9a0677){var _0x1a964c=_0x536427[_0x39d6('0x51')]['id'];var _0x1b2834=_0x536427[_0x39d6('0x5f')];var _0x33fc33=0xc8;var _0xc814e8=null;return db[_0x39d6('0xba')][_0x39d6('0xbb')]({'isolationLevel':db[_0x39d6('0xba')][_0x39d6('0xbc')][_0x39d6('0xbd')][_0x39d6('0xbe')]},function(_0x40dfd3){return db[_0x39d6('0x3a')][_0x39d6('0x65')]({'where':{'id':_0x1a964c},'transaction':_0x40dfd3})[_0x39d6('0x31')](function(_0x3e7ad6){if(_0x3e7ad6){return db[_0x39d6('0x71')][_0x39d6('0x32')]({'where':{'SmsAccountId':_0x1a964c},'transaction':_0x40dfd3})['then'](function(){var _0xfb5039=_['map'](_0x1b2834,function(_0x487a85){_0x487a85[_0x39d6('0x63')]=_0x1a964c;return _0x487a85;});return db[_0x39d6('0x71')][_0x39d6('0xbf')](_0xfb5039,{'transaction':_0x40dfd3});});}else{_0x33fc33=0x194;_0xc814e8=[];}});})[_0x39d6('0x31')](function(){if(_0x33fc33!==0x194){return db[_0x39d6('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x1a964c},'order':_0x39d6('0x75')})[_0x39d6('0x31')](function(_0x16179d){_0xc814e8=_0x16179d;});}})[_0x39d6('0x54')](function(_0x1566bd){_0x33fc33=0x1f4;logger[_0x39d6('0x21')](_0x1566bd[_0x39d6('0xc0')]);if(_0x1566bd['name']){delete _0x1566bd[_0x39d6('0x35')];}_0xc814e8=_0x1566bd;})[_0x39d6('0xc1')](function(){if(_0xc814e8===null){_0x9a0677[_0x39d6('0x25')](_0x33fc33);}else{if(_0x33fc33===0x1f4){_0x9a0677[_0x39d6('0x26')](_0x33fc33)['send'](_0xc814e8);}else{_0x9a0677[_0x39d6('0x26')](_0x33fc33)['json'](_0xc814e8);}}});};exports['getApplications']=function(_0x8cdc94,_0x5d0724,_0x2c80df){var _0x1cc86d={};var _0x5d04c2={};var _0x534001;var _0x1ee053;return db[_0x39d6('0x3a')]['findOne']({'where':{'id':_0x8cdc94['params']['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x5d0724,null))['then'](function(_0x2de1b4){if(_0x2de1b4){_0x534001=_0x2de1b4;_0x5d04c2[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0x71')][_0x39d6('0x52')]);_0x5d04c2[_0x39d6('0x3e')]=_[_0x39d6('0x3f')](_0x8cdc94['query']);_0x5d04c2['filters']=_['intersection'](_0x5d04c2[_0x39d6('0x3d')],_0x5d04c2[_0x39d6('0x3e')]);_0x1cc86d[_0x39d6('0x42')]=_[_0x39d6('0x40')](_0x5d04c2[_0x39d6('0x3d')],qs['fields'](_0x8cdc94[_0x39d6('0x3e')]['fields']));_0x1cc86d['attributes']=_0x1cc86d[_0x39d6('0x42')][_0x39d6('0x43')]?_0x1cc86d[_0x39d6('0x42')]:_0x5d04c2[_0x39d6('0x3d')];_0x1cc86d[_0x39d6('0x66')]=qs['sort'](_0x8cdc94[_0x39d6('0x3e')]['sort']);_0x1cc86d[_0x39d6('0x48')]=qs[_0x39d6('0x49')](_[_0x39d6('0x4a')](_0x8cdc94['query'],_0x5d04c2['filters']));if(_0x8cdc94['query'][_0x39d6('0x67')]){_0x1cc86d[_0x39d6('0x48')]=_['merge'](_0x1cc86d[_0x39d6('0x48')],{'$or':_[_0x39d6('0x39')](_0x1cc86d[_0x39d6('0x42')],function(_0x525f43){var _0x3f0d58={};_0x3f0d58[_0x525f43]={'$like':'%'+_0x8cdc94[_0x39d6('0x3e')][_0x39d6('0x67')]+'%'};return _0x3f0d58;})});}_0x1cc86d=_[_0x39d6('0x4b')]({},_0x1cc86d,_0x8cdc94[_0x39d6('0x4d')]);return _0x534001[_0x39d6('0xc2')](_0x1cc86d);}})[_0x39d6('0x31')](function(_0x1c878d){if(_0x1c878d){_0x1ee053=_0x1c878d[_0x39d6('0x43')];if(!_0x8cdc94[_0x39d6('0x3e')][_0x39d6('0x44')](_0x39d6('0x45'))){_0x1cc86d['limit']=qs[_0x39d6('0x46')](_0x8cdc94[_0x39d6('0x3e')][_0x39d6('0x46')]);_0x1cc86d[_0x39d6('0x29')]=qs[_0x39d6('0x29')](_0x8cdc94[_0x39d6('0x3e')][_0x39d6('0x29')]);}return _0x534001[_0x39d6('0xc2')](_0x1cc86d);}})[_0x39d6('0x31')](function(_0x37b2c8){if(_0x37b2c8){return _0x37b2c8?{'count':_0x1ee053,'rows':_0x37b2c8}:null;}})[_0x39d6('0x31')](respondWithResult(_0x5d0724,null))[_0x39d6('0x54')](handleError(_0x5d0724,null));};exports[_0x39d6('0xc3')]=function(_0x47a898,_0x1e667e,_0x5bfcdb){var _0x59012c={'raw':![],'where':{}};var _0x477b53={};var _0x227f1d={'count':0x0,'rows':[]};return db[_0x39d6('0x3a')][_0x39d6('0x65')]({'where':{'id':_0x47a898[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x1e667e,null))['then'](function(_0x2c5d7b){if(_0x2c5d7b){_0x477b53[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0xa0')]['rawAttributes']);_0x477b53['query']=_[_0x39d6('0x3f')](_0x47a898[_0x39d6('0x3e')]);_0x477b53['filters']=_['intersection'](_0x477b53[_0x39d6('0x3d')],_0x477b53[_0x39d6('0x3e')]);_0x59012c[_0x39d6('0x42')]=_['intersection'](_0x477b53[_0x39d6('0x3d')],qs[_0x39d6('0x41')](_0x47a898['query'][_0x39d6('0x41')]));_0x59012c[_0x39d6('0x42')]=_0x59012c['attributes'][_0x39d6('0x43')]?_0x59012c[_0x39d6('0x42')]:_0x477b53[_0x39d6('0x3d')];if(!_0x47a898['query'][_0x39d6('0x44')]('nolimit')){_0x59012c[_0x39d6('0x46')]=qs[_0x39d6('0x46')](_0x47a898['query'][_0x39d6('0x46')]);_0x59012c[_0x39d6('0x29')]=qs[_0x39d6('0x29')](_0x47a898[_0x39d6('0x3e')][_0x39d6('0x29')]);}_0x59012c[_0x39d6('0x66')]=qs[_0x39d6('0x47')](_0x47a898[_0x39d6('0x3e')][_0x39d6('0x47')]);_0x59012c[_0x39d6('0x48')]=qs['filters'](_[_0x39d6('0x4a')](_0x47a898[_0x39d6('0x3e')],_0x477b53['filters']));_0x59012c[_0x39d6('0x48')][_0x39d6('0x63')]=_0x2c5d7b['id'];if(_0x47a898[_0x39d6('0x3e')][_0x39d6('0x67')]){_0x59012c['where']=_['merge'](_0x59012c[_0x39d6('0x48')],{'$or':_['map'](_0x59012c[_0x39d6('0x42')],function(_0x2b9282){var _0x1aa430={};_0x1aa430[_0x2b9282]={'$like':'%'+_0x47a898[_0x39d6('0x3e')][_0x39d6('0x67')]+'%'};return _0x1aa430;})});}_0x59012c=_['merge']({},_0x59012c,_0x47a898[_0x39d6('0x4d')]);return db[_0x39d6('0xa0')]['count']({'where':_0x59012c['where']})['then'](function(_0x3417fc){_0x227f1d[_0x39d6('0x2b')]=_0x3417fc;if(_0x47a898[_0x39d6('0x3e')]['includeAll']){_0x59012c['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x39d6('0xc4')],'as':'Owner','attributes':[_0x39d6('0x35'),_0x39d6('0xc5'),_0x39d6('0xc6')],'required':![]},{'model':db[_0x39d6('0xc7')],'as':_0x39d6('0xc8'),'attributes':['id',_0x39d6('0x35'),'color'],'where':_0x47a898[_0x39d6('0x3e')]['tag']?{'id':_0x47a898[_0x39d6('0x3e')][_0x39d6('0xc9')]}:undefined,'required':_0x47a898[_0x39d6('0x3e')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x39d6('0x4f')](_0x59012c);})[_0x39d6('0x31')](function(_0x3c6ec5){_0x227f1d['rows']=_0x3c6ec5;return _0x227f1d;});}})[_0x39d6('0x31')](respondWithFilteredResult(_0x1e667e,_0x59012c))[_0x39d6('0x54')](handleError(_0x1e667e,null));};exports[_0x39d6('0x36')]=function(_0x255bf9,_0x3a560b,_0xd25498){var _0x2877a0,_0x2e6751,_0x49bd96;if(_[_0x39d6('0x95')](_0x255bf9[_0x39d6('0x5f')]['body'])||_0x255bf9['body'][_0x39d6('0x5f')]===''){throw new db['Sequelize']['ValidationError'](_0x39d6('0x96'));}if(_[_0x39d6('0x95')](_0x255bf9[_0x39d6('0x5f')]['to'])){throw new db[(_0x39d6('0x7a'))][(_0x39d6('0x7b'))]('to\x20is\x20mandatory');}_0x2877a0=_0x255bf9[_0x39d6('0x5f')]['to'];return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x255bf9[_0x39d6('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x39d6('0xca'),'include':[{'model':db[_0x39d6('0x78')],'as':_0x39d6('0x9c'),'where':{'mobile':_0x2877a0},'limit':0x1,'order':[[_0x39d6('0x7f'),_0x39d6('0xcb')]]}]}]})[_0x39d6('0x31')](handleEntityNotFound(_0x3a560b,null))['then'](function(_0x1edfbb){if(_0x1edfbb&&_0x1edfbb[_0x39d6('0xca')]){_0x2e6751=_0x1edfbb[_0x39d6('0x33')]({'plain':!![]});if(_0x2e6751[_0x39d6('0xca')]&&_0x2e6751[_0x39d6('0xca')][_0x39d6('0x9c')][_0x39d6('0x43')]){return _0x2e6751[_0x39d6('0xca')][_0x39d6('0x9c')][0x0];}return db['CmContact']['create'](_[_0x39d6('0x9e')](_0x255bf9[_0x39d6('0x5f')],{'firstName':_0x2877a0,'mobile':_0x2877a0,'phone':_0x2877a0,'ListId':_0x2e6751[_0x39d6('0x81')]}));}})[_0x39d6('0x31')](handleEntityNotFound(_0x3a560b,null))[_0x39d6('0x31')](function(_0x728664){if(_0x728664){_0x49bd96=_0x728664;return db[_0x39d6('0xa0')][_0x39d6('0x60')]({'where':{'ContactId':_0x49bd96['id'],'closed':![],'SmsAccountId':_0x2e6751['id']}})['then'](function(_0x507ec9){if(_0x507ec9){return[_0x507ec9,![]];}return db[_0x39d6('0xa0')]['create']({'UserId':_0x255bf9[_0x39d6('0x56')]['id'],'ContactId':_0x49bd96['id'],'SmsAccountId':_0x2e6751['id'],'phone':_0x2877a0,'firstMsgDirection':_0x39d6('0xcc'),'Messages':[_[_0x39d6('0x4b')](_0x255bf9[_0x39d6('0x5f')],{'read':![],'body':_0x255bf9['body'][_0x39d6('0x5f')],'phone':_0x2877a0,'SmsAccountId':_0x2e6751['id'],'UserId':_0x255bf9['user']['id'],'ContactId':_0x49bd96['id']})]},{'include':[{'model':db[_0x39d6('0xa8')],'as':_0x39d6('0xcd')}]})[_0x39d6('0x31')](function(_0x9a2ac6){return[_0x9a2ac6,!![]];});});}})['spread'](function(_0x1b6a08,_0x1369c2){if(_0x1369c2){return _0x1b6a08;}return db['SmsMessage']['create'](_['merge'](_0x255bf9[_0x39d6('0x5f')],{'read':![],'body':_0x255bf9[_0x39d6('0x5f')]['body'],'phone':_0x2877a0,'SmsAccountId':_0x2e6751['id'],'SmsInteractionId':_0x1b6a08['id'],'UserId':_0x255bf9[_0x39d6('0x56')]['id'],'ContactId':_0x49bd96['id']}))['then'](function(_0x331f2c){_0x1b6a08[_0x39d6('0xce')]['Messages']=[];_0x1b6a08['dataValues'][_0x39d6('0xcd')][_0x39d6('0xa5')](_0x331f2c[_0x39d6('0xce')]);return _0x1b6a08;});})[_0x39d6('0x31')](respondWithResult(_0x3a560b,null))['catch'](handleError(_0x3a560b,null));};exports['status']=function(_0x399b84,_0x5750ff,_0xe92b85){if(_0x399b84[_0x39d6('0x5f')]['id']){delete _0x399b84[_0x39d6('0x5f')]['id'];}var _0x1f64c8,_0x1b0768,_0x54d4da;return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x399b84['params']['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x5750ff,null))[_0x39d6('0x31')](function(_0x4bb830){if(_0x4bb830){_0x54d4da=_0x4bb830;logger[_0x39d6('0x1f')](_0x39d6('0x20'),_0x39d6('0x26'),_0x39d6('0xcf'),_0x4bb830['type'],util[_0x39d6('0xd0')](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));switch(_0x4bb830[_0x39d6('0x3b')]){case'skebby':if(_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd1')]&&_0x399b84[_0x39d6('0x5f')][_0x39d6('0x26')]){_0x1b0768=_0x399b84['body'][_0x39d6('0x26')];return db[_0x39d6('0xa8')]['find']({'where':{'messageId':_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd1')]}});}break;case _0x39d6('0x89'):if(_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd2')]&&_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd3')]){_0x1b0768=_0x399b84[_0x39d6('0x5f')]['statusInt'];return db[_0x39d6('0xa8')][_0x39d6('0x60')]({'where':{'messageId':_0x399b84[_0x39d6('0x5f')]['requestid']}});}break;case'clicksend':if(_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd4')]&&_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd5')]){_0x1b0768=_0x399b84[_0x39d6('0x5f')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x399b84[_0x39d6('0x5f')][_0x39d6('0xd4')]}});}break;case _0x39d6('0x8d'):var _0x45a445=_0x399b84[_0x39d6('0x5f')][_0x39d6('0x8e')][0x0];if(_0x45a445[_0x39d6('0x85')]&&_0x45a445[_0x39d6('0x26')][_0x39d6('0xd6')]===_0x39d6('0xd7')){_0x1b0768=_0x45a445[_0x39d6('0x26')][_0x39d6('0xd6')];return db[_0x39d6('0xa8')][_0x39d6('0x60')]({'where':{'messageId':_0x45a445[_0x39d6('0x85')]}});}break;case _0x39d6('0x90'):if(_0x399b84[_0x39d6('0x5f')][_0x39d6('0x85')]&&_0x399b84['body'][_0x39d6('0x26')]){_0x1b0768=_0x399b84[_0x39d6('0x5f')][_0x39d6('0x26')];return db[_0x39d6('0xa8')][_0x39d6('0x60')]({'where':{'messageId':_0x399b84[_0x39d6('0x5f')][_0x39d6('0x85')]}});}break;case _0x39d6('0xd8'):if(_0x399b84['body'][0x0][_0x39d6('0x23')]['id']){_0x1b0768=_0x399b84['body'][0x0]['type'];return db[_0x39d6('0xa8')][_0x39d6('0x60')]({'where':{'messageId':_0x399b84[_0x39d6('0x5f')][0x0][_0x39d6('0x23')]['id']}});}break;case _0x39d6('0xd9'):if(_0x399b84[_0x39d6('0x5f')][_0x39d6('0xda')]&&_0x399b84['body'][_0x39d6('0x26')]){_0x1b0768=_0x399b84['body'][_0x39d6('0x26')];return db[_0x39d6('0xa8')]['find']({'where':{'messageId':_0x399b84['body'][_0x39d6('0xda')]}});}break;}}})[_0x39d6('0x31')](handleEntityNotFound(_0x5750ff,null))[_0x39d6('0x31')](function(_0x461a53){if(_0x461a53){_0x1f64c8=_0x461a53;switch(_0x54d4da['type']){case'skebby':if(_0x1b0768===_0x39d6('0xd7')){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger[_0x39d6('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x39d6('0x87'),util[_0x39d6('0xd0')](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1b0768==='1'){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger['error'](_0x39d6('0x20'),'status',_0x39d6('0x87'),util[_0x39d6('0xd0')](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x39d6('0x8a'):if(!_0x399b84[_0x39d6('0x5f')][_0x39d6('0xdb')]&&_0x1b0768>=0xc8&&_0x1b0768<=0xce){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger[_0x39d6('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x39d6('0x8a'),util['inspect'](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x39d6('0x8d'):var _0x1a3310=_0x399b84['body'][_0x39d6('0x8e')][0x0];if(_0x1a3310[_0x39d6('0x26')][_0x39d6('0xd6')]===_0x39d6('0xd7')){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger['error'](_0x39d6('0x20'),_0x39d6('0x26'),_0x39d6('0x8d'),util[_0x39d6('0xd0')](_0x399b84['body'],{'showHidden':![],'depth':null}));}break;case _0x39d6('0x90'):if(_0x1b0768=='DELIVERED_TO_GATEWAY'||_0x1b0768=='RECEIVED_BY_RECIPIENT'){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger[_0x39d6('0x21')](_0x39d6('0x20'),'status',_0x39d6('0x90'),util[_0x39d6('0xd0')](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1b0768==_0x39d6('0xdc')){return _0x1f64c8['update']({'read':!![]});}else{logger['error'](_0x39d6('0x20'),_0x39d6('0x26'),_0x39d6('0xd8'),util[_0x39d6('0xd0')](_0x399b84[_0x39d6('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1b0768==='DELIVRD'||_0x1b0768==='ACCEPTD'){return _0x1f64c8[_0x39d6('0x5e')]({'read':!![]});}else{logger[_0x39d6('0x21')](_0x39d6('0x20'),_0x39d6('0x26'),_0x39d6('0xd9'),util[_0x39d6('0xd0')](_0x399b84['body'],{'showHidden':![],'depth':null}));}break;}return _0x1f64c8;}})[_0x39d6('0x31')](respondWithResult(_0x5750ff,null))['catch'](handleError(_0x5750ff,null));};exports['statusGet']=function(_0x467a61,_0x1acdfa,_0x2b6595){var _0x37e756,_0x2fcae1,_0x1dda69;return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x467a61[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x1acdfa,null))[_0x39d6('0x31')](function(_0x5c015b){if(_0x5c015b){_0x1dda69=_0x5c015b;logger[_0x39d6('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39d6('0x26'),_0x39d6('0xcf'),_0x5c015b[_0x39d6('0x3b')],util['inspect'](_0x467a61[_0x39d6('0x3e')],{'showHidden':![],'depth':null}));switch(_0x5c015b['type']){case _0x39d6('0xdd'):if(_0x467a61[_0x39d6('0x3e')][_0x39d6('0xde')]&&_0x467a61[_0x39d6('0x3e')]['state']){_0x2fcae1=_0x467a61['query'][_0x39d6('0xdf')];return db['SmsMessage'][_0x39d6('0x60')]({'where':{'messageId':_0x467a61[_0x39d6('0x3e')][_0x39d6('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x1acdfa,null))[_0x39d6('0x31')](function(_0x3e910c){if(_0x3e910c){_0x37e756=_0x3e910c;switch(_0x1dda69[_0x39d6('0x3b')]){case _0x39d6('0xdd'):if(_0x2fcae1==='2'||_0x2fcae1==='6'){return _0x37e756['update']({'read':!![]});}else{logger[_0x39d6('0x21')](_0x39d6('0x20'),_0x39d6('0x26'),_0x39d6('0xdd'),util['inspect'](_0x467a61[_0x39d6('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x37e756;}})['then'](respondWithResult(_0x1acdfa,null))[_0x39d6('0x54')](handleError(_0x1acdfa,null));};exports[_0x39d6('0xe0')]=function(_0x463f1e,_0x11910a,_0x56a2f0){return db[_0x39d6('0x3a')]['find']({'where':{'id':_0x463f1e['params']['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x11910a,null))[_0x39d6('0x31')](function(_0xd07b01){if(_0xd07b01){return _0xd07b01['addAgents'](_0x463f1e[_0x39d6('0x5f')][_0x39d6('0x69')],_[_0x39d6('0x9d')](_0x463f1e['body'],[_0x39d6('0x69'),'id'])||{})[_0x39d6('0xa1')](function(_0x5ebc09){for(var _0x27cfad=0x0;_0x27cfad<_0x463f1e[_0x39d6('0x5f')][_0x39d6('0x69')][_0x39d6('0x43')];_0x27cfad+=0x1){socket[_0x39d6('0xe1')]('userSmsAccount:save',{'UserId':Number(_0x463f1e['body'][_0x39d6('0x69')][_0x27cfad]),'SmsAccountId':Number(_0x463f1e[_0x39d6('0x51')]['id'])});}return _0x5ebc09;});}})['then'](respondWithResult(_0x11910a,null))[_0x39d6('0x54')](handleError(_0x11910a,null));};exports['removeAgents']=function(_0x5ae27e,_0x173a50,_0x50264){return db[_0x39d6('0x3a')][_0x39d6('0x60')]({'where':{'id':_0x5ae27e[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x173a50,null))['then'](function(_0x130f46){if(_0x130f46){return _0x130f46[_0x39d6('0xe2')](_0x5ae27e[_0x39d6('0x3e')]['ids'])['then'](function(){if(_[_0x39d6('0xe3')](_0x5ae27e[_0x39d6('0x3e')][_0x39d6('0x69')])){for(var _0x2cf018=0x0;_0x2cf018<_0x5ae27e[_0x39d6('0x3e')]['ids'][_0x39d6('0x43')];_0x2cf018+=0x1){socket[_0x39d6('0xe1')](_0x39d6('0xe4'),{'UserId':Number(_0x5ae27e[_0x39d6('0x3e')][_0x39d6('0x69')][_0x2cf018]),'SmsAccountId':Number(_0x5ae27e[_0x39d6('0x51')]['id'])});}}else{socket[_0x39d6('0xe1')](_0x39d6('0xe4'),{'UserId':Number(_0x5ae27e[_0x39d6('0x3e')][_0x39d6('0x69')]),'SmsAccountId':Number(_0x5ae27e[_0x39d6('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x173a50,null))['catch'](handleError(_0x173a50,null));};exports[_0x39d6('0xe5')]=function(_0x700e64,_0x43dfaf,_0x2442b7){var _0x5c96bd={};var _0x2c617e={};var _0x25b14f;var _0x2b5d90;return db['SmsAccount'][_0x39d6('0x65')]({'where':{'id':_0x700e64[_0x39d6('0x51')]['id']}})[_0x39d6('0x31')](handleEntityNotFound(_0x43dfaf,null))[_0x39d6('0x31')](function(_0x152f05){if(_0x152f05){_0x25b14f=_0x152f05;_0x2c617e[_0x39d6('0x3d')]=_[_0x39d6('0x3f')](db[_0x39d6('0xc4')][_0x39d6('0x52')]);_0x2c617e['query']=_[_0x39d6('0x3f')](_0x700e64['query']);_0x2c617e[_0x39d6('0x49')]=_[_0x39d6('0x40')](_0x2c617e[_0x39d6('0x3d')],_0x2c617e['query']);_0x5c96bd['attributes']=_[_0x39d6('0x40')](_0x2c617e[_0x39d6('0x3d')],qs[_0x39d6('0x41')](_0x700e64[_0x39d6('0x3e')]['fields']));_0x5c96bd['attributes']=_0x5c96bd[_0x39d6('0x42')]['length']?_0x5c96bd[_0x39d6('0x42')]:_0x2c617e[_0x39d6('0x3d')];_0x5c96bd['order']=qs[_0x39d6('0x47')](_0x700e64[_0x39d6('0x3e')][_0x39d6('0x47')]);_0x5c96bd['where']=qs[_0x39d6('0x49')](_[_0x39d6('0x4a')](_0x700e64[_0x39d6('0x3e')],_0x2c617e[_0x39d6('0x49')]));if(_0x700e64[_0x39d6('0x3e')][_0x39d6('0x67')]){_0x5c96bd[_0x39d6('0x48')]=_[_0x39d6('0x4b')](_0x5c96bd[_0x39d6('0x48')],{'$or':_['map'](_0x5c96bd[_0x39d6('0x42')],function(_0x395197){var _0x58470e={};_0x58470e[_0x395197]={'$like':'%'+_0x700e64[_0x39d6('0x3e')][_0x39d6('0x67')]+'%'};return _0x58470e;})});}_0x5c96bd=_[_0x39d6('0x4b')]({},_0x5c96bd,_0x700e64[_0x39d6('0x4d')]);return _0x25b14f['getAgents'](_0x5c96bd);}})['then'](function(_0xed2016){if(_0xed2016){_0x2b5d90=_0xed2016['length'];if(!_0x700e64[_0x39d6('0x3e')]['hasOwnProperty']('nolimit')){_0x5c96bd[_0x39d6('0x46')]=qs['limit'](_0x700e64[_0x39d6('0x3e')][_0x39d6('0x46')]);_0x5c96bd[_0x39d6('0x29')]=qs['offset'](_0x700e64[_0x39d6('0x3e')]['offset']);}return _0x25b14f['getAgents'](_0x5c96bd);}})[_0x39d6('0x31')](function(_0x4b347f){if(_0x4b347f){return _0x4b347f?{'count':_0x2b5d90,'rows':_0x4b347f}:null;}})['then'](respondWithResult(_0x43dfaf,null))[_0x39d6('0x54')](handleError(_0x43dfaf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ec28445..6524fe2 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 _0xbb5e=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xbb5e,0x1e7));var _0xebb5=function(_0x1eed93,_0x177a48){_0x1eed93=_0x1eed93-0x0;var _0x5ab049=_0xbb5e[_0x1eed93];return _0x5ab049;};'use strict';var EventEmitter=require(_0xebb5('0x0'));var SmsAccount=require(_0xebb5('0x1'))['db'][_0xebb5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xebb5('0x3')](0x0);var events={'afterCreate':_0xebb5('0x4'),'afterUpdate':_0xebb5('0x5'),'afterDestroy':_0xebb5('0x6')};function emitEvent(_0x9652ce){return function(_0x4e9f7e,_0x5662ec,_0x192b9a){SmsAccountEvents[_0xebb5('0x7')](_0x9652ce+':'+_0x4e9f7e['id'],_0x4e9f7e);SmsAccountEvents['emit'](_0x9652ce,_0x4e9f7e);_0x192b9a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xebb5('0x8')](e,emitEvent(event));}}module[_0xebb5('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x1f95=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit'];(function(_0x22a289,_0x148765){var _0x37d881=function(_0x17db28){while(--_0x17db28){_0x22a289['push'](_0x22a289['shift']());}};_0x37d881(++_0x148765);}(_0x1f95,0xd0));var _0x51f9=function(_0x22ce50,_0x54dbea){_0x22ce50=_0x22ce50-0x0;var _0x4bdfa3=_0x1f95[_0x22ce50];return _0x4bdfa3;};'use strict';var EventEmitter=require(_0x51f9('0x0'));var SmsAccount=require(_0x51f9('0x1'))['db'][_0x51f9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x51f9('0x3')](0x0);var events={'afterCreate':_0x51f9('0x4'),'afterUpdate':_0x51f9('0x5'),'afterDestroy':_0x51f9('0x6')};function emitEvent(_0x42d6f3){return function(_0x24345b,_0x51d3f8,_0x57d0d2){SmsAccountEvents['emit'](_0x42d6f3+':'+_0x24345b['id'],_0x24345b);SmsAccountEvents[_0x51f9('0x7')](_0x42d6f3,_0x24345b);_0x57d0d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x51f9('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 92de0b8..299e606 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 _0xd314=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x1bd5e6,_0xa7c02c){var _0xc6af09=function(_0x5ac750){while(--_0x5ac750){_0x1bd5e6['push'](_0x1bd5e6['shift']());}};_0xc6af09(++_0xa7c02c);}(_0xd314,0x9a));var _0x4d31=function(_0x3e4ff5,_0x135929){_0x3e4ff5=_0x3e4ff5-0x0;var _0x5e793e=_0xd314[_0x3e4ff5];return _0x5e793e;};'use strict';var _=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var logger=require(_0x4d31('0x2'))('api');var moment=require(_0x4d31('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d31('0x5'));var config=require(_0x4d31('0x6'));var attributes=require(_0x4d31('0x7'));module[_0x4d31('0x8')]=function(_0x32b901,_0x1eb188){return _0x32b901[_0x4d31('0x9')](_0x4d31('0xa'),attributes,{'tableName':_0x4d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5125=['path','rimraf','./smsAccount.attributes','exports','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5125,0x1db));var _0x5512=function(_0x48afb3,_0x1e78b6){_0x48afb3=_0x48afb3-0x0;var _0x5a58d6=_0x5125[_0x48afb3];return _0x5a58d6;};'use strict';var _=require(_0x5512('0x0'));var util=require('util');var logger=require(_0x5512('0x1'))(_0x5512('0x2'));var moment=require('moment');var BPromise=require(_0x5512('0x3'));var rp=require(_0x5512('0x4'));var fs=require('fs');var path=require(_0x5512('0x5'));var rimraf=require(_0x5512('0x6'));var config=require('../../config/environment');var attributes=require(_0x5512('0x7'));module[_0x5512('0x8')]=function(_0x6f738c,_0x42c2d9){return _0x6f738c[_0x5512('0x9')]('SmsAccount',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 ee22dd4..48790f7 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 _0xf559=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model'];(function(_0x31bbbf,_0x19e84a){var _0x5d6a77=function(_0x2f5874){while(--_0x2f5874){_0x31bbbf['push'](_0x31bbbf['shift']());}};_0x5d6a77(++_0x19e84a);}(_0xf559,0xa0));var _0x9f55=function(_0x223207,_0x522af9){_0x223207=_0x223207-0x0;var _0x433997=_0xf559[_0x223207];return _0x433997;};'use strict';var _=require(_0x9f55('0x0'));var util=require(_0x9f55('0x1'));var moment=require(_0x9f55('0x2'));var BPromise=require(_0x9f55('0x3'));var rs=require(_0x9f55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9f55('0x5'));var logger=require(_0x9f55('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f55('0x7'));var client=jayson[_0x9f55('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9f55('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f55('0xa'))(new Redis(config[_0x9f55('0x9')]));require(_0x9f55('0xb'))[_0x9f55('0xc')](socket);function respondWithRpcPromise(_0x564783,_0x2be4f5,_0x263137){return new BPromise(function(_0x5a4d2e,_0x83da68){return client[_0x9f55('0xd')](_0x564783,_0x263137)[_0x9f55('0xe')](function(_0x52b7bc){logger[_0x9f55('0xf')]('SmsAccount,\x20%s,\x20%s',_0x2be4f5,'request\x20sent');logger[_0x9f55('0x10')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2be4f5,_0x9f55('0x11'),JSON[_0x9f55('0x12')](_0x52b7bc));if(_0x52b7bc[_0x9f55('0x13')]){if(_0x52b7bc[_0x9f55('0x13')]['code']===0x1f4){logger[_0x9f55('0x13')](_0x9f55('0x14'),_0x2be4f5,_0x52b7bc[_0x9f55('0x13')][_0x9f55('0x15')]);return _0x83da68(_0x52b7bc['error'][_0x9f55('0x15')]);}logger['error'](_0x9f55('0x14'),_0x2be4f5,_0x52b7bc[_0x9f55('0x13')][_0x9f55('0x15')]);return _0x5a4d2e(_0x52b7bc[_0x9f55('0x13')]['message']);}else{logger[_0x9f55('0xf')](_0x9f55('0x14'),_0x2be4f5,_0x9f55('0x11'));_0x5a4d2e(_0x52b7bc[_0x9f55('0x16')][_0x9f55('0x15')]);}})[_0x9f55('0x17')](function(_0x19b5ae){logger[_0x9f55('0x13')](_0x9f55('0x14'),_0x2be4f5,_0x19b5ae);_0x83da68(_0x19b5ae);});});}exports[_0x9f55('0x18')]=function(_0x4a2167){var _0x40e005=this;return new Promise(function(_0x250d40,_0x50fe24){return db[_0x9f55('0x19')]['find']({'raw':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1b')]||null:null,'attributes':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1c')]||null:null,'include':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167['options'][_0x9f55('0x1d')]?_['map'](_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1d')],function(_0x54617f){return{'model':db[_0x54617f['model']],'as':_0x54617f['as'],'attributes':_0x54617f['attributes'],'include':_0x54617f['include']?_[_0x9f55('0x1e')](_0x54617f[_0x9f55('0x1d')],function(_0x57cc42){return{'model':db[_0x57cc42[_0x9f55('0x1f')]],'as':_0x57cc42['as'],'attributes':_0x57cc42[_0x9f55('0x1c')],'include':_0x57cc42[_0x9f55('0x1d')]?_[_0x9f55('0x1e')](_0x57cc42[_0x9f55('0x1d')],function(_0x379b85){return{'model':db[_0x379b85[_0x9f55('0x1f')]],'as':_0x379b85['as'],'attributes':_0x379b85[_0x9f55('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a2888){logger[_0x9f55('0xf')]('ShowSmsAccount',_0x4a2167);logger[_0x9f55('0x10')]('ShowSmsAccount',_0x4a2167,JSON[_0x9f55('0x12')](_0x2a2888));_0x250d40(_0x2a2888);})[_0x9f55('0x17')](function(_0xc4eee7){logger[_0x9f55('0x13')](_0x9f55('0x18'),_0xc4eee7['message'],_0x4a2167);_0x50fe24(_0x40e005[_0x9f55('0x13')](0x1f4,_0xc4eee7[_0x9f55('0x15')]));});});}; \ No newline at end of file +var _0x03c4=['map','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','ShowSmsAccount','find','options','where','attributes','include'];(function(_0xab9d30,_0x188a37){var _0x5b9ea8=function(_0x1cec03){while(--_0x1cec03){_0xab9d30['push'](_0xab9d30['shift']());}};_0x5b9ea8(++_0x188a37);}(_0x03c4,0xf8));var _0x403c=function(_0x30a339,_0x15699d){_0x30a339=_0x30a339-0x0;var _0x312b8a=_0x03c4[_0x30a339];return _0x312b8a;};'use strict';var _=require(_0x403c('0x0'));var util=require(_0x403c('0x1'));var moment=require(_0x403c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x403c('0x3'));var db=require(_0x403c('0x4'))['db'];var utils=require(_0x403c('0x5'));var logger=require(_0x403c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x403c('0x7')][_0x403c('0x8')]({'port':0x232a});config[_0x403c('0x9')]=_[_0x403c('0xa')](config['redis'],{'host':_0x403c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x403c('0x9')]));require(_0x403c('0xc'))[_0x403c('0xd')](socket);function respondWithRpcPromise(_0x2f1181,_0x186f0c,_0x52bea3){return new BPromise(function(_0x4b8bc4,_0xd0a4a9){return client[_0x403c('0xe')](_0x2f1181,_0x52bea3)[_0x403c('0xf')](function(_0x128462){logger['info'](_0x403c('0x10'),_0x186f0c,'request\x20sent');logger[_0x403c('0x11')](_0x403c('0x12'),_0x186f0c,_0x403c('0x13'),JSON['stringify'](_0x128462));if(_0x128462[_0x403c('0x14')]){if(_0x128462[_0x403c('0x14')][_0x403c('0x15')]===0x1f4){logger[_0x403c('0x14')](_0x403c('0x10'),_0x186f0c,_0x128462[_0x403c('0x14')][_0x403c('0x16')]);return _0xd0a4a9(_0x128462[_0x403c('0x14')][_0x403c('0x16')]);}logger[_0x403c('0x14')](_0x403c('0x10'),_0x186f0c,_0x128462[_0x403c('0x14')]['message']);return _0x4b8bc4(_0x128462[_0x403c('0x14')]['message']);}else{logger[_0x403c('0x17')]('SmsAccount,\x20%s,\x20%s',_0x186f0c,_0x403c('0x13'));_0x4b8bc4(_0x128462[_0x403c('0x18')][_0x403c('0x16')]);}})[_0x403c('0x19')](function(_0x4a6d4d){logger[_0x403c('0x14')](_0x403c('0x10'),_0x186f0c,_0x4a6d4d);_0xd0a4a9(_0x4a6d4d);});});}exports[_0x403c('0x1a')]=function(_0x52bad1){var _0x3086a5=this;return new Promise(function(_0x19f284,_0x437f0b){return db['SmsAccount'][_0x403c('0x1b')]({'raw':_0x52bad1[_0x403c('0x1c')]?_0x52bad1[_0x403c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x52bad1[_0x403c('0x1c')]?_0x52bad1[_0x403c('0x1c')][_0x403c('0x1d')]||null:null,'attributes':_0x52bad1[_0x403c('0x1c')]?_0x52bad1[_0x403c('0x1c')][_0x403c('0x1e')]||null:null,'include':_0x52bad1['options']?_0x52bad1[_0x403c('0x1c')][_0x403c('0x1f')]?_[_0x403c('0x20')](_0x52bad1['options'][_0x403c('0x1f')],function(_0x11b322){return{'model':db[_0x11b322['model']],'as':_0x11b322['as'],'attributes':_0x11b322[_0x403c('0x1e')],'include':_0x11b322[_0x403c('0x1f')]?_['map'](_0x11b322[_0x403c('0x1f')],function(_0x3c41b9){return{'model':db[_0x3c41b9['model']],'as':_0x3c41b9['as'],'attributes':_0x3c41b9[_0x403c('0x1e')],'include':_0x3c41b9[_0x403c('0x1f')]?_[_0x403c('0x20')](_0x3c41b9[_0x403c('0x1f')],function(_0x552ff7){return{'model':db[_0x552ff7[_0x403c('0x21')]],'as':_0x552ff7['as'],'attributes':_0x552ff7[_0x403c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x403c('0xf')](function(_0x564ce3){logger[_0x403c('0x17')](_0x403c('0x1a'),_0x52bad1);logger[_0x403c('0x11')](_0x403c('0x1a'),_0x52bad1,JSON[_0x403c('0x22')](_0x564ce3));_0x19f284(_0x564ce3);})['catch'](function(_0x4369fc){logger[_0x403c('0x14')](_0x403c('0x1a'),_0x4369fc[_0x403c('0x16')],_0x52bad1);_0x437f0b(_0x3086a5[_0x403c('0x14')](0x1f4,_0x4369fc[_0x403c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7973515..7267ec6 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 c4fcdec..2884096 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 _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(_0x1f9594,_0x9f5a86){var _0x154a45=function(_0x5af2ad){while(--_0x5af2ad){_0x1f9594['push'](_0x1f9594['shift']());}};_0x154a45(++_0x9f5a86);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a8e84,_0x3084ae){_0x2a8e84=_0x2a8e84-0x0;var _0x11e05c=_0xedd9[_0x2a8e84];return _0x11e05c;};'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 +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13eec6,_0x170127){var _0x585c24=function(_0x3052df){while(--_0x3052df){_0x13eec6['push'](_0x13eec6['shift']());}};_0x585c24(++_0x170127);}(_0x34e8,0x12c));var _0x834e=function(_0x32cd14,_0x1e1ab7){_0x32cd14=_0x32cd14-0x0;var _0x25a3db=_0x34e8[_0x32cd14];return _0x25a3db;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6756d15..aa962f0 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 _0x799d=['noop','STRING','sequelize','exports','INTEGER'];(function(_0x3feb3d,_0x597999){var _0x24439e=function(_0x5f1de0){while(--_0x5f1de0){_0x3feb3d['push'](_0x3feb3d['shift']());}};_0x24439e(++_0x597999);}(_0x799d,0x7a));var _0xd799=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x799d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xd799('0x0'));module[_0xd799('0x1')]={'priority':{'type':Sequelize[_0xd799('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd799('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd799('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4da1=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x4da1,0xb5));var _0x14da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4da1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x14da('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x14da('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x14da('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x14da('0x1')],'defaultValue':_0x14da('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 95cc055..dc3fc54 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 _0x6a58=['fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','SmsApplication','findAll','rows','catch','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','name','map','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6a58,0x17c));var _0x86a5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x6a58[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x86a5('0x0'));var rimraf=require(_0x86a5('0x1'));var zipdir=require(_0x86a5('0x2'));var jsonpatch=require(_0x86a5('0x3'));var rp=require(_0x86a5('0x4'));var moment=require('moment');var BPromise=require(_0x86a5('0x5'));var Mustache=require('mustache');var util=require(_0x86a5('0x6'));var path=require(_0x86a5('0x7'));var sox=require(_0x86a5('0x8'));var csv=require('to-csv');var ejs=require(_0x86a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86a5('0xa'));var squel=require(_0x86a5('0xb'));var crypto=require(_0x86a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x86a5('0xe'));var Redis=require(_0x86a5('0xf'));var authService=require(_0x86a5('0x10'));var qs=require(_0x86a5('0x11'));var as=require(_0x86a5('0x12'));var hardwareService=require(_0x86a5('0x13'));var logger=require('../../config/logger')(_0x86a5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x86a5('0x15'));var db=require(_0x86a5('0x16'))['db'];function respondWithStatusCode(_0x535335,_0x29df65){_0x29df65=_0x29df65||0xcc;return function(_0x30370a){if(_0x30370a){return _0x535335[_0x86a5('0x17')](_0x29df65);}return _0x535335[_0x86a5('0x18')](_0x29df65)['end']();};}function respondWithResult(_0x3c6270,_0xb22f94){_0xb22f94=_0xb22f94||0xc8;return function(_0x3d8a7b){if(_0x3d8a7b){return _0x3c6270[_0x86a5('0x18')](_0xb22f94)[_0x86a5('0x19')](_0x3d8a7b);}};}function respondWithFilteredResult(_0x1cd374,_0x4267eb){return function(_0x553ebb){if(_0x553ebb){var _0x20a505=typeof _0x4267eb[_0x86a5('0x1a')]===_0x86a5('0x1b')&&typeof _0x4267eb['limit']===_0x86a5('0x1b');var _0xc8a8b5=_0x553ebb[_0x86a5('0x1c')];var _0xe04d39=_0x20a505?0x0:_0x4267eb[_0x86a5('0x1a')];var _0x4e21ce=_0x20a505?_0x553ebb[_0x86a5('0x1c')]:_0x4267eb[_0x86a5('0x1a')]+_0x4267eb['limit'];var _0x409bc2;if(_0x4e21ce>=_0xc8a8b5){_0x4e21ce=_0xc8a8b5;_0x409bc2=0xc8;}else{_0x409bc2=0xce;}_0x1cd374[_0x86a5('0x18')](_0x409bc2);return _0x1cd374[_0x86a5('0x1d')](_0x86a5('0x1e'),_0xe04d39+'-'+_0x4e21ce+'/'+_0xc8a8b5)['json'](_0x553ebb);}return null;};}function patchUpdates(_0x5253cd){return function(_0x179956){try{jsonpatch['apply'](_0x179956,_0x5253cd,!![]);}catch(_0x64030e){return BPromise[_0x86a5('0x1f')](_0x64030e);}return _0x179956[_0x86a5('0x20')]();};}function saveUpdates(_0x10030f,_0x3da281){return function(_0x525410){if(_0x525410){return _0x525410[_0x86a5('0x21')](_0x10030f)[_0x86a5('0x22')](function(_0x3763f0){return _0x3763f0;});}return null;};}function removeEntity(_0x27b524,_0x334631){return function(_0x35957f){if(_0x35957f){return _0x35957f[_0x86a5('0x23')]()[_0x86a5('0x22')](function(){_0x27b524[_0x86a5('0x18')](0xcc)[_0x86a5('0x24')]();});}};}function handleEntityNotFound(_0x118640,_0x48ec2b){return function(_0x1ca453){if(!_0x1ca453){_0x118640['sendStatus'](0x194);}return _0x1ca453;};}function handleError(_0x5910d4,_0x415242){_0x415242=_0x415242||0x1f4;return function(_0x1188f4){logger['error'](_0x1188f4['stack']);if(_0x1188f4[_0x86a5('0x25')]){delete _0x1188f4[_0x86a5('0x25')];}_0x5910d4[_0x86a5('0x18')](_0x415242)['send'](_0x1188f4);};}exports['index']=function(_0x20b97d,_0x1e12c2){var _0x248aa1={},_0x288b5d={},_0x4caab1={'count':0x0,'rows':[]};var _0x3a47d5=_[_0x86a5('0x26')](db['SmsApplication'][_0x86a5('0x27')],function(_0x4e024b){return{'name':_0x4e024b[_0x86a5('0x28')],'type':_0x4e024b['type'][_0x86a5('0x29')]};});_0x288b5d[_0x86a5('0x2a')]=_['map'](_0x3a47d5,'name');_0x288b5d[_0x86a5('0x2b')]=_[_0x86a5('0x2c')](_0x20b97d[_0x86a5('0x2b')]);_0x288b5d['filters']=_['intersection'](_0x288b5d[_0x86a5('0x2a')],_0x288b5d[_0x86a5('0x2b')]);_0x248aa1['attributes']=_[_0x86a5('0x2d')](_0x288b5d['model'],qs[_0x86a5('0x2e')](_0x20b97d[_0x86a5('0x2b')]['fields']));_0x248aa1[_0x86a5('0x2f')]=_0x248aa1[_0x86a5('0x2f')][_0x86a5('0x30')]?_0x248aa1['attributes']:_0x288b5d[_0x86a5('0x2a')];if(!_0x20b97d[_0x86a5('0x2b')]['hasOwnProperty'](_0x86a5('0x31'))){_0x248aa1['limit']=qs[_0x86a5('0x32')](_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x32')]);_0x248aa1[_0x86a5('0x1a')]=qs[_0x86a5('0x1a')](_0x20b97d['query'][_0x86a5('0x1a')]);}_0x248aa1[_0x86a5('0x33')]=qs[_0x86a5('0x34')](_0x20b97d[_0x86a5('0x2b')]['sort']);_0x248aa1['where']=qs[_0x86a5('0x35')](_[_0x86a5('0x36')](_0x20b97d[_0x86a5('0x2b')],_0x288b5d[_0x86a5('0x35')]),_0x3a47d5);if(_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x37')]){_0x248aa1['where']=_[_0x86a5('0x38')](_0x248aa1[_0x86a5('0x39')],{'$or':_['map'](_0x3a47d5,function(_0x2c1e3d){if(_0x2c1e3d[_0x86a5('0x3a')]!==_0x86a5('0x3b')){var _0xf65af8={};_0xf65af8[_0x2c1e3d['name']]={'$like':'%'+_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x37')]+'%'};return _0xf65af8;}})});}_0x248aa1=_[_0x86a5('0x38')]({},_0x248aa1,_0x20b97d[_0x86a5('0x3c')]);var _0x343aae={'where':_0x248aa1[_0x86a5('0x39')]};return db['SmsApplication'][_0x86a5('0x1c')](_0x343aae)[_0x86a5('0x22')](function(_0x319c44){_0x4caab1[_0x86a5('0x1c')]=_0x319c44;if(_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x3d')]){_0x248aa1['include']=[{'all':!![]}];}return db[_0x86a5('0x3e')][_0x86a5('0x3f')](_0x248aa1);})[_0x86a5('0x22')](function(_0x1e327b){_0x4caab1[_0x86a5('0x40')]=_0x1e327b;return _0x4caab1;})[_0x86a5('0x22')](respondWithFilteredResult(_0x1e12c2,_0x248aa1))[_0x86a5('0x41')](handleError(_0x1e12c2,null));};exports['show']=function(_0x2d6da4,_0x225965){var _0x3245e6={'raw':!![],'where':{'id':_0x2d6da4[_0x86a5('0x42')]['id']}},_0xc7e099={};_0xc7e099[_0x86a5('0x2a')]=_['keys'](db['SmsApplication'][_0x86a5('0x27')]);_0xc7e099[_0x86a5('0x2b')]=_[_0x86a5('0x2c')](_0x2d6da4[_0x86a5('0x2b')]);_0xc7e099[_0x86a5('0x35')]=_[_0x86a5('0x2d')](_0xc7e099[_0x86a5('0x2a')],_0xc7e099[_0x86a5('0x2b')]);_0x3245e6[_0x86a5('0x2f')]=_[_0x86a5('0x2d')](_0xc7e099[_0x86a5('0x2a')],qs['fields'](_0x2d6da4[_0x86a5('0x2b')]['fields']));_0x3245e6[_0x86a5('0x2f')]=_0x3245e6[_0x86a5('0x2f')][_0x86a5('0x30')]?_0x3245e6['attributes']:_0xc7e099[_0x86a5('0x2a')];if(_0x2d6da4[_0x86a5('0x2b')][_0x86a5('0x3d')]){_0x3245e6[_0x86a5('0x43')]=[{'all':!![]}];}_0x3245e6=_[_0x86a5('0x38')]({},_0x3245e6,_0x2d6da4[_0x86a5('0x3c')]);return db[_0x86a5('0x3e')]['find'](_0x3245e6)['then'](handleEntityNotFound(_0x225965,null))[_0x86a5('0x22')](respondWithResult(_0x225965,null))[_0x86a5('0x41')](handleError(_0x225965,null));};exports[_0x86a5('0x44')]=function(_0x3d3448,_0x3caef3){return db[_0x86a5('0x3e')][_0x86a5('0x44')](_0x3d3448[_0x86a5('0x45')],{})[_0x86a5('0x22')](respondWithResult(_0x3caef3,0xc9))[_0x86a5('0x41')](handleError(_0x3caef3,null));};exports['update']=function(_0x4fb39a,_0x4fe121){if(_0x4fb39a['body']['id']){delete _0x4fb39a[_0x86a5('0x45')]['id'];}return db[_0x86a5('0x3e')][_0x86a5('0x46')]({'where':{'id':_0x4fb39a[_0x86a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4fe121,null))[_0x86a5('0x22')](saveUpdates(_0x4fb39a['body'],null))[_0x86a5('0x22')](respondWithResult(_0x4fe121,null))[_0x86a5('0x41')](handleError(_0x4fe121,null));};exports[_0x86a5('0x23')]=function(_0x16c626,_0x7482ad){return db['SmsApplication']['find']({'where':{'id':_0x16c626[_0x86a5('0x42')]['id']}})[_0x86a5('0x22')](handleEntityNotFound(_0x7482ad,null))['then'](removeEntity(_0x7482ad,null))[_0x86a5('0x41')](handleError(_0x7482ad,null));}; \ No newline at end of file +var _0xefb0=['count','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','SmsApplication','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xefb0,0x1a5));var _0x0efb=function(_0x1a42d2,_0x34daf2){_0x1a42d2=_0x1a42d2-0x0;var _0x5a2d73=_0xefb0[_0x1a42d2];return _0x5a2d73;};'use strict';var emlformat=require(_0x0efb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0efb('0x1'));var jsonpatch=require(_0x0efb('0x2'));var rp=require(_0x0efb('0x3'));var moment=require(_0x0efb('0x4'));var BPromise=require(_0x0efb('0x5'));var Mustache=require(_0x0efb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0efb('0x7'));var csv=require('to-csv');var ejs=require(_0x0efb('0x8'));var fs=require('fs');var fs_extra=require(_0x0efb('0x9'));var _=require(_0x0efb('0xa'));var squel=require('squel');var crypto=require(_0x0efb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0efb('0xc'));var toCsv=require(_0x0efb('0xd'));var querystring=require(_0x0efb('0xe'));var Papa=require(_0x0efb('0xf'));var Redis=require(_0x0efb('0x10'));var authService=require(_0x0efb('0x11'));var qs=require(_0x0efb('0x12'));var as=require(_0x0efb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0efb('0x14'))(_0x0efb('0x15'));var utils=require(_0x0efb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0efb('0x17'));var db=require(_0x0efb('0x18'))['db'];function respondWithStatusCode(_0x15bec9,_0x33ce14){_0x33ce14=_0x33ce14||0xcc;return function(_0x821ee9){if(_0x821ee9){return _0x15bec9['sendStatus'](_0x33ce14);}return _0x15bec9[_0x0efb('0x19')](_0x33ce14)['end']();};}function respondWithResult(_0xfb9516,_0x2f761c){_0x2f761c=_0x2f761c||0xc8;return function(_0x24e1ec){if(_0x24e1ec){return _0xfb9516[_0x0efb('0x19')](_0x2f761c)[_0x0efb('0x1a')](_0x24e1ec);}};}function respondWithFilteredResult(_0x1bc214,_0x5dc30f){return function(_0x4809d0){if(_0x4809d0){var _0x985c84=typeof _0x5dc30f['offset']===_0x0efb('0x1b')&&typeof _0x5dc30f['limit']===_0x0efb('0x1b');var _0x2f6e5b=_0x4809d0['count'];var _0x253b33=_0x985c84?0x0:_0x5dc30f[_0x0efb('0x1c')];var _0x1402d3=_0x985c84?_0x4809d0[_0x0efb('0x1d')]:_0x5dc30f[_0x0efb('0x1c')]+_0x5dc30f[_0x0efb('0x1e')];var _0x469a47;if(_0x1402d3>=_0x2f6e5b){_0x1402d3=_0x2f6e5b;_0x469a47=0xc8;}else{_0x469a47=0xce;}_0x1bc214[_0x0efb('0x19')](_0x469a47);return _0x1bc214['set'](_0x0efb('0x1f'),_0x253b33+'-'+_0x1402d3+'/'+_0x2f6e5b)[_0x0efb('0x1a')](_0x4809d0);}return null;};}function patchUpdates(_0x5a9076){return function(_0x228463){try{jsonpatch[_0x0efb('0x20')](_0x228463,_0x5a9076,!![]);}catch(_0x5079ca){return BPromise[_0x0efb('0x21')](_0x5079ca);}return _0x228463[_0x0efb('0x22')]();};}function saveUpdates(_0x440f72,_0x30ec2b){return function(_0x5656dc){if(_0x5656dc){return _0x5656dc[_0x0efb('0x23')](_0x440f72)[_0x0efb('0x24')](function(_0xaa2eeb){return _0xaa2eeb;});}return null;};}function removeEntity(_0x44ef7d,_0x585265){return function(_0x57fad3){if(_0x57fad3){return _0x57fad3[_0x0efb('0x25')]()[_0x0efb('0x24')](function(){_0x44ef7d[_0x0efb('0x19')](0xcc)[_0x0efb('0x26')]();});}};}function handleEntityNotFound(_0x4a6a49,_0x38c6f0){return function(_0x3cd8e4){if(!_0x3cd8e4){_0x4a6a49[_0x0efb('0x27')](0x194);}return _0x3cd8e4;};}function handleError(_0x48ca50,_0x37a1aa){_0x37a1aa=_0x37a1aa||0x1f4;return function(_0x486da5){logger[_0x0efb('0x28')](_0x486da5['stack']);if(_0x486da5[_0x0efb('0x29')]){delete _0x486da5[_0x0efb('0x29')];}_0x48ca50[_0x0efb('0x19')](_0x37a1aa)[_0x0efb('0x2a')](_0x486da5);};}exports[_0x0efb('0x2b')]=function(_0x9d57da,_0x5d86b1){var _0x431877={},_0x299323={},_0x4bf02d={'count':0x0,'rows':[]};var _0x105496=_[_0x0efb('0x2c')](db[_0x0efb('0x2d')]['rawAttributes'],function(_0x4145e1){return{'name':_0x4145e1['fieldName'],'type':_0x4145e1[_0x0efb('0x2e')][_0x0efb('0x2f')]};});_0x299323['model']=_[_0x0efb('0x2c')](_0x105496,_0x0efb('0x29'));_0x299323[_0x0efb('0x30')]=_['keys'](_0x9d57da[_0x0efb('0x30')]);_0x299323[_0x0efb('0x31')]=_[_0x0efb('0x32')](_0x299323['model'],_0x299323[_0x0efb('0x30')]);_0x431877[_0x0efb('0x33')]=_[_0x0efb('0x32')](_0x299323[_0x0efb('0x34')],qs[_0x0efb('0x35')](_0x9d57da[_0x0efb('0x30')]['fields']));_0x431877[_0x0efb('0x33')]=_0x431877[_0x0efb('0x33')][_0x0efb('0x36')]?_0x431877['attributes']:_0x299323[_0x0efb('0x34')];if(!_0x9d57da[_0x0efb('0x30')][_0x0efb('0x37')](_0x0efb('0x38'))){_0x431877[_0x0efb('0x1e')]=qs[_0x0efb('0x1e')](_0x9d57da['query']['limit']);_0x431877[_0x0efb('0x1c')]=qs['offset'](_0x9d57da[_0x0efb('0x30')][_0x0efb('0x1c')]);}_0x431877['order']=qs[_0x0efb('0x39')](_0x9d57da[_0x0efb('0x30')]['sort']);_0x431877[_0x0efb('0x3a')]=qs[_0x0efb('0x31')](_[_0x0efb('0x3b')](_0x9d57da[_0x0efb('0x30')],_0x299323[_0x0efb('0x31')]),_0x105496);if(_0x9d57da[_0x0efb('0x30')][_0x0efb('0x3c')]){_0x431877[_0x0efb('0x3a')]=_[_0x0efb('0x3d')](_0x431877[_0x0efb('0x3a')],{'$or':_['map'](_0x105496,function(_0x3f030f){if(_0x3f030f[_0x0efb('0x2e')]!==_0x0efb('0x3e')){var _0x3428d7={};_0x3428d7[_0x3f030f[_0x0efb('0x29')]]={'$like':'%'+_0x9d57da[_0x0efb('0x30')][_0x0efb('0x3c')]+'%'};return _0x3428d7;}})});}_0x431877=_[_0x0efb('0x3d')]({},_0x431877,_0x9d57da[_0x0efb('0x3f')]);var _0x142563={'where':_0x431877[_0x0efb('0x3a')]};return db['SmsApplication'][_0x0efb('0x1d')](_0x142563)['then'](function(_0x39d4ed){_0x4bf02d[_0x0efb('0x1d')]=_0x39d4ed;if(_0x9d57da[_0x0efb('0x30')][_0x0efb('0x40')]){_0x431877[_0x0efb('0x41')]=[{'all':!![]}];}return db[_0x0efb('0x2d')]['findAll'](_0x431877);})['then'](function(_0x46fc75){_0x4bf02d[_0x0efb('0x42')]=_0x46fc75;return _0x4bf02d;})['then'](respondWithFilteredResult(_0x5d86b1,_0x431877))[_0x0efb('0x43')](handleError(_0x5d86b1,null));};exports[_0x0efb('0x44')]=function(_0x88387c,_0x17b454){var _0x9aca91={'raw':!![],'where':{'id':_0x88387c[_0x0efb('0x45')]['id']}},_0x5cf0d6={};_0x5cf0d6[_0x0efb('0x34')]=_[_0x0efb('0x46')](db['SmsApplication'][_0x0efb('0x47')]);_0x5cf0d6[_0x0efb('0x30')]=_[_0x0efb('0x46')](_0x88387c['query']);_0x5cf0d6[_0x0efb('0x31')]=_[_0x0efb('0x32')](_0x5cf0d6[_0x0efb('0x34')],_0x5cf0d6[_0x0efb('0x30')]);_0x9aca91[_0x0efb('0x33')]=_[_0x0efb('0x32')](_0x5cf0d6[_0x0efb('0x34')],qs[_0x0efb('0x35')](_0x88387c[_0x0efb('0x30')][_0x0efb('0x35')]));_0x9aca91['attributes']=_0x9aca91[_0x0efb('0x33')]['length']?_0x9aca91['attributes']:_0x5cf0d6[_0x0efb('0x34')];if(_0x88387c['query'][_0x0efb('0x40')]){_0x9aca91[_0x0efb('0x41')]=[{'all':!![]}];}_0x9aca91=_[_0x0efb('0x3d')]({},_0x9aca91,_0x88387c['options']);return db[_0x0efb('0x2d')][_0x0efb('0x48')](_0x9aca91)[_0x0efb('0x24')](handleEntityNotFound(_0x17b454,null))['then'](respondWithResult(_0x17b454,null))[_0x0efb('0x43')](handleError(_0x17b454,null));};exports[_0x0efb('0x49')]=function(_0x85636b,_0x449a27){return db[_0x0efb('0x2d')][_0x0efb('0x49')](_0x85636b['body'],{})[_0x0efb('0x24')](respondWithResult(_0x449a27,0xc9))[_0x0efb('0x43')](handleError(_0x449a27,null));};exports[_0x0efb('0x23')]=function(_0x3ccadd,_0x232ce5){if(_0x3ccadd[_0x0efb('0x4a')]['id']){delete _0x3ccadd[_0x0efb('0x4a')]['id'];}return db[_0x0efb('0x2d')]['find']({'where':{'id':_0x3ccadd[_0x0efb('0x45')]['id']}})['then'](handleEntityNotFound(_0x232ce5,null))[_0x0efb('0x24')](saveUpdates(_0x3ccadd[_0x0efb('0x4a')],null))['then'](respondWithResult(_0x232ce5,null))[_0x0efb('0x43')](handleError(_0x232ce5,null));};exports[_0x0efb('0x25')]=function(_0x1c4632,_0x4a2b60){return db['SmsApplication']['find']({'where':{'id':_0x1c4632[_0x0efb('0x45')]['id']}})[_0x0efb('0x24')](handleEntityNotFound(_0x4a2b60,null))['then'](removeEntity(_0x4a2b60,null))['catch'](handleError(_0x4a2b60,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b0851c3..569188f 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 _0x13d5=['rimraf','../../config/environment','exports','define','SmsApplication','lodash','util','../../config/logger','path'];(function(_0x62f2b3,_0x54f02e){var _0x467ade=function(_0x2a5390){while(--_0x2a5390){_0x62f2b3['push'](_0x62f2b3['shift']());}};_0x467ade(++_0x54f02e);}(_0x13d5,0x1a3));var _0x513d=function(_0x28c1ee,_0x5e9056){_0x28c1ee=_0x28c1ee-0x0;var _0x4e0fe8=_0x13d5[_0x28c1ee];return _0x4e0fe8;};'use strict';var _=require(_0x513d('0x0'));var util=require(_0x513d('0x1'));var logger=require(_0x513d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513d('0x3'));var rimraf=require(_0x513d('0x4'));var config=require(_0x513d('0x5'));var attributes=require('./smsApplication.attributes');module[_0x513d('0x6')]=function(_0x5c2d56,_0x5a6a76){return _0x5c2d56[_0x513d('0x7')](_0x513d('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xad0f=['bluebird','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x1d7510,_0x469676){var _0x446171=function(_0x3f8a1e){while(--_0x3f8a1e){_0x1d7510['push'](_0x1d7510['shift']());}};_0x446171(++_0x469676);}(_0xad0f,0xa1));var _0xfad0=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xad0f[_0x16dbfd];return _0x382254;};'use strict';var _=require(_0xfad0('0x0'));var util=require(_0xfad0('0x1'));var logger=require('../../config/logger')(_0xfad0('0x2'));var moment=require(_0xfad0('0x3'));var BPromise=require(_0xfad0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfad0('0x5'));var attributes=require(_0xfad0('0x6'));module[_0xfad0('0x7')]=function(_0x503b53,_0x38a18c){return _0x503b53['define']('SmsApplication',attributes,{'tableName':_0xfad0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfad0('0x9'),'collate':_0xfad0('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 53ad14b..6f32050 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 _0x7669=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash'];(function(_0x272cd4,_0x3e9a8a){var _0x291e61=function(_0x205914){while(--_0x205914){_0x272cd4['push'](_0x272cd4['shift']());}};_0x291e61(++_0x3e9a8a);}(_0x7669,0xe5));var _0x9766=function(_0x27af05,_0x488012){_0x27af05=_0x27af05-0x0;var _0x45b4b2=_0x7669[_0x27af05];return _0x45b4b2;};'use strict';var _=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var moment=require(_0x9766('0x2'));var BPromise=require('bluebird');var rs=require(_0x9766('0x3'));var fs=require('fs');var Redis=require(_0x9766('0x4'));var db=require(_0x9766('0x5'))['db'];var utils=require(_0x9766('0x6'));var logger=require(_0x9766('0x7'))(_0x9766('0x8'));var config=require('../../config/environment');var jayson=require(_0x9766('0x9'));var client=jayson[_0x9766('0xa')][_0x9766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x251329,_0x4f85e7,_0x26bbd9){return new BPromise(function(_0x2b5b52,_0x2381eb){return client[_0x9766('0xc')](_0x251329,_0x26bbd9)[_0x9766('0xd')](function(_0x5cb787){logger[_0x9766('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4f85e7,_0x9766('0xf'));logger['debug'](_0x9766('0x10'),_0x4f85e7,'request\x20sent',JSON[_0x9766('0x11')](_0x5cb787));if(_0x5cb787['error']){if(_0x5cb787[_0x9766('0x12')][_0x9766('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4f85e7,_0x5cb787[_0x9766('0x12')]['message']);return _0x2381eb(_0x5cb787[_0x9766('0x12')]['message']);}logger[_0x9766('0x12')](_0x9766('0x14'),_0x4f85e7,_0x5cb787['error'][_0x9766('0x15')]);return _0x2b5b52(_0x5cb787['error'][_0x9766('0x15')]);}else{logger[_0x9766('0xe')](_0x9766('0x14'),_0x4f85e7,_0x9766('0xf'));_0x2b5b52(_0x5cb787[_0x9766('0x16')][_0x9766('0x15')]);}})['catch'](function(_0x8f9b2a){logger[_0x9766('0x12')](_0x9766('0x14'),_0x4f85e7,_0x8f9b2a);_0x2381eb(_0x8f9b2a);});});} \ No newline at end of file +var _0x04d5=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d3e1a,_0xea02fa){var _0x8e2289=function(_0x48bd4d){while(--_0x48bd4d){_0x5d3e1a['push'](_0x5d3e1a['shift']());}};_0x8e2289(++_0xea02fa);}(_0x04d5,0xe1));var _0x504d=function(_0x43fcff,_0x3c1f86){_0x43fcff=_0x43fcff-0x0;var _0x476841=_0x04d5[_0x43fcff];return _0x476841;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var moment=require('moment');var BPromise=require(_0x504d('0x2'));var rs=require(_0x504d('0x3'));var fs=require('fs');var Redis=require(_0x504d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x504d('0x5'));var logger=require(_0x504d('0x6'))(_0x504d('0x7'));var config=require(_0x504d('0x8'));var jayson=require(_0x504d('0x9'));var client=jayson['client'][_0x504d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278262,_0x87bf04,_0x49cb76){return new BPromise(function(_0x5712a7,_0x16da4f){return client[_0x504d('0xb')](_0x278262,_0x49cb76)[_0x504d('0xc')](function(_0x48e0e6){logger[_0x504d('0xd')](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));logger[_0x504d('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x87bf04,_0x504d('0xf'),JSON[_0x504d('0x11')](_0x48e0e6));if(_0x48e0e6[_0x504d('0x12')]){if(_0x48e0e6[_0x504d('0x12')][_0x504d('0x13')]===0x1f4){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6['error']['message']);return _0x16da4f(_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);}logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);return _0x5712a7(_0x48e0e6['error'][_0x504d('0x14')]);}else{logger['info'](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));_0x5712a7(_0x48e0e6['result'][_0x504d('0x14')]);}})[_0x504d('0x15')](function(_0x1e3722){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x1e3722);_0x16da4f(_0x1e3722);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a011fba..971e8db 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 _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x4fd21d,_0x41a819){var _0x28fe8d=function(_0x5b192e){while(--_0x5b192e){_0x4fd21d['push'](_0x4fd21d['shift']());}};_0x28fe8d(++_0x41a819);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file +var _0xbaf0=['sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x3fa77c,_0x284952){var _0x57d3e7=function(_0x57936b){while(--_0x57936b){_0x3fa77c['push'](_0x3fa77c['shift']());}};_0x57d3e7(++_0x284952);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0baf('0x12')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x13')]);router['post'](_0x0baf('0x14'),auth['isAuthenticated'](),interaction[_0x0baf('0x15')](_0x0baf('0x16'),_0x0baf('0x17')),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')](_0x0baf('0x1a'),auth['isAuthenticated'](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1b')),controller[_0x0baf('0x1c')]);router[_0x0baf('0x1d')](_0x0baf('0x1a'),auth[_0x0baf('0xa')](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1e')),controller[_0x0baf('0x1f')]);router[_0x0baf('0x1d')](_0x0baf('0x14'),auth[_0x0baf('0xa')](),controller['removeTags']);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 f85a14a..edb86ab 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 _0x69d4=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x17c927,_0x1f9cb5){var _0x1320ee=function(_0x3a8eb2){while(--_0x3a8eb2){_0x17c927['push'](_0x17c927['shift']());}};_0x1320ee(++_0x1f9cb5);}(_0x69d4,0x83));var _0x469d=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x69d4[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0x469d('0x0'));var moment=require(_0x469d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x469d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x469d('0x3')]},'disposition':{'type':Sequelize[_0x469d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x469d('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x469d('0x4')]},'read1stAt':{'type':Sequelize[_0x469d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x469d('0x5')]('in',_0x469d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x469d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x469d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x469d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3a15=['DATE','STRING','out','BOOLEAN','INTEGER','sequelize','exports'];(function(_0xcae5ee,_0xcbc7a){var _0x3402db=function(_0x794249){while(--_0x794249){_0xcae5ee['push'](_0xcae5ee['shift']());}};_0x3402db(++_0xcbc7a);}(_0x3a15,0xde));var _0x53a1=function(_0x347f98,_0x23b964){_0x347f98=_0x347f98-0x0;var _0x5c8bfc=_0x3a15[_0x347f98];return _0x5c8bfc;};'use strict';var Sequelize=require(_0x53a1('0x0'));var moment=require('moment');module[_0x53a1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53a1('0x2')]},'disposition':{'type':Sequelize[_0x53a1('0x3')]},'secondDisposition':{'type':Sequelize[_0x53a1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x53a1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x53a1('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x53a1('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x53a1('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x53a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index b98bdcf..3731734 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 _0x6bbb=['json','undefined','offset','limit','set','update','then','error','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','format','count','rows','addTags','setTags','Tag','emit','removeTags','download','join','root','server','files','tmp','push','User','fullname','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','YYYY-MM-DD\x20HH:mm:ss','toString','closed','out','System','lastName','value','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','sendStatus','status','end'];(function(_0x120d6a,_0x47fcb6){var _0x3c56e5=function(_0x321e51){while(--_0x321e51){_0x120d6a['push'](_0x120d6a['shift']());}};_0x3c56e5(++_0x47fcb6);}(_0x6bbb,0x148));var _0xb6bb=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x6bbb[_0x1d30a3];return _0x32bba1;};'use strict';var rimraf=require(_0xb6bb('0x0'));var zipdir=require(_0xb6bb('0x1'));var moment=require('moment');var BPromise=require(_0xb6bb('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xb6bb('0x3'));var fs=require('fs');var _=require(_0xb6bb('0x4'));var Redis=require('ioredis');var interaction=require(_0xb6bb('0x5'));var qs=require(_0xb6bb('0x6'));var pdf=require(_0xb6bb('0x7'));var logger=require(_0xb6bb('0x8'))(_0xb6bb('0x9'));var config=require(_0xb6bb('0xa'));var db=require(_0xb6bb('0xb'))['db'];config[_0xb6bb('0xc')]=_[_0xb6bb('0xd')](config[_0xb6bb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6bb('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1f72f8,_0x586708){_0x586708=_0x586708||0xcc;return function(_0x126da7){if(_0x126da7){return _0x1f72f8[_0xb6bb('0xe')](_0x586708);}return _0x1f72f8[_0xb6bb('0xf')](_0x586708)[_0xb6bb('0x10')]();};}function respondWithResult(_0x5834ee,_0x5d9452){_0x5d9452=_0x5d9452||0xc8;return function(_0x25b150){if(_0x25b150){return _0x5834ee[_0xb6bb('0xf')](_0x5d9452)[_0xb6bb('0x11')](_0x25b150);}};}function respondWithFilteredResult(_0x5e67b0,_0x3bba80){return function(_0x42f33e){if(_0x42f33e){var _0x62bb90=typeof _0x3bba80['offset']==='undefined'&&typeof _0x3bba80['limit']===_0xb6bb('0x12');var _0x2227f9=_0x42f33e['count'];var _0x53ff59=_0x62bb90?0x0:_0x3bba80[_0xb6bb('0x13')];var _0xcdfe26=_0x62bb90?_0x42f33e['count']:_0x3bba80[_0xb6bb('0x13')]+_0x3bba80[_0xb6bb('0x14')];var _0x3320b2;if(_0xcdfe26>=_0x2227f9){_0xcdfe26=_0x2227f9;_0x3320b2=0xc8;}else{_0x3320b2=0xce;}_0x5e67b0[_0xb6bb('0xf')](_0x3320b2);return _0x5e67b0[_0xb6bb('0x15')]('Content-Range',_0x53ff59+'-'+_0xcdfe26+'/'+_0x2227f9)[_0xb6bb('0x11')](_0x42f33e);}return null;};}function saveUpdates(_0x5d6f1e){return function(_0x12be45){if(_0x12be45){return _0x12be45[_0xb6bb('0x16')](_0x5d6f1e)['then'](function(_0x54b1cb){return _0x54b1cb;});}return null;};}function removeEntity(_0x1b5412){return function(_0x5d8568){if(_0x5d8568){return _0x5d8568['destroy']()[_0xb6bb('0x17')](function(){_0x1b5412['status'](0xcc)[_0xb6bb('0x10')]();});}};}function handleEntityNotFound(_0xd5a7b9){return function(_0x318073){if(!_0x318073){_0xd5a7b9[_0xb6bb('0xe')](0x194);}return _0x318073;};}function handleError(_0x2f6d9b,_0x937bdd){_0x937bdd=_0x937bdd||0x1f4;return function(_0x2bce22){logger[_0xb6bb('0x18')](_0x2bce22['stack']);if(_0x2bce22[_0xb6bb('0x19')]){delete _0x2bce22['name'];}_0x2f6d9b[_0xb6bb('0xf')](_0x937bdd)['send'](_0x2bce22);};}exports[_0xb6bb('0x1a')]=function(_0x5731d3,_0x1a5457){var _0x3d7a6d={};var _0x2e451e=_[_0xb6bb('0x1b')](db[_0xb6bb('0x1c')][_0xb6bb('0x1d')],function(_0xfb45d2){return{'name':_0xfb45d2[_0xb6bb('0x1e')],'type':_0xfb45d2[_0xb6bb('0x1f')][_0xb6bb('0x20')]};});_0x3d7a6d=qs[_0xb6bb('0x21')](_0x2e451e,_0x5731d3);return interaction[_0xb6bb('0x22')](_0xb6bb('0x23'),_0x5731d3[_0xb6bb('0x24')],_0x5731d3[_0xb6bb('0x25')],_0x3d7a6d,_0x2e451e)['then'](respondWithFilteredResult(_0x1a5457,_0x3d7a6d))[_0xb6bb('0x26')](handleError(_0x1a5457,null));};exports[_0xb6bb('0x27')]=function(_0x266c5c,_0x2e14a9){var _0x369bb5={'raw':![],'where':{'id':_0x266c5c[_0xb6bb('0x28')]['id']}},_0x1030fa={};_0x1030fa[_0xb6bb('0x29')]=_[_0xb6bb('0x2a')](db[_0xb6bb('0x1c')][_0xb6bb('0x1d')]);_0x1030fa['query']=_['keys'](_0x266c5c[_0xb6bb('0x24')]);_0x1030fa['filters']=_[_0xb6bb('0x2b')](_0x1030fa[_0xb6bb('0x29')],_0x1030fa[_0xb6bb('0x24')]);_0x369bb5[_0xb6bb('0x2c')]=_['intersection'](_0x1030fa['model'],qs[_0xb6bb('0x2d')](_0x266c5c['query'][_0xb6bb('0x2d')]));_0x369bb5['attributes']=_0x369bb5[_0xb6bb('0x2c')][_0xb6bb('0x2e')]?_0x369bb5['attributes']:_0x1030fa[_0xb6bb('0x29')];if(_0x266c5c[_0xb6bb('0x24')][_0xb6bb('0x2f')]){_0x369bb5[_0xb6bb('0x30')]=[{'all':!![]}];}_0x369bb5=_[_0xb6bb('0x31')]({},_0x369bb5,_0x266c5c[_0xb6bb('0x32')]);return db[_0xb6bb('0x1c')]['find'](_0x369bb5)[_0xb6bb('0x17')](handleEntityNotFound(_0x2e14a9,null))[_0xb6bb('0x17')](respondWithResult(_0x2e14a9,null))[_0xb6bb('0x26')](handleError(_0x2e14a9,null));};exports[_0xb6bb('0x33')]=function(_0x52b6fa,_0x4f0e3a){return db['SmsInteraction'][_0xb6bb('0x33')](_0x52b6fa[_0xb6bb('0x34')],{})[_0xb6bb('0x17')](respondWithResult(_0x4f0e3a,0xc9))[_0xb6bb('0x26')](handleError(_0x4f0e3a,null));};exports['update']=function(_0x3fc889,_0x432f31){if(_0x3fc889[_0xb6bb('0x34')]['id']){delete _0x3fc889[_0xb6bb('0x34')]['id'];}return db[_0xb6bb('0x1c')][_0xb6bb('0x35')]({'where':{'id':_0x3fc889[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x432f31,null))[_0xb6bb('0x17')](saveUpdates(_0x3fc889['body'],null))[_0xb6bb('0x17')](respondWithResult(_0x432f31,null))['catch'](handleError(_0x432f31,null));};exports[_0xb6bb('0x36')]=function(_0x2cc5d2,_0x68e275){return db[_0xb6bb('0x1c')]['find']({'where':{'id':_0x2cc5d2[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x68e275,null))[_0xb6bb('0x17')](removeEntity(_0x68e275,null))[_0xb6bb('0x26')](handleError(_0x68e275,null));};exports[_0xb6bb('0x37')]=function(_0x490428,_0x2da59){return db[_0xb6bb('0x1c')]['describe']()['then'](respondWithResult(_0x2da59,null))[_0xb6bb('0x26')](handleError(_0x2da59,null));};exports['addMessage']=function(_0x5eee22,_0x1edb9f){return db['SmsMessage'][_0xb6bb('0x35')]({'where':{'id':_0x5eee22[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x1edb9f,null))[_0xb6bb('0x17')](function(_0x20b15f){if(_0x20b15f){return _0x20b15f[_0xb6bb('0x38')](_0x5eee22[_0xb6bb('0x34')][_0xb6bb('0x39')],_[_0xb6bb('0x3a')](_0x5eee22[_0xb6bb('0x34')],['ids','id'])||{});}})[_0xb6bb('0x17')](respondWithResult(_0x1edb9f,null))[_0xb6bb('0x26')](handleError(_0x1edb9f,null));};exports[_0xb6bb('0x3b')]=function(_0x526f89,_0x12825d){var _0x120790={'raw':![],'where':{}};var _0x33afb3={};var _0x49e3dc={'count':0x0,'rows':[]};return db[_0xb6bb('0x1c')][_0xb6bb('0x3c')]({'where':{'id':_0x526f89[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x12825d,null))[_0xb6bb('0x17')](function(_0x5f3dec){if(_0x5f3dec){_0x33afb3[_0xb6bb('0x29')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x33afb3[_0xb6bb('0x24')]=_['keys'](_0x526f89['query']);_0x33afb3[_0xb6bb('0x3d')]=_[_0xb6bb('0x2b')](_0x33afb3['model'],_0x33afb3[_0xb6bb('0x24')]);_0x120790[_0xb6bb('0x2c')]=_[_0xb6bb('0x2b')](_0x33afb3['model'],qs[_0xb6bb('0x2d')](_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x2d')]));_0x120790['attributes']=_0x120790[_0xb6bb('0x2c')][_0xb6bb('0x2e')]?_0x120790['attributes']:_0x33afb3['model'];if(!_0x526f89['query'][_0xb6bb('0x3e')](_0xb6bb('0x3f'))){_0x120790[_0xb6bb('0x14')]=qs[_0xb6bb('0x14')](_0x526f89[_0xb6bb('0x24')]['limit']);_0x120790[_0xb6bb('0x13')]=qs[_0xb6bb('0x13')](_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x13')]);}_0x120790[_0xb6bb('0x40')]=qs['sort'](_0x526f89['query'][_0xb6bb('0x41')]);_0x120790['where']=qs[_0xb6bb('0x3d')](_[_0xb6bb('0x42')](_0x526f89['query'],_0x33afb3['filters']));_0x120790[_0xb6bb('0x43')][_0xb6bb('0x44')]=_0x5f3dec['id'];if(_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x45')]){_0x120790[_0xb6bb('0x43')]=_[_0xb6bb('0x31')](_0x120790[_0xb6bb('0x43')],{'$or':_[_0xb6bb('0x1b')](_0x120790[_0xb6bb('0x2c')],function(_0x33c895){var _0x2dbd4b={};_0x2dbd4b[_0x33c895]={'$like':'%'+_0x526f89[_0xb6bb('0x24')]['filter']+'%'};return _0x2dbd4b;})});}if(_0x526f89['query'][_0xb6bb('0x46')]){var _0x21b156=_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x46')][_0xb6bb('0x47')](',');var _0x8a03aa={};_0x8a03aa[_0x21b156[0x0]]={'$gte':moment(_0x21b156[0x1])[_0xb6bb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x120790['where']=_[_0xb6bb('0x31')](_0x120790[_0xb6bb('0x43')],_0x8a03aa);}_0x120790=_[_0xb6bb('0x31')]({},_0x120790,_0x526f89[_0xb6bb('0x32')]);return db['SmsMessage'][_0xb6bb('0x49')]({'where':_0x120790[_0xb6bb('0x43')]})[_0xb6bb('0x17')](function(_0x1492f4){_0x49e3dc[_0xb6bb('0x49')]=_0x1492f4;if(_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x2f')]){_0x120790[_0xb6bb('0x30')]=[{'all':!![]}];}return db['SmsMessage'][_0xb6bb('0x22')](_0x120790);})['then'](function(_0x1ebbe3){_0x49e3dc[_0xb6bb('0x4a')]=_0x1ebbe3;return _0x49e3dc;});}})[_0xb6bb('0x17')](respondWithFilteredResult(_0x12825d,_0x120790))[_0xb6bb('0x26')](handleError(_0x12825d,null));};exports[_0xb6bb('0x4b')]=function(_0x191e5b,_0x3855dd){return db[_0xb6bb('0x1c')]['find']({'where':{'id':_0x191e5b['params']['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x3855dd,null))[_0xb6bb('0x17')](function(_0x4f1f8b){if(_0x4f1f8b){return _0x4f1f8b[_0xb6bb('0x4c')](_0x191e5b[_0xb6bb('0x34')][_0xb6bb('0x39')],_[_0xb6bb('0x3a')](_0x191e5b[_0xb6bb('0x34')],[_0xb6bb('0x39'),'id'])||{})['spread'](function(){return db[_0xb6bb('0x4d')]['findAll']({'attributes':['id',_0xb6bb('0x19'),'color'],'where':{'id':_0x191e5b[_0xb6bb('0x34')][_0xb6bb('0x39')]}});})[_0xb6bb('0x17')](function(_0x43d656){socket[_0xb6bb('0x4e')]('smsInteractionTags:save',{'id':Number(_0x191e5b['params']['id']),'tags':_0x43d656||[]});return{'id':Number(_0x191e5b['params']['id']),'tags':_0x43d656||[]};});}})[_0xb6bb('0x17')](respondWithResult(_0x3855dd,null))[_0xb6bb('0x26')](handleError(_0x3855dd,null));};exports[_0xb6bb('0x4f')]=function(_0x392e85,_0x5c6974){return db['SmsInteraction'][_0xb6bb('0x35')]({'where':{'id':_0x392e85[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x5c6974,null))['then'](function(_0x6c8b3d){if(_0x6c8b3d){return _0x6c8b3d[_0xb6bb('0x4f')](_0x392e85[_0xb6bb('0x24')][_0xb6bb('0x39')]);}})['then'](respondWithStatusCode(_0x5c6974,null))[_0xb6bb('0x26')](handleError(_0x5c6974,null));};exports[_0xb6bb('0x50')]=function(_0x37b29d,_0x2ef9ac){var _0x41fef2=moment()['unix']()['toString']();var _0x229768=path[_0xb6bb('0x51')](config[_0xb6bb('0x52')],_0xb6bb('0x53'),_0xb6bb('0x54'),_0xb6bb('0x55'));var _0x9675df=path['join'](_0x229768,_0x41fef2);var _0x464e18=util[_0xb6bb('0x48')]('transcript-%d-%s.zip',_0x37b29d[_0xb6bb('0x28')]['id'],_0x41fef2);var _0x2dbb11=path['join'](_0x229768,_0x464e18);var _0x1a3390=[];_0x1a3390[_0xb6bb('0x56')]({'model':db[_0xb6bb('0x57')],'as':_0xb6bb('0x57'),'attributes':['id',_0xb6bb('0x58')],'raw':!![]});_0x1a3390[_0xb6bb('0x56')]({'model':db['CmContact'],'as':_0xb6bb('0x59'),'attributes':['id',_0xb6bb('0x5a'),'lastName'],'raw':!![]});var _0x142d52=[{'model':db['SmsMessage'],'as':_0xb6bb('0x5b'),'attributes':['id','body',_0xb6bb('0x5c'),_0xb6bb('0x5d'),_0xb6bb('0x5e'),_0xb6bb('0x5f')],'include':_0x1a3390}];_0x142d52[_0xb6bb('0x56')]({'model':db[_0xb6bb('0x60')],'as':_0xb6bb('0x61'),'attributes':['id',_0xb6bb('0x19')]});_0x142d52[_0xb6bb('0x56')]({'model':db['User'],'as':_0xb6bb('0x62'),'attributes':['id','fullname']});return db[_0xb6bb('0x1c')][_0xb6bb('0x35')]({'where':{'id':_0x37b29d[_0xb6bb('0x28')]['id']},'include':_0x142d52})[_0xb6bb('0x17')](handleEntityNotFound(_0x2ef9ac,null))[_0xb6bb('0x17')](function(_0x16f540){if(_0x16f540){var _0x4f2c97=_0x16f540[_0xb6bb('0x63')]({'plain':!![]});fs[_0xb6bb('0x64')](_0x9675df);var _0xce4488={'channel':_0xb6bb('0x65'),'account':_0x4f2c97['Account'][_0xb6bb('0x19')],'agent':_0x4f2c97[_0xb6bb('0x62')]?_0x4f2c97[_0xb6bb('0x62')]['fullname']:'N.A.','createdAt':moment(_0x4f2c97[_0xb6bb('0x5c')])[_0xb6bb('0x48')](_0xb6bb('0x66'))[_0xb6bb('0x67')](),'closedAt':_0x4f2c97[_0xb6bb('0x68')]?moment(_0x4f2c97['closedAt'])[_0xb6bb('0x48')](_0xb6bb('0x66'))['toString']():'','disposition':_0x4f2c97['disposition'],'messages':_(_0x4f2c97[_0xb6bb('0x5b')])[_0xb6bb('0x45')]({'secret':![]})[_0xb6bb('0x1b')](function(_0x589188){return{'date':moment(_0x589188[_0xb6bb('0x5c')])[_0xb6bb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb6bb('0x67')](),'sender':_0x589188['direction']===_0xb6bb('0x69')?_0x589188['User']?_0x589188['User']['fullname']:_0xb6bb('0x6a'):_0x589188[_0xb6bb('0x59')]['firstName']+(_0x589188[_0xb6bb('0x59')]['lastName']?'\x20'+_0x589188[_0xb6bb('0x59')][_0xb6bb('0x6b')]:''),'body':_0x589188[_0xb6bb('0x34')],'direction':_0x589188[_0xb6bb('0x5d')]===_0xb6bb('0x69')?'A':'C','secret':_0x589188[_0xb6bb('0x5e')],'read':_0x589188[_0xb6bb('0x5f')]};})[_0xb6bb('0x6c')]()};return ejs['renderFile'](path['join'](config[_0xb6bb('0x52')],'server',_0xb6bb('0x6d'),_0xb6bb('0x6e')),{'interaction':_0xce4488})[_0xb6bb('0x17')](function(_0xa4fef){var _0x29ce36=path[_0xb6bb('0x51')](_0x9675df,'transcript-'+_0x4f2c97['id']+'-'+_0x41fef2+'.pdf');var _0xa80f2f={'path':_0x29ce36,'channel':'Sms','interactionId':_0x4f2c97['id']};return pdf[_0xb6bb('0x6f')](_0xa4fef,_0xa80f2f);})[_0xb6bb('0x17')](function(){return new BPromise(function(_0x1166ca,_0x3b1086){zipdir(_0x9675df,{'saveTo':_0x2dbb11},function(_0xf558ef,_0x13eff0){if(_0xf558ef)return _0x3b1086(_0xf558ef);return _0x1166ca(_0x13eff0);});})[_0xb6bb('0x17')](function(){return new BPromise(function(_0x347c09,_0x537429){rimraf(_0x9675df,function(_0x465aad){if(_0x465aad)_0x537429(_0x465aad);return _0x347c09();});});})[_0xb6bb('0x17')](function(){return _0x2ef9ac[_0xb6bb('0x50')](_0x2dbb11,_0x464e18,function(_0x4806db){if(_0x4806db){console[_0xb6bb('0x70')](_0xb6bb('0x71'),_0x4806db);}else{fs[_0xb6bb('0x72')](_0x2dbb11);}});});});}else{return _0x2ef9ac['sendStatus'](0xc8);}})[_0xb6bb('0x26')](handleError(_0x2ef9ac,null));}; \ No newline at end of file +var _0xb018=['../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','sort','where','pick','SmsInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','direction','secret','Account','Owner','get','mkdirSync','createdAt','closed','closedAt','disposition','Messages','out','System','lastName','read','value','views','Sms','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment'];(function(_0x27d96c,_0x3419be){var _0x33ef6d=function(_0x58654d){while(--_0x58654d){_0x27d96c['push'](_0x27d96c['shift']());}};_0x33ef6d(++_0x3419be);}(_0xb018,0x6b));var _0x8b01=function(_0x223d90,_0x3d10c4){_0x223d90=_0x223d90-0x0;var _0x1cc144=_0xb018[_0x223d90];return _0x1cc144;};'use strict';var rimraf=require(_0x8b01('0x0'));var zipdir=require(_0x8b01('0x1'));var moment=require('moment');var BPromise=require(_0x8b01('0x2'));var util=require(_0x8b01('0x3'));var path=require(_0x8b01('0x4'));var ejs=require(_0x8b01('0x5'));var fs=require('fs');var _=require(_0x8b01('0x6'));var Redis=require(_0x8b01('0x7'));var interaction=require(_0x8b01('0x8'));var qs=require(_0x8b01('0x9'));var pdf=require(_0x8b01('0xa'));var logger=require('../../config/logger')('api');var config=require(_0x8b01('0xb'));var db=require(_0x8b01('0xc'))['db'];config[_0x8b01('0xd')]=_[_0x8b01('0xe')](config[_0x8b01('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b01('0xf'))(new Redis(config[_0x8b01('0xd')]));require(_0x8b01('0x10'))[_0x8b01('0x11')](socket);function respondWithStatusCode(_0x106719,_0xec0f68){_0xec0f68=_0xec0f68||0xcc;return function(_0x1d5014){if(_0x1d5014){return _0x106719[_0x8b01('0x12')](_0xec0f68);}return _0x106719['status'](_0xec0f68)[_0x8b01('0x13')]();};}function respondWithResult(_0x23aca9,_0x412c32){_0x412c32=_0x412c32||0xc8;return function(_0x35164e){if(_0x35164e){return _0x23aca9[_0x8b01('0x14')](_0x412c32)[_0x8b01('0x15')](_0x35164e);}};}function respondWithFilteredResult(_0x1c9423,_0x1f1fc6){return function(_0x20bf58){if(_0x20bf58){var _0x258bbb=typeof _0x1f1fc6[_0x8b01('0x16')]===_0x8b01('0x17')&&typeof _0x1f1fc6[_0x8b01('0x18')]===_0x8b01('0x17');var _0x5e398a=_0x20bf58[_0x8b01('0x19')];var _0x3eb107=_0x258bbb?0x0:_0x1f1fc6['offset'];var _0x1fbb50=_0x258bbb?_0x20bf58[_0x8b01('0x19')]:_0x1f1fc6[_0x8b01('0x16')]+_0x1f1fc6['limit'];var _0x1b2f67;if(_0x1fbb50>=_0x5e398a){_0x1fbb50=_0x5e398a;_0x1b2f67=0xc8;}else{_0x1b2f67=0xce;}_0x1c9423[_0x8b01('0x14')](_0x1b2f67);return _0x1c9423[_0x8b01('0x1a')](_0x8b01('0x1b'),_0x3eb107+'-'+_0x1fbb50+'/'+_0x5e398a)[_0x8b01('0x15')](_0x20bf58);}return null;};}function saveUpdates(_0x138987){return function(_0x5428ac){if(_0x5428ac){return _0x5428ac[_0x8b01('0x1c')](_0x138987)[_0x8b01('0x1d')](function(_0x44ee59){return _0x44ee59;});}return null;};}function removeEntity(_0x25f0f2){return function(_0x3c9604){if(_0x3c9604){return _0x3c9604[_0x8b01('0x1e')]()[_0x8b01('0x1d')](function(){_0x25f0f2[_0x8b01('0x14')](0xcc)[_0x8b01('0x13')]();});}};}function handleEntityNotFound(_0x252627){return function(_0x28cca3){if(!_0x28cca3){_0x252627[_0x8b01('0x12')](0x194);}return _0x28cca3;};}function handleError(_0x237ecd,_0x119069){_0x119069=_0x119069||0x1f4;return function(_0x243a07){logger['error'](_0x243a07['stack']);if(_0x243a07[_0x8b01('0x1f')]){delete _0x243a07[_0x8b01('0x1f')];}_0x237ecd[_0x8b01('0x14')](_0x119069)['send'](_0x243a07);};}exports['index']=function(_0xe373d4,_0x31d750){var _0x1dbfd5={};var _0x298e19=_['map'](db[_0x8b01('0x20')]['rawAttributes'],function(_0x5a7c8e){return{'name':_0x5a7c8e[_0x8b01('0x21')],'type':_0x5a7c8e[_0x8b01('0x22')][_0x8b01('0x23')]};});_0x1dbfd5=qs[_0x8b01('0x24')](_0x298e19,_0xe373d4);return interaction[_0x8b01('0x25')](_0x8b01('0x26'),_0xe373d4[_0x8b01('0x27')],_0xe373d4[_0x8b01('0x28')],_0x1dbfd5,_0x298e19)[_0x8b01('0x1d')](respondWithFilteredResult(_0x31d750,_0x1dbfd5))[_0x8b01('0x29')](handleError(_0x31d750,null));};exports[_0x8b01('0x2a')]=function(_0x1fcc17,_0x14216e){var _0x2aad64={'raw':![],'where':{'id':_0x1fcc17[_0x8b01('0x2b')]['id']}},_0x4511b6={};_0x4511b6[_0x8b01('0x2c')]=_[_0x8b01('0x2d')](db['SmsInteraction'][_0x8b01('0x2e')]);_0x4511b6[_0x8b01('0x27')]=_[_0x8b01('0x2d')](_0x1fcc17['query']);_0x4511b6[_0x8b01('0x2f')]=_['intersection'](_0x4511b6[_0x8b01('0x2c')],_0x4511b6['query']);_0x2aad64[_0x8b01('0x30')]=_[_0x8b01('0x31')](_0x4511b6['model'],qs[_0x8b01('0x32')](_0x1fcc17[_0x8b01('0x27')][_0x8b01('0x32')]));_0x2aad64['attributes']=_0x2aad64[_0x8b01('0x30')][_0x8b01('0x33')]?_0x2aad64['attributes']:_0x4511b6[_0x8b01('0x2c')];if(_0x1fcc17[_0x8b01('0x27')][_0x8b01('0x34')]){_0x2aad64[_0x8b01('0x35')]=[{'all':!![]}];}_0x2aad64=_[_0x8b01('0x36')]({},_0x2aad64,_0x1fcc17[_0x8b01('0x37')]);return db[_0x8b01('0x20')]['find'](_0x2aad64)[_0x8b01('0x1d')](handleEntityNotFound(_0x14216e,null))['then'](respondWithResult(_0x14216e,null))[_0x8b01('0x29')](handleError(_0x14216e,null));};exports[_0x8b01('0x38')]=function(_0x1701c6,_0xb01f80){return db['SmsInteraction'][_0x8b01('0x38')](_0x1701c6['body'],{})[_0x8b01('0x1d')](respondWithResult(_0xb01f80,0xc9))['catch'](handleError(_0xb01f80,null));};exports['update']=function(_0x43f4c3,_0x3a7a78){if(_0x43f4c3[_0x8b01('0x39')]['id']){delete _0x43f4c3[_0x8b01('0x39')]['id'];}return db[_0x8b01('0x20')][_0x8b01('0x3a')]({'where':{'id':_0x43f4c3['params']['id']}})[_0x8b01('0x1d')](handleEntityNotFound(_0x3a7a78,null))[_0x8b01('0x1d')](saveUpdates(_0x43f4c3[_0x8b01('0x39')],null))[_0x8b01('0x1d')](respondWithResult(_0x3a7a78,null))[_0x8b01('0x29')](handleError(_0x3a7a78,null));};exports[_0x8b01('0x1e')]=function(_0x367bfb,_0x5d4838){return db[_0x8b01('0x20')]['find']({'where':{'id':_0x367bfb[_0x8b01('0x2b')]['id']}})[_0x8b01('0x1d')](handleEntityNotFound(_0x5d4838,null))['then'](removeEntity(_0x5d4838,null))[_0x8b01('0x29')](handleError(_0x5d4838,null));};exports[_0x8b01('0x3b')]=function(_0x164df9,_0x2df803){return db[_0x8b01('0x20')][_0x8b01('0x3b')]()[_0x8b01('0x1d')](respondWithResult(_0x2df803,null))[_0x8b01('0x29')](handleError(_0x2df803,null));};exports[_0x8b01('0x3c')]=function(_0x2f5ccd,_0x137661){return db[_0x8b01('0x3d')][_0x8b01('0x3a')]({'where':{'id':_0x2f5ccd['params']['id']}})[_0x8b01('0x1d')](handleEntityNotFound(_0x137661,null))[_0x8b01('0x1d')](function(_0x3c4473){if(_0x3c4473){return _0x3c4473['addMessage'](_0x2f5ccd[_0x8b01('0x39')][_0x8b01('0x3e')],_[_0x8b01('0x3f')](_0x2f5ccd['body'],[_0x8b01('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x137661,null))['catch'](handleError(_0x137661,null));};exports['getMessages']=function(_0x2fb6d5,_0x236d20){var _0xc88035={'raw':![],'where':{}};var _0x113583={};var _0x487ba3={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8b01('0x40')]({'where':{'id':_0x2fb6d5[_0x8b01('0x2b')]['id']}})[_0x8b01('0x1d')](handleEntityNotFound(_0x236d20,null))['then'](function(_0x4a4590){if(_0x4a4590){_0x113583[_0x8b01('0x2c')]=_[_0x8b01('0x2d')](db[_0x8b01('0x3d')]['rawAttributes']);_0x113583[_0x8b01('0x27')]=_['keys'](_0x2fb6d5[_0x8b01('0x27')]);_0x113583[_0x8b01('0x2f')]=_[_0x8b01('0x31')](_0x113583['model'],_0x113583[_0x8b01('0x27')]);_0xc88035[_0x8b01('0x30')]=_[_0x8b01('0x31')](_0x113583[_0x8b01('0x2c')],qs[_0x8b01('0x32')](_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x32')]));_0xc88035[_0x8b01('0x30')]=_0xc88035[_0x8b01('0x30')][_0x8b01('0x33')]?_0xc88035['attributes']:_0x113583['model'];if(!_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x41')]('nolimit')){_0xc88035[_0x8b01('0x18')]=qs['limit'](_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x18')]);_0xc88035['offset']=qs[_0x8b01('0x16')](_0x2fb6d5['query'][_0x8b01('0x16')]);}_0xc88035['order']=qs[_0x8b01('0x42')](_0x2fb6d5['query']['sort']);_0xc88035[_0x8b01('0x43')]=qs[_0x8b01('0x2f')](_[_0x8b01('0x44')](_0x2fb6d5['query'],_0x113583['filters']));_0xc88035[_0x8b01('0x43')][_0x8b01('0x45')]=_0x4a4590['id'];if(_0x2fb6d5[_0x8b01('0x27')]['filter']){_0xc88035[_0x8b01('0x43')]=_['merge'](_0xc88035[_0x8b01('0x43')],{'$or':_[_0x8b01('0x46')](_0xc88035[_0x8b01('0x30')],function(_0x4f1b7b){var _0x12b590={};_0x12b590[_0x4f1b7b]={'$like':'%'+_0x2fb6d5['query'][_0x8b01('0x47')]+'%'};return _0x12b590;})});}if(_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x48')]){var _0x4f73c2=_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x48')][_0x8b01('0x49')](',');var _0x4f7f78={};_0x4f7f78[_0x4f73c2[0x0]]={'$gte':moment(_0x4f73c2[0x1])[_0x8b01('0x4a')](_0x8b01('0x4b'))};_0xc88035[_0x8b01('0x43')]=_[_0x8b01('0x36')](_0xc88035[_0x8b01('0x43')],_0x4f7f78);}_0xc88035=_['merge']({},_0xc88035,_0x2fb6d5[_0x8b01('0x37')]);return db[_0x8b01('0x3d')]['count']({'where':_0xc88035[_0x8b01('0x43')]})[_0x8b01('0x1d')](function(_0x43a9b0){_0x487ba3['count']=_0x43a9b0;if(_0x2fb6d5[_0x8b01('0x27')][_0x8b01('0x34')]){_0xc88035[_0x8b01('0x35')]=[{'all':!![]}];}return db[_0x8b01('0x3d')][_0x8b01('0x25')](_0xc88035);})[_0x8b01('0x1d')](function(_0x3bc464){_0x487ba3[_0x8b01('0x4c')]=_0x3bc464;return _0x487ba3;});}})[_0x8b01('0x1d')](respondWithFilteredResult(_0x236d20,_0xc88035))['catch'](handleError(_0x236d20,null));};exports[_0x8b01('0x4d')]=function(_0x5a84fc,_0x26b7cd){return db[_0x8b01('0x20')][_0x8b01('0x3a')]({'where':{'id':_0x5a84fc[_0x8b01('0x2b')]['id']}})['then'](handleEntityNotFound(_0x26b7cd,null))[_0x8b01('0x1d')](function(_0x1a45f0){if(_0x1a45f0){return _0x1a45f0[_0x8b01('0x4e')](_0x5a84fc[_0x8b01('0x39')][_0x8b01('0x3e')],_['omit'](_0x5a84fc[_0x8b01('0x39')],[_0x8b01('0x3e'),'id'])||{})[_0x8b01('0x4f')](function(){return db[_0x8b01('0x50')][_0x8b01('0x25')]({'attributes':['id',_0x8b01('0x1f'),'color'],'where':{'id':_0x5a84fc[_0x8b01('0x39')][_0x8b01('0x3e')]}});})[_0x8b01('0x1d')](function(_0x5b389a){socket[_0x8b01('0x51')](_0x8b01('0x52'),{'id':Number(_0x5a84fc[_0x8b01('0x2b')]['id']),'tags':_0x5b389a||[]});return{'id':Number(_0x5a84fc[_0x8b01('0x2b')]['id']),'tags':_0x5b389a||[]};});}})[_0x8b01('0x1d')](respondWithResult(_0x26b7cd,null))[_0x8b01('0x29')](handleError(_0x26b7cd,null));};exports[_0x8b01('0x53')]=function(_0x226b54,_0x50f5af){return db[_0x8b01('0x20')][_0x8b01('0x3a')]({'where':{'id':_0x226b54[_0x8b01('0x2b')]['id']}})[_0x8b01('0x1d')](handleEntityNotFound(_0x50f5af,null))[_0x8b01('0x1d')](function(_0x54600c){if(_0x54600c){return _0x54600c['removeTags'](_0x226b54[_0x8b01('0x27')][_0x8b01('0x3e')]);}})[_0x8b01('0x1d')](respondWithStatusCode(_0x50f5af,null))[_0x8b01('0x29')](handleError(_0x50f5af,null));};exports[_0x8b01('0x54')]=function(_0xb9e71a,_0x1c989a){var _0x252135=moment()[_0x8b01('0x55')]()[_0x8b01('0x56')]();var _0x113416=path[_0x8b01('0x57')](config[_0x8b01('0x58')],_0x8b01('0x59'),'files',_0x8b01('0x5a'));var _0x13b838=path[_0x8b01('0x57')](_0x113416,_0x252135);var _0x4422c0=util[_0x8b01('0x4a')](_0x8b01('0x5b'),_0xb9e71a['params']['id'],_0x252135);var _0x4d9ee0=path[_0x8b01('0x57')](_0x113416,_0x4422c0);var _0x3b52ef=[];_0x3b52ef[_0x8b01('0x5c')]({'model':db[_0x8b01('0x5d')],'as':_0x8b01('0x5d'),'attributes':['id',_0x8b01('0x5e')],'raw':!![]});_0x3b52ef[_0x8b01('0x5c')]({'model':db[_0x8b01('0x5f')],'as':_0x8b01('0x60'),'attributes':['id',_0x8b01('0x61'),'lastName'],'raw':!![]});var _0x3f2183=[{'model':db[_0x8b01('0x3d')],'as':'Messages','attributes':['id','body','createdAt',_0x8b01('0x62'),_0x8b01('0x63'),'read'],'include':_0x3b52ef}];_0x3f2183[_0x8b01('0x5c')]({'model':db['SmsAccount'],'as':_0x8b01('0x64'),'attributes':['id','name']});_0x3f2183[_0x8b01('0x5c')]({'model':db['User'],'as':_0x8b01('0x65'),'attributes':['id',_0x8b01('0x5e')]});return db[_0x8b01('0x20')][_0x8b01('0x3a')]({'where':{'id':_0xb9e71a[_0x8b01('0x2b')]['id']},'include':_0x3f2183})['then'](handleEntityNotFound(_0x1c989a,null))[_0x8b01('0x1d')](function(_0x3a8052){if(_0x3a8052){var _0x7bcae7=_0x3a8052[_0x8b01('0x66')]({'plain':!![]});fs[_0x8b01('0x67')](_0x13b838);var _0x483416={'channel':'Sms','account':_0x7bcae7[_0x8b01('0x64')][_0x8b01('0x1f')],'agent':_0x7bcae7[_0x8b01('0x65')]?_0x7bcae7['Owner'][_0x8b01('0x5e')]:'N.A.','createdAt':moment(_0x7bcae7[_0x8b01('0x68')])[_0x8b01('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8b01('0x56')](),'closedAt':_0x7bcae7[_0x8b01('0x69')]?moment(_0x7bcae7[_0x8b01('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x7bcae7[_0x8b01('0x6b')],'messages':_(_0x7bcae7[_0x8b01('0x6c')])[_0x8b01('0x47')]({'secret':![]})['map'](function(_0x4d5d9f){return{'date':moment(_0x4d5d9f[_0x8b01('0x68')])['format'](_0x8b01('0x4b'))['toString'](),'sender':_0x4d5d9f['direction']===_0x8b01('0x6d')?_0x4d5d9f[_0x8b01('0x5d')]?_0x4d5d9f[_0x8b01('0x5d')][_0x8b01('0x5e')]:_0x8b01('0x6e'):_0x4d5d9f[_0x8b01('0x60')]['firstName']+(_0x4d5d9f[_0x8b01('0x60')][_0x8b01('0x6f')]?'\x20'+_0x4d5d9f['Contact'][_0x8b01('0x6f')]:''),'body':_0x4d5d9f[_0x8b01('0x39')],'direction':_0x4d5d9f[_0x8b01('0x62')]===_0x8b01('0x6d')?'A':'C','secret':_0x4d5d9f['secret'],'read':_0x4d5d9f[_0x8b01('0x70')]};})[_0x8b01('0x71')]()};return ejs['renderFile'](path[_0x8b01('0x57')](config[_0x8b01('0x58')],'server',_0x8b01('0x72'),'downloadInteraction.ejs'),{'interaction':_0x483416})[_0x8b01('0x1d')](function(_0x8bf610){var _0x5d6fde=path[_0x8b01('0x57')](_0x13b838,'transcript-'+_0x7bcae7['id']+'-'+_0x252135+'.pdf');var _0x658df3={'path':_0x5d6fde,'channel':_0x8b01('0x73'),'interactionId':_0x7bcae7['id']};return pdf[_0x8b01('0x74')](_0x8bf610,_0x658df3);})['then'](function(){return new BPromise(function(_0x29d84a,_0x32687a){zipdir(_0x13b838,{'saveTo':_0x4d9ee0},function(_0x7780f2,_0x128ff1){if(_0x7780f2)return _0x32687a(_0x7780f2);return _0x29d84a(_0x128ff1);});})[_0x8b01('0x1d')](function(){return new BPromise(function(_0x4c9018,_0x564d50){rimraf(_0x13b838,function(_0x59b98b){if(_0x59b98b)_0x564d50(_0x59b98b);return _0x4c9018();});});})[_0x8b01('0x1d')](function(){return _0x1c989a[_0x8b01('0x54')](_0x4d9ee0,_0x4422c0,function(_0x39db68){if(_0x39db68){console[_0x8b01('0x75')](_0x8b01('0x76'),_0x39db68);}else{fs['unlinkSync'](_0x4d9ee0);}});});});}else{return _0x1c989a[_0x8b01('0x12')](0xc8);}})['catch'](handleError(_0x1c989a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a9112f8..465830c 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 _0x056b=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x5bbfe9,_0x38cc04){var _0x589e98=function(_0x3f259d){while(--_0x3f259d){_0x5bbfe9['push'](_0x5bbfe9['shift']());}};_0x589e98(++_0x38cc04);}(_0x056b,0xb6));var _0xb056=function(_0x39df6e,_0x548a5a){_0x39df6e=_0x39df6e-0x0;var _0xcbceb6=_0x056b[_0x39df6e];return _0xcbceb6;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var SmsMessage=require(_0xb056('0x0'))['db'][_0xb056('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb056('0x3')](0x0);var events={'afterCreate':_0xb056('0x4'),'afterUpdate':_0xb056('0x5'),'afterDestroy':_0xb056('0x6')};function emitEvent(_0x343d88){return function(_0x2ff09d,_0x15a545,_0x515612){_0x2ff09d[_0xb056('0x7')]({'attributes':['id'],'raw':!![]})[_0xb056('0x8')](function(_0x3eae69){_0x2ff09d[_0xb056('0x9')](_0xb056('0xa'),_0x3eae69[_0xb056('0xb')](function(_0x539126){return{'id':_0x539126['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2ff09d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb056('0x8')](function(_0x160c2a){_0x2ff09d[_0xb056('0x9')](_0xb056('0xc'),_0x160c2a['length']);SmsInteractionEvents[_0xb056('0xd')](_0x343d88+':'+_0x2ff09d['id'],_0x2ff09d);SmsInteractionEvents['emit'](_0x343d88,_0x2ff09d);_0x515612(null);})[_0xb056('0xe')](_0x515612(null));};}for(var e in events){if(events[_0xb056('0xf')](e)){var event=events[e];SmsInteraction[_0xb056('0x10')](e,emitEvent(event));}}module[_0xb056('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xe820=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x34a66a,_0x55df56){var _0x5b62de=function(_0x139ef9){while(--_0x139ef9){_0x34a66a['push'](_0x34a66a['shift']());}};_0x5b62de(++_0x55df56);}(_0xe820,0xd2));var _0x0e82=function(_0x4ac1e5,_0x246f8b){_0x4ac1e5=_0x4ac1e5-0x0;var _0x24a309=_0xe820[_0x4ac1e5];return _0x24a309;};'use strict';var EventEmitter=require(_0x0e82('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x0e82('0x1')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0e82('0x2')](0x0);var events={'afterCreate':_0x0e82('0x3'),'afterUpdate':_0x0e82('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc6d61e){return function(_0x5de50f,_0x2cb88f,_0x105e3c){_0x5de50f[_0x0e82('0x5')]({'attributes':['id'],'raw':!![]})[_0x0e82('0x6')](function(_0x2a0f9b){_0x5de50f['setDataValue'](_0x0e82('0x7'),_0x2a0f9b[_0x0e82('0x8')](function(_0x2c0d6d){return{'id':_0x2c0d6d['id']};}));return SmsMessage[_0x0e82('0x9')]({'where':{'SmsInteractionId':_0x5de50f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e82('0x6')](function(_0x4b3302){_0x5de50f[_0x0e82('0xa')](_0x0e82('0xb'),_0x4b3302[_0x0e82('0xc')]);SmsInteractionEvents[_0x0e82('0xd')](_0xc6d61e+':'+_0x5de50f['id'],_0x5de50f);SmsInteractionEvents[_0x0e82('0xd')](_0xc6d61e,_0x5de50f);_0x105e3c(null);})[_0x0e82('0xe')](_0x105e3c(null));};}for(var e in events){if(events[_0x0e82('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0e82('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 3735239..d1cc6d3 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 _0xeffd=['lodash','util','../../config/logger','api','moment','bluebird','path','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4d173e,_0x2cba6d){var _0x6a26a0=function(_0x28e530){while(--_0x28e530){_0x4d173e['push'](_0x4d173e['shift']());}};_0x6a26a0(++_0x2cba6d);}(_0xeffd,0x1c0));var _0xdeff=function(_0x1afd68,_0x2b104f){_0x1afd68=_0x1afd68-0x0;var _0x12cb3a=_0xeffd[_0x1afd68];return _0x12cb3a;};'use strict';var _=require(_0xdeff('0x0'));var util=require(_0xdeff('0x1'));var logger=require(_0xdeff('0x2'))(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdeff('0x7'));module[_0xdeff('0x8')]=function(_0x1fdf2e,_0x56a85e){return _0x1fdf2e['define'](_0xdeff('0x9'),attributes,{'tableName':_0xdeff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25c526,_0x23e44d,_0x34fd76){if(_0x25c526[_0xdeff('0xb')](_0xdeff('0xc'))){_0x25c526[_0xdeff('0xd')]=moment()[_0xdeff('0xe')](_0xdeff('0xf'));}_0x34fd76(null,_0x25c526);}}});}; \ No newline at end of file +var _0x3e7b=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','closedAt','format','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1ae022,_0x4bea59){var _0x51f769=function(_0x48fa2b){while(--_0x48fa2b){_0x1ae022['push'](_0x1ae022['shift']());}};_0x51f769(++_0x4bea59);}(_0x3e7b,0xa8));var _0xb3e7=function(_0x1d021f,_0xfd197e){_0x1d021f=_0x1d021f-0x0;var _0xa92373=_0x3e7b[_0x1d021f];return _0xa92373;};'use strict';var _=require(_0xb3e7('0x0'));var util=require(_0xb3e7('0x1'));var logger=require(_0xb3e7('0x2'))(_0xb3e7('0x3'));var moment=require(_0xb3e7('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3e7('0x5'));var fs=require('fs');var path=require(_0xb3e7('0x6'));var rimraf=require(_0xb3e7('0x7'));var config=require(_0xb3e7('0x8'));var attributes=require(_0xb3e7('0x9'));module[_0xb3e7('0xa')]=function(_0x521ffa,_0x12247d){return _0x521ffa[_0xb3e7('0xb')](_0xb3e7('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508542,_0xc952c7,_0x15799e){if(_0x508542['changed'](_0xb3e7('0xd'))){_0x508542[_0xb3e7('0xe')]=moment()[_0xb3e7('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x15799e(null,_0x508542);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6b17205..57928d6 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 _0x00ba=['SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','body','options','raw','attributes','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x00ba,0x1a4));var _0xa00b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x00ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa00b('0x0'));var util=require(_0xa00b('0x1'));var moment=require(_0xa00b('0x2'));var BPromise=require(_0xa00b('0x3'));var rs=require(_0xa00b('0x4'));var fs=require('fs');var Redis=require(_0xa00b('0x5'));var db=require(_0xa00b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa00b('0x7'))(_0xa00b('0x8'));var config=require('../../config/environment');var jayson=require(_0xa00b('0x9'));var client=jayson[_0xa00b('0xa')][_0xa00b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa00b('0xc')],{'host':_0xa00b('0xd'),'port':0x18eb});var socket=require(_0xa00b('0xe'))(new Redis(config[_0xa00b('0xc')]));require(_0xa00b('0xf'))[_0xa00b('0x10')](socket);function respondWithRpcPromise(_0x999973,_0xe135a0,_0x259dfa){return new BPromise(function(_0x4102c5,_0x1eeb7e){return client[_0xa00b('0x11')](_0x999973,_0x259dfa)[_0xa00b('0x12')](function(_0x2aef83){logger[_0xa00b('0x13')](_0xa00b('0x14'),_0xe135a0,'request\x20sent');logger['debug'](_0xa00b('0x15'),_0xe135a0,_0xa00b('0x16'),JSON[_0xa00b('0x17')](_0x2aef83));if(_0x2aef83[_0xa00b('0x18')]){if(_0x2aef83['error'][_0xa00b('0x19')]===0x1f4){logger[_0xa00b('0x18')](_0xa00b('0x14'),_0xe135a0,_0x2aef83[_0xa00b('0x18')][_0xa00b('0x1a')]);return _0x1eeb7e(_0x2aef83['error'][_0xa00b('0x1a')]);}logger[_0xa00b('0x18')](_0xa00b('0x14'),_0xe135a0,_0x2aef83[_0xa00b('0x18')]['message']);return _0x4102c5(_0x2aef83[_0xa00b('0x18')][_0xa00b('0x1a')]);}else{logger['info'](_0xa00b('0x14'),_0xe135a0,_0xa00b('0x16'));_0x4102c5(_0x2aef83[_0xa00b('0x1b')]['message']);}})[_0xa00b('0x1c')](function(_0x33b9bc){logger['error']('SmsInteraction,\x20%s,\x20%s',_0xe135a0,_0x33b9bc);_0x1eeb7e(_0x33b9bc);});});}exports['UpdateSmsInteraction']=function(_0x4656cb){var _0x23c0b9=this;return new Promise(function(_0x5c3e12,_0x47030b){return db['SmsInteraction'][_0xa00b('0x1d')](_0x4656cb[_0xa00b('0x1e')],{'raw':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb['options'][_0xa00b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb[_0xa00b('0x1f')]['where']||null:null,'attributes':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb['options'][_0xa00b('0x21')]||null:null,'limit':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb[_0xa00b('0x1f')]['limit']||null:null})[_0xa00b('0x12')](function(_0x496872){logger[_0xa00b('0x13')]('UpdateSmsInteraction',_0x4656cb);logger[_0xa00b('0x22')]('UpdateSmsInteraction',_0x4656cb,JSON['stringify'](_0x496872));_0x5c3e12(_0x496872);})[_0xa00b('0x1c')](function(_0x24f33d){logger[_0xa00b('0x18')](_0xa00b('0x23'),_0x24f33d[_0xa00b('0x1a')],_0x4656cb);_0x47030b(_0x23c0b9[_0xa00b('0x18')](0x1f4,_0x24f33d[_0xa00b('0x1a')]));});});};exports[_0xa00b('0x24')]=function(_0x41ff75){return new Promise(function(_0x53ade5,_0x5636ea){return db[_0xa00b('0x25')][_0xa00b('0x26')]({'where':_0x41ff75[_0xa00b('0x1f')]?_0x41ff75[_0xa00b('0x1f')][_0xa00b('0x27')]||null:null})['then'](function(_0x2adb1e){if(_0x2adb1e){return _0x2adb1e['addTags'](_0x41ff75[_0xa00b('0x1e')][_0xa00b('0x28')],_[_0xa00b('0x29')](_0x41ff75[_0xa00b('0x1e')],['ids','id'])||{});}})[_0xa00b('0x2a')](function(_0x30c67d){logger[_0xa00b('0x13')](_0xa00b('0x2b'),_0x41ff75);logger[_0xa00b('0x22')](_0xa00b('0x2b'),_0x41ff75,JSON[_0xa00b('0x17')](_0x30c67d));_0x53ade5(_0x30c67d);})[_0xa00b('0x1c')](function(_0x4faf9d){logger[_0xa00b('0x18')](_0xa00b('0x2b'),_0x4faf9d['message'],_0x41ff75);_0x5636ea(_this[_0xa00b('0x18')](0x1f4,_0x4faf9d[_0xa00b('0x1a')]));});});}; \ No newline at end of file +var _0x6605=['AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','SmsInteraction','update','body','options','raw','where','attributes','UpdateSmsInteraction','catch','AddTagsToSmsInteraction','find','addTags','ids','omit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6605,0x120));var _0x5660=function(_0x4210d0,_0xeb5b0a){_0x4210d0=_0x4210d0-0x0;var _0x8af8bc=_0x6605[_0x4210d0];return _0x8af8bc;};'use strict';var _=require(_0x5660('0x0'));var util=require('util');var moment=require(_0x5660('0x1'));var BPromise=require('bluebird');var rs=require(_0x5660('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5660('0x3'))['db'];var utils=require(_0x5660('0x4'));var logger=require(_0x5660('0x5'))(_0x5660('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5660('0x7')][_0x5660('0x8')]({'port':0x232a});config[_0x5660('0x9')]=_[_0x5660('0xa')](config['redis'],{'host':_0x5660('0xb'),'port':0x18eb});var socket=require(_0x5660('0xc'))(new Redis(config[_0x5660('0x9')]));require(_0x5660('0xd'))[_0x5660('0xe')](socket);function respondWithRpcPromise(_0x1cbbb3,_0x21913f,_0x49fe66){return new BPromise(function(_0x5193f2,_0x564641){return client[_0x5660('0xf')](_0x1cbbb3,_0x49fe66)[_0x5660('0x10')](function(_0x557663){logger[_0x5660('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x21913f,_0x5660('0x12'));logger[_0x5660('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x21913f,'request\x20sent',JSON[_0x5660('0x14')](_0x557663));if(_0x557663[_0x5660('0x15')]){if(_0x557663[_0x5660('0x15')][_0x5660('0x16')]===0x1f4){logger['error'](_0x5660('0x17'),_0x21913f,_0x557663['error'][_0x5660('0x18')]);return _0x564641(_0x557663[_0x5660('0x15')][_0x5660('0x18')]);}logger[_0x5660('0x15')](_0x5660('0x17'),_0x21913f,_0x557663[_0x5660('0x15')][_0x5660('0x18')]);return _0x5193f2(_0x557663[_0x5660('0x15')]['message']);}else{logger[_0x5660('0x11')](_0x5660('0x17'),_0x21913f,_0x5660('0x12'));_0x5193f2(_0x557663[_0x5660('0x19')][_0x5660('0x18')]);}})['catch'](function(_0x5d462d){logger['error'](_0x5660('0x17'),_0x21913f,_0x5d462d);_0x564641(_0x5d462d);});});}exports['UpdateSmsInteraction']=function(_0x3658d6){var _0x7b21db=this;return new Promise(function(_0x1a6110,_0x4d1dcc){return db[_0x5660('0x1a')][_0x5660('0x1b')](_0x3658d6[_0x5660('0x1c')],{'raw':_0x3658d6[_0x5660('0x1d')]?_0x3658d6[_0x5660('0x1d')][_0x5660('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3658d6[_0x5660('0x1d')]?_0x3658d6[_0x5660('0x1d')][_0x5660('0x1f')]||null:null,'attributes':_0x3658d6[_0x5660('0x1d')]?_0x3658d6['options'][_0x5660('0x20')]||null:null,'limit':_0x3658d6[_0x5660('0x1d')]?_0x3658d6[_0x5660('0x1d')]['limit']||null:null})['then'](function(_0x50c171){logger[_0x5660('0x11')](_0x5660('0x21'),_0x3658d6);logger['debug'](_0x5660('0x21'),_0x3658d6,JSON[_0x5660('0x14')](_0x50c171));_0x1a6110(_0x50c171);})[_0x5660('0x22')](function(_0x46c4ec){logger[_0x5660('0x15')](_0x5660('0x21'),_0x46c4ec[_0x5660('0x18')],_0x3658d6);_0x4d1dcc(_0x7b21db['error'](0x1f4,_0x46c4ec[_0x5660('0x18')]));});});};exports[_0x5660('0x23')]=function(_0x4a6820){return new Promise(function(_0x535932,_0x361a6b){return db[_0x5660('0x1a')][_0x5660('0x24')]({'where':_0x4a6820['options']?_0x4a6820[_0x5660('0x1d')][_0x5660('0x1f')]||null:null})[_0x5660('0x10')](function(_0x500ae9){if(_0x500ae9){return _0x500ae9[_0x5660('0x25')](_0x4a6820[_0x5660('0x1c')][_0x5660('0x26')],_[_0x5660('0x27')](_0x4a6820['body'],[_0x5660('0x26'),'id'])||{});}})['spread'](function(_0x9e74b2){logger[_0x5660('0x11')](_0x5660('0x28'),_0x4a6820);logger['debug'](_0x5660('0x28'),_0x4a6820,JSON[_0x5660('0x14')](_0x9e74b2));_0x535932(_0x9e74b2);})['catch'](function(_0x3c6e43){logger['error'](_0x5660('0x28'),_0x3c6e43[_0x5660('0x18')],_0x4a6820);_0x361a6b(_this['error'](0x1f4,_0x3c6e43['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2289481..9258a46 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 _0x9744=['remove','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x36fe00,_0x3ff5d0){var _0x34e1c2=function(_0xc7dc03){while(--_0xc7dc03){_0x36fe00['push'](_0x36fe00['shift']());}};_0x34e1c2(++_0x3ff5d0);}(_0x9744,0xa6));var _0x4974=function(_0x4cf5d8,_0x1f61ee){_0x4cf5d8=_0x4cf5d8-0x0;var _0x4f8cc0=_0x9744[_0x4cf5d8];return _0x4f8cc0;};'use strict';var SmsInteractionEvents=require(_0x4974('0x0'));var events=[_0x4974('0x1'),_0x4974('0x2'),'update'];function createListener(_0x670dc7,_0x495691){return function(_0x3f221f){_0x495691[_0x4974('0x3')](_0x670dc7,_0x3f221f);};}function removeListener(_0x2543b7,_0x4efd58){return function(){SmsInteractionEvents['removeListener'](_0x2543b7,_0x4efd58);};}exports[_0x4974('0x4')]=function(_0x4dd893){for(var _0x48a813=0x0,_0x5d4dfd=events[_0x4974('0x5')];_0x48a813<_0x5d4dfd;_0x48a813++){var _0x4ff22a=events[_0x48a813];var _0x2a0537=createListener(_0x4974('0x6')+_0x4ff22a,_0x4dd893);SmsInteractionEvents['on'](_0x4ff22a,_0x2a0537);}}; \ No newline at end of file +var _0x6d32=['./smsInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0xe45fef,_0x1ff738){var _0x36586a=function(_0x57e185){while(--_0x57e185){_0xe45fef['push'](_0xe45fef['shift']());}};_0x36586a(++_0x1ff738);}(_0x6d32,0xee));var _0x26d3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x6d32[_0x2e4aa2];return _0x5e6092;};'use strict';var SmsInteractionEvents=require(_0x26d3('0x0'));var events=['save',_0x26d3('0x1'),_0x26d3('0x2')];function createListener(_0x3349fa,_0xb04091){return function(_0x5a5640){_0xb04091[_0x26d3('0x3')](_0x3349fa,_0x5a5640);};}function removeListener(_0x233277,_0x50a3f0){return function(){SmsInteractionEvents[_0x26d3('0x4')](_0x233277,_0x50a3f0);};}exports[_0x26d3('0x5')]=function(_0x44848a){for(var _0x368ddc=0x0,_0x48562b=events[_0x26d3('0x6')];_0x368ddc<_0x48562b;_0x368ddc++){var _0x504618=events[_0x368ddc];var _0x5e110d=createListener('smsInteraction:'+_0x504618,_0x44848a);SmsInteractionEvents['on'](_0x504618,_0x5e110d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c8c493e..5ef0da2 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 _0x53f8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','show','post','sms','smsmessage:create','/:id/status','status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x53f8,0xf7));var _0x853f=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x53f8[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x853f('0x0'));var util=require(_0x853f('0x1'));var path=require('path');var timeout=require(_0x853f('0x2'));var express=require(_0x853f('0x3'));var router=express['Router']();var fs_extra=require(_0x853f('0x4'));var auth=require(_0x853f('0x5'));var interaction=require(_0x853f('0x6'));var config=require(_0x853f('0x7'));var controller=require(_0x853f('0x8'));router[_0x853f('0x9')]('/',auth[_0x853f('0xa')](),controller[_0x853f('0xb')]);router[_0x853f('0x9')](_0x853f('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x853f('0xa')](),controller[_0x853f('0xd')]);router[_0x853f('0xe')]('/',auth[_0x853f('0xa')](),interaction['tracked'](_0x853f('0xf'),_0x853f('0x10')),controller['create']);router['post'](_0x853f('0x11'),controller[_0x853f('0x12')]);router['put'](_0x853f('0x13'),auth[_0x853f('0xa')](),controller[_0x853f('0x14')]);router[_0x853f('0x15')](_0x853f('0x16'),auth[_0x853f('0xa')](),controller[_0x853f('0x17')]);router[_0x853f('0x15')](_0x853f('0x18'),auth[_0x853f('0xa')](),controller[_0x853f('0x19')]);router[_0x853f('0x1a')]('/:id',auth[_0x853f('0xa')](),controller[_0x853f('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8dae=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','smsmessage:create','create','/:id/status','status','update','/:id/reject','reject','destroy','exports','multer'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x8dae,0xa7));var _0xe8da=function(_0x219b57,_0x44e2c0){_0x219b57=_0x219b57-0x0;var _0x3457f5=_0x8dae[_0x219b57];return _0x3457f5;};'use strict';var multer=require(_0xe8da('0x0'));var util=require('util');var path=require(_0xe8da('0x1'));var timeout=require(_0xe8da('0x2'));var express=require(_0xe8da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8da('0x4'));var interaction=require(_0xe8da('0x5'));var config=require(_0xe8da('0x6'));var controller=require('./smsMessage.controller');router[_0xe8da('0x7')]('/',auth[_0xe8da('0x8')](),controller[_0xe8da('0x9')]);router[_0xe8da('0x7')](_0xe8da('0xa'),auth[_0xe8da('0x8')](),controller[_0xe8da('0xb')]);router['get'](_0xe8da('0xc'),auth['isAuthenticated'](),controller[_0xe8da('0xd')]);router[_0xe8da('0xe')]('/',auth[_0xe8da('0x8')](),interaction['tracked']('sms',_0xe8da('0xf')),controller[_0xe8da('0x10')]);router[_0xe8da('0xe')](_0xe8da('0x11'),controller[_0xe8da('0x12')]);router['put']('/:id',auth[_0xe8da('0x8')](),controller[_0xe8da('0x13')]);router['put']('/:id/accept',auth[_0xe8da('0x8')](),controller['accept']);router['put'](_0xe8da('0x14'),auth['isAuthenticated'](),controller[_0xe8da('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe8da('0x16')]);module[_0xe8da('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 902a235..3ee71fe 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 _0x5a05=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x579fba,_0x470bcd){var _0x4540d3=function(_0x3ed69f){while(--_0x3ed69f){_0x579fba['push'](_0x579fba['shift']());}};_0x4540d3(++_0x470bcd);}(_0x5a05,0x93));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x55a0('0x0'));module[_0x55a0('0x1')]={'body':{'type':Sequelize[_0x55a0('0x2')](_0x55a0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x55a0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55a0('0x5')]('in',_0x55a0('0x6')),'defaultValue':_0x55a0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x55a0('0x7')](0xbe)},'phone':{'type':Sequelize[_0x55a0('0x7')]},'readAt':{'type':Sequelize[_0x55a0('0x8')]},'secret':{'type':Sequelize[_0x55a0('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x55a0('0x7')]},'providerResponse':{'type':Sequelize[_0x55a0('0x2')]}}; \ No newline at end of file +var _0x2a1d=['TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x519f,_0x48a547){var _0x3a8345=function(_0x399f62){while(--_0x399f62){_0x519f['push'](_0x519f['shift']());}};_0x3a8345(++_0x48a547);}(_0x2a1d,0x113));var _0xd2a1=function(_0x43f4b8,_0x3c24a1){_0x43f4b8=_0x43f4b8-0x0;var _0x35d077=_0x2a1d[_0x43f4b8];return _0x35d077;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd2a1('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd2a1('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd2a1('0x2')]('in','out'),'defaultValue':_0xd2a1('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd2a1('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd2a1('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd2a1('0x4')]},'providerResponse':{'type':Sequelize[_0xd2a1('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2194f26..3e7d778 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 _0x61d0=['message','result','end','json','offset','undefined','limit','count','status','Content-Range','save','update','destroy','sendStatus','name','send','map','SmsMessage','rawAttributes','fieldName','key','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','SmsInteraction','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x61d0,0x187));var _0x061d=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0x61d0[_0x1460ab];return _0x1eeb5c;};'use strict';var emlformat=require(_0x061d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x061d('0x1'));var jsonpatch=require(_0x061d('0x2'));var rp=require('request-promise');var moment=require(_0x061d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x061d('0x4'));var util=require(_0x061d('0x5'));var path=require('path');var sox=require(_0x061d('0x6'));var csv=require(_0x061d('0x7'));var ejs=require(_0x061d('0x8'));var fs=require('fs');var fs_extra=require(_0x061d('0x9'));var _=require(_0x061d('0xa'));var squel=require(_0x061d('0xb'));var crypto=require(_0x061d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x061d('0xd'));var Papa=require('papaparse');var Redis=require(_0x061d('0xe'));var authService=require(_0x061d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x061d('0x10'));var hardwareService=require(_0x061d('0x11'));var logger=require(_0x061d('0x12'))(_0x061d('0x13'));var utils=require(_0x061d('0x14'));var config=require(_0x061d('0x15'));var licenseUtil=require(_0x061d('0x16'));var db=require('../../mysqldb')['db'];config[_0x061d('0x17')]=_[_0x061d('0x18')](config[_0x061d('0x17')],{'host':_0x061d('0x19'),'port':0x18eb});var socket=require(_0x061d('0x1a'))(new Redis(config[_0x061d('0x17')]));require(_0x061d('0x1b'))[_0x061d('0x1c')](socket);var jayson=require(_0x061d('0x1d'));var client=jayson[_0x061d('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x061d('0x1e')][_0x061d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x457423,_0x4f926b,_0x28a1db,_0x4fda9e){return new BPromise(function(_0x571fa8,_0x2195fe){var _0x25f253=_0x4fda9e||client;return _0x25f253[_0x061d('0x20')](_0x457423,_0x28a1db)[_0x061d('0x21')](function(_0x5d2472){logger[_0x061d('0x22')](_0x061d('0x23'),_0x4f926b,_0x061d('0x24'));logger['debug'](_0x061d('0x25'),_0x4f926b,_0x061d('0x24'),JSON[_0x061d('0x26')](_0x5d2472));if(_0x5d2472[_0x061d('0x27')]){if(_0x5d2472['error'][_0x061d('0x28')]===0x1f4){logger[_0x061d('0x27')]('SmsMessage,\x20%s,\x20%s',_0x4f926b,_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);return _0x2195fe(_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);}logger[_0x061d('0x27')](_0x061d('0x23'),_0x4f926b,_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);return _0x571fa8(_0x5d2472['error'][_0x061d('0x29')]);}else{logger[_0x061d('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4f926b,_0x061d('0x24'));_0x571fa8(_0x5d2472[_0x061d('0x2a')]['message']);}})['catch'](function(_0x300b39){logger[_0x061d('0x27')](_0x061d('0x23'),_0x4f926b,_0x300b39);_0x2195fe(_0x300b39);});});}function respondWithStatusCode(_0x2bace6,_0x267049){_0x267049=_0x267049||0xcc;return function(_0x41e3db){if(_0x41e3db){return _0x2bace6['sendStatus'](_0x267049);}return _0x2bace6['status'](_0x267049)[_0x061d('0x2b')]();};}function respondWithResult(_0x16f1db,_0x5be49a){_0x5be49a=_0x5be49a||0xc8;return function(_0x159c9d){if(_0x159c9d){return _0x16f1db['status'](_0x5be49a)[_0x061d('0x2c')](_0x159c9d);}};}function respondWithFilteredResult(_0x1d3d76,_0x2179d5){return function(_0x366188){if(_0x366188){var _0xc8f0cd=typeof _0x2179d5[_0x061d('0x2d')]===_0x061d('0x2e')&&typeof _0x2179d5[_0x061d('0x2f')]===_0x061d('0x2e');var _0x16f00c=_0x366188[_0x061d('0x30')];var _0xbf9d7b=_0xc8f0cd?0x0:_0x2179d5['offset'];var _0x17fd4a=_0xc8f0cd?_0x366188[_0x061d('0x30')]:_0x2179d5[_0x061d('0x2d')]+_0x2179d5[_0x061d('0x2f')];var _0x545d34;if(_0x17fd4a>=_0x16f00c){_0x17fd4a=_0x16f00c;_0x545d34=0xc8;}else{_0x545d34=0xce;}_0x1d3d76[_0x061d('0x31')](_0x545d34);return _0x1d3d76['set'](_0x061d('0x32'),_0xbf9d7b+'-'+_0x17fd4a+'/'+_0x16f00c)['json'](_0x366188);}return null;};}function patchUpdates(_0x3af042){return function(_0x3c00c0){try{jsonpatch['apply'](_0x3c00c0,_0x3af042,!![]);}catch(_0x3b32e0){return BPromise['reject'](_0x3b32e0);}return _0x3c00c0[_0x061d('0x33')]();};}function saveUpdates(_0x3376fe,_0x3f7f97){return function(_0xb09b02){if(_0xb09b02){return _0xb09b02[_0x061d('0x34')](_0x3376fe)['then'](function(_0x3d990c){return _0x3d990c;});}return null;};}function removeEntity(_0x157d64,_0x2cc972){return function(_0x25e14a){if(_0x25e14a){return _0x25e14a[_0x061d('0x35')]()[_0x061d('0x21')](function(){_0x157d64[_0x061d('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e79d7,_0xcf4749){return function(_0x4ebdb6){if(!_0x4ebdb6){_0x3e79d7[_0x061d('0x36')](0x194);}return _0x4ebdb6;};}function handleError(_0x4b7357,_0x3c85c5){_0x3c85c5=_0x3c85c5||0x1f4;return function(_0xf0cc3f){logger[_0x061d('0x27')](_0xf0cc3f['stack']);if(_0xf0cc3f[_0x061d('0x37')]){delete _0xf0cc3f[_0x061d('0x37')];}_0x4b7357[_0x061d('0x31')](_0x3c85c5)[_0x061d('0x38')](_0xf0cc3f);};}exports['index']=function(_0xdfcee7,_0x4426d3){var _0x461c55={},_0x197044={},_0x281c7a={'count':0x0,'rows':[]};var _0x32e81d=_[_0x061d('0x39')](db[_0x061d('0x3a')][_0x061d('0x3b')],function(_0x54d639){return{'name':_0x54d639[_0x061d('0x3c')],'type':_0x54d639['type'][_0x061d('0x3d')]};});_0x197044['model']=_[_0x061d('0x39')](_0x32e81d,_0x061d('0x37'));_0x197044['query']=_['keys'](_0xdfcee7['query']);_0x197044[_0x061d('0x3e')]=_[_0x061d('0x3f')](_0x197044['model'],_0x197044[_0x061d('0x40')]);_0x461c55[_0x061d('0x41')]=_[_0x061d('0x3f')](_0x197044[_0x061d('0x42')],qs[_0x061d('0x43')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x43')]));_0x461c55[_0x061d('0x41')]=_0x461c55[_0x061d('0x41')]['length']?_0x461c55[_0x061d('0x41')]:_0x197044['model'];if(!_0xdfcee7[_0x061d('0x40')][_0x061d('0x44')](_0x061d('0x45'))){_0x461c55['limit']=qs[_0x061d('0x2f')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x2f')]);_0x461c55['offset']=qs[_0x061d('0x2d')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x2d')]);}_0x461c55[_0x061d('0x46')]=qs[_0x061d('0x47')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x47')]);_0x461c55[_0x061d('0x48')]=qs[_0x061d('0x3e')](_[_0x061d('0x49')](_0xdfcee7[_0x061d('0x40')],_0x197044[_0x061d('0x3e')]),_0x32e81d);if(_0xdfcee7[_0x061d('0x40')]['filter']){_0x461c55['where']=_[_0x061d('0x4a')](_0x461c55['where'],{'$or':_[_0x061d('0x39')](_0x32e81d,function(_0x20453b){if(_0x20453b[_0x061d('0x4b')]!==_0x061d('0x4c')){var _0x240e0c={};_0x240e0c[_0x20453b[_0x061d('0x37')]]={'$like':'%'+_0xdfcee7[_0x061d('0x40')][_0x061d('0x4d')]+'%'};return _0x240e0c;}})});}_0x461c55=_[_0x061d('0x4a')]({},_0x461c55,_0xdfcee7['options']);var _0x5ee577={'where':_0x461c55['where']};return db[_0x061d('0x3a')][_0x061d('0x30')](_0x5ee577)[_0x061d('0x21')](function(_0x1818f4){_0x281c7a[_0x061d('0x30')]=_0x1818f4;if(_0xdfcee7[_0x061d('0x40')][_0x061d('0x4e')]){_0x461c55[_0x061d('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x061d('0x50')](_0x461c55);})['then'](function(_0x99924e){_0x281c7a[_0x061d('0x51')]=_0x99924e;return _0x281c7a;})[_0x061d('0x21')](respondWithFilteredResult(_0x4426d3,_0x461c55))[_0x061d('0x52')](handleError(_0x4426d3,null));};exports[_0x061d('0x53')]=function(_0x3e8551,_0x2c0d96){var _0x1f2423={'raw':!![],'where':{'id':_0x3e8551[_0x061d('0x54')]['id']}},_0x19c935={};_0x19c935['model']=_['keys'](db[_0x061d('0x3a')][_0x061d('0x3b')]);_0x19c935[_0x061d('0x40')]=_['keys'](_0x3e8551['query']);_0x19c935[_0x061d('0x3e')]=_[_0x061d('0x3f')](_0x19c935[_0x061d('0x42')],_0x19c935[_0x061d('0x40')]);_0x1f2423['attributes']=_['intersection'](_0x19c935[_0x061d('0x42')],qs[_0x061d('0x43')](_0x3e8551[_0x061d('0x40')][_0x061d('0x43')]));_0x1f2423[_0x061d('0x41')]=_0x1f2423['attributes']['length']?_0x1f2423['attributes']:_0x19c935['model'];if(_0x3e8551[_0x061d('0x40')][_0x061d('0x4e')]){_0x1f2423[_0x061d('0x4f')]=[{'all':!![]}];}_0x1f2423=_[_0x061d('0x4a')]({},_0x1f2423,_0x3e8551[_0x061d('0x55')]);return db[_0x061d('0x3a')][_0x061d('0x56')](_0x1f2423)['then'](handleEntityNotFound(_0x2c0d96,null))[_0x061d('0x21')](respondWithResult(_0x2c0d96,null))[_0x061d('0x52')](handleError(_0x2c0d96,null));};exports[_0x061d('0x57')]=function(_0x13b1cd,_0x372491){return db[_0x061d('0x3a')]['create'](_0x13b1cd[_0x061d('0x58')],{})[_0x061d('0x21')](respondWithResult(_0x372491,0xc9))[_0x061d('0x52')](handleError(_0x372491,null));};exports[_0x061d('0x34')]=function(_0x5de628,_0x141b62){if(_0x5de628['body']['id']){delete _0x5de628[_0x061d('0x58')]['id'];}return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0x5de628['params']['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x141b62,null))['then'](saveUpdates(_0x5de628[_0x061d('0x58')],null))[_0x061d('0x21')](respondWithResult(_0x141b62,null))[_0x061d('0x52')](handleError(_0x141b62,null));};exports[_0x061d('0x35')]=function(_0x2665b8,_0x41a215){return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0x2665b8['params']['id']}})['then'](handleEntityNotFound(_0x41a215,null))[_0x061d('0x21')](removeEntity(_0x41a215,null))[_0x061d('0x52')](handleError(_0x41a215,null));};exports[_0x061d('0x59')]=function(_0x2b06b2,_0x3126c6){return db[_0x061d('0x3a')]['describe']()[_0x061d('0x21')](respondWithResult(_0x3126c6,null))[_0x061d('0x52')](handleError(_0x3126c6,null));};var interaction_log=require('../../config/logger')(_0x061d('0x5a'));exports[_0x061d('0x5b')]=function(_0x512f67,_0x2d2067,_0x2f357d){var _0x18bd07={'agent':{},'channel':_0x061d('0x5c')};if(_0x512f67['body']['id']){delete _0x512f67[_0x061d('0x58')]['id'];}_0x512f67[_0x061d('0x58')][_0x061d('0x5d')]=!![];_0x512f67['body']['readAt']=moment()[_0x061d('0x5e')](_0x061d('0x5f'));_0x512f67[_0x061d('0x58')][_0x061d('0x60')]=_0x512f67[_0x061d('0x58')][_0x061d('0x60')]||_0x512f67[_0x061d('0x61')]['id'];_0x18bd07[_0x061d('0x62')]['id']=_0x512f67[_0x061d('0x58')][_0x061d('0x60')];return db[_0x061d('0x3a')]['find']({'where':{'id':_0x512f67['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d2067,null))['then'](saveUpdates(_0x512f67[_0x061d('0x58')],null))[_0x061d('0x21')](function(_0x485a57){if(_0x485a57){_0x18bd07[_0x061d('0x29')]=_0x485a57[_0x061d('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x061d('0x56')]({'where':{'id':_0x485a57[_0x061d('0x64')]}});}return null;})[_0x061d('0x21')](handleEntityNotFound(_0x2d2067,null))[_0x061d('0x21')](function(_0x27de9b){if(_0x27de9b){return _0x27de9b['update']({'UserId':_0x512f67[_0x061d('0x58')][_0x061d('0x60')],'read1stAt':_['isNil'](_0x27de9b[_0x061d('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x061d('0x21')](function(_0x4ae03d){if(_0x4ae03d){_0x18bd07[_0x061d('0x66')]=_0x4ae03d[_0x061d('0x63')]({'plain':!![]});interaction_log[_0x061d('0x22')](_0x061d('0x67'),_0x512f67[_0x061d('0x61')]['id'],_0x512f67[_0x061d('0x61')][_0x061d('0x37')],_0x512f67['user'][_0x061d('0x68')],_0x18bd07[_0x061d('0x66')]['id'],_0x512f67['body']?JSON[_0x061d('0x26')](_0x512f67['body']):'null');return respondWithRpcPromise(_0x061d('0x69'),'acceptMessage',_0x18bd07);}return null;})['then'](function(_0x24d5c9){var _0x4cff59='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24d5c9[_0x061d('0x29')][_0x061d('0x6a')];return db['sequelize'][_0x061d('0x40')](_0x4cff59,{'type':db[_0x061d('0x6b')]['QueryTypes'][_0x061d('0x6c')],'raw':!![]})['then'](function(_0x324bdf){return _0x324bdf;});})['then'](function(_0x494ed4){if(_0x494ed4){_0x18bd07[_0x061d('0x29')][_0x061d('0x6d')]=_0x494ed4[0x0];if(!_0x512f67[_0x061d('0x58')][_0x061d('0x60')])return;return db[_0x061d('0x6e')][_0x061d('0x56')]({'where':{'id':_0x512f67[_0x061d('0x58')][_0x061d('0x60')],'role':_0x061d('0x62')},'attributes':['id',_0x061d('0x37'),_0x061d('0x6f'),_0x061d('0x70'),_0x061d('0x71')],'raw':!![]});}return null;})[_0x061d('0x21')](function(_0x4148d7){if(!_0x4148d7)return null;_0x18bd07[_0x061d('0x29')][_0x061d('0x62')]=_0x4148d7;return _0x18bd07;})[_0x061d('0x21')](function(_0x59fac8){if(_0x59fac8){if(_0x512f67[_0x061d('0x58')][_0x061d('0x72')]){_0x18bd07[_0x061d('0x29')][_0x061d('0x73')]=util[_0x061d('0x5e')]('SIP/%s',_0x512f67[_0x061d('0x61')]['name']);_0x18bd07['message']['channel']=_0x18bd07[_0x061d('0x74')];_0x18bd07['message'][_0x061d('0x75')]=_0x18bd07[_0x061d('0x74')];_0x18bd07[_0x061d('0x29')][_0x061d('0x76')]=_0x061d('0x5b');return respondWithRpcPromise(_0x061d('0x77'),'EventManager',{'event':_0x061d('0x78'),'message':_0x18bd07[_0x061d('0x29')]},client9002)[_0x061d('0x21')](function(){return _0x18bd07;});}return _0x18bd07;}return null;})[_0x061d('0x21')](respondWithResult(_0x2d2067,null))[_0x061d('0x52')](handleError(_0x2d2067,null));};var interaction_log=require('../../config/logger')(_0x061d('0x5a'));exports[_0x061d('0x79')]=function(_0x25aa82,_0x7f6a13,_0x38367c){var _0x3c867d={'agent':{},'channel':'sms'};if(_0x25aa82['body']['id']){delete _0x25aa82[_0x061d('0x58')]['id'];}_0x25aa82['body'][_0x061d('0x60')]=_0x25aa82[_0x061d('0x58')][_0x061d('0x60')]||_0x25aa82[_0x061d('0x61')]['id'];_0x3c867d[_0x061d('0x62')]['id']=_0x25aa82[_0x061d('0x58')]['UserId'];return db[_0x061d('0x3a')]['find']({'where':{'id':_0x25aa82[_0x061d('0x54')]['id'],'UserId':null}})[_0x061d('0x21')](handleEntityNotFound(_0x7f6a13,null))[_0x061d('0x21')](function(_0x31fe9a){if(_0x31fe9a){_0x3c867d[_0x061d('0x29')]=_0x31fe9a[_0x061d('0x63')]({'plain':!![]});return db[_0x061d('0x7a')][_0x061d('0x56')]({'where':{'id':_0x31fe9a['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7f6a13,null))[_0x061d('0x21')](function(_0x580b83){if(_0x580b83){_0x3c867d[_0x061d('0x66')]=_0x580b83[_0x061d('0x63')]({'plain':!![]});interaction_log[_0x061d('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25aa82[_0x061d('0x61')]['id'],_0x25aa82[_0x061d('0x61')]['name'],_0x25aa82[_0x061d('0x61')][_0x061d('0x68')],_0x3c867d[_0x061d('0x66')]['id'],_0x25aa82[_0x061d('0x58')]?JSON[_0x061d('0x26')](_0x25aa82[_0x061d('0x58')]):'null');return respondWithRpcPromise(_0x061d('0x7b'),'rejectMessage',_0x3c867d);}return null;})[_0x061d('0x21')](function(_0x219db3){var _0x22a9bc=_0x061d('0x7c')+_0x219db3['message'][_0x061d('0x6a')];return db['sequelize']['query'](_0x22a9bc,{'type':db['Sequelize'][_0x061d('0x7d')]['SELECT'],'raw':!![]})[_0x061d('0x21')](function(_0x349f88){return _0x349f88;});})[_0x061d('0x21')](function(_0x39dda7){if(_0x39dda7){_0x3c867d[_0x061d('0x29')][_0x061d('0x6d')]=_0x39dda7[0x0];if(!_0x25aa82[_0x061d('0x58')][_0x061d('0x60')])return;return db[_0x061d('0x6e')][_0x061d('0x56')]({'where':{'id':_0x25aa82[_0x061d('0x58')][_0x061d('0x60')],'role':_0x061d('0x62')},'attributes':['id',_0x061d('0x37'),_0x061d('0x6f'),_0x061d('0x70'),_0x061d('0x71')],'raw':!![]});}return null;})['then'](function(_0x5019f0){if(!_0x5019f0)return null;_0x3c867d['message']['agent']=_0x5019f0;return _0x3c867d;})['then'](function(_0x2896bb){if(_0x2896bb){_0x2896bb[_0x061d('0x29')][_0x061d('0x73')]=util[_0x061d('0x5e')](_0x061d('0x7e'),_0x25aa82[_0x061d('0x61')][_0x061d('0x37')]);_0x2896bb[_0x061d('0x29')][_0x061d('0x74')]=_0x3c867d[_0x061d('0x74')];_0x2896bb[_0x061d('0x29')][_0x061d('0x75')]=_0x3c867d['channel'];_0x2896bb[_0x061d('0x29')][_0x061d('0x76')]='reject';respondWithRpcPromise(_0x061d('0x77'),_0x061d('0x77'),{'event':_0x061d('0x7f'),'message':_0x2896bb['message']},client9002);return _0x3c867d;}return null;})[_0x061d('0x21')](respondWithResult(_0x7f6a13,null))[_0x061d('0x52')](handleError(_0x7f6a13,null));};exports['status']=function(_0xfdbd23,_0x2fcd92,_0x3f08ae){if(_0xfdbd23[_0x061d('0x58')]['id']){delete _0xfdbd23[_0x061d('0x58')]['id'];}var _0x368b67;return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0xfdbd23['params']['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x2fcd92,null))[_0x061d('0x21')](function(_0x368f55){if(_0x368f55){_0x368b67=_0x368f55;return db['SmsAccount'][_0x061d('0x56')]({'where':{'id':_0x368f55[_0x061d('0x80')]}});}})[_0x061d('0x21')](handleEntityNotFound(_0x2fcd92,null))[_0x061d('0x21')](function(_0x3151e8){if(_0x3151e8){logger['debug'](_0x061d('0x25'),_0x061d('0x31'),_0x061d('0x81'),_0x3151e8[_0x061d('0x4b')],util[_0x061d('0x82')](_0xfdbd23['body'],{'showHidden':![],'depth':null}));switch(_0x3151e8[_0x061d('0x4b')]){case _0x061d('0x83'):if(_0xfdbd23[_0x061d('0x58')][_0x061d('0x84')]&&_0xfdbd23[_0x061d('0x58')][_0x061d('0x84')]===_0x368b67['messageId']){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),'twilio',util[_0x061d('0x82')](_0xfdbd23[_0x061d('0x58')],{'showHidden':![],'depth':null}));}break;case _0x061d('0x86'):if(_0xfdbd23['body'][_0x061d('0x87')]&&_0xfdbd23[_0x061d('0x58')][_0x061d('0x87')]===_0x368b67['messageId']&&_[_0x061d('0x88')]([_0x061d('0x89'),_0x061d('0x8a')],_0xfdbd23[_0x061d('0x58')]['Status'])>=0x0){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),_0x061d('0x8b'),util['inspect'](_0xfdbd23[_0x061d('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x30772f=_0xfdbd23['body'][_0x061d('0x8c')][0x0];if(_0x30772f[_0x061d('0x31')][_0x061d('0x8d')]===_0x061d('0x8e')){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),_0x061d('0x8f'),util[_0x061d('0x82')](_0xfdbd23['body'],{'showHidden':![],'depth':null}));}break;}return _0x368b67;}})['then'](respondWithResult(_0x2fcd92,null))['catch'](handleError(_0x2fcd92,null));}; \ No newline at end of file +var _0xcdb4=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','internal','rejectmessage','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','filter'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x125c40,_0x4ff068){_0x125c40=_0x125c40-0x0;var _0x5cb927=_0xcdb4[_0x125c40];return _0x5cb927;};'use strict';var emlformat=require(_0x4cdb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cdb('0x1'));var moment=require(_0x4cdb('0x2'));var BPromise=require(_0x4cdb('0x3'));var Mustache=require(_0x4cdb('0x4'));var util=require(_0x4cdb('0x5'));var path=require(_0x4cdb('0x6'));var sox=require(_0x4cdb('0x7'));var csv=require(_0x4cdb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cdb('0x9'));var crypto=require('crypto');var jsforce=require(_0x4cdb('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4cdb('0x8'));var querystring=require(_0x4cdb('0xb'));var Papa=require(_0x4cdb('0xc'));var Redis=require(_0x4cdb('0xd'));var authService=require(_0x4cdb('0xe'));var qs=require(_0x4cdb('0xf'));var as=require(_0x4cdb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cdb('0x11'))('api');var utils=require(_0x4cdb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4cdb('0x13'));var db=require(_0x4cdb('0x14'))['db'];config[_0x4cdb('0x15')]=_[_0x4cdb('0x16')](config[_0x4cdb('0x15')],{'host':_0x4cdb('0x17'),'port':0x18eb});var socket=require(_0x4cdb('0x18'))(new Redis(config[_0x4cdb('0x15')]));require(_0x4cdb('0x19'))[_0x4cdb('0x1a')](socket);var jayson=require(_0x4cdb('0x1b'));var client=jayson[_0x4cdb('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x4cdb('0x1c')][_0x4cdb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x28e7c6,_0x4ac3e1,_0x280a06,_0x26d5bd){return new BPromise(function(_0x2bd40c,_0x255804){var _0x380eb7=_0x26d5bd||client;return _0x380eb7[_0x4cdb('0x1e')](_0x28e7c6,_0x280a06)[_0x4cdb('0x1f')](function(_0x2a7e95){logger[_0x4cdb('0x20')](_0x4cdb('0x21'),_0x4ac3e1,_0x4cdb('0x22'));logger[_0x4cdb('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ac3e1,_0x4cdb('0x22'),JSON[_0x4cdb('0x24')](_0x2a7e95));if(_0x2a7e95[_0x4cdb('0x25')]){if(_0x2a7e95[_0x4cdb('0x25')][_0x4cdb('0x26')]===0x1f4){logger[_0x4cdb('0x25')](_0x4cdb('0x21'),_0x4ac3e1,_0x2a7e95['error'][_0x4cdb('0x27')]);return _0x255804(_0x2a7e95[_0x4cdb('0x25')][_0x4cdb('0x27')]);}logger[_0x4cdb('0x25')](_0x4cdb('0x21'),_0x4ac3e1,_0x2a7e95[_0x4cdb('0x25')][_0x4cdb('0x27')]);return _0x2bd40c(_0x2a7e95[_0x4cdb('0x25')][_0x4cdb('0x27')]);}else{logger[_0x4cdb('0x20')](_0x4cdb('0x21'),_0x4ac3e1,'request\x20sent');_0x2bd40c(_0x2a7e95[_0x4cdb('0x28')][_0x4cdb('0x27')]);}})[_0x4cdb('0x29')](function(_0x44a4a6){logger['error'](_0x4cdb('0x21'),_0x4ac3e1,_0x44a4a6);_0x255804(_0x44a4a6);});});}function respondWithStatusCode(_0x29680c,_0x2b8047){_0x2b8047=_0x2b8047||0xcc;return function(_0xa36cc2){if(_0xa36cc2){return _0x29680c[_0x4cdb('0x2a')](_0x2b8047);}return _0x29680c['status'](_0x2b8047)['end']();};}function respondWithResult(_0x22b6bf,_0xdb6cfe){_0xdb6cfe=_0xdb6cfe||0xc8;return function(_0x14b9df){if(_0x14b9df){return _0x22b6bf[_0x4cdb('0x2b')](_0xdb6cfe)[_0x4cdb('0x2c')](_0x14b9df);}};}function respondWithFilteredResult(_0x48ce9e,_0x413171){return function(_0x2d15b3){if(_0x2d15b3){var _0x203cdf=typeof _0x413171[_0x4cdb('0x2d')]===_0x4cdb('0x2e')&&typeof _0x413171['limit']==='undefined';var _0xf0621b=_0x2d15b3[_0x4cdb('0x2f')];var _0x2cd06e=_0x203cdf?0x0:_0x413171[_0x4cdb('0x2d')];var _0x34a4aa=_0x203cdf?_0x2d15b3[_0x4cdb('0x2f')]:_0x413171[_0x4cdb('0x2d')]+_0x413171[_0x4cdb('0x30')];var _0xc0efa9;if(_0x34a4aa>=_0xf0621b){_0x34a4aa=_0xf0621b;_0xc0efa9=0xc8;}else{_0xc0efa9=0xce;}_0x48ce9e[_0x4cdb('0x2b')](_0xc0efa9);return _0x48ce9e[_0x4cdb('0x31')]('Content-Range',_0x2cd06e+'-'+_0x34a4aa+'/'+_0xf0621b)[_0x4cdb('0x2c')](_0x2d15b3);}return null;};}function patchUpdates(_0x1995c5){return function(_0x4f67bd){try{jsonpatch[_0x4cdb('0x32')](_0x4f67bd,_0x1995c5,!![]);}catch(_0x446fa7){return BPromise['reject'](_0x446fa7);}return _0x4f67bd[_0x4cdb('0x33')]();};}function saveUpdates(_0x497867,_0x560aa5){return function(_0x21b80a){if(_0x21b80a){return _0x21b80a[_0x4cdb('0x34')](_0x497867)[_0x4cdb('0x1f')](function(_0x268ed5){return _0x268ed5;});}return null;};}function removeEntity(_0x312377,_0x3b7f5a){return function(_0x349a25){if(_0x349a25){return _0x349a25[_0x4cdb('0x35')]()[_0x4cdb('0x1f')](function(){_0x312377[_0x4cdb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4457bc,_0x2b49aa){return function(_0x44d846){if(!_0x44d846){_0x4457bc[_0x4cdb('0x2a')](0x194);}return _0x44d846;};}function handleError(_0x2d1905,_0x3fee1d){_0x3fee1d=_0x3fee1d||0x1f4;return function(_0x3acdec){logger[_0x4cdb('0x25')](_0x3acdec['stack']);if(_0x3acdec[_0x4cdb('0x36')]){delete _0x3acdec[_0x4cdb('0x36')];}_0x2d1905[_0x4cdb('0x2b')](_0x3fee1d)[_0x4cdb('0x37')](_0x3acdec);};}exports[_0x4cdb('0x38')]=function(_0x19dc03,_0x1a8ca9){var _0x2e280c={},_0x43e1cb={},_0x4e981b={'count':0x0,'rows':[]};var _0x10a553=_[_0x4cdb('0x39')](db[_0x4cdb('0x3a')][_0x4cdb('0x3b')],function(_0x4fa43b){return{'name':_0x4fa43b['fieldName'],'type':_0x4fa43b[_0x4cdb('0x3c')][_0x4cdb('0x3d')]};});_0x43e1cb[_0x4cdb('0x3e')]=_['map'](_0x10a553,_0x4cdb('0x36'));_0x43e1cb[_0x4cdb('0x3f')]=_[_0x4cdb('0x40')](_0x19dc03[_0x4cdb('0x3f')]);_0x43e1cb['filters']=_[_0x4cdb('0x41')](_0x43e1cb[_0x4cdb('0x3e')],_0x43e1cb[_0x4cdb('0x3f')]);_0x2e280c['attributes']=_[_0x4cdb('0x41')](_0x43e1cb[_0x4cdb('0x3e')],qs['fields'](_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x42')]));_0x2e280c[_0x4cdb('0x43')]=_0x2e280c[_0x4cdb('0x43')]['length']?_0x2e280c[_0x4cdb('0x43')]:_0x43e1cb['model'];if(!_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x44')](_0x4cdb('0x45'))){_0x2e280c[_0x4cdb('0x30')]=qs[_0x4cdb('0x30')](_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x30')]);_0x2e280c[_0x4cdb('0x2d')]=qs[_0x4cdb('0x2d')](_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x2d')]);}_0x2e280c['order']=qs[_0x4cdb('0x46')](_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x46')]);_0x2e280c['where']=qs[_0x4cdb('0x47')](_['pick'](_0x19dc03[_0x4cdb('0x3f')],_0x43e1cb['filters']),_0x10a553);if(_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x48')]){_0x2e280c[_0x4cdb('0x49')]=_[_0x4cdb('0x4a')](_0x2e280c[_0x4cdb('0x49')],{'$or':_[_0x4cdb('0x39')](_0x10a553,function(_0x2231a5){if(_0x2231a5[_0x4cdb('0x3c')]!==_0x4cdb('0x4b')){var _0x4708f9={};_0x4708f9[_0x2231a5[_0x4cdb('0x36')]]={'$like':'%'+_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x48')]+'%'};return _0x4708f9;}})});}_0x2e280c=_[_0x4cdb('0x4a')]({},_0x2e280c,_0x19dc03[_0x4cdb('0x4c')]);var _0x530909={'where':_0x2e280c['where']};return db['SmsMessage'][_0x4cdb('0x2f')](_0x530909)['then'](function(_0x9f3744){_0x4e981b['count']=_0x9f3744;if(_0x19dc03[_0x4cdb('0x3f')][_0x4cdb('0x4d')]){_0x2e280c[_0x4cdb('0x4e')]=[{'all':!![]}];}return db[_0x4cdb('0x3a')][_0x4cdb('0x4f')](_0x2e280c);})['then'](function(_0x11143d){_0x4e981b[_0x4cdb('0x50')]=_0x11143d;return _0x4e981b;})[_0x4cdb('0x1f')](respondWithFilteredResult(_0x1a8ca9,_0x2e280c))[_0x4cdb('0x29')](handleError(_0x1a8ca9,null));};exports[_0x4cdb('0x51')]=function(_0x21e815,_0x23db67){var _0x2f7b87={'raw':!![],'where':{'id':_0x21e815[_0x4cdb('0x52')]['id']}},_0x3392ea={};_0x3392ea[_0x4cdb('0x3e')]=_[_0x4cdb('0x40')](db[_0x4cdb('0x3a')][_0x4cdb('0x3b')]);_0x3392ea[_0x4cdb('0x3f')]=_[_0x4cdb('0x40')](_0x21e815['query']);_0x3392ea['filters']=_[_0x4cdb('0x41')](_0x3392ea[_0x4cdb('0x3e')],_0x3392ea[_0x4cdb('0x3f')]);_0x2f7b87[_0x4cdb('0x43')]=_[_0x4cdb('0x41')](_0x3392ea[_0x4cdb('0x3e')],qs['fields'](_0x21e815[_0x4cdb('0x3f')][_0x4cdb('0x42')]));_0x2f7b87['attributes']=_0x2f7b87[_0x4cdb('0x43')][_0x4cdb('0x53')]?_0x2f7b87[_0x4cdb('0x43')]:_0x3392ea[_0x4cdb('0x3e')];if(_0x21e815[_0x4cdb('0x3f')][_0x4cdb('0x4d')]){_0x2f7b87['include']=[{'all':!![]}];}_0x2f7b87=_[_0x4cdb('0x4a')]({},_0x2f7b87,_0x21e815[_0x4cdb('0x4c')]);return db[_0x4cdb('0x3a')][_0x4cdb('0x54')](_0x2f7b87)[_0x4cdb('0x1f')](handleEntityNotFound(_0x23db67,null))['then'](respondWithResult(_0x23db67,null))['catch'](handleError(_0x23db67,null));};exports[_0x4cdb('0x55')]=function(_0x17fbc6,_0x1d5944){return db[_0x4cdb('0x3a')]['create'](_0x17fbc6[_0x4cdb('0x56')],{})['then'](respondWithResult(_0x1d5944,0xc9))[_0x4cdb('0x29')](handleError(_0x1d5944,null));};exports[_0x4cdb('0x34')]=function(_0xb25014,_0x2255c2){if(_0xb25014[_0x4cdb('0x56')]['id']){delete _0xb25014['body']['id'];}return db[_0x4cdb('0x3a')]['find']({'where':{'id':_0xb25014['params']['id']}})['then'](handleEntityNotFound(_0x2255c2,null))[_0x4cdb('0x1f')](saveUpdates(_0xb25014['body'],null))[_0x4cdb('0x1f')](respondWithResult(_0x2255c2,null))[_0x4cdb('0x29')](handleError(_0x2255c2,null));};exports[_0x4cdb('0x35')]=function(_0x5b9153,_0xd1f6f9){return db[_0x4cdb('0x3a')][_0x4cdb('0x54')]({'where':{'id':_0x5b9153[_0x4cdb('0x52')]['id']}})[_0x4cdb('0x1f')](handleEntityNotFound(_0xd1f6f9,null))[_0x4cdb('0x1f')](removeEntity(_0xd1f6f9,null))['catch'](handleError(_0xd1f6f9,null));};exports['describe']=function(_0x3c9074,_0x5c00ed){return db[_0x4cdb('0x3a')][_0x4cdb('0x57')]()[_0x4cdb('0x1f')](respondWithResult(_0x5c00ed,null))[_0x4cdb('0x29')](handleError(_0x5c00ed,null));};var interaction_log=require(_0x4cdb('0x11'))('sms-interactions');exports[_0x4cdb('0x58')]=function(_0x52e1a3,_0x23204f,_0x4c3c10){var _0x4fa65d={'agent':{},'channel':'sms'};if(_0x52e1a3[_0x4cdb('0x56')]['id']){delete _0x52e1a3[_0x4cdb('0x56')]['id'];}_0x52e1a3[_0x4cdb('0x56')]['read']=!![];_0x52e1a3[_0x4cdb('0x56')][_0x4cdb('0x59')]=moment()[_0x4cdb('0x5a')](_0x4cdb('0x5b'));_0x52e1a3[_0x4cdb('0x56')][_0x4cdb('0x5c')]=_0x52e1a3[_0x4cdb('0x56')][_0x4cdb('0x5c')]||_0x52e1a3['user']['id'];_0x4fa65d['agent']['id']=_0x52e1a3['body'][_0x4cdb('0x5c')];return db[_0x4cdb('0x3a')][_0x4cdb('0x54')]({'where':{'id':_0x52e1a3[_0x4cdb('0x52')]['id'],'UserId':null}})[_0x4cdb('0x1f')](handleEntityNotFound(_0x23204f,null))[_0x4cdb('0x1f')](saveUpdates(_0x52e1a3[_0x4cdb('0x56')],null))['then'](function(_0x501422){if(_0x501422){_0x4fa65d[_0x4cdb('0x27')]=_0x501422[_0x4cdb('0x5d')]({'plain':!![]});return db[_0x4cdb('0x5e')][_0x4cdb('0x54')]({'where':{'id':_0x501422['SmsInteractionId']}});}return null;})[_0x4cdb('0x1f')](handleEntityNotFound(_0x23204f,null))[_0x4cdb('0x1f')](function(_0x33f10d){if(_0x33f10d){return _0x33f10d[_0x4cdb('0x34')]({'UserId':_0x52e1a3[_0x4cdb('0x56')][_0x4cdb('0x5c')],'read1stAt':_[_0x4cdb('0x5f')](_0x33f10d['read1stAt'])?moment()['format'](_0x4cdb('0x5b')):undefined});}return null;})['then'](function(_0x2e4c84){if(_0x2e4c84){_0x4fa65d[_0x4cdb('0x60')]=_0x2e4c84[_0x4cdb('0x5d')]({'plain':!![]});interaction_log[_0x4cdb('0x20')](_0x4cdb('0x61'),_0x52e1a3[_0x4cdb('0x62')]['id'],_0x52e1a3[_0x4cdb('0x62')]['name'],_0x52e1a3[_0x4cdb('0x62')][_0x4cdb('0x63')],_0x4fa65d[_0x4cdb('0x60')]['id'],_0x52e1a3['body']?JSON[_0x4cdb('0x24')](_0x52e1a3[_0x4cdb('0x56')]):'null');return respondWithRpcPromise(_0x4cdb('0x64'),_0x4cdb('0x65'),_0x4fa65d);}return null;})[_0x4cdb('0x1f')](function(_0x7b969d){var _0xfc695f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7b969d['message'][_0x4cdb('0x66')];return db[_0x4cdb('0x67')][_0x4cdb('0x3f')](_0xfc695f,{'type':db[_0x4cdb('0x68')][_0x4cdb('0x69')][_0x4cdb('0x6a')],'raw':!![]})[_0x4cdb('0x1f')](function(_0x437af3){return _0x437af3;});})[_0x4cdb('0x1f')](function(_0x291f5a){if(_0x291f5a){_0x4fa65d[_0x4cdb('0x27')]['contact']=_0x291f5a[0x0];if(!_0x52e1a3['body'][_0x4cdb('0x5c')])return;return db['User'][_0x4cdb('0x54')]({'where':{'id':_0x52e1a3[_0x4cdb('0x56')]['UserId'],'role':_0x4cdb('0x6b')},'attributes':['id','name',_0x4cdb('0x6c'),'email','internal'],'raw':!![]});}return null;})[_0x4cdb('0x1f')](function(_0x3cb1bb){if(!_0x3cb1bb)return null;_0x4fa65d[_0x4cdb('0x27')]['agent']=_0x3cb1bb;return _0x4fa65d;})['then'](function(_0x24f4ae){if(_0x24f4ae){if(_0x52e1a3[_0x4cdb('0x56')][_0x4cdb('0x6d')]){_0x4fa65d[_0x4cdb('0x27')][_0x4cdb('0x6e')]=util[_0x4cdb('0x5a')](_0x4cdb('0x6f'),_0x52e1a3[_0x4cdb('0x62')][_0x4cdb('0x36')]);_0x4fa65d[_0x4cdb('0x27')][_0x4cdb('0x70')]=_0x4fa65d['channel'];_0x4fa65d[_0x4cdb('0x27')][_0x4cdb('0x71')]=_0x4fa65d[_0x4cdb('0x70')];_0x4fa65d[_0x4cdb('0x27')][_0x4cdb('0x72')]=_0x4cdb('0x58');return respondWithRpcPromise(_0x4cdb('0x73'),'EventManager',{'event':_0x4cdb('0x74'),'message':_0x4fa65d[_0x4cdb('0x27')]},client9002)['then'](function(){return _0x4fa65d;});}return _0x4fa65d;}return null;})[_0x4cdb('0x1f')](respondWithResult(_0x23204f,null))[_0x4cdb('0x29')](handleError(_0x23204f,null));};var interaction_log=require('../../config/logger')(_0x4cdb('0x75'));exports[_0x4cdb('0x76')]=function(_0x521040,_0x16c6b8,_0x278274){var _0x3258a3={'agent':{},'channel':'sms'};if(_0x521040[_0x4cdb('0x56')]['id']){delete _0x521040['body']['id'];}_0x521040[_0x4cdb('0x56')][_0x4cdb('0x5c')]=_0x521040[_0x4cdb('0x56')][_0x4cdb('0x5c')]||_0x521040[_0x4cdb('0x62')]['id'];_0x3258a3['agent']['id']=_0x521040[_0x4cdb('0x56')]['UserId'];return db['SmsMessage'][_0x4cdb('0x54')]({'where':{'id':_0x521040['params']['id'],'UserId':null}})[_0x4cdb('0x1f')](handleEntityNotFound(_0x16c6b8,null))[_0x4cdb('0x1f')](function(_0x4aee58){if(_0x4aee58){_0x3258a3['message']=_0x4aee58['get']({'plain':!![]});return db[_0x4cdb('0x5e')][_0x4cdb('0x54')]({'where':{'id':_0x4aee58[_0x4cdb('0x77')]}});}return null;})[_0x4cdb('0x1f')](handleEntityNotFound(_0x16c6b8,null))['then'](function(_0x3aa096){if(_0x3aa096){_0x3258a3[_0x4cdb('0x60')]=_0x3aa096[_0x4cdb('0x5d')]({'plain':!![]});interaction_log[_0x4cdb('0x20')](_0x4cdb('0x78'),_0x521040[_0x4cdb('0x62')]['id'],_0x521040[_0x4cdb('0x62')][_0x4cdb('0x36')],_0x521040[_0x4cdb('0x62')][_0x4cdb('0x63')],_0x3258a3[_0x4cdb('0x60')]['id'],_0x521040[_0x4cdb('0x56')]?JSON[_0x4cdb('0x24')](_0x521040[_0x4cdb('0x56')]):_0x4cdb('0x79'));return respondWithRpcPromise('RejectMessage',_0x4cdb('0x7a'),_0x3258a3);}return null;})['then'](function(_0x181bb8){var _0x7854be=_0x4cdb('0x7b')+_0x181bb8['message'][_0x4cdb('0x66')];return db[_0x4cdb('0x67')][_0x4cdb('0x3f')](_0x7854be,{'type':db['Sequelize'][_0x4cdb('0x69')][_0x4cdb('0x6a')],'raw':!![]})[_0x4cdb('0x1f')](function(_0x3bb955){return _0x3bb955;});})['then'](function(_0x423215){if(_0x423215){_0x3258a3[_0x4cdb('0x27')][_0x4cdb('0x7c')]=_0x423215[0x0];if(!_0x521040['body'][_0x4cdb('0x5c')])return;return db[_0x4cdb('0x7d')]['find']({'where':{'id':_0x521040[_0x4cdb('0x56')][_0x4cdb('0x5c')],'role':_0x4cdb('0x6b')},'attributes':['id',_0x4cdb('0x36'),'fullname','email',_0x4cdb('0x7e')],'raw':!![]});}return null;})['then'](function(_0x28ff44){if(!_0x28ff44)return null;_0x3258a3[_0x4cdb('0x27')][_0x4cdb('0x6b')]=_0x28ff44;return _0x3258a3;})[_0x4cdb('0x1f')](function(_0x43ccbf){if(_0x43ccbf){_0x43ccbf['message']['interface']=util['format'](_0x4cdb('0x6f'),_0x521040[_0x4cdb('0x62')][_0x4cdb('0x36')]);_0x43ccbf[_0x4cdb('0x27')][_0x4cdb('0x70')]=_0x3258a3[_0x4cdb('0x70')];_0x43ccbf[_0x4cdb('0x27')][_0x4cdb('0x71')]=_0x3258a3[_0x4cdb('0x70')];_0x43ccbf[_0x4cdb('0x27')]['event']=_0x4cdb('0x76');respondWithRpcPromise(_0x4cdb('0x73'),_0x4cdb('0x73'),{'event':_0x4cdb('0x7f'),'message':_0x43ccbf[_0x4cdb('0x27')]},client9002);return _0x3258a3;}return null;})[_0x4cdb('0x1f')](respondWithResult(_0x16c6b8,null))['catch'](handleError(_0x16c6b8,null));};exports['status']=function(_0x337be5,_0x132782,_0x545c3d){if(_0x337be5[_0x4cdb('0x56')]['id']){delete _0x337be5[_0x4cdb('0x56')]['id'];}var _0x40e6f4;return db[_0x4cdb('0x3a')]['find']({'where':{'id':_0x337be5[_0x4cdb('0x52')]['id']}})[_0x4cdb('0x1f')](handleEntityNotFound(_0x132782,null))[_0x4cdb('0x1f')](function(_0x963f2a){if(_0x963f2a){_0x40e6f4=_0x963f2a;return db['SmsAccount'][_0x4cdb('0x54')]({'where':{'id':_0x963f2a[_0x4cdb('0x80')]}});}})[_0x4cdb('0x1f')](handleEntityNotFound(_0x132782,null))['then'](function(_0x3f3b7d){if(_0x3f3b7d){logger[_0x4cdb('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4cdb('0x2b'),'received\x20delivery\x20report\x20from',_0x3f3b7d[_0x4cdb('0x3c')],util[_0x4cdb('0x81')](_0x337be5['body'],{'showHidden':![],'depth':null}));switch(_0x3f3b7d[_0x4cdb('0x3c')]){case'twilio':if(_0x337be5[_0x4cdb('0x56')][_0x4cdb('0x82')]&&_0x337be5['body'][_0x4cdb('0x82')]===_0x40e6f4[_0x4cdb('0x83')]){return _0x40e6f4[_0x4cdb('0x34')]({'read':!![]});}else{logger[_0x4cdb('0x25')](_0x4cdb('0x84'),_0x4cdb('0x2b'),_0x4cdb('0x85'),util['inspect'](_0x337be5[_0x4cdb('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x337be5[_0x4cdb('0x56')][_0x4cdb('0x86')]&&_0x337be5[_0x4cdb('0x56')][_0x4cdb('0x86')]===_0x40e6f4['messageId']&&_[_0x4cdb('0x87')]([_0x4cdb('0x88'),_0x4cdb('0x89')],_0x337be5[_0x4cdb('0x56')][_0x4cdb('0x8a')])>=0x0){return _0x40e6f4[_0x4cdb('0x34')]({'read':!![]});}else{logger[_0x4cdb('0x25')](_0x4cdb('0x84'),_0x4cdb('0x2b'),_0x4cdb('0x8b'),util[_0x4cdb('0x81')](_0x337be5[_0x4cdb('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4cdb('0x8c'):var _0x7f8844=_0x337be5['body'][_0x4cdb('0x8d')][0x0];if(_0x7f8844[_0x4cdb('0x2b')]['groupName']===_0x4cdb('0x8e')){return _0x40e6f4[_0x4cdb('0x34')]({'read':!![]});}else{logger['error'](_0x4cdb('0x84'),'status','infobip',util[_0x4cdb('0x81')](_0x337be5[_0x4cdb('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x40e6f4;}})[_0x4cdb('0x1f')](respondWithResult(_0x132782,null))[_0x4cdb('0x29')](handleError(_0x132782,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c6b4393..aeb503f 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 _0x6142=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x6142,0x147));var _0x2614=function(_0x2c5435,_0x1bbff8){_0x2c5435=_0x2c5435-0x0;var _0x1f7ffe=_0x6142[_0x2c5435];return _0x1f7ffe;};'use strict';var EventEmitter=require(_0x2614('0x0'));var SmsMessage=require(_0x2614('0x1'))['db'][_0x2614('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2614('0x3'),'afterUpdate':_0x2614('0x4'),'afterDestroy':_0x2614('0x5')};function emitEvent(_0x47d24d){return function(_0x55922d,_0x39d9c8,_0x37e975){SmsMessageEvents[_0x2614('0x6')](_0x47d24d+':'+_0x55922d['id'],_0x55922d);SmsMessageEvents['emit'](_0x47d24d,_0x55922d);_0x37e975(null);};}for(var e in events){if(events[_0x2614('0x7')](e)){var event=events[e];SmsMessage[_0x2614('0x8')](e,emitEvent(event));}}module[_0x2614('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xa4fe=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage'];(function(_0x4ee632,_0x426322){var _0x3c70e6=function(_0x1541f7){while(--_0x1541f7){_0x4ee632['push'](_0x4ee632['shift']());}};_0x3c70e6(++_0x426322);}(_0xa4fe,0x12f));var _0xea4f=function(_0x5219b1,_0x45dfad){_0x5219b1=_0x5219b1-0x0;var _0x1fff2e=_0xa4fe[_0x5219b1];return _0x1fff2e;};'use strict';var EventEmitter=require(_0xea4f('0x0'));var SmsMessage=require(_0xea4f('0x1'))['db'][_0xea4f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xea4f('0x3')](0x0);var events={'afterCreate':_0xea4f('0x4'),'afterUpdate':_0xea4f('0x5'),'afterDestroy':_0xea4f('0x6')};function emitEvent(_0xf11183){return function(_0x36beff,_0x54a16e,_0x29108f){SmsMessageEvents[_0xea4f('0x7')](_0xf11183+':'+_0x36beff['id'],_0x36beff);SmsMessageEvents[_0xea4f('0x7')](_0xf11183,_0x36beff);_0x29108f(null);};}for(var e in events){if(events[_0xea4f('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6292f92..b08690e 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 _0x9c03=['accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','/status?token=','token','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','length','apiKey','createHash','md5','signature=','/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/'];(function(_0x469318,_0x2c7c98){var _0x77c40e=function(_0x5795e7){while(--_0x5795e7){_0x469318['push'](_0x469318['shift']());}};_0x77c40e(++_0x2c7c98);}(_0x9c03,0x87));var _0x39c0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9c03[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x39c0('0x0'));var logger=require(_0x39c0('0x1'))(_0x39c0('0x2'));var moment=require('moment');var BPromise=require(_0x39c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39c0('0x4'));var rimraf=require('rimraf');var config=require(_0x39c0('0x5'));var attributes=require(_0x39c0('0x6'));module[_0x39c0('0x7')]=function(_0x2dead8,_0x2eee65){return _0x2dead8[_0x39c0('0x8')](_0x39c0('0x9'),attributes,{'tableName':_0x39c0('0xa'),'paranoid':![],'indexes':[{'name':_0x39c0('0xb'),'fields':[_0x39c0('0xb')]},{'name':_0x39c0('0xc'),'fields':[_0x39c0('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x110921,_0x3bcd88,_0x4d3bf0){var _0x550104=_0x2dead8[_0x39c0('0xe')];var _0x38820e=_0x110921[_0x39c0('0xf')]({'plain':!![]});if(_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()==='in'||_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()===_0x39c0('0x12')&&!_0x38820e[_0x39c0('0x13')]&&!_[_0x39c0('0x14')](_0x38820e[_0x39c0('0x15')])&&!_['isNil'](_0x38820e[_0x39c0('0x16')])){_0x550104['SmsInteraction']['findOne']({'where':{'id':_0x38820e['SmsInteractionId']}})[_0x39c0('0x17')](function(_0x3e7bb2){if(_0x3e7bb2){_0x3e7bb2[_0x39c0('0x18')]({'lastMsgAt':_0x38820e[_0x39c0('0x19')],'lastMsgDirection':_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()});}})[_0x39c0('0x1a')](function(_0x8cb5f9){console[_0x39c0('0x1b')](_0x8cb5f9);});}if(_0x38820e[_0x39c0('0x10')]===_0x39c0('0x12')&&!_0x38820e[_0x39c0('0x13')]){var _0x48d791;_0x550104[_0x39c0('0x1c')][_0x39c0('0x1d')]({'where':{'id':_0x38820e[_0x39c0('0x1e')]},'raw':!![]})[_0x39c0('0x17')](function(_0x305482){_0x48d791=_0x305482;if(_0x48d791&&_0x48d791[_0x39c0('0x1f')]){switch(_0x48d791[_0x39c0('0x1f')]){case _0x39c0('0x20'):var _0x5d8f97=require(_0x39c0('0x20'));if(_0x48d791[_0x39c0('0x21')]&&_0x48d791[_0x39c0('0x22')]&&_0x48d791[_0x39c0('0x23')]){var _0x37f003=new _0x5d8f97(_0x48d791[_0x39c0('0x21')],_0x48d791['authToken']);_0x37f003[_0x39c0('0x24')][_0x39c0('0x25')]({'body':_0x38820e['body'],'to':_0x38820e[_0x39c0('0x23')],'from':_0x48d791[_0x39c0('0x23')],'statusCallback':_0x48d791[_0x39c0('0x26')]+_0x39c0('0x27')+_0x38820e['id']+'/status?token='+_0x48d791['token']})[_0x39c0('0x17')](function(_0x104436){if(_0x104436['sid']){return _0x110921[_0x39c0('0x18')]({'messageId':_0x104436[_0x39c0('0x28')]});}})[_0x39c0('0x1a')](function(_0x46153d){logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x20'),util['inspect'](_0x46153d,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x20'),_0x39c0('0x2b'));}break;case'skebby':var _0x22777c='https://api.skebby.it/API/v1.0/REST/';if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){var _0x4037f3={'recipient':[_0x38820e['phone']],'message':_0x38820e[_0x39c0('0xd')],'message_type':_0x48d791[_0x39c0('0x2e')]};if(_0x48d791[_0x39c0('0x2e')]&&_0x48d791[_0x39c0('0x2e')]!=='SI'){_0x4037f3[_0x39c0('0x2f')]=_0x48d791['phone'];}var _0x18b180={'url':_0x22777c+'login?username='+_0x48d791[_0x39c0('0x2c')]+_0x39c0('0x30')+_0x48d791[_0x39c0('0x2d')],'method':_0x39c0('0x31')};rp(_0x18b180)[_0x39c0('0x17')](function(_0x100999){var _0x3904bb=_0x100999[_0x39c0('0x32')](';');var _0x24169a={'user_key':_0x3904bb[0x0],'session_key':_0x3904bb[0x1]};_0x18b180={'url':_0x22777c+'sms','method':_0x39c0('0x33'),'headers':{'user_key':_0x24169a[_0x39c0('0x34')],'Session_key':_0x24169a[_0x39c0('0x35')]},'json':!![],'body':_0x4037f3};return rp(_0x18b180);})['then'](function(_0x49ee80){if(_0x49ee80['total_sent']>=0x1){var _0x2d88bb={'messageId':_0x49ee80[_0x39c0('0x36')]};if(_0x48d791[_0x39c0('0x2e')]!=='GP'||!_0x48d791[_0x39c0('0x37')]){_0x2d88bb[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x2d88bb);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x39'),util[_0x39c0('0x3a')](_0x49ee80,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5639b2){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x39'),util[_0x39c0('0x3a')](_0x5639b2,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x39c0('0x3b'):if(_0x48d791[_0x39c0('0x22')]){var _0x568718={'recipient':_0x38820e[_0x39c0('0x23')],'message':_0x38820e['body'],'sender':_0x48d791[_0x39c0('0x3c')]||_0x48d791[_0x39c0('0x23')],'authorization':_0x48d791[_0x39c0('0x22')]};var _0x3bcd88={'method':_0x39c0('0x33'),'uri':_0x39c0('0x3d'),'body':_0x568718,'json':!![]};rp(_0x3bcd88)[_0x39c0('0x17')](function(_0x567cbb){var _0x2b88f6={'messageId':_0x567cbb['requestid']};if(!_0x48d791[_0x39c0('0x37')]){_0x2b88f6[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x2b88f6);})[_0x39c0('0x1a')](function(_0x9c7f69){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),'connectel',util['inspect'](_0x9c7f69,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x3b'),_0x39c0('0x3e'));}break;case'clicksend':if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){var _0x568718={'messages':[{'source':'xCALLY\x20Motion','to':_0x38820e[_0x39c0('0x23')],'body':_0x38820e['body'],'from':_0x48d791[_0x39c0('0x3c')]||_0x48d791[_0x39c0('0x23')]}]};var _0x2199a7=util[_0x39c0('0x3f')]('%s:%s',_0x48d791[_0x39c0('0x2c')],_0x48d791[_0x39c0('0x2d')]);var _0x3bcd88={'method':'POST','uri':_0x39c0('0x40'),'body':_0x568718,'headers':{'Authorization':util[_0x39c0('0x3f')](_0x39c0('0x41'),new Buffer(_0x2199a7)[_0x39c0('0x42')](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)['then'](function(_0x152f2c){if(_0x152f2c[_0x39c0('0x44')]>=0xc8&&_0x152f2c['http_code']<=0xce){if(_0x152f2c[_0x39c0('0x45')]&&_0x152f2c[_0x39c0('0x45')][_0x39c0('0x46')]>0x0){var _0x410b2f=_[_0x39c0('0x47')](_0x152f2c['data'][_0x39c0('0x24')]);var _0x1a11a3={'messageId':_0x410b2f['message_id']};if(!_0x48d791[_0x39c0('0x37')]){_0x1a11a3[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x1a11a3);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'clickSend',util['inspect'](_0x152f2c,{'showHidden':![],'depth':null}));}}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x48'),util[_0x39c0('0x3a')](_0x152f2c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4a5820){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x48'),util[_0x39c0('0x3a')](_0x4a5820,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'clickSend',_0x39c0('0x49'));}break;case _0x39c0('0x4a'):if(_0x48d791['authId']&&_0x48d791[_0x39c0('0x22')]){var _0x568718={'dst':_0x38820e['phone'],'text':_0x38820e[_0x39c0('0xd')],'src':_0x48d791['senderString']||_0x48d791[_0x39c0('0x23')],'url':_0x48d791[_0x39c0('0x26')]+'/api/sms/messages/'+_0x38820e['id']+_0x39c0('0x4b')+_0x48d791[_0x39c0('0x4c')]};var _0x2199a7=util[_0x39c0('0x3f')](_0x39c0('0x4d'),_0x48d791[_0x39c0('0x4e')],_0x48d791['authToken']);var _0x3bcd88={'method':_0x39c0('0x33'),'uri':util[_0x39c0('0x3f')](_0x39c0('0x4f'),_0x48d791[_0x39c0('0x4e')]),'body':_0x568718,'headers':{'Authorization':util[_0x39c0('0x3f')]('Basic\x20%s',new Buffer(_0x2199a7)[_0x39c0('0x42')](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)['then'](function(_0x2c868c){var _0x28cca3={'messageId':_0x2c868c[_0x39c0('0x50')][0x0]};return _0x110921[_0x39c0('0x18')](_0x28cca3);})[_0x39c0('0x1a')](function(_0x5bfc8b){logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate','plivo',util[_0x39c0('0x3a')](_0x5bfc8b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x39c0('0x51'):if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){if(_0x48d791[_0x39c0('0x52')]){var _0x19dff4={'method':'POST','uri':_0x48d791[_0x39c0('0x52')]+_0x39c0('0x53'),'body':{'username':_0x48d791[_0x39c0('0x2c')],'password':_0x48d791[_0x39c0('0x2d')]},'json':!![]};return rp(_0x19dff4)['then'](function(_0xf34454){var _0x3fcf17={'method':_0x39c0('0x33'),'uri':_0x48d791['baseUrl']+_0x39c0('0x54'),'body':{'messages':[{'from':_0x48d791[_0x39c0('0x23')],'destinations':[{'to':_0x38820e[_0x39c0('0x23')]}],'text':_0x38820e[_0x39c0('0xd')],'notifyUrl':_0x48d791['remote']+_0x39c0('0x27')+_0x38820e['id']+_0x39c0('0x4b')+_0x48d791[_0x39c0('0x4c')],'notifyContentType':_0x39c0('0x55'),'callbackData':_0x48d791['phone']+';'+_0x38820e[_0x39c0('0xd')]}]},'headers':{'Authorization':_0x39c0('0x56')+_0xf34454['token']},'json':!![]};return rp(_0x3fcf17)[_0x39c0('0x17')](function(_0x2e7506){if(_0x2e7506[_0x39c0('0x24')]){var _0x192a60={'messageId':_0x2e7506[_0x39c0('0x24')][0x0][_0x39c0('0xb')]};if(!_0x48d791[_0x39c0('0x37')]){_0x192a60[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x192a60);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x51'),util[_0x39c0('0x3a')](_0x2e7506,{'showHidden':![],'depth':null}));}});})[_0x39c0('0x1a')](function(_0x13215e){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x51'),util['inspect'](_0x13215e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x39c0('0x29'),'afterCreate',_0x39c0('0x51'),_0x39c0('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x39c0('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x39c0('0x58'):var _0x5367ef=require(_0x39c0('0x59'));if(_0x48d791['apiKey']){var _0x420806={};_0x420806[_0x39c0('0x5a')]=_0x48d791['username'];_0x420806[_0x39c0('0x23')]=_0x38820e[_0x39c0('0x23')];_0x420806[_0x39c0('0x2f')]=_0x48d791[_0x39c0('0x23')];_0x420806[_0x39c0('0x5b')]=_0x38820e['body'];_0x420806['timestamp']=+new Date();var _0x11f45c='';var _0x7a353d='';var _0x2f1cdd=Object[_0x39c0('0x5c')](_0x420806);_0x2f1cdd[_0x39c0('0x5d')]();for(var _0x30b6a5=0x0;_0x30b6a5<_0x2f1cdd[_0x39c0('0x5e')];_0x30b6a5++){if(_0x11f45c!=''){_0x11f45c+='&';}_0x11f45c+=_0x2f1cdd[_0x30b6a5]+'='+encodeURIComponent(_0x420806[_0x2f1cdd[_0x30b6a5]]);_0x7a353d+=_0x420806[_0x2f1cdd[_0x30b6a5]];}_0x7a353d+=_0x48d791[_0x39c0('0x5f')];_0x7a353d=_0x5367ef[_0x39c0('0x60')](_0x39c0('0x61'))[_0x39c0('0x18')](_0x7a353d)['digest']('hex');if(_0x11f45c!==''){_0x11f45c+='&';}_0x11f45c+=_0x39c0('0x62')+_0x7a353d;var _0x18b180={'method':_0x39c0('0x31'),'uri':_0x48d791[_0x39c0('0x52')]+_0x39c0('0x63')+_0x11f45c,'json':!![]};return rp(_0x18b180)[_0x39c0('0x17')](function(_0x2a9abe){var _0x1738c9=Object[_0x39c0('0x5c')](_0x2a9abe);if(_0x2a9abe[_0x1738c9[0x0]]['error']&&parseInt(_0x2a9abe[_0x1738c9[0x0]]['error'])===0x0){var _0x1c56c5={'messageId':_0x2a9abe[_0x1738c9[0x0]][_0x39c0('0x64')]};if(!_0x48d791[_0x39c0('0x37')]){_0x1c56c5[_0x39c0('0x38')]=!![];}return _0x110921['update'](_0x1c56c5);}else{return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x58'),util[_0x39c0('0x3a')](_0x2a9abe[_0x39c0('0x1b')],{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5334cf){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),'csc',util[_0x39c0('0x3a')](_0x5334cf,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x58'),_0x39c0('0x65'));}break;case _0x39c0('0x66'):if(_0x48d791[_0x39c0('0x5f')]){var _0x4d6c79={'method':_0x39c0('0x33'),'uri':_0x39c0('0x67'),'headers':{'Authorization':_0x48d791['apiKey']},'body':{'content':_0x38820e[_0x39c0('0xd')],'to':[_0x38820e[_0x39c0('0x23')]],'from':_0x48d791[_0x39c0('0x23')],'binary':![],'clientMessageId':_0x39c0('0x68'),'charset':_0x39c0('0x69')},'json':!![]};rp(_0x4d6c79)[_0x39c0('0x17')](function(_0x537555){if(!_0x537555[_0x39c0('0x1b')]){var _0x46e390={'messageId':_0x537555[_0x39c0('0x24')][0x0][_0x39c0('0x6a')]};if(!_0x48d791[_0x39c0('0x37')]){_0x46e390[_0x39c0('0x38')]=!![];}return _0x110921['update'](_0x46e390);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),'clickatell',util['inspect'](_0x537555[_0x39c0('0x1b')],{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x3b3a43){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x66'),util[_0x39c0('0x3a')](_0x3b3a43,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x66'),_0x39c0('0x65'));}break;case _0x39c0('0x6b'):if(_0x48d791['username']&&_0x48d791[_0x39c0('0x2d')]){var _0x2199a7=util['format'](_0x39c0('0x4d'),_0x48d791[_0x39c0('0x2c')],_0x48d791[_0x39c0('0x2d')]);var _0x3bcd88={'method':_0x39c0('0x33'),'uri':_0x39c0('0x6c')+_0x48d791[_0x39c0('0x6d')]+_0x39c0('0x6e'),'body':{'to':[_0x38820e['phone']],'text':_0x38820e[_0x39c0('0xd')],'from':_0x48d791['phone'],'applicationId':_0x48d791[_0x39c0('0x6f')]},'headers':{'Authorization':util[_0x39c0('0x3f')](_0x39c0('0x41'),new Buffer(_0x2199a7)['toString'](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)[_0x39c0('0x17')](function(_0x2f03ae){if(_0x2f03ae['id']){var _0x6ad54e={'messageId':_0x2f03ae['id']};return _0x110921['update'](_0x6ad54e);}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x6b'),util[_0x39c0('0x3a')](_0x2f03ae,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5956e0){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x6b'),util[_0x39c0('0x3a')](_0x5956e0,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x6b'),_0x39c0('0x49'));}break;case _0x39c0('0x70'):if(_0x48d791[_0x39c0('0x5f')]){var _0x2f03e={};var _0x18b180={'method':_0x39c0('0x33'),'uri':_0x39c0('0x71'),'headers':{'Authorization':_0x39c0('0x72')+_0x48d791[_0x39c0('0x5f')],'Content-Type':_0x39c0('0x55')},'body':{'from':_0x48d791[_0x39c0('0x23')],'to':_0x38820e[_0x39c0('0x23')],'text':_0x38820e[_0x39c0('0xd')]},'json':!![]};return rp(_0x18b180)['then'](function(_0x224fc1){if(_0x224fc1['code']==0xca){_0x2f03e[_0x39c0('0x73')]=_0x224fc1;var _0x533d1d={'method':_0x39c0('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x39c0('0x72')+_0x48d791[_0x39c0('0x5f')],'Content-Type':_0x39c0('0x55')},'body':{'refid':_0x2f03e[_0x39c0('0x73')]['refid']},'json':!![]};return rp(_0x533d1d)['then'](function(_0x120acc){_0x2f03e[_0x39c0('0x74')]=_0x120acc;var _0x4c9190={'messageId':_0x2f03e[_0x39c0('0x73')][_0x39c0('0x75')],'read':!![]};return _0x110921[_0x39c0('0x18')](_0x4c9190);});}else{return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x70'),util[_0x39c0('0x3a')](_0x224fc1,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x59b0fc){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x70'),util[_0x39c0('0x3a')](_0x59b0fc,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x70'),_0x39c0('0x76'));}break;}}})[_0x39c0('0x77')](function(){_0x4d3bf0();});}else{_0x4d3bf0();}}},'charset':_0x39c0('0x78'),'collate':_0x39c0('0x79')});}; \ No newline at end of file +var _0x7743=['applicationId','base64','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','SmsMessage','sms_messages','messageId','FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','secret','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','body','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','username','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','inspect','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','sort','length','md5','digest','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','/messages'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7743,0x85));var _0x3774=function(_0x5c2836,_0x31b257){_0x5c2836=_0x5c2836-0x0;var _0x58ad3f=_0x7743[_0x5c2836];return _0x58ad3f;};'use strict';var _=require(_0x3774('0x0'));var util=require(_0x3774('0x1'));var logger=require(_0x3774('0x2'))(_0x3774('0x3'));var moment=require(_0x3774('0x4'));var BPromise=require(_0x3774('0x5'));var rp=require(_0x3774('0x6'));var fs=require('fs');var path=require(_0x3774('0x7'));var rimraf=require('rimraf');var config=require(_0x3774('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x5c3319,_0x213cea){return _0x5c3319['define'](_0x3774('0x9'),attributes,{'tableName':_0x3774('0xa'),'paranoid':![],'indexes':[{'name':_0x3774('0xb'),'fields':[_0x3774('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':_0x3774('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcdcf76,_0x236dae,_0x2d3839){var _0x1a32d9=_0x5c3319[_0x3774('0xd')];var _0x4c44da=_0xcdcf76['get']({'plain':!![]});if(_0x4c44da['direction'][_0x3774('0xe')]()==='in'||_0x4c44da[_0x3774('0xf')][_0x3774('0xe')]()===_0x3774('0x10')&&!_0x4c44da['secret']&&!_[_0x3774('0x11')](_0x4c44da[_0x3774('0x12')])&&!_[_0x3774('0x11')](_0x4c44da[_0x3774('0x13')])){_0x1a32d9[_0x3774('0x14')][_0x3774('0x15')]({'where':{'id':_0x4c44da[_0x3774('0x13')]}})[_0x3774('0x16')](function(_0x2052f5){if(_0x2052f5){_0x2052f5[_0x3774('0x17')]({'lastMsgAt':_0x4c44da['createdAt'],'lastMsgDirection':_0x4c44da[_0x3774('0xf')]['toLowerCase']()});}})[_0x3774('0x18')](function(_0x21e4fe){console[_0x3774('0x19')](_0x21e4fe);});}if(_0x4c44da[_0x3774('0xf')]===_0x3774('0x10')&&!_0x4c44da[_0x3774('0x1a')]){var _0x4a74ef;_0x1a32d9[_0x3774('0x1b')][_0x3774('0x1c')]({'where':{'id':_0x4c44da['SmsAccountId']},'raw':!![]})[_0x3774('0x16')](function(_0x41212d){_0x4a74ef=_0x41212d;if(_0x4a74ef&&_0x4a74ef[_0x3774('0x1d')]){switch(_0x4a74ef[_0x3774('0x1d')]){case'twilio':var _0x6ba888=require(_0x3774('0x1e'));if(_0x4a74ef[_0x3774('0x1f')]&&_0x4a74ef[_0x3774('0x20')]&&_0x4a74ef[_0x3774('0x21')]){var _0x66290f=new _0x6ba888(_0x4a74ef[_0x3774('0x1f')],_0x4a74ef['authToken']);_0x66290f[_0x3774('0x22')]['create']({'body':_0x4c44da[_0x3774('0x23')],'to':_0x4c44da[_0x3774('0x21')],'from':_0x4a74ef[_0x3774('0x21')],'statusCallback':_0x4a74ef['remote']+_0x3774('0x24')+_0x4c44da['id']+_0x3774('0x25')+_0x4a74ef[_0x3774('0x26')]})[_0x3774('0x16')](function(_0xb05cf9){if(_0xb05cf9[_0x3774('0x27')]){return _0xcdcf76[_0x3774('0x17')]({'messageId':_0xb05cf9[_0x3774('0x27')]});}})[_0x3774('0x18')](function(_0x3822ed){logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate','twilio',util['inspect'](_0x3822ed,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3774('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3774('0x29'):var _0x5478b4=_0x3774('0x2a');if(_0x4a74ef['username']&&_0x4a74ef[_0x3774('0x2b')]){var _0x46c8cc={'recipient':[_0x4c44da[_0x3774('0x21')]],'message':_0x4c44da[_0x3774('0x23')],'message_type':_0x4a74ef['smsMethod']};if(_0x4a74ef[_0x3774('0x2c')]&&_0x4a74ef[_0x3774('0x2c')]!=='SI'){_0x46c8cc['sender']=_0x4a74ef[_0x3774('0x21')];}var _0x5accfe={'url':_0x5478b4+_0x3774('0x2d')+_0x4a74ef[_0x3774('0x2e')]+_0x3774('0x2f')+_0x4a74ef[_0x3774('0x2b')],'method':'GET'};rp(_0x5accfe)['then'](function(_0x679c5a){var _0x2f566e=_0x679c5a[_0x3774('0x30')](';');var _0x5ad272={'user_key':_0x2f566e[0x0],'session_key':_0x2f566e[0x1]};_0x5accfe={'url':_0x5478b4+_0x3774('0x31'),'method':_0x3774('0x32'),'headers':{'user_key':_0x5ad272[_0x3774('0x33')],'Session_key':_0x5ad272[_0x3774('0x34')]},'json':!![],'body':_0x46c8cc};return rp(_0x5accfe);})[_0x3774('0x16')](function(_0x2e6d0d){if(_0x2e6d0d[_0x3774('0x35')]>=0x1){var _0x2776d4={'messageId':_0x2e6d0d[_0x3774('0x36')]};if(_0x4a74ef['smsMethod']!=='GP'||!_0x4a74ef[_0x3774('0x37')]){_0x2776d4[_0x3774('0x38')]=!![];}return _0xcdcf76[_0x3774('0x17')](_0x2776d4);}else{return logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),_0x3774('0x29'),util['inspect'](_0x2e6d0d,{'showHidden':![],'depth':null}));}})[_0x3774('0x18')](function(_0x3ad9e6){return logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),_0x3774('0x29'),util['inspect'](_0x3ad9e6,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x29'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3774('0x3a'):if(_0x4a74ef[_0x3774('0x20')]){var _0xd67216={'recipient':_0x4c44da['phone'],'message':_0x4c44da['body'],'sender':_0x4a74ef[_0x3774('0x3b')]||_0x4a74ef[_0x3774('0x21')],'authorization':_0x4a74ef[_0x3774('0x20')]};var _0x236dae={'method':'POST','uri':_0x3774('0x3c'),'body':_0xd67216,'json':!![]};rp(_0x236dae)[_0x3774('0x16')](function(_0x10e41e){var _0x3ebfde={'messageId':_0x10e41e[_0x3774('0x3d')]};if(!_0x4a74ef[_0x3774('0x37')]){_0x3ebfde[_0x3774('0x38')]=!![];}return _0xcdcf76['update'](_0x3ebfde);})[_0x3774('0x18')](function(_0x12b6ad){logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x3a'),util[_0x3774('0x3e')](_0x12b6ad,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x3a'),'Missing\x20parameters:\x20authToken');}break;case _0x3774('0x3f'):if(_0x4a74ef[_0x3774('0x2e')]&&_0x4a74ef['password']){var _0xd67216={'messages':[{'source':_0x3774('0x40'),'to':_0x4c44da[_0x3774('0x21')],'body':_0x4c44da[_0x3774('0x23')],'from':_0x4a74ef[_0x3774('0x3b')]||_0x4a74ef[_0x3774('0x21')]}]};var _0x415744=util[_0x3774('0x41')]('%s:%s',_0x4a74ef[_0x3774('0x2e')],_0x4a74ef['password']);var _0x236dae={'method':_0x3774('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xd67216,'headers':{'Authorization':util['format'](_0x3774('0x42'),new Buffer(_0x415744)[_0x3774('0x43')]('base64'))},'json':!![]};rp(_0x236dae)[_0x3774('0x16')](function(_0x49ad39){if(_0x49ad39[_0x3774('0x44')]>=0xc8&&_0x49ad39[_0x3774('0x44')]<=0xce){if(_0x49ad39[_0x3774('0x45')]&&_0x49ad39[_0x3774('0x45')][_0x3774('0x46')]>0x0){var _0x6bb33e=_['head'](_0x49ad39[_0x3774('0x45')][_0x3774('0x22')]);var _0x19d22f={'messageId':_0x6bb33e[_0x3774('0x47')]};if(!_0x4a74ef['deliveryReport']){_0x19d22f[_0x3774('0x38')]=!![];}return _0xcdcf76[_0x3774('0x17')](_0x19d22f);}else{logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),_0x3774('0x48'),util[_0x3774('0x3e')](_0x49ad39,{'showHidden':![],'depth':null}));}}else{logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),'clickSend',util[_0x3774('0x3e')](_0x49ad39,{'showHidden':![],'depth':null}));}})[_0x3774('0x18')](function(_0x3af08d){logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x48'),util[_0x3774('0x3e')](_0x3af08d,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3774('0x48'),_0x3774('0x49'));}break;case _0x3774('0x4a'):if(_0x4a74ef[_0x3774('0x4b')]&&_0x4a74ef[_0x3774('0x20')]){var _0xd67216={'dst':_0x4c44da[_0x3774('0x21')],'text':_0x4c44da[_0x3774('0x23')],'src':_0x4a74ef[_0x3774('0x3b')]||_0x4a74ef['phone'],'url':_0x4a74ef[_0x3774('0x4c')]+_0x3774('0x24')+_0x4c44da['id']+_0x3774('0x25')+_0x4a74ef['token']};var _0x415744=util[_0x3774('0x41')](_0x3774('0x4d'),_0x4a74ef['authId'],_0x4a74ef[_0x3774('0x20')]);var _0x236dae={'method':_0x3774('0x32'),'uri':util[_0x3774('0x41')](_0x3774('0x4e'),_0x4a74ef['authId']),'body':_0xd67216,'headers':{'Authorization':util[_0x3774('0x41')](_0x3774('0x42'),new Buffer(_0x415744)[_0x3774('0x43')]('base64'))},'json':!![]};rp(_0x236dae)[_0x3774('0x16')](function(_0x27486e){var _0x4c9a81={'messageId':_0x27486e['message_uuid'][0x0]};return _0xcdcf76[_0x3774('0x17')](_0x4c9a81);})['catch'](function(_0x3dbe78){logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),'plivo',util['inspect'](_0x3dbe78,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x4a'),_0x3774('0x4f'));}break;case _0x3774('0x50'):if(_0x4a74ef[_0x3774('0x2e')]&&_0x4a74ef[_0x3774('0x2b')]){if(_0x4a74ef['baseUrl']){var _0x398874={'method':_0x3774('0x32'),'uri':_0x4a74ef[_0x3774('0x51')]+_0x3774('0x52'),'body':{'username':_0x4a74ef[_0x3774('0x2e')],'password':_0x4a74ef[_0x3774('0x2b')]},'json':!![]};return rp(_0x398874)['then'](function(_0xfa8422){var _0x123722={'method':_0x3774('0x32'),'uri':_0x4a74ef['baseUrl']+_0x3774('0x53'),'body':{'messages':[{'from':_0x4a74ef[_0x3774('0x21')],'destinations':[{'to':_0x4c44da[_0x3774('0x21')]}],'text':_0x4c44da['body'],'notifyUrl':_0x4a74ef[_0x3774('0x4c')]+_0x3774('0x24')+_0x4c44da['id']+_0x3774('0x25')+_0x4a74ef[_0x3774('0x26')],'notifyContentType':_0x3774('0x54'),'callbackData':_0x4a74ef['phone']+';'+_0x4c44da[_0x3774('0x23')]}]},'headers':{'Authorization':_0x3774('0x55')+_0xfa8422[_0x3774('0x26')]},'json':!![]};return rp(_0x123722)[_0x3774('0x16')](function(_0x25c9f0){if(_0x25c9f0['messages']){var _0x47cd8e={'messageId':_0x25c9f0['messages'][0x0][_0x3774('0xb')]};if(!_0x4a74ef['deliveryReport']){_0x47cd8e['read']=!![];}return _0xcdcf76[_0x3774('0x17')](_0x47cd8e);}else{return logger['error'](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x50'),util[_0x3774('0x3e')](_0x25c9f0,{'showHidden':![],'depth':null}));}});})[_0x3774('0x18')](function(_0x50ac9b){return logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x50'),util[_0x3774('0x3e')](_0x50ac9b,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate','infobip',_0x3774('0x56'));}}else{logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),_0x3774('0x50'),_0x3774('0x49'));}break;case _0x3774('0x57'):var _0xd6cf6e=require(_0x3774('0x58'));if(_0x4a74ef[_0x3774('0x59')]){var _0x19c337={};_0x19c337[_0x3774('0x5a')]=_0x4a74ef['username'];_0x19c337[_0x3774('0x21')]=_0x4c44da[_0x3774('0x21')];_0x19c337[_0x3774('0x5b')]=_0x4a74ef[_0x3774('0x21')];_0x19c337['text']=_0x4c44da[_0x3774('0x23')];_0x19c337['timestamp']=+new Date();var _0x12854c='';var _0x232123='';var _0x3d917a=Object['keys'](_0x19c337);_0x3d917a[_0x3774('0x5c')]();for(var _0x118e83=0x0;_0x118e83<_0x3d917a[_0x3774('0x5d')];_0x118e83++){if(_0x12854c!=''){_0x12854c+='&';}_0x12854c+=_0x3d917a[_0x118e83]+'='+encodeURIComponent(_0x19c337[_0x3d917a[_0x118e83]]);_0x232123+=_0x19c337[_0x3d917a[_0x118e83]];}_0x232123+=_0x4a74ef[_0x3774('0x59')];_0x232123=_0xd6cf6e['createHash'](_0x3774('0x5e'))['update'](_0x232123)[_0x3774('0x5f')]('hex');if(_0x12854c!==''){_0x12854c+='&';}_0x12854c+=_0x3774('0x60')+_0x232123;var _0x5accfe={'method':_0x3774('0x61'),'uri':_0x4a74ef[_0x3774('0x51')]+'/external/get/send.php?'+_0x12854c,'json':!![]};return rp(_0x5accfe)[_0x3774('0x16')](function(_0x503b36){var _0x2fc6b7=Object['keys'](_0x503b36);if(_0x503b36[_0x2fc6b7[0x0]]['error']&&parseInt(_0x503b36[_0x2fc6b7[0x0]]['error'])===0x0){var _0xfc365a={'messageId':_0x503b36[_0x2fc6b7[0x0]][_0x3774('0x62')]};if(!_0x4a74ef[_0x3774('0x37')]){_0xfc365a[_0x3774('0x38')]=!![];}return _0xcdcf76[_0x3774('0x17')](_0xfc365a);}else{return logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x57'),util[_0x3774('0x3e')](_0x503b36['error'],{'showHidden':![],'depth':null}));}})[_0x3774('0x18')](function(_0x1957cf){return logger['error'](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x57'),util[_0x3774('0x3e')](_0x1957cf,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x57'),_0x3774('0x63'));}break;case _0x3774('0x64'):if(_0x4a74ef[_0x3774('0x59')]){var _0x5ec67e={'method':_0x3774('0x32'),'uri':_0x3774('0x65'),'headers':{'Authorization':_0x4a74ef['apiKey']},'body':{'content':_0x4c44da[_0x3774('0x23')],'to':[_0x4c44da[_0x3774('0x21')]],'from':_0x4a74ef[_0x3774('0x21')],'binary':![],'clientMessageId':_0x3774('0x66'),'charset':_0x3774('0x67')},'json':!![]};rp(_0x5ec67e)['then'](function(_0x48da5e){if(!_0x48da5e[_0x3774('0x19')]){var _0x356f39={'messageId':_0x48da5e['messages'][0x0]['apiMessageId']};if(!_0x4a74ef['deliveryReport']){_0x356f39['read']=!![];}return _0xcdcf76[_0x3774('0x17')](_0x356f39);}else{return logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util['inspect'](_0x48da5e[_0x3774('0x19')],{'showHidden':![],'depth':null}));}})[_0x3774('0x18')](function(_0x285a2f){return logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x64'),util[_0x3774('0x3e')](_0x285a2f,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x64'),_0x3774('0x63'));}break;case'bandwidth':if(_0x4a74ef[_0x3774('0x2e')]&&_0x4a74ef[_0x3774('0x2b')]){var _0x415744=util['format'](_0x3774('0x4d'),_0x4a74ef[_0x3774('0x2e')],_0x4a74ef['password']);var _0x236dae={'method':_0x3774('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4a74ef['accountId']+_0x3774('0x68'),'body':{'to':[_0x4c44da[_0x3774('0x21')]],'text':_0x4c44da['body'],'from':_0x4a74ef[_0x3774('0x21')],'applicationId':_0x4a74ef[_0x3774('0x69')]},'headers':{'Authorization':util['format'](_0x3774('0x42'),new Buffer(_0x415744)[_0x3774('0x43')](_0x3774('0x6a')))},'json':!![]};rp(_0x236dae)[_0x3774('0x16')](function(_0x3e7c15){if(_0x3e7c15['id']){var _0x4bbeca={'messageId':_0x3e7c15['id']};return _0xcdcf76[_0x3774('0x17')](_0x4bbeca);}else{logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),'bandwidth',util['inspect'](_0x3e7c15,{'showHidden':![],'depth':null}));}})[_0x3774('0x18')](function(_0x9cde0b){logger[_0x3774('0x19')](_0x3774('0x28'),'afterCreate',_0x3774('0x6b'),util[_0x3774('0x3e')](_0x9cde0b,{'showHidden':![],'depth':null}));});}else{logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3774('0x6c'):if(_0x4a74ef['apiKey']){var _0x5c5ca5={};var _0x5accfe={'method':_0x3774('0x32'),'uri':_0x3774('0x6d'),'headers':{'Authorization':_0x3774('0x6e')+_0x4a74ef[_0x3774('0x59')],'Content-Type':'application/json'},'body':{'from':_0x4a74ef[_0x3774('0x21')],'to':_0x4c44da[_0x3774('0x21')],'text':_0x4c44da[_0x3774('0x23')]},'json':!![]};return rp(_0x5accfe)['then'](function(_0x584e39){if(_0x584e39[_0x3774('0x6f')]==0xca){_0x5c5ca5[_0x3774('0x70')]=_0x584e39;var _0x42b6ac={'method':_0x3774('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3774('0x6e')+_0x4a74ef[_0x3774('0x59')],'Content-Type':_0x3774('0x54')},'body':{'refid':_0x5c5ca5[_0x3774('0x70')][_0x3774('0x71')]},'json':!![]};return rp(_0x42b6ac)[_0x3774('0x16')](function(_0x5be980){_0x5c5ca5[_0x3774('0x72')]=_0x5be980;var _0x42529f={'messageId':_0x5c5ca5[_0x3774('0x70')][_0x3774('0x71')],'read':!![]};return _0xcdcf76[_0x3774('0x17')](_0x42529f);});}else{return logger[_0x3774('0x19')](_0x3774('0x28'),_0x3774('0x39'),'intelepeer',util['inspect'](_0x584e39,{'showHidden':![],'depth':null}));}})['catch'](function(_0xac77ac){return logger[_0x3774('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3774('0x39'),'intelepeer',util[_0x3774('0x3e')](_0xac77ac,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x3774('0x28'),_0x3774('0x39'),_0x3774('0x6c'),_0x3774('0x73'));}break;}}})[_0x3774('0x74')](function(){_0x2d3839();});}else{_0x2d3839();}}},'charset':_0x3774('0x75'),'collate':_0x3774('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b3b0fd7..70569de 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 _0x50c1=['redis','localhost','socket.io-emitter','register','request','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','create','body','options','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults'];(function(_0x10b2ae,_0x2db8e9){var _0x193043=function(_0x2fe3cc){while(--_0x2fe3cc){_0x10b2ae['push'](_0x10b2ae['shift']());}};_0x193043(++_0x2db8e9);}(_0x50c1,0x171));var _0x150c=function(_0x20f3a4,_0x5089d4){_0x20f3a4=_0x20f3a4-0x0;var _0x3d5d35=_0x50c1[_0x20f3a4];return _0x3d5d35;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require(_0x150c('0x1'));var BPromise=require('bluebird');var rs=require(_0x150c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x150c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x150c('0x4'))('rpc');var config=require(_0x150c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x150c('0x6')][_0x150c('0x7')]({'port':0x232a});config['redis']=_[_0x150c('0x8')](config[_0x150c('0x9')],{'host':_0x150c('0xa'),'port':0x18eb});var socket=require(_0x150c('0xb'))(new Redis(config[_0x150c('0x9')]));require('./smsMessage.socket')[_0x150c('0xc')](socket);function respondWithRpcPromise(_0x41442c,_0x355c80,_0x480570){return new BPromise(function(_0x50be63,_0xd66817){return client[_0x150c('0xd')](_0x41442c,_0x480570)[_0x150c('0xe')](function(_0x4e1c9f){logger['info']('SmsMessage,\x20%s,\x20%s',_0x355c80,_0x150c('0xf'));logger['debug'](_0x150c('0x10'),_0x355c80,_0x150c('0xf'),JSON['stringify'](_0x4e1c9f));if(_0x4e1c9f['error']){if(_0x4e1c9f['error']['code']===0x1f4){logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);return _0xd66817(_0x4e1c9f[_0x150c('0x11')]['message']);}logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);return _0x50be63(_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);}else{logger['info'](_0x150c('0x12'),_0x355c80,_0x150c('0xf'));_0x50be63(_0x4e1c9f[_0x150c('0x14')][_0x150c('0x13')]);}})['catch'](function(_0x56b14f){logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x56b14f);_0xd66817(_0x56b14f);});});}exports[_0x150c('0x15')]=function(_0x2526ec){var _0x40f7c6=this;return new Promise(function(_0x45a705,_0x38619c){return db[_0x150c('0x16')][_0x150c('0x17')](_0x2526ec[_0x150c('0x18')],{'raw':_0x2526ec['options']?_0x2526ec[_0x150c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x150c('0xe')](function(_0x4356b5){logger['info'](_0x150c('0x15'),_0x2526ec);logger['debug'](_0x150c('0x15'),_0x2526ec,JSON['stringify'](_0x4356b5));_0x45a705(_0x4356b5);})[_0x150c('0x1a')](function(_0x27f9cf){logger[_0x150c('0x11')]('CreateSmsMessage',_0x27f9cf[_0x150c('0x13')],_0x2526ec);_0x38619c(_0x40f7c6[_0x150c('0x11')](0x1f4,_0x27f9cf[_0x150c('0x13')]));});});}; \ No newline at end of file +var _0x94e9=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x94e9,0x11b));var _0x994e=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x94e9[_0x195577];return _0x13c367;};'use strict';var _=require(_0x994e('0x0'));var util=require(_0x994e('0x1'));var moment=require(_0x994e('0x2'));var BPromise=require(_0x994e('0x3'));var rs=require(_0x994e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x994e('0x5'))(_0x994e('0x6'));var config=require(_0x994e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x994e('0x8')]({'port':0x232a});config[_0x994e('0x9')]=_[_0x994e('0xa')](config[_0x994e('0x9')],{'host':_0x994e('0xb'),'port':0x18eb});var socket=require(_0x994e('0xc'))(new Redis(config[_0x994e('0x9')]));require(_0x994e('0xd'))['register'](socket);function respondWithRpcPromise(_0x169080,_0x3b5cc4,_0x16bcb4){return new BPromise(function(_0x766913,_0x3c6a03){return client[_0x994e('0xe')](_0x169080,_0x16bcb4)[_0x994e('0xf')](function(_0x33b021){logger[_0x994e('0x10')](_0x994e('0x11'),_0x3b5cc4,_0x994e('0x12'));logger[_0x994e('0x13')](_0x994e('0x14'),_0x3b5cc4,_0x994e('0x12'),JSON[_0x994e('0x15')](_0x33b021));if(_0x33b021[_0x994e('0x16')]){if(_0x33b021['error'][_0x994e('0x17')]===0x1f4){logger[_0x994e('0x16')](_0x994e('0x11'),_0x3b5cc4,_0x33b021[_0x994e('0x16')][_0x994e('0x18')]);return _0x3c6a03(_0x33b021[_0x994e('0x16')]['message']);}logger[_0x994e('0x16')](_0x994e('0x11'),_0x3b5cc4,_0x33b021[_0x994e('0x16')][_0x994e('0x18')]);return _0x766913(_0x33b021[_0x994e('0x16')][_0x994e('0x18')]);}else{logger[_0x994e('0x10')](_0x994e('0x11'),_0x3b5cc4,_0x994e('0x12'));_0x766913(_0x33b021[_0x994e('0x19')][_0x994e('0x18')]);}})[_0x994e('0x1a')](function(_0x50d029){logger[_0x994e('0x16')](_0x994e('0x11'),_0x3b5cc4,_0x50d029);_0x3c6a03(_0x50d029);});});}exports[_0x994e('0x1b')]=function(_0xff55c8){var _0x3375ba=this;return new Promise(function(_0x1566c6,_0x26295c){return db[_0x994e('0x1c')][_0x994e('0x1d')](_0xff55c8[_0x994e('0x1e')],{'raw':_0xff55c8[_0x994e('0x1f')]?_0xff55c8['options'][_0x994e('0x20')]===undefined?!![]:![]:!![]})[_0x994e('0xf')](function(_0x5ca9db){logger[_0x994e('0x10')](_0x994e('0x1b'),_0xff55c8);logger[_0x994e('0x13')]('CreateSmsMessage',_0xff55c8,JSON[_0x994e('0x15')](_0x5ca9db));_0x1566c6(_0x5ca9db);})['catch'](function(_0x5ba25a){logger[_0x994e('0x16')](_0x994e('0x1b'),_0x5ba25a[_0x994e('0x18')],_0xff55c8);_0x26295c(_0x3375ba[_0x994e('0x16')](0x1f4,_0x5ba25a[_0x994e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1fe6fc5..7e1bfe8 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 _0xa4b2=['removeListener','register','length','./smsMessage.events','save','remove'];(function(_0x1836e8,_0x10ffa5){var _0x2e17cc=function(_0x55ccc9){while(--_0x55ccc9){_0x1836e8['push'](_0x1836e8['shift']());}};_0x2e17cc(++_0x10ffa5);}(_0xa4b2,0x123));var _0x2a4b=function(_0x2e9bc3,_0x2c28da){_0x2e9bc3=_0x2e9bc3-0x0;var _0x3a87c6=_0xa4b2[_0x2e9bc3];return _0x3a87c6;};'use strict';var SmsMessageEvents=require(_0x2a4b('0x0'));var events=[_0x2a4b('0x1'),_0x2a4b('0x2'),'update'];function createListener(_0x3a4314,_0x35eb02){return function(_0x5b152e){_0x35eb02['emit'](_0x3a4314,_0x5b152e);};}function removeListener(_0x401c68,_0x2f99d6){return function(){SmsMessageEvents[_0x2a4b('0x3')](_0x401c68,_0x2f99d6);};}exports[_0x2a4b('0x4')]=function(_0x55da1e){for(var _0x1cfe6b=0x0,_0x328f63=events[_0x2a4b('0x5')];_0x1cfe6b<_0x328f63;_0x1cfe6b++){var _0x1c9a58=events[_0x1cfe6b];var _0x5f53ef=createListener('smsMessage:'+_0x1c9a58,_0x55da1e);SmsMessageEvents['on'](_0x1c9a58,_0x5f53ef);}}; \ No newline at end of file +var _0x4d89=['remove','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x1aaa52,_0x442418){var _0x1a3b6a=function(_0x4a168a){while(--_0x4a168a){_0x1aaa52['push'](_0x1aaa52['shift']());}};_0x1a3b6a(++_0x442418);}(_0x4d89,0x95));var _0x94d8=function(_0xfc698b,_0x3d8e45){_0xfc698b=_0xfc698b-0x0;var _0x57816f=_0x4d89[_0xfc698b];return _0x57816f;};'use strict';var SmsMessageEvents=require(_0x94d8('0x0'));var events=['save',_0x94d8('0x1'),'update'];function createListener(_0x4a619d,_0x4e5824){return function(_0xa42a64){_0x4e5824['emit'](_0x4a619d,_0xa42a64);};}function removeListener(_0x1feb2a,_0xcd328a){return function(){SmsMessageEvents[_0x94d8('0x2')](_0x1feb2a,_0xcd328a);};}exports[_0x94d8('0x3')]=function(_0x54e370){for(var _0x9a3d2=0x0,_0x4c5c71=events[_0x94d8('0x4')];_0x9a3d2<_0x4c5c71;_0x9a3d2++){var _0x1019bd=events[_0x9a3d2];var _0x14098f=createListener(_0x94d8('0x5')+_0x1019bd,_0x54e370);SmsMessageEvents['on'](_0x1019bd,_0x14098f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 4d770df..f2e5347 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 _0x753c=['/:id','show','/:id/teams','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x1a5d3c,_0x597cd0){var _0x2802e7=function(_0x119a92){while(--_0x119a92){_0x1a5d3c['push'](_0x1a5d3c['shift']());}};_0x2802e7(++_0x597cd0);}(_0x753c,0x92));var _0xc753=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x753c[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc753('0x0'));var express=require(_0xc753('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc753('0x2'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xc753('0x3')]('/',auth[_0xc753('0x4')](),controller[_0xc753('0x5')]);router[_0xc753('0x3')](_0xc753('0x6'),auth['isAuthenticated'](),controller[_0xc753('0x7')]);router[_0xc753('0x3')](_0xc753('0x8'),auth[_0xc753('0x4')](),controller[_0xc753('0x9')]);router[_0xc753('0x3')]('/:id/members',auth[_0xc753('0x4')](),controller['getMembers']);router['get'](_0xc753('0xa'),auth[_0xc753('0x4')](),controller['getTeams']);router['get']('/:id/users',auth[_0xc753('0x4')](),controller['getAgents']);router[_0xc753('0xb')]('/',auth[_0xc753('0x4')](),controller['create']);router[_0xc753('0xb')](_0xc753('0xa'),auth[_0xc753('0x4')](),controller[_0xc753('0xc')]);router[_0xc753('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc753('0xd')]);router[_0xc753('0xe')](_0xc753('0x8'),auth['isAuthenticated'](),controller[_0xc753('0xf')]);router[_0xc753('0x10')](_0xc753('0x8'),auth[_0xc753('0x4')](),controller[_0xc753('0x11')]);router[_0xc753('0x10')]('/:id/teams',auth[_0xc753('0x4')](),controller[_0xc753('0x12')]);router['delete'](_0xc753('0x13'),auth['isAuthenticated'](),controller[_0xc753('0x14')]);module[_0xc753('0x15')]=router; \ No newline at end of file +var _0x1a78=['getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0x1a78,0x180));var _0x81a7=function(_0x46acc4,_0x381c5c){_0x46acc4=_0x46acc4-0x0;var _0x308d88=_0x1a78[_0x46acc4];return _0x308d88;};'use strict';var multer=require(_0x81a7('0x0'));var util=require(_0x81a7('0x1'));var path=require(_0x81a7('0x2'));var timeout=require(_0x81a7('0x3'));var express=require(_0x81a7('0x4'));var router=express[_0x81a7('0x5')]();var fs_extra=require(_0x81a7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x81a7('0x7'));var config=require(_0x81a7('0x8'));var controller=require(_0x81a7('0x9'));router['get']('/',auth[_0x81a7('0xa')](),controller['index']);router[_0x81a7('0xb')](_0x81a7('0xc'),auth[_0x81a7('0xa')](),controller['describe']);router[_0x81a7('0xb')](_0x81a7('0xd'),auth[_0x81a7('0xa')](),controller[_0x81a7('0xe')]);router[_0x81a7('0xb')]('/:id/members',auth[_0x81a7('0xa')](),controller[_0x81a7('0xf')]);router[_0x81a7('0xb')](_0x81a7('0x10'),auth['isAuthenticated'](),controller[_0x81a7('0x11')]);router[_0x81a7('0xb')](_0x81a7('0x12'),auth[_0x81a7('0xa')](),controller[_0x81a7('0x13')]);router[_0x81a7('0x14')]('/',auth[_0x81a7('0xa')](),controller[_0x81a7('0x15')]);router['post'](_0x81a7('0x10'),auth[_0x81a7('0xa')](),controller[_0x81a7('0x16')]);router['post'](_0x81a7('0x12'),auth[_0x81a7('0xa')](),controller[_0x81a7('0x17')]);router[_0x81a7('0x18')](_0x81a7('0xd'),auth['isAuthenticated'](),controller[_0x81a7('0x19')]);router[_0x81a7('0x1a')](_0x81a7('0xd'),auth[_0x81a7('0xa')](),controller[_0x81a7('0x1b')]);router[_0x81a7('0x1a')](_0x81a7('0x10'),auth[_0x81a7('0xa')](),controller[_0x81a7('0x1c')]);router[_0x81a7('0x1a')](_0x81a7('0x12'),auth['isAuthenticated'](),controller[_0x81a7('0x1d')]);module[_0x81a7('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b85919b..06f07a7 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 _0x0c31=['ENUM','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x3e97e4,_0x46742d){var _0x31f467=function(_0x407e7a){while(--_0x407e7a){_0x3e97e4['push'](_0x3e97e4['shift']());}};_0x31f467(++_0x46742d);}(_0x0c31,0x96));var _0x10c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0c31[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x10c3('0x0'));module[_0x10c3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x10c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x10c3('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x10c3('0x4')]('rrmemory',_0x10c3('0x5'),_0x10c3('0x6'))}}; \ No newline at end of file +var _0x07b7=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x5bec90,_0x885c73){var _0x5d8698=function(_0x4743fc){while(--_0x4743fc){_0x5bec90['push'](_0x5bec90['shift']());}};_0x5d8698(++_0x885c73);}(_0x07b7,0x16c));var _0x707b=function(_0x37452f,_0x17a04c){_0x37452f=_0x37452f-0x0;var _0xd5b34f=_0x07b7[_0x37452f];return _0xd5b34f;};'use strict';var Sequelize=require(_0x707b('0x0'));module['exports']={'name':{'type':Sequelize[_0x707b('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x707b('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x707b('0x3'),_0x707b('0x4'),_0x707b('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 847ca94..a079c28 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 _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x5f24c4,_0x508a17){var _0x3adf4f=function(_0x1b0e20){while(--_0x1b0e20){_0x5f24c4['push'](_0x5f24c4['shift']());}};_0x3adf4f(++_0x508a17);}(_0xdb28,0x106));var _0x8db2=function(_0x2f8782,_0x4bd976){_0x2f8782=_0x2f8782-0x0;var _0x59a6a1=_0xdb28[_0x2f8782];return _0x59a6a1;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0xadb5,0xad));var _0x5adb=function(_0x2710aa,_0x135a56){_0x2710aa=_0x2710aa-0x0;var _0x88abdf=_0xadb5[_0x2710aa];return _0x88abdf;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 031a182..3db60d0 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 _0xf585=['exports','save','update','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf585,0xf7));var _0x5f58=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf585[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5f58('0x0'),'afterUpdate':_0x5f58('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4f022b){return function(_0x212b2c,_0x3c497d,_0x48538e){SmsQueueEvents['emit'](_0x4f022b+':'+_0x212b2c['id'],_0x212b2c);SmsQueueEvents[_0x5f58('0x2')](_0x4f022b,_0x212b2c);_0x48538e(null);};}for(var e in events){if(events[_0x5f58('0x3')](e)){var event=events[e];SmsQueue[_0x5f58('0x4')](e,emitEvent(event));}}module[_0x5f58('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0xf806=['SmsQueue','save','emit','hook','exports','events'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0xf806,0x6b));var _0x6f80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf806[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6f80('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x6f80('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f80('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x29af7d){return function(_0x158a9c,_0x2f3ce5,_0x10c519){SmsQueueEvents['emit'](_0x29af7d+':'+_0x158a9c['id'],_0x158a9c);SmsQueueEvents[_0x6f80('0x3')](_0x29af7d,_0x158a9c);_0x10c519(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x6f80('0x4')](e,emitEvent(event));}}module[_0x6f80('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index d2f58c9..d4b1fc1 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 _0x78ad=['SmsQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x276f21,_0x5d5821){var _0x4a75e4=function(_0x4e214c){while(--_0x4e214c){_0x276f21['push'](_0x276f21['shift']());}};_0x4a75e4(++_0x5d5821);}(_0x78ad,0x1e1));var _0xd78a=function(_0x2de0f3,_0x358a0a){_0x2de0f3=_0x2de0f3-0x0;var _0x5e992c=_0x78ad[_0x2de0f3];return _0x5e992c;};'use strict';var _=require('lodash');var util=require(_0xd78a('0x0'));var logger=require(_0xd78a('0x1'))(_0xd78a('0x2'));var moment=require(_0xd78a('0x3'));var BPromise=require(_0xd78a('0x4'));var rp=require(_0xd78a('0x5'));var fs=require('fs');var path=require(_0xd78a('0x6'));var rimraf=require(_0xd78a('0x7'));var config=require(_0xd78a('0x8'));var attributes=require(_0xd78a('0x9'));module[_0xd78a('0xa')]=function(_0x4359a2,_0x2a1c3a){return _0x4359a2['define'](_0xd78a('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99fe=['moment','bluebird','request-promise','path','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','api'];(function(_0x832043,_0x59881e){var _0x2eeb21=function(_0x31dc4e){while(--_0x31dc4e){_0x832043['push'](_0x832043['shift']());}};_0x2eeb21(++_0x59881e);}(_0x99fe,0xbd));var _0xe99f=function(_0x441e18,_0x2a4780){_0x441e18=_0x441e18-0x0;var _0x4adf21=_0x99fe[_0x441e18];return _0x4adf21;};'use strict';var _=require('lodash');var util=require(_0xe99f('0x0'));var logger=require(_0xe99f('0x1'))(_0xe99f('0x2'));var moment=require(_0xe99f('0x3'));var BPromise=require(_0xe99f('0x4'));var rp=require(_0xe99f('0x5'));var fs=require('fs');var path=require(_0xe99f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe99f('0x7'));module[_0xe99f('0x8')]=function(_0x36b27a,_0x1f17d6){return _0x36b27a[_0xe99f('0x9')](_0xe99f('0xa'),attributes,{'tableName':_0xe99f('0xb'),'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 96bf7d8..9698cb6 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 _0x8906=['localhost','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x28b39b,_0x58f18a){var _0x253233=function(_0x464f37){while(--_0x464f37){_0x28b39b['push'](_0x28b39b['shift']());}};_0x253233(++_0x58f18a);}(_0x8906,0xbc));var _0x6890=function(_0x39ac07,_0xabefb4){_0x39ac07=_0x39ac07-0x0;var _0x4b9fc8=_0x8906[_0x39ac07];return _0x4b9fc8;};'use strict';var _=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var moment=require(_0x6890('0x2'));var BPromise=require(_0x6890('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6890('0x4'));var db=require(_0x6890('0x5'))['db'];var utils=require(_0x6890('0x6'));var logger=require('../../config/logger')(_0x6890('0x7'));var config=require(_0x6890('0x8'));var jayson=require(_0x6890('0x9'));var client=jayson[_0x6890('0xa')]['http']({'port':0x232a});config[_0x6890('0xb')]=_['defaults'](config[_0x6890('0xb')],{'host':_0x6890('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6890('0xb')]));require(_0x6890('0xd'))[_0x6890('0xe')](socket);function respondWithRpcPromise(_0x28c86b,_0x2aa048,_0x164d03){return new BPromise(function(_0x36ed52,_0x56c32d){return client[_0x6890('0xf')](_0x28c86b,_0x164d03)[_0x6890('0x10')](function(_0x236640){logger[_0x6890('0x11')]('SmsQueue,\x20%s,\x20%s',_0x2aa048,_0x6890('0x12'));logger[_0x6890('0x13')](_0x6890('0x14'),_0x2aa048,_0x6890('0x12'),JSON[_0x6890('0x15')](_0x236640));if(_0x236640[_0x6890('0x16')]){if(_0x236640[_0x6890('0x16')][_0x6890('0x17')]===0x1f4){logger[_0x6890('0x16')](_0x6890('0x18'),_0x2aa048,_0x236640[_0x6890('0x16')][_0x6890('0x19')]);return _0x56c32d(_0x236640[_0x6890('0x16')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x2aa048,_0x236640[_0x6890('0x16')]['message']);return _0x36ed52(_0x236640['error'][_0x6890('0x19')]);}else{logger['info'](_0x6890('0x18'),_0x2aa048,_0x6890('0x12'));_0x36ed52(_0x236640['result'][_0x6890('0x19')]);}})[_0x6890('0x1a')](function(_0x5259d4){logger['error'](_0x6890('0x18'),_0x2aa048,_0x5259d4);_0x56c32d(_0x5259d4);});});}exports[_0x6890('0x1b')]=function(_0x340b4e){var _0x49df81=this;return new Promise(function(_0x35e76a,_0x3471e3){return db[_0x6890('0x1c')][_0x6890('0x1d')]({'raw':_0x340b4e[_0x6890('0x1e')]?_0x340b4e[_0x6890('0x1e')][_0x6890('0x1f')]===undefined?!![]:![]:!![],'where':_0x340b4e['options']?_0x340b4e[_0x6890('0x1e')][_0x6890('0x20')]||null:null,'attributes':_0x340b4e['options']?_0x340b4e[_0x6890('0x1e')][_0x6890('0x21')]||null:null,'limit':_0x340b4e[_0x6890('0x1e')]?_0x340b4e['options'][_0x6890('0x22')]||null:null,'include':_0x340b4e[_0x6890('0x1e')]?_0x340b4e[_0x6890('0x1e')][_0x6890('0x23')]?_[_0x6890('0x24')](_0x340b4e[_0x6890('0x1e')][_0x6890('0x23')],function(_0x490c92){return{'model':db[_0x490c92[_0x6890('0x25')]],'as':_0x490c92['as'],'attributes':_0x490c92['attributes'],'include':_0x490c92[_0x6890('0x23')]?_[_0x6890('0x24')](_0x490c92[_0x6890('0x23')],function(_0x5523e2){return{'model':db[_0x5523e2['model']],'as':_0x5523e2['as'],'attributes':_0x5523e2[_0x6890('0x21')],'include':_0x5523e2[_0x6890('0x23')]?_[_0x6890('0x24')](_0x5523e2[_0x6890('0x23')],function(_0xa6bada){return{'model':db[_0xa6bada[_0x6890('0x25')]],'as':_0xa6bada['as'],'attributes':_0xa6bada[_0x6890('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b5b1){logger[_0x6890('0x11')](_0x6890('0x1b'),_0x340b4e);logger[_0x6890('0x13')](_0x6890('0x1b'),_0x340b4e,JSON[_0x6890('0x15')](_0x56b5b1));_0x35e76a(_0x56b5b1);})[_0x6890('0x1a')](function(_0x416ec3){logger['error']('GetSmsQueue',_0x416ec3[_0x6890('0x19')],_0x340b4e);_0x3471e3(_0x49df81[_0x6890('0x16')](0x1f4,_0x416ec3[_0x6890('0x19')]));});});};exports[_0x6890('0x26')]=function(_0x1f6938){var _0x1f17f8=this;return new Promise(function(_0x32c65c,_0x2ecf60){return db[_0x6890('0x1c')][_0x6890('0x27')]({'raw':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')][_0x6890('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')][_0x6890('0x20')]||null:null,'attributes':_0x1f6938['options']?_0x1f6938[_0x6890('0x1e')][_0x6890('0x21')]||null:null,'include':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')]['include']?_[_0x6890('0x24')](_0x1f6938[_0x6890('0x1e')][_0x6890('0x23')],function(_0x56200d){return{'model':db[_0x56200d[_0x6890('0x25')]],'as':_0x56200d['as'],'attributes':_0x56200d[_0x6890('0x21')],'include':_0x56200d[_0x6890('0x23')]?_[_0x6890('0x24')](_0x56200d[_0x6890('0x23')],function(_0x2aca09){return{'model':db[_0x2aca09[_0x6890('0x25')]],'as':_0x2aca09['as'],'attributes':_0x2aca09[_0x6890('0x21')],'include':_0x2aca09[_0x6890('0x23')]?_[_0x6890('0x24')](_0x2aca09[_0x6890('0x23')],function(_0x42ad60){return{'model':db[_0x42ad60[_0x6890('0x25')]],'as':_0x42ad60['as'],'attributes':_0x42ad60[_0x6890('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6890('0x10')](function(_0x1d5d71){logger[_0x6890('0x11')](_0x6890('0x26'),_0x1f6938);logger[_0x6890('0x13')](_0x6890('0x26'),_0x1f6938,JSON[_0x6890('0x15')](_0x1d5d71));_0x32c65c(_0x1d5d71);})['catch'](function(_0x300740){logger[_0x6890('0x16')]('ShowSmsQueue',_0x300740[_0x6890('0x19')],_0x1f6938);_0x2ecf60(_0x1f17f8[_0x6890('0x16')](0x1f4,_0x300740[_0x6890('0x19')]));});});}; \ No newline at end of file +var _0xd910=['model','debug','catch','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSmsQueue','SmsQueue','options','raw','attributes','include','map'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd910,0x116));var _0x0d91=function(_0x31e87a,_0xb14bd7){_0x31e87a=_0x31e87a-0x0;var _0x234ddd=_0xd910[_0x31e87a];return _0x234ddd;};'use strict';var _=require(_0x0d91('0x0'));var util=require(_0x0d91('0x1'));var moment=require(_0x0d91('0x2'));var BPromise=require(_0x0d91('0x3'));var rs=require(_0x0d91('0x4'));var fs=require('fs');var Redis=require(_0x0d91('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d91('0x6'))(_0x0d91('0x7'));var config=require(_0x0d91('0x8'));var jayson=require(_0x0d91('0x9'));var client=jayson[_0x0d91('0xa')][_0x0d91('0xb')]({'port':0x232a});config[_0x0d91('0xc')]=_[_0x0d91('0xd')](config[_0x0d91('0xc')],{'host':_0x0d91('0xe'),'port':0x18eb});var socket=require(_0x0d91('0xf'))(new Redis(config[_0x0d91('0xc')]));require('./smsQueue.socket')[_0x0d91('0x10')](socket);function respondWithRpcPromise(_0xc0c306,_0x446dfd,_0x220030){return new BPromise(function(_0x488a94,_0x2777b3){return client[_0x0d91('0x11')](_0xc0c306,_0x220030)[_0x0d91('0x12')](function(_0x5e6a64){logger[_0x0d91('0x13')](_0x0d91('0x14'),_0x446dfd,'request\x20sent');logger['debug'](_0x0d91('0x15'),_0x446dfd,_0x0d91('0x16'),JSON[_0x0d91('0x17')](_0x5e6a64));if(_0x5e6a64[_0x0d91('0x18')]){if(_0x5e6a64[_0x0d91('0x18')]['code']===0x1f4){logger[_0x0d91('0x18')](_0x0d91('0x14'),_0x446dfd,_0x5e6a64[_0x0d91('0x18')][_0x0d91('0x19')]);return _0x2777b3(_0x5e6a64['error'][_0x0d91('0x19')]);}logger['error'](_0x0d91('0x14'),_0x446dfd,_0x5e6a64[_0x0d91('0x18')][_0x0d91('0x19')]);return _0x488a94(_0x5e6a64[_0x0d91('0x18')][_0x0d91('0x19')]);}else{logger[_0x0d91('0x13')](_0x0d91('0x14'),_0x446dfd,_0x0d91('0x16'));_0x488a94(_0x5e6a64[_0x0d91('0x1a')][_0x0d91('0x19')]);}})['catch'](function(_0x2e8526){logger[_0x0d91('0x18')]('SmsQueue,\x20%s,\x20%s',_0x446dfd,_0x2e8526);_0x2777b3(_0x2e8526);});});}exports[_0x0d91('0x1b')]=function(_0x3d76cb){var _0x36cdcc=this;return new Promise(function(_0x2232f2,_0x414354){return db[_0x0d91('0x1c')]['findAll']({'raw':_0x3d76cb[_0x0d91('0x1d')]?_0x3d76cb['options'][_0x0d91('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d76cb[_0x0d91('0x1d')]?_0x3d76cb['options']['where']||null:null,'attributes':_0x3d76cb[_0x0d91('0x1d')]?_0x3d76cb[_0x0d91('0x1d')][_0x0d91('0x1f')]||null:null,'limit':_0x3d76cb['options']?_0x3d76cb['options']['limit']||null:null,'include':_0x3d76cb[_0x0d91('0x1d')]?_0x3d76cb[_0x0d91('0x1d')][_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x3d76cb[_0x0d91('0x1d')][_0x0d91('0x20')],function(_0x677f69){return{'model':db[_0x677f69[_0x0d91('0x22')]],'as':_0x677f69['as'],'attributes':_0x677f69[_0x0d91('0x1f')],'include':_0x677f69[_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x677f69[_0x0d91('0x20')],function(_0x12f97a){return{'model':db[_0x12f97a[_0x0d91('0x22')]],'as':_0x12f97a['as'],'attributes':_0x12f97a[_0x0d91('0x1f')],'include':_0x12f97a[_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x12f97a[_0x0d91('0x20')],function(_0x4df33c){return{'model':db[_0x4df33c[_0x0d91('0x22')]],'as':_0x4df33c['as'],'attributes':_0x4df33c[_0x0d91('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb95e97){logger['info']('GetSmsQueue',_0x3d76cb);logger[_0x0d91('0x23')](_0x0d91('0x1b'),_0x3d76cb,JSON[_0x0d91('0x17')](_0xb95e97));_0x2232f2(_0xb95e97);})[_0x0d91('0x24')](function(_0x40919d){logger['error']('GetSmsQueue',_0x40919d[_0x0d91('0x19')],_0x3d76cb);_0x414354(_0x36cdcc[_0x0d91('0x18')](0x1f4,_0x40919d[_0x0d91('0x19')]));});});};exports['ShowSmsQueue']=function(_0x3f5343){var _0x5cf0d2=this;return new Promise(function(_0x4499e3,_0x157f97){return db['SmsQueue'][_0x0d91('0x25')]({'raw':_0x3f5343[_0x0d91('0x1d')]?_0x3f5343[_0x0d91('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3f5343[_0x0d91('0x1d')]?_0x3f5343['options']['where']||null:null,'attributes':_0x3f5343['options']?_0x3f5343[_0x0d91('0x1d')]['attributes']||null:null,'include':_0x3f5343[_0x0d91('0x1d')]?_0x3f5343[_0x0d91('0x1d')][_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x3f5343[_0x0d91('0x1d')][_0x0d91('0x20')],function(_0x1296e7){return{'model':db[_0x1296e7['model']],'as':_0x1296e7['as'],'attributes':_0x1296e7[_0x0d91('0x1f')],'include':_0x1296e7[_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x1296e7[_0x0d91('0x20')],function(_0x3a70be){return{'model':db[_0x3a70be[_0x0d91('0x22')]],'as':_0x3a70be['as'],'attributes':_0x3a70be[_0x0d91('0x1f')],'include':_0x3a70be[_0x0d91('0x20')]?_[_0x0d91('0x21')](_0x3a70be[_0x0d91('0x20')],function(_0x2fc1ef){return{'model':db[_0x2fc1ef['model']],'as':_0x2fc1ef['as'],'attributes':_0x2fc1ef[_0x0d91('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x556969){logger[_0x0d91('0x13')](_0x0d91('0x26'),_0x3f5343);logger[_0x0d91('0x23')](_0x0d91('0x26'),_0x3f5343,JSON[_0x0d91('0x17')](_0x556969));_0x4499e3(_0x556969);})[_0x0d91('0x24')](function(_0x72806b){logger[_0x0d91('0x18')](_0x0d91('0x26'),_0x72806b[_0x0d91('0x19')],_0x3f5343);_0x157f97(_0x5cf0d2[_0x0d91('0x18')](0x1f4,_0x72806b[_0x0d91('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 427c737..11c9e82 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 _0xae77=['remove','update','emit','removeListener','./smsQueue.events','save'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xae77,0x196));var _0x7ae7=function(_0x115f84,_0x5f5c55){_0x115f84=_0x115f84-0x0;var _0x53c7d4=_0xae77[_0x115f84];return _0x53c7d4;};'use strict';var SmsQueueEvents=require(_0x7ae7('0x0'));var events=[_0x7ae7('0x1'),_0x7ae7('0x2'),_0x7ae7('0x3')];function createListener(_0x400371,_0x4ba2ad){return function(_0x517109){_0x4ba2ad[_0x7ae7('0x4')](_0x400371,_0x517109);};}function removeListener(_0x8f30ad,_0x53bfc5){return function(){SmsQueueEvents[_0x7ae7('0x5')](_0x8f30ad,_0x53bfc5);};}exports['register']=function(_0x3e98e1){for(var _0x179086=0x0,_0x53256e=events['length'];_0x179086<_0x53256e;_0x179086++){var _0x51512c=events[_0x179086];var _0x444876=createListener('smsQueue:'+_0x51512c,_0x3e98e1);SmsQueueEvents['on'](_0x51512c,_0x444876);}}; \ No newline at end of file +var _0x219c=['length','smsQueue:','./smsQueue.events','save','removeListener'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x219c,0xca));var _0xc219=function(_0x1693da,_0xade59c){_0x1693da=_0x1693da-0x0;var _0x44187f=_0x219c[_0x1693da];return _0x44187f;};'use strict';var SmsQueueEvents=require(_0xc219('0x0'));var events=[_0xc219('0x1'),'remove','update'];function createListener(_0x51630a,_0x4ae01a){return function(_0x54ddee){_0x4ae01a['emit'](_0x51630a,_0x54ddee);};}function removeListener(_0x962872,_0x429cd7){return function(){SmsQueueEvents[_0xc219('0x2')](_0x962872,_0x429cd7);};}exports['register']=function(_0x5421c3){for(var _0x50ef90=0x0,_0x160eac=events[_0xc219('0x3')];_0x50ef90<_0x160eac;_0x50ef90++){var _0x90220b=events[_0x50ef90];var _0x484bf4=createListener(_0xc219('0x4')+_0x90220b,_0x5421c3);SmsQueueEvents['on'](_0x90220b,_0x484bf4);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f0e389a..faa2c46 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 _0xf22c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3ab7ea,_0x23b0f0){var _0x2eab6f=function(_0x58f051){while(--_0x58f051){_0x3ab7ea['push'](_0x3ab7ea['shift']());}};_0x2eab6f(++_0x23b0f0);}(_0xf22c,0x19f));var _0xcf22=function(_0x2e185e,_0x2c061a){_0x2e185e=_0x2e185e-0x0;var _0x23687c=_0xf22c[_0x2e185e];return _0x23687c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf22('0x0'));var timeout=require(_0xcf22('0x1'));var express=require(_0xcf22('0x2'));var router=express[_0xcf22('0x3')]();var fs_extra=require(_0xcf22('0x4'));var auth=require(_0xcf22('0x5'));var interaction=require(_0xcf22('0x6'));var config=require(_0xcf22('0x7'));var controller=require(_0xcf22('0x8'));router['get']('/',auth[_0xcf22('0x9')](),controller['index']);router[_0xcf22('0xa')](_0xcf22('0xb'),auth[_0xcf22('0x9')](),controller[_0xcf22('0xc')]);router[_0xcf22('0xa')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0xe')]);router[_0xcf22('0xf')]('/',auth[_0xcf22('0x9')](),controller[_0xcf22('0x10')]);router[_0xcf22('0x11')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0x12')]);router[_0xcf22('0x13')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0x14')]);module[_0xcf22('0x15')]=router; \ No newline at end of file +var _0x9330=['describe','/:id','show','post','create','put','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x284c96,_0x3e1bec){var _0xbdbb1e=function(_0xb9050){while(--_0xb9050){_0x284c96['push'](_0x284c96['shift']());}};_0xbdbb1e(++_0x3e1bec);}(_0x9330,0x14a));var _0x0933=function(_0x24d6f5,_0x5d0c1c){_0x24d6f5=_0x24d6f5-0x0;var _0x5368fe=_0x9330[_0x24d6f5];return _0x5368fe;};'use strict';var multer=require(_0x0933('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0933('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0933('0x2'));var auth=require(_0x0933('0x3'));var interaction=require(_0x0933('0x4'));var config=require(_0x0933('0x5'));var controller=require(_0x0933('0x6'));router[_0x0933('0x7')]('/',auth[_0x0933('0x8')](),controller['index']);router[_0x0933('0x7')](_0x0933('0x9'),auth[_0x0933('0x8')](),controller[_0x0933('0xa')]);router[_0x0933('0x7')](_0x0933('0xb'),auth[_0x0933('0x8')](),controller[_0x0933('0xc')]);router[_0x0933('0xd')]('/',auth[_0x0933('0x8')](),controller[_0x0933('0xe')]);router[_0x0933('0xf')](_0x0933('0xb'),auth[_0x0933('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0933('0x10')]);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 f3a5f37..a173b16 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 _0x757b=['sequelize','STRING','DATE','moment'];(function(_0x313352,_0x4f9bd4){var _0x217947=function(_0x5c63fe){while(--_0x5c63fe){_0x313352['push'](_0x313352['shift']());}};_0x217947(++_0x4f9bd4);}(_0x757b,0xa7));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb757('0x0'));var Sequelize=require(_0xb757('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb757('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb757('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb757('0x3')]},'exitAt':{'type':Sequelize[_0xb757('0x3')]},'reason':{'type':Sequelize[_0xb757('0x2')]}}; \ No newline at end of file +var _0xcd65=['sequelize','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd65,0x12b));var _0x5cd6=function(_0x469665,_0x394876){_0x469665=_0x469665-0x0;var _0x291ab5=_0xcd65[_0x469665];return _0x291ab5;};'use strict';var moment=require(_0x5cd6('0x0'));var Sequelize=require(_0x5cd6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5cd6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5cd6('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5cd6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5eef818..c3e2017 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 _0xa663=['apply','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x39195c,_0x509c6c){var _0xd4ddfb=function(_0x4255dc){while(--_0x4255dc){_0x39195c['push'](_0x39195c['shift']());}};_0xd4ddfb(++_0x509c6c);}(_0xa663,0x159));var _0x3a66=function(_0x2d6d88,_0x2ea070){_0x2d6d88=_0x2d6d88-0x0;var _0x1991b0=_0xa663[_0x2d6d88];return _0x1991b0;};'use strict';var emlformat=require(_0x3a66('0x0'));var rimraf=require(_0x3a66('0x1'));var zipdir=require(_0x3a66('0x2'));var jsonpatch=require(_0x3a66('0x3'));var rp=require(_0x3a66('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3a66('0x5'));var sox=require(_0x3a66('0x6'));var csv=require('to-csv');var ejs=require(_0x3a66('0x7'));var fs=require('fs');var fs_extra=require(_0x3a66('0x8'));var _=require(_0x3a66('0x9'));var squel=require(_0x3a66('0xa'));var crypto=require(_0x3a66('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3a66('0xc'));var toCsv=require(_0x3a66('0xd'));var querystring=require(_0x3a66('0xe'));var Papa=require('papaparse');var Redis=require(_0x3a66('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3a66('0x10'));var as=require(_0x3a66('0x11'));var hardwareService=require(_0x3a66('0x12'));var logger=require(_0x3a66('0x13'))(_0x3a66('0x14'));var utils=require(_0x3a66('0x15'));var config=require(_0x3a66('0x16'));var licenseUtil=require(_0x3a66('0x17'));var db=require(_0x3a66('0x18'))['db'];function respondWithStatusCode(_0x242215,_0x169d8a){_0x169d8a=_0x169d8a||0xcc;return function(_0x737f9c){if(_0x737f9c){return _0x242215[_0x3a66('0x19')](_0x169d8a);}return _0x242215[_0x3a66('0x1a')](_0x169d8a)[_0x3a66('0x1b')]();};}function respondWithResult(_0x5f5193,_0x2e0af9){_0x2e0af9=_0x2e0af9||0xc8;return function(_0x2cafa5){if(_0x2cafa5){return _0x5f5193[_0x3a66('0x1a')](_0x2e0af9)[_0x3a66('0x1c')](_0x2cafa5);}};}function respondWithFilteredResult(_0x242c47,_0xb0d6df){return function(_0x29cfd4){if(_0x29cfd4){var _0x4f4efb=typeof _0xb0d6df[_0x3a66('0x1d')]===_0x3a66('0x1e')&&typeof _0xb0d6df['limit']==='undefined';var _0x3ec8b4=_0x29cfd4[_0x3a66('0x1f')];var _0x145eea=_0x4f4efb?0x0:_0xb0d6df[_0x3a66('0x1d')];var _0x56b74f=_0x4f4efb?_0x29cfd4[_0x3a66('0x1f')]:_0xb0d6df['offset']+_0xb0d6df[_0x3a66('0x20')];var _0x37bde1;if(_0x56b74f>=_0x3ec8b4){_0x56b74f=_0x3ec8b4;_0x37bde1=0xc8;}else{_0x37bde1=0xce;}_0x242c47[_0x3a66('0x1a')](_0x37bde1);return _0x242c47[_0x3a66('0x21')](_0x3a66('0x22'),_0x145eea+'-'+_0x56b74f+'/'+_0x3ec8b4)['json'](_0x29cfd4);}return null;};}function patchUpdates(_0xafbd5){return function(_0x3c07f5){try{jsonpatch[_0x3a66('0x23')](_0x3c07f5,_0xafbd5,!![]);}catch(_0x427a6f){return BPromise['reject'](_0x427a6f);}return _0x3c07f5[_0x3a66('0x24')]();};}function saveUpdates(_0x7ef713,_0x2eab48){return function(_0x476f56){if(_0x476f56){return _0x476f56[_0x3a66('0x25')](_0x7ef713)[_0x3a66('0x26')](function(_0x11fc21){return _0x11fc21;});}return null;};}function removeEntity(_0xc4df65,_0x4e80d5){return function(_0xe38c7c){if(_0xe38c7c){return _0xe38c7c[_0x3a66('0x27')]()[_0x3a66('0x26')](function(){_0xc4df65['status'](0xcc)[_0x3a66('0x1b')]();});}};}function handleEntityNotFound(_0x15ed75,_0x17015a){return function(_0x290de8){if(!_0x290de8){_0x15ed75['sendStatus'](0x194);}return _0x290de8;};}function handleError(_0x1f7bbe,_0x41ea72){_0x41ea72=_0x41ea72||0x1f4;return function(_0x4a9eec){logger[_0x3a66('0x28')](_0x4a9eec[_0x3a66('0x29')]);if(_0x4a9eec[_0x3a66('0x2a')]){delete _0x4a9eec[_0x3a66('0x2a')];}_0x1f7bbe[_0x3a66('0x1a')](_0x41ea72)[_0x3a66('0x2b')](_0x4a9eec);};}exports[_0x3a66('0x2c')]=function(_0x2ce50c,_0x564106){var _0x2c5c49={},_0x39248d={},_0x460c30={'count':0x0,'rows':[]};var _0x321e26=_['map'](db[_0x3a66('0x2d')][_0x3a66('0x2e')],function(_0x1ab8bf){return{'name':_0x1ab8bf[_0x3a66('0x2f')],'type':_0x1ab8bf[_0x3a66('0x30')]['key']};});_0x39248d['model']=_[_0x3a66('0x31')](_0x321e26,_0x3a66('0x2a'));_0x39248d[_0x3a66('0x32')]=_[_0x3a66('0x33')](_0x2ce50c[_0x3a66('0x32')]);_0x39248d[_0x3a66('0x34')]=_['intersection'](_0x39248d['model'],_0x39248d[_0x3a66('0x32')]);_0x2c5c49['attributes']=_[_0x3a66('0x35')](_0x39248d[_0x3a66('0x36')],qs[_0x3a66('0x37')](_0x2ce50c[_0x3a66('0x32')]['fields']));_0x2c5c49[_0x3a66('0x38')]=_0x2c5c49[_0x3a66('0x38')]['length']?_0x2c5c49['attributes']:_0x39248d[_0x3a66('0x36')];if(!_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x39')](_0x3a66('0x3a'))){_0x2c5c49['limit']=qs[_0x3a66('0x20')](_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x20')]);_0x2c5c49[_0x3a66('0x1d')]=qs[_0x3a66('0x1d')](_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x1d')]);}_0x2c5c49[_0x3a66('0x3b')]=qs[_0x3a66('0x3c')](_0x2ce50c['query']['sort']);_0x2c5c49[_0x3a66('0x3d')]=qs[_0x3a66('0x34')](_[_0x3a66('0x3e')](_0x2ce50c[_0x3a66('0x32')],_0x39248d[_0x3a66('0x34')]),_0x321e26);if(_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x3f')]){_0x2c5c49[_0x3a66('0x3d')]=_[_0x3a66('0x40')](_0x2c5c49['where'],{'$or':_['map'](_0x321e26,function(_0x4f6fac){if(_0x4f6fac['type']!==_0x3a66('0x41')){var _0xee04fb={};_0xee04fb[_0x4f6fac[_0x3a66('0x2a')]]={'$like':'%'+_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x3f')]+'%'};return _0xee04fb;}})});}_0x2c5c49=_[_0x3a66('0x40')]({},_0x2c5c49,_0x2ce50c[_0x3a66('0x42')]);var _0x248118={'where':_0x2c5c49[_0x3a66('0x3d')]};return db[_0x3a66('0x2d')]['count'](_0x248118)[_0x3a66('0x26')](function(_0x1526d8){_0x460c30[_0x3a66('0x1f')]=_0x1526d8;if(_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x43')]){_0x2c5c49[_0x3a66('0x44')]=[{'all':!![]}];}return db[_0x3a66('0x2d')]['findAll'](_0x2c5c49);})[_0x3a66('0x26')](function(_0x4305a7){_0x460c30['rows']=_0x4305a7;return _0x460c30;})[_0x3a66('0x26')](respondWithFilteredResult(_0x564106,_0x2c5c49))[_0x3a66('0x45')](handleError(_0x564106,null));};exports[_0x3a66('0x46')]=function(_0x54430a,_0x4a9467){var _0x452616={'raw':!![],'where':{'id':_0x54430a[_0x3a66('0x47')]['id']}},_0x443881={};_0x443881[_0x3a66('0x36')]=_[_0x3a66('0x33')](db[_0x3a66('0x2d')][_0x3a66('0x2e')]);_0x443881[_0x3a66('0x32')]=_['keys'](_0x54430a[_0x3a66('0x32')]);_0x443881[_0x3a66('0x34')]=_[_0x3a66('0x35')](_0x443881['model'],_0x443881[_0x3a66('0x32')]);_0x452616[_0x3a66('0x38')]=_['intersection'](_0x443881['model'],qs['fields'](_0x54430a[_0x3a66('0x32')]['fields']));_0x452616[_0x3a66('0x38')]=_0x452616[_0x3a66('0x38')][_0x3a66('0x48')]?_0x452616[_0x3a66('0x38')]:_0x443881['model'];if(_0x54430a[_0x3a66('0x32')][_0x3a66('0x43')]){_0x452616['include']=[{'all':!![]}];}_0x452616=_[_0x3a66('0x40')]({},_0x452616,_0x54430a['options']);return db[_0x3a66('0x2d')][_0x3a66('0x49')](_0x452616)[_0x3a66('0x26')](handleEntityNotFound(_0x4a9467,null))[_0x3a66('0x26')](respondWithResult(_0x4a9467,null))[_0x3a66('0x45')](handleError(_0x4a9467,null));};exports[_0x3a66('0x4a')]=function(_0x5ef124,_0x1428d4){return db[_0x3a66('0x2d')][_0x3a66('0x4a')](_0x5ef124[_0x3a66('0x4b')],{})[_0x3a66('0x26')](respondWithResult(_0x1428d4,0xc9))[_0x3a66('0x45')](handleError(_0x1428d4,null));};exports[_0x3a66('0x25')]=function(_0x24715d,_0x4865a8){if(_0x24715d['body']['id']){delete _0x24715d[_0x3a66('0x4b')]['id'];}return db[_0x3a66('0x2d')]['find']({'where':{'id':_0x24715d[_0x3a66('0x47')]['id']}})['then'](handleEntityNotFound(_0x4865a8,null))[_0x3a66('0x26')](saveUpdates(_0x24715d[_0x3a66('0x4b')],null))['then'](respondWithResult(_0x4865a8,null))[_0x3a66('0x45')](handleError(_0x4865a8,null));};exports['destroy']=function(_0x584271,_0x9c7fcc){return db[_0x3a66('0x2d')][_0x3a66('0x49')]({'where':{'id':_0x584271[_0x3a66('0x47')]['id']}})[_0x3a66('0x26')](handleEntityNotFound(_0x9c7fcc,null))[_0x3a66('0x26')](removeEntity(_0x9c7fcc,null))[_0x3a66('0x45')](handleError(_0x9c7fcc,null));};exports['describe']=function(_0x5bd95d,_0x1520e0){return db[_0x3a66('0x2d')]['describe']()[_0x3a66('0x26')](respondWithResult(_0x1520e0,null))[_0x3a66('0x45')](handleError(_0x1520e0,null));}; \ No newline at end of file +var _0x7b03=['Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x7b03,0x173));var _0x37b0=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x7b03[_0x47a40b];return _0x19610c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37b0('0x0'));var zipdir=require(_0x37b0('0x1'));var jsonpatch=require(_0x37b0('0x2'));var rp=require(_0x37b0('0x3'));var moment=require(_0x37b0('0x4'));var BPromise=require(_0x37b0('0x5'));var Mustache=require(_0x37b0('0x6'));var util=require(_0x37b0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x37b0('0x8'));var ejs=require(_0x37b0('0x9'));var fs=require('fs');var fs_extra=require(_0x37b0('0xa'));var _=require(_0x37b0('0xb'));var squel=require(_0x37b0('0xc'));var crypto=require(_0x37b0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x37b0('0xe'));var toCsv=require(_0x37b0('0x8'));var querystring=require(_0x37b0('0xf'));var Papa=require(_0x37b0('0x10'));var Redis=require(_0x37b0('0x11'));var authService=require(_0x37b0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x37b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37b0('0x14'))(_0x37b0('0x15'));var utils=require(_0x37b0('0x16'));var config=require(_0x37b0('0x17'));var licenseUtil=require(_0x37b0('0x18'));var db=require(_0x37b0('0x19'))['db'];function respondWithStatusCode(_0x9f1e0e,_0x4df2c6){_0x4df2c6=_0x4df2c6||0xcc;return function(_0x3889d0){if(_0x3889d0){return _0x9f1e0e[_0x37b0('0x1a')](_0x4df2c6);}return _0x9f1e0e[_0x37b0('0x1b')](_0x4df2c6)[_0x37b0('0x1c')]();};}function respondWithResult(_0x29a468,_0xf48540){_0xf48540=_0xf48540||0xc8;return function(_0x39d074){if(_0x39d074){return _0x29a468['status'](_0xf48540)[_0x37b0('0x1d')](_0x39d074);}};}function respondWithFilteredResult(_0x207cfb,_0x559156){return function(_0x349155){if(_0x349155){var _0xfeeb30=typeof _0x559156[_0x37b0('0x1e')]==='undefined'&&typeof _0x559156[_0x37b0('0x1f')]===_0x37b0('0x20');var _0x236314=_0x349155[_0x37b0('0x21')];var _0x41501b=_0xfeeb30?0x0:_0x559156[_0x37b0('0x1e')];var _0x335a64=_0xfeeb30?_0x349155[_0x37b0('0x21')]:_0x559156[_0x37b0('0x1e')]+_0x559156['limit'];var _0x5ce396;if(_0x335a64>=_0x236314){_0x335a64=_0x236314;_0x5ce396=0xc8;}else{_0x5ce396=0xce;}_0x207cfb['status'](_0x5ce396);return _0x207cfb['set'](_0x37b0('0x22'),_0x41501b+'-'+_0x335a64+'/'+_0x236314)['json'](_0x349155);}return null;};}function patchUpdates(_0x4e2c5d){return function(_0x15e3c6){try{jsonpatch[_0x37b0('0x23')](_0x15e3c6,_0x4e2c5d,!![]);}catch(_0x34a9a3){return BPromise[_0x37b0('0x24')](_0x34a9a3);}return _0x15e3c6[_0x37b0('0x25')]();};}function saveUpdates(_0x1b995b,_0x58e2ba){return function(_0x484933){if(_0x484933){return _0x484933[_0x37b0('0x26')](_0x1b995b)[_0x37b0('0x27')](function(_0x54920c){return _0x54920c;});}return null;};}function removeEntity(_0x23d3e3,_0x4e97d8){return function(_0x59aacc){if(_0x59aacc){return _0x59aacc['destroy']()['then'](function(){_0x23d3e3['status'](0xcc)[_0x37b0('0x1c')]();});}};}function handleEntityNotFound(_0x40e24b,_0x1fc2b7){return function(_0x1d07ae){if(!_0x1d07ae){_0x40e24b[_0x37b0('0x1a')](0x194);}return _0x1d07ae;};}function handleError(_0x4cc1a9,_0x251fbd){_0x251fbd=_0x251fbd||0x1f4;return function(_0x230411){logger[_0x37b0('0x28')](_0x230411[_0x37b0('0x29')]);if(_0x230411['name']){delete _0x230411[_0x37b0('0x2a')];}_0x4cc1a9['status'](_0x251fbd)[_0x37b0('0x2b')](_0x230411);};}exports[_0x37b0('0x2c')]=function(_0x43b961,_0x479021){var _0x33160e={},_0x533bbb={},_0x5eada4={'count':0x0,'rows':[]};var _0xb0f8eb=_[_0x37b0('0x2d')](db[_0x37b0('0x2e')][_0x37b0('0x2f')],function(_0x409ca4){return{'name':_0x409ca4[_0x37b0('0x30')],'type':_0x409ca4[_0x37b0('0x31')][_0x37b0('0x32')]};});_0x533bbb['model']=_[_0x37b0('0x2d')](_0xb0f8eb,'name');_0x533bbb[_0x37b0('0x33')]=_['keys'](_0x43b961[_0x37b0('0x33')]);_0x533bbb['filters']=_[_0x37b0('0x34')](_0x533bbb[_0x37b0('0x35')],_0x533bbb[_0x37b0('0x33')]);_0x33160e['attributes']=_[_0x37b0('0x34')](_0x533bbb[_0x37b0('0x35')],qs[_0x37b0('0x36')](_0x43b961['query'][_0x37b0('0x36')]));_0x33160e[_0x37b0('0x37')]=_0x33160e[_0x37b0('0x37')][_0x37b0('0x38')]?_0x33160e[_0x37b0('0x37')]:_0x533bbb['model'];if(!_0x43b961['query'][_0x37b0('0x39')](_0x37b0('0x3a'))){_0x33160e[_0x37b0('0x1f')]=qs[_0x37b0('0x1f')](_0x43b961['query'][_0x37b0('0x1f')]);_0x33160e[_0x37b0('0x1e')]=qs[_0x37b0('0x1e')](_0x43b961['query'][_0x37b0('0x1e')]);}_0x33160e[_0x37b0('0x3b')]=qs[_0x37b0('0x3c')](_0x43b961[_0x37b0('0x33')]['sort']);_0x33160e[_0x37b0('0x3d')]=qs[_0x37b0('0x3e')](_[_0x37b0('0x3f')](_0x43b961[_0x37b0('0x33')],_0x533bbb['filters']),_0xb0f8eb);if(_0x43b961[_0x37b0('0x33')]['filter']){_0x33160e['where']=_['merge'](_0x33160e[_0x37b0('0x3d')],{'$or':_[_0x37b0('0x2d')](_0xb0f8eb,function(_0x52d5dc){if(_0x52d5dc[_0x37b0('0x31')]!==_0x37b0('0x40')){var _0x2cee57={};_0x2cee57[_0x52d5dc[_0x37b0('0x2a')]]={'$like':'%'+_0x43b961[_0x37b0('0x33')][_0x37b0('0x41')]+'%'};return _0x2cee57;}})});}_0x33160e=_[_0x37b0('0x42')]({},_0x33160e,_0x43b961[_0x37b0('0x43')]);var _0x431a86={'where':_0x33160e['where']};return db[_0x37b0('0x2e')][_0x37b0('0x21')](_0x431a86)[_0x37b0('0x27')](function(_0x481f45){_0x5eada4[_0x37b0('0x21')]=_0x481f45;if(_0x43b961[_0x37b0('0x33')][_0x37b0('0x44')]){_0x33160e[_0x37b0('0x45')]=[{'all':!![]}];}return db[_0x37b0('0x2e')][_0x37b0('0x46')](_0x33160e);})[_0x37b0('0x27')](function(_0x3bed92){_0x5eada4[_0x37b0('0x47')]=_0x3bed92;return _0x5eada4;})[_0x37b0('0x27')](respondWithFilteredResult(_0x479021,_0x33160e))[_0x37b0('0x48')](handleError(_0x479021,null));};exports[_0x37b0('0x49')]=function(_0x493bbe,_0x286e78){var _0x9bb078={'raw':!![],'where':{'id':_0x493bbe[_0x37b0('0x4a')]['id']}},_0x1bc76b={};_0x1bc76b['model']=_[_0x37b0('0x4b')](db[_0x37b0('0x2e')][_0x37b0('0x2f')]);_0x1bc76b['query']=_[_0x37b0('0x4b')](_0x493bbe[_0x37b0('0x33')]);_0x1bc76b[_0x37b0('0x3e')]=_['intersection'](_0x1bc76b['model'],_0x1bc76b[_0x37b0('0x33')]);_0x9bb078[_0x37b0('0x37')]=_[_0x37b0('0x34')](_0x1bc76b[_0x37b0('0x35')],qs[_0x37b0('0x36')](_0x493bbe[_0x37b0('0x33')]['fields']));_0x9bb078[_0x37b0('0x37')]=_0x9bb078[_0x37b0('0x37')][_0x37b0('0x38')]?_0x9bb078[_0x37b0('0x37')]:_0x1bc76b[_0x37b0('0x35')];if(_0x493bbe[_0x37b0('0x33')][_0x37b0('0x44')]){_0x9bb078[_0x37b0('0x45')]=[{'all':!![]}];}_0x9bb078=_[_0x37b0('0x42')]({},_0x9bb078,_0x493bbe['options']);return db[_0x37b0('0x2e')][_0x37b0('0x4c')](_0x9bb078)[_0x37b0('0x27')](handleEntityNotFound(_0x286e78,null))[_0x37b0('0x27')](respondWithResult(_0x286e78,null))[_0x37b0('0x48')](handleError(_0x286e78,null));};exports[_0x37b0('0x4d')]=function(_0x1a6a5f,_0xd1137a){return db[_0x37b0('0x2e')][_0x37b0('0x4d')](_0x1a6a5f[_0x37b0('0x4e')],{})[_0x37b0('0x27')](respondWithResult(_0xd1137a,0xc9))[_0x37b0('0x48')](handleError(_0xd1137a,null));};exports[_0x37b0('0x26')]=function(_0x4ea3bb,_0x410af3){if(_0x4ea3bb[_0x37b0('0x4e')]['id']){delete _0x4ea3bb['body']['id'];}return db['SmsQueueReport'][_0x37b0('0x4c')]({'where':{'id':_0x4ea3bb['params']['id']}})[_0x37b0('0x27')](handleEntityNotFound(_0x410af3,null))[_0x37b0('0x27')](saveUpdates(_0x4ea3bb[_0x37b0('0x4e')],null))[_0x37b0('0x27')](respondWithResult(_0x410af3,null))[_0x37b0('0x48')](handleError(_0x410af3,null));};exports[_0x37b0('0x4f')]=function(_0x117143,_0x957cc9){return db[_0x37b0('0x2e')][_0x37b0('0x4c')]({'where':{'id':_0x117143[_0x37b0('0x4a')]['id']}})[_0x37b0('0x27')](handleEntityNotFound(_0x957cc9,null))[_0x37b0('0x27')](removeEntity(_0x957cc9,null))[_0x37b0('0x48')](handleError(_0x957cc9,null));};exports[_0x37b0('0x50')]=function(_0x77e400,_0x582d49){return db[_0x37b0('0x2e')][_0x37b0('0x50')]()['then'](respondWithResult(_0x582d49,null))[_0x37b0('0x48')](handleError(_0x582d49,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1e5cc00..499f406 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x770f4,_0x3896bc){var _0x1cdaef=function(_0xc83c8b){while(--_0xc83c8b){_0x770f4['push'](_0x770f4['shift']());}};_0x1cdaef(++_0x3896bc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a864e18..980ed59 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 _0xd66f=['code','message','result','catch','SmsQueueReport','body','options','CreateSmsQueueReport','debug','stringify','raw','where','limit','then','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4d986d,_0x1d9bd1){var _0x1e6676=function(_0x272835){while(--_0x272835){_0x4d986d['push'](_0x4d986d['shift']());}};_0x1e6676(++_0x1d9bd1);}(_0xd66f,0xc9));var _0xfd66=function(_0x17c1e9,_0x1c5e8a){_0x17c1e9=_0x17c1e9-0x0;var _0x26f699=_0xd66f[_0x17c1e9];return _0x26f699;};'use strict';var _=require(_0xfd66('0x0'));var util=require(_0xfd66('0x1'));var moment=require(_0xfd66('0x2'));var BPromise=require(_0xfd66('0x3'));var rs=require(_0xfd66('0x4'));var fs=require('fs');var Redis=require(_0xfd66('0x5'));var db=require(_0xfd66('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd66('0x7'))(_0xfd66('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd66('0x9'));var client=jayson[_0xfd66('0xa')][_0xfd66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4deca8,_0x448826,_0x33f89b){return new BPromise(function(_0x2a4176,_0x38d600){return client['request'](_0x4deca8,_0x33f89b)['then'](function(_0x4a121a){logger[_0xfd66('0xc')](_0xfd66('0xd'),_0x448826,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x448826,_0xfd66('0xe'),JSON['stringify'](_0x4a121a));if(_0x4a121a[_0xfd66('0xf')]){if(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x10')]===0x1f4){logger[_0xfd66('0xf')](_0xfd66('0xd'),_0x448826,_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);return _0x38d600(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);}logger['error'](_0xfd66('0xd'),_0x448826,_0x4a121a[_0xfd66('0xf')]['message']);return _0x2a4176(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);}else{logger[_0xfd66('0xc')](_0xfd66('0xd'),_0x448826,'request\x20sent');_0x2a4176(_0x4a121a[_0xfd66('0x12')]['message']);}})[_0xfd66('0x13')](function(_0x9b4059){logger[_0xfd66('0xf')](_0xfd66('0xd'),_0x448826,_0x9b4059);_0x38d600(_0x9b4059);});});}exports['CreateSmsQueueReport']=function(_0x50282b){var _0x253276=this;return new Promise(function(_0x4789db,_0x16aaed){return db[_0xfd66('0x14')]['create'](_0x50282b[_0xfd66('0x15')],{'raw':_0x50282b['options']?_0x50282b[_0xfd66('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5f1e84){logger[_0xfd66('0xc')](_0xfd66('0x17'),_0x50282b);logger[_0xfd66('0x18')]('CreateSmsQueueReport',_0x50282b,JSON[_0xfd66('0x19')](_0x5f1e84));_0x4789db(_0x5f1e84);})[_0xfd66('0x13')](function(_0x1c7b4a){logger[_0xfd66('0xf')](_0xfd66('0x17'),_0x1c7b4a[_0xfd66('0x11')],_0x50282b);_0x16aaed(_0x253276[_0xfd66('0xf')](0x1f4,_0x1c7b4a['message']));});});};exports['UpdateSmsQueueReport']=function(_0x47f51b){var _0x42c861=this;return new Promise(function(_0x2e5e48,_0x3270d4){return db[_0xfd66('0x14')]['update'](_0x47f51b[_0xfd66('0x15')],{'raw':_0x47f51b[_0xfd66('0x16')]?_0x47f51b['options'][_0xfd66('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f51b['options']?_0x47f51b[_0xfd66('0x16')][_0xfd66('0x1b')]||null:null,'attributes':_0x47f51b[_0xfd66('0x16')]?_0x47f51b['options']['attributes']||null:null,'limit':_0x47f51b['options']?_0x47f51b[_0xfd66('0x16')][_0xfd66('0x1c')]||null:null})[_0xfd66('0x1d')](function(_0x4f34e2){logger[_0xfd66('0xc')](_0xfd66('0x1e'),_0x47f51b);logger[_0xfd66('0x18')](_0xfd66('0x1e'),_0x47f51b,JSON['stringify'](_0x4f34e2));_0x2e5e48(_0x4f34e2);})['catch'](function(_0xf49643){logger[_0xfd66('0xf')]('UpdateSmsQueueReport',_0xf49643[_0xfd66('0x11')],_0x47f51b);_0x3270d4(_0x42c861[_0xfd66('0xf')](0x1f4,_0xf49643['message']));});});}; \ No newline at end of file +var _0x3a7f=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3a7f,0x127));var _0xf3a7=function(_0x1b3ddb,_0x55f51f){_0x1b3ddb=_0x1b3ddb-0x0;var _0x5e8d85=_0x3a7f[_0x1b3ddb];return _0x5e8d85;};'use strict';var _=require(_0xf3a7('0x0'));var util=require(_0xf3a7('0x1'));var moment=require(_0xf3a7('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3a7('0x4'))['db'];var utils=require(_0xf3a7('0x5'));var logger=require(_0xf3a7('0x6'))('rpc');var config=require(_0xf3a7('0x7'));var jayson=require(_0xf3a7('0x8'));var client=jayson[_0xf3a7('0x9')][_0xf3a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41fdd8,_0x1a1a95,_0x26f66b){return new BPromise(function(_0x46c489,_0x265864){return client[_0xf3a7('0xb')](_0x41fdd8,_0x26f66b)[_0xf3a7('0xc')](function(_0x58fa09){logger[_0xf3a7('0xd')](_0xf3a7('0xe'),_0x1a1a95,_0xf3a7('0xf'));logger[_0xf3a7('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1a1a95,_0xf3a7('0xf'),JSON[_0xf3a7('0x11')](_0x58fa09));if(_0x58fa09[_0xf3a7('0x12')]){if(_0x58fa09['error']['code']===0x1f4){logger[_0xf3a7('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x1a1a95,_0x58fa09[_0xf3a7('0x12')][_0xf3a7('0x13')]);return _0x265864(_0x58fa09[_0xf3a7('0x12')][_0xf3a7('0x13')]);}logger[_0xf3a7('0x12')](_0xf3a7('0xe'),_0x1a1a95,_0x58fa09[_0xf3a7('0x12')][_0xf3a7('0x13')]);return _0x46c489(_0x58fa09[_0xf3a7('0x12')]['message']);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1a1a95,_0xf3a7('0xf'));_0x46c489(_0x58fa09['result']['message']);}})[_0xf3a7('0x14')](function(_0x4f4e8e){logger[_0xf3a7('0x12')](_0xf3a7('0xe'),_0x1a1a95,_0x4f4e8e);_0x265864(_0x4f4e8e);});});}exports[_0xf3a7('0x15')]=function(_0x198d82){var _0x15cb0e=this;return new Promise(function(_0x3af433,_0x480808){return db[_0xf3a7('0x16')][_0xf3a7('0x17')](_0x198d82[_0xf3a7('0x18')],{'raw':_0x198d82[_0xf3a7('0x19')]?_0x198d82[_0xf3a7('0x19')][_0xf3a7('0x1a')]===undefined?!![]:![]:!![]})[_0xf3a7('0xc')](function(_0x30a098){logger[_0xf3a7('0xd')](_0xf3a7('0x15'),_0x198d82);logger['debug'](_0xf3a7('0x15'),_0x198d82,JSON[_0xf3a7('0x11')](_0x30a098));_0x3af433(_0x30a098);})['catch'](function(_0xd178b9){logger['error'](_0xf3a7('0x15'),_0xd178b9[_0xf3a7('0x13')],_0x198d82);_0x480808(_0x15cb0e[_0xf3a7('0x12')](0x1f4,_0xd178b9[_0xf3a7('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x5c7502){var _0x147262=this;return new Promise(function(_0x18b189,_0x4acf27){return db[_0xf3a7('0x16')]['update'](_0x5c7502[_0xf3a7('0x18')],{'raw':_0x5c7502['options']?_0x5c7502[_0xf3a7('0x19')][_0xf3a7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c7502[_0xf3a7('0x19')]?_0x5c7502[_0xf3a7('0x19')]['where']||null:null,'attributes':_0x5c7502[_0xf3a7('0x19')]?_0x5c7502[_0xf3a7('0x19')][_0xf3a7('0x1b')]||null:null,'limit':_0x5c7502['options']?_0x5c7502[_0xf3a7('0x19')][_0xf3a7('0x1c')]||null:null})[_0xf3a7('0xc')](function(_0x5e2554){logger[_0xf3a7('0xd')](_0xf3a7('0x1d'),_0x5c7502);logger[_0xf3a7('0x10')](_0xf3a7('0x1d'),_0x5c7502,JSON[_0xf3a7('0x11')](_0x5e2554));_0x18b189(_0x5e2554);})[_0xf3a7('0x14')](function(_0x37efbd){logger['error'](_0xf3a7('0x1d'),_0x37efbd['message'],_0x5c7502);_0x4acf27(_0x147262[_0xf3a7('0x12')](0x1f4,_0x37efbd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 40d9cdb..2298265 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 _0x43fd=['create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5c0427,_0x340e41){_0x5c0427=_0x5c0427-0x0;var _0x523ee7=_0x43fd[_0x5c0427];return _0x523ee7;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['get'](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller['show']);router[_0xd43f('0xb')]('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xc')]);router[_0xd43f('0xd')](_0xd43f('0xa'),auth['isAuthenticated'](),controller[_0xd43f('0xe')]);router[_0xd43f('0xf')](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x10')]);module[_0xd43f('0x11')]=router; \ No newline at end of file +var _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x6f47,0xc7));var _0x76f4=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x6f47[_0x2faddb];return _0x273c05;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xe')]);router[_0x76f4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x76f4('0x10')]);router[_0x76f4('0x11')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x12')]);module[_0x76f4('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index cd11a02..b707892 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xd76d5f,_0x2aeadd){var _0x38f169=function(_0x2d7598){while(--_0x2d7598){_0xd76d5f['push'](_0xd76d5f['shift']());}};_0x38f169(++_0x2aeadd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x00bb[_0x47e7cb];return _0x2a8874;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3aadde,_0x50f23f){var _0x21df4e=function(_0x55a49d){while(--_0x55a49d){_0x3aadde['push'](_0x3aadde['shift']());}};_0x21df4e(++_0x50f23f);}(_0x54ef,0x112));var _0xf54e=function(_0xe6e60,_0x360dbe){_0xe6e60=_0xe6e60-0x0;var _0x218a4a=_0x54ef[_0xe6e60];return _0x218a4a;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 2923267..7299197 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 _0xca48=['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','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','filters','query','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1312f4,_0x34085f){var _0x56042f=function(_0x17db9a){while(--_0x17db9a){_0x1312f4['push'](_0x1312f4['shift']());}};_0x56042f(++_0x34085f);}(_0xca48,0xe9));var _0x8ca4=function(_0x5e5b5e,_0x1d4bde){_0x5e5b5e=_0x5e5b5e-0x0;var _0x296489=_0xca48[_0x5e5b5e];return _0x296489;};'use strict';var emlformat=require(_0x8ca4('0x0'));var rimraf=require(_0x8ca4('0x1'));var zipdir=require(_0x8ca4('0x2'));var jsonpatch=require(_0x8ca4('0x3'));var rp=require(_0x8ca4('0x4'));var moment=require(_0x8ca4('0x5'));var BPromise=require(_0x8ca4('0x6'));var Mustache=require(_0x8ca4('0x7'));var util=require(_0x8ca4('0x8'));var path=require(_0x8ca4('0x9'));var sox=require(_0x8ca4('0xa'));var csv=require(_0x8ca4('0xb'));var ejs=require(_0x8ca4('0xc'));var fs=require('fs');var fs_extra=require(_0x8ca4('0xd'));var _=require('lodash');var squel=require(_0x8ca4('0xe'));var crypto=require(_0x8ca4('0xf'));var jsforce=require(_0x8ca4('0x10'));var deskjs=require(_0x8ca4('0x11'));var toCsv=require(_0x8ca4('0xb'));var querystring=require(_0x8ca4('0x12'));var Papa=require(_0x8ca4('0x13'));var Redis=require(_0x8ca4('0x14'));var authService=require(_0x8ca4('0x15'));var qs=require(_0x8ca4('0x16'));var as=require(_0x8ca4('0x17'));var hardwareService=require(_0x8ca4('0x18'));var logger=require(_0x8ca4('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x8ca4('0x1a'));var licenseUtil=require(_0x8ca4('0x1b'));var db=require(_0x8ca4('0x1c'))['db'];function respondWithStatusCode(_0x3c8a29,_0x16ff10){_0x16ff10=_0x16ff10||0xcc;return function(_0x5b5a2d){if(_0x5b5a2d){return _0x3c8a29['sendStatus'](_0x16ff10);}return _0x3c8a29['status'](_0x16ff10)[_0x8ca4('0x1d')]();};}function respondWithResult(_0x4ce544,_0xc35b9a){_0xc35b9a=_0xc35b9a||0xc8;return function(_0x54b5dd){if(_0x54b5dd){return _0x4ce544[_0x8ca4('0x1e')](_0xc35b9a)[_0x8ca4('0x1f')](_0x54b5dd);}};}function respondWithFilteredResult(_0x2344cc,_0x5801d0){return function(_0x3e9338){if(_0x3e9338){var _0x5f112c=typeof _0x5801d0[_0x8ca4('0x20')]==='undefined'&&typeof _0x5801d0[_0x8ca4('0x21')]===_0x8ca4('0x22');var _0xb34bc6=_0x3e9338['count'];var _0x3c64d2=_0x5f112c?0x0:_0x5801d0[_0x8ca4('0x20')];var _0x365522=_0x5f112c?_0x3e9338[_0x8ca4('0x23')]:_0x5801d0['offset']+_0x5801d0[_0x8ca4('0x21')];var _0x15ecb7;if(_0x365522>=_0xb34bc6){_0x365522=_0xb34bc6;_0x15ecb7=0xc8;}else{_0x15ecb7=0xce;}_0x2344cc['status'](_0x15ecb7);return _0x2344cc[_0x8ca4('0x24')]('Content-Range',_0x3c64d2+'-'+_0x365522+'/'+_0xb34bc6)[_0x8ca4('0x1f')](_0x3e9338);}return null;};}function patchUpdates(_0x308a9a){return function(_0x4fc5ce){try{jsonpatch[_0x8ca4('0x25')](_0x4fc5ce,_0x308a9a,!![]);}catch(_0x160423){return BPromise[_0x8ca4('0x26')](_0x160423);}return _0x4fc5ce[_0x8ca4('0x27')]();};}function saveUpdates(_0x376e45,_0x444955){return function(_0x23bb2c){if(_0x23bb2c){return _0x23bb2c[_0x8ca4('0x28')](_0x376e45)[_0x8ca4('0x29')](function(_0x22a13d){return _0x22a13d;});}return null;};}function removeEntity(_0x4aa43d,_0x40ea03){return function(_0xb5fc2){if(_0xb5fc2){return _0xb5fc2[_0x8ca4('0x2a')]()[_0x8ca4('0x29')](function(){_0x4aa43d[_0x8ca4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e9c0,_0x273c37){return function(_0x599705){if(!_0x599705){_0x19e9c0[_0x8ca4('0x2b')](0x194);}return _0x599705;};}function handleError(_0xdf280,_0xee6814){_0xee6814=_0xee6814||0x1f4;return function(_0x4a6fc7){logger[_0x8ca4('0x2c')](_0x4a6fc7[_0x8ca4('0x2d')]);if(_0x4a6fc7[_0x8ca4('0x2e')]){delete _0x4a6fc7[_0x8ca4('0x2e')];}_0xdf280[_0x8ca4('0x1e')](_0xee6814)[_0x8ca4('0x2f')](_0x4a6fc7);};}exports[_0x8ca4('0x30')]=function(_0x8a59b4,_0x33cf2d){var _0x326d86={},_0x2c485b={},_0x26605c={'count':0x0,'rows':[]};var _0x4e6194=_[_0x8ca4('0x31')](db[_0x8ca4('0x32')][_0x8ca4('0x33')],function(_0x2f9ab0){return{'name':_0x2f9ab0[_0x8ca4('0x34')],'type':_0x2f9ab0[_0x8ca4('0x35')]['key']};});_0x2c485b[_0x8ca4('0x36')]=_[_0x8ca4('0x31')](_0x4e6194,_0x8ca4('0x2e'));_0x2c485b['query']=_['keys'](_0x8a59b4['query']);_0x2c485b[_0x8ca4('0x37')]=_['intersection'](_0x2c485b[_0x8ca4('0x36')],_0x2c485b[_0x8ca4('0x38')]);_0x326d86[_0x8ca4('0x39')]=_[_0x8ca4('0x3a')](_0x2c485b[_0x8ca4('0x36')],qs[_0x8ca4('0x3b')](_0x8a59b4['query'][_0x8ca4('0x3b')]));_0x326d86[_0x8ca4('0x39')]=_0x326d86[_0x8ca4('0x39')][_0x8ca4('0x3c')]?_0x326d86[_0x8ca4('0x39')]:_0x2c485b[_0x8ca4('0x36')];if(!_0x8a59b4[_0x8ca4('0x38')]['hasOwnProperty'](_0x8ca4('0x3d'))){_0x326d86[_0x8ca4('0x21')]=qs[_0x8ca4('0x21')](_0x8a59b4[_0x8ca4('0x38')]['limit']);_0x326d86[_0x8ca4('0x20')]=qs['offset'](_0x8a59b4[_0x8ca4('0x38')]['offset']);}_0x326d86[_0x8ca4('0x3e')]=qs[_0x8ca4('0x3f')](_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x3f')]);_0x326d86['where']=qs[_0x8ca4('0x37')](_['pick'](_0x8a59b4[_0x8ca4('0x38')],_0x2c485b[_0x8ca4('0x37')]),_0x4e6194);if(_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x40')]){_0x326d86[_0x8ca4('0x41')]=_[_0x8ca4('0x42')](_0x326d86[_0x8ca4('0x41')],{'$or':_[_0x8ca4('0x31')](_0x4e6194,function(_0x36250b){if(_0x36250b[_0x8ca4('0x35')]!=='VIRTUAL'){var _0x1056bd={};_0x1056bd[_0x36250b[_0x8ca4('0x2e')]]={'$like':'%'+_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x40')]+'%'};return _0x1056bd;}})});}_0x326d86=_['merge']({},_0x326d86,_0x8a59b4[_0x8ca4('0x43')]);var _0x59f245={'where':_0x326d86[_0x8ca4('0x41')]};return db[_0x8ca4('0x32')]['count'](_0x59f245)[_0x8ca4('0x29')](function(_0x24c126){_0x26605c[_0x8ca4('0x23')]=_0x24c126;if(_0x8a59b4[_0x8ca4('0x38')]['includeAll']){_0x326d86[_0x8ca4('0x44')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8ca4('0x45')](_0x326d86);})['then'](function(_0x56aa34){_0x26605c['rows']=_0x56aa34;return _0x26605c;})[_0x8ca4('0x29')](respondWithFilteredResult(_0x33cf2d,_0x326d86))[_0x8ca4('0x46')](handleError(_0x33cf2d,null));};exports[_0x8ca4('0x47')]=function(_0x40dd30,_0x3e28b0){var _0x178b4={'raw':!![],'where':{'id':_0x40dd30[_0x8ca4('0x48')]['id']}},_0x86061c={};_0x86061c[_0x8ca4('0x36')]=_[_0x8ca4('0x49')](db[_0x8ca4('0x32')]['rawAttributes']);_0x86061c[_0x8ca4('0x38')]=_[_0x8ca4('0x49')](_0x40dd30['query']);_0x86061c[_0x8ca4('0x37')]=_[_0x8ca4('0x3a')](_0x86061c[_0x8ca4('0x36')],_0x86061c[_0x8ca4('0x38')]);_0x178b4[_0x8ca4('0x39')]=_['intersection'](_0x86061c[_0x8ca4('0x36')],qs[_0x8ca4('0x3b')](_0x40dd30[_0x8ca4('0x38')][_0x8ca4('0x3b')]));_0x178b4['attributes']=_0x178b4[_0x8ca4('0x39')][_0x8ca4('0x3c')]?_0x178b4['attributes']:_0x86061c[_0x8ca4('0x36')];if(_0x40dd30[_0x8ca4('0x38')][_0x8ca4('0x4a')]){_0x178b4[_0x8ca4('0x44')]=[{'all':!![]}];}_0x178b4=_['merge']({},_0x178b4,_0x40dd30[_0x8ca4('0x43')]);return db[_0x8ca4('0x32')][_0x8ca4('0x4b')](_0x178b4)[_0x8ca4('0x29')](handleEntityNotFound(_0x3e28b0,null))['then'](respondWithResult(_0x3e28b0,null))[_0x8ca4('0x46')](handleError(_0x3e28b0,null));};exports[_0x8ca4('0x4c')]=function(_0x4e7884,_0x16fa01){return db[_0x8ca4('0x32')][_0x8ca4('0x4c')](_0x4e7884[_0x8ca4('0x4d')],{})[_0x8ca4('0x29')](respondWithResult(_0x16fa01,0xc9))[_0x8ca4('0x46')](handleError(_0x16fa01,null));};exports['update']=function(_0x3f59e0,_0x2e521d){if(_0x3f59e0[_0x8ca4('0x4d')]['id']){delete _0x3f59e0[_0x8ca4('0x4d')]['id'];}return db[_0x8ca4('0x32')][_0x8ca4('0x4b')]({'where':{'id':_0x3f59e0['params']['id']}})[_0x8ca4('0x29')](handleEntityNotFound(_0x2e521d,null))['then'](saveUpdates(_0x3f59e0['body'],null))[_0x8ca4('0x29')](respondWithResult(_0x2e521d,null))['catch'](handleError(_0x2e521d,null));};exports[_0x8ca4('0x2a')]=function(_0x25005e,_0x14e9a2){return db[_0x8ca4('0x32')][_0x8ca4('0x4b')]({'where':{'id':_0x25005e[_0x8ca4('0x48')]['id']}})[_0x8ca4('0x29')](handleEntityNotFound(_0x14e9a2,null))['then'](removeEntity(_0x14e9a2,null))[_0x8ca4('0x46')](handleError(_0x14e9a2,null));};exports[_0x8ca4('0x4e')]=function(_0x5ab038,_0x42991a){return db[_0x8ca4('0x32')][_0x8ca4('0x4e')]()[_0x8ca4('0x29')](respondWithResult(_0x42991a,null))[_0x8ca4('0x46')](handleError(_0x42991a,null));}; \ No newline at end of file +var _0xcd0d=['include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll'];(function(_0x289925,_0x8644ff){var _0x38d3cf=function(_0x4457d6){while(--_0x4457d6){_0x289925['push'](_0x289925['shift']());}};_0x38d3cf(++_0x8644ff);}(_0xcd0d,0xa3));var _0xdcd0=function(_0x89ace6,_0x39064b){_0x89ace6=_0x89ace6-0x0;var _0x302694=_0xcd0d[_0x89ace6];return _0x302694;};'use strict';var emlformat=require(_0xdcd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcd0('0x1'));var jsonpatch=require(_0xdcd0('0x2'));var rp=require(_0xdcd0('0x3'));var moment=require('moment');var BPromise=require(_0xdcd0('0x4'));var Mustache=require(_0xdcd0('0x5'));var util=require(_0xdcd0('0x6'));var path=require(_0xdcd0('0x7'));var sox=require(_0xdcd0('0x8'));var csv=require(_0xdcd0('0x9'));var ejs=require(_0xdcd0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcd0('0xb'));var squel=require(_0xdcd0('0xc'));var crypto=require(_0xdcd0('0xd'));var jsforce=require(_0xdcd0('0xe'));var deskjs=require(_0xdcd0('0xf'));var toCsv=require(_0xdcd0('0x9'));var querystring=require(_0xdcd0('0x10'));var Papa=require('papaparse');var Redis=require(_0xdcd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdcd0('0x12'));var hardwareService=require(_0xdcd0('0x13'));var logger=require(_0xdcd0('0x14'))(_0xdcd0('0x15'));var utils=require('../../config/utils');var config=require(_0xdcd0('0x16'));var licenseUtil=require(_0xdcd0('0x17'));var db=require(_0xdcd0('0x18'))['db'];function respondWithStatusCode(_0x532e8c,_0x5d2626){_0x5d2626=_0x5d2626||0xcc;return function(_0x35461b){if(_0x35461b){return _0x532e8c[_0xdcd0('0x19')](_0x5d2626);}return _0x532e8c[_0xdcd0('0x1a')](_0x5d2626)['end']();};}function respondWithResult(_0x249071,_0x1d744f){_0x1d744f=_0x1d744f||0xc8;return function(_0x31cce3){if(_0x31cce3){return _0x249071['status'](_0x1d744f)['json'](_0x31cce3);}};}function respondWithFilteredResult(_0x36ed33,_0x43dc0e){return function(_0x58d9c9){if(_0x58d9c9){var _0x292d65=typeof _0x43dc0e['offset']===_0xdcd0('0x1b')&&typeof _0x43dc0e[_0xdcd0('0x1c')]==='undefined';var _0x1b8c21=_0x58d9c9[_0xdcd0('0x1d')];var _0x15be47=_0x292d65?0x0:_0x43dc0e[_0xdcd0('0x1e')];var _0x39b3a9=_0x292d65?_0x58d9c9[_0xdcd0('0x1d')]:_0x43dc0e['offset']+_0x43dc0e['limit'];var _0x5c5f43;if(_0x39b3a9>=_0x1b8c21){_0x39b3a9=_0x1b8c21;_0x5c5f43=0xc8;}else{_0x5c5f43=0xce;}_0x36ed33[_0xdcd0('0x1a')](_0x5c5f43);return _0x36ed33[_0xdcd0('0x1f')]('Content-Range',_0x15be47+'-'+_0x39b3a9+'/'+_0x1b8c21)[_0xdcd0('0x20')](_0x58d9c9);}return null;};}function patchUpdates(_0xd2f83a){return function(_0x528657){try{jsonpatch[_0xdcd0('0x21')](_0x528657,_0xd2f83a,!![]);}catch(_0x31f330){return BPromise['reject'](_0x31f330);}return _0x528657['save']();};}function saveUpdates(_0x212882,_0x22af93){return function(_0x13b370){if(_0x13b370){return _0x13b370[_0xdcd0('0x22')](_0x212882)[_0xdcd0('0x23')](function(_0x68612c){return _0x68612c;});}return null;};}function removeEntity(_0x3cb83f,_0x59bcba){return function(_0x4d2665){if(_0x4d2665){return _0x4d2665[_0xdcd0('0x24')]()[_0xdcd0('0x23')](function(){_0x3cb83f[_0xdcd0('0x1a')](0xcc)[_0xdcd0('0x25')]();});}};}function handleEntityNotFound(_0x29a9c0,_0x43b469){return function(_0x4960bf){if(!_0x4960bf){_0x29a9c0[_0xdcd0('0x19')](0x194);}return _0x4960bf;};}function handleError(_0x5efd9d,_0x5bb408){_0x5bb408=_0x5bb408||0x1f4;return function(_0x24f373){logger[_0xdcd0('0x26')](_0x24f373[_0xdcd0('0x27')]);if(_0x24f373[_0xdcd0('0x28')]){delete _0x24f373['name'];}_0x5efd9d[_0xdcd0('0x1a')](_0x5bb408)[_0xdcd0('0x29')](_0x24f373);};}exports[_0xdcd0('0x2a')]=function(_0x3f2c9c,_0x59b55a){var _0xd67b86={},_0x150ca7={},_0xdb52dd={'count':0x0,'rows':[]};var _0x4c87db=_[_0xdcd0('0x2b')](db[_0xdcd0('0x2c')][_0xdcd0('0x2d')],function(_0x1c7640){return{'name':_0x1c7640[_0xdcd0('0x2e')],'type':_0x1c7640[_0xdcd0('0x2f')]['key']};});_0x150ca7[_0xdcd0('0x30')]=_[_0xdcd0('0x2b')](_0x4c87db,_0xdcd0('0x28'));_0x150ca7[_0xdcd0('0x31')]=_[_0xdcd0('0x32')](_0x3f2c9c['query']);_0x150ca7['filters']=_[_0xdcd0('0x33')](_0x150ca7['model'],_0x150ca7[_0xdcd0('0x31')]);_0xd67b86[_0xdcd0('0x34')]=_['intersection'](_0x150ca7[_0xdcd0('0x30')],qs[_0xdcd0('0x35')](_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x35')]));_0xd67b86[_0xdcd0('0x34')]=_0xd67b86['attributes'][_0xdcd0('0x36')]?_0xd67b86[_0xdcd0('0x34')]:_0x150ca7[_0xdcd0('0x30')];if(!_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x37')](_0xdcd0('0x38'))){_0xd67b86[_0xdcd0('0x1c')]=qs[_0xdcd0('0x1c')](_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x1c')]);_0xd67b86[_0xdcd0('0x1e')]=qs[_0xdcd0('0x1e')](_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x1e')]);}_0xd67b86['order']=qs[_0xdcd0('0x39')](_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x39')]);_0xd67b86[_0xdcd0('0x3a')]=qs[_0xdcd0('0x3b')](_[_0xdcd0('0x3c')](_0x3f2c9c[_0xdcd0('0x31')],_0x150ca7[_0xdcd0('0x3b')]),_0x4c87db);if(_0x3f2c9c[_0xdcd0('0x31')]['filter']){_0xd67b86['where']=_[_0xdcd0('0x3d')](_0xd67b86[_0xdcd0('0x3a')],{'$or':_['map'](_0x4c87db,function(_0x39a8f1){if(_0x39a8f1[_0xdcd0('0x2f')]!==_0xdcd0('0x3e')){var _0x565d6d={};_0x565d6d[_0x39a8f1[_0xdcd0('0x28')]]={'$like':'%'+_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x3f')]+'%'};return _0x565d6d;}})});}_0xd67b86=_[_0xdcd0('0x3d')]({},_0xd67b86,_0x3f2c9c['options']);var _0xa94229={'where':_0xd67b86[_0xdcd0('0x3a')]};return db[_0xdcd0('0x2c')][_0xdcd0('0x1d')](_0xa94229)[_0xdcd0('0x23')](function(_0x5c3431){_0xdb52dd[_0xdcd0('0x1d')]=_0x5c3431;if(_0x3f2c9c[_0xdcd0('0x31')][_0xdcd0('0x40')]){_0xd67b86[_0xdcd0('0x41')]=[{'all':!![]}];}return db[_0xdcd0('0x2c')][_0xdcd0('0x42')](_0xd67b86);})[_0xdcd0('0x23')](function(_0x365386){_0xdb52dd[_0xdcd0('0x43')]=_0x365386;return _0xdb52dd;})[_0xdcd0('0x23')](respondWithFilteredResult(_0x59b55a,_0xd67b86))[_0xdcd0('0x44')](handleError(_0x59b55a,null));};exports[_0xdcd0('0x45')]=function(_0x14b368,_0x42a331){var _0x332ea0={'raw':!![],'where':{'id':_0x14b368[_0xdcd0('0x46')]['id']}},_0x404a7f={};_0x404a7f[_0xdcd0('0x30')]=_['keys'](db[_0xdcd0('0x2c')]['rawAttributes']);_0x404a7f[_0xdcd0('0x31')]=_[_0xdcd0('0x32')](_0x14b368[_0xdcd0('0x31')]);_0x404a7f[_0xdcd0('0x3b')]=_['intersection'](_0x404a7f['model'],_0x404a7f[_0xdcd0('0x31')]);_0x332ea0['attributes']=_[_0xdcd0('0x33')](_0x404a7f[_0xdcd0('0x30')],qs['fields'](_0x14b368[_0xdcd0('0x31')][_0xdcd0('0x35')]));_0x332ea0[_0xdcd0('0x34')]=_0x332ea0[_0xdcd0('0x34')]['length']?_0x332ea0[_0xdcd0('0x34')]:_0x404a7f['model'];if(_0x14b368[_0xdcd0('0x31')][_0xdcd0('0x40')]){_0x332ea0['include']=[{'all':!![]}];}_0x332ea0=_['merge']({},_0x332ea0,_0x14b368[_0xdcd0('0x47')]);return db[_0xdcd0('0x2c')][_0xdcd0('0x48')](_0x332ea0)[_0xdcd0('0x23')](handleEntityNotFound(_0x42a331,null))[_0xdcd0('0x23')](respondWithResult(_0x42a331,null))[_0xdcd0('0x44')](handleError(_0x42a331,null));};exports[_0xdcd0('0x49')]=function(_0x130e70,_0xe82e19){return db[_0xdcd0('0x2c')][_0xdcd0('0x49')](_0x130e70[_0xdcd0('0x4a')],{})[_0xdcd0('0x23')](respondWithResult(_0xe82e19,0xc9))[_0xdcd0('0x44')](handleError(_0xe82e19,null));};exports[_0xdcd0('0x22')]=function(_0x4f1001,_0x47c5e4){if(_0x4f1001[_0xdcd0('0x4a')]['id']){delete _0x4f1001[_0xdcd0('0x4a')]['id'];}return db[_0xdcd0('0x2c')][_0xdcd0('0x48')]({'where':{'id':_0x4f1001[_0xdcd0('0x46')]['id']}})[_0xdcd0('0x23')](handleEntityNotFound(_0x47c5e4,null))[_0xdcd0('0x23')](saveUpdates(_0x4f1001['body'],null))[_0xdcd0('0x23')](respondWithResult(_0x47c5e4,null))[_0xdcd0('0x44')](handleError(_0x47c5e4,null));};exports[_0xdcd0('0x24')]=function(_0x1cc55e,_0x2882f7){return db[_0xdcd0('0x2c')][_0xdcd0('0x48')]({'where':{'id':_0x1cc55e[_0xdcd0('0x46')]['id']}})['then'](handleEntityNotFound(_0x2882f7,null))[_0xdcd0('0x23')](removeEntity(_0x2882f7,null))[_0xdcd0('0x44')](handleError(_0x2882f7,null));};exports[_0xdcd0('0x4b')]=function(_0x1bcab1,_0x1b002d){return db[_0xdcd0('0x2c')][_0xdcd0('0x4b')]()[_0xdcd0('0x23')](respondWithResult(_0x1b002d,null))['catch'](handleError(_0x1b002d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 2e974ba..35ad872 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 _0x1301=['SmsTransferReport','uniqueid','lodash','util','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1301,0x70));var _0x1130=function(_0x229618,_0x47a1c7){_0x229618=_0x229618-0x0;var _0x23283c=_0x1301[_0x229618];return _0x23283c;};'use strict';var _=require(_0x1130('0x0'));var util=require(_0x1130('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1130('0x2'));var BPromise=require(_0x1130('0x3'));var rp=require(_0x1130('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1130('0x5'));var attributes=require(_0x1130('0x6'));module[_0x1130('0x7')]=function(_0x282638,_0x928ad4){return _0x282638[_0x1130('0x8')](_0x1130('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1130('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6347=['report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x1e49a5,_0x181fa0){var _0x13bb32=function(_0x171613){while(--_0x171613){_0x1e49a5['push'](_0x1e49a5['shift']());}};_0x13bb32(++_0x181fa0);}(_0x6347,0x1c9));var _0x7634=function(_0x447ade,_0xf08302){_0x447ade=_0x447ade-0x0;var _0x5dd563=_0x6347[_0x447ade];return _0x5dd563;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require('../../config/logger')(_0x7634('0x2'));var moment=require(_0x7634('0x3'));var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7634('0x6'));var config=require('../../config/environment');var attributes=require(_0x7634('0x7'));module[_0x7634('0x8')]=function(_0x56d2ad,_0x58d043){return _0x56d2ad[_0x7634('0x9')](_0x7634('0xa'),attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[{'name':_0x7634('0xc'),'fields':[_0x7634('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5a6e59b..6d8efa3 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 _0xbdb9=['request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http'];(function(_0x4e86db,_0x2dda03){var _0x231111=function(_0x34c9fa){while(--_0x34c9fa){_0x4e86db['push'](_0x4e86db['shift']());}};_0x231111(++_0x2dda03);}(_0xbdb9,0xac));var _0x9bdb=function(_0x40f288,_0x48150a){_0x40f288=_0x40f288-0x0;var _0x5cc7d4=_0xbdb9[_0x40f288];return _0x5cc7d4;};'use strict';var _=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var moment=require(_0x9bdb('0x2'));var BPromise=require(_0x9bdb('0x3'));var rs=require(_0x9bdb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9bdb('0x6'));var client=jayson['client'][_0x9bdb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e9c54,_0x369e4a,_0x27cdd8){return new BPromise(function(_0x27c6b8,_0x4bbae9){return client[_0x9bdb('0x8')](_0x4e9c54,_0x27cdd8)[_0x9bdb('0x9')](function(_0x152c08){logger['info'](_0x9bdb('0xa'),_0x369e4a,_0x9bdb('0xb'));logger[_0x9bdb('0xc')](_0x9bdb('0xd'),_0x369e4a,_0x9bdb('0xb'),JSON['stringify'](_0x152c08));if(_0x152c08['error']){if(_0x152c08[_0x9bdb('0xe')][_0x9bdb('0xf')]===0x1f4){logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x152c08[_0x9bdb('0xe')][_0x9bdb('0x10')]);return _0x4bbae9(_0x152c08['error'][_0x9bdb('0x10')]);}logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x152c08[_0x9bdb('0xe')][_0x9bdb('0x10')]);return _0x27c6b8(_0x152c08['error'][_0x9bdb('0x10')]);}else{logger[_0x9bdb('0x11')](_0x9bdb('0xa'),_0x369e4a,'request\x20sent');_0x27c6b8(_0x152c08[_0x9bdb('0x12')][_0x9bdb('0x10')]);}})[_0x9bdb('0x13')](function(_0x1f575e){logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x1f575e);_0x4bbae9(_0x1f575e);});});} \ No newline at end of file +var _0xe64a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','request\x20sent','stringify','error','message','SmsTransferReport,\x20%s,\x20%s','result','catch'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0xe64a,0x1e0));var _0xae64=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe64a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var moment=require(_0xae64('0x2'));var BPromise=require(_0xae64('0x3'));var rs=require(_0xae64('0x4'));var fs=require('fs');var Redis=require(_0xae64('0x5'));var db=require(_0xae64('0x6'))['db'];var utils=require(_0xae64('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae64('0x8')][_0xae64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1064e3,_0x3cb2a6,_0x272ae9){return new BPromise(function(_0x65a9d1,_0x385871){return client[_0xae64('0xa')](_0x1064e3,_0x272ae9)[_0xae64('0xb')](function(_0x407543){logger[_0xae64('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x3cb2a6,_0xae64('0xd'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3cb2a6,_0xae64('0xd'),JSON[_0xae64('0xe')](_0x407543));if(_0x407543[_0xae64('0xf')]){if(_0x407543[_0xae64('0xf')]['code']===0x1f4){logger[_0xae64('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3cb2a6,_0x407543['error'][_0xae64('0x10')]);return _0x385871(_0x407543[_0xae64('0xf')][_0xae64('0x10')]);}logger['error'](_0xae64('0x11'),_0x3cb2a6,_0x407543[_0xae64('0xf')][_0xae64('0x10')]);return _0x65a9d1(_0x407543[_0xae64('0xf')][_0xae64('0x10')]);}else{logger['info'](_0xae64('0x11'),_0x3cb2a6,_0xae64('0xd'));_0x65a9d1(_0x407543[_0xae64('0x12')][_0xae64('0x10')]);}})[_0xae64('0x13')](function(_0x561408){logger[_0xae64('0xf')](_0xae64('0x11'),_0x3cb2a6,_0x561408);_0x385871(_0x561408);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 76e3070..ee44785 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 _0x4df6=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4df6,0x13a));var _0x64df=function(_0x57c534,_0x2203e7){_0x57c534=_0x57c534-0x0;var _0x409017=_0x4df6[_0x57c534];return _0x409017;};'use strict';var multer=require(_0x64df('0x0'));var util=require(_0x64df('0x1'));var path=require(_0x64df('0x2'));var timeout=require(_0x64df('0x3'));var express=require(_0x64df('0x4'));var router=express[_0x64df('0x5')]();var fs_extra=require(_0x64df('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x64df('0x7'));var config=require(_0x64df('0x8'));var controller=require(_0x64df('0x9'));router[_0x64df('0xa')]('/',auth[_0x64df('0xb')](),controller[_0x64df('0xc')]);router['get'](_0x64df('0xd'),auth[_0x64df('0xb')](),controller[_0x64df('0xe')]);router['get'](_0x64df('0xf'),auth[_0x64df('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bcac4,_0x297a01,_0x120538){_0x120538(null,path[_0x64df('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x3b46ad,_0x4f3c30,_0x491ab2){_0x4f3c30['originalname']=_0x4f3c30[_0x64df('0x11')][_0x64df('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x491ab2(null,util[_0x64df('0x13')](_0x64df('0x14'),path[_0x64df('0x15')](_0x4f3c30['originalname'],path[_0x64df('0x16')](_0x4f3c30['originalname'])),Date[_0x64df('0x17')](),path[_0x64df('0x16')](_0x4f3c30[_0x64df('0x11')])));}})});router['post']('/',upload[_0x64df('0x18')](_0x64df('0x19')),controller[_0x64df('0x1a')]);router[_0x64df('0x1b')](_0x64df('0xd'),auth[_0x64df('0xb')](),controller[_0x64df('0x1c')]);router[_0x64df('0x1d')]('/:id',auth[_0x64df('0xb')](),controller[_0x64df('0x1d')]);module[_0x64df('0x1e')]=router; \ No newline at end of file +var _0x9f53=['diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download'];(function(_0x1cf035,_0x48a94c){var _0x1c2209=function(_0x1590e3){while(--_0x1590e3){_0x1cf035['push'](_0x1cf035['shift']());}};_0x1c2209(++_0x48a94c);}(_0x9f53,0x11a));var _0x39f5=function(_0x35a982,_0x2ad7dd){_0x35a982=_0x35a982-0x0;var _0x509232=_0x9f53[_0x35a982];return _0x509232;};'use strict';var multer=require(_0x39f5('0x0'));var util=require(_0x39f5('0x1'));var path=require(_0x39f5('0x2'));var timeout=require(_0x39f5('0x3'));var express=require(_0x39f5('0x4'));var router=express[_0x39f5('0x5')]();var fs_extra=require(_0x39f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x39f5('0x7'));var config=require(_0x39f5('0x8'));var controller=require(_0x39f5('0x9'));router[_0x39f5('0xa')]('/',auth[_0x39f5('0xb')](),controller['index']);router[_0x39f5('0xa')](_0x39f5('0xc'),auth[_0x39f5('0xb')](),controller[_0x39f5('0xd')]);router[_0x39f5('0xa')]('/:id/download',auth[_0x39f5('0xb')](),controller[_0x39f5('0xe')]);var upload=multer({'storage':multer[_0x39f5('0xf')]({'destination':function(_0x1a631a,_0x4763e2,_0x12fbb2){_0x12fbb2(null,path['join'](config[_0x39f5('0x10')],_0x39f5('0x11')));},'filename':function(_0x40fe5b,_0x4c9248,_0x547ac8){_0x4c9248[_0x39f5('0x12')]=_0x4c9248[_0x39f5('0x12')][_0x39f5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x547ac8(null,util[_0x39f5('0x14')](_0x39f5('0x15'),path[_0x39f5('0x16')](_0x4c9248[_0x39f5('0x12')],path['extname'](_0x4c9248[_0x39f5('0x12')])),Date[_0x39f5('0x17')](),path[_0x39f5('0x18')](_0x4c9248['originalname'])));}})});router[_0x39f5('0x19')]('/',upload[_0x39f5('0x1a')](_0x39f5('0x1b')),controller[_0x39f5('0x1c')]);router[_0x39f5('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x39f5('0x1e')]);router[_0x39f5('0x1f')]('/:id',auth[_0x39f5('0xb')](),controller['delete']);module[_0x39f5('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index ef22b19..43d1818 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 _0x8f27=['STRING','FLOAT','BIGINT','sequelize','exports','name'];(function(_0x5f1453,_0x2e2c8a){var _0x33e311=function(_0xd0461b){while(--_0xd0461b){_0x5f1453['push'](_0x5f1453['shift']());}};_0x33e311(++_0x2e2c8a);}(_0x8f27,0x11d));var _0x78f2=function(_0x2fdc1a,_0x2a0a5a){_0x2fdc1a=_0x2fdc1a-0x0;var _0x51fb16=_0x8f27[_0x2fdc1a];return _0x51fb16;};'use strict';var Sequelize=require(_0x78f2('0x0'));module[_0x78f2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x78f2('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x78f2('0x3')]},'display_name':{'type':Sequelize[_0x78f2('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x78f2('0x3')]},'original_duration':{'type':Sequelize[_0x78f2('0x4')]},'original_sampleCount':{'type':Sequelize[_0x78f2('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x78f2('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x78f2('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x175f=['INTEGER','BIGINT','exports','STRING','name','FLOAT'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x175f,0x1be));var _0xf175=function(_0x30a6a5,_0x1a5cc6){_0x30a6a5=_0x30a6a5-0x0;var _0x560984=_0x175f[_0x30a6a5];return _0x560984;};'use strict';var Sequelize=require('sequelize');module[_0xf175('0x0')]={'name':{'type':Sequelize[_0xf175('0x1')],'unique':_0xf175('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf175('0x1')]},'display_name':{'type':Sequelize[_0xf175('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xf175('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xf175('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf175('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf175('0x4')]},'converted_format':{'type':Sequelize[_0xf175('0x1')]},'converted_duration':{'type':Sequelize[_0xf175('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xf175('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xf175('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index dfdbe3d..077fd76 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 _0xd3c3=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','save_name','existsSync','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','download','join','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','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3c3,0x1ef));var _0x3d3c=function(_0x192258,_0x4de6e3){_0x192258=_0x192258-0x0;var _0x1d08bb=_0xd3c3[_0x192258];return _0x1d08bb;};'use strict';var emlformat=require(_0x3d3c('0x0'));var rimraf=require(_0x3d3c('0x1'));var zipdir=require(_0x3d3c('0x2'));var jsonpatch=require(_0x3d3c('0x3'));var rp=require(_0x3d3c('0x4'));var moment=require(_0x3d3c('0x5'));var BPromise=require(_0x3d3c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d3c('0x7'));var sox=require(_0x3d3c('0x8'));var csv=require(_0x3d3c('0x9'));var ejs=require(_0x3d3c('0xa'));var fs=require('fs');var fs_extra=require(_0x3d3c('0xb'));var _=require(_0x3d3c('0xc'));var squel=require(_0x3d3c('0xd'));var crypto=require(_0x3d3c('0xe'));var jsforce=require(_0x3d3c('0xf'));var deskjs=require(_0x3d3c('0x10'));var toCsv=require(_0x3d3c('0x9'));var querystring=require(_0x3d3c('0x11'));var Papa=require(_0x3d3c('0x12'));var Redis=require(_0x3d3c('0x13'));var authService=require(_0x3d3c('0x14'));var qs=require(_0x3d3c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3c('0x16'));var logger=require(_0x3d3c('0x17'))(_0x3d3c('0x18'));var utils=require('../../config/utils');var config=require(_0x3d3c('0x19'));var licenseUtil=require(_0x3d3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c012d,_0x1a78fb){_0x1a78fb=_0x1a78fb||0xcc;return function(_0x2bdf34){if(_0x2bdf34){return _0x5c012d[_0x3d3c('0x1b')](_0x1a78fb);}return _0x5c012d[_0x3d3c('0x1c')](_0x1a78fb)[_0x3d3c('0x1d')]();};}function respondWithResult(_0x110638,_0x137c82){_0x137c82=_0x137c82||0xc8;return function(_0x2a6e34){if(_0x2a6e34){return _0x110638[_0x3d3c('0x1c')](_0x137c82)[_0x3d3c('0x1e')](_0x2a6e34);}};}function respondWithFilteredResult(_0x469f32,_0x199b7e){return function(_0x5190ea){if(_0x5190ea){var _0x51aa54=typeof _0x199b7e[_0x3d3c('0x1f')]==='undefined'&&typeof _0x199b7e[_0x3d3c('0x20')]===_0x3d3c('0x21');var _0x53b351=_0x5190ea[_0x3d3c('0x22')];var _0x43e079=_0x51aa54?0x0:_0x199b7e[_0x3d3c('0x1f')];var _0x4afa20=_0x51aa54?_0x5190ea[_0x3d3c('0x22')]:_0x199b7e[_0x3d3c('0x1f')]+_0x199b7e[_0x3d3c('0x20')];var _0x50cd4e;if(_0x4afa20>=_0x53b351){_0x4afa20=_0x53b351;_0x50cd4e=0xc8;}else{_0x50cd4e=0xce;}_0x469f32[_0x3d3c('0x1c')](_0x50cd4e);return _0x469f32['set'](_0x3d3c('0x23'),_0x43e079+'-'+_0x4afa20+'/'+_0x53b351)['json'](_0x5190ea);}return null;};}function patchUpdates(_0x3d6b6c){return function(_0xb93fa1){try{jsonpatch[_0x3d3c('0x24')](_0xb93fa1,_0x3d6b6c,!![]);}catch(_0xce028a){return BPromise[_0x3d3c('0x25')](_0xce028a);}return _0xb93fa1['save']();};}function saveUpdates(_0x4e5342,_0x296d88){return function(_0x6e4bf2){if(_0x6e4bf2){return _0x6e4bf2['update'](_0x4e5342)[_0x3d3c('0x26')](function(_0xb8af79){return _0xb8af79;});}return null;};}function removeEntity(_0x1cef39,_0x1ed111){return function(_0x32056f){if(_0x32056f){return _0x32056f['destroy']()[_0x3d3c('0x26')](function(){var _0x577c2a=_0x32056f[_0x3d3c('0x27')]({'plain':!![]});var _0x30386c=_0x3d3c('0x28');return db[_0x3d3c('0x29')][_0x3d3c('0x2a')]({'where':{'type':_0x30386c,'resourceId':_0x577c2a['id']}})[_0x3d3c('0x26')](function(){return _0x32056f;});})[_0x3d3c('0x26')](function(){_0x1cef39[_0x3d3c('0x1c')](0xcc)[_0x3d3c('0x1d')]();});}};}function handleEntityNotFound(_0x58bc3c,_0x443b18){return function(_0x49f423){if(!_0x49f423){_0x58bc3c[_0x3d3c('0x1b')](0x194);}return _0x49f423;};}function handleError(_0x177085,_0x12764f){_0x12764f=_0x12764f||0x1f4;return function(_0x485207){logger[_0x3d3c('0x2b')](_0x485207[_0x3d3c('0x2c')]);if(_0x485207['name']){delete _0x485207[_0x3d3c('0x2d')];}_0x177085['status'](_0x12764f)[_0x3d3c('0x2e')](_0x485207);};}exports[_0x3d3c('0x2f')]=function(_0x5b6b13,_0x1412e6){var _0x459459={},_0x5df754={},_0x5dbc0e={'count':0x0,'rows':[]};var _0x8d59c3=_[_0x3d3c('0x30')](db[_0x3d3c('0x31')][_0x3d3c('0x32')],function(_0x2ed02d){return{'name':_0x2ed02d[_0x3d3c('0x33')],'type':_0x2ed02d['type'][_0x3d3c('0x34')]};});_0x5df754[_0x3d3c('0x35')]=_[_0x3d3c('0x30')](_0x8d59c3,'name');_0x5df754[_0x3d3c('0x36')]=_[_0x3d3c('0x37')](_0x5b6b13['query']);_0x5df754['filters']=_[_0x3d3c('0x38')](_0x5df754[_0x3d3c('0x35')],_0x5df754[_0x3d3c('0x36')]);_0x459459[_0x3d3c('0x39')]=_[_0x3d3c('0x38')](_0x5df754['model'],qs[_0x3d3c('0x3a')](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x3a')]));_0x459459[_0x3d3c('0x39')]=_0x459459[_0x3d3c('0x39')][_0x3d3c('0x3b')]?_0x459459['attributes']:_0x5df754[_0x3d3c('0x35')];if(!_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x3c')](_0x3d3c('0x3d'))){_0x459459['limit']=qs[_0x3d3c('0x20')](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x20')]);_0x459459[_0x3d3c('0x1f')]=qs['offset'](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x1f')]);}_0x459459[_0x3d3c('0x3e')]=qs[_0x3d3c('0x3f')](_0x5b6b13[_0x3d3c('0x36')]['sort']);_0x459459[_0x3d3c('0x40')]=qs[_0x3d3c('0x41')](_[_0x3d3c('0x42')](_0x5b6b13['query'],_0x5df754[_0x3d3c('0x41')]),_0x8d59c3);if(_0x5b6b13['query']['filter']){_0x459459[_0x3d3c('0x40')]=_[_0x3d3c('0x43')](_0x459459[_0x3d3c('0x40')],{'$or':_[_0x3d3c('0x30')](_0x8d59c3,function(_0x3f926e){if(_0x3f926e['type']!==_0x3d3c('0x44')){var _0x498766={};_0x498766[_0x3f926e[_0x3d3c('0x2d')]]={'$like':'%'+_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x45')]+'%'};return _0x498766;}})});}_0x459459=_[_0x3d3c('0x43')]({},_0x459459,_0x5b6b13[_0x3d3c('0x46')]);var _0x9eb39a={'where':_0x459459[_0x3d3c('0x40')]};return db[_0x3d3c('0x31')]['count'](_0x9eb39a)[_0x3d3c('0x26')](function(_0x4dbe3a){_0x5dbc0e[_0x3d3c('0x22')]=_0x4dbe3a;if(_0x5b6b13[_0x3d3c('0x36')]['includeAll']){_0x459459[_0x3d3c('0x47')]=[{'all':!![]}];}return db['Sound'][_0x3d3c('0x48')](_0x459459);})[_0x3d3c('0x26')](function(_0x502923){_0x5dbc0e[_0x3d3c('0x49')]=_0x502923;return _0x5dbc0e;})[_0x3d3c('0x26')](respondWithFilteredResult(_0x1412e6,_0x459459))[_0x3d3c('0x4a')](handleError(_0x1412e6,null));};exports[_0x3d3c('0x4b')]=function(_0x3c5ae5,_0x539031){var _0x2f9205={'raw':!![],'where':{'id':_0x3c5ae5[_0x3d3c('0x4c')]['id']}},_0x414e20={};_0x414e20[_0x3d3c('0x35')]=_[_0x3d3c('0x37')](db[_0x3d3c('0x31')][_0x3d3c('0x32')]);_0x414e20[_0x3d3c('0x36')]=_['keys'](_0x3c5ae5[_0x3d3c('0x36')]);_0x414e20[_0x3d3c('0x41')]=_[_0x3d3c('0x38')](_0x414e20[_0x3d3c('0x35')],_0x414e20[_0x3d3c('0x36')]);_0x2f9205[_0x3d3c('0x39')]=_['intersection'](_0x414e20[_0x3d3c('0x35')],qs[_0x3d3c('0x3a')](_0x3c5ae5[_0x3d3c('0x36')][_0x3d3c('0x3a')]));_0x2f9205[_0x3d3c('0x39')]=_0x2f9205['attributes']['length']?_0x2f9205['attributes']:_0x414e20[_0x3d3c('0x35')];if(_0x3c5ae5[_0x3d3c('0x36')][_0x3d3c('0x4d')]){_0x2f9205[_0x3d3c('0x47')]=[{'all':!![]}];}_0x2f9205=_['merge']({},_0x2f9205,_0x3c5ae5[_0x3d3c('0x46')]);return db[_0x3d3c('0x31')]['find'](_0x2f9205)[_0x3d3c('0x26')](handleEntityNotFound(_0x539031,null))['then'](respondWithResult(_0x539031,null))[_0x3d3c('0x4a')](handleError(_0x539031,null));};exports['download']=function(_0x1fc035,_0x1b5d6c,_0xcf1c2c){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x1fc035[_0x3d3c('0x4c')]['id']},'attributes':[_0x3d3c('0x2d'),_0x3d3c('0x4f'),'converted_format'],'raw':!![]})[_0x3d3c('0x26')](handleEntityNotFound(_0x1b5d6c,null))[_0x3d3c('0x26')](function(_0x1e27fb){if(_0x1e27fb){if(!fs[_0x3d3c('0x50')](path['join'](config['root'],_0x3d3c('0x51'),_0x1e27fb['save_name']+'.'+_0x1e27fb[_0x3d3c('0x52')]))){throw new db[(_0x3d3c('0x53'))]['ValidationError'](_0x3d3c('0x54'));}return _0x1b5d6c[_0x3d3c('0x55')](path[_0x3d3c('0x56')](config['root'],_0x3d3c('0x51'),util[_0x3d3c('0x57')]('%s.%s',_0x1e27fb[_0x3d3c('0x4f')],_0x1e27fb[_0x3d3c('0x52')])),util['format'](_0x3d3c('0x58'),_0x1e27fb['name'],_0x1e27fb[_0x3d3c('0x52')]));}return null;})[_0x3d3c('0x4a')](handleError(_0x1b5d6c,null));};exports[_0x3d3c('0x59')]=function(_0x43b5eb,_0x3190da,_0x1a1950){var _0xf2e2c7={'name':path[_0x3d3c('0x5a')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')],path['extname'](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')])),'save_name':path[_0x3d3c('0x5a')](_0x43b5eb[_0x3d3c('0x5b')]['filename'],path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5e')])),'original_format':path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')])[_0x3d3c('0x5f')](0x1),'converted_format':_0x3d3c('0x60')};var _0x4add31=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],_0x3d3c('0x62'),_0x43b5eb[_0x3d3c('0x5b')]['filename']);var _0x5af7c3=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],_0x3d3c('0x51'),util[_0x3d3c('0x57')]('%s.%s',path['basename'](_0x43b5eb['file'][_0x3d3c('0x5e')],path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5e')])),_0xf2e2c7[_0x3d3c('0x52')]));logger[_0x3d3c('0x63')](_0x3d3c('0x64'),_0x4add31);logger[_0x3d3c('0x63')](_0x3d3c('0x65'),_0x5af7c3);try{fs[_0x3d3c('0x66')](_0x4add31,parseInt(_0x3d3c('0x67'),0x8));var _0x137a49=sox[_0x3d3c('0x68')](_0x4add31,_0x5af7c3,{'sampleRate':0x1f40,'format':_0x3d3c('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x137a49['on'](_0x3d3c('0x2b'),function(_0x5a9905){fs[_0x3d3c('0x69')](_0x4add31);_0x3190da[_0x3d3c('0x1c')](0x1f4)[_0x3d3c('0x2e')](_0x5a9905);});_0x137a49['on'](_0x3d3c('0x6a'),function(_0x44ed65){_0xf2e2c7['original_duration']=isNaN(_0x44ed65['duration'])?null:_0x44ed65[_0x3d3c('0x6b')]*0x3e8;_0xf2e2c7['original_sampleCount']=isNaN(_0x44ed65[_0x3d3c('0x6c')])?null:_0x44ed65[_0x3d3c('0x6c')];_0xf2e2c7['original_channelCount']=isNaN(_0x44ed65[_0x3d3c('0x6d')])?null:_0x44ed65[_0x3d3c('0x6d')];_0xf2e2c7[_0x3d3c('0x6e')]=isNaN(_0x44ed65[_0x3d3c('0x6f')])?null:_0x44ed65[_0x3d3c('0x6f')];_0xf2e2c7['original_sampleRate']=isNaN(_0x44ed65[_0x3d3c('0x70')])?null:_0x44ed65[_0x3d3c('0x70')];});_0x137a49['on'](_0x3d3c('0x71'),function(_0x269240){_0xf2e2c7[_0x3d3c('0x72')]=isNaN(_0x269240['duration'])?null:_0x269240['duration']*0x3e8;_0xf2e2c7[_0x3d3c('0x73')]=isNaN(_0x269240[_0x3d3c('0x6c')])?null:_0x269240[_0x3d3c('0x6c')];_0xf2e2c7[_0x3d3c('0x74')]=isNaN(_0x269240[_0x3d3c('0x6d')])?null:_0x269240[_0x3d3c('0x6d')];_0xf2e2c7['converted_bitRate']=isNaN(_0x269240[_0x3d3c('0x6f')])?null:_0x269240[_0x3d3c('0x6f')];_0xf2e2c7[_0x3d3c('0x75')]=isNaN(_0x269240[_0x3d3c('0x70')])?null:_0x269240[_0x3d3c('0x70')];});_0x137a49['on'](_0x3d3c('0x1d'),function(){fs[_0x3d3c('0x66')](_0x5af7c3,parseInt(_0x3d3c('0x67'),0x8));return db[_0x3d3c('0x31')]['create'](_0xf2e2c7)[_0x3d3c('0x26')](function(_0x33ff1a){var _0x46a841={'role':_0x43b5eb['body'][_0x3d3c('0x76')],'userProfileId':_0x43b5eb['body']['userProfileId']};if(!_0x46a841)throw new Error(_0x3d3c('0x77'));if(_0x46a841['role']==='user'){var _0x4635fd=_0x33ff1a[_0x3d3c('0x27')]({'plain':!![]});return db[_0x3d3c('0x78')][_0x3d3c('0x4e')]({'where':{'name':_0x3d3c('0x28'),'userProfileId':_0x46a841['userProfileId']},'raw':!![]})[_0x3d3c('0x26')](function(_0x4df623){if(_0x4df623&&_0x4df623['autoAssociation']===0x0){return db[_0x3d3c('0x29')][_0x3d3c('0x59')]({'name':_0x4635fd[_0x3d3c('0x2d')],'resourceId':_0x4635fd['id'],'type':_0x4df623[_0x3d3c('0x2d')],'sectionId':_0x4df623['id']},{})[_0x3d3c('0x26')](function(){return _0x33ff1a;});}else{return _0x33ff1a;}})[_0x3d3c('0x4a')](function(_0x55f712){logger[_0x3d3c('0x2b')](_0x3d3c('0x79'),_0x55f712);throw _0x55f712;});}return _0x33ff1a;})[_0x3d3c('0x26')](respondWithResult(_0x3190da,null))[_0x3d3c('0x4a')](handleError(_0x3190da,null));});_0x137a49[_0x3d3c('0x7a')]();}catch(_0x48b448){_0x3190da['status'](0x1f4)[_0x3d3c('0x2e')](_0x48b448);}};exports[_0x3d3c('0x7b')]=function(_0x6bc6b8,_0x508d4b,_0xcda9f8){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x6bc6b8[_0x3d3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508d4b,null))[_0x3d3c('0x26')](saveUpdates(_[_0x3d3c('0x42')](_0x6bc6b8['body'],[_0x3d3c('0x2d'),_0x3d3c('0x7c')]),null))['then'](respondWithResult(_0x508d4b,null))['catch'](handleError(_0x508d4b,null));};exports[_0x3d3c('0x7d')]=function(_0x508878,_0x2d9240,_0x1ef4da){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x508878[_0x3d3c('0x4c')]['id']}})['then'](function(_0x3a6160){if(_0x3a6160){return _0x3a6160['destroy']();}})[_0x3d3c('0x26')](function(_0xfd58ee){var _0x5e24d2=path['join'](config[_0x3d3c('0x61')],_0x3d3c('0x62'),util[_0x3d3c('0x57')](_0x3d3c('0x58'),_0xfd58ee[_0x3d3c('0x4f')],_0xfd58ee[_0x3d3c('0x7e')]));var _0x92c701=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],'server/files/sounds/converted',util[_0x3d3c('0x57')](_0x3d3c('0x58'),_0xfd58ee[_0x3d3c('0x4f')],_0xfd58ee['converted_format']));fs[_0x3d3c('0x69')](_0x5e24d2);fs[_0x3d3c('0x69')](_0x92c701);return _0xfd58ee;})[_0x3d3c('0x26')](function(_0x1c3eed){if(_0x1c3eed){return _0x2d9240[_0x3d3c('0x1c')](0xcc)['end']();}})[_0x3d3c('0x26')](handleEntityNotFound(_0x2d9240,null))[_0x3d3c('0x4a')](handleError(_0x2d9240,null));}; \ No newline at end of file +var _0x0412=['src','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Sound','includeAll','include','rows','catch','show','params','keys','intersection','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','basename','originalname','extname','file','filename','substring','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','unlinkSync'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x0412,0x95));var _0x2041=function(_0x42b1f9,_0x13071e){_0x42b1f9=_0x42b1f9-0x0;var _0x190bf9=_0x0412[_0x42b1f9];return _0x190bf9;};'use strict';var emlformat=require(_0x2041('0x0'));var rimraf=require(_0x2041('0x1'));var zipdir=require(_0x2041('0x2'));var jsonpatch=require(_0x2041('0x3'));var rp=require(_0x2041('0x4'));var moment=require(_0x2041('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2041('0x6'));var util=require('util');var path=require(_0x2041('0x7'));var sox=require(_0x2041('0x8'));var csv=require(_0x2041('0x9'));var ejs=require(_0x2041('0xa'));var fs=require('fs');var fs_extra=require(_0x2041('0xb'));var _=require(_0x2041('0xc'));var squel=require(_0x2041('0xd'));var crypto=require(_0x2041('0xe'));var jsforce=require(_0x2041('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2041('0x9'));var querystring=require(_0x2041('0x10'));var Papa=require('papaparse');var Redis=require(_0x2041('0x11'));var authService=require(_0x2041('0x12'));var qs=require(_0x2041('0x13'));var as=require(_0x2041('0x14'));var hardwareService=require(_0x2041('0x15'));var logger=require(_0x2041('0x16'))(_0x2041('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38f226,_0x1c8cbf){_0x1c8cbf=_0x1c8cbf||0xcc;return function(_0x41b226){if(_0x41b226){return _0x38f226[_0x2041('0x18')](_0x1c8cbf);}return _0x38f226[_0x2041('0x19')](_0x1c8cbf)[_0x2041('0x1a')]();};}function respondWithResult(_0x3aa911,_0xa3bc9){_0xa3bc9=_0xa3bc9||0xc8;return function(_0x454ee6){if(_0x454ee6){return _0x3aa911['status'](_0xa3bc9)[_0x2041('0x1b')](_0x454ee6);}};}function respondWithFilteredResult(_0x515f31,_0x35c021){return function(_0x44b60a){if(_0x44b60a){var _0x5e6074=typeof _0x35c021[_0x2041('0x1c')]===_0x2041('0x1d')&&typeof _0x35c021['limit']===_0x2041('0x1d');var _0x224d27=_0x44b60a[_0x2041('0x1e')];var _0x29bb7a=_0x5e6074?0x0:_0x35c021['offset'];var _0x48abb8=_0x5e6074?_0x44b60a[_0x2041('0x1e')]:_0x35c021['offset']+_0x35c021[_0x2041('0x1f')];var _0x100c8b;if(_0x48abb8>=_0x224d27){_0x48abb8=_0x224d27;_0x100c8b=0xc8;}else{_0x100c8b=0xce;}_0x515f31[_0x2041('0x19')](_0x100c8b);return _0x515f31[_0x2041('0x20')](_0x2041('0x21'),_0x29bb7a+'-'+_0x48abb8+'/'+_0x224d27)[_0x2041('0x1b')](_0x44b60a);}return null;};}function patchUpdates(_0xb3445e){return function(_0x16c76a){try{jsonpatch[_0x2041('0x22')](_0x16c76a,_0xb3445e,!![]);}catch(_0x4683dc){return BPromise[_0x2041('0x23')](_0x4683dc);}return _0x16c76a[_0x2041('0x24')]();};}function saveUpdates(_0x58e1f3,_0x4cecdf){return function(_0x400e0f){if(_0x400e0f){return _0x400e0f[_0x2041('0x25')](_0x58e1f3)[_0x2041('0x26')](function(_0x142601){return _0x142601;});}return null;};}function removeEntity(_0x204b66,_0x194faa){return function(_0xfabac8){if(_0xfabac8){return _0xfabac8[_0x2041('0x27')]()[_0x2041('0x26')](function(){var _0x48263a=_0xfabac8[_0x2041('0x28')]({'plain':!![]});var _0x51d905=_0x2041('0x29');return db['UserProfileResource'][_0x2041('0x27')]({'where':{'type':_0x51d905,'resourceId':_0x48263a['id']}})['then'](function(){return _0xfabac8;});})[_0x2041('0x26')](function(){_0x204b66[_0x2041('0x19')](0xcc)[_0x2041('0x1a')]();});}};}function handleEntityNotFound(_0xaa8a65,_0x2cb083){return function(_0x5ac193){if(!_0x5ac193){_0xaa8a65['sendStatus'](0x194);}return _0x5ac193;};}function handleError(_0x4bb1e8,_0x438741){_0x438741=_0x438741||0x1f4;return function(_0x313e7e){logger['error'](_0x313e7e['stack']);if(_0x313e7e[_0x2041('0x2a')]){delete _0x313e7e['name'];}_0x4bb1e8[_0x2041('0x19')](_0x438741)[_0x2041('0x2b')](_0x313e7e);};}exports[_0x2041('0x2c')]=function(_0x334093,_0x3233b8){var _0x5b3a36={},_0x143f9c={},_0x5b7d6a={'count':0x0,'rows':[]};var _0x1d5304=_[_0x2041('0x2d')](db['Sound'][_0x2041('0x2e')],function(_0x49673b){return{'name':_0x49673b[_0x2041('0x2f')],'type':_0x49673b[_0x2041('0x30')][_0x2041('0x31')]};});_0x143f9c['model']=_[_0x2041('0x2d')](_0x1d5304,_0x2041('0x2a'));_0x143f9c[_0x2041('0x32')]=_['keys'](_0x334093[_0x2041('0x32')]);_0x143f9c[_0x2041('0x33')]=_['intersection'](_0x143f9c[_0x2041('0x34')],_0x143f9c[_0x2041('0x32')]);_0x5b3a36[_0x2041('0x35')]=_['intersection'](_0x143f9c['model'],qs[_0x2041('0x36')](_0x334093[_0x2041('0x32')]['fields']));_0x5b3a36[_0x2041('0x35')]=_0x5b3a36['attributes'][_0x2041('0x37')]?_0x5b3a36['attributes']:_0x143f9c[_0x2041('0x34')];if(!_0x334093[_0x2041('0x32')][_0x2041('0x38')]('nolimit')){_0x5b3a36[_0x2041('0x1f')]=qs[_0x2041('0x1f')](_0x334093[_0x2041('0x32')][_0x2041('0x1f')]);_0x5b3a36[_0x2041('0x1c')]=qs[_0x2041('0x1c')](_0x334093[_0x2041('0x32')][_0x2041('0x1c')]);}_0x5b3a36[_0x2041('0x39')]=qs[_0x2041('0x3a')](_0x334093[_0x2041('0x32')]['sort']);_0x5b3a36['where']=qs[_0x2041('0x33')](_[_0x2041('0x3b')](_0x334093['query'],_0x143f9c[_0x2041('0x33')]),_0x1d5304);if(_0x334093[_0x2041('0x32')][_0x2041('0x3c')]){_0x5b3a36[_0x2041('0x3d')]=_[_0x2041('0x3e')](_0x5b3a36[_0x2041('0x3d')],{'$or':_[_0x2041('0x2d')](_0x1d5304,function(_0x51efc7){if(_0x51efc7[_0x2041('0x30')]!==_0x2041('0x3f')){var _0x3c6c0e={};_0x3c6c0e[_0x51efc7[_0x2041('0x2a')]]={'$like':'%'+_0x334093['query'][_0x2041('0x3c')]+'%'};return _0x3c6c0e;}})});}_0x5b3a36=_[_0x2041('0x3e')]({},_0x5b3a36,_0x334093[_0x2041('0x40')]);var _0x2f66c6={'where':_0x5b3a36[_0x2041('0x3d')]};return db[_0x2041('0x41')][_0x2041('0x1e')](_0x2f66c6)[_0x2041('0x26')](function(_0x5bda04){_0x5b7d6a['count']=_0x5bda04;if(_0x334093['query'][_0x2041('0x42')]){_0x5b3a36[_0x2041('0x43')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x5b3a36);})['then'](function(_0x26498c){_0x5b7d6a[_0x2041('0x44')]=_0x26498c;return _0x5b7d6a;})[_0x2041('0x26')](respondWithFilteredResult(_0x3233b8,_0x5b3a36))[_0x2041('0x45')](handleError(_0x3233b8,null));};exports[_0x2041('0x46')]=function(_0x59fe16,_0x168383){var _0x398db3={'raw':!![],'where':{'id':_0x59fe16[_0x2041('0x47')]['id']}},_0x291e9f={};_0x291e9f[_0x2041('0x34')]=_[_0x2041('0x48')](db[_0x2041('0x41')][_0x2041('0x2e')]);_0x291e9f[_0x2041('0x32')]=_[_0x2041('0x48')](_0x59fe16[_0x2041('0x32')]);_0x291e9f[_0x2041('0x33')]=_[_0x2041('0x49')](_0x291e9f['model'],_0x291e9f[_0x2041('0x32')]);_0x398db3[_0x2041('0x35')]=_[_0x2041('0x49')](_0x291e9f[_0x2041('0x34')],qs[_0x2041('0x36')](_0x59fe16[_0x2041('0x32')][_0x2041('0x36')]));_0x398db3[_0x2041('0x35')]=_0x398db3[_0x2041('0x35')][_0x2041('0x37')]?_0x398db3[_0x2041('0x35')]:_0x291e9f[_0x2041('0x34')];if(_0x59fe16['query'][_0x2041('0x42')]){_0x398db3['include']=[{'all':!![]}];}_0x398db3=_[_0x2041('0x3e')]({},_0x398db3,_0x59fe16[_0x2041('0x40')]);return db['Sound'][_0x2041('0x4a')](_0x398db3)[_0x2041('0x26')](handleEntityNotFound(_0x168383,null))['then'](respondWithResult(_0x168383,null))[_0x2041('0x45')](handleError(_0x168383,null));};exports[_0x2041('0x4b')]=function(_0x4dd84f,_0x4ab1a1,_0x397397){return db[_0x2041('0x41')][_0x2041('0x4a')]({'where':{'id':_0x4dd84f[_0x2041('0x47')]['id']},'attributes':['name',_0x2041('0x4c'),_0x2041('0x4d')],'raw':!![]})[_0x2041('0x26')](handleEntityNotFound(_0x4ab1a1,null))[_0x2041('0x26')](function(_0x270e0d){if(_0x270e0d){if(!fs[_0x2041('0x4e')](path[_0x2041('0x4f')](config['root'],_0x2041('0x50'),_0x270e0d['save_name']+'.'+_0x270e0d['converted_format']))){throw new db[(_0x2041('0x51'))][(_0x2041('0x52'))]('Sound\x20not\x20found');}return _0x4ab1a1['download'](path[_0x2041('0x4f')](config['root'],_0x2041('0x50'),util[_0x2041('0x53')](_0x2041('0x54'),_0x270e0d[_0x2041('0x4c')],_0x270e0d[_0x2041('0x4d')])),util[_0x2041('0x53')](_0x2041('0x54'),_0x270e0d[_0x2041('0x2a')],_0x270e0d[_0x2041('0x4d')]));}return null;})[_0x2041('0x45')](handleError(_0x4ab1a1,null));};exports[_0x2041('0x55')]=function(_0x521399,_0x37eb2f,_0x51a1cf){var _0x2b6c01={'name':path[_0x2041('0x56')](_0x521399['file'][_0x2041('0x57')],path[_0x2041('0x58')](_0x521399['file'][_0x2041('0x57')])),'save_name':path[_0x2041('0x56')](_0x521399[_0x2041('0x59')]['filename'],path[_0x2041('0x58')](_0x521399['file'][_0x2041('0x5a')])),'original_format':path[_0x2041('0x58')](_0x521399[_0x2041('0x59')][_0x2041('0x57')])[_0x2041('0x5b')](0x1),'converted_format':'wav'};var _0x41b65b=path[_0x2041('0x4f')](config[_0x2041('0x5c')],_0x2041('0x5d'),_0x521399[_0x2041('0x59')][_0x2041('0x5a')]);var _0x1a8581=path[_0x2041('0x4f')](config[_0x2041('0x5c')],_0x2041('0x50'),util[_0x2041('0x53')](_0x2041('0x54'),path['basename'](_0x521399[_0x2041('0x59')][_0x2041('0x5a')],path[_0x2041('0x58')](_0x521399[_0x2041('0x59')][_0x2041('0x5a')])),_0x2b6c01[_0x2041('0x4d')]));logger[_0x2041('0x5e')](_0x2041('0x5f'),_0x41b65b);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1a8581);try{fs[_0x2041('0x60')](_0x41b65b,parseInt(_0x2041('0x61'),0x8));var _0x1dbbc2=sox[_0x2041('0x62')](_0x41b65b,_0x1a8581,{'sampleRate':0x1f40,'format':_0x2041('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1dbbc2['on']('error',function(_0x3f6157){fs[_0x2041('0x64')](_0x41b65b);_0x37eb2f[_0x2041('0x19')](0x1f4)[_0x2041('0x2b')](_0x3f6157);});_0x1dbbc2['on'](_0x2041('0x65'),function(_0xefb77c){_0x2b6c01['original_duration']=isNaN(_0xefb77c[_0x2041('0x66')])?null:_0xefb77c[_0x2041('0x66')]*0x3e8;_0x2b6c01[_0x2041('0x67')]=isNaN(_0xefb77c[_0x2041('0x68')])?null:_0xefb77c[_0x2041('0x68')];_0x2b6c01[_0x2041('0x69')]=isNaN(_0xefb77c['channelCount'])?null:_0xefb77c['channelCount'];_0x2b6c01[_0x2041('0x6a')]=isNaN(_0xefb77c[_0x2041('0x6b')])?null:_0xefb77c[_0x2041('0x6b')];_0x2b6c01['original_sampleRate']=isNaN(_0xefb77c[_0x2041('0x6c')])?null:_0xefb77c[_0x2041('0x6c')];});_0x1dbbc2['on'](_0x2041('0x6d'),function(_0x4a3185){_0x2b6c01['converted_duration']=isNaN(_0x4a3185[_0x2041('0x66')])?null:_0x4a3185[_0x2041('0x66')]*0x3e8;_0x2b6c01[_0x2041('0x6e')]=isNaN(_0x4a3185[_0x2041('0x68')])?null:_0x4a3185[_0x2041('0x68')];_0x2b6c01[_0x2041('0x6f')]=isNaN(_0x4a3185[_0x2041('0x70')])?null:_0x4a3185[_0x2041('0x70')];_0x2b6c01[_0x2041('0x71')]=isNaN(_0x4a3185[_0x2041('0x6b')])?null:_0x4a3185['bitRate'];_0x2b6c01['converted_sampleRate']=isNaN(_0x4a3185[_0x2041('0x6c')])?null:_0x4a3185[_0x2041('0x6c')];});_0x1dbbc2['on'](_0x2041('0x1a'),function(){fs[_0x2041('0x60')](_0x1a8581,parseInt(_0x2041('0x61'),0x8));return db['Sound']['create'](_0x2b6c01)[_0x2041('0x26')](function(_0x1cc4ac){var _0x47b983={'role':_0x521399[_0x2041('0x72')][_0x2041('0x73')],'userProfileId':_0x521399['body'][_0x2041('0x74')]};if(!_0x47b983)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47b983['role']===_0x2041('0x75')){var _0x25e835=_0x1cc4ac['get']({'plain':!![]});return db[_0x2041('0x76')][_0x2041('0x4a')]({'where':{'name':_0x2041('0x29'),'userProfileId':_0x47b983[_0x2041('0x74')]},'raw':!![]})[_0x2041('0x26')](function(_0x31c6af){if(_0x31c6af&&_0x31c6af[_0x2041('0x77')]===0x0){return db[_0x2041('0x78')][_0x2041('0x55')]({'name':_0x25e835[_0x2041('0x2a')],'resourceId':_0x25e835['id'],'type':_0x31c6af[_0x2041('0x2a')],'sectionId':_0x31c6af['id']},{})[_0x2041('0x26')](function(){return _0x1cc4ac;});}else{return _0x1cc4ac;}})['catch'](function(_0x2e0971){logger['error'](_0x2041('0x79'),_0x2e0971);throw _0x2e0971;});}return _0x1cc4ac;})['then'](respondWithResult(_0x37eb2f,null))['catch'](handleError(_0x37eb2f,null));});_0x1dbbc2[_0x2041('0x7a')]();}catch(_0x416c3d){_0x37eb2f[_0x2041('0x19')](0x1f4)['send'](_0x416c3d);}};exports[_0x2041('0x25')]=function(_0x3dce7f,_0x434720,_0x59e97c){return db['Sound']['find']({'where':{'id':_0x3dce7f[_0x2041('0x47')]['id']}})[_0x2041('0x26')](handleEntityNotFound(_0x434720,null))[_0x2041('0x26')](saveUpdates(_[_0x2041('0x3b')](_0x3dce7f['body'],[_0x2041('0x2a'),_0x2041('0x7b')]),null))[_0x2041('0x26')](respondWithResult(_0x434720,null))[_0x2041('0x45')](handleError(_0x434720,null));};exports[_0x2041('0x7c')]=function(_0x260535,_0x22933b,_0x196231){return db[_0x2041('0x41')][_0x2041('0x4a')]({'where':{'id':_0x260535[_0x2041('0x47')]['id']}})['then'](function(_0x1abb6b){if(_0x1abb6b){return _0x1abb6b[_0x2041('0x27')]();}})[_0x2041('0x26')](function(_0x305e44){var _0x1a5725=path[_0x2041('0x4f')](config['root'],_0x2041('0x5d'),util[_0x2041('0x53')](_0x2041('0x54'),_0x305e44[_0x2041('0x4c')],_0x305e44['original_format']));var _0x5ef1f5=path['join'](config[_0x2041('0x5c')],_0x2041('0x50'),util[_0x2041('0x53')]('%s.%s',_0x305e44[_0x2041('0x4c')],_0x305e44[_0x2041('0x4d')]));fs['unlinkSync'](_0x1a5725);fs['unlinkSync'](_0x5ef1f5);return _0x305e44;})[_0x2041('0x26')](function(_0x35b9ca){if(_0x35b9ca){return _0x22933b[_0x2041('0x19')](0xcc)[_0x2041('0x1a')]();}})[_0x2041('0x26')](handleEntityNotFound(_0x22933b,null))['catch'](handleError(_0x22933b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 602046e..7e68b7d 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 _0xd4df=['moment','bluebird','rimraf','./sound.attributes','define','Sound','lodash','util','../../config/logger','api'];(function(_0x56b610,_0x568e2a){var _0x2ca198=function(_0x55729f){while(--_0x55729f){_0x56b610['push'](_0x56b610['shift']());}};_0x2ca198(++_0x568e2a);}(_0xd4df,0x16e));var _0xfd4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfd4d('0x0'));var util=require(_0xfd4d('0x1'));var logger=require(_0xfd4d('0x2'))(_0xfd4d('0x3'));var moment=require(_0xfd4d('0x4'));var BPromise=require(_0xfd4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd4d('0x7'));module['exports']=function(_0x229d57,_0x1d2136){return _0x229d57[_0xfd4d('0x8')](_0xfd4d('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5449=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger'];(function(_0x33ebd4,_0x294358){var _0xad487a=function(_0x2ba19f){while(--_0x2ba19f){_0x33ebd4['push'](_0x33ebd4['shift']());}};_0xad487a(++_0x294358);}(_0x5449,0x8e));var _0x9544=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5449[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x9544('0x0'));var util=require('util');var logger=require(_0x9544('0x1'))(_0x9544('0x2'));var moment=require('moment');var BPromise=require(_0x9544('0x3'));var rp=require(_0x9544('0x4'));var fs=require('fs');var path=require(_0x9544('0x5'));var rimraf=require(_0x9544('0x6'));var config=require(_0x9544('0x7'));var attributes=require(_0x9544('0x8'));module['exports']=function(_0x4acc39,_0x292b35){return _0x4acc39[_0x9544('0x9')](_0x9544('0xa'),attributes,{'tableName':_0x9544('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 f49af69..d8f47d0 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 _0xef35=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','find','raw','options','where','include','map','model','attributes','ShowSound','debug','stringify','catch','moment','ioredis','../../mysqldb'];(function(_0x1275e8,_0x40ab85){var _0x2bfdbd=function(_0x3424c7){while(--_0x3424c7){_0x1275e8['push'](_0x1275e8['shift']());}};_0x2bfdbd(++_0x40ab85);}(_0xef35,0x98));var _0x5ef3=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xef35[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ef3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ef3('0x1'));var db=require(_0x5ef3('0x2'))['db'];var utils=require(_0x5ef3('0x3'));var logger=require(_0x5ef3('0x4'))(_0x5ef3('0x5'));var config=require(_0x5ef3('0x6'));var jayson=require(_0x5ef3('0x7'));var client=jayson[_0x5ef3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x284857,_0x7b6373,_0x19bb19){return new BPromise(function(_0x113fb6,_0x196189){return client[_0x5ef3('0x9')](_0x284857,_0x19bb19)[_0x5ef3('0xa')](function(_0x2da40a){logger['info'](_0x5ef3('0xb'),_0x7b6373,'request\x20sent');logger['debug'](_0x5ef3('0xc'),_0x7b6373,'request\x20sent',JSON['stringify'](_0x2da40a));if(_0x2da40a[_0x5ef3('0xd')]){if(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xe')]===0x1f4){logger[_0x5ef3('0xd')](_0x5ef3('0xb'),_0x7b6373,_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);return _0x196189(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);}logger['error'](_0x5ef3('0xb'),_0x7b6373,_0x2da40a[_0x5ef3('0xd')]['message']);return _0x113fb6(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);}else{logger[_0x5ef3('0x10')](_0x5ef3('0xb'),_0x7b6373,_0x5ef3('0x11'));_0x113fb6(_0x2da40a[_0x5ef3('0x12')]['message']);}})['catch'](function(_0x28a145){logger[_0x5ef3('0xd')](_0x5ef3('0xb'),_0x7b6373,_0x28a145);_0x196189(_0x28a145);});});}exports['ShowSound']=function(_0x1bf997){var _0x54c8ff=this;return new Promise(function(_0x315ba0,_0x3c882f){return db['Sound'][_0x5ef3('0x13')]({'raw':_0x1bf997['options']?_0x1bf997['options'][_0x5ef3('0x14')]===undefined?!![]:![]:!![],'where':_0x1bf997[_0x5ef3('0x15')]?_0x1bf997[_0x5ef3('0x15')][_0x5ef3('0x16')]||null:null,'attributes':_0x1bf997[_0x5ef3('0x15')]?_0x1bf997[_0x5ef3('0x15')]['attributes']||null:null,'include':_0x1bf997['options']?_0x1bf997['options'][_0x5ef3('0x17')]?_[_0x5ef3('0x18')](_0x1bf997[_0x5ef3('0x15')][_0x5ef3('0x17')],function(_0x2abb71){return{'model':db[_0x2abb71[_0x5ef3('0x19')]],'as':_0x2abb71['as'],'attributes':_0x2abb71[_0x5ef3('0x1a')],'include':_0x2abb71['include']?_['map'](_0x2abb71[_0x5ef3('0x17')],function(_0x21f966){return{'model':db[_0x21f966['model']],'as':_0x21f966['as'],'attributes':_0x21f966['attributes'],'include':_0x21f966['include']?_[_0x5ef3('0x18')](_0x21f966[_0x5ef3('0x17')],function(_0x293af1){return{'model':db[_0x293af1[_0x5ef3('0x19')]],'as':_0x293af1['as'],'attributes':_0x293af1[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef3('0xa')](function(_0xc2e978){logger[_0x5ef3('0x10')](_0x5ef3('0x1b'),_0x1bf997);logger[_0x5ef3('0x1c')]('ShowSound',_0x1bf997,JSON[_0x5ef3('0x1d')](_0xc2e978));_0x315ba0(_0xc2e978);})[_0x5ef3('0x1e')](function(_0x1c74ea){logger[_0x5ef3('0xd')](_0x5ef3('0x1b'),_0x1c74ea[_0x5ef3('0xf')],_0x1bf997);_0x3c882f(_0x54c8ff[_0x5ef3('0xd')](0x1f4,_0x1c74ea[_0x5ef3('0xf')]));});});}; \ No newline at end of file +var _0x0a39=['map','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model'];(function(_0x1c1682,_0x37c715){var _0x1010b5=function(_0x1dc476){while(--_0x1dc476){_0x1c1682['push'](_0x1c1682['shift']());}};_0x1010b5(++_0x37c715);}(_0x0a39,0xe8));var _0x90a3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0a39[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x90a3('0x0'));var moment=require(_0x90a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x90a3('0x2'));var fs=require('fs');var Redis=require(_0x90a3('0x3'));var db=require(_0x90a3('0x4'))['db'];var utils=require(_0x90a3('0x5'));var logger=require(_0x90a3('0x6'))('rpc');var config=require(_0x90a3('0x7'));var jayson=require(_0x90a3('0x8'));var client=jayson[_0x90a3('0x9')][_0x90a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x94f007,_0x2141b9,_0x3992af){return new BPromise(function(_0x1e2510,_0x4a1dae){return client[_0x90a3('0xb')](_0x94f007,_0x3992af)[_0x90a3('0xc')](function(_0x4ca205){logger[_0x90a3('0xd')](_0x90a3('0xe'),_0x2141b9,'request\x20sent');logger[_0x90a3('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x2141b9,_0x90a3('0x10'),JSON[_0x90a3('0x11')](_0x4ca205));if(_0x4ca205[_0x90a3('0x12')]){if(_0x4ca205[_0x90a3('0x12')][_0x90a3('0x13')]===0x1f4){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x2141b9,_0x4ca205[_0x90a3('0x12')][_0x90a3('0x14')]);return _0x4a1dae(_0x4ca205[_0x90a3('0x12')][_0x90a3('0x14')]);}logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x2141b9,_0x4ca205['error'][_0x90a3('0x14')]);return _0x1e2510(_0x4ca205['error'][_0x90a3('0x14')]);}else{logger[_0x90a3('0xd')](_0x90a3('0xe'),_0x2141b9,'request\x20sent');_0x1e2510(_0x4ca205[_0x90a3('0x15')][_0x90a3('0x14')]);}})[_0x90a3('0x16')](function(_0x2a7ee7){logger[_0x90a3('0x12')](_0x90a3('0xe'),_0x2141b9,_0x2a7ee7);_0x4a1dae(_0x2a7ee7);});});}exports[_0x90a3('0x17')]=function(_0x224785){var _0x3544f2=this;return new Promise(function(_0x4473df,_0xda239c){return db[_0x90a3('0x18')][_0x90a3('0x19')]({'raw':_0x224785[_0x90a3('0x1a')]?_0x224785[_0x90a3('0x1a')][_0x90a3('0x1b')]===undefined?!![]:![]:!![],'where':_0x224785[_0x90a3('0x1a')]?_0x224785['options'][_0x90a3('0x1c')]||null:null,'attributes':_0x224785[_0x90a3('0x1a')]?_0x224785[_0x90a3('0x1a')][_0x90a3('0x1d')]||null:null,'include':_0x224785[_0x90a3('0x1a')]?_0x224785[_0x90a3('0x1a')][_0x90a3('0x1e')]?_['map'](_0x224785[_0x90a3('0x1a')][_0x90a3('0x1e')],function(_0x1fb9d3){return{'model':db[_0x1fb9d3[_0x90a3('0x1f')]],'as':_0x1fb9d3['as'],'attributes':_0x1fb9d3[_0x90a3('0x1d')],'include':_0x1fb9d3[_0x90a3('0x1e')]?_['map'](_0x1fb9d3[_0x90a3('0x1e')],function(_0x57e36c){return{'model':db[_0x57e36c[_0x90a3('0x1f')]],'as':_0x57e36c['as'],'attributes':_0x57e36c[_0x90a3('0x1d')],'include':_0x57e36c[_0x90a3('0x1e')]?_[_0x90a3('0x20')](_0x57e36c[_0x90a3('0x1e')],function(_0x161c91){return{'model':db[_0x161c91['model']],'as':_0x161c91['as'],'attributes':_0x161c91['attributes']};}):[]};}):[]};}):[]:[]})[_0x90a3('0xc')](function(_0x1ca74d){logger[_0x90a3('0xd')](_0x90a3('0x17'),_0x224785);logger[_0x90a3('0xf')]('ShowSound',_0x224785,JSON['stringify'](_0x1ca74d));_0x4473df(_0x1ca74d);})[_0x90a3('0x16')](function(_0x4a948c){logger['error'](_0x90a3('0x17'),_0x4a948c[_0x90a3('0x14')],_0x224785);_0xda239c(_0x3544f2[_0x90a3('0x12')](0x1f4,_0x4a948c[_0x90a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 57021d4..6b8cc69 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(_0x4966a4,_0x39662c){var _0x3c6bf6=function(_0x53c4f2){while(--_0x53c4f2){_0x4966a4['push'](_0x4966a4['shift']());}};_0x3c6bf6(++_0x39662c);}(_0x2032,0xd9));var _0x2203=function(_0x3c1183,_0x1ecbe8){_0x3c1183=_0x3c1183-0x0;var _0x5b2deb=_0x2032[_0x3c1183];return _0x5b2deb;};'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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x44b034,_0xe3f980){var _0x5216cc=function(_0x10af31){while(--_0x10af31){_0x44b034['push'](_0x44b034['shift']());}};_0x5216cc(++_0xe3f980);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 875813d..e1de4c7 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 _0x744f=['TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x542f20,_0x107fac){var _0x35ce6d=function(_0x1bf92a){while(--_0x1bf92a){_0x542f20['push'](_0x542f20['shift']());}};_0x35ce6d(++_0x107fac);}(_0x744f,0x119));var _0xf744=function(_0x248e22,_0x115f43){_0x248e22=_0x248e22-0x0;var _0xbef947=_0x744f[_0x248e22];return _0xbef947;};'use strict';var Sequelize=require(_0xf744('0x0'));module[_0xf744('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xf744('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xf744('0x3')]('in',_0xf744('0x4')),'defaultValue':_0xf744('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf744('0x5')]},'providerResponse':{'type':Sequelize[_0xf744('0x6')]}}; \ No newline at end of file +var _0xd1c2=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x26a506,_0x335198){var _0xbddb9b=function(_0x1cc8a5){while(--_0x1cc8a5){_0x26a506['push'](_0x26a506['shift']());}};_0xbddb9b(++_0x335198);}(_0xd1c2,0x169));var _0x2d1c=function(_0x3cca04,_0x52efed){_0x3cca04=_0x3cca04-0x0;var _0x10e0e5=_0xd1c2[_0x3cca04];return _0x10e0e5;};'use strict';var Sequelize=require(_0x2d1c('0x0'));module[_0x2d1c('0x1')]={'uniqueid':{'type':Sequelize[_0x2d1c('0x2')]},'body':{'type':Sequelize[_0x2d1c('0x3')](_0x2d1c('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x2d1c('0x5')]('in','out'),'defaultValue':_0x2d1c('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2d1c('0x2')]},'providerResponse':{'type':Sequelize[_0x2d1c('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 423f496..c4e94f1 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 _0x71a1=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','where','pick','filters','filter','merge','include','findAll','catch','show','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x17558f,_0x42f9f5){var _0x4a81a5=function(_0x14ec0a){while(--_0x14ec0a){_0x17558f['push'](_0x17558f['shift']());}};_0x4a81a5(++_0x42f9f5);}(_0x71a1,0x1eb));var _0x171a=function(_0x25b7e9,_0x40e68e){_0x25b7e9=_0x25b7e9-0x0;var _0x4bc0a3=_0x71a1[_0x25b7e9];return _0x4bc0a3;};'use strict';var emlformat=require(_0x171a('0x0'));var rimraf=require(_0x171a('0x1'));var zipdir=require(_0x171a('0x2'));var jsonpatch=require(_0x171a('0x3'));var rp=require(_0x171a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x171a('0x5'));var util=require(_0x171a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x171a('0x7'));var ejs=require(_0x171a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x171a('0x9'));var squel=require(_0x171a('0xa'));var crypto=require(_0x171a('0xb'));var jsforce=require(_0x171a('0xc'));var deskjs=require(_0x171a('0xd'));var toCsv=require(_0x171a('0x7'));var querystring=require(_0x171a('0xe'));var Papa=require(_0x171a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x171a('0x10'));var as=require(_0x171a('0x11'));var hardwareService=require(_0x171a('0x12'));var logger=require(_0x171a('0x13'))(_0x171a('0x14'));var utils=require(_0x171a('0x15'));var config=require(_0x171a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x171a('0x17'))['db'];function respondWithStatusCode(_0x5b0154,_0x26f64b){_0x26f64b=_0x26f64b||0xcc;return function(_0x8a90d3){if(_0x8a90d3){return _0x5b0154['sendStatus'](_0x26f64b);}return _0x5b0154['status'](_0x26f64b)[_0x171a('0x18')]();};}function respondWithResult(_0x16a5b5,_0x2730da){_0x2730da=_0x2730da||0xc8;return function(_0x353d02){if(_0x353d02){return _0x16a5b5[_0x171a('0x19')](_0x2730da)[_0x171a('0x1a')](_0x353d02);}};}function respondWithFilteredResult(_0x3c737f,_0x209c7f){return function(_0x370f6e){if(_0x370f6e){var _0xf32321=typeof _0x209c7f[_0x171a('0x1b')]===_0x171a('0x1c')&&typeof _0x209c7f[_0x171a('0x1d')]===_0x171a('0x1c');var _0x34db6e=_0x370f6e[_0x171a('0x1e')];var _0x34ec66=_0xf32321?0x0:_0x209c7f[_0x171a('0x1b')];var _0x1f1bf7=_0xf32321?_0x370f6e[_0x171a('0x1e')]:_0x209c7f[_0x171a('0x1b')]+_0x209c7f['limit'];var _0x44d970;if(_0x1f1bf7>=_0x34db6e){_0x1f1bf7=_0x34db6e;_0x44d970=0xc8;}else{_0x44d970=0xce;}_0x3c737f[_0x171a('0x19')](_0x44d970);return _0x3c737f[_0x171a('0x1f')]('Content-Range',_0x34ec66+'-'+_0x1f1bf7+'/'+_0x34db6e)[_0x171a('0x1a')](_0x370f6e);}return null;};}function patchUpdates(_0xb2c217){return function(_0x966760){try{jsonpatch[_0x171a('0x20')](_0x966760,_0xb2c217,!![]);}catch(_0x2771bf){return BPromise['reject'](_0x2771bf);}return _0x966760['save']();};}function saveUpdates(_0x591ca9,_0x9714bf){return function(_0x1a1627){if(_0x1a1627){return _0x1a1627[_0x171a('0x21')](_0x591ca9)[_0x171a('0x22')](function(_0x4fe162){return _0x4fe162;});}return null;};}function removeEntity(_0x18d24c,_0x23d4d3){return function(_0xcbc8e2){if(_0xcbc8e2){return _0xcbc8e2['destroy']()['then'](function(){_0x18d24c[_0x171a('0x19')](0xcc)[_0x171a('0x18')]();});}};}function handleEntityNotFound(_0x59580a,_0x1932b7){return function(_0x49bf1a){if(!_0x49bf1a){_0x59580a[_0x171a('0x23')](0x194);}return _0x49bf1a;};}function handleError(_0x3c7246,_0x4a8df3){_0x4a8df3=_0x4a8df3||0x1f4;return function(_0x15b6ce){logger[_0x171a('0x24')](_0x15b6ce[_0x171a('0x25')]);if(_0x15b6ce[_0x171a('0x26')]){delete _0x15b6ce['name'];}_0x3c7246['status'](_0x4a8df3)[_0x171a('0x27')](_0x15b6ce);};}exports[_0x171a('0x28')]=function(_0x49f3ec,_0x3dce2){var _0x3e6389={},_0x284f20={},_0x11d2e4={'count':0x0,'rows':[]};var _0x5f202c=_[_0x171a('0x29')](db[_0x171a('0x2a')][_0x171a('0x2b')],function(_0x1d3340){return{'name':_0x1d3340[_0x171a('0x2c')],'type':_0x1d3340[_0x171a('0x2d')][_0x171a('0x2e')]};});_0x284f20[_0x171a('0x2f')]=_['map'](_0x5f202c,'name');_0x284f20['query']=_['keys'](_0x49f3ec[_0x171a('0x30')]);_0x284f20['filters']=_['intersection'](_0x284f20[_0x171a('0x2f')],_0x284f20[_0x171a('0x30')]);_0x3e6389[_0x171a('0x31')]=_[_0x171a('0x32')](_0x284f20[_0x171a('0x2f')],qs[_0x171a('0x33')](_0x49f3ec[_0x171a('0x30')][_0x171a('0x33')]));_0x3e6389[_0x171a('0x31')]=_0x3e6389[_0x171a('0x31')][_0x171a('0x34')]?_0x3e6389[_0x171a('0x31')]:_0x284f20[_0x171a('0x2f')];if(!_0x49f3ec[_0x171a('0x30')]['hasOwnProperty'](_0x171a('0x35'))){_0x3e6389[_0x171a('0x1d')]=qs[_0x171a('0x1d')](_0x49f3ec['query']['limit']);_0x3e6389[_0x171a('0x1b')]=qs['offset'](_0x49f3ec[_0x171a('0x30')][_0x171a('0x1b')]);}_0x3e6389[_0x171a('0x36')]=qs['sort'](_0x49f3ec[_0x171a('0x30')]['sort']);_0x3e6389[_0x171a('0x37')]=qs['filters'](_[_0x171a('0x38')](_0x49f3ec[_0x171a('0x30')],_0x284f20[_0x171a('0x39')]),_0x5f202c);if(_0x49f3ec['query'][_0x171a('0x3a')]){_0x3e6389[_0x171a('0x37')]=_[_0x171a('0x3b')](_0x3e6389['where'],{'$or':_[_0x171a('0x29')](_0x5f202c,function(_0x265c81){if(_0x265c81[_0x171a('0x2d')]!=='VIRTUAL'){var _0x424457={};_0x424457[_0x265c81[_0x171a('0x26')]]={'$like':'%'+_0x49f3ec[_0x171a('0x30')][_0x171a('0x3a')]+'%'};return _0x424457;}})});}_0x3e6389=_[_0x171a('0x3b')]({},_0x3e6389,_0x49f3ec['options']);var _0x2aeed0={'where':_0x3e6389['where']};return db[_0x171a('0x2a')][_0x171a('0x1e')](_0x2aeed0)[_0x171a('0x22')](function(_0x478a03){_0x11d2e4['count']=_0x478a03;if(_0x49f3ec['query']['includeAll']){_0x3e6389[_0x171a('0x3c')]=[{'all':!![]}];}return db[_0x171a('0x2a')][_0x171a('0x3d')](_0x3e6389);})[_0x171a('0x22')](function(_0x33a000){_0x11d2e4['rows']=_0x33a000;return _0x11d2e4;})[_0x171a('0x22')](respondWithFilteredResult(_0x3dce2,_0x3e6389))[_0x171a('0x3e')](handleError(_0x3dce2,null));};exports[_0x171a('0x3f')]=function(_0x4bc849,_0x343bd3){var _0x45eeb6={'raw':!![],'where':{'id':_0x4bc849[_0x171a('0x40')]['id']}},_0x3c67a2={};_0x3c67a2['model']=_[_0x171a('0x41')](db['SquareMessage'][_0x171a('0x2b')]);_0x3c67a2[_0x171a('0x30')]=_[_0x171a('0x41')](_0x4bc849[_0x171a('0x30')]);_0x3c67a2[_0x171a('0x39')]=_[_0x171a('0x32')](_0x3c67a2[_0x171a('0x2f')],_0x3c67a2[_0x171a('0x30')]);_0x45eeb6[_0x171a('0x31')]=_[_0x171a('0x32')](_0x3c67a2['model'],qs[_0x171a('0x33')](_0x4bc849[_0x171a('0x30')]['fields']));_0x45eeb6[_0x171a('0x31')]=_0x45eeb6[_0x171a('0x31')][_0x171a('0x34')]?_0x45eeb6[_0x171a('0x31')]:_0x3c67a2['model'];if(_0x4bc849['query'][_0x171a('0x42')]){_0x45eeb6['include']=[{'all':!![]}];}_0x45eeb6=_[_0x171a('0x3b')]({},_0x45eeb6,_0x4bc849['options']);return db[_0x171a('0x2a')][_0x171a('0x43')](_0x45eeb6)[_0x171a('0x22')](handleEntityNotFound(_0x343bd3,null))[_0x171a('0x22')](respondWithResult(_0x343bd3,null))[_0x171a('0x3e')](handleError(_0x343bd3,null));};exports[_0x171a('0x44')]=function(_0x3baec0,_0x15a197){return db[_0x171a('0x2a')][_0x171a('0x44')](_0x3baec0['body'],{})[_0x171a('0x22')](respondWithResult(_0x15a197,0xc9))['catch'](handleError(_0x15a197,null));};exports[_0x171a('0x21')]=function(_0x506b0c,_0xb9647){if(_0x506b0c[_0x171a('0x45')]['id']){delete _0x506b0c[_0x171a('0x45')]['id'];}return db[_0x171a('0x2a')][_0x171a('0x43')]({'where':{'id':_0x506b0c[_0x171a('0x40')]['id']}})[_0x171a('0x22')](handleEntityNotFound(_0xb9647,null))[_0x171a('0x22')](saveUpdates(_0x506b0c[_0x171a('0x45')],null))[_0x171a('0x22')](respondWithResult(_0xb9647,null))[_0x171a('0x3e')](handleError(_0xb9647,null));};exports[_0x171a('0x46')]=function(_0x132973,_0x144a31){return db[_0x171a('0x2a')][_0x171a('0x43')]({'where':{'id':_0x132973[_0x171a('0x40')]['id']}})[_0x171a('0x22')](handleEntityNotFound(_0x144a31,null))['then'](removeEntity(_0x144a31,null))[_0x171a('0x3e')](handleError(_0x144a31,null));}; \ No newline at end of file +var _0x9918=['rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','sendStatus','error','name','index','map','SquareMessage'];(function(_0x3da888,_0x7a9b4c){var _0x8e5abf=function(_0x353434){while(--_0x353434){_0x3da888['push'](_0x3da888['shift']());}};_0x8e5abf(++_0x7a9b4c);}(_0x9918,0x186));var _0x8991=function(_0x32cefe,_0x1befba){_0x32cefe=_0x32cefe-0x0;var _0x283e79=_0x9918[_0x32cefe];return _0x283e79;};'use strict';var emlformat=require(_0x8991('0x0'));var rimraf=require(_0x8991('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8991('0x2'));var rp=require(_0x8991('0x3'));var moment=require(_0x8991('0x4'));var BPromise=require(_0x8991('0x5'));var Mustache=require(_0x8991('0x6'));var util=require(_0x8991('0x7'));var path=require(_0x8991('0x8'));var sox=require(_0x8991('0x9'));var csv=require(_0x8991('0xa'));var ejs=require(_0x8991('0xb'));var fs=require('fs');var fs_extra=require(_0x8991('0xc'));var _=require(_0x8991('0xd'));var squel=require(_0x8991('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8991('0xa'));var querystring=require(_0x8991('0xf'));var Papa=require('papaparse');var Redis=require(_0x8991('0x10'));var authService=require(_0x8991('0x11'));var qs=require(_0x8991('0x12'));var as=require(_0x8991('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8991('0x14'))(_0x8991('0x15'));var utils=require('../../config/utils');var config=require(_0x8991('0x16'));var licenseUtil=require(_0x8991('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54ac95,_0xfbee87){_0xfbee87=_0xfbee87||0xcc;return function(_0xadf5a2){if(_0xadf5a2){return _0x54ac95['sendStatus'](_0xfbee87);}return _0x54ac95['status'](_0xfbee87)[_0x8991('0x18')]();};}function respondWithResult(_0x465fc4,_0x183767){_0x183767=_0x183767||0xc8;return function(_0x3711e9){if(_0x3711e9){return _0x465fc4[_0x8991('0x19')](_0x183767)[_0x8991('0x1a')](_0x3711e9);}};}function respondWithFilteredResult(_0x57cdec,_0x4770b8){return function(_0x26d039){if(_0x26d039){var _0x75a1e4=typeof _0x4770b8[_0x8991('0x1b')]===_0x8991('0x1c')&&typeof _0x4770b8[_0x8991('0x1d')]==='undefined';var _0x5e9558=_0x26d039[_0x8991('0x1e')];var _0x500ede=_0x75a1e4?0x0:_0x4770b8[_0x8991('0x1b')];var _0x3137f9=_0x75a1e4?_0x26d039[_0x8991('0x1e')]:_0x4770b8[_0x8991('0x1b')]+_0x4770b8[_0x8991('0x1d')];var _0x206d4c;if(_0x3137f9>=_0x5e9558){_0x3137f9=_0x5e9558;_0x206d4c=0xc8;}else{_0x206d4c=0xce;}_0x57cdec[_0x8991('0x19')](_0x206d4c);return _0x57cdec[_0x8991('0x1f')]('Content-Range',_0x500ede+'-'+_0x3137f9+'/'+_0x5e9558)[_0x8991('0x1a')](_0x26d039);}return null;};}function patchUpdates(_0x3cfd7d){return function(_0xbcc0e0){try{jsonpatch['apply'](_0xbcc0e0,_0x3cfd7d,!![]);}catch(_0x475834){return BPromise['reject'](_0x475834);}return _0xbcc0e0[_0x8991('0x20')]();};}function saveUpdates(_0x5113fd,_0x1ab7f6){return function(_0x3aecbb){if(_0x3aecbb){return _0x3aecbb[_0x8991('0x21')](_0x5113fd)[_0x8991('0x22')](function(_0x53802f){return _0x53802f;});}return null;};}function removeEntity(_0x5d52a0,_0x39490d){return function(_0xbfec5f){if(_0xbfec5f){return _0xbfec5f[_0x8991('0x23')]()['then'](function(){_0x5d52a0['status'](0xcc)[_0x8991('0x18')]();});}};}function handleEntityNotFound(_0x38f6ca,_0x93931e){return function(_0x1d86af){if(!_0x1d86af){_0x38f6ca[_0x8991('0x24')](0x194);}return _0x1d86af;};}function handleError(_0x5086d7,_0x5e148c){_0x5e148c=_0x5e148c||0x1f4;return function(_0x4263c6){logger[_0x8991('0x25')](_0x4263c6['stack']);if(_0x4263c6[_0x8991('0x26')]){delete _0x4263c6[_0x8991('0x26')];}_0x5086d7[_0x8991('0x19')](_0x5e148c)['send'](_0x4263c6);};}exports[_0x8991('0x27')]=function(_0x42ed44,_0x21e8f2){var _0x582ab7={},_0x1aade7={},_0xeefa8f={'count':0x0,'rows':[]};var _0x14f4f9=_[_0x8991('0x28')](db[_0x8991('0x29')][_0x8991('0x2a')],function(_0x4a18fd){return{'name':_0x4a18fd[_0x8991('0x2b')],'type':_0x4a18fd[_0x8991('0x2c')][_0x8991('0x2d')]};});_0x1aade7['model']=_[_0x8991('0x28')](_0x14f4f9,'name');_0x1aade7[_0x8991('0x2e')]=_['keys'](_0x42ed44[_0x8991('0x2e')]);_0x1aade7[_0x8991('0x2f')]=_['intersection'](_0x1aade7[_0x8991('0x30')],_0x1aade7[_0x8991('0x2e')]);_0x582ab7[_0x8991('0x31')]=_[_0x8991('0x32')](_0x1aade7['model'],qs[_0x8991('0x33')](_0x42ed44[_0x8991('0x2e')][_0x8991('0x33')]));_0x582ab7[_0x8991('0x31')]=_0x582ab7['attributes'][_0x8991('0x34')]?_0x582ab7[_0x8991('0x31')]:_0x1aade7[_0x8991('0x30')];if(!_0x42ed44[_0x8991('0x2e')][_0x8991('0x35')](_0x8991('0x36'))){_0x582ab7['limit']=qs[_0x8991('0x1d')](_0x42ed44[_0x8991('0x2e')][_0x8991('0x1d')]);_0x582ab7[_0x8991('0x1b')]=qs[_0x8991('0x1b')](_0x42ed44[_0x8991('0x2e')]['offset']);}_0x582ab7['order']=qs[_0x8991('0x37')](_0x42ed44[_0x8991('0x2e')]['sort']);_0x582ab7[_0x8991('0x38')]=qs[_0x8991('0x2f')](_[_0x8991('0x39')](_0x42ed44[_0x8991('0x2e')],_0x1aade7[_0x8991('0x2f')]),_0x14f4f9);if(_0x42ed44[_0x8991('0x2e')][_0x8991('0x3a')]){_0x582ab7[_0x8991('0x38')]=_[_0x8991('0x3b')](_0x582ab7[_0x8991('0x38')],{'$or':_['map'](_0x14f4f9,function(_0x266ad8){if(_0x266ad8['type']!==_0x8991('0x3c')){var _0x85dea0={};_0x85dea0[_0x266ad8[_0x8991('0x26')]]={'$like':'%'+_0x42ed44[_0x8991('0x2e')]['filter']+'%'};return _0x85dea0;}})});}_0x582ab7=_[_0x8991('0x3b')]({},_0x582ab7,_0x42ed44[_0x8991('0x3d')]);var _0x21c20b={'where':_0x582ab7['where']};return db[_0x8991('0x29')][_0x8991('0x1e')](_0x21c20b)[_0x8991('0x22')](function(_0x351dea){_0xeefa8f[_0x8991('0x1e')]=_0x351dea;if(_0x42ed44[_0x8991('0x2e')]['includeAll']){_0x582ab7[_0x8991('0x3e')]=[{'all':!![]}];}return db[_0x8991('0x29')][_0x8991('0x3f')](_0x582ab7);})[_0x8991('0x22')](function(_0x4139e3){_0xeefa8f[_0x8991('0x40')]=_0x4139e3;return _0xeefa8f;})[_0x8991('0x22')](respondWithFilteredResult(_0x21e8f2,_0x582ab7))[_0x8991('0x41')](handleError(_0x21e8f2,null));};exports['show']=function(_0x145a34,_0x2c5221){var _0x5a84b2={'raw':!![],'where':{'id':_0x145a34[_0x8991('0x42')]['id']}},_0x2653f7={};_0x2653f7['model']=_[_0x8991('0x43')](db[_0x8991('0x29')][_0x8991('0x2a')]);_0x2653f7[_0x8991('0x2e')]=_[_0x8991('0x43')](_0x145a34[_0x8991('0x2e')]);_0x2653f7[_0x8991('0x2f')]=_[_0x8991('0x32')](_0x2653f7[_0x8991('0x30')],_0x2653f7[_0x8991('0x2e')]);_0x5a84b2[_0x8991('0x31')]=_[_0x8991('0x32')](_0x2653f7['model'],qs[_0x8991('0x33')](_0x145a34[_0x8991('0x2e')][_0x8991('0x33')]));_0x5a84b2[_0x8991('0x31')]=_0x5a84b2[_0x8991('0x31')][_0x8991('0x34')]?_0x5a84b2['attributes']:_0x2653f7['model'];if(_0x145a34['query'][_0x8991('0x44')]){_0x5a84b2[_0x8991('0x3e')]=[{'all':!![]}];}_0x5a84b2=_[_0x8991('0x3b')]({},_0x5a84b2,_0x145a34['options']);return db['SquareMessage'][_0x8991('0x45')](_0x5a84b2)[_0x8991('0x22')](handleEntityNotFound(_0x2c5221,null))['then'](respondWithResult(_0x2c5221,null))[_0x8991('0x41')](handleError(_0x2c5221,null));};exports[_0x8991('0x46')]=function(_0x4faa49,_0x5871a9){return db[_0x8991('0x29')][_0x8991('0x46')](_0x4faa49[_0x8991('0x47')],{})[_0x8991('0x22')](respondWithResult(_0x5871a9,0xc9))['catch'](handleError(_0x5871a9,null));};exports['update']=function(_0x3238c2,_0xa5e40){if(_0x3238c2[_0x8991('0x47')]['id']){delete _0x3238c2[_0x8991('0x47')]['id'];}return db[_0x8991('0x29')]['find']({'where':{'id':_0x3238c2['params']['id']}})['then'](handleEntityNotFound(_0xa5e40,null))[_0x8991('0x22')](saveUpdates(_0x3238c2[_0x8991('0x47')],null))[_0x8991('0x22')](respondWithResult(_0xa5e40,null))[_0x8991('0x41')](handleError(_0xa5e40,null));};exports[_0x8991('0x23')]=function(_0x2e5fb3,_0x389290){return db[_0x8991('0x29')]['find']({'where':{'id':_0x2e5fb3[_0x8991('0x42')]['id']}})['then'](handleEntityNotFound(_0x389290,null))['then'](removeEntity(_0x389290,null))[_0x8991('0x41')](handleError(_0x389290,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d10c97d..60e401f 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 _0xe695=['api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe695,0x128));var _0x5e69=function(_0xaa677d,_0x3747fd){_0xaa677d=_0xaa677d-0x0;var _0x5877f5=_0xe695[_0xaa677d];return _0x5877f5;};'use strict';var _=require(_0x5e69('0x0'));var util=require(_0x5e69('0x1'));var logger=require(_0x5e69('0x2'))(_0x5e69('0x3'));var moment=require(_0x5e69('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e69('0x5'));var fs=require('fs');var path=require(_0x5e69('0x6'));var rimraf=require(_0x5e69('0x7'));var config=require(_0x5e69('0x8'));var attributes=require(_0x5e69('0x9'));module[_0x5e69('0xa')]=function(_0xad26a6,_0x451a09){return _0xad26a6[_0x5e69('0xb')](_0x5e69('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa54e=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird'];(function(_0x23ff69,_0x354544){var _0x1ce4d1=function(_0x28c9e2){while(--_0x28c9e2){_0x23ff69['push'](_0x23ff69['shift']());}};_0x1ce4d1(++_0x354544);}(_0xa54e,0x70));var _0xea54=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0xa54e[_0x54b396];return _0x532e6d;};'use strict';var _=require(_0xea54('0x0'));var util=require(_0xea54('0x1'));var logger=require(_0xea54('0x2'))(_0xea54('0x3'));var moment=require('moment');var BPromise=require(_0xea54('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea54('0x5'));var rimraf=require(_0xea54('0x6'));var config=require(_0xea54('0x7'));var attributes=require(_0xea54('0x8'));module[_0xea54('0x9')]=function(_0xb795a9,_0x2a032a){return _0xb795a9[_0xea54('0xa')](_0xea54('0xb'),attributes,{'tableName':_0xea54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index eef2fd2..ed538ca 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 _0xf646=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','lodash','moment'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xf646,0x16a));var _0x6f64=function(_0x38e955,_0x37913f){_0x38e955=_0x38e955-0x0;var _0x313089=_0xf646[_0x38e955];return _0x313089;};'use strict';var _=require(_0x6f64('0x0'));var util=require('util');var moment=require(_0x6f64('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f64('0x2'));var fs=require('fs');var Redis=require(_0x6f64('0x3'));var db=require(_0x6f64('0x4'))['db'];var utils=require(_0x6f64('0x5'));var logger=require('../../config/logger')(_0x6f64('0x6'));var config=require(_0x6f64('0x7'));var jayson=require(_0x6f64('0x8'));var client=jayson['client'][_0x6f64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x409867,_0x5a7294,_0x516423){return new BPromise(function(_0x176ebe,_0x217016){return client[_0x6f64('0xa')](_0x409867,_0x516423)['then'](function(_0x79d0fa){logger[_0x6f64('0xb')](_0x6f64('0xc'),_0x5a7294,_0x6f64('0xd'));logger[_0x6f64('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5a7294,_0x6f64('0xd'),JSON[_0x6f64('0xf')](_0x79d0fa));if(_0x79d0fa[_0x6f64('0x10')]){if(_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x11')]===0x1f4){logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x5a7294,_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);return _0x217016(_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);}logger[_0x6f64('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5a7294,_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);return _0x176ebe(_0x79d0fa['error'][_0x6f64('0x12')]);}else{logger[_0x6f64('0xb')]('SquareMessage,\x20%s,\x20%s',_0x5a7294,'request\x20sent');_0x176ebe(_0x79d0fa[_0x6f64('0x13')][_0x6f64('0x12')]);}})[_0x6f64('0x14')](function(_0x55a1ce){logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x5a7294,_0x55a1ce);_0x217016(_0x55a1ce);});});}exports[_0x6f64('0x15')]=function(_0x39601d){var _0x5bace7=this;return new Promise(function(_0x341d45,_0x23bc86){return db[_0x6f64('0x16')]['create'](_0x39601d[_0x6f64('0x17')],{'raw':_0x39601d['options']?_0x39601d[_0x6f64('0x18')][_0x6f64('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x8dd045){logger[_0x6f64('0xb')]('CreateSquareMessage',_0x39601d);logger[_0x6f64('0xe')](_0x6f64('0x15'),_0x39601d,JSON[_0x6f64('0xf')](_0x8dd045));_0x341d45(_0x8dd045);})[_0x6f64('0x14')](function(_0x5b3009){logger[_0x6f64('0x10')](_0x6f64('0x15'),_0x5b3009[_0x6f64('0x12')],_0x39601d);_0x23bc86(_0x5bace7[_0x6f64('0x10')](0x1f4,_0x5b3009['message']));});});}; \ No newline at end of file +var _0x377d=['../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','moment','randomstring','ioredis'];(function(_0x42d448,_0x5b3376){var _0x406964=function(_0x182cdb){while(--_0x182cdb){_0x42d448['push'](_0x42d448['shift']());}};_0x406964(++_0x5b3376);}(_0x377d,0x128));var _0xd377=function(_0x1b788f,_0x3f119d){_0x1b788f=_0x1b788f-0x0;var _0x21cfc4=_0x377d[_0x1b788f];return _0x21cfc4;};'use strict';var _=require(_0xd377('0x0'));var util=require('util');var moment=require(_0xd377('0x1'));var BPromise=require('bluebird');var rs=require(_0xd377('0x2'));var fs=require('fs');var Redis=require(_0xd377('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd377('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd377('0x5'));var jayson=require(_0xd377('0x6'));var client=jayson['client'][_0xd377('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x276b2a,_0x284878,_0x1f4956){return new BPromise(function(_0x2fc5ca,_0x3472fd){return client[_0xd377('0x8')](_0x276b2a,_0x1f4956)[_0xd377('0x9')](function(_0x2d4c76){logger[_0xd377('0xa')](_0xd377('0xb'),_0x284878,_0xd377('0xc'));logger[_0xd377('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x284878,_0xd377('0xc'),JSON['stringify'](_0x2d4c76));if(_0x2d4c76[_0xd377('0xe')]){if(_0x2d4c76[_0xd377('0xe')]['code']===0x1f4){logger['error'](_0xd377('0xb'),_0x284878,_0x2d4c76[_0xd377('0xe')][_0xd377('0xf')]);return _0x3472fd(_0x2d4c76[_0xd377('0xe')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x284878,_0x2d4c76[_0xd377('0xe')]['message']);return _0x2fc5ca(_0x2d4c76[_0xd377('0xe')][_0xd377('0xf')]);}else{logger[_0xd377('0xa')](_0xd377('0xb'),_0x284878,_0xd377('0xc'));_0x2fc5ca(_0x2d4c76[_0xd377('0x10')]['message']);}})[_0xd377('0x11')](function(_0x42a015){logger[_0xd377('0xe')]('SquareMessage,\x20%s,\x20%s',_0x284878,_0x42a015);_0x3472fd(_0x42a015);});});}exports[_0xd377('0x12')]=function(_0x56c395){var _0x48566e=this;return new Promise(function(_0x391406,_0xbd5aa1){return db[_0xd377('0x13')][_0xd377('0x14')](_0x56c395[_0xd377('0x15')],{'raw':_0x56c395[_0xd377('0x16')]?_0x56c395['options'][_0xd377('0x17')]===undefined?!![]:![]:!![]})[_0xd377('0x9')](function(_0x554187){logger['info'](_0xd377('0x12'),_0x56c395);logger[_0xd377('0xd')]('CreateSquareMessage',_0x56c395,JSON[_0xd377('0x18')](_0x554187));_0x391406(_0x554187);})['catch'](function(_0x2738a2){logger[_0xd377('0xe')](_0xd377('0x12'),_0x2738a2[_0xd377('0xf')],_0x56c395);_0xbd5aa1(_0x48566e[_0xd377('0xe')](0x1f4,_0x2738a2[_0xd377('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 86bc31b..a2d687e 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 _0x0b57=['15s','test','put','/:id','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0b57,0x72));var _0x70b5=function(_0x1e6bf3,_0x4133b2){_0x1e6bf3=_0x1e6bf3-0x0;var _0x21ea62=_0x0b57[_0x1e6bf3];return _0x21ea62;};'use strict';var multer=require(_0x70b5('0x0'));var util=require(_0x70b5('0x1'));var path=require(_0x70b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x70b5('0x3'));var router=express[_0x70b5('0x4')]();var fs_extra=require(_0x70b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70b5('0x6'));var config=require(_0x70b5('0x7'));var controller=require(_0x70b5('0x8'));router['get']('/',auth[_0x70b5('0x9')](),controller['index']);router[_0x70b5('0xa')]('/:id',auth[_0x70b5('0x9')](),controller[_0x70b5('0xb')]);router[_0x70b5('0xa')]('/:id/test',auth['isAuthenticated'](),timeout(_0x70b5('0xc')),controller[_0x70b5('0xd')]);router['post']('/',auth[_0x70b5('0x9')](),controller['create']);router[_0x70b5('0xe')](_0x70b5('0xf'),auth[_0x70b5('0x9')](),controller['update']);router[_0x70b5('0x10')](_0x70b5('0xf'),auth[_0x70b5('0x9')](),controller[_0x70b5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7865=['../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x20c2ac,_0x4c4d82){var _0x24d8ff=function(_0x550a81){while(--_0x550a81){_0x20c2ac['push'](_0x20c2ac['shift']());}};_0x24d8ff(++_0x4c4d82);}(_0x7865,0x13d));var _0x5786=function(_0xb87a63,_0xe20ceb){_0xb87a63=_0xb87a63-0x0;var _0x707353=_0x7865[_0xb87a63];return _0x707353;};'use strict';var multer=require(_0x5786('0x0'));var util=require(_0x5786('0x1'));var path=require('path');var timeout=require(_0x5786('0x2'));var express=require(_0x5786('0x3'));var router=express[_0x5786('0x4')]();var fs_extra=require(_0x5786('0x5'));var auth=require(_0x5786('0x6'));var interaction=require(_0x5786('0x7'));var config=require('../../config/environment');var controller=require(_0x5786('0x8'));router[_0x5786('0x9')]('/',auth[_0x5786('0xa')](),controller[_0x5786('0xb')]);router['get'](_0x5786('0xc'),auth[_0x5786('0xa')](),controller[_0x5786('0xd')]);router[_0x5786('0x9')]('/:id/test',auth[_0x5786('0xa')](),timeout('15s'),controller['test']);router['post']('/',auth[_0x5786('0xa')](),controller[_0x5786('0xe')]);router[_0x5786('0xf')](_0x5786('0xc'),auth[_0x5786('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5786('0xa')](),controller[_0x5786('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6b7ea8e..04b5b57 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 _0x6c54=['STRING','sequelize','name'];(function(_0x35a8b8,_0x45098e){var _0x590b2d=function(_0x17ab7a){while(--_0x17ab7a){_0x35a8b8['push'](_0x35a8b8['shift']());}};_0x590b2d(++_0x45098e);}(_0x6c54,0x1d2));var _0x46c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6c54[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x46c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x46c5('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x46c5('0x2')]},'description':{'type':Sequelize[_0x46c5('0x2')]}}; \ No newline at end of file +var _0xb91c=['STRING','name'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0xb91c,0x140));var _0xcb91=function(_0x381208,_0xb6b22){_0x381208=_0x381208-0x0;var _0x40fdae=_0xb91c[_0x381208];return _0x40fdae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcb91('0x0')],'unique':_0xcb91('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb91('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index be146cd..52f3a0d 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 _0x0129=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x52cd26,_0x3652c6){var _0x329811=function(_0x23123f){while(--_0x23123f){_0x52cd26['push'](_0x52cd26['shift']());}};_0x329811(++_0x3652c6);}(_0x0129,0x97));var _0x9012=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0129[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9012('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9012('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9012('0x2'));var Mustache=require(_0x9012('0x3'));var util=require('util');var path=require(_0x9012('0x4'));var sox=require(_0x9012('0x5'));var csv=require(_0x9012('0x6'));var ejs=require(_0x9012('0x7'));var fs=require('fs');var fs_extra=require(_0x9012('0x8'));var _=require(_0x9012('0x9'));var squel=require(_0x9012('0xa'));var crypto=require('crypto');var jsforce=require(_0x9012('0xb'));var deskjs=require(_0x9012('0xc'));var toCsv=require(_0x9012('0x6'));var querystring=require(_0x9012('0xd'));var Papa=require(_0x9012('0xe'));var Redis=require('ioredis');var authService=require(_0x9012('0xf'));var qs=require(_0x9012('0x10'));var as=require(_0x9012('0x11'));var hardwareService=require(_0x9012('0x12'));var logger=require(_0x9012('0x13'))(_0x9012('0x14'));var utils=require(_0x9012('0x15'));var config=require(_0x9012('0x16'));var licenseUtil=require(_0x9012('0x17'));var db=require(_0x9012('0x18'))['db'];function respondWithStatusCode(_0x25da7d,_0x4a6b31){_0x4a6b31=_0x4a6b31||0xcc;return function(_0x421740){if(_0x421740){return _0x25da7d[_0x9012('0x19')](_0x4a6b31);}return _0x25da7d[_0x9012('0x1a')](_0x4a6b31)[_0x9012('0x1b')]();};}function respondWithResult(_0x2dceb8,_0x5f1fd5){_0x5f1fd5=_0x5f1fd5||0xc8;return function(_0x1621e8){if(_0x1621e8){return _0x2dceb8[_0x9012('0x1a')](_0x5f1fd5)[_0x9012('0x1c')](_0x1621e8);}};}function respondWithFilteredResult(_0x3c8ff7,_0x3de1a1){return function(_0x50520a){if(_0x50520a){var _0x3342b0=typeof _0x3de1a1[_0x9012('0x1d')]===_0x9012('0x1e')&&typeof _0x3de1a1[_0x9012('0x1f')]===_0x9012('0x1e');var _0x1ed1ce=_0x50520a[_0x9012('0x20')];var _0x16292b=_0x3342b0?0x0:_0x3de1a1[_0x9012('0x1d')];var _0x50cdfb=_0x3342b0?_0x50520a['count']:_0x3de1a1['offset']+_0x3de1a1['limit'];var _0xdb7b56;if(_0x50cdfb>=_0x1ed1ce){_0x50cdfb=_0x1ed1ce;_0xdb7b56=0xc8;}else{_0xdb7b56=0xce;}_0x3c8ff7['status'](_0xdb7b56);return _0x3c8ff7[_0x9012('0x21')]('Content-Range',_0x16292b+'-'+_0x50cdfb+'/'+_0x1ed1ce)['json'](_0x50520a);}return null;};}function patchUpdates(_0x2a68a){return function(_0x3fc223){try{jsonpatch[_0x9012('0x22')](_0x3fc223,_0x2a68a,!![]);}catch(_0x405aa3){return BPromise[_0x9012('0x23')](_0x405aa3);}return _0x3fc223[_0x9012('0x24')]();};}function saveUpdates(_0x2b5a97,_0x5f35ae){return function(_0x191a64){if(_0x191a64){return _0x191a64[_0x9012('0x25')](_0x2b5a97)[_0x9012('0x26')](function(_0x303538){return _0x303538;});}return null;};}function removeEntity(_0x4bd797,_0x4dc7ea){return function(_0x4e0aa8){if(_0x4e0aa8){return _0x4e0aa8[_0x9012('0x27')]()[_0x9012('0x26')](function(){var _0x5942a3=_0x4e0aa8[_0x9012('0x28')]({'plain':!![]});var _0x29e301='ODBC';return db['UserProfileResource'][_0x9012('0x27')]({'where':{'type':_0x29e301,'resourceId':_0x5942a3['id']}})[_0x9012('0x26')](function(){return _0x4e0aa8;});})[_0x9012('0x26')](function(){_0x4bd797[_0x9012('0x1a')](0xcc)[_0x9012('0x1b')]();});}};}function handleEntityNotFound(_0x54b104,_0x2ecaa1){return function(_0x263b31){if(!_0x263b31){_0x54b104[_0x9012('0x19')](0x194);}return _0x263b31;};}function handleError(_0x13c8ba,_0x5506e9){_0x5506e9=_0x5506e9||0x1f4;return function(_0x1f927b){logger[_0x9012('0x29')](_0x1f927b[_0x9012('0x2a')]);if(_0x1f927b[_0x9012('0x2b')]){delete _0x1f927b[_0x9012('0x2b')];}_0x13c8ba[_0x9012('0x1a')](_0x5506e9)[_0x9012('0x2c')](_0x1f927b);};}exports['index']=function(_0x3b1f9a,_0x52a906){var _0x40401e={},_0x53c48f={},_0x1edb3e={'count':0x0,'rows':[]};var _0x16fdd0=_['map'](db[_0x9012('0x2d')][_0x9012('0x2e')],function(_0x118b96){return{'name':_0x118b96[_0x9012('0x2f')],'type':_0x118b96[_0x9012('0x30')]['key']};});_0x53c48f[_0x9012('0x31')]=_['map'](_0x16fdd0,_0x9012('0x2b'));_0x53c48f[_0x9012('0x32')]=_['keys'](_0x3b1f9a[_0x9012('0x32')]);_0x53c48f[_0x9012('0x33')]=_['intersection'](_0x53c48f[_0x9012('0x31')],_0x53c48f[_0x9012('0x32')]);_0x40401e[_0x9012('0x34')]=_[_0x9012('0x35')](_0x53c48f[_0x9012('0x31')],qs[_0x9012('0x36')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x36')]));_0x40401e[_0x9012('0x34')]=_0x40401e[_0x9012('0x34')][_0x9012('0x37')]?_0x40401e[_0x9012('0x34')]:_0x53c48f[_0x9012('0x31')];if(!_0x3b1f9a[_0x9012('0x32')][_0x9012('0x38')](_0x9012('0x39'))){_0x40401e[_0x9012('0x1f')]=qs[_0x9012('0x1f')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x1f')]);_0x40401e[_0x9012('0x1d')]=qs[_0x9012('0x1d')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x1d')]);}_0x40401e[_0x9012('0x3a')]=qs[_0x9012('0x3b')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3b')]);_0x40401e['where']=qs[_0x9012('0x33')](_[_0x9012('0x3c')](_0x3b1f9a[_0x9012('0x32')],_0x53c48f[_0x9012('0x33')]),_0x16fdd0);if(_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3d')]){_0x40401e[_0x9012('0x3e')]=_[_0x9012('0x3f')](_0x40401e['where'],{'$or':_[_0x9012('0x40')](_0x16fdd0,function(_0x2aea64){if(_0x2aea64[_0x9012('0x30')]!=='VIRTUAL'){var _0x28201c={};_0x28201c[_0x2aea64[_0x9012('0x2b')]]={'$like':'%'+_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3d')]+'%'};return _0x28201c;}})});}_0x40401e=_[_0x9012('0x3f')]({},_0x40401e,_0x3b1f9a['options']);var _0x551064={'where':_0x40401e[_0x9012('0x3e')]};return db['SquareOdbc'][_0x9012('0x20')](_0x551064)[_0x9012('0x26')](function(_0x191989){_0x1edb3e[_0x9012('0x20')]=_0x191989;if(_0x3b1f9a[_0x9012('0x32')][_0x9012('0x41')]){_0x40401e[_0x9012('0x42')]=[{'all':!![]}];}return db[_0x9012('0x2d')][_0x9012('0x43')](_0x40401e);})[_0x9012('0x26')](function(_0xa1cbd0){_0x1edb3e[_0x9012('0x44')]=_0xa1cbd0;return _0x1edb3e;})[_0x9012('0x26')](respondWithFilteredResult(_0x52a906,_0x40401e))['catch'](handleError(_0x52a906,null));};exports[_0x9012('0x45')]=function(_0x3ac964,_0x16da14){var _0x144d45={'raw':!![],'where':{'id':_0x3ac964['params']['id']}},_0x27367d={};_0x27367d[_0x9012('0x31')]=_[_0x9012('0x46')](db[_0x9012('0x2d')][_0x9012('0x2e')]);_0x27367d[_0x9012('0x32')]=_['keys'](_0x3ac964[_0x9012('0x32')]);_0x27367d[_0x9012('0x33')]=_['intersection'](_0x27367d['model'],_0x27367d['query']);_0x144d45['attributes']=_['intersection'](_0x27367d[_0x9012('0x31')],qs['fields'](_0x3ac964[_0x9012('0x32')]['fields']));_0x144d45['attributes']=_0x144d45[_0x9012('0x34')][_0x9012('0x37')]?_0x144d45[_0x9012('0x34')]:_0x27367d[_0x9012('0x31')];if(_0x3ac964[_0x9012('0x32')]['includeAll']){_0x144d45['include']=[{'all':!![]}];}_0x144d45=_[_0x9012('0x3f')]({},_0x144d45,_0x3ac964[_0x9012('0x47')]);return db['SquareOdbc'][_0x9012('0x48')](_0x144d45)[_0x9012('0x26')](handleEntityNotFound(_0x16da14,null))[_0x9012('0x26')](respondWithResult(_0x16da14,null))[_0x9012('0x49')](handleError(_0x16da14,null));};exports[_0x9012('0x4a')]=function(_0x25cc92,_0x217e2a){return db[_0x9012('0x2d')][_0x9012('0x4a')](_0x25cc92[_0x9012('0x4b')],{})['then'](function(_0x21bd7b){var _0x3e26c7=_0x25cc92[_0x9012('0x4c')]['get']({'plain':!![]});if(!_0x3e26c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e26c7[_0x9012('0x4d')]==='user'){var _0x3d7a72=_0x21bd7b[_0x9012('0x28')]({'plain':!![]});var _0xac028=_0x9012('0x4e');return db[_0x9012('0x4f')][_0x9012('0x48')]({'where':{'name':_0xac028,'userProfileId':_0x3e26c7[_0x9012('0x50')]},'raw':!![]})[_0x9012('0x26')](function(_0x103205){if(_0x103205&&_0x103205[_0x9012('0x51')]===0x0){return db[_0x9012('0x52')][_0x9012('0x4a')]({'name':_0x3d7a72['name'],'resourceId':_0x3d7a72['id'],'type':_0x103205[_0x9012('0x2b')],'sectionId':_0x103205['id']},{})['then'](function(){return _0x21bd7b;});}else{return _0x21bd7b;}})['catch'](function(_0x584572){logger[_0x9012('0x29')](_0x9012('0x53'),_0x584572);throw _0x584572;});}return _0x21bd7b;})['then'](respondWithResult(_0x217e2a,0xc9))[_0x9012('0x49')](handleError(_0x217e2a,null));};exports[_0x9012('0x25')]=function(_0x2898b6,_0x4352e4){if(_0x2898b6['body']['id']){delete _0x2898b6[_0x9012('0x4b')]['id'];}return db['SquareOdbc'][_0x9012('0x48')]({'where':{'id':_0x2898b6[_0x9012('0x54')]['id']}})['then'](handleEntityNotFound(_0x4352e4,null))[_0x9012('0x26')](saveUpdates(_0x2898b6[_0x9012('0x4b')],null))[_0x9012('0x26')](respondWithResult(_0x4352e4,null))[_0x9012('0x49')](handleError(_0x4352e4,null));};exports[_0x9012('0x27')]=function(_0x4901f7,_0xe21a73){return db[_0x9012('0x2d')][_0x9012('0x48')]({'where':{'id':_0x4901f7['params']['id']}})['then'](handleEntityNotFound(_0xe21a73,null))[_0x9012('0x26')](removeEntity(_0xe21a73,null))['catch'](handleError(_0xe21a73,null));};exports['test']=function(_0x131a5e,_0x5b43af,_0x27791c){var _0x2afc8f;return db['SquareOdbc'][_0x9012('0x48')]({'where':{'id':_0x131a5e[_0x9012('0x54')]['id']},'attributes':['id',_0x9012('0x55')]})[_0x9012('0x26')](handleEntityNotFound(_0x5b43af,null))['then'](function(_0x1f7852){if(_0x1f7852){var _0x4fd0d8=require(_0x9012('0x56'))();_0x4fd0d8[_0x9012('0x57')](_0x1f7852[_0x9012('0x55')]);_0x4fd0d8[_0x9012('0x58')]();return _0x1f7852;}})['then'](respondWithResult(_0x5b43af,null))['catch'](handleError(_0x5b43af,null));}; \ No newline at end of file +var _0x74b0=['pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where'];(function(_0xed3592,_0x386639){var _0x466c99=function(_0x594259){while(--_0x594259){_0xed3592['push'](_0xed3592['shift']());}};_0x466c99(++_0x386639);}(_0x74b0,0x126));var _0x074b=function(_0x259d11,_0x222597){_0x259d11=_0x259d11-0x0;var _0x34f70c=_0x74b0[_0x259d11];return _0x34f70c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074b('0x0'));var zipdir=require(_0x074b('0x1'));var jsonpatch=require(_0x074b('0x2'));var rp=require(_0x074b('0x3'));var moment=require(_0x074b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x074b('0x5'));var util=require(_0x074b('0x6'));var path=require(_0x074b('0x7'));var sox=require(_0x074b('0x8'));var csv=require(_0x074b('0x9'));var ejs=require(_0x074b('0xa'));var fs=require('fs');var fs_extra=require(_0x074b('0xb'));var _=require('lodash');var squel=require(_0x074b('0xc'));var crypto=require(_0x074b('0xd'));var jsforce=require(_0x074b('0xe'));var deskjs=require(_0x074b('0xf'));var toCsv=require(_0x074b('0x9'));var querystring=require(_0x074b('0x10'));var Papa=require('papaparse');var Redis=require(_0x074b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x074b('0x12'));var as=require(_0x074b('0x13'));var hardwareService=require(_0x074b('0x14'));var logger=require(_0x074b('0x15'))(_0x074b('0x16'));var utils=require('../../config/utils');var config=require(_0x074b('0x17'));var licenseUtil=require(_0x074b('0x18'));var db=require(_0x074b('0x19'))['db'];function respondWithStatusCode(_0x5334e5,_0x2d3af2){_0x2d3af2=_0x2d3af2||0xcc;return function(_0x4909c9){if(_0x4909c9){return _0x5334e5[_0x074b('0x1a')](_0x2d3af2);}return _0x5334e5[_0x074b('0x1b')](_0x2d3af2)[_0x074b('0x1c')]();};}function respondWithResult(_0x14e273,_0x21dd39){_0x21dd39=_0x21dd39||0xc8;return function(_0x50afcf){if(_0x50afcf){return _0x14e273['status'](_0x21dd39)[_0x074b('0x1d')](_0x50afcf);}};}function respondWithFilteredResult(_0xec0a4f,_0x6ea7f7){return function(_0x23d99b){if(_0x23d99b){var _0x101d1f=typeof _0x6ea7f7[_0x074b('0x1e')]===_0x074b('0x1f')&&typeof _0x6ea7f7[_0x074b('0x20')]===_0x074b('0x1f');var _0x3df48e=_0x23d99b['count'];var _0x4556e9=_0x101d1f?0x0:_0x6ea7f7[_0x074b('0x1e')];var _0x3bb6d0=_0x101d1f?_0x23d99b[_0x074b('0x21')]:_0x6ea7f7[_0x074b('0x1e')]+_0x6ea7f7[_0x074b('0x20')];var _0x54805d;if(_0x3bb6d0>=_0x3df48e){_0x3bb6d0=_0x3df48e;_0x54805d=0xc8;}else{_0x54805d=0xce;}_0xec0a4f[_0x074b('0x1b')](_0x54805d);return _0xec0a4f[_0x074b('0x22')](_0x074b('0x23'),_0x4556e9+'-'+_0x3bb6d0+'/'+_0x3df48e)[_0x074b('0x1d')](_0x23d99b);}return null;};}function patchUpdates(_0x451cb8){return function(_0x3acc5b){try{jsonpatch[_0x074b('0x24')](_0x3acc5b,_0x451cb8,!![]);}catch(_0xea6319){return BPromise[_0x074b('0x25')](_0xea6319);}return _0x3acc5b[_0x074b('0x26')]();};}function saveUpdates(_0x32286b,_0x41167a){return function(_0x30e36d){if(_0x30e36d){return _0x30e36d['update'](_0x32286b)['then'](function(_0x2549e2){return _0x2549e2;});}return null;};}function removeEntity(_0x3be39d,_0xeaa2b){return function(_0x50cd64){if(_0x50cd64){return _0x50cd64['destroy']()[_0x074b('0x27')](function(){var _0x118863=_0x50cd64[_0x074b('0x28')]({'plain':!![]});var _0x57ad75=_0x074b('0x29');return db[_0x074b('0x2a')][_0x074b('0x2b')]({'where':{'type':_0x57ad75,'resourceId':_0x118863['id']}})[_0x074b('0x27')](function(){return _0x50cd64;});})[_0x074b('0x27')](function(){_0x3be39d[_0x074b('0x1b')](0xcc)[_0x074b('0x1c')]();});}};}function handleEntityNotFound(_0x486895,_0x2d30b0){return function(_0x2e5214){if(!_0x2e5214){_0x486895[_0x074b('0x1a')](0x194);}return _0x2e5214;};}function handleError(_0x4fee8a,_0x5e3620){_0x5e3620=_0x5e3620||0x1f4;return function(_0x1f0e9a){logger[_0x074b('0x2c')](_0x1f0e9a[_0x074b('0x2d')]);if(_0x1f0e9a[_0x074b('0x2e')]){delete _0x1f0e9a[_0x074b('0x2e')];}_0x4fee8a[_0x074b('0x1b')](_0x5e3620)[_0x074b('0x2f')](_0x1f0e9a);};}exports[_0x074b('0x30')]=function(_0x459583,_0x1987c1){var _0x559119={},_0x5537de={},_0x330e2a={'count':0x0,'rows':[]};var _0x1554ea=_[_0x074b('0x31')](db[_0x074b('0x32')][_0x074b('0x33')],function(_0x3d6046){return{'name':_0x3d6046[_0x074b('0x34')],'type':_0x3d6046[_0x074b('0x35')]['key']};});_0x5537de[_0x074b('0x36')]=_[_0x074b('0x31')](_0x1554ea,_0x074b('0x2e'));_0x5537de[_0x074b('0x37')]=_[_0x074b('0x38')](_0x459583[_0x074b('0x37')]);_0x5537de[_0x074b('0x39')]=_[_0x074b('0x3a')](_0x5537de['model'],_0x5537de[_0x074b('0x37')]);_0x559119[_0x074b('0x3b')]=_['intersection'](_0x5537de['model'],qs[_0x074b('0x3c')](_0x459583['query'][_0x074b('0x3c')]));_0x559119[_0x074b('0x3b')]=_0x559119[_0x074b('0x3b')][_0x074b('0x3d')]?_0x559119['attributes']:_0x5537de[_0x074b('0x36')];if(!_0x459583['query'][_0x074b('0x3e')](_0x074b('0x3f'))){_0x559119['limit']=qs[_0x074b('0x20')](_0x459583[_0x074b('0x37')][_0x074b('0x20')]);_0x559119['offset']=qs[_0x074b('0x1e')](_0x459583['query'][_0x074b('0x1e')]);}_0x559119[_0x074b('0x40')]=qs['sort'](_0x459583[_0x074b('0x37')]['sort']);_0x559119[_0x074b('0x41')]=qs['filters'](_[_0x074b('0x42')](_0x459583[_0x074b('0x37')],_0x5537de[_0x074b('0x39')]),_0x1554ea);if(_0x459583[_0x074b('0x37')]['filter']){_0x559119['where']=_['merge'](_0x559119[_0x074b('0x41')],{'$or':_['map'](_0x1554ea,function(_0x1a0bd9){if(_0x1a0bd9[_0x074b('0x35')]!==_0x074b('0x43')){var _0x5bf8d0={};_0x5bf8d0[_0x1a0bd9[_0x074b('0x2e')]]={'$like':'%'+_0x459583[_0x074b('0x37')]['filter']+'%'};return _0x5bf8d0;}})});}_0x559119=_[_0x074b('0x44')]({},_0x559119,_0x459583[_0x074b('0x45')]);var _0x386544={'where':_0x559119[_0x074b('0x41')]};return db[_0x074b('0x32')][_0x074b('0x21')](_0x386544)[_0x074b('0x27')](function(_0x511870){_0x330e2a['count']=_0x511870;if(_0x459583[_0x074b('0x37')][_0x074b('0x46')]){_0x559119['include']=[{'all':!![]}];}return db[_0x074b('0x32')][_0x074b('0x47')](_0x559119);})[_0x074b('0x27')](function(_0x4c4bcb){_0x330e2a[_0x074b('0x48')]=_0x4c4bcb;return _0x330e2a;})[_0x074b('0x27')](respondWithFilteredResult(_0x1987c1,_0x559119))[_0x074b('0x49')](handleError(_0x1987c1,null));};exports['show']=function(_0x2236c5,_0x121498){var _0x562931={'raw':!![],'where':{'id':_0x2236c5[_0x074b('0x4a')]['id']}},_0x5227e3={};_0x5227e3[_0x074b('0x36')]=_[_0x074b('0x38')](db[_0x074b('0x32')][_0x074b('0x33')]);_0x5227e3[_0x074b('0x37')]=_['keys'](_0x2236c5[_0x074b('0x37')]);_0x5227e3[_0x074b('0x39')]=_['intersection'](_0x5227e3[_0x074b('0x36')],_0x5227e3[_0x074b('0x37')]);_0x562931['attributes']=_[_0x074b('0x3a')](_0x5227e3['model'],qs[_0x074b('0x3c')](_0x2236c5[_0x074b('0x37')][_0x074b('0x3c')]));_0x562931[_0x074b('0x3b')]=_0x562931[_0x074b('0x3b')][_0x074b('0x3d')]?_0x562931['attributes']:_0x5227e3[_0x074b('0x36')];if(_0x2236c5[_0x074b('0x37')][_0x074b('0x46')]){_0x562931['include']=[{'all':!![]}];}_0x562931=_[_0x074b('0x44')]({},_0x562931,_0x2236c5[_0x074b('0x45')]);return db[_0x074b('0x32')][_0x074b('0x4b')](_0x562931)[_0x074b('0x27')](handleEntityNotFound(_0x121498,null))['then'](respondWithResult(_0x121498,null))['catch'](handleError(_0x121498,null));};exports[_0x074b('0x4c')]=function(_0x5e0124,_0x27a840){return db['SquareOdbc']['create'](_0x5e0124['body'],{})[_0x074b('0x27')](function(_0x68ee8d){var _0x8c3d9c=_0x5e0124[_0x074b('0x4d')]['get']({'plain':!![]});if(!_0x8c3d9c)throw new Error(_0x074b('0x4e'));if(_0x8c3d9c[_0x074b('0x4f')]===_0x074b('0x4d')){var _0x5c0bcc=_0x68ee8d[_0x074b('0x28')]({'plain':!![]});var _0x927772='ODBC';return db['UserProfileSection'][_0x074b('0x4b')]({'where':{'name':_0x927772,'userProfileId':_0x8c3d9c[_0x074b('0x50')]},'raw':!![]})[_0x074b('0x27')](function(_0x465ea6){if(_0x465ea6&&_0x465ea6[_0x074b('0x51')]===0x0){return db[_0x074b('0x2a')][_0x074b('0x4c')]({'name':_0x5c0bcc[_0x074b('0x2e')],'resourceId':_0x5c0bcc['id'],'type':_0x465ea6[_0x074b('0x2e')],'sectionId':_0x465ea6['id']},{})[_0x074b('0x27')](function(){return _0x68ee8d;});}else{return _0x68ee8d;}})[_0x074b('0x49')](function(_0x256dc8){logger[_0x074b('0x2c')](_0x074b('0x52'),_0x256dc8);throw _0x256dc8;});}return _0x68ee8d;})[_0x074b('0x27')](respondWithResult(_0x27a840,0xc9))[_0x074b('0x49')](handleError(_0x27a840,null));};exports[_0x074b('0x53')]=function(_0x266773,_0x5db21f){if(_0x266773['body']['id']){delete _0x266773[_0x074b('0x54')]['id'];}return db[_0x074b('0x32')]['find']({'where':{'id':_0x266773['params']['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x5db21f,null))[_0x074b('0x27')](saveUpdates(_0x266773[_0x074b('0x54')],null))[_0x074b('0x27')](respondWithResult(_0x5db21f,null))[_0x074b('0x49')](handleError(_0x5db21f,null));};exports[_0x074b('0x2b')]=function(_0x540bdb,_0xa7f940){return db[_0x074b('0x32')][_0x074b('0x4b')]({'where':{'id':_0x540bdb['params']['id']}})[_0x074b('0x27')](handleEntityNotFound(_0xa7f940,null))[_0x074b('0x27')](removeEntity(_0xa7f940,null))['catch'](handleError(_0xa7f940,null));};exports[_0x074b('0x55')]=function(_0x5e6f7d,_0x22e910,_0x1d67cd){var _0x41b9b2;return db[_0x074b('0x32')]['find']({'where':{'id':_0x5e6f7d[_0x074b('0x4a')]['id']},'attributes':['id',_0x074b('0x56')]})[_0x074b('0x27')](handleEntityNotFound(_0x22e910,null))[_0x074b('0x27')](function(_0x56a621){if(_0x56a621){var _0x84e290=require(_0x074b('0x57'))();_0x84e290[_0x074b('0x58')](_0x56a621[_0x074b('0x56')]);_0x84e290[_0x074b('0x59')]();return _0x56a621;}})[_0x074b('0x27')](respondWithResult(_0x22e910,null))[_0x074b('0x49')](handleError(_0x22e910,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7faa24e..1c1fc44 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 _0x0ec4=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ec4,0xe9));var _0x40ec=function(_0x3a47e4,_0x21b1d5){_0x3a47e4=_0x3a47e4-0x0;var _0x2486f9=_0x0ec4[_0x3a47e4];return _0x2486f9;};'use strict';var _=require(_0x40ec('0x0'));var util=require(_0x40ec('0x1'));var logger=require(_0x40ec('0x2'))(_0x40ec('0x3'));var moment=require(_0x40ec('0x4'));var BPromise=require(_0x40ec('0x5'));var rp=require(_0x40ec('0x6'));var fs=require('fs');var path=require(_0x40ec('0x7'));var rimraf=require(_0x40ec('0x8'));var config=require(_0x40ec('0x9'));var attributes=require(_0x40ec('0xa'));module['exports']=function(_0x501e0f,_0x1cd8c3){return _0x501e0f[_0x40ec('0xb')](_0x40ec('0xc'),attributes,{'tableName':_0x40ec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf5f=['request-promise','rimraf','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api','moment','bluebird'];(function(_0x513dfe,_0x5b2a8e){var _0x3f01a9=function(_0x287163){while(--_0x287163){_0x513dfe['push'](_0x513dfe['shift']());}};_0x3f01a9(++_0x5b2a8e);}(_0xbf5f,0x145));var _0xfbf5=function(_0x429013,_0x11f74e){_0x429013=_0x429013-0x0;var _0x551ba2=_0xbf5f[_0x429013];return _0x551ba2;};'use strict';var _=require(_0xfbf5('0x0'));var util=require(_0xfbf5('0x1'));var logger=require('../../config/logger')(_0xfbf5('0x2'));var moment=require(_0xfbf5('0x3'));var BPromise=require(_0xfbf5('0x4'));var rp=require(_0xfbf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbf5('0x6'));var config=require('../../config/environment');var attributes=require(_0xfbf5('0x7'));module[_0xfbf5('0x8')]=function(_0x3502e8,_0x5738d7){return _0x3502e8[_0xfbf5('0x9')]('SquareOdbc',attributes,{'tableName':_0xfbf5('0xa'),'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 0dc22b0..b4d9ef5 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 _0xd086=['then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd086,0x98));var _0x6d08=function(_0x5d480a,_0x3943b7){_0x5d480a=_0x5d480a-0x0;var _0x56a943=_0xd086[_0x5d480a];return _0x56a943;};'use strict';var _=require(_0x6d08('0x0'));var util=require(_0x6d08('0x1'));var moment=require(_0x6d08('0x2'));var BPromise=require(_0x6d08('0x3'));var rs=require(_0x6d08('0x4'));var fs=require('fs');var Redis=require(_0x6d08('0x5'));var db=require(_0x6d08('0x6'))['db'];var utils=require(_0x6d08('0x7'));var logger=require(_0x6d08('0x8'))(_0x6d08('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d08('0xa'));var client=jayson[_0x6d08('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512cec,_0x49284d,_0x5e20b4){return new BPromise(function(_0x312537,_0xc9222c){return client[_0x6d08('0xc')](_0x512cec,_0x5e20b4)[_0x6d08('0xd')](function(_0xa63e38){logger['info'](_0x6d08('0xe'),_0x49284d,_0x6d08('0xf'));logger[_0x6d08('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x49284d,_0x6d08('0xf'),JSON[_0x6d08('0x11')](_0xa63e38));if(_0xa63e38[_0x6d08('0x12')]){if(_0xa63e38['error'][_0x6d08('0x13')]===0x1f4){logger[_0x6d08('0x12')](_0x6d08('0xe'),_0x49284d,_0xa63e38[_0x6d08('0x12')]['message']);return _0xc9222c(_0xa63e38[_0x6d08('0x12')][_0x6d08('0x14')]);}logger[_0x6d08('0x12')](_0x6d08('0xe'),_0x49284d,_0xa63e38[_0x6d08('0x12')]['message']);return _0x312537(_0xa63e38['error']['message']);}else{logger[_0x6d08('0x15')](_0x6d08('0xe'),_0x49284d,'request\x20sent');_0x312537(_0xa63e38[_0x6d08('0x16')][_0x6d08('0x14')]);}})[_0x6d08('0x17')](function(_0x391696){logger['error'](_0x6d08('0xe'),_0x49284d,_0x391696);_0xc9222c(_0x391696);});});}exports[_0x6d08('0x18')]=function(_0x334130){var _0x76e8f2=this;return new Promise(function(_0x2a5817,_0x1e504a){return db['SquareOdbc'][_0x6d08('0x19')]({'raw':_0x334130[_0x6d08('0x1a')]?_0x334130['options'][_0x6d08('0x1b')]===undefined?!![]:![]:!![],'where':_0x334130[_0x6d08('0x1a')]?_0x334130[_0x6d08('0x1a')][_0x6d08('0x1c')]||null:null,'attributes':_0x334130['options']?_0x334130['options'][_0x6d08('0x1d')]||null:null,'include':_0x334130['options']?_0x334130[_0x6d08('0x1a')][_0x6d08('0x1e')]?_[_0x6d08('0x1f')](_0x334130[_0x6d08('0x1a')][_0x6d08('0x1e')],function(_0x2817b2){return{'model':db[_0x2817b2[_0x6d08('0x20')]],'as':_0x2817b2['as'],'attributes':_0x2817b2[_0x6d08('0x1d')],'include':_0x2817b2['include']?_[_0x6d08('0x1f')](_0x2817b2[_0x6d08('0x1e')],function(_0x148d91){return{'model':db[_0x148d91[_0x6d08('0x20')]],'as':_0x148d91['as'],'attributes':_0x148d91[_0x6d08('0x1d')],'include':_0x148d91[_0x6d08('0x1e')]?_[_0x6d08('0x1f')](_0x148d91[_0x6d08('0x1e')],function(_0x110434){return{'model':db[_0x110434[_0x6d08('0x20')]],'as':_0x110434['as'],'attributes':_0x110434['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d08('0xd')](function(_0x23b379){logger[_0x6d08('0x15')]('ShowSquareOdbc',_0x334130);logger[_0x6d08('0x10')](_0x6d08('0x18'),_0x334130,JSON[_0x6d08('0x11')](_0x23b379));_0x2a5817(_0x23b379);})['catch'](function(_0x497bcc){logger[_0x6d08('0x12')]('ShowSquareOdbc',_0x497bcc['message'],_0x334130);_0x1e504a(_0x76e8f2[_0x6d08('0x12')](0x1f4,_0x497bcc['message']));});});}; \ No newline at end of file +var _0x0229=['message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','map','model','include','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x581059,_0x379b9){var _0x1423d2=function(_0x4bc119){while(--_0x4bc119){_0x581059['push'](_0x581059['shift']());}};_0x1423d2(++_0x379b9);}(_0x0229,0x141));var _0x9022=function(_0xc9eddf,_0x1cae92){_0xc9eddf=_0xc9eddf-0x0;var _0x2950ee=_0x0229[_0xc9eddf];return _0x2950ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9022('0x0'));var BPromise=require('bluebird');var rs=require(_0x9022('0x1'));var fs=require('fs');var Redis=require(_0x9022('0x2'));var db=require(_0x9022('0x3'))['db'];var utils=require(_0x9022('0x4'));var logger=require(_0x9022('0x5'))(_0x9022('0x6'));var config=require(_0x9022('0x7'));var jayson=require(_0x9022('0x8'));var client=jayson[_0x9022('0x9')][_0x9022('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x69f22d,_0x2096b5,_0x287ad9){return new BPromise(function(_0x110a4c,_0x197ad9){return client[_0x9022('0xb')](_0x69f22d,_0x287ad9)[_0x9022('0xc')](function(_0x3f8f24){logger[_0x9022('0xd')](_0x9022('0xe'),_0x2096b5,_0x9022('0xf'));logger[_0x9022('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2096b5,_0x9022('0xf'),JSON[_0x9022('0x11')](_0x3f8f24));if(_0x3f8f24[_0x9022('0x12')]){if(_0x3f8f24[_0x9022('0x12')][_0x9022('0x13')]===0x1f4){logger['error'](_0x9022('0xe'),_0x2096b5,_0x3f8f24[_0x9022('0x12')][_0x9022('0x14')]);return _0x197ad9(_0x3f8f24[_0x9022('0x12')][_0x9022('0x14')]);}logger['error'](_0x9022('0xe'),_0x2096b5,_0x3f8f24[_0x9022('0x12')][_0x9022('0x14')]);return _0x110a4c(_0x3f8f24['error'][_0x9022('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x2096b5,_0x9022('0xf'));_0x110a4c(_0x3f8f24[_0x9022('0x15')][_0x9022('0x14')]);}})[_0x9022('0x16')](function(_0xfc6e05){logger[_0x9022('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x2096b5,_0xfc6e05);_0x197ad9(_0xfc6e05);});});}exports[_0x9022('0x17')]=function(_0x1b7483){var _0x4a4d75=this;return new Promise(function(_0x19a895,_0x28cc51){return db[_0x9022('0x18')]['find']({'raw':_0x1b7483[_0x9022('0x19')]?_0x1b7483[_0x9022('0x19')][_0x9022('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b7483[_0x9022('0x19')]?_0x1b7483[_0x9022('0x19')]['where']||null:null,'attributes':_0x1b7483[_0x9022('0x19')]?_0x1b7483['options'][_0x9022('0x1b')]||null:null,'include':_0x1b7483[_0x9022('0x19')]?_0x1b7483[_0x9022('0x19')]['include']?_[_0x9022('0x1c')](_0x1b7483['options']['include'],function(_0x3dc1d1){return{'model':db[_0x3dc1d1[_0x9022('0x1d')]],'as':_0x3dc1d1['as'],'attributes':_0x3dc1d1[_0x9022('0x1b')],'include':_0x3dc1d1[_0x9022('0x1e')]?_[_0x9022('0x1c')](_0x3dc1d1[_0x9022('0x1e')],function(_0x5675df){return{'model':db[_0x5675df[_0x9022('0x1d')]],'as':_0x5675df['as'],'attributes':_0x5675df[_0x9022('0x1b')],'include':_0x5675df[_0x9022('0x1e')]?_['map'](_0x5675df['include'],function(_0x859233){return{'model':db[_0x859233[_0x9022('0x1d')]],'as':_0x859233['as'],'attributes':_0x859233['attributes']};}):[]};}):[]};}):[]:[]})[_0x9022('0xc')](function(_0x1a75b6){logger[_0x9022('0xd')]('ShowSquareOdbc',_0x1b7483);logger[_0x9022('0x10')](_0x9022('0x17'),_0x1b7483,JSON[_0x9022('0x11')](_0x1a75b6));_0x19a895(_0x1a75b6);})['catch'](function(_0x574b30){logger[_0x9022('0x12')]('ShowSquareOdbc',_0x574b30[_0x9022('0x14')],_0x1b7483);_0x28cc51(_0x4a4d75[_0x9022('0x12')](0x1f4,_0x574b30[_0x9022('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3d0efa6..9185a9f 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 _0x8402=['../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x405056,_0x186a8c){var _0x576c59=function(_0x1c6fd4){while(--_0x1c6fd4){_0x405056['push'](_0x405056['shift']());}};_0x576c59(++_0x186a8c);}(_0x8402,0xf9));var _0x2840=function(_0x20a861,_0x61c48d){_0x20a861=_0x20a861-0x0;var _0xa93d1c=_0x8402[_0x20a861];return _0xa93d1c;};'use strict';var multer=require(_0x2840('0x0'));var util=require(_0x2840('0x1'));var path=require(_0x2840('0x2'));var timeout=require('connect-timeout');var express=require(_0x2840('0x3'));var router=express[_0x2840('0x4')]();var fs_extra=require(_0x2840('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2840('0x6'));var config=require('../../config/environment');var controller=require(_0x2840('0x7'));router[_0x2840('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2840('0x8')](_0x2840('0x9'),auth[_0x2840('0xa')](),controller[_0x2840('0xb')]);router[_0x2840('0xc')]('/',auth[_0x2840('0xa')](),controller[_0x2840('0xd')]);router[_0x2840('0xe')](_0x2840('0x9'),auth[_0x2840('0xa')](),controller['update']);router[_0x2840('0xf')](_0x2840('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2840('0x10')]=router; \ No newline at end of file +var _0xd7db=['show','create','put','/:id','update','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x451a3a,_0x36947e){var _0x545b8d=function(_0x42b4fb){while(--_0x42b4fb){_0x451a3a['push'](_0x451a3a['shift']());}};_0x545b8d(++_0x36947e);}(_0xd7db,0x17b));var _0xbd7d=function(_0x4d7f9c,_0x40fda5){_0x4d7f9c=_0x4d7f9c-0x0;var _0x59970a=_0xd7db[_0x4d7f9c];return _0x59970a;};'use strict';var multer=require(_0xbd7d('0x0'));var util=require('util');var path=require(_0xbd7d('0x1'));var timeout=require(_0xbd7d('0x2'));var express=require(_0xbd7d('0x3'));var router=express['Router']();var fs_extra=require(_0xbd7d('0x4'));var auth=require(_0xbd7d('0x5'));var interaction=require(_0xbd7d('0x6'));var config=require(_0xbd7d('0x7'));var controller=require(_0xbd7d('0x8'));router[_0xbd7d('0x9')]('/',auth[_0xbd7d('0xa')](),controller[_0xbd7d('0xb')]);router[_0xbd7d('0x9')]('/:id',auth[_0xbd7d('0xa')](),controller[_0xbd7d('0xc')]);router['post']('/',auth[_0xbd7d('0xa')](),controller[_0xbd7d('0xd')]);router[_0xbd7d('0xe')](_0xbd7d('0xf'),auth['isAuthenticated'](),controller[_0xbd7d('0x10')]);router['delete'](_0xbd7d('0xf'),auth[_0xbd7d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9d682c9..fe26db2 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 _0x813b=['preproduction','toString','long','production','utf8','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x813b,0x126));var _0xb813=function(_0x5ce916,_0x10f92c){_0x5ce916=_0x5ce916-0x0;var _0x19c16e=_0x813b[_0x5ce916];return _0x19c16e;};'use strict';var Sequelize=require(_0xb813('0x0'));module['exports']={'name':{'type':Sequelize[_0xb813('0x1')],'unique':_0xb813('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb813('0x1')]},'notes':{'type':Sequelize[_0xb813('0x3')]},'preproduction':{'type':Sequelize[_0xb813('0x4')]('long'),'get':function(){if(this[_0xb813('0x5')](_0xb813('0x6'))){return this[_0xb813('0x5')](_0xb813('0x6'))[_0xb813('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb813('0x4')](_0xb813('0x8')),'get':function(){if(this[_0xb813('0x5')]('production')){return this[_0xb813('0x5')](_0xb813('0x9'))['toString'](_0xb813('0xa'));}}},'savedAt':{'type':Sequelize[_0xb813('0xb')]},'publishedAt':{'type':Sequelize[_0xb813('0xb')]}}; \ No newline at end of file +var _0xc6df=['long','getDataValue','preproduction','toString','utf8','production','DATE','STRING','name','BLOB'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xc6df,0x115));var _0xfc6d=function(_0xa2d19e,_0x5e82d0){_0xa2d19e=_0xa2d19e-0x0;var _0x6994cb=_0xc6df[_0xa2d19e];return _0x6994cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfc6d('0x0')],'unique':_0xfc6d('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xfc6d('0x2')](_0xfc6d('0x3')),'get':function(){if(this[_0xfc6d('0x4')](_0xfc6d('0x5'))){return this[_0xfc6d('0x4')](_0xfc6d('0x5'))[_0xfc6d('0x6')](_0xfc6d('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0xfc6d('0x3')),'get':function(){if(this[_0xfc6d('0x4')](_0xfc6d('0x8'))){return this['getDataValue']('production')[_0xfc6d('0x6')](_0xfc6d('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xfc6d('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1cdb253..a0153f9 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 _0x147d=['options','count','rows','show','params','keys','include','find','catch','body','user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','set','Content-Range','json','update','then','destroy','get','publish','agi','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter'];(function(_0x31a125,_0x139136){var _0x1b1baa=function(_0x5aa7aa){while(--_0x5aa7aa){_0x31a125['push'](_0x31a125['shift']());}};_0x1b1baa(++_0x139136);}(_0x147d,0xe9));var _0xd147=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x147d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0xd147('0x0'));var qs=require(_0xd147('0x1'));var logger=require(_0xd147('0x2'))(_0xd147('0x3'));var config=require(_0xd147('0x4'));var db=require(_0xd147('0x5'))['db'];config[_0xd147('0x6')]=_[_0xd147('0x7')](config[_0xd147('0x6')],{'host':_0xd147('0x8'),'port':0x18eb});var socket=require(_0xd147('0x9'))(new Redis(config[_0xd147('0x6')]));require(_0xd147('0xa'))[_0xd147('0xb')](socket);function respondWithResult(_0x334adc,_0x2c9669){_0x2c9669=_0x2c9669||0xc8;return function(_0x5b1b4f){if(_0x5b1b4f){return _0x334adc[_0xd147('0xc')](_0x2c9669)['json'](_0x5b1b4f);}};}function respondWithFilteredResult(_0x51400d,_0x534700){return function(_0x878ca0){if(_0x878ca0){var _0x699a6d=typeof _0x534700[_0xd147('0xd')]==='undefined'&&typeof _0x534700[_0xd147('0xe')]===_0xd147('0xf');var _0x132073=_0x878ca0['count'];var _0x189dc9=_0x699a6d?0x0:_0x534700[_0xd147('0xd')];var _0x4df449=_0x699a6d?_0x878ca0['count']:_0x534700['offset']+_0x534700[_0xd147('0xe')];var _0x451ba3;if(_0x4df449>=_0x132073){_0x4df449=_0x132073;_0x451ba3=0xc8;}else{_0x451ba3=0xce;}_0x51400d[_0xd147('0xc')](_0x451ba3);return _0x51400d[_0xd147('0x10')](_0xd147('0x11'),_0x189dc9+'-'+_0x4df449+'/'+_0x132073)[_0xd147('0x12')](_0x878ca0);}return null;};}function saveUpdates(_0x3d133b){return function(_0x274f6d){if(_0x274f6d){return _0x274f6d[_0xd147('0x13')](_0x3d133b)[_0xd147('0x14')](function(_0x3284fd){return _0x3284fd;});}return null;};}function removeEntity(_0x48b7ef){return function(_0x3ee7bb){if(_0x3ee7bb){return _0x3ee7bb[_0xd147('0x15')]()[_0xd147('0x14')](function(){var _0x47ba99=_0x3ee7bb[_0xd147('0x16')]({'plain':!![]});var _0x41ad8f='SquareProjects';return db['UserProfileResource'][_0xd147('0x15')]({'where':{'type':_0x41ad8f,'resourceId':_0x47ba99['id']}})[_0xd147('0x14')](function(){return _0x3ee7bb;});})[_0xd147('0x14')](function(){var _0x5dc83f=new Redis(config[_0xd147('0x6')]);_0x5dc83f[_0xd147('0x17')](_0xd147('0x18'),JSON['stringify']({'id':_0x3ee7bb['id'],'deleted':!![]}));})['then'](function(){_0x48b7ef[_0xd147('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587429){return function(_0x56587b){if(!_0x56587b){_0x587429['sendStatus'](0x194);}return _0x56587b;};}function handleError(_0x41e033,_0x394c84){_0x394c84=_0x394c84||0x1f4;return function(_0x3eb826){logger[_0xd147('0x19')](_0x3eb826[_0xd147('0x1a')]);if(_0x3eb826[_0xd147('0x1b')]){delete _0x3eb826[_0xd147('0x1b')];}_0x41e033[_0xd147('0xc')](_0x394c84)[_0xd147('0x1c')](_0x3eb826);};}exports[_0xd147('0x1d')]=function(_0x554fa5,_0x5e3567){var _0x564cf7={},_0x35d509={},_0x385bff={'count':0x0,'rows':[]};var _0xd4cb53=_[_0xd147('0x1e')](db[_0xd147('0x1f')][_0xd147('0x20')],function(_0x3b9b12){return{'name':_0x3b9b12[_0xd147('0x21')],'type':_0x3b9b12[_0xd147('0x22')][_0xd147('0x23')]};});_0x35d509['model']=_[_0xd147('0x1e')](_0xd4cb53,_0xd147('0x1b'));_0x35d509[_0xd147('0x24')]=_['keys'](_0x554fa5['query']);_0x35d509['filters']=_[_0xd147('0x25')](_0x35d509['model'],_0x35d509['query']);_0x564cf7['attributes']=_[_0xd147('0x25')](_0x35d509[_0xd147('0x26')],qs['fields'](_0x554fa5[_0xd147('0x24')][_0xd147('0x27')]));_0x564cf7[_0xd147('0x28')]=_0x564cf7[_0xd147('0x28')][_0xd147('0x29')]?_0x564cf7[_0xd147('0x28')]:_0x35d509[_0xd147('0x26')];if(!_0x554fa5[_0xd147('0x24')]['hasOwnProperty'](_0xd147('0x2a'))){_0x564cf7[_0xd147('0xe')]=qs[_0xd147('0xe')](_0x554fa5[_0xd147('0x24')]['limit']);_0x564cf7[_0xd147('0xd')]=qs[_0xd147('0xd')](_0x554fa5[_0xd147('0x24')][_0xd147('0xd')]);}_0x564cf7[_0xd147('0x2b')]=qs[_0xd147('0x2c')](_0x554fa5[_0xd147('0x24')][_0xd147('0x2c')]);_0x564cf7[_0xd147('0x2d')]=qs[_0xd147('0x2e')](_[_0xd147('0x2f')](_0x554fa5[_0xd147('0x24')],_0x35d509[_0xd147('0x2e')]),_0xd4cb53);if(_0x554fa5['query']['filter']){_0x564cf7[_0xd147('0x2d')]=_[_0xd147('0x30')](_0x564cf7[_0xd147('0x2d')],{'$or':_[_0xd147('0x1e')](_0xd4cb53,function(_0x3cc20e){if(_0x3cc20e[_0xd147('0x22')]!==_0xd147('0x31')){var _0x5eb056={};_0x5eb056[_0x3cc20e[_0xd147('0x1b')]]={'$like':'%'+_0x554fa5[_0xd147('0x24')][_0xd147('0x32')]+'%'};return _0x5eb056;}})});}_0x564cf7=_[_0xd147('0x30')]({},_0x564cf7,_0x554fa5[_0xd147('0x33')]);var _0x4c0bf0={'where':_0x564cf7[_0xd147('0x2d')]};return db[_0xd147('0x1f')][_0xd147('0x34')](_0x4c0bf0)['then'](function(_0x55c3cd){_0x385bff[_0xd147('0x34')]=_0x55c3cd;if(_0x554fa5[_0xd147('0x24')]['includeAll']){_0x564cf7['include']=[{'all':!![]}];}return db[_0xd147('0x1f')]['findAll'](_0x564cf7);})[_0xd147('0x14')](function(_0x5ee0c7){_0x385bff[_0xd147('0x35')]=_0x5ee0c7;return _0x385bff;})['then'](respondWithFilteredResult(_0x5e3567,_0x564cf7))['catch'](handleError(_0x5e3567,null));};exports[_0xd147('0x36')]=function(_0x565cf7,_0x40a793){var _0x3faf46={'raw':![],'where':{'id':_0x565cf7[_0xd147('0x37')]['id']}},_0x4e3ae4={};_0x4e3ae4['model']=_[_0xd147('0x38')](db[_0xd147('0x1f')][_0xd147('0x20')]);_0x4e3ae4[_0xd147('0x24')]=_[_0xd147('0x38')](_0x565cf7[_0xd147('0x24')]);_0x4e3ae4['filters']=_[_0xd147('0x25')](_0x4e3ae4['model'],_0x4e3ae4[_0xd147('0x24')]);_0x3faf46[_0xd147('0x28')]=_['intersection'](_0x4e3ae4[_0xd147('0x26')],qs[_0xd147('0x27')](_0x565cf7['query'][_0xd147('0x27')]));_0x3faf46[_0xd147('0x28')]=_0x3faf46[_0xd147('0x28')][_0xd147('0x29')]?_0x3faf46[_0xd147('0x28')]:_0x4e3ae4[_0xd147('0x26')];if(_0x565cf7[_0xd147('0x24')]['includeAll']){_0x3faf46[_0xd147('0x39')]=[{'all':!![]}];}_0x3faf46=_[_0xd147('0x30')]({},_0x3faf46,_0x565cf7[_0xd147('0x33')]);return db['SquareProject'][_0xd147('0x3a')](_0x3faf46)[_0xd147('0x14')](handleEntityNotFound(_0x40a793,null))[_0xd147('0x14')](respondWithResult(_0x40a793,null))[_0xd147('0x3b')](handleError(_0x40a793,null));};exports['create']=function(_0x444368,_0x3bba60){return db['SquareProject']['create'](_0x444368[_0xd147('0x3c')],{})['then'](function(_0x39055d){var _0x5b7744=_0x444368[_0xd147('0x3d')][_0xd147('0x16')]({'plain':!![]});if(!_0x5b7744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b7744[_0xd147('0x3e')]===_0xd147('0x3d')){var _0x4898fb=_0x39055d[_0xd147('0x16')]({'plain':!![]});var _0x20fe18=_0xd147('0x3f');return db[_0xd147('0x40')][_0xd147('0x3a')]({'where':{'name':_0x20fe18,'userProfileId':_0x5b7744[_0xd147('0x41')]},'raw':!![]})[_0xd147('0x14')](function(_0x491107){if(_0x491107&&_0x491107[_0xd147('0x42')]===0x0){return db[_0xd147('0x43')][_0xd147('0x44')]({'name':_0x4898fb[_0xd147('0x1b')],'resourceId':_0x4898fb['id'],'type':_0x491107[_0xd147('0x1b')],'sectionId':_0x491107['id']},{})[_0xd147('0x14')](function(){return _0x39055d;});}else{return _0x39055d;}})[_0xd147('0x3b')](function(_0xe8655d){logger[_0xd147('0x19')](_0xd147('0x45'),_0xe8655d);throw _0xe8655d;});}return _0x39055d;})['then'](respondWithResult(_0x3bba60,0xc9))[_0xd147('0x3b')](handleError(_0x3bba60,null));};exports[_0xd147('0x13')]=function(_0x502bf3,_0x3afbb5){if(_0x502bf3[_0xd147('0x3c')]['id']){delete _0x502bf3[_0xd147('0x3c')]['id'];}return db[_0xd147('0x1f')][_0xd147('0x3a')]({'where':{'id':_0x502bf3['params']['id']}})['then'](handleEntityNotFound(_0x3afbb5,null))[_0xd147('0x14')](saveUpdates(_0x502bf3['body'],null))[_0xd147('0x14')](function(_0x244488){if(!_0x244488)return;var _0x5f5ddc=_0x244488[_0xd147('0x16')]({'plain':!![]});return _0x5f5ddc;})[_0xd147('0x14')](function(_0x59893b){var _0x46bed3=new Redis(config[_0xd147('0x6')]);_0x46bed3['publish'](_0xd147('0x18'),JSON['stringify'](_[_0xd147('0x2f')](_0x59893b,['id',_0xd147('0x1b'),_0xd147('0x46')])));return _0x59893b;})['then'](respondWithResult(_0x3afbb5,null))[_0xd147('0x3b')](handleError(_0x3afbb5,null));};exports['destroy']=function(_0x23e013,_0x2a0d7d){return db[_0xd147('0x1f')]['find']({'where':{'id':_0x23e013['params']['id']}})[_0xd147('0x14')](handleEntityNotFound(_0x2a0d7d,null))[_0xd147('0x14')](removeEntity(_0x2a0d7d,null))['catch'](handleError(_0x2a0d7d,null));}; \ No newline at end of file +var _0x3c9f=['limit','set','Content-Range','update','then','get','SquareProjects','destroy','publish','agi','stringify','status','end','error','stack','name','send','index','map','SquareProject','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','params','rawAttributes','length','find','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','lodash','ioredis','../../components/parsers/qs','../../config/logger','defaults','redis','./squareProject.socket','register','json','offset','undefined','count'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x3c9f,0x1e4));var _0xf3c9=function(_0x1f85bb,_0x5d2857){_0x1f85bb=_0x1f85bb-0x0;var _0x34fc88=_0x3c9f[_0x1f85bb];return _0x34fc88;};'use strict';var _=require(_0xf3c9('0x0'));var Redis=require(_0xf3c9('0x1'));var qs=require(_0xf3c9('0x2'));var logger=require(_0xf3c9('0x3'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf3c9('0x4')](config[_0xf3c9('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3c9('0x5')]));require(_0xf3c9('0x6'))[_0xf3c9('0x7')](socket);function respondWithResult(_0x48815b,_0x49f0ac){_0x49f0ac=_0x49f0ac||0xc8;return function(_0x28e4de){if(_0x28e4de){return _0x48815b['status'](_0x49f0ac)[_0xf3c9('0x8')](_0x28e4de);}};}function respondWithFilteredResult(_0x4e6841,_0xc9b72a){return function(_0x582eee){if(_0x582eee){var _0x4eced8=typeof _0xc9b72a[_0xf3c9('0x9')]===_0xf3c9('0xa')&&typeof _0xc9b72a['limit']===_0xf3c9('0xa');var _0x38c7aa=_0x582eee[_0xf3c9('0xb')];var _0x5853b1=_0x4eced8?0x0:_0xc9b72a[_0xf3c9('0x9')];var _0x4fb3ed=_0x4eced8?_0x582eee[_0xf3c9('0xb')]:_0xc9b72a[_0xf3c9('0x9')]+_0xc9b72a[_0xf3c9('0xc')];var _0x2f5c5e;if(_0x4fb3ed>=_0x38c7aa){_0x4fb3ed=_0x38c7aa;_0x2f5c5e=0xc8;}else{_0x2f5c5e=0xce;}_0x4e6841['status'](_0x2f5c5e);return _0x4e6841[_0xf3c9('0xd')](_0xf3c9('0xe'),_0x5853b1+'-'+_0x4fb3ed+'/'+_0x38c7aa)[_0xf3c9('0x8')](_0x582eee);}return null;};}function saveUpdates(_0x52fe45){return function(_0xfa738b){if(_0xfa738b){return _0xfa738b[_0xf3c9('0xf')](_0x52fe45)[_0xf3c9('0x10')](function(_0x2cabc3){return _0x2cabc3;});}return null;};}function removeEntity(_0x7be0b8){return function(_0xf9f042){if(_0xf9f042){return _0xf9f042['destroy']()['then'](function(){var _0x1e7437=_0xf9f042[_0xf3c9('0x11')]({'plain':!![]});var _0x4bb22c=_0xf3c9('0x12');return db['UserProfileResource'][_0xf3c9('0x13')]({'where':{'type':_0x4bb22c,'resourceId':_0x1e7437['id']}})['then'](function(){return _0xf9f042;});})[_0xf3c9('0x10')](function(){var _0x135b3d=new Redis(config['redis']);_0x135b3d[_0xf3c9('0x14')](_0xf3c9('0x15'),JSON[_0xf3c9('0x16')]({'id':_0xf9f042['id'],'deleted':!![]}));})[_0xf3c9('0x10')](function(){_0x7be0b8[_0xf3c9('0x17')](0xcc)[_0xf3c9('0x18')]();});}};}function handleEntityNotFound(_0x39cf7e){return function(_0x9fb843){if(!_0x9fb843){_0x39cf7e['sendStatus'](0x194);}return _0x9fb843;};}function handleError(_0x5746c6,_0x557bc8){_0x557bc8=_0x557bc8||0x1f4;return function(_0x4e645b){logger[_0xf3c9('0x19')](_0x4e645b[_0xf3c9('0x1a')]);if(_0x4e645b['name']){delete _0x4e645b[_0xf3c9('0x1b')];}_0x5746c6[_0xf3c9('0x17')](_0x557bc8)[_0xf3c9('0x1c')](_0x4e645b);};}exports[_0xf3c9('0x1d')]=function(_0x4fbc10,_0x1ebe0c){var _0x23b0c9={},_0x439488={},_0x1683dd={'count':0x0,'rows':[]};var _0x573fa9=_[_0xf3c9('0x1e')](db[_0xf3c9('0x1f')]['rawAttributes'],function(_0x45db64){return{'name':_0x45db64['fieldName'],'type':_0x45db64[_0xf3c9('0x20')][_0xf3c9('0x21')]};});_0x439488[_0xf3c9('0x22')]=_[_0xf3c9('0x1e')](_0x573fa9,_0xf3c9('0x1b'));_0x439488[_0xf3c9('0x23')]=_[_0xf3c9('0x24')](_0x4fbc10['query']);_0x439488[_0xf3c9('0x25')]=_[_0xf3c9('0x26')](_0x439488[_0xf3c9('0x22')],_0x439488[_0xf3c9('0x23')]);_0x23b0c9[_0xf3c9('0x27')]=_[_0xf3c9('0x26')](_0x439488['model'],qs['fields'](_0x4fbc10[_0xf3c9('0x23')][_0xf3c9('0x28')]));_0x23b0c9[_0xf3c9('0x27')]=_0x23b0c9[_0xf3c9('0x27')]['length']?_0x23b0c9[_0xf3c9('0x27')]:_0x439488[_0xf3c9('0x22')];if(!_0x4fbc10[_0xf3c9('0x23')][_0xf3c9('0x29')](_0xf3c9('0x2a'))){_0x23b0c9['limit']=qs[_0xf3c9('0xc')](_0x4fbc10['query'][_0xf3c9('0xc')]);_0x23b0c9[_0xf3c9('0x9')]=qs[_0xf3c9('0x9')](_0x4fbc10[_0xf3c9('0x23')][_0xf3c9('0x9')]);}_0x23b0c9[_0xf3c9('0x2b')]=qs[_0xf3c9('0x2c')](_0x4fbc10['query'][_0xf3c9('0x2c')]);_0x23b0c9[_0xf3c9('0x2d')]=qs[_0xf3c9('0x25')](_['pick'](_0x4fbc10[_0xf3c9('0x23')],_0x439488['filters']),_0x573fa9);if(_0x4fbc10[_0xf3c9('0x23')][_0xf3c9('0x2e')]){_0x23b0c9[_0xf3c9('0x2d')]=_[_0xf3c9('0x2f')](_0x23b0c9[_0xf3c9('0x2d')],{'$or':_['map'](_0x573fa9,function(_0x4cd79b){if(_0x4cd79b['type']!==_0xf3c9('0x30')){var _0xeab09c={};_0xeab09c[_0x4cd79b[_0xf3c9('0x1b')]]={'$like':'%'+_0x4fbc10[_0xf3c9('0x23')][_0xf3c9('0x2e')]+'%'};return _0xeab09c;}})});}_0x23b0c9=_[_0xf3c9('0x2f')]({},_0x23b0c9,_0x4fbc10[_0xf3c9('0x31')]);var _0xf24632={'where':_0x23b0c9['where']};return db[_0xf3c9('0x1f')][_0xf3c9('0xb')](_0xf24632)['then'](function(_0x1079d9){_0x1683dd[_0xf3c9('0xb')]=_0x1079d9;if(_0x4fbc10['query'][_0xf3c9('0x32')]){_0x23b0c9['include']=[{'all':!![]}];}return db[_0xf3c9('0x1f')]['findAll'](_0x23b0c9);})[_0xf3c9('0x10')](function(_0xee7f28){_0x1683dd['rows']=_0xee7f28;return _0x1683dd;})[_0xf3c9('0x10')](respondWithFilteredResult(_0x1ebe0c,_0x23b0c9))[_0xf3c9('0x33')](handleError(_0x1ebe0c,null));};exports['show']=function(_0x5b0560,_0x3fad5b){var _0x4ed19c={'raw':![],'where':{'id':_0x5b0560[_0xf3c9('0x34')]['id']}},_0x1f116a={};_0x1f116a['model']=_['keys'](db[_0xf3c9('0x1f')][_0xf3c9('0x35')]);_0x1f116a[_0xf3c9('0x23')]=_['keys'](_0x5b0560[_0xf3c9('0x23')]);_0x1f116a[_0xf3c9('0x25')]=_[_0xf3c9('0x26')](_0x1f116a[_0xf3c9('0x22')],_0x1f116a[_0xf3c9('0x23')]);_0x4ed19c['attributes']=_['intersection'](_0x1f116a[_0xf3c9('0x22')],qs[_0xf3c9('0x28')](_0x5b0560[_0xf3c9('0x23')]['fields']));_0x4ed19c['attributes']=_0x4ed19c[_0xf3c9('0x27')][_0xf3c9('0x36')]?_0x4ed19c[_0xf3c9('0x27')]:_0x1f116a['model'];if(_0x5b0560[_0xf3c9('0x23')][_0xf3c9('0x32')]){_0x4ed19c['include']=[{'all':!![]}];}_0x4ed19c=_[_0xf3c9('0x2f')]({},_0x4ed19c,_0x5b0560['options']);return db[_0xf3c9('0x1f')][_0xf3c9('0x37')](_0x4ed19c)[_0xf3c9('0x10')](handleEntityNotFound(_0x3fad5b,null))[_0xf3c9('0x10')](respondWithResult(_0x3fad5b,null))['catch'](handleError(_0x3fad5b,null));};exports['create']=function(_0x2addd1,_0xf1e747){return db[_0xf3c9('0x1f')]['create'](_0x2addd1[_0xf3c9('0x38')],{})[_0xf3c9('0x10')](function(_0x4f0e96){var _0x481592=_0x2addd1['user'][_0xf3c9('0x11')]({'plain':!![]});if(!_0x481592)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481592[_0xf3c9('0x39')]==='user'){var _0x20f803=_0x4f0e96[_0xf3c9('0x11')]({'plain':!![]});var _0x1cd5a0=_0xf3c9('0x12');return db['UserProfileSection'][_0xf3c9('0x37')]({'where':{'name':_0x1cd5a0,'userProfileId':_0x481592[_0xf3c9('0x3a')]},'raw':!![]})[_0xf3c9('0x10')](function(_0x30ea5e){if(_0x30ea5e&&_0x30ea5e[_0xf3c9('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x20f803['name'],'resourceId':_0x20f803['id'],'type':_0x30ea5e['name'],'sectionId':_0x30ea5e['id']},{})[_0xf3c9('0x10')](function(){return _0x4f0e96;});}else{return _0x4f0e96;}})[_0xf3c9('0x33')](function(_0x510b44){logger[_0xf3c9('0x19')](_0xf3c9('0x3c'),_0x510b44);throw _0x510b44;});}return _0x4f0e96;})[_0xf3c9('0x10')](respondWithResult(_0xf1e747,0xc9))[_0xf3c9('0x33')](handleError(_0xf1e747,null));};exports[_0xf3c9('0xf')]=function(_0x3f73a1,_0x1473ed){if(_0x3f73a1[_0xf3c9('0x38')]['id']){delete _0x3f73a1[_0xf3c9('0x38')]['id'];}return db['SquareProject'][_0xf3c9('0x37')]({'where':{'id':_0x3f73a1[_0xf3c9('0x34')]['id']}})[_0xf3c9('0x10')](handleEntityNotFound(_0x1473ed,null))[_0xf3c9('0x10')](saveUpdates(_0x3f73a1[_0xf3c9('0x38')],null))[_0xf3c9('0x10')](function(_0x3d31d5){if(!_0x3d31d5)return;var _0x14e7a6=_0x3d31d5['get']({'plain':!![]});return _0x14e7a6;})[_0xf3c9('0x10')](function(_0x52f056){var _0x1dab2f=new Redis(config[_0xf3c9('0x5')]);_0x1dab2f[_0xf3c9('0x14')]('agi',JSON[_0xf3c9('0x16')](_[_0xf3c9('0x3d')](_0x52f056,['id',_0xf3c9('0x1b'),'production'])));return _0x52f056;})[_0xf3c9('0x10')](respondWithResult(_0x1473ed,null))['catch'](handleError(_0x1473ed,null));};exports[_0xf3c9('0x13')]=function(_0x430302,_0x2f0c4a){return db[_0xf3c9('0x1f')]['find']({'where':{'id':_0x430302['params']['id']}})[_0xf3c9('0x10')](handleEntityNotFound(_0x2f0c4a,null))[_0xf3c9('0x10')](removeEntity(_0x2f0c4a,null))[_0xf3c9('0x33')](handleError(_0x2f0c4a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5d0493a..d21c128 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 _0x1d3b=['save','remove','emit','hook','events','../../mysqldb'];(function(_0x5f52ab,_0x2a745b){var _0x34f6e0=function(_0x4ebca5){while(--_0x4ebca5){_0x5f52ab['push'](_0x5f52ab['shift']());}};_0x34f6e0(++_0x2a745b);}(_0x1d3b,0xb2));var _0xb1d3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x1d3b[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0xb1d3('0x0'));var SquareProject=require(_0xb1d3('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1d3('0x2'),'afterUpdate':'update','afterDestroy':_0xb1d3('0x3')};function emitEvent(_0x2d7cfc){return function(_0x4add64,_0x55721b,_0x38f745){SquareProjectEvents[_0xb1d3('0x4')](_0x2d7cfc+':'+_0x4add64['id'],_0x4add64);SquareProjectEvents[_0xb1d3('0x4')](_0x2d7cfc,_0x4add64);_0x38f745(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb1d3('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xdc75=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit'];(function(_0x1bafb1,_0x3f4d43){var _0x1e9aa9=function(_0x34c867){while(--_0x34c867){_0x1bafb1['push'](_0x1bafb1['shift']());}};_0x1e9aa9(++_0x3f4d43);}(_0xdc75,0x80));var _0x5dc7=function(_0x394d6c,_0x30adb1){_0x394d6c=_0x394d6c-0x0;var _0x18df60=_0xdc75[_0x394d6c];return _0x18df60;};'use strict';var EventEmitter=require(_0x5dc7('0x0'));var SquareProject=require(_0x5dc7('0x1'))['db'][_0x5dc7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5dc7('0x3')](0x0);var events={'afterCreate':_0x5dc7('0x4'),'afterUpdate':'update','afterDestroy':_0x5dc7('0x5')};function emitEvent(_0x4462f8){return function(_0x1fdbe0,_0x6c8979,_0x4ab778){SquareProjectEvents[_0x5dc7('0x6')](_0x4462f8+':'+_0x1fdbe0['id'],_0x1fdbe0);SquareProjectEvents[_0x5dc7('0x6')](_0x4462f8,_0x1fdbe0);_0x4ab778(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x5dc7('0x7')](e,emitEvent(event));}}module[_0x5dc7('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b56388d..8cc6617 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 _0x6606=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','rimraf','./squareProject.attributes','exports','define'];(function(_0x15d1c4,_0x5a032e){var _0x481032=function(_0x19f55e){while(--_0x19f55e){_0x15d1c4['push'](_0x15d1c4['shift']());}};_0x481032(++_0x5a032e);}(_0x6606,0x158));var _0x6660=function(_0x7dee27,_0x545b55){_0x7dee27=_0x7dee27-0x0;var _0x4fb661=_0x6606[_0x7dee27];return _0x4fb661;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var logger=require(_0x6660('0x2'))(_0x6660('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6660('0x4'));var config=require('../../config/environment');var attributes=require(_0x6660('0x5'));module[_0x6660('0x6')]=function(_0xbd2cef,_0x5b2790){return _0xbd2cef[_0x6660('0x7')](_0x6660('0x8'),attributes,{'tableName':_0x6660('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a54a0,_0x5dfaa2,_0x40a8f0){if(_0x1a54a0['changed'](_0x6660('0xa'))){_0x1a54a0[_0x6660('0xb')]=moment()[_0x6660('0xc')](_0x6660('0xd'));}if(_0x1a54a0['changed'](_0x6660('0xe'))){_0x1a54a0[_0x6660('0xf')]=moment()[_0x6660('0xc')](_0x6660('0xd'));}_0x40a8f0(null,_0x1a54a0);}}});}; \ No newline at end of file +var _0x9696=['moment','bluebird','path','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','../../config/logger','api'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9696,0x10b));var _0x6969=function(_0x356d92,_0xdd350e){_0x356d92=_0x356d92-0x0;var _0x517e3e=_0x9696[_0x356d92];return _0x517e3e;};'use strict';var _=require(_0x6969('0x0'));var util=require('util');var logger=require(_0x6969('0x1'))(_0x6969('0x2'));var moment=require(_0x6969('0x3'));var BPromise=require(_0x6969('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6969('0x5'));var rimraf=require('rimraf');var config=require(_0x6969('0x6'));var attributes=require(_0x6969('0x7'));module[_0x6969('0x8')]=function(_0x3d864d,_0x4f47af){return _0x3d864d[_0x6969('0x9')]('SquareProject',attributes,{'tableName':_0x6969('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58a1ce,_0x31e53c,_0xadcf10){if(_0x58a1ce[_0x6969('0xb')]('preproduction')){_0x58a1ce[_0x6969('0xc')]=moment()['format'](_0x6969('0xd'));}if(_0x58a1ce[_0x6969('0xb')]('production')){_0x58a1ce[_0x6969('0xe')]=moment()['format'](_0x6969('0xd'));}_0xadcf10(null,_0x58a1ce);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ee4524b..e3ba141 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 _0xdd38=['where','attributes','limit','include','model','map','info','debug','catch','error','message','find','then','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','raw','options'];(function(_0x5a7521,_0x2d1d5e){var _0x3d6e6a=function(_0x1ea2b8){while(--_0x1ea2b8){_0x5a7521['push'](_0x5a7521['shift']());}};_0x3d6e6a(++_0x2d1d5e);}(_0xdd38,0x197));var _0x8dd3=function(_0x17474a,_0xd1a49c){_0x17474a=_0x17474a-0x0;var _0x3a5495=_0xdd38[_0x17474a];return _0x3a5495;};'use strict';var _=require('lodash');var Redis=require(_0x8dd3('0x0'));var db=require(_0x8dd3('0x1'))['db'];var logger=require(_0x8dd3('0x2'))(_0x8dd3('0x3'));var config=require(_0x8dd3('0x4'));config['redis']=_[_0x8dd3('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dd3('0x6')]));require(_0x8dd3('0x7'))[_0x8dd3('0x8')](socket);exports[_0x8dd3('0x9')]=function(_0xb18985){var _0x2e979b=this;return new Promise(function(_0x46f71b,_0x2422ba){return db[_0x8dd3('0xa')]['findAll']({'raw':_0xb18985['options']?_0xb18985['options'][_0x8dd3('0xb')]===undefined?!![]:![]:!![],'where':_0xb18985[_0x8dd3('0xc')]?_0xb18985[_0x8dd3('0xc')][_0x8dd3('0xd')]||null:null,'attributes':_0xb18985[_0x8dd3('0xc')]?_0xb18985['options'][_0x8dd3('0xe')]||null:null,'limit':_0xb18985[_0x8dd3('0xc')]?_0xb18985[_0x8dd3('0xc')][_0x8dd3('0xf')]||null:null,'include':_0xb18985[_0x8dd3('0xc')]?_0xb18985['options'][_0x8dd3('0x10')]?_['map'](_0xb18985[_0x8dd3('0xc')][_0x8dd3('0x10')],function(_0x551360){return{'model':db[_0x551360[_0x8dd3('0x11')]],'as':_0x551360['as'],'attributes':_0x551360[_0x8dd3('0xe')],'include':_0x551360[_0x8dd3('0x10')]?_[_0x8dd3('0x12')](_0x551360[_0x8dd3('0x10')],function(_0x14cfc0){return{'model':db[_0x14cfc0['model']],'as':_0x14cfc0['as'],'attributes':_0x14cfc0['attributes'],'include':_0x14cfc0[_0x8dd3('0x10')]?_['map'](_0x14cfc0[_0x8dd3('0x10')],function(_0x2a0aa2){return{'model':db[_0x2a0aa2['model']],'as':_0x2a0aa2['as'],'attributes':_0x2a0aa2[_0x8dd3('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3edc2e){logger[_0x8dd3('0x13')]('GetSquareProjects',_0xb18985);logger[_0x8dd3('0x14')](_0x8dd3('0x9'),_0xb18985,JSON['stringify'](_0x3edc2e));_0x46f71b(_0x3edc2e);})[_0x8dd3('0x15')](function(_0x1aed83){logger[_0x8dd3('0x16')]('GetSquareProjects',_0x1aed83['message'],_0xb18985);_0x2422ba(_0x2e979b[_0x8dd3('0x16')](0x1f4,_0x1aed83[_0x8dd3('0x17')]));});});};exports['ShowSquareProject']=function(_0x6b36ee){var _0x23b8c6=this;return new Promise(function(_0x28ab8c,_0x130d01){return db['SquareProject'][_0x8dd3('0x18')]({'raw':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee['options']['raw']===undefined?!![]:![]:!![],'where':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee[_0x8dd3('0xc')][_0x8dd3('0xd')]||null:null,'attributes':_0x6b36ee['options']?_0x6b36ee['options'][_0x8dd3('0xe')]||null:null,'include':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee[_0x8dd3('0xc')]['include']?_[_0x8dd3('0x12')](_0x6b36ee['options']['include'],function(_0x450c49){return{'model':db[_0x450c49[_0x8dd3('0x11')]],'as':_0x450c49['as'],'attributes':_0x450c49[_0x8dd3('0xe')],'include':_0x450c49['include']?_[_0x8dd3('0x12')](_0x450c49[_0x8dd3('0x10')],function(_0x25b4b4){return{'model':db[_0x25b4b4[_0x8dd3('0x11')]],'as':_0x25b4b4['as'],'attributes':_0x25b4b4[_0x8dd3('0xe')],'include':_0x25b4b4[_0x8dd3('0x10')]?_[_0x8dd3('0x12')](_0x25b4b4[_0x8dd3('0x10')],function(_0x5942d0){return{'model':db[_0x5942d0[_0x8dd3('0x11')]],'as':_0x5942d0['as'],'attributes':_0x5942d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8dd3('0x19')](function(_0x4347c3){logger[_0x8dd3('0x13')](_0x8dd3('0x1a'),_0x6b36ee);logger[_0x8dd3('0x14')](_0x8dd3('0x1a'),_0x6b36ee,JSON[_0x8dd3('0x1b')](_0x4347c3));_0x28ab8c(_0x4347c3);})[_0x8dd3('0x15')](function(_0x11e23f){logger[_0x8dd3('0x16')](_0x8dd3('0x1a'),_0x11e23f['message'],_0x6b36ee);_0x130d01(_0x23b8c6[_0x8dd3('0x16')](0x1f4,_0x11e23f['message']));});});}; \ No newline at end of file +var _0xb905=['socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','GetSquareProjects','stringify','catch','message','ShowSquareProject','error','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost'];(function(_0x55c2b6,_0x2eedb1){var _0x4105d3=function(_0x4806cf){while(--_0x4806cf){_0x55c2b6['push'](_0x55c2b6['shift']());}};_0x4105d3(++_0x2eedb1);}(_0xb905,0x8a));var _0x5b90=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb905[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x5b90('0x0'))['db'];var logger=require(_0x5b90('0x1'))(_0x5b90('0x2'));var config=require(_0x5b90('0x3'));config['redis']=_[_0x5b90('0x4')](config[_0x5b90('0x5')],{'host':_0x5b90('0x6'),'port':0x18eb});var socket=require(_0x5b90('0x7'))(new Redis(config['redis']));require(_0x5b90('0x8'))[_0x5b90('0x9')](socket);exports['GetSquareProjects']=function(_0x3f65b1){var _0x44399e=this;return new Promise(function(_0x496d86,_0x3c58a0){return db[_0x5b90('0xa')][_0x5b90('0xb')]({'raw':_0x3f65b1[_0x5b90('0xc')]?_0x3f65b1[_0x5b90('0xc')][_0x5b90('0xd')]===undefined?!![]:![]:!![],'where':_0x3f65b1[_0x5b90('0xc')]?_0x3f65b1[_0x5b90('0xc')][_0x5b90('0xe')]||null:null,'attributes':_0x3f65b1[_0x5b90('0xc')]?_0x3f65b1[_0x5b90('0xc')][_0x5b90('0xf')]||null:null,'limit':_0x3f65b1['options']?_0x3f65b1['options'][_0x5b90('0x10')]||null:null,'include':_0x3f65b1[_0x5b90('0xc')]?_0x3f65b1['options'][_0x5b90('0x11')]?_[_0x5b90('0x12')](_0x3f65b1[_0x5b90('0xc')][_0x5b90('0x11')],function(_0x3e7f38){return{'model':db[_0x3e7f38[_0x5b90('0x13')]],'as':_0x3e7f38['as'],'attributes':_0x3e7f38[_0x5b90('0xf')],'include':_0x3e7f38[_0x5b90('0x11')]?_[_0x5b90('0x12')](_0x3e7f38['include'],function(_0x36ef06){return{'model':db[_0x36ef06[_0x5b90('0x13')]],'as':_0x36ef06['as'],'attributes':_0x36ef06[_0x5b90('0xf')],'include':_0x36ef06['include']?_['map'](_0x36ef06['include'],function(_0x4afcbd){return{'model':db[_0x4afcbd[_0x5b90('0x13')]],'as':_0x4afcbd['as'],'attributes':_0x4afcbd[_0x5b90('0xf')]};}):[]};}):[]};}):[]:[]})[_0x5b90('0x14')](function(_0x55dc28){logger[_0x5b90('0x15')]('GetSquareProjects',_0x3f65b1);logger[_0x5b90('0x16')](_0x5b90('0x17'),_0x3f65b1,JSON[_0x5b90('0x18')](_0x55dc28));_0x496d86(_0x55dc28);})[_0x5b90('0x19')](function(_0x3197b3){logger['error'](_0x5b90('0x17'),_0x3197b3[_0x5b90('0x1a')],_0x3f65b1);_0x3c58a0(_0x44399e['error'](0x1f4,_0x3197b3['message']));});});};exports['ShowSquareProject']=function(_0x253290){var _0x404474=this;return new Promise(function(_0x5361a9,_0x813f1){return db['SquareProject']['find']({'raw':_0x253290[_0x5b90('0xc')]?_0x253290[_0x5b90('0xc')][_0x5b90('0xd')]===undefined?!![]:![]:!![],'where':_0x253290[_0x5b90('0xc')]?_0x253290[_0x5b90('0xc')]['where']||null:null,'attributes':_0x253290['options']?_0x253290[_0x5b90('0xc')][_0x5b90('0xf')]||null:null,'include':_0x253290[_0x5b90('0xc')]?_0x253290[_0x5b90('0xc')][_0x5b90('0x11')]?_['map'](_0x253290[_0x5b90('0xc')][_0x5b90('0x11')],function(_0x5bc326){return{'model':db[_0x5bc326['model']],'as':_0x5bc326['as'],'attributes':_0x5bc326[_0x5b90('0xf')],'include':_0x5bc326[_0x5b90('0x11')]?_[_0x5b90('0x12')](_0x5bc326['include'],function(_0x574101){return{'model':db[_0x574101['model']],'as':_0x574101['as'],'attributes':_0x574101['attributes'],'include':_0x574101[_0x5b90('0x11')]?_[_0x5b90('0x12')](_0x574101[_0x5b90('0x11')],function(_0x1e6a6d){return{'model':db[_0x1e6a6d['model']],'as':_0x1e6a6d['as'],'attributes':_0x1e6a6d[_0x5b90('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x332b7a){logger['info'](_0x5b90('0x1b'),_0x253290);logger[_0x5b90('0x16')](_0x5b90('0x1b'),_0x253290,JSON[_0x5b90('0x18')](_0x332b7a));_0x5361a9(_0x332b7a);})[_0x5b90('0x19')](function(_0x29f372){logger[_0x5b90('0x1c')]('ShowSquareProject',_0x29f372['message'],_0x253290);_0x813f1(_0x404474[_0x5b90('0x1c')](0x1f4,_0x29f372[_0x5b90('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 50124f5..4dbba82 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 _0xd3c2=['removeListener','register','squareProject:','save','remove','emit'];(function(_0x4a002e,_0x14a5f6){var _0xb86ae3=function(_0x10a189){while(--_0x10a189){_0x4a002e['push'](_0x4a002e['shift']());}};_0xb86ae3(++_0x14a5f6);}(_0xd3c2,0x183));var _0x2d3c=function(_0x36c712,_0x4cc6a0){_0x36c712=_0x36c712-0x0;var _0x59c77a=_0xd3c2[_0x36c712];return _0x59c77a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x2d3c('0x0'),_0x2d3c('0x1'),'update'];function createListener(_0x49939d,_0x3f6002){return function(_0x408ad9){_0x3f6002[_0x2d3c('0x2')](_0x49939d,_0x408ad9);};}function removeListener(_0x3a55e2,_0x3451d0){return function(){SquareProjectEvents[_0x2d3c('0x3')](_0x3a55e2,_0x3451d0);};}exports[_0x2d3c('0x4')]=function(_0x4e6cc6){for(var _0x4cef3a=0x0,_0x21a926=events['length'];_0x4cef3a<_0x21a926;_0x4cef3a++){var _0x4a8649=events[_0x4cef3a];var _0x2ef41e=createListener(_0x2d3c('0x5')+_0x4a8649,_0x4e6cc6);SquareProjectEvents['on'](_0x4a8649,_0x2ef41e);}}; \ No newline at end of file +var _0xccd2=['register','length','squareProject:','save','remove','update','emit'];(function(_0x39bc4a,_0x595147){var _0x436b0d=function(_0x44e6eb){while(--_0x44e6eb){_0x39bc4a['push'](_0x39bc4a['shift']());}};_0x436b0d(++_0x595147);}(_0xccd2,0x114));var _0x2ccd=function(_0x315319,_0x139f0f){_0x315319=_0x315319-0x0;var _0x5563aa=_0xccd2[_0x315319];return _0x5563aa;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x2ccd('0x0'),_0x2ccd('0x1'),_0x2ccd('0x2')];function createListener(_0x5dbed,_0x4a5b9b){return function(_0x14dcc7){_0x4a5b9b[_0x2ccd('0x3')](_0x5dbed,_0x14dcc7);};}function removeListener(_0x60e27b,_0x2b7223){return function(){SquareProjectEvents['removeListener'](_0x60e27b,_0x2b7223);};}exports[_0x2ccd('0x4')]=function(_0x64da75){for(var _0x268208=0x0,_0xbc46c=events[_0x2ccd('0x5')];_0x268208<_0xbc46c;_0x268208++){var _0x942514=events[_0x268208];var _0x3ad0d7=createListener(_0x2ccd('0x6')+_0x942514,_0x64da75);SquareProjectEvents['on'](_0x942514,_0x3ad0d7);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 36951cf..997739f 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2a44a9,_0x4985a3){var _0x257b8e=function(_0x10ffb3){while(--_0x10ffb3){_0x2a44a9['push'](_0x2a44a9['shift']());}};_0x257b8e(++_0x4985a3);}(_0x4975,0x86));var _0x5497=function(_0x1d6904,_0x4ca73e){_0x1d6904=_0x1d6904-0x0;var _0x4630ac=_0x4975[_0x1d6904];return _0x4630ac;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x7217,0x19e));var _0x7721=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7217[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);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 11213e3..8d6b8b8 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 _0xed1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0xed1f,0x6a));var _0xfed1=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xed1f[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'context':{'type':Sequelize[_0xfed1('0x2')]},'extension':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'dnid':{'type':Sequelize[_0xfed1('0x2')]},'projectName':{'type':Sequelize[_0xfed1('0x2')]},'saveName':{'type':Sequelize[_0xfed1('0x2')]},'filename':{'type':Sequelize[_0xfed1('0x2')]},'savePath':{'type':Sequelize[_0xfed1('0x2')]},'format':{'type':Sequelize[_0xfed1('0x3')],'get':function(){var _0x612b38='';var _0x2a6082=this[_0xfed1('0x4')]('savePath');if(_0x2a6082){_0x612b38=_0x2a6082[_0xfed1('0x5')](_0x2a6082[_0xfed1('0x6')]('.'));}return _0x612b38;}}}; \ No newline at end of file +var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x215733,_0x5c567e){var _0x7f1a5c=function(_0x98bf92){while(--_0x98bf92){_0x215733['push'](_0x215733['shift']());}};_0x7f1a5c(++_0x5c567e);}(_0x5d17,0x114));var _0x75d1=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x5d17[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 75d4b59..57d6b93 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 _0x95af=['filter','options','findAll','show','params','SquareRecording','includeAll','include','find','catch','create','body','download','../../components/encryptor','type','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x305551,_0x868339){var _0x115ce2=function(_0x49265b){while(--_0x49265b){_0x305551['push'](_0x305551['shift']());}};_0x115ce2(++_0x868339);}(_0x95af,0x8b));var _0xf95a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x95af[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf95a('0x0'));var zipdir=require(_0xf95a('0x1'));var jsonpatch=require(_0xf95a('0x2'));var rp=require(_0xf95a('0x3'));var moment=require(_0xf95a('0x4'));var BPromise=require(_0xf95a('0x5'));var Mustache=require(_0xf95a('0x6'));var util=require(_0xf95a('0x7'));var path=require(_0xf95a('0x8'));var sox=require(_0xf95a('0x9'));var csv=require(_0xf95a('0xa'));var ejs=require(_0xf95a('0xb'));var fs=require('fs');var fs_extra=require(_0xf95a('0xc'));var _=require(_0xf95a('0xd'));var squel=require(_0xf95a('0xe'));var crypto=require(_0xf95a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf95a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf95a('0x11'));var Papa=require(_0xf95a('0x12'));var Redis=require(_0xf95a('0x13'));var authService=require(_0xf95a('0x14'));var qs=require(_0xf95a('0x15'));var as=require(_0xf95a('0x16'));var hardwareService=require(_0xf95a('0x17'));var logger=require(_0xf95a('0x18'))(_0xf95a('0x19'));var utils=require(_0xf95a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf95a('0x1b'));var db=require(_0xf95a('0x1c'))['db'];function respondWithStatusCode(_0x36138f,_0x20812d){_0x20812d=_0x20812d||0xcc;return function(_0x425836){if(_0x425836){return _0x36138f[_0xf95a('0x1d')](_0x20812d);}return _0x36138f[_0xf95a('0x1e')](_0x20812d)[_0xf95a('0x1f')]();};}function respondWithResult(_0x213145,_0x14bb58){_0x14bb58=_0x14bb58||0xc8;return function(_0x391659){if(_0x391659){return _0x213145[_0xf95a('0x1e')](_0x14bb58)[_0xf95a('0x20')](_0x391659);}};}function respondWithFilteredResult(_0x281ca4,_0x3c94af){return function(_0x37be11){if(_0x37be11){var _0x1203db=typeof _0x3c94af['offset']===_0xf95a('0x21')&&typeof _0x3c94af[_0xf95a('0x22')]===_0xf95a('0x21');var _0x2bea3b=_0x37be11[_0xf95a('0x23')];var _0x4f4c71=_0x1203db?0x0:_0x3c94af[_0xf95a('0x24')];var _0x2b4d5c=_0x1203db?_0x37be11['count']:_0x3c94af['offset']+_0x3c94af[_0xf95a('0x22')];var _0xb5553e;if(_0x2b4d5c>=_0x2bea3b){_0x2b4d5c=_0x2bea3b;_0xb5553e=0xc8;}else{_0xb5553e=0xce;}_0x281ca4[_0xf95a('0x1e')](_0xb5553e);return _0x281ca4[_0xf95a('0x25')](_0xf95a('0x26'),_0x4f4c71+'-'+_0x2b4d5c+'/'+_0x2bea3b)[_0xf95a('0x20')](_0x37be11);}return null;};}function patchUpdates(_0x3706e1){return function(_0x42b051){try{jsonpatch['apply'](_0x42b051,_0x3706e1,!![]);}catch(_0x3a001c){return BPromise[_0xf95a('0x27')](_0x3a001c);}return _0x42b051[_0xf95a('0x28')]();};}function saveUpdates(_0x2b1df8,_0x18c65c){return function(_0x5053d7){if(_0x5053d7){return _0x5053d7[_0xf95a('0x29')](_0x2b1df8)[_0xf95a('0x2a')](function(_0x5619ac){return _0x5619ac;});}return null;};}function removeEntity(_0x3b4a10,_0xf406df){return function(_0x24e97e){if(_0x24e97e){return _0x24e97e[_0xf95a('0x2b')]()[_0xf95a('0x2a')](function(){_0x3b4a10[_0xf95a('0x1e')](0xcc)[_0xf95a('0x1f')]();});}};}function handleEntityNotFound(_0x5e642e,_0x17c6ec){return function(_0x481084){if(!_0x481084){_0x5e642e['sendStatus'](0x194);}return _0x481084;};}function handleError(_0x48f4d1,_0x10b16d){_0x10b16d=_0x10b16d||0x1f4;return function(_0x402eb8){logger[_0xf95a('0x2c')](_0x402eb8[_0xf95a('0x2d')]);if(_0x402eb8[_0xf95a('0x2e')]){delete _0x402eb8[_0xf95a('0x2e')];}_0x48f4d1[_0xf95a('0x1e')](_0x10b16d)[_0xf95a('0x2f')](_0x402eb8);};}exports[_0xf95a('0x30')]=function(_0x11b39b,_0x18b912){var _0x36547f={},_0x4fb9ce={},_0x3148e0={'count':0x0,'rows':[]};var _0x5b3e1a=_[_0xf95a('0x31')](db['SquareRecording'][_0xf95a('0x32')],function(_0xd8387d){return{'name':_0xd8387d[_0xf95a('0x33')],'type':_0xd8387d['type'][_0xf95a('0x34')]};});_0x4fb9ce[_0xf95a('0x35')]=_['map'](_0x5b3e1a,_0xf95a('0x2e'));_0x4fb9ce[_0xf95a('0x36')]=_[_0xf95a('0x37')](_0x11b39b[_0xf95a('0x36')]);_0x4fb9ce[_0xf95a('0x38')]=_[_0xf95a('0x39')](_0x4fb9ce[_0xf95a('0x35')],_0x4fb9ce[_0xf95a('0x36')]);_0x36547f[_0xf95a('0x3a')]=_['intersection'](_0x4fb9ce[_0xf95a('0x35')],qs['fields'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x3b')]));_0x36547f[_0xf95a('0x3a')]=_0x36547f['attributes'][_0xf95a('0x3c')]?_0x36547f[_0xf95a('0x3a')]:_0x4fb9ce[_0xf95a('0x35')];if(!_0x11b39b['query'][_0xf95a('0x3d')](_0xf95a('0x3e'))){_0x36547f['limit']=qs['limit'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x22')]);_0x36547f[_0xf95a('0x24')]=qs[_0xf95a('0x24')](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x24')]);}_0x36547f['order']=qs['sort'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x3f')]);_0x36547f[_0xf95a('0x40')]=qs['filters'](_[_0xf95a('0x41')](_0x11b39b[_0xf95a('0x36')],_0x4fb9ce[_0xf95a('0x38')]),_0x5b3e1a);if(_0x11b39b[_0xf95a('0x36')]['filter']){_0x36547f[_0xf95a('0x40')]=_[_0xf95a('0x42')](_0x36547f[_0xf95a('0x40')],{'$or':_[_0xf95a('0x31')](_0x5b3e1a,function(_0x34a22f){if(_0x34a22f['type']!=='VIRTUAL'){var _0x4726bc={};_0x4726bc[_0x34a22f[_0xf95a('0x2e')]]={'$like':'%'+_0x11b39b[_0xf95a('0x36')][_0xf95a('0x43')]+'%'};return _0x4726bc;}})});}_0x36547f=_['merge']({},_0x36547f,_0x11b39b[_0xf95a('0x44')]);var _0x3f424e={'where':_0x36547f[_0xf95a('0x40')]};return db['SquareRecording'][_0xf95a('0x23')](_0x3f424e)[_0xf95a('0x2a')](function(_0x53638b){_0x3148e0[_0xf95a('0x23')]=_0x53638b;if(_0x11b39b[_0xf95a('0x36')]['includeAll']){_0x36547f['include']=[{'all':!![]}];}return db['SquareRecording'][_0xf95a('0x45')](_0x36547f);})[_0xf95a('0x2a')](function(_0x68f5f){_0x3148e0['rows']=_0x68f5f;return _0x3148e0;})[_0xf95a('0x2a')](respondWithFilteredResult(_0x18b912,_0x36547f))['catch'](handleError(_0x18b912,null));};exports[_0xf95a('0x46')]=function(_0x418efc,_0x31cee3){var _0x5e81d4={'raw':!![],'where':{'id':_0x418efc[_0xf95a('0x47')]['id']}},_0x1e9871={};_0x1e9871['model']=_['keys'](db[_0xf95a('0x48')][_0xf95a('0x32')]);_0x1e9871[_0xf95a('0x36')]=_[_0xf95a('0x37')](_0x418efc[_0xf95a('0x36')]);_0x1e9871[_0xf95a('0x38')]=_['intersection'](_0x1e9871['model'],_0x1e9871[_0xf95a('0x36')]);_0x5e81d4[_0xf95a('0x3a')]=_[_0xf95a('0x39')](_0x1e9871['model'],qs[_0xf95a('0x3b')](_0x418efc['query'][_0xf95a('0x3b')]));_0x5e81d4['attributes']=_0x5e81d4['attributes'][_0xf95a('0x3c')]?_0x5e81d4[_0xf95a('0x3a')]:_0x1e9871[_0xf95a('0x35')];if(_0x418efc[_0xf95a('0x36')][_0xf95a('0x49')]){_0x5e81d4[_0xf95a('0x4a')]=[{'all':!![]}];}_0x5e81d4=_['merge']({},_0x5e81d4,_0x418efc[_0xf95a('0x44')]);return db[_0xf95a('0x48')][_0xf95a('0x4b')](_0x5e81d4)[_0xf95a('0x2a')](handleEntityNotFound(_0x31cee3,null))['then'](respondWithResult(_0x31cee3,null))[_0xf95a('0x4c')](handleError(_0x31cee3,null));};exports['create']=function(_0x517b3a,_0x57d64a){return db[_0xf95a('0x48')][_0xf95a('0x4d')](_0x517b3a[_0xf95a('0x4e')],{})[_0xf95a('0x2a')](respondWithResult(_0x57d64a,0xc9))['catch'](handleError(_0x57d64a,null));};exports[_0xf95a('0x29')]=function(_0x2875d8,_0x3c30fe){if(_0x2875d8[_0xf95a('0x4e')]['id']){delete _0x2875d8['body']['id'];}return db[_0xf95a('0x48')][_0xf95a('0x4b')]({'where':{'id':_0x2875d8[_0xf95a('0x47')]['id']}})[_0xf95a('0x2a')](handleEntityNotFound(_0x3c30fe,null))['then'](saveUpdates(_0x2875d8['body'],null))[_0xf95a('0x2a')](respondWithResult(_0x3c30fe,null))[_0xf95a('0x4c')](handleError(_0x3c30fe,null));};exports[_0xf95a('0x4f')]=function(_0x456739,_0x4f1cc9,_0x349d75){var _0x502bed=require(_0xf95a('0x50'));var _0x5d908a=![];var _0x121001={};if(_0x456739[_0xf95a('0x36')][_0xf95a('0x51')]&&_0x456739[_0xf95a('0x36')][_0xf95a('0x51')]===_0xf95a('0x52')){_0x121001[_0xf95a('0x52')]=_0x456739[_0xf95a('0x47')]['id'];}else{_0x121001['id']=_0x456739[_0xf95a('0x47')]['id'];}return db['SquareRecording'][_0xf95a('0x4b')]({'where':_0x121001,'attributes':['id','savePath',_0xf95a('0x53')],'raw':!![]})[_0xf95a('0x2a')](handleEntityNotFound(_0x4f1cc9,null))[_0xf95a('0x2a')](function(_0x2f17c5){if(_0x2f17c5){var _0x567c46=_0x2f17c5[_0xf95a('0x54')];var _0x68624a=util[_0xf95a('0x55')](_0xf95a('0x56'),_0x567c46);if(fs[_0xf95a('0x57')](_0x68624a)){_0x5d908a=!![];return _0x502bed[_0xf95a('0x58')](_0x68624a,_0x567c46,config[_0xf95a('0x59')][_0xf95a('0x5a')])[_0xf95a('0x2a')](function(){return _0x2f17c5;});}return _0x2f17c5;}})[_0xf95a('0x2a')](function(_0x4a2ceb){if(_0x4a2ceb){var _0x87058d=_0x4a2ceb[_0xf95a('0x54')];if(!fs['existsSync'](_0x87058d)){throw new db[(_0xf95a('0x5b'))][(_0xf95a('0x5c'))](_0xf95a('0x5d'));}if(_0x4a2ceb[_0xf95a('0x53')]){return _0x4f1cc9[_0xf95a('0x4f')](_0x87058d,_0x4a2ceb[_0xf95a('0x53')]+path[_0xf95a('0x5e')](_0x87058d),function(){if(_0x5d908a){fs[_0xf95a('0x5f')](_0x87058d);}});}else{return _0x4f1cc9[_0xf95a('0x4f')](_0x87058d,function(_0x3a1a6d){if(_0x5d908a){fs['unlink'](_0x87058d);}});}}})['catch'](function(_0x48be10){if(_0x48be10['message']===_0xf95a('0x5d')){_0x4f1cc9[_0xf95a('0x1e')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f1cc9,null);}});};exports[_0xf95a('0x2b')]=function(_0x23be00,_0x111949){return db[_0xf95a('0x48')]['find']({'where':{'id':_0x23be00[_0xf95a('0x47')]['id']}})[_0xf95a('0x2a')](function(_0x1b6810){if(_[_0xf95a('0x60')](_0x1b6810)){throw new ReferenceError(_0xf95a('0x61'));}return _0x1b6810;})[_0xf95a('0x2a')](function(_0x594a10){var _0x534529=_0x594a10[_0xf95a('0x54')];logger[_0xf95a('0x62')](_0xf95a('0x63'),_0x534529);if(!_['isNil'](_0x594a10['savePath'])&&fs[_0xf95a('0x57')](_0x534529)){logger[_0xf95a('0x62')](_0xf95a('0x64')+_0x534529+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf95a('0x65')](_0x534529);}_0x534529=_0x534529+'.cypher';if(!_[_0xf95a('0x60')](_0x594a10[_0xf95a('0x54')])&&fs['existsSync'](_0x534529)){logger[_0xf95a('0x62')](_0xf95a('0x64')+_0x534529+_0xf95a('0x66'));fs[_0xf95a('0x65')](_0x534529);}return _0x594a10;})['then'](function(_0x3dbffd){if(!_0x3dbffd)throw new InternalError();return _0x3dbffd[_0xf95a('0x2b')]();})['then'](function(){_0x111949[_0xf95a('0x1e')](0xcc)['end']();})[_0xf95a('0x4c')](handleError(_0x111949,null));}; \ No newline at end of file +var _0x1b0e=['attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','rows','show','params','keys','length','find','create','catch','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','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','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','intersection'];(function(_0x549b53,_0x56d9a0){var _0xc54d57=function(_0x4a7a50){while(--_0x4a7a50){_0x549b53['push'](_0x549b53['shift']());}};_0xc54d57(++_0x56d9a0);}(_0x1b0e,0x1b5));var _0xe1b0=function(_0x2bb296,_0x32393e){_0x2bb296=_0x2bb296-0x0;var _0x1f63fe=_0x1b0e[_0x2bb296];return _0x1f63fe;};'use strict';var emlformat=require(_0xe1b0('0x0'));var rimraf=require(_0xe1b0('0x1'));var zipdir=require(_0xe1b0('0x2'));var jsonpatch=require(_0xe1b0('0x3'));var rp=require(_0xe1b0('0x4'));var moment=require(_0xe1b0('0x5'));var BPromise=require(_0xe1b0('0x6'));var Mustache=require(_0xe1b0('0x7'));var util=require(_0xe1b0('0x8'));var path=require(_0xe1b0('0x9'));var sox=require(_0xe1b0('0xa'));var csv=require(_0xe1b0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe1b0('0xc'));var crypto=require(_0xe1b0('0xd'));var jsforce=require(_0xe1b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1b0('0xb'));var querystring=require('querystring');var Papa=require(_0xe1b0('0xf'));var Redis=require(_0xe1b0('0x10'));var authService=require(_0xe1b0('0x11'));var qs=require(_0xe1b0('0x12'));var as=require(_0xe1b0('0x13'));var hardwareService=require(_0xe1b0('0x14'));var logger=require(_0xe1b0('0x15'))('api');var utils=require(_0xe1b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe1b0('0x17'));var db=require(_0xe1b0('0x18'))['db'];function respondWithStatusCode(_0x1e59aa,_0x1ed4df){_0x1ed4df=_0x1ed4df||0xcc;return function(_0x17b41d){if(_0x17b41d){return _0x1e59aa[_0xe1b0('0x19')](_0x1ed4df);}return _0x1e59aa[_0xe1b0('0x1a')](_0x1ed4df)[_0xe1b0('0x1b')]();};}function respondWithResult(_0x31e716,_0x1849fd){_0x1849fd=_0x1849fd||0xc8;return function(_0x1ce2d3){if(_0x1ce2d3){return _0x31e716['status'](_0x1849fd)[_0xe1b0('0x1c')](_0x1ce2d3);}};}function respondWithFilteredResult(_0xbf0a4c,_0x37c97a){return function(_0x45bde3){if(_0x45bde3){var _0x160f68=typeof _0x37c97a[_0xe1b0('0x1d')]===_0xe1b0('0x1e')&&typeof _0x37c97a[_0xe1b0('0x1f')]==='undefined';var _0x45b1d5=_0x45bde3[_0xe1b0('0x20')];var _0x224ca3=_0x160f68?0x0:_0x37c97a['offset'];var _0x45ff53=_0x160f68?_0x45bde3[_0xe1b0('0x20')]:_0x37c97a[_0xe1b0('0x1d')]+_0x37c97a[_0xe1b0('0x1f')];var _0x2d007e;if(_0x45ff53>=_0x45b1d5){_0x45ff53=_0x45b1d5;_0x2d007e=0xc8;}else{_0x2d007e=0xce;}_0xbf0a4c[_0xe1b0('0x1a')](_0x2d007e);return _0xbf0a4c['set'](_0xe1b0('0x21'),_0x224ca3+'-'+_0x45ff53+'/'+_0x45b1d5)[_0xe1b0('0x1c')](_0x45bde3);}return null;};}function patchUpdates(_0x2752c9){return function(_0x54566c){try{jsonpatch[_0xe1b0('0x22')](_0x54566c,_0x2752c9,!![]);}catch(_0x11682d){return BPromise[_0xe1b0('0x23')](_0x11682d);}return _0x54566c[_0xe1b0('0x24')]();};}function saveUpdates(_0x886b68,_0x5356bc){return function(_0x6f5eed){if(_0x6f5eed){return _0x6f5eed[_0xe1b0('0x25')](_0x886b68)[_0xe1b0('0x26')](function(_0x74cff1){return _0x74cff1;});}return null;};}function removeEntity(_0x9e0373,_0x527e70){return function(_0x1830a0){if(_0x1830a0){return _0x1830a0[_0xe1b0('0x27')]()['then'](function(){_0x9e0373[_0xe1b0('0x1a')](0xcc)[_0xe1b0('0x1b')]();});}};}function handleEntityNotFound(_0x1add70,_0x53339b){return function(_0x72eb4){if(!_0x72eb4){_0x1add70[_0xe1b0('0x19')](0x194);}return _0x72eb4;};}function handleError(_0x3fe415,_0x54d0dc){_0x54d0dc=_0x54d0dc||0x1f4;return function(_0xfee60b){logger[_0xe1b0('0x28')](_0xfee60b['stack']);if(_0xfee60b[_0xe1b0('0x29')]){delete _0xfee60b[_0xe1b0('0x29')];}_0x3fe415[_0xe1b0('0x1a')](_0x54d0dc)[_0xe1b0('0x2a')](_0xfee60b);};}exports[_0xe1b0('0x2b')]=function(_0x260e90,_0x475a72){var _0x569c39={},_0x3d9625={},_0xa63d7b={'count':0x0,'rows':[]};var _0x2c5912=_[_0xe1b0('0x2c')](db[_0xe1b0('0x2d')][_0xe1b0('0x2e')],function(_0x434c19){return{'name':_0x434c19[_0xe1b0('0x2f')],'type':_0x434c19[_0xe1b0('0x30')][_0xe1b0('0x31')]};});_0x3d9625[_0xe1b0('0x32')]=_[_0xe1b0('0x2c')](_0x2c5912,_0xe1b0('0x29'));_0x3d9625[_0xe1b0('0x33')]=_['keys'](_0x260e90[_0xe1b0('0x33')]);_0x3d9625['filters']=_[_0xe1b0('0x34')](_0x3d9625['model'],_0x3d9625[_0xe1b0('0x33')]);_0x569c39[_0xe1b0('0x35')]=_['intersection'](_0x3d9625[_0xe1b0('0x32')],qs[_0xe1b0('0x36')](_0x260e90[_0xe1b0('0x33')][_0xe1b0('0x36')]));_0x569c39[_0xe1b0('0x35')]=_0x569c39[_0xe1b0('0x35')]['length']?_0x569c39['attributes']:_0x3d9625[_0xe1b0('0x32')];if(!_0x260e90['query'][_0xe1b0('0x37')](_0xe1b0('0x38'))){_0x569c39[_0xe1b0('0x1f')]=qs[_0xe1b0('0x1f')](_0x260e90[_0xe1b0('0x33')][_0xe1b0('0x1f')]);_0x569c39[_0xe1b0('0x1d')]=qs[_0xe1b0('0x1d')](_0x260e90['query']['offset']);}_0x569c39['order']=qs['sort'](_0x260e90[_0xe1b0('0x33')][_0xe1b0('0x39')]);_0x569c39[_0xe1b0('0x3a')]=qs['filters'](_[_0xe1b0('0x3b')](_0x260e90[_0xe1b0('0x33')],_0x3d9625[_0xe1b0('0x3c')]),_0x2c5912);if(_0x260e90[_0xe1b0('0x33')]['filter']){_0x569c39[_0xe1b0('0x3a')]=_[_0xe1b0('0x3d')](_0x569c39[_0xe1b0('0x3a')],{'$or':_['map'](_0x2c5912,function(_0x1245e0){if(_0x1245e0[_0xe1b0('0x30')]!==_0xe1b0('0x3e')){var _0x246c37={};_0x246c37[_0x1245e0[_0xe1b0('0x29')]]={'$like':'%'+_0x260e90['query'][_0xe1b0('0x3f')]+'%'};return _0x246c37;}})});}_0x569c39=_[_0xe1b0('0x3d')]({},_0x569c39,_0x260e90[_0xe1b0('0x40')]);var _0x1eba5e={'where':_0x569c39[_0xe1b0('0x3a')]};return db[_0xe1b0('0x2d')]['count'](_0x1eba5e)[_0xe1b0('0x26')](function(_0x86efe2){_0xa63d7b[_0xe1b0('0x20')]=_0x86efe2;if(_0x260e90[_0xe1b0('0x33')]['includeAll']){_0x569c39[_0xe1b0('0x41')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x569c39);})[_0xe1b0('0x26')](function(_0x46d73d){_0xa63d7b[_0xe1b0('0x42')]=_0x46d73d;return _0xa63d7b;})['then'](respondWithFilteredResult(_0x475a72,_0x569c39))['catch'](handleError(_0x475a72,null));};exports[_0xe1b0('0x43')]=function(_0x4c0b8e,_0x585e20){var _0x58ac06={'raw':!![],'where':{'id':_0x4c0b8e[_0xe1b0('0x44')]['id']}},_0x1523e7={};_0x1523e7[_0xe1b0('0x32')]=_[_0xe1b0('0x45')](db[_0xe1b0('0x2d')][_0xe1b0('0x2e')]);_0x1523e7[_0xe1b0('0x33')]=_[_0xe1b0('0x45')](_0x4c0b8e[_0xe1b0('0x33')]);_0x1523e7['filters']=_['intersection'](_0x1523e7[_0xe1b0('0x32')],_0x1523e7[_0xe1b0('0x33')]);_0x58ac06[_0xe1b0('0x35')]=_[_0xe1b0('0x34')](_0x1523e7[_0xe1b0('0x32')],qs[_0xe1b0('0x36')](_0x4c0b8e[_0xe1b0('0x33')]['fields']));_0x58ac06[_0xe1b0('0x35')]=_0x58ac06[_0xe1b0('0x35')][_0xe1b0('0x46')]?_0x58ac06[_0xe1b0('0x35')]:_0x1523e7['model'];if(_0x4c0b8e[_0xe1b0('0x33')]['includeAll']){_0x58ac06[_0xe1b0('0x41')]=[{'all':!![]}];}_0x58ac06=_[_0xe1b0('0x3d')]({},_0x58ac06,_0x4c0b8e[_0xe1b0('0x40')]);return db['SquareRecording'][_0xe1b0('0x47')](_0x58ac06)['then'](handleEntityNotFound(_0x585e20,null))[_0xe1b0('0x26')](respondWithResult(_0x585e20,null))['catch'](handleError(_0x585e20,null));};exports[_0xe1b0('0x48')]=function(_0x51141c,_0xd78c9b){return db['SquareRecording'][_0xe1b0('0x48')](_0x51141c['body'],{})[_0xe1b0('0x26')](respondWithResult(_0xd78c9b,0xc9))[_0xe1b0('0x49')](handleError(_0xd78c9b,null));};exports[_0xe1b0('0x25')]=function(_0x1696f1,_0x5b3cba){if(_0x1696f1[_0xe1b0('0x4a')]['id']){delete _0x1696f1[_0xe1b0('0x4a')]['id'];}return db[_0xe1b0('0x2d')][_0xe1b0('0x47')]({'where':{'id':_0x1696f1['params']['id']}})['then'](handleEntityNotFound(_0x5b3cba,null))[_0xe1b0('0x26')](saveUpdates(_0x1696f1['body'],null))[_0xe1b0('0x26')](respondWithResult(_0x5b3cba,null))['catch'](handleError(_0x5b3cba,null));};exports[_0xe1b0('0x4b')]=function(_0x1e925b,_0x17e0be,_0x20c234){var _0x3ae3c4=require(_0xe1b0('0x4c'));var _0x2803e1=![];var _0x205e58={};if(_0x1e925b['query'][_0xe1b0('0x30')]&&_0x1e925b[_0xe1b0('0x33')][_0xe1b0('0x30')]===_0xe1b0('0x4d')){_0x205e58[_0xe1b0('0x4d')]=_0x1e925b[_0xe1b0('0x44')]['id'];}else{_0x205e58['id']=_0x1e925b[_0xe1b0('0x44')]['id'];}return db['SquareRecording']['find']({'where':_0x205e58,'attributes':['id',_0xe1b0('0x4e'),_0xe1b0('0x4f')],'raw':!![]})[_0xe1b0('0x26')](handleEntityNotFound(_0x17e0be,null))[_0xe1b0('0x26')](function(_0x38aebb){if(_0x38aebb){var _0x17e33b=_0x38aebb[_0xe1b0('0x4e')];var _0x4f613f=util[_0xe1b0('0x50')](_0xe1b0('0x51'),_0x17e33b);if(fs[_0xe1b0('0x52')](_0x4f613f)){_0x2803e1=!![];return _0x3ae3c4['decryptFile'](_0x4f613f,_0x17e33b,config[_0xe1b0('0x53')]['recording'])[_0xe1b0('0x26')](function(){return _0x38aebb;});}return _0x38aebb;}})[_0xe1b0('0x26')](function(_0x12f901){if(_0x12f901){var _0x13d4a1=_0x12f901[_0xe1b0('0x4e')];if(!fs[_0xe1b0('0x52')](_0x13d4a1)){throw new db['Sequelize'][(_0xe1b0('0x54'))]('SquareRecording\x20not\x20found');}if(_0x12f901[_0xe1b0('0x4f')]){return _0x17e0be[_0xe1b0('0x4b')](_0x13d4a1,_0x12f901[_0xe1b0('0x4f')]+path[_0xe1b0('0x55')](_0x13d4a1),function(){if(_0x2803e1){fs[_0xe1b0('0x56')](_0x13d4a1);}});}else{return _0x17e0be['download'](_0x13d4a1,function(_0x32a769){if(_0x2803e1){fs['unlink'](_0x13d4a1);}});}}})[_0xe1b0('0x49')](function(_0x4cff3a){if(_0x4cff3a[_0xe1b0('0x57')]===_0xe1b0('0x58')){_0x17e0be[_0xe1b0('0x1a')](0x194)[_0xe1b0('0x2a')](_0xe1b0('0x59'));}else{return handleError(_0x17e0be,null);}});};exports['destroy']=function(_0x43ce6d,_0x568d9a){return db['SquareRecording'][_0xe1b0('0x47')]({'where':{'id':_0x43ce6d[_0xe1b0('0x44')]['id']}})[_0xe1b0('0x26')](function(_0x2f7c84){if(_[_0xe1b0('0x5a')](_0x2f7c84)){throw new ReferenceError(_0xe1b0('0x5b'));}return _0x2f7c84;})[_0xe1b0('0x26')](function(_0x224804){var _0x1be05b=_0x224804[_0xe1b0('0x4e')];logger[_0xe1b0('0x5c')](_0xe1b0('0x5d'),_0x1be05b);if(!_[_0xe1b0('0x5a')](_0x224804[_0xe1b0('0x4e')])&&fs[_0xe1b0('0x52')](_0x1be05b)){logger[_0xe1b0('0x5c')](_0xe1b0('0x5e')+_0x1be05b+_0xe1b0('0x5f'));fs[_0xe1b0('0x60')](_0x1be05b);}_0x1be05b=_0x1be05b+_0xe1b0('0x61');if(!_[_0xe1b0('0x5a')](_0x224804[_0xe1b0('0x4e')])&&fs[_0xe1b0('0x52')](_0x1be05b)){logger[_0xe1b0('0x5c')](_0xe1b0('0x5e')+_0x1be05b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe1b0('0x60')](_0x1be05b);}return _0x224804;})[_0xe1b0('0x26')](function(_0x337cdf){if(!_0x337cdf)throw new InternalError();return _0x337cdf['destroy']();})[_0xe1b0('0x26')](function(){_0x568d9a[_0xe1b0('0x1a')](0xcc)[_0xe1b0('0x1b')]();})['catch'](handleError(_0x568d9a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 75b81e0..f6310d2 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 _0xd9ce=['square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x14cba0,_0x1db963){var _0x4da603=function(_0x375b5b){while(--_0x375b5b){_0x14cba0['push'](_0x14cba0['shift']());}};_0x4da603(++_0x1db963);}(_0xd9ce,0xeb));var _0xed9c=function(_0x1097d7,_0x1bf6df){_0x1097d7=_0x1097d7-0x0;var _0x140177=_0xd9ce[_0x1097d7];return _0x140177;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var logger=require(_0xed9c('0x2'))(_0xed9c('0x3'));var moment=require(_0xed9c('0x4'));var BPromise=require(_0xed9c('0x5'));var rp=require(_0xed9c('0x6'));var fs=require('fs');var path=require(_0xed9c('0x7'));var rimraf=require('rimraf');var config=require(_0xed9c('0x8'));var attributes=require(_0xed9c('0x9'));module[_0xed9c('0xa')]=function(_0x154e9d,_0x3043a6){return _0x154e9d[_0xed9c('0xb')]('SquareRecording',attributes,{'tableName':_0xed9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ef=['request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','util','../../config/logger','moment','bluebird'];(function(_0x5659c0,_0x5f2532){var _0x36e3c0=function(_0x247a5f){while(--_0x247a5f){_0x5659c0['push'](_0x5659c0['shift']());}};_0x36e3c0(++_0x5f2532);}(_0x15ef,0x80));var _0xf15e=function(_0x200696,_0x29fbff){_0x200696=_0x200696-0x0;var _0x974349=_0x15ef[_0x200696];return _0x974349;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var logger=require(_0xf15e('0x1'))('api');var moment=require(_0xf15e('0x2'));var BPromise=require(_0xf15e('0x3'));var rp=require(_0xf15e('0x4'));var fs=require('fs');var path=require(_0xf15e('0x5'));var rimraf=require(_0xf15e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf15e('0x7'));module[_0xf15e('0x8')]=function(_0x5e96b4,_0x5ba863){return _0x5e96b4[_0xf15e('0x9')](_0xf15e('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 9cdb7ba..0d38f33 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 _0x9ae3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','moment','bluebird'];(function(_0x20e859,_0x68926d){var _0x23622d=function(_0x527ccf){while(--_0x527ccf){_0x20e859['push'](_0x20e859['shift']());}};_0x23622d(++_0x68926d);}(_0x9ae3,0xf1));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39ae('0x0'));var BPromise=require(_0x39ae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39ae('0x2'));var db=require(_0x39ae('0x3'))['db'];var utils=require(_0x39ae('0x4'));var logger=require(_0x39ae('0x5'))('rpc');var config=require(_0x39ae('0x6'));var jayson=require(_0x39ae('0x7'));var client=jayson[_0x39ae('0x8')][_0x39ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b4538,_0x264f14,_0x504fbd){return new BPromise(function(_0x2e7196,_0x224521){return client[_0x39ae('0xa')](_0x4b4538,_0x504fbd)[_0x39ae('0xb')](function(_0xf2d7cc){logger[_0x39ae('0xc')](_0x39ae('0xd'),_0x264f14,_0x39ae('0xe'));logger[_0x39ae('0xf')](_0x39ae('0x10'),_0x264f14,_0x39ae('0xe'),JSON[_0x39ae('0x11')](_0xf2d7cc));if(_0xf2d7cc['error']){if(_0xf2d7cc['error']['code']===0x1f4){logger[_0x39ae('0x12')](_0x39ae('0xd'),_0x264f14,_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);return _0x224521(_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);}logger[_0x39ae('0x12')]('SquareRecording,\x20%s,\x20%s',_0x264f14,_0xf2d7cc['error'][_0x39ae('0x13')]);return _0x2e7196(_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x264f14,_0x39ae('0xe'));_0x2e7196(_0xf2d7cc['result'][_0x39ae('0x13')]);}})[_0x39ae('0x14')](function(_0x146abe){logger[_0x39ae('0x12')](_0x39ae('0xd'),_0x264f14,_0x146abe);_0x224521(_0x146abe);});});}exports[_0x39ae('0x15')]=function(_0x2c5103){var _0x114be4=this;return new Promise(function(_0x42d426,_0x59ab1d){return db[_0x39ae('0x16')][_0x39ae('0x17')](_0x2c5103[_0x39ae('0x18')],{'raw':_0x2c5103[_0x39ae('0x19')]?_0x2c5103[_0x39ae('0x19')][_0x39ae('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x584ff8){logger[_0x39ae('0xc')](_0x39ae('0x15'),_0x2c5103);logger[_0x39ae('0xf')](_0x39ae('0x15'),_0x2c5103,JSON[_0x39ae('0x11')](_0x584ff8));_0x42d426(_0x584ff8);})[_0x39ae('0x14')](function(_0xb27655){logger[_0x39ae('0x12')]('CreateSquareRecording',_0xb27655['message'],_0x2c5103);_0x59ab1d(_0x114be4['error'](0x1f4,_0xb27655[_0x39ae('0x13')]));});});}; \ No newline at end of file +var _0x8c97=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','stringify'];(function(_0x48b6c6,_0xba4073){var _0x1bcc9a=function(_0x581c84){while(--_0x581c84){_0x48b6c6['push'](_0x48b6c6['shift']());}};_0x1bcc9a(++_0xba4073);}(_0x8c97,0x1e6));var _0x78c9=function(_0x5220a1,_0x474db8){_0x5220a1=_0x5220a1-0x0;var _0x2b9bd2=_0x8c97[_0x5220a1];return _0x2b9bd2;};'use strict';var _=require('lodash');var util=require(_0x78c9('0x0'));var moment=require(_0x78c9('0x1'));var BPromise=require(_0x78c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78c9('0x3'));var db=require(_0x78c9('0x4'))['db'];var utils=require(_0x78c9('0x5'));var logger=require(_0x78c9('0x6'))(_0x78c9('0x7'));var config=require(_0x78c9('0x8'));var jayson=require(_0x78c9('0x9'));var client=jayson[_0x78c9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaf0f74,_0x47bc9f,_0x3fcede){return new BPromise(function(_0x5828f3,_0x209e46){return client['request'](_0xaf0f74,_0x3fcede)['then'](function(_0x48e3cd){logger['info']('SquareRecording,\x20%s,\x20%s',_0x47bc9f,_0x78c9('0xb'));logger[_0x78c9('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x47bc9f,_0x78c9('0xb'),JSON['stringify'](_0x48e3cd));if(_0x48e3cd[_0x78c9('0xd')]){if(_0x48e3cd[_0x78c9('0xd')][_0x78c9('0xe')]===0x1f4){logger[_0x78c9('0xd')]('SquareRecording,\x20%s,\x20%s',_0x47bc9f,_0x48e3cd[_0x78c9('0xd')][_0x78c9('0xf')]);return _0x209e46(_0x48e3cd[_0x78c9('0xd')][_0x78c9('0xf')]);}logger[_0x78c9('0xd')]('SquareRecording,\x20%s,\x20%s',_0x47bc9f,_0x48e3cd[_0x78c9('0xd')][_0x78c9('0xf')]);return _0x5828f3(_0x48e3cd[_0x78c9('0xd')][_0x78c9('0xf')]);}else{logger['info'](_0x78c9('0x10'),_0x47bc9f,_0x78c9('0xb'));_0x5828f3(_0x48e3cd[_0x78c9('0x11')][_0x78c9('0xf')]);}})[_0x78c9('0x12')](function(_0x26f185){logger[_0x78c9('0xd')](_0x78c9('0x10'),_0x47bc9f,_0x26f185);_0x209e46(_0x26f185);});});}exports[_0x78c9('0x13')]=function(_0x28048a){var _0x312d8b=this;return new Promise(function(_0x28bed9,_0x2252c3){return db[_0x78c9('0x14')][_0x78c9('0x15')](_0x28048a[_0x78c9('0x16')],{'raw':_0x28048a[_0x78c9('0x17')]?_0x28048a['options'][_0x78c9('0x18')]===undefined?!![]:![]:!![]})[_0x78c9('0x19')](function(_0xeafb30){logger['info'](_0x78c9('0x13'),_0x28048a);logger['debug'](_0x78c9('0x13'),_0x28048a,JSON[_0x78c9('0x1a')](_0xeafb30));_0x28bed9(_0xeafb30);})['catch'](function(_0x42d1bf){logger[_0x78c9('0xd')](_0x78c9('0x13'),_0x42d1bf[_0x78c9('0xf')],_0x28048a);_0x2252c3(_0x312d8b['error'](0x1f4,_0x42d1bf[_0x78c9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 520f4b5..d26b36d 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1d2a1a,_0x44c78f){var _0x2173c2=function(_0x17ba21){while(--_0x17ba21){_0x1d2a1a['push'](_0x1d2a1a['shift']());}};_0x2173c2(++_0x44c78f);}(_0xb10b,0x12a));var _0xbb10=function(_0x599570,_0x460668){_0x599570=_0x599570-0x0;var _0x3d743f=_0xb10b[_0x599570];return _0x3d743f;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 678a6bc..a33a0d6 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 _0x3183=['BOOLEAN','STRING','DATE'];(function(_0x244dd0,_0x2b2073){var _0x5f123e=function(_0x303249){while(--_0x303249){_0x244dd0['push'](_0x244dd0['shift']());}};_0x5f123e(++_0x2b2073);}(_0x3183,0x10f));var _0x3318=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3183[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3318('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3318('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3318('0x0')]},'uniqueid':{'type':Sequelize[_0x3318('0x0')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3318('0x0')]},'calleridname':{'type':Sequelize[_0x3318('0x0')]},'callingpres':{'type':Sequelize[_0x3318('0x0')]},'callingani2':{'type':Sequelize[_0x3318('0x0')]},'callington':{'type':Sequelize[_0x3318('0x0')]},'callingtns':{'type':Sequelize[_0x3318('0x0')]},'dnid':{'type':Sequelize[_0x3318('0x0')]},'rdnis':{'type':Sequelize[_0x3318('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3318('0x0')]},'priority':{'type':Sequelize[_0x3318('0x0')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3318('0x0')]},'threadid':{'type':Sequelize[_0x3318('0x0')]},'project_name':{'type':Sequelize[_0x3318('0x0')]},'joinAt':{'type':Sequelize[_0x3318('0x1')]},'leaveAt':{'type':Sequelize[_0x3318('0x1')]},'bot':{'type':Sequelize[_0x3318('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xda59=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x4687c3,_0x27c841){var _0xf055e6=function(_0x39d1f7){while(--_0x39d1f7){_0x4687c3['push'](_0x4687c3['shift']());}};_0xf055e6(++_0x27c841);}(_0xda59,0x66));var _0x9da5=function(_0x5068ef,_0xf0f7c4){_0x5068ef=_0x5068ef-0x0;var _0x41f6d1=_0xda59[_0x5068ef];return _0x41f6d1;};'use strict';var Sequelize=require(_0x9da5('0x0'));module[_0x9da5('0x1')]={'network':{'type':Sequelize[_0x9da5('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x9da5('0x2')]},'channel':{'type':Sequelize[_0x9da5('0x2')]},'language':{'type':Sequelize[_0x9da5('0x2')]},'type':{'type':Sequelize[_0x9da5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x9da5('0x2')]},'callerid':{'type':Sequelize[_0x9da5('0x2')]},'calleridname':{'type':Sequelize[_0x9da5('0x2')]},'callingpres':{'type':Sequelize[_0x9da5('0x2')]},'callingani2':{'type':Sequelize[_0x9da5('0x2')]},'callington':{'type':Sequelize[_0x9da5('0x2')]},'callingtns':{'type':Sequelize[_0x9da5('0x2')]},'dnid':{'type':Sequelize[_0x9da5('0x2')]},'rdnis':{'type':Sequelize[_0x9da5('0x2')]},'context':{'type':Sequelize[_0x9da5('0x2')]},'extension':{'type':Sequelize[_0x9da5('0x2')]},'priority':{'type':Sequelize[_0x9da5('0x2')]},'enhanced':{'type':Sequelize[_0x9da5('0x2')]},'accountcode':{'type':Sequelize[_0x9da5('0x2')]},'threadid':{'type':Sequelize[_0x9da5('0x2')]},'project_name':{'type':Sequelize[_0x9da5('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9da5('0x3')]},'bot':{'type':Sequelize[_0x9da5('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 01e519a..3812579 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 _0x4ae3=['findAll','rows','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae3,0x179));var _0x34ae=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x4ae3[_0x282320];return _0x271d54;};'use strict';var emlformat=require(_0x34ae('0x0'));var rimraf=require(_0x34ae('0x1'));var zipdir=require(_0x34ae('0x2'));var jsonpatch=require(_0x34ae('0x3'));var rp=require('request-promise');var moment=require(_0x34ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ae('0x5'));var util=require('util');var path=require(_0x34ae('0x6'));var sox=require(_0x34ae('0x7'));var csv=require(_0x34ae('0x8'));var ejs=require(_0x34ae('0x9'));var fs=require('fs');var fs_extra=require(_0x34ae('0xa'));var _=require(_0x34ae('0xb'));var squel=require(_0x34ae('0xc'));var crypto=require('crypto');var jsforce=require(_0x34ae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x34ae('0x8'));var querystring=require(_0x34ae('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ae('0xf'));var authService=require(_0x34ae('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x34ae('0x11'))('api');var utils=require(_0x34ae('0x12'));var config=require(_0x34ae('0x13'));var licenseUtil=require(_0x34ae('0x14'));var db=require(_0x34ae('0x15'))['db'];function respondWithStatusCode(_0x1533aa,_0x122fcf){_0x122fcf=_0x122fcf||0xcc;return function(_0x168bbf){if(_0x168bbf){return _0x1533aa['sendStatus'](_0x122fcf);}return _0x1533aa[_0x34ae('0x16')](_0x122fcf)[_0x34ae('0x17')]();};}function respondWithResult(_0x194ef2,_0x51bff1){_0x51bff1=_0x51bff1||0xc8;return function(_0x53d3d6){if(_0x53d3d6){return _0x194ef2[_0x34ae('0x16')](_0x51bff1)[_0x34ae('0x18')](_0x53d3d6);}};}function respondWithFilteredResult(_0x231fed,_0xd370b1){return function(_0xde0b91){if(_0xde0b91){var _0x4bb676=typeof _0xd370b1[_0x34ae('0x19')]===_0x34ae('0x1a')&&typeof _0xd370b1[_0x34ae('0x1b')]===_0x34ae('0x1a');var _0x12e825=_0xde0b91[_0x34ae('0x1c')];var _0x119361=_0x4bb676?0x0:_0xd370b1[_0x34ae('0x19')];var _0xd115a9=_0x4bb676?_0xde0b91['count']:_0xd370b1[_0x34ae('0x19')]+_0xd370b1[_0x34ae('0x1b')];var _0x3accc3;if(_0xd115a9>=_0x12e825){_0xd115a9=_0x12e825;_0x3accc3=0xc8;}else{_0x3accc3=0xce;}_0x231fed['status'](_0x3accc3);return _0x231fed[_0x34ae('0x1d')](_0x34ae('0x1e'),_0x119361+'-'+_0xd115a9+'/'+_0x12e825)[_0x34ae('0x18')](_0xde0b91);}return null;};}function patchUpdates(_0x47f593){return function(_0x4777e9){try{jsonpatch[_0x34ae('0x1f')](_0x4777e9,_0x47f593,!![]);}catch(_0x113cc5){return BPromise[_0x34ae('0x20')](_0x113cc5);}return _0x4777e9[_0x34ae('0x21')]();};}function saveUpdates(_0x92a607,_0x1f6a7d){return function(_0x118e03){if(_0x118e03){return _0x118e03[_0x34ae('0x22')](_0x92a607)[_0x34ae('0x23')](function(_0x277360){return _0x277360;});}return null;};}function removeEntity(_0x1f0a14,_0x1a80a6){return function(_0x422723){if(_0x422723){return _0x422723[_0x34ae('0x24')]()[_0x34ae('0x23')](function(){_0x1f0a14[_0x34ae('0x16')](0xcc)[_0x34ae('0x17')]();});}};}function handleEntityNotFound(_0x3b1bbc,_0x3253cf){return function(_0x13b6fb){if(!_0x13b6fb){_0x3b1bbc['sendStatus'](0x194);}return _0x13b6fb;};}function handleError(_0x24b03e,_0x5653a9){_0x5653a9=_0x5653a9||0x1f4;return function(_0xa5161){logger[_0x34ae('0x25')](_0xa5161[_0x34ae('0x26')]);if(_0xa5161[_0x34ae('0x27')]){delete _0xa5161[_0x34ae('0x27')];}_0x24b03e['status'](_0x5653a9)[_0x34ae('0x28')](_0xa5161);};}exports[_0x34ae('0x29')]=function(_0x19a46d,_0x1e41d4){var _0x24a549={},_0x45c4a1={},_0x58dc85={'count':0x0,'rows':[]};var _0xb4a49c=_['map'](db[_0x34ae('0x2a')][_0x34ae('0x2b')],function(_0x57e8c7){return{'name':_0x57e8c7[_0x34ae('0x2c')],'type':_0x57e8c7[_0x34ae('0x2d')][_0x34ae('0x2e')]};});_0x45c4a1[_0x34ae('0x2f')]=_[_0x34ae('0x30')](_0xb4a49c,'name');_0x45c4a1[_0x34ae('0x31')]=_[_0x34ae('0x32')](_0x19a46d[_0x34ae('0x31')]);_0x45c4a1['filters']=_[_0x34ae('0x33')](_0x45c4a1[_0x34ae('0x2f')],_0x45c4a1['query']);_0x24a549[_0x34ae('0x34')]=_[_0x34ae('0x33')](_0x45c4a1['model'],qs[_0x34ae('0x35')](_0x19a46d[_0x34ae('0x31')][_0x34ae('0x35')]));_0x24a549[_0x34ae('0x34')]=_0x24a549[_0x34ae('0x34')][_0x34ae('0x36')]?_0x24a549['attributes']:_0x45c4a1[_0x34ae('0x2f')];if(!_0x19a46d[_0x34ae('0x31')][_0x34ae('0x37')]('nolimit')){_0x24a549[_0x34ae('0x1b')]=qs[_0x34ae('0x1b')](_0x19a46d[_0x34ae('0x31')]['limit']);_0x24a549['offset']=qs[_0x34ae('0x19')](_0x19a46d[_0x34ae('0x31')]['offset']);}_0x24a549[_0x34ae('0x38')]=qs[_0x34ae('0x39')](_0x19a46d[_0x34ae('0x31')][_0x34ae('0x39')]);_0x24a549[_0x34ae('0x3a')]=qs[_0x34ae('0x3b')](_[_0x34ae('0x3c')](_0x19a46d[_0x34ae('0x31')],_0x45c4a1[_0x34ae('0x3b')]),_0xb4a49c);if(_0x19a46d[_0x34ae('0x31')][_0x34ae('0x3d')]){_0x24a549[_0x34ae('0x3a')]=_['merge'](_0x24a549[_0x34ae('0x3a')],{'$or':_[_0x34ae('0x30')](_0xb4a49c,function(_0x1a255f){if(_0x1a255f[_0x34ae('0x2d')]!==_0x34ae('0x3e')){var _0x11eb36={};_0x11eb36[_0x1a255f[_0x34ae('0x27')]]={'$like':'%'+_0x19a46d[_0x34ae('0x31')][_0x34ae('0x3d')]+'%'};return _0x11eb36;}})});}_0x24a549=_[_0x34ae('0x3f')]({},_0x24a549,_0x19a46d[_0x34ae('0x40')]);var _0xf7a1ec={'where':_0x24a549['where']};return db[_0x34ae('0x2a')][_0x34ae('0x1c')](_0xf7a1ec)[_0x34ae('0x23')](function(_0x1743c7){_0x58dc85[_0x34ae('0x1c')]=_0x1743c7;if(_0x19a46d[_0x34ae('0x31')][_0x34ae('0x41')]){_0x24a549[_0x34ae('0x42')]=[{'all':!![]}];}return db[_0x34ae('0x2a')][_0x34ae('0x43')](_0x24a549);})['then'](function(_0x44d769){_0x58dc85[_0x34ae('0x44')]=_0x44d769;return _0x58dc85;})[_0x34ae('0x23')](respondWithFilteredResult(_0x1e41d4,_0x24a549))['catch'](handleError(_0x1e41d4,null));};exports['show']=function(_0x5374e9,_0xe240d2){var _0x1a397f={'raw':!![],'where':{'id':_0x5374e9[_0x34ae('0x45')]['id']}},_0x3774dc={};_0x3774dc[_0x34ae('0x2f')]=_[_0x34ae('0x32')](db[_0x34ae('0x2a')][_0x34ae('0x2b')]);_0x3774dc[_0x34ae('0x31')]=_[_0x34ae('0x32')](_0x5374e9['query']);_0x3774dc[_0x34ae('0x3b')]=_[_0x34ae('0x33')](_0x3774dc[_0x34ae('0x2f')],_0x3774dc[_0x34ae('0x31')]);_0x1a397f[_0x34ae('0x34')]=_[_0x34ae('0x33')](_0x3774dc[_0x34ae('0x2f')],qs[_0x34ae('0x35')](_0x5374e9['query'][_0x34ae('0x35')]));_0x1a397f['attributes']=_0x1a397f['attributes'][_0x34ae('0x36')]?_0x1a397f[_0x34ae('0x34')]:_0x3774dc[_0x34ae('0x2f')];if(_0x5374e9[_0x34ae('0x31')][_0x34ae('0x41')]){_0x1a397f[_0x34ae('0x42')]=[{'all':!![]}];}_0x1a397f=_[_0x34ae('0x3f')]({},_0x1a397f,_0x5374e9['options']);return db[_0x34ae('0x2a')]['find'](_0x1a397f)[_0x34ae('0x23')](handleEntityNotFound(_0xe240d2,null))[_0x34ae('0x23')](respondWithResult(_0xe240d2,null))[_0x34ae('0x46')](handleError(_0xe240d2,null));};exports['create']=function(_0x19db28,_0x517d8a){return db[_0x34ae('0x2a')]['create'](_0x19db28[_0x34ae('0x47')],{})['then'](respondWithResult(_0x517d8a,0xc9))[_0x34ae('0x46')](handleError(_0x517d8a,null));};exports[_0x34ae('0x22')]=function(_0xec00df,_0x591483){if(_0xec00df[_0x34ae('0x47')]['id']){delete _0xec00df[_0x34ae('0x47')]['id'];}return db[_0x34ae('0x2a')][_0x34ae('0x48')]({'where':{'id':_0xec00df['params']['id']}})[_0x34ae('0x23')](handleEntityNotFound(_0x591483,null))[_0x34ae('0x23')](saveUpdates(_0xec00df[_0x34ae('0x47')],null))[_0x34ae('0x23')](respondWithResult(_0x591483,null))[_0x34ae('0x46')](handleError(_0x591483,null));};exports['destroy']=function(_0x42d988,_0x3a384b){return db[_0x34ae('0x2a')][_0x34ae('0x48')]({'where':{'id':_0x42d988[_0x34ae('0x45')]['id']}})[_0x34ae('0x23')](handleEntityNotFound(_0x3a384b,null))['then'](removeEntity(_0x3a384b,null))['catch'](handleError(_0x3a384b,null));};exports['describe']=function(_0x4d4916,_0x73e214){return db[_0x34ae('0x2a')][_0x34ae('0x49')]()[_0x34ae('0x23')](respondWithResult(_0x73e214,null))['catch'](handleError(_0x73e214,null));}; \ No newline at end of file +var _0xd00d=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','includeAll','include','findAll','show','params','options','create','body','catch','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x460316,_0x576130){var _0x1f417d=function(_0x41486d){while(--_0x41486d){_0x460316['push'](_0x460316['shift']());}};_0x1f417d(++_0x576130);}(_0xd00d,0xc6));var _0xdd00=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xd00d[_0x52b7b9];return _0x5b5d30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd00('0x0'));var zipdir=require(_0xdd00('0x1'));var jsonpatch=require(_0xdd00('0x2'));var rp=require(_0xdd00('0x3'));var moment=require(_0xdd00('0x4'));var BPromise=require(_0xdd00('0x5'));var Mustache=require('mustache');var util=require(_0xdd00('0x6'));var path=require(_0xdd00('0x7'));var sox=require(_0xdd00('0x8'));var csv=require(_0xdd00('0x9'));var ejs=require(_0xdd00('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd00('0xb'));var crypto=require(_0xdd00('0xc'));var jsforce=require(_0xdd00('0xd'));var deskjs=require(_0xdd00('0xe'));var toCsv=require(_0xdd00('0x9'));var querystring=require('querystring');var Papa=require(_0xdd00('0xf'));var Redis=require('ioredis');var authService=require(_0xdd00('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdd00('0x11'));var hardwareService=require(_0xdd00('0x12'));var logger=require(_0xdd00('0x13'))('api');var utils=require(_0xdd00('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdd00('0x15'));var db=require(_0xdd00('0x16'))['db'];function respondWithStatusCode(_0x532134,_0x54bf10){_0x54bf10=_0x54bf10||0xcc;return function(_0x55d782){if(_0x55d782){return _0x532134[_0xdd00('0x17')](_0x54bf10);}return _0x532134[_0xdd00('0x18')](_0x54bf10)[_0xdd00('0x19')]();};}function respondWithResult(_0x27c6fb,_0xf23d31){_0xf23d31=_0xf23d31||0xc8;return function(_0x2bc9ae){if(_0x2bc9ae){return _0x27c6fb['status'](_0xf23d31)['json'](_0x2bc9ae);}};}function respondWithFilteredResult(_0x48fff6,_0x10be43){return function(_0x2f5622){if(_0x2f5622){var _0x5bdd1f=typeof _0x10be43[_0xdd00('0x1a')]==='undefined'&&typeof _0x10be43['limit']===_0xdd00('0x1b');var _0x73aba6=_0x2f5622[_0xdd00('0x1c')];var _0x9ae519=_0x5bdd1f?0x0:_0x10be43[_0xdd00('0x1a')];var _0x449e96=_0x5bdd1f?_0x2f5622[_0xdd00('0x1c')]:_0x10be43[_0xdd00('0x1a')]+_0x10be43[_0xdd00('0x1d')];var _0x1a003c;if(_0x449e96>=_0x73aba6){_0x449e96=_0x73aba6;_0x1a003c=0xc8;}else{_0x1a003c=0xce;}_0x48fff6[_0xdd00('0x18')](_0x1a003c);return _0x48fff6[_0xdd00('0x1e')]('Content-Range',_0x9ae519+'-'+_0x449e96+'/'+_0x73aba6)['json'](_0x2f5622);}return null;};}function patchUpdates(_0x567a2c){return function(_0x55c110){try{jsonpatch[_0xdd00('0x1f')](_0x55c110,_0x567a2c,!![]);}catch(_0x599bda){return BPromise[_0xdd00('0x20')](_0x599bda);}return _0x55c110[_0xdd00('0x21')]();};}function saveUpdates(_0x3c052e,_0x517b19){return function(_0x2b9428){if(_0x2b9428){return _0x2b9428[_0xdd00('0x22')](_0x3c052e)['then'](function(_0x3ddcc4){return _0x3ddcc4;});}return null;};}function removeEntity(_0x4902b2,_0x2bd782){return function(_0x42b8c3){if(_0x42b8c3){return _0x42b8c3['destroy']()[_0xdd00('0x23')](function(){_0x4902b2[_0xdd00('0x18')](0xcc)[_0xdd00('0x19')]();});}};}function handleEntityNotFound(_0x542884,_0x158183){return function(_0x13b2e7){if(!_0x13b2e7){_0x542884['sendStatus'](0x194);}return _0x13b2e7;};}function handleError(_0x41cf5a,_0x5dd7e6){_0x5dd7e6=_0x5dd7e6||0x1f4;return function(_0x40b8b7){logger['error'](_0x40b8b7[_0xdd00('0x24')]);if(_0x40b8b7[_0xdd00('0x25')]){delete _0x40b8b7['name'];}_0x41cf5a[_0xdd00('0x18')](_0x5dd7e6)[_0xdd00('0x26')](_0x40b8b7);};}exports[_0xdd00('0x27')]=function(_0x3d1873,_0x1f4b10){var _0x5d940c={},_0x524a3a={},_0x1832c6={'count':0x0,'rows':[]};var _0x56ee0f=_['map'](db[_0xdd00('0x28')][_0xdd00('0x29')],function(_0x57c007){return{'name':_0x57c007['fieldName'],'type':_0x57c007[_0xdd00('0x2a')][_0xdd00('0x2b')]};});_0x524a3a[_0xdd00('0x2c')]=_['map'](_0x56ee0f,_0xdd00('0x25'));_0x524a3a[_0xdd00('0x2d')]=_[_0xdd00('0x2e')](_0x3d1873[_0xdd00('0x2d')]);_0x524a3a[_0xdd00('0x2f')]=_[_0xdd00('0x30')](_0x524a3a[_0xdd00('0x2c')],_0x524a3a['query']);_0x5d940c[_0xdd00('0x31')]=_[_0xdd00('0x30')](_0x524a3a[_0xdd00('0x2c')],qs[_0xdd00('0x32')](_0x3d1873[_0xdd00('0x2d')][_0xdd00('0x32')]));_0x5d940c[_0xdd00('0x31')]=_0x5d940c[_0xdd00('0x31')][_0xdd00('0x33')]?_0x5d940c[_0xdd00('0x31')]:_0x524a3a[_0xdd00('0x2c')];if(!_0x3d1873['query']['hasOwnProperty'](_0xdd00('0x34'))){_0x5d940c[_0xdd00('0x1d')]=qs[_0xdd00('0x1d')](_0x3d1873[_0xdd00('0x2d')][_0xdd00('0x1d')]);_0x5d940c['offset']=qs[_0xdd00('0x1a')](_0x3d1873[_0xdd00('0x2d')][_0xdd00('0x1a')]);}_0x5d940c[_0xdd00('0x35')]=qs[_0xdd00('0x36')](_0x3d1873['query']['sort']);_0x5d940c['where']=qs['filters'](_[_0xdd00('0x37')](_0x3d1873[_0xdd00('0x2d')],_0x524a3a[_0xdd00('0x2f')]),_0x56ee0f);if(_0x3d1873[_0xdd00('0x2d')][_0xdd00('0x38')]){_0x5d940c[_0xdd00('0x39')]=_['merge'](_0x5d940c[_0xdd00('0x39')],{'$or':_[_0xdd00('0x3a')](_0x56ee0f,function(_0x30977f){if(_0x30977f[_0xdd00('0x2a')]!=='VIRTUAL'){var _0x5a3f84={};_0x5a3f84[_0x30977f[_0xdd00('0x25')]]={'$like':'%'+_0x3d1873['query'][_0xdd00('0x38')]+'%'};return _0x5a3f84;}})});}_0x5d940c=_[_0xdd00('0x3b')]({},_0x5d940c,_0x3d1873['options']);var _0x157afe={'where':_0x5d940c[_0xdd00('0x39')]};return db['SquareReport'][_0xdd00('0x1c')](_0x157afe)[_0xdd00('0x23')](function(_0x1d689c){_0x1832c6[_0xdd00('0x1c')]=_0x1d689c;if(_0x3d1873[_0xdd00('0x2d')][_0xdd00('0x3c')]){_0x5d940c[_0xdd00('0x3d')]=[{'all':!![]}];}return db[_0xdd00('0x28')][_0xdd00('0x3e')](_0x5d940c);})[_0xdd00('0x23')](function(_0xf4a226){_0x1832c6['rows']=_0xf4a226;return _0x1832c6;})[_0xdd00('0x23')](respondWithFilteredResult(_0x1f4b10,_0x5d940c))['catch'](handleError(_0x1f4b10,null));};exports[_0xdd00('0x3f')]=function(_0x540d9e,_0x591fd8){var _0x167db5={'raw':!![],'where':{'id':_0x540d9e[_0xdd00('0x40')]['id']}},_0x4cf7f0={};_0x4cf7f0[_0xdd00('0x2c')]=_['keys'](db['SquareReport'][_0xdd00('0x29')]);_0x4cf7f0['query']=_['keys'](_0x540d9e[_0xdd00('0x2d')]);_0x4cf7f0[_0xdd00('0x2f')]=_['intersection'](_0x4cf7f0[_0xdd00('0x2c')],_0x4cf7f0[_0xdd00('0x2d')]);_0x167db5[_0xdd00('0x31')]=_[_0xdd00('0x30')](_0x4cf7f0['model'],qs['fields'](_0x540d9e['query'][_0xdd00('0x32')]));_0x167db5[_0xdd00('0x31')]=_0x167db5['attributes'][_0xdd00('0x33')]?_0x167db5[_0xdd00('0x31')]:_0x4cf7f0['model'];if(_0x540d9e['query'][_0xdd00('0x3c')]){_0x167db5[_0xdd00('0x3d')]=[{'all':!![]}];}_0x167db5=_['merge']({},_0x167db5,_0x540d9e[_0xdd00('0x41')]);return db[_0xdd00('0x28')]['find'](_0x167db5)[_0xdd00('0x23')](handleEntityNotFound(_0x591fd8,null))[_0xdd00('0x23')](respondWithResult(_0x591fd8,null))['catch'](handleError(_0x591fd8,null));};exports[_0xdd00('0x42')]=function(_0x4ccd53,_0xc76528){return db[_0xdd00('0x28')]['create'](_0x4ccd53[_0xdd00('0x43')],{})[_0xdd00('0x23')](respondWithResult(_0xc76528,0xc9))[_0xdd00('0x44')](handleError(_0xc76528,null));};exports[_0xdd00('0x22')]=function(_0x3704fa,_0x348315){if(_0x3704fa['body']['id']){delete _0x3704fa[_0xdd00('0x43')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x3704fa['params']['id']}})[_0xdd00('0x23')](handleEntityNotFound(_0x348315,null))[_0xdd00('0x23')](saveUpdates(_0x3704fa[_0xdd00('0x43')],null))[_0xdd00('0x23')](respondWithResult(_0x348315,null))[_0xdd00('0x44')](handleError(_0x348315,null));};exports['destroy']=function(_0x49dcf9,_0x2aa983){return db[_0xdd00('0x28')][_0xdd00('0x45')]({'where':{'id':_0x49dcf9[_0xdd00('0x40')]['id']}})[_0xdd00('0x23')](handleEntityNotFound(_0x2aa983,null))['then'](removeEntity(_0x2aa983,null))['catch'](handleError(_0x2aa983,null));};exports[_0xdd00('0x46')]=function(_0x16813d,_0xeb47ba){return db[_0xdd00('0x28')]['describe']()['then'](respondWithResult(_0xeb47ba,null))[_0xdd00('0x44')](handleError(_0xeb47ba,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 470d416..40f59dd 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 _0x74cc=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt'];(function(_0x26d906,_0x53c612){var _0x178b39=function(_0xbda359){while(--_0xbda359){_0x26d906['push'](_0x26d906['shift']());}};_0x178b39(++_0x53c612);}(_0x74cc,0x78));var _0xc74c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x74cc[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0xc74c('0x0'));var logger=require(_0xc74c('0x1'))(_0xc74c('0x2'));var moment=require(_0xc74c('0x3'));var BPromise=require(_0xc74c('0x4'));var rp=require(_0xc74c('0x5'));var fs=require('fs');var path=require(_0xc74c('0x6'));var rimraf=require('rimraf');var config=require(_0xc74c('0x7'));var attributes=require(_0xc74c('0x8'));module[_0xc74c('0x9')]=function(_0x155f51,_0x5deb66){return _0x155f51[_0xc74c('0xa')]('SquareReport',attributes,{'tableName':_0xc74c('0xb'),'paranoid':![],'indexes':[{'name':_0xc74c('0xc'),'fields':[_0xc74c('0xd'),'project_name']},{'name':_0xc74c('0xe'),'fields':[_0xc74c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf565=['request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api'];(function(_0x2c971d,_0x2cf295){var _0x25587c=function(_0x1deea5){while(--_0x1deea5){_0x2c971d['push'](_0x2c971d['shift']());}};_0x25587c(++_0x2cf295);}(_0xf565,0xac));var _0x5f56=function(_0x3f2af3,_0x449282){_0x3f2af3=_0x3f2af3-0x0;var _0x27562c=_0xf565[_0x3f2af3];return _0x27562c;};'use strict';var _=require(_0x5f56('0x0'));var util=require(_0x5f56('0x1'));var logger=require(_0x5f56('0x2'))(_0x5f56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f56('0x4'));var fs=require('fs');var path=require(_0x5f56('0x5'));var rimraf=require(_0x5f56('0x6'));var config=require(_0x5f56('0x7'));var attributes=require(_0x5f56('0x8'));module[_0x5f56('0x9')]=function(_0x34e8f6,_0x1d67f5){return _0x34e8f6[_0x5f56('0xa')](_0x5f56('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5f56('0xc'),'fields':[_0x5f56('0xd'),_0x5f56('0xe')]},{'name':_0x5f56('0xf'),'fields':[_0x5f56('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 03ef32a..8da763e 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 _0xc218=['body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','options','raw','UpdateSquareReport','SquareReport'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xc218,0xb8));var _0x8c21=function(_0xe66930,_0x2860cf){_0xe66930=_0xe66930-0x0;var _0x348660=_0xc218[_0xe66930];return _0x348660;};'use strict';var _=require(_0x8c21('0x0'));var util=require(_0x8c21('0x1'));var moment=require(_0x8c21('0x2'));var BPromise=require(_0x8c21('0x3'));var rs=require(_0x8c21('0x4'));var fs=require('fs');var Redis=require(_0x8c21('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c21('0x6'));var logger=require(_0x8c21('0x7'))(_0x8c21('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c21('0x9'));var client=jayson[_0x8c21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5a7e,_0x5d42a4,_0x5ec2e8){return new BPromise(function(_0x111e0f,_0xd9cf61){return client[_0x8c21('0xb')](_0x1e5a7e,_0x5ec2e8)[_0x8c21('0xc')](function(_0x5e32d4){logger[_0x8c21('0xd')]('SquareReport,\x20%s,\x20%s',_0x5d42a4,_0x8c21('0xe'));logger[_0x8c21('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5d42a4,'request\x20sent',JSON[_0x8c21('0x10')](_0x5e32d4));if(_0x5e32d4['error']){if(_0x5e32d4[_0x8c21('0x11')]['code']===0x1f4){logger[_0x8c21('0x11')](_0x8c21('0x12'),_0x5d42a4,_0x5e32d4[_0x8c21('0x11')]['message']);return _0xd9cf61(_0x5e32d4[_0x8c21('0x11')][_0x8c21('0x13')]);}logger[_0x8c21('0x11')](_0x8c21('0x12'),_0x5d42a4,_0x5e32d4[_0x8c21('0x11')][_0x8c21('0x13')]);return _0x111e0f(_0x5e32d4['error'][_0x8c21('0x13')]);}else{logger[_0x8c21('0xd')](_0x8c21('0x12'),_0x5d42a4,'request\x20sent');_0x111e0f(_0x5e32d4['result'][_0x8c21('0x13')]);}})[_0x8c21('0x14')](function(_0x5a8a11){logger[_0x8c21('0x11')]('SquareReport,\x20%s,\x20%s',_0x5d42a4,_0x5a8a11);_0xd9cf61(_0x5a8a11);});});}exports[_0x8c21('0x15')]=function(_0xe26b81){var _0x59526a=this;return new Promise(function(_0x46e231,_0x261619){return db['SquareReport']['create'](_0xe26b81['body'],{'raw':_0xe26b81[_0x8c21('0x16')]?_0xe26b81[_0x8c21('0x16')][_0x8c21('0x17')]===undefined?!![]:![]:!![]})[_0x8c21('0xc')](function(_0x26efa4){logger[_0x8c21('0xd')](_0x8c21('0x15'),_0xe26b81);logger[_0x8c21('0xf')](_0x8c21('0x15'),_0xe26b81,JSON[_0x8c21('0x10')](_0x26efa4));_0x46e231(_0x26efa4);})[_0x8c21('0x14')](function(_0x161fb3){logger[_0x8c21('0x11')](_0x8c21('0x15'),_0x161fb3['message'],_0xe26b81);_0x261619(_0x59526a['error'](0x1f4,_0x161fb3[_0x8c21('0x13')]));});});};exports[_0x8c21('0x18')]=function(_0x58583){var _0x3d21ac=this;return new Promise(function(_0x21c7ad,_0xf33c9){return db[_0x8c21('0x19')]['update'](_0x58583[_0x8c21('0x1a')],{'raw':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')][_0x8c21('0x1b')]||null:null,'attributes':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')][_0x8c21('0x1c')]||null:null,'limit':_0x58583[_0x8c21('0x16')]?_0x58583['options'][_0x8c21('0x1d')]||null:null})['then'](function(_0x8495ba){logger['info'](_0x8c21('0x18'),_0x58583);logger[_0x8c21('0xf')](_0x8c21('0x18'),_0x58583,JSON[_0x8c21('0x10')](_0x8495ba));_0x21c7ad(_0x8495ba);})[_0x8c21('0x14')](function(_0x64e34a){logger[_0x8c21('0x11')](_0x8c21('0x18'),_0x64e34a[_0x8c21('0x13')],_0x58583);_0xf33c9(_0x3d21ac['error'](0x1f4,_0x64e34a[_0x8c21('0x13')]));});});}; \ No newline at end of file +var _0x0209=['SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','catch','SquareReport','create','body','options','raw','CreateSquareReport','stringify','UpdateSquareReport','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug'];(function(_0x1290f6,_0x3bf9df){var _0x89158e=function(_0x5eb038){while(--_0x5eb038){_0x1290f6['push'](_0x1290f6['shift']());}};_0x89158e(++_0x3bf9df);}(_0x0209,0x189));var _0x9020=function(_0x1b46a8,_0x27da6d){_0x1b46a8=_0x1b46a8-0x0;var _0x44c92a=_0x0209[_0x1b46a8];return _0x44c92a;};'use strict';var _=require('lodash');var util=require(_0x9020('0x0'));var moment=require(_0x9020('0x1'));var BPromise=require('bluebird');var rs=require(_0x9020('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9020('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9020('0x4'))(_0x9020('0x5'));var config=require(_0x9020('0x6'));var jayson=require(_0x9020('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea940,_0x2955f9,_0xd4d050){return new BPromise(function(_0x40e413,_0x5d0954){return client[_0x9020('0x8')](_0x1ea940,_0xd4d050)[_0x9020('0x9')](function(_0x26a3ba){logger[_0x9020('0xa')]('SquareReport,\x20%s,\x20%s',_0x2955f9,_0x9020('0xb'));logger[_0x9020('0xc')](_0x9020('0xd'),_0x2955f9,_0x9020('0xb'),JSON['stringify'](_0x26a3ba));if(_0x26a3ba[_0x9020('0xe')]){if(_0x26a3ba[_0x9020('0xe')]['code']===0x1f4){logger[_0x9020('0xe')](_0x9020('0xf'),_0x2955f9,_0x26a3ba['error'][_0x9020('0x10')]);return _0x5d0954(_0x26a3ba['error'][_0x9020('0x10')]);}logger[_0x9020('0xe')](_0x9020('0xf'),_0x2955f9,_0x26a3ba[_0x9020('0xe')][_0x9020('0x10')]);return _0x40e413(_0x26a3ba['error'][_0x9020('0x10')]);}else{logger[_0x9020('0xa')](_0x9020('0xf'),_0x2955f9,'request\x20sent');_0x40e413(_0x26a3ba['result']['message']);}})[_0x9020('0x11')](function(_0x47d4d1){logger[_0x9020('0xe')](_0x9020('0xf'),_0x2955f9,_0x47d4d1);_0x5d0954(_0x47d4d1);});});}exports['CreateSquareReport']=function(_0xbb92b8){var _0x3d9a98=this;return new Promise(function(_0x579dc9,_0x1f4bc3){return db[_0x9020('0x12')][_0x9020('0x13')](_0xbb92b8[_0x9020('0x14')],{'raw':_0xbb92b8['options']?_0xbb92b8[_0x9020('0x15')][_0x9020('0x16')]===undefined?!![]:![]:!![]})[_0x9020('0x9')](function(_0xb0515c){logger['info'](_0x9020('0x17'),_0xbb92b8);logger[_0x9020('0xc')](_0x9020('0x17'),_0xbb92b8,JSON[_0x9020('0x18')](_0xb0515c));_0x579dc9(_0xb0515c);})[_0x9020('0x11')](function(_0xe5df0b){logger['error']('CreateSquareReport',_0xe5df0b[_0x9020('0x10')],_0xbb92b8);_0x1f4bc3(_0x3d9a98['error'](0x1f4,_0xe5df0b[_0x9020('0x10')]));});});};exports[_0x9020('0x19')]=function(_0x4155c7){var _0x4183a0=this;return new Promise(function(_0x50e6b4,_0x566f89){return db[_0x9020('0x12')]['update'](_0x4155c7['body'],{'raw':_0x4155c7[_0x9020('0x15')]?_0x4155c7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4155c7['options']?_0x4155c7[_0x9020('0x15')][_0x9020('0x1a')]||null:null,'attributes':_0x4155c7[_0x9020('0x15')]?_0x4155c7[_0x9020('0x15')][_0x9020('0x1b')]||null:null,'limit':_0x4155c7[_0x9020('0x15')]?_0x4155c7[_0x9020('0x15')][_0x9020('0x1c')]||null:null})[_0x9020('0x9')](function(_0x5deeef){logger[_0x9020('0xa')](_0x9020('0x19'),_0x4155c7);logger['debug'](_0x9020('0x19'),_0x4155c7,JSON['stringify'](_0x5deeef));_0x50e6b4(_0x5deeef);})[_0x9020('0x11')](function(_0x45a9f6){logger[_0x9020('0xe')](_0x9020('0x19'),_0x45a9f6[_0x9020('0x10')],_0x4155c7);_0x566f89(_0x4183a0[_0x9020('0xe')](0x1f4,_0x45a9f6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 42b440b..7b0e69e 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 _0x3501=['post','update','delete','multer','path','connect-timeout','express','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1866aa,_0xfd4dd4){var _0x439033=function(_0x4b7f43){while(--_0x4b7f43){_0x1866aa['push'](_0x1866aa['shift']());}};_0x439033(++_0xfd4dd4);}(_0x3501,0x8a));var _0x1350=function(_0x382868,_0xb5acfd){_0x382868=_0x382868-0x0;var _0x43e191=_0x3501[_0x382868];return _0x43e191;};'use strict';var multer=require(_0x1350('0x0'));var util=require('util');var path=require(_0x1350('0x1'));var timeout=require(_0x1350('0x2'));var express=require(_0x1350('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1350('0x4'));var config=require('../../config/environment');var controller=require(_0x1350('0x5'));router[_0x1350('0x6')]('/',auth[_0x1350('0x7')](),controller[_0x1350('0x8')]);router[_0x1350('0x6')](_0x1350('0x9'),auth[_0x1350('0x7')](),controller['describe']);router[_0x1350('0x6')](_0x1350('0xa'),auth['isAuthenticated'](),controller[_0x1350('0xb')]);router[_0x1350('0xc')]('/',auth[_0x1350('0x7')](),controller['create']);router['put'](_0x1350('0xa'),auth['isAuthenticated'](),controller[_0x1350('0xd')]);router[_0x1350('0xe')](_0x1350('0xa'),auth[_0x1350('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe083=['isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','describe'];(function(_0x13f9c3,_0x2036c0){var _0x22185a=function(_0x36a7e6){while(--_0x36a7e6){_0x13f9c3['push'](_0x13f9c3['shift']());}};_0x22185a(++_0x2036c0);}(_0xe083,0x179));var _0x3e08=function(_0x502dbe,_0x49af37){_0x502dbe=_0x502dbe-0x0;var _0x49fd5c=_0xe083[_0x502dbe];return _0x49fd5c;};'use strict';var multer=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var path=require(_0x3e08('0x2'));var timeout=require(_0x3e08('0x3'));var express=require(_0x3e08('0x4'));var router=express[_0x3e08('0x5')]();var fs_extra=require(_0x3e08('0x6'));var auth=require(_0x3e08('0x7'));var interaction=require(_0x3e08('0x8'));var config=require(_0x3e08('0x9'));var controller=require(_0x3e08('0xa'));router[_0x3e08('0xb')]('/',auth['isAuthenticated'](),controller[_0x3e08('0xc')]);router[_0x3e08('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x3e08('0xd')]);router[_0x3e08('0xb')]('/:id',auth[_0x3e08('0xe')](),controller['show']);router[_0x3e08('0xf')]('/',auth['isAuthenticated'](),controller[_0x3e08('0x10')]);router[_0x3e08('0x11')](_0x3e08('0x12'),auth[_0x3e08('0xe')](),controller[_0x3e08('0x13')]);router[_0x3e08('0x14')](_0x3e08('0x12'),auth[_0x3e08('0xe')](),controller[_0x3e08('0x15')]);module[_0x3e08('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 78745f9..8e4a523 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 _0xd09d=['exports','STRING','sequelize'];(function(_0x3727b6,_0x4c3cd3){var _0x23263d=function(_0x155be3){while(--_0x155be3){_0x3727b6['push'](_0x3727b6['shift']());}};_0x23263d(++_0x4c3cd3);}(_0xd09d,0x1a0));var _0xdd09=function(_0x7cc9f5,_0x44951f){_0x7cc9f5=_0x7cc9f5-0x0;var _0x4fdbbf=_0xd09d[_0x7cc9f5];return _0x4fdbbf;};'use strict';var Sequelize=require(_0xdd09('0x0'));module[_0xdd09('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xdd09('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xdd09('0x2')]},'callerid':{'type':Sequelize[_0xdd09('0x2')]}}; \ No newline at end of file +var _0xd697=['TEXT','sequelize','STRING'];(function(_0x359f21,_0x2c0600){var _0x5de42b=function(_0x1242a7){while(--_0x1242a7){_0x359f21['push'](_0x359f21['shift']());}};_0x5de42b(++_0x2c0600);}(_0xd697,0x11b));var _0x7d69=function(_0x3c5fc2,_0x270731){_0x3c5fc2=_0x3c5fc2-0x0;var _0x58ecd8=_0xd697[_0x3c5fc2];return _0x58ecd8;};'use strict';var Sequelize=require(_0x7d69('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7d69('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x7d69('0x2')]},'project_name':{'type':Sequelize[_0x7d69('0x1')]},'callerid':{'type':Sequelize[_0x7d69('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 97e5c72..66fbb59 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 _0x8f23=['rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','create','body','find','describe','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x30579f,_0x45217b){var _0x53b36b=function(_0x4b529a){while(--_0x4b529a){_0x30579f['push'](_0x30579f['shift']());}};_0x53b36b(++_0x45217b);}(_0x8f23,0x1e0));var _0x38f2=function(_0x5e1a7a,_0x4498af){_0x5e1a7a=_0x5e1a7a-0x0;var _0x231e48=_0x8f23[_0x5e1a7a];return _0x231e48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x38f2('0x1'));var Mustache=require(_0x38f2('0x2'));var util=require(_0x38f2('0x3'));var path=require(_0x38f2('0x4'));var sox=require(_0x38f2('0x5'));var csv=require(_0x38f2('0x6'));var ejs=require(_0x38f2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f2('0x8'));var squel=require(_0x38f2('0x9'));var crypto=require(_0x38f2('0xa'));var jsforce=require(_0x38f2('0xb'));var deskjs=require(_0x38f2('0xc'));var toCsv=require(_0x38f2('0x6'));var querystring=require('querystring');var Papa=require(_0x38f2('0xd'));var Redis=require(_0x38f2('0xe'));var authService=require(_0x38f2('0xf'));var qs=require(_0x38f2('0x10'));var as=require(_0x38f2('0x11'));var hardwareService=require(_0x38f2('0x12'));var logger=require(_0x38f2('0x13'))(_0x38f2('0x14'));var utils=require(_0x38f2('0x15'));var config=require(_0x38f2('0x16'));var licenseUtil=require(_0x38f2('0x17'));var db=require(_0x38f2('0x18'))['db'];function respondWithStatusCode(_0x23d888,_0xa6918f){_0xa6918f=_0xa6918f||0xcc;return function(_0x5ccb05){if(_0x5ccb05){return _0x23d888[_0x38f2('0x19')](_0xa6918f);}return _0x23d888[_0x38f2('0x1a')](_0xa6918f)[_0x38f2('0x1b')]();};}function respondWithResult(_0x227f6a,_0x2d7b9c){_0x2d7b9c=_0x2d7b9c||0xc8;return function(_0x135241){if(_0x135241){return _0x227f6a[_0x38f2('0x1a')](_0x2d7b9c)['json'](_0x135241);}};}function respondWithFilteredResult(_0x464080,_0x53761b){return function(_0x421720){if(_0x421720){var _0x129327=typeof _0x53761b[_0x38f2('0x1c')]===_0x38f2('0x1d')&&typeof _0x53761b[_0x38f2('0x1e')]===_0x38f2('0x1d');var _0x30d4e8=_0x421720[_0x38f2('0x1f')];var _0x5e6c5b=_0x129327?0x0:_0x53761b[_0x38f2('0x1c')];var _0x37ba57=_0x129327?_0x421720['count']:_0x53761b[_0x38f2('0x1c')]+_0x53761b[_0x38f2('0x1e')];var _0x3c616f;if(_0x37ba57>=_0x30d4e8){_0x37ba57=_0x30d4e8;_0x3c616f=0xc8;}else{_0x3c616f=0xce;}_0x464080['status'](_0x3c616f);return _0x464080['set'](_0x38f2('0x20'),_0x5e6c5b+'-'+_0x37ba57+'/'+_0x30d4e8)[_0x38f2('0x21')](_0x421720);}return null;};}function patchUpdates(_0x1b4083){return function(_0x3aedaa){try{jsonpatch[_0x38f2('0x22')](_0x3aedaa,_0x1b4083,!![]);}catch(_0x2325ea){return BPromise['reject'](_0x2325ea);}return _0x3aedaa['save']();};}function saveUpdates(_0x5a9270,_0x2ec493){return function(_0x1eee2e){if(_0x1eee2e){return _0x1eee2e[_0x38f2('0x23')](_0x5a9270)[_0x38f2('0x24')](function(_0x5661ff){return _0x5661ff;});}return null;};}function removeEntity(_0x17f432,_0x56adf7){return function(_0x4e9fb4){if(_0x4e9fb4){return _0x4e9fb4[_0x38f2('0x25')]()[_0x38f2('0x24')](function(){_0x17f432['status'](0xcc)[_0x38f2('0x1b')]();});}};}function handleEntityNotFound(_0x78a33,_0x199c19){return function(_0x310f0d){if(!_0x310f0d){_0x78a33[_0x38f2('0x19')](0x194);}return _0x310f0d;};}function handleError(_0x2895de,_0x5d3f90){_0x5d3f90=_0x5d3f90||0x1f4;return function(_0x4a7acb){logger[_0x38f2('0x26')](_0x4a7acb[_0x38f2('0x27')]);if(_0x4a7acb['name']){delete _0x4a7acb[_0x38f2('0x28')];}_0x2895de[_0x38f2('0x1a')](_0x5d3f90)[_0x38f2('0x29')](_0x4a7acb);};}exports[_0x38f2('0x2a')]=function(_0x4bebdb,_0x48436f){var _0x50fd7={},_0x2e9f84={},_0x4ee078={'count':0x0,'rows':[]};var _0x1f4b72=_[_0x38f2('0x2b')](db[_0x38f2('0x2c')][_0x38f2('0x2d')],function(_0x53558e){return{'name':_0x53558e[_0x38f2('0x2e')],'type':_0x53558e[_0x38f2('0x2f')]['key']};});_0x2e9f84['model']=_[_0x38f2('0x2b')](_0x1f4b72,_0x38f2('0x28'));_0x2e9f84['query']=_[_0x38f2('0x30')](_0x4bebdb['query']);_0x2e9f84[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0x2e9f84[_0x38f2('0x33')],_0x2e9f84[_0x38f2('0x34')]);_0x50fd7['attributes']=_[_0x38f2('0x32')](_0x2e9f84[_0x38f2('0x33')],qs[_0x38f2('0x35')](_0x4bebdb['query']['fields']));_0x50fd7[_0x38f2('0x36')]=_0x50fd7[_0x38f2('0x36')][_0x38f2('0x37')]?_0x50fd7['attributes']:_0x2e9f84[_0x38f2('0x33')];if(!_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x38')](_0x38f2('0x39'))){_0x50fd7['limit']=qs['limit'](_0x4bebdb[_0x38f2('0x34')]['limit']);_0x50fd7[_0x38f2('0x1c')]=qs['offset'](_0x4bebdb['query'][_0x38f2('0x1c')]);}_0x50fd7[_0x38f2('0x3a')]=qs[_0x38f2('0x3b')](_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x3b')]);_0x50fd7[_0x38f2('0x3c')]=qs['filters'](_[_0x38f2('0x3d')](_0x4bebdb[_0x38f2('0x34')],_0x2e9f84[_0x38f2('0x31')]),_0x1f4b72);if(_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x3e')]){_0x50fd7[_0x38f2('0x3c')]=_[_0x38f2('0x3f')](_0x50fd7[_0x38f2('0x3c')],{'$or':_[_0x38f2('0x2b')](_0x1f4b72,function(_0x52838d){if(_0x52838d[_0x38f2('0x2f')]!==_0x38f2('0x40')){var _0x1afc3e={};_0x1afc3e[_0x52838d[_0x38f2('0x28')]]={'$like':'%'+_0x4bebdb['query']['filter']+'%'};return _0x1afc3e;}})});}_0x50fd7=_['merge']({},_0x50fd7,_0x4bebdb['options']);var _0x1a1ba5={'where':_0x50fd7['where']};return db[_0x38f2('0x2c')][_0x38f2('0x1f')](_0x1a1ba5)[_0x38f2('0x24')](function(_0x14e2e1){_0x4ee078['count']=_0x14e2e1;if(_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x41')]){_0x50fd7[_0x38f2('0x42')]=[{'all':!![]}];}return db[_0x38f2('0x2c')]['findAll'](_0x50fd7);})[_0x38f2('0x24')](function(_0x85dc1e){_0x4ee078['rows']=_0x85dc1e;return _0x4ee078;})[_0x38f2('0x24')](respondWithFilteredResult(_0x48436f,_0x50fd7))[_0x38f2('0x43')](handleError(_0x48436f,null));};exports[_0x38f2('0x44')]=function(_0xce88bf,_0x10a5ef){var _0x2abdeb={'raw':!![],'where':{'id':_0xce88bf[_0x38f2('0x45')]['id']}},_0x3b0761={};_0x3b0761[_0x38f2('0x33')]=_[_0x38f2('0x30')](db[_0x38f2('0x2c')]['rawAttributes']);_0x3b0761[_0x38f2('0x34')]=_[_0x38f2('0x30')](_0xce88bf[_0x38f2('0x34')]);_0x3b0761['filters']=_[_0x38f2('0x32')](_0x3b0761[_0x38f2('0x33')],_0x3b0761[_0x38f2('0x34')]);_0x2abdeb[_0x38f2('0x36')]=_['intersection'](_0x3b0761['model'],qs['fields'](_0xce88bf[_0x38f2('0x34')][_0x38f2('0x35')]));_0x2abdeb['attributes']=_0x2abdeb[_0x38f2('0x36')][_0x38f2('0x37')]?_0x2abdeb[_0x38f2('0x36')]:_0x3b0761[_0x38f2('0x33')];if(_0xce88bf[_0x38f2('0x34')]['includeAll']){_0x2abdeb[_0x38f2('0x42')]=[{'all':!![]}];}_0x2abdeb=_[_0x38f2('0x3f')]({},_0x2abdeb,_0xce88bf[_0x38f2('0x46')]);return db[_0x38f2('0x2c')]['find'](_0x2abdeb)['then'](handleEntityNotFound(_0x10a5ef,null))[_0x38f2('0x24')](respondWithResult(_0x10a5ef,null))[_0x38f2('0x43')](handleError(_0x10a5ef,null));};exports[_0x38f2('0x47')]=function(_0x37586a,_0x3ae311){return db['SquareDetailsReport'][_0x38f2('0x47')](_0x37586a[_0x38f2('0x48')],{})[_0x38f2('0x24')](respondWithResult(_0x3ae311,0xc9))[_0x38f2('0x43')](handleError(_0x3ae311,null));};exports[_0x38f2('0x23')]=function(_0xaac5c2,_0x27bcf3){if(_0xaac5c2[_0x38f2('0x48')]['id']){delete _0xaac5c2[_0x38f2('0x48')]['id'];}return db[_0x38f2('0x2c')][_0x38f2('0x49')]({'where':{'id':_0xaac5c2[_0x38f2('0x45')]['id']}})[_0x38f2('0x24')](handleEntityNotFound(_0x27bcf3,null))['then'](saveUpdates(_0xaac5c2[_0x38f2('0x48')],null))[_0x38f2('0x24')](respondWithResult(_0x27bcf3,null))[_0x38f2('0x43')](handleError(_0x27bcf3,null));};exports[_0x38f2('0x25')]=function(_0x5aa599,_0x48507e){return db[_0x38f2('0x2c')]['find']({'where':{'id':_0x5aa599[_0x38f2('0x45')]['id']}})[_0x38f2('0x24')](handleEntityNotFound(_0x48507e,null))['then'](removeEntity(_0x48507e,null))['catch'](handleError(_0x48507e,null));};exports[_0x38f2('0x4a')]=function(_0xd3bcc7,_0x48ac81){return db[_0x38f2('0x2c')]['describe']()[_0x38f2('0x24')](respondWithResult(_0x48ac81,null))[_0x38f2('0x43')](handleError(_0x48ac81,null));}; \ No newline at end of file +var _0x22e7=['SquareDetailsReport','includeAll','findAll','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','status','undefined','count','offset','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','filter','options'];(function(_0x19b709,_0x373b44){var _0x29eb28=function(_0x4a66c4){while(--_0x4a66c4){_0x19b709['push'](_0x19b709['shift']());}};_0x29eb28(++_0x373b44);}(_0x22e7,0x9d));var _0x722e=function(_0x4048d0,_0x3b7a51){_0x4048d0=_0x4048d0-0x0;var _0x29691=_0x22e7[_0x4048d0];return _0x29691;};'use strict';var emlformat=require(_0x722e('0x0'));var rimraf=require(_0x722e('0x1'));var zipdir=require(_0x722e('0x2'));var jsonpatch=require(_0x722e('0x3'));var rp=require(_0x722e('0x4'));var moment=require('moment');var BPromise=require(_0x722e('0x5'));var Mustache=require(_0x722e('0x6'));var util=require(_0x722e('0x7'));var path=require(_0x722e('0x8'));var sox=require(_0x722e('0x9'));var csv=require(_0x722e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x722e('0xb'));var squel=require(_0x722e('0xc'));var crypto=require(_0x722e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x722e('0xe'));var toCsv=require(_0x722e('0xa'));var querystring=require(_0x722e('0xf'));var Papa=require(_0x722e('0x10'));var Redis=require(_0x722e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x722e('0x12'));var as=require(_0x722e('0x13'));var hardwareService=require(_0x722e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x722e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x722e('0x16'))['db'];function respondWithStatusCode(_0x69096b,_0x5bcfc2){_0x5bcfc2=_0x5bcfc2||0xcc;return function(_0x704e58){if(_0x704e58){return _0x69096b[_0x722e('0x17')](_0x5bcfc2);}return _0x69096b['status'](_0x5bcfc2)[_0x722e('0x18')]();};}function respondWithResult(_0x1432cf,_0x1e2495){_0x1e2495=_0x1e2495||0xc8;return function(_0x57693f){if(_0x57693f){return _0x1432cf[_0x722e('0x19')](_0x1e2495)['json'](_0x57693f);}};}function respondWithFilteredResult(_0x410855,_0x1eec0f){return function(_0x22f366){if(_0x22f366){var _0xb4302a=typeof _0x1eec0f['offset']===_0x722e('0x1a')&&typeof _0x1eec0f['limit']===_0x722e('0x1a');var _0xd6dbc0=_0x22f366['count'];var _0x162eb1=_0xb4302a?0x0:_0x1eec0f['offset'];var _0x320c25=_0xb4302a?_0x22f366[_0x722e('0x1b')]:_0x1eec0f[_0x722e('0x1c')]+_0x1eec0f['limit'];var _0x53e90a;if(_0x320c25>=_0xd6dbc0){_0x320c25=_0xd6dbc0;_0x53e90a=0xc8;}else{_0x53e90a=0xce;}_0x410855[_0x722e('0x19')](_0x53e90a);return _0x410855['set']('Content-Range',_0x162eb1+'-'+_0x320c25+'/'+_0xd6dbc0)[_0x722e('0x1d')](_0x22f366);}return null;};}function patchUpdates(_0x275d8c){return function(_0xdfdf12){try{jsonpatch[_0x722e('0x1e')](_0xdfdf12,_0x275d8c,!![]);}catch(_0x7602dd){return BPromise[_0x722e('0x1f')](_0x7602dd);}return _0xdfdf12[_0x722e('0x20')]();};}function saveUpdates(_0x5e971c,_0x259bcb){return function(_0x3b5738){if(_0x3b5738){return _0x3b5738[_0x722e('0x21')](_0x5e971c)[_0x722e('0x22')](function(_0x4ecc13){return _0x4ecc13;});}return null;};}function removeEntity(_0x92d460,_0x33d03b){return function(_0x49da12){if(_0x49da12){return _0x49da12[_0x722e('0x23')]()[_0x722e('0x22')](function(){_0x92d460[_0x722e('0x19')](0xcc)[_0x722e('0x18')]();});}};}function handleEntityNotFound(_0x1f1207,_0x3b1164){return function(_0x4739ca){if(!_0x4739ca){_0x1f1207[_0x722e('0x17')](0x194);}return _0x4739ca;};}function handleError(_0x338912,_0x4ab45f){_0x4ab45f=_0x4ab45f||0x1f4;return function(_0x381a01){logger[_0x722e('0x24')](_0x381a01[_0x722e('0x25')]);if(_0x381a01[_0x722e('0x26')]){delete _0x381a01[_0x722e('0x26')];}_0x338912['status'](_0x4ab45f)['send'](_0x381a01);};}exports[_0x722e('0x27')]=function(_0x1ecedc,_0x5a4af9){var _0xe677c9={},_0x33c6a4={},_0x1657bd={'count':0x0,'rows':[]};var _0x1bcc23=_[_0x722e('0x28')](db['SquareDetailsReport'][_0x722e('0x29')],function(_0x3971e6){return{'name':_0x3971e6['fieldName'],'type':_0x3971e6[_0x722e('0x2a')][_0x722e('0x2b')]};});_0x33c6a4[_0x722e('0x2c')]=_[_0x722e('0x28')](_0x1bcc23,_0x722e('0x26'));_0x33c6a4[_0x722e('0x2d')]=_[_0x722e('0x2e')](_0x1ecedc[_0x722e('0x2d')]);_0x33c6a4[_0x722e('0x2f')]=_[_0x722e('0x30')](_0x33c6a4[_0x722e('0x2c')],_0x33c6a4[_0x722e('0x2d')]);_0xe677c9['attributes']=_[_0x722e('0x30')](_0x33c6a4[_0x722e('0x2c')],qs[_0x722e('0x31')](_0x1ecedc['query'][_0x722e('0x31')]));_0xe677c9[_0x722e('0x32')]=_0xe677c9[_0x722e('0x32')][_0x722e('0x33')]?_0xe677c9['attributes']:_0x33c6a4[_0x722e('0x2c')];if(!_0x1ecedc['query'][_0x722e('0x34')](_0x722e('0x35'))){_0xe677c9['limit']=qs[_0x722e('0x36')](_0x1ecedc[_0x722e('0x2d')][_0x722e('0x36')]);_0xe677c9[_0x722e('0x1c')]=qs['offset'](_0x1ecedc[_0x722e('0x2d')][_0x722e('0x1c')]);}_0xe677c9[_0x722e('0x37')]=qs[_0x722e('0x38')](_0x1ecedc[_0x722e('0x2d')][_0x722e('0x38')]);_0xe677c9['where']=qs[_0x722e('0x2f')](_[_0x722e('0x39')](_0x1ecedc[_0x722e('0x2d')],_0x33c6a4[_0x722e('0x2f')]),_0x1bcc23);if(_0x1ecedc['query']['filter']){_0xe677c9[_0x722e('0x3a')]=_[_0x722e('0x3b')](_0xe677c9['where'],{'$or':_[_0x722e('0x28')](_0x1bcc23,function(_0x52f22b){if(_0x52f22b[_0x722e('0x2a')]!=='VIRTUAL'){var _0x325541={};_0x325541[_0x52f22b[_0x722e('0x26')]]={'$like':'%'+_0x1ecedc[_0x722e('0x2d')][_0x722e('0x3c')]+'%'};return _0x325541;}})});}_0xe677c9=_[_0x722e('0x3b')]({},_0xe677c9,_0x1ecedc[_0x722e('0x3d')]);var _0x29427c={'where':_0xe677c9['where']};return db[_0x722e('0x3e')]['count'](_0x29427c)[_0x722e('0x22')](function(_0x283f25){_0x1657bd['count']=_0x283f25;if(_0x1ecedc[_0x722e('0x2d')][_0x722e('0x3f')]){_0xe677c9['include']=[{'all':!![]}];}return db[_0x722e('0x3e')][_0x722e('0x40')](_0xe677c9);})['then'](function(_0x1b0cfe){_0x1657bd['rows']=_0x1b0cfe;return _0x1657bd;})['then'](respondWithFilteredResult(_0x5a4af9,_0xe677c9))['catch'](handleError(_0x5a4af9,null));};exports[_0x722e('0x41')]=function(_0x34ab80,_0x504b94){var _0x49ad00={'raw':!![],'where':{'id':_0x34ab80[_0x722e('0x42')]['id']}},_0x501dc6={};_0x501dc6['model']=_[_0x722e('0x2e')](db[_0x722e('0x3e')][_0x722e('0x29')]);_0x501dc6[_0x722e('0x2d')]=_[_0x722e('0x2e')](_0x34ab80['query']);_0x501dc6[_0x722e('0x2f')]=_[_0x722e('0x30')](_0x501dc6[_0x722e('0x2c')],_0x501dc6[_0x722e('0x2d')]);_0x49ad00[_0x722e('0x32')]=_[_0x722e('0x30')](_0x501dc6[_0x722e('0x2c')],qs['fields'](_0x34ab80['query'][_0x722e('0x31')]));_0x49ad00[_0x722e('0x32')]=_0x49ad00['attributes'][_0x722e('0x33')]?_0x49ad00[_0x722e('0x32')]:_0x501dc6[_0x722e('0x2c')];if(_0x34ab80['query']['includeAll']){_0x49ad00[_0x722e('0x43')]=[{'all':!![]}];}_0x49ad00=_[_0x722e('0x3b')]({},_0x49ad00,_0x34ab80[_0x722e('0x3d')]);return db['SquareDetailsReport'][_0x722e('0x44')](_0x49ad00)['then'](handleEntityNotFound(_0x504b94,null))[_0x722e('0x22')](respondWithResult(_0x504b94,null))[_0x722e('0x45')](handleError(_0x504b94,null));};exports[_0x722e('0x46')]=function(_0x6840c9,_0x20937a){return db['SquareDetailsReport'][_0x722e('0x46')](_0x6840c9[_0x722e('0x47')],{})[_0x722e('0x22')](respondWithResult(_0x20937a,0xc9))[_0x722e('0x45')](handleError(_0x20937a,null));};exports['update']=function(_0x3675d8,_0xf29f56){if(_0x3675d8['body']['id']){delete _0x3675d8[_0x722e('0x47')]['id'];}return db[_0x722e('0x3e')][_0x722e('0x44')]({'where':{'id':_0x3675d8['params']['id']}})[_0x722e('0x22')](handleEntityNotFound(_0xf29f56,null))[_0x722e('0x22')](saveUpdates(_0x3675d8[_0x722e('0x47')],null))[_0x722e('0x22')](respondWithResult(_0xf29f56,null))[_0x722e('0x45')](handleError(_0xf29f56,null));};exports[_0x722e('0x23')]=function(_0x1d47b2,_0xf8b5b7){return db['SquareDetailsReport'][_0x722e('0x44')]({'where':{'id':_0x1d47b2[_0x722e('0x42')]['id']}})[_0x722e('0x22')](handleEntityNotFound(_0xf8b5b7,null))[_0x722e('0x22')](removeEntity(_0xf8b5b7,null))[_0x722e('0x45')](handleError(_0xf8b5b7,null));};exports[_0x722e('0x48')]=function(_0x1a7069,_0x48e505){return db['SquareDetailsReport']['describe']()[_0x722e('0x22')](respondWithResult(_0x48e505,null))[_0x722e('0x45')](handleError(_0x48e505,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 42f4da8..56dd6db 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 _0x8612=['moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','api'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x8612,0xda));var _0x2861=function(_0xf5186a,_0x5abfd0){_0xf5186a=_0xf5186a-0x0;var _0x3c1548=_0x8612[_0xf5186a];return _0x3c1548;};'use strict';var _=require(_0x2861('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2861('0x1'));var moment=require(_0x2861('0x2'));var BPromise=require('bluebird');var rp=require(_0x2861('0x3'));var fs=require('fs');var path=require(_0x2861('0x4'));var rimraf=require(_0x2861('0x5'));var config=require(_0x2861('0x6'));var attributes=require(_0x2861('0x7'));module['exports']=function(_0x162bfa,_0x133109){return _0x162bfa[_0x2861('0x8')](_0x2861('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1711=['rimraf','./squareReportDetail.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1711,0x138));var _0x1171=function(_0x5ad013,_0x5259f1){_0x5ad013=_0x5ad013-0x0;var _0x246997=_0x1711[_0x5ad013];return _0x246997;};'use strict';var _=require(_0x1171('0x0'));var util=require(_0x1171('0x1'));var logger=require('../../config/logger')(_0x1171('0x2'));var moment=require(_0x1171('0x3'));var BPromise=require(_0x1171('0x4'));var rp=require(_0x1171('0x5'));var fs=require('fs');var path=require(_0x1171('0x6'));var rimraf=require(_0x1171('0x7'));var config=require('../../config/environment');var attributes=require(_0x1171('0x8'));module[_0x1171('0x9')]=function(_0x392877,_0x333464){return _0x392877[_0x1171('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 97f6781..bf59be9 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 _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x579526,_0x40166f){var _0x336049=function(_0x67b5b0){while(--_0x67b5b0){_0x579526['push'](_0x579526['shift']());}};_0x336049(++_0x40166f);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0xdd4f=['options','raw','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2668a9,_0x2ec098){_0x2668a9=_0x2668a9-0x0;var _0x2f4f7d=_0xdd4f[_0x2668a9];return _0x2f4f7d;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});}exports[_0xfdd4('0x15')]=function(_0x2ccc88){var _0x32b5f7=this;return new Promise(function(_0x33d752,_0x1746e1){return db[_0xfdd4('0x16')][_0xfdd4('0x17')](_0x2ccc88['body'],{'raw':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x19')]===undefined?!![]:![]:!![]})[_0xfdd4('0xa')](function(_0x1454f1){logger[_0xfdd4('0x13')](_0xfdd4('0x15'),_0x2ccc88);logger[_0xfdd4('0xc')]('CreateSquareDetailsReport',_0x2ccc88,JSON[_0xfdd4('0xf')](_0x1454f1));_0x33d752(_0x1454f1);})[_0xfdd4('0x1a')](function(_0x2a24e8){logger[_0xfdd4('0x10')](_0xfdd4('0x15'),_0x2a24e8[_0xfdd4('0x12')],_0x2ccc88);_0x1746e1(_0x32b5f7[_0xfdd4('0x10')](0x1f4,_0x2a24e8[_0xfdd4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bee5757..cbda73a 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 _0xfbd8=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x2bc061,_0x20a594){var _0x3a1435=function(_0x66fb53){while(--_0x66fb53){_0x2bc061['push'](_0x2bc061['shift']());}};_0x3a1435(++_0x20a594);}(_0xfbd8,0x99));var _0x8fbd=function(_0x333965,_0x16e0f5){_0x333965=_0x333965-0x0;var _0x50290e=_0xfbd8[_0x333965];return _0x50290e;};'use strict';var express=require(_0x8fbd('0x0'));var router=express[_0x8fbd('0x1')]();var auth=require(_0x8fbd('0x2'));var controller=require(_0x8fbd('0x3'));router[_0x8fbd('0x4')]('/',auth[_0x8fbd('0x5')](),controller[_0x8fbd('0x6')]);router[_0x8fbd('0x4')](_0x8fbd('0x7'),auth['isAuthenticated'](),controller[_0x8fbd('0x8')]);module['exports']=router; \ No newline at end of file +var _0xd7cc=['/process/:pid/kill','killProcess','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xd7cc,0xf7));var _0xcd7c=function(_0x3a606e,_0x38a76e){_0x3a606e=_0x3a606e-0x0;var _0x13a811=_0xd7cc[_0x3a606e];return _0x13a811;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xcd7c('0x0'));var controller=require(_0xcd7c('0x1'));router['get']('/',auth[_0xcd7c('0x2')](),controller[_0xcd7c('0x3')]);router[_0xcd7c('0x4')](_0xcd7c('0x5'),auth['isAuthenticated'](),controller[_0xcd7c('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 5aa7017..6e7a055 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 _0x951b=['child_process','exec','../../config/logger','api','util','bluebird','lodash','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','kill','params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x22e942,_0x7ee516){var _0xf5e153=function(_0x8891b7){while(--_0x8891b7){_0x22e942['push'](_0x22e942['shift']());}};_0xf5e153(++_0x7ee516);}(_0x951b,0x12b));var _0xb951=function(_0x4a84f7,_0x5a64cc){_0x4a84f7=_0x4a84f7-0x0;var _0x31771c=_0x951b[_0x4a84f7];return _0x31771c;};'use strict';var info=require('systeminformation');var exec=require(_0xb951('0x0'))[_0xb951('0x1')];var logger=require(_0xb951('0x2'))(_0xb951('0x3'));var util=require(_0xb951('0x4'));var BPromise=require(_0xb951('0x5'));var _=require(_0xb951('0x6'));function handleError(_0x91860c,_0x41d595,_0x4f16bf){_0x41d595=_0x41d595||0x1f4;return function(_0x5582d4){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4f16bf,_0x41d595,util['inspect'](_0x5582d4,{'showHidden':![],'depth':null}));delete _0x5582d4['name'];_0x91860c[_0xb951('0x7')](_0x41d595)[_0xb951('0x8')](_0x5582d4);};}exports[_0xb951('0x9')]=function(_0x42ed76,_0x416ec8){return info['getAllData']()[_0xb951('0xa')](function(_0x31460f){return _0x416ec8[_0xb951('0x7')](0xc8)[_0xb951('0xb')](_0x31460f);})[_0xb951('0xc')](function(_0x4b2215){return _0x416ec8['status'](0x1f4)[_0xb951('0xb')](_0x4b2215);});};exports[_0xb951('0xd')]=function(_0xa4f95a,_0x4ec5bc){var _0x59667c=['components/import/cm'];return new BPromise(function(_0x4e59ae,_0x199850){return exec(util[_0xb951('0xe')](_0xb951('0xf'),_0xa4f95a['params']['pid']),function(_0x448a65,_0x76d685,_0x2801ad){if(_0x448a65){return _0x199850(_0x448a65);}return _0x4e59ae(_0x76d685);});})['then'](function(_0xfa8cf9){var _0x4b8327=![];var _0x40f907=_0xfa8cf9[_0xb951('0x10')](/\n/);for(var _0x485b05=0x0,_0x4f6c9d=_0x59667c[_0xb951('0x11')];_0x485b05<_0x4f6c9d,_0x4b8327===![];_0x485b05+=0x1){if(_0xfa8cf9['indexOf'](_0x59667c[_0x485b05])>=0x0){_0x4b8327=!![];}}if(!_0x4b8327){throw new Error(util[_0xb951('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xa4f95a['params']['pid']));}process[_0xb951('0x12')](_0xa4f95a[_0xb951('0x13')][_0xb951('0x14')],_0xb951('0x15'));return _0x4ec5bc[_0xb951('0x7')](0xc8)[_0xb951('0xb')]({'message':util['format'](_0xb951('0x16'),_0xa4f95a[_0xb951('0x13')][_0xb951('0x14')])});})[_0xb951('0xc')](handleError(_0x4ec5bc,null,'killProcess'));}; \ No newline at end of file +var _0xb3c3=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x4b066a,_0x13a284){var _0x536de6=function(_0x15ed0c){while(--_0x15ed0c){_0x4b066a['push'](_0x4b066a['shift']());}};_0x536de6(++_0x13a284);}(_0xb3c3,0x154));var _0x3b3c=function(_0x434345,_0x2ea208){_0x434345=_0x434345-0x0;var _0xfa43f9=_0xb3c3[_0x434345];return _0xfa43f9;};'use strict';var info=require(_0x3b3c('0x0'));var exec=require(_0x3b3c('0x1'))[_0x3b3c('0x2')];var logger=require(_0x3b3c('0x3'))(_0x3b3c('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x3b3c('0x5'));function handleError(_0x2a8126,_0x19e43e,_0x354e52){_0x19e43e=_0x19e43e||0x1f4;return function(_0x4b7197){logger[_0x3b3c('0x6')](_0x3b3c('0x7'),_0x354e52,_0x19e43e,util['inspect'](_0x4b7197,{'showHidden':![],'depth':null}));delete _0x4b7197[_0x3b3c('0x8')];_0x2a8126[_0x3b3c('0x9')](_0x19e43e)[_0x3b3c('0xa')](_0x4b7197);};}exports[_0x3b3c('0xb')]=function(_0x158fd0,_0x5b635c){return info[_0x3b3c('0xc')]()['then'](function(_0x426cdd){return _0x5b635c[_0x3b3c('0x9')](0xc8)[_0x3b3c('0xd')](_0x426cdd);})[_0x3b3c('0xe')](function(_0x5b1036){return _0x5b635c[_0x3b3c('0x9')](0x1f4)[_0x3b3c('0xd')](_0x5b1036);});};exports[_0x3b3c('0xf')]=function(_0x34cc12,_0x3d4898){var _0x113490=[_0x3b3c('0x10')];return new BPromise(function(_0x570c2d,_0x483d38){return exec(util[_0x3b3c('0x11')](_0x3b3c('0x12'),_0x34cc12[_0x3b3c('0x13')][_0x3b3c('0x14')]),function(_0x2bee22,_0x3578fe,_0x542a47){if(_0x2bee22){return _0x483d38(_0x2bee22);}return _0x570c2d(_0x3578fe);});})['then'](function(_0x1dcbcb){var _0x5c3300=![];var _0x1ed7d5=_0x1dcbcb['split'](/\n/);for(var _0x4140a0=0x0,_0x1d189f=_0x113490[_0x3b3c('0x15')];_0x4140a0<_0x1d189f,_0x5c3300===![];_0x4140a0+=0x1){if(_0x1dcbcb['indexOf'](_0x113490[_0x4140a0])>=0x0){_0x5c3300=!![];}}if(!_0x5c3300){throw new Error(util[_0x3b3c('0x11')](_0x3b3c('0x16'),_0x34cc12[_0x3b3c('0x13')][_0x3b3c('0x14')]));}process[_0x3b3c('0x17')](_0x34cc12['params'][_0x3b3c('0x14')],_0x3b3c('0x18'));return _0x3d4898['status'](0xc8)[_0x3b3c('0xd')]({'message':util[_0x3b3c('0x11')](_0x3b3c('0x19'),_0x34cc12[_0x3b3c('0x13')][_0x3b3c('0x14')])});})[_0x3b3c('0xe')](handleError(_0x3d4898,null,_0x3b3c('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 755345c..2834720 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 _0x726f=['./tag.controller','index','/:id','post','isAuthenticated','create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23e50f,_0x47e473){var _0xb10df7=function(_0x361fc8){while(--_0x361fc8){_0x23e50f['push'](_0x23e50f['shift']());}};_0xb10df7(++_0x47e473);}(_0x726f,0x1ca));var _0xf726=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x726f[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var path=require(_0xf726('0x2'));var timeout=require(_0xf726('0x3'));var express=require(_0xf726('0x4'));var router=express[_0xf726('0x5')]();var fs_extra=require(_0xf726('0x6'));var auth=require(_0xf726('0x7'));var interaction=require(_0xf726('0x8'));var config=require(_0xf726('0x9'));var controller=require(_0xf726('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xf726('0xb')]);router['get'](_0xf726('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf726('0xd')]('/',auth[_0xf726('0xe')](),controller[_0xf726('0xf')]);router['put'](_0xf726('0xc'),auth[_0xf726('0xe')](),controller[_0xf726('0x10')]);router['delete'](_0xf726('0xc'),auth[_0xf726('0xe')](),controller['destroy']);module[_0xf726('0x11')]=router; \ No newline at end of file +var _0x7915=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7915,0x1a9));var _0x5791=function(_0x4bd329,_0xa5ae4){_0x4bd329=_0x4bd329-0x0;var _0x875f22=_0x7915[_0x4bd329];return _0x875f22;};'use strict';var multer=require(_0x5791('0x0'));var util=require(_0x5791('0x1'));var path=require(_0x5791('0x2'));var timeout=require(_0x5791('0x3'));var express=require(_0x5791('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5791('0x5'));var interaction=require(_0x5791('0x6'));var config=require(_0x5791('0x7'));var controller=require(_0x5791('0x8'));router['get']('/',auth[_0x5791('0x9')](),controller[_0x5791('0xa')]);router[_0x5791('0xb')](_0x5791('0xc'),auth[_0x5791('0x9')](),controller[_0x5791('0xd')]);router['post']('/',auth[_0x5791('0x9')](),controller[_0x5791('0xe')]);router[_0x5791('0xf')]('/:id',auth[_0x5791('0x9')](),controller[_0x5791('0x10')]);router['delete'](_0x5791('0xc'),auth[_0x5791('0x9')](),controller[_0x5791('0x11')]);module[_0x5791('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7b99aac..2ea39f8 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 _0x4b74=['exports','STRING','#0091EA','sequelize'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x4b74,0x103));var _0x44b7=function(_0x232332,_0x3cb82b){_0x232332=_0x232332-0x0;var _0x3e71f6=_0x4b74[_0x232332];return _0x3e71f6;};'use strict';var Sequelize=require(_0x44b7('0x0'));module[_0x44b7('0x1')]={'name':{'type':Sequelize[_0x44b7('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x44b7('0x2')],'defaultValue':_0x44b7('0x3')},'description':{'type':Sequelize[_0x44b7('0x2')]}}; \ No newline at end of file +var _0xaf4c=['#0091EA','exports','STRING'];(function(_0x320909,_0x17e27a){var _0x3b19b5=function(_0x5268c7){while(--_0x5268c7){_0x320909['push'](_0x320909['shift']());}};_0x3b19b5(++_0x17e27a);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x15915f,_0x58cd67){_0x15915f=_0x15915f-0x0;var _0xb0d6b3=_0xaf4c[_0x15915f];return _0xb0d6b3;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'name':{'type':Sequelize[_0xcaf4('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcaf4('0x1')],'defaultValue':_0xcaf4('0x2')},'description':{'type':Sequelize[_0xcaf4('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index b0461b4..d7ca24d 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 _0x8d9b=['filter','type','options','Tag','rows','params','length','includeAll','include','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x289c45,_0x552084){var _0x46d1e7=function(_0x589742){while(--_0x589742){_0x289c45['push'](_0x289c45['shift']());}};_0x46d1e7(++_0x552084);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8d9('0x0'));var rimraf=require(_0xb8d9('0x1'));var zipdir=require(_0xb8d9('0x2'));var jsonpatch=require(_0xb8d9('0x3'));var rp=require(_0xb8d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d9('0x5'));var util=require('util');var path=require(_0xb8d9('0x6'));var sox=require(_0xb8d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8d9('0x9'));var toCsv=require(_0xb8d9('0xa'));var querystring=require(_0xb8d9('0xb'));var Papa=require(_0xb8d9('0xc'));var Redis=require(_0xb8d9('0xd'));var authService=require(_0xb8d9('0xe'));var qs=require(_0xb8d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d9('0x10'));var logger=require('../../config/logger')(_0xb8d9('0x11'));var utils=require(_0xb8d9('0x12'));var config=require(_0xb8d9('0x13'));var licenseUtil=require(_0xb8d9('0x14'));var db=require(_0xb8d9('0x15'))['db'];function respondWithStatusCode(_0x13b1d8,_0x10b7fe){_0x10b7fe=_0x10b7fe||0xcc;return function(_0x265472){if(_0x265472){return _0x13b1d8[_0xb8d9('0x16')](_0x10b7fe);}return _0x13b1d8[_0xb8d9('0x17')](_0x10b7fe)[_0xb8d9('0x18')]();};}function respondWithResult(_0x4b0f9,_0x1bcb02){_0x1bcb02=_0x1bcb02||0xc8;return function(_0xb3fa68){if(_0xb3fa68){return _0x4b0f9['status'](_0x1bcb02)[_0xb8d9('0x19')](_0xb3fa68);}};}function respondWithFilteredResult(_0x2c5265,_0x513edf){return function(_0x24f33a){if(_0x24f33a){var _0x283780=typeof _0x513edf['offset']==='undefined'&&typeof _0x513edf['limit']===_0xb8d9('0x1a');var _0x2d1b34=_0x24f33a[_0xb8d9('0x1b')];var _0x1183e4=_0x283780?0x0:_0x513edf['offset'];var _0x31b33f=_0x283780?_0x24f33a['count']:_0x513edf[_0xb8d9('0x1c')]+_0x513edf[_0xb8d9('0x1d')];var _0x447367;if(_0x31b33f>=_0x2d1b34){_0x31b33f=_0x2d1b34;_0x447367=0xc8;}else{_0x447367=0xce;}_0x2c5265[_0xb8d9('0x17')](_0x447367);return _0x2c5265[_0xb8d9('0x1e')]('Content-Range',_0x1183e4+'-'+_0x31b33f+'/'+_0x2d1b34)['json'](_0x24f33a);}return null;};}function patchUpdates(_0x5444a5){return function(_0x42f600){try{jsonpatch[_0xb8d9('0x1f')](_0x42f600,_0x5444a5,!![]);}catch(_0x15495f){return BPromise[_0xb8d9('0x20')](_0x15495f);}return _0x42f600[_0xb8d9('0x21')]();};}function saveUpdates(_0x48c504,_0x963afa){return function(_0x430794){if(_0x430794){return _0x430794[_0xb8d9('0x22')](_0x48c504)[_0xb8d9('0x23')](function(_0x3cefe3){return _0x3cefe3;});}return null;};}function removeEntity(_0x1d94aa,_0x3f4b9d){return function(_0x3d1659){if(_0x3d1659){return _0x3d1659[_0xb8d9('0x24')]()[_0xb8d9('0x23')](function(){var _0x52df47=_0x3d1659[_0xb8d9('0x25')]({'plain':!![]});var _0x49380d='Tags';return db[_0xb8d9('0x26')][_0xb8d9('0x24')]({'where':{'type':_0x49380d,'resourceId':_0x52df47['id']}})[_0xb8d9('0x23')](function(){return _0x3d1659;});})[_0xb8d9('0x23')](function(){_0x1d94aa[_0xb8d9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241041,_0x282db6){return function(_0x3111aa){if(!_0x3111aa){_0x241041['sendStatus'](0x194);}return _0x3111aa;};}function handleError(_0x2d1439,_0x1c9bd4){_0x1c9bd4=_0x1c9bd4||0x1f4;return function(_0x336918){logger['error'](_0x336918[_0xb8d9('0x27')]);if(_0x336918[_0xb8d9('0x28')]){delete _0x336918['name'];}_0x2d1439[_0xb8d9('0x17')](_0x1c9bd4)[_0xb8d9('0x29')](_0x336918);};}exports[_0xb8d9('0x2a')]=function(_0x1b1212,_0x358e4d){var _0x84b01c={},_0x13120c={},_0x27ed72={'count':0x0,'rows':[]};var _0x8674fc=_[_0xb8d9('0x2b')](db['Tag'][_0xb8d9('0x2c')],function(_0x374def){return{'name':_0x374def[_0xb8d9('0x2d')],'type':_0x374def['type'][_0xb8d9('0x2e')]};});_0x13120c[_0xb8d9('0x2f')]=_[_0xb8d9('0x2b')](_0x8674fc,_0xb8d9('0x28'));_0x13120c[_0xb8d9('0x30')]=_[_0xb8d9('0x31')](_0x1b1212['query']);_0x13120c['filters']=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],_0x13120c[_0xb8d9('0x30')]);_0x84b01c[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],qs['fields'](_0x1b1212['query'][_0xb8d9('0x34')]));_0x84b01c[_0xb8d9('0x33')]=_0x84b01c[_0xb8d9('0x33')]['length']?_0x84b01c[_0xb8d9('0x33')]:_0x13120c['model'];if(!_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x35')](_0xb8d9('0x36'))){_0x84b01c['limit']=qs[_0xb8d9('0x1d')](_0x1b1212[_0xb8d9('0x30')]['limit']);_0x84b01c['offset']=qs[_0xb8d9('0x1c')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x1c')]);}_0x84b01c[_0xb8d9('0x37')]=qs[_0xb8d9('0x38')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x38')]);_0x84b01c[_0xb8d9('0x39')]=qs[_0xb8d9('0x3a')](_[_0xb8d9('0x3b')](_0x1b1212[_0xb8d9('0x30')],_0x13120c[_0xb8d9('0x3a')]),_0x8674fc);if(_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x3c')]){_0x84b01c['where']=_['merge'](_0x84b01c[_0xb8d9('0x39')],{'$or':_[_0xb8d9('0x2b')](_0x8674fc,function(_0x364bb1){if(_0x364bb1[_0xb8d9('0x3d')]!=='VIRTUAL'){var _0x4b1d71={};_0x4b1d71[_0x364bb1[_0xb8d9('0x28')]]={'$like':'%'+_0x1b1212['query'][_0xb8d9('0x3c')]+'%'};return _0x4b1d71;}})});}_0x84b01c=_['merge']({},_0x84b01c,_0x1b1212[_0xb8d9('0x3e')]);var _0x5ae97b={'where':_0x84b01c[_0xb8d9('0x39')]};return db[_0xb8d9('0x3f')][_0xb8d9('0x1b')](_0x5ae97b)['then'](function(_0x40fd3e){_0x27ed72[_0xb8d9('0x1b')]=_0x40fd3e;if(_0x1b1212[_0xb8d9('0x30')]['includeAll']){_0x84b01c['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x84b01c);})['then'](function(_0xc1816a){_0x27ed72[_0xb8d9('0x40')]=_0xc1816a;return _0x27ed72;})[_0xb8d9('0x23')](respondWithFilteredResult(_0x358e4d,_0x84b01c))['catch'](handleError(_0x358e4d,null));};exports['show']=function(_0x142e54,_0x496d4f){var _0x13f7ce={'raw':!![],'where':{'id':_0x142e54[_0xb8d9('0x41')]['id']}},_0x25ae38={};_0x25ae38[_0xb8d9('0x2f')]=_[_0xb8d9('0x31')](db['Tag'][_0xb8d9('0x2c')]);_0x25ae38[_0xb8d9('0x30')]=_['keys'](_0x142e54[_0xb8d9('0x30')]);_0x25ae38[_0xb8d9('0x3a')]=_['intersection'](_0x25ae38['model'],_0x25ae38[_0xb8d9('0x30')]);_0x13f7ce[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x25ae38[_0xb8d9('0x2f')],qs[_0xb8d9('0x34')](_0x142e54['query'][_0xb8d9('0x34')]));_0x13f7ce[_0xb8d9('0x33')]=_0x13f7ce[_0xb8d9('0x33')][_0xb8d9('0x42')]?_0x13f7ce[_0xb8d9('0x33')]:_0x25ae38[_0xb8d9('0x2f')];if(_0x142e54['query'][_0xb8d9('0x43')]){_0x13f7ce[_0xb8d9('0x44')]=[{'all':!![]}];}_0x13f7ce=_[_0xb8d9('0x45')]({},_0x13f7ce,_0x142e54[_0xb8d9('0x3e')]);return db[_0xb8d9('0x3f')][_0xb8d9('0x46')](_0x13f7ce)['then'](handleEntityNotFound(_0x496d4f,null))[_0xb8d9('0x23')](respondWithResult(_0x496d4f,null))[_0xb8d9('0x47')](handleError(_0x496d4f,null));};exports['create']=function(_0x212310,_0x41f38b){return db['Tag']['create'](_0x212310[_0xb8d9('0x48')],{})[_0xb8d9('0x23')](function(_0x3c2a57){var _0xca2c82=_0x212310[_0xb8d9('0x49')][_0xb8d9('0x25')]({'plain':!![]});if(!_0xca2c82)throw new Error(_0xb8d9('0x4a'));if(_0xca2c82['role']===_0xb8d9('0x49')){var _0x431c21=_0x3c2a57[_0xb8d9('0x25')]({'plain':!![]});var _0x53575d=_0xb8d9('0x4b');return db[_0xb8d9('0x4c')]['find']({'where':{'name':_0x53575d,'userProfileId':_0xca2c82['userProfileId']},'raw':!![]})[_0xb8d9('0x23')](function(_0x213915){if(_0x213915&&_0x213915['autoAssociation']===0x0){return db[_0xb8d9('0x26')][_0xb8d9('0x4d')]({'name':_0x431c21[_0xb8d9('0x28')],'resourceId':_0x431c21['id'],'type':_0x213915[_0xb8d9('0x28')],'sectionId':_0x213915['id']},{})['then'](function(){return _0x3c2a57;});}else{return _0x3c2a57;}})[_0xb8d9('0x47')](function(_0x3d7ea6){logger[_0xb8d9('0x4e')](_0xb8d9('0x4f'),_0x3d7ea6);throw _0x3d7ea6;});}return _0x3c2a57;})[_0xb8d9('0x23')](respondWithResult(_0x41f38b,0xc9))[_0xb8d9('0x47')](handleError(_0x41f38b,null));};exports[_0xb8d9('0x22')]=function(_0x518bb4,_0x3101da){if(_0x518bb4['body']['id']){delete _0x518bb4[_0xb8d9('0x48')]['id'];}return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x518bb4['params']['id']}})[_0xb8d9('0x23')](handleEntityNotFound(_0x3101da,null))[_0xb8d9('0x23')](saveUpdates(_0x518bb4[_0xb8d9('0x48')],null))[_0xb8d9('0x23')](respondWithResult(_0x3101da,null))[_0xb8d9('0x47')](handleError(_0x3101da,null));};exports[_0xb8d9('0x24')]=function(_0x4533e5,_0x3480d1){return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x4533e5[_0xb8d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3480d1,null))[_0xb8d9('0x23')](removeEntity(_0x3480d1,null))[_0xb8d9('0x47')](handleError(_0x3480d1,null));}; \ No newline at end of file +var _0xe812=['userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','Tags','UserProfileResource','destroy','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe812,0x1f2));var _0x2e81=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe812[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e81('0x0'));var zipdir=require(_0x2e81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e81('0x2'));var BPromise=require(_0x2e81('0x3'));var Mustache=require('mustache');var util=require(_0x2e81('0x4'));var path=require(_0x2e81('0x5'));var sox=require('sox');var csv=require(_0x2e81('0x6'));var ejs=require(_0x2e81('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e81('0x8'));var squel=require(_0x2e81('0x9'));var crypto=require(_0x2e81('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e81('0xb'));var toCsv=require(_0x2e81('0x6'));var querystring=require(_0x2e81('0xc'));var Papa=require(_0x2e81('0xd'));var Redis=require('ioredis');var authService=require(_0x2e81('0xe'));var qs=require(_0x2e81('0xf'));var as=require(_0x2e81('0x10'));var hardwareService=require(_0x2e81('0x11'));var logger=require(_0x2e81('0x12'))(_0x2e81('0x13'));var utils=require(_0x2e81('0x14'));var config=require(_0x2e81('0x15'));var licenseUtil=require(_0x2e81('0x16'));var db=require(_0x2e81('0x17'))['db'];function respondWithStatusCode(_0x4284f3,_0x5c58a2){_0x5c58a2=_0x5c58a2||0xcc;return function(_0x30a730){if(_0x30a730){return _0x4284f3[_0x2e81('0x18')](_0x5c58a2);}return _0x4284f3['status'](_0x5c58a2)[_0x2e81('0x19')]();};}function respondWithResult(_0x5598a9,_0x2a4411){_0x2a4411=_0x2a4411||0xc8;return function(_0x2b24f0){if(_0x2b24f0){return _0x5598a9[_0x2e81('0x1a')](_0x2a4411)[_0x2e81('0x1b')](_0x2b24f0);}};}function respondWithFilteredResult(_0x1bb937,_0x3a8c05){return function(_0x53da62){if(_0x53da62){var _0xc4d315=typeof _0x3a8c05[_0x2e81('0x1c')]==='undefined'&&typeof _0x3a8c05[_0x2e81('0x1d')]==='undefined';var _0x2cc0c6=_0x53da62[_0x2e81('0x1e')];var _0x4c1b11=_0xc4d315?0x0:_0x3a8c05[_0x2e81('0x1c')];var _0x2bb9b6=_0xc4d315?_0x53da62[_0x2e81('0x1e')]:_0x3a8c05[_0x2e81('0x1c')]+_0x3a8c05[_0x2e81('0x1d')];var _0x1f20bf;if(_0x2bb9b6>=_0x2cc0c6){_0x2bb9b6=_0x2cc0c6;_0x1f20bf=0xc8;}else{_0x1f20bf=0xce;}_0x1bb937[_0x2e81('0x1a')](_0x1f20bf);return _0x1bb937[_0x2e81('0x1f')](_0x2e81('0x20'),_0x4c1b11+'-'+_0x2bb9b6+'/'+_0x2cc0c6)[_0x2e81('0x1b')](_0x53da62);}return null;};}function patchUpdates(_0x524694){return function(_0x10b77e){try{jsonpatch[_0x2e81('0x21')](_0x10b77e,_0x524694,!![]);}catch(_0x9ddf6b){return BPromise[_0x2e81('0x22')](_0x9ddf6b);}return _0x10b77e[_0x2e81('0x23')]();};}function saveUpdates(_0x386721,_0x18b9be){return function(_0x39ffa8){if(_0x39ffa8){return _0x39ffa8['update'](_0x386721)[_0x2e81('0x24')](function(_0x49e9f1){return _0x49e9f1;});}return null;};}function removeEntity(_0x2d50af,_0x4fe130){return function(_0x1d09cb){if(_0x1d09cb){return _0x1d09cb['destroy']()['then'](function(){var _0x123d3d=_0x1d09cb[_0x2e81('0x25')]({'plain':!![]});var _0x4a75ff=_0x2e81('0x26');return db[_0x2e81('0x27')][_0x2e81('0x28')]({'where':{'type':_0x4a75ff,'resourceId':_0x123d3d['id']}})[_0x2e81('0x24')](function(){return _0x1d09cb;});})[_0x2e81('0x24')](function(){_0x2d50af[_0x2e81('0x1a')](0xcc)[_0x2e81('0x19')]();});}};}function handleEntityNotFound(_0x4669aa,_0x1b34db){return function(_0x1bf5a6){if(!_0x1bf5a6){_0x4669aa[_0x2e81('0x18')](0x194);}return _0x1bf5a6;};}function handleError(_0xc0720f,_0x8edf9c){_0x8edf9c=_0x8edf9c||0x1f4;return function(_0x3ec91d){logger['error'](_0x3ec91d['stack']);if(_0x3ec91d[_0x2e81('0x29')]){delete _0x3ec91d[_0x2e81('0x29')];}_0xc0720f[_0x2e81('0x1a')](_0x8edf9c)[_0x2e81('0x2a')](_0x3ec91d);};}exports[_0x2e81('0x2b')]=function(_0x2a78bb,_0x243b20){var _0x13612b={},_0x26ec2a={},_0x1c37d1={'count':0x0,'rows':[]};var _0x392c5b=_['map'](db[_0x2e81('0x2c')][_0x2e81('0x2d')],function(_0x1d0437){return{'name':_0x1d0437[_0x2e81('0x2e')],'type':_0x1d0437[_0x2e81('0x2f')][_0x2e81('0x30')]};});_0x26ec2a[_0x2e81('0x31')]=_[_0x2e81('0x32')](_0x392c5b,_0x2e81('0x29'));_0x26ec2a[_0x2e81('0x33')]=_[_0x2e81('0x34')](_0x2a78bb[_0x2e81('0x33')]);_0x26ec2a[_0x2e81('0x35')]=_[_0x2e81('0x36')](_0x26ec2a[_0x2e81('0x31')],_0x26ec2a[_0x2e81('0x33')]);_0x13612b[_0x2e81('0x37')]=_['intersection'](_0x26ec2a[_0x2e81('0x31')],qs[_0x2e81('0x38')](_0x2a78bb['query'][_0x2e81('0x38')]));_0x13612b[_0x2e81('0x37')]=_0x13612b['attributes'][_0x2e81('0x39')]?_0x13612b[_0x2e81('0x37')]:_0x26ec2a[_0x2e81('0x31')];if(!_0x2a78bb['query'][_0x2e81('0x3a')](_0x2e81('0x3b'))){_0x13612b[_0x2e81('0x1d')]=qs[_0x2e81('0x1d')](_0x2a78bb[_0x2e81('0x33')]['limit']);_0x13612b['offset']=qs['offset'](_0x2a78bb['query'][_0x2e81('0x1c')]);}_0x13612b['order']=qs['sort'](_0x2a78bb[_0x2e81('0x33')][_0x2e81('0x3c')]);_0x13612b[_0x2e81('0x3d')]=qs['filters'](_[_0x2e81('0x3e')](_0x2a78bb[_0x2e81('0x33')],_0x26ec2a[_0x2e81('0x35')]),_0x392c5b);if(_0x2a78bb[_0x2e81('0x33')][_0x2e81('0x3f')]){_0x13612b['where']=_['merge'](_0x13612b[_0x2e81('0x3d')],{'$or':_[_0x2e81('0x32')](_0x392c5b,function(_0x35d1c0){if(_0x35d1c0['type']!==_0x2e81('0x40')){var _0x44d10c={};_0x44d10c[_0x35d1c0[_0x2e81('0x29')]]={'$like':'%'+_0x2a78bb['query'][_0x2e81('0x3f')]+'%'};return _0x44d10c;}})});}_0x13612b=_[_0x2e81('0x41')]({},_0x13612b,_0x2a78bb[_0x2e81('0x42')]);var _0x10e240={'where':_0x13612b[_0x2e81('0x3d')]};return db[_0x2e81('0x2c')][_0x2e81('0x1e')](_0x10e240)[_0x2e81('0x24')](function(_0x5508f0){_0x1c37d1['count']=_0x5508f0;if(_0x2a78bb[_0x2e81('0x33')]['includeAll']){_0x13612b[_0x2e81('0x43')]=[{'all':!![]}];}return db[_0x2e81('0x2c')][_0x2e81('0x44')](_0x13612b);})[_0x2e81('0x24')](function(_0x3c5fbb){_0x1c37d1[_0x2e81('0x45')]=_0x3c5fbb;return _0x1c37d1;})['then'](respondWithFilteredResult(_0x243b20,_0x13612b))['catch'](handleError(_0x243b20,null));};exports[_0x2e81('0x46')]=function(_0x2bc2a7,_0x1a8233){var _0x53bb7c={'raw':!![],'where':{'id':_0x2bc2a7[_0x2e81('0x47')]['id']}},_0x4499b7={};_0x4499b7['model']=_[_0x2e81('0x34')](db['Tag'][_0x2e81('0x2d')]);_0x4499b7[_0x2e81('0x33')]=_[_0x2e81('0x34')](_0x2bc2a7[_0x2e81('0x33')]);_0x4499b7['filters']=_[_0x2e81('0x36')](_0x4499b7['model'],_0x4499b7[_0x2e81('0x33')]);_0x53bb7c[_0x2e81('0x37')]=_['intersection'](_0x4499b7[_0x2e81('0x31')],qs[_0x2e81('0x38')](_0x2bc2a7[_0x2e81('0x33')][_0x2e81('0x38')]));_0x53bb7c[_0x2e81('0x37')]=_0x53bb7c[_0x2e81('0x37')][_0x2e81('0x39')]?_0x53bb7c['attributes']:_0x4499b7[_0x2e81('0x31')];if(_0x2bc2a7['query']['includeAll']){_0x53bb7c[_0x2e81('0x43')]=[{'all':!![]}];}_0x53bb7c=_['merge']({},_0x53bb7c,_0x2bc2a7['options']);return db[_0x2e81('0x2c')][_0x2e81('0x48')](_0x53bb7c)[_0x2e81('0x24')](handleEntityNotFound(_0x1a8233,null))['then'](respondWithResult(_0x1a8233,null))['catch'](handleError(_0x1a8233,null));};exports[_0x2e81('0x49')]=function(_0x1dd4d7,_0x16ed11){return db[_0x2e81('0x2c')]['create'](_0x1dd4d7['body'],{})[_0x2e81('0x24')](function(_0x4056e8){var _0x5631b6=_0x1dd4d7['user'][_0x2e81('0x25')]({'plain':!![]});if(!_0x5631b6)throw new Error(_0x2e81('0x4a'));if(_0x5631b6['role']===_0x2e81('0x4b')){var _0x33a4d7=_0x4056e8[_0x2e81('0x25')]({'plain':!![]});var _0x3402b3=_0x2e81('0x26');return db['UserProfileSection'][_0x2e81('0x48')]({'where':{'name':_0x3402b3,'userProfileId':_0x5631b6[_0x2e81('0x4c')]},'raw':!![]})[_0x2e81('0x24')](function(_0xb4decd){if(_0xb4decd&&_0xb4decd['autoAssociation']===0x0){return db['UserProfileResource'][_0x2e81('0x49')]({'name':_0x33a4d7[_0x2e81('0x29')],'resourceId':_0x33a4d7['id'],'type':_0xb4decd[_0x2e81('0x29')],'sectionId':_0xb4decd['id']},{})[_0x2e81('0x24')](function(){return _0x4056e8;});}else{return _0x4056e8;}})[_0x2e81('0x4d')](function(_0x482888){logger[_0x2e81('0x4e')](_0x2e81('0x4f'),_0x482888);throw _0x482888;});}return _0x4056e8;})[_0x2e81('0x24')](respondWithResult(_0x16ed11,0xc9))[_0x2e81('0x4d')](handleError(_0x16ed11,null));};exports[_0x2e81('0x50')]=function(_0x4aa5e5,_0x44db7f){if(_0x4aa5e5[_0x2e81('0x51')]['id']){delete _0x4aa5e5['body']['id'];}return db['Tag'][_0x2e81('0x48')]({'where':{'id':_0x4aa5e5['params']['id']}})[_0x2e81('0x24')](handleEntityNotFound(_0x44db7f,null))[_0x2e81('0x24')](saveUpdates(_0x4aa5e5[_0x2e81('0x51')],null))[_0x2e81('0x24')](respondWithResult(_0x44db7f,null))[_0x2e81('0x4d')](handleError(_0x44db7f,null));};exports[_0x2e81('0x28')]=function(_0x18beeb,_0x1570c1){return db['Tag'][_0x2e81('0x48')]({'where':{'id':_0x18beeb['params']['id']}})[_0x2e81('0x24')](handleEntityNotFound(_0x1570c1,null))[_0x2e81('0x24')](removeEntity(_0x1570c1,null))['catch'](handleError(_0x1570c1,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 75ce018..bc815d3 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 _0x39a0=['./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbf78f7,_0x3b955f){var _0x35da95=function(_0x4fbb5e){while(--_0x4fbb5e){_0xbf78f7['push'](_0xbf78f7['shift']());}};_0x35da95(++_0x3b955f);}(_0x39a0,0x7b));var _0x039a=function(_0x36c5a0,_0x5acca5){_0x36c5a0=_0x36c5a0-0x0;var _0x47af7a=_0x39a0[_0x36c5a0];return _0x47af7a;};'use strict';var _=require(_0x039a('0x0'));var util=require(_0x039a('0x1'));var logger=require(_0x039a('0x2'))(_0x039a('0x3'));var moment=require(_0x039a('0x4'));var BPromise=require(_0x039a('0x5'));var rp=require(_0x039a('0x6'));var fs=require('fs');var path=require(_0x039a('0x7'));var rimraf=require(_0x039a('0x8'));var config=require('../../config/environment');var attributes=require(_0x039a('0x9'));module[_0x039a('0xa')]=function(_0x4e09d4,_0x3ad7b0){return _0x4e09d4['define']('Tag',attributes,{'tableName':_0x039a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9874=['api','moment','request-promise','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util'];(function(_0x172328,_0xeb050b){var _0x30db98=function(_0x2b77be){while(--_0x2b77be){_0x172328['push'](_0x172328['shift']());}};_0x30db98(++_0xeb050b);}(_0x9874,0x155));var _0x4987=function(_0x17249d,_0x2c5c7a){_0x17249d=_0x17249d-0x0;var _0x2557e3=_0x9874[_0x17249d];return _0x2557e3;};'use strict';var _=require('lodash');var util=require(_0x4987('0x0'));var logger=require('../../config/logger')(_0x4987('0x1'));var moment=require(_0x4987('0x2'));var BPromise=require('bluebird');var rp=require(_0x4987('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4987('0x4'));var attributes=require(_0x4987('0x5'));module[_0x4987('0x6')]=function(_0xf40c75,_0x26f6b3){return _0xf40c75['define'](_0x4987('0x7'),attributes,{'tableName':_0x4987('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 7b1c0a6..d609940 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x5e03fc,_0x1b5ed7){_0x5e03fc=_0x5e03fc-0x0;var _0x116ada=_0x008c[_0x5e03fc];return _0x116ada;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x5577=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5577,0x1b4));var _0x7557=function(_0x229121,_0x4cfd48){_0x229121=_0x229121-0x0;var _0x559765=_0x5577[_0x229121];return _0x559765;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var moment=require(_0x7557('0x1'));var BPromise=require(_0x7557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7557('0x3'));var db=require(_0x7557('0x4'))['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da895,_0x1446fd,_0x33e9aa){return new BPromise(function(_0x37f335,_0xa4f49a){return client[_0x7557('0xb')](_0x3da895,_0x33e9aa)[_0x7557('0xc')](function(_0x24b592){logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));logger[_0x7557('0x10')](_0x7557('0x11'),_0x1446fd,'request\x20sent',JSON['stringify'](_0x24b592));if(_0x24b592[_0x7557('0x12')]){if(_0x24b592[_0x7557('0x12')][_0x7557('0x13')]===0x1f4){logger[_0x7557('0x12')](_0x7557('0xe'),_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0xa4f49a(_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);}logger[_0x7557('0x12')]('Tag,\x20%s,\x20%s',_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0x37f335(_0x24b592[_0x7557('0x12')]['message']);}else{logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));_0x37f335(_0x24b592[_0x7557('0x15')]['message']);}})[_0x7557('0x16')](function(_0x46057c){logger['error']('Tag,\x20%s,\x20%s',_0x1446fd,_0x46057c);_0xa4f49a(_0x46057c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 250fa58..6bfa39c 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 fca6a9d..872eb5a 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x24b122,_0x4a667c){var _0x4652fd=function(_0x3a62eb){while(--_0x3a62eb){_0x24b122['push'](_0x24b122['shift']());}};_0x4652fd(++_0x4a667c);}(_0x757a,0xde));var _0xa757=function(_0x5ef013,_0x2a3eae){_0x5ef013=_0x5ef013-0x0;var _0x3106a0=_0x757a[_0x5ef013];return _0x3106a0;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 6e8a75c..db5da3a 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 _0x3db8=['filter','merge','VIRTUAL','options','includeAll','rows','show','rawAttributes','include','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','Teams','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','all','spread','Openchannel','Whatsapp','Queue:remove','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x3db8,0xff));var _0x83db=function(_0x17be8a,_0xc4f89b){_0x17be8a=_0x17be8a-0x0;var _0x3ef88f=_0x3db8[_0x17be8a];return _0x3ef88f;};'use strict';var emlformat=require(_0x83db('0x0'));var rimraf=require(_0x83db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83db('0x2'));var rp=require('request-promise');var moment=require(_0x83db('0x3'));var BPromise=require(_0x83db('0x4'));var Mustache=require(_0x83db('0x5'));var util=require('util');var path=require('path');var sox=require(_0x83db('0x6'));var csv=require(_0x83db('0x7'));var ejs=require(_0x83db('0x8'));var fs=require('fs');var fs_extra=require(_0x83db('0x9'));var _=require(_0x83db('0xa'));var squel=require('squel');var crypto=require(_0x83db('0xb'));var jsforce=require(_0x83db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x83db('0x7'));var querystring=require(_0x83db('0xd'));var Papa=require(_0x83db('0xe'));var Redis=require(_0x83db('0xf'));var authService=require(_0x83db('0x10'));var qs=require(_0x83db('0x11'));var as=require(_0x83db('0x12'));var hardwareService=require(_0x83db('0x13'));var logger=require(_0x83db('0x14'))(_0x83db('0x15'));var utils=require(_0x83db('0x16'));var config=require(_0x83db('0x17'));var licenseUtil=require(_0x83db('0x18'));var db=require(_0x83db('0x19'))['db'];config['redis']=_[_0x83db('0x1a')](config['redis'],{'host':_0x83db('0x1b'),'port':0x18eb});var socket=require(_0x83db('0x1c'))(new Redis(config['redis']));require(_0x83db('0x1d'))[_0x83db('0x1e')](socket);function respondWithStatusCode(_0x47111,_0x5e6530){_0x5e6530=_0x5e6530||0xcc;return function(_0x3c7179){if(_0x3c7179){return _0x47111[_0x83db('0x1f')](_0x5e6530);}return _0x47111[_0x83db('0x20')](_0x5e6530)[_0x83db('0x21')]();};}function respondWithResult(_0x2c39da,_0x5b23e5){_0x5b23e5=_0x5b23e5||0xc8;return function(_0x5e1979){if(_0x5e1979){return _0x2c39da[_0x83db('0x20')](_0x5b23e5)['json'](_0x5e1979);}};}function respondWithFilteredResult(_0x13badc,_0x38badb){return function(_0x1be912){if(_0x1be912){var _0x2e302d=typeof _0x38badb[_0x83db('0x22')]==='undefined'&&typeof _0x38badb[_0x83db('0x23')]===_0x83db('0x24');var _0x482805=_0x1be912[_0x83db('0x25')];var _0x14ffb0=_0x2e302d?0x0:_0x38badb[_0x83db('0x22')];var _0x38ad9d=_0x2e302d?_0x1be912[_0x83db('0x25')]:_0x38badb[_0x83db('0x22')]+_0x38badb[_0x83db('0x23')];var _0x45dad9;if(_0x38ad9d>=_0x482805){_0x38ad9d=_0x482805;_0x45dad9=0xc8;}else{_0x45dad9=0xce;}_0x13badc[_0x83db('0x20')](_0x45dad9);return _0x13badc[_0x83db('0x26')](_0x83db('0x27'),_0x14ffb0+'-'+_0x38ad9d+'/'+_0x482805)[_0x83db('0x28')](_0x1be912);}return null;};}function patchUpdates(_0x2419f7){return function(_0x279402){try{jsonpatch[_0x83db('0x29')](_0x279402,_0x2419f7,!![]);}catch(_0x569f4d){return BPromise[_0x83db('0x2a')](_0x569f4d);}return _0x279402[_0x83db('0x2b')]();};}function saveUpdates(_0x1a66c1,_0x5537d8){return function(_0x16cab9){if(_0x16cab9){return _0x16cab9['update'](_0x1a66c1)[_0x83db('0x2c')](function(_0x578213){return _0x578213;});}return null;};}function handleEntityNotFound(_0x2d6a93,_0xe20dee){return function(_0x346111){if(!_0x346111){_0x2d6a93[_0x83db('0x1f')](0x194);}return _0x346111;};}function handleError(_0x3796ee,_0x215cdd){_0x215cdd=_0x215cdd||0x1f4;return function(_0x29a7f2){logger[_0x83db('0x2d')](_0x29a7f2[_0x83db('0x2e')]);if(_0x29a7f2[_0x83db('0x2f')]){delete _0x29a7f2[_0x83db('0x2f')];}_0x3796ee['status'](_0x215cdd)[_0x83db('0x30')](_0x29a7f2);};}exports[_0x83db('0x31')]=function(_0x5447f3,_0x4cd3b4){var _0x3739ce={},_0x3ba77c={},_0x2c5537={'count':0x0,'rows':[]};var _0x302714=_[_0x83db('0x32')](db[_0x83db('0x33')]['rawAttributes'],function(_0x2f3cda){return{'name':_0x2f3cda[_0x83db('0x34')],'type':_0x2f3cda[_0x83db('0x35')][_0x83db('0x36')]};});_0x3ba77c[_0x83db('0x37')]=_[_0x83db('0x32')](_0x302714,'name');_0x3ba77c[_0x83db('0x38')]=_[_0x83db('0x39')](_0x5447f3[_0x83db('0x38')]);_0x3ba77c[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x3ba77c[_0x83db('0x37')],_0x3ba77c[_0x83db('0x38')]);_0x3739ce[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0x3ba77c[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x5447f3['query'][_0x83db('0x3d')]));_0x3739ce[_0x83db('0x3c')]=_0x3739ce[_0x83db('0x3c')][_0x83db('0x3e')]?_0x3739ce[_0x83db('0x3c')]:_0x3ba77c[_0x83db('0x37')];if(!_0x5447f3['query'][_0x83db('0x3f')](_0x83db('0x40'))){_0x3739ce['limit']=qs['limit'](_0x5447f3['query']['limit']);_0x3739ce[_0x83db('0x22')]=qs[_0x83db('0x22')](_0x5447f3[_0x83db('0x38')]['offset']);}_0x3739ce[_0x83db('0x41')]=qs[_0x83db('0x42')](_0x5447f3['query'][_0x83db('0x42')]);_0x3739ce[_0x83db('0x43')]=qs[_0x83db('0x3a')](_[_0x83db('0x44')](_0x5447f3[_0x83db('0x38')],_0x3ba77c['filters']),_0x302714);if(_0x5447f3[_0x83db('0x38')][_0x83db('0x45')]){_0x3739ce[_0x83db('0x43')]=_[_0x83db('0x46')](_0x3739ce[_0x83db('0x43')],{'$or':_[_0x83db('0x32')](_0x302714,function(_0x7ca2b8){if(_0x7ca2b8[_0x83db('0x35')]!==_0x83db('0x47')){var _0x13fb9d={};_0x13fb9d[_0x7ca2b8[_0x83db('0x2f')]]={'$like':'%'+_0x5447f3[_0x83db('0x38')]['filter']+'%'};return _0x13fb9d;}})});}_0x3739ce=_[_0x83db('0x46')]({},_0x3739ce,_0x5447f3[_0x83db('0x48')]);var _0x4b33ac={'where':_0x3739ce[_0x83db('0x43')]};return db[_0x83db('0x33')][_0x83db('0x25')](_0x4b33ac)['then'](function(_0x197aad){_0x2c5537[_0x83db('0x25')]=_0x197aad;if(_0x5447f3[_0x83db('0x38')][_0x83db('0x49')]){_0x3739ce['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x3739ce);})[_0x83db('0x2c')](function(_0x1c03f7){_0x2c5537[_0x83db('0x4a')]=_0x1c03f7;return _0x2c5537;})[_0x83db('0x2c')](respondWithFilteredResult(_0x4cd3b4,_0x3739ce))['catch'](handleError(_0x4cd3b4,null));};exports[_0x83db('0x4b')]=function(_0x18127a,_0x40a246){var _0x453da0={'raw':![],'where':{'id':_0x18127a['params']['id']}},_0xcffa50={};_0xcffa50['model']=_[_0x83db('0x39')](db[_0x83db('0x33')][_0x83db('0x4c')]);_0xcffa50[_0x83db('0x38')]=_[_0x83db('0x39')](_0x18127a[_0x83db('0x38')]);_0xcffa50['filters']=_[_0x83db('0x3b')](_0xcffa50[_0x83db('0x37')],_0xcffa50[_0x83db('0x38')]);_0x453da0[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0xcffa50[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x18127a[_0x83db('0x38')][_0x83db('0x3d')]));_0x453da0[_0x83db('0x3c')]=_0x453da0[_0x83db('0x3c')][_0x83db('0x3e')]?_0x453da0['attributes']:_0xcffa50[_0x83db('0x37')];if(_0x18127a['query']['includeAll']){_0x453da0[_0x83db('0x4d')]=[{'all':!![]}];}_0x453da0=_['merge']({},_0x453da0,_0x18127a[_0x83db('0x48')]);return db['Team'][_0x83db('0x4e')](_0x453da0)[_0x83db('0x2c')](handleEntityNotFound(_0x40a246,null))[_0x83db('0x2c')](respondWithResult(_0x40a246,null))[_0x83db('0x4f')](handleError(_0x40a246,null));};exports['create']=function(_0x17fd20,_0x430dff){return db[_0x83db('0x33')]['create'](_0x17fd20[_0x83db('0x50')],{})[_0x83db('0x2c')](function(_0x4ae587){var _0x296a8a=_0x17fd20[_0x83db('0x51')][_0x83db('0x52')]({'plain':!![]});if(!_0x296a8a)throw new Error(_0x83db('0x53'));if(_0x296a8a['role']==='user'){var _0x224830=_0x4ae587['get']({'plain':!![]});var _0x160475='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x160475,'userProfileId':_0x296a8a[_0x83db('0x54')]},'raw':!![]})[_0x83db('0x2c')](function(_0x33121e){if(_0x33121e&&_0x33121e[_0x83db('0x55')]===0x0){return db['UserProfileResource'][_0x83db('0x56')]({'name':_0x224830[_0x83db('0x2f')],'resourceId':_0x224830['id'],'type':_0x33121e[_0x83db('0x2f')],'sectionId':_0x33121e['id']},{})['then'](function(){return _0x4ae587;});}else{return _0x4ae587;}})[_0x83db('0x4f')](function(_0x52d9ff){logger[_0x83db('0x2d')](_0x83db('0x57'),_0x52d9ff);throw _0x52d9ff;});}return _0x4ae587;})[_0x83db('0x2c')](respondWithResult(_0x430dff,0xc9))['catch'](handleError(_0x430dff,null));};exports[_0x83db('0x58')]=function(_0x28ec23,_0x1fb5c2){if(_0x28ec23['body']['id']){delete _0x28ec23['body']['id'];}return db[_0x83db('0x33')]['find']({'where':{'id':_0x28ec23[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x1fb5c2,null))[_0x83db('0x2c')](saveUpdates(_0x28ec23[_0x83db('0x50')],null))[_0x83db('0x2c')](respondWithResult(_0x1fb5c2,null))[_0x83db('0x4f')](handleError(_0x1fb5c2,null));};exports[_0x83db('0x5a')]=function(_0xdec844,_0x1dcb07){var _0x6415dd=_0xdec844[_0x83db('0x59')]['id'];var _0x33c6ea=[];return db[_0x83db('0x5b')][_0x83db('0x5c')](function(_0x63fbd7){var _0x496b25=_0x83db('0x5d')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x496b25,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7})['then'](function(_0x83b22a){_0x33c6ea=_[_0x83db('0x32')](_0x83b22a,function(_0x230960){return Number(_0x230960[_0x83db('0x61')]);});})[_0x83db('0x2c')](function(){var _0xe6e6b3=_0x83db('0x62')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0xe6e6b3,{'type':db[_0x83db('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x44de75){var _0x437b9d=_[_0x83db('0x32')](_0x44de75,function(_0x332d54){return Number(_0x332d54['VoiceQueueId']);});return db[_0x83db('0x63')]['destroy']({'where':{'UserId':{'$in':_0x33c6ea},'VoiceQueueId':{'$in':_0x437b9d}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x596a7e='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x596a7e,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x46c533){var _0x5aab36=_['map'](_0x46c533,function(_0x4883e6){return Number(_0x4883e6[_0x83db('0x64')]);});return db[_0x83db('0x65')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'MailQueueId':{'$in':_0x5aab36}},'transaction':_0x63fbd7});})['then'](function(){var _0x49ab4f=_0x83db('0x66')+_0x6415dd;return db['sequelize'][_0x83db('0x38')](_0x49ab4f,{'type':db['Sequelize']['QueryTypes'][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})['then'](function(_0x7bc48a){var _0x52702d=_[_0x83db('0x32')](_0x7bc48a,function(_0x5144c1){return Number(_0x5144c1[_0x83db('0x67')]);});return db[_0x83db('0x68')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'SmsQueueId':{'$in':_0x52702d}},'transaction':_0x63fbd7});})['then'](function(){var _0x46b136=_0x83db('0x69')+_0x6415dd;return db['sequelize'][_0x83db('0x38')](_0x46b136,{'type':db[_0x83db('0x5e')]['QueryTypes'][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x5068c7){var _0x7afea6=_[_0x83db('0x32')](_0x5068c7,function(_0x560eaf){return Number(_0x560eaf[_0x83db('0x6a')]);});return db[_0x83db('0x6b')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'ChatQueueId':{'$in':_0x7afea6}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x2d74c7=_0x83db('0x6c')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x2d74c7,{'type':db['Sequelize'][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})['then'](function(_0x38cf08){var _0x2640eb=_[_0x83db('0x32')](_0x38cf08,function(_0x573337){return Number(_0x573337[_0x83db('0x6d')]);});return db['UserFaxQueue'][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'FaxQueueId':{'$in':_0x2640eb}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x569fcf=_0x83db('0x6e')+_0x6415dd;return db[_0x83db('0x5b')]['query'](_0x569fcf,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x157df4){var _0x13b3f1=_[_0x83db('0x32')](_0x157df4,function(_0x468ed9){return Number(_0x468ed9[_0x83db('0x6f')]);});return db['UserOpenchannelQueue'][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'OpenchannelQueueId':{'$in':_0x13b3f1}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x2268f3=_0x83db('0x70')+_0x6415dd;return db[_0x83db('0x5b')]['query'](_0x2268f3,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0xd9384f){var _0x48febd=_[_0x83db('0x32')](_0xd9384f,function(_0x330987){return Number(_0x330987['WhatsappQueueId']);});return db[_0x83db('0x71')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'WhatsappQueueId':{'$in':_0x48febd}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')][_0x83db('0x4e')]({'where':{'TeamId':_0x6415dd}});})['then'](function(_0x43c71e){if(_0x43c71e===null){return;}return db[_0x83db('0x73')]['destroy']({'where':{'UserId':{'$in':_0x33c6ea},'VoicePrefixId':_0x43c71e[_0x83db('0x74')]},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){return db['Team'][_0x83db('0x5a')]({'where':{'id':_0x6415dd},'cascade':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x37b02d){if(_0x37b02d===0x0){_0x1dcb07[_0x83db('0x1f')](0x194);}else{return db[_0x83db('0x75')][_0x83db('0x5a')]({'where':{'type':_0x83db('0x76'),'resourceId':_0x6415dd},'cascade':!![],'transaction':_0x63fbd7})[_0x83db('0x2c')](function(){_0x1dcb07[_0x83db('0x20')](0xcc)[_0x83db('0x21')]();});}})[_0x83db('0x4f')](function(_0x335c3e){_0x1dcb07[_0x83db('0x20')](0x1f4)[_0x83db('0x30')](_0x335c3e);});});};exports[_0x83db('0x77')]=function(_0x4c0bd0,_0x35f932,_0xc77e7a){return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x4c0bd0[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x35f932,null))[_0x83db('0x2c')](function(_0xa3b6f4){if(!_0x4c0bd0[_0x83db('0x38')][_0x83db('0x79')]||!utils['isValidChannel'](_0x4c0bd0[_0x83db('0x38')]['channel'])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}var _0x45a17c={};var _0x3c4e73={};_0x3c4e73[_0x83db('0x37')]=_[_0x83db('0x39')](db[_[_0x83db('0x7c')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x79')][_0x83db('0x7d')]())+_0x83db('0x7e')][_0x83db('0x4c')]);_0x3c4e73[_0x83db('0x38')]=_['keys'](_0x4c0bd0[_0x83db('0x38')]);_0x3c4e73[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x3c4e73['model'],_0x3c4e73[_0x83db('0x38')]);_0x45a17c[_0x83db('0x3c')]=_['intersection'](_0x3c4e73[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x3d')]));_0x45a17c[_0x83db('0x3c')]=_0x45a17c[_0x83db('0x3c')]['length']?_0x45a17c[_0x83db('0x3c')]:_0x3c4e73[_0x83db('0x37')];_0x45a17c[_0x83db('0x23')]=qs[_0x83db('0x23')](_0x4c0bd0['query'][_0x83db('0x23')]);_0x45a17c[_0x83db('0x22')]=qs[_0x83db('0x22')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x22')]);_0x45a17c['order']=qs[_0x83db('0x42')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x42')]);_0x45a17c[_0x83db('0x43')]=qs['filters'](_['pick'](_0x4c0bd0[_0x83db('0x38')],_0x3c4e73[_0x83db('0x3a')]));_0x45a17c=_[_0x83db('0x46')]({},_0x45a17c,_0x4c0bd0[_0x83db('0x48')]);return _0xa3b6f4[_0x83db('0x52')+_['capitalize'](_0x4c0bd0['query'][_0x83db('0x79')]['toLowerCase']())+_0x83db('0x7f')](_0x45a17c);})['then'](respondWithResult(_0x35f932,null))[_0x83db('0x4f')](handleError(_0x35f932,null));};exports[_0x83db('0x80')]=function(_0x3757af,_0x4a4739,_0x416cba){return db['Team'][_0x83db('0x78')]({'where':{'id':_0x3757af['params']['id']}})[_0x83db('0x2c')](function(_0x3777ee){if(_0x3777ee){if(!_0x3757af[_0x83db('0x50')][_0x83db('0x79')]||!utils[_0x83db('0x81')](_0x3757af[_0x83db('0x50')][_0x83db('0x79')])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}return _0x3777ee['add'+_[_0x83db('0x7c')](_0x3757af[_0x83db('0x50')]['channel'][_0x83db('0x7d')]())+_0x83db('0x7f')](_0x3757af['body'][_0x83db('0x82')]);}return null;})[_0x83db('0x2c')](handleEntityNotFound(_0x4a4739,null))[_0x83db('0x2c')](respondWithStatusCode(_0x4a4739,null))['catch'](handleError(_0x4a4739,null));};exports[_0x83db('0x83')]=function(_0x5a76a2,_0x3cee54,_0x21cb77){return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x5a76a2[_0x83db('0x59')]['id']}})['then'](function(_0x36ccf9){if(_0x36ccf9){if(!_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')]||!utils[_0x83db('0x81')](_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}return _0x36ccf9[_0x83db('0x84')+_[_0x83db('0x7c')](_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')][_0x83db('0x7d')]())+_0x83db('0x7f')](_0x5a76a2['query'][_0x83db('0x82')]);}return null;})['then'](handleEntityNotFound(_0x3cee54,null))['then'](respondWithStatusCode(_0x3cee54,null))[_0x83db('0x4f')](handleError(_0x3cee54,null));};exports[_0x83db('0x85')]=function(_0x139e4c,_0x46eff0){var _0x38337e=_[_0x83db('0x86')](_0x139e4c[_0x83db('0x50')][_0x83db('0x82')])?_0x139e4c['body'][_0x83db('0x82')]:[_0x139e4c[_0x83db('0x50')][_0x83db('0x82')]];var _0x4ab6c7=_0x139e4c[_0x83db('0x59')]['id'];return db['Team'][_0x83db('0x4e')]({'where':{'id':_0x4ab6c7}})[_0x83db('0x2c')](handleEntityNotFound(_0x46eff0,null))[_0x83db('0x2c')](function(_0x4f7218){if(_0x4f7218){var _0x414515=[_0x83db('0x87'),_0x83db('0x88'),_0x83db('0x89'),_0x83db('0x8a'),_0x83db('0x8b'),'Openchannel','Whatsapp'];return db['sequelize']['transaction'](function(_0x16264c){var _0x85861a=_['map'](_0x414515,function(_0x2992ae){var _0x11ba96={'attributes':['id',_0x83db('0x2f')]};if(_0x2992ae==='Voice'){_0x11ba96[_0x83db('0x8c')]={'attributes':[_0x83db('0x8d')]};}return _0x4f7218['get'+_0x2992ae+'Queues'](_0x11ba96)[_0x83db('0x2c')](function(_0x37e373){var _0x559f3c=_[_0x83db('0x32')](_0x37e373,function(_0x462ad5){var _0x30e0f2=_[_0x83db('0x32')](_0x38337e,function(_0x3a20be){var _0x8df244={'where':{'UserId':_0x3a20be,[_0x2992ae+_0x83db('0x8e')]:_0x462ad5['id']},'transaction':_0x16264c};if(_0x2992ae===_0x83db('0x87')){_0x8df244['defaults']={'penalty':_0x462ad5[_0x83db('0x8f')][_0x83db('0x8d')]};}return db[_0x83db('0x90')+_0x2992ae+_0x83db('0x7e')][_0x83db('0x91')](_0x8df244)['then'](function(){socket[_0x83db('0x92')](_0x83db('0x51')+_0x2992ae+_0x83db('0x93'),{'UserId':_0x3a20be,[_0x2992ae+_0x83db('0x8e')]:_0x462ad5['id']});if(_0x2992ae!==_0x83db('0x87')){return;}return db['User'][_0x83db('0x94')]({'where':{'id':_0x38337e,'online':0x1},'attributes':['id',_0x83db('0x2f'),'online',_0x83db('0x95'),'interface'],'raw':!![]})[_0x83db('0x2c')](function(_0x3ac152){var _0x29a6f3=_['map'](_0x3ac152,function(_0x4b22b9){return db[_0x83db('0x96')][_0x83db('0x97')]({'membername':_0x4b22b9[_0x83db('0x2f')],'UserId':_0x4b22b9['id'],'queue_name':_0x462ad5['name'],'VoiceQueueId':_0x462ad5['id'],'interface':_[_0x83db('0x98')](_0x4b22b9[_0x83db('0x99')])?util[_0x83db('0x9a')]('SIP/%s',_0x4b22b9[_0x83db('0x2f')]):_0x4b22b9[_0x83db('0x99')],'paused':_0x4b22b9[_0x83db('0x95')]||![],'penalty':_0x462ad5['TeamVoiceQueue'][_0x83db('0x8d')]},{'transaction':_0x16264c});});return Promise[_0x83db('0x9b')](_0x29a6f3);});});});return Promise[_0x83db('0x9b')](_0x30e0f2);});return Promise[_0x83db('0x9b')](_0x559f3c);})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')]['findOne']({'where':{'teamId':_0x4ab6c7}})[_0x83db('0x2c')](function(_0x54b680){if(_0x54b680){var _0x3fc659=_[_0x83db('0x32')](_0x38337e,function(_0x1ce138){db[_0x83db('0x73')][_0x83db('0x97')]({'UserId':_0x1ce138,'VoicePrefixId':_0x54b680[_0x83db('0x74')]});});return Promise[_0x83db('0x9b')](_0x3fc659);}});});});return Promise[_0x83db('0x9b')](_0x85861a)[_0x83db('0x2c')](function(){return _0x4f7218[_0x83db('0x85')](_0x38337e,{'transaction':_0x16264c})[_0x83db('0x9c')](function(_0x6937e9){return _0x6937e9;});});});}})[_0x83db('0x2c')](respondWithResult(_0x46eff0,null))[_0x83db('0x4f')](handleError(_0x46eff0,null));};exports['removeAgents']=function(_0x17f29d,_0x543bbe){var _0x50b028=_[_0x83db('0x86')](_0x17f29d[_0x83db('0x38')][_0x83db('0x82')])?_0x17f29d['query'][_0x83db('0x82')]:[_0x17f29d[_0x83db('0x38')]['ids']];var _0x328480=_0x17f29d[_0x83db('0x59')]['id'];return db['Team']['find']({'where':{'id':_0x328480}})[_0x83db('0x2c')](handleEntityNotFound(_0x543bbe,null))['then'](function(_0x50c7d5){if(_0x50c7d5){var _0x56eb0b=[_0x83db('0x87'),_0x83db('0x88'),_0x83db('0x89'),_0x83db('0x8a'),_0x83db('0x8b'),_0x83db('0x9d'),_0x83db('0x9e')];return db['sequelize']['transaction'](function(_0x4d606c){var _0x10136d=_[_0x83db('0x32')](_0x56eb0b,function(_0x4a8a65){var _0x27fb64={'attributes':['id',_0x83db('0x2f')]};return _0x50c7d5[_0x83db('0x52')+_0x4a8a65+_0x83db('0x7f')](_0x27fb64)[_0x83db('0x2c')](function(_0x2b9d3e){var _0x1fa43c=_['map'](_0x2b9d3e,function(_0x3ed454){return _0x3ed454['removeAgents'](_0x50b028,{'transaction':_0x4d606c})[_0x83db('0x2c')](function(){var _0x5e5e9a=_[_0x83db('0x32')](_0x50b028,function(_0x5b2014){socket[_0x83db('0x92')](_0x83db('0x51')+_0x4a8a65+_0x83db('0x9f'),{'UserId':Number(_0x5b2014),[_0x4a8a65+_0x83db('0x8e')]:_0x3ed454['id']});if(_0x4a8a65!==_0x83db('0x87')){return;}return db[_0x83db('0x96')][_0x83db('0x5a')]({'where':{'VoiceQueueId':_0x3ed454['id'],'UserId':_0x5b2014},'transaction':_0x4d606c});});return Promise[_0x83db('0x9b')](_0x5e5e9a);});});return Promise[_0x83db('0x9b')](_0x1fa43c);});});return Promise[_0x83db('0x9b')](_0x10136d)['then'](function(){return _0x50c7d5[_0x83db('0xa0')](_0x50b028,{'transaction':_0x4d606c});})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')]['findOne']({'where':{'teamId':_0x328480}})[_0x83db('0x2c')](function(_0x42b6df){if(_0x42b6df){var _0x4f153d=_[_0x83db('0x32')](_0x50b028,function(_0x3c90b2){db[_0x83db('0x73')]['destroy']({'where':{'UserId':_0x3c90b2,'VoicePrefixId':_0x42b6df[_0x83db('0x74')]}});});return Promise[_0x83db('0x9b')](_0x4f153d);}});});});}})[_0x83db('0x2c')](respondWithStatusCode(_0x543bbe,null))[_0x83db('0x4f')](handleError(_0x543bbe,null));};exports[_0x83db('0xa1')]=function(_0x4472df,_0x340ed6,_0x5412aa){var _0x1e3430={};var _0x47abe8={};var _0x287eb2;var _0x42dc7c;return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x4472df[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x340ed6,null))[_0x83db('0x2c')](function(_0x896ab8){if(_0x896ab8){_0x287eb2=_0x896ab8;_0x47abe8[_0x83db('0x37')]=_['keys'](db[_0x83db('0x90')][_0x83db('0x4c')]);_0x47abe8['query']=_[_0x83db('0x39')](_0x4472df[_0x83db('0x38')]);_0x47abe8[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x47abe8[_0x83db('0x37')],_0x47abe8[_0x83db('0x38')]);_0x1e3430[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0x47abe8[_0x83db('0x37')],qs['fields'](_0x4472df['query']['fields']));_0x1e3430['attributes']=_0x1e3430[_0x83db('0x3c')]['length']?_0x1e3430[_0x83db('0x3c')]:_0x47abe8[_0x83db('0x37')];_0x1e3430[_0x83db('0x41')]=qs[_0x83db('0x42')](_0x4472df[_0x83db('0x38')][_0x83db('0x42')]);_0x1e3430[_0x83db('0x43')]=qs[_0x83db('0x3a')](_[_0x83db('0x44')](_0x4472df[_0x83db('0x38')],_0x47abe8[_0x83db('0x3a')]));if(_0x4472df[_0x83db('0x38')][_0x83db('0x45')]){_0x1e3430[_0x83db('0x43')]=_['merge'](_0x1e3430[_0x83db('0x43')],{'$or':_['map'](_0x1e3430[_0x83db('0x3c')],function(_0x3cf55c){var _0x4e2332={};_0x4e2332[_0x3cf55c]={'$like':'%'+_0x4472df[_0x83db('0x38')]['filter']+'%'};return _0x4e2332;})});}_0x1e3430=_['merge']({},_0x1e3430,_0x4472df[_0x83db('0x48')]);return _0x287eb2[_0x83db('0xa1')](_0x1e3430);}})[_0x83db('0x2c')](function(_0x115c9a){if(_0x115c9a){_0x42dc7c=_0x115c9a[_0x83db('0x3e')];if(!_0x4472df['query'][_0x83db('0x3f')](_0x83db('0x40'))){_0x1e3430[_0x83db('0x23')]=qs[_0x83db('0x23')](_0x4472df[_0x83db('0x38')][_0x83db('0x23')]);_0x1e3430[_0x83db('0x22')]=qs['offset'](_0x4472df[_0x83db('0x38')][_0x83db('0x22')]);}return _0x287eb2[_0x83db('0xa1')](_0x1e3430);}})[_0x83db('0x2c')](function(_0x4da6cd){if(_0x4da6cd){return _0x4da6cd?{'count':_0x42dc7c,'rows':_0x4da6cd}:null;}})[_0x83db('0x2c')](respondWithResult(_0x340ed6,null))[_0x83db('0x4f')](handleError(_0x340ed6,null));}; \ No newline at end of file +var _0xc96a=['Whatsapp','through','penalty','get','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','UserVoicePrefix','upsert','spread','isArray','Chat','Mail','Fax','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','error','stack','name','send','Team','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','then','includeAll','include','rows','catch','params','keys','rawAttributes','length','merge','options','find','create','body','user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','ids','remove','addAgents','Voice','Sms','Openchannel'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xc96a,0xb9));var _0xac96=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xc96a[_0x266618];return _0x54dbf5;};'use strict';var emlformat=require(_0xac96('0x0'));var rimraf=require(_0xac96('0x1'));var zipdir=require(_0xac96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac96('0x3'));var moment=require('moment');var BPromise=require(_0xac96('0x4'));var Mustache=require('mustache');var util=require(_0xac96('0x5'));var path=require(_0xac96('0x6'));var sox=require(_0xac96('0x7'));var csv=require('to-csv');var ejs=require(_0xac96('0x8'));var fs=require('fs');var fs_extra=require(_0xac96('0x9'));var _=require(_0xac96('0xa'));var squel=require(_0xac96('0xb'));var crypto=require(_0xac96('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xac96('0xd'));var toCsv=require(_0xac96('0xe'));var querystring=require('querystring');var Papa=require(_0xac96('0xf'));var Redis=require(_0xac96('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac96('0x11'));var as=require(_0xac96('0x12'));var hardwareService=require(_0xac96('0x13'));var logger=require(_0xac96('0x14'))(_0xac96('0x15'));var utils=require(_0xac96('0x16'));var config=require(_0xac96('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xac96('0x18')]=_[_0xac96('0x19')](config[_0xac96('0x18')],{'host':_0xac96('0x1a'),'port':0x18eb});var socket=require(_0xac96('0x1b'))(new Redis(config[_0xac96('0x18')]));require(_0xac96('0x1c'))[_0xac96('0x1d')](socket);function respondWithStatusCode(_0x3d513e,_0xbb38b7){_0xbb38b7=_0xbb38b7||0xcc;return function(_0x1c91dd){if(_0x1c91dd){return _0x3d513e[_0xac96('0x1e')](_0xbb38b7);}return _0x3d513e[_0xac96('0x1f')](_0xbb38b7)[_0xac96('0x20')]();};}function respondWithResult(_0x1a4e71,_0x17f648){_0x17f648=_0x17f648||0xc8;return function(_0x2e2d21){if(_0x2e2d21){return _0x1a4e71[_0xac96('0x1f')](_0x17f648)[_0xac96('0x21')](_0x2e2d21);}};}function respondWithFilteredResult(_0x55881b,_0x195877){return function(_0x5f368e){if(_0x5f368e){var _0x237544=typeof _0x195877[_0xac96('0x22')]===_0xac96('0x23')&&typeof _0x195877[_0xac96('0x24')]==='undefined';var _0x24d894=_0x5f368e[_0xac96('0x25')];var _0x21c34a=_0x237544?0x0:_0x195877[_0xac96('0x22')];var _0x1c93b8=_0x237544?_0x5f368e['count']:_0x195877[_0xac96('0x22')]+_0x195877[_0xac96('0x24')];var _0x24a909;if(_0x1c93b8>=_0x24d894){_0x1c93b8=_0x24d894;_0x24a909=0xc8;}else{_0x24a909=0xce;}_0x55881b[_0xac96('0x1f')](_0x24a909);return _0x55881b['set'](_0xac96('0x26'),_0x21c34a+'-'+_0x1c93b8+'/'+_0x24d894)[_0xac96('0x21')](_0x5f368e);}return null;};}function patchUpdates(_0x2b46a1){return function(_0x1a301a){try{jsonpatch[_0xac96('0x27')](_0x1a301a,_0x2b46a1,!![]);}catch(_0x4119fb){return BPromise[_0xac96('0x28')](_0x4119fb);}return _0x1a301a[_0xac96('0x29')]();};}function saveUpdates(_0x50c644,_0x58fccd){return function(_0x2a169d){if(_0x2a169d){return _0x2a169d['update'](_0x50c644)['then'](function(_0x29df40){return _0x29df40;});}return null;};}function handleEntityNotFound(_0x4799b2,_0x2261eb){return function(_0x177d0b){if(!_0x177d0b){_0x4799b2['sendStatus'](0x194);}return _0x177d0b;};}function handleError(_0x54d485,_0xe91768){_0xe91768=_0xe91768||0x1f4;return function(_0x29feb4){logger[_0xac96('0x2a')](_0x29feb4[_0xac96('0x2b')]);if(_0x29feb4[_0xac96('0x2c')]){delete _0x29feb4[_0xac96('0x2c')];}_0x54d485['status'](_0xe91768)[_0xac96('0x2d')](_0x29feb4);};}exports['index']=function(_0x57935d,_0x2adebf){var _0x3fa551={},_0x25e103={},_0x27c1f5={'count':0x0,'rows':[]};var _0x253693=_['map'](db[_0xac96('0x2e')]['rawAttributes'],function(_0x17a94c){return{'name':_0x17a94c[_0xac96('0x2f')],'type':_0x17a94c['type'][_0xac96('0x30')]};});_0x25e103[_0xac96('0x31')]=_[_0xac96('0x32')](_0x253693,'name');_0x25e103['query']=_['keys'](_0x57935d[_0xac96('0x33')]);_0x25e103['filters']=_[_0xac96('0x34')](_0x25e103[_0xac96('0x31')],_0x25e103[_0xac96('0x33')]);_0x3fa551[_0xac96('0x35')]=_[_0xac96('0x34')](_0x25e103[_0xac96('0x31')],qs['fields'](_0x57935d[_0xac96('0x33')][_0xac96('0x36')]));_0x3fa551[_0xac96('0x35')]=_0x3fa551['attributes']['length']?_0x3fa551[_0xac96('0x35')]:_0x25e103[_0xac96('0x31')];if(!_0x57935d['query'][_0xac96('0x37')](_0xac96('0x38'))){_0x3fa551[_0xac96('0x24')]=qs[_0xac96('0x24')](_0x57935d[_0xac96('0x33')]['limit']);_0x3fa551[_0xac96('0x22')]=qs[_0xac96('0x22')](_0x57935d[_0xac96('0x33')][_0xac96('0x22')]);}_0x3fa551[_0xac96('0x39')]=qs[_0xac96('0x3a')](_0x57935d[_0xac96('0x33')][_0xac96('0x3a')]);_0x3fa551['where']=qs['filters'](_[_0xac96('0x3b')](_0x57935d['query'],_0x25e103[_0xac96('0x3c')]),_0x253693);if(_0x57935d[_0xac96('0x33')][_0xac96('0x3d')]){_0x3fa551[_0xac96('0x3e')]=_['merge'](_0x3fa551[_0xac96('0x3e')],{'$or':_['map'](_0x253693,function(_0x1eb10f){if(_0x1eb10f['type']!==_0xac96('0x3f')){var _0xe25ee6={};_0xe25ee6[_0x1eb10f['name']]={'$like':'%'+_0x57935d['query']['filter']+'%'};return _0xe25ee6;}})});}_0x3fa551=_['merge']({},_0x3fa551,_0x57935d['options']);var _0x9004c7={'where':_0x3fa551[_0xac96('0x3e')]};return db[_0xac96('0x2e')][_0xac96('0x25')](_0x9004c7)[_0xac96('0x40')](function(_0xebd6bf){_0x27c1f5[_0xac96('0x25')]=_0xebd6bf;if(_0x57935d[_0xac96('0x33')][_0xac96('0x41')]){_0x3fa551[_0xac96('0x42')]=[{'all':!![]}];}return db[_0xac96('0x2e')]['findAll'](_0x3fa551);})[_0xac96('0x40')](function(_0x5c8ff7){_0x27c1f5[_0xac96('0x43')]=_0x5c8ff7;return _0x27c1f5;})['then'](respondWithFilteredResult(_0x2adebf,_0x3fa551))[_0xac96('0x44')](handleError(_0x2adebf,null));};exports['show']=function(_0x31b72d,_0x370027){var _0x20736a={'raw':![],'where':{'id':_0x31b72d[_0xac96('0x45')]['id']}},_0x5b24d1={};_0x5b24d1[_0xac96('0x31')]=_[_0xac96('0x46')](db[_0xac96('0x2e')][_0xac96('0x47')]);_0x5b24d1[_0xac96('0x33')]=_[_0xac96('0x46')](_0x31b72d['query']);_0x5b24d1[_0xac96('0x3c')]=_[_0xac96('0x34')](_0x5b24d1[_0xac96('0x31')],_0x5b24d1['query']);_0x20736a[_0xac96('0x35')]=_[_0xac96('0x34')](_0x5b24d1['model'],qs[_0xac96('0x36')](_0x31b72d['query'][_0xac96('0x36')]));_0x20736a[_0xac96('0x35')]=_0x20736a[_0xac96('0x35')][_0xac96('0x48')]?_0x20736a[_0xac96('0x35')]:_0x5b24d1['model'];if(_0x31b72d[_0xac96('0x33')][_0xac96('0x41')]){_0x20736a[_0xac96('0x42')]=[{'all':!![]}];}_0x20736a=_[_0xac96('0x49')]({},_0x20736a,_0x31b72d[_0xac96('0x4a')]);return db[_0xac96('0x2e')][_0xac96('0x4b')](_0x20736a)[_0xac96('0x40')](handleEntityNotFound(_0x370027,null))[_0xac96('0x40')](respondWithResult(_0x370027,null))[_0xac96('0x44')](handleError(_0x370027,null));};exports[_0xac96('0x4c')]=function(_0x18b6d4,_0x1b5d7a){return db[_0xac96('0x2e')][_0xac96('0x4c')](_0x18b6d4[_0xac96('0x4d')],{})['then'](function(_0x318c2e){var _0x371a8e=_0x18b6d4[_0xac96('0x4e')]['get']({'plain':!![]});if(!_0x371a8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x371a8e['role']===_0xac96('0x4e')){var _0x5a75b7=_0x318c2e['get']({'plain':!![]});var _0xb507f0=_0xac96('0x4f');return db[_0xac96('0x50')][_0xac96('0x4b')]({'where':{'name':_0xb507f0,'userProfileId':_0x371a8e[_0xac96('0x51')]},'raw':!![]})[_0xac96('0x40')](function(_0x5f0373){if(_0x5f0373&&_0x5f0373['autoAssociation']===0x0){return db['UserProfileResource'][_0xac96('0x4c')]({'name':_0x5a75b7[_0xac96('0x2c')],'resourceId':_0x5a75b7['id'],'type':_0x5f0373[_0xac96('0x2c')],'sectionId':_0x5f0373['id']},{})[_0xac96('0x40')](function(){return _0x318c2e;});}else{return _0x318c2e;}})[_0xac96('0x44')](function(_0x23714a){logger['error'](_0xac96('0x52'),_0x23714a);throw _0x23714a;});}return _0x318c2e;})[_0xac96('0x40')](respondWithResult(_0x1b5d7a,0xc9))[_0xac96('0x44')](handleError(_0x1b5d7a,null));};exports['update']=function(_0x4b39c8,_0x2c1110){if(_0x4b39c8[_0xac96('0x4d')]['id']){delete _0x4b39c8[_0xac96('0x4d')]['id'];}return db['Team']['find']({'where':{'id':_0x4b39c8['params']['id']}})['then'](handleEntityNotFound(_0x2c1110,null))['then'](saveUpdates(_0x4b39c8[_0xac96('0x4d')],null))['then'](respondWithResult(_0x2c1110,null))[_0xac96('0x44')](handleError(_0x2c1110,null));};exports['destroy']=function(_0x4cba28,_0x4310bf){var _0x5eac38=_0x4cba28[_0xac96('0x45')]['id'];var _0x51a7d3=[];return db[_0xac96('0x53')][_0xac96('0x54')](function(_0xedc21){var _0x31396a=_0xac96('0x55')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x31396a,{'type':db['Sequelize'][_0xac96('0x56')]['SELECT'],'raw':!![],'transaction':_0xedc21})[_0xac96('0x40')](function(_0x1c7268){_0x51a7d3=_[_0xac96('0x32')](_0x1c7268,function(_0x47d676){return Number(_0x47d676[_0xac96('0x57')]);});})[_0xac96('0x40')](function(){var _0x589f3d=_0xac96('0x58')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x589f3d,{'type':db[_0xac96('0x59')][_0xac96('0x56')][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x55a277){var _0x303ddc=_[_0xac96('0x32')](_0x55a277,function(_0x380ec0){return Number(_0x380ec0['VoiceQueueId']);});return db[_0xac96('0x5b')][_0xac96('0x5c')]({'where':{'UserId':{'$in':_0x51a7d3},'VoiceQueueId':{'$in':_0x303ddc}},'transaction':_0xedc21});})[_0xac96('0x40')](function(){var _0x1d9057=_0xac96('0x5d')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x1d9057,{'type':db['Sequelize'][_0xac96('0x56')][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x12e964){var _0x5ca494=_[_0xac96('0x32')](_0x12e964,function(_0xb71d9a){return Number(_0xb71d9a[_0xac96('0x5e')]);});return db[_0xac96('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x51a7d3},'MailQueueId':{'$in':_0x5ca494}},'transaction':_0xedc21});})['then'](function(){var _0x19f890='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5eac38;return db[_0xac96('0x53')]['query'](_0x19f890,{'type':db[_0xac96('0x59')]['QueryTypes'][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x391a95){var _0x4c6f06=_[_0xac96('0x32')](_0x391a95,function(_0x3b592a){return Number(_0x3b592a[_0xac96('0x60')]);});return db[_0xac96('0x61')][_0xac96('0x5c')]({'where':{'UserId':{'$in':_0x51a7d3},'SmsQueueId':{'$in':_0x4c6f06}},'transaction':_0xedc21});})[_0xac96('0x40')](function(){var _0x35085d=_0xac96('0x62')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x35085d,{'type':db[_0xac96('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x420cd8){var _0x5d8917=_[_0xac96('0x32')](_0x420cd8,function(_0x41dea4){return Number(_0x41dea4[_0xac96('0x63')]);});return db['UserChatQueue'][_0xac96('0x5c')]({'where':{'UserId':{'$in':_0x51a7d3},'ChatQueueId':{'$in':_0x5d8917}},'transaction':_0xedc21});})[_0xac96('0x40')](function(){var _0x46ad63=_0xac96('0x64')+_0x5eac38;return db[_0xac96('0x53')]['query'](_0x46ad63,{'type':db[_0xac96('0x59')][_0xac96('0x56')][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x5a8177){var _0x395a69=_[_0xac96('0x32')](_0x5a8177,function(_0x40334d){return Number(_0x40334d[_0xac96('0x65')]);});return db[_0xac96('0x66')]['destroy']({'where':{'UserId':{'$in':_0x51a7d3},'FaxQueueId':{'$in':_0x395a69}},'transaction':_0xedc21});})[_0xac96('0x40')](function(){var _0x30c50c=_0xac96('0x67')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x30c50c,{'type':db[_0xac96('0x59')][_0xac96('0x56')][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x5b2a1e){var _0x288d2=_[_0xac96('0x32')](_0x5b2a1e,function(_0x302eb5){return Number(_0x302eb5[_0xac96('0x68')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x51a7d3},'OpenchannelQueueId':{'$in':_0x288d2}},'transaction':_0xedc21});})[_0xac96('0x40')](function(){var _0x4570b8=_0xac96('0x69')+_0x5eac38;return db[_0xac96('0x53')][_0xac96('0x33')](_0x4570b8,{'type':db[_0xac96('0x59')][_0xac96('0x56')][_0xac96('0x5a')],'raw':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x190478){var _0x4c972e=_[_0xac96('0x32')](_0x190478,function(_0x5b07ab){return Number(_0x5b07ab[_0xac96('0x6a')]);});return db[_0xac96('0x6b')][_0xac96('0x5c')]({'where':{'UserId':{'$in':_0x51a7d3},'WhatsappQueueId':{'$in':_0x4c972e}},'transaction':_0xedc21});})['then'](function(){return db[_0xac96('0x6c')]['find']({'where':{'TeamId':_0x5eac38}});})[_0xac96('0x40')](function(_0x33ed76){if(_0x33ed76===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x51a7d3},'VoicePrefixId':_0x33ed76[_0xac96('0x6d')]},'transaction':_0xedc21});})[_0xac96('0x40')](function(){return db[_0xac96('0x2e')][_0xac96('0x5c')]({'where':{'id':_0x5eac38},'cascade':!![],'transaction':_0xedc21});})[_0xac96('0x40')](function(_0x269ada){if(_0x269ada===0x0){_0x4310bf[_0xac96('0x1e')](0x194);}else{return db[_0xac96('0x6e')]['destroy']({'where':{'type':_0xac96('0x4f'),'resourceId':_0x5eac38},'cascade':!![],'transaction':_0xedc21})[_0xac96('0x40')](function(){_0x4310bf[_0xac96('0x1f')](0xcc)[_0xac96('0x20')]();});}})[_0xac96('0x44')](function(_0x24a715){_0x4310bf[_0xac96('0x1f')](0x1f4)[_0xac96('0x2d')](_0x24a715);});});};exports[_0xac96('0x6f')]=function(_0x5bdc91,_0x26678f,_0x5663de){return db[_0xac96('0x2e')][_0xac96('0x70')]({'where':{'id':_0x5bdc91[_0xac96('0x45')]['id']}})[_0xac96('0x40')](handleEntityNotFound(_0x26678f,null))[_0xac96('0x40')](function(_0x437794){if(!_0x5bdc91[_0xac96('0x33')][_0xac96('0x71')]||!utils['isValidChannel'](_0x5bdc91[_0xac96('0x33')][_0xac96('0x71')])){throw new db[(_0xac96('0x59'))][(_0xac96('0x72'))](_0xac96('0x73'));}var _0xf1c5ba={};var _0x2341be={};_0x2341be[_0xac96('0x31')]=_[_0xac96('0x46')](db[_[_0xac96('0x74')](_0x5bdc91[_0xac96('0x33')][_0xac96('0x71')][_0xac96('0x75')]())+_0xac96('0x76')][_0xac96('0x47')]);_0x2341be[_0xac96('0x33')]=_[_0xac96('0x46')](_0x5bdc91[_0xac96('0x33')]);_0x2341be[_0xac96('0x3c')]=_[_0xac96('0x34')](_0x2341be[_0xac96('0x31')],_0x2341be[_0xac96('0x33')]);_0xf1c5ba[_0xac96('0x35')]=_['intersection'](_0x2341be['model'],qs[_0xac96('0x36')](_0x5bdc91['query'][_0xac96('0x36')]));_0xf1c5ba[_0xac96('0x35')]=_0xf1c5ba[_0xac96('0x35')][_0xac96('0x48')]?_0xf1c5ba['attributes']:_0x2341be[_0xac96('0x31')];_0xf1c5ba[_0xac96('0x24')]=qs['limit'](_0x5bdc91['query'][_0xac96('0x24')]);_0xf1c5ba[_0xac96('0x22')]=qs[_0xac96('0x22')](_0x5bdc91['query'][_0xac96('0x22')]);_0xf1c5ba[_0xac96('0x39')]=qs[_0xac96('0x3a')](_0x5bdc91[_0xac96('0x33')][_0xac96('0x3a')]);_0xf1c5ba['where']=qs[_0xac96('0x3c')](_[_0xac96('0x3b')](_0x5bdc91['query'],_0x2341be[_0xac96('0x3c')]));_0xf1c5ba=_[_0xac96('0x49')]({},_0xf1c5ba,_0x5bdc91[_0xac96('0x4a')]);return _0x437794['get'+_[_0xac96('0x74')](_0x5bdc91[_0xac96('0x33')]['channel'][_0xac96('0x75')]())+_0xac96('0x77')](_0xf1c5ba);})['then'](respondWithResult(_0x26678f,null))['catch'](handleError(_0x26678f,null));};exports['addQueues']=function(_0x278abe,_0x7ca867,_0x365fa3){return db[_0xac96('0x2e')][_0xac96('0x70')]({'where':{'id':_0x278abe[_0xac96('0x45')]['id']}})['then'](function(_0x1e8c9f){if(_0x1e8c9f){if(!_0x278abe[_0xac96('0x4d')][_0xac96('0x71')]||!utils[_0xac96('0x78')](_0x278abe[_0xac96('0x4d')][_0xac96('0x71')])){throw new db['Sequelize'][(_0xac96('0x72'))](_0xac96('0x73'));}return _0x1e8c9f['add'+_[_0xac96('0x74')](_0x278abe[_0xac96('0x4d')][_0xac96('0x71')][_0xac96('0x75')]())+_0xac96('0x77')](_0x278abe[_0xac96('0x4d')][_0xac96('0x79')]);}return null;})[_0xac96('0x40')](handleEntityNotFound(_0x7ca867,null))[_0xac96('0x40')](respondWithStatusCode(_0x7ca867,null))['catch'](handleError(_0x7ca867,null));};exports['removeQueues']=function(_0x4ad7f2,_0x1f2ae1,_0x3e4a32){return db[_0xac96('0x2e')][_0xac96('0x70')]({'where':{'id':_0x4ad7f2[_0xac96('0x45')]['id']}})[_0xac96('0x40')](function(_0x4bd0c6){if(_0x4bd0c6){if(!_0x4ad7f2[_0xac96('0x33')][_0xac96('0x71')]||!utils['isValidChannel'](_0x4ad7f2[_0xac96('0x33')][_0xac96('0x71')])){throw new db[(_0xac96('0x59'))][(_0xac96('0x72'))](_0xac96('0x73'));}return _0x4bd0c6[_0xac96('0x7a')+_[_0xac96('0x74')](_0x4ad7f2['query'][_0xac96('0x71')][_0xac96('0x75')]())+'Queues'](_0x4ad7f2[_0xac96('0x33')][_0xac96('0x79')]);}return null;})[_0xac96('0x40')](handleEntityNotFound(_0x1f2ae1,null))[_0xac96('0x40')](respondWithStatusCode(_0x1f2ae1,null))['catch'](handleError(_0x1f2ae1,null));};exports[_0xac96('0x7b')]=function(_0x50ec2a,_0x4255c7){var _0x4d676f=_['isArray'](_0x50ec2a[_0xac96('0x4d')][_0xac96('0x79')])?_0x50ec2a[_0xac96('0x4d')]['ids']:[_0x50ec2a[_0xac96('0x4d')]['ids']];var _0xfb79ad=_0x50ec2a[_0xac96('0x45')]['id'];return db[_0xac96('0x2e')]['find']({'where':{'id':_0xfb79ad}})[_0xac96('0x40')](handleEntityNotFound(_0x4255c7,null))[_0xac96('0x40')](function(_0x355a07){if(_0x355a07){var _0x2b5828=[_0xac96('0x7c'),'Chat','Mail',_0xac96('0x7d'),'Fax',_0xac96('0x7e'),_0xac96('0x7f')];return db[_0xac96('0x53')][_0xac96('0x54')](function(_0x66be69){var _0x21421c=_[_0xac96('0x32')](_0x2b5828,function(_0x801212){var _0x43eea1={'attributes':['id',_0xac96('0x2c')]};if(_0x801212==='Voice'){_0x43eea1[_0xac96('0x80')]={'attributes':[_0xac96('0x81')]};}return _0x355a07[_0xac96('0x82')+_0x801212+_0xac96('0x77')](_0x43eea1)[_0xac96('0x40')](function(_0x4fdcb9){var _0x56e00c=_['map'](_0x4fdcb9,function(_0x7d2608){var _0x16b07b=_[_0xac96('0x32')](_0x4d676f,function(_0x5ae6fc){var _0x5941bf={'where':{'UserId':_0x5ae6fc,[_0x801212+_0xac96('0x83')]:_0x7d2608['id']},'transaction':_0x66be69};if(_0x801212===_0xac96('0x7c')){_0x5941bf[_0xac96('0x19')]={'penalty':_0x7d2608[_0xac96('0x84')][_0xac96('0x81')]};}return db[_0xac96('0x85')+_0x801212+_0xac96('0x76')][_0xac96('0x86')](_0x5941bf)[_0xac96('0x40')](function(){socket['emit'](_0xac96('0x4e')+_0x801212+_0xac96('0x87'),{'UserId':_0x5ae6fc,[_0x801212+_0xac96('0x83')]:_0x7d2608['id']});if(_0x801212!==_0xac96('0x7c')){return;}return db[_0xac96('0x85')][_0xac96('0x88')]({'where':{'id':_0x4d676f,'online':0x1},'attributes':['id',_0xac96('0x2c'),_0xac96('0x89'),_0xac96('0x8a'),_0xac96('0x8b')],'raw':!![]})[_0xac96('0x40')](function(_0x47106a){var _0x31876d=_['map'](_0x47106a,function(_0x30fbfa){return db[_0xac96('0x8c')]['upsert']({'membername':_0x30fbfa['name'],'UserId':_0x30fbfa['id'],'queue_name':_0x7d2608[_0xac96('0x2c')],'VoiceQueueId':_0x7d2608['id'],'interface':_[_0xac96('0x8d')](_0x30fbfa[_0xac96('0x8b')])?util[_0xac96('0x8e')](_0xac96('0x8f'),_0x30fbfa[_0xac96('0x2c')]):_0x30fbfa['interface'],'paused':_0x30fbfa[_0xac96('0x8a')]||![],'penalty':_0x7d2608[_0xac96('0x84')][_0xac96('0x81')]},{'transaction':_0x66be69});});return Promise[_0xac96('0x90')](_0x31876d);});});});return Promise[_0xac96('0x90')](_0x16b07b);});return Promise[_0xac96('0x90')](_0x56e00c);})[_0xac96('0x40')](function(){return db[_0xac96('0x6c')]['findOne']({'where':{'teamId':_0xfb79ad}})[_0xac96('0x40')](function(_0x49b373){if(_0x49b373){var _0x4feb57=_[_0xac96('0x32')](_0x4d676f,function(_0x7bd43f){db[_0xac96('0x91')][_0xac96('0x92')]({'UserId':_0x7bd43f,'VoicePrefixId':_0x49b373[_0xac96('0x6d')]});});return Promise[_0xac96('0x90')](_0x4feb57);}});});});return Promise[_0xac96('0x90')](_0x21421c)['then'](function(){return _0x355a07[_0xac96('0x7b')](_0x4d676f,{'transaction':_0x66be69})[_0xac96('0x93')](function(_0x48ce9d){return _0x48ce9d;});});});}})[_0xac96('0x40')](respondWithResult(_0x4255c7,null))[_0xac96('0x44')](handleError(_0x4255c7,null));};exports['removeAgents']=function(_0xe7ba22,_0x1134d6){var _0xbf6ef1=_[_0xac96('0x94')](_0xe7ba22[_0xac96('0x33')]['ids'])?_0xe7ba22['query'][_0xac96('0x79')]:[_0xe7ba22[_0xac96('0x33')][_0xac96('0x79')]];var _0xabd44b=_0xe7ba22[_0xac96('0x45')]['id'];return db[_0xac96('0x2e')][_0xac96('0x4b')]({'where':{'id':_0xabd44b}})[_0xac96('0x40')](handleEntityNotFound(_0x1134d6,null))[_0xac96('0x40')](function(_0x2bde6d){if(_0x2bde6d){var _0x415db0=['Voice',_0xac96('0x95'),_0xac96('0x96'),_0xac96('0x7d'),_0xac96('0x97'),_0xac96('0x7e'),_0xac96('0x7f')];return db[_0xac96('0x53')][_0xac96('0x54')](function(_0x5748b1){var _0x1eadc5=_[_0xac96('0x32')](_0x415db0,function(_0x3a4f94){var _0x2d3967={'attributes':['id','name']};return _0x2bde6d[_0xac96('0x82')+_0x3a4f94+_0xac96('0x77')](_0x2d3967)[_0xac96('0x40')](function(_0x2629e9){var _0x3375af=_[_0xac96('0x32')](_0x2629e9,function(_0x24cc97){return _0x24cc97[_0xac96('0x98')](_0xbf6ef1,{'transaction':_0x5748b1})['then'](function(){var _0x140ae0=_[_0xac96('0x32')](_0xbf6ef1,function(_0x5a00b4){socket[_0xac96('0x99')](_0xac96('0x4e')+_0x3a4f94+_0xac96('0x9a'),{'UserId':Number(_0x5a00b4),[_0x3a4f94+_0xac96('0x83')]:_0x24cc97['id']});if(_0x3a4f94!=='Voice'){return;}return db[_0xac96('0x8c')][_0xac96('0x5c')]({'where':{'VoiceQueueId':_0x24cc97['id'],'UserId':_0x5a00b4},'transaction':_0x5748b1});});return Promise['all'](_0x140ae0);});});return Promise['all'](_0x3375af);});});return Promise[_0xac96('0x90')](_0x1eadc5)[_0xac96('0x40')](function(){return _0x2bde6d[_0xac96('0x98')](_0xbf6ef1,{'transaction':_0x5748b1});})[_0xac96('0x40')](function(){return db[_0xac96('0x6c')][_0xac96('0x70')]({'where':{'teamId':_0xabd44b}})[_0xac96('0x40')](function(_0x4ae7e8){if(_0x4ae7e8){var _0x3a7d7d=_['map'](_0xbf6ef1,function(_0x491c6b){db[_0xac96('0x91')]['destroy']({'where':{'UserId':_0x491c6b,'VoicePrefixId':_0x4ae7e8[_0xac96('0x6d')]}});});return Promise['all'](_0x3a7d7d);}});});});}})['then'](respondWithStatusCode(_0x1134d6,null))[_0xac96('0x44')](handleError(_0x1134d6,null));};exports[_0xac96('0x9b')]=function(_0xe78cce,_0x257194,_0x3f115e){var _0x1bfd09={};var _0x3ebf82={};var _0x134e38;var _0x59209d;return db[_0xac96('0x2e')][_0xac96('0x70')]({'where':{'id':_0xe78cce[_0xac96('0x45')]['id']}})['then'](handleEntityNotFound(_0x257194,null))[_0xac96('0x40')](function(_0x1703ed){if(_0x1703ed){_0x134e38=_0x1703ed;_0x3ebf82['model']=_['keys'](db[_0xac96('0x85')][_0xac96('0x47')]);_0x3ebf82['query']=_[_0xac96('0x46')](_0xe78cce[_0xac96('0x33')]);_0x3ebf82[_0xac96('0x3c')]=_[_0xac96('0x34')](_0x3ebf82[_0xac96('0x31')],_0x3ebf82[_0xac96('0x33')]);_0x1bfd09['attributes']=_['intersection'](_0x3ebf82[_0xac96('0x31')],qs[_0xac96('0x36')](_0xe78cce[_0xac96('0x33')][_0xac96('0x36')]));_0x1bfd09[_0xac96('0x35')]=_0x1bfd09[_0xac96('0x35')][_0xac96('0x48')]?_0x1bfd09[_0xac96('0x35')]:_0x3ebf82[_0xac96('0x31')];_0x1bfd09['order']=qs[_0xac96('0x3a')](_0xe78cce[_0xac96('0x33')][_0xac96('0x3a')]);_0x1bfd09[_0xac96('0x3e')]=qs[_0xac96('0x3c')](_[_0xac96('0x3b')](_0xe78cce[_0xac96('0x33')],_0x3ebf82['filters']));if(_0xe78cce[_0xac96('0x33')][_0xac96('0x3d')]){_0x1bfd09['where']=_['merge'](_0x1bfd09['where'],{'$or':_[_0xac96('0x32')](_0x1bfd09[_0xac96('0x35')],function(_0x1c0c18){var _0x117e75={};_0x117e75[_0x1c0c18]={'$like':'%'+_0xe78cce['query'][_0xac96('0x3d')]+'%'};return _0x117e75;})});}_0x1bfd09=_['merge']({},_0x1bfd09,_0xe78cce[_0xac96('0x4a')]);return _0x134e38[_0xac96('0x9b')](_0x1bfd09);}})['then'](function(_0x4a5c1f){if(_0x4a5c1f){_0x59209d=_0x4a5c1f[_0xac96('0x48')];if(!_0xe78cce['query']['hasOwnProperty'](_0xac96('0x38'))){_0x1bfd09[_0xac96('0x24')]=qs[_0xac96('0x24')](_0xe78cce[_0xac96('0x33')][_0xac96('0x24')]);_0x1bfd09[_0xac96('0x22')]=qs[_0xac96('0x22')](_0xe78cce[_0xac96('0x33')][_0xac96('0x22')]);}return _0x134e38[_0xac96('0x9b')](_0x1bfd09);}})['then'](function(_0x13f10a){if(_0x13f10a){return _0x13f10a?{'count':_0x59209d,'rows':_0x13f10a}:null;}})[_0xac96('0x40')](respondWithResult(_0x257194,null))['catch'](handleError(_0x257194,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3f87b95..1dee697 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 _0x8674=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x2437c2,_0x2da5aa){var _0x49e9d1=function(_0x351517){while(--_0x351517){_0x2437c2['push'](_0x2437c2['shift']());}};_0x49e9d1(++_0x2da5aa);}(_0x8674,0x12e));var _0x4867=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8674[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x4867('0x0'));var Team=require(_0x4867('0x1'))['db'][_0x4867('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4867('0x3')](0x0);var events={'afterCreate':_0x4867('0x4'),'afterUpdate':_0x4867('0x5'),'afterDestroy':_0x4867('0x6')};function emitEvent(_0x5b58c9){return function(_0x137aae,_0x4efd27,_0x2e479b){TeamEvents[_0x4867('0x7')](_0x5b58c9+':'+_0x137aae['id'],_0x137aae);TeamEvents[_0x4867('0x7')](_0x5b58c9,_0x137aae);_0x2e479b(null);};}for(var e in events){if(events[_0x4867('0x8')](e)){var event=events[e];Team[_0x4867('0x9')](e,emitEvent(event));}}module[_0x4867('0xa')]=TeamEvents; \ No newline at end of file +var _0x650c=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x650c,0x163));var _0xc650=function(_0x286614,_0x2c427e){_0x286614=_0x286614-0x0;var _0x439d92=_0x650c[_0x286614];return _0x439d92;};'use strict';var EventEmitter=require(_0xc650('0x0'));var Team=require(_0xc650('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc650('0x2'),'afterUpdate':'update','afterDestroy':_0xc650('0x3')};function emitEvent(_0x40a3c5){return function(_0x4526e6,_0x63bed6,_0x54c6b7){TeamEvents['emit'](_0x40a3c5+':'+_0x4526e6['id'],_0x4526e6);TeamEvents[_0xc650('0x4')](_0x40a3c5,_0x4526e6);_0x54c6b7(null);};}for(var e in events){if(events[_0xc650('0x5')](e)){var event=events[e];Team[_0xc650('0x6')](e,emitEvent(event));}}module[_0xc650('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index dd448c5..3a25b40 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 _0xf29e=['Whatsapp','resolve','./team.attributes','get','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice'];(function(_0x2a1290,_0x3b8277){var _0x2a18ea=function(_0x50e040){while(--_0x50e040){_0x2a1290['push'](_0x2a1290['shift']());}};_0x2a18ea(++_0x3b8277);}(_0xf29e,0xa4));var _0xef29=function(_0x5b0701,_0xbd6d61){_0x5b0701=_0x5b0701-0x0;var _0x49939c=_0xf29e[_0x5b0701];return _0x49939c;};'use strict';var _=require('lodash');var attributes=require(_0xef29('0x0'));function getQueuesByChannel(_0x2bd018,_0x4679e4){var _0x5bda87=_0xef29('0x1')+_0x4679e4+'Queues';return _0x2bd018[_0x5bda87]()['then'](function(_0x4352c8){return _[_0xef29('0x2')](_0x4352c8,function(_0x9fb549){_0x9fb549[_0xef29('0x3')](_0xef29('0x4'),_0x4679e4);return _0x9fb549;});})[_0xef29('0x5')](function(_0x1f8a92){throw _0x1f8a92;});}module[_0xef29('0x6')]=function(_0x53d402){return _0x53d402[_0xef29('0x7')](_0xef29('0x8'),attributes,{'tableName':_0xef29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5e4143=this;var _0x513faa=[_0xef29('0xa'),_0xef29('0xb'),_0xef29('0xc'),_0xef29('0xd'),_0xef29('0xe'),_0xef29('0xf'),_0xef29('0x10')];return Promise[_0xef29('0x11')]()['then'](function(){var _0x4e3023=_[_0xef29('0x2')](_0x513faa,function(_0x3abcfb){return getQueuesByChannel(_0x5e4143,_0x3abcfb);});return Promise['all'](_0x4e3023);})[_0xef29('0x5')](function(_0xcb0ed0){throw _0xcb0ed0;});}}});}; \ No newline at end of file +var _0xe13e=['./team.attributes','get','Queues','then','map','catch','exports','Fax','Mail','Sms','Voice','Whatsapp','resolve','lodash'];(function(_0x41a5ca,_0x16d70a){var _0x588a55=function(_0x424ec7){while(--_0x424ec7){_0x41a5ca['push'](_0x41a5ca['shift']());}};_0x588a55(++_0x16d70a);}(_0xe13e,0xb5));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee13('0x0'));var attributes=require(_0xee13('0x1'));function getQueuesByChannel(_0x5169b5,_0x8d23ff){var _0x101bc1=_0xee13('0x2')+_0x8d23ff+_0xee13('0x3');return _0x5169b5[_0x101bc1]()[_0xee13('0x4')](function(_0x306ccd){return _[_0xee13('0x5')](_0x306ccd,function(_0x26872f){_0x26872f['setDataValue']('channel',_0x8d23ff);return _0x26872f;});})[_0xee13('0x6')](function(_0x52b568){throw _0x52b568;});}module[_0xee13('0x7')]=function(_0x33693a){return _0x33693a['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x154ee7=this;var _0x393b9b=['Chat',_0xee13('0x8'),_0xee13('0x9'),'Openchannel',_0xee13('0xa'),_0xee13('0xb'),_0xee13('0xc')];return Promise[_0xee13('0xd')]()[_0xee13('0x4')](function(){var _0x145479=_[_0xee13('0x5')](_0x393b9b,function(_0x386de5){return getQueuesByChannel(_0x154ee7,_0x386de5);});return Promise['all'](_0x145479);})[_0xee13('0x6')](function(_0x128e6e){throw _0x128e6e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9caac99..e0ed66b 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 _0x5d2c=['./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5eb1e7,_0x354ca1){var _0x36d9d2=function(_0x299f56){while(--_0x299f56){_0x5eb1e7['push'](_0x5eb1e7['shift']());}};_0x36d9d2(++_0x354ca1);}(_0x5d2c,0xbb));var _0xc5d2=function(_0xd2a17f,_0x28243c){_0xd2a17f=_0xd2a17f-0x0;var _0x3a8e49=_0x5d2c[_0xd2a17f];return _0x3a8e49;};'use strict';var _=require(_0xc5d2('0x0'));var util=require(_0xc5d2('0x1'));var moment=require(_0xc5d2('0x2'));var BPromise=require(_0xc5d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5d2('0x4'));var db=require(_0xc5d2('0x5'))['db'];var utils=require(_0xc5d2('0x6'));var logger=require(_0xc5d2('0x7'))(_0xc5d2('0x8'));var config=require(_0xc5d2('0x9'));var jayson=require(_0xc5d2('0xa'));var client=jayson[_0xc5d2('0xb')][_0xc5d2('0xc')]({'port':0x232a});config[_0xc5d2('0xd')]=_['defaults'](config['redis'],{'host':_0xc5d2('0xe'),'port':0x18eb});var socket=require(_0xc5d2('0xf'))(new Redis(config[_0xc5d2('0xd')]));require(_0xc5d2('0x10'))[_0xc5d2('0x11')](socket);function respondWithRpcPromise(_0x4330ef,_0x324fbe,_0x211cfa){return new BPromise(function(_0x424bb3,_0x357521){return client[_0xc5d2('0x12')](_0x4330ef,_0x211cfa)[_0xc5d2('0x13')](function(_0x5f3543){logger[_0xc5d2('0x14')](_0xc5d2('0x15'),_0x324fbe,_0xc5d2('0x16'));logger['debug'](_0xc5d2('0x17'),_0x324fbe,_0xc5d2('0x16'),JSON[_0xc5d2('0x18')](_0x5f3543));if(_0x5f3543['error']){if(_0x5f3543[_0xc5d2('0x19')][_0xc5d2('0x1a')]===0x1f4){logger[_0xc5d2('0x19')](_0xc5d2('0x15'),_0x324fbe,_0x5f3543[_0xc5d2('0x19')]['message']);return _0x357521(_0x5f3543[_0xc5d2('0x19')][_0xc5d2('0x1b')]);}logger['error'](_0xc5d2('0x15'),_0x324fbe,_0x5f3543[_0xc5d2('0x19')]['message']);return _0x424bb3(_0x5f3543[_0xc5d2('0x19')]['message']);}else{logger[_0xc5d2('0x14')]('Team,\x20%s,\x20%s',_0x324fbe,'request\x20sent');_0x424bb3(_0x5f3543[_0xc5d2('0x1c')][_0xc5d2('0x1b')]);}})['catch'](function(_0x45d211){logger['error'](_0xc5d2('0x15'),_0x324fbe,_0x45d211);_0x357521(_0x45d211);});});} \ No newline at end of file +var _0xa00b=['info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request'];(function(_0x22ba49,_0x2d8c86){var _0x103d4b=function(_0x2f4da4){while(--_0x2f4da4){_0x22ba49['push'](_0x22ba49['shift']());}};_0x103d4b(++_0x2d8c86);}(_0xa00b,0x1dd));var _0xba00=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa00b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xba00('0x0'));var util=require(_0xba00('0x1'));var moment=require(_0xba00('0x2'));var BPromise=require(_0xba00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba00('0x4'));var db=require(_0xba00('0x5'))['db'];var utils=require(_0xba00('0x6'));var logger=require(_0xba00('0x7'))('rpc');var config=require(_0xba00('0x8'));var jayson=require(_0xba00('0x9'));var client=jayson[_0xba00('0xa')][_0xba00('0xb')]({'port':0x232a});config[_0xba00('0xc')]=_['defaults'](config[_0xba00('0xc')],{'host':_0xba00('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba00('0xc')]));require(_0xba00('0xe'))[_0xba00('0xf')](socket);function respondWithRpcPromise(_0x20a96b,_0x55984e,_0x172d3e){return new BPromise(function(_0x5636e1,_0x170d47){return client[_0xba00('0x10')](_0x20a96b,_0x172d3e)['then'](function(_0x442f90){logger[_0xba00('0x11')](_0xba00('0x12'),_0x55984e,'request\x20sent');logger['debug'](_0xba00('0x13'),_0x55984e,_0xba00('0x14'),JSON['stringify'](_0x442f90));if(_0x442f90[_0xba00('0x15')]){if(_0x442f90[_0xba00('0x15')][_0xba00('0x16')]===0x1f4){logger[_0xba00('0x15')]('Team,\x20%s,\x20%s',_0x55984e,_0x442f90[_0xba00('0x15')]['message']);return _0x170d47(_0x442f90[_0xba00('0x15')][_0xba00('0x17')]);}logger[_0xba00('0x15')](_0xba00('0x12'),_0x55984e,_0x442f90['error']['message']);return _0x5636e1(_0x442f90['error'][_0xba00('0x17')]);}else{logger[_0xba00('0x11')](_0xba00('0x12'),_0x55984e,'request\x20sent');_0x5636e1(_0x442f90[_0xba00('0x18')][_0xba00('0x17')]);}})[_0xba00('0x19')](function(_0x458ed7){logger[_0xba00('0x15')](_0xba00('0x12'),_0x55984e,_0x458ed7);_0x170d47(_0x458ed7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5506578..c20d81b 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 _0xe083=['register','length','./team.events','save'];(function(_0x4d53a5,_0x3da5df){var _0xb85e6e=function(_0x3a726e){while(--_0x3a726e){_0x4d53a5['push'](_0x4d53a5['shift']());}};_0xb85e6e(++_0x3da5df);}(_0xe083,0x76));var _0x3e08=function(_0x3dbb83,_0x529e37){_0x3dbb83=_0x3dbb83-0x0;var _0x9478b4=_0xe083[_0x3dbb83];return _0x9478b4;};'use strict';var TeamEvents=require(_0x3e08('0x0'));var events=[_0x3e08('0x1'),'remove','update'];function createListener(_0x38141e,_0x908deb){return function(_0x22c0d9){_0x908deb['emit'](_0x38141e,_0x22c0d9);};}function removeListener(_0x3e8cb2,_0xf65806){return function(){TeamEvents['removeListener'](_0x3e8cb2,_0xf65806);};}exports[_0x3e08('0x2')]=function(_0xb2983d){for(var _0x3975ae=0x0,_0x51bd77=events[_0x3e08('0x3')];_0x3975ae<_0x51bd77;_0x3975ae++){var _0x2ddcdd=events[_0x3975ae];var _0x4378ca=createListener('team:'+_0x2ddcdd,_0xb2983d);TeamEvents['on'](_0x2ddcdd,_0x4378ca);}}; \ No newline at end of file +var _0x4849=['save','remove','update','emit','register','length','team:'];(function(_0x45a244,_0x12f982){var _0x57edbc=function(_0x2182b2){while(--_0x2182b2){_0x45a244['push'](_0x45a244['shift']());}};_0x57edbc(++_0x12f982);}(_0x4849,0x181));var _0x9484=function(_0x288784,_0x25a410){_0x288784=_0x288784-0x0;var _0x12e16e=_0x4849[_0x288784];return _0x12e16e;};'use strict';var TeamEvents=require('./team.events');var events=[_0x9484('0x0'),_0x9484('0x1'),_0x9484('0x2')];function createListener(_0x22e8eb,_0x530a18){return function(_0x337903){_0x530a18[_0x9484('0x3')](_0x22e8eb,_0x337903);};}function removeListener(_0xecde47,_0x95b89e){return function(){TeamEvents['removeListener'](_0xecde47,_0x95b89e);};}exports[_0x9484('0x4')]=function(_0x555b70){for(var _0x521217=0x0,_0x4e7b02=events[_0x9484('0x5')];_0x521217<_0x4e7b02;_0x521217++){var _0x515733=events[_0x521217];var _0x2952ea=createListener(_0x9484('0x6')+_0x515733,_0x555b70);TeamEvents['on'](_0x515733,_0x2952ea);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index e615a6a..1f99e62 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 _0x3ae9=['INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3ae9,0xdb));var _0x93ae=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x3ae9[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x93ae('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x93ae('0x0')]}}; \ No newline at end of file +var _0xa39f=['INTEGER','sequelize','exports'];(function(_0x2ee54a,_0x202513){var _0x32b378=function(_0x27483a){while(--_0x27483a){_0x2ee54a['push'](_0x2ee54a['shift']());}};_0x32b378(++_0x202513);}(_0xa39f,0x1e4));var _0xfa39=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0xa39f[_0x1cd47d];return _0x29d52f;};'use strict';var Sequelize=require(_0xfa39('0x0'));module[_0xfa39('0x1')]={'TeamId':{'type':Sequelize[_0xfa39('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f8565fe..6bd2ebd 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 _0xd7a0=['path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','bluebird','request-promise'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xd7a0,0x163));var _0x0d7a=function(_0xa767af,_0x3799ca){_0xa767af=_0xa767af-0x0;var _0x3fe4b6=_0xd7a0[_0xa767af];return _0x3fe4b6;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b7=['path','rimraf','../../config/environment','define','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x42a7cd,_0x32f06c){var _0x1e482b=function(_0x21de87){while(--_0x21de87){_0x42a7cd['push'](_0x42a7cd['shift']());}};_0x1e482b(++_0x32f06c);}(_0x14b7,0x144));var _0x714b=function(_0x500aeb,_0x29fdba){_0x500aeb=_0x500aeb-0x0;var _0x5f3052=_0x14b7[_0x500aeb];return _0x5f3052;};'use strict';var _=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var logger=require(_0x714b('0x2'))(_0x714b('0x3'));var moment=require('moment');var BPromise=require(_0x714b('0x4'));var rp=require(_0x714b('0x5'));var fs=require('fs');var path=require(_0x714b('0x6'));var rimraf=require(_0x714b('0x7'));var config=require(_0x714b('0x8'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x45c9ae,_0x966048){return _0x45c9ae[_0x714b('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x714b('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 0290cae..cb9c754 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x47cebb,_0x371972){var _0x1d9d6d=function(_0x8baa2e){while(--_0x8baa2e){_0x47cebb['push'](_0x47cebb['shift']());}};_0x1d9d6d(++_0x371972);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xcb91[_0x305c31];return _0x17f39f;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5b30b3,_0x374892){var _0x33f228=function(_0x19d739){while(--_0x19d739){_0x5b30b3['push'](_0x5b30b3['shift']());}};_0x33f228(++_0x374892);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9a59e7a..e70b831 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 _0x5126=['INTEGER','sequelize','exports'];(function(_0x506544,_0x3a5287){var _0x9282a3=function(_0x17ebb2){while(--_0x17ebb2){_0x506544['push'](_0x506544['shift']());}};_0x9282a3(++_0x3a5287);}(_0x5126,0x7c));var _0x6512=function(_0x44c1f1,_0x4c57b4){_0x44c1f1=_0x44c1f1-0x0;var _0x23dcd5=_0x5126[_0x44c1f1];return _0x23dcd5;};'use strict';var Sequelize=require(_0x6512('0x0'));module[_0x6512('0x1')]={'penalty':{'type':Sequelize[_0x6512('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc99d=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc99d,0x175));var _0xdc99=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xc99d[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0xdc99('0x0'));module[_0xdc99('0x1')]={'penalty':{'type':Sequelize[_0xdc99('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 5596330..d8ea23f 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 _0x8d9b=['util','../../config/logger','api','moment','path','../../config/environment','./teamVoiceQueue.attributes','define','lodash'];(function(_0x3d4472,_0x32614d){var _0x3df20f=function(_0x5dde98){while(--_0x5dde98){_0x3d4472['push'](_0x3d4472['shift']());}};_0x3df20f(++_0x32614d);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d9('0x6'));var attributes=require(_0xb8d9('0x7'));module['exports']=function(_0x5996e9,_0x529b0a){return _0x5996e9[_0xb8d9('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff3c=['moment','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','util','api'];(function(_0x8d9e63,_0x27a519){var _0x3589f1=function(_0x73b6a4){while(--_0x73b6a4){_0x8d9e63['push'](_0x8d9e63['shift']());}};_0x3589f1(++_0x27a519);}(_0xff3c,0x179));var _0xcff3=function(_0x1fadd2,_0x4020f0){_0x1fadd2=_0x1fadd2-0x0;var _0x226f9f=_0xff3c[_0x1fadd2];return _0x226f9f;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var logger=require('../../config/logger')(_0xcff3('0x2'));var moment=require(_0xcff3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff3('0x4'));var rimraf=require(_0xcff3('0x5'));var config=require(_0xcff3('0x6'));var attributes=require(_0xcff3('0x7'));module[_0xcff3('0x8')]=function(_0x308a82,_0x47b899){return _0x308a82['define'](_0xcff3('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 05d6911..a4324c7 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 _0x643f=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x556bbc,_0x3d16aa){var _0x456cb3=function(_0x3e5b27){while(--_0x3e5b27){_0x556bbc['push'](_0x556bbc['shift']());}};_0x456cb3(++_0x3d16aa);}(_0x643f,0x1e6));var _0xf643=function(_0x67fdbf,_0xc3c2f3){_0x67fdbf=_0x67fdbf-0x0;var _0x3e8004=_0x643f[_0x67fdbf];return _0x3e8004;};'use strict';var _=require('lodash');var util=require(_0xf643('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf643('0x1'));var fs=require('fs');var Redis=require(_0xf643('0x2'));var db=require(_0xf643('0x3'))['db'];var utils=require(_0xf643('0x4'));var logger=require(_0xf643('0x5'))(_0xf643('0x6'));var config=require(_0xf643('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf643('0x8')][_0xf643('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x531a6e,_0x5acb9a,_0x28904b){return new BPromise(function(_0x3544d6,_0x36cf77){return client['request'](_0x531a6e,_0x28904b)[_0xf643('0xa')](function(_0x2f0a19){logger[_0xf643('0xb')](_0xf643('0xc'),_0x5acb9a,_0xf643('0xd'));logger[_0xf643('0xe')](_0xf643('0xf'),_0x5acb9a,_0xf643('0xd'),JSON[_0xf643('0x10')](_0x2f0a19));if(_0x2f0a19[_0xf643('0x11')]){if(_0x2f0a19[_0xf643('0x11')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5acb9a,_0x2f0a19['error'][_0xf643('0x12')]);return _0x36cf77(_0x2f0a19['error']['message']);}logger[_0xf643('0x11')](_0xf643('0xc'),_0x5acb9a,_0x2f0a19['error'][_0xf643('0x12')]);return _0x3544d6(_0x2f0a19[_0xf643('0x11')][_0xf643('0x12')]);}else{logger[_0xf643('0xb')](_0xf643('0xc'),_0x5acb9a,_0xf643('0xd'));_0x3544d6(_0x2f0a19[_0xf643('0x13')][_0xf643('0x12')]);}})[_0xf643('0x14')](function(_0x3f1566){logger[_0xf643('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5acb9a,_0x3f1566);_0x36cf77(_0x3f1566);});});} \ No newline at end of file +var _0xce92=['request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http'];(function(_0x554651,_0x33b329){var _0x53fb5a=function(_0x1f8b0a){while(--_0x1f8b0a){_0x554651['push'](_0x554651['shift']());}};_0x53fb5a(++_0x33b329);}(_0xce92,0x186));var _0x2ce9=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0xce92[_0x3fc5d8];return _0x25307a;};'use strict';var _=require(_0x2ce9('0x0'));var util=require('util');var moment=require(_0x2ce9('0x1'));var BPromise=require(_0x2ce9('0x2'));var rs=require(_0x2ce9('0x3'));var fs=require('fs');var Redis=require(_0x2ce9('0x4'));var db=require(_0x2ce9('0x5'))['db'];var utils=require(_0x2ce9('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2ce9('0x7'));var client=jayson['client'][_0x2ce9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a375f,_0x31829a,_0x32da86){return new BPromise(function(_0x3adbb7,_0x41d233){return client[_0x2ce9('0x9')](_0x5a375f,_0x32da86)[_0x2ce9('0xa')](function(_0x59179f){logger[_0x2ce9('0xb')](_0x2ce9('0xc'),_0x31829a,'request\x20sent');logger['debug'](_0x2ce9('0xd'),_0x31829a,_0x2ce9('0xe'),JSON[_0x2ce9('0xf')](_0x59179f));if(_0x59179f[_0x2ce9('0x10')]){if(_0x59179f['error'][_0x2ce9('0x11')]===0x1f4){logger[_0x2ce9('0x10')](_0x2ce9('0xc'),_0x31829a,_0x59179f[_0x2ce9('0x10')][_0x2ce9('0x12')]);return _0x41d233(_0x59179f[_0x2ce9('0x10')][_0x2ce9('0x12')]);}logger['error'](_0x2ce9('0xc'),_0x31829a,_0x59179f[_0x2ce9('0x10')][_0x2ce9('0x12')]);return _0x3adbb7(_0x59179f[_0x2ce9('0x10')][_0x2ce9('0x12')]);}else{logger[_0x2ce9('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31829a,_0x2ce9('0xe'));_0x3adbb7(_0x59179f[_0x2ce9('0x13')]['message']);}})[_0x2ce9('0x14')](function(_0x528818){logger[_0x2ce9('0x10')](_0x2ce9('0xc'),_0x31829a,_0x528818);_0x41d233(_0x528818);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f395ef1..5b7c0a3 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 _0xa46e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','update','delete'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xa46e,0x8a));var _0xea46=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xa46e[_0x277af0];return _0x43bd7c;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./template.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0xb')]('/',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xea46('0xd')]);router[_0xea46('0xe')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);module[_0xea46('0x10')]=router; \ No newline at end of file +var _0xacc6=['../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xacc6,0x150));var _0x6acc=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xacc6[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var path=require(_0x6acc('0x2'));var timeout=require(_0x6acc('0x3'));var express=require(_0x6acc('0x4'));var router=express['Router']();var fs_extra=require(_0x6acc('0x5'));var auth=require(_0x6acc('0x6'));var interaction=require(_0x6acc('0x7'));var config=require('../../config/environment');var controller=require(_0x6acc('0x8'));router['get']('/',auth[_0x6acc('0x9')](),controller[_0x6acc('0xa')]);router['get'](_0x6acc('0xb'),auth['isAuthenticated'](),controller[_0x6acc('0xc')]);router[_0x6acc('0xd')]('/',auth[_0x6acc('0x9')](),controller[_0x6acc('0xe')]);router['put'](_0x6acc('0xb'),auth['isAuthenticated'](),controller[_0x6acc('0xf')]);router[_0x6acc('0x10')](_0x6acc('0xb'),auth[_0x6acc('0x9')](),controller[_0x6acc('0x11')]);module[_0x6acc('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e09576c..4459bca 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 _0x37db=['sequelize','exports','STRING','TEXT'];(function(_0x2169ed,_0x2b39f8){var _0x35c6f4=function(_0x13f577){while(--_0x13f577){_0x2169ed['push'](_0x2169ed['shift']());}};_0x35c6f4(++_0x2b39f8);}(_0x37db,0x144));var _0xb37d=function(_0x24b156,_0xc079ef){_0x24b156=_0x24b156-0x0;var _0xc6ceec=_0x37db[_0x24b156];return _0xc6ceec;};'use strict';var Sequelize=require(_0xb37d('0x0'));module[_0xb37d('0x1')]={'name':{'type':Sequelize[_0xb37d('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb37d('0x3')]}}; \ No newline at end of file +var _0xff45=['exports','STRING','TEXT','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xff45,0xb3));var _0x5ff4=function(_0x1b3c40,_0x48cc44){_0x1b3c40=_0x1b3c40-0x0;var _0x54a769=_0xff45[_0x1b3c40];return _0x54a769;};'use strict';var Sequelize=require(_0x5ff4('0x0'));module[_0x5ff4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5ff4('0x2')]},'html':{'type':Sequelize[_0x5ff4('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index ef9ec3b..e02e3f1 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 _0x986f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','Template','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params'];(function(_0x41f3f6,_0x2f4694){var _0x4c006a=function(_0x23043e){while(--_0x23043e){_0x41f3f6['push'](_0x41f3f6['shift']());}};_0x4c006a(++_0x2f4694);}(_0x986f,0xa8));var _0xf986=function(_0x2557b0,_0x57fba2){_0x2557b0=_0x2557b0-0x0;var _0x468e8f=_0x986f[_0x2557b0];return _0x468e8f;};'use strict';var emlformat=require(_0xf986('0x0'));var rimraf=require(_0xf986('0x1'));var zipdir=require(_0xf986('0x2'));var jsonpatch=require(_0xf986('0x3'));var rp=require(_0xf986('0x4'));var moment=require('moment');var BPromise=require(_0xf986('0x5'));var Mustache=require(_0xf986('0x6'));var util=require(_0xf986('0x7'));var path=require(_0xf986('0x8'));var sox=require('sox');var csv=require(_0xf986('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf986('0xa'));var _=require(_0xf986('0xb'));var squel=require(_0xf986('0xc'));var crypto=require(_0xf986('0xd'));var jsforce=require(_0xf986('0xe'));var deskjs=require(_0xf986('0xf'));var toCsv=require(_0xf986('0x9'));var querystring=require(_0xf986('0x10'));var Papa=require('papaparse');var Redis=require(_0xf986('0x11'));var authService=require(_0xf986('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf986('0x13'));var hardwareService=require(_0xf986('0x14'));var logger=require(_0xf986('0x15'))(_0xf986('0x16'));var utils=require(_0xf986('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf986('0x18'))['db'];function respondWithStatusCode(_0x5ac359,_0x199022){_0x199022=_0x199022||0xcc;return function(_0x3f675d){if(_0x3f675d){return _0x5ac359[_0xf986('0x19')](_0x199022);}return _0x5ac359[_0xf986('0x1a')](_0x199022)[_0xf986('0x1b')]();};}function respondWithResult(_0x1c7316,_0xf748e7){_0xf748e7=_0xf748e7||0xc8;return function(_0x1d14bd){if(_0x1d14bd){return _0x1c7316[_0xf986('0x1a')](_0xf748e7)['json'](_0x1d14bd);}};}function respondWithFilteredResult(_0x177154,_0x428bf3){return function(_0x3c995b){if(_0x3c995b){var _0x24c024=typeof _0x428bf3[_0xf986('0x1c')]===_0xf986('0x1d')&&typeof _0x428bf3[_0xf986('0x1e')]===_0xf986('0x1d');var _0x4aff19=_0x3c995b[_0xf986('0x1f')];var _0x48e2b3=_0x24c024?0x0:_0x428bf3['offset'];var _0x7b34c2=_0x24c024?_0x3c995b[_0xf986('0x1f')]:_0x428bf3[_0xf986('0x1c')]+_0x428bf3[_0xf986('0x1e')];var _0x1ac80c;if(_0x7b34c2>=_0x4aff19){_0x7b34c2=_0x4aff19;_0x1ac80c=0xc8;}else{_0x1ac80c=0xce;}_0x177154[_0xf986('0x1a')](_0x1ac80c);return _0x177154[_0xf986('0x20')](_0xf986('0x21'),_0x48e2b3+'-'+_0x7b34c2+'/'+_0x4aff19)['json'](_0x3c995b);}return null;};}function patchUpdates(_0x21eb89){return function(_0xfe3857){try{jsonpatch[_0xf986('0x22')](_0xfe3857,_0x21eb89,!![]);}catch(_0x18984a){return BPromise[_0xf986('0x23')](_0x18984a);}return _0xfe3857[_0xf986('0x24')]();};}function saveUpdates(_0x8eaf63,_0x417008){return function(_0x54606a){if(_0x54606a){return _0x54606a['update'](_0x8eaf63)[_0xf986('0x25')](function(_0x24a742){return _0x24a742;});}return null;};}function removeEntity(_0x1c2015,_0x3f5ce5){return function(_0x759a43){if(_0x759a43){return _0x759a43['destroy']()[_0xf986('0x25')](function(){var _0x657fb7=_0x759a43[_0xf986('0x26')]({'plain':!![]});var _0x563c11='Templates';return db[_0xf986('0x27')][_0xf986('0x28')]({'where':{'type':_0x563c11,'resourceId':_0x657fb7['id']}})[_0xf986('0x25')](function(){return _0x759a43;});})[_0xf986('0x25')](function(){_0x1c2015[_0xf986('0x1a')](0xcc)[_0xf986('0x1b')]();});}};}function handleEntityNotFound(_0x314edb,_0x33a60b){return function(_0x14c009){if(!_0x14c009){_0x314edb[_0xf986('0x19')](0x194);}return _0x14c009;};}function handleError(_0x5da339,_0x37ab85){_0x37ab85=_0x37ab85||0x1f4;return function(_0x3226c0){logger['error'](_0x3226c0[_0xf986('0x29')]);if(_0x3226c0[_0xf986('0x2a')]){delete _0x3226c0[_0xf986('0x2a')];}_0x5da339[_0xf986('0x1a')](_0x37ab85)[_0xf986('0x2b')](_0x3226c0);};}exports[_0xf986('0x2c')]=function(_0x2ac740,_0x5cc2d9){var _0x1f5142={},_0x444698={},_0x4a970e={'count':0x0,'rows':[]};var _0x4e560a=_[_0xf986('0x2d')](db[_0xf986('0x2e')][_0xf986('0x2f')],function(_0x240408){return{'name':_0x240408['fieldName'],'type':_0x240408[_0xf986('0x30')][_0xf986('0x31')]};});_0x444698[_0xf986('0x32')]=_[_0xf986('0x2d')](_0x4e560a,'name');_0x444698['query']=_[_0xf986('0x33')](_0x2ac740[_0xf986('0x34')]);_0x444698[_0xf986('0x35')]=_['intersection'](_0x444698[_0xf986('0x32')],_0x444698[_0xf986('0x34')]);_0x1f5142[_0xf986('0x36')]=_[_0xf986('0x37')](_0x444698['model'],qs[_0xf986('0x38')](_0x2ac740[_0xf986('0x34')]['fields']));_0x1f5142['attributes']=_0x1f5142['attributes']['length']?_0x1f5142[_0xf986('0x36')]:_0x444698[_0xf986('0x32')];if(!_0x2ac740['query'][_0xf986('0x39')](_0xf986('0x3a'))){_0x1f5142[_0xf986('0x1e')]=qs[_0xf986('0x1e')](_0x2ac740[_0xf986('0x34')]['limit']);_0x1f5142['offset']=qs[_0xf986('0x1c')](_0x2ac740[_0xf986('0x34')][_0xf986('0x1c')]);}_0x1f5142[_0xf986('0x3b')]=qs['sort'](_0x2ac740['query'][_0xf986('0x3c')]);_0x1f5142[_0xf986('0x3d')]=qs[_0xf986('0x35')](_[_0xf986('0x3e')](_0x2ac740[_0xf986('0x34')],_0x444698[_0xf986('0x35')]),_0x4e560a);if(_0x2ac740['query'][_0xf986('0x3f')]){_0x1f5142[_0xf986('0x3d')]=_[_0xf986('0x40')](_0x1f5142['where'],{'$or':_[_0xf986('0x2d')](_0x4e560a,function(_0x5e1a0a){if(_0x5e1a0a['type']!=='VIRTUAL'){var _0xf56c71={};_0xf56c71[_0x5e1a0a['name']]={'$like':'%'+_0x2ac740[_0xf986('0x34')][_0xf986('0x3f')]+'%'};return _0xf56c71;}})});}_0x1f5142=_[_0xf986('0x40')]({},_0x1f5142,_0x2ac740[_0xf986('0x41')]);var _0x7d17d0={'where':_0x1f5142[_0xf986('0x3d')]};return db[_0xf986('0x2e')][_0xf986('0x1f')](_0x7d17d0)[_0xf986('0x25')](function(_0x1a1a9d){_0x4a970e[_0xf986('0x1f')]=_0x1a1a9d;if(_0x2ac740[_0xf986('0x34')][_0xf986('0x42')]){_0x1f5142[_0xf986('0x43')]=[{'all':!![]}];}return db[_0xf986('0x2e')][_0xf986('0x44')](_0x1f5142);})[_0xf986('0x25')](function(_0x43ef51){_0x4a970e[_0xf986('0x45')]=_0x43ef51;return _0x4a970e;})[_0xf986('0x25')](respondWithFilteredResult(_0x5cc2d9,_0x1f5142))[_0xf986('0x46')](handleError(_0x5cc2d9,null));};exports['show']=function(_0x54a6a2,_0x3e571a){var _0x58cef3={'raw':!![],'where':{'id':_0x54a6a2['params']['id']}},_0x401b18={};_0x401b18['model']=_['keys'](db['Template'][_0xf986('0x2f')]);_0x401b18[_0xf986('0x34')]=_[_0xf986('0x33')](_0x54a6a2['query']);_0x401b18['filters']=_[_0xf986('0x37')](_0x401b18[_0xf986('0x32')],_0x401b18[_0xf986('0x34')]);_0x58cef3[_0xf986('0x36')]=_[_0xf986('0x37')](_0x401b18[_0xf986('0x32')],qs[_0xf986('0x38')](_0x54a6a2[_0xf986('0x34')][_0xf986('0x38')]));_0x58cef3[_0xf986('0x36')]=_0x58cef3[_0xf986('0x36')][_0xf986('0x47')]?_0x58cef3[_0xf986('0x36')]:_0x401b18[_0xf986('0x32')];if(_0x54a6a2[_0xf986('0x34')][_0xf986('0x42')]){_0x58cef3[_0xf986('0x43')]=[{'all':!![]}];}_0x58cef3=_[_0xf986('0x40')]({},_0x58cef3,_0x54a6a2[_0xf986('0x41')]);return db[_0xf986('0x2e')][_0xf986('0x48')](_0x58cef3)['then'](handleEntityNotFound(_0x3e571a,null))[_0xf986('0x25')](respondWithResult(_0x3e571a,null))['catch'](handleError(_0x3e571a,null));};exports['create']=function(_0x4001fa,_0xec51b6){return db['Template'][_0xf986('0x49')](_0x4001fa['body'],{})[_0xf986('0x25')](function(_0x56b2f4){var _0x3cb9d6=_0x4001fa[_0xf986('0x4a')][_0xf986('0x26')]({'plain':!![]});if(!_0x3cb9d6)throw new Error(_0xf986('0x4b'));if(_0x3cb9d6[_0xf986('0x4c')]===_0xf986('0x4a')){var _0x3d1538=_0x56b2f4[_0xf986('0x26')]({'plain':!![]});var _0x4bbc74='Templates';return db[_0xf986('0x4d')][_0xf986('0x48')]({'where':{'name':_0x4bbc74,'userProfileId':_0x3cb9d6[_0xf986('0x4e')]},'raw':!![]})[_0xf986('0x25')](function(_0x225fd0){if(_0x225fd0&&_0x225fd0[_0xf986('0x4f')]===0x0){return db[_0xf986('0x27')][_0xf986('0x49')]({'name':_0x3d1538[_0xf986('0x2a')],'resourceId':_0x3d1538['id'],'type':_0x225fd0[_0xf986('0x2a')],'sectionId':_0x225fd0['id']},{})[_0xf986('0x25')](function(){return _0x56b2f4;});}else{return _0x56b2f4;}})[_0xf986('0x46')](function(_0x53d7d2){logger[_0xf986('0x50')](_0xf986('0x51'),_0x53d7d2);throw _0x53d7d2;});}return _0x56b2f4;})[_0xf986('0x25')](respondWithResult(_0xec51b6,0xc9))[_0xf986('0x46')](handleError(_0xec51b6,null));};exports[_0xf986('0x52')]=function(_0x51200a,_0x3afbdb){if(_0x51200a['body']['id']){delete _0x51200a['body']['id'];}return db[_0xf986('0x2e')][_0xf986('0x48')]({'where':{'id':_0x51200a['params']['id']}})[_0xf986('0x25')](handleEntityNotFound(_0x3afbdb,null))['then'](saveUpdates(_0x51200a['body'],null))[_0xf986('0x25')](respondWithResult(_0x3afbdb,null))[_0xf986('0x46')](handleError(_0x3afbdb,null));};exports[_0xf986('0x28')]=function(_0x4b1f43,_0x57291e){return db[_0xf986('0x2e')][_0xf986('0x48')]({'where':{'id':_0x4b1f43[_0xf986('0x53')]['id']}})['then'](handleEntityNotFound(_0x57291e,null))[_0xf986('0x25')](removeEntity(_0x57291e,null))[_0xf986('0x46')](handleError(_0x57291e,null));}; \ No newline at end of file +var _0x1587=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','get','Templates','UserProfileResource','error','name','index','map','Template','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find'];(function(_0x225a97,_0x477562){var _0xc01055=function(_0x25f821){while(--_0x25f821){_0x225a97['push'](_0x225a97['shift']());}};_0xc01055(++_0x477562);}(_0x1587,0xad));var _0x7158=function(_0x1021b7,_0x1afa2f){_0x1021b7=_0x1021b7-0x0;var _0x4e1ff2=_0x1587[_0x1021b7];return _0x4e1ff2;};'use strict';var emlformat=require(_0x7158('0x0'));var rimraf=require(_0x7158('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7158('0x2'));var rp=require('request-promise');var moment=require(_0x7158('0x3'));var BPromise=require(_0x7158('0x4'));var Mustache=require('mustache');var util=require(_0x7158('0x5'));var path=require(_0x7158('0x6'));var sox=require(_0x7158('0x7'));var csv=require('to-csv');var ejs=require(_0x7158('0x8'));var fs=require('fs');var fs_extra=require(_0x7158('0x9'));var _=require(_0x7158('0xa'));var squel=require('squel');var crypto=require(_0x7158('0xb'));var jsforce=require(_0x7158('0xc'));var deskjs=require(_0x7158('0xd'));var toCsv=require(_0x7158('0xe'));var querystring=require(_0x7158('0xf'));var Papa=require(_0x7158('0x10'));var Redis=require(_0x7158('0x11'));var authService=require(_0x7158('0x12'));var qs=require(_0x7158('0x13'));var as=require(_0x7158('0x14'));var hardwareService=require(_0x7158('0x15'));var logger=require(_0x7158('0x16'))('api');var utils=require(_0x7158('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7158('0x18'));var db=require(_0x7158('0x19'))['db'];function respondWithStatusCode(_0x5444bb,_0x23bbf7){_0x23bbf7=_0x23bbf7||0xcc;return function(_0x5ca018){if(_0x5ca018){return _0x5444bb[_0x7158('0x1a')](_0x23bbf7);}return _0x5444bb[_0x7158('0x1b')](_0x23bbf7)[_0x7158('0x1c')]();};}function respondWithResult(_0x4c01da,_0x4b7509){_0x4b7509=_0x4b7509||0xc8;return function(_0x3c4130){if(_0x3c4130){return _0x4c01da[_0x7158('0x1b')](_0x4b7509)[_0x7158('0x1d')](_0x3c4130);}};}function respondWithFilteredResult(_0x5234c6,_0x4736bc){return function(_0x57dd74){if(_0x57dd74){var _0x1d6212=typeof _0x4736bc[_0x7158('0x1e')]==='undefined'&&typeof _0x4736bc[_0x7158('0x1f')]===_0x7158('0x20');var _0x3d506b=_0x57dd74[_0x7158('0x21')];var _0x4db2f9=_0x1d6212?0x0:_0x4736bc[_0x7158('0x1e')];var _0x59531e=_0x1d6212?_0x57dd74['count']:_0x4736bc[_0x7158('0x1e')]+_0x4736bc[_0x7158('0x1f')];var _0x4e91ad;if(_0x59531e>=_0x3d506b){_0x59531e=_0x3d506b;_0x4e91ad=0xc8;}else{_0x4e91ad=0xce;}_0x5234c6['status'](_0x4e91ad);return _0x5234c6[_0x7158('0x22')](_0x7158('0x23'),_0x4db2f9+'-'+_0x59531e+'/'+_0x3d506b)['json'](_0x57dd74);}return null;};}function patchUpdates(_0x396e71){return function(_0x22c581){try{jsonpatch[_0x7158('0x24')](_0x22c581,_0x396e71,!![]);}catch(_0xb13b4c){return BPromise[_0x7158('0x25')](_0xb13b4c);}return _0x22c581['save']();};}function saveUpdates(_0x4af042,_0x57d07a){return function(_0x2162bb){if(_0x2162bb){return _0x2162bb[_0x7158('0x26')](_0x4af042)['then'](function(_0x2c15b6){return _0x2c15b6;});}return null;};}function removeEntity(_0x1a577e,_0x35e382){return function(_0x3ef37e){if(_0x3ef37e){return _0x3ef37e[_0x7158('0x27')]()[_0x7158('0x28')](function(){var _0x5c22c3=_0x3ef37e[_0x7158('0x29')]({'plain':!![]});var _0x2ce46f=_0x7158('0x2a');return db[_0x7158('0x2b')]['destroy']({'where':{'type':_0x2ce46f,'resourceId':_0x5c22c3['id']}})[_0x7158('0x28')](function(){return _0x3ef37e;});})[_0x7158('0x28')](function(){_0x1a577e['status'](0xcc)[_0x7158('0x1c')]();});}};}function handleEntityNotFound(_0x23ace2,_0x5fbef5){return function(_0x32ea0e){if(!_0x32ea0e){_0x23ace2['sendStatus'](0x194);}return _0x32ea0e;};}function handleError(_0x2e491a,_0x56e161){_0x56e161=_0x56e161||0x1f4;return function(_0x441d18){logger[_0x7158('0x2c')](_0x441d18['stack']);if(_0x441d18[_0x7158('0x2d')]){delete _0x441d18[_0x7158('0x2d')];}_0x2e491a[_0x7158('0x1b')](_0x56e161)['send'](_0x441d18);};}exports[_0x7158('0x2e')]=function(_0x55052e,_0x10fe2d){var _0x577052={},_0x3af4bd={},_0x35321f={'count':0x0,'rows':[]};var _0x5e9c62=_[_0x7158('0x2f')](db[_0x7158('0x30')]['rawAttributes'],function(_0x422186){return{'name':_0x422186['fieldName'],'type':_0x422186[_0x7158('0x31')][_0x7158('0x32')]};});_0x3af4bd[_0x7158('0x33')]=_[_0x7158('0x2f')](_0x5e9c62,_0x7158('0x2d'));_0x3af4bd[_0x7158('0x34')]=_[_0x7158('0x35')](_0x55052e['query']);_0x3af4bd[_0x7158('0x36')]=_[_0x7158('0x37')](_0x3af4bd[_0x7158('0x33')],_0x3af4bd[_0x7158('0x34')]);_0x577052[_0x7158('0x38')]=_[_0x7158('0x37')](_0x3af4bd['model'],qs[_0x7158('0x39')](_0x55052e[_0x7158('0x34')]['fields']));_0x577052[_0x7158('0x38')]=_0x577052['attributes'][_0x7158('0x3a')]?_0x577052['attributes']:_0x3af4bd[_0x7158('0x33')];if(!_0x55052e['query']['hasOwnProperty'](_0x7158('0x3b'))){_0x577052[_0x7158('0x1f')]=qs[_0x7158('0x1f')](_0x55052e[_0x7158('0x34')][_0x7158('0x1f')]);_0x577052[_0x7158('0x1e')]=qs[_0x7158('0x1e')](_0x55052e[_0x7158('0x34')]['offset']);}_0x577052[_0x7158('0x3c')]=qs[_0x7158('0x3d')](_0x55052e[_0x7158('0x34')]['sort']);_0x577052[_0x7158('0x3e')]=qs[_0x7158('0x36')](_[_0x7158('0x3f')](_0x55052e[_0x7158('0x34')],_0x3af4bd['filters']),_0x5e9c62);if(_0x55052e[_0x7158('0x34')]['filter']){_0x577052[_0x7158('0x3e')]=_['merge'](_0x577052[_0x7158('0x3e')],{'$or':_[_0x7158('0x2f')](_0x5e9c62,function(_0x2d27ce){if(_0x2d27ce[_0x7158('0x31')]!==_0x7158('0x40')){var _0x19a493={};_0x19a493[_0x2d27ce[_0x7158('0x2d')]]={'$like':'%'+_0x55052e['query'][_0x7158('0x41')]+'%'};return _0x19a493;}})});}_0x577052=_[_0x7158('0x42')]({},_0x577052,_0x55052e[_0x7158('0x43')]);var _0x1316a1={'where':_0x577052[_0x7158('0x3e')]};return db['Template'][_0x7158('0x21')](_0x1316a1)[_0x7158('0x28')](function(_0x51d9dc){_0x35321f[_0x7158('0x21')]=_0x51d9dc;if(_0x55052e[_0x7158('0x34')][_0x7158('0x44')]){_0x577052[_0x7158('0x45')]=[{'all':!![]}];}return db[_0x7158('0x30')][_0x7158('0x46')](_0x577052);})[_0x7158('0x28')](function(_0x1566d5){_0x35321f[_0x7158('0x47')]=_0x1566d5;return _0x35321f;})[_0x7158('0x28')](respondWithFilteredResult(_0x10fe2d,_0x577052))[_0x7158('0x48')](handleError(_0x10fe2d,null));};exports['show']=function(_0xa90dfd,_0x1e9053){var _0xf05cdb={'raw':!![],'where':{'id':_0xa90dfd[_0x7158('0x49')]['id']}},_0x1a1b31={};_0x1a1b31[_0x7158('0x33')]=_['keys'](db[_0x7158('0x30')][_0x7158('0x4a')]);_0x1a1b31[_0x7158('0x34')]=_['keys'](_0xa90dfd[_0x7158('0x34')]);_0x1a1b31['filters']=_[_0x7158('0x37')](_0x1a1b31['model'],_0x1a1b31[_0x7158('0x34')]);_0xf05cdb['attributes']=_[_0x7158('0x37')](_0x1a1b31['model'],qs['fields'](_0xa90dfd[_0x7158('0x34')]['fields']));_0xf05cdb[_0x7158('0x38')]=_0xf05cdb['attributes'][_0x7158('0x3a')]?_0xf05cdb['attributes']:_0x1a1b31[_0x7158('0x33')];if(_0xa90dfd[_0x7158('0x34')][_0x7158('0x44')]){_0xf05cdb['include']=[{'all':!![]}];}_0xf05cdb=_[_0x7158('0x42')]({},_0xf05cdb,_0xa90dfd['options']);return db[_0x7158('0x30')][_0x7158('0x4b')](_0xf05cdb)[_0x7158('0x28')](handleEntityNotFound(_0x1e9053,null))[_0x7158('0x28')](respondWithResult(_0x1e9053,null))['catch'](handleError(_0x1e9053,null));};exports[_0x7158('0x4c')]=function(_0xf76ebe,_0x6a421){return db[_0x7158('0x30')]['create'](_0xf76ebe['body'],{})['then'](function(_0x3c39e0){var _0x44ca3a=_0xf76ebe['user']['get']({'plain':!![]});if(!_0x44ca3a)throw new Error(_0x7158('0x4d'));if(_0x44ca3a[_0x7158('0x4e')]===_0x7158('0x4f')){var _0x39ee03=_0x3c39e0[_0x7158('0x29')]({'plain':!![]});var _0x29e3d1=_0x7158('0x2a');return db[_0x7158('0x50')][_0x7158('0x4b')]({'where':{'name':_0x29e3d1,'userProfileId':_0x44ca3a['userProfileId']},'raw':!![]})[_0x7158('0x28')](function(_0x23f210){if(_0x23f210&&_0x23f210['autoAssociation']===0x0){return db[_0x7158('0x2b')][_0x7158('0x4c')]({'name':_0x39ee03[_0x7158('0x2d')],'resourceId':_0x39ee03['id'],'type':_0x23f210[_0x7158('0x2d')],'sectionId':_0x23f210['id']},{})[_0x7158('0x28')](function(){return _0x3c39e0;});}else{return _0x3c39e0;}})[_0x7158('0x48')](function(_0x2c15ee){logger['error'](_0x7158('0x51'),_0x2c15ee);throw _0x2c15ee;});}return _0x3c39e0;})[_0x7158('0x28')](respondWithResult(_0x6a421,0xc9))[_0x7158('0x48')](handleError(_0x6a421,null));};exports[_0x7158('0x26')]=function(_0x4e4701,_0x5cf9fa){if(_0x4e4701['body']['id']){delete _0x4e4701[_0x7158('0x52')]['id'];}return db[_0x7158('0x30')]['find']({'where':{'id':_0x4e4701[_0x7158('0x49')]['id']}})[_0x7158('0x28')](handleEntityNotFound(_0x5cf9fa,null))[_0x7158('0x28')](saveUpdates(_0x4e4701[_0x7158('0x52')],null))[_0x7158('0x28')](respondWithResult(_0x5cf9fa,null))['catch'](handleError(_0x5cf9fa,null));};exports[_0x7158('0x27')]=function(_0x23dfa9,_0x4627a9){return db[_0x7158('0x30')][_0x7158('0x4b')]({'where':{'id':_0x23dfa9[_0x7158('0x49')]['id']}})[_0x7158('0x28')](handleEntityNotFound(_0x4627a9,null))[_0x7158('0x28')](removeEntity(_0x4627a9,null))[_0x7158('0x48')](handleError(_0x4627a9,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e560916..c5dae84 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 _0x88f2=['request-promise','rimraf','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2419c7,_0x1486e6){var _0x1fd347=function(_0x10716f){while(--_0x10716f){_0x2419c7['push'](_0x2419c7['shift']());}};_0x1fd347(++_0x1486e6);}(_0x88f2,0x66));var _0x288f=function(_0x1cc949,_0x2d58a2){_0x1cc949=_0x1cc949-0x0;var _0x5c4a28=_0x88f2[_0x1cc949];return _0x5c4a28;};'use strict';var _=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var logger=require(_0x288f('0x2'))(_0x288f('0x3'));var moment=require(_0x288f('0x4'));var BPromise=require(_0x288f('0x5'));var rp=require(_0x288f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x288f('0x7'));var config=require('../../config/environment');var attributes=require(_0x288f('0x8'));module['exports']=function(_0x4234b0,_0x5da8d6){return _0x4234b0[_0x288f('0x9')](_0x288f('0xa'),attributes,{'tableName':_0x288f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5476=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates','util','../../config/logger'];(function(_0x49bcfe,_0x1dfb73){var _0x32b827=function(_0x124238){while(--_0x124238){_0x49bcfe['push'](_0x49bcfe['shift']());}};_0x32b827(++_0x1dfb73);}(_0x5476,0x11c));var _0x6547=function(_0x3c4c51,_0x27b863){_0x3c4c51=_0x3c4c51-0x0;var _0x182e28=_0x5476[_0x3c4c51];return _0x182e28;};'use strict';var _=require('lodash');var util=require(_0x6547('0x0'));var logger=require(_0x6547('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6547('0x2'));var rp=require(_0x6547('0x3'));var fs=require('fs');var path=require(_0x6547('0x4'));var rimraf=require(_0x6547('0x5'));var config=require(_0x6547('0x6'));var attributes=require('./template.attributes');module[_0x6547('0x7')]=function(_0xa9eeec,_0x4e153e){return _0xa9eeec[_0x6547('0x8')](_0x6547('0x9'),attributes,{'tableName':_0x6547('0xa'),'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 5a67c39..8242721 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 _0x7dc8=['model','include','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x273de0,_0x564057){var _0x309969=function(_0x1fa6de){while(--_0x1fa6de){_0x273de0['push'](_0x273de0['shift']());}};_0x309969(++_0x564057);}(_0x7dc8,0x1b0));var _0x87dc=function(_0x1d0b52,_0x24b776){_0x1d0b52=_0x1d0b52-0x0;var _0x2e9da3=_0x7dc8[_0x1d0b52];return _0x2e9da3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x87dc('0x0'));var rs=require(_0x87dc('0x1'));var fs=require('fs');var Redis=require(_0x87dc('0x2'));var db=require(_0x87dc('0x3'))['db'];var utils=require(_0x87dc('0x4'));var logger=require('../../config/logger')(_0x87dc('0x5'));var config=require(_0x87dc('0x6'));var jayson=require(_0x87dc('0x7'));var client=jayson[_0x87dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x223649,_0x528525,_0x543a14){return new BPromise(function(_0xb6148c,_0x548b80){return client[_0x87dc('0x9')](_0x223649,_0x543a14)[_0x87dc('0xa')](function(_0x3a30c1){logger[_0x87dc('0xb')](_0x87dc('0xc'),_0x528525,_0x87dc('0xd'));logger[_0x87dc('0xe')](_0x87dc('0xf'),_0x528525,'request\x20sent',JSON[_0x87dc('0x10')](_0x3a30c1));if(_0x3a30c1[_0x87dc('0x11')]){if(_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x12')]===0x1f4){logger[_0x87dc('0x11')](_0x87dc('0xc'),_0x528525,_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);return _0x548b80(_0x3a30c1['error'][_0x87dc('0x13')]);}logger['error'](_0x87dc('0xc'),_0x528525,_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);return _0xb6148c(_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);}else{logger[_0x87dc('0xb')](_0x87dc('0xc'),_0x528525,'request\x20sent');_0xb6148c(_0x3a30c1[_0x87dc('0x14')]['message']);}})[_0x87dc('0x15')](function(_0x14541b){logger['error'](_0x87dc('0xc'),_0x528525,_0x14541b);_0x548b80(_0x14541b);});});}exports[_0x87dc('0x16')]=function(_0x4f3554){var _0x4b314c=this;return new Promise(function(_0x10af3f,_0x342117){return db[_0x87dc('0x17')][_0x87dc('0x18')]({'raw':_0x4f3554['options']?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f3554[_0x87dc('0x19')]?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1b')]||null:null,'attributes':_0x4f3554['options']?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1c')]||null:null,'limit':_0x4f3554[_0x87dc('0x19')]?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1d')]||null:null,'include':_0x4f3554[_0x87dc('0x19')]?_0x4f3554['options']['include']?_['map'](_0x4f3554[_0x87dc('0x19')]['include'],function(_0x30bf3){return{'model':db[_0x30bf3[_0x87dc('0x1e')]],'as':_0x30bf3['as'],'attributes':_0x30bf3[_0x87dc('0x1c')],'include':_0x30bf3[_0x87dc('0x1f')]?_[_0x87dc('0x20')](_0x30bf3[_0x87dc('0x1f')],function(_0x2adab0){return{'model':db[_0x2adab0[_0x87dc('0x1e')]],'as':_0x2adab0['as'],'attributes':_0x2adab0['attributes'],'include':_0x2adab0[_0x87dc('0x1f')]?_[_0x87dc('0x20')](_0x2adab0['include'],function(_0x2eb6d5){return{'model':db[_0x2eb6d5[_0x87dc('0x1e')]],'as':_0x2eb6d5['as'],'attributes':_0x2eb6d5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7441){logger['info'](_0x87dc('0x16'),_0x4f3554);logger[_0x87dc('0xe')](_0x87dc('0x16'),_0x4f3554,JSON[_0x87dc('0x10')](_0x4c7441));_0x10af3f(_0x4c7441);})[_0x87dc('0x15')](function(_0x1fa42a){logger[_0x87dc('0x11')](_0x87dc('0x16'),_0x1fa42a[_0x87dc('0x13')],_0x4f3554);_0x342117(_0x4b314c[_0x87dc('0x11')](0x1f4,_0x1fa42a[_0x87dc('0x13')]));});});}; \ No newline at end of file +var _0xd436=['where','attributes','limit','include','map','model','then','GetTemplate','debug','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','client','http','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','Template','options','raw'];(function(_0xf022be,_0x14e78e){var _0x18d7d5=function(_0x4bcdca){while(--_0x4bcdca){_0xf022be['push'](_0xf022be['shift']());}};_0x18d7d5(++_0x14e78e);}(_0xd436,0x1ea));var _0x6d43=function(_0x54b719,_0x39ade5){_0x54b719=_0x54b719-0x0;var _0x31edd9=_0xd436[_0x54b719];return _0x31edd9;};'use strict';var _=require(_0x6d43('0x0'));var util=require(_0x6d43('0x1'));var moment=require('moment');var BPromise=require(_0x6d43('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d43('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d43('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d43('0x6')][_0x6d43('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2659b6,_0x2565eb,_0x591df3){return new BPromise(function(_0x5d1195,_0x1b7638){return client['request'](_0x2659b6,_0x591df3)['then'](function(_0x39f1bf){logger['info'](_0x6d43('0x8'),_0x2565eb,_0x6d43('0x9'));logger['debug'](_0x6d43('0xa'),_0x2565eb,_0x6d43('0x9'),JSON[_0x6d43('0xb')](_0x39f1bf));if(_0x39f1bf['error']){if(_0x39f1bf['error'][_0x6d43('0xc')]===0x1f4){logger[_0x6d43('0xd')](_0x6d43('0x8'),_0x2565eb,_0x39f1bf[_0x6d43('0xd')][_0x6d43('0xe')]);return _0x1b7638(_0x39f1bf[_0x6d43('0xd')][_0x6d43('0xe')]);}logger[_0x6d43('0xd')](_0x6d43('0x8'),_0x2565eb,_0x39f1bf[_0x6d43('0xd')][_0x6d43('0xe')]);return _0x5d1195(_0x39f1bf[_0x6d43('0xd')][_0x6d43('0xe')]);}else{logger[_0x6d43('0xf')]('Template,\x20%s,\x20%s',_0x2565eb,_0x6d43('0x9'));_0x5d1195(_0x39f1bf[_0x6d43('0x10')][_0x6d43('0xe')]);}})['catch'](function(_0x13d4ab){logger[_0x6d43('0xd')]('Template,\x20%s,\x20%s',_0x2565eb,_0x13d4ab);_0x1b7638(_0x13d4ab);});});}exports['GetTemplate']=function(_0x5294f9){var _0x1c098b=this;return new Promise(function(_0x2f118e,_0x558ea8){return db[_0x6d43('0x11')]['findAll']({'raw':_0x5294f9[_0x6d43('0x12')]?_0x5294f9[_0x6d43('0x12')][_0x6d43('0x13')]===undefined?!![]:![]:!![],'where':_0x5294f9[_0x6d43('0x12')]?_0x5294f9['options'][_0x6d43('0x14')]||null:null,'attributes':_0x5294f9[_0x6d43('0x12')]?_0x5294f9['options'][_0x6d43('0x15')]||null:null,'limit':_0x5294f9[_0x6d43('0x12')]?_0x5294f9['options'][_0x6d43('0x16')]||null:null,'include':_0x5294f9[_0x6d43('0x12')]?_0x5294f9[_0x6d43('0x12')][_0x6d43('0x17')]?_[_0x6d43('0x18')](_0x5294f9[_0x6d43('0x12')][_0x6d43('0x17')],function(_0x143c6c){return{'model':db[_0x143c6c[_0x6d43('0x19')]],'as':_0x143c6c['as'],'attributes':_0x143c6c[_0x6d43('0x15')],'include':_0x143c6c[_0x6d43('0x17')]?_[_0x6d43('0x18')](_0x143c6c['include'],function(_0x16f5a3){return{'model':db[_0x16f5a3[_0x6d43('0x19')]],'as':_0x16f5a3['as'],'attributes':_0x16f5a3[_0x6d43('0x15')],'include':_0x16f5a3[_0x6d43('0x17')]?_[_0x6d43('0x18')](_0x16f5a3[_0x6d43('0x17')],function(_0x3c6004){return{'model':db[_0x3c6004[_0x6d43('0x19')]],'as':_0x3c6004['as'],'attributes':_0x3c6004[_0x6d43('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d43('0x1a')](function(_0x421dbe){logger[_0x6d43('0xf')](_0x6d43('0x1b'),_0x5294f9);logger[_0x6d43('0x1c')](_0x6d43('0x1b'),_0x5294f9,JSON[_0x6d43('0xb')](_0x421dbe));_0x2f118e(_0x421dbe);})[_0x6d43('0x1d')](function(_0x1ec6df){logger['error'](_0x6d43('0x1b'),_0x1ec6df[_0x6d43('0xe')],_0x5294f9);_0x558ea8(_0x1c098b[_0x6d43('0xd')](0x1f4,_0x1ec6df['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 07236bf..55eb000 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 _0x25c2=['index','/:id','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','/:id/all_conditions','addAnyCondition','addAction','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x449f61,_0x232c0d){var _0x3b57f3=function(_0x43b26e){while(--_0x43b26e){_0x449f61['push'](_0x449f61['shift']());}};_0x3b57f3(++_0x232c0d);}(_0x25c2,0xdd));var _0x225c=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x25c2[_0x29db36];return _0x234e87;};'use strict';var multer=require(_0x225c('0x0'));var util=require('util');var path=require(_0x225c('0x1'));var timeout=require(_0x225c('0x2'));var express=require('express');var router=express[_0x225c('0x3')]();var fs_extra=require(_0x225c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x225c('0x5'));var config=require(_0x225c('0x6'));var controller=require('./trigger.controller');router[_0x225c('0x7')]('/',auth[_0x225c('0x8')](),controller[_0x225c('0x9')]);router[_0x225c('0x7')](_0x225c('0xa'),auth[_0x225c('0x8')](),controller['show']);router[_0x225c('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x225c('0xb')]);router[_0x225c('0x7')](_0x225c('0xc'),auth['isAuthenticated'](),controller[_0x225c('0xd')]);router[_0x225c('0x7')](_0x225c('0xe'),auth[_0x225c('0x8')](),controller['getActions']);router[_0x225c('0xf')]('/',auth[_0x225c('0x8')](),controller['create']);router[_0x225c('0xf')](_0x225c('0x10'),auth[_0x225c('0x8')](),controller['addAllCondition']);router[_0x225c('0xf')](_0x225c('0xc'),auth[_0x225c('0x8')](),controller[_0x225c('0x11')]);router[_0x225c('0xf')](_0x225c('0xe'),auth[_0x225c('0x8')](),controller[_0x225c('0x12')]);router['put']('/:id',auth[_0x225c('0x8')](),controller[_0x225c('0x13')]);router[_0x225c('0x14')](_0x225c('0xa'),auth['isAuthenticated'](),controller[_0x225c('0x15')]);module[_0x225c('0x16')]=router; \ No newline at end of file +var _0x3eae=['addAction','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','./trigger.controller','get','index','isAuthenticated','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x3eae,0x66));var _0xe3ea=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x3eae[_0x5b27da];return _0x3254f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe3ea('0x0'));var timeout=require(_0xe3ea('0x1'));var express=require('express');var router=express[_0xe3ea('0x2')]();var fs_extra=require(_0xe3ea('0x3'));var auth=require(_0xe3ea('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe3ea('0x5'));router[_0xe3ea('0x6')]('/',auth['isAuthenticated'](),controller[_0xe3ea('0x7')]);router[_0xe3ea('0x6')]('/:id',auth[_0xe3ea('0x8')](),controller['show']);router[_0xe3ea('0x6')](_0xe3ea('0x9'),auth[_0xe3ea('0x8')](),controller['getAllConditions']);router[_0xe3ea('0x6')](_0xe3ea('0xa'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0xb')]);router[_0xe3ea('0x6')](_0xe3ea('0xc'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe3ea('0xe')]);router[_0xe3ea('0xf')](_0xe3ea('0x9'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0x10')]);router[_0xe3ea('0xf')](_0xe3ea('0xa'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0x11')]);router[_0xe3ea('0xf')](_0xe3ea('0xc'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0x12')]);router['put'](_0xe3ea('0x13'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0x14')]);router[_0xe3ea('0x15')](_0xe3ea('0x13'),auth[_0xe3ea('0x8')](),controller[_0xe3ea('0x16')]);module[_0xe3ea('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 4a0b6b3..48c3e33 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 _0xcc1b=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0xcc1b,0x89));var _0xbcc1=function(_0xede81e,_0x15ffce){_0xede81e=_0xede81e-0x0;var _0xb1193=_0xcc1b[_0xede81e];return _0xb1193;};'use strict';var Sequelize=require(_0xbcc1('0x0'));module[_0xbcc1('0x1')]={'name':{'type':Sequelize[_0xbcc1('0x2')]},'channel':{'type':Sequelize[_0xbcc1('0x2')]},'description':{'type':Sequelize[_0xbcc1('0x2')]},'status':{'type':Sequelize[_0xbcc1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8101=['exports','STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8101,0x195));var _0x1810=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x8101[_0x2125f0];return _0x12d6eb;};'use strict';var Sequelize=require('sequelize');module[_0x1810('0x0')]={'name':{'type':Sequelize[_0x1810('0x1')]},'channel':{'type':Sequelize[_0x1810('0x1')]},'description':{'type':Sequelize[_0x1810('0x1')]},'status':{'type':Sequelize[_0x1810('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fd4d1b5..42fb5a8 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 _0x9f2c=['role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user'];(function(_0x29d172,_0x130406){var _0xf0fbea=function(_0x4bdba5){while(--_0x4bdba5){_0x29d172['push'](_0x29d172['shift']());}};_0xf0fbea(++_0x130406);}(_0x9f2c,0x66));var _0xc9f2=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x9f2c[_0x549928];return _0x941e27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc9f2('0x1'));var moment=require(_0xc9f2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9f2('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc9f2('0x4'));var csv=require(_0xc9f2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9f2('0x6'));var _=require(_0xc9f2('0x7'));var squel=require('squel');var crypto=require(_0xc9f2('0x8'));var jsforce=require(_0xc9f2('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc9f2('0x5'));var querystring=require('querystring');var Papa=require(_0xc9f2('0xa'));var Redis=require(_0xc9f2('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc9f2('0xc'));var as=require(_0xc9f2('0xd'));var hardwareService=require(_0xc9f2('0xe'));var logger=require(_0xc9f2('0xf'))(_0xc9f2('0x10'));var utils=require('../../config/utils');var config=require(_0xc9f2('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9f2('0x12'))['db'];function respondWithStatusCode(_0x57f7fc,_0x4a0484){_0x4a0484=_0x4a0484||0xcc;return function(_0x56deee){if(_0x56deee){return _0x57f7fc[_0xc9f2('0x13')](_0x4a0484);}return _0x57f7fc[_0xc9f2('0x14')](_0x4a0484)[_0xc9f2('0x15')]();};}function respondWithResult(_0x578bce,_0x4dd391){_0x4dd391=_0x4dd391||0xc8;return function(_0xb56feb){if(_0xb56feb){return _0x578bce['status'](_0x4dd391)['json'](_0xb56feb);}};}function respondWithFilteredResult(_0xd02e80,_0x201efe){return function(_0x9f4502){if(_0x9f4502){var _0x252d5f=typeof _0x201efe[_0xc9f2('0x16')]===_0xc9f2('0x17')&&typeof _0x201efe[_0xc9f2('0x18')]===_0xc9f2('0x17');var _0x10c6a7=_0x9f4502[_0xc9f2('0x19')];var _0x54fb87=_0x252d5f?0x0:_0x201efe['offset'];var _0x4983aa=_0x252d5f?_0x9f4502['count']:_0x201efe[_0xc9f2('0x16')]+_0x201efe[_0xc9f2('0x18')];var _0x529f69;if(_0x4983aa>=_0x10c6a7){_0x4983aa=_0x10c6a7;_0x529f69=0xc8;}else{_0x529f69=0xce;}_0xd02e80[_0xc9f2('0x14')](_0x529f69);return _0xd02e80[_0xc9f2('0x1a')](_0xc9f2('0x1b'),_0x54fb87+'-'+_0x4983aa+'/'+_0x10c6a7)[_0xc9f2('0x1c')](_0x9f4502);}return null;};}function patchUpdates(_0x29dd24){return function(_0x15ed6d){try{jsonpatch[_0xc9f2('0x1d')](_0x15ed6d,_0x29dd24,!![]);}catch(_0x530b0e){return BPromise[_0xc9f2('0x1e')](_0x530b0e);}return _0x15ed6d['save']();};}function saveUpdates(_0x4c6554,_0x5a850b){return function(_0x1dc23f){if(_0x1dc23f){return _0x1dc23f[_0xc9f2('0x1f')](_0x4c6554)['then'](function(_0xcaec78){return _0xcaec78;});}return null;};}function removeEntity(_0x280f8d,_0xfb0bc1){return function(_0x11f2a4){if(_0x11f2a4){return _0x11f2a4[_0xc9f2('0x20')]()['then'](function(){var _0x48a076=_0x11f2a4[_0xc9f2('0x21')]({'plain':!![]});var _0x449231=_0xc9f2('0x22');return db[_0xc9f2('0x23')][_0xc9f2('0x20')]({'where':{'type':_0x449231,'resourceId':_0x48a076['id']}})[_0xc9f2('0x24')](function(){return _0x11f2a4;});})[_0xc9f2('0x24')](function(){_0x280f8d[_0xc9f2('0x14')](0xcc)[_0xc9f2('0x15')]();});}};}function handleEntityNotFound(_0xa01330,_0x590444){return function(_0x254125){if(!_0x254125){_0xa01330[_0xc9f2('0x13')](0x194);}return _0x254125;};}function handleError(_0x387a3f,_0xb7225a){_0xb7225a=_0xb7225a||0x1f4;return function(_0x5d04e5){logger[_0xc9f2('0x25')](_0x5d04e5[_0xc9f2('0x26')]);if(_0x5d04e5[_0xc9f2('0x27')]){delete _0x5d04e5[_0xc9f2('0x27')];}_0x387a3f[_0xc9f2('0x14')](_0xb7225a)[_0xc9f2('0x28')](_0x5d04e5);};}exports[_0xc9f2('0x29')]=function(_0x143a8a,_0xdb3e08){var _0x56f242={},_0x586be7={},_0x4b42b0={'count':0x0,'rows':[]};var _0x49d79b=_[_0xc9f2('0x2a')](db[_0xc9f2('0x2b')][_0xc9f2('0x2c')],function(_0x537326){return{'name':_0x537326[_0xc9f2('0x2d')],'type':_0x537326[_0xc9f2('0x2e')][_0xc9f2('0x2f')]};});_0x586be7['model']=_[_0xc9f2('0x2a')](_0x49d79b,'name');_0x586be7[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x143a8a[_0xc9f2('0x30')]);_0x586be7['filters']=_['intersection'](_0x586be7[_0xc9f2('0x32')],_0x586be7[_0xc9f2('0x30')]);_0x56f242[_0xc9f2('0x33')]=_[_0xc9f2('0x34')](_0x586be7[_0xc9f2('0x32')],qs[_0xc9f2('0x35')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x56f242[_0xc9f2('0x33')]=_0x56f242[_0xc9f2('0x33')][_0xc9f2('0x36')]?_0x56f242[_0xc9f2('0x33')]:_0x586be7[_0xc9f2('0x32')];if(!_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x56f242[_0xc9f2('0x18')]=qs[_0xc9f2('0x18')](_0x143a8a['query']['limit']);_0x56f242['offset']=qs[_0xc9f2('0x16')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x16')]);}_0x56f242[_0xc9f2('0x39')]=qs[_0xc9f2('0x3a')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x3a')]);_0x56f242[_0xc9f2('0x3b')]=qs[_0xc9f2('0x3c')](_['pick'](_0x143a8a['query'],_0x586be7[_0xc9f2('0x3c')]),_0x49d79b);if(_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x56f242['where']=_['merge'](_0x56f242['where'],{'$or':_[_0xc9f2('0x2a')](_0x49d79b,function(_0x55f5da){if(_0x55f5da[_0xc9f2('0x2e')]!==_0xc9f2('0x3e')){var _0xf671c5={};_0xf671c5[_0x55f5da['name']]={'$like':'%'+_0x143a8a['query']['filter']+'%'};return _0xf671c5;}})});}_0x56f242=_[_0xc9f2('0x3f')]({},_0x56f242,_0x143a8a[_0xc9f2('0x40')]);var _0x1be9e0={'where':_0x56f242[_0xc9f2('0x3b')]};return db[_0xc9f2('0x2b')]['count'](_0x1be9e0)['then'](function(_0x45cd11){_0x4b42b0[_0xc9f2('0x19')]=_0x45cd11;if(_0x143a8a[_0xc9f2('0x30')]['includeAll']){_0x56f242[_0xc9f2('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xc9f2('0x42')](_0x56f242);})[_0xc9f2('0x24')](function(_0xf6354a){_0x4b42b0[_0xc9f2('0x43')]=_0xf6354a;return _0x4b42b0;})['then'](respondWithFilteredResult(_0xdb3e08,_0x56f242))[_0xc9f2('0x44')](handleError(_0xdb3e08,null));};exports[_0xc9f2('0x45')]=function(_0x39df27,_0x3d8b94){var _0x28cd1e={'raw':![],'where':{'id':_0x39df27[_0xc9f2('0x46')]['id']}},_0x431bc8={};_0x431bc8['model']=_[_0xc9f2('0x31')](db['Trigger']['rawAttributes']);_0x431bc8[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x39df27[_0xc9f2('0x30')]);_0x431bc8[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x431bc8[_0xc9f2('0x32')],_0x431bc8[_0xc9f2('0x30')]);_0x28cd1e['attributes']=_[_0xc9f2('0x34')](_0x431bc8['model'],qs[_0xc9f2('0x35')](_0x39df27['query'][_0xc9f2('0x35')]));_0x28cd1e[_0xc9f2('0x33')]=_0x28cd1e['attributes'][_0xc9f2('0x36')]?_0x28cd1e[_0xc9f2('0x33')]:_0x431bc8[_0xc9f2('0x32')];if(_0x39df27[_0xc9f2('0x30')][_0xc9f2('0x47')]){_0x28cd1e[_0xc9f2('0x41')]=[{'all':!![]}];}_0x28cd1e=_[_0xc9f2('0x3f')]({},_0x28cd1e,_0x39df27['options']);return db[_0xc9f2('0x2b')][_0xc9f2('0x48')](_0x28cd1e)['then'](handleEntityNotFound(_0x3d8b94,null))[_0xc9f2('0x24')](respondWithResult(_0x3d8b94,null))[_0xc9f2('0x44')](handleError(_0x3d8b94,null));};exports[_0xc9f2('0x49')]=function(_0x209cf9,_0x4365ce){return db['Trigger'][_0xc9f2('0x49')](_0x209cf9[_0xc9f2('0x4a')],{})[_0xc9f2('0x24')](function(_0x1e08bd){var _0x4d2880=_0x209cf9[_0xc9f2('0x4b')][_0xc9f2('0x21')]({'plain':!![]});if(!_0x4d2880)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2880[_0xc9f2('0x4c')]==='user'){var _0x5699d4=_0x1e08bd[_0xc9f2('0x21')]({'plain':!![]});var _0x57a380=_0xc9f2('0x22');return db[_0xc9f2('0x4d')]['find']({'where':{'name':_0x57a380,'userProfileId':_0x4d2880['userProfileId']},'raw':!![]})[_0xc9f2('0x24')](function(_0x17b6a3){if(_0x17b6a3&&_0x17b6a3['autoAssociation']===0x0){return db[_0xc9f2('0x23')][_0xc9f2('0x49')]({'name':_0x5699d4[_0xc9f2('0x27')],'resourceId':_0x5699d4['id'],'type':_0x17b6a3[_0xc9f2('0x27')],'sectionId':_0x17b6a3['id']},{})['then'](function(){return _0x1e08bd;});}else{return _0x1e08bd;}})[_0xc9f2('0x44')](function(_0x38e770){logger[_0xc9f2('0x25')](_0xc9f2('0x4e'),_0x38e770);throw _0x38e770;});}return _0x1e08bd;})['then'](respondWithResult(_0x4365ce,0xc9))[_0xc9f2('0x44')](handleError(_0x4365ce,null));};exports[_0xc9f2('0x1f')]=function(_0xe0d2c0,_0x2ff8e9){if(_0xe0d2c0[_0xc9f2('0x4a')]['id']){delete _0xe0d2c0[_0xc9f2('0x4a')]['id'];}return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0xe0d2c0['params']['id']}})['then'](handleEntityNotFound(_0x2ff8e9,null))[_0xc9f2('0x24')](saveUpdates(_0xe0d2c0[_0xc9f2('0x4a')],null))['then'](respondWithResult(_0x2ff8e9,null))[_0xc9f2('0x44')](handleError(_0x2ff8e9,null));};exports[_0xc9f2('0x20')]=function(_0x4c5dbd,_0x536a2f){return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0x4c5dbd[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x536a2f,null))[_0xc9f2('0x24')](removeEntity(_0x536a2f,null))[_0xc9f2('0x44')](handleError(_0x536a2f,null));};exports['addAllCondition']=function(_0x28aaf1,_0x86565b,_0x36bd1a){if(_0x28aaf1[_0xc9f2('0x4a')]['id']){delete _0x28aaf1[_0xc9f2('0x4a')]['id'];}return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0x28aaf1[_0xc9f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x86565b,null))['then'](function(_0x476989){if(_0x476989){_0x28aaf1[_0xc9f2('0x4a')]['TriggerAllId']=_0x476989['id'];return db[_0xc9f2('0x4f')][_0xc9f2('0x49')](_0x28aaf1[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x86565b,null))['catch'](handleError(_0x86565b,null));};exports[_0xc9f2('0x50')]=function(_0x45ac48,_0x4083e6,_0x4ee0f2){if(_0x45ac48[_0xc9f2('0x4a')]['id']){delete _0x45ac48[_0xc9f2('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x45ac48['params']['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x4083e6,null))[_0xc9f2('0x24')](function(_0x24f778){if(_0x24f778){_0x45ac48[_0xc9f2('0x4a')]['TriggerAnyId']=_0x24f778['id'];return db['Condition'][_0xc9f2('0x49')](_0x45ac48[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x4083e6,null))[_0xc9f2('0x44')](handleError(_0x4083e6,null));};exports[_0xc9f2('0x51')]=function(_0xf0e950,_0x1b8c4f,_0x2cbb){var _0x5a471a={};var _0x17e5e8={};var _0x427c64;var _0x45e9cd;return db[_0xc9f2('0x2b')][_0xc9f2('0x52')]({'where':{'id':_0xf0e950[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x1b8c4f,null))[_0xc9f2('0x24')](function(_0x5d6913){if(_0x5d6913){_0x427c64=_0x5d6913;_0x17e5e8['model']=_['keys'](db[_0xc9f2('0x4f')]['rawAttributes']);_0x17e5e8[_0xc9f2('0x30')]=_['keys'](_0xf0e950[_0xc9f2('0x30')]);_0x17e5e8[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x17e5e8[_0xc9f2('0x32')],_0x17e5e8['query']);_0x5a471a[_0xc9f2('0x33')]=_['intersection'](_0x17e5e8['model'],qs[_0xc9f2('0x35')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x5a471a[_0xc9f2('0x33')]=_0x5a471a[_0xc9f2('0x33')][_0xc9f2('0x36')]?_0x5a471a[_0xc9f2('0x33')]:_0x17e5e8[_0xc9f2('0x32')];_0x5a471a[_0xc9f2('0x39')]=qs[_0xc9f2('0x3a')](_0xf0e950[_0xc9f2('0x30')]['sort']);_0x5a471a[_0xc9f2('0x3b')]=qs[_0xc9f2('0x3c')](_[_0xc9f2('0x53')](_0xf0e950[_0xc9f2('0x30')],_0x17e5e8['filters']));if(_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x5a471a['where']=_['merge'](_0x5a471a['where'],{'$or':_[_0xc9f2('0x2a')](_0x5a471a[_0xc9f2('0x33')],function(_0x4a7ce6){var _0x4952f5={};_0x4952f5[_0x4a7ce6]={'$like':'%'+_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x3d')]+'%'};return _0x4952f5;})});}_0x5a471a=_[_0xc9f2('0x3f')]({},_0x5a471a,_0xf0e950[_0xc9f2('0x40')]);return _0x427c64[_0xc9f2('0x51')](_0x5a471a);}})[_0xc9f2('0x24')](function(_0x5f9a5d){if(_0x5f9a5d){_0x45e9cd=_0x5f9a5d[_0xc9f2('0x36')];if(!_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x5a471a[_0xc9f2('0x18')]=qs[_0xc9f2('0x18')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x5a471a[_0xc9f2('0x16')]=qs[_0xc9f2('0x16')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x427c64[_0xc9f2('0x51')](_0x5a471a);}})[_0xc9f2('0x24')](function(_0x234b32){if(_0x234b32){return _0x234b32?{'count':_0x45e9cd,'rows':_0x234b32}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x1b8c4f,null))[_0xc9f2('0x44')](handleError(_0x1b8c4f,null));};exports[_0xc9f2('0x54')]=function(_0x4e8dd7,_0x58b401,_0x3f664b){var _0x1742d0={};var _0x1c6ed4={};var _0x28735f;var _0x4982a5;return db[_0xc9f2('0x2b')]['findOne']({'where':{'id':_0x4e8dd7['params']['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x58b401,null))[_0xc9f2('0x24')](function(_0x10b7ac){if(_0x10b7ac){_0x28735f=_0x10b7ac;_0x1c6ed4[_0xc9f2('0x32')]=_[_0xc9f2('0x31')](db[_0xc9f2('0x4f')][_0xc9f2('0x2c')]);_0x1c6ed4[_0xc9f2('0x30')]=_['keys'](_0x4e8dd7[_0xc9f2('0x30')]);_0x1c6ed4[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x1c6ed4[_0xc9f2('0x32')],_0x1c6ed4[_0xc9f2('0x30')]);_0x1742d0[_0xc9f2('0x33')]=_[_0xc9f2('0x34')](_0x1c6ed4[_0xc9f2('0x32')],qs[_0xc9f2('0x35')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x1742d0[_0xc9f2('0x33')]=_0x1742d0[_0xc9f2('0x33')]['length']?_0x1742d0['attributes']:_0x1c6ed4['model'];_0x1742d0['order']=qs['sort'](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x3a')]);_0x1742d0['where']=qs[_0xc9f2('0x3c')](_[_0xc9f2('0x53')](_0x4e8dd7['query'],_0x1c6ed4[_0xc9f2('0x3c')]));if(_0x4e8dd7['query']['filter']){_0x1742d0[_0xc9f2('0x3b')]=_[_0xc9f2('0x3f')](_0x1742d0[_0xc9f2('0x3b')],{'$or':_['map'](_0x1742d0['attributes'],function(_0x51d0bf){var _0x83a1f0={};_0x83a1f0[_0x51d0bf]={'$like':'%'+_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x3d')]+'%'};return _0x83a1f0;})});}_0x1742d0=_[_0xc9f2('0x3f')]({},_0x1742d0,_0x4e8dd7[_0xc9f2('0x40')]);return _0x28735f[_0xc9f2('0x54')](_0x1742d0);}})[_0xc9f2('0x24')](function(_0x1268ce){if(_0x1268ce){_0x4982a5=_0x1268ce[_0xc9f2('0x36')];if(!_0x4e8dd7['query'][_0xc9f2('0x37')]('nolimit')){_0x1742d0['limit']=qs[_0xc9f2('0x18')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x1742d0['offset']=qs[_0xc9f2('0x16')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x28735f[_0xc9f2('0x54')](_0x1742d0);}})['then'](function(_0x1eb84c){if(_0x1eb84c){return _0x1eb84c?{'count':_0x4982a5,'rows':_0x1eb84c}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x58b401,null))[_0xc9f2('0x44')](handleError(_0x58b401,null));};exports[_0xc9f2('0x55')]=function(_0x5177c8,_0x491702,_0x221dbc){if(_0x5177c8['body']['id']){delete _0x5177c8['body']['id'];}return db['Trigger'][_0xc9f2('0x48')]({'where':{'id':_0x5177c8[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x491702,null))[_0xc9f2('0x24')](function(_0x3f552a){if(_0x3f552a){_0x5177c8['body'][_0xc9f2('0x56')]=_0x3f552a['id'];return db[_0xc9f2('0x57')][_0xc9f2('0x49')](_0x5177c8[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x491702,null))['catch'](handleError(_0x491702,null));};exports[_0xc9f2('0x58')]=function(_0x33b51c,_0x4bd72b,_0x16952a){var _0x334515={};var _0x33eac6={};var _0x3128c5;var _0x57df5f;return db[_0xc9f2('0x2b')][_0xc9f2('0x52')]({'where':{'id':_0x33b51c[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x4bd72b,null))[_0xc9f2('0x24')](function(_0x21a2e8){if(_0x21a2e8){_0x3128c5=_0x21a2e8;_0x33eac6['model']=_['keys'](db[_0xc9f2('0x57')][_0xc9f2('0x2c')]);_0x33eac6[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x33b51c[_0xc9f2('0x30')]);_0x33eac6['filters']=_[_0xc9f2('0x34')](_0x33eac6[_0xc9f2('0x32')],_0x33eac6['query']);_0x334515['attributes']=_[_0xc9f2('0x34')](_0x33eac6['model'],qs[_0xc9f2('0x35')](_0x33b51c['query'][_0xc9f2('0x35')]));_0x334515['attributes']=_0x334515[_0xc9f2('0x33')]['length']?_0x334515[_0xc9f2('0x33')]:_0x33eac6[_0xc9f2('0x32')];_0x334515['order']=qs[_0xc9f2('0x3a')](_0x33b51c['query'][_0xc9f2('0x3a')]);_0x334515[_0xc9f2('0x3b')]=qs['filters'](_[_0xc9f2('0x53')](_0x33b51c[_0xc9f2('0x30')],_0x33eac6[_0xc9f2('0x3c')]));if(_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x334515['where']=_[_0xc9f2('0x3f')](_0x334515[_0xc9f2('0x3b')],{'$or':_[_0xc9f2('0x2a')](_0x334515[_0xc9f2('0x33')],function(_0x2b6d3f){var _0x370219={};_0x370219[_0x2b6d3f]={'$like':'%'+_0x33b51c['query']['filter']+'%'};return _0x370219;})});}_0x334515=_[_0xc9f2('0x3f')]({},_0x334515,_0x33b51c['options']);return _0x3128c5[_0xc9f2('0x58')](_0x334515);}})[_0xc9f2('0x24')](function(_0x20af93){if(_0x20af93){_0x57df5f=_0x20af93[_0xc9f2('0x36')];if(!_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x334515['limit']=qs[_0xc9f2('0x18')](_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x334515[_0xc9f2('0x16')]=qs[_0xc9f2('0x16')](_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x3128c5[_0xc9f2('0x58')](_0x334515);}})[_0xc9f2('0x24')](function(_0x485ce0){if(_0x485ce0){return _0x485ce0?{'count':_0x57df5f,'rows':_0x485ce0}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x4bd72b,null))[_0xc9f2('0x44')](handleError(_0x4bd72b,null));}; \ No newline at end of file +var _0xc4b9=['hasOwnProperty','getAnyConditions','order','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','end','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','include','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne'];(function(_0x15d1aa,_0x4fadfb){var _0x5e61ba=function(_0x2aed6b){while(--_0x2aed6b){_0x15d1aa['push'](_0x15d1aa['shift']());}};_0x5e61ba(++_0x4fadfb);}(_0xc4b9,0x127));var _0x9c4b=function(_0x3622c3,_0x593143){_0x3622c3=_0x3622c3-0x0;var _0x4237d5=_0xc4b9[_0x3622c3];return _0x4237d5;};'use strict';var emlformat=require(_0x9c4b('0x0'));var rimraf=require(_0x9c4b('0x1'));var zipdir=require(_0x9c4b('0x2'));var jsonpatch=require(_0x9c4b('0x3'));var rp=require(_0x9c4b('0x4'));var moment=require(_0x9c4b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c4b('0x6'));var path=require(_0x9c4b('0x7'));var sox=require(_0x9c4b('0x8'));var csv=require(_0x9c4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c4b('0xa'));var _=require(_0x9c4b('0xb'));var squel=require('squel');var crypto=require(_0x9c4b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9c4b('0xd'));var toCsv=require(_0x9c4b('0x9'));var querystring=require(_0x9c4b('0xe'));var Papa=require(_0x9c4b('0xf'));var Redis=require(_0x9c4b('0x10'));var authService=require(_0x9c4b('0x11'));var qs=require(_0x9c4b('0x12'));var as=require(_0x9c4b('0x13'));var hardwareService=require(_0x9c4b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9c4b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9c4b('0x16'));var db=require(_0x9c4b('0x17'))['db'];function respondWithStatusCode(_0x359788,_0x3e439c){_0x3e439c=_0x3e439c||0xcc;return function(_0x2305cb){if(_0x2305cb){return _0x359788['sendStatus'](_0x3e439c);}return _0x359788['status'](_0x3e439c)['end']();};}function respondWithResult(_0x360bea,_0x525a8e){_0x525a8e=_0x525a8e||0xc8;return function(_0x2f6efd){if(_0x2f6efd){return _0x360bea[_0x9c4b('0x18')](_0x525a8e)[_0x9c4b('0x19')](_0x2f6efd);}};}function respondWithFilteredResult(_0x423361,_0x1c5652){return function(_0x3aba58){if(_0x3aba58){var _0x48c79f=typeof _0x1c5652[_0x9c4b('0x1a')]===_0x9c4b('0x1b')&&typeof _0x1c5652['limit']===_0x9c4b('0x1b');var _0x1843db=_0x3aba58[_0x9c4b('0x1c')];var _0x5843f2=_0x48c79f?0x0:_0x1c5652['offset'];var _0x25ed5a=_0x48c79f?_0x3aba58[_0x9c4b('0x1c')]:_0x1c5652[_0x9c4b('0x1a')]+_0x1c5652[_0x9c4b('0x1d')];var _0x533f15;if(_0x25ed5a>=_0x1843db){_0x25ed5a=_0x1843db;_0x533f15=0xc8;}else{_0x533f15=0xce;}_0x423361[_0x9c4b('0x18')](_0x533f15);return _0x423361[_0x9c4b('0x1e')](_0x9c4b('0x1f'),_0x5843f2+'-'+_0x25ed5a+'/'+_0x1843db)['json'](_0x3aba58);}return null;};}function patchUpdates(_0x10947b){return function(_0x1ca9e2){try{jsonpatch[_0x9c4b('0x20')](_0x1ca9e2,_0x10947b,!![]);}catch(_0x4caba7){return BPromise[_0x9c4b('0x21')](_0x4caba7);}return _0x1ca9e2[_0x9c4b('0x22')]();};}function saveUpdates(_0xb68214,_0x196083){return function(_0x341dea){if(_0x341dea){return _0x341dea[_0x9c4b('0x23')](_0xb68214)[_0x9c4b('0x24')](function(_0x5191fa){return _0x5191fa;});}return null;};}function removeEntity(_0x56fd21,_0x2a5ff1){return function(_0xb50fba){if(_0xb50fba){return _0xb50fba['destroy']()[_0x9c4b('0x24')](function(){var _0x3fa669=_0xb50fba[_0x9c4b('0x25')]({'plain':!![]});var _0x1ba1eb='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x1ba1eb,'resourceId':_0x3fa669['id']}})[_0x9c4b('0x24')](function(){return _0xb50fba;});})[_0x9c4b('0x24')](function(){_0x56fd21['status'](0xcc)[_0x9c4b('0x26')]();});}};}function handleEntityNotFound(_0x14e244,_0x10b7ef){return function(_0x28ef5a){if(!_0x28ef5a){_0x14e244[_0x9c4b('0x27')](0x194);}return _0x28ef5a;};}function handleError(_0xb01181,_0x203c15){_0x203c15=_0x203c15||0x1f4;return function(_0x346ceb){logger[_0x9c4b('0x28')](_0x346ceb[_0x9c4b('0x29')]);if(_0x346ceb[_0x9c4b('0x2a')]){delete _0x346ceb[_0x9c4b('0x2a')];}_0xb01181['status'](_0x203c15)[_0x9c4b('0x2b')](_0x346ceb);};}exports[_0x9c4b('0x2c')]=function(_0x5722bd,_0x421260){var _0x1f9998={},_0x112bf3={},_0x5026e1={'count':0x0,'rows':[]};var _0x1133a0=_[_0x9c4b('0x2d')](db[_0x9c4b('0x2e')][_0x9c4b('0x2f')],function(_0x473243){return{'name':_0x473243[_0x9c4b('0x30')],'type':_0x473243[_0x9c4b('0x31')][_0x9c4b('0x32')]};});_0x112bf3['model']=_[_0x9c4b('0x2d')](_0x1133a0,'name');_0x112bf3[_0x9c4b('0x33')]=_[_0x9c4b('0x34')](_0x5722bd['query']);_0x112bf3[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x112bf3[_0x9c4b('0x37')],_0x112bf3['query']);_0x1f9998['attributes']=_['intersection'](_0x112bf3[_0x9c4b('0x37')],qs[_0x9c4b('0x38')](_0x5722bd[_0x9c4b('0x33')]['fields']));_0x1f9998[_0x9c4b('0x39')]=_0x1f9998[_0x9c4b('0x39')][_0x9c4b('0x3a')]?_0x1f9998[_0x9c4b('0x39')]:_0x112bf3[_0x9c4b('0x37')];if(!_0x5722bd['query']['hasOwnProperty'](_0x9c4b('0x3b'))){_0x1f9998[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x5722bd[_0x9c4b('0x33')][_0x9c4b('0x1d')]);_0x1f9998[_0x9c4b('0x1a')]=qs['offset'](_0x5722bd['query'][_0x9c4b('0x1a')]);}_0x1f9998['order']=qs['sort'](_0x5722bd[_0x9c4b('0x33')][_0x9c4b('0x3c')]);_0x1f9998[_0x9c4b('0x3d')]=qs[_0x9c4b('0x35')](_[_0x9c4b('0x3e')](_0x5722bd[_0x9c4b('0x33')],_0x112bf3[_0x9c4b('0x35')]),_0x1133a0);if(_0x5722bd[_0x9c4b('0x33')][_0x9c4b('0x3f')]){_0x1f9998[_0x9c4b('0x3d')]=_[_0x9c4b('0x40')](_0x1f9998[_0x9c4b('0x3d')],{'$or':_[_0x9c4b('0x2d')](_0x1133a0,function(_0x3e36e7){if(_0x3e36e7['type']!=='VIRTUAL'){var _0x1783f2={};_0x1783f2[_0x3e36e7[_0x9c4b('0x2a')]]={'$like':'%'+_0x5722bd[_0x9c4b('0x33')][_0x9c4b('0x3f')]+'%'};return _0x1783f2;}})});}_0x1f9998=_[_0x9c4b('0x40')]({},_0x1f9998,_0x5722bd['options']);var _0x311f90={'where':_0x1f9998[_0x9c4b('0x3d')]};return db['Trigger'][_0x9c4b('0x1c')](_0x311f90)[_0x9c4b('0x24')](function(_0x31e683){_0x5026e1[_0x9c4b('0x1c')]=_0x31e683;if(_0x5722bd['query']['includeAll']){_0x1f9998[_0x9c4b('0x41')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x1f9998);})[_0x9c4b('0x24')](function(_0x57f238){_0x5026e1['rows']=_0x57f238;return _0x5026e1;})[_0x9c4b('0x24')](respondWithFilteredResult(_0x421260,_0x1f9998))[_0x9c4b('0x42')](handleError(_0x421260,null));};exports[_0x9c4b('0x43')]=function(_0x9e7066,_0x48f5da){var _0x45abd7={'raw':![],'where':{'id':_0x9e7066[_0x9c4b('0x44')]['id']}},_0x1189f0={};_0x1189f0[_0x9c4b('0x37')]=_[_0x9c4b('0x34')](db[_0x9c4b('0x2e')][_0x9c4b('0x2f')]);_0x1189f0[_0x9c4b('0x33')]=_[_0x9c4b('0x34')](_0x9e7066[_0x9c4b('0x33')]);_0x1189f0['filters']=_['intersection'](_0x1189f0[_0x9c4b('0x37')],_0x1189f0['query']);_0x45abd7[_0x9c4b('0x39')]=_[_0x9c4b('0x36')](_0x1189f0[_0x9c4b('0x37')],qs['fields'](_0x9e7066[_0x9c4b('0x33')][_0x9c4b('0x38')]));_0x45abd7['attributes']=_0x45abd7[_0x9c4b('0x39')][_0x9c4b('0x3a')]?_0x45abd7[_0x9c4b('0x39')]:_0x1189f0[_0x9c4b('0x37')];if(_0x9e7066[_0x9c4b('0x33')]['includeAll']){_0x45abd7[_0x9c4b('0x41')]=[{'all':!![]}];}_0x45abd7=_[_0x9c4b('0x40')]({},_0x45abd7,_0x9e7066[_0x9c4b('0x45')]);return db[_0x9c4b('0x2e')][_0x9c4b('0x46')](_0x45abd7)[_0x9c4b('0x24')](handleEntityNotFound(_0x48f5da,null))['then'](respondWithResult(_0x48f5da,null))[_0x9c4b('0x42')](handleError(_0x48f5da,null));};exports['create']=function(_0x17380e,_0x4ae367){return db[_0x9c4b('0x2e')][_0x9c4b('0x47')](_0x17380e[_0x9c4b('0x48')],{})[_0x9c4b('0x24')](function(_0x4c3421){var _0x455089=_0x17380e[_0x9c4b('0x49')][_0x9c4b('0x25')]({'plain':!![]});if(!_0x455089)throw new Error(_0x9c4b('0x4a'));if(_0x455089[_0x9c4b('0x4b')]===_0x9c4b('0x49')){var _0x16eb34=_0x4c3421[_0x9c4b('0x25')]({'plain':!![]});var _0x29cacb='Triggers';return db[_0x9c4b('0x4c')][_0x9c4b('0x46')]({'where':{'name':_0x29cacb,'userProfileId':_0x455089[_0x9c4b('0x4d')]},'raw':!![]})[_0x9c4b('0x24')](function(_0x41c637){if(_0x41c637&&_0x41c637[_0x9c4b('0x4e')]===0x0){return db[_0x9c4b('0x4f')][_0x9c4b('0x47')]({'name':_0x16eb34[_0x9c4b('0x2a')],'resourceId':_0x16eb34['id'],'type':_0x41c637['name'],'sectionId':_0x41c637['id']},{})[_0x9c4b('0x24')](function(){return _0x4c3421;});}else{return _0x4c3421;}})[_0x9c4b('0x42')](function(_0x37fb54){logger[_0x9c4b('0x28')](_0x9c4b('0x50'),_0x37fb54);throw _0x37fb54;});}return _0x4c3421;})['then'](respondWithResult(_0x4ae367,0xc9))[_0x9c4b('0x42')](handleError(_0x4ae367,null));};exports['update']=function(_0xfeb036,_0x17ec47){if(_0xfeb036['body']['id']){delete _0xfeb036[_0x9c4b('0x48')]['id'];}return db[_0x9c4b('0x2e')][_0x9c4b('0x46')]({'where':{'id':_0xfeb036['params']['id']}})[_0x9c4b('0x24')](handleEntityNotFound(_0x17ec47,null))[_0x9c4b('0x24')](saveUpdates(_0xfeb036[_0x9c4b('0x48')],null))['then'](respondWithResult(_0x17ec47,null))[_0x9c4b('0x42')](handleError(_0x17ec47,null));};exports[_0x9c4b('0x51')]=function(_0x1ede39,_0x219ff9){return db[_0x9c4b('0x2e')][_0x9c4b('0x46')]({'where':{'id':_0x1ede39[_0x9c4b('0x44')]['id']}})[_0x9c4b('0x24')](handleEntityNotFound(_0x219ff9,null))['then'](removeEntity(_0x219ff9,null))[_0x9c4b('0x42')](handleError(_0x219ff9,null));};exports[_0x9c4b('0x52')]=function(_0x1b2256,_0x3f1678,_0x14d438){if(_0x1b2256['body']['id']){delete _0x1b2256[_0x9c4b('0x48')]['id'];}return db[_0x9c4b('0x2e')][_0x9c4b('0x46')]({'where':{'id':_0x1b2256['params']['id']}})['then'](handleEntityNotFound(_0x3f1678,null))[_0x9c4b('0x24')](function(_0x254511){if(_0x254511){_0x1b2256[_0x9c4b('0x48')][_0x9c4b('0x53')]=_0x254511['id'];return db[_0x9c4b('0x54')]['create'](_0x1b2256[_0x9c4b('0x48')]);}})[_0x9c4b('0x24')](respondWithResult(_0x3f1678,null))[_0x9c4b('0x42')](handleError(_0x3f1678,null));};exports[_0x9c4b('0x55')]=function(_0x5bcc13,_0x295799,_0x43ca02){if(_0x5bcc13[_0x9c4b('0x48')]['id']){delete _0x5bcc13[_0x9c4b('0x48')]['id'];}return db[_0x9c4b('0x2e')][_0x9c4b('0x46')]({'where':{'id':_0x5bcc13['params']['id']}})[_0x9c4b('0x24')](handleEntityNotFound(_0x295799,null))['then'](function(_0x35ddfa){if(_0x35ddfa){_0x5bcc13[_0x9c4b('0x48')][_0x9c4b('0x56')]=_0x35ddfa['id'];return db['Condition'][_0x9c4b('0x47')](_0x5bcc13[_0x9c4b('0x48')]);}})[_0x9c4b('0x24')](respondWithResult(_0x295799,null))[_0x9c4b('0x42')](handleError(_0x295799,null));};exports[_0x9c4b('0x57')]=function(_0x22605c,_0xf874fb,_0x2fdaed){var _0x5bf112={};var _0x2f76d6={};var _0x20ac4b;var _0x4eb924;return db[_0x9c4b('0x2e')][_0x9c4b('0x58')]({'where':{'id':_0x22605c[_0x9c4b('0x44')]['id']}})[_0x9c4b('0x24')](handleEntityNotFound(_0xf874fb,null))[_0x9c4b('0x24')](function(_0x3b06cd){if(_0x3b06cd){_0x20ac4b=_0x3b06cd;_0x2f76d6[_0x9c4b('0x37')]=_[_0x9c4b('0x34')](db[_0x9c4b('0x54')][_0x9c4b('0x2f')]);_0x2f76d6[_0x9c4b('0x33')]=_[_0x9c4b('0x34')](_0x22605c['query']);_0x2f76d6[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x2f76d6[_0x9c4b('0x37')],_0x2f76d6[_0x9c4b('0x33')]);_0x5bf112['attributes']=_[_0x9c4b('0x36')](_0x2f76d6[_0x9c4b('0x37')],qs[_0x9c4b('0x38')](_0x22605c[_0x9c4b('0x33')][_0x9c4b('0x38')]));_0x5bf112['attributes']=_0x5bf112['attributes'][_0x9c4b('0x3a')]?_0x5bf112[_0x9c4b('0x39')]:_0x2f76d6[_0x9c4b('0x37')];_0x5bf112['order']=qs[_0x9c4b('0x3c')](_0x22605c[_0x9c4b('0x33')][_0x9c4b('0x3c')]);_0x5bf112['where']=qs[_0x9c4b('0x35')](_[_0x9c4b('0x3e')](_0x22605c['query'],_0x2f76d6['filters']));if(_0x22605c[_0x9c4b('0x33')][_0x9c4b('0x3f')]){_0x5bf112['where']=_[_0x9c4b('0x40')](_0x5bf112['where'],{'$or':_[_0x9c4b('0x2d')](_0x5bf112[_0x9c4b('0x39')],function(_0x1eb22a){var _0x432298={};_0x432298[_0x1eb22a]={'$like':'%'+_0x22605c[_0x9c4b('0x33')][_0x9c4b('0x3f')]+'%'};return _0x432298;})});}_0x5bf112=_[_0x9c4b('0x40')]({},_0x5bf112,_0x22605c['options']);return _0x20ac4b[_0x9c4b('0x57')](_0x5bf112);}})['then'](function(_0xebc158){if(_0xebc158){_0x4eb924=_0xebc158['length'];if(!_0x22605c['query'][_0x9c4b('0x59')](_0x9c4b('0x3b'))){_0x5bf112[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x22605c['query'][_0x9c4b('0x1d')]);_0x5bf112['offset']=qs[_0x9c4b('0x1a')](_0x22605c[_0x9c4b('0x33')][_0x9c4b('0x1a')]);}return _0x20ac4b[_0x9c4b('0x57')](_0x5bf112);}})[_0x9c4b('0x24')](function(_0x45ac9a){if(_0x45ac9a){return _0x45ac9a?{'count':_0x4eb924,'rows':_0x45ac9a}:null;}})['then'](respondWithResult(_0xf874fb,null))['catch'](handleError(_0xf874fb,null));};exports[_0x9c4b('0x5a')]=function(_0x19a90e,_0x20f55d,_0x4f03b8){var _0x45efae={};var _0x45d6d5={};var _0xd5dbb7;var _0x482f5f;return db['Trigger']['findOne']({'where':{'id':_0x19a90e[_0x9c4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x20f55d,null))[_0x9c4b('0x24')](function(_0x2ff6bf){if(_0x2ff6bf){_0xd5dbb7=_0x2ff6bf;_0x45d6d5[_0x9c4b('0x37')]=_[_0x9c4b('0x34')](db[_0x9c4b('0x54')][_0x9c4b('0x2f')]);_0x45d6d5[_0x9c4b('0x33')]=_['keys'](_0x19a90e['query']);_0x45d6d5[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x45d6d5['model'],_0x45d6d5[_0x9c4b('0x33')]);_0x45efae[_0x9c4b('0x39')]=_[_0x9c4b('0x36')](_0x45d6d5[_0x9c4b('0x37')],qs[_0x9c4b('0x38')](_0x19a90e['query']['fields']));_0x45efae[_0x9c4b('0x39')]=_0x45efae['attributes'][_0x9c4b('0x3a')]?_0x45efae[_0x9c4b('0x39')]:_0x45d6d5[_0x9c4b('0x37')];_0x45efae[_0x9c4b('0x5b')]=qs[_0x9c4b('0x3c')](_0x19a90e[_0x9c4b('0x33')]['sort']);_0x45efae[_0x9c4b('0x3d')]=qs[_0x9c4b('0x35')](_['pick'](_0x19a90e[_0x9c4b('0x33')],_0x45d6d5[_0x9c4b('0x35')]));if(_0x19a90e['query'][_0x9c4b('0x3f')]){_0x45efae[_0x9c4b('0x3d')]=_[_0x9c4b('0x40')](_0x45efae['where'],{'$or':_['map'](_0x45efae[_0x9c4b('0x39')],function(_0x23947a){var _0x213945={};_0x213945[_0x23947a]={'$like':'%'+_0x19a90e['query'][_0x9c4b('0x3f')]+'%'};return _0x213945;})});}_0x45efae=_[_0x9c4b('0x40')]({},_0x45efae,_0x19a90e[_0x9c4b('0x45')]);return _0xd5dbb7[_0x9c4b('0x5a')](_0x45efae);}})[_0x9c4b('0x24')](function(_0x52407a){if(_0x52407a){_0x482f5f=_0x52407a[_0x9c4b('0x3a')];if(!_0x19a90e[_0x9c4b('0x33')][_0x9c4b('0x59')](_0x9c4b('0x3b'))){_0x45efae[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x19a90e['query'][_0x9c4b('0x1d')]);_0x45efae['offset']=qs[_0x9c4b('0x1a')](_0x19a90e[_0x9c4b('0x33')]['offset']);}return _0xd5dbb7[_0x9c4b('0x5a')](_0x45efae);}})['then'](function(_0x3dd653){if(_0x3dd653){return _0x3dd653?{'count':_0x482f5f,'rows':_0x3dd653}:null;}})['then'](respondWithResult(_0x20f55d,null))[_0x9c4b('0x42')](handleError(_0x20f55d,null));};exports[_0x9c4b('0x5c')]=function(_0x29d2ff,_0x310ec0,_0x42a90c){if(_0x29d2ff['body']['id']){delete _0x29d2ff['body']['id'];}return db['Trigger'][_0x9c4b('0x46')]({'where':{'id':_0x29d2ff['params']['id']}})['then'](handleEntityNotFound(_0x310ec0,null))[_0x9c4b('0x24')](function(_0x5d3e33){if(_0x5d3e33){_0x29d2ff['body'][_0x9c4b('0x5d')]=_0x5d3e33['id'];return db['Action']['create'](_0x29d2ff[_0x9c4b('0x48')]);}})[_0x9c4b('0x24')](respondWithResult(_0x310ec0,null))[_0x9c4b('0x42')](handleError(_0x310ec0,null));};exports[_0x9c4b('0x5e')]=function(_0xab2534,_0x503f6b,_0x438890){var _0x866d10={};var _0x9b17a9={};var _0xae9731;var _0x400d7a;return db[_0x9c4b('0x2e')][_0x9c4b('0x58')]({'where':{'id':_0xab2534[_0x9c4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x503f6b,null))['then'](function(_0x3e51d8){if(_0x3e51d8){_0xae9731=_0x3e51d8;_0x9b17a9[_0x9c4b('0x37')]=_[_0x9c4b('0x34')](db[_0x9c4b('0x5f')]['rawAttributes']);_0x9b17a9[_0x9c4b('0x33')]=_[_0x9c4b('0x34')](_0xab2534[_0x9c4b('0x33')]);_0x9b17a9[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x9b17a9[_0x9c4b('0x37')],_0x9b17a9[_0x9c4b('0x33')]);_0x866d10[_0x9c4b('0x39')]=_[_0x9c4b('0x36')](_0x9b17a9[_0x9c4b('0x37')],qs['fields'](_0xab2534[_0x9c4b('0x33')]['fields']));_0x866d10[_0x9c4b('0x39')]=_0x866d10[_0x9c4b('0x39')][_0x9c4b('0x3a')]?_0x866d10['attributes']:_0x9b17a9['model'];_0x866d10[_0x9c4b('0x5b')]=qs[_0x9c4b('0x3c')](_0xab2534[_0x9c4b('0x33')][_0x9c4b('0x3c')]);_0x866d10[_0x9c4b('0x3d')]=qs[_0x9c4b('0x35')](_[_0x9c4b('0x3e')](_0xab2534[_0x9c4b('0x33')],_0x9b17a9[_0x9c4b('0x35')]));if(_0xab2534[_0x9c4b('0x33')]['filter']){_0x866d10[_0x9c4b('0x3d')]=_[_0x9c4b('0x40')](_0x866d10[_0x9c4b('0x3d')],{'$or':_[_0x9c4b('0x2d')](_0x866d10[_0x9c4b('0x39')],function(_0x59c462){var _0x3e6ead={};_0x3e6ead[_0x59c462]={'$like':'%'+_0xab2534[_0x9c4b('0x33')][_0x9c4b('0x3f')]+'%'};return _0x3e6ead;})});}_0x866d10=_[_0x9c4b('0x40')]({},_0x866d10,_0xab2534[_0x9c4b('0x45')]);return _0xae9731[_0x9c4b('0x5e')](_0x866d10);}})['then'](function(_0x4fb61a){if(_0x4fb61a){_0x400d7a=_0x4fb61a[_0x9c4b('0x3a')];if(!_0xab2534[_0x9c4b('0x33')][_0x9c4b('0x59')]('nolimit')){_0x866d10[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0xab2534[_0x9c4b('0x33')][_0x9c4b('0x1d')]);_0x866d10[_0x9c4b('0x1a')]=qs['offset'](_0xab2534[_0x9c4b('0x33')][_0x9c4b('0x1a')]);}return _0xae9731[_0x9c4b('0x5e')](_0x866d10);}})[_0x9c4b('0x24')](function(_0x3c909c){if(_0x3c909c){return _0x3c909c?{'count':_0x400d7a,'rows':_0x3c909c}:null;}})[_0x9c4b('0x24')](respondWithResult(_0x503f6b,null))['catch'](handleError(_0x503f6b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ae06e4f..5bd49b5 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 _0x2830=['rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b2e06,_0xfb05f){var _0x4c5424=function(_0x26aba6){while(--_0x26aba6){_0x1b2e06['push'](_0x1b2e06['shift']());}};_0x4c5424(++_0xfb05f);}(_0x2830,0x117));var _0x0283=function(_0x211df5,_0x11a49f){_0x211df5=_0x211df5-0x0;var _0x13d513=_0x2830[_0x211df5];return _0x13d513;};'use strict';var _=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var logger=require(_0x0283('0x2'))(_0x0283('0x3'));var moment=require(_0x0283('0x4'));var BPromise=require(_0x0283('0x5'));var rp=require(_0x0283('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0283('0x7'));var config=require('../../config/environment');var attributes=require(_0x0283('0x8'));module[_0x0283('0x9')]=function(_0xc56cd7,_0x2125db){return _0xc56cd7[_0x0283('0xa')](_0x0283('0xb'),attributes,{'tableName':_0x0283('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdab2=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'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 698029d..926086d 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 _0x7f37=['attributes','debug','catch','raw','where','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','info','result','GetTrigger','Trigger','findAll','options','limit','include','map','model'];(function(_0x4b0625,_0x4bcba3){var _0x3d7ce8=function(_0x4fe2ae){while(--_0x4fe2ae){_0x4b0625['push'](_0x4b0625['shift']());}};_0x3d7ce8(++_0x4bcba3);}(_0x7f37,0x6f));var _0x77f3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f37[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x77f3('0x0'));var util=require(_0x77f3('0x1'));var moment=require(_0x77f3('0x2'));var BPromise=require(_0x77f3('0x3'));var rs=require(_0x77f3('0x4'));var fs=require('fs');var Redis=require(_0x77f3('0x5'));var db=require(_0x77f3('0x6'))['db'];var utils=require(_0x77f3('0x7'));var logger=require('../../config/logger')(_0x77f3('0x8'));var config=require(_0x77f3('0x9'));var jayson=require(_0x77f3('0xa'));var client=jayson['client'][_0x77f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139366,_0x395e8c,_0xfec0fc){return new BPromise(function(_0x16c69f,_0x3d58b9){return client[_0x77f3('0xc')](_0x139366,_0xfec0fc)['then'](function(_0x3cc462){logger['info']('Trigger,\x20%s,\x20%s',_0x395e8c,'request\x20sent');logger['debug'](_0x77f3('0xd'),_0x395e8c,_0x77f3('0xe'),JSON[_0x77f3('0xf')](_0x3cc462));if(_0x3cc462[_0x77f3('0x10')]){if(_0x3cc462[_0x77f3('0x10')]['code']===0x1f4){logger[_0x77f3('0x10')](_0x77f3('0x11'),_0x395e8c,_0x3cc462[_0x77f3('0x10')]['message']);return _0x3d58b9(_0x3cc462[_0x77f3('0x10')][_0x77f3('0x12')]);}logger[_0x77f3('0x10')](_0x77f3('0x11'),_0x395e8c,_0x3cc462['error'][_0x77f3('0x12')]);return _0x16c69f(_0x3cc462[_0x77f3('0x10')][_0x77f3('0x12')]);}else{logger[_0x77f3('0x13')](_0x77f3('0x11'),_0x395e8c,_0x77f3('0xe'));_0x16c69f(_0x3cc462[_0x77f3('0x14')][_0x77f3('0x12')]);}})['catch'](function(_0x80781a){logger['error'](_0x77f3('0x11'),_0x395e8c,_0x80781a);_0x3d58b9(_0x80781a);});});}exports[_0x77f3('0x15')]=function(_0x3667b8){var _0x3ff41d=this;return new Promise(function(_0x4de32d,_0x9d2434){return db[_0x77f3('0x16')][_0x77f3('0x17')]({'raw':_0x3667b8[_0x77f3('0x18')]?_0x3667b8['options']['raw']===undefined?!![]:![]:!![],'where':_0x3667b8[_0x77f3('0x18')]?_0x3667b8[_0x77f3('0x18')]['where']||null:null,'attributes':_0x3667b8[_0x77f3('0x18')]?_0x3667b8['options']['attributes']||null:null,'limit':_0x3667b8[_0x77f3('0x18')]?_0x3667b8[_0x77f3('0x18')][_0x77f3('0x19')]||null:null,'include':_0x3667b8['options']?_0x3667b8[_0x77f3('0x18')][_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x3667b8[_0x77f3('0x18')][_0x77f3('0x1a')],function(_0x5579c6){return{'model':db[_0x5579c6[_0x77f3('0x1c')]],'as':_0x5579c6['as'],'attributes':_0x5579c6[_0x77f3('0x1d')],'include':_0x5579c6['include']?_[_0x77f3('0x1b')](_0x5579c6[_0x77f3('0x1a')],function(_0x752e59){return{'model':db[_0x752e59['model']],'as':_0x752e59['as'],'attributes':_0x752e59[_0x77f3('0x1d')],'include':_0x752e59['include']?_[_0x77f3('0x1b')](_0x752e59['include'],function(_0x415604){return{'model':db[_0x415604[_0x77f3('0x1c')]],'as':_0x415604['as'],'attributes':_0x415604[_0x77f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b5119){logger[_0x77f3('0x13')](_0x77f3('0x15'),_0x3667b8);logger[_0x77f3('0x1e')](_0x77f3('0x15'),_0x3667b8,JSON['stringify'](_0x5b5119));_0x4de32d(_0x5b5119);})[_0x77f3('0x1f')](function(_0x3a1799){logger[_0x77f3('0x10')]('GetTrigger',_0x3a1799[_0x77f3('0x12')],_0x3667b8);_0x9d2434(_0x3ff41d[_0x77f3('0x10')](0x1f4,_0x3a1799[_0x77f3('0x12')]));});});};exports['ShowTrigger']=function(_0x480947){var _0x4594c9=this;return new Promise(function(_0x3eb5f5,_0x2e7c18){return db[_0x77f3('0x16')]['find']({'raw':_0x480947['options']?_0x480947['options'][_0x77f3('0x20')]===undefined?!![]:![]:!![],'where':_0x480947['options']?_0x480947[_0x77f3('0x18')][_0x77f3('0x21')]||null:null,'attributes':_0x480947[_0x77f3('0x18')]?_0x480947['options'][_0x77f3('0x1d')]||null:null,'include':_0x480947[_0x77f3('0x18')]?_0x480947['options'][_0x77f3('0x1a')]?_['map'](_0x480947['options'][_0x77f3('0x1a')],function(_0x22dabb){return{'model':db[_0x22dabb[_0x77f3('0x1c')]],'as':_0x22dabb['as'],'attributes':_0x22dabb['attributes'],'include':_0x22dabb[_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x22dabb[_0x77f3('0x1a')],function(_0x4307f0){return{'model':db[_0x4307f0['model']],'as':_0x4307f0['as'],'attributes':_0x4307f0[_0x77f3('0x1d')],'include':_0x4307f0[_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x4307f0[_0x77f3('0x1a')],function(_0x4eff1d){return{'model':db[_0x4eff1d[_0x77f3('0x1c')]],'as':_0x4eff1d['as'],'attributes':_0x4eff1d[_0x77f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x170981){logger[_0x77f3('0x13')]('ShowTrigger',_0x480947);logger[_0x77f3('0x1e')](_0x77f3('0x22'),_0x480947,JSON[_0x77f3('0xf')](_0x170981));_0x3eb5f5(_0x170981);})['catch'](function(_0x3ab8ba){logger[_0x77f3('0x10')](_0x77f3('0x22'),_0x3ab8ba['message'],_0x480947);_0x2e7c18(_0x4594c9[_0x77f3('0x10')](0x1f4,_0x3ab8ba[_0x77f3('0x12')]));});});}; \ No newline at end of file +var _0xaba9=['attributes','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetTrigger','findAll','raw','options','where','map','include','model'];(function(_0x5bf840,_0x9fc2ab){var _0x4f4355=function(_0x5bef49){while(--_0x5bef49){_0x5bf840['push'](_0x5bf840['shift']());}};_0x4f4355(++_0x9fc2ab);}(_0xaba9,0xad));var _0x9aba=function(_0x51b15f,_0x26b98d){_0x51b15f=_0x51b15f-0x0;var _0x2361ce=_0xaba9[_0x51b15f];return _0x2361ce;};'use strict';var _=require(_0x9aba('0x0'));var util=require(_0x9aba('0x1'));var moment=require(_0x9aba('0x2'));var BPromise=require(_0x9aba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aba('0x4'));var db=require(_0x9aba('0x5'))['db'];var utils=require(_0x9aba('0x6'));var logger=require(_0x9aba('0x7'))(_0x9aba('0x8'));var config=require('../../config/environment');var jayson=require(_0x9aba('0x9'));var client=jayson[_0x9aba('0xa')][_0x9aba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57b28f,_0x4a352c,_0x404657){return new BPromise(function(_0x34f677,_0xeaf7cc){return client['request'](_0x57b28f,_0x404657)[_0x9aba('0xc')](function(_0x310c4b){logger[_0x9aba('0xd')](_0x9aba('0xe'),_0x4a352c,'request\x20sent');logger[_0x9aba('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4a352c,_0x9aba('0x10'),JSON[_0x9aba('0x11')](_0x310c4b));if(_0x310c4b[_0x9aba('0x12')]){if(_0x310c4b[_0x9aba('0x12')][_0x9aba('0x13')]===0x1f4){logger[_0x9aba('0x12')]('Trigger,\x20%s,\x20%s',_0x4a352c,_0x310c4b[_0x9aba('0x12')][_0x9aba('0x14')]);return _0xeaf7cc(_0x310c4b[_0x9aba('0x12')][_0x9aba('0x14')]);}logger[_0x9aba('0x12')](_0x9aba('0xe'),_0x4a352c,_0x310c4b[_0x9aba('0x12')][_0x9aba('0x14')]);return _0x34f677(_0x310c4b['error']['message']);}else{logger[_0x9aba('0xd')]('Trigger,\x20%s,\x20%s',_0x4a352c,_0x9aba('0x10'));_0x34f677(_0x310c4b[_0x9aba('0x15')][_0x9aba('0x14')]);}})[_0x9aba('0x16')](function(_0x3b8476){logger[_0x9aba('0x12')](_0x9aba('0xe'),_0x4a352c,_0x3b8476);_0xeaf7cc(_0x3b8476);});});}exports[_0x9aba('0x17')]=function(_0x52cb27){var _0x3fa676=this;return new Promise(function(_0x11fed5,_0x496b40){return db['Trigger'][_0x9aba('0x18')]({'raw':_0x52cb27['options']?_0x52cb27['options'][_0x9aba('0x19')]===undefined?!![]:![]:!![],'where':_0x52cb27['options']?_0x52cb27[_0x9aba('0x1a')][_0x9aba('0x1b')]||null:null,'attributes':_0x52cb27['options']?_0x52cb27[_0x9aba('0x1a')]['attributes']||null:null,'limit':_0x52cb27[_0x9aba('0x1a')]?_0x52cb27['options']['limit']||null:null,'include':_0x52cb27[_0x9aba('0x1a')]?_0x52cb27['options']['include']?_[_0x9aba('0x1c')](_0x52cb27[_0x9aba('0x1a')][_0x9aba('0x1d')],function(_0x56ad11){return{'model':db[_0x56ad11[_0x9aba('0x1e')]],'as':_0x56ad11['as'],'attributes':_0x56ad11[_0x9aba('0x1f')],'include':_0x56ad11[_0x9aba('0x1d')]?_[_0x9aba('0x1c')](_0x56ad11[_0x9aba('0x1d')],function(_0x30a4e8){return{'model':db[_0x30a4e8[_0x9aba('0x1e')]],'as':_0x30a4e8['as'],'attributes':_0x30a4e8[_0x9aba('0x1f')],'include':_0x30a4e8[_0x9aba('0x1d')]?_[_0x9aba('0x1c')](_0x30a4e8[_0x9aba('0x1d')],function(_0x496c2e){return{'model':db[_0x496c2e[_0x9aba('0x1e')]],'as':_0x496c2e['as'],'attributes':_0x496c2e[_0x9aba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9aba('0xc')](function(_0xc6194c){logger[_0x9aba('0xd')](_0x9aba('0x17'),_0x52cb27);logger[_0x9aba('0xf')](_0x9aba('0x17'),_0x52cb27,JSON['stringify'](_0xc6194c));_0x11fed5(_0xc6194c);})['catch'](function(_0x1f4f57){logger[_0x9aba('0x12')](_0x9aba('0x17'),_0x1f4f57[_0x9aba('0x14')],_0x52cb27);_0x496b40(_0x3fa676[_0x9aba('0x12')](0x1f4,_0x1f4f57['message']));});});};exports[_0x9aba('0x20')]=function(_0x454ff8){var _0x27d174=this;return new Promise(function(_0x54f8a9,_0x1c2185){return db['Trigger'][_0x9aba('0x21')]({'raw':_0x454ff8[_0x9aba('0x1a')]?_0x454ff8[_0x9aba('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x454ff8['options']?_0x454ff8['options'][_0x9aba('0x1b')]||null:null,'attributes':_0x454ff8[_0x9aba('0x1a')]?_0x454ff8['options'][_0x9aba('0x1f')]||null:null,'include':_0x454ff8[_0x9aba('0x1a')]?_0x454ff8[_0x9aba('0x1a')][_0x9aba('0x1d')]?_[_0x9aba('0x1c')](_0x454ff8[_0x9aba('0x1a')][_0x9aba('0x1d')],function(_0x250fa5){return{'model':db[_0x250fa5['model']],'as':_0x250fa5['as'],'attributes':_0x250fa5['attributes'],'include':_0x250fa5[_0x9aba('0x1d')]?_[_0x9aba('0x1c')](_0x250fa5[_0x9aba('0x1d')],function(_0x19212a){return{'model':db[_0x19212a[_0x9aba('0x1e')]],'as':_0x19212a['as'],'attributes':_0x19212a[_0x9aba('0x1f')],'include':_0x19212a[_0x9aba('0x1d')]?_['map'](_0x19212a['include'],function(_0x5bc16a){return{'model':db[_0x5bc16a[_0x9aba('0x1e')]],'as':_0x5bc16a['as'],'attributes':_0x5bc16a[_0x9aba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9aba('0xc')](function(_0x4e5328){logger['info'](_0x9aba('0x20'),_0x454ff8);logger[_0x9aba('0xf')](_0x9aba('0x20'),_0x454ff8,JSON[_0x9aba('0x11')](_0x4e5328));_0x54f8a9(_0x4e5328);})['catch'](function(_0x287fe2){logger[_0x9aba('0x12')]('ShowTrigger',_0x287fe2['message'],_0x454ff8);_0x1c2185(_0x27d174[_0x9aba('0x12')](0x1f4,_0x287fe2['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index b5f898d..ef4c45c 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 _0xa2b5=['post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','/:id/clone','clone'];(function(_0xc7d92f,_0x2f2193){var _0x3a17ea=function(_0x4315de){while(--_0x4315de){_0xc7d92f['push'](_0xc7d92f['shift']());}};_0x3a17ea(++_0x2f2193);}(_0xa2b5,0x1bd));var _0x5a2b=function(_0x58e2bd,_0x3dacea){_0x58e2bd=_0x58e2bd-0x0;var _0x2d0a5b=_0xa2b5[_0x58e2bd];return _0x2d0a5b;};'use strict';var multer=require(_0x5a2b('0x0'));var util=require(_0x5a2b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a2b('0x2'));var router=express[_0x5a2b('0x3')]();var fs_extra=require(_0x5a2b('0x4'));var auth=require(_0x5a2b('0x5'));var interaction=require(_0x5a2b('0x6'));var config=require(_0x5a2b('0x7'));var controller=require(_0x5a2b('0x8'));router[_0x5a2b('0x9')]('/',auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xb')]);router[_0x5a2b('0x9')]('/:id',auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xc')]);router['post'](_0x5a2b('0xd'),auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xe')]);router[_0x5a2b('0xf')]('/',auth['isAuthenticated'](),controller[_0x5a2b('0x10')]);router[_0x5a2b('0x11')](_0x5a2b('0x12'),auth['isAuthenticated'](),controller[_0x5a2b('0x13')]);router[_0x5a2b('0x14')](_0x5a2b('0x12'),auth[_0x5a2b('0xa')](),controller[_0x5a2b('0x15')]);module[_0x5a2b('0x16')]=router; \ No newline at end of file +var _0x396e=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x396e,0x172));var _0xe396=function(_0x314726,_0x2391b7){_0x314726=_0x314726-0x0;var _0x25553f=_0x396e[_0x314726];return _0x25553f;};'use strict';var multer=require(_0xe396('0x0'));var util=require(_0xe396('0x1'));var path=require(_0xe396('0x2'));var timeout=require(_0xe396('0x3'));var express=require('express');var router=express[_0xe396('0x4')]();var fs_extra=require(_0xe396('0x5'));var auth=require(_0xe396('0x6'));var interaction=require(_0xe396('0x7'));var config=require('../../config/environment');var controller=require(_0xe396('0x8'));router[_0xe396('0x9')]('/',auth[_0xe396('0xa')](),controller[_0xe396('0xb')]);router[_0xe396('0x9')](_0xe396('0xc'),auth[_0xe396('0xa')](),controller[_0xe396('0xd')]);router[_0xe396('0xe')](_0xe396('0xf'),auth[_0xe396('0xa')](),controller[_0xe396('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe396('0x11')]);router[_0xe396('0x12')](_0xe396('0xc'),auth['isAuthenticated'](),controller[_0xe396('0x13')]);router[_0xe396('0x14')](_0xe396('0xc'),auth[_0xe396('0xa')](),controller[_0xe396('0x15')]);module[_0xe396('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ad746a7..6cea2ab 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 _0x157c=['dynamic','sequelize','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x51cd5e,_0x162cbe){var _0xa9acd8=function(_0x2606f3){while(--_0x2606f3){_0x51cd5e['push'](_0x51cd5e['shift']());}};_0xa9acd8(++_0x162cbe);}(_0x157c,0x1c3));var _0xc157=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0x157c[_0x3c700f];return _0x1bf773;};'use strict';var Sequelize=require(_0xc157('0x0'));module[_0xc157('0x1')]={'name':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'unique':_0xc157('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc157('0x4')]('friend',_0xc157('0x5'),_0xc157('0x6')),'allowNull':![],'defaultValue':_0xc157('0x7')},'context':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x8'),_0xc157('0x9'),_0xc157('0xa'),'ALLOWED',_0xc157('0xb'),_0xc157('0xc'),_0xc157('0xd'),_0xc157('0xe'))},'deny':{'type':Sequelize[_0xc157('0x2')]},'permit':{'type':Sequelize[_0xc157('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc157('0x2')]},'remotesecret':{'type':Sequelize[_0xc157('0x2')]},'transport':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0xf'),'set':function(_0xfd9d4b){this[_0xc157('0x10')](_0xc157('0x11'),_0xfd9d4b?_0xfd9d4b[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x11'))?this[_0xc157('0x13')](_0xc157('0x11'))[_0xc157('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc157('0x4')]('rfc2833','info',_0xc157('0x15'),_0xc157('0x16'),_0xc157('0x17')),'defaultValue':_0xc157('0x18')},'directmedia':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x1a'),_0xc157('0x1b'),_0xc157('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc157('0x2')]},'directmediadeny':{'type':Sequelize[_0xc157('0x2')]},'nat':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x1d'),'set':function(_0x4c4926){this['setDataValue'](_0xc157('0x1e'),_0x4c4926?_0x4c4926[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x1e'))?this[_0xc157('0x13')](_0xc157('0x1e'))[_0xc157('0x14')](','):null;},'comment':_0xc157('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc157('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc157('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'defaultValue':_0xc157('0x20'),'set':function(_0xbb7aa8){this[_0xc157('0x10')](_0xc157('0x21'),_0xbb7aa8?_0xbb7aa8[_0xc157('0x12')](';'):_0xc157('0x20'));},'get':function(){return this[_0xc157('0x13')](_0xc157('0x21'))?this[_0xc157('0x13')](_0xc157('0x21'))[_0xc157('0x14')](';'):null;},'comment':_0xc157('0x22')},'autoframing':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'insecure':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x23'),'set':function(_0x15def3){this['setDataValue'](_0xc157('0x24'),_0x15def3?_0x15def3[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x24'))?this[_0xc157('0x13')](_0xc157('0x24'))[_0xc157('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc157('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x25'))},'promiscredir':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'accountcode':{'type':Sequelize[_0xc157('0x26')](0xb)},'setvar':{'type':Sequelize[_0xc157('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc157('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no'),'defaultValue':_0xc157('0x19')},'busylevel':{'type':Sequelize[_0xc157('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xc157('0x2')]},'template':{'type':Sequelize[_0xc157('0x2')]},'videosupport':{'type':Sequelize[_0xc157('0x4')]('yes','no',_0xc157('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xc157('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xc157('0x28'),_0xc157('0x29'),_0xc157('0x2a'))},'session_expires':{'type':Sequelize[_0xc157('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xc157('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xc157('0x2b')),'defaultValue':_0xc157('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xc157('0x2')]},'regexten':{'type':Sequelize[_0xc157('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc157('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xc157('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xc157('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc157('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc157('0x2')]},'callbackextension':{'type':Sequelize[_0xc157('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xc157('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xc157('0x2')]},'contactdeny':{'type':Sequelize[_0xc157('0x2')]},'contactacl':{'type':Sequelize[_0xc157('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc157('0x26')](0xb)},'encryption':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'icesupport':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x2c'),_0xc157('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xc157('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc157('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc157('0x2')]},'dtlscipher':{'type':Sequelize[_0xc157('0x2')]},'dtlscafile':{'type':Sequelize[_0xc157('0x2')]},'dtlscapath':{'type':Sequelize[_0xc157('0x2')]},'dtlssetup':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x2e'),_0xc157('0x2f'),_0xc157('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc157('0x2')]},'usereqphone':{'type':Sequelize[_0xc157('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc157('0x2')]},'call_limit':{'type':Sequelize[_0xc157('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'vmexten':{'type':Sequelize[_0xc157('0x2')]},'mohinterpret':{'type':Sequelize[_0xc157('0x2')]},'mohsuggest':{'type':Sequelize[_0xc157('0x2')]},'parkinglot':{'type':Sequelize[_0xc157('0x2')]},'description':{'type':Sequelize[_0xc157('0x2')]},'host':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x31')},'canreinvite':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x1a'),_0xc157('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc157('0x2')]},'otherFields':{'type':Sequelize[_0xc157('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc157('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xf033=['PROHIB_PASSED_SCREEN','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','update,nonat','exports','ENUM','friend','user','peer','STRING','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x429e1,_0x3dcc52){var _0x4d01b0=function(_0xd04ffe){while(--_0xd04ffe){_0x429e1['push'](_0x429e1['shift']());}};_0x4d01b0(++_0x3dcc52);}(_0xf033,0x1cd));var _0x3f03=function(_0x2b59e5,_0x104bf9){_0x2b59e5=_0x2b59e5-0x0;var _0x41aab2=_0xf033[_0x2b59e5];return _0x41aab2;};'use strict';var Sequelize=require('sequelize');module[_0x3f03('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x2'),_0x3f03('0x3'),_0x3f03('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3f03('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x3f03('0x6'),_0x3f03('0x7'),_0x3f03('0x8'),_0x3f03('0x9'),'PROHIB_FAILED_SCREEN',_0x3f03('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3f03('0x5')]},'secret':{'type':Sequelize[_0x3f03('0x5')]},'md5secret':{'type':Sequelize[_0x3f03('0x5')]},'remotesecret':{'type':Sequelize[_0x3f03('0x5')]},'transport':{'type':Sequelize[_0x3f03('0x5')],'defaultValue':_0x3f03('0xb'),'set':function(_0x38e3c6){this['setDataValue'](_0x3f03('0xc'),_0x38e3c6?_0x38e3c6['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x3f03('0xd')](_0x3f03('0xc'))[_0x3f03('0xe')](','):null;},'comment':_0x3f03('0xf')},'dtmfmode':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x10'),_0x3f03('0x11'),_0x3f03('0x12'),_0x3f03('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no',_0x3f03('0x15'),_0x3f03('0x16'),_0x3f03('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3f03('0x1')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3f03('0x5')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x3f03('0x18'),'set':function(_0x3483c6){this[_0x3f03('0x19')](_0x3f03('0x1a'),_0x3483c6?_0x3483c6['join'](','):null);},'get':function(){return this[_0x3f03('0xd')]('nat')?this[_0x3f03('0xd')](_0x3f03('0x1a'))[_0x3f03('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x3f03('0x5')]},'namedcallgroup':{'type':Sequelize[_0x3f03('0x5')]},'pickupgroup':{'type':Sequelize[_0x3f03('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x3f03('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3f03('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3f03('0x5')],'defaultValue':_0x3f03('0x1b')},'allow':{'type':Sequelize[_0x3f03('0x5')],'allowNull':![],'defaultValue':_0x3f03('0x1c'),'set':function(_0x2ed0da){this[_0x3f03('0x19')](_0x3f03('0x1d'),_0x2ed0da?_0x2ed0da[_0x3f03('0x1e')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3f03('0xd')]('allow')?this[_0x3f03('0xd')](_0x3f03('0x1d'))[_0x3f03('0xe')](';'):null;},'comment':_0x3f03('0x1f')},'autoframing':{'type':Sequelize[_0x3f03('0x1')]('yes','no')},'insecure':{'type':Sequelize[_0x3f03('0x5')],'defaultValue':'port,invite','set':function(_0x3ec896){this[_0x3f03('0x19')](_0x3f03('0x20'),_0x3ec896?_0x3ec896[_0x3f03('0x1e')](','):null);},'get':function(){return this[_0x3f03('0xd')](_0x3f03('0x20'))?this[_0x3f03('0xd')](_0x3f03('0x20'))[_0x3f03('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3f03('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3f03('0x1')]('yes','no',_0x3f03('0x21'))},'promiscredir':{'type':Sequelize[_0x3f03('0x1')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x3f03('0x22')](0xb)},'setvar':{'type':Sequelize[_0x3f03('0x5')]},'callerid':{'type':Sequelize[_0x3f03('0x5')],'defaultValue':_0x3f03('0x23')},'amaflags':{'type':Sequelize[_0x3f03('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0x3f03('0x14'),'no'),'defaultValue':_0x3f03('0x14')},'busylevel':{'type':Sequelize[_0x3f03('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3f03('0x14'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x3f03('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x3f03('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no',_0x3f03('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3f03('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x3f03('0x1')]('accept',_0x3f03('0x25'),_0x3f03('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x3f03('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x27'),_0x3f03('0x28')),'defaultValue':_0x3f03('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x3f03('0x5')]},'regexten':{'type':Sequelize[_0x3f03('0x5')]},'fromdomain':{'type':Sequelize[_0x3f03('0x5')]},'fromuser':{'type':Sequelize[_0x3f03('0x5')]},'port':{'type':Sequelize[_0x3f03('0x22')](0x5)},'qualify':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x3f03('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x3f03('0x5')]},'defaultuser':{'type':Sequelize[_0x3f03('0x5')]},'rtptimeout':{'type':Sequelize[_0x3f03('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3f03('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no',_0x3f03('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x3f03('0x5')]},'timert1':{'type':Sequelize[_0x3f03('0x22')](0xb)},'timerb':{'type':Sequelize[_0x3f03('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3f03('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x3f03('0x5')]},'contactdeny':{'type':Sequelize[_0x3f03('0x5')]},'contactacl':{'type':Sequelize[_0x3f03('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x3f03('0x5')]},'use_q850_reason':{'type':Sequelize[_0x3f03('0x5')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x3f03('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'force_avp':{'type':Sequelize[_0x3f03('0x1')]('yes','no')},'icesupport':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no',_0x3f03('0x2a'),_0x3f03('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x3f03('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3f03('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x3f03('0x5')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3f03('0x5')]},'dtlscapath':{'type':Sequelize[_0x3f03('0x5')]},'dtlssetup':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x2c'),_0x3f03('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3f03('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3f03('0x1')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x3f03('0x1')]('yes','no')},'vmexten':{'type':Sequelize[_0x3f03('0x5')]},'mohinterpret':{'type':Sequelize[_0x3f03('0x5')]},'mohsuggest':{'type':Sequelize[_0x3f03('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f03('0x5')]},'host':{'type':Sequelize[_0x3f03('0x5')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x3f03('0x1')](_0x3f03('0x14'),'no',_0x3f03('0x15'),_0x3f03('0x16'),_0x3f03('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3f03('0x5')]},'otherFields':{'type':Sequelize[_0x3f03('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3f03('0x5')],'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 5ca1ce7..3339a45 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x46db9a,_0x40dfa3){var _0x49d522=function(_0x1eeb20){while(--_0x1eeb20){_0x46db9a['push'](_0x46db9a['shift']());}};_0x49d522(++_0x40dfa3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file +var _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5bf3c8,_0x5c268b){var _0xf2a998=function(_0x24243d){while(--_0x24243d){_0x5bf3c8['push'](_0x5bf3c8['shift']());}};_0xf2a998(++_0x5c268b);}(_0x84ab,0x12f));var _0xb84a=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x84ab[_0x3bef2c];return _0x331503;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1da9163..4fd5486 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 _0x2091=['rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2091,0x68));var _0x1209=function(_0x380fcf,_0x32e2c6){_0x380fcf=_0x380fcf-0x0;var _0x135471=_0x2091[_0x380fcf];return _0x135471;};'use strict';var _=require(_0x1209('0x0'));var util=require(_0x1209('0x1'));var logger=require(_0x1209('0x2'))(_0x1209('0x3'));var moment=require(_0x1209('0x4'));var BPromise=require(_0x1209('0x5'));var rp=require(_0x1209('0x6'));var fs=require('fs');var path=require(_0x1209('0x7'));var rimraf=require(_0x1209('0x8'));var config=require('../../config/environment');var attributes=require(_0x1209('0x9'));module[_0x1209('0xa')]=function(_0x8fa5fe,_0x2304f2){return _0x8fa5fe[_0x1209('0xb')](_0x1209('0xc'),attributes,{'tableName':_0x1209('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323c=['api','moment','bluebird','path','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0xed7d9a,_0x26a34d){var _0x3e9f15=function(_0x109a7f){while(--_0x109a7f){_0xed7d9a['push'](_0xed7d9a['shift']());}};_0x3e9f15(++_0x26a34d);}(_0x323c,0x76));var _0xc323=function(_0xded12b,_0xecfb8e){_0xded12b=_0xded12b-0x0;var _0x572384=_0x323c[_0xded12b];return _0x572384;};'use strict';var _=require(_0xc323('0x0'));var util=require(_0xc323('0x1'));var logger=require('../../config/logger')(_0xc323('0x2'));var moment=require(_0xc323('0x3'));var BPromise=require(_0xc323('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc323('0x5'));var rimraf=require(_0xc323('0x6'));var config=require('../../config/environment');var attributes=require(_0xc323('0x7'));module[_0xc323('0x8')]=function(_0x66691a,_0x2b2510){return _0x66691a[_0xc323('0x9')](_0xc323('0xa'),attributes,{'tableName':_0xc323('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 10b0bfe..de43e46 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 _0x9729=['include','model','attributes','then','GetTrunk','catch','find','ShowTrunk','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','Trunk','findAll','options','raw','where','limit','map'];(function(_0x39658b,_0xf72a7f){var _0xa37442=function(_0x2edfaf){while(--_0x2edfaf){_0x39658b['push'](_0x39658b['shift']());}};_0xa37442(++_0xf72a7f);}(_0x9729,0xce));var _0x9972=function(_0x3af631,_0x2a5244){_0x3af631=_0x3af631-0x0;var _0x46bc92=_0x9729[_0x3af631];return _0x46bc92;};'use strict';var _=require(_0x9972('0x0'));var util=require('util');var moment=require(_0x9972('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9972('0x2'));var db=require(_0x9972('0x3'))['db'];var utils=require(_0x9972('0x4'));var logger=require(_0x9972('0x5'))(_0x9972('0x6'));var config=require(_0x9972('0x7'));var jayson=require(_0x9972('0x8'));var client=jayson['client'][_0x9972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d88e5,_0x25de29,_0x589d85){return new BPromise(function(_0x8b8420,_0xb9b7ad){return client[_0x9972('0xa')](_0x7d88e5,_0x589d85)['then'](function(_0x232981){logger['info'](_0x9972('0xb'),_0x25de29,_0x9972('0xc'));logger[_0x9972('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x25de29,'request\x20sent',JSON[_0x9972('0xe')](_0x232981));if(_0x232981['error']){if(_0x232981[_0x9972('0xf')]['code']===0x1f4){logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x232981['error']['message']);return _0xb9b7ad(_0x232981['error']['message']);}logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x232981[_0x9972('0xf')][_0x9972('0x10')]);return _0x8b8420(_0x232981[_0x9972('0xf')][_0x9972('0x10')]);}else{logger[_0x9972('0x11')](_0x9972('0xb'),_0x25de29,'request\x20sent');_0x8b8420(_0x232981['result'][_0x9972('0x10')]);}})['catch'](function(_0x3bd7b1){logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x3bd7b1);_0xb9b7ad(_0x3bd7b1);});});}exports['GetTrunk']=function(_0x3e3fdb){var _0x41b48c=this;return new Promise(function(_0x50ef97,_0x5b4eec){return db[_0x9972('0x12')][_0x9972('0x13')]({'raw':_0x3e3fdb['options']?_0x3e3fdb[_0x9972('0x14')][_0x9972('0x15')]===undefined?!![]:![]:!![],'where':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb['options'][_0x9972('0x16')]||null:null,'attributes':_0x3e3fdb['options']?_0x3e3fdb[_0x9972('0x14')]['attributes']||null:null,'limit':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb[_0x9972('0x14')][_0x9972('0x17')]||null:null,'include':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb[_0x9972('0x14')]['include']?_[_0x9972('0x18')](_0x3e3fdb['options'][_0x9972('0x19')],function(_0x40e3e9){return{'model':db[_0x40e3e9[_0x9972('0x1a')]],'as':_0x40e3e9['as'],'attributes':_0x40e3e9[_0x9972('0x1b')],'include':_0x40e3e9['include']?_[_0x9972('0x18')](_0x40e3e9[_0x9972('0x19')],function(_0x5e717b){return{'model':db[_0x5e717b[_0x9972('0x1a')]],'as':_0x5e717b['as'],'attributes':_0x5e717b[_0x9972('0x1b')],'include':_0x5e717b['include']?_['map'](_0x5e717b[_0x9972('0x19')],function(_0x44c0fe){return{'model':db[_0x44c0fe[_0x9972('0x1a')]],'as':_0x44c0fe['as'],'attributes':_0x44c0fe[_0x9972('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9972('0x1c')](function(_0x4058f2){logger[_0x9972('0x11')](_0x9972('0x1d'),_0x3e3fdb);logger[_0x9972('0xd')](_0x9972('0x1d'),_0x3e3fdb,JSON[_0x9972('0xe')](_0x4058f2));_0x50ef97(_0x4058f2);})[_0x9972('0x1e')](function(_0x39f672){logger['error']('GetTrunk',_0x39f672[_0x9972('0x10')],_0x3e3fdb);_0x5b4eec(_0x41b48c[_0x9972('0xf')](0x1f4,_0x39f672[_0x9972('0x10')]));});});};exports['ShowTrunk']=function(_0x5c2817){var _0x320444=this;return new Promise(function(_0x21a4a0,_0x249253){return db[_0x9972('0x12')][_0x9972('0x1f')]({'raw':_0x5c2817[_0x9972('0x14')]?_0x5c2817[_0x9972('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5c2817['options']?_0x5c2817[_0x9972('0x14')][_0x9972('0x16')]||null:null,'attributes':_0x5c2817[_0x9972('0x14')]?_0x5c2817[_0x9972('0x14')][_0x9972('0x1b')]||null:null,'include':_0x5c2817['options']?_0x5c2817[_0x9972('0x14')][_0x9972('0x19')]?_[_0x9972('0x18')](_0x5c2817[_0x9972('0x14')][_0x9972('0x19')],function(_0x5e1eda){return{'model':db[_0x5e1eda['model']],'as':_0x5e1eda['as'],'attributes':_0x5e1eda['attributes'],'include':_0x5e1eda[_0x9972('0x19')]?_[_0x9972('0x18')](_0x5e1eda[_0x9972('0x19')],function(_0x4b8ccc){return{'model':db[_0x4b8ccc['model']],'as':_0x4b8ccc['as'],'attributes':_0x4b8ccc[_0x9972('0x1b')],'include':_0x4b8ccc[_0x9972('0x19')]?_[_0x9972('0x18')](_0x4b8ccc[_0x9972('0x19')],function(_0x4223f3){return{'model':db[_0x4223f3[_0x9972('0x1a')]],'as':_0x4223f3['as'],'attributes':_0x4223f3[_0x9972('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9972('0x1c')](function(_0x5824d3){logger['info']('ShowTrunk',_0x5c2817);logger[_0x9972('0xd')](_0x9972('0x20'),_0x5c2817,JSON[_0x9972('0xe')](_0x5824d3));_0x21a4a0(_0x5824d3);})[_0x9972('0x1e')](function(_0x3cbe36){logger[_0x9972('0xf')](_0x9972('0x20'),_0x3cbe36[_0x9972('0x10')],_0x5c2817);_0x249253(_0x320444[_0x9972('0xf')](0x1f4,_0x3cbe36['message']));});});}; \ No newline at end of file +var _0x7cc2=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','Trunk','findAll','options','raw','where','attributes','include','model','map','then','GetTrunk','catch','find','ShowTrunk','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x5e3560,_0x74add3){var _0x4a1160=function(_0x4d3c23){while(--_0x4d3c23){_0x5e3560['push'](_0x5e3560['shift']());}};_0x4a1160(++_0x74add3);}(_0x7cc2,0x1dc));var _0x27cc=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x7cc2[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x27cc('0x0'));var util=require('util');var moment=require(_0x27cc('0x1'));var BPromise=require('bluebird');var rs=require(_0x27cc('0x2'));var fs=require('fs');var Redis=require(_0x27cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27cc('0x4'));var logger=require(_0x27cc('0x5'))(_0x27cc('0x6'));var config=require(_0x27cc('0x7'));var jayson=require(_0x27cc('0x8'));var client=jayson[_0x27cc('0x9')][_0x27cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30b5ea,_0x56932a,_0x40599a){return new BPromise(function(_0x2d63b1,_0x340237){return client[_0x27cc('0xb')](_0x30b5ea,_0x40599a)['then'](function(_0x2fb814){logger['info']('Trunk,\x20%s,\x20%s',_0x56932a,_0x27cc('0xc'));logger[_0x27cc('0xd')](_0x27cc('0xe'),_0x56932a,'request\x20sent',JSON[_0x27cc('0xf')](_0x2fb814));if(_0x2fb814['error']){if(_0x2fb814[_0x27cc('0x10')][_0x27cc('0x11')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x56932a,_0x2fb814[_0x27cc('0x10')][_0x27cc('0x12')]);return _0x340237(_0x2fb814[_0x27cc('0x10')]['message']);}logger[_0x27cc('0x10')](_0x27cc('0x13'),_0x56932a,_0x2fb814[_0x27cc('0x10')][_0x27cc('0x12')]);return _0x2d63b1(_0x2fb814['error'][_0x27cc('0x12')]);}else{logger[_0x27cc('0x14')](_0x27cc('0x13'),_0x56932a,_0x27cc('0xc'));_0x2d63b1(_0x2fb814['result']['message']);}})['catch'](function(_0x118f51){logger['error'](_0x27cc('0x13'),_0x56932a,_0x118f51);_0x340237(_0x118f51);});});}exports['GetTrunk']=function(_0x3ba003){var _0x173936=this;return new Promise(function(_0x14b85e,_0x1a1669){return db[_0x27cc('0x15')][_0x27cc('0x16')]({'raw':_0x3ba003['options']?_0x3ba003[_0x27cc('0x17')][_0x27cc('0x18')]===undefined?!![]:![]:!![],'where':_0x3ba003['options']?_0x3ba003[_0x27cc('0x17')][_0x27cc('0x19')]||null:null,'attributes':_0x3ba003[_0x27cc('0x17')]?_0x3ba003[_0x27cc('0x17')][_0x27cc('0x1a')]||null:null,'limit':_0x3ba003[_0x27cc('0x17')]?_0x3ba003[_0x27cc('0x17')]['limit']||null:null,'include':_0x3ba003[_0x27cc('0x17')]?_0x3ba003['options'][_0x27cc('0x1b')]?_['map'](_0x3ba003['options'][_0x27cc('0x1b')],function(_0x33a413){return{'model':db[_0x33a413['model']],'as':_0x33a413['as'],'attributes':_0x33a413['attributes'],'include':_0x33a413[_0x27cc('0x1b')]?_['map'](_0x33a413[_0x27cc('0x1b')],function(_0x10ef50){return{'model':db[_0x10ef50[_0x27cc('0x1c')]],'as':_0x10ef50['as'],'attributes':_0x10ef50[_0x27cc('0x1a')],'include':_0x10ef50[_0x27cc('0x1b')]?_[_0x27cc('0x1d')](_0x10ef50[_0x27cc('0x1b')],function(_0xd5c85e){return{'model':db[_0xd5c85e[_0x27cc('0x1c')]],'as':_0xd5c85e['as'],'attributes':_0xd5c85e[_0x27cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x27cc('0x1e')](function(_0x3de9ac){logger[_0x27cc('0x14')](_0x27cc('0x1f'),_0x3ba003);logger['debug']('GetTrunk',_0x3ba003,JSON[_0x27cc('0xf')](_0x3de9ac));_0x14b85e(_0x3de9ac);})[_0x27cc('0x20')](function(_0x16953b){logger['error'](_0x27cc('0x1f'),_0x16953b[_0x27cc('0x12')],_0x3ba003);_0x1a1669(_0x173936['error'](0x1f4,_0x16953b[_0x27cc('0x12')]));});});};exports['ShowTrunk']=function(_0x1fb59d){var _0x398891=this;return new Promise(function(_0x843e6d,_0x1c48cb){return db[_0x27cc('0x15')][_0x27cc('0x21')]({'raw':_0x1fb59d['options']?_0x1fb59d['options'][_0x27cc('0x18')]===undefined?!![]:![]:!![],'where':_0x1fb59d[_0x27cc('0x17')]?_0x1fb59d[_0x27cc('0x17')][_0x27cc('0x19')]||null:null,'attributes':_0x1fb59d[_0x27cc('0x17')]?_0x1fb59d[_0x27cc('0x17')][_0x27cc('0x1a')]||null:null,'include':_0x1fb59d[_0x27cc('0x17')]?_0x1fb59d[_0x27cc('0x17')]['include']?_[_0x27cc('0x1d')](_0x1fb59d[_0x27cc('0x17')][_0x27cc('0x1b')],function(_0x56469f){return{'model':db[_0x56469f[_0x27cc('0x1c')]],'as':_0x56469f['as'],'attributes':_0x56469f[_0x27cc('0x1a')],'include':_0x56469f[_0x27cc('0x1b')]?_[_0x27cc('0x1d')](_0x56469f['include'],function(_0x4e64a5){return{'model':db[_0x4e64a5['model']],'as':_0x4e64a5['as'],'attributes':_0x4e64a5[_0x27cc('0x1a')],'include':_0x4e64a5['include']?_[_0x27cc('0x1d')](_0x4e64a5[_0x27cc('0x1b')],function(_0xc5bdce){return{'model':db[_0xc5bdce[_0x27cc('0x1c')]],'as':_0xc5bdce['as'],'attributes':_0xc5bdce[_0x27cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x27cc('0x1e')](function(_0x230420){logger[_0x27cc('0x14')]('ShowTrunk',_0x1fb59d);logger[_0x27cc('0xd')](_0x27cc('0x22'),_0x1fb59d,JSON[_0x27cc('0xf')](_0x230420));_0x843e6d(_0x230420);})[_0x27cc('0x20')](function(_0x650a85){logger[_0x27cc('0x10')](_0x27cc('0x22'),_0x650a85[_0x27cc('0x12')],_0x1fb59d);_0x1c48cb(_0x398891['error'](0x1f4,_0x650a85['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 36c65cc..77d660d 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 _0xc733=['exports','express','Router','../../components/auth/service','put','/:id','isAuthenticated'];(function(_0x1b8bac,_0x390bc9){var _0x4390d0=function(_0x2e46df){while(--_0x2e46df){_0x1b8bac['push'](_0x1b8bac['shift']());}};_0x4390d0(++_0x390bc9);}(_0xc733,0x1ba));var _0x3c73=function(_0x45ed20,_0x347b04){_0x45ed20=_0x45ed20-0x0;var _0x629f0f=_0xc733[_0x45ed20];return _0x629f0f;};'use strict';var express=require(_0x3c73('0x0'));var router=express[_0x3c73('0x1')]();var auth=require(_0x3c73('0x2'));var controller=require('./user-setting.controller');router[_0x3c73('0x3')](_0x3c73('0x4'),auth[_0x3c73('0x5')](),controller['update']);module[_0x3c73('0x6')]=router; \ No newline at end of file +var _0x4f8c=['../../components/auth/service','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0xf989a3,_0x7b4ae6){var _0x438f68=function(_0x2cdd48){while(--_0x2cdd48){_0xf989a3['push'](_0xf989a3['shift']());}};_0x438f68(++_0x7b4ae6);}(_0x4f8c,0x136));var _0xc4f8=function(_0x1fb20b,_0x4d5ba8){_0x1fb20b=_0x1fb20b-0x0;var _0x1d5705=_0x4f8c[_0x1fb20b];return _0x1d5705;};'use strict';var express=require(_0xc4f8('0x0'));var router=express[_0xc4f8('0x1')]();var auth=require(_0xc4f8('0x2'));var controller=require('./user-setting.controller');router[_0xc4f8('0x3')](_0xc4f8('0x4'),auth[_0xc4f8('0x5')](),controller[_0xc4f8('0x6')]);module[_0xc4f8('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 1dbcc04..ec74ef5 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 _0x8a6d=['TEXT','DATE','INTEGER','sequelize','warning','info','debug','ENUM','error'];(function(_0x291659,_0x55ef07){var _0xa6afaf=function(_0x758d77){while(--_0x758d77){_0x291659['push'](_0x291659['shift']());}};_0xa6afaf(++_0x55ef07);}(_0x8a6d,0x11a));var _0xd8a6=function(_0x53a102,_0x5df034){_0x53a102=_0x53a102-0x0;var _0x4aa650=_0x8a6d[_0x53a102];return _0x4aa650;};'use strict';var Sequelize=require(_0xd8a6('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xd8a6('0x1'),_0xd8a6('0x2'),_0xd8a6('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xd8a6('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd8a6('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd8a6('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd8a6('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd8a6('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x1b8e=['sequelize','error','warning','info','debug','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x25c8f8,_0x44e62b){var _0x14bef9=function(_0x3815e7){while(--_0x3815e7){_0x25c8f8['push'](_0x25c8f8['shift']());}};_0x14bef9(++_0x44e62b);}(_0x1b8e,0x84));var _0xe1b8=function(_0x15775d,_0x55a800){_0x15775d=_0x15775d-0x0;var _0x4e7685=_0x1b8e[_0x15775d];return _0x4e7685;};'use strict';var Sequelize=require(_0xe1b8('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xe1b8('0x1'),_0xe1b8('0x2'),_0xe1b8('0x3'),_0xe1b8('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xe1b8('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xe1b8('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xe1b8('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe1b8('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe1b8('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe1b8('0x9')],'unique':_0xe1b8('0xa')}}; \ 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 4c6cc6f..0e14525 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 _0x59c3=['send','user','role','admin','params','Invalid\x20user\x20setting\x20id','find','then','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','status','json','update','sendStatus','error','stack','name'];(function(_0x50ed96,_0x19bac2){var _0x193c04=function(_0x3d7769){while(--_0x3d7769){_0x50ed96['push'](_0x50ed96['shift']());}};_0x193c04(++_0x19bac2);}(_0x59c3,0x133));var _0x359c=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x59c3[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x359c('0x0'));var Redis=require(_0x359c('0x1'));var logger=require(_0x359c('0x2'))(_0x359c('0x3'));var config=require(_0x359c('0x4'));var db=require(_0x359c('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x359c('0x6')]));require(_0x359c('0x7'))[_0x359c('0x8')](socket);config[_0x359c('0x6')]=_[_0x359c('0x9')](config[_0x359c('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x9c107b,_0x58b390){_0x58b390=_0x58b390||0xc8;return function(_0x3a7d8e){if(_0x3a7d8e){return _0x9c107b[_0x359c('0xa')](_0x58b390)[_0x359c('0xb')](_0x3a7d8e);}};}function saveUpdates(_0x682720){return function(_0x536426){if(_0x536426){return _0x536426[_0x359c('0xc')](_0x682720)['then'](function(_0x15b56d){return _0x15b56d;});}return null;};}function handleEntityNotFound(_0x1d7417){return function(_0xb48a01){if(!_0xb48a01){_0x1d7417[_0x359c('0xd')](0x194);}return _0xb48a01;};}function handleError(_0x160271,_0x218e8b){_0x218e8b=_0x218e8b||0x1f4;return function(_0x5567d7){logger[_0x359c('0xe')](_0x5567d7[_0x359c('0xf')]);if(_0x5567d7[_0x359c('0x10')]){delete _0x5567d7[_0x359c('0x10')];}_0x160271[_0x359c('0xa')](_0x218e8b)[_0x359c('0x11')](_0x5567d7);};}exports[_0x359c('0xc')]=function(_0x246dc1,_0x3a73ca){if(_0x246dc1[_0x359c('0x12')][_0x359c('0x13')]!==_0x359c('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x246dc1[_0x359c('0x15')]['id'])))throw new Error(_0x359c('0x16'));return db['UserSetting'][_0x359c('0x17')]({'where':{'id':_0x246dc1[_0x359c('0x15')]['id']}})[_0x359c('0x18')](handleEntityNotFound(_0x3a73ca,null))[_0x359c('0x18')](saveUpdates(_0x246dc1[_0x359c('0x19')],null))[_0x359c('0x18')](respondWithResult(_0x3a73ca,null))[_0x359c('0x1a')](handleError(_0x3a73ca,null));}; \ No newline at end of file +var _0x4853=['json','update','then','sendStatus','error','stack','send','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','catch','ioredis','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','localhost','status'];(function(_0x420204,_0xaae94d){var _0x93aaad=function(_0x2049fa){while(--_0x2049fa){_0x420204['push'](_0x420204['shift']());}};_0x93aaad(++_0xaae94d);}(_0x4853,0x11d));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Redis=require(_0x3485('0x0'));var logger=require('../../config/logger')(_0x3485('0x1'));var config=require(_0x3485('0x2'));var db=require(_0x3485('0x3'))['db'];var socket=require(_0x3485('0x4'))(new Redis(config[_0x3485('0x5')]));require(_0x3485('0x6'))['register'](socket);config['redis']=_['defaults'](config[_0x3485('0x5')],{'host':_0x3485('0x7'),'port':0x18eb});function respondWithResult(_0x2442dd,_0x10ec4b){_0x10ec4b=_0x10ec4b||0xc8;return function(_0x41a183){if(_0x41a183){return _0x2442dd[_0x3485('0x8')](_0x10ec4b)[_0x3485('0x9')](_0x41a183);}};}function saveUpdates(_0x568ea7){return function(_0x386f6b){if(_0x386f6b){return _0x386f6b[_0x3485('0xa')](_0x568ea7)[_0x3485('0xb')](function(_0x876b94){return _0x876b94;});}return null;};}function handleEntityNotFound(_0xe402e6){return function(_0x466c62){if(!_0x466c62){_0xe402e6[_0x3485('0xc')](0x194);}return _0x466c62;};}function handleError(_0x432791,_0x1db53c){_0x1db53c=_0x1db53c||0x1f4;return function(_0x523fff){logger[_0x3485('0xd')](_0x523fff[_0x3485('0xe')]);if(_0x523fff['name']){delete _0x523fff['name'];}_0x432791[_0x3485('0x8')](_0x1db53c)[_0x3485('0xf')](_0x523fff);};}exports[_0x3485('0xa')]=function(_0x516082,_0x4c33dd){if(_0x516082['user']['role']!=='admin')throw new Error(_0x3485('0x10'));if(isNaN(Number(_0x516082[_0x3485('0x11')]['id'])))throw new Error(_0x3485('0x12'));return db['UserSetting'][_0x3485('0x13')]({'where':{'id':_0x516082['params']['id']}})['then'](handleEntityNotFound(_0x4c33dd,null))[_0x3485('0xb')](saveUpdates(_0x516082['body'],null))[_0x3485('0xb')](respondWithResult(_0x4c33dd,null))[_0x3485('0x14')](handleError(_0x4c33dd,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 5b8c62c..49ed3da 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 _0x028d=['update','emit','hasOwnProperty','hook','exports','UserSetting','save'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x028d,0x1a2));var _0xd028=function(_0x48bceb,_0x3658d8){_0x48bceb=_0x48bceb-0x0;var _0x274484=_0x028d[_0x48bceb];return _0x274484;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xd028('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd028('0x1'),'afterUpdate':_0xd028('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3f4600){return function(_0x3ba3d1,_0x56b0a0,_0x15c68d){UserSettingEvents[_0xd028('0x3')](_0x3f4600+':'+_0x3ba3d1['id'],_0x3ba3d1);UserSettingEvents[_0xd028('0x3')](_0x3f4600,_0x3ba3d1);_0x15c68d(null);};}for(var e in events){if(events[_0xd028('0x4')](e)){var event=events[e];UserSetting[_0xd028('0x5')](e,emitEvent(event));}}module[_0xd028('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xad8b=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x484b24,_0x5f34ad){var _0x379fbb=function(_0x138c14){while(--_0x138c14){_0x484b24['push'](_0x484b24['shift']());}};_0x379fbb(++_0x5f34ad);}(_0xad8b,0x1e4));var _0xbad8=function(_0x113974,_0x4850e4){_0x113974=_0x113974-0x0;var _0x1b242f=_0xad8b[_0x113974];return _0x1b242f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xbad8('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbad8('0x1')](0x0);var events={'afterCreate':_0xbad8('0x2'),'afterUpdate':_0xbad8('0x3'),'afterDestroy':_0xbad8('0x4')};function emitEvent(_0x4670fc){return function(_0x15d7df,_0x3f1ddb,_0x310df9){UserSettingEvents[_0xbad8('0x5')](_0x4670fc+':'+_0x15d7df['id'],_0x15d7df);UserSettingEvents['emit'](_0x4670fc,_0x15d7df);_0x310df9(null);};}for(var e in events){if(events[_0xbad8('0x6')](e)){var event=events[e];UserSetting[_0xbad8('0x7')](e,emitEvent(event));}}module[_0xbad8('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 76535e5..bd26005 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 _0x9234=['clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x49c663,_0x37d7a3){var _0x5a3e7e=function(_0x2fe2b3){while(--_0x2fe2b3){_0x49c663['push'](_0x49c663['shift']());}};_0x5a3e7e(++_0x37d7a3);}(_0x9234,0x1bd));var _0x4923=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x9234[_0x24259d];return _0x5a701;};'use strict';var attributes=require(_0x4923('0x0'));module['exports']=function(_0x1ece6e){return _0x1ece6e[_0x4923('0x1')](_0x4923('0x2'),attributes,{'tableName':_0x4923('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481178){if(!_0x481178[_0x4923('0x4')])_0x481178[_0x4923('0x5')]=null;else if(_0x481178['clientSideLoggingEnabledSince']===null)_0x481178[_0x4923('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x7980=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x706eb3,_0x2304c3){var _0x34a6e6=function(_0x4e52a5){while(--_0x4e52a5){_0x706eb3['push'](_0x706eb3['shift']());}};_0x34a6e6(++_0x2304c3);}(_0x7980,0xab));var _0x0798=function(_0x44fcdb,_0x1e9a76){_0x44fcdb=_0x44fcdb-0x0;var _0x30b086=_0x7980[_0x44fcdb];return _0x30b086;};'use strict';var attributes=require(_0x0798('0x0'));module[_0x0798('0x1')]=function(_0x2c2c4e){return _0x2c2c4e[_0x0798('0x2')](_0x0798('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a9ff7){if(!_0x3a9ff7[_0x0798('0x4')])_0x3a9ff7[_0x0798('0x5')]=null;else if(_0x3a9ff7[_0x0798('0x5')]===null)_0x3a9ff7[_0x0798('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index adaa087..b202c5b 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 _0x3ee8=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save'];(function(_0x34e76c,_0x11d21e){var _0x267d83=function(_0x204033){while(--_0x204033){_0x34e76c['push'](_0x34e76c['shift']());}};_0x267d83(++_0x11d21e);}(_0x3ee8,0x9e));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0x83ee('0x0'));var events=[_0x83ee('0x1'),_0x83ee('0x2'),_0x83ee('0x3')];function createListener(_0xec6bb6,_0x5f410c){return function(_0x495bd2){_0x5f410c[_0x83ee('0x4')](_0xec6bb6,_0x495bd2);if(_0xec6bb6===_0x83ee('0x5')){_0x5f410c[_0x83ee('0x4')](_0x83ee('0x6')+_0x495bd2[_0x83ee('0x7')],_0x495bd2);}};}exports['register']=function(_0x47511b){for(var _0x1469fe=0x0,_0x52cd53=events[_0x83ee('0x8')];_0x1469fe<_0x52cd53;_0x1469fe++){var _0xd397fd=events[_0x1469fe];var _0x3cac2c=createListener(_0x83ee('0x9')+_0xd397fd,_0x47511b);UserSettingEvents['on'](_0xd397fd,_0x3cac2c);}}; \ No newline at end of file +var _0x36b1=['register','user-setting:','./user-setting.events','save','remove','emit','user-setting:update:user-','UserId'];(function(_0x3699c7,_0x100180){var _0x34767c=function(_0x45c0ed){while(--_0x45c0ed){_0x3699c7['push'](_0x3699c7['shift']());}};_0x34767c(++_0x100180);}(_0x36b1,0x1aa));var _0x136b=function(_0x1a3ff5,_0x5eecbd){_0x1a3ff5=_0x1a3ff5-0x0;var _0x339f6b=_0x36b1[_0x1a3ff5];return _0x339f6b;};'use strict';var UserSettingEvents=require(_0x136b('0x0'));var events=[_0x136b('0x1'),_0x136b('0x2'),'update'];function createListener(_0x4a8986,_0x4f42e8){return function(_0x4d0907){_0x4f42e8[_0x136b('0x3')](_0x4a8986,_0x4d0907);if(_0x4a8986==='user-setting:update'){_0x4f42e8[_0x136b('0x3')](_0x136b('0x4')+_0x4d0907[_0x136b('0x5')],_0x4d0907);}};}exports[_0x136b('0x6')]=function(_0x5a8f24){for(var _0xb6691a=0x0,_0x23d223=events['length'];_0xb6691a<_0x23d223;_0xb6691a++){var _0x3e946d=events[_0xb6691a];var _0x1b43fd=createListener(_0x136b('0x7')+_0x3e946d,_0x5a8f24);UserSettingEvents['on'](_0x3e946d,_0x1b43fd);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8fac042..7576875 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 _0xfdbf=['getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','login','logout','/:id/pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites'];(function(_0x17a72f,_0x564733){var _0x3c85e6=function(_0x5dc310){while(--_0x5dc310){_0x17a72f['push'](_0x17a72f['shift']());}};_0x3c85e6(++_0x564733);}(_0xfdbf,0xb5));var _0xffdb=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xfdbf[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0xffdb('0x0'));var util=require(_0xffdb('0x1'));var path=require(_0xffdb('0x2'));var timeout=require('connect-timeout');var express=require(_0xffdb('0x3'));var router=express[_0xffdb('0x4')]();var fs_extra=require(_0xffdb('0x5'));var auth=require(_0xffdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xffdb('0x7'));var controller=require('./user.controller');router[_0xffdb('0x8')]('/',auth[_0xffdb('0x9')](),controller[_0xffdb('0xa')]);router[_0xffdb('0x8')](_0xffdb('0xb'),auth[_0xffdb('0x9')](),controller[_0xffdb('0xc')]);router[_0xffdb('0x8')](_0xffdb('0xd'),auth[_0xffdb('0x9')](),controller[_0xffdb('0xe')]);router[_0xffdb('0x8')](_0xffdb('0xf'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x10')]);router[_0xffdb('0x8')]('/:id',auth[_0xffdb('0x9')](),controller[_0xffdb('0x11')]);router['get']('/:id/avatar',controller[_0xffdb('0x12')]);router['get']('/:id/open_tabs',auth[_0xffdb('0x9')](),controller[_0xffdb('0x13')]);router[_0xffdb('0x8')](_0xffdb('0x14'),auth['isAuthenticated'](),controller['getContacts']);router[_0xffdb('0x8')](_0xffdb('0x15'),auth['isAuthenticated'](),controller[_0xffdb('0x16')]);router[_0xffdb('0x8')](_0xffdb('0x17'),auth[_0xffdb('0x9')](),controller['getVoiceQueuesRt']);router[_0xffdb('0x8')]('/:id/groups',auth['isAuthenticated'](),controller[_0xffdb('0x18')]);router['get'](_0xffdb('0x19'),auth[_0xffdb('0x9')](),controller['getRecordings']);router['get'](_0xffdb('0x1a'),auth[_0xffdb('0x9')](),controller['getScreenRecordings']);router['get']('/:id/chat/interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x1b')]);router[_0xffdb('0x8')](_0xffdb('0x1c'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x1d')]);router[_0xffdb('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0xffdb('0x1e'),auth['isAuthenticated'](),controller[_0xffdb('0x1f')]);router[_0xffdb('0x8')](_0xffdb('0x20'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x21')]);router[_0xffdb('0x8')]('/:id/whatsapp/interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x22')]);router['get'](_0xffdb('0x23'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x24')]);router['get'](_0xffdb('0x25'),auth['isAuthenticated'](),controller[_0xffdb('0x26')]);router[_0xffdb('0x8')](_0xffdb('0x27'),auth['isAuthenticated'](),controller[_0xffdb('0x28')]);router[_0xffdb('0x8')](_0xffdb('0x29'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2a')]);router[_0xffdb('0x8')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2c')]);router[_0xffdb('0x8')](_0xffdb('0x2d'),auth['isAuthenticated'](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xffdb('0x2e'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2f')]);router[_0xffdb('0x8')](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x31')]);router[_0xffdb('0x8')](_0xffdb('0x32'),auth['isAuthenticated'](),controller[_0xffdb('0x33')]);router[_0xffdb('0x8')](_0xffdb('0x34'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x35')]);router['get'](_0xffdb('0x36'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x37')]);router[_0xffdb('0x38')](_0xffdb('0x14'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x39')]);router['post']('/',auth['isAuthenticated'](),controller[_0xffdb('0x3a')]);router[_0xffdb('0x38')](_0xffdb('0x3b'),auth['isAuthenticated'](),controller[_0xffdb('0x3c')]);router[_0xffdb('0x38')](_0xffdb('0x15'),auth[_0xffdb('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xffdb('0x3d')]({'destination':function(_0x4785b8,_0x4c2731,_0x4b6d9d){_0x4b6d9d(null,path['join'](config[_0xffdb('0x3e')],_0xffdb('0x3f')));},'filename':function(_0x52569b,_0x191285,_0x4d3c22){_0x4d3c22(null,util[_0xffdb('0x40')](_0xffdb('0x41'),Date[_0xffdb('0x42')](),_0x191285[_0xffdb('0x43')]));}})});router[_0xffdb('0x38')](_0xffdb('0x44'),upload['single'](_0xffdb('0x45')),controller[_0xffdb('0x46')]);router[_0xffdb('0x38')]('/:id/login',auth[_0xffdb('0x9')](),controller[_0xffdb('0x47')]);router['post']('/:id/logout',auth[_0xffdb('0x9')](),controller[_0xffdb('0x48')]);router[_0xffdb('0x38')](_0xffdb('0x49'),auth[_0xffdb('0x9')](),controller['pause']);router['post'](_0xffdb('0x4a'),auth[_0xffdb('0x9')](),controller['unpause']);router[_0xffdb('0x38')]('/:id/teams',auth[_0xffdb('0x9')](),controller['addTeams']);router['post'](_0xffdb('0x4b'),auth['isAuthenticated'](),controller[_0xffdb('0x4c')]);router[_0xffdb('0x38')]('/:id/mail_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x4d')]);router[_0xffdb('0x38')]('/:id/fax_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x4e')]);router[_0xffdb('0x38')](_0xffdb('0x4f'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x50')]);router[_0xffdb('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xffdb('0x51')]);router[_0xffdb('0x38')](_0xffdb('0x52'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x53')]);router[_0xffdb('0x38')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x54')]);router['post'](_0xffdb('0x2d'),auth['isAuthenticated'](),controller[_0xffdb('0x55')]);router['post'](_0xffdb('0x56'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0xffdb('0x9')](),controller[_0xffdb('0x57')]);router['post'](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x58')]);router[_0xffdb('0x38')](_0xffdb('0x32'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x59')]);router[_0xffdb('0x38')](_0xffdb('0x36'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x5a')]);router[_0xffdb('0x5b')](_0xffdb('0x5c'),auth[_0xffdb('0x9')](),controller['update']);router['put'](_0xffdb('0x5d'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x5e')]);router[_0xffdb('0x5f')]('/:id/queues',auth[_0xffdb('0x9')](),controller[_0xffdb('0x60')]);router[_0xffdb('0x5f')]('/:id/teams',auth[_0xffdb('0x9')](),controller[_0xffdb('0x61')]);router[_0xffdb('0x5f')](_0xffdb('0x5c'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x62')]);router['delete']('/:id/chat_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x63')]);router['delete'](_0xffdb('0x64'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x65')]);router[_0xffdb('0x5f')](_0xffdb('0x66'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x67')]);router[_0xffdb('0x5f')](_0xffdb('0x4f'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x68')]);router[_0xffdb('0x5f')](_0xffdb('0x69'),auth['isAuthenticated'](),controller[_0xffdb('0x6a')]);router[_0xffdb('0x5f')](_0xffdb('0x52'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6b')]);router[_0xffdb('0x5f')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller['removeFaxAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x2d'),auth['isAuthenticated'](),controller[_0xffdb('0x6c')]);router[_0xffdb('0x5f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x2e'),auth[_0xffdb('0x9')](),controller['removeSmsAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6d')]);router[_0xffdb('0x5f')](_0xffdb('0x32'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6e')]);router['delete'](_0xffdb('0x36'),auth['isAuthenticated'](),controller[_0xffdb('0x6f')]);router['post'](_0xffdb('0x70'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x71')]);module[_0xffdb('0x72')]=router; \ No newline at end of file +var _0xd237=['getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getApiKey','post','/:id/contacts','/create_many','bulkCreate','diskStorage','root','server/files/images/','now','single','addAvatar','/:id/login','/:id/logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addWhatsappAccounts','/:id/api_key','createApiKey','update','put','/:id/password','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','/:id/openchannel_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','describe','/whoami','isAuthenticated','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/queues'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xd237,0x12b));var _0x7d23=function(_0x1f1eee,_0x2f10af){_0x1f1eee=_0x1f1eee-0x0;var _0x325e75=_0xd237[_0x1f1eee];return _0x325e75;};'use strict';var multer=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var path=require(_0x7d23('0x2'));var timeout=require(_0x7d23('0x3'));var express=require('express');var router=express[_0x7d23('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7d23('0x5'));var interaction=require(_0x7d23('0x6'));var config=require(_0x7d23('0x7'));var controller=require(_0x7d23('0x8'));router[_0x7d23('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7d23('0x9')](_0x7d23('0xa'),auth['isAuthenticated'](),controller[_0x7d23('0xb')]);router[_0x7d23('0x9')](_0x7d23('0xc'),auth[_0x7d23('0xd')](),controller[_0x7d23('0xe')]);router[_0x7d23('0x9')]('/presence',auth[_0x7d23('0xd')](),controller[_0x7d23('0xf')]);router[_0x7d23('0x9')](_0x7d23('0x10'),auth['isAuthenticated'](),controller[_0x7d23('0x11')]);router[_0x7d23('0x9')](_0x7d23('0x12'),controller[_0x7d23('0x13')]);router[_0x7d23('0x9')]('/:id/open_tabs',auth[_0x7d23('0xd')](),controller[_0x7d23('0x14')]);router[_0x7d23('0x9')]('/:id/contacts',auth[_0x7d23('0xd')](),controller['getContacts']);router[_0x7d23('0x9')](_0x7d23('0x15'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x16')]);router[_0x7d23('0x9')](_0x7d23('0x17'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x18')]);router[_0x7d23('0x9')](_0x7d23('0x19'),auth['isAuthenticated'](),controller[_0x7d23('0x1a')]);router[_0x7d23('0x9')](_0x7d23('0x1b'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x1c')]);router['get'](_0x7d23('0x1d'),auth['isAuthenticated'](),controller[_0x7d23('0x1e')]);router[_0x7d23('0x9')](_0x7d23('0x1f'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x20')]);router[_0x7d23('0x9')](_0x7d23('0x21'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x22')]);router['get'](_0x7d23('0x23'),auth['isAuthenticated'](),controller[_0x7d23('0x24')]);router['get']('/:id/sms/interactions',auth[_0x7d23('0xd')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth[_0x7d23('0xd')](),controller['getFaxInteractions']);router[_0x7d23('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x7d23('0x25')]);router[_0x7d23('0x9')](_0x7d23('0x26'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x27')]);router['get'](_0x7d23('0x28'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x29')]);router['get'](_0x7d23('0x2a'),auth['isAuthenticated'](),controller[_0x7d23('0x2b')]);router[_0x7d23('0x9')](_0x7d23('0x2c'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x2d')]);router[_0x7d23('0x9')](_0x7d23('0x2e'),auth['isAuthenticated'](),controller[_0x7d23('0x2f')]);router['get'](_0x7d23('0x30'),auth['isAuthenticated'](),controller[_0x7d23('0x31')]);router[_0x7d23('0x9')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x7d23('0x32')]);router['get'](_0x7d23('0x33'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x34')]);router[_0x7d23('0x9')]('/:id/chat_websites',auth[_0x7d23('0xd')](),controller[_0x7d23('0x35')]);router['get'](_0x7d23('0x36'),auth['isAuthenticated'](),controller[_0x7d23('0x37')]);router[_0x7d23('0x9')]('/:id/scheduled_calls',auth[_0x7d23('0xd')](),controller['getScheduledCalls']);router[_0x7d23('0x9')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x7d23('0x38')]);router[_0x7d23('0x39')](_0x7d23('0x3a'),auth['isAuthenticated'](),controller['addContacts']);router[_0x7d23('0x39')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7d23('0x39')](_0x7d23('0x3b'),auth['isAuthenticated'](),controller[_0x7d23('0x3c')]);router[_0x7d23('0x39')]('/:id/queues',auth[_0x7d23('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7d23('0x3d')]({'destination':function(_0x53a10f,_0x3c7c95,_0x24c787){_0x24c787(null,path['join'](config[_0x7d23('0x3e')],_0x7d23('0x3f')));},'filename':function(_0xaf83ad,_0x16799b,_0x240f6e){_0x240f6e(null,util['format']('%s-%s',Date[_0x7d23('0x40')](),_0x16799b['originalname']));}})});router[_0x7d23('0x39')](_0x7d23('0x12'),upload[_0x7d23('0x41')]('file'),controller[_0x7d23('0x42')]);router[_0x7d23('0x39')](_0x7d23('0x43'),auth[_0x7d23('0xd')](),controller['login']);router['post'](_0x7d23('0x44'),auth['isAuthenticated'](),controller['logout']);router[_0x7d23('0x39')]('/:id/pause',auth['isAuthenticated'](),controller[_0x7d23('0x45')]);router[_0x7d23('0x39')](_0x7d23('0x46'),auth[_0x7d23('0xd')](),controller['unpause']);router[_0x7d23('0x39')](_0x7d23('0x26'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x47')]);router[_0x7d23('0x39')](_0x7d23('0x48'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x49')]);router[_0x7d23('0x39')](_0x7d23('0x4a'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x4b')]);router[_0x7d23('0x39')]('/:id/fax_interactions',auth[_0x7d23('0xd')](),controller[_0x7d23('0x4c')]);router[_0x7d23('0x39')](_0x7d23('0x4d'),auth[_0x7d23('0xd')](),controller['addSmsInteractions']);router[_0x7d23('0x39')](_0x7d23('0x4e'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x4f')]);router[_0x7d23('0x39')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x7d23('0x39')](_0x7d23('0x2e'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x50')]);router['post']('/:id/mail_accounts',auth[_0x7d23('0xd')](),controller[_0x7d23('0x51')]);router[_0x7d23('0x39')]('/:id/openchannel_accounts',auth[_0x7d23('0xd')](),controller['addOpenchannelAccounts']);router[_0x7d23('0x39')](_0x7d23('0x33'),auth[_0x7d23('0xd')](),controller['addSmsAccounts']);router[_0x7d23('0x39')](_0x7d23('0x52'),auth[_0x7d23('0xd')](),controller['addChatWebsites']);router[_0x7d23('0x39')](_0x7d23('0x36'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x53')]);router['post'](_0x7d23('0x54'),auth['isAuthenticated'](),controller[_0x7d23('0x55')]);router['put'](_0x7d23('0x10'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x56')]);router[_0x7d23('0x57')](_0x7d23('0x58'),auth[_0x7d23('0xd')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x7d23('0xd')](),controller[_0x7d23('0x59')]);router[_0x7d23('0x5a')](_0x7d23('0x26'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x7d23('0x10'),auth['isAuthenticated'](),controller[_0x7d23('0x5b')]);router[_0x7d23('0x5a')](_0x7d23('0x48'),auth['isAuthenticated'](),controller[_0x7d23('0x5c')]);router[_0x7d23('0x5a')](_0x7d23('0x4a'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x5d')]);router[_0x7d23('0x5a')](_0x7d23('0x5e'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x5f')]);router[_0x7d23('0x5a')](_0x7d23('0x4d'),auth['isAuthenticated'](),controller[_0x7d23('0x60')]);router[_0x7d23('0x5a')](_0x7d23('0x4e'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x61')]);router['delete'](_0x7d23('0x62'),auth[_0x7d23('0xd')](),controller['removeWhatsappInteractions']);router[_0x7d23('0x5a')]('/:id/fax_accounts',auth[_0x7d23('0xd')](),controller[_0x7d23('0x63')]);router['delete'](_0x7d23('0x30'),auth[_0x7d23('0xd')](),controller['removeMailAccounts']);router[_0x7d23('0x5a')](_0x7d23('0x64'),auth[_0x7d23('0xd')](),controller['removeOpenchannelAccounts']);router['delete'](_0x7d23('0x33'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x65')]);router[_0x7d23('0x5a')](_0x7d23('0x52'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x66')]);router['delete'](_0x7d23('0x36'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x67')]);router[_0x7d23('0x5a')](_0x7d23('0x54'),auth[_0x7d23('0xd')](),controller[_0x7d23('0x68')]);router[_0x7d23('0x39')]('/:id/messengerSoundNotification',auth[_0x7d23('0xd')](),controller[_0x7d23('0x69')]);module[_0x7d23('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b61b5d9..ca21e8c 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 _0x2258=['dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','active','actpass','update,nonat','DATE','TEXT','isArray','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','encryption','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','local','accountcode','callerid','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','INTEGER'];(function(_0x3f88b9,_0x212f54){var _0x49f57b=function(_0xde0bb2){while(--_0xde0bb2){_0x3f88b9['push'](_0x3f88b9['shift']());}};_0x49f57b(++_0x212f54);}(_0x2258,0xfe));var _0x8225=function(_0x4f7f74,_0x23df79){_0x4f7f74=_0x4f7f74-0x0;var _0x425467=_0x2258[_0x4f7f74];return _0x425467;};'use strict';var Sequelize=require(_0x8225('0x0'));var moment=require('moment');var util=require(_0x8225('0x1'));var _=require(_0x8225('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x503c21){this[_0x8225('0x3')](_0x8225('0x4'),_0x503c21);this[_0x8225('0x3')](_0x8225('0x5'),_0x503c21);},'comment':_0x8225('0x6')},'fullname':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'set':function(_0x44ecb8){this['setDataValue'](_0x8225('0x8'),_0x44ecb8);this[_0x8225('0x3')]('callerid',util[_0x8225('0x9')](_0x8225('0xa'),_0x44ecb8,this['getDataValue'](_0x8225('0xb'))));}},'alias':{'type':Sequelize[_0x8225('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8225('0xc'),'validate':{'isEmail':!![]},'set':function(_0x485b46){if(_0x485b46){this[_0x8225('0x3')](_0x8225('0xc'),_0x485b46[_0x8225('0xd')]());}}},'role':{'type':Sequelize[_0x8225('0xe')](_0x8225('0xf'),_0x8225('0x10'),_0x8225('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8225('0x7')],'defaultValue':_0x8225('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x8225('0xb'),'set':function(_0x17c04a){this[_0x8225('0x3')](_0x8225('0xb'),_0x17c04a);this[_0x8225('0x3')](_0x8225('0x13'),_0x17c04a);this[_0x8225('0x3')](_0x8225('0x14'),util[_0x8225('0x9')](_0x8225('0xa'),this[_0x8225('0x15')]('fullname'),_0x17c04a));}},'salt':{'type':Sequelize[_0x8225('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8225('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x8225('0x7')]},'city':{'type':Sequelize[_0x8225('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8225('0x7')],'defaultValue':_0x8225('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8225('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x8225('0x1a'),'user',_0x8225('0x1b')),'allowNull':!![],'defaultValue':_0x8225('0x1a')},'context':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x8225('0x1d'),_0x8225('0x1e'),_0x8225('0x1f'),_0x8225('0x20'),_0x8225('0x21'),_0x8225('0x22'),_0x8225('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x24'),'set':function(_0x59c023){this[_0x8225('0x3')]('transport',_0x59c023?_0x59c023[_0x8225('0x25')](','):null);},'get':function(){return this[_0x8225('0x15')](_0x8225('0x26'))?this[_0x8225('0x15')]('transport')[_0x8225('0x27')](','):null;},'comment':_0x8225('0x28')},'dtmfmode':{'type':Sequelize[_0x8225('0xe')]('rfc2833',_0x8225('0x29'),_0x8225('0x2a'),'inband',_0x8225('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x2d'),_0x8225('0x2e'),_0x8225('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x30'),'set':function(_0x47bd05){this[_0x8225('0x3')]('nat',_0x47bd05?_0x47bd05[_0x8225('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x8225('0x31'))?this[_0x8225('0x15')](_0x8225('0x31'))[_0x8225('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x8225('0x7')]},'namedcallgroup':{'type':Sequelize[_0x8225('0x7')]},'pickupgroup':{'type':Sequelize[_0x8225('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x8225('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8225('0x7')]},'disallow':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'defaultValue':_0x8225('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8225('0x33'),'set':function(_0x4210fb){this[_0x8225('0x3')](_0x8225('0x34'),_0x4210fb?_0x4210fb[_0x8225('0x25')](';'):_0x8225('0x33'));},'get':function(){return this['getDataValue'](_0x8225('0x34'))?this[_0x8225('0x15')]('allow')[_0x8225('0x27')](';'):null;},'comment':_0x8225('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'set':function(_0x46d3d0){this[_0x8225('0x3')](_0x8225('0x36'),_0x46d3d0?_0x46d3d0[_0x8225('0x25')](','):null);},'get':function(){return this[_0x8225('0x15')](_0x8225('0x36'))?this[_0x8225('0x15')](_0x8225('0x36'))[_0x8225('0x27')](','):null;},'comment':_0x8225('0x37')},'trustrpid':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x39')},'amaflags':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x3b'),_0x8225('0x3c'),_0x8225('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x3e'),_0x8225('0x3f')),'allowNull':!![],'defaultValue':_0x8225('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x8225('0x2c')},'keepalive':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8225('0xe')]('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8225('0x40'),'passive',_0x8225('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x2d'),_0x8225('0x2e'),_0x8225('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8225('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x8225('0x43')]},'passwordResetAt':{'type':Sequelize[_0x8225('0x43')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8225('0x44')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5f2bfe){this[_0x8225('0x3')]('showWebBar',_0x5f2bfe);var _0x2b738b=this['get']({'plain':!![]});switch(_0x5f2bfe){case 0x0:case 0x1:var _0x297e1a=_0x2b738b[_0x8225('0x26')]?_[_0x8225('0x45')](_0x2b738b[_0x8225('0x26')])?_0x2b738b[_0x8225('0x26')][_0x8225('0x25')]():_0x2b738b[_0x8225('0x26')]:_0x8225('0x24');if(_0x297e1a==='wss'){_0x297e1a=_0x8225('0x24');}this[_0x8225('0x3')](_0x8225('0x26'),_0x297e1a);this[_0x8225('0x3')]('encryption','no');this[_0x8225('0x3')](_0x8225('0x46'),null);this[_0x8225('0x3')](_0x8225('0x47'),null);this[_0x8225('0x3')](_0x8225('0x48'),null);this[_0x8225('0x3')](_0x8225('0x49'),null);this[_0x8225('0x3')](_0x8225('0x4a'),null);this['setDataValue'](_0x8225('0x4b'),null);this['setDataValue'](_0x8225('0x4c'),null);this['setDataValue'](_0x8225('0x4d'),null);this[_0x8225('0x3')](_0x8225('0x4e'),'no');break;case 0x2:this[_0x8225('0x3')]('transport',_0x8225('0x4f'));this[_0x8225('0x3')](_0x8225('0x50'),'yes');this[_0x8225('0x3')](_0x8225('0x46'),_0x8225('0x2c'));this[_0x8225('0x3')](_0x8225('0x47'),'yes');this[_0x8225('0x3')](_0x8225('0x48'),_0x8225('0x2c'));this[_0x8225('0x3')]('dtlsenable',_0x8225('0x2c'));this[_0x8225('0x3')]('dtlsverify','no');this[_0x8225('0x3')](_0x8225('0x4b'),_0x8225('0x41'));this['setDataValue'](_0x8225('0x4c'),_0x2b738b[_0x8225('0x4c')]||_0x8225('0x51'));this[_0x8225('0x3')](_0x8225('0x4d'),_0x2b738b[_0x8225('0x4d')]||_0x8225('0x52'));this['setDataValue'](_0x8225('0x4e'),_0x8225('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x8225('0x44')],'set':function(_0x3ca9b4){this['setDataValue'](_0x8225('0x53'),_0x3ca9b4?_0x3ca9b4[_0x8225('0x25')](','):[]);},'get':function(){return this[_0x8225('0x15')]('permissions')?_[_0x8225('0x54')](this[_0x8225('0x15')](_0x8225('0x53'))[_0x8225('0x27')](','),function(_0x23ea56){return parseInt(_0x23ea56,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8225('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8225('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8225('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8225('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8225('0x55')],'get':function(){return this[_0x8225('0x15')](_0x8225('0x56'))?this[_0x8225('0x15')](_0x8225('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x125627){if(typeof _0x125627===_0x8225('0x57')){var _0x21d1e7=_0x125627==='1'?!![]:_0x125627==='0'?![]:_0x125627===_0x8225('0x58')?!![]:_0x125627==='false'?![]:![];this[_0x8225('0x3')](_0x8225('0x59'),_0x21d1e7);}else{this[_0x8225('0x3')](_0x8225('0x59'),_0x125627);}}},'blocked':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![],'set':function(_0xba31c7){this[_0x8225('0x3')](_0x8225('0x5a'),_0xba31c7);if(_0xba31c7===!![]){this[_0x8225('0x3')](_0x8225('0x5b'),moment());this[_0x8225('0x3')](_0x8225('0x5c'),0x0);}else{this[_0x8225('0x3')](_0x8225('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8225('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x3488=['blocked','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','name','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','dynamic','friend','user','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','active','passive','update,nonat','TEXT','showWebBar','get','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','encryption','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x3488,0x168));var _0x8348=function(_0x2a613c,_0x2d4228){_0x2a613c=_0x2a613c-0x0;var _0x1f024f=_0x3488[_0x2a613c];return _0x1f024f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x8348('0x0'));var _=require(_0x8348('0x1'));module[_0x8348('0x2')]={'name':{'type':Sequelize[_0x8348('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5e348b){this[_0x8348('0x4')](_0x8348('0x5'),_0x5e348b);this[_0x8348('0x4')](_0x8348('0x6'),_0x5e348b);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4e0e6c){this[_0x8348('0x4')](_0x8348('0x7'),_0x4e0e6c);this[_0x8348('0x4')](_0x8348('0x8'),util['format'](_0x8348('0x9'),_0x4e0e6c,this[_0x8348('0xa')](_0x8348('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8348('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2eb2f7){if(_0x2eb2f7){this['setDataValue'](_0x8348('0xc'),_0x2eb2f7['toLowerCase']());}}},'role':{'type':Sequelize[_0x8348('0xd')](_0x8348('0xe'),'user','agent',_0x8348('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x8348('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8348('0x3')],'defaultValue':_0x8348('0x10')},'internal':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':![],'unique':_0x8348('0xb'),'set':function(_0x4f0fb5){this['setDataValue']('internal',_0x4f0fb5);this[_0x8348('0x4')](_0x8348('0x12'),_0x4f0fb5);this[_0x8348('0x4')](_0x8348('0x8'),util['format']('\x22%s\x22\x20<%s>',this[_0x8348('0xa')](_0x8348('0x7')),_0x4f0fb5));}},'salt':{'type':Sequelize[_0x8348('0x3')]},'phone':{'type':Sequelize[_0x8348('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x8348('0x3')]},'zipcode':{'type':Sequelize[_0x8348('0x3')]},'userpic':{'type':Sequelize[_0x8348('0x3')]},'city':{'type':Sequelize[_0x8348('0x3')]},'country':{'type':Sequelize[_0x8348('0x3')]},'online':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8348('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x8348('0x14')]},'chatCapacity':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8348('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8348('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![],'defaultValue':_0x8348('0x15')},'ipaddr':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x8348('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x16'),_0x8348('0x17'),'peer'),'allowNull':!![],'defaultValue':_0x8348('0x16')},'context':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![],'defaultValue':_0x8348('0x18')},'callingpres':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x19'),_0x8348('0x1a'),_0x8348('0x1b'),_0x8348('0x1c'),'PROHIB_NOT_SCREENED',_0x8348('0x1d'),_0x8348('0x1e'),_0x8348('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![],'defaultValue':_0x8348('0x20'),'set':function(_0x2b31b1){this[_0x8348('0x4')]('transport',_0x2b31b1?_0x2b31b1[_0x8348('0x21')](','):null);},'get':function(){return this[_0x8348('0xa')](_0x8348('0x22'))?this['getDataValue'](_0x8348('0x22'))[_0x8348('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x8348('0x24'),_0x8348('0x25'),_0x8348('0x26'),_0x8348('0x27'),_0x8348('0x28')),'allowNull':!![],'defaultValue':_0x8348('0x24')},'directmedia':{'type':Sequelize[_0x8348('0xd')]('yes','no',_0x8348('0x29'),_0x8348('0x2a'),_0x8348('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8348('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8348('0x2c'),'set':function(_0x798501){this[_0x8348('0x4')](_0x8348('0x2d'),_0x798501?_0x798501[_0x8348('0x21')](','):null);},'get':function(){return this[_0x8348('0xa')](_0x8348('0x2d'))?this[_0x8348('0xa')](_0x8348('0x2d'))[_0x8348('0x23')](','):null;},'comment':_0x8348('0x2e')},'callgroup':{'type':Sequelize[_0x8348('0x3')]},'namedcallgroup':{'type':Sequelize[_0x8348('0x3')]},'pickupgroup':{'type':Sequelize[_0x8348('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x8348('0x3')]},'language':{'type':Sequelize[_0x8348('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8348('0x3')]},'disallow':{'type':Sequelize[_0x8348('0x3')],'allowNull':![],'defaultValue':_0x8348('0x2f')},'allow':{'type':Sequelize[_0x8348('0x3')],'allowNull':![],'defaultValue':_0x8348('0x30'),'set':function(_0x453c99){this[_0x8348('0x4')](_0x8348('0x31'),_0x453c99?_0x453c99[_0x8348('0x21')](';'):_0x8348('0x30'));},'get':function(){return this[_0x8348('0xa')](_0x8348('0x31'))?this[_0x8348('0xa')](_0x8348('0x31'))['split'](';'):null;},'comment':_0x8348('0x32')},'autoframing':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![],'set':function(_0xc80fc9){this['setDataValue']('insecure',_0xc80fc9?_0xc80fc9[_0x8348('0x21')](','):null);},'get':function(){return this[_0x8348('0xa')]('insecure')?this[_0x8348('0xa')](_0x8348('0x34'))[_0x8348('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x8348('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no',_0x8348('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x8348('0x33'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![],'defaultValue':_0x8348('0x36')},'amaflags':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8348('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no',_0x8348('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x38'),_0x8348('0x39'),_0x8348('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x8348('0x3b')),'allowNull':!![],'defaultValue':_0x8348('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![],'defaultValue':_0x8348('0x33')},'keepalive':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x8348('0x33'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x8348('0x33'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x8348('0x33'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8348('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x3c'),_0x8348('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8348('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no',_0x8348('0x29'),_0x8348('0x2a'),_0x8348('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8348('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x8348('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8348('0x3f')]},'showWebBar':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0,'set':function(_0x190620){this[_0x8348('0x4')](_0x8348('0x40'),_0x190620);var _0x5df1a8=this[_0x8348('0x41')]({'plain':!![]});switch(_0x190620){case 0x0:case 0x1:var _0x3ce5bf=_0x5df1a8['transport']?_['isArray'](_0x5df1a8[_0x8348('0x22')])?_0x5df1a8[_0x8348('0x22')][_0x8348('0x21')]():_0x5df1a8['transport']:_0x8348('0x20');if(_0x3ce5bf==='wss'){_0x3ce5bf=_0x8348('0x20');}this['setDataValue'](_0x8348('0x22'),_0x3ce5bf);this[_0x8348('0x4')]('encryption','no');this[_0x8348('0x4')](_0x8348('0x42'),null);this['setDataValue'](_0x8348('0x43'),null);this[_0x8348('0x4')](_0x8348('0x44'),null);this['setDataValue'](_0x8348('0x45'),null);this[_0x8348('0x4')](_0x8348('0x46'),null);this[_0x8348('0x4')](_0x8348('0x47'),null);this['setDataValue'](_0x8348('0x48'),null);this[_0x8348('0x4')](_0x8348('0x49'),null);this[_0x8348('0x4')](_0x8348('0x4a'),'no');break;case 0x2:this[_0x8348('0x4')](_0x8348('0x22'),_0x8348('0x4b'));this[_0x8348('0x4')](_0x8348('0x4c'),'yes');this[_0x8348('0x4')](_0x8348('0x42'),_0x8348('0x33'));this[_0x8348('0x4')](_0x8348('0x43'),'yes');this[_0x8348('0x4')](_0x8348('0x44'),_0x8348('0x33'));this[_0x8348('0x4')](_0x8348('0x45'),_0x8348('0x33'));this[_0x8348('0x4')](_0x8348('0x46'),'no');this[_0x8348('0x4')](_0x8348('0x47'),'actpass');this[_0x8348('0x4')](_0x8348('0x48'),_0x5df1a8[_0x8348('0x48')]||_0x8348('0x4d'));this[_0x8348('0x4')](_0x8348('0x49'),_0x5df1a8[_0x8348('0x49')]||_0x8348('0x4e'));this['setDataValue'](_0x8348('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x8348('0x3f')],'set':function(_0x3af950){this[_0x8348('0x4')](_0x8348('0x4f'),_0x3af950?_0x3af950[_0x8348('0x21')](','):[]);},'get':function(){return this[_0x8348('0xa')]('permissions')?_['map'](this['getDataValue'](_0x8348('0x4f'))['split'](','),function(_0x50a19a){return parseInt(_0x50a19a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8348('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8348('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8348('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8348('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8348('0xd')](_0x8348('0x33'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8348('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8348('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x8348('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x8348('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8348('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x210632){if(typeof _0x210632===_0x8348('0x51')){var _0x5028ca=_0x210632==='1'?!![]:_0x210632==='0'?![]:_0x210632===_0x8348('0x52')?!![]:_0x210632===_0x8348('0x53')?![]:![];this[_0x8348('0x4')](_0x8348('0x54'),_0x5028ca);}else{this[_0x8348('0x4')](_0x8348('0x54'),_0x210632);}}},'blocked':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![],'set':function(_0x47e04d){this[_0x8348('0x4')](_0x8348('0x55'),_0x47e04d);if(_0x47e04d===!![]){this[_0x8348('0x4')](_0x8348('0x56'),moment());this[_0x8348('0x4')](_0x8348('0x57'),0x0);}else{this[_0x8348('0x4')](_0x8348('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8348('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8348('0x11')](0x5)[_0x8348('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8348('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8348('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8348('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x8348('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b198fcb..b136325 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 _0xa9e9=['count','set','Content-Range','json','update','then','role','agent','emit','userNotification:recalc:','destroy','get','Users','user','Agents','Telephones','telephone','ignore','map','value','includes','find','name','send','fieldName','type','key','filter','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','User','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','fax','mail','whatsapp','catch','merge','options','sms','all','body','params','addContacts','ids','omit','internal','findById','securePassword','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','password','fullname','email','permissions','101','102','103','110','104','105','108','100','111','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','addQueues','channel','isValidChannel','add','capitalize','toLowerCase','Queues','spread','Queue:save','voice','VoiceQueue','online','interface','SIP/%s','voicePause','penalty','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','isArray','QueueId','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','openchannel','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','rawAttributes','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','updateAttributes','getChannels','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','Voice','upsert','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Team','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$lt','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','firstName','lastName','phone','CmContact','Contact','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','unknown','ringing','teams','queues','toString','lower','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','pause','voiceStatus','unavailable','busy','toUpperCase','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','messengerSoundNotification','enabled','moment','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e9,0x168));var _0x9a9e=function(_0x33ad39,_0x3f5c1b){_0x33ad39=_0x33ad39-0x0;var _0x517f4b=_0xa9e9[_0x33ad39];return _0x517f4b;};'use strict';var moment=require(_0x9a9e('0x0'));var util=require('util');var path=require(_0x9a9e('0x1'));var fs=require('fs');var _=require(_0x9a9e('0x2'));var squel=require(_0x9a9e('0x3'));var Redis=require(_0x9a9e('0x4'));var authService=require(_0x9a9e('0x5'));var contacts=require(_0x9a9e('0x6'));var qs=require('../../components/parsers/qs');var rta=require(_0x9a9e('0x7'));var logger=require(_0x9a9e('0x8'))(_0x9a9e('0x9'));var utils=require(_0x9a9e('0xa'));var config=require('../../config/environment');var licenseUtil=require(_0x9a9e('0xb'));var APIBadRequestError=require(_0x9a9e('0xc'))[_0x9a9e('0xd')];var APINotFoundError=require(_0x9a9e('0xc'))[_0x9a9e('0xe')];var APIHandleError=require(_0x9a9e('0xc'))[_0x9a9e('0xf')];var db=require(_0x9a9e('0x10'))['db'];var socket=require(_0x9a9e('0x11'))(new Redis(config[_0x9a9e('0x12')]));require('./user.socket')['register'](socket);config[_0x9a9e('0x12')]=_[_0x9a9e('0x13')](config[_0x9a9e('0x12')],{'host':_0x9a9e('0x14'),'port':0x18eb});var values;function respondWithStatusCode(_0x4d52f7,_0x4d4805){_0x4d4805=_0x4d4805||0xcc;return function(_0x3092e3){if(_0x3092e3){return _0x4d52f7[_0x9a9e('0x15')](_0x4d4805);}return _0x4d52f7[_0x9a9e('0x16')](_0x4d4805)[_0x9a9e('0x17')]();};}function respondWithResult(_0x3b7810,_0x36141c){_0x36141c=_0x36141c||0xc8;return function(_0x436eca){if(_0x436eca){return _0x3b7810[_0x9a9e('0x16')](_0x36141c)['json'](_0x436eca);}};}function respondWithFilteredResult(_0x3c2095,_0x115de7){return function(_0x5006e5){if(_0x5006e5){var _0x3d447b=typeof _0x115de7[_0x9a9e('0x18')]===_0x9a9e('0x19')&&typeof _0x115de7[_0x9a9e('0x1a')]===_0x9a9e('0x19');var _0x4d2112=_0x5006e5['count'];var _0x34f20f=_0x3d447b?0x0:_0x115de7[_0x9a9e('0x18')];var _0x45c5e0=_0x3d447b?_0x5006e5[_0x9a9e('0x1b')]:_0x115de7['offset']+_0x115de7['limit'];var _0x132fbb;if(_0x45c5e0>=_0x4d2112){_0x45c5e0=_0x4d2112;_0x132fbb=0xc8;}else{_0x132fbb=0xce;}_0x3c2095[_0x9a9e('0x16')](_0x132fbb);return _0x3c2095[_0x9a9e('0x1c')](_0x9a9e('0x1d'),_0x34f20f+'-'+_0x45c5e0+'/'+_0x4d2112)[_0x9a9e('0x1e')](_0x5006e5);}return null;};}function saveUpdates(_0x2652e7){return function(_0x24b06c){if(_0x24b06c){return _0x24b06c[_0x9a9e('0x1f')](_0x2652e7)[_0x9a9e('0x20')](function(_0x2ad965){if(_0x2ad965[_0x9a9e('0x21')]===_0x9a9e('0x22')){socket[_0x9a9e('0x23')](_0x9a9e('0x24')+_0x2ad965['id'],_0x2ad965);}return _0x2ad965;});}return null;};}function removeEntity(_0x4b1c7f){return function(_0x49174a){if(_0x49174a){return _0x49174a[_0x9a9e('0x25')]()['then'](function(){var _0x52bd16=_0x49174a[_0x9a9e('0x26')]({'plain':!![]});if(_0x52bd16[_0x9a9e('0x21')]==='admin')return;var _0x2b1d07=[{'name':_0x9a9e('0x27'),'value':_0x9a9e('0x28'),'ignore':!![]},{'name':_0x9a9e('0x29'),'value':_0x9a9e('0x22'),'ignore':![]},{'name':_0x9a9e('0x2a'),'value':_0x9a9e('0x2b'),'ignore':![]}];var _0x537e55=_(_0x2b1d07)['filter'](_0x9a9e('0x2c'))[_0x9a9e('0x2d')]('value')[_0x9a9e('0x2e')]();if(_[_0x9a9e('0x2f')](_0x537e55,_0x52bd16[_0x9a9e('0x21')])){return;}var _0x187892=_[_0x9a9e('0x30')](_0x2b1d07,[_0x9a9e('0x2e'),_0x52bd16[_0x9a9e('0x21')]])[_0x9a9e('0x31')];return db['UserProfileResource'][_0x9a9e('0x25')]({'where':{'type':_0x187892,'resourceId':_0x52bd16['id']}})[_0x9a9e('0x20')](function(){return _0x49174a;});})[_0x9a9e('0x20')](function(){_0x4b1c7f['status'](0xcc)[_0x9a9e('0x17')]();});}};}function handleEntityNotFound(_0x10a633){return function(_0x58f70c){if(!_0x58f70c){_0x10a633['sendStatus'](0x194);}return _0x58f70c;};}function handleError(_0x180be5,_0x47533e){_0x47533e=_0x47533e||0x1f4;return function(_0x3c196b){logger['error'](_0x3c196b['stack']);if(_0x3c196b[_0x9a9e('0x31')]){delete _0x3c196b[_0x9a9e('0x31')];}_0x180be5[_0x9a9e('0x16')](_0x47533e)[_0x9a9e('0x32')](_0x3c196b);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x9a9e('0x2d')](function(_0x329c68){return{'name':_0x329c68[_0x9a9e('0x33')],'type':_0x329c68[_0x9a9e('0x34')][_0x9a9e('0x35')]};})[_0x9a9e('0x36')](function(_0x59ecaa){return!['password',_0x9a9e('0x37'),_0x9a9e('0x38'),_0x9a9e('0x39'),_0x9a9e('0x3a'),_0x9a9e('0x3b')][_0x9a9e('0x2f')](_0x59ecaa[_0x9a9e('0x31')]);})[_0x9a9e('0x2e')]();}exports[_0x9a9e('0x3c')]=function(_0x264a39,_0x31dc82){var _0x517c7e={},_0x3e7edf={'count':0x0,'rows':[]};var _0x2b6574=getUserAttributes();_0x517c7e=qs[_0x9a9e('0x3d')](_0x2b6574,_0x264a39);var _0x440285={'where':_0x517c7e[_0x9a9e('0x3e')]};return db[_0x9a9e('0x3f')][_0x9a9e('0x1b')](_0x440285)[_0x9a9e('0x20')](function(_0x49a500){_0x3e7edf['count']=_0x49a500;if(_0x264a39['query'][_0x9a9e('0x40')]){_0x517c7e[_0x9a9e('0x41')]=[{'all':!![]}];}if(_0x264a39[_0x9a9e('0x42')][_0x9a9e('0x43')]===_0x9a9e('0x44')){_0x517c7e[_0x9a9e('0x41')]=[{'model':db[_0x9a9e('0x45')],'as':_0x9a9e('0x43')}];}if(!_['includes'](_0x517c7e[_0x9a9e('0x46')],'id')){_0x517c7e[_0x9a9e('0x46')][_0x9a9e('0x47')]('id');}return db[_0x9a9e('0x3f')][_0x9a9e('0x48')](_0x517c7e);})[_0x9a9e('0x20')](function(_0x1f3986){_0x3e7edf[_0x9a9e('0x49')]=_0x1f3986;if(_0x264a39['query'][_0x9a9e('0x4a')]===_0x9a9e('0x44')){var _0x3de245=[];for(var _0x49a2a1=0x0;_0x49a2a1<_0x3e7edf['rows'][_0x9a9e('0x4b')];_0x49a2a1++){_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4c'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245[_0x9a9e('0x47')](get_open_tabs('sms',_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1]['dataValues']));_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1]['dataValues']));_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4f'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245[_0x9a9e('0x47')](get_open_tabs('openchannel',_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245['push'](get_open_tabs(_0x9a9e('0x50'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));}return Promise['all'](_0x3de245)[_0x9a9e('0x20')](function(){return _0x3e7edf;});}else{return _0x3e7edf;}})['then'](respondWithFilteredResult(_0x31dc82,_0x517c7e))[_0x9a9e('0x51')](handleError(_0x31dc82,null));};exports['show']=function(_0x2baee2,_0x16bc0d){var _0x1e1915=getUserAttributes();_0x2baee2[_0x9a9e('0x42')]['id']=_0x2baee2['params']['id'];var _0x1ae2a6=qs[_0x9a9e('0x3d')](_0x1e1915,_0x2baee2);if(_0x2baee2[_0x9a9e('0x42')][_0x9a9e('0x40')]){_0x1ae2a6[_0x9a9e('0x41')]=[{'all':!![]}];}if(_0x2baee2[_0x9a9e('0x42')][_0x9a9e('0x43')]===_0x9a9e('0x44')){_0x1ae2a6[_0x9a9e('0x41')]=[{'model':db['UserSetting'],'as':_0x9a9e('0x43')}];}_0x1ae2a6=_[_0x9a9e('0x52')]({},_0x1ae2a6,_0x2baee2[_0x9a9e('0x53')]);if(!_[_0x9a9e('0x2f')](_0x1ae2a6[_0x9a9e('0x46')],'id')){_0x1ae2a6[_0x9a9e('0x46')][_0x9a9e('0x47')]('id');}return db['User'][_0x9a9e('0x30')](_0x1ae2a6)[_0x9a9e('0x20')](handleEntityNotFound(_0x16bc0d,null))[_0x9a9e('0x20')](function(_0x1b3097){var _0x5bf53c=[];values=_0x1b3097;if(_0x2baee2['query']['openTabs']===_0x9a9e('0x44')){_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('chat',_0x1b3097['dataValues']));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x54'),_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('openchannel',_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('whatsapp',_0x1b3097['dataValues']));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4f'),_0x1b3097[_0x9a9e('0x4d')]));return Promise[_0x9a9e('0x55')](_0x5bf53c);}else{return values;}})[_0x9a9e('0x20')](function(){return values;})[_0x9a9e('0x20')](respondWithResult(_0x16bc0d,null))[_0x9a9e('0x51')](handleError(_0x16bc0d,null));};exports[_0x9a9e('0x1f')]=function(_0x5de696,_0x5c3b1b){if(_0x5de696[_0x9a9e('0x56')]['id']){delete _0x5de696[_0x9a9e('0x56')]['id'];}delete _0x5de696[_0x9a9e('0x56')][_0x9a9e('0x21')];return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x5de696[_0x9a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c3b1b,null))[_0x9a9e('0x20')](saveUpdates(_0x5de696[_0x9a9e('0x56')],null))[_0x9a9e('0x20')](respondWithResult(_0x5c3b1b,null))[_0x9a9e('0x51')](handleError(_0x5c3b1b,null));};exports['describe']=function(_0xf6a6ff,_0x476417){return db[_0x9a9e('0x3f')]['describe']()[_0x9a9e('0x20')](respondWithResult(_0x476417,null))[_0x9a9e('0x51')](handleError(_0x476417,null));};exports['addContacts']=function(_0x21aa16,_0x34efb4){return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x21aa16[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x34efb4,null))[_0x9a9e('0x20')](function(_0x3cd3f4){if(_0x3cd3f4){return _0x3cd3f4[_0x9a9e('0x58')](_0x21aa16[_0x9a9e('0x56')][_0x9a9e('0x59')],_[_0x9a9e('0x5a')](_0x21aa16['body'],[_0x9a9e('0x59'),'id'])||{});}})['then'](respondWithResult(_0x34efb4,null))[_0x9a9e('0x51')](handleError(_0x34efb4,null));};function validateUser(_0x61230a){return new Promise(function(_0x212c54,_0x366651){if(_0x61230a[_0x9a9e('0x5b')])return _0x212c54(_0x61230a);return db['Setting'][_0x9a9e('0x5c')](0x1)[_0x9a9e('0x20')](function(_0x28a09f){if(_0x28a09f[_0x9a9e('0x5d')])authService['validatePasswordPattern'](_0x61230a['password']);db[_0x9a9e('0x3f')]['max'](_0x9a9e('0x5b'))[_0x9a9e('0x20')](function(_0x1153b1){if(_[_0x9a9e('0x5e')](_0x1153b1)){_0x61230a['internal']=_0x28a09f[_0x9a9e('0x5f')]||0x1;return;}if(_[_0x9a9e('0x5e')](_0x28a09f[_0x9a9e('0x5f')])||_0x28a09f[_0x9a9e('0x5f')]===_0x1153b1){_0x61230a[_0x9a9e('0x5b')]=_0x1153b1+0x1;return;}if(_0x28a09f[_0x9a9e('0x5f')]>_0x1153b1){_0x61230a[_0x9a9e('0x5b')]=_0x28a09f[_0x9a9e('0x5f')];return;}return db[_0x9a9e('0x60')][_0x9a9e('0x42')](_0x9a9e('0x61'),{'type':db[_0x9a9e('0x60')][_0x9a9e('0x62')][_0x9a9e('0x63')]})[_0x9a9e('0x20')](function(_0x46f3b2){if(_0x46f3b2&&_0x46f3b2['length']){for(var _0x5d9d7a=0x0,_0x2aa88b=_0x46f3b2[_0x9a9e('0x4b')];_0x5d9d7a<_0x2aa88b&&_[_0x9a9e('0x5e')](_0x61230a[_0x9a9e('0x5b')]);_0x5d9d7a++){if(_0x28a09f[_0x9a9e('0x5f')]<=_0x46f3b2[_0x5d9d7a][_0x9a9e('0x64')]){_0x61230a[_0x9a9e('0x5b')]=_0x46f3b2[_0x5d9d7a]['from'];}else if(_0x28a09f['min_internal']>_0x46f3b2[_0x5d9d7a][_0x9a9e('0x64')]&&_0x28a09f[_0x9a9e('0x5f')]<=_0x46f3b2[_0x5d9d7a]['to']){_0x61230a[_0x9a9e('0x5b')]=_0x28a09f[_0x9a9e('0x5f')];}}}if(_[_0x9a9e('0x5e')](_0x61230a['internal'])){_0x61230a['internal']=_0x1153b1+0x1;}return _0x212c54(_0x61230a);});});})[_0x9a9e('0x51')](function(_0x2bd345){_0x366651(_0x2bd345);});});}function updateUser(_0x3d56f5){return new Promise(function(_0x582d74,_0x415a28){try{if(_0x3d56f5[_0x9a9e('0x65')]){_0x3d56f5['mailbox']=_0x3d56f5[_0x9a9e('0x5b')];_0x3d56f5['VoiceMail']={'mailbox':_0x3d56f5[_0x9a9e('0x5b')],'password':_0x3d56f5[_0x9a9e('0x66')],'fullname':_0x3d56f5[_0x9a9e('0x67')],'email':_0x3d56f5[_0x9a9e('0x68')]};}if(_0x3d56f5[_0x9a9e('0x21')]==='agent'){if(!_0x3d56f5[_0x9a9e('0x69')])_0x3d56f5[_0x9a9e('0x69')]=[_0x9a9e('0x6a'),_0x9a9e('0x6b'),_0x9a9e('0x6c'),'113',_0x9a9e('0x6d'),_0x9a9e('0x6e'),_0x9a9e('0x6f'),'106','107',_0x9a9e('0x70'),'109',_0x9a9e('0x71'),_0x9a9e('0x72'),'114',_0x9a9e('0x73')];}_0x582d74(_0x3d56f5);}catch(_0x19a790){_0x415a28(_0x19a790);}});}exports[_0x9a9e('0x74')]=function(_0x2140c6,_0x42ac80){if(_0x2140c6[_0x9a9e('0x28')]['role']===_0x9a9e('0x22'))throw new Error(_0x9a9e('0x75'));if(_0x2140c6[_0x9a9e('0x56')][_0x9a9e('0x21')]===_0x9a9e('0x28')&&_0x2140c6[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x76')){throw new Error(_0x9a9e('0x77'));}if(_0x2140c6['body'][_0x9a9e('0x21')]===_0x9a9e('0x76')&&_0x2140c6[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x76')){throw new Error(_0x9a9e('0x78'));}return licenseUtil[_0x9a9e('0x79')]([_0x2140c6[_0x9a9e('0x56')]])['then'](function(){return validateUser(_0x2140c6[_0x9a9e('0x56')]);})['then'](function(_0x485ab1){return updateUser(_0x485ab1)[_0x9a9e('0x20')](function(_0x411699){if(_0x411699[_0x9a9e('0x21')]===_0x9a9e('0x76')){_0x411699[_0x9a9e('0x7a')]=_0x2140c6['user']['settingsEnabled'];delete _0x411699[_0x9a9e('0x7b')];}return _0x411699;});})[_0x9a9e('0x20')](function(_0x521e86){return db['User'][_0x9a9e('0x74')](_0x521e86,{'include':[{'model':db['VoiceMail'],'as':_0x9a9e('0x7c')}]});})[_0x9a9e('0x20')](function(_0x1be99d){if(_0x2140c6['body']['role']==='user')return _0x1be99d;if(_0x2140c6[_0x9a9e('0x28')]['role']!=='user')return _0x1be99d;return db['UserProfileSection'][_0x9a9e('0x30')]({'where':{'name':_0x1be99d[_0x9a9e('0x21')]===_0x9a9e('0x22')?_0x9a9e('0x29'):'Telephones','userProfileId':_0x2140c6[_0x9a9e('0x28')]['userProfileId']},'raw':!![]})[_0x9a9e('0x20')](function(_0x1e95f1){if(!_0x1e95f1||_0x1e95f1[_0x9a9e('0x7d')]!=0x0)return _0x1be99d;return db[_0x9a9e('0x7e')][_0x9a9e('0x74')]({'name':_0x1be99d['name'],'resourceId':_0x1be99d['id'],'type':_0x1e95f1[_0x9a9e('0x31')],'sectionId':_0x1e95f1['id']},{})['then'](function(){return _0x1be99d;});})['catch'](function(_0x4aeefd){logger[_0x9a9e('0x7f')](_0x9a9e('0x80'),_0x4aeefd);throw _0x4aeefd;});})['then'](respondWithResult(_0x42ac80,0xc9))['catch'](handleError(_0x42ac80,null));};exports[_0x9a9e('0x81')]=function(_0x14fb97,_0x3a872f){var _0x292ae7=_0x14fb97[_0x9a9e('0x56')];var _0x547324=[];if(_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]===_0x9a9e('0x22'))throw new Error(_0x9a9e('0x75'));if(_[_0x9a9e('0x82')](_0x292ae7,[_0x9a9e('0x21'),_0x9a9e('0x28')])&&_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x9a9e('0x82')](_0x292ae7,['role',_0x9a9e('0x76')])&&_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!=='admin'){throw new Error(_0x9a9e('0x83'));}return licenseUtil['checkUserLimits'](_0x292ae7)['then'](function(){return validateUser(_0x292ae7[0x0]);})[_0x9a9e('0x20')](function(){for(var _0x647621=0x1;_0x647621<_0x292ae7[_0x9a9e('0x4b')];_0x647621++){var _0x5c9337=_0x292ae7[_0x647621-0x1][_0x9a9e('0x5b')];if(!_0x292ae7[_0x647621][_0x9a9e('0x5b')])_0x292ae7[_0x647621]['internal']=_0x5c9337+0x1;_0x547324[_0x9a9e('0x47')](validateUser(_0x292ae7[_0x647621]));}return Promise[_0x9a9e('0x55')](_0x547324);})[_0x9a9e('0x20')](function(){_0x547324=[];for(var _0x3dfff5=0x0;_0x3dfff5<_0x292ae7[_0x9a9e('0x4b')];_0x3dfff5++){_0x547324[_0x9a9e('0x47')](updateUser(_0x292ae7[_0x3dfff5]));}return Promise[_0x9a9e('0x55')](_0x547324);})['then'](function(){_0x547324=_0x292ae7[_0x9a9e('0x2d')](function(_0x354cce){return db['User'][_0x9a9e('0x74')](_0x354cce,{'include':[{'model':db[_0x9a9e('0x7c')],'as':'VoiceMail'}]})[_0x9a9e('0x20')](function(_0x2b3e6a){_0x354cce['id']=_0x2b3e6a['id'];return _0x354cce;});});return Promise[_0x9a9e('0x55')](_0x547324);})[_0x9a9e('0x20')](function(_0x5c7cc0){if(_0x14fb97['body'][_0x9a9e('0x21')]===_0x9a9e('0x28'))return _0x5c7cc0;if(_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x28'))return _0x5c7cc0;var _0x2a331b=_[_0x9a9e('0x82')](_0x5c7cc0,function(_0x388b25){return _0x388b25[_0x9a9e('0x21')]===_0x9a9e('0x22')||_0x388b25['role']==='telephone';});if(!_0x2a331b)return _0x5c7cc0;return db['UserProfileSection'][_0x9a9e('0x48')]({'where':{'name':{'$or':[_0x9a9e('0x29'),_0x9a9e('0x2a')]},'userProfileId':_0x14fb97[_0x9a9e('0x28')]['userProfileId']},'raw':!![]})[_0x9a9e('0x20')](function(_0x6c2b36){if(_[_0x9a9e('0x84')](_0x6c2b36)||!_['some'](_0x6c2b36,['autoAssociation',0x0]))return _0x5c7cc0;_0x547324=[];var _0x1df22e=_(_0x6c2b36)[_0x9a9e('0x2d')](function(_0x1d77ce){if(_0x1d77ce[_0x9a9e('0x7d')]===0x1)return;return _0x1d77ce['name']===_0x9a9e('0x29')?_0x9a9e('0x22'):_0x9a9e('0x2b');})['compact']()[_0x9a9e('0x2e')]();for(var _0x5b89e1=0x0;_0x5b89e1<_0x5c7cc0[_0x9a9e('0x4b')];_0x5b89e1++){if(!_[_0x9a9e('0x2f')](_0x1df22e,_0x5c7cc0[_0x5b89e1]['role']))return;var _0x2a3f73=_0x5c7cc0[_0x5b89e1][_0x9a9e('0x21')]===_0x9a9e('0x22')?'Agents':_0x9a9e('0x2a');_0x547324['push'](db[_0x9a9e('0x7e')][_0x9a9e('0x74')]({'name':_0x5c7cc0[_0x5b89e1][_0x9a9e('0x31')],'resourceId':_0x5c7cc0[_0x5b89e1]['id'],'type':_0x2a3f73,'sectionId':_[_0x9a9e('0x30')](_0x6c2b36,['name',_0x2a3f73])['id']},{}));}return Promise[_0x9a9e('0x55')](_0x547324);});})[_0x9a9e('0x20')](respondWithResult(_0x3a872f,0xc9))[_0x9a9e('0x51')](handleError(_0x3a872f,null));};exports['changePassword']=function(_0x2358a7,_0x290d7c){if(_0x2358a7[_0x9a9e('0x56')]['id']){delete _0x2358a7[_0x9a9e('0x56')]['id'];}return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x2358a7['params']['id']}})['then'](function(_0x5e47a9){if(!_0x5e47a9)return null;if(_0x5e47a9['id']===_0x2358a7['user']['id']){if(!_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x85')]||!_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')]){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x89'));}if(!_0x5e47a9[_0x9a9e('0x8a')](_0x2358a7['body'][_0x9a9e('0x85')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x8b'));}if(_0x2358a7[_0x9a9e('0x56')]['oldPassword']===_0x2358a7['body'][_0x9a9e('0x86')]){throw new db['Sequelize'][(_0x9a9e('0x88'))](_0x9a9e('0x8c'));}}else if(_0x2358a7[_0x9a9e('0x28')][_0x9a9e('0x21')]==='admin'){if(!_0x2358a7[_0x9a9e('0x56')]['newPassword']){throw new db['Sequelize'][(_0x9a9e('0x88'))](_0x9a9e('0x8d'));}}else if(_0x2358a7[_0x9a9e('0x28')][_0x9a9e('0x21')]===_0x9a9e('0x28')){if(!_0x2358a7['body'][_0x9a9e('0x86')]){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5e47a9['role']!==_0x9a9e('0x22')){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x75'));}}else{throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x75'));}return _0x5e47a9;})[_0x9a9e('0x20')](handleEntityNotFound(_0x290d7c,null))[_0x9a9e('0x20')](function(_0x50f6fa){return db[_0x9a9e('0x8e')][_0x9a9e('0x8f')]({'attributes':['id',_0x9a9e('0x5d'),_0x9a9e('0x90'),_0x9a9e('0x91')]})[_0x9a9e('0x20')](function(_0x3bf8d2){if(_0x3bf8d2[_0x9a9e('0x5d')])authService[_0x9a9e('0x92')](_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')]);if(!_0x3bf8d2[_0x9a9e('0x90')]||!_0x50f6fa[_0x9a9e('0x38')])return _0x50f6fa;authService['validatePasswordHistory'](_0x2358a7[_0x9a9e('0x56')]['newPassword'],_0x50f6fa[_0x9a9e('0x38')],_0x3bf8d2[_0x9a9e('0x91')]);return _0x50f6fa;})[_0x9a9e('0x20')](saveUpdates({'password':_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')],'passwordResetAt':_0x2358a7[_0x9a9e('0x28')]['id']==_0x2358a7[_0x9a9e('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')],_0x50f6fa[_0x9a9e('0x38')])},null));})['then'](respondWithResult(_0x290d7c,null))[_0x9a9e('0x51')](handleError(_0x290d7c,null));};exports[_0x9a9e('0x93')]=function(_0x2fa1d6,_0x5b2e54){var _0x1fc7e0=_0x2fa1d6[_0x9a9e('0x56')][_0x9a9e('0x94')];return db['User'][_0x9a9e('0x30')]({'where':{'id':_0x2fa1d6[_0x9a9e('0x57')]['id']},'attributes':['id',_0x9a9e('0x31'),_0x9a9e('0x21'),'online','loginInPause','voicePause','interface']})[_0x9a9e('0x20')](handleEntityNotFound(_0x5b2e54,null))[_0x9a9e('0x20')](function(_0xe409e){if(_0xe409e){if(!utils[_0x9a9e('0x95')](_0x1fc7e0)){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))]('Unknown\x20channel');}return _0xe409e[_0x9a9e('0x96')+_[_0x9a9e('0x97')](_0x1fc7e0[_0x9a9e('0x98')]())+_0x9a9e('0x99')](_0x2fa1d6['body']['ids'],{'penalty':_0x2fa1d6[_0x9a9e('0x56')]['penalty']||0x0})[_0x9a9e('0x9a')](function(_0x400981){for(var _0x5bf56e=0x0;_0x5bf56e<_0x2fa1d6['body'][_0x9a9e('0x59')][_0x9a9e('0x4b')];_0x5bf56e+=0x1){var _0x333405={'UserId':Number(_0x2fa1d6['params']['id'])};_0x333405[_['capitalize'](_0x1fc7e0[_0x9a9e('0x98')]())+'QueueId']=Number(_0x2fa1d6['body'][_0x9a9e('0x59')][_0x5bf56e]);socket['emit'](_0x9a9e('0x28')+_['capitalize'](_0x1fc7e0['toLowerCase']())+_0x9a9e('0x9b'),_0x333405);}return _0x400981;})[_0x9a9e('0x20')](function(){if(_0x1fc7e0===_0x9a9e('0x9c')){return db[_0x9a9e('0x9d')]['findAll']({'where':{'id':_0x2fa1d6[_0x9a9e('0x56')][_0x9a9e('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x82d6c5){var _0x18ed03=_0xe409e[_0x9a9e('0x26')]({'plain':!![]});var _0x3e381b=[];if(_0x1fc7e0===_0x9a9e('0x9c')&&_0x18ed03['role']===_0x9a9e('0x22')&&_0x18ed03[_0x9a9e('0x9e')]){for(let _0x262dd5=0x0;_0x262dd5<_0x82d6c5[_0x9a9e('0x4b')];_0x262dd5+=0x1){_0x3e381b['push']({'membername':_0x18ed03[_0x9a9e('0x31')],'UserId':_0x18ed03['id'],'queue_name':_0x82d6c5[_0x262dd5]['name'],'VoiceQueueId':_0x82d6c5[_0x262dd5]['id'],'interface':_[_0x9a9e('0x5e')](_0x18ed03[_0x9a9e('0x9f')])?util['format'](_0x9a9e('0xa0'),_0x18ed03[_0x9a9e('0x31')]):_0x18ed03[_0x9a9e('0x9f')],'paused':_0x18ed03[_0x9a9e('0xa1')]||![],'penalty':_0x2fa1d6['body'][_0x9a9e('0xa2')]||0x0});}return Promise[_0x9a9e('0x55')](_0x3e381b['map'](function(_0x3dc59f){return db[_0x9a9e('0xa3')]['upsert'](_0x3dc59f);}));}return _0xe409e;});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x5b2e54,null))[_0x9a9e('0x51')](handleError(_0x5b2e54,null));};exports[_0x9a9e('0xa4')]=function(_0x43b481,_0x37dcc2){var _0x5c7c03,_0x3b2757;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x43b481[_0x9a9e('0x57')]['id']},'attributes':['id','name',_0x9a9e('0x21')]})[_0x9a9e('0x20')](handleEntityNotFound(_0x37dcc2,null))[_0x9a9e('0x20')](function(_0x3a63ed){if(_0x3a63ed){_0x5c7c03=_0x3a63ed;if(!_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]||!utils[_0x9a9e('0x95')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xa5'));}return _0x3a63ed[_0x9a9e('0xa6')+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')]['channel'][_0x9a9e('0x98')]())+_0x9a9e('0x99')](_0x43b481['query'][_0x9a9e('0x59')]);}})[_0x9a9e('0x20')](function(_0x70c94){if(_[_0x9a9e('0xa7')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')])){for(var _0xb97bf5=0x0;_0xb97bf5<_0x43b481['query']['ids']['length'];_0xb97bf5+=0x1){_0x3b2757={'UserId':Number(_0x43b481[_0x9a9e('0x57')]['id'])};_0x3b2757[_['capitalize'](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')][_0x9a9e('0x98')]())+_0x9a9e('0xa8')]=Number(_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')][_0xb97bf5]);socket[_0x9a9e('0x23')]('user'+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+_0x9a9e('0xa9'),_0x3b2757);}}else{_0x3b2757={'UserId':Number(_0x43b481['params']['id'])};_0x3b2757[_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+'QueueId']=Number(_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')]);socket[_0x9a9e('0x23')]('user'+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+'Queue:remove',_0x3b2757);}return _0x70c94;})[_0x9a9e('0x20')](function(){if(_0x43b481[_0x9a9e('0x42')]['channel']===_0x9a9e('0x9c')){return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'UserId':_0x43b481[_0x9a9e('0x57')]['id'],'VoiceQueueId':_0x43b481['query'][_0x9a9e('0x59')]},'individualHooks':!![]})[_0x9a9e('0x20')](function(){return _0x5c7c03;});}return _0x5c7c03;})[_0x9a9e('0x20')](respondWithStatusCode(_0x37dcc2,null))[_0x9a9e('0x51')](handleError(_0x37dcc2,null));};exports[_0x9a9e('0xaa')]=function(_0x56a77c,_0x416c4f){_0x56a77c[_0x9a9e('0x56')]['userpic']=_0x56a77c[_0x9a9e('0xab')][_0x9a9e('0xac')];return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x56a77c['params']['id']}})['then'](handleEntityNotFound(_0x416c4f,null))[_0x9a9e('0x20')](saveUpdates(_0x56a77c['body'],null))[_0x9a9e('0x20')](respondWithResult(_0x416c4f,null))[_0x9a9e('0x51')](handleError(_0x416c4f,null));};exports[_0x9a9e('0xad')]=function(_0xf29624,_0x49b3d2){var _0x39835a=path[_0x9a9e('0xae')](config[_0x9a9e('0xaf')],_0x9a9e('0xb0'));return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0xf29624[_0x9a9e('0x57')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9a9e('0x20')](handleEntityNotFound(_0x49b3d2,null))['then'](function(_0x4dde59){if(_0x4dde59){if(_[_0x9a9e('0x5e')](_0x4dde59[_0x9a9e('0xb1')])){return _0x49b3d2[_0x9a9e('0xb2')](_0x39835a);}else{if(!fs[_0x9a9e('0xb3')](path['join'](config[_0x9a9e('0xaf')],'server/files/images/',_0x4dde59[_0x9a9e('0xb1')]))){return _0x49b3d2[_0x9a9e('0xb2')](_0x39835a);}return _0x49b3d2[_0x9a9e('0xb2')](path[_0x9a9e('0xae')](config['root'],_0x9a9e('0xb4'),_0x4dde59[_0x9a9e('0xb1')]));}}})[_0x9a9e('0x51')](handleError(_0x49b3d2,null));};exports[_0x9a9e('0xb5')]=function(_0x36dd0f,_0x4089e9){return db[_0x9a9e('0x3f')]['find']({'where':{'id':_0x36dd0f[_0x9a9e('0x57')]['id']},'attributes':['id']})[_0x9a9e('0x20')](handleEntityNotFound(_0x4089e9,null))[_0x9a9e('0x20')](function(_0x14af92){var _0x1974c3=[];values=_0x14af92[_0x9a9e('0x4d')];_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4c'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x54'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3['push'](get_open_tabs(_0x9a9e('0xb6'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x50'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3['push'](get_open_tabs(_0x9a9e('0x4f'),_0x14af92['dataValues']));return Promise[_0x9a9e('0x55')](_0x1974c3);})[_0x9a9e('0x20')](function(_0x5d55cf){if(_0x5d55cf){var _0x4bc06b=_['map'](values[_0x9a9e('0xb7')],function(_0x5ebc85){return{'channel':_0x9a9e('0xb8'),'id':_0x5ebc85['id'],'createdAt':_0x5ebc85[_0x9a9e('0xb9')]};});var _0xa84480=_[_0x9a9e('0x2d')](values[_0x9a9e('0xba')],function(_0x23de27){return{'channel':_0x9a9e('0xbb'),'id':_0x23de27['id'],'createdAt':_0x23de27['createdAt']};});var _0x42e6f3=_[_0x9a9e('0x2d')](values['OpenchannelOpenTabs'],function(_0x1d9f6e){return{'channel':_0x9a9e('0xbc'),'id':_0x1d9f6e['id'],'createdAt':_0x1d9f6e[_0x9a9e('0xb9')]};});var _0x301d08=_[_0x9a9e('0x2d')](values['MailOpenTabs'],function(_0x29766a){return{'channel':'MAIL','id':_0x29766a['id'],'createdAt':_0x29766a['createdAt']};});var _0x17b957=_[_0x9a9e('0x2d')](values[_0x9a9e('0xbd')],function(_0x188e54){return{'channel':_0x9a9e('0xbe'),'id':_0x188e54['id'],'createdAt':_0x188e54[_0x9a9e('0xb9')]};});var _0x2a5998=_[_0x9a9e('0x2d')](values[_0x9a9e('0xbf')],function(_0x2719b0){return{'channel':'WHATSAPP','id':_0x2719b0['id'],'createdAt':_0x2719b0[_0x9a9e('0xb9')]};});var _0x1928d3=_[_0x9a9e('0xc0')](_0x4bc06b,_0xa84480,_0x42e6f3,_0x301d08,_0x17b957,_0x2a5998);var _0x5ad6fb={'count':_0x1928d3[_0x9a9e('0x4b')],'rows':_0x1928d3};return _0x5ad6fb;}else return null;})['then'](respondWithResult(_0x4089e9,null))['catch'](handleError(_0x4089e9,null));};exports[_0x9a9e('0xc1')]=function(_0x50285f,_0x57f7e0){var _0x5dc14a={};return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x50285f['params']['id']}})[_0x9a9e('0x20')](function(_0x166322){if(!_0x166322){throw new APINotFoundError(util['format'](_0x9a9e('0xc2'),_0x50285f[_0x9a9e('0x57')]['id']));}return contacts['describe']();})['then'](function(_0xaeb3b4){_0x50285f[_0x9a9e('0x42')][_0x9a9e('0x3f')]=_0x50285f[_0x9a9e('0x57')]['id'];_0x5dc14a=qs[_0x9a9e('0x3d')](_0xaeb3b4,_0x50285f);if(_0x50285f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0x40'))){_0x5dc14a[_0x9a9e('0x41')]=[{'model':db[_0x9a9e('0xc4')],'as':_0x9a9e('0xc5'),'required':![]},{'model':db[_0x9a9e('0xc6')],'as':_0x9a9e('0xc7'),'attributes':['id','name',_0x9a9e('0xc8')],'where':_0x50285f[_0x9a9e('0x42')][_0x9a9e('0xc9')]?{'id':_0x50285f[_0x9a9e('0x42')]['tag']}:undefined,'required':_0x50285f['query']['tag']?!![]:![]}];}return contacts[_0x9a9e('0x48')](_0x50285f[_0x9a9e('0x42')],_0x50285f[_0x9a9e('0x28')],_0x5dc14a,_0xaeb3b4);})[_0x9a9e('0x20')](respondWithFilteredResult(_0x57f7e0,_0x5dc14a))[_0x9a9e('0x51')](APIHandleError(_0x57f7e0));};exports[_0x9a9e('0xca')]=function(_0x46bcd4,_0x2d46e0){var _0x43c9d3;var _0x5b162e={};var _0x31ce60;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x46bcd4[_0x9a9e('0x57')]['id']},'attributes':['id','name',_0x9a9e('0x21')]})['then'](handleEntityNotFound(_0x2d46e0,null))['then'](function(_0x1244bc){if(!utils[_0x9a9e('0x95')](_0x46bcd4['query'][_0x9a9e('0x94')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xa5'));}_0x43c9d3=_0x1244bc;var _0x4f274e={};_0x4f274e[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_[_0x9a9e('0x97')](_0x46bcd4['query'][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0xce')]);_0x4f274e[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x46bcd4[_0x9a9e('0x42')]);_0x4f274e[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x4f274e[_0x9a9e('0xcb')],_0x4f274e[_0x9a9e('0x42')]);_0x5b162e[_0x9a9e('0x46')]=_['intersection'](_0x4f274e['model'],qs[_0x9a9e('0xd1')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x5b162e[_0x9a9e('0x46')]=_0x5b162e[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x5b162e[_0x9a9e('0x46')]:_0x4f274e[_0x9a9e('0xcb')];_0x5b162e[_0x9a9e('0xd2')]=qs['sort'](_0x46bcd4['query'][_0x9a9e('0xd3')]);_0x5b162e[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x46bcd4[_0x9a9e('0x42')],_0x4f274e['filters']));if(_0x46bcd4['query'][_0x9a9e('0x36')]){_0x5b162e[_0x9a9e('0x3e')]=_['merge'](_0x5b162e['where'],{'$or':_[_0x9a9e('0x2d')](_0x5b162e[_0x9a9e('0x46')],function(_0x2f0713){var _0x141a99={};_0x141a99[_0x2f0713]={'$like':'%'+_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x141a99;})});}_0x5b162e=_['merge']({},_0x5b162e,_0x46bcd4['options']);switch(_0x43c9d3[_0x9a9e('0x21')]){case _0x9a9e('0x76'):return db[_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0x48')](_0x5b162e);case'user':case _0x9a9e('0x22'):return _0x43c9d3[_0x9a9e('0x26')+_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+'Queues'](_0x5b162e);default:throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xd5'));}})['then'](function(_0xb90e0c){_0x31ce60=_0xb90e0c[_0x9a9e('0x4b')];if(!_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x5b162e[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x46bcd4['query'][_0x9a9e('0x1a')]);_0x5b162e[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x46bcd4['query'][_0x9a9e('0x18')]);}switch(_0x43c9d3['role']){case _0x9a9e('0x76'):return db[_['capitalize'](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0x48')](_0x5b162e);case _0x9a9e('0x28'):case _0x9a9e('0x22'):return _0x43c9d3[_0x9a9e('0x26')+_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0x99')](_0x5b162e);}})[_0x9a9e('0x20')](function(_0x3dc593){return{'count':_0x31ce60,'rows':_0x3dc593};})[_0x9a9e('0x20')](respondWithResult(_0x2d46e0,null))[_0x9a9e('0x51')](handleError(_0x2d46e0,null));};exports[_0x9a9e('0xd7')]=function(_0x4072b1,_0x36a1ee){var _0x3d431f={};var _0x5cb82c={};var _0x48ae11;var _0x21d6e9;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4072b1[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x36a1ee,null))['then'](function(_0x78e26f){if(_0x78e26f){_0x48ae11=_0x78e26f;_0x5cb82c[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xa3')][_0x9a9e('0xce')]);_0x5cb82c['query']=_['keys'](_0x4072b1['query']);_0x5cb82c[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x5cb82c[_0x9a9e('0xcb')],_0x5cb82c[_0x9a9e('0x42')]);_0x3d431f['attributes']=_[_0x9a9e('0xd0')](_0x5cb82c['model'],qs[_0x9a9e('0xd1')](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x3d431f[_0x9a9e('0x46')]=_0x3d431f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x3d431f[_0x9a9e('0x46')]:_0x5cb82c[_0x9a9e('0xcb')];_0x3d431f[_0x9a9e('0xd2')]=qs['sort'](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x3d431f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x4072b1[_0x9a9e('0x42')],_0x5cb82c[_0x9a9e('0xcf')]));if(_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x3d431f[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x3d431f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x3d431f[_0x9a9e('0x46')],function(_0x1fa485){var _0x2538b0={};_0x2538b0[_0x1fa485]={'$like':'%'+_0x4072b1['query'][_0x9a9e('0x36')]+'%'};return _0x2538b0;})});}_0x3d431f=_[_0x9a9e('0x52')]({},_0x3d431f,_0x4072b1[_0x9a9e('0x53')]);return _0x48ae11[_0x9a9e('0xd7')](_0x3d431f);}})['then'](function(_0x226cde){if(_0x226cde){_0x21d6e9=_0x226cde['length'];if(!_0x4072b1['query']['hasOwnProperty']('nolimit')){_0x3d431f[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x4072b1['query'][_0x9a9e('0x1a')]);_0x3d431f[_0x9a9e('0x18')]=qs['offset'](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x48ae11[_0x9a9e('0xd7')](_0x3d431f);}})[_0x9a9e('0x20')](function(_0xf7eb8d){if(_0xf7eb8d){return _0xf7eb8d?{'count':_0x21d6e9,'rows':_0xf7eb8d}:null;}})['then'](respondWithResult(_0x36a1ee,null))[_0x9a9e('0x51')](handleError(_0x36a1ee,null));};exports[_0x9a9e('0xd8')]=function(_0x5065f3,_0x25f509){var _0x1330c5={};var _0x58c54b={};var _0x561ff1;var _0x351d0b;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x5065f3[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x25f509,null))['then'](function(_0x30dab4){if(_0x30dab4){_0x561ff1=_0x30dab4;_0x58c54b[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xd9')][_0x9a9e('0xce')]);_0x58c54b[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x5065f3[_0x9a9e('0x42')]);_0x58c54b['filters']=_[_0x9a9e('0xd0')](_0x58c54b[_0x9a9e('0xcb')],_0x58c54b[_0x9a9e('0x42')]);_0x1330c5[_0x9a9e('0x46')]=_['intersection'](_0x58c54b['model'],qs[_0x9a9e('0xd1')](_0x5065f3['query'][_0x9a9e('0xd1')]));_0x1330c5[_0x9a9e('0x46')]=_0x1330c5[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x1330c5['attributes']:_0x58c54b['model'];_0x1330c5[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x5065f3['query'][_0x9a9e('0xd3')]);_0x1330c5[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x5065f3['query'],_0x58c54b['filters']));if(_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x1330c5[_0x9a9e('0x3e')]=_['merge'](_0x1330c5[_0x9a9e('0x3e')],{'$or':_['map'](_0x1330c5['attributes'],function(_0x27c36a){var _0x17847e={};_0x17847e[_0x27c36a]={'$like':'%'+_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x17847e;})});}_0x1330c5=_[_0x9a9e('0x52')]({},_0x1330c5,_0x5065f3[_0x9a9e('0x53')]);return _0x561ff1[_0x9a9e('0xd8')](_0x1330c5);}})[_0x9a9e('0x20')](function(_0x3b7276){if(_0x3b7276){_0x351d0b=_0x3b7276[_0x9a9e('0x4b')];if(!_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x1330c5[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x1330c5[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x5065f3['query'][_0x9a9e('0x18')]);}return _0x561ff1[_0x9a9e('0xd8')](_0x1330c5);}})[_0x9a9e('0x20')](function(_0x53460d){if(_0x53460d){return _0x53460d?{'count':_0x351d0b,'rows':_0x53460d}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x25f509,null))[_0x9a9e('0x51')](handleError(_0x25f509,null));};exports['getRecordings']=function(_0x1987e7,_0x3ab3d2){var _0x1e333f={'raw':!![],'where':{}};var _0xba6acc={};var _0x32bf9b={'count':0x0,'rows':[]};return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x1987e7['params']['id']}})['then'](handleEntityNotFound(_0x3ab3d2,null))[_0x9a9e('0x20')](function(_0x52578d){if(_0x52578d){_0xba6acc['model']=_['keys'](db['VoiceRecording'][_0x9a9e('0xce')]);_0xba6acc[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1987e7[_0x9a9e('0x42')]);_0xba6acc['filters']=_[_0x9a9e('0xd0')](_0xba6acc['model'],_0xba6acc[_0x9a9e('0x42')]);_0x1e333f[_0x9a9e('0x46')]=_['intersection'](_0xba6acc[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x1e333f[_0x9a9e('0x46')]=_0x1e333f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x1e333f['attributes']:_0xba6acc[_0x9a9e('0xcb')];if(!_0x1987e7[_0x9a9e('0x42')]['hasOwnProperty'](_0x9a9e('0xd6'))){_0x1e333f[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x1987e7['query'][_0x9a9e('0x1a')]);_0x1e333f[_0x9a9e('0x18')]=qs['offset'](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0x18')]);}_0x1e333f[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x1e333f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x1987e7[_0x9a9e('0x42')],_0xba6acc[_0x9a9e('0xcf')]));_0x1e333f[_0x9a9e('0x3e')]['UserId']=_0x52578d['id'];if(_0x1987e7[_0x9a9e('0x42')]['filter']){_0x1e333f[_0x9a9e('0x3e')]=_['merge'](_0x1e333f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x1e333f[_0x9a9e('0x46')],function(_0x2da6f5){var _0x5dbeaf={};_0x5dbeaf[_0x2da6f5]={'$like':'%'+_0x1987e7['query'][_0x9a9e('0x36')]+'%'};return _0x5dbeaf;})});}_0x1e333f=_[_0x9a9e('0x52')]({},_0x1e333f,_0x1987e7[_0x9a9e('0x53')]);return db[_0x9a9e('0xda')]['count']({'where':_0x1e333f['where']})[_0x9a9e('0x20')](function(_0x308a42){_0x32bf9b['count']=_0x308a42;if(_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0x40')]){_0x1e333f[_0x9a9e('0x41')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1e333f);})[_0x9a9e('0x20')](function(_0x5b930b){_0x32bf9b[_0x9a9e('0x49')]=_0x5b930b;return _0x32bf9b;});}})[_0x9a9e('0x20')](respondWithFilteredResult(_0x3ab3d2,_0x1e333f))[_0x9a9e('0x51')](handleError(_0x3ab3d2,null));};exports['getScreenRecordings']=function(_0x3d752f,_0x46b2f8){var _0x563d64={'raw':!![],'where':{}};var _0x1a2166={};var _0x8d04de={'count':0x0,'rows':[]};return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0x3d752f[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x46b2f8,null))[_0x9a9e('0x20')](function(_0x18e428){if(_0x18e428){_0x1a2166[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xdb')][_0x9a9e('0xce')]);_0x1a2166[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x3d752f['query']);_0x1a2166[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1a2166[_0x9a9e('0xcb')],_0x1a2166[_0x9a9e('0x42')]);_0x563d64[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x1a2166['model'],qs['fields'](_0x3d752f[_0x9a9e('0x42')]['fields']));_0x563d64[_0x9a9e('0x46')]=_0x563d64['attributes'][_0x9a9e('0x4b')]?_0x563d64['attributes']:_0x1a2166['model'];if(!_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x563d64[_0x9a9e('0x1a')]=qs['limit'](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x563d64[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x18')]);}_0x563d64[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x563d64[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x3d752f[_0x9a9e('0x42')],_0x1a2166[_0x9a9e('0xcf')]));_0x563d64['where'][_0x9a9e('0xdc')]=_0x18e428['id'];if(_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x563d64['where']=_[_0x9a9e('0x52')](_0x563d64[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x563d64['attributes'],function(_0x15af03){var _0x30beae={};_0x30beae[_0x15af03]={'$like':'%'+_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x30beae;})});}_0x563d64=_[_0x9a9e('0x52')]({},_0x563d64,_0x3d752f[_0x9a9e('0x53')]);return db[_0x9a9e('0xdb')][_0x9a9e('0x1b')]({'where':_0x563d64['where']})[_0x9a9e('0x20')](function(_0x337bb2){_0x8d04de['count']=_0x337bb2;if(_0x3d752f[_0x9a9e('0x42')]['includeAll']){_0x563d64[_0x9a9e('0x41')]=[{'all':!![]}];}return db[_0x9a9e('0xdb')][_0x9a9e('0x48')](_0x563d64);})['then'](function(_0x15e1e0){_0x8d04de['rows']=_0x15e1e0;return _0x8d04de;});}})[_0x9a9e('0x20')](respondWithFilteredResult(_0x46b2f8,_0x563d64))[_0x9a9e('0x51')](handleError(_0x46b2f8,null));};exports[_0x9a9e('0xdd')]=function(_0x3b4eec,_0x259947){var _0x594abb={};var _0x5f4f61={};var _0x43f296;var _0x2a2108;return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0x3b4eec[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x259947,null))[_0x9a9e('0x20')](function(_0x5b7352){if(_0x5b7352){_0x43f296=_0x5b7352;_0x5f4f61[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['ChatInteraction']['rawAttributes']);_0x5f4f61['query']=_[_0x9a9e('0xcc')](_0x3b4eec[_0x9a9e('0x42')]);_0x5f4f61['filters']=_['intersection'](_0x5f4f61[_0x9a9e('0xcb')],_0x5f4f61['query']);_0x594abb['attributes']=_[_0x9a9e('0xd0')](_0x5f4f61['model'],qs['fields'](_0x3b4eec['query'][_0x9a9e('0xd1')]));_0x594abb[_0x9a9e('0x46')]=_0x594abb['attributes'][_0x9a9e('0x4b')]?_0x594abb[_0x9a9e('0x46')]:_0x5f4f61[_0x9a9e('0xcb')];_0x594abb['order']=qs['sort'](_0x3b4eec['query'][_0x9a9e('0xd3')]);_0x594abb['where']=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x3b4eec[_0x9a9e('0x42')],_0x5f4f61[_0x9a9e('0xcf')]));if(_0x3b4eec['query'][_0x9a9e('0x36')]){_0x594abb[_0x9a9e('0x3e')]=_['merge'](_0x594abb[_0x9a9e('0x3e')],{'$or':_['map'](_0x594abb[_0x9a9e('0x46')],function(_0x23d340){var _0x2dc7b5={};_0x2dc7b5[_0x23d340]={'$like':'%'+_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x2dc7b5;})});}_0x594abb=_[_0x9a9e('0x52')]({},_0x594abb,_0x3b4eec[_0x9a9e('0x53')]);return _0x43f296[_0x9a9e('0xdd')](_0x594abb);}})[_0x9a9e('0x20')](function(_0x85be9a){if(_0x85be9a){_0x2a2108=_0x85be9a[_0x9a9e('0x4b')];if(!_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x594abb[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x594abb[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x3b4eec[_0x9a9e('0x42')]['offset']);}return _0x43f296[_0x9a9e('0xdd')](_0x594abb);}})[_0x9a9e('0x20')](function(_0x202613){if(_0x202613){return _0x202613?{'count':_0x2a2108,'rows':_0x202613}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x259947,null))[_0x9a9e('0x51')](handleError(_0x259947,null));};exports[_0x9a9e('0xde')]=function(_0x1679b6,_0x54acc9){var _0x5808d8={};var _0x5a6be2={};var _0x5a3c25;var _0x4de7d8;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x1679b6[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x54acc9,null))[_0x9a9e('0x20')](function(_0x19e735){if(_0x19e735){_0x5a3c25=_0x19e735;_0x5a6be2[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['OpenchannelInteraction']['rawAttributes']);_0x5a6be2[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1679b6[_0x9a9e('0x42')]);_0x5a6be2[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x5a6be2[_0x9a9e('0xcb')],_0x5a6be2[_0x9a9e('0x42')]);_0x5808d8[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x5a6be2[_0x9a9e('0xcb')],qs['fields'](_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x5808d8[_0x9a9e('0x46')]=_0x5808d8['attributes'][_0x9a9e('0x4b')]?_0x5808d8[_0x9a9e('0x46')]:_0x5a6be2['model'];_0x5808d8[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x1679b6[_0x9a9e('0x42')]['sort']);_0x5808d8['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x1679b6[_0x9a9e('0x42')],_0x5a6be2[_0x9a9e('0xcf')]));if(_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x5808d8[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x5808d8[_0x9a9e('0x3e')],{'$or':_['map'](_0x5808d8[_0x9a9e('0x46')],function(_0x2beab5){var _0x460ae7={};_0x460ae7[_0x2beab5]={'$like':'%'+_0x1679b6['query']['filter']+'%'};return _0x460ae7;})});}_0x5808d8=_[_0x9a9e('0x52')]({},_0x5808d8,_0x1679b6['options']);return _0x5a3c25[_0x9a9e('0xde')](_0x5808d8);}})['then'](function(_0xe2b5b2){if(_0xe2b5b2){_0x4de7d8=_0xe2b5b2[_0x9a9e('0x4b')];if(!_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x5808d8[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x5808d8['offset']=qs[_0x9a9e('0x18')](_0x1679b6['query'][_0x9a9e('0x18')]);}return _0x5a3c25['getOpenchannelInteractions'](_0x5808d8);}})[_0x9a9e('0x20')](function(_0x4e0a97){if(_0x4e0a97){return _0x4e0a97?{'count':_0x4de7d8,'rows':_0x4e0a97}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x54acc9,null))[_0x9a9e('0x51')](handleError(_0x54acc9,null));};exports['getMailInteractions']=function(_0x2ef9b0,_0x1437c6){var _0x393ecf={'raw':!![],'where':{}};var _0x17a24a={};var _0x3f3edb={'count':0x0,'rows':[]};return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x2ef9b0[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x1437c6,null))['then'](function(_0x52f5bf){if(_0x52f5bf){_0x17a24a['model']=_[_0x9a9e('0xcc')](db[_0x9a9e('0xdf')][_0x9a9e('0xce')]);_0x17a24a[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x2ef9b0['query']);_0x17a24a[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x17a24a[_0x9a9e('0xcb')],_0x17a24a[_0x9a9e('0x42')]);_0x393ecf[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x17a24a['model'],qs[_0x9a9e('0xd1')](_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x393ecf[_0x9a9e('0x46')]=_0x393ecf[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x393ecf[_0x9a9e('0x46')]:_0x17a24a[_0x9a9e('0xcb')];if(!_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x393ecf[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x393ecf[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x2ef9b0[_0x9a9e('0x42')]['offset']);}_0x393ecf[_0x9a9e('0xd2')]=qs['sort'](_0x2ef9b0[_0x9a9e('0x42')]['sort']);_0x393ecf[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x2ef9b0[_0x9a9e('0x42')],_0x17a24a[_0x9a9e('0xcf')]));_0x393ecf[_0x9a9e('0x3e')][_0x9a9e('0xdc')]=_0x52f5bf['id'];if(_0x2ef9b0['query'][_0x9a9e('0x36')]){_0x393ecf[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x393ecf[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x393ecf[_0x9a9e('0x46')],function(_0x2b7ce3){var _0x42d304={};_0x42d304[_0x2b7ce3]={'$like':'%'+_0x2ef9b0['query']['filter']+'%'};return _0x42d304;})});}_0x393ecf=_[_0x9a9e('0x52')]({},_0x393ecf,_0x2ef9b0[_0x9a9e('0x53')]);return db[_0x9a9e('0xdf')]['count']({'where':_0x393ecf[_0x9a9e('0x3e')]})['then'](function(_0x1f7b21){_0x3f3edb['count']=_0x1f7b21;if(_0x2ef9b0['query'][_0x9a9e('0x40')]){_0x393ecf[_0x9a9e('0x41')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x393ecf);})['then'](function(_0x5428cf){_0x3f3edb[_0x9a9e('0x49')]=_0x5428cf;return _0x3f3edb;});}})['then'](respondWithFilteredResult(_0x1437c6,_0x393ecf))[_0x9a9e('0x51')](handleError(_0x1437c6,null));};exports[_0x9a9e('0xe0')]=function(_0x485e3b,_0x539281){var _0x5d9832={};var _0x1e3056={};var _0xb3ff71;var _0x5c30b2;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x485e3b[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x539281,null))['then'](function(_0x1152bb){if(_0x1152bb){_0xb3ff71=_0x1152bb;_0x1e3056[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xe1')]['rawAttributes']);_0x1e3056['query']=_[_0x9a9e('0xcc')](_0x485e3b[_0x9a9e('0x42')]);_0x1e3056[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1e3056[_0x9a9e('0xcb')],_0x1e3056[_0x9a9e('0x42')]);_0x5d9832['attributes']=_[_0x9a9e('0xd0')](_0x1e3056[_0x9a9e('0xcb')],qs['fields'](_0x485e3b[_0x9a9e('0x42')]['fields']));_0x5d9832['attributes']=_0x5d9832[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x5d9832[_0x9a9e('0x46')]:_0x1e3056[_0x9a9e('0xcb')];_0x5d9832[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x485e3b['query'][_0x9a9e('0xd3')]);_0x5d9832['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x485e3b[_0x9a9e('0x42')],_0x1e3056[_0x9a9e('0xcf')]));if(_0x485e3b['query'][_0x9a9e('0x36')]){_0x5d9832[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x5d9832[_0x9a9e('0x3e')],{'$or':_['map'](_0x5d9832['attributes'],function(_0x389775){var _0x464efd={};_0x464efd[_0x389775]={'$like':'%'+_0x485e3b['query'][_0x9a9e('0x36')]+'%'};return _0x464efd;})});}_0x5d9832=_[_0x9a9e('0x52')]({},_0x5d9832,_0x485e3b[_0x9a9e('0x53')]);return _0xb3ff71[_0x9a9e('0xe0')](_0x5d9832);}})[_0x9a9e('0x20')](function(_0x25ea0a){if(_0x25ea0a){_0x5c30b2=_0x25ea0a['length'];if(!_0x485e3b['query']['hasOwnProperty'](_0x9a9e('0xd6'))){_0x5d9832[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x485e3b['query'][_0x9a9e('0x1a')]);_0x5d9832[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x485e3b[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0xb3ff71[_0x9a9e('0xe0')](_0x5d9832);}})[_0x9a9e('0x20')](function(_0x19ac95){if(_0x19ac95){return _0x19ac95?{'count':_0x5c30b2,'rows':_0x19ac95}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x539281,null))[_0x9a9e('0x51')](handleError(_0x539281,null));};exports[_0x9a9e('0xe2')]=function(_0x466eb2,_0x568f1c){var _0xf85bdf={};var _0x425358={};var _0x2a7fc2;var _0x777070;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x466eb2['params']['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x568f1c,null))[_0x9a9e('0x20')](function(_0x59123f){if(_0x59123f){_0x2a7fc2=_0x59123f;_0x425358[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0xe3')][_0x9a9e('0xce')]);_0x425358[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x466eb2[_0x9a9e('0x42')]);_0x425358[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x425358[_0x9a9e('0xcb')],_0x425358['query']);_0xf85bdf[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x425358[_0x9a9e('0xcb')],qs['fields'](_0x466eb2['query'][_0x9a9e('0xd1')]));_0xf85bdf[_0x9a9e('0x46')]=_0xf85bdf['attributes']['length']?_0xf85bdf[_0x9a9e('0x46')]:_0x425358['model'];_0xf85bdf[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0xf85bdf[_0x9a9e('0x3e')]=qs['filters'](_[_0x9a9e('0xd4')](_0x466eb2[_0x9a9e('0x42')],_0x425358[_0x9a9e('0xcf')]));if(_0x466eb2['query'][_0x9a9e('0x36')]){_0xf85bdf[_0x9a9e('0x3e')]=_['merge'](_0xf85bdf[_0x9a9e('0x3e')],{'$or':_['map'](_0xf85bdf[_0x9a9e('0x46')],function(_0x143b14){var _0x13f8a4={};_0x13f8a4[_0x143b14]={'$like':'%'+_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x13f8a4;})});}_0xf85bdf=_['merge']({},_0xf85bdf,_0x466eb2[_0x9a9e('0x53')]);return _0x2a7fc2['getFaxInteractions'](_0xf85bdf);}})[_0x9a9e('0x20')](function(_0x524413){if(_0x524413){_0x777070=_0x524413['length'];if(!_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0xf85bdf[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x466eb2[_0x9a9e('0x42')]['limit']);_0xf85bdf[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x466eb2[_0x9a9e('0x42')]['offset']);}return _0x2a7fc2[_0x9a9e('0xe2')](_0xf85bdf);}})[_0x9a9e('0x20')](function(_0x40ec0e){if(_0x40ec0e){return _0x40ec0e?{'count':_0x777070,'rows':_0x40ec0e}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x568f1c,null))['catch'](handleError(_0x568f1c,null));};exports[_0x9a9e('0xe4')]=function(_0x4aed4f,_0x21b880){var _0x4ee178={};var _0x1e1d74={};var _0x31a23e;var _0x5f020d;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4aed4f[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x21b880,null))['then'](function(_0x4b888c){if(_0x4b888c){_0x31a23e=_0x4b888c;_0x1e1d74['model']=_[_0x9a9e('0xcc')](db['WhatsappInteraction'][_0x9a9e('0xce')]);_0x1e1d74[_0x9a9e('0x42')]=_['keys'](_0x4aed4f[_0x9a9e('0x42')]);_0x1e1d74[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1e1d74['model'],_0x1e1d74[_0x9a9e('0x42')]);_0x4ee178[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x1e1d74[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x4ee178[_0x9a9e('0x46')]=_0x4ee178[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x4ee178[_0x9a9e('0x46')]:_0x1e1d74[_0x9a9e('0xcb')];_0x4ee178['order']=qs[_0x9a9e('0xd3')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x4ee178[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x4aed4f[_0x9a9e('0x42')],_0x1e1d74['filters']));if(_0x4aed4f[_0x9a9e('0x42')]['filter']){_0x4ee178[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x4ee178[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x4ee178['attributes'],function(_0x331e8c){var _0xa85858={};_0xa85858[_0x331e8c]={'$like':'%'+_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0xa85858;})});}_0x4ee178=_[_0x9a9e('0x52')]({},_0x4ee178,_0x4aed4f[_0x9a9e('0x53')]);return _0x31a23e[_0x9a9e('0xe4')](_0x4ee178);}})['then'](function(_0xb67a79){if(_0xb67a79){_0x5f020d=_0xb67a79['length'];if(!_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x4ee178[_0x9a9e('0x1a')]=qs['limit'](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x4ee178[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x31a23e[_0x9a9e('0xe4')](_0x4ee178);}})['then'](function(_0x13ad77){if(_0x13ad77){return _0x13ad77?{'count':_0x5f020d,'rows':_0x13ad77}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x21b880,null))[_0x9a9e('0x51')](handleError(_0x21b880,null));};exports[_0x9a9e('0xe5')]=function(_0x5734e8,_0x56e909,_0x538b0c){var _0x522687;var _0x1c1ca8;var _0x32fc99;var _0x18c195=!_[_0x9a9e('0x5e')](_0x5734e8[_0x9a9e('0x57')]['id'])?_0x5734e8[_0x9a9e('0x57')]['id']:!_['isNil'](_0x5734e8['user']['id'])?_0x5734e8['user']['id']:null;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x18c195,'role':{'$or':['admin',_0x9a9e('0x28'),_0x9a9e('0x22')]}},'attributes':['id','name','phone',_0x9a9e('0xe6'),_0x9a9e('0x21'),'internal','loginInPause']})[_0x9a9e('0x20')](function(_0x47730c){if(_0x47730c){if(_0x47730c['role']===_0x9a9e('0x22')){_0x522687=_0x47730c;if(_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0x9f')]){_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xe8'),_0x522687[_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0x9f')]]);}else if(_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0xe9')]){_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xa0'),_0x5734e8[_0x9a9e('0x56')]['intrf']);}else{_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xa0'),_0x522687['name']);}socket['to'](util[_0x9a9e('0xe7')](_0x9a9e('0xea'),_0x522687['name']))[_0x9a9e('0x23')](_0x9a9e('0xeb'),{'user':{'id':_0x522687['id'],'name':_0x522687['name']},'ip':_0x5734e8[_0x9a9e('0xec')][_0x9a9e('0xed')]||_0x5734e8[_0x9a9e('0xee')][_0x9a9e('0xef')]||_0x5734e8[_0x9a9e('0xf0')][_0x9a9e('0xef')]||_0x5734e8[_0x9a9e('0xee')]['socket'][_0x9a9e('0xef')]});return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'membername':_0x522687[_0x9a9e('0x31')]},'individualHooks':!![]});}}else{throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xf1'));}})[_0x9a9e('0x20')](function(){if(_0x522687){return _0x522687[_0x9a9e('0xf2')]({'raw':!![]});}})[_0x9a9e('0x20')](function(_0x20b7a0){if(_0x522687){if(_0x20b7a0){_0x1c1ca8=_0x20b7a0;if(_0x1c1ca8[_0x9a9e('0x4b')]){var _0x21382d=_0x1c1ca8[_0x9a9e('0x2d')](function(_0x24ec93){var _0x3d70b1={'membername':_0x522687[_0x9a9e('0x31')],'UserId':_0x522687['id'],'queue_name':_0x24ec93['name'],'VoiceQueueId':_0x24ec93['id'],'interface':_0x32fc99,'paused':_0x522687[_0x9a9e('0xf3')]||![],'penalty':_0x24ec93[_0x9a9e('0xf4')]||0x0};return db[_0x9a9e('0xa3')]['upsert'](_0x3d70b1);});return Promise['all'](_0x21382d);}}}})[_0x9a9e('0x20')](function(){if(_0x522687){return db[_0x9a9e('0xf5')][_0x9a9e('0x48')]({'where':{'membername':_0x522687[_0x9a9e('0x31')],'exitAt':null}});}})['then'](function(_0x57f2bd){if(_0x522687){var _0x23ac30=[];_0x57f2bd[_0x9a9e('0xf6')](function(_0xc9c7c2){_0x23ac30[_0x9a9e('0x47')](_0xc9c7c2[_0x9a9e('0x1f')]({'exitAt':moment()[_0x9a9e('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9a9e('0x55')](_0x23ac30);}})['then'](function(){if(_0x522687){var _0xd207d7=[];var _0x449940=[];var _0x5ac72b=utils['getChannels']();var _0x2fd532={'membername':_0x522687[_0x9a9e('0x31')],'interface':_0x32fc99,'enterAt':moment()['format'](_0x9a9e('0xf7')),'role':_0x522687[_0x9a9e('0x21')],'internal':_0x522687[_0x9a9e('0x5b')]};_0x5ac72b[_0x9a9e('0xf6')](function(_0x36089d){_0xd207d7['push'](_[_0x9a9e('0x52')]({'channel':_0x36089d,'type':'LOGIN','data1':_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0xf8')],'data2':_0x32fc99},_0x2fd532));if(_0x522687[_0x9a9e('0xf3')]){_0x449940[_0x9a9e('0x47')](_[_0x9a9e('0x52')]({'channel':_0x36089d,'type':_0x9a9e('0xf9'),'data1':_0x9a9e('0xfa')},_0x2fd532));}});return db['MemberReport'][_0x9a9e('0x81')](_0xd207d7['concat'](_0x449940),{'individualHooks':!![]});}})[_0x9a9e('0x20')](function(){if(_0x522687){return _0x522687[_0x9a9e('0x1f')]({'online':!![],'lastLoginAt':moment()['format'](_0x9a9e('0xf7')),'voicePause':_0x522687[_0x9a9e('0xf3')]||![],'mailPause':_0x522687[_0x9a9e('0xf3')]||![],'chatPause':_0x522687[_0x9a9e('0xf3')]||![],'faxPause':_0x522687[_0x9a9e('0xf3')]||![],'smsPause':_0x522687['loginInPause']||![],'openchannelPause':_0x522687[_0x9a9e('0xf3')]||![],'whatsappPause':_0x522687[_0x9a9e('0xf3')]||![],'pauseType':_0x522687[_0x9a9e('0xf3')]?_0x9a9e('0xfa'):null,'interface':_0x32fc99,'lastPauseAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))});}})[_0x9a9e('0x20')](function(_0x1f25ef){if(_0x5734e8[_0x9a9e('0xfb')]){return _0x538b0c();}else{return Promise[_0x9a9e('0xfc')](_0x1f25ef)[_0x9a9e('0x20')](respondWithResult(_0x56e909,null));}})[_0x9a9e('0x51')](handleError(_0x56e909,null));};exports['logout']=function(_0x41cc25,_0x44f683){var _0x1f6c21;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x41cc25[_0x9a9e('0x57')]['id'],'role':'agent'},'attributes':['id',_0x9a9e('0x31'),'role']})[_0x9a9e('0x20')](handleEntityNotFound(_0x44f683,null))[_0x9a9e('0x20')](function(_0x529270){if(_0x529270){_0x1f6c21=_0x529270;return db[_0x9a9e('0xa3')]['destroy']({'where':{'membername':_0x1f6c21[_0x9a9e('0x31')]},'individualHooks':!![]});}})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0xf5')]['findAll']({'where':{'membername':_0x1f6c21[_0x9a9e('0x31')],'exitAt':null}});})['then'](function(_0x357ccb){var _0x8b63=[];_0x357ccb[_0x9a9e('0xf6')](function(_0x15c877){_0x8b63['push'](_0x15c877[_0x9a9e('0x1f')]({'exitAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))}));});return Promise[_0x9a9e('0x55')](_0x8b63);})['then'](function(){return _0x1f6c21[_0x9a9e('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x44f683,null))['catch'](handleError(_0x44f683,null));};exports['pause']=function(_0x38dfe1,_0x14a633){var _0x23fc68;return db[_0x9a9e('0xa3')]['update']({'paused':0x1},{'where':{'UserId':_0x38dfe1['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x38dfe1[_0x9a9e('0x57')]['id'],'role':_0x9a9e('0x22')},'attributes':['id','name','role','internal',_0x9a9e('0x9f'),_0x9a9e('0x9e')]});})['then'](handleEntityNotFound(_0x14a633,null))[_0x9a9e('0x20')](function(_0x525f4d){if(_0x525f4d){_0x23fc68=_0x525f4d;return db[_0x9a9e('0xf5')][_0x9a9e('0x48')]({'where':{'membername':_0x23fc68['name'],'type':'PAUSE','exitAt':null}});}})[_0x9a9e('0x20')](function(_0x5324c2){if(_0x5324c2[_0x9a9e('0x4b')]){var _0x1a4062=moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'));for(var _0x3a7aa3=0x0,_0x3ac790=_0x5324c2['length'];_0x3a7aa3<_0x3ac790;_0x3a7aa3++){_0x5324c2[_0x3a7aa3][_0x9a9e('0xfd')]({'exitAt':_0x1a4062});}}})['then'](function(){var _0x4df566=[];var _0x1abc79=utils[_0x9a9e('0xfe')]();_0x1abc79[_0x9a9e('0xf6')](function(_0x11f6ec){_0x4df566[_0x9a9e('0x47')]({'channel':_0x11f6ec,'membername':_0x23fc68[_0x9a9e('0x31')],'interface':_[_0x9a9e('0x5e')](_0x23fc68['interface'])?util['format']('SIP/%s',_0x23fc68[_0x9a9e('0x31')]):_0x23fc68[_0x9a9e('0x9f')],'type':_0x9a9e('0xf9'),'enterAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7')),'data1':_0x38dfe1[_0x9a9e('0x56')]['type']||'DEFAULT\x20PAUSE','role':_0x23fc68[_0x9a9e('0x21')],'internal':_0x23fc68['internal']});});return db[_0x9a9e('0xf5')][_0x9a9e('0x81')](_0x4df566,{'individualHooks':!![]});})['then'](function(){return _0x23fc68[_0x9a9e('0x1f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x38dfe1[_0x9a9e('0x56')][_0x9a9e('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))});})['then'](respondWithResult(_0x14a633,null))[_0x9a9e('0x51')](handleError(_0x14a633,null));};exports[_0x9a9e('0xff')]=function(_0x28687a,_0x3832ee){if(_0x28687a[_0x9a9e('0x56')][_0x9a9e('0x94')]&&!utils[_0x9a9e('0x95')](_0x28687a[_0x9a9e('0x56')][_0x9a9e('0x94')])){throw new APIBadRequestError(util[_0x9a9e('0xe7')](_0x9a9e('0x100'),_0x28687a[_0x9a9e('0x56')]['channel']));}return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x28687a[_0x9a9e('0x57')]['id']},'attributes':['id',_0x9a9e('0x31'),_0x9a9e('0x21'),_0x9a9e('0x5b'),'interface',_0x9a9e('0x9e'),_0x9a9e('0xa1'),_0x9a9e('0x101'),_0x9a9e('0x102'),_0x9a9e('0x103'),_0x9a9e('0x104'),_0x9a9e('0x105'),_0x9a9e('0x106'),_0x9a9e('0x107'),_0x9a9e('0x108')]})[_0x9a9e('0x20')](function(_0xa3eab6){if(!_0xa3eab6){throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x28687a[_0x9a9e('0x57')]['id']));}return _0xa3eab6[_0x9a9e('0xff')](_0x28687a['body']['channel']);})[_0x9a9e('0x20')](respondWithResult(_0x3832ee,null))[_0x9a9e('0x51')](APIHandleError(_0x3832ee));};exports[_0x9a9e('0x109')]=function(_0x4c836c,_0x4a5b84){var _0x199840={};var _0x53d00e={};var _0x227b91;var _0x355833;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4c836c[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x4a5b84,null))[_0x9a9e('0x20')](function(_0x4b1c0d){if(_0x4b1c0d){_0x227b91=_0x4b1c0d;_0x53d00e[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['Team'][_0x9a9e('0xce')]);_0x53d00e[_0x9a9e('0x42')]=_['keys'](_0x4c836c[_0x9a9e('0x42')]);_0x53d00e[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x53d00e[_0x9a9e('0xcb')],_0x53d00e[_0x9a9e('0x42')]);_0x199840['attributes']=_[_0x9a9e('0xd0')](_0x53d00e[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x199840[_0x9a9e('0x46')]=_0x199840[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x199840[_0x9a9e('0x46')]:_0x53d00e[_0x9a9e('0xcb')];_0x199840[_0x9a9e('0xd2')]=qs['sort'](_0x4c836c['query']['sort']);_0x199840['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x4c836c['query'],_0x53d00e['filters']));if(_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x199840[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x199840[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x199840[_0x9a9e('0x46')],function(_0x9b578){var _0x6fbfe2={};_0x6fbfe2[_0x9b578]={'$like':'%'+_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x6fbfe2;})});}_0x199840=_['merge']({},_0x199840,_0x4c836c[_0x9a9e('0x53')]);return _0x227b91[_0x9a9e('0x109')](_0x199840);}})['then'](function(_0x103902){if(_0x103902){_0x355833=_0x103902[_0x9a9e('0x4b')];if(!_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x199840['limit']=qs['limit'](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x199840[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x227b91['getTeams'](_0x199840);}})[_0x9a9e('0x20')](function(_0x1d5e7c){if(_0x1d5e7c){return _0x1d5e7c?{'count':_0x355833,'rows':_0x1d5e7c}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x4a5b84,null))[_0x9a9e('0x51')](handleError(_0x4a5b84,null));};exports['addTeams']=function(_0x119539,_0x582ade){var _0xe30177=_0x119539[_0x9a9e('0x57')]['id'];var _0x5c6f99=_0x119539[_0x9a9e('0x56')]?_0x119539[_0x9a9e('0x56')][_0x9a9e('0x59')]:null;var _0x183cf0=[];return Promise[_0x9a9e('0xfc')]()[_0x9a9e('0x20')](function(){if(!_0x5c6f99)throw new APIBadRequestError(_0x9a9e('0x10a'));})[_0x9a9e('0x20')](function(){return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0xe30177}});})[_0x9a9e('0x20')](function(_0x217955){if(!_0x217955)throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x119539[_0x9a9e('0x57')]['id']));return db[_0x9a9e('0x60')][_0x9a9e('0x10b')](function(_0x57f395){return _0x217955[_0x9a9e('0x10c')](_0x5c6f99,{'transaction':_0x57f395})['then'](function(){return db['Team'][_0x9a9e('0x48')]({'where':{'id':{'$in':_0x5c6f99}}});})[_0x9a9e('0x20')](function(_0x52327c){var _0x586fc0=_[_0x9a9e('0x2d')](_0x52327c,function(_0x5022c3){return _0x5022c3[_0x9a9e('0x10d')]();});return Promise[_0x9a9e('0x55')](_0x586fc0);})[_0x9a9e('0x20')](function(_0x11ebfd){_0x183cf0=_[_0x9a9e('0x10e')](_0x11ebfd);var _0x1d35b2=_[_0x9a9e('0x2d')](_0x183cf0,function(_0x4d1b2f){return _0x4d1b2f[_0x9a9e('0x10f')](_0x217955['id'],{'transaction':_0x57f395});});return Promise[_0x9a9e('0x55')](_0x1d35b2);})[_0x9a9e('0x20')](function(){if(!_0x217955['online'])return;var _0x502a63=_['filter'](_0x183cf0,function(_0x22a5b1){return _0x22a5b1['getDataValue'](_0x9a9e('0x94'))===_0x9a9e('0x110');});var _0x592cdb=_[_0x9a9e('0x2d')](_0x502a63,function(_0x753ef4){return db['UserVoiceQueueRt'][_0x9a9e('0x111')]({'membername':_0x217955[_0x9a9e('0x31')],'UserId':_0x217955['id'],'queue_name':_0x753ef4['name'],'VoiceQueueId':_0x753ef4['id'],'interface':_[_0x9a9e('0x5e')](_0x217955[_0x9a9e('0x9f')])?util['format'](_0x9a9e('0xa0'),_0x217955['name']):_0x217955[_0x9a9e('0x9f')],'paused':_0x217955[_0x9a9e('0xa1')]||![],'penalty':_0x217955[_0x9a9e('0xa2')]},{'transaction':_0x57f395});});return Promise[_0x9a9e('0x55')](_0x592cdb);})[_0x9a9e('0x20')](function(){return db['TeamVoicePrefix'][_0x9a9e('0x48')]({'where':{'teamId':{'$in':_0x5c6f99}}});})['then'](function(_0x18f706){var _0x196e34=_[_0x9a9e('0x2d')](_0x18f706,function(_0xcf1984){return db['UserVoicePrefix']['create']({'UserId':_0x217955['id'],'VoicePrefixId':_0xcf1984['VoicePrefixId']},{'transaction':_0x57f395});});return Promise['all'](_0x196e34);});});})[_0x9a9e('0x20')](function(){for(var _0x4ae16b=0x0;_0x4ae16b<_0x183cf0[_0x9a9e('0x4b')];_0x4ae16b++){var _0x3e236a=_0x183cf0[_0x4ae16b][_0x9a9e('0x112')]('channel');var _0x5086d7=_0x3e236a+_0x9a9e('0xa8');socket[_0x9a9e('0x23')](_0x9a9e('0x28')+_0x3e236a+_0x9a9e('0x9b'),{'UserId':_0xe30177,['queueField']:_0x183cf0[_0x4ae16b]['id']});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x582ade,null))[_0x9a9e('0x51')](APIHandleError(_0x582ade));};exports[_0x9a9e('0x113')]=function(_0x10f0b7,_0x1dcaa2){var _0x30abdc=_0x10f0b7['params']['id'];var _0x17cc80=null;if(_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]){_0x17cc80=_[_0x9a9e('0xa7')](_0x10f0b7[_0x9a9e('0x42')]['ids'])?_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]:[_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]];}var _0x3f2e5a=[];return Promise[_0x9a9e('0xfc')]()['then'](function(){if(!_0x17cc80)throw new APIBadRequestError(_0x9a9e('0x114'));})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x30abdc}});})[_0x9a9e('0x20')](function(_0x2e35df){if(!_0x2e35df)throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x10f0b7[_0x9a9e('0x57')]['id']));return db[_0x9a9e('0x60')]['transaction'](function(_0x243e81){return _0x2e35df['removeTeams'](_0x17cc80,{'transaction':_0x243e81})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x115')]['findAll']({'where':{'id':{'$in':_0x17cc80}}});})[_0x9a9e('0x20')](function(_0x3eed78){var _0x207f46=_[_0x9a9e('0x2d')](_0x3eed78,function(_0x40c315){return _0x40c315[_0x9a9e('0x10d')]();});return Promise['all'](_0x207f46);})[_0x9a9e('0x20')](function(_0x13d2c7){_0x3f2e5a=_[_0x9a9e('0x10e')](_0x13d2c7);var _0x113270=_['map'](_0x3f2e5a,function(_0x50ad50){return _0x50ad50['removeAgent'](_0x2e35df['id'],{'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x113270);})[_0x9a9e('0x20')](function(){if(!_0x2e35df[_0x9a9e('0x9e')])return;var _0x4f2f2d=_[_0x9a9e('0x36')](_0x3f2e5a,function(_0x22dd99){return _0x22dd99['getDataValue'](_0x9a9e('0x94'))===_0x9a9e('0x110');});var _0x182b7c=_[_0x9a9e('0x2d')](_0x4f2f2d,function(_0x5c5639){return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'VoiceQueueId':_0x5c5639['id'],'UserId':_0x2e35df['id']},'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x182b7c);})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x116')][_0x9a9e('0x48')]({'where':{'teamId':{'$in':_0x17cc80}}});})[_0x9a9e('0x20')](function(_0x1c6dca){var _0x42286c=_[_0x9a9e('0x2d')](_0x1c6dca,function(_0x882285){return db[_0x9a9e('0x117')][_0x9a9e('0x25')]({'where':{'UserId':_0x2e35df['id'],'VoicePrefixId':_0x882285[_0x9a9e('0x118')]}},{'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x42286c);});});})[_0x9a9e('0x20')](function(){for(var _0x50b0f8=0x0;_0x50b0f8<_0x3f2e5a[_0x9a9e('0x4b')];_0x50b0f8++){var _0x24f607=_0x3f2e5a[_0x50b0f8][_0x9a9e('0x112')](_0x9a9e('0x94'));var _0x474459=_0x24f607+_0x9a9e('0xa8');socket[_0x9a9e('0x23')](_0x9a9e('0x28')+_0x24f607+'Queue:remove',{'UserId':_0x30abdc,['queueField']:_0x3f2e5a[_0x50b0f8]['id']});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x1dcaa2,null))[_0x9a9e('0x51')](APIHandleError(_0x1dcaa2));};exports[_0x9a9e('0x119')]=function(_0x2a89a9,_0x5b9e2f){var _0x459f4f={};var _0x16342a={};var _0x1c47df;var _0x2ec482;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x2a89a9[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x5b9e2f,null))['then'](function(_0x39d3d4){if(_0x39d3d4){_0x1c47df=_0x39d3d4;_0x16342a[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0xc4')]['rawAttributes']);_0x16342a[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x2a89a9[_0x9a9e('0x42')]);_0x16342a[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x16342a['model'],_0x16342a[_0x9a9e('0x42')]);_0x459f4f[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x16342a[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x459f4f['attributes']=_0x459f4f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x459f4f[_0x9a9e('0x46')]:_0x16342a['model'];_0x459f4f[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x459f4f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x2a89a9[_0x9a9e('0x42')],_0x16342a['filters']));if(_0x2a89a9['query']['filter']){_0x459f4f[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x459f4f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x459f4f['attributes'],function(_0xbaefd3){var _0x157ddf={};_0x157ddf[_0xbaefd3]={'$like':'%'+_0x2a89a9['query'][_0x9a9e('0x36')]+'%'};return _0x157ddf;})});}_0x459f4f=_[_0x9a9e('0x52')]({},_0x459f4f,_0x2a89a9[_0x9a9e('0x53')]);return _0x1c47df['getLists'](_0x459f4f);}})[_0x9a9e('0x20')](function(_0x4a2406){if(_0x4a2406){_0x2ec482=_0x4a2406[_0x9a9e('0x4b')];if(!_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x459f4f['limit']=qs[_0x9a9e('0x1a')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x459f4f['offset']=qs[_0x9a9e('0x18')](_0x2a89a9['query'][_0x9a9e('0x18')]);}return _0x1c47df[_0x9a9e('0x119')](_0x459f4f);}})[_0x9a9e('0x20')](function(_0x420f7c){if(_0x420f7c){return _0x420f7c?{'count':_0x2ec482,'rows':_0x420f7c}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x5b9e2f,null))[_0x9a9e('0x51')](handleError(_0x5b9e2f,null));};exports[_0x9a9e('0x11a')]=function(_0x1d358a,_0x38b299){var _0x324d5c={};var _0x488a50={};var _0x1ac4e4;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x1d358a[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x38b299,null))[_0x9a9e('0x20')](function(_0x1b1b8a){if(_0x1b1b8a){_0x1ac4e4=_0x1b1b8a;_0x488a50[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0x3f')][_0x9a9e('0xce')]);_0x488a50[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1d358a[_0x9a9e('0x42')]);_0x488a50[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x488a50[_0x9a9e('0xcb')],_0x488a50['query']);_0x324d5c[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x488a50[_0x9a9e('0xcb')],qs['fields'](_0x1d358a['query'][_0x9a9e('0xd1')]));_0x324d5c[_0x9a9e('0x46')]=_0x324d5c[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x324d5c[_0x9a9e('0x46')]:_0x488a50[_0x9a9e('0xcb')];_0x324d5c['order']=qs[_0x9a9e('0xd3')](_0x1d358a[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x324d5c['where']=qs['filters'](_[_0x9a9e('0xd4')](_0x1d358a[_0x9a9e('0x42')],_0x488a50[_0x9a9e('0xcf')]));if(_0x1d358a[_0x9a9e('0x42')]['filter']){_0x324d5c[_0x9a9e('0x3e')]=_['merge'](_0x324d5c[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x324d5c['attributes'],function(_0x1f1b84){var _0x3f7365={};_0x3f7365[_0x1f1b84]={'$like':'%'+_0x1d358a[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x3f7365;})});}_0x324d5c[_0x9a9e('0xcb')]=db['User'];_0x324d5c['as']=_0x9a9e('0x29');_0x324d5c=_[_0x9a9e('0x52')]({},_0x324d5c,_0x1d358a[_0x9a9e('0x53')]);return _0x1ac4e4[_0x9a9e('0xf2')]({'include':[_0x324d5c]});}})[_0x9a9e('0x20')](function(_0x231b03){if(_0x231b03){var _0x47e738={},_0x62f6da=[];for(var _0x2bf011=0x0;_0x2bf011<_0x231b03[_0x9a9e('0x4b')];_0x2bf011+=0x1){for(var _0x4069c6=0x0,_0x53f615;_0x4069c6<_0x231b03[_0x2bf011]['Agents'][_0x9a9e('0x4b')];_0x4069c6+=0x1){_0x53f615=_0x231b03[_0x2bf011]['Agents'][_0x4069c6][_0x9a9e('0x26')]({'plain':!![]});_0x47e738[_0x53f615['id']]=_0x53f615;}}_0x47e738=_['values'](_0x47e738);for(var _0x58a6f6=qs[_0x9a9e('0x18')](_0x1d358a[_0x9a9e('0x42')]['offset']);_0x58a6f6<_0x47e738[_0x9a9e('0x4b')]&&_0x62f6da[_0x9a9e('0x4b')]=_0x256e51){_0x596c2f=_0x256e51;_0xbb80af=0xc8;}else{_0xbb80af=0xce;}_0x2eb1c4[_0x1be5('0x16')](_0xbb80af);return _0x2eb1c4[_0x1be5('0x1c')](_0x1be5('0x1d'),_0x3f833a+'-'+_0x596c2f+'/'+_0x256e51)[_0x1be5('0x17')](_0x3fc045);}return null;};}function saveUpdates(_0x262cf8){return function(_0x4ced50){if(_0x4ced50){return _0x4ced50[_0x1be5('0x1e')](_0x262cf8)[_0x1be5('0x1f')](function(_0x481c81){if(_0x481c81[_0x1be5('0x20')]===_0x1be5('0x21')){socket['emit'](_0x1be5('0x22')+_0x481c81['id'],_0x481c81);}return _0x481c81;});}return null;};}function removeEntity(_0x2c7c3d){return function(_0x548234){if(_0x548234){return _0x548234['destroy']()[_0x1be5('0x1f')](function(){var _0x412738=_0x548234[_0x1be5('0x23')]({'plain':!![]});if(_0x412738[_0x1be5('0x20')]===_0x1be5('0x24'))return;var _0x5f3e37=[{'name':_0x1be5('0x25'),'value':'user','ignore':!![]},{'name':_0x1be5('0x26'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x1be5('0x27'),'ignore':![]}];var _0x184adc=_(_0x5f3e37)[_0x1be5('0x28')](_0x1be5('0x29'))['map'](_0x1be5('0x2a'))[_0x1be5('0x2a')]();if(_['includes'](_0x184adc,_0x412738[_0x1be5('0x20')])){return;}var _0x28551d=_['find'](_0x5f3e37,[_0x1be5('0x2a'),_0x412738[_0x1be5('0x20')]])[_0x1be5('0x2b')];return db[_0x1be5('0x2c')][_0x1be5('0x2d')]({'where':{'type':_0x28551d,'resourceId':_0x412738['id']}})['then'](function(){return _0x548234;});})['then'](function(){_0x2c7c3d[_0x1be5('0x16')](0xcc)[_0x1be5('0x15')]();});}};}function handleEntityNotFound(_0x351202){return function(_0x1b1a1e){if(!_0x1b1a1e){_0x351202[_0x1be5('0x14')](0x194);}return _0x1b1a1e;};}function handleError(_0x320ea0,_0x398352){_0x398352=_0x398352||0x1f4;return function(_0x4193b8){logger['error'](_0x4193b8[_0x1be5('0x2e')]);if(_0x4193b8[_0x1be5('0x2b')]){delete _0x4193b8['name'];}_0x320ea0[_0x1be5('0x16')](_0x398352)[_0x1be5('0x2f')](_0x4193b8);};}function getUserAttributes(){return _(db[_0x1be5('0x30')][_0x1be5('0x31')])['map'](function(_0x38b9a3){return{'name':_0x38b9a3[_0x1be5('0x32')],'type':_0x38b9a3[_0x1be5('0x33')][_0x1be5('0x34')]};})[_0x1be5('0x28')](function(_0x5f1945){return![_0x1be5('0x35'),_0x1be5('0x36'),_0x1be5('0x37'),_0x1be5('0x38'),_0x1be5('0x39'),_0x1be5('0x3a')][_0x1be5('0x3b')](_0x5f1945[_0x1be5('0x2b')]);})['value']();}exports['index']=function(_0x210d58,_0x5ee3b0){var _0x1d746d={},_0x9e3131={'count':0x0,'rows':[]};var _0x14d27e=getUserAttributes();_0x1d746d=qs[_0x1be5('0x3c')](_0x14d27e,_0x210d58);var _0x42a314={'where':_0x1d746d[_0x1be5('0x3d')]};return db[_0x1be5('0x30')][_0x1be5('0x1b')](_0x42a314)[_0x1be5('0x1f')](function(_0x21498c){_0x9e3131[_0x1be5('0x1b')]=_0x21498c;if(_0x210d58[_0x1be5('0x3e')][_0x1be5('0x3f')]){_0x1d746d[_0x1be5('0x40')]=[{'all':!![]}];}if(_0x210d58['query'][_0x1be5('0x41')]===_0x1be5('0x42')){_0x1d746d[_0x1be5('0x40')]=[{'model':db['UserSetting'],'as':_0x1be5('0x41')}];}if(!_[_0x1be5('0x3b')](_0x1d746d['attributes'],'id')){_0x1d746d[_0x1be5('0x43')][_0x1be5('0x44')]('id');}return db[_0x1be5('0x30')][_0x1be5('0x45')](_0x1d746d);})[_0x1be5('0x1f')](function(_0x47cb75){_0x9e3131[_0x1be5('0x46')]=_0x47cb75;if(_0x210d58[_0x1be5('0x3e')][_0x1be5('0x47')]===_0x1be5('0x42')){var _0x5408ec=[];for(var _0x45824d=0x0;_0x45824d<_0x9e3131[_0x1be5('0x46')]['length'];_0x45824d++){_0x5408ec[_0x1be5('0x44')](get_open_tabs('chat',_0x9e3131['rows'][_0x45824d][_0x1be5('0x48')]));_0x5408ec['push'](get_open_tabs(_0x1be5('0x49'),_0x9e3131[_0x1be5('0x46')][_0x45824d]['dataValues']));_0x5408ec[_0x1be5('0x44')](get_open_tabs('fax',_0x9e3131[_0x1be5('0x46')][_0x45824d][_0x1be5('0x48')]));_0x5408ec[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x4a'),_0x9e3131[_0x1be5('0x46')][_0x45824d][_0x1be5('0x48')]));_0x5408ec[_0x1be5('0x44')](get_open_tabs('openchannel',_0x9e3131[_0x1be5('0x46')][_0x45824d][_0x1be5('0x48')]));_0x5408ec[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x4b'),_0x9e3131[_0x1be5('0x46')][_0x45824d][_0x1be5('0x48')]));}return Promise[_0x1be5('0x4c')](_0x5408ec)[_0x1be5('0x1f')](function(){return _0x9e3131;});}else{return _0x9e3131;}})[_0x1be5('0x1f')](respondWithFilteredResult(_0x5ee3b0,_0x1d746d))['catch'](handleError(_0x5ee3b0,null));};exports['show']=function(_0x5c6723,_0x3f38b8){var _0x5f3521=getUserAttributes();_0x5c6723['query']['id']=_0x5c6723['params']['id'];var _0x5daa7b=qs[_0x1be5('0x3c')](_0x5f3521,_0x5c6723);if(_0x5c6723[_0x1be5('0x3e')]['includeAll']){_0x5daa7b[_0x1be5('0x40')]=[{'all':!![]}];}if(_0x5c6723[_0x1be5('0x3e')]['userSetting']==='true'){_0x5daa7b[_0x1be5('0x40')]=[{'model':db[_0x1be5('0x4d')],'as':_0x1be5('0x41')}];}_0x5daa7b=_['merge']({},_0x5daa7b,_0x5c6723[_0x1be5('0x4e')]);if(!_[_0x1be5('0x3b')](_0x5daa7b[_0x1be5('0x43')],'id')){_0x5daa7b[_0x1be5('0x43')][_0x1be5('0x44')]('id');}return db[_0x1be5('0x30')][_0x1be5('0x4f')](_0x5daa7b)[_0x1be5('0x1f')](handleEntityNotFound(_0x3f38b8,null))[_0x1be5('0x1f')](function(_0x5a58e4){var _0xdfdb7a=[];values=_0x5a58e4;if(_0x5c6723['query'][_0x1be5('0x47')]===_0x1be5('0x42')){_0xdfdb7a[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x50'),_0x5a58e4[_0x1be5('0x48')]));_0xdfdb7a[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x49'),_0x5a58e4[_0x1be5('0x48')]));_0xdfdb7a['push'](get_open_tabs('openchannel',_0x5a58e4['dataValues']));_0xdfdb7a['push'](get_open_tabs(_0x1be5('0x4b'),_0x5a58e4[_0x1be5('0x48')]));_0xdfdb7a[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x51'),_0x5a58e4[_0x1be5('0x48')]));_0xdfdb7a[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x4a'),_0x5a58e4['dataValues']));return Promise['all'](_0xdfdb7a);}else{return values;}})[_0x1be5('0x1f')](function(){return values;})['then'](respondWithResult(_0x3f38b8,null))['catch'](handleError(_0x3f38b8,null));};exports[_0x1be5('0x1e')]=function(_0x1268fe,_0x151072){if(_0x1268fe['body']['id']){delete _0x1268fe[_0x1be5('0x52')]['id'];}delete _0x1268fe[_0x1be5('0x52')][_0x1be5('0x20')];return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x1268fe[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x151072,null))[_0x1be5('0x1f')](saveUpdates(_0x1268fe[_0x1be5('0x52')],null))['then'](respondWithResult(_0x151072,null))[_0x1be5('0x54')](handleError(_0x151072,null));};exports['describe']=function(_0x483424,_0x175339){return db[_0x1be5('0x30')]['describe']()[_0x1be5('0x1f')](respondWithResult(_0x175339,null))[_0x1be5('0x54')](handleError(_0x175339,null));};exports['addContacts']=function(_0x254c6d,_0x794130){return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x254c6d['params']['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x794130,null))['then'](function(_0x31de77){if(_0x31de77){return _0x31de77[_0x1be5('0x55')](_0x254c6d[_0x1be5('0x52')]['ids'],_[_0x1be5('0x56')](_0x254c6d['body'],[_0x1be5('0x57'),'id'])||{});}})[_0x1be5('0x1f')](respondWithResult(_0x794130,null))[_0x1be5('0x54')](handleError(_0x794130,null));};function validateUser(_0x1425ad){return new Promise(function(_0x38a646,_0x1f9566){if(_0x1425ad['internal'])return _0x38a646(_0x1425ad);return db['Setting'][_0x1be5('0x58')](0x1)[_0x1be5('0x1f')](function(_0x3376c8){if(_0x3376c8[_0x1be5('0x59')])authService[_0x1be5('0x5a')](_0x1425ad['password']);db[_0x1be5('0x30')]['max']('internal')[_0x1be5('0x1f')](function(_0x46c4da){if(_[_0x1be5('0x5b')](_0x46c4da)){_0x1425ad['internal']=_0x3376c8[_0x1be5('0x5c')]||0x1;return;}if(_[_0x1be5('0x5b')](_0x3376c8['min_internal'])||_0x3376c8[_0x1be5('0x5c')]===_0x46c4da){_0x1425ad[_0x1be5('0x5d')]=_0x46c4da+0x1;return;}if(_0x3376c8['min_internal']>_0x46c4da){_0x1425ad['internal']=_0x3376c8[_0x1be5('0x5c')];return;}return db['sequelize'][_0x1be5('0x3e')](_0x1be5('0x5e'),{'type':db[_0x1be5('0x5f')]['QueryTypes'][_0x1be5('0x60')]})['then'](function(_0x37e200){if(_0x37e200&&_0x37e200[_0x1be5('0x61')]){for(var _0x4efe3d=0x0,_0x3a8742=_0x37e200[_0x1be5('0x61')];_0x4efe3d<_0x3a8742&&_[_0x1be5('0x5b')](_0x1425ad[_0x1be5('0x5d')]);_0x4efe3d++){if(_0x3376c8[_0x1be5('0x5c')]<=_0x37e200[_0x4efe3d]['from']){_0x1425ad[_0x1be5('0x5d')]=_0x37e200[_0x4efe3d][_0x1be5('0x62')];}else if(_0x3376c8[_0x1be5('0x5c')]>_0x37e200[_0x4efe3d][_0x1be5('0x62')]&&_0x3376c8[_0x1be5('0x5c')]<=_0x37e200[_0x4efe3d]['to']){_0x1425ad[_0x1be5('0x5d')]=_0x3376c8['min_internal'];}}}if(_[_0x1be5('0x5b')](_0x1425ad[_0x1be5('0x5d')])){_0x1425ad[_0x1be5('0x5d')]=_0x46c4da+0x1;}return _0x38a646(_0x1425ad);});});})['catch'](function(_0xa55a26){_0x1f9566(_0xa55a26);});});}function updateUser(_0x3b749e){return new Promise(function(_0x5af72b,_0x316c3b){try{if(_0x3b749e['voicemail']){_0x3b749e[_0x1be5('0x63')]=_0x3b749e['internal'];_0x3b749e[_0x1be5('0x64')]={'mailbox':_0x3b749e[_0x1be5('0x5d')],'password':_0x3b749e[_0x1be5('0x35')],'fullname':_0x3b749e['fullname'],'email':_0x3b749e[_0x1be5('0x65')]};}if(_0x3b749e['role']===_0x1be5('0x21')){if(!_0x3b749e[_0x1be5('0x66')])_0x3b749e[_0x1be5('0x66')]=[_0x1be5('0x67'),_0x1be5('0x68'),'103',_0x1be5('0x69'),'110',_0x1be5('0x6a'),_0x1be5('0x6b'),'106',_0x1be5('0x6c'),_0x1be5('0x6d'),_0x1be5('0x6e'),_0x1be5('0x6f'),_0x1be5('0x70'),_0x1be5('0x71'),_0x1be5('0x72')];}_0x5af72b(_0x3b749e);}catch(_0x574996){_0x316c3b(_0x574996);}});}exports[_0x1be5('0x73')]=function(_0x4e03ff,_0x60a082){if(_0x4e03ff['user'][_0x1be5('0x20')]===_0x1be5('0x21'))throw new Error(_0x1be5('0x74'));if(_0x4e03ff[_0x1be5('0x52')][_0x1be5('0x20')]===_0x1be5('0x75')&&_0x4e03ff[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x24')){throw new Error(_0x1be5('0x76'));}if(_0x4e03ff[_0x1be5('0x52')][_0x1be5('0x20')]==='admin'&&_0x4e03ff[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x24')){throw new Error(_0x1be5('0x77'));}return licenseUtil[_0x1be5('0x78')]([_0x4e03ff[_0x1be5('0x52')]])[_0x1be5('0x1f')](function(){return validateUser(_0x4e03ff[_0x1be5('0x52')]);})[_0x1be5('0x1f')](function(_0x421de4){return updateUser(_0x421de4)[_0x1be5('0x1f')](function(_0x5d4d72){if(_0x5d4d72[_0x1be5('0x20')]===_0x1be5('0x24')){_0x5d4d72[_0x1be5('0x79')]=_0x4e03ff['user'][_0x1be5('0x79')];delete _0x5d4d72[_0x1be5('0x7a')];}return _0x5d4d72;});})['then'](function(_0x3997b7){return db['User'][_0x1be5('0x73')](_0x3997b7,{'include':[{'model':db['VoiceMail'],'as':_0x1be5('0x64')}]});})['then'](function(_0x5912ee){if(_0x4e03ff['body'][_0x1be5('0x20')]===_0x1be5('0x75'))return _0x5912ee;if(_0x4e03ff[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x75'))return _0x5912ee;return db['UserProfileSection'][_0x1be5('0x4f')]({'where':{'name':_0x5912ee[_0x1be5('0x20')]===_0x1be5('0x21')?'Agents':_0x1be5('0x7b'),'userProfileId':_0x4e03ff['user'][_0x1be5('0x7a')]},'raw':!![]})['then'](function(_0x174819){if(!_0x174819||_0x174819[_0x1be5('0x7c')]!=0x0)return _0x5912ee;return db[_0x1be5('0x2c')][_0x1be5('0x73')]({'name':_0x5912ee['name'],'resourceId':_0x5912ee['id'],'type':_0x174819['name'],'sectionId':_0x174819['id']},{})[_0x1be5('0x1f')](function(){return _0x5912ee;});})[_0x1be5('0x54')](function(_0x4ce188){logger[_0x1be5('0x7d')](_0x1be5('0x7e'),_0x4ce188);throw _0x4ce188;});})[_0x1be5('0x1f')](respondWithResult(_0x60a082,0xc9))['catch'](handleError(_0x60a082,null));};exports['bulkCreate']=function(_0x2a8243,_0x1388f8){var _0xb2dd0b=_0x2a8243['body'];var _0x139a71=[];if(_0x2a8243['user'][_0x1be5('0x20')]===_0x1be5('0x21'))throw new Error(_0x1be5('0x74'));if(_[_0x1be5('0x7f')](_0xb2dd0b,[_0x1be5('0x20'),_0x1be5('0x75')])&&_0x2a8243[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x24')){throw new Error(_0x1be5('0x76'));}if(_['some'](_0xb2dd0b,[_0x1be5('0x20'),_0x1be5('0x24')])&&_0x2a8243[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x24')){throw new Error(_0x1be5('0x80'));}return licenseUtil[_0x1be5('0x78')](_0xb2dd0b)['then'](function(){return validateUser(_0xb2dd0b[0x0]);})[_0x1be5('0x1f')](function(){for(var _0x173911=0x1;_0x173911<_0xb2dd0b[_0x1be5('0x61')];_0x173911++){var _0x23a5e4=_0xb2dd0b[_0x173911-0x1][_0x1be5('0x5d')];if(!_0xb2dd0b[_0x173911]['internal'])_0xb2dd0b[_0x173911][_0x1be5('0x5d')]=_0x23a5e4+0x1;_0x139a71['push'](validateUser(_0xb2dd0b[_0x173911]));}return Promise[_0x1be5('0x4c')](_0x139a71);})[_0x1be5('0x1f')](function(){_0x139a71=[];for(var _0x289978=0x0;_0x289978<_0xb2dd0b[_0x1be5('0x61')];_0x289978++){_0x139a71[_0x1be5('0x44')](updateUser(_0xb2dd0b[_0x289978]));}return Promise['all'](_0x139a71);})[_0x1be5('0x1f')](function(){_0x139a71=_0xb2dd0b[_0x1be5('0x81')](function(_0x1c83ce){return db[_0x1be5('0x30')][_0x1be5('0x73')](_0x1c83ce,{'include':[{'model':db[_0x1be5('0x64')],'as':_0x1be5('0x64')}]})[_0x1be5('0x1f')](function(_0x1dc353){_0x1c83ce['id']=_0x1dc353['id'];return _0x1c83ce;});});return Promise[_0x1be5('0x4c')](_0x139a71);})['then'](function(_0x1c46b2){if(_0x2a8243[_0x1be5('0x52')][_0x1be5('0x20')]===_0x1be5('0x75'))return _0x1c46b2;if(_0x2a8243[_0x1be5('0x75')][_0x1be5('0x20')]!==_0x1be5('0x75'))return _0x1c46b2;var _0x3c542b=_['some'](_0x1c46b2,function(_0x248d8c){return _0x248d8c[_0x1be5('0x20')]==='agent'||_0x248d8c[_0x1be5('0x20')]===_0x1be5('0x27');});if(!_0x3c542b)return _0x1c46b2;return db[_0x1be5('0x82')][_0x1be5('0x45')]({'where':{'name':{'$or':['Agents',_0x1be5('0x7b')]},'userProfileId':_0x2a8243[_0x1be5('0x75')]['userProfileId']},'raw':!![]})[_0x1be5('0x1f')](function(_0x193b41){if(_['isEmpty'](_0x193b41)||!_['some'](_0x193b41,['autoAssociation',0x0]))return _0x1c46b2;_0x139a71=[];var _0x5df78a=_(_0x193b41)['map'](function(_0x217615){if(_0x217615['autoAssociation']===0x1)return;return _0x217615['name']==='Agents'?'agent':_0x1be5('0x27');})[_0x1be5('0x83')]()[_0x1be5('0x2a')]();for(var _0x462546=0x0;_0x462546<_0x1c46b2[_0x1be5('0x61')];_0x462546++){if(!_[_0x1be5('0x3b')](_0x5df78a,_0x1c46b2[_0x462546]['role']))return;var _0x2d152c=_0x1c46b2[_0x462546]['role']===_0x1be5('0x21')?'Agents':_0x1be5('0x7b');_0x139a71['push'](db[_0x1be5('0x2c')][_0x1be5('0x73')]({'name':_0x1c46b2[_0x462546][_0x1be5('0x2b')],'resourceId':_0x1c46b2[_0x462546]['id'],'type':_0x2d152c,'sectionId':_['find'](_0x193b41,['name',_0x2d152c])['id']},{}));}return Promise[_0x1be5('0x4c')](_0x139a71);});})[_0x1be5('0x1f')](respondWithResult(_0x1388f8,0xc9))[_0x1be5('0x54')](handleError(_0x1388f8,null));};exports['changePassword']=function(_0x69287a,_0x537840){if(_0x69287a[_0x1be5('0x52')]['id']){delete _0x69287a['body']['id'];}return db['User']['find']({'where':{'id':_0x69287a[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](function(_0x57112f){if(!_0x57112f)return null;if(_0x57112f['id']===_0x69287a[_0x1be5('0x75')]['id']){if(!_0x69287a['body'][_0x1be5('0x84')]||!_0x69287a[_0x1be5('0x52')][_0x1be5('0x85')]){throw new db['Sequelize'][(_0x1be5('0x86'))](_0x1be5('0x87'));}if(!_0x57112f[_0x1be5('0x88')](_0x69287a[_0x1be5('0x52')]['oldPassword'])){throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))](_0x1be5('0x8a'));}if(_0x69287a[_0x1be5('0x52')]['oldPassword']===_0x69287a[_0x1be5('0x52')][_0x1be5('0x85')]){throw new db[(_0x1be5('0x89'))]['ValidationError'](_0x1be5('0x8b'));}}else if(_0x69287a['user'][_0x1be5('0x20')]==='admin'){if(!_0x69287a[_0x1be5('0x52')]['newPassword']){throw new db['Sequelize'][(_0x1be5('0x86'))](_0x1be5('0x8c'));}}else if(_0x69287a[_0x1be5('0x75')][_0x1be5('0x20')]==='user'){if(!_0x69287a['body'][_0x1be5('0x85')]){throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x57112f[_0x1be5('0x20')]!==_0x1be5('0x21')){throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))](_0x1be5('0x74'));}}else{throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))]('Unauthorized');}return _0x57112f;})[_0x1be5('0x1f')](handleEntityNotFound(_0x537840,null))[_0x1be5('0x1f')](function(_0x58ae68){return db['Setting'][_0x1be5('0x8d')]({'attributes':['id',_0x1be5('0x59'),_0x1be5('0x8e'),_0x1be5('0x8f')]})[_0x1be5('0x1f')](function(_0x494a96){if(_0x494a96['securePassword'])authService[_0x1be5('0x5a')](_0x69287a[_0x1be5('0x52')][_0x1be5('0x85')]);if(!_0x494a96[_0x1be5('0x8e')]||!_0x58ae68['previousPasswords'])return _0x58ae68;authService['validatePasswordHistory'](_0x69287a[_0x1be5('0x52')][_0x1be5('0x85')],_0x58ae68[_0x1be5('0x37')],_0x494a96[_0x1be5('0x8f')]);return _0x58ae68;})[_0x1be5('0x1f')](saveUpdates({'password':_0x69287a['body'][_0x1be5('0x85')],'passwordResetAt':_0x69287a[_0x1be5('0x75')]['id']==_0x69287a[_0x1be5('0x53')]['id']?moment():null,'previousPasswords':authService[_0x1be5('0x90')](_0x69287a[_0x1be5('0x52')][_0x1be5('0x85')],_0x58ae68[_0x1be5('0x37')])},null));})[_0x1be5('0x1f')](respondWithResult(_0x537840,null))['catch'](handleError(_0x537840,null));};exports[_0x1be5('0x91')]=function(_0x2dea03,_0x550c00){var _0x3037e5=_0x2dea03['body'][_0x1be5('0x92')];return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x2dea03['params']['id']},'attributes':['id',_0x1be5('0x2b'),_0x1be5('0x20'),_0x1be5('0x93'),_0x1be5('0x94'),_0x1be5('0x95'),_0x1be5('0x96')]})[_0x1be5('0x1f')](handleEntityNotFound(_0x550c00,null))[_0x1be5('0x1f')](function(_0x360df4){if(_0x360df4){if(!utils['isValidChannel'](_0x3037e5)){throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))](_0x1be5('0x97'));}return _0x360df4['add'+_[_0x1be5('0x98')](_0x3037e5[_0x1be5('0x99')]())+_0x1be5('0x9a')](_0x2dea03[_0x1be5('0x52')][_0x1be5('0x57')],{'penalty':_0x2dea03[_0x1be5('0x52')][_0x1be5('0x9b')]||0x0})[_0x1be5('0x9c')](function(_0x162e47){for(var _0xab7b9b=0x0;_0xab7b9b<_0x2dea03[_0x1be5('0x52')][_0x1be5('0x57')]['length'];_0xab7b9b+=0x1){var _0x5805fb={'UserId':Number(_0x2dea03['params']['id'])};_0x5805fb[_['capitalize'](_0x3037e5[_0x1be5('0x99')]())+_0x1be5('0x9d')]=Number(_0x2dea03[_0x1be5('0x52')][_0x1be5('0x57')][_0xab7b9b]);socket[_0x1be5('0x9e')]('user'+_[_0x1be5('0x98')](_0x3037e5[_0x1be5('0x99')]())+_0x1be5('0x9f'),_0x5805fb);}return _0x162e47;})[_0x1be5('0x1f')](function(){if(_0x3037e5==='voice'){return db[_0x1be5('0xa0')][_0x1be5('0x45')]({'where':{'id':_0x2dea03[_0x1be5('0x52')][_0x1be5('0x57')]||[]},'raw':!![],'attributes':['id',_0x1be5('0x2b')]});}})[_0x1be5('0x1f')](function(_0x36a399){var _0x39936e=_0x360df4[_0x1be5('0x23')]({'plain':!![]});var _0x4ef3af=[];if(_0x3037e5===_0x1be5('0xa1')&&_0x39936e[_0x1be5('0x20')]==='agent'&&_0x39936e[_0x1be5('0x93')]){for(let _0x2269d0=0x0;_0x2269d0<_0x36a399[_0x1be5('0x61')];_0x2269d0+=0x1){_0x4ef3af['push']({'membername':_0x39936e[_0x1be5('0x2b')],'UserId':_0x39936e['id'],'queue_name':_0x36a399[_0x2269d0][_0x1be5('0x2b')],'VoiceQueueId':_0x36a399[_0x2269d0]['id'],'interface':_[_0x1be5('0x5b')](_0x39936e[_0x1be5('0x96')])?util[_0x1be5('0xa2')](_0x1be5('0xa3'),_0x39936e[_0x1be5('0x2b')]):_0x39936e[_0x1be5('0x96')],'paused':_0x39936e[_0x1be5('0x95')]||![],'penalty':_0x2dea03['body'][_0x1be5('0x9b')]||0x0});}return Promise[_0x1be5('0x4c')](_0x4ef3af[_0x1be5('0x81')](function(_0x4f5c58){return db[_0x1be5('0xa4')][_0x1be5('0xa5')](_0x4f5c58);}));}return _0x360df4;});}})['then'](respondWithStatusCode(_0x550c00,null))['catch'](handleError(_0x550c00,null));};exports[_0x1be5('0xa6')]=function(_0x57fb67,_0x2a62d0){var _0x4a317c,_0x217fff;return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x57fb67[_0x1be5('0x53')]['id']},'attributes':['id','name',_0x1be5('0x20')]})[_0x1be5('0x1f')](handleEntityNotFound(_0x2a62d0,null))[_0x1be5('0x1f')](function(_0x54be5d){if(_0x54be5d){_0x4a317c=_0x54be5d;if(!_0x57fb67[_0x1be5('0x3e')]['channel']||!utils[_0x1be5('0xa7')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x92')])){throw new db[(_0x1be5('0x89'))][(_0x1be5('0x86'))](_0x1be5('0x97'));}return _0x54be5d[_0x1be5('0xa8')+_[_0x1be5('0x98')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x92')][_0x1be5('0x99')]())+_0x1be5('0x9a')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x57')]);}})[_0x1be5('0x1f')](function(_0x1284a0){if(_[_0x1be5('0xa9')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x57')])){for(var _0x4a0f09=0x0;_0x4a0f09<_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x57')][_0x1be5('0x61')];_0x4a0f09+=0x1){_0x217fff={'UserId':Number(_0x57fb67[_0x1be5('0x53')]['id'])};_0x217fff[_[_0x1be5('0x98')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x92')][_0x1be5('0x99')]())+_0x1be5('0x9d')]=Number(_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x57')][_0x4a0f09]);socket[_0x1be5('0x9e')](_0x1be5('0x75')+_[_0x1be5('0x98')](_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x92')]['toLowerCase']())+'Queue:remove',_0x217fff);}}else{_0x217fff={'UserId':Number(_0x57fb67[_0x1be5('0x53')]['id'])};_0x217fff[_[_0x1be5('0x98')](_0x57fb67[_0x1be5('0x3e')]['channel']['toLowerCase']())+_0x1be5('0x9d')]=Number(_0x57fb67[_0x1be5('0x3e')][_0x1be5('0x57')]);socket[_0x1be5('0x9e')](_0x1be5('0x75')+_[_0x1be5('0x98')](_0x57fb67['query'][_0x1be5('0x92')][_0x1be5('0x99')]())+_0x1be5('0xaa'),_0x217fff);}return _0x1284a0;})['then'](function(){if(_0x57fb67[_0x1be5('0x3e')]['channel']===_0x1be5('0xa1')){return db[_0x1be5('0xa4')][_0x1be5('0x2d')]({'where':{'UserId':_0x57fb67[_0x1be5('0x53')]['id'],'VoiceQueueId':_0x57fb67['query'][_0x1be5('0x57')]},'individualHooks':!![]})[_0x1be5('0x1f')](function(){return _0x4a317c;});}return _0x4a317c;})[_0x1be5('0x1f')](respondWithStatusCode(_0x2a62d0,null))[_0x1be5('0x54')](handleError(_0x2a62d0,null));};exports['addAvatar']=function(_0x446aa5,_0x1f3cb1){_0x446aa5[_0x1be5('0x52')][_0x1be5('0xab')]=_0x446aa5[_0x1be5('0xac')]['filename'];return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x446aa5[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x1f3cb1,null))[_0x1be5('0x1f')](saveUpdates(_0x446aa5[_0x1be5('0x52')],null))[_0x1be5('0x1f')](respondWithResult(_0x1f3cb1,null))[_0x1be5('0x54')](handleError(_0x1f3cb1,null));};exports[_0x1be5('0xad')]=function(_0xac757e,_0x1ce9ad){var _0x12d37e=path[_0x1be5('0xae')](config[_0x1be5('0xaf')],_0x1be5('0xb0'));return db['User'][_0x1be5('0x4f')]({'where':{'id':_0xac757e[_0x1be5('0x53')]['id']},'attributes':['id',_0x1be5('0xab')],'raw':!![]})[_0x1be5('0x1f')](handleEntityNotFound(_0x1ce9ad,null))[_0x1be5('0x1f')](function(_0x56a080){if(_0x56a080){if(_['isNil'](_0x56a080['userpic'])){return _0x1ce9ad[_0x1be5('0xb1')](_0x12d37e);}else{if(!fs[_0x1be5('0xb2')](path['join'](config[_0x1be5('0xaf')],_0x1be5('0xb3'),_0x56a080['userpic']))){return _0x1ce9ad[_0x1be5('0xb1')](_0x12d37e);}return _0x1ce9ad[_0x1be5('0xb1')](path[_0x1be5('0xae')](config[_0x1be5('0xaf')],_0x1be5('0xb3'),_0x56a080[_0x1be5('0xab')]));}}})[_0x1be5('0x54')](handleError(_0x1ce9ad,null));};exports[_0x1be5('0xb4')]=function(_0x4143d4,_0x34c0b5){return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x4143d4['params']['id']},'attributes':['id']})[_0x1be5('0x1f')](handleEntityNotFound(_0x34c0b5,null))[_0x1be5('0x1f')](function(_0x40ad07){var _0x53b7fe=[];values=_0x40ad07[_0x1be5('0x48')];_0x53b7fe[_0x1be5('0x44')](get_open_tabs('chat',_0x40ad07[_0x1be5('0x48')]));_0x53b7fe[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x49'),_0x40ad07['dataValues']));_0x53b7fe[_0x1be5('0x44')](get_open_tabs(_0x1be5('0xb5'),_0x40ad07[_0x1be5('0x48')]));_0x53b7fe[_0x1be5('0x44')](get_open_tabs(_0x1be5('0x4b'),_0x40ad07['dataValues']));_0x53b7fe['push'](get_open_tabs('fax',_0x40ad07[_0x1be5('0x48')]));_0x53b7fe['push'](get_open_tabs(_0x1be5('0x4a'),_0x40ad07[_0x1be5('0x48')]));return Promise[_0x1be5('0x4c')](_0x53b7fe);})['then'](function(_0x5eb738){if(_0x5eb738){var _0x44f4ab=_[_0x1be5('0x81')](values['ChatOpenTabs'],function(_0xa622d1){return{'channel':_0x1be5('0xb6'),'id':_0xa622d1['id'],'createdAt':_0xa622d1['createdAt']};});var _0x1e8950=_[_0x1be5('0x81')](values[_0x1be5('0xb7')],function(_0x550a44){return{'channel':_0x1be5('0xb8'),'id':_0x550a44['id'],'createdAt':_0x550a44[_0x1be5('0xb9')]};});var _0x2c7570=_[_0x1be5('0x81')](values[_0x1be5('0xba')],function(_0x1d076e){return{'channel':_0x1be5('0xbb'),'id':_0x1d076e['id'],'createdAt':_0x1d076e[_0x1be5('0xb9')]};});var _0x79577b=_[_0x1be5('0x81')](values[_0x1be5('0xbc')],function(_0x598bad){return{'channel':'MAIL','id':_0x598bad['id'],'createdAt':_0x598bad[_0x1be5('0xb9')]};});var _0x52f74a=_[_0x1be5('0x81')](values['SmsOpenTabs'],function(_0x25cdbf){return{'channel':_0x1be5('0xbd'),'id':_0x25cdbf['id'],'createdAt':_0x25cdbf[_0x1be5('0xb9')]};});var _0x509b98=_['map'](values[_0x1be5('0xbe')],function(_0x1855eb){return{'channel':_0x1be5('0xbf'),'id':_0x1855eb['id'],'createdAt':_0x1855eb[_0x1be5('0xb9')]};});var _0x277757=_[_0x1be5('0xc0')](_0x44f4ab,_0x1e8950,_0x2c7570,_0x79577b,_0x52f74a,_0x509b98);var _0x4ecca1={'count':_0x277757['length'],'rows':_0x277757};return _0x4ecca1;}else return null;})[_0x1be5('0x1f')](respondWithResult(_0x34c0b5,null))[_0x1be5('0x54')](handleError(_0x34c0b5,null));};exports['getContacts']=function(_0x11da00,_0x10de2d){var _0x5f0d79={};return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x11da00[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](function(_0x471f82){if(!_0x471f82){throw new APINotFoundError(util[_0x1be5('0xa2')](_0x1be5('0xc1'),_0x11da00['params']['id']));}return contacts['describe']();})[_0x1be5('0x1f')](function(_0x55f95c){_0x11da00[_0x1be5('0x3e')][_0x1be5('0x30')]=_0x11da00[_0x1be5('0x53')]['id'];_0x5f0d79=qs['getOptions'](_0x55f95c,_0x11da00);if(_0x11da00[_0x1be5('0x3e')][_0x1be5('0xc2')]('includeAll')){_0x5f0d79[_0x1be5('0x40')]=[{'model':db[_0x1be5('0xc3')],'as':_0x1be5('0xc4'),'required':![]},{'model':db['Tag'],'as':_0x1be5('0xc5'),'attributes':['id',_0x1be5('0x2b'),_0x1be5('0xc6')],'where':_0x11da00[_0x1be5('0x3e')][_0x1be5('0xc7')]?{'id':_0x11da00['query'][_0x1be5('0xc7')]}:undefined,'required':_0x11da00[_0x1be5('0x3e')]['tag']?!![]:![]}];}return contacts[_0x1be5('0x45')](_0x11da00[_0x1be5('0x3e')],_0x11da00['user'],_0x5f0d79,_0x55f95c);})[_0x1be5('0x1f')](respondWithFilteredResult(_0x10de2d,_0x5f0d79))['catch'](APIHandleError(_0x10de2d));};exports[_0x1be5('0xc8')]=function(_0x1c2c92,_0x2970f9){var _0x5416f6;var _0x4cf727={};var _0x3d8626;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x1c2c92[_0x1be5('0x53')]['id']},'attributes':['id',_0x1be5('0x2b'),_0x1be5('0x20')]})[_0x1be5('0x1f')](handleEntityNotFound(_0x2970f9,null))[_0x1be5('0x1f')](function(_0x37b34b){if(!utils[_0x1be5('0xa7')](_0x1c2c92['query'][_0x1be5('0x92')])){throw new db['Sequelize'][(_0x1be5('0x86'))]('Unknown\x20channel');}_0x5416f6=_0x37b34b;var _0x2bbeca={};_0x2bbeca[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db[_[_0x1be5('0x98')](_0x1c2c92['query'][_0x1be5('0x92')])+_0x1be5('0xcb')][_0x1be5('0x31')]);_0x2bbeca[_0x1be5('0x3e')]=_['keys'](_0x1c2c92['query']);_0x2bbeca['filters']=_[_0x1be5('0xcc')](_0x2bbeca['model'],_0x2bbeca['query']);_0x4cf727[_0x1be5('0x43')]=_[_0x1be5('0xcc')](_0x2bbeca[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x1c2c92[_0x1be5('0x3e')]['fields']));_0x4cf727[_0x1be5('0x43')]=_0x4cf727['attributes'][_0x1be5('0x61')]?_0x4cf727[_0x1be5('0x43')]:_0x2bbeca[_0x1be5('0xc9')];_0x4cf727[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x4cf727['where']=qs['filters'](_[_0x1be5('0xd0')](_0x1c2c92[_0x1be5('0x3e')],_0x2bbeca['filters']));if(_0x1c2c92['query'][_0x1be5('0x28')]){_0x4cf727[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x4cf727['where'],{'$or':_[_0x1be5('0x81')](_0x4cf727[_0x1be5('0x43')],function(_0x24fbcb){var _0x245413={};_0x245413[_0x24fbcb]={'$like':'%'+_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x245413;})});}_0x4cf727=_[_0x1be5('0xd1')]({},_0x4cf727,_0x1c2c92[_0x1be5('0x4e')]);switch(_0x5416f6['role']){case _0x1be5('0x24'):return db[_['capitalize'](_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0x92')])+_0x1be5('0xcb')][_0x1be5('0x45')](_0x4cf727);case _0x1be5('0x75'):case _0x1be5('0x21'):return _0x5416f6['get'+_[_0x1be5('0x98')](_0x1c2c92[_0x1be5('0x3e')]['channel'])+_0x1be5('0x9a')](_0x4cf727);default:throw new db[(_0x1be5('0x89'))]['ValidationError']('Unknown\x20role');}})['then'](function(_0x12a530){_0x3d8626=_0x12a530[_0x1be5('0x61')];if(!_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x4cf727[_0x1be5('0x1a')]=qs[_0x1be5('0x1a')](_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x4cf727['offset']=qs[_0x1be5('0x18')](_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0x18')]);}switch(_0x5416f6[_0x1be5('0x20')]){case'admin':return db[_[_0x1be5('0x98')](_0x1c2c92['query']['channel'])+_0x1be5('0xcb')][_0x1be5('0x45')](_0x4cf727);case _0x1be5('0x75'):case'agent':return _0x5416f6[_0x1be5('0x23')+_['capitalize'](_0x1c2c92[_0x1be5('0x3e')][_0x1be5('0x92')])+'Queues'](_0x4cf727);}})[_0x1be5('0x1f')](function(_0x173e0c){return{'count':_0x3d8626,'rows':_0x173e0c};})[_0x1be5('0x1f')](respondWithResult(_0x2970f9,null))[_0x1be5('0x54')](handleError(_0x2970f9,null));};exports[_0x1be5('0xd3')]=function(_0x4aa6c2,_0x30d547){var _0x6090c1={};var _0x425fe2={};var _0x59772a;var _0x2c4e74;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x4aa6c2[_0x1be5('0x53')]['id']}})['then'](handleEntityNotFound(_0x30d547,null))[_0x1be5('0x1f')](function(_0x3ba86d){if(_0x3ba86d){_0x59772a=_0x3ba86d;_0x425fe2[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db['UserVoiceQueueRt'][_0x1be5('0x31')]);_0x425fe2['query']=_[_0x1be5('0xca')](_0x4aa6c2['query']);_0x425fe2[_0x1be5('0xd4')]=_[_0x1be5('0xcc')](_0x425fe2[_0x1be5('0xc9')],_0x425fe2[_0x1be5('0x3e')]);_0x6090c1['attributes']=_[_0x1be5('0xcc')](_0x425fe2[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x4aa6c2['query'][_0x1be5('0xcd')]));_0x6090c1[_0x1be5('0x43')]=_0x6090c1['attributes'][_0x1be5('0x61')]?_0x6090c1[_0x1be5('0x43')]:_0x425fe2['model'];_0x6090c1[_0x1be5('0xce')]=qs['sort'](_0x4aa6c2[_0x1be5('0x3e')]['sort']);_0x6090c1['where']=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x4aa6c2[_0x1be5('0x3e')],_0x425fe2[_0x1be5('0xd4')]));if(_0x4aa6c2[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x6090c1[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x6090c1[_0x1be5('0x3d')],{'$or':_['map'](_0x6090c1[_0x1be5('0x43')],function(_0xe3755a){var _0x32b759={};_0x32b759[_0xe3755a]={'$like':'%'+_0x4aa6c2['query'][_0x1be5('0x28')]+'%'};return _0x32b759;})});}_0x6090c1=_['merge']({},_0x6090c1,_0x4aa6c2[_0x1be5('0x4e')]);return _0x59772a[_0x1be5('0xd3')](_0x6090c1);}})['then'](function(_0x2a2180){if(_0x2a2180){_0x2c4e74=_0x2a2180['length'];if(!_0x4aa6c2[_0x1be5('0x3e')]['hasOwnProperty'](_0x1be5('0xd2'))){_0x6090c1[_0x1be5('0x1a')]=qs['limit'](_0x4aa6c2[_0x1be5('0x3e')]['limit']);_0x6090c1[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0x4aa6c2[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0x59772a[_0x1be5('0xd3')](_0x6090c1);}})[_0x1be5('0x1f')](function(_0x4b16b2){if(_0x4b16b2){return _0x4b16b2?{'count':_0x2c4e74,'rows':_0x4b16b2}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x30d547,null))[_0x1be5('0x54')](handleError(_0x30d547,null));};exports['getGroups']=function(_0x26a2bf,_0x2a2cce){var _0x56bb87={};var _0x4ecfa6={};var _0x26c3d4;var _0xb0987b;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x26a2bf[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x2a2cce,null))[_0x1be5('0x1f')](function(_0x4e525c){if(_0x4e525c){_0x26c3d4=_0x4e525c;_0x4ecfa6['model']=_[_0x1be5('0xca')](db[_0x1be5('0xd5')][_0x1be5('0x31')]);_0x4ecfa6[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0x26a2bf['query']);_0x4ecfa6[_0x1be5('0xd4')]=_[_0x1be5('0xcc')](_0x4ecfa6[_0x1be5('0xc9')],_0x4ecfa6[_0x1be5('0x3e')]);_0x56bb87[_0x1be5('0x43')]=_['intersection'](_0x4ecfa6[_0x1be5('0xc9')],qs['fields'](_0x26a2bf[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x56bb87[_0x1be5('0x43')]=_0x56bb87[_0x1be5('0x43')][_0x1be5('0x61')]?_0x56bb87[_0x1be5('0x43')]:_0x4ecfa6[_0x1be5('0xc9')];_0x56bb87[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x26a2bf['query'][_0x1be5('0xcf')]);_0x56bb87[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x26a2bf[_0x1be5('0x3e')],_0x4ecfa6[_0x1be5('0xd4')]));if(_0x26a2bf[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x56bb87[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x56bb87['where'],{'$or':_[_0x1be5('0x81')](_0x56bb87[_0x1be5('0x43')],function(_0x5b060a){var _0x1c9f92={};_0x1c9f92[_0x5b060a]={'$like':'%'+_0x26a2bf['query'][_0x1be5('0x28')]+'%'};return _0x1c9f92;})});}_0x56bb87=_[_0x1be5('0xd1')]({},_0x56bb87,_0x26a2bf[_0x1be5('0x4e')]);return _0x26c3d4[_0x1be5('0xd6')](_0x56bb87);}})[_0x1be5('0x1f')](function(_0x389f51){if(_0x389f51){_0xb0987b=_0x389f51['length'];if(!_0x26a2bf[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x56bb87[_0x1be5('0x1a')]=qs[_0x1be5('0x1a')](_0x26a2bf[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x56bb87[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0x26a2bf[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0x26c3d4['getGroups'](_0x56bb87);}})['then'](function(_0x3455ee){if(_0x3455ee){return _0x3455ee?{'count':_0xb0987b,'rows':_0x3455ee}:null;}})['then'](respondWithResult(_0x2a2cce,null))['catch'](handleError(_0x2a2cce,null));};exports['getRecordings']=function(_0x49862a,_0x182c35){var _0x5b394a={'raw':!![],'where':{}};var _0x3d6b3b={};var _0x1147c2={'count':0x0,'rows':[]};return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x49862a[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x182c35,null))[_0x1be5('0x1f')](function(_0x525833){if(_0x525833){_0x3d6b3b[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db['VoiceRecording'][_0x1be5('0x31')]);_0x3d6b3b[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0x49862a[_0x1be5('0x3e')]);_0x3d6b3b[_0x1be5('0xd4')]=_[_0x1be5('0xcc')](_0x3d6b3b[_0x1be5('0xc9')],_0x3d6b3b[_0x1be5('0x3e')]);_0x5b394a['attributes']=_[_0x1be5('0xcc')](_0x3d6b3b[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x49862a['query'][_0x1be5('0xcd')]));_0x5b394a[_0x1be5('0x43')]=_0x5b394a[_0x1be5('0x43')][_0x1be5('0x61')]?_0x5b394a[_0x1be5('0x43')]:_0x3d6b3b[_0x1be5('0xc9')];if(!_0x49862a[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x5b394a['limit']=qs[_0x1be5('0x1a')](_0x49862a[_0x1be5('0x3e')]['limit']);_0x5b394a['offset']=qs[_0x1be5('0x18')](_0x49862a[_0x1be5('0x3e')][_0x1be5('0x18')]);}_0x5b394a['order']=qs[_0x1be5('0xcf')](_0x49862a[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x5b394a['where']=qs[_0x1be5('0xd4')](_['pick'](_0x49862a['query'],_0x3d6b3b['filters']));_0x5b394a[_0x1be5('0x3d')][_0x1be5('0xd7')]=_0x525833['id'];if(_0x49862a[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x5b394a[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x5b394a['where'],{'$or':_[_0x1be5('0x81')](_0x5b394a[_0x1be5('0x43')],function(_0x619f70){var _0x5d7c60={};_0x5d7c60[_0x619f70]={'$like':'%'+_0x49862a['query'][_0x1be5('0x28')]+'%'};return _0x5d7c60;})});}_0x5b394a=_[_0x1be5('0xd1')]({},_0x5b394a,_0x49862a[_0x1be5('0x4e')]);return db[_0x1be5('0xd8')]['count']({'where':_0x5b394a[_0x1be5('0x3d')]})[_0x1be5('0x1f')](function(_0x484cfe){_0x1147c2[_0x1be5('0x1b')]=_0x484cfe;if(_0x49862a['query'][_0x1be5('0x3f')]){_0x5b394a[_0x1be5('0x40')]=[{'all':!![]}];}return db[_0x1be5('0xd8')][_0x1be5('0x45')](_0x5b394a);})['then'](function(_0x1bbbaf){_0x1147c2[_0x1be5('0x46')]=_0x1bbbaf;return _0x1147c2;});}})[_0x1be5('0x1f')](respondWithFilteredResult(_0x182c35,_0x5b394a))[_0x1be5('0x54')](handleError(_0x182c35,null));};exports[_0x1be5('0xd9')]=function(_0xce9739,_0x4c2c71){var _0x343a52={'raw':!![],'where':{}};var _0x339c02={};var _0x1ae6e7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0xce9739[_0x1be5('0x53')]['id']}})['then'](handleEntityNotFound(_0x4c2c71,null))['then'](function(_0x2a05f3){if(_0x2a05f3){_0x339c02[_0x1be5('0xc9')]=_['keys'](db[_0x1be5('0xda')][_0x1be5('0x31')]);_0x339c02[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0xce9739[_0x1be5('0x3e')]);_0x339c02[_0x1be5('0xd4')]=_['intersection'](_0x339c02['model'],_0x339c02['query']);_0x343a52[_0x1be5('0x43')]=_['intersection'](_0x339c02[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0xce9739['query'][_0x1be5('0xcd')]));_0x343a52[_0x1be5('0x43')]=_0x343a52[_0x1be5('0x43')]['length']?_0x343a52['attributes']:_0x339c02[_0x1be5('0xc9')];if(!_0xce9739['query']['hasOwnProperty'](_0x1be5('0xd2'))){_0x343a52['limit']=qs['limit'](_0xce9739['query']['limit']);_0x343a52[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0xce9739[_0x1be5('0x3e')][_0x1be5('0x18')]);}_0x343a52[_0x1be5('0xce')]=qs['sort'](_0xce9739[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x343a52[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0xce9739[_0x1be5('0x3e')],_0x339c02['filters']));_0x343a52[_0x1be5('0x3d')]['UserId']=_0x2a05f3['id'];if(_0xce9739[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x343a52[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x343a52[_0x1be5('0x3d')],{'$or':_['map'](_0x343a52['attributes'],function(_0x4ee352){var _0x338f70={};_0x338f70[_0x4ee352]={'$like':'%'+_0xce9739[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x338f70;})});}_0x343a52=_[_0x1be5('0xd1')]({},_0x343a52,_0xce9739[_0x1be5('0x4e')]);return db['ScreenRecording'][_0x1be5('0x1b')]({'where':_0x343a52[_0x1be5('0x3d')]})[_0x1be5('0x1f')](function(_0x45c792){_0x1ae6e7[_0x1be5('0x1b')]=_0x45c792;if(_0xce9739[_0x1be5('0x3e')][_0x1be5('0x3f')]){_0x343a52[_0x1be5('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1be5('0x45')](_0x343a52);})[_0x1be5('0x1f')](function(_0x4d1604){_0x1ae6e7['rows']=_0x4d1604;return _0x1ae6e7;});}})[_0x1be5('0x1f')](respondWithFilteredResult(_0x4c2c71,_0x343a52))[_0x1be5('0x54')](handleError(_0x4c2c71,null));};exports[_0x1be5('0xdb')]=function(_0x324b88,_0x463896){var _0x4a7423={};var _0x2f0934={};var _0x2f552c;var _0x1d2164;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x324b88[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x463896,null))['then'](function(_0x23333e){if(_0x23333e){_0x2f552c=_0x23333e;_0x2f0934[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db['ChatInteraction']['rawAttributes']);_0x2f0934['query']=_[_0x1be5('0xca')](_0x324b88['query']);_0x2f0934[_0x1be5('0xd4')]=_['intersection'](_0x2f0934[_0x1be5('0xc9')],_0x2f0934[_0x1be5('0x3e')]);_0x4a7423[_0x1be5('0x43')]=_[_0x1be5('0xcc')](_0x2f0934[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x324b88['query'][_0x1be5('0xcd')]));_0x4a7423[_0x1be5('0x43')]=_0x4a7423[_0x1be5('0x43')][_0x1be5('0x61')]?_0x4a7423[_0x1be5('0x43')]:_0x2f0934[_0x1be5('0xc9')];_0x4a7423['order']=qs[_0x1be5('0xcf')](_0x324b88[_0x1be5('0x3e')]['sort']);_0x4a7423['where']=qs['filters'](_['pick'](_0x324b88[_0x1be5('0x3e')],_0x2f0934[_0x1be5('0xd4')]));if(_0x324b88[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x4a7423['where']=_[_0x1be5('0xd1')](_0x4a7423['where'],{'$or':_['map'](_0x4a7423[_0x1be5('0x43')],function(_0x1eb30c){var _0x3fcb5b={};_0x3fcb5b[_0x1eb30c]={'$like':'%'+_0x324b88[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x3fcb5b;})});}_0x4a7423=_[_0x1be5('0xd1')]({},_0x4a7423,_0x324b88[_0x1be5('0x4e')]);return _0x2f552c[_0x1be5('0xdb')](_0x4a7423);}})[_0x1be5('0x1f')](function(_0xaf9401){if(_0xaf9401){_0x1d2164=_0xaf9401[_0x1be5('0x61')];if(!_0x324b88[_0x1be5('0x3e')][_0x1be5('0xc2')]('nolimit')){_0x4a7423[_0x1be5('0x1a')]=qs['limit'](_0x324b88['query'][_0x1be5('0x1a')]);_0x4a7423[_0x1be5('0x18')]=qs['offset'](_0x324b88[_0x1be5('0x3e')]['offset']);}return _0x2f552c[_0x1be5('0xdb')](_0x4a7423);}})[_0x1be5('0x1f')](function(_0x3b695d){if(_0x3b695d){return _0x3b695d?{'count':_0x1d2164,'rows':_0x3b695d}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x463896,null))['catch'](handleError(_0x463896,null));};exports[_0x1be5('0xdc')]=function(_0xaead7c,_0x1662fc){var _0x469bd1={};var _0x2969ca={};var _0x1e6c77;var _0x2bfe7d;return db[_0x1be5('0x30')]['findOne']({'where':{'id':_0xaead7c[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x1662fc,null))[_0x1be5('0x1f')](function(_0x5918c0){if(_0x5918c0){_0x1e6c77=_0x5918c0;_0x2969ca[_0x1be5('0xc9')]=_['keys'](db[_0x1be5('0xdd')][_0x1be5('0x31')]);_0x2969ca[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0xaead7c[_0x1be5('0x3e')]);_0x2969ca[_0x1be5('0xd4')]=_[_0x1be5('0xcc')](_0x2969ca[_0x1be5('0xc9')],_0x2969ca[_0x1be5('0x3e')]);_0x469bd1[_0x1be5('0x43')]=_['intersection'](_0x2969ca[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0xaead7c[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x469bd1[_0x1be5('0x43')]=_0x469bd1[_0x1be5('0x43')][_0x1be5('0x61')]?_0x469bd1['attributes']:_0x2969ca[_0x1be5('0xc9')];_0x469bd1[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0xaead7c['query'][_0x1be5('0xcf')]);_0x469bd1['where']=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0xaead7c['query'],_0x2969ca[_0x1be5('0xd4')]));if(_0xaead7c[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x469bd1[_0x1be5('0x3d')]=_['merge'](_0x469bd1[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x469bd1['attributes'],function(_0x47fdc0){var _0x54b58f={};_0x54b58f[_0x47fdc0]={'$like':'%'+_0xaead7c[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x54b58f;})});}_0x469bd1=_[_0x1be5('0xd1')]({},_0x469bd1,_0xaead7c[_0x1be5('0x4e')]);return _0x1e6c77[_0x1be5('0xdc')](_0x469bd1);}})['then'](function(_0x2fca2f){if(_0x2fca2f){_0x2bfe7d=_0x2fca2f['length'];if(!_0xaead7c['query']['hasOwnProperty'](_0x1be5('0xd2'))){_0x469bd1['limit']=qs[_0x1be5('0x1a')](_0xaead7c[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x469bd1[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0xaead7c[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0x1e6c77[_0x1be5('0xdc')](_0x469bd1);}})[_0x1be5('0x1f')](function(_0x35818a){if(_0x35818a){return _0x35818a?{'count':_0x2bfe7d,'rows':_0x35818a}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x1662fc,null))[_0x1be5('0x54')](handleError(_0x1662fc,null));};exports['getMailInteractions']=function(_0x5e9ab8,_0x57f663){var _0x440226={'raw':!![],'where':{}};var _0x353e6d={};var _0x10265f={'count':0x0,'rows':[]};return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x5e9ab8[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x57f663,null))[_0x1be5('0x1f')](function(_0x4041f6){if(_0x4041f6){_0x353e6d[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db[_0x1be5('0xde')][_0x1be5('0x31')]);_0x353e6d['query']=_[_0x1be5('0xca')](_0x5e9ab8[_0x1be5('0x3e')]);_0x353e6d['filters']=_[_0x1be5('0xcc')](_0x353e6d['model'],_0x353e6d[_0x1be5('0x3e')]);_0x440226[_0x1be5('0x43')]=_[_0x1be5('0xcc')](_0x353e6d[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x5e9ab8[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x440226[_0x1be5('0x43')]=_0x440226['attributes'][_0x1be5('0x61')]?_0x440226[_0x1be5('0x43')]:_0x353e6d[_0x1be5('0xc9')];if(!_0x5e9ab8[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x440226[_0x1be5('0x1a')]=qs[_0x1be5('0x1a')](_0x5e9ab8['query'][_0x1be5('0x1a')]);_0x440226[_0x1be5('0x18')]=qs['offset'](_0x5e9ab8[_0x1be5('0x3e')][_0x1be5('0x18')]);}_0x440226['order']=qs['sort'](_0x5e9ab8['query'][_0x1be5('0xcf')]);_0x440226[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_['pick'](_0x5e9ab8[_0x1be5('0x3e')],_0x353e6d['filters']));_0x440226[_0x1be5('0x3d')]['UserId']=_0x4041f6['id'];if(_0x5e9ab8[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x440226[_0x1be5('0x3d')]=_['merge'](_0x440226[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x440226[_0x1be5('0x43')],function(_0x1a7b23){var _0xb2817b={};_0xb2817b[_0x1a7b23]={'$like':'%'+_0x5e9ab8[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0xb2817b;})});}_0x440226=_['merge']({},_0x440226,_0x5e9ab8['options']);return db['MailInteraction'][_0x1be5('0x1b')]({'where':_0x440226[_0x1be5('0x3d')]})[_0x1be5('0x1f')](function(_0x497e33){_0x10265f[_0x1be5('0x1b')]=_0x497e33;if(_0x5e9ab8['query'][_0x1be5('0x3f')]){_0x440226[_0x1be5('0x40')]=[{'all':!![]}];}return db['MailInteraction'][_0x1be5('0x45')](_0x440226);})[_0x1be5('0x1f')](function(_0x573502){_0x10265f[_0x1be5('0x46')]=_0x573502;return _0x10265f;});}})['then'](respondWithFilteredResult(_0x57f663,_0x440226))['catch'](handleError(_0x57f663,null));};exports[_0x1be5('0xdf')]=function(_0x4b0d7d,_0x4eebdf){var _0x56b70e={};var _0x1cb70a={};var _0x189b03;var _0x5ce9e8;return db[_0x1be5('0x30')]['findOne']({'where':{'id':_0x4b0d7d['params']['id']}})['then'](handleEntityNotFound(_0x4eebdf,null))[_0x1be5('0x1f')](function(_0x5241da){if(_0x5241da){_0x189b03=_0x5241da;_0x1cb70a[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db['SmsInteraction'][_0x1be5('0x31')]);_0x1cb70a[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0x4b0d7d[_0x1be5('0x3e')]);_0x1cb70a[_0x1be5('0xd4')]=_['intersection'](_0x1cb70a[_0x1be5('0xc9')],_0x1cb70a[_0x1be5('0x3e')]);_0x56b70e[_0x1be5('0x43')]=_['intersection'](_0x1cb70a[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x4b0d7d['query'][_0x1be5('0xcd')]));_0x56b70e[_0x1be5('0x43')]=_0x56b70e[_0x1be5('0x43')][_0x1be5('0x61')]?_0x56b70e[_0x1be5('0x43')]:_0x1cb70a[_0x1be5('0xc9')];_0x56b70e['order']=qs['sort'](_0x4b0d7d[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x56b70e[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x4b0d7d[_0x1be5('0x3e')],_0x1cb70a[_0x1be5('0xd4')]));if(_0x4b0d7d['query']['filter']){_0x56b70e[_0x1be5('0x3d')]=_['merge'](_0x56b70e['where'],{'$or':_[_0x1be5('0x81')](_0x56b70e[_0x1be5('0x43')],function(_0x3be593){var _0x3bbb0f={};_0x3bbb0f[_0x3be593]={'$like':'%'+_0x4b0d7d['query'][_0x1be5('0x28')]+'%'};return _0x3bbb0f;})});}_0x56b70e=_[_0x1be5('0xd1')]({},_0x56b70e,_0x4b0d7d['options']);return _0x189b03[_0x1be5('0xdf')](_0x56b70e);}})[_0x1be5('0x1f')](function(_0x4eb463){if(_0x4eb463){_0x5ce9e8=_0x4eb463['length'];if(!_0x4b0d7d[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x56b70e[_0x1be5('0x1a')]=qs['limit'](_0x4b0d7d['query'][_0x1be5('0x1a')]);_0x56b70e[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0x4b0d7d[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0x189b03['getSmsInteractions'](_0x56b70e);}})[_0x1be5('0x1f')](function(_0x5c6a86){if(_0x5c6a86){return _0x5c6a86?{'count':_0x5ce9e8,'rows':_0x5c6a86}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x4eebdf,null))['catch'](handleError(_0x4eebdf,null));};exports[_0x1be5('0xe0')]=function(_0x1b6efc,_0x552fa6){var _0x41676f={};var _0x5cb5bf={};var _0xabe086;var _0xd099c8;return db[_0x1be5('0x30')]['findOne']({'where':{'id':_0x1b6efc[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x552fa6,null))['then'](function(_0xf0fcd6){if(_0xf0fcd6){_0xabe086=_0xf0fcd6;_0x5cb5bf[_0x1be5('0xc9')]=_['keys'](db['FaxInteraction'][_0x1be5('0x31')]);_0x5cb5bf[_0x1be5('0x3e')]=_['keys'](_0x1b6efc[_0x1be5('0x3e')]);_0x5cb5bf[_0x1be5('0xd4')]=_['intersection'](_0x5cb5bf[_0x1be5('0xc9')],_0x5cb5bf['query']);_0x41676f['attributes']=_[_0x1be5('0xcc')](_0x5cb5bf[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x1b6efc[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x41676f[_0x1be5('0x43')]=_0x41676f[_0x1be5('0x43')]['length']?_0x41676f[_0x1be5('0x43')]:_0x5cb5bf[_0x1be5('0xc9')];_0x41676f[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x1b6efc[_0x1be5('0x3e')]['sort']);_0x41676f['where']=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x1b6efc['query'],_0x5cb5bf[_0x1be5('0xd4')]));if(_0x1b6efc[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x41676f['where']=_['merge'](_0x41676f[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x41676f['attributes'],function(_0x45257a){var _0x3495b1={};_0x3495b1[_0x45257a]={'$like':'%'+_0x1b6efc[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x3495b1;})});}_0x41676f=_['merge']({},_0x41676f,_0x1b6efc[_0x1be5('0x4e')]);return _0xabe086[_0x1be5('0xe0')](_0x41676f);}})[_0x1be5('0x1f')](function(_0x23999c){if(_0x23999c){_0xd099c8=_0x23999c[_0x1be5('0x61')];if(!_0x1b6efc[_0x1be5('0x3e')]['hasOwnProperty'](_0x1be5('0xd2'))){_0x41676f[_0x1be5('0x1a')]=qs['limit'](_0x1b6efc[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x41676f[_0x1be5('0x18')]=qs['offset'](_0x1b6efc[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0xabe086[_0x1be5('0xe0')](_0x41676f);}})[_0x1be5('0x1f')](function(_0x14bbc1){if(_0x14bbc1){return _0x14bbc1?{'count':_0xd099c8,'rows':_0x14bbc1}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x552fa6,null))[_0x1be5('0x54')](handleError(_0x552fa6,null));};exports[_0x1be5('0xe1')]=function(_0x3a370e,_0x30852e){var _0x3a8e54={};var _0x3f3e89={};var _0x3ac3f5;var _0x30595b;return db['User'][_0x1be5('0x8d')]({'where':{'id':_0x3a370e['params']['id']}})['then'](handleEntityNotFound(_0x30852e,null))[_0x1be5('0x1f')](function(_0x1a8d3){if(_0x1a8d3){_0x3ac3f5=_0x1a8d3;_0x3f3e89[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db[_0x1be5('0xe2')][_0x1be5('0x31')]);_0x3f3e89[_0x1be5('0x3e')]=_[_0x1be5('0xca')](_0x3a370e['query']);_0x3f3e89[_0x1be5('0xd4')]=_['intersection'](_0x3f3e89[_0x1be5('0xc9')],_0x3f3e89[_0x1be5('0x3e')]);_0x3a8e54['attributes']=_[_0x1be5('0xcc')](_0x3f3e89[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x3a370e[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x3a8e54[_0x1be5('0x43')]=_0x3a8e54[_0x1be5('0x43')][_0x1be5('0x61')]?_0x3a8e54[_0x1be5('0x43')]:_0x3f3e89[_0x1be5('0xc9')];_0x3a8e54[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x3a370e['query'][_0x1be5('0xcf')]);_0x3a8e54[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x3a370e[_0x1be5('0x3e')],_0x3f3e89[_0x1be5('0xd4')]));if(_0x3a370e[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x3a8e54[_0x1be5('0x3d')]=_['merge'](_0x3a8e54[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x3a8e54[_0x1be5('0x43')],function(_0x56a8eb){var _0x38d96c={};_0x38d96c[_0x56a8eb]={'$like':'%'+_0x3a370e[_0x1be5('0x3e')]['filter']+'%'};return _0x38d96c;})});}_0x3a8e54=_[_0x1be5('0xd1')]({},_0x3a8e54,_0x3a370e[_0x1be5('0x4e')]);return _0x3ac3f5[_0x1be5('0xe1')](_0x3a8e54);}})['then'](function(_0x37e9f1){if(_0x37e9f1){_0x30595b=_0x37e9f1[_0x1be5('0x61')];if(!_0x3a370e[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x3a8e54[_0x1be5('0x1a')]=qs[_0x1be5('0x1a')](_0x3a370e[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x3a8e54['offset']=qs[_0x1be5('0x18')](_0x3a370e['query']['offset']);}return _0x3ac3f5[_0x1be5('0xe1')](_0x3a8e54);}})[_0x1be5('0x1f')](function(_0x4678ea){if(_0x4678ea){return _0x4678ea?{'count':_0x30595b,'rows':_0x4678ea}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x30852e,null))[_0x1be5('0x54')](handleError(_0x30852e,null));};exports[_0x1be5('0xe3')]=function(_0x3d8665,_0x408e73,_0x4318b9){var _0x543ad4;var _0x2e59d5;var _0x8413c9;var _0x3fa0f5=!_[_0x1be5('0x5b')](_0x3d8665[_0x1be5('0x53')]['id'])?_0x3d8665[_0x1be5('0x53')]['id']:!_['isNil'](_0x3d8665[_0x1be5('0x75')]['id'])?_0x3d8665[_0x1be5('0x75')]['id']:null;return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x3fa0f5,'role':{'$or':['admin',_0x1be5('0x75'),'agent']}},'attributes':['id',_0x1be5('0x2b'),'phone',_0x1be5('0xe4'),_0x1be5('0x20'),_0x1be5('0x5d'),'loginInPause']})[_0x1be5('0x1f')](function(_0x236ac1){if(_0x236ac1){if(_0x236ac1[_0x1be5('0x20')]===_0x1be5('0x21')){_0x543ad4=_0x236ac1;if(_0x3d8665[_0x1be5('0x52')][_0x1be5('0x96')]){_0x8413c9=util[_0x1be5('0xa2')](_0x1be5('0xe5'),_0x543ad4[_0x3d8665[_0x1be5('0x52')]['interface']]);}else if(_0x3d8665[_0x1be5('0x52')][_0x1be5('0xe6')]){_0x8413c9=util[_0x1be5('0xa2')]('SIP/%s',_0x3d8665[_0x1be5('0x52')][_0x1be5('0xe6')]);}else{_0x8413c9=util[_0x1be5('0xa2')](_0x1be5('0xa3'),_0x543ad4['name']);}socket['to'](util['format']('user:%s',_0x543ad4['name']))[_0x1be5('0x9e')]('user:forcelogout',{'user':{'id':_0x543ad4['id'],'name':_0x543ad4['name']},'ip':_0x3d8665[_0x1be5('0xe7')][_0x1be5('0xe8')]||_0x3d8665[_0x1be5('0xe9')][_0x1be5('0xea')]||_0x3d8665[_0x1be5('0xeb')]['remoteAddress']||_0x3d8665[_0x1be5('0xe9')][_0x1be5('0xeb')]['remoteAddress']});return db[_0x1be5('0xa4')]['destroy']({'where':{'membername':_0x543ad4[_0x1be5('0x2b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x1be5('0x86'))](_0x1be5('0xec'));}})['then'](function(){if(_0x543ad4){return _0x543ad4[_0x1be5('0xed')]({'raw':!![]});}})[_0x1be5('0x1f')](function(_0x882748){if(_0x543ad4){if(_0x882748){_0x2e59d5=_0x882748;if(_0x2e59d5['length']){var _0x172259=_0x2e59d5['map'](function(_0x4324fb){var _0x1630f5={'membername':_0x543ad4['name'],'UserId':_0x543ad4['id'],'queue_name':_0x4324fb[_0x1be5('0x2b')],'VoiceQueueId':_0x4324fb['id'],'interface':_0x8413c9,'paused':_0x543ad4[_0x1be5('0x94')]||![],'penalty':_0x4324fb[_0x1be5('0xee')]||0x0};return db[_0x1be5('0xa4')][_0x1be5('0xa5')](_0x1630f5);});return Promise['all'](_0x172259);}}}})[_0x1be5('0x1f')](function(){if(_0x543ad4){return db[_0x1be5('0xef')][_0x1be5('0x45')]({'where':{'membername':_0x543ad4[_0x1be5('0x2b')],'exitAt':null}});}})[_0x1be5('0x1f')](function(_0x276de4){if(_0x543ad4){var _0xb9518c=[];_0x276de4[_0x1be5('0xf0')](function(_0xf930fd){_0xb9518c[_0x1be5('0x44')](_0xf930fd[_0x1be5('0x1e')]({'exitAt':moment()[_0x1be5('0xa2')](_0x1be5('0xf1'))}));});return Promise[_0x1be5('0x4c')](_0xb9518c);}})[_0x1be5('0x1f')](function(){if(_0x543ad4){var _0x5e2e98=[];var _0x45e2ec=[];var _0x2cfb5f=utils[_0x1be5('0xf2')]();var _0x28d662={'membername':_0x543ad4[_0x1be5('0x2b')],'interface':_0x8413c9,'enterAt':moment()['format'](_0x1be5('0xf1')),'role':_0x543ad4[_0x1be5('0x20')],'internal':_0x543ad4[_0x1be5('0x5d')]};_0x2cfb5f['forEach'](function(_0x1ed394){_0x5e2e98[_0x1be5('0x44')](_[_0x1be5('0xd1')]({'channel':_0x1ed394,'type':_0x1be5('0xf3'),'data1':_0x3d8665[_0x1be5('0x52')][_0x1be5('0xf4')],'data2':_0x8413c9},_0x28d662));if(_0x543ad4[_0x1be5('0x94')]){_0x45e2ec[_0x1be5('0x44')](_[_0x1be5('0xd1')]({'channel':_0x1ed394,'type':_0x1be5('0xf5'),'data1':'LOGININPAUSE'},_0x28d662));}});return db['MemberReport']['bulkCreate'](_0x5e2e98[_0x1be5('0xc0')](_0x45e2ec),{'individualHooks':!![]});}})[_0x1be5('0x1f')](function(){if(_0x543ad4){return _0x543ad4[_0x1be5('0x1e')]({'online':!![],'lastLoginAt':moment()['format'](_0x1be5('0xf1')),'voicePause':_0x543ad4[_0x1be5('0x94')]||![],'mailPause':_0x543ad4['loginInPause']||![],'chatPause':_0x543ad4['loginInPause']||![],'faxPause':_0x543ad4[_0x1be5('0x94')]||![],'smsPause':_0x543ad4[_0x1be5('0x94')]||![],'openchannelPause':_0x543ad4[_0x1be5('0x94')]||![],'whatsappPause':_0x543ad4[_0x1be5('0x94')]||![],'pauseType':_0x543ad4[_0x1be5('0x94')]?_0x1be5('0xf6'):null,'interface':_0x8413c9,'lastPauseAt':moment()[_0x1be5('0xa2')](_0x1be5('0xf1'))});}})['then'](function(_0x217491){if(_0x3d8665['isMiddleware']){return _0x4318b9();}else{return Promise['resolve'](_0x217491)['then'](respondWithResult(_0x408e73,null));}})[_0x1be5('0x54')](handleError(_0x408e73,null));};exports[_0x1be5('0xf7')]=function(_0x2c13fc,_0x4f92f7){var _0x232919;return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x2c13fc[_0x1be5('0x53')]['id'],'role':_0x1be5('0x21')},'attributes':['id',_0x1be5('0x2b'),_0x1be5('0x20')]})[_0x1be5('0x1f')](handleEntityNotFound(_0x4f92f7,null))[_0x1be5('0x1f')](function(_0x1c2dc8){if(_0x1c2dc8){_0x232919=_0x1c2dc8;return db[_0x1be5('0xa4')][_0x1be5('0x2d')]({'where':{'membername':_0x232919[_0x1be5('0x2b')]},'individualHooks':!![]});}})[_0x1be5('0x1f')](function(){return db[_0x1be5('0xef')]['findAll']({'where':{'membername':_0x232919[_0x1be5('0x2b')],'exitAt':null}});})[_0x1be5('0x1f')](function(_0x4d50ea){var _0x4ea3f4=[];_0x4d50ea[_0x1be5('0xf0')](function(_0x27dfd6){_0x4ea3f4['push'](_0x27dfd6[_0x1be5('0x1e')]({'exitAt':moment()[_0x1be5('0xa2')](_0x1be5('0xf1'))}));});return Promise[_0x1be5('0x4c')](_0x4ea3f4);})[_0x1be5('0x1f')](function(){return _0x232919[_0x1be5('0x1e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x4f92f7,null))[_0x1be5('0x54')](handleError(_0x4f92f7,null));};exports[_0x1be5('0xf8')]=function(_0x331d59,_0x2d20ee){var _0x354620;return db['UserVoiceQueueRt'][_0x1be5('0x1e')]({'paused':0x1},{'where':{'UserId':_0x331d59[_0x1be5('0x53')]['id']},'individualHooks':!![]})[_0x1be5('0x1f')](function(){return db['User'][_0x1be5('0x4f')]({'where':{'id':_0x331d59[_0x1be5('0x53')]['id'],'role':_0x1be5('0x21')},'attributes':['id',_0x1be5('0x2b'),_0x1be5('0x20'),_0x1be5('0x5d'),_0x1be5('0x96'),_0x1be5('0x93')]});})[_0x1be5('0x1f')](handleEntityNotFound(_0x2d20ee,null))['then'](function(_0x3142eb){if(_0x3142eb){_0x354620=_0x3142eb;return db[_0x1be5('0xef')][_0x1be5('0x45')]({'where':{'membername':_0x354620[_0x1be5('0x2b')],'type':_0x1be5('0xf5'),'exitAt':null}});}})[_0x1be5('0x1f')](function(_0x2891df){if(_0x2891df[_0x1be5('0x61')]){var _0x595429=moment()[_0x1be5('0xa2')](_0x1be5('0xf1'));for(var _0x229b39=0x0,_0x4539d9=_0x2891df[_0x1be5('0x61')];_0x229b39<_0x4539d9;_0x229b39++){_0x2891df[_0x229b39][_0x1be5('0xf9')]({'exitAt':_0x595429});}}})['then'](function(){var _0x7810cd=[];var _0x2c0fa6=utils['getChannels']();_0x2c0fa6[_0x1be5('0xf0')](function(_0x5cf16e){_0x7810cd[_0x1be5('0x44')]({'channel':_0x5cf16e,'membername':_0x354620[_0x1be5('0x2b')],'interface':_['isNil'](_0x354620[_0x1be5('0x96')])?util[_0x1be5('0xa2')](_0x1be5('0xa3'),_0x354620[_0x1be5('0x2b')]):_0x354620[_0x1be5('0x96')],'type':_0x1be5('0xf5'),'enterAt':moment()[_0x1be5('0xa2')](_0x1be5('0xf1')),'data1':_0x331d59[_0x1be5('0x52')]['type']||_0x1be5('0xfa'),'role':_0x354620[_0x1be5('0x20')],'internal':_0x354620[_0x1be5('0x5d')]});});return db[_0x1be5('0xef')]['bulkCreate'](_0x7810cd,{'individualHooks':!![]});})[_0x1be5('0x1f')](function(){return _0x354620[_0x1be5('0x1e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x331d59['body']['type']||_0x1be5('0xfa'),'lastPauseAt':moment()[_0x1be5('0xa2')](_0x1be5('0xf1'))});})[_0x1be5('0x1f')](respondWithResult(_0x2d20ee,null))[_0x1be5('0x54')](handleError(_0x2d20ee,null));};exports[_0x1be5('0xfb')]=function(_0x2b5b8b,_0x196faa){if(_0x2b5b8b[_0x1be5('0x52')][_0x1be5('0x92')]&&!utils[_0x1be5('0xa7')](_0x2b5b8b[_0x1be5('0x52')][_0x1be5('0x92')])){throw new APIBadRequestError(util[_0x1be5('0xa2')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2b5b8b[_0x1be5('0x52')]['channel']));}return db[_0x1be5('0x30')][_0x1be5('0x4f')]({'where':{'id':_0x2b5b8b[_0x1be5('0x53')]['id']},'attributes':['id',_0x1be5('0x2b'),_0x1be5('0x20'),_0x1be5('0x5d'),_0x1be5('0x96'),'online','voicePause','mailPause','chatPause','faxPause','openchannelPause',_0x1be5('0xfc'),_0x1be5('0xfd'),'pauseType',_0x1be5('0xfe')]})[_0x1be5('0x1f')](function(_0x49e438){if(!_0x49e438){throw new APINotFoundError(util['format'](_0x1be5('0xc1'),_0x2b5b8b[_0x1be5('0x53')]['id']));}return _0x49e438[_0x1be5('0xfb')](_0x2b5b8b[_0x1be5('0x52')]['channel']);})['then'](respondWithResult(_0x196faa,null))[_0x1be5('0x54')](APIHandleError(_0x196faa));};exports[_0x1be5('0xff')]=function(_0x3ca2b7,_0xbec632){var _0x4ae5ee={};var _0x2565ac={};var _0x240944;var _0x32bb2d;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x3ca2b7['params']['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0xbec632,null))[_0x1be5('0x1f')](function(_0x3c1f9a){if(_0x3c1f9a){_0x240944=_0x3c1f9a;_0x2565ac[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db[_0x1be5('0x100')][_0x1be5('0x31')]);_0x2565ac['query']=_[_0x1be5('0xca')](_0x3ca2b7['query']);_0x2565ac['filters']=_['intersection'](_0x2565ac[_0x1be5('0xc9')],_0x2565ac[_0x1be5('0x3e')]);_0x4ae5ee[_0x1be5('0x43')]=_['intersection'](_0x2565ac[_0x1be5('0xc9')],qs[_0x1be5('0xcd')](_0x3ca2b7[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x4ae5ee[_0x1be5('0x43')]=_0x4ae5ee['attributes'][_0x1be5('0x61')]?_0x4ae5ee['attributes']:_0x2565ac[_0x1be5('0xc9')];_0x4ae5ee[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x3ca2b7[_0x1be5('0x3e')]['sort']);_0x4ae5ee[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x3ca2b7[_0x1be5('0x3e')],_0x2565ac[_0x1be5('0xd4')]));if(_0x3ca2b7[_0x1be5('0x3e')][_0x1be5('0x28')]){_0x4ae5ee[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x4ae5ee[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x4ae5ee[_0x1be5('0x43')],function(_0x42e239){var _0x42aaa8={};_0x42aaa8[_0x42e239]={'$like':'%'+_0x3ca2b7[_0x1be5('0x3e')]['filter']+'%'};return _0x42aaa8;})});}_0x4ae5ee=_['merge']({},_0x4ae5ee,_0x3ca2b7['options']);return _0x240944[_0x1be5('0xff')](_0x4ae5ee);}})['then'](function(_0xeb1237){if(_0xeb1237){_0x32bb2d=_0xeb1237[_0x1be5('0x61')];if(!_0x3ca2b7[_0x1be5('0x3e')][_0x1be5('0xc2')](_0x1be5('0xd2'))){_0x4ae5ee['limit']=qs[_0x1be5('0x1a')](_0x3ca2b7[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x4ae5ee[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0x3ca2b7[_0x1be5('0x3e')]['offset']);}return _0x240944[_0x1be5('0xff')](_0x4ae5ee);}})[_0x1be5('0x1f')](function(_0xc0691e){if(_0xc0691e){return _0xc0691e?{'count':_0x32bb2d,'rows':_0xc0691e}:null;}})['then'](respondWithResult(_0xbec632,null))['catch'](handleError(_0xbec632,null));};exports['addTeams']=function(_0x48ef73,_0x47cdc2){var _0x2ba80b=_0x48ef73[_0x1be5('0x53')]['id'];var _0x44b1ea=_0x48ef73[_0x1be5('0x52')]?_0x48ef73[_0x1be5('0x52')][_0x1be5('0x57')]:null;var _0x55492c=[];return Promise[_0x1be5('0x101')]()['then'](function(){if(!_0x44b1ea)throw new APIBadRequestError(_0x1be5('0x102'));})[_0x1be5('0x1f')](function(){return db[_0x1be5('0x30')]['findOne']({'where':{'id':_0x2ba80b}});})['then'](function(_0x45e488){if(!_0x45e488)throw new APINotFoundError(util[_0x1be5('0xa2')](_0x1be5('0xc1'),_0x48ef73[_0x1be5('0x53')]['id']));return db[_0x1be5('0x5f')][_0x1be5('0x103')](function(_0x2cdcf8){return _0x45e488[_0x1be5('0x104')](_0x44b1ea,{'transaction':_0x2cdcf8})[_0x1be5('0x1f')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x44b1ea}}});})[_0x1be5('0x1f')](function(_0x105286){var _0x501218=_[_0x1be5('0x81')](_0x105286,function(_0x384182){return _0x384182[_0x1be5('0x105')]();});return Promise[_0x1be5('0x4c')](_0x501218);})['then'](function(_0x32d602){_0x55492c=_[_0x1be5('0x106')](_0x32d602);var _0x3808db=_[_0x1be5('0x81')](_0x55492c,function(_0x357065){return _0x357065[_0x1be5('0x107')](_0x45e488['id'],{'transaction':_0x2cdcf8});});return Promise[_0x1be5('0x4c')](_0x3808db);})[_0x1be5('0x1f')](function(){if(!_0x45e488['online'])return;var _0x4b1c70=_[_0x1be5('0x28')](_0x55492c,function(_0x533a2b){return _0x533a2b[_0x1be5('0x108')]('channel')===_0x1be5('0x109');});var _0x58e8f1=_[_0x1be5('0x81')](_0x4b1c70,function(_0x2ea2d3){return db[_0x1be5('0xa4')][_0x1be5('0xa5')]({'membername':_0x45e488[_0x1be5('0x2b')],'UserId':_0x45e488['id'],'queue_name':_0x2ea2d3[_0x1be5('0x2b')],'VoiceQueueId':_0x2ea2d3['id'],'interface':_['isNil'](_0x45e488['interface'])?util[_0x1be5('0xa2')](_0x1be5('0xa3'),_0x45e488[_0x1be5('0x2b')]):_0x45e488[_0x1be5('0x96')],'paused':_0x45e488[_0x1be5('0x95')]||![],'penalty':_0x45e488[_0x1be5('0x9b')]},{'transaction':_0x2cdcf8});});return Promise[_0x1be5('0x4c')](_0x58e8f1);})[_0x1be5('0x1f')](function(){return db[_0x1be5('0x10a')][_0x1be5('0x45')]({'where':{'teamId':{'$in':_0x44b1ea}}});})[_0x1be5('0x1f')](function(_0x4b1ca8){var _0x5499b4=_['map'](_0x4b1ca8,function(_0x18cf78){return db[_0x1be5('0x10b')][_0x1be5('0x73')]({'UserId':_0x45e488['id'],'VoicePrefixId':_0x18cf78[_0x1be5('0x10c')]},{'transaction':_0x2cdcf8});});return Promise['all'](_0x5499b4);});});})[_0x1be5('0x1f')](function(){for(var _0x3cf4b5=0x0;_0x3cf4b5<_0x55492c[_0x1be5('0x61')];_0x3cf4b5++){var _0x5c9e0f=_0x55492c[_0x3cf4b5]['getDataValue'](_0x1be5('0x92'));var _0x269951=_0x5c9e0f+_0x1be5('0x9d');socket[_0x1be5('0x9e')](_0x1be5('0x75')+_0x5c9e0f+_0x1be5('0x9f'),{'UserId':_0x2ba80b,['queueField']:_0x55492c[_0x3cf4b5]['id']});}})[_0x1be5('0x1f')](respondWithStatusCode(_0x47cdc2,null))[_0x1be5('0x54')](APIHandleError(_0x47cdc2));};exports['removeTeams']=function(_0x37dbc3,_0x3b6ae9){var _0x1a92af=_0x37dbc3[_0x1be5('0x53')]['id'];var _0x1a2f36=null;if(_0x37dbc3[_0x1be5('0x3e')]['ids']){_0x1a2f36=_[_0x1be5('0xa9')](_0x37dbc3['query'][_0x1be5('0x57')])?_0x37dbc3[_0x1be5('0x3e')]['ids']:[_0x37dbc3[_0x1be5('0x3e')]['ids']];}var _0xbb9b14=[];return Promise['resolve']()['then'](function(){if(!_0x1a2f36)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x1be5('0x1f')](function(){return db['User']['findOne']({'where':{'id':_0x1a92af}});})['then'](function(_0xffb471){if(!_0xffb471)throw new APINotFoundError(util[_0x1be5('0xa2')](_0x1be5('0xc1'),_0x37dbc3['params']['id']));return db[_0x1be5('0x5f')]['transaction'](function(_0x1e1093){return _0xffb471[_0x1be5('0x10d')](_0x1a2f36,{'transaction':_0x1e1093})[_0x1be5('0x1f')](function(){return db[_0x1be5('0x100')][_0x1be5('0x45')]({'where':{'id':{'$in':_0x1a2f36}}});})[_0x1be5('0x1f')](function(_0x30ba03){var _0x34e1d2=_[_0x1be5('0x81')](_0x30ba03,function(_0x3b71d8){return _0x3b71d8[_0x1be5('0x105')]();});return Promise[_0x1be5('0x4c')](_0x34e1d2);})[_0x1be5('0x1f')](function(_0x4ba411){_0xbb9b14=_['flattenDeep'](_0x4ba411);var _0x3351ca=_[_0x1be5('0x81')](_0xbb9b14,function(_0x11db28){return _0x11db28[_0x1be5('0x10e')](_0xffb471['id'],{'transaction':_0x1e1093});});return Promise[_0x1be5('0x4c')](_0x3351ca);})['then'](function(){if(!_0xffb471[_0x1be5('0x93')])return;var _0x1b8887=_[_0x1be5('0x28')](_0xbb9b14,function(_0x5ebaa3){return _0x5ebaa3['getDataValue'](_0x1be5('0x92'))===_0x1be5('0x109');});var _0x1da0cf=_[_0x1be5('0x81')](_0x1b8887,function(_0x224471){return db[_0x1be5('0xa4')][_0x1be5('0x2d')]({'where':{'VoiceQueueId':_0x224471['id'],'UserId':_0xffb471['id']},'transaction':_0x1e1093});});return Promise[_0x1be5('0x4c')](_0x1da0cf);})[_0x1be5('0x1f')](function(){return db[_0x1be5('0x10a')][_0x1be5('0x45')]({'where':{'teamId':{'$in':_0x1a2f36}}});})[_0x1be5('0x1f')](function(_0x30c8a5){var _0x4c95c0=_[_0x1be5('0x81')](_0x30c8a5,function(_0x3a1187){return db[_0x1be5('0x10b')][_0x1be5('0x2d')]({'where':{'UserId':_0xffb471['id'],'VoicePrefixId':_0x3a1187[_0x1be5('0x10c')]}},{'transaction':_0x1e1093});});return Promise[_0x1be5('0x4c')](_0x4c95c0);});});})[_0x1be5('0x1f')](function(){for(var _0x4c1a05=0x0;_0x4c1a05<_0xbb9b14[_0x1be5('0x61')];_0x4c1a05++){var _0x20ab34=_0xbb9b14[_0x4c1a05][_0x1be5('0x108')](_0x1be5('0x92'));var _0x3fb8f0=_0x20ab34+_0x1be5('0x9d');socket[_0x1be5('0x9e')](_0x1be5('0x75')+_0x20ab34+_0x1be5('0xaa'),{'UserId':_0x1a92af,['queueField']:_0xbb9b14[_0x4c1a05]['id']});}})[_0x1be5('0x1f')](respondWithStatusCode(_0x3b6ae9,null))[_0x1be5('0x54')](APIHandleError(_0x3b6ae9));};exports[_0x1be5('0x10f')]=function(_0x2c1035,_0x5ca7b8){var _0x59ebad={};var _0x11006a={};var _0x1abfc7;var _0x3cabd8;return db[_0x1be5('0x30')][_0x1be5('0x8d')]({'where':{'id':_0x2c1035[_0x1be5('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ca7b8,null))[_0x1be5('0x1f')](function(_0x1417b1){if(_0x1417b1){_0x1abfc7=_0x1417b1;_0x11006a[_0x1be5('0xc9')]=_['keys'](db[_0x1be5('0xc3')][_0x1be5('0x31')]);_0x11006a[_0x1be5('0x3e')]=_['keys'](_0x2c1035[_0x1be5('0x3e')]);_0x11006a['filters']=_[_0x1be5('0xcc')](_0x11006a[_0x1be5('0xc9')],_0x11006a[_0x1be5('0x3e')]);_0x59ebad['attributes']=_['intersection'](_0x11006a['model'],qs['fields'](_0x2c1035[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x59ebad[_0x1be5('0x43')]=_0x59ebad[_0x1be5('0x43')][_0x1be5('0x61')]?_0x59ebad['attributes']:_0x11006a[_0x1be5('0xc9')];_0x59ebad['order']=qs['sort'](_0x2c1035[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x59ebad[_0x1be5('0x3d')]=qs['filters'](_[_0x1be5('0xd0')](_0x2c1035['query'],_0x11006a[_0x1be5('0xd4')]));if(_0x2c1035['query']['filter']){_0x59ebad[_0x1be5('0x3d')]=_['merge'](_0x59ebad[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x59ebad[_0x1be5('0x43')],function(_0x127f70){var _0x2e2dec={};_0x2e2dec[_0x127f70]={'$like':'%'+_0x2c1035[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x2e2dec;})});}_0x59ebad=_[_0x1be5('0xd1')]({},_0x59ebad,_0x2c1035[_0x1be5('0x4e')]);return _0x1abfc7[_0x1be5('0x10f')](_0x59ebad);}})[_0x1be5('0x1f')](function(_0x176a57){if(_0x176a57){_0x3cabd8=_0x176a57[_0x1be5('0x61')];if(!_0x2c1035[_0x1be5('0x3e')]['hasOwnProperty'](_0x1be5('0xd2'))){_0x59ebad[_0x1be5('0x1a')]=qs['limit'](_0x2c1035[_0x1be5('0x3e')][_0x1be5('0x1a')]);_0x59ebad[_0x1be5('0x18')]=qs[_0x1be5('0x18')](_0x2c1035[_0x1be5('0x3e')][_0x1be5('0x18')]);}return _0x1abfc7[_0x1be5('0x10f')](_0x59ebad);}})['then'](function(_0x17d0a5){if(_0x17d0a5){return _0x17d0a5?{'count':_0x3cabd8,'rows':_0x17d0a5}:null;}})[_0x1be5('0x1f')](respondWithResult(_0x5ca7b8,null))[_0x1be5('0x54')](handleError(_0x5ca7b8,null));};exports['getAgents']=function(_0x535d7a,_0x4d6f74){var _0x55ed3e={};var _0x228374={};var _0x4c481c;return db['User'][_0x1be5('0x8d')]({'where':{'id':_0x535d7a[_0x1be5('0x53')]['id']}})[_0x1be5('0x1f')](handleEntityNotFound(_0x4d6f74,null))[_0x1be5('0x1f')](function(_0x395db2){if(_0x395db2){_0x4c481c=_0x395db2;_0x228374[_0x1be5('0xc9')]=_[_0x1be5('0xca')](db[_0x1be5('0x30')][_0x1be5('0x31')]);_0x228374[_0x1be5('0x3e')]=_['keys'](_0x535d7a[_0x1be5('0x3e')]);_0x228374[_0x1be5('0xd4')]=_[_0x1be5('0xcc')](_0x228374['model'],_0x228374[_0x1be5('0x3e')]);_0x55ed3e[_0x1be5('0x43')]=_[_0x1be5('0xcc')](_0x228374['model'],qs[_0x1be5('0xcd')](_0x535d7a[_0x1be5('0x3e')][_0x1be5('0xcd')]));_0x55ed3e[_0x1be5('0x43')]=_0x55ed3e[_0x1be5('0x43')]['length']?_0x55ed3e[_0x1be5('0x43')]:_0x228374[_0x1be5('0xc9')];_0x55ed3e[_0x1be5('0xce')]=qs[_0x1be5('0xcf')](_0x535d7a[_0x1be5('0x3e')][_0x1be5('0xcf')]);_0x55ed3e[_0x1be5('0x3d')]=qs[_0x1be5('0xd4')](_[_0x1be5('0xd0')](_0x535d7a[_0x1be5('0x3e')],_0x228374[_0x1be5('0xd4')]));if(_0x535d7a['query']['filter']){_0x55ed3e[_0x1be5('0x3d')]=_[_0x1be5('0xd1')](_0x55ed3e[_0x1be5('0x3d')],{'$or':_[_0x1be5('0x81')](_0x55ed3e[_0x1be5('0x43')],function(_0x2a449e){var _0x5297c0={};_0x5297c0[_0x2a449e]={'$like':'%'+_0x535d7a[_0x1be5('0x3e')][_0x1be5('0x28')]+'%'};return _0x5297c0;})});}_0x55ed3e[_0x1be5('0xc9')]=db[_0x1be5('0x30')];_0x55ed3e['as']=_0x1be5('0x26');_0x55ed3e=_['merge']({},_0x55ed3e,_0x535d7a[_0x1be5('0x4e')]);return _0x4c481c[_0x1be5('0xed')]({'include':[_0x55ed3e]});}})['then'](function(_0x3f7f64){if(_0x3f7f64){var _0x4a2212={},_0x44485a=[];for(var _0x13d8c2=0x0;_0x13d8c2<_0x3f7f64[_0x1be5('0x61')];_0x13d8c2+=0x1){for(var _0x522fc8=0x0,_0x4bd362;_0x522fc8<_0x3f7f64[_0x13d8c2]['Agents'][_0x1be5('0x61')];_0x522fc8+=0x1){_0x4bd362=_0x3f7f64[_0x13d8c2][_0x1be5('0x26')][_0x522fc8][_0x1be5('0x23')]({'plain':!![]});_0x4a2212[_0x4bd362['id']]=_0x4bd362;}}_0x4a2212=_[_0x1be5('0x110')](_0x4a2212);for(var _0x457673=qs[_0x1be5('0x18')](_0x535d7a[_0x1be5('0x3e')][_0x1be5('0x18')]);_0x457673<_0x4a2212[_0x1be5('0x61')]&&_0x44485a[_0x1be5('0x61')]=_0x20e662[_0xa67b('0x4d')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa67b('0x1f')](function(){if(_0x30e0d2){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x30e0d2[_0xa67b('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x30e0d2){return _0x30e0d2[_0xa67b('0x4e')]({'raw':!![]});}})[_0xa67b('0x1f')](function(_0x5577c0){if(_0x30e0d2){if(_0x5577c0){var _0x37c718=[];_0x53de88=_0x5577c0;if(_0x53de88[_0xa67b('0x27')]){for(var _0x11a145=0x0;_0x11a145<_0x53de88[_0xa67b('0x27')];_0x11a145++){_0x37c718[_0xa67b('0x2c')](db[_0xa67b('0x23')]['upsert']({'membername':_0x30e0d2[_0xa67b('0x26')],'UserId':_0x30e0d2['id'],'queue_name':_0x53de88[_0x11a145][_0xa67b('0x26')],'VoiceQueueId':_0x53de88[_0x11a145]['id'],'interface':_0x4ce593,'paused':_0x30e0d2[_0xa67b('0x47')]||![],'penalty':_0x53de88[_0x11a145][_0xa67b('0x4f')]||0x0}));}return BPromise[_0xa67b('0x42')](_0x37c718);}}}})['then'](function(){if(_0x30e0d2){return db[_0xa67b('0x25')][_0xa67b('0xd')]({'where':{'membername':_0x30e0d2[_0xa67b('0x26')],'exitAt':null}});}})[_0xa67b('0x1f')](function(_0x1e0409){if(_0x30e0d2){if(_0x1e0409&&_0x1e0409['length']){var _0x949da6=[];_0x1e0409[_0xa67b('0x2b')](function(_0x116504){_0x949da6['push'](_0x116504[_0xa67b('0x24')]({'exitAt':moment()[_0xa67b('0x20')](_0xa67b('0x28'))}));});return BPromise[_0xa67b('0x42')](_0x949da6);}}})[_0xa67b('0x1f')](function(){if(_0x30e0d2){var _0x2c0a84=[];var _0x5b9685=[];var _0x316c8a=utils['getChannels']();var _0x1c4aaf={'membername':_0x30e0d2[_0xa67b('0x26')],'interface':_0x4ce593,'enterAt':moment()[_0xa67b('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x30e0d2[_0xa67b('0x1d')],'internal':_0x30e0d2['internal']};_0x316c8a[_0xa67b('0x2b')](function(_0x2a7c38){_0x2c0a84[_0xa67b('0x2c')](_[_0xa67b('0x50')]({'channel':_0x2a7c38,'type':'LOGIN','data1':'callysquare','data2':_0x4ce593},_0x1c4aaf));if(_0x30e0d2[_0xa67b('0x47')]){_0x5b9685[_0xa67b('0x2c')](_[_0xa67b('0x50')]({'channel':_0x2a7c38,'type':_0xa67b('0x51'),'data1':_0xa67b('0x52')},_0x1c4aaf));}});return db['MemberReport']['bulkCreate'](_0x2c0a84['concat'](_0x5b9685),{'individualHooks':!![]});}})['then'](function(){if(_0x30e0d2){return _0x30e0d2['update']({'online':!![],'lastLoginAt':moment()['format'](_0xa67b('0x28')),'voicePause':_0x30e0d2[_0xa67b('0x47')]||![],'mailPause':_0x30e0d2[_0xa67b('0x47')]||![],'chatPause':_0x30e0d2[_0xa67b('0x47')]||![],'faxPause':_0x30e0d2[_0xa67b('0x47')]||![],'smsPause':_0x30e0d2[_0xa67b('0x47')]||![],'openchannelPause':_0x30e0d2[_0xa67b('0x47')]||![],'pauseType':_0x30e0d2[_0xa67b('0x47')]?_0xa67b('0x52'):null,'lastPauseAt':moment()[_0xa67b('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4ce593});}})[_0xa67b('0x1f')](function(_0x3b2f5e){_0x250e96(_0x3b2f5e);})[_0xa67b('0x18')](function(_0x1dfe2f){_0x5abcbe(_0x274fa4[_0xa67b('0x1a')](0x1f4,_0x1dfe2f[_0xa67b('0x19')]));});});}; \ No newline at end of file +var _0x7a08=['agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','forEach','LOGIN','callysquare','merge','LOGININPAUSE','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','User','findAll','options','raw','where','attributes','limit','map','model','include','then','info','GetUser','debug','catch','message','error','ShowUser','stringify','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','body','bulkCreate','type','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','interface','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','params','LogoutUser','destroy','push','all','LoginUser','phone','loginInPause','count','agent'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a08,0x19e));var _0x87a0=function(_0x1d0c7e,_0x40b36c){_0x1d0c7e=_0x1d0c7e-0x0;var _0x30cf02=_0x7a08[_0x1d0c7e];return _0x30cf02;};'use strict';var _=require(_0x87a0('0x0'));var util=require(_0x87a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require(_0x87a0('0x2'));var db=require(_0x87a0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x87a0('0x4'))(_0x87a0('0x5'));var config=require(_0x87a0('0x6'));config[_0x87a0('0x7')]=_['defaults'](config[_0x87a0('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x87a0('0x8'))(new Redis(config[_0x87a0('0x7')]));require('./user.socket')['register'](socket);exports['GetUser']=function(_0x1cea27){var _0x5cae7f=this;return new Promise(function(_0x345a87,_0x5a8231){return db[_0x87a0('0x9')][_0x87a0('0xa')]({'raw':_0x1cea27['options']?_0x1cea27[_0x87a0('0xb')][_0x87a0('0xc')]===undefined?!![]:![]:!![],'where':_0x1cea27['options']?_0x1cea27['options'][_0x87a0('0xd')]||null:null,'attributes':_0x1cea27[_0x87a0('0xb')]?_0x1cea27['options'][_0x87a0('0xe')]||null:null,'limit':_0x1cea27[_0x87a0('0xb')]?_0x1cea27[_0x87a0('0xb')][_0x87a0('0xf')]||null:null,'include':_0x1cea27[_0x87a0('0xb')]?_0x1cea27[_0x87a0('0xb')]['include']?_[_0x87a0('0x10')](_0x1cea27[_0x87a0('0xb')]['include'],function(_0x15ddcd){return{'model':db[_0x15ddcd[_0x87a0('0x11')]],'as':_0x15ddcd['as'],'attributes':_0x15ddcd[_0x87a0('0xe')],'include':_0x15ddcd[_0x87a0('0x12')]?_['map'](_0x15ddcd[_0x87a0('0x12')],function(_0x185752){return{'model':db[_0x185752[_0x87a0('0x11')]],'as':_0x185752['as'],'attributes':_0x185752[_0x87a0('0xe')],'include':_0x185752[_0x87a0('0x12')]?_[_0x87a0('0x10')](_0x185752[_0x87a0('0x12')],function(_0x3adcd1){return{'model':db[_0x3adcd1[_0x87a0('0x11')]],'as':_0x3adcd1['as'],'attributes':_0x3adcd1[_0x87a0('0xe')]};}):[]};}):[]};}):[]:[]})[_0x87a0('0x13')](function(_0x19c369){logger[_0x87a0('0x14')](_0x87a0('0x15'),_0x1cea27);logger[_0x87a0('0x16')](_0x87a0('0x15'),_0x1cea27,JSON['stringify'](_0x19c369));_0x345a87(_0x19c369);})[_0x87a0('0x17')](function(_0x3308f0){logger['error'](_0x87a0('0x15'),_0x3308f0[_0x87a0('0x18')],_0x1cea27);_0x5a8231(_0x5cae7f[_0x87a0('0x19')](0x1f4,_0x3308f0[_0x87a0('0x18')]));});});};exports['ShowUser']=function(_0x71ee1f){var _0x2833dd=this;return new Promise(function(_0x195b41,_0x2568ee){return db['User']['find']({'raw':_0x71ee1f['options']?_0x71ee1f[_0x87a0('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x71ee1f['options']?_0x71ee1f['options'][_0x87a0('0xd')]||null:null,'attributes':_0x71ee1f['options']?_0x71ee1f[_0x87a0('0xb')]['attributes']||null:null,'include':_0x71ee1f['options']?_0x71ee1f[_0x87a0('0xb')]['include']?_['map'](_0x71ee1f[_0x87a0('0xb')][_0x87a0('0x12')],function(_0x5c12f0){return{'model':db[_0x5c12f0[_0x87a0('0x11')]],'as':_0x5c12f0['as'],'attributes':_0x5c12f0['attributes'],'include':_0x5c12f0[_0x87a0('0x12')]?_['map'](_0x5c12f0[_0x87a0('0x12')],function(_0x1ee431){return{'model':db[_0x1ee431[_0x87a0('0x11')]],'as':_0x1ee431['as'],'attributes':_0x1ee431[_0x87a0('0xe')],'include':_0x1ee431[_0x87a0('0x12')]?_[_0x87a0('0x10')](_0x1ee431[_0x87a0('0x12')],function(_0x293317){return{'model':db[_0x293317[_0x87a0('0x11')]],'as':_0x293317['as'],'attributes':_0x293317['attributes']};}):[]};}):[]};}):[]:[]})[_0x87a0('0x13')](function(_0x36fe76){logger[_0x87a0('0x14')]('ShowUser',_0x71ee1f);logger[_0x87a0('0x16')](_0x87a0('0x1a'),_0x71ee1f,JSON[_0x87a0('0x1b')](_0x36fe76));_0x195b41(_0x36fe76);})['catch'](function(_0x2c124d){logger[_0x87a0('0x19')]('ShowUser',_0x2c124d[_0x87a0('0x18')],_0x71ee1f);_0x2568ee(_0x2833dd[_0x87a0('0x19')](0x1f4,_0x2c124d[_0x87a0('0x18')]));});});};exports['PauseUser']=function(_0x5ac4dd){var _0x33d8b2;return db[_0x87a0('0x9')]['find']({'where':_0x5ac4dd[_0x87a0('0xb')]['where']||{},'attributes':['id','name',_0x87a0('0x1c'),_0x87a0('0x1d'),'interface']})[_0x87a0('0x13')](function(_0x135d2c){if(!_0x135d2c){throw new Error(util[_0x87a0('0x1e')](_0x87a0('0x1f'),_0x5ac4dd['params']['id']));}_0x33d8b2=_0x135d2c;return db[_0x87a0('0x20')][_0x87a0('0x21')]({'paused':0x1},{'where':{'UserId':_0x33d8b2['id']},'individualHooks':!![]});})['then'](function(){return db[_0x87a0('0x22')][_0x87a0('0xa')]({'where':{'membername':_0x33d8b2[_0x87a0('0x23')],'type':_0x87a0('0x24'),'exitAt':null}});})[_0x87a0('0x13')](function(_0x30ab7b){if(_0x30ab7b&&_0x30ab7b[_0x87a0('0x25')]){var _0x3bc9fa=moment()[_0x87a0('0x1e')](_0x87a0('0x26'));for(var _0x29ad65=0x0,_0x54d8aa=_0x30ab7b[_0x87a0('0x25')];_0x29ad65<_0x54d8aa;_0x29ad65++){_0x30ab7b[_0x29ad65][_0x87a0('0x27')]({'exitAt':_0x3bc9fa});}}})[_0x87a0('0x13')](function(){var _0x54f1b3=[];var _0xda64a1=utils[_0x87a0('0x28')]();_0xda64a1['forEach'](function(_0x50b52e){_0x54f1b3['push']({'channel':_0x50b52e,'membername':_0x33d8b2[_0x87a0('0x23')],'interface':_[_0x87a0('0x29')](_0x33d8b2['interface'])?util[_0x87a0('0x1e')](_0x87a0('0x2a'),_0x33d8b2['name']):_0x33d8b2['interface'],'type':_0x87a0('0x24'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5ac4dd['body']['type']||'DEFAULT\x20PAUSE','role':_0x33d8b2[_0x87a0('0x1c')],'internal':_0x33d8b2[_0x87a0('0x1d')],'uniqueid':_0x5ac4dd[_0x87a0('0x2b')]['uniqueid']||null});});return db[_0x87a0('0x22')][_0x87a0('0x2c')](_0x54f1b3,{'individualHooks':!![]});})['then'](function(){return _0x33d8b2[_0x87a0('0x21')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5ac4dd['body'][_0x87a0('0x2d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x87a0('0x1e')](_0x87a0('0x26'))});})[_0x87a0('0x17')](function(_0x118afb){throw _0x118afb;});};exports[_0x87a0('0x2e')]=function(_0x119772){return Promise[_0x87a0('0x2f')]()['then'](function(){if(_0x119772['body'][_0x87a0('0x30')]&&!utils[_0x87a0('0x31')](_0x119772[_0x87a0('0x2b')][_0x87a0('0x30')])){throw new Error(util[_0x87a0('0x1e')](_0x87a0('0x32'),_0x119772[_0x87a0('0x2b')][_0x87a0('0x30')]));}return db[_0x87a0('0x9')][_0x87a0('0x33')]({'where':_0x119772[_0x87a0('0xb')][_0x87a0('0xd')]||{},'attributes':['id','name',_0x87a0('0x1c'),_0x87a0('0x1d'),_0x87a0('0x34'),_0x87a0('0x35'),_0x87a0('0x36'),_0x87a0('0x37'),'chatPause',_0x87a0('0x38'),_0x87a0('0x39'),_0x87a0('0x3a'),_0x87a0('0x3b'),_0x87a0('0x3c'),_0x87a0('0x3d')]});})[_0x87a0('0x13')](function(_0x5d447f){if(!_0x5d447f){throw new Error(util[_0x87a0('0x1e')](_0x87a0('0x1f'),_0x119772[_0x87a0('0x3e')]['id']));}return _0x5d447f['unpause'](_0x119772[_0x87a0('0x2b')][_0x87a0('0x30')],'system');})['catch'](function(_0x5585ad){throw _0x5585ad;});};exports[_0x87a0('0x3f')]=function(_0x4f659b){var _0x1923b4=this;return new Promise(function(_0x52faab,_0x9a3b5e){var _0x415799;return db[_0x87a0('0x9')]['findOne']({'where':_0x4f659b['options'][_0x87a0('0xd')]||{},'attributes':['id',_0x87a0('0x23')]})['then'](function(_0x2560de){if(_0x2560de){_0x415799=_0x2560de;return db[_0x87a0('0x20')][_0x87a0('0x40')]({'where':{'membername':_0x415799[_0x87a0('0x23')]},'individualHooks':!![]});}})[_0x87a0('0x13')](function(){if(_0x415799){return db[_0x87a0('0x22')]['findAll']({'where':{'membername':_0x415799['name'],'exitAt':null}});}})[_0x87a0('0x13')](function(_0x2ea7de){if(_0x415799){if(_0x2ea7de&&_0x2ea7de[_0x87a0('0x25')]){var _0x1e371c=[];_0x2ea7de['forEach'](function(_0x5b4153){_0x1e371c[_0x87a0('0x41')](_0x5b4153['update']({'exitAt':moment()[_0x87a0('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x87a0('0x42')](_0x1e371c);}}})[_0x87a0('0x13')](function(){if(_0x415799){return _0x415799[_0x87a0('0x21')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x87a0('0x13')](function(_0x41f896){_0x52faab(_0x41f896);})[_0x87a0('0x17')](function(_0x144039){_0x9a3b5e(_0x1923b4[_0x87a0('0x19')](0x1f4,_0x144039[_0x87a0('0x18')]));});});};exports[_0x87a0('0x43')]=function(_0xb769ff){var _0x1955ce=this;return new Promise(function(_0x4385e5,_0x340759){var _0x341a3e;var _0x23d453;var _0x443d63;var _0x3472f4;return db[_0x87a0('0x9')][_0x87a0('0x33')]({'where':_0xb769ff['options'][_0x87a0('0xd')]||{},'attributes':['id',_0x87a0('0x23'),_0x87a0('0x1c'),'mobile',_0x87a0('0x44'),'internal',_0x87a0('0x45'),_0x87a0('0x34')]})[_0x87a0('0x13')](function(_0x473652){if(_0x473652){_0x341a3e=_0x473652;_0x3472f4=_0xb769ff[_0x87a0('0x2b')][_0x87a0('0x34')]?_0xb769ff[_0x87a0('0x2b')][_0x87a0('0x34')]:util[_0x87a0('0x1e')](_0x87a0('0x2a'),_0x341a3e['name']);return db[_0x87a0('0x9')][_0x87a0('0x46')]({'where':{'role':_0x87a0('0x47'),'online':!![],'id':{'$ne':_0x341a3e['id']}}});}})['then'](function(_0x1c7394){if(_0x1c7394){_0x443d63=_0x1c7394;return require('../../config/license/util')['getLicense']();}})[_0x87a0('0x13')](function(_0x16c0e2){if(_0x16c0e2&&_0x16c0e2['agents']&&_0x443d63>=_0x16c0e2[_0x87a0('0x48')]){throw new Error(_0x87a0('0x49'));}})[_0x87a0('0x13')](function(){if(_0x341a3e){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x341a3e[_0x87a0('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x341a3e){return _0x341a3e['getVoiceQueues']({'raw':!![]});}})[_0x87a0('0x13')](function(_0x1735ef){if(_0x341a3e){if(_0x1735ef){var _0x29f1e9=[];_0x23d453=_0x1735ef;if(_0x23d453['length']){for(var _0x2fe791=0x0;_0x2fe791<_0x23d453[_0x87a0('0x25')];_0x2fe791++){_0x29f1e9[_0x87a0('0x41')](db[_0x87a0('0x20')][_0x87a0('0x4a')]({'membername':_0x341a3e[_0x87a0('0x23')],'UserId':_0x341a3e['id'],'queue_name':_0x23d453[_0x2fe791][_0x87a0('0x23')],'VoiceQueueId':_0x23d453[_0x2fe791]['id'],'interface':_0x3472f4,'paused':_0x341a3e['loginInPause']||![],'penalty':_0x23d453[_0x2fe791][_0x87a0('0x4b')]||0x0}));}return BPromise['all'](_0x29f1e9);}}}})[_0x87a0('0x13')](function(){if(_0x341a3e){return db[_0x87a0('0x22')][_0x87a0('0xa')]({'where':{'membername':_0x341a3e[_0x87a0('0x23')],'exitAt':null}});}})[_0x87a0('0x13')](function(_0x2bff9b){if(_0x341a3e){if(_0x2bff9b&&_0x2bff9b[_0x87a0('0x25')]){var _0x1aabea=[];_0x2bff9b['forEach'](function(_0x2a448c){_0x1aabea[_0x87a0('0x41')](_0x2a448c[_0x87a0('0x21')]({'exitAt':moment()['format'](_0x87a0('0x26'))}));});return BPromise['all'](_0x1aabea);}}})['then'](function(){if(_0x341a3e){var _0x58c211=[];var _0x3e07d2=[];var _0x49744b=utils[_0x87a0('0x28')]();var _0x230acf={'membername':_0x341a3e[_0x87a0('0x23')],'interface':_0x3472f4,'enterAt':moment()[_0x87a0('0x1e')](_0x87a0('0x26')),'role':_0x341a3e[_0x87a0('0x1c')],'internal':_0x341a3e['internal']};_0x49744b[_0x87a0('0x4c')](function(_0x1d0d1d){_0x58c211[_0x87a0('0x41')](_['merge']({'channel':_0x1d0d1d,'type':_0x87a0('0x4d'),'data1':_0x87a0('0x4e'),'data2':_0x3472f4},_0x230acf));if(_0x341a3e[_0x87a0('0x45')]){_0x3e07d2[_0x87a0('0x41')](_[_0x87a0('0x4f')]({'channel':_0x1d0d1d,'type':_0x87a0('0x24'),'data1':_0x87a0('0x50')},_0x230acf));}});return db['MemberReport'][_0x87a0('0x2c')](_0x58c211['concat'](_0x3e07d2),{'individualHooks':!![]});}})[_0x87a0('0x13')](function(){if(_0x341a3e){return _0x341a3e[_0x87a0('0x21')]({'online':!![],'lastLoginAt':moment()[_0x87a0('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x341a3e[_0x87a0('0x45')]||![],'mailPause':_0x341a3e[_0x87a0('0x45')]||![],'chatPause':_0x341a3e[_0x87a0('0x45')]||![],'faxPause':_0x341a3e[_0x87a0('0x45')]||![],'smsPause':_0x341a3e[_0x87a0('0x45')]||![],'openchannelPause':_0x341a3e[_0x87a0('0x45')]||![],'pauseType':_0x341a3e[_0x87a0('0x45')]?_0x87a0('0x50'):null,'lastPauseAt':moment()[_0x87a0('0x1e')](_0x87a0('0x26')),'interface':_0x3472f4});}})[_0x87a0('0x13')](function(_0x3bb253){_0x4385e5(_0x3bb253);})[_0x87a0('0x17')](function(_0x111f1d){_0x340759(_0x1955ce[_0x87a0('0x19')](0x1f4,_0x111f1d[_0x87a0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 84c942c..f1553af 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 _0xf64c=['./user.events','save','update','emit','removeListener','register','length','user:'];(function(_0x171a4a,_0x1ee852){var _0x2dc33e=function(_0x52ca80){while(--_0x52ca80){_0x171a4a['push'](_0x171a4a['shift']());}};_0x2dc33e(++_0x1ee852);}(_0xf64c,0x100));var _0xcf64=function(_0x42a9e0,_0x432991){_0x42a9e0=_0x42a9e0-0x0;var _0x51fb2e=_0xf64c[_0x42a9e0];return _0x51fb2e;};'use strict';var UserEvents=require(_0xcf64('0x0'));var events=[_0xcf64('0x1'),'remove',_0xcf64('0x2')];function createListener(_0x4e6f46,_0x5a32a0){return function(_0x58c75a){_0x5a32a0[_0xcf64('0x3')](_0x4e6f46,_0x58c75a);};}function removeListener(_0x5454b7,_0x464be9){return function(){UserEvents[_0xcf64('0x4')](_0x5454b7,_0x464be9);};}exports[_0xcf64('0x5')]=function(_0x504686){for(var _0x786187=0x0,_0x4af05a=events[_0xcf64('0x6')];_0x786187<_0x4af05a;_0x786187++){var _0x297c8c=events[_0x786187];var _0x22e22a=createListener(_0xcf64('0x7')+_0x297c8c,_0x504686);UserEvents['on'](_0x297c8c,_0x22e22a);}}; \ No newline at end of file +var _0xa7d8=['remove','emit','register','length','./user.events','save'];(function(_0x56aab0,_0x4afd25){var _0xa15bf4=function(_0x499049){while(--_0x499049){_0x56aab0['push'](_0x56aab0['shift']());}};_0xa15bf4(++_0x4afd25);}(_0xa7d8,0xa0));var _0x8a7d=function(_0xe73aed,_0x31959f){_0xe73aed=_0xe73aed-0x0;var _0x367936=_0xa7d8[_0xe73aed];return _0x367936;};'use strict';var UserEvents=require(_0x8a7d('0x0'));var events=[_0x8a7d('0x1'),_0x8a7d('0x2'),'update'];function createListener(_0x5c5cf7,_0x34d0d1){return function(_0x3dd6df){_0x34d0d1[_0x8a7d('0x3')](_0x5c5cf7,_0x3dd6df);};}function removeListener(_0x1b25f3,_0xa31822){return function(){UserEvents['removeListener'](_0x1b25f3,_0xa31822);};}exports[_0x8a7d('0x4')]=function(_0x50326d){for(var _0x22a17d=0x0,_0x3002a3=events[_0x8a7d('0x5')];_0x22a17d<_0x3002a3;_0x22a17d++){var _0x1a94d1=events[_0x22a17d];var _0x477a06=createListener('user:'+_0x1a94d1,_0x50326d);UserEvents['on'](_0x1a94d1,_0x477a06);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5245236..15f1d68 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5084b8,_0x41f192){var _0x1617a0=function(_0x353526){while(--_0x353526){_0x5084b8['push'](_0x5084b8['shift']());}};_0x1617a0(++_0x41f192);}(_0x70e0,0x17b));var _0x070e=function(_0x448a88,_0x2bde69){_0x448a88=_0x448a88-0x0;var _0x583d37=_0x70e0[_0x448a88];return _0x583d37;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x28467d,_0x2ac2bf){var _0x22cbbd=function(_0x3288ec){while(--_0x3288ec){_0x28467d['push'](_0x28467d['shift']());}};_0x22cbbd(++_0x2ac2bf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e68354a..9ef9de5 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 _0xc1fe=['exports','INTEGER','sequelize'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xc1fe,0xdd));var _0xec1f=function(_0x185276,_0x54a4be){_0x185276=_0x185276-0x0;var _0x3b770b=_0xc1fe[_0x185276];return _0x3b770b;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'penalty':{'type':Sequelize[_0xec1f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xebe7=['sequelize','exports','INTEGER'];(function(_0x46ea72,_0x3d5c9f){var _0x2b51c1=function(_0x1961c4){while(--_0x1961c4){_0x46ea72['push'](_0x46ea72['shift']());}};_0x2b51c1(++_0x3d5c9f);}(_0xebe7,0x165));var _0x7ebe=function(_0x5e3ed2,_0x580c0c){_0x5e3ed2=_0x5e3ed2-0x0;var _0x291e6e=_0xebe7[_0x5e3ed2];return _0x291e6e;};'use strict';var Sequelize=require(_0x7ebe('0x0'));module[_0x7ebe('0x1')]={'penalty':{'type':Sequelize[_0x7ebe('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3ed750d..a85d3b2 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 _0x3a2a=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5233d4,_0x323ed8){var _0x1b7f4f=function(_0x1b41b4){while(--_0x1b41b4){_0x5233d4['push'](_0x5233d4['shift']());}};_0x1b7f4f(++_0x323ed8);}(_0x3a2a,0x12e));var _0xa3a2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a2a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa3a2('0x0'));var logger=require(_0xa3a2('0x1'))(_0xa3a2('0x2'));var moment=require(_0xa3a2('0x3'));var BPromise=require(_0xa3a2('0x4'));var rp=require(_0xa3a2('0x5'));var fs=require('fs');var path=require(_0xa3a2('0x6'));var rimraf=require(_0xa3a2('0x7'));var config=require(_0xa3a2('0x8'));var attributes=require(_0xa3a2('0x9'));module[_0xa3a2('0xa')]=function(_0x1cf493,_0x3b5903){return _0x1cf493[_0xa3a2('0xb')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab05=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','user_has_chat_queues','lodash'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xab05,0x113));var _0x5ab0=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xab05[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x5ab0('0x0'));var util=require(_0x5ab0('0x1'));var logger=require(_0x5ab0('0x2'))(_0x5ab0('0x3'));var moment=require(_0x5ab0('0x4'));var BPromise=require(_0x5ab0('0x5'));var rp=require(_0x5ab0('0x6'));var fs=require('fs');var path=require(_0x5ab0('0x7'));var rimraf=require(_0x5ab0('0x8'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x5ab0('0x9')]=function(_0x3ae5ae,_0x5b2bd2){return _0x3ae5ae[_0x5ab0('0xa')]('UserChatQueue',attributes,{'tableName':_0x5ab0('0xb'),'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 8e18e0c..c1e9ec8 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 _0xb2f0=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb2f0,0x9c));var _0x0b2f=function(_0x576fdd,_0x2d8b37){_0x576fdd=_0x576fdd-0x0;var _0xe6ec51=_0xb2f0[_0x576fdd];return _0xe6ec51;};'use strict';var _=require(_0x0b2f('0x0'));var util=require(_0x0b2f('0x1'));var moment=require('moment');var BPromise=require(_0x0b2f('0x2'));var rs=require(_0x0b2f('0x3'));var fs=require('fs');var Redis=require(_0x0b2f('0x4'));var db=require(_0x0b2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b2f('0x6'))(_0x0b2f('0x7'));var config=require(_0x0b2f('0x8'));var jayson=require(_0x0b2f('0x9'));var client=jayson[_0x0b2f('0xa')][_0x0b2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x537a1c,_0xde50e3,_0x1c0b12){return new BPromise(function(_0x265246,_0xe55aea){return client[_0x0b2f('0xc')](_0x537a1c,_0x1c0b12)[_0x0b2f('0xd')](function(_0x1b2c05){logger[_0x0b2f('0xe')](_0x0b2f('0xf'),_0xde50e3,_0x0b2f('0x10'));logger[_0x0b2f('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xde50e3,_0x0b2f('0x10'),JSON[_0x0b2f('0x12')](_0x1b2c05));if(_0x1b2c05[_0x0b2f('0x13')]){if(_0x1b2c05['error'][_0x0b2f('0x14')]===0x1f4){logger['error'](_0x0b2f('0xf'),_0xde50e3,_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);return _0xe55aea(_0x1b2c05['error'][_0x0b2f('0x15')]);}logger['error'](_0x0b2f('0xf'),_0xde50e3,_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);return _0x265246(_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);}else{logger[_0x0b2f('0xe')](_0x0b2f('0xf'),_0xde50e3,_0x0b2f('0x10'));_0x265246(_0x1b2c05['result'][_0x0b2f('0x15')]);}})['catch'](function(_0x199f80){logger[_0x0b2f('0x13')](_0x0b2f('0xf'),_0xde50e3,_0x199f80);_0xe55aea(_0x199f80);});});} \ No newline at end of file +var _0xabf3=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0xabf3,0x1a6));var _0x3abf=function(_0x57e950,_0x2d719b){_0x57e950=_0x57e950-0x0;var _0x55b448=_0xabf3[_0x57e950];return _0x55b448;};'use strict';var _=require(_0x3abf('0x0'));var util=require(_0x3abf('0x1'));var moment=require(_0x3abf('0x2'));var BPromise=require(_0x3abf('0x3'));var rs=require(_0x3abf('0x4'));var fs=require('fs');var Redis=require(_0x3abf('0x5'));var db=require(_0x3abf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3abf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3abf('0x8'));var client=jayson[_0x3abf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x292f7b,_0x443a,_0x1f5309){return new BPromise(function(_0x5bd3c5,_0x39bfbc){return client[_0x3abf('0xa')](_0x292f7b,_0x1f5309)['then'](function(_0x284a50){logger[_0x3abf('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x443a,'request\x20sent');logger[_0x3abf('0xc')](_0x3abf('0xd'),_0x443a,_0x3abf('0xe'),JSON[_0x3abf('0xf')](_0x284a50));if(_0x284a50[_0x3abf('0x10')]){if(_0x284a50[_0x3abf('0x10')][_0x3abf('0x11')]===0x1f4){logger['error'](_0x3abf('0x12'),_0x443a,_0x284a50[_0x3abf('0x10')][_0x3abf('0x13')]);return _0x39bfbc(_0x284a50[_0x3abf('0x10')][_0x3abf('0x13')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x443a,_0x284a50[_0x3abf('0x10')][_0x3abf('0x13')]);return _0x5bd3c5(_0x284a50[_0x3abf('0x10')][_0x3abf('0x13')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x443a,_0x3abf('0xe'));_0x5bd3c5(_0x284a50['result']['message']);}})[_0x3abf('0x14')](function(_0x133f1a){logger[_0x3abf('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x443a,_0x133f1a);_0x39bfbc(_0x133f1a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ed45376..574c6d3 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b2094,_0x59e69d){var _0x3d56ff=function(_0x138bdf){while(--_0x138bdf){_0x2b2094['push'](_0x2b2094['shift']());}};_0x3d56ff(++_0x59e69d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0d66a96..621d7be 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 _0x6ad2=['exports','INTEGER','STRING'];(function(_0x57479b,_0x279609){var _0x40efc7=function(_0x4a622c){while(--_0x4a622c){_0x57479b['push'](_0x57479b['shift']());}};_0x40efc7(++_0x279609);}(_0x6ad2,0x1da));var _0x26ad=function(_0x1f5822,_0x50a5ab){_0x1f5822=_0x1f5822-0x0;var _0x124d1e=_0x6ad2[_0x1f5822];return _0x124d1e;};'use strict';var Sequelize=require('sequelize');module[_0x26ad('0x0')]={'penalty':{'type':Sequelize[_0x26ad('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x26ad('0x2')]}}; \ No newline at end of file +var _0xbc78=['INTEGER','STRING','sequelize','exports'];(function(_0x60e7fc,_0xae4e2a){var _0x19c8be=function(_0x472eb7){while(--_0x472eb7){_0x60e7fc['push'](_0x60e7fc['shift']());}};_0x19c8be(++_0xae4e2a);}(_0xbc78,0x1ee));var _0x8bc7=function(_0x3fe3dd,_0x4c5e35){_0x3fe3dd=_0x3fe3dd-0x0;var _0x34b30d=_0xbc78[_0x3fe3dd];return _0x34b30d;};'use strict';var Sequelize=require(_0x8bc7('0x0'));module[_0x8bc7('0x1')]={'penalty':{'type':Sequelize[_0x8bc7('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8bc7('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8bc7('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5858555..77f1bea 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 _0xa12b=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa12b,0xb9));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var util=require(_0xba12('0x1'));var logger=require(_0xba12('0x2'))(_0xba12('0x3'));var moment=require(_0xba12('0x4'));var BPromise=require('bluebird');var rp=require(_0xba12('0x5'));var fs=require('fs');var path=require(_0xba12('0x6'));var rimraf=require(_0xba12('0x7'));var config=require(_0xba12('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0xba12('0x9')]=function(_0x51c3ae,_0x62c6ee){return _0x51c3ae[_0xba12('0xa')](_0xba12('0xb'),attributes,{'tableName':_0xba12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f81=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5419e5,_0x17b24f){var _0x5d8080=function(_0x18cb6a){while(--_0x18cb6a){_0x5419e5['push'](_0x5419e5['shift']());}};_0x5d8080(++_0x17b24f);}(_0x4f81,0x158));var _0x14f8=function(_0x4e3f11,_0x32323b){_0x4e3f11=_0x4e3f11-0x0;var _0x4fca3f=_0x4f81[_0x4e3f11];return _0x4fca3f;};'use strict';var _=require(_0x14f8('0x0'));var util=require(_0x14f8('0x1'));var logger=require(_0x14f8('0x2'))(_0x14f8('0x3'));var moment=require(_0x14f8('0x4'));var BPromise=require(_0x14f8('0x5'));var rp=require(_0x14f8('0x6'));var fs=require('fs');var path=require(_0x14f8('0x7'));var rimraf=require(_0x14f8('0x8'));var config=require(_0x14f8('0x9'));var attributes=require(_0x14f8('0xa'));module[_0x14f8('0xb')]=function(_0x75a7b4,_0x5534b9){return _0x75a7b4[_0x14f8('0xc')](_0x14f8('0xd'),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 a771209..14b240b 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 _0x62be=['request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x51207c,_0x14afc6){var _0x2509c2=function(_0x325f49){while(--_0x325f49){_0x51207c['push'](_0x51207c['shift']());}};_0x2509c2(++_0x14afc6);}(_0x62be,0x130));var _0xe62b=function(_0x3af707,_0x1b7c6a){_0x3af707=_0x3af707-0x0;var _0x3cf60a=_0x62be[_0x3af707];return _0x3cf60a;};'use strict';var _=require(_0xe62b('0x0'));var util=require(_0xe62b('0x1'));var moment=require(_0xe62b('0x2'));var BPromise=require(_0xe62b('0x3'));var rs=require(_0xe62b('0x4'));var fs=require('fs');var Redis=require(_0xe62b('0x5'));var db=require(_0xe62b('0x6'))['db'];var utils=require(_0xe62b('0x7'));var logger=require('../../config/logger')(_0xe62b('0x8'));var config=require('../../config/environment');var jayson=require(_0xe62b('0x9'));var client=jayson[_0xe62b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3db94a,_0x554541,_0x48e3f6){return new BPromise(function(_0x57b40e,_0x3e1f2c){return client[_0xe62b('0xb')](_0x3db94a,_0x48e3f6)['then'](function(_0x37b1c4){logger[_0xe62b('0xc')](_0xe62b('0xd'),_0x554541,_0xe62b('0xe'));logger[_0xe62b('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x554541,_0xe62b('0xe'),JSON['stringify'](_0x37b1c4));if(_0x37b1c4[_0xe62b('0x10')]){if(_0x37b1c4[_0xe62b('0x10')][_0xe62b('0x11')]===0x1f4){logger[_0xe62b('0x10')](_0xe62b('0xd'),_0x554541,_0x37b1c4['error'][_0xe62b('0x12')]);return _0x3e1f2c(_0x37b1c4['error'][_0xe62b('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x554541,_0x37b1c4['error'][_0xe62b('0x12')]);return _0x57b40e(_0x37b1c4['error']['message']);}else{logger[_0xe62b('0xc')](_0xe62b('0xd'),_0x554541,_0xe62b('0xe'));_0x57b40e(_0x37b1c4[_0xe62b('0x13')][_0xe62b('0x12')]);}})[_0xe62b('0x14')](function(_0x54bbfa){logger['error'](_0xe62b('0xd'),_0x554541,_0x54bbfa);_0x3e1f2c(_0x54bbfa);});});} \ No newline at end of file +var _0xe9c8=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x14a6ed,_0x1f879e){var _0x3bcbc4=function(_0x30d0b3){while(--_0x30d0b3){_0x14a6ed['push'](_0x14a6ed['shift']());}};_0x3bcbc4(++_0x1f879e);}(_0xe9c8,0x106));var _0x8e9c=function(_0x50c186,_0xf7791){_0x50c186=_0x50c186-0x0;var _0x1da419=_0xe9c8[_0x50c186];return _0x1da419;};'use strict';var _=require(_0x8e9c('0x0'));var util=require(_0x8e9c('0x1'));var moment=require(_0x8e9c('0x2'));var BPromise=require(_0x8e9c('0x3'));var rs=require(_0x8e9c('0x4'));var fs=require('fs');var Redis=require(_0x8e9c('0x5'));var db=require(_0x8e9c('0x6'))['db'];var utils=require(_0x8e9c('0x7'));var logger=require(_0x8e9c('0x8'))(_0x8e9c('0x9'));var config=require(_0x8e9c('0xa'));var jayson=require(_0x8e9c('0xb'));var client=jayson[_0x8e9c('0xc')][_0x8e9c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bd17f,_0x1a35a8,_0x279b39){return new BPromise(function(_0x33564a,_0x387d01){return client[_0x8e9c('0xe')](_0x4bd17f,_0x279b39)[_0x8e9c('0xf')](function(_0x44bfec){logger[_0x8e9c('0x10')](_0x8e9c('0x11'),_0x1a35a8,_0x8e9c('0x12'));logger[_0x8e9c('0x13')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1a35a8,_0x8e9c('0x12'),JSON['stringify'](_0x44bfec));if(_0x44bfec['error']){if(_0x44bfec[_0x8e9c('0x14')][_0x8e9c('0x15')]===0x1f4){logger[_0x8e9c('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x1a35a8,_0x44bfec[_0x8e9c('0x14')][_0x8e9c('0x16')]);return _0x387d01(_0x44bfec[_0x8e9c('0x14')][_0x8e9c('0x16')]);}logger['error'](_0x8e9c('0x11'),_0x1a35a8,_0x44bfec[_0x8e9c('0x14')][_0x8e9c('0x16')]);return _0x33564a(_0x44bfec[_0x8e9c('0x14')][_0x8e9c('0x16')]);}else{logger[_0x8e9c('0x10')](_0x8e9c('0x11'),_0x1a35a8,_0x8e9c('0x12'));_0x33564a(_0x44bfec[_0x8e9c('0x17')][_0x8e9c('0x16')]);}})[_0x8e9c('0x18')](function(_0xc4760c){logger[_0x8e9c('0x14')](_0x8e9c('0x11'),_0x1a35a8,_0xc4760c);_0x387d01(_0xc4760c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ac42571..4e8e05f 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d496c,_0x3e3f9d){var _0x2b7a91=function(_0x5c5b26){while(--_0x5c5b26){_0x2d496c['push'](_0x2d496c['shift']());}};_0x2b7a91(++_0x3e3f9d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xcb91[_0x5b5cde];return _0x364ad2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x38db76,_0xa73369){var _0x1e51db=function(_0x5814af){while(--_0x5814af){_0x38db76['push'](_0x38db76['shift']());}};_0x1e51db(++_0xa73369);}(_0xedd9,0xfc));var _0x9edd=function(_0x5984a2,_0x597338){_0x5984a2=_0x5984a2-0x0;var _0x435a53=_0xedd9[_0x5984a2];return _0x435a53;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5cdc4b9..281ebe2 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 _0xabbc=['sequelize','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xabbc,0x1bc));var _0xcabb=function(_0x533852,_0x5e1347){_0x533852=_0x533852-0x0;var _0x3b39f2=_0xabbc[_0x533852];return _0x3b39f2;};'use strict';var Sequelize=require(_0xcabb('0x0'));module[_0xcabb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6f6=['exports','sequelize'];(function(_0x562582,_0x459282){var _0x37c6cb=function(_0x48f239){while(--_0x48f239){_0x562582['push'](_0x562582['shift']());}};_0x37c6cb(++_0x459282);}(_0xc6f6,0x1cb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6c6f('0x0'));module[_0x6c6f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 7b12c70..90daa84 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 _0xc6eb=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','request-promise','path'];(function(_0x5285de,_0x554a15){var _0x55691e=function(_0x347520){while(--_0x347520){_0x5285de['push'](_0x5285de['shift']());}};_0x55691e(++_0x554a15);}(_0xc6eb,0xe1));var _0xbc6e=function(_0x51ce14,_0x5cd58b){_0x51ce14=_0x51ce14-0x0;var _0x301a2d=_0xc6eb[_0x51ce14];return _0x301a2d;};'use strict';var _=require(_0xbc6e('0x0'));var util=require(_0xbc6e('0x1'));var logger=require(_0xbc6e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc6e('0x3'));var fs=require('fs');var path=require(_0xbc6e('0x4'));var rimraf=require(_0xbc6e('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc6e('0x6'));module[_0xbc6e('0x7')]=function(_0xdce366,_0x8f1048){return _0xdce366[_0xbc6e('0x8')]('UserMailQueue',attributes,{'tableName':_0xbc6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde13=['define','UserMailQueue','user_has_mail_queues','lodash','util','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xde13,0x121));var _0x3de1=function(_0x9d4921,_0x5bfaaa){_0x9d4921=_0x9d4921-0x0;var _0xbecfb1=_0xde13[_0x9d4921];return _0xbecfb1;};'use strict';var _=require(_0x3de1('0x0'));var util=require(_0x3de1('0x1'));var logger=require('../../config/logger')(_0x3de1('0x2'));var moment=require('moment');var BPromise=require(_0x3de1('0x3'));var rp=require(_0x3de1('0x4'));var fs=require('fs');var path=require(_0x3de1('0x5'));var rimraf=require(_0x3de1('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x3de1('0x7')]=function(_0x554997,_0x44c2fd){return _0x554997[_0x3de1('0x8')](_0x3de1('0x9'),attributes,{'tableName':_0x3de1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 5faf781..92730d7 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x40c64f,_0x1ff2a2){var _0x3882c1=function(_0x3506a3){while(--_0x3506a3){_0x40c64f['push'](_0x40c64f['shift']());}};_0x3882c1(++_0x1ff2a2);}(_0x3e74,0x175));var _0x43e7=function(_0x508642,_0x32e05b){_0x508642=_0x508642-0x0;var _0x442d9f=_0x3e74[_0x508642];return _0x442d9f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x16285d,_0x47b433){var _0x1e666a=function(_0x345942){while(--_0x345942){_0x16285d['push'](_0x16285d['shift']());}};_0x1e666a(++_0x47b433);}(_0xe14b,0x93));var _0xbe14=function(_0x41979f,_0x299fae){_0x41979f=_0x41979f-0x0;var _0x29f0b9=_0xe14b[_0x41979f];return _0x29f0b9;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index effa08a..5060d4d 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 _0xe76c=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./userNotification.controller','exports'];(function(_0x40ef20,_0x294d44){var _0x415188=function(_0x213549){while(--_0x213549){_0x40ef20['push'](_0x40ef20['shift']());}};_0x415188(++_0x294d44);}(_0xe76c,0x171));var _0xce76=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xe76c[_0x386c3e];return _0x4b8e13;};'use strict';var multer=require(_0xce76('0x0'));var util=require(_0xce76('0x1'));var path=require(_0xce76('0x2'));var timeout=require('connect-timeout');var express=require(_0xce76('0x3'));var router=express[_0xce76('0x4')]();var fs_extra=require(_0xce76('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce76('0x6'));var config=require('../../config/environment');var controller=require(_0xce76('0x7'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xce76('0x8')]=router; \ No newline at end of file +var _0x4509=['../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4509,0x126));var _0x9450=function(_0x404516,_0x399245){_0x404516=_0x404516-0x0;var _0xd56781=_0x4509[_0x404516];return _0xd56781;};'use strict';var multer=require(_0x9450('0x0'));var util=require(_0x9450('0x1'));var path=require(_0x9450('0x2'));var timeout=require(_0x9450('0x3'));var express=require(_0x9450('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9450('0x5'));var interaction=require(_0x9450('0x6'));var config=require('../../config/environment');var controller=require(_0x9450('0x7'));router[_0x9450('0x8')]('/',auth[_0x9450('0x9')](),controller[_0x9450('0xa')]);module[_0x9450('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 58d6150..a52074c 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 _0x31b4=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0x31b4,0xf2));var _0x431b=function(_0x67a688,_0x3019b6){_0x67a688=_0x67a688-0x0;var _0x2f197a=_0x31b4[_0x67a688];return _0x2f197a;};'use strict';var Sequelize=require(_0x431b('0x0'));module[_0x431b('0x1')]={'body':{'type':Sequelize[_0x431b('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x431b('0x3')]}}; \ No newline at end of file +var _0xc1c2=['STRING','BOOLEAN','TEXT'];(function(_0x172f74,_0x1d0434){var _0x51d04e=function(_0x118c23){while(--_0x118c23){_0x172f74['push'](_0x172f74['shift']());}};_0x51d04e(++_0x1d0434);}(_0xc1c2,0x104));var _0x2c1c=function(_0x116bc9,_0x5e8d8b){_0x116bc9=_0x116bc9-0x0;var _0x36b11b=_0xc1c2[_0x116bc9];return _0x36b11b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x2c1c('0x0')]},'senderName':{'type':Sequelize[_0x2c1c('0x1')]},'recipientsId':{'type':Sequelize[_0x2c1c('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2c1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1d1d308..7c73801 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 _0x7f8c=['Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','replace','queue','Queue','push','all','flatten','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','./userNotification.socket','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch'];(function(_0x4ba774,_0x3bec9b){var _0x49f22c=function(_0x2ede12){while(--_0x2ede12){_0x4ba774['push'](_0x4ba774['shift']());}};_0x49f22c(++_0x3bec9b);}(_0x7f8c,0xd9));var _0xc7f8=function(_0xef241b,_0x3c216f){_0xef241b=_0xef241b-0x0;var _0x5cfa2e=_0x7f8c[_0xef241b];return _0x5cfa2e;};'use strict';var emlformat=require(_0xc7f8('0x0'));var rimraf=require(_0xc7f8('0x1'));var zipdir=require(_0xc7f8('0x2'));var jsonpatch=require(_0xc7f8('0x3'));var rp=require('request-promise');var moment=require(_0xc7f8('0x4'));var BPromise=require(_0xc7f8('0x5'));var Mustache=require('mustache');var util=require(_0xc7f8('0x6'));var path=require(_0xc7f8('0x7'));var sox=require(_0xc7f8('0x8'));var csv=require(_0xc7f8('0x9'));var ejs=require(_0xc7f8('0xa'));var fs=require('fs');var fs_extra=require(_0xc7f8('0xb'));var _=require(_0xc7f8('0xc'));var squel=require(_0xc7f8('0xd'));var crypto=require(_0xc7f8('0xe'));var jsforce=require(_0xc7f8('0xf'));var deskjs=require(_0xc7f8('0x10'));var toCsv=require(_0xc7f8('0x9'));var querystring=require(_0xc7f8('0x11'));var Papa=require(_0xc7f8('0x12'));var Redis=require(_0xc7f8('0x13'));var authService=require(_0xc7f8('0x14'));var qs=require(_0xc7f8('0x15'));var as=require(_0xc7f8('0x16'));var hardwareService=require(_0xc7f8('0x17'));var logger=require(_0xc7f8('0x18'))(_0xc7f8('0x19'));var utils=require('../../config/utils');var config=require(_0xc7f8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc7f8('0x1b')]=_['defaults'](config[_0xc7f8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7f8('0x1b')]));require(_0xc7f8('0x1c'))['register'](socket);function respondWithStatusCode(_0x4d87a4,_0x1c8d9d){_0x1c8d9d=_0x1c8d9d||0xcc;return function(_0x38c4b5){if(_0x38c4b5){return _0x4d87a4['sendStatus'](_0x1c8d9d);}return _0x4d87a4['status'](_0x1c8d9d)[_0xc7f8('0x1d')]();};}function respondWithResult(_0x5e6de1,_0x4ba518){_0x4ba518=_0x4ba518||0xc8;return function(_0x3e0bef){if(_0x3e0bef){return _0x5e6de1[_0xc7f8('0x1e')](_0x4ba518)[_0xc7f8('0x1f')](_0x3e0bef);}};}function respondWithFilteredResult(_0x984069,_0x3d27f9){return function(_0x389a14){if(_0x389a14){var _0x329606=typeof _0x3d27f9[_0xc7f8('0x20')]===_0xc7f8('0x21')&&typeof _0x3d27f9[_0xc7f8('0x22')]===_0xc7f8('0x21');var _0x61bf49=_0x389a14[_0xc7f8('0x23')];var _0xfec17=_0x329606?0x0:_0x3d27f9[_0xc7f8('0x20')];var _0x5ce1a0=_0x329606?_0x389a14[_0xc7f8('0x23')]:_0x3d27f9[_0xc7f8('0x20')]+_0x3d27f9[_0xc7f8('0x22')];var _0x29b926;if(_0x5ce1a0>=_0x61bf49){_0x5ce1a0=_0x61bf49;_0x29b926=0xc8;}else{_0x29b926=0xce;}_0x984069['status'](_0x29b926);return _0x984069[_0xc7f8('0x24')]('Content-Range',_0xfec17+'-'+_0x5ce1a0+'/'+_0x61bf49)['json'](_0x389a14);}return null;};}function patchUpdates(_0x5b7c09){return function(_0x487dd0){try{jsonpatch[_0xc7f8('0x25')](_0x487dd0,_0x5b7c09,!![]);}catch(_0x3e7fee){return BPromise[_0xc7f8('0x26')](_0x3e7fee);}return _0x487dd0[_0xc7f8('0x27')]();};}function saveUpdates(_0x2a849d,_0x5e2d2d){return function(_0x32f14f){if(_0x32f14f){return _0x32f14f['update'](_0x2a849d)[_0xc7f8('0x28')](function(_0x45d80f){return _0x45d80f;});}return null;};}function removeEntity(_0x33ffd8,_0x2fb91f){return function(_0x2b61e2){if(_0x2b61e2){return _0x2b61e2[_0xc7f8('0x29')]()['then'](function(){_0x33ffd8[_0xc7f8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e97db,_0x5ccafe){return function(_0x31fa53){if(!_0x31fa53){_0x2e97db['sendStatus'](0x194);}return _0x31fa53;};}function handleError(_0x53d562,_0x3938a5){_0x3938a5=_0x3938a5||0x1f4;return function(_0x564935){logger[_0xc7f8('0x2a')](_0x564935[_0xc7f8('0x2b')]);if(_0x564935['name']){delete _0x564935['name'];}_0x53d562[_0xc7f8('0x1e')](_0x3938a5)[_0xc7f8('0x2c')](_0x564935);};}exports[_0xc7f8('0x2d')]=function(_0x2ece5a,_0x33747a,_0x7f9268){if(!_0x2ece5a['body'][_0xc7f8('0x2e')](_0xc7f8('0x2f'))&&!_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x31'))){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x34'));}else{if(_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x31'))&&!_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x35'))){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x36'));}if(!_0x2ece5a[_0xc7f8('0x30')]['hasOwnProperty']('recipients')){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x37'));}else{try{var _0x344400=JSON['parse'](_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x38')]);}catch(_0x1549d4){logger[_0xc7f8('0x2a')](_0x1549d4);throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x39'));}var _0x4107ec=['chatqueue',_0xc7f8('0x3a'),_0xc7f8('0x3b'),_0xc7f8('0x3c'),_0xc7f8('0x3d'),_0xc7f8('0x3e'),_0xc7f8('0x3f'),'team',_0xc7f8('0x40')];if(_[_0xc7f8('0x41')](_0x344400,function(_0x4de16e){return!_[_0xc7f8('0x42')](_0x4107ec,_0x4de16e[_0xc7f8('0x43')][_0xc7f8('0x44')]());})){throw new db['Sequelize'][(_0xc7f8('0x33'))](_0xc7f8('0x45'));}}}var _0x342904={};_0x342904[_0xc7f8('0x46')]=_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x46'))?_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x46')]:_0x2ece5a['user']['fullname'];_0x342904['recipientsDescription']=_[_0xc7f8('0x47')](_0x2ece5a['body'][_0xc7f8('0x48')])?null:_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x48')];_0x342904[_0xc7f8('0x49')]=_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x49')]||![];_0x342904[_0xc7f8('0x4a')]=_0x2ece5a[_0xc7f8('0x40')]['id'];return getContent(_0x2ece5a[_0xc7f8('0x30')])['then'](function(_0x3b88b2){_0x342904[_0xc7f8('0x30')]=_0x3b88b2;return getRecipients(_0x344400);})[_0xc7f8('0x28')](function(_0x2d3924){_0x342904['recipientsId']=_[_0xc7f8('0x4b')](_0x2d3924)[_0xc7f8('0x4c')](',');return db[_0xc7f8('0x4d')][_0xc7f8('0x4e')](function(_0x3dbf85){return db[_0xc7f8('0x4f')][_0xc7f8('0x50')](_0x342904,{'raw':!![],'transaction':_0x3dbf85})[_0xc7f8('0x28')](function(_0x3d9ea1){var _0x3dfb7a={'sender':_0x342904['senderName'],'description':_0x342904[_0xc7f8('0x48')],'content':_0x342904[_0xc7f8('0x30')],'beep':_0x342904['beep']};_0x2d3924[_0xc7f8('0x51')](function(_0x381b1b){_0x3dfb7a[_0xc7f8('0x52')]=_0x381b1b;socket[_0xc7f8('0x53')](_0xc7f8('0x54'),_0x3dfb7a);});return _0x3d9ea1;});});})[_0xc7f8('0x28')](respondWithResult(_0x33747a,0xc9))[_0xc7f8('0x55')](handleError(_0x33747a,null));};function getContent(_0x38161d){return new BPromise(function(_0x1b4df5,_0x2f377d){if(_0x38161d[_0xc7f8('0x2f')]){_0x1b4df5(_0x38161d[_0xc7f8('0x2f')]);return;}return db[_0xc7f8('0x56')]['findOne']({'attributes':[_0xc7f8('0x57')],'where':{'id':_0x38161d[_0xc7f8('0x31')]},'raw':!![]})[_0xc7f8('0x28')](function(_0x182268){if(!_0x182268)throw new db['Sequelize'][(_0xc7f8('0x33'))](_0xc7f8('0x58'));var _0x261f01=Mustache[_0xc7f8('0x59')](_0x182268['html'],_0x38161d[_0xc7f8('0x35')]);_0x1b4df5(_0x261f01);})[_0xc7f8('0x55')](function(_0x3be99e){_0x2f377d(_0x3be99e);});});}function getRecipients(_0x37d90e){return new BPromise(function(_0x452a90,_0xb1aef2){var _0x4c0148=[];var _0x3d86ac=[];_0x37d90e[_0xc7f8('0x51')](function(_0x5dce6f){var _0x3194c0=_[_0xc7f8('0x5a')](_0x5dce6f['model'][_0xc7f8('0x44')]());if(_0x3194c0==='User'){_0x4c0148=_[_0xc7f8('0x5b')](_0x4c0148,_0x5dce6f[_0xc7f8('0x5c')]);}else{if(_[_0xc7f8('0x42')](_0x3194c0,'queue'))_0x3194c0=_0x3194c0[_0xc7f8('0x5d')](_0xc7f8('0x5e'),_0xc7f8('0x5f'));_0x5dce6f[_0xc7f8('0x5c')][_0xc7f8('0x51')](function(_0x470ce0){_0x3d86ac[_0xc7f8('0x60')](getAgents(_0x3194c0,_0x470ce0));});}});return BPromise[_0xc7f8('0x61')](_0x3d86ac)['then'](function(_0x1689ce){_0x4c0148=_[_0xc7f8('0x5b')](_0x4c0148,_[_0xc7f8('0x62')](_0x1689ce));_0x452a90(_0x4c0148);})[_0xc7f8('0x55')](function(_0x288554){_0xb1aef2(_0x288554);});});}function getAgents(_0x4ac272,_0xbc3f08){return new BPromise(function(_0xcbde41,_0x54f52c){return db[_0x4ac272][_0xc7f8('0x63')]({'where':{'id':_0xbc3f08}})[_0xc7f8('0x28')](function(_0x1c9a0b){return _0x1c9a0b['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0xf3774){var _0x17a190=_[_0xc7f8('0x64')](_0xf3774,'id');_0xcbde41(_0x17a190);});})['catch'](function(_0x3db692){_0x54f52c(_0x3db692);});});} \ No newline at end of file +var _0x7dc2=['fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName'];(function(_0x286d7c,_0x24589e){var _0x26479b=function(_0x3066eb){while(--_0x3066eb){_0x286d7c['push'](_0x286d7c['shift']());}};_0x26479b(++_0x24589e);}(_0x7dc2,0x86));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x27dc('0x0'));var rimraf=require(_0x27dc('0x1'));var zipdir=require(_0x27dc('0x2'));var jsonpatch=require(_0x27dc('0x3'));var rp=require(_0x27dc('0x4'));var moment=require('moment');var BPromise=require(_0x27dc('0x5'));var Mustache=require(_0x27dc('0x6'));var util=require(_0x27dc('0x7'));var path=require(_0x27dc('0x8'));var sox=require(_0x27dc('0x9'));var csv=require(_0x27dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27dc('0xb'));var _=require(_0x27dc('0xc'));var squel=require(_0x27dc('0xd'));var crypto=require(_0x27dc('0xe'));var jsforce=require(_0x27dc('0xf'));var deskjs=require(_0x27dc('0x10'));var toCsv=require(_0x27dc('0xa'));var querystring=require(_0x27dc('0x11'));var Papa=require('papaparse');var Redis=require(_0x27dc('0x12'));var authService=require(_0x27dc('0x13'));var qs=require(_0x27dc('0x14'));var as=require(_0x27dc('0x15'));var hardwareService=require(_0x27dc('0x16'));var logger=require(_0x27dc('0x17'))(_0x27dc('0x18'));var utils=require(_0x27dc('0x19'));var config=require(_0x27dc('0x1a'));var licenseUtil=require(_0x27dc('0x1b'));var db=require(_0x27dc('0x1c'))['db'];config[_0x27dc('0x1d')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x27dc('0x1e'))(new Redis(config['redis']));require(_0x27dc('0x1f'))['register'](socket);function respondWithStatusCode(_0x4bad28,_0x1099fe){_0x1099fe=_0x1099fe||0xcc;return function(_0x32eb00){if(_0x32eb00){return _0x4bad28[_0x27dc('0x20')](_0x1099fe);}return _0x4bad28[_0x27dc('0x21')](_0x1099fe)[_0x27dc('0x22')]();};}function respondWithResult(_0x4b919c,_0x5f20c6){_0x5f20c6=_0x5f20c6||0xc8;return function(_0x4e840d){if(_0x4e840d){return _0x4b919c['status'](_0x5f20c6)[_0x27dc('0x23')](_0x4e840d);}};}function respondWithFilteredResult(_0x2ee117,_0x2f63b0){return function(_0x59fa67){if(_0x59fa67){var _0x172405=typeof _0x2f63b0[_0x27dc('0x24')]===_0x27dc('0x25')&&typeof _0x2f63b0[_0x27dc('0x26')]===_0x27dc('0x25');var _0x45a0ce=_0x59fa67['count'];var _0x38ff53=_0x172405?0x0:_0x2f63b0[_0x27dc('0x24')];var _0x159e71=_0x172405?_0x59fa67['count']:_0x2f63b0['offset']+_0x2f63b0['limit'];var _0x132277;if(_0x159e71>=_0x45a0ce){_0x159e71=_0x45a0ce;_0x132277=0xc8;}else{_0x132277=0xce;}_0x2ee117[_0x27dc('0x21')](_0x132277);return _0x2ee117[_0x27dc('0x27')](_0x27dc('0x28'),_0x38ff53+'-'+_0x159e71+'/'+_0x45a0ce)[_0x27dc('0x23')](_0x59fa67);}return null;};}function patchUpdates(_0x3069e9){return function(_0x49853b){try{jsonpatch[_0x27dc('0x29')](_0x49853b,_0x3069e9,!![]);}catch(_0x238c7f){return BPromise[_0x27dc('0x2a')](_0x238c7f);}return _0x49853b[_0x27dc('0x2b')]();};}function saveUpdates(_0x46c933,_0x113024){return function(_0x4f5d72){if(_0x4f5d72){return _0x4f5d72[_0x27dc('0x2c')](_0x46c933)[_0x27dc('0x2d')](function(_0x140263){return _0x140263;});}return null;};}function removeEntity(_0x2a5293,_0x26d721){return function(_0xabac98){if(_0xabac98){return _0xabac98[_0x27dc('0x2e')]()['then'](function(){_0x2a5293[_0x27dc('0x21')](0xcc)[_0x27dc('0x22')]();});}};}function handleEntityNotFound(_0x3d2a30,_0x2755c8){return function(_0x5390bf){if(!_0x5390bf){_0x3d2a30['sendStatus'](0x194);}return _0x5390bf;};}function handleError(_0x219849,_0x26daee){_0x26daee=_0x26daee||0x1f4;return function(_0x2bc6b9){logger[_0x27dc('0x2f')](_0x2bc6b9['stack']);if(_0x2bc6b9[_0x27dc('0x30')]){delete _0x2bc6b9['name'];}_0x219849[_0x27dc('0x21')](_0x26daee)[_0x27dc('0x31')](_0x2bc6b9);};}exports[_0x27dc('0x32')]=function(_0x32eb1b,_0x1946d0,_0x1ab5b6){if(!_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x34')]('text')&&!_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x34')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x27dc('0x35'));}else{if(_0x32eb1b['body'][_0x27dc('0x34')](_0x27dc('0x36'))&&!_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x34')]('view')){throw new db[(_0x27dc('0x37'))][(_0x27dc('0x38'))](_0x27dc('0x39'));}if(!_0x32eb1b['body']['hasOwnProperty'](_0x27dc('0x3a'))){throw new db[(_0x27dc('0x37'))][(_0x27dc('0x38'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x7ea686=JSON[_0x27dc('0x3b')](_0x32eb1b['body'][_0x27dc('0x3a')]);}catch(_0x1f524d){logger[_0x27dc('0x2f')](_0x1f524d);throw new db[(_0x27dc('0x37'))][(_0x27dc('0x38'))](_0x27dc('0x3c'));}var _0x387cc2=[_0x27dc('0x3d'),_0x27dc('0x3e'),'mailqueue',_0x27dc('0x3f'),_0x27dc('0x40'),'voicequeue',_0x27dc('0x41'),_0x27dc('0x42'),_0x27dc('0x43')];if(_[_0x27dc('0x44')](_0x7ea686,function(_0x4bb217){return!_[_0x27dc('0x45')](_0x387cc2,_0x4bb217[_0x27dc('0x46')][_0x27dc('0x47')]());})){throw new db['Sequelize'][(_0x27dc('0x38'))](_0x27dc('0x48'));}}}var _0x44cfe2={};_0x44cfe2[_0x27dc('0x49')]=_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x34')](_0x27dc('0x49'))?_0x32eb1b['body'][_0x27dc('0x49')]:_0x32eb1b[_0x27dc('0x43')][_0x27dc('0x4a')];_0x44cfe2['recipientsDescription']=_[_0x27dc('0x4b')](_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x4c')])?null:_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x4c')];_0x44cfe2['beep']=_0x32eb1b[_0x27dc('0x33')][_0x27dc('0x4d')]||![];_0x44cfe2[_0x27dc('0x4e')]=_0x32eb1b[_0x27dc('0x43')]['id'];return getContent(_0x32eb1b[_0x27dc('0x33')])['then'](function(_0x281bce){_0x44cfe2['body']=_0x281bce;return getRecipients(_0x7ea686);})[_0x27dc('0x2d')](function(_0x565b85){_0x44cfe2[_0x27dc('0x4f')]=_[_0x27dc('0x50')](_0x565b85)[_0x27dc('0x51')](',');return db['sequelize']['transaction'](function(_0x966761){return db[_0x27dc('0x52')][_0x27dc('0x53')](_0x44cfe2,{'raw':!![],'transaction':_0x966761})[_0x27dc('0x2d')](function(_0x9baaca){var _0x16d497={'sender':_0x44cfe2[_0x27dc('0x49')],'description':_0x44cfe2['recipientsDescription'],'content':_0x44cfe2[_0x27dc('0x33')],'beep':_0x44cfe2[_0x27dc('0x4d')]};_0x565b85['forEach'](function(_0x38bed7){_0x16d497['recipient']=_0x38bed7;socket[_0x27dc('0x54')](_0x27dc('0x55'),_0x16d497);});return _0x9baaca;});});})[_0x27dc('0x2d')](respondWithResult(_0x1946d0,0xc9))[_0x27dc('0x56')](handleError(_0x1946d0,null));};function getContent(_0x2875fc){return new BPromise(function(_0x293c00,_0x325bcd){if(_0x2875fc[_0x27dc('0x57')]){_0x293c00(_0x2875fc[_0x27dc('0x57')]);return;}return db[_0x27dc('0x58')]['findOne']({'attributes':[_0x27dc('0x59')],'where':{'id':_0x2875fc[_0x27dc('0x36')]},'raw':!![]})[_0x27dc('0x2d')](function(_0x56df25){if(!_0x56df25)throw new db[(_0x27dc('0x37'))][(_0x27dc('0x38'))](_0x27dc('0x5a'));var _0xe77cb1=Mustache[_0x27dc('0x5b')](_0x56df25[_0x27dc('0x59')],_0x2875fc[_0x27dc('0x5c')]);_0x293c00(_0xe77cb1);})['catch'](function(_0x11d586){_0x325bcd(_0x11d586);});});}function getRecipients(_0x4181da){return new BPromise(function(_0x5676c4,_0x10061a){var _0x173f48=[];var _0x5aff54=[];_0x4181da[_0x27dc('0x5d')](function(_0x378bfb){var _0x116c82=_['startCase'](_0x378bfb[_0x27dc('0x46')]['toLowerCase']());if(_0x116c82===_0x27dc('0x5e')){_0x173f48=_[_0x27dc('0x5f')](_0x173f48,_0x378bfb[_0x27dc('0x60')]);}else{if(_[_0x27dc('0x45')](_0x116c82,_0x27dc('0x61')))_0x116c82=_0x116c82[_0x27dc('0x62')](_0x27dc('0x61'),_0x27dc('0x63'));_0x378bfb['ids']['forEach'](function(_0x56a431){_0x5aff54[_0x27dc('0x64')](getAgents(_0x116c82,_0x56a431));});}});return BPromise['all'](_0x5aff54)['then'](function(_0x5c8734){_0x173f48=_[_0x27dc('0x5f')](_0x173f48,_[_0x27dc('0x65')](_0x5c8734));_0x5676c4(_0x173f48);})[_0x27dc('0x56')](function(_0x3e8deb){_0x10061a(_0x3e8deb);});});}function getAgents(_0x324059,_0x13b018){return new BPromise(function(_0x8e56b1,_0x50af8d){return db[_0x324059]['findOne']({'where':{'id':_0x13b018}})[_0x27dc('0x2d')](function(_0x50fae3){return _0x50fae3[_0x27dc('0x66')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4e59a3){var _0x435558=_[_0x27dc('0x67')](_0x4e59a3,'id');_0x8e56b1(_0x435558);});})[_0x27dc('0x56')](function(_0x5c46b6){_0x50af8d(_0x5c46b6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7d4ba17..46bb9f1 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 _0x0d3a=['../../mysqldb','UserNotification','save','update','remove','emit','hook','exports','events'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x0d3a,0x13a));var _0xa0d3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0d3a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa0d3('0x0'));var UserNotification=require(_0xa0d3('0x1'))['db'][_0xa0d3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa0d3('0x3'),'afterUpdate':_0xa0d3('0x4'),'afterDestroy':_0xa0d3('0x5')};function emitEvent(_0x19ded7){return function(_0x29a9b5,_0x54b477,_0x14f3bf){UserNotificationEvents[_0xa0d3('0x6')](_0x19ded7+':'+_0x29a9b5['id'],_0x29a9b5);UserNotificationEvents['emit'](_0x19ded7,_0x29a9b5);_0x14f3bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xa0d3('0x7')](e,emitEvent(event));}}module[_0xa0d3('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xa218=['hasOwnProperty','exports','events','UserNotification','setMaxListeners','save','update','emit'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0xa218,0x112));var _0x8a21=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa218[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require(_0x8a21('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x8a21('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8a21('0x2')](0x0);var events={'afterCreate':_0x8a21('0x3'),'afterUpdate':_0x8a21('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa75149){return function(_0x5c2624,_0x4b62cc,_0x52be8d){UserNotificationEvents[_0x8a21('0x5')](_0xa75149+':'+_0x5c2624['id'],_0x5c2624);UserNotificationEvents['emit'](_0xa75149,_0x5c2624);_0x52be8d(null);};}for(var e in events){if(events[_0x8a21('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x8a21('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5e9f508..88bd8b9 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 _0xbd0c=['path','rimraf','../../config/environment','exports','define','userNotifications','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xbd0c,0x8a));var _0xcbd0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd0c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xcbd0('0x0'));var util=require('util');var logger=require(_0xcbd0('0x1'))(_0xcbd0('0x2'));var moment=require(_0xcbd0('0x3'));var BPromise=require(_0xcbd0('0x4'));var rp=require(_0xcbd0('0x5'));var fs=require('fs');var path=require(_0xcbd0('0x6'));var rimraf=require(_0xcbd0('0x7'));var config=require(_0xcbd0('0x8'));var attributes=require('./userNotification.attributes');module[_0xcbd0('0x9')]=function(_0x30df0b,_0x3c2333){return _0x30df0b[_0xcbd0('0xa')]('UserNotification',attributes,{'tableName':_0xcbd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1b72=['rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path'];(function(_0xfe2302,_0x86e767){var _0x14f90d=function(_0x5a7726){while(--_0x5a7726){_0xfe2302['push'](_0xfe2302['shift']());}};_0x14f90d(++_0x86e767);}(_0x1b72,0x67));var _0x21b7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b72[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x21b7('0x0'));var logger=require(_0x21b7('0x1'))('api');var moment=require(_0x21b7('0x2'));var BPromise=require(_0x21b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21b7('0x4'));var rimraf=require(_0x21b7('0x5'));var config=require(_0x21b7('0x6'));var attributes=require(_0x21b7('0x7'));module['exports']=function(_0x2ccc0d,_0x5315f2){return _0x2ccc0d[_0x21b7('0x8')](_0x21b7('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21b7('0xa'),'collate':_0x21b7('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index daafa7b..fb1d440 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 _0x99ea=['register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userNotification.socket'];(function(_0x350034,_0x341770){var _0x303eb4=function(_0x306295){while(--_0x306295){_0x350034['push'](_0x350034['shift']());}};_0x303eb4(++_0x341770);}(_0x99ea,0x1c7));var _0xa99e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x99ea[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa99e('0x0'));var util=require(_0xa99e('0x1'));var moment=require('moment');var BPromise=require(_0xa99e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa99e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa99e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa99e('0x5'));var jayson=require(_0xa99e('0x6'));var client=jayson[_0xa99e('0x7')][_0xa99e('0x8')]({'port':0x232a});config['redis']=_[_0xa99e('0x9')](config[_0xa99e('0xa')],{'host':_0xa99e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa99e('0xa')]));require(_0xa99e('0xc'))[_0xa99e('0xd')](socket);function respondWithRpcPromise(_0x418434,_0x42d449,_0x4b938c){return new BPromise(function(_0x10c127,_0x2fe270){return client[_0xa99e('0xe')](_0x418434,_0x4b938c)['then'](function(_0x422d60){logger[_0xa99e('0xf')](_0xa99e('0x10'),_0x42d449,_0xa99e('0x11'));logger[_0xa99e('0x12')](_0xa99e('0x13'),_0x42d449,_0xa99e('0x11'),JSON[_0xa99e('0x14')](_0x422d60));if(_0x422d60[_0xa99e('0x15')]){if(_0x422d60[_0xa99e('0x15')][_0xa99e('0x16')]===0x1f4){logger[_0xa99e('0x15')](_0xa99e('0x10'),_0x42d449,_0x422d60[_0xa99e('0x15')]['message']);return _0x2fe270(_0x422d60['error'][_0xa99e('0x17')]);}logger[_0xa99e('0x15')](_0xa99e('0x10'),_0x42d449,_0x422d60[_0xa99e('0x15')][_0xa99e('0x17')]);return _0x10c127(_0x422d60[_0xa99e('0x15')]['message']);}else{logger[_0xa99e('0xf')](_0xa99e('0x10'),_0x42d449,_0xa99e('0x11'));_0x10c127(_0x422d60[_0xa99e('0x18')]['message']);}})[_0xa99e('0x19')](function(_0x3cc5de){logger['error']('UserNotification,\x20%s,\x20%s',_0x42d449,_0x3cc5de);_0x2fe270(_0x3cc5de);});});} \ No newline at end of file +var _0x2988=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3b0268,_0x134ef2){var _0x2dd69a=function(_0x3d9dc6){while(--_0x3d9dc6){_0x3b0268['push'](_0x3b0268['shift']());}};_0x2dd69a(++_0x134ef2);}(_0x2988,0x101));var _0x8298=function(_0x2ab6bc,_0x2726fa){_0x2ab6bc=_0x2ab6bc-0x0;var _0x3cce59=_0x2988[_0x2ab6bc];return _0x3cce59;};'use strict';var _=require(_0x8298('0x0'));var util=require(_0x8298('0x1'));var moment=require(_0x8298('0x2'));var BPromise=require(_0x8298('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8298('0x4'))['db'];var utils=require(_0x8298('0x5'));var logger=require(_0x8298('0x6'))(_0x8298('0x7'));var config=require(_0x8298('0x8'));var jayson=require(_0x8298('0x9'));var client=jayson[_0x8298('0xa')][_0x8298('0xb')]({'port':0x232a});config[_0x8298('0xc')]=_['defaults'](config[_0x8298('0xc')],{'host':_0x8298('0xd'),'port':0x18eb});var socket=require(_0x8298('0xe'))(new Redis(config[_0x8298('0xc')]));require(_0x8298('0xf'))[_0x8298('0x10')](socket);function respondWithRpcPromise(_0x59b4f0,_0x5875f2,_0x42aebd){return new BPromise(function(_0x138635,_0x382110){return client[_0x8298('0x11')](_0x59b4f0,_0x42aebd)[_0x8298('0x12')](function(_0x2c5b19){logger[_0x8298('0x13')](_0x8298('0x14'),_0x5875f2,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x5875f2,_0x8298('0x15'),JSON[_0x8298('0x16')](_0x2c5b19));if(_0x2c5b19[_0x8298('0x17')]){if(_0x2c5b19[_0x8298('0x17')][_0x8298('0x18')]===0x1f4){logger[_0x8298('0x17')](_0x8298('0x14'),_0x5875f2,_0x2c5b19[_0x8298('0x17')][_0x8298('0x19')]);return _0x382110(_0x2c5b19[_0x8298('0x17')][_0x8298('0x19')]);}logger['error'](_0x8298('0x14'),_0x5875f2,_0x2c5b19['error'][_0x8298('0x19')]);return _0x138635(_0x2c5b19['error'][_0x8298('0x19')]);}else{logger[_0x8298('0x13')](_0x8298('0x14'),_0x5875f2,_0x8298('0x15'));_0x138635(_0x2c5b19['result'][_0x8298('0x19')]);}})[_0x8298('0x1a')](function(_0x1adb56){logger['error'](_0x8298('0x14'),_0x5875f2,_0x1adb56);_0x382110(_0x1adb56);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index dfa78fa..db64b1f 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 _0x642f=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x642f,0x1e3));var _0xf642=function(_0xe8d2f2,_0x13e30b){_0xe8d2f2=_0xe8d2f2-0x0;var _0x296102=_0x642f[_0xe8d2f2];return _0x296102;};'use strict';var UserNotificationEvents=require(_0xf642('0x0'));var events=[_0xf642('0x1'),_0xf642('0x2'),_0xf642('0x3')];function createListener(_0x451355,_0x1987b0){return function(_0x825f2){_0x1987b0[_0xf642('0x4')](_0x451355,_0x825f2);};}function removeListener(_0x2f8abe,_0x2a9fa5){return function(){UserNotificationEvents[_0xf642('0x5')](_0x2f8abe,_0x2a9fa5);};}exports[_0xf642('0x6')]=function(_0xb0bb8){for(var _0x7ff770=0x0,_0xa0f6c1=events[_0xf642('0x7')];_0x7ff770<_0xa0f6c1;_0x7ff770++){var _0x3322c6=events[_0x7ff770];var _0x2c84cc=createListener(_0xf642('0x8')+_0x3322c6,_0xb0bb8);UserNotificationEvents['on'](_0x3322c6,_0x2c84cc);}}; \ No newline at end of file +var _0xa6b0=['save','remove','update','emit','removeListener','length','./userNotification.events'];(function(_0x3ed528,_0x52481c){var _0x3ac7fb=function(_0x473a8f){while(--_0x473a8f){_0x3ed528['push'](_0x3ed528['shift']());}};_0x3ac7fb(++_0x52481c);}(_0xa6b0,0x18e));var _0x0a6b=function(_0x283693,_0x5b512c){_0x283693=_0x283693-0x0;var _0xd2b8ef=_0xa6b0[_0x283693];return _0xd2b8ef;};'use strict';var UserNotificationEvents=require(_0x0a6b('0x0'));var events=[_0x0a6b('0x1'),_0x0a6b('0x2'),_0x0a6b('0x3')];function createListener(_0x21fcfe,_0x272414){return function(_0x19aa7d){_0x272414[_0x0a6b('0x4')](_0x21fcfe,_0x19aa7d);};}function removeListener(_0x23ff07,_0x1a5f11){return function(){UserNotificationEvents[_0x0a6b('0x5')](_0x23ff07,_0x1a5f11);};}exports['register']=function(_0x4acf60){for(var _0x5064c2=0x0,_0x52dc4f=events[_0x0a6b('0x6')];_0x5064c2<_0x52dc4f;_0x5064c2++){var _0x4eb252=events[_0x5064c2];var _0x468034=createListener('userNotification:'+_0x4eb252,_0x4acf60);UserNotificationEvents['on'](_0x4eb252,_0x468034);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7b298ba..50be67d 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a86a2,_0x560c79){var _0x6beb21=function(_0x5a871d){while(--_0x5a871d){_0x2a86a2['push'](_0x2a86a2['shift']());}};_0x6beb21(++_0x560c79);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x94ea5d,_0xe526c8){var _0x3f1692=function(_0x5c73cf){while(--_0x5c73cf){_0x94ea5d['push'](_0x94ea5d['shift']());}};_0x3f1692(++_0xe526c8);}(_0xe706,0xa3));var _0x6e70=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0xe706[_0x2df84d];return _0x2634ce;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e237c39..04a3297 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 _0x1c9a=['exports','sequelize'];(function(_0x17348b,_0x1a42ba){var _0x3a9762=function(_0x654285){while(--_0x654285){_0x17348b['push'](_0x17348b['shift']());}};_0x3a9762(++_0x1a42ba);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x468031,_0x55d261){_0x468031=_0x468031-0x0;var _0x47accd=_0x1c9a[_0x468031];return _0x47accd;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module[_0xa1c9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x268b=['INTEGER','sequelize','exports'];(function(_0x4344b6,_0x1973cb){var _0x5d6de3=function(_0x4e4047){while(--_0x4e4047){_0x4344b6['push'](_0x4344b6['shift']());}};_0x5d6de3(++_0x1973cb);}(_0x268b,0xca));var _0xb268=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x268b[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0xb268('0x0'));module[_0xb268('0x1')]={'penalty':{'type':Sequelize[_0xb268('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 5139f06..a3bab18 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 _0x8482=['util','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x8482,0x103));var _0x2848=function(_0xc857e5,_0x561cfa){_0xc857e5=_0xc857e5-0x0;var _0x59a0f3=_0x8482[_0xc857e5];return _0x59a0f3;};'use strict';var _=require(_0x2848('0x0'));var util=require(_0x2848('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2848('0x2'));var BPromise=require(_0x2848('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2848('0x4'));var rimraf=require(_0x2848('0x5'));var config=require(_0x2848('0x6'));var attributes=require(_0x2848('0x7'));module['exports']=function(_0x3b6ad3,_0xaf237c){return _0x3b6ad3[_0x2848('0x8')](_0x2848('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea9=['user_has_openchannel_queues','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xcea9,0x90));var _0x9cea=function(_0x48786d,_0x523e00){_0x48786d=_0x48786d-0x0;var _0x44a241=_0xcea9[_0x48786d];return _0x44a241;};'use strict';var _=require(_0x9cea('0x0'));var util=require('util');var logger=require(_0x9cea('0x1'))(_0x9cea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cea('0x4'));var config=require(_0x9cea('0x5'));var attributes=require(_0x9cea('0x6'));module[_0x9cea('0x7')]=function(_0x6f5535,_0x1b61f2){return _0x6f5535[_0x9cea('0x8')](_0x9cea('0x9'),attributes,{'tableName':_0x9cea('0xa'),'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 7beb655..95ba296 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 _0xc820=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x29db09,_0x1462e5){var _0x54cc55=function(_0x318e12){while(--_0x318e12){_0x29db09['push'](_0x29db09['shift']());}};_0x54cc55(++_0x1462e5);}(_0xc820,0x1a9));var _0x0c82=function(_0x1f6a87,_0x1f1605){_0x1f6a87=_0x1f6a87-0x0;var _0x22ef00=_0xc820[_0x1f6a87];return _0x22ef00;};'use strict';var _=require(_0x0c82('0x0'));var util=require(_0x0c82('0x1'));var moment=require(_0x0c82('0x2'));var BPromise=require(_0x0c82('0x3'));var rs=require(_0x0c82('0x4'));var fs=require('fs');var Redis=require(_0x0c82('0x5'));var db=require(_0x0c82('0x6'))['db'];var utils=require(_0x0c82('0x7'));var logger=require(_0x0c82('0x8'))('rpc');var config=require(_0x0c82('0x9'));var jayson=require(_0x0c82('0xa'));var client=jayson[_0x0c82('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25de4f,_0x23679d,_0x4338e1){return new BPromise(function(_0x14eee9,_0x54e5b){return client[_0x0c82('0xc')](_0x25de4f,_0x4338e1)[_0x0c82('0xd')](function(_0xb5365){logger[_0x0c82('0xe')](_0x0c82('0xf'),_0x23679d,_0x0c82('0x10'));logger[_0x0c82('0x11')](_0x0c82('0x12'),_0x23679d,_0x0c82('0x10'),JSON['stringify'](_0xb5365));if(_0xb5365[_0x0c82('0x13')]){if(_0xb5365[_0x0c82('0x13')]['code']===0x1f4){logger[_0x0c82('0x13')](_0x0c82('0xf'),_0x23679d,_0xb5365['error'][_0x0c82('0x14')]);return _0x54e5b(_0xb5365[_0x0c82('0x13')][_0x0c82('0x14')]);}logger['error'](_0x0c82('0xf'),_0x23679d,_0xb5365['error'][_0x0c82('0x14')]);return _0x14eee9(_0xb5365[_0x0c82('0x13')][_0x0c82('0x14')]);}else{logger[_0x0c82('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23679d,_0x0c82('0x10'));_0x14eee9(_0xb5365['result'][_0x0c82('0x14')]);}})[_0x0c82('0x15')](function(_0x514b7c){logger['error'](_0x0c82('0xf'),_0x23679d,_0x514b7c);_0x54e5b(_0x514b7c);});});} \ No newline at end of file +var _0x0695=['info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x30786b,_0x50879b){var _0x26a50d=function(_0x4fe06d){while(--_0x4fe06d){_0x30786b['push'](_0x30786b['shift']());}};_0x26a50d(++_0x50879b);}(_0x0695,0x127));var _0x5069=function(_0x3a3b65,_0x2f239f){_0x3a3b65=_0x3a3b65-0x0;var _0xc09bc0=_0x0695[_0x3a3b65];return _0xc09bc0;};'use strict';var _=require(_0x5069('0x0'));var util=require(_0x5069('0x1'));var moment=require(_0x5069('0x2'));var BPromise=require('bluebird');var rs=require(_0x5069('0x3'));var fs=require('fs');var Redis=require(_0x5069('0x4'));var db=require(_0x5069('0x5'))['db'];var utils=require(_0x5069('0x6'));var logger=require(_0x5069('0x7'))(_0x5069('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5069('0x9')][_0x5069('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf6bd1c,_0x4843f8,_0x57814e){return new BPromise(function(_0x1481af,_0x1babd9){return client[_0x5069('0xb')](_0xf6bd1c,_0x57814e)[_0x5069('0xc')](function(_0x2b0a7d){logger[_0x5069('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4843f8,_0x5069('0xe'));logger['debug'](_0x5069('0xf'),_0x4843f8,_0x5069('0xe'),JSON['stringify'](_0x2b0a7d));if(_0x2b0a7d[_0x5069('0x10')]){if(_0x2b0a7d[_0x5069('0x10')][_0x5069('0x11')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4843f8,_0x2b0a7d['error'][_0x5069('0x12')]);return _0x1babd9(_0x2b0a7d[_0x5069('0x10')]['message']);}logger['error'](_0x5069('0x13'),_0x4843f8,_0x2b0a7d['error'][_0x5069('0x12')]);return _0x1481af(_0x2b0a7d[_0x5069('0x10')][_0x5069('0x12')]);}else{logger['info'](_0x5069('0x13'),_0x4843f8,_0x5069('0xe'));_0x1481af(_0x2b0a7d[_0x5069('0x14')][_0x5069('0x12')]);}})[_0x5069('0x15')](function(_0x528a9b){logger[_0x5069('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4843f8,_0x528a9b);_0x1babd9(_0x528a9b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7c1688b..e87b07f 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 _0x0bf1=['put','update','destroy','delete','/:id/sections','removeSections','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','describe','/:id','isAuthenticated','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0bf1,0xc7));var _0x10bf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0bf1[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x10bf('0x0'));var util=require('util');var path=require(_0x10bf('0x1'));var timeout=require(_0x10bf('0x2'));var express=require(_0x10bf('0x3'));var router=express[_0x10bf('0x4')]();var fs_extra=require(_0x10bf('0x5'));var auth=require(_0x10bf('0x6'));var interaction=require(_0x10bf('0x7'));var config=require(_0x10bf('0x8'));var controller=require(_0x10bf('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x10bf('0xa')](_0x10bf('0xb'),auth['isAuthenticated'](),controller[_0x10bf('0xc')]);router[_0x10bf('0xa')](_0x10bf('0xd'),auth[_0x10bf('0xe')](),controller[_0x10bf('0xf')]);router['get']('/:id/sections',auth[_0x10bf('0xe')](),controller[_0x10bf('0x10')]);router[_0x10bf('0xa')](_0x10bf('0x11'),auth['isAuthenticated'](),controller[_0x10bf('0x12')]);router[_0x10bf('0x13')]('/',auth[_0x10bf('0xe')](),controller[_0x10bf('0x14')]);router[_0x10bf('0x13')](_0x10bf('0x15'),auth[_0x10bf('0xe')](),controller[_0x10bf('0x16')]);router[_0x10bf('0x13')]('/:id/sections',auth[_0x10bf('0xe')](),controller[_0x10bf('0x17')]);router[_0x10bf('0x13')](_0x10bf('0x11'),auth['isAuthenticated'](),controller[_0x10bf('0x18')]);router[_0x10bf('0x19')](_0x10bf('0xd'),auth['isAuthenticated'](),controller[_0x10bf('0x1a')]);router['delete'](_0x10bf('0xd'),auth[_0x10bf('0xe')](),controller[_0x10bf('0x1b')]);router[_0x10bf('0x1c')](_0x10bf('0x1d'),auth['isAuthenticated'](),controller[_0x10bf('0x1e')]);router[_0x10bf('0x1c')](_0x10bf('0x11'),auth[_0x10bf('0xe')](),controller['removeResources']);module[_0x10bf('0x1f')]=router; \ No newline at end of file +var _0xf391=['show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf391,0x1f1));var _0x1f39=function(_0x251f99,_0x224b33){_0x251f99=_0x251f99-0x0;var _0x3c8ec2=_0xf391[_0x251f99];return _0x3c8ec2;};'use strict';var multer=require(_0x1f39('0x0'));var util=require(_0x1f39('0x1'));var path=require('path');var timeout=require(_0x1f39('0x2'));var express=require(_0x1f39('0x3'));var router=express[_0x1f39('0x4')]();var fs_extra=require(_0x1f39('0x5'));var auth=require(_0x1f39('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f39('0x7'));var controller=require(_0x1f39('0x8'));router[_0x1f39('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f39('0x9')](_0x1f39('0xa'),auth[_0x1f39('0xb')](),controller['describe']);router[_0x1f39('0x9')](_0x1f39('0xc'),auth[_0x1f39('0xb')](),controller[_0x1f39('0xd')]);router[_0x1f39('0x9')](_0x1f39('0xe'),auth[_0x1f39('0xb')](),controller[_0x1f39('0xf')]);router['get']('/:id/resources',auth[_0x1f39('0xb')](),controller[_0x1f39('0x10')]);router[_0x1f39('0x11')]('/',auth[_0x1f39('0xb')](),controller[_0x1f39('0x12')]);router[_0x1f39('0x11')](_0x1f39('0x13'),auth[_0x1f39('0xb')](),controller[_0x1f39('0x14')]);router[_0x1f39('0x11')](_0x1f39('0xe'),auth['isAuthenticated'](),controller[_0x1f39('0x15')]);router[_0x1f39('0x11')](_0x1f39('0x16'),auth['isAuthenticated'](),controller['addResources']);router[_0x1f39('0x17')](_0x1f39('0xc'),auth[_0x1f39('0xb')](),controller[_0x1f39('0x18')]);router[_0x1f39('0x19')](_0x1f39('0xc'),auth['isAuthenticated'](),controller[_0x1f39('0x1a')]);router[_0x1f39('0x19')](_0x1f39('0xe'),auth['isAuthenticated'](),controller[_0x1f39('0x1b')]);router[_0x1f39('0x19')]('/:id/resources',auth[_0x1f39('0xb')](),controller[_0x1f39('0x1c')]);module[_0x1f39('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 28da06a..4c1d3c3 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 _0x83e3=['STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x475b37,_0x463bea){var _0x10485d=function(_0x201b24){while(--_0x201b24){_0x475b37['push'](_0x475b37['shift']());}};_0x10485d(++_0x463bea);}(_0x83e3,0xf1));var _0x383e=function(_0x2fbe56,_0x403a39){_0x2fbe56=_0x2fbe56-0x0;var _0x3ad88b=_0x83e3[_0x2fbe56];return _0x3ad88b;};'use strict';var Sequelize=require(_0x383e('0x0'));module[_0x383e('0x1')]={'name':{'type':Sequelize[_0x383e('0x2')],'allowNull':![],'unique':_0x383e('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfd3d7f){this['setDataValue'](_0x383e('0x4'),_0xfd3d7f?_0xfd3d7f[_0x383e('0x5')](''):[]);},'get':function(){return this[_0x383e('0x6')](_0x383e('0x4'))?this['getDataValue'](_0x383e('0x4'))[_0x383e('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x383e('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6040=['split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x87fbcf,_0x2dbd4e){var _0x58a1b5=function(_0x222795){while(--_0x222795){_0x87fbcf['push'](_0x87fbcf['shift']());}};_0x58a1b5(++_0x2dbd4e);}(_0x6040,0x146));var _0x0604=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x6040[_0x3a7634];return _0x23bbe9;};'use strict';var Sequelize=require(_0x0604('0x0'));module['exports']={'name':{'type':Sequelize[_0x0604('0x1')],'allowNull':![],'unique':_0x0604('0x2')},'crudPermissions':{'type':Sequelize[_0x0604('0x1')],'set':function(_0x522f21){this[_0x0604('0x3')](_0x0604('0x4'),_0x522f21?_0x522f21[_0x0604('0x5')](''):[]);},'get':function(){return this[_0x0604('0x6')](_0x0604('0x4'))?this[_0x0604('0x6')](_0x0604('0x4'))[_0x0604('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0604('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0604('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0604('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0604('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0604('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0604('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a60a137..18734f0 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 _0x90ce=['offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','include','UserProfile','findAll','show','params','includeAll','merge','options','find','create','body','catch','get','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','removeSections','ids','getSections','enabled','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','end','status','json'];(function(_0x45a367,_0xe4419e){var _0xefdf5e=function(_0x3eec0a){while(--_0x3eec0a){_0x45a367['push'](_0x45a367['shift']());}};_0xefdf5e(++_0xe4419e);}(_0x90ce,0x19a));var _0xe90c=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x90ce[_0x256d6a];return _0x460058;};'use strict';var emlformat=require(_0xe90c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe90c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe90c('0x2'));var moment=require(_0xe90c('0x3'));var BPromise=require(_0xe90c('0x4'));var Mustache=require(_0xe90c('0x5'));var util=require(_0xe90c('0x6'));var path=require(_0xe90c('0x7'));var sox=require('sox');var csv=require(_0xe90c('0x8'));var ejs=require(_0xe90c('0x9'));var fs=require('fs');var fs_extra=require(_0xe90c('0xa'));var _=require(_0xe90c('0xb'));var squel=require(_0xe90c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe90c('0xd'));var deskjs=require(_0xe90c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe90c('0xf'));var Papa=require(_0xe90c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe90c('0x11'));var as=require(_0xe90c('0x12'));var hardwareService=require(_0xe90c('0x13'));var logger=require(_0xe90c('0x14'))(_0xe90c('0x15'));var utils=require(_0xe90c('0x16'));var config=require(_0xe90c('0x17'));var licenseUtil=require(_0xe90c('0x18'));var db=require('../../mysqldb')['db'];config[_0xe90c('0x19')]=_[_0xe90c('0x1a')](config[_0xe90c('0x19')],{'host':_0xe90c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe90c('0x19')]));require(_0xe90c('0x1c'))[_0xe90c('0x1d')](socket);function respondWithStatusCode(_0x4a6fe3,_0x50228b){_0x50228b=_0x50228b||0xcc;return function(_0x48c983){if(_0x48c983){return _0x4a6fe3[_0xe90c('0x1e')](_0x50228b);}return _0x4a6fe3['status'](_0x50228b)[_0xe90c('0x1f')]();};}function respondWithResult(_0x857d20,_0x9e479){_0x9e479=_0x9e479||0xc8;return function(_0x403088){if(_0x403088){return _0x857d20[_0xe90c('0x20')](_0x9e479)[_0xe90c('0x21')](_0x403088);}};}function respondWithFilteredResult(_0x1c77a5,_0x393b1f){return function(_0x49ba81){if(_0x49ba81){var _0x311e1d=typeof _0x393b1f[_0xe90c('0x22')]===_0xe90c('0x23')&&typeof _0x393b1f['limit']===_0xe90c('0x23');var _0x1fe5ef=_0x49ba81['count'];var _0x3ed834=_0x311e1d?0x0:_0x393b1f[_0xe90c('0x22')];var _0x2b4576=_0x311e1d?_0x49ba81[_0xe90c('0x24')]:_0x393b1f['offset']+_0x393b1f[_0xe90c('0x25')];var _0x42c3f6;if(_0x2b4576>=_0x1fe5ef){_0x2b4576=_0x1fe5ef;_0x42c3f6=0xc8;}else{_0x42c3f6=0xce;}_0x1c77a5[_0xe90c('0x20')](_0x42c3f6);return _0x1c77a5['set'](_0xe90c('0x26'),_0x3ed834+'-'+_0x2b4576+'/'+_0x1fe5ef)['json'](_0x49ba81);}return null;};}function patchUpdates(_0x20b11b){return function(_0xc3635c){try{jsonpatch['apply'](_0xc3635c,_0x20b11b,!![]);}catch(_0x40bd2b){return BPromise[_0xe90c('0x27')](_0x40bd2b);}return _0xc3635c[_0xe90c('0x28')]();};}function saveUpdates(_0x11a627,_0x264527){return function(_0x2725e3){if(_0x2725e3){return _0x2725e3[_0xe90c('0x29')](_0x11a627)[_0xe90c('0x2a')](function(_0x31200c){return _0x31200c;});}return null;};}function removeEntity(_0x4984d1,_0x25294d){return function(_0x41ba2a){if(_0x41ba2a){return _0x41ba2a[_0xe90c('0x2b')]()['then'](function(){_0x4984d1[_0xe90c('0x20')](0xcc)[_0xe90c('0x1f')]();});}};}function handleEntityNotFound(_0x1a92fb,_0x3ef217){return function(_0x26fb3a){if(!_0x26fb3a){_0x1a92fb['sendStatus'](0x194);}return _0x26fb3a;};}function handleError(_0x4c6425,_0x15eb8e){_0x15eb8e=_0x15eb8e||0x1f4;return function(_0x4c7733){logger[_0xe90c('0x2c')](_0x4c7733[_0xe90c('0x2d')]);if(_0x4c7733['name']){delete _0x4c7733[_0xe90c('0x2e')];}_0x4c6425['status'](_0x15eb8e)['send'](_0x4c7733);};}exports[_0xe90c('0x2f')]=function(_0x3dc8ab,_0x4a1d46){var _0x246188={},_0x8b1fc={},_0x37783a={'count':0x0,'rows':[]};var _0x131c1a=_[_0xe90c('0x30')](db['UserProfile'][_0xe90c('0x31')],function(_0x89444e){return{'name':_0x89444e[_0xe90c('0x32')],'type':_0x89444e['type'][_0xe90c('0x33')]};});_0x8b1fc[_0xe90c('0x34')]=_[_0xe90c('0x30')](_0x131c1a,_0xe90c('0x2e'));_0x8b1fc['query']=_[_0xe90c('0x35')](_0x3dc8ab['query']);_0x8b1fc[_0xe90c('0x36')]=_[_0xe90c('0x37')](_0x8b1fc[_0xe90c('0x34')],_0x8b1fc[_0xe90c('0x38')]);_0x246188[_0xe90c('0x39')]=_[_0xe90c('0x37')](_0x8b1fc['model'],qs[_0xe90c('0x3a')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x3a')]));_0x246188[_0xe90c('0x39')]=_0x246188[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x246188[_0xe90c('0x39')]:_0x8b1fc[_0xe90c('0x34')];if(!_0x3dc8ab['query'][_0xe90c('0x3c')](_0xe90c('0x3d'))){_0x246188[_0xe90c('0x25')]=qs[_0xe90c('0x25')](_0x3dc8ab['query']['limit']);_0x246188[_0xe90c('0x22')]=qs[_0xe90c('0x22')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x22')]);}_0x246188['order']=qs[_0xe90c('0x3e')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x3e')]);_0x246188[_0xe90c('0x3f')]=qs[_0xe90c('0x36')](_[_0xe90c('0x40')](_0x3dc8ab['query'],_0x8b1fc[_0xe90c('0x36')]),_0x131c1a);if(_0x3dc8ab['query']['filter']){_0x246188[_0xe90c('0x3f')]=_['merge'](_0x246188[_0xe90c('0x3f')],{'$or':_[_0xe90c('0x30')](_0x131c1a,function(_0x616859){if(_0x616859[_0xe90c('0x41')]!==_0xe90c('0x42')){var _0xd09e11={};_0xd09e11[_0x616859[_0xe90c('0x2e')]]={'$like':'%'+_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x43')]+'%'};return _0xd09e11;}})});}_0x246188=_['merge']({},_0x246188,_0x3dc8ab['options']);var _0x5347ae={'where':_0x246188[_0xe90c('0x3f')]};return db['UserProfile']['count'](_0x5347ae)[_0xe90c('0x2a')](function(_0x32e106){_0x37783a[_0xe90c('0x24')]=_0x32e106;if(_0x3dc8ab['query']['includeAll']){_0x246188[_0xe90c('0x44')]=[{'all':!![]}];}return db[_0xe90c('0x45')][_0xe90c('0x46')](_0x246188);})['then'](function(_0x1dc079){_0x37783a['rows']=_0x1dc079;return _0x37783a;})[_0xe90c('0x2a')](respondWithFilteredResult(_0x4a1d46,_0x246188))['catch'](handleError(_0x4a1d46,null));};exports[_0xe90c('0x47')]=function(_0xaa3a48,_0x1d4327){var _0x12f5cd={'raw':![],'where':{'id':_0xaa3a48[_0xe90c('0x48')]['id']}},_0x2c508e={};_0x2c508e['model']=_[_0xe90c('0x35')](db[_0xe90c('0x45')][_0xe90c('0x31')]);_0x2c508e['query']=_[_0xe90c('0x35')](_0xaa3a48[_0xe90c('0x38')]);_0x2c508e[_0xe90c('0x36')]=_[_0xe90c('0x37')](_0x2c508e[_0xe90c('0x34')],_0x2c508e['query']);_0x12f5cd['attributes']=_[_0xe90c('0x37')](_0x2c508e[_0xe90c('0x34')],qs['fields'](_0xaa3a48[_0xe90c('0x38')][_0xe90c('0x3a')]));_0x12f5cd[_0xe90c('0x39')]=_0x12f5cd[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x12f5cd[_0xe90c('0x39')]:_0x2c508e[_0xe90c('0x34')];if(_0xaa3a48[_0xe90c('0x38')][_0xe90c('0x49')]){_0x12f5cd[_0xe90c('0x44')]=[{'all':!![]}];}_0x12f5cd=_[_0xe90c('0x4a')]({},_0x12f5cd,_0xaa3a48[_0xe90c('0x4b')]);return db['UserProfile'][_0xe90c('0x4c')](_0x12f5cd)['then'](handleEntityNotFound(_0x1d4327,null))[_0xe90c('0x2a')](respondWithResult(_0x1d4327,null))['catch'](handleError(_0x1d4327,null));};exports[_0xe90c('0x4d')]=function(_0x210784,_0x138fe9){return db[_0xe90c('0x45')][_0xe90c('0x4d')](_0x210784[_0xe90c('0x4e')],{})[_0xe90c('0x2a')](respondWithResult(_0x138fe9,0xc9))[_0xe90c('0x4f')](handleError(_0x138fe9,null));};exports['clone']=function(_0x5cb309,_0x5d2930){var _0x2ad5f1={'where':{'id':_0x5cb309[_0xe90c('0x48')]['id']}},_0x3a26a3={};_0x3a26a3[_0xe90c('0x34')]=_[_0xe90c('0x35')](db[_0xe90c('0x45')][_0xe90c('0x31')]);_0x2ad5f1[_0xe90c('0x39')]=_[_0xe90c('0x37')](_0x3a26a3[_0xe90c('0x34')],qs[_0xe90c('0x3a')](_0x5cb309['query'][_0xe90c('0x3a')]));_0x2ad5f1[_0xe90c('0x39')]=_0x2ad5f1[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x2ad5f1['attributes']:_0x3a26a3['model'];if(_0x5cb309[_0xe90c('0x38')][_0xe90c('0x49')]){_0x2ad5f1[_0xe90c('0x44')]=[{'all':!![]}];}_0x2ad5f1=_['merge']({},_0x2ad5f1,_0x5cb309['options']);return db[_0xe90c('0x45')]['find'](_0x2ad5f1)[_0xe90c('0x2a')](handleEntityNotFound(_0x5d2930,null))[_0xe90c('0x2a')](function(_0x270dd2){if(_0x270dd2){var _0x33e08f=_0x270dd2[_0xe90c('0x50')]({'plain':!![]});_0x33e08f=qs[_0xe90c('0x51')](_0x33e08f,['id','createdAt','updatedAt',_0xe90c('0x52')]);_0x5cb309[_0xe90c('0x4e')]=_[_0xe90c('0x51')](_0x5cb309['body'],['id',_0xe90c('0x53'),_0xe90c('0x54')]);return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0x4d212e){return db[_0xe90c('0x45')][_0xe90c('0x4d')](_[_0xe90c('0x4a')](_0x33e08f,_0x5cb309[_0xe90c('0x4e')]),{'include':_0x5cb309['query'][_0xe90c('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x4d212e})[_0xe90c('0x2a')](function(_0x3c5e2a){var _0xf4c4d6=_0x3c5e2a[_0xe90c('0x50')]({'plain':!![]});return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x5cb309['params']['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x296dbd){if(_0x296dbd){return BPromise['each'](_0x296dbd,function(_0x7ae01a){return new BPromise(function(_0x3efb0e,_0x10b372){if(_0x7ae01a[_0xe90c('0x58')]===null||_0x7ae01a[_0xe90c('0x58')]===0x1)_0x3efb0e(null);return db[_0xe90c('0x59')]['findAll']({'where':{'sectionId':_0x7ae01a['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x33151d){var _0x12b633=_[_0xe90c('0x30')](_0x33151d,function(_0x27655){return qs[_0xe90c('0x51')](_0x27655,['id',_0xe90c('0x53'),_0xe90c('0x54'),_0xe90c('0x5a')]);});_0x3efb0e(_0x12b633);})['catch'](function(_0x21e731){_0x10b372(_0x21e731);});})[_0xe90c('0x2a')](function(_0x543e5c){var _0x321076=qs['omit'](_0x7ae01a,['id',_0xe90c('0x53'),_0xe90c('0x54')]);_0x321076['userProfileId']=_0xf4c4d6['id'];if(_0x543e5c)_0x321076[_0xe90c('0x5b')]=_0x543e5c;return _0x321076;})[_0xe90c('0x2a')](function(_0x12125d){return db[_0xe90c('0x57')][_0xe90c('0x4d')](_0x12125d,{'include':[{'model':db[_0xe90c('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4d212e});});})[_0xe90c('0x2a')](function(){return _0xf4c4d6;});}});});});}})[_0xe90c('0x2a')](respondWithResult(_0x5d2930,0xc9))[_0xe90c('0x4f')](handleError(_0x5d2930,null));};exports[_0xe90c('0x29')]=function(_0x21ddfc,_0x3a7fe2){if(_0x21ddfc[_0xe90c('0x4e')]['id']){delete _0x21ddfc['body']['id'];}return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x21ddfc['params']['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x3a7fe2,null))['then'](saveUpdates(_0x21ddfc[_0xe90c('0x4e')],null))['then'](respondWithResult(_0x3a7fe2,null))['catch'](handleError(_0x3a7fe2,null));};exports[_0xe90c('0x2b')]=function(_0x5ab84d,_0x35c5a0){return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x5ab84d[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x35c5a0,null))[_0xe90c('0x2a')](removeEntity(_0x35c5a0,null))['catch'](handleError(_0x35c5a0,null));};exports[_0xe90c('0x5c')]=function(_0x104c71,_0x298dd6){return db[_0xe90c('0x45')][_0xe90c('0x5c')]()[_0xe90c('0x2a')](respondWithResult(_0x298dd6,null))[_0xe90c('0x4f')](handleError(_0x298dd6,null));};exports[_0xe90c('0x5d')]=function(_0x2e4bc3,_0x3c0103){var _0x18a835=_0x2e4bc3[_0xe90c('0x4e')];return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x2e4bc3['params']['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x3c0103,null))[_0xe90c('0x2a')](function(_0x598894){if(_0x598894){return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0xed7f12){return db['UserProfileSection'][_0xe90c('0x2b')]({'where':{'userProfileId':_0x2e4bc3['params']['id'],'sectionId':_[_0xe90c('0x30')](_0x18a835,function(_0x126eab){return _0x126eab[_0xe90c('0x5a')];})},'transaction':_0xed7f12})[_0xe90c('0x2a')](function(){var _0x559ae8=_[_0xe90c('0x30')](_0x18a835,function(_0xfbf815){_0xfbf815[_0xe90c('0x5e')]=_0x2e4bc3[_0xe90c('0x48')]['id'];return _0xfbf815;});var _0x102395=[];return BPromise['each'](_0x559ae8,function(_0x77afd3){return db[_0xe90c('0x57')][_0xe90c('0x4d')](_0x77afd3,{'include':[{'model':db['UserProfileResource'],'as':_0xe90c('0x5b')}],'raw':!![],'transaction':_0xed7f12})['then'](function(_0x307417){_0x102395['push'](_0x307417[_0xe90c('0x50')]({'plain':!![]}));});})[_0xe90c('0x2a')](function(){return _0x102395;});});});}})[_0xe90c('0x2a')](function(_0x2c12bf){return _0x2c12bf;})[_0xe90c('0x2a')](respondWithResult(_0x3c0103,null))[_0xe90c('0x4f')](handleError(_0x3c0103,null));};exports[_0xe90c('0x5f')]=function(_0x1ba888,_0x50cfa7){var _0xfff1b1;return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x1ba888[_0xe90c('0x48')]['id']},'attributes':['id',_0xe90c('0x2e')]})[_0xe90c('0x2a')](handleEntityNotFound(_0x50cfa7,null))[_0xe90c('0x2a')](function(_0x3cd378){if(_0x3cd378){_0xfff1b1=_0x3cd378;return db[_0xe90c('0x57')][_0xe90c('0x2b')]({'where':{'userProfileId':_0x1ba888[_0xe90c('0x48')]['id'],'sectionId':_0x1ba888[_0xe90c('0x38')][_0xe90c('0x60')]}});}})[_0xe90c('0x2a')](function(){return _0xfff1b1;})[_0xe90c('0x2a')](respondWithStatusCode(_0x50cfa7,null))[_0xe90c('0x4f')](handleError(_0x50cfa7,null));};exports[_0xe90c('0x61')]=function(_0x533a8b,_0x551d09){var _0x176ae6=[];var _0x3b2da1=[];return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x533a8b[_0xe90c('0x48')]['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x502e26){_0x176ae6=_['filter'](_0x502e26,function(_0x2265c2){return _0x2265c2[_0xe90c('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x2265c2[_0xe90c('0x5a')]);});if(!_['isEmpty'](_0x176ae6)){return _[_0xe90c('0x30')](_0x176ae6,function(_0x44b76f){return _0x44b76f[_0xe90c('0x5a')];});}else{return;}})[_0xe90c('0x2a')](function(_0x116308){if(_0x116308)_0x3b2da1=_0x116308;if(_[_0xe90c('0x63')](_0x3b2da1,0x64)){var _0xc317a9=_[_0xe90c('0x4c')](_0x176ae6,{'sectionId':0x64});return hasDefaultDashboard(_0xc317a9)['then'](function(_0x5f2299){return _['map'](_0x176ae6,function(_0x5f3d9b){if(_0x5f3d9b['sectionId']===0x64){_0x5f3d9b[_0xe90c('0x64')]=_0x5f2299;}return _0x5f3d9b;});});}else{return;}})[_0xe90c('0x2a')](function(_0x43a16b){if(_0x43a16b)_0x176ae6=_0x43a16b;if(_[_0xe90c('0x63')](_0x3b2da1,0x3eb)){var _0x161af4=_[_0xe90c('0x4c')](_0x176ae6,{'sectionId':0x3eb});return getCustomDashboards(_0x161af4)[_0xe90c('0x2a')](function(_0x3adf3c){return _[_0xe90c('0x30')](_0x176ae6,function(_0x4665fc){if(_0x161af4[_0xe90c('0x62')]){if(_0x4665fc[_0xe90c('0x5a')]===0x3eb){_0x4665fc[_0xe90c('0x64')]=_0x3adf3c;}}else{if(_0x4665fc['sectionId']===0x64){if(!_0x4665fc[_0xe90c('0x64')]){_0x4665fc[_0xe90c('0x64')]=[];}_0x4665fc[_0xe90c('0x64')]=_0x4665fc['subsections']['concat'](_0x3adf3c);}}return _0x4665fc;});});}else{return;}})[_0xe90c('0x2a')](function(_0x28ca45){if(_0x28ca45)_0x176ae6=_0x28ca45;if(_['includes'](_0x3b2da1,0x709)){var _0x6342f4=_['find'](_0x176ae6,{'sectionId':0x709});return getPlugins(_0x6342f4)['then'](function(_0x25322b){if(_0x6342f4[_0xe90c('0x62')]){return _[_0xe90c('0x30')](_0x176ae6,function(_0x391894){if(_0x391894['sectionId']===0x709){_0x391894[_0xe90c('0x64')]=_0x25322b;}return _0x391894;});}else{var _0x1c85c2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25322b};var _0x1a88ad=_['map'](_0x176ae6);_0x1a88ad[_0xe90c('0x65')](_0x1c85c2);return _0x1a88ad;}});}else{return;}})[_0xe90c('0x2a')](function(_0x2c21ab){if(_0x2c21ab)_0x176ae6=_0x2c21ab;return _['filter'](_0x176ae6,[_0xe90c('0x62'),0x1]);})[_0xe90c('0x2a')](respondWithResult(_0x551d09,null))[_0xe90c('0x4f')](handleError(_0x551d09,null));};function hasDefaultDashboard(_0x506a63){var _0x52167e=[0x65];return new BPromise(function(_0x392bbf,_0x54a130){try{if(_0x506a63[_0xe90c('0x58')]){_0x392bbf(_0x52167e);}else{return db[_0xe90c('0x59')][_0xe90c('0x66')]({'where':{'sectionId':_0x506a63['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x2d40c1){_0x2d40c1?_0x392bbf(_0x52167e):_0x392bbf();});}}catch(_0x3b9e58){_0x54a130(_0x3b9e58);}});}function getCustomDashboards(_0x51f00f){var _0x348f43=[];return new BPromise(function(_0x101471,_0x1da3ac){try{if(_0x51f00f[_0xe90c('0x58')]){return db['Dashboard'][_0xe90c('0x46')]({'raw':!![]})[_0xe90c('0x2a')](function(_0x59d9a3){_0x59d9a3[_0xe90c('0x67')](function(_0x1516d3){_0x348f43[_0xe90c('0x65')](_0x1516d3['id']+0x1869f);});_0x101471(_0x348f43);});}else{return db[_0xe90c('0x59')]['findAll']({'where':{'sectionId':_0x51f00f['id']},'raw':!![]})['then'](function(_0x53aa5d){_0x53aa5d[_0xe90c('0x67')](function(_0x49aecd){_0x348f43[_0xe90c('0x65')](_0x49aecd[_0xe90c('0x68')]+0x1869f);});_0x101471(_0x348f43);});}}catch(_0x144fd3){_0x1da3ac(_0x144fd3);}});}function getPlugins(_0x34128d){var _0x10d8f1=[];return new BPromise(function(_0x32272f,_0x5ef4e4){try{if(_0x34128d[_0xe90c('0x58')]){return db[_0xe90c('0x69')][_0xe90c('0x46')]({'raw':!![]})[_0xe90c('0x2a')](function(_0x37a0e2){_0x37a0e2[_0xe90c('0x67')](function(_0x3d99e1){_0x10d8f1[_0xe90c('0x65')](_0x3d99e1['id']+0x15b38);});_0x32272f(_0x10d8f1);});}else{return db['UserProfileResource'][_0xe90c('0x46')]({'where':{'sectionId':_0x34128d['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x2d1a04){_0x2d1a04[_0xe90c('0x67')](function(_0x1fa0a2){_0x10d8f1[_0xe90c('0x65')](_0x1fa0a2['resourceId']+0x15b38);});_0x32272f(_0x10d8f1);});}}catch(_0x33dc53){_0x5ef4e4(_0x33dc53);}});}exports[_0xe90c('0x6a')]=function(_0x3a7690,_0x299fe3){return db[_0xe90c('0x45')]['find']({'where':{'id':_0x3a7690[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x299fe3,null))[_0xe90c('0x2a')](function(_0x3a7d7e){if(_0x3a7d7e){return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0x4d9dfc){return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x3a7690[_0xe90c('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xe90c('0x2a')](function(_0x36b85c){if(_0x36b85c){return db[_0xe90c('0x57')][_0xe90c('0x2b')]({'where':{'userProfileId':_0x3a7690['params']['id'],'id':_[_0xe90c('0x30')](_0x36b85c,function(_0xf93bba){return _0xf93bba['id'];})},'transaction':_0x4d9dfc});}})[_0xe90c('0x2a')](function(_0x5401c0){var _0x7e385a=_[_0xe90c('0x30')](_0x3a7690[_0xe90c('0x4e')],function(_0x5e9bc4){_0x5e9bc4['userProfileId']=_0x3a7690['params']['id'];return _0x5e9bc4;});return db[_0xe90c('0x57')][_0xe90c('0x6b')](_0x7e385a,{'raw':!![],'transaction':_0x4d9dfc});})[_0xe90c('0x2a')](function(_0x175c33){var _0x2a5fcf=_['filter'](_['map'](_0x175c33,function(_0x25fe58){return _0x25fe58[_0xe90c('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a5fcf){return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x3a7690['params']['id'],'sectionId':_[_0xe90c('0x30')](_0x2a5fcf,function(_0x415ac4){return _0x415ac4['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe90c('0x2a')](function(_0x10daee){var _0x15e62c=_['map'](_0x3a7690['body'],function(_0x1c11b1){_0x1c11b1[_0xe90c('0x5e')]=_0x3a7690['params']['id'];return _0x1c11b1;});return db[_0xe90c('0x59')][_0xe90c('0x6b')](_0x15e62c,{'raw':!![],'transaction':_0x4d9dfc});});}})[_0xe90c('0x4f')](handleError(_0x299fe3,null));});}})[_0xe90c('0x2a')](function(_0x4de4da){var _0x170b5b=_[_0xe90c('0x30')](_0x4de4da,function(_0x18c99e){return _0x18c99e[_0xe90c('0x50')]({'plain':!![]});});})[_0xe90c('0x2a')](respondWithResult(_0x299fe3,null))['catch'](handleError(_0x299fe3,null));};exports[_0xe90c('0x6c')]=function(_0x3c1039,_0x39d83e,_0x34cc67){return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x3c1039[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x39d83e,null))[_0xe90c('0x2a')](function(_0x3f5bf7){if(_0x3f5bf7){return _0x3f5bf7[_0xe90c('0x6c')](_0x3c1039[_0xe90c('0x38')][_0xe90c('0x60')]);}})['then'](respondWithStatusCode(_0x39d83e,null))[_0xe90c('0x4f')](handleError(_0x39d83e,null));};exports[_0xe90c('0x6d')]=function(_0x513a03,_0x3ee236){var _0x9a148b={};if(!_0x513a03[_0xe90c('0x38')]['section'])throw new Error(_0xe90c('0x6e'));if(!_0x513a03['query'][_0xe90c('0x3c')]('nolimit')){_0x9a148b[_0xe90c('0x25')]=qs[_0xe90c('0x25')](_0x513a03[_0xe90c('0x38')][_0xe90c('0x25')]);_0x9a148b[_0xe90c('0x22')]=qs[_0xe90c('0x22')](_0x513a03[_0xe90c('0x38')]['offset']);}return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x513a03['params']['id']}})['then'](function(_0x290bd2){if(!_0x290bd2)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x513a03[_0xe90c('0x48')]['id']);return db['UserProfile'][_0xe90c('0x6d')](_0x513a03);})['then'](respondWithFilteredResult(_0x3ee236,_0x9a148b))['catch'](handleError(_0x3ee236,null));}; \ No newline at end of file +var _0x0a20=['save','update','then','error','stack','name','map','UserProfile','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','merge','type','options','include','findAll','catch','show','params','includeAll','find','create','get','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','destroy','describe','addSections','userProfileId','push','getSections','includes','isEmpty','subsections','concat','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x0a20,0x1ed));var _0x00a2=function(_0x13770c,_0x37b7eb){_0x13770c=_0x13770c-0x0;var _0x447aec=_0x0a20[_0x13770c];return _0x447aec;};'use strict';var emlformat=require(_0x00a2('0x0'));var rimraf=require(_0x00a2('0x1'));var zipdir=require(_0x00a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00a2('0x3'));var moment=require(_0x00a2('0x4'));var BPromise=require(_0x00a2('0x5'));var Mustache=require('mustache');var util=require(_0x00a2('0x6'));var path=require(_0x00a2('0x7'));var sox=require(_0x00a2('0x8'));var csv=require(_0x00a2('0x9'));var ejs=require(_0x00a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00a2('0xb'));var squel=require(_0x00a2('0xc'));var crypto=require(_0x00a2('0xd'));var jsforce=require(_0x00a2('0xe'));var deskjs=require(_0x00a2('0xf'));var toCsv=require(_0x00a2('0x9'));var querystring=require('querystring');var Papa=require(_0x00a2('0x10'));var Redis=require(_0x00a2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x00a2('0x12'));var as=require(_0x00a2('0x13'));var hardwareService=require(_0x00a2('0x14'));var logger=require(_0x00a2('0x15'))('api');var utils=require(_0x00a2('0x16'));var config=require(_0x00a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x00a2('0x18')]=_['defaults'](config['redis'],{'host':_0x00a2('0x19'),'port':0x18eb});var socket=require(_0x00a2('0x1a'))(new Redis(config['redis']));require(_0x00a2('0x1b'))['register'](socket);function respondWithStatusCode(_0x34cf48,_0x3681ae){_0x3681ae=_0x3681ae||0xcc;return function(_0x551098){if(_0x551098){return _0x34cf48[_0x00a2('0x1c')](_0x3681ae);}return _0x34cf48['status'](_0x3681ae)[_0x00a2('0x1d')]();};}function respondWithResult(_0x2685c1,_0x1c3f08){_0x1c3f08=_0x1c3f08||0xc8;return function(_0xdaec0e){if(_0xdaec0e){return _0x2685c1[_0x00a2('0x1e')](_0x1c3f08)[_0x00a2('0x1f')](_0xdaec0e);}};}function respondWithFilteredResult(_0x540f42,_0x227599){return function(_0xbc6922){if(_0xbc6922){var _0x102a6f=typeof _0x227599[_0x00a2('0x20')]===_0x00a2('0x21')&&typeof _0x227599[_0x00a2('0x22')]==='undefined';var _0x58e2af=_0xbc6922[_0x00a2('0x23')];var _0x4a332d=_0x102a6f?0x0:_0x227599[_0x00a2('0x20')];var _0x32520f=_0x102a6f?_0xbc6922[_0x00a2('0x23')]:_0x227599[_0x00a2('0x20')]+_0x227599[_0x00a2('0x22')];var _0x269ef6;if(_0x32520f>=_0x58e2af){_0x32520f=_0x58e2af;_0x269ef6=0xc8;}else{_0x269ef6=0xce;}_0x540f42['status'](_0x269ef6);return _0x540f42[_0x00a2('0x24')]('Content-Range',_0x4a332d+'-'+_0x32520f+'/'+_0x58e2af)['json'](_0xbc6922);}return null;};}function patchUpdates(_0x21c3e9){return function(_0x3f050b){try{jsonpatch['apply'](_0x3f050b,_0x21c3e9,!![]);}catch(_0xda3c19){return BPromise['reject'](_0xda3c19);}return _0x3f050b[_0x00a2('0x25')]();};}function saveUpdates(_0x7ab198,_0x4899fe){return function(_0x2ced9b){if(_0x2ced9b){return _0x2ced9b[_0x00a2('0x26')](_0x7ab198)[_0x00a2('0x27')](function(_0x196694){return _0x196694;});}return null;};}function removeEntity(_0x56542c,_0x1664c5){return function(_0x373054){if(_0x373054){return _0x373054['destroy']()[_0x00a2('0x27')](function(){_0x56542c[_0x00a2('0x1e')](0xcc)[_0x00a2('0x1d')]();});}};}function handleEntityNotFound(_0x1e2f7c,_0x3a523c){return function(_0x408c79){if(!_0x408c79){_0x1e2f7c['sendStatus'](0x194);}return _0x408c79;};}function handleError(_0x3a8502,_0x195feb){_0x195feb=_0x195feb||0x1f4;return function(_0x4c192b){logger[_0x00a2('0x28')](_0x4c192b[_0x00a2('0x29')]);if(_0x4c192b[_0x00a2('0x2a')]){delete _0x4c192b['name'];}_0x3a8502[_0x00a2('0x1e')](_0x195feb)['send'](_0x4c192b);};}exports['index']=function(_0x2702b4,_0x34ef99){var _0x38070a={},_0x2e534f={},_0x25037a={'count':0x0,'rows':[]};var _0x3186fa=_[_0x00a2('0x2b')](db[_0x00a2('0x2c')][_0x00a2('0x2d')],function(_0x13619c){return{'name':_0x13619c['fieldName'],'type':_0x13619c['type'][_0x00a2('0x2e')]};});_0x2e534f['model']=_[_0x00a2('0x2b')](_0x3186fa,_0x00a2('0x2a'));_0x2e534f[_0x00a2('0x2f')]=_[_0x00a2('0x30')](_0x2702b4[_0x00a2('0x2f')]);_0x2e534f[_0x00a2('0x31')]=_['intersection'](_0x2e534f[_0x00a2('0x32')],_0x2e534f['query']);_0x38070a[_0x00a2('0x33')]=_[_0x00a2('0x34')](_0x2e534f['model'],qs[_0x00a2('0x35')](_0x2702b4[_0x00a2('0x2f')][_0x00a2('0x35')]));_0x38070a['attributes']=_0x38070a[_0x00a2('0x33')][_0x00a2('0x36')]?_0x38070a['attributes']:_0x2e534f[_0x00a2('0x32')];if(!_0x2702b4['query']['hasOwnProperty']('nolimit')){_0x38070a[_0x00a2('0x22')]=qs['limit'](_0x2702b4[_0x00a2('0x2f')][_0x00a2('0x22')]);_0x38070a[_0x00a2('0x20')]=qs[_0x00a2('0x20')](_0x2702b4[_0x00a2('0x2f')][_0x00a2('0x20')]);}_0x38070a['order']=qs[_0x00a2('0x37')](_0x2702b4[_0x00a2('0x2f')][_0x00a2('0x37')]);_0x38070a[_0x00a2('0x38')]=qs[_0x00a2('0x31')](_[_0x00a2('0x39')](_0x2702b4[_0x00a2('0x2f')],_0x2e534f['filters']),_0x3186fa);if(_0x2702b4[_0x00a2('0x2f')][_0x00a2('0x3a')]){_0x38070a[_0x00a2('0x38')]=_[_0x00a2('0x3b')](_0x38070a[_0x00a2('0x38')],{'$or':_[_0x00a2('0x2b')](_0x3186fa,function(_0x308411){if(_0x308411[_0x00a2('0x3c')]!=='VIRTUAL'){var _0x3116ee={};_0x3116ee[_0x308411[_0x00a2('0x2a')]]={'$like':'%'+_0x2702b4[_0x00a2('0x2f')]['filter']+'%'};return _0x3116ee;}})});}_0x38070a=_['merge']({},_0x38070a,_0x2702b4[_0x00a2('0x3d')]);var _0x2ce84a={'where':_0x38070a[_0x00a2('0x38')]};return db[_0x00a2('0x2c')][_0x00a2('0x23')](_0x2ce84a)['then'](function(_0x4dca71){_0x25037a[_0x00a2('0x23')]=_0x4dca71;if(_0x2702b4[_0x00a2('0x2f')]['includeAll']){_0x38070a[_0x00a2('0x3e')]=[{'all':!![]}];}return db[_0x00a2('0x2c')][_0x00a2('0x3f')](_0x38070a);})[_0x00a2('0x27')](function(_0x4bd6f9){_0x25037a['rows']=_0x4bd6f9;return _0x25037a;})[_0x00a2('0x27')](respondWithFilteredResult(_0x34ef99,_0x38070a))[_0x00a2('0x40')](handleError(_0x34ef99,null));};exports[_0x00a2('0x41')]=function(_0x456741,_0x176150){var _0xc483df={'raw':![],'where':{'id':_0x456741[_0x00a2('0x42')]['id']}},_0x388f88={};_0x388f88['model']=_['keys'](db[_0x00a2('0x2c')][_0x00a2('0x2d')]);_0x388f88[_0x00a2('0x2f')]=_[_0x00a2('0x30')](_0x456741[_0x00a2('0x2f')]);_0x388f88['filters']=_[_0x00a2('0x34')](_0x388f88[_0x00a2('0x32')],_0x388f88[_0x00a2('0x2f')]);_0xc483df['attributes']=_[_0x00a2('0x34')](_0x388f88[_0x00a2('0x32')],qs['fields'](_0x456741[_0x00a2('0x2f')][_0x00a2('0x35')]));_0xc483df[_0x00a2('0x33')]=_0xc483df[_0x00a2('0x33')][_0x00a2('0x36')]?_0xc483df['attributes']:_0x388f88[_0x00a2('0x32')];if(_0x456741[_0x00a2('0x2f')][_0x00a2('0x43')]){_0xc483df[_0x00a2('0x3e')]=[{'all':!![]}];}_0xc483df=_[_0x00a2('0x3b')]({},_0xc483df,_0x456741['options']);return db[_0x00a2('0x2c')][_0x00a2('0x44')](_0xc483df)[_0x00a2('0x27')](handleEntityNotFound(_0x176150,null))[_0x00a2('0x27')](respondWithResult(_0x176150,null))[_0x00a2('0x40')](handleError(_0x176150,null));};exports[_0x00a2('0x45')]=function(_0x4a67b3,_0x440f07){return db[_0x00a2('0x2c')]['create'](_0x4a67b3['body'],{})[_0x00a2('0x27')](respondWithResult(_0x440f07,0xc9))[_0x00a2('0x40')](handleError(_0x440f07,null));};exports['clone']=function(_0x1b1f3c,_0x20004e){var _0x21fdce={'where':{'id':_0x1b1f3c['params']['id']}},_0x4c817d={};_0x4c817d[_0x00a2('0x32')]=_[_0x00a2('0x30')](db['UserProfile'][_0x00a2('0x2d')]);_0x21fdce[_0x00a2('0x33')]=_[_0x00a2('0x34')](_0x4c817d[_0x00a2('0x32')],qs[_0x00a2('0x35')](_0x1b1f3c[_0x00a2('0x2f')][_0x00a2('0x35')]));_0x21fdce[_0x00a2('0x33')]=_0x21fdce['attributes']['length']?_0x21fdce[_0x00a2('0x33')]:_0x4c817d[_0x00a2('0x32')];if(_0x1b1f3c[_0x00a2('0x2f')][_0x00a2('0x43')]){_0x21fdce['include']=[{'all':!![]}];}_0x21fdce=_[_0x00a2('0x3b')]({},_0x21fdce,_0x1b1f3c[_0x00a2('0x3d')]);return db[_0x00a2('0x2c')][_0x00a2('0x44')](_0x21fdce)['then'](handleEntityNotFound(_0x20004e,null))[_0x00a2('0x27')](function(_0x20a839){if(_0x20a839){var _0x310643=_0x20a839[_0x00a2('0x46')]({'plain':!![]});_0x310643=qs['omit'](_0x310643,['id',_0x00a2('0x47'),_0x00a2('0x48'),_0x00a2('0x49')]);_0x1b1f3c[_0x00a2('0x4a')]=_[_0x00a2('0x4b')](_0x1b1f3c[_0x00a2('0x4a')],['id',_0x00a2('0x47'),_0x00a2('0x48')]);return db[_0x00a2('0x4c')][_0x00a2('0x4d')](function(_0x4db43a){return db[_0x00a2('0x2c')]['create'](_['merge'](_0x310643,_0x1b1f3c[_0x00a2('0x4a')]),{'include':_0x1b1f3c[_0x00a2('0x2f')][_0x00a2('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x4db43a})[_0x00a2('0x27')](function(_0x58b6ac){var _0x1e8a68=_0x58b6ac['get']({'plain':!![]});return db[_0x00a2('0x4e')][_0x00a2('0x3f')]({'where':{'userProfileId':_0x1b1f3c[_0x00a2('0x42')]['id']},'raw':!![]})[_0x00a2('0x27')](function(_0x9bd1d6){if(_0x9bd1d6){return BPromise[_0x00a2('0x4f')](_0x9bd1d6,function(_0x2e47af){return new BPromise(function(_0x461964,_0x1f1843){if(_0x2e47af[_0x00a2('0x50')]===null||_0x2e47af[_0x00a2('0x50')]===0x1)_0x461964(null);return db[_0x00a2('0x51')]['findAll']({'where':{'sectionId':_0x2e47af['id']},'raw':!![]})['then'](function(_0x3df912){var _0x47b9e2=_[_0x00a2('0x2b')](_0x3df912,function(_0x441164){return qs[_0x00a2('0x4b')](_0x441164,['id',_0x00a2('0x47'),_0x00a2('0x48'),_0x00a2('0x52')]);});_0x461964(_0x47b9e2);})[_0x00a2('0x40')](function(_0xcb1c0){_0x1f1843(_0xcb1c0);});})[_0x00a2('0x27')](function(_0x175535){var _0x22f1eb=qs[_0x00a2('0x4b')](_0x2e47af,['id',_0x00a2('0x47'),'updatedAt']);_0x22f1eb['userProfileId']=_0x1e8a68['id'];if(_0x175535)_0x22f1eb[_0x00a2('0x53')]=_0x175535;return _0x22f1eb;})[_0x00a2('0x27')](function(_0x546229){return db[_0x00a2('0x4e')][_0x00a2('0x45')](_0x546229,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4db43a});});})[_0x00a2('0x27')](function(){return _0x1e8a68;});}});});});}})['then'](respondWithResult(_0x20004e,0xc9))['catch'](handleError(_0x20004e,null));};exports[_0x00a2('0x26')]=function(_0x5176f4,_0x2a2e38){if(_0x5176f4[_0x00a2('0x4a')]['id']){delete _0x5176f4[_0x00a2('0x4a')]['id'];}return db[_0x00a2('0x2c')]['find']({'where':{'id':_0x5176f4['params']['id']}})[_0x00a2('0x27')](handleEntityNotFound(_0x2a2e38,null))[_0x00a2('0x27')](saveUpdates(_0x5176f4['body'],null))[_0x00a2('0x27')](respondWithResult(_0x2a2e38,null))[_0x00a2('0x40')](handleError(_0x2a2e38,null));};exports[_0x00a2('0x54')]=function(_0xf7fc90,_0x26c0f6){return db['UserProfile'][_0x00a2('0x44')]({'where':{'id':_0xf7fc90[_0x00a2('0x42')]['id']}})['then'](handleEntityNotFound(_0x26c0f6,null))[_0x00a2('0x27')](removeEntity(_0x26c0f6,null))[_0x00a2('0x40')](handleError(_0x26c0f6,null));};exports[_0x00a2('0x55')]=function(_0x5f305f,_0x44b2fa){return db[_0x00a2('0x2c')][_0x00a2('0x55')]()[_0x00a2('0x27')](respondWithResult(_0x44b2fa,null))['catch'](handleError(_0x44b2fa,null));};exports[_0x00a2('0x56')]=function(_0x4642b2,_0x33f020){var _0x5a0e2d=_0x4642b2[_0x00a2('0x4a')];return db[_0x00a2('0x2c')][_0x00a2('0x44')]({'where':{'id':_0x4642b2[_0x00a2('0x42')]['id']}})[_0x00a2('0x27')](handleEntityNotFound(_0x33f020,null))[_0x00a2('0x27')](function(_0x4d375a){if(_0x4d375a){return db[_0x00a2('0x4c')]['transaction'](function(_0x5ad419){return db[_0x00a2('0x4e')][_0x00a2('0x54')]({'where':{'userProfileId':_0x4642b2['params']['id'],'sectionId':_[_0x00a2('0x2b')](_0x5a0e2d,function(_0x213c9a){return _0x213c9a['sectionId'];})},'transaction':_0x5ad419})[_0x00a2('0x27')](function(){var _0x5ccedb=_[_0x00a2('0x2b')](_0x5a0e2d,function(_0x4d9a47){_0x4d9a47[_0x00a2('0x57')]=_0x4642b2['params']['id'];return _0x4d9a47;});var _0x199a21=[];return BPromise[_0x00a2('0x4f')](_0x5ccedb,function(_0x45597f){return db[_0x00a2('0x4e')][_0x00a2('0x45')](_0x45597f,{'include':[{'model':db[_0x00a2('0x51')],'as':_0x00a2('0x53')}],'raw':!![],'transaction':_0x5ad419})[_0x00a2('0x27')](function(_0x3d2d71){_0x199a21[_0x00a2('0x58')](_0x3d2d71[_0x00a2('0x46')]({'plain':!![]}));});})[_0x00a2('0x27')](function(){return _0x199a21;});});});}})['then'](function(_0x1772d3){return _0x1772d3;})['then'](respondWithResult(_0x33f020,null))[_0x00a2('0x40')](handleError(_0x33f020,null));};exports['removeSections']=function(_0x614d80,_0x3c0435){var _0x1482a7;return db[_0x00a2('0x2c')][_0x00a2('0x44')]({'where':{'id':_0x614d80[_0x00a2('0x42')]['id']},'attributes':['id',_0x00a2('0x2a')]})[_0x00a2('0x27')](handleEntityNotFound(_0x3c0435,null))[_0x00a2('0x27')](function(_0x5b692d){if(_0x5b692d){_0x1482a7=_0x5b692d;return db[_0x00a2('0x4e')][_0x00a2('0x54')]({'where':{'userProfileId':_0x614d80[_0x00a2('0x42')]['id'],'sectionId':_0x614d80[_0x00a2('0x2f')]['ids']}});}})[_0x00a2('0x27')](function(){return _0x1482a7;})[_0x00a2('0x27')](respondWithStatusCode(_0x3c0435,null))[_0x00a2('0x40')](handleError(_0x3c0435,null));};exports[_0x00a2('0x59')]=function(_0x49353f,_0x502ec4){var _0xfc757a=[];var _0x3f2bad=[];return db[_0x00a2('0x4e')][_0x00a2('0x3f')]({'where':{'userProfileId':_0x49353f[_0x00a2('0x42')]['id']},'raw':!![]})[_0x00a2('0x27')](function(_0x4a4191){_0xfc757a=_[_0x00a2('0x3a')](_0x4a4191,function(_0xa6fe3b){return _0xa6fe3b['enabled']===0x1||_[_0x00a2('0x5a')]([0x3eb,0x709],_0xa6fe3b[_0x00a2('0x52')]);});if(!_[_0x00a2('0x5b')](_0xfc757a)){return _['map'](_0xfc757a,function(_0x23e8d0){return _0x23e8d0[_0x00a2('0x52')];});}else{return;}})[_0x00a2('0x27')](function(_0x151b4f){if(_0x151b4f)_0x3f2bad=_0x151b4f;if(_[_0x00a2('0x5a')](_0x3f2bad,0x64)){var _0x38f961=_['find'](_0xfc757a,{'sectionId':0x64});return hasDefaultDashboard(_0x38f961)[_0x00a2('0x27')](function(_0xac043c){return _[_0x00a2('0x2b')](_0xfc757a,function(_0x53ae75){if(_0x53ae75[_0x00a2('0x52')]===0x64){_0x53ae75[_0x00a2('0x5c')]=_0xac043c;}return _0x53ae75;});});}else{return;}})['then'](function(_0x5649de){if(_0x5649de)_0xfc757a=_0x5649de;if(_[_0x00a2('0x5a')](_0x3f2bad,0x3eb)){var _0x440cea=_[_0x00a2('0x44')](_0xfc757a,{'sectionId':0x3eb});return getCustomDashboards(_0x440cea)[_0x00a2('0x27')](function(_0x5c0f6a){return _[_0x00a2('0x2b')](_0xfc757a,function(_0x5bf8a3){if(_0x440cea['enabled']){if(_0x5bf8a3[_0x00a2('0x52')]===0x3eb){_0x5bf8a3[_0x00a2('0x5c')]=_0x5c0f6a;}}else{if(_0x5bf8a3[_0x00a2('0x52')]===0x64){if(!_0x5bf8a3[_0x00a2('0x5c')]){_0x5bf8a3[_0x00a2('0x5c')]=[];}_0x5bf8a3[_0x00a2('0x5c')]=_0x5bf8a3['subsections'][_0x00a2('0x5d')](_0x5c0f6a);}}return _0x5bf8a3;});});}else{return;}})[_0x00a2('0x27')](function(_0x5b87a9){if(_0x5b87a9)_0xfc757a=_0x5b87a9;if(_[_0x00a2('0x5a')](_0x3f2bad,0x709)){var _0x2f6477=_[_0x00a2('0x44')](_0xfc757a,{'sectionId':0x709});return getPlugins(_0x2f6477)[_0x00a2('0x27')](function(_0x369191){if(_0x2f6477[_0x00a2('0x5e')]){return _[_0x00a2('0x2b')](_0xfc757a,function(_0x4a7c2c){if(_0x4a7c2c[_0x00a2('0x52')]===0x709){_0x4a7c2c['subsections']=_0x369191;}return _0x4a7c2c;});}else{var _0x1ec437={'sectionId':0x76c,'enabled':0x1,'subsections':_0x369191};var _0x15c88d=_[_0x00a2('0x2b')](_0xfc757a);_0x15c88d[_0x00a2('0x58')](_0x1ec437);return _0x15c88d;}});}else{return;}})[_0x00a2('0x27')](function(_0x4bad38){if(_0x4bad38)_0xfc757a=_0x4bad38;return _[_0x00a2('0x3a')](_0xfc757a,[_0x00a2('0x5e'),0x1]);})[_0x00a2('0x27')](respondWithResult(_0x502ec4,null))[_0x00a2('0x40')](handleError(_0x502ec4,null));};function hasDefaultDashboard(_0x559045){var _0x2af67a=[0x65];return new BPromise(function(_0x33c435,_0x1f2b7e){try{if(_0x559045['autoAssociation']){_0x33c435(_0x2af67a);}else{return db[_0x00a2('0x51')][_0x00a2('0x5f')]({'where':{'sectionId':_0x559045['id']},'raw':!![]})[_0x00a2('0x27')](function(_0x185cbc){_0x185cbc?_0x33c435(_0x2af67a):_0x33c435();});}}catch(_0x25e063){_0x1f2b7e(_0x25e063);}});}function getCustomDashboards(_0x392f00){var _0x3a977f=[];return new BPromise(function(_0x19450b,_0x4d383b){try{if(_0x392f00['autoAssociation']){return db[_0x00a2('0x60')][_0x00a2('0x3f')]({'raw':!![]})['then'](function(_0x17e79a){_0x17e79a[_0x00a2('0x61')](function(_0x57277a){_0x3a977f[_0x00a2('0x58')](_0x57277a['id']+0x1869f);});_0x19450b(_0x3a977f);});}else{return db[_0x00a2('0x51')][_0x00a2('0x3f')]({'where':{'sectionId':_0x392f00['id']},'raw':!![]})[_0x00a2('0x27')](function(_0x2fd025){_0x2fd025['forEach'](function(_0x308edc){_0x3a977f[_0x00a2('0x58')](_0x308edc[_0x00a2('0x62')]+0x1869f);});_0x19450b(_0x3a977f);});}}catch(_0x2b4224){_0x4d383b(_0x2b4224);}});}function getPlugins(_0x2751cf){var _0x48e31a=[];return new BPromise(function(_0x326d85,_0x345a28){try{if(_0x2751cf[_0x00a2('0x50')]){return db['Plugin'][_0x00a2('0x3f')]({'raw':!![]})[_0x00a2('0x27')](function(_0x467c4f){_0x467c4f[_0x00a2('0x61')](function(_0x243a79){_0x48e31a[_0x00a2('0x58')](_0x243a79['id']+0x15b38);});_0x326d85(_0x48e31a);});}else{return db[_0x00a2('0x51')][_0x00a2('0x3f')]({'where':{'sectionId':_0x2751cf['id']},'raw':!![]})[_0x00a2('0x27')](function(_0x2f3525){_0x2f3525[_0x00a2('0x61')](function(_0x285d0e){_0x48e31a[_0x00a2('0x58')](_0x285d0e[_0x00a2('0x62')]+0x15b38);});_0x326d85(_0x48e31a);});}}catch(_0x15fdde){_0x345a28(_0x15fdde);}});}exports[_0x00a2('0x63')]=function(_0x5da448,_0xa62384){return db[_0x00a2('0x2c')][_0x00a2('0x44')]({'where':{'id':_0x5da448[_0x00a2('0x42')]['id']}})['then'](handleEntityNotFound(_0xa62384,null))[_0x00a2('0x27')](function(_0x17f8fa){if(_0x17f8fa){return db['sequelize'][_0x00a2('0x4d')](function(_0x2285d2){return db[_0x00a2('0x4e')]['findAll']({'where':{'userProfileId':_0x5da448[_0x00a2('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0x00a2('0x27')](function(_0xf4961){if(_0xf4961){return db[_0x00a2('0x4e')][_0x00a2('0x54')]({'where':{'userProfileId':_0x5da448[_0x00a2('0x42')]['id'],'id':_[_0x00a2('0x2b')](_0xf4961,function(_0x5964e0){return _0x5964e0['id'];})},'transaction':_0x2285d2});}})[_0x00a2('0x27')](function(_0x1d71af){var _0x384bc1=_[_0x00a2('0x2b')](_0x5da448['body'],function(_0x3f2c51){_0x3f2c51[_0x00a2('0x57')]=_0x5da448[_0x00a2('0x42')]['id'];return _0x3f2c51;});return db[_0x00a2('0x4e')][_0x00a2('0x64')](_0x384bc1,{'raw':!![],'transaction':_0x2285d2});})['then'](function(_0x873e1a){var _0x30f4c3=_[_0x00a2('0x3a')](_[_0x00a2('0x2b')](_0x873e1a,function(_0x57344c){return _0x57344c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x30f4c3){return db[_0x00a2('0x4e')][_0x00a2('0x3f')]({'where':{'userProfileId':_0x5da448[_0x00a2('0x42')]['id'],'sectionId':_[_0x00a2('0x2b')](_0x30f4c3,function(_0x5a6acb){return _0x5a6acb[_0x00a2('0x52')];})},'attributes':['id',_0x00a2('0x52')],'raw':!![]})['then'](function(_0x2f966d){var _0x1d842a=_[_0x00a2('0x2b')](_0x5da448[_0x00a2('0x4a')],function(_0x5b27b2){_0x5b27b2['userProfileId']=_0x5da448[_0x00a2('0x42')]['id'];return _0x5b27b2;});return db[_0x00a2('0x51')][_0x00a2('0x64')](_0x1d842a,{'raw':!![],'transaction':_0x2285d2});});}})[_0x00a2('0x40')](handleError(_0xa62384,null));});}})[_0x00a2('0x27')](function(_0xf56f6e){var _0x426d1e=_[_0x00a2('0x2b')](_0xf56f6e,function(_0x2d91e9){return _0x2d91e9['get']({'plain':!![]});});})['then'](respondWithResult(_0xa62384,null))['catch'](handleError(_0xa62384,null));};exports['removeResources']=function(_0x34008b,_0x5b8ec9,_0x2189ee){return db[_0x00a2('0x2c')][_0x00a2('0x44')]({'where':{'id':_0x34008b[_0x00a2('0x42')]['id']}})[_0x00a2('0x27')](handleEntityNotFound(_0x5b8ec9,null))['then'](function(_0x545998){if(_0x545998){return _0x545998[_0x00a2('0x65')](_0x34008b[_0x00a2('0x2f')]['ids']);}})[_0x00a2('0x27')](respondWithStatusCode(_0x5b8ec9,null))[_0x00a2('0x40')](handleError(_0x5b8ec9,null));};exports[_0x00a2('0x66')]=function(_0x380c87,_0x255420){var _0x7c8064={};if(!_0x380c87[_0x00a2('0x2f')][_0x00a2('0x67')])throw new Error('Missing\x20section\x20parameter');if(!_0x380c87[_0x00a2('0x2f')][_0x00a2('0x68')](_0x00a2('0x69'))){_0x7c8064[_0x00a2('0x22')]=qs[_0x00a2('0x22')](_0x380c87[_0x00a2('0x2f')]['limit']);_0x7c8064['offset']=qs['offset'](_0x380c87[_0x00a2('0x2f')][_0x00a2('0x20')]);}return db['UserProfile'][_0x00a2('0x44')]({'where':{'id':_0x380c87[_0x00a2('0x42')]['id']}})['then'](function(_0x5a57dc){if(!_0x5a57dc)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x380c87[_0x00a2('0x42')]['id']);return db[_0x00a2('0x2c')][_0x00a2('0x66')](_0x380c87);})[_0x00a2('0x27')](respondWithFilteredResult(_0x255420,_0x7c8064))['catch'](handleError(_0x255420,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index fc151ea..2e44a77 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 _0x50e5=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x45eaf0,_0x347e3d){var _0x3a8201=function(_0x1ae24a){while(--_0x1ae24a){_0x45eaf0['push'](_0x45eaf0['shift']());}};_0x3a8201(++_0x347e3d);}(_0x50e5,0xb7));var _0x550e=function(_0x42846c,_0x484578){_0x42846c=_0x42846c-0x0;var _0x3829b2=_0x50e5[_0x42846c];return _0x3829b2;};'use strict';var EventEmitter=require(_0x550e('0x0'));var UserProfile=require(_0x550e('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x550e('0x2')](0x0);var events={'afterCreate':_0x550e('0x3'),'afterUpdate':_0x550e('0x4'),'afterDestroy':_0x550e('0x5')};function emitEvent(_0x40aee6){return function(_0x3f3a13,_0x78e6c5,_0xafede5){UserProfileEvents[_0x550e('0x6')](_0x40aee6+':'+_0x3f3a13['id'],_0x3f3a13);UserProfileEvents[_0x550e('0x6')](_0x40aee6,_0x3f3a13);_0xafede5(null);};}for(var e in events){if(events[_0x550e('0x7')](e)){var event=events[e];UserProfile[_0x550e('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xc14a=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2e0617,_0x198eb4){var _0x56d26f=function(_0x33a288){while(--_0x33a288){_0x2e0617['push'](_0x2e0617['shift']());}};_0x56d26f(++_0x198eb4);}(_0xc14a,0xa9));var _0xac14=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc14a[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xac14('0x0'));var UserProfile=require(_0xac14('0x1'))['db'][_0xac14('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xac14('0x3')](0x0);var events={'afterCreate':_0xac14('0x4'),'afterUpdate':'update','afterDestroy':_0xac14('0x5')};function emitEvent(_0x21c4da){return function(_0x53f3d1,_0x412485,_0x525320){UserProfileEvents[_0xac14('0x6')](_0x21c4da+':'+_0x53f3d1['id'],_0x53f3d1);UserProfileEvents[_0xac14('0x6')](_0x21c4da,_0x53f3d1);_0x525320(null);};}for(var e in events){if(events[_0xac14('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xac14('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fd685d8..aa284f1 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 _0x49f4=['outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','catch','define','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','where','VIRTUAL','foreignKey','forEach','options','include','reportType','default','CustomReports','count','rows','ids','customSorting','merge','extraQueryConditions','includeAll','Tags','color','tag','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','resolve','UserProfileResource','resourceId','type','toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','name','projectName','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','VoiceQueues','queue','VoiceQueue','QueueCampaigns'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x49f4,0x147));var _0x449f=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x49f4[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x449f('0x0'));var attributes=require(_0x449f('0x1'));var squel=require(_0x449f('0x2'));module[_0x449f('0x3')]=function(_0x1925cf){var _0x1bb48a=_0x1925cf[_0x449f('0x4')];function _0x55ce78(_0x5ee851,_0x585444){return new Promise(function(_0x587485,_0x17045d){if(!_0x585444)return _0x587485(null);var _0x58cf40=_0x585444[_0x449f('0x5')]?{[_0x585444[_0x449f('0x5')][_0x449f('0x6')]]:_0x585444['filter'][_0x449f('0x7')]}:undefined;return _0x1bb48a[_0x5ee851][_0x449f('0x8')]({'where':_0x58cf40,'raw':!![]})[_0x449f('0x9')](function(_0x3559a6){_0x585444[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3559a6,'id');_0x587485(_0x585444);})['catch'](function(_0x42a603){_0x17045d(_0x42a603);});});}function _0xc13d42(_0x528a5b,_0x39e78f){return new Promise(function(_0x405655,_0x569a22){var _0x5b73e3=_0x528a5b[_0x449f('0x5')]?{[_0x528a5b[_0x449f('0x5')]['field']]:_0x528a5b[_0x449f('0x5')][_0x449f('0x7')]}:undefined;return _0x1bb48a[_0x528a5b['model']]['findAll']({'where':_0x5b73e3,'raw':!![]})[_0x449f('0x9')](function(_0x3dd46c){_0x39e78f['associatedResources']=_['map'](_0x3dd46c,function(_0x38a22b){return _0x38a22b['name'];});_0x405655(_0x39e78f);})['catch'](function(_0x567eaf){_0x569a22(_0x567eaf);});});}function _0x1160e0(_0x306c1f,_0x3b4471,_0x413833){if(!_0x3b4471)return Promise[_0x449f('0xc')](null);return new Promise(function(_0x317dad,_0x1ed4e3){return _0x1bb48a[_0x449f('0xd')][_0x449f('0x8')]({'where':{'sectionId':_0x3b4471['id']},'raw':!![]})[_0x449f('0x9')](function(_0x3482bc){if(_0x306c1f[_0x449f('0x6')]&&_0x306c1f['field']!=='id'){_0x3b4471[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3482bc,function(_0x2be46e){return _0x2be46e[_0x306c1f[_0x449f('0x6')]];});}else{if(_0x413833==='AnalyticExtractedReport'){_0x3b4471[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3482bc,function(_0x3a19d5){return{'id':_0x3a19d5[_0x449f('0xe')],'type':_0x3a19d5[_0x449f('0xf')]};});}else{_0x3b4471[_0x449f('0xa')]=_['map'](_0x3482bc,function(_0x386503){return _0x386503[_0x449f('0xe')];});}}_0x317dad(_0x3b4471);})['catch'](function(_0x54d107){_0x1ed4e3(_0x54d107);});});}function _0xbb2add(_0x441a2d,_0x1571be){var _0x2a8f88={'parentSections':[]};switch(_0x441a2d[_0x449f('0x10')]()){case'squareprojects':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x12');break;case _0x449f('0x13'):_0x2a8f88[_0x449f('0x11')]='SquareOdbc';break;case _0x449f('0x14'):_0x2a8f88['childModel']=_0x449f('0x15');_0x2a8f88['parentSections']=[{'name':_0x449f('0x16'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x18')}];break;case'projects':_0x2a8f88[_0x449f('0x11')]='JscriptyProject';break;case _0x449f('0x19'):_0x2a8f88['childModel']=_0x449f('0x1a');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x1c'),'field':'id','foreignKey':_0x449f('0x1d')}];break;case _0x449f('0x1e'):_0x2a8f88['childModel']=_0x449f('0x1f');break;case _0x449f('0x20'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x21');break;case _0x449f('0x22'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x23');break;case _0x449f('0x24'):_0x2a8f88['childModel']=_0x449f('0x25');break;case _0x449f('0x26'):_0x2a8f88['childModel']=_0x449f('0x27');break;case _0x449f('0x28'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x29');break;case'faxaccounts':_0x2a8f88[_0x449f('0x11')]='FaxAccount';break;case'inboundroutes':case _0x449f('0x2a'):case _0x449f('0x2b'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x2c');break;case'contexts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x2d');break;case _0x449f('0x2e'):_0x2a8f88[_0x449f('0x11')]='VoiceMail';break;case _0x449f('0x2f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x30');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x31'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x32'),'model':'User','filter':{'field':'role','value':[_0x449f('0x33')]}},{'name':_0x449f('0x34'),'field':'name','foreignKey':_0x449f('0x32'),'model':_0x449f('0x35'),'filter':{'field':_0x449f('0x36'),'value':['telephone']}},{'name':_0x449f('0x37'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x38'),'model':_0x449f('0x39'),'filter':{'field':_0x449f('0xf'),'value':['inbound']}},{'name':_0x449f('0x3a'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x38'),'model':_0x449f('0x39'),'filter':{'field':_0x449f('0xf'),'value':[_0x449f('0x3b')]}}];break;case _0x449f('0x3c'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x3d');break;case _0x449f('0x3e'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x3f');break;case _0x449f('0x40'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x41');break;case _0x449f('0x42'):_0x2a8f88['childModel']='Campaign';break;case'mailqueues':_0x2a8f88['childModel']=_0x449f('0x43');break;case _0x449f('0x44'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x45');break;case _0x449f('0x46'):_0x2a8f88['childModel']='MailSubstatus';break;case _0x449f('0x47'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x48');break;case _0x449f('0x49'):_0x2a8f88[_0x449f('0x11')]='OpenchannelAccount';break;case _0x449f('0x4a'):_0x2a8f88[_0x449f('0x11')]='SmsQueue';break;case _0x449f('0x4b'):_0x2a8f88['childModel']='SmsAccount';break;case _0x449f('0x4c'):_0x2a8f88['childModel']=_0x449f('0x4d');break;case _0x449f('0x4e'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x4f');break;case _0x449f('0x50'):_0x2a8f88[_0x449f('0x11')]='Team';break;case _0x449f('0x51'):case _0x449f('0x52'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x39');if(_0x1571be){_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x37')},{'name':'QueueCampaigns'}];}break;case _0x449f('0x53'):case _0x449f('0x54'):case _0x449f('0x55'):_0x2a8f88[_0x449f('0x11')]='User';if(_0x1571be){_0x2a8f88[_0x449f('0x1b')]=[{'name':'Users','filter':{'field':'role','value':[_0x449f('0x56'),_0x449f('0x57')]},'ignore':!![]},{'name':_0x449f('0x31')},{'name':_0x449f('0x34')}];}break;case _0x449f('0x58'):_0x2a8f88[_0x449f('0x11')]='ZendeskAccount';break;case _0x449f('0x59'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5a');break;case _0x449f('0x5b'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5c');break;case _0x449f('0x5d'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5e');break;case _0x449f('0x5f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x60');break;case'zohoaccounts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x61');break;case'vtigeraccounts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x35');break;case'cannedanswers':_0x2a8f88['childModel']=_0x449f('0x62');break;case _0x449f('0x63'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x64');break;case _0x449f('0x65'):_0x2a8f88[_0x449f('0x11')]='Dashboard';break;case _0x449f('0x66'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x67');break;case'pauses':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x68');break;case _0x449f('0x69'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6a');break;case _0x449f('0x6b'):_0x2a8f88['childModel']='Sound';break;case _0x449f('0x6c'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6d');break;case'templates':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6e');break;case _0x449f('0x6f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x70');break;case _0x449f('0x71'):_0x2a8f88['childModel']=_0x449f('0x72');break;case _0x449f('0x73'):_0x2a8f88['childModel']='Variable';break;case _0x449f('0x74'):_0x2a8f88['childModel']=_0x449f('0x75');break;case _0x449f('0x76'):_0x2a8f88['childModel']=_0x449f('0x77');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x78'),'field':'id','foreignKey':_0x449f('0x79')}];break;case _0x449f('0x7a'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x7b');break;}return _0x2a8f88;}function _0x40b3c1(_0x5383d0,_0x53e3f4){var _0x2092b3=_0x5383d0['charAt'](0x0)['toUpperCase']()+_0x5383d0['slice'](0x1);var _0x238330={'type':_0x1bb48a[_0x449f('0x7c')][_0x449f('0x7d')][_0x449f('0x7e')],'raw':!![]};return new Promise(function(_0x4c415a,_0x64b4fa){var _0x53e99f=squel['select']()[_0x449f('0x6')](_0x449f('0x7f')+_0x2092b3+_0x449f('0x80'),'id')[_0x449f('0x6')](_0x449f('0x81'))[_0x449f('0x82')](_0x449f('0x83')+_0x5383d0+'_interactions','ui')['where'](_0x449f('0x84'),_0x53e3f4['id']);return _0x1bb48a[_0x449f('0x85')][_0x449f('0x86')](_0x53e99f[_0x449f('0x87')](),_0x238330)['then'](function(_0x5258a6){_0x53e3f4[_0x2092b3+_0x449f('0x88')]=_0x5258a6;_0x4c415a(_0x5258a6);})[_0x449f('0x89')](function(_0x58461e){_0x64b4fa(_0x58461e);});});}return _0x1925cf[_0x449f('0x8a')](_0x449f('0x8b'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xfb165f){var _0x16ac72=require(_0x449f('0x8c'));var _0xe16cc6={'raw':_0xfb165f[_0x449f('0x86')][_0x449f('0x8d')],'where':{}};var _0x59043d={};var _0x4ebb75={'count':0x0,'rows':[]};var _0xbaa9a0=_0xfb165f[_0x449f('0x86')][_0x449f('0x8e')];var _0x19819f=_0xfb165f[_0x449f('0x86')][_0x449f('0x8f')]||![];var _0x4fdf1a=_0xbb2add(_0xbaa9a0,_0x19819f);if(!_0x4fdf1a['childModel'])throw new Error(_0x449f('0x90')+_0xbaa9a0+'\x27');var _0xd20753=[{'name':_0xbaa9a0}];if(!_['isEmpty'](_0x4fdf1a['parentSections']))_0xd20753=_0x4fdf1a[_0x449f('0x1b')];var _0x3eac09=[];for(var _0x590c58=0x0;_0x590c58<_0xd20753[_0x449f('0x91')];_0x590c58++){_0x3eac09[_0x449f('0x92')](_0x1bb48a[_0x449f('0x93')][_0x449f('0x94')]({'where':{'userProfileId':_0xfb165f[_0x449f('0x95')]['id'],'name':_0xd20753[_0x590c58][_0x449f('0x17')]},'raw':!![]}));}return Promise[_0x449f('0x96')](_0x3eac09)[_0x449f('0x9')](function(_0x4598bf){var _0x2f50fd=_[_0x449f('0x5')](_0x4598bf,function(_0x54cdbb){return _0x54cdbb?_0x54cdbb:undefined;});var _0x380cba=_[_0x449f('0x5')](_0xd20753,[_0x449f('0x97'),!![]]);var _0x1c9474=_[_0x449f('0x98')](_0x2f50fd)&&_[_0x449f('0x98')](_0x380cba)?null:_[_0x449f('0x99')](_0x380cba,_0x2f50fd);if(!_0x1c9474)return null;var _0x22e44a=[];for(var _0x106fc5=0x0;_0x106fc5<_0x1c9474['length'];_0x106fc5++){var _0x3d8a3c=_['find'](_0xd20753,function(_0x3c3aaf){return _0x1c9474[_0x106fc5]?_0x3c3aaf[_0x449f('0x17')]===_0x1c9474[_0x106fc5][_0x449f('0x17')]:null;});if(_0x3d8a3c){if(_0x1c9474[_0x106fc5][_0x449f('0x97')]){_0x22e44a[_0x449f('0x92')](_0x55ce78(_0x4fdf1a[_0x449f('0x11')],_0x1c9474[_0x106fc5]));}else{if(!_0x1c9474[_0x106fc5][_0x449f('0x9a')]){_0x22e44a[_0x449f('0x92')](_0x1160e0(_0x3d8a3c,_0x1c9474[_0x106fc5],_0x4fdf1a['childModel']));}else{if(_0x3d8a3c[_0x449f('0x9b')]){_0x22e44a[_0x449f('0x92')](_0xc13d42(_0x3d8a3c,_0x1c9474[_0x106fc5]));}}}}}return Promise[_0x449f('0x96')](_0x22e44a);})[_0x449f('0x9')](function(_0x160145){var _0x3df778=_0x160145;var _0x380473=null;if(_0x3df778){_0x380473=_0x3df778[_0x449f('0x91')]===0x1?_0x3df778[0x0]:null;}if(!_0x380473&&!_0x3df778)return _0x4ebb75;var _0x48f51a=_0x1bb48a[_0x4fdf1a['childModel']][_0x449f('0x9c')];_0x59043d[_0x449f('0x9b')]=_[_0x449f('0x9d')](_0x48f51a);_0x59043d[_0x449f('0x86')]=_[_0x449f('0x9d')](_0xfb165f['query']);_0x59043d['filters']=_[_0x449f('0x9e')](_0x59043d['model'],_0x59043d[_0x449f('0x86')]);_0xe16cc6[_0x449f('0x9f')]=_[_0x449f('0x9e')](_0x59043d['model'],_0x16ac72[_0x449f('0xa0')](_0xfb165f[_0x449f('0x86')][_0x449f('0xa0')]));_0xe16cc6[_0x449f('0x9f')]=_0xe16cc6['attributes'][_0x449f('0x91')]?_0xe16cc6['attributes']:_0x59043d[_0x449f('0x9b')];if(!_0xfb165f[_0x449f('0x86')][_0x449f('0xa1')]('nolimit')){_0xe16cc6['limit']=_0x16ac72[_0x449f('0xa2')](_0xfb165f[_0x449f('0x86')][_0x449f('0xa2')]);_0xe16cc6[_0x449f('0xa3')]=_0x16ac72['offset'](_0xfb165f[_0x449f('0x86')]['offset']);}_0xe16cc6[_0x449f('0xa4')]=_0x16ac72[_0x449f('0xa5')](_0xfb165f['query'][_0x449f('0xa5')]);_0xe16cc6['where']=_0x16ac72[_0x449f('0xa6')](_[_0x449f('0xa7')](_0xfb165f[_0x449f('0x86')],_0x59043d[_0x449f('0xa6')]));if(_0xfb165f['query'][_0x449f('0x5')]){_0xe16cc6[_0x449f('0xa8')]=_['merge'](_0xe16cc6[_0x449f('0xa8')],{'$or':_[_0x449f('0xb')](_0x48f51a,function(_0xd52b00){if(_0xd52b00[_0x449f('0xf')]['key']!==_0x449f('0xa9')){var _0x141af5={};_0x141af5[_0xd52b00['field']]={'$like':'%'+_0xfb165f['query'][_0x449f('0x5')]+'%'};return _0x141af5;}})});}var _0x22f903=[];var _0x11f431=null;var _0x17dcb2={};if(_0x380473){_0x11f431=_['find'](_0xd20753,[_0x449f('0x17'),_0x380473[_0x449f('0x17')]]);if(_0x11f431[_0x449f('0x6')]){_0x17dcb2={};if(_0x4fdf1a[_0x449f('0x11')]===_0x449f('0x77')){_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_['map'](_0x380473[_0x449f('0xa')],'id');}else{_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_0x380473[_0x449f('0xa')];}_0x22f903[_0x449f('0x92')](_0x17dcb2);}else{_0xe16cc6['where']['id']=_0x380473[_0x449f('0xa')];}}else{for(var _0x4771de=0x0;_0x4771de<_0x3df778[_0x449f('0x91')];_0x4771de++){_0x11f431=_[_0x449f('0x94')](_0xd20753,[_0x449f('0x17'),_0x3df778[_0x4771de]['name']]);if(_0x11f431['field']){_0x17dcb2={};_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_0x3df778[_0x4771de][_0x449f('0xa')];_0x22f903['push'](_0x17dcb2);}else{if(!_0xe16cc6[_0x449f('0xa8')]['id'])_0xe16cc6[_0x449f('0xa8')]['id']=[];_0x3df778[_0x4771de][_0x449f('0xa')][_0x449f('0xab')](function(_0x1d5d6d){_0xe16cc6[_0x449f('0xa8')]['id'][_0x449f('0x92')](_0x1d5d6d);});}}}if(!_[_0x449f('0x98')](_0x22f903)){_0xe16cc6[_0x449f('0xa8')]=_['merge'](_0xe16cc6['where'],{'$and':{'$or':_0x22f903}});}_0xe16cc6=_['merge']({},_0xe16cc6,_0xfb165f[_0x449f('0xac')]);if(_0x380473&&!_0x380473[_0x449f('0x9a')]&&_0x4fdf1a[_0x449f('0x11')]===_0x449f('0x77')){if(_0xfb165f[_0x449f('0x86')]['includeAll']){_0xe16cc6[_0x449f('0xad')]=[{'all':!![]}];}return _0x1bb48a[_0x4fdf1a['childModel']][_0x449f('0x8')](_0xe16cc6)['then'](function(_0x145d88){var _0x27f8ec=[];_0x145d88['forEach'](function(_0x151667){var _0x444e2c;switch(_0x151667[_0x449f('0xae')]){case _0x449f('0xaf'):_0x444e2c=_[_0x449f('0x94')](_0x380473[_0x449f('0xa')],function(_0x3a6dff){return _0x3a6dff['id']===_0x151667[_0x449f('0x79')]&&_0x3a6dff[_0x449f('0xf')]==='DefaultReports';});break;case'custom':_0x444e2c=_[_0x449f('0x94')](_0x380473['associatedResources'],function(_0x1c32a1){return _0x1c32a1['id']===_0x151667[_0x449f('0x79')]&&_0x1c32a1['type']===_0x449f('0xb0');});break;}if(_0x444e2c)_0x27f8ec['push'](_0x151667);});_0x4ebb75[_0x449f('0xb1')]=_0x27f8ec[_0x449f('0x91')];_0x4ebb75[_0x449f('0xb2')]=_0x27f8ec;return _0x4ebb75;});}else{if(!_[_0x449f('0x98')](_0xfb165f[_0x449f('0x86')]['ids'])){_0xe16cc6[_0x449f('0xa8')]['id']=_0xe16cc6[_0x449f('0xa8')]['id']?_[_0x449f('0x9e')](_0xe16cc6[_0x449f('0xa8')]['id'],_0xfb165f[_0x449f('0x86')][_0x449f('0xb3')]):_0xfb165f[_0x449f('0x86')][_0x449f('0xb3')];if(_0xfb165f[_0x449f('0x86')][_0x449f('0xb4')]){_0xe16cc6[_0x449f('0xa4')]=_0xfb165f[_0x449f('0x86')][_0x449f('0xb4')];}}if(_0xfb165f[_0x449f('0x86')]['extraQueryConditions']){_0xe16cc6[_0x449f('0xa8')]=_[_0x449f('0xb5')](_0xe16cc6['where'],{'$and':_0xfb165f[_0x449f('0x86')][_0x449f('0xb6')]});}return _0x1bb48a[_0x4fdf1a[_0x449f('0x11')]][_0x449f('0xb1')]({'where':_0xe16cc6['where']})[_0x449f('0x9')](function(_0x13d8e3){_0x4ebb75[_0x449f('0xb1')]=_0x13d8e3;if(_0xfb165f[_0x449f('0x86')][_0x449f('0xb7')]){if(_0x4fdf1a['childModel']===_0x449f('0x1a')){_0xe16cc6[_0x449f('0xad')]=[{'model':_0x1bb48a['Tag'],'as':_0x449f('0xb8'),'attributes':['id',_0x449f('0x17'),_0x449f('0xb9')],'required':_0xfb165f[_0x449f('0x86')][_0x449f('0xba')]?!![]:![]},{'model':_0x1bb48a[_0x449f('0x6d')],'as':'ThroughTags','attributes':['id',_0x449f('0x17'),_0x449f('0xb9')],'through':_0xfb165f[_0x449f('0x86')][_0x449f('0xba')]?{'attributes':[],'where':{'TagId':_0xfb165f['query']['tag']||undefined}}:{},'required':_0xfb165f['query']['tag']?!![]:![]}];}else{_0xe16cc6[_0x449f('0xad')]=[{'all':!![]}];}}return _0x1bb48a[_0x4fdf1a[_0x449f('0x11')]][_0x449f('0x8')](_0xe16cc6);})[_0x449f('0x9')](function(_0x1d4baa){_0x4ebb75['rows']=_0x1d4baa;if(_0xbaa9a0===_0x449f('0x31')&&_0xfb165f['query']['openTabs']==='true'){var _0x2a43f9=[];for(var _0x387fa0=0x0;_0x387fa0<_0x4ebb75[_0x449f('0xb2')][_0x449f('0x91')];_0x387fa0++){_0x2a43f9['push'](_0x40b3c1(_0x449f('0xbb'),_0x4ebb75[_0x449f('0xb2')][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbd'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1('fax',_0x4ebb75[_0x449f('0xb2')][_0x387fa0]['dataValues']));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbe'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbf'),_0x4ebb75[_0x449f('0xb2')][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9['push'](_0x40b3c1(_0x449f('0xc0'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));}return Promise['all'](_0x2a43f9)[_0x449f('0x9')](function(){return _0x4ebb75;});}return _0x4ebb75;});}});}}});}; \ No newline at end of file +var _0x952e=['reportType','default','reportId','DefaultReports','custom','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','ThroughTags','color','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','agent','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','chanspies','VoiceChanSpy','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','User','Users','role','admin','user','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','all','ignore','isEmpty','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach'];(function(_0x5cb3d6,_0x15c259){var _0x99da4=function(_0x57b15a){while(--_0x57b15a){_0x5cb3d6['push'](_0x5cb3d6['shift']());}};_0x99da4(++_0x15c259);}(_0x952e,0xde));var _0xe952=function(_0x41b263,_0x31cb88){_0x41b263=_0x41b263-0x0;var _0x513e3d=_0x952e[_0x41b263];return _0x513e3d;};'use strict';var _=require(_0xe952('0x0'));var attributes=require(_0xe952('0x1'));var squel=require(_0xe952('0x2'));module['exports']=function(_0x2ef07d){var _0x58eadc=_0x2ef07d[_0xe952('0x3')];function _0x4b70fc(_0x27aae8,_0x360a56){return new Promise(function(_0x33f157,_0x10d025){if(!_0x360a56)return _0x33f157(null);var _0x353627=_0x360a56[_0xe952('0x4')]?{[_0x360a56['filter'][_0xe952('0x5')]]:_0x360a56[_0xe952('0x4')][_0xe952('0x6')]}:undefined;return _0x58eadc[_0x27aae8][_0xe952('0x7')]({'where':_0x353627,'raw':!![]})[_0xe952('0x8')](function(_0x1bc199){_0x360a56[_0xe952('0x9')]=_[_0xe952('0xa')](_0x1bc199,'id');_0x33f157(_0x360a56);})[_0xe952('0xb')](function(_0x24bf69){_0x10d025(_0x24bf69);});});}function _0x14f0e0(_0x19cb81,_0x2afebe){return new Promise(function(_0xb091d6,_0x45a6ee){var _0x4a08c7=_0x19cb81['filter']?{[_0x19cb81[_0xe952('0x4')]['field']]:_0x19cb81[_0xe952('0x4')][_0xe952('0x6')]}:undefined;return _0x58eadc[_0x19cb81['model']][_0xe952('0x7')]({'where':_0x4a08c7,'raw':!![]})[_0xe952('0x8')](function(_0x30b48a){_0x2afebe[_0xe952('0x9')]=_[_0xe952('0xa')](_0x30b48a,function(_0x3a539d){return _0x3a539d[_0xe952('0xc')];});_0xb091d6(_0x2afebe);})[_0xe952('0xb')](function(_0x3da225){_0x45a6ee(_0x3da225);});});}function _0x3a91d1(_0x3d52f9,_0x37fce6,_0x66cebe){if(!_0x37fce6)return Promise[_0xe952('0xd')](null);return new Promise(function(_0x41f631,_0x13e4d9){return _0x58eadc['UserProfileResource']['findAll']({'where':{'sectionId':_0x37fce6['id']},'raw':!![]})[_0xe952('0x8')](function(_0x598e54){if(_0x3d52f9['field']&&_0x3d52f9['field']!=='id'){_0x37fce6['associatedResources']=_[_0xe952('0xa')](_0x598e54,function(_0x527fc4){return _0x527fc4[_0x3d52f9[_0xe952('0x5')]];});}else{if(_0x66cebe===_0xe952('0xe')){_0x37fce6[_0xe952('0x9')]=_[_0xe952('0xa')](_0x598e54,function(_0xae79f5){return{'id':_0xae79f5['resourceId'],'type':_0xae79f5[_0xe952('0xf')]};});}else{_0x37fce6['associatedResources']=_[_0xe952('0xa')](_0x598e54,function(_0x447bf1){return _0x447bf1[_0xe952('0x10')];});}}_0x41f631(_0x37fce6);})[_0xe952('0xb')](function(_0x32b7c0){_0x13e4d9(_0x32b7c0);});});}function _0x43a39f(_0x51dce1,_0x395e5b){var _0x3d3519={'parentSections':[]};switch(_0x51dce1[_0xe952('0x11')]()){case _0xe952('0x12'):_0x3d3519['childModel']=_0xe952('0x13');break;case'odbc':_0x3d3519[_0xe952('0x14')]=_0xe952('0x15');break;case _0xe952('0x16'):_0x3d3519['childModel']=_0xe952('0x17');_0x3d3519[_0xe952('0x18')]=[{'name':'SquareProjects','field':_0xe952('0xc'),'foreignKey':_0xe952('0x19')}];break;case _0xe952('0x1a'):_0x3d3519['childModel']=_0xe952('0x1b');break;case _0xe952('0x1c'):_0x3d3519[_0xe952('0x14')]='CmContact';_0x3d3519[_0xe952('0x18')]=[{'name':_0xe952('0x1d'),'field':'id','foreignKey':_0xe952('0x1e')}];break;case'lists':_0x3d3519[_0xe952('0x14')]=_0xe952('0x1f');break;case _0xe952('0x20'):_0x3d3519[_0xe952('0x14')]='CmCompany';break;case'globalcustomfields':_0x3d3519[_0xe952('0x14')]=_0xe952('0x21');break;case _0xe952('0x22'):_0x3d3519['childModel']=_0xe952('0x23');break;case _0xe952('0x24'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x25');break;case'faxqueues':_0x3d3519[_0xe952('0x14')]=_0xe952('0x26');break;case _0xe952('0x27'):_0x3d3519['childModel']=_0xe952('0x28');break;case _0xe952('0x29'):case _0xe952('0x2a'):case _0xe952('0x2b'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x2c');break;case'contexts':_0x3d3519[_0xe952('0x14')]=_0xe952('0x2d');break;case _0xe952('0x2e'):_0x3d3519['childModel']='VoiceMail';break;case _0xe952('0x2f'):_0x3d3519['childModel']=_0xe952('0x30');_0x3d3519[_0xe952('0x18')]=[{'name':'Agents','field':'name','foreignKey':_0xe952('0x31'),'model':'User','filter':{'field':'role','value':[_0xe952('0x32')]}},{'name':'Telephones','field':_0xe952('0xc'),'foreignKey':_0xe952('0x31'),'model':'User','filter':{'field':'role','value':[_0xe952('0x33')]}},{'name':_0xe952('0x34'),'field':_0xe952('0xc'),'foreignKey':'queue','model':_0xe952('0x35'),'filter':{'field':_0xe952('0xf'),'value':[_0xe952('0x36')]}},{'name':_0xe952('0x37'),'field':_0xe952('0xc'),'foreignKey':_0xe952('0x38'),'model':'VoiceQueue','filter':{'field':_0xe952('0xf'),'value':[_0xe952('0x39')]}}];break;case'musiconholds':_0x3d3519['childModel']='VoiceMusicOnHold';break;case _0xe952('0x3a'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x3b');break;case'voiceprefixes':_0x3d3519['childModel']=_0xe952('0x3c');break;case'ivrcampaigns':_0x3d3519[_0xe952('0x14')]='Campaign';break;case _0xe952('0x3d'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x3e');break;case _0xe952('0x3f'):_0x3d3519['childModel']=_0xe952('0x40');break;case _0xe952('0x41'):_0x3d3519['childModel']='MailSubstatus';break;case _0xe952('0x42'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x43');break;case _0xe952('0x44'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x45');break;case _0xe952('0x46'):_0x3d3519['childModel']='SmsQueue';break;case'smsaccounts':_0x3d3519[_0xe952('0x14')]=_0xe952('0x47');break;case _0xe952('0x48'):_0x3d3519['childModel']=_0xe952('0x49');break;case _0xe952('0x4a'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x4b');break;case _0xe952('0x4c'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x4d');break;case _0xe952('0x4e'):case _0xe952('0x4f'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x35');if(_0x395e5b){_0x3d3519[_0xe952('0x18')]=[{'name':_0xe952('0x34')},{'name':_0xe952('0x37')}];}break;case _0xe952('0x50'):case _0xe952('0x51'):case _0xe952('0x52'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x53');if(_0x395e5b){_0x3d3519[_0xe952('0x18')]=[{'name':_0xe952('0x54'),'filter':{'field':_0xe952('0x55'),'value':[_0xe952('0x56'),_0xe952('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0xe952('0x58')}];}break;case _0xe952('0x59'):_0x3d3519['childModel']='ZendeskAccount';break;case _0xe952('0x5a'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x5b');break;case'freshdeskaccounts':_0x3d3519[_0xe952('0x14')]=_0xe952('0x5c');break;case _0xe952('0x5d'):_0x3d3519[_0xe952('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x3d3519[_0xe952('0x14')]=_0xe952('0x5e');break;case _0xe952('0x5f'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x60');break;case _0xe952('0x61'):_0x3d3519[_0xe952('0x14')]='User';break;case _0xe952('0x62'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x63');break;case'dispositions':_0x3d3519[_0xe952('0x14')]='Disposition';break;case _0xe952('0x64'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x65');break;case'intervals':_0x3d3519[_0xe952('0x14')]=_0xe952('0x66');break;case _0xe952('0x67'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x68');break;case _0xe952('0x69'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x6a');break;case _0xe952('0x6b'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x6c');break;case _0xe952('0x6d'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x6e');break;case'templates':_0x3d3519[_0xe952('0x14')]=_0xe952('0x6f');break;case _0xe952('0x70'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x71');break;case'trunks':_0x3d3519[_0xe952('0x14')]=_0xe952('0x72');break;case _0xe952('0x73'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x74');break;case _0xe952('0x75'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x76');break;case'extractedreports':_0x3d3519[_0xe952('0x14')]='AnalyticExtractedReport';_0x3d3519[_0xe952('0x18')]=[{'name':_0xe952('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0xe952('0x78'):_0x3d3519[_0xe952('0x14')]=_0xe952('0x79');break;}return _0x3d3519;}function _0x27aab7(_0x431902,_0x2de8e6){var _0x78d172=_0x431902[_0xe952('0x7a')](0x0)[_0xe952('0x7b')]()+_0x431902[_0xe952('0x7c')](0x1);var _0x33242f={'type':_0x58eadc[_0xe952('0x7d')][_0xe952('0x7e')][_0xe952('0x7f')],'raw':!![]};return new Promise(function(_0x19b475,_0x3edcc8){var _0x39c77d=squel['select']()[_0xe952('0x5')](_0xe952('0x80')+_0x78d172+_0xe952('0x81'),'id')[_0xe952('0x5')](_0xe952('0x82'))[_0xe952('0x83')](_0xe952('0x84')+_0x431902+_0xe952('0x85'),'ui')[_0xe952('0x86')](_0xe952('0x87'),_0x2de8e6['id']);return _0x58eadc[_0xe952('0x88')][_0xe952('0x89')](_0x39c77d[_0xe952('0x8a')](),_0x33242f)[_0xe952('0x8')](function(_0xd1f538){_0x2de8e6[_0x78d172+_0xe952('0x8b')]=_0xd1f538;_0x19b475(_0xd1f538);})[_0xe952('0xb')](function(_0x13129e){_0x3edcc8(_0x13129e);});});}return _0x2ef07d[_0xe952('0x8c')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x400c32){var _0x3e96e6=require(_0xe952('0x8d'));var _0xc06dd9={'raw':_0x400c32['query'][_0xe952('0x8e')],'where':{}};var _0x1bf1b3={};var _0x4b3bff={'count':0x0,'rows':[]};var _0x47a644=_0x400c32[_0xe952('0x89')][_0xe952('0x8f')];var _0x5810a0=_0x400c32[_0xe952('0x89')][_0xe952('0x90')]||![];var _0x23c7fd=_0x43a39f(_0x47a644,_0x5810a0);if(!_0x23c7fd[_0xe952('0x14')])throw new Error(_0xe952('0x91')+_0x47a644+'\x27');var _0x5ce519=[{'name':_0x47a644}];if(!_['isEmpty'](_0x23c7fd[_0xe952('0x18')]))_0x5ce519=_0x23c7fd[_0xe952('0x18')];var _0x89b11a=[];for(var _0x5eb002=0x0;_0x5eb002<_0x5ce519[_0xe952('0x92')];_0x5eb002++){_0x89b11a[_0xe952('0x93')](_0x58eadc['UserProfileSection'][_0xe952('0x94')]({'where':{'userProfileId':_0x400c32[_0xe952('0x95')]['id'],'name':_0x5ce519[_0x5eb002][_0xe952('0xc')]},'raw':!![]}));}return Promise[_0xe952('0x96')](_0x89b11a)[_0xe952('0x8')](function(_0x2aaacc){var _0x2fb8f2=_['filter'](_0x2aaacc,function(_0x37bd53){return _0x37bd53?_0x37bd53:undefined;});var _0x266ec3=_[_0xe952('0x4')](_0x5ce519,[_0xe952('0x97'),!![]]);var _0x1ff686=_[_0xe952('0x98')](_0x2fb8f2)&&_[_0xe952('0x98')](_0x266ec3)?null:_['union'](_0x266ec3,_0x2fb8f2);if(!_0x1ff686)return null;var _0x3787ae=[];for(var _0x337b7e=0x0;_0x337b7e<_0x1ff686[_0xe952('0x92')];_0x337b7e++){var _0x5152ce=_[_0xe952('0x94')](_0x5ce519,function(_0x2d26ee){return _0x1ff686[_0x337b7e]?_0x2d26ee['name']===_0x1ff686[_0x337b7e]['name']:null;});if(_0x5152ce){if(_0x1ff686[_0x337b7e][_0xe952('0x97')]){_0x3787ae[_0xe952('0x93')](_0x4b70fc(_0x23c7fd[_0xe952('0x14')],_0x1ff686[_0x337b7e]));}else{if(!_0x1ff686[_0x337b7e][_0xe952('0x99')]){_0x3787ae[_0xe952('0x93')](_0x3a91d1(_0x5152ce,_0x1ff686[_0x337b7e],_0x23c7fd[_0xe952('0x14')]));}else{if(_0x5152ce[_0xe952('0x9a')]){_0x3787ae['push'](_0x14f0e0(_0x5152ce,_0x1ff686[_0x337b7e]));}}}}}return Promise[_0xe952('0x96')](_0x3787ae);})[_0xe952('0x8')](function(_0x2b8a41){var _0x2b9523=_0x2b8a41;var _0xdc5853=null;if(_0x2b9523){_0xdc5853=_0x2b9523[_0xe952('0x92')]===0x1?_0x2b9523[0x0]:null;}if(!_0xdc5853&&!_0x2b9523)return _0x4b3bff;var _0x5b0e2f=_0x58eadc[_0x23c7fd[_0xe952('0x14')]][_0xe952('0x9b')];_0x1bf1b3[_0xe952('0x9a')]=_[_0xe952('0x9c')](_0x5b0e2f);_0x1bf1b3['query']=_[_0xe952('0x9c')](_0x400c32[_0xe952('0x89')]);_0x1bf1b3[_0xe952('0x9d')]=_[_0xe952('0x9e')](_0x1bf1b3[_0xe952('0x9a')],_0x1bf1b3[_0xe952('0x89')]);_0xc06dd9[_0xe952('0x9f')]=_['intersection'](_0x1bf1b3[_0xe952('0x9a')],_0x3e96e6[_0xe952('0xa0')](_0x400c32[_0xe952('0x89')][_0xe952('0xa0')]));_0xc06dd9['attributes']=_0xc06dd9[_0xe952('0x9f')][_0xe952('0x92')]?_0xc06dd9[_0xe952('0x9f')]:_0x1bf1b3[_0xe952('0x9a')];if(!_0x400c32[_0xe952('0x89')]['hasOwnProperty'](_0xe952('0xa1'))){_0xc06dd9[_0xe952('0xa2')]=_0x3e96e6[_0xe952('0xa2')](_0x400c32['query']['limit']);_0xc06dd9[_0xe952('0xa3')]=_0x3e96e6['offset'](_0x400c32[_0xe952('0x89')][_0xe952('0xa3')]);}_0xc06dd9['order']=_0x3e96e6[_0xe952('0xa4')](_0x400c32[_0xe952('0x89')]['sort']);_0xc06dd9[_0xe952('0x86')]=_0x3e96e6[_0xe952('0x9d')](_['pick'](_0x400c32[_0xe952('0x89')],_0x1bf1b3[_0xe952('0x9d')]));if(_0x400c32[_0xe952('0x89')][_0xe952('0x4')]){_0xc06dd9[_0xe952('0x86')]=_['merge'](_0xc06dd9[_0xe952('0x86')],{'$or':_['map'](_0x5b0e2f,function(_0x1c84dc){if(_0x1c84dc[_0xe952('0xf')]['key']!==_0xe952('0xa5')){var _0x48c552={};_0x48c552[_0x1c84dc[_0xe952('0x5')]]={'$like':'%'+_0x400c32[_0xe952('0x89')][_0xe952('0x4')]+'%'};return _0x48c552;}})});}var _0x3a6313=[];var _0x5aa98f=null;var _0x4dddbd={};if(_0xdc5853){_0x5aa98f=_[_0xe952('0x94')](_0x5ce519,[_0xe952('0xc'),_0xdc5853[_0xe952('0xc')]]);if(_0x5aa98f[_0xe952('0x5')]){_0x4dddbd={};if(_0x23c7fd[_0xe952('0x14')]==='AnalyticExtractedReport'){_0x4dddbd[_0x5aa98f['foreignKey']]=_[_0xe952('0xa')](_0xdc5853[_0xe952('0x9')],'id');}else{_0x4dddbd[_0x5aa98f[_0xe952('0xa6')]]=_0xdc5853[_0xe952('0x9')];}_0x3a6313[_0xe952('0x93')](_0x4dddbd);}else{_0xc06dd9['where']['id']=_0xdc5853[_0xe952('0x9')];}}else{for(var _0x52af95=0x0;_0x52af95<_0x2b9523[_0xe952('0x92')];_0x52af95++){_0x5aa98f=_[_0xe952('0x94')](_0x5ce519,['name',_0x2b9523[_0x52af95][_0xe952('0xc')]]);if(_0x5aa98f['field']){_0x4dddbd={};_0x4dddbd[_0x5aa98f[_0xe952('0xa6')]]=_0x2b9523[_0x52af95][_0xe952('0x9')];_0x3a6313['push'](_0x4dddbd);}else{if(!_0xc06dd9[_0xe952('0x86')]['id'])_0xc06dd9[_0xe952('0x86')]['id']=[];_0x2b9523[_0x52af95][_0xe952('0x9')]['forEach'](function(_0x4fe868){_0xc06dd9[_0xe952('0x86')]['id']['push'](_0x4fe868);});}}}if(!_[_0xe952('0x98')](_0x3a6313)){_0xc06dd9['where']=_[_0xe952('0xa7')](_0xc06dd9[_0xe952('0x86')],{'$and':{'$or':_0x3a6313}});}_0xc06dd9=_[_0xe952('0xa7')]({},_0xc06dd9,_0x400c32[_0xe952('0xa8')]);if(_0xdc5853&&!_0xdc5853[_0xe952('0x99')]&&_0x23c7fd[_0xe952('0x14')]===_0xe952('0xe')){if(_0x400c32['query'][_0xe952('0xa9')]){_0xc06dd9[_0xe952('0xaa')]=[{'all':!![]}];}return _0x58eadc[_0x23c7fd[_0xe952('0x14')]][_0xe952('0x7')](_0xc06dd9)['then'](function(_0x1e1daa){var _0x34ee72=[];_0x1e1daa[_0xe952('0xab')](function(_0x435b19){var _0x3af90d;switch(_0x435b19[_0xe952('0xac')]){case _0xe952('0xad'):_0x3af90d=_['find'](_0xdc5853[_0xe952('0x9')],function(_0x135074){return _0x135074['id']===_0x435b19[_0xe952('0xae')]&&_0x135074[_0xe952('0xf')]===_0xe952('0xaf');});break;case _0xe952('0xb0'):_0x3af90d=_[_0xe952('0x94')](_0xdc5853[_0xe952('0x9')],function(_0x5c636b){return _0x5c636b['id']===_0x435b19[_0xe952('0xae')]&&_0x5c636b['type']==='CustomReports';});break;}if(_0x3af90d)_0x34ee72[_0xe952('0x93')](_0x435b19);});_0x4b3bff[_0xe952('0xb1')]=_0x34ee72['length'];_0x4b3bff[_0xe952('0xb2')]=_0x34ee72;return _0x4b3bff;});}else{if(!_[_0xe952('0x98')](_0x400c32[_0xe952('0x89')][_0xe952('0xb3')])){_0xc06dd9[_0xe952('0x86')]['id']=_0xc06dd9[_0xe952('0x86')]['id']?_[_0xe952('0x9e')](_0xc06dd9['where']['id'],_0x400c32[_0xe952('0x89')]['ids']):_0x400c32[_0xe952('0x89')][_0xe952('0xb3')];if(_0x400c32[_0xe952('0x89')][_0xe952('0xb4')]){_0xc06dd9[_0xe952('0xb5')]=_0x400c32['query'][_0xe952('0xb4')];}}if(_0x400c32[_0xe952('0x89')][_0xe952('0xb6')]){_0xc06dd9[_0xe952('0x86')]=_[_0xe952('0xa7')](_0xc06dd9[_0xe952('0x86')],{'$and':_0x400c32['query'][_0xe952('0xb6')]});}return _0x58eadc[_0x23c7fd[_0xe952('0x14')]]['count']({'where':_0xc06dd9[_0xe952('0x86')]})['then'](function(_0x1b1843){_0x4b3bff[_0xe952('0xb1')]=_0x1b1843;if(_0x400c32['query']['includeAll']){if(_0x23c7fd[_0xe952('0x14')]===_0xe952('0xb7')){_0xc06dd9[_0xe952('0xaa')]=[{'model':_0x58eadc[_0xe952('0x6e')],'as':_0xe952('0xb8'),'attributes':['id',_0xe952('0xc'),'color'],'required':_0x400c32[_0xe952('0x89')]['tag']?!![]:![]},{'model':_0x58eadc[_0xe952('0x6e')],'as':_0xe952('0xb9'),'attributes':['id',_0xe952('0xc'),_0xe952('0xba')],'through':_0x400c32['query'][_0xe952('0xbb')]?{'attributes':[],'where':{'TagId':_0x400c32['query'][_0xe952('0xbb')]||undefined}}:{},'required':_0x400c32[_0xe952('0x89')][_0xe952('0xbb')]?!![]:![]}];}else{_0xc06dd9[_0xe952('0xaa')]=[{'all':!![]}];}}return _0x58eadc[_0x23c7fd[_0xe952('0x14')]][_0xe952('0x7')](_0xc06dd9);})[_0xe952('0x8')](function(_0x32a8c3){_0x4b3bff['rows']=_0x32a8c3;if(_0x47a644==='Agents'&&_0x400c32['query'][_0xe952('0xbc')]===_0xe952('0xbd')){var _0x845681=[];for(var _0x4ad854=0x0;_0x4ad854<_0x4b3bff[_0xe952('0xb2')][_0xe952('0x92')];_0x4ad854++){_0x845681[_0xe952('0x93')](_0x27aab7(_0xe952('0xbe'),_0x4b3bff[_0xe952('0xb2')][_0x4ad854][_0xe952('0xbf')]));_0x845681['push'](_0x27aab7(_0xe952('0xc0'),_0x4b3bff[_0xe952('0xb2')][_0x4ad854]['dataValues']));_0x845681['push'](_0x27aab7(_0xe952('0xc1'),_0x4b3bff[_0xe952('0xb2')][_0x4ad854]['dataValues']));_0x845681[_0xe952('0x93')](_0x27aab7(_0xe952('0xc2'),_0x4b3bff[_0xe952('0xb2')][_0x4ad854][_0xe952('0xbf')]));_0x845681['push'](_0x27aab7(_0xe952('0xc3'),_0x4b3bff[_0xe952('0xb2')][_0x4ad854][_0xe952('0xbf')]));_0x845681[_0xe952('0x93')](_0x27aab7(_0xe952('0xc4'),_0x4b3bff['rows'][_0x4ad854][_0xe952('0xbf')]));}return Promise[_0xe952('0x96')](_0x845681)['then'](function(){return _0x4b3bff;});}return _0x4b3bff;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e7c495c..137532b 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 _0xdb8b=['http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x550d49,_0x870b44){var _0xec46f3=function(_0x2fa514){while(--_0x2fa514){_0x550d49['push'](_0x550d49['shift']());}};_0xec46f3(++_0x870b44);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x503710,_0x5eb02d){_0x503710=_0x503710-0x0;var _0x3a6bff=_0xdb8b[_0x503710];return _0x3a6bff;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var moment=require(_0xbdb8('0x1'));var BPromise=require(_0xbdb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb8('0x4'))(_0xbdb8('0x5'));var config=require(_0xbdb8('0x6'));var jayson=require(_0xbdb8('0x7'));var client=jayson['client'][_0xbdb8('0x8')]({'port':0x232a});config['redis']=_[_0xbdb8('0x9')](config[_0xbdb8('0xa')],{'host':_0xbdb8('0xb'),'port':0x18eb});var socket=require(_0xbdb8('0xc'))(new Redis(config[_0xbdb8('0xa')]));require(_0xbdb8('0xd'))['register'](socket);function respondWithRpcPromise(_0x3339c2,_0x176a31,_0x3cc8d1){return new BPromise(function(_0x682657,_0x2fba54){return client[_0xbdb8('0xe')](_0x3339c2,_0x3cc8d1)[_0xbdb8('0xf')](function(_0x55f17e){logger['info'](_0xbdb8('0x10'),_0x176a31,'request\x20sent');logger[_0xbdb8('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x176a31,_0xbdb8('0x12'),JSON['stringify'](_0x55f17e));if(_0x55f17e[_0xbdb8('0x13')]){if(_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x14')]===0x1f4){logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);return _0x2fba54(_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);}logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);return _0x682657(_0x55f17e['error'][_0xbdb8('0x15')]);}else{logger[_0xbdb8('0x16')](_0xbdb8('0x10'),_0x176a31,'request\x20sent');_0x682657(_0x55f17e['result'][_0xbdb8('0x15')]);}})['catch'](function(_0x37177b){logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x37177b);_0x2fba54(_0x37177b);});});} \ No newline at end of file +var _0xc14a=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x49bf94,_0x1b48c7){var _0x88831d=function(_0x555f68){while(--_0x555f68){_0x49bf94['push'](_0x49bf94['shift']());}};_0x88831d(++_0x1b48c7);}(_0xc14a,0xa9));var _0xac14=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc14a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xac14('0x0'));var util=require(_0xac14('0x1'));var moment=require(_0xac14('0x2'));var BPromise=require(_0xac14('0x3'));var rs=require(_0xac14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac14('0x5'))['db'];var utils=require(_0xac14('0x6'));var logger=require('../../config/logger')(_0xac14('0x7'));var config=require('../../config/environment');var jayson=require(_0xac14('0x8'));var client=jayson[_0xac14('0x9')][_0xac14('0xa')]({'port':0x232a});config['redis']=_[_0xac14('0xb')](config[_0xac14('0xc')],{'host':_0xac14('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac14('0xc')]));require(_0xac14('0xe'))[_0xac14('0xf')](socket);function respondWithRpcPromise(_0x25f266,_0x5b8be6,_0x86118d){return new BPromise(function(_0x540967,_0x85ed98){return client[_0xac14('0x10')](_0x25f266,_0x86118d)['then'](function(_0x517651){logger[_0xac14('0x11')](_0xac14('0x12'),_0x5b8be6,'request\x20sent');logger[_0xac14('0x13')](_0xac14('0x14'),_0x5b8be6,'request\x20sent',JSON[_0xac14('0x15')](_0x517651));if(_0x517651['error']){if(_0x517651[_0xac14('0x16')][_0xac14('0x17')]===0x1f4){logger[_0xac14('0x16')]('UserProfile,\x20%s,\x20%s',_0x5b8be6,_0x517651['error'][_0xac14('0x18')]);return _0x85ed98(_0x517651['error'][_0xac14('0x18')]);}logger['error'](_0xac14('0x12'),_0x5b8be6,_0x517651[_0xac14('0x16')][_0xac14('0x18')]);return _0x540967(_0x517651[_0xac14('0x16')][_0xac14('0x18')]);}else{logger['info'](_0xac14('0x12'),_0x5b8be6,_0xac14('0x19'));_0x540967(_0x517651[_0xac14('0x1a')][_0xac14('0x18')]);}})[_0xac14('0x1b')](function(_0x15fc09){logger[_0xac14('0x16')]('UserProfile,\x20%s,\x20%s',_0x5b8be6,_0x15fc09);_0x85ed98(_0x15fc09);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a88e706..a8290cf 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 _0xefe6=['register','length','save','remove','update','emit','removeListener'];(function(_0x1021b5,_0x71c972){var _0x3fa0df=function(_0x103ae4){while(--_0x103ae4){_0x1021b5['push'](_0x1021b5['shift']());}};_0x3fa0df(++_0x71c972);}(_0xefe6,0x144));var _0x6efe=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0xefe6[_0x2dd6b1];return _0x494306;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x6efe('0x0'),_0x6efe('0x1'),_0x6efe('0x2')];function createListener(_0x1407c8,_0x453f5f){return function(_0x2a26b4){_0x453f5f[_0x6efe('0x3')](_0x1407c8,_0x2a26b4);};}function removeListener(_0x1a8629,_0x562f0f){return function(){UserProfileEvents[_0x6efe('0x4')](_0x1a8629,_0x562f0f);};}exports[_0x6efe('0x5')]=function(_0x2d3530){for(var _0x25dd14=0x0,_0xb7df64=events[_0x6efe('0x6')];_0x25dd14<_0xb7df64;_0x25dd14++){var _0x4de038=events[_0x25dd14];var _0x55b282=createListener('userProfile:'+_0x4de038,_0x2d3530);UserProfileEvents['on'](_0x4de038,_0x55b282);}}; \ No newline at end of file +var _0x57bc=['length','userProfile:','save','remove','emit','register'];(function(_0x262de4,_0x38f4ef){var _0x46d6ec=function(_0x342e66){while(--_0x342e66){_0x262de4['push'](_0x262de4['shift']());}};_0x46d6ec(++_0x38f4ef);}(_0x57bc,0x6e));var _0xc57b=function(_0x364937,_0x550b55){_0x364937=_0x364937-0x0;var _0x1740ea=_0x57bc[_0x364937];return _0x1740ea;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc57b('0x0'),_0xc57b('0x1'),'update'];function createListener(_0x16c20c,_0x2dadab){return function(_0x48eb2d){_0x2dadab[_0xc57b('0x2')](_0x16c20c,_0x48eb2d);};}function removeListener(_0x3d5b6c,_0x3e6412){return function(){UserProfileEvents['removeListener'](_0x3d5b6c,_0x3e6412);};}exports[_0xc57b('0x3')]=function(_0x504b01){for(var _0x264155=0x0,_0x10603a=events[_0xc57b('0x4')];_0x264155<_0x10603a;_0x264155++){var _0x25175b=events[_0x264155];var _0x40eff4=createListener(_0xc57b('0x5')+_0x25175b,_0x504b01);UserProfileEvents['on'](_0x25175b,_0x40eff4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index db71118..065c3c2 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 _0x0084=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2e505f,_0xee12ca){var _0x43aedd=function(_0x57db39){while(--_0x57db39){_0x2e505f['push'](_0x2e505f['shift']());}};_0x43aedd(++_0xee12ca);}(_0x0084,0x68));var _0x4008=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0x0084[_0x2ece52];return _0x585ea8;};'use strict';var multer=require(_0x4008('0x0'));var util=require(_0x4008('0x1'));var path=require(_0x4008('0x2'));var timeout=require(_0x4008('0x3'));var express=require(_0x4008('0x4'));var router=express['Router']();var fs_extra=require(_0x4008('0x5'));var auth=require(_0x4008('0x6'));var interaction=require(_0x4008('0x7'));var config=require(_0x4008('0x8'));var controller=require(_0x4008('0x9'));router[_0x4008('0xa')]('/',auth['isAuthenticated'](),controller[_0x4008('0xb')]);router[_0x4008('0xa')](_0x4008('0xc'),auth[_0x4008('0xd')](),controller[_0x4008('0xe')]);router[_0x4008('0xa')]('/:id',auth[_0x4008('0xd')](),controller[_0x4008('0xf')]);router['post']('/',auth[_0x4008('0xd')](),controller[_0x4008('0x10')]);router[_0x4008('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4008('0x12')]);router[_0x4008('0x13')](_0x4008('0x14'),auth['isAuthenticated'](),controller[_0x4008('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb395=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','update','delete','destroy','exports','multer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb395,0x71));var _0x5b39=function(_0x50203e,_0x547524){_0x50203e=_0x50203e-0x0;var _0x5f5944=_0xb395[_0x50203e];return _0x5f5944;};'use strict';var multer=require(_0x5b39('0x0'));var util=require(_0x5b39('0x1'));var path=require(_0x5b39('0x2'));var timeout=require(_0x5b39('0x3'));var express=require(_0x5b39('0x4'));var router=express[_0x5b39('0x5')]();var fs_extra=require(_0x5b39('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5b39('0x7'));var config=require(_0x5b39('0x8'));var controller=require(_0x5b39('0x9'));router[_0x5b39('0xa')]('/',auth[_0x5b39('0xb')](),controller[_0x5b39('0xc')]);router[_0x5b39('0xa')](_0x5b39('0xd'),auth[_0x5b39('0xb')](),controller['describe']);router[_0x5b39('0xa')](_0x5b39('0xe'),auth[_0x5b39('0xb')](),controller['show']);router['post']('/',auth[_0x5b39('0xb')](),controller['create']);router['put'](_0x5b39('0xe'),auth['isAuthenticated'](),controller[_0x5b39('0xf')]);router[_0x5b39('0x10')](_0x5b39('0xe'),auth[_0x5b39('0xb')](),controller[_0x5b39('0x11')]);module[_0x5b39('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 07745ab..3dedce5 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 _0x36e8=['STRING','sequelize'];(function(_0x505ef4,_0x4bb0b7){var _0x13da45=function(_0x4c09a5){while(--_0x4c09a5){_0x505ef4['push'](_0x505ef4['shift']());}};_0x13da45(++_0x4bb0b7);}(_0x36e8,0xfb));var _0x836e=function(_0x1ca3d6,_0x312dad){_0x1ca3d6=_0x1ca3d6-0x0;var _0x5d1060=_0x36e8[_0x1ca3d6];return _0x5d1060;};'use strict';var Sequelize=require(_0x836e('0x0'));module['exports']={'name':{'type':Sequelize[_0x836e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x836e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5044=['STRING','INTEGER','sequelize','exports'];(function(_0x9657be,_0x2a7995){var _0x267e2b=function(_0x467c27){while(--_0x467c27){_0x9657be['push'](_0x9657be['shift']());}};_0x267e2b(++_0x2a7995);}(_0x5044,0x1da));var _0x4504=function(_0x5b7cc2,_0x2b4334){_0x5b7cc2=_0x5b7cc2-0x0;var _0x56573e=_0x5044[_0x5b7cc2];return _0x56573e;};'use strict';var Sequelize=require(_0x4504('0x0'));module[_0x4504('0x1')]={'name':{'type':Sequelize[_0x4504('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4504('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4504('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 00f501d..4468064 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 _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','UserProfileResource','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4669d6,_0x1afcc7){_0x4669d6=_0x4669d6-0x0;var _0x44ef97=_0xc6ac[_0x4669d6];return _0x44ef97;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['UserProfileResource'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x5e17b6,_0x3b17f2){var _0x317d37=function(_0x3c29c0){while(--_0x3c29c0){_0x5e17b6['push'](_0x5e17b6['shift']());}};_0x317d37(++_0x3b17f2);}(_0x7096,0x10c));var _0x6709=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7096[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c1fc38d..2bca675 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 _0x8294=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','UserProfileResource'];(function(_0x36de1a,_0x6e814){var _0x50eafe=function(_0x74f49f){while(--_0x74f49f){_0x36de1a['push'](_0x36de1a['shift']());}};_0x50eafe(++_0x6e814);}(_0x8294,0x19a));var _0x4829=function(_0x57e3b8,_0x413555){_0x57e3b8=_0x57e3b8-0x0;var _0x1634b2=_0x8294[_0x57e3b8];return _0x1634b2;};'use strict';var _=require(_0x4829('0x0'));var util=require(_0x4829('0x1'));var logger=require(_0x4829('0x2'))(_0x4829('0x3'));var moment=require('moment');var BPromise=require(_0x4829('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4829('0x5'));var rimraf=require('rimraf');var config=require(_0x4829('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x4829('0x7')]=function(_0x583237,_0x5041fa){return _0x583237[_0x4829('0x8')](_0x4829('0x9'),attributes,{'tableName':_0x4829('0xa'),'paranoid':![],'indexes':[{'name':_0x4829('0xb'),'fields':[_0x4829('0xc'),_0x4829('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a12=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0x3a12,0x9e));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var logger=require(_0x23a1('0x2'))(_0x23a1('0x3'));var moment=require(_0x23a1('0x4'));var BPromise=require(_0x23a1('0x5'));var rp=require(_0x23a1('0x6'));var fs=require('fs');var path=require(_0x23a1('0x7'));var rimraf=require(_0x23a1('0x8'));var config=require(_0x23a1('0x9'));var attributes=require(_0x23a1('0xa'));module[_0x23a1('0xb')]=function(_0xd7d745,_0x26aa5f){return _0xd7d745[_0x23a1('0xc')](_0x23a1('0xd'),attributes,{'tableName':_0x23a1('0xe'),'paranoid':![],'indexes':[{'name':_0x23a1('0xf'),'fields':[_0x23a1('0x10'),_0x23a1('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a9c6504..744b339 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 _0xbb57=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message'];(function(_0x12aa79,_0x11dbf4){var _0x9819d7=function(_0xb215c0){while(--_0xb215c0){_0x12aa79['push'](_0x12aa79['shift']());}};_0x9819d7(++_0x11dbf4);}(_0xbb57,0x105));var _0x7bb5=function(_0x35caf6,_0x2538c8){_0x35caf6=_0x35caf6-0x0;var _0x12eda3=_0xbb57[_0x35caf6];return _0x12eda3;};'use strict';var _=require(_0x7bb5('0x0'));var util=require(_0x7bb5('0x1'));var moment=require(_0x7bb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x7bb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bb5('0x4'))['db'];var utils=require(_0x7bb5('0x5'));var logger=require(_0x7bb5('0x6'))(_0x7bb5('0x7'));var config=require(_0x7bb5('0x8'));var jayson=require(_0x7bb5('0x9'));var client=jayson[_0x7bb5('0xa')][_0x7bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2c15,_0x296f59,_0x48ef01){return new BPromise(function(_0x5ae2df,_0x5506e6){return client[_0x7bb5('0xc')](_0x3e2c15,_0x48ef01)['then'](function(_0x231969){logger[_0x7bb5('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x296f59,_0x7bb5('0xe'));logger['debug'](_0x7bb5('0xf'),_0x296f59,_0x7bb5('0xe'),JSON['stringify'](_0x231969));if(_0x231969['error']){if(_0x231969[_0x7bb5('0x10')]['code']===0x1f4){logger[_0x7bb5('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x296f59,_0x231969['error']['message']);return _0x5506e6(_0x231969[_0x7bb5('0x10')]['message']);}logger['error'](_0x7bb5('0x11'),_0x296f59,_0x231969[_0x7bb5('0x10')]['message']);return _0x5ae2df(_0x231969['error'][_0x7bb5('0x12')]);}else{logger[_0x7bb5('0xd')](_0x7bb5('0x11'),_0x296f59,_0x7bb5('0xe'));_0x5ae2df(_0x231969['result']['message']);}})[_0x7bb5('0x13')](function(_0x3fec6f){logger['error'](_0x7bb5('0x11'),_0x296f59,_0x3fec6f);_0x5506e6(_0x3fec6f);});});} \ No newline at end of file +var _0x2651=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x2651,0x19c));var _0x1265=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x2651[_0x38537f];return _0x141e23;};'use strict';var _=require(_0x1265('0x0'));var util=require(_0x1265('0x1'));var moment=require(_0x1265('0x2'));var BPromise=require('bluebird');var rs=require(_0x1265('0x3'));var fs=require('fs');var Redis=require(_0x1265('0x4'));var db=require(_0x1265('0x5'))['db'];var utils=require(_0x1265('0x6'));var logger=require(_0x1265('0x7'))(_0x1265('0x8'));var config=require(_0x1265('0x9'));var jayson=require(_0x1265('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf9be05,_0x55872b,_0x463e7f){return new BPromise(function(_0x3dc50f,_0x2d5f3a){return client[_0x1265('0xb')](_0xf9be05,_0x463e7f)[_0x1265('0xc')](function(_0x54a958){logger[_0x1265('0xd')](_0x1265('0xe'),_0x55872b,_0x1265('0xf'));logger[_0x1265('0x10')](_0x1265('0x11'),_0x55872b,_0x1265('0xf'),JSON['stringify'](_0x54a958));if(_0x54a958[_0x1265('0x12')]){if(_0x54a958[_0x1265('0x12')][_0x1265('0x13')]===0x1f4){logger['error'](_0x1265('0xe'),_0x55872b,_0x54a958[_0x1265('0x12')][_0x1265('0x14')]);return _0x2d5f3a(_0x54a958[_0x1265('0x12')][_0x1265('0x14')]);}logger[_0x1265('0x12')](_0x1265('0xe'),_0x55872b,_0x54a958[_0x1265('0x12')][_0x1265('0x14')]);return _0x3dc50f(_0x54a958['error'][_0x1265('0x14')]);}else{logger[_0x1265('0xd')](_0x1265('0xe'),_0x55872b,_0x1265('0xf'));_0x3dc50f(_0x54a958[_0x1265('0x15')][_0x1265('0x14')]);}})[_0x1265('0x16')](function(_0x2bceca){logger[_0x1265('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x55872b,_0x2bceca);_0x2d5f3a(_0x2bceca);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 019e511..27ac32f 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 _0x761a=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0x761a,0x1d3));var _0xa761=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0x761a[_0x4ef8bc];return _0x5d4d56;};'use strict';var multer=require(_0xa761('0x0'));var util=require(_0xa761('0x1'));var path=require(_0xa761('0x2'));var timeout=require(_0xa761('0x3'));var express=require(_0xa761('0x4'));var router=express[_0xa761('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa761('0x6'));var interaction=require(_0xa761('0x7'));var config=require(_0xa761('0x8'));var controller=require(_0xa761('0x9'));router[_0xa761('0xa')]('/',auth[_0xa761('0xb')](),controller[_0xa761('0xc')]);router[_0xa761('0xa')](_0xa761('0xd'),auth[_0xa761('0xb')](),controller['describe']);router[_0xa761('0xa')](_0xa761('0xe'),auth['isAuthenticated'](),controller[_0xa761('0xf')]);router[_0xa761('0x10')]('/',auth[_0xa761('0xb')](),controller['create']);router['put'](_0xa761('0xe'),auth[_0xa761('0xb')](),controller[_0xa761('0x11')]);router[_0xa761('0x12')](_0xa761('0xe'),auth['isAuthenticated'](),controller[_0xa761('0x13')]);module[_0xa761('0x14')]=router; \ No newline at end of file +var _0xbb53=['create','put','update','destroy','exports','util','connect-timeout','express','fs-extra','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x5d9bca,_0x28d26f){var _0x22b41b=function(_0x425566){while(--_0x425566){_0x5d9bca['push'](_0x5d9bca['shift']());}};_0x22b41b(++_0x28d26f);}(_0xbb53,0x126));var _0x3bb5=function(_0x3dc0af,_0x276349){_0x3dc0af=_0x3dc0af-0x0;var _0x1aa258=_0xbb53[_0x3dc0af];return _0x1aa258;};'use strict';var multer=require('multer');var util=require(_0x3bb5('0x0'));var path=require('path');var timeout=require(_0x3bb5('0x1'));var express=require(_0x3bb5('0x2'));var router=express['Router']();var fs_extra=require(_0x3bb5('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3bb5('0x4'));router[_0x3bb5('0x5')]('/',auth['isAuthenticated'](),controller[_0x3bb5('0x6')]);router[_0x3bb5('0x5')](_0x3bb5('0x7'),auth[_0x3bb5('0x8')](),controller[_0x3bb5('0x9')]);router[_0x3bb5('0x5')](_0x3bb5('0xa'),auth['isAuthenticated'](),controller[_0x3bb5('0xb')]);router['post']('/',auth[_0x3bb5('0x8')](),controller[_0x3bb5('0xc')]);router[_0x3bb5('0xd')](_0x3bb5('0xa'),auth[_0x3bb5('0x8')](),controller[_0x3bb5('0xe')]);router['delete']('/:id',auth[_0x3bb5('0x8')](),controller[_0x3bb5('0xf')]);module[_0x3bb5('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 62b4cec..1d1f007 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 _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xccb2fc,_0x55cbd9){_0xccb2fc=_0xccb2fc-0x0;var _0x47d127=_0xd4f4[_0xccb2fc];return _0x47d127;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file +var _0x2547=['BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x4a6cbb,_0x4d21be){var _0x562d6f=function(_0x2c3644){while(--_0x2c3644){_0x4a6cbb['push'](_0x4a6cbb['shift']());}};_0x562d6f(++_0x4d21be);}(_0x2547,0x1cd));var _0x7254=function(_0x24c492,_0x14f22a){_0x24c492=_0x24c492-0x0;var _0x4d4bd7=_0x2547[_0x24c492];return _0x4d4bd7;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'name':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7254('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7254('0x1')],'set':function(_0x265ebf){this['setDataValue'](_0x7254('0x4'),_0x265ebf?_0x265ebf[_0x7254('0x5')](''):[]);},'get':function(){return this[_0x7254('0x6')](_0x7254('0x4'))?this['getDataValue'](_0x7254('0x4'))[_0x7254('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b86cfba..a0ce114 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 _0xc654=['sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','name','index','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc654,0x131));var _0x4c65=function(_0x2e79dd,_0x59fcaf){_0x2e79dd=_0x2e79dd-0x0;var _0x113a76=_0xc654[_0x2e79dd];return _0x113a76;};'use strict';var emlformat=require(_0x4c65('0x0'));var rimraf=require(_0x4c65('0x1'));var zipdir=require(_0x4c65('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c65('0x3'));var Mustache=require(_0x4c65('0x4'));var util=require('util');var path=require(_0x4c65('0x5'));var sox=require('sox');var csv=require(_0x4c65('0x6'));var ejs=require(_0x4c65('0x7'));var fs=require('fs');var fs_extra=require(_0x4c65('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c65('0x9'));var jsforce=require(_0x4c65('0xa'));var deskjs=require(_0x4c65('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c65('0xc'));var Redis=require(_0x4c65('0xd'));var authService=require(_0x4c65('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4c65('0xf'));var hardwareService=require(_0x4c65('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4c65('0x11'));var config=require(_0x4c65('0x12'));var licenseUtil=require(_0x4c65('0x13'));var db=require(_0x4c65('0x14'))['db'];function respondWithStatusCode(_0xbfc9df,_0x4dbd38){_0x4dbd38=_0x4dbd38||0xcc;return function(_0x1d7315){if(_0x1d7315){return _0xbfc9df[_0x4c65('0x15')](_0x4dbd38);}return _0xbfc9df['status'](_0x4dbd38)[_0x4c65('0x16')]();};}function respondWithResult(_0x9884d2,_0x1c9952){_0x1c9952=_0x1c9952||0xc8;return function(_0x48c5af){if(_0x48c5af){return _0x9884d2['status'](_0x1c9952)[_0x4c65('0x17')](_0x48c5af);}};}function respondWithFilteredResult(_0x4c817f,_0x5242ee){return function(_0x398893){if(_0x398893){var _0x2a81e4=typeof _0x5242ee[_0x4c65('0x18')]===_0x4c65('0x19')&&typeof _0x5242ee[_0x4c65('0x1a')]===_0x4c65('0x19');var _0x32d68f=_0x398893['count'];var _0x5ed7f1=_0x2a81e4?0x0:_0x5242ee[_0x4c65('0x18')];var _0x10e2b=_0x2a81e4?_0x398893[_0x4c65('0x1b')]:_0x5242ee[_0x4c65('0x18')]+_0x5242ee[_0x4c65('0x1a')];var _0x2c989a;if(_0x10e2b>=_0x32d68f){_0x10e2b=_0x32d68f;_0x2c989a=0xc8;}else{_0x2c989a=0xce;}_0x4c817f[_0x4c65('0x1c')](_0x2c989a);return _0x4c817f['set'](_0x4c65('0x1d'),_0x5ed7f1+'-'+_0x10e2b+'/'+_0x32d68f)['json'](_0x398893);}return null;};}function patchUpdates(_0x201f5c){return function(_0x5b5c94){try{jsonpatch[_0x4c65('0x1e')](_0x5b5c94,_0x201f5c,!![]);}catch(_0x21eccc){return BPromise[_0x4c65('0x1f')](_0x21eccc);}return _0x5b5c94[_0x4c65('0x20')]();};}function saveUpdates(_0x2a4a53,_0x3a9189){return function(_0x4a401c){if(_0x4a401c){return _0x4a401c[_0x4c65('0x21')](_0x2a4a53)[_0x4c65('0x22')](function(_0x45a6a8){return _0x45a6a8;});}return null;};}function removeEntity(_0xca52b5,_0x304d8b){return function(_0x398f0c){if(_0x398f0c){return _0x398f0c['destroy']()[_0x4c65('0x22')](function(){_0xca52b5['status'](0xcc)[_0x4c65('0x16')]();});}};}function handleEntityNotFound(_0x120811,_0xfc0d47){return function(_0x10058b){if(!_0x10058b){_0x120811[_0x4c65('0x15')](0x194);}return _0x10058b;};}function handleError(_0x521c0d,_0x1c07a6){_0x1c07a6=_0x1c07a6||0x1f4;return function(_0xefd836){logger[_0x4c65('0x23')](_0xefd836['stack']);if(_0xefd836['name']){delete _0xefd836[_0x4c65('0x24')];}_0x521c0d['status'](_0x1c07a6)['send'](_0xefd836);};}exports[_0x4c65('0x25')]=function(_0x170fbc,_0x3c44d8){var _0x32ec46={},_0x3bdf19={},_0x43899c={'count':0x0,'rows':[]};var _0x464c8f=_['map'](db[_0x4c65('0x26')][_0x4c65('0x27')],function(_0x30e12e){return{'name':_0x30e12e[_0x4c65('0x28')],'type':_0x30e12e[_0x4c65('0x29')]['key']};});_0x3bdf19[_0x4c65('0x2a')]=_['map'](_0x464c8f,'name');_0x3bdf19[_0x4c65('0x2b')]=_['keys'](_0x170fbc[_0x4c65('0x2b')]);_0x3bdf19[_0x4c65('0x2c')]=_['intersection'](_0x3bdf19[_0x4c65('0x2a')],_0x3bdf19['query']);_0x32ec46[_0x4c65('0x2d')]=_['intersection'](_0x3bdf19[_0x4c65('0x2a')],qs[_0x4c65('0x2e')](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x2e')]));_0x32ec46[_0x4c65('0x2d')]=_0x32ec46['attributes'][_0x4c65('0x2f')]?_0x32ec46[_0x4c65('0x2d')]:_0x3bdf19['model'];if(!_0x170fbc['query'][_0x4c65('0x30')](_0x4c65('0x31'))){_0x32ec46[_0x4c65('0x1a')]=qs['limit'](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x1a')]);_0x32ec46[_0x4c65('0x18')]=qs[_0x4c65('0x18')](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x18')]);}_0x32ec46['order']=qs['sort'](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x32')]);_0x32ec46[_0x4c65('0x33')]=qs['filters'](_[_0x4c65('0x34')](_0x170fbc[_0x4c65('0x2b')],_0x3bdf19[_0x4c65('0x2c')]),_0x464c8f);if(_0x170fbc[_0x4c65('0x2b')]['filter']){_0x32ec46[_0x4c65('0x33')]=_[_0x4c65('0x35')](_0x32ec46['where'],{'$or':_[_0x4c65('0x36')](_0x464c8f,function(_0x1a33b5){if(_0x1a33b5['type']!==_0x4c65('0x37')){var _0x1c101a={};_0x1c101a[_0x1a33b5[_0x4c65('0x24')]]={'$like':'%'+_0x170fbc['query'][_0x4c65('0x38')]+'%'};return _0x1c101a;}})});}_0x32ec46=_[_0x4c65('0x35')]({},_0x32ec46,_0x170fbc[_0x4c65('0x39')]);var _0x105f78={'where':_0x32ec46[_0x4c65('0x33')]};return db['UserProfileSection'][_0x4c65('0x1b')](_0x105f78)[_0x4c65('0x22')](function(_0x61780){_0x43899c['count']=_0x61780;if(_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x3a')]){_0x32ec46['include']=[{'all':!![]}];}return db[_0x4c65('0x26')][_0x4c65('0x3b')](_0x32ec46);})[_0x4c65('0x22')](function(_0x5f0d0f){_0x43899c[_0x4c65('0x3c')]=_0x5f0d0f;return _0x43899c;})[_0x4c65('0x22')](respondWithFilteredResult(_0x3c44d8,_0x32ec46))[_0x4c65('0x3d')](handleError(_0x3c44d8,null));};exports[_0x4c65('0x3e')]=function(_0x418005,_0x1755a0){var _0x1bcc91={'raw':![],'where':{'id':_0x418005[_0x4c65('0x3f')]['id']}},_0x80d5de={};_0x80d5de[_0x4c65('0x2a')]=_[_0x4c65('0x40')](db[_0x4c65('0x26')][_0x4c65('0x27')]);_0x80d5de['query']=_[_0x4c65('0x40')](_0x418005[_0x4c65('0x2b')]);_0x80d5de[_0x4c65('0x2c')]=_['intersection'](_0x80d5de['model'],_0x80d5de[_0x4c65('0x2b')]);_0x1bcc91[_0x4c65('0x2d')]=_[_0x4c65('0x41')](_0x80d5de[_0x4c65('0x2a')],qs[_0x4c65('0x2e')](_0x418005['query']['fields']));_0x1bcc91['attributes']=_0x1bcc91[_0x4c65('0x2d')]['length']?_0x1bcc91['attributes']:_0x80d5de[_0x4c65('0x2a')];if(_0x418005['query']['includeAll']){_0x1bcc91[_0x4c65('0x42')]=[{'all':!![]}];}_0x1bcc91=_[_0x4c65('0x35')]({},_0x1bcc91,_0x418005['options']);return db[_0x4c65('0x26')][_0x4c65('0x43')](_0x1bcc91)[_0x4c65('0x22')](handleEntityNotFound(_0x1755a0,null))['then'](respondWithResult(_0x1755a0,null))['catch'](handleError(_0x1755a0,null));};exports[_0x4c65('0x44')]=function(_0x56f2e8,_0x5c0808){return db[_0x4c65('0x26')][_0x4c65('0x44')](_0x56f2e8[_0x4c65('0x45')],{})[_0x4c65('0x22')](respondWithResult(_0x5c0808,0xc9))[_0x4c65('0x3d')](handleError(_0x5c0808,null));};exports['update']=function(_0x49f316,_0x59a78b){if(_0x49f316[_0x4c65('0x45')]['id']){delete _0x49f316[_0x4c65('0x45')]['id'];}return db[_0x4c65('0x26')]['find']({'where':{'id':_0x49f316[_0x4c65('0x3f')]['id']}})[_0x4c65('0x22')](handleEntityNotFound(_0x59a78b,null))['then'](saveUpdates(_0x49f316[_0x4c65('0x45')],null))[_0x4c65('0x22')](respondWithResult(_0x59a78b,null))['catch'](handleError(_0x59a78b,null));};exports[_0x4c65('0x46')]=function(_0xd40bc6,_0x2070e7){return db['UserProfileSection'][_0x4c65('0x43')]({'where':{'id':_0xd40bc6[_0x4c65('0x3f')]['id']}})[_0x4c65('0x22')](handleEntityNotFound(_0x2070e7,null))[_0x4c65('0x22')](removeEntity(_0x2070e7,null))['catch'](handleError(_0x2070e7,null));};exports['describe']=function(_0x59ad40,_0x1242b9){return db[_0x4c65('0x26')]['describe']()[_0x4c65('0x22')](respondWithResult(_0x1242b9,null))[_0x4c65('0x3d')](handleError(_0x1242b9,null));}; \ No newline at end of file +var _0xc5c6=['rows','show','params','keys','length','catch','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0xc5c6,0xf7));var _0x6c5c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xc5c6[_0x411017];return _0x2adeea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c5c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c5c('0x1'));var rp=require(_0x6c5c('0x2'));var moment=require(_0x6c5c('0x3'));var BPromise=require(_0x6c5c('0x4'));var Mustache=require(_0x6c5c('0x5'));var util=require(_0x6c5c('0x6'));var path=require(_0x6c5c('0x7'));var sox=require(_0x6c5c('0x8'));var csv=require(_0x6c5c('0x9'));var ejs=require(_0x6c5c('0xa'));var fs=require('fs');var fs_extra=require(_0x6c5c('0xb'));var _=require(_0x6c5c('0xc'));var squel=require(_0x6c5c('0xd'));var crypto=require(_0x6c5c('0xe'));var jsforce=require(_0x6c5c('0xf'));var deskjs=require(_0x6c5c('0x10'));var toCsv=require(_0x6c5c('0x9'));var querystring=require('querystring');var Papa=require(_0x6c5c('0x11'));var Redis=require(_0x6c5c('0x12'));var authService=require(_0x6c5c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c5c('0x14'));var hardwareService=require(_0x6c5c('0x15'));var logger=require('../../config/logger')(_0x6c5c('0x16'));var utils=require('../../config/utils');var config=require(_0x6c5c('0x17'));var licenseUtil=require(_0x6c5c('0x18'));var db=require(_0x6c5c('0x19'))['db'];function respondWithStatusCode(_0x3ab851,_0xbc77f0){_0xbc77f0=_0xbc77f0||0xcc;return function(_0x39626c){if(_0x39626c){return _0x3ab851[_0x6c5c('0x1a')](_0xbc77f0);}return _0x3ab851[_0x6c5c('0x1b')](_0xbc77f0)[_0x6c5c('0x1c')]();};}function respondWithResult(_0x4f2fae,_0x1bbbae){_0x1bbbae=_0x1bbbae||0xc8;return function(_0x4004e0){if(_0x4004e0){return _0x4f2fae['status'](_0x1bbbae)['json'](_0x4004e0);}};}function respondWithFilteredResult(_0x113941,_0x5087c5){return function(_0x3dc8cb){if(_0x3dc8cb){var _0x5acddd=typeof _0x5087c5[_0x6c5c('0x1d')]==='undefined'&&typeof _0x5087c5[_0x6c5c('0x1e')]==='undefined';var _0x19965f=_0x3dc8cb[_0x6c5c('0x1f')];var _0x334514=_0x5acddd?0x0:_0x5087c5['offset'];var _0x4e0545=_0x5acddd?_0x3dc8cb[_0x6c5c('0x1f')]:_0x5087c5[_0x6c5c('0x1d')]+_0x5087c5[_0x6c5c('0x1e')];var _0x4bbda6;if(_0x4e0545>=_0x19965f){_0x4e0545=_0x19965f;_0x4bbda6=0xc8;}else{_0x4bbda6=0xce;}_0x113941[_0x6c5c('0x1b')](_0x4bbda6);return _0x113941[_0x6c5c('0x20')](_0x6c5c('0x21'),_0x334514+'-'+_0x4e0545+'/'+_0x19965f)[_0x6c5c('0x22')](_0x3dc8cb);}return null;};}function patchUpdates(_0x15f3d1){return function(_0x241c32){try{jsonpatch[_0x6c5c('0x23')](_0x241c32,_0x15f3d1,!![]);}catch(_0x3ea81a){return BPromise[_0x6c5c('0x24')](_0x3ea81a);}return _0x241c32[_0x6c5c('0x25')]();};}function saveUpdates(_0x1dc2aa,_0x225b36){return function(_0xbd4fd8){if(_0xbd4fd8){return _0xbd4fd8[_0x6c5c('0x26')](_0x1dc2aa)['then'](function(_0x5458ff){return _0x5458ff;});}return null;};}function removeEntity(_0x7707cc,_0x111aef){return function(_0x1419c8){if(_0x1419c8){return _0x1419c8[_0x6c5c('0x27')]()[_0x6c5c('0x28')](function(){_0x7707cc['status'](0xcc)[_0x6c5c('0x1c')]();});}};}function handleEntityNotFound(_0x38aea0,_0x4b1bb9){return function(_0xa04c77){if(!_0xa04c77){_0x38aea0['sendStatus'](0x194);}return _0xa04c77;};}function handleError(_0x4de290,_0x35b846){_0x35b846=_0x35b846||0x1f4;return function(_0x19c089){logger[_0x6c5c('0x29')](_0x19c089[_0x6c5c('0x2a')]);if(_0x19c089[_0x6c5c('0x2b')]){delete _0x19c089['name'];}_0x4de290['status'](_0x35b846)[_0x6c5c('0x2c')](_0x19c089);};}exports[_0x6c5c('0x2d')]=function(_0x32cf5c,_0xa136dc){var _0x5999fa={},_0x9cd51b={},_0x33303a={'count':0x0,'rows':[]};var _0x2fbaf5=_[_0x6c5c('0x2e')](db[_0x6c5c('0x2f')][_0x6c5c('0x30')],function(_0x2f7fb9){return{'name':_0x2f7fb9['fieldName'],'type':_0x2f7fb9[_0x6c5c('0x31')][_0x6c5c('0x32')]};});_0x9cd51b['model']=_[_0x6c5c('0x2e')](_0x2fbaf5,_0x6c5c('0x2b'));_0x9cd51b[_0x6c5c('0x33')]=_['keys'](_0x32cf5c[_0x6c5c('0x33')]);_0x9cd51b[_0x6c5c('0x34')]=_[_0x6c5c('0x35')](_0x9cd51b[_0x6c5c('0x36')],_0x9cd51b[_0x6c5c('0x33')]);_0x5999fa['attributes']=_[_0x6c5c('0x35')](_0x9cd51b[_0x6c5c('0x36')],qs[_0x6c5c('0x37')](_0x32cf5c['query']['fields']));_0x5999fa[_0x6c5c('0x38')]=_0x5999fa[_0x6c5c('0x38')]['length']?_0x5999fa[_0x6c5c('0x38')]:_0x9cd51b[_0x6c5c('0x36')];if(!_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x39')]('nolimit')){_0x5999fa[_0x6c5c('0x1e')]=qs[_0x6c5c('0x1e')](_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x1e')]);_0x5999fa[_0x6c5c('0x1d')]=qs[_0x6c5c('0x1d')](_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x1d')]);}_0x5999fa[_0x6c5c('0x3a')]=qs['sort'](_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x3b')]);_0x5999fa['where']=qs[_0x6c5c('0x34')](_[_0x6c5c('0x3c')](_0x32cf5c['query'],_0x9cd51b[_0x6c5c('0x34')]),_0x2fbaf5);if(_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x3d')]){_0x5999fa[_0x6c5c('0x3e')]=_[_0x6c5c('0x3f')](_0x5999fa[_0x6c5c('0x3e')],{'$or':_[_0x6c5c('0x2e')](_0x2fbaf5,function(_0x3a8ea5){if(_0x3a8ea5['type']!==_0x6c5c('0x40')){var _0x5d2105={};_0x5d2105[_0x3a8ea5[_0x6c5c('0x2b')]]={'$like':'%'+_0x32cf5c[_0x6c5c('0x33')][_0x6c5c('0x3d')]+'%'};return _0x5d2105;}})});}_0x5999fa=_[_0x6c5c('0x3f')]({},_0x5999fa,_0x32cf5c[_0x6c5c('0x41')]);var _0x577582={'where':_0x5999fa['where']};return db[_0x6c5c('0x2f')][_0x6c5c('0x1f')](_0x577582)[_0x6c5c('0x28')](function(_0x2ae3b6){_0x33303a[_0x6c5c('0x1f')]=_0x2ae3b6;if(_0x32cf5c['query'][_0x6c5c('0x42')]){_0x5999fa[_0x6c5c('0x43')]=[{'all':!![]}];}return db[_0x6c5c('0x2f')][_0x6c5c('0x44')](_0x5999fa);})[_0x6c5c('0x28')](function(_0x548775){_0x33303a[_0x6c5c('0x45')]=_0x548775;return _0x33303a;})[_0x6c5c('0x28')](respondWithFilteredResult(_0xa136dc,_0x5999fa))['catch'](handleError(_0xa136dc,null));};exports[_0x6c5c('0x46')]=function(_0x3707e1,_0x28acd3){var _0x4f6cd8={'raw':![],'where':{'id':_0x3707e1[_0x6c5c('0x47')]['id']}},_0x2699fb={};_0x2699fb[_0x6c5c('0x36')]=_[_0x6c5c('0x48')](db[_0x6c5c('0x2f')]['rawAttributes']);_0x2699fb['query']=_['keys'](_0x3707e1['query']);_0x2699fb['filters']=_[_0x6c5c('0x35')](_0x2699fb[_0x6c5c('0x36')],_0x2699fb[_0x6c5c('0x33')]);_0x4f6cd8[_0x6c5c('0x38')]=_[_0x6c5c('0x35')](_0x2699fb[_0x6c5c('0x36')],qs['fields'](_0x3707e1[_0x6c5c('0x33')][_0x6c5c('0x37')]));_0x4f6cd8[_0x6c5c('0x38')]=_0x4f6cd8['attributes'][_0x6c5c('0x49')]?_0x4f6cd8['attributes']:_0x2699fb[_0x6c5c('0x36')];if(_0x3707e1[_0x6c5c('0x33')][_0x6c5c('0x42')]){_0x4f6cd8[_0x6c5c('0x43')]=[{'all':!![]}];}_0x4f6cd8=_[_0x6c5c('0x3f')]({},_0x4f6cd8,_0x3707e1[_0x6c5c('0x41')]);return db[_0x6c5c('0x2f')]['find'](_0x4f6cd8)[_0x6c5c('0x28')](handleEntityNotFound(_0x28acd3,null))[_0x6c5c('0x28')](respondWithResult(_0x28acd3,null))[_0x6c5c('0x4a')](handleError(_0x28acd3,null));};exports['create']=function(_0x279a32,_0x382a92){return db[_0x6c5c('0x2f')][_0x6c5c('0x4b')](_0x279a32[_0x6c5c('0x4c')],{})[_0x6c5c('0x28')](respondWithResult(_0x382a92,0xc9))[_0x6c5c('0x4a')](handleError(_0x382a92,null));};exports[_0x6c5c('0x26')]=function(_0x440ac7,_0x4b1f0c){if(_0x440ac7[_0x6c5c('0x4c')]['id']){delete _0x440ac7[_0x6c5c('0x4c')]['id'];}return db[_0x6c5c('0x2f')][_0x6c5c('0x4d')]({'where':{'id':_0x440ac7[_0x6c5c('0x47')]['id']}})[_0x6c5c('0x28')](handleEntityNotFound(_0x4b1f0c,null))[_0x6c5c('0x28')](saveUpdates(_0x440ac7[_0x6c5c('0x4c')],null))[_0x6c5c('0x28')](respondWithResult(_0x4b1f0c,null))[_0x6c5c('0x4a')](handleError(_0x4b1f0c,null));};exports[_0x6c5c('0x27')]=function(_0x1a86aa,_0x397f1f){return db['UserProfileSection'][_0x6c5c('0x4d')]({'where':{'id':_0x1a86aa[_0x6c5c('0x47')]['id']}})[_0x6c5c('0x28')](handleEntityNotFound(_0x397f1f,null))[_0x6c5c('0x28')](removeEntity(_0x397f1f,null))['catch'](handleError(_0x397f1f,null));};exports[_0x6c5c('0x4e')]=function(_0x3c8584,_0x4514a){return db[_0x6c5c('0x2f')][_0x6c5c('0x4e')]()['then'](respondWithResult(_0x4514a,null))[_0x6c5c('0x4a')](handleError(_0x4514a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fef666e..e62d1db 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 _0xc871=['exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc871,0x164));var _0x1c87=function(_0x3c0083,_0x76a45a){_0x3c0083=_0x3c0083-0x0;var _0x362617=_0xc871[_0x3c0083];return _0x362617;};'use strict';var _=require(_0x1c87('0x0'));var util=require(_0x1c87('0x1'));var logger=require(_0x1c87('0x2'))('api');var moment=require(_0x1c87('0x3'));var BPromise=require(_0x1c87('0x4'));var rp=require(_0x1c87('0x5'));var fs=require('fs');var path=require(_0x1c87('0x6'));var rimraf=require('rimraf');var config=require(_0x1c87('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x1c87('0x8')]=function(_0x18bc77,_0x1e24cb){return _0x18bc77['define'](_0x1c87('0x9'),attributes,{'tableName':_0x1c87('0xa'),'paranoid':![],'indexes':[{'name':_0x1c87('0xb'),'fields':[_0x1c87('0xc'),_0x1c87('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe9e=['path','rimraf','UserProfileSection','compositeIndex','userProfileId','lodash','util','api','bluebird','request-promise'];(function(_0x57e239,_0x19e557){var _0x57025b=function(_0x33d16e){while(--_0x33d16e){_0x57e239['push'](_0x57e239['shift']());}};_0x57025b(++_0x19e557);}(_0xbe9e,0x11d));var _0xebe9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbe9e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xebe9('0x0'));var util=require(_0xebe9('0x1'));var logger=require('../../config/logger')(_0xebe9('0x2'));var moment=require('moment');var BPromise=require(_0xebe9('0x3'));var rp=require(_0xebe9('0x4'));var fs=require('fs');var path=require(_0xebe9('0x5'));var rimraf=require(_0xebe9('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x530f66,_0x2ca911){return _0x530f66['define'](_0xebe9('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xebe9('0x8'),'fields':['sectionId',_0xebe9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0f245d1..d8ce25c 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 _0xb55c=['request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x7f0c96,_0x2f5107){var _0x2afa3f=function(_0x3e3709){while(--_0x3e3709){_0x7f0c96['push'](_0x7f0c96['shift']());}};_0x2afa3f(++_0x2f5107);}(_0xb55c,0x187));var _0xcb55=function(_0x10413d,_0x39ceb2){_0x10413d=_0x10413d-0x0;var _0x26c937=_0xb55c[_0x10413d];return _0x26c937;};'use strict';var _=require(_0xcb55('0x0'));var util=require(_0xcb55('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb55('0x2'));var fs=require('fs');var Redis=require(_0xcb55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb55('0x4'));var logger=require(_0xcb55('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb55('0x6')][_0xcb55('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e38d5,_0x265280,_0x50ccb9){return new BPromise(function(_0xda320a,_0x58a244){return client[_0xcb55('0x8')](_0x4e38d5,_0x50ccb9)[_0xcb55('0x9')](function(_0x31f383){logger['info'](_0xcb55('0xa'),_0x265280,_0xcb55('0xb'));logger['debug'](_0xcb55('0xc'),_0x265280,'request\x20sent',JSON['stringify'](_0x31f383));if(_0x31f383[_0xcb55('0xd')]){if(_0x31f383['error'][_0xcb55('0xe')]===0x1f4){logger[_0xcb55('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x265280,_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);return _0x58a244(_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);}logger[_0xcb55('0xd')](_0xcb55('0xa'),_0x265280,_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);return _0xda320a(_0x31f383[_0xcb55('0xd')]['message']);}else{logger[_0xcb55('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x265280,'request\x20sent');_0xda320a(_0x31f383[_0xcb55('0x11')]['message']);}})[_0xcb55('0x12')](function(_0x263aa2){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x265280,_0x263aa2);_0x58a244(_0x263aa2);});});} \ No newline at end of file +var _0x8d88=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x11860e,_0x38e69f){var _0x3a49fc=function(_0x511907){while(--_0x511907){_0x11860e['push'](_0x11860e['shift']());}};_0x3a49fc(++_0x38e69f);}(_0x8d88,0x1be));var _0x88d8=function(_0x3ad133,_0x377068){_0x3ad133=_0x3ad133-0x0;var _0x33b86a=_0x8d88[_0x3ad133];return _0x33b86a;};'use strict';var _=require(_0x88d8('0x0'));var util=require(_0x88d8('0x1'));var moment=require(_0x88d8('0x2'));var BPromise=require(_0x88d8('0x3'));var rs=require(_0x88d8('0x4'));var fs=require('fs');var Redis=require(_0x88d8('0x5'));var db=require(_0x88d8('0x6'))['db'];var utils=require(_0x88d8('0x7'));var logger=require(_0x88d8('0x8'))(_0x88d8('0x9'));var config=require(_0x88d8('0xa'));var jayson=require(_0x88d8('0xb'));var client=jayson[_0x88d8('0xc')][_0x88d8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x53b9c9,_0x4e9836,_0x508641){return new BPromise(function(_0x2aa2f3,_0x595b73){return client[_0x88d8('0xe')](_0x53b9c9,_0x508641)[_0x88d8('0xf')](function(_0x46e060){logger[_0x88d8('0x10')](_0x88d8('0x11'),_0x4e9836,_0x88d8('0x12'));logger[_0x88d8('0x13')](_0x88d8('0x14'),_0x4e9836,_0x88d8('0x12'),JSON['stringify'](_0x46e060));if(_0x46e060[_0x88d8('0x15')]){if(_0x46e060['error'][_0x88d8('0x16')]===0x1f4){logger[_0x88d8('0x15')](_0x88d8('0x11'),_0x4e9836,_0x46e060['error'][_0x88d8('0x17')]);return _0x595b73(_0x46e060[_0x88d8('0x15')][_0x88d8('0x17')]);}logger[_0x88d8('0x15')](_0x88d8('0x11'),_0x4e9836,_0x46e060['error'][_0x88d8('0x17')]);return _0x2aa2f3(_0x46e060['error'][_0x88d8('0x17')]);}else{logger[_0x88d8('0x10')](_0x88d8('0x11'),_0x4e9836,_0x88d8('0x12'));_0x2aa2f3(_0x46e060[_0x88d8('0x18')]['message']);}})['catch'](function(_0x115f7b){logger[_0x88d8('0x15')](_0x88d8('0x11'),_0x4e9836,_0x115f7b);_0x595b73(_0x115f7b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c2a157f..f3451e4 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5cf516,_0x407555){var _0x55d480=function(_0x46f364){while(--_0x46f364){_0x5cf516['push'](_0x5cf516['shift']());}};_0x55d480(++_0x407555);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb91[_0x35e75a];return _0xb23c7f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x40c281,_0x48018b){var _0x350b73=function(_0x55dfc2){while(--_0x55dfc2){_0x40c281['push'](_0x40c281['shift']());}};_0x350b73(++_0x48018b);}(_0x70e0,0x17b));var _0x070e=function(_0x240ed0,_0x476512){_0x240ed0=_0x240ed0-0x0;var _0xc08f71=_0x70e0[_0x240ed0];return _0xc08f71;};'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 fbd0059..3fa58a5 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 _0xf23c=['INTEGER'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf23c,0x113));var _0xcf23=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xf23c[_0x4a8bad];return _0x30cf32;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xcf23('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb646=['exports','INTEGER','sequelize'];(function(_0x4a010b,_0x3523b3){var _0xe0b19b=function(_0x68b0bb){while(--_0x68b0bb){_0x4a010b['push'](_0x4a010b['shift']());}};_0xe0b19b(++_0x3523b3);}(_0xb646,0x83));var _0x6b64=function(_0x343bd9,_0x5691e8){_0x343bd9=_0x343bd9-0x0;var _0x573c69=_0xb646[_0x343bd9];return _0x573c69;};'use strict';var Sequelize=require(_0x6b64('0x0'));module[_0x6b64('0x1')]={'penalty':{'type':Sequelize[_0x6b64('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 e965783..87fe4bc 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 _0xb7de=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','exports'];(function(_0x5670b2,_0x247622){var _0x287d48=function(_0x142573){while(--_0x142573){_0x5670b2['push'](_0x5670b2['shift']());}};_0x287d48(++_0x247622);}(_0xb7de,0xc7));var _0xeb7d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb7de[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var logger=require(_0xeb7d('0x2'))('api');var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var rp=require(_0xeb7d('0x5'));var fs=require('fs');var path=require(_0xeb7d('0x6'));var rimraf=require(_0xeb7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7d('0x8'));module[_0xeb7d('0x9')]=function(_0xadf4,_0x433c32){return _0xadf4[_0xeb7d('0xa')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x118a26,_0x3326bb){var _0x1624c1=function(_0x242089){while(--_0x242089){_0x118a26['push'](_0x118a26['shift']());}};_0x1624c1(++_0x3326bb);}(_0x4bd3,0x174));var _0x34bd=function(_0x407883,_0x10a193){_0x407883=_0x407883-0x0;var _0x402503=_0x4bd3[_0x407883];return _0x402503;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('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 920fc0b..bbbc161 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 _0x4829=['../../config/logger','rpc','jayson/promise','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xbd703,_0x3253a6){var _0x12d984=function(_0x5b47f1){while(--_0x5b47f1){_0xbd703['push'](_0xbd703['shift']());}};_0x12d984(++_0x3253a6);}(_0x4829,0xbf));var _0x9482=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4829[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9482('0x0'));var util=require(_0x9482('0x1'));var moment=require(_0x9482('0x2'));var BPromise=require('bluebird');var rs=require(_0x9482('0x3'));var fs=require('fs');var Redis=require(_0x9482('0x4'));var db=require(_0x9482('0x5'))['db'];var utils=require(_0x9482('0x6'));var logger=require(_0x9482('0x7'))(_0x9482('0x8'));var config=require('../../config/environment');var jayson=require(_0x9482('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358381,_0x14cc7a,_0xb5b5df){return new BPromise(function(_0x373203,_0x3838d0){return client[_0x9482('0xa')](_0x358381,_0xb5b5df)[_0x9482('0xb')](function(_0x80b8f7){logger['info'](_0x9482('0xc'),_0x14cc7a,_0x9482('0xd'));logger[_0x9482('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14cc7a,_0x9482('0xd'),JSON[_0x9482('0xf')](_0x80b8f7));if(_0x80b8f7['error']){if(_0x80b8f7[_0x9482('0x10')][_0x9482('0x11')]===0x1f4){logger[_0x9482('0x10')](_0x9482('0xc'),_0x14cc7a,_0x80b8f7[_0x9482('0x10')]['message']);return _0x3838d0(_0x80b8f7[_0x9482('0x10')][_0x9482('0x12')]);}logger['error'](_0x9482('0xc'),_0x14cc7a,_0x80b8f7[_0x9482('0x10')]['message']);return _0x373203(_0x80b8f7[_0x9482('0x10')][_0x9482('0x12')]);}else{logger[_0x9482('0x13')](_0x9482('0xc'),_0x14cc7a,_0x9482('0xd'));_0x373203(_0x80b8f7[_0x9482('0x14')]['message']);}})[_0x9482('0x15')](function(_0x16b33b){logger[_0x9482('0x10')](_0x9482('0xc'),_0x14cc7a,_0x16b33b);_0x3838d0(_0x16b33b);});});} \ No newline at end of file +var _0xe9f5=['jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','message','error','result','catch','util','bluebird','../../config/utils','../../config/environment'];(function(_0x11315f,_0x4eabdd){var _0xb4c69c=function(_0x2773ea){while(--_0x2773ea){_0x11315f['push'](_0x11315f['shift']());}};_0xb4c69c(++_0x4eabdd);}(_0xe9f5,0x1a5));var _0x5e9f=function(_0xc74e59,_0xdec86b){_0xc74e59=_0xc74e59-0x0;var _0x125171=_0xe9f5[_0xc74e59];return _0x125171;};'use strict';var _=require('lodash');var util=require(_0x5e9f('0x0'));var moment=require('moment');var BPromise=require(_0x5e9f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e9f('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5e9f('0x3'));var jayson=require(_0x5e9f('0x4'));var client=jayson[_0x5e9f('0x5')][_0x5e9f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x225d44,_0x4b61db,_0xc332f9){return new BPromise(function(_0x2a2742,_0x2d0c43){return client[_0x5e9f('0x7')](_0x225d44,_0xc332f9)['then'](function(_0xe8eba3){logger[_0x5e9f('0x8')](_0x5e9f('0x9'),_0x4b61db,_0x5e9f('0xa'));logger[_0x5e9f('0xb')](_0x5e9f('0xc'),_0x4b61db,'request\x20sent',JSON['stringify'](_0xe8eba3));if(_0xe8eba3['error']){if(_0xe8eba3['error']['code']===0x1f4){logger['error'](_0x5e9f('0x9'),_0x4b61db,_0xe8eba3['error'][_0x5e9f('0xd')]);return _0x2d0c43(_0xe8eba3[_0x5e9f('0xe')][_0x5e9f('0xd')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4b61db,_0xe8eba3[_0x5e9f('0xe')][_0x5e9f('0xd')]);return _0x2a2742(_0xe8eba3[_0x5e9f('0xe')]['message']);}else{logger[_0x5e9f('0x8')](_0x5e9f('0x9'),_0x4b61db,_0x5e9f('0xa'));_0x2a2742(_0xe8eba3[_0x5e9f('0xf')][_0x5e9f('0xd')]);}})[_0x5e9f('0x10')](function(_0x3e2364){logger[_0x5e9f('0xe')](_0x5e9f('0x9'),_0x4b61db,_0x3e2364);_0x2d0c43(_0x3e2364);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index ed1e765..373ef38 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 _0xfd47=['INTEGER','exports'];(function(_0x4b1e43,_0x554b63){var _0x6e1fb7=function(_0x3fc750){while(--_0x3fc750){_0x4b1e43['push'](_0x4b1e43['shift']());}};_0x6e1fb7(++_0x554b63);}(_0xfd47,0xa9));var _0x7fd4=function(_0xe6830f,_0x40d9a8){_0xe6830f=_0xe6830f-0x0;var _0x234da9=_0xfd47[_0xe6830f];return _0x234da9;};'use strict';var Sequelize=require('sequelize');module[_0x7fd4('0x0')]={'UserId':{'type':Sequelize[_0x7fd4('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7fd4('0x1')]}}; \ No newline at end of file +var _0x6141=['exports','INTEGER','sequelize'];(function(_0x2dff37,_0x497f07){var _0x155983=function(_0x506770){while(--_0x506770){_0x2dff37['push'](_0x2dff37['shift']());}};_0x155983(++_0x497f07);}(_0x6141,0x95));var _0x1614=function(_0x558308,_0x5bd50e){_0x558308=_0x558308-0x0;var _0x329acc=_0x6141[_0x558308];return _0x329acc;};'use strict';var Sequelize=require(_0x1614('0x0'));module[_0x1614('0x1')]={'UserId':{'type':Sequelize[_0x1614('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1614('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6325083..c2dfa69 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(_0x2bd6a4,_0x5b3487){var _0x3f4976=function(_0x588b81){while(--_0x588b81){_0x2bd6a4['push'](_0x2bd6a4['shift']());}};_0x3f4976(++_0x5b3487);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x3d258b,_0x103ba8){var _0x1b48cb=function(_0x5bcb97){while(--_0x5bcb97){_0x3d258b['push'](_0x3d258b['shift']());}};_0x1b48cb(++_0x103ba8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 fafa182..04c7fb3 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47195e,_0x347734){var _0x571abb=function(_0x3574ad){while(--_0x3574ad){_0x47195e['push'](_0x47195e['shift']());}};_0x571abb(++_0x347734);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x368abc,_0x8bbc6f){var _0x2fd9f0=function(_0x129756){while(--_0x129756){_0x368abc['push'](_0x368abc['shift']());}};_0x2fd9f0(++_0x8bbc6f);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 102b991..0510fe7 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 _0xd086=['sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd086,0x1da));var _0x6d08=function(_0xb5db5a,_0x2aee49){_0xb5db5a=_0xb5db5a-0x0;var _0x56218a=_0xd086[_0xb5db5a];return _0x56218a;};'use strict';var Sequelize=require(_0x6d08('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6d08('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7244=['sequelize','exports','INTEGER'];(function(_0x55c55d,_0x44107a){var _0x219eab=function(_0x554462){while(--_0x554462){_0x55c55d['push'](_0x55c55d['shift']());}};_0x219eab(++_0x44107a);}(_0x7244,0xf6));var _0x4724=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7244[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x4724('0x0'));module[_0x4724('0x1')]={'penalty':{'type':Sequelize[_0x4724('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 91a71ff..8d69805 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 _0xe1e6=['bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0xe1e6,0xf2));var _0x6e1e=function(_0x436b5f,_0xaede2d){_0x436b5f=_0x436b5f-0x0;var _0x11f0da=_0xe1e6[_0x436b5f];return _0x11f0da;};'use strict';var _=require(_0x6e1e('0x0'));var util=require(_0x6e1e('0x1'));var logger=require(_0x6e1e('0x2'))(_0x6e1e('0x3'));var moment=require(_0x6e1e('0x4'));var BPromise=require(_0x6e1e('0x5'));var rp=require(_0x6e1e('0x6'));var fs=require('fs');var path=require(_0x6e1e('0x7'));var rimraf=require('rimraf');var config=require(_0x6e1e('0x8'));var attributes=require(_0x6e1e('0x9'));module[_0x6e1e('0xa')]=function(_0x3bf05e,_0x5c4e77){return _0x3bf05e[_0x6e1e('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x6e1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa6d=['path','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x10dcd1,_0x38b131){var _0x4b4c6a=function(_0x2dcdc7){while(--_0x2dcdc7){_0x10dcd1['push'](_0x10dcd1['shift']());}};_0x4b4c6a(++_0x38b131);}(_0xaa6d,0x9b));var _0xdaa6=function(_0x49f839,_0x5a8382){_0x49f839=_0x49f839-0x0;var _0x60a229=_0xaa6d[_0x49f839];return _0x60a229;};'use strict';var _=require(_0xdaa6('0x0'));var util=require(_0xdaa6('0x1'));var logger=require(_0xdaa6('0x2'))(_0xdaa6('0x3'));var moment=require(_0xdaa6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdaa6('0x5'));var rimraf=require('rimraf');var config=require(_0xdaa6('0x6'));var attributes=require(_0xdaa6('0x7'));module['exports']=function(_0x12bcb8,_0x43b41d){return _0x12bcb8['define'](_0xdaa6('0x8'),attributes,{'tableName':_0xdaa6('0x9'),'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 587aa55..26ef817 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 _0x81f9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0x81f9,0x1b5));var _0x981f=function(_0x2a217b,_0xb039df){_0x2a217b=_0x2a217b-0x0;var _0x29a6ac=_0x81f9[_0x2a217b];return _0x29a6ac;};'use strict';var _=require('lodash');var util=require(_0x981f('0x0'));var moment=require(_0x981f('0x1'));var BPromise=require(_0x981f('0x2'));var rs=require(_0x981f('0x3'));var fs=require('fs');var Redis=require(_0x981f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x981f('0x5'));var logger=require(_0x981f('0x6'))(_0x981f('0x7'));var config=require(_0x981f('0x8'));var jayson=require(_0x981f('0x9'));var client=jayson['client'][_0x981f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70292,_0xa8d5dd,_0x26d693){return new BPromise(function(_0x18c2b6,_0x3828ba){return client[_0x981f('0xb')](_0x70292,_0x26d693)[_0x981f('0xc')](function(_0x52e5db){logger[_0x981f('0xd')](_0x981f('0xe'),_0xa8d5dd,_0x981f('0xf'));logger[_0x981f('0x10')](_0x981f('0x11'),_0xa8d5dd,_0x981f('0xf'),JSON['stringify'](_0x52e5db));if(_0x52e5db[_0x981f('0x12')]){if(_0x52e5db[_0x981f('0x12')][_0x981f('0x13')]===0x1f4){logger[_0x981f('0x12')](_0x981f('0xe'),_0xa8d5dd,_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);return _0x3828ba(_0x52e5db['error'][_0x981f('0x14')]);}logger[_0x981f('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0xa8d5dd,_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);return _0x18c2b6(_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0xa8d5dd,'request\x20sent');_0x18c2b6(_0x52e5db[_0x981f('0x15')]['message']);}})[_0x981f('0x16')](function(_0x3cb4d9){logger['error'](_0x981f('0xe'),_0xa8d5dd,_0x3cb4d9);_0x3828ba(_0x3cb4d9);});});} \ No newline at end of file +var _0xeb39=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2d3c42,_0x682053){var _0x51e8e0=function(_0x5261a3){while(--_0x5261a3){_0x2d3c42['push'](_0x2d3c42['shift']());}};_0x51e8e0(++_0x682053);}(_0xeb39,0x100));var _0x9eb3=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xeb39[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x9eb3('0x0'));var util=require(_0x9eb3('0x1'));var moment=require(_0x9eb3('0x2'));var BPromise=require(_0x9eb3('0x3'));var rs=require(_0x9eb3('0x4'));var fs=require('fs');var Redis=require(_0x9eb3('0x5'));var db=require(_0x9eb3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eb3('0x7'))(_0x9eb3('0x8'));var config=require(_0x9eb3('0x9'));var jayson=require(_0x9eb3('0xa'));var client=jayson[_0x9eb3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7c68,_0x217dba,_0x394f46){return new BPromise(function(_0x258528,_0x1b5b0e){return client['request'](_0x1a7c68,_0x394f46)['then'](function(_0x2233e6){logger[_0x9eb3('0xc')](_0x9eb3('0xd'),_0x217dba,_0x9eb3('0xe'));logger[_0x9eb3('0xf')](_0x9eb3('0x10'),_0x217dba,_0x9eb3('0xe'),JSON['stringify'](_0x2233e6));if(_0x2233e6[_0x9eb3('0x11')]){if(_0x2233e6[_0x9eb3('0x11')]['code']===0x1f4){logger[_0x9eb3('0x11')](_0x9eb3('0xd'),_0x217dba,_0x2233e6[_0x9eb3('0x11')]['message']);return _0x1b5b0e(_0x2233e6[_0x9eb3('0x11')][_0x9eb3('0x12')]);}logger[_0x9eb3('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x217dba,_0x2233e6['error']['message']);return _0x258528(_0x2233e6[_0x9eb3('0x11')][_0x9eb3('0x12')]);}else{logger[_0x9eb3('0xc')](_0x9eb3('0xd'),_0x217dba,_0x9eb3('0xe'));_0x258528(_0x2233e6[_0x9eb3('0x13')][_0x9eb3('0x12')]);}})[_0x9eb3('0x14')](function(_0x4f3e06){logger['error'](_0x9eb3('0xd'),_0x217dba,_0x4f3e06);_0x1b5b0e(_0x4f3e06);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 654a266..b2311fd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2dc682,_0x1b3401){var _0x3acf92=function(_0x25089e){while(--_0x25089e){_0x2dc682['push'](_0x2dc682['shift']());}};_0x3acf92(++_0x1b3401);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xcb91[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b767d,_0x30f31c){var _0x11ee86=function(_0xf05263){while(--_0xf05263){_0x5b767d['push'](_0x5b767d['shift']());}};_0x11ee86(++_0x30f31c);}(_0x70e0,0x17b));var _0x070e=function(_0x21e804,_0x13ad4c){_0x21e804=_0x21e804-0x0;var _0x514de4=_0x70e0[_0x21e804];return _0x514de4;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b4f84d9..d041f26 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 _0x88fa=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x44c8a5,_0x49186f){var _0x5c4c0e=function(_0x43fc6d){while(--_0x43fc6d){_0x44c8a5['push'](_0x44c8a5['shift']());}};_0x5c4c0e(++_0x49186f);}(_0x88fa,0x19f));var _0xa88f=function(_0x412572,_0x37e9e2){_0x412572=_0x412572-0x0;var _0x20881f=_0x88fa[_0x412572];return _0x20881f;};'use strict';var Sequelize=require(_0xa88f('0x0'));module[_0xa88f('0x1')]={'uniqueid':{'type':Sequelize[_0xa88f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa88f('0x3')},'membername':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa88f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xa88f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'unique':_0xa88f('0x5'),'comment':_0xa88f('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa88f('0x3')},'paused':{'type':Sequelize[_0xa88f('0x2')](0xb),'defaultValue':0x0,'comment':_0xa88f('0x3')}}; \ No newline at end of file +var _0xe35c=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3fe6af,_0x282deb){var _0x53a5cd=function(_0x1c477e){while(--_0x1c477e){_0x3fe6af['push'](_0x3fe6af['shift']());}};_0x53a5cd(++_0x282deb);}(_0xe35c,0x146));var _0xce35=function(_0x226880,_0x24c02a){_0x226880=_0x226880-0x0;var _0x3df351=_0xe35c[_0x226880];return _0x3df351;};'use strict';var Sequelize=require(_0xce35('0x0'));module[_0xce35('0x1')]={'uniqueid':{'type':Sequelize[_0xce35('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xce35('0x3')},'membername':{'type':Sequelize[_0xce35('0x4')],'allowNull':![],'comment':_0xce35('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xce35('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xce35('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xce35('0x4')],'allowNull':![],'unique':_0xce35('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xce35('0x2')](0xb),'defaultValue':0x0,'comment':_0xce35('0x3')},'paused':{'type':Sequelize[_0xce35('0x2')](0xb),'defaultValue':0x0,'comment':_0xce35('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 5e36689..0ded5b9 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 _0x03a0=['UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x359828,_0x5a3f9f){var _0x2a368a=function(_0x460e65){while(--_0x460e65){_0x359828['push'](_0x359828['shift']());}};_0x2a368a(++_0x5a3f9f);}(_0x03a0,0x15f));var _0x003a=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x03a0[_0xd050c6];return _0x7278a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x003a('0x0'))['db'][_0x003a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x003a('0x2'),'afterUpdate':_0x003a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2abecd){return function(_0x5ab6c0,_0x59a49a,_0xef8dcf){UserVoiceQueueRtEvents['emit'](_0x2abecd+':'+_0x5ab6c0['id'],_0x5ab6c0);UserVoiceQueueRtEvents[_0x003a('0x4')](_0x2abecd,_0x5ab6c0);_0xef8dcf(null);};}for(var e in events){if(events[_0x003a('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x003a('0x6')](e,emitEvent(event));}}module[_0x003a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xfe85=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfe85,0x178));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5fe8('0x0'));var UserVoiceQueueRt=require(_0x5fe8('0x1'))['db'][_0x5fe8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fe8('0x3'),'afterUpdate':_0x5fe8('0x4'),'afterDestroy':_0x5fe8('0x5')};function emitEvent(_0x2b6271){return function(_0x5e59d4,_0x3675c7,_0xda3a40){UserVoiceQueueRtEvents[_0x5fe8('0x6')](_0x2b6271+':'+_0x5e59d4['id'],_0x5e59d4);UserVoiceQueueRtEvents['emit'](_0x2b6271,_0x5e59d4);_0xda3a40(null);};}for(var e in events){if(events[_0x5fe8('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x5fe8('0x8')](e,emitEvent(event));}}module[_0x5fe8('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 101daca..814ec7c 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 _0x2fb6=['request-promise','path','./userVoiceQueueRt.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2fb6,0x165));var _0x62fb=function(_0x1d5823,_0x365410){_0x1d5823=_0x1d5823-0x0;var _0x1a599f=_0x2fb6[_0x1d5823];return _0x1a599f;};'use strict';var _=require(_0x62fb('0x0'));var util=require(_0x62fb('0x1'));var logger=require(_0x62fb('0x2'))(_0x62fb('0x3'));var moment=require(_0x62fb('0x4'));var BPromise=require(_0x62fb('0x5'));var rp=require(_0x62fb('0x6'));var fs=require('fs');var path=require(_0x62fb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62fb('0x8'));module[_0x62fb('0x9')]=function(_0x712e1f,_0x5357ef){return _0x712e1f[_0x62fb('0xa')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeae9=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird'];(function(_0x14e3f7,_0x57eac6){var _0x55836d=function(_0x5418be){while(--_0x5418be){_0x14e3f7['push'](_0x14e3f7['shift']());}};_0x55836d(++_0x57eac6);}(_0xeae9,0x7f));var _0x9eae=function(_0x115ef0,_0x5a83b2){_0x115ef0=_0x115ef0-0x0;var _0x420f5a=_0xeae9[_0x115ef0];return _0x420f5a;};'use strict';var _=require(_0x9eae('0x0'));var util=require(_0x9eae('0x1'));var logger=require(_0x9eae('0x2'))(_0x9eae('0x3'));var moment=require('moment');var BPromise=require(_0x9eae('0x4'));var rp=require(_0x9eae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eae('0x6'));var config=require(_0x9eae('0x7'));var attributes=require(_0x9eae('0x8'));module[_0x9eae('0x9')]=function(_0x474585,_0x2f1a86){return _0x474585['define']('UserVoiceQueueRt',attributes,{'tableName':_0x9eae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 62f7d38..d43d255 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 _0x0a92=['client','http','redis','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d13df,_0x2cc45d){var _0x54fd6d=function(_0x51abe8){while(--_0x51abe8){_0x1d13df['push'](_0x1d13df['shift']());}};_0x54fd6d(++_0x2cc45d);}(_0x0a92,0x168));var _0x20a9=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x0a92[_0x5d6b41];return _0x1c2dd6;};'use strict';var _=require(_0x20a9('0x0'));var util=require(_0x20a9('0x1'));var moment=require(_0x20a9('0x2'));var BPromise=require(_0x20a9('0x3'));var rs=require(_0x20a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20a9('0x6'))(_0x20a9('0x7'));var config=require(_0x20a9('0x8'));var jayson=require(_0x20a9('0x9'));var client=jayson[_0x20a9('0xa')][_0x20a9('0xb')]({'port':0x232a});config[_0x20a9('0xc')]=_['defaults'](config[_0x20a9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x20a9('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x20a9('0xe')](socket);function respondWithRpcPromise(_0x3d4054,_0x14786f,_0x2c16e4){return new BPromise(function(_0x5920e7,_0x573c9d){return client[_0x20a9('0xf')](_0x3d4054,_0x2c16e4)[_0x20a9('0x10')](function(_0x428a8){logger[_0x20a9('0x11')](_0x20a9('0x12'),_0x14786f,'request\x20sent');logger[_0x20a9('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x14786f,'request\x20sent',JSON[_0x20a9('0x14')](_0x428a8));if(_0x428a8[_0x20a9('0x15')]){if(_0x428a8[_0x20a9('0x15')][_0x20a9('0x16')]===0x1f4){logger[_0x20a9('0x15')](_0x20a9('0x12'),_0x14786f,_0x428a8[_0x20a9('0x15')][_0x20a9('0x17')]);return _0x573c9d(_0x428a8['error']['message']);}logger['error'](_0x20a9('0x12'),_0x14786f,_0x428a8[_0x20a9('0x15')]['message']);return _0x5920e7(_0x428a8[_0x20a9('0x15')][_0x20a9('0x17')]);}else{logger[_0x20a9('0x11')](_0x20a9('0x12'),_0x14786f,_0x20a9('0x18'));_0x5920e7(_0x428a8[_0x20a9('0x19')][_0x20a9('0x17')]);}})[_0x20a9('0x1a')](function(_0x47604b){logger[_0x20a9('0x15')](_0x20a9('0x12'),_0x14786f,_0x47604b);_0x573c9d(_0x47604b);});});}exports[_0x20a9('0x1b')]=function(_0x499d70){var _0x2e221d=this;return new Promise(function(_0x76b028,_0x3ce387){return db[_0x20a9('0x1c')][_0x20a9('0x1d')]({'raw':_0x499d70['options']?_0x499d70['options'][_0x20a9('0x1e')]===undefined?!![]:![]:!![],'where':_0x499d70[_0x20a9('0x1f')]?_0x499d70['options'][_0x20a9('0x20')]||null:null,'attributes':[[db[_0x20a9('0x21')]['fn'](_0x20a9('0x22'),db[_0x20a9('0x21')]['fn']('IF',db['sequelize'][_0x20a9('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x20a9('0x24')]]})[_0x20a9('0x10')](function(_0x1c1306){logger[_0x20a9('0x11')]('GetVoiceQueueRtPauses',_0x499d70);logger[_0x20a9('0x13')](_0x20a9('0x1b'),_0x499d70,JSON[_0x20a9('0x14')](_0x1c1306));_0x76b028(_0x1c1306);})[_0x20a9('0x1a')](function(_0x5d231e){logger[_0x20a9('0x15')](_0x20a9('0x1b'),_0x5d231e[_0x20a9('0x17')],_0x499d70);_0x3ce387(_0x2e221d[_0x20a9('0x15')](0x1f4,_0x5d231e[_0x20a9('0x17')]));});});}; \ No newline at end of file +var _0x85da=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','debug','error','UserVoiceQueueRt,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','lodash','util','moment'];(function(_0x59f261,_0x4eb1a5){var _0x3c0e46=function(_0x3b8963){while(--_0x3b8963){_0x59f261['push'](_0x59f261['shift']());}};_0x3c0e46(++_0x4eb1a5);}(_0x85da,0x189));var _0xa85d=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x85da[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0xa85d('0x0'));var util=require(_0xa85d('0x1'));var moment=require(_0xa85d('0x2'));var BPromise=require(_0xa85d('0x3'));var rs=require(_0xa85d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa85d('0x5'))['db'];var utils=require(_0xa85d('0x6'));var logger=require(_0xa85d('0x7'))(_0xa85d('0x8'));var config=require(_0xa85d('0x9'));var jayson=require(_0xa85d('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa85d('0xb')]=_['defaults'](config['redis'],{'host':_0xa85d('0xc'),'port':0x18eb});var socket=require(_0xa85d('0xd'))(new Redis(config[_0xa85d('0xb')]));require(_0xa85d('0xe'))[_0xa85d('0xf')](socket);function respondWithRpcPromise(_0x3fb179,_0x580b36,_0x1d9331){return new BPromise(function(_0x5cd97e,_0x3d8401){return client[_0xa85d('0x10')](_0x3fb179,_0x1d9331)[_0xa85d('0x11')](function(_0x264d3d){logger[_0xa85d('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x580b36,'request\x20sent');logger[_0xa85d('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x580b36,'request\x20sent',JSON['stringify'](_0x264d3d));if(_0x264d3d[_0xa85d('0x14')]){if(_0x264d3d[_0xa85d('0x14')]['code']===0x1f4){logger[_0xa85d('0x14')](_0xa85d('0x15'),_0x580b36,_0x264d3d[_0xa85d('0x14')]['message']);return _0x3d8401(_0x264d3d[_0xa85d('0x14')]['message']);}logger[_0xa85d('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x580b36,_0x264d3d['error'][_0xa85d('0x16')]);return _0x5cd97e(_0x264d3d[_0xa85d('0x14')]['message']);}else{logger[_0xa85d('0x12')](_0xa85d('0x15'),_0x580b36,_0xa85d('0x17'));_0x5cd97e(_0x264d3d[_0xa85d('0x18')][_0xa85d('0x16')]);}})[_0xa85d('0x19')](function(_0x51e619){logger[_0xa85d('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x580b36,_0x51e619);_0x3d8401(_0x51e619);});});}exports[_0xa85d('0x1a')]=function(_0x16d971){var _0xf7606a=this;return new Promise(function(_0x1c0ca5,_0x22c8cb){return db['UserVoiceQueueRt'][_0xa85d('0x1b')]({'raw':_0x16d971[_0xa85d('0x1c')]?_0x16d971[_0xa85d('0x1c')][_0xa85d('0x1d')]===undefined?!![]:![]:!![],'where':_0x16d971[_0xa85d('0x1c')]?_0x16d971['options'][_0xa85d('0x1e')]||null:null,'attributes':[[db[_0xa85d('0x1f')]['fn'](_0xa85d('0x20'),db[_0xa85d('0x1f')]['fn']('IF',db[_0xa85d('0x1f')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xa85d('0x11')](function(_0x313dbc){logger[_0xa85d('0x12')](_0xa85d('0x1a'),_0x16d971);logger[_0xa85d('0x13')](_0xa85d('0x1a'),_0x16d971,JSON['stringify'](_0x313dbc));_0x1c0ca5(_0x313dbc);})[_0xa85d('0x19')](function(_0x3585eb){logger['error'](_0xa85d('0x1a'),_0x3585eb[_0xa85d('0x16')],_0x16d971);_0x22c8cb(_0xf7606a[_0xa85d('0x14')](0x1f4,_0x3585eb[_0xa85d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e9746eb..7cea746 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 _0x6144=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x5cb4fc,_0x222fbb){var _0xe29f03=function(_0x14b4a4){while(--_0x14b4a4){_0x5cb4fc['push'](_0x5cb4fc['shift']());}};_0xe29f03(++_0x222fbb);}(_0x6144,0x99));var _0x4614=function(_0x3440c4,_0xb565db){_0x3440c4=_0x3440c4-0x0;var _0x536069=_0x6144[_0x3440c4];return _0x536069;};'use strict';var UserVoiceQueueRtEvents=require(_0x4614('0x0'));var events=[_0x4614('0x1'),_0x4614('0x2'),_0x4614('0x3')];function createListener(_0x56bf24,_0x1db9ab){return function(_0x3b8b58){_0x1db9ab[_0x4614('0x4')](_0x56bf24,_0x3b8b58);};}function removeListener(_0x254bb6,_0x5ac7b6){return function(){UserVoiceQueueRtEvents[_0x4614('0x5')](_0x254bb6,_0x5ac7b6);};}exports[_0x4614('0x6')]=function(_0x40832b){for(var _0x935177=0x0,_0x3d6142=events['length'];_0x935177<_0x3d6142;_0x935177++){var _0x45e5f2=events[_0x935177];var _0x3eb8ea=createListener(_0x4614('0x7')+_0x45e5f2,_0x40832b);UserVoiceQueueRtEvents['on'](_0x45e5f2,_0x3eb8ea);}}; \ No newline at end of file +var _0x7722=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x9470db,_0x45e341){var _0x2d8149=function(_0x5d5c7c){while(--_0x5d5c7c){_0x9470db['push'](_0x9470db['shift']());}};_0x2d8149(++_0x45e341);}(_0x7722,0x14e));var _0x2772=function(_0x1c604f,_0x1899e4){_0x1c604f=_0x1c604f-0x0;var _0x55e98e=_0x7722[_0x1c604f];return _0x55e98e;};'use strict';var UserVoiceQueueRtEvents=require(_0x2772('0x0'));var events=[_0x2772('0x1'),_0x2772('0x2'),_0x2772('0x3')];function createListener(_0x169af9,_0xbdd234){return function(_0xede334){_0xbdd234[_0x2772('0x4')](_0x169af9,_0xede334);};}function removeListener(_0x1c4d7f,_0x53f112){return function(){UserVoiceQueueRtEvents[_0x2772('0x5')](_0x1c4d7f,_0x53f112);};}exports['register']=function(_0x2a3e34){for(var _0x112ea5=0x0,_0x3e6c6e=events[_0x2772('0x6')];_0x112ea5<_0x3e6c6e;_0x112ea5++){var _0x21b452=events[_0x112ea5];var _0x53f017=createListener(_0x2772('0x7')+_0x21b452,_0x2a3e34);UserVoiceQueueRtEvents['on'](_0x21b452,_0x53f017);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5df2106..8c83f37 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x362d16,_0x31c1a2){var _0x5596de=function(_0x3e588b){while(--_0x3e588b){_0x362d16['push'](_0x362d16['shift']());}};_0x5596de(++_0x31c1a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d9b3b,_0x2b7af4){var _0x3ddd58=function(_0x5a5717){while(--_0x5a5717){_0x5d9b3b['push'](_0x5d9b3b['shift']());}};_0x3ddd58(++_0x2b7af4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c7ece3f..e0d21ec 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 _0x7e88=['sequelize'];(function(_0x3125f4,_0x2e5641){var _0x2088da=function(_0x3b4e91){while(--_0x3b4e91){_0x3125f4['push'](_0x3125f4['shift']());}};_0x2088da(++_0x2e5641);}(_0x7e88,0x149));var _0x87e8=function(_0x1db10d,_0xb105){_0x1db10d=_0x1db10d-0x0;var _0x23981b=_0x7e88[_0x1db10d];return _0x23981b;};'use strict';var Sequelize=require(_0x87e8('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb000=['INTEGER','sequelize'];(function(_0x52cd91,_0x373551){var _0x4773d4=function(_0xb76abf){while(--_0xb76abf){_0x52cd91['push'](_0x52cd91['shift']());}};_0x4773d4(++_0x373551);}(_0xb000,0x1a7));var _0x0b00=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xb000[_0x188703];return _0x1a0c81;};'use strict';var Sequelize=require(_0x0b00('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0b00('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 78d61c3..e3688ab 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 _0x3fa3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x4a2581,_0x180153){var _0x3ed126=function(_0x4b2f0c){while(--_0x4b2f0c){_0x4a2581['push'](_0x4a2581['shift']());}};_0x3ed126(++_0x180153);}(_0x3fa3,0xfd));var _0x33fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fa3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x33fa('0x0'));var logger=require(_0x33fa('0x1'))(_0x33fa('0x2'));var moment=require(_0x33fa('0x3'));var BPromise=require(_0x33fa('0x4'));var rp=require(_0x33fa('0x5'));var fs=require('fs');var path=require(_0x33fa('0x6'));var rimraf=require('rimraf');var config=require(_0x33fa('0x7'));var attributes=require(_0x33fa('0x8'));module[_0x33fa('0x9')]=function(_0x358904,_0x34f4b4){return _0x358904['define'](_0x33fa('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3e8=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0xa3e8,0xb1));var _0x8a3e=function(_0x1b27fd,_0x29ccef){_0x1b27fd=_0x1b27fd-0x0;var _0x41d72e=_0xa3e8[_0x1b27fd];return _0x41d72e;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var logger=require(_0x8a3e('0x2'))(_0x8a3e('0x3'));var moment=require(_0x8a3e('0x4'));var BPromise=require(_0x8a3e('0x5'));var rp=require(_0x8a3e('0x6'));var fs=require('fs');var path=require(_0x8a3e('0x7'));var rimraf=require(_0x8a3e('0x8'));var config=require(_0x8a3e('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x8a3e('0xa')]=function(_0x288201,_0x130e92){return _0x288201[_0x8a3e('0xb')](_0x8a3e('0xc'),attributes,{'tableName':_0x8a3e('0xd'),'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 f846827..13ea1dd 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 _0xe733=['../../config/logger','rpc','../../config/environment','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd058a7,_0x519154){var _0x211a5d=function(_0x459f66){while(--_0x459f66){_0xd058a7['push'](_0xd058a7['shift']());}};_0x211a5d(++_0x519154);}(_0xe733,0xa1));var _0x3e73=function(_0x343285,_0x4cb733){_0x343285=_0x343285-0x0;var _0x7395c1=_0xe733[_0x343285];return _0x7395c1;};'use strict';var _=require(_0x3e73('0x0'));var util=require(_0x3e73('0x1'));var moment=require(_0x3e73('0x2'));var BPromise=require(_0x3e73('0x3'));var rs=require(_0x3e73('0x4'));var fs=require('fs');var Redis=require(_0x3e73('0x5'));var db=require(_0x3e73('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e73('0x7'))(_0x3e73('0x8'));var config=require(_0x3e73('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3e73('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26abaa,_0x3b5a0d,_0x2dcbc7){return new BPromise(function(_0x9ebb71,_0x49ed37){return client[_0x3e73('0xb')](_0x26abaa,_0x2dcbc7)[_0x3e73('0xc')](function(_0x1d197a){logger[_0x3e73('0xd')](_0x3e73('0xe'),_0x3b5a0d,_0x3e73('0xf'));logger[_0x3e73('0x10')](_0x3e73('0x11'),_0x3b5a0d,_0x3e73('0xf'),JSON[_0x3e73('0x12')](_0x1d197a));if(_0x1d197a[_0x3e73('0x13')]){if(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x14')]===0x1f4){logger[_0x3e73('0x13')](_0x3e73('0xe'),_0x3b5a0d,_0x1d197a['error'][_0x3e73('0x15')]);return _0x49ed37(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x15')]);}logger['error'](_0x3e73('0xe'),_0x3b5a0d,_0x1d197a['error'][_0x3e73('0x15')]);return _0x9ebb71(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x15')]);}else{logger[_0x3e73('0xd')](_0x3e73('0xe'),_0x3b5a0d,_0x3e73('0xf'));_0x9ebb71(_0x1d197a[_0x3e73('0x16')][_0x3e73('0x15')]);}})[_0x3e73('0x17')](function(_0x3ed640){logger['error'](_0x3e73('0xe'),_0x3b5a0d,_0x3ed640);_0x49ed37(_0x3ed640);});});} \ No newline at end of file +var _0x9a23=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f0f2c,_0x9817bf){var _0x104e69=function(_0x6915cc){while(--_0x6915cc){_0x5f0f2c['push'](_0x5f0f2c['shift']());}};_0x104e69(++_0x9817bf);}(_0x9a23,0x1dd));var _0x39a2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9a23[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39a2('0x0'));var BPromise=require(_0x39a2('0x1'));var rs=require(_0x39a2('0x2'));var fs=require('fs');var Redis=require(_0x39a2('0x3'));var db=require(_0x39a2('0x4'))['db'];var utils=require(_0x39a2('0x5'));var logger=require(_0x39a2('0x6'))(_0x39a2('0x7'));var config=require(_0x39a2('0x8'));var jayson=require(_0x39a2('0x9'));var client=jayson['client'][_0x39a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16644b,_0x54d71b,_0x5c44ab){return new BPromise(function(_0x1b917e,_0x436cc3){return client[_0x39a2('0xb')](_0x16644b,_0x5c44ab)[_0x39a2('0xc')](function(_0x210d37){logger[_0x39a2('0xd')](_0x39a2('0xe'),_0x54d71b,_0x39a2('0xf'));logger[_0x39a2('0x10')](_0x39a2('0x11'),_0x54d71b,_0x39a2('0xf'),JSON['stringify'](_0x210d37));if(_0x210d37['error']){if(_0x210d37[_0x39a2('0x12')][_0x39a2('0x13')]===0x1f4){logger['error'](_0x39a2('0xe'),_0x54d71b,_0x210d37['error'][_0x39a2('0x14')]);return _0x436cc3(_0x210d37[_0x39a2('0x12')]['message']);}logger[_0x39a2('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d71b,_0x210d37['error'][_0x39a2('0x14')]);return _0x1b917e(_0x210d37[_0x39a2('0x12')][_0x39a2('0x14')]);}else{logger[_0x39a2('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x54d71b,_0x39a2('0xf'));_0x1b917e(_0x210d37[_0x39a2('0x15')][_0x39a2('0x14')]);}})[_0x39a2('0x16')](function(_0x4c60e4){logger[_0x39a2('0x12')](_0x39a2('0xe'),_0x54d71b,_0x4c60e4);_0x436cc3(_0x4c60e4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8b05f1a..ef756f0 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 _0x2f72=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x4123a0,_0x8eb7c){var _0x41643c=function(_0x4014f8){while(--_0x4014f8){_0x4123a0['push'](_0x4123a0['shift']());}};_0x41643c(++_0x8eb7c);}(_0x2f72,0x166));var _0x22f7=function(_0x4930c3,_0x1898bd){_0x4930c3=_0x4930c3-0x0;var _0x23911b=_0x2f72[_0x4930c3];return _0x23911b;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require(_0x22f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0xc')]);router[_0x22f7('0xa')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xe')]);router[_0x22f7('0xf')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x10')]);router[_0x22f7('0x11')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0x12')]);router['delete'](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller['destroy']);module[_0x22f7('0x13')]=router; \ No newline at end of file +var _0xcb99=['../../config/environment','./variable.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x3836a4,_0x2c853b){var _0xd3b99f=function(_0x191a62){while(--_0x191a62){_0x3836a4['push'](_0x3836a4['shift']());}};_0xd3b99f(++_0x2c853b);}(_0xcb99,0x8b));var _0x9cb9=function(_0x2a40b3,_0xe1c253){_0x2a40b3=_0x2a40b3-0x0;var _0x4ac6cb=_0xcb99[_0x2a40b3];return _0x4ac6cb;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xa')]);router[_0x9cb9('0xb')]('/',auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0xe')]);router[_0x9cb9('0xf')](_0x9cb9('0x9'),auth['isAuthenticated'](),controller[_0x9cb9('0x10')]);module[_0x9cb9('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4103114..029c572 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 _0x64f6=['exports','STRING','name','sequelize'];(function(_0x2a5716,_0x4641fb){var _0x1f6916=function(_0x36c524){while(--_0x36c524){_0x2a5716['push'](_0x2a5716['shift']());}};_0x1f6916(++_0x4641fb);}(_0x64f6,0xb3));var _0x664f=function(_0x10f8f3,_0x21e890){_0x10f8f3=_0x10f8f3-0x0;var _0x2d0a23=_0x64f6[_0x10f8f3];return _0x2d0a23;};'use strict';var Sequelize=require(_0x664f('0x0'));module[_0x664f('0x1')]={'name':{'type':Sequelize[_0x664f('0x2')],'unique':_0x664f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcfab=['sequelize','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcfab,0x1e0));var _0xbcfa=function(_0x42fa68,_0x5850c2){_0x42fa68=_0x42fa68-0x0;var _0x2cc677=_0xcfab[_0x42fa68];return _0x2cc677;};'use strict';var Sequelize=require(_0xbcfa('0x0'));module['exports']={'name':{'type':Sequelize[_0xbcfa('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbcfa('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 48c4ced..d2dc7c2 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 _0x6067=['filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','fieldName','type','query','keys'];(function(_0x3fca12,_0x15fb5d){var _0x5b2b83=function(_0x4d8d05){while(--_0x4d8d05){_0x3fca12['push'](_0x3fca12['shift']());}};_0x5b2b83(++_0x15fb5d);}(_0x6067,0x121));var _0x7606=function(_0x14c6f5,_0x1c88a7){_0x14c6f5=_0x14c6f5-0x0;var _0x2278bb=_0x6067[_0x14c6f5];return _0x2278bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7606('0x0'));var jsonpatch=require(_0x7606('0x1'));var rp=require('request-promise');var moment=require(_0x7606('0x2'));var BPromise=require(_0x7606('0x3'));var Mustache=require(_0x7606('0x4'));var util=require(_0x7606('0x5'));var path=require(_0x7606('0x6'));var sox=require(_0x7606('0x7'));var csv=require(_0x7606('0x8'));var ejs=require(_0x7606('0x9'));var fs=require('fs');var fs_extra=require(_0x7606('0xa'));var _=require(_0x7606('0xb'));var squel=require(_0x7606('0xc'));var crypto=require(_0x7606('0xd'));var jsforce=require(_0x7606('0xe'));var deskjs=require(_0x7606('0xf'));var toCsv=require(_0x7606('0x8'));var querystring=require(_0x7606('0x10'));var Papa=require(_0x7606('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7606('0x12'));var as=require(_0x7606('0x13'));var hardwareService=require(_0x7606('0x14'));var logger=require(_0x7606('0x15'))(_0x7606('0x16'));var utils=require(_0x7606('0x17'));var config=require(_0x7606('0x18'));var licenseUtil=require(_0x7606('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dbb60,_0x582f4a){_0x582f4a=_0x582f4a||0xcc;return function(_0xa7d66c){if(_0xa7d66c){return _0x4dbb60[_0x7606('0x1a')](_0x582f4a);}return _0x4dbb60['status'](_0x582f4a)[_0x7606('0x1b')]();};}function respondWithResult(_0x331224,_0x2dbb02){_0x2dbb02=_0x2dbb02||0xc8;return function(_0x4da474){if(_0x4da474){return _0x331224[_0x7606('0x1c')](_0x2dbb02)[_0x7606('0x1d')](_0x4da474);}};}function respondWithFilteredResult(_0x1f510b,_0x5310cf){return function(_0x2f01e1){if(_0x2f01e1){var _0x16e6cf=typeof _0x5310cf[_0x7606('0x1e')]===_0x7606('0x1f')&&typeof _0x5310cf[_0x7606('0x20')]==='undefined';var _0x2bfdd5=_0x2f01e1[_0x7606('0x21')];var _0x2701b6=_0x16e6cf?0x0:_0x5310cf['offset'];var _0x2973b0=_0x16e6cf?_0x2f01e1['count']:_0x5310cf[_0x7606('0x1e')]+_0x5310cf[_0x7606('0x20')];var _0x3ffce4;if(_0x2973b0>=_0x2bfdd5){_0x2973b0=_0x2bfdd5;_0x3ffce4=0xc8;}else{_0x3ffce4=0xce;}_0x1f510b[_0x7606('0x1c')](_0x3ffce4);return _0x1f510b[_0x7606('0x22')](_0x7606('0x23'),_0x2701b6+'-'+_0x2973b0+'/'+_0x2bfdd5)['json'](_0x2f01e1);}return null;};}function patchUpdates(_0x13c194){return function(_0x4fc140){try{jsonpatch[_0x7606('0x24')](_0x4fc140,_0x13c194,!![]);}catch(_0x3f4f9b){return BPromise['reject'](_0x3f4f9b);}return _0x4fc140[_0x7606('0x25')]();};}function saveUpdates(_0x5a687b,_0x40c751){return function(_0x209748){if(_0x209748){return _0x209748[_0x7606('0x26')](_0x5a687b)[_0x7606('0x27')](function(_0x16aa3a){return _0x16aa3a;});}return null;};}function removeEntity(_0xcfd0c7,_0x46fd9b){return function(_0x41b53f){if(_0x41b53f){return _0x41b53f['destroy']()[_0x7606('0x27')](function(){var _0x45c63b=_0x41b53f[_0x7606('0x28')]({'plain':!![]});var _0x32b119=_0x7606('0x29');return db[_0x7606('0x2a')][_0x7606('0x2b')]({'where':{'type':_0x32b119,'resourceId':_0x45c63b['id']}})[_0x7606('0x27')](function(){return _0x41b53f;});})[_0x7606('0x27')](function(){_0xcfd0c7[_0x7606('0x1c')](0xcc)[_0x7606('0x1b')]();});}};}function handleEntityNotFound(_0x39264b,_0x44bed1){return function(_0xdb377d){if(!_0xdb377d){_0x39264b[_0x7606('0x1a')](0x194);}return _0xdb377d;};}function handleError(_0x4e3e62,_0x486e37){_0x486e37=_0x486e37||0x1f4;return function(_0x333c14){logger[_0x7606('0x2c')](_0x333c14[_0x7606('0x2d')]);if(_0x333c14[_0x7606('0x2e')]){delete _0x333c14[_0x7606('0x2e')];}_0x4e3e62[_0x7606('0x1c')](_0x486e37)[_0x7606('0x2f')](_0x333c14);};}exports[_0x7606('0x30')]=function(_0x15f824,_0x2641ad){var _0x49b54e={},_0x1d800d={},_0x1802cc={'count':0x0,'rows':[]};var _0x57419c=_[_0x7606('0x31')](db[_0x7606('0x32')]['rawAttributes'],function(_0x25bb55){return{'name':_0x25bb55[_0x7606('0x33')],'type':_0x25bb55[_0x7606('0x34')]['key']};});_0x1d800d['model']=_[_0x7606('0x31')](_0x57419c,'name');_0x1d800d[_0x7606('0x35')]=_[_0x7606('0x36')](_0x15f824['query']);_0x1d800d[_0x7606('0x37')]=_['intersection'](_0x1d800d['model'],_0x1d800d[_0x7606('0x35')]);_0x49b54e['attributes']=_[_0x7606('0x38')](_0x1d800d[_0x7606('0x39')],qs[_0x7606('0x3a')](_0x15f824[_0x7606('0x35')][_0x7606('0x3a')]));_0x49b54e[_0x7606('0x3b')]=_0x49b54e[_0x7606('0x3b')][_0x7606('0x3c')]?_0x49b54e[_0x7606('0x3b')]:_0x1d800d[_0x7606('0x39')];if(!_0x15f824['query']['hasOwnProperty'](_0x7606('0x3d'))){_0x49b54e[_0x7606('0x20')]=qs[_0x7606('0x20')](_0x15f824[_0x7606('0x35')][_0x7606('0x20')]);_0x49b54e['offset']=qs[_0x7606('0x1e')](_0x15f824[_0x7606('0x35')]['offset']);}_0x49b54e[_0x7606('0x3e')]=qs[_0x7606('0x3f')](_0x15f824['query'][_0x7606('0x3f')]);_0x49b54e[_0x7606('0x40')]=qs['filters'](_[_0x7606('0x41')](_0x15f824[_0x7606('0x35')],_0x1d800d[_0x7606('0x37')]),_0x57419c);if(_0x15f824[_0x7606('0x35')][_0x7606('0x42')]){_0x49b54e[_0x7606('0x40')]=_[_0x7606('0x43')](_0x49b54e[_0x7606('0x40')],{'$or':_['map'](_0x57419c,function(_0x39f901){if(_0x39f901[_0x7606('0x34')]!==_0x7606('0x44')){var _0x30e1cc={};_0x30e1cc[_0x39f901['name']]={'$like':'%'+_0x15f824[_0x7606('0x35')][_0x7606('0x42')]+'%'};return _0x30e1cc;}})});}_0x49b54e=_[_0x7606('0x43')]({},_0x49b54e,_0x15f824[_0x7606('0x45')]);var _0x5c3139={'where':_0x49b54e[_0x7606('0x40')]};return db[_0x7606('0x32')][_0x7606('0x21')](_0x5c3139)[_0x7606('0x27')](function(_0x4df635){_0x1802cc[_0x7606('0x21')]=_0x4df635;if(_0x15f824['query'][_0x7606('0x46')]){_0x49b54e[_0x7606('0x47')]=[{'all':!![]}];}return db['Variable'][_0x7606('0x48')](_0x49b54e);})[_0x7606('0x27')](function(_0x3b2c49){_0x1802cc[_0x7606('0x49')]=_0x3b2c49;return _0x1802cc;})[_0x7606('0x27')](respondWithFilteredResult(_0x2641ad,_0x49b54e))[_0x7606('0x4a')](handleError(_0x2641ad,null));};exports['show']=function(_0x2d5990,_0x59fefe){var _0x24d037={'raw':!![],'where':{'id':_0x2d5990[_0x7606('0x4b')]['id']}},_0x455801={};_0x455801[_0x7606('0x39')]=_[_0x7606('0x36')](db[_0x7606('0x32')][_0x7606('0x4c')]);_0x455801[_0x7606('0x35')]=_['keys'](_0x2d5990['query']);_0x455801[_0x7606('0x37')]=_['intersection'](_0x455801['model'],_0x455801[_0x7606('0x35')]);_0x24d037['attributes']=_[_0x7606('0x38')](_0x455801[_0x7606('0x39')],qs[_0x7606('0x3a')](_0x2d5990[_0x7606('0x35')][_0x7606('0x3a')]));_0x24d037['attributes']=_0x24d037[_0x7606('0x3b')]['length']?_0x24d037[_0x7606('0x3b')]:_0x455801[_0x7606('0x39')];if(_0x2d5990[_0x7606('0x35')][_0x7606('0x46')]){_0x24d037[_0x7606('0x47')]=[{'all':!![]}];}_0x24d037=_[_0x7606('0x43')]({},_0x24d037,_0x2d5990[_0x7606('0x45')]);return db[_0x7606('0x32')][_0x7606('0x4d')](_0x24d037)[_0x7606('0x27')](handleEntityNotFound(_0x59fefe,null))[_0x7606('0x27')](respondWithResult(_0x59fefe,null))[_0x7606('0x4a')](handleError(_0x59fefe,null));};exports[_0x7606('0x4e')]=function(_0x1062f3,_0x1dc49a){return db[_0x7606('0x32')][_0x7606('0x4e')](_0x1062f3['body'],{})['then'](function(_0x2952de){var _0x5a9547=_0x1062f3[_0x7606('0x4f')][_0x7606('0x28')]({'plain':!![]});if(!_0x5a9547)throw new Error(_0x7606('0x50'));if(_0x5a9547['role']===_0x7606('0x4f')){var _0x50ea65=_0x2952de[_0x7606('0x28')]({'plain':!![]});var _0x34bd43='Variables';return db[_0x7606('0x51')][_0x7606('0x4d')]({'where':{'name':_0x34bd43,'userProfileId':_0x5a9547[_0x7606('0x52')]},'raw':!![]})['then'](function(_0x55b642){if(_0x55b642&&_0x55b642[_0x7606('0x53')]===0x0){return db[_0x7606('0x2a')][_0x7606('0x4e')]({'name':_0x50ea65[_0x7606('0x2e')],'resourceId':_0x50ea65['id'],'type':_0x55b642[_0x7606('0x2e')],'sectionId':_0x55b642['id']},{})['then'](function(){return _0x2952de;});}else{return _0x2952de;}})['catch'](function(_0x4aae65){logger[_0x7606('0x2c')](_0x7606('0x54'),_0x4aae65);throw _0x4aae65;});}return _0x2952de;})[_0x7606('0x27')](respondWithResult(_0x1dc49a,0xc9))[_0x7606('0x4a')](handleError(_0x1dc49a,null));};exports[_0x7606('0x26')]=function(_0x216be9,_0x223375){if(_0x216be9[_0x7606('0x55')]['id']){delete _0x216be9[_0x7606('0x55')]['id'];}return db[_0x7606('0x32')]['find']({'where':{'id':_0x216be9[_0x7606('0x4b')]['id']}})[_0x7606('0x27')](handleEntityNotFound(_0x223375,null))[_0x7606('0x27')](saveUpdates(_0x216be9[_0x7606('0x55')],null))[_0x7606('0x27')](respondWithResult(_0x223375,null))[_0x7606('0x4a')](handleError(_0x223375,null));};exports[_0x7606('0x2b')]=function(_0x32dbf3,_0x3eb5e5){return db['Variable'][_0x7606('0x4d')]({'where':{'id':_0x32dbf3['params']['id']}})[_0x7606('0x27')](handleEntityNotFound(_0x3eb5e5,null))[_0x7606('0x27')](removeEntity(_0x3eb5e5,null))[_0x7606('0x4a')](handleError(_0x3eb5e5,null));}; \ No newline at end of file +var _0x902d=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','undefined','limit','offset','count','set','json','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x902d,0x1aa));var _0xd902=function(_0x382d7e,_0x16798c){_0x382d7e=_0x382d7e-0x0;var _0x33c721=_0x902d[_0x382d7e];return _0x33c721;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd902('0x0'));var zipdir=require(_0xd902('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd902('0x2'));var moment=require(_0xd902('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd902('0x4'));var util=require(_0xd902('0x5'));var path=require(_0xd902('0x6'));var sox=require(_0xd902('0x7'));var csv=require(_0xd902('0x8'));var ejs=require(_0xd902('0x9'));var fs=require('fs');var fs_extra=require(_0xd902('0xa'));var _=require(_0xd902('0xb'));var squel=require(_0xd902('0xc'));var crypto=require(_0xd902('0xd'));var jsforce=require(_0xd902('0xe'));var deskjs=require(_0xd902('0xf'));var toCsv=require(_0xd902('0x8'));var querystring=require('querystring');var Papa=require(_0xd902('0x10'));var Redis=require(_0xd902('0x11'));var authService=require(_0xd902('0x12'));var qs=require(_0xd902('0x13'));var as=require(_0xd902('0x14'));var hardwareService=require(_0xd902('0x15'));var logger=require(_0xd902('0x16'))(_0xd902('0x17'));var utils=require(_0xd902('0x18'));var config=require(_0xd902('0x19'));var licenseUtil=require(_0xd902('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x423db5,_0x37188c){_0x37188c=_0x37188c||0xcc;return function(_0x2b67b3){if(_0x2b67b3){return _0x423db5['sendStatus'](_0x37188c);}return _0x423db5['status'](_0x37188c)[_0xd902('0x1b')]();};}function respondWithResult(_0x4f1462,_0x563418){_0x563418=_0x563418||0xc8;return function(_0x1f5d00){if(_0x1f5d00){return _0x4f1462[_0xd902('0x1c')](_0x563418)['json'](_0x1f5d00);}};}function respondWithFilteredResult(_0x4ccac0,_0x2f6307){return function(_0x4bd483){if(_0x4bd483){var _0xa37d2c=typeof _0x2f6307['offset']===_0xd902('0x1d')&&typeof _0x2f6307[_0xd902('0x1e')]==='undefined';var _0x3dd662=_0x4bd483['count'];var _0x3dffcd=_0xa37d2c?0x0:_0x2f6307[_0xd902('0x1f')];var _0x3a126a=_0xa37d2c?_0x4bd483[_0xd902('0x20')]:_0x2f6307[_0xd902('0x1f')]+_0x2f6307['limit'];var _0x144a9a;if(_0x3a126a>=_0x3dd662){_0x3a126a=_0x3dd662;_0x144a9a=0xc8;}else{_0x144a9a=0xce;}_0x4ccac0[_0xd902('0x1c')](_0x144a9a);return _0x4ccac0[_0xd902('0x21')]('Content-Range',_0x3dffcd+'-'+_0x3a126a+'/'+_0x3dd662)[_0xd902('0x22')](_0x4bd483);}return null;};}function patchUpdates(_0x171585){return function(_0xdd3666){try{jsonpatch[_0xd902('0x23')](_0xdd3666,_0x171585,!![]);}catch(_0x48f80d){return BPromise[_0xd902('0x24')](_0x48f80d);}return _0xdd3666[_0xd902('0x25')]();};}function saveUpdates(_0x1f5705,_0x308a83){return function(_0x25e324){if(_0x25e324){return _0x25e324[_0xd902('0x26')](_0x1f5705)[_0xd902('0x27')](function(_0xb5f15){return _0xb5f15;});}return null;};}function removeEntity(_0x4f46a6,_0x31da67){return function(_0x53c3f6){if(_0x53c3f6){return _0x53c3f6[_0xd902('0x28')]()[_0xd902('0x27')](function(){var _0x6406=_0x53c3f6[_0xd902('0x29')]({'plain':!![]});var _0x52cf04=_0xd902('0x2a');return db[_0xd902('0x2b')][_0xd902('0x28')]({'where':{'type':_0x52cf04,'resourceId':_0x6406['id']}})[_0xd902('0x27')](function(){return _0x53c3f6;});})[_0xd902('0x27')](function(){_0x4f46a6[_0xd902('0x1c')](0xcc)[_0xd902('0x1b')]();});}};}function handleEntityNotFound(_0x392199,_0x92d297){return function(_0x519f60){if(!_0x519f60){_0x392199['sendStatus'](0x194);}return _0x519f60;};}function handleError(_0x43518e,_0x23555b){_0x23555b=_0x23555b||0x1f4;return function(_0x4166c8){logger[_0xd902('0x2c')](_0x4166c8[_0xd902('0x2d')]);if(_0x4166c8[_0xd902('0x2e')]){delete _0x4166c8['name'];}_0x43518e['status'](_0x23555b)[_0xd902('0x2f')](_0x4166c8);};}exports[_0xd902('0x30')]=function(_0x3bd22c,_0x4ef9e1){var _0x3b4387={},_0x16c683={},_0x95dfde={'count':0x0,'rows':[]};var _0x3f6fe2=_['map'](db[_0xd902('0x31')][_0xd902('0x32')],function(_0x3b5db3){return{'name':_0x3b5db3['fieldName'],'type':_0x3b5db3[_0xd902('0x33')]['key']};});_0x16c683[_0xd902('0x34')]=_[_0xd902('0x35')](_0x3f6fe2,_0xd902('0x2e'));_0x16c683[_0xd902('0x36')]=_[_0xd902('0x37')](_0x3bd22c[_0xd902('0x36')]);_0x16c683[_0xd902('0x38')]=_['intersection'](_0x16c683[_0xd902('0x34')],_0x16c683['query']);_0x3b4387['attributes']=_[_0xd902('0x39')](_0x16c683['model'],qs[_0xd902('0x3a')](_0x3bd22c[_0xd902('0x36')][_0xd902('0x3a')]));_0x3b4387['attributes']=_0x3b4387[_0xd902('0x3b')][_0xd902('0x3c')]?_0x3b4387[_0xd902('0x3b')]:_0x16c683[_0xd902('0x34')];if(!_0x3bd22c[_0xd902('0x36')][_0xd902('0x3d')]('nolimit')){_0x3b4387['limit']=qs[_0xd902('0x1e')](_0x3bd22c[_0xd902('0x36')]['limit']);_0x3b4387[_0xd902('0x1f')]=qs['offset'](_0x3bd22c['query'][_0xd902('0x1f')]);}_0x3b4387[_0xd902('0x3e')]=qs[_0xd902('0x3f')](_0x3bd22c[_0xd902('0x36')][_0xd902('0x3f')]);_0x3b4387[_0xd902('0x40')]=qs['filters'](_['pick'](_0x3bd22c[_0xd902('0x36')],_0x16c683[_0xd902('0x38')]),_0x3f6fe2);if(_0x3bd22c['query'][_0xd902('0x41')]){_0x3b4387[_0xd902('0x40')]=_[_0xd902('0x42')](_0x3b4387['where'],{'$or':_[_0xd902('0x35')](_0x3f6fe2,function(_0x503334){if(_0x503334[_0xd902('0x33')]!==_0xd902('0x43')){var _0x3d33f6={};_0x3d33f6[_0x503334['name']]={'$like':'%'+_0x3bd22c[_0xd902('0x36')]['filter']+'%'};return _0x3d33f6;}})});}_0x3b4387=_['merge']({},_0x3b4387,_0x3bd22c[_0xd902('0x44')]);var _0x5bd123={'where':_0x3b4387['where']};return db[_0xd902('0x31')][_0xd902('0x20')](_0x5bd123)[_0xd902('0x27')](function(_0x28dd6f){_0x95dfde[_0xd902('0x20')]=_0x28dd6f;if(_0x3bd22c['query']['includeAll']){_0x3b4387[_0xd902('0x45')]=[{'all':!![]}];}return db[_0xd902('0x31')][_0xd902('0x46')](_0x3b4387);})['then'](function(_0x59c285){_0x95dfde[_0xd902('0x47')]=_0x59c285;return _0x95dfde;})[_0xd902('0x27')](respondWithFilteredResult(_0x4ef9e1,_0x3b4387))[_0xd902('0x48')](handleError(_0x4ef9e1,null));};exports[_0xd902('0x49')]=function(_0x7ce7f8,_0x8219f0){var _0x334a28={'raw':!![],'where':{'id':_0x7ce7f8[_0xd902('0x4a')]['id']}},_0x2d468b={};_0x2d468b['model']=_['keys'](db[_0xd902('0x31')]['rawAttributes']);_0x2d468b[_0xd902('0x36')]=_[_0xd902('0x37')](_0x7ce7f8['query']);_0x2d468b[_0xd902('0x38')]=_[_0xd902('0x39')](_0x2d468b[_0xd902('0x34')],_0x2d468b[_0xd902('0x36')]);_0x334a28[_0xd902('0x3b')]=_[_0xd902('0x39')](_0x2d468b[_0xd902('0x34')],qs[_0xd902('0x3a')](_0x7ce7f8[_0xd902('0x36')][_0xd902('0x3a')]));_0x334a28[_0xd902('0x3b')]=_0x334a28[_0xd902('0x3b')]['length']?_0x334a28[_0xd902('0x3b')]:_0x2d468b['model'];if(_0x7ce7f8[_0xd902('0x36')][_0xd902('0x4b')]){_0x334a28[_0xd902('0x45')]=[{'all':!![]}];}_0x334a28=_[_0xd902('0x42')]({},_0x334a28,_0x7ce7f8[_0xd902('0x44')]);return db[_0xd902('0x31')][_0xd902('0x4c')](_0x334a28)['then'](handleEntityNotFound(_0x8219f0,null))[_0xd902('0x27')](respondWithResult(_0x8219f0,null))[_0xd902('0x48')](handleError(_0x8219f0,null));};exports[_0xd902('0x4d')]=function(_0x51b595,_0x20b625){return db[_0xd902('0x31')][_0xd902('0x4d')](_0x51b595[_0xd902('0x4e')],{})[_0xd902('0x27')](function(_0x56aea8){var _0x13acb5=_0x51b595[_0xd902('0x4f')][_0xd902('0x29')]({'plain':!![]});if(!_0x13acb5)throw new Error(_0xd902('0x50'));if(_0x13acb5[_0xd902('0x51')]===_0xd902('0x4f')){var _0x4ad198=_0x56aea8[_0xd902('0x29')]({'plain':!![]});var _0x30086c=_0xd902('0x2a');return db[_0xd902('0x52')][_0xd902('0x4c')]({'where':{'name':_0x30086c,'userProfileId':_0x13acb5['userProfileId']},'raw':!![]})[_0xd902('0x27')](function(_0xfdf943){if(_0xfdf943&&_0xfdf943[_0xd902('0x53')]===0x0){return db[_0xd902('0x2b')][_0xd902('0x4d')]({'name':_0x4ad198[_0xd902('0x2e')],'resourceId':_0x4ad198['id'],'type':_0xfdf943[_0xd902('0x2e')],'sectionId':_0xfdf943['id']},{})[_0xd902('0x27')](function(){return _0x56aea8;});}else{return _0x56aea8;}})[_0xd902('0x48')](function(_0x30a0dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30a0dd);throw _0x30a0dd;});}return _0x56aea8;})[_0xd902('0x27')](respondWithResult(_0x20b625,0xc9))[_0xd902('0x48')](handleError(_0x20b625,null));};exports[_0xd902('0x26')]=function(_0x5675ee,_0x5df8bd){if(_0x5675ee[_0xd902('0x4e')]['id']){delete _0x5675ee['body']['id'];}return db[_0xd902('0x31')][_0xd902('0x4c')]({'where':{'id':_0x5675ee[_0xd902('0x4a')]['id']}})[_0xd902('0x27')](handleEntityNotFound(_0x5df8bd,null))['then'](saveUpdates(_0x5675ee[_0xd902('0x4e')],null))['then'](respondWithResult(_0x5df8bd,null))[_0xd902('0x48')](handleError(_0x5df8bd,null));};exports['destroy']=function(_0x171302,_0x594436){return db[_0xd902('0x31')]['find']({'where':{'id':_0x171302['params']['id']}})['then'](handleEntityNotFound(_0x594436,null))['then'](removeEntity(_0x594436,null))[_0xd902('0x48')](handleError(_0x594436,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a328774..15c205c 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 _0x13be=['define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports'];(function(_0xd53f87,_0x16c6bd){var _0x190178=function(_0x4cc0ed){while(--_0x4cc0ed){_0xd53f87['push'](_0xd53f87['shift']());}};_0x190178(++_0x16c6bd);}(_0x13be,0x1e3));var _0xe13b=function(_0x54ae0d,_0xd4fae){_0x54ae0d=_0x54ae0d-0x0;var _0x456421=_0x13be[_0x54ae0d];return _0x456421;};'use strict';var _=require(_0xe13b('0x0'));var util=require(_0xe13b('0x1'));var logger=require(_0xe13b('0x2'))(_0xe13b('0x3'));var moment=require(_0xe13b('0x4'));var BPromise=require(_0xe13b('0x5'));var rp=require(_0xe13b('0x6'));var fs=require('fs');var path=require(_0xe13b('0x7'));var rimraf=require('rimraf');var config=require(_0xe13b('0x8'));var attributes=require(_0xe13b('0x9'));module[_0xe13b('0xa')]=function(_0x23de83,_0x426938){return _0x23de83[_0xe13b('0xb')]('Variable',attributes,{'tableName':_0xe13b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e53=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','tools_variables','lodash','util'];(function(_0x124c44,_0x3b8f29){var _0x4c85a7=function(_0x22c658){while(--_0x22c658){_0x124c44['push'](_0x124c44['shift']());}};_0x4c85a7(++_0x3b8f29);}(_0x5e53,0x6c));var _0x35e5=function(_0x3378c1,_0x48bb97){_0x3378c1=_0x3378c1-0x0;var _0x1e3821=_0x5e53[_0x3378c1];return _0x1e3821;};'use strict';var _=require(_0x35e5('0x0'));var util=require(_0x35e5('0x1'));var logger=require(_0x35e5('0x2'))(_0x35e5('0x3'));var moment=require('moment');var BPromise=require(_0x35e5('0x4'));var rp=require(_0x35e5('0x5'));var fs=require('fs');var path=require(_0x35e5('0x6'));var rimraf=require(_0x35e5('0x7'));var config=require(_0x35e5('0x8'));var attributes=require('./variable.attributes');module[_0x35e5('0x9')]=function(_0x36e589,_0x4b1670){return _0x36e589['define']('Variable',attributes,{'tableName':_0x35e5('0xa'),'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 252f578..f39f015 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x12c289,_0x3376b8){var _0x9e28d5=function(_0x33cb58){while(--_0x33cb58){_0x12c289['push'](_0x12c289['shift']());}};_0x9e28d5(++_0x3376b8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x58f99f,_0x59c1b0){_0x58f99f=_0x58f99f-0x0;var _0x2976e9=_0x1cb9[_0x58f99f];return _0x2976e9;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x326f,0xd1));var _0xf326=function(_0x804576,_0x2e12a4){_0x804576=_0x804576-0x0;var _0xb067f8=_0x326f[_0x804576];return _0xb067f8;};'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')]('Variable,\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')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 474a222..e7e5437 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 _0xe3f2=['get','/fetch','isAuthenticated','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index'];(function(_0x4e3b54,_0x1e6976){var _0x5e686=function(_0x145d22){while(--_0x145d22){_0x4e3b54['push'](_0x4e3b54['shift']());}};_0x5e686(++_0x1e6976);}(_0xe3f2,0x1ab));var _0x2e3f=function(_0x5e8b76,_0x198600){_0x5e8b76=_0x5e8b76-0x0;var _0x19ff83=_0xe3f2[_0x5e8b76];return _0x19ff83;};'use strict';var express=require(_0x2e3f('0x0'));var router=express[_0x2e3f('0x1')]();var auth=require(_0x2e3f('0x2'));var controller=require(_0x2e3f('0x3'));router['get']('/',controller[_0x2e3f('0x4')]);router[_0x2e3f('0x5')](_0x2e3f('0x6'),auth[_0x2e3f('0x7')](),auth[_0x2e3f('0x8')](),controller['fetch']);router[_0x2e3f('0x5')]('/reset',auth[_0x2e3f('0x7')](),auth[_0x2e3f('0x8')](),controller[_0x2e3f('0x9')]);router[_0x2e3f('0x5')](_0x2e3f('0xa'),auth['isAuthenticated'](),auth[_0x2e3f('0x8')](),controller[_0x2e3f('0xb')]);router['get'](_0x2e3f('0xc'),auth[_0x2e3f('0x7')](),controller['restart']);router[_0x2e3f('0x5')](_0x2e3f('0xd'),controller[_0x2e3f('0xe')]);module[_0x2e3f('0xf')]=router; \ No newline at end of file +var _0xe2f4=['index','/fetch','isAuthenticated','canUpdate','/pull','pull','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get'];(function(_0xbbc6a8,_0x17eb6d){var _0x598c4c=function(_0x266425){while(--_0x266425){_0xbbc6a8['push'](_0xbbc6a8['shift']());}};_0x598c4c(++_0x17eb6d);}(_0xe2f4,0x1a0));var _0x4e2f=function(_0x31aa1f,_0x42ef34){_0x31aa1f=_0x31aa1f-0x0;var _0x2b4c46=_0xe2f4[_0x31aa1f];return _0x2b4c46;};'use strict';var express=require('express');var router=express[_0x4e2f('0x0')]();var auth=require(_0x4e2f('0x1'));var controller=require(_0x4e2f('0x2'));router[_0x4e2f('0x3')]('/',controller[_0x4e2f('0x4')]);router[_0x4e2f('0x3')](_0x4e2f('0x5'),auth[_0x4e2f('0x6')](),auth[_0x4e2f('0x7')](),controller['fetch']);router[_0x4e2f('0x3')]('/reset',auth['isAuthenticated'](),auth[_0x4e2f('0x7')](),controller['reset']);router[_0x4e2f('0x3')](_0x4e2f('0x8'),auth[_0x4e2f('0x6')](),auth[_0x4e2f('0x7')](),controller[_0x4e2f('0x9')]);router[_0x4e2f('0x3')](_0x4e2f('0xa'),auth[_0x4e2f('0x6')](),controller[_0x4e2f('0xb')]);router[_0x4e2f('0x3')](_0x4e2f('0xc'),controller[_0x4e2f('0xd')]);module[_0x4e2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d89fb0a..c62f5b4 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 _0x1ae7=['../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','length','replace','.js','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','compare-versions','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1ae7,0x86));var _0x71ae=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x1ae7[_0x3054be];return _0x3df150;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x71ae('0x0'));var pkginfo=require(_0x71ae('0x1'))(module,'version');var compareVersions=require(_0x71ae('0x2'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x71ae('0x3'));var pm2=require(_0x71ae('0x4'));var logger=require(_0x71ae('0x5'))(_0x71ae('0x6'));var git=require(_0x71ae('0x7'))(config[_0x71ae('0x8')]);exports[_0x71ae('0x9')]=function(_0x5f5b18,_0x59449f){var _0x134095={'current':module[_0x71ae('0xa')][_0x71ae('0xb')],'phonebar':0x2};if(_0x5f5b18['query']&&_0x5f5b18[_0x71ae('0xc')][_0x71ae('0xd')]){return git[_0x71ae('0xe')]()[_0x71ae('0xf')](function(_0x1479a9,_0x10b3e2){_0x134095[_0x71ae('0xd')]=(_0x1479a9?module['exports'][_0x71ae('0xb')]:_0x10b3e2[_0x71ae('0xd')])||_0x71ae('0x10');return _0x59449f['status'](0xc8)['json'](_0x134095);});}else{return _0x59449f[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')](_0x134095);}};exports['fetch']=function(_0x1f8fdb,_0x1778f9){return git[_0x71ae('0xe')]([_0x71ae('0x13'),_0x71ae('0x14')],function(_0x7094e5){if(_0x7094e5){logger[_0x71ae('0x15')](_0x7094e5);return _0x1778f9['status'](0x1f4)['json'](_0x7094e5);}logger[_0x71ae('0x16')](_0x71ae('0x17'));return _0x1778f9[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x71ae('0x18')]=function(_0x1f294b,_0xae5e50){return git['reset'](['--hard',_0x71ae('0x19')],function(_0x55ec57){if(_0x55ec57){logger['error'](_0x55ec57);return _0xae5e50[_0x71ae('0x11')](0x1f4)[_0x71ae('0x12')](_0x55ec57);}logger['info'](_0x71ae('0x1a'));return _0xae5e50[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x2bf133,_0x4baee1){exec('npm\x20install\x20--production',function(_0x1542b0,_0x442f4f,_0x3e990f){logger[_0x71ae('0x16')](_0x442f4f);logger['info'](_0x3e990f);if(_0x1542b0){logger[_0x71ae('0x15')](_0x1542b0);return _0x4baee1[_0x71ae('0x11')](0x1f4)[_0x71ae('0x12')](_0x1542b0);}return _0x4baee1['status'](0xc8)[_0x71ae('0x12')]({'output':_0x442f4f});});};exports['restart']=function(_0x92075d,_0x1a6330){return pm2['restart']('motion2')[_0x71ae('0x1b')](function(_0x53a9c1){logger['info'](_0x71ae('0x1c'),_0x53a9c1);return _0x1a6330['status'](0xc8)[_0x71ae('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x71ae('0x1d')](function(_0x345338){logger[_0x71ae('0x15')](_0x345338);return _0x1a6330['status'](0x1f4)['json'](_0x345338);});};exports[_0x71ae('0x1e')]=function(_0x334691,_0x20e6dd){var _0x288193=fs['readdirSync'](path[_0x71ae('0x1f')](config['root'],'server',_0x71ae('0x1e')));var _0x42b663=[];for(var _0x28322a=0x0;_0x28322a<_0x288193[_0x71ae('0x20')];_0x28322a++){var _0x4a0486=_0x288193[_0x28322a][_0x71ae('0x21')](_0x71ae('0x22'),'');if(compareVersions(module[_0x71ae('0xa')][_0x71ae('0xb')],_0x4a0486)===-0x1){_0x42b663[_0x71ae('0x23')](_0x4a0486);}}if(_0x42b663['length']){var _0xf851f9=_0x42b663['sort'](compareVersions);var _0x2af475=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x71ae('0x24')],'modelName':_0x71ae('0x24'),'columnName':_0x71ae('0xb')},'migrations':{'params':[db[_0x71ae('0x25')][_0x71ae('0x26')](),db[_0x71ae('0x25')][_0x71ae('0x27')],function(){throw new Error(_0x71ae('0x28'));}],'path':path['join'](config['root'],_0x71ae('0x29'),'migrations'),'pattern':/\.js$/}});_0x2af475['up']({'migrations':_['map'](_0xf851f9,function(_0x4419c6){return _0x4419c6+'.js';})})['then'](function(){return _0x20e6dd[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x71ae('0x2a')+_[_0x71ae('0x2b')](_0xf851f9),'migrations':_['join'](_0xf851f9)});})[_0x71ae('0x1d')](function(_0x242c8c){if(_0x242c8c instanceof db[_0x71ae('0x25')][_0x71ae('0x2c')]){return _0x20e6dd[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x20e6dd['status'](0x1f4)['json'](_0x242c8c);}});}else{return _0x20e6dd[_0x71ae('0x11')](0xc8)['json']({'output':_0x71ae('0x2d')});}}; \ No newline at end of file +var _0x90cc=['../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2'];(function(_0x5d3878,_0xc64460){var _0x4be8b9=function(_0x4756a2){while(--_0x4756a2){_0x5d3878['push'](_0x5d3878['shift']());}};_0x4be8b9(++_0xc64460);}(_0x90cc,0xc8));var _0xc90c=function(_0x2a9f03,_0x4ebaad){_0x2a9f03=_0x2a9f03-0x0;var _0x1bd245=_0x90cc[_0x2a9f03];return _0x1bd245;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xc90c('0x0'));var pkginfo=require(_0xc90c('0x1'))(module,_0xc90c('0x2'));var compareVersions=require(_0xc90c('0x3'));var exec=require(_0xc90c('0x4'))[_0xc90c('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xc90c('0x6'));var pm2=require(_0xc90c('0x7'));var logger=require(_0xc90c('0x8'))(_0xc90c('0x9'));var git=require(_0xc90c('0xa'))(config[_0xc90c('0xb')]);exports[_0xc90c('0xc')]=function(_0x33cca7,_0x49ccf2){var _0x578a97={'current':module[_0xc90c('0xd')][_0xc90c('0x2')],'phonebar':0x2};if(_0x33cca7['query']&&_0x33cca7[_0xc90c('0xe')][_0xc90c('0xf')]){return git[_0xc90c('0x10')]()[_0xc90c('0x11')](function(_0x3fd8e3,_0x419638){_0x578a97[_0xc90c('0xf')]=(_0x3fd8e3?module[_0xc90c('0xd')]['version']:_0x419638['latest'])||'2.0.0';return _0x49ccf2[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')](_0x578a97);});}else{return _0x49ccf2[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')](_0x578a97);}};exports[_0xc90c('0x10')]=function(_0x474b1d,_0x3f9615){return git[_0xc90c('0x10')]([_0xc90c('0x14'),_0xc90c('0x15')],function(_0x45f586){if(_0x45f586){logger[_0xc90c('0x16')](_0x45f586);return _0x3f9615['status'](0x1f4)[_0xc90c('0x13')](_0x45f586);}logger['info'](_0xc90c('0x17'));return _0x3f9615['status'](0xc8)[_0xc90c('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc90c('0x18')]=function(_0x496668,_0xefe79a){return git[_0xc90c('0x18')]([_0xc90c('0x19'),_0xc90c('0x1a')],function(_0x21d1e5){if(_0x21d1e5){logger[_0xc90c('0x16')](_0x21d1e5);return _0xefe79a[_0xc90c('0x12')](0x1f4)['json'](_0x21d1e5);}logger[_0xc90c('0x1b')](_0xc90c('0x1c'));return _0xefe79a[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')]({'output':_0xc90c('0x1d')});});};exports[_0xc90c('0x1e')]=function(_0x5c1901,_0x4ff18d){exec(_0xc90c('0x1f'),function(_0x512bac,_0x4aec5e,_0x4f41cd){logger['info'](_0x4aec5e);logger['info'](_0x4f41cd);if(_0x512bac){logger[_0xc90c('0x16')](_0x512bac);return _0x4ff18d[_0xc90c('0x12')](0x1f4)[_0xc90c('0x13')](_0x512bac);}return _0x4ff18d[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')]({'output':_0x4aec5e});});};exports[_0xc90c('0x20')]=function(_0x4589a0,_0x5d0c2f){return pm2['restart'](_0xc90c('0x21'))[_0xc90c('0x22')](function(_0x37b250){logger[_0xc90c('0x1b')]('pm2\x20restart\x20motion\x20%s',_0x37b250);return _0x5d0c2f['status'](0xc8)['json']({'output':_0xc90c('0x23')});})[_0xc90c('0x24')](function(_0x380b14){logger[_0xc90c('0x16')](_0x380b14);return _0x5d0c2f['status'](0x1f4)[_0xc90c('0x13')](_0x380b14);});};exports[_0xc90c('0x25')]=function(_0x1e0e72,_0x420a5d){var _0x288da4=fs[_0xc90c('0x26')](path[_0xc90c('0x27')](config[_0xc90c('0xb')],_0xc90c('0x28'),_0xc90c('0x25')));var _0x8c89be=[];for(var _0x58035e=0x0;_0x58035e<_0x288da4[_0xc90c('0x29')];_0x58035e++){var _0x5562d9=_0x288da4[_0x58035e]['replace'](_0xc90c('0x2a'),'');if(compareVersions(module[_0xc90c('0xd')]['version'],_0x5562d9)===-0x1){_0x8c89be[_0xc90c('0x2b')](_0x5562d9);}}if(_0x8c89be[_0xc90c('0x29')]){var _0x5ddda5=_0x8c89be[_0xc90c('0x2c')](compareVersions);var _0x3f2702=new Umzug({'storage':_0xc90c('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0xc90c('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xc90c('0x2d')][_0xc90c('0x2f')](),db[_0xc90c('0x2d')][_0xc90c('0x30')],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['join'](config[_0xc90c('0xb')],'server',_0xc90c('0x25')),'pattern':/\.js$/}});_0x3f2702['up']({'migrations':_[_0xc90c('0x31')](_0x5ddda5,function(_0x7977c){return _0x7977c+'.js';})})[_0xc90c('0x22')](function(){return _0x420a5d[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')]({'output':_0xc90c('0x32')+module[_0xc90c('0xd')][_0xc90c('0x2')]+'\x20to\x20'+_['last'](_0x5ddda5),'migrations':_['join'](_0x5ddda5)});})[_0xc90c('0x24')](function(_0x5f2fab){if(_0x5f2fab instanceof db[_0xc90c('0x2d')]['UniqueConstraintError']){return _0x420a5d[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x420a5d[_0xc90c('0x12')](0x1f4)['json'](_0x5f2fab);}});}else{return _0x420a5d[_0xc90c('0x12')](0xc8)[_0xc90c('0x13')]({'output':_0xc90c('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d231bcd..e2a18e4 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 _0xd202=['fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd202,0x18b));var _0x2d20=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xd202[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var path=require(_0x2d20('0x2'));var timeout=require(_0x2d20('0x3'));var express=require(_0x2d20('0x4'));var router=express['Router']();var fs_extra=require(_0x2d20('0x5'));var auth=require(_0x2d20('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2d20('0x7'));router[_0x2d20('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d20('0x9')]);router[_0x2d20('0x8')](_0x2d20('0xa'),auth['isAuthenticated'](),controller[_0x2d20('0xb')]);router[_0x2d20('0x8')](_0x2d20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2d20('0xd')]('/',auth[_0x2d20('0xe')](),controller[_0x2d20('0xf')]);router[_0x2d20('0x10')](_0x2d20('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2d20('0x11')]('/:id',auth[_0x2d20('0xe')](),controller[_0x2d20('0x12')]);module[_0x2d20('0x13')]=router; \ No newline at end of file +var _0x3185=['../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x49e838,_0x4d36a4){var _0x31db07=function(_0x7b8a6a){while(--_0x7b8a6a){_0x49e838['push'](_0x49e838['shift']());}};_0x31db07(++_0x4d36a4);}(_0x3185,0xf6));var _0x5318=function(_0x3c902b,_0x12e11c){_0x3c902b=_0x3c902b-0x0;var _0x5c785a=_0x3185[_0x3c902b];return _0x5c785a;};'use strict';var multer=require(_0x5318('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5318('0x1'));var express=require(_0x5318('0x2'));var router=express[_0x5318('0x3')]();var fs_extra=require(_0x5318('0x4'));var auth=require(_0x5318('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5318('0x6'));var controller=require(_0x5318('0x7'));router[_0x5318('0x8')]('/',auth[_0x5318('0x9')](),controller['index']);router['get'](_0x5318('0xa'),auth[_0x5318('0x9')](),controller[_0x5318('0xb')]);router[_0x5318('0x8')](_0x5318('0xc'),auth[_0x5318('0x9')](),controller[_0x5318('0xd')]);router[_0x5318('0xe')]('/',auth[_0x5318('0x9')](),controller[_0x5318('0xf')]);router[_0x5318('0x10')](_0x5318('0xc'),auth[_0x5318('0x9')](),controller[_0x5318('0x11')]);router[_0x5318('0x12')](_0x5318('0xc'),auth[_0x5318('0x9')](),controller[_0x5318('0x13')]);module[_0x5318('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index fca5d32..2d43689 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 _0x9c1d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x219483,_0x552f66){var _0x334fd8=function(_0x3fdb67){while(--_0x3fdb67){_0x219483['push'](_0x219483['shift']());}};_0x334fd8(++_0x552f66);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x519327,_0x568002){_0x519327=_0x519327-0x0;var _0x221014=_0x9c1d[_0x519327];return _0x221014;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'type':{'type':Sequelize[_0xd9c1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'calleridname':{'type':Sequelize[_0xd9c1('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd9c1('0x2')]},'membername':{'type':Sequelize[_0xd9c1('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd9c1('0x3')]},'holdtime':{'type':Sequelize[_0xd9c1('0x4')]},'agentcomplete':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9c1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9c1('0x4')]},'reason':{'type':Sequelize[_0xd9c1('0x2')]},'lastevent':{'type':Sequelize[_0xd9c1('0x2')]},'channel':{'type':Sequelize[_0xd9c1('0x2')]},'channelstate':{'type':Sequelize[_0xd9c1('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9c1('0x2')]},'accountcode':{'type':Sequelize[_0xd9c1('0x2')]},'context':{'type':Sequelize[_0xd9c1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd9c1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9c1('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridname':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd9c1('0x2')]},'destlanguage':{'type':Sequelize[_0xd9c1('0x2')]},'destaccountcode':{'type':Sequelize[_0xd9c1('0x2')]},'destcontext':{'type':Sequelize[_0xd9c1('0x2')]},'destexten':{'type':Sequelize[_0xd9c1('0x2')]},'destpriority':{'type':Sequelize[_0xd9c1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd9c1('0x2')]},'transfer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9c1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'agententerreason':{'type':Sequelize[_0xd9c1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b17=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b17,0x10f));var _0x74b1=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x4b17[_0x1dac7a];return _0x4cb363;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'type':{'type':Sequelize[_0x74b1('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x74b1('0x1')]},'calleridname':{'type':Sequelize[_0x74b1('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x74b1('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x74b1('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x74b1('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x74b1('0x2')]},'agentdumpAt':{'type':Sequelize[_0x74b1('0x2')]},'holdtime':{'type':Sequelize[_0x74b1('0x3')]},'agentcomplete':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x74b1('0x3')]},'agentacw':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x74b1('0x3')]},'reason':{'type':Sequelize[_0x74b1('0x1')]},'lastevent':{'type':Sequelize[_0x74b1('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x74b1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x74b1('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x74b1('0x1')]},'language':{'type':Sequelize[_0x74b1('0x1')]},'accountcode':{'type':Sequelize[_0x74b1('0x1')]},'context':{'type':Sequelize[_0x74b1('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x74b1('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x74b1('0x1')]},'destcalleridnum':{'type':Sequelize[_0x74b1('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x74b1('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x74b1('0x1')]},'destpriority':{'type':Sequelize[_0x74b1('0x1')]},'destuniqueid':{'type':Sequelize[_0x74b1('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x74b1('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x74b1('0x1')]},'transfer':{'type':Sequelize[_0x74b1('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x74b1('0x5')},'transferexten':{'type':Sequelize[_0x74b1('0x1')]},'transferuniqueid':{'type':Sequelize[_0x74b1('0x1')]},'agententerreason':{'type':Sequelize[_0x74b1('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index c3626f3..9ae0552 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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 20edce5..640cb6d 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 _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash'];(function(_0x1214dd,_0x19090b){var _0x2cfd8a=function(_0x477d32){while(--_0x477d32){_0x1214dd['push'](_0x1214dd['shift']());}};_0x2cfd8a(++_0x19090b);}(_0x9649,0x19f));var _0x9964=function(_0x197e7e,_0x1c1bf0){_0x197e7e=_0x197e7e-0x0;var _0x48ecf2=_0x9649[_0x197e7e];return _0x48ecf2;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9964('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39c7=['destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','define','uniqueid'];(function(_0x2acf33,_0x4184a1){var _0x57555d=function(_0x3b909c){while(--_0x3b909c){_0x2acf33['push'](_0x2acf33['shift']());}};_0x57555d(++_0x4184a1);}(_0x39c7,0x85));var _0x739c=function(_0x4c2c72,_0x295857){_0x4c2c72=_0x4c2c72-0x0;var _0x13e980=_0x39c7[_0x4c2c72];return _0x13e980;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var logger=require(_0x739c('0x1'))(_0x739c('0x2'));var moment=require(_0x739c('0x3'));var BPromise=require(_0x739c('0x4'));var rp=require(_0x739c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x739c('0x6'));var config=require(_0x739c('0x7'));var attributes=require(_0x739c('0x8'));module['exports']=function(_0x4c5030,_0x1923d9){return _0x4c5030[_0x739c('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x739c('0xa'),_0x739c('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 ee6b3d1..d2ac304 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 _0x02a3=['where','attributes','limit','UpdateVoiceAgentReport','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','body'];(function(_0x185c4c,_0x3f9923){var _0x584882=function(_0x3bf6ff){while(--_0x3bf6ff){_0x185c4c['push'](_0x185c4c['shift']());}};_0x584882(++_0x3f9923);}(_0x02a3,0x1a9));var _0x302a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x02a3[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x302a('0x0'));var moment=require(_0x302a('0x1'));var BPromise=require(_0x302a('0x2'));var rs=require(_0x302a('0x3'));var fs=require('fs');var Redis=require(_0x302a('0x4'));var db=require(_0x302a('0x5'))['db'];var utils=require(_0x302a('0x6'));var logger=require(_0x302a('0x7'))(_0x302a('0x8'));var config=require('../../config/environment');var jayson=require(_0x302a('0x9'));var client=jayson[_0x302a('0xa')][_0x302a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f5e2,_0x418879,_0x445989){return new BPromise(function(_0x328db4,_0x2a54f8){return client[_0x302a('0xc')](_0x35f5e2,_0x445989)[_0x302a('0xd')](function(_0x5d8056){logger[_0x302a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x302a('0xf'));logger[_0x302a('0x10')](_0x302a('0x11'),_0x418879,_0x302a('0xf'),JSON['stringify'](_0x5d8056));if(_0x5d8056[_0x302a('0x12')]){if(_0x5d8056[_0x302a('0x12')][_0x302a('0x13')]===0x1f4){logger[_0x302a('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x2a54f8(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}logger[_0x302a('0x12')](_0x302a('0x15'),_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x328db4(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}else{logger[_0x302a('0xe')](_0x302a('0x15'),_0x418879,'request\x20sent');_0x328db4(_0x5d8056[_0x302a('0x16')][_0x302a('0x14')]);}})[_0x302a('0x17')](function(_0x3fc4d7){logger['error'](_0x302a('0x15'),_0x418879,_0x3fc4d7);_0x2a54f8(_0x3fc4d7);});});}exports['CreateVoiceAgentReport']=function(_0x27d7a6){var _0x2aefe6=this;return new Promise(function(_0x2a763e,_0x1cef13){return db[_0x302a('0x18')][_0x302a('0x19')](_0x27d7a6['body'],{'raw':_0x27d7a6['options']?_0x27d7a6[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![]})[_0x302a('0xd')](function(_0x3b7542){logger[_0x302a('0xe')](_0x302a('0x1c'),_0x27d7a6);logger['debug'](_0x302a('0x1c'),_0x27d7a6,JSON['stringify'](_0x3b7542));_0x2a763e(_0x3b7542);})[_0x302a('0x17')](function(_0x405339){logger[_0x302a('0x12')](_0x302a('0x1c'),_0x405339[_0x302a('0x14')],_0x27d7a6);_0x1cef13(_0x2aefe6['error'](0x1f4,_0x405339[_0x302a('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x41d0b5){var _0x48577f=this;return new Promise(function(_0x324041,_0x5d62f8){return db[_0x302a('0x18')]['update'](_0x41d0b5[_0x302a('0x1d')],{'raw':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d0b5[_0x302a('0x1a')]?_0x41d0b5['options'][_0x302a('0x1e')]||null:null,'attributes':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1f')]||null:null,'limit':_0x41d0b5['options']?_0x41d0b5['options'][_0x302a('0x20')]||null:null})[_0x302a('0xd')](function(_0x1d3a29){logger[_0x302a('0xe')](_0x302a('0x21'),_0x41d0b5);logger[_0x302a('0x10')]('UpdateVoiceAgentReport',_0x41d0b5,JSON[_0x302a('0x22')](_0x1d3a29));_0x324041(_0x1d3a29);})[_0x302a('0x17')](function(_0x20ef7b){logger[_0x302a('0x12')](_0x302a('0x21'),_0x20ef7b[_0x302a('0x14')],_0x41d0b5);_0x5d62f8(_0x48577f[_0x302a('0x12')](0x1f4,_0x20ef7b[_0x302a('0x14')]));});});}; \ No newline at end of file +var _0xb53e=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','debug','stringify','update','where','attributes','limit','UpdateVoiceAgentReport','lodash'];(function(_0x301bee,_0x91a563){var _0x3fbdbc=function(_0x4a7222){while(--_0x4a7222){_0x301bee['push'](_0x301bee['shift']());}};_0x3fbdbc(++_0x91a563);}(_0xb53e,0x1db));var _0xeb53=function(_0x555e37,_0x44c858){_0x555e37=_0x555e37-0x0;var _0xcd685f=_0xb53e[_0x555e37];return _0xcd685f;};'use strict';var _=require(_0xeb53('0x0'));var util=require(_0xeb53('0x1'));var moment=require(_0xeb53('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb53('0x4'));var logger=require(_0xeb53('0x5'))(_0xeb53('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xeb53('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33bb9a,_0x55fbc1,_0x47e85c){return new BPromise(function(_0xe6854a,_0x5a57a2){return client['request'](_0x33bb9a,_0x47e85c)[_0xeb53('0x8')](function(_0x1c05ef){logger[_0xeb53('0x9')](_0xeb53('0xa'),_0x55fbc1,_0xeb53('0xb'));logger['debug'](_0xeb53('0xc'),_0x55fbc1,'request\x20sent',JSON['stringify'](_0x1c05ef));if(_0x1c05ef['error']){if(_0x1c05ef[_0xeb53('0xd')]['code']===0x1f4){logger[_0xeb53('0xd')](_0xeb53('0xa'),_0x55fbc1,_0x1c05ef[_0xeb53('0xd')][_0xeb53('0xe')]);return _0x5a57a2(_0x1c05ef['error'][_0xeb53('0xe')]);}logger[_0xeb53('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x55fbc1,_0x1c05ef[_0xeb53('0xd')][_0xeb53('0xe')]);return _0xe6854a(_0x1c05ef['error'][_0xeb53('0xe')]);}else{logger[_0xeb53('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x55fbc1,_0xeb53('0xb'));_0xe6854a(_0x1c05ef['result'][_0xeb53('0xe')]);}})[_0xeb53('0xf')](function(_0x5e8fb1){logger[_0xeb53('0xd')](_0xeb53('0xa'),_0x55fbc1,_0x5e8fb1);_0x5a57a2(_0x5e8fb1);});});}exports['CreateVoiceAgentReport']=function(_0x3a0118){var _0x4b9052=this;return new Promise(function(_0x1b9628,_0x6dc8f6){return db[_0xeb53('0x10')]['create'](_0x3a0118[_0xeb53('0x11')],{'raw':_0x3a0118[_0xeb53('0x12')]?_0x3a0118[_0xeb53('0x12')][_0xeb53('0x13')]===undefined?!![]:![]:!![]})[_0xeb53('0x8')](function(_0x14e20e){logger['info'](_0xeb53('0x14'),_0x3a0118);logger[_0xeb53('0x15')]('CreateVoiceAgentReport',_0x3a0118,JSON[_0xeb53('0x16')](_0x14e20e));_0x1b9628(_0x14e20e);})['catch'](function(_0x34ac11){logger['error']('CreateVoiceAgentReport',_0x34ac11[_0xeb53('0xe')],_0x3a0118);_0x6dc8f6(_0x4b9052[_0xeb53('0xd')](0x1f4,_0x34ac11[_0xeb53('0xe')]));});});};exports['UpdateVoiceAgentReport']=function(_0x10ca28){var _0x2ab626=this;return new Promise(function(_0x2900d9,_0x2f15e4){return db[_0xeb53('0x10')][_0xeb53('0x17')](_0x10ca28[_0xeb53('0x11')],{'raw':_0x10ca28[_0xeb53('0x12')]?_0x10ca28[_0xeb53('0x12')][_0xeb53('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ca28[_0xeb53('0x12')]?_0x10ca28[_0xeb53('0x12')][_0xeb53('0x18')]||null:null,'attributes':_0x10ca28['options']?_0x10ca28[_0xeb53('0x12')][_0xeb53('0x19')]||null:null,'limit':_0x10ca28[_0xeb53('0x12')]?_0x10ca28[_0xeb53('0x12')][_0xeb53('0x1a')]||null:null})[_0xeb53('0x8')](function(_0x16da12){logger['info']('UpdateVoiceAgentReport',_0x10ca28);logger['debug']('UpdateVoiceAgentReport',_0x10ca28,JSON[_0xeb53('0x16')](_0x16da12));_0x2900d9(_0x16da12);})[_0xeb53('0xf')](function(_0x24c08f){logger[_0xeb53('0xd')](_0xeb53('0x1b'),_0x24c08f[_0xeb53('0xe')],_0x10ca28);_0x2f15e4(_0x2ab626[_0xeb53('0xd')](0x1f4,_0x24c08f[_0xeb53('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e8e6545..32c4a63 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 _0xc3b5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','path','connect-timeout','express'];(function(_0x2be187,_0x4abbf0){var _0x5bf334=function(_0xfe9ae6){while(--_0xfe9ae6){_0x2be187['push'](_0x2be187['shift']());}};_0x5bf334(++_0x4abbf0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x40bc31,_0x48a243){_0x40bc31=_0x40bc31-0x0;var _0x30f10e=_0xc3b5[_0x40bc31];return _0x30f10e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./voiceCallReport.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xb')]);router['get'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x11')]);router['delete'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller['destroy']);module[_0x5c3b('0x12')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x42e186,_0x40ee6b){var _0x3b36c4=function(_0xf4c536){while(--_0xf4c536){_0x42e186['push'](_0x42e186['shift']());}};_0x3b36c4(++_0x40ee6b);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5b2c50,_0x4db66b){_0x5b2c50=_0x5b2c50-0x0;var _0x47f2f9=_0xd0bb[_0x5b2c50];return _0x47f2f9;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9ccf59f..b4eab46 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 _0xe8f9=['inbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x15b75c,_0x52f837){var _0x1fb570=function(_0x176eec){while(--_0x176eec){_0x15b75c['push'](_0x15b75c['shift']());}};_0x1fb570(++_0x52f837);}(_0xe8f9,0x73));var _0x9e8f=function(_0x43afda,_0x432a32){_0x43afda=_0x43afda-0x0;var _0x20e8e5=_0xe8f9[_0x43afda];return _0x20e8e5;};'use strict';var Sequelize=require('sequelize');module[_0x9e8f('0x0')]={'uniqueid':{'type':Sequelize[_0x9e8f('0x1')]},'type':{'type':Sequelize[_0x9e8f('0x2')](_0x9e8f('0x3'),_0x9e8f('0x4'),_0x9e8f('0x5'),_0x9e8f('0x6'),'outbound-fax',_0x9e8f('0x7'))},'tag':{'type':Sequelize[_0x9e8f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9e8f('0x1')]},'destination':{'type':Sequelize[_0x9e8f('0x1')]},'destinationcontext':{'type':Sequelize[_0x9e8f('0x1')]},'callerid':{'type':Sequelize[_0x9e8f('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x9e8f('0x1')]},'lastapplication':{'type':Sequelize[_0x9e8f('0x1')]},'lastdata':{'type':Sequelize[_0x9e8f('0x8')]},'starttime':{'type':Sequelize[_0x9e8f('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9e8f('0x9')]},'endtime':{'type':Sequelize[_0x9e8f('0x9')]},'duration':{'type':Sequelize[_0x9e8f('0xa')]},'billableseconds':{'type':Sequelize[_0x9e8f('0xa')]},'mohtime':{'type':Sequelize[_0x9e8f('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9e8f('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9e8f('0x1')]},'userDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'note':{'type':Sequelize[_0x9e8f('0x1')]},'prefix':{'type':Sequelize[_0x9e8f('0x1')]},'routeid':{'type':Sequelize[_0x9e8f('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd472=['exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x3ec45b,_0x438d73){var _0x2c8b12=function(_0x314b68){while(--_0x314b68){_0x3ec45b['push'](_0x3ec45b['shift']());}};_0x2c8b12(++_0x438d73);}(_0xd472,0x1eb));var _0x2d47=function(_0x2e7323,_0x524e79){_0x2e7323=_0x2e7323-0x0;var _0x58a813=_0xd472[_0x2e7323];return _0x58a813;};'use strict';var Sequelize=require(_0x2d47('0x0'));module[_0x2d47('0x1')]={'uniqueid':{'type':Sequelize[_0x2d47('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2d47('0x3'),_0x2d47('0x4'),_0x2d47('0x5'),_0x2d47('0x6'),_0x2d47('0x7'),_0x2d47('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x2d47('0x2')]},'destination':{'type':Sequelize[_0x2d47('0x2')]},'destinationcontext':{'type':Sequelize[_0x2d47('0x2')]},'callerid':{'type':Sequelize[_0x2d47('0x2')]},'channel':{'type':Sequelize[_0x2d47('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2d47('0x2')]},'lastdata':{'type':Sequelize[_0x2d47('0x9')]},'starttime':{'type':Sequelize[_0x2d47('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2d47('0xa')]},'duration':{'type':Sequelize[_0x2d47('0xb')]},'billableseconds':{'type':Sequelize[_0x2d47('0xb')]},'mohtime':{'type':Sequelize[_0x2d47('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2d47('0x2')]},'userfield':{'type':Sequelize[_0x2d47('0x2')]},'userDisposition':{'type':Sequelize[_0x2d47('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x2d47('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x2d47('0x2')]},'note':{'type':Sequelize[_0x2d47('0x2')]},'prefix':{'type':Sequelize[_0x2d47('0x2')]},'routeid':{'type':Sequelize[_0x2d47('0xb')]},'sipcallid':{'type':Sequelize[_0x2d47('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 0fb89a6..82e5b14 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x179388,_0x4c4ce3){_0x179388=_0x179388-0x0;var _0xaa9a2f=_0x5f2f[_0x179388];return _0xaa9a2f;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x57c48a,_0xf38316){var _0x5af402=function(_0x163d4c){while(--_0x163d4c){_0x57c48a['push'](_0x57c48a['shift']());}};_0x5af402(++_0xf38316);}(_0x0b0e,0x187));var _0xe0b0=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x0b0e[_0x492af5];return _0x59f529;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1782e56..00eaa8d 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 _0x4e16=['VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4e16,0x1ee));var _0x64e1=function(_0x5b3e50,_0xa7a3cb){_0x5b3e50=_0x5b3e50-0x0;var _0x89a0c9=_0x4e16[_0x5b3e50];return _0x89a0c9;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var logger=require(_0x64e1('0x2'))(_0x64e1('0x3'));var moment=require(_0x64e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x64e1('0x5'));var fs=require('fs');var path=require(_0x64e1('0x6'));var rimraf=require(_0x64e1('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x64e1('0x8')]=function(_0x58dad6,_0x4f05ae){return _0x58dad6[_0x64e1('0x9')](_0x64e1('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x64e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9f9=['moment','bluebird','request-promise','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xd9f9,0xcc));var _0x9d9f=function(_0x1d240e,_0x303b04){_0x1d240e=_0x1d240e-0x0;var _0x59ca9b=_0xd9f9[_0x1d240e];return _0x59ca9b;};'use strict';var _=require(_0x9d9f('0x0'));var util=require(_0x9d9f('0x1'));var logger=require(_0x9d9f('0x2'))(_0x9d9f('0x3'));var moment=require(_0x9d9f('0x4'));var BPromise=require(_0x9d9f('0x5'));var rp=require(_0x9d9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d9f('0x7'));module[_0x9d9f('0x8')]=function(_0x506f5c,_0x2596b8){return _0x506f5c[_0x9d9f('0x9')](_0x9d9f('0xa'),attributes,{'tableName':_0x9d9f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9d9f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a688b4b..e8857f1 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 _0x4094=['../../config/environment','http','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','model','attributes','map','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f2981,_0x5d9e82){var _0x4ae493=function(_0x53537c){while(--_0x53537c){_0x3f2981['push'](_0x3f2981['shift']());}};_0x4ae493(++_0x5d9e82);}(_0x4094,0x174));var _0x4409=function(_0x1086ef,_0x5cc2c9){_0x1086ef=_0x1086ef-0x0;var _0x56a797=_0x4094[_0x1086ef];return _0x56a797;};'use strict';var _=require(_0x4409('0x0'));var util=require(_0x4409('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4409('0x2'));var fs=require('fs');var Redis=require(_0x4409('0x3'));var db=require(_0x4409('0x4'))['db'];var utils=require(_0x4409('0x5'));var logger=require(_0x4409('0x6'))(_0x4409('0x7'));var config=require(_0x4409('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4409('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc53e,_0x35cbb0,_0x40e6fc){return new BPromise(function(_0x2962e3,_0x4e862a){return client['request'](_0x1fc53e,_0x40e6fc)[_0x4409('0xa')](function(_0x18436b){logger[_0x4409('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x35cbb0,'request\x20sent');logger[_0x4409('0xc')](_0x4409('0xd'),_0x35cbb0,'request\x20sent',JSON[_0x4409('0xe')](_0x18436b));if(_0x18436b['error']){if(_0x18436b[_0x4409('0xf')][_0x4409('0x10')]===0x1f4){logger[_0x4409('0xf')](_0x4409('0x11'),_0x35cbb0,_0x18436b['error'][_0x4409('0x12')]);return _0x4e862a(_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);}logger[_0x4409('0xf')](_0x4409('0x11'),_0x35cbb0,_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);return _0x2962e3(_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);}else{logger['info'](_0x4409('0x11'),_0x35cbb0,_0x4409('0x13'));_0x2962e3(_0x18436b[_0x4409('0x14')][_0x4409('0x12')]);}})[_0x4409('0x15')](function(_0x4a937d){logger['error'](_0x4409('0x11'),_0x35cbb0,_0x4a937d);_0x4e862a(_0x4a937d);});});}exports[_0x4409('0x16')]=function(_0x6b893f){var _0xfb12f9=this;return new Promise(function(_0x24acf7,_0x4aa909){return db[_0x4409('0x17')][_0x4409('0x18')]({'raw':_0x6b893f[_0x4409('0x19')]?_0x6b893f['options'][_0x4409('0x1a')]===undefined?!![]:![]:!![],'where':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')][_0x4409('0x1b')]||null:null,'attributes':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')]['attributes']||null:null,'limit':_0x6b893f['options']?_0x6b893f[_0x4409('0x19')][_0x4409('0x1c')]||null:null,'include':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')][_0x4409('0x1d')]?_['map'](_0x6b893f[_0x4409('0x19')][_0x4409('0x1d')],function(_0x1dc713){return{'model':db[_0x1dc713['model']],'as':_0x1dc713['as'],'attributes':_0x1dc713['attributes'],'include':_0x1dc713[_0x4409('0x1d')]?_['map'](_0x1dc713[_0x4409('0x1d')],function(_0x5acb31){return{'model':db[_0x5acb31[_0x4409('0x1e')]],'as':_0x5acb31['as'],'attributes':_0x5acb31[_0x4409('0x1f')],'include':_0x5acb31[_0x4409('0x1d')]?_[_0x4409('0x20')](_0x5acb31[_0x4409('0x1d')],function(_0x559fe3){return{'model':db[_0x559fe3[_0x4409('0x1e')]],'as':_0x559fe3['as'],'attributes':_0x559fe3[_0x4409('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196ec8){logger['info'](_0x4409('0x16'),_0x6b893f);logger[_0x4409('0xc')]('GetVoiceCallReport',_0x6b893f,JSON[_0x4409('0xe')](_0x196ec8));_0x24acf7(_0x196ec8);})['catch'](function(_0x19f800){logger[_0x4409('0xf')](_0x4409('0x16'),_0x19f800['message'],_0x6b893f);_0x4aa909(_0xfb12f9[_0x4409('0xf')](0x1f4,_0x19f800[_0x4409('0x12')]));});});};exports[_0x4409('0x21')]=function(_0x493ec9){var _0x531632=this;return new Promise(function(_0x5d44d4,_0x108aef){return db[_0x4409('0x17')][_0x4409('0x22')](_0x493ec9['body'],{'raw':_0x493ec9[_0x4409('0x19')]?_0x493ec9[_0x4409('0x19')][_0x4409('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xcdf71){logger[_0x4409('0xb')]('CreateVoiceCallReport',_0x493ec9);logger[_0x4409('0xc')](_0x4409('0x21'),_0x493ec9,JSON[_0x4409('0xe')](_0xcdf71));_0x5d44d4(_0xcdf71);})[_0x4409('0x15')](function(_0xb5999e){logger['error']('CreateVoiceCallReport',_0xb5999e['message'],_0x493ec9);_0x108aef(_0x531632[_0x4409('0xf')](0x1f4,_0xb5999e[_0x4409('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4e6b2d){var _0x50ef85=this;return new Promise(function(_0x138c16,_0x2051d0){return db[_0x4409('0x17')][_0x4409('0x23')](_0x4e6b2d[_0x4409('0x24')],{'raw':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d[_0x4409('0x19')][_0x4409('0x1b')]||null:null,'attributes':_0x4e6b2d['options']?_0x4e6b2d['options'][_0x4409('0x1f')]||null:null,'limit':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d['options'][_0x4409('0x1c')]||null:null})[_0x4409('0xa')](function(_0x4f7be3){logger[_0x4409('0xb')](_0x4409('0x25'),_0x4e6b2d);logger[_0x4409('0xc')](_0x4409('0x25'),_0x4e6b2d,JSON[_0x4409('0xe')](_0x4f7be3));_0x138c16(_0x4f7be3);})[_0x4409('0x15')](function(_0x57617c){logger[_0x4409('0xf')](_0x4409('0x25'),_0x57617c[_0x4409('0x12')],_0x4e6b2d);_0x2051d0(_0x50ef85[_0x4409('0xf')](0x1f4,_0x57617c[_0x4409('0x12')]));});});}; \ No newline at end of file +var _0x0e19=['stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5263d2,_0x476862){var _0x2363a0=function(_0x22380d){while(--_0x22380d){_0x5263d2['push'](_0x5263d2['shift']());}};_0x2363a0(++_0x476862);}(_0x0e19,0x64));var _0x90e1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0e19[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x90e1('0x0'));var moment=require(_0x90e1('0x1'));var BPromise=require(_0x90e1('0x2'));var rs=require(_0x90e1('0x3'));var fs=require('fs');var Redis=require(_0x90e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x90e1('0x5'))(_0x90e1('0x6'));var config=require(_0x90e1('0x7'));var jayson=require(_0x90e1('0x8'));var client=jayson[_0x90e1('0x9')][_0x90e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b3eb0,_0x31ef49,_0x197bf5){return new BPromise(function(_0x3e1d2f,_0x44f0b1){return client[_0x90e1('0xb')](_0x2b3eb0,_0x197bf5)[_0x90e1('0xc')](function(_0x4c5808){logger[_0x90e1('0xd')](_0x90e1('0xe'),_0x31ef49,_0x90e1('0xf'));logger[_0x90e1('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x31ef49,_0x90e1('0xf'),JSON[_0x90e1('0x11')](_0x4c5808));if(_0x4c5808[_0x90e1('0x12')]){if(_0x4c5808[_0x90e1('0x12')][_0x90e1('0x13')]===0x1f4){logger[_0x90e1('0x12')](_0x90e1('0xe'),_0x31ef49,_0x4c5808[_0x90e1('0x12')][_0x90e1('0x14')]);return _0x44f0b1(_0x4c5808[_0x90e1('0x12')]['message']);}logger['error'](_0x90e1('0xe'),_0x31ef49,_0x4c5808[_0x90e1('0x12')][_0x90e1('0x14')]);return _0x3e1d2f(_0x4c5808[_0x90e1('0x12')]['message']);}else{logger[_0x90e1('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x31ef49,'request\x20sent');_0x3e1d2f(_0x4c5808[_0x90e1('0x15')]['message']);}})[_0x90e1('0x16')](function(_0x483620){logger['error'](_0x90e1('0xe'),_0x31ef49,_0x483620);_0x44f0b1(_0x483620);});});}exports[_0x90e1('0x17')]=function(_0x1aea31){var _0x11ceeb=this;return new Promise(function(_0x35d204,_0x4cebcc){return db[_0x90e1('0x18')][_0x90e1('0x19')]({'raw':_0x1aea31[_0x90e1('0x1a')]?_0x1aea31[_0x90e1('0x1a')][_0x90e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x1aea31[_0x90e1('0x1a')]?_0x1aea31[_0x90e1('0x1a')][_0x90e1('0x1c')]||null:null,'attributes':_0x1aea31[_0x90e1('0x1a')]?_0x1aea31[_0x90e1('0x1a')][_0x90e1('0x1d')]||null:null,'limit':_0x1aea31[_0x90e1('0x1a')]?_0x1aea31['options'][_0x90e1('0x1e')]||null:null,'include':_0x1aea31[_0x90e1('0x1a')]?_0x1aea31['options']['include']?_['map'](_0x1aea31['options'][_0x90e1('0x1f')],function(_0x336ece){return{'model':db[_0x336ece[_0x90e1('0x20')]],'as':_0x336ece['as'],'attributes':_0x336ece[_0x90e1('0x1d')],'include':_0x336ece['include']?_[_0x90e1('0x21')](_0x336ece[_0x90e1('0x1f')],function(_0x25c2fd){return{'model':db[_0x25c2fd[_0x90e1('0x20')]],'as':_0x25c2fd['as'],'attributes':_0x25c2fd[_0x90e1('0x1d')],'include':_0x25c2fd[_0x90e1('0x1f')]?_['map'](_0x25c2fd[_0x90e1('0x1f')],function(_0xa87a6b){return{'model':db[_0xa87a6b[_0x90e1('0x20')]],'as':_0xa87a6b['as'],'attributes':_0xa87a6b[_0x90e1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b613f){logger['info'](_0x90e1('0x17'),_0x1aea31);logger[_0x90e1('0x10')]('GetVoiceCallReport',_0x1aea31,JSON['stringify'](_0x4b613f));_0x35d204(_0x4b613f);})[_0x90e1('0x16')](function(_0x6969ed){logger[_0x90e1('0x12')](_0x90e1('0x17'),_0x6969ed[_0x90e1('0x14')],_0x1aea31);_0x4cebcc(_0x11ceeb[_0x90e1('0x12')](0x1f4,_0x6969ed['message']));});});};exports['CreateVoiceCallReport']=function(_0x2de2c0){var _0x326e4c=this;return new Promise(function(_0x4210ab,_0x15e541){return db[_0x90e1('0x18')][_0x90e1('0x22')](_0x2de2c0[_0x90e1('0x23')],{'raw':_0x2de2c0['options']?_0x2de2c0[_0x90e1('0x1a')][_0x90e1('0x1b')]===undefined?!![]:![]:!![]})[_0x90e1('0xc')](function(_0x594447){logger[_0x90e1('0xd')](_0x90e1('0x24'),_0x2de2c0);logger[_0x90e1('0x10')]('CreateVoiceCallReport',_0x2de2c0,JSON[_0x90e1('0x11')](_0x594447));_0x4210ab(_0x594447);})[_0x90e1('0x16')](function(_0x39ddc3){logger[_0x90e1('0x12')](_0x90e1('0x24'),_0x39ddc3[_0x90e1('0x14')],_0x2de2c0);_0x15e541(_0x326e4c['error'](0x1f4,_0x39ddc3[_0x90e1('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x44be23){var _0x4f2b3f=this;return new Promise(function(_0xc6e05d,_0x52447f){return db[_0x90e1('0x18')][_0x90e1('0x25')](_0x44be23['body'],{'raw':_0x44be23['options']?_0x44be23[_0x90e1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44be23[_0x90e1('0x1a')]?_0x44be23[_0x90e1('0x1a')][_0x90e1('0x1c')]||null:null,'attributes':_0x44be23[_0x90e1('0x1a')]?_0x44be23['options'][_0x90e1('0x1d')]||null:null,'limit':_0x44be23[_0x90e1('0x1a')]?_0x44be23['options']['limit']||null:null})['then'](function(_0x202624){logger[_0x90e1('0xd')](_0x90e1('0x26'),_0x44be23);logger['debug'](_0x90e1('0x26'),_0x44be23,JSON[_0x90e1('0x11')](_0x202624));_0xc6e05d(_0x202624);})['catch'](function(_0x429c63){logger[_0x90e1('0x12')]('UpdateVoiceCallReport',_0x429c63['message'],_0x44be23);_0x52447f(_0x4f2b3f['error'](0x1f4,_0x429c63[_0x90e1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c183284..b264c0c 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 _0xcdd0=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x12c914,_0x662ecc){var _0x10700d=function(_0x162178){while(--_0x162178){_0x12c914['push'](_0x12c914['shift']());}};_0x10700d(++_0x662ecc);}(_0xcdd0,0x88));var _0x0cdd=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xcdd0[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require('path');var timeout=require(_0x0cdd('0x2'));var express=require(_0x0cdd('0x3'));var router=express[_0x0cdd('0x4')]();var fs_extra=require(_0x0cdd('0x5'));var auth=require(_0x0cdd('0x6'));var interaction=require(_0x0cdd('0x7'));var config=require('../../config/environment');var controller=require(_0x0cdd('0x8'));router[_0x0cdd('0x9')]('/',auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xb')]);router[_0x0cdd('0x9')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0cdd('0xe')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xf')]);router[_0x0cdd('0x10')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x20a1=['/:id','update','delete','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x3805e9,_0x33a4ed){var _0x207e20=function(_0x293840){while(--_0x293840){_0x3805e9['push'](_0x3805e9['shift']());}};_0x207e20(++_0x33a4ed);}(_0x20a1,0x101));var _0x120a=function(_0x324e2c,_0x29c55a){_0x324e2c=_0x324e2c-0x0;var _0x27caf1=_0x20a1[_0x324e2c];return _0x27caf1;};'use strict';var multer=require(_0x120a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x120a('0x1')]();var fs_extra=require(_0x120a('0x2'));var auth=require(_0x120a('0x3'));var interaction=require(_0x120a('0x4'));var config=require('../../config/environment');var controller=require(_0x120a('0x5'));router[_0x120a('0x6')]('/',auth[_0x120a('0x7')](),controller[_0x120a('0x8')]);router[_0x120a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x120a('0x9')]);router[_0x120a('0xa')]('/',auth[_0x120a('0x7')](),controller[_0x120a('0xb')]);router[_0x120a('0xc')](_0x120a('0xd'),auth['isAuthenticated'](),controller[_0x120a('0xe')]);router[_0x120a('0xf')](_0x120a('0xd'),auth[_0x120a('0x7')](),controller[_0x120a('0x10')]);module[_0x120a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2a37529..e9b1529 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 _0xa3c4=['options','BOOLEAN','exports','STRING','setDataValue','join','getDataValue'];(function(_0x25a08b,_0x3df98d){var _0x2bf414=function(_0x1d39f2){while(--_0x1d39f2){_0x25a08b['push'](_0x25a08b['shift']());}};_0x2bf414(++_0x3df98d);}(_0xa3c4,0x152));var _0x4a3c=function(_0xb1378c,_0x5947){_0xb1378c=_0xb1378c-0x0;var _0x3a3d2a=_0xa3c4[_0xb1378c];return _0x3a3d2a;};'use strict';var Sequelize=require('sequelize');module[_0x4a3c('0x0')]={'name':{'type':Sequelize[_0x4a3c('0x1')]},'prefix':{'type':Sequelize[_0x4a3c('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4a3c('0x1')],'set':function(_0x3325e8){this[_0x4a3c('0x2')]('options',_0x3325e8?_0x3325e8[_0x4a3c('0x3')](''):[]);},'get':function(){return this[_0x4a3c('0x4')](_0x4a3c('0x5'))?this[_0x4a3c('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x4a3c('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x4a3c('0x1')]},'record':{'type':Sequelize[_0x4a3c('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4a3c('0x1')]},'description':{'type':Sequelize[_0x4a3c('0x1')]}}; \ No newline at end of file +var _0x381b=['sequelize','STRING','name','setDataValue','join','getDataValue','options','BOOLEAN'];(function(_0x564b7f,_0x162734){var _0x194ae6=function(_0x25fe6b){while(--_0x25fe6b){_0x564b7f['push'](_0x564b7f['shift']());}};_0x194ae6(++_0x162734);}(_0x381b,0x100));var _0xb381=function(_0xa25342,_0x24522b){_0xa25342=_0xa25342-0x0;var _0x52be43=_0x381b[_0xa25342];return _0x52be43;};'use strict';var Sequelize=require(_0xb381('0x0'));module['exports']={'name':{'type':Sequelize[_0xb381('0x1')]},'prefix':{'type':Sequelize[_0xb381('0x1')],'unique':_0xb381('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x49da78){this[_0xb381('0x3')]('options',_0x49da78?_0x49da78[_0xb381('0x4')](''):[]);},'get':function(){return this[_0xb381('0x5')](_0xb381('0x6'))?this[_0xb381('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb381('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb381('0x1')]},'description':{'type':Sequelize[_0xb381('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e795b1d..588d99e 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 _0x0bb5=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0xdc506b,_0x133ab6){var _0x504d53=function(_0x1f1c7c){while(--_0x1f1c7c){_0xdc506b['push'](_0xdc506b['shift']());}};_0x504d53(++_0x133ab6);}(_0x0bb5,0x148));var _0x50bb=function(_0x40e39c,_0x1e5048){_0x40e39c=_0x40e39c-0x0;var _0xd7417e=_0x0bb5[_0x40e39c];return _0xd7417e;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceChanSpy'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceChanSpy'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));}; \ No newline at end of file +var _0xaf93=['sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','then','get','ChanSpies','UserProfileResource','destroy','end','sendStatus','stack','name','index','VoiceChanSpy','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit'];(function(_0xabd630,_0x53cf00){var _0x35e2d0=function(_0x42561e){while(--_0x42561e){_0xabd630['push'](_0xabd630['shift']());}};_0x35e2d0(++_0x53cf00);}(_0xaf93,0x151));var _0x3af9=function(_0x189b1d,_0x1df005){_0x189b1d=_0x189b1d-0x0;var _0x3d8ab0=_0xaf93[_0x189b1d];return _0x3d8ab0;};'use strict';var emlformat=require(_0x3af9('0x0'));var rimraf=require(_0x3af9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3af9('0x2'));var moment=require(_0x3af9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3af9('0x4'));var util=require(_0x3af9('0x5'));var path=require(_0x3af9('0x6'));var sox=require(_0x3af9('0x7'));var csv=require(_0x3af9('0x8'));var ejs=require(_0x3af9('0x9'));var fs=require('fs');var fs_extra=require(_0x3af9('0xa'));var _=require('lodash');var squel=require(_0x3af9('0xb'));var crypto=require('crypto');var jsforce=require(_0x3af9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3af9('0xe'));var qs=require(_0x3af9('0xf'));var as=require(_0x3af9('0x10'));var hardwareService=require(_0x3af9('0x11'));var logger=require('../../config/logger')(_0x3af9('0x12'));var utils=require(_0x3af9('0x13'));var config=require(_0x3af9('0x14'));var licenseUtil=require(_0x3af9('0x15'));var db=require(_0x3af9('0x16'))['db'];function respondWithStatusCode(_0xfa1410,_0x212f63){_0x212f63=_0x212f63||0xcc;return function(_0xa7b81f){if(_0xa7b81f){return _0xfa1410['sendStatus'](_0x212f63);}return _0xfa1410[_0x3af9('0x17')](_0x212f63)['end']();};}function respondWithResult(_0x152254,_0x222b6f){_0x222b6f=_0x222b6f||0xc8;return function(_0x1e4ebb){if(_0x1e4ebb){return _0x152254['status'](_0x222b6f)[_0x3af9('0x18')](_0x1e4ebb);}};}function respondWithFilteredResult(_0x1088fc,_0x37cb8b){return function(_0x4b2845){if(_0x4b2845){var _0x278e80=typeof _0x37cb8b[_0x3af9('0x19')]===_0x3af9('0x1a')&&typeof _0x37cb8b[_0x3af9('0x1b')]==='undefined';var _0x1d3410=_0x4b2845[_0x3af9('0x1c')];var _0x298135=_0x278e80?0x0:_0x37cb8b[_0x3af9('0x19')];var _0x314df2=_0x278e80?_0x4b2845['count']:_0x37cb8b[_0x3af9('0x19')]+_0x37cb8b[_0x3af9('0x1b')];var _0x1f9214;if(_0x314df2>=_0x1d3410){_0x314df2=_0x1d3410;_0x1f9214=0xc8;}else{_0x1f9214=0xce;}_0x1088fc[_0x3af9('0x17')](_0x1f9214);return _0x1088fc[_0x3af9('0x1d')]('Content-Range',_0x298135+'-'+_0x314df2+'/'+_0x1d3410)[_0x3af9('0x18')](_0x4b2845);}return null;};}function patchUpdates(_0x34eb91){return function(_0x449349){try{jsonpatch[_0x3af9('0x1e')](_0x449349,_0x34eb91,!![]);}catch(_0x3c1793){return BPromise[_0x3af9('0x1f')](_0x3c1793);}return _0x449349['save']();};}function saveUpdates(_0x4a88ea,_0x505e25){return function(_0x5e24e3){if(_0x5e24e3){return _0x5e24e3['update'](_0x4a88ea)[_0x3af9('0x20')](function(_0x5c1c8f){return _0x5c1c8f;});}return null;};}function removeEntity(_0x74c872,_0x307f9d){return function(_0x4b5a5c){if(_0x4b5a5c){return _0x4b5a5c['destroy']()['then'](function(){var _0x119e85=_0x4b5a5c[_0x3af9('0x21')]({'plain':!![]});var _0x22965b=_0x3af9('0x22');return db[_0x3af9('0x23')][_0x3af9('0x24')]({'where':{'type':_0x22965b,'resourceId':_0x119e85['id']}})[_0x3af9('0x20')](function(){return _0x4b5a5c;});})[_0x3af9('0x20')](function(){_0x74c872['status'](0xcc)[_0x3af9('0x25')]();});}};}function handleEntityNotFound(_0x574b71,_0x485754){return function(_0x177650){if(!_0x177650){_0x574b71[_0x3af9('0x26')](0x194);}return _0x177650;};}function handleError(_0x19643f,_0xf8840){_0xf8840=_0xf8840||0x1f4;return function(_0x374382){logger['error'](_0x374382[_0x3af9('0x27')]);if(_0x374382[_0x3af9('0x28')]){delete _0x374382[_0x3af9('0x28')];}_0x19643f['status'](_0xf8840)['send'](_0x374382);};}exports[_0x3af9('0x29')]=function(_0x1d022d,_0x8867c6){var _0x540969={},_0x4186d5={},_0x115673={'count':0x0,'rows':[]};var _0x1c923d=_['map'](db[_0x3af9('0x2a')][_0x3af9('0x2b')],function(_0x407572){return{'name':_0x407572['fieldName'],'type':_0x407572[_0x3af9('0x2c')][_0x3af9('0x2d')]};});_0x4186d5[_0x3af9('0x2e')]=_['map'](_0x1c923d,_0x3af9('0x28'));_0x4186d5[_0x3af9('0x2f')]=_['keys'](_0x1d022d[_0x3af9('0x2f')]);_0x4186d5['filters']=_[_0x3af9('0x30')](_0x4186d5['model'],_0x4186d5['query']);_0x540969[_0x3af9('0x31')]=_['intersection'](_0x4186d5[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x1d022d[_0x3af9('0x2f')]['fields']));_0x540969['attributes']=_0x540969[_0x3af9('0x31')][_0x3af9('0x33')]?_0x540969['attributes']:_0x4186d5['model'];if(!_0x1d022d[_0x3af9('0x2f')]['hasOwnProperty'](_0x3af9('0x34'))){_0x540969[_0x3af9('0x1b')]=qs['limit'](_0x1d022d['query'][_0x3af9('0x1b')]);_0x540969[_0x3af9('0x19')]=qs[_0x3af9('0x19')](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x19')]);}_0x540969['order']=qs['sort'](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x35')]);_0x540969[_0x3af9('0x36')]=qs[_0x3af9('0x37')](_['pick'](_0x1d022d['query'],_0x4186d5[_0x3af9('0x37')]),_0x1c923d);if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]){_0x540969['where']=_[_0x3af9('0x39')](_0x540969[_0x3af9('0x36')],{'$or':_[_0x3af9('0x3a')](_0x1c923d,function(_0x576c86){if(_0x576c86[_0x3af9('0x2c')]!=='VIRTUAL'){var _0x1f3ac9={};_0x1f3ac9[_0x576c86[_0x3af9('0x28')]]={'$like':'%'+_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]+'%'};return _0x1f3ac9;}})});}_0x540969=_[_0x3af9('0x39')]({},_0x540969,_0x1d022d[_0x3af9('0x3b')]);var _0x43fd62={'where':_0x540969[_0x3af9('0x36')]};return db[_0x3af9('0x2a')][_0x3af9('0x1c')](_0x43fd62)[_0x3af9('0x20')](function(_0x4d7bd4){_0x115673[_0x3af9('0x1c')]=_0x4d7bd4;if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x3c')]){_0x540969[_0x3af9('0x3d')]=[{'all':!![]}];}return db[_0x3af9('0x2a')][_0x3af9('0x3e')](_0x540969);})[_0x3af9('0x20')](function(_0x384a61){_0x115673[_0x3af9('0x3f')]=_0x384a61;return _0x115673;})[_0x3af9('0x20')](respondWithFilteredResult(_0x8867c6,_0x540969))[_0x3af9('0x40')](handleError(_0x8867c6,null));};exports[_0x3af9('0x41')]=function(_0x549274,_0x542580){var _0x461dd6={'raw':![],'where':{'id':_0x549274[_0x3af9('0x42')]['id']}},_0x1daea4={};_0x1daea4[_0x3af9('0x2e')]=_[_0x3af9('0x43')](db[_0x3af9('0x2a')][_0x3af9('0x2b')]);_0x1daea4[_0x3af9('0x2f')]=_[_0x3af9('0x43')](_0x549274[_0x3af9('0x2f')]);_0x1daea4[_0x3af9('0x37')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],_0x1daea4['query']);_0x461dd6[_0x3af9('0x31')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x549274['query']['fields']));_0x461dd6[_0x3af9('0x31')]=_0x461dd6['attributes'][_0x3af9('0x33')]?_0x461dd6[_0x3af9('0x31')]:_0x1daea4[_0x3af9('0x2e')];if(_0x549274[_0x3af9('0x2f')]['includeAll']){_0x461dd6[_0x3af9('0x3d')]=[{'all':!![]}];}_0x461dd6=_[_0x3af9('0x39')]({},_0x461dd6,_0x549274[_0x3af9('0x3b')]);return db['VoiceChanSpy']['find'](_0x461dd6)[_0x3af9('0x20')](handleEntityNotFound(_0x542580,null))['then'](respondWithResult(_0x542580,null))['catch'](handleError(_0x542580,null));};exports['create']=function(_0x19bd47,_0x3bc784){return db[_0x3af9('0x2a')][_0x3af9('0x44')](_0x19bd47[_0x3af9('0x45')],{})[_0x3af9('0x20')](function(_0x442681){var _0x48377b=_0x19bd47[_0x3af9('0x46')][_0x3af9('0x21')]({'plain':!![]});if(!_0x48377b)throw new Error(_0x3af9('0x47'));if(_0x48377b[_0x3af9('0x48')]===_0x3af9('0x46')){var _0x1104d4=_0x442681['get']({'plain':!![]});var _0x1b4509=_0x3af9('0x22');return db[_0x3af9('0x49')][_0x3af9('0x4a')]({'where':{'name':_0x1b4509,'userProfileId':_0x48377b['userProfileId']},'raw':!![]})[_0x3af9('0x20')](function(_0x39d954){if(_0x39d954&&_0x39d954[_0x3af9('0x4b')]===0x0){return db[_0x3af9('0x23')]['create']({'name':_0x1104d4[_0x3af9('0x28')],'resourceId':_0x1104d4['id'],'type':_0x39d954[_0x3af9('0x28')],'sectionId':_0x39d954['id']},{})[_0x3af9('0x20')](function(){return _0x442681;});}else{return _0x442681;}})[_0x3af9('0x40')](function(_0x4c75b6){logger['error'](_0x3af9('0x4c'),_0x4c75b6);throw _0x4c75b6;});}return _0x442681;})[_0x3af9('0x20')](respondWithResult(_0x3bc784,0xc9))[_0x3af9('0x40')](handleError(_0x3bc784,null));};exports[_0x3af9('0x4d')]=function(_0x3f087a,_0x268820){if(_0x3f087a[_0x3af9('0x45')]['id']){delete _0x3f087a[_0x3af9('0x45')]['id'];}return db[_0x3af9('0x2a')][_0x3af9('0x4a')]({'where':{'id':_0x3f087a[_0x3af9('0x42')]['id']}})['then'](handleEntityNotFound(_0x268820,null))[_0x3af9('0x20')](saveUpdates(_0x3f087a[_0x3af9('0x45')],null))['then'](respondWithResult(_0x268820,null))['catch'](handleError(_0x268820,null));};exports[_0x3af9('0x24')]=function(_0x4b205f,_0x27f717){return db[_0x3af9('0x2a')]['find']({'where':{'id':_0x4b205f['params']['id']}})[_0x3af9('0x20')](handleEntityNotFound(_0x27f717,null))[_0x3af9('0x20')](removeEntity(_0x27f717,null))[_0x3af9('0x40')](handleError(_0x27f717,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8f8c2d0..39f51ad 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 _0x9050=['lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','User','findAll','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','destroy','bulkCreate'];(function(_0x5185c6,_0x4e7c65){var _0x1a9c19=function(_0x4b882b){while(--_0x4b882b){_0x5185c6['push'](_0x5185c6['shift']());}};_0x1a9c19(++_0x4e7c65);}(_0x9050,0x1e0));var _0x0905=function(_0x2b0c4e,_0x3233b2){_0x2b0c4e=_0x2b0c4e-0x0;var _0x2769d6=_0x9050[_0x2b0c4e];return _0x2769d6;};'use strict';var _=require(_0x0905('0x0'));var util=require(_0x0905('0x1'));var BPromise=require(_0x0905('0x2'));var attributes=require(_0x0905('0x3'));var getUserApplications=function(_0x4f599c,_0xb98eea,_0x2966d0){var _0x5caf91=0x1;var _0x344b1d=[];var _0x2c11c9={'context':_0xb98eea[_0x0905('0x4')]||_0x0905('0x5'),'exten':util[_0x0905('0x6')](_0x0905('0x7'),_0x4f599c[_0x0905('0x8')],_0x2966d0),'type':_0x0905('0x9'),'isApp':![],'ChanSpyId':_0x4f599c['id'],'UserId':_0xb98eea['id']};_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0xb'),'appdata':util['format'](_0x0905('0xc'),'chanspy'),'priority':_0x5caf91++},_0x2c11c9));if(_0x4f599c[_0x0905('0xd')]){_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0xe'),'appdata':util['format'](_0x0905('0xf'),_0x4f599c[_0x0905('0x10')]),'priority':_0x5caf91++},_0x2c11c9));}if(_0x4f599c['auth']){_0x344b1d['push'](_[_0x0905('0x11')]({'app':_0x0905('0x12'),'appdata':_0x4f599c[_0x0905('0x13')],'priority':_0x5caf91++},_0x2c11c9));}_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0x14'),'appdata':util['format'](_0x0905('0x15'),_0xb98eea[_0x0905('0x16')],_0x4f599c[_0x0905('0x17')]?_0x4f599c[_0x0905('0x17')][_0x0905('0x18')](''):''),'priority':_0x5caf91++},_0x2c11c9));if(_0x4f599c[_0x0905('0xd')]){_0x344b1d[_0x0905('0xa')](_[_0x0905('0x11')]({'app':_0x0905('0x19'),'priority':_0x5caf91++},_0x2c11c9));}return _0x344b1d;};var getChanSpyApplications=function(_0x351ff8,_0x2fe6e5){var _0x14d390=[];for(var _0x40c3b6=0x0,_0x3cffd7=0x1;_0x40c3b6<_0x2fe6e5[_0x0905('0x1a')];_0x40c3b6++,_0x3cffd7=0x1){_0x14d390=_0x14d390[_0x0905('0x1b')](getUserApplications(_0x351ff8,_0x2fe6e5[_0x40c3b6],_0x2fe6e5[_0x40c3b6]['internal']));if(_0x2fe6e5[_0x40c3b6]['internal']!=_0x2fe6e5[_0x40c3b6][_0x0905('0x16')]){_0x14d390=_0x14d390[_0x0905('0x1b')](getUserApplications(_0x351ff8,_0x2fe6e5[_0x40c3b6],_0x2fe6e5[_0x40c3b6][_0x0905('0x16')]));}}return _0x14d390;};var getChanSpyPromise=function(_0x285a2f,_0x57bf89){return new BPromise(function(_0x113d01,_0x5921c7){return _0x285a2f[_0x0905('0x1c')][_0x0905('0x1d')]({'attributes':['id',_0x0905('0x16'),'internal'],'where':{'role':_0x0905('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x20609b){if(_0x20609b){return _0x113d01(getChanSpyApplications(_0x57bf89,_0x20609b));}return _0x113d01([]);})[_0x0905('0x1f')](function(_0x8f759d){_0x5921c7(_0x8f759d);});});};module[_0x0905('0x20')]=function(_0x1f951f,_0x31a002){var _0x498445=_0x1f951f[_0x0905('0x21')];return _0x1f951f[_0x0905('0x22')]('VoiceChanSpy',attributes,{'tableName':_0x0905('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x431aed,_0x25c5c9,_0x1836f5){return getChanSpyPromise(_0x498445,_0x431aed)[_0x0905('0x24')](function(_0x2b2eae){if(_0x2b2eae&&_0x2b2eae['length']){return _0x498445[_0x0905('0x25')]['bulkCreate'](_0x2b2eae);}})[_0x0905('0x24')](function(){_0x1836f5();})[_0x0905('0x1f')](function(_0x5be9c7){_0x1836f5(_0x5be9c7);});},'afterUpdate':function(_0x2e56da,_0x1dde35,_0x13ee08){return _0x498445[_0x0905('0x25')][_0x0905('0x26')]({'where':{'ChanSpyId':_0x2e56da['id']}})[_0x0905('0x24')](function(){return getChanSpyPromise(_0x498445,_0x2e56da);})[_0x0905('0x24')](function(_0x49f753){if(_0x49f753&&_0x49f753[_0x0905('0x1a')]){return _0x498445['VoiceExtension'][_0x0905('0x27')](_0x49f753);}})[_0x0905('0x24')](function(){_0x13ee08();})['catch'](function(_0x2e5541){_0x13ee08(_0x2e5541);});},'afterDestroy':function(_0x5e2cc2,_0x2169fa,_0x5ce2d8){return _0x498445[_0x0905('0x25')][_0x0905('0x26')]({'where':{'ChanSpyId':_0x5e2cc2['id']}})[_0x0905('0x24')](function(){_0x5ce2d8();})[_0x0905('0x1f')](function(_0x257a41){_0x5ce2d8(_0x257a41);});}}});}; \ No newline at end of file +var _0x32b2=['push','Set','format','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','User','internal','agent','then','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','catch','destroy','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x32b2,0x66));var _0x232b=function(_0x64b6e,_0x391478){_0x64b6e=_0x64b6e-0x0;var _0x5d4448=_0x32b2[_0x64b6e];return _0x5d4448;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x232b('0x0'));var getUserApplications=function(_0x487fb1,_0x53e524,_0x2ac63b){var _0x2dcca8=0x1;var _0x4d90b3=[];var _0x231503={'context':_0x53e524[_0x232b('0x1')]||_0x232b('0x2'),'exten':util['format'](_0x232b('0x3'),_0x487fb1[_0x232b('0x4')],_0x2ac63b),'type':_0x232b('0x5'),'isApp':![],'ChanSpyId':_0x487fb1['id'],'UserId':_0x53e524['id']};_0x4d90b3[_0x232b('0x6')](_['merge']({'app':_0x232b('0x7'),'appdata':util[_0x232b('0x8')]('CDR(type)=%s',_0x232b('0x9')),'priority':_0x2dcca8++},_0x231503));if(_0x487fb1[_0x232b('0xa')]){_0x4d90b3['push'](_[_0x232b('0xb')]({'app':_0x232b('0xc'),'appdata':util[_0x232b('0x8')](_0x232b('0xd'),_0x487fb1[_0x232b('0xe')]),'priority':_0x2dcca8++},_0x231503));}if(_0x487fb1['auth']){_0x4d90b3[_0x232b('0x6')](_['merge']({'app':'Authenticate','appdata':_0x487fb1[_0x232b('0xf')],'priority':_0x2dcca8++},_0x231503));}_0x4d90b3[_0x232b('0x6')](_['merge']({'app':_0x232b('0x10'),'appdata':util[_0x232b('0x8')](_0x232b('0x11'),_0x53e524[_0x232b('0x12')],_0x487fb1[_0x232b('0x13')]?_0x487fb1[_0x232b('0x13')][_0x232b('0x14')](''):''),'priority':_0x2dcca8++},_0x231503));if(_0x487fb1[_0x232b('0xa')]){_0x4d90b3[_0x232b('0x6')](_[_0x232b('0xb')]({'app':_0x232b('0x15'),'priority':_0x2dcca8++},_0x231503));}return _0x4d90b3;};var getChanSpyApplications=function(_0x35f1eb,_0x56b28f){var _0xc5f5d7=[];for(var _0x2e8a51=0x0,_0x436530=0x1;_0x2e8a51<_0x56b28f['length'];_0x2e8a51++,_0x436530=0x1){_0xc5f5d7=_0xc5f5d7[_0x232b('0x16')](getUserApplications(_0x35f1eb,_0x56b28f[_0x2e8a51],_0x56b28f[_0x2e8a51]['internal']));if(_0x56b28f[_0x2e8a51]['internal']!=_0x56b28f[_0x2e8a51][_0x232b('0x12')]){_0xc5f5d7=_0xc5f5d7[_0x232b('0x16')](getUserApplications(_0x35f1eb,_0x56b28f[_0x2e8a51],_0x56b28f[_0x2e8a51][_0x232b('0x12')]));}}return _0xc5f5d7;};var getChanSpyPromise=function(_0x113be5,_0x15384e){return new BPromise(function(_0x50baa5,_0x10b93f){return _0x113be5[_0x232b('0x17')]['findAll']({'attributes':['id',_0x232b('0x12'),_0x232b('0x18')],'where':{'role':_0x232b('0x19'),'chanspy':!![]},'raw':!![]})[_0x232b('0x1a')](function(_0x200dc2){if(_0x200dc2){return _0x50baa5(getChanSpyApplications(_0x15384e,_0x200dc2));}return _0x50baa5([]);})['catch'](function(_0x3f1f44){_0x10b93f(_0x3f1f44);});});};module['exports']=function(_0x2d50f6,_0x418ced){var _0x61c55f=_0x2d50f6[_0x232b('0x1b')];return _0x2d50f6[_0x232b('0x1c')](_0x232b('0x1d'),attributes,{'tableName':_0x232b('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e908f,_0x12298f,_0x394bb4){return getChanSpyPromise(_0x61c55f,_0x2e908f)[_0x232b('0x1a')](function(_0x51bf41){if(_0x51bf41&&_0x51bf41[_0x232b('0x1f')]){return _0x61c55f[_0x232b('0x20')][_0x232b('0x21')](_0x51bf41);}})['then'](function(){_0x394bb4();})[_0x232b('0x22')](function(_0x396ca8){_0x394bb4(_0x396ca8);});},'afterUpdate':function(_0x2ad70f,_0x50bb91,_0x34bb9c){return _0x61c55f[_0x232b('0x20')][_0x232b('0x23')]({'where':{'ChanSpyId':_0x2ad70f['id']}})[_0x232b('0x1a')](function(){return getChanSpyPromise(_0x61c55f,_0x2ad70f);})['then'](function(_0x40ec67){if(_0x40ec67&&_0x40ec67[_0x232b('0x1f')]){return _0x61c55f[_0x232b('0x20')][_0x232b('0x21')](_0x40ec67);}})['then'](function(){_0x34bb9c();})[_0x232b('0x22')](function(_0x3da8d9){_0x34bb9c(_0x3da8d9);});},'afterDestroy':function(_0x40776b,_0x120d18,_0x1be76f){return _0x61c55f[_0x232b('0x20')]['destroy']({'where':{'ChanSpyId':_0x40776b['id']}})[_0x232b('0x1a')](function(){_0x1be76f();})['catch'](function(_0x403f75){_0x1be76f(_0x403f75);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c351cc5..b4df734 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 _0x55ea=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x40c552,_0x5b8889){var _0x35b192=function(_0x84de3f){while(--_0x84de3f){_0x40c552['push'](_0x40c552['shift']());}};_0x35b192(++_0x5b8889);}(_0x55ea,0xc9));var _0xa55e=function(_0x4c1b17,_0x211dff){_0x4c1b17=_0x4c1b17-0x0;var _0x412454=_0x55ea[_0x4c1b17];return _0x412454;};'use strict';var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var moment=require(_0xa55e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa55e('0x3'));var fs=require('fs');var Redis=require(_0xa55e('0x4'));var db=require(_0xa55e('0x5'))['db'];var utils=require(_0xa55e('0x6'));var logger=require(_0xa55e('0x7'))('rpc');var config=require(_0xa55e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a009c,_0x38378e,_0x20f2ac){return new BPromise(function(_0x30b885,_0xca9526){return client[_0xa55e('0x9')](_0x5a009c,_0x20f2ac)[_0xa55e('0xa')](function(_0x32f6f7){logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,'request\x20sent');logger['debug'](_0xa55e('0xd'),_0x38378e,_0xa55e('0xe'),JSON[_0xa55e('0xf')](_0x32f6f7));if(_0x32f6f7[_0xa55e('0x10')]){if(_0x32f6f7[_0xa55e('0x10')]['code']===0x1f4){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0xca9526(_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);}logger[_0xa55e('0x10')](_0xa55e('0xc'),_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0x30b885(_0x32f6f7[_0xa55e('0x10')]['message']);}else{logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,_0xa55e('0xe'));_0x30b885(_0x32f6f7[_0xa55e('0x12')][_0xa55e('0x11')]);}})[_0xa55e('0x13')](function(_0x585d3a){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x585d3a);_0xca9526(_0x585d3a);});});} \ No newline at end of file +var _0x593e=['then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3708c6,_0x376fd7){var _0x33f164=function(_0x251895){while(--_0x251895){_0x3708c6['push'](_0x3708c6['shift']());}};_0x33f164(++_0x376fd7);}(_0x593e,0xcb));var _0xe593=function(_0x7dce19,_0xcb4522){_0x7dce19=_0x7dce19-0x0;var _0x37fa61=_0x593e[_0x7dce19];return _0x37fa61;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2870fb8..cc791d3 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 _0xc803=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x2c60c9,_0x2c6e0d){var _0x564f3f=function(_0x3a06f6){while(--_0x3a06f6){_0x2c60c9['push'](_0x2c60c9['shift']());}};_0x564f3f(++_0x2c6e0d);}(_0xc803,0x1e2));var _0x3c80=function(_0x5671c6,_0x3a0619){_0x5671c6=_0x5671c6-0x0;var _0x4e86c8=_0xc803[_0x5671c6];return _0x4e86c8;};'use strict';var multer=require('multer');var util=require(_0x3c80('0x0'));var path=require(_0x3c80('0x1'));var timeout=require(_0x3c80('0x2'));var express=require(_0x3c80('0x3'));var router=express['Router']();var fs_extra=require(_0x3c80('0x4'));var auth=require(_0x3c80('0x5'));var interaction=require(_0x3c80('0x6'));var config=require(_0x3c80('0x7'));var controller=require(_0x3c80('0x8'));router[_0x3c80('0x9')]('/',auth[_0x3c80('0xa')](),controller[_0x3c80('0xb')]);router[_0x3c80('0x9')](_0x3c80('0xc'),auth[_0x3c80('0xa')](),controller[_0x3c80('0xd')]);router[_0x3c80('0xe')]('/',auth[_0x3c80('0xa')](),controller['create']);router[_0x3c80('0xf')]('/:id',auth[_0x3c80('0xa')](),controller[_0x3c80('0x10')]);router[_0x3c80('0x11')](_0x3c80('0xc'),auth[_0x3c80('0xa')](),controller[_0x3c80('0x12')]);module[_0x3c80('0x13')]=router; \ No newline at end of file +var _0xcc90=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','create','put'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xcc90,0x16c));var _0x0cc9=function(_0x5c570f,_0x233f02){_0x5c570f=_0x5c570f-0x0;var _0x23d3bf=_0xcc90[_0x5c570f];return _0x23d3bf;};'use strict';var multer=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var path=require(_0x0cc9('0x2'));var timeout=require(_0x0cc9('0x3'));var express=require(_0x0cc9('0x4'));var router=express[_0x0cc9('0x5')]();var fs_extra=require(_0x0cc9('0x6'));var auth=require(_0x0cc9('0x7'));var interaction=require(_0x0cc9('0x8'));var config=require(_0x0cc9('0x9'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x0cc9('0xa')](),controller['index']);router[_0x0cc9('0xb')](_0x0cc9('0xc'),auth[_0x0cc9('0xa')](),controller['show']);router[_0x0cc9('0xd')]('/',auth[_0x0cc9('0xa')](),controller[_0x0cc9('0xe')]);router[_0x0cc9('0xf')]('/:id',auth[_0x0cc9('0xa')](),controller[_0x0cc9('0x10')]);router[_0x0cc9('0x11')](_0x0cc9('0xc'),auth[_0x0cc9('0xa')](),controller[_0x0cc9('0x12')]);module[_0x0cc9('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 bee9e21..b6189db 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 _0xe776=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3450f5,_0x5780b2){var _0xfa84f0=function(_0x43b515){while(--_0x43b515){_0x3450f5['push'](_0x3450f5['shift']());}};_0xfa84f0(++_0x5780b2);}(_0xe776,0xfe));var _0x6e77=function(_0x290c92,_0x109b6f){_0x290c92=_0x290c92-0x0;var _0x104d47=_0xe776[_0x290c92];return _0x104d47;};'use strict';var Sequelize=require(_0x6e77('0x0'));module[_0x6e77('0x1')]={'name':{'type':Sequelize[_0x6e77('0x2')],'unique':_0x6e77('0x3')},'description':{'type':Sequelize[_0x6e77('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6e77('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x77b8=['name','BOOLEAN','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x77b8,0x9a));var _0x877b=function(_0x20af4e,_0x511577){_0x20af4e=_0x20af4e-0x0;var _0x4f990f=_0x77b8[_0x20af4e];return _0x4f990f;};'use strict';var Sequelize=require('sequelize');module[_0x877b('0x0')]={'name':{'type':Sequelize[_0x877b('0x1')],'unique':_0x877b('0x2')},'description':{'type':Sequelize[_0x877b('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x877b('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 c8b9c0b..5b9940d 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 _0x8b0d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Contexts','UserProfileResource','destroy','end','name','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','length','find','create','body','findAll','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','join','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x8b0d,0xbe));var _0xd8b0=function(_0x12f676,_0x295f00){_0x12f676=_0x12f676-0x0;var _0x218338=_0x8b0d[_0x12f676];return _0x218338;};'use strict';var emlformat=require(_0xd8b0('0x0'));var rimraf=require(_0xd8b0('0x1'));var zipdir=require(_0xd8b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd8b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd8b0('0x4'));var util=require(_0xd8b0('0x5'));var path=require(_0xd8b0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8b0('0x7'));var fs=require('fs');var fs_extra=require(_0xd8b0('0x8'));var _=require(_0xd8b0('0x9'));var squel=require(_0xd8b0('0xa'));var crypto=require(_0xd8b0('0xb'));var jsforce=require(_0xd8b0('0xc'));var deskjs=require(_0xd8b0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8b0('0xe'));var Redis=require(_0xd8b0('0xf'));var authService=require(_0xd8b0('0x10'));var qs=require(_0xd8b0('0x11'));var as=require(_0xd8b0('0x12'));var hardwareService=require(_0xd8b0('0x13'));var logger=require(_0xd8b0('0x14'))(_0xd8b0('0x15'));var utils=require(_0xd8b0('0x16'));var config=require(_0xd8b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8b0('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd8b0('0x19')][_0xd8b0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x536dc0,_0x5583f1,_0x522d94,_0xcaebf1){return new BPromise(function(_0xcc3d73,_0x3631a8){var _0x50c141=_0xcaebf1||client;return _0x50c141[_0xd8b0('0x1b')](_0x536dc0,_0x522d94)['then'](function(_0xc4ee75){logger[_0xd8b0('0x1c')](_0xd8b0('0x1d'),_0x5583f1,_0xd8b0('0x1e'));logger[_0xd8b0('0x1f')](_0xd8b0('0x20'),_0x5583f1,'request\x20sent',JSON[_0xd8b0('0x21')](_0xc4ee75));if(_0xc4ee75['error']){if(_0xc4ee75['error'][_0xd8b0('0x22')]===0x1f4){logger[_0xd8b0('0x23')](_0xd8b0('0x1d'),_0x5583f1,_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);return _0x3631a8(_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);}logger['error'](_0xd8b0('0x1d'),_0x5583f1,_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);return _0xcc3d73(_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);}else{logger[_0xd8b0('0x1c')](_0xd8b0('0x1d'),_0x5583f1,_0xd8b0('0x1e'));_0xcc3d73(_0xc4ee75[_0xd8b0('0x25')][_0xd8b0('0x24')]);}})[_0xd8b0('0x26')](function(_0x592367){logger['error'](_0xd8b0('0x1d'),_0x5583f1,_0x592367);_0x3631a8(_0x592367);});});}function respondWithStatusCode(_0x455488,_0x324697){_0x324697=_0x324697||0xcc;return function(_0x3dc2d2){if(_0x3dc2d2){return _0x455488[_0xd8b0('0x27')](_0x324697);}return _0x455488[_0xd8b0('0x28')](_0x324697)['end']();};}function respondWithResult(_0x26a062,_0x131d79){_0x131d79=_0x131d79||0xc8;return function(_0x4bf7bf){if(_0x4bf7bf){return _0x26a062[_0xd8b0('0x28')](_0x131d79)[_0xd8b0('0x29')](_0x4bf7bf);}};}function respondWithFilteredResult(_0x5c3501,_0x1cc160){return function(_0x34ed96){if(_0x34ed96){var _0x2bd31b=typeof _0x1cc160[_0xd8b0('0x2a')]===_0xd8b0('0x2b')&&typeof _0x1cc160[_0xd8b0('0x2c')]===_0xd8b0('0x2b');var _0x282ff5=_0x34ed96[_0xd8b0('0x2d')];var _0x2c24cf=_0x2bd31b?0x0:_0x1cc160[_0xd8b0('0x2a')];var _0x28d48e=_0x2bd31b?_0x34ed96[_0xd8b0('0x2d')]:_0x1cc160[_0xd8b0('0x2a')]+_0x1cc160[_0xd8b0('0x2c')];var _0x2a6b79;if(_0x28d48e>=_0x282ff5){_0x28d48e=_0x282ff5;_0x2a6b79=0xc8;}else{_0x2a6b79=0xce;}_0x5c3501[_0xd8b0('0x28')](_0x2a6b79);return _0x5c3501[_0xd8b0('0x2e')](_0xd8b0('0x2f'),_0x2c24cf+'-'+_0x28d48e+'/'+_0x282ff5)[_0xd8b0('0x29')](_0x34ed96);}return null;};}function patchUpdates(_0x5b957a){return function(_0x4eb958){try{jsonpatch[_0xd8b0('0x30')](_0x4eb958,_0x5b957a,!![]);}catch(_0x8d64da){return BPromise['reject'](_0x8d64da);}return _0x4eb958[_0xd8b0('0x31')]();};}function saveUpdates(_0x3ebbcb,_0x5a133d){return function(_0x190c3d){if(_0x190c3d){return _0x190c3d[_0xd8b0('0x32')](_0x3ebbcb)[_0xd8b0('0x33')](function(_0x43912b){return _0x43912b;});}return null;};}function removeEntity(_0x11b614,_0x349cec){return function(_0x2f89c7){if(_0x2f89c7){return _0x2f89c7['destroy']()[_0xd8b0('0x33')](function(){var _0x3c94e1=_0x2f89c7[_0xd8b0('0x34')]({'plain':!![]});var _0x436568=_0xd8b0('0x35');return db[_0xd8b0('0x36')][_0xd8b0('0x37')]({'where':{'type':_0x436568,'resourceId':_0x3c94e1['id']}})[_0xd8b0('0x33')](function(){return _0x2f89c7;});})[_0xd8b0('0x33')](function(){_0x11b614['status'](0xcc)[_0xd8b0('0x38')]();});}};}function handleEntityNotFound(_0x1feb5e,_0x193ad3){return function(_0xe92560){if(!_0xe92560){_0x1feb5e[_0xd8b0('0x27')](0x194);}return _0xe92560;};}function handleError(_0xe3a697,_0x56ba5c){_0x56ba5c=_0x56ba5c||0x1f4;return function(_0x44aba3){logger[_0xd8b0('0x23')](_0x44aba3['stack']);if(_0x44aba3[_0xd8b0('0x39')]){delete _0x44aba3[_0xd8b0('0x39')];}_0xe3a697[_0xd8b0('0x28')](_0x56ba5c)['send'](_0x44aba3);};}exports['index']=function(_0x3dfbb1,_0x1cf9b3){var _0x841d5a={},_0x1c6335={},_0x55a306={'count':0x0,'rows':[]};var _0xa3574a=_[_0xd8b0('0x3a')](db[_0xd8b0('0x3b')][_0xd8b0('0x3c')],function(_0x24a4be){return{'name':_0x24a4be[_0xd8b0('0x3d')],'type':_0x24a4be[_0xd8b0('0x3e')][_0xd8b0('0x3f')]};});_0x1c6335['model']=_[_0xd8b0('0x3a')](_0xa3574a,_0xd8b0('0x39'));_0x1c6335[_0xd8b0('0x40')]=_[_0xd8b0('0x41')](_0x3dfbb1[_0xd8b0('0x40')]);_0x1c6335[_0xd8b0('0x42')]=_[_0xd8b0('0x43')](_0x1c6335['model'],_0x1c6335[_0xd8b0('0x40')]);_0x841d5a[_0xd8b0('0x44')]=_[_0xd8b0('0x43')](_0x1c6335[_0xd8b0('0x45')],qs[_0xd8b0('0x46')](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x46')]));_0x841d5a['attributes']=_0x841d5a['attributes']['length']?_0x841d5a[_0xd8b0('0x44')]:_0x1c6335['model'];if(!_0x3dfbb1['query']['hasOwnProperty'](_0xd8b0('0x47'))){_0x841d5a['limit']=qs[_0xd8b0('0x2c')](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x2c')]);_0x841d5a[_0xd8b0('0x2a')]=qs['offset'](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x2a')]);}_0x841d5a['order']=qs[_0xd8b0('0x48')](_0x3dfbb1[_0xd8b0('0x40')]['sort']);_0x841d5a[_0xd8b0('0x49')]=qs[_0xd8b0('0x42')](_[_0xd8b0('0x4a')](_0x3dfbb1[_0xd8b0('0x40')],_0x1c6335['filters']),_0xa3574a);if(_0x3dfbb1['query']['filter']){_0x841d5a[_0xd8b0('0x49')]=_[_0xd8b0('0x4b')](_0x841d5a[_0xd8b0('0x49')],{'$or':_[_0xd8b0('0x3a')](_0xa3574a,function(_0x18ab34){if(_0x18ab34[_0xd8b0('0x3e')]!==_0xd8b0('0x4c')){var _0x43fd9a={};_0x43fd9a[_0x18ab34[_0xd8b0('0x39')]]={'$like':'%'+_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x4d')]+'%'};return _0x43fd9a;}})});}_0x841d5a=_[_0xd8b0('0x4b')]({},_0x841d5a,_0x3dfbb1[_0xd8b0('0x4e')]);var _0x1addff={'where':_0x841d5a[_0xd8b0('0x49')]};return db[_0xd8b0('0x3b')][_0xd8b0('0x2d')](_0x1addff)[_0xd8b0('0x33')](function(_0x2adb63){_0x55a306[_0xd8b0('0x2d')]=_0x2adb63;if(_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x4f')]){_0x841d5a[_0xd8b0('0x50')]=[{'all':!![]}];}return db[_0xd8b0('0x3b')]['findAll'](_0x841d5a);})[_0xd8b0('0x33')](function(_0x3d229c){_0x55a306['rows']=_0x3d229c;return _0x55a306;})[_0xd8b0('0x33')](respondWithFilteredResult(_0x1cf9b3,_0x841d5a))[_0xd8b0('0x26')](handleError(_0x1cf9b3,null));};exports[_0xd8b0('0x51')]=function(_0x310ac1,_0xb26493){var _0x5453b9={'raw':![],'where':{'id':_0x310ac1[_0xd8b0('0x52')]['id']}},_0x384ef2={};_0x384ef2[_0xd8b0('0x45')]=_[_0xd8b0('0x41')](db[_0xd8b0('0x3b')][_0xd8b0('0x3c')]);_0x384ef2[_0xd8b0('0x40')]=_[_0xd8b0('0x41')](_0x310ac1['query']);_0x384ef2[_0xd8b0('0x42')]=_[_0xd8b0('0x43')](_0x384ef2[_0xd8b0('0x45')],_0x384ef2['query']);_0x5453b9['attributes']=_[_0xd8b0('0x43')](_0x384ef2[_0xd8b0('0x45')],qs[_0xd8b0('0x46')](_0x310ac1[_0xd8b0('0x40')][_0xd8b0('0x46')]));_0x5453b9[_0xd8b0('0x44')]=_0x5453b9[_0xd8b0('0x44')][_0xd8b0('0x53')]?_0x5453b9['attributes']:_0x384ef2[_0xd8b0('0x45')];if(_0x310ac1['query'][_0xd8b0('0x4f')]){_0x5453b9[_0xd8b0('0x50')]=[{'all':!![]}];}_0x5453b9=_[_0xd8b0('0x4b')]({},_0x5453b9,_0x310ac1[_0xd8b0('0x4e')]);return db[_0xd8b0('0x3b')][_0xd8b0('0x54')](_0x5453b9)[_0xd8b0('0x33')](handleEntityNotFound(_0xb26493,null))[_0xd8b0('0x33')](respondWithResult(_0xb26493,null))[_0xd8b0('0x26')](handleError(_0xb26493,null));};exports[_0xd8b0('0x55')]=function(_0x38d57a,_0xcd6968,_0x526a80){var _0x41f2e8;return db['VoiceContext'][_0xd8b0('0x55')](_0x38d57a[_0xd8b0('0x56')],{'raw':!![]})[_0xd8b0('0x33')](function(_0x5bfe11){_0x41f2e8=_0x5bfe11;return db[_0xd8b0('0x3b')][_0xd8b0('0x57')]({'raw':!![]});})[_0xd8b0('0x33')](function(_0x5da0f6){var _0x15a1e5=fs[_0xd8b0('0x58')](path['join'](config[_0xd8b0('0x59')],'server/files/templates/context.ejs'),_0xd8b0('0x5a'));var _0x373eb0=ejs[_0xd8b0('0x5b')](_0x15a1e5,{'contexts':_0x5da0f6||[]});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0x373eb0);})['then'](function(){return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x55'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x33')](function(){var _0x268de0=_0x38d57a['user'][_0xd8b0('0x34')]({'plain':!![]});if(!_0x268de0)throw new Error(_0xd8b0('0x60'));if(_0x268de0[_0xd8b0('0x61')]===_0xd8b0('0x62')){var _0x20f30d=_0x41f2e8['get']({'plain':!![]});return db[_0xd8b0('0x63')][_0xd8b0('0x54')]({'where':{'name':_0xd8b0('0x35'),'userProfileId':_0x268de0[_0xd8b0('0x64')]},'raw':!![]})[_0xd8b0('0x33')](function(_0x48052d){if(_0x48052d&&_0x48052d['autoAssociation']===0x0){return db[_0xd8b0('0x36')]['create']({'name':_0x20f30d[_0xd8b0('0x39')],'resourceId':_0x20f30d['id'],'type':_0x48052d[_0xd8b0('0x39')],'sectionId':_0x48052d['id']},{})[_0xd8b0('0x33')](function(){return _0x41f2e8;});}else{return _0x41f2e8;}})['catch'](function(_0x23ee8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ee8e);throw _0x23ee8e;});}return _0x41f2e8;})['then'](respondWithResult(_0xcd6968,0xc9))[_0xd8b0('0x26')](handleError(_0xcd6968,null));};exports[_0xd8b0('0x32')]=function(_0x79035,_0x26d7a3,_0x5b94dc){var _0xb1cb73;return db[_0xd8b0('0x3b')][_0xd8b0('0x54')]({'where':{'id':_0x79035['params']['id']}})['then'](handleEntityNotFound(_0x26d7a3,null))[_0xd8b0('0x33')](saveUpdates(_0x79035['body'],null))['then'](function(_0x130b8e){if(_0x130b8e){_0xb1cb73=_0x130b8e;return db['VoiceContext'][_0xd8b0('0x57')]({'raw':!![]});}})['then'](function(_0x5ac99d){var _0x2376cc=fs[_0xd8b0('0x58')](path[_0xd8b0('0x65')](config[_0xd8b0('0x59')],_0xd8b0('0x66')),_0xd8b0('0x5a'));var _0x6c6728=ejs[_0xd8b0('0x5b')](_0x2376cc,{'contexts':_0x5ac99d||[]});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0x6c6728);})[_0xd8b0('0x33')](function(){return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x32'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x33')](function(){return _0xb1cb73;})[_0xd8b0('0x33')](respondWithResult(_0x26d7a3,null))[_0xd8b0('0x26')](handleError(_0x26d7a3,null));};exports[_0xd8b0('0x37')]=function(_0x453c00,_0x3dcdde,_0x4a1341){var _0x1ddaef;return db['VoiceContext'][_0xd8b0('0x54')]({'where':{'id':_0x453c00['params']['id']}})[_0xd8b0('0x33')](handleEntityNotFound(_0x3dcdde,null))[_0xd8b0('0x33')](removeEntity(_0x3dcdde,null))['then'](function(){return db[_0xd8b0('0x3b')][_0xd8b0('0x57')]({'raw':!![]});})[_0xd8b0('0x33')](function(_0x594e33){var _0x2940ce=fs['readFileSync'](path[_0xd8b0('0x65')](config[_0xd8b0('0x59')],_0xd8b0('0x66')),'utf8');var _0xc190e3=ejs[_0xd8b0('0x5b')](_0x2940ce,{'contexts':_0x594e33});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0xc190e3);return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x37'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x26')](handleError(_0x3dcdde,null));}; \ No newline at end of file +var _0x1b7a=['end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','type','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','length','options','find','create','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','Reload','chan_sip.so','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','utf8','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status'];(function(_0x4ca218,_0x2c3b47){var _0x1856e7=function(_0x552e3d){while(--_0x552e3d){_0x4ca218['push'](_0x4ca218['shift']());}};_0x1856e7(++_0x2c3b47);}(_0x1b7a,0x172));var _0xa1b7=function(_0x17baf0,_0x17750f){_0x17baf0=_0x17baf0-0x0;var _0x2e0c36=_0x1b7a[_0x17baf0];return _0x2e0c36;};'use strict';var emlformat=require(_0xa1b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa1b7('0x1'));var rp=require('request-promise');var moment=require(_0xa1b7('0x2'));var BPromise=require(_0xa1b7('0x3'));var Mustache=require('mustache');var util=require(_0xa1b7('0x4'));var path=require(_0xa1b7('0x5'));var sox=require(_0xa1b7('0x6'));var csv=require('to-csv');var ejs=require(_0xa1b7('0x7'));var fs=require('fs');var fs_extra=require(_0xa1b7('0x8'));var _=require(_0xa1b7('0x9'));var squel=require(_0xa1b7('0xa'));var crypto=require('crypto');var jsforce=require(_0xa1b7('0xb'));var deskjs=require(_0xa1b7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa1b7('0xd'));var Redis=require(_0xa1b7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa1b7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1b7('0x10'));var logger=require(_0xa1b7('0x11'))(_0xa1b7('0x12'));var utils=require(_0xa1b7('0x13'));var config=require(_0xa1b7('0x14'));var licenseUtil=require(_0xa1b7('0x15'));var db=require(_0xa1b7('0x16'))['db'];var jayson=require(_0xa1b7('0x17'));var client=jayson[_0xa1b7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b1b39,_0x13422d,_0x577b89,_0x5f19c9){return new BPromise(function(_0x3b53a5,_0x4b08e7){var _0x379dc7=_0x5f19c9||client;return _0x379dc7[_0xa1b7('0x19')](_0x4b1b39,_0x577b89)[_0xa1b7('0x1a')](function(_0x19b94a){logger[_0xa1b7('0x1b')](_0xa1b7('0x1c'),_0x13422d,_0xa1b7('0x1d'));logger[_0xa1b7('0x1e')](_0xa1b7('0x1f'),_0x13422d,_0xa1b7('0x1d'),JSON[_0xa1b7('0x20')](_0x19b94a));if(_0x19b94a[_0xa1b7('0x21')]){if(_0x19b94a[_0xa1b7('0x21')][_0xa1b7('0x22')]===0x1f4){logger[_0xa1b7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x13422d,_0x19b94a[_0xa1b7('0x21')][_0xa1b7('0x23')]);return _0x4b08e7(_0x19b94a['error'][_0xa1b7('0x23')]);}logger[_0xa1b7('0x21')](_0xa1b7('0x1c'),_0x13422d,_0x19b94a[_0xa1b7('0x21')]['message']);return _0x3b53a5(_0x19b94a[_0xa1b7('0x21')]['message']);}else{logger[_0xa1b7('0x1b')](_0xa1b7('0x1c'),_0x13422d,_0xa1b7('0x1d'));_0x3b53a5(_0x19b94a['result'][_0xa1b7('0x23')]);}})['catch'](function(_0x27ffeb){logger[_0xa1b7('0x21')](_0xa1b7('0x1c'),_0x13422d,_0x27ffeb);_0x4b08e7(_0x27ffeb);});});}function respondWithStatusCode(_0x537824,_0x4d4d40){_0x4d4d40=_0x4d4d40||0xcc;return function(_0x25ee87){if(_0x25ee87){return _0x537824[_0xa1b7('0x24')](_0x4d4d40);}return _0x537824[_0xa1b7('0x25')](_0x4d4d40)[_0xa1b7('0x26')]();};}function respondWithResult(_0x531bf6,_0x65ac6c){_0x65ac6c=_0x65ac6c||0xc8;return function(_0x17b249){if(_0x17b249){return _0x531bf6[_0xa1b7('0x25')](_0x65ac6c)['json'](_0x17b249);}};}function respondWithFilteredResult(_0x5e982b,_0x392eb9){return function(_0xfb040a){if(_0xfb040a){var _0x44de6c=typeof _0x392eb9['offset']===_0xa1b7('0x27')&&typeof _0x392eb9[_0xa1b7('0x28')]===_0xa1b7('0x27');var _0x5b6f1b=_0xfb040a[_0xa1b7('0x29')];var _0x398ce2=_0x44de6c?0x0:_0x392eb9[_0xa1b7('0x2a')];var _0xf20f10=_0x44de6c?_0xfb040a['count']:_0x392eb9[_0xa1b7('0x2a')]+_0x392eb9[_0xa1b7('0x28')];var _0x1b3223;if(_0xf20f10>=_0x5b6f1b){_0xf20f10=_0x5b6f1b;_0x1b3223=0xc8;}else{_0x1b3223=0xce;}_0x5e982b['status'](_0x1b3223);return _0x5e982b[_0xa1b7('0x2b')](_0xa1b7('0x2c'),_0x398ce2+'-'+_0xf20f10+'/'+_0x5b6f1b)[_0xa1b7('0x2d')](_0xfb040a);}return null;};}function patchUpdates(_0xde1156){return function(_0x291752){try{jsonpatch['apply'](_0x291752,_0xde1156,!![]);}catch(_0x3b05d1){return BPromise[_0xa1b7('0x2e')](_0x3b05d1);}return _0x291752[_0xa1b7('0x2f')]();};}function saveUpdates(_0x5c1225,_0x121545){return function(_0x4354ac){if(_0x4354ac){return _0x4354ac[_0xa1b7('0x30')](_0x5c1225)['then'](function(_0x272075){return _0x272075;});}return null;};}function removeEntity(_0x1386e1,_0x457ea7){return function(_0x1d56ea){if(_0x1d56ea){return _0x1d56ea[_0xa1b7('0x31')]()[_0xa1b7('0x1a')](function(){var _0x59e0d6=_0x1d56ea[_0xa1b7('0x32')]({'plain':!![]});var _0x473617=_0xa1b7('0x33');return db[_0xa1b7('0x34')][_0xa1b7('0x31')]({'where':{'type':_0x473617,'resourceId':_0x59e0d6['id']}})[_0xa1b7('0x1a')](function(){return _0x1d56ea;});})['then'](function(){_0x1386e1[_0xa1b7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381b62,_0x372be7){return function(_0x20562f){if(!_0x20562f){_0x381b62[_0xa1b7('0x24')](0x194);}return _0x20562f;};}function handleError(_0x584f5b,_0x57d5c0){_0x57d5c0=_0x57d5c0||0x1f4;return function(_0x25491b){logger[_0xa1b7('0x21')](_0x25491b[_0xa1b7('0x35')]);if(_0x25491b[_0xa1b7('0x36')]){delete _0x25491b[_0xa1b7('0x36')];}_0x584f5b[_0xa1b7('0x25')](_0x57d5c0)[_0xa1b7('0x37')](_0x25491b);};}exports[_0xa1b7('0x38')]=function(_0x47c124,_0x3143f4){var _0x503d14={},_0x17c4d4={},_0x19a56b={'count':0x0,'rows':[]};var _0x1fb6e8=_[_0xa1b7('0x39')](db[_0xa1b7('0x3a')][_0xa1b7('0x3b')],function(_0x4e3758){return{'name':_0x4e3758['fieldName'],'type':_0x4e3758[_0xa1b7('0x3c')][_0xa1b7('0x3d')]};});_0x17c4d4[_0xa1b7('0x3e')]=_['map'](_0x1fb6e8,_0xa1b7('0x36'));_0x17c4d4['query']=_['keys'](_0x47c124['query']);_0x17c4d4['filters']=_[_0xa1b7('0x3f')](_0x17c4d4['model'],_0x17c4d4[_0xa1b7('0x40')]);_0x503d14[_0xa1b7('0x41')]=_[_0xa1b7('0x3f')](_0x17c4d4[_0xa1b7('0x3e')],qs[_0xa1b7('0x42')](_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x42')]));_0x503d14[_0xa1b7('0x41')]=_0x503d14['attributes']['length']?_0x503d14[_0xa1b7('0x41')]:_0x17c4d4[_0xa1b7('0x3e')];if(!_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x43')](_0xa1b7('0x44'))){_0x503d14[_0xa1b7('0x28')]=qs[_0xa1b7('0x28')](_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x28')]);_0x503d14['offset']=qs[_0xa1b7('0x2a')](_0x47c124['query']['offset']);}_0x503d14[_0xa1b7('0x45')]=qs['sort'](_0x47c124['query']['sort']);_0x503d14[_0xa1b7('0x46')]=qs[_0xa1b7('0x47')](_[_0xa1b7('0x48')](_0x47c124[_0xa1b7('0x40')],_0x17c4d4['filters']),_0x1fb6e8);if(_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x49')]){_0x503d14['where']=_[_0xa1b7('0x4a')](_0x503d14['where'],{'$or':_[_0xa1b7('0x39')](_0x1fb6e8,function(_0x2bc1f1){if(_0x2bc1f1[_0xa1b7('0x3c')]!==_0xa1b7('0x4b')){var _0x5391d4={};_0x5391d4[_0x2bc1f1[_0xa1b7('0x36')]]={'$like':'%'+_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x49')]+'%'};return _0x5391d4;}})});}_0x503d14=_[_0xa1b7('0x4a')]({},_0x503d14,_0x47c124['options']);var _0x447e10={'where':_0x503d14[_0xa1b7('0x46')]};return db[_0xa1b7('0x3a')]['count'](_0x447e10)['then'](function(_0x481bed){_0x19a56b['count']=_0x481bed;if(_0x47c124[_0xa1b7('0x40')][_0xa1b7('0x4c')]){_0x503d14[_0xa1b7('0x4d')]=[{'all':!![]}];}return db[_0xa1b7('0x3a')][_0xa1b7('0x4e')](_0x503d14);})['then'](function(_0x1e3b8e){_0x19a56b[_0xa1b7('0x4f')]=_0x1e3b8e;return _0x19a56b;})[_0xa1b7('0x1a')](respondWithFilteredResult(_0x3143f4,_0x503d14))[_0xa1b7('0x50')](handleError(_0x3143f4,null));};exports['show']=function(_0xabbe86,_0x21012b){var _0x22eab9={'raw':![],'where':{'id':_0xabbe86['params']['id']}},_0x388038={};_0x388038[_0xa1b7('0x3e')]=_[_0xa1b7('0x51')](db[_0xa1b7('0x3a')][_0xa1b7('0x3b')]);_0x388038[_0xa1b7('0x40')]=_[_0xa1b7('0x51')](_0xabbe86[_0xa1b7('0x40')]);_0x388038[_0xa1b7('0x47')]=_[_0xa1b7('0x3f')](_0x388038['model'],_0x388038['query']);_0x22eab9[_0xa1b7('0x41')]=_[_0xa1b7('0x3f')](_0x388038['model'],qs[_0xa1b7('0x42')](_0xabbe86['query'][_0xa1b7('0x42')]));_0x22eab9[_0xa1b7('0x41')]=_0x22eab9['attributes'][_0xa1b7('0x52')]?_0x22eab9[_0xa1b7('0x41')]:_0x388038[_0xa1b7('0x3e')];if(_0xabbe86['query'][_0xa1b7('0x4c')]){_0x22eab9['include']=[{'all':!![]}];}_0x22eab9=_[_0xa1b7('0x4a')]({},_0x22eab9,_0xabbe86[_0xa1b7('0x53')]);return db[_0xa1b7('0x3a')][_0xa1b7('0x54')](_0x22eab9)[_0xa1b7('0x1a')](handleEntityNotFound(_0x21012b,null))[_0xa1b7('0x1a')](respondWithResult(_0x21012b,null))['catch'](handleError(_0x21012b,null));};exports[_0xa1b7('0x55')]=function(_0x478099,_0x334cd3,_0x41fb99){var _0x177cc1;return db[_0xa1b7('0x3a')][_0xa1b7('0x55')](_0x478099['body'],{'raw':!![]})[_0xa1b7('0x1a')](function(_0x1274f8){_0x177cc1=_0x1274f8;return db[_0xa1b7('0x3a')][_0xa1b7('0x4e')]({'raw':!![]});})[_0xa1b7('0x1a')](function(_0x1d5891){var _0x68a2d=fs[_0xa1b7('0x56')](path[_0xa1b7('0x57')](config[_0xa1b7('0x58')],_0xa1b7('0x59')),'utf8');var _0x26a1c0=ejs[_0xa1b7('0x5a')](_0x68a2d,{'contexts':_0x1d5891||[]});fs[_0xa1b7('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x26a1c0);})[_0xa1b7('0x1a')](function(){return respondWithRpcPromise(_0xa1b7('0x5c'),_0xa1b7('0x55'),{'module':_0xa1b7('0x5d')});})[_0xa1b7('0x1a')](function(){var _0x31d4fe=_0x478099[_0xa1b7('0x5e')][_0xa1b7('0x32')]({'plain':!![]});if(!_0x31d4fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31d4fe[_0xa1b7('0x5f')]==='user'){var _0x3514b3=_0x177cc1[_0xa1b7('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xa1b7('0x54')]({'where':{'name':'Contexts','userProfileId':_0x31d4fe[_0xa1b7('0x60')]},'raw':!![]})[_0xa1b7('0x1a')](function(_0x200b81){if(_0x200b81&&_0x200b81[_0xa1b7('0x61')]===0x0){return db[_0xa1b7('0x34')][_0xa1b7('0x55')]({'name':_0x3514b3[_0xa1b7('0x36')],'resourceId':_0x3514b3['id'],'type':_0x200b81[_0xa1b7('0x36')],'sectionId':_0x200b81['id']},{})[_0xa1b7('0x1a')](function(){return _0x177cc1;});}else{return _0x177cc1;}})[_0xa1b7('0x50')](function(_0x214a6){logger[_0xa1b7('0x21')](_0xa1b7('0x62'),_0x214a6);throw _0x214a6;});}return _0x177cc1;})[_0xa1b7('0x1a')](respondWithResult(_0x334cd3,0xc9))[_0xa1b7('0x50')](handleError(_0x334cd3,null));};exports['update']=function(_0x27fd9e,_0x1cacec,_0x1cb904){var _0x5c872b;return db['VoiceContext']['find']({'where':{'id':_0x27fd9e[_0xa1b7('0x63')]['id']}})[_0xa1b7('0x1a')](handleEntityNotFound(_0x1cacec,null))[_0xa1b7('0x1a')](saveUpdates(_0x27fd9e['body'],null))[_0xa1b7('0x1a')](function(_0x23c4fe){if(_0x23c4fe){_0x5c872b=_0x23c4fe;return db[_0xa1b7('0x3a')][_0xa1b7('0x4e')]({'raw':!![]});}})[_0xa1b7('0x1a')](function(_0x28a399){var _0x4ce834=fs[_0xa1b7('0x56')](path[_0xa1b7('0x57')](config[_0xa1b7('0x58')],_0xa1b7('0x59')),_0xa1b7('0x64'));var _0x1acac0=ejs[_0xa1b7('0x5a')](_0x4ce834,{'contexts':_0x28a399||[]});fs[_0xa1b7('0x5b')](_0xa1b7('0x65'),_0x1acac0);})[_0xa1b7('0x1a')](function(){return respondWithRpcPromise(_0xa1b7('0x5c'),_0xa1b7('0x30'),{'module':'chan_sip.so'});})[_0xa1b7('0x1a')](function(){return _0x5c872b;})[_0xa1b7('0x1a')](respondWithResult(_0x1cacec,null))[_0xa1b7('0x50')](handleError(_0x1cacec,null));};exports[_0xa1b7('0x31')]=function(_0x3d93d7,_0x3f6794,_0x349ce4){var _0x5b6060;return db[_0xa1b7('0x3a')][_0xa1b7('0x54')]({'where':{'id':_0x3d93d7['params']['id']}})['then'](handleEntityNotFound(_0x3f6794,null))['then'](removeEntity(_0x3f6794,null))[_0xa1b7('0x1a')](function(){return db[_0xa1b7('0x3a')][_0xa1b7('0x4e')]({'raw':!![]});})[_0xa1b7('0x1a')](function(_0x37fc57){var _0x4a9017=fs[_0xa1b7('0x56')](path['join'](config[_0xa1b7('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x20f786=ejs['render'](_0x4a9017,{'contexts':_0x37fc57});fs[_0xa1b7('0x5b')](_0xa1b7('0x65'),_0x20f786);return respondWithRpcPromise(_0xa1b7('0x5c'),_0xa1b7('0x31'),{'module':_0xa1b7('0x5d')});})[_0xa1b7('0x50')](handleError(_0x3f6794,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 087d45d..dace81f 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 _0xa108=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xa108,0xc4));var _0x8a10=function(_0x224077,_0xeffd6b){_0x224077=_0x224077-0x0;var _0xf36f81=_0xa108[_0x224077];return _0xf36f81;};'use strict';var _=require(_0x8a10('0x0'));var util=require(_0x8a10('0x1'));var logger=require(_0x8a10('0x2'))(_0x8a10('0x3'));var moment=require(_0x8a10('0x4'));var BPromise=require(_0x8a10('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a10('0x6'));var rimraf=require(_0x8a10('0x7'));var config=require(_0x8a10('0x8'));var attributes=require(_0x8a10('0x9'));module['exports']=function(_0x112f33,_0x425989){return _0x112f33[_0x8a10('0xa')](_0x8a10('0xb'),attributes,{'tableName':_0x8a10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2a=['request-promise','path','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','../../config/logger','api','moment'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x5a2a,0x138));var _0xa5a2=function(_0x3dbf8e,_0x52c9d4){_0x3dbf8e=_0x3dbf8e-0x0;var _0x322e14=_0x5a2a[_0x3dbf8e];return _0x322e14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa5a2('0x0'))(_0xa5a2('0x1'));var moment=require(_0xa5a2('0x2'));var BPromise=require('bluebird');var rp=require(_0xa5a2('0x3'));var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require('rimraf');var config=require(_0xa5a2('0x5'));var attributes=require(_0xa5a2('0x6'));module['exports']=function(_0x29f700,_0x476ca0){return _0x29f700['define'](_0xa5a2('0x7'),attributes,{'tableName':_0xa5a2('0x8'),'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 fc0a7e7..497c40f 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 _0xc87b=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x460b3e,_0x44e1d7){var _0x4a85c8=function(_0x1dc185){while(--_0x1dc185){_0x460b3e['push'](_0x460b3e['shift']());}};_0x4a85c8(++_0x44e1d7);}(_0xc87b,0xb2));var _0xbc87=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc87b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xbc87('0x0'));var util=require(_0xbc87('0x1'));var moment=require(_0xbc87('0x2'));var BPromise=require(_0xbc87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc87('0x4'));var db=require(_0xbc87('0x5'))['db'];var utils=require(_0xbc87('0x6'));var logger=require('../../config/logger')(_0xbc87('0x7'));var config=require(_0xbc87('0x8'));var jayson=require(_0xbc87('0x9'));var client=jayson[_0xbc87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444000,_0x2efa9f,_0x51d5ed){return new BPromise(function(_0x2946bc,_0x1cc8d6){return client[_0xbc87('0xb')](_0x444000,_0x51d5ed)[_0xbc87('0xc')](function(_0x284f80){logger[_0xbc87('0xd')](_0xbc87('0xe'),_0x2efa9f,_0xbc87('0xf'));logger['debug'](_0xbc87('0x10'),_0x2efa9f,'request\x20sent',JSON[_0xbc87('0x11')](_0x284f80));if(_0x284f80[_0xbc87('0x12')]){if(_0x284f80[_0xbc87('0x12')]['code']===0x1f4){logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0x284f80[_0xbc87('0x12')][_0xbc87('0x13')]);return _0x1cc8d6(_0x284f80[_0xbc87('0x12')]['message']);}logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0x284f80['error'][_0xbc87('0x13')]);return _0x2946bc(_0x284f80[_0xbc87('0x12')][_0xbc87('0x13')]);}else{logger[_0xbc87('0xd')](_0xbc87('0xe'),_0x2efa9f,_0xbc87('0xf'));_0x2946bc(_0x284f80[_0xbc87('0x14')]['message']);}})[_0xbc87('0x15')](function(_0xa0de3d){logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0xa0de3d);_0x1cc8d6(_0xa0de3d);});});} \ No newline at end of file +var _0xfc64=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','lodash','util','moment','randomstring','ioredis'];(function(_0x2b2ea6,_0x3d98c1){var _0xb6e7d5=function(_0xb313e6){while(--_0xb313e6){_0x2b2ea6['push'](_0x2b2ea6['shift']());}};_0xb6e7d5(++_0x3d98c1);}(_0xfc64,0x1b3));var _0x4fc6=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xfc64[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x4fc6('0x0'));var util=require(_0x4fc6('0x1'));var moment=require(_0x4fc6('0x2'));var BPromise=require('bluebird');var rs=require(_0x4fc6('0x3'));var fs=require('fs');var Redis=require(_0x4fc6('0x4'));var db=require(_0x4fc6('0x5'))['db'];var utils=require(_0x4fc6('0x6'));var logger=require(_0x4fc6('0x7'))('rpc');var config=require(_0x4fc6('0x8'));var jayson=require(_0x4fc6('0x9'));var client=jayson[_0x4fc6('0xa')][_0x4fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f829a,_0x3d67db,_0x4487c4){return new BPromise(function(_0x5999c7,_0x1e566c){return client[_0x4fc6('0xc')](_0x1f829a,_0x4487c4)[_0x4fc6('0xd')](function(_0x23d866){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3d67db,_0x4fc6('0xe'));logger[_0x4fc6('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3d67db,'request\x20sent',JSON[_0x4fc6('0x10')](_0x23d866));if(_0x23d866[_0x4fc6('0x11')]){if(_0x23d866[_0x4fc6('0x11')][_0x4fc6('0x12')]===0x1f4){logger[_0x4fc6('0x11')](_0x4fc6('0x13'),_0x3d67db,_0x23d866[_0x4fc6('0x11')][_0x4fc6('0x14')]);return _0x1e566c(_0x23d866['error'][_0x4fc6('0x14')]);}logger[_0x4fc6('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3d67db,_0x23d866[_0x4fc6('0x11')]['message']);return _0x5999c7(_0x23d866['error']['message']);}else{logger[_0x4fc6('0x15')](_0x4fc6('0x13'),_0x3d67db,'request\x20sent');_0x5999c7(_0x23d866['result'][_0x4fc6('0x14')]);}})['catch'](function(_0x40dc97){logger[_0x4fc6('0x11')](_0x4fc6('0x13'),_0x3d67db,_0x40dc97);_0x1e566c(_0x40dc97);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b961b5e..8c43495 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 _0xd6be=['put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x262db8,_0x551bb2){var _0x1d8323=function(_0x5dfbb3){while(--_0x5dfbb3){_0x262db8['push'](_0x262db8['shift']());}};_0x1d8323(++_0x551bb2);}(_0xd6be,0x1bd));var _0xed6b=function(_0x189c87,_0x5f4abd){_0x189c87=_0x189c87-0x0;var _0x494842=_0xd6be[_0x189c87];return _0x494842;};'use strict';var multer=require(_0xed6b('0x0'));var util=require(_0xed6b('0x1'));var path=require('path');var timeout=require(_0xed6b('0x2'));var express=require(_0xed6b('0x3'));var router=express['Router']();var fs_extra=require(_0xed6b('0x4'));var auth=require(_0xed6b('0x5'));var interaction=require(_0xed6b('0x6'));var config=require(_0xed6b('0x7'));var controller=require(_0xed6b('0x8'));router[_0xed6b('0x9')]('/',auth[_0xed6b('0xa')](),controller['index']);router['get'](_0xed6b('0xb'),auth[_0xed6b('0xa')](),controller[_0xed6b('0xc')]);router[_0xed6b('0x9')](_0xed6b('0xd'),auth[_0xed6b('0xa')](),controller[_0xed6b('0xe')]);router[_0xed6b('0xf')]('/',auth['isAuthenticated'](),controller[_0xed6b('0x10')]);router[_0xed6b('0x11')]('/:id',auth[_0xed6b('0xa')](),controller[_0xed6b('0x12')]);router[_0xed6b('0x13')](_0xed6b('0xd'),auth[_0xed6b('0xa')](),controller[_0xed6b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd4cc=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x38ff71,_0x58fa98){var _0x428f4d=function(_0x269a44){while(--_0x269a44){_0x38ff71['push'](_0x38ff71['shift']());}};_0x428f4d(++_0x58fa98);}(_0xd4cc,0x114));var _0xcd4c=function(_0x1bb8ae,_0x16a589){_0x1bb8ae=_0x1bb8ae-0x0;var _0x590cff=_0xd4cc[_0x1bb8ae];return _0x590cff;};'use strict';var multer=require(_0xcd4c('0x0'));var util=require(_0xcd4c('0x1'));var path=require(_0xcd4c('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd4c('0x3'));var router=express['Router']();var fs_extra=require(_0xcd4c('0x4'));var auth=require(_0xcd4c('0x5'));var interaction=require(_0xcd4c('0x6'));var config=require(_0xcd4c('0x7'));var controller=require(_0xcd4c('0x8'));router[_0xcd4c('0x9')]('/',auth[_0xcd4c('0xa')](),controller[_0xcd4c('0xb')]);router[_0xcd4c('0x9')]('/describe',auth[_0xcd4c('0xa')](),controller[_0xcd4c('0xc')]);router[_0xcd4c('0x9')](_0xcd4c('0xd'),auth[_0xcd4c('0xa')](),controller[_0xcd4c('0xe')]);router[_0xcd4c('0xf')]('/',auth[_0xcd4c('0xa')](),controller[_0xcd4c('0x10')]);router[_0xcd4c('0x11')]('/:id',auth[_0xcd4c('0xa')](),controller[_0xcd4c('0x12')]);router[_0xcd4c('0x13')]('/:id',auth[_0xcd4c('0xa')](),controller['destroy']);module[_0xcd4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b59f4e6..bfdc566 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 _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0xc2917e,_0x3903ed){var _0x11e716=function(_0x38da18){while(--_0x38da18){_0xc2917e['push'](_0xc2917e['shift']());}};_0x11e716(++_0x3903ed);}(_0x008c,0x188));var _0xc008=function(_0x7e1b6b,_0x4ad71d){_0x7e1b6b=_0x7e1b6b-0x0;var _0x2b086f=_0x008c[_0x7e1b6b];return _0x2b086f;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x4bda99,_0x5f39e0){var _0x29737b=function(_0x5afe04){while(--_0x5afe04){_0x4bda99['push'](_0x4bda99['shift']());}};_0x29737b(++_0x5f39e0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x34bd60,_0x235471){_0x34bd60=_0x34bd60-0x0;var _0x265ed1=_0xe5b3[_0x34bd60];return _0x265ed1;};'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 3e97958..3e88086 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 _0x993f=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','VoiceDialReport','rawAttributes','type','key','model','query','keys'];(function(_0x35b63e,_0xf8ded2){var _0x2dc057=function(_0x3555eb){while(--_0x3555eb){_0x35b63e['push'](_0x35b63e['shift']());}};_0x2dc057(++_0xf8ded2);}(_0x993f,0x18f));var _0xf993=function(_0x77411d,_0x4610fa){_0x77411d=_0x77411d-0x0;var _0x20133d=_0x993f[_0x77411d];return _0x20133d;};'use strict';var emlformat=require(_0xf993('0x0'));var rimraf=require(_0xf993('0x1'));var zipdir=require(_0xf993('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf993('0x3'));var moment=require(_0xf993('0x4'));var BPromise=require(_0xf993('0x5'));var Mustache=require(_0xf993('0x6'));var util=require(_0xf993('0x7'));var path=require(_0xf993('0x8'));var sox=require(_0xf993('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf993('0xa'));var _=require('lodash');var squel=require(_0xf993('0xb'));var crypto=require(_0xf993('0xc'));var jsforce=require(_0xf993('0xd'));var deskjs=require(_0xf993('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf993('0xf'));var Papa=require(_0xf993('0x10'));var Redis=require(_0xf993('0x11'));var authService=require(_0xf993('0x12'));var qs=require(_0xf993('0x13'));var as=require(_0xf993('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf993('0x15'))(_0xf993('0x16'));var utils=require('../../config/utils');var config=require(_0xf993('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf993('0x18'))['db'];function respondWithStatusCode(_0x27233d,_0x2c4765){_0x2c4765=_0x2c4765||0xcc;return function(_0x484b03){if(_0x484b03){return _0x27233d[_0xf993('0x19')](_0x2c4765);}return _0x27233d[_0xf993('0x1a')](_0x2c4765)[_0xf993('0x1b')]();};}function respondWithResult(_0x27b174,_0x459db4){_0x459db4=_0x459db4||0xc8;return function(_0x6d0dab){if(_0x6d0dab){return _0x27b174[_0xf993('0x1a')](_0x459db4)[_0xf993('0x1c')](_0x6d0dab);}};}function respondWithFilteredResult(_0x7f3295,_0x5b46de){return function(_0x2ca771){if(_0x2ca771){var _0x2be395=typeof _0x5b46de[_0xf993('0x1d')]===_0xf993('0x1e')&&typeof _0x5b46de[_0xf993('0x1f')]===_0xf993('0x1e');var _0x2be869=_0x2ca771[_0xf993('0x20')];var _0x585293=_0x2be395?0x0:_0x5b46de[_0xf993('0x1d')];var _0x35b475=_0x2be395?_0x2ca771[_0xf993('0x20')]:_0x5b46de[_0xf993('0x1d')]+_0x5b46de['limit'];var _0xd19d57;if(_0x35b475>=_0x2be869){_0x35b475=_0x2be869;_0xd19d57=0xc8;}else{_0xd19d57=0xce;}_0x7f3295[_0xf993('0x1a')](_0xd19d57);return _0x7f3295[_0xf993('0x21')](_0xf993('0x22'),_0x585293+'-'+_0x35b475+'/'+_0x2be869)[_0xf993('0x1c')](_0x2ca771);}return null;};}function patchUpdates(_0x51ca27){return function(_0x13f32f){try{jsonpatch[_0xf993('0x23')](_0x13f32f,_0x51ca27,!![]);}catch(_0x236958){return BPromise[_0xf993('0x24')](_0x236958);}return _0x13f32f[_0xf993('0x25')]();};}function saveUpdates(_0x45c3d3,_0x5a0022){return function(_0x46ec48){if(_0x46ec48){return _0x46ec48[_0xf993('0x26')](_0x45c3d3)[_0xf993('0x27')](function(_0x406d16){return _0x406d16;});}return null;};}function removeEntity(_0x1866f7,_0x208bbb){return function(_0x153553){if(_0x153553){return _0x153553['destroy']()['then'](function(){_0x1866f7[_0xf993('0x1a')](0xcc)[_0xf993('0x1b')]();});}};}function handleEntityNotFound(_0x4b6d21,_0x5083e5){return function(_0x438a38){if(!_0x438a38){_0x4b6d21[_0xf993('0x19')](0x194);}return _0x438a38;};}function handleError(_0x2906d6,_0x538af3){_0x538af3=_0x538af3||0x1f4;return function(_0x2c26d3){logger['error'](_0x2c26d3[_0xf993('0x28')]);if(_0x2c26d3[_0xf993('0x29')]){delete _0x2c26d3[_0xf993('0x29')];}_0x2906d6[_0xf993('0x1a')](_0x538af3)[_0xf993('0x2a')](_0x2c26d3);};}exports['index']=function(_0x419f6,_0x560b5){var _0x343b7a={},_0x2292d6={},_0x185a05={'count':0x0,'rows':[]};var _0x2ca280=_[_0xf993('0x2b')](db[_0xf993('0x2c')][_0xf993('0x2d')],function(_0x3649df){return{'name':_0x3649df['fieldName'],'type':_0x3649df[_0xf993('0x2e')][_0xf993('0x2f')]};});_0x2292d6[_0xf993('0x30')]=_['map'](_0x2ca280,_0xf993('0x29'));_0x2292d6[_0xf993('0x31')]=_[_0xf993('0x32')](_0x419f6[_0xf993('0x31')]);_0x2292d6[_0xf993('0x33')]=_[_0xf993('0x34')](_0x2292d6[_0xf993('0x30')],_0x2292d6[_0xf993('0x31')]);_0x343b7a[_0xf993('0x35')]=_[_0xf993('0x34')](_0x2292d6[_0xf993('0x30')],qs[_0xf993('0x36')](_0x419f6[_0xf993('0x31')][_0xf993('0x36')]));_0x343b7a[_0xf993('0x35')]=_0x343b7a[_0xf993('0x35')]['length']?_0x343b7a[_0xf993('0x35')]:_0x2292d6[_0xf993('0x30')];if(!_0x419f6['query'][_0xf993('0x37')](_0xf993('0x38'))){_0x343b7a[_0xf993('0x1f')]=qs['limit'](_0x419f6[_0xf993('0x31')][_0xf993('0x1f')]);_0x343b7a[_0xf993('0x1d')]=qs[_0xf993('0x1d')](_0x419f6[_0xf993('0x31')]['offset']);}_0x343b7a[_0xf993('0x39')]=qs[_0xf993('0x3a')](_0x419f6[_0xf993('0x31')][_0xf993('0x3a')]);_0x343b7a[_0xf993('0x3b')]=qs['filters'](_[_0xf993('0x3c')](_0x419f6[_0xf993('0x31')],_0x2292d6[_0xf993('0x33')]),_0x2ca280);if(_0x419f6[_0xf993('0x31')]['filter']){_0x343b7a[_0xf993('0x3b')]=_[_0xf993('0x3d')](_0x343b7a[_0xf993('0x3b')],{'$or':_[_0xf993('0x2b')](_0x2ca280,function(_0x33a264){if(_0x33a264['type']!==_0xf993('0x3e')){var _0x1ad055={};_0x1ad055[_0x33a264[_0xf993('0x29')]]={'$like':'%'+_0x419f6[_0xf993('0x31')]['filter']+'%'};return _0x1ad055;}})});}_0x343b7a=_[_0xf993('0x3d')]({},_0x343b7a,_0x419f6[_0xf993('0x3f')]);var _0x3fb298={'where':_0x343b7a[_0xf993('0x3b')]};return db[_0xf993('0x2c')]['count'](_0x3fb298)['then'](function(_0x1b72be){_0x185a05[_0xf993('0x20')]=_0x1b72be;if(_0x419f6[_0xf993('0x31')][_0xf993('0x40')]){_0x343b7a[_0xf993('0x41')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf993('0x42')](_0x343b7a);})['then'](function(_0x2a84b6){_0x185a05['rows']=_0x2a84b6;return _0x185a05;})['then'](respondWithFilteredResult(_0x560b5,_0x343b7a))[_0xf993('0x43')](handleError(_0x560b5,null));};exports[_0xf993('0x44')]=function(_0x7c1c1c,_0x18c2c7){var _0x4a90ac={'raw':!![],'where':{'id':_0x7c1c1c[_0xf993('0x45')]['id']}},_0xeb5a65={};_0xeb5a65[_0xf993('0x30')]=_[_0xf993('0x32')](db[_0xf993('0x2c')]['rawAttributes']);_0xeb5a65[_0xf993('0x31')]=_[_0xf993('0x32')](_0x7c1c1c[_0xf993('0x31')]);_0xeb5a65[_0xf993('0x33')]=_[_0xf993('0x34')](_0xeb5a65[_0xf993('0x30')],_0xeb5a65['query']);_0x4a90ac[_0xf993('0x35')]=_[_0xf993('0x34')](_0xeb5a65[_0xf993('0x30')],qs[_0xf993('0x36')](_0x7c1c1c[_0xf993('0x31')][_0xf993('0x36')]));_0x4a90ac[_0xf993('0x35')]=_0x4a90ac[_0xf993('0x35')]['length']?_0x4a90ac[_0xf993('0x35')]:_0xeb5a65[_0xf993('0x30')];if(_0x7c1c1c[_0xf993('0x31')][_0xf993('0x40')]){_0x4a90ac[_0xf993('0x41')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x7c1c1c[_0xf993('0x3f')]);return db[_0xf993('0x2c')]['find'](_0x4a90ac)[_0xf993('0x27')](handleEntityNotFound(_0x18c2c7,null))[_0xf993('0x27')](respondWithResult(_0x18c2c7,null))[_0xf993('0x43')](handleError(_0x18c2c7,null));};exports[_0xf993('0x46')]=function(_0x1d64ac,_0x1ee372){return db[_0xf993('0x2c')][_0xf993('0x46')](_0x1d64ac[_0xf993('0x47')],{})['then'](respondWithResult(_0x1ee372,0xc9))['catch'](handleError(_0x1ee372,null));};exports['update']=function(_0x1de410,_0x58c169){if(_0x1de410['body']['id']){delete _0x1de410[_0xf993('0x47')]['id'];}return db[_0xf993('0x2c')][_0xf993('0x48')]({'where':{'id':_0x1de410[_0xf993('0x45')]['id']}})['then'](handleEntityNotFound(_0x58c169,null))[_0xf993('0x27')](saveUpdates(_0x1de410['body'],null))[_0xf993('0x27')](respondWithResult(_0x58c169,null))[_0xf993('0x43')](handleError(_0x58c169,null));};exports[_0xf993('0x49')]=function(_0x3e6ffb,_0x37ae0e){return db[_0xf993('0x2c')]['find']({'where':{'id':_0x3e6ffb[_0xf993('0x45')]['id']}})[_0xf993('0x27')](handleEntityNotFound(_0x37ae0e,null))[_0xf993('0x27')](removeEntity(_0x37ae0e,null))[_0xf993('0x43')](handleError(_0x37ae0e,null));};exports[_0xf993('0x4a')]=function(_0x24c80e,_0x47414a){return db[_0xf993('0x2c')][_0xf993('0x4a')]()[_0xf993('0x27')](respondWithResult(_0x47414a,null))[_0xf993('0x43')](handleError(_0x47414a,null));}; \ No newline at end of file +var _0x8a7f=['merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','VoiceDialReport','filters','options','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','name','send','index','map','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','nolimit','sort','where','pick','filter'];(function(_0x246aa7,_0x126c74){var _0x3fbdd8=function(_0x5d714d){while(--_0x5d714d){_0x246aa7['push'](_0x246aa7['shift']());}};_0x3fbdd8(++_0x126c74);}(_0x8a7f,0x178));var _0xf8a7=function(_0x50cc4a,_0x3225f2){_0x50cc4a=_0x50cc4a-0x0;var _0x3ec6e8=_0x8a7f[_0x50cc4a];return _0x3ec6e8;};'use strict';var emlformat=require(_0xf8a7('0x0'));var rimraf=require(_0xf8a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8a7('0x2'));var rp=require('request-promise');var moment=require(_0xf8a7('0x3'));var BPromise=require(_0xf8a7('0x4'));var Mustache=require(_0xf8a7('0x5'));var util=require(_0xf8a7('0x6'));var path=require(_0xf8a7('0x7'));var sox=require(_0xf8a7('0x8'));var csv=require(_0xf8a7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8a7('0xa'));var _=require(_0xf8a7('0xb'));var squel=require(_0xf8a7('0xc'));var crypto=require(_0xf8a7('0xd'));var jsforce=require(_0xf8a7('0xe'));var deskjs=require(_0xf8a7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf8a7('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf8a7('0x11'));var qs=require(_0xf8a7('0x12'));var as=require(_0xf8a7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf8a7('0x14'));var config=require(_0xf8a7('0x15'));var licenseUtil=require(_0xf8a7('0x16'));var db=require(_0xf8a7('0x17'))['db'];function respondWithStatusCode(_0x4560cf,_0x3784c5){_0x3784c5=_0x3784c5||0xcc;return function(_0x581a09){if(_0x581a09){return _0x4560cf['sendStatus'](_0x3784c5);}return _0x4560cf['status'](_0x3784c5)[_0xf8a7('0x18')]();};}function respondWithResult(_0x42fab1,_0x41c08b){_0x41c08b=_0x41c08b||0xc8;return function(_0x223ba5){if(_0x223ba5){return _0x42fab1[_0xf8a7('0x19')](_0x41c08b)[_0xf8a7('0x1a')](_0x223ba5);}};}function respondWithFilteredResult(_0x59859d,_0x4aea3d){return function(_0x4d6123){if(_0x4d6123){var _0x5a2100=typeof _0x4aea3d['offset']===_0xf8a7('0x1b')&&typeof _0x4aea3d['limit']===_0xf8a7('0x1b');var _0xe0089b=_0x4d6123[_0xf8a7('0x1c')];var _0x34d083=_0x5a2100?0x0:_0x4aea3d[_0xf8a7('0x1d')];var _0x2024a7=_0x5a2100?_0x4d6123['count']:_0x4aea3d['offset']+_0x4aea3d[_0xf8a7('0x1e')];var _0x3bb98f;if(_0x2024a7>=_0xe0089b){_0x2024a7=_0xe0089b;_0x3bb98f=0xc8;}else{_0x3bb98f=0xce;}_0x59859d[_0xf8a7('0x19')](_0x3bb98f);return _0x59859d[_0xf8a7('0x1f')]('Content-Range',_0x34d083+'-'+_0x2024a7+'/'+_0xe0089b)[_0xf8a7('0x1a')](_0x4d6123);}return null;};}function patchUpdates(_0xbcabd5){return function(_0x222a76){try{jsonpatch[_0xf8a7('0x20')](_0x222a76,_0xbcabd5,!![]);}catch(_0x472be8){return BPromise[_0xf8a7('0x21')](_0x472be8);}return _0x222a76[_0xf8a7('0x22')]();};}function saveUpdates(_0x5aba72,_0x20c08e){return function(_0x547324){if(_0x547324){return _0x547324['update'](_0x5aba72)[_0xf8a7('0x23')](function(_0x25fc30){return _0x25fc30;});}return null;};}function removeEntity(_0x240663,_0x44c070){return function(_0x504271){if(_0x504271){return _0x504271[_0xf8a7('0x24')]()['then'](function(){_0x240663[_0xf8a7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25fcae,_0x30167c){return function(_0x121435){if(!_0x121435){_0x25fcae[_0xf8a7('0x25')](0x194);}return _0x121435;};}function handleError(_0x59ff2e,_0x1c554b){_0x1c554b=_0x1c554b||0x1f4;return function(_0x14b4cb){logger['error'](_0x14b4cb['stack']);if(_0x14b4cb[_0xf8a7('0x26')]){delete _0x14b4cb[_0xf8a7('0x26')];}_0x59ff2e[_0xf8a7('0x19')](_0x1c554b)[_0xf8a7('0x27')](_0x14b4cb);};}exports[_0xf8a7('0x28')]=function(_0x5f1609,_0x4c8ab8){var _0x29af66={},_0x170b5a={},_0x7cac1e={'count':0x0,'rows':[]};var _0x21f3ac=_[_0xf8a7('0x29')](db['VoiceDialReport'][_0xf8a7('0x2a')],function(_0x16c5bc){return{'name':_0x16c5bc['fieldName'],'type':_0x16c5bc['type'][_0xf8a7('0x2b')]};});_0x170b5a['model']=_['map'](_0x21f3ac,'name');_0x170b5a[_0xf8a7('0x2c')]=_[_0xf8a7('0x2d')](_0x5f1609[_0xf8a7('0x2c')]);_0x170b5a['filters']=_['intersection'](_0x170b5a[_0xf8a7('0x2e')],_0x170b5a[_0xf8a7('0x2c')]);_0x29af66['attributes']=_[_0xf8a7('0x2f')](_0x170b5a[_0xf8a7('0x2e')],qs[_0xf8a7('0x30')](_0x5f1609[_0xf8a7('0x2c')][_0xf8a7('0x30')]));_0x29af66['attributes']=_0x29af66[_0xf8a7('0x31')][_0xf8a7('0x32')]?_0x29af66['attributes']:_0x170b5a['model'];if(!_0x5f1609[_0xf8a7('0x2c')]['hasOwnProperty'](_0xf8a7('0x33'))){_0x29af66['limit']=qs[_0xf8a7('0x1e')](_0x5f1609[_0xf8a7('0x2c')]['limit']);_0x29af66[_0xf8a7('0x1d')]=qs[_0xf8a7('0x1d')](_0x5f1609['query'][_0xf8a7('0x1d')]);}_0x29af66['order']=qs[_0xf8a7('0x34')](_0x5f1609['query'][_0xf8a7('0x34')]);_0x29af66[_0xf8a7('0x35')]=qs['filters'](_[_0xf8a7('0x36')](_0x5f1609[_0xf8a7('0x2c')],_0x170b5a['filters']),_0x21f3ac);if(_0x5f1609['query'][_0xf8a7('0x37')]){_0x29af66[_0xf8a7('0x35')]=_[_0xf8a7('0x38')](_0x29af66['where'],{'$or':_[_0xf8a7('0x29')](_0x21f3ac,function(_0x40cd8b){if(_0x40cd8b[_0xf8a7('0x39')]!==_0xf8a7('0x3a')){var _0x3e5353={};_0x3e5353[_0x40cd8b['name']]={'$like':'%'+_0x5f1609[_0xf8a7('0x2c')]['filter']+'%'};return _0x3e5353;}})});}_0x29af66=_['merge']({},_0x29af66,_0x5f1609['options']);var _0x1a7105={'where':_0x29af66['where']};return db['VoiceDialReport'][_0xf8a7('0x1c')](_0x1a7105)[_0xf8a7('0x23')](function(_0x17d3b6){_0x7cac1e[_0xf8a7('0x1c')]=_0x17d3b6;if(_0x5f1609['query'][_0xf8a7('0x3b')]){_0x29af66[_0xf8a7('0x3c')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf8a7('0x3d')](_0x29af66);})[_0xf8a7('0x23')](function(_0x3b58b6){_0x7cac1e[_0xf8a7('0x3e')]=_0x3b58b6;return _0x7cac1e;})['then'](respondWithFilteredResult(_0x4c8ab8,_0x29af66))[_0xf8a7('0x3f')](handleError(_0x4c8ab8,null));};exports['show']=function(_0x3ff92c,_0xd325df){var _0x72d18={'raw':!![],'where':{'id':_0x3ff92c[_0xf8a7('0x40')]['id']}},_0x18004d={};_0x18004d[_0xf8a7('0x2e')]=_[_0xf8a7('0x2d')](db[_0xf8a7('0x41')][_0xf8a7('0x2a')]);_0x18004d['query']=_[_0xf8a7('0x2d')](_0x3ff92c['query']);_0x18004d[_0xf8a7('0x42')]=_[_0xf8a7('0x2f')](_0x18004d['model'],_0x18004d[_0xf8a7('0x2c')]);_0x72d18['attributes']=_[_0xf8a7('0x2f')](_0x18004d['model'],qs[_0xf8a7('0x30')](_0x3ff92c[_0xf8a7('0x2c')][_0xf8a7('0x30')]));_0x72d18['attributes']=_0x72d18[_0xf8a7('0x31')][_0xf8a7('0x32')]?_0x72d18[_0xf8a7('0x31')]:_0x18004d[_0xf8a7('0x2e')];if(_0x3ff92c[_0xf8a7('0x2c')]['includeAll']){_0x72d18[_0xf8a7('0x3c')]=[{'all':!![]}];}_0x72d18=_[_0xf8a7('0x38')]({},_0x72d18,_0x3ff92c[_0xf8a7('0x43')]);return db[_0xf8a7('0x41')]['find'](_0x72d18)['then'](handleEntityNotFound(_0xd325df,null))['then'](respondWithResult(_0xd325df,null))[_0xf8a7('0x3f')](handleError(_0xd325df,null));};exports['create']=function(_0x3da9e4,_0x308601){return db[_0xf8a7('0x41')]['create'](_0x3da9e4[_0xf8a7('0x44')],{})[_0xf8a7('0x23')](respondWithResult(_0x308601,0xc9))[_0xf8a7('0x3f')](handleError(_0x308601,null));};exports[_0xf8a7('0x45')]=function(_0x13c246,_0x1b3c13){if(_0x13c246[_0xf8a7('0x44')]['id']){delete _0x13c246['body']['id'];}return db[_0xf8a7('0x41')][_0xf8a7('0x46')]({'where':{'id':_0x13c246[_0xf8a7('0x40')]['id']}})[_0xf8a7('0x23')](handleEntityNotFound(_0x1b3c13,null))[_0xf8a7('0x23')](saveUpdates(_0x13c246[_0xf8a7('0x44')],null))[_0xf8a7('0x23')](respondWithResult(_0x1b3c13,null))[_0xf8a7('0x3f')](handleError(_0x1b3c13,null));};exports[_0xf8a7('0x24')]=function(_0x2c045e,_0x13a0c4){return db['VoiceDialReport'][_0xf8a7('0x46')]({'where':{'id':_0x2c045e[_0xf8a7('0x40')]['id']}})[_0xf8a7('0x23')](handleEntityNotFound(_0x13a0c4,null))['then'](removeEntity(_0x13a0c4,null))['catch'](handleError(_0x13a0c4,null));};exports[_0xf8a7('0x47')]=function(_0x28c14f,_0x219e9b){return db[_0xf8a7('0x41')][_0xf8a7('0x47')]()[_0xf8a7('0x23')](respondWithResult(_0x219e9b,null))['catch'](handleError(_0x219e9b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ecb707b..d97f96d 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 _0xc5ad=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0xc5ad,0xea));var _0xdc5a=function(_0x28068c,_0x2e0454){_0x28068c=_0x28068c-0x0;var _0x13559a=_0xc5ad[_0x28068c];return _0x13559a;};'use strict';var _=require(_0xdc5a('0x0'));var util=require(_0xdc5a('0x1'));var logger=require(_0xdc5a('0x2'))(_0xdc5a('0x3'));var moment=require(_0xdc5a('0x4'));var BPromise=require(_0xdc5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc5a('0x6'));var rimraf=require(_0xdc5a('0x7'));var config=require(_0xdc5a('0x8'));var attributes=require(_0xdc5a('0x9'));module[_0xdc5a('0xa')]=function(_0x51544e,_0x5a71f1){return _0x51544e[_0xdc5a('0xb')]('VoiceDialReport',attributes,{'tableName':_0xdc5a('0xc'),'paranoid':![],'indexes':[{'fields':[_0xdc5a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01ab=['exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x853e64,_0x42bb1e){var _0xe300cc=function(_0x425a46){while(--_0x425a46){_0x853e64['push'](_0x853e64['shift']());}};_0xe300cc(++_0x42bb1e);}(_0x01ab,0xaa));var _0xb01a=function(_0x254744,_0x219e6b){_0x254744=_0x254744-0x0;var _0x2a6a96=_0x01ab[_0x254744];return _0x2a6a96;};'use strict';var _=require(_0xb01a('0x0'));var util=require(_0xb01a('0x1'));var logger=require(_0xb01a('0x2'))('api');var moment=require(_0xb01a('0x3'));var BPromise=require(_0xb01a('0x4'));var rp=require(_0xb01a('0x5'));var fs=require('fs');var path=require(_0xb01a('0x6'));var rimraf=require(_0xb01a('0x7'));var config=require(_0xb01a('0x8'));var attributes=require(_0xb01a('0x9'));module[_0xb01a('0xa')]=function(_0x450f3c,_0x1115a5){return _0x450f3c[_0xb01a('0xb')](_0xb01a('0xc'),attributes,{'tableName':_0xb01a('0xd'),'paranoid':![],'indexes':[{'fields':[_0xb01a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2939383..a58bb03 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 _0xdb9e=['UpdateVoiceDialReport','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport'];(function(_0x4cd696,_0x74c45f){var _0x4c7dec=function(_0x374a73){while(--_0x374a73){_0x4cd696['push'](_0x4cd696['shift']());}};_0x4c7dec(++_0x74c45f);}(_0xdb9e,0x197));var _0xedb9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb9e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xedb9('0x0'));var BPromise=require(_0xedb9('0x1'));var rs=require(_0xedb9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb9('0x3'))['db'];var utils=require(_0xedb9('0x4'));var logger=require('../../config/logger')(_0xedb9('0x5'));var config=require(_0xedb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedb9('0x7')][_0xedb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4de0b9,_0x2e3284,_0x4d6779){return new BPromise(function(_0xdc8dd0,_0x4d1ed1){return client[_0xedb9('0x9')](_0x4de0b9,_0x4d6779)[_0xedb9('0xa')](function(_0x3f2360){logger[_0xedb9('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0xedb9('0xc'));logger[_0xedb9('0xd')](_0xedb9('0xe'),_0x2e3284,'request\x20sent',JSON[_0xedb9('0xf')](_0x3f2360));if(_0x3f2360[_0xedb9('0x10')]){if(_0x3f2360['error'][_0xedb9('0x11')]===0x1f4){logger[_0xedb9('0x10')](_0xedb9('0x12'),_0x2e3284,_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);return _0x4d1ed1(_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);}logger[_0xedb9('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);return _0xdc8dd0(_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);}else{logger[_0xedb9('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0xedb9('0xc'));_0xdc8dd0(_0x3f2360['result'][_0xedb9('0x13')]);}})[_0xedb9('0x14')](function(_0x2f3fa5){logger[_0xedb9('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0x2f3fa5);_0x4d1ed1(_0x2f3fa5);});});}exports['CreateVoiceDialReport']=function(_0x557cfe){var _0x43d88c=this;return new Promise(function(_0x3f8e9b,_0x190de7){return db[_0xedb9('0x15')][_0xedb9('0x16')](_0x557cfe[_0xedb9('0x17')],{'raw':_0x557cfe[_0xedb9('0x18')]?_0x557cfe[_0xedb9('0x18')][_0xedb9('0x19')]===undefined?!![]:![]:!![]})[_0xedb9('0xa')](function(_0x3503a3){logger['info'](_0xedb9('0x1a'),_0x557cfe);logger[_0xedb9('0xd')](_0xedb9('0x1a'),_0x557cfe,JSON[_0xedb9('0xf')](_0x3503a3));_0x3f8e9b(_0x3503a3);})['catch'](function(_0x2798d8){logger[_0xedb9('0x10')](_0xedb9('0x1a'),_0x2798d8['message'],_0x557cfe);_0x190de7(_0x43d88c[_0xedb9('0x10')](0x1f4,_0x2798d8[_0xedb9('0x13')]));});});};exports[_0xedb9('0x1b')]=function(_0x42dbd5){var _0x136214=this;return new Promise(function(_0x318473,_0x23472e){return db[_0xedb9('0x15')]['update'](_0x42dbd5[_0xedb9('0x17')],{'raw':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42dbd5['options']?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1c')]||null:null,'attributes':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1d')]||null:null,'limit':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1e')]||null:null})['then'](function(_0x14a54b){logger[_0xedb9('0xb')](_0xedb9('0x1b'),_0x42dbd5);logger[_0xedb9('0xd')](_0xedb9('0x1b'),_0x42dbd5,JSON[_0xedb9('0xf')](_0x14a54b));_0x318473(_0x14a54b);})['catch'](function(_0x3b776e){logger[_0xedb9('0x10')](_0xedb9('0x1b'),_0x3b776e[_0xedb9('0x13')],_0x42dbd5);_0x23472e(_0x136214[_0xedb9('0x10')](0x1f4,_0x3b776e[_0xedb9('0x13')]));});});}; \ No newline at end of file +var _0xc5e0=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','UpdateVoiceDialReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc5e0,0x11c));var _0x0c5e=function(_0x591c9b,_0x2201f6){_0x591c9b=_0x591c9b-0x0;var _0x4bfc6c=_0xc5e0[_0x591c9b];return _0x4bfc6c;};'use strict';var _=require(_0x0c5e('0x0'));var util=require(_0x0c5e('0x1'));var moment=require(_0x0c5e('0x2'));var BPromise=require(_0x0c5e('0x3'));var rs=require(_0x0c5e('0x4'));var fs=require('fs');var Redis=require(_0x0c5e('0x5'));var db=require(_0x0c5e('0x6'))['db'];var utils=require(_0x0c5e('0x7'));var logger=require(_0x0c5e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c5e('0x9')][_0x0c5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc8b0,_0x547ebc,_0x3525e8){return new BPromise(function(_0x5a7271,_0x8c06c2){return client[_0x0c5e('0xb')](_0x2dc8b0,_0x3525e8)[_0x0c5e('0xc')](function(_0xf488ec){logger[_0x0c5e('0xd')](_0x0c5e('0xe'),_0x547ebc,_0x0c5e('0xf'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x547ebc,_0x0c5e('0xf'),JSON[_0x0c5e('0x10')](_0xf488ec));if(_0xf488ec['error']){if(_0xf488ec[_0x0c5e('0x11')][_0x0c5e('0x12')]===0x1f4){logger['error'](_0x0c5e('0xe'),_0x547ebc,_0xf488ec['error'][_0x0c5e('0x13')]);return _0x8c06c2(_0xf488ec[_0x0c5e('0x11')][_0x0c5e('0x13')]);}logger[_0x0c5e('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x547ebc,_0xf488ec['error'][_0x0c5e('0x13')]);return _0x5a7271(_0xf488ec[_0x0c5e('0x11')]['message']);}else{logger[_0x0c5e('0xd')](_0x0c5e('0xe'),_0x547ebc,'request\x20sent');_0x5a7271(_0xf488ec[_0x0c5e('0x14')][_0x0c5e('0x13')]);}})[_0x0c5e('0x15')](function(_0x5cc1e5){logger[_0x0c5e('0x11')](_0x0c5e('0xe'),_0x547ebc,_0x5cc1e5);_0x8c06c2(_0x5cc1e5);});});}exports[_0x0c5e('0x16')]=function(_0x445082){var _0x582abf=this;return new Promise(function(_0x1817d2,_0x500770){return db[_0x0c5e('0x17')][_0x0c5e('0x18')](_0x445082[_0x0c5e('0x19')],{'raw':_0x445082[_0x0c5e('0x1a')]?_0x445082[_0x0c5e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0c5e('0xc')](function(_0x5edce4){logger[_0x0c5e('0xd')](_0x0c5e('0x16'),_0x445082);logger[_0x0c5e('0x1b')](_0x0c5e('0x16'),_0x445082,JSON['stringify'](_0x5edce4));_0x1817d2(_0x5edce4);})[_0x0c5e('0x15')](function(_0x59773c){logger['error'](_0x0c5e('0x16'),_0x59773c['message'],_0x445082);_0x500770(_0x582abf[_0x0c5e('0x11')](0x1f4,_0x59773c['message']));});});};exports[_0x0c5e('0x1c')]=function(_0x2dfcd0){var _0x57d664=this;return new Promise(function(_0x2567ba,_0x146c5b){return db[_0x0c5e('0x17')][_0x0c5e('0x1d')](_0x2dfcd0['body'],{'raw':_0x2dfcd0['options']?_0x2dfcd0[_0x0c5e('0x1a')][_0x0c5e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dfcd0[_0x0c5e('0x1a')]?_0x2dfcd0[_0x0c5e('0x1a')][_0x0c5e('0x1f')]||null:null,'attributes':_0x2dfcd0['options']?_0x2dfcd0['options']['attributes']||null:null,'limit':_0x2dfcd0['options']?_0x2dfcd0[_0x0c5e('0x1a')][_0x0c5e('0x20')]||null:null})[_0x0c5e('0xc')](function(_0x2d1064){logger[_0x0c5e('0xd')](_0x0c5e('0x1c'),_0x2dfcd0);logger[_0x0c5e('0x1b')](_0x0c5e('0x1c'),_0x2dfcd0,JSON[_0x0c5e('0x10')](_0x2d1064));_0x2567ba(_0x2d1064);})['catch'](function(_0x58ef02){logger['error'](_0x0c5e('0x1c'),_0x58ef02[_0x0c5e('0x13')],_0x2dfcd0);_0x146c5b(_0x57d664[_0x0c5e('0x11')](0x1f4,_0x58ef02[_0x0c5e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bbac64c..ba64b35 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 _0xa2f5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4725d6,_0x3506b9){var _0x4c7391=function(_0x5bdebe){while(--_0x5bdebe){_0x4725d6['push'](_0x4725d6['shift']());}};_0x4c7391(++_0x3506b9);}(_0xa2f5,0x188));var _0x5a2f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa2f5[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x5a2f('0x0'));var util=require(_0x5a2f('0x1'));var path=require(_0x5a2f('0x2'));var timeout=require(_0x5a2f('0x3'));var express=require(_0x5a2f('0x4'));var router=express[_0x5a2f('0x5')]();var fs_extra=require(_0x5a2f('0x6'));var auth=require(_0x5a2f('0x7'));var interaction=require(_0x5a2f('0x8'));var config=require(_0x5a2f('0x9'));var controller=require('./voiceExtension.controller');router[_0x5a2f('0xa')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xb')]);router['get'](_0x5a2f('0xc'),auth[_0x5a2f('0xd')](),controller['show']);router[_0x5a2f('0xe')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xf')]);router['post']('/:id/applications',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x10')]);router[_0x5a2f('0x11')]('/:id',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x12')]);router[_0x5a2f('0x13')](_0x5a2f('0xc'),auth['isAuthenticated'](),controller[_0x5a2f('0x14')]);module[_0x5a2f('0x15')]=router; \ No newline at end of file +var _0x733f=['/:id','isAuthenticated','show','post','create','addApplications','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x733f,0xc7));var _0xf733=function(_0x24d0a6,_0x48ff79){_0x24d0a6=_0x24d0a6-0x0;var _0xe6e137=_0x733f[_0x24d0a6];return _0xe6e137;};'use strict';var multer=require(_0xf733('0x0'));var util=require(_0xf733('0x1'));var path=require(_0xf733('0x2'));var timeout=require(_0xf733('0x3'));var express=require(_0xf733('0x4'));var router=express['Router']();var fs_extra=require(_0xf733('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf733('0x6'));var config=require(_0xf733('0x7'));var controller=require(_0xf733('0x8'));router[_0xf733('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf733('0xa'),auth[_0xf733('0xb')](),controller[_0xf733('0xc')]);router[_0xf733('0xd')]('/',auth['isAuthenticated'](),controller[_0xf733('0xe')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf733('0xf')]);router['put'](_0xf733('0xa'),auth[_0xf733('0xb')](),controller[_0xf733('0x10')]);router[_0xf733('0x11')](_0xf733('0xa'),auth[_0xf733('0xb')](),controller[_0xf733('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 8400cf5..6bcb7c0 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 _0x6084=['exten','STRING','compositeIndex','NoOp','ENUM','inbound','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6084,0xfd));var _0x4608=function(_0x16a857,_0x1ba2d5){_0x16a857=_0x16a857-0x0;var _0x375377=_0x6084[_0x16a857];return _0x375377;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'unique':_0x4608('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'unique':_0x4608('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4608('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4608('0x2')},'appdata':{'type':Sequelize[_0x4608('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4608('0x3')](_0x4608('0x4'),'outbound','internal',_0x4608('0x5'),'outbound-fax',_0x4608('0x6'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x4608('0x0')]},'interval':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'defaultValue':_0x4608('0x7')},'IntervalId':{'type':Sequelize[_0x4608('0x8')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4608('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4608('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x4608('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x4608('0x0')],'defaultValue':_0x4608('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3cf309){return this['getDataValue'](_0x4608('0xb'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7e40=['wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x4a6a6b,_0x4f2226){var _0x479216=function(_0x278ee3){while(--_0x278ee3){_0x4a6a6b['push'](_0x4a6a6b['shift']());}};_0x479216(++_0x4f2226);}(_0x7e40,0x136));var _0x07e4=function(_0x55f10a,_0x46dad1){_0x55f10a=_0x55f10a-0x0;var _0x23851b=_0x7e40[_0x55f10a];return _0x23851b;};'use strict';var Sequelize=require(_0x07e4('0x0'));module[_0x07e4('0x1')]={'context':{'type':Sequelize[_0x07e4('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x07e4('0x2')],'allowNull':![],'unique':_0x07e4('0x3')},'priority':{'type':Sequelize[_0x07e4('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x07e4('0x3')},'tag':{'type':Sequelize[_0x07e4('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x07e4('0x4')},'appdata':{'type':Sequelize[_0x07e4('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x07e4('0x5'),_0x07e4('0x6'),_0x07e4('0x7'),_0x07e4('0x8'),'outbound-fax','system',_0x07e4('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x07e4('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x07e4('0xa')},'IntervalId':{'type':Sequelize[_0x07e4('0xb')]},'isApp':{'type':Sequelize[_0x07e4('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x07e4('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x07e4('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x07e4('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x07e4('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x07e4('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x07e4('0xe')],'get':function(_0x555559){return this[_0x07e4('0xf')](_0x07e4('0x10'));}},'alias':{'type':Sequelize[_0x07e4('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 d2dedae..eac69be 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 _0xd171=['socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','context','description','recordingFormat','cutdigits','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0xe68e5b,_0x399915){var _0x155d7a=function(_0x3ef1d3){while(--_0x3ef1d3){_0xe68e5b['push'](_0xe68e5b['shift']());}};_0x155d7a(++_0x399915);}(_0xd171,0xfc));var _0x1d17=function(_0xabbfc7,_0x33d449){_0xabbfc7=_0xabbfc7-0x0;var _0x2a2a62=_0xd171[_0xabbfc7];return _0x2a2a62;};'use strict';var _=require(_0x1d17('0x0'));var Redis=require(_0x1d17('0x1'));var qs=require(_0x1d17('0x2'));var logger=require(_0x1d17('0x3'))(_0x1d17('0x4'));var config=require(_0x1d17('0x5'));var db=require(_0x1d17('0x6'))['db'];config[_0x1d17('0x7')]=_[_0x1d17('0x8')](config[_0x1d17('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d17('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x1d17('0xa')](socket);function respondWithStatusCode(_0x2456d4,_0x583a97){_0x583a97=_0x583a97||0xcc;return function(_0x46e777){if(_0x46e777){return _0x2456d4[_0x1d17('0xb')](_0x583a97);}return _0x2456d4['status'](_0x583a97)['end']();};}function respondWithResult(_0xa35312,_0x3d5cc7){_0x3d5cc7=_0x3d5cc7||0xc8;return function(_0x461aac){if(_0x461aac){return _0xa35312[_0x1d17('0xc')](_0x3d5cc7)[_0x1d17('0xd')](_0x461aac);}};}function respondWithFilteredResult(_0x349d09,_0x131857){return function(_0x67e6b4){if(_0x67e6b4){var _0xd1789d=typeof _0x131857[_0x1d17('0xe')]===_0x1d17('0xf')&&typeof _0x131857['limit']==='undefined';var _0x2f7280=_0x67e6b4[_0x1d17('0x10')];var _0x2f3822=_0xd1789d?0x0:_0x131857[_0x1d17('0xe')];var _0x57e49d=_0xd1789d?_0x67e6b4[_0x1d17('0x10')]:_0x131857[_0x1d17('0xe')]+_0x131857[_0x1d17('0x11')];var _0x13548a;if(_0x57e49d>=_0x2f7280){_0x57e49d=_0x2f7280;_0x13548a=0xc8;}else{_0x13548a=0xce;}_0x349d09[_0x1d17('0xc')](_0x13548a);return _0x349d09[_0x1d17('0x12')](_0x1d17('0x13'),_0x2f3822+'-'+_0x57e49d+'/'+_0x2f7280)[_0x1d17('0xd')](_0x67e6b4);}return null;};}function removeEntity(_0x2ebe53){return function(_0x113f81){if(_0x113f81){return _0x113f81[_0x1d17('0x14')]()['then'](function(){var _0x490c0e=_0x113f81['get']({'plain':!![]});var _0x414dfc=[{'name':_0x1d17('0x15'),'value':_0x1d17('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1d17('0x17'),'ignore':![]},{'name':_0x1d17('0x18'),'value':_0x1d17('0x19'),'ignore':![]}];var _0x4f4a52=_(_0x414dfc)[_0x1d17('0x1a')]('ignore')[_0x1d17('0x1b')]('value')[_0x1d17('0x1c')]();if(_[_0x1d17('0x1d')](_0x4f4a52,_0x490c0e[_0x1d17('0x1e')])){return;}var _0x488c6d=_[_0x1d17('0x1f')](_0x414dfc,['value',_0x490c0e[_0x1d17('0x1e')]])[_0x1d17('0x20')];return db[_0x1d17('0x21')][_0x1d17('0x14')]({'where':{'type':_0x488c6d,'resourceId':_0x490c0e['id']}})[_0x1d17('0x22')](function(){return _0x113f81;});})['then'](function(){_0x2ebe53[_0x1d17('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff1f3){return function(_0x37230d){if(!_0x37230d){_0x2ff1f3[_0x1d17('0xb')](0x194);}return _0x37230d;};}function handleError(_0x709d0a,_0x21d3e0){_0x21d3e0=_0x21d3e0||0x1f4;return function(_0x49c9ae){logger[_0x1d17('0x23')](_0x49c9ae[_0x1d17('0x24')]);if(_0x49c9ae[_0x1d17('0x20')]){delete _0x49c9ae[_0x1d17('0x20')];}_0x709d0a[_0x1d17('0xc')](_0x21d3e0)[_0x1d17('0x25')](_0x49c9ae);};}exports[_0x1d17('0x26')]=function(_0xec81ef,_0x1a9cdc){var _0x4aa6c8={},_0x43dd96={},_0x2ad8fa={'count':0x0,'rows':[]};var _0x218e27=_[_0x1d17('0x1b')](db[_0x1d17('0x27')][_0x1d17('0x28')],function(_0x3e4dbe){return{'name':_0x3e4dbe['fieldName'],'type':_0x3e4dbe['type'][_0x1d17('0x29')]};});_0x43dd96['model']=_[_0x1d17('0x1b')](_0x218e27,_0x1d17('0x20'));_0x43dd96['query']=_[_0x1d17('0x2a')](_0xec81ef[_0x1d17('0x2b')]);_0x43dd96['filters']=_[_0x1d17('0x2c')](_0x43dd96[_0x1d17('0x2d')],_0x43dd96[_0x1d17('0x2b')]);_0x4aa6c8['attributes']=_[_0x1d17('0x2c')](_0x43dd96[_0x1d17('0x2d')],qs[_0x1d17('0x2e')](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x2e')]));_0x4aa6c8[_0x1d17('0x2f')]=_0x4aa6c8[_0x1d17('0x2f')][_0x1d17('0x30')]?_0x4aa6c8[_0x1d17('0x2f')]:_0x43dd96['model'];if(!_0xec81ef[_0x1d17('0x2b')]['hasOwnProperty'](_0x1d17('0x31'))){_0x4aa6c8[_0x1d17('0x11')]=qs[_0x1d17('0x11')](_0xec81ef['query'][_0x1d17('0x11')]);_0x4aa6c8['offset']=qs['offset'](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0xe')]);}_0x4aa6c8[_0x1d17('0x32')]=qs['sort'](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x33')]);_0x4aa6c8[_0x1d17('0x34')]=qs['filters'](_[_0x1d17('0x35')](_0xec81ef[_0x1d17('0x2b')],_0x43dd96['filters']),_0x218e27);if(_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x1a')]){_0x4aa6c8[_0x1d17('0x34')]=_[_0x1d17('0x36')](_0x4aa6c8[_0x1d17('0x34')],{'$or':_[_0x1d17('0x1b')](_0x218e27,function(_0x1898bb){if(_0x1898bb[_0x1d17('0x1e')]!==_0x1d17('0x37')){var _0x302a91={};_0x302a91[_0x1898bb[_0x1d17('0x20')]]={'$like':'%'+_0xec81ef['query'][_0x1d17('0x1a')]+'%'};return _0x302a91;}})});}_0x4aa6c8=_[_0x1d17('0x36')]({},_0x4aa6c8,_0xec81ef[_0x1d17('0x38')]);var _0x12f499={'where':_0x4aa6c8['where']};return db['VoiceExtension'][_0x1d17('0x10')](_0x12f499)[_0x1d17('0x22')](function(_0x28251a){_0x2ad8fa[_0x1d17('0x10')]=_0x28251a;if(_0xec81ef['query'][_0x1d17('0x39')]){_0x4aa6c8[_0x1d17('0x3a')]=[{'all':!![]}];}return db[_0x1d17('0x27')][_0x1d17('0x3b')](_0x4aa6c8);})[_0x1d17('0x22')](function(_0x2fe0ab){_0x2ad8fa[_0x1d17('0x3c')]=_0x2fe0ab;return _0x2ad8fa;})[_0x1d17('0x22')](respondWithFilteredResult(_0x1a9cdc,_0x4aa6c8))[_0x1d17('0x3d')](handleError(_0x1a9cdc,null));};exports['show']=function(_0x2b6f7f,_0x422d5f){var _0x3951e4={'raw':![],'where':{'id':_0x2b6f7f['params']['id']}},_0x28a64b={};_0x28a64b[_0x1d17('0x2d')]=_[_0x1d17('0x2a')](db[_0x1d17('0x27')][_0x1d17('0x28')]);_0x28a64b['query']=_[_0x1d17('0x2a')](_0x2b6f7f['query']);_0x28a64b['filters']=_['intersection'](_0x28a64b[_0x1d17('0x2d')],_0x28a64b[_0x1d17('0x2b')]);_0x3951e4['attributes']=_['intersection'](_0x28a64b[_0x1d17('0x2d')],qs[_0x1d17('0x2e')](_0x2b6f7f[_0x1d17('0x2b')][_0x1d17('0x2e')]));_0x3951e4['attributes']=_0x3951e4[_0x1d17('0x2f')][_0x1d17('0x30')]?_0x3951e4['attributes']:_0x28a64b[_0x1d17('0x2d')];if(_0x2b6f7f[_0x1d17('0x2b')][_0x1d17('0x39')]){_0x3951e4[_0x1d17('0x3a')]=[{'all':!![]}];}_0x3951e4=_[_0x1d17('0x36')]({},_0x3951e4,_0x2b6f7f[_0x1d17('0x38')]);return db[_0x1d17('0x27')][_0x1d17('0x1f')](_0x3951e4)[_0x1d17('0x22')](handleEntityNotFound(_0x422d5f,null))[_0x1d17('0x22')](respondWithResult(_0x422d5f,null))[_0x1d17('0x3d')](handleError(_0x422d5f,null));};exports[_0x1d17('0x14')]=function(_0x358639,_0xfc6222){return db[_0x1d17('0x27')][_0x1d17('0x1f')]({'where':{'id':_0x358639[_0x1d17('0x3e')]['id']}})['then'](handleEntityNotFound(_0xfc6222,null))[_0x1d17('0x22')](removeEntity(_0xfc6222,null))['catch'](handleError(_0xfc6222,null));};exports['create']=function(_0x2c1a16,_0x423661){if(_0x2c1a16[_0x1d17('0x3f')][_0x1d17('0x1e')]==='outbound'&&!_['startsWith'](_0x2c1a16[_0x1d17('0x3f')][_0x1d17('0x40')],'_')){_0x2c1a16['body']['exten']='_'[_0x1d17('0x41')](_0x2c1a16['body']['exten']);}return db['VoiceExtension'][_0x1d17('0x42')](_0x2c1a16['body'],{'raw':![]})[_0x1d17('0x22')](function(_0x1c4f36){var _0x4e981c=_0x2c1a16[_0x1d17('0x43')][_0x1d17('0x44')]({'plain':!![]});if(!_0x4e981c)throw new Error(_0x1d17('0x45'));if(_0x4e981c[_0x1d17('0x46')]==='user'){var _0x864731=_0x1c4f36[_0x1d17('0x44')]({'plain':!![]});var _0x42d079=[{'name':_0x1d17('0x15'),'value':_0x1d17('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1d17('0x18'),'value':_0x1d17('0x19')}];var _0xf04e94=_[_0x1d17('0x1f')](_0x42d079,[_0x1d17('0x1c'),_0x864731[_0x1d17('0x1e')]])['name'];return db['UserProfileSection'][_0x1d17('0x1f')]({'where':{'name':_0xf04e94,'userProfileId':_0x4e981c[_0x1d17('0x47')]},'raw':!![]})[_0x1d17('0x22')](function(_0x30117e){if(_0x30117e&&_0x30117e['autoAssociation']===0x0){return db[_0x1d17('0x21')][_0x1d17('0x42')]({'name':_0x864731[_0x1d17('0x20')],'resourceId':_0x864731['id'],'type':_0x30117e[_0x1d17('0x20')],'sectionId':_0x30117e['id']},{})[_0x1d17('0x22')](function(){return _0x1c4f36;});}else{return _0x1c4f36;}})[_0x1d17('0x3d')](function(_0x76423a){logger[_0x1d17('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x76423a);throw _0x76423a;});}return _0x1c4f36;})[_0x1d17('0x22')](respondWithResult(_0x423661,0xc9))[_0x1d17('0x3d')](handleError(_0x423661,null));};exports['update']=function(_0x5df21d,_0xb66cb7){if(_0x5df21d[_0x1d17('0x3f')]['id']){delete _0x5df21d[_0x1d17('0x3f')]['id'];}return db['VoiceExtension'][_0x1d17('0x1f')]({'where':{'id':_0x5df21d[_0x1d17('0x3e')]['id']}})[_0x1d17('0x22')](handleEntityNotFound(_0xb66cb7,null))[_0x1d17('0x22')](function(_0x5ef75e){if(_0x5ef75e){return db['VoiceExtension'][_0x1d17('0x48')](_[_0x1d17('0x35')](_0x5df21d[_0x1d17('0x3f')],[_0x1d17('0x40'),_0x1d17('0x49'),_0x1d17('0x4a'),_0x1d17('0x4b'),_0x1d17('0x4c'),'mandatoryDisposition','alias']),{'where':{'context':_0x5ef75e[_0x1d17('0x49')],'exten':_0x5ef75e[_0x1d17('0x40')]},'individualHooks':!![]})[_0x1d17('0x22')](function(_0x377dcb){return _0x377dcb;});}return null;})[_0x1d17('0x22')](respondWithStatusCode(_0xb66cb7,null))[_0x1d17('0x3d')](handleError(_0xb66cb7,null));};exports['addApplications']=function(_0x4ac2a2,_0x15f855){var _0x44c3c8=_0x4ac2a2[_0x1d17('0x3e')]['id'];var _0x8f455b=_0x4ac2a2[_0x1d17('0x3f')];var _0x558d54=0xc8;var _0x697104=null;return db[_0x1d17('0x4d')][_0x1d17('0x4e')]({'isolationLevel':db[_0x1d17('0x4d')]['Transaction'][_0x1d17('0x4f')][_0x1d17('0x50')]},function(_0x25e233){return db[_0x1d17('0x27')]['findOne']({'where':{'id':_0x44c3c8},'transaction':_0x25e233})[_0x1d17('0x22')](function(_0x3fa358){if(_0x3fa358){return db[_0x1d17('0x27')][_0x1d17('0x14')]({'where':{'VoiceExtensionId':_0x44c3c8},'transaction':_0x25e233})[_0x1d17('0x22')](function(){var _0x281c22=_[_0x1d17('0x1b')](_0x8f455b,function(_0x1628fe){_0x1628fe['VoiceExtensionId']=_0x44c3c8;_0x1628fe[_0x1d17('0x51')]=!![];return _0x1628fe;});return _0x3fa358[_0x1d17('0x52')](_0x281c22);})[_0x1d17('0x22')](function(_0xbbafa5){return db['VoiceExtension'][_0x1d17('0x53')](_0xbbafa5,{'transaction':_0x25e233});});}else{_0x558d54=0x194;_0x697104=[];}});})[_0x1d17('0x22')](function(){if(_0x558d54!==0x194){return db[_0x1d17('0x27')][_0x1d17('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x44c3c8},'order':_0x1d17('0x55')})[_0x1d17('0x22')](function(_0x5eaa40){_0x697104=_0x5eaa40;});}})['catch'](function(_0xc5169d){_0x558d54=0x1f4;logger[_0x1d17('0x23')](_0xc5169d['stack']);if(_0xc5169d['name']){delete _0xc5169d[_0x1d17('0x20')];}_0x697104=_0xc5169d;})[_0x1d17('0x56')](function(){if(_0x697104===null){_0x15f855[_0x1d17('0xb')](_0x558d54);}else{if(_0x558d54===0x1f4){_0x15f855['status'](_0x558d54)[_0x1d17('0x25')](_0x697104);}else{_0x15f855[_0x1d17('0xc')](_0x558d54)[_0x1d17('0xd')](_0x697104);}}});}; \ No newline at end of file +var _0xc314=['catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','transaction','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','stack','finally','json','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./voiceExtension.socket','sendStatus','status','offset','limit','count','set','Content-Range','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','name','then','end','error','index','VoiceExtension','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','params','length','options'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xc314,0x184));var _0x4c31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc314[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c31('0x0'));var Redis=require(_0x4c31('0x1'));var qs=require(_0x4c31('0x2'));var logger=require(_0x4c31('0x3'))('api');var config=require(_0x4c31('0x4'));var db=require(_0x4c31('0x5'))['db'];config['redis']=_[_0x4c31('0x6')](config[_0x4c31('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c31('0x8'))(new Redis(config['redis']));require(_0x4c31('0x9'))['register'](socket);function respondWithStatusCode(_0x286990,_0x249330){_0x249330=_0x249330||0xcc;return function(_0x12ddef){if(_0x12ddef){return _0x286990[_0x4c31('0xa')](_0x249330);}return _0x286990[_0x4c31('0xb')](_0x249330)['end']();};}function respondWithResult(_0x142fb2,_0x40d914){_0x40d914=_0x40d914||0xc8;return function(_0x240531){if(_0x240531){return _0x142fb2[_0x4c31('0xb')](_0x40d914)['json'](_0x240531);}};}function respondWithFilteredResult(_0x4d0c8f,_0x5205c9){return function(_0x595d82){if(_0x595d82){var _0x7b12ea=typeof _0x5205c9[_0x4c31('0xc')]==='undefined'&&typeof _0x5205c9[_0x4c31('0xd')]==='undefined';var _0x4c7f94=_0x595d82[_0x4c31('0xe')];var _0x58ced4=_0x7b12ea?0x0:_0x5205c9[_0x4c31('0xc')];var _0x36796c=_0x7b12ea?_0x595d82[_0x4c31('0xe')]:_0x5205c9[_0x4c31('0xc')]+_0x5205c9[_0x4c31('0xd')];var _0xe825a7;if(_0x36796c>=_0x4c7f94){_0x36796c=_0x4c7f94;_0xe825a7=0xc8;}else{_0xe825a7=0xce;}_0x4d0c8f[_0x4c31('0xb')](_0xe825a7);return _0x4d0c8f[_0x4c31('0xf')](_0x4c31('0x10'),_0x58ced4+'-'+_0x36796c+'/'+_0x4c7f94)['json'](_0x595d82);}return null;};}function removeEntity(_0xc7ea18){return function(_0x16005e){if(_0x16005e){return _0x16005e[_0x4c31('0x11')]()['then'](function(){var _0x1a0a49=_0x16005e[_0x4c31('0x12')]({'plain':!![]});var _0x3bab95=[{'name':'InboundRoutes','value':_0x4c31('0x13'),'ignore':![]},{'name':_0x4c31('0x14'),'value':_0x4c31('0x15'),'ignore':![]},{'name':_0x4c31('0x16'),'value':_0x4c31('0x17'),'ignore':![]}];var _0x53dc9e=_(_0x3bab95)[_0x4c31('0x18')](_0x4c31('0x19'))[_0x4c31('0x1a')](_0x4c31('0x1b'))[_0x4c31('0x1b')]();if(_['includes'](_0x53dc9e,_0x1a0a49['type'])){return;}var _0x5aa104=_[_0x4c31('0x1c')](_0x3bab95,[_0x4c31('0x1b'),_0x1a0a49['type']])[_0x4c31('0x1d')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5aa104,'resourceId':_0x1a0a49['id']}})[_0x4c31('0x1e')](function(){return _0x16005e;});})['then'](function(){_0xc7ea18[_0x4c31('0xb')](0xcc)[_0x4c31('0x1f')]();});}};}function handleEntityNotFound(_0x5b846b){return function(_0x181f7e){if(!_0x181f7e){_0x5b846b[_0x4c31('0xa')](0x194);}return _0x181f7e;};}function handleError(_0x37c45e,_0x14d05b){_0x14d05b=_0x14d05b||0x1f4;return function(_0xa670a5){logger[_0x4c31('0x20')](_0xa670a5['stack']);if(_0xa670a5[_0x4c31('0x1d')]){delete _0xa670a5['name'];}_0x37c45e[_0x4c31('0xb')](_0x14d05b)['send'](_0xa670a5);};}exports[_0x4c31('0x21')]=function(_0xdf7996,_0x550872){var _0x38859c={},_0x4a369e={},_0x25b7d0={'count':0x0,'rows':[]};var _0x377a8d=_['map'](db[_0x4c31('0x22')]['rawAttributes'],function(_0x1907b7){return{'name':_0x1907b7[_0x4c31('0x23')],'type':_0x1907b7[_0x4c31('0x24')]['key']};});_0x4a369e['model']=_[_0x4c31('0x1a')](_0x377a8d,'name');_0x4a369e[_0x4c31('0x25')]=_[_0x4c31('0x26')](_0xdf7996[_0x4c31('0x25')]);_0x4a369e['filters']=_[_0x4c31('0x27')](_0x4a369e[_0x4c31('0x28')],_0x4a369e[_0x4c31('0x25')]);_0x38859c[_0x4c31('0x29')]=_['intersection'](_0x4a369e[_0x4c31('0x28')],qs[_0x4c31('0x2a')](_0xdf7996['query'][_0x4c31('0x2a')]));_0x38859c[_0x4c31('0x29')]=_0x38859c[_0x4c31('0x29')]['length']?_0x38859c[_0x4c31('0x29')]:_0x4a369e[_0x4c31('0x28')];if(!_0xdf7996[_0x4c31('0x25')][_0x4c31('0x2b')](_0x4c31('0x2c'))){_0x38859c[_0x4c31('0xd')]=qs[_0x4c31('0xd')](_0xdf7996[_0x4c31('0x25')]['limit']);_0x38859c['offset']=qs[_0x4c31('0xc')](_0xdf7996[_0x4c31('0x25')][_0x4c31('0xc')]);}_0x38859c[_0x4c31('0x2d')]=qs[_0x4c31('0x2e')](_0xdf7996[_0x4c31('0x25')][_0x4c31('0x2e')]);_0x38859c[_0x4c31('0x2f')]=qs[_0x4c31('0x30')](_[_0x4c31('0x31')](_0xdf7996[_0x4c31('0x25')],_0x4a369e[_0x4c31('0x30')]),_0x377a8d);if(_0xdf7996[_0x4c31('0x25')]['filter']){_0x38859c[_0x4c31('0x2f')]=_[_0x4c31('0x32')](_0x38859c[_0x4c31('0x2f')],{'$or':_[_0x4c31('0x1a')](_0x377a8d,function(_0x4c6f8a){if(_0x4c6f8a['type']!==_0x4c31('0x33')){var _0xefbb03={};_0xefbb03[_0x4c6f8a[_0x4c31('0x1d')]]={'$like':'%'+_0xdf7996[_0x4c31('0x25')][_0x4c31('0x18')]+'%'};return _0xefbb03;}})});}_0x38859c=_[_0x4c31('0x32')]({},_0x38859c,_0xdf7996['options']);var _0x325298={'where':_0x38859c[_0x4c31('0x2f')]};return db[_0x4c31('0x22')][_0x4c31('0xe')](_0x325298)[_0x4c31('0x1e')](function(_0x42d0d6){_0x25b7d0['count']=_0x42d0d6;if(_0xdf7996[_0x4c31('0x25')][_0x4c31('0x34')]){_0x38859c[_0x4c31('0x35')]=[{'all':!![]}];}return db[_0x4c31('0x22')]['findAll'](_0x38859c);})[_0x4c31('0x1e')](function(_0x157586){_0x25b7d0['rows']=_0x157586;return _0x25b7d0;})['then'](respondWithFilteredResult(_0x550872,_0x38859c))['catch'](handleError(_0x550872,null));};exports['show']=function(_0x511890,_0x1de5e7){var _0x4995b9={'raw':![],'where':{'id':_0x511890[_0x4c31('0x36')]['id']}},_0x526d94={};_0x526d94[_0x4c31('0x28')]=_[_0x4c31('0x26')](db[_0x4c31('0x22')]['rawAttributes']);_0x526d94[_0x4c31('0x25')]=_[_0x4c31('0x26')](_0x511890[_0x4c31('0x25')]);_0x526d94[_0x4c31('0x30')]=_['intersection'](_0x526d94[_0x4c31('0x28')],_0x526d94[_0x4c31('0x25')]);_0x4995b9[_0x4c31('0x29')]=_[_0x4c31('0x27')](_0x526d94[_0x4c31('0x28')],qs[_0x4c31('0x2a')](_0x511890['query'][_0x4c31('0x2a')]));_0x4995b9[_0x4c31('0x29')]=_0x4995b9[_0x4c31('0x29')][_0x4c31('0x37')]?_0x4995b9[_0x4c31('0x29')]:_0x526d94[_0x4c31('0x28')];if(_0x511890[_0x4c31('0x25')][_0x4c31('0x34')]){_0x4995b9['include']=[{'all':!![]}];}_0x4995b9=_[_0x4c31('0x32')]({},_0x4995b9,_0x511890[_0x4c31('0x38')]);return db['VoiceExtension'][_0x4c31('0x1c')](_0x4995b9)['then'](handleEntityNotFound(_0x1de5e7,null))[_0x4c31('0x1e')](respondWithResult(_0x1de5e7,null))[_0x4c31('0x39')](handleError(_0x1de5e7,null));};exports[_0x4c31('0x11')]=function(_0xeb33a5,_0x5b4944){return db[_0x4c31('0x22')]['find']({'where':{'id':_0xeb33a5[_0x4c31('0x36')]['id']}})[_0x4c31('0x1e')](handleEntityNotFound(_0x5b4944,null))['then'](removeEntity(_0x5b4944,null))[_0x4c31('0x39')](handleError(_0x5b4944,null));};exports[_0x4c31('0x3a')]=function(_0x5dc0dc,_0x5d2140){if(_0x5dc0dc[_0x4c31('0x3b')]['type']===_0x4c31('0x15')&&!_[_0x4c31('0x3c')](_0x5dc0dc[_0x4c31('0x3b')][_0x4c31('0x3d')],'_')){_0x5dc0dc[_0x4c31('0x3b')][_0x4c31('0x3d')]='_'[_0x4c31('0x3e')](_0x5dc0dc[_0x4c31('0x3b')][_0x4c31('0x3d')]);}return db[_0x4c31('0x22')][_0x4c31('0x3a')](_0x5dc0dc[_0x4c31('0x3b')],{'raw':![]})[_0x4c31('0x1e')](function(_0x1ae1e9){var _0x16990d=_0x5dc0dc[_0x4c31('0x3f')][_0x4c31('0x12')]({'plain':!![]});if(!_0x16990d)throw new Error(_0x4c31('0x40'));if(_0x16990d[_0x4c31('0x41')]===_0x4c31('0x3f')){var _0x420516=_0x1ae1e9['get']({'plain':!![]});var _0x1f797c=[{'name':_0x4c31('0x42'),'value':'inbound'},{'name':_0x4c31('0x14'),'value':'outbound'},{'name':_0x4c31('0x16'),'value':_0x4c31('0x17')}];var _0xbd91d=_[_0x4c31('0x1c')](_0x1f797c,[_0x4c31('0x1b'),_0x420516[_0x4c31('0x24')]])['name'];return db[_0x4c31('0x43')][_0x4c31('0x1c')]({'where':{'name':_0xbd91d,'userProfileId':_0x16990d[_0x4c31('0x44')]},'raw':!![]})[_0x4c31('0x1e')](function(_0x3d6717){if(_0x3d6717&&_0x3d6717[_0x4c31('0x45')]===0x0){return db[_0x4c31('0x46')]['create']({'name':_0x420516[_0x4c31('0x1d')],'resourceId':_0x420516['id'],'type':_0x3d6717[_0x4c31('0x1d')],'sectionId':_0x3d6717['id']},{})['then'](function(){return _0x1ae1e9;});}else{return _0x1ae1e9;}})[_0x4c31('0x39')](function(_0x58d7b2){logger[_0x4c31('0x20')](_0x4c31('0x47'),_0x58d7b2);throw _0x58d7b2;});}return _0x1ae1e9;})[_0x4c31('0x1e')](respondWithResult(_0x5d2140,0xc9))[_0x4c31('0x39')](handleError(_0x5d2140,null));};exports[_0x4c31('0x48')]=function(_0x53ad13,_0x8d86bb){if(_0x53ad13[_0x4c31('0x3b')]['id']){delete _0x53ad13[_0x4c31('0x3b')]['id'];}return db[_0x4c31('0x22')][_0x4c31('0x1c')]({'where':{'id':_0x53ad13[_0x4c31('0x36')]['id']}})[_0x4c31('0x1e')](handleEntityNotFound(_0x8d86bb,null))[_0x4c31('0x1e')](function(_0x16971e){if(_0x16971e){return db[_0x4c31('0x22')][_0x4c31('0x48')](_[_0x4c31('0x31')](_0x53ad13[_0x4c31('0x3b')],['exten',_0x4c31('0x49'),_0x4c31('0x4a'),_0x4c31('0x4b'),_0x4c31('0x4c'),_0x4c31('0x4d'),'alias']),{'where':{'context':_0x16971e[_0x4c31('0x49')],'exten':_0x16971e[_0x4c31('0x3d')]},'individualHooks':!![]})['then'](function(_0x1df725){return _0x1df725;});}return null;})[_0x4c31('0x1e')](respondWithStatusCode(_0x8d86bb,null))['catch'](handleError(_0x8d86bb,null));};exports['addApplications']=function(_0x5d5155,_0x3bfac2){var _0x3f9245=_0x5d5155[_0x4c31('0x36')]['id'];var _0x19db67=_0x5d5155['body'];var _0x5a763b=0xc8;var _0x275238=null;return db['sequelize'][_0x4c31('0x4e')]({'isolationLevel':db[_0x4c31('0x4f')][_0x4c31('0x50')]['ISOLATION_LEVELS'][_0x4c31('0x51')]},function(_0x20ecc0){return db[_0x4c31('0x22')][_0x4c31('0x52')]({'where':{'id':_0x3f9245},'transaction':_0x20ecc0})[_0x4c31('0x1e')](function(_0x9b2231){if(_0x9b2231){return db[_0x4c31('0x22')][_0x4c31('0x11')]({'where':{'VoiceExtensionId':_0x3f9245},'transaction':_0x20ecc0})[_0x4c31('0x1e')](function(){var _0x590f77=_[_0x4c31('0x1a')](_0x19db67,function(_0x1b0a55){_0x1b0a55[_0x4c31('0x53')]=_0x3f9245;_0x1b0a55['isApp']=!![];return _0x1b0a55;});return _0x9b2231['createRouting'](_0x590f77);})['then'](function(_0xe9d658){return db['VoiceExtension'][_0x4c31('0x54')](_0xe9d658,{'transaction':_0x20ecc0});});}else{_0x5a763b=0x194;_0x275238=[];}});})[_0x4c31('0x1e')](function(){if(_0x5a763b!==0x194){return db[_0x4c31('0x22')][_0x4c31('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f9245},'order':'cast(priority\x20as\x20unsigned)'})[_0x4c31('0x1e')](function(_0x5d0a6a){_0x275238=_0x5d0a6a;});}})[_0x4c31('0x39')](function(_0x11e23e){_0x5a763b=0x1f4;logger[_0x4c31('0x20')](_0x11e23e[_0x4c31('0x56')]);if(_0x11e23e[_0x4c31('0x1d')]){delete _0x11e23e['name'];}_0x275238=_0x11e23e;})[_0x4c31('0x57')](function(){if(_0x275238===null){_0x3bfac2['sendStatus'](_0x5a763b);}else{if(_0x5a763b===0x1f4){_0x3bfac2['status'](_0x5a763b)['send'](_0x275238);}else{_0x3bfac2[_0x4c31('0xb')](_0x5a763b)[_0x4c31('0x58')](_0x275238);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 837d84b..00b6ee6 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 _0x370d=['events','../../mysqldb','VoiceExtension','update','remove','hasOwnProperty'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x370d,0x144));var _0xd370=function(_0x10a21f,_0x414459){_0x10a21f=_0x10a21f-0x0;var _0x489175=_0x370d[_0x10a21f];return _0x489175;};'use strict';var EventEmitter=require(_0xd370('0x0'));var VoiceExtension=require(_0xd370('0x1'))['db'][_0xd370('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd370('0x3'),'afterDestroy':_0xd370('0x4')};function emitEvent(_0x145598){return function(_0xdb3e0d,_0x5dbad3,_0x808761){VoiceExtensionEvents['emit'](_0x145598+':'+_0xdb3e0d['id'],_0xdb3e0d);VoiceExtensionEvents['emit'](_0x145598,_0xdb3e0d);_0x808761(null);};}for(var e in events){if(events[_0xd370('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xd570=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd570,0x1ab));var _0x0d57=function(_0x61ae44,_0x4410a2){_0x61ae44=_0x61ae44-0x0;var _0x5831fe=_0xd570[_0x61ae44];return _0x5831fe;};'use strict';var EventEmitter=require(_0x0d57('0x0'));var VoiceExtension=require(_0x0d57('0x1'))['db'][_0x0d57('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0d57('0x3')](0x0);var events={'afterCreate':_0x0d57('0x4'),'afterUpdate':_0x0d57('0x5'),'afterDestroy':_0x0d57('0x6')};function emitEvent(_0x2c866d){return function(_0x58eab9,_0x37a75c,_0xdb3f8f){VoiceExtensionEvents[_0x0d57('0x7')](_0x2c866d+':'+_0x58eab9['id'],_0x58eab9);VoiceExtensionEvents[_0x0d57('0x7')](_0x2c866d,_0x58eab9);_0xdb3f8f(null);};}for(var e in events){if(events[_0x0d57('0x8')](e)){var event=events[e];VoiceExtension[_0x0d57('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 99bc37d..b69d6df 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 _0x2c22=['length','name','trunk','phone','param','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','context','exten','alias','Set','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','split'];(function(_0x43800e,_0x3c2920){var _0x4789e1=function(_0x1e3bd1){while(--_0x1e3bd1){_0x43800e['push'](_0x43800e['shift']());}};_0x4789e1(++_0x3c2920);}(_0x2c22,0x1cc));var _0x22c2=function(_0x3d4ed3,_0x5e06e){_0x3d4ed3=_0x3d4ed3-0x0;var _0x9e519a=_0x2c22[_0x3d4ed3];return _0x9e519a;};'use strict';var _=require('lodash');var attributes=require(_0x22c2('0x0'));module[_0x22c2('0x1')]=function(_0x4515a4){var _0x335d72=_0x4515a4[_0x22c2('0x2')];function _0xd2f998(_0xdf02f4){var _0x342db9=0x2;var _0x195a47=[{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':'CDR(type)='+_0xdf02f4['type'],'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':_0xdf02f4[_0x22c2('0x6')]?_0x22c2('0x7'):'NoOp','appdata':_0xdf02f4[_0x22c2('0x6')]?_0x22c2('0x8')+_0xdf02f4[_0x22c2('0x6')]:_0x22c2('0x9'),'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']}];if(_0xdf02f4[_0x22c2('0x3')]===_0x22c2('0xa')){_0x195a47[_0x22c2('0xb')]({'type':_0x22c2('0xa'),'app':'Set','appdata':_0x22c2('0xc')+_0xdf02f4['id'],'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4['exten'],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']});}_0x195a47[_0x22c2('0xb')]({'type':_0xdf02f4[_0x22c2('0x3')],'app':_0x22c2('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4['exten'],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':_0x22c2('0xd'),'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':_0x22c2('0xe'),'context':_0xdf02f4['context'],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']});return _0x195a47;}function _0x13c771(_0x1b28b7){var _0x376268=0x2;var _0x30b164=[{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0x10'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x1b28b7[_0x22c2('0x6')]?'Set':_0x22c2('0x11'),'appdata':_0x1b28b7[_0x22c2('0x6')]?_0x22c2('0x8')+_0x1b28b7[_0x22c2('0x6')]:'No\x20alias\x20set','context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x12')+(_0x1b28b7[_0x22c2('0x13')]?_0x22c2('0x14')+_0x1b28b7[_0x22c2('0x13')]+'}':_0x22c2('0x15')),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':'CDR(routeid)='+_0x1b28b7['id'],'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':'outbound','app':_0x22c2('0x16'),'appdata':_0x22c2('0x17')+(_0x376268+0x2)+_0x22c2('0x18')+(_0x376268+0x1)+')','context':_0x1b28b7['context'],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x1b28b7[_0x22c2('0x13')]?_0x22c2('0x19')+_0x1b28b7[_0x22c2('0x13')]+'}':_0x22c2('0x1a'),'context':_0x1b28b7['context'],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x1b'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0xd'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0xe'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':'outbound','app':_0x22c2('0x7'),'appdata':_0x22c2('0x1c')+_0x1b28b7['id'],'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']}];if(_0x1b28b7[_0x22c2('0x1d')]('recordingFormat')&&_0x1b28b7[_0x22c2('0x1e')]!=='none'){_0x30b164[_0x22c2('0xb')]({'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x1f'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x20')+_0x1b28b7['recordingFormat']||_0x22c2('0x21'),'context':_0x1b28b7['context'],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']});}return _0x30b164;}function _0x1997b3(_0xdf9a86,_0x33cc06){var _0x3495ed=[{'name':'trunk','param':0x0},{'name':_0x22c2('0x22'),'param':0x1},{'name':_0x22c2('0x23'),'param':0x2},{'name':_0x22c2('0x24'),'param':0x3}];var _0x51ce76={};var _0x54a41c=_0x33cc06[_0x22c2('0x25')](',');var _0x695217=[];for(var _0x2f6c99=0x0;_0x2f6c99<_0x3495ed[_0x22c2('0x26')];_0x2f6c99++){switch(_0x3495ed[_0x2f6c99][_0x22c2('0x27')]){case _0x22c2('0x28'):_0x51ce76[_0x22c2('0x28')]=_0x54a41c[_0x3495ed[_0x2f6c99]['param']]['split']('/')[0x1];_0x51ce76[_0x22c2('0x29')]=_0x54a41c[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]][_0x22c2('0x25')]('/')[0x2];_0x51ce76[_0x22c2('0x2b')]=_0x51ce76['phone']?_0x51ce76[_0x22c2('0x29')][_0x22c2('0x25')]('$')[0x0]:undefined;_0x51ce76[_0x22c2('0x29')]=_0xdf9a86['cutdigits']?(_0x51ce76[_0x22c2('0x2b')]||'')+_0x22c2('0x14')+_0xdf9a86['cutdigits']+'}':(_0x51ce76[_0x22c2('0x2b')]||'')+_0x22c2('0x15');_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=[_0x22c2('0x2c'),_0x51ce76[_0x22c2('0x28')],_0x51ce76[_0x22c2('0x29')]][_0x22c2('0x2d')]('/');break;case _0x22c2('0x23'):_0x51ce76[_0x22c2('0x23')]=_0x54a41c[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]];if(_0xdf9a86[_0x22c2('0x1e')]!==_0x22c2('0x2e')){if(_0x51ce76['options'][_0x22c2('0x2f')](_0x22c2('0x30'))<0x0){_0x51ce76[_0x22c2('0x23')]+=_0x22c2('0x30');}}else{_0x51ce76['options']=_0x51ce76[_0x22c2('0x23')][_0x22c2('0x31')]('U(xcally-mixmonitor-context)','');}_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=_0x51ce76[_0x22c2('0x23')];break;default:_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=_0x54a41c[_0x3495ed[_0x2f6c99]['param']];}}return _0x695217[_0x22c2('0x2d')](',');}function _0x561b7d(_0x433153,_0xd5e272,_0x56fac0){return new Promise(function(_0x278dd2,_0x58e1f3){var _0x2df9df=[];if(_['isEmpty'](_0xd5e272))return _0x278dd2(_0x2df9df);_0x335d72['Interval'][_0x22c2('0x32')]({'attributes':['id',_0x22c2('0x33'),_0x22c2('0x34')],'raw':!![]})[_0x22c2('0x35')](function(_0x1a5e3){for(var _0x160244=0x0,_0x1462eb=0x0;_0x160244<_0xd5e272[_0x22c2('0x26')];_0x160244++,_0x1462eb=0x0){var _0x32c082=_0xd5e272[_0x160244];var _0x238a76=[];var _0x6ff0e8=[];delete _0x32c082['id'];if(_0x32c082[_0x22c2('0x33')]!=='*,*,*,*'){_0x32c082[_0x22c2('0x36')]=[_0x32c082[_0x22c2('0x33')]];}else{_0x32c082['intervals']=_0x32c082[_0x22c2('0x34')]?_[_0x22c2('0x37')](_[_0x22c2('0x38')](_0x1a5e3,{'IntervalId':_0x32c082[_0x22c2('0x34')]}),_0x22c2('0x33')):[];}_0x32c082[_0x22c2('0x4')]=_0x433153[_0x22c2('0x4')];_0x32c082['exten']=_0x433153[_0x22c2('0x5')];if(_0x32c082[_0x22c2('0x3')])_0x32c082['type']=_0x32c082['type'][_0x22c2('0x39')]();if(_0x433153[_0x22c2('0x3')]==='outbound'){if(_0x32c082[_0x22c2('0x1d')](_0x22c2('0x3a'))&&_0x32c082['tag']&&_0x32c082[_0x22c2('0x3a')]!=='--'){_0x238a76[_0x22c2('0xb')]({'type':_0x32c082['type'][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x3b')+_0x32c082['tag'],'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')]['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':'ExecIf','appdata':_0x22c2('0x3c')+(_0x32c082['callerID']?_0x22c2('0x3d')+_0x32c082[_0x22c2('0x3e')]+')':_0x22c2('0x3f')),'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')]['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}else{if(_0x32c082[_0x22c2('0x1d')](_0x22c2('0x40'))){if([_0x22c2('0x41'),'playback'][_0x22c2('0x42')](_0x32c082[_0x22c2('0x43')][_0x22c2('0x39')]())&&_0x32c082[_0x22c2('0x44')]!==_0x22c2('0x45')){if(_0x32c082['answer']){_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x16'),'appdata':_0x22c2('0x46'),'context':_0x433153['context'],'exten':_0x433153['exten'],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});_0x238a76[_0x22c2('0xb')]({'type':_0x32c082['type'][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}else{_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals']['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x47'),'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}}}}for(var _0x513d64=0x0;_0x513d64<_0x32c082[_0x22c2('0x36')]['length'];_0x513d64++){var _0x1aa175=_0x56fac0+_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')];var _0x202c3a=_0x513d64===_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')]-0x1?_0x56fac0+_0x238a76['length']+_0x6ff0e8[_0x22c2('0x26')]+0x2:_0x56fac0+_0x513d64+0x1;_0x238a76['splice'](_0x513d64,0x0,{'type':_0x433153['type'],'app':'GotoIfTime','appdata':_0x32c082[_0x22c2('0x36')][_0x513d64]+'?'+_0x433153['context']+',${EXTEN},'+_0x1aa175+':'+_0x433153['context']+_0x22c2('0x48')+_0x202c3a,'exten':_0x433153[_0x22c2('0x5')],'context':_0x433153[_0x22c2('0x4')],'priority':_0x56fac0+_0x513d64,'VoiceExtensionId':_0x433153['id']});}if(_0x32c082[_0x22c2('0x44')]===_0x22c2('0x49')){_0x32c082[_0x22c2('0x4a')]=_0x1997b3(_0x433153,_0x32c082['appdata']);}if(_0x32c082[_0x22c2('0x44')]===_0x22c2('0x4b')){_0x238a76['push']({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}_0x32c082[_0x22c2('0x4c')]=_0x238a76[_0x22c2('0x26')]?_[_0x22c2('0x4d')](_0x238a76)['priority']+0x1:_0x56fac0;_0x2df9df=_[_0x22c2('0x4e')](_0x2df9df,_0x238a76,[_0x32c082],_0x6ff0e8);_0x56fac0=_[_0x22c2('0x4d')](_0x2df9df)['priority']+0x1;}return _0x278dd2(_0x2df9df);})[_0x22c2('0x4f')](function(_0x25610e){_0x58e1f3(_0x25610e);});});}return _0x4515a4['define']('VoiceExtension',attributes,{'tableName':_0x22c2('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x543eb3){var _0x54e1e0=this[_0x22c2('0x51')]({'plain':!![]});var _0x58761a=_0x54e1e0['type']===_0x22c2('0xf')?_0x13c771(_0x54e1e0):_0xd2f998(_0x54e1e0);return _0x561b7d(_0x54e1e0,_0x543eb3,_[_0x22c2('0x4d')](_0x58761a)[_0x22c2('0x4c')]+0x1)['then'](function(_0x1bf293){var _0x17924d=_[_0x22c2('0x4e')](_0x58761a,_0x1bf293);_0x17924d[_0x22c2('0xb')]({'type':_0x54e1e0['type'],'app':_0x22c2('0x52'),'exten':_0x54e1e0[_0x22c2('0x5')],'context':_0x54e1e0['context'],'priority':_[_0x22c2('0x4d')](_0x17924d)[_0x22c2('0x4c')]+0x1,'VoiceExtensionId':_0x54e1e0['id']});return _0x17924d;});}}});}; \ No newline at end of file +var _0x155d=['outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','phone','param','prefix','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','then','length','interval','intervals','IntervalId','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(routeAlias)=','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x155d,0x89));var _0xd155=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x155d[_0x35007a];return _0x574f68;};'use strict';var _=require(_0xd155('0x0'));var attributes=require(_0xd155('0x1'));module[_0xd155('0x2')]=function(_0x157d11){var _0x50eeee=_0x157d11[_0xd155('0x3')];function _0x3ec1be(_0x58bdb8){var _0x4cf996=0x2;var _0x4f127d=[{'type':_0x58bdb8['type'],'app':_0xd155('0x4'),'appdata':_0xd155('0x5')+_0x58bdb8[_0xd155('0x6')],'context':_0x58bdb8[_0xd155('0x7')],'exten':_0x58bdb8[_0xd155('0x8')],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']},{'type':_0x58bdb8[_0xd155('0x6')],'app':_0x58bdb8[_0xd155('0x9')]?_0xd155('0x4'):_0xd155('0xa'),'appdata':_0x58bdb8[_0xd155('0x9')]?'CDR(routeAlias)='+_0x58bdb8[_0xd155('0x9')]:'No\x20alias\x20set','context':_0x58bdb8[_0xd155('0x7')],'exten':_0x58bdb8[_0xd155('0x8')],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']}];if(_0x58bdb8[_0xd155('0x6')]===_0xd155('0xb')){_0x4f127d[_0xd155('0xc')]({'type':_0xd155('0xb'),'app':_0xd155('0x4'),'appdata':_0xd155('0xd')+_0x58bdb8['id'],'context':_0x58bdb8[_0xd155('0x7')],'exten':_0x58bdb8[_0xd155('0x8')],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']});}_0x4f127d[_0xd155('0xc')]({'type':_0x58bdb8[_0xd155('0x6')],'app':'Set','appdata':_0xd155('0xe'),'context':_0x58bdb8[_0xd155('0x7')],'exten':_0x58bdb8['exten'],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']},{'type':_0x58bdb8['type'],'app':_0xd155('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x58bdb8['context'],'exten':_0x58bdb8[_0xd155('0x8')],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']},{'type':_0x58bdb8[_0xd155('0x6')],'app':_0xd155('0x4'),'appdata':_0xd155('0xf'),'context':_0x58bdb8[_0xd155('0x7')],'exten':_0x58bdb8[_0xd155('0x8')],'priority':_0x4cf996++,'VoiceExtensionId':_0x58bdb8['id']});return _0x4f127d;}function _0x111445(_0x13a53c){var _0x118dec=0x2;var _0x4a4658=[{'type':_0xd155('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':_0xd155('0x10'),'app':_0x13a53c['alias']?_0xd155('0x4'):_0xd155('0xa'),'appdata':_0x13a53c[_0xd155('0x9')]?_0xd155('0x11')+_0x13a53c[_0xd155('0x9')]:_0xd155('0x12'),'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':_0xd155('0x4'),'appdata':_0xd155('0x13')+(_0x13a53c[_0xd155('0x14')]?_0xd155('0x15')+_0x13a53c[_0xd155('0x14')]+'}':_0xd155('0x16')),'context':_0x13a53c['context'],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':_0xd155('0x4'),'appdata':_0xd155('0xd')+_0x13a53c['id'],'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':'ExecIf','appdata':_0xd155('0x17')+(_0x118dec+0x2)+_0xd155('0x18')+(_0x118dec+0x1)+')','context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':_0xd155('0x4'),'appdata':_0x13a53c[_0xd155('0x14')]?_0xd155('0x19')+_0x13a53c[_0xd155('0x14')]+'}':_0xd155('0x1a'),'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c['exten'],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':_0xd155('0x4'),'appdata':_0xd155('0xe'),'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':'outbound','app':_0xd155('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c['exten'],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':_0xd155('0x10'),'app':_0xd155('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c['exten'],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':_0xd155('0x10'),'app':_0xd155('0x4'),'appdata':_0xd155('0x1b')+_0x13a53c['id'],'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c['exten'],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']}];if(_0x13a53c[_0xd155('0x1c')]('recordingFormat')&&_0x13a53c[_0xd155('0x1d')]!=='none'){_0x4a4658['push']({'type':_0xd155('0x10'),'app':'Set','appdata':_0xd155('0x1e'),'context':_0x13a53c['context'],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']},{'type':_0xd155('0x10'),'app':_0xd155('0x4'),'appdata':_0xd155('0x1f')+_0x13a53c['recordingFormat']||_0xd155('0x20'),'context':_0x13a53c[_0xd155('0x7')],'exten':_0x13a53c[_0xd155('0x8')],'priority':_0x118dec++,'VoiceExtensionId':_0x13a53c['id']});}return _0x4a4658;}function _0x23db64(_0xf7c81b,_0x32c8f1){var _0x239b05=[{'name':_0xd155('0x21'),'param':0x0},{'name':_0xd155('0x22'),'param':0x1},{'name':_0xd155('0x23'),'param':0x2},{'name':_0xd155('0x24'),'param':0x3}];var _0x1ba4cd={};var _0x575020=_0x32c8f1[_0xd155('0x25')](',');var _0xcb6bfc=[];for(var _0x2e3684=0x0;_0x2e3684<_0x239b05['length'];_0x2e3684++){switch(_0x239b05[_0x2e3684][_0xd155('0x26')]){case _0xd155('0x21'):_0x1ba4cd[_0xd155('0x21')]=_0x575020[_0x239b05[_0x2e3684]['param']][_0xd155('0x25')]('/')[0x1];_0x1ba4cd[_0xd155('0x27')]=_0x575020[_0x239b05[_0x2e3684][_0xd155('0x28')]]['split']('/')[0x2];_0x1ba4cd[_0xd155('0x29')]=_0x1ba4cd[_0xd155('0x27')]?_0x1ba4cd[_0xd155('0x27')][_0xd155('0x25')]('$')[0x0]:undefined;_0x1ba4cd[_0xd155('0x27')]=_0xf7c81b[_0xd155('0x14')]?(_0x1ba4cd[_0xd155('0x29')]||'')+'${EXTEN:'+_0xf7c81b[_0xd155('0x14')]+'}':(_0x1ba4cd[_0xd155('0x29')]||'')+_0xd155('0x16');_0xcb6bfc[_0x239b05[_0x2e3684][_0xd155('0x28')]]=['SIP',_0x1ba4cd[_0xd155('0x21')],_0x1ba4cd[_0xd155('0x27')]][_0xd155('0x2a')]('/');break;case'options':_0x1ba4cd['options']=_0x575020[_0x239b05[_0x2e3684][_0xd155('0x28')]];if(_0xf7c81b['recordingFormat']!==_0xd155('0x2b')){if(_0x1ba4cd[_0xd155('0x23')][_0xd155('0x2c')](_0xd155('0x2d'))<0x0){_0x1ba4cd[_0xd155('0x23')]+=_0xd155('0x2d');}}else{_0x1ba4cd[_0xd155('0x23')]=_0x1ba4cd[_0xd155('0x23')][_0xd155('0x2e')](_0xd155('0x2d'),'');}_0xcb6bfc[_0x239b05[_0x2e3684][_0xd155('0x28')]]=_0x1ba4cd['options'];break;default:_0xcb6bfc[_0x239b05[_0x2e3684][_0xd155('0x28')]]=_0x575020[_0x239b05[_0x2e3684][_0xd155('0x28')]];}}return _0xcb6bfc[_0xd155('0x2a')](',');}function _0x179d80(_0x219b57,_0xfc2b15,_0x306511){return new Promise(function(_0x195b92,_0x4076d8){var _0xab6f77=[];if(_[_0xd155('0x2f')](_0xfc2b15))return _0x195b92(_0xab6f77);_0x50eeee['Interval']['findAll']({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xd155('0x30')](function(_0x22a9cb){for(var _0x5d3436=0x0,_0x7f1da=0x0;_0x5d3436<_0xfc2b15[_0xd155('0x31')];_0x5d3436++,_0x7f1da=0x0){var _0x1258b6=_0xfc2b15[_0x5d3436];var _0x4d8061=[];var _0x3d5a10=[];delete _0x1258b6['id'];if(_0x1258b6[_0xd155('0x32')]!=='*,*,*,*'){_0x1258b6[_0xd155('0x33')]=[_0x1258b6[_0xd155('0x32')]];}else{_0x1258b6[_0xd155('0x33')]=_0x1258b6[_0xd155('0x34')]?_[_0xd155('0x35')](_[_0xd155('0x36')](_0x22a9cb,{'IntervalId':_0x1258b6[_0xd155('0x34')]}),_0xd155('0x32')):[];}_0x1258b6[_0xd155('0x7')]=_0x219b57['context'];_0x1258b6[_0xd155('0x8')]=_0x219b57[_0xd155('0x8')];if(_0x1258b6[_0xd155('0x6')])_0x1258b6[_0xd155('0x6')]=_0x1258b6[_0xd155('0x6')]['toLowerCase']();if(_0x219b57[_0xd155('0x6')]===_0xd155('0x10')){if(_0x1258b6[_0xd155('0x1c')](_0xd155('0x37'))&&_0x1258b6[_0xd155('0x37')]&&_0x1258b6[_0xd155('0x37')]!=='--'){_0x4d8061['push']({'type':_0x1258b6[_0xd155('0x6')]['toLowerCase'](),'app':_0xd155('0x4'),'appdata':_0xd155('0x38')+_0x1258b6[_0xd155('0x37')],'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6[_0xd155('0x33')]['length']+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});}_0x4d8061['push']({'type':_0x1258b6[_0xd155('0x6')][_0xd155('0x39')](),'app':'ExecIf','appdata':_0xd155('0x3a')+(_0x1258b6['callerID']?'Set(CALLERID(all)='+_0x1258b6['callerID']+')':_0xd155('0x3b')),'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});}else{if(_0x1258b6[_0xd155('0x1c')](_0xd155('0x3c'))){if([_0xd155('0x3d'),_0xd155('0x3e')]['includes'](_0x1258b6[_0xd155('0x3f')]['toLowerCase']())&&_0x1258b6[_0xd155('0x40')]!==_0xd155('0x41')){if(_0x1258b6[_0xd155('0x3c')]){_0x4d8061[_0xd155('0xc')]({'type':_0x1258b6[_0xd155('0x6')]['toLowerCase'](),'app':_0xd155('0x42'),'appdata':_0xd155('0x43'),'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});_0x4d8061[_0xd155('0xc')]({'type':_0x1258b6['type'][_0xd155('0x39')](),'app':_0xd155('0x4'),'appdata':_0xd155('0x44'),'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});}else{_0x4d8061['push']({'type':_0x1258b6[_0xd155('0x6')][_0xd155('0x39')](),'app':'ExecIf','appdata':_0xd155('0x45'),'context':_0x219b57['context'],'exten':_0x219b57['exten'],'priority':_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});_0x4d8061[_0xd155('0xc')]({'type':_0x1258b6[_0xd155('0x6')][_0xd155('0x39')](),'app':_0xd155('0x4'),'appdata':_0xd155('0x46'),'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});}}}}for(var _0x1a2fc8=0x0;_0x1a2fc8<_0x1258b6['intervals']['length'];_0x1a2fc8++){var _0x12ee24=_0x306511+_0x1258b6[_0xd155('0x33')][_0xd155('0x31')];var _0x21275a=_0x1a2fc8===_0x1258b6[_0xd155('0x33')][_0xd155('0x31')]-0x1?_0x306511+_0x4d8061[_0xd155('0x31')]+_0x3d5a10[_0xd155('0x31')]+0x2:_0x306511+_0x1a2fc8+0x1;_0x4d8061['splice'](_0x1a2fc8,0x0,{'type':_0x219b57[_0xd155('0x6')],'app':_0xd155('0x47'),'appdata':_0x1258b6[_0xd155('0x33')][_0x1a2fc8]+'?'+_0x219b57[_0xd155('0x7')]+_0xd155('0x48')+_0x12ee24+':'+_0x219b57['context']+',${EXTEN},'+_0x21275a,'exten':_0x219b57[_0xd155('0x8')],'context':_0x219b57['context'],'priority':_0x306511+_0x1a2fc8,'VoiceExtensionId':_0x219b57['id']});}if(_0x1258b6['appType']===_0xd155('0x49')){_0x1258b6['appdata']=_0x23db64(_0x219b57,_0x1258b6['appdata']);}if(_0x1258b6[_0xd155('0x40')]===_0xd155('0x4a')){_0x4d8061[_0xd155('0xc')]({'type':_0x1258b6[_0xd155('0x6')][_0xd155('0x39')](),'app':'Set','appdata':_0xd155('0x4b'),'context':_0x219b57[_0xd155('0x7')],'exten':_0x219b57[_0xd155('0x8')],'priority':_0x1258b6['intervals'][_0xd155('0x31')]+_0x306511+_0x7f1da++,'VoiceExtensionId':_0x219b57['id']});}_0x1258b6['priority']=_0x4d8061[_0xd155('0x31')]?_[_0xd155('0x4c')](_0x4d8061)[_0xd155('0x4d')]+0x1:_0x306511;_0xab6f77=_[_0xd155('0x4e')](_0xab6f77,_0x4d8061,[_0x1258b6],_0x3d5a10);_0x306511=_[_0xd155('0x4c')](_0xab6f77)['priority']+0x1;}return _0x195b92(_0xab6f77);})['catch'](function(_0x474214){_0x4076d8(_0x474214);});});}return _0x157d11['define'](_0xd155('0x4f'),attributes,{'tableName':_0xd155('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b7e1a){var _0x208e52=this['get']({'plain':!![]});var _0x19e2e4=_0x208e52['type']===_0xd155('0x10')?_0x111445(_0x208e52):_0x3ec1be(_0x208e52);return _0x179d80(_0x208e52,_0x5b7e1a,_['last'](_0x19e2e4)[_0xd155('0x4d')]+0x1)[_0xd155('0x30')](function(_0x9fcf0e){var _0x3521d6=_['concat'](_0x19e2e4,_0x9fcf0e);_0x3521d6[_0xd155('0xc')]({'type':_0x208e52[_0xd155('0x6')],'app':_0xd155('0x51'),'exten':_0x208e52[_0xd155('0x8')],'context':_0x208e52[_0xd155('0x7')],'priority':_[_0xd155('0x4c')](_0x3521d6)[_0xd155('0x4d')]+0x1,'VoiceExtensionId':_0x208e52['id']});return _0x3521d6;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 0e14ac0..a794a5c 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 _0xf8af=['VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','model','attributes','map','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x144d9e,_0x513680){var _0x242e7f=function(_0x58795b){while(--_0x58795b){_0x144d9e['push'](_0x144d9e['shift']());}};_0x242e7f(++_0x513680);}(_0xf8af,0x8b));var _0xff8a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf8af[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xff8a('0x0'));var util=require('util');var moment=require(_0xff8a('0x1'));var BPromise=require(_0xff8a('0x2'));var rs=require(_0xff8a('0x3'));var fs=require('fs');var Redis=require(_0xff8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff8a('0x5'));var logger=require(_0xff8a('0x6'))(_0xff8a('0x7'));var config=require(_0xff8a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xff8a('0x9')]({'port':0x232a});config['redis']=_[_0xff8a('0xa')](config[_0xff8a('0xb')],{'host':_0xff8a('0xc'),'port':0x18eb});var socket=require(_0xff8a('0xd'))(new Redis(config[_0xff8a('0xb')]));require(_0xff8a('0xe'))[_0xff8a('0xf')](socket);function respondWithRpcPromise(_0x7442d6,_0x3bb1ba,_0xb8cb56){return new BPromise(function(_0x2c2e5d,_0x5a31cb){return client[_0xff8a('0x10')](_0x7442d6,_0xb8cb56)[_0xff8a('0x11')](function(_0x3f12b5){logger['info'](_0xff8a('0x12'),_0x3bb1ba,_0xff8a('0x13'));logger[_0xff8a('0x14')](_0xff8a('0x15'),_0x3bb1ba,_0xff8a('0x13'),JSON['stringify'](_0x3f12b5));if(_0x3f12b5[_0xff8a('0x16')]){if(_0x3f12b5[_0xff8a('0x16')][_0xff8a('0x17')]===0x1f4){logger[_0xff8a('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x3bb1ba,_0x3f12b5['error']['message']);return _0x5a31cb(_0x3f12b5['error'][_0xff8a('0x18')]);}logger['error'](_0xff8a('0x12'),_0x3bb1ba,_0x3f12b5[_0xff8a('0x16')]['message']);return _0x2c2e5d(_0x3f12b5[_0xff8a('0x16')]['message']);}else{logger['info'](_0xff8a('0x12'),_0x3bb1ba,_0xff8a('0x13'));_0x2c2e5d(_0x3f12b5[_0xff8a('0x19')]['message']);}})[_0xff8a('0x1a')](function(_0x5c4349){logger[_0xff8a('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x3bb1ba,_0x5c4349);_0x5a31cb(_0x5c4349);});});}exports[_0xff8a('0x1b')]=function(_0x1b4272){var _0x794015=this;return new Promise(function(_0xdb1027,_0x145d95){return db[_0xff8a('0x1c')][_0xff8a('0x1d')]({'raw':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x20')]||null:null,'attributes':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')]['attributes']||null:null,'limit':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x21')]||null:null,'include':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272['options'][_0xff8a('0x22')]?_['map'](_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x22')],function(_0x2c67c2){return{'model':db[_0x2c67c2[_0xff8a('0x23')]],'as':_0x2c67c2['as'],'attributes':_0x2c67c2[_0xff8a('0x24')],'include':_0x2c67c2['include']?_[_0xff8a('0x25')](_0x2c67c2[_0xff8a('0x22')],function(_0x3063b1){return{'model':db[_0x3063b1['model']],'as':_0x3063b1['as'],'attributes':_0x3063b1[_0xff8a('0x24')],'include':_0x3063b1[_0xff8a('0x22')]?_[_0xff8a('0x25')](_0x3063b1[_0xff8a('0x22')],function(_0x38188f){return{'model':db[_0x38188f[_0xff8a('0x23')]],'as':_0x38188f['as'],'attributes':_0x38188f[_0xff8a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca17e){logger[_0xff8a('0x26')](_0xff8a('0x1b'),_0x1b4272);logger[_0xff8a('0x14')](_0xff8a('0x1b'),_0x1b4272,JSON[_0xff8a('0x27')](_0x4ca17e));_0xdb1027(_0x4ca17e);})[_0xff8a('0x1a')](function(_0x50cb0f){logger[_0xff8a('0x16')](_0xff8a('0x1b'),_0x50cb0f['message'],_0x1b4272);_0x145d95(_0x794015[_0xff8a('0x16')](0x1f4,_0x50cb0f[_0xff8a('0x18')]));});});}; \ No newline at end of file +var _0xdedd=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','model','stringify'];(function(_0x3420f5,_0x42e6dc){var _0x3abba7=function(_0x2f9a34){while(--_0x2f9a34){_0x3420f5['push'](_0x3420f5['shift']());}};_0x3abba7(++_0x42e6dc);}(_0xdedd,0x197));var _0xdded=function(_0x1acf7f,_0x4d5169){_0x1acf7f=_0x1acf7f-0x0;var _0x462baf=_0xdedd[_0x1acf7f];return _0x462baf;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var moment=require(_0xdded('0x2'));var BPromise=require(_0xdded('0x3'));var rs=require(_0xdded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdded('0x5'))['db'];var utils=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));var config=require(_0xdded('0x9'));var jayson=require(_0xdded('0xa'));var client=jayson[_0xdded('0xb')][_0xdded('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdded('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdded('0xe'))[_0xdded('0xf')](socket);function respondWithRpcPromise(_0x30db97,_0xc7fb6a,_0x4e53bb){return new BPromise(function(_0x91b36d,_0x4f3d66){return client[_0xdded('0x10')](_0x30db97,_0x4e53bb)[_0xdded('0x11')](function(_0x363291){logger[_0xdded('0x12')](_0xdded('0x13'),_0xc7fb6a,_0xdded('0x14'));logger[_0xdded('0x15')](_0xdded('0x16'),_0xc7fb6a,_0xdded('0x14'),JSON['stringify'](_0x363291));if(_0x363291[_0xdded('0x17')]){if(_0x363291[_0xdded('0x17')]['code']===0x1f4){logger[_0xdded('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xc7fb6a,_0x363291[_0xdded('0x17')]['message']);return _0x4f3d66(_0x363291[_0xdded('0x17')][_0xdded('0x18')]);}logger[_0xdded('0x17')]('VoiceExtension,\x20%s,\x20%s',_0xc7fb6a,_0x363291[_0xdded('0x17')][_0xdded('0x18')]);return _0x91b36d(_0x363291[_0xdded('0x17')][_0xdded('0x18')]);}else{logger[_0xdded('0x12')](_0xdded('0x13'),_0xc7fb6a,_0xdded('0x14'));_0x91b36d(_0x363291[_0xdded('0x19')]['message']);}})[_0xdded('0x1a')](function(_0x1ff810){logger[_0xdded('0x17')](_0xdded('0x13'),_0xc7fb6a,_0x1ff810);_0x4f3d66(_0x1ff810);});});}exports[_0xdded('0x1b')]=function(_0x29eb80){var _0x43f005=this;return new Promise(function(_0x457ee4,_0x415b38){return db[_0xdded('0x1c')][_0xdded('0x1d')]({'raw':_0x29eb80[_0xdded('0x1e')]?_0x29eb80[_0xdded('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x29eb80[_0xdded('0x1e')]?_0x29eb80[_0xdded('0x1e')][_0xdded('0x1f')]||null:null,'attributes':_0x29eb80[_0xdded('0x1e')]?_0x29eb80['options'][_0xdded('0x20')]||null:null,'limit':_0x29eb80['options']?_0x29eb80[_0xdded('0x1e')][_0xdded('0x21')]||null:null,'include':_0x29eb80[_0xdded('0x1e')]?_0x29eb80[_0xdded('0x1e')][_0xdded('0x22')]?_['map'](_0x29eb80[_0xdded('0x1e')][_0xdded('0x22')],function(_0x2b66b3){return{'model':db[_0x2b66b3[_0xdded('0x23')]],'as':_0x2b66b3['as'],'attributes':_0x2b66b3[_0xdded('0x20')],'include':_0x2b66b3['include']?_['map'](_0x2b66b3[_0xdded('0x22')],function(_0x88b9f1){return{'model':db[_0x88b9f1[_0xdded('0x23')]],'as':_0x88b9f1['as'],'attributes':_0x88b9f1[_0xdded('0x20')],'include':_0x88b9f1[_0xdded('0x22')]?_['map'](_0x88b9f1[_0xdded('0x22')],function(_0x10c128){return{'model':db[_0x10c128[_0xdded('0x23')]],'as':_0x10c128['as'],'attributes':_0x10c128[_0xdded('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x415158){logger['info'](_0xdded('0x1b'),_0x29eb80);logger[_0xdded('0x15')](_0xdded('0x1b'),_0x29eb80,JSON[_0xdded('0x24')](_0x415158));_0x457ee4(_0x415158);})[_0xdded('0x1a')](function(_0x3459c7){logger[_0xdded('0x17')]('GetVoiceExtension',_0x3459c7[_0xdded('0x18')],_0x29eb80);_0x415b38(_0x43f005[_0xdded('0x17')](0x1f4,_0x3459c7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f4e7d82..8d3a38f 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4ad395,_0x2ab982){var _0x26313d=function(_0x5174be){while(--_0x5174be){_0x4ad395['push'](_0x4ad395['shift']());}};_0x26313d(++_0x2ab982);}(_0x7a54,0x106));var _0x47a5=function(_0x13399e,_0x378626){_0x13399e=_0x13399e-0x0;var _0x3b3f96=_0x7a54[_0x13399e];return _0x3b3f96;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x4d956a,_0x4d4dcc){var _0x2137b0=function(_0x39a05c){while(--_0x39a05c){_0x4d956a['push'](_0x4d956a['shift']());}};_0x2137b0(++_0x4d4dcc);}(_0xf494,0x1c6));var _0x4f49=function(_0x24aacf,_0x406a66){_0x24aacf=_0x24aacf-0x0;var _0x32cb33=_0xf494[_0x24aacf];return _0x32cb33;};'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 aac0f40..7a07f66 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 _0x627e=['show','/:id/messages','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x2e53ec,_0x3fdd41){var _0x3a5d88=function(_0xf91da7){while(--_0xf91da7){_0x2e53ec['push'](_0x2e53ec['shift']());}};_0x3a5d88(++_0x3fdd41);}(_0x627e,0x14a));var _0xe627=function(_0xa79fc3,_0x3b93fa){_0xa79fc3=_0xa79fc3-0x0;var _0x541d8d=_0x627e[_0xa79fc3];return _0x541d8d;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe627('0xe')]('/',auth[_0xe627('0x8')](),controller['create']);router['put'](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xf')]);router[_0xe627('0x10')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0x11')]);module[_0xe627('0x12')]=router; \ No newline at end of file +var _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x3fe1ba,_0x1a33c5){var _0x5df1b4=function(_0x55d7c3){while(--_0x55d7c3){_0x3fe1ba['push'](_0x3fe1ba['shift']());}};_0x5df1b4(++_0x1a33c5);}(_0x1883,0xab));var _0x3188=function(_0x449842,_0x3d7507){_0x449842=_0x449842-0x0;var _0x99e21f=_0x1883[_0x449842];return _0x99e21f;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 41b5271..9324cbf 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 _0x89b1=['sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','mailbox'];(function(_0x23b27c,_0x5cc227){var _0x63413c=function(_0x1b831e){while(--_0x1b831e){_0x23b27c['push'](_0x23b27c['shift']());}};_0x63413c(++_0x5cc227);}(_0x89b1,0x1c2));var _0x189b=function(_0x284288,_0xee6ca9){_0x284288=_0x284288-0x0;var _0x18ca41=_0x89b1[_0x284288];return _0x18ca41;};'use strict';var Sequelize=require(_0x189b('0x0'));module[_0x189b('0x1')]={'customer_id':{'type':Sequelize[_0x189b('0x2')]},'context':{'type':Sequelize[_0x189b('0x2')],'defaultValue':'from-voicemail','unique':_0x189b('0x3')},'mailbox':{'type':Sequelize[_0x189b('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x189b('0x2')]},'fullname':{'type':Sequelize[_0x189b('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xbdfc1){this[_0x189b('0x4')](_0x189b('0x5'),typeof _0xbdfc1==='string'&&_0xbdfc1[_0x189b('0x6')]()?_0xbdfc1[_0x189b('0x6')]():null);}},'pager':{'type':Sequelize[_0x189b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x189b('0x7')},'attach':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x189b('0x2')]},'callback':{'type':Sequelize[_0x189b('0x2')]},'review':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'stamp':{'type':_0x189b('0xa')},'emailsubject':{'type':Sequelize[_0x189b('0x2')]},'emailbody':{'type':Sequelize[_0x189b('0x2')]},'maxsecs':{'type':Sequelize[_0x189b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x189b('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x189b('0xd')+this['getDataValue'](_0x189b('0xe'));}}}; \ No newline at end of file +var _0x7328=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','sequelize','STRING','contest_mailbox','setDataValue','string'];(function(_0x60d4a3,_0x294479){var _0x346a35=function(_0x1ac840){while(--_0x1ac840){_0x60d4a3['push'](_0x60d4a3['shift']());}};_0x346a35(++_0x294479);}(_0x7328,0xe9));var _0x8732=function(_0x4957ea,_0x12d3c9){_0x4957ea=_0x4957ea-0x0;var _0x9f9354=_0x7328[_0x4957ea];return _0x9f9354;};'use strict';var Sequelize=require(_0x8732('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x8732('0x1')]},'context':{'type':Sequelize[_0x8732('0x1')],'defaultValue':'from-voicemail','unique':_0x8732('0x2')},'mailbox':{'type':Sequelize[_0x8732('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8732('0x2')},'password':{'type':Sequelize[_0x8732('0x1')]},'fullname':{'type':Sequelize[_0x8732('0x1')]},'email':{'type':Sequelize[_0x8732('0x1')],'validate':{'isEmail':!![]},'set':function(_0x2508b5){this[_0x8732('0x3')]('email',typeof _0x2508b5===_0x8732('0x4')&&_0x2508b5['trim']()?_0x2508b5[_0x8732('0x5')]():null);}},'pager':{'type':Sequelize[_0x8732('0x1')]},'tz':{'type':Sequelize[_0x8732('0x1')],'defaultValue':_0x8732('0x6')},'attach':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':_0x8732('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':_0x8732('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8732('0x1')]},'review':{'type':Sequelize['ENUM'](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8732('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':_0x8732('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8732('0x7')](_0x8732('0x8'),'no'),'defaultValue':_0x8732('0x8'),'allowNull':![]},'stamp':{'type':_0x8732('0x9')},'emailsubject':{'type':Sequelize[_0x8732('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8732('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8732('0xb')](_0x8732('0xc'))+'\x20-\x20'+this[_0x8732('0xb')](_0x8732('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5de7001..a05eb68 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 _0x4483=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Voicemails','UserProfileResource','error','name','index','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','find','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_0x4483,0x1a3));var _0x3448=function(_0x5b8ab9,_0x2ca073){_0x5b8ab9=_0x5b8ab9-0x0;var _0x5a2e9f=_0x4483[_0x5b8ab9];return _0x5a2e9f;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){var _0x566ff5=_0x22ad5c[_0x3448('0x29')]({'plain':!![]});var _0x1b5c49=_0x3448('0x2a');return db[_0x3448('0x2b')][_0x3448('0x27')]({'where':{'type':_0x1b5c49,'resourceId':_0x566ff5['id']}})['then'](function(){return _0x22ad5c;});})[_0x3448('0x28')](function(){_0x2dcd40[_0x3448('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a479,_0x12c22d){return function(_0x310912){if(!_0x310912){_0x19a479[_0x3448('0x1b')](0x194);}return _0x310912;};}function handleError(_0x38fab2,_0x35f026){_0x35f026=_0x35f026||0x1f4;return function(_0x31be64){logger[_0x3448('0x2c')](_0x31be64['stack']);if(_0x31be64[_0x3448('0x2d')]){delete _0x31be64[_0x3448('0x2d')];}_0x38fab2[_0x3448('0x1c')](_0x35f026)['send'](_0x31be64);};}exports[_0x3448('0x2e')]=function(_0x5dfdf7,_0x486f2c){var _0x493898={},_0x52fb48={},_0xff6513={'count':0x0,'rows':[]};var _0x5e96f0=_['map'](db[_0x3448('0x2f')][_0x3448('0x30')],function(_0x32121c){return{'name':_0x32121c[_0x3448('0x31')],'type':_0x32121c['type'][_0x3448('0x32')]};});_0x52fb48[_0x3448('0x33')]=_[_0x3448('0x34')](_0x5e96f0,'name');_0x52fb48[_0x3448('0x35')]=_[_0x3448('0x36')](_0x5dfdf7['query']);_0x52fb48['filters']=_[_0x3448('0x37')](_0x52fb48[_0x3448('0x33')],_0x52fb48[_0x3448('0x35')]);_0x493898[_0x3448('0x38')]=_['intersection'](_0x52fb48[_0x3448('0x33')],qs[_0x3448('0x39')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x39')]));_0x493898['attributes']=_0x493898[_0x3448('0x38')][_0x3448('0x3a')]?_0x493898['attributes']:_0x52fb48[_0x3448('0x33')];if(!_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3b')](_0x3448('0x3c'))){_0x493898[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x21')]);_0x493898[_0x3448('0x1f')]=qs['offset'](_0x5dfdf7['query'][_0x3448('0x1f')]);}_0x493898['order']=qs[_0x3448('0x3d')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3d')]);_0x493898[_0x3448('0x3e')]=qs['filters'](_[_0x3448('0x3f')](_0x5dfdf7[_0x3448('0x35')],_0x52fb48[_0x3448('0x40')]),_0x5e96f0);if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x41')]){_0x493898[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x493898[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x5e96f0,function(_0x5a58c5){if(_0x5a58c5[_0x3448('0x43')]!==_0x3448('0x44')){var _0x322b46={};_0x322b46[_0x5a58c5[_0x3448('0x2d')]]={'$like':'%'+_0x5dfdf7[_0x3448('0x35')]['filter']+'%'};return _0x322b46;}})});}_0x493898=_[_0x3448('0x42')]({},_0x493898,_0x5dfdf7[_0x3448('0x45')]);var _0x4a6e5={'where':_0x493898[_0x3448('0x3e')]};return db[_0x3448('0x2f')][_0x3448('0x22')](_0x4a6e5)[_0x3448('0x28')](function(_0x3db5f1){_0xff6513['count']=_0x3db5f1;if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x46')]){_0x493898[_0x3448('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x3448('0x48')](_0x493898);})[_0x3448('0x28')](function(_0x21f989){_0xff6513[_0x3448('0x49')]=_0x21f989;return _0xff6513;})[_0x3448('0x28')](respondWithFilteredResult(_0x486f2c,_0x493898))[_0x3448('0x4a')](handleError(_0x486f2c,null));};exports[_0x3448('0x4b')]=function(_0x4f54e7,_0x2165c7){var _0x46b172={'raw':!![],'where':{'id':_0x4f54e7[_0x3448('0x4c')]['id']}},_0x1e7fb7={};_0x1e7fb7[_0x3448('0x33')]=_[_0x3448('0x36')](db['VoiceMail'][_0x3448('0x30')]);_0x1e7fb7['query']=_['keys'](_0x4f54e7[_0x3448('0x35')]);_0x1e7fb7[_0x3448('0x40')]=_['intersection'](_0x1e7fb7[_0x3448('0x33')],_0x1e7fb7[_0x3448('0x35')]);_0x46b172['attributes']=_[_0x3448('0x37')](_0x1e7fb7[_0x3448('0x33')],qs['fields'](_0x4f54e7[_0x3448('0x35')][_0x3448('0x39')]));_0x46b172[_0x3448('0x38')]=_0x46b172[_0x3448('0x38')][_0x3448('0x3a')]?_0x46b172[_0x3448('0x38')]:_0x1e7fb7[_0x3448('0x33')];if(_0x4f54e7['query']['includeAll']){_0x46b172[_0x3448('0x47')]=[{'all':!![]}];}_0x46b172=_[_0x3448('0x42')]({},_0x46b172,_0x4f54e7[_0x3448('0x45')]);return db[_0x3448('0x2f')]['find'](_0x46b172)[_0x3448('0x28')](handleEntityNotFound(_0x2165c7,null))[_0x3448('0x28')](respondWithResult(_0x2165c7,null))[_0x3448('0x4a')](handleError(_0x2165c7,null));};exports[_0x3448('0x4d')]=function(_0x363374,_0x5d942b){return db[_0x3448('0x2f')]['create'](_0x363374[_0x3448('0x4e')],{})[_0x3448('0x28')](function(_0x5c8e42){var _0x479b79=_0x363374[_0x3448('0x4f')][_0x3448('0x29')]({'plain':!![]});if(!_0x479b79)throw new Error(_0x3448('0x50'));if(_0x479b79[_0x3448('0x51')]===_0x3448('0x4f')){var _0xc769e1=_0x5c8e42['get']({'plain':!![]});var _0x23dbda=_0x3448('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x23dbda,'userProfileId':_0x479b79[_0x3448('0x52')]},'raw':!![]})[_0x3448('0x28')](function(_0x4d20ba){if(_0x4d20ba&&_0x4d20ba['autoAssociation']===0x0){return db[_0x3448('0x2b')][_0x3448('0x4d')]({'name':_0xc769e1[_0x3448('0x2d')],'resourceId':_0xc769e1['id'],'type':_0x4d20ba[_0x3448('0x2d')],'sectionId':_0x4d20ba['id']},{})[_0x3448('0x28')](function(){return _0x5c8e42;});}else{return _0x5c8e42;}})[_0x3448('0x4a')](function(_0x2aea70){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aea70);throw _0x2aea70;});}return _0x5c8e42;})['then'](respondWithResult(_0x5d942b,0xc9))[_0x3448('0x4a')](handleError(_0x5d942b,null));};exports[_0x3448('0x26')]=function(_0x5cf3fe,_0x35ce1d){if(_0x5cf3fe[_0x3448('0x4e')]['id']){delete _0x5cf3fe['body']['id'];}return db[_0x3448('0x2f')][_0x3448('0x53')]({'where':{'id':_0x5cf3fe['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x35ce1d,null))[_0x3448('0x28')](saveUpdates(_0x5cf3fe[_0x3448('0x4e')],null))[_0x3448('0x28')](respondWithResult(_0x35ce1d,null))[_0x3448('0x4a')](handleError(_0x35ce1d,null));};exports[_0x3448('0x27')]=function(_0xeda861,_0x1b7d87){return db[_0x3448('0x2f')]['find']({'where':{'id':_0xeda861[_0x3448('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b7d87,null))[_0x3448('0x28')](removeEntity(_0x1b7d87,null))[_0x3448('0x4a')](handleError(_0x1b7d87,null));};exports[_0x3448('0x54')]=function(_0x58422,_0x1cbeae,_0x332e02){return db['VoiceMail'][_0x3448('0x55')]({'where':{'id':_0x58422['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x1cbeae,null))[_0x3448('0x28')](function(_0x3bf4d2){var _0x5c9320;var _0x3ead11={},_0x4e381f={};_0x4e381f['model']=_[_0x3448('0x36')](db[_0x3448('0x56')][_0x3448('0x30')]);_0x4e381f['query']=_[_0x3448('0x36')](_0x58422[_0x3448('0x35')]);_0x4e381f[_0x3448('0x40')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],_0x4e381f[_0x3448('0x35')]);_0x3ead11[_0x3448('0x38')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],qs[_0x3448('0x39')](_0x58422[_0x3448('0x35')][_0x3448('0x39')]));_0x3ead11[_0x3448('0x38')]=_0x3ead11[_0x3448('0x38')][_0x3448('0x3a')]?_0x3ead11[_0x3448('0x38')]:_0x4e381f[_0x3448('0x33')];if(!_0x58422[_0x3448('0x35')]['hasOwnProperty'](_0x3448('0x3c'))){_0x3ead11['limit']=qs[_0x3448('0x21')](_0x58422['query'][_0x3448('0x21')]);_0x3ead11[_0x3448('0x1f')]=qs['offset'](_0x58422[_0x3448('0x35')][_0x3448('0x1f')]);}_0x3ead11['order']=qs['sort'](_0x58422[_0x3448('0x35')]['sort']);_0x3ead11['where']=qs[_0x3448('0x40')](_[_0x3448('0x3f')](_0x58422['query'],_0x4e381f['filters']));if(_0x58422[_0x3448('0x35')][_0x3448('0x41')]){_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x3ead11[_0x3448('0x38')],function(_0x10749d){var _0x2cf3ef={};_0x2cf3ef[_0x10749d]={'$like':'%'+_0x58422[_0x3448('0x35')][_0x3448('0x41')]+'%'};return _0x2cf3ef;})});}_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'mailboxuser':_0x3bf4d2['mailbox']});_0x3ead11=_[_0x3448('0x42')]({},_0x3ead11,_0x58422[_0x3448('0x45')]);return db['VoiceMailMessage'][_0x3448('0x57')](_0x3ead11)[_0x3448('0x28')](respondWithFilteredResult(_0x1cbeae,_0x3ead11));})['catch'](handleError(_0x1cbeae,null));}; \ No newline at end of file +var _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x53af52,_0x56d628){var _0x589671=function(_0x4e2792){while(--_0x4e2792){_0x53af52['push'](_0x53af52['shift']());}};_0x589671(++_0x56d628);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4ee16fa..8a0a592 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 _0x80b5=['./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x330a8c,_0x5833c8){var _0x74cd01=function(_0x38c7b6){while(--_0x38c7b6){_0x330a8c['push'](_0x330a8c['shift']());}};_0x74cd01(++_0x5833c8);}(_0x80b5,0x1d6));var _0x580b=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x80b5[_0x481df5];return _0x32726e;};'use strict';var _=require(_0x580b('0x0'));var util=require(_0x580b('0x1'));var logger=require(_0x580b('0x2'))(_0x580b('0x3'));var moment=require(_0x580b('0x4'));var BPromise=require(_0x580b('0x5'));var rp=require(_0x580b('0x6'));var fs=require('fs');var path=require(_0x580b('0x7'));var rimraf=require(_0x580b('0x8'));var config=require(_0x580b('0x9'));var attributes=require(_0x580b('0xa'));module[_0x580b('0xb')]=function(_0x41d66b,_0x525d85){return _0x41d66b['define'](_0x580b('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x580b('0xd'),'fields':[_0x580b('0xe'),_0x580b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3785=['request-promise','path','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox','util','../../config/logger','api','moment','bluebird'];(function(_0x360a02,_0x5c1a9c){var _0x563dd3=function(_0x366338){while(--_0x366338){_0x360a02['push'](_0x360a02['shift']());}};_0x563dd3(++_0x5c1a9c);}(_0x3785,0x140));var _0x5378=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3785[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x5378('0x0'));var logger=require(_0x5378('0x1'))(_0x5378('0x2'));var moment=require(_0x5378('0x3'));var BPromise=require(_0x5378('0x4'));var rp=require(_0x5378('0x5'));var fs=require('fs');var path=require(_0x5378('0x6'));var rimraf=require('rimraf');var config=require(_0x5378('0x7'));var attributes=require('./voiceMail.attributes');module[_0x5378('0x8')]=function(_0x328a42,_0x471b35){return _0x328a42[_0x5378('0x9')](_0x5378('0xa'),attributes,{'tableName':_0x5378('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x5378('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9f23a04..3bb9ae8 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 _0xf52d=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash'];(function(_0x207d3d,_0x4b2103){var _0x8c2e5d=function(_0x56784b){while(--_0x56784b){_0x207d3d['push'](_0x207d3d['shift']());}};_0x8c2e5d(++_0x4b2103);}(_0xf52d,0xd1));var _0xdf52=function(_0x4e0148,_0x5021b4){_0x4e0148=_0x4e0148-0x0;var _0x3f3e5e=_0xf52d[_0x4e0148];return _0x3f3e5e;};'use strict';var _=require(_0xdf52('0x0'));var util=require(_0xdf52('0x1'));var moment=require(_0xdf52('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf52('0x3'));var fs=require('fs');var Redis=require(_0xdf52('0x4'));var db=require(_0xdf52('0x5'))['db'];var utils=require(_0xdf52('0x6'));var logger=require('../../config/logger')(_0xdf52('0x7'));var config=require(_0xdf52('0x8'));var jayson=require(_0xdf52('0x9'));var client=jayson['client'][_0xdf52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe43033,_0x417b98,_0x2efde6){return new BPromise(function(_0x193b5f,_0x4fc263){return client['request'](_0xe43033,_0x2efde6)[_0xdf52('0xb')](function(_0x4031df){logger['info'](_0xdf52('0xc'),_0x417b98,_0xdf52('0xd'));logger[_0xdf52('0xe')](_0xdf52('0xf'),_0x417b98,_0xdf52('0xd'),JSON[_0xdf52('0x10')](_0x4031df));if(_0x4031df[_0xdf52('0x11')]){if(_0x4031df['error']['code']===0x1f4){logger[_0xdf52('0x11')](_0xdf52('0xc'),_0x417b98,_0x4031df['error'][_0xdf52('0x12')]);return _0x4fc263(_0x4031df['error'][_0xdf52('0x12')]);}logger['error'](_0xdf52('0xc'),_0x417b98,_0x4031df[_0xdf52('0x11')][_0xdf52('0x12')]);return _0x193b5f(_0x4031df[_0xdf52('0x11')][_0xdf52('0x12')]);}else{logger[_0xdf52('0x13')]('VoiceMail,\x20%s,\x20%s',_0x417b98,_0xdf52('0xd'));_0x193b5f(_0x4031df[_0xdf52('0x14')]['message']);}})['catch'](function(_0x4fd3d1){logger[_0xdf52('0x11')]('VoiceMail,\x20%s,\x20%s',_0x417b98,_0x4fd3d1);_0x4fc263(_0x4fd3d1);});});} \ No newline at end of file +var _0xbdcd=['VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x4ebf10,_0x2ea42a){var _0x12453b=function(_0x13643b){while(--_0x13643b){_0x4ebf10['push'](_0x4ebf10['shift']());}};_0x12453b(++_0x2ea42a);}(_0xbdcd,0x134));var _0xdbdc=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0xbdcd[_0x1261c2];return _0x3aabd2;};'use strict';var _=require(_0xdbdc('0x0'));var util=require(_0xdbdc('0x1'));var moment=require(_0xdbdc('0x2'));var BPromise=require(_0xdbdc('0x3'));var rs=require(_0xdbdc('0x4'));var fs=require('fs');var Redis=require(_0xdbdc('0x5'));var db=require(_0xdbdc('0x6'))['db'];var utils=require(_0xdbdc('0x7'));var logger=require(_0xdbdc('0x8'))(_0xdbdc('0x9'));var config=require('../../config/environment');var jayson=require(_0xdbdc('0xa'));var client=jayson[_0xdbdc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x592cd8,_0x33054b,_0x35e4ca){return new BPromise(function(_0x273d0c,_0x91f442){return client[_0xdbdc('0xc')](_0x592cd8,_0x35e4ca)[_0xdbdc('0xd')](function(_0x405b82){logger['info'](_0xdbdc('0xe'),_0x33054b,'request\x20sent');logger['debug'](_0xdbdc('0xf'),_0x33054b,_0xdbdc('0x10'),JSON[_0xdbdc('0x11')](_0x405b82));if(_0x405b82[_0xdbdc('0x12')]){if(_0x405b82[_0xdbdc('0x12')][_0xdbdc('0x13')]===0x1f4){logger[_0xdbdc('0x12')]('VoiceMail,\x20%s,\x20%s',_0x33054b,_0x405b82[_0xdbdc('0x12')][_0xdbdc('0x14')]);return _0x91f442(_0x405b82[_0xdbdc('0x12')][_0xdbdc('0x14')]);}logger[_0xdbdc('0x12')](_0xdbdc('0xe'),_0x33054b,_0x405b82[_0xdbdc('0x12')]['message']);return _0x273d0c(_0x405b82[_0xdbdc('0x12')][_0xdbdc('0x14')]);}else{logger['info'](_0xdbdc('0xe'),_0x33054b,'request\x20sent');_0x273d0c(_0x405b82[_0xdbdc('0x15')][_0xdbdc('0x14')]);}})[_0xdbdc('0x16')](function(_0x2c4d05){logger['error'](_0xdbdc('0xe'),_0x33054b,_0x2c4d05);_0x91f442(_0x2c4d05);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1de0e31..c5d8a5f 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 _0x04dc=['delete','destroy','multer','util','path','Router','fs-extra','get','index','show','isAuthenticated','download','post','put','/:id','update'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0x04dc,0x1b2));var _0xc04d=function(_0x1a4c27,_0x5a4b45){_0x1a4c27=_0x1a4c27-0x0;var _0x578d9=_0x04dc[_0x1a4c27];return _0x578d9;};'use strict';var multer=require(_0xc04d('0x0'));var util=require(_0xc04d('0x1'));var path=require(_0xc04d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc04d('0x3')]();var fs_extra=require(_0xc04d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc04d('0x5')]('/',auth['isAuthenticated'](),controller[_0xc04d('0x6')]);router[_0xc04d('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc04d('0x7')]);router[_0xc04d('0x5')]('/:id/download',auth[_0xc04d('0x8')](),controller[_0xc04d('0x9')]);router[_0xc04d('0xa')]('/',auth[_0xc04d('0x8')](),controller['create']);router[_0xc04d('0xb')](_0xc04d('0xc'),auth[_0xc04d('0x8')](),controller[_0xc04d('0xd')]);router[_0xc04d('0xe')]('/:id',auth[_0xc04d('0x8')](),controller[_0xc04d('0xf')]);module['exports']=router; \ No newline at end of file +var _0xfaa5=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3030e9,_0x435a80){var _0x219650=function(_0x1baabd){while(--_0x1baabd){_0x3030e9['push'](_0x3030e9['shift']());}};_0x219650(++_0x435a80);}(_0xfaa5,0x1d8));var _0x5faa=function(_0x5515a7,_0x2c4af1){_0x5515a7=_0x5515a7-0x0;var _0x43f4bf=_0xfaa5[_0x5515a7];return _0x43f4bf;};'use strict';var multer=require(_0x5faa('0x0'));var util=require(_0x5faa('0x1'));var path=require(_0x5faa('0x2'));var timeout=require(_0x5faa('0x3'));var express=require(_0x5faa('0x4'));var router=express['Router']();var fs_extra=require(_0x5faa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5faa('0x6'));var config=require(_0x5faa('0x7'));var controller=require(_0x5faa('0x8'));router[_0x5faa('0x9')]('/',auth[_0x5faa('0xa')](),controller[_0x5faa('0xb')]);router[_0x5faa('0x9')](_0x5faa('0xc'),auth[_0x5faa('0xa')](),controller[_0x5faa('0xd')]);router[_0x5faa('0x9')]('/:id/download',auth[_0x5faa('0xa')](),controller['download']);router[_0x5faa('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5faa('0xf')](_0x5faa('0xc'),auth['isAuthenticated'](),controller[_0x5faa('0x10')]);router[_0x5faa('0x11')](_0x5faa('0xc'),auth[_0x5faa('0xa')](),controller[_0x5faa('0x12')]);module[_0x5faa('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a52f3f3..e8f8487 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 _0x598f=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x53a51b,_0x4c164d){var _0x17b065=function(_0xabc64e){while(--_0xabc64e){_0x53a51b['push'](_0x53a51b['shift']());}};_0x17b065(++_0x4c164d);}(_0x598f,0x10f));var _0xf598=function(_0x1ecd32,_0x507695){_0x1ecd32=_0x1ecd32-0x0;var _0x3fcbe5=_0x598f[_0x1ecd32];return _0x3fcbe5;};'use strict';var Sequelize=require(_0xf598('0x0'));module['exports']={'name':{'type':Sequelize[_0xf598('0x1')],'get':function(_0x44828e){return this[_0xf598('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf598('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf598('0x5')](_0xf598('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'stamp':{'type':_0xf598('0x7'),'defaultValue':Sequelize[_0xf598('0x8')](_0xf598('0x9'))}}; \ No newline at end of file +var _0x1d41=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','STRING','long'];(function(_0x3a7829,_0x19370c){var _0x4f5918=function(_0x68d55a){while(--_0x68d55a){_0x3a7829['push'](_0x3a7829['shift']());}};_0x4f5918(++_0x19370c);}(_0x1d41,0x129));var _0x11d4=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0x1d41[_0x402c8f];return _0x11e809;};'use strict';var Sequelize=require(_0x11d4('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c51b6){return this[_0x11d4('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x11d4('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x11d4('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x11d4('0x4'),'defaultValue':Sequelize[_0x11d4('0x5')](_0x11d4('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ba25c50..75b9aa1 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 _0x50b0=['find','catch','create','body','update','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x262f5d,_0x4a6c15){var _0x376624=function(_0x9c534b){while(--_0x9c534b){_0x262f5d['push'](_0x262f5d['shift']());}};_0x376624(++_0x4a6c15);}(_0x50b0,0xf7));var _0x050b=function(_0x29d6f6,_0x2d20de){_0x29d6f6=_0x29d6f6-0x0;var _0x128722=_0x50b0[_0x29d6f6];return _0x128722;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x050b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x050b('0x1'));var moment=require(_0x050b('0x2'));var BPromise=require(_0x050b('0x3'));var Mustache=require('mustache');var util=require(_0x050b('0x4'));var path=require(_0x050b('0x5'));var sox=require('sox');var csv=require(_0x050b('0x6'));var ejs=require(_0x050b('0x7'));var fs=require('fs');var fs_extra=require(_0x050b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x050b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x050b('0xa'));var toCsv=require(_0x050b('0x6'));var querystring=require(_0x050b('0xb'));var Papa=require(_0x050b('0xc'));var Redis=require(_0x050b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x050b('0xe'));var as=require(_0x050b('0xf'));var hardwareService=require(_0x050b('0x10'));var logger=require(_0x050b('0x11'))(_0x050b('0x12'));var utils=require(_0x050b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x050b('0x14'))['db'];function respondWithStatusCode(_0x52c6dc,_0x4ce32d){_0x4ce32d=_0x4ce32d||0xcc;return function(_0x2b6c69){if(_0x2b6c69){return _0x52c6dc['sendStatus'](_0x4ce32d);}return _0x52c6dc[_0x050b('0x15')](_0x4ce32d)['end']();};}function respondWithResult(_0xa4e155,_0x535d7c){_0x535d7c=_0x535d7c||0xc8;return function(_0x82a351){if(_0x82a351){return _0xa4e155[_0x050b('0x15')](_0x535d7c)[_0x050b('0x16')](_0x82a351);}};}function respondWithFilteredResult(_0x43a857,_0x28ccb0){return function(_0x2a6c9f){if(_0x2a6c9f){var _0x533cc3=typeof _0x28ccb0['offset']==='undefined'&&typeof _0x28ccb0['limit']===_0x050b('0x17');var _0x36ea9a=_0x2a6c9f[_0x050b('0x18')];var _0x465ace=_0x533cc3?0x0:_0x28ccb0[_0x050b('0x19')];var _0x4f8ba3=_0x533cc3?_0x2a6c9f[_0x050b('0x18')]:_0x28ccb0[_0x050b('0x19')]+_0x28ccb0[_0x050b('0x1a')];var _0x4d17a0;if(_0x4f8ba3>=_0x36ea9a){_0x4f8ba3=_0x36ea9a;_0x4d17a0=0xc8;}else{_0x4d17a0=0xce;}_0x43a857['status'](_0x4d17a0);return _0x43a857[_0x050b('0x1b')](_0x050b('0x1c'),_0x465ace+'-'+_0x4f8ba3+'/'+_0x36ea9a)[_0x050b('0x16')](_0x2a6c9f);}return null;};}function patchUpdates(_0x48ad25){return function(_0x5a9828){try{jsonpatch[_0x050b('0x1d')](_0x5a9828,_0x48ad25,!![]);}catch(_0x1b1c5f){return BPromise[_0x050b('0x1e')](_0x1b1c5f);}return _0x5a9828[_0x050b('0x1f')]();};}function saveUpdates(_0x3c5bc0,_0x595910){return function(_0x49c637){if(_0x49c637){return _0x49c637['update'](_0x3c5bc0)[_0x050b('0x20')](function(_0x8a2ea9){return _0x8a2ea9;});}return null;};}function removeEntity(_0x3d6e56,_0x48f084){return function(_0x5a3eca){if(_0x5a3eca){return _0x5a3eca[_0x050b('0x21')]()[_0x050b('0x20')](function(){_0x3d6e56[_0x050b('0x15')](0xcc)[_0x050b('0x22')]();});}};}function handleEntityNotFound(_0x4d8265,_0x5dcb4e){return function(_0x2262c9){if(!_0x2262c9){_0x4d8265[_0x050b('0x23')](0x194);}return _0x2262c9;};}function handleError(_0x55ed60,_0x5a96ca){_0x5a96ca=_0x5a96ca||0x1f4;return function(_0x49ffe4){logger['error'](_0x49ffe4['stack']);if(_0x49ffe4[_0x050b('0x24')]){delete _0x49ffe4[_0x050b('0x24')];}_0x55ed60['status'](_0x5a96ca)[_0x050b('0x25')](_0x49ffe4);};}exports['index']=function(_0x53d358,_0x3459f6){var _0x4825f1={},_0x4e0709={},_0x42629c={'count':0x0,'rows':[]};var _0x1ec305=_[_0x050b('0x26')](db[_0x050b('0x27')][_0x050b('0x28')],function(_0x369723){return{'name':_0x369723['fieldName'],'type':_0x369723[_0x050b('0x29')][_0x050b('0x2a')]};});_0x4e0709[_0x050b('0x2b')]=_[_0x050b('0x2c')](_[_0x050b('0x26')](_0x1ec305,_0x050b('0x24')),[_0x050b('0x24')]);_0x4e0709[_0x050b('0x2d')]=_[_0x050b('0x2e')](_0x53d358[_0x050b('0x2d')]);_0x4e0709[_0x050b('0x2f')]=_[_0x050b('0x30')](_0x4e0709[_0x050b('0x2b')],_0x4e0709[_0x050b('0x2d')]);_0x4825f1[_0x050b('0x31')]=_[_0x050b('0x30')](_0x4e0709['model'],qs[_0x050b('0x32')](_0x53d358['query']['fields']));_0x4825f1[_0x050b('0x31')]=_0x4825f1[_0x050b('0x31')][_0x050b('0x33')]?_0x4825f1[_0x050b('0x31')]:_0x4e0709[_0x050b('0x2b')];if(!_0x53d358[_0x050b('0x2d')][_0x050b('0x34')]('nolimit')){_0x4825f1[_0x050b('0x1a')]=qs[_0x050b('0x1a')](_0x53d358[_0x050b('0x2d')][_0x050b('0x1a')]);_0x4825f1['offset']=qs[_0x050b('0x19')](_0x53d358[_0x050b('0x2d')][_0x050b('0x19')]);}_0x4825f1['order']=qs[_0x050b('0x35')](_0x53d358[_0x050b('0x2d')][_0x050b('0x35')]);_0x4825f1[_0x050b('0x36')]=qs[_0x050b('0x2f')](_['pick'](_0x53d358[_0x050b('0x2d')],_0x4e0709[_0x050b('0x2f')]),_0x1ec305);if(_0x53d358[_0x050b('0x2d')][_0x050b('0x37')]){_0x4825f1[_0x050b('0x36')]=_[_0x050b('0x38')](_0x4825f1[_0x050b('0x36')],{'$or':_[_0x050b('0x26')](_0x1ec305,function(_0x55901c){if(_0x55901c['type']!==_0x050b('0x39')){var _0x184ad2={};_0x184ad2[_0x55901c[_0x050b('0x24')]]={'$like':'%'+_0x53d358[_0x050b('0x2d')][_0x050b('0x37')]+'%'};return _0x184ad2;}})});}_0x4825f1=_[_0x050b('0x38')]({},_0x4825f1,_0x53d358[_0x050b('0x3a')]);var _0x1a2a37={'where':_0x4825f1[_0x050b('0x36')]};return db[_0x050b('0x27')][_0x050b('0x18')](_0x1a2a37)['then'](function(_0x1832fa){_0x42629c[_0x050b('0x18')]=_0x1832fa;if(_0x53d358[_0x050b('0x2d')][_0x050b('0x3b')]){_0x4825f1[_0x050b('0x3c')]=[{'all':!![]}];}return db[_0x050b('0x27')][_0x050b('0x3d')](_0x4825f1);})[_0x050b('0x20')](function(_0x2bddb6){_0x42629c[_0x050b('0x3e')]=_0x2bddb6;return _0x42629c;})['then'](respondWithFilteredResult(_0x3459f6,_0x4825f1))['catch'](handleError(_0x3459f6,null));};exports[_0x050b('0x3f')]=function(_0x36f1cc,_0x450801){var _0x2f7d45={'raw':!![],'where':{'id':_0x36f1cc[_0x050b('0x40')]['id']}},_0x3c5abf={};_0x3c5abf[_0x050b('0x2b')]=_[_0x050b('0x2e')](db[_0x050b('0x27')][_0x050b('0x28')]);_0x3c5abf[_0x050b('0x2d')]=_[_0x050b('0x2e')](_0x36f1cc[_0x050b('0x2d')]);_0x3c5abf[_0x050b('0x2f')]=_[_0x050b('0x30')](_0x3c5abf['model'],_0x3c5abf[_0x050b('0x2d')]);_0x2f7d45[_0x050b('0x31')]=_[_0x050b('0x30')](_0x3c5abf[_0x050b('0x2b')],qs[_0x050b('0x32')](_0x36f1cc[_0x050b('0x2d')]['fields']));_0x2f7d45[_0x050b('0x31')]=_0x2f7d45[_0x050b('0x31')][_0x050b('0x33')]?_0x2f7d45[_0x050b('0x31')]:_0x3c5abf['model'];if(_0x36f1cc[_0x050b('0x2d')][_0x050b('0x3b')]){_0x2f7d45[_0x050b('0x3c')]=[{'all':!![]}];}_0x2f7d45=_[_0x050b('0x38')]({},_0x2f7d45,_0x36f1cc[_0x050b('0x3a')]);return db[_0x050b('0x27')][_0x050b('0x41')](_0x2f7d45)['then'](handleEntityNotFound(_0x450801,null))[_0x050b('0x20')](respondWithResult(_0x450801,null))[_0x050b('0x42')](handleError(_0x450801,null));};exports[_0x050b('0x43')]=function(_0x568339,_0x184bee){return db[_0x050b('0x27')][_0x050b('0x43')](_0x568339[_0x050b('0x44')],{})[_0x050b('0x20')](respondWithResult(_0x184bee,0xc9))[_0x050b('0x42')](handleError(_0x184bee,null));};exports[_0x050b('0x45')]=function(_0x14a2fa,_0x332650){if(_0x14a2fa[_0x050b('0x44')]['id']){delete _0x14a2fa['body']['id'];}return db[_0x050b('0x27')][_0x050b('0x41')]({'where':{'id':_0x14a2fa[_0x050b('0x40')]['id']}})[_0x050b('0x20')](handleEntityNotFound(_0x332650,null))[_0x050b('0x20')](saveUpdates(_0x14a2fa[_0x050b('0x44')],null))[_0x050b('0x20')](respondWithResult(_0x332650,null))[_0x050b('0x42')](handleError(_0x332650,null));};exports['destroy']=function(_0x49fe8b,_0x1558ae){return db[_0x050b('0x27')][_0x050b('0x41')]({'where':{'id':_0x49fe8b[_0x050b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1558ae,null))['then'](removeEntity(_0x1558ae,null))[_0x050b('0x42')](handleError(_0x1558ae,null));};exports['download']=function(_0xa0ff7c,_0x10cef2,_0x4d1397){return db['VoiceMailMessage'][_0x050b('0x41')]({'where':{'id':_0xa0ff7c['params']['id']},'attributes':['id','recording',_0x050b('0x46')]})[_0x050b('0x20')](handleEntityNotFound(_0x10cef2,null))[_0x050b('0x20')](function(_0x426fea){if(_0x426fea){if(!_0x426fea[_0x050b('0x47')]){throw new db[(_0x050b('0x48'))]['ValidationError'](_0x050b('0x49'));}var _0x41016={'Content-Type':_0x050b('0x4a'),'Content-Disposition':_0x050b('0x4b')};if(_0x426fea['msg_id']){_0x41016[_0x050b('0x4c')]=_0x050b('0x4d')+_0x426fea[_0x050b('0x46')]+'.wav\x22';}_0x10cef2['set'](_0x41016);return _0x10cef2['send'](new Buffer(_0x426fea[_0x050b('0x47')]));}})[_0x050b('0x42')](handleError(_0x10cef2,null));}; \ No newline at end of file +var _0xdb21=['set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','find','create','body','catch','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdb21,0xd2));var _0x1db2=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0xdb21[_0x293e7a];return _0xb78342;};'use strict';var emlformat=require(_0x1db2('0x0'));var rimraf=require(_0x1db2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1db2('0x2'));var rp=require(_0x1db2('0x3'));var moment=require(_0x1db2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1db2('0x5'));var util=require(_0x1db2('0x6'));var path=require('path');var sox=require(_0x1db2('0x7'));var csv=require('to-csv');var ejs=require(_0x1db2('0x8'));var fs=require('fs');var fs_extra=require(_0x1db2('0x9'));var _=require('lodash');var squel=require(_0x1db2('0xa'));var crypto=require(_0x1db2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1db2('0xc'));var toCsv=require(_0x1db2('0xd'));var querystring=require('querystring');var Papa=require(_0x1db2('0xe'));var Redis=require('ioredis');var authService=require(_0x1db2('0xf'));var qs=require(_0x1db2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1db2('0x11'));var logger=require(_0x1db2('0x12'))(_0x1db2('0x13'));var utils=require('../../config/utils');var config=require(_0x1db2('0x14'));var licenseUtil=require(_0x1db2('0x15'));var db=require(_0x1db2('0x16'))['db'];function respondWithStatusCode(_0x144eac,_0x52557c){_0x52557c=_0x52557c||0xcc;return function(_0x3354db){if(_0x3354db){return _0x144eac[_0x1db2('0x17')](_0x52557c);}return _0x144eac[_0x1db2('0x18')](_0x52557c)[_0x1db2('0x19')]();};}function respondWithResult(_0x57125d,_0x27a68d){_0x27a68d=_0x27a68d||0xc8;return function(_0x349eec){if(_0x349eec){return _0x57125d['status'](_0x27a68d)['json'](_0x349eec);}};}function respondWithFilteredResult(_0x601962,_0xac2eda){return function(_0x568b11){if(_0x568b11){var _0x2466e5=typeof _0xac2eda['offset']===_0x1db2('0x1a')&&typeof _0xac2eda[_0x1db2('0x1b')]==='undefined';var _0x31ba86=_0x568b11[_0x1db2('0x1c')];var _0x2684f5=_0x2466e5?0x0:_0xac2eda['offset'];var _0x18f28a=_0x2466e5?_0x568b11[_0x1db2('0x1c')]:_0xac2eda[_0x1db2('0x1d')]+_0xac2eda['limit'];var _0x58fe5b;if(_0x18f28a>=_0x31ba86){_0x18f28a=_0x31ba86;_0x58fe5b=0xc8;}else{_0x58fe5b=0xce;}_0x601962[_0x1db2('0x18')](_0x58fe5b);return _0x601962[_0x1db2('0x1e')](_0x1db2('0x1f'),_0x2684f5+'-'+_0x18f28a+'/'+_0x31ba86)[_0x1db2('0x20')](_0x568b11);}return null;};}function patchUpdates(_0x53fa9f){return function(_0x2d7c79){try{jsonpatch['apply'](_0x2d7c79,_0x53fa9f,!![]);}catch(_0x2c9a33){return BPromise[_0x1db2('0x21')](_0x2c9a33);}return _0x2d7c79[_0x1db2('0x22')]();};}function saveUpdates(_0x27be80,_0x33cc69){return function(_0x3b382e){if(_0x3b382e){return _0x3b382e[_0x1db2('0x23')](_0x27be80)[_0x1db2('0x24')](function(_0x4d63c6){return _0x4d63c6;});}return null;};}function removeEntity(_0x408d44,_0x2ceb5e){return function(_0x1c3f36){if(_0x1c3f36){return _0x1c3f36[_0x1db2('0x25')]()['then'](function(){_0x408d44[_0x1db2('0x18')](0xcc)[_0x1db2('0x19')]();});}};}function handleEntityNotFound(_0x43e986,_0x4f4a0a){return function(_0x298601){if(!_0x298601){_0x43e986['sendStatus'](0x194);}return _0x298601;};}function handleError(_0x266f21,_0x41f81a){_0x41f81a=_0x41f81a||0x1f4;return function(_0x77af89){logger[_0x1db2('0x26')](_0x77af89[_0x1db2('0x27')]);if(_0x77af89['name']){delete _0x77af89[_0x1db2('0x28')];}_0x266f21['status'](_0x41f81a)[_0x1db2('0x29')](_0x77af89);};}exports[_0x1db2('0x2a')]=function(_0xf17cc1,_0x38ddaf){var _0x3e7a1e={},_0x2a53a3={},_0x5bd376={'count':0x0,'rows':[]};var _0x7c131e=_[_0x1db2('0x2b')](db[_0x1db2('0x2c')][_0x1db2('0x2d')],function(_0x3e9b7a){return{'name':_0x3e9b7a[_0x1db2('0x2e')],'type':_0x3e9b7a[_0x1db2('0x2f')][_0x1db2('0x30')]};});_0x2a53a3[_0x1db2('0x31')]=_['differenceBy'](_[_0x1db2('0x2b')](_0x7c131e,_0x1db2('0x28')),[_0x1db2('0x28')]);_0x2a53a3[_0x1db2('0x32')]=_[_0x1db2('0x33')](_0xf17cc1[_0x1db2('0x32')]);_0x2a53a3[_0x1db2('0x34')]=_[_0x1db2('0x35')](_0x2a53a3[_0x1db2('0x31')],_0x2a53a3['query']);_0x3e7a1e[_0x1db2('0x36')]=_[_0x1db2('0x35')](_0x2a53a3[_0x1db2('0x31')],qs['fields'](_0xf17cc1['query'][_0x1db2('0x37')]));_0x3e7a1e[_0x1db2('0x36')]=_0x3e7a1e[_0x1db2('0x36')][_0x1db2('0x38')]?_0x3e7a1e[_0x1db2('0x36')]:_0x2a53a3[_0x1db2('0x31')];if(!_0xf17cc1[_0x1db2('0x32')]['hasOwnProperty'](_0x1db2('0x39'))){_0x3e7a1e[_0x1db2('0x1b')]=qs['limit'](_0xf17cc1[_0x1db2('0x32')]['limit']);_0x3e7a1e[_0x1db2('0x1d')]=qs[_0x1db2('0x1d')](_0xf17cc1['query'][_0x1db2('0x1d')]);}_0x3e7a1e['order']=qs[_0x1db2('0x3a')](_0xf17cc1[_0x1db2('0x32')][_0x1db2('0x3a')]);_0x3e7a1e[_0x1db2('0x3b')]=qs[_0x1db2('0x34')](_[_0x1db2('0x3c')](_0xf17cc1[_0x1db2('0x32')],_0x2a53a3[_0x1db2('0x34')]),_0x7c131e);if(_0xf17cc1['query']['filter']){_0x3e7a1e['where']=_[_0x1db2('0x3d')](_0x3e7a1e[_0x1db2('0x3b')],{'$or':_[_0x1db2('0x2b')](_0x7c131e,function(_0x2a3420){if(_0x2a3420[_0x1db2('0x2f')]!==_0x1db2('0x3e')){var _0x506bbd={};_0x506bbd[_0x2a3420['name']]={'$like':'%'+_0xf17cc1[_0x1db2('0x32')][_0x1db2('0x3f')]+'%'};return _0x506bbd;}})});}_0x3e7a1e=_[_0x1db2('0x3d')]({},_0x3e7a1e,_0xf17cc1['options']);var _0x381c42={'where':_0x3e7a1e[_0x1db2('0x3b')]};return db[_0x1db2('0x2c')][_0x1db2('0x1c')](_0x381c42)[_0x1db2('0x24')](function(_0x1dd614){_0x5bd376[_0x1db2('0x1c')]=_0x1dd614;if(_0xf17cc1[_0x1db2('0x32')][_0x1db2('0x40')]){_0x3e7a1e[_0x1db2('0x41')]=[{'all':!![]}];}return db[_0x1db2('0x2c')][_0x1db2('0x42')](_0x3e7a1e);})['then'](function(_0x45e980){_0x5bd376['rows']=_0x45e980;return _0x5bd376;})[_0x1db2('0x24')](respondWithFilteredResult(_0x38ddaf,_0x3e7a1e))['catch'](handleError(_0x38ddaf,null));};exports[_0x1db2('0x43')]=function(_0x4c1079,_0x1c333f){var _0x197a86={'raw':!![],'where':{'id':_0x4c1079[_0x1db2('0x44')]['id']}},_0x4720e7={};_0x4720e7[_0x1db2('0x31')]=_[_0x1db2('0x33')](db[_0x1db2('0x2c')][_0x1db2('0x2d')]);_0x4720e7[_0x1db2('0x32')]=_[_0x1db2('0x33')](_0x4c1079[_0x1db2('0x32')]);_0x4720e7[_0x1db2('0x34')]=_[_0x1db2('0x35')](_0x4720e7[_0x1db2('0x31')],_0x4720e7[_0x1db2('0x32')]);_0x197a86['attributes']=_['intersection'](_0x4720e7[_0x1db2('0x31')],qs['fields'](_0x4c1079[_0x1db2('0x32')][_0x1db2('0x37')]));_0x197a86[_0x1db2('0x36')]=_0x197a86[_0x1db2('0x36')][_0x1db2('0x38')]?_0x197a86[_0x1db2('0x36')]:_0x4720e7[_0x1db2('0x31')];if(_0x4c1079['query'][_0x1db2('0x40')]){_0x197a86[_0x1db2('0x41')]=[{'all':!![]}];}_0x197a86=_[_0x1db2('0x3d')]({},_0x197a86,_0x4c1079['options']);return db[_0x1db2('0x2c')][_0x1db2('0x45')](_0x197a86)[_0x1db2('0x24')](handleEntityNotFound(_0x1c333f,null))[_0x1db2('0x24')](respondWithResult(_0x1c333f,null))['catch'](handleError(_0x1c333f,null));};exports[_0x1db2('0x46')]=function(_0x29e3e9,_0x5a6451){return db[_0x1db2('0x2c')][_0x1db2('0x46')](_0x29e3e9[_0x1db2('0x47')],{})[_0x1db2('0x24')](respondWithResult(_0x5a6451,0xc9))[_0x1db2('0x48')](handleError(_0x5a6451,null));};exports[_0x1db2('0x23')]=function(_0x14fbcf,_0x36dc6c){if(_0x14fbcf['body']['id']){delete _0x14fbcf[_0x1db2('0x47')]['id'];}return db[_0x1db2('0x2c')]['find']({'where':{'id':_0x14fbcf['params']['id']}})[_0x1db2('0x24')](handleEntityNotFound(_0x36dc6c,null))[_0x1db2('0x24')](saveUpdates(_0x14fbcf['body'],null))[_0x1db2('0x24')](respondWithResult(_0x36dc6c,null))['catch'](handleError(_0x36dc6c,null));};exports[_0x1db2('0x25')]=function(_0x278d48,_0x4767d3){return db['VoiceMailMessage']['find']({'where':{'id':_0x278d48[_0x1db2('0x44')]['id']}})[_0x1db2('0x24')](handleEntityNotFound(_0x4767d3,null))[_0x1db2('0x24')](removeEntity(_0x4767d3,null))[_0x1db2('0x48')](handleError(_0x4767d3,null));};exports['download']=function(_0x202ab0,_0x21ed34,_0x3cd7ec){return db[_0x1db2('0x2c')]['find']({'where':{'id':_0x202ab0[_0x1db2('0x44')]['id']},'attributes':['id',_0x1db2('0x49'),_0x1db2('0x4a')]})[_0x1db2('0x24')](handleEntityNotFound(_0x21ed34,null))[_0x1db2('0x24')](function(_0x424233){if(_0x424233){if(!_0x424233[_0x1db2('0x49')]){throw new db['Sequelize'][(_0x1db2('0x4b'))](_0x1db2('0x4c'));}var _0xc1c6fe={'Content-Type':'audio/wav','Content-Disposition':_0x1db2('0x4d')};if(_0x424233[_0x1db2('0x4a')]){_0xc1c6fe[_0x1db2('0x4e')]='attachment;\x20filename=\x22'+_0x424233[_0x1db2('0x4a')]+_0x1db2('0x4f');}_0x21ed34['set'](_0xc1c6fe);return _0x21ed34[_0x1db2('0x29')](new Buffer(_0x424233[_0x1db2('0x49')]));}})[_0x1db2('0x48')](handleError(_0x21ed34,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 14cfdbc..9b7c787 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 _0x53e2=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fd155,_0x340af9){var _0x250e2f=function(_0x3cef99){while(--_0x3cef99){_0x1fd155['push'](_0x1fd155['shift']());}};_0x250e2f(++_0x340af9);}(_0x53e2,0x11f));var _0x253e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e2[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x253e('0x0'));var util=require(_0x253e('0x1'));var logger=require(_0x253e('0x2'))(_0x253e('0x3'));var moment=require(_0x253e('0x4'));var BPromise=require(_0x253e('0x5'));var rp=require(_0x253e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x253e('0x7'));var config=require(_0x253e('0x8'));var attributes=require(_0x253e('0x9'));module[_0x253e('0xa')]=function(_0x1fd622,_0x3d4c4a){return _0x1fd622[_0x253e('0xb')](_0x253e('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x253e('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6297=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2308e7,_0x4037e1){var _0x458c4a=function(_0x598e87){while(--_0x598e87){_0x2308e7['push'](_0x2308e7['shift']());}};_0x458c4a(++_0x4037e1);}(_0x6297,0x11d));var _0x7629=function(_0x1743bb,_0x1d161b){_0x1743bb=_0x1743bb-0x0;var _0x2db451=_0x6297[_0x1743bb];return _0x2db451;};'use strict';var _=require('lodash');var util=require(_0x7629('0x0'));var logger=require(_0x7629('0x1'))(_0x7629('0x2'));var moment=require(_0x7629('0x3'));var BPromise=require(_0x7629('0x4'));var rp=require(_0x7629('0x5'));var fs=require('fs');var path=require(_0x7629('0x6'));var rimraf=require(_0x7629('0x7'));var config=require(_0x7629('0x8'));var attributes=require(_0x7629('0x9'));module[_0x7629('0xa')]=function(_0x3d886f,_0x19c42a){return _0x3d886f[_0x7629('0xb')](_0x7629('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x7629('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 17dda7f..6c1ae7a 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 _0x2534=['ioredis','../../mysqldb','../../config/utils','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1740ae,_0x5889d2){var _0x2eddc6=function(_0x228c0f){while(--_0x228c0f){_0x1740ae['push'](_0x1740ae['shift']());}};_0x2eddc6(++_0x5889d2);}(_0x2534,0x84));var _0x4253=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x2534[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var moment=require('moment');var BPromise=require(_0x4253('0x2'));var rs=require(_0x4253('0x3'));var fs=require('fs');var Redis=require(_0x4253('0x4'));var db=require(_0x4253('0x5'))['db'];var utils=require(_0x4253('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4253('0x7')][_0x4253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216e46,_0x1392ca,_0x136a34){return new BPromise(function(_0x2b0685,_0x4dd89c){return client[_0x4253('0x9')](_0x216e46,_0x136a34)['then'](function(_0x1aabba){logger['info'](_0x4253('0xa'),_0x1392ca,_0x4253('0xb'));logger['debug'](_0x4253('0xc'),_0x1392ca,_0x4253('0xb'),JSON['stringify'](_0x1aabba));if(_0x1aabba[_0x4253('0xd')]){if(_0x1aabba[_0x4253('0xd')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1392ca,_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);return _0x4dd89c(_0x1aabba['error'][_0x4253('0xe')]);}logger['error'](_0x4253('0xa'),_0x1392ca,_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);return _0x2b0685(_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x1392ca,_0x4253('0xb'));_0x2b0685(_0x1aabba[_0x4253('0xf')]['message']);}})[_0x4253('0x10')](function(_0x50cc7f){logger[_0x4253('0xd')](_0x4253('0xa'),_0x1392ca,_0x50cc7f);_0x4dd89c(_0x50cc7f);});});} \ No newline at end of file +var _0x6b0e=['http','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6b0e,0x188));var _0xe6b0=function(_0x22ec6e,_0x5b82ac){_0x22ec6e=_0x22ec6e-0x0;var _0x305f3a=_0x6b0e[_0x22ec6e];return _0x305f3a;};'use strict';var _=require('lodash');var util=require(_0xe6b0('0x0'));var moment=require('moment');var BPromise=require(_0xe6b0('0x1'));var rs=require(_0xe6b0('0x2'));var fs=require('fs');var Redis=require(_0xe6b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe6b0('0x4'));var config=require(_0xe6b0('0x5'));var jayson=require(_0xe6b0('0x6'));var client=jayson[_0xe6b0('0x7')][_0xe6b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbac2af,_0xfc0d1c,_0x54bc8d){return new BPromise(function(_0x59a722,_0x3ae631){return client['request'](_0xbac2af,_0x54bc8d)[_0xe6b0('0x9')](function(_0x4b0f9e){logger['info'](_0xe6b0('0xa'),_0xfc0d1c,'request\x20sent');logger[_0xe6b0('0xb')](_0xe6b0('0xc'),_0xfc0d1c,_0xe6b0('0xd'),JSON[_0xe6b0('0xe')](_0x4b0f9e));if(_0x4b0f9e[_0xe6b0('0xf')]){if(_0x4b0f9e['error'][_0xe6b0('0x10')]===0x1f4){logger['error'](_0xe6b0('0xa'),_0xfc0d1c,_0x4b0f9e['error'][_0xe6b0('0x11')]);return _0x3ae631(_0x4b0f9e[_0xe6b0('0xf')][_0xe6b0('0x11')]);}logger['error'](_0xe6b0('0xa'),_0xfc0d1c,_0x4b0f9e['error']['message']);return _0x59a722(_0x4b0f9e['error'][_0xe6b0('0x11')]);}else{logger['info'](_0xe6b0('0xa'),_0xfc0d1c,_0xe6b0('0xd'));_0x59a722(_0x4b0f9e[_0xe6b0('0x12')][_0xe6b0('0x11')]);}})[_0xe6b0('0x13')](function(_0x28df2b){logger[_0xe6b0('0xf')](_0xe6b0('0xa'),_0xfc0d1c,_0x28df2b);_0x3ae631(_0x28df2b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4cb2f8f..f1faa0c 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 _0xc71d=['../../config/environment','get','isAuthenticated','show','/:id/sounds','getSounds','create','post','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ad694,_0x4d9361){var _0x52647b=function(_0x572b2c){while(--_0x572b2c){_0x3ad694['push'](_0x3ad694['shift']());}};_0x52647b(++_0x4d9361);}(_0xc71d,0x160));var _0xdc71=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xc71d[_0x52096b];return _0x2b1cc7;};'use strict';var multer=require(_0xdc71('0x0'));var util=require(_0xdc71('0x1'));var path=require('path');var timeout=require(_0xdc71('0x2'));var express=require(_0xdc71('0x3'));var router=express[_0xdc71('0x4')]();var fs_extra=require(_0xdc71('0x5'));var auth=require(_0xdc71('0x6'));var interaction=require(_0xdc71('0x7'));var config=require(_0xdc71('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xdc71('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc71('0x9')]('/:id',auth[_0xdc71('0xa')](),controller[_0xdc71('0xb')]);router['get'](_0xdc71('0xc'),auth[_0xdc71('0xa')](),controller[_0xdc71('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc71('0xe')]);router[_0xdc71('0xf')]('/:id/sounds',auth[_0xdc71('0xa')](),controller['addSound']);router[_0xdc71('0x10')](_0xdc71('0x11'),auth[_0xdc71('0xa')](),controller[_0xdc71('0x12')]);router[_0xdc71('0x13')]('/:id',auth[_0xdc71('0xa')](),controller[_0xdc71('0x14')]);router[_0xdc71('0x13')](_0xdc71('0x15'),auth['isAuthenticated'](),controller[_0xdc71('0x16')]);module[_0xdc71('0x17')]=router; \ No newline at end of file +var _0x6cb8=['/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','getSounds','post','addSound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cb8,0xae));var _0x86cb=function(_0x40e699,_0x4ed5ee){_0x40e699=_0x40e699-0x0;var _0x3a13a3=_0x6cb8[_0x40e699];return _0x3a13a3;};'use strict';var multer=require(_0x86cb('0x0'));var util=require(_0x86cb('0x1'));var path=require(_0x86cb('0x2'));var timeout=require(_0x86cb('0x3'));var express=require(_0x86cb('0x4'));var router=express[_0x86cb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86cb('0x6'));var controller=require(_0x86cb('0x7'));router[_0x86cb('0x8')]('/',auth[_0x86cb('0x9')](),controller['index']);router[_0x86cb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x86cb('0xa')]);router[_0x86cb('0x8')](_0x86cb('0xb'),auth['isAuthenticated'](),controller[_0x86cb('0xc')]);router['post']('/',auth[_0x86cb('0x9')](),controller['create']);router[_0x86cb('0xd')](_0x86cb('0xb'),auth[_0x86cb('0x9')](),controller[_0x86cb('0xe')]);router['put'](_0x86cb('0xf'),auth[_0x86cb('0x9')](),controller[_0x86cb('0x10')]);router[_0x86cb('0x11')](_0x86cb('0xf'),auth[_0x86cb('0x9')](),controller[_0x86cb('0x12')]);router[_0x86cb('0x11')](_0x86cb('0x13'),auth['isAuthenticated'](),controller[_0x86cb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 755f81e..6fe2f34 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 _0x8b3a=['quietmp3nb','mp3','files','alpha','sequelize','exports','STRING','name','ENUM','custom','mp3nb'];(function(_0x154a2e,_0x185c6e){var _0x3369c4=function(_0x4f918a){while(--_0x4f918a){_0x154a2e['push'](_0x154a2e['shift']());}};_0x3369c4(++_0x185c6e);}(_0x8b3a,0x1f3));var _0xa8b3=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x8b3a[_0x5b13c3];return _0x3d6780;};'use strict';var Sequelize=require(_0xa8b3('0x0'));module[_0xa8b3('0x1')]={'name':{'type':Sequelize[_0xa8b3('0x2')],'allowNull':![],'unique':_0xa8b3('0x3')},'mode':{'type':Sequelize[_0xa8b3('0x4')](_0xa8b3('0x5'),'files',_0xa8b3('0x6'),_0xa8b3('0x7'),'quietmp3',_0xa8b3('0x8')),'allowNull':!![],'defaultValue':_0xa8b3('0x9')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa8b3('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ab3=['name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x15a5c7,_0x1eeb3e){var _0x47a94e=function(_0x3aab1f){while(--_0x3aab1f){_0x15a5c7['push'](_0x15a5c7['shift']());}};_0x47a94e(++_0x1eeb3e);}(_0x5ab3,0x136));var _0x35ab=function(_0x1b81c1,_0x1fd465){_0x1b81c1=_0x1b81c1-0x0;var _0x1f2b20=_0x5ab3[_0x1b81c1];return _0x1f2b20;};'use strict';var Sequelize=require(_0x35ab('0x0'));module[_0x35ab('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x35ab('0x2')},'mode':{'type':Sequelize[_0x35ab('0x3')](_0x35ab('0x4'),_0x35ab('0x5'),_0x35ab('0x6'),_0x35ab('0x7'),'quietmp3',_0x35ab('0x8')),'allowNull':!![],'defaultValue':_0x35ab('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x35ab('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x35ab('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x35ab('0x9')],'allowNull':!![]},'stamp':{'type':_0x35ab('0xa')},'defaultEntry':{'type':Sequelize[_0x35ab('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 4abcb6c..5f433cd 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 _0xeaaa=['symlinkSync','removeSound','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','MusicOnHolds','stack','index','map','VoiceMusicOnHold','rawAttributes','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','find','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','Sound','save_name','converted_format','createdAt','format','%s.%s','basename','extname'];(function(_0x4f74a5,_0x1fd979){var _0x5be8b2=function(_0x3bb233){while(--_0x3bb233){_0x4f74a5['push'](_0x4f74a5['shift']());}};_0x5be8b2(++_0x1fd979);}(_0xeaaa,0x149));var _0xaeaa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xeaaa[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xaeaa('0x0'));var rimraf=require(_0xaeaa('0x1'));var zipdir=require(_0xaeaa('0x2'));var jsonpatch=require(_0xaeaa('0x3'));var rp=require(_0xaeaa('0x4'));var moment=require(_0xaeaa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaeaa('0x6'));var sox=require(_0xaeaa('0x7'));var csv=require(_0xaeaa('0x8'));var ejs=require(_0xaeaa('0x9'));var fs=require('fs');var fs_extra=require(_0xaeaa('0xa'));var _=require(_0xaeaa('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaeaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaeaa('0x8'));var querystring=require(_0xaeaa('0xd'));var Papa=require(_0xaeaa('0xe'));var Redis=require('ioredis');var authService=require(_0xaeaa('0xf'));var qs=require(_0xaeaa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaeaa('0x11'))(_0xaeaa('0x12'));var utils=require(_0xaeaa('0x13'));var config=require(_0xaeaa('0x14'));var licenseUtil=require(_0xaeaa('0x15'));var db=require(_0xaeaa('0x16'))['db'];function respondWithStatusCode(_0x3c06bb,_0x5ccc8d){_0x5ccc8d=_0x5ccc8d||0xcc;return function(_0x4e82d3){if(_0x4e82d3){return _0x3c06bb[_0xaeaa('0x17')](_0x5ccc8d);}return _0x3c06bb[_0xaeaa('0x18')](_0x5ccc8d)['end']();};}function respondWithResult(_0x3df176,_0x4647c6){_0x4647c6=_0x4647c6||0xc8;return function(_0x8bc954){if(_0x8bc954){return _0x3df176[_0xaeaa('0x18')](_0x4647c6)[_0xaeaa('0x19')](_0x8bc954);}};}function respondWithFilteredResult(_0x591ed8,_0x3c3c6a){return function(_0xc1a7ea){if(_0xc1a7ea){var _0x39773d=typeof _0x3c3c6a[_0xaeaa('0x1a')]===_0xaeaa('0x1b')&&typeof _0x3c3c6a[_0xaeaa('0x1c')]===_0xaeaa('0x1b');var _0x233cdd=_0xc1a7ea[_0xaeaa('0x1d')];var _0x2a59ec=_0x39773d?0x0:_0x3c3c6a[_0xaeaa('0x1a')];var _0x3f4908=_0x39773d?_0xc1a7ea[_0xaeaa('0x1d')]:_0x3c3c6a[_0xaeaa('0x1a')]+_0x3c3c6a['limit'];var _0x36f39e;if(_0x3f4908>=_0x233cdd){_0x3f4908=_0x233cdd;_0x36f39e=0xc8;}else{_0x36f39e=0xce;}_0x591ed8[_0xaeaa('0x18')](_0x36f39e);return _0x591ed8[_0xaeaa('0x1e')]('Content-Range',_0x2a59ec+'-'+_0x3f4908+'/'+_0x233cdd)[_0xaeaa('0x19')](_0xc1a7ea);}return null;};}function patchUpdates(_0x499572){return function(_0x1ef51b){try{jsonpatch[_0xaeaa('0x1f')](_0x1ef51b,_0x499572,!![]);}catch(_0x193a36){return BPromise[_0xaeaa('0x20')](_0x193a36);}return _0x1ef51b['save']();};}function saveUpdates(_0x1375c0,_0x3b772c){return function(_0x2011f5){if(_0x2011f5){return _0x2011f5[_0xaeaa('0x21')](_0x1375c0)['then'](function(_0x19c96e){return _0x19c96e;});}return null;};}function removeEntity(_0x4556db,_0x25736a){return function(_0x5547eb){if(_0x5547eb){return _0x5547eb[_0xaeaa('0x22')]()[_0xaeaa('0x23')](function(){var _0xab4f17=_0x5547eb[_0xaeaa('0x24')]({'plain':!![]});var _0x1d1fac=_0xaeaa('0x25');return db['UserProfileResource'][_0xaeaa('0x22')]({'where':{'type':_0x1d1fac,'resourceId':_0xab4f17['id']}})['then'](function(){return _0x5547eb;});})[_0xaeaa('0x23')](function(){_0x4556db[_0xaeaa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273277,_0x2fd303){return function(_0x17805e){if(!_0x17805e){_0x273277[_0xaeaa('0x17')](0x194);}return _0x17805e;};}function handleError(_0x4f5a0e,_0x70152c){_0x70152c=_0x70152c||0x1f4;return function(_0x3dd8c7){logger['error'](_0x3dd8c7[_0xaeaa('0x26')]);if(_0x3dd8c7['name']){delete _0x3dd8c7['name'];}_0x4f5a0e[_0xaeaa('0x18')](_0x70152c)['send'](_0x3dd8c7);};}exports[_0xaeaa('0x27')]=function(_0x43a125,_0x5a98c8){var _0x43907e={},_0x17ebd5={},_0x38644c={'count':0x0,'rows':[]};var _0x5703af=_[_0xaeaa('0x28')](db[_0xaeaa('0x29')][_0xaeaa('0x2a')],function(_0x584263){return{'name':_0x584263['fieldName'],'type':_0x584263['type']['key']};});_0x17ebd5[_0xaeaa('0x2b')]=_[_0xaeaa('0x28')](_0x5703af,_0xaeaa('0x2c'));_0x17ebd5[_0xaeaa('0x2d')]=_[_0xaeaa('0x2e')](_0x43a125[_0xaeaa('0x2d')]);_0x17ebd5[_0xaeaa('0x2f')]=_[_0xaeaa('0x30')](_0x17ebd5['model'],_0x17ebd5[_0xaeaa('0x2d')]);_0x43907e['attributes']=_[_0xaeaa('0x30')](_0x17ebd5[_0xaeaa('0x2b')],qs[_0xaeaa('0x31')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x31')]));_0x43907e[_0xaeaa('0x32')]=_0x43907e[_0xaeaa('0x32')][_0xaeaa('0x33')]?_0x43907e[_0xaeaa('0x32')]:_0x17ebd5[_0xaeaa('0x2b')];if(!_0x43a125['query']['hasOwnProperty'](_0xaeaa('0x34'))){_0x43907e[_0xaeaa('0x1c')]=qs[_0xaeaa('0x1c')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x1c')]);_0x43907e[_0xaeaa('0x1a')]=qs['offset'](_0x43a125[_0xaeaa('0x2d')]['offset']);}_0x43907e[_0xaeaa('0x35')]=qs[_0xaeaa('0x36')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x36')]);delete _0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x36')];_0x43907e[_0xaeaa('0x37')]=qs['filters'](_[_0xaeaa('0x38')](_0x43a125[_0xaeaa('0x2d')],_0x17ebd5['filters']),_0x5703af);if(_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x39')]){_0x43907e[_0xaeaa('0x37')]=_[_0xaeaa('0x3a')](_0x43907e['where'],{'$or':_['map'](_0x5703af,function(_0x259ed7){if(_0x259ed7[_0xaeaa('0x3b')]!==_0xaeaa('0x3c')){var _0x36d1fd={};_0x36d1fd[_0x259ed7[_0xaeaa('0x2c')]]={'$like':'%'+_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x39')]+'%'};return _0x36d1fd;}})});}_0x43907e=_[_0xaeaa('0x3a')]({},_0x43907e,_0x43a125[_0xaeaa('0x3d')]);var _0x345eab={'where':_0x43907e[_0xaeaa('0x37')]};return db[_0xaeaa('0x29')][_0xaeaa('0x1d')](_0x345eab)[_0xaeaa('0x23')](function(_0x13933b){_0x38644c[_0xaeaa('0x1d')]=_0x13933b;if(_0x43a125[_0xaeaa('0x2d')]['includeAll']){_0x43907e[_0xaeaa('0x3e')]=[{'all':!![]}];}return db[_0xaeaa('0x29')][_0xaeaa('0x3f')](_0x43907e);})[_0xaeaa('0x23')](function(_0x454486){_0x38644c[_0xaeaa('0x40')]=_0x454486;return _0x38644c;})['then'](respondWithFilteredResult(_0x5a98c8,_0x43907e))[_0xaeaa('0x41')](handleError(_0x5a98c8,null));};exports[_0xaeaa('0x42')]=function(_0x463b16,_0x18b1dd){var _0x3dfb61={'raw':![],'where':{'id':_0x463b16[_0xaeaa('0x43')]['id']}},_0x30968f={};_0x30968f[_0xaeaa('0x2b')]=_[_0xaeaa('0x2e')](db[_0xaeaa('0x29')][_0xaeaa('0x2a')]);_0x30968f[_0xaeaa('0x2d')]=_[_0xaeaa('0x2e')](_0x463b16[_0xaeaa('0x2d')]);_0x30968f[_0xaeaa('0x2f')]=_['intersection'](_0x30968f[_0xaeaa('0x2b')],_0x30968f[_0xaeaa('0x2d')]);_0x3dfb61[_0xaeaa('0x32')]=_[_0xaeaa('0x30')](_0x30968f[_0xaeaa('0x2b')],qs['fields'](_0x463b16[_0xaeaa('0x2d')]['fields']));_0x3dfb61[_0xaeaa('0x32')]=_0x3dfb61['attributes'][_0xaeaa('0x33')]?_0x3dfb61[_0xaeaa('0x32')]:_0x30968f[_0xaeaa('0x2b')];if(_0x463b16['query'][_0xaeaa('0x44')]){_0x3dfb61[_0xaeaa('0x3e')]=[{'all':!![]}];}_0x3dfb61=_[_0xaeaa('0x3a')]({},_0x3dfb61,_0x463b16[_0xaeaa('0x3d')]);return db[_0xaeaa('0x29')]['find'](_0x3dfb61)[_0xaeaa('0x23')](handleEntityNotFound(_0x18b1dd,null))[_0xaeaa('0x23')](respondWithResult(_0x18b1dd,null))[_0xaeaa('0x41')](handleError(_0x18b1dd,null));};exports[_0xaeaa('0x21')]=function(_0x352d5b,_0x123b4b){if(_0x352d5b[_0xaeaa('0x45')]['id']){delete _0x352d5b['body']['id'];}return db[_0xaeaa('0x29')][_0xaeaa('0x46')]({'where':{'id':_0x352d5b[_0xaeaa('0x43')]['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x123b4b,null))[_0xaeaa('0x23')](saveUpdates(_0x352d5b[_0xaeaa('0x45')],null))[_0xaeaa('0x23')](respondWithResult(_0x123b4b,null))[_0xaeaa('0x41')](handleError(_0x123b4b,null));};exports[_0xaeaa('0x47')]=function(_0x177471,_0x1e579d,_0x5f4055){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x28eb08){if(_0x177471['body'][_0xaeaa('0x4a')]===_0xaeaa('0x4b')){_0x177471[_0xaeaa('0x45')]['directory']=path[_0xaeaa('0x4c')](config[_0xaeaa('0x4d')],_0xaeaa('0x4e'),_0x177471[_0xaeaa('0x45')][_0xaeaa('0x2c')]);}return db[_0xaeaa('0x29')]['create'](_0x177471[_0xaeaa('0x45')],{'transaction':_0x28eb08})[_0xaeaa('0x23')](function(_0x352934){if(_0x177471[_0xaeaa('0x45')][_0xaeaa('0x4a')]==='files'){fs[_0xaeaa('0x4f')](_0x352934[_0xaeaa('0x50')],parseInt(_0xaeaa('0x51'),0x8));}var _0x474731=_0x177471['user'][_0xaeaa('0x24')]({'plain':!![]});if(!_0x474731)throw new Error(_0xaeaa('0x52'));if(_0x474731[_0xaeaa('0x53')]===_0xaeaa('0x54')){var _0xbde79f=_0x352934[_0xaeaa('0x24')]({'plain':!![]});return db[_0xaeaa('0x55')][_0xaeaa('0x46')]({'where':{'name':_0xaeaa('0x25'),'userProfileId':_0x474731[_0xaeaa('0x56')]},'raw':!![]})[_0xaeaa('0x23')](function(_0x4e4ff7){if(_0x4e4ff7&&_0x4e4ff7[_0xaeaa('0x57')]===0x0){return db[_0xaeaa('0x58')][_0xaeaa('0x47')]({'name':_0xbde79f[_0xaeaa('0x2c')],'resourceId':_0xbde79f['id'],'type':_0x4e4ff7['name'],'sectionId':_0x4e4ff7['id']},{})[_0xaeaa('0x23')](function(){return _0x352934;});}else{return _0x352934;}})[_0xaeaa('0x41')](function(_0x2886db){logger['error'](_0xaeaa('0x59'),_0x2886db);});}return _0x352934;});})[_0xaeaa('0x23')](respondWithResult(_0x1e579d,0xc9))[_0xaeaa('0x41')](handleError(_0x1e579d,null));};exports[_0xaeaa('0x22')]=function(_0x1c1115,_0x448572,_0x56712e){var _0x41f83b;return db[_0xaeaa('0x29')]['find']({'where':{'id':_0x1c1115['params']['id']}})[_0xaeaa('0x23')](function(_0x87fa0e){if(_0x87fa0e){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x36677d){return _0x87fa0e[_0xaeaa('0x22')]({'transaction':_0x36677d,'raw':!![]})[_0xaeaa('0x23')](function(_0x2721eb){if(_0x2721eb['directory']){fs[_0xaeaa('0x5a')](_0x2721eb['directory'])[_0xaeaa('0x5b')](function(_0x1cb9c2){fs['unlinkSync'](path[_0xaeaa('0x4c')](_0x2721eb['directory'],_0x1cb9c2));});fs[_0xaeaa('0x5c')](_0x2721eb[_0xaeaa('0x50')]);}return _0x2721eb;});})[_0xaeaa('0x41')](function(_0x437e3d){throw new db[(_0xaeaa('0x5d'))][(_0xaeaa('0x5e'))](_0x437e3d['message']);});}})[_0xaeaa('0x23')](handleEntityNotFound(_0x448572,null))[_0xaeaa('0x23')](removeEntity(_0x448572,null))['catch'](handleError(_0x448572,null));};exports['addSound']=function(_0xdce06a,_0x507596,_0x53ea7a){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x376618){var _0x37f0b9;return db[_0xaeaa('0x29')][_0xaeaa('0x46')]({'where':{'id':_0xdce06a['params']['id']}})[_0xaeaa('0x23')](function(_0x4b5831){if(_0x4b5831){_0x37f0b9=_0x4b5831;return _0x4b5831['addSound'](_0xdce06a['body']['id'],{'transaction':_0x376618});}})[_0xaeaa('0x23')](function(_0x24174b){if(_0x24174b){return db[_0xaeaa('0x5f')]['findOne']({'where':{'id':_0xdce06a[_0xaeaa('0x45')]['id']},'attributes':['id',_0xaeaa('0x2c'),_0xaeaa('0x60'),_0xaeaa('0x61'),_0xaeaa('0x62')],'raw':!![]});}})[_0xaeaa('0x23')](function(_0x396256){if(_0x396256){var _0x2563d2=path[_0xaeaa('0x4c')](config[_0xaeaa('0x4d')],'server/files/sounds/converted',util[_0xaeaa('0x63')](_0xaeaa('0x64'),path[_0xaeaa('0x65')](_0x396256[_0xaeaa('0x60')],path[_0xaeaa('0x66')](_0x396256[_0xaeaa('0x60')])),_0x396256['converted_format']));var _0x11714e=path['join'](config[_0xaeaa('0x4d')],_0xaeaa('0x4e'),_0x37f0b9[_0xaeaa('0x2c')],util[_0xaeaa('0x63')](_0xaeaa('0x64'),_0x396256[_0xaeaa('0x2c')],_0x396256['converted_format']));fs[_0xaeaa('0x67')](_0x2563d2,_0x11714e);return _0x396256;}})[_0xaeaa('0x41')](function(_0x11c41f){throw new db[(_0xaeaa('0x5d'))][(_0xaeaa('0x5e'))](_0x11c41f['message']);});})[_0xaeaa('0x23')](handleEntityNotFound(_0x507596,null))[_0xaeaa('0x23')](respondWithResult(_0x507596,0xc9))[_0xaeaa('0x41')](handleError(_0x507596,null));};exports[_0xaeaa('0x68')]=function(_0x36cc21,_0x410440,_0x21b416){return db['sequelize']['transaction'](function(_0x387c58){var _0x41ab3f;return db[_0xaeaa('0x29')][_0xaeaa('0x69')]({'where':{'id':_0x36cc21[_0xaeaa('0x43')]['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x410440,null))[_0xaeaa('0x23')](function(_0x5847e1){if(_0x5847e1){_0x41ab3f=_0x5847e1;return _0x5847e1[_0xaeaa('0x68')](_0x36cc21['params'][_0xaeaa('0x6a')]);}})[_0xaeaa('0x23')](function(_0x4c8d72){if(_0x4c8d72){return db[_0xaeaa('0x5f')][_0xaeaa('0x69')]({'where':{'id':_0x36cc21[_0xaeaa('0x43')][_0xaeaa('0x6a')]},'attributes':['id',_0xaeaa('0x2c'),'save_name','converted_format',_0xaeaa('0x62')],'raw':!![]});}})[_0xaeaa('0x23')](function(_0x4e7f2a){if(_0x4e7f2a){fs['unlinkSync'](path[_0xaeaa('0x4c')](_0x41ab3f['directory'],util[_0xaeaa('0x63')](_0xaeaa('0x64'),_0x4e7f2a[_0xaeaa('0x2c')],_0x4e7f2a[_0xaeaa('0x61')])));return _0x4e7f2a;}})[_0xaeaa('0x41')](function(_0x5a1fc8){throw new db['Sequelize'][(_0xaeaa('0x5e'))](_0x5a1fc8['message']);});})[_0xaeaa('0x23')](handleEntityNotFound(_0x410440,null))[_0xaeaa('0x23')](respondWithStatusCode(_0x410440,0xcc))[_0xaeaa('0x41')](handleError(_0x410440,null));};exports[_0xaeaa('0x6b')]=function(_0x12bd3f,_0x3f0a3c,_0x43ce57){var _0x255e88={};var _0x35178d={};var _0x49dd09;var _0x4461ed;return db[_0xaeaa('0x29')][_0xaeaa('0x69')]({'where':{'id':_0x12bd3f['params']['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x3f0a3c,null))['then'](function(_0x377edd){if(_0x377edd){_0x49dd09=_0x377edd;_0x35178d['model']=_[_0xaeaa('0x2e')](db['Sound'][_0xaeaa('0x2a')]);_0x35178d['query']=_[_0xaeaa('0x2e')](_0x12bd3f[_0xaeaa('0x2d')]);_0x35178d[_0xaeaa('0x2f')]=_['intersection'](_0x35178d['model'],_0x35178d[_0xaeaa('0x2d')]);_0x255e88[_0xaeaa('0x32')]=_['intersection'](_0x35178d['model'],qs[_0xaeaa('0x31')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x31')]));_0x255e88[_0xaeaa('0x32')]=_0x255e88['attributes'][_0xaeaa('0x33')]?_0x255e88[_0xaeaa('0x32')]:_0x35178d[_0xaeaa('0x2b')];_0x255e88['order']=qs['sort'](_0x12bd3f['query'][_0xaeaa('0x36')]);_0x255e88[_0xaeaa('0x37')]=qs['filters'](_[_0xaeaa('0x38')](_0x12bd3f['query'],_0x35178d[_0xaeaa('0x2f')]));if(_0x12bd3f[_0xaeaa('0x2d')]['filter']){_0x255e88[_0xaeaa('0x37')]=_['merge'](_0x255e88[_0xaeaa('0x37')],{'$or':_[_0xaeaa('0x28')](_0x255e88['attributes'],function(_0x9c0a24){var _0x5596a1={};_0x5596a1[_0x9c0a24]={'$like':'%'+_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x39')]+'%'};return _0x5596a1;})});}_0x255e88=_[_0xaeaa('0x3a')]({},_0x255e88,_0x12bd3f['options']);return _0x49dd09['getSounds'](_0x255e88);}})[_0xaeaa('0x23')](function(_0xdd7cf7){if(_0xdd7cf7){_0x4461ed=_0xdd7cf7[_0xaeaa('0x33')];if(!_0x12bd3f[_0xaeaa('0x2d')]['hasOwnProperty'](_0xaeaa('0x34'))){_0x255e88[_0xaeaa('0x1c')]=qs[_0xaeaa('0x1c')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x1c')]);_0x255e88['offset']=qs[_0xaeaa('0x1a')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x1a')]);}return _0x49dd09[_0xaeaa('0x6b')](_0x255e88);}})[_0xaeaa('0x23')](function(_0x21823e){if(_0x21823e){return _0x21823e?{'count':_0x4461ed,'rows':_0x21823e}:null;}})[_0xaeaa('0x23')](respondWithResult(_0x3f0a3c,null))[_0xaeaa('0x41')](handleError(_0x3f0a3c,null));}; \ No newline at end of file +var _0xca62=['rows','catch','show','params','intersection','length','options','find','body','create','transaction','mode','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','ValidationError','message','addSound','findOne','converted_format','server/files/sounds/converted','format','basename','extname','save_name','symlinkSync','Sequelize','removeSound','id2','createdAt','getSounds','Sound','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','MusicOnHolds','UserProfileResource','error','send','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','includeAll','include','findAll'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xca62,0x16c));var _0x2ca6=function(_0x5c6d11,_0x19fc22){_0x5c6d11=_0x5c6d11-0x0;var _0x36f6cd=_0xca62[_0x5c6d11];return _0x36f6cd;};'use strict';var emlformat=require(_0x2ca6('0x0'));var rimraf=require(_0x2ca6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ca6('0x2'));var rp=require(_0x2ca6('0x3'));var moment=require(_0x2ca6('0x4'));var BPromise=require(_0x2ca6('0x5'));var Mustache=require('mustache');var util=require(_0x2ca6('0x6'));var path=require(_0x2ca6('0x7'));var sox=require('sox');var csv=require(_0x2ca6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ca6('0x9'));var squel=require('squel');var crypto=require(_0x2ca6('0xa'));var jsforce=require(_0x2ca6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ca6('0x8'));var querystring=require(_0x2ca6('0xc'));var Papa=require(_0x2ca6('0xd'));var Redis=require(_0x2ca6('0xe'));var authService=require(_0x2ca6('0xf'));var qs=require(_0x2ca6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca6('0x11'));var logger=require(_0x2ca6('0x12'))('api');var utils=require(_0x2ca6('0x13'));var config=require(_0x2ca6('0x14'));var licenseUtil=require(_0x2ca6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55b5c2,_0x4614eb){_0x4614eb=_0x4614eb||0xcc;return function(_0x2649f1){if(_0x2649f1){return _0x55b5c2['sendStatus'](_0x4614eb);}return _0x55b5c2[_0x2ca6('0x16')](_0x4614eb)['end']();};}function respondWithResult(_0x1f02ea,_0x3b9e8d){_0x3b9e8d=_0x3b9e8d||0xc8;return function(_0x2e98da){if(_0x2e98da){return _0x1f02ea[_0x2ca6('0x16')](_0x3b9e8d)[_0x2ca6('0x17')](_0x2e98da);}};}function respondWithFilteredResult(_0x449194,_0x118fa6){return function(_0x3429a1){if(_0x3429a1){var _0xa068f5=typeof _0x118fa6[_0x2ca6('0x18')]==='undefined'&&typeof _0x118fa6[_0x2ca6('0x19')]===_0x2ca6('0x1a');var _0x345cb6=_0x3429a1[_0x2ca6('0x1b')];var _0x2e5c3e=_0xa068f5?0x0:_0x118fa6[_0x2ca6('0x18')];var _0x2e814c=_0xa068f5?_0x3429a1[_0x2ca6('0x1b')]:_0x118fa6[_0x2ca6('0x18')]+_0x118fa6['limit'];var _0x183291;if(_0x2e814c>=_0x345cb6){_0x2e814c=_0x345cb6;_0x183291=0xc8;}else{_0x183291=0xce;}_0x449194['status'](_0x183291);return _0x449194[_0x2ca6('0x1c')](_0x2ca6('0x1d'),_0x2e5c3e+'-'+_0x2e814c+'/'+_0x345cb6)[_0x2ca6('0x17')](_0x3429a1);}return null;};}function patchUpdates(_0x36c1b6){return function(_0x4115fa){try{jsonpatch[_0x2ca6('0x1e')](_0x4115fa,_0x36c1b6,!![]);}catch(_0x567ce6){return BPromise[_0x2ca6('0x1f')](_0x567ce6);}return _0x4115fa[_0x2ca6('0x20')]();};}function saveUpdates(_0x29da26,_0x23295d){return function(_0x48f773){if(_0x48f773){return _0x48f773['update'](_0x29da26)['then'](function(_0x5bff69){return _0x5bff69;});}return null;};}function removeEntity(_0x156dd2,_0x5bb0b4){return function(_0x4fd066){if(_0x4fd066){return _0x4fd066[_0x2ca6('0x21')]()[_0x2ca6('0x22')](function(){var _0x38fb93=_0x4fd066[_0x2ca6('0x23')]({'plain':!![]});var _0x133533=_0x2ca6('0x24');return db[_0x2ca6('0x25')][_0x2ca6('0x21')]({'where':{'type':_0x133533,'resourceId':_0x38fb93['id']}})[_0x2ca6('0x22')](function(){return _0x4fd066;});})[_0x2ca6('0x22')](function(){_0x156dd2[_0x2ca6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5583bf,_0x7ef139){return function(_0x2e3f7b){if(!_0x2e3f7b){_0x5583bf['sendStatus'](0x194);}return _0x2e3f7b;};}function handleError(_0x4dcd91,_0x5e2e6a){_0x5e2e6a=_0x5e2e6a||0x1f4;return function(_0x212158){logger[_0x2ca6('0x26')](_0x212158['stack']);if(_0x212158['name']){delete _0x212158['name'];}_0x4dcd91[_0x2ca6('0x16')](_0x5e2e6a)[_0x2ca6('0x27')](_0x212158);};}exports['index']=function(_0xed0660,_0x1dd7c2){var _0x17fbd9={},_0x55b8dc={},_0x5db15d={'count':0x0,'rows':[]};var _0x562320=_[_0x2ca6('0x28')](db[_0x2ca6('0x29')][_0x2ca6('0x2a')],function(_0x2c1c3e){return{'name':_0x2c1c3e[_0x2ca6('0x2b')],'type':_0x2c1c3e['type'][_0x2ca6('0x2c')]};});_0x55b8dc[_0x2ca6('0x2d')]=_['map'](_0x562320,'name');_0x55b8dc[_0x2ca6('0x2e')]=_[_0x2ca6('0x2f')](_0xed0660[_0x2ca6('0x2e')]);_0x55b8dc[_0x2ca6('0x30')]=_['intersection'](_0x55b8dc[_0x2ca6('0x2d')],_0x55b8dc[_0x2ca6('0x2e')]);_0x17fbd9[_0x2ca6('0x31')]=_['intersection'](_0x55b8dc[_0x2ca6('0x2d')],qs[_0x2ca6('0x32')](_0xed0660[_0x2ca6('0x2e')]['fields']));_0x17fbd9[_0x2ca6('0x31')]=_0x17fbd9[_0x2ca6('0x31')]['length']?_0x17fbd9['attributes']:_0x55b8dc[_0x2ca6('0x2d')];if(!_0xed0660[_0x2ca6('0x2e')]['hasOwnProperty'](_0x2ca6('0x33'))){_0x17fbd9['limit']=qs[_0x2ca6('0x19')](_0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x19')]);_0x17fbd9[_0x2ca6('0x18')]=qs['offset'](_0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x18')]);}_0x17fbd9[_0x2ca6('0x34')]=qs['sort'](_0xed0660['query'][_0x2ca6('0x35')]);delete _0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x35')];_0x17fbd9[_0x2ca6('0x36')]=qs[_0x2ca6('0x30')](_[_0x2ca6('0x37')](_0xed0660[_0x2ca6('0x2e')],_0x55b8dc[_0x2ca6('0x30')]),_0x562320);if(_0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x38')]){_0x17fbd9[_0x2ca6('0x36')]=_['merge'](_0x17fbd9[_0x2ca6('0x36')],{'$or':_[_0x2ca6('0x28')](_0x562320,function(_0xa8fc43){if(_0xa8fc43[_0x2ca6('0x39')]!==_0x2ca6('0x3a')){var _0x70789b={};_0x70789b[_0xa8fc43[_0x2ca6('0x3b')]]={'$like':'%'+_0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x38')]+'%'};return _0x70789b;}})});}_0x17fbd9=_[_0x2ca6('0x3c')]({},_0x17fbd9,_0xed0660['options']);var _0x26958f={'where':_0x17fbd9[_0x2ca6('0x36')]};return db[_0x2ca6('0x29')][_0x2ca6('0x1b')](_0x26958f)[_0x2ca6('0x22')](function(_0x36f8cc){_0x5db15d[_0x2ca6('0x1b')]=_0x36f8cc;if(_0xed0660[_0x2ca6('0x2e')][_0x2ca6('0x3d')]){_0x17fbd9[_0x2ca6('0x3e')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x2ca6('0x3f')](_0x17fbd9);})[_0x2ca6('0x22')](function(_0x2a539d){_0x5db15d[_0x2ca6('0x40')]=_0x2a539d;return _0x5db15d;})[_0x2ca6('0x22')](respondWithFilteredResult(_0x1dd7c2,_0x17fbd9))[_0x2ca6('0x41')](handleError(_0x1dd7c2,null));};exports[_0x2ca6('0x42')]=function(_0x38ef3d,_0x5802ad){var _0xee32f9={'raw':![],'where':{'id':_0x38ef3d[_0x2ca6('0x43')]['id']}},_0x507fe1={};_0x507fe1['model']=_[_0x2ca6('0x2f')](db[_0x2ca6('0x29')][_0x2ca6('0x2a')]);_0x507fe1['query']=_[_0x2ca6('0x2f')](_0x38ef3d[_0x2ca6('0x2e')]);_0x507fe1[_0x2ca6('0x30')]=_[_0x2ca6('0x44')](_0x507fe1['model'],_0x507fe1['query']);_0xee32f9[_0x2ca6('0x31')]=_[_0x2ca6('0x44')](_0x507fe1[_0x2ca6('0x2d')],qs['fields'](_0x38ef3d[_0x2ca6('0x2e')][_0x2ca6('0x32')]));_0xee32f9[_0x2ca6('0x31')]=_0xee32f9['attributes'][_0x2ca6('0x45')]?_0xee32f9[_0x2ca6('0x31')]:_0x507fe1[_0x2ca6('0x2d')];if(_0x38ef3d['query'][_0x2ca6('0x3d')]){_0xee32f9[_0x2ca6('0x3e')]=[{'all':!![]}];}_0xee32f9=_['merge']({},_0xee32f9,_0x38ef3d[_0x2ca6('0x46')]);return db[_0x2ca6('0x29')][_0x2ca6('0x47')](_0xee32f9)[_0x2ca6('0x22')](handleEntityNotFound(_0x5802ad,null))['then'](respondWithResult(_0x5802ad,null))['catch'](handleError(_0x5802ad,null));};exports['update']=function(_0x408344,_0x30ff49){if(_0x408344['body']['id']){delete _0x408344[_0x2ca6('0x48')]['id'];}return db[_0x2ca6('0x29')]['find']({'where':{'id':_0x408344[_0x2ca6('0x43')]['id']}})[_0x2ca6('0x22')](handleEntityNotFound(_0x30ff49,null))[_0x2ca6('0x22')](saveUpdates(_0x408344[_0x2ca6('0x48')],null))['then'](respondWithResult(_0x30ff49,null))[_0x2ca6('0x41')](handleError(_0x30ff49,null));};exports[_0x2ca6('0x49')]=function(_0x56f02d,_0x475709,_0xc015b){return db['sequelize'][_0x2ca6('0x4a')](function(_0x3ad8a2){if(_0x56f02d['body'][_0x2ca6('0x4b')]==='files'){_0x56f02d[_0x2ca6('0x48')][_0x2ca6('0x4c')]=path[_0x2ca6('0x4d')](config[_0x2ca6('0x4e')],_0x2ca6('0x4f'),_0x56f02d[_0x2ca6('0x48')]['name']);}return db[_0x2ca6('0x29')]['create'](_0x56f02d[_0x2ca6('0x48')],{'transaction':_0x3ad8a2})['then'](function(_0x266068){if(_0x56f02d[_0x2ca6('0x48')][_0x2ca6('0x4b')]==='files'){fs['mkdirSync'](_0x266068[_0x2ca6('0x4c')],parseInt(_0x2ca6('0x50'),0x8));}var _0x550012=_0x56f02d[_0x2ca6('0x51')][_0x2ca6('0x23')]({'plain':!![]});if(!_0x550012)throw new Error(_0x2ca6('0x52'));if(_0x550012['role']===_0x2ca6('0x51')){var _0x4741e2=_0x266068['get']({'plain':!![]});return db['UserProfileSection'][_0x2ca6('0x47')]({'where':{'name':_0x2ca6('0x24'),'userProfileId':_0x550012[_0x2ca6('0x53')]},'raw':!![]})[_0x2ca6('0x22')](function(_0x42f5bb){if(_0x42f5bb&&_0x42f5bb[_0x2ca6('0x54')]===0x0){return db[_0x2ca6('0x25')][_0x2ca6('0x49')]({'name':_0x4741e2[_0x2ca6('0x3b')],'resourceId':_0x4741e2['id'],'type':_0x42f5bb['name'],'sectionId':_0x42f5bb['id']},{})['then'](function(){return _0x266068;});}else{return _0x266068;}})[_0x2ca6('0x41')](function(_0x15ba7c){logger[_0x2ca6('0x26')](_0x2ca6('0x55'),_0x15ba7c);});}return _0x266068;});})[_0x2ca6('0x22')](respondWithResult(_0x475709,0xc9))[_0x2ca6('0x41')](handleError(_0x475709,null));};exports['destroy']=function(_0x172abe,_0x2b6996,_0x4add4d){var _0x593747;return db[_0x2ca6('0x29')][_0x2ca6('0x47')]({'where':{'id':_0x172abe['params']['id']}})['then'](function(_0x4515fb){if(_0x4515fb){return db[_0x2ca6('0x56')]['transaction'](function(_0x5c157d){return _0x4515fb['destroy']({'transaction':_0x5c157d,'raw':!![]})[_0x2ca6('0x22')](function(_0x187171){if(_0x187171[_0x2ca6('0x4c')]){fs['readdirSync'](_0x187171[_0x2ca6('0x4c')])[_0x2ca6('0x57')](function(_0xf188c6){fs[_0x2ca6('0x58')](path[_0x2ca6('0x4d')](_0x187171[_0x2ca6('0x4c')],_0xf188c6));});fs['rmdirSync'](_0x187171[_0x2ca6('0x4c')]);}return _0x187171;});})['catch'](function(_0xbf43fc){throw new db['Sequelize'][(_0x2ca6('0x59'))](_0xbf43fc[_0x2ca6('0x5a')]);});}})[_0x2ca6('0x22')](handleEntityNotFound(_0x2b6996,null))[_0x2ca6('0x22')](removeEntity(_0x2b6996,null))[_0x2ca6('0x41')](handleError(_0x2b6996,null));};exports[_0x2ca6('0x5b')]=function(_0x7956,_0x4a1396,_0x4fc9e0){return db[_0x2ca6('0x56')][_0x2ca6('0x4a')](function(_0x28bbc0){var _0x4c5819;return db[_0x2ca6('0x29')][_0x2ca6('0x47')]({'where':{'id':_0x7956[_0x2ca6('0x43')]['id']}})[_0x2ca6('0x22')](function(_0x4d28b6){if(_0x4d28b6){_0x4c5819=_0x4d28b6;return _0x4d28b6['addSound'](_0x7956[_0x2ca6('0x48')]['id'],{'transaction':_0x28bbc0});}})[_0x2ca6('0x22')](function(_0x27729e){if(_0x27729e){return db['Sound'][_0x2ca6('0x5c')]({'where':{'id':_0x7956['body']['id']},'attributes':['id',_0x2ca6('0x3b'),'save_name',_0x2ca6('0x5d'),'createdAt'],'raw':!![]});}})['then'](function(_0x479ed7){if(_0x479ed7){var _0xfd2f78=path['join'](config[_0x2ca6('0x4e')],_0x2ca6('0x5e'),util[_0x2ca6('0x5f')]('%s.%s',path[_0x2ca6('0x60')](_0x479ed7['save_name'],path[_0x2ca6('0x61')](_0x479ed7[_0x2ca6('0x62')])),_0x479ed7['converted_format']));var _0x5ef52f=path[_0x2ca6('0x4d')](config[_0x2ca6('0x4e')],_0x2ca6('0x4f'),_0x4c5819[_0x2ca6('0x3b')],util[_0x2ca6('0x5f')]('%s.%s',_0x479ed7[_0x2ca6('0x3b')],_0x479ed7[_0x2ca6('0x5d')]));fs[_0x2ca6('0x63')](_0xfd2f78,_0x5ef52f);return _0x479ed7;}})[_0x2ca6('0x41')](function(_0x4d5297){throw new db[(_0x2ca6('0x64'))]['ValidationError'](_0x4d5297[_0x2ca6('0x5a')]);});})[_0x2ca6('0x22')](handleEntityNotFound(_0x4a1396,null))[_0x2ca6('0x22')](respondWithResult(_0x4a1396,0xc9))[_0x2ca6('0x41')](handleError(_0x4a1396,null));};exports[_0x2ca6('0x65')]=function(_0x121cb7,_0x259da6,_0x470b27){return db['sequelize']['transaction'](function(_0x5431f5){var _0x143d70;return db[_0x2ca6('0x29')][_0x2ca6('0x5c')]({'where':{'id':_0x121cb7[_0x2ca6('0x43')]['id']}})['then'](handleEntityNotFound(_0x259da6,null))['then'](function(_0x439a2a){if(_0x439a2a){_0x143d70=_0x439a2a;return _0x439a2a[_0x2ca6('0x65')](_0x121cb7[_0x2ca6('0x43')][_0x2ca6('0x66')]);}})[_0x2ca6('0x22')](function(_0x2bb2c5){if(_0x2bb2c5){return db['Sound']['findOne']({'where':{'id':_0x121cb7[_0x2ca6('0x43')]['id2']},'attributes':['id',_0x2ca6('0x3b'),_0x2ca6('0x62'),_0x2ca6('0x5d'),_0x2ca6('0x67')],'raw':!![]});}})[_0x2ca6('0x22')](function(_0x2928e2){if(_0x2928e2){fs[_0x2ca6('0x58')](path[_0x2ca6('0x4d')](_0x143d70['directory'],util[_0x2ca6('0x5f')]('%s.%s',_0x2928e2[_0x2ca6('0x3b')],_0x2928e2[_0x2ca6('0x5d')])));return _0x2928e2;}})[_0x2ca6('0x41')](function(_0x32780a){throw new db[(_0x2ca6('0x64'))][(_0x2ca6('0x59'))](_0x32780a['message']);});})[_0x2ca6('0x22')](handleEntityNotFound(_0x259da6,null))['then'](respondWithStatusCode(_0x259da6,0xcc))[_0x2ca6('0x41')](handleError(_0x259da6,null));};exports[_0x2ca6('0x68')]=function(_0x20f931,_0x1d3b4b,_0x29fc52){var _0x4d3a1f={};var _0x534e16={};var _0x1f35c9;var _0x37f46d;return db[_0x2ca6('0x29')]['findOne']({'where':{'id':_0x20f931['params']['id']}})['then'](handleEntityNotFound(_0x1d3b4b,null))[_0x2ca6('0x22')](function(_0x405be4){if(_0x405be4){_0x1f35c9=_0x405be4;_0x534e16[_0x2ca6('0x2d')]=_['keys'](db[_0x2ca6('0x69')][_0x2ca6('0x2a')]);_0x534e16[_0x2ca6('0x2e')]=_['keys'](_0x20f931[_0x2ca6('0x2e')]);_0x534e16['filters']=_[_0x2ca6('0x44')](_0x534e16[_0x2ca6('0x2d')],_0x534e16[_0x2ca6('0x2e')]);_0x4d3a1f['attributes']=_[_0x2ca6('0x44')](_0x534e16[_0x2ca6('0x2d')],qs[_0x2ca6('0x32')](_0x20f931['query'][_0x2ca6('0x32')]));_0x4d3a1f[_0x2ca6('0x31')]=_0x4d3a1f[_0x2ca6('0x31')][_0x2ca6('0x45')]?_0x4d3a1f[_0x2ca6('0x31')]:_0x534e16[_0x2ca6('0x2d')];_0x4d3a1f[_0x2ca6('0x34')]=qs[_0x2ca6('0x35')](_0x20f931[_0x2ca6('0x2e')][_0x2ca6('0x35')]);_0x4d3a1f['where']=qs[_0x2ca6('0x30')](_[_0x2ca6('0x37')](_0x20f931[_0x2ca6('0x2e')],_0x534e16[_0x2ca6('0x30')]));if(_0x20f931['query'][_0x2ca6('0x38')]){_0x4d3a1f['where']=_[_0x2ca6('0x3c')](_0x4d3a1f[_0x2ca6('0x36')],{'$or':_[_0x2ca6('0x28')](_0x4d3a1f[_0x2ca6('0x31')],function(_0x5a9322){var _0x5c9a89={};_0x5c9a89[_0x5a9322]={'$like':'%'+_0x20f931[_0x2ca6('0x2e')][_0x2ca6('0x38')]+'%'};return _0x5c9a89;})});}_0x4d3a1f=_['merge']({},_0x4d3a1f,_0x20f931['options']);return _0x1f35c9[_0x2ca6('0x68')](_0x4d3a1f);}})[_0x2ca6('0x22')](function(_0x4d221c){if(_0x4d221c){_0x37f46d=_0x4d221c[_0x2ca6('0x45')];if(!_0x20f931[_0x2ca6('0x2e')][_0x2ca6('0x6a')]('nolimit')){_0x4d3a1f[_0x2ca6('0x19')]=qs[_0x2ca6('0x19')](_0x20f931[_0x2ca6('0x2e')][_0x2ca6('0x19')]);_0x4d3a1f[_0x2ca6('0x18')]=qs['offset'](_0x20f931[_0x2ca6('0x2e')][_0x2ca6('0x18')]);}return _0x1f35c9[_0x2ca6('0x68')](_0x4d3a1f);}})[_0x2ca6('0x22')](function(_0x2a9ef7){if(_0x2a9ef7){return _0x2a9ef7?{'count':_0x37f46d,'rows':_0x2a9ef7}:null;}})[_0x2ca6('0x22')](respondWithResult(_0x1d3b4b,null))['catch'](handleError(_0x1d3b4b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7684afb..49b4e13 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 _0x7f70=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x405d5b,_0x3c8a7a){var _0x4922dc=function(_0xd73c10){while(--_0xd73c10){_0x405d5b['push'](_0x405d5b['shift']());}};_0x4922dc(++_0x3c8a7a);}(_0x7f70,0x11d));var _0x07f7=function(_0x2741a3,_0x4792d3){_0x2741a3=_0x2741a3-0x0;var _0x31e9ac=_0x7f70[_0x2741a3];return _0x31e9ac;};'use strict';var _=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var logger=require(_0x07f7('0x2'))('api');var moment=require(_0x07f7('0x3'));var BPromise=require(_0x07f7('0x4'));var rp=require(_0x07f7('0x5'));var fs=require('fs');var path=require(_0x07f7('0x6'));var rimraf=require(_0x07f7('0x7'));var config=require(_0x07f7('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x07f7('0x9')]=function(_0x36c679,_0x2660a9){return _0x36c679[_0x07f7('0xa')](_0x07f7('0xb'),attributes,{'tableName':_0x07f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10a4=['define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x19228b,_0x4cca2c){var _0x3bb354=function(_0x3c0cc9){while(--_0x3c0cc9){_0x19228b['push'](_0x19228b['shift']());}};_0x3bb354(++_0x4cca2c);}(_0x10a4,0x10b));var _0x410a=function(_0x234051,_0xcc582f){_0x234051=_0x234051-0x0;var _0x24e238=_0x10a4[_0x234051];return _0x24e238;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x410a('0x0'))(_0x410a('0x1'));var moment=require(_0x410a('0x2'));var BPromise=require(_0x410a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x410a('0x4'));var rimraf=require(_0x410a('0x5'));var config=require(_0x410a('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x410a('0x7')]=function(_0x5a8617,_0x2f478d){return _0x5a8617[_0x410a('0x8')](_0x410a('0x9'),attributes,{'tableName':_0x410a('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 0a2fd4b..d54ec3c 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x454024,_0x1bf2fc){var _0x33f072=function(_0x5fa315){while(--_0x5fa315){_0x454024['push'](_0x454024['shift']());}};_0x33f072(++_0x1bf2fc);}(_0x34e8,0x12c));var _0x834e=function(_0x554cce,_0x4b35a4){_0x554cce=_0x554cce-0x0;var _0x846906=_0x34e8[_0x554cce];return _0x846906;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _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(_0x50d1da,_0x5cb3ed){var _0x109fc1=function(_0x41a3f8){while(--_0x41a3f8){_0x50d1da['push'](_0x50d1da['shift']());}};_0x109fc1(++_0x5cb3ed);}(_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 ae870a5..da5d3a8 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 _0x0298=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','destroy','delete','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5426d5,_0x2516e3){var _0xc70f20=function(_0x137027){while(--_0x137027){_0x5426d5['push'](_0x5426d5['shift']());}};_0xc70f20(++_0x2516e3);}(_0x0298,0x95));var _0x8029=function(_0x4c5de1,_0x31e913){_0x4c5de1=_0x4c5de1-0x0;var _0x10114a=_0x0298[_0x4c5de1];return _0x10114a;};'use strict';var multer=require(_0x8029('0x0'));var util=require('util');var path=require(_0x8029('0x1'));var timeout=require(_0x8029('0x2'));var express=require(_0x8029('0x3'));var router=express[_0x8029('0x4')]();var fs_extra=require(_0x8029('0x5'));var auth=require(_0x8029('0x6'));var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router['get']('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router['get'](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0xd')]);router[_0x8029('0xe')](_0x8029('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8029('0xe')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['getAgents']);router['get'](_0x8029('0x11'),auth[_0x8029('0xa')](),controller['getTeams']);router[_0x8029('0x12')]('/',auth['isAuthenticated'](),controller[_0x8029('0x13')]);router[_0x8029('0x12')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller[_0x8029('0x14')]);router[_0x8029('0x12')]('/:id/teams',auth[_0x8029('0xa')](),controller[_0x8029('0x15')]);router[_0x8029('0x16')](_0x8029('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8029('0xf'),auth[_0x8029('0xa')](),controller[_0x8029('0x17')]);router[_0x8029('0x18')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['removeAgents']);router[_0x8029('0x18')](_0x8029('0x11'),auth[_0x8029('0xa')](),controller[_0x8029('0x19')]);module['exports']=router; \ No newline at end of file +var _0x5c58=['getTeams','post','create','addAgents','/:id/teams','addTeams','delete','removeAgents','removeTeams','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/users','getAgents'];(function(_0x5b754d,_0x5192ff){var _0x423e2e=function(_0x115138){while(--_0x115138){_0x5b754d['push'](_0x5b754d['shift']());}};_0x423e2e(++_0x5192ff);}(_0x5c58,0x154));var _0x85c5=function(_0x21f33c,_0x150610){_0x21f33c=_0x21f33c-0x0;var _0xc255b5=_0x5c58[_0x21f33c];return _0xc255b5;};'use strict';var multer=require('multer');var util=require(_0x85c5('0x0'));var path=require(_0x85c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85c5('0x2')]();var fs_extra=require(_0x85c5('0x3'));var auth=require(_0x85c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85c5('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x85c5('0x6')](),controller['index']);router[_0x85c5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x85c5('0x7')](_0x85c5('0x8'),auth['isAuthenticated'](),controller[_0x85c5('0x9')]);router['get'](_0x85c5('0xa'),auth[_0x85c5('0x6')](),controller[_0x85c5('0xb')]);router[_0x85c5('0x7')]('/:id/teams',auth[_0x85c5('0x6')](),controller[_0x85c5('0xc')]);router[_0x85c5('0xd')]('/',auth[_0x85c5('0x6')](),controller[_0x85c5('0xe')]);router['post'](_0x85c5('0xa'),auth[_0x85c5('0x6')](),controller[_0x85c5('0xf')]);router[_0x85c5('0xd')](_0x85c5('0x10'),auth['isAuthenticated'](),controller[_0x85c5('0x11')]);router['put'](_0x85c5('0x8'),auth[_0x85c5('0x6')](),controller['update']);router[_0x85c5('0x12')](_0x85c5('0x8'),auth['isAuthenticated'](),controller['destroy']);router[_0x85c5('0x12')]('/:id/users',auth[_0x85c5('0x6')](),controller[_0x85c5('0x13')]);router[_0x85c5('0x12')](_0x85c5('0x10'),auth['isAuthenticated'](),controller[_0x85c5('0x14')]);module[_0x85c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4f27bc5..19c04bb 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 _0x18e4=['sequelize','exports','STRING','name'];(function(_0x516e19,_0x592a77){var _0x46855e=function(_0x5df0c3){while(--_0x5df0c3){_0x516e19['push'](_0x516e19['shift']());}};_0x46855e(++_0x592a77);}(_0x18e4,0x140));var _0x418e=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x18e4[_0x4d8666];return _0x37175b;};'use strict';var Sequelize=require(_0x418e('0x0'));module[_0x418e('0x1')]={'name':{'type':Sequelize[_0x418e('0x2')],'allowNull':![],'unique':_0x418e('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x466ce3){return'system-'+this['getDataValue'](_0x418e('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x418e('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x90b6=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x90b6,0x17e));var _0x690b=function(_0x379a4d,_0x4d3593){_0x379a4d=_0x379a4d-0x0;var _0x50531a=_0x90b6[_0x379a4d];return _0x50531a;};'use strict';var Sequelize=require(_0x690b('0x0'));module[_0x690b('0x1')]={'name':{'type':Sequelize[_0x690b('0x2')],'allowNull':![],'unique':_0x690b('0x3')},'prefix':{'type':Sequelize[_0x690b('0x4')],'get':function(_0x427c3d){return _0x690b('0x5')+this[_0x690b('0x6')](_0x690b('0x3'))+'-';}},'description':{'type':Sequelize[_0x690b('0x2')]},'callerIdAll':{'type':Sequelize[_0x690b('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x690b('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index d25ccb3..d039990 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 _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0x4991,0xf7));var _0x1499=function(_0x32e97b,_0x173b20){_0x32e97b=_0x32e97b-0x0;var _0x30132d=_0x4991[_0x32e97b];return _0x30132d;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file +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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xda2d,0x102));var _0xdda2=function(_0x6e5053,_0x48b8ed){_0x6e5053=_0x6e5053-0x0;var _0x11d345=_0xda2d[_0x6e5053];return _0x11d345;};'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 diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 43b9e0c..ee3a90e 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 _0x60f1=['emit','hook','exports','events','VoicePrefix','save','update','remove'];(function(_0x1872b9,_0x32d5b8){var _0x2a2eb6=function(_0x1bbc58){while(--_0x1bbc58){_0x1872b9['push'](_0x1872b9['shift']());}};_0x2a2eb6(++_0x32d5b8);}(_0x60f1,0x6b));var _0x160f=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0x60f1[_0x3a2deb];return _0x203ab0;};'use strict';var EventEmitter=require(_0x160f('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x160f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x160f('0x2'),'afterUpdate':_0x160f('0x3'),'afterDestroy':_0x160f('0x4')};function emitEvent(_0x53af72){return function(_0x25df29,_0x1f7d8c,_0x15cb0c){VoicePrefixEvents[_0x160f('0x5')](_0x53af72+':'+_0x25df29['id'],_0x25df29);VoicePrefixEvents[_0x160f('0x5')](_0x53af72,_0x25df29);_0x15cb0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x160f('0x6')](e,emitEvent(event));}}module[_0x160f('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xe2d9=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x49dcfb,_0x2d2c5e){var _0x512245=function(_0x5358c5){while(--_0x5358c5){_0x49dcfb['push'](_0x49dcfb['shift']());}};_0x512245(++_0x2d2c5e);}(_0xe2d9,0xa5));var _0x9e2d=function(_0x4d9af2,_0x4fb0ec){_0x4d9af2=_0x4d9af2-0x0;var _0x43319b=_0xe2d9[_0x4d9af2];return _0x43319b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9e2d('0x0'))['db'][_0x9e2d('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9e2d('0x2')](0x0);var events={'afterCreate':_0x9e2d('0x3'),'afterUpdate':_0x9e2d('0x4'),'afterDestroy':_0x9e2d('0x5')};function emitEvent(_0x37bf20){return function(_0x4088d7,_0x1f9990,_0x215de6){VoicePrefixEvents[_0x9e2d('0x6')](_0x37bf20+':'+_0x4088d7['id'],_0x4088d7);VoicePrefixEvents[_0x9e2d('0x6')](_0x37bf20,_0x4088d7);_0x215de6(null);};}for(var e in events){if(events[_0x9e2d('0x7')](e)){var event=events[e];VoicePrefix[_0x9e2d('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d8a4641..91f5dbb 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 _0xf903=['define','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0xf903,0x12b));var _0x3f90=function(_0x548c1d,_0x4e6a09){_0x548c1d=_0x548c1d-0x0;var _0x21ce9f=_0xf903[_0x548c1d];return _0x21ce9f;};'use strict';var _=require(_0x3f90('0x0'));var util=require(_0x3f90('0x1'));var logger=require(_0x3f90('0x2'))('api');var moment=require(_0x3f90('0x3'));var BPromise=require(_0x3f90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f90('0x5'));var rimraf=require('rimraf');var config=require(_0x3f90('0x6'));var attributes=require(_0x3f90('0x7'));module[_0x3f90('0x8')]=function(_0x4f9510,_0x5f00b3){return _0x4f9510[_0x3f90('0x9')]('VoicePrefix',attributes,{'tableName':_0x3f90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad71=['exports','voice_prefixes','util','api','moment','bluebird'];(function(_0x55a24c,_0x4f331d){var _0x495763=function(_0x3c41c1){while(--_0x3c41c1){_0x55a24c['push'](_0x55a24c['shift']());}};_0x495763(++_0x4f331d);}(_0xad71,0x1ee));var _0x1ad7=function(_0x4efed9,_0x1aa12a){_0x4efed9=_0x4efed9-0x0;var _0x3635c5=_0xad71[_0x4efed9];return _0x3635c5;};'use strict';var _=require('lodash');var util=require(_0x1ad7('0x0'));var logger=require('../../config/logger')(_0x1ad7('0x1'));var moment=require(_0x1ad7('0x2'));var BPromise=require(_0x1ad7('0x3'));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('./voicePrefix.attributes');module[_0x1ad7('0x4')]=function(_0x48e2b1,_0x5961e0){return _0x48e2b1['define']('VoicePrefix',attributes,{'tableName':_0x1ad7('0x5'),'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 ea27be4..7af6ac1 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 _0x81c6=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x81c6,0x1d5));var _0x681c=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0x81c6[_0x21dd50];return _0x1b7d5e;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});config[_0x681c('0x8')]=_[_0x681c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0xa'))(new Redis(config[_0x681c('0x8')]));require(_0x681c('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f0228,_0x3e3770,_0x4ff60b){return new BPromise(function(_0x82b6ad,_0x83927a){return client[_0x681c('0xc')](_0x4f0228,_0x4ff60b)[_0x681c('0xd')](function(_0x48dc05){logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));logger[_0x681c('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3e3770,_0x681c('0xf'),JSON['stringify'](_0x48dc05));if(_0x48dc05[_0x681c('0x11')]){if(_0x48dc05['error'][_0x681c('0x12')]===0x1f4){logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x83927a(_0x48dc05[_0x681c('0x11')]['message']);}logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x82b6ad(_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);}else{logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));_0x82b6ad(_0x48dc05[_0x681c('0x14')][_0x681c('0x13')]);}})['catch'](function(_0x22e608){logger[_0x681c('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3e3770,_0x22e608);_0x83927a(_0x22e608);});});} \ No newline at end of file +var _0xea4e=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug'];(function(_0xf29686,_0x1e73df){var _0x288c09=function(_0x40eff2){while(--_0x40eff2){_0xf29686['push'](_0xf29686['shift']());}};_0x288c09(++_0x1e73df);}(_0xea4e,0x10c));var _0xeea4=function(_0x21331a,_0x57fc48){_0x21331a=_0x21331a-0x0;var _0x325c55=_0xea4e[_0x21331a];return _0x325c55;};'use strict';var _=require(_0xeea4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeea4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeea4('0x2'))['db'];var utils=require(_0xeea4('0x3'));var logger=require('../../config/logger')(_0xeea4('0x4'));var config=require(_0xeea4('0x5'));var jayson=require(_0xeea4('0x6'));var client=jayson[_0xeea4('0x7')][_0xeea4('0x8')]({'port':0x232a});config[_0xeea4('0x9')]=_[_0xeea4('0xa')](config[_0xeea4('0x9')],{'host':_0xeea4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeea4('0x9')]));require('./voicePrefix.socket')[_0xeea4('0xc')](socket);function respondWithRpcPromise(_0x114d6e,_0x279b9,_0x367d41){return new BPromise(function(_0x16a077,_0x3f9846){return client[_0xeea4('0xd')](_0x114d6e,_0x367d41)[_0xeea4('0xe')](function(_0x48a0db){logger[_0xeea4('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x279b9,_0xeea4('0x10'));logger[_0xeea4('0x11')](_0xeea4('0x12'),_0x279b9,_0xeea4('0x10'),JSON[_0xeea4('0x13')](_0x48a0db));if(_0x48a0db[_0xeea4('0x14')]){if(_0x48a0db[_0xeea4('0x14')][_0xeea4('0x15')]===0x1f4){logger['error'](_0xeea4('0x16'),_0x279b9,_0x48a0db[_0xeea4('0x14')]['message']);return _0x3f9846(_0x48a0db[_0xeea4('0x14')]['message']);}logger[_0xeea4('0x14')](_0xeea4('0x16'),_0x279b9,_0x48a0db[_0xeea4('0x14')][_0xeea4('0x17')]);return _0x16a077(_0x48a0db[_0xeea4('0x14')][_0xeea4('0x17')]);}else{logger[_0xeea4('0xf')](_0xeea4('0x16'),_0x279b9,_0xeea4('0x10'));_0x16a077(_0x48a0db[_0xeea4('0x18')]['message']);}})[_0xeea4('0x19')](function(_0x8e29fb){logger['error'](_0xeea4('0x16'),_0x279b9,_0x8e29fb);_0x3f9846(_0x8e29fb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b15c7c8..44fb4ba 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 _0x05b0=['remove','update','register','length'];(function(_0x56cfa2,_0x19806b){var _0xc153f2=function(_0x4049ef){while(--_0x4049ef){_0x56cfa2['push'](_0x56cfa2['shift']());}};_0xc153f2(++_0x19806b);}(_0x05b0,0x188));var _0x005b=function(_0x4ccdd9,_0x3f12c2){_0x4ccdd9=_0x4ccdd9-0x0;var _0x551bb7=_0x05b0[_0x4ccdd9];return _0x551bb7;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x005b('0x0'),_0x005b('0x1')];function createListener(_0x4c8e5f,_0xbc782b){return function(_0x2f5c09){_0xbc782b['emit'](_0x4c8e5f,_0x2f5c09);};}function removeListener(_0x342d08,_0x2849ed){return function(){VoicePrefixEvents['removeListener'](_0x342d08,_0x2849ed);};}exports[_0x005b('0x2')]=function(_0x18fb51){for(var _0x31fe01=0x0,_0x98e71c=events[_0x005b('0x3')];_0x31fe01<_0x98e71c;_0x31fe01++){var _0x35998d=events[_0x31fe01];var _0x263bc9=createListener('voicePrefix:'+_0x35998d,_0x18fb51);VoicePrefixEvents['on'](_0x35998d,_0x263bc9);}}; \ No newline at end of file +var _0x0506=['emit','length','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x1dcdf3,_0x5e435c){var _0x172849=function(_0x2e85e8){while(--_0x2e85e8){_0x1dcdf3['push'](_0x1dcdf3['shift']());}};_0x172849(++_0x5e435c);}(_0x0506,0x1d1));var _0x6050=function(_0x1cb823,_0x135d10){_0x1cb823=_0x1cb823-0x0;var _0x567ba3=_0x0506[_0x1cb823];return _0x567ba3;};'use strict';var VoicePrefixEvents=require(_0x6050('0x0'));var events=[_0x6050('0x1'),_0x6050('0x2'),'update'];function createListener(_0x52f82b,_0x5139c7){return function(_0x49a1ca){_0x5139c7[_0x6050('0x3')](_0x52f82b,_0x49a1ca);};}function removeListener(_0x58e2a9,_0x3cbb1f){return function(){VoicePrefixEvents['removeListener'](_0x58e2a9,_0x3cbb1f);};}exports['register']=function(_0xfd44cc){for(var _0x269be3=0x0,_0x2a3644=events[_0x6050('0x4')];_0x269be3<_0x2a3644;_0x269be3++){var _0x3512ba=events[_0x269be3];var _0xf64de5=createListener(_0x6050('0x5')+_0x3512ba,_0xfd44cc);VoicePrefixEvents['on'](_0x3512ba,_0xf64de5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index acb3221..de87632 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(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x59cda9,_0x47d4c4){_0x59cda9=_0x59cda9-0x0;var _0x26c18f=_0xb10b[_0x59cda9];return _0x26c18f;};'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(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0xb10b,0x12a));var _0xbb10=function(_0x12fc6d,_0x1b2dc1){_0x12fc6d=_0x12fc6d-0x0;var _0x2929f0=_0xb10b[_0x12fc6d];return _0x2929f0;};'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 480a5ba..988630a 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 _0xb8a1=['strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','ENUM','inbound','outbound','STRING','default','leastrecent','random','rrmemory','linear','wrandom','setDataValue'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xb8a1,0x123));var _0x1b8a=function(_0x225524,_0x36a0c7){_0x225524=_0x225524-0x0;var _0x4506c3=_0xb8a1[_0x225524];return _0x4506c3;};'use strict';var Sequelize=require(_0x1b8a('0x0'));module[_0x1b8a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x3'),_0x1b8a('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x6')},'announce':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1b8a('0x7'),'fewestcalls',_0x1b8a('0x8'),_0x1b8a('0x9'),_0x1b8a('0xa'),_0x1b8a('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x597818){this[_0x1b8a('0xc')](_0x1b8a('0xd'),_0x597818?_0x597818:'rrmemory');},'get':function(){var _0x24bbd7=this['getDataValue']('type');var _0x272c80=this[_0x1b8a('0xe')](_0x1b8a('0xf'));var _0x1e4d0f=this[_0x1b8a('0xe')](_0x1b8a('0xd'));if(_0x24bbd7===_0x1b8a('0x4')){if(_0x272c80===_0x1b8a('0x10')){return null;}if(_0x272c80==='booked'&&![_0x1b8a('0x9'),_0x1b8a('0x11')][_0x1b8a('0x12')](_0x1e4d0f)){this['setDataValue'](_0x1b8a('0xd'),'rrmemory');}}return _0x1e4d0f;}},'servicelevel':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'timeout':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1b8a('0x5')]},'weight':{'type':Sequelize[_0x1b8a('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x1b8a('0x2')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1b8a('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':_0x1b8a('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no',_0x1b8a('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1b8a('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1b8a('0x5')]},'queue_youarenext':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1b8a('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1b8a('0x5')]},'queue_quantity1':{'type':Sequelize[_0x1b8a('0x5')]},'queue_quantity2':{'type':Sequelize[_0x1b8a('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x1b8a('0x5')]},'periodic_announce':{'type':Sequelize[_0x1b8a('0x16')],'set':function(_0x309512){this[_0x1b8a('0xc')](_0x1b8a('0x17'),_0x309512?_0x309512[_0x1b8a('0x18')](','):[]);},'get':function(){return this[_0x1b8a('0xe')](_0x1b8a('0x17'))?this['getDataValue'](_0x1b8a('0x17'))[_0x1b8a('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x14'),'set':function(_0x397af3){this[_0x1b8a('0xc')](_0x1b8a('0x1a'),_0x397af3?_0x397af3['join'](','):undefined);},'get':function(){return this[_0x1b8a('0xe')](_0x1b8a('0x1a'))?this[_0x1b8a('0xe')](_0x1b8a('0x1a'))[_0x1b8a('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2dad7f){this[_0x1b8a('0xc')]('leavewhenempty',_0x2dad7f?_0x2dad7f['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1b8a('0x1b'))?this[_0x1b8a('0xe')](_0x1b8a('0x1b'))[_0x1b8a('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1b8a('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1b8a('0x5')]},'description':{'type':Sequelize[_0x1b8a('0x5')]},'acw':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'set':function(_0x4d8560){this[_0x1b8a('0xc')](_0x1b8a('0x1d'),_0x4d8560);if(_0x4d8560){if(this[_0x1b8a('0xe')](_0x1b8a('0x1e'))<0x2){this[_0x1b8a('0xc')](_0x1b8a('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':_0x1b8a('0x1f')},'dialMethod':{'type':Sequelize[_0x1b8a('0x2')]('preview','progressive',_0x1b8a('0x20'),_0x1b8a('0x21'),'booked'),'defaultValue':_0x1b8a('0x22'),'comment':_0x1b8a('0x23')},'dialLimitChannel':{'type':Sequelize[_0x1b8a('0x13')](0x4)[_0x1b8a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1b8a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b8a('0x25')},'dialPowerLevel':{'type':Sequelize[_0x1b8a('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x27'),_0x1b8a('0x28')),'defaultValue':_0x1b8a('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1b8a('0x26')](0x2)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1b8a('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x2b'),'comment':_0x1b8a('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2d')},'dialQueueProject':{'type':Sequelize[_0x1b8a('0x5')],'comment':_0x1b8a('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1b8a('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x34')},'dialPrefix':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1b8a('0x35'),_0x1b8a('0x36'),_0x1b8a('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1b8a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1b8a('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b8a('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b8a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b8a('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1b8a('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1b8a('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1b8a('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1b8a('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b8a('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':_0x1b8a('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b8a('0x2')]('DESC','ASC'),'defaultValue':_0x1b8a('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1b8a('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x43')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x44')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1b8a('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22096b){if(!_0x22096b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x1b8a('0xc')](_0x1b8a('0x4b'),_0x22096b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1b8a('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![]}}; \ No newline at end of file +var _0xf11a=['joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','outbound','inbound','STRING','default','ringall','leastrecent','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','preview','roundrobin','includes','INTEGER','ENUM','yes','once','periodic_announce','join','split'];(function(_0x4cc733,_0x390627){var _0x58dc2e=function(_0x2ba205){while(--_0x2ba205){_0x4cc733['push'](_0x4cc733['shift']());}};_0x58dc2e(++_0x390627);}(_0xf11a,0x1ba));var _0xaf11=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xf11a[_0x1b2422];return _0x376573;};'use strict';var Sequelize=require('sequelize');module[_0xaf11('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaf11('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xaf11('0x2')),'allowNull':![],'defaultValue':_0xaf11('0x3')},'musiconhold':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':_0xaf11('0x5')},'announce':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xaf11('0x6'),_0xaf11('0x7'),'fewestcalls',_0xaf11('0x8'),_0xaf11('0x9'),_0xaf11('0xa'),'wrandom',_0xaf11('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4ca7c0){this[_0xaf11('0xc')](_0xaf11('0xd'),_0x4ca7c0?_0x4ca7c0:_0xaf11('0x9'));},'get':function(){var _0x19be2c=this[_0xaf11('0xe')](_0xaf11('0xf'));var _0x2bd011=this[_0xaf11('0xe')]('dialMethod');var _0x14d9a4=this['getDataValue'](_0xaf11('0xd'));if(_0x19be2c===_0xaf11('0x2')){if(_0x2bd011===_0xaf11('0x10')){return null;}if(_0x2bd011==='booked'&&![_0xaf11('0x9'),_0xaf11('0x11')][_0xaf11('0x12')](_0x14d9a4)){this['setDataValue'](_0xaf11('0xd'),_0xaf11('0x9'));}}return _0x14d9a4;}},'servicelevel':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaf11('0x13')](0xb)},'timeout':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaf11('0x14')]('yes','no'),'defaultValue':_0xaf11('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xaf11('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xaf11('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xaf11('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xaf11('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaf11('0x14')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no',_0xaf11('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xaf11('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xaf11('0x14')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xaf11('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xaf11('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0xaf11('0x4')]},'queue_less_than':{'type':Sequelize[_0xaf11('0x4')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1bdc19){this['setDataValue'](_0xaf11('0x17'),_0x1bdc19?_0x1bdc19[_0xaf11('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0xaf11('0x17'))?this['getDataValue'](_0xaf11('0x17'))[_0xaf11('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':'yes','set':function(_0x37af8c){this[_0xaf11('0xc')](_0xaf11('0x1a'),_0x37af8c?_0x37af8c[_0xaf11('0x18')](','):undefined);},'get':function(){return this[_0xaf11('0xe')]('joinempty')?this[_0xaf11('0xe')](_0xaf11('0x1a'))[_0xaf11('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':'no','set':function(_0x39428b){this[_0xaf11('0xc')](_0xaf11('0x1b'),_0x39428b?_0x39428b['join'](','):undefined);},'get':function(){return this[_0xaf11('0xe')](_0xaf11('0x1b'))?this['getDataValue'](_0xaf11('0x1b'))[_0xaf11('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xaf11('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xaf11('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf11('0x4')]},'acw':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':0x0,'set':function(_0x5f3501){this[_0xaf11('0xc')](_0xaf11('0x1d'),_0x5f3501);if(_0x5f3501){if(this[_0xaf11('0xe')]('wrapuptime')<0x2){this['setDataValue'](_0xaf11('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaf11('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':0x0,'comment':_0xaf11('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0xaf11('0x10'),_0xaf11('0x20'),_0xaf11('0x21'),_0xaf11('0x22'),'booked'),'defaultValue':_0xaf11('0x20'),'comment':_0xaf11('0x23')},'dialLimitChannel':{'type':Sequelize[_0xaf11('0x13')](0x4)[_0xaf11('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf11('0x25')},'dialLimitQueue':{'type':Sequelize[_0xaf11('0x13')](0x4)[_0xaf11('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf11('0x26')},'dialPowerLevel':{'type':Sequelize[_0xaf11('0x27')](0x2)[_0xaf11('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaf11('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x29'),_0xaf11('0x2a')),'defaultValue':'dropRate','comment':_0xaf11('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xaf11('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xaf11('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xaf11('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xaf11('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaf11('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xaf11('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':'tTxX','comment':_0xaf11('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xaf11('0x4')],'comment':_0xaf11('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf11('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'comment':_0xaf11('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaf11('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xaf11('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaf11('0x14')]('always',_0xaf11('0x36'),_0xaf11('0x37')),'defaultValue':_0xaf11('0x38')},'dialAMDActive':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xaf11('0x13')](0x9)[_0xaf11('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf11('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaf11('0x13')](0x9)[_0xaf11('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xaf11('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf11('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf11('0x13')](0x9)[_0xaf11('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf11('0x13')](0x9)[_0xaf11('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaf11('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaf11('0x13')](0x9)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf11('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf11('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaf11('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf11('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xaf11('0x13')](0x5)[_0xaf11('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xaf11('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf11('0x14')](_0xaf11('0x40'),_0xaf11('0x41')),'defaultValue':_0xaf11('0x40')},'dialQueueProject2':{'type':Sequelize[_0xaf11('0x4')],'comment':_0xaf11('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf11('0x42')},'dialCutDigit':{'type':Sequelize[_0xaf11('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf11('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf11('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf11('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf11('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaf11('0x13')](0x5)[_0xaf11('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf11('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xbf8e4f){if(!_0xbf8e4f)this[_0xaf11('0xc')](_0xaf11('0x4c'),null);this['setDataValue'](_0xaf11('0x4d'),_0xbf8e4f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xaf11('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xaf11('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xaf11('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xaf11('0x13')](0x3)[_0xaf11('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 405b104..ec372b3 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 _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x1cdab6,_0x6ff98f){var _0x304aa1=function(_0x2583c8){while(--_0x2583c8){_0x1cdab6['push'](_0x1cdab6['shift']());}};_0x304aa1(++_0x6ff98f);}(_0xa41a,0x6b));var _0xaa41=function(_0x2c133e,_0x4df72c){_0x2c133e=_0x2c133e-0x0;var _0x46b891=_0xa41a[_0x2c133e];return _0x46b891;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','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)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 90a9624..f92c904 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 _0x6339=['hook','events','../../mysqldb','VoiceQueue','update','remove','emit','hasOwnProperty'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x6339,0xa1));var _0x9633=function(_0x22f235,_0x51e8fb){_0x22f235=_0x22f235-0x0;var _0x4d456b=_0x6339[_0x22f235];return _0x4d456b;};'use strict';var EventEmitter=require(_0x9633('0x0'));var VoiceQueue=require(_0x9633('0x1'))['db'][_0x9633('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9633('0x3'),'afterDestroy':_0x9633('0x4')};function emitEvent(_0x3cd32d){return function(_0x30bbeb,_0x4ee4,_0x4efe61){VoiceQueueEvents[_0x9633('0x5')](_0x3cd32d+':'+_0x30bbeb['id'],_0x30bbeb);VoiceQueueEvents[_0x9633('0x5')](_0x3cd32d,_0x30bbeb);_0x4efe61(null);};}for(var e in events){if(events[_0x9633('0x6')](e)){var event=events[e];VoiceQueue[_0x9633('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xcabd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','save','remove'];(function(_0xab73a1,_0x2bfb0c){var _0x5e9388=function(_0x46513d){while(--_0x46513d){_0xab73a1['push'](_0xab73a1['shift']());}};_0x5e9388(++_0x2bfb0c);}(_0xcabd,0x1b4));var _0xdcab=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xcabd[_0x34bc30];return _0x5706de;};'use strict';var EventEmitter=require(_0xdcab('0x0'));var VoiceQueue=require(_0xdcab('0x1'))['db'][_0xdcab('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcab('0x3'),'afterUpdate':'update','afterDestroy':_0xdcab('0x4')};function emitEvent(_0x1814b7){return function(_0x4003e3,_0x3c38df,_0x2b466d){VoiceQueueEvents[_0xdcab('0x5')](_0x1814b7+':'+_0x4003e3['id'],_0x4003e3);VoiceQueueEvents[_0xdcab('0x5')](_0x1814b7,_0x4003e3);_0x2b466d(null);};}for(var e in events){if(events[_0xdcab('0x6')](e)){var event=events[e];VoiceQueue[_0xdcab('0x7')](e,emitEvent(event));}}module[_0xdcab('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 3f68c26..321999c 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2ce5e3,_0x429426){var _0xe1e73c=function(_0x4a1c38){while(--_0x4a1c38){_0x2ce5e3['push'](_0x2ce5e3['shift']());}};_0xe1e73c(++_0x429426);}(_0x70e0,0x17b));var _0x070e=function(_0x6713a4,_0x54aca3){_0x6713a4=_0x6713a4-0x0;var _0x456c23=_0x70e0[_0x6713a4];return _0x456c23;};'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 +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x498396,_0x395c9a){var _0x1b0fbd=function(_0x1c511e){while(--_0x1c511e){_0x498396['push'](_0x498396['shift']());}};_0x1b0fbd(++_0x395c9a);}(_0x70e0,0x17b));var _0x070e=function(_0x5d6ff9,_0x3a1e51){_0x5d6ff9=_0x5d6ff9-0x0;var _0x47be99=_0x70e0[_0x5d6ff9];return _0x47be99;};'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 f0898c1..9f90301 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 _0xf844=['limit','map','include','model','ShowVoiceQueue','find','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes'];(function(_0x57372a,_0x177ba7){var _0x54c7a2=function(_0x177609){while(--_0x177609){_0x57372a['push'](_0x57372a['shift']());}};_0x54c7a2(++_0x177ba7);}(_0xf844,0x79));var _0x4f84=function(_0xe326ae,_0x49dd64){_0xe326ae=_0xe326ae-0x0;var _0x2bde3c=_0xf844[_0xe326ae];return _0x2bde3c;};'use strict';var _=require(_0x4f84('0x0'));var util=require(_0x4f84('0x1'));var moment=require(_0x4f84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f84('0x3'));var db=require(_0x4f84('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f84('0x5'))('rpc');var config=require(_0x4f84('0x6'));var jayson=require(_0x4f84('0x7'));var client=jayson[_0x4f84('0x8')][_0x4f84('0x9')]({'port':0x232a});config['redis']=_[_0x4f84('0xa')](config['redis'],{'host':_0x4f84('0xb'),'port':0x18eb});var socket=require(_0x4f84('0xc'))(new Redis(config['redis']));require(_0x4f84('0xd'))[_0x4f84('0xe')](socket);function respondWithRpcPromise(_0x3b0dd2,_0x1ab862,_0x2471f8){return new BPromise(function(_0x2f1c34,_0x22a82d){return client['request'](_0x3b0dd2,_0x2471f8)[_0x4f84('0xf')](function(_0x3aa569){logger[_0x4f84('0x10')](_0x4f84('0x11'),_0x1ab862,_0x4f84('0x12'));logger[_0x4f84('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1ab862,'request\x20sent',JSON[_0x4f84('0x14')](_0x3aa569));if(_0x3aa569['error']){if(_0x3aa569['error'][_0x4f84('0x15')]===0x1f4){logger[_0x4f84('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1ab862,_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);return _0x22a82d(_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);}logger[_0x4f84('0x16')](_0x4f84('0x11'),_0x1ab862,_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);return _0x2f1c34(_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);}else{logger[_0x4f84('0x10')](_0x4f84('0x11'),_0x1ab862,'request\x20sent');_0x2f1c34(_0x3aa569[_0x4f84('0x18')]['message']);}})['catch'](function(_0x1945a2){logger[_0x4f84('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1ab862,_0x1945a2);_0x22a82d(_0x1945a2);});});}exports[_0x4f84('0x19')]=function(_0x5b62cd){var _0x362217=this;return new Promise(function(_0x13363d,_0x252c06){return db[_0x4f84('0x1a')]['findAll']({'raw':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1d')]||null:null,'attributes':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd['options'][_0x4f84('0x1e')]||null:null,'limit':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1f')]||null:null,'include':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')]['include']?_[_0x4f84('0x20')](_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x21')],function(_0x409149){return{'model':db[_0x409149[_0x4f84('0x22')]],'as':_0x409149['as'],'attributes':_0x409149[_0x4f84('0x1e')],'include':_0x409149['include']?_['map'](_0x409149[_0x4f84('0x21')],function(_0x4b76c3){return{'model':db[_0x4b76c3['model']],'as':_0x4b76c3['as'],'attributes':_0x4b76c3[_0x4f84('0x1e')],'include':_0x4b76c3['include']?_[_0x4f84('0x20')](_0x4b76c3[_0x4f84('0x21')],function(_0x2218ca){return{'model':db[_0x2218ca['model']],'as':_0x2218ca['as'],'attributes':_0x2218ca[_0x4f84('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f84('0xf')](function(_0x5b2a35){logger[_0x4f84('0x10')]('GetVoiceQueue',_0x5b62cd);logger[_0x4f84('0x13')](_0x4f84('0x19'),_0x5b62cd,JSON[_0x4f84('0x14')](_0x5b2a35));_0x13363d(_0x5b2a35);})['catch'](function(_0xaf8597){logger[_0x4f84('0x16')]('GetVoiceQueue',_0xaf8597[_0x4f84('0x17')],_0x5b62cd);_0x252c06(_0x362217[_0x4f84('0x16')](0x1f4,_0xaf8597[_0x4f84('0x17')]));});});};exports[_0x4f84('0x23')]=function(_0x2001f4){var _0x2e55a8=this;return new Promise(function(_0x57a7a9,_0x198641){return db[_0x4f84('0x1a')][_0x4f84('0x24')]({'raw':_0x2001f4['options']?_0x2001f4['options'][_0x4f84('0x1c')]===undefined?!![]:![]:!![],'where':_0x2001f4[_0x4f84('0x1b')]?_0x2001f4[_0x4f84('0x1b')]['where']||null:null,'attributes':_0x2001f4['options']?_0x2001f4[_0x4f84('0x1b')][_0x4f84('0x1e')]||null:null,'include':_0x2001f4[_0x4f84('0x1b')]?_0x2001f4[_0x4f84('0x1b')]['include']?_[_0x4f84('0x20')](_0x2001f4['options']['include'],function(_0x13093e){return{'model':db[_0x13093e[_0x4f84('0x22')]],'as':_0x13093e['as'],'attributes':_0x13093e[_0x4f84('0x1e')],'include':_0x13093e['include']?_['map'](_0x13093e[_0x4f84('0x21')],function(_0x1ccbc7){return{'model':db[_0x1ccbc7[_0x4f84('0x22')]],'as':_0x1ccbc7['as'],'attributes':_0x1ccbc7[_0x4f84('0x1e')],'include':_0x1ccbc7[_0x4f84('0x21')]?_['map'](_0x1ccbc7[_0x4f84('0x21')],function(_0x3891de){return{'model':db[_0x3891de[_0x4f84('0x22')]],'as':_0x3891de['as'],'attributes':_0x3891de[_0x4f84('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f84('0xf')](function(_0x2b112d){logger[_0x4f84('0x10')](_0x4f84('0x23'),_0x2001f4);logger[_0x4f84('0x13')](_0x4f84('0x23'),_0x2001f4,JSON[_0x4f84('0x14')](_0x2b112d));_0x57a7a9(_0x2b112d);})[_0x4f84('0x25')](function(_0x45460f){logger[_0x4f84('0x16')](_0x4f84('0x23'),_0x45460f['message'],_0x2001f4);_0x198641(_0x2e55a8[_0x4f84('0x16')](0x1f4,_0x45460f[_0x4f84('0x17')]));});});}; \ No newline at end of file +var _0x9f49=['../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ffb6f,_0x4982c0){var _0x264b62=function(_0x1bb68b){while(--_0x1bb68b){_0x3ffb6f['push'](_0x3ffb6f['shift']());}};_0x264b62(++_0x4982c0);}(_0x9f49,0x78));var _0x99f4=function(_0x3db302,_0xe8be0f){_0x3db302=_0x3db302-0x0;var _0x4eff8a=_0x9f49[_0x3db302];return _0x4eff8a;};'use strict';var _=require(_0x99f4('0x0'));var util=require('util');var moment=require(_0x99f4('0x1'));var BPromise=require(_0x99f4('0x2'));var rs=require(_0x99f4('0x3'));var fs=require('fs');var Redis=require(_0x99f4('0x4'));var db=require(_0x99f4('0x5'))['db'];var utils=require(_0x99f4('0x6'));var logger=require(_0x99f4('0x7'))(_0x99f4('0x8'));var config=require(_0x99f4('0x9'));var jayson=require(_0x99f4('0xa'));var client=jayson['client'][_0x99f4('0xb')]({'port':0x232a});config['redis']=_[_0x99f4('0xc')](config[_0x99f4('0xd')],{'host':_0x99f4('0xe'),'port':0x18eb});var socket=require(_0x99f4('0xf'))(new Redis(config[_0x99f4('0xd')]));require(_0x99f4('0x10'))[_0x99f4('0x11')](socket);function respondWithRpcPromise(_0x57d15e,_0x463db6,_0xb74c45){return new BPromise(function(_0x4ee506,_0x4bf42e){return client[_0x99f4('0x12')](_0x57d15e,_0xb74c45)[_0x99f4('0x13')](function(_0x313982){logger['info'](_0x99f4('0x14'),_0x463db6,'request\x20sent');logger[_0x99f4('0x15')](_0x99f4('0x16'),_0x463db6,_0x99f4('0x17'),JSON[_0x99f4('0x18')](_0x313982));if(_0x313982[_0x99f4('0x19')]){if(_0x313982['error'][_0x99f4('0x1a')]===0x1f4){logger['error'](_0x99f4('0x14'),_0x463db6,_0x313982[_0x99f4('0x19')]['message']);return _0x4bf42e(_0x313982[_0x99f4('0x19')][_0x99f4('0x1b')]);}logger[_0x99f4('0x19')](_0x99f4('0x14'),_0x463db6,_0x313982[_0x99f4('0x19')]['message']);return _0x4ee506(_0x313982[_0x99f4('0x19')][_0x99f4('0x1b')]);}else{logger[_0x99f4('0x1c')](_0x99f4('0x14'),_0x463db6,_0x99f4('0x17'));_0x4ee506(_0x313982[_0x99f4('0x1d')][_0x99f4('0x1b')]);}})[_0x99f4('0x1e')](function(_0x59611f){logger[_0x99f4('0x19')](_0x99f4('0x14'),_0x463db6,_0x59611f);_0x4bf42e(_0x59611f);});});}exports[_0x99f4('0x1f')]=function(_0x3eb73e){var _0x42eb60=this;return new Promise(function(_0x11923d,_0x3da2c2){return db[_0x99f4('0x20')]['findAll']({'raw':_0x3eb73e[_0x99f4('0x21')]?_0x3eb73e['options'][_0x99f4('0x22')]===undefined?!![]:![]:!![],'where':_0x3eb73e[_0x99f4('0x21')]?_0x3eb73e[_0x99f4('0x21')]['where']||null:null,'attributes':_0x3eb73e[_0x99f4('0x21')]?_0x3eb73e[_0x99f4('0x21')][_0x99f4('0x23')]||null:null,'limit':_0x3eb73e[_0x99f4('0x21')]?_0x3eb73e['options'][_0x99f4('0x24')]||null:null,'include':_0x3eb73e['options']?_0x3eb73e[_0x99f4('0x21')][_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x3eb73e[_0x99f4('0x21')][_0x99f4('0x25')],function(_0x5b80e6){return{'model':db[_0x5b80e6[_0x99f4('0x27')]],'as':_0x5b80e6['as'],'attributes':_0x5b80e6[_0x99f4('0x23')],'include':_0x5b80e6[_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x5b80e6['include'],function(_0x387c80){return{'model':db[_0x387c80[_0x99f4('0x27')]],'as':_0x387c80['as'],'attributes':_0x387c80[_0x99f4('0x23')],'include':_0x387c80[_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x387c80['include'],function(_0x42d6a8){return{'model':db[_0x42d6a8[_0x99f4('0x27')]],'as':_0x42d6a8['as'],'attributes':_0x42d6a8[_0x99f4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fe7e0){logger['info'](_0x99f4('0x1f'),_0x3eb73e);logger[_0x99f4('0x15')](_0x99f4('0x1f'),_0x3eb73e,JSON[_0x99f4('0x18')](_0x4fe7e0));_0x11923d(_0x4fe7e0);})[_0x99f4('0x1e')](function(_0x354601){logger[_0x99f4('0x19')]('GetVoiceQueue',_0x354601['message'],_0x3eb73e);_0x3da2c2(_0x42eb60[_0x99f4('0x19')](0x1f4,_0x354601[_0x99f4('0x1b')]));});});};exports[_0x99f4('0x28')]=function(_0x348f9e){var _0x5d5a65=this;return new Promise(function(_0x569475,_0x2dd052){return db['VoiceQueue'][_0x99f4('0x29')]({'raw':_0x348f9e['options']?_0x348f9e['options'][_0x99f4('0x22')]===undefined?!![]:![]:!![],'where':_0x348f9e[_0x99f4('0x21')]?_0x348f9e[_0x99f4('0x21')][_0x99f4('0x2a')]||null:null,'attributes':_0x348f9e[_0x99f4('0x21')]?_0x348f9e['options'][_0x99f4('0x23')]||null:null,'include':_0x348f9e['options']?_0x348f9e[_0x99f4('0x21')][_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x348f9e['options'][_0x99f4('0x25')],function(_0x425114){return{'model':db[_0x425114[_0x99f4('0x27')]],'as':_0x425114['as'],'attributes':_0x425114[_0x99f4('0x23')],'include':_0x425114[_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x425114['include'],function(_0x1b4a8a){return{'model':db[_0x1b4a8a[_0x99f4('0x27')]],'as':_0x1b4a8a['as'],'attributes':_0x1b4a8a[_0x99f4('0x23')],'include':_0x1b4a8a[_0x99f4('0x25')]?_[_0x99f4('0x26')](_0x1b4a8a[_0x99f4('0x25')],function(_0x3e6ef7){return{'model':db[_0x3e6ef7[_0x99f4('0x27')]],'as':_0x3e6ef7['as'],'attributes':_0x3e6ef7[_0x99f4('0x23')]};}):[]};}):[]};}):[]:[]})[_0x99f4('0x13')](function(_0x4d12e4){logger[_0x99f4('0x1c')](_0x99f4('0x28'),_0x348f9e);logger[_0x99f4('0x15')]('ShowVoiceQueue',_0x348f9e,JSON[_0x99f4('0x18')](_0x4d12e4));_0x569475(_0x4d12e4);})[_0x99f4('0x1e')](function(_0x21be66){logger[_0x99f4('0x19')]('ShowVoiceQueue',_0x21be66[_0x99f4('0x1b')],_0x348f9e);_0x2dd052(_0x5d5a65[_0x99f4('0x19')](0x1f4,_0x21be66[_0x99f4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 763f8e4..c60a377 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 _0x1c5c=['./voiceQueue.events','remove','emit','removeListener','register','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1c5c,0x8a));var _0xc1c5=function(_0x9b6096,_0xb69645){_0x9b6096=_0x9b6096-0x0;var _0xce8ca7=_0x1c5c[_0x9b6096];return _0xce8ca7;};'use strict';var VoiceQueueEvents=require(_0xc1c5('0x0'));var events=['save',_0xc1c5('0x1'),'update'];function createListener(_0x153656,_0x5b03cd){return function(_0x1d0894){_0x5b03cd[_0xc1c5('0x2')](_0x153656,_0x1d0894);};}function removeListener(_0xcbc3e,_0x4ffa99){return function(){VoiceQueueEvents[_0xc1c5('0x3')](_0xcbc3e,_0x4ffa99);};}exports[_0xc1c5('0x4')]=function(_0x3a19f7){for(var _0x449df5=0x0,_0x2dafb2=events[_0xc1c5('0x5')];_0x449df5<_0x2dafb2;_0x449df5++){var _0x40d2d2=events[_0x449df5];var _0x417267=createListener('voiceQueue:'+_0x40d2d2,_0x3a19f7);VoiceQueueEvents['on'](_0x40d2d2,_0x417267);}}; \ No newline at end of file +var _0x6d1a=['./voiceQueue.events','save','update','register'];(function(_0x531301,_0x3509f2){var _0x46e668=function(_0x272a6c){while(--_0x272a6c){_0x531301['push'](_0x531301['shift']());}};_0x46e668(++_0x3509f2);}(_0x6d1a,0x1ec));var _0xa6d1=function(_0x47b1a8,_0x40c662){_0x47b1a8=_0x47b1a8-0x0;var _0x1258c1=_0x6d1a[_0x47b1a8];return _0x1258c1;};'use strict';var VoiceQueueEvents=require(_0xa6d1('0x0'));var events=[_0xa6d1('0x1'),'remove',_0xa6d1('0x2')];function createListener(_0x54527b,_0x3501b0){return function(_0x5948b8){_0x3501b0['emit'](_0x54527b,_0x5948b8);};}function removeListener(_0x118fdd,_0x2a347d){return function(){VoiceQueueEvents['removeListener'](_0x118fdd,_0x2a347d);};}exports[_0xa6d1('0x3')]=function(_0x5d01f2){for(var _0x3ffc41=0x0,_0x5be59a=events['length'];_0x3ffc41<_0x5be59a;_0x3ffc41++){var _0x3f0c84=events[_0x3ffc41];var _0x1eb996=createListener('voiceQueue:'+_0x3f0c84,_0x5d01f2);VoiceQueueEvents['on'](_0x3f0c84,_0x1eb996);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fe0dcda..9d93850 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 _0x0d2b=['create','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','/index','/:id','show','post'];(function(_0x5764d9,_0x2bb4c6){var _0x1edfcf=function(_0x28f679){while(--_0x28f679){_0x5764d9['push'](_0x5764d9['shift']());}};_0x1edfcf(++_0x2bb4c6);}(_0x0d2b,0x155));var _0xb0d2=function(_0x2ecd37,_0x45dd91){_0x2ecd37=_0x2ecd37-0x0;var _0x3557b7=_0x0d2b[_0x2ecd37];return _0x3557b7;};'use strict';var multer=require(_0xb0d2('0x0'));var util=require('util');var path=require(_0xb0d2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0d2('0x2')]();var fs_extra=require(_0xb0d2('0x3'));var auth=require(_0xb0d2('0x4'));var interaction=require(_0xb0d2('0x5'));var config=require(_0xb0d2('0x6'));var controller=require(_0xb0d2('0x7'));router[_0xb0d2('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0d2('0x9')]);router[_0xb0d2('0x8')](_0xb0d2('0xa'),auth[_0xb0d2('0xb')](),controller['describe']);router[_0xb0d2('0x8')](_0xb0d2('0xc'),auth[_0xb0d2('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xb0d2('0xd'),auth['isAuthenticated'](),controller[_0xb0d2('0xe')]);router[_0xb0d2('0xf')]('/',auth[_0xb0d2('0xb')](),controller[_0xb0d2('0x10')]);router[_0xb0d2('0x11')](_0xb0d2('0xd'),auth[_0xb0d2('0xb')](),controller[_0xb0d2('0x12')]);router[_0xb0d2('0x13')](_0xb0d2('0xd'),auth[_0xb0d2('0xb')](),controller['destroy']);module[_0xb0d2('0x14')]=router; \ No newline at end of file +var _0x8155=['./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8155,0x83));var _0x5815=function(_0x59bcdc,_0x539241){_0x59bcdc=_0x59bcdc-0x0;var _0x388fe3=_0x8155[_0x59bcdc];return _0x388fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5815('0x0'));var timeout=require(_0x5815('0x1'));var express=require(_0x5815('0x2'));var router=express['Router']();var fs_extra=require(_0x5815('0x3'));var auth=require(_0x5815('0x4'));var interaction=require(_0x5815('0x5'));var config=require(_0x5815('0x6'));var controller=require(_0x5815('0x7'));router['get']('/',auth[_0x5815('0x8')](),controller[_0x5815('0x9')]);router[_0x5815('0xa')](_0x5815('0xb'),auth[_0x5815('0x8')](),controller['describe']);router[_0x5815('0xa')](_0x5815('0xc'),auth[_0x5815('0x8')](),controller[_0x5815('0xd')]);router[_0x5815('0xa')]('/:id',auth[_0x5815('0x8')](),controller[_0x5815('0xe')]);router[_0x5815('0xf')]('/',auth[_0x5815('0x8')](),controller[_0x5815('0x10')]);router[_0x5815('0x11')](_0x5815('0x12'),auth[_0x5815('0x8')](),controller[_0x5815('0x13')]);router[_0x5815('0x14')]('/:id',auth[_0x5815('0x8')](),controller[_0x5815('0x15')]);module[_0x5815('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 af04f71..48bc40b 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 _0x5591=['queuecallerjoinAt','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x5591,0x1dc));var _0x1559=function(_0x378830,_0xb532d7){_0x378830=_0x378830-0x0;var _0x4e4348=_0x5591[_0x378830];return _0x4e4348;};'use strict';var Sequelize=require(_0x1559('0x0'));var moment=require(_0x1559('0x1'));module[_0x1559('0x2')]={'type':{'type':Sequelize[_0x1559('0x3')]},'uniqueid':{'type':Sequelize[_0x1559('0x3')]},'calleridnum':{'type':Sequelize[_0x1559('0x3')]},'calleridname':{'type':Sequelize[_0x1559('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1559('0x4')],'set':function(_0x4b2cbd){var _0x40b350=moment(_0x4b2cbd);var _0x405726=moment(this['getDataValue'](_0x1559('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5e74ec=_0x40b350['diff'](_0x405726,'seconds');this[_0x1559('0x6')](_0x1559('0x7'),_0x4b2cbd);this[_0x1559('0x6')](_0x1559('0x8'),_0x5e74ec||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1559('0x3')],'comment':_0x1559('0xa')},'originalposition':{'type':Sequelize[_0x1559('0xb')]},'channel':{'type':Sequelize[_0x1559('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1559('0x3')]},'connectedlinename':{'type':Sequelize[_0x1559('0x3')]},'accountcode':{'type':Sequelize[_0x1559('0x3')]},'context':{'type':Sequelize[_0x1559('0x3')]},'exten':{'type':Sequelize[_0x1559('0x3')]},'priority':{'type':Sequelize[_0x1559('0x3')]},'holdtime':{'type':Sequelize[_0x1559('0xb')]},'mohtime':{'type':Sequelize[_0x1559('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1559('0x3')]},'transfer':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1559('0xc')},'transferexten':{'type':Sequelize[_0x1559('0x3')]},'transferuniqueid':{'type':Sequelize[_0x1559('0x3')]},'disposition':{'type':Sequelize[_0x1559('0x3')]},'secondDisposition':{'type':Sequelize[_0x1559('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1559('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1559('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1559('0x3')]}}; \ No newline at end of file +var _0xaa65=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x3bbe4b,_0x35f067){var _0x402d37=function(_0x2f7f78){while(--_0x2f7f78){_0x3bbe4b['push'](_0x3bbe4b['shift']());}};_0x402d37(++_0x35f067);}(_0xaa65,0x6b));var _0x5aa6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa65[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x5aa6('0x0'));var moment=require('moment');module[_0x5aa6('0x1')]={'type':{'type':Sequelize[_0x5aa6('0x2')]},'uniqueid':{'type':Sequelize[_0x5aa6('0x2')]},'calleridnum':{'type':Sequelize[_0x5aa6('0x2')]},'calleridname':{'type':Sequelize[_0x5aa6('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5aa6('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x5aa6('0x3')],'set':function(_0xd2f7e8){var _0x56716d=moment(_0xd2f7e8);var _0x5b36f3=moment(this[_0x5aa6('0x4')](_0x5aa6('0x5')))[_0x5aa6('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x51f46e=_0x56716d['diff'](_0x5b36f3,_0x5aa6('0x7'));this[_0x5aa6('0x8')](_0x5aa6('0x9'),_0xd2f7e8);this[_0x5aa6('0x8')](_0x5aa6('0xa'),_0x51f46e||null);}},'position':{'type':Sequelize[_0x5aa6('0xb')]},'count':{'type':Sequelize[_0x5aa6('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5aa6('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x5aa6('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5aa6('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5aa6('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5aa6('0xd')},'originalposition':{'type':Sequelize[_0x5aa6('0xb')]},'channel':{'type':Sequelize[_0x5aa6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5aa6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5aa6('0x2')]},'context':{'type':Sequelize[_0x5aa6('0x2')]},'exten':{'type':Sequelize[_0x5aa6('0x2')]},'priority':{'type':Sequelize[_0x5aa6('0x2')]},'holdtime':{'type':Sequelize[_0x5aa6('0xb')]},'mohtime':{'type':Sequelize[_0x5aa6('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5aa6('0x2')]},'transfer':{'type':Sequelize[_0x5aa6('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5aa6('0x2')],'comment':_0x5aa6('0xe')},'transferexten':{'type':Sequelize[_0x5aa6('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5aa6('0x2')]},'disposition':{'type':Sequelize[_0x5aa6('0x2')]},'secondDisposition':{'type':Sequelize[_0x5aa6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5aa6('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x5aa6('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x5aa6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a8f459d..e03ef16 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 _0x6a04=['type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','rawAttributes','create','body','update','find','params','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','map','fieldName'];(function(_0x2046d4,_0x294ed9){var _0x4ca7eb=function(_0x4cb79d){while(--_0x4cb79d){_0x2046d4['push'](_0x2046d4['shift']());}};_0x4ca7eb(++_0x294ed9);}(_0x6a04,0x115));var _0x46a0=function(_0x511111,_0x4c7792){_0x511111=_0x511111-0x0;var _0x1386f2=_0x6a04[_0x511111];return _0x1386f2;};'use strict';var emlformat=require(_0x46a0('0x0'));var rimraf=require(_0x46a0('0x1'));var zipdir=require(_0x46a0('0x2'));var jsonpatch=require(_0x46a0('0x3'));var rp=require(_0x46a0('0x4'));var moment=require(_0x46a0('0x5'));var BPromise=require(_0x46a0('0x6'));var Mustache=require(_0x46a0('0x7'));var util=require('util');var path=require(_0x46a0('0x8'));var sox=require(_0x46a0('0x9'));var csv=require(_0x46a0('0xa'));var ejs=require(_0x46a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a0('0xc'));var squel=require(_0x46a0('0xd'));var crypto=require(_0x46a0('0xe'));var jsforce=require(_0x46a0('0xf'));var deskjs=require(_0x46a0('0x10'));var toCsv=require(_0x46a0('0xa'));var querystring=require(_0x46a0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x46a0('0x12'));var qs=require(_0x46a0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46a0('0x14'))(_0x46a0('0x15'));var utils=require(_0x46a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x46a0('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x46a0('0x18')](config['redis'],{'host':_0x46a0('0x19'),'port':0x18eb});var socket=require(_0x46a0('0x1a'))(new Redis(config[_0x46a0('0x1b')]));require(_0x46a0('0x1c'))['register'](socket);function respondWithStatusCode(_0xe2ca6e,_0x3297c4){_0x3297c4=_0x3297c4||0xcc;return function(_0x3eba61){if(_0x3eba61){return _0xe2ca6e[_0x46a0('0x1d')](_0x3297c4);}return _0xe2ca6e[_0x46a0('0x1e')](_0x3297c4)[_0x46a0('0x1f')]();};}function respondWithResult(_0x118d80,_0x500183){_0x500183=_0x500183||0xc8;return function(_0x5af334){if(_0x5af334){return _0x118d80[_0x46a0('0x1e')](_0x500183)['json'](_0x5af334);}};}function respondWithFilteredResult(_0x4236b2,_0xd73444){return function(_0x27d540){if(_0x27d540){var _0x282a81=typeof _0xd73444[_0x46a0('0x20')]===_0x46a0('0x21')&&typeof _0xd73444['limit']===_0x46a0('0x21');var _0x365ed3=_0x27d540[_0x46a0('0x22')];var _0x502762=_0x282a81?0x0:_0xd73444['offset'];var _0x1444af=_0x282a81?_0x27d540[_0x46a0('0x22')]:_0xd73444['offset']+_0xd73444['limit'];var _0x5f293e;if(_0x1444af>=_0x365ed3){_0x1444af=_0x365ed3;_0x5f293e=0xc8;}else{_0x5f293e=0xce;}_0x4236b2[_0x46a0('0x1e')](_0x5f293e);return _0x4236b2[_0x46a0('0x23')](_0x46a0('0x24'),_0x502762+'-'+_0x1444af+'/'+_0x365ed3)[_0x46a0('0x25')](_0x27d540);}return null;};}function patchUpdates(_0x518c4e){return function(_0x92e8b1){try{jsonpatch['apply'](_0x92e8b1,_0x518c4e,!![]);}catch(_0x4892ab){return BPromise['reject'](_0x4892ab);}return _0x92e8b1[_0x46a0('0x26')]();};}function saveUpdates(_0x2bd65c,_0x2f5358){return function(_0x1b6ea1){if(_0x1b6ea1){return _0x1b6ea1['update'](_0x2bd65c)[_0x46a0('0x27')](function(_0x4dda39){return _0x4dda39;});}return null;};}function removeEntity(_0xde924e,_0x13225a){return function(_0x4cebcd){if(_0x4cebcd){return _0x4cebcd[_0x46a0('0x28')]()[_0x46a0('0x27')](function(){_0xde924e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdfe9,_0x22479f){return function(_0x1d260e){if(!_0x1d260e){_0x2fdfe9[_0x46a0('0x1d')](0x194);}return _0x1d260e;};}function handleError(_0x5754e1,_0x2cf32f){_0x2cf32f=_0x2cf32f||0x1f4;return function(_0xe5b9bd){logger[_0x46a0('0x29')](_0xe5b9bd[_0x46a0('0x2a')]);if(_0xe5b9bd[_0x46a0('0x2b')]){delete _0xe5b9bd[_0x46a0('0x2b')];}_0x5754e1[_0x46a0('0x1e')](_0x2cf32f)[_0x46a0('0x2c')](_0xe5b9bd);};}exports['index']=function(_0x54e80e,_0x4d552b){var _0x2726d6={},_0x1c5b18={},_0x751b2e={'count':0x0,'rows':[]};var _0x5c3949=_[_0x46a0('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x17f485){return{'name':_0x17f485[_0x46a0('0x2e')],'type':_0x17f485[_0x46a0('0x2f')]['key']};});_0x1c5b18['model']=_[_0x46a0('0x2d')](_0x5c3949,_0x46a0('0x2b'));_0x1c5b18[_0x46a0('0x30')]=_[_0x46a0('0x31')](_0x54e80e[_0x46a0('0x30')]);_0x1c5b18[_0x46a0('0x32')]=_['intersection'](_0x1c5b18[_0x46a0('0x33')],_0x1c5b18['query']);_0x2726d6['attributes']=_[_0x46a0('0x34')](_0x1c5b18[_0x46a0('0x33')],qs['fields'](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x35')]));_0x2726d6[_0x46a0('0x36')]=_0x2726d6[_0x46a0('0x36')][_0x46a0('0x37')]?_0x2726d6[_0x46a0('0x36')]:_0x1c5b18[_0x46a0('0x33')];if(!_0x54e80e[_0x46a0('0x30')][_0x46a0('0x38')](_0x46a0('0x39'))){_0x2726d6[_0x46a0('0x3a')]=qs['limit'](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3a')]);_0x2726d6[_0x46a0('0x20')]=qs[_0x46a0('0x20')](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x20')]);}_0x2726d6[_0x46a0('0x3b')]=qs[_0x46a0('0x3c')](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3c')]);_0x2726d6[_0x46a0('0x3d')]=qs['filters'](_[_0x46a0('0x3e')](_0x54e80e[_0x46a0('0x30')],_0x1c5b18[_0x46a0('0x32')]),_0x5c3949);if(_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3f')]){_0x2726d6[_0x46a0('0x3d')]=_[_0x46a0('0x40')](_0x2726d6[_0x46a0('0x3d')],{'$or':_['map'](_0x5c3949,function(_0x468ad6){if(_0x468ad6[_0x46a0('0x2f')]!==_0x46a0('0x41')){var _0x2616e8={};_0x2616e8[_0x468ad6['name']]={'$like':'%'+_0x54e80e[_0x46a0('0x30')]['filter']+'%'};return _0x2616e8;}})});}_0x2726d6=_[_0x46a0('0x40')]({},_0x2726d6,_0x54e80e['options']);var _0x57d636={'where':_0x2726d6['where']};return db['VoiceQueueReport']['count'](_0x57d636)[_0x46a0('0x27')](function(_0x6e0615){_0x751b2e[_0x46a0('0x22')]=_0x6e0615;if(_0x54e80e[_0x46a0('0x30')][_0x46a0('0x42')]){_0x2726d6[_0x46a0('0x43')]=[{'all':!![]}];}return db[_0x46a0('0x44')][_0x46a0('0x45')](_0x2726d6);})[_0x46a0('0x27')](function(_0x2d0f7b){_0x751b2e[_0x46a0('0x46')]=_0x2d0f7b;return _0x751b2e;})['then'](respondWithFilteredResult(_0x4d552b,_0x2726d6))[_0x46a0('0x47')](handleError(_0x4d552b,null));};exports[_0x46a0('0x48')]=function(_0x3340a9,_0x557eac){var _0x5584c2={'raw':![],'where':{'id':_0x3340a9['params']['id']}},_0x223b24={};_0x223b24['model']=_['keys'](db['VoiceQueueReport'][_0x46a0('0x49')]);_0x223b24[_0x46a0('0x30')]=_[_0x46a0('0x31')](_0x3340a9[_0x46a0('0x30')]);_0x223b24[_0x46a0('0x32')]=_[_0x46a0('0x34')](_0x223b24[_0x46a0('0x33')],_0x223b24[_0x46a0('0x30')]);_0x5584c2['attributes']=_[_0x46a0('0x34')](_0x223b24['model'],qs[_0x46a0('0x35')](_0x3340a9[_0x46a0('0x30')][_0x46a0('0x35')]));_0x5584c2[_0x46a0('0x36')]=_0x5584c2[_0x46a0('0x36')][_0x46a0('0x37')]?_0x5584c2['attributes']:_0x223b24[_0x46a0('0x33')];if(_0x3340a9['query'][_0x46a0('0x42')]){_0x5584c2[_0x46a0('0x43')]=[{'all':!![]}];}_0x5584c2=_[_0x46a0('0x40')]({},_0x5584c2,_0x3340a9['options']);return db[_0x46a0('0x44')]['find'](_0x5584c2)['then'](handleEntityNotFound(_0x557eac,null))[_0x46a0('0x27')](respondWithResult(_0x557eac,null))['catch'](handleError(_0x557eac,null));};exports[_0x46a0('0x4a')]=function(_0x37b4de,_0x40b5ef){return db[_0x46a0('0x44')][_0x46a0('0x4a')](_0x37b4de[_0x46a0('0x4b')],{})[_0x46a0('0x27')](respondWithResult(_0x40b5ef,0xc9))[_0x46a0('0x47')](handleError(_0x40b5ef,null));};exports[_0x46a0('0x4c')]=function(_0x18a5d4,_0x6b7dd7){if(_0x18a5d4[_0x46a0('0x4b')]['id']){delete _0x18a5d4[_0x46a0('0x4b')]['id'];}return db['VoiceQueueReport'][_0x46a0('0x4d')]({'where':{'id':_0x18a5d4['params']['id']}})[_0x46a0('0x27')](handleEntityNotFound(_0x6b7dd7,null))['then'](saveUpdates(_0x18a5d4[_0x46a0('0x4b')],null))['then'](respondWithResult(_0x6b7dd7,null))[_0x46a0('0x47')](handleError(_0x6b7dd7,null));};exports[_0x46a0('0x28')]=function(_0x2c4f19,_0x42da07){return db[_0x46a0('0x44')][_0x46a0('0x4d')]({'where':{'id':_0x2c4f19[_0x46a0('0x4e')]['id']}})[_0x46a0('0x27')](handleEntityNotFound(_0x42da07,null))['then'](removeEntity(_0x42da07,null))[_0x46a0('0x47')](handleError(_0x42da07,null));};exports[_0x46a0('0x4f')]=function(_0x4f4cf5,_0x298e04){return db[_0x46a0('0x44')][_0x46a0('0x4f')]()[_0x46a0('0x27')](respondWithResult(_0x298e04,null))[_0x46a0('0x47')](handleError(_0x298e04,null));};exports[_0x46a0('0x50')]=function(_0x563360,_0x57a1f8){var _0x3c40d3={},_0x7bae4c={},_0x14e097={'count':0x0,'rows':[]};_0x7bae4c[_0x46a0('0x33')]=_[_0x46a0('0x31')](db[_0x46a0('0x44')]['rawAttributes']);_0x7bae4c[_0x46a0('0x30')]=_['keys'](_0x563360[_0x46a0('0x30')]);_0x7bae4c[_0x46a0('0x32')]=_[_0x46a0('0x34')](_0x7bae4c[_0x46a0('0x33')],_0x7bae4c[_0x46a0('0x30')]);_0x3c40d3['attributes']=_[_0x46a0('0x34')](_0x7bae4c[_0x46a0('0x33')],qs[_0x46a0('0x35')](_0x563360['query']['fields']));_0x3c40d3[_0x46a0('0x36')]=_0x3c40d3['attributes'][_0x46a0('0x37')]?_0x3c40d3[_0x46a0('0x36')]:_0x7bae4c['model'];if(!_0x563360[_0x46a0('0x30')]['hasOwnProperty'](_0x46a0('0x39'))){_0x3c40d3[_0x46a0('0x3a')]=qs[_0x46a0('0x3a')](_0x563360[_0x46a0('0x30')][_0x46a0('0x3a')]);_0x3c40d3['offset']=qs[_0x46a0('0x20')](_0x563360[_0x46a0('0x30')]['offset']);}_0x3c40d3[_0x46a0('0x3b')]=qs[_0x46a0('0x3c')](_0x563360['query']['sort']);_0x3c40d3[_0x46a0('0x3d')]=qs[_0x46a0('0x32')](_[_0x46a0('0x3e')](_0x563360['query'],_0x7bae4c[_0x46a0('0x32')]));if(_0x563360[_0x46a0('0x30')]['filter']){_0x3c40d3[_0x46a0('0x3d')]=_[_0x46a0('0x40')](_0x3c40d3[_0x46a0('0x3d')],{'$or':_[_0x46a0('0x2d')](_0x3c40d3[_0x46a0('0x36')],function(_0x267aca){var _0x2d77b4={};_0x2d77b4[_0x267aca]={'$like':'%'+_0x563360[_0x46a0('0x30')][_0x46a0('0x3f')]+'%'};return _0x2d77b4;})});}_0x3c40d3=_['merge']({},_0x3c40d3,_0x563360['options']);var _0x27f54e={'where':_0x3c40d3[_0x46a0('0x3d')]};return db[_0x46a0('0x44')][_0x46a0('0x22')](_0x27f54e)['then'](function(_0x5896bb){_0x14e097['count']=_0x5896bb;if(_0x563360['query'][_0x46a0('0x42')]){_0x3c40d3[_0x46a0('0x43')]=[{'all':!![]}];}return db[_0x46a0('0x44')][_0x46a0('0x45')](_0x3c40d3);})[_0x46a0('0x27')](function(_0x158251){_0x14e097[_0x46a0('0x46')]=_0x158251;return _0x14e097;})[_0x46a0('0x27')](respondWithFilteredResult(_0x57a1f8,_0x3c40d3,_0x46a0('0x50')))[_0x46a0('0x47')](handleError(_0x57a1f8,null,_0x46a0('0x50')));}; \ No newline at end of file +var _0x324c=['include','findAll','catch','keys','create','body','find','destroy','describe','getVoiceQueuesReport','nolimit','pick','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','VoiceQueueReport','includeAll'];(function(_0x8b6cb1,_0x5ad718){var _0xb744f4=function(_0x470807){while(--_0x470807){_0x8b6cb1['push'](_0x8b6cb1['shift']());}};_0xb744f4(++_0x5ad718);}(_0x324c,0xb1));var _0xc324=function(_0x31fb29,_0xbf658f){_0x31fb29=_0x31fb29-0x0;var _0x19101e=_0x324c[_0x31fb29];return _0x19101e;};'use strict';var emlformat=require(_0xc324('0x0'));var rimraf=require(_0xc324('0x1'));var zipdir=require(_0xc324('0x2'));var jsonpatch=require(_0xc324('0x3'));var rp=require(_0xc324('0x4'));var moment=require(_0xc324('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc324('0x6'));var util=require(_0xc324('0x7'));var path=require(_0xc324('0x8'));var sox=require('sox');var csv=require(_0xc324('0x9'));var ejs=require(_0xc324('0xa'));var fs=require('fs');var fs_extra=require(_0xc324('0xb'));var _=require(_0xc324('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc324('0xd'));var deskjs=require(_0xc324('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc324('0xf'));var Papa=require(_0xc324('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc324('0x11'));var as=require(_0xc324('0x12'));var hardwareService=require(_0xc324('0x13'));var logger=require(_0xc324('0x14'))(_0xc324('0x15'));var utils=require(_0xc324('0x16'));var config=require(_0xc324('0x17'));var licenseUtil=require(_0xc324('0x18'));var db=require(_0xc324('0x19'))['db'];config[_0xc324('0x1a')]=_[_0xc324('0x1b')](config[_0xc324('0x1a')],{'host':_0xc324('0x1c'),'port':0x18eb});var socket=require(_0xc324('0x1d'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xc324('0x1e')](socket);function respondWithStatusCode(_0x3b5a8a,_0x50b1ce){_0x50b1ce=_0x50b1ce||0xcc;return function(_0x10e4a2){if(_0x10e4a2){return _0x3b5a8a[_0xc324('0x1f')](_0x50b1ce);}return _0x3b5a8a[_0xc324('0x20')](_0x50b1ce)['end']();};}function respondWithResult(_0x463813,_0x3eea11){_0x3eea11=_0x3eea11||0xc8;return function(_0x2d9c10){if(_0x2d9c10){return _0x463813[_0xc324('0x20')](_0x3eea11)['json'](_0x2d9c10);}};}function respondWithFilteredResult(_0x1c9460,_0x196fbc){return function(_0x364364){if(_0x364364){var _0x1d773e=typeof _0x196fbc[_0xc324('0x21')]===_0xc324('0x22')&&typeof _0x196fbc[_0xc324('0x23')]===_0xc324('0x22');var _0x5e0178=_0x364364[_0xc324('0x24')];var _0x54d9f4=_0x1d773e?0x0:_0x196fbc[_0xc324('0x21')];var _0x450958=_0x1d773e?_0x364364['count']:_0x196fbc[_0xc324('0x21')]+_0x196fbc['limit'];var _0x3568b6;if(_0x450958>=_0x5e0178){_0x450958=_0x5e0178;_0x3568b6=0xc8;}else{_0x3568b6=0xce;}_0x1c9460[_0xc324('0x20')](_0x3568b6);return _0x1c9460[_0xc324('0x25')](_0xc324('0x26'),_0x54d9f4+'-'+_0x450958+'/'+_0x5e0178)[_0xc324('0x27')](_0x364364);}return null;};}function patchUpdates(_0xfefb89){return function(_0x471160){try{jsonpatch[_0xc324('0x28')](_0x471160,_0xfefb89,!![]);}catch(_0x3b725d){return BPromise[_0xc324('0x29')](_0x3b725d);}return _0x471160['save']();};}function saveUpdates(_0xd18d2b,_0x4baedf){return function(_0x5ba791){if(_0x5ba791){return _0x5ba791[_0xc324('0x2a')](_0xd18d2b)[_0xc324('0x2b')](function(_0x5bc9bd){return _0x5bc9bd;});}return null;};}function removeEntity(_0x5bc197,_0x1b33b5){return function(_0x16ca55){if(_0x16ca55){return _0x16ca55['destroy']()['then'](function(){_0x5bc197['status'](0xcc)[_0xc324('0x2c')]();});}};}function handleEntityNotFound(_0x42407f,_0x20606b){return function(_0x312019){if(!_0x312019){_0x42407f[_0xc324('0x1f')](0x194);}return _0x312019;};}function handleError(_0x1084b2,_0x242055){_0x242055=_0x242055||0x1f4;return function(_0x2f7a0a){logger['error'](_0x2f7a0a['stack']);if(_0x2f7a0a[_0xc324('0x2d')]){delete _0x2f7a0a[_0xc324('0x2d')];}_0x1084b2[_0xc324('0x20')](_0x242055)[_0xc324('0x2e')](_0x2f7a0a);};}exports[_0xc324('0x2f')]=function(_0xf48f5c,_0x25b1b6){var _0xb2435f={},_0xb14518={},_0x4560bc={'count':0x0,'rows':[]};var _0x3d977e=_[_0xc324('0x30')](db['VoiceQueueReport'][_0xc324('0x31')],function(_0xa0962e){return{'name':_0xa0962e[_0xc324('0x32')],'type':_0xa0962e[_0xc324('0x33')][_0xc324('0x34')]};});_0xb14518['model']=_['map'](_0x3d977e,_0xc324('0x2d'));_0xb14518[_0xc324('0x35')]=_['keys'](_0xf48f5c[_0xc324('0x35')]);_0xb14518[_0xc324('0x36')]=_['intersection'](_0xb14518[_0xc324('0x37')],_0xb14518[_0xc324('0x35')]);_0xb2435f[_0xc324('0x38')]=_[_0xc324('0x39')](_0xb14518['model'],qs[_0xc324('0x3a')](_0xf48f5c[_0xc324('0x35')]['fields']));_0xb2435f['attributes']=_0xb2435f[_0xc324('0x38')][_0xc324('0x3b')]?_0xb2435f[_0xc324('0x38')]:_0xb14518[_0xc324('0x37')];if(!_0xf48f5c[_0xc324('0x35')][_0xc324('0x3c')]('nolimit')){_0xb2435f[_0xc324('0x23')]=qs[_0xc324('0x23')](_0xf48f5c[_0xc324('0x35')][_0xc324('0x23')]);_0xb2435f[_0xc324('0x21')]=qs['offset'](_0xf48f5c['query'][_0xc324('0x21')]);}_0xb2435f[_0xc324('0x3d')]=qs[_0xc324('0x3e')](_0xf48f5c[_0xc324('0x35')][_0xc324('0x3e')]);_0xb2435f[_0xc324('0x3f')]=qs[_0xc324('0x36')](_['pick'](_0xf48f5c[_0xc324('0x35')],_0xb14518['filters']),_0x3d977e);if(_0xf48f5c[_0xc324('0x35')][_0xc324('0x40')]){_0xb2435f[_0xc324('0x3f')]=_[_0xc324('0x41')](_0xb2435f[_0xc324('0x3f')],{'$or':_[_0xc324('0x30')](_0x3d977e,function(_0x31894d){if(_0x31894d[_0xc324('0x33')]!=='VIRTUAL'){var _0x1ffe4a={};_0x1ffe4a[_0x31894d[_0xc324('0x2d')]]={'$like':'%'+_0xf48f5c[_0xc324('0x35')][_0xc324('0x40')]+'%'};return _0x1ffe4a;}})});}_0xb2435f=_[_0xc324('0x41')]({},_0xb2435f,_0xf48f5c[_0xc324('0x42')]);var _0x4420ce={'where':_0xb2435f[_0xc324('0x3f')]};return db[_0xc324('0x43')][_0xc324('0x24')](_0x4420ce)[_0xc324('0x2b')](function(_0x3c18bf){_0x4560bc[_0xc324('0x24')]=_0x3c18bf;if(_0xf48f5c[_0xc324('0x35')][_0xc324('0x44')]){_0xb2435f[_0xc324('0x45')]=[{'all':!![]}];}return db[_0xc324('0x43')][_0xc324('0x46')](_0xb2435f);})[_0xc324('0x2b')](function(_0x2e28b9){_0x4560bc['rows']=_0x2e28b9;return _0x4560bc;})[_0xc324('0x2b')](respondWithFilteredResult(_0x25b1b6,_0xb2435f))[_0xc324('0x47')](handleError(_0x25b1b6,null));};exports['show']=function(_0x9a0995,_0x289ea2){var _0x33abdc={'raw':![],'where':{'id':_0x9a0995['params']['id']}},_0x474862={};_0x474862[_0xc324('0x37')]=_[_0xc324('0x48')](db[_0xc324('0x43')][_0xc324('0x31')]);_0x474862[_0xc324('0x35')]=_['keys'](_0x9a0995['query']);_0x474862[_0xc324('0x36')]=_[_0xc324('0x39')](_0x474862[_0xc324('0x37')],_0x474862[_0xc324('0x35')]);_0x33abdc['attributes']=_['intersection'](_0x474862[_0xc324('0x37')],qs[_0xc324('0x3a')](_0x9a0995['query'][_0xc324('0x3a')]));_0x33abdc[_0xc324('0x38')]=_0x33abdc[_0xc324('0x38')][_0xc324('0x3b')]?_0x33abdc['attributes']:_0x474862[_0xc324('0x37')];if(_0x9a0995[_0xc324('0x35')][_0xc324('0x44')]){_0x33abdc[_0xc324('0x45')]=[{'all':!![]}];}_0x33abdc=_[_0xc324('0x41')]({},_0x33abdc,_0x9a0995[_0xc324('0x42')]);return db['VoiceQueueReport']['find'](_0x33abdc)['then'](handleEntityNotFound(_0x289ea2,null))[_0xc324('0x2b')](respondWithResult(_0x289ea2,null))[_0xc324('0x47')](handleError(_0x289ea2,null));};exports[_0xc324('0x49')]=function(_0x225434,_0x5663eb){return db[_0xc324('0x43')][_0xc324('0x49')](_0x225434[_0xc324('0x4a')],{})[_0xc324('0x2b')](respondWithResult(_0x5663eb,0xc9))[_0xc324('0x47')](handleError(_0x5663eb,null));};exports['update']=function(_0x42a4f0,_0x4266ea){if(_0x42a4f0[_0xc324('0x4a')]['id']){delete _0x42a4f0[_0xc324('0x4a')]['id'];}return db[_0xc324('0x43')][_0xc324('0x4b')]({'where':{'id':_0x42a4f0['params']['id']}})[_0xc324('0x2b')](handleEntityNotFound(_0x4266ea,null))[_0xc324('0x2b')](saveUpdates(_0x42a4f0['body'],null))['then'](respondWithResult(_0x4266ea,null))['catch'](handleError(_0x4266ea,null));};exports[_0xc324('0x4c')]=function(_0x20239e,_0x5a5b1f){return db[_0xc324('0x43')][_0xc324('0x4b')]({'where':{'id':_0x20239e['params']['id']}})[_0xc324('0x2b')](handleEntityNotFound(_0x5a5b1f,null))[_0xc324('0x2b')](removeEntity(_0x5a5b1f,null))[_0xc324('0x47')](handleError(_0x5a5b1f,null));};exports[_0xc324('0x4d')]=function(_0x26611a,_0x57ac02){return db[_0xc324('0x43')]['describe']()[_0xc324('0x2b')](respondWithResult(_0x57ac02,null))[_0xc324('0x47')](handleError(_0x57ac02,null));};exports[_0xc324('0x4e')]=function(_0xc77e31,_0x17f090){var _0x26f17b={},_0x4647b5={},_0x356dab={'count':0x0,'rows':[]};_0x4647b5[_0xc324('0x37')]=_[_0xc324('0x48')](db[_0xc324('0x43')][_0xc324('0x31')]);_0x4647b5[_0xc324('0x35')]=_[_0xc324('0x48')](_0xc77e31[_0xc324('0x35')]);_0x4647b5['filters']=_[_0xc324('0x39')](_0x4647b5[_0xc324('0x37')],_0x4647b5['query']);_0x26f17b[_0xc324('0x38')]=_[_0xc324('0x39')](_0x4647b5[_0xc324('0x37')],qs[_0xc324('0x3a')](_0xc77e31[_0xc324('0x35')]['fields']));_0x26f17b['attributes']=_0x26f17b['attributes'][_0xc324('0x3b')]?_0x26f17b[_0xc324('0x38')]:_0x4647b5[_0xc324('0x37')];if(!_0xc77e31['query'][_0xc324('0x3c')](_0xc324('0x4f'))){_0x26f17b['limit']=qs['limit'](_0xc77e31[_0xc324('0x35')]['limit']);_0x26f17b[_0xc324('0x21')]=qs[_0xc324('0x21')](_0xc77e31[_0xc324('0x35')]['offset']);}_0x26f17b[_0xc324('0x3d')]=qs[_0xc324('0x3e')](_0xc77e31['query']['sort']);_0x26f17b[_0xc324('0x3f')]=qs[_0xc324('0x36')](_[_0xc324('0x50')](_0xc77e31[_0xc324('0x35')],_0x4647b5[_0xc324('0x36')]));if(_0xc77e31[_0xc324('0x35')][_0xc324('0x40')]){_0x26f17b['where']=_[_0xc324('0x41')](_0x26f17b[_0xc324('0x3f')],{'$or':_['map'](_0x26f17b['attributes'],function(_0x8807c2){var _0x242d42={};_0x242d42[_0x8807c2]={'$like':'%'+_0xc77e31[_0xc324('0x35')][_0xc324('0x40')]+'%'};return _0x242d42;})});}_0x26f17b=_[_0xc324('0x41')]({},_0x26f17b,_0xc77e31[_0xc324('0x42')]);var _0x5de30f={'where':_0x26f17b[_0xc324('0x3f')]};return db[_0xc324('0x43')]['count'](_0x5de30f)['then'](function(_0xaa3f71){_0x356dab[_0xc324('0x24')]=_0xaa3f71;if(_0xc77e31[_0xc324('0x35')]['includeAll']){_0x26f17b[_0xc324('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xc324('0x46')](_0x26f17b);})['then'](function(_0x354a91){_0x356dab[_0xc324('0x51')]=_0x354a91;return _0x356dab;})['then'](respondWithFilteredResult(_0x17f090,_0x26f17b,_0xc324('0x4e')))[_0xc324('0x47')](handleError(_0x17f090,null,_0xc324('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3a351ad..5bce59d 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 _0xda6b=['remove','emit','hook','../../mysqldb','VoiceQueueReport','save'];(function(_0x1ad11f,_0x4558d0){var _0x349f3a=function(_0x939d84){while(--_0x939d84){_0x1ad11f['push'](_0x1ad11f['shift']());}};_0x349f3a(++_0x4558d0);}(_0xda6b,0x141));var _0xbda6=function(_0x3f3e4c,_0xa1cb65){_0x3f3e4c=_0x3f3e4c-0x0;var _0x33925f=_0xda6b[_0x3f3e4c];return _0x33925f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbda6('0x0'))['db'][_0xbda6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbda6('0x2'),'afterUpdate':'update','afterDestroy':_0xbda6('0x3')};function emitEvent(_0xb0ce56){return function(_0x118f90,_0x5a8b4e,_0x4a66db){VoiceQueueReportEvents[_0xbda6('0x4')](_0xb0ce56+':'+_0x118f90['id'],_0x118f90);VoiceQueueReportEvents['emit'](_0xb0ce56,_0x118f90);_0x4a66db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xbda6('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xed8c=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x6f6ff4,_0x196b0a){var _0x651649=function(_0x83acbd){while(--_0x83acbd){_0x6f6ff4['push'](_0x6f6ff4['shift']());}};_0x651649(++_0x196b0a);}(_0xed8c,0x135));var _0xced8=function(_0x3c990a,_0x4d270e){_0x3c990a=_0x3c990a-0x0;var _0x20effd=_0xed8c[_0x3c990a];return _0x20effd;};'use strict';var EventEmitter=require(_0xced8('0x0'));var VoiceQueueReport=require(_0xced8('0x1'))['db'][_0xced8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xced8('0x3')](0x0);var events={'afterCreate':_0xced8('0x4'),'afterUpdate':_0xced8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x554da0){return function(_0x405a1c,_0x46728e,_0x49a823){VoiceQueueReportEvents[_0xced8('0x6')](_0x554da0+':'+_0x405a1c['id'],_0x405a1c);VoiceQueueReportEvents['emit'](_0x554da0,_0x405a1c);_0x49a823(null);};}for(var e in events){if(events[_0xced8('0x7')](e)){var event=events[e];VoiceQueueReport[_0xced8('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 708f653..5c96874 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 _0xbfbe=['util','api','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x2c6d5a,_0x51903f){var _0x5ec196=function(_0x52e45a){while(--_0x52e45a){_0x2c6d5a['push'](_0x2c6d5a['shift']());}};_0x5ec196(++_0x51903f);}(_0xbfbe,0x143));var _0xebfb=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0xbfbe[_0x3dd0b9];return _0x4c0351;};'use strict';var _=require(_0xebfb('0x0'));var util=require(_0xebfb('0x1'));var logger=require('../../config/logger')(_0xebfb('0x2'));var moment=require('moment');var BPromise=require(_0xebfb('0x3'));var rp=require(_0xebfb('0x4'));var fs=require('fs');var path=require(_0xebfb('0x5'));var rimraf=require(_0xebfb('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xebfb('0x7')]=function(_0x589b78,_0x24be33){return _0x589b78[_0xebfb('0x8')](_0xebfb('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xebfb('0xa')]},{'fields':[_0xebfb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f1=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf2f1,0xee));var _0x1f2f=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xf2f1[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0x1f2f('0x0'));var util=require('util');var logger=require(_0x1f2f('0x1'))(_0x1f2f('0x2'));var moment=require(_0x1f2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f2f('0x4'));var fs=require('fs');var path=require(_0x1f2f('0x5'));var rimraf=require(_0x1f2f('0x6'));var config=require(_0x1f2f('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x1f2f('0x8')]=function(_0x399877,_0x551f9f){return _0x399877[_0x1f2f('0x9')](_0x1f2f('0xa'),attributes,{'tableName':_0x1f2f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x1f2f('0xc')]},{'fields':[_0x1f2f('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 6ede615..8d26bdd 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 _0xfc17=['raw','where','attributes','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport','findAll','options'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xfc17,0x10e));var _0x7fc1=function(_0x2ee202,_0x449507){_0x2ee202=_0x2ee202-0x0;var _0x36c32a=_0xfc17[_0x2ee202];return _0x36c32a;};'use strict';var _=require(_0x7fc1('0x0'));var util=require('util');var moment=require(_0x7fc1('0x1'));var BPromise=require(_0x7fc1('0x2'));var rs=require(_0x7fc1('0x3'));var fs=require('fs');var Redis=require(_0x7fc1('0x4'));var db=require(_0x7fc1('0x5'))['db'];var utils=require(_0x7fc1('0x6'));var logger=require(_0x7fc1('0x7'))(_0x7fc1('0x8'));var config=require(_0x7fc1('0x9'));var jayson=require(_0x7fc1('0xa'));var client=jayson['client'][_0x7fc1('0xb')]({'port':0x232a});config[_0x7fc1('0xc')]=_['defaults'](config[_0x7fc1('0xc')],{'host':_0x7fc1('0xd'),'port':0x18eb});var socket=require(_0x7fc1('0xe'))(new Redis(config[_0x7fc1('0xc')]));require(_0x7fc1('0xf'))[_0x7fc1('0x10')](socket);function respondWithRpcPromise(_0x594ff7,_0x36f7c4,_0xe3bba){return new BPromise(function(_0x5f0298,_0x5c92a8){return client['request'](_0x594ff7,_0xe3bba)[_0x7fc1('0x11')](function(_0x52d173){logger[_0x7fc1('0x12')](_0x7fc1('0x13'),_0x36f7c4,_0x7fc1('0x14'));logger[_0x7fc1('0x15')](_0x7fc1('0x16'),_0x36f7c4,_0x7fc1('0x14'),JSON[_0x7fc1('0x17')](_0x52d173));if(_0x52d173[_0x7fc1('0x18')]){if(_0x52d173['error']['code']===0x1f4){logger[_0x7fc1('0x18')](_0x7fc1('0x13'),_0x36f7c4,_0x52d173[_0x7fc1('0x18')][_0x7fc1('0x19')]);return _0x5c92a8(_0x52d173['error'][_0x7fc1('0x19')]);}logger[_0x7fc1('0x18')](_0x7fc1('0x13'),_0x36f7c4,_0x52d173[_0x7fc1('0x18')][_0x7fc1('0x19')]);return _0x5f0298(_0x52d173[_0x7fc1('0x18')]['message']);}else{logger[_0x7fc1('0x12')](_0x7fc1('0x13'),_0x36f7c4,_0x7fc1('0x14'));_0x5f0298(_0x52d173[_0x7fc1('0x1a')][_0x7fc1('0x19')]);}})[_0x7fc1('0x1b')](function(_0x2f330){logger[_0x7fc1('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x36f7c4,_0x2f330);_0x5c92a8(_0x2f330);});});}exports['GetVoiceQueueReport']=function(_0x7fce05){var _0x46f6bf=this;return new Promise(function(_0x3da554,_0x59f047){return db[_0x7fc1('0x1c')][_0x7fc1('0x1d')]({'raw':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x1f')]===undefined?!![]:![]:!![],'where':_0x7fce05['options']?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x20')]||null:null,'attributes':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x21')]||null:null,'limit':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')]['limit']||null:null,'include':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05['options'][_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x7fce05['options'][_0x7fc1('0x22')],function(_0x496ed5){return{'model':db[_0x496ed5[_0x7fc1('0x24')]],'as':_0x496ed5['as'],'attributes':_0x496ed5['attributes'],'include':_0x496ed5[_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x496ed5[_0x7fc1('0x22')],function(_0x4b1776){return{'model':db[_0x4b1776['model']],'as':_0x4b1776['as'],'attributes':_0x4b1776['attributes'],'include':_0x4b1776[_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x4b1776[_0x7fc1('0x22')],function(_0x27bba0){return{'model':db[_0x27bba0[_0x7fc1('0x24')]],'as':_0x27bba0['as'],'attributes':_0x27bba0[_0x7fc1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7fc1('0x11')](function(_0x1eb9e0){logger[_0x7fc1('0x12')](_0x7fc1('0x25'),_0x7fce05);logger[_0x7fc1('0x15')]('GetVoiceQueueReport',_0x7fce05,JSON[_0x7fc1('0x17')](_0x1eb9e0));_0x3da554(_0x1eb9e0);})['catch'](function(_0x23aa80){logger[_0x7fc1('0x18')](_0x7fc1('0x25'),_0x23aa80[_0x7fc1('0x19')],_0x7fce05);_0x59f047(_0x46f6bf[_0x7fc1('0x18')](0x1f4,_0x23aa80[_0x7fc1('0x19')]));});});};exports[_0x7fc1('0x26')]=function(_0x502ca8){var _0x333393=this;return new Promise(function(_0xf81302,_0x586bae){return db['VoiceQueueReport']['create'](_0x502ca8[_0x7fc1('0x27')],{'raw':_0x502ca8[_0x7fc1('0x1e')]?_0x502ca8[_0x7fc1('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x7fc1('0x11')](function(_0x25bcc3){logger[_0x7fc1('0x12')](_0x7fc1('0x26'),_0x502ca8);logger[_0x7fc1('0x15')](_0x7fc1('0x26'),_0x502ca8,JSON[_0x7fc1('0x17')](_0x25bcc3));_0xf81302(_0x25bcc3);})[_0x7fc1('0x1b')](function(_0x3fe87c){logger[_0x7fc1('0x18')]('CreateVoiceQueueReport',_0x3fe87c['message'],_0x502ca8);_0x586bae(_0x333393['error'](0x1f4,_0x3fe87c[_0x7fc1('0x19')]));});});};exports[_0x7fc1('0x28')]=function(_0x3488f3){var _0x56112f=this;return new Promise(function(_0x4a29b2,_0x518e40){return db[_0x7fc1('0x1c')][_0x7fc1('0x29')](_0x3488f3[_0x7fc1('0x27')],{'raw':_0x3488f3[_0x7fc1('0x1e')]?_0x3488f3[_0x7fc1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3488f3['options']?_0x3488f3[_0x7fc1('0x1e')]['where']||null:null,'attributes':_0x3488f3[_0x7fc1('0x1e')]?_0x3488f3['options'][_0x7fc1('0x21')]||null:null,'limit':_0x3488f3['options']?_0x3488f3['options'][_0x7fc1('0x2a')]||null:null})[_0x7fc1('0x11')](function(_0x7e0c0b){logger[_0x7fc1('0x12')](_0x7fc1('0x28'),_0x3488f3);logger[_0x7fc1('0x15')](_0x7fc1('0x28'),_0x3488f3,JSON[_0x7fc1('0x17')](_0x7e0c0b));_0x4a29b2(_0x7e0c0b);})[_0x7fc1('0x1b')](function(_0x2c8e68){logger[_0x7fc1('0x18')](_0x7fc1('0x28'),_0x2c8e68['message'],_0x3488f3);_0x518e40(_0x56112f[_0x7fc1('0x18')](0x1f4,_0x2c8e68[_0x7fc1('0x19')]));});});}; \ No newline at end of file +var _0xfa8b=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','map','model','include','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x14cd13,_0x2a2097){var _0x13e84a=function(_0x4c1207){while(--_0x4c1207){_0x14cd13['push'](_0x14cd13['shift']());}};_0x13e84a(++_0x2a2097);}(_0xfa8b,0x163));var _0xbfa8=function(_0x59c1b8,_0x251576){_0x59c1b8=_0x59c1b8-0x0;var _0x202875=_0xfa8b[_0x59c1b8];return _0x202875;};'use strict';var _=require(_0xbfa8('0x0'));var util=require(_0xbfa8('0x1'));var moment=require(_0xbfa8('0x2'));var BPromise=require(_0xbfa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfa8('0x4'))['db'];var utils=require(_0xbfa8('0x5'));var logger=require(_0xbfa8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfa8('0x7')][_0xbfa8('0x8')]({'port':0x232a});config[_0xbfa8('0x9')]=_[_0xbfa8('0xa')](config[_0xbfa8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbfa8('0xb'))(new Redis(config[_0xbfa8('0x9')]));require(_0xbfa8('0xc'))[_0xbfa8('0xd')](socket);function respondWithRpcPromise(_0x19e950,_0x390301,_0x3922b2){return new BPromise(function(_0x330253,_0x17fd15){return client[_0xbfa8('0xe')](_0x19e950,_0x3922b2)[_0xbfa8('0xf')](function(_0x5ee759){logger[_0xbfa8('0x10')](_0xbfa8('0x11'),_0x390301,_0xbfa8('0x12'));logger[_0xbfa8('0x13')](_0xbfa8('0x14'),_0x390301,'request\x20sent',JSON[_0xbfa8('0x15')](_0x5ee759));if(_0x5ee759['error']){if(_0x5ee759[_0xbfa8('0x16')][_0xbfa8('0x17')]===0x1f4){logger[_0xbfa8('0x16')](_0xbfa8('0x11'),_0x390301,_0x5ee759[_0xbfa8('0x16')][_0xbfa8('0x18')]);return _0x17fd15(_0x5ee759[_0xbfa8('0x16')][_0xbfa8('0x18')]);}logger[_0xbfa8('0x16')](_0xbfa8('0x11'),_0x390301,_0x5ee759[_0xbfa8('0x16')][_0xbfa8('0x18')]);return _0x330253(_0x5ee759[_0xbfa8('0x16')]['message']);}else{logger[_0xbfa8('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x390301,_0xbfa8('0x12'));_0x330253(_0x5ee759[_0xbfa8('0x19')][_0xbfa8('0x18')]);}})[_0xbfa8('0x1a')](function(_0x274e83){logger[_0xbfa8('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x390301,_0x274e83);_0x17fd15(_0x274e83);});});}exports['GetVoiceQueueReport']=function(_0x14f1cb){var _0x1cfd05=this;return new Promise(function(_0x4e93c0,_0x3652c7){return db['VoiceQueueReport']['findAll']({'raw':_0x14f1cb['options']?_0x14f1cb[_0xbfa8('0x1b')][_0xbfa8('0x1c')]===undefined?!![]:![]:!![],'where':_0x14f1cb['options']?_0x14f1cb['options']['where']||null:null,'attributes':_0x14f1cb['options']?_0x14f1cb['options'][_0xbfa8('0x1d')]||null:null,'limit':_0x14f1cb[_0xbfa8('0x1b')]?_0x14f1cb[_0xbfa8('0x1b')][_0xbfa8('0x1e')]||null:null,'include':_0x14f1cb[_0xbfa8('0x1b')]?_0x14f1cb['options']['include']?_[_0xbfa8('0x1f')](_0x14f1cb['options']['include'],function(_0x23ef3f){return{'model':db[_0x23ef3f[_0xbfa8('0x20')]],'as':_0x23ef3f['as'],'attributes':_0x23ef3f['attributes'],'include':_0x23ef3f['include']?_['map'](_0x23ef3f[_0xbfa8('0x21')],function(_0x410aed){return{'model':db[_0x410aed[_0xbfa8('0x20')]],'as':_0x410aed['as'],'attributes':_0x410aed[_0xbfa8('0x1d')],'include':_0x410aed[_0xbfa8('0x21')]?_['map'](_0x410aed['include'],function(_0x39b48b){return{'model':db[_0x39b48b[_0xbfa8('0x20')]],'as':_0x39b48b['as'],'attributes':_0x39b48b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfa8('0xf')](function(_0x43516d){logger['info'](_0xbfa8('0x22'),_0x14f1cb);logger['debug'](_0xbfa8('0x22'),_0x14f1cb,JSON[_0xbfa8('0x15')](_0x43516d));_0x4e93c0(_0x43516d);})['catch'](function(_0x2f258f){logger[_0xbfa8('0x16')]('GetVoiceQueueReport',_0x2f258f[_0xbfa8('0x18')],_0x14f1cb);_0x3652c7(_0x1cfd05[_0xbfa8('0x16')](0x1f4,_0x2f258f[_0xbfa8('0x18')]));});});};exports[_0xbfa8('0x23')]=function(_0x1937f){var _0x42008d=this;return new Promise(function(_0x2474f6,_0xb55787){return db[_0xbfa8('0x24')][_0xbfa8('0x25')](_0x1937f[_0xbfa8('0x26')],{'raw':_0x1937f['options']?_0x1937f[_0xbfa8('0x1b')][_0xbfa8('0x1c')]===undefined?!![]:![]:!![]})[_0xbfa8('0xf')](function(_0x1606f6){logger[_0xbfa8('0x10')](_0xbfa8('0x23'),_0x1937f);logger[_0xbfa8('0x13')](_0xbfa8('0x23'),_0x1937f,JSON[_0xbfa8('0x15')](_0x1606f6));_0x2474f6(_0x1606f6);})[_0xbfa8('0x1a')](function(_0x34e6c0){logger[_0xbfa8('0x16')](_0xbfa8('0x23'),_0x34e6c0['message'],_0x1937f);_0xb55787(_0x42008d[_0xbfa8('0x16')](0x1f4,_0x34e6c0['message']));});});};exports[_0xbfa8('0x27')]=function(_0x3f346a){var _0x199e33=this;return new Promise(function(_0x26eefe,_0x6c8c30){return db[_0xbfa8('0x24')][_0xbfa8('0x28')](_0x3f346a[_0xbfa8('0x26')],{'raw':_0x3f346a['options']?_0x3f346a['options'][_0xbfa8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f346a[_0xbfa8('0x1b')]?_0x3f346a[_0xbfa8('0x1b')]['where']||null:null,'attributes':_0x3f346a[_0xbfa8('0x1b')]?_0x3f346a['options']['attributes']||null:null,'limit':_0x3f346a[_0xbfa8('0x1b')]?_0x3f346a[_0xbfa8('0x1b')][_0xbfa8('0x1e')]||null:null})['then'](function(_0x1b02e7){logger[_0xbfa8('0x10')]('UpdateVoiceQueueReport',_0x3f346a);logger[_0xbfa8('0x13')](_0xbfa8('0x27'),_0x3f346a,JSON[_0xbfa8('0x15')](_0x1b02e7));_0x26eefe(_0x1b02e7);})[_0xbfa8('0x1a')](function(_0x23cabd){logger[_0xbfa8('0x16')]('UpdateVoiceQueueReport',_0x23cabd[_0xbfa8('0x18')],_0x3f346a);_0x6c8c30(_0x199e33[_0xbfa8('0x16')](0x1f4,_0x23cabd[_0xbfa8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 905705e..9fb3795 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 _0xc8e9=['register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0xc8e9,0x1f4));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x9c8e('0x0'),_0x9c8e('0x1'),_0x9c8e('0x2')];function createListener(_0x4fc891,_0x5b9e9a){return function(_0x703475){_0x5b9e9a[_0x9c8e('0x3')](_0x4fc891,_0x703475);};}function removeListener(_0x1cb493,_0x147e2b){return function(){VoiceQueueReportEvents['removeListener'](_0x1cb493,_0x147e2b);};}exports[_0x9c8e('0x4')]=function(_0x38c013){for(var _0x241bea=0x0,_0x431c51=events[_0x9c8e('0x5')];_0x241bea<_0x431c51;_0x241bea++){var _0x1d7de1=events[_0x241bea];var _0x3864c8=createListener(_0x9c8e('0x6')+_0x1d7de1,_0x38c013);VoiceQueueReportEvents['on'](_0x1d7de1,_0x3864c8);}}; \ No newline at end of file +var _0xe131=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','emit','removeListener'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe131,0x1b5));var _0x1e13=function(_0x50c965,_0x36cac7){_0x50c965=_0x50c965-0x0;var _0x370062=_0xe131[_0x50c965];return _0x370062;};'use strict';var VoiceQueueReportEvents=require(_0x1e13('0x0'));var events=[_0x1e13('0x1'),'remove','update'];function createListener(_0x1e422a,_0x585d3e){return function(_0x5d0ccc){_0x585d3e[_0x1e13('0x2')](_0x1e422a,_0x5d0ccc);};}function removeListener(_0x2680ec,_0x1cabf5){return function(){VoiceQueueReportEvents[_0x1e13('0x3')](_0x2680ec,_0x1cabf5);};}exports[_0x1e13('0x4')]=function(_0x440239){for(var _0x3ec2e6=0x0,_0x3d272f=events[_0x1e13('0x5')];_0x3ec2e6<_0x3d272f;_0x3ec2e6++){var _0x477d58=events[_0x3ec2e6];var _0x65a30d=createListener(_0x1e13('0x6')+_0x477d58,_0x440239);VoiceQueueReportEvents['on'](_0x477d58,_0x65a30d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3180178..389a3a3 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 _0xc092=['delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xe74768,_0x4c0bf9){var _0x302e8a=function(_0x5ba5c8){while(--_0x5ba5c8){_0xe74768['push'](_0xe74768['shift']());}};_0x302e8a(++_0x4c0bf9);}(_0xc092,0x122));var _0x2c09=function(_0x1b96ea,_0x20fa69){_0x1b96ea=_0x1b96ea-0x0;var _0x2a0d86=_0xc092[_0x1b96ea];return _0x2a0d86;};'use strict';var multer=require(_0x2c09('0x0'));var util=require(_0x2c09('0x1'));var path=require(_0x2c09('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c09('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c09('0x4'));var interaction=require(_0x2c09('0x5'));var config=require(_0x2c09('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x2c09('0x7')]('/',auth[_0x2c09('0x8')](),controller[_0x2c09('0x9')]);router[_0x2c09('0x7')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller[_0x2c09('0xb')]);router[_0x2c09('0xc')]('/',auth[_0x2c09('0x8')](),controller['create']);router[_0x2c09('0xd')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller['update']);router[_0x2c09('0xe')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller[_0x2c09('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8f2f=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x36cdd3,_0x5e6a97){var _0x140d84=function(_0x2dd7c6){while(--_0x2dd7c6){_0x36cdd3['push'](_0x36cdd3['shift']());}};_0x140d84(++_0x5e6a97);}(_0x8f2f,0x1b6));var _0xf8f2=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x8f2f[_0xa8883];return _0x479426;};'use strict';var multer=require(_0xf8f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf8f2('0x1'));var express=require(_0xf8f2('0x2'));var router=express[_0xf8f2('0x3')]();var fs_extra=require(_0xf8f2('0x4'));var auth=require(_0xf8f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8f2('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0xf8f2('0x7')]('/',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0x9')]);router[_0xf8f2('0x7')]('/:id',auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xa')]);router[_0xf8f2('0xb')]('/',auth['isAuthenticated'](),controller[_0xf8f2('0xc')]);router[_0xf8f2('0xd')](_0xf8f2('0xe'),auth[_0xf8f2('0x8')](),controller['update']);router['delete'](_0xf8f2('0xe'),auth[_0xf8f2('0x8')](),controller[_0xf8f2('0xf')]);module[_0xf8f2('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 9f80ca3..37f8b06 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 _0x47ea=['moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x58f678,_0x18b3cc){var _0x238aef=function(_0x339e5d){while(--_0x339e5d){_0x58f678['push'](_0x58f678['shift']());}};_0x238aef(++_0x18b3cc);}(_0x47ea,0xd7));var _0xa47e=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x47ea[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xa47e('0x0'));var moment=require(_0xa47e('0x1'));module[_0xa47e('0x2')]={'time':{'type':Sequelize[_0xa47e('0x3')]},'callid':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa47e('0x4')](_0xa47e('0x5'))}}; \ No newline at end of file +var _0xd61f=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','STRING'];(function(_0x5bf2e7,_0x1ca562){var _0x2a556a=function(_0x363fc2){while(--_0x363fc2){_0x5bf2e7['push'](_0x5bf2e7['shift']());}};_0x2a556a(++_0x1ca562);}(_0xd61f,0xe4));var _0xfd61=function(_0x19d5ac,_0x35922c){_0x19d5ac=_0x19d5ac-0x0;var _0x5073b9=_0xd61f[_0x19d5ac];return _0x5073b9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfd61('0x0')]={'time':{'type':Sequelize[_0xfd61('0x1')]},'callid':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfd61('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfd61('0x2')],'allowNull':![],'defaultValue':Sequelize[_0xfd61('0x3')](_0xfd61('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 118e14e..23c820f 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 _0x80f3=['then','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','VoiceQueuesLog','rows','catch','keys','includeAll','options','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x22cf20,_0x2811b5){var _0x2909b1=function(_0x367b24){while(--_0x367b24){_0x22cf20['push'](_0x22cf20['shift']());}};_0x2909b1(++_0x2811b5);}(_0x80f3,0x1cd));var _0x380f=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0x80f3[_0x1f6691];return _0xf786b6;};'use strict';var emlformat=require(_0x380f('0x0'));var rimraf=require(_0x380f('0x1'));var zipdir=require(_0x380f('0x2'));var jsonpatch=require(_0x380f('0x3'));var rp=require(_0x380f('0x4'));var moment=require(_0x380f('0x5'));var BPromise=require(_0x380f('0x6'));var Mustache=require(_0x380f('0x7'));var util=require(_0x380f('0x8'));var path=require('path');var sox=require(_0x380f('0x9'));var csv=require(_0x380f('0xa'));var ejs=require(_0x380f('0xb'));var fs=require('fs');var fs_extra=require(_0x380f('0xc'));var _=require(_0x380f('0xd'));var squel=require(_0x380f('0xe'));var crypto=require(_0x380f('0xf'));var jsforce=require(_0x380f('0x10'));var deskjs=require(_0x380f('0x11'));var toCsv=require(_0x380f('0xa'));var querystring=require(_0x380f('0x12'));var Papa=require(_0x380f('0x13'));var Redis=require(_0x380f('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x380f('0x15'));var logger=require('../../config/logger')(_0x380f('0x16'));var utils=require('../../config/utils');var config=require(_0x380f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x380f('0x18'))['db'];function respondWithStatusCode(_0x1a8d81,_0x42c990){_0x42c990=_0x42c990||0xcc;return function(_0x4994ce){if(_0x4994ce){return _0x1a8d81[_0x380f('0x19')](_0x42c990);}return _0x1a8d81[_0x380f('0x1a')](_0x42c990)[_0x380f('0x1b')]();};}function respondWithResult(_0x45aa62,_0x100120){_0x100120=_0x100120||0xc8;return function(_0x29ae62){if(_0x29ae62){return _0x45aa62[_0x380f('0x1a')](_0x100120)[_0x380f('0x1c')](_0x29ae62);}};}function respondWithFilteredResult(_0x14e849,_0x5e6caf){return function(_0x5ae05e){if(_0x5ae05e){var _0x5ae522=typeof _0x5e6caf[_0x380f('0x1d')]===_0x380f('0x1e')&&typeof _0x5e6caf[_0x380f('0x1f')]===_0x380f('0x1e');var _0x569619=_0x5ae05e[_0x380f('0x20')];var _0x3ba46f=_0x5ae522?0x0:_0x5e6caf[_0x380f('0x1d')];var _0x13b0ac=_0x5ae522?_0x5ae05e['count']:_0x5e6caf[_0x380f('0x1d')]+_0x5e6caf[_0x380f('0x1f')];var _0x516ade;if(_0x13b0ac>=_0x569619){_0x13b0ac=_0x569619;_0x516ade=0xc8;}else{_0x516ade=0xce;}_0x14e849[_0x380f('0x1a')](_0x516ade);return _0x14e849[_0x380f('0x21')](_0x380f('0x22'),_0x3ba46f+'-'+_0x13b0ac+'/'+_0x569619)[_0x380f('0x1c')](_0x5ae05e);}return null;};}function patchUpdates(_0x4a989b){return function(_0x52be9d){try{jsonpatch['apply'](_0x52be9d,_0x4a989b,!![]);}catch(_0x34f749){return BPromise['reject'](_0x34f749);}return _0x52be9d[_0x380f('0x23')]();};}function saveUpdates(_0x345524,_0x552190){return function(_0x52d82b){if(_0x52d82b){return _0x52d82b['update'](_0x345524)['then'](function(_0x2abb7f){return _0x2abb7f;});}return null;};}function removeEntity(_0x170055,_0x5ec35a){return function(_0x4ccc39){if(_0x4ccc39){return _0x4ccc39['destroy']()[_0x380f('0x24')](function(){_0x170055[_0x380f('0x1a')](0xcc)[_0x380f('0x1b')]();});}};}function handleEntityNotFound(_0x5352f7,_0x43e10e){return function(_0x49b61b){if(!_0x49b61b){_0x5352f7['sendStatus'](0x194);}return _0x49b61b;};}function handleError(_0x35443b,_0x24a084){_0x24a084=_0x24a084||0x1f4;return function(_0x47bab2){logger[_0x380f('0x25')](_0x47bab2['stack']);if(_0x47bab2[_0x380f('0x26')]){delete _0x47bab2[_0x380f('0x26')];}_0x35443b['status'](_0x24a084)[_0x380f('0x27')](_0x47bab2);};}exports[_0x380f('0x28')]=function(_0x31f025,_0x3ba8aa){var _0x1c5800={},_0x62c4e3={},_0x22e212={'count':0x0,'rows':[]};var _0x5b1e0e=_[_0x380f('0x29')](db['VoiceQueuesLog'][_0x380f('0x2a')],function(_0x432c8c){return{'name':_0x432c8c['fieldName'],'type':_0x432c8c[_0x380f('0x2b')]['key']};});_0x62c4e3[_0x380f('0x2c')]=_[_0x380f('0x29')](_0x5b1e0e,'name');_0x62c4e3[_0x380f('0x2d')]=_['keys'](_0x31f025[_0x380f('0x2d')]);_0x62c4e3[_0x380f('0x2e')]=_[_0x380f('0x2f')](_0x62c4e3[_0x380f('0x2c')],_0x62c4e3[_0x380f('0x2d')]);_0x1c5800['attributes']=_['intersection'](_0x62c4e3[_0x380f('0x2c')],qs[_0x380f('0x30')](_0x31f025[_0x380f('0x2d')][_0x380f('0x30')]));_0x1c5800[_0x380f('0x31')]=_0x1c5800[_0x380f('0x31')][_0x380f('0x32')]?_0x1c5800[_0x380f('0x31')]:_0x62c4e3[_0x380f('0x2c')];if(!_0x31f025[_0x380f('0x2d')][_0x380f('0x33')]('nolimit')){_0x1c5800[_0x380f('0x1f')]=qs[_0x380f('0x1f')](_0x31f025[_0x380f('0x2d')][_0x380f('0x1f')]);_0x1c5800['offset']=qs[_0x380f('0x1d')](_0x31f025[_0x380f('0x2d')][_0x380f('0x1d')]);}_0x1c5800[_0x380f('0x34')]=qs['sort'](_0x31f025[_0x380f('0x2d')][_0x380f('0x35')]);_0x1c5800[_0x380f('0x36')]=qs['filters'](_['pick'](_0x31f025['query'],_0x62c4e3[_0x380f('0x2e')]),_0x5b1e0e);if(_0x31f025[_0x380f('0x2d')][_0x380f('0x37')]){_0x1c5800[_0x380f('0x36')]=_[_0x380f('0x38')](_0x1c5800['where'],{'$or':_[_0x380f('0x29')](_0x5b1e0e,function(_0xc5b094){if(_0xc5b094[_0x380f('0x2b')]!==_0x380f('0x39')){var _0xe5e013={};_0xe5e013[_0xc5b094[_0x380f('0x26')]]={'$like':'%'+_0x31f025[_0x380f('0x2d')][_0x380f('0x37')]+'%'};return _0xe5e013;}})});}_0x1c5800=_[_0x380f('0x38')]({},_0x1c5800,_0x31f025['options']);var _0x46b77c={'where':_0x1c5800['where']};return db['VoiceQueuesLog'][_0x380f('0x20')](_0x46b77c)['then'](function(_0x3c1984){_0x22e212['count']=_0x3c1984;if(_0x31f025['query']['includeAll']){_0x1c5800[_0x380f('0x3a')]=[{'all':!![]}];}return db[_0x380f('0x3b')]['findAll'](_0x1c5800);})['then'](function(_0x54773a){_0x22e212[_0x380f('0x3c')]=_0x54773a;return _0x22e212;})[_0x380f('0x24')](respondWithFilteredResult(_0x3ba8aa,_0x1c5800))[_0x380f('0x3d')](handleError(_0x3ba8aa,null));};exports['show']=function(_0x2a2ebb,_0x762fa8){var _0xf3b9d3={'raw':!![],'where':{'id':_0x2a2ebb['params']['id']}},_0x1950ff={};_0x1950ff[_0x380f('0x2c')]=_[_0x380f('0x3e')](db['VoiceQueuesLog'][_0x380f('0x2a')]);_0x1950ff['query']=_[_0x380f('0x3e')](_0x2a2ebb[_0x380f('0x2d')]);_0x1950ff[_0x380f('0x2e')]=_[_0x380f('0x2f')](_0x1950ff[_0x380f('0x2c')],_0x1950ff[_0x380f('0x2d')]);_0xf3b9d3[_0x380f('0x31')]=_['intersection'](_0x1950ff[_0x380f('0x2c')],qs[_0x380f('0x30')](_0x2a2ebb[_0x380f('0x2d')][_0x380f('0x30')]));_0xf3b9d3[_0x380f('0x31')]=_0xf3b9d3[_0x380f('0x31')][_0x380f('0x32')]?_0xf3b9d3[_0x380f('0x31')]:_0x1950ff[_0x380f('0x2c')];if(_0x2a2ebb[_0x380f('0x2d')][_0x380f('0x3f')]){_0xf3b9d3[_0x380f('0x3a')]=[{'all':!![]}];}_0xf3b9d3=_[_0x380f('0x38')]({},_0xf3b9d3,_0x2a2ebb[_0x380f('0x40')]);return db[_0x380f('0x3b')][_0x380f('0x41')](_0xf3b9d3)[_0x380f('0x24')](handleEntityNotFound(_0x762fa8,null))[_0x380f('0x24')](respondWithResult(_0x762fa8,null))[_0x380f('0x3d')](handleError(_0x762fa8,null));};exports['create']=function(_0x4f0a0a,_0x9a2d62){return db['VoiceQueuesLog'][_0x380f('0x42')](_0x4f0a0a[_0x380f('0x43')],{})['then'](respondWithResult(_0x9a2d62,0xc9))['catch'](handleError(_0x9a2d62,null));};exports[_0x380f('0x44')]=function(_0x5af433,_0x374194){if(_0x5af433['body']['id']){delete _0x5af433[_0x380f('0x43')]['id'];}return db['VoiceQueuesLog'][_0x380f('0x41')]({'where':{'id':_0x5af433[_0x380f('0x45')]['id']}})['then'](handleEntityNotFound(_0x374194,null))[_0x380f('0x24')](saveUpdates(_0x5af433['body'],null))[_0x380f('0x24')](respondWithResult(_0x374194,null))[_0x380f('0x3d')](handleError(_0x374194,null));};exports[_0x380f('0x46')]=function(_0x3a0e80,_0x1b00a7){return db['VoiceQueuesLog'][_0x380f('0x41')]({'where':{'id':_0x3a0e80['params']['id']}})[_0x380f('0x24')](handleEntityNotFound(_0x1b00a7,null))[_0x380f('0x24')](removeEntity(_0x1b00a7,null))[_0x380f('0x3d')](handleError(_0x1b00a7,null));}; \ No newline at end of file +var _0x401a=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','VoiceQueuesLog','include','findAll','catch','show','params','includeAll'];(function(_0x1c204b,_0x126bc7){var _0xb4b09=function(_0x2f8de8){while(--_0x2f8de8){_0x1c204b['push'](_0x1c204b['shift']());}};_0xb4b09(++_0x126bc7);}(_0x401a,0x99));var _0xa401=function(_0x4c9c70,_0x5c3955){_0x4c9c70=_0x4c9c70-0x0;var _0x2583ef=_0x401a[_0x4c9c70];return _0x2583ef;};'use strict';var emlformat=require(_0xa401('0x0'));var rimraf=require(_0xa401('0x1'));var zipdir=require(_0xa401('0x2'));var jsonpatch=require(_0xa401('0x3'));var rp=require(_0xa401('0x4'));var moment=require(_0xa401('0x5'));var BPromise=require(_0xa401('0x6'));var Mustache=require(_0xa401('0x7'));var util=require(_0xa401('0x8'));var path=require(_0xa401('0x9'));var sox=require(_0xa401('0xa'));var csv=require('to-csv');var ejs=require(_0xa401('0xb'));var fs=require('fs');var fs_extra=require(_0xa401('0xc'));var _=require(_0xa401('0xd'));var squel=require(_0xa401('0xe'));var crypto=require('crypto');var jsforce=require(_0xa401('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa401('0x10'));var querystring=require(_0xa401('0x11'));var Papa=require('papaparse');var Redis=require(_0xa401('0x12'));var authService=require(_0xa401('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa401('0x14'));var hardwareService=require(_0xa401('0x15'));var logger=require(_0xa401('0x16'))(_0xa401('0x17'));var utils=require('../../config/utils');var config=require(_0xa401('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa401('0x19'))['db'];function respondWithStatusCode(_0x2bf202,_0x149540){_0x149540=_0x149540||0xcc;return function(_0x25404){if(_0x25404){return _0x2bf202[_0xa401('0x1a')](_0x149540);}return _0x2bf202[_0xa401('0x1b')](_0x149540)[_0xa401('0x1c')]();};}function respondWithResult(_0x57a050,_0x280e49){_0x280e49=_0x280e49||0xc8;return function(_0x111ef4){if(_0x111ef4){return _0x57a050['status'](_0x280e49)[_0xa401('0x1d')](_0x111ef4);}};}function respondWithFilteredResult(_0x312301,_0x5d91de){return function(_0x1e562a){if(_0x1e562a){var _0x528c69=typeof _0x5d91de[_0xa401('0x1e')]===_0xa401('0x1f')&&typeof _0x5d91de[_0xa401('0x20')]==='undefined';var _0x3c0cf2=_0x1e562a['count'];var _0x81d95e=_0x528c69?0x0:_0x5d91de[_0xa401('0x1e')];var _0x4a8abe=_0x528c69?_0x1e562a[_0xa401('0x21')]:_0x5d91de[_0xa401('0x1e')]+_0x5d91de[_0xa401('0x20')];var _0x4b1d4e;if(_0x4a8abe>=_0x3c0cf2){_0x4a8abe=_0x3c0cf2;_0x4b1d4e=0xc8;}else{_0x4b1d4e=0xce;}_0x312301[_0xa401('0x1b')](_0x4b1d4e);return _0x312301[_0xa401('0x22')]('Content-Range',_0x81d95e+'-'+_0x4a8abe+'/'+_0x3c0cf2)[_0xa401('0x1d')](_0x1e562a);}return null;};}function patchUpdates(_0x2c9d68){return function(_0x555f7f){try{jsonpatch[_0xa401('0x23')](_0x555f7f,_0x2c9d68,!![]);}catch(_0x56ae51){return BPromise['reject'](_0x56ae51);}return _0x555f7f[_0xa401('0x24')]();};}function saveUpdates(_0x4e0367,_0x23bb99){return function(_0x3be277){if(_0x3be277){return _0x3be277[_0xa401('0x25')](_0x4e0367)[_0xa401('0x26')](function(_0x4e3eb4){return _0x4e3eb4;});}return null;};}function removeEntity(_0x566d4e,_0x399928){return function(_0x19d841){if(_0x19d841){return _0x19d841[_0xa401('0x27')]()[_0xa401('0x26')](function(){_0x566d4e[_0xa401('0x1b')](0xcc)[_0xa401('0x1c')]();});}};}function handleEntityNotFound(_0x55e541,_0x1f7382){return function(_0x52043b){if(!_0x52043b){_0x55e541[_0xa401('0x1a')](0x194);}return _0x52043b;};}function handleError(_0x2ef1e0,_0xd1ef2e){_0xd1ef2e=_0xd1ef2e||0x1f4;return function(_0x2e2dc5){logger[_0xa401('0x28')](_0x2e2dc5[_0xa401('0x29')]);if(_0x2e2dc5['name']){delete _0x2e2dc5[_0xa401('0x2a')];}_0x2ef1e0[_0xa401('0x1b')](_0xd1ef2e)[_0xa401('0x2b')](_0x2e2dc5);};}exports['index']=function(_0x39df2d,_0x2d34e6){var _0x15c66e={},_0x1e7c6c={},_0x43b2b0={'count':0x0,'rows':[]};var _0x131ae1=_['map'](db['VoiceQueuesLog'][_0xa401('0x2c')],function(_0x4e83a6){return{'name':_0x4e83a6['fieldName'],'type':_0x4e83a6['type']['key']};});_0x1e7c6c[_0xa401('0x2d')]=_[_0xa401('0x2e')](_0x131ae1,_0xa401('0x2a'));_0x1e7c6c[_0xa401('0x2f')]=_[_0xa401('0x30')](_0x39df2d[_0xa401('0x2f')]);_0x1e7c6c[_0xa401('0x31')]=_[_0xa401('0x32')](_0x1e7c6c[_0xa401('0x2d')],_0x1e7c6c['query']);_0x15c66e[_0xa401('0x33')]=_[_0xa401('0x32')](_0x1e7c6c[_0xa401('0x2d')],qs[_0xa401('0x34')](_0x39df2d[_0xa401('0x2f')]['fields']));_0x15c66e['attributes']=_0x15c66e['attributes'][_0xa401('0x35')]?_0x15c66e[_0xa401('0x33')]:_0x1e7c6c[_0xa401('0x2d')];if(!_0x39df2d[_0xa401('0x2f')][_0xa401('0x36')](_0xa401('0x37'))){_0x15c66e[_0xa401('0x20')]=qs['limit'](_0x39df2d['query']['limit']);_0x15c66e[_0xa401('0x1e')]=qs['offset'](_0x39df2d[_0xa401('0x2f')]['offset']);}_0x15c66e[_0xa401('0x38')]=qs[_0xa401('0x39')](_0x39df2d['query'][_0xa401('0x39')]);_0x15c66e[_0xa401('0x3a')]=qs[_0xa401('0x31')](_[_0xa401('0x3b')](_0x39df2d[_0xa401('0x2f')],_0x1e7c6c[_0xa401('0x31')]),_0x131ae1);if(_0x39df2d[_0xa401('0x2f')]['filter']){_0x15c66e['where']=_['merge'](_0x15c66e[_0xa401('0x3a')],{'$or':_['map'](_0x131ae1,function(_0x3919d7){if(_0x3919d7[_0xa401('0x3c')]!==_0xa401('0x3d')){var _0x40d3cf={};_0x40d3cf[_0x3919d7[_0xa401('0x2a')]]={'$like':'%'+_0x39df2d['query'][_0xa401('0x3e')]+'%'};return _0x40d3cf;}})});}_0x15c66e=_[_0xa401('0x3f')]({},_0x15c66e,_0x39df2d[_0xa401('0x40')]);var _0x451d39={'where':_0x15c66e[_0xa401('0x3a')]};return db[_0xa401('0x41')]['count'](_0x451d39)[_0xa401('0x26')](function(_0x16ca25){_0x43b2b0[_0xa401('0x21')]=_0x16ca25;if(_0x39df2d[_0xa401('0x2f')]['includeAll']){_0x15c66e[_0xa401('0x42')]=[{'all':!![]}];}return db[_0xa401('0x41')][_0xa401('0x43')](_0x15c66e);})[_0xa401('0x26')](function(_0x45b9f9){_0x43b2b0['rows']=_0x45b9f9;return _0x43b2b0;})[_0xa401('0x26')](respondWithFilteredResult(_0x2d34e6,_0x15c66e))[_0xa401('0x44')](handleError(_0x2d34e6,null));};exports[_0xa401('0x45')]=function(_0x47dfc5,_0x269706){var _0x42df22={'raw':!![],'where':{'id':_0x47dfc5[_0xa401('0x46')]['id']}},_0x13415e={};_0x13415e[_0xa401('0x2d')]=_[_0xa401('0x30')](db[_0xa401('0x41')][_0xa401('0x2c')]);_0x13415e[_0xa401('0x2f')]=_[_0xa401('0x30')](_0x47dfc5[_0xa401('0x2f')]);_0x13415e[_0xa401('0x31')]=_[_0xa401('0x32')](_0x13415e[_0xa401('0x2d')],_0x13415e[_0xa401('0x2f')]);_0x42df22[_0xa401('0x33')]=_[_0xa401('0x32')](_0x13415e[_0xa401('0x2d')],qs[_0xa401('0x34')](_0x47dfc5[_0xa401('0x2f')][_0xa401('0x34')]));_0x42df22[_0xa401('0x33')]=_0x42df22[_0xa401('0x33')][_0xa401('0x35')]?_0x42df22['attributes']:_0x13415e[_0xa401('0x2d')];if(_0x47dfc5[_0xa401('0x2f')][_0xa401('0x47')]){_0x42df22[_0xa401('0x42')]=[{'all':!![]}];}_0x42df22=_[_0xa401('0x3f')]({},_0x42df22,_0x47dfc5[_0xa401('0x40')]);return db[_0xa401('0x41')][_0xa401('0x48')](_0x42df22)[_0xa401('0x26')](handleEntityNotFound(_0x269706,null))[_0xa401('0x26')](respondWithResult(_0x269706,null))['catch'](handleError(_0x269706,null));};exports[_0xa401('0x49')]=function(_0x176668,_0x3bc748){return db[_0xa401('0x41')][_0xa401('0x49')](_0x176668[_0xa401('0x4a')],{})[_0xa401('0x26')](respondWithResult(_0x3bc748,0xc9))[_0xa401('0x44')](handleError(_0x3bc748,null));};exports[_0xa401('0x25')]=function(_0x2c3835,_0x5e670d){if(_0x2c3835[_0xa401('0x4a')]['id']){delete _0x2c3835[_0xa401('0x4a')]['id'];}return db['VoiceQueuesLog'][_0xa401('0x48')]({'where':{'id':_0x2c3835[_0xa401('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e670d,null))['then'](saveUpdates(_0x2c3835['body'],null))[_0xa401('0x26')](respondWithResult(_0x5e670d,null))[_0xa401('0x44')](handleError(_0x5e670d,null));};exports[_0xa401('0x27')]=function(_0x265520,_0x7c802a){return db[_0xa401('0x41')]['find']({'where':{'id':_0x265520[_0xa401('0x46')]['id']}})['then'](handleEntityNotFound(_0x7c802a,null))[_0xa401('0x26')](removeEntity(_0x7c802a,null))[_0xa401('0x44')](handleError(_0x7c802a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 49827a6..917a6c2 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 _0x68c0=['define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','exports'];(function(_0x3425f9,_0x2358ca){var _0x814f39=function(_0x4cb267){while(--_0x4cb267){_0x3425f9['push'](_0x3425f9['shift']());}};_0x814f39(++_0x2358ca);}(_0x68c0,0x1c5));var _0x068c=function(_0x10b304,_0x3f188e){_0x10b304=_0x10b304-0x0;var _0x10fb78=_0x68c0[_0x10b304];return _0x10fb78;};'use strict';var _=require(_0x068c('0x0'));var util=require(_0x068c('0x1'));var logger=require('../../config/logger')(_0x068c('0x2'));var moment=require(_0x068c('0x3'));var BPromise=require(_0x068c('0x4'));var rp=require(_0x068c('0x5'));var fs=require('fs');var path=require(_0x068c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x068c('0x7'));module[_0x068c('0x8')]=function(_0x18e855,_0x1681b8){return _0x18e855[_0x068c('0x9')](_0x068c('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x068c('0xb'),'fields':[_0x068c('0xc'),_0x068c('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa753=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x450f09,_0x59561d){var _0x4e22ec=function(_0x516748){while(--_0x516748){_0x450f09['push'](_0x450f09['shift']());}};_0x4e22ec(++_0x59561d);}(_0xa753,0xa3));var _0x3a75=function(_0x1a51a2,_0x473530){_0x1a51a2=_0x1a51a2-0x0;var _0x139741=_0xa753[_0x1a51a2];return _0x139741;};'use strict';var _=require(_0x3a75('0x0'));var util=require(_0x3a75('0x1'));var logger=require(_0x3a75('0x2'))('api');var moment=require(_0x3a75('0x3'));var BPromise=require(_0x3a75('0x4'));var rp=require(_0x3a75('0x5'));var fs=require('fs');var path=require(_0x3a75('0x6'));var rimraf=require(_0x3a75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a75('0x8'));module[_0x3a75('0x9')]=function(_0x4e3db4,_0x2af483){return _0x4e3db4['define'](_0x3a75('0xa'),attributes,{'tableName':_0x3a75('0xb'),'paranoid':![],'indexes':[{'name':_0x3a75('0xc'),'fields':[_0x3a75('0xd'),_0x3a75('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 42fca23..78dc269 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 _0xd517=['../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x29415e,_0x4793d4){var _0x4158c2=function(_0x59a9fe){while(--_0x59a9fe){_0x29415e['push'](_0x29415e['shift']());}};_0x4158c2(++_0x4793d4);}(_0xd517,0x1dd));var _0x7d51=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0xd517[_0x35181c];return _0xe14bf9;};'use strict';var _=require(_0x7d51('0x0'));var util=require(_0x7d51('0x1'));var moment=require(_0x7d51('0x2'));var BPromise=require(_0x7d51('0x3'));var rs=require(_0x7d51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d51('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d51('0x6'));var config=require(_0x7d51('0x7'));var jayson=require(_0x7d51('0x8'));var client=jayson[_0x7d51('0x9')][_0x7d51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4a46,_0x2c50de,_0x23bcf1){return new BPromise(function(_0x474aca,_0x55d39b){return client['request'](_0x6f4a46,_0x23bcf1)[_0x7d51('0xb')](function(_0x446261){logger[_0x7d51('0xc')](_0x7d51('0xd'),_0x2c50de,'request\x20sent');logger['debug'](_0x7d51('0xe'),_0x2c50de,_0x7d51('0xf'),JSON[_0x7d51('0x10')](_0x446261));if(_0x446261['error']){if(_0x446261[_0x7d51('0x11')][_0x7d51('0x12')]===0x1f4){logger['error'](_0x7d51('0xd'),_0x2c50de,_0x446261['error'][_0x7d51('0x13')]);return _0x55d39b(_0x446261[_0x7d51('0x11')]['message']);}logger['error'](_0x7d51('0xd'),_0x2c50de,_0x446261[_0x7d51('0x11')][_0x7d51('0x13')]);return _0x474aca(_0x446261['error']['message']);}else{logger[_0x7d51('0xc')](_0x7d51('0xd'),_0x2c50de,_0x7d51('0xf'));_0x474aca(_0x446261[_0x7d51('0x14')]['message']);}})[_0x7d51('0x15')](function(_0x1116be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2c50de,_0x1116be);_0x55d39b(_0x1116be);});});} \ No newline at end of file +var _0x5127=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x5127,0x18f));var _0x7512=function(_0x494223,_0x2c1f71){_0x494223=_0x494223-0x0;var _0xdaf98=_0x5127[_0x494223];return _0xdaf98;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7512('0x5'))(_0x7512('0x6'));var config=require(_0x7512('0x7'));var jayson=require(_0x7512('0x8'));var client=jayson[_0x7512('0x9')][_0x7512('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6779,_0x4d0765,_0x2d2e88){return new BPromise(function(_0x543586,_0x43ce62){return client['request'](_0x4e6779,_0x2d2e88)[_0x7512('0xb')](function(_0x1e41b5){logger[_0x7512('0xc')](_0x7512('0xd'),_0x4d0765,_0x7512('0xe'));logger[_0x7512('0xf')](_0x7512('0x10'),_0x4d0765,_0x7512('0xe'),JSON[_0x7512('0x11')](_0x1e41b5));if(_0x1e41b5[_0x7512('0x12')]){if(_0x1e41b5[_0x7512('0x12')][_0x7512('0x13')]===0x1f4){logger[_0x7512('0x12')](_0x7512('0xd'),_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x43ce62(_0x1e41b5[_0x7512('0x12')]['message']);}logger[_0x7512('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d0765,_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);return _0x543586(_0x1e41b5[_0x7512('0x12')][_0x7512('0x14')]);}else{logger[_0x7512('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4d0765,'request\x20sent');_0x543586(_0x1e41b5[_0x7512('0x15')][_0x7512('0x14')]);}})[_0x7512('0x16')](function(_0x3f8f8f){logger['error'](_0x7512('0xd'),_0x4d0765,_0x3f8f8f);_0x43ce62(_0x3f8f8f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4fec3bd..79a6d28 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 _0xe7c1=['describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x2594dc,_0x33b3d0){var _0x4c4506=function(_0x1856a4){while(--_0x1856a4){_0x2594dc['push'](_0x2594dc['shift']());}};_0x4c4506(++_0x33b3d0);}(_0xe7c1,0xc6));var _0x1e7c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe7c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1e7c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e7c('0x1')]();var fs_extra=require(_0x1e7c('0x2'));var auth=require(_0x1e7c('0x3'));var interaction=require(_0x1e7c('0x4'));var config=require('../../config/environment');var controller=require(_0x1e7c('0x5'));router[_0x1e7c('0x6')]('/',auth[_0x1e7c('0x7')](),controller['index']);router[_0x1e7c('0x6')](_0x1e7c('0x8'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0x9')]);router[_0x1e7c('0x6')]('/:id',auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xa')]);router[_0x1e7c('0x6')]('/:id/download',auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xb')]);router[_0x1e7c('0x6')](_0x1e7c('0xc'),controller[_0x1e7c('0xd')]);router[_0x1e7c('0x6')](_0x1e7c('0xe'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xf')]);router[_0x1e7c('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e7c('0x11')]);router[_0x1e7c('0x10')](_0x1e7c('0xe'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0x12')]);router[_0x1e7c('0x13')](_0x1e7c('0x14'),auth['isAuthenticated'](),controller[_0x1e7c('0x15')]);router['delete'](_0x1e7c('0x14'),auth[_0x1e7c('0x7')](),controller['destroy']);module[_0x1e7c('0x16')]=router; \ No newline at end of file +var _0xec25=['show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x5341bd,_0x13383a){var _0xf423b3=function(_0x4e0271){while(--_0x4e0271){_0x5341bd['push'](_0x5341bd['shift']());}};_0xf423b3(++_0x13383a);}(_0xec25,0x89));var _0x5ec2=function(_0x148cf2,_0x1875c2){_0x148cf2=_0x148cf2-0x0;var _0x11e969=_0xec25[_0x148cf2];return _0x11e969;};'use strict';var multer=require(_0x5ec2('0x0'));var util=require(_0x5ec2('0x1'));var path=require(_0x5ec2('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ec2('0x3'));var router=express['Router']();var fs_extra=require(_0x5ec2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5ec2('0x5'));var config=require(_0x5ec2('0x6'));var controller=require(_0x5ec2('0x7'));router['get']('/',auth[_0x5ec2('0x8')](),controller[_0x5ec2('0x9')]);router[_0x5ec2('0xa')]('/describe',auth[_0x5ec2('0x8')](),controller[_0x5ec2('0xb')]);router[_0x5ec2('0xa')](_0x5ec2('0xc'),auth[_0x5ec2('0x8')](),controller[_0x5ec2('0xd')]);router['get'](_0x5ec2('0xe'),auth[_0x5ec2('0x8')](),controller[_0x5ec2('0xf')]);router[_0x5ec2('0xa')](_0x5ec2('0x10'),controller[_0x5ec2('0x11')]);router[_0x5ec2('0xa')](_0x5ec2('0x12'),auth[_0x5ec2('0x8')](),controller[_0x5ec2('0x13')]);router[_0x5ec2('0x14')]('/',auth[_0x5ec2('0x8')](),controller[_0x5ec2('0x15')]);router[_0x5ec2('0x14')]('/:id/transcribe',auth[_0x5ec2('0x8')](),controller[_0x5ec2('0x16')]);router[_0x5ec2('0x17')](_0x5ec2('0xc'),auth[_0x5ec2('0x8')](),controller[_0x5ec2('0x18')]);router['delete'](_0x5ec2('0xc'),auth[_0x5ec2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c208431..b1da8a3 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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 71a5cb9..b00b26c 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 _0x39d3=['%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','token','push','$and','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','describe','download','../../components/encryptor','uniqueid','value'];(function(_0x3b1f5d,_0xeec4bd){var _0x114974=function(_0x2cda6d){while(--_0x2cda6d){_0x3b1f5d['push'](_0x3b1f5d['shift']());}};_0x114974(++_0xeec4bd);}(_0x39d3,0xdd));var _0x339d=function(_0x46a50e,_0x49f0f4){_0x46a50e=_0x46a50e-0x0;var _0x4e5b41=_0x39d3[_0x46a50e];return _0x4e5b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x339d('0x0'));var zipdir=require(_0x339d('0x1'));var jsonpatch=require(_0x339d('0x2'));var rp=require(_0x339d('0x3'));var moment=require(_0x339d('0x4'));var BPromise=require(_0x339d('0x5'));var Mustache=require(_0x339d('0x6'));var util=require(_0x339d('0x7'));var path=require(_0x339d('0x8'));var sox=require(_0x339d('0x9'));var csv=require('to-csv');var ejs=require(_0x339d('0xa'));var fs=require('fs');var fs_extra=require(_0x339d('0xb'));var _=require(_0x339d('0xc'));var squel=require(_0x339d('0xd'));var crypto=require(_0x339d('0xe'));var jsforce=require(_0x339d('0xf'));var deskjs=require(_0x339d('0x10'));var toCsv=require(_0x339d('0x11'));var querystring=require(_0x339d('0x12'));var Papa=require('papaparse');var AWS=require(_0x339d('0x13'));var uuidv4=require(_0x339d('0x14'));var Redis=require(_0x339d('0x15'));var authService=require(_0x339d('0x16'));var qs=require(_0x339d('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x339d('0x18'));var logger=require(_0x339d('0x19'))(_0x339d('0x1a'));var utils=require(_0x339d('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x339d('0x1c'));var db=require(_0x339d('0x1d'))['db'];function respondWithStatusCode(_0x216c8b,_0x341287){_0x341287=_0x341287||0xcc;return function(_0x33c04b){if(_0x33c04b){return _0x216c8b['sendStatus'](_0x341287);}return _0x216c8b[_0x339d('0x1e')](_0x341287)[_0x339d('0x1f')]();};}function respondWithResult(_0x20527c,_0x4435f8){_0x4435f8=_0x4435f8||0xc8;return function(_0x3e6d73){if(_0x3e6d73){return _0x20527c['status'](_0x4435f8)['json'](_0x3e6d73);}};}function respondWithFilteredResult(_0x5a5de7,_0x598f5d){return function(_0x551652){if(_0x551652){var _0x840bb=typeof _0x598f5d[_0x339d('0x20')]===_0x339d('0x21')&&typeof _0x598f5d[_0x339d('0x22')]===_0x339d('0x21');var _0x2e0f17=_0x551652['count'];var _0x29b05b=_0x840bb?0x0:_0x598f5d[_0x339d('0x20')];var _0x3c64cd=_0x840bb?_0x551652[_0x339d('0x23')]:_0x598f5d[_0x339d('0x20')]+_0x598f5d['limit'];var _0x21cf41;if(_0x3c64cd>=_0x2e0f17){_0x3c64cd=_0x2e0f17;_0x21cf41=0xc8;}else{_0x21cf41=0xce;}_0x5a5de7['status'](_0x21cf41);return _0x5a5de7[_0x339d('0x24')](_0x339d('0x25'),_0x29b05b+'-'+_0x3c64cd+'/'+_0x2e0f17)[_0x339d('0x26')](_0x551652);}return null;};}function patchUpdates(_0x57e005){return function(_0x14be8f){try{jsonpatch[_0x339d('0x27')](_0x14be8f,_0x57e005,!![]);}catch(_0x2ef015){return BPromise[_0x339d('0x28')](_0x2ef015);}return _0x14be8f[_0x339d('0x29')]();};}function saveUpdates(_0x1c8cfe,_0x50dd52){return function(_0x13c4fc){if(_0x13c4fc){return _0x13c4fc[_0x339d('0x2a')](_0x1c8cfe)[_0x339d('0x2b')](function(_0x276a7c){return _0x276a7c;});}return null;};}function removeEntity(_0x578366,_0x4f1deb){return function(_0x125a2a){if(_0x125a2a){return _0x125a2a['destroy']()[_0x339d('0x2b')](function(){_0x578366[_0x339d('0x1e')](0xcc)[_0x339d('0x1f')]();});}};}function handleEntityNotFound(_0x2dd2e3,_0x495dc1){return function(_0x4e6007){if(!_0x4e6007){_0x2dd2e3[_0x339d('0x2c')](0x194);}return _0x4e6007;};}function handleError(_0x5bbde5,_0x2c64a7){_0x2c64a7=_0x2c64a7||0x1f4;return function(_0x588550){logger[_0x339d('0x2d')](_0x588550['stack']);if(_0x588550[_0x339d('0x2e')]){delete _0x588550[_0x339d('0x2e')];}_0x5bbde5['status'](_0x2c64a7)[_0x339d('0x2f')](_0x588550);};}exports['index']=function(_0x38f06c,_0x3d42d0){var _0x5264db={},_0x43c82d={},_0x2df1d5={'count':0x0,'rows':[]};var _0x3eea78=_['map'](db[_0x339d('0x30')][_0x339d('0x31')],function(_0x5413da){return{'name':_0x5413da[_0x339d('0x32')],'type':_0x5413da[_0x339d('0x33')][_0x339d('0x34')]};});_0x43c82d[_0x339d('0x35')]=_[_0x339d('0x36')](_[_0x339d('0x37')](_0x3eea78,_0x339d('0x2e')),[_0x339d('0x38')]);_0x43c82d[_0x339d('0x39')]=_[_0x339d('0x3a')](_0x38f06c['query']);_0x43c82d['filters']=_['intersection'](_0x43c82d[_0x339d('0x35')],_0x43c82d[_0x339d('0x39')]);_0x5264db[_0x339d('0x3b')]=_[_0x339d('0x3c')](_0x43c82d[_0x339d('0x35')],qs['fields'](_0x38f06c[_0x339d('0x39')][_0x339d('0x3d')]));_0x5264db[_0x339d('0x3b')]=_0x5264db[_0x339d('0x3b')]['length']?_0x5264db[_0x339d('0x3b')]:_0x43c82d['model'];if(!_0x38f06c['query'][_0x339d('0x3e')](_0x339d('0x3f'))){_0x5264db[_0x339d('0x22')]=qs[_0x339d('0x22')](_0x38f06c['query'][_0x339d('0x22')]);_0x5264db[_0x339d('0x20')]=qs['offset'](_0x38f06c[_0x339d('0x39')][_0x339d('0x20')]);}_0x5264db[_0x339d('0x40')]=qs[_0x339d('0x41')](_0x38f06c[_0x339d('0x39')]['sort']);_0x5264db[_0x339d('0x42')]=qs[_0x339d('0x43')](_[_0x339d('0x44')](_0x38f06c[_0x339d('0x39')],_0x43c82d[_0x339d('0x43')]),_0x3eea78);if(_0x38f06c[_0x339d('0x39')][_0x339d('0x45')]){_0x5264db[_0x339d('0x42')]=_[_0x339d('0x46')](_0x5264db[_0x339d('0x42')],{'$or':_[_0x339d('0x37')](_0x3eea78,function(_0x471f9e){if(_0x471f9e[_0x339d('0x33')]!==_0x339d('0x47')){var _0x875295={};_0x875295[_0x471f9e[_0x339d('0x2e')]]={'$like':'%'+_0x38f06c[_0x339d('0x39')][_0x339d('0x45')]+'%'};return _0x875295;}})});}_0x5264db=_['merge']({},_0x5264db,_0x38f06c['options']);var _0x20fd9b={'where':_0x5264db[_0x339d('0x42')]};return db[_0x339d('0x30')][_0x339d('0x23')](_0x20fd9b)[_0x339d('0x2b')](function(_0x50e4ca){_0x2df1d5[_0x339d('0x23')]=_0x50e4ca;if(_0x38f06c['query'][_0x339d('0x48')]){_0x5264db[_0x339d('0x49')]=[{'all':!![]}];}return db[_0x339d('0x30')][_0x339d('0x4a')](_0x5264db);})['then'](function(_0x434b01){_0x2df1d5[_0x339d('0x4b')]=_0x434b01;return _0x2df1d5;})[_0x339d('0x2b')](respondWithFilteredResult(_0x3d42d0,_0x5264db))[_0x339d('0x4c')](handleError(_0x3d42d0,null));};exports[_0x339d('0x4d')]=function(_0x503e19,_0x340da8){var _0x3aaaf9={'raw':![],'where':{'id':_0x503e19[_0x339d('0x4e')]['id']}},_0x29c17e={};_0x29c17e['model']=_[_0x339d('0x3a')](db['VoiceRecording'][_0x339d('0x31')]);_0x29c17e[_0x339d('0x39')]=_[_0x339d('0x3a')](_0x503e19[_0x339d('0x39')]);_0x29c17e[_0x339d('0x43')]=_[_0x339d('0x3c')](_0x29c17e[_0x339d('0x35')],_0x29c17e[_0x339d('0x39')]);_0x3aaaf9[_0x339d('0x3b')]=_[_0x339d('0x3c')](_0x29c17e['model'],qs[_0x339d('0x3d')](_0x503e19[_0x339d('0x39')]['fields']));_0x3aaaf9[_0x339d('0x3b')]=_0x3aaaf9[_0x339d('0x3b')][_0x339d('0x4f')]?_0x3aaaf9[_0x339d('0x3b')]:_0x29c17e['model'];if(_0x503e19['query'][_0x339d('0x48')]){_0x3aaaf9[_0x339d('0x49')]=[{'all':!![]}];}_0x3aaaf9=_[_0x339d('0x46')]({},_0x3aaaf9,_0x503e19[_0x339d('0x50')]);return db[_0x339d('0x30')]['find'](_0x3aaaf9)[_0x339d('0x2b')](handleEntityNotFound(_0x340da8,null))[_0x339d('0x2b')](respondWithResult(_0x340da8,null))['catch'](handleError(_0x340da8,null));};exports[_0x339d('0x51')]=function(_0x4acd6f,_0xa47e95){return db[_0x339d('0x30')][_0x339d('0x51')](_0x4acd6f['body'],{})[_0x339d('0x2b')](respondWithResult(_0xa47e95,0xc9))['catch'](handleError(_0xa47e95,null));};exports[_0x339d('0x2a')]=function(_0x5bfdfb,_0x3a98d2){if(_0x5bfdfb['body']['id']){delete _0x5bfdfb[_0x339d('0x52')]['id'];}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':{'id':_0x5bfdfb[_0x339d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a98d2,null))[_0x339d('0x2b')](saveUpdates(_0x5bfdfb['body'],null))[_0x339d('0x2b')](respondWithResult(_0x3a98d2,null))[_0x339d('0x4c')](handleError(_0x3a98d2,null));};exports['describe']=function(_0x4037d0,_0x2df497){return db[_0x339d('0x30')][_0x339d('0x54')]()['then'](respondWithResult(_0x2df497,null))[_0x339d('0x4c')](handleError(_0x2df497,null));};exports[_0x339d('0x55')]=function(_0x26fb3d,_0x3c82d7,_0x4e324a){var _0x3a30f1=require(_0x339d('0x56'));var _0x19c286=![];var _0x3ddae5={};if(_0x26fb3d[_0x339d('0x39')][_0x339d('0x33')]&&_0x26fb3d[_0x339d('0x39')][_0x339d('0x33')]===_0x339d('0x57')){_0x3ddae5[_0x339d('0x57')]=_0x26fb3d[_0x339d('0x4e')]['id'];}else{_0x3ddae5['id']=_0x26fb3d[_0x339d('0x4e')]['id'];}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':_0x3ddae5,'attributes':['id',_0x339d('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x3c82d7,null))['then'](function(_0x3c08b3){if(_0x3c08b3){var _0x29711f=_0x3c08b3[_0x339d('0x58')];var _0x4d081c=util[_0x339d('0x38')](_0x339d('0x59'),_0x29711f);if(fs[_0x339d('0x5a')](_0x4d081c)){_0x19c286=!![];return _0x3a30f1[_0x339d('0x5b')](_0x4d081c,_0x29711f,config[_0x339d('0x5c')][_0x339d('0x5d')])['then'](function(){return _0x3c08b3;});}return _0x3c08b3;}})['then'](function(_0x5ce181){if(_0x5ce181){var _0x374587=_0x5ce181[_0x339d('0x58')];if(!fs['existsSync'](_0x374587)){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x60'));}if(_0x5ce181[_0x339d('0x61')]){return _0x3c82d7['download'](_0x374587,_0x5ce181['filename']+path[_0x339d('0x62')](_0x374587),function(){if(_0x19c286){fs[_0x339d('0x63')](_0x374587);}});}else{return _0x3c82d7[_0x339d('0x55')](_0x374587,function(_0x39c7cf){if(_0x19c286){fs[_0x339d('0x63')](_0x374587);}});}}})['catch'](function(_0x9a510){if(_0x9a510[_0x339d('0x64')]===_0x339d('0x60')){_0x3c82d7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3c82d7,null);}});};exports[_0x339d('0x65')]=function(_0x4363b8,_0x122c69,_0x5f3364){var _0x5816e2=require('../../components/encryptor');var _0x11b1ec=![];var _0xd15e67={'$and':[db[_0x339d('0x66')][_0x339d('0x42')](db[_0x339d('0x66')]['fn']('MD5',db[_0x339d('0x66')]['col'](_0x339d('0x57'))),_0x4363b8['query'][_0x339d('0x67')])]};if(_0x4363b8[_0x339d('0x39')][_0x339d('0x33')]&&_0x4363b8[_0x339d('0x39')]['type']===_0x339d('0x57')){_0xd15e67['$and'][_0x339d('0x68')]({'uniqueid':_0x4363b8[_0x339d('0x4e')]['id']});}else{_0xd15e67[_0x339d('0x69')]['push']({'id':_0x4363b8[_0x339d('0x4e')]['id']});}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':_0xd15e67,'attributes':['id','value'],'raw':!![]})[_0x339d('0x2b')](handleEntityNotFound(_0x122c69,null))[_0x339d('0x2b')](function(_0x46bc3c){if(_0x46bc3c){var _0x402167=util['format'](_0x339d('0x59'),_0x46bc3c[_0x339d('0x58')]);if(fs[_0x339d('0x5a')](_0x402167)){_0x11b1ec=!![];return _0x5816e2['decryptFile'](_0x402167,_0x46bc3c[_0x339d('0x58')],config[_0x339d('0x5c')]['recording'])[_0x339d('0x2b')](function(){return _0x46bc3c;});}return _0x46bc3c;}})['then'](function(_0x4bca08){if(_0x4bca08){if(!fs[_0x339d('0x5a')](_0x4bca08['value'])){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x60'));}if(_0x4bca08[_0x339d('0x61')]){return _0x122c69[_0x339d('0x55')](_0x4bca08[_0x339d('0x58')],_0x4bca08[_0x339d('0x61')]+path[_0x339d('0x62')](_0x4bca08['value']),function(){if(_0x11b1ec){fs[_0x339d('0x63')](_0x4bca08[_0x339d('0x58')]);}});}else{return _0x122c69[_0x339d('0x55')](_0x4bca08['value'],function(_0x6b6c74){if(_0x11b1ec){fs[_0x339d('0x63')](_0x4bca08[_0x339d('0x58')]);}});}}})[_0x339d('0x4c')](handleError(_0x122c69,null));};exports['destroy']=function(_0xdf6772,_0x24e0f3){return db[_0x339d('0x30')][_0x339d('0x53')]({'where':{'id':_0xdf6772[_0x339d('0x4e')]['id']}})[_0x339d('0x2b')](function(_0x49d794){if(_[_0x339d('0x6a')](_0x49d794)){throw new ReferenceError('Entity\x20not\x20found');}return _0x49d794;})[_0x339d('0x2b')](function(_0x49e412){var _0x531947=_0x49e412[_0x339d('0x58')];logger['info'](_0x339d('0x6b'),_0x531947);if(!_['isNil'](_0x49e412[_0x339d('0x58')])&&fs[_0x339d('0x5a')](_0x531947)){logger[_0x339d('0x6c')](_0x339d('0x6d')+_0x531947+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x339d('0x6e')](_0x531947);}_0x531947=_0x531947+'.cypher';if(!_['isNil'](_0x49e412[_0x339d('0x58')])&&fs[_0x339d('0x5a')](_0x531947)){logger['info'](_0x339d('0x6d')+_0x531947+_0x339d('0x6f'));fs[_0x339d('0x6e')](_0x531947);}return _0x49e412;})[_0x339d('0x2b')](function(_0x2958be){if(!_0x2958be)throw new InternalError();return _0x2958be['destroy']();})[_0x339d('0x2b')](function(){_0x24e0f3[_0x339d('0x1e')](0xcc)[_0x339d('0x1f')]();})[_0x339d('0x4c')](handleError(_0x24e0f3,null));};function getBucketslist(_0x4950cc,_0x5690b6,_0x3ffc7d){return new Promise(function(_0x65ddcc,_0xc6329a){var _0x3adeff=new AWS['S3']({'accessKeyId':_0x5690b6,'secretAccessKey':_0x4950cc,'region':_0x3ffc7d});_0x3adeff[_0x339d('0x70')]({},function(_0x12a024,_0x126ef1){if(_0x12a024){return _0xc6329a(_0x12a024);}else{return _0x65ddcc(_0x126ef1);}});});}function createBucket(_0x15eefc,_0x56970c,_0x55a055,_0x2a106c){return new Promise(function(_0x479188,_0x4ba8e2){var _0x5c74d1=new AWS['S3']({'accessKeyId':_0x56970c,'secretAccessKey':_0x15eefc,'region':_0x55a055});_0x5c74d1['createBucket']({'Bucket':_0x2a106c},function(_0x498290,_0xf9a133){if(_0x498290){return _0x4ba8e2(_0x498290);}else{return _0x479188(_0xf9a133);}});});}function uploadFile(_0x18d977,_0x101f01,_0x595519,_0x32e815,_0x2bc368,_0x1143f2){return new Promise(function(_0x39642b,_0x55bd8c){var _0xc30431=new AWS['S3']({'accessKeyId':_0x101f01,'secretAccessKey':_0x18d977,'region':_0x595519});_0xc30431['upload']({'Bucket':_0x32e815,'Key':_0x2bc368,'Body':_0x1143f2},function(_0x5977a9,_0x96022b){if(_0x5977a9){return _0x55bd8c(_0x5977a9);}else{return _0x39642b(_0x96022b);}});});}function startTranscribe(_0x282356,_0x3a16ac,_0x3fdfa9,_0x526430,_0x25dffd,_0x5a5307){return new Promise(function(_0x519130,_0x48219d){var _0x1ce6a3=new AWS[(_0x339d('0x71'))]({'accessKeyId':_0x3a16ac,'secretAccessKey':_0x282356,'region':_0x3fdfa9});_0x1ce6a3[_0x339d('0x72')]({'TranscriptionJobName':_0x526430,'LanguageCode':_0x25dffd,'Media':{'MediaFileUri':_0x5a5307}},function(_0x3280bc,_0x4b47ad){if(_0x3280bc){return _0x48219d(_0x3280bc);}else{return _0x519130(_0x4b47ad);}});});}function transcribe(_0x5395c0,_0x21d901,_0x343473,_0x2339b1,_0x5e339e,_0x33e2f2,_0x4122f6){return new Promise(function(_0xcfaa7d,_0x459655){var _0x2c6113={};logger['info'](util[_0x339d('0x38')](_0x339d('0x73'),_0x5395c0,_0x5e339e));return uploadFile(_0x21d901,_0x343473,_0x2339b1,_0x5e339e,path[_0x339d('0x74')](_0x33e2f2),fs[_0x339d('0x75')](_0x33e2f2))[_0x339d('0x2b')](function(_0x2c0580){logger['info'](util[_0x339d('0x38')](_0x339d('0x76'),_0x5395c0,_0x5e339e,_0x2c0580['Location']));_0x2c6113[_0x339d('0x77')]=_0x2c0580[_0x339d('0x78')];_0x2c6113['location']=_0x2c0580[_0x339d('0x79')];logger[_0x339d('0x6c')](util[_0x339d('0x38')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5395c0));return startTranscribe(_0x21d901,_0x343473,_0x2339b1,uuidv4(),_0x4122f6,_0x2c0580[_0x339d('0x79')]);})[_0x339d('0x2b')](function(_0x56b0e7){logger[_0x339d('0x6c')](util[_0x339d('0x38')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5395c0,_0x56b0e7[_0x339d('0x7a')][_0x339d('0x7b')]));_0x2c6113['transcribeName']=_0x56b0e7[_0x339d('0x7a')][_0x339d('0x7b')];_0x2c6113[_0x339d('0x7c')]=_0x56b0e7['TranscriptionJob'][_0x339d('0x7d')];return _0xcfaa7d(_0x2c6113);})[_0x339d('0x4c')](function(_0x18deed){return _0x459655(_0x18deed);});});}exports[_0x339d('0x7e')]=function(_0x4bcb3e,_0x49ca83,_0x54c183){var _0x52a4c9;var _0x4cd27f;var _0x467d13;var _0xcb747=require(_0x339d('0x56'));return db[_0x339d('0x30')][_0x339d('0x7f')]({'where':{'id':_0x4bcb3e[_0x339d('0x4e')]['id']}})[_0x339d('0x2b')](function(_0xc41d7f){if(_0xc41d7f){var _0x59320=util[_0x339d('0x38')](_0x339d('0x59'),_0xc41d7f['value']);if(fs['existsSync'](_0x59320)){cypher=!![];return _0xcb747[_0x339d('0x5b')](_0x59320,_0xc41d7f[_0x339d('0x58')],config['secrets'][_0x339d('0x5d')])[_0x339d('0x2b')](function(){return _0xc41d7f;});}return _0xc41d7f;}})[_0x339d('0x2b')](function(_0x57bedf){if(!_0x57bedf){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))]('Voice\x20Recording\x20not\x20found');}_0x4cd27f=_0x57bedf;return db[_0x339d('0x80')][_0x339d('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x49ca83,null))[_0x339d('0x2b')](function(_0x3b92fa){if(_0x3b92fa){_0x52a4c9=_0x3b92fa;if(!_0x52a4c9[_0x339d('0x81')]||!_0x52a4c9[_0x339d('0x82')]||!_0x52a4c9[_0x339d('0x83')]||!_0x52a4c9[_0x339d('0x84')]||!_0x52a4c9[_0x339d('0x77')]){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x85'));}if(_0x4bcb3e[_0x339d('0x52')][_0x339d('0x86')]&&(!_0x52a4c9[_0x339d('0x87')]||!_0x52a4c9['sentimentAccountId']||!_0x52a4c9[_0x339d('0x88')]||!_0x52a4c9['language']||!_0x52a4c9['bucket'])){throw new db[(_0x339d('0x5e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x339d('0x89')][_0x339d('0x7f')]({'where':{'id':_0x52a4c9[_0x339d('0x82')]}});}})[_0x339d('0x2b')](function(_0x360685){if(!_0x360685){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x360685[_0x339d('0x8a')]||!_0x360685[_0x339d('0x8b')]){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x8c'));}_0x467d13=_0x360685;return getBucketslist(_0x467d13[_0x339d('0x8a')],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')]);})[_0x339d('0x2b')](function(_0x5f2958){if(_0x5f2958&&_0x5f2958[_0x339d('0x8d')]){var _0x2a8b14=_[_0x339d('0x53')](_0x5f2958['Buckets'],function(_0x455fd6){return _0x455fd6[_0x339d('0x8e')]===_0x52a4c9[_0x339d('0x77')];});if(!_0x2a8b14){logger['info'](util['format'](_0x339d('0x8f'),_0x4bcb3e[_0x339d('0x4e')]['id'],_0x52a4c9[_0x339d('0x77')]));return createBucket(_0x467d13[_0x339d('0x8a')],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')],_0x52a4c9['bucket']);}logger['info'](util[_0x339d('0x38')](_0x339d('0x90'),_0x4bcb3e[_0x339d('0x4e')]['id'],_0x52a4c9['bucket']));return;}})[_0x339d('0x2b')](function(_0x2e148e){if(_0x4cd27f['transcribeStatus']===_0x339d('0x91')){return transcribe(_0x4bcb3e[_0x339d('0x4e')]['id'],_0x467d13['data1'],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')],_0x52a4c9[_0x339d('0x77')],_0x4cd27f[_0x339d('0x58')],_0x52a4c9['language']);}else{logger[_0x339d('0x6c')](util[_0x339d('0x38')](_0x339d('0x92'),_0x4bcb3e['params']['id']));return{'transcribeStatus':_0x339d('0x93')};}})[_0x339d('0x2b')](function(_0x117e02){if(_0x117e02){_0x117e02[_0x339d('0x94')]=_0x4bcb3e[_0x339d('0x52')][_0x339d('0x86')];return _0x4cd27f['updateAttributes'](_0x117e02);}})[_0x339d('0x2b')](respondWithResult(_0x49ca83,null))[_0x339d('0x4c')](handleError(_0x49ca83,null));};function writeFile(_0x465732,_0x2727ff){return new Promise(function(_0x6b7435,_0x36b4ad){fs[_0x339d('0x95')](_0x2727ff,_0x465732,function(_0x1bcceb,_0x218a67){if(_0x1bcceb){return _0x36b4ad(_0x1bcceb);}else{return _0x6b7435(_0x218a67);}});});}exports[_0x339d('0x96')]=function(_0x100ade,_0xf519c6,_0x10d22e){return db[_0x339d('0x30')][_0x339d('0x7f')]({'where':{'id':_0x100ade['params']['id']}})['then'](handleEntityNotFound(_0xf519c6))[_0x339d('0x2b')](function(_0x424643){if(_0x424643&&_0x424643[_0x339d('0x97')]){var _0x3299b4=_0x424643[_0x339d('0x97')];var _0x18e09e=config[_0x339d('0x98')]+_0x339d('0x99')+_0x424643['id']+'.txt';if(fs['existsSync'](_0x18e09e)){return _0x18e09e;}return writeFile(_0x3299b4,_0x18e09e)['then'](function(){return _0x18e09e;});}else{throw new db['Sequelize'][(_0x339d('0x5f'))](_0x339d('0x9a'));}})['then'](function(_0x1f2a46){return _0xf519c6[_0x339d('0x55')](_0x1f2a46);})[_0x339d('0x4c')](handleError(_0xf519c6));}; \ No newline at end of file +var _0xe1f6=['decryptFile','secrets','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','$and','push','ValidationError','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','%s.cypher','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','find','describe','download','../../components/encryptor','type','uniqueid','params','value','format','existsSync'];(function(_0x25c793,_0x220d04){var _0x29a37a=function(_0x236e4a){while(--_0x236e4a){_0x25c793['push'](_0x25c793['shift']());}};_0x29a37a(++_0x220d04);}(_0xe1f6,0xe3));var _0x6e1f=function(_0x4f3ee5,_0x38db22){_0x4f3ee5=_0x4f3ee5-0x0;var _0x5280c7=_0xe1f6[_0x4f3ee5];return _0x5280c7;};'use strict';var emlformat=require(_0x6e1f('0x0'));var rimraf=require(_0x6e1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e1f('0x2'));var rp=require(_0x6e1f('0x3'));var moment=require(_0x6e1f('0x4'));var BPromise=require(_0x6e1f('0x5'));var Mustache=require(_0x6e1f('0x6'));var util=require(_0x6e1f('0x7'));var path=require(_0x6e1f('0x8'));var sox=require(_0x6e1f('0x9'));var csv=require(_0x6e1f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6e1f('0xb'));var crypto=require(_0x6e1f('0xc'));var jsforce=require(_0x6e1f('0xd'));var deskjs=require(_0x6e1f('0xe'));var toCsv=require(_0x6e1f('0xa'));var querystring=require(_0x6e1f('0xf'));var Papa=require(_0x6e1f('0x10'));var AWS=require(_0x6e1f('0x11'));var uuidv4=require(_0x6e1f('0x12'));var Redis=require(_0x6e1f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6e1f('0x14'));var as=require(_0x6e1f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e1f('0x16'));var utils=require('../../config/utils');var config=require(_0x6e1f('0x17'));var licenseUtil=require(_0x6e1f('0x18'));var db=require(_0x6e1f('0x19'))['db'];function respondWithStatusCode(_0x12c027,_0x1c912a){_0x1c912a=_0x1c912a||0xcc;return function(_0x3d79a6){if(_0x3d79a6){return _0x12c027[_0x6e1f('0x1a')](_0x1c912a);}return _0x12c027['status'](_0x1c912a)[_0x6e1f('0x1b')]();};}function respondWithResult(_0x5da3a3,_0x13ff42){_0x13ff42=_0x13ff42||0xc8;return function(_0x4ee534){if(_0x4ee534){return _0x5da3a3[_0x6e1f('0x1c')](_0x13ff42)[_0x6e1f('0x1d')](_0x4ee534);}};}function respondWithFilteredResult(_0x457e3b,_0x5de91a){return function(_0x2dedff){if(_0x2dedff){var _0x3dbc3b=typeof _0x5de91a[_0x6e1f('0x1e')]===_0x6e1f('0x1f')&&typeof _0x5de91a['limit']===_0x6e1f('0x1f');var _0x30a6ca=_0x2dedff[_0x6e1f('0x20')];var _0x36df90=_0x3dbc3b?0x0:_0x5de91a['offset'];var _0xc84634=_0x3dbc3b?_0x2dedff[_0x6e1f('0x20')]:_0x5de91a[_0x6e1f('0x1e')]+_0x5de91a[_0x6e1f('0x21')];var _0x2425c0;if(_0xc84634>=_0x30a6ca){_0xc84634=_0x30a6ca;_0x2425c0=0xc8;}else{_0x2425c0=0xce;}_0x457e3b[_0x6e1f('0x1c')](_0x2425c0);return _0x457e3b[_0x6e1f('0x22')](_0x6e1f('0x23'),_0x36df90+'-'+_0xc84634+'/'+_0x30a6ca)['json'](_0x2dedff);}return null;};}function patchUpdates(_0x2acea6){return function(_0xfb2227){try{jsonpatch['apply'](_0xfb2227,_0x2acea6,!![]);}catch(_0x3a196c){return BPromise[_0x6e1f('0x24')](_0x3a196c);}return _0xfb2227['save']();};}function saveUpdates(_0x13d3d5,_0x157fe5){return function(_0x522582){if(_0x522582){return _0x522582[_0x6e1f('0x25')](_0x13d3d5)[_0x6e1f('0x26')](function(_0x4598c5){return _0x4598c5;});}return null;};}function removeEntity(_0x168abf,_0x5e7f90){return function(_0x15710c){if(_0x15710c){return _0x15710c[_0x6e1f('0x27')]()[_0x6e1f('0x26')](function(){_0x168abf[_0x6e1f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa13e,_0x3f3f0e){return function(_0x5be2d2){if(!_0x5be2d2){_0x3aa13e[_0x6e1f('0x1a')](0x194);}return _0x5be2d2;};}function handleError(_0x5dc81a,_0x5cc3f2){_0x5cc3f2=_0x5cc3f2||0x1f4;return function(_0x2f855a){logger['error'](_0x2f855a[_0x6e1f('0x28')]);if(_0x2f855a[_0x6e1f('0x29')]){delete _0x2f855a[_0x6e1f('0x29')];}_0x5dc81a['status'](_0x5cc3f2)[_0x6e1f('0x2a')](_0x2f855a);};}exports[_0x6e1f('0x2b')]=function(_0x420ff2,_0x336800){var _0x825b30={},_0xb2c11d={},_0x2f6959={'count':0x0,'rows':[]};var _0xf3ce0a=_[_0x6e1f('0x2c')](db[_0x6e1f('0x2d')]['rawAttributes'],function(_0x32a513){return{'name':_0x32a513['fieldName'],'type':_0x32a513['type']['key']};});_0xb2c11d[_0x6e1f('0x2e')]=_[_0x6e1f('0x2f')](_[_0x6e1f('0x2c')](_0xf3ce0a,_0x6e1f('0x29')),['format']);_0xb2c11d[_0x6e1f('0x30')]=_[_0x6e1f('0x31')](_0x420ff2['query']);_0xb2c11d['filters']=_[_0x6e1f('0x32')](_0xb2c11d[_0x6e1f('0x2e')],_0xb2c11d[_0x6e1f('0x30')]);_0x825b30[_0x6e1f('0x33')]=_[_0x6e1f('0x32')](_0xb2c11d[_0x6e1f('0x2e')],qs[_0x6e1f('0x34')](_0x420ff2['query']['fields']));_0x825b30[_0x6e1f('0x33')]=_0x825b30[_0x6e1f('0x33')]['length']?_0x825b30[_0x6e1f('0x33')]:_0xb2c11d['model'];if(!_0x420ff2[_0x6e1f('0x30')][_0x6e1f('0x35')](_0x6e1f('0x36'))){_0x825b30[_0x6e1f('0x21')]=qs['limit'](_0x420ff2[_0x6e1f('0x30')][_0x6e1f('0x21')]);_0x825b30['offset']=qs[_0x6e1f('0x1e')](_0x420ff2['query'][_0x6e1f('0x1e')]);}_0x825b30['order']=qs[_0x6e1f('0x37')](_0x420ff2[_0x6e1f('0x30')][_0x6e1f('0x37')]);_0x825b30[_0x6e1f('0x38')]=qs[_0x6e1f('0x39')](_[_0x6e1f('0x3a')](_0x420ff2['query'],_0xb2c11d['filters']),_0xf3ce0a);if(_0x420ff2[_0x6e1f('0x30')][_0x6e1f('0x3b')]){_0x825b30[_0x6e1f('0x38')]=_[_0x6e1f('0x3c')](_0x825b30[_0x6e1f('0x38')],{'$or':_['map'](_0xf3ce0a,function(_0x3f0e29){if(_0x3f0e29['type']!==_0x6e1f('0x3d')){var _0x4ba167={};_0x4ba167[_0x3f0e29[_0x6e1f('0x29')]]={'$like':'%'+_0x420ff2['query']['filter']+'%'};return _0x4ba167;}})});}_0x825b30=_['merge']({},_0x825b30,_0x420ff2[_0x6e1f('0x3e')]);var _0x599d9d={'where':_0x825b30[_0x6e1f('0x38')]};return db[_0x6e1f('0x2d')][_0x6e1f('0x20')](_0x599d9d)[_0x6e1f('0x26')](function(_0x5eda88){_0x2f6959[_0x6e1f('0x20')]=_0x5eda88;if(_0x420ff2['query'][_0x6e1f('0x3f')]){_0x825b30[_0x6e1f('0x40')]=[{'all':!![]}];}return db[_0x6e1f('0x2d')][_0x6e1f('0x41')](_0x825b30);})[_0x6e1f('0x26')](function(_0x3e407d){_0x2f6959[_0x6e1f('0x42')]=_0x3e407d;return _0x2f6959;})['then'](respondWithFilteredResult(_0x336800,_0x825b30))[_0x6e1f('0x43')](handleError(_0x336800,null));};exports[_0x6e1f('0x44')]=function(_0x5bd61c,_0x4b1472){var _0x3d1bec={'raw':![],'where':{'id':_0x5bd61c['params']['id']}},_0x48f12d={};_0x48f12d[_0x6e1f('0x2e')]=_[_0x6e1f('0x31')](db['VoiceRecording'][_0x6e1f('0x45')]);_0x48f12d[_0x6e1f('0x30')]=_[_0x6e1f('0x31')](_0x5bd61c[_0x6e1f('0x30')]);_0x48f12d[_0x6e1f('0x39')]=_[_0x6e1f('0x32')](_0x48f12d[_0x6e1f('0x2e')],_0x48f12d[_0x6e1f('0x30')]);_0x3d1bec[_0x6e1f('0x33')]=_[_0x6e1f('0x32')](_0x48f12d['model'],qs[_0x6e1f('0x34')](_0x5bd61c['query'][_0x6e1f('0x34')]));_0x3d1bec[_0x6e1f('0x33')]=_0x3d1bec[_0x6e1f('0x33')][_0x6e1f('0x46')]?_0x3d1bec[_0x6e1f('0x33')]:_0x48f12d[_0x6e1f('0x2e')];if(_0x5bd61c[_0x6e1f('0x30')][_0x6e1f('0x3f')]){_0x3d1bec[_0x6e1f('0x40')]=[{'all':!![]}];}_0x3d1bec=_[_0x6e1f('0x3c')]({},_0x3d1bec,_0x5bd61c[_0x6e1f('0x3e')]);return db[_0x6e1f('0x2d')]['find'](_0x3d1bec)[_0x6e1f('0x26')](handleEntityNotFound(_0x4b1472,null))[_0x6e1f('0x26')](respondWithResult(_0x4b1472,null))[_0x6e1f('0x43')](handleError(_0x4b1472,null));};exports[_0x6e1f('0x47')]=function(_0x1fe22d,_0x546852){return db['VoiceRecording'][_0x6e1f('0x47')](_0x1fe22d['body'],{})[_0x6e1f('0x26')](respondWithResult(_0x546852,0xc9))[_0x6e1f('0x43')](handleError(_0x546852,null));};exports[_0x6e1f('0x25')]=function(_0x7be2af,_0x220176){if(_0x7be2af[_0x6e1f('0x48')]['id']){delete _0x7be2af[_0x6e1f('0x48')]['id'];}return db[_0x6e1f('0x2d')][_0x6e1f('0x49')]({'where':{'id':_0x7be2af['params']['id']}})['then'](handleEntityNotFound(_0x220176,null))[_0x6e1f('0x26')](saveUpdates(_0x7be2af[_0x6e1f('0x48')],null))[_0x6e1f('0x26')](respondWithResult(_0x220176,null))[_0x6e1f('0x43')](handleError(_0x220176,null));};exports[_0x6e1f('0x4a')]=function(_0x3a2507,_0x7ac07c){return db['VoiceRecording'][_0x6e1f('0x4a')]()[_0x6e1f('0x26')](respondWithResult(_0x7ac07c,null))['catch'](handleError(_0x7ac07c,null));};exports[_0x6e1f('0x4b')]=function(_0x4f0ed5,_0x27fa6c,_0x1071c9){var _0x3e80a9=require(_0x6e1f('0x4c'));var _0x3e1157=![];var _0x1f9b86={};if(_0x4f0ed5['query']['type']&&_0x4f0ed5[_0x6e1f('0x30')][_0x6e1f('0x4d')]===_0x6e1f('0x4e')){_0x1f9b86[_0x6e1f('0x4e')]=_0x4f0ed5[_0x6e1f('0x4f')]['id'];}else{_0x1f9b86['id']=_0x4f0ed5['params']['id'];}return db['VoiceRecording'][_0x6e1f('0x49')]({'where':_0x1f9b86,'attributes':['id',_0x6e1f('0x50')],'raw':!![]})[_0x6e1f('0x26')](handleEntityNotFound(_0x27fa6c,null))['then'](function(_0x447cf3){if(_0x447cf3){var _0x38d274=_0x447cf3[_0x6e1f('0x50')];var _0x1d9153=util[_0x6e1f('0x51')]('%s.cypher',_0x38d274);if(fs[_0x6e1f('0x52')](_0x1d9153)){_0x3e1157=!![];return _0x3e80a9[_0x6e1f('0x53')](_0x1d9153,_0x38d274,config[_0x6e1f('0x54')]['recording'])['then'](function(){return _0x447cf3;});}return _0x447cf3;}})[_0x6e1f('0x26')](function(_0x1c38e5){if(_0x1c38e5){var _0x3585a7=_0x1c38e5['value'];if(!fs['existsSync'](_0x3585a7)){throw new db[(_0x6e1f('0x55'))]['ValidationError'](_0x6e1f('0x56'));}if(_0x1c38e5['filename']){return _0x27fa6c['download'](_0x3585a7,_0x1c38e5[_0x6e1f('0x57')]+path[_0x6e1f('0x58')](_0x3585a7),function(){if(_0x3e1157){fs[_0x6e1f('0x59')](_0x3585a7);}});}else{return _0x27fa6c[_0x6e1f('0x4b')](_0x3585a7,function(_0x38d2b5){if(_0x3e1157){fs[_0x6e1f('0x59')](_0x3585a7);}});}}})[_0x6e1f('0x43')](function(_0x2ce13a){if(_0x2ce13a[_0x6e1f('0x5a')]===_0x6e1f('0x56')){_0x27fa6c[_0x6e1f('0x1c')](0x194)[_0x6e1f('0x2a')](_0x6e1f('0x5b'));}else{return handleError(_0x27fa6c,null);}});};exports['downloads']=function(_0x2fb1fc,_0xef7150,_0xbaa083){var _0x4fef92=require(_0x6e1f('0x4c'));var _0x5b58ee=![];var _0x36191e={'$and':[db[_0x6e1f('0x5c')][_0x6e1f('0x38')](db[_0x6e1f('0x5c')]['fn'](_0x6e1f('0x5d'),db[_0x6e1f('0x5c')][_0x6e1f('0x5e')](_0x6e1f('0x4e'))),_0x2fb1fc[_0x6e1f('0x30')]['token'])]};if(_0x2fb1fc[_0x6e1f('0x30')][_0x6e1f('0x4d')]&&_0x2fb1fc[_0x6e1f('0x30')][_0x6e1f('0x4d')]===_0x6e1f('0x4e')){_0x36191e[_0x6e1f('0x5f')]['push']({'uniqueid':_0x2fb1fc['params']['id']});}else{_0x36191e[_0x6e1f('0x5f')][_0x6e1f('0x60')]({'id':_0x2fb1fc[_0x6e1f('0x4f')]['id']});}return db[_0x6e1f('0x2d')][_0x6e1f('0x49')]({'where':_0x36191e,'attributes':['id','value'],'raw':!![]})[_0x6e1f('0x26')](handleEntityNotFound(_0xef7150,null))['then'](function(_0x47de3b){if(_0x47de3b){var _0x12151f=util['format']('%s.cypher',_0x47de3b[_0x6e1f('0x50')]);if(fs[_0x6e1f('0x52')](_0x12151f)){_0x5b58ee=!![];return _0x4fef92[_0x6e1f('0x53')](_0x12151f,_0x47de3b[_0x6e1f('0x50')],config['secrets']['recording'])['then'](function(){return _0x47de3b;});}return _0x47de3b;}})[_0x6e1f('0x26')](function(_0xea32f0){if(_0xea32f0){if(!fs[_0x6e1f('0x52')](_0xea32f0['value'])){throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))]('VoiceRecording\x20not\x20found');}if(_0xea32f0[_0x6e1f('0x57')]){return _0xef7150['download'](_0xea32f0[_0x6e1f('0x50')],_0xea32f0[_0x6e1f('0x57')]+path[_0x6e1f('0x58')](_0xea32f0[_0x6e1f('0x50')]),function(){if(_0x5b58ee){fs[_0x6e1f('0x59')](_0xea32f0[_0x6e1f('0x50')]);}});}else{return _0xef7150['download'](_0xea32f0[_0x6e1f('0x50')],function(_0x4d93d5){if(_0x5b58ee){fs[_0x6e1f('0x59')](_0xea32f0['value']);}});}}})['catch'](handleError(_0xef7150,null));};exports['destroy']=function(_0x4145d5,_0x3bcdfc){return db[_0x6e1f('0x2d')][_0x6e1f('0x49')]({'where':{'id':_0x4145d5[_0x6e1f('0x4f')]['id']}})['then'](function(_0x4f668a){if(_['isNil'](_0x4f668a)){throw new ReferenceError(_0x6e1f('0x62'));}return _0x4f668a;})[_0x6e1f('0x26')](function(_0x1ca090){var _0x2cd668=_0x1ca090[_0x6e1f('0x50')];logger[_0x6e1f('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x2cd668);if(!_[_0x6e1f('0x64')](_0x1ca090[_0x6e1f('0x50')])&&fs[_0x6e1f('0x52')](_0x2cd668)){logger['info'](_0x6e1f('0x65')+_0x2cd668+_0x6e1f('0x66'));fs[_0x6e1f('0x67')](_0x2cd668);}_0x2cd668=_0x2cd668+_0x6e1f('0x68');if(!_[_0x6e1f('0x64')](_0x1ca090['value'])&&fs[_0x6e1f('0x52')](_0x2cd668)){logger[_0x6e1f('0x63')]('File:\x20\x22'+_0x2cd668+_0x6e1f('0x66'));fs[_0x6e1f('0x67')](_0x2cd668);}return _0x1ca090;})[_0x6e1f('0x26')](function(_0x2fbf07){if(!_0x2fbf07)throw new InternalError();return _0x2fbf07[_0x6e1f('0x27')]();})[_0x6e1f('0x26')](function(){_0x3bcdfc[_0x6e1f('0x1c')](0xcc)[_0x6e1f('0x1b')]();})['catch'](handleError(_0x3bcdfc,null));};function getBucketslist(_0x9ee8a2,_0x491602,_0x42463a){return new Promise(function(_0x337113,_0xbf44ca){var _0x4655a1=new AWS['S3']({'accessKeyId':_0x491602,'secretAccessKey':_0x9ee8a2,'region':_0x42463a});_0x4655a1[_0x6e1f('0x69')]({},function(_0x55055b,_0x5d9637){if(_0x55055b){return _0xbf44ca(_0x55055b);}else{return _0x337113(_0x5d9637);}});});}function createBucket(_0x563593,_0x2b0998,_0x12a8a1,_0x44217b){return new Promise(function(_0x2809a3,_0x159186){var _0x11612f=new AWS['S3']({'accessKeyId':_0x2b0998,'secretAccessKey':_0x563593,'region':_0x12a8a1});_0x11612f[_0x6e1f('0x6a')]({'Bucket':_0x44217b},function(_0xbe4ef3,_0x5d9ec0){if(_0xbe4ef3){return _0x159186(_0xbe4ef3);}else{return _0x2809a3(_0x5d9ec0);}});});}function uploadFile(_0x7ae199,_0x4381d3,_0x921484,_0x523caa,_0x48e1d5,_0x5ef9dc){return new Promise(function(_0xd71f98,_0x201fd4){var _0x536b06=new AWS['S3']({'accessKeyId':_0x4381d3,'secretAccessKey':_0x7ae199,'region':_0x921484});_0x536b06['upload']({'Bucket':_0x523caa,'Key':_0x48e1d5,'Body':_0x5ef9dc},function(_0x35d281,_0x5996a1){if(_0x35d281){return _0x201fd4(_0x35d281);}else{return _0xd71f98(_0x5996a1);}});});}function startTranscribe(_0x50e11f,_0x2d378c,_0x563220,_0x4f5c3f,_0x4ada61,_0x20cb2c){return new Promise(function(_0x45bf5c,_0x3a39c4){var _0x354465=new AWS[(_0x6e1f('0x6b'))]({'accessKeyId':_0x2d378c,'secretAccessKey':_0x50e11f,'region':_0x563220});_0x354465[_0x6e1f('0x6c')]({'TranscriptionJobName':_0x4f5c3f,'LanguageCode':_0x4ada61,'Media':{'MediaFileUri':_0x20cb2c}},function(_0x2d6135,_0x300992){if(_0x2d6135){return _0x3a39c4(_0x2d6135);}else{return _0x45bf5c(_0x300992);}});});}function transcribe(_0x48bb91,_0x174c1f,_0x1c2b64,_0x291d02,_0x594e3d,_0x3d28e5,_0x4de05c){return new Promise(function(_0x4cfb5a,_0x34b293){var _0x48cb95={};logger[_0x6e1f('0x63')](util[_0x6e1f('0x51')](_0x6e1f('0x6d'),_0x48bb91,_0x594e3d));return uploadFile(_0x174c1f,_0x1c2b64,_0x291d02,_0x594e3d,path[_0x6e1f('0x6e')](_0x3d28e5),fs[_0x6e1f('0x6f')](_0x3d28e5))['then'](function(_0xba1b50){logger[_0x6e1f('0x63')](util[_0x6e1f('0x51')](_0x6e1f('0x70'),_0x48bb91,_0x594e3d,_0xba1b50[_0x6e1f('0x71')]));_0x48cb95[_0x6e1f('0x72')]=_0xba1b50['Bucket'];_0x48cb95[_0x6e1f('0x73')]=_0xba1b50['Location'];logger[_0x6e1f('0x63')](util[_0x6e1f('0x51')](_0x6e1f('0x74'),_0x48bb91));return startTranscribe(_0x174c1f,_0x1c2b64,_0x291d02,uuidv4(),_0x4de05c,_0xba1b50[_0x6e1f('0x71')]);})['then'](function(_0x33520b){logger[_0x6e1f('0x63')](util[_0x6e1f('0x51')](_0x6e1f('0x75'),_0x48bb91,_0x33520b['TranscriptionJob']['TranscriptionJobName']));_0x48cb95[_0x6e1f('0x76')]=_0x33520b[_0x6e1f('0x77')]['TranscriptionJobName'];_0x48cb95[_0x6e1f('0x78')]=_0x33520b[_0x6e1f('0x77')][_0x6e1f('0x79')];return _0x4cfb5a(_0x48cb95);})['catch'](function(_0x436304){return _0x34b293(_0x436304);});});}exports[_0x6e1f('0x7a')]=function(_0x4306b3,_0x52fbf8,_0x2c390a){var _0x3901f1;var _0x322382;var _0x1057fa;var _0x2cd140=require(_0x6e1f('0x4c'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4306b3['params']['id']}})[_0x6e1f('0x26')](function(_0xc3a908){if(_0xc3a908){var _0xe3094e=util[_0x6e1f('0x51')](_0x6e1f('0x7b'),_0xc3a908[_0x6e1f('0x50')]);if(fs[_0x6e1f('0x52')](_0xe3094e)){cypher=!![];return _0x2cd140[_0x6e1f('0x53')](_0xe3094e,_0xc3a908[_0x6e1f('0x50')],config[_0x6e1f('0x54')]['recording'])[_0x6e1f('0x26')](function(){return _0xc3a908;});}return _0xc3a908;}})[_0x6e1f('0x26')](function(_0x174e08){if(!_0x174e08){throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))]('Voice\x20Recording\x20not\x20found');}_0x322382=_0x174e08;return db[_0x6e1f('0x7c')]['findOne']({'where':{'id':0x1}});})[_0x6e1f('0x26')](handleEntityNotFound(_0x52fbf8,null))[_0x6e1f('0x26')](function(_0x72b628){if(_0x72b628){_0x3901f1=_0x72b628;if(!_0x3901f1[_0x6e1f('0x7d')]||!_0x3901f1[_0x6e1f('0x7e')]||!_0x3901f1[_0x6e1f('0x7f')]||!_0x3901f1[_0x6e1f('0x80')]||!_0x3901f1[_0x6e1f('0x72')]){throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))](_0x6e1f('0x81'));}if(_0x4306b3[_0x6e1f('0x48')][_0x6e1f('0x82')]&&(!_0x3901f1[_0x6e1f('0x83')]||!_0x3901f1[_0x6e1f('0x84')]||!_0x3901f1[_0x6e1f('0x85')]||!_0x3901f1[_0x6e1f('0x80')]||!_0x3901f1[_0x6e1f('0x72')])){throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))](_0x6e1f('0x86'));}return db[_0x6e1f('0x87')][_0x6e1f('0x88')]({'where':{'id':_0x3901f1[_0x6e1f('0x7e')]}});}})[_0x6e1f('0x26')](function(_0x170832){if(!_0x170832){throw new db['Sequelize'][(_0x6e1f('0x61'))](_0x6e1f('0x89'));}if(!_0x170832[_0x6e1f('0x8a')]||!_0x170832[_0x6e1f('0x8b')]){throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))](_0x6e1f('0x8c'));}_0x1057fa=_0x170832;return getBucketslist(_0x1057fa[_0x6e1f('0x8a')],_0x1057fa[_0x6e1f('0x8b')],_0x3901f1[_0x6e1f('0x7f')]);})['then'](function(_0x57ea4c){if(_0x57ea4c&&_0x57ea4c[_0x6e1f('0x8d')]){var _0x17f8b7=_[_0x6e1f('0x49')](_0x57ea4c[_0x6e1f('0x8d')],function(_0x1b8c40){return _0x1b8c40[_0x6e1f('0x8e')]===_0x3901f1['bucket'];});if(!_0x17f8b7){logger['info'](util[_0x6e1f('0x51')](_0x6e1f('0x8f'),_0x4306b3[_0x6e1f('0x4f')]['id'],_0x3901f1[_0x6e1f('0x72')]));return createBucket(_0x1057fa[_0x6e1f('0x8a')],_0x1057fa[_0x6e1f('0x8b')],_0x3901f1['transcribeRegion'],_0x3901f1['bucket']);}logger[_0x6e1f('0x63')](util['format'](_0x6e1f('0x90'),_0x4306b3[_0x6e1f('0x4f')]['id'],_0x3901f1[_0x6e1f('0x72')]));return;}})[_0x6e1f('0x26')](function(_0x1ce4d6){if(_0x322382[_0x6e1f('0x78')]===_0x6e1f('0x91')){return transcribe(_0x4306b3[_0x6e1f('0x4f')]['id'],_0x1057fa[_0x6e1f('0x8a')],_0x1057fa[_0x6e1f('0x8b')],_0x3901f1['transcribeRegion'],_0x3901f1[_0x6e1f('0x72')],_0x322382[_0x6e1f('0x50')],_0x3901f1[_0x6e1f('0x80')]);}else{logger[_0x6e1f('0x63')](util[_0x6e1f('0x51')](_0x6e1f('0x92'),_0x4306b3[_0x6e1f('0x4f')]['id']));return{'transcribeStatus':_0x6e1f('0x93')};}})[_0x6e1f('0x26')](function(_0x2df595){if(_0x2df595){_0x2df595[_0x6e1f('0x94')]=_0x4306b3[_0x6e1f('0x48')][_0x6e1f('0x82')];return _0x322382[_0x6e1f('0x95')](_0x2df595);}})[_0x6e1f('0x26')](respondWithResult(_0x52fbf8,null))[_0x6e1f('0x43')](handleError(_0x52fbf8,null));};function writeFile(_0xc99d4c,_0x11d8c4){return new Promise(function(_0x10cdc5,_0xb817bf){fs['writeFile'](_0x11d8c4,_0xc99d4c,function(_0x5d1f26,_0x5c85c4){if(_0x5d1f26){return _0xb817bf(_0x5d1f26);}else{return _0x10cdc5(_0x5c85c4);}});});}exports[_0x6e1f('0x96')]=function(_0x1d7acc,_0x55144a,_0x412af2){return db['VoiceRecording'][_0x6e1f('0x88')]({'where':{'id':_0x1d7acc[_0x6e1f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x55144a))[_0x6e1f('0x26')](function(_0x3e91aa){if(_0x3e91aa&&_0x3e91aa[_0x6e1f('0x97')]){var _0x26376e=_0x3e91aa[_0x6e1f('0x97')];var _0x5bcfef=config[_0x6e1f('0x98')]+_0x6e1f('0x99')+_0x3e91aa['id']+'.txt';if(fs[_0x6e1f('0x52')](_0x5bcfef)){return _0x5bcfef;}return writeFile(_0x26376e,_0x5bcfef)['then'](function(){return _0x5bcfef;});}else{throw new db[(_0x6e1f('0x55'))][(_0x6e1f('0x61'))](_0x6e1f('0x9a'));}})['then'](function(_0x4fa3e6){return _0x55144a[_0x6e1f('0x4b')](_0x4fa3e6);})['catch'](handleError(_0x55144a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d6f7a45..4a98248 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 _0x84e1=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0xa39ba1,_0x291066){var _0x296408=function(_0x3e16bd){while(--_0x3e16bd){_0xa39ba1['push'](_0xa39ba1['shift']());}};_0x296408(++_0x291066);}(_0x84e1,0x1dc));var _0x184e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x84e1[_0xfae23b];return _0x200640;};'use strict';var attributes=require(_0x184e('0x0'));module[_0x184e('0x1')]=function(_0x1cb42b,_0x1e7e1f){return _0x1cb42b[_0x184e('0x2')](_0x184e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x184e('0x4'),'fields':[_0x184e('0x4')]},{'name':_0x184e('0x5'),'fields':[_0x184e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x4064a4,_0x3769d2){var _0x539f9c=function(_0x2156b2){while(--_0x2156b2){_0x4064a4['push'](_0x4064a4['shift']());}};_0x539f9c(++_0x3769d2);}(_0xb43b,0xbf));var _0xbb43=function(_0x585350,_0x3e536d){_0x585350=_0x585350-0x0;var _0x5d8e96=_0xb43b[_0x585350];return _0x5d8e96;};'use strict';var attributes=require(_0xbb43('0x0'));module['exports']=function(_0x1b9ba2,_0x21ce6c){return _0x1b9ba2[_0xbb43('0x1')](_0xbb43('0x2'),attributes,{'tableName':_0xbb43('0x3'),'paranoid':![],'indexes':[{'name':_0xbb43('0x4'),'fields':[_0xbb43('0x4')]},{'name':_0xbb43('0x5'),'fields':[_0xbb43('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 8be652d..2eb2830 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x524e,0x15e));var _0xe524=function(_0xae88fb,_0x2d2b34){_0xae88fb=_0xae88fb-0x0;var _0x446d8d=_0x524e[_0xae88fb];return _0x446d8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file +var _0xa6b0=['create','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','VoiceRecording'];(function(_0x396a44,_0x3557ba){var _0x3fc32b=function(_0x4ab361){while(--_0x4ab361){_0x396a44['push'](_0x396a44['shift']());}};_0x3fc32b(++_0x3557ba);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3db9e1,_0x4f4198){_0x3db9e1=_0x3db9e1-0x0;var _0x2d43b5=_0xa6b0[_0x3db9e1];return _0x2d43b5;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['UpdateVoiceRecording']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['VoiceRecording'][_0x0a6b('0x17')](_0xcb412[_0x0a6b('0x18')],{'raw':_0xcb412['options']?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb412[_0x0a6b('0x19')]?_0xcb412['options'][_0x0a6b('0x1b')]||null:null,'attributes':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')]['attributes']||null:null,'limit':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1c')]||null:null})[_0x0a6b('0x1d')](function(_0x122c19){logger['info'](_0x0a6b('0x1e'),_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1e'),_0xcb412,JSON['stringify'](_0x122c19));_0x2cb10b(_0x122c19);})[_0x0a6b('0x16')](function(_0x2e58fd){logger[_0x0a6b('0x12')](_0x0a6b('0x1e'),_0x2e58fd[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347['error'](0x1f4,_0x2e58fd[_0x0a6b('0x14')]));});});};exports[_0x0a6b('0x1f')]=function(_0x19a653){var _0x4ce9d4=this;return new Promise(function(_0x3a9092,_0x51e760){var _0xecbf0c=require(_0x0a6b('0x20'));var _0x45ae97;return db['Setting']['findOne']({'attributes':['id',_0x0a6b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x0a6b('0x1d')](function(_0x1aecc7){_0x45ae97=_0x1aecc7;return db[_0x0a6b('0x22')][_0x0a6b('0x23')](_0x19a653[_0x0a6b('0x18')]);})['then'](function(_0xa7ab7c){if(_0x45ae97[_0x0a6b('0x21')]&&fs['existsSync'](_0xa7ab7c[_0x0a6b('0x24')])){var _0x554145=util['format'](_0x0a6b('0x25'),_0xa7ab7c[_0x0a6b('0x24')]);return _0xecbf0c[_0x0a6b('0x26')](_0xa7ab7c[_0x0a6b('0x24')],_0x554145,config[_0x0a6b('0x27')]['recording'])['then'](function(){fs[_0x0a6b('0x28')](_0xa7ab7c[_0x0a6b('0x24')]);logger[_0x0a6b('0xc')](_0x0a6b('0x29'));return _0xa7ab7c;});}return _0xa7ab7c;})['then'](function(_0xe2b82b){logger[_0x0a6b('0xc')]('CreateVoiceRecording',_0x19a653);logger['debug'](_0x0a6b('0x1f'),_0x19a653,JSON[_0x0a6b('0x11')](_0xe2b82b));_0x3a9092(_0xe2b82b);})['catch'](function(_0x3c3c23){logger[_0x0a6b('0x12')](_0x0a6b('0x1f'),_0x3c3c23[_0x0a6b('0x14')],_0x19a653);_0x51e760(_0x4ce9d4[_0x0a6b('0x12')](0x1f4,_0x3c3c23[_0x0a6b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 945ee14..a57041f 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 _0x2ea9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0x2ea9,0x94));var _0x92ea=function(_0x375dd4,_0x44213e){_0x375dd4=_0x375dd4-0x0;var _0x5c2006=_0x2ea9[_0x375dd4];return _0x5c2006;};'use strict';var multer=require('multer');var util=require(_0x92ea('0x0'));var path=require('path');var timeout=require(_0x92ea('0x1'));var express=require(_0x92ea('0x2'));var router=express[_0x92ea('0x3')]();var fs_extra=require(_0x92ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92ea('0x5'));var config=require(_0x92ea('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x92ea('0x7')]('/',auth[_0x92ea('0x8')](),controller[_0x92ea('0x9')]);router[_0x92ea('0x7')]('/describe',auth[_0x92ea('0x8')](),controller[_0x92ea('0xa')]);router[_0x92ea('0x7')](_0x92ea('0xb'),auth[_0x92ea('0x8')](),controller['show']);router[_0x92ea('0xc')]('/',auth[_0x92ea('0x8')](),controller['create']);router[_0x92ea('0xd')](_0x92ea('0xb'),auth[_0x92ea('0x8')](),controller[_0x92ea('0xe')]);router['delete'](_0x92ea('0xb'),auth['isAuthenticated'](),controller[_0x92ea('0xf')]);module[_0x92ea('0x10')]=router; \ No newline at end of file +var _0x102b=['/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x54b719,_0x39ade5){var _0x31edd9=function(_0x3f2514){while(--_0x3f2514){_0x54b719['push'](_0x54b719['shift']());}};_0x31edd9(++_0x39ade5);}(_0x102b,0xa0));var _0xb102=function(_0x2828cd,_0xa8ee53){_0x2828cd=_0x2828cd-0x0;var _0x332d95=_0x102b[_0x2828cd];return _0x332d95;};'use strict';var multer=require(_0xb102('0x0'));var util=require(_0xb102('0x1'));var path=require(_0xb102('0x2'));var timeout=require(_0xb102('0x3'));var express=require(_0xb102('0x4'));var router=express[_0xb102('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb102('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb102('0x7'));var controller=require('./voiceTransferReport.controller');router[_0xb102('0x8')]('/',auth[_0xb102('0x9')](),controller[_0xb102('0xa')]);router[_0xb102('0x8')](_0xb102('0xb'),auth[_0xb102('0x9')](),controller['describe']);router[_0xb102('0x8')](_0xb102('0xc'),auth[_0xb102('0x9')](),controller[_0xb102('0xd')]);router[_0xb102('0xe')]('/',auth[_0xb102('0x9')](),controller['create']);router[_0xb102('0xf')](_0xb102('0xc'),auth['isAuthenticated'](),controller[_0xb102('0x10')]);router['delete'](_0xb102('0xc'),auth[_0xb102('0x9')](),controller[_0xb102('0x11')]);module[_0xb102('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 20c8b43..e40a96d 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 _0xd101=['exports','ENUM','STRING','Yes','sequelize','moment'];(function(_0x302533,_0x4e7e6a){var _0x1995f3=function(_0x1e5100){while(--_0x1e5100){_0x302533['push'](_0x302533['shift']());}};_0x1995f3(++_0x4e7e6a);}(_0xd101,0x1d2));var _0x1d10=function(_0x52cfe8,_0x312809){_0x52cfe8=_0x52cfe8-0x0;var _0x486e32=_0xd101[_0x52cfe8];return _0x486e32;};'use strict';var Sequelize=require(_0x1d10('0x0'));var moment=require(_0x1d10('0x1'));module[_0x1d10('0x2')]={'type':{'type':Sequelize[_0x1d10('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x1d10('0x4')]},'transfererchannel':{'type':Sequelize[_0x1d10('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1d10('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1d10('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1d10('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1d10('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1d10('0x4')]},'transferercontext':{'type':Sequelize[_0x1d10('0x4')]},'transfererexten':{'type':Sequelize[_0x1d10('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x1d10('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1d10('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1d10('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1d10('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x1d10('0x4')]},'transfereecontext':{'type':Sequelize[_0x1d10('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1d10('0x4')]},'isexternal':{'type':Sequelize[_0x1d10('0x3')](_0x1d10('0x5'),'No')},'context':{'type':Sequelize[_0x1d10('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x83a6=['ENUM','blind','STRING','Yes','sequelize','moment','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x83a6,0xe4));var _0x683a=function(_0xacc4f2,_0x3de620){_0xacc4f2=_0xacc4f2-0x0;var _0x359ffe=_0x83a6[_0xacc4f2];return _0x359ffe;};'use strict';var Sequelize=require(_0x683a('0x0'));var moment=require(_0x683a('0x1'));module[_0x683a('0x2')]={'type':{'type':Sequelize[_0x683a('0x3')](_0x683a('0x4'),'attended')},'result':{'type':Sequelize[_0x683a('0x5')]},'transfererchannel':{'type':Sequelize[_0x683a('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x683a('0x5')]},'transferercalleridname':{'type':Sequelize[_0x683a('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x683a('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x683a('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x683a('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x683a('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x683a('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x683a('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x683a('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x683a('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x683a('0x5')]},'transfereecontext':{'type':Sequelize[_0x683a('0x5')]},'transfereeexten':{'type':Sequelize[_0x683a('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x683a('0x5')]},'isexternal':{'type':Sequelize[_0x683a('0x3')](_0x683a('0x6'),'No')},'context':{'type':Sequelize[_0x683a('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1c6f958..91ad080 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 _0x95cf=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','params','describe','eml-format','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model'];(function(_0x103a30,_0x3a0154){var _0x182dad=function(_0x7afd45){while(--_0x7afd45){_0x103a30['push'](_0x103a30['shift']());}};_0x182dad(++_0x3a0154);}(_0x95cf,0x169));var _0xf95c=function(_0x5a0078,_0x2505ac){_0x5a0078=_0x5a0078-0x0;var _0x92d5c2=_0x95cf[_0x5a0078];return _0x92d5c2;};'use strict';var emlformat=require(_0xf95c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf95c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf95c('0x2'));var util=require('util');var path=require(_0xf95c('0x3'));var sox=require('sox');var csv=require(_0xf95c('0x4'));var ejs=require(_0xf95c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf95c('0x6'));var crypto=require(_0xf95c('0x7'));var jsforce=require(_0xf95c('0x8'));var deskjs=require(_0xf95c('0x9'));var toCsv=require(_0xf95c('0x4'));var querystring=require(_0xf95c('0xa'));var Papa=require(_0xf95c('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf95c('0xc'));var as=require(_0xf95c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf95c('0xe'))(_0xf95c('0xf'));var utils=require(_0xf95c('0x10'));var config=require(_0xf95c('0x11'));var licenseUtil=require(_0xf95c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373857,_0x22badf){_0x22badf=_0x22badf||0xcc;return function(_0x2cfd28){if(_0x2cfd28){return _0x373857[_0xf95c('0x13')](_0x22badf);}return _0x373857[_0xf95c('0x14')](_0x22badf)[_0xf95c('0x15')]();};}function respondWithResult(_0x28f374,_0x1877ee){_0x1877ee=_0x1877ee||0xc8;return function(_0x3abd68){if(_0x3abd68){return _0x28f374[_0xf95c('0x14')](_0x1877ee)['json'](_0x3abd68);}};}function respondWithFilteredResult(_0x508189,_0x98e46c){return function(_0xda686a){if(_0xda686a){var _0x4c3036=typeof _0x98e46c[_0xf95c('0x16')]===_0xf95c('0x17')&&typeof _0x98e46c[_0xf95c('0x18')]===_0xf95c('0x17');var _0x31afde=_0xda686a[_0xf95c('0x19')];var _0x31271b=_0x4c3036?0x0:_0x98e46c[_0xf95c('0x16')];var _0x484683=_0x4c3036?_0xda686a[_0xf95c('0x19')]:_0x98e46c[_0xf95c('0x16')]+_0x98e46c[_0xf95c('0x18')];var _0x2ae836;if(_0x484683>=_0x31afde){_0x484683=_0x31afde;_0x2ae836=0xc8;}else{_0x2ae836=0xce;}_0x508189[_0xf95c('0x14')](_0x2ae836);return _0x508189[_0xf95c('0x1a')]('Content-Range',_0x31271b+'-'+_0x484683+'/'+_0x31afde)['json'](_0xda686a);}return null;};}function patchUpdates(_0x3b55e5){return function(_0xd8244c){try{jsonpatch['apply'](_0xd8244c,_0x3b55e5,!![]);}catch(_0x3c071b){return BPromise[_0xf95c('0x1b')](_0x3c071b);}return _0xd8244c['save']();};}function saveUpdates(_0x117117,_0x11d6e3){return function(_0x392bfc){if(_0x392bfc){return _0x392bfc['update'](_0x117117)[_0xf95c('0x1c')](function(_0x27891e){return _0x27891e;});}return null;};}function removeEntity(_0x58cc97,_0x53e4b0){return function(_0x52593b){if(_0x52593b){return _0x52593b[_0xf95c('0x1d')]()[_0xf95c('0x1c')](function(){_0x58cc97[_0xf95c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551971,_0x2b16ff){return function(_0x1ffd80){if(!_0x1ffd80){_0x551971['sendStatus'](0x194);}return _0x1ffd80;};}function handleError(_0x4cc9d2,_0x1a4ef0){_0x1a4ef0=_0x1a4ef0||0x1f4;return function(_0x345aeb){logger[_0xf95c('0x1e')](_0x345aeb[_0xf95c('0x1f')]);if(_0x345aeb['name']){delete _0x345aeb[_0xf95c('0x20')];}_0x4cc9d2[_0xf95c('0x14')](_0x1a4ef0)[_0xf95c('0x21')](_0x345aeb);};}exports[_0xf95c('0x22')]=function(_0x3ee7b0,_0x3f236c){var _0x52cdb5={},_0x561ae2={},_0x1d6794={'count':0x0,'rows':[]};var _0x1d0f98=_[_0xf95c('0x23')](db[_0xf95c('0x24')][_0xf95c('0x25')],function(_0x56a821){return{'name':_0x56a821['fieldName'],'type':_0x56a821[_0xf95c('0x26')][_0xf95c('0x27')]};});_0x561ae2[_0xf95c('0x28')]=_[_0xf95c('0x23')](_0x1d0f98,_0xf95c('0x20'));_0x561ae2['query']=_[_0xf95c('0x29')](_0x3ee7b0['query']);_0x561ae2[_0xf95c('0x2a')]=_[_0xf95c('0x2b')](_0x561ae2['model'],_0x561ae2[_0xf95c('0x2c')]);_0x52cdb5[_0xf95c('0x2d')]=_[_0xf95c('0x2b')](_0x561ae2['model'],qs['fields'](_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x2e')]));_0x52cdb5[_0xf95c('0x2d')]=_0x52cdb5[_0xf95c('0x2d')][_0xf95c('0x2f')]?_0x52cdb5['attributes']:_0x561ae2[_0xf95c('0x28')];if(!_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x30')](_0xf95c('0x31'))){_0x52cdb5[_0xf95c('0x18')]=qs[_0xf95c('0x18')](_0x3ee7b0['query'][_0xf95c('0x18')]);_0x52cdb5[_0xf95c('0x16')]=qs[_0xf95c('0x16')](_0x3ee7b0['query'][_0xf95c('0x16')]);}_0x52cdb5[_0xf95c('0x32')]=qs[_0xf95c('0x33')](_0x3ee7b0[_0xf95c('0x2c')]['sort']);_0x52cdb5[_0xf95c('0x34')]=qs[_0xf95c('0x2a')](_[_0xf95c('0x35')](_0x3ee7b0[_0xf95c('0x2c')],_0x561ae2[_0xf95c('0x2a')]),_0x1d0f98);if(_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x36')]){_0x52cdb5['where']=_[_0xf95c('0x37')](_0x52cdb5[_0xf95c('0x34')],{'$or':_[_0xf95c('0x23')](_0x1d0f98,function(_0x1ad59a){if(_0x1ad59a[_0xf95c('0x26')]!==_0xf95c('0x38')){var _0x9c3544={};_0x9c3544[_0x1ad59a[_0xf95c('0x20')]]={'$like':'%'+_0x3ee7b0['query'][_0xf95c('0x36')]+'%'};return _0x9c3544;}})});}_0x52cdb5=_['merge']({},_0x52cdb5,_0x3ee7b0[_0xf95c('0x39')]);var _0x18630c={'where':_0x52cdb5['where']};return db['VoiceTransferReport'][_0xf95c('0x19')](_0x18630c)['then'](function(_0x115430){_0x1d6794[_0xf95c('0x19')]=_0x115430;if(_0x3ee7b0['query'][_0xf95c('0x3a')]){_0x52cdb5['include']=[{'all':!![]}];}return db[_0xf95c('0x24')]['findAll'](_0x52cdb5);})[_0xf95c('0x1c')](function(_0x46b978){_0x1d6794[_0xf95c('0x3b')]=_0x46b978;return _0x1d6794;})[_0xf95c('0x1c')](respondWithFilteredResult(_0x3f236c,_0x52cdb5))[_0xf95c('0x3c')](handleError(_0x3f236c,null));};exports['show']=function(_0x795116,_0x52c39c){var _0x2827ca={'raw':!![],'where':{'id':_0x795116['params']['id']}},_0x23db22={};_0x23db22[_0xf95c('0x28')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x23db22['query']=_[_0xf95c('0x29')](_0x795116[_0xf95c('0x2c')]);_0x23db22[_0xf95c('0x2a')]=_[_0xf95c('0x2b')](_0x23db22[_0xf95c('0x28')],_0x23db22[_0xf95c('0x2c')]);_0x2827ca[_0xf95c('0x2d')]=_[_0xf95c('0x2b')](_0x23db22[_0xf95c('0x28')],qs[_0xf95c('0x2e')](_0x795116['query']['fields']));_0x2827ca[_0xf95c('0x2d')]=_0x2827ca[_0xf95c('0x2d')]['length']?_0x2827ca['attributes']:_0x23db22[_0xf95c('0x28')];if(_0x795116[_0xf95c('0x2c')][_0xf95c('0x3a')]){_0x2827ca[_0xf95c('0x3d')]=[{'all':!![]}];}_0x2827ca=_[_0xf95c('0x37')]({},_0x2827ca,_0x795116[_0xf95c('0x39')]);return db['VoiceTransferReport'][_0xf95c('0x3e')](_0x2827ca)[_0xf95c('0x1c')](handleEntityNotFound(_0x52c39c,null))[_0xf95c('0x1c')](respondWithResult(_0x52c39c,null))[_0xf95c('0x3c')](handleError(_0x52c39c,null));};exports[_0xf95c('0x3f')]=function(_0x5ba327,_0x2dce59){return db[_0xf95c('0x24')][_0xf95c('0x3f')](_0x5ba327[_0xf95c('0x40')],{})[_0xf95c('0x1c')](respondWithResult(_0x2dce59,0xc9))[_0xf95c('0x3c')](handleError(_0x2dce59,null));};exports['update']=function(_0x28f2b8,_0x3a659e){if(_0x28f2b8[_0xf95c('0x40')]['id']){delete _0x28f2b8[_0xf95c('0x40')]['id'];}return db[_0xf95c('0x24')][_0xf95c('0x3e')]({'where':{'id':_0x28f2b8[_0xf95c('0x41')]['id']}})[_0xf95c('0x1c')](handleEntityNotFound(_0x3a659e,null))[_0xf95c('0x1c')](saveUpdates(_0x28f2b8['body'],null))[_0xf95c('0x1c')](respondWithResult(_0x3a659e,null))[_0xf95c('0x3c')](handleError(_0x3a659e,null));};exports['destroy']=function(_0x4b3af6,_0x1a47d9){return db[_0xf95c('0x24')][_0xf95c('0x3e')]({'where':{'id':_0x4b3af6[_0xf95c('0x41')]['id']}})[_0xf95c('0x1c')](handleEntityNotFound(_0x1a47d9,null))['then'](removeEntity(_0x1a47d9,null))[_0xf95c('0x3c')](handleError(_0x1a47d9,null));};exports[_0xf95c('0x42')]=function(_0x497cf5,_0x614c15){return db[_0xf95c('0x24')][_0xf95c('0x42')]()[_0xf95c('0x1c')](respondWithResult(_0x614c15,null))[_0xf95c('0x3c')](handleError(_0x614c15,null));}; \ No newline at end of file +var _0x5838=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','then','stack','name','send','index','VoiceTransferReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','keys','filters','include','find','catch','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5838,0x115));var _0x8583=function(_0x2b84a2,_0x5beede){_0x2b84a2=_0x2b84a2-0x0;var _0x35da14=_0x5838[_0x2b84a2];return _0x35da14;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8583('0x0'));var zipdir=require(_0x8583('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8583('0x2'));var moment=require(_0x8583('0x3'));var BPromise=require(_0x8583('0x4'));var Mustache=require(_0x8583('0x5'));var util=require(_0x8583('0x6'));var path=require(_0x8583('0x7'));var sox=require(_0x8583('0x8'));var csv=require(_0x8583('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8583('0xa'));var _=require(_0x8583('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8583('0xc'));var toCsv=require(_0x8583('0x9'));var querystring=require(_0x8583('0xd'));var Papa=require(_0x8583('0xe'));var Redis=require('ioredis');var authService=require(_0x8583('0xf'));var qs=require(_0x8583('0x10'));var as=require(_0x8583('0x11'));var hardwareService=require(_0x8583('0x12'));var logger=require(_0x8583('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8583('0x14'));var licenseUtil=require(_0x8583('0x15'));var db=require(_0x8583('0x16'))['db'];function respondWithStatusCode(_0x3a7629,_0x28d270){_0x28d270=_0x28d270||0xcc;return function(_0x5c41c7){if(_0x5c41c7){return _0x3a7629[_0x8583('0x17')](_0x28d270);}return _0x3a7629['status'](_0x28d270)[_0x8583('0x18')]();};}function respondWithResult(_0xcbd4ae,_0x489f4e){_0x489f4e=_0x489f4e||0xc8;return function(_0x3b4a3e){if(_0x3b4a3e){return _0xcbd4ae['status'](_0x489f4e)[_0x8583('0x19')](_0x3b4a3e);}};}function respondWithFilteredResult(_0x57510d,_0x2d9e50){return function(_0x5aedf8){if(_0x5aedf8){var _0xe4b3b9=typeof _0x2d9e50[_0x8583('0x1a')]===_0x8583('0x1b')&&typeof _0x2d9e50['limit']==='undefined';var _0x1c523c=_0x5aedf8[_0x8583('0x1c')];var _0x527c62=_0xe4b3b9?0x0:_0x2d9e50['offset'];var _0x2608e1=_0xe4b3b9?_0x5aedf8['count']:_0x2d9e50['offset']+_0x2d9e50['limit'];var _0x2b1e5e;if(_0x2608e1>=_0x1c523c){_0x2608e1=_0x1c523c;_0x2b1e5e=0xc8;}else{_0x2b1e5e=0xce;}_0x57510d[_0x8583('0x1d')](_0x2b1e5e);return _0x57510d[_0x8583('0x1e')](_0x8583('0x1f'),_0x527c62+'-'+_0x2608e1+'/'+_0x1c523c)['json'](_0x5aedf8);}return null;};}function patchUpdates(_0x4dffc8){return function(_0x104e9a){try{jsonpatch[_0x8583('0x20')](_0x104e9a,_0x4dffc8,!![]);}catch(_0x2ed2ae){return BPromise[_0x8583('0x21')](_0x2ed2ae);}return _0x104e9a['save']();};}function saveUpdates(_0x5a181f,_0x154f0e){return function(_0x13c086){if(_0x13c086){return _0x13c086['update'](_0x5a181f)[_0x8583('0x22')](function(_0xfffde4){return _0xfffde4;});}return null;};}function removeEntity(_0x31c227,_0x387ca4){return function(_0x587cda){if(_0x587cda){return _0x587cda['destroy']()[_0x8583('0x22')](function(){_0x31c227[_0x8583('0x1d')](0xcc)[_0x8583('0x18')]();});}};}function handleEntityNotFound(_0x90ff6,_0x35103a){return function(_0x4227d5){if(!_0x4227d5){_0x90ff6['sendStatus'](0x194);}return _0x4227d5;};}function handleError(_0x37e43f,_0x572269){_0x572269=_0x572269||0x1f4;return function(_0x2bf5f2){logger['error'](_0x2bf5f2[_0x8583('0x23')]);if(_0x2bf5f2[_0x8583('0x24')]){delete _0x2bf5f2[_0x8583('0x24')];}_0x37e43f['status'](_0x572269)[_0x8583('0x25')](_0x2bf5f2);};}exports[_0x8583('0x26')]=function(_0x2583b9,_0x132774){var _0x31f0f9={},_0x55cd69={},_0x4de8bb={'count':0x0,'rows':[]};var _0x1512e0=_['map'](db[_0x8583('0x27')][_0x8583('0x28')],function(_0x360f9a){return{'name':_0x360f9a['fieldName'],'type':_0x360f9a[_0x8583('0x29')][_0x8583('0x2a')]};});_0x55cd69[_0x8583('0x2b')]=_[_0x8583('0x2c')](_0x1512e0,_0x8583('0x24'));_0x55cd69[_0x8583('0x2d')]=_['keys'](_0x2583b9[_0x8583('0x2d')]);_0x55cd69['filters']=_[_0x8583('0x2e')](_0x55cd69[_0x8583('0x2b')],_0x55cd69[_0x8583('0x2d')]);_0x31f0f9[_0x8583('0x2f')]=_[_0x8583('0x2e')](_0x55cd69[_0x8583('0x2b')],qs[_0x8583('0x30')](_0x2583b9[_0x8583('0x2d')][_0x8583('0x30')]));_0x31f0f9['attributes']=_0x31f0f9[_0x8583('0x2f')][_0x8583('0x31')]?_0x31f0f9[_0x8583('0x2f')]:_0x55cd69['model'];if(!_0x2583b9[_0x8583('0x2d')][_0x8583('0x32')](_0x8583('0x33'))){_0x31f0f9[_0x8583('0x34')]=qs['limit'](_0x2583b9[_0x8583('0x2d')][_0x8583('0x34')]);_0x31f0f9['offset']=qs[_0x8583('0x1a')](_0x2583b9['query'][_0x8583('0x1a')]);}_0x31f0f9[_0x8583('0x35')]=qs[_0x8583('0x36')](_0x2583b9['query'][_0x8583('0x36')]);_0x31f0f9['where']=qs['filters'](_[_0x8583('0x37')](_0x2583b9[_0x8583('0x2d')],_0x55cd69['filters']),_0x1512e0);if(_0x2583b9[_0x8583('0x2d')][_0x8583('0x38')]){_0x31f0f9[_0x8583('0x39')]=_[_0x8583('0x3a')](_0x31f0f9[_0x8583('0x39')],{'$or':_['map'](_0x1512e0,function(_0x217d81){if(_0x217d81[_0x8583('0x29')]!==_0x8583('0x3b')){var _0xead6b9={};_0xead6b9[_0x217d81['name']]={'$like':'%'+_0x2583b9[_0x8583('0x2d')]['filter']+'%'};return _0xead6b9;}})});}_0x31f0f9=_[_0x8583('0x3a')]({},_0x31f0f9,_0x2583b9[_0x8583('0x3c')]);var _0x59407c={'where':_0x31f0f9['where']};return db[_0x8583('0x27')][_0x8583('0x1c')](_0x59407c)['then'](function(_0x3d309c){_0x4de8bb[_0x8583('0x1c')]=_0x3d309c;if(_0x2583b9[_0x8583('0x2d')]['includeAll']){_0x31f0f9['include']=[{'all':!![]}];}return db[_0x8583('0x27')][_0x8583('0x3d')](_0x31f0f9);})[_0x8583('0x22')](function(_0x2390ca){_0x4de8bb[_0x8583('0x3e')]=_0x2390ca;return _0x4de8bb;})[_0x8583('0x22')](respondWithFilteredResult(_0x132774,_0x31f0f9))['catch'](handleError(_0x132774,null));};exports[_0x8583('0x3f')]=function(_0x5c3ae1,_0x10b5a6){var _0x398890={'raw':!![],'where':{'id':_0x5c3ae1[_0x8583('0x40')]['id']}},_0x50f601={};_0x50f601[_0x8583('0x2b')]=_[_0x8583('0x41')](db['VoiceTransferReport'][_0x8583('0x28')]);_0x50f601[_0x8583('0x2d')]=_['keys'](_0x5c3ae1['query']);_0x50f601[_0x8583('0x42')]=_['intersection'](_0x50f601[_0x8583('0x2b')],_0x50f601['query']);_0x398890['attributes']=_[_0x8583('0x2e')](_0x50f601[_0x8583('0x2b')],qs[_0x8583('0x30')](_0x5c3ae1['query'][_0x8583('0x30')]));_0x398890[_0x8583('0x2f')]=_0x398890[_0x8583('0x2f')][_0x8583('0x31')]?_0x398890[_0x8583('0x2f')]:_0x50f601['model'];if(_0x5c3ae1[_0x8583('0x2d')]['includeAll']){_0x398890[_0x8583('0x43')]=[{'all':!![]}];}_0x398890=_[_0x8583('0x3a')]({},_0x398890,_0x5c3ae1[_0x8583('0x3c')]);return db['VoiceTransferReport'][_0x8583('0x44')](_0x398890)[_0x8583('0x22')](handleEntityNotFound(_0x10b5a6,null))[_0x8583('0x22')](respondWithResult(_0x10b5a6,null))[_0x8583('0x45')](handleError(_0x10b5a6,null));};exports[_0x8583('0x46')]=function(_0x5c00a5,_0x5c7ac8){return db[_0x8583('0x27')][_0x8583('0x46')](_0x5c00a5[_0x8583('0x47')],{})[_0x8583('0x22')](respondWithResult(_0x5c7ac8,0xc9))[_0x8583('0x45')](handleError(_0x5c7ac8,null));};exports['update']=function(_0x2d6ef2,_0x47ae2a){if(_0x2d6ef2[_0x8583('0x47')]['id']){delete _0x2d6ef2['body']['id'];}return db[_0x8583('0x27')][_0x8583('0x44')]({'where':{'id':_0x2d6ef2[_0x8583('0x40')]['id']}})['then'](handleEntityNotFound(_0x47ae2a,null))[_0x8583('0x22')](saveUpdates(_0x2d6ef2[_0x8583('0x47')],null))[_0x8583('0x22')](respondWithResult(_0x47ae2a,null))[_0x8583('0x45')](handleError(_0x47ae2a,null));};exports[_0x8583('0x48')]=function(_0x53e3b8,_0x5a4c61){return db['VoiceTransferReport'][_0x8583('0x44')]({'where':{'id':_0x53e3b8[_0x8583('0x40')]['id']}})[_0x8583('0x22')](handleEntityNotFound(_0x5a4c61,null))['then'](removeEntity(_0x5a4c61,null))['catch'](handleError(_0x5a4c61,null));};exports[_0x8583('0x49')]=function(_0x181278,_0x72c783){return db[_0x8583('0x27')]['describe']()[_0x8583('0x22')](respondWithResult(_0x72c783,null))[_0x8583('0x45')](handleError(_0x72c783,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 79b383c..151040a 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 _0x6efd=['util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x6efd,0x1af));var _0xd6ef=function(_0x333bb4,_0x48ab05){_0x333bb4=_0x333bb4-0x0;var _0x56f499=_0x6efd[_0x333bb4];return _0x56f499;};'use strict';var _=require(_0xd6ef('0x0'));var util=require(_0xd6ef('0x1'));var logger=require(_0xd6ef('0x2'))(_0xd6ef('0x3'));var moment=require(_0xd6ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ef('0x5'));var fs=require('fs');var path=require(_0xd6ef('0x6'));var rimraf=require(_0xd6ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xd6ef('0x8'));module[_0xd6ef('0x9')]=function(_0x5dc81a,_0x39a3dd){return _0x5dc81a[_0xd6ef('0xa')](_0xd6ef('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce0b=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','VoiceTransferReport','util'];(function(_0x5693af,_0xa1e06){var _0x21f29f=function(_0x34327f){while(--_0x34327f){_0x5693af['push'](_0x5693af['shift']());}};_0x21f29f(++_0xa1e06);}(_0xce0b,0xe0));var _0xbce0=function(_0x14f2cf,_0x2d3713){_0x14f2cf=_0x14f2cf-0x0;var _0x4dd78f=_0xce0b[_0x14f2cf];return _0x4dd78f;};'use strict';var _=require('lodash');var util=require(_0xbce0('0x0'));var logger=require(_0xbce0('0x1'))(_0xbce0('0x2'));var moment=require('moment');var BPromise=require(_0xbce0('0x3'));var rp=require(_0xbce0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbce0('0x5'));var config=require(_0xbce0('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x31d56b,_0x19ddb8){return _0x31d56b[_0xbce0('0x7')](_0xbce0('0x8'),attributes,{'tableName':'report_call_transfer','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 060c651..2171cf6 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 _0x742c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','VoiceTransferReport','create','body','raw','CreateVoiceTransferReport','lodash'];(function(_0x558849,_0x113740){var _0x4149cd=function(_0x4779e6){while(--_0x4779e6){_0x558849['push'](_0x558849['shift']());}};_0x4149cd(++_0x113740);}(_0x742c,0x197));var _0xc742=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x742c[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0xc742('0x0'));var util=require('util');var moment=require(_0xc742('0x1'));var BPromise=require(_0xc742('0x2'));var rs=require(_0xc742('0x3'));var fs=require('fs');var Redis=require(_0xc742('0x4'));var db=require(_0xc742('0x5'))['db'];var utils=require(_0xc742('0x6'));var logger=require('../../config/logger')(_0xc742('0x7'));var config=require(_0xc742('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1211b5,_0x384a4f,_0xfd4a9d){return new BPromise(function(_0x25852d,_0x2d8219){return client[_0xc742('0x9')](_0x1211b5,_0xfd4a9d)[_0xc742('0xa')](function(_0x132f97){logger[_0xc742('0xb')](_0xc742('0xc'),_0x384a4f,'request\x20sent');logger[_0xc742('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x384a4f,_0xc742('0xe'),JSON['stringify'](_0x132f97));if(_0x132f97['error']){if(_0x132f97[_0xc742('0xf')]['code']===0x1f4){logger[_0xc742('0xf')](_0xc742('0xc'),_0x384a4f,_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);return _0x2d8219(_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);}logger[_0xc742('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x384a4f,_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);return _0x25852d(_0x132f97['error'][_0xc742('0x10')]);}else{logger[_0xc742('0xb')](_0xc742('0xc'),_0x384a4f,_0xc742('0xe'));_0x25852d(_0x132f97[_0xc742('0x11')]['message']);}})[_0xc742('0x12')](function(_0x47fb72){logger[_0xc742('0xf')](_0xc742('0xc'),_0x384a4f,_0x47fb72);_0x2d8219(_0x47fb72);});});}exports['CreateVoiceTransferReport']=function(_0x1bb447){var _0x418b95=this;return new Promise(function(_0x3a5642,_0x1b2b47){return db[_0xc742('0x13')][_0xc742('0x14')](_0x1bb447[_0xc742('0x15')],{'raw':_0x1bb447['options']?_0x1bb447['options'][_0xc742('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x536f78){logger[_0xc742('0xb')](_0xc742('0x17'),_0x1bb447);logger['debug']('CreateVoiceTransferReport',_0x1bb447,JSON['stringify'](_0x536f78));_0x3a5642(_0x536f78);})[_0xc742('0x12')](function(_0xddedc7){logger[_0xc742('0xf')](_0xc742('0x17'),_0xddedc7['message'],_0x1bb447);_0x1b2b47(_0x418b95['error'](0x1f4,_0xddedc7[_0xc742('0x10')]));});});}; \ No newline at end of file +var _0x989b=['stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','VoiceTransferReport','create','raw','CreateVoiceTransferReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x989b,0xeb));var _0xb989=function(_0x4f680d,_0x28fb35){_0x4f680d=_0x4f680d-0x0;var _0x43850d=_0x989b[_0x4f680d];return _0x43850d;};'use strict';var _=require(_0xb989('0x0'));var util=require(_0xb989('0x1'));var moment=require(_0xb989('0x2'));var BPromise=require(_0xb989('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb989('0x4'));var db=require(_0xb989('0x5'))['db'];var utils=require(_0xb989('0x6'));var logger=require('../../config/logger')(_0xb989('0x7'));var config=require(_0xb989('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb989('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x347f60,_0x139c25,_0x76acb1){return new BPromise(function(_0x1f6f17,_0x41f634){return client[_0xb989('0xa')](_0x347f60,_0x76acb1)[_0xb989('0xb')](function(_0x5df050){logger['info'](_0xb989('0xc'),_0x139c25,_0xb989('0xd'));logger[_0xb989('0xe')](_0xb989('0xf'),_0x139c25,_0xb989('0xd'),JSON['stringify'](_0x5df050));if(_0x5df050[_0xb989('0x10')]){if(_0x5df050['error'][_0xb989('0x11')]===0x1f4){logger[_0xb989('0x10')](_0xb989('0xc'),_0x139c25,_0x5df050['error'][_0xb989('0x12')]);return _0x41f634(_0x5df050[_0xb989('0x10')][_0xb989('0x12')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x139c25,_0x5df050[_0xb989('0x10')][_0xb989('0x12')]);return _0x1f6f17(_0x5df050['error'][_0xb989('0x12')]);}else{logger[_0xb989('0x13')](_0xb989('0xc'),_0x139c25,_0xb989('0xd'));_0x1f6f17(_0x5df050['result']['message']);}})[_0xb989('0x14')](function(_0x392257){logger[_0xb989('0x10')](_0xb989('0xc'),_0x139c25,_0x392257);_0x41f634(_0x392257);});});}exports['CreateVoiceTransferReport']=function(_0x3d3861){var _0x551ff3=this;return new Promise(function(_0x271f31,_0x1f3819){return db[_0xb989('0x15')][_0xb989('0x16')](_0x3d3861['body'],{'raw':_0x3d3861['options']?_0x3d3861['options'][_0xb989('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2e5528){logger[_0xb989('0x13')](_0xb989('0x18'),_0x3d3861);logger[_0xb989('0xe')](_0xb989('0x18'),_0x3d3861,JSON[_0xb989('0x19')](_0x2e5528));_0x271f31(_0x2e5528);})['catch'](function(_0x16d8cb){logger['error'](_0xb989('0x18'),_0x16d8cb[_0xb989('0x12')],_0x3d3861);_0x1f3819(_0x551ff3[_0xb989('0x10')](0x1f4,_0x16d8cb[_0xb989('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ef7ce66..943bdde 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb43b,0x1b2));var _0xbb43=function(_0x301f1a,_0x3aebe3){_0x301f1a=_0x301f1a-0x0;var _0x18595a=_0xb43b[_0x301f1a];return _0x18595a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x143ce6,_0x46e089){_0x143ce6=_0x143ce6-0x0;var _0x33ed64=_0xf3cd[_0x143ce6];return _0x33ed64;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b5182dd..dbaf90d 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 _0x19ea=['format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','json','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','../../config/environment','bluebird','jayson/promise','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','log','error','name','send','status','NotFound','request','then','message','result','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callerId','callbackUrl'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x19ea,0xfe));var _0xa19e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x19ea[_0x2a6809];return _0x11c371;};'use strict';var path=require(_0xa19e('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xa19e('0x1'));var util=require('util');var BPromise=require(_0xa19e('0x2'));var jayson=require(_0xa19e('0x3'));var amiClient=jayson[_0xa19e('0x4')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0xa19e('0x5'));var Redis=require(_0xa19e('0x6'));config[_0xa19e('0x7')]=_[_0xa19e('0x8')](config[_0xa19e('0x7')],{'host':_0xa19e('0x9'),'port':0x18eb});var io=require(_0xa19e('0xa'))(new Redis(config[_0xa19e('0x7')]));var Schema=require(_0xa19e('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'callNumber':{'type':'string','required':[!![],_0xa19e('0xe')]},'callerId':{'type':_0xa19e('0xf')},'callbackUrl':{'type':_0xa19e('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':[!![],_0xa19e('0x10')]},'transferNumber':{'type':_0xa19e('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]}});function emit(_0x2598f5,_0x48530c,_0x28fd37){logger[_0xa19e('0x11')](_0x2598f5,_0x48530c,JSON[_0xa19e('0x12')](_0x28fd37));io['to'](_0x2598f5)[_0xa19e('0x13')](_0x48530c,_0x28fd37);}function handleError(_0x3acfae){return function(_0x38e398){console[_0xa19e('0x14')]('handleError:',_0x38e398,_0x38e398 instanceof RangeError);logger[_0xa19e('0x15')](_0x38e398['stack']);if(_0x38e398 instanceof RangeError){if(_0x38e398[_0xa19e('0x16')]){delete _0x38e398['name'];}_0x3acfae['status'](0x194)[_0xa19e('0x17')](_0x38e398);}else{if(_0x38e398[_0xa19e('0x16')]){delete _0x38e398['name'];}_0x3acfae[_0xa19e('0x18')](0x1f4)[_0xa19e('0x17')](_0x38e398);}};}function checkError(){return function(_0x3c11d5){if(!_0x3c11d5){throw new RangeError(_0xa19e('0x19'));}return _0x3c11d5;};}function respondWithRpcPromise(_0x5869c8,_0x41ad6b){return new BPromise(function(_0x33b588,_0x105874){var _0x301f6d=amiClient;return _0x301f6d[_0xa19e('0x1a')](_0x5869c8,_0x41ad6b)[_0xa19e('0x1b')](function(_0x2a416e){if(_0x2a416e[_0xa19e('0x15')]){if(_0x2a416e[_0xa19e('0x15')]['code']===0x1f4){return _0x105874(_0x2a416e[_0xa19e('0x15')][_0xa19e('0x1c')]);}return _0x33b588(_0x2a416e['error'][_0xa19e('0x1c')]);}else{_0x33b588(_0x2a416e[_0xa19e('0x1d')]);}})['catch'](function(_0x20b05c){_0x105874(_0x20b05c);});});}function getAgent(_0x389f2f){return db['User'][_0xa19e('0x1e')]({'where':{'id':_0x389f2f,'role':_0xa19e('0x1f')}})[_0xa19e('0x1b')](checkError());}function getAgentCheckSession(_0x21c9ca,_0x2076c5){return new BPromise(function(_0x180407,_0x23c0cc){var _0x3f5ac6=respondWithRpcPromise(_0xa19e('0x20'));var _0x24dd51=getAgent(_0x21c9ca);Promise[_0xa19e('0x21')]([_0x3f5ac6,_0x24dd51])[_0xa19e('0x1b')](function(_0x1ce643){var _0x475a26=_0x1ce643[0x0];var _0xdf0b20=_0x1ce643[0x1];var _0x4613c3=_[_0xa19e('0x22')](_0x475a26[_0xa19e('0x23')],function(_0x3dcd74){return _0x3dcd74[_0xa19e('0x24')]==_0xdf0b20['id']&&_0x3dcd74['sessionId']==_0x2076c5;});if(_0x4613c3[_0xa19e('0x25')]==0x1){_0x180407(_0xdf0b20);}else{_0x23c0cc(new RangeError(_0xa19e('0x26')+_0x2076c5+_0xa19e('0x27')));}});});}exports[_0xa19e('0x28')]=function(_0x13d6c4,_0x355fd9){logger['info'](_0xa19e('0x29'),_0x13d6c4[_0xa19e('0x2a')]);var _0x543ae5=originateValidation[_0xa19e('0xb')](_0x13d6c4['body']);if(_0x543ae5['length']>0x0){return _0x355fd9[_0xa19e('0x18')](0x190)['json'](_0x543ae5);}var _0x5a42c9=_0x13d6c4['body'][_0xa19e('0x2b')];var _0x177e4b=_0x13d6c4[_0xa19e('0x2a')]['callNumber'];var _0x1ec065=_0x13d6c4[_0xa19e('0x2a')][_0xa19e('0x2c')];var _0x288a41=_0x13d6c4[_0xa19e('0x2a')][_0xa19e('0x2d')];return getAgent(_0x5a42c9)['then'](function(_0x3e1e62){logger[_0xa19e('0x11')]('entityFound:',_0x3e1e62[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x3e1e62['name']),'webbar:originate',{'callNumber':_0x177e4b,'callerId':_0x1ec065,'callbackUrl':_0x288a41});return _0x355fd9[_0xa19e('0x18')](0xc8)['json']({'error':![],'message':_0xa19e('0x30')});})[_0xa19e('0x31')](handleError(_0x355fd9));};exports[_0xa19e('0x32')]=function(_0x18c54a,_0x4f7e80){logger[_0xa19e('0x11')](_0xa19e('0x33'),_0x18c54a['body']);var _0x438e5a=hangupValidation['validate'](_0x18c54a[_0xa19e('0x2a')]);if(_0x438e5a[_0xa19e('0x25')]>0x0){return _0x4f7e80[_0xa19e('0x18')](0x190)['json'](_0x438e5a);}var _0x45ee6f=_0x18c54a[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0x4c3554=_0x18c54a[_0xa19e('0x2a')][_0xa19e('0x34')];return getAgent(_0x45ee6f)['then'](function(_0x561608){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x561608['name']);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x561608['name']),_0xa19e('0x36'),{'sessionId':_0x4c3554});return _0x4f7e80[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x38')});})[_0xa19e('0x31')](handleError(_0x4f7e80));};exports['answer']=function(_0x2acd9b,_0x26b0fd){logger[_0xa19e('0x11')](_0xa19e('0x39'),_0x2acd9b[_0xa19e('0x2a')]);var _0x51f0f4=answerValidation[_0xa19e('0xb')](_0x2acd9b['body']);if(_0x51f0f4[_0xa19e('0x25')]>0x0){return _0x26b0fd[_0xa19e('0x18')](0x190)['json'](_0x51f0f4);}var _0x8dfa7e=_0x2acd9b[_0xa19e('0x2a')]['userId'];var _0x41d7ae=_0x2acd9b['body'][_0xa19e('0x34')];return getAgent(_0x8dfa7e)[_0xa19e('0x1b')](function(_0x3572b2){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x3572b2[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x3572b2['name']),_0xa19e('0x3a'),{'sessionId':_0x41d7ae});return _0x26b0fd[_0xa19e('0x18')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xa19e('0x31')](handleError(_0x26b0fd));};exports[_0xa19e('0x3b')]=function(_0x3cbc3b,_0x5a865d){logger[_0xa19e('0x11')](_0xa19e('0x3c'),_0x3cbc3b['body']);var _0x1b7f8b=holdValidation[_0xa19e('0xb')](_0x3cbc3b[_0xa19e('0x2a')]);if(_0x1b7f8b['length']>0x0){return _0x5a865d[_0xa19e('0x18')](0x190)['json'](_0x1b7f8b);}var _0x349543=_0x3cbc3b[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0x3c3b3a=_0x3cbc3b[_0xa19e('0x2a')]['sessionId'];return getAgent(_0x349543)[_0xa19e('0x1b')](function(_0x4c90fe){logger[_0xa19e('0x11')]('entityFound:',_0x4c90fe[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x4c90fe[_0xa19e('0x16')]),'webbar:hold',{'sessionId':_0x3c3b3a});return _0x5a865d[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x3d')});})[_0xa19e('0x31')](handleError(_0x5a865d));};exports['unhold']=function(_0x454c9f,_0x5ae431){logger[_0xa19e('0x11')](_0xa19e('0x3e'),_0x454c9f[_0xa19e('0x2a')]);var _0x501dea=unholdValidation[_0xa19e('0xb')](_0x454c9f[_0xa19e('0x2a')]);if(_0x501dea['length']>0x0){return _0x5ae431[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x501dea);}var _0x33b6b0=_0x454c9f[_0xa19e('0x2a')]['userId'];var _0x51d10a=_0x454c9f[_0xa19e('0x2a')][_0xa19e('0x34')];return getAgent(_0x33b6b0)['then'](function(_0x18f219){logger[_0xa19e('0x11')]('entityFound:',_0x18f219[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x18f219[_0xa19e('0x16')]),_0xa19e('0x3f'),{'sessionId':_0x51d10a});return _0x5ae431[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x40')});})[_0xa19e('0x31')](handleError(_0x5ae431));};exports[_0xa19e('0x41')]=function(_0x39eb06,_0x479b09){logger['info'](_0xa19e('0x42'),_0x479b09[_0xa19e('0x2a')]);var _0x17ac29=callsValidation['validate'](_0x39eb06['body']);if(_0x17ac29['length']>0x0){return _0x479b09[_0xa19e('0x18')](0x190)['json'](_0x17ac29);}var _0x3ce686=_0x39eb06[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0xdf2b29=respondWithRpcPromise('VoiceChannels');var _0x966a23=getAgent(_0x3ce686);return Promise[_0xa19e('0x21')]([_0xdf2b29,_0x966a23])[_0xa19e('0x1b')](function(_0xfe4a4){var _0x2cc680=_0xfe4a4[0x0];var _0x12064e=_0xfe4a4[0x1];var _0x1eb008=_[_0xa19e('0x22')](_0x2cc680[_0xa19e('0x23')],function(_0x43ed0f){return _0x43ed0f[_0xa19e('0x24')]==_0x12064e['id'];});return _0x479b09[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'count':_0x1eb008[_0xa19e('0x25')],'rows':_0x1eb008});})[_0xa19e('0x31')](handleError(_0x479b09));};exports[_0xa19e('0x43')]=function(_0x45f7ee,_0x5ad478){logger[_0xa19e('0x11')](_0xa19e('0x44'),_0x45f7ee['body']);var _0x14483e=conferenceValidation['validate'](_0x45f7ee['body']);if(_0x14483e[_0xa19e('0x25')]>0x0){return _0x5ad478[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x14483e);}var _0x5d85f2=_0x45f7ee[_0xa19e('0x2a')]['userId'];return getAgent(_0x5d85f2)[_0xa19e('0x1b')](function(_0x5afd28){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x5afd28[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x5afd28['name']),_0xa19e('0x45'));return _0x5ad478['status'](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x46')});})[_0xa19e('0x31')](handleError(_0x5ad478));};exports[_0xa19e('0x47')]=function(_0x1982b6,_0x2b625c){logger[_0xa19e('0x11')](_0xa19e('0x48'),_0x1982b6[_0xa19e('0x2a')]);var _0x3f6bf7=transferValidation[_0xa19e('0xb')](_0x1982b6[_0xa19e('0x2a')]);if(_0x3f6bf7['length']>0x0){return _0x2b625c[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x3f6bf7);}var _0x5ca466=_0x1982b6[_0xa19e('0x2a')]['userId'];var _0x1d991d=_0x1982b6['body'][_0xa19e('0x34')];var _0x45f260=_0x1982b6['body'][_0xa19e('0x49')];return getAgent(_0x5ca466)['then'](function(_0xbb6170){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0xbb6170[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0xbb6170['name']),_0xa19e('0x4a'),{'sessionId':_0x1d991d,'transferNumber':_0x45f260});return _0x2b625c[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa19e('0x31')](handleError(_0x2b625c));}; \ No newline at end of file +var _0xd3d1=['send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','length','sessionId\x20','originate','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','sessionId','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','handleError:','stack','name','status'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'use strict';var path=require(_0x1d3d('0x0'));var fs=require('fs');var _=require(_0x1d3d('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var jayson=require(_0x1d3d('0x4'));var amiClient=jayson[_0x1d3d('0x5')][_0x1d3d('0x6')]({'port':0x232a});var logger=require(_0x1d3d('0x7'))(_0x1d3d('0x8'));var Redis=require(_0x1d3d('0x9'));config[_0x1d3d('0xa')]=_[_0x1d3d('0xb')](config[_0x1d3d('0xa')],{'host':_0x1d3d('0xc'),'port':0x18eb});var io=require(_0x1d3d('0xd'))(new Redis(config[_0x1d3d('0xa')]));var Schema=require(_0x1d3d('0xe'));var originateValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],_0x1d3d('0x10')]},'callNumber':{'type':'string','required':[!![],_0x1d3d('0x11')]},'callerId':{'type':_0x1d3d('0x12')},'callbackUrl':{'type':_0x1d3d('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],_0x1d3d('0x10')]},'sessionId':{'type':_0x1d3d('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],_0x1d3d('0x10')]},'sessionId':{'type':_0x1d3d('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],_0x1d3d('0x10')]},'sessionId':{'type':'string','required':[!![],_0x1d3d('0x13')]},'transferNumber':{'type':_0x1d3d('0x12'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1d3d('0x10')]},'sessionId':{'type':_0x1d3d('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1d3d('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1d3d('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1d3d('0xf'),'required':[!![],_0x1d3d('0x10')]}});function emit(_0x24bb8c,_0x21c2e4,_0x1bdbdc){logger[_0x1d3d('0x14')](_0x24bb8c,_0x21c2e4,JSON['stringify'](_0x1bdbdc));io['to'](_0x24bb8c)['emit'](_0x21c2e4,_0x1bdbdc);}function handleError(_0x316ab4){return function(_0xe0a583){console['log'](_0x1d3d('0x15'),_0xe0a583,_0xe0a583 instanceof RangeError);logger['error'](_0xe0a583[_0x1d3d('0x16')]);if(_0xe0a583 instanceof RangeError){if(_0xe0a583[_0x1d3d('0x17')]){delete _0xe0a583[_0x1d3d('0x17')];}_0x316ab4[_0x1d3d('0x18')](0x194)['send'](_0xe0a583);}else{if(_0xe0a583[_0x1d3d('0x17')]){delete _0xe0a583['name'];}_0x316ab4['status'](0x1f4)[_0x1d3d('0x19')](_0xe0a583);}};}function checkError(){return function(_0x2bfac3){if(!_0x2bfac3){throw new RangeError(_0x1d3d('0x1a'));}return _0x2bfac3;};}function respondWithRpcPromise(_0x344a03,_0xa6f180){return new BPromise(function(_0xe4afa2,_0x471df5){var _0xa55c43=amiClient;return _0xa55c43[_0x1d3d('0x1b')](_0x344a03,_0xa6f180)[_0x1d3d('0x1c')](function(_0x1610a6){if(_0x1610a6['error']){if(_0x1610a6[_0x1d3d('0x1d')][_0x1d3d('0x1e')]===0x1f4){return _0x471df5(_0x1610a6['error'][_0x1d3d('0x1f')]);}return _0xe4afa2(_0x1610a6['error'][_0x1d3d('0x1f')]);}else{_0xe4afa2(_0x1610a6[_0x1d3d('0x20')]);}})[_0x1d3d('0x21')](function(_0x4235fd){_0x471df5(_0x4235fd);});});}function getAgent(_0x44e03e){return db[_0x1d3d('0x22')][_0x1d3d('0x23')]({'where':{'id':_0x44e03e,'role':_0x1d3d('0x24')}})[_0x1d3d('0x1c')](checkError());}function getAgentCheckSession(_0x2df7b7,_0x172dbd){return new BPromise(function(_0x4f0aa7,_0x3f5681){var _0x5b2986=respondWithRpcPromise(_0x1d3d('0x25'));var _0x2bcc2=getAgent(_0x2df7b7);Promise['all']([_0x5b2986,_0x2bcc2])[_0x1d3d('0x1c')](function(_0x16b7b3){var _0x3cb011=_0x16b7b3[0x0];var _0x2a3812=_0x16b7b3[0x1];var _0x4abbfc=_[_0x1d3d('0x26')](_0x3cb011[_0x1d3d('0x27')],function(_0x5d1b6c){return _0x5d1b6c[_0x1d3d('0x28')]==_0x2a3812['id']&&_0x5d1b6c['sessionId']==_0x172dbd;});if(_0x4abbfc[_0x1d3d('0x29')]==0x1){_0x4f0aa7(_0x2a3812);}else{_0x3f5681(new RangeError(_0x1d3d('0x2a')+_0x172dbd+'\x20not\x20found!'));}});});}exports[_0x1d3d('0x2b')]=function(_0x192f60,_0x102b70){logger[_0x1d3d('0x14')](_0x1d3d('0x2c'),_0x192f60[_0x1d3d('0x2d')]);var _0x4fc03a=originateValidation[_0x1d3d('0xe')](_0x192f60[_0x1d3d('0x2d')]);if(_0x4fc03a['length']>0x0){return _0x102b70[_0x1d3d('0x18')](0x190)[_0x1d3d('0x2e')](_0x4fc03a);}var _0x4017b2=_0x192f60[_0x1d3d('0x2d')]['userId'];var _0x4a1e67=_0x192f60[_0x1d3d('0x2d')][_0x1d3d('0x2f')];var _0x47a8e3=_0x192f60[_0x1d3d('0x2d')][_0x1d3d('0x30')];var _0x2888f9=_0x192f60[_0x1d3d('0x2d')]['callbackUrl'];return getAgent(_0x4017b2)['then'](function(_0x29fa6c){logger['info'](_0x1d3d('0x31'),_0x29fa6c[_0x1d3d('0x17')]);emit(util[_0x1d3d('0x32')](_0x1d3d('0x33'),_0x29fa6c[_0x1d3d('0x17')]),_0x1d3d('0x34'),{'callNumber':_0x4a1e67,'callerId':_0x47a8e3,'callbackUrl':_0x2888f9});return _0x102b70[_0x1d3d('0x18')](0xc8)[_0x1d3d('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0x1d3d('0x21')](handleError(_0x102b70));};exports['hangup']=function(_0x58ae8e,_0x206e4c){logger['info'](_0x1d3d('0x35'),_0x58ae8e[_0x1d3d('0x2d')]);var _0x182083=hangupValidation[_0x1d3d('0xe')](_0x58ae8e['body']);if(_0x182083['length']>0x0){return _0x206e4c[_0x1d3d('0x18')](0x190)['json'](_0x182083);}var _0x290853=_0x58ae8e[_0x1d3d('0x2d')]['userId'];var _0x1ad7a6=_0x58ae8e[_0x1d3d('0x2d')]['sessionId'];return getAgent(_0x290853)[_0x1d3d('0x1c')](function(_0x40f8ca){logger[_0x1d3d('0x14')](_0x1d3d('0x31'),_0x40f8ca[_0x1d3d('0x17')]);emit(util[_0x1d3d('0x32')]('user:%s',_0x40f8ca[_0x1d3d('0x17')]),_0x1d3d('0x36'),{'sessionId':_0x1ad7a6});return _0x206e4c[_0x1d3d('0x18')](0xc8)[_0x1d3d('0x2e')]({'error':![],'message':_0x1d3d('0x37')});})['catch'](handleError(_0x206e4c));};exports[_0x1d3d('0x38')]=function(_0x2ccba6,_0x1c0cc6){logger[_0x1d3d('0x14')]('answer\x20fired:',_0x2ccba6[_0x1d3d('0x2d')]);var _0x977ea8=answerValidation[_0x1d3d('0xe')](_0x2ccba6[_0x1d3d('0x2d')]);if(_0x977ea8[_0x1d3d('0x29')]>0x0){return _0x1c0cc6['status'](0x190)['json'](_0x977ea8);}var _0x229f48=_0x2ccba6[_0x1d3d('0x2d')][_0x1d3d('0x39')];var _0x66efd=_0x2ccba6[_0x1d3d('0x2d')]['sessionId'];return getAgent(_0x229f48)[_0x1d3d('0x1c')](function(_0x557a25){logger[_0x1d3d('0x14')](_0x1d3d('0x31'),_0x557a25[_0x1d3d('0x17')]);emit(util[_0x1d3d('0x32')]('user:%s',_0x557a25[_0x1d3d('0x17')]),_0x1d3d('0x3a'),{'sessionId':_0x66efd});return _0x1c0cc6[_0x1d3d('0x18')](0xc8)[_0x1d3d('0x2e')]({'error':![],'message':_0x1d3d('0x3b')});})[_0x1d3d('0x21')](handleError(_0x1c0cc6));};exports[_0x1d3d('0x3c')]=function(_0x55aa8a,_0x3c5ccf){logger['info'](_0x1d3d('0x3d'),_0x55aa8a[_0x1d3d('0x2d')]);var _0x5e8ec0=holdValidation[_0x1d3d('0xe')](_0x55aa8a['body']);if(_0x5e8ec0[_0x1d3d('0x29')]>0x0){return _0x3c5ccf['status'](0x190)[_0x1d3d('0x2e')](_0x5e8ec0);}var _0xebd1f4=_0x55aa8a[_0x1d3d('0x2d')][_0x1d3d('0x39')];var _0xea9cf2=_0x55aa8a[_0x1d3d('0x2d')][_0x1d3d('0x3e')];return getAgent(_0xebd1f4)[_0x1d3d('0x1c')](function(_0x59e88a){logger['info']('entityFound:',_0x59e88a[_0x1d3d('0x17')]);emit(util[_0x1d3d('0x32')](_0x1d3d('0x33'),_0x59e88a[_0x1d3d('0x17')]),_0x1d3d('0x3f'),{'sessionId':_0xea9cf2});return _0x3c5ccf[_0x1d3d('0x18')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x3c5ccf));};exports['unhold']=function(_0x3dc5ca,_0x21620d){logger[_0x1d3d('0x14')](_0x1d3d('0x40'),_0x3dc5ca[_0x1d3d('0x2d')]);var _0x363f4c=unholdValidation[_0x1d3d('0xe')](_0x3dc5ca[_0x1d3d('0x2d')]);if(_0x363f4c[_0x1d3d('0x29')]>0x0){return _0x21620d[_0x1d3d('0x18')](0x190)[_0x1d3d('0x2e')](_0x363f4c);}var _0xb88d59=_0x3dc5ca[_0x1d3d('0x2d')][_0x1d3d('0x39')];var _0x311b05=_0x3dc5ca['body'][_0x1d3d('0x3e')];return getAgent(_0xb88d59)[_0x1d3d('0x1c')](function(_0x1bbfc8){logger[_0x1d3d('0x14')]('entityFound:',_0x1bbfc8[_0x1d3d('0x17')]);emit(util['format']('user:%s',_0x1bbfc8[_0x1d3d('0x17')]),_0x1d3d('0x41'),{'sessionId':_0x311b05});return _0x21620d['status'](0xc8)[_0x1d3d('0x2e')]({'error':![],'message':_0x1d3d('0x42')});})['catch'](handleError(_0x21620d));};exports[_0x1d3d('0x43')]=function(_0x7af4dd,_0x15d9b4){logger[_0x1d3d('0x14')](_0x1d3d('0x44'),_0x15d9b4[_0x1d3d('0x2d')]);var _0x213b0b=callsValidation[_0x1d3d('0xe')](_0x7af4dd[_0x1d3d('0x2d')]);if(_0x213b0b['length']>0x0){return _0x15d9b4[_0x1d3d('0x18')](0x190)['json'](_0x213b0b);}var _0x482c31=_0x7af4dd['body']['userId'];var _0x17c3ab=respondWithRpcPromise(_0x1d3d('0x25'));var _0x32aaa2=getAgent(_0x482c31);return Promise[_0x1d3d('0x45')]([_0x17c3ab,_0x32aaa2])['then'](function(_0xecfc7e){var _0x480439=_0xecfc7e[0x0];var _0x44273d=_0xecfc7e[0x1];var _0xd3f336=_['filter'](_0x480439[_0x1d3d('0x27')],function(_0x45419e){return _0x45419e['UserId']==_0x44273d['id'];});return _0x15d9b4[_0x1d3d('0x18')](0xc8)[_0x1d3d('0x2e')]({'count':_0xd3f336[_0x1d3d('0x29')],'rows':_0xd3f336});})[_0x1d3d('0x21')](handleError(_0x15d9b4));};exports[_0x1d3d('0x46')]=function(_0x16e757,_0x4e47d5){logger[_0x1d3d('0x14')](_0x1d3d('0x47'),_0x16e757[_0x1d3d('0x2d')]);var _0x1183c0=conferenceValidation[_0x1d3d('0xe')](_0x16e757['body']);if(_0x1183c0[_0x1d3d('0x29')]>0x0){return _0x4e47d5['status'](0x190)[_0x1d3d('0x2e')](_0x1183c0);}var _0x5dcad1=_0x16e757[_0x1d3d('0x2d')][_0x1d3d('0x39')];return getAgent(_0x5dcad1)[_0x1d3d('0x1c')](function(_0x1711ee){logger[_0x1d3d('0x14')](_0x1d3d('0x31'),_0x1711ee[_0x1d3d('0x17')]);emit(util['format'](_0x1d3d('0x33'),_0x1711ee[_0x1d3d('0x17')]),_0x1d3d('0x48'));return _0x4e47d5[_0x1d3d('0x18')](0xc8)[_0x1d3d('0x2e')]({'error':![],'message':_0x1d3d('0x49')});})['catch'](handleError(_0x4e47d5));};exports[_0x1d3d('0x4a')]=function(_0x2ca216,_0xa8891a){logger[_0x1d3d('0x14')](_0x1d3d('0x4b'),_0x2ca216['body']);var _0xe83c1d=transferValidation[_0x1d3d('0xe')](_0x2ca216[_0x1d3d('0x2d')]);if(_0xe83c1d['length']>0x0){return _0xa8891a[_0x1d3d('0x18')](0x190)['json'](_0xe83c1d);}var _0x2ee6ca=_0x2ca216['body'][_0x1d3d('0x39')];var _0x378878=_0x2ca216[_0x1d3d('0x2d')]['sessionId'];var _0x389330=_0x2ca216[_0x1d3d('0x2d')][_0x1d3d('0x4c')];return getAgent(_0x2ee6ca)['then'](function(_0x19a126){logger[_0x1d3d('0x14')](_0x1d3d('0x31'),_0x19a126['name']);emit(util[_0x1d3d('0x32')](_0x1d3d('0x33'),_0x19a126[_0x1d3d('0x17')]),_0x1d3d('0x4d'),{'sessionId':_0x378878,'transferNumber':_0x389330});return _0xa8891a[_0x1d3d('0x18')](0xc8)['json']({'error':![],'message':_0x1d3d('0x4e')});})[_0x1d3d('0x21')](handleError(_0xa8891a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 481c453..32b6c82 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 _0xea26=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','/:id/dispositions','addDisposition','addAgents','addApplications','notify','/:id/send','put','update','destroy','delete','removeAgents','exports','multer','util','connect-timeout'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xea26,0xc3));var _0x6ea2=function(_0x54de7d,_0x431a61){_0x54de7d=_0x54de7d-0x0;var _0x5388d3=_0xea26[_0x54de7d];return _0x5388d3;};'use strict';var multer=require(_0x6ea2('0x0'));var util=require(_0x6ea2('0x1'));var path=require('path');var timeout=require(_0x6ea2('0x2'));var express=require(_0x6ea2('0x3'));var router=express[_0x6ea2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ea2('0x5'));var interaction=require(_0x6ea2('0x6'));var config=require(_0x6ea2('0x7'));var controller=require(_0x6ea2('0x8'));router[_0x6ea2('0x9')]('/',auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xb')]);router[_0x6ea2('0x9')](_0x6ea2('0xc'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xd')]);router[_0x6ea2('0x9')](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xf')]);router[_0x6ea2('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x6ea2('0x9')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['getAnswers']);router[_0x6ea2('0x9')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller['getAgents']);router[_0x6ea2('0x9')](_0x6ea2('0x12'),auth['isAuthenticated'](),controller[_0x6ea2('0x13')]);router[_0x6ea2('0x14')]('/',auth[_0x6ea2('0xa')](),controller['create']);router[_0x6ea2('0x14')](_0x6ea2('0x15'),auth['isAuthenticated'](),controller[_0x6ea2('0x16')]);router[_0x6ea2('0x14')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['addAnswer']);router[_0x6ea2('0x14')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x17')]);router[_0x6ea2('0x14')](_0x6ea2('0x12'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x18')]);router[_0x6ea2('0x14')]('/:id/notify',controller[_0x6ea2('0x19')]);router[_0x6ea2('0x14')](_0x6ea2('0x1a'),auth[_0x6ea2('0xa')](),controller['send']);router[_0x6ea2('0x1b')](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1c')]);router['delete'](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1d')]);router[_0x6ea2('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x6ea2('0x1e')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['removeAnswers']);router[_0x6ea2('0x1e')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1f')]);module[_0x6ea2('0x20')]=router; \ No newline at end of file +var _0x902f=['/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x902f,0x74));var _0xf902=function(_0x42caee,_0x12c5bc){_0x42caee=_0x42caee-0x0;var _0x4a455f=_0x902f[_0x42caee];return _0x4a455f;};'use strict';var multer=require(_0xf902('0x0'));var util=require(_0xf902('0x1'));var path=require(_0xf902('0x2'));var timeout=require(_0xf902('0x3'));var express=require('express');var router=express[_0xf902('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf902('0x5'));var config=require(_0xf902('0x6'));var controller=require(_0xf902('0x7'));router['get']('/',auth[_0xf902('0x8')](),controller[_0xf902('0x9')]);router[_0xf902('0xa')](_0xf902('0xb'),auth[_0xf902('0x8')](),controller[_0xf902('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf902('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf902('0xd')]);router[_0xf902('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf902('0xe')]);router[_0xf902('0xa')](_0xf902('0xf'),auth[_0xf902('0x8')](),controller[_0xf902('0x10')]);router[_0xf902('0xa')](_0xf902('0x11'),auth['isAuthenticated'](),controller[_0xf902('0x12')]);router[_0xf902('0x13')]('/',auth[_0xf902('0x8')](),controller['create']);router[_0xf902('0x13')]('/:id/dispositions',auth[_0xf902('0x8')](),controller['addDisposition']);router[_0xf902('0x13')](_0xf902('0x14'),auth[_0xf902('0x8')](),controller[_0xf902('0x15')]);router[_0xf902('0x13')](_0xf902('0xf'),auth['isAuthenticated'](),controller[_0xf902('0x16')]);router[_0xf902('0x13')](_0xf902('0x11'),auth[_0xf902('0x8')](),controller[_0xf902('0x17')]);router[_0xf902('0x13')](_0xf902('0x18'),controller['notify']);router[_0xf902('0x13')]('/:id/send',auth[_0xf902('0x8')](),controller[_0xf902('0x19')]);router[_0xf902('0x1a')](_0xf902('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0xf902('0x1c')](_0xf902('0x1b'),auth['isAuthenticated'](),controller[_0xf902('0x1d')]);router[_0xf902('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf902('0x1e')]);router[_0xf902('0x1c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf902('0x1f')]);router[_0xf902('0x1c')](_0xf902('0xf'),auth[_0xf902('0x8')](),controller[_0xf902('0x20')]);module[_0xf902('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index bc01aa6..1c2da94 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 _0x21e9=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate'];(function(_0x26973e,_0x4d1d08){var _0x26893c=function(_0x55b60d){while(--_0x55b60d){_0x26973e['push'](_0x26973e['shift']());}};_0x26893c(++_0x4d1d08);}(_0x21e9,0x164));var _0x921e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x21e9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x921e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x921e('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x921e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x921e('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x921e('0x3')]();}},'phone':{'type':Sequelize[_0x921e('0x2')]},'type':{'type':Sequelize[_0x921e('0x4')](_0x921e('0x5'),_0x921e('0x6'))},'accountSid':{'type':Sequelize[_0x921e('0x2')]},'baseUrl':{'type':Sequelize[_0x921e('0x2')]},'authToken':{'type':Sequelize[_0x921e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x921e('0x7')],'defaultValue':function(){return _0x921e('0x8');}},'notificationSound':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x921e('0xa')],'comment':_0x921e('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12d97c){if(!_0x12d97c){this[_0x921e('0xc')](_0x921e('0xd'),null);}this['setDataValue'](_0x921e('0xe'),_0x12d97c);}},'description':{'type':Sequelize[_0x921e('0x2')]}}; \ No newline at end of file +var _0x003a=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','twilio','sinch','TEXT','BOOLEAN','INTEGER'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x003a,0x1b0));var _0xa003=function(_0xac9b92,_0x22d97d){_0xac9b92=_0xac9b92-0x0;var _0x121990=_0x003a[_0xac9b92];return _0x121990;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa003('0x0'));module[_0xa003('0x1')]={'name':{'type':Sequelize[_0xa003('0x2')],'unique':_0xa003('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa003('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa003('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xa003('0x5'),_0xa003('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xa003('0x2')]},'authToken':{'type':Sequelize[_0xa003('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa003('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa003('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa003('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa003('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa003('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa003('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa003('0x9')],'comment':_0xa003('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xa003('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x39eaec){if(!_0x39eaec){this[_0xa003('0xb')](_0xa003('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x39eaec);}},'description':{'type':Sequelize[_0xa003('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index eb169f2..3730ca3 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 _0x02a4=['queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','stringify','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','read','timestamp','message_id','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','replace','whatsapp:','Body','MessageSid','notifications','from','messageId','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','autoclose','applications','push','unmanaged','created','WhatsappMessage','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent'];(function(_0x2ad003,_0x2d4962){var _0x4cdf67=function(_0x3159e0){while(--_0x3159e0){_0x2ad003['push'](_0x2ad003['shift']());}};_0x4cdf67(++_0x2d4962);}(_0x02a4,0x19d));var _0x402a=function(_0x1fe5d7,_0x263feb){_0x1fe5d7=_0x1fe5d7-0x0;var _0x4873f4=_0x02a4[_0x1fe5d7];return _0x4873f4;};'use strict';var emlformat=require(_0x402a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x402a('0x1'));var rp=require(_0x402a('0x2'));var moment=require(_0x402a('0x3'));var BPromise=require(_0x402a('0x4'));var Mustache=require(_0x402a('0x5'));var util=require('util');var path=require(_0x402a('0x6'));var sox=require(_0x402a('0x7'));var csv=require(_0x402a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x402a('0x9'));var _=require(_0x402a('0xa'));var squel=require(_0x402a('0xb'));var crypto=require('crypto');var jsforce=require(_0x402a('0xc'));var deskjs=require(_0x402a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x402a('0xe'));var Papa=require(_0x402a('0xf'));var Redis=require(_0x402a('0x10'));var authService=require(_0x402a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x402a('0x12'))(_0x402a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x402a('0x14'));var db=require(_0x402a('0x15'))['db'];config['redis']=_[_0x402a('0x16')](config[_0x402a('0x17')],{'host':_0x402a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x402a('0x19'))[_0x402a('0x1a')](socket);var jayson=require(_0x402a('0x1b'));var client=jayson[_0x402a('0x1c')][_0x402a('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4dd0e9,_0x4897dc,_0x1ef004,_0x5dc2ae){return new BPromise(function(_0x36781e,_0x175017){var _0x387ab8=_0x5dc2ae||client;return _0x387ab8[_0x402a('0x1e')](_0x4dd0e9,_0x1ef004)['then'](function(_0x41f368){logger['info'](_0x402a('0x1f'),_0x4897dc,_0x402a('0x20'));logger[_0x402a('0x21')](_0x402a('0x22'),_0x4897dc,_0x402a('0x20'),JSON['stringify'](_0x41f368));if(_0x41f368['error']){if(_0x41f368['error']['code']===0x1f4){logger['error'](_0x402a('0x1f'),_0x4897dc,_0x41f368[_0x402a('0x23')][_0x402a('0x24')]);return _0x175017(_0x41f368['error'][_0x402a('0x24')]);}logger[_0x402a('0x23')](_0x402a('0x1f'),_0x4897dc,_0x41f368[_0x402a('0x23')]['message']);return _0x36781e(_0x41f368[_0x402a('0x23')]['message']);}else{logger[_0x402a('0x25')](_0x402a('0x1f'),_0x4897dc,_0x402a('0x20'));_0x36781e(_0x41f368[_0x402a('0x26')][_0x402a('0x24')]);}})['catch'](function(_0x34445e){logger[_0x402a('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x4897dc,_0x34445e);_0x175017(_0x34445e);});});}function respondWithStatusCode(_0x1eb8ad,_0x5f2aa2){_0x5f2aa2=_0x5f2aa2||0xcc;return function(_0x53ad68){if(_0x53ad68){return _0x1eb8ad[_0x402a('0x27')](_0x5f2aa2);}return _0x1eb8ad['status'](_0x5f2aa2)['end']();};}function respondWithResult(_0x2c2583,_0x4910fa){_0x4910fa=_0x4910fa||0xc8;return function(_0x3ed63d){if(_0x3ed63d){return _0x2c2583['status'](_0x4910fa)[_0x402a('0x28')](_0x3ed63d);}};}function respondWithFilteredResult(_0x4c82d3,_0x1fcba1){return function(_0x4d4e96){if(_0x4d4e96){var _0x4cd228=typeof _0x1fcba1[_0x402a('0x29')]==='undefined'&&typeof _0x1fcba1[_0x402a('0x2a')]===_0x402a('0x2b');var _0x5dfafb=_0x4d4e96[_0x402a('0x2c')];var _0x6ac4fa=_0x4cd228?0x0:_0x1fcba1[_0x402a('0x29')];var _0x441536=_0x4cd228?_0x4d4e96[_0x402a('0x2c')]:_0x1fcba1[_0x402a('0x29')]+_0x1fcba1[_0x402a('0x2a')];var _0x5b2d72;if(_0x441536>=_0x5dfafb){_0x441536=_0x5dfafb;_0x5b2d72=0xc8;}else{_0x5b2d72=0xce;}_0x4c82d3[_0x402a('0x2d')](_0x5b2d72);return _0x4c82d3[_0x402a('0x2e')](_0x402a('0x2f'),_0x6ac4fa+'-'+_0x441536+'/'+_0x5dfafb)[_0x402a('0x28')](_0x4d4e96);}return null;};}function patchUpdates(_0x1d8fd5){return function(_0x4e9228){try{jsonpatch[_0x402a('0x30')](_0x4e9228,_0x1d8fd5,!![]);}catch(_0x4e6f94){return BPromise[_0x402a('0x31')](_0x4e6f94);}return _0x4e9228[_0x402a('0x32')]();};}function saveUpdates(_0x5eb908,_0x3fdc94){return function(_0x201aac){if(_0x201aac){return _0x201aac['update'](_0x5eb908)[_0x402a('0x33')](function(_0x561198){return _0x561198;});}return null;};}function removeEntity(_0x52b709,_0x570379){return function(_0x7fc1bb){if(_0x7fc1bb){return _0x7fc1bb[_0x402a('0x34')]()['then'](function(){var _0x2427e3=_0x7fc1bb[_0x402a('0x35')]({'plain':!![]});var _0x51c15b='WhatsappAccounts';return db[_0x402a('0x36')][_0x402a('0x34')]({'where':{'type':_0x51c15b,'resourceId':_0x2427e3['id']}})[_0x402a('0x33')](function(){return _0x7fc1bb;});})[_0x402a('0x33')](function(){_0x52b709['status'](0xcc)[_0x402a('0x37')]();});}};}function handleEntityNotFound(_0x33ec84,_0x11bc4b){return function(_0x173a00){if(!_0x173a00){_0x33ec84[_0x402a('0x27')](0x194);}return _0x173a00;};}function handleError(_0x4b260f,_0x4c7a1b){_0x4c7a1b=_0x4c7a1b||0x1f4;return function(_0x27788b){logger[_0x402a('0x23')](_0x27788b[_0x402a('0x38')]);if(_0x27788b[_0x402a('0x39')]){delete _0x27788b[_0x402a('0x39')];}_0x4b260f[_0x402a('0x2d')](_0x4c7a1b)[_0x402a('0x3a')](_0x27788b);};}exports[_0x402a('0x3b')]=function(_0x2ec78c,_0x56b35f){var _0x479202={'include':[{'model':db[_0x402a('0x3c')],'as':_0x402a('0x3d')}]},_0x58af7a={},_0x448797={'count':0x0,'rows':[]};var _0x39c974=_[_0x402a('0x3e')](db[_0x402a('0x3f')][_0x402a('0x40')],function(_0x58d36e){return{'name':_0x58d36e[_0x402a('0x41')],'type':_0x58d36e[_0x402a('0x42')]['key']};});_0x58af7a['model']=_[_0x402a('0x3e')](_0x39c974,'name');_0x58af7a[_0x402a('0x43')]=_[_0x402a('0x44')](_0x2ec78c[_0x402a('0x43')]);_0x58af7a[_0x402a('0x45')]=_[_0x402a('0x46')](_0x58af7a[_0x402a('0x47')],_0x58af7a[_0x402a('0x43')]);_0x479202[_0x402a('0x48')]=_['intersection'](_0x58af7a[_0x402a('0x47')],qs['fields'](_0x2ec78c[_0x402a('0x43')][_0x402a('0x49')]));_0x479202[_0x402a('0x48')]=_0x479202[_0x402a('0x48')][_0x402a('0x4a')]?_0x479202[_0x402a('0x48')]:_0x58af7a[_0x402a('0x47')];if(!_0x2ec78c[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x479202[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x2ec78c['query']['limit']);_0x479202[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x2ec78c['query'][_0x402a('0x29')]);}_0x479202[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x2ec78c[_0x402a('0x43')][_0x402a('0x4e')]);_0x479202['where']=qs['filters'](_[_0x402a('0x4f')](_0x2ec78c['query'],_0x58af7a[_0x402a('0x45')]),_0x39c974);if(_0x2ec78c[_0x402a('0x43')][_0x402a('0x50')]){_0x479202['where']=_[_0x402a('0x51')](_0x479202[_0x402a('0x52')],{'$or':_['map'](_0x39c974,function(_0x19d793){if(_0x19d793['type']!==_0x402a('0x53')){var _0x58899b={};_0x58899b[_0x19d793[_0x402a('0x39')]]={'$like':'%'+_0x2ec78c[_0x402a('0x43')]['filter']+'%'};return _0x58899b;}})});}_0x479202=_['merge']({},_0x479202,_0x2ec78c[_0x402a('0x54')]);var _0xe1ebda={'where':_0x479202[_0x402a('0x52')]};return db[_0x402a('0x3f')]['count'](_0xe1ebda)[_0x402a('0x33')](function(_0x3dc757){_0x448797[_0x402a('0x2c')]=_0x3dc757;if(_0x2ec78c[_0x402a('0x43')][_0x402a('0x55')]){_0x479202[_0x402a('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x402a('0x57')](_0x479202);})[_0x402a('0x33')](function(_0x2c68ce){_0x448797[_0x402a('0x58')]=_0x2c68ce;return _0x448797;})['then'](respondWithFilteredResult(_0x56b35f,_0x479202))[_0x402a('0x59')](handleError(_0x56b35f,null));};exports[_0x402a('0x5a')]=function(_0x693c3c,_0x565ee5){var _0x44f682={'raw':![],'where':{'id':_0x693c3c[_0x402a('0x5b')]['id']},'include':[{'model':db[_0x402a('0x3c')],'as':'mandatoryDispositionPause'}]},_0x537abc={};_0x537abc['model']=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x537abc['query']=_[_0x402a('0x44')](_0x693c3c[_0x402a('0x43')]);_0x537abc[_0x402a('0x45')]=_['intersection'](_0x537abc[_0x402a('0x47')],_0x537abc['query']);_0x44f682[_0x402a('0x48')]=_[_0x402a('0x46')](_0x537abc[_0x402a('0x47')],qs[_0x402a('0x49')](_0x693c3c['query'][_0x402a('0x49')]));_0x44f682['attributes']=_0x44f682[_0x402a('0x48')]['length']?_0x44f682['attributes']:_0x537abc[_0x402a('0x47')];if(_0x693c3c['query']['includeAll']){_0x44f682['include']=[{'all':!![]}];}_0x44f682=_[_0x402a('0x51')]({},_0x44f682,_0x693c3c[_0x402a('0x54')]);return db['WhatsappAccount']['find'](_0x44f682)[_0x402a('0x33')](handleEntityNotFound(_0x565ee5,null))[_0x402a('0x33')](respondWithResult(_0x565ee5,null))[_0x402a('0x59')](handleError(_0x565ee5,null));};exports[_0x402a('0x5c')]=function(_0x569cba,_0x40d94f){return db[_0x402a('0x3f')]['create'](_0x569cba[_0x402a('0x5d')],{})[_0x402a('0x33')](function(_0x2b5528){var _0x4e64fc=_0x569cba[_0x402a('0x5e')][_0x402a('0x35')]({'plain':!![]});if(!_0x4e64fc)throw new Error(_0x402a('0x5f'));if(_0x4e64fc['role']===_0x402a('0x5e')){var _0x470638=_0x2b5528[_0x402a('0x35')]({'plain':!![]});var _0x37aae0=_0x402a('0x60');return db[_0x402a('0x61')][_0x402a('0x62')]({'where':{'name':_0x37aae0,'userProfileId':_0x4e64fc[_0x402a('0x63')]},'raw':!![]})[_0x402a('0x33')](function(_0x4650d2){if(_0x4650d2&&_0x4650d2['autoAssociation']===0x0){return db[_0x402a('0x36')][_0x402a('0x5c')]({'name':_0x470638[_0x402a('0x39')],'resourceId':_0x470638['id'],'type':_0x4650d2['name'],'sectionId':_0x4650d2['id']},{})['then'](function(){return _0x2b5528;});}else{return _0x2b5528;}})[_0x402a('0x59')](function(_0x44cf3e){logger[_0x402a('0x23')](_0x402a('0x64'),_0x44cf3e);throw _0x44cf3e;});}return _0x2b5528;})[_0x402a('0x33')](respondWithResult(_0x40d94f,0xc9))['catch'](handleError(_0x40d94f,null));};exports[_0x402a('0x65')]=function(_0x547b71,_0x3bb646){if(_0x547b71[_0x402a('0x5d')]['id']){delete _0x547b71['body']['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x547b71[_0x402a('0x5b')]['id']},'include':[{'model':db[_0x402a('0x3c')],'as':_0x402a('0x3d')}]})['then'](handleEntityNotFound(_0x3bb646,null))[_0x402a('0x33')](saveUpdates(_0x547b71[_0x402a('0x5d')],null))[_0x402a('0x33')](respondWithResult(_0x3bb646,null))[_0x402a('0x59')](handleError(_0x3bb646,null));};exports[_0x402a('0x34')]=function(_0x4650bd,_0x223882){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4650bd[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x223882,null))['then'](removeEntity(_0x223882,null))['catch'](handleError(_0x223882,null));};exports[_0x402a('0x66')]=function(_0x4a3681,_0x2ea641){return db[_0x402a('0x3f')]['describe']()[_0x402a('0x33')](respondWithResult(_0x2ea641,null))[_0x402a('0x59')](handleError(_0x2ea641,null));};exports[_0x402a('0x67')]=function(_0x4edefe,_0x28f572,_0x1b2dde){if(_0x4edefe['body']['id']){delete _0x4edefe[_0x402a('0x5d')]['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4edefe[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x28f572,null))[_0x402a('0x33')](function(_0x31440a){if(_0x31440a){_0x4edefe[_0x402a('0x5d')]['WhatsappAccountId']=_0x31440a['id'];return db[_0x402a('0x68')][_0x402a('0x5c')](_0x4edefe[_0x402a('0x5d')]);}})[_0x402a('0x33')](respondWithResult(_0x28f572,null))[_0x402a('0x59')](handleError(_0x28f572,null));};exports[_0x402a('0x69')]=function(_0x554345,_0x587708,_0x26ce44){var _0x5db717={'raw':![],'where':{}};var _0x31c575={};var _0x1075dd={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x402a('0x6a')]({'where':{'id':_0x554345[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x587708,null))[_0x402a('0x33')](function(_0x544a75){if(_0x544a75){_0x31c575['model']=_[_0x402a('0x44')](db[_0x402a('0x68')][_0x402a('0x40')]);_0x31c575[_0x402a('0x43')]=_[_0x402a('0x44')](_0x554345['query']);_0x31c575[_0x402a('0x45')]=_['intersection'](_0x31c575['model'],_0x31c575[_0x402a('0x43')]);_0x5db717['attributes']=_[_0x402a('0x46')](_0x31c575['model'],qs['fields'](_0x554345['query']['fields']));_0x5db717['attributes']=_0x5db717[_0x402a('0x48')]['length']?_0x5db717['attributes']:_0x31c575['model'];if(!_0x554345[_0x402a('0x43')][_0x402a('0x4b')]('nolimit')){_0x5db717[_0x402a('0x2a')]=qs['limit'](_0x554345[_0x402a('0x43')][_0x402a('0x2a')]);_0x5db717[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x554345['query']['offset']);}_0x5db717[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x554345['query']['sort']);_0x5db717[_0x402a('0x52')]=qs[_0x402a('0x45')](_['pick'](_0x554345['query'],_0x31c575[_0x402a('0x45')]));_0x5db717[_0x402a('0x52')][_0x402a('0x6b')]=_0x544a75['id'];if(_0x554345[_0x402a('0x43')][_0x402a('0x50')]){_0x5db717[_0x402a('0x52')]=_[_0x402a('0x51')](_0x5db717[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x5db717[_0x402a('0x48')],function(_0x5aae4e){var _0x427b3a={};_0x427b3a[_0x5aae4e]={'$like':'%'+_0x554345[_0x402a('0x43')]['filter']+'%'};return _0x427b3a;})});}_0x5db717=_[_0x402a('0x51')]({},_0x5db717,_0x554345[_0x402a('0x54')]);return db['Disposition']['count']({'where':_0x5db717['where']})[_0x402a('0x33')](function(_0x2dfb32){_0x1075dd[_0x402a('0x2c')]=_0x2dfb32;if(_0x554345[_0x402a('0x43')][_0x402a('0x55')]){_0x5db717[_0x402a('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x402a('0x57')](_0x5db717);})[_0x402a('0x33')](function(_0x4e0ab0){_0x1075dd[_0x402a('0x58')]=_0x4e0ab0;return _0x1075dd;});}})['then'](respondWithFilteredResult(_0x587708,_0x5db717))[_0x402a('0x59')](handleError(_0x587708,null));};exports[_0x402a('0x6c')]=function(_0x4378c0,_0x374c56,_0x855bfc){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4378c0[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x374c56,null))['then'](function(_0xa45289){if(_0xa45289){return _0xa45289[_0x402a('0x6c')](_0x4378c0[_0x402a('0x43')][_0x402a('0x6d')]);}})['then'](respondWithStatusCode(_0x374c56,null))[_0x402a('0x59')](handleError(_0x374c56,null));};exports[_0x402a('0x6e')]=function(_0x538ac6,_0x478e17,_0x1e1b0d){if(_0x538ac6['body']['id']){delete _0x538ac6[_0x402a('0x5d')]['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x538ac6['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x478e17,null))[_0x402a('0x33')](function(_0x5cc264){if(_0x5cc264){_0x538ac6[_0x402a('0x5d')][_0x402a('0x6b')]=_0x5cc264['id'];return db[_0x402a('0x6f')]['create'](_0x538ac6['body']);}})[_0x402a('0x33')](respondWithResult(_0x478e17,null))['catch'](handleError(_0x478e17,null));};exports['getAnswers']=function(_0x5bf82f,_0x56a441,_0x161259){var _0x4540b4={'raw':![],'where':{}};var _0x1c06cc={};var _0x5cdc1c={'count':0x0,'rows':[]};return db[_0x402a('0x3f')]['findOne']({'where':{'id':_0x5bf82f[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x56a441,null))['then'](function(_0x3a7220){if(_0x3a7220){_0x1c06cc[_0x402a('0x47')]=_[_0x402a('0x44')](db[_0x402a('0x6f')][_0x402a('0x40')]);_0x1c06cc['query']=_[_0x402a('0x44')](_0x5bf82f[_0x402a('0x43')]);_0x1c06cc[_0x402a('0x45')]=_[_0x402a('0x46')](_0x1c06cc['model'],_0x1c06cc[_0x402a('0x43')]);_0x4540b4[_0x402a('0x48')]=_['intersection'](_0x1c06cc['model'],qs['fields'](_0x5bf82f['query'][_0x402a('0x49')]));_0x4540b4[_0x402a('0x48')]=_0x4540b4[_0x402a('0x48')][_0x402a('0x4a')]?_0x4540b4[_0x402a('0x48')]:_0x1c06cc['model'];if(!_0x5bf82f[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x4540b4[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x5bf82f[_0x402a('0x43')][_0x402a('0x2a')]);_0x4540b4[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x5bf82f['query'][_0x402a('0x29')]);}_0x4540b4[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x5bf82f[_0x402a('0x43')][_0x402a('0x4e')]);_0x4540b4['where']=qs['filters'](_[_0x402a('0x4f')](_0x5bf82f[_0x402a('0x43')],_0x1c06cc[_0x402a('0x45')]));_0x4540b4['where']['WhatsappAccountId']=_0x3a7220['id'];if(_0x5bf82f[_0x402a('0x43')]['filter']){_0x4540b4[_0x402a('0x52')]=_[_0x402a('0x51')](_0x4540b4[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x4540b4[_0x402a('0x48')],function(_0x1f32fd){var _0x703881={};_0x703881[_0x1f32fd]={'$like':'%'+_0x5bf82f['query']['filter']+'%'};return _0x703881;})});}_0x4540b4=_[_0x402a('0x51')]({},_0x4540b4,_0x5bf82f[_0x402a('0x54')]);return db[_0x402a('0x6f')][_0x402a('0x2c')]({'where':_0x4540b4[_0x402a('0x52')]})[_0x402a('0x33')](function(_0x5887a7){_0x5cdc1c[_0x402a('0x2c')]=_0x5887a7;if(_0x5bf82f[_0x402a('0x43')][_0x402a('0x55')]){_0x4540b4[_0x402a('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4540b4);})['then'](function(_0x250fb7){_0x5cdc1c['rows']=_0x250fb7;return _0x5cdc1c;});}})[_0x402a('0x33')](respondWithFilteredResult(_0x56a441,_0x4540b4))['catch'](handleError(_0x56a441,null));};exports[_0x402a('0x70')]=function(_0x37cecd,_0x5b7ce7,_0x502138){return db['WhatsappAccount']['find']({'where':{'id':_0x37cecd[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x5b7ce7,null))[_0x402a('0x33')](function(_0x46abf5){if(_0x46abf5){return _0x46abf5[_0x402a('0x70')](_0x37cecd[_0x402a('0x43')][_0x402a('0x6d')]);}})[_0x402a('0x33')](respondWithStatusCode(_0x5b7ce7,null))[_0x402a('0x59')](handleError(_0x5b7ce7,null));};exports['addAgents']=function(_0x1aca12,_0x401641,_0x448523){return db['WhatsappAccount'][_0x402a('0x62')]({'where':{'id':_0x1aca12[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x401641,null))['then'](function(_0x26db94){if(_0x26db94){return _0x26db94[_0x402a('0x71')](_0x1aca12['body'][_0x402a('0x6d')],_[_0x402a('0x72')](_0x1aca12['body'],[_0x402a('0x6d'),'id'])||{})[_0x402a('0x73')](function(_0x2b1e20){for(var _0x3e032e=0x0;_0x3e032e<_0x1aca12[_0x402a('0x5d')]['ids'][_0x402a('0x4a')];_0x3e032e+=0x1){socket[_0x402a('0x74')](_0x402a('0x75'),{'UserId':Number(_0x1aca12['body']['ids'][_0x3e032e]),'WhatsappAccountId':Number(_0x1aca12['params']['id'])});}return _0x2b1e20;});}})[_0x402a('0x33')](respondWithResult(_0x401641,null))[_0x402a('0x59')](handleError(_0x401641,null));};exports[_0x402a('0x76')]=function(_0x6d6dbc,_0x11a698,_0x20501d){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x6d6dbc['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x11a698,null))[_0x402a('0x33')](function(_0x44a0e5){if(_0x44a0e5){return _0x44a0e5[_0x402a('0x76')](_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')])['then'](function(){if(_[_0x402a('0x77')](_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')])){for(var _0x2cf7d5=0x0;_0x2cf7d5<_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')][_0x402a('0x4a')];_0x2cf7d5+=0x1){socket[_0x402a('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')][_0x2cf7d5]),'WhatsappAccountId':Number(_0x6d6dbc[_0x402a('0x5b')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')]),'WhatsappAccountId':Number(_0x6d6dbc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x11a698,null))[_0x402a('0x59')](handleError(_0x11a698,null));};exports[_0x402a('0x78')]=function(_0xea021a,_0x43476d,_0x1bd37d){var _0x119bef={};var _0xc2d3a8={};var _0x176ba0;var _0x13f3ab;return db[_0x402a('0x3f')][_0x402a('0x6a')]({'where':{'id':_0xea021a[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43476d,null))['then'](function(_0x479ba5){if(_0x479ba5){_0x176ba0=_0x479ba5;_0xc2d3a8[_0x402a('0x47')]=_[_0x402a('0x44')](db['User'][_0x402a('0x40')]);_0xc2d3a8[_0x402a('0x43')]=_[_0x402a('0x44')](_0xea021a[_0x402a('0x43')]);_0xc2d3a8[_0x402a('0x45')]=_[_0x402a('0x46')](_0xc2d3a8[_0x402a('0x47')],_0xc2d3a8[_0x402a('0x43')]);_0x119bef[_0x402a('0x48')]=_[_0x402a('0x46')](_0xc2d3a8['model'],qs[_0x402a('0x49')](_0xea021a[_0x402a('0x43')]['fields']));_0x119bef[_0x402a('0x48')]=_0x119bef[_0x402a('0x48')][_0x402a('0x4a')]?_0x119bef[_0x402a('0x48')]:_0xc2d3a8[_0x402a('0x47')];_0x119bef[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0xea021a['query'][_0x402a('0x4e')]);_0x119bef[_0x402a('0x52')]=qs[_0x402a('0x45')](_['pick'](_0xea021a[_0x402a('0x43')],_0xc2d3a8['filters']));if(_0xea021a[_0x402a('0x43')][_0x402a('0x50')]){_0x119bef['where']=_[_0x402a('0x51')](_0x119bef[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x119bef[_0x402a('0x48')],function(_0x520fd3){var _0x2c7ede={};_0x2c7ede[_0x520fd3]={'$like':'%'+_0xea021a['query'][_0x402a('0x50')]+'%'};return _0x2c7ede;})});}_0x119bef=_[_0x402a('0x51')]({},_0x119bef,_0xea021a[_0x402a('0x54')]);return _0x176ba0['getAgents'](_0x119bef);}})['then'](function(_0xf427c1){if(_0xf427c1){_0x13f3ab=_0xf427c1['length'];if(!_0xea021a[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x119bef['limit']=qs[_0x402a('0x2a')](_0xea021a[_0x402a('0x43')][_0x402a('0x2a')]);_0x119bef['offset']=qs[_0x402a('0x29')](_0xea021a[_0x402a('0x43')][_0x402a('0x29')]);}return _0x176ba0[_0x402a('0x78')](_0x119bef);}})['then'](function(_0x57a8e6){if(_0x57a8e6){return _0x57a8e6?{'count':_0x13f3ab,'rows':_0x57a8e6}:null;}})[_0x402a('0x33')](respondWithResult(_0x43476d,null))[_0x402a('0x59')](handleError(_0x43476d,null));};exports[_0x402a('0x79')]=function(_0x45e66c,_0x6423bf){var _0x31f3d8=_0x45e66c[_0x402a('0x5b')]['id'];var _0x14a942=_0x45e66c['body'];var _0xf0a915=0xc8;var _0x24f753=null;return db['sequelize'][_0x402a('0x7a')]({'isolationLevel':db[_0x402a('0x7b')][_0x402a('0x7c')][_0x402a('0x7d')][_0x402a('0x7e')]},function(_0x19fc88){return db[_0x402a('0x3f')][_0x402a('0x6a')]({'where':{'id':_0x31f3d8},'transaction':_0x19fc88})['then'](function(_0xe30c18){if(_0xe30c18){return db['WhatsappApplication'][_0x402a('0x34')]({'where':{'WhatsappAccountId':_0x31f3d8},'transaction':_0x19fc88})[_0x402a('0x33')](function(){var _0x5259af=_['map'](_0x14a942,function(_0x86e07c){_0x86e07c[_0x402a('0x6b')]=_0x31f3d8;return _0x86e07c;});return db['WhatsappApplication'][_0x402a('0x7f')](_0x5259af,{'transaction':_0x19fc88});});}else{_0xf0a915=0x194;_0x24f753=[];}});})[_0x402a('0x33')](function(){if(_0xf0a915!==0x194){return db[_0x402a('0x80')][_0x402a('0x81')]({'where':{'WhatsappAccountId':_0x31f3d8},'order':_0x402a('0x82')})[_0x402a('0x33')](function(_0x59bd52){_0x24f753=_0x59bd52;});}})['catch'](function(_0x2c7bf2){_0xf0a915=0x1f4;logger[_0x402a('0x23')](_0x2c7bf2[_0x402a('0x38')]);if(_0x2c7bf2['name']){delete _0x2c7bf2[_0x402a('0x39')];}_0x24f753=_0x2c7bf2;})[_0x402a('0x83')](function(){if(_0x24f753===null){_0x6423bf[_0x402a('0x27')](_0xf0a915);}else{if(_0xf0a915===0x1f4){_0x6423bf[_0x402a('0x2d')](_0xf0a915)[_0x402a('0x3a')](_0x24f753);}else{_0x6423bf[_0x402a('0x2d')](_0xf0a915)['json'](_0x24f753);}}});};exports[_0x402a('0x84')]=function(_0x21461c,_0xc8a3c2,_0x31f442){var _0x1f92f7={};var _0x24c5ac={};var _0x4a41c0;var _0x3b5e64;return db['WhatsappAccount'][_0x402a('0x6a')]({'where':{'id':_0x21461c['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0xc8a3c2,null))[_0x402a('0x33')](function(_0x4744dd){if(_0x4744dd){_0x4a41c0=_0x4744dd;_0x24c5ac[_0x402a('0x47')]=_['keys'](db[_0x402a('0x80')][_0x402a('0x40')]);_0x24c5ac[_0x402a('0x43')]=_[_0x402a('0x44')](_0x21461c[_0x402a('0x43')]);_0x24c5ac[_0x402a('0x45')]=_[_0x402a('0x46')](_0x24c5ac[_0x402a('0x47')],_0x24c5ac[_0x402a('0x43')]);_0x1f92f7[_0x402a('0x48')]=_['intersection'](_0x24c5ac[_0x402a('0x47')],qs['fields'](_0x21461c[_0x402a('0x43')][_0x402a('0x49')]));_0x1f92f7[_0x402a('0x48')]=_0x1f92f7[_0x402a('0x48')][_0x402a('0x4a')]?_0x1f92f7[_0x402a('0x48')]:_0x24c5ac[_0x402a('0x47')];_0x1f92f7['order']=qs[_0x402a('0x4e')](_0x21461c[_0x402a('0x43')]['sort']);_0x1f92f7['where']=qs['filters'](_['pick'](_0x21461c[_0x402a('0x43')],_0x24c5ac['filters']));if(_0x21461c['query'][_0x402a('0x50')]){_0x1f92f7[_0x402a('0x52')]=_[_0x402a('0x51')](_0x1f92f7[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x1f92f7[_0x402a('0x48')],function(_0x4e2f1f){var _0x3d65e={};_0x3d65e[_0x4e2f1f]={'$like':'%'+_0x21461c[_0x402a('0x43')][_0x402a('0x50')]+'%'};return _0x3d65e;})});}_0x1f92f7=_['merge']({},_0x1f92f7,_0x21461c[_0x402a('0x54')]);return _0x4a41c0[_0x402a('0x84')](_0x1f92f7);}})[_0x402a('0x33')](function(_0x5dea07){if(_0x5dea07){_0x3b5e64=_0x5dea07[_0x402a('0x4a')];if(!_0x21461c[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x1f92f7[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x21461c[_0x402a('0x43')][_0x402a('0x2a')]);_0x1f92f7[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x21461c['query']['offset']);}return _0x4a41c0[_0x402a('0x84')](_0x1f92f7);}})[_0x402a('0x33')](function(_0x2c3dd6){if(_0x2c3dd6){return _0x2c3dd6?{'count':_0x3b5e64,'rows':_0x2c3dd6}:null;}})[_0x402a('0x33')](respondWithResult(_0xc8a3c2,null))['catch'](handleError(_0xc8a3c2,null));};exports[_0x402a('0x85')]=function(_0x4af33d,_0x4311d5,_0x2ad21e){var _0x326824={'channel':_0x402a('0x86')};var _0x2e8bf6=[];var _0x1886ad=[];var _0x2181c0={};return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4af33d[_0x402a('0x5b')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x1c00aa){_0x326824[_0x402a('0x87')]=_0x1c00aa;if(_0x326824[_0x402a('0x87')]&&_0x326824[_0x402a('0x87')][_0x402a('0x42')]===_0x402a('0x88')&&_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')]){if(_0x4af33d['body'][_0x402a('0x89')]['length']===0x0)return;if(_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')][0x0]['state']!==_0x402a('0x8a'))return;return db['WhatsappMessage'][_0x402a('0x65')]({'read':!![],'readAt':_0x4af33d['body'][_0x402a('0x89')][0x0][_0x402a('0x8b')]},{'where':{'messageId':_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')][0x0][_0x402a('0x8c')]},'individualHooks':!![]})['then'](function(_0x1c5f52){return _0x4311d5['status'](0xc8)[_0x402a('0x28')](_0x1c5f52);});}_0x326824['applications']=_[_0x402a('0x8d')](_0x1c00aa[_0x402a('0x8e')],[_0x402a('0x82')],[_0x402a('0x8f')]);if(_0x326824[_0x402a('0x87')][_0x402a('0x8e')]){delete _0x326824[_0x402a('0x87')][_0x402a('0x8e')];}return db[_0x402a('0x90')][_0x402a('0x66')]()['then'](function(_0x37a362){if(!_0x37a362){throw new db[(_0x402a('0x91'))]['ValidationError'](_0x402a('0x92'));}_0x2e8bf6=_[_0x402a('0x93')](_[_0x402a('0x44')](_0x37a362),['createdAt',_0x402a('0x94')]);_0x1886ad=_[_0x402a('0x93')](_[_0x402a('0x44')](_0x37a362),[_0x402a('0x95'),_0x402a('0x94'),_0x402a('0x96'),_0x402a('0x97')]);_0x326824[_0x402a('0x5d')]={'mapKey':'mobile'};if(_0x326824[_0x402a('0x87')]&&_0x326824[_0x402a('0x87')]['type']===_0x402a('0x98')){_0x326824[_0x402a('0x5d')]['from']=_0x4af33d[_0x402a('0x5d')]['From'][_0x402a('0x99')](_0x402a('0x9a'),'');_0x326824['body']['body']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9b')];_0x326824[_0x402a('0x5d')]['messageId']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9c')];}if(_0x326824[_0x402a('0x87')]&&_0x326824['account']['type']===_0x402a('0x88')){_0x326824[_0x402a('0x5d')]['from']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x9e')];_0x326824[_0x402a('0x5d')][_0x402a('0x5d')]=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x24')][_0x402a('0x5d')];_0x326824[_0x402a('0x5d')][_0x402a('0x9f')]=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x8c')];}if(_0x326824['body']['id']){delete _0x326824['body']['id'];}if(_[_0x402a('0xa0')](_0x326824[_0x402a('0x5d')]['from'])){throw new db[(_0x402a('0x91'))]['ValidationError'](_0x402a('0xa1'));}if(_['isNil'](_0x326824[_0x402a('0x5d')]['body'])||_0x326824[_0x402a('0x5d')][_0x402a('0x5d')]===''){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xa3'));}if(_['isNil'](_0x326824[_0x402a('0x5d')][_0x402a('0xa4')])){throw new db['Sequelize'][(_0x402a('0xa2'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1886ad);}if(!_[_0x402a('0xa5')](_0x1886ad,_0x326824[_0x402a('0x5d')][_0x402a('0xa4')])){throw new db['Sequelize'][(_0x402a('0xa2'))](_0x402a('0xa6')+_0x1886ad);}_0x2181c0[_0x326824['body'][_0x402a('0xa4')]]=_0x326824[_0x402a('0x5d')][_0x402a('0x9e')];return db[_0x402a('0xa7')][_0x402a('0x62')]({'where':{'id':_0x326824[_0x402a('0x87')]['ListId']},'include':[{'model':db[_0x402a('0x90')],'as':_0x402a('0xa8'),'where':_0x2181c0,'limit':0x1,'order':[[_0x402a('0x94'),_0x402a('0xa9')]]}]});})[_0x402a('0x33')](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x97138e){if(_0x97138e){_0x326824['list']=_[_0x402a('0x72')](_0x97138e,[_0x402a('0xa8')]);if(_0x97138e[_0x402a('0xa8')][_0x402a('0x4a')]){return _0x97138e['Contacts'][0x0];}var _0x73f6d4=_['defaults'](_0x326824[_0x402a('0x5d')],{'firstName':_0x326824[_0x402a('0x5d')][_0x402a('0x9e')],'ListId':_0x97138e['id']});_0x73f6d4[_0x326824[_0x402a('0x5d')][_0x402a('0xa4')]]=_0x326824[_0x402a('0x5d')][_0x402a('0x9e')];return db[_0x402a('0x90')][_0x402a('0x5c')](_0x73f6d4,{'fields':_0x2e8bf6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x329bb1){if(_0x329bb1){_0x326824[_0x402a('0xaa')]=_0x329bb1;var _0x5a8f2b={'ContactId':_0x329bb1['id'],'phone':_0x326824['body'][_0x402a('0x9e')],'WhatsappAccountId':_0x4af33d[_0x402a('0x5b')]['id']};var _0x5a75c7={'ContactId':_0x329bb1['id'],'WhatsappAccountId':_0x4af33d[_0x402a('0x5b')]['id'],'closed':![]};return db[_0x402a('0xab')][_0x402a('0x62')]({'where':_0x5a75c7})['then'](function(_0x2a7562){if(_0x2a7562){return[_0x2a7562,![]];}return db[_0x402a('0xab')][_0x402a('0x5c')](_0x5a8f2b)[_0x402a('0x33')](function(_0x2cff23){return[_0x2cff23,!![]];});});}})[_0x402a('0x73')](function(_0x4cf7f3,_0x27c8b5){_0x326824['interaction']=_0x4cf7f3['get']({'plain':!![]});_0x326824[_0x402a('0xac')]['created']=![];if(_0x27c8b5){if(_0x326824['account'][_0x402a('0xad')]){_0x326824[_0x402a('0xae')][_0x402a('0xaf')]({'id':0x0,'priority':_0x326824['applications'][_0x402a('0x4a')]+0x1,'app':'close','appdata':_0x402a('0xb0'),'interval':'*,*,*,*'});}_0x326824[_0x402a('0xac')][_0x402a('0xb1')]=!![];}return db[_0x402a('0xb2')][_0x402a('0x5c')]({'phone':_0x326824[_0x402a('0x5d')][_0x402a('0x9e')],'messageId':_0x326824[_0x402a('0x5d')][_0x402a('0x9f')],'body':_0x326824['body'][_0x402a('0x5d')],'WhatsappAccountId':_0x4af33d['params']['id'],'WhatsappInteractionId':_0x4cf7f3['id'],'direction':'in','ContactId':_0x4cf7f3[_0x402a('0xb3')],'AttachmentId':_0x326824['body'][_0x402a('0xb4')]});})['then'](function(_0x549ae0){_0x326824[_0x402a('0x24')]=_0x549ae0;if(!_0x326824[_0x402a('0xac')]['UserId'])return;return db['User'][_0x402a('0x62')]({'attributes':['id','name'],'where':{'id':_0x326824[_0x402a('0xac')]['UserId']}});})[_0x402a('0x33')](function(_0x15872b){if(_0x15872b){_0x326824[_0x402a('0xae')][_0x402a('0xb5')]({'id':0x0,'priority':0x0,'app':_0x402a('0xb6'),'appdata':_0x15872b[_0x402a('0x39')]+','+(_0x326824[_0x402a('0x87')][_0x402a('0xb7')]||0xa),'interval':'*,*,*,*'});}if(!_0x326824['interaction']['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x402a('0x39')],'where':{'id':_0x326824['interaction'][_0x402a('0xb8')]}});})[_0x402a('0x33')](function(_0x53a003){if(_0x53a003){_0x326824[_0x402a('0xae')][_0x402a('0xb5')]({'id':0x0,'priority':0x1,'app':_0x402a('0xb9'),'appdata':_0x53a003['name']+','+(_0x326824[_0x402a('0x87')][_0x402a('0xba')]||0x12c),'interval':_0x402a('0xbb')});}return respondWithRpcPromise(_0x402a('0xbc'),_0x402a('0xbd'),_0x326824);})[_0x402a('0x33')](function(_0x56b2f3){if(_0x56b2f3){var _0x2a675e=0xc8;var _0x46ec97=_0x402a('0xbe');logger[_0x402a('0x25')](_0x402a('0x22'),_0x46ec97,_0x2a675e,_0x402a('0xbf'));logger[_0x402a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x46ec97,_0x2a675e,_0x402a('0xbf'),JSON[_0x402a('0xc0')](_0x56b2f3));if(_0x326824[_0x402a('0x87')]['type']===_0x402a('0x98')){return _0x4311d5[_0x402a('0x2d')](_0x2a675e)['set']('Content-Type',_0x402a('0xc1'))[_0x402a('0x3a')]('\x0a');}else{return _0x4311d5['status'](_0x2a675e)[_0x402a('0x28')](_0x56b2f3);}}});})[_0x402a('0x59')](handleError(_0x4311d5,null));};exports['send']=function(_0x2c623f,_0x3b5ead,_0x175dc8){var _0x3c00e5,_0x1385f7,_0x48c12b;if(_[_0x402a('0xa0')](_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')])||_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')]===''){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xa3'));}if(_[_0x402a('0xa0')](_0x2c623f[_0x402a('0x5d')]['to'])){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xc2'));}_0x3c00e5=_0x2c623f['body']['to'];return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x2c623f['params']['id']},'include':[{'model':db[_0x402a('0xa7')],'as':_0x402a('0xc3'),'include':[{'model':db['CmContact'],'as':_0x402a('0xa8'),'where':{'mobile':_0x3c00e5},'limit':0x1,'order':[['updatedAt',_0x402a('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x3b5ead,null))[_0x402a('0x33')](function(_0x2a1088){if(_0x2a1088&&_0x2a1088[_0x402a('0xc3')]){_0x1385f7=_0x2a1088[_0x402a('0x35')]({'plain':!![]});if(_0x1385f7[_0x402a('0xc3')]&&_0x1385f7[_0x402a('0xc3')][_0x402a('0xa8')][_0x402a('0x4a')]){return _0x1385f7[_0x402a('0xc3')][_0x402a('0xa8')][0x0];}return db[_0x402a('0x90')][_0x402a('0x5c')](_['defaults'](_0x2c623f[_0x402a('0x5d')],{'firstName':_0x3c00e5,'mobile':_0x3c00e5,'phone':_0x3c00e5,'ListId':_0x1385f7[_0x402a('0x97')]}));}})[_0x402a('0x33')](handleEntityNotFound(_0x3b5ead,null))[_0x402a('0x33')](function(_0x4a9622){if(_0x4a9622){_0x48c12b=_0x4a9622;return db[_0x402a('0xab')][_0x402a('0x62')]({'where':{'ContactId':_0x48c12b['id'],'closed':![],'WhatsappAccountId':_0x1385f7['id']}})[_0x402a('0x33')](function(_0x4b614d){if(_0x4b614d){return[_0x4b614d,![]];}return db[_0x402a('0xab')][_0x402a('0x5c')]({'UserId':_0x2c623f['user']['id'],'ContactId':_0x48c12b['id'],'WhatsappAccountId':_0x1385f7['id'],'phone':_0x3c00e5,'firstMsgDirection':_0x402a('0xc4'),'Messages':[_[_0x402a('0x51')](_0x2c623f[_0x402a('0x5d')],{'read':![],'body':_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')],'phone':_0x3c00e5,'WhatsappAccountId':_0x1385f7['id'],'UserId':_0x2c623f[_0x402a('0x5e')]['id'],'ContactId':_0x48c12b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x432ab5){return[_0x432ab5,!![]];});});}})['spread'](function(_0x152550,_0x19f492){if(_0x19f492){return _0x152550;}return db['WhatsappMessage']['create'](_['merge'](_0x2c623f['body'],{'read':![],'body':_0x2c623f[_0x402a('0x5d')]['body'],'phone':_0x3c00e5,'WhatsappAccountId':_0x1385f7['id'],'WhatsappInteractionId':_0x152550['id'],'UserId':_0x2c623f[_0x402a('0x5e')]['id'],'ContactId':_0x48c12b['id']}))[_0x402a('0x33')](function(_0x425ad1){_0x152550['dataValues']['Messages']=[];_0x152550[_0x402a('0xc5')][_0x402a('0xc6')][_0x402a('0xaf')](_0x425ad1['dataValues']);return _0x152550;});})['then'](respondWithResult(_0x3b5ead,null))[_0x402a('0x59')](handleError(_0x3b5ead,null));}; \ No newline at end of file +var _0xc1ec=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','whatsapp','account','type','sinch','statuses','state','read','update','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','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','Contacts','DESC','list','contact','WhatsappInteraction','interaction','close','unmanaged','created','WhatsappMessage','AttachmentId','UserId','unshift','*,*,*,*','WhatsappQueue','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','push','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','offset','limit','count','set','apply','reject','save','destroy','get','WhatsappAccounts','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','WhatsappAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','sequelize','transaction'];(function(_0x14dfd6,_0x392fa4){var _0x36c19a=function(_0x453179){while(--_0x453179){_0x14dfd6['push'](_0x14dfd6['shift']());}};_0x36c19a(++_0x392fa4);}(_0xc1ec,0x117));var _0xcc1e=function(_0x563ae3,_0x1df974){_0x563ae3=_0x563ae3-0x0;var _0x1138cc=_0xc1ec[_0x563ae3];return _0x1138cc;};'use strict';var emlformat=require(_0xcc1e('0x0'));var rimraf=require(_0xcc1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc1e('0x2'));var moment=require(_0xcc1e('0x3'));var BPromise=require(_0xcc1e('0x4'));var Mustache=require(_0xcc1e('0x5'));var util=require(_0xcc1e('0x6'));var path=require(_0xcc1e('0x7'));var sox=require(_0xcc1e('0x8'));var csv=require('to-csv');var ejs=require(_0xcc1e('0x9'));var fs=require('fs');var fs_extra=require(_0xcc1e('0xa'));var _=require(_0xcc1e('0xb'));var squel=require(_0xcc1e('0xc'));var crypto=require(_0xcc1e('0xd'));var jsforce=require(_0xcc1e('0xe'));var deskjs=require(_0xcc1e('0xf'));var toCsv=require(_0xcc1e('0x10'));var querystring=require(_0xcc1e('0x11'));var Papa=require('papaparse');var Redis=require(_0xcc1e('0x12'));var authService=require(_0xcc1e('0x13'));var qs=require(_0xcc1e('0x14'));var as=require(_0xcc1e('0x15'));var hardwareService=require(_0xcc1e('0x16'));var logger=require(_0xcc1e('0x17'))('api');var utils=require(_0xcc1e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcc1e('0x19'));var db=require('../../mysqldb')['db'];config[_0xcc1e('0x1a')]=_['defaults'](config[_0xcc1e('0x1a')],{'host':_0xcc1e('0x1b'),'port':0x18eb});var socket=require(_0xcc1e('0x1c'))(new Redis(config['redis']));require(_0xcc1e('0x1d'))[_0xcc1e('0x1e')](socket);var jayson=require(_0xcc1e('0x1f'));var client=jayson[_0xcc1e('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x538f41,_0x6935b8,_0x303e16,_0x12421e){return new BPromise(function(_0x3233b7,_0x13bcff){var _0x3e743d=_0x12421e||client;return _0x3e743d['request'](_0x538f41,_0x303e16)[_0xcc1e('0x21')](function(_0x45d0cf){logger[_0xcc1e('0x22')](_0xcc1e('0x23'),_0x6935b8,_0xcc1e('0x24'));logger[_0xcc1e('0x25')](_0xcc1e('0x26'),_0x6935b8,'request\x20sent',JSON[_0xcc1e('0x27')](_0x45d0cf));if(_0x45d0cf[_0xcc1e('0x28')]){if(_0x45d0cf[_0xcc1e('0x28')][_0xcc1e('0x29')]===0x1f4){logger[_0xcc1e('0x28')](_0xcc1e('0x23'),_0x6935b8,_0x45d0cf[_0xcc1e('0x28')][_0xcc1e('0x2a')]);return _0x13bcff(_0x45d0cf[_0xcc1e('0x28')][_0xcc1e('0x2a')]);}logger[_0xcc1e('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x6935b8,_0x45d0cf['error']['message']);return _0x3233b7(_0x45d0cf[_0xcc1e('0x28')][_0xcc1e('0x2a')]);}else{logger[_0xcc1e('0x22')](_0xcc1e('0x23'),_0x6935b8,'request\x20sent');_0x3233b7(_0x45d0cf['result']['message']);}})['catch'](function(_0x2f3cfc){logger['error'](_0xcc1e('0x23'),_0x6935b8,_0x2f3cfc);_0x13bcff(_0x2f3cfc);});});}function respondWithStatusCode(_0x50e615,_0x2f28b3){_0x2f28b3=_0x2f28b3||0xcc;return function(_0x348d0d){if(_0x348d0d){return _0x50e615['sendStatus'](_0x2f28b3);}return _0x50e615[_0xcc1e('0x2b')](_0x2f28b3)[_0xcc1e('0x2c')]();};}function respondWithResult(_0x57df1b,_0x5afbc5){_0x5afbc5=_0x5afbc5||0xc8;return function(_0x498df7){if(_0x498df7){return _0x57df1b[_0xcc1e('0x2b')](_0x5afbc5)[_0xcc1e('0x2d')](_0x498df7);}};}function respondWithFilteredResult(_0x33a840,_0x26f70f){return function(_0x366847){if(_0x366847){var _0x46b719=typeof _0x26f70f[_0xcc1e('0x2e')]==='undefined'&&typeof _0x26f70f[_0xcc1e('0x2f')]==='undefined';var _0x59c4ee=_0x366847[_0xcc1e('0x30')];var _0xdb917c=_0x46b719?0x0:_0x26f70f[_0xcc1e('0x2e')];var _0x502e14=_0x46b719?_0x366847[_0xcc1e('0x30')]:_0x26f70f[_0xcc1e('0x2e')]+_0x26f70f[_0xcc1e('0x2f')];var _0x376977;if(_0x502e14>=_0x59c4ee){_0x502e14=_0x59c4ee;_0x376977=0xc8;}else{_0x376977=0xce;}_0x33a840['status'](_0x376977);return _0x33a840[_0xcc1e('0x31')]('Content-Range',_0xdb917c+'-'+_0x502e14+'/'+_0x59c4ee)['json'](_0x366847);}return null;};}function patchUpdates(_0x552c67){return function(_0x1d3afb){try{jsonpatch[_0xcc1e('0x32')](_0x1d3afb,_0x552c67,!![]);}catch(_0x6bc379){return BPromise[_0xcc1e('0x33')](_0x6bc379);}return _0x1d3afb[_0xcc1e('0x34')]();};}function saveUpdates(_0x1b1b32,_0x39db85){return function(_0x29a308){if(_0x29a308){return _0x29a308['update'](_0x1b1b32)[_0xcc1e('0x21')](function(_0x2e6b0e){return _0x2e6b0e;});}return null;};}function removeEntity(_0x107fa9,_0x5eb2be){return function(_0xb1a0c8){if(_0xb1a0c8){return _0xb1a0c8[_0xcc1e('0x35')]()[_0xcc1e('0x21')](function(){var _0x40ec74=_0xb1a0c8[_0xcc1e('0x36')]({'plain':!![]});var _0x557d30=_0xcc1e('0x37');return db['UserProfileResource'][_0xcc1e('0x35')]({'where':{'type':_0x557d30,'resourceId':_0x40ec74['id']}})[_0xcc1e('0x21')](function(){return _0xb1a0c8;});})[_0xcc1e('0x21')](function(){_0x107fa9[_0xcc1e('0x2b')](0xcc)[_0xcc1e('0x2c')]();});}};}function handleEntityNotFound(_0x45ff5e,_0xc0ae9){return function(_0x1f54d3){if(!_0x1f54d3){_0x45ff5e[_0xcc1e('0x38')](0x194);}return _0x1f54d3;};}function handleError(_0x153ad4,_0x11e421){_0x11e421=_0x11e421||0x1f4;return function(_0x15eaf6){logger['error'](_0x15eaf6['stack']);if(_0x15eaf6[_0xcc1e('0x39')]){delete _0x15eaf6[_0xcc1e('0x39')];}_0x153ad4['status'](_0x11e421)[_0xcc1e('0x3a')](_0x15eaf6);};}exports[_0xcc1e('0x3b')]=function(_0x205476,_0x2d9662){var _0x4fa8e0={'include':[{'model':db[_0xcc1e('0x3c')],'as':_0xcc1e('0x3d')}]},_0x2ba331={},_0x409dd4={'count':0x0,'rows':[]};var _0x3a7cfe=_[_0xcc1e('0x3e')](db[_0xcc1e('0x3f')][_0xcc1e('0x40')],function(_0x49f7aa){return{'name':_0x49f7aa['fieldName'],'type':_0x49f7aa['type'][_0xcc1e('0x41')]};});_0x2ba331['model']=_[_0xcc1e('0x3e')](_0x3a7cfe,_0xcc1e('0x39'));_0x2ba331[_0xcc1e('0x42')]=_[_0xcc1e('0x43')](_0x205476['query']);_0x2ba331[_0xcc1e('0x44')]=_[_0xcc1e('0x45')](_0x2ba331[_0xcc1e('0x46')],_0x2ba331['query']);_0x4fa8e0[_0xcc1e('0x47')]=_['intersection'](_0x2ba331[_0xcc1e('0x46')],qs[_0xcc1e('0x48')](_0x205476[_0xcc1e('0x42')][_0xcc1e('0x48')]));_0x4fa8e0['attributes']=_0x4fa8e0['attributes'][_0xcc1e('0x49')]?_0x4fa8e0[_0xcc1e('0x47')]:_0x2ba331[_0xcc1e('0x46')];if(!_0x205476[_0xcc1e('0x42')][_0xcc1e('0x4a')](_0xcc1e('0x4b'))){_0x4fa8e0[_0xcc1e('0x2f')]=qs['limit'](_0x205476['query'][_0xcc1e('0x2f')]);_0x4fa8e0[_0xcc1e('0x2e')]=qs[_0xcc1e('0x2e')](_0x205476[_0xcc1e('0x42')][_0xcc1e('0x2e')]);}_0x4fa8e0[_0xcc1e('0x4c')]=qs[_0xcc1e('0x4d')](_0x205476['query'][_0xcc1e('0x4d')]);_0x4fa8e0[_0xcc1e('0x4e')]=qs[_0xcc1e('0x44')](_[_0xcc1e('0x4f')](_0x205476['query'],_0x2ba331[_0xcc1e('0x44')]),_0x3a7cfe);if(_0x205476[_0xcc1e('0x42')][_0xcc1e('0x50')]){_0x4fa8e0[_0xcc1e('0x4e')]=_[_0xcc1e('0x51')](_0x4fa8e0['where'],{'$or':_['map'](_0x3a7cfe,function(_0x47a7b5){if(_0x47a7b5['type']!==_0xcc1e('0x52')){var _0x5f53e5={};_0x5f53e5[_0x47a7b5[_0xcc1e('0x39')]]={'$like':'%'+_0x205476['query'][_0xcc1e('0x50')]+'%'};return _0x5f53e5;}})});}_0x4fa8e0=_[_0xcc1e('0x51')]({},_0x4fa8e0,_0x205476[_0xcc1e('0x53')]);var _0x56f6e4={'where':_0x4fa8e0[_0xcc1e('0x4e')]};return db[_0xcc1e('0x3f')][_0xcc1e('0x30')](_0x56f6e4)['then'](function(_0x4e547c){_0x409dd4[_0xcc1e('0x30')]=_0x4e547c;if(_0x205476[_0xcc1e('0x42')]['includeAll']){_0x4fa8e0['include']=[{'all':!![]}];}return db[_0xcc1e('0x3f')][_0xcc1e('0x54')](_0x4fa8e0);})['then'](function(_0x30b96c){_0x409dd4[_0xcc1e('0x55')]=_0x30b96c;return _0x409dd4;})[_0xcc1e('0x21')](respondWithFilteredResult(_0x2d9662,_0x4fa8e0))['catch'](handleError(_0x2d9662,null));};exports[_0xcc1e('0x56')]=function(_0x5b1bbc,_0x456816){var _0x51f053={'raw':![],'where':{'id':_0x5b1bbc['params']['id']},'include':[{'model':db[_0xcc1e('0x3c')],'as':_0xcc1e('0x3d')}]},_0x4dde42={};_0x4dde42[_0xcc1e('0x46')]=_[_0xcc1e('0x43')](db[_0xcc1e('0x3f')][_0xcc1e('0x40')]);_0x4dde42[_0xcc1e('0x42')]=_[_0xcc1e('0x43')](_0x5b1bbc['query']);_0x4dde42[_0xcc1e('0x44')]=_[_0xcc1e('0x45')](_0x4dde42[_0xcc1e('0x46')],_0x4dde42[_0xcc1e('0x42')]);_0x51f053[_0xcc1e('0x47')]=_['intersection'](_0x4dde42[_0xcc1e('0x46')],qs['fields'](_0x5b1bbc[_0xcc1e('0x42')][_0xcc1e('0x48')]));_0x51f053[_0xcc1e('0x47')]=_0x51f053[_0xcc1e('0x47')][_0xcc1e('0x49')]?_0x51f053[_0xcc1e('0x47')]:_0x4dde42[_0xcc1e('0x46')];if(_0x5b1bbc[_0xcc1e('0x42')][_0xcc1e('0x57')]){_0x51f053['include']=[{'all':!![]}];}_0x51f053=_['merge']({},_0x51f053,_0x5b1bbc['options']);return db[_0xcc1e('0x3f')][_0xcc1e('0x58')](_0x51f053)[_0xcc1e('0x21')](handleEntityNotFound(_0x456816,null))['then'](respondWithResult(_0x456816,null))[_0xcc1e('0x59')](handleError(_0x456816,null));};exports['create']=function(_0x249606,_0x78b7c){return db[_0xcc1e('0x3f')][_0xcc1e('0x5a')](_0x249606[_0xcc1e('0x5b')],{})[_0xcc1e('0x21')](function(_0x26dd79){var _0x34d70b=_0x249606[_0xcc1e('0x5c')]['get']({'plain':!![]});if(!_0x34d70b)throw new Error(_0xcc1e('0x5d'));if(_0x34d70b['role']===_0xcc1e('0x5c')){var _0x396796=_0x26dd79[_0xcc1e('0x36')]({'plain':!![]});var _0x72b783=_0xcc1e('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x72b783,'userProfileId':_0x34d70b[_0xcc1e('0x5e')]},'raw':!![]})[_0xcc1e('0x21')](function(_0x472b97){if(_0x472b97&&_0x472b97['autoAssociation']===0x0){return db['UserProfileResource'][_0xcc1e('0x5a')]({'name':_0x396796[_0xcc1e('0x39')],'resourceId':_0x396796['id'],'type':_0x472b97['name'],'sectionId':_0x472b97['id']},{})[_0xcc1e('0x21')](function(){return _0x26dd79;});}else{return _0x26dd79;}})[_0xcc1e('0x59')](function(_0x4001b3){logger['error'](_0xcc1e('0x5f'),_0x4001b3);throw _0x4001b3;});}return _0x26dd79;})[_0xcc1e('0x21')](respondWithResult(_0x78b7c,0xc9))[_0xcc1e('0x59')](handleError(_0x78b7c,null));};exports['update']=function(_0x20dd3e,_0x3c317e){if(_0x20dd3e[_0xcc1e('0x5b')]['id']){delete _0x20dd3e['body']['id'];}return db[_0xcc1e('0x3f')][_0xcc1e('0x58')]({'where':{'id':_0x20dd3e['params']['id']},'include':[{'model':db[_0xcc1e('0x3c')],'as':_0xcc1e('0x3d')}]})[_0xcc1e('0x21')](handleEntityNotFound(_0x3c317e,null))[_0xcc1e('0x21')](saveUpdates(_0x20dd3e[_0xcc1e('0x5b')],null))['then'](respondWithResult(_0x3c317e,null))[_0xcc1e('0x59')](handleError(_0x3c317e,null));};exports[_0xcc1e('0x35')]=function(_0x45c5e0,_0x3b3a61){return db[_0xcc1e('0x3f')][_0xcc1e('0x58')]({'where':{'id':_0x45c5e0[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x3b3a61,null))[_0xcc1e('0x21')](removeEntity(_0x3b3a61,null))[_0xcc1e('0x59')](handleError(_0x3b3a61,null));};exports[_0xcc1e('0x61')]=function(_0x54add2,_0x72fc48){return db[_0xcc1e('0x3f')][_0xcc1e('0x61')]()[_0xcc1e('0x21')](respondWithResult(_0x72fc48,null))[_0xcc1e('0x59')](handleError(_0x72fc48,null));};exports[_0xcc1e('0x62')]=function(_0x66bfca,_0x19f1e5,_0x2ab8b1){if(_0x66bfca[_0xcc1e('0x5b')]['id']){delete _0x66bfca[_0xcc1e('0x5b')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x66bfca[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x19f1e5,null))[_0xcc1e('0x21')](function(_0x5083b8){if(_0x5083b8){_0x66bfca['body']['WhatsappAccountId']=_0x5083b8['id'];return db[_0xcc1e('0x63')][_0xcc1e('0x5a')](_0x66bfca['body']);}})[_0xcc1e('0x21')](respondWithResult(_0x19f1e5,null))['catch'](handleError(_0x19f1e5,null));};exports[_0xcc1e('0x64')]=function(_0x196fed,_0x82f04e,_0x4d7228){var _0x584c5e={'raw':![],'where':{}};var _0x5833e2={};var _0x3244bf={'count':0x0,'rows':[]};return db[_0xcc1e('0x3f')]['findOne']({'where':{'id':_0x196fed[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x82f04e,null))[_0xcc1e('0x21')](function(_0x2ca82f){if(_0x2ca82f){_0x5833e2[_0xcc1e('0x46')]=_[_0xcc1e('0x43')](db[_0xcc1e('0x63')][_0xcc1e('0x40')]);_0x5833e2[_0xcc1e('0x42')]=_[_0xcc1e('0x43')](_0x196fed['query']);_0x5833e2['filters']=_[_0xcc1e('0x45')](_0x5833e2[_0xcc1e('0x46')],_0x5833e2['query']);_0x584c5e[_0xcc1e('0x47')]=_[_0xcc1e('0x45')](_0x5833e2[_0xcc1e('0x46')],qs[_0xcc1e('0x48')](_0x196fed['query'][_0xcc1e('0x48')]));_0x584c5e[_0xcc1e('0x47')]=_0x584c5e['attributes'][_0xcc1e('0x49')]?_0x584c5e[_0xcc1e('0x47')]:_0x5833e2[_0xcc1e('0x46')];if(!_0x196fed[_0xcc1e('0x42')][_0xcc1e('0x4a')](_0xcc1e('0x4b'))){_0x584c5e['limit']=qs[_0xcc1e('0x2f')](_0x196fed[_0xcc1e('0x42')][_0xcc1e('0x2f')]);_0x584c5e[_0xcc1e('0x2e')]=qs['offset'](_0x196fed[_0xcc1e('0x42')]['offset']);}_0x584c5e[_0xcc1e('0x4c')]=qs['sort'](_0x196fed['query'][_0xcc1e('0x4d')]);_0x584c5e['where']=qs[_0xcc1e('0x44')](_[_0xcc1e('0x4f')](_0x196fed[_0xcc1e('0x42')],_0x5833e2[_0xcc1e('0x44')]));_0x584c5e[_0xcc1e('0x4e')][_0xcc1e('0x65')]=_0x2ca82f['id'];if(_0x196fed[_0xcc1e('0x42')][_0xcc1e('0x50')]){_0x584c5e[_0xcc1e('0x4e')]=_[_0xcc1e('0x51')](_0x584c5e[_0xcc1e('0x4e')],{'$or':_[_0xcc1e('0x3e')](_0x584c5e['attributes'],function(_0x54a367){var _0x4f5292={};_0x4f5292[_0x54a367]={'$like':'%'+_0x196fed[_0xcc1e('0x42')]['filter']+'%'};return _0x4f5292;})});}_0x584c5e=_[_0xcc1e('0x51')]({},_0x584c5e,_0x196fed[_0xcc1e('0x53')]);return db[_0xcc1e('0x63')][_0xcc1e('0x30')]({'where':_0x584c5e[_0xcc1e('0x4e')]})[_0xcc1e('0x21')](function(_0x45e116){_0x3244bf[_0xcc1e('0x30')]=_0x45e116;if(_0x196fed['query'][_0xcc1e('0x57')]){_0x584c5e[_0xcc1e('0x66')]=[{'all':!![]}];}return db[_0xcc1e('0x63')][_0xcc1e('0x54')](_0x584c5e);})['then'](function(_0x5c48c6){_0x3244bf[_0xcc1e('0x55')]=_0x5c48c6;return _0x3244bf;});}})[_0xcc1e('0x21')](respondWithFilteredResult(_0x82f04e,_0x584c5e))[_0xcc1e('0x59')](handleError(_0x82f04e,null));};exports[_0xcc1e('0x67')]=function(_0x72b3f5,_0x281a6f,_0xc99581){return db[_0xcc1e('0x3f')][_0xcc1e('0x58')]({'where':{'id':_0x72b3f5[_0xcc1e('0x60')]['id']}})['then'](handleEntityNotFound(_0x281a6f,null))[_0xcc1e('0x21')](function(_0x586b30){if(_0x586b30){return _0x586b30[_0xcc1e('0x67')](_0x72b3f5[_0xcc1e('0x42')][_0xcc1e('0x68')]);}})[_0xcc1e('0x21')](respondWithStatusCode(_0x281a6f,null))[_0xcc1e('0x59')](handleError(_0x281a6f,null));};exports[_0xcc1e('0x69')]=function(_0x4cbdba,_0x2937ed,_0x554eaa){if(_0x4cbdba[_0xcc1e('0x5b')]['id']){delete _0x4cbdba[_0xcc1e('0x5b')]['id'];}return db[_0xcc1e('0x3f')]['find']({'where':{'id':_0x4cbdba['params']['id']}})['then'](handleEntityNotFound(_0x2937ed,null))[_0xcc1e('0x21')](function(_0x331706){if(_0x331706){_0x4cbdba[_0xcc1e('0x5b')][_0xcc1e('0x65')]=_0x331706['id'];return db[_0xcc1e('0x6a')]['create'](_0x4cbdba[_0xcc1e('0x5b')]);}})[_0xcc1e('0x21')](respondWithResult(_0x2937ed,null))[_0xcc1e('0x59')](handleError(_0x2937ed,null));};exports[_0xcc1e('0x6b')]=function(_0x8e252f,_0x57f290,_0x7c0b0a){var _0x443a1b={'raw':![],'where':{}};var _0x501cd9={};var _0x2f3d09={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcc1e('0x6c')]({'where':{'id':_0x8e252f[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x57f290,null))[_0xcc1e('0x21')](function(_0x44f61f){if(_0x44f61f){_0x501cd9[_0xcc1e('0x46')]=_['keys'](db[_0xcc1e('0x6a')][_0xcc1e('0x40')]);_0x501cd9['query']=_[_0xcc1e('0x43')](_0x8e252f[_0xcc1e('0x42')]);_0x501cd9[_0xcc1e('0x44')]=_[_0xcc1e('0x45')](_0x501cd9[_0xcc1e('0x46')],_0x501cd9[_0xcc1e('0x42')]);_0x443a1b[_0xcc1e('0x47')]=_['intersection'](_0x501cd9[_0xcc1e('0x46')],qs['fields'](_0x8e252f[_0xcc1e('0x42')]['fields']));_0x443a1b[_0xcc1e('0x47')]=_0x443a1b['attributes'][_0xcc1e('0x49')]?_0x443a1b[_0xcc1e('0x47')]:_0x501cd9['model'];if(!_0x8e252f[_0xcc1e('0x42')][_0xcc1e('0x4a')](_0xcc1e('0x4b'))){_0x443a1b[_0xcc1e('0x2f')]=qs[_0xcc1e('0x2f')](_0x8e252f[_0xcc1e('0x42')][_0xcc1e('0x2f')]);_0x443a1b[_0xcc1e('0x2e')]=qs['offset'](_0x8e252f[_0xcc1e('0x42')][_0xcc1e('0x2e')]);}_0x443a1b['order']=qs[_0xcc1e('0x4d')](_0x8e252f['query'][_0xcc1e('0x4d')]);_0x443a1b['where']=qs[_0xcc1e('0x44')](_['pick'](_0x8e252f['query'],_0x501cd9['filters']));_0x443a1b[_0xcc1e('0x4e')][_0xcc1e('0x65')]=_0x44f61f['id'];if(_0x8e252f[_0xcc1e('0x42')][_0xcc1e('0x50')]){_0x443a1b[_0xcc1e('0x4e')]=_[_0xcc1e('0x51')](_0x443a1b['where'],{'$or':_['map'](_0x443a1b[_0xcc1e('0x47')],function(_0x426c31){var _0x49e99e={};_0x49e99e[_0x426c31]={'$like':'%'+_0x8e252f['query'][_0xcc1e('0x50')]+'%'};return _0x49e99e;})});}_0x443a1b=_[_0xcc1e('0x51')]({},_0x443a1b,_0x8e252f['options']);return db['CannedAnswer'][_0xcc1e('0x30')]({'where':_0x443a1b['where']})[_0xcc1e('0x21')](function(_0x4ca04b){_0x2f3d09['count']=_0x4ca04b;if(_0x8e252f['query'][_0xcc1e('0x57')]){_0x443a1b[_0xcc1e('0x66')]=[{'all':!![]}];}return db[_0xcc1e('0x6a')][_0xcc1e('0x54')](_0x443a1b);})['then'](function(_0x44aef5){_0x2f3d09['rows']=_0x44aef5;return _0x2f3d09;});}})[_0xcc1e('0x21')](respondWithFilteredResult(_0x57f290,_0x443a1b))[_0xcc1e('0x59')](handleError(_0x57f290,null));};exports['removeAnswers']=function(_0x388d41,_0x12f753,_0x41c30d){return db['WhatsappAccount'][_0xcc1e('0x58')]({'where':{'id':_0x388d41[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x12f753,null))[_0xcc1e('0x21')](function(_0x377dc3){if(_0x377dc3){return _0x377dc3[_0xcc1e('0x6d')](_0x388d41[_0xcc1e('0x42')][_0xcc1e('0x68')]);}})[_0xcc1e('0x21')](respondWithStatusCode(_0x12f753,null))[_0xcc1e('0x59')](handleError(_0x12f753,null));};exports[_0xcc1e('0x6e')]=function(_0x159cda,_0x117c57,_0x458fec){return db['WhatsappAccount'][_0xcc1e('0x58')]({'where':{'id':_0x159cda[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x117c57,null))[_0xcc1e('0x21')](function(_0x48cbbf){if(_0x48cbbf){return _0x48cbbf[_0xcc1e('0x6e')](_0x159cda[_0xcc1e('0x5b')][_0xcc1e('0x68')],_[_0xcc1e('0x6f')](_0x159cda['body'],[_0xcc1e('0x68'),'id'])||{})[_0xcc1e('0x70')](function(_0x34fbea){for(var _0x30aa26=0x0;_0x30aa26<_0x159cda[_0xcc1e('0x5b')][_0xcc1e('0x68')][_0xcc1e('0x49')];_0x30aa26+=0x1){socket[_0xcc1e('0x71')](_0xcc1e('0x72'),{'UserId':Number(_0x159cda[_0xcc1e('0x5b')]['ids'][_0x30aa26]),'WhatsappAccountId':Number(_0x159cda['params']['id'])});}return _0x34fbea;});}})[_0xcc1e('0x21')](respondWithResult(_0x117c57,null))[_0xcc1e('0x59')](handleError(_0x117c57,null));};exports[_0xcc1e('0x73')]=function(_0x48a74c,_0x1b5477,_0x35fa0b){return db['WhatsappAccount'][_0xcc1e('0x58')]({'where':{'id':_0x48a74c['params']['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x1b5477,null))[_0xcc1e('0x21')](function(_0x463f1a){if(_0x463f1a){return _0x463f1a[_0xcc1e('0x73')](_0x48a74c[_0xcc1e('0x42')][_0xcc1e('0x68')])[_0xcc1e('0x21')](function(){if(_['isArray'](_0x48a74c['query'][_0xcc1e('0x68')])){for(var _0x5ad58e=0x0;_0x5ad58e<_0x48a74c[_0xcc1e('0x42')]['ids'][_0xcc1e('0x49')];_0x5ad58e+=0x1){socket['emit'](_0xcc1e('0x74'),{'UserId':Number(_0x48a74c['query']['ids'][_0x5ad58e]),'WhatsappAccountId':Number(_0x48a74c[_0xcc1e('0x60')]['id'])});}}else{socket['emit'](_0xcc1e('0x74'),{'UserId':Number(_0x48a74c[_0xcc1e('0x42')][_0xcc1e('0x68')]),'WhatsappAccountId':Number(_0x48a74c[_0xcc1e('0x60')]['id'])});}});}})[_0xcc1e('0x21')](respondWithStatusCode(_0x1b5477,null))[_0xcc1e('0x59')](handleError(_0x1b5477,null));};exports['getAgents']=function(_0x2b9b9b,_0x49aa91,_0xa9358d){var _0x2a5875={};var _0x544bd8={};var _0x183d44;var _0x298253;return db[_0xcc1e('0x3f')][_0xcc1e('0x6c')]({'where':{'id':_0x2b9b9b[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x49aa91,null))[_0xcc1e('0x21')](function(_0x39d1ad){if(_0x39d1ad){_0x183d44=_0x39d1ad;_0x544bd8[_0xcc1e('0x46')]=_[_0xcc1e('0x43')](db[_0xcc1e('0x75')][_0xcc1e('0x40')]);_0x544bd8['query']=_[_0xcc1e('0x43')](_0x2b9b9b[_0xcc1e('0x42')]);_0x544bd8[_0xcc1e('0x44')]=_[_0xcc1e('0x45')](_0x544bd8['model'],_0x544bd8['query']);_0x2a5875[_0xcc1e('0x47')]=_['intersection'](_0x544bd8['model'],qs['fields'](_0x2b9b9b[_0xcc1e('0x42')][_0xcc1e('0x48')]));_0x2a5875['attributes']=_0x2a5875[_0xcc1e('0x47')][_0xcc1e('0x49')]?_0x2a5875[_0xcc1e('0x47')]:_0x544bd8[_0xcc1e('0x46')];_0x2a5875['order']=qs['sort'](_0x2b9b9b[_0xcc1e('0x42')]['sort']);_0x2a5875[_0xcc1e('0x4e')]=qs[_0xcc1e('0x44')](_[_0xcc1e('0x4f')](_0x2b9b9b[_0xcc1e('0x42')],_0x544bd8[_0xcc1e('0x44')]));if(_0x2b9b9b[_0xcc1e('0x42')][_0xcc1e('0x50')]){_0x2a5875[_0xcc1e('0x4e')]=_[_0xcc1e('0x51')](_0x2a5875[_0xcc1e('0x4e')],{'$or':_[_0xcc1e('0x3e')](_0x2a5875['attributes'],function(_0x3b1629){var _0x3a3a21={};_0x3a3a21[_0x3b1629]={'$like':'%'+_0x2b9b9b[_0xcc1e('0x42')][_0xcc1e('0x50')]+'%'};return _0x3a3a21;})});}_0x2a5875=_[_0xcc1e('0x51')]({},_0x2a5875,_0x2b9b9b[_0xcc1e('0x53')]);return _0x183d44['getAgents'](_0x2a5875);}})[_0xcc1e('0x21')](function(_0x3b4d74){if(_0x3b4d74){_0x298253=_0x3b4d74[_0xcc1e('0x49')];if(!_0x2b9b9b[_0xcc1e('0x42')][_0xcc1e('0x4a')]('nolimit')){_0x2a5875[_0xcc1e('0x2f')]=qs[_0xcc1e('0x2f')](_0x2b9b9b[_0xcc1e('0x42')]['limit']);_0x2a5875[_0xcc1e('0x2e')]=qs[_0xcc1e('0x2e')](_0x2b9b9b['query'][_0xcc1e('0x2e')]);}return _0x183d44[_0xcc1e('0x76')](_0x2a5875);}})[_0xcc1e('0x21')](function(_0x28f0d0){if(_0x28f0d0){return _0x28f0d0?{'count':_0x298253,'rows':_0x28f0d0}:null;}})[_0xcc1e('0x21')](respondWithResult(_0x49aa91,null))[_0xcc1e('0x59')](handleError(_0x49aa91,null));};exports['addApplications']=function(_0x28a82a,_0xd5dcc6){var _0x241454=_0x28a82a[_0xcc1e('0x60')]['id'];var _0x665dae=_0x28a82a['body'];var _0x29c045=0xc8;var _0x215b46=null;return db[_0xcc1e('0x77')][_0xcc1e('0x78')]({'isolationLevel':db['sequelize'][_0xcc1e('0x79')][_0xcc1e('0x7a')][_0xcc1e('0x7b')]},function(_0x17552e){return db['WhatsappAccount']['findOne']({'where':{'id':_0x241454},'transaction':_0x17552e})[_0xcc1e('0x21')](function(_0x29e182){if(_0x29e182){return db[_0xcc1e('0x7c')][_0xcc1e('0x35')]({'where':{'WhatsappAccountId':_0x241454},'transaction':_0x17552e})[_0xcc1e('0x21')](function(){var _0x364f1e=_[_0xcc1e('0x3e')](_0x665dae,function(_0x1a44f0){_0x1a44f0[_0xcc1e('0x65')]=_0x241454;return _0x1a44f0;});return db[_0xcc1e('0x7c')][_0xcc1e('0x7d')](_0x364f1e,{'transaction':_0x17552e});});}else{_0x29c045=0x194;_0x215b46=[];}});})[_0xcc1e('0x21')](function(){if(_0x29c045!==0x194){return db['WhatsappApplication'][_0xcc1e('0x7e')]({'where':{'WhatsappAccountId':_0x241454},'order':_0xcc1e('0x7f')})[_0xcc1e('0x21')](function(_0x541ef8){_0x215b46=_0x541ef8;});}})['catch'](function(_0x1c0b41){_0x29c045=0x1f4;logger[_0xcc1e('0x28')](_0x1c0b41[_0xcc1e('0x80')]);if(_0x1c0b41[_0xcc1e('0x39')]){delete _0x1c0b41['name'];}_0x215b46=_0x1c0b41;})[_0xcc1e('0x81')](function(){if(_0x215b46===null){_0xd5dcc6[_0xcc1e('0x38')](_0x29c045);}else{if(_0x29c045===0x1f4){_0xd5dcc6[_0xcc1e('0x2b')](_0x29c045)['send'](_0x215b46);}else{_0xd5dcc6[_0xcc1e('0x2b')](_0x29c045)[_0xcc1e('0x2d')](_0x215b46);}}});};exports['getApplications']=function(_0x1c4cf7,_0x114289,_0x33ebfe){var _0x4fda5e={};var _0x3aac53={};var _0x590076;var _0x5cff90;return db[_0xcc1e('0x3f')]['findOne']({'where':{'id':_0x1c4cf7[_0xcc1e('0x60')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x114289,null))[_0xcc1e('0x21')](function(_0x13c482){if(_0x13c482){_0x590076=_0x13c482;_0x3aac53[_0xcc1e('0x46')]=_[_0xcc1e('0x43')](db[_0xcc1e('0x7c')]['rawAttributes']);_0x3aac53['query']=_[_0xcc1e('0x43')](_0x1c4cf7[_0xcc1e('0x42')]);_0x3aac53['filters']=_[_0xcc1e('0x45')](_0x3aac53[_0xcc1e('0x46')],_0x3aac53['query']);_0x4fda5e['attributes']=_['intersection'](_0x3aac53[_0xcc1e('0x46')],qs[_0xcc1e('0x48')](_0x1c4cf7[_0xcc1e('0x42')][_0xcc1e('0x48')]));_0x4fda5e[_0xcc1e('0x47')]=_0x4fda5e[_0xcc1e('0x47')][_0xcc1e('0x49')]?_0x4fda5e[_0xcc1e('0x47')]:_0x3aac53['model'];_0x4fda5e['order']=qs['sort'](_0x1c4cf7['query'][_0xcc1e('0x4d')]);_0x4fda5e[_0xcc1e('0x4e')]=qs[_0xcc1e('0x44')](_[_0xcc1e('0x4f')](_0x1c4cf7['query'],_0x3aac53['filters']));if(_0x1c4cf7[_0xcc1e('0x42')][_0xcc1e('0x50')]){_0x4fda5e['where']=_[_0xcc1e('0x51')](_0x4fda5e[_0xcc1e('0x4e')],{'$or':_[_0xcc1e('0x3e')](_0x4fda5e['attributes'],function(_0x414a70){var _0x2e3eca={};_0x2e3eca[_0x414a70]={'$like':'%'+_0x1c4cf7[_0xcc1e('0x42')][_0xcc1e('0x50')]+'%'};return _0x2e3eca;})});}_0x4fda5e=_[_0xcc1e('0x51')]({},_0x4fda5e,_0x1c4cf7['options']);return _0x590076[_0xcc1e('0x82')](_0x4fda5e);}})[_0xcc1e('0x21')](function(_0x5472a0){if(_0x5472a0){_0x5cff90=_0x5472a0[_0xcc1e('0x49')];if(!_0x1c4cf7[_0xcc1e('0x42')][_0xcc1e('0x4a')](_0xcc1e('0x4b'))){_0x4fda5e[_0xcc1e('0x2f')]=qs[_0xcc1e('0x2f')](_0x1c4cf7['query'][_0xcc1e('0x2f')]);_0x4fda5e['offset']=qs[_0xcc1e('0x2e')](_0x1c4cf7[_0xcc1e('0x42')][_0xcc1e('0x2e')]);}return _0x590076[_0xcc1e('0x82')](_0x4fda5e);}})[_0xcc1e('0x21')](function(_0x30aa63){if(_0x30aa63){return _0x30aa63?{'count':_0x5cff90,'rows':_0x30aa63}:null;}})[_0xcc1e('0x21')](respondWithResult(_0x114289,null))[_0xcc1e('0x59')](handleError(_0x114289,null));};exports[_0xcc1e('0x83')]=function(_0x5d61a4,_0x30a1be,_0x7b68f3){var _0xd55de={'channel':_0xcc1e('0x84')};var _0x13cad8=[];var _0x10f053=[];var _0x2c8d69={};return db['WhatsappAccount'][_0xcc1e('0x58')]({'where':{'id':_0x5d61a4['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x30a1be,null))[_0xcc1e('0x21')](function(_0x25a426){_0xd55de['account']=_0x25a426;if(_0xd55de[_0xcc1e('0x85')]&&_0xd55de[_0xcc1e('0x85')][_0xcc1e('0x86')]===_0xcc1e('0x87')&&_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x88')]){if(_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x88')][_0xcc1e('0x49')]===0x0)return;if(_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x88')][0x0][_0xcc1e('0x89')]!==_0xcc1e('0x8a'))return;return db['WhatsappMessage'][_0xcc1e('0x8b')]({'read':!![],'readAt':_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x5d61a4['body'][_0xcc1e('0x88')][0x0]['message_id']},'individualHooks':!![]})[_0xcc1e('0x21')](function(_0x31a4b6){return _0x30a1be[_0xcc1e('0x2b')](0xc8)[_0xcc1e('0x2d')](_0x31a4b6);});}_0xd55de[_0xcc1e('0x8c')]=_[_0xcc1e('0x8d')](_0x25a426[_0xcc1e('0x8e')],[_0xcc1e('0x7f')],['asc']);if(_0xd55de['account'][_0xcc1e('0x8e')]){delete _0xd55de[_0xcc1e('0x85')][_0xcc1e('0x8e')];}return db[_0xcc1e('0x8f')][_0xcc1e('0x61')]()[_0xcc1e('0x21')](function(_0x301cb0){if(!_0x301cb0){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0x92'));}_0x13cad8=_['difference'](_[_0xcc1e('0x43')](_0x301cb0),[_0xcc1e('0x93'),'updatedAt']);_0x10f053=_[_0xcc1e('0x94')](_[_0xcc1e('0x43')](_0x301cb0),['createdAt',_0xcc1e('0x95'),_0xcc1e('0x96'),_0xcc1e('0x97')]);_0xd55de[_0xcc1e('0x5b')]={'mapKey':_0xcc1e('0x98')};if(_0xd55de[_0xcc1e('0x85')]&&_0xd55de[_0xcc1e('0x85')][_0xcc1e('0x86')]===_0xcc1e('0x99')){_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x9a')]=_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x9b')][_0xcc1e('0x9c')](_0xcc1e('0x9d'),'');_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x5b')]=_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0x9e')];_0xd55de['body'][_0xcc1e('0x9f')]=_0x5d61a4['body'][_0xcc1e('0xa0')];}if(_0xd55de[_0xcc1e('0x85')]&&_0xd55de[_0xcc1e('0x85')][_0xcc1e('0x86')]===_0xcc1e('0x87')){_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x9a')]=_0x5d61a4['body'][_0xcc1e('0xa1')][0x0][_0xcc1e('0x9a')];_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x5b')]=_0x5d61a4[_0xcc1e('0x5b')]['notifications'][0x0]['message'][_0xcc1e('0x5b')];_0xd55de[_0xcc1e('0x5b')]['messageId']=_0x5d61a4[_0xcc1e('0x5b')][_0xcc1e('0xa1')][0x0][_0xcc1e('0xa2')];}if(_0xd55de[_0xcc1e('0x5b')]['id']){delete _0xd55de[_0xcc1e('0x5b')]['id'];}if(_[_0xcc1e('0xa3')](_0xd55de['body']['from'])){throw new db['Sequelize'][(_0xcc1e('0x91'))](_0xcc1e('0xa4'));}if(_[_0xcc1e('0xa3')](_0xd55de[_0xcc1e('0x5b')]['body'])||_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x5b')]===''){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0xa5'));}if(_[_0xcc1e('0xa3')](_0xd55de['body'][_0xcc1e('0xa6')])){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0xa7')+_0x10f053);}if(!_['includes'](_0x10f053,_0xd55de['body'][_0xcc1e('0xa6')])){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0xa8')+_0x10f053);}_0x2c8d69[_0xd55de['body'][_0xcc1e('0xa6')]]=_0xd55de['body'][_0xcc1e('0x9a')];return db[_0xcc1e('0xa9')][_0xcc1e('0x58')]({'where':{'id':_0xd55de[_0xcc1e('0x85')]['ListId']},'include':[{'model':db[_0xcc1e('0x8f')],'as':_0xcc1e('0xaa'),'where':_0x2c8d69,'limit':0x1,'order':[[_0xcc1e('0x95'),_0xcc1e('0xab')]]}]});})[_0xcc1e('0x21')](handleEntityNotFound(_0x30a1be,null))['then'](function(_0x2642cf){if(_0x2642cf){_0xd55de[_0xcc1e('0xac')]=_['omit'](_0x2642cf,[_0xcc1e('0xaa')]);if(_0x2642cf['Contacts'][_0xcc1e('0x49')]){return _0x2642cf[_0xcc1e('0xaa')][0x0];}var _0x203df9=_['defaults'](_0xd55de['body'],{'firstName':_0xd55de['body'][_0xcc1e('0x9a')],'ListId':_0x2642cf['id']});_0x203df9[_0xd55de['body'][_0xcc1e('0xa6')]]=_0xd55de[_0xcc1e('0x5b')]['from'];return db[_0xcc1e('0x8f')][_0xcc1e('0x5a')](_0x203df9,{'fields':_0x13cad8,'raw':!![]});}})[_0xcc1e('0x21')](handleEntityNotFound(_0x30a1be,null))[_0xcc1e('0x21')](function(_0xa6d9d4){if(_0xa6d9d4){_0xd55de[_0xcc1e('0xad')]=_0xa6d9d4;var _0x2597ee={'ContactId':_0xa6d9d4['id'],'phone':_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x9a')],'WhatsappAccountId':_0x5d61a4['params']['id']};var _0x172b85={'ContactId':_0xa6d9d4['id'],'WhatsappAccountId':_0x5d61a4[_0xcc1e('0x60')]['id'],'closed':![]};return db[_0xcc1e('0xae')]['find']({'where':_0x172b85})['then'](function(_0x210cf2){if(_0x210cf2){return[_0x210cf2,![]];}return db['WhatsappInteraction']['create'](_0x2597ee)['then'](function(_0x49f7a6){return[_0x49f7a6,!![]];});});}})[_0xcc1e('0x70')](function(_0x2bf7c2,_0x33454f){_0xd55de[_0xcc1e('0xaf')]=_0x2bf7c2[_0xcc1e('0x36')]({'plain':!![]});_0xd55de[_0xcc1e('0xaf')]['created']=![];if(_0x33454f){if(_0xd55de[_0xcc1e('0x85')]['autoclose']){_0xd55de[_0xcc1e('0x8c')]['push']({'id':0x0,'priority':_0xd55de['applications'][_0xcc1e('0x49')]+0x1,'app':_0xcc1e('0xb0'),'appdata':_0xcc1e('0xb1'),'interval':'*,*,*,*'});}_0xd55de[_0xcc1e('0xaf')][_0xcc1e('0xb2')]=!![];}return db[_0xcc1e('0xb3')][_0xcc1e('0x5a')]({'phone':_0xd55de['body'][_0xcc1e('0x9a')],'messageId':_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x9f')],'body':_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0x5b')],'WhatsappAccountId':_0x5d61a4['params']['id'],'WhatsappInteractionId':_0x2bf7c2['id'],'direction':'in','ContactId':_0x2bf7c2['ContactId'],'AttachmentId':_0xd55de[_0xcc1e('0x5b')][_0xcc1e('0xb4')]});})[_0xcc1e('0x21')](function(_0x37d7e5){_0xd55de[_0xcc1e('0x2a')]=_0x37d7e5;if(!_0xd55de[_0xcc1e('0xaf')][_0xcc1e('0xb5')])return;return db[_0xcc1e('0x75')]['find']({'attributes':['id',_0xcc1e('0x39')],'where':{'id':_0xd55de[_0xcc1e('0xaf')]['UserId']}});})[_0xcc1e('0x21')](function(_0xb0317b){if(_0xb0317b){_0xd55de[_0xcc1e('0x8c')][_0xcc1e('0xb6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb0317b[_0xcc1e('0x39')]+','+(_0xd55de['account']['waitForTheAssignedAgent']||0xa),'interval':_0xcc1e('0xb7')});}if(!_0xd55de[_0xcc1e('0xaf')]['queueId'])return;return db[_0xcc1e('0xb8')][_0xcc1e('0x58')]({'attributes':['id',_0xcc1e('0x39')],'where':{'id':_0xd55de['interaction'][_0xcc1e('0xb9')]}});})[_0xcc1e('0x21')](function(_0x342391){if(_0x342391){_0xd55de[_0xcc1e('0x8c')][_0xcc1e('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x342391[_0xcc1e('0x39')]+','+(_0xd55de['account'][_0xcc1e('0xba')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcc1e('0xbb'),_0xcc1e('0xbc'),_0xd55de);})[_0xcc1e('0x21')](function(_0x201f02){if(_0x201f02){var _0x30cc60=0xc8;var _0x2d0f7e=_0xcc1e('0xbd');logger[_0xcc1e('0x22')](_0xcc1e('0x26'),_0x2d0f7e,_0x30cc60,'entity\x20found');logger[_0xcc1e('0x25')](_0xcc1e('0xbe'),_0x2d0f7e,_0x30cc60,'entity\x20found',JSON[_0xcc1e('0x27')](_0x201f02));if(_0xd55de['account'][_0xcc1e('0x86')]==='twilio'){return _0x30a1be['status'](_0x30cc60)[_0xcc1e('0x31')](_0xcc1e('0xbf'),'text/xml')[_0xcc1e('0x3a')](_0xcc1e('0xc0'));}else{return _0x30a1be[_0xcc1e('0x2b')](_0x30cc60)[_0xcc1e('0x2d')](_0x201f02);}}});})[_0xcc1e('0x59')](handleError(_0x30a1be,null));};exports[_0xcc1e('0x3a')]=function(_0x1751c9,_0x55e415,_0x41db6d){var _0x4c1169,_0x386681,_0x18d91;if(_['isNil'](_0x1751c9[_0xcc1e('0x5b')][_0xcc1e('0x5b')])||_0x1751c9[_0xcc1e('0x5b')][_0xcc1e('0x5b')]===''){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0xa5'));}if(_[_0xcc1e('0xa3')](_0x1751c9[_0xcc1e('0x5b')]['to'])){throw new db[(_0xcc1e('0x90'))][(_0xcc1e('0x91'))](_0xcc1e('0xc1'));}_0x4c1169=_0x1751c9[_0xcc1e('0x5b')]['to'];return db['WhatsappAccount'][_0xcc1e('0x58')]({'where':{'id':_0x1751c9[_0xcc1e('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0xcc1e('0xc2'),'include':[{'model':db['CmContact'],'as':_0xcc1e('0xaa'),'where':{'mobile':_0x4c1169},'limit':0x1,'order':[[_0xcc1e('0x95'),_0xcc1e('0xab')]]}]}]})[_0xcc1e('0x21')](handleEntityNotFound(_0x55e415,null))['then'](function(_0x35bc85){if(_0x35bc85&&_0x35bc85[_0xcc1e('0xc2')]){_0x386681=_0x35bc85['get']({'plain':!![]});if(_0x386681[_0xcc1e('0xc2')]&&_0x386681['List']['Contacts']['length']){return _0x386681[_0xcc1e('0xc2')][_0xcc1e('0xaa')][0x0];}return db[_0xcc1e('0x8f')][_0xcc1e('0x5a')](_[_0xcc1e('0xc3')](_0x1751c9[_0xcc1e('0x5b')],{'firstName':_0x4c1169,'mobile':_0x4c1169,'phone':_0x4c1169,'ListId':_0x386681[_0xcc1e('0x97')]}));}})[_0xcc1e('0x21')](handleEntityNotFound(_0x55e415,null))['then'](function(_0x1413a9){if(_0x1413a9){_0x18d91=_0x1413a9;return db[_0xcc1e('0xae')]['find']({'where':{'ContactId':_0x18d91['id'],'closed':![],'WhatsappAccountId':_0x386681['id']}})[_0xcc1e('0x21')](function(_0x140cbe){if(_0x140cbe){return[_0x140cbe,![]];}return db[_0xcc1e('0xae')]['create']({'UserId':_0x1751c9[_0xcc1e('0x5c')]['id'],'ContactId':_0x18d91['id'],'WhatsappAccountId':_0x386681['id'],'phone':_0x4c1169,'firstMsgDirection':_0xcc1e('0xc4'),'Messages':[_[_0xcc1e('0x51')](_0x1751c9[_0xcc1e('0x5b')],{'read':![],'body':_0x1751c9[_0xcc1e('0x5b')]['body'],'phone':_0x4c1169,'WhatsappAccountId':_0x386681['id'],'UserId':_0x1751c9[_0xcc1e('0x5c')]['id'],'ContactId':_0x18d91['id']})]},{'include':[{'model':db[_0xcc1e('0xb3')],'as':_0xcc1e('0xc5')}]})[_0xcc1e('0x21')](function(_0x2b8336){return[_0x2b8336,!![]];});});}})[_0xcc1e('0x70')](function(_0x11489f,_0x558def){if(_0x558def){return _0x11489f;}return db[_0xcc1e('0xb3')][_0xcc1e('0x5a')](_['merge'](_0x1751c9[_0xcc1e('0x5b')],{'read':![],'body':_0x1751c9[_0xcc1e('0x5b')]['body'],'phone':_0x4c1169,'WhatsappAccountId':_0x386681['id'],'WhatsappInteractionId':_0x11489f['id'],'UserId':_0x1751c9['user']['id'],'ContactId':_0x18d91['id']}))[_0xcc1e('0x21')](function(_0x299f50){_0x11489f[_0xcc1e('0xc6')]['Messages']=[];_0x11489f['dataValues'][_0xcc1e('0xc5')][_0xcc1e('0xc7')](_0x299f50['dataValues']);return _0x11489f;});})[_0xcc1e('0x21')](respondWithResult(_0x55e415,null))[_0xcc1e('0x59')](handleError(_0x55e415,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2ed70ba..a32f744 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 _0xb51e=['update','remove','emit','hook','exports','WhatsappAccount','setMaxListeners','save'];(function(_0x69b218,_0x29e70c){var _0xc986ef=function(_0x644821){while(--_0x644821){_0x69b218['push'](_0x69b218['shift']());}};_0xc986ef(++_0x29e70c);}(_0xb51e,0x1d5));var _0xeb51=function(_0x411514,_0x4e9c5f){_0x411514=_0x411514-0x0;var _0x58db58=_0xb51e[_0x411514];return _0x58db58;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xeb51('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xeb51('0x1')](0x0);var events={'afterCreate':_0xeb51('0x2'),'afterUpdate':_0xeb51('0x3'),'afterDestroy':_0xeb51('0x4')};function emitEvent(_0x300038){return function(_0x485c14,_0x20b874,_0x38fde8){WhatsappAccountEvents[_0xeb51('0x5')](_0x300038+':'+_0x485c14['id'],_0x485c14);WhatsappAccountEvents['emit'](_0x300038,_0x485c14);_0x38fde8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xeb51('0x6')](e,emitEvent(event));}}module[_0xeb51('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x19d2=['remove','emit','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x1d6ede,_0x161829){var _0x5e51a2=function(_0x1cd55c){while(--_0x1cd55c){_0x1d6ede['push'](_0x1d6ede['shift']());}};_0x5e51a2(++_0x161829);}(_0x19d2,0x1d3));var _0x219d=function(_0x689c1a,_0x4f41b4){_0x689c1a=_0x689c1a-0x0;var _0x58fe41=_0x19d2[_0x689c1a];return _0x58fe41;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x219d('0x0'))['db'][_0x219d('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x219d('0x2')](0x0);var events={'afterCreate':_0x219d('0x3'),'afterUpdate':_0x219d('0x4'),'afterDestroy':_0x219d('0x5')};function emitEvent(_0x1f4574){return function(_0x496181,_0x2ec0d7,_0x2bbfa9){WhatsappAccountEvents[_0x219d('0x6')](_0x1f4574+':'+_0x496181['id'],_0x496181);WhatsappAccountEvents[_0x219d('0x6')](_0x1f4574,_0x496181);_0x2bbfa9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x219d('0x7')](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 e729a2f..07cc125 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 _0x817e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x19744e,_0x4d9e08){var _0x5608ec=function(_0x5e159d){while(--_0x5e159d){_0x19744e['push'](_0x19744e['shift']());}};_0x5608ec(++_0x4d9e08);}(_0x817e,0x14e));var _0xe817=function(_0x1471f4,_0x426e10){_0x1471f4=_0x1471f4-0x0;var _0x128c00=_0x817e[_0x1471f4];return _0x128c00;};'use strict';var _=require(_0xe817('0x0'));var util=require(_0xe817('0x1'));var logger=require(_0xe817('0x2'))('api');var moment=require(_0xe817('0x3'));var BPromise=require(_0xe817('0x4'));var rp=require(_0xe817('0x5'));var fs=require('fs');var path=require(_0xe817('0x6'));var rimraf=require(_0xe817('0x7'));var config=require(_0xe817('0x8'));var attributes=require(_0xe817('0x9'));module[_0xe817('0xa')]=function(_0x3348d5,_0x5e89a5){return _0x3348d5[_0xe817('0xb')](_0xe817('0xc'),attributes,{'tableName':_0xe817('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d74=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x58db63,_0x2e3e49){var _0x27e5b6=function(_0x21aff6){while(--_0x21aff6){_0x58db63['push'](_0x58db63['shift']());}};_0x27e5b6(++_0x2e3e49);}(_0x3d74,0x149));var _0x43d7=function(_0x5bc5e6,_0x556a49){_0x5bc5e6=_0x5bc5e6-0x0;var _0x1778c7=_0x3d74[_0x5bc5e6];return _0x1778c7;};'use strict';var _=require(_0x43d7('0x0'));var util=require(_0x43d7('0x1'));var logger=require(_0x43d7('0x2'))(_0x43d7('0x3'));var moment=require(_0x43d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x43d7('0x5'));var fs=require('fs');var path=require(_0x43d7('0x6'));var rimraf=require(_0x43d7('0x7'));var config=require(_0x43d7('0x8'));var attributes=require(_0x43d7('0x9'));module['exports']=function(_0x4dbf8e,_0xb266aa){return _0x4dbf8e[_0x43d7('0xa')](_0x43d7('0xb'),attributes,{'tableName':_0x43d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 22c190c..f3d9975 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 _0x37e9=['options','raw','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','request\x20sent','debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x29e397,_0x4c8f1b){var _0x3c7af6=function(_0x2013a7){while(--_0x2013a7){_0x29e397['push'](_0x29e397['shift']());}};_0x3c7af6(++_0x4c8f1b);}(_0x37e9,0x1e7));var _0x937e=function(_0x229bc4,_0x4dca0a){_0x229bc4=_0x229bc4-0x0;var _0x29b4a2=_0x37e9[_0x229bc4];return _0x29b4a2;};'use strict';var _=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var moment=require(_0x937e('0x2'));var BPromise=require(_0x937e('0x3'));var rs=require(_0x937e('0x4'));var fs=require('fs');var Redis=require(_0x937e('0x5'));var db=require(_0x937e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x937e('0x7'))(_0x937e('0x8'));var config=require(_0x937e('0x9'));var jayson=require(_0x937e('0xa'));var client=jayson[_0x937e('0xb')][_0x937e('0xc')]({'port':0x232a});config['redis']=_[_0x937e('0xd')](config[_0x937e('0xe')],{'host':_0x937e('0xf'),'port':0x18eb});var socket=require(_0x937e('0x10'))(new Redis(config[_0x937e('0xe')]));require(_0x937e('0x11'))['register'](socket);function respondWithRpcPromise(_0x4b9059,_0x359f09,_0x1c3a8c){return new BPromise(function(_0x32f562,_0x2f71ed){return client[_0x937e('0x12')](_0x4b9059,_0x1c3a8c)[_0x937e('0x13')](function(_0x490e42){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x359f09,_0x937e('0x14'));logger[_0x937e('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x359f09,_0x937e('0x14'),JSON[_0x937e('0x16')](_0x490e42));if(_0x490e42[_0x937e('0x17')]){if(_0x490e42[_0x937e('0x17')]['code']===0x1f4){logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);return _0x2f71ed(_0x490e42['error'][_0x937e('0x19')]);}logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);return _0x32f562(_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);}else{logger[_0x937e('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x359f09,'request\x20sent');_0x32f562(_0x490e42[_0x937e('0x1b')][_0x937e('0x19')]);}})[_0x937e('0x1c')](function(_0x2c0420){logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x2c0420);_0x2f71ed(_0x2c0420);});});}exports[_0x937e('0x1d')]=function(_0x244109){var _0x456533=this;return new Promise(function(_0x5a8903,_0x25c1e3){return db[_0x937e('0x1e')]['find']({'raw':_0x244109['options']?_0x244109[_0x937e('0x1f')][_0x937e('0x20')]===undefined?!![]:![]:!![],'where':_0x244109['options']?_0x244109[_0x937e('0x1f')]['where']||null:null,'attributes':_0x244109[_0x937e('0x1f')]?_0x244109[_0x937e('0x1f')][_0x937e('0x21')]||null:null,'include':_0x244109[_0x937e('0x1f')]?_0x244109[_0x937e('0x1f')]['include']?_[_0x937e('0x22')](_0x244109[_0x937e('0x1f')][_0x937e('0x23')],function(_0xecae9){return{'model':db[_0xecae9[_0x937e('0x24')]],'as':_0xecae9['as'],'attributes':_0xecae9[_0x937e('0x21')],'include':_0xecae9['include']?_[_0x937e('0x22')](_0xecae9[_0x937e('0x23')],function(_0x2ee185){return{'model':db[_0x2ee185[_0x937e('0x24')]],'as':_0x2ee185['as'],'attributes':_0x2ee185['attributes'],'include':_0x2ee185[_0x937e('0x23')]?_[_0x937e('0x22')](_0x2ee185[_0x937e('0x23')],function(_0x3db336){return{'model':db[_0x3db336[_0x937e('0x24')]],'as':_0x3db336['as'],'attributes':_0x3db336['attributes']};}):[]};}):[]};}):[]:[]})[_0x937e('0x13')](function(_0x380999){logger['info'](_0x937e('0x1d'),_0x244109);logger[_0x937e('0x15')](_0x937e('0x1d'),_0x244109,JSON['stringify'](_0x380999));_0x5a8903(_0x380999);})[_0x937e('0x1c')](function(_0x3f8ac7){logger[_0x937e('0x17')](_0x937e('0x1d'),_0x3f8ac7[_0x937e('0x19')],_0x244109);_0x25c1e3(_0x456533[_0x937e('0x17')](0x1f4,_0x3f8ac7[_0x937e('0x19')]));});});}; \ No newline at end of file +var _0xbc4b=['code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','model','map','attributes','then','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xbc4b,0x1a2));var _0xbbc4=function(_0x21b695,_0x4fcaa6){_0x21b695=_0x21b695-0x0;var _0x51324f=_0xbc4b[_0x21b695];return _0x51324f;};'use strict';var _=require(_0xbbc4('0x0'));var util=require(_0xbbc4('0x1'));var moment=require(_0xbbc4('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbc4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbc4('0x4'))['db'];var utils=require(_0xbbc4('0x5'));var logger=require(_0xbbc4('0x6'))(_0xbbc4('0x7'));var config=require(_0xbbc4('0x8'));var jayson=require(_0xbbc4('0x9'));var client=jayson['client'][_0xbbc4('0xa')]({'port':0x232a});config[_0xbbc4('0xb')]=_[_0xbbc4('0xc')](config['redis'],{'host':_0xbbc4('0xd'),'port':0x18eb});var socket=require(_0xbbc4('0xe'))(new Redis(config[_0xbbc4('0xb')]));require(_0xbbc4('0xf'))[_0xbbc4('0x10')](socket);function respondWithRpcPromise(_0x9a8904,_0xf82780,_0x2decb4){return new BPromise(function(_0x5d3a52,_0x1aab31){return client[_0xbbc4('0x11')](_0x9a8904,_0x2decb4)['then'](function(_0x418ae6){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xf82780,_0xbbc4('0x12'));logger['debug'](_0xbbc4('0x13'),_0xf82780,_0xbbc4('0x12'),JSON[_0xbbc4('0x14')](_0x418ae6));if(_0x418ae6[_0xbbc4('0x15')]){if(_0x418ae6['error'][_0xbbc4('0x16')]===0x1f4){logger[_0xbbc4('0x15')](_0xbbc4('0x17'),_0xf82780,_0x418ae6[_0xbbc4('0x15')][_0xbbc4('0x18')]);return _0x1aab31(_0x418ae6[_0xbbc4('0x15')][_0xbbc4('0x18')]);}logger['error'](_0xbbc4('0x17'),_0xf82780,_0x418ae6['error'][_0xbbc4('0x18')]);return _0x5d3a52(_0x418ae6['error'][_0xbbc4('0x18')]);}else{logger[_0xbbc4('0x19')](_0xbbc4('0x17'),_0xf82780,'request\x20sent');_0x5d3a52(_0x418ae6[_0xbbc4('0x1a')]['message']);}})[_0xbbc4('0x1b')](function(_0x42ce3d){logger['error'](_0xbbc4('0x17'),_0xf82780,_0x42ce3d);_0x1aab31(_0x42ce3d);});});}exports[_0xbbc4('0x1c')]=function(_0x5637ec){var _0x5d0958=this;return new Promise(function(_0x398279,_0x10b184){return db[_0xbbc4('0x1d')][_0xbbc4('0x1e')]({'raw':_0x5637ec[_0xbbc4('0x1f')]?_0x5637ec['options'][_0xbbc4('0x20')]===undefined?!![]:![]:!![],'where':_0x5637ec['options']?_0x5637ec[_0xbbc4('0x1f')][_0xbbc4('0x21')]||null:null,'attributes':_0x5637ec[_0xbbc4('0x1f')]?_0x5637ec[_0xbbc4('0x1f')]['attributes']||null:null,'include':_0x5637ec[_0xbbc4('0x1f')]?_0x5637ec[_0xbbc4('0x1f')]['include']?_['map'](_0x5637ec[_0xbbc4('0x1f')][_0xbbc4('0x22')],function(_0x3280ab){return{'model':db[_0x3280ab[_0xbbc4('0x23')]],'as':_0x3280ab['as'],'attributes':_0x3280ab['attributes'],'include':_0x3280ab[_0xbbc4('0x22')]?_[_0xbbc4('0x24')](_0x3280ab[_0xbbc4('0x22')],function(_0x27d4d6){return{'model':db[_0x27d4d6[_0xbbc4('0x23')]],'as':_0x27d4d6['as'],'attributes':_0x27d4d6[_0xbbc4('0x25')],'include':_0x27d4d6[_0xbbc4('0x22')]?_[_0xbbc4('0x24')](_0x27d4d6[_0xbbc4('0x22')],function(_0x1203a9){return{'model':db[_0x1203a9['model']],'as':_0x1203a9['as'],'attributes':_0x1203a9[_0xbbc4('0x25')]};}):[]};}):[]};}):[]:[]})[_0xbbc4('0x26')](function(_0x14bfac){logger[_0xbbc4('0x19')](_0xbbc4('0x1c'),_0x5637ec);logger[_0xbbc4('0x27')]('ShowWhatsappAccount',_0x5637ec,JSON['stringify'](_0x14bfac));_0x398279(_0x14bfac);})[_0xbbc4('0x1b')](function(_0x345e43){logger[_0xbbc4('0x15')](_0xbbc4('0x1c'),_0x345e43[_0xbbc4('0x18')],_0x5637ec);_0x10b184(_0x5d0958['error'](0x1f4,_0x345e43[_0xbbc4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 0917fa4..5df9c62 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 _0xc361=['register','length','./whatsappAccount.events','save','remove','update','removeListener'];(function(_0x4ca375,_0x18c0fa){var _0x2ae445=function(_0x43b775){while(--_0x43b775){_0x4ca375['push'](_0x4ca375['shift']());}};_0x2ae445(++_0x18c0fa);}(_0xc361,0x113));var _0x1c36=function(_0x3fb875,_0x5b6071){_0x3fb875=_0x3fb875-0x0;var _0x58d97e=_0xc361[_0x3fb875];return _0x58d97e;};'use strict';var WhatsappAccountEvents=require(_0x1c36('0x0'));var events=[_0x1c36('0x1'),_0x1c36('0x2'),_0x1c36('0x3')];function createListener(_0x176c32,_0x238c10){return function(_0x4aff62){_0x238c10['emit'](_0x176c32,_0x4aff62);};}function removeListener(_0x6bfa27,_0x5b508f){return function(){WhatsappAccountEvents[_0x1c36('0x4')](_0x6bfa27,_0x5b508f);};}exports[_0x1c36('0x5')]=function(_0x3e6f0f){for(var _0x81779a=0x0,_0x55e364=events[_0x1c36('0x6')];_0x81779a<_0x55e364;_0x81779a++){var _0xdb4402=events[_0x81779a];var _0x186757=createListener('whatsappAccount:'+_0xdb4402,_0x3e6f0f);WhatsappAccountEvents['on'](_0xdb4402,_0x186757);}}; \ No newline at end of file +var _0xa2cd=['update','emit','removeListener','length','whatsappAccount:'];(function(_0x2ed88f,_0x5bc5ae){var _0x17ca96=function(_0x2be0dc){while(--_0x2be0dc){_0x2ed88f['push'](_0x2ed88f['shift']());}};_0x17ca96(++_0x5bc5ae);}(_0xa2cd,0x104));var _0xda2c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa2cd[_0x138adb];return _0x1b27f2;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save','remove',_0xda2c('0x0')];function createListener(_0x2afc40,_0x18dcf1){return function(_0x25fdbf){_0x18dcf1[_0xda2c('0x1')](_0x2afc40,_0x25fdbf);};}function removeListener(_0x2756bf,_0x4d926c){return function(){WhatsappAccountEvents[_0xda2c('0x2')](_0x2756bf,_0x4d926c);};}exports['register']=function(_0x2a5071){for(var _0x4c9969=0x0,_0x459be7=events[_0xda2c('0x3')];_0x4c9969<_0x459be7;_0x4c9969++){var _0x1feebb=events[_0x4c9969];var _0x3aead3=createListener(_0xda2c('0x4')+_0x1feebb,_0x2a5071);WhatsappAccountEvents['on'](_0x1feebb,_0x3aead3);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 58cfe39..03749b9 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 _0x120d=['isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x120d,0x1e8));var _0xd120=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0x120d[_0x2cbd58];return _0x42ef2a;};'use strict';var multer=require(_0xd120('0x0'));var util=require(_0xd120('0x1'));var path=require(_0xd120('0x2'));var timeout=require(_0xd120('0x3'));var express=require(_0xd120('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd120('0x5'));var config=require(_0xd120('0x6'));var controller=require('./whatsappApplication.controller');router[_0xd120('0x7')]('/',auth[_0xd120('0x8')](),controller[_0xd120('0x9')]);router[_0xd120('0x7')](_0xd120('0xa'),auth[_0xd120('0x8')](),controller[_0xd120('0xb')]);router['post']('/',auth[_0xd120('0x8')](),controller[_0xd120('0xc')]);router['put'](_0xd120('0xa'),auth[_0xd120('0x8')](),controller['update']);router[_0xd120('0xd')](_0xd120('0xa'),auth['isAuthenticated'](),controller[_0xd120('0xe')]);module[_0xd120('0xf')]=router; \ No newline at end of file +var _0x567e=['create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','post'];(function(_0x39d70c,_0x33c8e3){var _0x2cd53c=function(_0x524417){while(--_0x524417){_0x39d70c['push'](_0x39d70c['shift']());}};_0x2cd53c(++_0x33c8e3);}(_0x567e,0x16d));var _0xe567=function(_0x12fa55,_0x4857f5){_0x12fa55=_0x12fa55-0x0;var _0x13fad8=_0x567e[_0x12fa55];return _0x13fad8;};'use strict';var multer=require(_0xe567('0x0'));var util=require(_0xe567('0x1'));var path=require(_0xe567('0x2'));var timeout=require('connect-timeout');var express=require(_0xe567('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe567('0x4'));var interaction=require(_0xe567('0x5'));var config=require(_0xe567('0x6'));var controller=require(_0xe567('0x7'));router[_0xe567('0x8')]('/',auth['isAuthenticated'](),controller[_0xe567('0x9')]);router['get'](_0xe567('0xa'),auth[_0xe567('0xb')](),controller['show']);router[_0xe567('0xc')]('/',auth['isAuthenticated'](),controller[_0xe567('0xd')]);router[_0xe567('0xe')](_0xe567('0xa'),auth[_0xe567('0xb')](),controller[_0xe567('0xf')]);router[_0xe567('0x10')]('/:id',auth[_0xe567('0xb')](),controller['destroy']);module[_0xe567('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 64b4ec1..9c68cbf 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 _0x6318=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1ebd5d,_0x416fc7){var _0x3035e6=function(_0x430098){while(--_0x430098){_0x1ebd5d['push'](_0x1ebd5d['shift']());}};_0x3035e6(++_0x416fc7);}(_0x6318,0x106));var _0x8631=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6318[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x8631('0x0'));module[_0x8631('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8631('0x2')],'allowNull':![],'defaultValue':_0x8631('0x3')},'appdata':{'type':Sequelize[_0x8631('0x4')]()},'description':{'type':Sequelize[_0x8631('0x2')]},'interval':{'type':Sequelize[_0x8631('0x2')],'defaultValue':_0x8631('0x5')}}; \ No newline at end of file +var _0x7482=['TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x7482,0xb2));var _0x2748=function(_0xf60e39,_0x5e008c){_0xf60e39=_0xf60e39-0x0;var _0x4cacb7=_0x7482[_0xf60e39];return _0x4cacb7;};'use strict';var Sequelize=require(_0x2748('0x0'));module[_0x2748('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2748('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2748('0x3')],'defaultValue':_0x2748('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d6fc550..108eedb 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 _0x160c=['limit','set','apply','save','update','then','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count'];(function(_0x27fccc,_0x4ffbdc){var _0x14598d=function(_0x45943c){while(--_0x45943c){_0x27fccc['push'](_0x27fccc['shift']());}};_0x14598d(++_0x4ffbdc);}(_0x160c,0x181));var _0xc160=function(_0x1cdf40,_0xd24a9e){_0x1cdf40=_0x1cdf40-0x0;var _0x1af53b=_0x160c[_0x1cdf40];return _0x1af53b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc160('0x0'));var zipdir=require(_0xc160('0x1'));var jsonpatch=require(_0xc160('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc160('0x3'));var util=require('util');var path=require(_0xc160('0x4'));var sox=require(_0xc160('0x5'));var csv=require(_0xc160('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc160('0x7'));var _=require('lodash');var squel=require(_0xc160('0x8'));var crypto=require('crypto');var jsforce=require(_0xc160('0x9'));var deskjs=require(_0xc160('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc160('0xb'));var Papa=require(_0xc160('0xc'));var Redis=require('ioredis');var authService=require(_0xc160('0xd'));var qs=require(_0xc160('0xe'));var as=require(_0xc160('0xf'));var hardwareService=require(_0xc160('0x10'));var logger=require(_0xc160('0x11'))(_0xc160('0x12'));var utils=require(_0xc160('0x13'));var config=require(_0xc160('0x14'));var licenseUtil=require(_0xc160('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f7be,_0x363817){_0x363817=_0x363817||0xcc;return function(_0x5946ab){if(_0x5946ab){return _0x58f7be[_0xc160('0x16')](_0x363817);}return _0x58f7be[_0xc160('0x17')](_0x363817)[_0xc160('0x18')]();};}function respondWithResult(_0x548660,_0x1c3110){_0x1c3110=_0x1c3110||0xc8;return function(_0x5e1aa7){if(_0x5e1aa7){return _0x548660[_0xc160('0x17')](_0x1c3110)[_0xc160('0x19')](_0x5e1aa7);}};}function respondWithFilteredResult(_0x4c7561,_0x382227){return function(_0x5eb209){if(_0x5eb209){var _0x35f233=typeof _0x382227[_0xc160('0x1a')]===_0xc160('0x1b')&&typeof _0x382227['limit']==='undefined';var _0x1c320d=_0x5eb209[_0xc160('0x1c')];var _0x6120d5=_0x35f233?0x0:_0x382227['offset'];var _0x3b7b55=_0x35f233?_0x5eb209[_0xc160('0x1c')]:_0x382227[_0xc160('0x1a')]+_0x382227[_0xc160('0x1d')];var _0x4cf313;if(_0x3b7b55>=_0x1c320d){_0x3b7b55=_0x1c320d;_0x4cf313=0xc8;}else{_0x4cf313=0xce;}_0x4c7561[_0xc160('0x17')](_0x4cf313);return _0x4c7561[_0xc160('0x1e')]('Content-Range',_0x6120d5+'-'+_0x3b7b55+'/'+_0x1c320d)[_0xc160('0x19')](_0x5eb209);}return null;};}function patchUpdates(_0x3544cb){return function(_0x714d70){try{jsonpatch[_0xc160('0x1f')](_0x714d70,_0x3544cb,!![]);}catch(_0x41bb1e){return BPromise['reject'](_0x41bb1e);}return _0x714d70[_0xc160('0x20')]();};}function saveUpdates(_0x25f5cf,_0x2c99b8){return function(_0x143c18){if(_0x143c18){return _0x143c18[_0xc160('0x21')](_0x25f5cf)[_0xc160('0x22')](function(_0x2804ad){return _0x2804ad;});}return null;};}function removeEntity(_0x11f8c8,_0x417ac1){return function(_0x432a48){if(_0x432a48){return _0x432a48['destroy']()['then'](function(){_0x11f8c8[_0xc160('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d235e,_0x63d33d){return function(_0x2d5d3f){if(!_0x2d5d3f){_0x7d235e['sendStatus'](0x194);}return _0x2d5d3f;};}function handleError(_0x46e33f,_0xda5e6d){_0xda5e6d=_0xda5e6d||0x1f4;return function(_0x2542f1){logger[_0xc160('0x23')](_0x2542f1[_0xc160('0x24')]);if(_0x2542f1['name']){delete _0x2542f1[_0xc160('0x25')];}_0x46e33f[_0xc160('0x17')](_0xda5e6d)[_0xc160('0x26')](_0x2542f1);};}exports[_0xc160('0x27')]=function(_0xa10de0,_0x33a490){var _0x2e16ad={},_0x56a004={},_0xd1aab9={'count':0x0,'rows':[]};var _0x395857=_[_0xc160('0x28')](db['WhatsappApplication']['rawAttributes'],function(_0x44930d){return{'name':_0x44930d['fieldName'],'type':_0x44930d[_0xc160('0x29')][_0xc160('0x2a')]};});_0x56a004[_0xc160('0x2b')]=_['map'](_0x395857,'name');_0x56a004['query']=_['keys'](_0xa10de0[_0xc160('0x2c')]);_0x56a004[_0xc160('0x2d')]=_[_0xc160('0x2e')](_0x56a004['model'],_0x56a004[_0xc160('0x2c')]);_0x2e16ad['attributes']=_['intersection'](_0x56a004[_0xc160('0x2b')],qs[_0xc160('0x2f')](_0xa10de0['query'][_0xc160('0x2f')]));_0x2e16ad[_0xc160('0x30')]=_0x2e16ad[_0xc160('0x30')][_0xc160('0x31')]?_0x2e16ad[_0xc160('0x30')]:_0x56a004[_0xc160('0x2b')];if(!_0xa10de0[_0xc160('0x2c')]['hasOwnProperty']('nolimit')){_0x2e16ad[_0xc160('0x1d')]=qs['limit'](_0xa10de0[_0xc160('0x2c')][_0xc160('0x1d')]);_0x2e16ad[_0xc160('0x1a')]=qs[_0xc160('0x1a')](_0xa10de0[_0xc160('0x2c')]['offset']);}_0x2e16ad['order']=qs[_0xc160('0x32')](_0xa10de0[_0xc160('0x2c')][_0xc160('0x32')]);_0x2e16ad[_0xc160('0x33')]=qs['filters'](_['pick'](_0xa10de0['query'],_0x56a004[_0xc160('0x2d')]),_0x395857);if(_0xa10de0[_0xc160('0x2c')][_0xc160('0x34')]){_0x2e16ad[_0xc160('0x33')]=_['merge'](_0x2e16ad[_0xc160('0x33')],{'$or':_[_0xc160('0x28')](_0x395857,function(_0x503824){if(_0x503824[_0xc160('0x29')]!=='VIRTUAL'){var _0x1b6371={};_0x1b6371[_0x503824['name']]={'$like':'%'+_0xa10de0[_0xc160('0x2c')][_0xc160('0x34')]+'%'};return _0x1b6371;}})});}_0x2e16ad=_[_0xc160('0x35')]({},_0x2e16ad,_0xa10de0[_0xc160('0x36')]);var _0xa11aab={'where':_0x2e16ad['where']};return db[_0xc160('0x37')][_0xc160('0x1c')](_0xa11aab)[_0xc160('0x22')](function(_0x38fb34){_0xd1aab9[_0xc160('0x1c')]=_0x38fb34;if(_0xa10de0[_0xc160('0x2c')][_0xc160('0x38')]){_0x2e16ad[_0xc160('0x39')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xc160('0x3a')](_0x2e16ad);})[_0xc160('0x22')](function(_0x5c3c26){_0xd1aab9[_0xc160('0x3b')]=_0x5c3c26;return _0xd1aab9;})[_0xc160('0x22')](respondWithFilteredResult(_0x33a490,_0x2e16ad))[_0xc160('0x3c')](handleError(_0x33a490,null));};exports[_0xc160('0x3d')]=function(_0x38387f,_0x22bcbc){var _0x2b8727={'raw':!![],'where':{'id':_0x38387f[_0xc160('0x3e')]['id']}},_0x499d70={};_0x499d70[_0xc160('0x2b')]=_[_0xc160('0x3f')](db[_0xc160('0x37')][_0xc160('0x40')]);_0x499d70['query']=_['keys'](_0x38387f[_0xc160('0x2c')]);_0x499d70[_0xc160('0x2d')]=_['intersection'](_0x499d70['model'],_0x499d70[_0xc160('0x2c')]);_0x2b8727[_0xc160('0x30')]=_['intersection'](_0x499d70[_0xc160('0x2b')],qs[_0xc160('0x2f')](_0x38387f[_0xc160('0x2c')][_0xc160('0x2f')]));_0x2b8727['attributes']=_0x2b8727[_0xc160('0x30')][_0xc160('0x31')]?_0x2b8727[_0xc160('0x30')]:_0x499d70[_0xc160('0x2b')];if(_0x38387f[_0xc160('0x2c')]['includeAll']){_0x2b8727['include']=[{'all':!![]}];}_0x2b8727=_[_0xc160('0x35')]({},_0x2b8727,_0x38387f[_0xc160('0x36')]);return db[_0xc160('0x37')][_0xc160('0x41')](_0x2b8727)[_0xc160('0x22')](handleEntityNotFound(_0x22bcbc,null))['then'](respondWithResult(_0x22bcbc,null))['catch'](handleError(_0x22bcbc,null));};exports[_0xc160('0x42')]=function(_0x38d6d9,_0x188b24){return db[_0xc160('0x37')][_0xc160('0x42')](_0x38d6d9[_0xc160('0x43')],{})[_0xc160('0x22')](respondWithResult(_0x188b24,0xc9))['catch'](handleError(_0x188b24,null));};exports[_0xc160('0x21')]=function(_0x3fa809,_0x254d3b){if(_0x3fa809[_0xc160('0x43')]['id']){delete _0x3fa809[_0xc160('0x43')]['id'];}return db['WhatsappApplication'][_0xc160('0x41')]({'where':{'id':_0x3fa809['params']['id']}})[_0xc160('0x22')](handleEntityNotFound(_0x254d3b,null))[_0xc160('0x22')](saveUpdates(_0x3fa809[_0xc160('0x43')],null))['then'](respondWithResult(_0x254d3b,null))['catch'](handleError(_0x254d3b,null));};exports[_0xc160('0x44')]=function(_0x2b1af5,_0x3be62e){return db[_0xc160('0x37')][_0xc160('0x41')]({'where':{'id':_0x2b1af5[_0xc160('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3be62e,null))[_0xc160('0x22')](removeEntity(_0x3be62e,null))[_0xc160('0x3c')](handleError(_0x3be62e,null));}; \ No newline at end of file +var _0x3588=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','length','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x491fed,_0x5a4781){var _0x197049=function(_0x3e4f2b){while(--_0x3e4f2b){_0x491fed['push'](_0x491fed['shift']());}};_0x197049(++_0x5a4781);}(_0x3588,0x82));var _0x8358=function(_0x5d7299,_0x544bc0){_0x5d7299=_0x5d7299-0x0;var _0x3125ea=_0x3588[_0x5d7299];return _0x3125ea;};'use strict';var emlformat=require(_0x8358('0x0'));var rimraf=require(_0x8358('0x1'));var zipdir=require(_0x8358('0x2'));var jsonpatch=require(_0x8358('0x3'));var rp=require(_0x8358('0x4'));var moment=require(_0x8358('0x5'));var BPromise=require(_0x8358('0x6'));var Mustache=require('mustache');var util=require(_0x8358('0x7'));var path=require(_0x8358('0x8'));var sox=require(_0x8358('0x9'));var csv=require(_0x8358('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8358('0xb'));var _=require(_0x8358('0xc'));var squel=require('squel');var crypto=require(_0x8358('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8358('0xe'));var toCsv=require(_0x8358('0xa'));var querystring=require(_0x8358('0xf'));var Papa=require(_0x8358('0x10'));var Redis=require('ioredis');var authService=require(_0x8358('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8358('0x12'));var hardwareService=require(_0x8358('0x13'));var logger=require(_0x8358('0x14'))(_0x8358('0x15'));var utils=require(_0x8358('0x16'));var config=require(_0x8358('0x17'));var licenseUtil=require(_0x8358('0x18'));var db=require(_0x8358('0x19'))['db'];function respondWithStatusCode(_0x3cf276,_0x2c2aeb){_0x2c2aeb=_0x2c2aeb||0xcc;return function(_0x213d5e){if(_0x213d5e){return _0x3cf276[_0x8358('0x1a')](_0x2c2aeb);}return _0x3cf276[_0x8358('0x1b')](_0x2c2aeb)[_0x8358('0x1c')]();};}function respondWithResult(_0xda422b,_0x317ea0){_0x317ea0=_0x317ea0||0xc8;return function(_0x51d21d){if(_0x51d21d){return _0xda422b['status'](_0x317ea0)[_0x8358('0x1d')](_0x51d21d);}};}function respondWithFilteredResult(_0x4bad9c,_0x19da0b){return function(_0x4f412a){if(_0x4f412a){var _0x585969=typeof _0x19da0b['offset']===_0x8358('0x1e')&&typeof _0x19da0b[_0x8358('0x1f')]===_0x8358('0x1e');var _0x366a2b=_0x4f412a[_0x8358('0x20')];var _0x27a21d=_0x585969?0x0:_0x19da0b[_0x8358('0x21')];var _0x524bfb=_0x585969?_0x4f412a[_0x8358('0x20')]:_0x19da0b[_0x8358('0x21')]+_0x19da0b['limit'];var _0x31038d;if(_0x524bfb>=_0x366a2b){_0x524bfb=_0x366a2b;_0x31038d=0xc8;}else{_0x31038d=0xce;}_0x4bad9c[_0x8358('0x1b')](_0x31038d);return _0x4bad9c[_0x8358('0x22')](_0x8358('0x23'),_0x27a21d+'-'+_0x524bfb+'/'+_0x366a2b)['json'](_0x4f412a);}return null;};}function patchUpdates(_0x56d435){return function(_0x19e667){try{jsonpatch[_0x8358('0x24')](_0x19e667,_0x56d435,!![]);}catch(_0x45ae60){return BPromise['reject'](_0x45ae60);}return _0x19e667['save']();};}function saveUpdates(_0x1330b5,_0x528ce8){return function(_0x218537){if(_0x218537){return _0x218537[_0x8358('0x25')](_0x1330b5)[_0x8358('0x26')](function(_0x21e9ad){return _0x21e9ad;});}return null;};}function removeEntity(_0x25d82a,_0x3675c3){return function(_0x1ae76d){if(_0x1ae76d){return _0x1ae76d['destroy']()[_0x8358('0x26')](function(){_0x25d82a['status'](0xcc)[_0x8358('0x1c')]();});}};}function handleEntityNotFound(_0x5d8317,_0x248d2f){return function(_0x1beaa7){if(!_0x1beaa7){_0x5d8317[_0x8358('0x1a')](0x194);}return _0x1beaa7;};}function handleError(_0x542499,_0x153e02){_0x153e02=_0x153e02||0x1f4;return function(_0x37a172){logger[_0x8358('0x27')](_0x37a172[_0x8358('0x28')]);if(_0x37a172[_0x8358('0x29')]){delete _0x37a172[_0x8358('0x29')];}_0x542499[_0x8358('0x1b')](_0x153e02)['send'](_0x37a172);};}exports[_0x8358('0x2a')]=function(_0x3921bc,_0x334443){var _0x458eb9={},_0x460d5c={},_0x1c1987={'count':0x0,'rows':[]};var _0x79b688=_[_0x8358('0x2b')](db[_0x8358('0x2c')][_0x8358('0x2d')],function(_0x340b39){return{'name':_0x340b39[_0x8358('0x2e')],'type':_0x340b39[_0x8358('0x2f')]['key']};});_0x460d5c[_0x8358('0x30')]=_['map'](_0x79b688,'name');_0x460d5c[_0x8358('0x31')]=_[_0x8358('0x32')](_0x3921bc[_0x8358('0x31')]);_0x460d5c[_0x8358('0x33')]=_['intersection'](_0x460d5c[_0x8358('0x30')],_0x460d5c[_0x8358('0x31')]);_0x458eb9[_0x8358('0x34')]=_['intersection'](_0x460d5c[_0x8358('0x30')],qs[_0x8358('0x35')](_0x3921bc[_0x8358('0x31')][_0x8358('0x35')]));_0x458eb9['attributes']=_0x458eb9[_0x8358('0x34')]['length']?_0x458eb9[_0x8358('0x34')]:_0x460d5c[_0x8358('0x30')];if(!_0x3921bc[_0x8358('0x31')][_0x8358('0x36')](_0x8358('0x37'))){_0x458eb9[_0x8358('0x1f')]=qs[_0x8358('0x1f')](_0x3921bc[_0x8358('0x31')][_0x8358('0x1f')]);_0x458eb9[_0x8358('0x21')]=qs[_0x8358('0x21')](_0x3921bc['query']['offset']);}_0x458eb9[_0x8358('0x38')]=qs[_0x8358('0x39')](_0x3921bc[_0x8358('0x31')][_0x8358('0x39')]);_0x458eb9['where']=qs[_0x8358('0x33')](_[_0x8358('0x3a')](_0x3921bc[_0x8358('0x31')],_0x460d5c[_0x8358('0x33')]),_0x79b688);if(_0x3921bc[_0x8358('0x31')][_0x8358('0x3b')]){_0x458eb9[_0x8358('0x3c')]=_['merge'](_0x458eb9[_0x8358('0x3c')],{'$or':_[_0x8358('0x2b')](_0x79b688,function(_0x546d2e){if(_0x546d2e[_0x8358('0x2f')]!==_0x8358('0x3d')){var _0x26ef7c={};_0x26ef7c[_0x546d2e[_0x8358('0x29')]]={'$like':'%'+_0x3921bc['query'][_0x8358('0x3b')]+'%'};return _0x26ef7c;}})});}_0x458eb9=_[_0x8358('0x3e')]({},_0x458eb9,_0x3921bc[_0x8358('0x3f')]);var _0x5b047a={'where':_0x458eb9[_0x8358('0x3c')]};return db[_0x8358('0x2c')][_0x8358('0x20')](_0x5b047a)[_0x8358('0x26')](function(_0x2c2a27){_0x1c1987['count']=_0x2c2a27;if(_0x3921bc['query'][_0x8358('0x40')]){_0x458eb9['include']=[{'all':!![]}];}return db[_0x8358('0x2c')]['findAll'](_0x458eb9);})['then'](function(_0x2a0a8a){_0x1c1987[_0x8358('0x41')]=_0x2a0a8a;return _0x1c1987;})[_0x8358('0x26')](respondWithFilteredResult(_0x334443,_0x458eb9))[_0x8358('0x42')](handleError(_0x334443,null));};exports[_0x8358('0x43')]=function(_0x106778,_0x2cd23f){var _0x32334f={'raw':!![],'where':{'id':_0x106778['params']['id']}},_0x59272f={};_0x59272f['model']=_[_0x8358('0x32')](db[_0x8358('0x2c')]['rawAttributes']);_0x59272f[_0x8358('0x31')]=_[_0x8358('0x32')](_0x106778[_0x8358('0x31')]);_0x59272f[_0x8358('0x33')]=_['intersection'](_0x59272f[_0x8358('0x30')],_0x59272f['query']);_0x32334f[_0x8358('0x34')]=_['intersection'](_0x59272f[_0x8358('0x30')],qs[_0x8358('0x35')](_0x106778[_0x8358('0x31')]['fields']));_0x32334f[_0x8358('0x34')]=_0x32334f[_0x8358('0x34')][_0x8358('0x44')]?_0x32334f[_0x8358('0x34')]:_0x59272f['model'];if(_0x106778['query']['includeAll']){_0x32334f['include']=[{'all':!![]}];}_0x32334f=_[_0x8358('0x3e')]({},_0x32334f,_0x106778[_0x8358('0x3f')]);return db[_0x8358('0x2c')][_0x8358('0x45')](_0x32334f)[_0x8358('0x26')](handleEntityNotFound(_0x2cd23f,null))[_0x8358('0x26')](respondWithResult(_0x2cd23f,null))['catch'](handleError(_0x2cd23f,null));};exports[_0x8358('0x46')]=function(_0x3e906d,_0x3664cb){return db[_0x8358('0x2c')][_0x8358('0x46')](_0x3e906d[_0x8358('0x47')],{})[_0x8358('0x26')](respondWithResult(_0x3664cb,0xc9))[_0x8358('0x42')](handleError(_0x3664cb,null));};exports['update']=function(_0x467fbc,_0x2da39c){if(_0x467fbc['body']['id']){delete _0x467fbc['body']['id'];}return db[_0x8358('0x2c')]['find']({'where':{'id':_0x467fbc[_0x8358('0x48')]['id']}})[_0x8358('0x26')](handleEntityNotFound(_0x2da39c,null))[_0x8358('0x26')](saveUpdates(_0x467fbc[_0x8358('0x47')],null))[_0x8358('0x26')](respondWithResult(_0x2da39c,null))[_0x8358('0x42')](handleError(_0x2da39c,null));};exports[_0x8358('0x49')]=function(_0x134144,_0x57e15f){return db[_0x8358('0x2c')][_0x8358('0x45')]({'where':{'id':_0x134144[_0x8358('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e15f,null))[_0x8358('0x26')](removeEntity(_0x57e15f,null))[_0x8358('0x42')](handleError(_0x57e15f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9aaf784..141ef50 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 _0xc73e=['util','api','moment','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x339781,_0xe299e9){var _0x5cfb6a=function(_0x37f3de){while(--_0x37f3de){_0x339781['push'](_0x339781['shift']());}};_0x5cfb6a(++_0xe299e9);}(_0xc73e,0x1e9));var _0xec73=function(_0x2e028d,_0x5dcc0f){_0x2e028d=_0x2e028d-0x0;var _0x5c88b3=_0xc73e[_0x2e028d];return _0x5c88b3;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('WhatsappApplication',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec73('0x9')});}; \ No newline at end of file +var _0xf120=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci'];(function(_0x31e531,_0x5dae1a){var _0x5920d5=function(_0x38a54a){while(--_0x38a54a){_0x31e531['push'](_0x31e531['shift']());}};_0x5920d5(++_0x5dae1a);}(_0xf120,0x179));var _0x0f12=function(_0x1775d3,_0x4e178f){_0x1775d3=_0x1775d3-0x0;var _0x2c9a3c=_0xf120[_0x1775d3];return _0x2c9a3c;};'use strict';var _=require('lodash');var util=require(_0x0f12('0x0'));var logger=require(_0x0f12('0x1'))(_0x0f12('0x2'));var moment=require('moment');var BPromise=require(_0x0f12('0x3'));var rp=require(_0x0f12('0x4'));var fs=require('fs');var path=require(_0x0f12('0x5'));var rimraf=require('rimraf');var config=require(_0x0f12('0x6'));var attributes=require(_0x0f12('0x7'));module[_0x0f12('0x8')]=function(_0x308941,_0x21f951){return _0x308941[_0x0f12('0x9')](_0x0f12('0xa'),attributes,{'tableName':_0x0f12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0f12('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ca7265c..72c7beb 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 _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x4860e7,_0xf0b5a){var _0x242420=function(_0x199991){while(--_0x199991){_0x4860e7['push'](_0x4860e7['shift']());}};_0x242420(++_0xf0b5a);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x24e7b0,_0x23104f){_0x24e7b0=_0x24e7b0-0x0;var _0x1b09a1=_0xd0bb[_0x24e7b0];return _0x1b09a1;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file +var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x6953bc,_0x1c64c0){var _0x59bfbe=function(_0x2a7f64){while(--_0x2a7f64){_0x6953bc['push'](_0x6953bc['shift']());}};_0x59bfbe(++_0x1c64c0);}(_0xb821,0xa7));var _0x1b82=function(_0x1cf4ba,_0x53f8d7){_0x1cf4ba=_0x1cf4ba-0x0;var _0x409fa8=_0xb821[_0x1cf4ba];return _0x409fa8;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1e84273..a4fa475 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 _0xe944=['whatsapp','whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xe944,0x174));var _0x4e94=function(_0x4a51aa,_0x54acad){_0x4a51aa=_0x4a51aa-0x0;var _0x9ddd5b=_0xe944[_0x4a51aa];return _0x9ddd5b;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e94('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e94('0x3'));var controller=require(_0x4e94('0x4'));router[_0x4e94('0x5')]('/',auth[_0x4e94('0x6')](),controller['index']);router[_0x4e94('0x5')](_0x4e94('0x7'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x8')]);router['get'](_0x4e94('0x9'),auth['isAuthenticated'](),controller[_0x4e94('0xa')]);router[_0x4e94('0x5')](_0x4e94('0xb'),auth[_0x4e94('0x6')](),controller['getMessages']);router[_0x4e94('0x5')](_0x4e94('0xc'),auth[_0x4e94('0x6')](),controller[_0x4e94('0xd')]);router[_0x4e94('0xe')]('/',auth[_0x4e94('0x6')](),controller[_0x4e94('0xf')]);router['post']('/:id/messages',auth[_0x4e94('0x6')](),controller[_0x4e94('0x10')]);router[_0x4e94('0xe')](_0x4e94('0x11'),auth[_0x4e94('0x6')](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x13')),controller[_0x4e94('0x14')]);router[_0x4e94('0x15')](_0x4e94('0x9'),auth[_0x4e94('0x6')](),interaction[_0x4e94('0x16')](_0x4e94('0x12'),_0x4e94('0x17')),controller[_0x4e94('0x18')]);router[_0x4e94('0x19')](_0x4e94('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x1a')),controller[_0x4e94('0x1b')]);router[_0x4e94('0x19')](_0x4e94('0x11'),auth['isAuthenticated'](),controller[_0x4e94('0x1c')]);module[_0x4e94('0x1d')]=router; \ No newline at end of file +var _0x6657=['/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe'];(function(_0x483ec7,_0x5a113b){var _0xd8a699=function(_0x1e1d21){while(--_0x1e1d21){_0x483ec7['push'](_0x483ec7['shift']());}};_0xd8a699(++_0x5a113b);}(_0x6657,0x17f));var _0x7665=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x6657[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x7665('0x0'));var util=require('util');var path=require(_0x7665('0x1'));var timeout=require(_0x7665('0x2'));var express=require(_0x7665('0x3'));var router=express[_0x7665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7665('0x5'));var interaction=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var controller=require(_0x7665('0x8'));router[_0x7665('0x9')]('/',auth[_0x7665('0xa')](),controller[_0x7665('0xb')]);router[_0x7665('0x9')]('/describe',auth[_0x7665('0xa')](),controller[_0x7665('0xc')]);router[_0x7665('0x9')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0xe')]);router[_0x7665('0x9')](_0x7665('0xf'),auth['isAuthenticated'](),controller[_0x7665('0x10')]);router[_0x7665('0x9')](_0x7665('0x11'),auth['isAuthenticated'](),controller[_0x7665('0x12')]);router['post']('/',auth[_0x7665('0xa')](),controller[_0x7665('0x13')]);router['post'](_0x7665('0xf'),auth[_0x7665('0xa')](),controller['addMessage']);router[_0x7665('0x14')](_0x7665('0x15'),auth['isAuthenticated'](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x18')),controller[_0x7665('0x19')]);router[_0x7665('0x1a')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),_0x7665('0x1b')),controller[_0x7665('0x1c')]);router[_0x7665('0x1d')](_0x7665('0xd'),auth[_0x7665('0xa')](),interaction[_0x7665('0x16')](_0x7665('0x17'),'whatsappinteraction:destroy'),controller[_0x7665('0x1e')]);router[_0x7665('0x1d')]('/:id/tags',auth[_0x7665('0xa')](),controller[_0x7665('0x1f')]);module[_0x7665('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 5140128..a8e76d5 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 _0x1b0e=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x1b0e,0x132));var _0xe1b0=function(_0x5397c5,_0x290189){_0x5397c5=_0x5397c5-0x0;var _0x324589=_0x1b0e[_0x5397c5];return _0x324589;};'use strict';var Sequelize=require(_0xe1b0('0x0'));var moment=require(_0xe1b0('0x1'));module[_0xe1b0('0x2')]={'closed':{'type':Sequelize[_0xe1b0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe1b0('0x4')]},'disposition':{'type':Sequelize[_0xe1b0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe1b0('0x5')]},'phone':{'type':Sequelize[_0xe1b0('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe1b0('0x6')]('in',_0xe1b0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe1b0('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe1b0('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe1b0('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe2ab=['exports','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize','moment'];(function(_0xfc6247,_0x5cbddb){var _0x291245=function(_0x41d7ba){while(--_0x41d7ba){_0xfc6247['push'](_0xfc6247['shift']());}};_0x291245(++_0x5cbddb);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xe2ab[_0x470f24];return _0x2c6fc8;};'use strict';var Sequelize=require(_0xbe2a('0x0'));var moment=require(_0xbe2a('0x1'));module[_0xbe2a('0x2')]={'closed':{'type':Sequelize[_0xbe2a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbe2a('0x4')]},'disposition':{'type':Sequelize[_0xbe2a('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbe2a('0x5')]},'note':{'type':Sequelize[_0xbe2a('0x5')]},'phone':{'type':Sequelize[_0xbe2a('0x5')]},'read1stAt':{'type':Sequelize[_0xbe2a('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbe2a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbe2a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbe2a('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xbe2a('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index cece9bb..9565ba5 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 _0x82a1=['files','tmp','join','server','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Owner','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','out','System','secret','value','renderFile','views','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','findAll','whatsapp','query','user','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','merge','options','find','body','describe','WhatsappMessage','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','includeAll','include','rows','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','download','unix','toString','root'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x82a1,0xa3));var _0x182a=function(_0x4f6141,_0x22930f){_0x4f6141=_0x4f6141-0x0;var _0x15f73c=_0x82a1[_0x4f6141];return _0x15f73c;};'use strict';var rimraf=require(_0x182a('0x0'));var zipdir=require(_0x182a('0x1'));var moment=require(_0x182a('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x182a('0x3'));var ejs=require(_0x182a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x182a('0x5'));var qs=require(_0x182a('0x6'));var pdf=require(_0x182a('0x7'));var logger=require(_0x182a('0x8'))('api');var config=require('../../config/environment');var db=require(_0x182a('0x9'))['db'];config[_0x182a('0xa')]=_[_0x182a('0xb')](config[_0x182a('0xa')],{'host':_0x182a('0xc'),'port':0x18eb});var socket=require(_0x182a('0xd'))(new Redis(config[_0x182a('0xa')]));require('./whatsappInteraction.socket')[_0x182a('0xe')](socket);function respondWithStatusCode(_0x28b18f,_0x200662){_0x200662=_0x200662||0xcc;return function(_0x157b29){if(_0x157b29){return _0x28b18f[_0x182a('0xf')](_0x200662);}return _0x28b18f[_0x182a('0x10')](_0x200662)[_0x182a('0x11')]();};}function respondWithResult(_0x3fd410,_0x966034){_0x966034=_0x966034||0xc8;return function(_0x5d2804){if(_0x5d2804){return _0x3fd410[_0x182a('0x10')](_0x966034)['json'](_0x5d2804);}};}function respondWithFilteredResult(_0x29a694,_0x132cb0){return function(_0x1e1a75){if(_0x1e1a75){var _0xe3b597=typeof _0x132cb0[_0x182a('0x12')]===_0x182a('0x13')&&typeof _0x132cb0[_0x182a('0x14')]==='undefined';var _0x1ac1da=_0x1e1a75[_0x182a('0x15')];var _0x385a22=_0xe3b597?0x0:_0x132cb0[_0x182a('0x12')];var _0x530939=_0xe3b597?_0x1e1a75[_0x182a('0x15')]:_0x132cb0['offset']+_0x132cb0['limit'];var _0x3e7c73;if(_0x530939>=_0x1ac1da){_0x530939=_0x1ac1da;_0x3e7c73=0xc8;}else{_0x3e7c73=0xce;}_0x29a694[_0x182a('0x10')](_0x3e7c73);return _0x29a694['set'](_0x182a('0x16'),_0x385a22+'-'+_0x530939+'/'+_0x1ac1da)[_0x182a('0x17')](_0x1e1a75);}return null;};}function saveUpdates(_0x243743){return function(_0x4853f8){if(_0x4853f8){return _0x4853f8[_0x182a('0x18')](_0x243743)[_0x182a('0x19')](function(_0x4b3233){return _0x4b3233;});}return null;};}function removeEntity(_0xf7a40){return function(_0x21b50f){if(_0x21b50f){return _0x21b50f[_0x182a('0x1a')]()[_0x182a('0x19')](function(){_0xf7a40['status'](0xcc)[_0x182a('0x11')]();});}};}function handleEntityNotFound(_0x4e41fb){return function(_0xf63702){if(!_0xf63702){_0x4e41fb['sendStatus'](0x194);}return _0xf63702;};}function handleError(_0x2bf3f8,_0x4378c4){_0x4378c4=_0x4378c4||0x1f4;return function(_0x3012ab){logger[_0x182a('0x1b')](_0x3012ab[_0x182a('0x1c')]);if(_0x3012ab[_0x182a('0x1d')]){delete _0x3012ab[_0x182a('0x1d')];}_0x2bf3f8[_0x182a('0x10')](_0x4378c4)[_0x182a('0x1e')](_0x3012ab);};}exports[_0x182a('0x1f')]=function(_0xf5e624,_0x2b33f8){var _0x5ed13f={};var _0x4ace1b=_[_0x182a('0x20')](db[_0x182a('0x21')]['rawAttributes'],function(_0x1bbda8){return{'name':_0x1bbda8[_0x182a('0x22')],'type':_0x1bbda8[_0x182a('0x23')][_0x182a('0x24')]};});_0x5ed13f=qs['getOptions'](_0x4ace1b,_0xf5e624);return interaction[_0x182a('0x25')](_0x182a('0x26'),_0xf5e624[_0x182a('0x27')],_0xf5e624[_0x182a('0x28')],_0x5ed13f,_0x4ace1b)[_0x182a('0x19')](respondWithFilteredResult(_0x2b33f8,_0x5ed13f))[_0x182a('0x29')](handleError(_0x2b33f8,null));};exports['show']=function(_0x3495cf,_0x5eab81){var _0x5f2eef={'raw':![],'where':{'id':_0x3495cf[_0x182a('0x2a')]['id']}},_0x29acdc={};_0x29acdc[_0x182a('0x2b')]=_[_0x182a('0x2c')](db['WhatsappInteraction'][_0x182a('0x2d')]);_0x29acdc['query']=_[_0x182a('0x2c')](_0x3495cf[_0x182a('0x27')]);_0x29acdc[_0x182a('0x2e')]=_[_0x182a('0x2f')](_0x29acdc[_0x182a('0x2b')],_0x29acdc['query']);_0x5f2eef[_0x182a('0x30')]=_[_0x182a('0x2f')](_0x29acdc[_0x182a('0x2b')],qs[_0x182a('0x31')](_0x3495cf[_0x182a('0x27')][_0x182a('0x31')]));_0x5f2eef[_0x182a('0x30')]=_0x5f2eef[_0x182a('0x30')][_0x182a('0x32')]?_0x5f2eef['attributes']:_0x29acdc[_0x182a('0x2b')];if(_0x3495cf[_0x182a('0x27')]['includeAll']){_0x5f2eef['include']=[{'all':!![]}];}_0x5f2eef=_[_0x182a('0x33')]({},_0x5f2eef,_0x3495cf[_0x182a('0x34')]);return db[_0x182a('0x21')][_0x182a('0x35')](_0x5f2eef)[_0x182a('0x19')](handleEntityNotFound(_0x5eab81,null))[_0x182a('0x19')](respondWithResult(_0x5eab81,null))[_0x182a('0x29')](handleError(_0x5eab81,null));};exports['create']=function(_0x4e7f3f,_0x3e80b6){return db[_0x182a('0x21')]['create'](_0x4e7f3f['body'],{})[_0x182a('0x19')](respondWithResult(_0x3e80b6,0xc9))['catch'](handleError(_0x3e80b6,null));};exports[_0x182a('0x18')]=function(_0x34605c,_0x194198){if(_0x34605c[_0x182a('0x36')]['id']){delete _0x34605c[_0x182a('0x36')]['id'];}return db['WhatsappInteraction'][_0x182a('0x35')]({'where':{'id':_0x34605c['params']['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x194198,null))[_0x182a('0x19')](saveUpdates(_0x34605c[_0x182a('0x36')],null))['then'](respondWithResult(_0x194198,null))[_0x182a('0x29')](handleError(_0x194198,null));};exports['destroy']=function(_0x2bdef0,_0x104174){return db[_0x182a('0x21')]['find']({'where':{'id':_0x2bdef0[_0x182a('0x2a')]['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x104174,null))[_0x182a('0x19')](removeEntity(_0x104174,null))[_0x182a('0x29')](handleError(_0x104174,null));};exports[_0x182a('0x37')]=function(_0x38b050,_0x5a8ab3){return db['WhatsappInteraction'][_0x182a('0x37')]()[_0x182a('0x19')](respondWithResult(_0x5a8ab3,null))[_0x182a('0x29')](handleError(_0x5a8ab3,null));};exports['addMessage']=function(_0x583ce3,_0x420ed0){return db[_0x182a('0x38')][_0x182a('0x35')]({'where':{'id':_0x583ce3[_0x182a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x420ed0,null))[_0x182a('0x19')](function(_0x5ab8ef){if(_0x5ab8ef){return _0x5ab8ef[_0x182a('0x39')](_0x583ce3[_0x182a('0x36')][_0x182a('0x3a')],_['omit'](_0x583ce3['body'],[_0x182a('0x3a'),'id'])||{});}})[_0x182a('0x19')](respondWithResult(_0x420ed0,null))[_0x182a('0x29')](handleError(_0x420ed0,null));};exports[_0x182a('0x3b')]=function(_0x4f8cfe,_0x3acb96){var _0x259100={'raw':![],'where':{}};var _0x2ebfe9={};var _0x42f218={'count':0x0,'rows':[]};return db[_0x182a('0x21')]['findOne']({'where':{'id':_0x4f8cfe[_0x182a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3acb96,null))[_0x182a('0x19')](function(_0xac715d){if(_0xac715d){_0x2ebfe9[_0x182a('0x2b')]=_['keys'](db[_0x182a('0x38')]['rawAttributes']);_0x2ebfe9[_0x182a('0x27')]=_[_0x182a('0x2c')](_0x4f8cfe[_0x182a('0x27')]);_0x2ebfe9[_0x182a('0x2e')]=_[_0x182a('0x2f')](_0x2ebfe9[_0x182a('0x2b')],_0x2ebfe9[_0x182a('0x27')]);_0x259100[_0x182a('0x30')]=_[_0x182a('0x2f')](_0x2ebfe9[_0x182a('0x2b')],qs[_0x182a('0x31')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x31')]));_0x259100[_0x182a('0x30')]=_0x259100[_0x182a('0x30')][_0x182a('0x32')]?_0x259100['attributes']:_0x2ebfe9[_0x182a('0x2b')];if(!_0x4f8cfe[_0x182a('0x27')][_0x182a('0x3c')](_0x182a('0x3d'))){_0x259100['limit']=qs['limit'](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x14')]);_0x259100['offset']=qs[_0x182a('0x12')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x12')]);}_0x259100[_0x182a('0x3e')]=qs[_0x182a('0x3f')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x3f')]);_0x259100[_0x182a('0x40')]=qs[_0x182a('0x2e')](_[_0x182a('0x41')](_0x4f8cfe[_0x182a('0x27')],_0x2ebfe9[_0x182a('0x2e')]));_0x259100[_0x182a('0x40')]['WhatsappInteractionId']=_0xac715d['id'];if(_0x4f8cfe['query']['filter']){_0x259100[_0x182a('0x40')]=_[_0x182a('0x33')](_0x259100['where'],{'$or':_['map'](_0x259100[_0x182a('0x30')],function(_0x58e84e){var _0x22ea85={};_0x22ea85[_0x58e84e]={'$like':'%'+_0x4f8cfe[_0x182a('0x27')][_0x182a('0x42')]+'%'};return _0x22ea85;})});}if(_0x4f8cfe[_0x182a('0x27')]['$gte']){var _0x7d63ff=_0x4f8cfe[_0x182a('0x27')][_0x182a('0x43')][_0x182a('0x44')](',');var _0x19b6c4={};_0x19b6c4[_0x7d63ff[0x0]]={'$gte':moment(_0x7d63ff[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x259100[_0x182a('0x40')]=_[_0x182a('0x33')](_0x259100[_0x182a('0x40')],_0x19b6c4);}_0x259100=_[_0x182a('0x33')]({},_0x259100,_0x4f8cfe[_0x182a('0x34')]);return db[_0x182a('0x38')][_0x182a('0x15')]({'where':_0x259100[_0x182a('0x40')]})['then'](function(_0x4cf2a9){_0x42f218[_0x182a('0x15')]=_0x4cf2a9;if(_0x4f8cfe[_0x182a('0x27')][_0x182a('0x45')]){_0x259100[_0x182a('0x46')]=[{'all':!![]}];}return db[_0x182a('0x38')]['findAll'](_0x259100);})[_0x182a('0x19')](function(_0x3c08ca){_0x42f218[_0x182a('0x47')]=_0x3c08ca;return _0x42f218;});}})['then'](respondWithFilteredResult(_0x3acb96,_0x259100))[_0x182a('0x29')](handleError(_0x3acb96,null));};exports[_0x182a('0x48')]=function(_0x308fb0,_0xb5106f){return db[_0x182a('0x21')][_0x182a('0x35')]({'where':{'id':_0x308fb0['params']['id']}})[_0x182a('0x19')](handleEntityNotFound(_0xb5106f,null))[_0x182a('0x19')](function(_0x4df351){if(_0x4df351){return _0x4df351[_0x182a('0x49')](_0x308fb0['body'][_0x182a('0x3a')],_[_0x182a('0x4a')](_0x308fb0[_0x182a('0x36')],['ids','id'])||{})[_0x182a('0x4b')](function(){return db[_0x182a('0x4c')][_0x182a('0x25')]({'attributes':['id',_0x182a('0x1d'),'color'],'where':{'id':_0x308fb0[_0x182a('0x36')][_0x182a('0x3a')]}});})[_0x182a('0x19')](function(_0x2cf03f){socket[_0x182a('0x4d')](_0x182a('0x4e'),{'id':Number(_0x308fb0['params']['id']),'tags':_0x2cf03f||[]});return{'id':Number(_0x308fb0['params']['id']),'tags':_0x2cf03f||[]};});}})[_0x182a('0x19')](respondWithResult(_0xb5106f,null))[_0x182a('0x29')](handleError(_0xb5106f,null));};exports['removeTags']=function(_0x1b1242,_0x5e5ff8){return db['WhatsappInteraction'][_0x182a('0x35')]({'where':{'id':_0x1b1242[_0x182a('0x2a')]['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x5e5ff8,null))[_0x182a('0x19')](function(_0x5d4322){if(_0x5d4322){return _0x5d4322['removeTags'](_0x1b1242[_0x182a('0x27')][_0x182a('0x3a')]);}})['then'](respondWithStatusCode(_0x5e5ff8,null))[_0x182a('0x29')](handleError(_0x5e5ff8,null));};exports[_0x182a('0x4f')]=function(_0x51cfe5,_0x4d2943){var _0x37bdd5=moment()[_0x182a('0x50')]()[_0x182a('0x51')]();var _0xa1d111=path['join'](config[_0x182a('0x52')],'server',_0x182a('0x53'),_0x182a('0x54'));var _0x276416=path[_0x182a('0x55')](config[_0x182a('0x52')],_0x182a('0x56'),_0x182a('0x53'),_0x182a('0x57'));var _0x1a844a=path[_0x182a('0x55')](_0xa1d111,_0x37bdd5);var _0x3500db=util[_0x182a('0x58')](_0x182a('0x59'),_0x51cfe5[_0x182a('0x2a')]['id'],_0x37bdd5);var _0x30af6e=path[_0x182a('0x55')](_0xa1d111,_0x3500db);var _0x505792=[];_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x5b')],'as':_0x182a('0x5b'),'attributes':['id',_0x182a('0x5c')],'raw':!![]});_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x5d')],'as':_0x182a('0x5e'),'attributes':['id',_0x182a('0x5f'),_0x182a('0x60')],'raw':!![]});if(_0x51cfe5[_0x182a('0x27')][_0x182a('0x57')]){_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x61')],'as':'Attachment','raw':!![]});}var _0x1fa0ac=[{'model':db[_0x182a('0x38')],'as':_0x182a('0x62'),'attributes':['id','body',_0x182a('0x63'),_0x182a('0x64'),'secret',_0x182a('0x65')],'include':_0x505792}];_0x1fa0ac['push']({'model':db[_0x182a('0x66')],'as':'Account','attributes':['id','name']});_0x1fa0ac['push']({'model':db[_0x182a('0x5b')],'as':_0x182a('0x67'),'attributes':['id','fullname']});return db[_0x182a('0x21')]['find']({'where':{'id':_0x51cfe5['params']['id']},'include':_0x1fa0ac})[_0x182a('0x19')](handleEntityNotFound(_0x4d2943,null))[_0x182a('0x19')](function(_0x2dad21){if(_0x2dad21){var _0x451c95=_0x2dad21['get']({'plain':!![]});fs['mkdirSync'](_0x1a844a);var _0x37a6d6={'channel':'Whatsapp','account':_0x451c95[_0x182a('0x68')]['name'],'agent':_0x451c95['Owner']?_0x451c95[_0x182a('0x67')]['fullname']:_0x182a('0x69'),'createdAt':moment(_0x451c95['createdAt'])[_0x182a('0x58')](_0x182a('0x6a'))[_0x182a('0x51')](),'closedAt':_0x451c95[_0x182a('0x6b')]?moment(_0x451c95[_0x182a('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x182a('0x51')]():'','disposition':_0x451c95['disposition'],'messages':_(_0x451c95[_0x182a('0x62')])[_0x182a('0x42')]({'secret':![]})[_0x182a('0x20')](function(_0x3045b1){if(_0x3045b1[_0x182a('0x61')]){var _0x5467d1=path[_0x182a('0x55')](_0x276416,_0x3045b1['Attachment'][_0x182a('0x6d')]);if(fs[_0x182a('0x6e')](_0x5467d1)){fs[_0x182a('0x6f')](_0x5467d1)['pipe'](fs['createWriteStream'](path[_0x182a('0x55')](_0x1a844a,_0x3045b1[_0x182a('0x61')]['basename'])));}}return{'date':moment(_0x3045b1[_0x182a('0x63')])[_0x182a('0x58')](_0x182a('0x6a'))[_0x182a('0x51')](),'sender':_0x3045b1[_0x182a('0x64')]===_0x182a('0x70')?_0x3045b1[_0x182a('0x5b')]?_0x3045b1['User'][_0x182a('0x5c')]:_0x182a('0x71'):_0x3045b1['Contact'][_0x182a('0x5f')]+(_0x3045b1['Contact'][_0x182a('0x60')]?'\x20'+_0x3045b1[_0x182a('0x5e')]['lastName']:''),'body':_0x3045b1[_0x182a('0x61')]?_0x3045b1[_0x182a('0x61')][_0x182a('0x6d')]:_0x3045b1['body'],'direction':_0x3045b1['direction']===_0x182a('0x70')?'A':'C','secret':_0x3045b1[_0x182a('0x72')],'read':_0x3045b1[_0x182a('0x65')],'attachment':_0x3045b1[_0x182a('0x61')]};})[_0x182a('0x73')]()};return ejs[_0x182a('0x74')](path[_0x182a('0x55')](config[_0x182a('0x52')],_0x182a('0x56'),_0x182a('0x75'),'downloadInteraction.ejs'),{'interaction':_0x37a6d6})['then'](function(_0x2db1ca){var _0x4c035c=path[_0x182a('0x55')](_0x1a844a,'transcript-'+_0x451c95['id']+'-'+_0x37bdd5+_0x182a('0x76'));var _0x1d91b1={'path':_0x4c035c,'channel':_0x182a('0x77'),'interactionId':_0x451c95['id']};return pdf[_0x182a('0x78')](_0x2db1ca,_0x1d91b1);})[_0x182a('0x19')](function(){return new BPromise(function(_0x1a80ab,_0x7936d9){zipdir(_0x1a844a,{'saveTo':_0x30af6e},function(_0x406960,_0x3ba60a){if(_0x406960)return _0x7936d9(_0x406960);return _0x1a80ab(_0x3ba60a);});})[_0x182a('0x19')](function(){return new BPromise(function(_0x4a7c73,_0x3e6f08){rimraf(_0x1a844a,function(_0x2c0a62){if(_0x2c0a62)_0x3e6f08(_0x2c0a62);return _0x4a7c73();});});})[_0x182a('0x19')](function(){return _0x4d2943[_0x182a('0x4f')](_0x30af6e,_0x3500db,function(_0x3158a2){if(_0x3158a2){console[_0x182a('0x79')]('err',_0x3158a2);}else{fs[_0x182a('0x7a')](_0x30af6e);}});});});}else{return _0x4d2943[_0x182a('0xf')](0xc8);}})[_0x182a('0x29')](handleError(_0x4d2943,null));}; \ No newline at end of file +var _0x1c70=['type','key','getOptions','findAll','whatsapp','query','user','catch','params','model','keys','rawAttributes','filters','intersection','fields','attributes','include','merge','options','WhatsappInteraction','find','create','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','secret','read','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','stack','name','send','index','map','fieldName'];(function(_0x593d56,_0x10d793){var _0xb1c92c=function(_0x25f720){while(--_0x25f720){_0x593d56['push'](_0x593d56['shift']());}};_0xb1c92c(++_0x10d793);}(_0x1c70,0xe3));var _0x01c7=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0x1c70[_0x20c809];return _0x1064a1;};'use strict';var rimraf=require(_0x01c7('0x0'));var zipdir=require(_0x01c7('0x1'));var moment=require(_0x01c7('0x2'));var BPromise=require(_0x01c7('0x3'));var util=require(_0x01c7('0x4'));var path=require(_0x01c7('0x5'));var ejs=require(_0x01c7('0x6'));var fs=require('fs');var _=require(_0x01c7('0x7'));var Redis=require('ioredis');var interaction=require(_0x01c7('0x8'));var qs=require(_0x01c7('0x9'));var pdf=require(_0x01c7('0xa'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x01c7('0xb')]=_[_0x01c7('0xc')](config[_0x01c7('0xb')],{'host':_0x01c7('0xd'),'port':0x18eb});var socket=require(_0x01c7('0xe'))(new Redis(config[_0x01c7('0xb')]));require(_0x01c7('0xf'))['register'](socket);function respondWithStatusCode(_0x4ad06d,_0x2e9988){_0x2e9988=_0x2e9988||0xcc;return function(_0x5e285d){if(_0x5e285d){return _0x4ad06d[_0x01c7('0x10')](_0x2e9988);}return _0x4ad06d[_0x01c7('0x11')](_0x2e9988)[_0x01c7('0x12')]();};}function respondWithResult(_0x320e01,_0x156b40){_0x156b40=_0x156b40||0xc8;return function(_0x58ca7f){if(_0x58ca7f){return _0x320e01[_0x01c7('0x11')](_0x156b40)['json'](_0x58ca7f);}};}function respondWithFilteredResult(_0x44a9a8,_0x357cf7){return function(_0x386eff){if(_0x386eff){var _0x1c0e7a=typeof _0x357cf7['offset']===_0x01c7('0x13')&&typeof _0x357cf7['limit']===_0x01c7('0x13');var _0x47dcac=_0x386eff[_0x01c7('0x14')];var _0x5d4025=_0x1c0e7a?0x0:_0x357cf7['offset'];var _0x3ad6db=_0x1c0e7a?_0x386eff[_0x01c7('0x14')]:_0x357cf7[_0x01c7('0x15')]+_0x357cf7[_0x01c7('0x16')];var _0x5a745a;if(_0x3ad6db>=_0x47dcac){_0x3ad6db=_0x47dcac;_0x5a745a=0xc8;}else{_0x5a745a=0xce;}_0x44a9a8[_0x01c7('0x11')](_0x5a745a);return _0x44a9a8[_0x01c7('0x17')](_0x01c7('0x18'),_0x5d4025+'-'+_0x3ad6db+'/'+_0x47dcac)[_0x01c7('0x19')](_0x386eff);}return null;};}function saveUpdates(_0x2b1c02){return function(_0x4edf89){if(_0x4edf89){return _0x4edf89[_0x01c7('0x1a')](_0x2b1c02)[_0x01c7('0x1b')](function(_0x54656c){return _0x54656c;});}return null;};}function removeEntity(_0x1fbd20){return function(_0x58408c){if(_0x58408c){return _0x58408c[_0x01c7('0x1c')]()[_0x01c7('0x1b')](function(){_0x1fbd20[_0x01c7('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8883){return function(_0x4690a6){if(!_0x4690a6){_0x2c8883[_0x01c7('0x10')](0x194);}return _0x4690a6;};}function handleError(_0x1a0dc1,_0x372274){_0x372274=_0x372274||0x1f4;return function(_0x1d5a4d){logger['error'](_0x1d5a4d[_0x01c7('0x1d')]);if(_0x1d5a4d[_0x01c7('0x1e')]){delete _0x1d5a4d['name'];}_0x1a0dc1[_0x01c7('0x11')](_0x372274)[_0x01c7('0x1f')](_0x1d5a4d);};}exports[_0x01c7('0x20')]=function(_0x4814b2,_0xb40a98){var _0x104bcb={};var _0x327d4c=_[_0x01c7('0x21')](db['WhatsappInteraction']['rawAttributes'],function(_0x38c5ac){return{'name':_0x38c5ac[_0x01c7('0x22')],'type':_0x38c5ac[_0x01c7('0x23')][_0x01c7('0x24')]};});_0x104bcb=qs[_0x01c7('0x25')](_0x327d4c,_0x4814b2);return interaction[_0x01c7('0x26')](_0x01c7('0x27'),_0x4814b2[_0x01c7('0x28')],_0x4814b2[_0x01c7('0x29')],_0x104bcb,_0x327d4c)[_0x01c7('0x1b')](respondWithFilteredResult(_0xb40a98,_0x104bcb))[_0x01c7('0x2a')](handleError(_0xb40a98,null));};exports['show']=function(_0x13d993,_0x1c591e){var _0x50a51a={'raw':![],'where':{'id':_0x13d993[_0x01c7('0x2b')]['id']}},_0x337712={};_0x337712[_0x01c7('0x2c')]=_[_0x01c7('0x2d')](db['WhatsappInteraction'][_0x01c7('0x2e')]);_0x337712['query']=_[_0x01c7('0x2d')](_0x13d993[_0x01c7('0x28')]);_0x337712[_0x01c7('0x2f')]=_[_0x01c7('0x30')](_0x337712[_0x01c7('0x2c')],_0x337712[_0x01c7('0x28')]);_0x50a51a['attributes']=_[_0x01c7('0x30')](_0x337712[_0x01c7('0x2c')],qs[_0x01c7('0x31')](_0x13d993[_0x01c7('0x28')][_0x01c7('0x31')]));_0x50a51a[_0x01c7('0x32')]=_0x50a51a[_0x01c7('0x32')]['length']?_0x50a51a[_0x01c7('0x32')]:_0x337712[_0x01c7('0x2c')];if(_0x13d993[_0x01c7('0x28')]['includeAll']){_0x50a51a[_0x01c7('0x33')]=[{'all':!![]}];}_0x50a51a=_[_0x01c7('0x34')]({},_0x50a51a,_0x13d993[_0x01c7('0x35')]);return db[_0x01c7('0x36')][_0x01c7('0x37')](_0x50a51a)[_0x01c7('0x1b')](handleEntityNotFound(_0x1c591e,null))[_0x01c7('0x1b')](respondWithResult(_0x1c591e,null))[_0x01c7('0x2a')](handleError(_0x1c591e,null));};exports[_0x01c7('0x38')]=function(_0x516ba9,_0x56bdac){return db[_0x01c7('0x36')][_0x01c7('0x38')](_0x516ba9[_0x01c7('0x39')],{})[_0x01c7('0x1b')](respondWithResult(_0x56bdac,0xc9))[_0x01c7('0x2a')](handleError(_0x56bdac,null));};exports[_0x01c7('0x1a')]=function(_0x468a62,_0x5cdf1a){if(_0x468a62['body']['id']){delete _0x468a62[_0x01c7('0x39')]['id'];}return db[_0x01c7('0x36')][_0x01c7('0x37')]({'where':{'id':_0x468a62[_0x01c7('0x2b')]['id']}})[_0x01c7('0x1b')](handleEntityNotFound(_0x5cdf1a,null))[_0x01c7('0x1b')](saveUpdates(_0x468a62[_0x01c7('0x39')],null))['then'](respondWithResult(_0x5cdf1a,null))[_0x01c7('0x2a')](handleError(_0x5cdf1a,null));};exports[_0x01c7('0x1c')]=function(_0x2a89b1,_0xa27b69){return db['WhatsappInteraction'][_0x01c7('0x37')]({'where':{'id':_0x2a89b1['params']['id']}})['then'](handleEntityNotFound(_0xa27b69,null))[_0x01c7('0x1b')](removeEntity(_0xa27b69,null))[_0x01c7('0x2a')](handleError(_0xa27b69,null));};exports[_0x01c7('0x3a')]=function(_0x61f6ac,_0x599ed8){return db[_0x01c7('0x36')][_0x01c7('0x3a')]()[_0x01c7('0x1b')](respondWithResult(_0x599ed8,null))[_0x01c7('0x2a')](handleError(_0x599ed8,null));};exports[_0x01c7('0x3b')]=function(_0x25d16b,_0x13510d){return db[_0x01c7('0x3c')]['find']({'where':{'id':_0x25d16b['params']['id']}})[_0x01c7('0x1b')](handleEntityNotFound(_0x13510d,null))['then'](function(_0x35a3d1){if(_0x35a3d1){return _0x35a3d1[_0x01c7('0x3b')](_0x25d16b[_0x01c7('0x39')]['ids'],_[_0x01c7('0x3d')](_0x25d16b[_0x01c7('0x39')],[_0x01c7('0x3e'),'id'])||{});}})[_0x01c7('0x1b')](respondWithResult(_0x13510d,null))[_0x01c7('0x2a')](handleError(_0x13510d,null));};exports[_0x01c7('0x3f')]=function(_0x2f0c36,_0x83e392){var _0x139630={'raw':![],'where':{}};var _0x59cdb6={};var _0x417024={'count':0x0,'rows':[]};return db[_0x01c7('0x36')][_0x01c7('0x40')]({'where':{'id':_0x2f0c36['params']['id']}})[_0x01c7('0x1b')](handleEntityNotFound(_0x83e392,null))[_0x01c7('0x1b')](function(_0x544292){if(_0x544292){_0x59cdb6[_0x01c7('0x2c')]=_[_0x01c7('0x2d')](db[_0x01c7('0x3c')]['rawAttributes']);_0x59cdb6[_0x01c7('0x28')]=_['keys'](_0x2f0c36['query']);_0x59cdb6[_0x01c7('0x2f')]=_[_0x01c7('0x30')](_0x59cdb6[_0x01c7('0x2c')],_0x59cdb6['query']);_0x139630[_0x01c7('0x32')]=_[_0x01c7('0x30')](_0x59cdb6['model'],qs[_0x01c7('0x31')](_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x31')]));_0x139630['attributes']=_0x139630['attributes']['length']?_0x139630['attributes']:_0x59cdb6[_0x01c7('0x2c')];if(!_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x41')](_0x01c7('0x42'))){_0x139630[_0x01c7('0x16')]=qs[_0x01c7('0x16')](_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x16')]);_0x139630[_0x01c7('0x15')]=qs['offset'](_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x15')]);}_0x139630[_0x01c7('0x43')]=qs[_0x01c7('0x44')](_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x44')]);_0x139630[_0x01c7('0x45')]=qs[_0x01c7('0x2f')](_['pick'](_0x2f0c36[_0x01c7('0x28')],_0x59cdb6[_0x01c7('0x2f')]));_0x139630[_0x01c7('0x45')][_0x01c7('0x46')]=_0x544292['id'];if(_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x47')]){_0x139630['where']=_['merge'](_0x139630[_0x01c7('0x45')],{'$or':_[_0x01c7('0x21')](_0x139630[_0x01c7('0x32')],function(_0x55c7e7){var _0x1c34f5={};_0x1c34f5[_0x55c7e7]={'$like':'%'+_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x47')]+'%'};return _0x1c34f5;})});}if(_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x48')]){var _0x2244cb=_0x2f0c36[_0x01c7('0x28')][_0x01c7('0x48')]['split'](',');var _0x4613b4={};_0x4613b4[_0x2244cb[0x0]]={'$gte':moment(_0x2244cb[0x1])[_0x01c7('0x49')](_0x01c7('0x4a'))};_0x139630[_0x01c7('0x45')]=_[_0x01c7('0x34')](_0x139630[_0x01c7('0x45')],_0x4613b4);}_0x139630=_['merge']({},_0x139630,_0x2f0c36[_0x01c7('0x35')]);return db[_0x01c7('0x3c')][_0x01c7('0x14')]({'where':_0x139630[_0x01c7('0x45')]})['then'](function(_0x385316){_0x417024[_0x01c7('0x14')]=_0x385316;if(_0x2f0c36['query']['includeAll']){_0x139630['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x01c7('0x26')](_0x139630);})['then'](function(_0x1af870){_0x417024[_0x01c7('0x4b')]=_0x1af870;return _0x417024;});}})['then'](respondWithFilteredResult(_0x83e392,_0x139630))[_0x01c7('0x2a')](handleError(_0x83e392,null));};exports[_0x01c7('0x4c')]=function(_0x26338d,_0x1c286b){return db[_0x01c7('0x36')][_0x01c7('0x37')]({'where':{'id':_0x26338d[_0x01c7('0x2b')]['id']}})[_0x01c7('0x1b')](handleEntityNotFound(_0x1c286b,null))[_0x01c7('0x1b')](function(_0x824f97){if(_0x824f97){return _0x824f97[_0x01c7('0x4d')](_0x26338d[_0x01c7('0x39')][_0x01c7('0x3e')],_[_0x01c7('0x3d')](_0x26338d[_0x01c7('0x39')],['ids','id'])||{})[_0x01c7('0x4e')](function(){return db['Tag'][_0x01c7('0x26')]({'attributes':['id',_0x01c7('0x1e'),_0x01c7('0x4f')],'where':{'id':_0x26338d['body'][_0x01c7('0x3e')]}});})[_0x01c7('0x1b')](function(_0x48e66f){socket[_0x01c7('0x50')](_0x01c7('0x51'),{'id':Number(_0x26338d[_0x01c7('0x2b')]['id']),'tags':_0x48e66f||[]});return{'id':Number(_0x26338d['params']['id']),'tags':_0x48e66f||[]};});}})[_0x01c7('0x1b')](respondWithResult(_0x1c286b,null))[_0x01c7('0x2a')](handleError(_0x1c286b,null));};exports[_0x01c7('0x52')]=function(_0x4ce27b,_0x5f043c){return db['WhatsappInteraction'][_0x01c7('0x37')]({'where':{'id':_0x4ce27b[_0x01c7('0x2b')]['id']}})[_0x01c7('0x1b')](handleEntityNotFound(_0x5f043c,null))[_0x01c7('0x1b')](function(_0x38e470){if(_0x38e470){return _0x38e470[_0x01c7('0x52')](_0x4ce27b[_0x01c7('0x28')]['ids']);}})[_0x01c7('0x1b')](respondWithStatusCode(_0x5f043c,null))[_0x01c7('0x2a')](handleError(_0x5f043c,null));};exports[_0x01c7('0x53')]=function(_0x5c19a6,_0x104641){var _0x5d9c68=moment()[_0x01c7('0x54')]()[_0x01c7('0x55')]();var _0x9985a=path[_0x01c7('0x56')](config[_0x01c7('0x57')],_0x01c7('0x58'),_0x01c7('0x59'),_0x01c7('0x5a'));var _0x2818ac=path['join'](config[_0x01c7('0x57')],_0x01c7('0x58'),_0x01c7('0x59'),_0x01c7('0x5b'));var _0x447070=path['join'](_0x9985a,_0x5d9c68);var _0x253cf3=util[_0x01c7('0x49')](_0x01c7('0x5c'),_0x5c19a6[_0x01c7('0x2b')]['id'],_0x5d9c68);var _0x1146dd=path[_0x01c7('0x56')](_0x9985a,_0x253cf3);var _0xebbd1e=[];_0xebbd1e[_0x01c7('0x5d')]({'model':db[_0x01c7('0x5e')],'as':_0x01c7('0x5e'),'attributes':['id',_0x01c7('0x5f')],'raw':!![]});_0xebbd1e['push']({'model':db[_0x01c7('0x60')],'as':'Contact','attributes':['id',_0x01c7('0x61'),_0x01c7('0x62')],'raw':!![]});if(_0x5c19a6[_0x01c7('0x28')][_0x01c7('0x5b')]){_0xebbd1e[_0x01c7('0x5d')]({'model':db[_0x01c7('0x63')],'as':_0x01c7('0x63'),'raw':!![]});}var _0x3bdea0=[{'model':db[_0x01c7('0x3c')],'as':_0x01c7('0x64'),'attributes':['id','body',_0x01c7('0x65'),_0x01c7('0x66'),'secret','read'],'include':_0xebbd1e}];_0x3bdea0['push']({'model':db[_0x01c7('0x67')],'as':_0x01c7('0x68'),'attributes':['id','name']});_0x3bdea0[_0x01c7('0x5d')]({'model':db[_0x01c7('0x5e')],'as':'Owner','attributes':['id',_0x01c7('0x5f')]});return db[_0x01c7('0x36')][_0x01c7('0x37')]({'where':{'id':_0x5c19a6['params']['id']},'include':_0x3bdea0})[_0x01c7('0x1b')](handleEntityNotFound(_0x104641,null))['then'](function(_0x18a4f9){if(_0x18a4f9){var _0x574ee9=_0x18a4f9[_0x01c7('0x69')]({'plain':!![]});fs[_0x01c7('0x6a')](_0x447070);var _0xce7ba8={'channel':_0x01c7('0x6b'),'account':_0x574ee9[_0x01c7('0x68')][_0x01c7('0x1e')],'agent':_0x574ee9[_0x01c7('0x6c')]?_0x574ee9['Owner'][_0x01c7('0x5f')]:_0x01c7('0x6d'),'createdAt':moment(_0x574ee9['createdAt'])[_0x01c7('0x49')](_0x01c7('0x4a'))['toString'](),'closedAt':_0x574ee9[_0x01c7('0x6e')]?moment(_0x574ee9[_0x01c7('0x6f')])[_0x01c7('0x49')](_0x01c7('0x4a'))[_0x01c7('0x55')]():'','disposition':_0x574ee9[_0x01c7('0x70')],'messages':_(_0x574ee9[_0x01c7('0x64')])[_0x01c7('0x47')]({'secret':![]})[_0x01c7('0x21')](function(_0x32271a){if(_0x32271a['Attachment']){var _0x29bb23=path[_0x01c7('0x56')](_0x2818ac,_0x32271a[_0x01c7('0x63')][_0x01c7('0x71')]);if(fs[_0x01c7('0x72')](_0x29bb23)){fs[_0x01c7('0x73')](_0x29bb23)[_0x01c7('0x74')](fs[_0x01c7('0x75')](path['join'](_0x447070,_0x32271a[_0x01c7('0x63')][_0x01c7('0x71')])));}}return{'date':moment(_0x32271a[_0x01c7('0x65')])[_0x01c7('0x49')](_0x01c7('0x4a'))[_0x01c7('0x55')](),'sender':_0x32271a[_0x01c7('0x66')]===_0x01c7('0x76')?_0x32271a['User']?_0x32271a[_0x01c7('0x5e')][_0x01c7('0x5f')]:_0x01c7('0x77'):_0x32271a['Contact'][_0x01c7('0x61')]+(_0x32271a[_0x01c7('0x78')][_0x01c7('0x62')]?'\x20'+_0x32271a[_0x01c7('0x78')][_0x01c7('0x62')]:''),'body':_0x32271a[_0x01c7('0x63')]?_0x32271a[_0x01c7('0x63')][_0x01c7('0x71')]:_0x32271a[_0x01c7('0x39')],'direction':_0x32271a[_0x01c7('0x66')]==='out'?'A':'C','secret':_0x32271a[_0x01c7('0x79')],'read':_0x32271a[_0x01c7('0x7a')],'attachment':_0x32271a[_0x01c7('0x63')]};})[_0x01c7('0x7b')]()};return ejs[_0x01c7('0x7c')](path[_0x01c7('0x56')](config[_0x01c7('0x57')],_0x01c7('0x58'),'views',_0x01c7('0x7d')),{'interaction':_0xce7ba8})[_0x01c7('0x1b')](function(_0x3070cf){var _0x3d83b7=path[_0x01c7('0x56')](_0x447070,_0x01c7('0x7e')+_0x574ee9['id']+'-'+_0x5d9c68+_0x01c7('0x7f'));var _0x554d74={'path':_0x3d83b7,'channel':'Whatsapp','interactionId':_0x574ee9['id']};return pdf[_0x01c7('0x80')](_0x3070cf,_0x554d74);})[_0x01c7('0x1b')](function(){return new BPromise(function(_0x247d26,_0x4366ca){zipdir(_0x447070,{'saveTo':_0x1146dd},function(_0xba00b2,_0x469432){if(_0xba00b2)return _0x4366ca(_0xba00b2);return _0x247d26(_0x469432);});})[_0x01c7('0x1b')](function(){return new BPromise(function(_0x42d056,_0x197b95){rimraf(_0x447070,function(_0x56e935){if(_0x56e935)_0x197b95(_0x56e935);return _0x42d056();});});})[_0x01c7('0x1b')](function(){return _0x104641[_0x01c7('0x53')](_0x1146dd,_0x253cf3,function(_0x43137e){if(_0x43137e){console[_0x01c7('0x81')]('err',_0x43137e);}else{fs[_0x01c7('0x82')](_0x1146dd);}});});});}else{return _0x104641[_0x01c7('0x10')](0xc8);}})['catch'](handleError(_0x104641,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 08f9762..d437426 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 _0x94d2=['save','getUsers','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x152999,_0x1dd83b){var _0x32ef67=function(_0xe8dc18){while(--_0xe8dc18){_0x152999['push'](_0x152999['shift']());}};_0x32ef67(++_0x1dd83b);}(_0x94d2,0x1cd));var _0x294d=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x94d2[_0x23be51];return _0x47a26d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x294d('0x0')];var WhatsappMessage=require(_0x294d('0x1'))['db'][_0x294d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x294d('0x3')](0x0);var events={'afterCreate':_0x294d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f2fc8){return function(_0x393430,_0xb2c63a,_0x234700){_0x393430[_0x294d('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c3d7c){_0x393430[_0x294d('0x6')](_0x294d('0x7'),_0x5c3d7c[_0x294d('0x8')](function(_0x3066ae){return{'id':_0x3066ae['id']};}));return WhatsappMessage[_0x294d('0x9')]({'where':{'WhatsappInteractionId':_0x393430['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x7931bb){_0x393430[_0x294d('0x6')]('unreadMessages',_0x7931bb[_0x294d('0xa')]);WhatsappInteractionEvents[_0x294d('0xb')](_0x2f2fc8+':'+_0x393430['id'],_0x393430);WhatsappInteractionEvents['emit'](_0x2f2fc8,_0x393430);_0x234700(null);})['catch'](_0x234700(null));};}for(var e in events){if(events[_0x294d('0xc')](e)){var event=events[e];WhatsappInteraction[_0x294d('0xd')](e,emitEvent(event));}}module[_0x294d('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6599=['update','getUsers','setDataValue','Users','then','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x37c01d,_0x9a740){var _0x45f66a=function(_0x37eac0){while(--_0x37eac0){_0x37c01d['push'](_0x37c01d['shift']());}};_0x45f66a(++_0x9a740);}(_0x6599,0xb0));var _0x9659=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x6599[_0x4fa489];return _0x41d2ce;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9659('0x0'))['db'][_0x9659('0x1')];var WhatsappMessage=require(_0x9659('0x0'))['db'][_0x9659('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9659('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9659('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f5d38){return function(_0x4fd132,_0x2acc26,_0xb08ede){_0x4fd132[_0x9659('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4e4402){_0x4fd132[_0x9659('0x6')](_0x9659('0x7'),_0x4e4402['map'](function(_0xdf6dea){return{'id':_0xdf6dea['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x4fd132['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9659('0x8')](function(_0x194d48){_0x4fd132['setDataValue'](_0x9659('0x9'),_0x194d48[_0x9659('0xa')]);WhatsappInteractionEvents[_0x9659('0xb')](_0x2f5d38+':'+_0x4fd132['id'],_0x4fd132);WhatsappInteractionEvents['emit'](_0x2f5d38,_0x4fd132);_0xb08ede(null);})[_0x9659('0xc')](_0xb08ede(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x9659('0xd')](e,emitEvent(event));}}module[_0x9659('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2b834ca..68c5d96 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 _0x8bea=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2b3062,_0x1f4d35){var _0x528b16=function(_0x3d736b){while(--_0x3d736b){_0x2b3062['push'](_0x2b3062['shift']());}};_0x528b16(++_0x1f4d35);}(_0x8bea,0x96));var _0xa8be=function(_0x45ff50,_0x71f810){_0x45ff50=_0x45ff50-0x0;var _0x143a4d=_0x8bea[_0x45ff50];return _0x143a4d;};'use strict';var _=require(_0xa8be('0x0'));var util=require(_0xa8be('0x1'));var logger=require(_0xa8be('0x2'))(_0xa8be('0x3'));var moment=require('moment');var BPromise=require(_0xa8be('0x4'));var rp=require(_0xa8be('0x5'));var fs=require('fs');var path=require(_0xa8be('0x6'));var rimraf=require(_0xa8be('0x7'));var config=require('../../config/environment');var attributes=require(_0xa8be('0x8'));module[_0xa8be('0x9')]=function(_0x2a3d5d,_0x4d31ca){return _0x2a3d5d['define'](_0xa8be('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35749d,_0x437ccb,_0x3d19db){if(_0x35749d[_0xa8be('0xb')]('closed')){_0x35749d[_0xa8be('0xc')]=moment()[_0xa8be('0xd')](_0xa8be('0xe'));}_0x3d19db(null,_0x35749d);}}});}; \ No newline at end of file +var _0x8281=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird','request-promise'];(function(_0x406c0e,_0x126ef1){var _0x52626a=function(_0x281f84){while(--_0x281f84){_0x406c0e['push'](_0x406c0e['shift']());}};_0x52626a(++_0x126ef1);}(_0x8281,0x182));var _0x1828=function(_0x1e228c,_0x952f1b){_0x1e228c=_0x1e228c-0x0;var _0x2a482f=_0x8281[_0x1e228c];return _0x2a482f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1828('0x0'))(_0x1828('0x1'));var moment=require('moment');var BPromise=require(_0x1828('0x2'));var rp=require(_0x1828('0x3'));var fs=require('fs');var path=require(_0x1828('0x4'));var rimraf=require(_0x1828('0x5'));var config=require(_0x1828('0x6'));var attributes=require(_0x1828('0x7'));module[_0x1828('0x8')]=function(_0x102777,_0x4752d7){return _0x102777['define'](_0x1828('0x9'),attributes,{'tableName':_0x1828('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a5768,_0x1f6580,_0xfbcc1b){if(_0x2a5768['changed'](_0x1828('0xb'))){_0x2a5768[_0x1828('0xc')]=moment()[_0x1828('0xd')](_0x1828('0xe'));}_0xfbcc1b(null,_0x2a5768);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e212c5c..e9c8026 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 _0x2513=['update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x2e36a0,_0x3b5978){var _0x547ffb=function(_0x4ecab4){while(--_0x4ecab4){_0x2e36a0['push'](_0x2e36a0['shift']());}};_0x547ffb(++_0x3b5978);}(_0x2513,0xb5));var _0x3251=function(_0x5bc0af,_0x63a853){_0x5bc0af=_0x5bc0af-0x0;var _0xfb1af=_0x2513[_0x5bc0af];return _0xfb1af;};'use strict';var _=require(_0x3251('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3251('0x1'));var rs=require(_0x3251('0x2'));var fs=require('fs');var Redis=require(_0x3251('0x3'));var db=require(_0x3251('0x4'))['db'];var utils=require(_0x3251('0x5'));var logger=require(_0x3251('0x6'))('rpc');var config=require(_0x3251('0x7'));var jayson=require(_0x3251('0x8'));var client=jayson[_0x3251('0x9')]['http']({'port':0x232a});config[_0x3251('0xa')]=_[_0x3251('0xb')](config[_0x3251('0xa')],{'host':_0x3251('0xc'),'port':0x18eb});var socket=require(_0x3251('0xd'))(new Redis(config['redis']));require(_0x3251('0xe'))['register'](socket);function respondWithRpcPromise(_0x178396,_0x9c7834,_0x23838e){return new BPromise(function(_0x2a7575,_0x506594){return client[_0x3251('0xf')](_0x178396,_0x23838e)[_0x3251('0x10')](function(_0x4f6030){logger[_0x3251('0x11')](_0x3251('0x12'),_0x9c7834,_0x3251('0x13'));logger[_0x3251('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x9c7834,_0x3251('0x13'),JSON[_0x3251('0x15')](_0x4f6030));if(_0x4f6030[_0x3251('0x16')]){if(_0x4f6030['error'][_0x3251('0x17')]===0x1f4){logger[_0x3251('0x16')](_0x3251('0x12'),_0x9c7834,_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);return _0x506594(_0x4f6030[_0x3251('0x16')]['message']);}logger[_0x3251('0x16')](_0x3251('0x12'),_0x9c7834,_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);return _0x2a7575(_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);}else{logger[_0x3251('0x11')](_0x3251('0x12'),_0x9c7834,_0x3251('0x13'));_0x2a7575(_0x4f6030[_0x3251('0x19')][_0x3251('0x18')]);}})[_0x3251('0x1a')](function(_0x5c5232){logger[_0x3251('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x9c7834,_0x5c5232);_0x506594(_0x5c5232);});});}exports[_0x3251('0x1b')]=function(_0xe9e532){var _0x341674=this;return new Promise(function(_0xd084c,_0x144de3){return db[_0x3251('0x1c')][_0x3251('0x1d')](_0xe9e532[_0x3251('0x1e')],{'raw':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x21')]||null:null,'attributes':_0xe9e532['options']?_0xe9e532[_0x3251('0x1f')][_0x3251('0x22')]||null:null,'limit':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x23')]||null:null})['then'](function(_0x192bf7){logger[_0x3251('0x11')](_0x3251('0x1b'),_0xe9e532);logger[_0x3251('0x14')](_0x3251('0x1b'),_0xe9e532,JSON[_0x3251('0x15')](_0x192bf7));_0xd084c(_0x192bf7);})[_0x3251('0x1a')](function(_0x2f0b5c){logger['error'](_0x3251('0x1b'),_0x2f0b5c[_0x3251('0x18')],_0xe9e532);_0x144de3(_0x341674[_0x3251('0x16')](0x1f4,_0x2f0b5c[_0x3251('0x18')]));});});};exports[_0x3251('0x24')]=function(_0x52d025){return new Promise(function(_0x25ecfc,_0x3ba774){return db[_0x3251('0x1c')][_0x3251('0x25')]({'where':_0x52d025[_0x3251('0x1f')]?_0x52d025[_0x3251('0x1f')]['where']||null:null})[_0x3251('0x10')](function(_0x20e4a2){if(_0x20e4a2){return _0x20e4a2['addTags'](_0x52d025[_0x3251('0x1e')][_0x3251('0x26')],_[_0x3251('0x27')](_0x52d025[_0x3251('0x1e')],[_0x3251('0x26'),'id'])||{});}})[_0x3251('0x28')](function(_0x1ecbfc){logger[_0x3251('0x11')](_0x3251('0x29'),_0x52d025);logger[_0x3251('0x14')](_0x3251('0x29'),_0x52d025,JSON['stringify'](_0x1ecbfc));_0x25ecfc(_0x1ecbfc);})[_0x3251('0x1a')](function(_0x52afc3){logger[_0x3251('0x16')](_0x3251('0x29'),_0x52afc3['message'],_0x52d025);_0x3ba774(_this[_0x3251('0x16')](0x1f4,_0x52afc3[_0x3251('0x18')]));});});}; \ No newline at end of file +var _0xa48b=['socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','omit','spread','info','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xa48b,0x72));var _0xba48=function(_0x48aad1,_0x2bc3ca){_0x48aad1=_0x48aad1-0x0;var _0x265330=_0xa48b[_0x48aad1];return _0x265330;};'use strict';var _=require('lodash');var util=require(_0xba48('0x0'));var moment=require(_0xba48('0x1'));var BPromise=require(_0xba48('0x2'));var rs=require(_0xba48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba48('0x4'))['db'];var utils=require(_0xba48('0x5'));var logger=require(_0xba48('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xba48('0x7'));var client=jayson[_0xba48('0x8')][_0xba48('0x9')]({'port':0x232a});config[_0xba48('0xa')]=_[_0xba48('0xb')](config[_0xba48('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xba48('0xc'))(new Redis(config[_0xba48('0xa')]));require(_0xba48('0xd'))[_0xba48('0xe')](socket);function respondWithRpcPromise(_0x3e5a01,_0x2ba093,_0x2958e7){return new BPromise(function(_0xd2d1f7,_0x3f7b03){return client[_0xba48('0xf')](_0x3e5a01,_0x2958e7)[_0xba48('0x10')](function(_0x2ca356){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x2ba093,_0xba48('0x11'));logger[_0xba48('0x12')](_0xba48('0x13'),_0x2ba093,_0xba48('0x11'),JSON[_0xba48('0x14')](_0x2ca356));if(_0x2ca356[_0xba48('0x15')]){if(_0x2ca356[_0xba48('0x15')]['code']===0x1f4){logger['error'](_0xba48('0x16'),_0x2ba093,_0x2ca356[_0xba48('0x15')][_0xba48('0x17')]);return _0x3f7b03(_0x2ca356[_0xba48('0x15')][_0xba48('0x17')]);}logger[_0xba48('0x15')](_0xba48('0x16'),_0x2ba093,_0x2ca356[_0xba48('0x15')][_0xba48('0x17')]);return _0xd2d1f7(_0x2ca356[_0xba48('0x15')][_0xba48('0x17')]);}else{logger['info'](_0xba48('0x16'),_0x2ba093,'request\x20sent');_0xd2d1f7(_0x2ca356[_0xba48('0x18')]['message']);}})[_0xba48('0x19')](function(_0x24564f){logger[_0xba48('0x15')](_0xba48('0x16'),_0x2ba093,_0x24564f);_0x3f7b03(_0x24564f);});});}exports[_0xba48('0x1a')]=function(_0x407f92){var _0x32d4c7=this;return new Promise(function(_0x1365f1,_0x199802){return db['WhatsappInteraction'][_0xba48('0x1b')](_0x407f92[_0xba48('0x1c')],{'raw':_0x407f92[_0xba48('0x1d')]?_0x407f92[_0xba48('0x1d')][_0xba48('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407f92['options']?_0x407f92[_0xba48('0x1d')][_0xba48('0x1f')]||null:null,'attributes':_0x407f92[_0xba48('0x1d')]?_0x407f92[_0xba48('0x1d')][_0xba48('0x20')]||null:null,'limit':_0x407f92[_0xba48('0x1d')]?_0x407f92[_0xba48('0x1d')][_0xba48('0x21')]||null:null})[_0xba48('0x10')](function(_0x2e28df){logger['info'](_0xba48('0x1a'),_0x407f92);logger['debug'](_0xba48('0x1a'),_0x407f92,JSON['stringify'](_0x2e28df));_0x1365f1(_0x2e28df);})[_0xba48('0x19')](function(_0x2fe86b){logger[_0xba48('0x15')](_0xba48('0x1a'),_0x2fe86b[_0xba48('0x17')],_0x407f92);_0x199802(_0x32d4c7['error'](0x1f4,_0x2fe86b[_0xba48('0x17')]));});});};exports[_0xba48('0x22')]=function(_0x420f8a){return new Promise(function(_0x18fa26,_0x4cd632){return db[_0xba48('0x23')][_0xba48('0x24')]({'where':_0x420f8a[_0xba48('0x1d')]?_0x420f8a['options'][_0xba48('0x1f')]||null:null})[_0xba48('0x10')](function(_0x107387){if(_0x107387){return _0x107387[_0xba48('0x25')](_0x420f8a[_0xba48('0x1c')]['ids'],_[_0xba48('0x26')](_0x420f8a[_0xba48('0x1c')],['ids','id'])||{});}})[_0xba48('0x27')](function(_0x549783){logger[_0xba48('0x28')](_0xba48('0x29'),_0x420f8a);logger['debug'](_0xba48('0x29'),_0x420f8a,JSON[_0xba48('0x14')](_0x549783));_0x18fa26(_0x549783);})[_0xba48('0x19')](function(_0x5d8cee){logger[_0xba48('0x15')](_0xba48('0x29'),_0x5d8cee[_0xba48('0x17')],_0x420f8a);_0x4cd632(_this['error'](0x1f4,_0x5d8cee[_0xba48('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1f98bea..2afff1d 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 _0x50bf=['whatsappInteraction:','./whatsappInteraction.events','emit','register','length'];(function(_0x4a1a9b,_0x40391f){var _0x237338=function(_0x32c2d0){while(--_0x32c2d0){_0x4a1a9b['push'](_0x4a1a9b['shift']());}};_0x237338(++_0x40391f);}(_0x50bf,0x1a0));var _0xf50b=function(_0xe15cc5,_0x551056){_0xe15cc5=_0xe15cc5-0x0;var _0x4e5124=_0x50bf[_0xe15cc5];return _0x4e5124;};'use strict';var WhatsappInteractionEvents=require(_0xf50b('0x0'));var events=['save','remove','update'];function createListener(_0x4912f4,_0x5a6c16){return function(_0x1d0079){_0x5a6c16[_0xf50b('0x1')](_0x4912f4,_0x1d0079);};}function removeListener(_0x6e23f1,_0x24316b){return function(){WhatsappInteractionEvents['removeListener'](_0x6e23f1,_0x24316b);};}exports[_0xf50b('0x2')]=function(_0x3f73e0){for(var _0x114dd3=0x0,_0x919837=events[_0xf50b('0x3')];_0x114dd3<_0x919837;_0x114dd3++){var _0x5f5207=events[_0x114dd3];var _0x1ac636=createListener(_0xf50b('0x4')+_0x5f5207,_0x3f73e0);WhatsappInteractionEvents['on'](_0x5f5207,_0x1ac636);}}; \ No newline at end of file +var _0xd7cf=['emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','remove'];(function(_0x2c9c16,_0x191d2e){var _0x3f0ee4=function(_0x408fab){while(--_0x408fab){_0x2c9c16['push'](_0x2c9c16['shift']());}};_0x3f0ee4(++_0x191d2e);}(_0xd7cf,0x140));var _0xfd7c=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0xd7cf[_0x322296];return _0x432ea7;};'use strict';var WhatsappInteractionEvents=require(_0xfd7c('0x0'));var events=['save',_0xfd7c('0x1'),'update'];function createListener(_0x5d40fd,_0x2ad411){return function(_0x289e6a){_0x2ad411[_0xfd7c('0x2')](_0x5d40fd,_0x289e6a);};}function removeListener(_0x398901,_0x83242a){return function(){WhatsappInteractionEvents[_0xfd7c('0x3')](_0x398901,_0x83242a);};}exports[_0xfd7c('0x4')]=function(_0x1c5cff){for(var _0x2b50b8=0x0,_0x512592=events[_0xfd7c('0x5')];_0x2b50b8<_0x512592;_0x2b50b8++){var _0x150382=events[_0x2b50b8];var _0x36905b=createListener(_0xfd7c('0x6')+_0x150382,_0x1c5cff);WhatsappInteractionEvents['on'](_0x150382,_0x36905b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c3acda3..9dfd6c9 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 _0xb5c7=['index','/:id','show','tracked','whatsappmessage:create','create','post','/:id/status','status','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x1fcaaa,_0x4f9e3c){var _0x16606e=function(_0x3ad5d3){while(--_0x3ad5d3){_0x1fcaaa['push'](_0x1fcaaa['shift']());}};_0x16606e(++_0x4f9e3c);}(_0xb5c7,0x68));var _0x7b5c=function(_0x28915d,_0x1ea8d0){_0x28915d=_0x28915d-0x0;var _0x5ee220=_0xb5c7[_0x28915d];return _0x5ee220;};'use strict';var multer=require(_0x7b5c('0x0'));var util=require(_0x7b5c('0x1'));var path=require(_0x7b5c('0x2'));var timeout=require(_0x7b5c('0x3'));var express=require(_0x7b5c('0x4'));var router=express[_0x7b5c('0x5')]();var fs_extra=require(_0x7b5c('0x6'));var auth=require(_0x7b5c('0x7'));var interaction=require(_0x7b5c('0x8'));var config=require('../../config/environment');var controller=require(_0x7b5c('0x9'));router[_0x7b5c('0xa')]('/',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0xc')]);router['get']('/describe',auth[_0x7b5c('0xb')](),controller['describe']);router[_0x7b5c('0xa')](_0x7b5c('0xd'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0xe')]);router['post']('/',auth[_0x7b5c('0xb')](),interaction[_0x7b5c('0xf')]('whatsapp',_0x7b5c('0x10')),controller[_0x7b5c('0x11')]);router[_0x7b5c('0x12')](_0x7b5c('0x13'),controller[_0x7b5c('0x14')]);router['put']('/:id',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x15')]);router[_0x7b5c('0x16')](_0x7b5c('0x17'),auth['isAuthenticated'](),controller[_0x7b5c('0x18')]);router[_0x7b5c('0x16')]('/:id/reject',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x19')]);router[_0x7b5c('0x1a')](_0x7b5c('0xd'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x1b')]);module[_0x7b5c('0x1c')]=router; \ No newline at end of file +var _0xb49d=['/:id/status','update','put','accept','/:id/reject','reject','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x1af327,_0x375aba){var _0x36a437=function(_0x4de506){while(--_0x4de506){_0x1af327['push'](_0x1af327['shift']());}};_0x36a437(++_0x375aba);}(_0xb49d,0x1cf));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdb49('0x0'));var util=require(_0xdb49('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb49('0x2')]();var fs_extra=require(_0xdb49('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdb49('0x4'));var config=require(_0xdb49('0x5'));var controller=require(_0xdb49('0x6'));router[_0xdb49('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb49('0x8')]);router['get'](_0xdb49('0x9'),auth[_0xdb49('0xa')](),controller[_0xdb49('0xb')]);router['get'](_0xdb49('0xc'),auth[_0xdb49('0xa')](),controller['show']);router[_0xdb49('0xd')]('/',auth['isAuthenticated'](),interaction[_0xdb49('0xe')](_0xdb49('0xf'),_0xdb49('0x10')),controller['create']);router[_0xdb49('0xd')](_0xdb49('0x11'),controller['status']);router['put'](_0xdb49('0xc'),auth[_0xdb49('0xa')](),controller[_0xdb49('0x12')]);router[_0xdb49('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xdb49('0x14')]);router[_0xdb49('0x13')](_0xdb49('0x15'),auth['isAuthenticated'](),controller[_0xdb49('0x16')]);router['delete']('/:id',auth[_0xdb49('0xa')](),controller[_0xdb49('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 647eeef..a60bef3 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 _0x5bac=['STRING','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x5bac,0x19f));var _0xc5ba=function(_0x43fc6e,_0x41ac6b){_0x43fc6e=_0x43fc6e-0x0;var _0x3ca5c5=_0x5bac[_0x43fc6e];return _0x3ca5c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc5ba('0x0')](_0xc5ba('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc5ba('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc5ba('0x3')]('in','out'),'defaultValue':_0xc5ba('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc5ba('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc5ba('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc5ba('0x5')]},'providerResponse':{'type':Sequelize[_0xc5ba('0x0')]}}; \ No newline at end of file +var _0x95b2=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x95b2,0x144));var _0x295b=function(_0x6c6056,_0x6a2792){_0x6c6056=_0x6c6056-0x0;var _0x2cd186=_0x95b2[_0x6c6056];return _0x2cd186;};'use strict';var Sequelize=require(_0x295b('0x0'));module[_0x295b('0x1')]={'body':{'type':Sequelize[_0x295b('0x2')](_0x295b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x295b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x295b('0x5')]('in',_0x295b('0x6')),'defaultValue':_0x295b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x295b('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x295b('0x8')]},'secret':{'type':Sequelize[_0x295b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x295b('0x7')]},'providerResponse':{'type':Sequelize[_0x295b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 93df965..a058638 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 _0x0792=['localhost','socket.io-emitter','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','WhatsappMessage','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','../../config/logger','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','[WHATSAPPMESSAGE: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','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','agent','manual','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','interface','SIP/%s','reject','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0792,0x74));var _0x2079=function(_0x1c3375,_0x29cf53){_0x1c3375=_0x1c3375-0x0;var _0x179181=_0x0792[_0x1c3375];return _0x179181;};'use strict';var emlformat=require(_0x2079('0x0'));var rimraf=require(_0x2079('0x1'));var zipdir=require(_0x2079('0x2'));var jsonpatch=require(_0x2079('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2079('0x4'));var util=require(_0x2079('0x5'));var path=require(_0x2079('0x6'));var sox=require(_0x2079('0x7'));var csv=require(_0x2079('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2079('0x9'));var _=require('lodash');var squel=require(_0x2079('0xa'));var crypto=require(_0x2079('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2079('0xc'));var toCsv=require(_0x2079('0x8'));var querystring=require(_0x2079('0xd'));var Papa=require(_0x2079('0xe'));var Redis=require(_0x2079('0xf'));var authService=require(_0x2079('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2079('0x11'));var hardwareService=require(_0x2079('0x12'));var logger=require('../../config/logger')(_0x2079('0x13'));var utils=require(_0x2079('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2079('0x15'));var db=require(_0x2079('0x16'))['db'];config[_0x2079('0x17')]=_[_0x2079('0x18')](config[_0x2079('0x17')],{'host':_0x2079('0x19'),'port':0x18eb});var socket=require(_0x2079('0x1a'))(new Redis(config[_0x2079('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x2079('0x1b'));var client=jayson['client'][_0x2079('0x1c')]({'port':0x232c});var client9002=jayson[_0x2079('0x1d')][_0x2079('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x329db4,_0x31b4ea,_0x4b38a1,_0xa70f8c){return new BPromise(function(_0x472bce,_0x3714cc){var _0xd1a721=_0xa70f8c||client;return _0xd1a721['request'](_0x329db4,_0x4b38a1)[_0x2079('0x1e')](function(_0x71993){logger[_0x2079('0x1f')](_0x2079('0x20'),_0x31b4ea,_0x2079('0x21'));logger[_0x2079('0x22')](_0x2079('0x23'),_0x31b4ea,_0x2079('0x21'),JSON[_0x2079('0x24')](_0x71993));if(_0x71993[_0x2079('0x25')]){if(_0x71993[_0x2079('0x25')][_0x2079('0x26')]===0x1f4){logger['error'](_0x2079('0x20'),_0x31b4ea,_0x71993[_0x2079('0x25')][_0x2079('0x27')]);return _0x3714cc(_0x71993[_0x2079('0x25')][_0x2079('0x27')]);}logger[_0x2079('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x31b4ea,_0x71993[_0x2079('0x25')][_0x2079('0x27')]);return _0x472bce(_0x71993[_0x2079('0x25')][_0x2079('0x27')]);}else{logger[_0x2079('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x31b4ea,_0x2079('0x21'));_0x472bce(_0x71993['result']['message']);}})['catch'](function(_0x2d7c47){logger[_0x2079('0x25')](_0x2079('0x20'),_0x31b4ea,_0x2d7c47);_0x3714cc(_0x2d7c47);});});}function respondWithStatusCode(_0x498190,_0x5705d0){_0x5705d0=_0x5705d0||0xcc;return function(_0x4fa561){if(_0x4fa561){return _0x498190[_0x2079('0x28')](_0x5705d0);}return _0x498190[_0x2079('0x29')](_0x5705d0)[_0x2079('0x2a')]();};}function respondWithResult(_0x5eeaa6,_0x306b9b){_0x306b9b=_0x306b9b||0xc8;return function(_0x2b77e1){if(_0x2b77e1){return _0x5eeaa6[_0x2079('0x29')](_0x306b9b)[_0x2079('0x2b')](_0x2b77e1);}};}function respondWithFilteredResult(_0x793004,_0x5ab48a){return function(_0x2e8301){if(_0x2e8301){var _0x1018c1=typeof _0x5ab48a[_0x2079('0x2c')]===_0x2079('0x2d')&&typeof _0x5ab48a[_0x2079('0x2e')]===_0x2079('0x2d');var _0x45fbde=_0x2e8301[_0x2079('0x2f')];var _0x5e1884=_0x1018c1?0x0:_0x5ab48a[_0x2079('0x2c')];var _0x5c5876=_0x1018c1?_0x2e8301[_0x2079('0x2f')]:_0x5ab48a[_0x2079('0x2c')]+_0x5ab48a[_0x2079('0x2e')];var _0x2e02a1;if(_0x5c5876>=_0x45fbde){_0x5c5876=_0x45fbde;_0x2e02a1=0xc8;}else{_0x2e02a1=0xce;}_0x793004[_0x2079('0x29')](_0x2e02a1);return _0x793004[_0x2079('0x30')](_0x2079('0x31'),_0x5e1884+'-'+_0x5c5876+'/'+_0x45fbde)[_0x2079('0x2b')](_0x2e8301);}return null;};}function patchUpdates(_0x55bdfa){return function(_0x358067){try{jsonpatch[_0x2079('0x32')](_0x358067,_0x55bdfa,!![]);}catch(_0x41a844){return BPromise['reject'](_0x41a844);}return _0x358067[_0x2079('0x33')]();};}function saveUpdates(_0x469af3,_0x5ba5de){return function(_0x2417d5){if(_0x2417d5){return _0x2417d5[_0x2079('0x34')](_0x469af3)[_0x2079('0x1e')](function(_0x57fea4){return _0x57fea4;});}return null;};}function removeEntity(_0xd10ec0,_0x5cc578){return function(_0x41a831){if(_0x41a831){return _0x41a831[_0x2079('0x35')]()[_0x2079('0x1e')](function(){_0xd10ec0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x278859,_0x15c34f){return function(_0x31d53c){if(!_0x31d53c){_0x278859[_0x2079('0x28')](0x194);}return _0x31d53c;};}function handleError(_0x50fc05,_0x4a48c0){_0x4a48c0=_0x4a48c0||0x1f4;return function(_0x23756f){logger[_0x2079('0x25')](_0x23756f[_0x2079('0x36')]);if(_0x23756f['name']){delete _0x23756f['name'];}_0x50fc05[_0x2079('0x29')](_0x4a48c0)[_0x2079('0x37')](_0x23756f);};}exports[_0x2079('0x38')]=function(_0x55c1a2,_0x129d44){var _0x358ccb={},_0x391225={},_0xbf7bcb={'count':0x0,'rows':[]};var _0x430023=_[_0x2079('0x39')](db['WhatsappMessage'][_0x2079('0x3a')],function(_0x57838b){return{'name':_0x57838b[_0x2079('0x3b')],'type':_0x57838b[_0x2079('0x3c')][_0x2079('0x3d')]};});_0x391225[_0x2079('0x3e')]=_[_0x2079('0x39')](_0x430023,_0x2079('0x3f'));_0x391225[_0x2079('0x40')]=_[_0x2079('0x41')](_0x55c1a2[_0x2079('0x40')]);_0x391225[_0x2079('0x42')]=_[_0x2079('0x43')](_0x391225['model'],_0x391225[_0x2079('0x40')]);_0x358ccb[_0x2079('0x44')]=_[_0x2079('0x43')](_0x391225[_0x2079('0x3e')],qs['fields'](_0x55c1a2[_0x2079('0x40')][_0x2079('0x45')]));_0x358ccb[_0x2079('0x44')]=_0x358ccb[_0x2079('0x44')]['length']?_0x358ccb[_0x2079('0x44')]:_0x391225[_0x2079('0x3e')];if(!_0x55c1a2[_0x2079('0x40')]['hasOwnProperty'](_0x2079('0x46'))){_0x358ccb[_0x2079('0x2e')]=qs[_0x2079('0x2e')](_0x55c1a2[_0x2079('0x40')][_0x2079('0x2e')]);_0x358ccb[_0x2079('0x2c')]=qs[_0x2079('0x2c')](_0x55c1a2[_0x2079('0x40')]['offset']);}_0x358ccb[_0x2079('0x47')]=qs[_0x2079('0x48')](_0x55c1a2['query'][_0x2079('0x48')]);_0x358ccb['where']=qs[_0x2079('0x42')](_[_0x2079('0x49')](_0x55c1a2['query'],_0x391225[_0x2079('0x42')]),_0x430023);if(_0x55c1a2[_0x2079('0x40')][_0x2079('0x4a')]){_0x358ccb[_0x2079('0x4b')]=_['merge'](_0x358ccb[_0x2079('0x4b')],{'$or':_[_0x2079('0x39')](_0x430023,function(_0xb7c65a){if(_0xb7c65a[_0x2079('0x3c')]!==_0x2079('0x4c')){var _0x845643={};_0x845643[_0xb7c65a[_0x2079('0x3f')]]={'$like':'%'+_0x55c1a2[_0x2079('0x40')]['filter']+'%'};return _0x845643;}})});}_0x358ccb=_[_0x2079('0x4d')]({},_0x358ccb,_0x55c1a2['options']);var _0x302ca3={'where':_0x358ccb[_0x2079('0x4b')]};return db[_0x2079('0x4e')]['count'](_0x302ca3)[_0x2079('0x1e')](function(_0x50cc77){_0xbf7bcb[_0x2079('0x2f')]=_0x50cc77;if(_0x55c1a2['query'][_0x2079('0x4f')]){_0x358ccb[_0x2079('0x50')]=[{'all':!![]}];}return db[_0x2079('0x4e')][_0x2079('0x51')](_0x358ccb);})[_0x2079('0x1e')](function(_0x23b1b6){_0xbf7bcb[_0x2079('0x52')]=_0x23b1b6;return _0xbf7bcb;})[_0x2079('0x1e')](respondWithFilteredResult(_0x129d44,_0x358ccb))[_0x2079('0x53')](handleError(_0x129d44,null));};exports['show']=function(_0x1f6b86,_0x368e50){var _0x2a1bdf={'raw':!![],'where':{'id':_0x1f6b86[_0x2079('0x54')]['id']}},_0x33d4c1={};_0x33d4c1[_0x2079('0x3e')]=_['keys'](db[_0x2079('0x4e')][_0x2079('0x3a')]);_0x33d4c1[_0x2079('0x40')]=_[_0x2079('0x41')](_0x1f6b86[_0x2079('0x40')]);_0x33d4c1[_0x2079('0x42')]=_['intersection'](_0x33d4c1[_0x2079('0x3e')],_0x33d4c1[_0x2079('0x40')]);_0x2a1bdf[_0x2079('0x44')]=_['intersection'](_0x33d4c1[_0x2079('0x3e')],qs[_0x2079('0x45')](_0x1f6b86[_0x2079('0x40')]['fields']));_0x2a1bdf[_0x2079('0x44')]=_0x2a1bdf[_0x2079('0x44')][_0x2079('0x55')]?_0x2a1bdf['attributes']:_0x33d4c1[_0x2079('0x3e')];if(_0x1f6b86[_0x2079('0x40')][_0x2079('0x4f')]){_0x2a1bdf[_0x2079('0x50')]=[{'all':!![]}];}_0x2a1bdf=_[_0x2079('0x4d')]({},_0x2a1bdf,_0x1f6b86['options']);return db[_0x2079('0x4e')][_0x2079('0x56')](_0x2a1bdf)[_0x2079('0x1e')](handleEntityNotFound(_0x368e50,null))[_0x2079('0x1e')](respondWithResult(_0x368e50,null))[_0x2079('0x53')](handleError(_0x368e50,null));};exports[_0x2079('0x57')]=function(_0x539bab,_0x21d721){return db[_0x2079('0x4e')]['create'](_0x539bab[_0x2079('0x58')],{})[_0x2079('0x1e')](respondWithResult(_0x21d721,0xc9))[_0x2079('0x53')](handleError(_0x21d721,null));};exports[_0x2079('0x34')]=function(_0x3dbb2d,_0x43ae5d){if(_0x3dbb2d[_0x2079('0x58')]['id']){delete _0x3dbb2d[_0x2079('0x58')]['id'];}return db[_0x2079('0x4e')][_0x2079('0x56')]({'where':{'id':_0x3dbb2d['params']['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x43ae5d,null))[_0x2079('0x1e')](saveUpdates(_0x3dbb2d[_0x2079('0x58')],null))['then'](respondWithResult(_0x43ae5d,null))[_0x2079('0x53')](handleError(_0x43ae5d,null));};exports[_0x2079('0x35')]=function(_0x569492,_0x5e2fde){return db['WhatsappMessage'][_0x2079('0x56')]({'where':{'id':_0x569492[_0x2079('0x54')]['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x5e2fde,null))[_0x2079('0x1e')](removeEntity(_0x5e2fde,null))[_0x2079('0x53')](handleError(_0x5e2fde,null));};exports[_0x2079('0x59')]=function(_0x1c2541,_0x911dcb){return db[_0x2079('0x4e')][_0x2079('0x59')]()[_0x2079('0x1e')](respondWithResult(_0x911dcb,null))['catch'](handleError(_0x911dcb,null));};var interaction_log=require(_0x2079('0x5a'))('whatsapp-interactions');exports['accept']=function(_0xf8d3e2,_0x26487f,_0x5ed98d){var _0xf4634c={'agent':{},'channel':_0x2079('0x5b')};if(_0xf8d3e2['body']['id']){delete _0xf8d3e2[_0x2079('0x58')]['id'];}_0xf8d3e2[_0x2079('0x58')][_0x2079('0x5c')]=!![];_0xf8d3e2[_0x2079('0x58')]['readAt']=moment()[_0x2079('0x5d')](_0x2079('0x5e'));_0xf8d3e2[_0x2079('0x58')]['UserId']=_0xf8d3e2['body']['UserId']||_0xf8d3e2[_0x2079('0x5f')]['id'];_0xf4634c['agent']['id']=_0xf8d3e2['body'][_0x2079('0x60')];return db['WhatsappMessage'][_0x2079('0x56')]({'where':{'id':_0xf8d3e2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26487f,null))['then'](saveUpdates(_0xf8d3e2[_0x2079('0x58')],null))[_0x2079('0x1e')](function(_0x12dad0){if(_0x12dad0){_0xf4634c[_0x2079('0x27')]=_0x12dad0[_0x2079('0x61')]({'plain':!![]});return db[_0x2079('0x62')][_0x2079('0x56')]({'where':{'id':_0x12dad0[_0x2079('0x63')]}});}return null;})[_0x2079('0x1e')](handleEntityNotFound(_0x26487f,null))[_0x2079('0x1e')](function(_0x35429f){if(_0x35429f){return _0x35429f[_0x2079('0x34')]({'UserId':_0xf8d3e2['body']['UserId'],'read1stAt':_['isNil'](_0x35429f[_0x2079('0x64')])?moment()['format'](_0x2079('0x5e')):undefined});}return null;})[_0x2079('0x1e')](function(_0x13c961){if(_0x13c961){_0xf4634c['interaction']=_0x13c961[_0x2079('0x61')]({'plain':!![]});interaction_log[_0x2079('0x1f')](_0x2079('0x65'),_0xf8d3e2['user']['id'],_0xf8d3e2[_0x2079('0x5f')][_0x2079('0x3f')],_0xf8d3e2[_0x2079('0x5f')][_0x2079('0x66')],_0xf4634c[_0x2079('0x67')]['id'],_0xf8d3e2['body']?JSON[_0x2079('0x24')](_0xf8d3e2[_0x2079('0x58')]):_0x2079('0x68'));return respondWithRpcPromise(_0x2079('0x69'),_0x2079('0x6a'),_0xf4634c);}return null;})[_0x2079('0x1e')](function(_0x4f7d9a){var _0x280f5b=_0x2079('0x6b')+_0x4f7d9a['message'][_0x2079('0x6c')];return db[_0x2079('0x6d')][_0x2079('0x40')](_0x280f5b,{'type':db[_0x2079('0x6e')][_0x2079('0x6f')][_0x2079('0x70')],'raw':!![]})[_0x2079('0x1e')](function(_0x5ba39b){return _0x5ba39b;});})[_0x2079('0x1e')](function(_0x5ecee9){if(_0x5ecee9){_0xf4634c['message'][_0x2079('0x71')]=_0x5ecee9[0x0];if(!_0xf8d3e2[_0x2079('0x58')][_0x2079('0x60')])return;return db[_0x2079('0x72')][_0x2079('0x56')]({'where':{'id':_0xf8d3e2['body'][_0x2079('0x60')],'role':'agent'},'attributes':['id',_0x2079('0x3f'),'fullname','email',_0x2079('0x73')],'raw':!![]});}return null;})[_0x2079('0x1e')](function(_0x4026d6){if(!_0x4026d6)return null;_0xf4634c['message'][_0x2079('0x74')]=_0x4026d6;return _0xf4634c;})[_0x2079('0x1e')](function(_0xf56311){if(_0xf56311){if(_0xf8d3e2['body'][_0x2079('0x75')]){_0xf4634c[_0x2079('0x27')]['interface']=util['format']('SIP/%s',_0xf8d3e2[_0x2079('0x5f')]['name']);_0xf4634c[_0x2079('0x27')][_0x2079('0x76')]=_0xf4634c[_0x2079('0x76')];_0xf4634c[_0x2079('0x27')]['motionChannel']=_0xf4634c[_0x2079('0x76')];_0xf4634c[_0x2079('0x27')][_0x2079('0x77')]=_0x2079('0x78');return respondWithRpcPromise(_0x2079('0x79'),'EventManager',{'event':_0x2079('0x7a'),'message':_0xf4634c[_0x2079('0x27')]},client9002)[_0x2079('0x1e')](function(){return _0xf4634c;});}return _0xf4634c;}return null;})[_0x2079('0x1e')](respondWithResult(_0x26487f,null))[_0x2079('0x53')](handleError(_0x26487f,null));};var interaction_log=require(_0x2079('0x5a'))(_0x2079('0x7b'));exports['reject']=function(_0x3933ca,_0x4febb1,_0x530c2f){var _0x46e6d7={'agent':{},'channel':_0x2079('0x5b')};if(_0x3933ca[_0x2079('0x58')]['id']){delete _0x3933ca['body']['id'];}_0x3933ca[_0x2079('0x58')][_0x2079('0x60')]=_0x3933ca['body']['UserId']||_0x3933ca[_0x2079('0x5f')]['id'];_0x46e6d7[_0x2079('0x74')]['id']=_0x3933ca[_0x2079('0x58')]['UserId'];return db[_0x2079('0x4e')]['find']({'where':{'id':_0x3933ca[_0x2079('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4febb1,null))[_0x2079('0x1e')](function(_0x2f3100){if(_0x2f3100){_0x46e6d7['message']=_0x2f3100[_0x2079('0x61')]({'plain':!![]});return db[_0x2079('0x62')][_0x2079('0x56')]({'where':{'id':_0x2f3100[_0x2079('0x63')]}});}return null;})[_0x2079('0x1e')](handleEntityNotFound(_0x4febb1,null))['then'](function(_0x644249){if(_0x644249){_0x46e6d7['interaction']=_0x644249[_0x2079('0x61')]({'plain':!![]});interaction_log[_0x2079('0x1f')](_0x2079('0x7c'),_0x3933ca['user']['id'],_0x3933ca[_0x2079('0x5f')][_0x2079('0x3f')],_0x3933ca[_0x2079('0x5f')][_0x2079('0x66')],_0x46e6d7['interaction']['id'],_0x3933ca[_0x2079('0x58')]?JSON[_0x2079('0x24')](_0x3933ca[_0x2079('0x58')]):_0x2079('0x68'));return respondWithRpcPromise(_0x2079('0x7d'),_0x2079('0x7e'),_0x46e6d7);}return null;})[_0x2079('0x1e')](function(_0x84f28d){var _0x407107=_0x2079('0x6b')+_0x84f28d[_0x2079('0x27')][_0x2079('0x6c')];return db['sequelize'][_0x2079('0x40')](_0x407107,{'type':db[_0x2079('0x6e')][_0x2079('0x6f')][_0x2079('0x70')],'raw':!![]})[_0x2079('0x1e')](function(_0x2c7468){return _0x2c7468;});})[_0x2079('0x1e')](function(_0x316da5){if(_0x316da5){_0x46e6d7['message'][_0x2079('0x71')]=_0x316da5[0x0];if(!_0x3933ca[_0x2079('0x58')][_0x2079('0x60')])return;return db['User'][_0x2079('0x56')]({'where':{'id':_0x3933ca[_0x2079('0x58')][_0x2079('0x60')],'role':_0x2079('0x74')},'attributes':['id',_0x2079('0x3f'),_0x2079('0x7f'),_0x2079('0x80'),_0x2079('0x73')],'raw':!![]});}return null;})[_0x2079('0x1e')](function(_0x5c14a0){if(!_0x5c14a0)return null;_0x46e6d7['message'][_0x2079('0x74')]=_0x5c14a0;return _0x46e6d7;})['then'](function(_0x2f5c9b){if(_0x2f5c9b){_0x2f5c9b[_0x2079('0x27')][_0x2079('0x81')]=util[_0x2079('0x5d')](_0x2079('0x82'),_0x3933ca['user'][_0x2079('0x3f')]);_0x2f5c9b[_0x2079('0x27')][_0x2079('0x76')]=_0x46e6d7[_0x2079('0x76')];_0x2f5c9b[_0x2079('0x27')]['motionChannel']=_0x46e6d7[_0x2079('0x76')];_0x2f5c9b['message']['event']=_0x2079('0x83');respondWithRpcPromise(_0x2079('0x79'),_0x2079('0x79'),{'event':'rejectmessage','message':_0x2f5c9b['message']},client9002);return _0x46e6d7;}return null;})[_0x2079('0x1e')](respondWithResult(_0x4febb1,null))['catch'](handleError(_0x4febb1,null));};exports[_0x2079('0x29')]=function(_0x196c07,_0x8b8f5c,_0x44c8c0){if(_0x196c07[_0x2079('0x58')]['id']){delete _0x196c07[_0x2079('0x58')]['id'];}var _0x32f0d3;return db[_0x2079('0x4e')]['find']({'where':{'id':_0x196c07[_0x2079('0x54')]['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x8b8f5c,null))[_0x2079('0x1e')](function(_0x2d923d){if(_0x2d923d){_0x32f0d3=_0x2d923d;return db[_0x2079('0x84')][_0x2079('0x56')]({'where':{'id':_0x2d923d[_0x2079('0x85')]}});}})[_0x2079('0x1e')](handleEntityNotFound(_0x8b8f5c,null))['then'](function(_0x43321a){if(_0x43321a){logger[_0x2079('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x2079('0x86'),_0x43321a['type'],util[_0x2079('0x87')](_0x196c07[_0x2079('0x58')],{'showHidden':![],'depth':null}));switch(_0x43321a[_0x2079('0x3c')]){case _0x2079('0x88'):if(_0x196c07['body'][_0x2079('0x89')]&&_0x196c07['body'][_0x2079('0x89')]===_0x32f0d3[_0x2079('0x8a')]&&_0x196c07[_0x2079('0x58')][_0x2079('0x8b')]&&_0x196c07[_0x2079('0x58')][_0x2079('0x8b')]===_0x2079('0x5c')){return _0x32f0d3[_0x2079('0x34')]({'read':!![]});}else{logger['error'](_0x2079('0x8c'),_0x2079('0x29'),_0x2079('0x88'),util[_0x2079('0x87')](_0x196c07['body'],{'showHidden':![],'depth':null}));}break;}return _0x32f0d3;}})[_0x2079('0x1e')](respondWithResult(_0x8b8f5c,null))[_0x2079('0x53')](handleError(_0x8b8f5c,null));}; \ No newline at end of file +var _0xd830=['jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x42c876,_0xbc454b){var _0x3d46ef=function(_0x298f17){while(--_0x298f17){_0x42c876['push'](_0x42c876['shift']());}};_0x3d46ef(++_0xbc454b);}(_0xd830,0x199));var _0x0d83=function(_0x11c702,_0x50d44a){_0x11c702=_0x11c702-0x0;var _0x425081=_0xd830[_0x11c702];return _0x425081;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d83('0x0'));var zipdir=require(_0x0d83('0x1'));var jsonpatch=require(_0x0d83('0x2'));var rp=require(_0x0d83('0x3'));var moment=require(_0x0d83('0x4'));var BPromise=require(_0x0d83('0x5'));var Mustache=require('mustache');var util=require(_0x0d83('0x6'));var path=require(_0x0d83('0x7'));var sox=require(_0x0d83('0x8'));var csv=require(_0x0d83('0x9'));var ejs=require(_0x0d83('0xa'));var fs=require('fs');var fs_extra=require(_0x0d83('0xb'));var _=require(_0x0d83('0xc'));var squel=require(_0x0d83('0xd'));var crypto=require(_0x0d83('0xe'));var jsforce=require(_0x0d83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0d83('0x9'));var querystring=require(_0x0d83('0x10'));var Papa=require(_0x0d83('0x11'));var Redis=require(_0x0d83('0x12'));var authService=require(_0x0d83('0x13'));var qs=require(_0x0d83('0x14'));var as=require(_0x0d83('0x15'));var hardwareService=require(_0x0d83('0x16'));var logger=require(_0x0d83('0x17'))(_0x0d83('0x18'));var utils=require('../../config/utils');var config=require(_0x0d83('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d83('0x1a'))['db'];config[_0x0d83('0x1b')]=_['defaults'](config[_0x0d83('0x1b')],{'host':_0x0d83('0x1c'),'port':0x18eb});var socket=require(_0x0d83('0x1d'))(new Redis(config[_0x0d83('0x1b')]));require(_0x0d83('0x1e'))[_0x0d83('0x1f')](socket);var jayson=require(_0x0d83('0x20'));var client=jayson[_0x0d83('0x21')][_0x0d83('0x22')]({'port':0x232c});var client9002=jayson[_0x0d83('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8897f3,_0x4686df,_0x488a1f,_0x1f3a8f){return new BPromise(function(_0x182fc3,_0x2c11e2){var _0x1db414=_0x1f3a8f||client;return _0x1db414[_0x0d83('0x23')](_0x8897f3,_0x488a1f)['then'](function(_0x10b3e7){logger[_0x0d83('0x24')](_0x0d83('0x25'),_0x4686df,_0x0d83('0x26'));logger[_0x0d83('0x27')](_0x0d83('0x28'),_0x4686df,_0x0d83('0x26'),JSON[_0x0d83('0x29')](_0x10b3e7));if(_0x10b3e7[_0x0d83('0x2a')]){if(_0x10b3e7[_0x0d83('0x2a')]['code']===0x1f4){logger[_0x0d83('0x2a')](_0x0d83('0x25'),_0x4686df,_0x10b3e7[_0x0d83('0x2a')][_0x0d83('0x2b')]);return _0x2c11e2(_0x10b3e7[_0x0d83('0x2a')][_0x0d83('0x2b')]);}logger[_0x0d83('0x2a')](_0x0d83('0x25'),_0x4686df,_0x10b3e7[_0x0d83('0x2a')]['message']);return _0x182fc3(_0x10b3e7[_0x0d83('0x2a')][_0x0d83('0x2b')]);}else{logger[_0x0d83('0x24')](_0x0d83('0x25'),_0x4686df,'request\x20sent');_0x182fc3(_0x10b3e7['result'][_0x0d83('0x2b')]);}})[_0x0d83('0x2c')](function(_0x28e913){logger[_0x0d83('0x2a')](_0x0d83('0x25'),_0x4686df,_0x28e913);_0x2c11e2(_0x28e913);});});}function respondWithStatusCode(_0x33b3b5,_0x4303fa){_0x4303fa=_0x4303fa||0xcc;return function(_0x438f0a){if(_0x438f0a){return _0x33b3b5[_0x0d83('0x2d')](_0x4303fa);}return _0x33b3b5[_0x0d83('0x2e')](_0x4303fa)[_0x0d83('0x2f')]();};}function respondWithResult(_0x3b7677,_0xa19970){_0xa19970=_0xa19970||0xc8;return function(_0x11ddba){if(_0x11ddba){return _0x3b7677[_0x0d83('0x2e')](_0xa19970)[_0x0d83('0x30')](_0x11ddba);}};}function respondWithFilteredResult(_0x3b26a4,_0x2e8ea4){return function(_0x3eb1b9){if(_0x3eb1b9){var _0x42f048=typeof _0x2e8ea4[_0x0d83('0x31')]===_0x0d83('0x32')&&typeof _0x2e8ea4[_0x0d83('0x33')]==='undefined';var _0x42550f=_0x3eb1b9['count'];var _0x52acaf=_0x42f048?0x0:_0x2e8ea4[_0x0d83('0x31')];var _0x3377dd=_0x42f048?_0x3eb1b9[_0x0d83('0x34')]:_0x2e8ea4[_0x0d83('0x31')]+_0x2e8ea4[_0x0d83('0x33')];var _0x58e3fc;if(_0x3377dd>=_0x42550f){_0x3377dd=_0x42550f;_0x58e3fc=0xc8;}else{_0x58e3fc=0xce;}_0x3b26a4[_0x0d83('0x2e')](_0x58e3fc);return _0x3b26a4[_0x0d83('0x35')](_0x0d83('0x36'),_0x52acaf+'-'+_0x3377dd+'/'+_0x42550f)['json'](_0x3eb1b9);}return null;};}function patchUpdates(_0xaee43e){return function(_0x1267c1){try{jsonpatch[_0x0d83('0x37')](_0x1267c1,_0xaee43e,!![]);}catch(_0x2a22ba){return BPromise[_0x0d83('0x38')](_0x2a22ba);}return _0x1267c1[_0x0d83('0x39')]();};}function saveUpdates(_0x4957db,_0xc1ea41){return function(_0x50d5e8){if(_0x50d5e8){return _0x50d5e8[_0x0d83('0x3a')](_0x4957db)['then'](function(_0x139ef0){return _0x139ef0;});}return null;};}function removeEntity(_0x274b54,_0x3681c1){return function(_0x42a42c){if(_0x42a42c){return _0x42a42c[_0x0d83('0x3b')]()[_0x0d83('0x3c')](function(){_0x274b54[_0x0d83('0x2e')](0xcc)[_0x0d83('0x2f')]();});}};}function handleEntityNotFound(_0x2aba89,_0x8fb9d8){return function(_0x52c1e6){if(!_0x52c1e6){_0x2aba89[_0x0d83('0x2d')](0x194);}return _0x52c1e6;};}function handleError(_0x1db055,_0x4cee0c){_0x4cee0c=_0x4cee0c||0x1f4;return function(_0x526011){logger['error'](_0x526011['stack']);if(_0x526011[_0x0d83('0x3d')]){delete _0x526011[_0x0d83('0x3d')];}_0x1db055[_0x0d83('0x2e')](_0x4cee0c)[_0x0d83('0x3e')](_0x526011);};}exports[_0x0d83('0x3f')]=function(_0x451a01,_0x43876c){var _0x263e14={},_0xa4e352={},_0x22cc8e={'count':0x0,'rows':[]};var _0x5d0677=_[_0x0d83('0x40')](db[_0x0d83('0x41')]['rawAttributes'],function(_0x5600fb){return{'name':_0x5600fb[_0x0d83('0x42')],'type':_0x5600fb[_0x0d83('0x43')][_0x0d83('0x44')]};});_0xa4e352[_0x0d83('0x45')]=_[_0x0d83('0x40')](_0x5d0677,_0x0d83('0x3d'));_0xa4e352[_0x0d83('0x46')]=_[_0x0d83('0x47')](_0x451a01[_0x0d83('0x46')]);_0xa4e352[_0x0d83('0x48')]=_[_0x0d83('0x49')](_0xa4e352[_0x0d83('0x45')],_0xa4e352[_0x0d83('0x46')]);_0x263e14['attributes']=_[_0x0d83('0x49')](_0xa4e352[_0x0d83('0x45')],qs[_0x0d83('0x4a')](_0x451a01[_0x0d83('0x46')][_0x0d83('0x4a')]));_0x263e14[_0x0d83('0x4b')]=_0x263e14['attributes'][_0x0d83('0x4c')]?_0x263e14[_0x0d83('0x4b')]:_0xa4e352[_0x0d83('0x45')];if(!_0x451a01[_0x0d83('0x46')]['hasOwnProperty'](_0x0d83('0x4d'))){_0x263e14[_0x0d83('0x33')]=qs[_0x0d83('0x33')](_0x451a01['query'][_0x0d83('0x33')]);_0x263e14['offset']=qs['offset'](_0x451a01[_0x0d83('0x46')]['offset']);}_0x263e14[_0x0d83('0x4e')]=qs[_0x0d83('0x4f')](_0x451a01[_0x0d83('0x46')][_0x0d83('0x4f')]);_0x263e14[_0x0d83('0x50')]=qs[_0x0d83('0x48')](_[_0x0d83('0x51')](_0x451a01['query'],_0xa4e352[_0x0d83('0x48')]),_0x5d0677);if(_0x451a01['query'][_0x0d83('0x52')]){_0x263e14[_0x0d83('0x50')]=_['merge'](_0x263e14['where'],{'$or':_['map'](_0x5d0677,function(_0x45fcc1){if(_0x45fcc1[_0x0d83('0x43')]!==_0x0d83('0x53')){var _0x2d9d48={};_0x2d9d48[_0x45fcc1['name']]={'$like':'%'+_0x451a01['query'][_0x0d83('0x52')]+'%'};return _0x2d9d48;}})});}_0x263e14=_[_0x0d83('0x54')]({},_0x263e14,_0x451a01[_0x0d83('0x55')]);var _0x288794={'where':_0x263e14[_0x0d83('0x50')]};return db[_0x0d83('0x41')][_0x0d83('0x34')](_0x288794)[_0x0d83('0x3c')](function(_0x19b787){_0x22cc8e[_0x0d83('0x34')]=_0x19b787;if(_0x451a01[_0x0d83('0x46')][_0x0d83('0x56')]){_0x263e14[_0x0d83('0x57')]=[{'all':!![]}];}return db[_0x0d83('0x41')][_0x0d83('0x58')](_0x263e14);})[_0x0d83('0x3c')](function(_0x17a3e7){_0x22cc8e[_0x0d83('0x59')]=_0x17a3e7;return _0x22cc8e;})[_0x0d83('0x3c')](respondWithFilteredResult(_0x43876c,_0x263e14))[_0x0d83('0x2c')](handleError(_0x43876c,null));};exports[_0x0d83('0x5a')]=function(_0x17385a,_0x4319dc){var _0x2c5b57={'raw':!![],'where':{'id':_0x17385a[_0x0d83('0x5b')]['id']}},_0x1fb543={};_0x1fb543[_0x0d83('0x45')]=_[_0x0d83('0x47')](db[_0x0d83('0x41')][_0x0d83('0x5c')]);_0x1fb543['query']=_[_0x0d83('0x47')](_0x17385a['query']);_0x1fb543[_0x0d83('0x48')]=_[_0x0d83('0x49')](_0x1fb543[_0x0d83('0x45')],_0x1fb543[_0x0d83('0x46')]);_0x2c5b57[_0x0d83('0x4b')]=_['intersection'](_0x1fb543[_0x0d83('0x45')],qs[_0x0d83('0x4a')](_0x17385a[_0x0d83('0x46')][_0x0d83('0x4a')]));_0x2c5b57[_0x0d83('0x4b')]=_0x2c5b57[_0x0d83('0x4b')]['length']?_0x2c5b57[_0x0d83('0x4b')]:_0x1fb543[_0x0d83('0x45')];if(_0x17385a[_0x0d83('0x46')][_0x0d83('0x56')]){_0x2c5b57[_0x0d83('0x57')]=[{'all':!![]}];}_0x2c5b57=_['merge']({},_0x2c5b57,_0x17385a[_0x0d83('0x55')]);return db[_0x0d83('0x41')][_0x0d83('0x5d')](_0x2c5b57)[_0x0d83('0x3c')](handleEntityNotFound(_0x4319dc,null))[_0x0d83('0x3c')](respondWithResult(_0x4319dc,null))['catch'](handleError(_0x4319dc,null));};exports[_0x0d83('0x5e')]=function(_0x39a2a1,_0x3b7992){return db[_0x0d83('0x41')][_0x0d83('0x5e')](_0x39a2a1[_0x0d83('0x5f')],{})[_0x0d83('0x3c')](respondWithResult(_0x3b7992,0xc9))['catch'](handleError(_0x3b7992,null));};exports[_0x0d83('0x3a')]=function(_0x24f7d7,_0x33a6d2){if(_0x24f7d7[_0x0d83('0x5f')]['id']){delete _0x24f7d7[_0x0d83('0x5f')]['id'];}return db[_0x0d83('0x41')]['find']({'where':{'id':_0x24f7d7[_0x0d83('0x5b')]['id']}})[_0x0d83('0x3c')](handleEntityNotFound(_0x33a6d2,null))[_0x0d83('0x3c')](saveUpdates(_0x24f7d7[_0x0d83('0x5f')],null))['then'](respondWithResult(_0x33a6d2,null))[_0x0d83('0x2c')](handleError(_0x33a6d2,null));};exports[_0x0d83('0x3b')]=function(_0x1d934c,_0x1b3b3e){return db[_0x0d83('0x41')]['find']({'where':{'id':_0x1d934c[_0x0d83('0x5b')]['id']}})[_0x0d83('0x3c')](handleEntityNotFound(_0x1b3b3e,null))[_0x0d83('0x3c')](removeEntity(_0x1b3b3e,null))['catch'](handleError(_0x1b3b3e,null));};exports[_0x0d83('0x60')]=function(_0x1e02f5,_0x2725d5){return db[_0x0d83('0x41')][_0x0d83('0x60')]()[_0x0d83('0x3c')](respondWithResult(_0x2725d5,null))[_0x0d83('0x2c')](handleError(_0x2725d5,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x0d83('0x61')]=function(_0x542283,_0x2995a7,_0x2f43dc){var _0x55f210={'agent':{},'channel':_0x0d83('0x62')};if(_0x542283[_0x0d83('0x5f')]['id']){delete _0x542283[_0x0d83('0x5f')]['id'];}_0x542283[_0x0d83('0x5f')][_0x0d83('0x63')]=!![];_0x542283[_0x0d83('0x5f')][_0x0d83('0x64')]=moment()[_0x0d83('0x65')](_0x0d83('0x66'));_0x542283[_0x0d83('0x5f')]['UserId']=_0x542283[_0x0d83('0x5f')][_0x0d83('0x67')]||_0x542283[_0x0d83('0x68')]['id'];_0x55f210[_0x0d83('0x69')]['id']=_0x542283[_0x0d83('0x5f')]['UserId'];return db['WhatsappMessage'][_0x0d83('0x5d')]({'where':{'id':_0x542283['params']['id'],'UserId':null}})[_0x0d83('0x3c')](handleEntityNotFound(_0x2995a7,null))[_0x0d83('0x3c')](saveUpdates(_0x542283[_0x0d83('0x5f')],null))[_0x0d83('0x3c')](function(_0x857583){if(_0x857583){_0x55f210[_0x0d83('0x2b')]=_0x857583[_0x0d83('0x6a')]({'plain':!![]});return db[_0x0d83('0x6b')][_0x0d83('0x5d')]({'where':{'id':_0x857583['WhatsappInteractionId']}});}return null;})[_0x0d83('0x3c')](handleEntityNotFound(_0x2995a7,null))['then'](function(_0x5ba41c){if(_0x5ba41c){return _0x5ba41c[_0x0d83('0x3a')]({'UserId':_0x542283[_0x0d83('0x5f')][_0x0d83('0x67')],'read1stAt':_[_0x0d83('0x6c')](_0x5ba41c[_0x0d83('0x6d')])?moment()[_0x0d83('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x298919){if(_0x298919){_0x55f210[_0x0d83('0x6e')]=_0x298919[_0x0d83('0x6a')]({'plain':!![]});interaction_log[_0x0d83('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x542283[_0x0d83('0x68')]['id'],_0x542283['user'][_0x0d83('0x3d')],_0x542283[_0x0d83('0x68')][_0x0d83('0x6f')],_0x55f210[_0x0d83('0x6e')]['id'],_0x542283['body']?JSON[_0x0d83('0x29')](_0x542283[_0x0d83('0x5f')]):'null');return respondWithRpcPromise(_0x0d83('0x70'),_0x0d83('0x71'),_0x55f210);}return null;})['then'](function(_0x20976c){var _0xac0134=_0x0d83('0x72')+_0x20976c['message'][_0x0d83('0x73')];return db[_0x0d83('0x74')]['query'](_0xac0134,{'type':db['Sequelize'][_0x0d83('0x75')][_0x0d83('0x76')],'raw':!![]})['then'](function(_0x575591){return _0x575591;});})[_0x0d83('0x3c')](function(_0xb51cf9){if(_0xb51cf9){_0x55f210[_0x0d83('0x2b')][_0x0d83('0x77')]=_0xb51cf9[0x0];if(!_0x542283[_0x0d83('0x5f')][_0x0d83('0x67')])return;return db[_0x0d83('0x78')][_0x0d83('0x5d')]({'where':{'id':_0x542283[_0x0d83('0x5f')][_0x0d83('0x67')],'role':_0x0d83('0x69')},'attributes':['id',_0x0d83('0x3d'),_0x0d83('0x79'),_0x0d83('0x7a'),'internal'],'raw':!![]});}return null;})[_0x0d83('0x3c')](function(_0x17a5af){if(!_0x17a5af)return null;_0x55f210[_0x0d83('0x2b')]['agent']=_0x17a5af;return _0x55f210;})[_0x0d83('0x3c')](function(_0x2d0876){if(_0x2d0876){if(_0x542283[_0x0d83('0x5f')][_0x0d83('0x7b')]){_0x55f210[_0x0d83('0x2b')][_0x0d83('0x7c')]=util[_0x0d83('0x65')](_0x0d83('0x7d'),_0x542283['user'][_0x0d83('0x3d')]);_0x55f210[_0x0d83('0x2b')]['channel']=_0x55f210[_0x0d83('0x7e')];_0x55f210['message'][_0x0d83('0x7f')]=_0x55f210[_0x0d83('0x7e')];_0x55f210[_0x0d83('0x2b')][_0x0d83('0x80')]=_0x0d83('0x61');return respondWithRpcPromise(_0x0d83('0x81'),_0x0d83('0x81'),{'event':_0x0d83('0x82'),'message':_0x55f210[_0x0d83('0x2b')]},client9002)['then'](function(){return _0x55f210;});}return _0x55f210;}return null;})[_0x0d83('0x3c')](respondWithResult(_0x2995a7,null))['catch'](handleError(_0x2995a7,null));};var interaction_log=require(_0x0d83('0x17'))(_0x0d83('0x83'));exports[_0x0d83('0x38')]=function(_0x3e10c2,_0x11aa0c,_0xe574d2){var _0x2a61fa={'agent':{},'channel':_0x0d83('0x62')};if(_0x3e10c2['body']['id']){delete _0x3e10c2[_0x0d83('0x5f')]['id'];}_0x3e10c2[_0x0d83('0x5f')]['UserId']=_0x3e10c2[_0x0d83('0x5f')][_0x0d83('0x67')]||_0x3e10c2['user']['id'];_0x2a61fa[_0x0d83('0x69')]['id']=_0x3e10c2['body']['UserId'];return db['WhatsappMessage'][_0x0d83('0x5d')]({'where':{'id':_0x3e10c2['params']['id'],'UserId':null}})[_0x0d83('0x3c')](handleEntityNotFound(_0x11aa0c,null))[_0x0d83('0x3c')](function(_0x276309){if(_0x276309){_0x2a61fa[_0x0d83('0x2b')]=_0x276309['get']({'plain':!![]});return db[_0x0d83('0x6b')][_0x0d83('0x5d')]({'where':{'id':_0x276309[_0x0d83('0x84')]}});}return null;})[_0x0d83('0x3c')](handleEntityNotFound(_0x11aa0c,null))['then'](function(_0x3834b0){if(_0x3834b0){_0x2a61fa['interaction']=_0x3834b0[_0x0d83('0x6a')]({'plain':!![]});interaction_log[_0x0d83('0x24')](_0x0d83('0x85'),_0x3e10c2[_0x0d83('0x68')]['id'],_0x3e10c2['user'][_0x0d83('0x3d')],_0x3e10c2[_0x0d83('0x68')][_0x0d83('0x6f')],_0x2a61fa[_0x0d83('0x6e')]['id'],_0x3e10c2[_0x0d83('0x5f')]?JSON[_0x0d83('0x29')](_0x3e10c2[_0x0d83('0x5f')]):_0x0d83('0x86'));return respondWithRpcPromise(_0x0d83('0x87'),_0x0d83('0x88'),_0x2a61fa);}return null;})[_0x0d83('0x3c')](function(_0x622585){var _0x1b255f=_0x0d83('0x72')+_0x622585[_0x0d83('0x2b')][_0x0d83('0x73')];return db[_0x0d83('0x74')][_0x0d83('0x46')](_0x1b255f,{'type':db[_0x0d83('0x89')][_0x0d83('0x75')][_0x0d83('0x76')],'raw':!![]})[_0x0d83('0x3c')](function(_0x5986d1){return _0x5986d1;});})['then'](function(_0x167dc9){if(_0x167dc9){_0x2a61fa[_0x0d83('0x2b')]['contact']=_0x167dc9[0x0];if(!_0x3e10c2[_0x0d83('0x5f')][_0x0d83('0x67')])return;return db['User']['find']({'where':{'id':_0x3e10c2['body']['UserId'],'role':_0x0d83('0x69')},'attributes':['id','name',_0x0d83('0x79'),_0x0d83('0x7a'),'internal'],'raw':!![]});}return null;})[_0x0d83('0x3c')](function(_0x1d32ad){if(!_0x1d32ad)return null;_0x2a61fa[_0x0d83('0x2b')]['agent']=_0x1d32ad;return _0x2a61fa;})['then'](function(_0x37f417){if(_0x37f417){_0x37f417[_0x0d83('0x2b')][_0x0d83('0x7c')]=util[_0x0d83('0x65')](_0x0d83('0x7d'),_0x3e10c2[_0x0d83('0x68')]['name']);_0x37f417[_0x0d83('0x2b')]['channel']=_0x2a61fa[_0x0d83('0x7e')];_0x37f417[_0x0d83('0x2b')][_0x0d83('0x7f')]=_0x2a61fa[_0x0d83('0x7e')];_0x37f417['message'][_0x0d83('0x80')]=_0x0d83('0x38');respondWithRpcPromise(_0x0d83('0x81'),_0x0d83('0x81'),{'event':'rejectmessage','message':_0x37f417[_0x0d83('0x2b')]},client9002);return _0x2a61fa;}return null;})[_0x0d83('0x3c')](respondWithResult(_0x11aa0c,null))[_0x0d83('0x2c')](handleError(_0x11aa0c,null));};exports['status']=function(_0x4c015b,_0x275565,_0x4a01fd){if(_0x4c015b[_0x0d83('0x5f')]['id']){delete _0x4c015b[_0x0d83('0x5f')]['id'];}var _0x465a64;return db[_0x0d83('0x41')][_0x0d83('0x5d')]({'where':{'id':_0x4c015b[_0x0d83('0x5b')]['id']}})[_0x0d83('0x3c')](handleEntityNotFound(_0x275565,null))['then'](function(_0x3422ff){if(_0x3422ff){_0x465a64=_0x3422ff;return db[_0x0d83('0x8a')]['find']({'where':{'id':_0x3422ff[_0x0d83('0x8b')]}});}})[_0x0d83('0x3c')](handleEntityNotFound(_0x275565,null))['then'](function(_0x3c34d9){if(_0x3c34d9){logger[_0x0d83('0x27')](_0x0d83('0x8c'),_0x0d83('0x2e'),_0x0d83('0x8d'),_0x3c34d9[_0x0d83('0x43')],util['inspect'](_0x4c015b[_0x0d83('0x5f')],{'showHidden':![],'depth':null}));switch(_0x3c34d9['type']){case _0x0d83('0x8e'):if(_0x4c015b[_0x0d83('0x5f')][_0x0d83('0x8f')]&&_0x4c015b[_0x0d83('0x5f')][_0x0d83('0x8f')]===_0x465a64[_0x0d83('0x90')]&&_0x4c015b['body'][_0x0d83('0x91')]&&_0x4c015b[_0x0d83('0x5f')][_0x0d83('0x91')]===_0x0d83('0x63')){return _0x465a64[_0x0d83('0x3a')]({'read':!![]});}else{logger[_0x0d83('0x2a')](_0x0d83('0x92'),_0x0d83('0x2e'),_0x0d83('0x8e'),util['inspect'](_0x4c015b['body'],{'showHidden':![],'depth':null}));}break;}return _0x465a64;}})[_0x0d83('0x3c')](respondWithResult(_0x275565,null))['catch'](handleError(_0x275565,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a8bc0e0..5f40405 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 _0x765e=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x5d44cc,_0x2a6fbc){var _0xf1346e=function(_0x3ba106){while(--_0x3ba106){_0x5d44cc['push'](_0x5d44cc['shift']());}};_0xf1346e(++_0x2a6fbc);}(_0x765e,0x131));var _0xe765=function(_0x55ef97,_0x153c0d){_0x55ef97=_0x55ef97-0x0;var _0x9b4ed9=_0x765e[_0x55ef97];return _0x9b4ed9;};'use strict';var EventEmitter=require(_0xe765('0x0'));var WhatsappMessage=require(_0xe765('0x1'))['db'][_0xe765('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe765('0x3')](0x0);var events={'afterCreate':_0xe765('0x4'),'afterUpdate':_0xe765('0x5'),'afterDestroy':_0xe765('0x6')};function emitEvent(_0x38d6d2){return function(_0x30703f,_0xd2e232,_0x9559d4){WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2+':'+_0x30703f['id'],_0x30703f);WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2,_0x30703f);_0x9559d4(null);};}for(var e in events){if(events[_0xe765('0x8')](e)){var event=events[e];WhatsappMessage[_0xe765('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x7894=['WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7894,0x170));var _0x4789=function(_0x3f0473,_0x3d11d3){_0x3f0473=_0x3f0473-0x0;var _0x5f1c0c=_0x7894[_0x3f0473];return _0x5f1c0c;};'use strict';var EventEmitter=require(_0x4789('0x0'));var WhatsappMessage=require(_0x4789('0x1'))['db'][_0x4789('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4789('0x3')](0x0);var events={'afterCreate':_0x4789('0x4'),'afterUpdate':_0x4789('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd4bd76){return function(_0x2b2dd3,_0x4e2393,_0x3394f6){WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76+':'+_0x2b2dd3['id'],_0x2b2dd3);WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76,_0x2b2dd3);_0x3394f6(null);};}for(var e in events){if(events[_0x4789('0x7')](e)){var event=events[e];WhatsappMessage[_0x4789('0x8')](e,emitEvent(event));}}module[_0x4789('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 8e8b33f..b1432f9 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 _0x7ad3=['update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/messages/','text','POST','Bearer\x20','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','phone','messages','create','body','whatsapp:','/api/whatsapp/messages/','sid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ad3,0x13e));var _0x37ad=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7ad3[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x37ad('0x0'));var util=require('util');var logger=require(_0x37ad('0x1'))(_0x37ad('0x2'));var moment=require(_0x37ad('0x3'));var BPromise=require(_0x37ad('0x4'));var rp=require(_0x37ad('0x5'));var fetch=require(_0x37ad('0x6'));var fs=require('fs');var path=require(_0x37ad('0x7'));var rimraf=require(_0x37ad('0x8'));var config=require(_0x37ad('0x9'));var attributes=require(_0x37ad('0xa'));module[_0x37ad('0xb')]=function(_0x5d7058,_0xe6953f){return _0x5d7058[_0x37ad('0xc')](_0x37ad('0xd'),attributes,{'tableName':_0x37ad('0xe'),'paranoid':![],'indexes':[{'name':_0x37ad('0xf'),'fields':[_0x37ad('0xf')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x37ad('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x864e54,_0x335a83,_0x1dfcc7){var _0x587096=_0x5d7058[_0x37ad('0x11')];var _0x20041d=_0x864e54['get']({'plain':!![]});if(_0x20041d['direction']['toLowerCase']()==='in'||_0x20041d[_0x37ad('0x12')][_0x37ad('0x13')]()===_0x37ad('0x14')&&!_0x20041d[_0x37ad('0x15')]&&!_[_0x37ad('0x16')](_0x20041d[_0x37ad('0x17')])){_0x587096['WhatsappInteraction'][_0x37ad('0x18')]({'where':{'id':_0x20041d[_0x37ad('0x19')]}})[_0x37ad('0x1a')](function(_0xcf4d23){if(_0xcf4d23){_0xcf4d23['update']({'lastMsgAt':_0x20041d[_0x37ad('0x1b')],'lastMsgDirection':_0x20041d[_0x37ad('0x12')][_0x37ad('0x13')]()});}})[_0x37ad('0x1c')](function(_0x38ccee){console[_0x37ad('0x1d')](_0x38ccee);});}if(_0x20041d[_0x37ad('0x12')]===_0x37ad('0x14')&&!_0x20041d[_0x37ad('0x15')]){var _0x35b03f;_0x587096[_0x37ad('0x1e')][_0x37ad('0x1f')]({'where':{'id':_0x20041d['WhatsappAccountId']},'raw':!![]})[_0x37ad('0x1a')](function(_0x47db43){_0x35b03f=_0x47db43;if(_0x35b03f&&_0x35b03f[_0x37ad('0x20')]){switch(_0x35b03f[_0x37ad('0x20')]){case _0x37ad('0x21'):var _0x421f48=require(_0x37ad('0x21'));if(_0x35b03f[_0x37ad('0x22')]&&_0x35b03f['authToken']&&_0x35b03f[_0x37ad('0x23')]){var _0x1b4211=new _0x421f48(_0x35b03f[_0x37ad('0x22')],_0x35b03f['authToken']);_0x1b4211[_0x37ad('0x24')][_0x37ad('0x25')]({'body':_0x20041d[_0x37ad('0x26')],'to':_0x37ad('0x27')+_0x20041d[_0x37ad('0x23')],'from':_0x37ad('0x27')+_0x35b03f['phone'],'statusCallback':_0x35b03f['remote']+_0x37ad('0x28')+_0x20041d['id']+'/status?token='+_0x35b03f['token']})[_0x37ad('0x1a')](function(_0x87cefa){if(_0x87cefa[_0x37ad('0x29')]){return _0x864e54[_0x37ad('0x2a')]({'messageId':_0x87cefa[_0x37ad('0x29')]});}})[_0x37ad('0x1c')](function(_0x176230){logger['error'](_0x37ad('0x2b'),'afterCreate',_0x37ad('0x21'),util[_0x37ad('0x2c')](_0x176230,{'showHidden':![],'depth':null}));});}else{logger[_0x37ad('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x37ad('0x2d'),_0x37ad('0x21'),_0x37ad('0x2e'));}break;case _0x37ad('0x2f'):var _0x4aef66=_0x35b03f['accountSid'];var _0x4a5176=_0x35b03f[_0x37ad('0x30')];var _0x29e6f2=_0x35b03f[_0x37ad('0x31')]+'/whatsapp/v1/'+_0x4aef66+_0x37ad('0x32');var _0xe944cb={'to':[_0x20041d['phone']],'message':{'type':_0x37ad('0x33'),'text':_0x20041d[_0x37ad('0x26')]}};var _0x27293a={'method':_0x37ad('0x34'),'uri':_0x29e6f2,'headers':{'Authorization':_0x37ad('0x35')+_0x4a5176,'Content-Type':'application/json'},'body':_0xe944cb,'json':!![]};rp(_0x27293a)[_0x37ad('0x1a')](function(_0x336621){if(_0x336621['statuses'][0x0][_0x37ad('0x36')]){return _0x864e54[_0x37ad('0x2a')]({'messageId':_0x336621[_0x37ad('0x37')][0x0][_0x37ad('0x36')]});}})['catch'](function(_0x37e12e){logger['err'](_0x37ad('0x38'),_0x37e12e);});break;}}})[_0x37ad('0x39')](function(){_0x1dfcc7();});}else{_0x1dfcc7();}}},'charset':_0x37ad('0x3a'),'collate':_0x37ad('0x3b')});}; \ No newline at end of file +var _0xe6c5=['/messages/','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','then','update','createdAt','WhatsappAccount','WhatsappAccountId','twilio','accountSid','phone','authToken','messages','body','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl'];(function(_0x7cb173,_0x93d6e8){var _0x5b101f=function(_0x1ebaa2){while(--_0x1ebaa2){_0x7cb173['push'](_0x7cb173['shift']());}};_0x5b101f(++_0x93d6e8);}(_0xe6c5,0x1e8));var _0x5e6c=function(_0x4f4043,_0x534178){_0x4f4043=_0x4f4043-0x0;var _0x14bedd=_0xe6c5[_0x4f4043];return _0x14bedd;};'use strict';var _=require(_0x5e6c('0x0'));var util=require(_0x5e6c('0x1'));var logger=require(_0x5e6c('0x2'))('api');var moment=require(_0x5e6c('0x3'));var BPromise=require(_0x5e6c('0x4'));var rp=require(_0x5e6c('0x5'));var fetch=require(_0x5e6c('0x6'));var fs=require('fs');var path=require(_0x5e6c('0x7'));var rimraf=require(_0x5e6c('0x8'));var config=require('../../config/environment');var attributes=require(_0x5e6c('0x9'));module[_0x5e6c('0xa')]=function(_0x27fa7b,_0x50af96){return _0x27fa7b[_0x5e6c('0xb')](_0x5e6c('0xc'),attributes,{'tableName':_0x5e6c('0xd'),'paranoid':![],'indexes':[{'name':_0x5e6c('0xe'),'fields':[_0x5e6c('0xe')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x5e6c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x310f09,_0x5c917c,_0x3bc405){var _0x230108=_0x27fa7b[_0x5e6c('0x10')];var _0x2a5d8a=_0x310f09['get']({'plain':!![]});if(_0x2a5d8a[_0x5e6c('0x11')][_0x5e6c('0x12')]()==='in'||_0x2a5d8a[_0x5e6c('0x11')]['toLowerCase']()==='out'&&!_0x2a5d8a[_0x5e6c('0x13')]&&!_[_0x5e6c('0x14')](_0x2a5d8a[_0x5e6c('0x15')])){_0x230108['WhatsappInteraction']['findOne']({'where':{'id':_0x2a5d8a['WhatsappInteractionId']}})[_0x5e6c('0x16')](function(_0x4ca45a){if(_0x4ca45a){_0x4ca45a[_0x5e6c('0x17')]({'lastMsgAt':_0x2a5d8a[_0x5e6c('0x18')],'lastMsgDirection':_0x2a5d8a[_0x5e6c('0x11')][_0x5e6c('0x12')]()});}})['catch'](function(_0x51229d){console['error'](_0x51229d);});}if(_0x2a5d8a[_0x5e6c('0x11')]==='out'&&!_0x2a5d8a[_0x5e6c('0x13')]){var _0xa94005;_0x230108[_0x5e6c('0x19')]['find']({'where':{'id':_0x2a5d8a[_0x5e6c('0x1a')]},'raw':!![]})[_0x5e6c('0x16')](function(_0x145b96){_0xa94005=_0x145b96;if(_0xa94005&&_0xa94005['type']){switch(_0xa94005['type']){case _0x5e6c('0x1b'):var _0x313c7d=require(_0x5e6c('0x1b'));if(_0xa94005[_0x5e6c('0x1c')]&&_0xa94005['authToken']&&_0xa94005[_0x5e6c('0x1d')]){var _0xf4b8e0=new _0x313c7d(_0xa94005[_0x5e6c('0x1c')],_0xa94005[_0x5e6c('0x1e')]);_0xf4b8e0[_0x5e6c('0x1f')]['create']({'body':_0x2a5d8a[_0x5e6c('0x20')],'to':'whatsapp:'+_0x2a5d8a[_0x5e6c('0x1d')],'from':_0x5e6c('0x21')+_0xa94005['phone'],'statusCallback':_0xa94005[_0x5e6c('0x22')]+'/api/whatsapp/messages/'+_0x2a5d8a['id']+_0x5e6c('0x23')+_0xa94005[_0x5e6c('0x24')]})[_0x5e6c('0x16')](function(_0x48762e){if(_0x48762e[_0x5e6c('0x25')]){return _0x310f09['update']({'messageId':_0x48762e['sid']});}})['catch'](function(_0x5429ca){logger['error'](_0x5e6c('0x26'),_0x5e6c('0x27'),_0x5e6c('0x1b'),util[_0x5e6c('0x28')](_0x5429ca,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5e6c('0x26'),_0x5e6c('0x27'),_0x5e6c('0x1b'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x8b5df=_0xa94005[_0x5e6c('0x1c')];var _0x350a93=_0xa94005[_0x5e6c('0x1e')];var _0x8ffe79=_0xa94005[_0x5e6c('0x29')]+'/whatsapp/v1/'+_0x8b5df+_0x5e6c('0x2a');var _0x4a8318={'to':[_0x2a5d8a[_0x5e6c('0x1d')]],'message':{'type':'text','text':_0x2a5d8a['body']}};var _0x198772={'method':_0x5e6c('0x2b'),'uri':_0x8ffe79,'headers':{'Authorization':_0x5e6c('0x2c')+_0x350a93,'Content-Type':_0x5e6c('0x2d')},'body':_0x4a8318,'json':!![]};rp(_0x198772)[_0x5e6c('0x16')](function(_0x35518d){if(_0x35518d[_0x5e6c('0x2e')][0x0][_0x5e6c('0x2f')]){return _0x310f09['update']({'messageId':_0x35518d['statuses'][0x0][_0x5e6c('0x2f')]});}})[_0x5e6c('0x30')](function(_0x4d2ce4){logger[_0x5e6c('0x31')]('WhatsappMessage,\x20%s',_0x4d2ce4);});break;}}})[_0x5e6c('0x32')](function(){_0x3bc405();});}else{_0x3bc405();}}},'charset':_0x5e6c('0x33'),'collate':_0x5e6c('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5ba02cb..afb79ac 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 _0x0a72=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','options','raw','CreateWhatsappMessage','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x29ddd4,_0x4a42e3){var _0x49627a=function(_0x350b3d){while(--_0x350b3d){_0x29ddd4['push'](_0x29ddd4['shift']());}};_0x49627a(++_0x4a42e3);}(_0x0a72,0x125));var _0x20a7=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0a72[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x20a7('0x0'));var util=require(_0x20a7('0x1'));var moment=require(_0x20a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x20a7('0x3'));var fs=require('fs');var Redis=require(_0x20a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20a7('0x5'));var logger=require('../../config/logger')(_0x20a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x20a7('0x7'));var client=jayson[_0x20a7('0x8')][_0x20a7('0x9')]({'port':0x232a});config[_0x20a7('0xa')]=_[_0x20a7('0xb')](config['redis'],{'host':_0x20a7('0xc'),'port':0x18eb});var socket=require(_0x20a7('0xd'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x20a7('0xe')](socket);function respondWithRpcPromise(_0x30f350,_0x2a4477,_0x3b9ae1){return new BPromise(function(_0x1fa818,_0x493ae0){return client[_0x20a7('0xf')](_0x30f350,_0x3b9ae1)[_0x20a7('0x10')](function(_0x343ee8){logger[_0x20a7('0x11')](_0x20a7('0x12'),_0x2a4477,_0x20a7('0x13'));logger['debug'](_0x20a7('0x14'),_0x2a4477,_0x20a7('0x13'),JSON[_0x20a7('0x15')](_0x343ee8));if(_0x343ee8[_0x20a7('0x16')]){if(_0x343ee8[_0x20a7('0x16')]['code']===0x1f4){logger[_0x20a7('0x16')](_0x20a7('0x12'),_0x2a4477,_0x343ee8['error'][_0x20a7('0x17')]);return _0x493ae0(_0x343ee8[_0x20a7('0x16')]['message']);}logger[_0x20a7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x343ee8[_0x20a7('0x16')][_0x20a7('0x17')]);return _0x1fa818(_0x343ee8[_0x20a7('0x16')][_0x20a7('0x17')]);}else{logger[_0x20a7('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x20a7('0x13'));_0x1fa818(_0x343ee8[_0x20a7('0x18')][_0x20a7('0x17')]);}})[_0x20a7('0x19')](function(_0x23bddc){logger[_0x20a7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x23bddc);_0x493ae0(_0x23bddc);});});}exports['CreateWhatsappMessage']=function(_0x3ba887){var _0x57b468=this;return new Promise(function(_0x4e31e9,_0x1d5cae){return db['WhatsappMessage'][_0x20a7('0x1a')](_0x3ba887['body'],{'raw':_0x3ba887[_0x20a7('0x1b')]?_0x3ba887[_0x20a7('0x1b')][_0x20a7('0x1c')]===undefined?!![]:![]:!![]})[_0x20a7('0x10')](function(_0x5740d9){logger[_0x20a7('0x11')]('CreateWhatsappMessage',_0x3ba887);logger['debug'](_0x20a7('0x1d'),_0x3ba887,JSON[_0x20a7('0x15')](_0x5740d9));_0x4e31e9(_0x5740d9);})[_0x20a7('0x19')](function(_0x1b46c0){logger[_0x20a7('0x16')]('CreateWhatsappMessage',_0x1b46c0['message'],_0x3ba887);_0x1d5cae(_0x57b468['error'](0x1f4,_0x1b46c0[_0x20a7('0x17')]));});});}; \ No newline at end of file +var _0xb45c=['client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','options','debug','CreateWhatsappMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1728fb,_0x49f68a){var _0x3a7427=function(_0x280f85){while(--_0x280f85){_0x1728fb['push'](_0x1728fb['shift']());}};_0x3a7427(++_0x49f68a);}(_0xb45c,0xee));var _0xcb45=function(_0x5384d2,_0x37278b){_0x5384d2=_0x5384d2-0x0;var _0x5c02d1=_0xb45c[_0x5384d2];return _0x5c02d1;};'use strict';var _=require(_0xcb45('0x0'));var util=require(_0xcb45('0x1'));var moment=require(_0xcb45('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb45('0x3'));var fs=require('fs');var Redis=require(_0xcb45('0x4'));var db=require(_0xcb45('0x5'))['db'];var utils=require(_0xcb45('0x6'));var logger=require('../../config/logger')(_0xcb45('0x7'));var config=require(_0xcb45('0x8'));var jayson=require(_0xcb45('0x9'));var client=jayson[_0xcb45('0xa')][_0xcb45('0xb')]({'port':0x232a});config['redis']=_[_0xcb45('0xc')](config[_0xcb45('0xd')],{'host':_0xcb45('0xe'),'port':0x18eb});var socket=require(_0xcb45('0xf'))(new Redis(config[_0xcb45('0xd')]));require('./whatsappMessage.socket')[_0xcb45('0x10')](socket);function respondWithRpcPromise(_0x3b434,_0x4f8852,_0x3affab){return new BPromise(function(_0x52f828,_0x5d5e19){return client[_0xcb45('0x11')](_0x3b434,_0x3affab)[_0xcb45('0x12')](function(_0x2d4d47){logger[_0xcb45('0x13')](_0xcb45('0x14'),_0x4f8852,_0xcb45('0x15'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4f8852,_0xcb45('0x15'),JSON[_0xcb45('0x16')](_0x2d4d47));if(_0x2d4d47['error']){if(_0x2d4d47['error']['code']===0x1f4){logger[_0xcb45('0x17')](_0xcb45('0x14'),_0x4f8852,_0x2d4d47[_0xcb45('0x17')][_0xcb45('0x18')]);return _0x5d5e19(_0x2d4d47[_0xcb45('0x17')][_0xcb45('0x18')]);}logger[_0xcb45('0x17')](_0xcb45('0x14'),_0x4f8852,_0x2d4d47[_0xcb45('0x17')]['message']);return _0x52f828(_0x2d4d47[_0xcb45('0x17')][_0xcb45('0x18')]);}else{logger[_0xcb45('0x13')](_0xcb45('0x14'),_0x4f8852,_0xcb45('0x15'));_0x52f828(_0x2d4d47[_0xcb45('0x19')][_0xcb45('0x18')]);}})['catch'](function(_0x5dee65){logger['error'](_0xcb45('0x14'),_0x4f8852,_0x5dee65);_0x5d5e19(_0x5dee65);});});}exports['CreateWhatsappMessage']=function(_0x2c4969){var _0x5e7f61=this;return new Promise(function(_0x2f0478,_0x25a6da){return db['WhatsappMessage'][_0xcb45('0x1a')](_0x2c4969['body'],{'raw':_0x2c4969['options']?_0x2c4969[_0xcb45('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xcb45('0x12')](function(_0x4c9567){logger['info']('CreateWhatsappMessage',_0x2c4969);logger[_0xcb45('0x1c')](_0xcb45('0x1d'),_0x2c4969,JSON[_0xcb45('0x16')](_0x4c9567));_0x2f0478(_0x4c9567);})[_0xcb45('0x1e')](function(_0x4e2bf3){logger[_0xcb45('0x17')](_0xcb45('0x1d'),_0x4e2bf3['message'],_0x2c4969);_0x25a6da(_0x5e7f61[_0xcb45('0x17')](0x1f4,_0x4e2bf3[_0xcb45('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index de8d6ac..3d76b77 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 _0x7e8a=['emit','register','length','./whatsappMessage.events','save','remove'];(function(_0x20da96,_0x46fed5){var _0x2cdc39=function(_0x495103){while(--_0x495103){_0x20da96['push'](_0x20da96['shift']());}};_0x2cdc39(++_0x46fed5);}(_0x7e8a,0x1b3));var _0xa7e8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x7e8a[_0x24f31b];return _0x488401;};'use strict';var WhatsappMessageEvents=require(_0xa7e8('0x0'));var events=[_0xa7e8('0x1'),_0xa7e8('0x2'),'update'];function createListener(_0x315cf9,_0xa2fdaa){return function(_0x4333ff){_0xa2fdaa[_0xa7e8('0x3')](_0x315cf9,_0x4333ff);};}function removeListener(_0x448f63,_0x1635ab){return function(){WhatsappMessageEvents['removeListener'](_0x448f63,_0x1635ab);};}exports[_0xa7e8('0x4')]=function(_0xc1ee95){for(var _0x28e954=0x0,_0x17a876=events[_0xa7e8('0x5')];_0x28e954<_0x17a876;_0x28e954++){var _0x3032e8=events[_0x28e954];var _0x21d734=createListener('whatsappMessage:'+_0x3032e8,_0xc1ee95);WhatsappMessageEvents['on'](_0x3032e8,_0x21d734);}}; \ No newline at end of file +var _0x7931=['update','emit','removeListener','register','whatsappMessage:','remove'];(function(_0x40e218,_0x4231a4){var _0x3d9e5a=function(_0x4e9556){while(--_0x4e9556){_0x40e218['push'](_0x40e218['shift']());}};_0x3d9e5a(++_0x4231a4);}(_0x7931,0x185));var _0x1793=function(_0x5c5405,_0x2068d1){_0x5c5405=_0x5c5405-0x0;var _0x391f29=_0x7931[_0x5c5405];return _0x391f29;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x1793('0x0'),_0x1793('0x1')];function createListener(_0x46aa31,_0x542c1f){return function(_0x1c1303){_0x542c1f[_0x1793('0x2')](_0x46aa31,_0x1c1303);};}function removeListener(_0x1c1951,_0x853ed1){return function(){WhatsappMessageEvents[_0x1793('0x3')](_0x1c1951,_0x853ed1);};}exports[_0x1793('0x4')]=function(_0x2672a7){for(var _0xc94db5=0x0,_0x1092ce=events['length'];_0xc94db5<_0x1092ce;_0xc94db5++){var _0x1f867c=events[_0xc94db5];var _0x352d50=createListener(_0x1793('0x5')+_0x1f867c,_0x2672a7);WhatsappMessageEvents['on'](_0x1f867c,_0x352d50);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ddc7250..4fdb987 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 _0x9f10=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','put','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9f10,0x72));var _0x09f1=function(_0xff55fc,_0xab4d88){_0xff55fc=_0xff55fc-0x0;var _0x157926=_0x9f10[_0xff55fc];return _0x157926;};'use strict';var multer=require('multer');var util=require(_0x09f1('0x0'));var path=require(_0x09f1('0x1'));var timeout=require(_0x09f1('0x2'));var express=require(_0x09f1('0x3'));var router=express['Router']();var fs_extra=require(_0x09f1('0x4'));var auth=require(_0x09f1('0x5'));var interaction=require(_0x09f1('0x6'));var config=require(_0x09f1('0x7'));var controller=require(_0x09f1('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x09f1('0x9')](),controller['describe']);router[_0x09f1('0xa')](_0x09f1('0xb'),auth[_0x09f1('0x9')](),controller[_0x09f1('0xc')]);router[_0x09f1('0xa')]('/:id/members',auth[_0x09f1('0x9')](),controller[_0x09f1('0xd')]);router[_0x09f1('0xa')](_0x09f1('0xe'),auth[_0x09f1('0x9')](),controller['getTeams']);router[_0x09f1('0xa')](_0x09f1('0xf'),auth['isAuthenticated'](),controller[_0x09f1('0x10')]);router['post']('/',auth[_0x09f1('0x9')](),controller['create']);router[_0x09f1('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x09f1('0x11')](_0x09f1('0xf'),auth[_0x09f1('0x9')](),controller['addAgents']);router[_0x09f1('0x12')](_0x09f1('0xb'),auth['isAuthenticated'](),controller[_0x09f1('0x13')]);router['delete'](_0x09f1('0xb'),auth[_0x09f1('0x9')](),controller[_0x09f1('0x14')]);router[_0x09f1('0x15')](_0x09f1('0xe'),auth[_0x09f1('0x9')](),controller[_0x09f1('0x16')]);router[_0x09f1('0x15')](_0x09f1('0xf'),auth[_0x09f1('0x9')](),controller['removeAgents']);module[_0x09f1('0x17')]=router; \ No newline at end of file +var _0xfc31=['delete','removeTeams','removeAgents','multer','util','path','express','fs-extra','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update'];(function(_0x47c989,_0x2f9375){var _0x313538=function(_0x4536ff){while(--_0x4536ff){_0x47c989['push'](_0x47c989['shift']());}};_0x313538(++_0x2f9375);}(_0xfc31,0x121));var _0x1fc3=function(_0x1de813,_0x35bc14){_0x1de813=_0x1de813-0x0;var _0x2e0670=_0xfc31[_0x1de813];return _0x2e0670;};'use strict';var multer=require(_0x1fc3('0x0'));var util=require(_0x1fc3('0x1'));var path=require(_0x1fc3('0x2'));var timeout=require('connect-timeout');var express=require(_0x1fc3('0x3'));var router=express['Router']();var fs_extra=require(_0x1fc3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1fc3('0x5'));var config=require('../../config/environment');var controller=require(_0x1fc3('0x6'));router[_0x1fc3('0x7')]('/',auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x9')]);router[_0x1fc3('0x7')](_0x1fc3('0xa'),auth[_0x1fc3('0x8')](),controller[_0x1fc3('0xb')]);router[_0x1fc3('0x7')](_0x1fc3('0xc'),auth[_0x1fc3('0x8')](),controller[_0x1fc3('0xd')]);router[_0x1fc3('0x7')](_0x1fc3('0xe'),auth[_0x1fc3('0x8')](),controller['getMembers']);router[_0x1fc3('0x7')](_0x1fc3('0xf'),auth[_0x1fc3('0x8')](),controller['getTeams']);router['get'](_0x1fc3('0x10'),auth['isAuthenticated'](),controller[_0x1fc3('0x11')]);router[_0x1fc3('0x12')]('/',auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x1fc3('0x12')](_0x1fc3('0x10'),auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x14')]);router[_0x1fc3('0x15')]('/:id',auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x16')]);router[_0x1fc3('0x17')]('/:id',auth[_0x1fc3('0x8')](),controller['destroy']);router[_0x1fc3('0x17')](_0x1fc3('0xf'),auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x18')]);router[_0x1fc3('0x17')](_0x1fc3('0x10'),auth[_0x1fc3('0x8')](),controller[_0x1fc3('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 879c622..5e448a4 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 _0x87f8=['rrmemory','roundrobin','STRING','name','INTEGER'];(function(_0x45982a,_0x1f2be4){var _0x59a372=function(_0x1f8ab2){while(--_0x1f8ab2){_0x45982a['push'](_0x45982a['shift']());}};_0x59a372(++_0x1f2be4);}(_0x87f8,0x152));var _0x887f=function(_0x19c249,_0x5f3cca){_0x19c249=_0x19c249-0x0;var _0x193b0e=_0x87f8[_0x19c249];return _0x193b0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x887f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x887f('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x887f('0x2'),'beepall',_0x887f('0x3'))},'description':{'type':Sequelize[_0x887f('0x4')]}}; \ No newline at end of file +var _0xc817=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xc817,0x75));var _0x7c81=function(_0x4e6b9c,_0x42d14d){_0x4e6b9c=_0x4e6b9c-0x0;var _0x409757=_0xc817[_0x4e6b9c];return _0x409757;};'use strict';var Sequelize=require(_0x7c81('0x0'));module[_0x7c81('0x1')]={'name':{'type':Sequelize[_0x7c81('0x2')],'unique':_0x7c81('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c81('0x4')](_0x7c81('0x5'),_0x7c81('0x6'),_0x7c81('0x7'))},'description':{'type':Sequelize[_0x7c81('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 3699493..1b7f9bc 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 _0x0860=['UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','getOptions','where','include','query','WhatsappQueue','findAll','rows','show','params','model','keys','attributes','intersection','fields','length','includeAll','merge','options','find','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','sort','pick','filter','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','findOne','Team','order','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','destroy','then','get'];(function(_0x4ad6b2,_0x5158d3){var _0x4cc8ae=function(_0x47e001){while(--_0x47e001){_0x4ad6b2['push'](_0x4ad6b2['shift']());}};_0x4cc8ae(++_0x5158d3);}(_0x0860,0xda));var _0x0086=function(_0x24d3d4,_0x1f5294){_0x24d3d4=_0x24d3d4-0x0;var _0x24603f=_0x0860[_0x24d3d4];return _0x24603f;};'use strict';var BPromise=require('bluebird');var util=require(_0x0086('0x0'));var _=require(_0x0086('0x1'));var squel=require(_0x0086('0x2'));var Redis=require(_0x0086('0x3'));var qs=require(_0x0086('0x4'));var logger=require('../../config/logger')(_0x0086('0x5'));var config=require(_0x0086('0x6'));var db=require(_0x0086('0x7'))['db'];config[_0x0086('0x8')]=_[_0x0086('0x9')](config[_0x0086('0x8')],{'host':_0x0086('0xa'),'port':0x18eb});var socket=require(_0x0086('0xb'))(new Redis(config[_0x0086('0x8')]));require('./whatsappQueue.socket')[_0x0086('0xc')](socket);function respondWithStatusCode(_0x3b1cc7,_0x257979){_0x257979=_0x257979||0xcc;return function(_0x6150a7){if(_0x6150a7){return _0x3b1cc7[_0x0086('0xd')](_0x257979);}return _0x3b1cc7[_0x0086('0xe')](_0x257979)[_0x0086('0xf')]();};}function respondWithResult(_0xc55f41,_0x2f4a9a){_0x2f4a9a=_0x2f4a9a||0xc8;return function(_0x4b319a){if(_0x4b319a){return _0xc55f41[_0x0086('0xe')](_0x2f4a9a)[_0x0086('0x10')](_0x4b319a);}};}function respondWithFilteredResult(_0x1b9931,_0x1fcc34){return function(_0x1d48a5){if(_0x1d48a5){var _0x8ac967=typeof _0x1fcc34['offset']==='undefined'&&typeof _0x1fcc34[_0x0086('0x11')]===_0x0086('0x12');var _0x1d5cae=_0x1d48a5['count'];var _0x33520e=_0x8ac967?0x0:_0x1fcc34[_0x0086('0x13')];var _0xf2af7=_0x8ac967?_0x1d48a5[_0x0086('0x14')]:_0x1fcc34[_0x0086('0x13')]+_0x1fcc34[_0x0086('0x11')];var _0x2dad9f;if(_0xf2af7>=_0x1d5cae){_0xf2af7=_0x1d5cae;_0x2dad9f=0xc8;}else{_0x2dad9f=0xce;}_0x1b9931['status'](_0x2dad9f);return _0x1b9931[_0x0086('0x15')](_0x0086('0x16'),_0x33520e+'-'+_0xf2af7+'/'+_0x1d5cae)[_0x0086('0x10')](_0x1d48a5);}return null;};}function saveUpdates(_0x37ad1b){return function(_0x1b55de){if(_0x1b55de){return _0x1b55de['update'](_0x37ad1b)['then'](function(_0x2b2736){return _0x2b2736;});}return null;};}function removeEntity(_0x5b6bbd){return function(_0x58408f){if(_0x58408f){return _0x58408f[_0x0086('0x17')]()[_0x0086('0x18')](function(){var _0x3c9055=_0x58408f[_0x0086('0x19')]({'plain':!![]});var _0x39c774='WhatsappQueues';return db[_0x0086('0x1a')][_0x0086('0x17')]({'where':{'type':_0x39c774,'resourceId':_0x3c9055['id']}})[_0x0086('0x18')](function(){return _0x58408f;});})['then'](function(){_0x5b6bbd['status'](0xcc)[_0x0086('0xf')]();});}};}function handleEntityNotFound(_0x10d4aa){return function(_0x3d0541){if(!_0x3d0541){_0x10d4aa['sendStatus'](0x194);}return _0x3d0541;};}function handleError(_0x61cb84,_0x36cd09){_0x36cd09=_0x36cd09||0x1f4;return function(_0x30699b){logger[_0x0086('0x1b')](_0x30699b[_0x0086('0x1c')]);if(_0x30699b['name']){delete _0x30699b[_0x0086('0x1d')];}_0x61cb84[_0x0086('0xe')](_0x36cd09)[_0x0086('0x1e')](_0x30699b);};}exports[_0x0086('0x1f')]=function(_0x541cf8,_0x44953c){var _0xa49445={};var _0x1641d1={'count':0x0,'rows':[]};var _0x281b8c=_[_0x0086('0x20')](db['WhatsappQueue'][_0x0086('0x21')],function(_0x2203d0){return{'name':_0x2203d0[_0x0086('0x22')],'type':_0x2203d0['type']['key']};});_0xa49445=qs[_0x0086('0x23')](_0x281b8c,_0x541cf8);var _0x5b41ad={'where':_0xa49445[_0x0086('0x24')]};return db['WhatsappQueue'][_0x0086('0x14')](_0x5b41ad)[_0x0086('0x18')](function(_0x48b702){_0x1641d1[_0x0086('0x14')]=_0x48b702;_0xa49445[_0x0086('0x25')]=qs[_0x0086('0x25')](_0x541cf8[_0x0086('0x26')]);return db[_0x0086('0x27')][_0x0086('0x28')](_0xa49445);})['then'](function(_0x15d856){_0x1641d1[_0x0086('0x29')]=_0x15d856;return _0x1641d1;})['then'](respondWithFilteredResult(_0x44953c,_0xa49445))['catch'](handleError(_0x44953c,null));};exports[_0x0086('0x2a')]=function(_0x357fd0,_0x554b17){var _0x3a41d1={'raw':!![],'where':{'id':_0x357fd0[_0x0086('0x2b')]['id']}},_0x53e6e1={};_0x53e6e1[_0x0086('0x2c')]=_[_0x0086('0x2d')](db['WhatsappQueue']['rawAttributes']);_0x53e6e1[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x357fd0[_0x0086('0x26')]);_0x53e6e1['filters']=_['intersection'](_0x53e6e1[_0x0086('0x2c')],_0x53e6e1[_0x0086('0x26')]);_0x3a41d1[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x53e6e1[_0x0086('0x2c')],qs['fields'](_0x357fd0[_0x0086('0x26')][_0x0086('0x30')]));_0x3a41d1[_0x0086('0x2e')]=_0x3a41d1[_0x0086('0x2e')][_0x0086('0x31')]?_0x3a41d1['attributes']:_0x53e6e1['model'];if(_0x357fd0[_0x0086('0x26')][_0x0086('0x32')]){_0x3a41d1[_0x0086('0x25')]=[{'all':!![]}];}_0x3a41d1=_[_0x0086('0x33')]({},_0x3a41d1,_0x357fd0[_0x0086('0x34')]);return db[_0x0086('0x27')][_0x0086('0x35')](_0x3a41d1)['then'](handleEntityNotFound(_0x554b17,null))['then'](respondWithResult(_0x554b17,null))['catch'](handleError(_0x554b17,null));};exports['create']=function(_0x18f9fb,_0x49fb4b){return db[_0x0086('0x27')]['create'](_0x18f9fb['body'],{})[_0x0086('0x18')](function(_0x484823){var _0x2dc019=_0x18f9fb[_0x0086('0x36')][_0x0086('0x19')]({'plain':!![]});if(!_0x2dc019)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dc019[_0x0086('0x37')]==='user'){var _0x282bfa=_0x484823[_0x0086('0x19')]({'plain':!![]});var _0xe88248=_0x0086('0x38');return db[_0x0086('0x39')][_0x0086('0x35')]({'where':{'name':_0xe88248,'userProfileId':_0x2dc019[_0x0086('0x3a')]},'raw':!![]})['then'](function(_0x1c0d22){if(_0x1c0d22&&_0x1c0d22[_0x0086('0x3b')]===0x0){return db[_0x0086('0x1a')]['create']({'name':_0x282bfa['name'],'resourceId':_0x282bfa['id'],'type':_0x1c0d22[_0x0086('0x1d')],'sectionId':_0x1c0d22['id']},{})[_0x0086('0x18')](function(){return _0x484823;});}else{return _0x484823;}})[_0x0086('0x3c')](function(_0x1c8d4e){logger[_0x0086('0x1b')](_0x0086('0x3d'),_0x1c8d4e);throw _0x1c8d4e;});}return _0x484823;})['then'](respondWithResult(_0x49fb4b,0xc9))[_0x0086('0x3c')](handleError(_0x49fb4b,null));};exports[_0x0086('0x3e')]=function(_0xb11585,_0x29b83c){if(_0xb11585[_0x0086('0x3f')]['id']){delete _0xb11585[_0x0086('0x3f')]['id'];}return db[_0x0086('0x27')][_0x0086('0x35')]({'where':{'id':_0xb11585['params']['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x29b83c,null))[_0x0086('0x18')](saveUpdates(_0xb11585[_0x0086('0x3f')],null))[_0x0086('0x18')](respondWithResult(_0x29b83c,null))[_0x0086('0x3c')](handleError(_0x29b83c,null));};exports['destroy']=function(_0x22bf70,_0xacc716){return db[_0x0086('0x27')]['find']({'where':{'id':_0x22bf70[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0xacc716,null))[_0x0086('0x18')](removeEntity(_0xacc716,null))[_0x0086('0x3c')](handleError(_0xacc716,null));};exports['describe']=function(_0x57a92a,_0x3a467c){return db[_0x0086('0x27')][_0x0086('0x40')]()[_0x0086('0x18')](respondWithResult(_0x3a467c,null))[_0x0086('0x3c')](handleError(_0x3a467c,null));};exports[_0x0086('0x41')]=function(_0x543863,_0x5726b6){var _0x59d9bb={'raw':!![],'where':{}},_0x5105e3={},_0x431a8b;return db[_0x0086('0x27')]['findOne']({'where':{'id':_0x543863[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x5726b6,null))[_0x0086('0x18')](function(_0x114458){if(_0x114458){_0x431a8b=_0x114458[_0x0086('0x19')]({'plain':!![]});_0x5105e3['model']=_[_0x0086('0x2d')](db[_0x0086('0x42')][_0x0086('0x21')]);_0x5105e3[_0x0086('0x26')]=_['keys'](_0x543863[_0x0086('0x26')]);_0x5105e3[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x5105e3[_0x0086('0x2c')],_0x5105e3['query']);_0x59d9bb[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x5105e3[_0x0086('0x2c')],qs[_0x0086('0x30')](_0x543863[_0x0086('0x26')][_0x0086('0x30')]));_0x59d9bb['attributes']=_0x59d9bb['attributes'][_0x0086('0x31')]?_0x59d9bb[_0x0086('0x2e')]:_0x5105e3[_0x0086('0x2c')];if(!_0x543863[_0x0086('0x26')][_0x0086('0x44')]('nolimit')){_0x59d9bb['limit']=qs[_0x0086('0x11')](_0x543863[_0x0086('0x26')]['limit']);_0x59d9bb[_0x0086('0x13')]=qs[_0x0086('0x13')](_0x543863[_0x0086('0x26')]['offset']);}_0x59d9bb['order']=qs[_0x0086('0x45')](_0x543863[_0x0086('0x26')][_0x0086('0x45')]);_0x59d9bb['where']=qs['filters'](_[_0x0086('0x46')](_0x543863[_0x0086('0x26')],_0x5105e3[_0x0086('0x43')]));_0x59d9bb[_0x0086('0x24')]['WhatsappQueueId']=_0x114458['id'];if(_0x543863[_0x0086('0x26')][_0x0086('0x47')]){_0x59d9bb[_0x0086('0x24')]=_[_0x0086('0x33')](_0x59d9bb[_0x0086('0x24')],{'$or':_[_0x0086('0x20')](_0x59d9bb[_0x0086('0x2e')],function(_0x14c19a){var _0x49e2ad={};_0x49e2ad[_0x14c19a]={'$like':'%'+_0x543863[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x49e2ad;})});}_0x59d9bb=_[_0x0086('0x33')]({},_0x59d9bb,_0x543863[_0x0086('0x34')]);return db['UserWhatsappQueue'][_0x0086('0x28')](_0x59d9bb);}})['then'](function(_0x10826c){if(_0x10826c){return db['User'][_0x0086('0x48')]({'where':{'id':_[_0x0086('0x20')](_0x10826c,_0x0086('0x49')),'role':_0x0086('0x4a')},'attributes':['id',_0x0086('0x1d'),_0x0086('0x4b'),_0x0086('0x4c'),_0x0086('0x4d')]});}})[_0x0086('0x18')](function(_0x254720){if(_0x254720){return{'count':_0x254720['count'],'rows':_['map'](_0x254720['rows'],function(_0x44ee88){return{'membername':_0x44ee88[_0x0086('0x1d')],'UserId':_0x44ee88['id'],'queue_name':_0x431a8b[_0x0086('0x1d')],'WhatsappQueueId':_0x431a8b['id'],'interface':util['format']('%s/%s','SIP',_0x44ee88['name']),'penalty':0x0,'paused':_0x44ee88[_0x0086('0x4b')],'createdAt':_0x44ee88[_0x0086('0x4d')],'updatedAt':_0x44ee88[_0x0086('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0086('0x18')](respondWithFilteredResult(_0x5726b6,_0x59d9bb))[_0x0086('0x3c')](handleError(_0x5726b6,null));};exports['getTeams']=function(_0x2fc28b,_0x13f175){var _0x40fcc1={};var _0x577fe9={};var _0x4ccb55;var _0x2d25e6;return db['WhatsappQueue'][_0x0086('0x4e')]({'where':{'id':_0x2fc28b[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x13f175,null))['then'](function(_0x43b1d9){if(_0x43b1d9){_0x4ccb55=_0x43b1d9;_0x577fe9[_0x0086('0x2c')]=_[_0x0086('0x2d')](db[_0x0086('0x4f')][_0x0086('0x21')]);_0x577fe9[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x2fc28b['query']);_0x577fe9[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x577fe9['model'],_0x577fe9[_0x0086('0x26')]);_0x40fcc1[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x577fe9[_0x0086('0x2c')],qs[_0x0086('0x30')](_0x2fc28b[_0x0086('0x26')][_0x0086('0x30')]));_0x40fcc1['attributes']=_0x40fcc1[_0x0086('0x2e')]['length']?_0x40fcc1['attributes']:_0x577fe9['model'];_0x40fcc1[_0x0086('0x50')]=qs[_0x0086('0x45')](_0x2fc28b[_0x0086('0x26')]['sort']);_0x40fcc1[_0x0086('0x24')]=qs[_0x0086('0x43')](_[_0x0086('0x46')](_0x2fc28b['query'],_0x577fe9['filters']));if(_0x2fc28b['query'][_0x0086('0x47')]){_0x40fcc1[_0x0086('0x24')]=_[_0x0086('0x33')](_0x40fcc1[_0x0086('0x24')],{'$or':_[_0x0086('0x20')](_0x40fcc1[_0x0086('0x2e')],function(_0x43ac1b){var _0x4b9f63={};_0x4b9f63[_0x43ac1b]={'$like':'%'+_0x2fc28b[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x4b9f63;})});}_0x40fcc1=_['merge']({},_0x40fcc1,_0x2fc28b[_0x0086('0x34')]);return _0x4ccb55['getTeams'](_0x40fcc1);}})[_0x0086('0x18')](function(_0x6a2f42){if(_0x6a2f42){_0x2d25e6=_0x6a2f42[_0x0086('0x31')];if(!_0x2fc28b[_0x0086('0x26')]['hasOwnProperty']('nolimit')){_0x40fcc1[_0x0086('0x11')]=qs['limit'](_0x2fc28b['query'][_0x0086('0x11')]);_0x40fcc1[_0x0086('0x13')]=qs['offset'](_0x2fc28b[_0x0086('0x26')][_0x0086('0x13')]);}return _0x4ccb55[_0x0086('0x51')](_0x40fcc1);}})[_0x0086('0x18')](function(_0x1ed771){if(_0x1ed771){return _0x1ed771?{'count':_0x2d25e6,'rows':_0x1ed771}:null;}})[_0x0086('0x18')](respondWithResult(_0x13f175,null))[_0x0086('0x3c')](handleError(_0x13f175,null));};exports[_0x0086('0x52')]=function(_0x53742b,_0x53f29f){var _0x16e7cf=_0x53742b[_0x0086('0x3f')][_0x0086('0x53')];return db['Team'][_0x0086('0x28')]({'where':{'id':_0x16e7cf},'attributes':['id'],'include':[{'model':db[_0x0086('0x54')],'as':'Agents','attributes':['id',_0x0086('0x1d'),_0x0086('0x55'),_0x0086('0x56'),_0x0086('0x57')],'raw':!![]}]})['then'](function(_0x193e02){if(_0x193e02){var _0x1cfc90=_[_0x0086('0x58')](_0x193e02,function(_0x58edfa){var _0x2554e7=_0x58edfa['get']({'plain':!![]});return _0x2554e7[_0x0086('0x59')];});return db['WhatsappQueue'][_0x0086('0x35')]({'where':{'id':_0x53742b[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](function(_0x2b33cb){return db[_0x0086('0x5a')][_0x0086('0x5b')](function(_0x4efd9b){return _0x2b33cb[_0x0086('0x52')](_0x16e7cf,{'transaction':_0x4efd9b})[_0x0086('0x18')](function(){return BPromise[_0x0086('0x5c')](_0x1cfc90,function(_0x43df93){return db[_0x0086('0x42')]['findOrCreate']({'where':{'UserId':_0x43df93['id'],'WhatsappQueueId':_0x53742b[_0x0086('0x2b')]['id']},'transaction':_0x4efd9b});});})['then'](function(){_0x1cfc90[_0x0086('0x5d')](function(_0x469269){socket['emit'](_0x0086('0x5e'),{'UserId':_0x469269['id'],'WhatsappQueueId':_0x2b33cb['id']});});});});});}})['then'](respondWithStatusCode(_0x53f29f,null))[_0x0086('0x3c')](handleError(_0x53f29f,null));};exports[_0x0086('0x5f')]=function(_0x255972,_0x30d303){return db[_0x0086('0x4f')][_0x0086('0x28')]({'where':{'id':_0x255972['query'][_0x0086('0x53')]},'attributes':['id'],'include':[{'model':db[_0x0086('0x54')],'as':_0x0086('0x59'),'attributes':['id'],'raw':!![]}]})[_0x0086('0x18')](handleEntityNotFound(_0x30d303,null))[_0x0086('0x18')](function(_0x55a96a){var _0x320619=_[_0x0086('0x20')](_0x55a96a,'id');var _0x5852be=[];var _0x127a31=[];var _0x5416d4=squel[_0x0086('0x60')]();_0x5416d4[_0x0086('0x61')]('tq.TeamId')[_0x0086('0x62')](_0x0086('0x63'),'tq')['join'](_0x0086('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0086('0x65'),_0x255972[_0x0086('0x2b')]['id']);for(var _0x1783da=0x0;_0x1783da<_0x55a96a[_0x0086('0x31')];_0x1783da+=0x1){let _0x34a2bf=_0x55a96a[_0x1783da];for(var _0x42ee39=0x0;_0x42ee39<_0x34a2bf[_0x0086('0x59')]['length'];_0x42ee39+=0x1){let _0x562445=_0x34a2bf[_0x0086('0x59')][_0x42ee39];var _0x56dc1e=_0x5416d4['clone']();_0x56dc1e['where'](_0x0086('0x66'),_0x562445['id']);_0x127a31[_0x0086('0x67')](db['sequelize'][_0x0086('0x26')](_0x56dc1e[_0x0086('0x68')](),{'type':db[_0x0086('0x5a')][_0x0086('0x69')]['SELECT']})[_0x0086('0x18')](function(_0x54b32d){if(_0x54b32d[_0x0086('0x31')]===0x1){return _0x562445['id'];}else{var _0x4f4ea1=_[_0x0086('0x6a')](_[_0x0086('0x20')](_0x54b32d,_0x0086('0x6b')),function(_0x535764){return _[_0x0086('0x6c')](_0x320619,_0x535764);});if(_0x4f4ea1){return _0x562445['id'];}}}));}}return BPromise[_0x0086('0x6d')](_0x127a31)[_0x0086('0x18')](function(_0x34d33a){_0x5852be=_(_0x5852be)['union'](_0x34d33a)[_0x0086('0x6e')]()[_0x0086('0x6f')]();return db[_0x0086('0x27')]['find']({'where':{'id':_0x255972['params']['id']}})[_0x0086('0x18')](function(_0x1411e3){return db[_0x0086('0x5a')]['transaction'](function(_0x3cea2b){return _0x1411e3[_0x0086('0x5f')](_0x255972['query']['ids'],{'transaction':_0x3cea2b})[_0x0086('0x18')](function(){if(!_[_0x0086('0x70')](_0x5852be)){return _0x1411e3[_0x0086('0x71')](_0x5852be,{'transaction':_0x3cea2b});}})['then'](function(){_0x5852be[_0x0086('0x5d')](function(_0x26ec02){socket[_0x0086('0x72')](_0x0086('0x73'),{'UserId':_0x26ec02,'WhatsappQueueId':_0x1411e3['id']});});});});});});})['then'](respondWithStatusCode(_0x30d303,null))[_0x0086('0x3c')](handleError(_0x30d303,null));};exports['addAgents']=function(_0x540db9,_0x4dba56){return db[_0x0086('0x27')][_0x0086('0x35')]({'where':{'id':_0x540db9[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x4dba56,null))[_0x0086('0x18')](function(_0x16c853){if(_0x16c853){return _0x16c853[_0x0086('0x74')](_0x540db9[_0x0086('0x3f')][_0x0086('0x53')],_[_0x0086('0x75')](_0x540db9[_0x0086('0x3f')],['ids','id'])||{})[_0x0086('0x76')](function(_0x3ae531){for(var _0x2837d9=0x0;_0x2837d9<_0x540db9['body']['ids']['length'];_0x2837d9+=0x1){socket[_0x0086('0x72')](_0x0086('0x5e'),{'UserId':Number(_0x540db9[_0x0086('0x3f')][_0x0086('0x53')][_0x2837d9]),'WhatsappQueueId':Number(_0x540db9[_0x0086('0x2b')]['id'])});}return _0x3ae531;});}})[_0x0086('0x18')](respondWithResult(_0x4dba56,null))[_0x0086('0x3c')](handleError(_0x4dba56,null));};exports[_0x0086('0x71')]=function(_0x36ccfd,_0x1c122f){return db[_0x0086('0x27')]['find']({'where':{'id':_0x36ccfd[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x1c122f,null))[_0x0086('0x18')](function(_0xabebc1){if(_0xabebc1){return _0xabebc1[_0x0086('0x71')](_0x36ccfd[_0x0086('0x26')][_0x0086('0x53')])[_0x0086('0x18')](function(){if(_[_0x0086('0x77')](_0x36ccfd['query']['ids'])){for(var _0x3c2307=0x0;_0x3c2307<_0x36ccfd[_0x0086('0x26')]['ids']['length'];_0x3c2307+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x36ccfd[_0x0086('0x26')][_0x0086('0x53')][_0x3c2307]),'WhatsappQueueId':Number(_0x36ccfd[_0x0086('0x2b')]['id'])});}}else{socket[_0x0086('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x36ccfd['query']['ids']),'WhatsappQueueId':Number(_0x36ccfd[_0x0086('0x2b')]['id'])});}});}})[_0x0086('0x18')](respondWithStatusCode(_0x1c122f,null))['catch'](handleError(_0x1c122f,null));};exports[_0x0086('0x78')]=function(_0x35b51d,_0x2bc3d1){var _0x2e1da3={};var _0x6d61ef={};var _0x3d0213;var _0x338070;return db[_0x0086('0x27')][_0x0086('0x4e')]({'where':{'id':_0x35b51d['params']['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x2bc3d1,null))[_0x0086('0x18')](function(_0x329c41){if(_0x329c41){_0x3d0213=_0x329c41;_0x6d61ef['model']=_[_0x0086('0x2d')](db['User'][_0x0086('0x21')]);_0x6d61ef[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x35b51d['query']);_0x6d61ef[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x6d61ef[_0x0086('0x2c')],_0x6d61ef[_0x0086('0x26')]);_0x2e1da3[_0x0086('0x2e')]=_['intersection'](_0x6d61ef[_0x0086('0x2c')],qs['fields'](_0x35b51d[_0x0086('0x26')][_0x0086('0x30')]));_0x2e1da3[_0x0086('0x2e')]=_0x2e1da3[_0x0086('0x2e')][_0x0086('0x31')]?_0x2e1da3[_0x0086('0x2e')]:_0x6d61ef['model'];_0x2e1da3[_0x0086('0x50')]=qs[_0x0086('0x45')](_0x35b51d['query'][_0x0086('0x45')]);_0x2e1da3[_0x0086('0x24')]=qs[_0x0086('0x43')](_[_0x0086('0x46')](_0x35b51d[_0x0086('0x26')],_0x6d61ef[_0x0086('0x43')]));if(_0x35b51d[_0x0086('0x26')][_0x0086('0x47')]){_0x2e1da3[_0x0086('0x24')]=_[_0x0086('0x33')](_0x2e1da3[_0x0086('0x24')],{'$or':_['map'](_0x2e1da3['attributes'],function(_0x4b0691){var _0x1301c5={};_0x1301c5[_0x4b0691]={'$like':'%'+_0x35b51d[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x1301c5;})});}_0x2e1da3=_[_0x0086('0x33')]({},_0x2e1da3,_0x35b51d[_0x0086('0x34')]);return _0x3d0213['getAgents'](_0x2e1da3);}})['then'](function(_0x57ac81){if(_0x57ac81){_0x338070=_0x57ac81['length'];if(!_0x35b51d[_0x0086('0x26')][_0x0086('0x44')](_0x0086('0x79'))){_0x2e1da3[_0x0086('0x11')]=qs[_0x0086('0x11')](_0x35b51d[_0x0086('0x26')][_0x0086('0x11')]);_0x2e1da3[_0x0086('0x13')]=qs[_0x0086('0x13')](_0x35b51d['query'][_0x0086('0x13')]);}return _0x3d0213[_0x0086('0x78')](_0x2e1da3);}})['then'](function(_0x1a8841){if(_0x1a8841){return _0x1a8841?{'count':_0x338070,'rows':_0x1a8841}:null;}})[_0x0086('0x18')](respondWithResult(_0x2bc3d1,null))[_0x0086('0x3c')](handleError(_0x2bc3d1,null));}; \ No newline at end of file +var _0x3aec=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','merge','map','filter','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','addTeams','ids','Team','User','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','offset','limit','undefined','count','set','update','then','destroy','get','WhatsappQueues','end','sendStatus','stack','name','index','WhatsappQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','UserProfileResource','error'];(function(_0x18905a,_0x76944c){var _0x5b8ae9=function(_0x4a2020){while(--_0x4a2020){_0x18905a['push'](_0x18905a['shift']());}};_0x5b8ae9(++_0x76944c);}(_0x3aec,0xbe));var _0xc3ae=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x3aec[_0x4b7e4d];return _0x38d6af;};'use strict';var BPromise=require(_0xc3ae('0x0'));var util=require(_0xc3ae('0x1'));var _=require(_0xc3ae('0x2'));var squel=require('squel');var Redis=require(_0xc3ae('0x3'));var qs=require(_0xc3ae('0x4'));var logger=require(_0xc3ae('0x5'))(_0xc3ae('0x6'));var config=require('../../config/environment');var db=require(_0xc3ae('0x7'))['db'];config['redis']=_[_0xc3ae('0x8')](config[_0xc3ae('0x9')],{'host':_0xc3ae('0xa'),'port':0x18eb});var socket=require(_0xc3ae('0xb'))(new Redis(config[_0xc3ae('0x9')]));require('./whatsappQueue.socket')[_0xc3ae('0xc')](socket);function respondWithStatusCode(_0x444bf9,_0x29c23e){_0x29c23e=_0x29c23e||0xcc;return function(_0x39c632){if(_0x39c632){return _0x444bf9['sendStatus'](_0x29c23e);}return _0x444bf9[_0xc3ae('0xd')](_0x29c23e)['end']();};}function respondWithResult(_0x45e2a8,_0x340435){_0x340435=_0x340435||0xc8;return function(_0x4b4254){if(_0x4b4254){return _0x45e2a8[_0xc3ae('0xd')](_0x340435)[_0xc3ae('0xe')](_0x4b4254);}};}function respondWithFilteredResult(_0xf037e4,_0x4ae54b){return function(_0x4625e6){if(_0x4625e6){var _0x1c105d=typeof _0x4ae54b[_0xc3ae('0xf')]==='undefined'&&typeof _0x4ae54b[_0xc3ae('0x10')]===_0xc3ae('0x11');var _0x254ed5=_0x4625e6[_0xc3ae('0x12')];var _0x40ff32=_0x1c105d?0x0:_0x4ae54b['offset'];var _0x59b1f7=_0x1c105d?_0x4625e6['count']:_0x4ae54b[_0xc3ae('0xf')]+_0x4ae54b[_0xc3ae('0x10')];var _0x437186;if(_0x59b1f7>=_0x254ed5){_0x59b1f7=_0x254ed5;_0x437186=0xc8;}else{_0x437186=0xce;}_0xf037e4['status'](_0x437186);return _0xf037e4[_0xc3ae('0x13')]('Content-Range',_0x40ff32+'-'+_0x59b1f7+'/'+_0x254ed5)[_0xc3ae('0xe')](_0x4625e6);}return null;};}function saveUpdates(_0x579040){return function(_0x15c8db){if(_0x15c8db){return _0x15c8db[_0xc3ae('0x14')](_0x579040)[_0xc3ae('0x15')](function(_0x20cee9){return _0x20cee9;});}return null;};}function removeEntity(_0x10a4f8){return function(_0x5576af){if(_0x5576af){return _0x5576af[_0xc3ae('0x16')]()['then'](function(){var _0x459823=_0x5576af[_0xc3ae('0x17')]({'plain':!![]});var _0xfbc47f=_0xc3ae('0x18');return db['UserProfileResource'][_0xc3ae('0x16')]({'where':{'type':_0xfbc47f,'resourceId':_0x459823['id']}})[_0xc3ae('0x15')](function(){return _0x5576af;});})[_0xc3ae('0x15')](function(){_0x10a4f8[_0xc3ae('0xd')](0xcc)[_0xc3ae('0x19')]();});}};}function handleEntityNotFound(_0x2cc5ac){return function(_0x55d2d4){if(!_0x55d2d4){_0x2cc5ac[_0xc3ae('0x1a')](0x194);}return _0x55d2d4;};}function handleError(_0x4f0ee3,_0x153319){_0x153319=_0x153319||0x1f4;return function(_0x2ee2d2){logger['error'](_0x2ee2d2[_0xc3ae('0x1b')]);if(_0x2ee2d2['name']){delete _0x2ee2d2[_0xc3ae('0x1c')];}_0x4f0ee3[_0xc3ae('0xd')](_0x153319)['send'](_0x2ee2d2);};}exports[_0xc3ae('0x1d')]=function(_0x442c23,_0x4250bf){var _0x4c795d={};var _0x4471cd={'count':0x0,'rows':[]};var _0x59c897=_['map'](db[_0xc3ae('0x1e')]['rawAttributes'],function(_0x43f7d5){return{'name':_0x43f7d5[_0xc3ae('0x1f')],'type':_0x43f7d5[_0xc3ae('0x20')][_0xc3ae('0x21')]};});_0x4c795d=qs[_0xc3ae('0x22')](_0x59c897,_0x442c23);var _0x3b103a={'where':_0x4c795d[_0xc3ae('0x23')]};return db[_0xc3ae('0x1e')][_0xc3ae('0x12')](_0x3b103a)['then'](function(_0x2aa62b){_0x4471cd[_0xc3ae('0x12')]=_0x2aa62b;_0x4c795d[_0xc3ae('0x24')]=qs['include'](_0x442c23[_0xc3ae('0x25')]);return db[_0xc3ae('0x1e')][_0xc3ae('0x26')](_0x4c795d);})[_0xc3ae('0x15')](function(_0xb5954f){_0x4471cd[_0xc3ae('0x27')]=_0xb5954f;return _0x4471cd;})['then'](respondWithFilteredResult(_0x4250bf,_0x4c795d))[_0xc3ae('0x28')](handleError(_0x4250bf,null));};exports[_0xc3ae('0x29')]=function(_0x14eefe,_0x29f810){var _0xc6f3c6={'raw':!![],'where':{'id':_0x14eefe[_0xc3ae('0x2a')]['id']}},_0x8bd34a={};_0x8bd34a['model']=_[_0xc3ae('0x2b')](db[_0xc3ae('0x1e')][_0xc3ae('0x2c')]);_0x8bd34a[_0xc3ae('0x25')]=_[_0xc3ae('0x2b')](_0x14eefe[_0xc3ae('0x25')]);_0x8bd34a[_0xc3ae('0x2d')]=_['intersection'](_0x8bd34a[_0xc3ae('0x2e')],_0x8bd34a[_0xc3ae('0x25')]);_0xc6f3c6[_0xc3ae('0x2f')]=_[_0xc3ae('0x30')](_0x8bd34a[_0xc3ae('0x2e')],qs[_0xc3ae('0x31')](_0x14eefe[_0xc3ae('0x25')][_0xc3ae('0x31')]));_0xc6f3c6[_0xc3ae('0x2f')]=_0xc6f3c6[_0xc3ae('0x2f')][_0xc3ae('0x32')]?_0xc6f3c6[_0xc3ae('0x2f')]:_0x8bd34a[_0xc3ae('0x2e')];if(_0x14eefe[_0xc3ae('0x25')][_0xc3ae('0x33')]){_0xc6f3c6[_0xc3ae('0x24')]=[{'all':!![]}];}_0xc6f3c6=_['merge']({},_0xc6f3c6,_0x14eefe[_0xc3ae('0x34')]);return db[_0xc3ae('0x1e')]['find'](_0xc6f3c6)[_0xc3ae('0x15')](handleEntityNotFound(_0x29f810,null))['then'](respondWithResult(_0x29f810,null))[_0xc3ae('0x28')](handleError(_0x29f810,null));};exports[_0xc3ae('0x35')]=function(_0xd3f8f2,_0x4ce324){return db['WhatsappQueue'][_0xc3ae('0x35')](_0xd3f8f2['body'],{})[_0xc3ae('0x15')](function(_0x506a4f){var _0x59e8e0=_0xd3f8f2[_0xc3ae('0x36')][_0xc3ae('0x17')]({'plain':!![]});if(!_0x59e8e0)throw new Error(_0xc3ae('0x37'));if(_0x59e8e0[_0xc3ae('0x38')]==='user'){var _0x57a9d7=_0x506a4f['get']({'plain':!![]});var _0x18e8dd='WhatsappQueues';return db['UserProfileSection'][_0xc3ae('0x39')]({'where':{'name':_0x18e8dd,'userProfileId':_0x59e8e0['userProfileId']},'raw':!![]})[_0xc3ae('0x15')](function(_0x397d90){if(_0x397d90&&_0x397d90['autoAssociation']===0x0){return db[_0xc3ae('0x3a')][_0xc3ae('0x35')]({'name':_0x57a9d7[_0xc3ae('0x1c')],'resourceId':_0x57a9d7['id'],'type':_0x397d90['name'],'sectionId':_0x397d90['id']},{})[_0xc3ae('0x15')](function(){return _0x506a4f;});}else{return _0x506a4f;}})['catch'](function(_0x537dd0){logger[_0xc3ae('0x3b')](_0xc3ae('0x3c'),_0x537dd0);throw _0x537dd0;});}return _0x506a4f;})[_0xc3ae('0x15')](respondWithResult(_0x4ce324,0xc9))['catch'](handleError(_0x4ce324,null));};exports[_0xc3ae('0x14')]=function(_0x521732,_0xacdbc2){if(_0x521732[_0xc3ae('0x3d')]['id']){delete _0x521732[_0xc3ae('0x3d')]['id'];}return db[_0xc3ae('0x1e')]['find']({'where':{'id':_0x521732[_0xc3ae('0x2a')]['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0xacdbc2,null))[_0xc3ae('0x15')](saveUpdates(_0x521732[_0xc3ae('0x3d')],null))[_0xc3ae('0x15')](respondWithResult(_0xacdbc2,null))[_0xc3ae('0x28')](handleError(_0xacdbc2,null));};exports[_0xc3ae('0x16')]=function(_0x563347,_0x55092f){return db[_0xc3ae('0x1e')][_0xc3ae('0x39')]({'where':{'id':_0x563347[_0xc3ae('0x2a')]['id']}})['then'](handleEntityNotFound(_0x55092f,null))[_0xc3ae('0x15')](removeEntity(_0x55092f,null))['catch'](handleError(_0x55092f,null));};exports[_0xc3ae('0x3e')]=function(_0xc5fe70,_0x37bb3b){return db['WhatsappQueue'][_0xc3ae('0x3e')]()[_0xc3ae('0x15')](respondWithResult(_0x37bb3b,null))[_0xc3ae('0x28')](handleError(_0x37bb3b,null));};exports[_0xc3ae('0x3f')]=function(_0x1d1009,_0x7dba3f){var _0x1104ff={'raw':!![],'where':{}},_0x158411={},_0x5239d0;return db[_0xc3ae('0x1e')]['findOne']({'where':{'id':_0x1d1009['params']['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0x7dba3f,null))[_0xc3ae('0x15')](function(_0x3b6798){if(_0x3b6798){_0x5239d0=_0x3b6798[_0xc3ae('0x17')]({'plain':!![]});_0x158411[_0xc3ae('0x2e')]=_[_0xc3ae('0x2b')](db[_0xc3ae('0x40')][_0xc3ae('0x2c')]);_0x158411['query']=_[_0xc3ae('0x2b')](_0x1d1009[_0xc3ae('0x25')]);_0x158411[_0xc3ae('0x2d')]=_['intersection'](_0x158411['model'],_0x158411[_0xc3ae('0x25')]);_0x1104ff[_0xc3ae('0x2f')]=_['intersection'](_0x158411[_0xc3ae('0x2e')],qs['fields'](_0x1d1009[_0xc3ae('0x25')][_0xc3ae('0x31')]));_0x1104ff[_0xc3ae('0x2f')]=_0x1104ff[_0xc3ae('0x2f')]['length']?_0x1104ff[_0xc3ae('0x2f')]:_0x158411[_0xc3ae('0x2e')];if(!_0x1d1009[_0xc3ae('0x25')][_0xc3ae('0x41')](_0xc3ae('0x42'))){_0x1104ff[_0xc3ae('0x10')]=qs[_0xc3ae('0x10')](_0x1d1009[_0xc3ae('0x25')][_0xc3ae('0x10')]);_0x1104ff[_0xc3ae('0xf')]=qs['offset'](_0x1d1009[_0xc3ae('0x25')]['offset']);}_0x1104ff[_0xc3ae('0x43')]=qs[_0xc3ae('0x44')](_0x1d1009[_0xc3ae('0x25')][_0xc3ae('0x44')]);_0x1104ff[_0xc3ae('0x23')]=qs[_0xc3ae('0x2d')](_[_0xc3ae('0x45')](_0x1d1009['query'],_0x158411[_0xc3ae('0x2d')]));_0x1104ff[_0xc3ae('0x23')][_0xc3ae('0x46')]=_0x3b6798['id'];if(_0x1d1009[_0xc3ae('0x25')]['filter']){_0x1104ff['where']=_[_0xc3ae('0x47')](_0x1104ff['where'],{'$or':_[_0xc3ae('0x48')](_0x1104ff[_0xc3ae('0x2f')],function(_0x4cbd4c){var _0x4b9143={};_0x4b9143[_0x4cbd4c]={'$like':'%'+_0x1d1009[_0xc3ae('0x25')][_0xc3ae('0x49')]+'%'};return _0x4b9143;})});}_0x1104ff=_[_0xc3ae('0x47')]({},_0x1104ff,_0x1d1009[_0xc3ae('0x34')]);return db['UserWhatsappQueue'][_0xc3ae('0x26')](_0x1104ff);}})[_0xc3ae('0x15')](function(_0x3bb900){if(_0x3bb900){return db['User'][_0xc3ae('0x4a')]({'where':{'id':_[_0xc3ae('0x48')](_0x3bb900,_0xc3ae('0x4b')),'role':_0xc3ae('0x4c')},'attributes':['id',_0xc3ae('0x1c'),_0xc3ae('0x4d'),'updatedAt',_0xc3ae('0x4e')]});}})[_0xc3ae('0x15')](function(_0x2ed822){if(_0x2ed822){return{'count':_0x2ed822[_0xc3ae('0x12')],'rows':_[_0xc3ae('0x48')](_0x2ed822['rows'],function(_0x49dd28){return{'membername':_0x49dd28[_0xc3ae('0x1c')],'UserId':_0x49dd28['id'],'queue_name':_0x5239d0[_0xc3ae('0x1c')],'WhatsappQueueId':_0x5239d0['id'],'interface':util[_0xc3ae('0x4f')](_0xc3ae('0x50'),_0xc3ae('0x51'),_0x49dd28[_0xc3ae('0x1c')]),'penalty':0x0,'paused':_0x49dd28[_0xc3ae('0x4d')],'createdAt':_0x49dd28['createdAt'],'updatedAt':_0x49dd28[_0xc3ae('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3ae('0x15')](respondWithFilteredResult(_0x7dba3f,_0x1104ff))[_0xc3ae('0x28')](handleError(_0x7dba3f,null));};exports[_0xc3ae('0x53')]=function(_0x5eb2a9,_0x5887c7){var _0x132d2c={};var _0x177e49={};var _0x3cbdb8;var _0x49e131;return db[_0xc3ae('0x1e')][_0xc3ae('0x54')]({'where':{'id':_0x5eb2a9['params']['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0x5887c7,null))[_0xc3ae('0x15')](function(_0x586da2){if(_0x586da2){_0x3cbdb8=_0x586da2;_0x177e49[_0xc3ae('0x2e')]=_[_0xc3ae('0x2b')](db['Team'][_0xc3ae('0x2c')]);_0x177e49[_0xc3ae('0x25')]=_[_0xc3ae('0x2b')](_0x5eb2a9[_0xc3ae('0x25')]);_0x177e49[_0xc3ae('0x2d')]=_[_0xc3ae('0x30')](_0x177e49[_0xc3ae('0x2e')],_0x177e49[_0xc3ae('0x25')]);_0x132d2c[_0xc3ae('0x2f')]=_[_0xc3ae('0x30')](_0x177e49[_0xc3ae('0x2e')],qs['fields'](_0x5eb2a9[_0xc3ae('0x25')][_0xc3ae('0x31')]));_0x132d2c[_0xc3ae('0x2f')]=_0x132d2c['attributes'][_0xc3ae('0x32')]?_0x132d2c[_0xc3ae('0x2f')]:_0x177e49[_0xc3ae('0x2e')];_0x132d2c['order']=qs['sort'](_0x5eb2a9[_0xc3ae('0x25')][_0xc3ae('0x44')]);_0x132d2c[_0xc3ae('0x23')]=qs['filters'](_[_0xc3ae('0x45')](_0x5eb2a9[_0xc3ae('0x25')],_0x177e49[_0xc3ae('0x2d')]));if(_0x5eb2a9[_0xc3ae('0x25')][_0xc3ae('0x49')]){_0x132d2c[_0xc3ae('0x23')]=_['merge'](_0x132d2c[_0xc3ae('0x23')],{'$or':_[_0xc3ae('0x48')](_0x132d2c[_0xc3ae('0x2f')],function(_0x2e3a79){var _0x5be73a={};_0x5be73a[_0x2e3a79]={'$like':'%'+_0x5eb2a9[_0xc3ae('0x25')]['filter']+'%'};return _0x5be73a;})});}_0x132d2c=_[_0xc3ae('0x47')]({},_0x132d2c,_0x5eb2a9[_0xc3ae('0x34')]);return _0x3cbdb8['getTeams'](_0x132d2c);}})[_0xc3ae('0x15')](function(_0x4c8339){if(_0x4c8339){_0x49e131=_0x4c8339[_0xc3ae('0x32')];if(!_0x5eb2a9[_0xc3ae('0x25')][_0xc3ae('0x41')]('nolimit')){_0x132d2c[_0xc3ae('0x10')]=qs['limit'](_0x5eb2a9[_0xc3ae('0x25')]['limit']);_0x132d2c['offset']=qs['offset'](_0x5eb2a9[_0xc3ae('0x25')][_0xc3ae('0xf')]);}return _0x3cbdb8[_0xc3ae('0x53')](_0x132d2c);}})[_0xc3ae('0x15')](function(_0x1945a2){if(_0x1945a2){return _0x1945a2?{'count':_0x49e131,'rows':_0x1945a2}:null;}})[_0xc3ae('0x15')](respondWithResult(_0x5887c7,null))[_0xc3ae('0x28')](handleError(_0x5887c7,null));};exports[_0xc3ae('0x55')]=function(_0x436e28,_0x4f2685){var _0x4663a7=_0x436e28[_0xc3ae('0x3d')][_0xc3ae('0x56')];return db[_0xc3ae('0x57')][_0xc3ae('0x26')]({'where':{'id':_0x4663a7},'attributes':['id'],'include':[{'model':db[_0xc3ae('0x58')],'as':'Agents','attributes':['id','name',_0xc3ae('0x59'),_0xc3ae('0x5a'),_0xc3ae('0x5b')],'raw':!![]}]})[_0xc3ae('0x15')](function(_0x4dbaa5){if(_0x4dbaa5){var _0x11e536=_[_0xc3ae('0x5c')](_0x4dbaa5,function(_0xc0225e){var _0x46ca6e=_0xc0225e[_0xc3ae('0x17')]({'plain':!![]});return _0x46ca6e[_0xc3ae('0x5d')];});return db[_0xc3ae('0x1e')]['find']({'where':{'id':_0x436e28[_0xc3ae('0x2a')]['id']}})[_0xc3ae('0x15')](function(_0x525f66){return db[_0xc3ae('0x5e')]['transaction'](function(_0x4dde9b){return _0x525f66[_0xc3ae('0x55')](_0x4663a7,{'transaction':_0x4dde9b})[_0xc3ae('0x15')](function(){return BPromise[_0xc3ae('0x5f')](_0x11e536,function(_0x2bbd10){return db[_0xc3ae('0x40')][_0xc3ae('0x60')]({'where':{'UserId':_0x2bbd10['id'],'WhatsappQueueId':_0x436e28[_0xc3ae('0x2a')]['id']},'transaction':_0x4dde9b});});})[_0xc3ae('0x15')](function(){_0x11e536[_0xc3ae('0x61')](function(_0x473207){socket[_0xc3ae('0x62')](_0xc3ae('0x63'),{'UserId':_0x473207['id'],'WhatsappQueueId':_0x525f66['id']});});});});});}})['then'](respondWithStatusCode(_0x4f2685,null))['catch'](handleError(_0x4f2685,null));};exports[_0xc3ae('0x64')]=function(_0x5b6bab,_0x9f340d){return db[_0xc3ae('0x57')][_0xc3ae('0x26')]({'where':{'id':_0x5b6bab[_0xc3ae('0x25')][_0xc3ae('0x56')]},'attributes':['id'],'include':[{'model':db[_0xc3ae('0x58')],'as':_0xc3ae('0x5d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x9f340d,null))[_0xc3ae('0x15')](function(_0x3d0898){var _0x82dd09=_[_0xc3ae('0x48')](_0x3d0898,'id');var _0x18f4ab=[];var _0x1f15e5=[];var _0x140195=squel[_0xc3ae('0x65')]();_0x140195[_0xc3ae('0x66')]('tq.TeamId')[_0xc3ae('0x67')]('team_has_whatsapp_queues','tq')['join'](_0xc3ae('0x68'),'ut',_0xc3ae('0x69'))['where']('WhatsappQueueId\x20=\x20?',_0x5b6bab[_0xc3ae('0x2a')]['id']);for(var _0x37c978=0x0;_0x37c978<_0x3d0898[_0xc3ae('0x32')];_0x37c978+=0x1){let _0x3f2df9=_0x3d0898[_0x37c978];for(var _0x14e12c=0x0;_0x14e12c<_0x3f2df9[_0xc3ae('0x5d')][_0xc3ae('0x32')];_0x14e12c+=0x1){let _0x18fd62=_0x3f2df9['Agents'][_0x14e12c];var _0x3cc970=_0x140195['clone']();_0x3cc970[_0xc3ae('0x23')](_0xc3ae('0x6a'),_0x18fd62['id']);_0x1f15e5[_0xc3ae('0x6b')](db[_0xc3ae('0x5e')][_0xc3ae('0x25')](_0x3cc970['toString'](),{'type':db[_0xc3ae('0x5e')]['QueryTypes'][_0xc3ae('0x6c')]})['then'](function(_0x28d8f8){if(_0x28d8f8['length']===0x1){return _0x18fd62['id'];}else{var _0x2e0bef=_[_0xc3ae('0x6d')](_[_0xc3ae('0x48')](_0x28d8f8,_0xc3ae('0x6e')),function(_0x58d7b3){return _[_0xc3ae('0x6f')](_0x82dd09,_0x58d7b3);});if(_0x2e0bef){return _0x18fd62['id'];}}}));}}return BPromise[_0xc3ae('0x70')](_0x1f15e5)['then'](function(_0x987a30){_0x18f4ab=_(_0x18f4ab)[_0xc3ae('0x71')](_0x987a30)[_0xc3ae('0x72')]()[_0xc3ae('0x73')]();return db['WhatsappQueue'][_0xc3ae('0x39')]({'where':{'id':_0x5b6bab[_0xc3ae('0x2a')]['id']}})[_0xc3ae('0x15')](function(_0x4d8ce7){return db[_0xc3ae('0x5e')][_0xc3ae('0x74')](function(_0x4dd40c){return _0x4d8ce7['removeTeams'](_0x5b6bab[_0xc3ae('0x25')][_0xc3ae('0x56')],{'transaction':_0x4dd40c})[_0xc3ae('0x15')](function(){if(!_[_0xc3ae('0x75')](_0x18f4ab)){return _0x4d8ce7[_0xc3ae('0x76')](_0x18f4ab,{'transaction':_0x4dd40c});}})[_0xc3ae('0x15')](function(){_0x18f4ab['forEach'](function(_0x589eb3){socket[_0xc3ae('0x62')]('userWhatsappQueue:remove',{'UserId':_0x589eb3,'WhatsappQueueId':_0x4d8ce7['id']});});});});});});})[_0xc3ae('0x15')](respondWithStatusCode(_0x9f340d,null))['catch'](handleError(_0x9f340d,null));};exports['addAgents']=function(_0x2cd690,_0x8d8cd9){return db[_0xc3ae('0x1e')][_0xc3ae('0x39')]({'where':{'id':_0x2cd690['params']['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0x8d8cd9,null))[_0xc3ae('0x15')](function(_0x395da2){if(_0x395da2){return _0x395da2[_0xc3ae('0x77')](_0x2cd690['body'][_0xc3ae('0x56')],_[_0xc3ae('0x78')](_0x2cd690[_0xc3ae('0x3d')],[_0xc3ae('0x56'),'id'])||{})[_0xc3ae('0x79')](function(_0x2a45e9){for(var _0x3756fb=0x0;_0x3756fb<_0x2cd690[_0xc3ae('0x3d')][_0xc3ae('0x56')][_0xc3ae('0x32')];_0x3756fb+=0x1){socket['emit'](_0xc3ae('0x63'),{'UserId':Number(_0x2cd690['body'][_0xc3ae('0x56')][_0x3756fb]),'WhatsappQueueId':Number(_0x2cd690[_0xc3ae('0x2a')]['id'])});}return _0x2a45e9;});}})[_0xc3ae('0x15')](respondWithResult(_0x8d8cd9,null))[_0xc3ae('0x28')](handleError(_0x8d8cd9,null));};exports[_0xc3ae('0x76')]=function(_0x4bdbac,_0x5f4ebe){return db['WhatsappQueue'][_0xc3ae('0x39')]({'where':{'id':_0x4bdbac['params']['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0x5f4ebe,null))[_0xc3ae('0x15')](function(_0x657373){if(_0x657373){return _0x657373[_0xc3ae('0x76')](_0x4bdbac[_0xc3ae('0x25')][_0xc3ae('0x56')])[_0xc3ae('0x15')](function(){if(_[_0xc3ae('0x7a')](_0x4bdbac['query']['ids'])){for(var _0x51d946=0x0;_0x51d946<_0x4bdbac[_0xc3ae('0x25')][_0xc3ae('0x56')][_0xc3ae('0x32')];_0x51d946+=0x1){socket[_0xc3ae('0x62')]('userWhatsappQueue:remove',{'UserId':Number(_0x4bdbac['query'][_0xc3ae('0x56')][_0x51d946]),'WhatsappQueueId':Number(_0x4bdbac[_0xc3ae('0x2a')]['id'])});}}else{socket['emit'](_0xc3ae('0x7b'),{'UserId':Number(_0x4bdbac[_0xc3ae('0x25')]['ids']),'WhatsappQueueId':Number(_0x4bdbac['params']['id'])});}});}})[_0xc3ae('0x15')](respondWithStatusCode(_0x5f4ebe,null))[_0xc3ae('0x28')](handleError(_0x5f4ebe,null));};exports[_0xc3ae('0x7c')]=function(_0x49da93,_0x44d392){var _0x30f90f={};var _0x5894ef={};var _0x1c017f;var _0x337033;return db[_0xc3ae('0x1e')][_0xc3ae('0x54')]({'where':{'id':_0x49da93[_0xc3ae('0x2a')]['id']}})[_0xc3ae('0x15')](handleEntityNotFound(_0x44d392,null))[_0xc3ae('0x15')](function(_0x2db14c){if(_0x2db14c){_0x1c017f=_0x2db14c;_0x5894ef[_0xc3ae('0x2e')]=_[_0xc3ae('0x2b')](db[_0xc3ae('0x58')][_0xc3ae('0x2c')]);_0x5894ef[_0xc3ae('0x25')]=_[_0xc3ae('0x2b')](_0x49da93[_0xc3ae('0x25')]);_0x5894ef[_0xc3ae('0x2d')]=_[_0xc3ae('0x30')](_0x5894ef[_0xc3ae('0x2e')],_0x5894ef[_0xc3ae('0x25')]);_0x30f90f[_0xc3ae('0x2f')]=_['intersection'](_0x5894ef[_0xc3ae('0x2e')],qs['fields'](_0x49da93[_0xc3ae('0x25')][_0xc3ae('0x31')]));_0x30f90f[_0xc3ae('0x2f')]=_0x30f90f['attributes'][_0xc3ae('0x32')]?_0x30f90f[_0xc3ae('0x2f')]:_0x5894ef[_0xc3ae('0x2e')];_0x30f90f[_0xc3ae('0x43')]=qs[_0xc3ae('0x44')](_0x49da93[_0xc3ae('0x25')][_0xc3ae('0x44')]);_0x30f90f[_0xc3ae('0x23')]=qs[_0xc3ae('0x2d')](_[_0xc3ae('0x45')](_0x49da93[_0xc3ae('0x25')],_0x5894ef[_0xc3ae('0x2d')]));if(_0x49da93['query']['filter']){_0x30f90f[_0xc3ae('0x23')]=_[_0xc3ae('0x47')](_0x30f90f[_0xc3ae('0x23')],{'$or':_[_0xc3ae('0x48')](_0x30f90f['attributes'],function(_0x2e4f53){var _0x574c48={};_0x574c48[_0x2e4f53]={'$like':'%'+_0x49da93['query']['filter']+'%'};return _0x574c48;})});}_0x30f90f=_[_0xc3ae('0x47')]({},_0x30f90f,_0x49da93[_0xc3ae('0x34')]);return _0x1c017f[_0xc3ae('0x7c')](_0x30f90f);}})[_0xc3ae('0x15')](function(_0x4a7101){if(_0x4a7101){_0x337033=_0x4a7101[_0xc3ae('0x32')];if(!_0x49da93[_0xc3ae('0x25')][_0xc3ae('0x41')]('nolimit')){_0x30f90f[_0xc3ae('0x10')]=qs['limit'](_0x49da93[_0xc3ae('0x25')]['limit']);_0x30f90f['offset']=qs[_0xc3ae('0xf')](_0x49da93[_0xc3ae('0x25')][_0xc3ae('0xf')]);}return _0x1c017f[_0xc3ae('0x7c')](_0x30f90f);}})[_0xc3ae('0x15')](function(_0x25dc33){if(_0x25dc33){return _0x25dc33?{'count':_0x337033,'rows':_0x25dc33}:null;}})['then'](respondWithResult(_0x44d392,null))['catch'](handleError(_0x44d392,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4d8c08d..e726bb7 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 _0xde8d=['emit','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4a4e0f,_0x2b0f10){var _0x33f9df=function(_0x3bce7e){while(--_0x3bce7e){_0x4a4e0f['push'](_0x4a4e0f['shift']());}};_0x33f9df(++_0x2b0f10);}(_0xde8d,0x9d));var _0xdde8=function(_0x3f01,_0x259caa){_0x3f01=_0x3f01-0x0;var _0x1d1655=_0xde8d[_0x3f01];return _0x1d1655;};'use strict';var EventEmitter=require(_0xdde8('0x0'));var WhatsappQueue=require(_0xdde8('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdde8('0x2')](0x0);var events={'afterCreate':_0xdde8('0x3'),'afterUpdate':'update','afterDestroy':_0xdde8('0x4')};function emitEvent(_0x1ef29d){return function(_0x345e3e,_0x279579,_0x4b1b1f){WhatsappQueueEvents[_0xdde8('0x5')](_0x1ef29d+':'+_0x345e3e['id'],_0x345e3e);WhatsappQueueEvents[_0xdde8('0x5')](_0x1ef29d,_0x345e3e);_0x4b1b1f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x0030=['WhatsappQueue','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x0030,0x106));var _0x0003=function(_0x3c12bb,_0x49de69){_0x3c12bb=_0x3c12bb-0x0;var _0x3fa559=_0x0030[_0x3c12bb];return _0x3fa559;};'use strict';var EventEmitter=require(_0x0003('0x0'));var WhatsappQueue=require(_0x0003('0x1'))['db'][_0x0003('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0003('0x3')](0x0);var events={'afterCreate':_0x0003('0x4'),'afterUpdate':_0x0003('0x5'),'afterDestroy':_0x0003('0x6')};function emitEvent(_0x35a200){return function(_0x1f14f3,_0x157a23,_0x2f59a6){WhatsappQueueEvents['emit'](_0x35a200+':'+_0x1f14f3['id'],_0x1f14f3);WhatsappQueueEvents[_0x0003('0x7')](_0x35a200,_0x1f14f3);_0x2f59a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4e84336..ed80be6 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 _0x5b8e=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x5b8e,0xc6));var _0xe5b8=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x5b8e[_0x4d180c];return _0x49b57e;};'use strict';var _=require(_0xe5b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe5b8('0x1'));var moment=require(_0xe5b8('0x2'));var BPromise=require(_0xe5b8('0x3'));var rp=require(_0xe5b8('0x4'));var fs=require('fs');var path=require(_0xe5b8('0x5'));var rimraf=require('rimraf');var config=require(_0xe5b8('0x6'));var attributes=require(_0xe5b8('0x7'));module[_0xe5b8('0x8')]=function(_0xede3c,_0x2ca6e5){return _0xede3c['define'](_0xe5b8('0x9'),attributes,{'tableName':_0xe5b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dcf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dcf,0x1d2));var _0xf7dc=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x7dcf[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0xf7dc('0x0'));var util=require(_0xf7dc('0x1'));var logger=require('../../config/logger')(_0xf7dc('0x2'));var moment=require(_0xf7dc('0x3'));var BPromise=require(_0xf7dc('0x4'));var rp=require(_0xf7dc('0x5'));var fs=require('fs');var path=require(_0xf7dc('0x6'));var rimraf=require(_0xf7dc('0x7'));var config=require(_0xf7dc('0x8'));var attributes=require(_0xf7dc('0x9'));module['exports']=function(_0x2d1762,_0x1be680){return _0x2d1762[_0xf7dc('0xa')](_0xf7dc('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 6f3e5de..145e81f 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 _0x3e77=['include','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','options','where','attributes','map'];(function(_0x43a65b,_0x20f7c9){var _0x3af010=function(_0x274b06){while(--_0x274b06){_0x43a65b['push'](_0x43a65b['shift']());}};_0x3af010(++_0x20f7c9);}(_0x3e77,0x1a2));var _0x73e7=function(_0x3e7555,_0x442ce2){_0x3e7555=_0x3e7555-0x0;var _0x3719e9=_0x3e77[_0x3e7555];return _0x3719e9;};'use strict';var _=require(_0x73e7('0x0'));var util=require(_0x73e7('0x1'));var moment=require(_0x73e7('0x2'));var BPromise=require(_0x73e7('0x3'));var rs=require(_0x73e7('0x4'));var fs=require('fs');var Redis=require(_0x73e7('0x5'));var db=require(_0x73e7('0x6'))['db'];var utils=require(_0x73e7('0x7'));var logger=require(_0x73e7('0x8'))('rpc');var config=require(_0x73e7('0x9'));var jayson=require(_0x73e7('0xa'));var client=jayson[_0x73e7('0xb')][_0x73e7('0xc')]({'port':0x232a});config[_0x73e7('0xd')]=_[_0x73e7('0xe')](config[_0x73e7('0xd')],{'host':_0x73e7('0xf'),'port':0x18eb});var socket=require(_0x73e7('0x10'))(new Redis(config['redis']));require(_0x73e7('0x11'))[_0x73e7('0x12')](socket);function respondWithRpcPromise(_0x262904,_0x8b1a8,_0x4d0231){return new BPromise(function(_0x2d6224,_0x5bcca8){return client[_0x73e7('0x13')](_0x262904,_0x4d0231)['then'](function(_0x4dedb7){logger['info'](_0x73e7('0x14'),_0x8b1a8,_0x73e7('0x15'));logger[_0x73e7('0x16')](_0x73e7('0x17'),_0x8b1a8,'request\x20sent',JSON[_0x73e7('0x18')](_0x4dedb7));if(_0x4dedb7[_0x73e7('0x19')]){if(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1a')]===0x1f4){logger[_0x73e7('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x8b1a8,_0x4dedb7['error'][_0x73e7('0x1b')]);return _0x5bcca8(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);}logger['error'](_0x73e7('0x14'),_0x8b1a8,_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);return _0x2d6224(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);}else{logger[_0x73e7('0x1c')](_0x73e7('0x14'),_0x8b1a8,_0x73e7('0x15'));_0x2d6224(_0x4dedb7['result'][_0x73e7('0x1b')]);}})['catch'](function(_0x3ea8c9){logger[_0x73e7('0x19')](_0x73e7('0x14'),_0x8b1a8,_0x3ea8c9);_0x5bcca8(_0x3ea8c9);});});}exports['GetWhatsappQueue']=function(_0x3814a4){var _0x49acc0=this;return new Promise(function(_0x73a4ee,_0x4741d2){return db['WhatsappQueue']['findAll']({'raw':_0x3814a4['options']?_0x3814a4[_0x73e7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x1e')]||null:null,'attributes':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x1f')]||null:null,'limit':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')]['limit']||null:null,'include':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')]['include']?_[_0x73e7('0x20')](_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x21')],function(_0x640880){return{'model':db[_0x640880[_0x73e7('0x22')]],'as':_0x640880['as'],'attributes':_0x640880[_0x73e7('0x1f')],'include':_0x640880[_0x73e7('0x21')]?_['map'](_0x640880['include'],function(_0x232bb7){return{'model':db[_0x232bb7[_0x73e7('0x22')]],'as':_0x232bb7['as'],'attributes':_0x232bb7[_0x73e7('0x1f')],'include':_0x232bb7[_0x73e7('0x21')]?_[_0x73e7('0x20')](_0x232bb7['include'],function(_0x3da0e7){return{'model':db[_0x3da0e7[_0x73e7('0x22')]],'as':_0x3da0e7['as'],'attributes':_0x3da0e7[_0x73e7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x73e7('0x23')](function(_0x91310){logger[_0x73e7('0x1c')](_0x73e7('0x24'),_0x3814a4);logger[_0x73e7('0x16')](_0x73e7('0x24'),_0x3814a4,JSON[_0x73e7('0x18')](_0x91310));_0x73a4ee(_0x91310);})[_0x73e7('0x25')](function(_0x5cf9e0){logger['error'](_0x73e7('0x24'),_0x5cf9e0[_0x73e7('0x1b')],_0x3814a4);_0x4741d2(_0x49acc0['error'](0x1f4,_0x5cf9e0[_0x73e7('0x1b')]));});});};exports[_0x73e7('0x26')]=function(_0x329cf4){var _0xfbfaea=this;return new Promise(function(_0x3b0cde,_0x34514b){return db['WhatsappQueue'][_0x73e7('0x27')]({'raw':_0x329cf4['options']?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x28')]===undefined?!![]:![]:!![],'where':_0x329cf4[_0x73e7('0x1d')]?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x1e')]||null:null,'attributes':_0x329cf4[_0x73e7('0x1d')]?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x1f')]||null:null,'include':_0x329cf4['options']?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x21')]?_['map'](_0x329cf4[_0x73e7('0x1d')]['include'],function(_0x2cc711){return{'model':db[_0x2cc711[_0x73e7('0x22')]],'as':_0x2cc711['as'],'attributes':_0x2cc711[_0x73e7('0x1f')],'include':_0x2cc711[_0x73e7('0x21')]?_[_0x73e7('0x20')](_0x2cc711[_0x73e7('0x21')],function(_0x4b39f2){return{'model':db[_0x4b39f2[_0x73e7('0x22')]],'as':_0x4b39f2['as'],'attributes':_0x4b39f2['attributes'],'include':_0x4b39f2['include']?_[_0x73e7('0x20')](_0x4b39f2[_0x73e7('0x21')],function(_0x43024a){return{'model':db[_0x43024a[_0x73e7('0x22')]],'as':_0x43024a['as'],'attributes':_0x43024a[_0x73e7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2810e9){logger[_0x73e7('0x1c')](_0x73e7('0x26'),_0x329cf4);logger[_0x73e7('0x16')]('ShowWhatsappQueue',_0x329cf4,JSON[_0x73e7('0x18')](_0x2810e9));_0x3b0cde(_0x2810e9);})[_0x73e7('0x25')](function(_0x267b35){logger[_0x73e7('0x19')](_0x73e7('0x26'),_0x267b35[_0x73e7('0x1b')],_0x329cf4);_0x34514b(_0xfbfaea[_0x73e7('0x19')](0x1f4,_0x267b35[_0x73e7('0x1b')]));});});}; \ No newline at end of file +var _0x91a5=['model','debug','GetWhatsappQueue','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueue','findAll','raw','options','attributes','limit','map','include'];(function(_0x20886e,_0x47f131){var _0x4ea5ee=function(_0x2dc482){while(--_0x2dc482){_0x20886e['push'](_0x20886e['shift']());}};_0x4ea5ee(++_0x47f131);}(_0x91a5,0xfc));var _0x591a=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x91a5[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x591a('0x0'));var util=require(_0x591a('0x1'));var moment=require(_0x591a('0x2'));var BPromise=require(_0x591a('0x3'));var rs=require(_0x591a('0x4'));var fs=require('fs');var Redis=require(_0x591a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x591a('0x6'));var logger=require('../../config/logger')(_0x591a('0x7'));var config=require(_0x591a('0x8'));var jayson=require(_0x591a('0x9'));var client=jayson[_0x591a('0xa')]['http']({'port':0x232a});config[_0x591a('0xb')]=_[_0x591a('0xc')](config[_0x591a('0xb')],{'host':_0x591a('0xd'),'port':0x18eb});var socket=require(_0x591a('0xe'))(new Redis(config[_0x591a('0xb')]));require(_0x591a('0xf'))[_0x591a('0x10')](socket);function respondWithRpcPromise(_0x34a77f,_0x5439d4,_0x94aa90){return new BPromise(function(_0x561efb,_0x5cad67){return client['request'](_0x34a77f,_0x94aa90)[_0x591a('0x11')](function(_0x36a260){logger[_0x591a('0x12')](_0x591a('0x13'),_0x5439d4,_0x591a('0x14'));logger['debug'](_0x591a('0x15'),_0x5439d4,'request\x20sent',JSON[_0x591a('0x16')](_0x36a260));if(_0x36a260[_0x591a('0x17')]){if(_0x36a260['error'][_0x591a('0x18')]===0x1f4){logger[_0x591a('0x17')](_0x591a('0x13'),_0x5439d4,_0x36a260['error'][_0x591a('0x19')]);return _0x5cad67(_0x36a260[_0x591a('0x17')][_0x591a('0x19')]);}logger[_0x591a('0x17')](_0x591a('0x13'),_0x5439d4,_0x36a260['error']['message']);return _0x561efb(_0x36a260[_0x591a('0x17')]['message']);}else{logger[_0x591a('0x12')](_0x591a('0x13'),_0x5439d4,_0x591a('0x14'));_0x561efb(_0x36a260['result']['message']);}})[_0x591a('0x1a')](function(_0x1bb5a6){logger[_0x591a('0x17')](_0x591a('0x13'),_0x5439d4,_0x1bb5a6);_0x5cad67(_0x1bb5a6);});});}exports['GetWhatsappQueue']=function(_0x4c5de4){var _0x5cd166=this;return new Promise(function(_0x5a9100,_0x282e9e){return db[_0x591a('0x1b')][_0x591a('0x1c')]({'raw':_0x4c5de4['options']?_0x4c5de4['options'][_0x591a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c5de4[_0x591a('0x1e')]?_0x4c5de4[_0x591a('0x1e')]['where']||null:null,'attributes':_0x4c5de4[_0x591a('0x1e')]?_0x4c5de4['options'][_0x591a('0x1f')]||null:null,'limit':_0x4c5de4[_0x591a('0x1e')]?_0x4c5de4['options'][_0x591a('0x20')]||null:null,'include':_0x4c5de4['options']?_0x4c5de4[_0x591a('0x1e')]['include']?_[_0x591a('0x21')](_0x4c5de4['options'][_0x591a('0x22')],function(_0x11eb18){return{'model':db[_0x11eb18['model']],'as':_0x11eb18['as'],'attributes':_0x11eb18[_0x591a('0x1f')],'include':_0x11eb18[_0x591a('0x22')]?_[_0x591a('0x21')](_0x11eb18[_0x591a('0x22')],function(_0x3044a1){return{'model':db[_0x3044a1[_0x591a('0x23')]],'as':_0x3044a1['as'],'attributes':_0x3044a1[_0x591a('0x1f')],'include':_0x3044a1[_0x591a('0x22')]?_[_0x591a('0x21')](_0x3044a1['include'],function(_0x1717a4){return{'model':db[_0x1717a4[_0x591a('0x23')]],'as':_0x1717a4['as'],'attributes':_0x1717a4['attributes']};}):[]};}):[]};}):[]:[]})[_0x591a('0x11')](function(_0x885e40){logger[_0x591a('0x12')]('GetWhatsappQueue',_0x4c5de4);logger[_0x591a('0x24')](_0x591a('0x25'),_0x4c5de4,JSON['stringify'](_0x885e40));_0x5a9100(_0x885e40);})[_0x591a('0x1a')](function(_0x25a3b0){logger['error']('GetWhatsappQueue',_0x25a3b0['message'],_0x4c5de4);_0x282e9e(_0x5cd166['error'](0x1f4,_0x25a3b0[_0x591a('0x19')]));});});};exports[_0x591a('0x26')]=function(_0x23e911){var _0x4e1b28=this;return new Promise(function(_0x31de1a,_0x3c18bf){return db[_0x591a('0x1b')][_0x591a('0x27')]({'raw':_0x23e911[_0x591a('0x1e')]?_0x23e911['options'][_0x591a('0x1d')]===undefined?!![]:![]:!![],'where':_0x23e911[_0x591a('0x1e')]?_0x23e911[_0x591a('0x1e')][_0x591a('0x28')]||null:null,'attributes':_0x23e911[_0x591a('0x1e')]?_0x23e911['options'][_0x591a('0x1f')]||null:null,'include':_0x23e911[_0x591a('0x1e')]?_0x23e911['options'][_0x591a('0x22')]?_[_0x591a('0x21')](_0x23e911[_0x591a('0x1e')][_0x591a('0x22')],function(_0x5ef5d2){return{'model':db[_0x5ef5d2[_0x591a('0x23')]],'as':_0x5ef5d2['as'],'attributes':_0x5ef5d2[_0x591a('0x1f')],'include':_0x5ef5d2[_0x591a('0x22')]?_[_0x591a('0x21')](_0x5ef5d2[_0x591a('0x22')],function(_0x501e6d){return{'model':db[_0x501e6d[_0x591a('0x23')]],'as':_0x501e6d['as'],'attributes':_0x501e6d['attributes'],'include':_0x501e6d[_0x591a('0x22')]?_[_0x591a('0x21')](_0x501e6d['include'],function(_0x4b2dbb){return{'model':db[_0x4b2dbb[_0x591a('0x23')]],'as':_0x4b2dbb['as'],'attributes':_0x4b2dbb[_0x591a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321991){logger[_0x591a('0x12')]('ShowWhatsappQueue',_0x23e911);logger[_0x591a('0x24')](_0x591a('0x26'),_0x23e911,JSON[_0x591a('0x16')](_0x321991));_0x31de1a(_0x321991);})[_0x591a('0x1a')](function(_0x4512f5){logger[_0x591a('0x17')](_0x591a('0x26'),_0x4512f5[_0x591a('0x19')],_0x23e911);_0x3c18bf(_0x4e1b28[_0x591a('0x17')](0x1f4,_0x4512f5[_0x591a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d3324cd..6f36567 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 _0x502e=['./whatsappQueue.events','remove','update','register','length'];(function(_0x2ab14d,_0x2fc77e){var _0x5e2744=function(_0x241415){while(--_0x241415){_0x2ab14d['push'](_0x2ab14d['shift']());}};_0x5e2744(++_0x2fc77e);}(_0x502e,0x69));var _0xe502=function(_0x10ad65,_0x916609){_0x10ad65=_0x10ad65-0x0;var _0x2f1bcb=_0x502e[_0x10ad65];return _0x2f1bcb;};'use strict';var WhatsappQueueEvents=require(_0xe502('0x0'));var events=['save',_0xe502('0x1'),_0xe502('0x2')];function createListener(_0x3f9789,_0x525663){return function(_0x3b0070){_0x525663['emit'](_0x3f9789,_0x3b0070);};}function removeListener(_0x2c5bb1,_0x3287b2){return function(){WhatsappQueueEvents['removeListener'](_0x2c5bb1,_0x3287b2);};}exports[_0xe502('0x3')]=function(_0x527ec4){for(var _0x36ec9b=0x0,_0x454dbc=events[_0xe502('0x4')];_0x36ec9b<_0x454dbc;_0x36ec9b++){var _0x1eafa5=events[_0x36ec9b];var _0x4dc5df=createListener('whatsappQueue:'+_0x1eafa5,_0x527ec4);WhatsappQueueEvents['on'](_0x1eafa5,_0x4dc5df);}}; \ No newline at end of file +var _0xfbe0=['save','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x5d2911,_0xdc51b3){var _0x188c41=function(_0x384fa9){while(--_0x384fa9){_0x5d2911['push'](_0x5d2911['shift']());}};_0x188c41(++_0xdc51b3);}(_0xfbe0,0xd6));var _0x0fbe=function(_0x328d75,_0x5af2f9){_0x328d75=_0x328d75-0x0;var _0x2bd0da=_0xfbe0[_0x328d75];return _0x2bd0da;};'use strict';var WhatsappQueueEvents=require(_0x0fbe('0x0'));var events=[_0x0fbe('0x1'),'remove','update'];function createListener(_0x29b23e,_0x2c45c8){return function(_0x45dcdc){_0x2c45c8['emit'](_0x29b23e,_0x45dcdc);};}function removeListener(_0x3df41f,_0x27a7f4){return function(){WhatsappQueueEvents[_0x0fbe('0x2')](_0x3df41f,_0x27a7f4);};}exports['register']=function(_0x5d2ba0){for(var _0x554fe9=0x0,_0x182ec4=events[_0x0fbe('0x3')];_0x554fe9<_0x182ec4;_0x554fe9++){var _0x4b2e83=events[_0x554fe9];var _0x38be11=createListener(_0x0fbe('0x4')+_0x4b2e83,_0x5d2ba0);WhatsappQueueEvents['on'](_0x4b2e83,_0x38be11);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bdc9e17..21d700c 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 _0x59fe=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','create'];(function(_0x4fcb6c,_0xc5b404){var _0x75ac60=function(_0x1bcc31){while(--_0x1bcc31){_0x4fcb6c['push'](_0x4fcb6c['shift']());}};_0x75ac60(++_0xc5b404);}(_0x59fe,0x146));var _0xe59f=function(_0x52c9ff,_0x5d9894){_0x52c9ff=_0x52c9ff-0x0;var _0xa05b58=_0x59fe[_0x52c9ff];return _0xa05b58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe59f('0x0'));var timeout=require(_0xe59f('0x1'));var express=require(_0xe59f('0x2'));var router=express[_0xe59f('0x3')]();var fs_extra=require(_0xe59f('0x4'));var auth=require(_0xe59f('0x5'));var interaction=require(_0xe59f('0x6'));var config=require(_0xe59f('0x7'));var controller=require(_0xe59f('0x8'));router['get']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe59f('0xb')]);router[_0xe59f('0xc')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0xe')]);router['post']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xf')]);router['put'](_0xe59f('0xd'),auth[_0xe59f('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe59f('0x10')]);module[_0xe59f('0x11')]=router; \ No newline at end of file +var _0xf6be=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x5f1c3e,_0x532f71){var _0x19b1ca=function(_0x1291ec){while(--_0x1291ec){_0x5f1c3e['push'](_0x5f1c3e['shift']());}};_0x19b1ca(++_0x532f71);}(_0xf6be,0x1d1));var _0xef6b=function(_0x3c3e72,_0x3e1858){_0x3c3e72=_0x3c3e72-0x0;var _0x48a7e5=_0xf6be[_0x3c3e72];return _0x48a7e5;};'use strict';var multer=require('multer');var util=require(_0xef6b('0x0'));var path=require(_0xef6b('0x1'));var timeout=require(_0xef6b('0x2'));var express=require(_0xef6b('0x3'));var router=express[_0xef6b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef6b('0x5'));var interaction=require(_0xef6b('0x6'));var config=require(_0xef6b('0x7'));var controller=require(_0xef6b('0x8'));router[_0xef6b('0x9')]('/',auth[_0xef6b('0xa')](),controller[_0xef6b('0xb')]);router['get'](_0xef6b('0xc'),auth[_0xef6b('0xa')](),controller[_0xef6b('0xd')]);router[_0xef6b('0x9')]('/:id',auth[_0xef6b('0xa')](),controller[_0xef6b('0xe')]);router[_0xef6b('0xf')]('/',auth[_0xef6b('0xa')](),controller[_0xef6b('0x10')]);router[_0xef6b('0x11')](_0xef6b('0x12'),auth[_0xef6b('0xa')](),controller['update']);router[_0xef6b('0x13')](_0xef6b('0x12'),auth[_0xef6b('0xa')](),controller[_0xef6b('0x14')]);module[_0xef6b('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index d3900c2..5189d9b 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3bffc5,_0x1ce069){var _0x2f2023=function(_0x1f4fc2){while(--_0x1f4fc2){_0x3bffc5['push'](_0x3bffc5['shift']());}};_0x2f2023(++_0x1ce069);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x40dd35,_0x1316ff){var _0x1705ec=function(_0x21444e){while(--_0x21444e){_0x40dd35['push'](_0x40dd35['shift']());}};_0x1705ec(++_0x1316ff);}(_0x7a54,0x106));var _0x47a5=function(_0x4a8f96,_0x29cb96){_0x4a8f96=_0x4a8f96-0x0;var _0x1217d5=_0x7a54[_0x4a8f96];return _0x1217d5;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index b9d4172..428471d 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 _0xe511=['destroy','describe','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','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x3ecfab,_0x43003e){var _0x32e547=function(_0xfa1bf1){while(--_0xfa1bf1){_0x3ecfab['push'](_0x3ecfab['shift']());}};_0x32e547(++_0x43003e);}(_0xe511,0x16f));var _0x1e51=function(_0x4ac6a0,_0x4d28f9){_0x4ac6a0=_0x4ac6a0-0x0;var _0x1d9a5e=_0xe511[_0x4ac6a0];return _0x1d9a5e;};'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(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file +var _0xfef3=['offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json'];(function(_0x9e76d,_0x44e7a0){var _0x320985=function(_0x32c6c9){while(--_0x32c6c9){_0x9e76d['push'](_0x9e76d['shift']());}};_0x320985(++_0x44e7a0);}(_0xfef3,0x118));var _0x3fef=function(_0xf27c8d,_0x9ae5ef){_0xf27c8d=_0xf27c8d-0x0;var _0x568348=_0xfef3[_0xf27c8d];return _0x568348;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){_0x50025f[_0x3fef('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45464b,_0x2c0848){return function(_0x64d3e6){if(!_0x64d3e6){_0x45464b[_0x3fef('0x19')](0x194);}return _0x64d3e6;};}function handleError(_0x30e17a,_0x492ea0){_0x492ea0=_0x492ea0||0x1f4;return function(_0x4b4dee){logger['error'](_0x4b4dee[_0x3fef('0x28')]);if(_0x4b4dee[_0x3fef('0x29')]){delete _0x4b4dee['name'];}_0x30e17a[_0x3fef('0x20')](_0x492ea0)[_0x3fef('0x2a')](_0x4b4dee);};}exports['index']=function(_0x30a954,_0x3bdf03){var _0xf892bb={},_0x2b73fb={},_0x3a1a0a={'count':0x0,'rows':[]};var _0x137849=_[_0x3fef('0x2b')](db['WhatsappQueueReport'][_0x3fef('0x2c')],function(_0xc20ce5){return{'name':_0xc20ce5[_0x3fef('0x2d')],'type':_0xc20ce5[_0x3fef('0x2e')]['key']};});_0x2b73fb[_0x3fef('0x2f')]=_['map'](_0x137849,_0x3fef('0x29'));_0x2b73fb[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x30a954[_0x3fef('0x30')]);_0x2b73fb[_0x3fef('0x32')]=_[_0x3fef('0x33')](_0x2b73fb[_0x3fef('0x2f')],_0x2b73fb[_0x3fef('0x30')]);_0xf892bb[_0x3fef('0x34')]=_[_0x3fef('0x33')](_0x2b73fb['model'],qs['fields'](_0x30a954[_0x3fef('0x30')]['fields']));_0xf892bb[_0x3fef('0x34')]=_0xf892bb[_0x3fef('0x34')][_0x3fef('0x35')]?_0xf892bb[_0x3fef('0x34')]:_0x2b73fb[_0x3fef('0x2f')];if(!_0x30a954[_0x3fef('0x30')][_0x3fef('0x36')](_0x3fef('0x37'))){_0xf892bb[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x1d')]);_0xf892bb[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x30a954['query'][_0x3fef('0x1c')]);}_0xf892bb[_0x3fef('0x38')]=qs[_0x3fef('0x39')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x39')]);_0xf892bb[_0x3fef('0x3a')]=qs['filters'](_['pick'](_0x30a954[_0x3fef('0x30')],_0x2b73fb[_0x3fef('0x32')]),_0x137849);if(_0x30a954[_0x3fef('0x30')][_0x3fef('0x3b')]){_0xf892bb[_0x3fef('0x3a')]=_[_0x3fef('0x3c')](_0xf892bb[_0x3fef('0x3a')],{'$or':_[_0x3fef('0x2b')](_0x137849,function(_0x1fa70f){if(_0x1fa70f[_0x3fef('0x2e')]!==_0x3fef('0x3d')){var _0x560aae={};_0x560aae[_0x1fa70f[_0x3fef('0x29')]]={'$like':'%'+_0x30a954[_0x3fef('0x30')]['filter']+'%'};return _0x560aae;}})});}_0xf892bb=_['merge']({},_0xf892bb,_0x30a954[_0x3fef('0x3e')]);var _0x3dda68={'where':_0xf892bb[_0x3fef('0x3a')]};return db[_0x3fef('0x3f')][_0x3fef('0x1f')](_0x3dda68)[_0x3fef('0x40')](function(_0x17aff8){_0x3a1a0a[_0x3fef('0x1f')]=_0x17aff8;if(_0x30a954['query'][_0x3fef('0x41')]){_0xf892bb[_0x3fef('0x42')]=[{'all':!![]}];}return db[_0x3fef('0x3f')][_0x3fef('0x43')](_0xf892bb);})[_0x3fef('0x40')](function(_0x2143ec){_0x3a1a0a[_0x3fef('0x44')]=_0x2143ec;return _0x3a1a0a;})[_0x3fef('0x40')](respondWithFilteredResult(_0x3bdf03,_0xf892bb))[_0x3fef('0x45')](handleError(_0x3bdf03,null));};exports[_0x3fef('0x46')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x47')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x31')](db[_0x3fef('0x3f')][_0x3fef('0x2c')]);_0x15d2c7[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x12867c[_0x3fef('0x30')]);_0x15d2c7['filters']=_[_0x3fef('0x33')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x30')]);_0x2e1d7f[_0x3fef('0x34')]=_['intersection'](_0x15d2c7[_0x3fef('0x2f')],qs['fields'](_0x12867c[_0x3fef('0x30')][_0x3fef('0x48')]));_0x2e1d7f[_0x3fef('0x34')]=_0x2e1d7f[_0x3fef('0x34')][_0x3fef('0x35')]?_0x2e1d7f[_0x3fef('0x34')]:_0x15d2c7[_0x3fef('0x2f')];if(_0x12867c[_0x3fef('0x30')][_0x3fef('0x41')]){_0x2e1d7f[_0x3fef('0x42')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x3c')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x3e')]);return db[_0x3fef('0x3f')]['find'](_0x2e1d7f)[_0x3fef('0x40')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x40')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x49')]=function(_0x4210d6,_0x2f00c0){return db['WhatsappQueueReport'][_0x3fef('0x49')](_0x4210d6[_0x3fef('0x4a')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x45')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x4a')]['id'];}return db[_0x3fef('0x3f')]['find']({'where':{'id':_0x48322c[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x40')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x40')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x45')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x27')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x3f')][_0x3fef('0x4b')]({'where':{'id':_0x5b1acb[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x45')](handleError(_0x324f70,null));};exports[_0x3fef('0x4c')]=function(_0x39a4b1,_0x2b9275){return db[_0x3fef('0x3f')][_0x3fef('0x4c')]()[_0x3fef('0x40')](respondWithResult(_0x2b9275,null))[_0x3fef('0x45')](handleError(_0x2b9275,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index eed814a..017b456 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 _0x2b04=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x4244b3,_0x560e9c){var _0x40fe4d=function(_0x23b96a){while(--_0x23b96a){_0x4244b3['push'](_0x4244b3['shift']());}};_0x40fe4d(++_0x560e9c);}(_0x2b04,0x1a2));var _0x42b0=function(_0xd36577,_0x20c8e3){_0xd36577=_0xd36577-0x0;var _0x5eecd6=_0x2b04[_0xd36577];return _0x5eecd6;};'use strict';var _=require(_0x42b0('0x0'));var util=require(_0x42b0('0x1'));var logger=require(_0x42b0('0x2'))('api');var moment=require(_0x42b0('0x3'));var BPromise=require(_0x42b0('0x4'));var rp=require(_0x42b0('0x5'));var fs=require('fs');var path=require(_0x42b0('0x6'));var rimraf=require(_0x42b0('0x7'));var config=require(_0x42b0('0x8'));var attributes=require(_0x42b0('0x9'));module['exports']=function(_0x2bb323,_0x574f63){return _0x2bb323[_0x42b0('0xa')](_0x42b0('0xb'),attributes,{'tableName':_0x42b0('0xc'),'paranoid':![],'indexes':[{'name':_0x42b0('0xd'),'fields':[_0x42b0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd6=['report_whatsapp_queue','uniqueid','lodash','api','moment','request-promise','path','./whatsappQueueReport.attributes','exports','WhatsappQueueReport'];(function(_0x527d73,_0x1f6a7a){var _0x30d557=function(_0x1fee7c){while(--_0x1fee7c){_0x527d73['push'](_0x527d73['shift']());}};_0x30d557(++_0x1f6a7a);}(_0x9bd6,0x124));var _0x69bd=function(_0x248193,_0x572826){_0x248193=_0x248193-0x0;var _0x2d30fc=_0x9bd6[_0x248193];return _0x2d30fc;};'use strict';var _=require(_0x69bd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x69bd('0x1'));var moment=require(_0x69bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x69bd('0x3'));var fs=require('fs');var path=require(_0x69bd('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x69bd('0x5'));module[_0x69bd('0x6')]=function(_0x1034c4,_0x11e395){return _0x1034c4['define'](_0x69bd('0x7'),attributes,{'tableName':_0x69bd('0x8'),'paranoid':![],'indexes':[{'name':_0x69bd('0x9'),'fields':[_0x69bd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 958cc93..04049a6 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 _0xe203=['catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe203,0x1b8));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var util=require('util');var moment=require(_0x3e20('0x1'));var BPromise=require(_0x3e20('0x2'));var rs=require(_0x3e20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e20('0x4'));var logger=require('../../config/logger')(_0x3e20('0x5'));var config=require(_0x3e20('0x6'));var jayson=require(_0x3e20('0x7'));var client=jayson[_0x3e20('0x8')][_0x3e20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x347f10,_0x26ea38,_0x1c3a2e){return new BPromise(function(_0x34718f,_0x3244f5){return client[_0x3e20('0xa')](_0x347f10,_0x1c3a2e)[_0x3e20('0xb')](function(_0x365e30){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x26ea38,_0x3e20('0xc'));logger[_0x3e20('0xd')](_0x3e20('0xe'),_0x26ea38,_0x3e20('0xc'),JSON[_0x3e20('0xf')](_0x365e30));if(_0x365e30[_0x3e20('0x10')]){if(_0x365e30['error'][_0x3e20('0x11')]===0x1f4){logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);return _0x3244f5(_0x365e30['error']['message']);}logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);return _0x34718f(_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);}else{logger[_0x3e20('0x14')](_0x3e20('0x12'),_0x26ea38,_0x3e20('0xc'));_0x34718f(_0x365e30[_0x3e20('0x15')][_0x3e20('0x13')]);}})[_0x3e20('0x16')](function(_0x182f1f){logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x182f1f);_0x3244f5(_0x182f1f);});});}exports[_0x3e20('0x17')]=function(_0x311cb5){var _0x17a2e0=this;return new Promise(function(_0x2989df,_0x450b42){return db['WhatsappQueueReport']['create'](_0x311cb5[_0x3e20('0x18')],{'raw':_0x311cb5[_0x3e20('0x19')]?_0x311cb5[_0x3e20('0x19')][_0x3e20('0x1a')]===undefined?!![]:![]:!![]})[_0x3e20('0xb')](function(_0x78d91c){logger[_0x3e20('0x14')](_0x3e20('0x17'),_0x311cb5);logger[_0x3e20('0xd')](_0x3e20('0x17'),_0x311cb5,JSON['stringify'](_0x78d91c));_0x2989df(_0x78d91c);})['catch'](function(_0x1b1b5b){logger[_0x3e20('0x10')]('CreateWhatsappQueueReport',_0x1b1b5b['message'],_0x311cb5);_0x450b42(_0x17a2e0[_0x3e20('0x10')](0x1f4,_0x1b1b5b[_0x3e20('0x13')]));});});};exports[_0x3e20('0x1b')]=function(_0x4fe401){var _0x219e77=this;return new Promise(function(_0x169cbf,_0x177c5e){return db[_0x3e20('0x1c')][_0x3e20('0x1d')](_0x4fe401[_0x3e20('0x18')],{'raw':_0x4fe401[_0x3e20('0x19')]?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe401[_0x3e20('0x19')]?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1e')]||null:null,'attributes':_0x4fe401['options']?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1f')]||null:null,'limit':_0x4fe401[_0x3e20('0x19')]?_0x4fe401['options'][_0x3e20('0x20')]||null:null})[_0x3e20('0xb')](function(_0x1f076d){logger[_0x3e20('0x14')]('UpdateWhatsappQueueReport',_0x4fe401);logger[_0x3e20('0xd')](_0x3e20('0x1b'),_0x4fe401,JSON[_0x3e20('0xf')](_0x1f076d));_0x169cbf(_0x1f076d);})['catch'](function(_0x3870e2){logger[_0x3e20('0x10')](_0x3e20('0x1b'),_0x3870e2[_0x3e20('0x13')],_0x4fe401);_0x177c5e(_0x219e77['error'](0x1f4,_0x3870e2[_0x3e20('0x13')]));});});}; \ No newline at end of file +var _0xf8e2=['code','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xf8e2,0xf6));var _0x2f8e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf8e2[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2f8e('0x0'));var util=require(_0x2f8e('0x1'));var moment=require(_0x2f8e('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f8e('0x3'));var fs=require('fs');var Redis=require(_0x2f8e('0x4'));var db=require(_0x2f8e('0x5'))['db'];var utils=require(_0x2f8e('0x6'));var logger=require(_0x2f8e('0x7'))(_0x2f8e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f8e('0x9'));var client=jayson[_0x2f8e('0xa')][_0x2f8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ea095,_0x59a9b3,_0x33fb95){return new BPromise(function(_0x3597bc,_0x119b60){return client['request'](_0x4ea095,_0x33fb95)[_0x2f8e('0xc')](function(_0x2a3f0c){logger[_0x2f8e('0xd')](_0x2f8e('0xe'),_0x59a9b3,'request\x20sent');logger[_0x2f8e('0xf')](_0x2f8e('0x10'),_0x59a9b3,_0x2f8e('0x11'),JSON['stringify'](_0x2a3f0c));if(_0x2a3f0c['error']){if(_0x2a3f0c['error'][_0x2f8e('0x12')]===0x1f4){logger[_0x2f8e('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x59a9b3,_0x2a3f0c[_0x2f8e('0x13')][_0x2f8e('0x14')]);return _0x119b60(_0x2a3f0c[_0x2f8e('0x13')][_0x2f8e('0x14')]);}logger[_0x2f8e('0x13')](_0x2f8e('0xe'),_0x59a9b3,_0x2a3f0c[_0x2f8e('0x13')][_0x2f8e('0x14')]);return _0x3597bc(_0x2a3f0c[_0x2f8e('0x13')][_0x2f8e('0x14')]);}else{logger[_0x2f8e('0xd')](_0x2f8e('0xe'),_0x59a9b3,'request\x20sent');_0x3597bc(_0x2a3f0c[_0x2f8e('0x15')][_0x2f8e('0x14')]);}})['catch'](function(_0x336194){logger[_0x2f8e('0x13')](_0x2f8e('0xe'),_0x59a9b3,_0x336194);_0x119b60(_0x336194);});});}exports[_0x2f8e('0x16')]=function(_0x1cd697){var _0x3d696d=this;return new Promise(function(_0x343a24,_0x1c12dd){return db[_0x2f8e('0x17')]['create'](_0x1cd697[_0x2f8e('0x18')],{'raw':_0x1cd697[_0x2f8e('0x19')]?_0x1cd697['options'][_0x2f8e('0x1a')]===undefined?!![]:![]:!![]})[_0x2f8e('0xc')](function(_0x34a4f1){logger[_0x2f8e('0xd')](_0x2f8e('0x16'),_0x1cd697);logger[_0x2f8e('0xf')](_0x2f8e('0x16'),_0x1cd697,JSON[_0x2f8e('0x1b')](_0x34a4f1));_0x343a24(_0x34a4f1);})['catch'](function(_0x536e7d){logger[_0x2f8e('0x13')]('CreateWhatsappQueueReport',_0x536e7d[_0x2f8e('0x14')],_0x1cd697);_0x1c12dd(_0x3d696d[_0x2f8e('0x13')](0x1f4,_0x536e7d[_0x2f8e('0x14')]));});});};exports[_0x2f8e('0x1c')]=function(_0x57f20d){var _0x33347b=this;return new Promise(function(_0x3dbe8c,_0x484a9b){return db[_0x2f8e('0x17')][_0x2f8e('0x1d')](_0x57f20d[_0x2f8e('0x18')],{'raw':_0x57f20d[_0x2f8e('0x19')]?_0x57f20d[_0x2f8e('0x19')][_0x2f8e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57f20d['options']?_0x57f20d[_0x2f8e('0x19')][_0x2f8e('0x1e')]||null:null,'attributes':_0x57f20d[_0x2f8e('0x19')]?_0x57f20d['options'][_0x2f8e('0x1f')]||null:null,'limit':_0x57f20d['options']?_0x57f20d[_0x2f8e('0x19')][_0x2f8e('0x20')]||null:null})['then'](function(_0x142794){logger[_0x2f8e('0xd')](_0x2f8e('0x1c'),_0x57f20d);logger[_0x2f8e('0xf')](_0x2f8e('0x1c'),_0x57f20d,JSON[_0x2f8e('0x1b')](_0x142794));_0x3dbe8c(_0x142794);})['catch'](function(_0x340c2e){logger[_0x2f8e('0x13')](_0x2f8e('0x1c'),_0x340c2e['message'],_0x57f20d);_0x484a9b(_0x33347b['error'](0x1f4,_0x340c2e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e9166e8..a87b90e 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 _0x64c7=['/:id','isAuthenticated','post','create','put','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe'];(function(_0x3054fd,_0x2b37a7){var _0x258fd2=function(_0x482978){while(--_0x482978){_0x3054fd['push'](_0x3054fd['shift']());}};_0x258fd2(++_0x2b37a7);}(_0x64c7,0x1a5));var _0x764c=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x64c7[_0x142020];return _0x40da8f;};'use strict';var multer=require('multer');var util=require(_0x764c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x764c('0x1'));var router=express[_0x764c('0x2')]();var fs_extra=require(_0x764c('0x3'));var auth=require(_0x764c('0x4'));var interaction=require(_0x764c('0x5'));var config=require(_0x764c('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x764c('0x7')]('/',auth['isAuthenticated'](),controller[_0x764c('0x8')]);router[_0x764c('0x7')](_0x764c('0x9'),auth['isAuthenticated'](),controller[_0x764c('0xa')]);router[_0x764c('0x7')](_0x764c('0xb'),auth[_0x764c('0xc')](),controller['show']);router[_0x764c('0xd')]('/',auth['isAuthenticated'](),controller[_0x764c('0xe')]);router[_0x764c('0xf')](_0x764c('0xb'),auth[_0x764c('0xc')](),controller[_0x764c('0x10')]);router['delete'](_0x764c('0xb'),auth[_0x764c('0xc')](),controller[_0x764c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4de3=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get'];(function(_0x114903,_0x52c55e){var _0x4108e9=function(_0x5eaf3e){while(--_0x5eaf3e){_0x114903['push'](_0x114903['shift']());}};_0x4108e9(++_0x52c55e);}(_0x4de3,0xc7));var _0x34de=function(_0xc4c195,_0x57ddc8){_0xc4c195=_0xc4c195-0x0;var _0x407305=_0x4de3[_0xc4c195];return _0x407305;};'use strict';var multer=require(_0x34de('0x0'));var util=require('util');var path=require(_0x34de('0x1'));var timeout=require(_0x34de('0x2'));var express=require('express');var router=express[_0x34de('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34de('0x4'));var interaction=require(_0x34de('0x5'));var config=require(_0x34de('0x6'));var controller=require(_0x34de('0x7'));router['get']('/',auth[_0x34de('0x8')](),controller[_0x34de('0x9')]);router[_0x34de('0xa')](_0x34de('0xb'),auth[_0x34de('0x8')](),controller[_0x34de('0xc')]);router['get'](_0x34de('0xd'),auth[_0x34de('0x8')](),controller[_0x34de('0xe')]);router[_0x34de('0xf')]('/',auth[_0x34de('0x8')](),controller[_0x34de('0x10')]);router[_0x34de('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x34de('0x12')]);router[_0x34de('0x13')](_0x34de('0xd'),auth[_0x34de('0x8')](),controller[_0x34de('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4284f87..e9975bd 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 _0x49f8=['ENUM','account','queue','sequelize'];(function(_0x2442e3,_0x266653){var _0x3a718b=function(_0x592b18){while(--_0x592b18){_0x2442e3['push'](_0x2442e3['shift']());}};_0x3a718b(++_0x266653);}(_0x49f8,0xff));var _0x849f=function(_0xa5fdf4,_0x553bc8){_0xa5fdf4=_0xa5fdf4-0x0;var _0x45a73d=_0x49f8[_0xa5fdf4];return _0x45a73d;};'use strict';var Sequelize=require(_0x849f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x849f('0x1')](_0x849f('0x2'),'agent',_0x849f('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xd142=['sequelize','exports','STRING','ENUM','queue','DATE'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0xd142,0x11a));var _0x2d14=function(_0x37eb5c,_0x477cc0){_0x37eb5c=_0x37eb5c-0x0;var _0x243e31=_0xd142[_0x37eb5c];return _0x243e31;};'use strict';var Sequelize=require(_0x2d14('0x0'));module[_0x2d14('0x1')]={'uniqueid':{'type':Sequelize[_0x2d14('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2d14('0x3')]('account','agent',_0x2d14('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2d14('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 80f568e..e06d4e4 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 _0xaea8=['type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName'];(function(_0x54384e,_0x3bb484){var _0x5da9f1=function(_0x1511a4){while(--_0x1511a4){_0x54384e['push'](_0x54384e['shift']());}};_0x5da9f1(++_0x3bb484);}(_0xaea8,0x1d1));var _0x8aea=function(_0x45266b,_0x51552f){_0x45266b=_0x45266b-0x0;var _0x3ed876=_0xaea8[_0x45266b];return _0x3ed876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8aea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aea('0x1'));var rp=require('request-promise');var moment=require(_0x8aea('0x2'));var BPromise=require(_0x8aea('0x3'));var Mustache=require(_0x8aea('0x4'));var util=require(_0x8aea('0x5'));var path=require(_0x8aea('0x6'));var sox=require(_0x8aea('0x7'));var csv=require(_0x8aea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aea('0x9'));var _=require(_0x8aea('0xa'));var squel=require(_0x8aea('0xb'));var crypto=require(_0x8aea('0xc'));var jsforce=require(_0x8aea('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8aea('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8aea('0xf'));var as=require(_0x8aea('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aea('0x11'))(_0x8aea('0x12'));var utils=require(_0x8aea('0x13'));var config=require(_0x8aea('0x14'));var licenseUtil=require(_0x8aea('0x15'));var db=require(_0x8aea('0x16'))['db'];function respondWithStatusCode(_0x3bd0c1,_0x40a763){_0x40a763=_0x40a763||0xcc;return function(_0x50fa20){if(_0x50fa20){return _0x3bd0c1['sendStatus'](_0x40a763);}return _0x3bd0c1['status'](_0x40a763)['end']();};}function respondWithResult(_0x15630e,_0x30e054){_0x30e054=_0x30e054||0xc8;return function(_0x33f386){if(_0x33f386){return _0x15630e[_0x8aea('0x17')](_0x30e054)[_0x8aea('0x18')](_0x33f386);}};}function respondWithFilteredResult(_0x13d3cf,_0x4e9821){return function(_0x23639a){if(_0x23639a){var _0x5275eb=typeof _0x4e9821[_0x8aea('0x19')]==='undefined'&&typeof _0x4e9821[_0x8aea('0x1a')]===_0x8aea('0x1b');var _0x331b98=_0x23639a[_0x8aea('0x1c')];var _0x253e8e=_0x5275eb?0x0:_0x4e9821[_0x8aea('0x19')];var _0x297228=_0x5275eb?_0x23639a[_0x8aea('0x1c')]:_0x4e9821['offset']+_0x4e9821[_0x8aea('0x1a')];var _0x59b412;if(_0x297228>=_0x331b98){_0x297228=_0x331b98;_0x59b412=0xc8;}else{_0x59b412=0xce;}_0x13d3cf[_0x8aea('0x17')](_0x59b412);return _0x13d3cf[_0x8aea('0x1d')](_0x8aea('0x1e'),_0x253e8e+'-'+_0x297228+'/'+_0x331b98)['json'](_0x23639a);}return null;};}function patchUpdates(_0x1e69ce){return function(_0x1c72a9){try{jsonpatch[_0x8aea('0x1f')](_0x1c72a9,_0x1e69ce,!![]);}catch(_0x7dbcb8){return BPromise[_0x8aea('0x20')](_0x7dbcb8);}return _0x1c72a9['save']();};}function saveUpdates(_0xb367c0,_0x4453d2){return function(_0x18388d){if(_0x18388d){return _0x18388d[_0x8aea('0x21')](_0xb367c0)[_0x8aea('0x22')](function(_0x3e76bf){return _0x3e76bf;});}return null;};}function removeEntity(_0x4a1421,_0x387638){return function(_0x266e2b){if(_0x266e2b){return _0x266e2b[_0x8aea('0x23')]()[_0x8aea('0x22')](function(){_0x4a1421['status'](0xcc)[_0x8aea('0x24')]();});}};}function handleEntityNotFound(_0x482ba6,_0x49e7f2){return function(_0x3e786e){if(!_0x3e786e){_0x482ba6[_0x8aea('0x25')](0x194);}return _0x3e786e;};}function handleError(_0x3a29cd,_0x2b5fb3){_0x2b5fb3=_0x2b5fb3||0x1f4;return function(_0x5c8362){logger[_0x8aea('0x26')](_0x5c8362['stack']);if(_0x5c8362[_0x8aea('0x27')]){delete _0x5c8362[_0x8aea('0x27')];}_0x3a29cd['status'](_0x2b5fb3)[_0x8aea('0x28')](_0x5c8362);};}exports[_0x8aea('0x29')]=function(_0x1afdc3,_0x1ffc93){var _0x5850bb={},_0x6f151e={},_0x24c3b4={'count':0x0,'rows':[]};var _0x1e5a8c=_[_0x8aea('0x2a')](db[_0x8aea('0x2b')][_0x8aea('0x2c')],function(_0x175c14){return{'name':_0x175c14[_0x8aea('0x2d')],'type':_0x175c14[_0x8aea('0x2e')][_0x8aea('0x2f')]};});_0x6f151e[_0x8aea('0x30')]=_[_0x8aea('0x2a')](_0x1e5a8c,_0x8aea('0x27'));_0x6f151e[_0x8aea('0x31')]=_[_0x8aea('0x32')](_0x1afdc3['query']);_0x6f151e[_0x8aea('0x33')]=_[_0x8aea('0x34')](_0x6f151e[_0x8aea('0x30')],_0x6f151e[_0x8aea('0x31')]);_0x5850bb[_0x8aea('0x35')]=_[_0x8aea('0x34')](_0x6f151e[_0x8aea('0x30')],qs['fields'](_0x1afdc3[_0x8aea('0x31')][_0x8aea('0x36')]));_0x5850bb[_0x8aea('0x35')]=_0x5850bb[_0x8aea('0x35')][_0x8aea('0x37')]?_0x5850bb['attributes']:_0x6f151e[_0x8aea('0x30')];if(!_0x1afdc3[_0x8aea('0x31')]['hasOwnProperty']('nolimit')){_0x5850bb['limit']=qs[_0x8aea('0x1a')](_0x1afdc3['query'][_0x8aea('0x1a')]);_0x5850bb[_0x8aea('0x19')]=qs[_0x8aea('0x19')](_0x1afdc3['query'][_0x8aea('0x19')]);}_0x5850bb['order']=qs[_0x8aea('0x38')](_0x1afdc3[_0x8aea('0x31')]['sort']);_0x5850bb[_0x8aea('0x39')]=qs[_0x8aea('0x33')](_[_0x8aea('0x3a')](_0x1afdc3[_0x8aea('0x31')],_0x6f151e[_0x8aea('0x33')]),_0x1e5a8c);if(_0x1afdc3[_0x8aea('0x31')]['filter']){_0x5850bb[_0x8aea('0x39')]=_[_0x8aea('0x3b')](_0x5850bb['where'],{'$or':_[_0x8aea('0x2a')](_0x1e5a8c,function(_0x98b326){if(_0x98b326[_0x8aea('0x2e')]!==_0x8aea('0x3c')){var _0x93330c={};_0x93330c[_0x98b326[_0x8aea('0x27')]]={'$like':'%'+_0x1afdc3[_0x8aea('0x31')]['filter']+'%'};return _0x93330c;}})});}_0x5850bb=_[_0x8aea('0x3b')]({},_0x5850bb,_0x1afdc3[_0x8aea('0x3d')]);var _0x529e2d={'where':_0x5850bb[_0x8aea('0x39')]};return db[_0x8aea('0x2b')][_0x8aea('0x1c')](_0x529e2d)[_0x8aea('0x22')](function(_0x540110){_0x24c3b4[_0x8aea('0x1c')]=_0x540110;if(_0x1afdc3[_0x8aea('0x31')][_0x8aea('0x3e')]){_0x5850bb['include']=[{'all':!![]}];}return db[_0x8aea('0x2b')][_0x8aea('0x3f')](_0x5850bb);})['then'](function(_0x4fbd3f){_0x24c3b4[_0x8aea('0x40')]=_0x4fbd3f;return _0x24c3b4;})[_0x8aea('0x22')](respondWithFilteredResult(_0x1ffc93,_0x5850bb))[_0x8aea('0x41')](handleError(_0x1ffc93,null));};exports[_0x8aea('0x42')]=function(_0x503ea5,_0x334dfb){var _0x157ce4={'raw':!![],'where':{'id':_0x503ea5[_0x8aea('0x43')]['id']}},_0x5e9756={};_0x5e9756[_0x8aea('0x30')]=_[_0x8aea('0x32')](db[_0x8aea('0x2b')][_0x8aea('0x2c')]);_0x5e9756['query']=_[_0x8aea('0x32')](_0x503ea5['query']);_0x5e9756[_0x8aea('0x33')]=_[_0x8aea('0x34')](_0x5e9756[_0x8aea('0x30')],_0x5e9756[_0x8aea('0x31')]);_0x157ce4['attributes']=_[_0x8aea('0x34')](_0x5e9756[_0x8aea('0x30')],qs[_0x8aea('0x36')](_0x503ea5[_0x8aea('0x31')]['fields']));_0x157ce4[_0x8aea('0x35')]=_0x157ce4[_0x8aea('0x35')][_0x8aea('0x37')]?_0x157ce4['attributes']:_0x5e9756[_0x8aea('0x30')];if(_0x503ea5['query'][_0x8aea('0x3e')]){_0x157ce4[_0x8aea('0x44')]=[{'all':!![]}];}_0x157ce4=_[_0x8aea('0x3b')]({},_0x157ce4,_0x503ea5['options']);return db[_0x8aea('0x2b')][_0x8aea('0x45')](_0x157ce4)[_0x8aea('0x22')](handleEntityNotFound(_0x334dfb,null))['then'](respondWithResult(_0x334dfb,null))['catch'](handleError(_0x334dfb,null));};exports[_0x8aea('0x46')]=function(_0x5abaaf,_0x250fad){return db[_0x8aea('0x2b')][_0x8aea('0x46')](_0x5abaaf['body'],{})[_0x8aea('0x22')](respondWithResult(_0x250fad,0xc9))[_0x8aea('0x41')](handleError(_0x250fad,null));};exports['update']=function(_0x4a0122,_0x1ef24f){if(_0x4a0122['body']['id']){delete _0x4a0122[_0x8aea('0x47')]['id'];}return db[_0x8aea('0x2b')][_0x8aea('0x45')]({'where':{'id':_0x4a0122['params']['id']}})[_0x8aea('0x22')](handleEntityNotFound(_0x1ef24f,null))[_0x8aea('0x22')](saveUpdates(_0x4a0122[_0x8aea('0x47')],null))['then'](respondWithResult(_0x1ef24f,null))[_0x8aea('0x41')](handleError(_0x1ef24f,null));};exports['destroy']=function(_0x25855b,_0x533d1f){return db[_0x8aea('0x2b')][_0x8aea('0x45')]({'where':{'id':_0x25855b['params']['id']}})[_0x8aea('0x22')](handleEntityNotFound(_0x533d1f,null))[_0x8aea('0x22')](removeEntity(_0x533d1f,null))[_0x8aea('0x41')](handleError(_0x533d1f,null));};exports[_0x8aea('0x48')]=function(_0x13dc98,_0x1fb98e){return db['WhatsappTransferReport'][_0x8aea('0x48')]()[_0x8aea('0x22')](respondWithResult(_0x1fb98e,null))[_0x8aea('0x41')](handleError(_0x1fb98e,null));}; \ No newline at end of file +var _0x89f4=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x574347,_0x214e05){var _0x57f200=function(_0x539128){while(--_0x539128){_0x574347['push'](_0x574347['shift']());}};_0x57f200(++_0x214e05);}(_0x89f4,0x17a));var _0x489f=function(_0x4f8b10,_0x1a4093){_0x4f8b10=_0x4f8b10-0x0;var _0x2ff233=_0x89f4[_0x4f8b10];return _0x2ff233;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x489f('0x0'));var zipdir=require(_0x489f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x489f('0x2'));var moment=require(_0x489f('0x3'));var BPromise=require(_0x489f('0x4'));var Mustache=require(_0x489f('0x5'));var util=require(_0x489f('0x6'));var path=require(_0x489f('0x7'));var sox=require(_0x489f('0x8'));var csv=require(_0x489f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x489f('0xa'));var _=require(_0x489f('0xb'));var squel=require(_0x489f('0xc'));var crypto=require(_0x489f('0xd'));var jsforce=require(_0x489f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x489f('0x9'));var querystring=require(_0x489f('0xf'));var Papa=require(_0x489f('0x10'));var Redis=require(_0x489f('0x11'));var authService=require(_0x489f('0x12'));var qs=require(_0x489f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x489f('0x14'))(_0x489f('0x15'));var utils=require('../../config/utils');var config=require(_0x489f('0x16'));var licenseUtil=require(_0x489f('0x17'));var db=require(_0x489f('0x18'))['db'];function respondWithStatusCode(_0x271049,_0x3be6a9){_0x3be6a9=_0x3be6a9||0xcc;return function(_0x572ffe){if(_0x572ffe){return _0x271049[_0x489f('0x19')](_0x3be6a9);}return _0x271049[_0x489f('0x1a')](_0x3be6a9)[_0x489f('0x1b')]();};}function respondWithResult(_0x31a133,_0x22086e){_0x22086e=_0x22086e||0xc8;return function(_0x44d417){if(_0x44d417){return _0x31a133[_0x489f('0x1a')](_0x22086e)[_0x489f('0x1c')](_0x44d417);}};}function respondWithFilteredResult(_0x328334,_0x34e888){return function(_0x5eefa7){if(_0x5eefa7){var _0x299838=typeof _0x34e888['offset']===_0x489f('0x1d')&&typeof _0x34e888[_0x489f('0x1e')]===_0x489f('0x1d');var _0x245fac=_0x5eefa7['count'];var _0x5e5537=_0x299838?0x0:_0x34e888[_0x489f('0x1f')];var _0x3d77db=_0x299838?_0x5eefa7[_0x489f('0x20')]:_0x34e888['offset']+_0x34e888[_0x489f('0x1e')];var _0x568e45;if(_0x3d77db>=_0x245fac){_0x3d77db=_0x245fac;_0x568e45=0xc8;}else{_0x568e45=0xce;}_0x328334[_0x489f('0x1a')](_0x568e45);return _0x328334[_0x489f('0x21')]('Content-Range',_0x5e5537+'-'+_0x3d77db+'/'+_0x245fac)[_0x489f('0x1c')](_0x5eefa7);}return null;};}function patchUpdates(_0x56645c){return function(_0x3134f9){try{jsonpatch['apply'](_0x3134f9,_0x56645c,!![]);}catch(_0x4fd5e6){return BPromise[_0x489f('0x22')](_0x4fd5e6);}return _0x3134f9[_0x489f('0x23')]();};}function saveUpdates(_0x2d0609,_0x2e5d25){return function(_0xf9a150){if(_0xf9a150){return _0xf9a150[_0x489f('0x24')](_0x2d0609)['then'](function(_0x49decc){return _0x49decc;});}return null;};}function removeEntity(_0x43864f,_0x94471c){return function(_0x3fcb31){if(_0x3fcb31){return _0x3fcb31['destroy']()[_0x489f('0x25')](function(){_0x43864f[_0x489f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bf27,_0x1b7cc1){return function(_0x12dd25){if(!_0x12dd25){_0x31bf27['sendStatus'](0x194);}return _0x12dd25;};}function handleError(_0x499169,_0x54ae02){_0x54ae02=_0x54ae02||0x1f4;return function(_0x38a658){logger[_0x489f('0x26')](_0x38a658['stack']);if(_0x38a658[_0x489f('0x27')]){delete _0x38a658[_0x489f('0x27')];}_0x499169[_0x489f('0x1a')](_0x54ae02)[_0x489f('0x28')](_0x38a658);};}exports[_0x489f('0x29')]=function(_0x2f03e6,_0x1cc7ae){var _0x57791c={},_0x426bc8={},_0x31e597={'count':0x0,'rows':[]};var _0x1ebc0c=_[_0x489f('0x2a')](db[_0x489f('0x2b')][_0x489f('0x2c')],function(_0xab32ed){return{'name':_0xab32ed[_0x489f('0x2d')],'type':_0xab32ed[_0x489f('0x2e')][_0x489f('0x2f')]};});_0x426bc8[_0x489f('0x30')]=_[_0x489f('0x2a')](_0x1ebc0c,'name');_0x426bc8[_0x489f('0x31')]=_[_0x489f('0x32')](_0x2f03e6[_0x489f('0x31')]);_0x426bc8[_0x489f('0x33')]=_[_0x489f('0x34')](_0x426bc8['model'],_0x426bc8['query']);_0x57791c[_0x489f('0x35')]=_[_0x489f('0x34')](_0x426bc8[_0x489f('0x30')],qs[_0x489f('0x36')](_0x2f03e6['query'][_0x489f('0x36')]));_0x57791c[_0x489f('0x35')]=_0x57791c[_0x489f('0x35')][_0x489f('0x37')]?_0x57791c['attributes']:_0x426bc8[_0x489f('0x30')];if(!_0x2f03e6[_0x489f('0x31')][_0x489f('0x38')](_0x489f('0x39'))){_0x57791c[_0x489f('0x1e')]=qs['limit'](_0x2f03e6['query'][_0x489f('0x1e')]);_0x57791c[_0x489f('0x1f')]=qs[_0x489f('0x1f')](_0x2f03e6[_0x489f('0x31')][_0x489f('0x1f')]);}_0x57791c[_0x489f('0x3a')]=qs['sort'](_0x2f03e6[_0x489f('0x31')][_0x489f('0x3b')]);_0x57791c['where']=qs[_0x489f('0x33')](_[_0x489f('0x3c')](_0x2f03e6[_0x489f('0x31')],_0x426bc8[_0x489f('0x33')]),_0x1ebc0c);if(_0x2f03e6['query']['filter']){_0x57791c['where']=_[_0x489f('0x3d')](_0x57791c[_0x489f('0x3e')],{'$or':_['map'](_0x1ebc0c,function(_0x120a12){if(_0x120a12['type']!==_0x489f('0x3f')){var _0x51981a={};_0x51981a[_0x120a12[_0x489f('0x27')]]={'$like':'%'+_0x2f03e6[_0x489f('0x31')][_0x489f('0x40')]+'%'};return _0x51981a;}})});}_0x57791c=_[_0x489f('0x3d')]({},_0x57791c,_0x2f03e6[_0x489f('0x41')]);var _0x2f2edc={'where':_0x57791c['where']};return db[_0x489f('0x2b')][_0x489f('0x20')](_0x2f2edc)['then'](function(_0x1f0dc6){_0x31e597[_0x489f('0x20')]=_0x1f0dc6;if(_0x2f03e6[_0x489f('0x31')][_0x489f('0x42')]){_0x57791c[_0x489f('0x43')]=[{'all':!![]}];}return db[_0x489f('0x2b')]['findAll'](_0x57791c);})[_0x489f('0x25')](function(_0x5b933c){_0x31e597[_0x489f('0x44')]=_0x5b933c;return _0x31e597;})[_0x489f('0x25')](respondWithFilteredResult(_0x1cc7ae,_0x57791c))[_0x489f('0x45')](handleError(_0x1cc7ae,null));};exports[_0x489f('0x46')]=function(_0x10669e,_0x5a1810){var _0x58eb30={'raw':!![],'where':{'id':_0x10669e[_0x489f('0x47')]['id']}},_0x23b9ea={};_0x23b9ea['model']=_['keys'](db[_0x489f('0x2b')]['rawAttributes']);_0x23b9ea[_0x489f('0x31')]=_[_0x489f('0x32')](_0x10669e['query']);_0x23b9ea['filters']=_[_0x489f('0x34')](_0x23b9ea[_0x489f('0x30')],_0x23b9ea['query']);_0x58eb30[_0x489f('0x35')]=_[_0x489f('0x34')](_0x23b9ea[_0x489f('0x30')],qs['fields'](_0x10669e[_0x489f('0x31')]['fields']));_0x58eb30[_0x489f('0x35')]=_0x58eb30['attributes'][_0x489f('0x37')]?_0x58eb30[_0x489f('0x35')]:_0x23b9ea[_0x489f('0x30')];if(_0x10669e['query'][_0x489f('0x42')]){_0x58eb30[_0x489f('0x43')]=[{'all':!![]}];}_0x58eb30=_[_0x489f('0x3d')]({},_0x58eb30,_0x10669e[_0x489f('0x41')]);return db[_0x489f('0x2b')]['find'](_0x58eb30)[_0x489f('0x25')](handleEntityNotFound(_0x5a1810,null))[_0x489f('0x25')](respondWithResult(_0x5a1810,null))[_0x489f('0x45')](handleError(_0x5a1810,null));};exports[_0x489f('0x48')]=function(_0x5a5431,_0x4e4814){return db[_0x489f('0x2b')][_0x489f('0x48')](_0x5a5431['body'],{})[_0x489f('0x25')](respondWithResult(_0x4e4814,0xc9))['catch'](handleError(_0x4e4814,null));};exports[_0x489f('0x24')]=function(_0x1f6ca4,_0x57446c){if(_0x1f6ca4['body']['id']){delete _0x1f6ca4[_0x489f('0x49')]['id'];}return db[_0x489f('0x2b')][_0x489f('0x4a')]({'where':{'id':_0x1f6ca4[_0x489f('0x47')]['id']}})[_0x489f('0x25')](handleEntityNotFound(_0x57446c,null))[_0x489f('0x25')](saveUpdates(_0x1f6ca4[_0x489f('0x49')],null))[_0x489f('0x25')](respondWithResult(_0x57446c,null))[_0x489f('0x45')](handleError(_0x57446c,null));};exports[_0x489f('0x4b')]=function(_0x42fae4,_0x2acc36){return db[_0x489f('0x2b')][_0x489f('0x4a')]({'where':{'id':_0x42fae4[_0x489f('0x47')]['id']}})[_0x489f('0x25')](handleEntityNotFound(_0x2acc36,null))[_0x489f('0x25')](removeEntity(_0x2acc36,null))['catch'](handleError(_0x2acc36,null));};exports['describe']=function(_0x4e248a,_0x5229f3){return db[_0x489f('0x2b')][_0x489f('0x4c')]()[_0x489f('0x25')](respondWithResult(_0x5229f3,null))[_0x489f('0x45')](handleError(_0x5229f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 9fde065..5ecda82 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 _0x0a78=['path','rimraf','../../config/environment','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x0a78,0xcc));var _0x80a7=function(_0x1450ec,_0x22717b){_0x1450ec=_0x1450ec-0x0;var _0x2dc025=_0x0a78[_0x1450ec];return _0x2dc025;};'use strict';var _=require(_0x80a7('0x0'));var util=require(_0x80a7('0x1'));var logger=require(_0x80a7('0x2'))(_0x80a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x80a7('0x4'));var fs=require('fs');var path=require(_0x80a7('0x5'));var rimraf=require(_0x80a7('0x6'));var config=require(_0x80a7('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x216320,_0x4682c9){return _0x216320['define'](_0x80a7('0x8'),attributes,{'tableName':_0x80a7('0x9'),'paranoid':![],'indexes':[{'name':_0x80a7('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x447d=['rimraf','exports','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x25d263,_0x427584){var _0x30d528=function(_0x173651){while(--_0x173651){_0x25d263['push'](_0x25d263['shift']());}};_0x30d528(++_0x427584);}(_0x447d,0x93));var _0xd447=function(_0x1a013c,_0x5ac4d4){_0x1a013c=_0x1a013c-0x0;var _0x5947ec=_0x447d[_0x1a013c];return _0x5947ec;};'use strict';var _=require(_0xd447('0x0'));var util=require(_0xd447('0x1'));var logger=require(_0xd447('0x2'))(_0xd447('0x3'));var moment=require('moment');var BPromise=require(_0xd447('0x4'));var rp=require(_0xd447('0x5'));var fs=require('fs');var path=require(_0xd447('0x6'));var rimraf=require(_0xd447('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xd447('0x8')]=function(_0x385678,_0x197a58){return _0x385678['define']('WhatsappTransferReport',attributes,{'tableName':_0xd447('0x9'),'paranoid':![],'indexes':[{'name':_0xd447('0xa'),'fields':[_0xd447('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 202db55..7321eb3 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 _0x4658=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0x4658,0xe7));var _0x8465=function(_0xc3c3e,_0x4e9fe0){_0xc3c3e=_0xc3c3e-0x0;var _0xc2d1f4=_0x4658[_0xc3c3e];return _0xc2d1f4;};'use strict';var _=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var moment=require(_0x8465('0x2'));var BPromise=require(_0x8465('0x3'));var rs=require(_0x8465('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8465('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8465('0x6'))('rpc');var config=require(_0x8465('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8465('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x372748,_0x4cac16,_0x4dd64f){return new BPromise(function(_0x5a1d7c,_0x3b009d){return client[_0x8465('0x9')](_0x372748,_0x4dd64f)[_0x8465('0xa')](function(_0x24724d){logger[_0x8465('0xb')](_0x8465('0xc'),_0x4cac16,'request\x20sent');logger['debug'](_0x8465('0xd'),_0x4cac16,'request\x20sent',JSON[_0x8465('0xe')](_0x24724d));if(_0x24724d[_0x8465('0xf')]){if(_0x24724d[_0x8465('0xf')][_0x8465('0x10')]===0x1f4){logger[_0x8465('0xf')](_0x8465('0xc'),_0x4cac16,_0x24724d['error'][_0x8465('0x11')]);return _0x3b009d(_0x24724d[_0x8465('0xf')]['message']);}logger[_0x8465('0xf')](_0x8465('0xc'),_0x4cac16,_0x24724d[_0x8465('0xf')][_0x8465('0x11')]);return _0x5a1d7c(_0x24724d['error'][_0x8465('0x11')]);}else{logger[_0x8465('0xb')](_0x8465('0xc'),_0x4cac16,_0x8465('0x12'));_0x5a1d7c(_0x24724d[_0x8465('0x13')][_0x8465('0x11')]);}})[_0x8465('0x14')](function(_0x57f13e){logger[_0x8465('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4cac16,_0x57f13e);_0x3b009d(_0x57f13e);});});} \ No newline at end of file +var _0x11a1=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','../../config/utils','rpc','../../config/environment','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c08b4,_0x52318d){var _0x5c200f=function(_0x2a416c){while(--_0x2a416c){_0x3c08b4['push'](_0x3c08b4['shift']());}};_0x5c200f(++_0x52318d);}(_0x11a1,0x196));var _0x111a=function(_0x1e7f5c,_0x52fe5a){_0x1e7f5c=_0x1e7f5c-0x0;var _0x19dc3f=_0x11a1[_0x1e7f5c];return _0x19dc3f;};'use strict';var _=require(_0x111a('0x0'));var util=require('util');var moment=require(_0x111a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x111a('0x2'));var logger=require('../../config/logger')(_0x111a('0x3'));var config=require(_0x111a('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x111a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3f5abb,_0x3209c4,_0x3b57ff){return new BPromise(function(_0x221a8a,_0x252bc6){return client[_0x111a('0x6')](_0x3f5abb,_0x3b57ff)[_0x111a('0x7')](function(_0x10dad8){logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));logger[_0x111a('0xb')](_0x111a('0xc'),_0x3209c4,_0x111a('0xa'),JSON[_0x111a('0xd')](_0x10dad8));if(_0x10dad8[_0x111a('0xe')]){if(_0x10dad8[_0x111a('0xe')][_0x111a('0xf')]===0x1f4){logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x252bc6(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x221a8a(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}else{logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));_0x221a8a(_0x10dad8[_0x111a('0x11')][_0x111a('0x10')]);}})[_0x111a('0x12')](function(_0x164a80){logger['error'](_0x111a('0x9'),_0x3209c4,_0x164a80);_0x252bc6(_0x164a80);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7fcced0..c3f7bc5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34aa=['join','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x34aa,0x171));var _0xa34a=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x34aa[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0xa34a('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xa34a('0x1'));var checkLicense=require(_0xa34a('0x2'));var rpc=require(_0xa34a('0x3'));var config=require(_0xa34a('0x4'));var logger=require('./config/logger')(_0xa34a('0x5'));var pm2=require(_0xa34a('0x6'));var pm2Config=require(_0xa34a('0x7'));var schedule=require(_0xa34a('0x8'));var chat=require(_0xa34a('0x9'));var whatsapp=require(_0xa34a('0xa'));var transcribe=require(_0xa34a('0xb'));var provider=require(_0xa34a('0xc'));function main(){return db[_0xa34a('0xd')][_0xa34a('0xe')]()[_0xa34a('0xf')](function(){if(config['seedDB']){return seedDb[_0xa34a('0x10')]();}})[_0xa34a('0xf')](function(){return checkLicense[_0xa34a('0x10')]();})[_0xa34a('0xf')](function(){return rpc[_0xa34a('0x11')]();})['then'](function(_0x864029){logger[_0xa34a('0x12')](_0x864029);return chat[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return whatsapp[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return schedule[_0xa34a('0x13')]();})['then'](function(){return transcribe[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return provider[_0xa34a('0x13')]();})['then'](function(_0xc08e6){logger[_0xa34a('0x12')](_0xc08e6);return pm2['start'](pm2Config);})[_0xa34a('0xf')](function(_0x3d5926){var _0x5af32c=_0x3d5926[_0xa34a('0x14')](function(_0x7ac9a2){return typeof _0x7ac9a2[_0xa34a('0x15')]===_0xa34a('0x16')&&_0x7ac9a2[_0xa34a('0x15')]>=0x0;});if(_0x5af32c['length']>0x0){throw new Error(_0x5af32c[_0xa34a('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xa34a('0x18')](_0x5af32c,function(_0x14837d){return'\x22'+_0x14837d[_0xa34a('0x19')][_0xa34a('0x1a')]+'\x22';}));}logger['info'](_0xa34a('0x1b'),_[_0xa34a('0x18')](_[_0xa34a('0x14')](_0x3d5926,{'status':_0xa34a('0x1c')}),_0xa34a('0x1a'))['join']());logger[_0xa34a('0x12')](_0xa34a('0x1d'),_[_0xa34a('0x18')](_['filter'](_0x3d5926,function(_0x14a18b){return _0x14a18b[_0xa34a('0x1e')]!==_0xa34a('0x1c');}),_0xa34a('0x1a'))[_0xa34a('0x1f')]()||_0xa34a('0x20'));console['log'](_0xa34a('0x21'));})[_0xa34a('0x22')](function(_0x5f030c){console[_0xa34a('0x23')](_0xa34a('0x24'),_0x5f030c);logger[_0xa34a('0x25')](_0xa34a('0x26'),_0x5f030c);process[_0xa34a('0x27')](0x1);});}main(); \ No newline at end of file +var _0x6c32=['sync','then','seedDB','default','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','online','name','status','log','App\x20Ready!','catch','error','exit','lodash','./config/seedDB','./rpc','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize'];(function(_0x5441e3,_0x5db97c){var _0x54d25d=function(_0x388d05){while(--_0x388d05){_0x5441e3['push'](_0x5441e3['shift']());}};_0x54d25d(++_0x5db97c);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x26c3('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x26c3('0x2'));var config=require('./config/environment');var logger=require(_0x26c3('0x3'))(_0x26c3('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x26c3('0x5'));var chat=require(_0x26c3('0x6'));var whatsapp=require(_0x26c3('0x7'));var transcribe=require(_0x26c3('0x8'));var provider=require(_0x26c3('0x9'));function main(){return db[_0x26c3('0xa')][_0x26c3('0xb')]()[_0x26c3('0xc')](function(){if(config[_0x26c3('0xd')]){return seedDb[_0x26c3('0xe')]();}})['then'](function(){return checkLicense['default']();})[_0x26c3('0xc')](function(){return rpc['listen']();})[_0x26c3('0xc')](function(_0xc6e3b4){logger['info'](_0xc6e3b4);return chat[_0x26c3('0xf')]();})[_0x26c3('0xc')](function(){return whatsapp[_0x26c3('0xf')]();})[_0x26c3('0xc')](function(){return schedule[_0x26c3('0xf')]();})['then'](function(){return transcribe[_0x26c3('0xf')]();})[_0x26c3('0xc')](function(){return provider[_0x26c3('0xf')]();})[_0x26c3('0xc')](function(_0x1ef1a9){logger[_0x26c3('0x10')](_0x1ef1a9);return pm2[_0x26c3('0xf')](pm2Config);})[_0x26c3('0xc')](function(_0x5443cd){var _0x554c06=_0x5443cd[_0x26c3('0x11')](function(_0xd612e7){return typeof _0xd612e7[_0x26c3('0x12')]===_0x26c3('0x13')&&_0xd612e7[_0x26c3('0x12')]>=0x0;});if(_0x554c06[_0x26c3('0x14')]>0x0){throw new Error(_0x554c06['length']+_0x26c3('0x15')+_[_0x26c3('0x16')](_0x554c06,function(_0x4db301){return'\x22'+_0x4db301[_0x26c3('0x17')]['name']+'\x22';}));}logger[_0x26c3('0x10')]('Online\x20apps:',_[_0x26c3('0x16')](_[_0x26c3('0x11')](_0x5443cd,{'status':_0x26c3('0x18')}),_0x26c3('0x19'))['join']());logger[_0x26c3('0x10')]('Offline\x20apps:',_[_0x26c3('0x16')](_['filter'](_0x5443cd,function(_0x1c77e6){return _0x1c77e6[_0x26c3('0x1a')]!==_0x26c3('0x18');}),'name')['join']()||'None');console[_0x26c3('0x1b')](_0x26c3('0x1c'));})[_0x26c3('0x1d')](function(_0x5a18c9){console[_0x26c3('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x5a18c9);logger[_0x26c3('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5a18c9);process[_0x26c3('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3df3cf1..92416f2 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 _0xe511=['phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','unmanaged','json','Unmanaged.','headers','authorization','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','apikey','getUuid','findOne','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','setTokenCookie','role','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires'];(function(_0x541587,_0x494e6b){var _0x5d8b69=function(_0x32bcca){while(--_0x32bcca){_0x541587['push'](_0x541587['shift']());}};_0x5d8b69(++_0x494e6b);}(_0xe511,0x16f));var _0x1e51=function(_0x1e72d7,_0x46057b){_0x1e72d7=_0x1e72d7-0x0;var _0x5a8f0e=_0xe511[_0x1e72d7];return _0x5a8f0e;};'use strict';var db=require(_0x1e51('0x0'))['db'];var config=require(_0x1e51('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1e51('0x2'));var encryptor=require('../encryptor');var _=require(_0x1e51('0x3'));var jwt=require(_0x1e51('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x1e51('0x5'));var basicAuth=require(_0x1e51('0x6'));var crypto=require(_0x1e51('0x7'));var BPromise=require(_0x1e51('0x8'));var util=require('util');var moment=require(_0x1e51('0x9'));var validateJwt=expressJwt({'secret':config[_0x1e51('0xa')]['session']});var userAttributes=['id','role',_0x1e51('0xb'),_0x1e51('0xc'),'internal','email',_0x1e51('0xd'),_0x1e51('0xe'),_0x1e51('0xf'),_0x1e51('0x10'),_0x1e51('0x11'),_0x1e51('0x12'),'faxPause',_0x1e51('0x13'),_0x1e51('0x14'),_0x1e51('0x15'),_0x1e51('0x16'),_0x1e51('0x17'),_0x1e51('0x18'),'crudPermissions',_0x1e51('0x19'),_0x1e51('0x1a'),_0x1e51('0x1b'),_0x1e51('0x1c'),_0x1e51('0x1d'),_0x1e51('0x1e'),_0x1e51('0x1f'),_0x1e51('0x20'),_0x1e51('0x21'),_0x1e51('0x22'),'phoneBarPrefixRequired',_0x1e51('0x23'),_0x1e51('0x24'),_0x1e51('0x25'),'interface',_0x1e51('0x26'),'privacyEnabled','settingsEnabled',_0x1e51('0x27'),_0x1e51('0x28'),_0x1e51('0x29'),_0x1e51('0x2a'),_0x1e51('0x2b'),_0x1e51('0x2c'),'chatAutoanswer',_0x1e51('0x2d'),'emailAutoanswer',_0x1e51('0x2e'),_0x1e51('0x2f'),_0x1e51('0x30'),_0x1e51('0x31'),'openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x1e51('0x32'),'messengerSoundNotification'];exports[_0x1e51('0x33')]=function(){return this[_0x1e51('0x34')](!![])[_0x1e51('0x35')](function(_0x13240f,_0x23c85a,_0xf9298){if(_0x13240f[_0x1e51('0x36')]){_0xf9298();}else{return db[_0x1e51('0x37')]['findOne']({'where':{'id':_0x13240f['params']['id']},'attributes':['id',_0x1e51('0x38'),_0x1e51('0x39')],'raw':!![]})[_0x1e51('0x3a')](function(_0x1386db){if(_0x1386db&&_0x1386db['closed']){return _0x23c85a['status'](_0x1386db['disposition']===_0x1e51('0x3b')?0x195:0x193)[_0x1e51('0x3c')]({'message':_0x1386db[_0x1e51('0x39')]==='unmanaged'?_0x1e51('0x3d'):'Forbidden.'});}else{_0xf9298();}})['catch'](function(_0x3349f0){_0xf9298(_0x3349f0);});}});};exports['isAuthenticated']=function isAuthenticated(_0x170ec6){return compose()[_0x1e51('0x35')](function(_0x56722f,_0x3e6ef2,_0x10ee23){var _0x71c7af;if(_0x56722f[_0x1e51('0x3e')]['authorization']){if(_['startsWith'](_0x56722f['headers'][_0x1e51('0x3f')],_0x1e51('0x40'))){var _0x1ba84a=basicAuth(_0x56722f);db[_0x1e51('0x41')][_0x1e51('0x42')]({'where':{'name':_0x1ba84a[_0x1e51('0xc')]}})[_0x1e51('0x3a')](function(_0x34701c){if(!_0x34701c||!_0x34701c[_0x1e51('0x43')](_0x1ba84a[_0x1e51('0x44')])){return _0x3e6ef2[_0x1e51('0x45')](0x191)['json']({'message':_0x1e51('0x46')});}_0x56722f[_0x1e51('0x36')]={'id':_0x34701c['id']};_0x10ee23();})[_0x1e51('0x47')](function(_0x12da89){_0x10ee23(_0x12da89);});}else if(_[_0x1e51('0x48')](_0x56722f['headers'][_0x1e51('0x3f')],'Bearer')){validateJwt(_0x56722f,_0x3e6ef2,_0x10ee23);}else{if(_0x170ec6){_0x10ee23();}else{return _0x3e6ef2[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x49')});}}}else if(_0x56722f['query'][_0x1e51('0x4a')]){try{var _0x58f8b1={'audience':hardwareConf[_0x1e51('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x56722f['query'][_0x1e51('0x4a')],_0x58f8b1)[_0x1e51('0x3a')](function(_0x45313e){return db['User'][_0x1e51('0x42')]({'where':{'id':_0x45313e['sub']}})[_0x1e51('0x3a')](function(_0x2df269){_0x71c7af=_0x2df269;return db['Setting'][_0x1e51('0x4c')]({'where':{'id':0x1},'attributes':[_0x1e51('0x4d'),_0x1e51('0x4e')],'raw':!![]});})[_0x1e51('0x3a')](function(_0x146c44){if(!_0x71c7af||!_[_0x1e51('0x4f')](_0x71c7af['apiKeyNonce'],_0x45313e['nonce'])){return _0x3e6ef2[_0x1e51('0x45')](0x191)['json']({'message':_0x1e51('0x50')});}if(_0x71c7af[_0x1e51('0x51')]){return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});}if(_0x71c7af[_0x1e51('0x53')]){if(_0x146c44[_0x1e51('0x4e')]>0x0){if(moment(_0x71c7af[_0x1e51('0x54')])[_0x1e51('0x55')](_0x146c44[_0x1e51('0x4e')],_0x1e51('0x56'))>moment()){return _0x3e6ef2['status'](0x191)[_0x1e51('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});}}_0x56722f[_0x1e51('0x36')]={'id':_0x71c7af['id']};_0x10ee23();});})[_0x1e51('0x47')](function(){return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});});}catch(_0x121048){_0x10ee23(_0x121048);}}else if(_0x170ec6){_0x10ee23();}else{return _0x3e6ef2[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x13da51,_0x8bb476,_0x3be495){if(_0x13da51[_0x1e51('0x36')]){db[_0x1e51('0x41')][_0x1e51('0x42')]({'where':{'id':_0x13da51[_0x1e51('0x36')]['id']},'attributes':userAttributes})[_0x1e51('0x3a')](function(_0x5a6340){if(!_0x5a6340){return _0x8bb476[_0x1e51('0x45')](0x194)[_0x1e51('0x3c')]({'message':_0x1e51('0x57')});}_0x13da51[_0x1e51('0x36')]=_0x5a6340;_0x3be495();})[_0x1e51('0x47')](function(_0x2131fb){_0x3be495(_0x2131fb);});}else if(_0x170ec6){_0x3be495();}else{return _0x8bb476[_0x1e51('0x45')](0x194)['json']({'message':_0x1e51('0x58')});}});};exports[_0x1e51('0x59')]=function canUpdate(){return compose()['use'](function(_0xfd6521,_0x38e4a7,_0x2b7a25){return licenseUtil['getLicense']()[_0x1e51('0x3a')](function(_0x2ab15a){if(_0x2ab15a[_0x1e51('0x5a')]){_0x2b7a25();}else{return _0x38e4a7[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x5b')});}})[_0x1e51('0x47')](function(_0x10f423){_0x2b7a25(_0x10f423);});});};exports[_0x1e51('0x5c')]=function isWebrtcLicence(){return compose()['use'](function(_0x132625,_0x22a898,_0x4b5fa7){return licenseUtil[_0x1e51('0x5d')]()[_0x1e51('0x3a')](function(_0x139e9f){if(_0x139e9f['webrtc']){_0x4b5fa7();}else{return _0x22a898[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x5b')});}})['catch'](function(_0x2e9ee2){_0x4b5fa7(_0x2e9ee2);});});};exports['isMiddleware']=function(_0x581f7a,_0x54688b,_0x169e6c){_0x581f7a[_0x1e51('0x5e')]=!![];return _0x169e6c();};exports['signToken']=function signToken(_0x5c81f5){return signJwt(_0x5c81f5);};exports[_0x1e51('0x5f')]=function(_0x7ffc42,_0x2a43dd){if(!_0x7ffc42[_0x1e51('0x36')]){return _0x2a43dd[_0x1e51('0x45')](0x194)[_0x1e51('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x43a92b={'payload':{'id':_0x7ffc42['user']['id'],'role':_0x7ffc42[_0x1e51('0x36')][_0x1e51('0x60')]},'options':{'expiresIn':0x15180}};return signJwt(_0x43a92b)['then'](function(_0x5ea040){_0x2a43dd['cookie'](_0x1e51('0x61'),_0x5ea040);_0x2a43dd[_0x1e51('0x62')](_0x1e51('0x63'));})['catch'](function(_0x2fdee1){return _0x2a43dd[_0x1e51('0x45')](0x1f4)[_0x1e51('0x64')](_0x2fdee1);});};exports[_0x1e51('0x65')]=function(_0x1ccb55){if(_[_0x1e51('0x66')](_0x1ccb55[_0x1e51('0x67')])||_[_0x1e51('0x66')](_0x1ccb55['apiKeyIat'])){return null;}else{return createJwt(_0x1ccb55);}};exports[_0x1e51('0x68')]=function(_0x7c5f61){_0x7c5f61[_0x1e51('0x67')]=generateNonce();_0x7c5f61[_0x1e51('0x69')]=generateIssuedAt();return createJwt(_0x7c5f61);};exports[_0x1e51('0x6a')]=function(_0x2a88db,_0x5ba6c2){var _0x23ccb5=_0x2a88db['query']['apikey'];if(_0x23ccb5){var _0x4807b9={'nonce':_0x5ba6c2[_0x1e51('0x67')],'iat':_0x5ba6c2[_0x1e51('0x69')],'audience':hardwareConf[_0x1e51('0x4b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x23ccb5,_0x4807b9)[_0x1e51('0x3a')](function(){return generateApiKey(_0x5ba6c2);});}else{throw{'message':_0x1e51('0x6b')};}};exports[_0x1e51('0x6c')]=function(_0x4f4946){var _0x41385c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x41385c[_0x1e51('0x6d')](_0x4f4946))throw new db[(_0x1e51('0x6e'))]['ValidationError'](_0x1e51('0x6f'));return;};exports[_0x1e51('0x70')]=function(_0x175aa0,_0x30ee67,_0x666ae9){var _0x218273=encryptor[_0x1e51('0x71')](_0x30ee67)[_0x1e51('0x72')](',');for(var _0x517f51=0x0;_0x517f51<_0x666ae9;_0x517f51++){if(!_0x218273[_0x517f51])break;if(_0x175aa0[_0x1e51('0x73')]()===_0x218273[_0x517f51][_0x1e51('0x73')]()){var _0x48848f=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x666ae9);if(_0x666ae9===0x1){_0x48848f=_0x1e51('0x74');}throw new db[(_0x1e51('0x6e'))][(_0x1e51('0x75'))](_0x48848f);}}return;};exports[_0x1e51('0x76')]=function(_0x18e9d1,_0x3c322c){var _0x45b649=_0x3c322c?encryptor[_0x1e51('0x71')](_0x3c322c)[_0x1e51('0x72')](','):[];if(_0x45b649['length']===0x5){_0x45b649['splice'](-0x1,0x1);}_0x45b649['unshift'](_0x18e9d1);return encryptor[_0x1e51('0x77')](_0x45b649[_0x1e51('0x78')](','));};function signJwt(_0x50c202){var _0x4e1fa8=BPromise[_0x1e51('0x79')](jwt[_0x1e51('0x7a')],{'context':jwt});var _0x50b5c0=_0x50c202[_0x1e51('0x7b')]||config[_0x1e51('0xa')][_0x1e51('0x7c')];return new BPromise(function(_0x3e4073,_0x1cf3a3){_0x4e1fa8(_0x50c202[_0x1e51('0x7d')],_0x50b5c0,_0x50c202[_0x1e51('0x7e')])[_0x1e51('0x3a')](function(_0x207d4d){_0x3e4073(_0x207d4d);})[_0x1e51('0x47')](function(_0x486ebd){_0x1cf3a3(_0x486ebd);});});}function verifyJwt(_0x178baf,_0x2f5bf1,_0x3657a2){var _0x402bbd=BPromise[_0x1e51('0x79')](jwt[_0x1e51('0x7f')],{'context':jwt});var _0x47cc50=_0x3657a2||config['secrets'][_0x1e51('0x7c')];return new BPromise(function(_0x1b0459,_0x19ec72){_0x402bbd(_0x178baf,_0x47cc50,_0x2f5bf1)[_0x1e51('0x3a')](function(_0x52a439){_0x1b0459(_0x52a439);})['catch'](function(_0x5db283){_0x19ec72(_0x5db283);});});}function generateNonce(){return crypto[_0x1e51('0x80')](0x10)[_0x1e51('0x81')](_0x1e51('0x82'));}function generateIssuedAt(){return Math[_0x1e51('0x83')](Date[_0x1e51('0x84')]()/0x3e8)['toString']();}function createJwt(_0x16350b){var _0x3f9cea={'payload':{'iat':_0x16350b[_0x1e51('0x69')],'nonce':_0x16350b['apiKeyNonce']},'options':{'algorithm':_0x1e51('0x85'),'subject':_0x16350b['id'][_0x1e51('0x81')](),'issuer':hardwareConf[_0x1e51('0x4b')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3f9cea)[_0x1e51('0x3a')](function(_0x37b7c6){return{'iat':_0x16350b['apiKeyIat'],'nonce':_0x16350b['apiKeyNonce'],'token':_0x37b7c6};});} \ No newline at end of file +var _0xed3c=['join','promisify','sign','secret','secrets','session','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','crypto','bluebird','util','moment','fullname','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','disposition','then','closed','unmanaged','json','catch','isAuthenticated','headers','authorization','startsWith','User','find','name','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','blockDuration','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','minutes','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString'];(function(_0x44257e,_0x428c8f){var _0x185d78=function(_0x12e293){while(--_0x12e293){_0x44257e['push'](_0x44257e['shift']());}};_0x185d78(++_0x428c8f);}(_0xed3c,0x1a6));var _0xced3=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0xed3c[_0x49f30e];return _0x2cafd5;};'use strict';var db=require(_0xced3('0x0'))['db'];var config=require(_0xced3('0x1'));var hardwareConf=require(_0xced3('0x2'));var licenseUtil=require(_0xced3('0x3'));var encryptor=require('../encryptor');var _=require(_0xced3('0x4'));var jwt=require(_0xced3('0x5'));var expressJwt=require(_0xced3('0x6'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xced3('0x7'));var BPromise=require(_0xced3('0x8'));var util=require(_0xced3('0x9'));var moment=require(_0xced3('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id','role',_0xced3('0xb'),'name','internal','email',_0xced3('0xc'),_0xced3('0xd'),_0xced3('0xe'),_0xced3('0xf'),_0xced3('0x10'),'mailPause',_0xced3('0x11'),_0xced3('0x12'),_0xced3('0x13'),'pauseType',_0xced3('0x14'),_0xced3('0x15'),_0xced3('0x16'),_0xced3('0x17'),_0xced3('0x18'),_0xced3('0x19'),_0xced3('0x1a'),'phoneBarAutoAnswer',_0xced3('0x1b'),'phoneBarDnd',_0xced3('0x1c'),_0xced3('0x1d'),_0xced3('0x1e'),_0xced3('0x1f'),'phoneBarPrefixRequired',_0xced3('0x20'),_0xced3('0x21'),'hotdesk',_0xced3('0x22'),_0xced3('0x23'),_0xced3('0x24'),_0xced3('0x25'),'wssPort',_0xced3('0x26'),'downloadOmnichannelInteractions',_0xced3('0x27'),_0xced3('0x28'),_0xced3('0x29'),_0xced3('0x2a'),_0xced3('0x2b'),_0xced3('0x2c'),_0xced3('0x2d'),_0xced3('0x2e'),_0xced3('0x2f'),_0xced3('0x30'),_0xced3('0x31'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xced3('0x32'),_0xced3('0x33')];exports[_0xced3('0x34')]=function(){return this['isAuthenticated'](!![])[_0xced3('0x35')](function(_0x30d984,_0x526854,_0x559fa2){if(_0x30d984[_0xced3('0x36')]){_0x559fa2();}else{return db[_0xced3('0x37')][_0xced3('0x38')]({'where':{'id':_0x30d984[_0xced3('0x39')]['id']},'attributes':['id','closed',_0xced3('0x3a')],'raw':!![]})[_0xced3('0x3b')](function(_0x4fc285){if(_0x4fc285&&_0x4fc285[_0xced3('0x3c')]){return _0x526854['status'](_0x4fc285[_0xced3('0x3a')]===_0xced3('0x3d')?0x195:0x193)[_0xced3('0x3e')]({'message':_0x4fc285[_0xced3('0x3a')]===_0xced3('0x3d')?'Unmanaged.':'Forbidden.'});}else{_0x559fa2();}})[_0xced3('0x3f')](function(_0x5bb425){_0x559fa2(_0x5bb425);});}});};exports[_0xced3('0x40')]=function isAuthenticated(_0x1e6923){return compose()['use'](function(_0x3db664,_0x4024fa,_0x196956){var _0x1032d6;if(_0x3db664[_0xced3('0x41')][_0xced3('0x42')]){if(_[_0xced3('0x43')](_0x3db664[_0xced3('0x41')][_0xced3('0x42')],'Basic')){var _0xa78899=basicAuth(_0x3db664);db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'name':_0xa78899[_0xced3('0x46')]}})[_0xced3('0x3b')](function(_0x21e4a2){if(!_0x21e4a2||!_0x21e4a2[_0xced3('0x47')](_0xa78899[_0xced3('0x48')])){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x4a')});}_0x3db664[_0xced3('0x36')]={'id':_0x21e4a2['id']};_0x196956();})[_0xced3('0x3f')](function(_0x407a24){_0x196956(_0x407a24);});}else if(_[_0xced3('0x43')](_0x3db664[_0xced3('0x41')][_0xced3('0x42')],_0xced3('0x4b'))){validateJwt(_0x3db664,_0x4024fa,_0x196956);}else{if(_0x1e6923){_0x196956();}else{return _0x4024fa[_0xced3('0x49')](0x193)[_0xced3('0x3e')]({'message':_0xced3('0x4c')});}}}else if(_0x3db664['query'][_0xced3('0x4d')]){try{var _0x55e3ac={'audience':hardwareConf[_0xced3('0x4e')](),'issuer':hardwareConf[_0xced3('0x4e')]()};verifyJwt(_0x3db664[_0xced3('0x4f')][_0xced3('0x4d')],_0x55e3ac)[_0xced3('0x3b')](function(_0xefac3d){return db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'id':_0xefac3d[_0xced3('0x50')]}})[_0xced3('0x3b')](function(_0x5c290d){_0x1032d6=_0x5c290d;return db[_0xced3('0x51')][_0xced3('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xced3('0x52')],'raw':!![]});})[_0xced3('0x3b')](function(_0x1b5956){if(!_0x1032d6||!_['isEqual'](_0x1032d6['apiKeyNonce'],_0xefac3d[_0xced3('0x53')])){return _0x4024fa['status'](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x54')});}if(_0x1032d6['disabled']){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});}if(_0x1032d6['blocked']){if(_0x1b5956[_0xced3('0x52')]>0x0){if(moment(_0x1032d6['blockedAt'])['add'](_0x1b5956[_0xced3('0x52')],_0xced3('0x56'))>moment()){return _0x4024fa[_0xced3('0x49')](0x191)['json']({'message':_0xced3('0x55')});}}else{return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});}}_0x3db664[_0xced3('0x36')]={'id':_0x1032d6['id']};_0x196956();});})[_0xced3('0x3f')](function(){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});});}catch(_0x3eca11){_0x196956(_0x3eca11);}}else if(_0x1e6923){_0x196956();}else{return _0x4024fa[_0xced3('0x49')](0x193)[_0xced3('0x3e')]({'message':_0xced3('0x4c')});}})[_0xced3('0x35')](function(_0x1ced3a,_0x489546,_0x4279a3){if(_0x1ced3a[_0xced3('0x36')]){db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'id':_0x1ced3a[_0xced3('0x36')]['id']},'attributes':userAttributes})[_0xced3('0x3b')](function(_0x145157){if(!_0x145157){return _0x489546[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'User\x20not\x20found.'});}_0x1ced3a[_0xced3('0x36')]=_0x145157;_0x4279a3();})['catch'](function(_0x5f4599){_0x4279a3(_0x5f4599);});}else if(_0x1e6923){_0x4279a3();}else{return _0x489546[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xced3('0x57')]=function canUpdate(){return compose()[_0xced3('0x35')](function(_0x3569f3,_0x26b8ac,_0x5373ab){return licenseUtil[_0xced3('0x58')]()[_0xced3('0x3b')](function(_0xbf8cbc){if(_0xbf8cbc[_0xced3('0x59')]){_0x5373ab();}else{return _0x26b8ac[_0xced3('0x49')](0x193)['json']({'message':_0xced3('0x5a')});}})[_0xced3('0x3f')](function(_0x1dced4){_0x5373ab(_0x1dced4);});});};exports[_0xced3('0x5b')]=function isWebrtcLicence(){return compose()[_0xced3('0x35')](function(_0x740743,_0x3fa9fd,_0x532db9){return licenseUtil[_0xced3('0x58')]()[_0xced3('0x3b')](function(_0x4804e3){if(_0x4804e3['webrtc']){_0x532db9();}else{return _0x3fa9fd[_0xced3('0x49')](0x193)['json']({'message':_0xced3('0x5a')});}})[_0xced3('0x3f')](function(_0x33441c){_0x532db9(_0x33441c);});});};exports[_0xced3('0x5c')]=function(_0x2c70e3,_0x1b3396,_0x3700ed){_0x2c70e3[_0xced3('0x5c')]=!![];return _0x3700ed();};exports[_0xced3('0x5d')]=function signToken(_0x5b3529){return signJwt(_0x5b3529);};exports[_0xced3('0x5e')]=function(_0x8df206,_0x2aa876){if(!_0x8df206[_0xced3('0x36')]){return _0x2aa876[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x420b90={'payload':{'id':_0x8df206[_0xced3('0x36')]['id'],'role':_0x8df206[_0xced3('0x36')][_0xced3('0x5f')]},'options':{'expiresIn':0x15180}};return signJwt(_0x420b90)[_0xced3('0x3b')](function(_0x14dbfe){_0x2aa876[_0xced3('0x60')](_0xced3('0x61'),_0x14dbfe);_0x2aa876[_0xced3('0x62')](_0xced3('0x63'));})[_0xced3('0x3f')](function(_0x3e2a19){return _0x2aa876['status'](0x1f4)[_0xced3('0x64')](_0x3e2a19);});};exports['retrieveApiKey']=function(_0x466ffb){if(_[_0xced3('0x65')](_0x466ffb[_0xced3('0x66')])||_['isNil'](_0x466ffb['apiKeyIat'])){return null;}else{return createJwt(_0x466ffb);}};exports[_0xced3('0x67')]=function(_0x219a11){_0x219a11['apiKeyNonce']=generateNonce();_0x219a11[_0xced3('0x68')]=generateIssuedAt();return createJwt(_0x219a11);};exports['regenerateApiKey']=function(_0x3dba69,_0x3f9582){var _0x4f1860=_0x3dba69[_0xced3('0x4f')][_0xced3('0x4d')];if(_0x4f1860){var _0xf4d7bf={'nonce':_0x3f9582['apiKeyNonce'],'iat':_0x3f9582[_0xced3('0x68')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xced3('0x4e')]()};return verifyJwt(_0x4f1860,_0xf4d7bf)[_0xced3('0x3b')](function(){return generateApiKey(_0x3f9582);});}else{throw{'message':_0xced3('0x69')};}};exports[_0xced3('0x6a')]=function(_0x1c17a8){var _0xd3c7b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xd3c7b9[_0xced3('0x6b')](_0x1c17a8))throw new db[(_0xced3('0x6c'))][(_0xced3('0x6d'))](_0xced3('0x6e'));return;};exports[_0xced3('0x6f')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){var _0x40a2a2=encryptor[_0xced3('0x70')](_0x3859e8)[_0xced3('0x71')](',');for(var _0xbad036=0x0;_0xbad036<_0x3de35d;_0xbad036++){if(!_0x40a2a2[_0xbad036])break;if(_0x4b14dd['toLowerCase']()===_0x40a2a2[_0xbad036][_0xced3('0x72')]()){var _0x171081=util[_0xced3('0x73')](_0xced3('0x74'),_0x3de35d);if(_0x3de35d===0x1){_0x171081=_0xced3('0x75');}throw new db[(_0xced3('0x6c'))]['ValidationError'](_0x171081);}}return;};exports[_0xced3('0x76')]=function(_0x53844d,_0xc0cd87){var _0x5d9813=_0xc0cd87?encryptor[_0xced3('0x70')](_0xc0cd87)[_0xced3('0x71')](','):[];if(_0x5d9813['length']===0x5){_0x5d9813[_0xced3('0x77')](-0x1,0x1);}_0x5d9813[_0xced3('0x78')](_0x53844d);return encryptor[_0xced3('0x79')](_0x5d9813[_0xced3('0x7a')](','));};function signJwt(_0x1ec94b){var _0x21eeec=BPromise[_0xced3('0x7b')](jwt[_0xced3('0x7c')],{'context':jwt});var _0x18fe01=_0x1ec94b[_0xced3('0x7d')]||config[_0xced3('0x7e')][_0xced3('0x7f')];return new BPromise(function(_0x38033f,_0x4dea99){_0x21eeec(_0x1ec94b[_0xced3('0x80')],_0x18fe01,_0x1ec94b[_0xced3('0x81')])[_0xced3('0x3b')](function(_0x353a8e){_0x38033f(_0x353a8e);})['catch'](function(_0x463ca4){_0x4dea99(_0x463ca4);});});}function verifyJwt(_0x979b24,_0x404241,_0x373f31){var _0x2a62f5=BPromise[_0xced3('0x7b')](jwt[_0xced3('0x82')],{'context':jwt});var _0x4df923=_0x373f31||config[_0xced3('0x7e')][_0xced3('0x7f')];return new BPromise(function(_0x5db4eb,_0x1630d7){_0x2a62f5(_0x979b24,_0x4df923,_0x404241)[_0xced3('0x3b')](function(_0x3a9dac){_0x5db4eb(_0x3a9dac);})[_0xced3('0x3f')](function(_0x58d7fc){_0x1630d7(_0x58d7fc);});});}function generateNonce(){return crypto[_0xced3('0x83')](0x10)[_0xced3('0x84')](_0xced3('0x85'));}function generateIssuedAt(){return Math[_0xced3('0x86')](Date[_0xced3('0x87')]()/0x3e8)[_0xced3('0x84')]();}function createJwt(_0x236445){var _0x3ad0e7={'payload':{'iat':_0x236445[_0xced3('0x68')],'nonce':_0x236445[_0xced3('0x66')]},'options':{'algorithm':'HS512','subject':_0x236445['id'][_0xced3('0x84')](),'issuer':hardwareConf[_0xced3('0x4e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3ad0e7)['then'](function(_0xbec2b7){return{'iat':_0x236445['apiKeyIat'],'nonce':_0x236445[_0xced3('0x66')],'token':_0xbec2b7};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 77e4bfe..44c578b 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 _0xa32c=['countFilteredContacts','count','User','getFilteredContacts','rows','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','../../mysqldb','getContactsSubquery','parseAdvancedSearchFilter','search','parseQueryParameters','then','where','default','fields','clause','tags','user','checkListsRestrictions','ids'];(function(_0x17f7b5,_0x5ca2c4){var _0x1681a0=function(_0x43944c){while(--_0x43944c){_0x17f7b5['push'](_0x17f7b5['shift']());}};_0x1681a0(++_0x5ca2c4);}(_0xa32c,0x100));var _0xca32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa32c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xca32('0x0'));var sqlUtils=require(_0xca32('0x1'));var db=require(_0xca32('0x2'))['db'];exports['findAll']=function(_0x4e23be,_0x29b5af,_0x20f163,_0x3fefc){var _0x3c8963={'count':0x0,'rows':[]};var _0x1afa71=sqlUtils['skipContactsQuery'](_0x29b5af,_0x4e23be);if(_0x1afa71){return Promise['resolve'](_0x3c8963);}var _0x36e7e9=sqlUtils[_0xca32('0x3')]();var _0x54fc66={};var _0x43b00f=![];var _0x3d9fe7=![];return Promise['resolve']()['then'](function(){if(_0x4e23be['search']){return sqlUtils[_0xca32('0x4')](_0x4e23be[_0xca32('0x5')],_0x3fefc);}else{return sqlUtils[_0xca32('0x6')](_0x4e23be,_0x3fefc);}})[_0xca32('0x7')](function(_0x2f867e){_0x36e7e9[_0xca32('0x8')](_0x2f867e[_0xca32('0x9')]);_0x36e7e9['where'](_0x2f867e[_0xca32('0xa')]);_0x36e7e9[_0xca32('0x8')](_0x2f867e['filter']);_0x36e7e9[_0xca32('0x8')](_0x2f867e['user'][_0xca32('0xb')]);_0x54fc66=_0x2f867e[_0xca32('0xc')];_0x3d9fe7=_0x2f867e[_0xca32('0xd')]['skip'];return sqlUtils[_0xca32('0xe')](_0x29b5af,_0x4e23be,_0x3d9fe7);})[_0xca32('0x7')](function(_0x49ff35){_0x36e7e9[_0xca32('0x8')](_0x49ff35);var _0x277436=_0x4e23be[_0xca32('0x5')]?_0x54fc66[_0xca32('0xf')]:_0x4e23be['tag'];_0x43b00f=_0x277436?!![]:![];return sqlUtils[_0xca32('0x10')](_0x36e7e9,_0x277436);})[_0xca32('0x7')](function(_0x3c3059){_0x3c8963[_0xca32('0x11')]=_0x3c3059;if(_0x3c8963[_0xca32('0x11')]===0x0){return;}if(_0x4e23be[_0xca32('0x12')]){_0x3d9fe7=!![];}return sqlUtils['buildContactsQuery'](_0x36e7e9,_0x4e23be[_0xca32('0xa')],_0x20f163,_0x43b00f,_0x54fc66['clause'],_0x3d9fe7);})[_0xca32('0x7')](function(_0x49a384){if(!_0x49a384){return[];}return sqlUtils[_0xca32('0x13')](_0x49a384,_0x4e23be,_0x20f163);})[_0xca32('0x7')](function(_0x494a10){_0x3c8963[_0xca32('0x14')]=_0x494a10;return _0x3c8963;})[_0xca32('0x15')](function(_0x74ecb8){throw _0x74ecb8;});};exports[_0xca32('0x16')]=function(){var _0x536519={};var _0x231620=[];return db['CmContact'][_0xca32('0x16')]()[_0xca32('0x7')](function(_0x5bffd3){_0x536519=_0x5bffd3;var _0xe31d27=Object[_0xca32('0x17')](_0x536519)[_0xca32('0x18')](function(_0x35dfc3){return _[_0xca32('0x19')](_0x35dfc3,_0xca32('0x1a'))?_0x35dfc3:undefined;});var _0x332ffd=_0xe31d27[_0xca32('0x1b')](function(_0x5e8ff9){return db[_0xca32('0x1c')][_0xca32('0x1d')]({'where':{'id':_0x5e8ff9[_0xca32('0x1e')](0x3)},'raw':!![]});});return Promise[_0xca32('0x1f')](_0x332ffd);})[_0xca32('0x7')](function(_0x2088da){for(var _0x20f17f=0x0;_0x20f17f<_0x2088da['length'];_0x20f17f++){if(_0x2088da[_0x20f17f]){var _0x312eb6='cf_'+_0x2088da[_0x20f17f]['id'];_0x536519[_0x312eb6][_0xca32('0x20')]=_0x2088da[_0x20f17f][_0xca32('0x21')];}}_0x231620=_[_0xca32('0x1b')](Object[_0xca32('0x17')](_0x536519),function(_0x28490d){return{'name':_0x28490d,'type':_0x536519[_0x28490d][_0xca32('0x21')]};});return _0x231620;})[_0xca32('0x15')](function(_0x4b756b){throw _0x4b756b;});}; \ No newline at end of file +var _0x41a4=['then','search','parseAdvancedSearchFilter','where','default','fields','user','clause','tags','checkListsRestrictions','tag','count','User','buildContactsQuery','describe','CmContact','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','keys','catch','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery'];(function(_0x67ef3d,_0x50f0bd){var _0x2ef03e=function(_0x44e463){while(--_0x44e463){_0x67ef3d['push'](_0x67ef3d['shift']());}};_0x2ef03e(++_0x50f0bd);}(_0x41a4,0x10a));var _0x441a=function(_0x2b1e15,_0x12d058){_0x2b1e15=_0x2b1e15-0x0;var _0x31c2e2=_0x41a4[_0x2b1e15];return _0x31c2e2;};'use strict';var _=require(_0x441a('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x441a('0x1'))['db'];exports[_0x441a('0x2')]=function(_0x37b1fb,_0x24b084,_0x128f02,_0x290d78){var _0xd8fe82={'count':0x0,'rows':[]};var _0x13c215=sqlUtils[_0x441a('0x3')](_0x24b084,_0x37b1fb);if(_0x13c215){return Promise[_0x441a('0x4')](_0xd8fe82);}var _0x40bfc3=sqlUtils[_0x441a('0x5')]();var _0x131439={};var _0x421e28=![];var _0x18c191=![];return Promise[_0x441a('0x4')]()[_0x441a('0x6')](function(){if(_0x37b1fb[_0x441a('0x7')]){return sqlUtils[_0x441a('0x8')](_0x37b1fb[_0x441a('0x7')],_0x290d78);}else{return sqlUtils['parseQueryParameters'](_0x37b1fb,_0x290d78);}})[_0x441a('0x6')](function(_0x53e4dc){_0x40bfc3[_0x441a('0x9')](_0x53e4dc[_0x441a('0xa')]);_0x40bfc3[_0x441a('0x9')](_0x53e4dc[_0x441a('0xb')]);_0x40bfc3[_0x441a('0x9')](_0x53e4dc['filter']);_0x40bfc3[_0x441a('0x9')](_0x53e4dc[_0x441a('0xc')][_0x441a('0xd')]);_0x131439=_0x53e4dc[_0x441a('0xe')];_0x18c191=_0x53e4dc[_0x441a('0xc')]['skip'];return sqlUtils[_0x441a('0xf')](_0x24b084,_0x37b1fb,_0x18c191);})[_0x441a('0x6')](function(_0x310723){_0x40bfc3[_0x441a('0x9')](_0x310723);var _0x9a6e2e=_0x37b1fb[_0x441a('0x7')]?_0x131439['ids']:_0x37b1fb[_0x441a('0x10')];_0x421e28=_0x9a6e2e?!![]:![];return sqlUtils['countFilteredContacts'](_0x40bfc3,_0x9a6e2e);})[_0x441a('0x6')](function(_0x1737ae){_0xd8fe82['count']=_0x1737ae;if(_0xd8fe82[_0x441a('0x11')]===0x0){return;}if(_0x37b1fb[_0x441a('0x12')]){_0x18c191=!![];}return sqlUtils[_0x441a('0x13')](_0x40bfc3,_0x37b1fb[_0x441a('0xb')],_0x128f02,_0x421e28,_0x131439['clause'],_0x18c191);})[_0x441a('0x6')](function(_0x1e2370){if(!_0x1e2370){return[];}return sqlUtils['getFilteredContacts'](_0x1e2370,_0x37b1fb,_0x128f02);})[_0x441a('0x6')](function(_0x40591b){_0xd8fe82['rows']=_0x40591b;return _0xd8fe82;})['catch'](function(_0x129aed){throw _0x129aed;});};exports[_0x441a('0x14')]=function(){var _0x5457c9={};var _0xd4ca1=[];return db[_0x441a('0x15')]['describe']()[_0x441a('0x6')](function(_0x1515c3){_0x5457c9=_0x1515c3;var _0x4bec1c=Object['keys'](_0x5457c9)[_0x441a('0x16')](function(_0x15f027){return _[_0x441a('0x17')](_0x15f027,_0x441a('0x18'))?_0x15f027:undefined;});var _0x103e82=_0x4bec1c[_0x441a('0x19')](function(_0x15c7a4){return db[_0x441a('0x1a')][_0x441a('0x1b')]({'where':{'id':_0x15c7a4[_0x441a('0x1c')](0x3)},'raw':!![]});});return Promise['all'](_0x103e82);})[_0x441a('0x6')](function(_0x57a6c9){for(var _0x4b2b7b=0x0;_0x4b2b7b<_0x57a6c9[_0x441a('0x1d')];_0x4b2b7b++){if(_0x57a6c9[_0x4b2b7b]){var _0x1d5dbe=_0x441a('0x18')+_0x57a6c9[_0x4b2b7b]['id'];_0x5457c9[_0x1d5dbe][_0x441a('0x1e')]=_0x57a6c9[_0x4b2b7b][_0x441a('0x1f')];}}_0xd4ca1=_[_0x441a('0x19')](Object[_0x441a('0x20')](_0x5457c9),function(_0xb788d9){return{'name':_0xb788d9,'type':_0x5457c9[_0xb788d9][_0x441a('0x1f')]};});return _0xd4ca1;})[_0x441a('0x21')](function(_0x2708c1){throw _0x2708c1;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 425bef1..bbef5f0 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 _0xd247=['query','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','ListId','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','limit','offset','subqry.id','order','DESC','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','group','c.id','getSelectedTags','t.id\x20IN\x20?'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd247,0x143));var _0x7d24=function(_0xe33285,_0x7f474){_0xe33285=_0xe33285-0x0;var _0x31ca6b=_0xd247[_0xe33285];return _0x31ca6b;};'use strict';var _=require(_0x7d24('0x0'));var squel=require('squel');var as=require(_0x7d24('0x1'));var qs=require(_0x7d24('0x2'));var utils=require(_0x7d24('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1efcbd,_0xeff97b){var _0x58e603=![];if(_0x1efcbd[_0x7d24('0x4')]===_0x7d24('0x5')&&!_0xeff97b[_0x7d24('0x6')]&&!_0xeff97b['ListId']&&_0xeff97b[_0x7d24('0x7')]!==_0x7d24('0x8')){_0x58e603=!![];}return _0x58e603;}function getContactsSubquery(){return squel[_0x7d24('0x9')]()[_0x7d24('0xa')](_0x7d24('0xb'),'c')[_0x7d24('0xc')](_0x7d24('0xd'));}function applyJoinClauses(_0x22080b,_0x1f65b7){var _0x441024=_0x1f65b7?'c':_0x7d24('0xe');_0x22080b['left_join']('cm_user_has_contacts','uc',_0x7d24('0xf')+_0x441024+_0x7d24('0x10'))[_0x7d24('0x11')](_0x7d24('0x12'),'ct',_0x7d24('0x13')+_0x441024+'.id')[_0x7d24('0x11')](_0x7d24('0x14'),'t',_0x7d24('0x15'));return _0x22080b;}function addFieldsToQuery(_0x2bc213,_0x47c13d,_0x579f36,_0x5473ed,_0xc18df0){var _0x489490=_0xc18df0?'c':_0x7d24('0xe');if(!_0x47c13d){_0x47c13d=['id','firstName','lastName',_0x7d24('0x16'),_0x7d24('0x17'),_0x7d24('0x18'),'email',_0x7d24('0x19'),_0x7d24('0x1a'),_0x7d24('0x1b'),_0x7d24('0x1c'),_0x7d24('0x1d'),_0x7d24('0x1e')];}else if(!_0x47c13d[_0x7d24('0x1f')]('id')){_0x47c13d[_0x7d24('0x20')]('id');}var _0x2c1b24=_0x579f36&&_0xc18df0||!_0x579f36&&!_0xc18df0;if(_0x5473ed){_0x2c1b24=_0x5473ed&&_0xc18df0||!_0x5473ed&&!_0xc18df0;}_0x47c13d[_0x7d24('0x21')](function(_0x839159){if(_0x839159==='TagIds'){if(_0x2c1b24){_0x2bc213[_0x7d24('0x22')](_0x7d24('0x23'),_0x839159);}else if(_0x579f36||_0x5473ed){_0x2bc213[_0x7d24('0x22')](_0x489490+'.'+_0x839159);}}else{_0x2bc213[_0x7d24('0x22')](_0x489490+'.'+_0x839159);}});return _0x2bc213;}function getSqlClauses(){var _0x18a22d={'default':squel[_0x7d24('0x24')](),'fields':squel[_0x7d24('0x24')](),'filter':squel[_0x7d24('0x24')](),'tags':{'clause':squel[_0x7d24('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x18a22d;}function parseTagParameter(_0x5b8d22){var _0x183294=squel[_0x7d24('0x24')]();if(_0x5b8d22){var _0x2b33ba=utils['getSelectedTags'](_0x5b8d22);_0x2b33ba[_0x7d24('0x21')](function(_0x58c6d4){_0x183294['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58c6d4+',%');});}return _0x183294;}function parseSearchFilter(_0x2fe29d){var _0x458009=squel[_0x7d24('0x24')]();if(_0x2fe29d){var _0x34846d=_0x2fe29d[_0x7d24('0x25')]('\x5c','\x5c\x5c')[_0x7d24('0x25')](/'/g,'\x27\x27');if(_0x34846d[_0x7d24('0x26')]('\x20')[_0x7d24('0x27')]>0x1){_0x458009['or'](_0x7d24('0x28'),qs[_0x7d24('0x29')](_0x34846d,!![]),null);}else{if(qs[_0x7d24('0x2a')](_0x34846d)){_0x458009['or'](_0x7d24('0x2b'),_0x34846d+'%');_0x458009['or'](_0x7d24('0x2c'),_0x34846d+'%');_0x458009['or']('c.mobile\x20LIKE\x20?',_0x34846d+'%');_0x458009['or'](_0x7d24('0x2d'),_0x34846d+'%');}else if(qs[_0x7d24('0x2e')](_0x34846d)){_0x458009['or']('c.email\x20LIKE\x20?',_0x34846d+'%');}else{_0x458009['or']('c.firstName\x20LIKE\x20?','%'+_0x34846d+'%');_0x458009['or'](_0x7d24('0x2f'),'%'+_0x34846d+'%');_0x458009['or']('c.email\x20LIKE\x20?','%'+_0x34846d+'%');}}}return _0x458009;}function parseAdvancedSearchFilter(_0x326c6a,_0x5954cb){var _0x102995=getSqlClauses();var _0x5edf4b=as['parseSearch'](_0x326c6a);var _0x97f555=_0x5edf4b[_0x7d24('0x30')];for(var _0x3f0b5d=0x0;_0x3f0b5d<_0x5edf4b[_0x7d24('0x31')]['length'];_0x3f0b5d++){var _0x5e5cfd=_0x5edf4b[_0x7d24('0x31')][_0x3f0b5d];var _0xc35e71='c';var _0x3d3380=_[_0x7d24('0x32')](_0x5954cb,['name',_0x5e5cfd[_0x7d24('0x22')]]);if(_0x3d3380){if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x33')||_0x3d3380[_0x7d24('0x34')]==='datetime'){_0x5e5cfd[_0x7d24('0x35')]=_0x7d24('0x36');}var _0x5c5d70=as[_0x7d24('0x37')](_0xc35e71,_0x3d3380[_0x7d24('0x38')],_0x5e5cfd);_0x102995[_0x7d24('0x39')][_0x97f555](_0x5c5d70[_0x7d24('0x3a')],_0x5c5d70[_0x7d24('0x3b')][_0x7d24('0x3c')],_0x5c5d70[_0x7d24('0x3b')][_0x7d24('0x3d')]);}else{if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x3e')){var _0x46c5ad=_0x5e5cfd[_0x7d24('0x3b')][_0x7d24('0x26')](',')[_0x7d24('0x3f')](function(_0x2f0fab){return Number(_0x2f0fab);});var _0x4f3d16=parseTagParameter(_0x46c5ad);_0x102995[_0x7d24('0x40')][_0x7d24('0x41')][_0x7d24('0x42')](_0x4f3d16);_0x102995[_0x7d24('0x40')][_0x7d24('0x43')]=_0x46c5ad;}else if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x44')){_0x102995['user'][_0x7d24('0x41')][_0x7d24('0x42')](_0x7d24('0x45'),_0x5e5cfd[_0x7d24('0x3b')]);_0x102995['user'][_0x7d24('0x46')]=!![];}}}return _0x102995;}function parseModelFields(_0xdc6f56,_0x2f948f){var _0xfd0887=squel[_0x7d24('0x24')]();var _0x54013a=_(_0xdc6f56)[_0x7d24('0x47')]()[_0x7d24('0x3f')](function(_0x133eb7){return _[_0x7d24('0x48')](_0x2f948f,[_0x7d24('0x49'),_0x133eb7])?_0x133eb7:undefined;})[_0x7d24('0x4a')]()['value']();if(_0xdc6f56['Contact']){_0x54013a[_0x7d24('0x20')](_0x7d24('0x4b'));}if(_0xdc6f56[_0x7d24('0x44')]){_0x54013a[_0x7d24('0x20')](_0x7d24('0x44'));}if(_0x54013a[_0x7d24('0x27')]>0x0){_0x54013a[_0x7d24('0x21')](function(_0x23959e){if(_0x23959e==='ListId'){_0xfd0887[_0x7d24('0x42')](_0x7d24('0x4c'),[]['concat'](_0xdc6f56[_0x23959e]));}else if(_0x23959e===_0x7d24('0x4b')){var _0x54bc98='%'+_0xdc6f56[_0x23959e]+'%';_0xfd0887[_0x7d24('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x54bc98);}else if(_0x23959e==='User'){_0xfd0887['and'](_0x7d24('0x45'),_0xdc6f56[_0x23959e]);}else{_0xfd0887[_0x7d24('0x42')]('c.'+_0x23959e+_0x7d24('0x4d'),_0xdc6f56[_0x23959e]);}});}return _0xfd0887;}function parseQueryParameters(_0x2e4c00,_0x4a7004){var _0x702613=getSqlClauses();return Promise[_0x7d24('0x4e')]()[_0x7d24('0x4f')](function(){return parseModelFields(_0x2e4c00,_0x4a7004);})[_0x7d24('0x4f')](function(_0x587569){_0x702613[_0x7d24('0x50')][_0x7d24('0x42')](_0x587569);return parseTagParameter(_0x2e4c00['tag']);})[_0x7d24('0x4f')](function(_0x15cef2){_0x702613[_0x7d24('0x40')][_0x7d24('0x41')]['and'](_0x15cef2);return parseSearchFilter(_0x2e4c00[_0x7d24('0x51')]);})[_0x7d24('0x4f')](function(_0x5ed442){_0x702613['filter']=_0x5ed442;return _0x702613;});}function checkListsRestrictions(_0x230799,_0x531e2a,_0xe6db03){var _0xcda4d1=squel['expr']();return Promise[_0x7d24('0x4e')]()[_0x7d24('0x4f')](function(){if(_0x531e2a[_0x7d24('0x6')]&&_0x230799[_0x7d24('0x4')]===_0x7d24('0x5')&&!_0xe6db03){return _0x230799[_0x7d24('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x7d24('0x4f')](function(_0x5277af){if(_0x5277af){if(_0x5277af['length']===0x0){_0xcda4d1[_0x7d24('0x42')](_0x7d24('0x53'));}else{_0xcda4d1[_0x7d24('0x42')](_0x7d24('0x4c'),_[_0x7d24('0x3f')](_0x5277af,'id'));}}})[_0x7d24('0x4f')](function(){return _0xcda4d1;});}function buildContactsQuery(_0x168600,_0x339a9f,_0x1be398,_0x3fc683,_0x506740,_0x1c2a7f){if(_0x339a9f){_0x339a9f=_0x1be398[_0x7d24('0x54')];}_0x168600=addFieldsToQuery(_0x168600,_0x339a9f,_0x3fc683,_0x1c2a7f,!![]);var _0x42d93e=squel[_0x7d24('0x9')]();_0x42d93e=addFieldsToQuery(_0x42d93e,_0x339a9f,_0x3fc683,_0x1c2a7f,![]);if(_0x3fc683||_0x1c2a7f){_0x168600=applyJoinClauses(_0x168600,!![]);_0x168600['group']('c.id');if(_0x1be398[_0x7d24('0x55')]){_0x42d93e[_0x7d24('0x55')](_0x1be398['limit']);}if(_0x1be398[_0x7d24('0x56')]){_0x42d93e[_0x7d24('0x56')](_0x1be398[_0x7d24('0x56')]);}}else{_0x42d93e=applyJoinClauses(_0x42d93e,![]);_0x42d93e['group'](_0x7d24('0x57'));if(_0x1be398[_0x7d24('0x55')]){_0x168600[_0x7d24('0x55')](_0x1be398['limit']);}if(_0x1be398[_0x7d24('0x56')]){_0x168600[_0x7d24('0x56')](_0x1be398[_0x7d24('0x56')]);}}_0x42d93e['having'](_0x506740);if(_0x1be398['order']){_0x1be398[_0x7d24('0x58')][_0x7d24('0x21')](function(_0x34c0eb){_0x168600[_0x7d24('0x58')]('c.'+_0x34c0eb[0x0],_0x34c0eb[0x1]===_0x7d24('0x59')?![]:!![]);_0x42d93e['order']('subqry.'+_0x34c0eb[0x0],_0x34c0eb[0x1]===_0x7d24('0x59')?![]:!![]);});}_0x42d93e['from'](_0x168600,'subqry');return _0x42d93e;}function getFilteredContacts(_0x6fd701){var _0xe257c2=[];return db['Tag'][_0x7d24('0x5a')]({'attributes':['id',_0x7d24('0x49'),'color'],'raw':!![]})['then'](function(_0x445537){_0xe257c2=_[_0x7d24('0x5b')](_0x445537,'id');var _0x32668e={'type':db[_0x7d24('0x5c')][_0x7d24('0x5d')][_0x7d24('0x5e')],'model':db[_0x7d24('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7d24('0x60')]['query'](_0x6fd701[_0x7d24('0x61')](),_0x32668e);})[_0x7d24('0x4f')](function(_0x1f5a4d){_0x1f5a4d[_0x7d24('0x21')](function(_0xdebc0b){if(_0xdebc0b[_0x7d24('0x1e')]){_0xdebc0b[_0x7d24('0x62')]=[];_0xdebc0b[_0x7d24('0x1e')][_0x7d24('0x26')](',')[_0x7d24('0x21')](function(_0x4bd123){_0xdebc0b[_0x7d24('0x62')][_0x7d24('0x20')](_0xe257c2[_0x4bd123]);});}delete _0xdebc0b[_0x7d24('0x1e')];});return _0x1f5a4d;});}function countFilteredContacts(_0x1ba75d,_0x468b1d){var _0x421282=_0x1ba75d[_0x7d24('0x63')]();_0x421282[_0x7d24('0x22')](_0x7d24('0x64'));_0x421282=applyJoinClauses(_0x421282,!![]);_0x1ba75d[_0x7d24('0x65')](_0x7d24('0x66'));var _0x36e40f=utils[_0x7d24('0x67')](_0x468b1d);if(!_['isEmpty'](_0x36e40f)){_0x421282[_0x7d24('0xc')](_0x7d24('0x68'),_0x36e40f);}var _0x287824={'type':db[_0x7d24('0x5c')][_0x7d24('0x5d')]['SELECT'],'raw':!![]};return db[_0x7d24('0x60')][_0x7d24('0x69')](_0x421282[_0x7d24('0x61')](),_0x287824)[_0x7d24('0x4f')](function(_0x5d864f){return _0x5d864f[0x0][_0x7d24('0x64')];});}module[_0x7d24('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x231e=['sequelize','COUNT(*)','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','true','select','from','cm_contacts','where','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','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','includes','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','dateOfBirth','DATE','buildExpression','default','text','value','start','end','Tag','map','clause','tags','ids','User','and','uc.UserId\x20=\x20?','user','skip','some','push','ListId','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','getSelectedTags','isEmpty','t.id\x20IN\x20?'];(function(_0x43b801,_0x448a69){var _0x3c7819=function(_0x4c3356){while(--_0x4c3356){_0x43b801['push'](_0x43b801['shift']());}};_0x3c7819(++_0x448a69);}(_0x231e,0x71));var _0xe231=function(_0x6923ea,_0x4b5785){_0x6923ea=_0x6923ea-0x0;var _0x37b5d1=_0x231e[_0x6923ea];return _0x37b5d1;};'use strict';var _=require('lodash');var squel=require(_0xe231('0x0'));var as=require(_0xe231('0x1'));var qs=require(_0xe231('0x2'));var utils=require(_0xe231('0x3'));var db=require(_0xe231('0x4'))['db'];function skipContactsQuery(_0x5c5b41,_0x138461){var _0x5ad1f3=![];if(_0x5c5b41[_0xe231('0x5')]===_0xe231('0x6')&&!_0x138461[_0xe231('0x7')]&&!_0x138461['ListId']&&_0x138461['autocomplete']!==_0xe231('0x8')){_0x5ad1f3=!![];}return _0x5ad1f3;}function getContactsSubquery(){return squel[_0xe231('0x9')]()[_0xe231('0xa')](_0xe231('0xb'),'c')[_0xe231('0xc')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x5de221,_0x3cd63f){var _0x4824f8=_0x3cd63f?'c':_0xe231('0xd');_0x5de221[_0xe231('0xe')](_0xe231('0xf'),'uc',_0xe231('0x10')+_0x4824f8+_0xe231('0x11'))[_0xe231('0xe')](_0xe231('0x12'),'ct',_0xe231('0x13')+_0x4824f8+_0xe231('0x11'))['left_join'](_0xe231('0x14'),'t',_0xe231('0x15'));return _0x5de221;}function addFieldsToQuery(_0x4a9c13,_0x38adc6,_0x101164,_0xc5edeb,_0x3e35b4){var _0x5dea74=_0x3e35b4?'c':_0xe231('0xd');if(!_0x38adc6){_0x38adc6=['id',_0xe231('0x16'),_0xe231('0x17'),_0xe231('0x18'),_0xe231('0x19'),_0xe231('0x1a'),'email','ListId',_0xe231('0x1b'),_0xe231('0x1c'),_0xe231('0x1d'),_0xe231('0x1e'),'TagIds'];}else if(!_0x38adc6[_0xe231('0x1f')]('id')){_0x38adc6['push']('id');}var _0x18788b=_0x101164&&_0x3e35b4||!_0x101164&&!_0x3e35b4;if(_0xc5edeb){_0x18788b=_0xc5edeb&&_0x3e35b4||!_0xc5edeb&&!_0x3e35b4;}_0x38adc6[_0xe231('0x20')](function(_0x128172){if(_0x128172===_0xe231('0x21')){if(_0x18788b){_0x4a9c13[_0xe231('0x22')](_0xe231('0x23'),_0x128172);}else if(_0x101164||_0xc5edeb){_0x4a9c13[_0xe231('0x22')](_0x5dea74+'.'+_0x128172);}}else{_0x4a9c13['field'](_0x5dea74+'.'+_0x128172);}});return _0x4a9c13;}function getSqlClauses(){var _0x4a9bdf={'default':squel[_0xe231('0x24')](),'fields':squel[_0xe231('0x24')](),'filter':squel[_0xe231('0x24')](),'tags':{'clause':squel[_0xe231('0x24')](),'ids':null},'user':{'clause':squel[_0xe231('0x24')](),'skip':![]}};return _0x4a9bdf;}function parseTagParameter(_0x4d0d62){var _0x321639=squel[_0xe231('0x24')]();if(_0x4d0d62){var _0x4faf15=utils['getSelectedTags'](_0x4d0d62);_0x4faf15[_0xe231('0x20')](function(_0x54cea0){_0x321639['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x54cea0+',%');});}return _0x321639;}function parseSearchFilter(_0x901f7b){var _0x5f0dd6=squel[_0xe231('0x24')]();if(_0x901f7b){var _0x8ce89a=_0x901f7b[_0xe231('0x25')]('\x5c','\x5c\x5c')[_0xe231('0x25')](/'/g,'\x27\x27');if(_0x8ce89a[_0xe231('0x26')]('\x20')['length']>0x1){_0x5f0dd6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe231('0x27')](_0x8ce89a,!![]),null);}else{if(qs[_0xe231('0x28')](_0x8ce89a)){_0x5f0dd6['or'](_0xe231('0x29'),_0x8ce89a+'%');_0x5f0dd6['or'](_0xe231('0x2a'),_0x8ce89a+'%');_0x5f0dd6['or'](_0xe231('0x2b'),_0x8ce89a+'%');_0x5f0dd6['or'](_0xe231('0x2c'),_0x8ce89a+'%');}else if(qs['isEmail'](_0x8ce89a)){_0x5f0dd6['or'](_0xe231('0x2d'),_0x8ce89a+'%');}else{_0x5f0dd6['or']('c.firstName\x20LIKE\x20?','%'+_0x8ce89a+'%');_0x5f0dd6['or'](_0xe231('0x2e'),'%'+_0x8ce89a+'%');_0x5f0dd6['or'](_0xe231('0x2d'),'%'+_0x8ce89a+'%');}}}return _0x5f0dd6;}function parseAdvancedSearchFilter(_0xb7971b,_0x5bf7b8){var _0x320344=getSqlClauses();var _0x15cd64=as[_0xe231('0x2f')](_0xb7971b);var _0x38ff90=_0x15cd64[_0xe231('0x30')];for(var _0x56b6ca=0x0;_0x56b6ca<_0x15cd64[_0xe231('0x31')][_0xe231('0x32')];_0x56b6ca++){var _0x4e7e53=_0x15cd64[_0xe231('0x31')][_0x56b6ca];var _0x3d6789='c';var _0x431a1a=_[_0xe231('0x33')](_0x5bf7b8,[_0xe231('0x34'),_0x4e7e53[_0xe231('0x22')]]);if(_0x431a1a){if(_0x4e7e53[_0xe231('0x22')]===_0xe231('0x35')||_0x431a1a['fieldType']==='datetime'){_0x4e7e53['castTo']=_0xe231('0x36');}var _0x5d0751=as[_0xe231('0x37')](_0x3d6789,_0x431a1a['type'],_0x4e7e53);_0x320344[_0xe231('0x38')][_0x38ff90](_0x5d0751[_0xe231('0x39')],_0x5d0751[_0xe231('0x3a')][_0xe231('0x3b')],_0x5d0751['value'][_0xe231('0x3c')]);}else{if(_0x4e7e53[_0xe231('0x22')]===_0xe231('0x3d')){var _0x31dbd4=_0x4e7e53[_0xe231('0x3a')][_0xe231('0x26')](',')[_0xe231('0x3e')](function(_0x162463){return Number(_0x162463);});var _0x2df305=parseTagParameter(_0x31dbd4);_0x320344['tags'][_0xe231('0x3f')]['and'](_0x2df305);_0x320344[_0xe231('0x40')][_0xe231('0x41')]=_0x31dbd4;}else if(_0x4e7e53[_0xe231('0x22')]===_0xe231('0x42')){_0x320344['user'][_0xe231('0x3f')][_0xe231('0x43')](_0xe231('0x44'),_0x4e7e53[_0xe231('0x3a')]);_0x320344[_0xe231('0x45')][_0xe231('0x46')]=!![];}}}return _0x320344;}function parseModelFields(_0x5119ea,_0x227c8d){var _0x313af6=squel[_0xe231('0x24')]();var _0x523fb8=_(_0x5119ea)['keys']()[_0xe231('0x3e')](function(_0x4a0a61){return _[_0xe231('0x47')](_0x227c8d,[_0xe231('0x34'),_0x4a0a61])?_0x4a0a61:undefined;})['compact']()[_0xe231('0x3a')]();if(_0x5119ea['Contact']){_0x523fb8[_0xe231('0x48')]('Contact');}if(_0x5119ea['User']){_0x523fb8['push'](_0xe231('0x42'));}if(_0x523fb8[_0xe231('0x32')]>0x0){_0x523fb8[_0xe231('0x20')](function(_0x1c1106){if(_0x1c1106===_0xe231('0x49')){_0x313af6[_0xe231('0x43')]('c.ListId\x20IN\x20?',[]['concat'](_0x5119ea[_0x1c1106]));}else if(_0x1c1106===_0xe231('0x4a')){var _0x29e2d2='%'+_0x5119ea[_0x1c1106]+'%';_0x313af6['and'](_0xe231('0x4b'),_0x29e2d2);}else if(_0x1c1106===_0xe231('0x42')){_0x313af6['and'](_0xe231('0x44'),_0x5119ea[_0x1c1106]);}else{_0x313af6[_0xe231('0x43')]('c.'+_0x1c1106+_0xe231('0x4c'),_0x5119ea[_0x1c1106]);}});}return _0x313af6;}function parseQueryParameters(_0x3fd8db,_0x24469e){var _0xbc7569=getSqlClauses();return Promise[_0xe231('0x4d')]()[_0xe231('0x4e')](function(){return parseModelFields(_0x3fd8db,_0x24469e);})['then'](function(_0x51db03){_0xbc7569[_0xe231('0x4f')][_0xe231('0x43')](_0x51db03);return parseTagParameter(_0x3fd8db[_0xe231('0x50')]);})[_0xe231('0x4e')](function(_0x45d23c){_0xbc7569[_0xe231('0x40')]['clause'][_0xe231('0x43')](_0x45d23c);return parseSearchFilter(_0x3fd8db['filter']);})[_0xe231('0x4e')](function(_0x275556){_0xbc7569[_0xe231('0x51')]=_0x275556;return _0xbc7569;});}function checkListsRestrictions(_0x3d5f49,_0x31d08f,_0xf7179e){var _0xa9d49c=squel['expr']();return Promise[_0xe231('0x4d')]()[_0xe231('0x4e')](function(){if(_0x31d08f[_0xe231('0x7')]&&_0x3d5f49[_0xe231('0x5')]==='agent'&&!_0xf7179e){return _0x3d5f49[_0xe231('0x52')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x8c28a3){if(_0x8c28a3){if(_0x8c28a3[_0xe231('0x32')]===0x0){_0xa9d49c[_0xe231('0x43')](_0xe231('0x53'));}else{_0xa9d49c['and']('c.ListId\x20IN\x20?',_[_0xe231('0x3e')](_0x8c28a3,'id'));}}})['then'](function(){return _0xa9d49c;});}function buildContactsQuery(_0x1c20f9,_0xc92f46,_0xbf01a8,_0x56ffc3,_0x53cf82,_0x3e80dd){if(_0xc92f46){_0xc92f46=_0xbf01a8[_0xe231('0x54')];}_0x1c20f9=addFieldsToQuery(_0x1c20f9,_0xc92f46,_0x56ffc3,_0x3e80dd,!![]);var _0x5e22b2=squel[_0xe231('0x9')]();_0x5e22b2=addFieldsToQuery(_0x5e22b2,_0xc92f46,_0x56ffc3,_0x3e80dd,![]);if(_0x56ffc3||_0x3e80dd){_0x1c20f9=applyJoinClauses(_0x1c20f9,!![]);_0x1c20f9['group'](_0xe231('0x55'));if(_0xbf01a8['limit']){_0x5e22b2[_0xe231('0x56')](_0xbf01a8['limit']);}if(_0xbf01a8[_0xe231('0x57')]){_0x5e22b2[_0xe231('0x57')](_0xbf01a8[_0xe231('0x57')]);}}else{_0x5e22b2=applyJoinClauses(_0x5e22b2,![]);_0x5e22b2[_0xe231('0x58')](_0xe231('0x59'));if(_0xbf01a8['limit']){_0x1c20f9[_0xe231('0x56')](_0xbf01a8['limit']);}if(_0xbf01a8['offset']){_0x1c20f9[_0xe231('0x57')](_0xbf01a8[_0xe231('0x57')]);}}_0x5e22b2[_0xe231('0x5a')](_0x53cf82);if(_0xbf01a8[_0xe231('0x5b')]){_0xbf01a8[_0xe231('0x5b')][_0xe231('0x20')](function(_0x51d4a2){_0x1c20f9['order']('c.'+_0x51d4a2[0x0],_0x51d4a2[0x1]===_0xe231('0x5c')?![]:!![]);_0x5e22b2[_0xe231('0x5b')](_0xe231('0x5d')+_0x51d4a2[0x0],_0x51d4a2[0x1]===_0xe231('0x5c')?![]:!![]);});}_0x5e22b2['from'](_0x1c20f9,'subqry');return _0x5e22b2;}function getFilteredContacts(_0x5e696e){var _0x5e3efb=[];return db[_0xe231('0x3d')]['findAll']({'attributes':['id',_0xe231('0x34'),_0xe231('0x5e')],'raw':!![]})[_0xe231('0x4e')](function(_0x1f83f9){_0x5e3efb=_[_0xe231('0x5f')](_0x1f83f9,'id');var _0xc85dbd={'type':db[_0xe231('0x60')][_0xe231('0x61')][_0xe231('0x62')],'model':db[_0xe231('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xe231('0x64')](_0x5e696e[_0xe231('0x65')](),_0xc85dbd);})['then'](function(_0x1132f8){_0x1132f8['forEach'](function(_0x2fa279){if(_0x2fa279[_0xe231('0x21')]){_0x2fa279['Tags']=[];_0x2fa279[_0xe231('0x21')]['split'](',')[_0xe231('0x20')](function(_0x2467c2){_0x2fa279[_0xe231('0x66')][_0xe231('0x48')](_0x5e3efb[_0x2467c2]);});}delete _0x2fa279[_0xe231('0x21')];});return _0x1132f8;});}function countFilteredContacts(_0x10889e,_0x2ad624){var _0x563518=_0x10889e[_0xe231('0x67')]();_0x563518['field']('COUNT(*)');_0x563518=applyJoinClauses(_0x563518,!![]);_0x10889e[_0xe231('0x58')](_0xe231('0x55'));var _0x544242=utils[_0xe231('0x68')](_0x2ad624);if(!_[_0xe231('0x69')](_0x544242)){_0x563518[_0xe231('0xc')](_0xe231('0x6a'),_0x544242);}var _0x3b6e4e={'type':db[_0xe231('0x60')][_0xe231('0x61')][_0xe231('0x62')],'raw':!![]};return db[_0xe231('0x6b')][_0xe231('0x64')](_0x563518[_0xe231('0x65')](),_0x3b6e4e)[_0xe231('0x4e')](function(_0x17edef){return _0x17edef[0x0][_0xe231('0x6c')];});}module[_0xe231('0x6d')]={'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 048ecbb..48d553a 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 _0xa0b6=['utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','algorithm','encrypt','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','write','end','final','binary','unlink','createDecipher','data','close','encryptString'];(function(_0x55f8bc,_0x33017c){var _0x5945b0=function(_0x5459fe){while(--_0x5459fe){_0x55f8bc['push'](_0x55f8bc['shift']());}};_0x5945b0(++_0x33017c);}(_0xa0b6,0x19c));var _0x6a0b=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xa0b6[_0x383356];return _0x32ee5a;};'use strict';var crypto=require(_0x6a0b('0x0'));var fs=require('fs');var BPromise=require(_0x6a0b('0x1'));var _=require(_0x6a0b('0x2'));var config=require(_0x6a0b('0x3'));var logger=require(_0x6a0b('0x4'))(_0x6a0b('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6a0b('0x6')],'algorithm':_0x6a0b('0x7')};const fileOptions={'algorithm':_0x6a0b('0x8')};if(config['encrypt']&&config['encrypt'][_0x6a0b('0x9')]){var isSupported=isAlgorithmSupported(config[_0x6a0b('0xa')]['algorithm']);if(isSupported){fileOptions[_0x6a0b('0x9')]=config[_0x6a0b('0xa')][_0x6a0b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6a0b('0xb')](',\x20');logger['error'](config[_0x6a0b('0xa')][_0x6a0b('0x9')],_0x6a0b('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x556039){return AES_SUPPORTED_RX[_0x6a0b('0xd')](_0x556039);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x6a0b('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x534a08){return getSupportedCiphers()[_0x6a0b('0xf')](_0x534a08)>-0x1;}function combineOptions(_0x14c7c5){var _0x174267={};for(var _0xc22605 in fileOptions){if(fileOptions['hasOwnProperty'](_0xc22605)){_0x174267[_0xc22605]=fileOptions[_0xc22605];}}if(_0x14c7c5){for(var _0x183407 in _0x14c7c5){if(_0x14c7c5[_0x6a0b('0x10')](_0x183407)){_0x174267[_0x183407]=_0x14c7c5[_0x183407];}}}return _0x174267;}exports['encryptFile']=function(_0x459baf,_0x2b70ed,_0x3c05d3,_0x7b9f20){return new BPromise(function(_0x18a42d,_0x7aab37){_0x7b9f20=combineOptions(_0x7b9f20);var _0x2898e2=new Buffer(_0x3c05d3);var _0x1c8e63=fs[_0x6a0b('0x11')](_0x459baf);var _0x286f8b=fs[_0x6a0b('0x12')](_0x2b70ed);var _0x7efc3e=crypto[_0x6a0b('0x13')](_0x7b9f20[_0x6a0b('0x9')],_0x2898e2);_0x1c8e63['on']('data',function(_0x10553e){var _0x3e837a=new Buffer(_0x7efc3e[_0x6a0b('0x14')](_0x10553e),'binary');_0x286f8b[_0x6a0b('0x15')](_0x3e837a);});_0x1c8e63['on'](_0x6a0b('0x16'),function(){try{var _0x2bf090=new Buffer(_0x7efc3e[_0x6a0b('0x17')](_0x6a0b('0x18')),_0x6a0b('0x18'));_0x286f8b['write'](_0x2bf090);_0x286f8b[_0x6a0b('0x16')]();_0x286f8b['on']('close',function(){return _0x18a42d(_0x2b70ed);});}catch(_0x440099){fs[_0x6a0b('0x19')](_0x2b70ed);return _0x7aab37(_0x440099);}});});};exports['decryptFile']=function(_0x58b255,_0x4e6523,_0x3e1139,_0x3ed882){return new BPromise(function(_0x4e43b4,_0x1dd0cf){_0x3ed882=combineOptions(_0x3ed882);var _0x41a3ab=new Buffer(_0x3e1139);var _0x819e70=fs[_0x6a0b('0x11')](_0x58b255);var _0x4e3086=fs[_0x6a0b('0x12')](_0x4e6523);var _0xc392e5=crypto[_0x6a0b('0x1a')](_0x3ed882['algorithm'],_0x41a3ab);_0x819e70['on'](_0x6a0b('0x1b'),function(_0x13274a){var _0x2eae39=new Buffer(_0xc392e5[_0x6a0b('0x14')](_0x13274a),_0x6a0b('0x18'));_0x4e3086[_0x6a0b('0x15')](_0x2eae39);});_0x819e70['on']('end',function(){try{var _0x42d548=new Buffer(_0xc392e5[_0x6a0b('0x17')](_0x6a0b('0x18')),_0x6a0b('0x18'));_0x4e3086[_0x6a0b('0x15')](_0x42d548);_0x4e3086[_0x6a0b('0x16')]();_0x4e3086['on'](_0x6a0b('0x1c'),function(){return _0x4e43b4(_0x4e6523);});}catch(_0x3cf000){fs[_0x6a0b('0x19')](_0x4e6523);return _0x1dd0cf(_0x3cf000);}});});};exports[_0x6a0b('0x1d')]=function(_0x27639d,_0x272a40,_0x4fb75c){var _0x5b80a0=_0x4fb75c||stringOptions['algorithm'];var _0x160287=_0x272a40||stringOptions['secret'];var _0x244dcf=crypto[_0x6a0b('0x13')](_0x5b80a0,_0x160287);var _0x5dde9b=_0x244dcf['update'](_0x27639d,_0x6a0b('0x1e'),_0x6a0b('0x1f'));_0x5dde9b+=_0x244dcf[_0x6a0b('0x17')]('base64');return _0x5dde9b;};exports[_0x6a0b('0x20')]=function(_0x41e755,_0x1d117d,_0x515886){var _0x3e439c=_0x515886||stringOptions[_0x6a0b('0x9')];var _0x3744c8=_0x1d117d||stringOptions[_0x6a0b('0x21')];var _0xbf0011=crypto[_0x6a0b('0x1a')](_0x3e439c,_0x3744c8);var _0x3e4f43=_0xbf0011['update'](_0x41e755,_0x6a0b('0x1f'),_0x6a0b('0x1e'));_0x3e4f43+=_0xbf0011[_0x6a0b('0x17')](_0x6a0b('0x1e'));return _0x3e4f43;}; \ No newline at end of file +var _0x0c9a=['binary','end','final','write','close','unlink','decryptFile','encryptString','secret','base64','decryptString','createDecipher','crypto','bluebird','../../config/logger','app','secrets','aes-256-ctr','aes192','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update'];(function(_0x2cfea8,_0x4f5018){var _0x3834c4=function(_0x276a42){while(--_0x276a42){_0x2cfea8['push'](_0x2cfea8['shift']());}};_0x3834c4(++_0x4f5018);}(_0x0c9a,0x114));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xa0c9('0x0'));var fs=require('fs');var BPromise=require(_0xa0c9('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xa0c9('0x2'))(_0xa0c9('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa0c9('0x4')]['session'],'algorithm':_0xa0c9('0x5')};const fileOptions={'algorithm':_0xa0c9('0x6')};if(config['encrypt']&&config['encrypt'][_0xa0c9('0x7')]){var isSupported=isAlgorithmSupported(config[_0xa0c9('0x8')][_0xa0c9('0x7')]);if(isSupported){fileOptions[_0xa0c9('0x7')]=config['encrypt'][_0xa0c9('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa0c9('0x9')](',\x20');logger[_0xa0c9('0xa')](config[_0xa0c9('0x8')][_0xa0c9('0x7')],_0xa0c9('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x473cc1){return AES_SUPPORTED_RX[_0xa0c9('0xc')](_0x473cc1);}function getSupportedCiphers(){return crypto[_0xa0c9('0xd')]()[_0xa0c9('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1f86e2){return getSupportedCiphers()['indexOf'](_0x1f86e2)>-0x1;}function combineOptions(_0x5892f6){var _0x33be31={};for(var _0x282506 in fileOptions){if(fileOptions[_0xa0c9('0xf')](_0x282506)){_0x33be31[_0x282506]=fileOptions[_0x282506];}}if(_0x5892f6){for(var _0x5dd5d5 in _0x5892f6){if(_0x5892f6[_0xa0c9('0xf')](_0x5dd5d5)){_0x33be31[_0x5dd5d5]=_0x5892f6[_0x5dd5d5];}}}return _0x33be31;}exports['encryptFile']=function(_0x799960,_0x176d96,_0x2fe384,_0x57adaa){return new BPromise(function(_0x5b05a0,_0x563f92){_0x57adaa=combineOptions(_0x57adaa);var _0x251aca=new Buffer(_0x2fe384);var _0x39900e=fs[_0xa0c9('0x10')](_0x799960);var _0x18cf60=fs[_0xa0c9('0x11')](_0x176d96);var _0x39d719=crypto[_0xa0c9('0x12')](_0x57adaa['algorithm'],_0x251aca);_0x39900e['on'](_0xa0c9('0x13'),function(_0x501e06){var _0x35e792=new Buffer(_0x39d719[_0xa0c9('0x14')](_0x501e06),_0xa0c9('0x15'));_0x18cf60['write'](_0x35e792);});_0x39900e['on'](_0xa0c9('0x16'),function(){try{var _0x3e77cf=new Buffer(_0x39d719[_0xa0c9('0x17')]('binary'),_0xa0c9('0x15'));_0x18cf60[_0xa0c9('0x18')](_0x3e77cf);_0x18cf60[_0xa0c9('0x16')]();_0x18cf60['on'](_0xa0c9('0x19'),function(){return _0x5b05a0(_0x176d96);});}catch(_0x5bf2f2){fs[_0xa0c9('0x1a')](_0x176d96);return _0x563f92(_0x5bf2f2);}});});};exports[_0xa0c9('0x1b')]=function(_0x19fe8f,_0x223494,_0x25b9d8,_0x5ea140){return new BPromise(function(_0x508ba3,_0x53a0f7){_0x5ea140=combineOptions(_0x5ea140);var _0x5be112=new Buffer(_0x25b9d8);var _0x172075=fs['createReadStream'](_0x19fe8f);var _0x29a251=fs['createWriteStream'](_0x223494);var _0x42cccf=crypto['createDecipher'](_0x5ea140[_0xa0c9('0x7')],_0x5be112);_0x172075['on'](_0xa0c9('0x13'),function(_0x1f3076){var _0x318063=new Buffer(_0x42cccf['update'](_0x1f3076),_0xa0c9('0x15'));_0x29a251['write'](_0x318063);});_0x172075['on'](_0xa0c9('0x16'),function(){try{var _0x333b07=new Buffer(_0x42cccf[_0xa0c9('0x17')]('binary'),_0xa0c9('0x15'));_0x29a251[_0xa0c9('0x18')](_0x333b07);_0x29a251[_0xa0c9('0x16')]();_0x29a251['on'](_0xa0c9('0x19'),function(){return _0x508ba3(_0x223494);});}catch(_0x5eedd4){fs[_0xa0c9('0x1a')](_0x223494);return _0x53a0f7(_0x5eedd4);}});});};exports[_0xa0c9('0x1c')]=function(_0x5b1066,_0x47c9d7,_0x114670){var _0x2676db=_0x114670||stringOptions[_0xa0c9('0x7')];var _0x5da623=_0x47c9d7||stringOptions[_0xa0c9('0x1d')];var _0x130642=crypto[_0xa0c9('0x12')](_0x2676db,_0x5da623);var _0x3a49b6=_0x130642[_0xa0c9('0x14')](_0x5b1066,'utf8',_0xa0c9('0x1e'));_0x3a49b6+=_0x130642[_0xa0c9('0x17')]('base64');return _0x3a49b6;};exports[_0xa0c9('0x1f')]=function(_0x5de84b,_0x243128,_0x62ea00){var _0x19cc97=_0x62ea00||stringOptions[_0xa0c9('0x7')];var _0x3152d6=_0x243128||stringOptions[_0xa0c9('0x1d')];var _0x4b25ba=crypto[_0xa0c9('0x20')](_0x19cc97,_0x3152d6);var _0x301567=_0x4b25ba[_0xa0c9('0x14')](_0x5de84b,'base64','utf8');_0x301567+=_0x4b25ba['final']('utf8');return _0x301567;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9ae33d8..9b2d5f3 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 _0x755f=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','exit','path','lodash','to-csv','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','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','length','push'];(function(_0x175ecb,_0x55b4a6){var _0x14449a=function(_0xeee57){while(--_0xeee57){_0x175ecb['push'](_0x175ecb['shift']());}};_0x14449a(++_0x55b4a6);}(_0x755f,0x6c));var _0xf755=function(_0xf84186,_0x4dbffe){_0xf84186=_0xf84186-0x0;var _0x4e397c=_0x755f[_0xf84186];return _0x4e397c;};'use strict';var util=require('util');var path=require(_0xf755('0x0'));var _=require(_0xf755('0x1'));var csv=require(_0xf755('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf755('0x3'));var rimraf=require('rimraf');var db=require(_0xf755('0x4'))['db'];var dbH=require(_0xf755('0x4'))[_0xf755('0x5')];var logger=require(_0xf755('0x6'))(_0xf755('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf755('0x8')][0x2]);var QUERY=process[_0xf755('0x8')][0x3];var PATH=process[_0xf755('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b64db,_0x3eeec6){var _0x2f63eb={'status':_0x5b64db};var _0x39e42a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3eeec6){_0x2f63eb[_0xf755('0x9')]=_0x3eeec6;}return db[_0xf755('0xa')][_0xf755('0xb')](_0x2f63eb,_0x39e42a);}function main(){var _0x5a709e=0x1388;var _0x23692c;logger[_0xf755('0xc')](util[_0xf755('0xd')](_0xf755('0xe'),EXTRACTED_REPORT_ID,_0xf755('0xf')));return db['Setting'][_0xf755('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf755('0x11'),_0xf755('0x12')]})[_0xf755('0x13')](function(_0x40ee10){if(_0x40ee10){_0x23692c=_0x40ee10;_0x5a709e=_0x23692c[_0xf755('0x12')]||0x1388;}})[_0xf755('0x13')](function(){return dbH['sequelize'][_0xf755('0x14')](util[_0xf755('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]});})[_0xf755('0x13')](function(_0x42feee){if(!_0x42feee[0x0][_0xf755('0x18')]){return analyticExtractedReport('Empty');}var _0x5abb8e=[];var _0x34bdc2=0x0;if(_0x23692c[_0xf755('0x11')]){if(_0x42feee&&_0x42feee[_0xf755('0x19')]){var _0x3d3235=_['range'](_0x42feee[0x0][_0xf755('0x18')]/_0x5a709e);var _0x3e0972=Number['isInteger'](_0x42feee[0x0][_0xf755('0x18')]/_0x5a709e)?_0x42feee[0x0][_0xf755('0x18')]%_0x5a709e:0x0;_0x3d3235['forEach'](function(_0x490630){if(_0x490630>0x0){_0x34bdc2+=_0x5a709e;}_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')][_0xf755('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a709e,_0x34bdc2),{'type':dbH['sequelize'][_0xf755('0x16')]['SELECT']}));});if(_0x3e0972>0x0){_0x34bdc2+=_0x5a709e;_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')]['query'](util['format'](_0xf755('0x1b'),QUERY,_0x3e0972,_0x34bdc2),{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]}));}}}else{_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')]['query'](QUERY,{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]}));}var _0x59f1fa=path[_0xf755('0x1c')](PATH);var _0x36017c=path[_0xf755('0x1d')](PATH,_0xf755('0x1e'));var _0x4f5739=_0x23692c[_0xf755('0x11')]&&_0x5abb8e[_0xf755('0x19')]>0x1;var _0x1a26ce=[];if(!fs[_0xf755('0x1f')](path[_0xf755('0x20')](_0x59f1fa,_0x36017c))&&_0x4f5739){fs['mkdirSync'](path[_0xf755('0x20')](_0x59f1fa,_0x36017c));}return BPromise[_0xf755('0x21')](_0x5abb8e,function(_0x2fafee){_0x1a26ce[_0xf755('0x1a')](_0x2fafee);})['then'](function(){for(var _0x5e1a4b=0x0;_0x5e1a4b<_0x1a26ce[_0xf755('0x19')];_0x5e1a4b+=0x1){var _0x14680b;var _0x45546b=_0x1a26ce[_0x5e1a4b];if(_0x4f5739){_0x14680b=path[_0xf755('0x20')](_0x59f1fa,_0x36017c,util[_0xf755('0xd')](_0xf755('0x22'),_0x36017c,_0x5e1a4b,_0xf755('0x23')));}else{_0x14680b=path[_0xf755('0x20')](_0x59f1fa,util['format'](_0xf755('0x24'),_0x36017c,'csv'));}fs[_0xf755('0x25')](_0x14680b,csv(_0x45546b));}})[_0xf755('0x13')](function(){if(_0x4f5739){return new Promise(function(_0x2cb290){zipdir(path[_0xf755('0x20')](_0x59f1fa,_0x36017c),{'saveTo':path['join'](_0x59f1fa,util[_0xf755('0xd')]('%s.%s',_0x36017c,_0xf755('0x26')))},function(_0x3bcab2,_0x8d460e){rimraf(path[_0xf755('0x20')](_0x59f1fa,_0x36017c),function(){});_0x2cb290('zip\x20finished');});});}})['then'](function(){logger[_0xf755('0xc')](util[_0xf755('0xd')](_0xf755('0x27'),EXTRACTED_REPORT_ID,_0xf755('0xf')));return analyticExtractedReport(_0xf755('0x28'),_0x4f5739?util[_0xf755('0xd')](_0xf755('0x24'),_0x36017c,_0x4f5739?_0xf755('0x26'):'csv'):null);});})[_0xf755('0x29')](function(_0x5caf80){logger['info'](util[_0xf755('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf755('0xf')),util[_0xf755('0x2a')](_0x5caf80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf755('0x2b'));})['finally'](function(){process[_0xf755('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb6b9=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','then','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','lodash','to-csv','zip-dir','../../mysqldb','dbH','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','sequelize','query','QueryTypes','SELECT','num','forEach','push'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb6b9,0x1be));var _0x9b6b=function(_0x1738c0,_0x2fa809){_0x1738c0=_0x1738c0-0x0;var _0x70cf18=_0xb6b9[_0x1738c0];return _0x70cf18;};'use strict';var util=require(_0x9b6b('0x0'));var path=require('path');var _=require(_0x9b6b('0x1'));var csv=require(_0x9b6b('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x9b6b('0x3'));var rimraf=require('rimraf');var db=require(_0x9b6b('0x4'))['db'];var dbH=require(_0x9b6b('0x4'))[_0x9b6b('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9b6b('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc07885,_0x491add){var _0xb697a3={'status':_0xc07885};var _0xcf3a3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x491add){_0xb697a3['savename']=_0x491add;}return db[_0x9b6b('0x7')]['update'](_0xb697a3,_0xcf3a3f);}function main(){var _0x357619=0x1388;var _0x5520ee;logger[_0x9b6b('0x8')](util[_0x9b6b('0x9')](_0x9b6b('0xa'),EXTRACTED_REPORT_ID,_0x9b6b('0xb')));return db['Setting'][_0x9b6b('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9b6b('0xd'),_0x9b6b('0xe')]})['then'](function(_0x313791){if(_0x313791){_0x5520ee=_0x313791;_0x357619=_0x5520ee[_0x9b6b('0xe')]||0x1388;}})['then'](function(){return dbH[_0x9b6b('0xf')][_0x9b6b('0x10')](util[_0x9b6b('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9b6b('0xf')][_0x9b6b('0x11')][_0x9b6b('0x12')]});})['then'](function(_0xb6058d){if(!_0xb6058d[0x0][_0x9b6b('0x13')]){return analyticExtractedReport('Empty');}var _0x217116=[];var _0x1fda5a=0x0;if(_0x5520ee['split']){if(_0xb6058d&&_0xb6058d['length']){var _0x156db5=_['range'](_0xb6058d[0x0]['num']/_0x357619);var _0x5dd058=Number['isInteger'](_0xb6058d[0x0][_0x9b6b('0x13')]/_0x357619)?_0xb6058d[0x0]['num']%_0x357619:0x0;_0x156db5[_0x9b6b('0x14')](function(_0x26349f){if(_0x26349f>0x0){_0x1fda5a+=_0x357619;}_0x217116[_0x9b6b('0x15')](dbH['sequelize'][_0x9b6b('0x10')](util[_0x9b6b('0x9')](_0x9b6b('0x16'),QUERY,_0x357619,_0x1fda5a),{'type':dbH[_0x9b6b('0xf')][_0x9b6b('0x11')]['SELECT']}));});if(_0x5dd058>0x0){_0x1fda5a+=_0x357619;_0x217116[_0x9b6b('0x15')](dbH['sequelize'][_0x9b6b('0x10')](util[_0x9b6b('0x9')](_0x9b6b('0x16'),QUERY,_0x5dd058,_0x1fda5a),{'type':dbH[_0x9b6b('0xf')][_0x9b6b('0x11')][_0x9b6b('0x12')]}));}}}else{_0x217116['push'](dbH[_0x9b6b('0xf')][_0x9b6b('0x10')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x9b6b('0x12')]}));}var _0x5bbff8=path[_0x9b6b('0x17')](PATH);var _0x33a615=path[_0x9b6b('0x18')](PATH,_0x9b6b('0x19'));var _0x46bcef=_0x5520ee[_0x9b6b('0xd')]&&_0x217116[_0x9b6b('0x1a')]>0x1;var _0x3f23d2=[];if(!fs['existsSync'](path[_0x9b6b('0x1b')](_0x5bbff8,_0x33a615))&&_0x46bcef){fs['mkdirSync'](path[_0x9b6b('0x1b')](_0x5bbff8,_0x33a615));}return BPromise[_0x9b6b('0x1c')](_0x217116,function(_0x58fac4){_0x3f23d2[_0x9b6b('0x15')](_0x58fac4);})['then'](function(){for(var _0x25e45e=0x0;_0x25e45e<_0x3f23d2['length'];_0x25e45e+=0x1){var _0x70666e;var _0x149bc2=_0x3f23d2[_0x25e45e];if(_0x46bcef){_0x70666e=path[_0x9b6b('0x1b')](_0x5bbff8,_0x33a615,util[_0x9b6b('0x9')](_0x9b6b('0x1d'),_0x33a615,_0x25e45e,_0x9b6b('0x1e')));}else{_0x70666e=path['join'](_0x5bbff8,util[_0x9b6b('0x9')](_0x9b6b('0x1f'),_0x33a615,'csv'));}fs['writeFileSync'](_0x70666e,csv(_0x149bc2));}})['then'](function(){if(_0x46bcef){return new Promise(function(_0x59850d){zipdir(path['join'](_0x5bbff8,_0x33a615),{'saveTo':path['join'](_0x5bbff8,util['format']('%s.%s',_0x33a615,_0x9b6b('0x20')))},function(_0x30c4b4,_0x4031f7){rimraf(path[_0x9b6b('0x1b')](_0x5bbff8,_0x33a615),function(){});_0x59850d(_0x9b6b('0x21'));});});}})[_0x9b6b('0x22')](function(){logger['info'](util[_0x9b6b('0x9')](_0x9b6b('0x23'),EXTRACTED_REPORT_ID,_0x9b6b('0xb')));return analyticExtractedReport(_0x9b6b('0x24'),_0x46bcef?util['format']('%s.%s',_0x33a615,_0x46bcef?_0x9b6b('0x20'):_0x9b6b('0x1e')):null);});})['catch'](function(_0x4260cf){logger['info'](util['format'](_0x9b6b('0x25'),EXTRACTED_REPORT_ID,_0x9b6b('0xb')),util['inspect'](_0x4260cf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9b6b('0x26')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4361b3e..bdfe62c 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 _0x74ba=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','%s.%s','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','toString','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','error','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','value','fill','length','auto','body','push','concat','keys','forEach','name','startDate','format','header','pageBreak','before','margin','\x20/\x20','black','num','Empty','Setting','find','splitSizePdf','then','split','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all'];(function(_0x285f69,_0x534abd){var _0x1b65e4=function(_0x241e13){while(--_0x241e13){_0x285f69['push'](_0x285f69['shift']());}};_0x1b65e4(++_0x534abd);}(_0x74ba,0x111));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa74b('0x0'));var path=require(_0xa74b('0x1'));var moment=require(_0xa74b('0x2'));var htmlToPdfmake=require(_0xa74b('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa74b('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xa74b('0x5'))[_0xa74b('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0xa74b('0x7'));var db=require(_0xa74b('0x8'))['db'];var dbH=require(_0xa74b('0x8'))[_0xa74b('0x9')];var logger=require(_0xa74b('0xa'))(_0xa74b('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xa74b('0xc')][0x2]);var QUERY=process[_0xa74b('0xc')][0x3];var PATH=process[_0xa74b('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xa74b('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xd3601a,_0x3456c2){var _0x5e89aa={'status':_0xd3601a};var _0x38ab13={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3456c2){_0x5e89aa[_0xa74b('0xe')]=_0x3456c2;}return db[_0xa74b('0xf')]['update'](_0x5e89aa,_0x38ab13);}function getHeaders(_0x12b7c6){return _['map'](_0x12b7c6,function(_0x5df8e8){return{'text':_0x5df8e8,'style':_0xa74b('0x10')};});}function getRows(_0x4d25e7,_0x3b908a){return _[_0xa74b('0x11')](_0x3b908a,function(_0x426d45){return _(_0x426d45)[_0xa74b('0x12')](_0x4d25e7)['map'](function(_0x30c776){return _0x30c776?_['toString'](_0x30c776):'';})[_0xa74b('0x13')]();});}function createTable(_0xa9f0a4,_0x4b3f7f){var _0x2b359c={'widths':_[_0xa74b('0x14')](Array(_0xa9f0a4[_0xa74b('0x15')]),0x91),'heights':function(_0x2e4d5c){return _0x2e4d5c===0x0?_0xa74b('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1334d6=getHeaders(_0xa9f0a4);_0x2b359c[_0xa74b('0x17')][_0xa74b('0x18')](_0x1334d6);var _0x4c40cd=getRows(_0xa9f0a4,_0x4b3f7f);_0x2b359c[_0xa74b('0x17')]=_0x2b359c[_0xa74b('0x17')][_0xa74b('0x19')](_0x4c40cd);return _0x2b359c;}function createTables(_0x12c243){var _0x1ba48d=[];var _0x945492=_['chunk'](Object[_0xa74b('0x1a')](_0x12c243[0x0]),0x5);_0x945492[_0xa74b('0x1b')](function(_0x59e446){_0x1ba48d[_0xa74b('0x18')](createTable(_0x59e446,_0x12c243));});return _0x1ba48d;}function getPDFDocDefinition(_0xfcca82){var _0x1a1844=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xa74b('0x1c')],moment(EXTRACTED_REPORT[_0xa74b('0x1d')])[_0xa74b('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa74b('0x1e')](FORMAT));var _0x5e5626=[];for(var _0xd1dbee=0x0;_0xd1dbee<_0xfcca82[_0xa74b('0x15')];_0xd1dbee++){var _0x11db4f=[];if(_0xd1dbee===0x0){_0x11db4f[_0xa74b('0x18')]({'text':_0x1a1844,'style':_0xa74b('0x1f')});}var _0x35a300={'table':_0xfcca82[_0xd1dbee]};if(_0xd1dbee>0x0){_0x35a300[_0xa74b('0x20')]=_0xa74b('0x21');_0x35a300[_0xa74b('0x22')]=[0x0,0x46,0x0,0x0];}_0x11db4f[_0xa74b('0x18')](_0x35a300);_0x5e5626[_0xa74b('0x18')](_0x11db4f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5e5626,'footer':function(_0x1852ee,_0x3a0e76){return{'text':_0x1852ee['toString']()+_0xa74b('0x23')+_0x3a0e76,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa74b('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3414bf){var _0x1adccd=0x1388;var _0x572e2e;if(!_0x3414bf[0x0][_0xa74b('0x25')]){return analyticExtractedReport(_0xa74b('0x26'));}return db[_0xa74b('0x27')][_0xa74b('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa74b('0x29')]})[_0xa74b('0x2a')](function(_0x1cdb30){if(_0x1cdb30){_0x572e2e=_0x1cdb30;_0x1adccd=_0x572e2e[_0xa74b('0x29')]||0x3e8;}})['then'](function(){var _0x3a6254=[];var _0x146cb7=0x0;if(_0x572e2e[_0xa74b('0x2b')]){if(_0x3414bf&&_0x3414bf[_0xa74b('0x15')]){var _0x3822cf=_[_0xa74b('0x2c')](_0x3414bf[0x0]['num']/_0x1adccd);var _0x528a68=Number['isInteger'](_0x3414bf[0x0]['num']/_0x1adccd)?_0x3414bf[0x0][_0xa74b('0x25')]%_0x1adccd:0x0;_0x3822cf[_0xa74b('0x1b')](function(_0xc8ec32){if(_0xc8ec32>0x0){_0x146cb7+=_0x1adccd;}_0x3a6254[_0xa74b('0x18')](dbH[_0xa74b('0x2d')][_0xa74b('0x2e')](util[_0xa74b('0x1e')](_0xa74b('0x2f'),QUERY,_0x1adccd,_0x146cb7),{'type':dbH[_0xa74b('0x2d')][_0xa74b('0x30')][_0xa74b('0x31')]}));});if(_0x528a68>0x0){_0x146cb7+=_0x1adccd;_0x3a6254[_0xa74b('0x18')](dbH[_0xa74b('0x2d')][_0xa74b('0x2e')](util[_0xa74b('0x1e')](_0xa74b('0x2f'),QUERY,_0x528a68,_0x146cb7),{'type':dbH['sequelize'][_0xa74b('0x30')][_0xa74b('0x31')]}));}}}else{_0x3a6254['push'](dbH[_0xa74b('0x2d')]['query'](QUERY,{'type':dbH['sequelize'][_0xa74b('0x30')][_0xa74b('0x31')]}));}var _0x2dbfc2=path['dirname'](PATH);var _0x4b859d=path['basename'](PATH,_0xa74b('0x32'));var _0x2e6883=_0x572e2e['split']&&_0x3a6254[_0xa74b('0x15')]>0x1;var _0x19e55f=[];if(!fs[_0xa74b('0x33')](path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d))&&_0x2e6883){fs['mkdirSync'](path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d));}return BPromise[_0xa74b('0x35')](_0x3a6254,function(_0x3768de){_0x19e55f[_0xa74b('0x18')](_0x3768de);})[_0xa74b('0x2a')](function(){var _0x44ed6c=[];for(var _0x19e90e=0x0;_0x19e90e<_0x19e55f[_0xa74b('0x15')];_0x19e90e+=0x1){var _0x14bd5f=_0x19e55f[_0x19e90e];var _0xe8f13a=createTables(_[_0xa74b('0x36')](_0x14bd5f));var _0x1273c5;var _0x2326ba=getPDFDocDefinition(_0xe8f13a);var _0x1c707e=getPDFPrinter();var _0x272138=_0x1c707e[_0xa74b('0x37')](_0x2326ba);if(_0x2e6883){_0x1273c5=path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d,util[_0xa74b('0x1e')](_0xa74b('0x38'),_0x4b859d,_0x19e90e,_0xa74b('0x39')));}else{_0x1273c5=path[_0xa74b('0x34')](_0x2dbfc2,util[_0xa74b('0x1e')]('%s.%s',_0x4b859d,_0xa74b('0x39')));}_0x44ed6c['push'](writePDFDocument(_0x272138,_0x1273c5));}return Promise[_0xa74b('0x3a')](_0x44ed6c);})[_0xa74b('0x2a')](function(){if(_0x2e6883){return new Promise(function(_0x3ce479){zipdir(path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d),{'saveTo':path[_0xa74b('0x34')](_0x2dbfc2,util[_0xa74b('0x1e')]('%s.%s',_0x4b859d,'zip'))},function(){rimraf(path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d),function(){});_0x3ce479(_0xa74b('0x3b'));});});}})['then'](function(){if(!_0x2e6883)return;rimraf(path['join'](_0x2dbfc2,_0x4b859d),function(){});})[_0xa74b('0x2a')](function(){logger[_0xa74b('0x3c')](util[_0xa74b('0x1e')](_0xa74b('0x3d'),EXTRACTED_REPORT_ID,_0xa74b('0x3e')));return analyticExtractedReport('Completed',_0x2e6883?util[_0xa74b('0x1e')](_0xa74b('0x3f'),_0x4b859d,_0x2e6883?'zip':_0xa74b('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa74b('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa74b('0x3e')));return db[_0xa74b('0xf')][_0xa74b('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa74b('0x2a')](function(_0x1a3660){EXTRACTED_REPORT=_0x1a3660;return dbH['sequelize'][_0xa74b('0x2e')](util['format'](_0xa74b('0x41'),QUERY),{'type':dbH[_0xa74b('0x2d')][_0xa74b('0x30')][_0xa74b('0x31')]});})[_0xa74b('0x2a')](extractReport)[_0xa74b('0x42')](function(_0x5757ad){logger[_0xa74b('0x3c')](util[_0xa74b('0x1e')](_0xa74b('0x43'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x5757ad,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa74b('0x44')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x280112=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xa74b('0x45'),'italics':__dirname+_0xa74b('0x46'),'bolditalics':__dirname+_0xa74b('0x47')}});return _0x280112;}function getPDFDocDefinitionFromHTML(_0x3b0a98,_0x22d739){var _0x4c3133=util[_0xa74b('0x1e')](_0xa74b('0x48'),_0x22d739['channel'],_0x22d739[_0xa74b('0x49')]);var _0x4e5f5d=moment()['format'](_0xa74b('0x4a'))[_0xa74b('0x4b')]();var _0x3dbe6b=htmlToPdfmake(_0x3b0a98,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3dbe6b],'defaultStyle':{'font':_0xa74b('0x4c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa74b('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa74b('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa74b('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa74b('0x1f')}];},'footer':function(_0x580783,_0x20cfd1){return[{'text':util['format'](_0xa74b('0x4e'),_0x4c3133,_0x580783,_0x20cfd1,_0x4e5f5d),'style':_0xa74b('0x4f')}];}};}function writePDFDocument(_0x5c5b03,_0x3d3a08){return new Promise(function(_0x1c769f,_0x339513){var _0x53ae6c=_0x5c5b03['pipe'](fs['createWriteStream'](_0x3d3a08));_0x53ae6c['on'](_0xa74b('0x50'),function(){_0x1c769f(_0xa74b('0x50'));});_0x53ae6c['on'](_0xa74b('0x51'),function(_0x1edb81){_0x339513(_0x1edb81);});_0x5c5b03['end']();});}exports[_0xa74b('0x52')]=function(_0x518683,_0x9e2fc){var _0x51e7ae=getPDFPrinter();var _0x535d43=getPDFDocDefinitionFromHTML(_0x518683,_0x9e2fc);var _0xb5d251=_0x51e7ae[_0xa74b('0x37')](_0x535d43);return writePDFDocument(_0xb5d251,_0x9e2fc[_0xa74b('0x1')])[_0xa74b('0x42')](function(_0xb10b21){throw _0xb10b21;});}; \ No newline at end of file +var _0x7b21=['savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','push','concat','keys','forEach','format','name','startDate','endDate','header','before','margin','\x20/\x20','footer','Arial','num','Setting','find','split','splitSizePdf','then','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','createPdfFromHTML','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b21,0x19f));var _0x17b2=function(_0x552711,_0x376342){_0x552711=_0x552711-0x0;var _0x379f53=_0x7b21[_0x552711];return _0x379f53;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x17b2('0x0'));var path=require(_0x17b2('0x1'));var moment=require(_0x17b2('0x2'));var htmlToPdfmake=require(_0x17b2('0x3'));var PdfPrinter=require(_0x17b2('0x4'));var zipdir=require(_0x17b2('0x5'));var rimraf=require(_0x17b2('0x6'));var JSDOM=require(_0x17b2('0x7'))['JSDOM'];var window=new JSDOM('')[_0x17b2('0x8')];var BPromise=require('bluebird');var db=require(_0x17b2('0x9'))['db'];var dbH=require(_0x17b2('0x9'))[_0x17b2('0xa')];var logger=require(_0x17b2('0xb'))(_0x17b2('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x17b2('0xd')][0x3];var PATH=process[_0x17b2('0xd')][0x4];var NAME=process[_0x17b2('0xd')][0x5];var FORMAT=_0x17b2('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a107b,_0x3b45c9){var _0x5af14c={'status':_0x1a107b};var _0x2a0b9b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b45c9){_0x5af14c[_0x17b2('0xf')]=_0x3b45c9;}return db[_0x17b2('0x10')][_0x17b2('0x11')](_0x5af14c,_0x2a0b9b);}function getHeaders(_0x527e12){return _[_0x17b2('0x12')](_0x527e12,function(_0x2f6543){return{'text':_0x2f6543,'style':_0x17b2('0x13')};});}function getRows(_0x1b5709,_0x4ed225){return _[_0x17b2('0x12')](_0x4ed225,function(_0x14102d){return _(_0x14102d)[_0x17b2('0x14')](_0x1b5709)['map'](function(_0x3d1e2a){return _0x3d1e2a?_[_0x17b2('0x15')](_0x3d1e2a):'';})[_0x17b2('0x16')]();});}function createTable(_0x3d0b79,_0x1094fd){var _0x102a77={'widths':_['fill'](Array(_0x3d0b79[_0x17b2('0x17')]),0x91),'heights':function(_0x3dde7f){return _0x3dde7f===0x0?_0x17b2('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x23f966=getHeaders(_0x3d0b79);_0x102a77[_0x17b2('0x19')][_0x17b2('0x1a')](_0x23f966);var _0x3989b9=getRows(_0x3d0b79,_0x1094fd);_0x102a77[_0x17b2('0x19')]=_0x102a77['body'][_0x17b2('0x1b')](_0x3989b9);return _0x102a77;}function createTables(_0x17ba1d){var _0x45bb88=[];var _0x2003ed=_['chunk'](Object[_0x17b2('0x1c')](_0x17ba1d[0x0]),0x5);_0x2003ed[_0x17b2('0x1d')](function(_0x477cf1){_0x45bb88['push'](createTable(_0x477cf1,_0x17ba1d));});return _0x45bb88;}function getPDFDocDefinition(_0x5491cd){var _0x407ec2=util[_0x17b2('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x17b2('0x1f')],moment(EXTRACTED_REPORT[_0x17b2('0x20')])[_0x17b2('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x17b2('0x21')])[_0x17b2('0x1e')](FORMAT));var _0x205510=[];for(var _0x33083b=0x0;_0x33083b<_0x5491cd[_0x17b2('0x17')];_0x33083b++){var _0x2f24fa=[];if(_0x33083b===0x0){_0x2f24fa['push']({'text':_0x407ec2,'style':_0x17b2('0x22')});}var _0x581ae2={'table':_0x5491cd[_0x33083b]};if(_0x33083b>0x0){_0x581ae2['pageBreak']=_0x17b2('0x23');_0x581ae2[_0x17b2('0x24')]=[0x0,0x46,0x0,0x0];}_0x2f24fa[_0x17b2('0x1a')](_0x581ae2);_0x205510[_0x17b2('0x1a')](_0x2f24fa);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x205510,'footer':function(_0x59b4d0,_0x1f8cc0){return{'text':_0x59b4d0[_0x17b2('0x15')]()+_0x17b2('0x25')+_0x1f8cc0,'style':_0x17b2('0x26')};},'defaultStyle':{'font':_0x17b2('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x29e333){var _0x5e8a5d=0x1388;var _0x4f95a6;if(!_0x29e333[0x0][_0x17b2('0x28')]){return analyticExtractedReport('Empty');}return db[_0x17b2('0x29')][_0x17b2('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x17b2('0x2b'),_0x17b2('0x2c')]})[_0x17b2('0x2d')](function(_0x208e74){if(_0x208e74){_0x4f95a6=_0x208e74;_0x5e8a5d=_0x4f95a6[_0x17b2('0x2c')]||0x3e8;}})['then'](function(){var _0x27308a=[];var _0x9322ad=0x0;if(_0x4f95a6[_0x17b2('0x2b')]){if(_0x29e333&&_0x29e333[_0x17b2('0x17')]){var _0x19a137=_['range'](_0x29e333[0x0][_0x17b2('0x28')]/_0x5e8a5d);var _0x313dc9=Number[_0x17b2('0x2e')](_0x29e333[0x0][_0x17b2('0x28')]/_0x5e8a5d)?_0x29e333[0x0][_0x17b2('0x28')]%_0x5e8a5d:0x0;_0x19a137['forEach'](function(_0x1913aa){if(_0x1913aa>0x0){_0x9322ad+=_0x5e8a5d;}_0x27308a[_0x17b2('0x1a')](dbH['sequelize'][_0x17b2('0x2f')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5e8a5d,_0x9322ad),{'type':dbH[_0x17b2('0x30')][_0x17b2('0x31')][_0x17b2('0x32')]}));});if(_0x313dc9>0x0){_0x9322ad+=_0x5e8a5d;_0x27308a['push'](dbH['sequelize'][_0x17b2('0x2f')](util[_0x17b2('0x1e')](_0x17b2('0x33'),QUERY,_0x313dc9,_0x9322ad),{'type':dbH['sequelize'][_0x17b2('0x31')][_0x17b2('0x32')]}));}}}else{_0x27308a['push'](dbH[_0x17b2('0x30')][_0x17b2('0x2f')](QUERY,{'type':dbH[_0x17b2('0x30')][_0x17b2('0x31')]['SELECT']}));}var _0x5e8540=path['dirname'](PATH);var _0x4fe7a6=path[_0x17b2('0x34')](PATH,_0x17b2('0x35'));var _0x3b37d1=_0x4f95a6[_0x17b2('0x2b')]&&_0x27308a[_0x17b2('0x17')]>0x1;var _0xee9542=[];if(!fs[_0x17b2('0x36')](path[_0x17b2('0x37')](_0x5e8540,_0x4fe7a6))&&_0x3b37d1){fs[_0x17b2('0x38')](path[_0x17b2('0x37')](_0x5e8540,_0x4fe7a6));}return BPromise[_0x17b2('0x39')](_0x27308a,function(_0x1e236d){_0xee9542['push'](_0x1e236d);})[_0x17b2('0x2d')](function(){var _0x3f26f1=[];for(var _0x502aa5=0x0;_0x502aa5<_0xee9542[_0x17b2('0x17')];_0x502aa5+=0x1){var _0xe7899f=_0xee9542[_0x502aa5];var _0x845716=createTables(_[_0x17b2('0x3a')](_0xe7899f));var _0x1038e5;var _0x303797=getPDFDocDefinition(_0x845716);var _0xeb76e5=getPDFPrinter();var _0x16d778=_0xeb76e5[_0x17b2('0x3b')](_0x303797);if(_0x3b37d1){_0x1038e5=path[_0x17b2('0x37')](_0x5e8540,_0x4fe7a6,util[_0x17b2('0x1e')]('%s%d.%s',_0x4fe7a6,_0x502aa5,_0x17b2('0x3c')));}else{_0x1038e5=path[_0x17b2('0x37')](_0x5e8540,util[_0x17b2('0x1e')]('%s.%s',_0x4fe7a6,_0x17b2('0x3c')));}_0x3f26f1['push'](writePDFDocument(_0x16d778,_0x1038e5));}return Promise['all'](_0x3f26f1);})[_0x17b2('0x2d')](function(){if(_0x3b37d1){return new Promise(function(_0x5b5ed4){zipdir(path['join'](_0x5e8540,_0x4fe7a6),{'saveTo':path[_0x17b2('0x37')](_0x5e8540,util['format'](_0x17b2('0x3d'),_0x4fe7a6,_0x17b2('0x3e')))},function(){rimraf(path[_0x17b2('0x37')](_0x5e8540,_0x4fe7a6),function(){});_0x5b5ed4(_0x17b2('0x3f'));});});}})[_0x17b2('0x2d')](function(){if(!_0x3b37d1)return;rimraf(path[_0x17b2('0x37')](_0x5e8540,_0x4fe7a6),function(){});})[_0x17b2('0x2d')](function(){logger[_0x17b2('0x40')](util[_0x17b2('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x17b2('0x41')));return analyticExtractedReport(_0x17b2('0x42'),_0x3b37d1?util['format']('%s.%s',_0x4fe7a6,_0x3b37d1?_0x17b2('0x3e'):_0x17b2('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x17b2('0x40')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x17b2('0x2d')](function(_0x3a64b0){EXTRACTED_REPORT=_0x3a64b0;return dbH[_0x17b2('0x30')]['query'](util[_0x17b2('0x1e')](_0x17b2('0x43'),QUERY),{'type':dbH[_0x17b2('0x30')][_0x17b2('0x31')][_0x17b2('0x32')]});})[_0x17b2('0x2d')](extractReport)[_0x17b2('0x44')](function(_0x317686){logger[_0x17b2('0x40')](util[_0x17b2('0x1e')](_0x17b2('0x45'),EXTRACTED_REPORT_ID,_0x17b2('0x41')),util['inspect'](_0x317686,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17b2('0x46'));})[_0x17b2('0x47')](function(){process[_0x17b2('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xfb43f8=new PdfPrinter({'Arial':{'normal':__dirname+_0x17b2('0x49'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x17b2('0x4a'),'bolditalics':__dirname+_0x17b2('0x4b')}});return _0xfb43f8;}function getPDFDocDefinitionFromHTML(_0x4856fa,_0x59bccf){var _0xeb1047=util[_0x17b2('0x1e')](_0x17b2('0x4c'),_0x59bccf[_0x17b2('0x4d')],_0x59bccf[_0x17b2('0x4e')]);var _0x30b908=moment()['format'](_0x17b2('0x4f'))['toString']();var _0xdab2c3=htmlToPdfmake(_0x4856fa,{'window':window,'tableAutoSize':!![]});return{'content':[_0xdab2c3],'defaultStyle':{'font':_0x17b2('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x17b2('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x17b2('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x17b2('0x50')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x4d6a90,_0x59ae1d){return[{'text':util[_0x17b2('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xeb1047,_0x4d6a90,_0x59ae1d,_0x30b908),'style':'footer'}];}};}function writePDFDocument(_0x37c244,_0x3d8095){return new Promise(function(_0xc4baf,_0x24c9dd){var _0x17b424=_0x37c244[_0x17b2('0x51')](fs[_0x17b2('0x52')](_0x3d8095));_0x17b424['on'](_0x17b2('0x53'),function(){_0xc4baf(_0x17b2('0x53'));});_0x17b424['on'](_0x17b2('0x54'),function(_0xce0148){_0x24c9dd(_0xce0148);});_0x37c244['end']();});}exports[_0x17b2('0x55')]=function(_0x52fe39,_0x2167c0){var _0x476624=getPDFPrinter();var _0x16e0f4=getPDFDocDefinitionFromHTML(_0x52fe39,_0x2167c0);var _0x3dc083=_0x476624['createPdfKitDocument'](_0x16e0f4);return writePDFDocument(_0x3dc083,_0x2167c0[_0x17b2('0x1')])['catch'](function(_0x56e13b){throw _0x56e13b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index cf8527a..e00ce66 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 _0x3ffd=['dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','range','num','isInteger','forEach','push','sequelize','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','../../mysqldb'];(function(_0x204b2d,_0x4b4175){var _0x8da4bf=function(_0x491736){while(--_0x491736){_0x204b2d['push'](_0x204b2d['shift']());}};_0x8da4bf(++_0x4b4175);}(_0x3ffd,0x84));var _0xd3ff=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x3ffd[_0x130705];return _0x1fa991;};'use strict';var util=require(_0xd3ff('0x0'));var path=require('path');var _=require(_0xd3ff('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xd3ff('0x2'))[_0xd3ff('0x3')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd3ff('0x4')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd3ff('0x4')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e3d71,_0x243062){var _0x56dad7={'status':_0x4e3d71};var _0x6370fc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x243062){_0x56dad7[_0xd3ff('0x5')]=_0x243062;}return db[_0xd3ff('0x6')][_0xd3ff('0x7')](_0x56dad7,_0x6370fc);}function main(){var _0x55b1a6=0x1388;var _0x13c298;logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xd3ff('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd3ff('0xc'),_0xd3ff('0xd')]})[_0xd3ff('0xe')](function(_0x56e8b4){if(_0x56e8b4){_0x13c298=_0x56e8b4;_0x55b1a6=_0x13c298[_0xd3ff('0xd')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xd3ff('0xf')](util[_0xd3ff('0x9')](_0xd3ff('0x10'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xd3ff('0x11')]});})[_0xd3ff('0xe')](function(_0x3a55f4){if(!_0x3a55f4[0x0]['num']){return analyticExtractedReport(_0xd3ff('0x12'));}var _0x31f439=[];var _0x4d3eee=0x0;if(_0x13c298['split']){if(_0x3a55f4&&_0x3a55f4['length']){var _0x588e17=_[_0xd3ff('0x13')](_0x3a55f4[0x0][_0xd3ff('0x14')]/_0x55b1a6);var _0x49b2e4=Number[_0xd3ff('0x15')](_0x3a55f4[0x0]['num']/_0x55b1a6)?_0x3a55f4[0x0]['num']%_0x55b1a6:0x0;_0x588e17[_0xd3ff('0x16')](function(_0x4e8f8e){if(_0x4e8f8e>0x0){_0x4d3eee+=_0x55b1a6;}_0x31f439[_0xd3ff('0x17')](dbH[_0xd3ff('0x18')]['query'](util[_0xd3ff('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55b1a6,_0x4d3eee),{'type':dbH['sequelize']['QueryTypes'][_0xd3ff('0x11')]}));});if(_0x49b2e4>0x0){_0x4d3eee+=_0x55b1a6;_0x31f439[_0xd3ff('0x17')](dbH['sequelize']['query'](util[_0xd3ff('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x49b2e4,_0x4d3eee),{'type':dbH[_0xd3ff('0x18')][_0xd3ff('0x19')][_0xd3ff('0x11')]}));}}}else{_0x31f439[_0xd3ff('0x17')](dbH[_0xd3ff('0x18')][_0xd3ff('0xf')](QUERY,{'type':dbH[_0xd3ff('0x18')]['QueryTypes'][_0xd3ff('0x11')]}));}var _0x45e3a0=path[_0xd3ff('0x1a')](PATH);var _0xd6fdfb=path[_0xd3ff('0x1b')](PATH,'.xlsx');var _0x56fdb9=_0x13c298['split']&&_0x31f439['length']>0x1;var _0x117c6a=[];if(!fs[_0xd3ff('0x1c')](path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb))&&_0x56fdb9){fs[_0xd3ff('0x1e')](path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb));}return BPromise[_0xd3ff('0x1f')](_0x31f439,function(_0xd6ba1b){_0x117c6a[_0xd3ff('0x17')](_0xd6ba1b);})['then'](function(){for(var _0x24c5f8=0x0;_0x24c5f8<_0x117c6a[_0xd3ff('0x20')];_0x24c5f8+=0x1){var _0x3e2b70;var _0x1a4d92=_0x117c6a[_0x24c5f8];if(_0x56fdb9){_0x3e2b70=path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb,util[_0xd3ff('0x9')](_0xd3ff('0x21'),_0xd6fdfb,_0x24c5f8,'xlsx'));}else{_0x3e2b70=path[_0xd3ff('0x1d')](_0x45e3a0,util[_0xd3ff('0x9')](_0xd3ff('0x22'),_0xd6fdfb,_0xd3ff('0x23')));}fs[_0xd3ff('0x24')](_0x3e2b70,json2xls(_0x1a4d92),_0xd3ff('0x25'));}})[_0xd3ff('0xe')](function(){if(_0x56fdb9){return new Promise(function(_0x402242){zipdir(path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb),{'saveTo':path['join'](_0x45e3a0,util[_0xd3ff('0x9')](_0xd3ff('0x22'),_0xd6fdfb,_0xd3ff('0x26')))},function(_0x3475ab,_0x1beec3){rimraf(path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb),function(){});_0x402242('zip\x20finished');});});}})[_0xd3ff('0xe')](function(){logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0x27'),EXTRACTED_REPORT_ID,_0xd3ff('0x28')));return analyticExtractedReport('Completed',_0x56fdb9?util[_0xd3ff('0x9')]('%s.%s',_0xd6fdfb,_0x56fdb9?_0xd3ff('0x26'):_0xd3ff('0x23')):null);});})['catch'](function(_0x214e29){logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0x29'),EXTRACTED_REPORT_ID,_0xd3ff('0x28')),util[_0xd3ff('0x2a')](_0x214e29,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd3ff('0x2b')](function(){process[_0xd3ff('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3e49=['existsSync','join','each','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.xlsx','length'];(function(_0xc8f777,_0xe9e88f){var _0x28bce1=function(_0x3d4da5){while(--_0x3d4da5){_0xc8f777['push'](_0xc8f777['shift']());}};_0x28bce1(++_0xe9e88f);}(_0x3e49,0xfb));var _0x93e4=function(_0x5cbf7b,_0x34e24b){_0x5cbf7b=_0x5cbf7b-0x0;var _0xc91356=_0x3e49[_0x5cbf7b];return _0xc91356;};'use strict';var util=require(_0x93e4('0x0'));var path=require(_0x93e4('0x1'));var _=require(_0x93e4('0x2'));var fs=require('fs');var json2xls=require(_0x93e4('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x93e4('0x4'));var rimraf=require(_0x93e4('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x93e4('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x93e4('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x93e4('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x438831,_0x33390d){var _0x195909={'status':_0x438831};var _0x206a64={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33390d){_0x195909[_0x93e4('0x8')]=_0x33390d;}return db[_0x93e4('0x9')]['update'](_0x195909,_0x206a64);}function main(){var _0x113d53=0x1388;var _0x53a943;logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0xc'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return db[_0x93e4('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x93e4('0xf'),_0x93e4('0x10')]})[_0x93e4('0x11')](function(_0x4d5d66){if(_0x4d5d66){_0x53a943=_0x4d5d66;_0x113d53=_0x53a943[_0x93e4('0x10')]||0x1388;}})[_0x93e4('0x11')](function(){return dbH['sequelize'][_0x93e4('0x12')](util[_0x93e4('0xb')](_0x93e4('0x13'),QUERY),{'type':dbH[_0x93e4('0x14')]['QueryTypes'][_0x93e4('0x15')]});})['then'](function(_0x4ba240){if(!_0x4ba240[0x0][_0x93e4('0x16')]){return analyticExtractedReport(_0x93e4('0x17'));}var _0x5b1a67=[];var _0x123da8=0x0;if(_0x53a943[_0x93e4('0xf')]){if(_0x4ba240&&_0x4ba240['length']){var _0xc5ce72=_[_0x93e4('0x18')](_0x4ba240[0x0]['num']/_0x113d53);var _0x238091=Number['isInteger'](_0x4ba240[0x0][_0x93e4('0x16')]/_0x113d53)?_0x4ba240[0x0][_0x93e4('0x16')]%_0x113d53:0x0;_0xc5ce72['forEach'](function(_0x3dfb94){if(_0x3dfb94>0x0){_0x123da8+=_0x113d53;}_0x5b1a67[_0x93e4('0x19')](dbH[_0x93e4('0x14')][_0x93e4('0x12')](util[_0x93e4('0xb')](_0x93e4('0x1a'),QUERY,_0x113d53,_0x123da8),{'type':dbH['sequelize']['QueryTypes'][_0x93e4('0x15')]}));});if(_0x238091>0x0){_0x123da8+=_0x113d53;_0x5b1a67[_0x93e4('0x19')](dbH[_0x93e4('0x14')]['query'](util['format'](_0x93e4('0x1a'),QUERY,_0x238091,_0x123da8),{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}}}else{_0x5b1a67[_0x93e4('0x19')](dbH[_0x93e4('0x14')][_0x93e4('0x12')](QUERY,{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}var _0x2bca42=path['dirname'](PATH);var _0xd3559e=path[_0x93e4('0x1c')](PATH,_0x93e4('0x1d'));var _0x2f259b=_0x53a943[_0x93e4('0xf')]&&_0x5b1a67[_0x93e4('0x1e')]>0x1;var _0x3761c9=[];if(!fs[_0x93e4('0x1f')](path[_0x93e4('0x20')](_0x2bca42,_0xd3559e))&&_0x2f259b){fs['mkdirSync'](path[_0x93e4('0x20')](_0x2bca42,_0xd3559e));}return BPromise[_0x93e4('0x21')](_0x5b1a67,function(_0x5ede08){_0x3761c9[_0x93e4('0x19')](_0x5ede08);})[_0x93e4('0x11')](function(){for(var _0x11055b=0x0;_0x11055b<_0x3761c9['length'];_0x11055b+=0x1){var _0x3b7701;var _0x1e88b9=_0x3761c9[_0x11055b];if(_0x2f259b){_0x3b7701=path[_0x93e4('0x20')](_0x2bca42,_0xd3559e,util['format']('%s%d.%s',_0xd3559e,_0x11055b,'xlsx'));}else{_0x3b7701=path[_0x93e4('0x20')](_0x2bca42,util[_0x93e4('0xb')](_0x93e4('0x22'),_0xd3559e,_0x93e4('0x23')));}fs[_0x93e4('0x24')](_0x3b7701,json2xls(_0x1e88b9),_0x93e4('0x25'));}})[_0x93e4('0x11')](function(){if(_0x2f259b){return new Promise(function(_0x1cc33a){zipdir(path['join'](_0x2bca42,_0xd3559e),{'saveTo':path[_0x93e4('0x20')](_0x2bca42,util[_0x93e4('0xb')]('%s.%s',_0xd3559e,_0x93e4('0x26')))},function(_0x5af911,_0x173746){rimraf(path['join'](_0x2bca42,_0xd3559e),function(){});_0x1cc33a(_0x93e4('0x27'));});});}})[_0x93e4('0x11')](function(){logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0x28'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return analyticExtractedReport(_0x93e4('0x29'),_0x2f259b?util['format']('%s.%s',_0xd3559e,_0x2f259b?_0x93e4('0x26'):_0x93e4('0x23')):null);});})['catch'](function(_0x3e912d){logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0x2a'),EXTRACTED_REPORT_ID,_0x93e4('0xd')),util[_0x93e4('0x2b')](_0x3e912d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x93e4('0x2c'));})[_0x93e4('0x2d')](function(){process[_0x93e4('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 95ef0a3..4fc0e71 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 _0x89d6=['filter','groupBy','queue','playback','extensions','extension','push','type','format','context','priority','VoiceExtensionId','inbound','Set','outbound','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','*,*,*,*','hasOwnProperty','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','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','exten'];(function(_0x146e9d,_0x2bcc8d){var _0x2f0870=function(_0x4c2fb6){while(--_0x4c2fb6){_0x146e9d['push'](_0x146e9d['shift']());}};_0x2f0870(++_0x2bcc8d);}(_0x89d6,0x1d8));var _0x689d=function(_0x229669,_0x809f6d){_0x229669=_0x229669-0x0;var _0x1366d2=_0x89d6[_0x229669];return _0x1366d2;};'use strict';var _=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));function rewrite(_0x59f82e,_0x387703){var _0x839bee=this;return _0x59f82e[_0x689d('0x2')][_0x689d('0x3')]['findAll']({'raw':!![]})[_0x689d('0x4')](function(_0x158dce){_0x839bee['intervals']=_0x158dce;return _0x59f82e['models'][_0x689d('0x5')][_0x689d('0x6')]({'where':{'IntervalId':_0x387703[_0x689d('0x7')]},'raw':!![]});})[_0x689d('0x4')](function(_0xd593c6){return _0x59f82e[_0x689d('0x2')][_0x689d('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x689d('0x8')](_[_0x689d('0x9')](_0xd593c6,_0x689d('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x689d('0x4')](function(_0x5674b9){var _0x3ae9c6=_['filter'](_0x5674b9,{'priority':'1'});var _0x1e2ff1=_[_0x689d('0xb')](_0x5674b9,{'isApp':0x1});var _0x5bf392=_[_0x689d('0xc')](_0x1e2ff1,_0x689d('0xa'));var _0x38645e=[_0x689d('0xd'),_0x689d('0xe')];var _0x3984bd=[];var _0x5789d5=[];for(var _0x34903e in _0x5bf392){if(_0x5bf392['hasOwnProperty'](_0x34903e)){_0x839bee['priority']=0x2;_0x839bee[_0x689d('0xf')]=[];_0x839bee[_0x689d('0x10')]=_['find'](_0x3ae9c6,{'exten':_0x5bf392[_0x34903e][0x0]['exten']});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':util[_0x689d('0x13')]('CDR(type)=%s',_0x5bf392[_0x34903e][0x0]['type']),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x5bf392[_0x34903e][0x0][_0x689d('0x12')]===_0x689d('0x17')){_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':'CDR(routeid)='+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}else if(_0x5bf392[_0x34903e][0x0][_0x689d('0x12')]===_0x689d('0x19')){if(_0x839bee[_0x689d('0x10')]){_0x839bee['extensions'][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x1a')+(_0x839bee[_0x689d('0x10')][_0x689d('0x1b')]?'${EXTEN:'+_0x839bee['extension'][_0x689d('0x1b')]+'}':'${EXTEN}'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x1c')+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});var _0x5ed847=_0x839bee['priority']++;_0x839bee['extensions'][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x1e')+(_0x5ed847+0x2)+_0x689d('0x1f')+(_0x5ed847+0x1)+')','context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x5ed847,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x839bee[_0x689d('0x10')]){_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x839bee[_0x689d('0x10')][_0x689d('0x1b')]?_0x689d('0x20')+_0x839bee['extension']['cutdigits']+'}':_0x689d('0x21'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x22')+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x839bee[_0x689d('0x10')]&&_0x839bee[_0x689d('0x10')]['hasOwnProperty'](_0x689d('0x23'))&&_0x839bee['extension'][_0x689d('0x23')]!==_0x689d('0x24')){_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x25'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0]['exten'],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x839bee[_0x689d('0x10')][_0x689d('0x23')]||_0x689d('0x26'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0]['exten'],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}}_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x27'),'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':_0x689d('0x28'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0]['VoiceExtensionId']});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':_0x689d('0x29'),'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});for(var _0x2d913e=0x0,_0x179aeb=0x0;_0x2d913e<_0x5bf392[_0x34903e][_0x689d('0x2a')];_0x2d913e+=0x1,_0x179aeb=0x0){var _0x310fe3=_0x5bf392[_0x34903e][_0x2d913e];if(_0x310fe3['type']){_0x310fe3[_0x689d('0x12')]=_0x310fe3[_0x689d('0x12')][_0x689d('0x2b')]();}var _0x15e9e1=[];var _0x59b852=[];delete _0x310fe3['id'];delete _0x310fe3['createdAt'];delete _0x310fe3['updatedAt'];var _0x4bb3f2=_0x310fe3[_0x689d('0x2c')]!==_0x689d('0x2d')?[_0x310fe3['interval']]:_0x310fe3[_0x689d('0x7')]?_[_0x689d('0x9')](_[_0x689d('0xb')](_0x839bee['intervals'],{'IntervalId':_0x310fe3[_0x689d('0x7')]}),_0x689d('0x2c')):[];if(_0x310fe3[_0x689d('0x2e')](_0x689d('0x2f'))){if(_0x310fe3[_0x689d('0x2f')]&&_0x310fe3['tag']!=='--'){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':_0x689d('0x18'),'appdata':'CDR(tag)='+_0x310fe3[_0x689d('0x2f')],'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3['VoiceExtensionId']});}}if(_0x310fe3[_0x689d('0x12')]===_0x689d('0x19')&&_0x310fe3[_0x689d('0x2e')](_0x689d('0x30'))){if(_0x310fe3[_0x689d('0x30')]){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x31')+_0x310fe3[_0x689d('0x30')]+')','context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3['VoiceExtensionId']});}else{_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x32'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}}if(_0x310fe3[_0x689d('0x2e')](_0x689d('0x33'))){if(_0x38645e[_0x689d('0x34')](_0x310fe3[_0x689d('0x35')][_0x689d('0x2b')]())>=0x0&&_0x310fe3[_0x689d('0x36')]!==_0x689d('0x37')){if(_0x310fe3['answer']){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':'ExecIf','appdata':_0x689d('0x38'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2['length']+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':'Set','appdata':_0x689d('0x39'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}else{_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':_0x689d('0x1d'),'appdata':_0x689d('0x3a'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x3b'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}}}for(var _0x630a20=0x0;_0x630a20<_0x4bb3f2[_0x689d('0x2a')];_0x630a20+=0x1){var _0x4768e5=_0x839bee[_0x689d('0x15')]+_0x4bb3f2[_0x689d('0x2a')];var _0x4c44a3=_0x630a20===_0x4bb3f2[_0x689d('0x2a')]-0x1?_0x839bee[_0x689d('0x15')]+_0x15e9e1['length']+_0x59b852[_0x689d('0x2a')]+0x2:_0x839bee['priority']+_0x630a20+0x1;_0x15e9e1[_0x689d('0x3c')](_0x630a20,0x0,{'type':_0x310fe3[_0x689d('0x12')],'app':'GotoIfTime','appdata':_0x4bb3f2[_0x630a20]+'?'+_0x310fe3[_0x689d('0x14')]+_0x689d('0x3d')+_0x4768e5+':'+_0x310fe3[_0x689d('0x14')]+_0x689d('0x3d')+_0x4c44a3,'exten':_0x310fe3[_0x689d('0xa')],'context':_0x310fe3['context'],'priority':_0x839bee['priority']+_0x630a20,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0]['VoiceExtensionId']});}_0x310fe3[_0x689d('0x15')]=_0x15e9e1[_0x689d('0x2a')]?_['last'](_0x15e9e1)['priority']+0x1:_0x839bee['priority'];_0x839bee[_0x689d('0x15')]=(_0x59b852[_0x689d('0x2a')]?_[_0x689d('0x3e')](_0x59b852)[_0x689d('0x15')]:_0x310fe3['priority'])+0x1;_0x839bee[_0x689d('0xf')]=_['concat'](_0x839bee['extensions'],_0x15e9e1,[_0x310fe3],_0x59b852);}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Hangup','exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'priority':_0x839bee['priority'],'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x3984bd[_0x689d('0x11')](_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]);_0x5789d5=_['concat'](_0x5789d5,_0x839bee[_0x689d('0xf')]);}}return _0x59f82e[_0x689d('0x3f')](function(_0x3d6182){return _0x59f82e[_0x689d('0x2')][_0x689d('0x5')][_0x689d('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3984bd}},'transaction':_0x3d6182})[_0x689d('0x4')](function(_0x23765a){return _0x59f82e['models']['VoiceExtension'][_0x689d('0x41')](_[_0x689d('0x42')](_0x5789d5,'priority'),{'transaction':_0x3d6182});});});})[_0x689d('0x43')](function(_0x6bdf1a){console[_0x689d('0x44')](_0x6bdf1a);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xab83=['none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','*,*,*,*','interval','map','tag','CDR(tag)=','outbound','hasOwnProperty','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','exten','filter','groupBy','queue','playback','priority','extensions','extension','find','Set','CDR(type)=%s','type','inbound','push','CDR(routeid)=','context','CDR(destination)=','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xab83,0x17e));var _0x3ab8=function(_0x3cb5a7,_0x3849cd){_0x3cb5a7=_0x3cb5a7-0x0;var _0xb9ef8=_0xab83[_0x3cb5a7];return _0xb9ef8;};'use strict';var _=require(_0x3ab8('0x0'));var util=require(_0x3ab8('0x1'));function rewrite(_0x557126,_0x2ae060){var _0x202c98=this;return _0x557126[_0x3ab8('0x2')][_0x3ab8('0x3')][_0x3ab8('0x4')]({'raw':!![]})[_0x3ab8('0x5')](function(_0x5cfb96){_0x202c98[_0x3ab8('0x6')]=_0x5cfb96;return _0x557126[_0x3ab8('0x2')][_0x3ab8('0x7')][_0x3ab8('0x4')]({'where':{'IntervalId':_0x2ae060[_0x3ab8('0x8')]},'raw':!![]});})[_0x3ab8('0x5')](function(_0x1da0fa){return _0x557126[_0x3ab8('0x2')][_0x3ab8('0x7')][_0x3ab8('0x4')]({'where':{'exten':{'$in':_[_0x3ab8('0x9')](_['map'](_0x1da0fa,_0x3ab8('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x3ab8('0x5')](function(_0x157b99){var _0x2f6f02=_['filter'](_0x157b99,{'priority':'1'});var _0x2c8a6f=_[_0x3ab8('0xb')](_0x157b99,{'isApp':0x1});var _0x5c22fa=_[_0x3ab8('0xc')](_0x2c8a6f,'exten');var _0x56086a=[_0x3ab8('0xd'),_0x3ab8('0xe')];var _0x997481=[];var _0x1865a9=[];for(var _0x143bc2 in _0x5c22fa){if(_0x5c22fa['hasOwnProperty'](_0x143bc2)){_0x202c98[_0x3ab8('0xf')]=0x2;_0x202c98[_0x3ab8('0x10')]=[];_0x202c98[_0x3ab8('0x11')]=_[_0x3ab8('0x12')](_0x2f6f02,{'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')]});_0x202c98[_0x3ab8('0x10')]['push']({'type':_0x5c22fa[_0x143bc2][0x0]['type'],'app':_0x3ab8('0x13'),'appdata':util['format'](_0x3ab8('0x14'),_0x5c22fa[_0x143bc2][0x0]['type']),'context':_0x5c22fa[_0x143bc2][0x0]['context'],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId']});if(_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')]===_0x3ab8('0x16')){_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x18')+_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId'],'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0]['exten'],'priority':_0x202c98['priority']++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId']});}else if(_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')]==='outbound'){if(_0x202c98[_0x3ab8('0x11')]){_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x1a')+(_0x202c98['extension']['cutdigits']?_0x3ab8('0x1b')+_0x202c98['extension']['cutdigits']+'}':_0x3ab8('0x1c')),'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});}_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0]['type'],'app':_0x3ab8('0x13'),'appdata':'CDR(routeid)='+_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')],'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0]['exten'],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});var _0x3d835d=_0x202c98[_0x3ab8('0xf')]++;_0x202c98['extensions'][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x1e'),'appdata':_0x3ab8('0x1f')+(_0x3d835d+0x2)+_0x3ab8('0x20')+(_0x3d835d+0x1)+')','context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0]['exten'],'priority':_0x3d835d,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});if(_0x202c98[_0x3ab8('0x11')]){_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x202c98['extension'][_0x3ab8('0x21')]?_0x3ab8('0x22')+_0x202c98[_0x3ab8('0x11')][_0x3ab8('0x21')]+'}':_0x3ab8('0x23'),'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId']});}_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':'Set','appdata':_0x3ab8('0x24')+_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')],'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});if(_0x202c98[_0x3ab8('0x11')]&&_0x202c98[_0x3ab8('0x11')]['hasOwnProperty'](_0x3ab8('0x25'))&&_0x202c98[_0x3ab8('0x11')][_0x3ab8('0x25')]!==_0x3ab8('0x26')){_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0]['type'],'app':_0x3ab8('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5c22fa[_0x143bc2][0x0]['context'],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0]['type'],'app':_0x3ab8('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x202c98[_0x3ab8('0x11')][_0x3ab8('0x25')]||_0x3ab8('0x27'),'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98['priority']++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});}}_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x28'),'context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0]['exten'],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x29'),'context':_0x5c22fa[_0x143bc2][0x0]['context'],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId']});_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x19')],'exten':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0xa')],'priority':_0x202c98[_0x3ab8('0xf')]++,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});for(var _0x373bb4=0x0,_0x49d6cd=0x0;_0x373bb4<_0x5c22fa[_0x143bc2][_0x3ab8('0x2a')];_0x373bb4+=0x1,_0x49d6cd=0x0){var _0x2628db=_0x5c22fa[_0x143bc2][_0x373bb4];if(_0x2628db[_0x3ab8('0x15')]){_0x2628db[_0x3ab8('0x15')]=_0x2628db[_0x3ab8('0x15')]['toLowerCase']();}var _0x5be038=[];var _0x13f463=[];delete _0x2628db['id'];delete _0x2628db[_0x3ab8('0x2b')];delete _0x2628db['updatedAt'];var _0x207ec0=_0x2628db['interval']!==_0x3ab8('0x2c')?[_0x2628db[_0x3ab8('0x2d')]]:_0x2628db['IntervalId']?_[_0x3ab8('0x2e')](_[_0x3ab8('0xb')](_0x202c98['intervals'],{'IntervalId':_0x2628db[_0x3ab8('0x8')]}),_0x3ab8('0x2d')):[];if(_0x2628db['hasOwnProperty'](_0x3ab8('0x2f'))){if(_0x2628db['tag']&&_0x2628db[_0x3ab8('0x2f')]!=='--'){_0x5be038[_0x3ab8('0x17')]({'type':_0x2628db['type'],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x30')+_0x2628db[_0x3ab8('0x2f')],'context':_0x2628db[_0x3ab8('0x19')],'exten':_0x2628db[_0x3ab8('0xa')],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});}}if(_0x2628db['type']===_0x3ab8('0x31')&&_0x2628db[_0x3ab8('0x32')]('callerID')){if(_0x2628db[_0x3ab8('0x33')]){_0x5be038['push']({'type':_0x2628db[_0x3ab8('0x15')],'app':_0x3ab8('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2628db[_0x3ab8('0x33')]+')','context':_0x2628db[_0x3ab8('0x19')],'exten':_0x2628db[_0x3ab8('0xa')],'priority':_0x207ec0['length']+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db['VoiceExtensionId']});}else{_0x5be038[_0x3ab8('0x17')]({'type':_0x2628db[_0x3ab8('0x15')],'app':'ExecIf','appdata':_0x3ab8('0x34'),'context':_0x2628db['context'],'exten':_0x2628db[_0x3ab8('0xa')],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});}}if(_0x2628db[_0x3ab8('0x32')](_0x3ab8('0x35'))){if(_0x56086a[_0x3ab8('0x36')](_0x2628db[_0x3ab8('0x37')]['toLowerCase']())>=0x0&&_0x2628db[_0x3ab8('0x38')]!==_0x3ab8('0x39')){if(_0x2628db[_0x3ab8('0x35')]){_0x5be038[_0x3ab8('0x17')]({'type':_0x2628db['type'],'app':_0x3ab8('0x1e'),'appdata':_0x3ab8('0x3a'),'context':_0x2628db['context'],'exten':_0x2628db[_0x3ab8('0xa')],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});_0x5be038['push']({'type':_0x2628db[_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2628db[_0x3ab8('0x19')],'exten':_0x2628db['exten'],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});}else{_0x5be038['push']({'type':_0x2628db[_0x3ab8('0x15')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2628db[_0x3ab8('0x19')],'exten':_0x2628db['exten'],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});_0x5be038[_0x3ab8('0x17')]({'type':_0x2628db[_0x3ab8('0x15')],'app':_0x3ab8('0x13'),'appdata':_0x3ab8('0x3b'),'context':_0x2628db[_0x3ab8('0x19')],'exten':_0x2628db[_0x3ab8('0xa')],'priority':_0x207ec0[_0x3ab8('0x2a')]+_0x202c98[_0x3ab8('0xf')]+_0x49d6cd++,'VoiceExtensionId':_0x2628db[_0x3ab8('0x1d')]});}}}for(var _0xd563ac=0x0;_0xd563ac<_0x207ec0['length'];_0xd563ac+=0x1){var _0xfb38cc=_0x202c98[_0x3ab8('0xf')]+_0x207ec0[_0x3ab8('0x2a')];var _0x5c4c61=_0xd563ac===_0x207ec0[_0x3ab8('0x2a')]-0x1?_0x202c98[_0x3ab8('0xf')]+_0x5be038['length']+_0x13f463['length']+0x2:_0x202c98[_0x3ab8('0xf')]+_0xd563ac+0x1;_0x5be038[_0x3ab8('0x3c')](_0xd563ac,0x0,{'type':_0x2628db[_0x3ab8('0x15')],'app':'GotoIfTime','appdata':_0x207ec0[_0xd563ac]+'?'+_0x2628db[_0x3ab8('0x19')]+_0x3ab8('0x3d')+_0xfb38cc+':'+_0x2628db[_0x3ab8('0x19')]+_0x3ab8('0x3d')+_0x5c4c61,'exten':_0x2628db[_0x3ab8('0xa')],'context':_0x2628db[_0x3ab8('0x19')],'priority':_0x202c98[_0x3ab8('0xf')]+_0xd563ac,'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0]['VoiceExtensionId']});}_0x2628db['priority']=_0x5be038[_0x3ab8('0x2a')]?_[_0x3ab8('0x3e')](_0x5be038)[_0x3ab8('0xf')]+0x1:_0x202c98['priority'];_0x202c98[_0x3ab8('0xf')]=(_0x13f463[_0x3ab8('0x2a')]?_[_0x3ab8('0x3e')](_0x13f463)['priority']:_0x2628db[_0x3ab8('0xf')])+0x1;_0x202c98[_0x3ab8('0x10')]=_[_0x3ab8('0x3f')](_0x202c98[_0x3ab8('0x10')],_0x5be038,[_0x2628db],_0x13f463);}_0x202c98[_0x3ab8('0x10')][_0x3ab8('0x17')]({'type':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x15')],'app':_0x3ab8('0x40'),'exten':_0x5c22fa[_0x143bc2][0x0]['exten'],'context':_0x5c22fa[_0x143bc2][0x0]['context'],'priority':_0x202c98[_0x3ab8('0xf')],'VoiceExtensionId':_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]});_0x997481[_0x3ab8('0x17')](_0x5c22fa[_0x143bc2][0x0][_0x3ab8('0x1d')]);_0x1865a9=_[_0x3ab8('0x3f')](_0x1865a9,_0x202c98['extensions']);}}return _0x557126[_0x3ab8('0x41')](function(_0x46d262){return _0x557126[_0x3ab8('0x2')][_0x3ab8('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x997481}},'transaction':_0x46d262})[_0x3ab8('0x5')](function(_0x4a6828){return _0x557126[_0x3ab8('0x2')][_0x3ab8('0x7')][_0x3ab8('0x42')](_[_0x3ab8('0x43')](_0x1865a9,'priority'),{'transaction':_0x46d262});});});})[_0x3ab8('0x44')](function(_0x45d7ae){console['error'](_0x45d7ae);});}exports[_0x3ab8('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1c4ef61..26bd8d9 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 _0x9c77=['CmContact','create','keys','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','fromQuery','VoiceQueue','findAll','CmList','Lists','then','get','dialCheckDuplicateType','always','query','VoiceQueueId','sequelize','catch','all','Campaign','CampaignId','BlackLists','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','join','data','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0x9c77,0x187));var _0x79c7=function(_0x2cc604,_0x5c3480){_0x2cc604=_0x2cc604-0x0;var _0x1af9f9=_0x9c77[_0x2cc604];return _0x1af9f9;};'use strict';var BPromise=require('bluebird');var util=require(_0x79c7('0x0'));var _=require(_0x79c7('0x1'));var fs=require('fs');var squel=require(_0x79c7('0x2'));var Papa=require(_0x79c7('0x3'));var Redis=require('ioredis');var db=require(_0x79c7('0x4'))['db'];var config=require(_0x79c7('0x5'));var logger=require(_0x79c7('0x6'))(_0x79c7('0x7'));config[_0x79c7('0x8')]=_[_0x79c7('0x9')](config[_0x79c7('0x8')],{'host':_0x79c7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79c7('0x8')]));require(_0x79c7('0xb'))[_0x79c7('0xc')](socket);try{if(!process[_0x79c7('0xd')][0x2]||process[_0x79c7('0xd')][0x2]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x2]===_0x79c7('0xf')){throw new Error(_0x79c7('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x79c7('0xd')][0x3]||process[_0x79c7('0xd')][0x3]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x3]===_0x79c7('0xf')||!process[_0x79c7('0xd')][0x4]||process[_0x79c7('0xd')][0x4]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x4]===_0x79c7('0xf')){throw new Error(_0x79c7('0x11'));}var FIELDS=_[_0x79c7('0x12')](process[_0x79c7('0xd')][0x3][_0x79c7('0x13')](','),process[_0x79c7('0xd')][0x4]['split'](','));if(!process[_0x79c7('0xd')][0x5]||process[_0x79c7('0xd')][0x5]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x5]==='null'){throw new Error(_0x79c7('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x79c7('0xe')&&process['argv'][0x6]!==_0x79c7('0xf')?process[_0x79c7('0xd')][0x6]:null;var DUPLICATES=process[_0x79c7('0xd')][0x7]&&process[_0x79c7('0xd')][0x7]!==_0x79c7('0xe')&&process[_0x79c7('0xd')][0x7]!==_0x79c7('0xf')?process[_0x79c7('0xd')][0x7]:null;if(!process[_0x79c7('0xd')][0x8]||process[_0x79c7('0xd')][0x8]===_0x79c7('0xe')||process['argv'][0x8]===_0x79c7('0xf')){throw new Error(_0x79c7('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x52f42c){logger[_0x79c7('0x16')](_0x52f42c);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(_0x241fca,_0x1d7ae0,_0x540dad,_0x113471){var _0x5d48c4={'message':_0x1d7ae0};_0x5d48c4[_0x241fca]=!![];if(_0x540dad){_0x5d48c4[_0x79c7('0x17')]=_0x540dad;}if(_0x113471){_0x5d48c4[_0x79c7('0x18')]=_0x113471;}return _0x5d48c4;}function isEmail(_0x34f2a5){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'](_0x34f2a5);}function checkRow(_0x7c47ec,_0x526f85,_0x2017be){return new BPromise(function(_0x55b343,_0x1f3432){if(_[_0x79c7('0x19')](_0x7c47ec)){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2017be));}if(_0x7c47ec['errors']&&_0x7c47ec[_0x79c7('0x1a')][_0x79c7('0x1b')]){var _0x4cc749=_['map'](_0x7c47ec[_0x79c7('0x1a')],'message')[_0x79c7('0x1c')](';');return _0x1f3432(handleCheckRowError('error',_0x4cc749,null,_0x2017be));}var _0x31f677={};for(var _0x1105f1 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1105f1)&&FIELDS[_0x1105f1]){_0x31f677[_0x1105f1]=_0x7c47ec[_0x79c7('0x1d')][0x0][FIELDS[_0x1105f1]]||_0x7c47ec[_0x79c7('0x1d')][0x0]['\ufeff'+FIELDS[_0x1105f1]];}}if(!_0x31f677['firstName']){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'firstName\x20not\x20specified!',null,_0x2017be));}if(!_0x31f677[_0x79c7('0x1e')]){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),_0x79c7('0x1f'),null,_0x2017be));}if(_0x31f677[_0x79c7('0x20')]){var _0x2cf6c8=moment(_0x31f677[_0x79c7('0x20')],'YYYY-MM-DD');if(!_0x2cf6c8[_0x79c7('0x21')]()){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2017be));}}if(_0x31f677[_0x79c7('0x22')]){if(!isEmail(_0x31f677[_0x79c7('0x22')])){return _0x1f3432(handleCheckRowError('error',_0x79c7('0x23'),null,_0x2017be));}}_0x31f677[_0x79c7('0x24')]=LISTID;_0x31f677[_0x79c7('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x526f85){var _0x382e91={};for(var _0x2014bc=0x0,_0x4c6ccb=DUPLICATES[_0x79c7('0x1b')];_0x2014bc<_0x4c6ccb;_0x2014bc+=0x1){_0x382e91[DUPLICATES[_0x2014bc]]=_0x31f677[DUPLICATES[_0x2014bc]];}var _0x122596=_[_0x79c7('0x26')](_0x526f85,_0x382e91);if(_0x122596){return _0x1f3432(handleCheckRowError(_0x79c7('0x27'),_0x79c7('0x28'),_0x122596,_0x2017be));}}return db[_0x79c7('0x29')][_0x79c7('0x2a')](_0x31f677,{'raw':!![],'hooks':![],'fields':_[_0x79c7('0x2b')](_0x31f677)})['then'](function(_0x597e95){if(DUPLICATES&&DUPLICATES[_0x79c7('0x1b')]&&_0x526f85){_0x526f85[_0x79c7('0x2c')](_['pick'](_0x31f677,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x597e95['id'];return _0x55b343();})['catch'](function(_0x24aa7b){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),_0x79c7('0x2d')+(_0x24aa7b['message']||JSON[_0x79c7('0x2e')](_0x24aa7b)),null,_0x2017be));});});}function checkHopper(){function _0x30026a(){return function(_0x1be69){logger[_0x79c7('0x16')](_0x79c7('0x2f'),_0x79c7('0x30'),util[_0x79c7('0x31')](_0x1be69,{'showHidden':![],'depth':null}));};}var _0x18017d=function(_0x4adccd,_0x5838cb){var _0x3a82b5=squel[_0x79c7('0x32')]()[_0x79c7('0x33')](_0x79c7('0x34'))['fromQuery']([_0x79c7('0x1e'),_0x79c7('0x35'),_0x79c7('0x36'),_0x79c7('0x24'),_0x5838cb,_0x79c7('0x37'),_0x79c7('0x38')],squel[_0x79c7('0x39')]()['field'](_0x79c7('0x1e'),_0x79c7('0x1e'))[_0x79c7('0x3a')]('NOW()',_0x79c7('0x35'))[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x4adccd['id'][_0x79c7('0x3b')](),_0x5838cb)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')]('NOW()',_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')[_0x79c7('0x3f')](_0x79c7('0x40'),LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')](_0x79c7('0x41'))['where'](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')]('phone')[_0x79c7('0x3d')](_0x79c7('0x34'))[_0x79c7('0x3f')](_0x5838cb+_0x79c7('0x43'),_0x4adccd['id'][_0x79c7('0x3b')]())))[_0x79c7('0x3b')]();return _0x3a82b5;};var _0x5a7a48=function(_0x250d3d,_0x4ae647){var _0x3f8c82=squel[_0x79c7('0x32')]()['into'](_0x79c7('0x34'))['fromQuery'](['phone',_0x79c7('0x35'),_0x79c7('0x36'),_0x79c7('0x24'),_0x4ae647,'createdAt','updatedAt'],squel['select']()['field']('phone',_0x79c7('0x1e'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x35'))[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x250d3d['id'][_0x79c7('0x3b')](),_0x4ae647)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))['from']('cm_contacts')[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')[_0x79c7('0x3f')]('ListId\x20=\x20?',LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')](_0x79c7('0x44'),squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x79c7('0x3f')](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')]('calleridnum')[_0x79c7('0x3d')](_0x79c7('0x46'))['where'](_0x4ae647+_0x79c7('0x43'),_0x250d3d['id']['toString']()))[_0x79c7('0x3f')](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')](_0x79c7('0x1e'))[_0x79c7('0x3d')](_0x79c7('0x34'))[_0x79c7('0x3f')](_0x4ae647+_0x79c7('0x43'),_0x250d3d['id'][_0x79c7('0x3b')]())))[_0x79c7('0x3b')]();return _0x3f8c82;};function _0x1a38e0(_0x4e5aae,_0xd1a2b){var _0x193724=squel[_0x79c7('0x32')]()[_0x79c7('0x33')]('cm_hopper')['fromQuery']([_0x79c7('0x1e'),'scheduledAt','ContactId','ListId',_0xd1a2b,'createdAt','updatedAt'],squel['select']()['field'](_0x79c7('0x1e'),_0x79c7('0x1e'))['field'](_0x79c7('0x3c'),_0x79c7('0x35'))['field']('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x4e5aae['id'][_0x79c7('0x3b')](),_0xd1a2b)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')](_0x79c7('0x47'))[_0x79c7('0x3f')](_0x79c7('0x40'),LISTID['toString']())[_0x79c7('0x3f')](_0x79c7('0x44'),squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')](_0x79c7('0x41')))[_0x79c7('0x3b')]();return _0x193724;}function _0x3830a3(_0x653826,_0x39044d){var _0x5f1f84=squel[_0x79c7('0x32')]()[_0x79c7('0x33')](_0x79c7('0x48'))[_0x79c7('0x49')]([_0x79c7('0x1e'),_0x79c7('0x36'),_0x79c7('0x24'),_0x39044d,_0x79c7('0x37'),_0x79c7('0x38')],squel[_0x79c7('0x39')]()[_0x79c7('0x3a')](_0x79c7('0x1e'),'phone')[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),'ListId')[_0x79c7('0x3a')](_0x653826['id']['toString'](),_0x39044d)[_0x79c7('0x3a')](_0x79c7('0x3c'),'createdAt')[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x79c7('0x40'),LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')]('id\x20IN\x20?',squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')](_0x79c7('0x41')))[_0x79c7('0x3b')]();return _0x5f1f84;}return db[_0x79c7('0x4a')][_0x79c7('0x4b')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x79c7('0x4c')],'as':_0x79c7('0x4d'),'where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0x4927f6){var _0x4cf6cd=[];if(_0x4927f6){var _0x13dc29;for(var _0x3f9054=0x0,_0x187dc1;_0x3f9054<_0x4927f6[_0x79c7('0x1b')];_0x3f9054+=0x1){_0x187dc1=_0x4927f6[_0x3f9054][_0x79c7('0x4f')]({'plain':!![]});switch(_0x187dc1[_0x79c7('0x50')]){case _0x79c7('0x51'):_0x4cf6cd['push'](db['sequelize'][_0x79c7('0x52')](_0x5a7a48(_0x187dc1,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})['catch'](_0x30026a()));break;case'onlyIfOpen':_0x4cf6cd['push'](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x18017d(_0x187dc1,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));break;default:_0x4cf6cd[_0x79c7('0x2c')](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x1a38e0(_0x187dc1,_0x79c7('0x53')))['then'](function(){})['catch'](_0x30026a()));}}}return _0x4cf6cd;})[_0x79c7('0x56')]()[_0x79c7('0x4e')](function(){return db[_0x79c7('0x4a')][_0x79c7('0x4b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x79c7('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0xcc83df){var _0x10e2ba=[];if(_0xcc83df){var _0x4ea469;for(var _0x3bbed3=0x0,_0x51f880;_0x3bbed3<_0xcc83df[_0x79c7('0x1b')];_0x3bbed3+=0x1){_0x51f880=_0xcc83df[_0x3bbed3]['get']({'plain':!![]});_0x10e2ba[_0x79c7('0x2c')](db[_0x79c7('0x54')]['query'](_0x3830a3(_0x51f880,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}return _0x10e2ba;})[_0x79c7('0x56')]();})[_0x79c7('0x4e')](function(){return db[_0x79c7('0x57')][_0x79c7('0x4b')]({'attributes':['id',_0x79c7('0x50')],'include':[{'model':db['CmList'],'as':_0x79c7('0x4d'),'where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0x652680){var _0x5132f9=[];if(_0x652680){for(var _0x6e4c02=0x0,_0x309461;_0x6e4c02<_0x652680[_0x79c7('0x1b')];_0x6e4c02+=0x1){_0x309461=_0x652680[_0x6e4c02][_0x79c7('0x4f')]({'plain':!![]});switch(_0x309461[_0x79c7('0x50')]){case _0x79c7('0x51'):_0x5132f9[_0x79c7('0x2c')](db['sequelize'][_0x79c7('0x52')](_0x5a7a48(_0x309461,_0x79c7('0x58')))['then'](function(){})[_0x79c7('0x55')](_0x30026a()));break;case'onlyIfOpen':_0x5132f9['push'](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x18017d(_0x309461,'CampaignId'))[_0x79c7('0x4e')](function(){})['catch'](_0x30026a()));break;default:_0x5132f9[_0x79c7('0x2c')](db['sequelize'][_0x79c7('0x52')](_0x1a38e0(_0x309461,_0x79c7('0x58')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}}return _0x5132f9;})[_0x79c7('0x56')]();})[_0x79c7('0x4e')](function(){return db[_0x79c7('0x57')][_0x79c7('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x79c7('0x4c')],'as':_0x79c7('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x581bc8){var _0xaf1516=[];if(_0x581bc8){for(var _0x20b1af=0x0,_0x11ac8b;_0x20b1af<_0x581bc8[_0x79c7('0x1b')];_0x20b1af+=0x1){_0x11ac8b=_0x581bc8[_0x20b1af][_0x79c7('0x4f')]({'plain':!![]});_0xaf1516[_0x79c7('0x2c')](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x3830a3(_0x11ac8b,_0x79c7('0x58')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}return _0xaf1516;})['all']();})[_0x79c7('0x55')](function(_0x4feb87){logger['error']('cmContact,\x20%s,\x20%s',_0x79c7('0x5a'),_0x4feb87[_0x79c7('0x5b')]);});}var processPromises=function(_0xdf345e){return BPromise[_0x79c7('0x56')](promises)[_0x79c7('0x4e')](function(_0x3d8a04){})[_0x79c7('0x55')](function(_0x2d7cd5){logger[_0x79c7('0x16')](_0x79c7('0x5c'),JSON[_0x79c7('0x2e')](_0x2d7cd5));})[_0x79c7('0x5d')](function(){socket['emit'](_0x79c7('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xdf345e){return _0xdf345e[_0x79c7('0x5f')]();}});};var endCsv=function(){return BPromise[_0x79c7('0x60')]()[_0x79c7('0x4e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x79c7('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x79c7('0x61')](FILEPATH);}catch(_0x415240){logger['error'](_0x79c7('0x62'),JSON[_0x79c7('0x2e')](_0x415240));}finally{process[_0x79c7('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x79c7('0x64')](_0x79c7('0x65'));endCsv();});function main(){return BPromise['resolve']()[_0x79c7('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x79c7('0x13')](',');return db[_0x79c7('0x29')][_0x79c7('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x79c7('0x4e')](function(_0x38e922){var _0xfdbe49=fs[_0x79c7('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x79c7('0x67')](_0xfdbe49,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5dcd7f,_0x143ac2){total+=0x1;var _0x2f8f1b=total;promises['push'](checkRow(_0x5dcd7f,_0x38e922,_0x2f8f1b)[_0x79c7('0x4e')](function(){success+=0x1;})[_0x79c7('0x55')](function(_0x4c4bf3){if(_0x4c4bf3[_0x79c7('0x16')]){errors+=0x1;delete _0x4c4bf3['error'];}else if(_0x4c4bf3['duplicate']){duplicates+=0x1;delete _0x4c4bf3['duplicate'];}rows[_0x79c7('0x2c')](_0x4c4bf3);}));if(total%0xc8===0x0){_0x143ac2[_0x79c7('0x68')]();return processPromises(_0x143ac2);}},'complete':function(){return processPromises()[_0x79c7('0x4e')](function(){logger['info'](_0x79c7('0x69'));endCsv();});},'error':function(_0x3fec19,_0x259ce8){logger[_0x79c7('0x64')](_0x79c7('0x6a'),JSON['stringify'](_0x3fec19));endCsv();}});})['catch'](function(_0x392088){logger['error'](_0x79c7('0x6b'),JSON['stringify'](_0x392088));});}main(); \ No newline at end of file +var _0xb51e=['bluebird','util','lodash','../../../config/logger','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','hasOwnProperty','data','firstName','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','cm_hopper','fromQuery','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','insert','into','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','resume','resolve','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parse\x20error'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xb51e,0xce));var _0xeb51=function(_0x4a973e,_0x29034b){_0x4a973e=_0x4a973e-0x0;var _0x36b56e=_0xb51e[_0x4a973e];return _0x36b56e;};'use strict';var BPromise=require(_0xeb51('0x0'));var util=require(_0xeb51('0x1'));var _=require(_0xeb51('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xeb51('0x3'))('api');config['redis']=_[_0xeb51('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb51('0x5'))(new Redis(config['redis']));require(_0xeb51('0x6'))[_0xeb51('0x7')](socket);try{if(!process['argv'][0x2]||process[_0xeb51('0x8')][0x2]===_0xeb51('0x9')||process[_0xeb51('0x8')][0x2]==='null'){throw new Error(_0xeb51('0xa'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xeb51('0x8')][0x3]===_0xeb51('0x9')||process[_0xeb51('0x8')][0x3]===_0xeb51('0xb')||!process['argv'][0x4]||process[_0xeb51('0x8')][0x4]===_0xeb51('0x9')||process[_0xeb51('0x8')][0x4]===_0xeb51('0xb')){throw new Error(_0xeb51('0xc'));}var FIELDS=_[_0xeb51('0xd')](process[_0xeb51('0x8')][0x3][_0xeb51('0xe')](','),process[_0xeb51('0x8')][0x4]['split'](','));if(!process[_0xeb51('0x8')][0x5]||process[_0xeb51('0x8')][0x5]===_0xeb51('0x9')||process[_0xeb51('0x8')][0x5]===_0xeb51('0xb')){throw new Error(_0xeb51('0xf'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xeb51('0x8')][0x6]&&process[_0xeb51('0x8')][0x6]!=='undefined'&&process[_0xeb51('0x8')][0x6]!==_0xeb51('0xb')?process['argv'][0x6]:null;var DUPLICATES=process[_0xeb51('0x8')][0x7]&&process['argv'][0x7]!==_0xeb51('0x9')&&process[_0xeb51('0x8')][0x7]!==_0xeb51('0xb')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xeb51('0x8')][0x8]==='undefined'||process[_0xeb51('0x8')][0x8]==='null'){throw new Error(_0xeb51('0x10'));}var SOCKET_TIMESTAMP=process[_0xeb51('0x8')][0x8];}catch(_0x5392e0){logger[_0xeb51('0x11')](_0x5392e0);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(_0x2edc98,_0x51d09c,_0x8308b6,_0x305db0){var _0xf2d46={'message':_0x51d09c};_0xf2d46[_0x2edc98]=!![];if(_0x8308b6){_0xf2d46[_0xeb51('0x12')]=_0x8308b6;}if(_0x305db0){_0xf2d46[_0xeb51('0x13')]=_0x305db0;}return _0xf2d46;}function isEmail(_0x33e706){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'](_0x33e706);}function checkRow(_0x5df869,_0x46abfa,_0x4d57aa){return new BPromise(function(_0x2fd7ed,_0x1a2333){if(_[_0xeb51('0x14')](_0x5df869)){return _0x1a2333(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4d57aa));}if(_0x5df869[_0xeb51('0x15')]&&_0x5df869[_0xeb51('0x15')][_0xeb51('0x16')]){var _0x5f058b=_[_0xeb51('0x17')](_0x5df869[_0xeb51('0x15')],'message')['join'](';');return _0x1a2333(handleCheckRowError(_0xeb51('0x11'),_0x5f058b,null,_0x4d57aa));}var _0x3991ca={};for(var _0x48625a in FIELDS){if(FIELDS[_0xeb51('0x18')](_0x48625a)&&FIELDS[_0x48625a]){_0x3991ca[_0x48625a]=_0x5df869[_0xeb51('0x19')][0x0][FIELDS[_0x48625a]]||_0x5df869['data'][0x0]['\ufeff'+FIELDS[_0x48625a]];}}if(!_0x3991ca[_0xeb51('0x1a')]){return _0x1a2333(handleCheckRowError(_0xeb51('0x11'),'firstName\x20not\x20specified!',null,_0x4d57aa));}if(!_0x3991ca['phone']){return _0x1a2333(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x4d57aa));}if(_0x3991ca[_0xeb51('0x1b')]){var _0x98b36c=moment(_0x3991ca[_0xeb51('0x1b')],_0xeb51('0x1c'));if(!_0x98b36c[_0xeb51('0x1d')]()){return _0x1a2333(handleCheckRowError(_0xeb51('0x11'),_0xeb51('0x1e'),null,_0x4d57aa));}}if(_0x3991ca[_0xeb51('0x1f')]){if(!isEmail(_0x3991ca[_0xeb51('0x1f')])){return _0x1a2333(handleCheckRowError(_0xeb51('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x4d57aa));}}_0x3991ca[_0xeb51('0x20')]=LISTID;_0x3991ca['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xeb51('0x16')]&&_0x46abfa){var _0x178285={};for(var _0x561431=0x0,_0x18c860=DUPLICATES[_0xeb51('0x16')];_0x561431<_0x18c860;_0x561431+=0x1){_0x178285[DUPLICATES[_0x561431]]=_0x3991ca[DUPLICATES[_0x561431]];}var _0x1eb0e9=_['find'](_0x46abfa,_0x178285);if(_0x1eb0e9){return _0x1a2333(handleCheckRowError(_0xeb51('0x21'),_0xeb51('0x22'),_0x1eb0e9,_0x4d57aa));}}return db[_0xeb51('0x23')][_0xeb51('0x24')](_0x3991ca,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3991ca)})[_0xeb51('0x25')](function(_0x17c73c){if(DUPLICATES&&DUPLICATES['length']&&_0x46abfa){_0x46abfa['push'](_[_0xeb51('0x26')](_0x3991ca,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x17c73c['id'];return _0x2fd7ed();})[_0xeb51('0x27')](function(_0x246793){return _0x1a2333(handleCheckRowError(_0xeb51('0x11'),_0xeb51('0x28')+(_0x246793[_0xeb51('0x29')]||JSON[_0xeb51('0x2a')](_0x246793)),null,_0x4d57aa));});});}function checkHopper(){function _0x4a38d1(){return function(_0x34e6f4){logger['error'](_0xeb51('0x2b'),_0xeb51('0x2c'),util['inspect'](_0x34e6f4,{'showHidden':![],'depth':null}));};}var _0x559bc5=function(_0x570793,_0x4efb0b){var _0xa9ba40=squel['insert']()['into'](_0xeb51('0x2d'))[_0xeb51('0x2e')]([_0xeb51('0x2f'),'scheduledAt',_0xeb51('0x30'),_0xeb51('0x20'),_0x4efb0b,_0xeb51('0x31'),_0xeb51('0x32')],squel[_0xeb51('0x33')]()[_0xeb51('0x34')](_0xeb51('0x2f'),_0xeb51('0x2f'))[_0xeb51('0x34')](_0xeb51('0x35'),_0xeb51('0x36'))['field']('id','ContactId')['field'](LISTID[_0xeb51('0x37')](),'ListId')[_0xeb51('0x34')](_0x570793['id'][_0xeb51('0x37')](),_0x4efb0b)['field'](_0xeb51('0x35'),'createdAt')[_0xeb51('0x34')](_0xeb51('0x35'),'updatedAt')[_0xeb51('0x38')](_0xeb51('0x39'))[_0xeb51('0x3a')](_0xeb51('0x3b'))[_0xeb51('0x3a')](_0xeb51('0x3c'),LISTID['toString']())[_0xeb51('0x3a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xeb51('0x3d'),squel[_0xeb51('0x33')]()[_0xeb51('0x34')](_0xeb51('0x2f'))[_0xeb51('0x38')](_0xeb51('0x2d'))[_0xeb51('0x3a')](_0x4efb0b+_0xeb51('0x3e'),_0x570793['id']['toString']())))[_0xeb51('0x37')]();return _0xa9ba40;};var _0x322ae9=function(_0x2c0ef1,_0x3aeca5){var _0x2440e4=squel['insert']()['into'](_0xeb51('0x2d'))[_0xeb51('0x2e')](['phone','scheduledAt','ContactId','ListId',_0x3aeca5,_0xeb51('0x31'),_0xeb51('0x32')],squel['select']()['field'](_0xeb51('0x2f'),'phone')[_0xeb51('0x34')](_0xeb51('0x35'),_0xeb51('0x36'))[_0xeb51('0x34')]('id',_0xeb51('0x30'))['field'](LISTID[_0xeb51('0x37')](),'ListId')[_0xeb51('0x34')](_0x2c0ef1['id'][_0xeb51('0x37')](),_0x3aeca5)[_0xeb51('0x34')](_0xeb51('0x35'),_0xeb51('0x31'))['field'](_0xeb51('0x35'),_0xeb51('0x32'))['from'](_0xeb51('0x39'))['where']('deletedAt\x20IS\x20NULL')[_0xeb51('0x3a')](_0xeb51('0x3c'),LISTID[_0xeb51('0x37')]())[_0xeb51('0x3a')](_0xeb51('0x3f'),squel[_0xeb51('0x40')](hopperContacts))[_0xeb51('0x3a')](_0xeb51('0x41'))[_0xeb51('0x3a')](_0xeb51('0x3d'),squel[_0xeb51('0x33')]()[_0xeb51('0x34')](_0xeb51('0x42'))[_0xeb51('0x38')](_0xeb51('0x43'))[_0xeb51('0x3a')](_0x3aeca5+_0xeb51('0x3e'),_0x2c0ef1['id'][_0xeb51('0x37')]()))[_0xeb51('0x3a')](_0xeb51('0x3d'),squel[_0xeb51('0x33')]()[_0xeb51('0x34')]('phone')[_0xeb51('0x38')]('cm_hopper')['where'](_0x3aeca5+_0xeb51('0x3e'),_0x2c0ef1['id']['toString']())))['toString']();return _0x2440e4;};function _0x32cdad(_0x371857,_0x29bc85){var _0x5ca111=squel[_0xeb51('0x44')]()[_0xeb51('0x45')](_0xeb51('0x2d'))['fromQuery']([_0xeb51('0x2f'),'scheduledAt',_0xeb51('0x30'),'ListId',_0x29bc85,_0xeb51('0x31'),_0xeb51('0x32')],squel[_0xeb51('0x33')]()[_0xeb51('0x34')](_0xeb51('0x2f'),'phone')['field'](_0xeb51('0x35'),_0xeb51('0x36'))['field']('id',_0xeb51('0x30'))[_0xeb51('0x34')](LISTID[_0xeb51('0x37')](),_0xeb51('0x20'))[_0xeb51('0x34')](_0x371857['id'][_0xeb51('0x37')](),_0x29bc85)[_0xeb51('0x34')](_0xeb51('0x35'),_0xeb51('0x31'))['field']('NOW()',_0xeb51('0x32'))[_0xeb51('0x38')]('cm_contacts')[_0xeb51('0x3a')](_0xeb51('0x3b'))[_0xeb51('0x3a')](_0xeb51('0x3c'),LISTID['toString']())[_0xeb51('0x3a')](_0xeb51('0x3f'),squel[_0xeb51('0x40')](hopperContacts))[_0xeb51('0x3a')](_0xeb51('0x41')))[_0xeb51('0x37')]();return _0x5ca111;}function _0x4efbb6(_0x31c500,_0x1df84b){var _0x215f5a=squel[_0xeb51('0x44')]()[_0xeb51('0x45')](_0xeb51('0x46'))[_0xeb51('0x2e')]([_0xeb51('0x2f'),_0xeb51('0x30'),_0xeb51('0x20'),_0x1df84b,_0xeb51('0x31'),_0xeb51('0x32')],squel[_0xeb51('0x33')]()[_0xeb51('0x34')](_0xeb51('0x2f'),_0xeb51('0x2f'))[_0xeb51('0x34')]('id',_0xeb51('0x30'))[_0xeb51('0x34')](LISTID['toString'](),_0xeb51('0x20'))[_0xeb51('0x34')](_0x31c500['id'][_0xeb51('0x37')](),_0x1df84b)[_0xeb51('0x34')](_0xeb51('0x35'),_0xeb51('0x31'))['field'](_0xeb51('0x35'),_0xeb51('0x32'))[_0xeb51('0x38')](_0xeb51('0x39'))[_0xeb51('0x3a')](_0xeb51('0x3b'))[_0xeb51('0x3a')](_0xeb51('0x3c'),LISTID[_0xeb51('0x37')]())[_0xeb51('0x3a')]('id\x20IN\x20?',squel[_0xeb51('0x40')](hopperContacts))[_0xeb51('0x3a')](_0xeb51('0x41')))[_0xeb51('0x37')]();return _0x215f5a;}return db[_0xeb51('0x47')][_0xeb51('0x48')]({'where':{'type':_0xeb51('0x49')},'attributes':['id',_0xeb51('0x4a')],'include':[{'model':db[_0xeb51('0x4b')],'as':_0xeb51('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0x421c8f){var _0x5e6caf=[];if(_0x421c8f){var _0x35f410;for(var _0x2acc50=0x0,_0x9650d5;_0x2acc50<_0x421c8f['length'];_0x2acc50+=0x1){_0x9650d5=_0x421c8f[_0x2acc50][_0xeb51('0x4d')]({'plain':!![]});switch(_0x9650d5[_0xeb51('0x4a')]){case'always':_0x5e6caf[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x322ae9(_0x9650d5,_0xeb51('0x51')))['then'](function(){})[_0xeb51('0x27')](_0x4a38d1()));break;case _0xeb51('0x52'):_0x5e6caf[_0xeb51('0x4e')](db['sequelize'][_0xeb51('0x50')](_0x559bc5(_0x9650d5,_0xeb51('0x51')))[_0xeb51('0x25')](function(){})['catch'](_0x4a38d1()));break;default:_0x5e6caf[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x32cdad(_0x9650d5,_0xeb51('0x51')))[_0xeb51('0x25')](function(){})[_0xeb51('0x27')](_0x4a38d1()));}}}return _0x5e6caf;})[_0xeb51('0x53')]()['then'](function(){return db[_0xeb51('0x47')][_0xeb51('0x48')]({'where':{'type':_0xeb51('0x49')},'attributes':['id'],'include':[{'model':db[_0xeb51('0x4b')],'as':_0xeb51('0x54'),'where':{'id':LISTID}}]})[_0xeb51('0x25')](function(_0x262212){var _0x5a96e8=[];if(_0x262212){var _0x1ea835;for(var _0x7f7784=0x0,_0x224b77;_0x7f7784<_0x262212[_0xeb51('0x16')];_0x7f7784+=0x1){_0x224b77=_0x262212[_0x7f7784][_0xeb51('0x4d')]({'plain':!![]});_0x5a96e8[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x4efbb6(_0x224b77,'VoiceQueueId'))[_0xeb51('0x25')](function(){})[_0xeb51('0x27')](_0x4a38d1()));}}return _0x5a96e8;})[_0xeb51('0x53')]();})[_0xeb51('0x25')](function(){return db[_0xeb51('0x55')]['findAll']({'attributes':['id',_0xeb51('0x4a')],'include':[{'model':db[_0xeb51('0x4b')],'as':_0xeb51('0x4c'),'where':{'id':LISTID}}]})['then'](function(_0x353b08){var _0x4e06b=[];if(_0x353b08){for(var _0x49f34b=0x0,_0x4d93c7;_0x49f34b<_0x353b08[_0xeb51('0x16')];_0x49f34b+=0x1){_0x4d93c7=_0x353b08[_0x49f34b][_0xeb51('0x4d')]({'plain':!![]});switch(_0x4d93c7[_0xeb51('0x4a')]){case _0xeb51('0x56'):_0x4e06b[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x322ae9(_0x4d93c7,_0xeb51('0x57')))[_0xeb51('0x25')](function(){})[_0xeb51('0x27')](_0x4a38d1()));break;case _0xeb51('0x52'):_0x4e06b[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x559bc5(_0x4d93c7,_0xeb51('0x57')))[_0xeb51('0x25')](function(){})[_0xeb51('0x27')](_0x4a38d1()));break;default:_0x4e06b[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x32cdad(_0x4d93c7,'CampaignId'))[_0xeb51('0x25')](function(){})['catch'](_0x4a38d1()));}}}return _0x4e06b;})['all']();})[_0xeb51('0x25')](function(){return db[_0xeb51('0x55')][_0xeb51('0x48')]({'attributes':['id'],'include':[{'model':db[_0xeb51('0x4b')],'as':_0xeb51('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x266a3f){var _0x36dba3=[];if(_0x266a3f){for(var _0x4aed6c=0x0,_0x36c802;_0x4aed6c<_0x266a3f[_0xeb51('0x16')];_0x4aed6c+=0x1){_0x36c802=_0x266a3f[_0x4aed6c][_0xeb51('0x4d')]({'plain':!![]});_0x36dba3[_0xeb51('0x4e')](db[_0xeb51('0x4f')][_0xeb51('0x50')](_0x4efbb6(_0x36c802,_0xeb51('0x57')))[_0xeb51('0x25')](function(){})['catch'](_0x4a38d1()));}}return _0x36dba3;})['all']();})[_0xeb51('0x27')](function(_0x28711f){logger[_0xeb51('0x11')](_0xeb51('0x58'),_0xeb51('0x59'),_0x28711f[_0xeb51('0x29')]);});}var processPromises=function(_0x26d96c){return BPromise['all'](promises)['then'](function(_0x1329a1){})[_0xeb51('0x27')](function(_0x818159){logger['error'](_0xeb51('0x5a'),JSON['stringify'](_0x818159));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x26d96c){return _0x26d96c[_0xeb51('0x5b')]();}});};var endCsv=function(){return BPromise[_0xeb51('0x5c')]()[_0xeb51('0x25')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xeb51('0x5d')](_0xeb51('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xeb51('0x5f')](FILEPATH);}catch(_0xcf393){logger[_0xeb51('0x11')](_0xeb51('0x60'),JSON[_0xeb51('0x2a')](_0xcf393));}finally{process[_0xeb51('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0xeb51('0x62')](_0xeb51('0x63'));endCsv();});function main(){return BPromise[_0xeb51('0x5c')]()[_0xeb51('0x25')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xeb51('0x23')][_0xeb51('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xeb51('0x25')](function(_0x598cef){var _0x25b9ff=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xeb51('0x64')](_0x25b9ff,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e0eec,_0x5378a3){total+=0x1;var _0x2162f7=total;promises[_0xeb51('0x4e')](checkRow(_0x4e0eec,_0x598cef,_0x2162f7)['then'](function(){success+=0x1;})['catch'](function(_0x4f5b06){if(_0x4f5b06[_0xeb51('0x11')]){errors+=0x1;delete _0x4f5b06['error'];}else if(_0x4f5b06[_0xeb51('0x21')]){duplicates+=0x1;delete _0x4f5b06['duplicate'];}rows[_0xeb51('0x4e')](_0x4f5b06);}));if(total%0xc8===0x0){_0x5378a3[_0xeb51('0x65')]();return processPromises(_0x5378a3);}},'complete':function(){return processPromises()[_0xeb51('0x25')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x48e2d6,_0xdab2c2){logger[_0xeb51('0x62')](_0xeb51('0x66'),JSON[_0xeb51('0x2a')](_0x48e2d6));endCsv();}});})[_0xeb51('0x27')](function(_0x732b0d){logger[_0xeb51('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xeb51('0x2a')](_0x732b0d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5deb585..fbe01be 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 _0x38da=['cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','fields','join','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','UserId','.CmListId','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','set','dialTimezone','main','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','hasOwnProperty','replace','itemTypeId','trim','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','root','argv','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone'];(function(_0x247064,_0x471718){var _0x287b72=function(_0x857a3e){while(--_0x857a3e){_0x247064['push'](_0x247064['shift']());}};_0x287b72(++_0x471718);}(_0x38da,0x90));var _0xa38d=function(_0xc5cd18,_0x251c74){_0xc5cd18=_0xc5cd18-0x0;var _0x37a5cb=_0x38da[_0xc5cd18];return _0x37a5cb;};'use strict';var fs=require('fs');var path=require(_0xa38d('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xa38d('0x1'));var BPromise=require(_0xa38d('0x2'));var moment=require(_0xa38d('0x3'));var squel=require(_0xa38d('0x4'));var Redis=require(_0xa38d('0x5'));var db=require(_0xa38d('0x6'))['db'];var config=require(_0xa38d('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xa38d('0x8'))(_0xa38d('0x9'));config[_0xa38d('0xa')]=_[_0xa38d('0xb')](config[_0xa38d('0xa')],{'host':_0xa38d('0xc'),'port':0x18eb});var socket=require(_0xa38d('0xd'))(new Redis(config[_0xa38d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa38d('0xe')](_0xa38d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa38d('0xe')](_0xa38d('0xf'));function isEmail(_0x1c426f){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))*$/[_0xa38d('0x10')](_0x1c426f);}function selectNotIn(_0x462a71,_0x1ad0b3,_0x14024f,_0x3a70a0,_0x3592bb){return squel[_0xa38d('0x11')]()['field'](_0xa38d('0x12'))[_0xa38d('0x13')](_0x3a70a0)['join'](_0x1ad0b3,null,_0x1ad0b3+_0xa38d('0x14')+_0x3a70a0+'.'+_0x14024f)[_0xa38d('0x15')](_0x3a70a0+'.'+_0x14024f+_0xa38d('0x16')+_0x462a71+'.'+_0x14024f)[_0xa38d('0x15')](_0x1ad0b3+'.dialCheckDuplicateType\x20IN\x20('+_0x3592bb['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x323054,_0x52532e){promisesAdditionalPhones=[];return db[_0xa38d('0x17')][_0xa38d('0x18')]({'raw':!![],'attributes':['id',_0xa38d('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa38d('0x1a')](function(_0x4557d8){if(_0x4557d8!==null){var _0x7cc723=[];for(var _0x4bafed=0x0;_0x4bafed<_0x4557d8[_0xa38d('0x1b')];_0x4bafed++){var _0x4e25b1=_0x4557d8[_0x4bafed];_0x7cc723[_0xa38d('0x1c')](insertAdditionalPhones(_0x4e25b1));}}Promise[_0xa38d('0x1d')](_0x7cc723)['then'](function(){_0x323054({'val':0x1});});});});}function insertAdditionalPhones(_0x367ea4){return new Promise(function(_0x36f154,_0x43dccd){var _0x1b6c5a=_0x367ea4[_0xa38d('0x19')];var _0x1dd3e7=_0x1b6c5a[_0xa38d('0x1e')](';');var _0x43abd2=[];orderBy=0x0;for(var _0x435945=0x0;_0x435945<_0x1dd3e7[_0xa38d('0x1b')];_0x435945++){_0x43abd2[_0xa38d('0x1c')](splitAdditionalPhone(_0x367ea4['id'],_0x1dd3e7[_0x435945]));}Promise[_0xa38d('0x1d')](_0x43abd2)[_0xa38d('0x1a')](function(){_0x36f154({'val':_0x1dd3e7[_0xa38d('0x1b')]});});});}function splitAdditionalPhone(_0x3cc249,_0x408aa6){return new Promise(function(_0x13976e,_0x55c493){var _0x4e322f=_0x408aa6['split'](':');var _0x3c4852=_0x4e322f[0x0];var _0x4c4984=_0x4e322f[0x1];if(!_[_0xa38d('0x1f')](_0x4c4984)){var _0x4c36bd=_0x4c4984[_0xa38d('0x1e')]('|');var _0x512639=[];for(var _0x3e68a0=0x0;_0x3e68a0<_0x4c36bd[_0xa38d('0x1b')];_0x3e68a0++){if(_0x4c36bd[_0x3e68a0]!==''){var _0x5abf83=_[_0xa38d('0x20')](promisesAdditionalPhones,{'contactId':_0x3cc249,'phone':_0x4c36bd[_0x3e68a0]});if(_0x5abf83[_0xa38d('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xa38d('0x1c')]({'contactId':_0x3cc249,'contactTypeId':_0x3c4852,'phone':_0x4c36bd[_0x3e68a0],'orderBy':orderBy});}}}_0x13976e({'ok':0x1});}else _0x13976e({'res':0x0});});}function createAdditionalPhone(_0x294a27,_0x2df2f1,_0x565b93,_0x13f5f2){var _0x312c6d='';var _0xaebcd8='';var _0xdbe215=_0x565b93[_0xa38d('0x1e')]('§');_0x312c6d=_0xdbe215[0x0];if(_0xdbe215[_0xa38d('0x1b')]==0x2)_0xaebcd8=_0xdbe215[0x1];return new Promise(function(_0x254f41,_0x20ec2d){return db['CmContactHasItem'][_0xa38d('0x21')]({'where':{'CmContactId':_0x294a27,'item':_0x312c6d}})[_0xa38d('0x1a')](function(_0xd08c89){if(_0xd08c89){return db[_0xa38d('0x22')][_0xa38d('0x23')]({'ItemTypeId':_0x2df2f1,'description':_0xaebcd8,'OrderBy':_0x13f5f2},{'where':{'CmContactId':_0x294a27,'item':_0x312c6d}})[_0xa38d('0x1a')](function(_0x2f97c1){_0x254f41({'res':_0xa38d('0x24')});});}else{return db['CmContactHasItem'][_0xa38d('0x25')]({'CmContactId':_0x294a27,'item':_0x312c6d,'description':_0xaebcd8,'ItemTypeId':_0x2df2f1,'OrderBy':_0x13f5f2,'ItemClass':_0xa38d('0x26')})[_0xa38d('0x1a')](function(_0x58011e){_0x254f41({'res':_0xa38d('0x27')});});}});});}function insertCmHopper(_0x5d6a9b,_0x50f755,_0x49bfc2,_0x32d6a6,_0x5f37a5){var _0x23ef6=[_0xa38d('0x28'),'cm_contacts.scheduledat',_0xa38d('0x29'),_0xa38d('0x2a'),_0x50f755+'.'+_0x32d6a6,_0xa38d('0x2b'),_0xa38d('0x2c'),'cm_contacts.priority',_0xa38d('0x2d'),'\x22'+_0x5f37a5+'\x22'];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper')[_0xa38d('0x30')]([_0xa38d('0x12'),'scheduledat',_0xa38d('0x31'),_0xa38d('0x32'),_0x32d6a6,_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x35'),'UserId',_0xa38d('0x36')],squel[_0xa38d('0x11')]()['fields'](_0x23ef6)[_0xa38d('0x13')](_0x50f755)['join'](_0xa38d('0x37'),null,_0xa38d('0x38')+_0x50f755+'.CmListId')['join'](_0x49bfc2,null,_0x49bfc2+_0xa38d('0x14')+_0x50f755+'.'+_0x32d6a6)[_0xa38d('0x15')](_0x50f755+_0xa38d('0x39'),_0x5d6a9b)['where'](_0xa38d('0x3a'),NOW)['where'](_0xa38d('0x3b'),selectNotIn(_0x50f755,_0x49bfc2,_0x32d6a6,_0xa38d('0x3c'),[_0xa38d('0x3d'),_0xa38d('0x3e')]))['where'](_0xa38d('0x3b'),selectNotIn(_0x50f755,_0x49bfc2,_0x32d6a6,_0xa38d('0x3c'),['\x22always\x22'])))[_0xa38d('0x3f')]();}function insertCmHopperBlack(_0xd40c97,_0x2320f0,_0x5ae39d,_0x58f49c){var _0x1965bb=[_0xa38d('0x28'),_0xa38d('0x29'),_0xa38d('0x2a'),_0x2320f0+'.'+_0x58f49c,_0xa38d('0x2b'),_0xa38d('0x2c')];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper_black')[_0xa38d('0x30')]([_0xa38d('0x12'),_0xa38d('0x31'),'ListId',_0x58f49c,'createdAt','updatedAt'],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x1965bb)[_0xa38d('0x13')](_0x2320f0)['join'](_0xa38d('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x2320f0+'.CmListId')[_0xa38d('0x41')](_0x5ae39d,null,_0x5ae39d+'.id\x20=\x20'+_0x2320f0+'.'+_0x58f49c)['where'](_0x2320f0+_0xa38d('0x39'),_0xd40c97)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa38d('0x3b'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x12'))['from']('cm_hopper_black')[_0xa38d('0x15')]('ListId\x20=\x20?',_0xd40c97)[_0xa38d('0x15')](_0x58f49c+_0xa38d('0x16')+_0x2320f0+'.'+_0x58f49c)))[_0xa38d('0x3f')]();}function insertTzCmHopper(_0x5123b7,_0x20d4b4,_0x2bd40a,_0xe10aac,_0x2bf7b8,_0x22dc6e){var _0x436e8c=[_0xa38d('0x28'),_0xa38d('0x43')+_0x22dc6e+_0xa38d('0x44'),'cm_contacts.id',_0xa38d('0x2a'),_0x20d4b4+'.'+_0xe10aac,'cm_contacts.createdAt',_0xa38d('0x2c'),_0xa38d('0x45'),_0xa38d('0x2d'),'\x22'+_0x2bf7b8+'\x22'];var _0x3d3495=squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper')['fromQuery']([_0xa38d('0x12'),'scheduledat','ContactId',_0xa38d('0x32'),_0xe10aac,_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x35'),_0xa38d('0x46'),_0xa38d('0x36')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x436e8c)['from'](_0x20d4b4)['join'](_0xa38d('0x37'),null,_0xa38d('0x38')+_0x20d4b4+_0xa38d('0x47'))['join'](_0x2bd40a,null,_0x2bd40a+'.id\x20=\x20'+_0x20d4b4+'.'+_0xe10aac)[_0xa38d('0x41')](_0x22dc6e,null,_0x22dc6e+_0xa38d('0x14')+_0x20d4b4+'.'+_0xe10aac)[_0xa38d('0x15')](_0x20d4b4+_0xa38d('0x39'),_0x5123b7)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW)[_0xa38d('0x15')](_0xa38d('0x3b'),selectNotIn(_0x20d4b4,_0x2bd40a,_0xe10aac,'cm_hopper',[_0xa38d('0x3d'),_0xa38d('0x3e')]))[_0xa38d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x20d4b4,_0x2bd40a,_0xe10aac,_0xa38d('0x3c'),[_0xa38d('0x3d')])))['toString']();return _0x3d3495;}function insertTzCmHopperBlack(_0x13eb0c,_0x19777f,_0x17ec71,_0xb839c8){var _0xb808d4=['cm_contacts.phone',_0xa38d('0x29'),_0xa38d('0x2a'),_0x19777f+'.'+_0xb839c8,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper_black')[_0xa38d('0x30')]([_0xa38d('0x12'),_0xa38d('0x31'),_0xa38d('0x32'),_0xb839c8,'createdAt',_0xa38d('0x34')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0xb808d4)[_0xa38d('0x13')](_0x19777f)[_0xa38d('0x41')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x19777f+_0xa38d('0x47'))['join'](_0x17ec71,null,_0x17ec71+_0xa38d('0x14')+_0x19777f+'.'+_0xb839c8)['where'](_0x19777f+_0xa38d('0x39'),_0x13eb0c)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW)[_0xa38d('0x15')](_0xa38d('0x3b'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x12'))[_0xa38d('0x13')](_0xa38d('0x48'))[_0xa38d('0x15')](_0xa38d('0x49'),_0x13eb0c)[_0xa38d('0x15')](_0xb839c8+'\x20=\x20'+_0x19777f+'.'+_0xb839c8)))[_0xa38d('0x3f')]();}function insertCmHopperAdditionalPhones(_0x360fe3){var _0x5486a4=[_0xa38d('0x4a'),'cm_contact_has_items.item',_0xa38d('0x4b'),_0xa38d('0x4c'),_0xa38d('0x4d')];return squel['insert']()['into'](_0xa38d('0x4e'))[_0xa38d('0x30')]([_0xa38d('0x4f'),_0xa38d('0x12'),_0xa38d('0x50'),'createdAt',_0xa38d('0x34')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x5486a4)[_0xa38d('0x13')]('cm_hopper')['join'](_0xa38d('0x37'),null,_0xa38d('0x51'))[_0xa38d('0x41')](_0xa38d('0x52'),null,_0xa38d('0x53'))[_0xa38d('0x15')](_0xa38d('0x54'),_0x360fe3)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW))['toString']();}function insertCmContact(_0x3a2a50,_0x2e041b,_0x41cfff,_0x4849cb){var _0x52a168=_[_0xa38d('0x55')](_['keys'](_0x4849cb),[_0xa38d('0x32'),_0xa38d('0x56'),_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x57')]);return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')](_0xa38d('0x37'))[_0xa38d('0x30')](_0x52a168,squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x52a168)['from'](_0x2e041b)['where']('('+_0x41cfff[_0xa38d('0x41')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x41cfff)[_0xa38d('0x13')](_0xa38d('0x37'))[_0xa38d('0x15')]('ListId\x20=\x20?',_0x3a2a50)[_0xa38d('0x15')](_0xa38d('0x58')))['where'](_0xa38d('0x59'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x5a'),'min_id')[_0xa38d('0x13')](_0x2e041b)['group'](_0x41cfff['join'](','))))[_0xa38d('0x3f')]();}function handleStop(){logger[_0xa38d('0x5b')](_0xa38d('0x5c'));stopped=!![];}function handleUncaughtException(_0x4a367e){logger[_0xa38d('0x5d')](_0x4a367e[_0xa38d('0x5e')]);process[_0xa38d('0x5f')](0x1);}function handleError(_0x2a8345,_0x365633){stats[_0xa38d('0x60')][_0xa38d('0x1c')]({'name':_0x365633[_0xa38d('0x61')],'message':_0x365633[_0xa38d('0x5e')],'row':_0x2a8345});}function handleQuery(_0x2be4fd){logger[_0xa38d('0x5b')](_0x2be4fd);return db[_0xa38d('0x62')][_0xa38d('0x63')](_0x2be4fd)[_0xa38d('0x64')](function(_0x1ed54b){results[_0xa38d('0x1c')](_0x1ed54b);})[_0xa38d('0x65')](function(_0x2678c4){logger['error'](_0x2678c4[_0xa38d('0x5e')]);});}function updateTzCampaigns(_0x4b97a4){return new Promise(function(_0xce8e3a,_0x4c3705){var _0x496c6f=squel[_0xa38d('0x11')]()[_0xa38d('0x40')]([_0xa38d('0x66'),_0xa38d('0x67')])['from']('campaigns')[_0xa38d('0x41')](_0xa38d('0x68'),null,_0xa38d('0x69'))[_0xa38d('0x15')](_0xa38d('0x6a')+_0x4b97a4);db[_0xa38d('0x62')][_0xa38d('0x63')](_0x496c6f[_0xa38d('0x3f')]())[_0xa38d('0x64')](function(_0x2cce30){var _0x33477c=[];for(var _0x42b712=0x0;_0x42b712<_0x2cce30[_0xa38d('0x1b')];_0x42b712++){_0x33477c[_0xa38d('0x1c')](getTimezoneData(_0x2cce30[_0x42b712],tmp_campaigns));}BPromise[_0xa38d('0x1d')](_0x33477c)[_0xa38d('0x1a')](function(){_0xce8e3a({'val':0x1});});})[_0xa38d('0x65')](function(_0x25f124){logger[_0xa38d('0x5d')](_0x25f124[_0xa38d('0x5e')]);_0xce8e3a({'val':0x0});});});}function updateTzVoiceQueues(_0x5efa7d){return new Promise(function(_0x110467,_0x5699e5){var _0x30c8cf=squel['select']()[_0xa38d('0x40')]([_0xa38d('0x6b'),_0xa38d('0x6c')])[_0xa38d('0x13')](_0xa38d('0x6d'))['join'](_0xa38d('0x6e'),null,_0xa38d('0x6f'))[_0xa38d('0x15')](_0xa38d('0x70')+_0x5efa7d);db[_0xa38d('0x62')]['query'](_0x30c8cf['toString']())[_0xa38d('0x64')](function(_0x25d073){var _0x26ab9c=[];for(var _0x3efd99=0x0;_0x3efd99<_0x25d073[_0xa38d('0x1b')];_0x3efd99++){_0x26ab9c[_0xa38d('0x1c')](getTimezoneData(_0x25d073[_0x3efd99],tmp_voice_queues));}BPromise[_0xa38d('0x1d')](_0x26ab9c)['then'](function(){_0x110467({'val':0x1});});})[_0xa38d('0x65')](function(_0x1bc1a5){logger[_0xa38d('0x5d')](_0x1bc1a5['message']);_0x110467({'val':0x0});});});}function getTimezoneData(_0xb107e6,_0xfc9d61){return new Promise(function(_0x5c2b68,_0x1857f9){var _0x5b6046=shared['timezones'];var _0x565ef1=_0x5b6046[_0xb107e6['dialTimezone']];if(_[_0xa38d('0x1f')](_0x565ef1)){_0x5c2b68({'ret':0x1});}else{var _0x33bcc8=_0x565ef1['utcOffset'];var _0x55411b=squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')](_0xfc9d61)[_0xa38d('0x71')]('id',_0xb107e6['id'])[_0xa38d('0x71')]('offset',_0x33bcc8)[_0xa38d('0x71')](_0xa38d('0x72'),_0xb107e6['dialTimezone'])[_0xa38d('0x3f')]();return db[_0xa38d('0x62')][_0xa38d('0x63')](_0x55411b)[_0xa38d('0x64')](function(_0x390732){_0x5c2b68({'ret':0x1});})[_0xa38d('0x65')](function(_0x4f9542){logger[_0xa38d('0x5d')](_0x4f9542[_0xa38d('0x5e')]);_0x1857f9({'ret':0x1});});}});}function handleTZQuery(_0x551b4f){logger[_0xa38d('0x5b')](_0x551b4f);return db['sequelize'][_0xa38d('0x63')](_0x551b4f)[_0xa38d('0x64')](function(_0x532838){})['catch'](function(_0xfcf76b){logger[_0xa38d('0x5d')](_0xfcf76b['message']);});}function main(_0x704ea1,_0x49baba,_0x3fabb0,_0x391ff4){logger['info'](_0xa38d('0x73'),_0x704ea1,JSON['stringify'](_0x49baba));process[_0xa38d('0x74')](_0xa38d('0x75'));var _0x322161=_0x49baba[_0xa38d('0x76')];var _0x5b1eb0=_[_0xa38d('0x77')](_0x322161);var _0x3638ab=_0x49baba[_0xa38d('0x78')];var _0x3e3ca9=path['join'](config['root'],_0xa38d('0x79'),_0x3638ab+_0xa38d('0x7a'));hasTZ=_[_0xa38d('0x7b')](_0x322161)[_0xa38d('0x7c')](_0xa38d('0x72'));var _0x1896f3=_[_0xa38d('0x7b')](_0x322161)['join']();logger[_0xa38d('0x5b')](_0xa38d('0x7d'),_0x1896f3);db[_0xa38d('0x7e')][_0xa38d('0x18')]({'raw':!![],'attributes':['id',_0xa38d('0x7f')]})[_0xa38d('0x1a')](function(_0x3d6538){for(var _0xab4974=0x0;_0xab4974<_0x3d6538[_0xa38d('0x1b')];_0xab4974++){if(_0x3d6538[_0xab4974]['name']in _0x322161){contactItemTypes['push'](_0x3d6538[_0xab4974]);delete _0x5b1eb0[_0x3d6538[_0xab4974][_0xa38d('0x7f')]];hasAdditionalPhones=!![];}for(var _0x3143a3 in _0x322161){if(_0x3d6538[_0xab4974][_0xa38d('0x7f')]+'_description'===_0x3143a3){phoneDescriptions[_0xa38d('0x1c')]({'itemTypeId':_0x3d6538[_0xab4974]['id'],'description':_0x3143a3});delete _0x5b1eb0[_0x3143a3];}}}if(hasAdditionalPhones)_0x5b1eb0[_0xa38d('0x19')]='';var _0x36b5ec=_['keys'](_0x5b1eb0)['join']();logger[_0xa38d('0x5b')](_0xa38d('0x7d'),_0x36b5ec);fs[_0xa38d('0x80')](_0x3e3ca9,_0x36b5ec+'\x0a');Papa[_0xa38d('0x81')](fs[_0xa38d('0x82')](_0x704ea1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x467c54,_0x2a23cd){try{for(var _0x4b1e38=0x0,_0x4f2114=[];_0x4b1e38<_0x467c54[_0xa38d('0x83')][_0xa38d('0x1b')];_0x4b1e38++){stats[_0xa38d('0x84')]+=0x1;if(_0x467c54['errors'][_0x4b1e38]){handleError(_0x467c54[_0xa38d('0x83')][_0x4b1e38],_0x467c54[_0xa38d('0x60')][_0x4b1e38]);}else{var _0x11b1cd=[];var _0x5c44a5=[];var _0x5dd5ff={};for(var _0x52b038 in _0x322161){let _0x286c69=contactItemTypes[_0xa38d('0x85')](_0x32c322=>_0x32c322[_0xa38d('0x7f')]===_0x52b038);let _0x5fe711=contactItemTypes[_0xa38d('0x85')](_0x2f45e8=>_0x2f45e8[_0xa38d('0x7f')]+_0xa38d('0x86')===_0x52b038);if(_[_0xa38d('0x1f')](_0x286c69)&&_[_0xa38d('0x1f')](_0x5fe711)){if(_0x322161['hasOwnProperty'](_0x52b038)){if(_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]]){var _0x832ab4=_['trim'](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]]['replace'](/"/g,'\x27'));switch(_0x52b038){case _0xa38d('0x87'):var _0x5bcdef=moment(_0x832ab4,_0xa38d('0xf'),!![]);if(_0x5bcdef['isValid']()){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd[_0xa38d('0x1c')](_0xa38d('0x88'));}break;case'priority':var _0x46d72e=parseInt(_0x832ab4);_0x832ab4=_[_0xa38d('0x89')](_0x46d72e)||_0x46d72e<0x0||_0x46d72e>0x4?_0x391ff4?0x3:0x2:_0x46d72e;_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');break;case'UserId':var _0x291378=parseInt(_0x832ab4);if(_['isNumber'](_0x291378)&&_['includes'](_0x3fabb0,_0x291378)){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x291378+'\x22');}else{_0x11b1cd[_0xa38d('0x1c')](_0xa38d('0x8a'));}break;case'email':if(isEmail(_0x832ab4)){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd['push'](_0xa38d('0x8b'));}break;case'dateOfBirth':var _0x2bb53e=moment(_0x832ab4,_0xa38d('0x8c'),!![]);if(_0x2bb53e[_0xa38d('0x8d')]()){_0x4f2114['push']('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd['push'](_0xa38d('0x8e'));}break;case _0xa38d('0x72'):var _0x4ac936=shared['timezones'];var _0x5eef7a=_0x4ac936[_0x832ab4];if(!_['isNil'](_0x5eef7a)){var _0x23eafb=_0x5eef7a[_0xa38d('0x8f')];_0x4f2114['push']('\x22'+_0x832ab4+'\x22');_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x23eafb+'\x22');}break;default:_0x4f2114['push']('\x22'+_0x832ab4+'\x22');}}else{switch(_0x52b038){case _0xa38d('0x90'):case'phone':_0x11b1cd[_0xa38d('0x1c')](_0x52b038+'\x20not\x20specified');break;default:_0x4f2114[_0xa38d('0x1c')]('\x22\x22');}}}}else{var _0x49d6b0='';if(!_[_0xa38d('0x1f')](_0x286c69)){if(!_0x5dd5ff[_0xa38d('0x91')](_0x286c69['id'])){if(!_[_0xa38d('0x1f')](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]])){var _0x832ab4=_['trim'](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]][_0xa38d('0x92')](/"/g,'\x27'));var _0x4efade=phoneDescriptions[_0xa38d('0x85')](_0x423ba9=>_0x423ba9[_0xa38d('0x93')]===_0x286c69['id']);if(!_[_0xa38d('0x1f')](_0x4efade)){var _0x247af9=_[_0xa38d('0x94')](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x4efade[_0xa38d('0x95')]]][_0xa38d('0x92')](/"/g,'\x27'));if(!_[_0xa38d('0x1f')](_0x247af9))_0x832ab4=_0x832ab4+'§'+_0x247af9;}if(_0x49d6b0=='')_0x49d6b0=_0x832ab4;else _0x49d6b0+='|'+_0x832ab4;}_0x5c44a5[_0xa38d('0x1c')](_0x286c69['id']+':'+_0x49d6b0);_0x5dd5ff[_0x286c69['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f2114['push']('\x22'+_0x5c44a5[_0xa38d('0x41')](';')+'\x22');}if(_0x11b1cd[_0xa38d('0x1b')]){handleError(_0x467c54['data'][_0x4b1e38],{'code':'SystemRow','message':_0x11b1cd[_0xa38d('0x41')]()});}else{fs[_0xa38d('0x96')](_0x3e3ca9,_0x4f2114['join']()+'\x0a');}_0x4f2114=[];}if(!(stats[_0xa38d('0x84')]%0xc8)){socket[_0xa38d('0x97')](_0xa38d('0x98')+_0x3638ab,stats);stats[_0xa38d('0x60')]=[];}}if(stopped){logger[_0xa38d('0x5b')](_0xa38d('0x99'));_0x2a23cd[_0xa38d('0x9a')]();}}catch(_0xe99996){handleError(_0x467c54[_0xa38d('0x83')][_0x4b1e38],{'code':_0xa38d('0x9b'),'message':_0xe99996[_0xa38d('0x5e')]});logger['error'](_0xa38d('0x9c'),_0xe99996[_0xa38d('0x5e')]);}},'complete':function(){try{var _0x483623=[];var _0x5c0dec=[];var _0x2339c5=_0xa38d('0x37');if(_0x49baba[_0xa38d('0x9d')]&&_0x49baba[_0xa38d('0x9d')][_0xa38d('0x1b')]){_0x2339c5='cm_contacts_'+_0x3638ab;_0x483623[_0xa38d('0x1c')](_0xa38d('0x9e')+_0x2339c5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa38d('0x9f')+_0x3638ab;tmp_voice_queues=_0xa38d('0xa0')+_0x3638ab;_0x5c0dec[_0xa38d('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xa38d('0xa1'));_0x5c0dec[_0xa38d('0x1c')](_0xa38d('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xa38d('0xa2')](_0x5c0dec,handleTZQuery)[_0xa38d('0x1a')](function(_0x83f6a8){updateTzCampaigns(_0x49baba[_0xa38d('0x32')])[_0xa38d('0x1a')](function(_0x2e2cfb){updateTzVoiceQueues(_0x49baba[_0xa38d('0x32')])[_0xa38d('0x1a')](function(_0x5cd1e0){if(hasTZ)_0x36b5ec=_0x36b5ec[_0xa38d('0x92')]('dialTimezone',_0xa38d('0xa3'));var _0x608914=util[_0xa38d('0xe')](_0xa38d('0xa4'),_0x3e3ca9,_0x2339c5,_0x36b5ec,_0x49baba[_0xa38d('0x32')],_0x49baba[_0xa38d('0x56')]||null,NOW,NOW);if(_[_0xa38d('0x1f')](_0x322161[_0xa38d('0x87')])){_0x608914+=_0xa38d('0xa5');}_0x483623[_0xa38d('0x1c')](_0x608914);if(_0x49baba[_0xa38d('0x9d')]&&_0x49baba[_0xa38d('0x9d')]['length']){_0x483623['push'](insertCmContact(_0x49baba['ListId'],_0x2339c5,_0x49baba[_0xa38d('0x9d')],_0x322161));_0x483623[_0xa38d('0x1c')](_0xa38d('0xa6')+_0x2339c5+';');}BPromise[_0xa38d('0xa2')](_0x483623,handleQuery)[_0xa38d('0x1a')](function(_0x205c9b){BPromise[_0xa38d('0x1d')]([handleAdditionalPhones()])[_0xa38d('0x1a')](function(){_0x483623=[];for(var _0xb5385d=0x0;_0xb5385d\x20\x20');}var _0x2e1c90=path['join'](config[_0xa38d('0xb0')],_0xa38d('0x79'),process[_0xa38d('0xb1')][0x2]);if(!fs['existsSync'](_0x2e1c90)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3d211f={};try{_0x3d211f=JSON['parse'](process[_0xa38d('0xb1')][0x3]);if(!_0x3d211f[_0xa38d('0x76')]){throw new Error(_0xa38d('0xb2'));}if(!_0x3d211f[_0xa38d('0x76')]['phone']){throw new Error(_0xa38d('0xb3'));}if(!_0x3d211f['binding'][_0xa38d('0x90')]){throw new Error(_0xa38d('0xb4'));}var _0x4ba233=0x0;if(_0x3d211f[_0xa38d('0x76')][_0xa38d('0x46')]){_0x4ba233=0x1;}if(!_0x3d211f[_0xa38d('0x32')]){throw new Error(_0xa38d('0xb5'));}}catch(_0x5bc48e){throw new Error(_0xa38d('0xb6'));}var _0x1e42d6=[];try{_0x1e42d6=_[_0xa38d('0xb7')](JSON[_0xa38d('0x81')](process['argv'][0x4]),'id');}catch(_0x5bbca){logger[_0xa38d('0x5b')]('No\x20agent\x20available');}main(_0x2e1c90,_0x3d211f,_0x1e42d6,_0x4ba233);}validate();process['on'](_0xa38d('0xb8'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x894b=['message','info','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','name','keys','header','writeFileSync','parse','createReadStream','data','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','split','isNil','length','filter','CmContactHasItem','findOne','updated','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','into','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','fields','from','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','ListId\x20=\x20?','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','cm_contacts.UserId','scheduledat','priority','recallme','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','error','exit','errors','code'];(function(_0x2311d5,_0x370ce7){var _0x12f67d=function(_0x151dfc){while(--_0x151dfc){_0x2311d5['push'](_0x2311d5['shift']());}};_0x12f67d(++_0x370ce7);}(_0x894b,0x123));var _0xb894=function(_0x35a1cb,_0x5985c3){_0x35a1cb=_0x35a1cb-0x0;var _0x2cd095=_0x894b[_0x35a1cb];return _0x2cd095;};'use strict';var fs=require('fs');var path=require(_0xb894('0x0'));var _=require(_0xb894('0x1'));var Papa=require(_0xb894('0x2'));var util=require(_0xb894('0x3'));var BPromise=require('bluebird');var moment=require(_0xb894('0x4'));var squel=require(_0xb894('0x5'));var Redis=require('ioredis');var db=require(_0xb894('0x6'))['db'];var config=require(_0xb894('0x7'));var shared=require(_0xb894('0x8'));var logger=require(_0xb894('0x9'))(_0xb894('0xa'));config[_0xb894('0xb')]=_[_0xb894('0xc')](config['redis'],{'host':_0xb894('0xd'),'port':0x18eb});var socket=require(_0xb894('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb894('0xf')](_0xb894('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xb894('0x10'));function isEmail(_0x1073a3){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))*$/[_0xb894('0x11')](_0x1073a3);}function selectNotIn(_0x495abe,_0x200610,_0x26b0f1,_0x4fb4ae,_0x26debc){return squel[_0xb894('0x12')]()[_0xb894('0x13')](_0xb894('0x14'))['from'](_0x4fb4ae)[_0xb894('0x15')](_0x200610,null,_0x200610+_0xb894('0x16')+_0x4fb4ae+'.'+_0x26b0f1)[_0xb894('0x17')](_0x4fb4ae+'.'+_0x26b0f1+_0xb894('0x18')+_0x495abe+'.'+_0x26b0f1)[_0xb894('0x17')](_0x200610+_0xb894('0x19')+_0x26debc['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x312785,_0xe04630){promisesAdditionalPhones=[];return db[_0xb894('0x1a')][_0xb894('0x1b')]({'raw':!![],'attributes':['id',_0xb894('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb894('0x1d')](function(_0x1e2271){if(_0x1e2271!==null){var _0x347a21=[];for(var _0x2e4420=0x0;_0x2e4420<_0x1e2271['length'];_0x2e4420++){var _0x3328d4=_0x1e2271[_0x2e4420];_0x347a21[_0xb894('0x1e')](insertAdditionalPhones(_0x3328d4));}}Promise['all'](_0x347a21)['then'](function(){_0x312785({'val':0x1});});});});}function insertAdditionalPhones(_0x17a492){return new Promise(function(_0x21524b,_0x4e4adb){var _0x48a3d0=_0x17a492[_0xb894('0x1c')];var _0x4105c2=_0x48a3d0[_0xb894('0x1f')](';');var _0x100833=[];orderBy=0x0;for(var _0x5a9647=0x0;_0x5a9647<_0x4105c2['length'];_0x5a9647++){_0x100833['push'](splitAdditionalPhone(_0x17a492['id'],_0x4105c2[_0x5a9647]));}Promise['all'](_0x100833)[_0xb894('0x1d')](function(){_0x21524b({'val':_0x4105c2['length']});});});}function splitAdditionalPhone(_0x568e74,_0x2e9c06){return new Promise(function(_0x222e8e,_0x46438b){var _0x234046=_0x2e9c06[_0xb894('0x1f')](':');var _0x18f92e=_0x234046[0x0];var _0x5525db=_0x234046[0x1];if(!_[_0xb894('0x20')](_0x5525db)){var _0x22e24b=_0x5525db['split']('|');var _0x3c50ab=[];for(var _0x272fb8=0x0;_0x272fb8<_0x22e24b[_0xb894('0x21')];_0x272fb8++){if(_0x22e24b[_0x272fb8]!==''){var _0x502689=_[_0xb894('0x22')](promisesAdditionalPhones,{'contactId':_0x568e74,'phone':_0x22e24b[_0x272fb8]});if(_0x502689[_0xb894('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x568e74,'contactTypeId':_0x18f92e,'phone':_0x22e24b[_0x272fb8],'orderBy':orderBy});}}}_0x222e8e({'ok':0x1});}else _0x222e8e({'res':0x0});});}function createAdditionalPhone(_0x327a71,_0x62ee9,_0xa492c3,_0x5ad173){var _0x4981e5='';var _0x3bf51c='';var _0x886452=_0xa492c3['split']('§');_0x4981e5=_0x886452[0x0];if(_0x886452[_0xb894('0x21')]==0x2)_0x3bf51c=_0x886452[0x1];return new Promise(function(_0x176b4d,_0x10601c){return db[_0xb894('0x23')][_0xb894('0x24')]({'where':{'CmContactId':_0x327a71,'item':_0x4981e5}})[_0xb894('0x1d')](function(_0x259b9d){if(_0x259b9d){return db[_0xb894('0x23')]['update']({'ItemTypeId':_0x62ee9,'description':_0x3bf51c,'OrderBy':_0x5ad173},{'where':{'CmContactId':_0x327a71,'item':_0x4981e5}})['then'](function(_0x2607af){_0x176b4d({'res':_0xb894('0x25')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x327a71,'item':_0x4981e5,'description':_0x3bf51c,'ItemTypeId':_0x62ee9,'OrderBy':_0x5ad173,'ItemClass':_0xb894('0x26')})['then'](function(_0x178aa9){_0x176b4d({'res':_0xb894('0x27')});});}});});}function insertCmHopper(_0x1aacf0,_0x3b5e69,_0x1bf71f,_0x563725,_0x52a9ee){var _0x4db1d7=['cm_contacts.phone',_0xb894('0x28'),_0xb894('0x29'),_0xb894('0x2a'),_0x3b5e69+'.'+_0x563725,_0xb894('0x2b'),'cm_contacts.updatedAt',_0xb894('0x2c'),'cm_contacts.UserId','\x22'+_0x52a9ee+'\x22'];return squel['insert']()[_0xb894('0x2d')]('cm_hopper')[_0xb894('0x2e')]([_0xb894('0x14'),'scheduledat',_0xb894('0x2f'),_0xb894('0x30'),_0x563725,_0xb894('0x31'),_0xb894('0x32'),'priority',_0xb894('0x33'),'recallme'],squel[_0xb894('0x12')]()[_0xb894('0x34')](_0x4db1d7)[_0xb894('0x35')](_0x3b5e69)[_0xb894('0x15')](_0xb894('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x3b5e69+_0xb894('0x37'))['join'](_0x1bf71f,null,_0x1bf71f+_0xb894('0x16')+_0x3b5e69+'.'+_0x563725)[_0xb894('0x17')](_0x3b5e69+'.CmListId\x20=\x20?',_0x1aacf0)['where'](_0xb894('0x38'),NOW)[_0xb894('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b5e69,_0x1bf71f,_0x563725,_0xb894('0x39'),[_0xb894('0x3a'),_0xb894('0x3b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b5e69,_0x1bf71f,_0x563725,_0xb894('0x39'),[_0xb894('0x3a')])))[_0xb894('0x3c')]();}function insertCmHopperBlack(_0x599384,_0x4e1400,_0x82550,_0x2d083a){var _0x23e534=['cm_contacts.phone','cm_contacts.id',_0xb894('0x2a'),_0x4e1400+'.'+_0x2d083a,_0xb894('0x2b'),'cm_contacts.updatedAt'];return squel[_0xb894('0x3d')]()[_0xb894('0x2d')]('cm_hopper_black')['fromQuery']([_0xb894('0x14'),_0xb894('0x2f'),_0xb894('0x30'),_0x2d083a,'createdAt','updatedAt'],squel[_0xb894('0x12')]()['fields'](_0x23e534)[_0xb894('0x35')](_0x4e1400)[_0xb894('0x15')](_0xb894('0x36'),null,_0xb894('0x3e')+_0x4e1400+_0xb894('0x37'))[_0xb894('0x15')](_0x82550,null,_0x82550+_0xb894('0x16')+_0x4e1400+'.'+_0x2d083a)[_0xb894('0x17')](_0x4e1400+_0xb894('0x3f'),_0x599384)[_0xb894('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb894('0x17')](_0xb894('0x40'),squel[_0xb894('0x12')]()[_0xb894('0x13')]('phone')[_0xb894('0x35')](_0xb894('0x41'))['where'](_0xb894('0x42'),_0x599384)[_0xb894('0x17')](_0x2d083a+_0xb894('0x18')+_0x4e1400+'.'+_0x2d083a)))['toString']();}function insertTzCmHopper(_0x2d5ed5,_0x4d5800,_0x10b3f3,_0x23fd28,_0x412eb,_0x5a761c){var _0xc43c07=[_0xb894('0x43'),_0xb894('0x44')+_0x5a761c+_0xb894('0x45'),_0xb894('0x29'),_0xb894('0x2a'),_0x4d5800+'.'+_0x23fd28,_0xb894('0x2b'),_0xb894('0x46'),_0xb894('0x2c'),_0xb894('0x47'),'\x22'+_0x412eb+'\x22'];var _0x36fc5f=squel[_0xb894('0x3d')]()['into'](_0xb894('0x39'))[_0xb894('0x2e')]([_0xb894('0x14'),_0xb894('0x48'),_0xb894('0x2f'),_0xb894('0x30'),_0x23fd28,_0xb894('0x31'),_0xb894('0x32'),_0xb894('0x49'),_0xb894('0x33'),_0xb894('0x4a')],squel[_0xb894('0x12')]()[_0xb894('0x34')](_0xc43c07)[_0xb894('0x35')](_0x4d5800)[_0xb894('0x15')](_0xb894('0x36'),null,_0xb894('0x3e')+_0x4d5800+_0xb894('0x37'))[_0xb894('0x15')](_0x10b3f3,null,_0x10b3f3+_0xb894('0x16')+_0x4d5800+'.'+_0x23fd28)['join'](_0x5a761c,null,_0x5a761c+_0xb894('0x16')+_0x4d5800+'.'+_0x23fd28)[_0xb894('0x17')](_0x4d5800+_0xb894('0x3f'),_0x2d5ed5)['where'](_0xb894('0x38'),NOW)[_0xb894('0x17')](_0xb894('0x40'),selectNotIn(_0x4d5800,_0x10b3f3,_0x23fd28,_0xb894('0x39'),[_0xb894('0x3a'),_0xb894('0x3b')]))[_0xb894('0x17')](_0xb894('0x40'),selectNotIn(_0x4d5800,_0x10b3f3,_0x23fd28,_0xb894('0x39'),[_0xb894('0x3a')])))[_0xb894('0x3c')]();return _0x36fc5f;}function insertTzCmHopperBlack(_0x1defea,_0x576681,_0x13ed9b,_0x1a64ad){var _0x159e35=[_0xb894('0x43'),'cm_contacts.id',_0xb894('0x2a'),_0x576681+'.'+_0x1a64ad,_0xb894('0x2b'),'cm_contacts.updatedAt'];return squel[_0xb894('0x3d')]()[_0xb894('0x2d')]('cm_hopper_black')[_0xb894('0x2e')]([_0xb894('0x14'),_0xb894('0x2f'),_0xb894('0x30'),_0x1a64ad,_0xb894('0x31'),_0xb894('0x32')],squel[_0xb894('0x12')]()[_0xb894('0x34')](_0x159e35)[_0xb894('0x35')](_0x576681)[_0xb894('0x15')]('cm_contacts',null,_0xb894('0x3e')+_0x576681+_0xb894('0x37'))[_0xb894('0x15')](_0x13ed9b,null,_0x13ed9b+_0xb894('0x16')+_0x576681+'.'+_0x1a64ad)[_0xb894('0x17')](_0x576681+_0xb894('0x3f'),_0x1defea)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb894('0x17')](_0xb894('0x40'),squel[_0xb894('0x12')]()[_0xb894('0x13')](_0xb894('0x14'))[_0xb894('0x35')](_0xb894('0x41'))[_0xb894('0x17')](_0xb894('0x42'),_0x1defea)[_0xb894('0x17')](_0x1a64ad+'\x20=\x20'+_0x576681+'.'+_0x1a64ad)))[_0xb894('0x3c')]();}function insertCmHopperAdditionalPhones(_0x2a14d0){var _0x141910=['cm_hopper.id',_0xb894('0x4b'),_0xb894('0x4c'),_0xb894('0x4d'),_0xb894('0x4e')];return squel[_0xb894('0x3d')]()[_0xb894('0x2d')](_0xb894('0x4f'))[_0xb894('0x2e')](['CmHopperId',_0xb894('0x14'),_0xb894('0x50'),_0xb894('0x31'),_0xb894('0x32')],squel[_0xb894('0x12')]()['fields'](_0x141910)[_0xb894('0x35')](_0xb894('0x39'))['join'](_0xb894('0x36'),null,_0xb894('0x51'))[_0xb894('0x15')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xb894('0x17')](_0xb894('0x52'),_0x2a14d0)[_0xb894('0x17')](_0xb894('0x38'),NOW))[_0xb894('0x3c')]();}function insertCmContact(_0x4c0612,_0x1df460,_0x3bdff7,_0xe45ebc){var _0x23e700=_[_0xb894('0x53')](_['keys'](_0xe45ebc),[_0xb894('0x30'),_0xb894('0x54'),'createdAt','updatedAt',_0xb894('0x55')]);return squel['insert']()[_0xb894('0x2d')](_0xb894('0x36'))[_0xb894('0x2e')](_0x23e700,squel[_0xb894('0x12')]()['fields'](_0x23e700)[_0xb894('0x35')](_0x1df460)[_0xb894('0x17')]('('+_0x3bdff7[_0xb894('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xb894('0x12')]()['fields'](_0x3bdff7)[_0xb894('0x35')](_0xb894('0x36'))[_0xb894('0x17')](_0xb894('0x42'),_0x4c0612)[_0xb894('0x17')](_0xb894('0x56')))[_0xb894('0x17')](_0xb894('0x57'),squel[_0xb894('0x12')]()['field'](_0xb894('0x58'),_0xb894('0x59'))[_0xb894('0x35')](_0x1df460)[_0xb894('0x5a')](_0x3bdff7[_0xb894('0x15')](','))))[_0xb894('0x3c')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4ffb75){logger[_0xb894('0x5b')](_0x4ffb75['message']);process[_0xb894('0x5c')](0x1);}function handleError(_0x231af2,_0x12b57b){stats[_0xb894('0x5d')][_0xb894('0x1e')]({'name':_0x12b57b[_0xb894('0x5e')],'message':_0x12b57b[_0xb894('0x5f')],'row':_0x231af2});}function handleQuery(_0x57a2f7){logger[_0xb894('0x60')](_0x57a2f7);return db[_0xb894('0x61')][_0xb894('0x62')](_0x57a2f7)[_0xb894('0x63')](function(_0x2c3683){results['push'](_0x2c3683);})[_0xb894('0x64')](function(_0x49c221){logger['error'](_0x49c221[_0xb894('0x5f')]);});}function updateTzCampaigns(_0xcf9b9b){return new Promise(function(_0x880f79,_0x60bd45){var _0x3fcbeb=squel[_0xb894('0x12')]()[_0xb894('0x34')]([_0xb894('0x65'),_0xb894('0x66')])['from'](_0xb894('0x67'))[_0xb894('0x15')](_0xb894('0x68'),null,_0xb894('0x69'))[_0xb894('0x17')](_0xb894('0x6a')+_0xcf9b9b);db[_0xb894('0x61')][_0xb894('0x62')](_0x3fcbeb[_0xb894('0x3c')]())['spread'](function(_0x2f26d9){var _0x5707c5=[];for(var _0x4465f4=0x0;_0x4465f4<_0x2f26d9['length'];_0x4465f4++){_0x5707c5[_0xb894('0x1e')](getTimezoneData(_0x2f26d9[_0x4465f4],tmp_campaigns));}BPromise[_0xb894('0x6b')](_0x5707c5)[_0xb894('0x1d')](function(){_0x880f79({'val':0x1});});})[_0xb894('0x64')](function(_0x111981){logger[_0xb894('0x5b')](_0x111981['message']);_0x880f79({'val':0x0});});});}function updateTzVoiceQueues(_0x1dac6a){return new Promise(function(_0x4b95d6,_0x15ad33){var _0x569470=squel[_0xb894('0x12')]()[_0xb894('0x34')](['voice_queues.id',_0xb894('0x6c')])[_0xb894('0x35')]('voice_queues')['join']('voice_queues_has_cm_lists',null,_0xb894('0x6d'))[_0xb894('0x17')](_0xb894('0x6e')+_0x1dac6a);db['sequelize'][_0xb894('0x62')](_0x569470[_0xb894('0x3c')]())['spread'](function(_0x48e27a){var _0xacf2ac=[];for(var _0x2c853d=0x0;_0x2c853d<_0x48e27a[_0xb894('0x21')];_0x2c853d++){_0xacf2ac[_0xb894('0x1e')](getTimezoneData(_0x48e27a[_0x2c853d],tmp_voice_queues));}BPromise[_0xb894('0x6b')](_0xacf2ac)[_0xb894('0x1d')](function(){_0x4b95d6({'val':0x1});});})['catch'](function(_0x43cc3d){logger[_0xb894('0x5b')](_0x43cc3d[_0xb894('0x5f')]);_0x4b95d6({'val':0x0});});});}function getTimezoneData(_0x157f5f,_0x52d432){return new Promise(function(_0x45d0a7,_0x33172b){var _0xc985c1=shared[_0xb894('0x6f')];var _0x17a1fd=_0xc985c1[_0x157f5f[_0xb894('0x70')]];if(_[_0xb894('0x20')](_0x17a1fd)){_0x45d0a7({'ret':0x1});}else{var _0x3e0733=_0x17a1fd[_0xb894('0x71')];var _0x3b2b53=squel[_0xb894('0x3d')]()[_0xb894('0x2d')](_0x52d432)[_0xb894('0x72')]('id',_0x157f5f['id'])[_0xb894('0x72')](_0xb894('0x73'),_0x3e0733)['set'](_0xb894('0x70'),_0x157f5f['dialTimezone'])['toString']();return db['sequelize'][_0xb894('0x62')](_0x3b2b53)[_0xb894('0x63')](function(_0x17d8e5){_0x45d0a7({'ret':0x1});})['catch'](function(_0x406d0f){logger[_0xb894('0x5b')](_0x406d0f[_0xb894('0x5f')]);_0x33172b({'ret':0x1});});}});}function handleTZQuery(_0x38b444){logger[_0xb894('0x60')](_0x38b444);return db[_0xb894('0x61')][_0xb894('0x62')](_0x38b444)['spread'](function(_0x3836c7){})[_0xb894('0x64')](function(_0x374e84){logger[_0xb894('0x5b')](_0x374e84[_0xb894('0x5f')]);});}function main(_0x48319b,_0x5b2f66,_0x4e8c2f,_0x3c4fe3){logger['info'](_0xb894('0x74'),_0x48319b,JSON[_0xb894('0x75')](_0x5b2f66));process['send'](_0xb894('0x76'));var _0x4ab7a6=_0x5b2f66[_0xb894('0x77')];var _0x38400d=_[_0xb894('0x78')](_0x4ab7a6);var _0x2f2f3c=_0x5b2f66[_0xb894('0x79')];var _0x147951=path[_0xb894('0x15')](config[_0xb894('0x7a')],_0xb894('0x7b'),_0x2f2f3c+_0xb894('0x7c'));hasTZ=_['keys'](_0x4ab7a6)[_0xb894('0x7d')]('dialTimezone');var _0x14f508=_['keys'](_0x4ab7a6)['join']();logger[_0xb894('0x60')]('header',_0x14f508);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xb894('0x7e')]})[_0xb894('0x1d')](function(_0x347d94){for(var _0xaaddcb=0x0;_0xaaddcb<_0x347d94[_0xb894('0x21')];_0xaaddcb++){if(_0x347d94[_0xaaddcb][_0xb894('0x7e')]in _0x4ab7a6){contactItemTypes[_0xb894('0x1e')](_0x347d94[_0xaaddcb]);delete _0x38400d[_0x347d94[_0xaaddcb][_0xb894('0x7e')]];hasAdditionalPhones=!![];}for(var _0x53c8b4 in _0x4ab7a6){if(_0x347d94[_0xaaddcb][_0xb894('0x7e')]+'_description'===_0x53c8b4){phoneDescriptions[_0xb894('0x1e')]({'itemTypeId':_0x347d94[_0xaaddcb]['id'],'description':_0x53c8b4});delete _0x38400d[_0x53c8b4];}}}if(hasAdditionalPhones)_0x38400d['AdditionalPhones']='';var _0x24c2ef=_[_0xb894('0x7f')](_0x38400d)[_0xb894('0x15')]();logger[_0xb894('0x60')](_0xb894('0x80'),_0x24c2ef);fs[_0xb894('0x81')](_0x147951,_0x24c2ef+'\x0a');Papa[_0xb894('0x82')](fs[_0xb894('0x83')](_0x48319b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x102952,_0x285a30){try{for(var _0x22cf26=0x0,_0x595bc3=[];_0x22cf26<_0x102952[_0xb894('0x84')]['length'];_0x22cf26++){stats['rows']+=0x1;if(_0x102952[_0xb894('0x5d')][_0x22cf26]){handleError(_0x102952[_0xb894('0x84')][_0x22cf26],_0x102952['errors'][_0x22cf26]);}else{var _0x3e5f0a=[];var _0x3ba941=[];var _0x386c0d={};for(var _0x87b5a8 in _0x4ab7a6){let _0x2bcc19=contactItemTypes[_0xb894('0x85')](_0x1190dc=>_0x1190dc[_0xb894('0x7e')]===_0x87b5a8);let _0x56357b=contactItemTypes[_0xb894('0x85')](_0x2ae32e=>_0x2ae32e[_0xb894('0x7e')]+_0xb894('0x86')===_0x87b5a8);if(_['isNil'](_0x2bcc19)&&_[_0xb894('0x20')](_0x56357b)){if(_0x4ab7a6[_0xb894('0x87')](_0x87b5a8)){if(_0x102952[_0xb894('0x84')][_0x22cf26][_0x4ab7a6[_0x87b5a8]]){var _0x500870=_[_0xb894('0x88')](_0x102952[_0xb894('0x84')][_0x22cf26][_0x4ab7a6[_0x87b5a8]][_0xb894('0x89')](/"/g,'\x27'));switch(_0x87b5a8){case _0xb894('0x48'):var _0x4fbfa1=moment(_0x500870,_0xb894('0x10'),!![]);if(_0x4fbfa1[_0xb894('0x8a')]()){_0x595bc3[_0xb894('0x1e')]('\x22'+_0x500870+'\x22');}else{_0x3e5f0a[_0xb894('0x1e')](_0xb894('0x8b'));}break;case _0xb894('0x49'):var _0x12231e=parseInt(_0x500870);_0x500870=_[_0xb894('0x8c')](_0x12231e)||_0x12231e<0x0||_0x12231e>0x4?_0x3c4fe3?0x3:0x2:_0x12231e;_0x595bc3[_0xb894('0x1e')]('\x22'+_0x500870+'\x22');break;case _0xb894('0x33'):var _0x12314d=parseInt(_0x500870);if(_['isNumber'](_0x12314d)&&_[_0xb894('0x7d')](_0x4e8c2f,_0x12314d)){_0x595bc3[_0xb894('0x1e')]('\x22'+_0x12314d+'\x22');}else{_0x3e5f0a[_0xb894('0x1e')](_0xb894('0x8d'));}break;case'email':if(isEmail(_0x500870)){_0x595bc3[_0xb894('0x1e')]('\x22'+_0x500870+'\x22');}else{_0x3e5f0a['push'](_0xb894('0x8e'));}break;case _0xb894('0x8f'):var _0x5b745f=moment(_0x500870,_0xb894('0x90'),!![]);if(_0x5b745f[_0xb894('0x8a')]()){_0x595bc3[_0xb894('0x1e')]('\x22'+_0x500870+'\x22');}else{_0x3e5f0a[_0xb894('0x1e')](_0xb894('0x91'));}break;case _0xb894('0x70'):var _0xc2cd6e=shared[_0xb894('0x6f')];var _0x26b5e5=_0xc2cd6e[_0x500870];if(!_[_0xb894('0x20')](_0x26b5e5)){var _0x27069c=_0x26b5e5['utcOffset'];_0x595bc3['push']('\x22'+_0x500870+'\x22');_0x595bc3['push']('\x22'+_0x27069c+'\x22');}break;default:_0x595bc3['push']('\x22'+_0x500870+'\x22');}}else{switch(_0x87b5a8){case _0xb894('0x92'):case _0xb894('0x14'):_0x3e5f0a[_0xb894('0x1e')](_0x87b5a8+_0xb894('0x93'));break;default:_0x595bc3[_0xb894('0x1e')]('\x22\x22');}}}}else{var _0x1aebf4='';if(!_['isNil'](_0x2bcc19)){if(!_0x386c0d[_0xb894('0x87')](_0x2bcc19['id'])){if(!_[_0xb894('0x20')](_0x102952['data'][_0x22cf26][_0x4ab7a6[_0x87b5a8]])){var _0x500870=_['trim'](_0x102952['data'][_0x22cf26][_0x4ab7a6[_0x87b5a8]][_0xb894('0x89')](/"/g,'\x27'));var _0x2e15be=phoneDescriptions[_0xb894('0x85')](_0x2d3475=>_0x2d3475['itemTypeId']===_0x2bcc19['id']);if(!_[_0xb894('0x20')](_0x2e15be)){var _0xc5df5d=_[_0xb894('0x88')](_0x102952[_0xb894('0x84')][_0x22cf26][_0x4ab7a6[_0x2e15be[_0xb894('0x94')]]]['replace'](/"/g,'\x27'));if(!_[_0xb894('0x20')](_0xc5df5d))_0x500870=_0x500870+'§'+_0xc5df5d;}if(_0x1aebf4=='')_0x1aebf4=_0x500870;else _0x1aebf4+='|'+_0x500870;}_0x3ba941[_0xb894('0x1e')](_0x2bcc19['id']+':'+_0x1aebf4);_0x386c0d[_0x2bcc19['id']]=0x1;}}}}if(hasAdditionalPhones){_0x595bc3['push']('\x22'+_0x3ba941[_0xb894('0x15')](';')+'\x22');}if(_0x3e5f0a[_0xb894('0x21')]){handleError(_0x102952[_0xb894('0x84')][_0x22cf26],{'code':_0xb894('0x95'),'message':_0x3e5f0a[_0xb894('0x15')]()});}else{fs[_0xb894('0x96')](_0x147951,_0x595bc3[_0xb894('0x15')]()+'\x0a');}_0x595bc3=[];}if(!(stats['rows']%0xc8)){socket[_0xb894('0x97')](_0xb894('0x98')+_0x2f2f3c,stats);stats[_0xb894('0x5d')]=[];}}if(stopped){logger[_0xb894('0x60')](_0xb894('0x99'));_0x285a30[_0xb894('0x9a')]();}}catch(_0x4810ae){handleError(_0x102952['data'][_0x22cf26],{'code':_0xb894('0x9b'),'message':_0x4810ae[_0xb894('0x5f')]});logger[_0xb894('0x5b')](_0xb894('0x9c'),_0x4810ae[_0xb894('0x5f')]);}},'complete':function(){try{var _0x56be76=[];var _0x70fcb6=[];var _0x59539a='cm_contacts';if(_0x5b2f66[_0xb894('0x9d')]&&_0x5b2f66['duplicates']['length']){_0x59539a=_0xb894('0x9e')+_0x2f2f3c;_0x56be76[_0xb894('0x1e')](_0xb894('0x9f')+_0x59539a+_0xb894('0xa0'));}tmp_campaigns=_0xb894('0xa1')+_0x2f2f3c;tmp_voice_queues=_0xb894('0xa2')+_0x2f2f3c;_0x70fcb6[_0xb894('0x1e')](_0xb894('0x9f')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x70fcb6[_0xb894('0x1e')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xb894('0xa3'));BPromise[_0xb894('0xa4')](_0x70fcb6,handleTZQuery)['then'](function(_0x34bb4e){updateTzCampaigns(_0x5b2f66[_0xb894('0x30')])['then'](function(_0x22684f){updateTzVoiceQueues(_0x5b2f66[_0xb894('0x30')])[_0xb894('0x1d')](function(_0x2074a5){if(hasTZ)_0x24c2ef=_0x24c2ef[_0xb894('0x89')](_0xb894('0x70'),_0xb894('0xa5'));var _0x589938=util[_0xb894('0xf')](_0xb894('0xa6'),_0x147951,_0x59539a,_0x24c2ef,_0x5b2f66[_0xb894('0x30')],_0x5b2f66[_0xb894('0x54')]||null,NOW,NOW);if(_[_0xb894('0x20')](_0x4ab7a6['scheduledat'])){_0x589938+=_0xb894('0xa7');}_0x56be76[_0xb894('0x1e')](_0x589938);if(_0x5b2f66['duplicates']&&_0x5b2f66[_0xb894('0x9d')][_0xb894('0x21')]){_0x56be76[_0xb894('0x1e')](insertCmContact(_0x5b2f66[_0xb894('0x30')],_0x59539a,_0x5b2f66['duplicates'],_0x4ab7a6));_0x56be76[_0xb894('0x1e')](_0xb894('0xa8')+_0x59539a+';');}BPromise[_0xb894('0xa4')](_0x56be76,handleQuery)['then'](function(_0x1576e6){BPromise[_0xb894('0x6b')]([handleAdditionalPhones()])[_0xb894('0x1d')](function(){_0x56be76=[];for(var _0x263aaa=0x0;_0x263aaa_0x404a01[_0xa531('0x68')]===_0x5aac81);let _0x12330f=contactItemTypes[_0xa531('0x70')](_0x165c4e=>_0x165c4e[_0xa531('0x68')]+_0xa531('0x69')===_0x5aac81);if(_[_0xa531('0x71')](_0x250229)&&_[_0xa531('0x71')](_0x12330f)){if(_0x1cf6aa['hasOwnProperty'](_0x5aac81)){if(_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81]]){var _0x368039=_['trim'](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81]][_0xa531('0x72')](/"/g,'\x27'));switch(_0x5aac81){case'scheduledat':var _0x36c29c=moment(_0x368039,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x36c29c[_0xa531('0x73')]()){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9[_0xa531('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x21ca85=parseInt(_0x368039);_0x368039=_['isNaN'](_0x21ca85)||_0x21ca85<0x0||_0x21ca85>0x4?_0x132f9e?0x3:0x2:_0x21ca85;_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');break;case _0xa531('0x3c'):var _0x44e590=parseInt(_0x368039);if(_[_0xa531('0x74')](_0x44e590)&&_['includes'](_0x3f01c6,_0x44e590)){_0x57d0c0['push']('\x22'+_0x44e590+'\x22');}else{_0x4230e9['push'](_0xa531('0x75'));}break;case _0xa531('0x76'):if(isEmail(_0x368039)){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x5418e9=moment(_0x368039,'YYYY-MM-DD',!![]);if(_0x5418e9[_0xa531('0x73')]()){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9[_0xa531('0x1d')](_0xa531('0x77'));}break;default:_0x57d0c0['push']('\x22'+_0x368039+'\x22');}}else{switch(_0x5aac81){case _0xa531('0x78'):case _0xa531('0x15'):_0x4230e9[_0xa531('0x1d')](_0x5aac81+_0xa531('0x79'));break;default:_0x57d0c0[_0xa531('0x1d')]('\x22\x22');}}}}else{var _0x487b90='';if(!_[_0xa531('0x71')](_0x250229)){if(!_0x16dd7a[_0xa531('0x7a')](_0x250229['id'])){for(var _0xf500cd=0x0;_0xf500cd<_0x1cf6aa[_0x5aac81][_0xa531('0x1b')];_0xf500cd++){var _0x368039=_[_0xa531('0x7b')](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81][_0xf500cd]]['replace'](/"/g,'\x27'));var _0x5ccc51=phoneDescriptions[_0xa531('0x70')](_0x103f56=>_0x103f56[_0xa531('0x7c')]===_0x250229['id']);if(!_[_0xa531('0x71')](_0x5ccc51)){var _0x882fe0=_[_0xa531('0x7b')](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5ccc51[_0xa531('0x7d')]][0x0]][_0xa531('0x72')](/"/g,'\x27'));if(!_[_0xa531('0x71')](_0x882fe0))_0x368039=_0x368039+'§'+_0x882fe0;}if(_0x487b90=='')_0x487b90=_0x368039;else _0x487b90+='|'+_0x368039;}_0x23985e[_0xa531('0x1d')](_0x250229['id']+':'+_0x487b90);_0x16dd7a[_0x250229['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x23985e[_0xa531('0x16')](';')+'\x22');}if(_0x4230e9['length']){handleError(_0x196ea3[_0xa531('0x6e')][_0x345be8],{'code':_0xa531('0x7e'),'message':_0x4230e9[_0xa531('0x16')]()});}else{fs['appendFileSync'](_0x41342a,_0x57d0c0[_0xa531('0x16')]()+'\x0a');}_0x57d0c0=[];}if(!(stats[_0xa531('0x6f')]%0xc8)){socket[_0xa531('0x7f')](_0xa531('0x80')+_0x494a30,stats);stats[_0xa531('0x59')]=[];}}if(stopped){logger['info'](_0xa531('0x81'));_0xadbd2d['abort']();}}catch(_0x2c2b95){handleError(_0x196ea3[_0xa531('0x6e')][_0x345be8],{'code':_0xa531('0x82'),'message':_0x2c2b95['message']});logger['error'](_0xa531('0x83'),_0x2c2b95['message']);}},'complete':function(){try{var _0x58b737=[];var _0x38dc89=tempTableName;_0x58b737['push'](_0xa531('0x84')+_0x38dc89+_0xa531('0x85'));logger[_0xa531('0x57')](_0xa531('0x86'),contactItemTypes[_0xa531('0x1b')]);var _0x388022=util[_0xa531('0x87')](_0xa531('0x88'),_0x41342a,_0x38dc89,_0x245cb7,_0x205b48[_0xa531('0x39')],_0x205b48[_0xa531('0x53')]||null,NOW,NOW);if(_['isNil'](_0x1cf6aa[_0xa531('0x37')])){_0x388022+=_0xa531('0x89');}_0x58b737[_0xa531('0x1d')](_0x388022);BPromise[_0xa531('0x8a')](_0x58b737,handleQuery)[_0xa531('0x1e')](function(_0x7a68b7){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x58b737=[];for(var _0x729e1=0x0;_0x729e1\x20\x20');}var _0x4a1a33=path['join'](config[_0xa531('0x62')],_0xa531('0x63'),process['argv'][0x2]);if(!fs['existsSync'](_0x4a1a33)){throw new Error(_0xa531('0x93'));}var _0x522100={};try{_0x522100=JSON[_0xa531('0x6c')](process['argv'][0x3]);if(!_0x522100[_0xa531('0x60')]){throw new Error(_0xa531('0x94'));}var _0x43c8dc=0x0;if(_0x522100['binding'][_0xa531('0x3c')]){_0x43c8dc=0x1;}if(!_0x522100[_0xa531('0x39')]){throw new Error(_0xa531('0x95'));}}catch(_0x21f90e){throw new Error('body\x20id\x20mandatory');}var _0x4b3859=[];try{_0x4b3859=_[_0xa531('0x96')](JSON[_0xa531('0x6c')](process[_0xa531('0x97')][0x4]),'id');}catch(_0x359cac){logger['info']('No\x20agent\x20available');}main(_0x4a1a33,_0x522100,_0x4b3859,_0x43c8dc);}validate();process['on']('SIGINT',handleStop);process['on'](_0xa531('0x98'),handleUncaughtException); \ No newline at end of file +var _0xf6ed=['abort','SystemError','step','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','ioredis','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','all','then','error','message','AdditionalPhones','length','split','findOne','CmContactHasItem','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.createdAt','into','cm_hopper_black','fromQuery','ListId','select','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','errors','catch','main','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','itemTypeId','SystemRow','appendFileSync','contact:import:','Abort\x20parser'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x237635,_0x6a43af){_0x237635=_0x237635-0x0;var _0x2058d6=_0xf6ed[_0x237635];return _0x2058d6;};'use strict';var fs=require('fs');var path=require(_0xdf6e('0x0'));var _=require('lodash');var Papa=require(_0xdf6e('0x1'));var util=require(_0xdf6e('0x2'));var BPromise=require(_0xdf6e('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xdf6e('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xdf6e('0x5'))('import');config[_0xdf6e('0x6')]=_['defaults'](config[_0xdf6e('0x6')],{'host':_0xdf6e('0x7'),'port':0x18eb});var socket=require(_0xdf6e('0x8'))(new Redis(config[_0xdf6e('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xdf6e('0x9'));var tempTableName=_0xdf6e('0xa')+moment()[_0xdf6e('0xb')](_0xdf6e('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3a8881){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'](_0x3a8881);}function selectNotIn(_0x92cde3,_0x5ad59b,_0x3e3b47,_0x4bca60,_0x336554){return squel['select']()[_0xdf6e('0xd')](_0xdf6e('0xe'))['from'](_0x4bca60)[_0xdf6e('0xf')](_0x5ad59b,null,_0x5ad59b+_0xdf6e('0x10')+_0x4bca60+'.'+_0x3e3b47)[_0xdf6e('0x11')](_0x4bca60+'.'+_0x3e3b47+_0xdf6e('0x12')+_0x92cde3+'.'+_0x3e3b47)[_0xdf6e('0x11')](_0x5ad59b+_0xdf6e('0x13')+_0x336554['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x41ad53,_0x5c6805){promisesAdditionalPhones=[];promisesContact=[];return db[_0xdf6e('0x14')][_0xdf6e('0x15')](_0xdf6e('0x16')+tempTableName)[_0xdf6e('0x17')](function(_0x2eb619){if(_0x2eb619!==null){var _0xa41255=[];for(var _0x3eb3d3=0x0;_0x3eb3d3<_0x2eb619['length'];_0x3eb3d3++){var _0x8c6c36=_0x2eb619[_0x3eb3d3];if(!_['isNil'](_0x8c6c36[_0xdf6e('0xe')])){if(!_[_0xdf6e('0x18')](_0x8c6c36['AdditionalPhones']))_0xa41255['push'](insertAdditionalPhones(_0x8c6c36));promisesContact[_0xdf6e('0x19')]({'contact':_0x8c6c36});}}}Promise[_0xdf6e('0x1a')](_0xa41255)[_0xdf6e('0x1b')](function(){_0x41ad53({'val':0x1});});})['catch'](function(_0x2b5ec6){logger[_0xdf6e('0x1c')](_0x2b5ec6[_0xdf6e('0x1d')]);});});}function insertAdditionalPhones(_0x27e7e5){return new Promise(function(_0x198f92,_0x359100){var _0x530290=_0x27e7e5[_0xdf6e('0x1e')];if(_[_0xdf6e('0x18')](_0x530290))_0x359100({'val':0x0});else{var _0x28957d=_0x530290['split'](';');var _0x3e985c=[];orderBy=0x0;for(var _0x5edc14=0x0;_0x5edc14<_0x28957d[_0xdf6e('0x1f')];_0x5edc14++){_0x3e985c[_0xdf6e('0x19')](splitAdditionalPhone(_0x27e7e5['id'],_0x28957d[_0x5edc14]));}Promise['all'](_0x3e985c)[_0xdf6e('0x1b')](function(){_0x198f92({'val':_0x28957d[_0xdf6e('0x1f')]});});}});}function splitAdditionalPhone(_0x45f053,_0x44caed){return new Promise(function(_0x4da9cc,_0x4fe58f){var _0x71f2a0=_0x44caed['split'](':');var _0x11d19a=_0x71f2a0[0x0];var _0xf10cda=_0x71f2a0[0x1];if(_0xf10cda!==''){var _0x70ef58=_0xf10cda[_0xdf6e('0x20')]('|');var _0x5d4897=[];for(var _0x331f27=0x0;_0x331f27<_0x70ef58[_0xdf6e('0x1f')];_0x331f27++){if(_0x70ef58[_0x331f27]!==''){var _0x9cdeba=_['filter'](promisesAdditionalPhones,{'contactId':_0x45f053,'phone':_0x70ef58[_0x331f27]});if(_0x9cdeba[_0xdf6e('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xdf6e('0x19')]({'contactId':_0x45f053,'contactTypeId':_0x11d19a,'phone':_0x70ef58[_0x331f27],'orderBy':orderBy});}}}_0x4da9cc({'ok':0x1});}else _0x4da9cc({'res':0x0});});}function createAdditionalPhone(_0x2d198d,_0x43816c,_0x5c75f3,_0x1ef42a){var _0x2ed48e='';var _0x533a8c='';var _0x6b4289=_0x5c75f3['split']('§');_0x2ed48e=_0x6b4289[0x0];if(_0x6b4289[_0xdf6e('0x1f')]==0x2)_0x533a8c=_0x6b4289[0x1];return new Promise(function(_0x5e02ec,_0x4478ca){return db['CmContactHasItem'][_0xdf6e('0x21')]({'where':{'CmContactId':_0x2d198d,'item':_0x2ed48e}})[_0xdf6e('0x1b')](function(_0x570547){if(_0x570547){return db[_0xdf6e('0x22')][_0xdf6e('0x23')]({'ItemTypeId':_0x43816c,'description':_0x533a8c,'OrderBy':_0x1ef42a},{'where':{'CmContactId':_0x2d198d,'item':_0x2ed48e}})[_0xdf6e('0x1b')](function(_0x227ab){_0x5e02ec({'res':'updated'});});}else{return db[_0xdf6e('0x22')][_0xdf6e('0x24')]({'CmContactId':_0x2d198d,'item':_0x2ed48e,'ItemTypeId':_0x43816c,'description':_0x533a8c,'OrderBy':_0x1ef42a,'ItemClass':_0xdf6e('0x25')})[_0xdf6e('0x1b')](function(_0x2a3fff){_0x5e02ec({'res':_0xdf6e('0x26')});});}});});}function updateContact(_0x23c21c){return new Promise(function(_0x234954,_0x546d17){var _0x4b4575=_0x23c21c['id'];delete _0x23c21c['id'];return db[_0xdf6e('0x27')][_0xdf6e('0x23')](_0x23c21c,{'where':{'id':_0x4b4575}})['then'](function(_0x5c9659){updatedRows+=0x1;return db[_0xdf6e('0x28')][_0xdf6e('0x23')]({'phone':_0x23c21c[_0xdf6e('0xe')]},{'where':{'ContactId':_0x4b4575}})[_0xdf6e('0x1b')](function(_0x27b1f9){_0x234954({'ret':'OK'});});});});}function insertCmHopper(_0x4fa3f7,_0x107ebe,_0x3304d1,_0x1b86aa,_0x51b7f0){var _0x5466b0=[_0xdf6e('0x29'),'cm_contacts.scheduledat',_0xdf6e('0x2a'),_0xdf6e('0x2b'),_0x107ebe+'.'+_0x1b86aa,'cm_contacts.createdAt',_0xdf6e('0x2c'),'cm_contacts.priority',_0xdf6e('0x2d'),'\x22'+_0x51b7f0+'\x22'];return squel[_0xdf6e('0x2e')]()['into'](_0xdf6e('0x2f'))['fromQuery']([_0xdf6e('0xe'),_0xdf6e('0x30'),_0xdf6e('0x31'),'ListId',_0x1b86aa,_0xdf6e('0x32'),_0xdf6e('0x33'),_0xdf6e('0x34'),_0xdf6e('0x35'),_0xdf6e('0x36')],squel['select']()[_0xdf6e('0x37')](_0x5466b0)[_0xdf6e('0x38')](_0x107ebe)[_0xdf6e('0xf')](_0xdf6e('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x107ebe+_0xdf6e('0x3a'))[_0xdf6e('0xf')](_0x3304d1,null,_0x3304d1+_0xdf6e('0x10')+_0x107ebe+'.'+_0x1b86aa)[_0xdf6e('0x11')](_0x107ebe+_0xdf6e('0x3b'),_0x4fa3f7)[_0xdf6e('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdf6e('0x11')](_0xdf6e('0x3c'),selectNotIn(_0x107ebe,_0x3304d1,_0x1b86aa,_0xdf6e('0x2f'),[_0xdf6e('0x3d'),'\x22onlyIfOpen\x22']))[_0xdf6e('0x11')](_0xdf6e('0x3c'),selectNotIn(_0x107ebe,_0x3304d1,_0x1b86aa,'cm_hopper',[_0xdf6e('0x3d')])))[_0xdf6e('0x3e')]();}function insertCmHopperBlack(_0x35f7da,_0x3148e0,_0x3f1e5f,_0x3878fc){var _0x2e033d=[_0xdf6e('0x29'),_0xdf6e('0x2a'),'cm_contacts.ListId',_0x3148e0+'.'+_0x3878fc,_0xdf6e('0x3f'),_0xdf6e('0x2c')];return squel[_0xdf6e('0x2e')]()[_0xdf6e('0x40')](_0xdf6e('0x41'))[_0xdf6e('0x42')]([_0xdf6e('0xe'),'ContactId',_0xdf6e('0x43'),_0x3878fc,'createdAt',_0xdf6e('0x33')],squel[_0xdf6e('0x44')]()[_0xdf6e('0x37')](_0x2e033d)[_0xdf6e('0x38')](_0x3148e0)['join'](_0xdf6e('0x39'),null,_0xdf6e('0x45')+_0x3148e0+_0xdf6e('0x3a'))['join'](_0x3f1e5f,null,_0x3f1e5f+_0xdf6e('0x10')+_0x3148e0+'.'+_0x3878fc)[_0xdf6e('0x11')](_0x3148e0+_0xdf6e('0x3b'),_0x35f7da)[_0xdf6e('0x11')](_0xdf6e('0x46'),NOW)[_0xdf6e('0x11')](_0xdf6e('0x3c'),squel[_0xdf6e('0x44')]()[_0xdf6e('0xd')]('phone')[_0xdf6e('0x38')]('cm_hopper_black')[_0xdf6e('0x11')](_0xdf6e('0x47'),_0x35f7da)[_0xdf6e('0x11')](_0x3878fc+_0xdf6e('0x48'),_0x3148e0+'.'+_0x3878fc)))[_0xdf6e('0x3e')]();}function insertCmHopperAdditionalPhones(_0x5ef843){var _0x47e822=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xdf6e('0x49'),_0xdf6e('0x4a')];return squel['insert']()[_0xdf6e('0x40')](_0xdf6e('0x4b'))[_0xdf6e('0x42')]([_0xdf6e('0x4c'),_0xdf6e('0xe'),_0xdf6e('0x4d'),'createdAt',_0xdf6e('0x33')],squel[_0xdf6e('0x44')]()['fields'](_0x47e822)[_0xdf6e('0x38')]('cm_hopper')[_0xdf6e('0xf')](_0xdf6e('0x39'),null,_0xdf6e('0x4e'))[_0xdf6e('0xf')](_0xdf6e('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xdf6e('0x11')](_0xdf6e('0x50'),_0x5ef843)[_0xdf6e('0x11')](_0xdf6e('0x46'),NOW))[_0xdf6e('0x3e')]();}function insertCmContact(_0x1275b6,_0xab99d8,_0x8cb048,_0x48f0a6){var _0x2da2df=_['concat'](_[_0xdf6e('0x51')](_0x48f0a6),[_0xdf6e('0x43'),_0xdf6e('0x52'),_0xdf6e('0x32'),_0xdf6e('0x33')]);return squel['insert']()[_0xdf6e('0x40')](_0xdf6e('0x39'))['fromQuery'](_0x2da2df,squel[_0xdf6e('0x44')]()[_0xdf6e('0x37')](_0x2da2df)['from'](_0xab99d8)[_0xdf6e('0x11')]('('+_0x8cb048[_0xdf6e('0xf')](',')+')\x20NOT\x20IN\x20?',squel[_0xdf6e('0x44')]()['fields'](_0x8cb048)[_0xdf6e('0x38')]('cm_contacts')['where'](_0xdf6e('0x47'),_0x1275b6))['where'](_0xdf6e('0x53'),squel[_0xdf6e('0x44')]()[_0xdf6e('0xd')](_0xdf6e('0x54'),_0xdf6e('0x55'))[_0xdf6e('0x38')](_0xab99d8)[_0xdf6e('0x56')](_0x8cb048['join'](','))))['toString']();}function handleStop(){logger[_0xdf6e('0x57')](_0xdf6e('0x58'));stopped=!![];}function handleUncaughtException(_0x111539){logger[_0xdf6e('0x1c')](_0x111539['message']);process['exit'](0x1);}function handleError(_0x279439,_0x256382){stats[_0xdf6e('0x59')][_0xdf6e('0x19')]({'name':_0x256382['code'],'message':_0x256382[_0xdf6e('0x1d')],'row':_0x279439});}function handleQuery(_0x468a08){logger[_0xdf6e('0x57')](_0x468a08);return db['sequelize']['query'](_0x468a08)[_0xdf6e('0x17')](function(_0x2dffc1){results[_0xdf6e('0x19')](_0x2dffc1);})[_0xdf6e('0x5a')](function(_0x22b8f9){logger['error'](_0x22b8f9[_0xdf6e('0x1d')]);});}function main(_0x537b7a,_0x5907b1,_0x21571b,_0x3ecd23){logger[_0xdf6e('0x57')](_0xdf6e('0x5b'),_0x537b7a,JSON['stringify'](_0x5907b1));process[_0xdf6e('0x5c')](_0xdf6e('0x5d'));var _0x12e3fa=_0x5907b1[_0xdf6e('0x5e')];var _0x160a9f=_[_0xdf6e('0x5f')](_0x12e3fa);var _0x5a9284=_0x5907b1[_0xdf6e('0x60')];var _0x49990d=path[_0xdf6e('0xf')](config[_0xdf6e('0x61')],_0xdf6e('0x62'),_0x5a9284+_0xdf6e('0x63'));logger['info']('body',_0x5907b1);db[_0xdf6e('0x64')][_0xdf6e('0x65')]({'raw':!![],'attributes':['id',_0xdf6e('0x66')]})['then'](function(_0x17cc91){for(var _0x18ac18=0x0;_0x18ac18<_0x17cc91[_0xdf6e('0x1f')];_0x18ac18++){if(_0x17cc91[_0x18ac18]['name']in _0x12e3fa){contactItemTypes['push'](_0x17cc91[_0x18ac18]);delete _0x160a9f[_0x17cc91[_0x18ac18][_0xdf6e('0x66')]];hasAdditionalPhones=!![];}for(var _0x2cfec5 in _0x12e3fa){if(_0x17cc91[_0x18ac18][_0xdf6e('0x66')]+'_description'===_0x2cfec5){phoneDescriptions[_0xdf6e('0x19')]({'itemTypeId':_0x17cc91[_0x18ac18]['id'],'description':_0x2cfec5});delete _0x160a9f[_0x2cfec5];}}}if(hasAdditionalPhones)_0x160a9f[_0xdf6e('0x1e')]='';var _0x3887eb=_[_0xdf6e('0x51')](_0x160a9f)[_0xdf6e('0xf')]();logger[_0xdf6e('0x57')](_0xdf6e('0x67'),_0x3887eb);fs[_0xdf6e('0x68')](_0x49990d,_0x3887eb+'\x0a');Papa[_0xdf6e('0x69')](fs[_0xdf6e('0x6a')](_0x537b7a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x443ff5,_0x47b5f1){try{for(var _0x55243d=0x0,_0x430a97=[];_0x55243d<_0x443ff5[_0xdf6e('0x6b')][_0xdf6e('0x1f')];_0x55243d++){stats[_0xdf6e('0x6c')]+=0x1;if(_0x443ff5[_0xdf6e('0x59')][_0x55243d]){handleError(_0x443ff5[_0xdf6e('0x6b')][_0x55243d],_0x443ff5[_0xdf6e('0x59')][_0x55243d]);}else{var _0x7f5aa=[];var _0x505671=[];var _0x1bbf73={};for(var _0x2c75e5 in _0x12e3fa){let _0x1581cf=contactItemTypes[_0xdf6e('0x6d')](_0x37c1e1=>_0x37c1e1[_0xdf6e('0x66')]===_0x2c75e5);let _0x2678bc=contactItemTypes[_0xdf6e('0x6d')](_0x3324ed=>_0x3324ed[_0xdf6e('0x66')]+_0xdf6e('0x6e')===_0x2c75e5);if(_[_0xdf6e('0x18')](_0x1581cf)&&_['isNil'](_0x2678bc)){if(_0x12e3fa[_0xdf6e('0x6f')](_0x2c75e5)){if(_0x443ff5['data'][_0x55243d][_0x12e3fa[_0x2c75e5]]){var _0x1459e5=_[_0xdf6e('0x70')](_0x443ff5[_0xdf6e('0x6b')][_0x55243d][_0x12e3fa[_0x2c75e5]][_0xdf6e('0x71')](/"/g,'\x27'));switch(_0x2c75e5){case _0xdf6e('0x30'):var _0x49b041=moment(_0x1459e5,_0xdf6e('0x9'),!![]);if(_0x49b041[_0xdf6e('0x72')]()){_0x430a97['push']('\x22'+_0x1459e5+'\x22');}else{_0x7f5aa[_0xdf6e('0x19')](_0xdf6e('0x73'));}break;case _0xdf6e('0x34'):var _0x4f6c17=parseInt(_0x1459e5);_0x1459e5=_[_0xdf6e('0x74')](_0x4f6c17)||_0x4f6c17<0x0||_0x4f6c17>0x4?_0x3ecd23?0x3:0x2:_0x4f6c17;_0x430a97[_0xdf6e('0x19')]('\x22'+_0x1459e5+'\x22');break;case _0xdf6e('0x35'):var _0x2d47d5=parseInt(_0x1459e5);if(_[_0xdf6e('0x75')](_0x2d47d5)&&_['includes'](_0x21571b,_0x2d47d5)){_0x430a97[_0xdf6e('0x19')]('\x22'+_0x2d47d5+'\x22');}else{_0x7f5aa['push'](_0xdf6e('0x76'));}break;case'email':if(isEmail(_0x1459e5)){_0x430a97[_0xdf6e('0x19')]('\x22'+_0x1459e5+'\x22');}else{_0x7f5aa[_0xdf6e('0x19')](_0xdf6e('0x77'));}break;case'dateOfBirth':var _0x544584=moment(_0x1459e5,_0xdf6e('0x78'),!![]);if(_0x544584[_0xdf6e('0x72')]()){_0x430a97['push']('\x22'+_0x1459e5+'\x22');}else{_0x7f5aa[_0xdf6e('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x430a97[_0xdf6e('0x19')]('\x22'+_0x1459e5+'\x22');}}else{switch(_0x2c75e5){case'firstName':case _0xdf6e('0xe'):_0x7f5aa[_0xdf6e('0x19')](_0x2c75e5+'\x20not\x20specified');break;default:_0x430a97[_0xdf6e('0x19')]('\x22\x22');}}}}else{var _0xa62f6d='';if(!_[_0xdf6e('0x18')](_0x1581cf)){if(!_0x1bbf73[_0xdf6e('0x6f')](_0x1581cf['id'])){for(var _0x42eb9c=0x0;_0x42eb9c<_0x12e3fa[_0x2c75e5][_0xdf6e('0x1f')];_0x42eb9c++){var _0x1459e5=_['trim'](_0x443ff5['data'][_0x55243d][_0x12e3fa[_0x2c75e5][_0x42eb9c]]['replace'](/"/g,'\x27'));var _0x49aeb4=phoneDescriptions[_0xdf6e('0x6d')](_0x34c44f=>_0x34c44f[_0xdf6e('0x79')]===_0x1581cf['id']);if(!_[_0xdf6e('0x18')](_0x49aeb4)){var _0x19e35e=_['trim'](_0x443ff5[_0xdf6e('0x6b')][_0x55243d][_0x12e3fa[_0x49aeb4['description']][0x0]][_0xdf6e('0x71')](/"/g,'\x27'));if(!_[_0xdf6e('0x18')](_0x19e35e))_0x1459e5=_0x1459e5+'§'+_0x19e35e;}if(_0xa62f6d=='')_0xa62f6d=_0x1459e5;else _0xa62f6d+='|'+_0x1459e5;}_0x505671['push'](_0x1581cf['id']+':'+_0xa62f6d);_0x1bbf73[_0x1581cf['id']]=0x1;}}}}if(hasAdditionalPhones){_0x430a97[_0xdf6e('0x19')]('\x22'+_0x505671[_0xdf6e('0xf')](';')+'\x22');}if(_0x7f5aa[_0xdf6e('0x1f')]){handleError(_0x443ff5[_0xdf6e('0x6b')][_0x55243d],{'code':_0xdf6e('0x7a'),'message':_0x7f5aa['join']()});}else{fs[_0xdf6e('0x7b')](_0x49990d,_0x430a97[_0xdf6e('0xf')]()+'\x0a');}_0x430a97=[];}if(!(stats[_0xdf6e('0x6c')]%0xc8)){socket['emit'](_0xdf6e('0x7c')+_0x5a9284,stats);stats[_0xdf6e('0x59')]=[];}}if(stopped){logger[_0xdf6e('0x57')](_0xdf6e('0x7d'));_0x47b5f1[_0xdf6e('0x7e')]();}}catch(_0x243861){handleError(_0x443ff5[_0xdf6e('0x6b')][_0x55243d],{'code':_0xdf6e('0x7f'),'message':_0x243861[_0xdf6e('0x1d')]});logger[_0xdf6e('0x1c')](_0xdf6e('0x80'),_0x243861[_0xdf6e('0x1d')]);}},'complete':function(){try{var _0x1f2d7f=[];var _0xb53022=tempTableName;_0x1f2d7f[_0xdf6e('0x19')](_0xdf6e('0x81')+_0xb53022+'\x20LIKE\x20cm_contacts;');logger[_0xdf6e('0x57')]('CIS\x20len',contactItemTypes[_0xdf6e('0x1f')]);var _0x21b6e3=util[_0xdf6e('0xb')](_0xdf6e('0x82'),_0x49990d,_0xb53022,_0x3887eb,_0x5907b1[_0xdf6e('0x43')],_0x5907b1[_0xdf6e('0x52')]||null,NOW,NOW);if(_[_0xdf6e('0x18')](_0x12e3fa[_0xdf6e('0x30')])){_0x21b6e3+=_0xdf6e('0x83');}_0x1f2d7f['push'](_0x21b6e3);BPromise[_0xdf6e('0x84')](_0x1f2d7f,handleQuery)[_0xdf6e('0x1b')](function(_0x3a39ab){BPromise[_0xdf6e('0x1a')]([handleAdditionalPhones()])[_0xdf6e('0x1b')](function(){_0x1f2d7f=[];for(var _0x1197a0=0x0;_0x1197a0\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','agent','search','select','field','name','from','getInteractionFK','user_has_','_interactions','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','interactionsTags','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','type','default','text','value','end','unreadMessages','read','and','Contact','$substring','split','find','ContactId','buildExpression','contact'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1dd4,0xfe));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41dd('0x0'));var squel=require(_0x41dd('0x1'));var as=require(_0x41dd('0x2'));var qs=require(_0x41dd('0x3'));var updateInteraction=require(_0x41dd('0x4'))['updateInteraction'];var utils=require(_0x41dd('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3053ce,_0x1a660c,_0x4f191e){var _0x4a5371=![];var _0x1bbdfe=utils['getAccountFK'](_0x3053ce);if(_0x1a660c['role']===_0x41dd('0x6')&&!_0x4f191e[_0x41dd('0x7')]&&!_0x4f191e[_0x1bbdfe]){_0x4a5371=!![];}return _0x4a5371;}function getTagsQuery(){return squel[_0x41dd('0x8')]()['field']('id')[_0x41dd('0x9')](_0x41dd('0xa'))[_0x41dd('0x9')]('color')[_0x41dd('0xb')]('tools_tags');}function getUsersQuery(_0x526c9c,_0x40971b){var _0x27adac=utils[_0x41dd('0xc')](_0x526c9c);var _0x59f92b=_0x41dd('0xd')+_0x526c9c+_0x41dd('0xe');var _0x3a2b1c=squel[_0x41dd('0x8')]()[_0x41dd('0x9')](_0x41dd('0xf'))[_0x41dd('0x9')](_0x41dd('0x10'))[_0x41dd('0x9')]('ui.'+_0x27adac)[_0x41dd('0xb')](_0x59f92b,'ui')['left_join'](_0x41dd('0x11'),'u',_0x41dd('0x12'));if(_0x40971b[_0x41dd('0x13')]>0x0){_0x3a2b1c[_0x41dd('0x14')]('ui.'+_0x27adac+_0x41dd('0x15'),_[_0x41dd('0x16')](_0x40971b,'id'));}return _0x3a2b1c;}function getInteractionsQuery(_0x3e744a){var _0xf37fca=utils[_0x41dd('0x17')](_0x3e744a);var _0x2518bc=utils[_0x41dd('0x18')](_0x3e744a);var _0xaad7a5=utils[_0x41dd('0xc')](_0x3e744a);return squel[_0x41dd('0x8')]()[_0x41dd('0xb')](_0xf37fca[_0x41dd('0x19')],'i')[_0x41dd('0x1a')]('cm_contacts','c',_0x41dd('0x1b'))[_0x41dd('0x1a')]('users','o',_0x41dd('0x1c'))[_0x41dd('0x1a')](_0xf37fca[_0x41dd('0x1d')],'a','a.id\x20=\x20i.'+_0x2518bc)['left_join'](_0xf37fca[_0x41dd('0x1e')],'me',_0x41dd('0x1f')+_0xaad7a5+'\x20=\x20i.id')[_0x41dd('0x1a')](_0xf37fca[_0x41dd('0x20')],'it','it.'+_0xaad7a5+_0x41dd('0x21'))[_0x41dd('0x1a')](_0x41dd('0x22'),'t',_0x41dd('0x23'));}function getSqlClauses(){var _0x1dd935={'body':squel['expr'](),'contact':squel[_0x41dd('0x24')](),'default':squel['expr'](),'fields':squel[_0x41dd('0x24')](),'filter':squel[_0x41dd('0x24')](),'read':squel[_0x41dd('0x24')](),'tags':{'clause':squel[_0x41dd('0x24')](),'ids':null},'user':squel[_0x41dd('0x24')]()};return _0x1dd935;}function parseTagParameter(_0x11e70e){var _0x34ce72=squel[_0x41dd('0x24')]();if(_0x11e70e){var _0x338b2b=utils[_0x41dd('0x25')](_0x11e70e);_0x338b2b['forEach'](function(_0x3fff46){_0x34ce72['or'](_0x41dd('0x26'),'%,'+_0x3fff46+',%');});}return _0x34ce72;}function parseReadParameter(_0x34fc8f){var _0x580ea4='';if(_0x34fc8f){_0x580ea4=_0x41dd('0x27');if(_0x34fc8f==='1'){_0x580ea4=_0x580ea4[_0x41dd('0x28')](_0x41dd('0x29'),'=');}else{_0x580ea4=_0x580ea4['replace'](_0x41dd('0x29'),'>');}}return _0x580ea4;}function parseSearchFilter(_0x50b89a,_0x43ea8c){var _0x26d0c5=squel[_0x41dd('0x24')]();if(_0x43ea8c){var _0x45ab2b=_0x43ea8c[_0x41dd('0x28')]('\x5c','\x5c\x5c')[_0x41dd('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x45ab2b)){_0x26d0c5['or'](_0x41dd('0x2a'),_0x45ab2b+'%');if([_0x41dd('0x2b'),'whatsapp'][_0x41dd('0x2c')](_0x50b89a)){_0x26d0c5['or'](_0x41dd('0x2d'),_0x45ab2b+'%');}else if(_0x50b89a===_0x41dd('0x2e')){_0x26d0c5['or']('i.fax\x20LIKE\x20?',_0x45ab2b+'%');}else if(_0x50b89a===_0x41dd('0x2f')){_0x26d0c5['or'](_0x41dd('0x30'),_0x45ab2b+'%');}}else if(_0x50b89a===_0x41dd('0x31')&&qs[_0x41dd('0x32')](_0x45ab2b)){_0x26d0c5['or'](_0x41dd('0x33'),_0x45ab2b+'%');}else{if(_0x50b89a===_0x41dd('0x31')){_0x26d0c5['or'](_0x41dd('0x34'),qs[_0x41dd('0x35')](_0x45ab2b,!![]))['or'](_0x41dd('0x36'),qs[_0x41dd('0x35')](_0x45ab2b));}else if(_0x50b89a!==_0x41dd('0x2e')){_0x26d0c5['or'](_0x41dd('0x37'),qs[_0x41dd('0x35')](_0x45ab2b));}_0x26d0c5['or'](_0x41dd('0x38'),qs[_0x41dd('0x35')](_0x45ab2b,!![]),null);}}return _0x26d0c5;}function parseAdvancedSearchFilter(_0x3da411,_0x1233b0){var _0x5360b5=getSqlClauses();var _0x563896=as['parseSearch'](_0x3da411);var _0x12ee80=_0x563896[_0x41dd('0x39')];for(var _0x415cf4=0x0;_0x415cf4<_0x563896[_0x41dd('0x3a')][_0x41dd('0x13')];_0x415cf4++){var _0x505b46=_0x563896[_0x41dd('0x3a')][_0x415cf4];var _0x412c83='i';var _0x3dba74=_['find'](_0x1233b0,[_0x41dd('0xa'),_0x505b46[_0x41dd('0x9')]]);if(_0x3dba74){var _0x2f1e3d=as['buildExpression'](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x3c')][_0x12ee80](_0x2f1e3d[_0x41dd('0x3d')],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d['value'][_0x41dd('0x3f')]);}else{switch(_0x505b46['field']){case _0x41dd('0x40'):var _0x4f6e01=parseReadParameter(_0x505b46['value']);_0x5360b5[_0x41dd('0x41')][_0x41dd('0x42')](_0x4f6e01);break;case _0x41dd('0x43'):if(_0x505b46['operator']===_0x41dd('0x44')){if(_0x505b46['value'][_0x41dd('0x45')]('\x20')['length']>0x1){_0x5360b5['contact'][_0x12ee80](_0x41dd('0x38'),qs['getFullTextValue'](_0x505b46[_0x41dd('0x3e')],!![]),null);}else{var _0x20d8bd='%'+_0x505b46[_0x41dd('0x3e')]+'%';_0x5360b5['contact'][_0x12ee80]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x20d8bd,_0x20d8bd,_0x20d8bd);}}else{_0x3dba74=_[_0x41dd('0x46')](_0x1233b0,[_0x41dd('0xa'),'ContactId']);_0x505b46[_0x41dd('0x9')]=_0x41dd('0x47');_0x2f1e3d=as[_0x41dd('0x48')](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x49')][_0x12ee80](_0x2f1e3d[_0x41dd('0x3d')],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d[_0x41dd('0x3e')]['end']);}break;case'Tag':var _0x2840bb=_0x505b46[_0x41dd('0x3e')]['split'](',')[_0x41dd('0x16')](function(_0x52b8ec){return Number(_0x52b8ec);});var _0x4344e8=parseTagParameter(_0x2840bb);_0x5360b5[_0x41dd('0x4a')][_0x41dd('0x4b')][_0x41dd('0x42')](_0x4344e8);_0x5360b5[_0x41dd('0x4a')][_0x41dd('0x4c')]=_0x2840bb;break;case _0x41dd('0x4d'):if(_0x505b46['operator']===_0x41dd('0x44')){_0x5360b5[_0x41dd('0x4e')][_0x12ee80](_0x41dd('0x4f'),'%'+_0x505b46['value']+'%',null);}else{_0x3dba74=_[_0x41dd('0x46')](_0x1233b0,[_0x41dd('0xa'),_0x41dd('0x50')]);_0x505b46[_0x41dd('0x9')]=_0x41dd('0x50');_0x2f1e3d=as[_0x41dd('0x48')](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x4e')][_0x12ee80](_0x2f1e3d['text'],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x3f')]);}break;case _0x41dd('0x51'):case _0x41dd('0x52'):_0x2f1e3d=as[_0x41dd('0x48')]('me',null,_0x505b46);_0x5360b5[_0x41dd('0x51')][_0x12ee80](_0x2f1e3d['text'],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x53')],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x3f')]);break;}}}return _0x5360b5;}function parseModelFields(_0xdba0d1,_0x23cf06,_0x3d3e39){var _0x44eb27=utils[_0x41dd('0x18')](_0xdba0d1);var _0x5052ee=squel[_0x41dd('0x24')]();var _0x3de09c=_(_0x23cf06)[_0x41dd('0x54')]()[_0x41dd('0x16')](function(_0x2fbe73){return _[_0x41dd('0x55')](_0x3d3e39,[_0x41dd('0xa'),_0x2fbe73])?_0x2fbe73:undefined;})['compact']()[_0x41dd('0x3e')]();if(_0x3de09c[_0x41dd('0x13')]>0x0){_0x3de09c[_0x41dd('0x56')](function(_0x44f9e8){if(_0x44f9e8===_0x44eb27){_0x5052ee[_0x41dd('0x42')]('i.'+_0x44eb27+_0x41dd('0x15'),[][_0x41dd('0x57')](_0x23cf06[_0x44f9e8]));}else if(_0x44f9e8===_0x41dd('0x58')){var _0xb89a07=JSON[_0x41dd('0x59')](_0x23cf06[_0x44f9e8])[_0x41dd('0x5a')];var _0x16b86f=JSON[_0x41dd('0x59')](_0x23cf06[_0x44f9e8])[_0x41dd('0x5b')];_0x5052ee[_0x41dd('0x42')](_0x41dd('0x5c'),_0xb89a07,_0x16b86f);}else{if(_0x23cf06[_0x44f9e8]===_0x41dd('0x5d')){_0x5052ee[_0x41dd('0x42')]('i.'+_0x44f9e8+_0x41dd('0x5e'));}else{_0x5052ee[_0x41dd('0x42')]('i.'+_0x44f9e8+_0x41dd('0x5f'),_0x23cf06[_0x44f9e8]);}}});}return _0x5052ee;}function parseQueryParameters(_0x3126ba,_0x39c96f,_0x5070c4){var _0x951f46=getSqlClauses();return Promise[_0x41dd('0x60')]()[_0x41dd('0x61')](function(){return parseModelFields(_0x3126ba,_0x39c96f,_0x5070c4);})[_0x41dd('0x61')](function(_0x4d6709){_0x951f46[_0x41dd('0x62')][_0x41dd('0x42')](_0x4d6709);return parseReadParameter(_0x39c96f[_0x41dd('0x41')]);})[_0x41dd('0x61')](function(_0x5a0926){_0x951f46['read'][_0x41dd('0x42')](_0x5a0926);return parseTagParameter(_0x39c96f[_0x41dd('0x63')]);})['then'](function(_0x438896){_0x951f46['tags'][_0x41dd('0x4b')][_0x41dd('0x42')](_0x438896);return parseSearchFilter(_0x3126ba,_0x39c96f[_0x41dd('0x64')]);})[_0x41dd('0x61')](function(_0xfd8bea){_0x951f46['filter']=_0xfd8bea;return _0x951f46;});}function checkAccountsRestrictions(_0x49c148,_0xfb66f0,_0x5191c0){var _0x4f5192=utils[_0x41dd('0x18')](_0x49c148);var _0x27f36d=_0x41dd('0x65')+_[_0x41dd('0x66')](_0x49c148)+(_0x49c148==='chat'?'Websites':_0x41dd('0x67'));var _0x80a10c=squel[_0x41dd('0x24')]();return Promise[_0x41dd('0x60')]()[_0x41dd('0x61')](function(){if(_0x5191c0[_0x41dd('0x7')]&&_0xfb66f0[_0x41dd('0x68')]===_0x41dd('0x6')){return _0xfb66f0[_0x27f36d]({'attributes':['id'],'raw':!![]});}})[_0x41dd('0x61')](function(_0x5f0c11){if(_0x5f0c11){if(_0x5f0c11['length']===0x0){_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+_0x41dd('0x5e'));}else{_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+'\x20IN\x20?',_['map'](_0x5f0c11,'id'));}}else if(!_0x5191c0[_0x4f5192]){_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+_0x41dd('0x69'));}})[_0x41dd('0x61')](function(){return _0x80a10c;});}function getClosedOrderClause(_0x3d40b1,_0x539f47){var _0x134ee5='';var _0x78c17a=['i.thirdDisposition','i.secondDisposition',_0x41dd('0x6a')];if(_0x3d40b1===_0x41dd('0x31')){_0x78c17a[_0x41dd('0x6b')](_0x41dd('0x6c'));}if(_0x539f47['closed']==='0'&&_0x3d40b1==='mail'){_0x134ee5=_0x41dd('0x6c');}else{if(_0x539f47['closed']==='1'){_0x78c17a['shift']();}_0x134ee5=_0x41dd('0x6d')+_0x78c17a['join'](',\x20')+')';}return _0x134ee5;}function getFilteredInteractions(_0x222f5e,_0x1a6d58,_0x470951,_0x2eec9f){var _0x53d4d8=utils['getInteractionFK'](_0x222f5e);var _0x45e37b=_[_0x41dd('0x66')](_0x222f5e)+_0x41dd('0x6e');var _0xdc16dd=[];var _0x1a3b88=getTagsQuery();var _0x2ceed3={'type':db[_0x41dd('0x6f')][_0x41dd('0x70')][_0x41dd('0x71')],'raw':!![]};var _0x5bfe36=[];var _0x2ae0cf=[];return db[_0x41dd('0x72')][_0x41dd('0x73')](_0x1a3b88[_0x41dd('0x74')](),_0x2ceed3)[_0x41dd('0x61')](function(_0x58445e){_0xdc16dd=_[_0x41dd('0x75')](_0x58445e,'id');_0x2ceed3=_[_0x41dd('0x76')](_0x2ceed3,{'model':db[_0x45e37b],'mapToModel':!![],'nest':!![]});if(_0x470951[_0x41dd('0x62')]){_0x2eec9f[_0x41dd('0x77')]['forEach'](function(_0x1f9e7f){_0x1a6d58['field']('i.'+_0x1f9e7f);});}else{_0x1a6d58[_0x41dd('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41dd('0x40'));_0x1a6d58[_0x41dd('0x9')]('a.key',_0x41dd('0x78'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x79'),_0x41dd('0x7a'));if(_0x222f5e===_0x41dd('0x31')){_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x7b'),_0x41dd('0x7c'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x7d'),_0x41dd('0x7e'));_0x1a6d58[_0x41dd('0x9')]('i.id');_0x1a6d58['field'](_0x41dd('0x7f'));_0x1a6d58['field'](_0x41dd('0x80'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x81'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x82'));_0x1a6d58['field']('i.attach');_0x1a6d58[_0x41dd('0x9')]('i.lastMsgAt');_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x83'));_0x1a6d58['field'](_0x41dd('0x84'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x6a'));_0x1a6d58['field'](_0x41dd('0x85'));_0x1a6d58['field'](_0x41dd('0x86'));_0x1a6d58['field']('i.substatus');_0x1a6d58['field'](_0x41dd('0x87'));_0x1a6d58['field'](_0x41dd('0x88'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x89'));_0x1a6d58[_0x41dd('0x9')]('i.UserId');}else if(_0x222f5e===_0x41dd('0x2f')){_0x1a6d58[_0x41dd('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x41dd('0x7e'));}else{_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8a'),'contactName');}if(_0x222f5e!==_0x41dd('0x31')){_0x1a6d58[_0x41dd('0x9')]('i.*');}_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8b'),_0x41dd('0x8c'));_0x1a6d58[_0x41dd('0x9')]('c.lastName','Contact.lastName');_0x1a6d58[_0x41dd('0x9')]('c.email',_0x41dd('0x8d'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8e'),_0x41dd('0x8f'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x90'),_0x41dd('0x91'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x92'),_0x41dd('0x93'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x94'),_0x41dd('0x95'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x96'),_0x41dd('0x97'));_0x1a6d58[_0x41dd('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x41dd('0x98'));}if(_0x2eec9f[_0x41dd('0x99')]){_0x1a6d58['limit'](_0x2eec9f[_0x41dd('0x99')]);}if(_0x2eec9f[_0x41dd('0x9a')]){_0x1a6d58['offset'](_0x2eec9f[_0x41dd('0x9a')]);}return db[_0x41dd('0x72')]['query'](_0x1a6d58[_0x41dd('0x74')](),_0x2ceed3);})[_0x41dd('0x61')](function(_0x522568){_0x5bfe36=_0x522568;var _0x2f21c6=getUsersQuery(_0x222f5e,_0x5bfe36);return db[_0x41dd('0x72')]['query'](_0x2f21c6[_0x41dd('0x74')](),_0x2ceed3);})['then'](function(_0x4b6f0d){_0x2ae0cf=_[_0x41dd('0x9b')](_0x4b6f0d,_0x53d4d8);if(_0x222f5e===_0x41dd('0x31')){return db[_0x41dd('0x9c')][_0x41dd('0x9d')]({'attributes':[_0x41dd('0x9e')],'raw':!![]});}})['then'](function(_0xc79e37){var _0x134461=_0xc79e37?_0xc79e37[_0x41dd('0x9e')]:undefined;var _0x1f36b9=_0x5bfe36[_0x41dd('0x16')](function(_0x27d2c3){return updateInteraction(_0x27d2c3,_0xdc16dd,_0x2ae0cf,_0x134461);});return Promise['all'](_0x1f36b9);});}function countFilteredInteractions(_0x16c378,_0xf0dcce){var _0x1a16f4=_0x16c378[_0x41dd('0x9f')]();_0x1a16f4[_0x41dd('0x9')](_0x41dd('0xa0'));_0x1a16f4[_0x41dd('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41dd('0x40'));var _0x551d38=utils[_0x41dd('0x25')](_0xf0dcce);if(!_[_0x41dd('0xa1')](_0x551d38)){_0x1a16f4['where'](_0x41dd('0xa2'),_0x551d38);}var _0x92459b={'type':db[_0x41dd('0x6f')][_0x41dd('0x70')]['SELECT'],'raw':!![]};return db['sequelize'][_0x41dd('0x73')](_0x1a16f4['toString'](),_0x92459b);}module[_0x41dd('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x3de3=['_interactions','select','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','start','value','end','unreadMessages','read','and','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','Tag','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','plainBody','keys','some','compact','forEach','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','merge','attributes','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','where','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','getAccountFK','role','agent','search','field','name','color','from','getInteractionFK','user_has_'];(function(_0x2359ad,_0x23d661){var _0x1e7ed5=function(_0x4c9de4){while(--_0x4c9de4){_0x2359ad['push'](_0x2359ad['shift']());}};_0x1e7ed5(++_0x23d661);}(_0x3de3,0x132));var _0x33de=function(_0x300af3,_0x16cf33){_0x300af3=_0x300af3-0x0;var _0x28a357=_0x3de3[_0x300af3];return _0x28a357;};'use strict';var _=require(_0x33de('0x0'));var squel=require('squel');var as=require(_0x33de('0x1'));var qs=require(_0x33de('0x2'));var updateInteraction=require(_0x33de('0x3'))['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0xf574f9,_0xdf619d,_0x1583da){var _0x29a704=![];var _0x5436e0=utils[_0x33de('0x4')](_0xf574f9);if(_0xdf619d[_0x33de('0x5')]===_0x33de('0x6')&&!_0x1583da[_0x33de('0x7')]&&!_0x1583da[_0x5436e0]){_0x29a704=!![];}return _0x29a704;}function getTagsQuery(){return squel['select']()[_0x33de('0x8')]('id')[_0x33de('0x8')](_0x33de('0x9'))['field'](_0x33de('0xa'))[_0x33de('0xb')]('tools_tags');}function getUsersQuery(_0x551b66,_0x512067){var _0x4348a2=utils[_0x33de('0xc')](_0x551b66);var _0x4040bb=_0x33de('0xd')+_0x551b66+_0x33de('0xe');var _0xcf6f16=squel[_0x33de('0xf')]()[_0x33de('0x8')](_0x33de('0x10'))[_0x33de('0x8')](_0x33de('0x11'))[_0x33de('0x8')](_0x33de('0x12')+_0x4348a2)['from'](_0x4040bb,'ui')['left_join']('users','u',_0x33de('0x13'));if(_0x512067[_0x33de('0x14')]>0x0){_0xcf6f16['where']('ui.'+_0x4348a2+'\x20IN\x20?',_[_0x33de('0x15')](_0x512067,'id'));}return _0xcf6f16;}function getInteractionsQuery(_0xad3623){var _0x3f81f8=utils[_0x33de('0x16')](_0xad3623);var _0x1cf733=utils[_0x33de('0x4')](_0xad3623);var _0x5b3f72=utils[_0x33de('0xc')](_0xad3623);return squel[_0x33de('0xf')]()['from'](_0x3f81f8[_0x33de('0x17')],'i')[_0x33de('0x18')](_0x33de('0x19'),'c',_0x33de('0x1a'))[_0x33de('0x18')](_0x33de('0x1b'),'o',_0x33de('0x1c'))['left_join'](_0x3f81f8[_0x33de('0x1d')],'a','a.id\x20=\x20i.'+_0x1cf733)[_0x33de('0x18')](_0x3f81f8['messages'],'me',_0x33de('0x1e')+_0x5b3f72+'\x20=\x20i.id')[_0x33de('0x18')](_0x3f81f8['interactionsTags'],'it','it.'+_0x5b3f72+_0x33de('0x1f'))['left_join']('tools_tags','t',_0x33de('0x20'));}function getSqlClauses(){var _0x338529={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x33de('0x21')](),'fields':squel[_0x33de('0x21')](),'filter':squel[_0x33de('0x21')](),'read':squel[_0x33de('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x33de('0x21')]()};return _0x338529;}function parseTagParameter(_0x145c88){var _0x40a580=squel['expr']();if(_0x145c88){var _0x14747a=utils['getSelectedTags'](_0x145c88);_0x14747a['forEach'](function(_0x2dc357){_0x40a580['or'](_0x33de('0x22'),'%,'+_0x2dc357+',%');});}return _0x40a580;}function parseReadParameter(_0x3004be){var _0x8bc0cd='';if(_0x3004be){_0x8bc0cd=_0x33de('0x23');if(_0x3004be==='1'){_0x8bc0cd=_0x8bc0cd[_0x33de('0x24')]('{OPERATOR}','=');}else{_0x8bc0cd=_0x8bc0cd['replace'](_0x33de('0x25'),'>');}}return _0x8bc0cd;}function parseSearchFilter(_0x3c6368,_0x35a115){var _0x5aedc5=squel['expr']();if(_0x35a115){var _0x196e54=_0x35a115[_0x33de('0x24')]('\x5c','\x5c\x5c')[_0x33de('0x24')](/'/g,'\x27\x27');if(qs[_0x33de('0x26')](_0x196e54)){_0x5aedc5['or'](_0x33de('0x27'),_0x196e54+'%');if([_0x33de('0x28'),'whatsapp'][_0x33de('0x29')](_0x3c6368)){_0x5aedc5['or'](_0x33de('0x2a'),_0x196e54+'%');}else if(_0x3c6368===_0x33de('0x2b')){_0x5aedc5['or'](_0x33de('0x2c'),_0x196e54+'%');}else if(_0x3c6368==='openchannel'){_0x5aedc5['or'](_0x33de('0x2d'),_0x196e54+'%');}}else if(_0x3c6368===_0x33de('0x2e')&&qs['isEmail'](_0x196e54)){_0x5aedc5['or'](_0x33de('0x2f'),_0x196e54+'%');}else{if(_0x3c6368===_0x33de('0x2e')){_0x5aedc5['or'](_0x33de('0x30'),qs[_0x33de('0x31')](_0x196e54,!![]))['or'](_0x33de('0x32'),qs[_0x33de('0x31')](_0x196e54));}else if(_0x3c6368!==_0x33de('0x2b')){_0x5aedc5['or'](_0x33de('0x33'),qs[_0x33de('0x31')](_0x196e54));}_0x5aedc5['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x33de('0x31')](_0x196e54,!![]),null);}}return _0x5aedc5;}function parseAdvancedSearchFilter(_0x3ce859,_0x5209d5){var _0x20124c=getSqlClauses();var _0x53312d=as[_0x33de('0x34')](_0x3ce859);var _0x9480ae=_0x53312d[_0x33de('0x35')];for(var _0x192534=0x0;_0x192534<_0x53312d[_0x33de('0x36')][_0x33de('0x14')];_0x192534++){var _0x52133b=_0x53312d[_0x33de('0x36')][_0x192534];var _0x17ea19='i';var _0x1f449b=_[_0x33de('0x37')](_0x5209d5,[_0x33de('0x9'),_0x52133b[_0x33de('0x8')]]);if(_0x1f449b){var _0x3243f0=as[_0x33de('0x38')](_0x17ea19,_0x1f449b['type'],_0x52133b);_0x20124c[_0x33de('0x39')][_0x9480ae](_0x3243f0[_0x33de('0x3a')],_0x3243f0['value'][_0x33de('0x3b')],_0x3243f0[_0x33de('0x3c')][_0x33de('0x3d')]);}else{switch(_0x52133b[_0x33de('0x8')]){case _0x33de('0x3e'):var _0x2791f6=parseReadParameter(_0x52133b['value']);_0x20124c[_0x33de('0x3f')][_0x33de('0x40')](_0x2791f6);break;case'Contact':if(_0x52133b[_0x33de('0x41')]===_0x33de('0x42')){if(_0x52133b[_0x33de('0x3c')][_0x33de('0x43')]('\x20')[_0x33de('0x14')]>0x1){_0x20124c[_0x33de('0x44')][_0x9480ae](_0x33de('0x45'),qs['getFullTextValue'](_0x52133b[_0x33de('0x3c')],!![]),null);}else{var _0x8fc686='%'+_0x52133b[_0x33de('0x3c')]+'%';_0x20124c[_0x33de('0x44')][_0x9480ae]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x8fc686,_0x8fc686,_0x8fc686);}}else{_0x1f449b=_[_0x33de('0x37')](_0x5209d5,[_0x33de('0x9'),'ContactId']);_0x52133b[_0x33de('0x8')]=_0x33de('0x46');_0x3243f0=as['buildExpression'](_0x17ea19,_0x1f449b['type'],_0x52133b);_0x20124c[_0x33de('0x44')][_0x9480ae](_0x3243f0[_0x33de('0x3a')],_0x3243f0[_0x33de('0x3c')][_0x33de('0x3b')],_0x3243f0[_0x33de('0x3c')][_0x33de('0x3d')]);}break;case _0x33de('0x47'):var _0x217ad9=_0x52133b['value'][_0x33de('0x43')](',')['map'](function(_0x4a8f0d){return Number(_0x4a8f0d);});var _0x950b4b=parseTagParameter(_0x217ad9);_0x20124c[_0x33de('0x48')][_0x33de('0x49')][_0x33de('0x40')](_0x950b4b);_0x20124c['tags']['ids']=_0x217ad9;break;case _0x33de('0x4a'):if(_0x52133b['operator']==='$substring'){_0x20124c[_0x33de('0x4b')][_0x9480ae](_0x33de('0x4c'),'%'+_0x52133b[_0x33de('0x3c')]+'%',null);}else{_0x1f449b=_[_0x33de('0x37')](_0x5209d5,['name',_0x33de('0x4d')]);_0x52133b[_0x33de('0x8')]=_0x33de('0x4d');_0x3243f0=as['buildExpression'](_0x17ea19,_0x1f449b[_0x33de('0x4e')],_0x52133b);_0x20124c[_0x33de('0x4b')][_0x9480ae](_0x3243f0['text'],_0x3243f0[_0x33de('0x3c')]['start'],_0x3243f0['value'][_0x33de('0x3d')]);}break;case _0x33de('0x4f'):case _0x33de('0x50'):_0x3243f0=as[_0x33de('0x38')]('me',null,_0x52133b);_0x20124c['body'][_0x9480ae](_0x3243f0['text'],_0x3243f0[_0x33de('0x3c')][_0x33de('0x3b')],_0x3243f0[_0x33de('0x3c')][_0x33de('0x3d')]);break;}}}return _0x20124c;}function parseModelFields(_0x2f8687,_0x3a5a26,_0x145a7a){var _0x3df791=utils[_0x33de('0x4')](_0x2f8687);var _0x2d6e2c=squel['expr']();var _0x32337a=_(_0x3a5a26)[_0x33de('0x51')]()['map'](function(_0x224174){return _[_0x33de('0x52')](_0x145a7a,[_0x33de('0x9'),_0x224174])?_0x224174:undefined;})[_0x33de('0x53')]()[_0x33de('0x3c')]();if(_0x32337a[_0x33de('0x14')]>0x0){_0x32337a[_0x33de('0x54')](function(_0x32c920){if(_0x32c920===_0x3df791){_0x2d6e2c[_0x33de('0x40')]('i.'+_0x3df791+_0x33de('0x55'),[][_0x33de('0x56')](_0x3a5a26[_0x32c920]));}else if(_0x32c920===_0x33de('0x57')){var _0x219f84=JSON[_0x33de('0x58')](_0x3a5a26[_0x32c920])[_0x33de('0x59')];var _0x16a485=JSON['parse'](_0x3a5a26[_0x32c920])[_0x33de('0x5a')];_0x2d6e2c['and'](_0x33de('0x5b'),_0x219f84,_0x16a485);}else{if(_0x3a5a26[_0x32c920]===_0x33de('0x5c')){_0x2d6e2c[_0x33de('0x40')]('i.'+_0x32c920+_0x33de('0x5d'));}else{_0x2d6e2c['and']('i.'+_0x32c920+_0x33de('0x5e'),_0x3a5a26[_0x32c920]);}}});}return _0x2d6e2c;}function parseQueryParameters(_0x3421cd,_0x2bf50b,_0x1368f7){var _0xb53ac9=getSqlClauses();return Promise[_0x33de('0x5f')]()[_0x33de('0x60')](function(){return parseModelFields(_0x3421cd,_0x2bf50b,_0x1368f7);})[_0x33de('0x60')](function(_0xa0819f){_0xb53ac9[_0x33de('0x61')][_0x33de('0x40')](_0xa0819f);return parseReadParameter(_0x2bf50b[_0x33de('0x3f')]);})[_0x33de('0x60')](function(_0x541af6){_0xb53ac9[_0x33de('0x3f')][_0x33de('0x40')](_0x541af6);return parseTagParameter(_0x2bf50b[_0x33de('0x62')]);})[_0x33de('0x60')](function(_0x41db07){_0xb53ac9[_0x33de('0x48')]['clause'][_0x33de('0x40')](_0x41db07);return parseSearchFilter(_0x3421cd,_0x2bf50b[_0x33de('0x63')]);})[_0x33de('0x60')](function(_0x43a450){_0xb53ac9[_0x33de('0x63')]=_0x43a450;return _0xb53ac9;});}function checkAccountsRestrictions(_0x76c784,_0x46069c,_0x13bb18){var _0x252e1f=utils['getAccountFK'](_0x76c784);var _0x4216ae='get'+_[_0x33de('0x64')](_0x76c784)+(_0x76c784===_0x33de('0x65')?_0x33de('0x66'):_0x33de('0x67'));var _0x2f5b89=squel[_0x33de('0x21')]();return Promise[_0x33de('0x5f')]()[_0x33de('0x60')](function(){if(_0x13bb18['search']&&_0x46069c[_0x33de('0x5')]==='agent'){return _0x46069c[_0x4216ae]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1f5820){if(_0x1f5820){if(_0x1f5820['length']===0x0){_0x2f5b89[_0x33de('0x40')]('i.'+_0x252e1f+_0x33de('0x5d'));}else{_0x2f5b89['and']('i.'+_0x252e1f+_0x33de('0x55'),_['map'](_0x1f5820,'id'));}}else if(!_0x13bb18[_0x252e1f]){_0x2f5b89['and']('i.'+_0x252e1f+_0x33de('0x68'));}})[_0x33de('0x60')](function(){return _0x2f5b89;});}function getClosedOrderClause(_0x3037f8,_0x65e78c){var _0x3671ae='';var _0x389b52=[_0x33de('0x69'),_0x33de('0x6a'),_0x33de('0x6b')];if(_0x3037f8===_0x33de('0x2e')){_0x389b52[_0x33de('0x6c')](_0x33de('0x6d'));}if(_0x65e78c[_0x33de('0x6e')]==='0'&&_0x3037f8===_0x33de('0x2e')){_0x3671ae='i.substatus';}else{if(_0x65e78c[_0x33de('0x6e')]==='1'){_0x389b52[_0x33de('0x6f')]();}_0x3671ae='CONCAT_WS(\x27\x27,\x20'+_0x389b52[_0x33de('0x70')](',\x20')+')';}return _0x3671ae;}function getFilteredInteractions(_0x1a8e29,_0x3fcf26,_0x57170b,_0x1a0547){var _0x426ce5=utils['getInteractionFK'](_0x1a8e29);var _0x2e5f0b=_['capitalize'](_0x1a8e29)+_0x33de('0x71');var _0x481057=[];var _0x24d553=getTagsQuery();var _0x137af4={'type':db[_0x33de('0x72')][_0x33de('0x73')][_0x33de('0x74')],'raw':!![]};var _0xaa1b89=[];var _0x321a1d=[];return db[_0x33de('0x75')][_0x33de('0x76')](_0x24d553[_0x33de('0x77')](),_0x137af4)[_0x33de('0x60')](function(_0xfe00d5){_0x481057=_['keyBy'](_0xfe00d5,'id');_0x137af4=_[_0x33de('0x78')](_0x137af4,{'model':db[_0x2e5f0b],'mapToModel':!![],'nest':!![]});if(_0x57170b['fields']){_0x1a0547[_0x33de('0x79')][_0x33de('0x54')](function(_0x51a6ca){_0x3fcf26[_0x33de('0x8')]('i.'+_0x51a6ca);});}else{_0x3fcf26[_0x33de('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3fcf26[_0x33de('0x8')](_0x33de('0x7a'),'Account.key');_0x3fcf26[_0x33de('0x8')](_0x33de('0x7b'),_0x33de('0x7c'));if(_0x1a8e29==='mail'){_0x3fcf26[_0x33de('0x8')](_0x33de('0x7d'),_0x33de('0x7e'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x7f'),'contactName');_0x3fcf26[_0x33de('0x8')]('i.id');_0x3fcf26[_0x33de('0x8')]('i.createdAt');_0x3fcf26[_0x33de('0x8')]('i.updatedAt');_0x3fcf26[_0x33de('0x8')]('i.closed');_0x3fcf26[_0x33de('0x8')]('i.closedAt');_0x3fcf26[_0x33de('0x8')](_0x33de('0x80'));_0x3fcf26['field'](_0x33de('0x81'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x82'));_0x3fcf26['field']('i.subject');_0x3fcf26[_0x33de('0x8')]('i.disposition');_0x3fcf26[_0x33de('0x8')]('i.secondDisposition');_0x3fcf26[_0x33de('0x8')](_0x33de('0x69'));_0x3fcf26[_0x33de('0x8')]('i.substatus');_0x3fcf26[_0x33de('0x8')](_0x33de('0x83'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x84'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x85'));_0x3fcf26['field'](_0x33de('0x86'));}else if(_0x1a8e29===_0x33de('0x87')){_0x3fcf26[_0x33de('0x8')]('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',_0x33de('0x88'));}else{_0x3fcf26[_0x33de('0x8')](_0x33de('0x89'),'contactName');}if(_0x1a8e29!==_0x33de('0x2e')){_0x3fcf26['field']('i.*');}_0x3fcf26[_0x33de('0x8')](_0x33de('0x8a'),'Contact.firstName');_0x3fcf26[_0x33de('0x8')]('c.lastName',_0x33de('0x8b'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x8c'),_0x33de('0x8d'));_0x3fcf26[_0x33de('0x8')]('c.phone',_0x33de('0x8e'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x8f'),'Contact.mobile');_0x3fcf26[_0x33de('0x8')](_0x33de('0x90'),'Contact.fax');_0x3fcf26[_0x33de('0x8')](_0x33de('0x91'),'Owner.fullname');_0x3fcf26[_0x33de('0x8')]('o.internal',_0x33de('0x92'));_0x3fcf26[_0x33de('0x8')](_0x33de('0x93'),_0x33de('0x94'));}if(_0x1a0547[_0x33de('0x95')]){_0x3fcf26[_0x33de('0x95')](_0x1a0547['limit']);}if(_0x1a0547[_0x33de('0x96')]){_0x3fcf26['offset'](_0x1a0547[_0x33de('0x96')]);}return db[_0x33de('0x75')][_0x33de('0x76')](_0x3fcf26[_0x33de('0x77')](),_0x137af4);})[_0x33de('0x60')](function(_0x386add){_0xaa1b89=_0x386add;var _0x4cb685=getUsersQuery(_0x1a8e29,_0xaa1b89);return db[_0x33de('0x75')][_0x33de('0x76')](_0x4cb685[_0x33de('0x77')](),_0x137af4);})[_0x33de('0x60')](function(_0x1dab1e){_0x321a1d=_['groupBy'](_0x1dab1e,_0x426ce5);if(_0x1a8e29===_0x33de('0x2e')){return db['Setting'][_0x33de('0x97')]({'attributes':[_0x33de('0x98')],'raw':!![]});}})['then'](function(_0x1b1e75){var _0x481af0=_0x1b1e75?_0x1b1e75[_0x33de('0x98')]:undefined;var _0x3c63cf=_0xaa1b89[_0x33de('0x15')](function(_0x262189){return updateInteraction(_0x262189,_0x481057,_0x321a1d,_0x481af0);});return Promise[_0x33de('0x99')](_0x3c63cf);});}function countFilteredInteractions(_0x1d58be,_0x23f914){var _0x4882f7=_0x1d58be[_0x33de('0x9a')]();_0x4882f7[_0x33de('0x8')](_0x33de('0x9b'));_0x4882f7['field'](_0x33de('0x9c'),_0x33de('0x3e'));var _0x103aa5=utils[_0x33de('0x9d')](_0x23f914);if(!_['isEmpty'](_0x103aa5)){_0x4882f7[_0x33de('0x9e')](_0x33de('0x9f'),_0x103aa5);}var _0x2902f7={'type':db[_0x33de('0x72')]['QueryTypes'][_0x33de('0x74')],'raw':!![]};return db[_0x33de('0x75')]['query'](_0x4882f7['toString'](),_0x2902f7);}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 05d98c7..db0bcd7 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 _0x70a0=['catch','updateInteraction','TagIds','Tags','map','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x340916,_0x2b1417){var _0x489be0=function(_0x43a51a){while(--_0x43a51a){_0x340916['push'](_0x340916['shift']());}};_0x489be0(++_0x2b1417);}(_0x70a0,0x1d0));var _0x070a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x70a0[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x12abb9,_0x3c1e67){return new Promise(function(_0x5e97d8,_0x5d93c7){try{var _0x58c8ca=[];if(_0x3c1e67[_0x12abb9]){_0x58c8ca=_0x3c1e67[_0x12abb9][_0x070a('0x0')](function(_0x508622){return{'id':_0x508622['id'],'fullname':_0x508622['fullname']};});}return _0x5e97d8(_0x58c8ca);}catch(_0x3152cd){_0x5d93c7(_0x3152cd);}});}function getInteractionTags(_0x12935b,_0x3e1d0d){var _0x3cb159=[];if(_0x12935b){_0x12935b['split'](',')['forEach'](function(_0x3e2b33){_0x3cb159[_0x070a('0x1')](_0x3e1d0d[_0x3e2b33]);});}return _0x3cb159;}function updateWaitingCounter(_0x46f998){if(_0x46f998[_0x070a('0x2')]){_0x46f998['waiting']-=0x1;}}function updateInteractionCounters(_0x577aa9){_0x577aa9['waiting']=0x0;_0x577aa9['talking']=0x0;_0x577aa9[_0x070a('0x3')]=0x0;_0x577aa9[_0x070a('0x4')]=0x0;_0x577aa9[_0x070a('0x5')]=0x0;_0x577aa9[_0x070a('0x6')]=0x0;if(_0x577aa9[_0x070a('0x7')]){if(_0x577aa9[_0x070a('0x8')]==='abandoned'){_0x577aa9[_0x070a('0x5')]+=0x1;updateWaitingCounter(_0x577aa9);}if(_0x577aa9[_0x070a('0x9')]){_0x577aa9[_0x070a('0x3')]+=0x1;if(_0x577aa9[_0x070a('0xa')]){_0x577aa9['talking']-=0x1;}}else{if(_0x577aa9[_0x070a('0x8')]){_0x577aa9[_0x070a('0x4')]+=0x1;updateWaitingCounter(_0x577aa9);}}}else{if(!_0x577aa9[_0x070a('0x9')]){_0x577aa9[_0x070a('0x2')]+=0x1;}if(_0x577aa9[_0x070a('0x9')]){_0x577aa9['talking']+=0x1;updateWaitingCounter(_0x577aa9);}}_0x577aa9[_0x070a('0x6')]+=0x1;return _0x577aa9;}function getLastMessageText(_0x1f2033){return db[_0x070a('0xb')][_0x070a('0xc')]({'where':{'$and':[{'MailInteractionId':_0x1f2033['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x070a('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x070a('0xe')],'order':_0x070a('0xf'),'raw':!![]})[_0x070a('0x10')](function(_0xd4e8d6){if(_0xd4e8d6&&_0xd4e8d6[_0x070a('0xe')]){_0x1f2033[_0x070a('0x11')]=_[_0x070a('0x12')](_0xd4e8d6[_0x070a('0xe')]);}return _0x1f2033;})[_0x070a('0x13')](function(_0x316897){throw _0x316897;});}exports[_0x070a('0x14')]=function(_0x429de0,_0x4c33c0,_0x70b33f,_0x5ebfe3){return new Promise(function(_0x46f39e,_0x11f919){return getInteractionUsers(_0x429de0['id'],_0x70b33f)['then'](function(_0x562940){_0x429de0['Users']=_0x562940;return getInteractionTags(_0x429de0[_0x070a('0x15')],_0x4c33c0);})['then'](function(_0x362d24){_0x429de0[_0x070a('0x16')]=_0x362d24;delete _0x429de0[_0x070a('0x15')];return updateInteractionCounters(_0x429de0);})[_0x070a('0x10')](function(_0x3ea95c){if(_0x5ebfe3){return getLastMessageText(_0x3ea95c);}else{return _0x3ea95c;}})[_0x070a('0x10')](function(_0x350caa){_0x46f39e(_0x350caa);})[_0x070a('0x13')](function(_0x1bf676){_0x11f919(_0x1bf676);});});}; \ No newline at end of file +var _0xba76=['waiting','talking','answered','total','disposition','abandoned','UserId','unmanaged','MailMessage','findOne','out','-id','then','plainBody','lastMsgText','trimStart','catch','TagIds','lodash','../../mysqldb','map','fullname','split','forEach'];(function(_0x3f2ec7,_0x1d55d3){var _0x10ca4c=function(_0x272fcd){while(--_0x272fcd){_0x3f2ec7['push'](_0x3f2ec7['shift']());}};_0x10ca4c(++_0x1d55d3);}(_0xba76,0x102));var _0x6ba7=function(_0x285cf0,_0x4dbd24){_0x285cf0=_0x285cf0-0x0;var _0x106441=_0xba76[_0x285cf0];return _0x106441;};'use strict';var _=require(_0x6ba7('0x0'));var db=require(_0x6ba7('0x1'))['db'];function getInteractionUsers(_0x5a4fd8,_0xf6ed52){return new Promise(function(_0x185edd,_0x3fd6d8){try{var _0x1c6986=[];if(_0xf6ed52[_0x5a4fd8]){_0x1c6986=_0xf6ed52[_0x5a4fd8][_0x6ba7('0x2')](function(_0x21df8a){return{'id':_0x21df8a['id'],'fullname':_0x21df8a[_0x6ba7('0x3')]};});}return _0x185edd(_0x1c6986);}catch(_0x428469){_0x3fd6d8(_0x428469);}});}function getInteractionTags(_0x1f498e,_0xb11c5f){var _0x5e9613=[];if(_0x1f498e){_0x1f498e[_0x6ba7('0x4')](',')[_0x6ba7('0x5')](function(_0xcef015){_0x5e9613['push'](_0xb11c5f[_0xcef015]);});}return _0x5e9613;}function updateWaitingCounter(_0x3cafc1){if(_0x3cafc1[_0x6ba7('0x6')]){_0x3cafc1[_0x6ba7('0x6')]-=0x1;}}function updateInteractionCounters(_0x2682d5){_0x2682d5['waiting']=0x0;_0x2682d5[_0x6ba7('0x7')]=0x0;_0x2682d5[_0x6ba7('0x8')]=0x0;_0x2682d5['unmanaged']=0x0;_0x2682d5['abandoned']=0x0;_0x2682d5[_0x6ba7('0x9')]=0x0;if(_0x2682d5['closed']){if(_0x2682d5[_0x6ba7('0xa')]===_0x6ba7('0xb')){_0x2682d5['abandoned']+=0x1;updateWaitingCounter(_0x2682d5);}if(_0x2682d5[_0x6ba7('0xc')]){_0x2682d5[_0x6ba7('0x8')]+=0x1;if(_0x2682d5['talking']){_0x2682d5['talking']-=0x1;}}else{if(_0x2682d5[_0x6ba7('0xa')]){_0x2682d5[_0x6ba7('0xd')]+=0x1;updateWaitingCounter(_0x2682d5);}}}else{if(!_0x2682d5[_0x6ba7('0xc')]){_0x2682d5['waiting']+=0x1;}if(_0x2682d5['UserId']){_0x2682d5[_0x6ba7('0x7')]+=0x1;updateWaitingCounter(_0x2682d5);}}_0x2682d5[_0x6ba7('0x9')]+=0x1;return _0x2682d5;}function getLastMessageText(_0x291166){return db[_0x6ba7('0xe')][_0x6ba7('0xf')]({'where':{'$and':[{'MailInteractionId':_0x291166['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6ba7('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x6ba7('0x11'),'raw':!![]})[_0x6ba7('0x12')](function(_0x2dbcbc){if(_0x2dbcbc&&_0x2dbcbc[_0x6ba7('0x13')]){_0x291166[_0x6ba7('0x14')]=_[_0x6ba7('0x15')](_0x2dbcbc[_0x6ba7('0x13')]);}return _0x291166;})[_0x6ba7('0x16')](function(_0x50c23c){throw _0x50c23c;});}exports['updateInteraction']=function(_0x13c01e,_0x5492d7,_0x308486,_0x4cc171){return new Promise(function(_0x1a08c6,_0x998a77){return getInteractionUsers(_0x13c01e['id'],_0x308486)[_0x6ba7('0x12')](function(_0x5e659c){_0x13c01e['Users']=_0x5e659c;return getInteractionTags(_0x13c01e[_0x6ba7('0x17')],_0x5492d7);})[_0x6ba7('0x12')](function(_0xfa49fb){_0x13c01e['Tags']=_0xfa49fb;delete _0x13c01e[_0x6ba7('0x17')];return updateInteractionCounters(_0x13c01e);})[_0x6ba7('0x12')](function(_0x6bc460){if(_0x4cc171){return getLastMessageText(_0x6bc460);}else{return _0x6bc460;}})[_0x6ba7('0x12')](function(_0x1d5230){_0x1a08c6(_0x1d5230);})[_0x6ba7('0x16')](function(_0x5f2852){_0x998a77(_0x5f2852);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 660e489..f8f97a3 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 _0x2aab=['../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','name','role','stringify','null','Interaction','findOne','update','then','info','lodash'];(function(_0x2b3043,_0x1a9e4d){var _0x176d45=function(_0x4f09c0){while(--_0x4f09c0){_0x2b3043['push'](_0x2b3043['shift']());}};_0x176d45(++_0x1a9e4d);}(_0x2aab,0x1bf));var _0xb2aa=function(_0x2d37b3,_0x533ad0){_0x2d37b3=_0x2d37b3-0x0;var _0x9aaac0=_0x2aab[_0x2d37b3];return _0x9aaac0;};'use strict';var _=require(_0xb2aa('0x0'));var db=require(_0xb2aa('0x1'))['db'];var loggers={'openchannel':require(_0xb2aa('0x2'))(_0xb2aa('0x3')),'mail':require(_0xb2aa('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xb2aa('0x2'))(_0xb2aa('0x4')),'chat':require(_0xb2aa('0x2'))(_0xb2aa('0x5')),'whatsapp':require('../../config/logger')(_0xb2aa('0x6'))};function getAccountFK(_0xc9975){return _[_0xb2aa('0x7')](_0xc9975)+(_0xc9975===_0xb2aa('0x8')?_0xb2aa('0x9'):'Account')+'Id';}function getInteractionFK(_0x38643e){return _[_0xb2aa('0x7')](_0x38643e)+'InteractionId';}function getInteractionId(_0x454b18,_0x197ee3,_0xe159c1){if(_0x454b18&&_0x454b18[_[_0xb2aa('0xa')](_0xe159c1)+_0xb2aa('0xb')]){return _0x454b18[_[_0xb2aa('0xa')](_0xe159c1)+_0xb2aa('0xb')];}else if(_0x454b18&&_0x454b18['id']){return _0x454b18['id'];}else if(_0x197ee3&&_0x197ee3['id']){return _0x197ee3['id'];}else{return'unknown';}}function getInteractionsTables(_0x482e2b){return{'accounts':_0x482e2b+'_'+(_0x482e2b===_0xb2aa('0x8')?_0xb2aa('0xc'):_0xb2aa('0xd')),'interactions':_0x482e2b+_0xb2aa('0xe'),'interactionsTags':_0x482e2b+_0xb2aa('0xf'),'messages':_0x482e2b+'_messages','userInteractions':_0xb2aa('0x10')+_0x482e2b+'_interactions'};}function getSelectedTags(_0x3b5ea1){var _0x4a43ac=[];if(_0x3b5ea1){_0x4a43ac=Array[_0xb2aa('0x11')](_0x3b5ea1)?_0x3b5ea1:[_0x3b5ea1];}return _0x4a43ac;}function log(_0x3d438c,_0x205689,_0x563698,_0x274625,_0xd59406,_0x36c70a){loggers[_0xd59406[_0xb2aa('0x12')]()][_0x3d438c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36c70a['toUpperCase'](),_0x205689?_0x205689['id']:null,_0x205689?_0x205689[_0xb2aa('0x13')]:null,_0x205689?_0x205689[_0xb2aa('0x14')]:null,getInteractionId(_0x563698,_0x274625,_0xd59406),_0x563698?JSON[_0xb2aa('0x15')](_0x563698):_0xb2aa('0x16'));}function updateUser(_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d){db[_[_0xb2aa('0xa')](_0x1b1a10)+_0xb2aa('0x17')][_0xb2aa('0x18')]({'where':{'id':getInteractionId(_0x46a603,_0x1d3f68,_0x1b1a10)}})['then'](function(_0x247c0f){if(_0x247c0f){return _0x247c0f[_0xb2aa('0x19')]({'UserId':_0x16c2b7?_0x16c2b7['id']:null});}})[_0xb2aa('0x1a')](function(_0x664bd5){if(_0x664bd5){log(_0xb2aa('0x1b'),_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d);}})['catch'](function(){log('error',_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xcf1a=['role','null','Interaction','findOne','then','update','info','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','toUpperCase','name'];(function(_0x2feb52,_0x9f27d7){var _0x30225a=function(_0x4d8973){while(--_0x4d8973){_0x2feb52['push'](_0x2feb52['shift']());}};_0x30225a(++_0x9f27d7);}(_0xcf1a,0x148));var _0xacf1=function(_0x4e1eac,_0x258749){_0x4e1eac=_0x4e1eac-0x0;var _0x2994db=_0xcf1a[_0x4e1eac];return _0x2994db;};'use strict';var _=require(_0xacf1('0x0'));var db=require(_0xacf1('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xacf1('0x2')),'mail':require(_0xacf1('0x3'))(_0xacf1('0x4')),'fax':require(_0xacf1('0x3'))(_0xacf1('0x5')),'sms':require('../../config/logger')(_0xacf1('0x6')),'chat':require(_0xacf1('0x3'))('chat-interactions'),'whatsapp':require(_0xacf1('0x3'))(_0xacf1('0x7'))};function getAccountFK(_0x502e29){return _[_0xacf1('0x8')](_0x502e29)+(_0x502e29===_0xacf1('0x9')?_0xacf1('0xa'):'Account')+'Id';}function getInteractionFK(_0x4f73f2){return _[_0xacf1('0x8')](_0x4f73f2)+_0xacf1('0xb');}function getInteractionId(_0x52f548,_0x3c0113,_0x360eac){if(_0x52f548&&_0x52f548[_['upperFirst'](_0x360eac)+_0xacf1('0xb')]){return _0x52f548[_[_0xacf1('0xc')](_0x360eac)+_0xacf1('0xb')];}else if(_0x52f548&&_0x52f548['id']){return _0x52f548['id'];}else if(_0x3c0113&&_0x3c0113['id']){return _0x3c0113['id'];}else{return'unknown';}}function getInteractionsTables(_0x104363){return{'accounts':_0x104363+'_'+(_0x104363==='chat'?_0xacf1('0xd'):_0xacf1('0xe')),'interactions':_0x104363+_0xacf1('0xf'),'interactionsTags':_0x104363+_0xacf1('0x10'),'messages':_0x104363+_0xacf1('0x11'),'userInteractions':'user_has_'+_0x104363+'_interactions'};}function getSelectedTags(_0x3b3e0f){var _0x1c8ef1=[];if(_0x3b3e0f){_0x1c8ef1=Array['isArray'](_0x3b3e0f)?_0x3b3e0f:[_0x3b3e0f];}return _0x1c8ef1;}function log(_0x6f2ace,_0x19f00c,_0x141cd8,_0x4600b3,_0x33594e,_0x4c9785){loggers[_0x33594e['toLowerCase']()][_0x6f2ace]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c9785[_0xacf1('0x12')](),_0x19f00c?_0x19f00c['id']:null,_0x19f00c?_0x19f00c[_0xacf1('0x13')]:null,_0x19f00c?_0x19f00c[_0xacf1('0x14')]:null,getInteractionId(_0x141cd8,_0x4600b3,_0x33594e),_0x141cd8?JSON['stringify'](_0x141cd8):_0xacf1('0x15'));}function updateUser(_0x49405b,_0x33969a,_0x1b270a,_0x2389c2,_0xa6126){db[_[_0xacf1('0xc')](_0x2389c2)+_0xacf1('0x16')][_0xacf1('0x17')]({'where':{'id':getInteractionId(_0x33969a,_0x1b270a,_0x2389c2)}})[_0xacf1('0x18')](function(_0x388247){if(_0x388247){return _0x388247[_0xacf1('0x19')]({'UserId':_0x49405b?_0x49405b['id']:null});}})[_0xacf1('0x18')](function(_0x1bff0c){if(_0x1bff0c){log(_0xacf1('0x1a'),_0x49405b,_0x33969a,_0x1b270a,_0x2389c2,_0xa6126);}})['catch'](function(){log(_0xacf1('0x1b'),_0x49405b,_0x33969a,_0x1b270a,_0x2389c2,_0xa6126);});}module[_0xacf1('0x1c')]={'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 1c24e45..fc06fa0 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 _0x34c1=['use','License','findOne','then','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','update','base64','utf8','final','parse','hasOwnProperty'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0x34c1,0x16c));var _0x134c=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0x34c1[_0x6899c7];return _0x5186ee;};'use strict';var crypto=require(_0x134c('0x0'));var util=require(_0x134c('0x1'));var compose=require('composable-middleware');var db=require(_0x134c('0x2'))['db'];var config=require(_0x134c('0x3'));function getValueFromLicense(_0x488814,_0x389d09){if(_0x488814&&_0x389d09){if(_0x389d09[_0x134c('0x4')]&&_0x389d09[_0x134c('0x5')]){var _0x138220=_0x389d09['data1'];var _0x41146a=_0x389d09[_0x134c('0x5')];var _0x5718d6=_0x138220[_0x134c('0x6')]('-')[0x4];var _0x521262=_0x138220['split']('-')[0x0];var _0x32d43c=crypto['createDecipher'](_0x134c('0x7'),util['format']('%s:%s:%s',_0x5718d6,_0x138220,_0x521262));var _0x3a206a=_0x32d43c[_0x134c('0x8')](_0x41146a,_0x134c('0x9'),_0x134c('0xa'));_0x3a206a+=_0x32d43c[_0x134c('0xb')](_0x134c('0xa'));var _0x3e04aa=JSON[_0x134c('0xc')](_0x3a206a);return _0x3e04aa[_0x134c('0xd')](_0x488814)?_0x3e04aa[_0x488814]:null;}}return null;}function isLimit(_0x336bb3,_0x534e2c,_0x423b96,_0x40b13d){var _0x253e63=_0x534e2c;return compose()[_0x134c('0xe')](function(_0x44a9c5,_0x54f446,_0xfa5c4c){return db[_0x134c('0xf')][_0x134c('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x134c('0x11')](function(_0x4b7609){var _0x3ad6dd=getValueFromLicense(_0x336bb3,_0x4b7609);return _0x3ad6dd?_0x3ad6dd:_0x253e63;})[_0x134c('0x11')](function(_0x39da36){_0x253e63=_0x39da36;return _0x423b96['count'](_0x40b13d);})[_0x134c('0x11')](function(_0x410793){if(_0x410793>=_0x253e63){return _0x54f446['status'](0x193)[_0x134c('0x12')]({'message':util[_0x134c('0x13')](_0x134c('0x14'),_0x336bb3)});}_0xfa5c4c();})[_0x134c('0x15')](function(_0x2fd135){_0xfa5c4c(_0x2fd135);});});}function isUserLimit(){return isLimit(_0x134c('0x16'),0x1,db[_0x134c('0x17')],{'where':{'$or':[{'role':_0x134c('0x18')},{'role':_0x134c('0x19')}]}});}exports[_0x134c('0x1a')]=isUserLimit; \ No newline at end of file +var _0xcbde=['../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0x3d1bd2,_0x51ffe1){var _0x574ee4=function(_0xc1980e){while(--_0xc1980e){_0x3d1bd2['push'](_0x3d1bd2['shift']());}};_0x574ee4(++_0x51ffe1);}(_0xcbde,0x141));var _0xecbd=function(_0x54b1d5,_0x373761){_0x54b1d5=_0x54b1d5-0x0;var _0x469ba9=_0xcbde[_0x54b1d5];return _0x469ba9;};'use strict';var crypto=require(_0xecbd('0x0'));var util=require('util');var compose=require(_0xecbd('0x1'));var db=require(_0xecbd('0x2'))['db'];var config=require(_0xecbd('0x3'));function getValueFromLicense(_0x456f7f,_0x1a4c26){if(_0x456f7f&&_0x1a4c26){if(_0x1a4c26['data1']&&_0x1a4c26['license']){var _0x12470a=_0x1a4c26[_0xecbd('0x4')];var _0x566536=_0x1a4c26[_0xecbd('0x5')];var _0x27a04d=_0x12470a['split']('-')[0x4];var _0x5d1ba5=_0x12470a[_0xecbd('0x6')]('-')[0x0];var _0x3e9e7a=crypto[_0xecbd('0x7')](_0xecbd('0x8'),util[_0xecbd('0x9')](_0xecbd('0xa'),_0x27a04d,_0x12470a,_0x5d1ba5));var _0x493b24=_0x3e9e7a[_0xecbd('0xb')](_0x566536,'base64',_0xecbd('0xc'));_0x493b24+=_0x3e9e7a['final']('utf8');var _0x3ddb13=JSON['parse'](_0x493b24);return _0x3ddb13[_0xecbd('0xd')](_0x456f7f)?_0x3ddb13[_0x456f7f]:null;}}return null;}function isLimit(_0x24ec82,_0x4cd06f,_0x3c6429,_0x444a88){var _0x447856=_0x4cd06f;return compose()[_0xecbd('0xe')](function(_0x27c02a,_0x2ba71e,_0x1f4122){return db[_0xecbd('0xf')][_0xecbd('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0xc7bb2b){var _0x1607ec=getValueFromLicense(_0x24ec82,_0xc7bb2b);return _0x1607ec?_0x1607ec:_0x447856;})[_0xecbd('0x11')](function(_0x3805a){_0x447856=_0x3805a;return _0x3c6429[_0xecbd('0x12')](_0x444a88);})[_0xecbd('0x11')](function(_0x26d4c4){if(_0x26d4c4>=_0x447856){return _0x2ba71e[_0xecbd('0x13')](0x193)[_0xecbd('0x14')]({'message':util[_0xecbd('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x24ec82)});}_0x1f4122();})[_0xecbd('0x15')](function(_0x57c160){_0x1f4122(_0x57c160);});});}function isUserLimit(){return isLimit(_0xecbd('0x16'),0x1,db[_0xecbd('0x17')],{'where':{'$or':[{'role':_0xecbd('0x18')},{'role':_0xecbd('0x19')}]}});}exports[_0xecbd('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 05c0155..09a55bb 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 _0xb24a=['utcOffset','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','split','shift','forEach','filter','indexOf','map','push','buildExpression','DATE','operator','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop'];(function(_0x11c703,_0x17b6ea){var _0x45136d=function(_0x4930af){while(--_0x4930af){_0x11c703['push'](_0x11c703['shift']());}};_0x45136d(++_0x17b6ea);}(_0xb24a,0xe0));var _0xab24=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xb24a[_0x385eb1];return _0x5d40eb;};'use strict';var _=require(_0xab24('0x0'));var moment=require(_0xab24('0x1'));exports['parseSearch']=function(_0xa50cc5){var _0x53f10c={'conditions':[]};_0x53f10c['sqlOperator']=_[_0xab24('0x2')](_0xa50cc5,_0xab24('0x3'))?'or':_0xab24('0x4');var _0x2989f7=_0xa50cc5[_0xab24('0x5')]('[$and]','')[_0xab24('0x5')](_0xab24('0x3'),'')[_0xab24('0x6')]('||');for(var _0x3c346c=0x0;_0x3c346c<_0x2989f7['length'];_0x3c346c++){var _0xdd0def=_0x2989f7[_0x3c346c]['split'](':=');var _0x343d75=_0xdd0def[0x0];var _0x269331=_0xdd0def['slice'](0x1);_0x269331['forEach'](function(_0x3a289a){var _0x273bec=_0x3a289a[_0xab24('0x6')]('[')[_0xab24('0x7')]();var _0x47baf0=_0x3a289a['match'](/\[(.*?)\]/g);_0x47baf0[_0xab24('0x8')](function(_0x45cc4b){var _0x18cd4f=_0x45cc4b[_0xab24('0x6')]('[')[_0xab24('0x9')](function(_0x283d29){return _0x283d29[_0xab24('0xa')](']')>-0x1;})[_0xab24('0xb')](function(_0x4d1110){return _0x4d1110[_0xab24('0x6')](']')[0x0];})[0x0];_0x53f10c['conditions'][_0xab24('0xc')]({'field':_0x343d75,'operator':_0x273bec,'value':_0x18cd4f});});});}return _0x53f10c;};exports[_0xab24('0xd')]=function(_0x43967a,_0x3c28b3,_0x4d18be){var _0x39e2df={};if(_0x3c28b3===_0xab24('0xe')){if(_0x4d18be[_0xab24('0xf')]==='$eq'){_0x4d18be['operator']='$between';_0x4d18be[_0xab24('0x10')]+=','+_0x4d18be[_0xab24('0x10')];}else if(_['includes']([_0xab24('0x11'),_0xab24('0x12')],_0x4d18be[_0xab24('0xf')])){_0x4d18be['value']=moment(_0x4d18be['value'])[_0xab24('0x13')](0x1,_0xab24('0x14'))[_0xab24('0x15')](_0xab24('0x16'));}}if(_0x4d18be[_0xab24('0x17')]){_0x3c28b3=_0x4d18be[_0xab24('0x17')];_0x39e2df[_0xab24('0x18')]=_0xab24('0x19')+_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+_0xab24('0x1b')+_0x4d18be[_0xab24('0x17')]+')\x20'+parseOperator(_0x4d18be[_0xab24('0xf')]);}else{_0x39e2df[_0xab24('0x18')]=_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+'\x20'+parseOperator(_0x4d18be[_0xab24('0xf')]);}if(_[_0xab24('0x1c')]([_0xab24('0x1d'),_0xab24('0x1e')],_0x4d18be[_0xab24('0xf')]))_0x39e2df[_0xab24('0x18')]='('+_0x39e2df[_0xab24('0x18')]+_0xab24('0x1f')+_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+_0xab24('0x20');_0x39e2df[_0xab24('0x10')]=parseValue(_0x3c28b3,_0x4d18be[_0xab24('0xf')],_0x4d18be[_0xab24('0x10')]);return _0x39e2df;};function parseOperator(_0x5bb1e7){var _0x340443;switch(_0x5bb1e7){case _0xab24('0x21'):_0x340443=_0xab24('0x22');break;case _0xab24('0x1e'):_0x340443=_0xab24('0x23');break;case _0xab24('0x24'):_0x340443=_0xab24('0x25');break;case'$ne':_0x340443=_0xab24('0x26');break;case'$substring':case _0xab24('0x27'):case'$endsWith':_0x340443=_0xab24('0x28');break;case'$lt':_0x340443='<\x20?';break;case _0xab24('0x11'):_0x340443=_0xab24('0x29');break;case _0xab24('0x12'):_0x340443=_0xab24('0x2a');break;case _0xab24('0x2b'):_0x340443=_0xab24('0x2c');break;case _0xab24('0x2d'):_0x340443=_0xab24('0x2e');break;}return _0x340443;}function parseValue(_0x3a8a79,_0x5b1c1c,_0xfec1ae){var _0x39bdb3={'start':undefined,'end':undefined};switch(_0x5b1c1c){case _0xab24('0x21'):case _0xab24('0x1e'):_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae[_0xab24('0x6')](',');break;case _0xab24('0x30'):_0x39bdb3['start']='%'+_0xfec1ae+'%';break;case _0xab24('0x27'):_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae+'%';break;case _0xab24('0x31'):_0x39bdb3[_0xab24('0x2f')]='%'+_0xfec1ae;break;case _0xab24('0x2d'):var _0x563c47=_0xfec1ae[_0xab24('0x6')](',');var _0xfec1ae=_0x563c47[_0xab24('0x7')]();var _0x2b38f=_0x563c47[_0xab24('0x32')]();if(_0x3a8a79==='DATE'){_0xfec1ae=moment(_0xfec1ae)[_0xab24('0x33')](0x0,!![])['format']();_0x2b38f=moment(_0x2b38f)[_0xab24('0x33')](0x0,!![])[_0xab24('0x13')](0x17,_0xab24('0x34'))[_0xab24('0x13')](0x3b,_0xab24('0x35'))[_0xab24('0x13')](0x3b,_0xab24('0x36'))['format']();}_0x39bdb3={'start':_0xfec1ae,'end':_0x2b38f};break;default:_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae;break;}return _0x39bdb3;} \ No newline at end of file +var _0x5367=['match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','operator','value','includes','$lte','days','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','$between','start','utcOffset','format','add','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift'];(function(_0x21417b,_0xdee074){var _0x2342f7=function(_0x3e9850){while(--_0x3e9850){_0x21417b['push'](_0x21417b['shift']());}};_0x2342f7(++_0xdee074);}(_0x5367,0xd4));var _0x7536=function(_0x4c97d2,_0x52c766){_0x4c97d2=_0x4c97d2-0x0;var _0x493766=_0x5367[_0x4c97d2];return _0x493766;};'use strict';var _=require(_0x7536('0x0'));var moment=require('moment');exports[_0x7536('0x1')]=function(_0x3a03ba){var _0x3ab11a={'conditions':[]};_0x3ab11a[_0x7536('0x2')]=_[_0x7536('0x3')](_0x3a03ba,_0x7536('0x4'))?'or':_0x7536('0x5');var _0x137467=_0x3a03ba[_0x7536('0x6')]('[$and]','')['replace'](_0x7536('0x4'),'')[_0x7536('0x7')]('||');for(var _0x515457=0x0;_0x515457<_0x137467[_0x7536('0x8')];_0x515457++){var _0x30bfd3=_0x137467[_0x515457][_0x7536('0x7')](':=');var _0x368e8c=_0x30bfd3[0x0];var _0x5943b5=_0x30bfd3[_0x7536('0x9')](0x1);_0x5943b5[_0x7536('0xa')](function(_0x4e0d71){var _0x4a98d7=_0x4e0d71[_0x7536('0x7')]('[')[_0x7536('0xb')]();var _0x8245e9=_0x4e0d71[_0x7536('0xc')](/\[(.*?)\]/g);_0x8245e9[_0x7536('0xa')](function(_0x26822e){var _0x254cb3=_0x26822e[_0x7536('0x7')]('[')[_0x7536('0xd')](function(_0x566eea){return _0x566eea[_0x7536('0xe')](']')>-0x1;})[_0x7536('0xf')](function(_0x2dadb1){return _0x2dadb1['split'](']')[0x0];})[0x0];_0x3ab11a[_0x7536('0x10')][_0x7536('0x11')]({'field':_0x368e8c,'operator':_0x4a98d7,'value':_0x254cb3});});});}return _0x3ab11a;};exports[_0x7536('0x12')]=function(_0x41aec5,_0x4b919c,_0x336d28){var _0x36b9f9={};if(_0x4b919c===_0x7536('0x13')){if(_0x336d28['operator']===_0x7536('0x14')){_0x336d28[_0x7536('0x15')]='$between';_0x336d28[_0x7536('0x16')]+=','+_0x336d28[_0x7536('0x16')];}else if(_[_0x7536('0x17')](['$gt',_0x7536('0x18')],_0x336d28[_0x7536('0x15')])){_0x336d28[_0x7536('0x16')]=moment(_0x336d28[_0x7536('0x16')])['add'](0x1,_0x7536('0x19'))['format'](_0x7536('0x1a'));}}if(_0x336d28['castTo']){_0x4b919c=_0x336d28[_0x7536('0x1b')];_0x36b9f9[_0x7536('0x1c')]=_0x7536('0x1d')+_0x41aec5+'.'+_0x336d28[_0x7536('0x1e')]+_0x7536('0x1f')+_0x336d28[_0x7536('0x1b')]+')\x20'+parseOperator(_0x336d28[_0x7536('0x15')]);}else{_0x36b9f9[_0x7536('0x1c')]=_0x41aec5+'.'+_0x336d28['field']+'\x20'+parseOperator(_0x336d28['operator']);}if(_[_0x7536('0x17')]([_0x7536('0x20'),_0x7536('0x21')],_0x336d28[_0x7536('0x15')]))_0x36b9f9[_0x7536('0x1c')]='('+_0x36b9f9['text']+_0x7536('0x22')+_0x41aec5+'.'+_0x336d28[_0x7536('0x1e')]+_0x7536('0x23');_0x36b9f9[_0x7536('0x16')]=parseValue(_0x4b919c,_0x336d28[_0x7536('0x15')],_0x336d28[_0x7536('0x16')]);return _0x36b9f9;};function parseOperator(_0x488858){var _0xe11268;switch(_0x488858){case _0x7536('0x24'):_0xe11268=_0x7536('0x25');break;case _0x7536('0x21'):_0xe11268=_0x7536('0x26');break;case _0x7536('0x14'):_0xe11268=_0x7536('0x27');break;case _0x7536('0x20'):_0xe11268=_0x7536('0x28');break;case _0x7536('0x29'):case _0x7536('0x2a'):case _0x7536('0x2b'):_0xe11268=_0x7536('0x2c');break;case _0x7536('0x2d'):_0xe11268='<\x20?';break;case'$gt':_0xe11268=_0x7536('0x2e');break;case _0x7536('0x18'):_0xe11268=_0x7536('0x2f');break;case _0x7536('0x30'):_0xe11268='>=\x20?';break;case _0x7536('0x31'):_0xe11268='BETWEEN\x20?\x20AND\x20?';break;}return _0xe11268;}function parseValue(_0x7a7225,_0x44716f,_0x4274cf){var _0x12efd3={'start':undefined,'end':undefined};switch(_0x44716f){case _0x7536('0x24'):case _0x7536('0x21'):_0x12efd3['start']=_0x4274cf[_0x7536('0x7')](',');break;case _0x7536('0x29'):_0x12efd3[_0x7536('0x32')]='%'+_0x4274cf+'%';break;case'$startsWith':_0x12efd3[_0x7536('0x32')]=_0x4274cf+'%';break;case _0x7536('0x2b'):_0x12efd3[_0x7536('0x32')]='%'+_0x4274cf;break;case _0x7536('0x31'):var _0x4ee1f8=_0x4274cf['split'](',');var _0x4274cf=_0x4ee1f8['shift']();var _0x1f7f58=_0x4ee1f8['pop']();if(_0x7a7225===_0x7536('0x13')){_0x4274cf=moment(_0x4274cf)[_0x7536('0x33')](0x0,!![])[_0x7536('0x34')]();_0x1f7f58=moment(_0x1f7f58)[_0x7536('0x33')](0x0,!![])[_0x7536('0x35')](0x17,_0x7536('0x36'))[_0x7536('0x35')](0x3b,'minutes')['add'](0x3b,_0x7536('0x37'))[_0x7536('0x34')]();}_0x12efd3={'start':_0x4274cf,'end':_0x1f7f58};break;default:_0x12efd3[_0x7536('0x32')]=_0x4274cf;break;}return _0x12efd3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b737ec1..4eb70b2 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 _0xdd50=['unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','query','$id','model','keys','filters','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','VIRTUAL','lower','merge','options','include','includeAll','sequelize','moment','../../mysqldb','parse','alias','fields','raw','split','isEmpty','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','substr','DESC','col','unsigned','ASC','omit','length','isString'];(function(_0x475022,_0x1ce40b){var _0x2259c8=function(_0x4d88b2){while(--_0x4d88b2){_0x475022['push'](_0x475022['shift']());}};_0x2259c8(++_0x1ce40b);}(_0xdd50,0x172));var _0x0dd5=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xdd50[_0x1655bb];return _0x5e2020;};'use strict';var _=require('lodash');var sequelize=require(_0x0dd5('0x0'));var moment=require(_0x0dd5('0x1'));var db=require(_0x0dd5('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x36ae3d){var _0x129bde=['ne'];try{var _0x12af99=JSON['parse'](_0x36ae3d);var _0x51d2d8=Object['keys'](_0x12af99)[0x0];return _0x129bde['includes'](_0x51d2d8);}catch(_0x27ea09){return![];}}function getOperatorValue(_0x4f6b13){var _0x9471f5=JSON[_0x0dd5('0x3')](_0x4f6b13);var _0x91b1a=Object['keys'](_0x9471f5)[0x0];var _0x122096=_0x9471f5[_0x91b1a];return{['$'+_0x91b1a]:_0x122096};}function parseIncludeModel(_0x27611e){var _0x3036fe=JSON['parse'](_0x27611e);return{'model':db[_0x3036fe['model']],'as':_0x3036fe[_0x0dd5('0x4')],'attributes':_0x3036fe[_0x0dd5('0x5')],'raw':_0x3036fe[_0x0dd5('0x6')]};}exports['fields']=function(_0x574b2e){var _0x194b50=null;if(_0x574b2e){_0x194b50=_0x574b2e[_0x0dd5('0x7')](',');}return _0x194b50;};exports['filters']=function(_0x49c5e0,_0x310a22){var _0x320b20={};if(!_[_0x0dd5('0x8')](_0x49c5e0)){_['forOwn'](_0x49c5e0,function(_0x7997d6,_0x4a3edd){try{if(_0x310a22){var _0x165175=_['find'](_0x310a22,{'name':_0x4a3edd})||{};if(hasSequelizeOperator(_0x7997d6)){_0x320b20[_0x4a3edd]=getOperatorValue(_0x7997d6);}else if(_0x165175[_0x0dd5('0x9')]===_0x0dd5('0xa')&&_[_0x0dd5('0xb')](_0x7997d6)){var _0x1afc50=JSON[_0x0dd5('0x3')](_0x7997d6);var _0x259654={'$gte':moment(moment(_0x1afc50['$gte'])[_0x0dd5('0xc')](_0x0dd5('0xd')))[_0x0dd5('0xe')]()[_0x0dd5('0xc')](),'$lte':moment(moment(_0x1afc50['$lte'])[_0x0dd5('0xc')](_0x0dd5('0xd')))[_0x0dd5('0xe')]()['subtract'](0x1,'s')[_0x0dd5('0xc')]()};_0x320b20[_0x4a3edd]=_0x259654;}else if(_0x165175[_0x0dd5('0xf')]===_0x0dd5('0x10')){_0x320b20[_0x4a3edd]=_0x7997d6;}else{_0x320b20[_0x4a3edd]=_[_0x0dd5('0x11')](_0x7997d6)?_0x7997d6:JSON[_0x0dd5('0x3')](_0x7997d6);}}else{_0x320b20[_0x4a3edd]=_[_0x0dd5('0x11')](_0x7997d6)?_0x7997d6:JSON[_0x0dd5('0x3')](_0x7997d6);}}catch(_0x50cc2c){_0x320b20[_0x4a3edd]=_0x7997d6[_0x0dd5('0x7')](',');}});}return _0x320b20;};exports[_0x0dd5('0x12')]=function(_0x5cae24){_0x5cae24=parseInt(_0x5cae24,0xa);if(!_0x5cae24||_0x5cae24<0x0){_0x5cae24=LIMIT_VALUE;}return _0x5cae24;};exports[_0x0dd5('0x13')]=function(_0x2f2b70){_0x2f2b70=parseInt(_0x2f2b70,0xa);if(!_0x2f2b70||_0x2f2b70<0x0){_0x2f2b70=0x0;}return _0x2f2b70;};exports[_0x0dd5('0x14')]=function(_0x2c8eca){var _0x20c7a2,_0x4b2539=null;if(_0x2c8eca){_0x20c7a2=_0x2c8eca[_0x0dd5('0x7')](',');_0x4b2539=_[_0x0dd5('0x15')](_0x20c7a2,function(_0x3998b7){if(_0x3998b7[_0x0dd5('0x16')]('-')===0x0){return[_0x3998b7===_0x0dd5('0x17')?sequelize['cast'](sequelize['col'](_0x0dd5('0x17')),'unsigned'):_0x3998b7[_0x0dd5('0x18')](0x1),_0x0dd5('0x19')];}else{return[_0x3998b7===_0x0dd5('0x17')?sequelize['cast'](sequelize[_0x0dd5('0x1a')]('priority'),_0x0dd5('0x1b')):_0x3998b7,_0x0dd5('0x1c')];}});}return _0x4b2539;};exports[_0x0dd5('0x1d')]=function(_0x36f852,_0x36132f){if(_[_0x0dd5('0x8')](_0x36f852)){return _0x36f852;}if(_[_0x0dd5('0x11')](_0x36f852)){for(var _0x16cf0b=0x0;_0x16cf0b<_0x36f852[_0x0dd5('0x1e')];_0x16cf0b+=0x1){_0x36f852[_0x16cf0b]=this[_0x0dd5('0x1d')](_0x36f852[_0x16cf0b],_0x36132f);}return _0x36f852;}if(!_['isObject'](_0x36f852)){return _0x36f852;}if(_[_0x0dd5('0x1f')](_0x36132f)){_0x36132f=[_0x36132f];}if(!_[_0x0dd5('0x11')](_0x36132f)){return _0x36f852;}for(var _0x134a50=0x0;_0x134a50<_0x36132f[_0x0dd5('0x1e')];_0x134a50+=0x1){_[_0x0dd5('0x20')](_0x36f852,_0x36132f[_0x134a50]);}for(var _0x5ac12e in _0x36f852){if(_0x36f852[_0x0dd5('0x21')](_0x5ac12e)){_0x36f852[_0x5ac12e]=this['omit'](_0x36f852[_0x5ac12e],_0x36132f);}}return _0x36f852;};exports[_0x0dd5('0x22')]=function(_0x44efc1){return _0x44efc1['match'](RegExp(_0x0dd5('0x23')))?!![]:![];};exports[_0x0dd5('0x24')]=function(_0x5d39e0){return _0x5d39e0[_0x0dd5('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x0dd5('0x26')]=function(_0x30a414,_0x51adbd){var _0xabd4a5=[];var _0x3e8853=/[ `!@#$%^&*()_\-?~]/;var _0x278079=_0x51adbd?_0x0dd5('0x27'):'{EXPR}';_0x30a414[_0x0dd5('0x7')](/[ ,]+/)[_0x0dd5('0x28')](function(_0x265bf6){_0x265bf6=_0x265bf6[_0x0dd5('0x29')](/([^:]")"+/g,'$1');_0x265bf6='+'+_0x265bf6+'*';var _0x5c7e82=_0x265bf6[_0x0dd5('0x25')](_0x3e8853);if(_0x5c7e82){_0x265bf6='\x22'+_0x265bf6+'\x22';}_0xabd4a5[_0x0dd5('0x2a')](_0x265bf6);});_0x278079=_0x278079[_0x0dd5('0x29')](_0x0dd5('0x2b'),_0xabd4a5[_0x0dd5('0x2c')]('\x20'));return _0x278079;};exports[_0x0dd5('0x2d')]=function(_0x5e7f7a,_0x2c9b8e,_0x15c84a){var _0x177d95={},_0xf6a95c={};if(_0x2c9b8e[_0x0dd5('0x2e')]['$id']){_0x2c9b8e['query']['id']=_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x2f')];delete _0x2c9b8e[_0x0dd5('0x2e')]['$id'];}_0x177d95[_0x0dd5('0x30')]=_[_0x0dd5('0x15')](_0x5e7f7a,_0x0dd5('0xf'));_0x177d95['query']=_[_0x0dd5('0x31')](_0x2c9b8e[_0x0dd5('0x2e')]);_0x177d95[_0x0dd5('0x32')]=_[_0x0dd5('0x33')](_0x177d95['model'],_0x177d95[_0x0dd5('0x2e')]);_0xf6a95c[_0x0dd5('0x34')]=_['intersection'](_0x177d95[_0x0dd5('0x30')],this['fields'](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x5')]));_0xf6a95c[_0x0dd5('0x34')]=_0xf6a95c[_0x0dd5('0x34')][_0x0dd5('0x1e')]?_0xf6a95c['attributes']:_0x177d95[_0x0dd5('0x30')];if(!_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x21')](_0x0dd5('0x35'))){_0xf6a95c['limit']=this[_0x0dd5('0x12')](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x12')]);_0xf6a95c['offset']=this[_0x0dd5('0x13')](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x13')]);}_0xf6a95c[_0x0dd5('0x36')]=this['sort'](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x14')]);_0xf6a95c[_0x0dd5('0x37')]=this[_0x0dd5('0x32')](_[_0x0dd5('0x38')](_0x2c9b8e[_0x0dd5('0x2e')],_0x177d95[_0x0dd5('0x32')]),_0x5e7f7a);if(_0x2c9b8e[_0x0dd5('0x2e')]['filter']){var _0x1642c6=_0x5e7f7a;var _0x2ee8d6=_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x39')];if(typeof _0x2ee8d6===_0x0dd5('0x3a')){_0x1642c6=_[_0x0dd5('0x39')](_0x5e7f7a,function(_0x52a50a){return _['includes'](_0x2ee8d6[_0x0dd5('0x3b')],_0x52a50a[_0x0dd5('0xf')]);});_0x2ee8d6=_0x2ee8d6[_0x0dd5('0x3c')];}_0xf6a95c[_0x0dd5('0x37')]=_['merge'](_0xf6a95c[_0x0dd5('0x37')],{'$or':_['map'](_0x1642c6,function(_0xf05106){if(_0xf05106[_0x0dd5('0x9')]!==_0x0dd5('0x3d')){if(_0x15c84a){return sequelize[_0x0dd5('0x37')](sequelize['fn'](_0x0dd5('0x3e'),sequelize[_0x0dd5('0x1a')](_0xf05106[_0x0dd5('0xf')])),{'$like':sequelize['fn'](_0x0dd5('0x3e'),'%'+_0x2c9b8e[_0x0dd5('0x2e')]['filter']+'%')});}else{var _0x422c4e={};_0x422c4e[_0xf05106[_0x0dd5('0xf')]]={'$like':'%'+_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x39')]+'%'};return _0x422c4e;}}})});}_0xf6a95c=_[_0x0dd5('0x3f')]({},_0xf6a95c,_0x2c9b8e[_0x0dd5('0x40')]);return _0xf6a95c;};exports[_0x0dd5('0x41')]=function(_0x15e4fe){var _0x4ebab8=[];if(_0x15e4fe[_0x0dd5('0x42')]){_0x4ebab8[_0x0dd5('0x2a')]({'all':!![]});}else if(_0x15e4fe[_0x0dd5('0x41')]){if(Array[_0x0dd5('0x11')](_0x15e4fe[_0x0dd5('0x41')])){_0x4ebab8=Object[_0x0dd5('0x31')](_0x15e4fe[_0x0dd5('0x41')])[_0x0dd5('0x15')](function(_0x5c36f9){return parseIncludeModel(_0x15e4fe[_0x0dd5('0x41')][_0x5c36f9]);});}else{var _0x557364=parseIncludeModel(_0x15e4fe[_0x0dd5('0x41')]);_0x4ebab8['push'](_0x557364);}}return _0x4ebab8;}; \ No newline at end of file +var _0x528f=['VIRTUAL','merge','options','include','includeAll','sequelize','moment','../../mysqldb','parse','includes','keys','model','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','DESC','omit','length','isArray','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','replace','join','getOptions','query','$id','intersection','attributes','nolimit','order','where','filter','columns','value'];(function(_0x11fc04,_0x3a532b){var _0x2b30b2=function(_0x4961a5){while(--_0x4961a5){_0x11fc04['push'](_0x11fc04['shift']());}};_0x2b30b2(++_0x3a532b);}(_0x528f,0x140));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0xf528('0x0'));var moment=require(_0xf528('0x1'));var db=require(_0xf528('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x42142d){var _0x413c72=['ne'];try{var _0x5a32b9=JSON[_0xf528('0x3')](_0x42142d);var _0x4c9c0e=Object['keys'](_0x5a32b9)[0x0];return _0x413c72[_0xf528('0x4')](_0x4c9c0e);}catch(_0x491271){return![];}}function getOperatorValue(_0x2a4f5b){var _0x17c8c8=JSON['parse'](_0x2a4f5b);var _0x31b491=Object[_0xf528('0x5')](_0x17c8c8)[0x0];var _0x1b6bfd=_0x17c8c8[_0x31b491];return{['$'+_0x31b491]:_0x1b6bfd};}function parseIncludeModel(_0x2b3ee6){var _0x50be2d=JSON['parse'](_0x2b3ee6);return{'model':db[_0x50be2d[_0xf528('0x6')]],'as':_0x50be2d['alias'],'attributes':_0x50be2d[_0xf528('0x7')],'raw':_0x50be2d['raw']};}exports['fields']=function(_0x1d73ef){var _0x5a99b3=null;if(_0x1d73ef){_0x5a99b3=_0x1d73ef[_0xf528('0x8')](',');}return _0x5a99b3;};exports[_0xf528('0x9')]=function(_0x45b461,_0x2e8340){var _0xc2b1e2={};if(!_[_0xf528('0xa')](_0x45b461)){_['forOwn'](_0x45b461,function(_0x3ee03d,_0x3bf503){try{if(_0x2e8340){var _0x16e01c=_[_0xf528('0xb')](_0x2e8340,{'name':_0x3bf503})||{};if(hasSequelizeOperator(_0x3ee03d)){_0xc2b1e2[_0x3bf503]=getOperatorValue(_0x3ee03d);}else if(_0x16e01c[_0xf528('0xc')]===_0xf528('0xd')&&_[_0xf528('0xe')](_0x3ee03d)){var _0x34d797=JSON[_0xf528('0x3')](_0x3ee03d);var _0x155fe6={'$gte':moment(moment(_0x34d797['$gte'])[_0xf528('0xf')](_0xf528('0x10')))[_0xf528('0x11')]()[_0xf528('0xf')](),'$lte':moment(moment(_0x34d797[_0xf528('0x12')])[_0xf528('0xf')]('YYYY-MM-DD'))['utc']()[_0xf528('0x13')](0x1,'s')[_0xf528('0xf')]()};_0xc2b1e2[_0x3bf503]=_0x155fe6;}else if(_0x16e01c[_0xf528('0x14')]==='uniqueid'){_0xc2b1e2[_0x3bf503]=_0x3ee03d;}else{_0xc2b1e2[_0x3bf503]=_['isArray'](_0x3ee03d)?_0x3ee03d:JSON[_0xf528('0x3')](_0x3ee03d);}}else{_0xc2b1e2[_0x3bf503]=_['isArray'](_0x3ee03d)?_0x3ee03d:JSON[_0xf528('0x3')](_0x3ee03d);}}catch(_0x208d9b){_0xc2b1e2[_0x3bf503]=_0x3ee03d[_0xf528('0x8')](',');}});}return _0xc2b1e2;};exports[_0xf528('0x15')]=function(_0x11263d){_0x11263d=parseInt(_0x11263d,0xa);if(!_0x11263d||_0x11263d<0x0){_0x11263d=LIMIT_VALUE;}return _0x11263d;};exports[_0xf528('0x16')]=function(_0x31beb5){_0x31beb5=parseInt(_0x31beb5,0xa);if(!_0x31beb5||_0x31beb5<0x0){_0x31beb5=0x0;}return _0x31beb5;};exports[_0xf528('0x17')]=function(_0x4ba4cb){var _0x3540b0,_0x13db73=null;if(_0x4ba4cb){_0x3540b0=_0x4ba4cb[_0xf528('0x8')](',');_0x13db73=_[_0xf528('0x18')](_0x3540b0,function(_0x47815e){if(_0x47815e[_0xf528('0x19')]('-')===0x0){return[_0x47815e===_0xf528('0x1a')?sequelize[_0xf528('0x1b')](sequelize['col'](_0xf528('0x1a')),_0xf528('0x1c')):_0x47815e[_0xf528('0x1d')](0x1),_0xf528('0x1e')];}else{return[_0x47815e===_0xf528('0x1a')?sequelize[_0xf528('0x1b')](sequelize['col'](_0xf528('0x1a')),_0xf528('0x1c')):_0x47815e,'ASC'];}});}return _0x13db73;};exports[_0xf528('0x1f')]=function(_0xe5d90c,_0x4cac59){if(_[_0xf528('0xa')](_0xe5d90c)){return _0xe5d90c;}if(_['isArray'](_0xe5d90c)){for(var _0x2b6986=0x0;_0x2b6986<_0xe5d90c[_0xf528('0x20')];_0x2b6986+=0x1){_0xe5d90c[_0x2b6986]=this[_0xf528('0x1f')](_0xe5d90c[_0x2b6986],_0x4cac59);}return _0xe5d90c;}if(!_['isObject'](_0xe5d90c)){return _0xe5d90c;}if(_['isString'](_0x4cac59)){_0x4cac59=[_0x4cac59];}if(!_[_0xf528('0x21')](_0x4cac59)){return _0xe5d90c;}for(var _0x31a194=0x0;_0x31a194<_0x4cac59[_0xf528('0x20')];_0x31a194+=0x1){_[_0xf528('0x22')](_0xe5d90c,_0x4cac59[_0x31a194]);}for(var _0xbeaa21 in _0xe5d90c){if(_0xe5d90c[_0xf528('0x23')](_0xbeaa21)){_0xe5d90c[_0xbeaa21]=this[_0xf528('0x1f')](_0xe5d90c[_0xbeaa21],_0x4cac59);}}return _0xe5d90c;};exports[_0xf528('0x24')]=function(_0x14b950){return _0x14b950[_0xf528('0x25')](RegExp(_0xf528('0x26')))?!![]:![];};exports[_0xf528('0x27')]=function(_0x445916){return _0x445916[_0xf528('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xf528('0x28')]=function(_0x1398f4,_0x2e8b5e){var _0x568e54=[];var _0x24c63b=/[ `!@#$%^&*()_\-?~]/;var _0x27c22d=_0x2e8b5e?_0xf528('0x29'):_0xf528('0x2a');_0x1398f4[_0xf528('0x8')](/[ ,]+/)[_0xf528('0x2b')](function(_0x5151da){_0x5151da=_0x5151da['replace'](/([^:]")"+/g,'$1');_0x5151da='+'+_0x5151da+'*';var _0x4511d5=_0x5151da[_0xf528('0x25')](_0x24c63b);if(_0x4511d5){_0x5151da='\x22'+_0x5151da+'\x22';}_0x568e54[_0xf528('0x2c')](_0x5151da);});_0x27c22d=_0x27c22d[_0xf528('0x2d')]('{EXPR}',_0x568e54[_0xf528('0x2e')]('\x20'));return _0x27c22d;};exports[_0xf528('0x2f')]=function(_0x132901,_0x3a3e4f,_0x1a9849){var _0x143849={},_0x41b9e2={};if(_0x3a3e4f[_0xf528('0x30')]['$id']){_0x3a3e4f['query']['id']=_0x3a3e4f[_0xf528('0x30')][_0xf528('0x31')];delete _0x3a3e4f[_0xf528('0x30')][_0xf528('0x31')];}_0x143849[_0xf528('0x6')]=_[_0xf528('0x18')](_0x132901,_0xf528('0x14'));_0x143849[_0xf528('0x30')]=_[_0xf528('0x5')](_0x3a3e4f[_0xf528('0x30')]);_0x143849['filters']=_[_0xf528('0x32')](_0x143849['model'],_0x143849[_0xf528('0x30')]);_0x41b9e2[_0xf528('0x33')]=_[_0xf528('0x32')](_0x143849['model'],this[_0xf528('0x7')](_0x3a3e4f[_0xf528('0x30')][_0xf528('0x7')]));_0x41b9e2[_0xf528('0x33')]=_0x41b9e2['attributes'][_0xf528('0x20')]?_0x41b9e2['attributes']:_0x143849[_0xf528('0x6')];if(!_0x3a3e4f[_0xf528('0x30')][_0xf528('0x23')](_0xf528('0x34'))){_0x41b9e2['limit']=this[_0xf528('0x15')](_0x3a3e4f[_0xf528('0x30')][_0xf528('0x15')]);_0x41b9e2['offset']=this[_0xf528('0x16')](_0x3a3e4f['query'][_0xf528('0x16')]);}_0x41b9e2[_0xf528('0x35')]=this[_0xf528('0x17')](_0x3a3e4f[_0xf528('0x30')]['sort']);_0x41b9e2[_0xf528('0x36')]=this[_0xf528('0x9')](_['pick'](_0x3a3e4f[_0xf528('0x30')],_0x143849[_0xf528('0x9')]),_0x132901);if(_0x3a3e4f['query'][_0xf528('0x37')]){var _0x17f04b=_0x132901;var _0x4d2626=_0x3a3e4f[_0xf528('0x30')][_0xf528('0x37')];if(typeof _0x4d2626==='object'){_0x17f04b=_['filter'](_0x132901,function(_0x1188b9){return _[_0xf528('0x4')](_0x4d2626[_0xf528('0x38')],_0x1188b9[_0xf528('0x14')]);});_0x4d2626=_0x4d2626[_0xf528('0x39')];}_0x41b9e2[_0xf528('0x36')]=_['merge'](_0x41b9e2[_0xf528('0x36')],{'$or':_[_0xf528('0x18')](_0x17f04b,function(_0x49c0f8){if(_0x49c0f8[_0xf528('0xc')]!==_0xf528('0x3a')){if(_0x1a9849){return sequelize[_0xf528('0x36')](sequelize['fn']('lower',sequelize['col'](_0x49c0f8[_0xf528('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x3a3e4f[_0xf528('0x30')][_0xf528('0x37')]+'%')});}else{var _0x47c064={};_0x47c064[_0x49c0f8[_0xf528('0x14')]]={'$like':'%'+_0x3a3e4f[_0xf528('0x30')][_0xf528('0x37')]+'%'};return _0x47c064;}}})});}_0x41b9e2=_[_0xf528('0x3b')]({},_0x41b9e2,_0x3a3e4f[_0xf528('0x3c')]);return _0x41b9e2;};exports[_0xf528('0x3d')]=function(_0x2a4376){var _0x5539d5=[];if(_0x2a4376[_0xf528('0x3e')]){_0x5539d5[_0xf528('0x2c')]({'all':!![]});}else if(_0x2a4376[_0xf528('0x3d')]){if(Array[_0xf528('0x21')](_0x2a4376[_0xf528('0x3d')])){_0x5539d5=Object[_0xf528('0x5')](_0x2a4376[_0xf528('0x3d')])['map'](function(_0x4bc104){return parseIncludeModel(_0x2a4376[_0xf528('0x3d')][_0x4bc104]);});}else{var _0xb90ef0=parseIncludeModel(_0x2a4376['include']);_0x5539d5[_0xf528('0x2c')](_0xb90ef0);}}return _0x5539d5;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6b626e3..ce178e8 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 _0x55c0=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','length','unavailable','isNil','voiceStatus','idle','voicePause','pause','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','busy','getAgentStatus','isArray','startCase','map','findOne','all','uniq','value','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','pauseType','find','globalStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity'];(function(_0x229aba,_0x4c1434){var _0x53ea52=function(_0x4edbd0){while(--_0x4edbd0){_0x229aba['push'](_0x229aba['shift']());}};_0x53ea52(++_0x4c1434);}(_0x55c0,0xc9));var _0x055c=function(_0xec306d,_0x2c44af){_0xec306d=_0xec306d-0x0;var _0x4fd78a=_0x55c0[_0xec306d];return _0x4fd78a;};'use strict';var _=require(_0x055c('0x0'));var jayson=require('jayson/promise');var db=require(_0x055c('0x1'))['db'];var amiClient=jayson[_0x055c('0x2')][_0x055c('0x3')]({'port':0x232a});var routingClient=jayson[_0x055c('0x2')][_0x055c('0x3')]({'port':0x232c});function isAgentPaused(_0x3046b3,_0x1b6630){var _0x232a9f=[_0x3046b3[_0x055c('0x4')],_0x3046b3[_0x055c('0x5')],_0x3046b3[_0x055c('0x6')],_0x3046b3[_0x055c('0x7')],_0x3046b3[_0x055c('0x8')],_0x3046b3['voicePause'],_0x3046b3[_0x055c('0x9')]];if(!_0x1b6630)return _[_0x055c('0xa')](_0x232a9f);var _0x48f1be=_['filter'](_0x232a9f);return _0x48f1be[_0x055c('0xb')]>0x0&&_0x48f1be['length']<_0x232a9f[_0x055c('0xb')]?!![]:![];}function isIdle(_0x4670ab){return _0x4670ab==='idle'||_0x4670ab==='unknown'||_0x4670ab===_0x055c('0xc')||_0x4670ab==='ringing'||_[_0x055c('0xd')](_0x4670ab);}function isAgentIdle(_0x1da7c1){if(_0x1da7c1[_0x055c('0xe')]!==_0x055c('0xf')&&_0x1da7c1[_0x055c('0x10')]){_0x1da7c1[_0x055c('0xe')]=_0x055c('0x11');return![];}return _[_0x055c('0xa')]([_0x1da7c1[_0x055c('0x12')],_0x1da7c1['faxStatus'],_0x1da7c1[_0x055c('0x13')],_0x1da7c1[_0x055c('0x14')],_0x1da7c1['smsStatus'],_0x1da7c1[_0x055c('0xe')],_0x1da7c1[_0x055c('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x055c('0x16')](_0x055c('0x17'),{})[_0x055c('0x18')](function(_0x1efd88){if(_0x1efd88[_0x055c('0x19')]){throw new Error(_0x055c('0x1a'));}var _0x541654=_0x1efd88[_0x055c('0x1b')];return routingClient[_0x055c('0x16')]('Agents',{})['then'](function(_0xbbe33a){if(_0xbbe33a['error']){throw new Error(_0x055c('0x1c'));}var _0x308686=_0xbbe33a[_0x055c('0x1b')];return _[_0x055c('0x1d')]({},_0x541654,_0x308686);});})[_0x055c('0x1e')](function(_0x225d7d){throw _0x225d7d;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x487b04){var _0x529548=_0x055c('0x1f');if(isAgentPaused(_0x487b04))_0x529548='pause';else if(isAgentPaused(_0x487b04,!![]))_0x529548='*pause';else if(isAgentIdle(_0x487b04))_0x529548='idle';else _0x529548=_0x055c('0x20');return _0x529548;}exports[_0x055c('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x12cbab,_0x388f8d){var _0x54b9a7=_[_0x055c('0x22')](_0x12cbab)?_0x12cbab:[_0x12cbab];var _0x2eac8d=_[_0x055c('0x23')](_0x388f8d)+'Queue';var _0x164e5f=_[_0x055c('0x24')](_0x54b9a7,function(_0x141cf5){return db[_0x2eac8d][_0x055c('0x25')]({'where':{'id':_0x141cf5}})[_0x055c('0x18')](function(_0x345831){if(!_0x345831)return[];return _0x345831['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x055c('0x26')](_0x164e5f)[_0x055c('0x18')](function(_0x3727eb){var _0x4e8314=_(_0x3727eb)['flatten']()[_0x055c('0x24')]('id')[_0x055c('0x27')]()[_0x055c('0x28')]();return _0x4e8314;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e9c51,_0x1a0439,_0x4eab37){try{if(_0x1a0439[_0x055c('0xb')]>0x0){_0x3e9c51=_0x3e9c51[_0x055c('0x29')](function(_0x4e40a0){return _0x1a0439[_0x055c('0x2a')](_0x4e40a0['id']);});}var _0xa93e63=_0x3e9c51['filter'](function(_0x491e5d){var _0xdc3fd5=_0x055c('0x20');if(isAgentIdle(_0x491e5d)){_0xdc3fd5=_0x055c('0xf');}return _0xdc3fd5===_0x4eab37;});return _[_0x055c('0x24')](_0xa93e63,'id');}catch(_0x3fb27f){throw _0x3fb27f;}}exports[_0x055c('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x556bcd,_0x31fdfc,_0x394952){return Promise[_0x055c('0x2c')]()[_0x055c('0x18')](function(){if(_0x31fdfc[_0x055c('0xb')]>0x0){_0x556bcd=_0x556bcd[_0x055c('0x29')](function(_0xbcc912){return _0x31fdfc[_0x055c('0x2a')](_0xbcc912['id']);});}return _0x556bcd;})[_0x055c('0x18')](function(){return db[_0x055c('0x2d')][_0x055c('0x2e')]({'attributes':['id',_0x055c('0x2f'),_0x055c('0x30'),_0x055c('0x4'),_0x055c('0x5'),'mailPause',_0x055c('0x7'),'smsPause',_0x055c('0x10'),'whatsappPause',_0x055c('0x31')],'where':{'id':{'$in':_[_0x055c('0x24')](_0x556bcd,'id')}},'raw':!![]});})[_0x055c('0x18')](function(_0x25fea6){return _0x25fea6[_0x055c('0x24')](function(_0x182acb){var _0x4733b7=_[_0x055c('0x32')](_0x556bcd,['id',_0x182acb['id']]);var _0x4935f6=filterAgentAttributes(_0x4733b7);_['merge'](_0x182acb,_0x4935f6);_0x182acb[_0x055c('0x33')]=getAgentStatus(_0x182acb);return _0x182acb;});})[_0x055c('0x18')](function(_0x1d5fec){var _0x13617b=sortAgentsByStatus(_0x1d5fec,_0x394952);return _[_0x055c('0x24')](_0x13617b,'id');})['catch'](function(_0x59432b){throw _0x59432b;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5d94d8){var _0x24cd00={'fields':[],'order':null};var _0x46eaf5=_0x5d94d8[_0x055c('0x34')](',');_0x24cd00[_0x055c('0x35')]=_[_0x055c('0x29')](_0x46eaf5,function(_0x283fb4){if(!_0x283fb4[_0x055c('0x2a')](_0x055c('0x33'))){return!![];}_0x24cd00[_0x055c('0x36')]=_[_0x055c('0x37')](_0x283fb4,'-')?_0x055c('0x38'):'ASC';return![];});return _0x24cd00;}exports[_0x055c('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x18b78a){if(!_0x18b78a){_0x18b78a=_0x055c('0x3a');}if(_0x18b78a['includes'](_0x055c('0x30'))&&!_0x18b78a['includes'](_0x055c('0x3b'))){var _0x4bfeb6=_0x18b78a[_0x055c('0x3c')](0x0,_0x18b78a[_0x055c('0x3d')]('fullname'));_0x18b78a+=','+_0x4bfeb6+_0x055c('0x3b');}return _0x18b78a;}exports[_0x055c('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1f6f8d,_0x32fba6){var _0x2eba56=_0x1f6f8d[_0x055c('0x3f')](function(_0x4a0ca9,_0x2f8dbf){if(_0x4a0ca9['globalStatus']===_0x2f8dbf[_0x055c('0x33')]){if(_0x4a0ca9[_0x055c('0x33')]===_0x055c('0x11')){if(_0x32fba6==='DESC'){return(_0x4a0ca9[_0x055c('0x31')]||'')<(_0x2f8dbf[_0x055c('0x31')]||'')||_0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()>_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?0x1:-0x1;}else{return(_0x4a0ca9[_0x055c('0x31')]||'')<(_0x2f8dbf[_0x055c('0x31')]||'')||_0x4a0ca9['fullname']['toLowerCase']()>_0x2f8dbf['fullname'][_0x055c('0x40')]()?-0x1:0x1;}}else{if(_0x32fba6===_0x055c('0x38')){return _0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()<_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?0x1:-0x1;}else{return _0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()<_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?-0x1:0x1;}}}else{if(_0x32fba6===_0x055c('0x38')){return _0x4a0ca9[_0x055c('0x33')]<_0x2f8dbf['globalStatus']?0x1:-0x1;}else{return _0x4a0ca9['globalStatus']<_0x2f8dbf[_0x055c('0x33')]?-0x1:0x1;}}});return _0x2eba56;}exports[_0x055c('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x388f0f){var _0x5a4d4c=['userpic',_0x055c('0x42'),'lastLoginAt',_0x055c('0x43'),_0x055c('0x31'),'lastPauseAt','internal',_0x055c('0x44'),'chatPause',_0x055c('0x7'),_0x055c('0x6'),_0x055c('0x8'),'whatsappPause','faxPause',_0x055c('0x10'),'chatCapacity',_0x055c('0x45'),_0x055c('0x46'),_0x055c('0x47'),'whatsappCapacity',_0x055c('0x48'),_0x055c('0x49'),_0x055c('0x4a'),'mailCurrentCapacity',_0x055c('0x4b'),_0x055c('0x4c'),'faxCurrentCapacity',_0x055c('0x12'),_0x055c('0x14'),_0x055c('0x13'),_0x055c('0x4d'),'whatsappStatus','faxStatus','voiceStatus','chatStatusTime','openchannelStatusTime',_0x055c('0x4e'),_0x055c('0x4f'),_0x055c('0x50'),_0x055c('0x51'),_0x055c('0x52'),_0x055c('0x53'),_0x055c('0x54'),_0x055c('0x55'),_0x055c('0x56'),_0x055c('0x57'),_0x055c('0x58')];var _0x171824=[_0x055c('0x4'),_0x055c('0x7'),_0x055c('0x6'),_0x055c('0x8'),_0x055c('0x9'),_0x055c('0x5'),_0x055c('0x10'),_0x055c('0x42')];var _0x12768e=_(_0x388f0f)[_0x055c('0x59')](_0x171824)[_0x055c('0x5a')](_0x5a4d4c)[_0x055c('0x28')]();return _0x12768e;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x99d4=['all','map','value','includes','filter','getAgentIdsByStatus','resolve','findAll','smsPause','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','fullname,internal','fullname','substring','indexOf','internal','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','getAgentStatus','startCase','Queue','findOne'];(function(_0xc99e78,_0x26f9cf){var _0x533ee5=function(_0x49aa78){while(--_0x49aa78){_0xc99e78['push'](_0xc99e78['shift']());}};_0x533ee5(++_0x26f9cf);}(_0x99d4,0x13e));var _0x499d=function(_0x1ea84a,_0x31a991){_0x1ea84a=_0x1ea84a-0x0;var _0x39590f=_0x99d4[_0x1ea84a];return _0x39590f;};'use strict';var _=require(_0x499d('0x0'));var jayson=require('jayson/promise');var db=require(_0x499d('0x1'))['db'];var amiClient=jayson[_0x499d('0x2')][_0x499d('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x499d('0x3')]({'port':0x232c});function isAgentPaused(_0x4c011c,_0x1d1a34){var _0x4d083c=[_0x4c011c[_0x499d('0x4')],_0x4c011c[_0x499d('0x5')],_0x4c011c[_0x499d('0x6')],_0x4c011c[_0x499d('0x7')],_0x4c011c['smsPause'],_0x4c011c[_0x499d('0x8')],_0x4c011c[_0x499d('0x9')]];if(!_0x1d1a34)return _[_0x499d('0xa')](_0x4d083c);var _0x437843=_['filter'](_0x4d083c);return _0x437843[_0x499d('0xb')]>0x0&&_0x437843[_0x499d('0xb')]<_0x4d083c[_0x499d('0xb')]?!![]:![];}function isIdle(_0x27d820){return _0x27d820===_0x499d('0xc')||_0x27d820===_0x499d('0xd')||_0x27d820===_0x499d('0xe')||_0x27d820===_0x499d('0xf')||_[_0x499d('0x10')](_0x27d820);}function isAgentIdle(_0xe03ae0){if(_0xe03ae0[_0x499d('0x11')]!==_0x499d('0xc')&&_0xe03ae0[_0x499d('0x8')]){_0xe03ae0[_0x499d('0x11')]=_0x499d('0x12');return![];}return _[_0x499d('0xa')]([_0xe03ae0[_0x499d('0x13')],_0xe03ae0[_0x499d('0x14')],_0xe03ae0[_0x499d('0x15')],_0xe03ae0[_0x499d('0x16')],_0xe03ae0[_0x499d('0x17')],_0xe03ae0[_0x499d('0x11')],_0xe03ae0[_0x499d('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x499d('0x19')](_0x499d('0x1a'),{})[_0x499d('0x1b')](function(_0x40e679){if(_0x40e679['error']){throw new Error(_0x499d('0x1c'));}var _0x1d12d5=_0x40e679[_0x499d('0x1d')];return routingClient['request'](_0x499d('0x1a'),{})[_0x499d('0x1b')](function(_0xd8b7a){if(_0xd8b7a['error']){throw new Error(_0x499d('0x1e'));}var _0x1adbf8=_0xd8b7a[_0x499d('0x1d')];return _[_0x499d('0x1f')]({},_0x1d12d5,_0x1adbf8);});})[_0x499d('0x20')](function(_0x15d9d0){throw _0x15d9d0;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0xaba16d){var _0x4d669a=_0x499d('0xd');if(isAgentPaused(_0xaba16d))_0x4d669a='pause';else if(isAgentPaused(_0xaba16d,!![]))_0x4d669a=_0x499d('0x21');else if(isAgentIdle(_0xaba16d))_0x4d669a='idle';else _0x4d669a='busy';return _0x4d669a;}exports[_0x499d('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x2d56d5,_0x4a06a9){var _0x59a03a=_['isArray'](_0x2d56d5)?_0x2d56d5:[_0x2d56d5];var _0x4a81ca=_[_0x499d('0x23')](_0x4a06a9)+_0x499d('0x24');var _0x594400=_['map'](_0x59a03a,function(_0x15fbdd){return db[_0x4a81ca][_0x499d('0x25')]({'where':{'id':_0x15fbdd}})[_0x499d('0x1b')](function(_0x235003){if(!_0x235003)return[];return _0x235003['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x499d('0x26')](_0x594400)[_0x499d('0x1b')](function(_0x4a8591){var _0x330fcc=_(_0x4a8591)['flatten']()[_0x499d('0x27')]('id')['uniq']()[_0x499d('0x28')]();return _0x330fcc;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4d3417,_0x125df8,_0x3ff4e2){try{if(_0x125df8[_0x499d('0xb')]>0x0){_0x4d3417=_0x4d3417['filter'](function(_0x28c6f6){return _0x125df8[_0x499d('0x29')](_0x28c6f6['id']);});}var _0xc1cf9c=_0x4d3417[_0x499d('0x2a')](function(_0x44c595){var _0x418380='busy';if(isAgentIdle(_0x44c595)){_0x418380=_0x499d('0xc');}return _0x418380===_0x3ff4e2;});return _[_0x499d('0x27')](_0xc1cf9c,'id');}catch(_0x544734){throw _0x544734;}}exports[_0x499d('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x222fc0,_0x144731,_0x30471d){return Promise[_0x499d('0x2c')]()[_0x499d('0x1b')](function(){if(_0x144731[_0x499d('0xb')]>0x0){_0x222fc0=_0x222fc0[_0x499d('0x2a')](function(_0x2f4073){return _0x144731['includes'](_0x2f4073['id']);});}return _0x222fc0;})[_0x499d('0x1b')](function(){return db['User'][_0x499d('0x2d')]({'attributes':['id','name','fullname','chatPause',_0x499d('0x5'),_0x499d('0x6'),_0x499d('0x7'),_0x499d('0x2e'),_0x499d('0x8'),'whatsappPause','pauseType'],'where':{'id':{'$in':_['map'](_0x222fc0,'id')}},'raw':!![]});})[_0x499d('0x1b')](function(_0x2f028a){return _0x2f028a[_0x499d('0x27')](function(_0xe94edf){var _0x4305bd=_['find'](_0x222fc0,['id',_0xe94edf['id']]);var _0x58fb22=filterAgentAttributes(_0x4305bd);_[_0x499d('0x1f')](_0xe94edf,_0x58fb22);_0xe94edf[_0x499d('0x2f')]=getAgentStatus(_0xe94edf);return _0xe94edf;});})[_0x499d('0x1b')](function(_0x850350){var _0x1d3d5a=sortAgentsByStatus(_0x850350,_0x30471d);return _[_0x499d('0x27')](_0x1d3d5a,'id');})['catch'](function(_0x94344){throw _0x94344;});}exports[_0x499d('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x424920){var _0xdd5812={'fields':[],'order':null};var _0x4b39f4=_0x424920[_0x499d('0x31')](',');_0xdd5812[_0x499d('0x32')]=_[_0x499d('0x2a')](_0x4b39f4,function(_0x516194){if(!_0x516194[_0x499d('0x29')](_0x499d('0x2f'))){return!![];}_0xdd5812[_0x499d('0x33')]=_[_0x499d('0x34')](_0x516194,'-')?_0x499d('0x35'):'ASC';return![];});return _0xdd5812;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x20e336){if(!_0x20e336){_0x20e336=_0x499d('0x36');}if(_0x20e336[_0x499d('0x29')](_0x499d('0x37'))&&!_0x20e336[_0x499d('0x29')]('internal')){var _0x1b40e5=_0x20e336[_0x499d('0x38')](0x0,_0x20e336[_0x499d('0x39')](_0x499d('0x37')));_0x20e336+=','+_0x1b40e5+_0x499d('0x3a');}return _0x20e336;}exports[_0x499d('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x5ebeb5,_0x393bfa){var _0x5a7d0d=_0x5ebeb5[_0x499d('0x3c')](function(_0x189a6b,_0x2b9cb9){if(_0x189a6b[_0x499d('0x2f')]===_0x2b9cb9[_0x499d('0x2f')]){if(_0x189a6b['globalStatus']===_0x499d('0x12')){if(_0x393bfa===_0x499d('0x35')){return(_0x189a6b[_0x499d('0x3d')]||'')<(_0x2b9cb9[_0x499d('0x3d')]||'')||_0x189a6b[_0x499d('0x37')][_0x499d('0x3e')]()>_0x2b9cb9[_0x499d('0x37')][_0x499d('0x3e')]()?0x1:-0x1;}else{return(_0x189a6b[_0x499d('0x3d')]||'')<(_0x2b9cb9['pauseType']||'')||_0x189a6b[_0x499d('0x37')][_0x499d('0x3e')]()>_0x2b9cb9[_0x499d('0x37')][_0x499d('0x3e')]()?-0x1:0x1;}}else{if(_0x393bfa===_0x499d('0x35')){return _0x189a6b[_0x499d('0x37')][_0x499d('0x3e')]()<_0x2b9cb9[_0x499d('0x37')]['toLowerCase']()?0x1:-0x1;}else{return _0x189a6b[_0x499d('0x37')][_0x499d('0x3e')]()<_0x2b9cb9[_0x499d('0x37')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x393bfa===_0x499d('0x35')){return _0x189a6b[_0x499d('0x2f')]<_0x2b9cb9[_0x499d('0x2f')]?0x1:-0x1;}else{return _0x189a6b[_0x499d('0x2f')]<_0x2b9cb9[_0x499d('0x2f')]?-0x1:0x1;}}});return _0x5a7d0d;}exports[_0x499d('0x3f')]=sortAgentsByStatus;function filterAgentAttributes(_0x51f956){var _0x4dc763=[_0x499d('0x40'),_0x499d('0x41'),_0x499d('0x42'),_0x499d('0x43'),'pauseType','lastPauseAt','internal',_0x499d('0x44'),_0x499d('0x4'),_0x499d('0x7'),_0x499d('0x6'),_0x499d('0x2e'),_0x499d('0x9'),'faxPause','voicePause',_0x499d('0x45'),'openchannelCapacity',_0x499d('0x46'),_0x499d('0x47'),'whatsappCapacity',_0x499d('0x48'),_0x499d('0x49'),'openchannelCurrentCapacity',_0x499d('0x4a'),_0x499d('0x4b'),'whatsappCurrentCapacity',_0x499d('0x4c'),_0x499d('0x13'),_0x499d('0x16'),_0x499d('0x15'),_0x499d('0x17'),_0x499d('0x18'),_0x499d('0x14'),'voiceStatus','chatStatusTime',_0x499d('0x4d'),_0x499d('0x4e'),_0x499d('0x4f'),'whatsappStatusTime',_0x499d('0x50'),'voiceStatusTime',_0x499d('0x51'),_0x499d('0x52'),_0x499d('0x53'),_0x499d('0x54'),_0x499d('0x55'),'routealias'];var _0x7c0538=[_0x499d('0x4'),'openchannelPause',_0x499d('0x6'),_0x499d('0x2e'),_0x499d('0x9'),_0x499d('0x5'),_0x499d('0x8'),'online'];var _0x3c87e0=_(_0x51f956)[_0x499d('0x56')](_0x7c0538)[_0x499d('0x57')](_0x4dc763)[_0x499d('0x28')]();return _0x3c87e0;}exports[_0x499d('0x58')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index b129b05..4fa48b7 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 _0xce9b=['dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','busy','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','invalid','notInUse','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xce9b,0x123));var _0xbce9=function(_0x570a79,_0x4bfb7e){_0x570a79=_0x570a79-0x0;var _0x2b5456=_0xce9b[_0x570a79];return _0x2b5456;};'use strict';var _=require(_0xbce9('0x0'));var jayson=require(_0xbce9('0x1'));var util=require(_0xbce9('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xbce9('0x3')][_0xbce9('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xbce9('0x5'),_0xbce9('0x6'),_0xbce9('0x7'),_0xbce9('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0xbce9('0x9'),'loggedInDb',_0xbce9('0xa'),_0xbce9('0xb'),_0xbce9('0xc'),_0xbce9('0xd'),_0xbce9('0xe'),'unavailable',_0xbce9('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbce9('0x10'),_0xbce9('0x11'),_0xbce9('0x12'),_0xbce9('0x13'),_0xbce9('0x14'),_0xbce9('0x15'),'Trunk',_0xbce9('0x16'),_0xbce9('0x17'),_0xbce9('0x18'),_0xbce9('0x19'),'erlangAbandonmentRate',_0xbce9('0x1a'),_0xbce9('0x1b'),_0xbce9('0x1c'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xbce9('0x1d'),'predictiveIntervalAnsweredCalls',_0xbce9('0x1e'),_0xbce9('0x1f'),_0xbce9('0x20'),_0xbce9('0x21')];function getRealtimeQueues(_0x3af4f1,_0x243375){var _0x13d1ec=_0x243375===_0xbce9('0x22')?amiClient:routingClient;return _0x13d1ec[_0xbce9('0x23')](_[_0xbce9('0x24')](_0x243375)+_0xbce9('0x25'),_0x3af4f1)[_0xbce9('0x26')](function(_0x29802e){if(_0x29802e[_0xbce9('0x27')])throw new Error(util[_0xbce9('0x28')](_0xbce9('0x29'),_0x243375));return _0x29802e[_0xbce9('0x2a')];})['catch'](function(_0x48d7dd){throw _0x48d7dd;});}exports[_0xbce9('0x2b')]=getRealtimeQueues;function initializeQueues(_0x1539fd,_0x4163a7,_0x719906,_0x5c5f7b){var _0xb36094=DEFAULT_QUEUE_ATTRIBUTES;if(_0x719906===_0xbce9('0x22')){if(_0x5c5f7b===_0xbce9('0x2c')){_0xb36094=_0xb36094[_0xbce9('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5c5f7b===_0xbce9('0x2e')){_0xb36094=_0xb36094['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1539fd[_0xbce9('0x2f')](function(_0xd558de){var _0x16b275=_0xd558de[_0xbce9('0x30')]({'plain':!![]});_0x16b275[_0xbce9('0x7')]=0x0;_0x16b275[_0xbce9('0x31')]=0x0;_0x16b275['loggedIn']=0x0;_0x16b275[_0xbce9('0x5')]=0x0;_0x16b275['waiting']=0x0;if(_0x719906===_0xbce9('0x22')){_0x16b275[_0xbce9('0xe')]=0x0;_0x16b275[_0xbce9('0x32')]=0x0;if(_0x5c5f7b===_0xbce9('0x2e')){_0x16b275[_0xbce9('0x10')]=0x0;_0x16b275[_0xbce9('0x11')]=0x0;}}var _0x363884=_['find'](_0x4163a7,['id',_0x16b275['id']]);if(_0x363884){_['merge'](_0x16b275,_[_0xbce9('0x33')](_0x363884,_0xb36094));}return _0x16b275;});}exports[_0xbce9('0x34')]=initializeQueues; \ No newline at end of file +var _0xe06e=['outbound','map','paused','loggedIn','available','pTalking','find','pick','initializeQueues','lodash','jayson/promise','client','http','waiting','busy','inUse','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','concat'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xe06e,0x129));var _0xee06=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0xe06e[_0x118afa];return _0x167d76;};'use strict';var _=require(_0xee06('0x0'));var jayson=require(_0xee06('0x1'));var util=require('util');var amiClient=jayson[_0xee06('0x2')][_0xee06('0x3')]({'port':0x232a});var routingClient=jayson[_0xee06('0x2')][_0xee06('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn','paused',_0xee06('0x4')];var VOICE_QUEUE_ATTRIBUTES=[_0xee06('0x5'),_0xee06('0x6'),'invalid',_0xee06('0x7'),_0xee06('0x8'),_0xee06('0x9'),'ringing',_0xee06('0xa'),_0xee06('0xb'),_0xee06('0xc'),_0xee06('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xee06('0xe'),_0xee06('0xf'),_0xee06('0x10'),'dialActive',_0xee06('0x11'),'Trunk',_0xee06('0x12'),_0xee06('0x13'),_0xee06('0x14'),'erlangCallToSecond',_0xee06('0x15'),'erlangBusyFactor',_0xee06('0x16'),_0xee06('0x17'),'dialPredictiveIntervalMinThreshold',_0xee06('0x18'),_0xee06('0x19'),_0xee06('0x1a'),_0xee06('0x1b'),_0xee06('0x1c'),_0xee06('0x1d'),_0xee06('0x1e')];function getRealtimeQueues(_0x38c78b,_0x422a58){var _0x395eef=_0x422a58===_0xee06('0x1f')?amiClient:routingClient;return _0x395eef['request'](_[_0xee06('0x20')](_0x422a58)+_0xee06('0x21'),_0x38c78b)[_0xee06('0x22')](function(_0x25bc72){if(_0x25bc72[_0xee06('0x23')])throw new Error(util['format'](_0xee06('0x24'),_0x422a58));return _0x25bc72[_0xee06('0x25')];})['catch'](function(_0x193859){throw _0x193859;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1c8028,_0x579f1a,_0x244788,_0x13ce14){var _0x4dd839=DEFAULT_QUEUE_ATTRIBUTES;if(_0x244788===_0xee06('0x1f')){if(_0x13ce14==='inbound'){_0x4dd839=_0x4dd839[_0xee06('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x13ce14===_0xee06('0x27')){_0x4dd839=_0x4dd839[_0xee06('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1c8028[_0xee06('0x28')](function(_0x1bf188){var _0x3ae1c3=_0x1bf188['get']({'plain':!![]});_0x3ae1c3[_0xee06('0x29')]=0x0;_0x3ae1c3['loggedInDb']=0x0;_0x3ae1c3[_0xee06('0x2a')]=0x0;_0x3ae1c3[_0xee06('0x2b')]=0x0;_0x3ae1c3[_0xee06('0x4')]=0x0;if(_0x244788===_0xee06('0x1f')){_0x3ae1c3[_0xee06('0xb')]=0x0;_0x3ae1c3[_0xee06('0x5')]=0x0;if(_0x13ce14==='outbound'){_0x3ae1c3[_0xee06('0x2c')]=0x0;_0x3ae1c3[_0xee06('0xe')]=0x0;}}var _0x552807=_[_0xee06('0x2d')](_0x579f1a,['id',_0x3ae1c3['id']]);if(_0x552807){_['merge'](_0x3ae1c3,_[_0xee06('0x2e')](_0x552807,_0x4dd839));}return _0x3ae1c3;});}exports[_0xee06('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 158dcd2..b5d67b2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x250ebb,_0x33a65f){var _0x1225fb=function(_0x40172e){while(--_0x40172e){_0x250ebb['push'](_0x250ebb['shift']());}};_0x1225fb(++_0x33a65f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5dee44,_0x115b60){var _0x46f720=function(_0x169927){while(--_0x169927){_0x5dee44['push'](_0x5dee44['shift']());}};_0x46f720(++_0x115b60);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b17de9d..776f165 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 _0x776f=['licenseToken','test','win32','replace','hostname','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','join','md5','update','digest','hex','getUuid','platform'];(function(_0x50d448,_0x25d0eb){var _0x2e7ed4=function(_0x2cb8d4){while(--_0x2cb8d4){_0x50d448['push'](_0x50d448['shift']());}};_0x2e7ed4(++_0x25d0eb);}(_0x776f,0x70));var _0xf776=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x776f[_0x5e2862];return _0x8dcad4;};'use strict';var _=require(_0xf776('0x0'));var os=require('os');var crypto=require(_0xf776('0x1'));var machine=require(_0xf776('0x2'));var exec=require(_0xf776('0x3'))['execSync'];var config=require(_0xf776('0x4'));function getInterfaces(){var _0x46e51e=[];var _0x499954=os[_0xf776('0x5')]();var _0xaca246=_[_0xf776('0x6')](_[_0xf776('0x7')](_0x499954));for(var _0x50ea8a=0x0;_0x50ea8a<_0xaca246[_0xf776('0x8')];_0x50ea8a++){var _0x4a6eb0=_0x499954[_0xaca246[_0x50ea8a]][_0xf776('0x9')](function(_0x56dcba){return _0x56dcba[_0xf776('0xa')]===_0xf776('0xb')&&_0x56dcba[_0xf776('0xc')]===![];});_0x46e51e=_0x46e51e[_0xf776('0xd')](_0x4a6eb0);}return _0x46e51e;}function getFirstInterface(){var _0x1c8975=_[_0xf776('0xe')](getInterfaces());return{'macAddress':_0x1c8975&&_0x1c8975['mac']?_0x1c8975[_0xf776('0xf')]:_0xf776('0x10'),'ipAddress':_0x1c8975&&_0x1c8975[_0xf776('0x11')]?_0x1c8975[_0xf776('0x11')]:'127.0.0.1'};}exports[_0xf776('0x12')]=getFirstInterface;function getCPUhash(){var _0x491514=_[_0xf776('0x6')](os['cpus']()[_0xf776('0x13')](function(_0x429b46){return _0x429b46[_0xf776('0x14')];}))[_0xf776('0x15')](':');return crypto['createHash'](_0xf776('0x16'))[_0xf776('0x17')](_0x491514)[_0xf776('0x18')](_0xf776('0x19'));}exports[_0xf776('0x1a')]=function(){var _0x4181d0=os[_0xf776('0x1b')]();var _0x317da5=/[0-9a-f-]{36}/;if(config[_0xf776('0x1c')]&&_0x317da5[_0xf776('0x1d')](config['licenseToken'])){return config[_0xf776('0x1c')];}else if(_0x4181d0===_0xf776('0x1e')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xf776('0x1f')]('\x0d\x0a','');}else{var _0x17c2d6=getFirstInterface();var _0x5ec187=getCPUhash();var _0x1e3b3c=_0x5ec187+'|'+os[_0xf776('0x20')]()+'|'+_0x17c2d6['macAddress']+'|'+_0x17c2d6['ipAddress'];var _0x5efe8b=crypto[_0xf776('0x21')]('md5')[_0xf776('0x17')](_0x1e3b3c)[_0xf776('0x18')](_0xf776('0x19'));return _0x5efe8b[_0xf776('0x22')](0x0,0x8)+'-'+_0x5efe8b[_0xf776('0x22')](0x8,0xc)+'-'+_0x5efe8b['substring'](0xc,0x10)+'-'+_0x5efe8b[_0xf776('0x22')](0x10,0x14)+'-'+_0x5efe8b['substring'](0x14);}}; \ No newline at end of file +var _0xbe9e=['getFirstInterface','cpus','map','model','join','md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','createHash','digest','substring','execSync','../environment','networkInterfaces','orderBy','keys','length','IPv4','concat','head','mac','address','127.0.0.1'];(function(_0x493a93,_0x5ecb0b){var _0x3df857=function(_0x226d5a){while(--_0x226d5a){_0x493a93['push'](_0x493a93['shift']());}};_0x3df857(++_0x5ecb0b);}(_0xbe9e,0x13e));var _0xebe9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbe9e[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xebe9('0x0')];var config=require(_0xebe9('0x1'));function getInterfaces(){var _0x25f508=[];var _0x19ee8e=os[_0xebe9('0x2')]();var _0x2d6db6=_[_0xebe9('0x3')](_[_0xebe9('0x4')](_0x19ee8e));for(var _0x9421e8=0x0;_0x9421e8<_0x2d6db6[_0xebe9('0x5')];_0x9421e8++){var _0x1264ad=_0x19ee8e[_0x2d6db6[_0x9421e8]]['filter'](function(_0x424ed2){return _0x424ed2['family']===_0xebe9('0x6')&&_0x424ed2['internal']===![];});_0x25f508=_0x25f508[_0xebe9('0x7')](_0x1264ad);}return _0x25f508;}function getFirstInterface(){var _0xfa33c1=_[_0xebe9('0x8')](getInterfaces());return{'macAddress':_0xfa33c1&&_0xfa33c1['mac']?_0xfa33c1[_0xebe9('0x9')]:'00:00:00:00:00:00','ipAddress':_0xfa33c1&&_0xfa33c1[_0xebe9('0xa')]?_0xfa33c1[_0xebe9('0xa')]:_0xebe9('0xb')};}exports[_0xebe9('0xc')]=getFirstInterface;function getCPUhash(){var _0x568d2f=_[_0xebe9('0x3')](os[_0xebe9('0xd')]()[_0xebe9('0xe')](function(_0x5badfe){return _0x5badfe[_0xebe9('0xf')];}))[_0xebe9('0x10')](':');return crypto['createHash'](_0xebe9('0x11'))[_0xebe9('0x12')](_0x568d2f)['digest'](_0xebe9('0x13'));}exports[_0xebe9('0x14')]=function(){var _0x5b8229=os[_0xebe9('0x15')]();var _0x3ba9ff=/[0-9a-f-]{36}/;if(config[_0xebe9('0x16')]&&_0x3ba9ff[_0xebe9('0x17')](config['licenseToken'])){return config[_0xebe9('0x16')];}else if(_0x5b8229===_0xebe9('0x18')){return exec(_0xebe9('0x19'),{'encoding':_0xebe9('0x1a')})['replace']('\x0d\x0a','');}else{var _0x32beff=getFirstInterface();var _0x4679ab=getCPUhash();var _0x4bb5d8=_0x4679ab+'|'+os[_0xebe9('0x1b')]()+'|'+_0x32beff[_0xebe9('0x1c')]+'|'+_0x32beff[_0xebe9('0x1d')];var _0x53711d=crypto[_0xebe9('0x1e')](_0xebe9('0x11'))[_0xebe9('0x12')](_0x4bb5d8)[_0xebe9('0x1f')]('hex');return _0x53711d[_0xebe9('0x20')](0x0,0x8)+'-'+_0x53711d[_0xebe9('0x20')](0x8,0xc)+'-'+_0x53711d[_0xebe9('0x20')](0xc,0x10)+'-'+_0x53711d[_0xebe9('0x20')](0x10,0x14)+'-'+_0x53711d['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9b564a6..7777e35 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 _0x5afe=['%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','error','moment','bluebird','pkginfo','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format'];(function(_0x2c1f24,_0x64e52c){var _0x1057f0=function(_0x28b363){while(--_0x28b363){_0x2c1f24['push'](_0x2c1f24['shift']());}};_0x1057f0(++_0x64e52c);}(_0x5afe,0x64));var _0xe5af=function(_0x4c56b6,_0x239082){_0x4c56b6=_0x4c56b6-0x0;var _0x1ee73a=_0x5afe[_0x4c56b6];return _0x1ee73a;};'use strict';var util=require('util');var moment=require(_0xe5af('0x0'));var rp=require('request-promise');var BPromise=require(_0xe5af('0x1'));var pkginfo=require(_0xe5af('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xe5af('0x3'));var hardware=require('./hardware');var logger=require(_0xe5af('0x4'))(_0xe5af('0x5'));var HOST=_0xe5af('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41493c){return new BPromise(function(_0x223551,_0x2fae45){var _0x2731c0=util[_0xe5af('0x7')](_0xe5af('0x8'),HOST,_0x41493c,module[_0xe5af('0x9')][_0xe5af('0xa')]);if(oldToken){_0x2731c0=util[_0xe5af('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x41493c,module[_0xe5af('0x9')]['version'],oldToken);}var _0x159ab9={'uri':_0x2731c0,'method':_0xe5af('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x159ab9)[_0xe5af('0xc')](function(_0x4c5cf5){_0x223551(_0x4c5cf5);})[_0xe5af('0xd')](function(_0x5ae3bd){_0x2fae45(_0x5ae3bd);});});}function manageLicense(_0x182b9f,_0x47be3d){var _0x315f88=_0x47be3d['get']({'plain':!![]});if(!isOldTokenSent&&_0x315f88[_0xe5af('0xe')]!==_0x182b9f&&!_0x315f88['data2']){oldToken=_0x315f88['data1'];}httpRequest(_0x182b9f)[_0xe5af('0xc')](function(_0x2f20cb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f20cb['active']){isOldTokenSent=![];if(!_0x315f88[_0xe5af('0x5')]&&_0x315f88[_0xe5af('0x5')]!=_0x2f20cb['license']||_0x315f88[_0xe5af('0x5')]&&_0x315f88[_0xe5af('0xf')]){logger[_0xe5af('0x10')](_0xe5af('0x11'));}if(_0x315f88[_0xe5af('0x5')]&&!_0x315f88[_0xe5af('0xf')]&&_0x315f88[_0xe5af('0x5')]!=_0x2f20cb['license']){logger[_0xe5af('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x315f88['license']&&!_0x315f88[_0xe5af('0xf')]&&_0x315f88[_0xe5af('0x5')]==_0x2f20cb['license']){return _0x47be3d;}return _0x47be3d['update']({'data1':_0x182b9f,'data2':null,'license':_0x2f20cb[_0xe5af('0x5')]});}else{if(_0x2f20cb['license']||_0x315f88[_0xe5af('0x5')]){if(!_0x315f88[_0xe5af('0xf')]){if(_0x315f88[_0xe5af('0xe')]==_0x182b9f){GRAY_PERIOD_REASON=_0xe5af('0x12');logger[_0xe5af('0x10')](_0xe5af('0x13'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xe5af('0x10')](_0xe5af('0x14'),_0x315f88['data1'],_0x182b9f);}logger[_0xe5af('0x10')](_0xe5af('0x15'),GRAY_PERIOD_REASON[_0xe5af('0x16')](),moment()['format'](_0xe5af('0x17')));return _0x47be3d[_0xe5af('0x18')]({'data2':encryptor['encryptString'](moment()[_0xe5af('0x7')](_0xe5af('0x17')))});}else{if(moment()[_0xe5af('0x19')](encryptor[_0xe5af('0x1a')](_0x315f88[_0xe5af('0xf')]),_0xe5af('0x1b'))>DAYS){logger[_0xe5af('0x10')](_0xe5af('0x1c'),moment()['format'](_0xe5af('0x17')));isOldTokenSent=![];return _0x47be3d[_0xe5af('0x18')]({'data1':_0x182b9f,'data2':null,'license':null});}}}else{if(_0x315f88['data1']!=_0x182b9f){logger[_0xe5af('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x315f88[_0xe5af('0xe')],_0x182b9f);return _0x47be3d[_0xe5af('0x18')]({'data1':_0x182b9f,'data2':null,'license':null});}}}return _0x47be3d;})[_0xe5af('0xc')](function(_0x4895b6){_0x47be3d=_0x4895b6;})[_0xe5af('0xd')](function(_0x5b7659){logger['error'](_0x5b7659[_0xe5af('0x1d')]);})[_0xe5af('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xe5af('0x1f')](),_0x47be3d);},TIME);});}function defaultLicense(){var _0x4c84b1=hardware[_0xe5af('0x1f')]();if(_0x4c84b1){return db[_0xe5af('0x20')][_0xe5af('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x4c84b1}})[_0xe5af('0x22')](function(_0xa25160,_0xd87d4f){logger[_0xe5af('0x10')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4c84b1);manageLicense(_0x4c84b1,_0xa25160);})['catch'](function(_0x3ef8c1){logger[_0xe5af('0x23')](_0x3ef8c1[_0xe5af('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x8d4f=['findOrCreate','spread','error','default','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x8d4f,0x187));var _0xf8d4=function(_0x222a4b,_0x3d53d2){_0x222a4b=_0x222a4b-0x0;var _0x2bedb3=_0x8d4f[_0x222a4b];return _0x2bedb3;};'use strict';var util=require('util');var moment=require(_0xf8d4('0x0'));var rp=require('request-promise');var BPromise=require(_0xf8d4('0x1'));var pkginfo=require(_0xf8d4('0x2'))(module,_0xf8d4('0x3'));var db=require(_0xf8d4('0x4'))['db'];var encryptor=require(_0xf8d4('0x5'));var hardware=require(_0xf8d4('0x6'));var logger=require(_0xf8d4('0x7'))(_0xf8d4('0x8'));var HOST=_0xf8d4('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x224353){return new BPromise(function(_0x50e94f,_0x26bfb8){var _0x5dca6e=util['format'](_0xf8d4('0xa'),HOST,_0x224353,module[_0xf8d4('0xb')][_0xf8d4('0x3')]);if(oldToken){_0x5dca6e=util[_0xf8d4('0xc')](_0xf8d4('0xd'),HOST,_0x224353,module['exports'][_0xf8d4('0x3')],oldToken);}var _0x40c4c2={'uri':_0x5dca6e,'method':_0xf8d4('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x40c4c2)[_0xf8d4('0xf')](function(_0x109e4a){_0x50e94f(_0x109e4a);})[_0xf8d4('0x10')](function(_0x21278d){_0x26bfb8(_0x21278d);});});}function manageLicense(_0xa2f503,_0x13be92){var _0x22efd3=_0x13be92[_0xf8d4('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x22efd3['data1']!==_0xa2f503&&!_0x22efd3['data2']){oldToken=_0x22efd3[_0xf8d4('0x12')];}httpRequest(_0xa2f503)[_0xf8d4('0xf')](function(_0x5133ec){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5133ec[_0xf8d4('0x13')]){isOldTokenSent=![];if(!_0x22efd3[_0xf8d4('0x8')]&&_0x22efd3[_0xf8d4('0x8')]!=_0x5133ec['license']||_0x22efd3[_0xf8d4('0x8')]&&_0x22efd3[_0xf8d4('0x14')]){logger[_0xf8d4('0x15')](_0xf8d4('0x16'));}if(_0x22efd3[_0xf8d4('0x8')]&&!_0x22efd3[_0xf8d4('0x14')]&&_0x22efd3['license']!=_0x5133ec[_0xf8d4('0x8')]){logger[_0xf8d4('0x15')](_0xf8d4('0x17'));}if(_0x22efd3[_0xf8d4('0x8')]&&!_0x22efd3['data2']&&_0x22efd3[_0xf8d4('0x8')]==_0x5133ec[_0xf8d4('0x8')]){return _0x13be92;}return _0x13be92[_0xf8d4('0x18')]({'data1':_0xa2f503,'data2':null,'license':_0x5133ec[_0xf8d4('0x8')]});}else{if(_0x5133ec[_0xf8d4('0x8')]||_0x22efd3['license']){if(!_0x22efd3[_0xf8d4('0x14')]){if(_0x22efd3['data1']==_0xa2f503){GRAY_PERIOD_REASON=_0xf8d4('0x19');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xf8d4('0x1a');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x22efd3['data1'],_0xa2f503);}logger['info'](_0xf8d4('0x1b'),GRAY_PERIOD_REASON[_0xf8d4('0x1c')](),moment()[_0xf8d4('0xc')](_0xf8d4('0x1d')));return _0x13be92['update']({'data2':encryptor[_0xf8d4('0x1e')](moment()[_0xf8d4('0xc')](_0xf8d4('0x1d')))});}else{if(moment()[_0xf8d4('0x1f')](encryptor[_0xf8d4('0x20')](_0x22efd3[_0xf8d4('0x14')]),'days')>DAYS){logger[_0xf8d4('0x15')](_0xf8d4('0x21'),moment()['format'](_0xf8d4('0x1d')));isOldTokenSent=![];return _0x13be92[_0xf8d4('0x18')]({'data1':_0xa2f503,'data2':null,'license':null});}}}else{if(_0x22efd3[_0xf8d4('0x12')]!=_0xa2f503){logger[_0xf8d4('0x15')](_0xf8d4('0x22'),_0x22efd3[_0xf8d4('0x12')],_0xa2f503);return _0x13be92[_0xf8d4('0x18')]({'data1':_0xa2f503,'data2':null,'license':null});}}}return _0x13be92;})[_0xf8d4('0xf')](function(_0x12dfed){_0x13be92=_0x12dfed;})['catch'](function(_0x49c309){logger['error'](_0x49c309[_0xf8d4('0x23')]);})[_0xf8d4('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xf8d4('0x25')](),_0x13be92);},TIME);});}function defaultLicense(){var _0x276f83=hardware[_0xf8d4('0x25')]();if(_0x276f83){return db[_0xf8d4('0x26')][_0xf8d4('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x276f83}})[_0xf8d4('0x28')](function(_0x56b9f4,_0x31be60){logger[_0xf8d4('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x276f83);manageLicense(_0x276f83,_0x56b9f4);})[_0xf8d4('0x10')](function(_0x3f4c41){logger[_0xf8d4('0x29')](_0x3f4c41[_0xf8d4('0x23')]);});}}exports[_0xf8d4('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e3fb183..2c7ac64 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 _0x2add=['add','days','changed','message','User','findAll','role','COUNT','sequelize','col','count','admin','telephone','users','telephones','forEach','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x2add,0xcd));var _0xd2ad=function(_0x3ec216,_0x3178a1){_0x3ec216=_0x3ec216-0x0;var _0x54274a=_0x2add[_0x3ec216];return _0x54274a;};'use strict';var util=require(_0xd2ad('0x0'));var _=require(_0xd2ad('0x1'));var moment=require(_0xd2ad('0x2'));var BPromise=require('bluebird');var hardware=require(_0xd2ad('0x3'));var encryptor=require(_0xd2ad('0x4'));var db=require(_0xd2ad('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2ad('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd2ad('0x7'),'machineUuid':hardware[_0xd2ad('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2ad('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd2ad('0x9'),'machineUuid':hardware[_0xd2ad('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21ea6c){return new BPromise(function(_0x5acd5c,_0x13e632){return db['License'][_0xd2ad('0xa')](_[_0xd2ad('0xb')](_0x21ea6c,{'raw':!![],'where':{'id':0x1}}))[_0xd2ad('0xc')](function(_0x37a1a2){return checkLicense(_0x37a1a2,null);})[_0xd2ad('0xc')](function(_0x2f92bd){_0x5acd5c(_0x2f92bd);return;})['catch'](function(_0x104682){_0x13e632(_0x104682);});});}function checkLicense(_0x1f93ca,_0x18b815){if(!_0x1f93ca){demoLicense[_0xd2ad('0xd')]=_0x1f93ca[_0xd2ad('0xe')];return demoLicense;}try{var _0x23e424=_0x18b815||_0x1f93ca['license'];if(_[_0xd2ad('0xf')](_0x23e424)){throw new Error(_0xd2ad('0x10'));}var _0x20f19e=_0x1f93ca['data1'];var _0x2df5da=_0x1f93ca['data2'];var _0x55f054=_0x20f19e[_0xd2ad('0x11')]('-')[0x4];var _0xf38a6d=_0x20f19e[_0xd2ad('0x11')]('-')[0x0];var _0xa1b7a5=encryptor[_0xd2ad('0x12')](_0x23e424,util[_0xd2ad('0x13')](_0xd2ad('0x14'),_0x55f054,_0x20f19e,_0xf38a6d));var _0x2923f8=JSON['parse'](_0xa1b7a5);_0x2923f8[_0xd2ad('0x15')]=![];_0x2923f8[_0xd2ad('0xd')]=_0x20f19e;_0x2923f8[_0xd2ad('0x16')]=hardware[_0xd2ad('0x8')]();if(_0x2df5da){var _0x1c7ff6=encryptor[_0xd2ad('0x12')](_0x2df5da);_0x2923f8[_0xd2ad('0x17')]=_0x1c7ff6;_0x2923f8[_0xd2ad('0x18')]=moment(_0x1c7ff6)[_0xd2ad('0x19')](0x7,_0xd2ad('0x1a'))[_0xd2ad('0x13')]();_0x2923f8['grayReason']=_0x2923f8[_0xd2ad('0xd')]!=_0x2923f8['machineUuid']?_0xd2ad('0x1b'):'disabled';}return _0x2923f8;}catch(_0x3a656f){breakingLicense[_0xd2ad('0xd')]=_0x1f93ca[_0xd2ad('0xe')];breakingLicense[_0xd2ad('0x1c')]=_0x3a656f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2d024f,_0x135780){getLicense()['then'](function(_0x14fab9){return db[_0xd2ad('0x1d')][_0xd2ad('0x1e')]({'attributes':[_0xd2ad('0x1f'),[db['sequelize']['fn'](_0xd2ad('0x20'),db[_0xd2ad('0x21')][_0xd2ad('0x22')](_0xd2ad('0x1f'))),_0xd2ad('0x23')]],'group':'role','where':{'role':{'$or':[_0xd2ad('0x24'),'user',_0xd2ad('0x25')]}},'raw':!![]})[_0xd2ad('0xc')](function(_0x3fc4e4){var _0x49b0c5={'user':_0x14fab9[_0xd2ad('0x26')]||0x0,'telephone':_0x14fab9[_0xd2ad('0x27')]||0x0};_0x3fc4e4[_0xd2ad('0x28')](function(_0x1eabf0){var _0x15e980=_0x1eabf0[_0xd2ad('0x1f')]==='admin'?'user':_0x1eabf0['role'];_0x49b0c5[_0x15e980]-=_0x1eabf0[_0xd2ad('0x23')];if(_0x49b0c5[_0x15e980]<0x0)_0x49b0c5[_0x15e980]=0x0;});_0x2d024f(_0x49b0c5);return;});})['catch'](function(_0x1d9451){_0x135780(_0x1d9451);});});}function checkUserLimits(_0x42d167){return new BPromise(function(_0x5aa1c7,_0x341ea0){getLimits()[_0xd2ad('0xc')](function(_0x742584){var _0x2fa6e7=_['pick'](_[_0xd2ad('0x29')](_0x42d167,_0xd2ad('0x1f')),[_0xd2ad('0x24'),_0xd2ad('0x2a'),_0xd2ad('0x25')]);var _0x392810=(_0x2fa6e7[_0xd2ad('0x24')]||0x0)+(_0x2fa6e7['user']||0x0);var _0x1c42ec=_0x2fa6e7[_0xd2ad('0x25')]||0x0;if(_0x392810>_0x742584['user'])return _0x341ea0(_0xd2ad('0x2b'));if(_0x1c42ec>_0x742584['telephone'])return _0x341ea0(_0xd2ad('0x2c'));return _0x5aa1c7();})['catch'](function(_0x1f9250){_0x341ea0(_0x1f9250);});});}module[_0xd2ad('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3c81=['%s:%s:%s','demo','machineUuid','add','changed','disabled','message','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','uuid','data1','license','isEmpty','data2','split','decryptString','format'];(function(_0x1f00bf,_0x9a46c5){var _0x4be18f=function(_0x52ae99){while(--_0x52ae99){_0x1f00bf['push'](_0x1f00bf['shift']());}};_0x4be18f(++_0x9a46c5);}(_0x3c81,0xc8));var _0x13c8=function(_0x5c6b9a,_0x42b65b){_0x5c6b9a=_0x5c6b9a-0x0;var _0x36cd36=_0x3c81[_0x5c6b9a];return _0x36cd36;};'use strict';var util=require(_0x13c8('0x0'));var _=require('lodash');var moment=require(_0x13c8('0x1'));var BPromise=require(_0x13c8('0x2'));var hardware=require(_0x13c8('0x3'));var encryptor=require(_0x13c8('0x4'));var db=require(_0x13c8('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x13c8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x13c8('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4af37c){return new BPromise(function(_0x53aaa4,_0xf06593){return db[_0x13c8('0x8')][_0x13c8('0x9')](_[_0x13c8('0xa')](_0x4af37c,{'raw':!![],'where':{'id':0x1}}))[_0x13c8('0xb')](function(_0x208a1b){return checkLicense(_0x208a1b,null);})[_0x13c8('0xb')](function(_0x37f5d6){_0x53aaa4(_0x37f5d6);return;})['catch'](function(_0x2301b4){_0xf06593(_0x2301b4);});});}function checkLicense(_0x3f010d,_0x5c4186){if(!_0x3f010d){demoLicense[_0x13c8('0xc')]=_0x3f010d[_0x13c8('0xd')];return demoLicense;}try{var _0x48ecdf=_0x5c4186||_0x3f010d[_0x13c8('0xe')];if(_[_0x13c8('0xf')](_0x48ecdf)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2000ea=_0x3f010d[_0x13c8('0xd')];var _0x1854e2=_0x3f010d[_0x13c8('0x10')];var _0xfb30f6=_0x2000ea['split']('-')[0x4];var _0x3a4a23=_0x2000ea[_0x13c8('0x11')]('-')[0x0];var _0x1202f7=encryptor[_0x13c8('0x12')](_0x48ecdf,util[_0x13c8('0x13')](_0x13c8('0x14'),_0xfb30f6,_0x2000ea,_0x3a4a23));var _0x560e57=JSON['parse'](_0x1202f7);_0x560e57[_0x13c8('0x15')]=![];_0x560e57['uuid']=_0x2000ea;_0x560e57[_0x13c8('0x16')]=hardware[_0x13c8('0x7')]();if(_0x1854e2){var _0x264fd3=encryptor[_0x13c8('0x12')](_0x1854e2);_0x560e57['gray']=_0x264fd3;_0x560e57['deadline']=moment(_0x264fd3)[_0x13c8('0x17')](0x7,'days')[_0x13c8('0x13')]();_0x560e57['grayReason']=_0x560e57[_0x13c8('0xc')]!=_0x560e57[_0x13c8('0x16')]?_0x13c8('0x18'):_0x13c8('0x19');}return _0x560e57;}catch(_0x4c8aa5){breakingLicense[_0x13c8('0xc')]=_0x3f010d['data1'];breakingLicense[_0x13c8('0x1a')]=_0x4c8aa5[_0x13c8('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5573ea,_0x1585b9){getLicense()[_0x13c8('0xb')](function(_0x1463fe){return db['User'][_0x13c8('0x1b')]({'attributes':[_0x13c8('0x1c'),[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')][_0x13c8('0x1e')]('role')),_0x13c8('0x1f')]],'group':'role','where':{'role':{'$or':[_0x13c8('0x20'),_0x13c8('0x21'),_0x13c8('0x22')]}},'raw':!![]})[_0x13c8('0xb')](function(_0x15ae2d){var _0x18c195={'user':_0x1463fe[_0x13c8('0x23')]||0x0,'telephone':_0x1463fe[_0x13c8('0x24')]||0x0};_0x15ae2d[_0x13c8('0x25')](function(_0x103942){var _0x25ef8b=_0x103942[_0x13c8('0x1c')]===_0x13c8('0x20')?_0x13c8('0x21'):_0x103942[_0x13c8('0x1c')];_0x18c195[_0x25ef8b]-=_0x103942[_0x13c8('0x1f')];if(_0x18c195[_0x25ef8b]<0x0)_0x18c195[_0x25ef8b]=0x0;});_0x5573ea(_0x18c195);return;});})[_0x13c8('0x26')](function(_0x4f1704){_0x1585b9(_0x4f1704);});});}function checkUserLimits(_0x1de887){return new BPromise(function(_0x1ca799,_0x3b122b){getLimits()[_0x13c8('0xb')](function(_0x2de7f5){var _0x5881eb=_[_0x13c8('0x27')](_[_0x13c8('0x28')](_0x1de887,_0x13c8('0x1c')),[_0x13c8('0x20'),_0x13c8('0x21'),_0x13c8('0x22')]);var _0x3bc3e6=(_0x5881eb['admin']||0x0)+(_0x5881eb[_0x13c8('0x21')]||0x0);var _0x40922d=_0x5881eb[_0x13c8('0x22')]||0x0;if(_0x3bc3e6>_0x2de7f5[_0x13c8('0x21')])return _0x3b122b(_0x13c8('0x29'));if(_0x40922d>_0x2de7f5[_0x13c8('0x22')])return _0x3b122b(_0x13c8('0x2a'));return _0x1ca799();})['catch'](function(_0x56da3f){_0x3b122b(_0x56da3f);});});}module[_0x13c8('0x2b')]={'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 dfb806e..480a7bc 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 _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x455c85,_0x4ecda9){var _0x506ec4=function(_0x2ae1b0){while(--_0x2ae1b0){_0x455c85['push'](_0x455c85['shift']());}};_0x506ec4(++_0x4ecda9);}(_0x0120,0x6f));var _0x0012=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0120[_0x126558];return _0x1f6d14;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x2da6=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x512cde,_0x10aa7f){var _0x6f1dc3=function(_0x158e38){while(--_0x158e38){_0x512cde['push'](_0x512cde['shift']());}};_0x6f1dc3(++_0x10aa7f);}(_0x2da6,0x1dd));var _0x62da=function(_0x51b332,_0x11bd05){_0x51b332=_0x51b332-0x0;var _0x9db2d1=_0x2da6[_0x51b332];return _0x9db2d1;};'use strict';module[_0x62da('0x0')]={'DOMAIN':_0x62da('0x1'),'SESSION_SECRET':_0x62da('0x2'),'GOOGLE_ID':_0x62da('0x3'),'GOOGLE_SECRET':_0x62da('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d3d94b4..3851d97 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7ad=['exports'];(function(_0x21312c,_0x2b5596){var _0x34d047=function(_0x26d0a4){while(--_0x26d0a4){_0x21312c['push'](_0x21312c['shift']());}};_0x34d047(++_0x2b5596);}(_0xf7ad,0x1cf));var _0xdf7a=function(_0x379008,_0xa1fbaa){_0x379008=_0x379008-0x0;var _0xc436c6=_0xf7ad[_0x379008];return _0xc436c6;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0xdf7a('0x0')]=fileLogger; \ No newline at end of file +var _0x14b8=['../utils/loggers','exports'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x14b8,0x150));var _0x814b=function(_0x5515b3,_0x5bcffd){_0x5515b3=_0x5515b3-0x0;var _0x3ace2f=_0x14b8[_0x5515b3];return _0x3ace2f;};'use strict';var fileLogger=require(_0x814b('0x0'))['fileLogger'];module[_0x814b('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e1333f9..07f2929 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 _0x4c3e=['../../services/routing/index.js','../../services/xdr/index.js','path','../../config/environment','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x57aa39,_0x5b7dd9){var _0x1d9f2e=function(_0xda8d8a){while(--_0xda8d8a){_0x57aa39['push'](_0x57aa39['shift']());}};_0x1d9f2e(++_0x5b7dd9);}(_0x4c3e,0x10c));var _0xe4c3=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4c3e[_0xbb091];return _0x467a04;};'use strict';var path=require(_0xe4c3('0x0'));var cfg=require(_0xe4c3('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xe4c3('0x2')](cfg[_0xe4c3('0x3')],_0xe4c3('0x4')))};var pm2config={'apps':[{'name':_0xe4c3('0x5'),'script':path['join'](__dirname,_0xe4c3('0x6')),'env':env},{'name':_0xe4c3('0x7'),'script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0x8')),'env':env},{'name':_0xe4c3('0x9'),'script':path['join'](__dirname,_0xe4c3('0xa')),'env':env},{'name':'email','script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0xb')),'env':env},{'name':'routing','script':path['join'](__dirname,_0xe4c3('0xc')),'env':env},{'name':'xdr','script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x49f6=['resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','../../config/environment'];(function(_0x11e1ab,_0x4bb093){var _0x530ca0=function(_0x329d8b){while(--_0x329d8b){_0x11e1ab['push'](_0x11e1ab['shift']());}};_0x530ca0(++_0x4bb093);}(_0x49f6,0x9f));var _0x649f=function(_0x228ac5,_0x2b13b1){_0x228ac5=_0x228ac5-0x0;var _0x55a9fc=_0x49f6[_0x228ac5];return _0x55a9fc;};'use strict';var path=require('path');var cfg=require(_0x649f('0x0'));var env={'NODE_PATH':path[_0x649f('0x1')](path[_0x649f('0x2')](cfg[_0x649f('0x3')],_0x649f('0x4')))};var pm2config={'apps':[{'name':_0x649f('0x5'),'script':path[_0x649f('0x2')](__dirname,_0x649f('0x6')),'env':env},{'name':_0x649f('0x7'),'script':path[_0x649f('0x2')](__dirname,_0x649f('0x8')),'env':env},{'name':_0x649f('0x9'),'script':path[_0x649f('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x649f('0xa'),'script':path[_0x649f('0x2')](__dirname,_0x649f('0xb')),'env':env},{'name':_0x649f('0xc'),'script':path[_0x649f('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x649f('0xd'),'script':path['join'](__dirname,_0x649f('0xe')),'env':env}]};module[_0x649f('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 14b1e37..215f39a 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 _0x3141=['stop','disconnect','restart','list','describe','delete','dump','pm2','./config','connected','start','then'];(function(_0x5df843,_0x35331a){var _0x160f4f=function(_0x48a47d){while(--_0x48a47d){_0x5df843['push'](_0x5df843['shift']());}};_0x160f4f(++_0x35331a);}(_0x3141,0xdf));var _0x1314=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3141[_0x122ef9];return _0x42fba0;};'use strict';var pm2=require(_0x1314('0x0'));var BPromise=require('bluebird');var config=require(_0x1314('0x1'));function connect(){return new BPromise(function(_0x3df58b,_0x5c4278){return pm2['connect'](function(_0x127661){if(_0x127661){return _0x5c4278(_0x127661);}return _0x3df58b(_0x1314('0x2'));});});};exports[_0x1314('0x3')]=function(_0x5630ce){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x544522,_0x1587bf){return pm2['start'](_0x5630ce,function(_0x14714a,_0x5722c9){if(_0x14714a){return _0x1587bf(_0x14714a);}pm2['disconnect']();return _0x544522(_0x5722c9);});});});};exports['stop']=function(_0x4757ee){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x353770,_0xbf2b4a){return pm2[_0x1314('0x5')](_0x4757ee,function(_0x295873,_0x38a2bb){if(_0x295873){return _0xbf2b4a(_0x295873);}pm2[_0x1314('0x6')]();return _0x353770(_0x38a2bb);});});});};exports['restart']=function(_0x4a18ca){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x24e8b2,_0x43d016){return pm2[_0x1314('0x7')](_0x4a18ca,function(_0x496d6f,_0x3f1466){if(_0x496d6f){return _0x43d016(_0x496d6f);}pm2[_0x1314('0x6')]();return _0x24e8b2(_0x3f1466);});});});};exports[_0x1314('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x24d083,_0x2c1f42){return pm2[_0x1314('0x8')](function(_0xc3493f,_0x1c6fec){if(_0xc3493f){return _0x2c1f42(_0xc3493f);}pm2[_0x1314('0x6')]();return _0x24d083(_0x1c6fec);});});});};exports[_0x1314('0x9')]=function(_0x2862bb){return connect()['then'](function(){return new BPromise(function(_0x178923,_0x29ae15){return pm2[_0x1314('0x9')](_0x2862bb,function(_0x42a037,_0x82c3b0){if(_0x42a037){return _0x29ae15(_0x42a037);}pm2['disconnect']();return _0x178923(_0x82c3b0);});});});};exports[_0x1314('0xa')]=function(_0x41f3b1){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x3d19e5,_0x2db71f){return pm2['delete'](_0x41f3b1,function(_0x301ff0,_0x14825f){if(_0x301ff0){return _0x2db71f(_0x301ff0);}pm2['disconnect']();return _0x3d19e5(_0x14825f);});});});};exports['dump']=function(){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x1d9d57,_0x4e94a1){return pm2[_0x1314('0xb')](function(_0x2468c3){if(_0x2468c3){return _0x4e94a1(_0x2468c3);}return _0x1d9d57('saved');});});});}; \ No newline at end of file +var _0x4cac=['stop','restart','list','describe','delete','dump','pm2','./config','connect','connected','then','start','disconnect'];(function(_0x92c0be,_0x4391d2){var _0x3b4c1d=function(_0x27424b){while(--_0x27424b){_0x92c0be['push'](_0x92c0be['shift']());}};_0x3b4c1d(++_0x4391d2);}(_0x4cac,0x117));var _0xc4ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cac[_0x14add3];return _0x4a174f;};'use strict';var pm2=require(_0xc4ca('0x0'));var BPromise=require('bluebird');var config=require(_0xc4ca('0x1'));function connect(){return new BPromise(function(_0x3534b7,_0x22be5c){return pm2[_0xc4ca('0x2')](function(_0x442904){if(_0x442904){return _0x22be5c(_0x442904);}return _0x3534b7(_0xc4ca('0x3'));});});};exports['start']=function(_0x57d80d){return connect()[_0xc4ca('0x4')](function(){return new BPromise(function(_0x52d56b,_0x14131f){return pm2[_0xc4ca('0x5')](_0x57d80d,function(_0x531a66,_0x4a51f4){if(_0x531a66){return _0x14131f(_0x531a66);}pm2[_0xc4ca('0x6')]();return _0x52d56b(_0x4a51f4);});});});};exports[_0xc4ca('0x7')]=function(_0x16e893){return connect()[_0xc4ca('0x4')](function(){return new BPromise(function(_0x501a10,_0x5e33d2){return pm2['stop'](_0x16e893,function(_0x564813,_0xa8f01c){if(_0x564813){return _0x5e33d2(_0x564813);}pm2[_0xc4ca('0x6')]();return _0x501a10(_0xa8f01c);});});});};exports[_0xc4ca('0x8')]=function(_0x247bcc){return connect()[_0xc4ca('0x4')](function(){return new BPromise(function(_0x499d5e,_0x586b4a){return pm2['restart'](_0x247bcc,function(_0x2c59aa,_0x46a644){if(_0x2c59aa){return _0x586b4a(_0x2c59aa);}pm2[_0xc4ca('0x6')]();return _0x499d5e(_0x46a644);});});});};exports[_0xc4ca('0x9')]=function(){return connect()[_0xc4ca('0x4')](function(){return new BPromise(function(_0x299fdc,_0x588ccf){return pm2[_0xc4ca('0x9')](function(_0x11e695,_0x4c9a94){if(_0x11e695){return _0x588ccf(_0x11e695);}pm2[_0xc4ca('0x6')]();return _0x299fdc(_0x4c9a94);});});});};exports[_0xc4ca('0xa')]=function(_0x1660f0){return connect()['then'](function(){return new BPromise(function(_0x2b5ca9,_0x2fc2ed){return pm2[_0xc4ca('0xa')](_0x1660f0,function(_0x4c9895,_0x28af81){if(_0x4c9895){return _0x2fc2ed(_0x4c9895);}pm2[_0xc4ca('0x6')]();return _0x2b5ca9(_0x28af81);});});});};exports[_0xc4ca('0xb')]=function(_0x2eac27){return connect()[_0xc4ca('0x4')](function(){return new BPromise(function(_0xf297f9,_0x221169){return pm2[_0xc4ca('0xb')](_0x2eac27,function(_0x381333,_0x509032){if(_0x381333){return _0x221169(_0x381333);}pm2[_0xc4ca('0x6')]();return _0xf297f9(_0x509032);});});});};exports[_0xc4ca('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4b3944,_0x28615e){return pm2[_0xc4ca('0xc')](function(_0x2e9df1){if(_0x2e9df1){return _0x28615e(_0x2e9df1);}return _0x4b3944('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7e0e966..645fdd2 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 _0xc6f7=['../../config/environment','../logger','redis','defaults','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','lodash','moment','ioredis'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc6f7,0xf9));var _0x7c6f=function(_0x2b3e89,_0x2b91f3){_0x2b3e89=_0x2b3e89-0x0;var _0x439389=_0xc6f7[_0x2b3e89];return _0x439389;};'use strict';var _=require(_0x7c6f('0x0'));var moment=require(_0x7c6f('0x1'));var Redis=require(_0x7c6f('0x2'));var util=require('util');var config=require(_0x7c6f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x7c6f('0x4'))('schedule');config[_0x7c6f('0x5')]=_[_0x7c6f('0x6')](config[_0x7c6f('0x5')],{'host':_0x7c6f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c6f('0x5')]));function closeInteractions(){var _0x3ea144=0x0;var _0x141357=[];return db[_0x7c6f('0x8')][_0x7c6f('0x9')]({'raw':!![],'attributes':['id',_0x7c6f('0xa')],'where':{'id':0x1}})[_0x7c6f('0xb')](function(_0x12ddc3){_0x3ea144=_0x12ddc3[_0x7c6f('0xa')];if(_0x3ea144){return db[_0x7c6f('0xc')][_0x7c6f('0xd')]({'raw':!![],'attributes':['id',_0x7c6f('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7c6f('0xf')](_0x12ddc3[_0x7c6f('0xa')],'minutes')}}});}else{return[];}})[_0x7c6f('0xb')](function(_0x4ec399){if(_0x4ec399&&_0x4ec399[_0x7c6f('0x10')]){_0x141357=_[_0x7c6f('0x11')](_0x4ec399||[],'id');logger[_0x7c6f('0x12')](_0x7c6f('0x13'),_0x141357[_0x7c6f('0x14')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x7c6f('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x141357}});}})[_0x7c6f('0xb')](function(){if(_0x141357&&_0x141357[_0x7c6f('0x10')]){logger['info'](_0x7c6f('0x16'),_0x141357['join']());for(var _0x244a7d=0x0;_0x244a7d<_0x141357[_0x7c6f('0x10')];_0x244a7d++){io[_0x7c6f('0x17')](_0x7c6f('0x18'),{'id':_0x141357[_0x244a7d],'closed':!![]});}}})['catch'](function(_0xb79c15){logger[_0x7c6f('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0xb79c15?util[_0x7c6f('0x1a')](_0xb79c15,{'showHidden':![],'depth':null}):'');});}exports[_0x7c6f('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa501=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xa501,0x17f));var _0x1a50=function(_0x526eca,_0x32288e){_0x526eca=_0x526eca-0x0;var _0x2a6c2c=_0xa501[_0x526eca];return _0x2a6c2c;};'use strict';var _=require(_0x1a50('0x0'));var moment=require('moment');var Redis=require(_0x1a50('0x1'));var util=require(_0x1a50('0x2'));var config=require('../../config/environment');var db=require(_0x1a50('0x3'))['db'];var logger=require(_0x1a50('0x4'))(_0x1a50('0x5'));config[_0x1a50('0x6')]=_[_0x1a50('0x7')](config[_0x1a50('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1a50('0x8'))(new Redis(config[_0x1a50('0x6')]));function closeInteractions(){var _0x51c6b8=0x0;var _0x1bbac1=[];return db[_0x1a50('0x9')][_0x1a50('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x1a50('0xb')](function(_0x3b3507){_0x51c6b8=_0x3b3507[_0x1a50('0xc')];if(_0x51c6b8){return db[_0x1a50('0xd')][_0x1a50('0xe')]({'raw':!![],'attributes':['id',_0x1a50('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1a50('0x10')](_0x3b3507[_0x1a50('0xc')],_0x1a50('0x11'))}}});}else{return[];}})['then'](function(_0x3d5545){if(_0x3d5545&&_0x3d5545['length']){_0x1bbac1=_[_0x1a50('0x12')](_0x3d5545||[],'id');logger[_0x1a50('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1bbac1['join']());return db['ChatInteraction'][_0x1a50('0x14')]({'closeReason':_0x1a50('0x15'),'disposition':_0x1a50('0x16'),'closed':!![],'closedAt':moment()[_0x1a50('0x17')](_0x1a50('0x18'))},{'where':{'id':_0x1bbac1}});}})[_0x1a50('0xb')](function(){if(_0x1bbac1&&_0x1bbac1[_0x1a50('0x19')]){logger[_0x1a50('0x13')](_0x1a50('0x1a'),_0x1bbac1[_0x1a50('0x1b')]());for(var _0x5b2d9f=0x0;_0x5b2d9f<_0x1bbac1[_0x1a50('0x19')];_0x5b2d9f++){io['emit']('chatInteraction:update',{'id':_0x1bbac1[_0x5b2d9f],'closed':!![]});}}})[_0x1a50('0x1c')](function(_0x3561f1){logger['error'](_0x1a50('0x1d'),_0x3561f1?util[_0x1a50('0x1e')](_0x3561f1,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index b1d3ee5..a929069 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x702b=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x702b,0x158));var _0xb702=function(_0x16f178,_0x4b2042){_0x16f178=_0x16f178-0x0;var _0x5e0d1c=_0x702b[_0x16f178];return _0x5e0d1c;};'use strict';function start(){var _0x419e4e=require(_0xb702('0x0'));return _0x419e4e[_0xb702('0x1')]();}module[_0xb702('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xedda=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2b6a8f,_0x294599){var _0x2d2036=function(_0x1ea077){while(--_0x1ea077){_0x2b6a8f['push'](_0x2b6a8f['shift']());}};_0x2d2036(++_0x294599);}(_0xedda,0x86));var _0xaedd=function(_0x459fa1,_0x50ef75){_0x459fa1=_0x459fa1-0x0;var _0x19707a=_0xedda[_0x459fa1];return _0x19707a;};'use strict';function start(){var _0x3498d7=require(_0xaedd('0x0'));return _0x3498d7[_0xaedd('0x1')]();}module[_0xaedd('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b727f14..c6d7ef8 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 _0x4e7c=['schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','data','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','difference','intersection','toString','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise'];(function(_0x12df52,_0x4dddf5){var _0x228658=function(_0x518081){while(--_0x518081){_0x12df52['push'](_0x12df52['shift']());}};_0x228658(++_0x4dddf5);}(_0x4e7c,0x19f));var _0xc4e7=function(_0x59ce2c,_0x4c60ae){_0x59ce2c=_0x59ce2c-0x0;var _0x22c18f=_0x4e7c[_0x59ce2c];return _0x22c18f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xc4e7('0x0'));var _=require(_0xc4e7('0x1'));var moment=require(_0xc4e7('0x2'));var CronJobManager=require(_0xc4e7('0x3'));var jayson=require(_0xc4e7('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xc4e7('0x5'));var db=require(_0xc4e7('0x6'))['db'];var analyticCustomReportController=require(_0xc4e7('0x7'));var analyticDefaultReportController=require(_0xc4e7('0x8'));var client=jayson[_0xc4e7('0x9')][_0xc4e7('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4cc991,_0x232a2e){return function(){logger[_0xc4e7('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4cc991[_0xc4e7('0xc')]);var _0x14a8d1=!![];var _0x37ff1f=_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0xe')]();var _0x57b6ed={'account':_0x37ff1f,'message':{'from':util[_0xc4e7('0xf')](_0xc4e7('0x10'),_0x4cc991['MailAccount'][_0xc4e7('0x11')],_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0xc')]||_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0x12')][_0xc4e7('0x13')]),'to':_0x4cc991[_0xc4e7('0xc')],'cc':_0x4cc991['cc'],'bcc':_0x4cc991['bcc'],'subject':util['format'](_0xc4e7('0x14'),_0x232a2e['name'],_0x4cc991['subtractNumber'],_0x4cc991[_0xc4e7('0x15')])}};var _0xc583a0=path[_0xc4e7('0x16')](__dirname,_0xc4e7('0x17'));var _0x1e6db1=_0x232a2e[_0xc4e7('0x18')];var _0x456974=util[_0xc4e7('0xf')](_0xc4e7('0x19'),path[_0xc4e7('0x1a')](_0x232a2e[_0xc4e7('0x18')],path['extname'](_0x232a2e['savename'])),_0xc4e7('0x1b'));var _0x192869=path[_0xc4e7('0x16')](_0xc583a0,_0x1e6db1);var _0x197cbe=path[_0xc4e7('0x16')](_0xc583a0,_0x456974);if(fs[_0xc4e7('0x1c')](_0x192869)){_0x232a2e[_0xc4e7('0x1d')]=_0xc4e7('0x1e');_0x57b6ed['message'][_0xc4e7('0x1f')]=[{'filename':_0x1e6db1,'path':_0x192869}];_0x57b6ed[_0xc4e7('0x20')][_0xc4e7('0x21')]=util[_0xc4e7('0xf')](_0xc4e7('0x22'),JSON[_0xc4e7('0x23')](_0x232a2e,null,0x2));}else if(fs['existsSync'](_0x197cbe)){_0x232a2e[_0xc4e7('0x1d')]='Sent';_0x57b6ed['message'][_0xc4e7('0x1f')]=[{'filename':_0x456974,'path':_0x197cbe}];}else{_0x57b6ed[_0xc4e7('0x20')][_0xc4e7('0x21')]=_0xc4e7('0x24');if(!_0x4cc991['sendIfEmpty']){_0x14a8d1=![];logger[_0xc4e7('0xb')](_0xc4e7('0x25'));}}if(_0x14a8d1){return client['request'](_0xc4e7('0x26'),_0x57b6ed)[_0xc4e7('0x27')](function(_0x4a7de1){if(_0x4a7de1['error']){return logger[_0xc4e7('0x28')](_0xc4e7('0x29'),JSON['stringify'](_0x4a7de1));}return logger['info']('email\x20sent');})[_0xc4e7('0x2a')](function(_0x2e6caf){return logger[_0xc4e7('0x28')](_0xc4e7('0x29'),JSON[_0xc4e7('0x23')](_0x2e6caf));});}};}function handleError(){return function(_0x2e0af8){return logger['error'](JSON[_0xc4e7('0x23')](_0x2e0af8));};}function handleResult(_0x3be9de){return function(_0x2ee4fb){logger['info'](_0xc4e7('0x2b'),JSON[_0xc4e7('0x23')](_0x2ee4fb));if(_0x3be9de[_0xc4e7('0xd')]&&_0x3be9de['MailAccount']['Smtp']&&!_['isNil'](_0x3be9de[_0xc4e7('0xc')])){setTimeout(handleSendEmail(_0x3be9de,_0x2ee4fb),0x3c*0x3e8);}};}function handleJob(_0x4809f4){return function(){try{if(_['isNil'](_0x4809f4[_0xc4e7('0x2c')])){return logger[_0xc4e7('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x4809f4[_0xc4e7('0x15')])){return logger[_0xc4e7('0xb')](_0xc4e7('0x2d'));}var _0x670010={'startDate':moment()[_0xc4e7('0x2e')](_0x4809f4[_0xc4e7('0x2c')],_0x4809f4[_0xc4e7('0x15')])['format'](_0xc4e7('0x2f')),'endDate':moment()['format'](_0xc4e7('0x2f')),'type':_0xc4e7('0x30'),'output':_0x4809f4[_0xc4e7('0x31')],'name':_0x4809f4[_0xc4e7('0x11')]};if(!_[_0xc4e7('0x32')](_0x4809f4[_0xc4e7('0x33')])){logger[_0xc4e7('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4809f4[_0xc4e7('0x33')]);return analyticDefaultReportController[_0xc4e7('0x34')]({'id':_0x4809f4[_0xc4e7('0x33')]},_0x670010)['then'](handleResult(_0x4809f4))[_0xc4e7('0x2a')](handleError());}if(!_[_0xc4e7('0x32')](_0x4809f4[_0xc4e7('0x35')])){logger[_0xc4e7('0xb')](_0xc4e7('0x36'),_0x4809f4[_0xc4e7('0x35')]);return analyticCustomReportController[_0xc4e7('0x34')]({'id':_0x4809f4['CustomReportId']},_0x670010)[_0xc4e7('0x27')](handleResult(_0x4809f4))['catch'](handleError());}}catch(_0x47ff1d){logger[_0xc4e7('0x28')](JSON['stringify'](_0x47ff1d));}return logger['info'](_0xc4e7('0x37'));};}function getJobs(_0x53d84){var _0x4f9b94={};if(_0x53d84){_0x4f9b94['id']=_0x53d84;}return db['Schedule'][_0xc4e7('0x38')]({'where':_0x4f9b94,'include':[{'model':db[_0xc4e7('0xd')],'attributes':['id',_0xc4e7('0x11'),'email'],'include':[{'model':db[_0xc4e7('0x39')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xc4e7('0x3a')}]}]}]})[_0xc4e7('0x27')](function(_0x42265e){var _0x1c72a6=_['keys'](manager['jobs']);var _0x289d72=_[_0xc4e7('0x3b')](_0x42265e,function(_0x1aa103){return _0x1aa103['id']['toString']();});var _0x52c1b6=_[_0xc4e7('0x3c')](_0x42265e,function(_0x2ee6d7){return _0x2ee6d7['id']['toString']();});var _0x5a0848=_0x53d84?_0x289d72:_[_0xc4e7('0x3d')](_0x289d72,_0x1c72a6);var _0x54315d=_[_0xc4e7('0x3e')](_0x289d72,_0x1c72a6);var _0x51bc8f=_[_0xc4e7('0x3d')](_0x1c72a6,_0x289d72);var _0xc46ed2;var _0x2a3eac;for(_0xc46ed2=0x0;_0xc46ed2<_0x51bc8f['length']&&!_0x53d84;_0xc46ed2+=0x1){_0x2a3eac=_0x51bc8f[_0xc46ed2][_0xc4e7('0x3f')]();if(manager[_0xc4e7('0x40')](_0x2a3eac)){manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger['info'](_0xc4e7('0x43'),_0x2a3eac);}}logger['info'](_0xc4e7('0x44'),JSON[_0xc4e7('0x23')](_0x5a0848));for(_0xc46ed2=0x0;_0xc46ed2<_0x5a0848[_0xc4e7('0x45')];_0xc46ed2+=0x1){_0x2a3eac=_0x5a0848[_0xc46ed2][_0xc4e7('0x3f')]();logger[_0xc4e7('0xb')](_0xc4e7('0x46'),_0x2a3eac);if(_0x53d84){logger['info'](_0xc4e7('0x47'),_0x53d84);logger['info'](JSON[_0xc4e7('0x23')](_0x52c1b6[_0x2a3eac]));BPromise['resolve']()[_0xc4e7('0x27')](handleJob(_0x52c1b6[_0x2a3eac]));logger[_0xc4e7('0xb')](_0xc4e7('0x48'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}else if(_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]&&_0x52c1b6[_0x2a3eac][_0xc4e7('0x4a')]&&moment()[_0xc4e7('0x4b')](_0x52c1b6[_0x2a3eac][_0xc4e7('0x4c')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x4d')])){manager['add'](_0x2a3eac,_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')],handleJob(_0x52c1b6[_0x2a3eac]));manager[_0xc4e7('0x4e')](_0x2a3eac);logger[_0xc4e7('0xb')](_0xc4e7('0x4f'),_0x52c1b6[_0x2a3eac]['name'],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}else if(manager[_0xc4e7('0x40')](_0x2a3eac)){manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger[_0xc4e7('0xb')]('stop\x20cron',_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}}for(_0xc46ed2=0x0,_0x2a3eac;_0xc46ed2<_0x54315d[_0xc4e7('0x45')]&&!_0x53d84;_0xc46ed2+=0x1){_0x2a3eac=_0x54315d[_0xc46ed2][_0xc4e7('0x3f')]();if(manager['exists'](_0x2a3eac)){if(_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]&&_0x52c1b6[_0x2a3eac]['active']&&moment()['isBetween'](_0x52c1b6[_0x2a3eac][_0xc4e7('0x4c')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x4d')])){manager[_0xc4e7('0x50')](_0x2a3eac,_0x52c1b6[_0x2a3eac]['cron'],handleJob(_0x52c1b6[_0x2a3eac]));logger[_0xc4e7('0xb')](_0xc4e7('0x51'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac]['cron']);}else{manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger[_0xc4e7('0xb')](_0xc4e7('0x52'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}}}})[_0xc4e7('0x2a')](function(_0x54cedd){logger[_0xc4e7('0x28')](JSON['stringify'](_0x54cedd));});}exports[_0xc4e7('0x53')]=function(_0x17151b){return getJobs(_0x17151b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x5687=['keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','my\x20id','resolve','cron','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','active','update','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','MailAccount','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString'];(function(_0x1e4b61,_0x3afe6b){var _0x14490e=function(_0x4fd428){while(--_0x4fd428){_0x1e4b61['push'](_0x1e4b61['shift']());}};_0x14490e(++_0x3afe6b);}(_0x5687,0x1de));var _0x7568=function(_0x5bbb66,_0x3fe14e){_0x5bbb66=_0x5bbb66-0x0;var _0x3baea2=_0x5687[_0x5bbb66];return _0x3baea2;};'use strict';var fs=require('fs');var util=require(_0x7568('0x0'));var path=require(_0x7568('0x1'));var _=require('lodash');var moment=require(_0x7568('0x2'));var CronJobManager=require(_0x7568('0x3'));var jayson=require(_0x7568('0x4'));var BPromise=require(_0x7568('0x5'));var logger=require(_0x7568('0x6'))(_0x7568('0x7'));var db=require(_0x7568('0x8'))['db'];var analyticCustomReportController=require(_0x7568('0x9'));var analyticDefaultReportController=require(_0x7568('0xa'));var client=jayson[_0x7568('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28a6c6,_0x249178){return function(){logger[_0x7568('0xc')](_0x7568('0xd'),_0x28a6c6[_0x7568('0xe')]);var _0x315737=!![];var _0x43c88c=_0x28a6c6['MailAccount'][_0x7568('0xf')]();var _0x2d3f65={'account':_0x43c88c,'message':{'from':util[_0x7568('0x10')](_0x7568('0x11'),_0x28a6c6['MailAccount'][_0x7568('0x12')],_0x28a6c6['MailAccount'][_0x7568('0xe')]||_0x28a6c6[_0x7568('0x13')]['Smtp'][_0x7568('0x14')]),'to':_0x28a6c6[_0x7568('0xe')],'cc':_0x28a6c6['cc'],'bcc':_0x28a6c6[_0x7568('0x15')],'subject':util[_0x7568('0x10')](_0x7568('0x16'),_0x249178[_0x7568('0x12')],_0x28a6c6[_0x7568('0x17')],_0x28a6c6[_0x7568('0x18')])}};var _0x1aa73b=path[_0x7568('0x19')](__dirname,_0x7568('0x1a'));var _0xce4903=_0x249178[_0x7568('0x1b')];var _0x28bcc3=util['format']('%s.%s',path[_0x7568('0x1c')](_0x249178['savename'],path[_0x7568('0x1d')](_0x249178[_0x7568('0x1b')])),_0x7568('0x1e'));var _0x4ab469=path[_0x7568('0x19')](_0x1aa73b,_0xce4903);var _0x129f17=path[_0x7568('0x19')](_0x1aa73b,_0x28bcc3);if(fs[_0x7568('0x1f')](_0x4ab469)){_0x249178['status']=_0x7568('0x20');_0x2d3f65['message'][_0x7568('0x21')]=[{'filename':_0xce4903,'path':_0x4ab469}];_0x2d3f65[_0x7568('0x22')][_0x7568('0x23')]=util[_0x7568('0x10')](_0x7568('0x24'),JSON[_0x7568('0x25')](_0x249178,null,0x2));}else if(fs['existsSync'](_0x129f17)){_0x249178['status']='Sent';_0x2d3f65['message']['attachments']=[{'filename':_0x28bcc3,'path':_0x129f17}];}else{_0x2d3f65[_0x7568('0x22')][_0x7568('0x23')]=_0x7568('0x26');if(!_0x28a6c6[_0x7568('0x27')]){_0x315737=![];logger[_0x7568('0xc')](_0x7568('0x28'));}}if(_0x315737){return client['request'](_0x7568('0x29'),_0x2d3f65)[_0x7568('0x2a')](function(_0x23b0ce){if(_0x23b0ce[_0x7568('0x2b')]){return logger['error'](_0x7568('0x2c'),JSON[_0x7568('0x25')](_0x23b0ce));}return logger[_0x7568('0xc')](_0x7568('0x2d'));})[_0x7568('0x2e')](function(_0x506a19){return logger[_0x7568('0x2b')](_0x7568('0x2c'),JSON['stringify'](_0x506a19));});}};}function handleError(){return function(_0x40b47a){return logger[_0x7568('0x2b')](JSON['stringify'](_0x40b47a));};}function handleResult(_0x26491c){return function(_0x1152f1){logger[_0x7568('0xc')](_0x7568('0x2f'),JSON[_0x7568('0x25')](_0x1152f1));if(_0x26491c[_0x7568('0x13')]&&_0x26491c['MailAccount'][_0x7568('0x30')]&&!_[_0x7568('0x31')](_0x26491c[_0x7568('0xe')])){setTimeout(handleSendEmail(_0x26491c,_0x1152f1),0x3c*0x3e8);}};}function handleJob(_0x47ffe9){return function(){try{if(_[_0x7568('0x31')](_0x47ffe9[_0x7568('0x17')])){return logger[_0x7568('0xc')](_0x7568('0x32'));}if(_[_0x7568('0x31')](_0x47ffe9['subtractUnit'])){return logger[_0x7568('0xc')](_0x7568('0x33'));}var _0x3f847a={'startDate':moment()[_0x7568('0x34')](_0x47ffe9['subtractNumber'],_0x47ffe9[_0x7568('0x18')])[_0x7568('0x10')](_0x7568('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x7568('0x36'),'output':_0x47ffe9[_0x7568('0x37')],'name':_0x47ffe9[_0x7568('0x12')]};if(!_['isNil'](_0x47ffe9[_0x7568('0x38')])){logger[_0x7568('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x47ffe9[_0x7568('0x38')]);return analyticDefaultReportController['runReport']({'id':_0x47ffe9[_0x7568('0x38')]},_0x3f847a)[_0x7568('0x2a')](handleResult(_0x47ffe9))[_0x7568('0x2e')](handleError());}if(!_[_0x7568('0x31')](_0x47ffe9[_0x7568('0x39')])){logger[_0x7568('0xc')](_0x7568('0x3a'),_0x47ffe9['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x47ffe9[_0x7568('0x39')]},_0x3f847a)[_0x7568('0x2a')](handleResult(_0x47ffe9))[_0x7568('0x2e')](handleError());}}catch(_0x1dadaa){logger[_0x7568('0x2b')](JSON['stringify'](_0x1dadaa));}return logger['info'](_0x7568('0x3b'));};}function getJobs(_0x1ddae7){var _0x2862f0={};if(_0x1ddae7){_0x2862f0['id']=_0x1ddae7;}return db[_0x7568('0x3c')][_0x7568('0x3d')]({'where':_0x2862f0,'include':[{'model':db[_0x7568('0x13')],'attributes':['id',_0x7568('0x12'),_0x7568('0xe')],'include':[{'model':db[_0x7568('0x3e')],'as':_0x7568('0x30'),'include':[{'model':db[_0x7568('0x3f')],'as':_0x7568('0x3f')}]}]}]})[_0x7568('0x2a')](function(_0x13f8d9){var _0x115ee7=_[_0x7568('0x40')](manager[_0x7568('0x41')]);var _0x378336=_[_0x7568('0x42')](_0x13f8d9,function(_0x23d447){return _0x23d447['id'][_0x7568('0x43')]();});var _0x433533=_[_0x7568('0x44')](_0x13f8d9,function(_0x13966e){return _0x13966e['id'][_0x7568('0x43')]();});var _0x578ee2=_0x1ddae7?_0x378336:_[_0x7568('0x45')](_0x378336,_0x115ee7);var _0x4578ab=_[_0x7568('0x46')](_0x378336,_0x115ee7);var _0x5dbc53=_[_0x7568('0x45')](_0x115ee7,_0x378336);var _0x2fb244;var _0x5cbafc;for(_0x2fb244=0x0;_0x2fb244<_0x5dbc53[_0x7568('0x47')]&&!_0x1ddae7;_0x2fb244+=0x1){_0x5cbafc=_0x5dbc53[_0x2fb244][_0x7568('0x43')]();if(manager[_0x7568('0x48')](_0x5cbafc)){manager[_0x7568('0x49')](_0x5cbafc);manager['deleteJob'](_0x5cbafc);logger[_0x7568('0xc')](_0x7568('0x4a'),_0x5cbafc);}}logger[_0x7568('0xc')](_0x7568('0x4b'),JSON[_0x7568('0x25')](_0x578ee2));for(_0x2fb244=0x0;_0x2fb244<_0x578ee2[_0x7568('0x47')];_0x2fb244+=0x1){_0x5cbafc=_0x578ee2[_0x2fb244][_0x7568('0x43')]();logger['info']('index',_0x5cbafc);if(_0x1ddae7){logger[_0x7568('0xc')](_0x7568('0x4c'),_0x1ddae7);logger[_0x7568('0xc')](JSON[_0x7568('0x25')](_0x433533[_0x5cbafc]));BPromise[_0x7568('0x4d')]()[_0x7568('0x2a')](handleJob(_0x433533[_0x5cbafc]));logger[_0x7568('0xc')]('run\x20job',_0x433533[_0x5cbafc]['name'],_0x433533[_0x5cbafc]['cron']);}else if(_0x433533[_0x5cbafc][_0x7568('0x4e')]&&_0x433533[_0x5cbafc]['active']&&moment()[_0x7568('0x4f')](_0x433533[_0x5cbafc][_0x7568('0x50')],_0x433533[_0x5cbafc][_0x7568('0x51')])){manager[_0x7568('0x52')](_0x5cbafc,_0x433533[_0x5cbafc][_0x7568('0x4e')],handleJob(_0x433533[_0x5cbafc]));manager[_0x7568('0x53')](_0x5cbafc);logger['info'](_0x7568('0x54'),_0x433533[_0x5cbafc][_0x7568('0x12')],_0x433533[_0x5cbafc][_0x7568('0x4e')]);}else if(manager[_0x7568('0x48')](_0x5cbafc)){manager[_0x7568('0x49')](_0x5cbafc);manager[_0x7568('0x55')](_0x5cbafc);logger[_0x7568('0xc')](_0x7568('0x56'),_0x433533[_0x5cbafc][_0x7568('0x12')],_0x433533[_0x5cbafc][_0x7568('0x4e')]);}}for(_0x2fb244=0x0,_0x5cbafc;_0x2fb244<_0x4578ab[_0x7568('0x47')]&&!_0x1ddae7;_0x2fb244+=0x1){_0x5cbafc=_0x4578ab[_0x2fb244]['toString']();if(manager[_0x7568('0x48')](_0x5cbafc)){if(_0x433533[_0x5cbafc][_0x7568('0x4e')]&&_0x433533[_0x5cbafc][_0x7568('0x57')]&&moment()['isBetween'](_0x433533[_0x5cbafc][_0x7568('0x50')],_0x433533[_0x5cbafc][_0x7568('0x51')])){manager[_0x7568('0x58')](_0x5cbafc,_0x433533[_0x5cbafc][_0x7568('0x4e')],handleJob(_0x433533[_0x5cbafc]));logger['info'](_0x7568('0x59'),_0x433533[_0x5cbafc][_0x7568('0x12')],_0x433533[_0x5cbafc]['cron']);}else{manager[_0x7568('0x49')](_0x5cbafc);manager['deleteJob'](_0x5cbafc);logger[_0x7568('0xc')]('stop\x20cron',_0x433533[_0x5cbafc]['name'],_0x433533[_0x5cbafc][_0x7568('0x4e')]);}}}})[_0x7568('0x2e')](function(_0xcf3957){logger['error'](JSON[_0x7568('0x25')](_0xcf3957));});}exports[_0x7568('0x5a')]=function(_0x1e49eb){return getJobs(_0x1e49eb);};exports[_0x7568('0x53')]=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 a373d75..31e89d3 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 _0xb4f4=['aws-sdk','util','bluebird','../../mysqldb','../../config/logger','Comprehend','detectSentiment','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xb4f4,0xda));var _0x4b4f=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xb4f4[_0x172747];return _0x509692;};var _=require(_0x4b4f('0x0'));var AWS=require(_0x4b4f('0x1'));var rp=require('request-promise');var util=require(_0x4b4f('0x2'));var BPromise=require(_0x4b4f('0x3'));var db=require(_0x4b4f('0x4'))['db'];var logger=require(_0x4b4f('0x5'))('transcribe');function getTranscriptionJob(_0x2c27ce,_0x40e54b,_0x2de488,_0x183a72){return new Promise(function(_0x1faad4,_0x15e02e){var _0x405321=new AWS['TranscribeService']({'accessKeyId':_0x40e54b,'secretAccessKey':_0x2c27ce,'region':_0x2de488});_0x405321['getTranscriptionJob']({'TranscriptionJobName':_0x183a72},function(_0x108b4e,_0x2c647f){if(_0x108b4e){return _0x15e02e(_0x108b4e);}else{return _0x1faad4(_0x2c647f);}});});}function sentiment(_0x2e744d,_0x2a520b,_0x25e0c9,_0x4d8765,_0x155d17){return new Promise(function(_0x7cd37a,_0x39664b){var _0x5f0f0b=new AWS[(_0x4b4f('0x6'))]({'accessKeyId':_0x2a520b,'secretAccessKey':_0x2e744d,'region':_0x25e0c9});_0x5f0f0b[_0x4b4f('0x7')]({'Text':_0x4d8765,'LanguageCode':_0x155d17['substring'](0x0,0x2)},function(_0x44e469,_0x387a6b){if(_0x44e469){return _0x39664b(_0x44e469);}else{return _0x7cd37a(_0x387a6b);}});});}function checkTranscribeJob(_0xb62931,_0x154b05,_0x42973f){var _0x3ca456;return new BPromise(function(_0x1b7138,_0x13f3a1){logger['info'](util['format'](_0x4b4f('0x8'),_0xb62931['id'],_0xb62931[_0x4b4f('0x9')]));return getTranscriptionJob(_0x42973f['data1'],_0x42973f[_0x4b4f('0xa')],_0x154b05[_0x4b4f('0xb')],_0xb62931[_0x4b4f('0x9')])['then'](function(_0x1c74d4){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xb62931['id'],_0xb62931[_0x4b4f('0x9')],_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0xf')]));if(!_0xb62931[_0x4b4f('0x10')]){switch(_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0xf')]){case _0x4b4f('0x11'):var _0xcb27ba={'transcribeStatus':_0x1c74d4[_0x4b4f('0xe')]['TranscriptionJobStatus'],'fileUri':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x12')][_0x4b4f('0x13')]};logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x14'),_0xb62931['id']));return rp({'uri':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x12')][_0x4b4f('0x13')],'json':!![]})[_0x4b4f('0x15')](function(_0x445605){logger['info'](util[_0x4b4f('0xd')](_0x4b4f('0x16'),_0xb62931['id']));if(_0x445605&&_0x445605[_0x4b4f('0x17')]&&_0x445605['results'][_0x4b4f('0x18')]&&_0x445605['results'][_0x4b4f('0x18')]['length']){_0xcb27ba[_0x4b4f('0x10')]='';for(var _0x5da930=0x0;_0x5da930<_0x445605[_0x4b4f('0x17')][_0x4b4f('0x18')]['length'];_0x5da930++){_0xcb27ba[_0x4b4f('0x10')]+=_0x445605[_0x4b4f('0x17')][_0x4b4f('0x18')][_0x5da930][_0x4b4f('0x19')]+'';}}return _0xb62931[_0x4b4f('0x1a')](_0xcb27ba);})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xb62931['id']));if(!_0xb62931['tempSentiment']){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x1d'));}if(!_0x154b05[_0x4b4f('0x1e')]||!_0x154b05[_0x4b4f('0x1f')]||!_0x154b05[_0x4b4f('0x20')]||!_0x154b05[_0x4b4f('0x21')]||!_0x154b05[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x23'));}if(!_0xcb27ba['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x154b05[_0x4b4f('0x1f')]===_0x42973f['id']){return _0x42973f;}else{return db[_0x4b4f('0x24')][_0x4b4f('0x25')]({'where':{'id':_settings[_0x4b4f('0x1f')]}});}})[_0x4b4f('0x15')](function(_0x3ce343){if(!_0x3ce343){throw new db['Sequelize'][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x3ce343[_0x4b4f('0x27')]||!_0x3ce343['data2']){throw new db[(_0x4b4f('0x1b'))]['ValidationError'](_0x4b4f('0x28'));}_0x3ca456=_0x3ce343;logger['info'](util[_0x4b4f('0xd')](_0x4b4f('0x29'),_0xb62931['id']));return sentiment(_0x3ca456[_0x4b4f('0x27')],_0x3ca456['data2'],_0x154b05[_0x4b4f('0x20')],_0xcb27ba[_0x4b4f('0x10')],_0x154b05[_0x4b4f('0x21')]);})[_0x4b4f('0x15')](function(_0x2f1e16){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x2a'),_0xb62931['id']));return _0xb62931[_0x4b4f('0x1a')]({'sentiment':_0x2f1e16[_0x4b4f('0x2b')],'sPositive':_0x2f1e16[_0x4b4f('0x2c')][_0x4b4f('0x2d')],'sNegative':_0x2f1e16[_0x4b4f('0x2c')][_0x4b4f('0x2e')],'sMixed':_0x2f1e16['SentimentScore'][_0x4b4f('0x2f')],'sNeutral':_0x2f1e16[_0x4b4f('0x2c')]['Neutral']});})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util['format'](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});case _0x4b4f('0x31'):return _0xb62931[_0x4b4f('0x1a')]({'transcribeStatus':_0x4b4f('0x31'),'failureReason':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x32')]})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util['format'](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});default:logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x33'),_0xb62931['id']));break;}}else{return BPromise[_0x4b4f('0x34')]()[_0x4b4f('0x15')](function(){if(!_0xb62931[_0x4b4f('0x35')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x1d'));}if(!_0x154b05[_0x4b4f('0x1e')]||!_0x154b05[_0x4b4f('0x1f')]||!_0x154b05[_0x4b4f('0x20')]||!_0x154b05[_0x4b4f('0x21')]||!_0x154b05[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x23'));}if(!_0xb62931[_0x4b4f('0x10')]){throw new Error(_0x4b4f('0x36'));}if(_0x154b05[_0x4b4f('0x1f')]===_0x42973f['id']){return _0x42973f;}else{return db[_0x4b4f('0x24')][_0x4b4f('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4b4f('0x15')](function(_0x4e64e3){if(!_0x4e64e3){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x4e64e3[_0x4b4f('0x27')]||!_0x4e64e3[_0x4b4f('0xa')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x3ca456=_0x4e64e3;logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xb62931['id']));return sentiment(_0x3ca456[_0x4b4f('0x27')],_0x3ca456[_0x4b4f('0xa')],_0x154b05[_0x4b4f('0x20')],_0xb62931['fileText'],_0x154b05[_0x4b4f('0x21')]);})[_0x4b4f('0x15')](function(_0x5243c0){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x2a'),_0xb62931['id']));return _0xb62931[_0x4b4f('0x1a')]({'sentiment':_0x5243c0[_0x4b4f('0x2b')],'sPositive':_0x5243c0['SentimentScore'][_0x4b4f('0x2d')],'sNegative':_0x5243c0['SentimentScore'][_0x4b4f('0x2e')],'sMixed':_0x5243c0[_0x4b4f('0x2c')]['Mixed'],'sNeutral':_0x5243c0[_0x4b4f('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});}})[_0x4b4f('0x37')](function(_0x7d55f6){if(_0x7d55f6){if(!_0x7d55f6[_0x4b4f('0x38')]||_0x7d55f6[_0x4b4f('0x38')]!==_0x4b4f('0x39')){logger[_0x4b4f('0x3a')](util['format'](_0x4b4f('0x3b'),_0xb62931['id']),util[_0x4b4f('0x3c')](_0x7d55f6,{'showHidden':![],'depth':null}));}}_0x1b7138();});});}function checkTranscribe(){var _0x29e829;var _0x1255a6;var _0xe6decf;return db['VoiceRecording'][_0x4b4f('0x3d')]({'where':{'transcribeStatus':_0x4b4f('0x3e')}})[_0x4b4f('0x15')](function(_0x361088){if(!_0x361088||!_0x361088[_0x4b4f('0x3f')]){throw new db['Sequelize']['ValidationError'](_0x4b4f('0x40'));}_0x29e829=_0x361088;return db[_0x4b4f('0x41')][_0x4b4f('0x25')]({'where':{'id':0x1}});})[_0x4b4f('0x15')](function(_0x2917d7){if(!_0x2917d7){throw new db['Sequelize'][(_0x4b4f('0x1c'))](_0x4b4f('0x42'));}_0x1255a6=_0x2917d7;if(!_0x1255a6[_0x4b4f('0x43')]||!_0x1255a6[_0x4b4f('0x44')]||!_0x1255a6['transcribeRegion']||!_0x1255a6[_0x4b4f('0x21')]||!_0x1255a6[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x45'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1255a6[_0x4b4f('0x44')]}});})[_0x4b4f('0x15')](function(_0x4a5ae6){if(!_0x4a5ae6){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x4a5ae6[_0x4b4f('0x27')]||!_0x4a5ae6[_0x4b4f('0xa')]){throw new db['Sequelize'][(_0x4b4f('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0xe6decf=_0x4a5ae6;var _0x662fa1=[];_0x29e829[_0x4b4f('0x46')](function(_0x15ce66){_0x662fa1[_0x4b4f('0x47')](checkTranscribeJob(_0x15ce66,_0x1255a6,_0xe6decf));});return BPromise['all'](_0x662fa1);})[_0x4b4f('0x37')](function(_0x47e15d){if(_0x47e15d){if(!_0x47e15d[_0x4b4f('0x38')]||_0x47e15d[_0x4b4f('0x38')]!==_0x4b4f('0x39')){logger[_0x4b4f('0x3a')](util[_0x4b4f('0x3c')](_0x47e15d,{'showHidden':![],'depth':null}));}}});}exports[_0x4b4f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x235a=['then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','Mixed','Neutral','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured','push','error','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion'];(function(_0x2202fa,_0x79a46d){var _0x108bed=function(_0x11f5c7){while(--_0x11f5c7){_0x2202fa['push'](_0x2202fa['shift']());}};_0x108bed(++_0x79a46d);}(_0x235a,0x1ef));var _0xa235=function(_0x5bb106,_0x1f8961){_0x5bb106=_0x5bb106-0x0;var _0xbd1b71=_0x235a[_0x5bb106];return _0xbd1b71;};var _=require(_0xa235('0x0'));var AWS=require(_0xa235('0x1'));var rp=require(_0xa235('0x2'));var util=require('util');var BPromise=require(_0xa235('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa235('0x4'))(_0xa235('0x5'));function getTranscriptionJob(_0x277a68,_0x314ebf,_0x2e6eca,_0x5e94b0){return new Promise(function(_0x2961c8,_0x1707fc){var _0x4b849b=new AWS[(_0xa235('0x6'))]({'accessKeyId':_0x314ebf,'secretAccessKey':_0x277a68,'region':_0x2e6eca});_0x4b849b[_0xa235('0x7')]({'TranscriptionJobName':_0x5e94b0},function(_0x450e27,_0x2f3403){if(_0x450e27){return _0x1707fc(_0x450e27);}else{return _0x2961c8(_0x2f3403);}});});}function sentiment(_0x5c60d9,_0x2f73d3,_0x561602,_0x560eb1,_0x10bb4f){return new Promise(function(_0x504b60,_0xbde1c7){var _0x535bb9=new AWS['Comprehend']({'accessKeyId':_0x2f73d3,'secretAccessKey':_0x5c60d9,'region':_0x561602});_0x535bb9['detectSentiment']({'Text':_0x560eb1,'LanguageCode':_0x10bb4f[_0xa235('0x8')](0x0,0x2)},function(_0x3026d1,_0x3e620c){if(_0x3026d1){return _0xbde1c7(_0x3026d1);}else{return _0x504b60(_0x3e620c);}});});}function checkTranscribeJob(_0x1fe5cf,_0x5330db,_0x5510ff){var _0x47aad7;return new BPromise(function(_0x3187e4,_0x1080d7){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0xb'),_0x1fe5cf['id'],_0x1fe5cf[_0xa235('0xc')]));return getTranscriptionJob(_0x5510ff[_0xa235('0xd')],_0x5510ff[_0xa235('0xe')],_0x5330db[_0xa235('0xf')],_0x1fe5cf['transcribeName'])[_0xa235('0x10')](function(_0x20cd67){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x11'),_0x1fe5cf['id'],_0x1fe5cf[_0xa235('0xc')],_0x20cd67['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1fe5cf[_0xa235('0x12')]){switch(_0x20cd67[_0xa235('0x13')][_0xa235('0x14')]){case'COMPLETED':var _0x40b4a9={'transcribeStatus':_0x20cd67[_0xa235('0x13')][_0xa235('0x14')],'fileUri':_0x20cd67[_0xa235('0x13')][_0xa235('0x15')][_0xa235('0x16')]};logger[_0xa235('0x9')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x1fe5cf['id']));return rp({'uri':_0x20cd67[_0xa235('0x13')][_0xa235('0x15')][_0xa235('0x16')],'json':!![]})[_0xa235('0x10')](function(_0x2e38e){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x17'),_0x1fe5cf['id']));if(_0x2e38e&&_0x2e38e[_0xa235('0x18')]&&_0x2e38e[_0xa235('0x18')][_0xa235('0x19')]&&_0x2e38e[_0xa235('0x18')][_0xa235('0x19')][_0xa235('0x1a')]){_0x40b4a9[_0xa235('0x12')]='';for(var _0x3364ee=0x0;_0x3364ee<_0x2e38e[_0xa235('0x18')][_0xa235('0x19')][_0xa235('0x1a')];_0x3364ee++){_0x40b4a9[_0xa235('0x12')]+=_0x2e38e[_0xa235('0x18')]['transcripts'][_0x3364ee][_0xa235('0x1b')]+'';}}return _0x1fe5cf['update'](_0x40b4a9);})[_0xa235('0x10')](function(){logger['info'](util[_0xa235('0xa')](_0xa235('0x1c'),_0x1fe5cf['id']));if(!_0x1fe5cf[_0xa235('0x1d')]){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5330db[_0xa235('0x20')]||!_0x5330db[_0xa235('0x21')]||!_0x5330db['sentimentRegion']||!_0x5330db['language']||!_0x5330db['bucket']){throw new db['Sequelize'][(_0xa235('0x1f'))](_0xa235('0x22'));}if(!_0x40b4a9[_0xa235('0x12')]){throw new Error(_0xa235('0x23'));}if(_0x5330db[_0xa235('0x21')]===_0x5510ff['id']){return _0x5510ff;}else{return db[_0xa235('0x24')][_0xa235('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2832be){if(!_0x2832be){throw new db[(_0xa235('0x1e'))]['ValidationError'](_0xa235('0x26'));}if(!_0x2832be[_0xa235('0xd')]||!_0x2832be[_0xa235('0xe')]){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))](_0xa235('0x27'));}_0x47aad7=_0x2832be;logger[_0xa235('0x9')](util[_0xa235('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1fe5cf['id']));return sentiment(_0x47aad7[_0xa235('0xd')],_0x47aad7['data2'],_0x5330db[_0xa235('0x28')],_0x40b4a9[_0xa235('0x12')],_0x5330db[_0xa235('0x29')]);})[_0xa235('0x10')](function(_0x453571){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x2a'),_0x1fe5cf['id']));return _0x1fe5cf[_0xa235('0x2b')]({'sentiment':_0x453571[_0xa235('0x2c')],'sPositive':_0x453571[_0xa235('0x2d')][_0xa235('0x2e')],'sNegative':_0x453571[_0xa235('0x2d')]['Negative'],'sMixed':_0x453571['SentimentScore']['Mixed'],'sNeutral':_0x453571[_0xa235('0x2d')]['Neutral']});})[_0xa235('0x10')](function(){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x1c'),_0x1fe5cf['id']));_0x3187e4();});case _0xa235('0x2f'):return _0x1fe5cf[_0xa235('0x2b')]({'transcribeStatus':_0xa235('0x2f'),'failureReason':_0x20cd67['TranscriptionJob'][_0xa235('0x30')]})[_0xa235('0x10')](function(){logger['info'](util[_0xa235('0xa')](_0xa235('0x1c'),_0x1fe5cf['id']));_0x3187e4();});default:logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x31'),_0x1fe5cf['id']));break;}}else{return BPromise[_0xa235('0x32')]()[_0xa235('0x10')](function(){if(!_0x1fe5cf[_0xa235('0x1d')]){throw new db[(_0xa235('0x1e'))]['ValidationError'](_0xa235('0x33'));}if(!_0x5330db[_0xa235('0x20')]||!_0x5330db[_0xa235('0x21')]||!_0x5330db[_0xa235('0x28')]||!_0x5330db[_0xa235('0x29')]||!_0x5330db['bucket']){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))](_0xa235('0x22'));}if(!_0x1fe5cf[_0xa235('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x5330db[_0xa235('0x21')]===_0x5510ff['id']){return _0x5510ff;}else{return db[_0xa235('0x24')][_0xa235('0x25')]({'where':{'id':_settings[_0xa235('0x21')]}});}})[_0xa235('0x10')](function(_0x22caf6){if(!_0x22caf6){throw new db[(_0xa235('0x1e'))]['ValidationError'](_0xa235('0x26'));}if(!_0x22caf6[_0xa235('0xd')]||!_0x22caf6[_0xa235('0xe')]){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x47aad7=_0x22caf6;logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x34'),_0x1fe5cf['id']));return sentiment(_0x47aad7[_0xa235('0xd')],_0x47aad7[_0xa235('0xe')],_0x5330db['sentimentRegion'],_0x1fe5cf[_0xa235('0x12')],_0x5330db[_0xa235('0x29')]);})[_0xa235('0x10')](function(_0x59de31){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x2a'),_0x1fe5cf['id']));return _0x1fe5cf[_0xa235('0x2b')]({'sentiment':_0x59de31['Sentiment'],'sPositive':_0x59de31[_0xa235('0x2d')][_0xa235('0x2e')],'sNegative':_0x59de31[_0xa235('0x2d')][_0xa235('0x35')],'sMixed':_0x59de31[_0xa235('0x2d')][_0xa235('0x36')],'sNeutral':_0x59de31[_0xa235('0x2d')][_0xa235('0x37')],'transcribeStatus':_0xa235('0x38')});})['then'](function(){logger[_0xa235('0x9')](util[_0xa235('0xa')](_0xa235('0x1c'),_0x1fe5cf['id']));_0x3187e4();});}})[_0xa235('0x39')](function(_0x38d6ec){if(_0x38d6ec){if(!_0x38d6ec['name']||_0x38d6ec[_0xa235('0x3a')]!==_0xa235('0x3b')){logger['error'](util[_0xa235('0xa')](_0xa235('0x3c'),_0x1fe5cf['id']),util[_0xa235('0x3d')](_0x38d6ec,{'showHidden':![],'depth':null}));}}_0x3187e4();});});}function checkTranscribe(){var _0x2e7562;var _0x5c735d;var _0x16d9e8;return db['VoiceRecording'][_0xa235('0x3e')]({'where':{'transcribeStatus':_0xa235('0x3f')}})['then'](function(_0x308dc1){if(!_0x308dc1||!_0x308dc1[_0xa235('0x1a')]){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))](_0xa235('0x40'));}_0x2e7562=_0x308dc1;return db[_0xa235('0x41')][_0xa235('0x25')]({'where':{'id':0x1}});})[_0xa235('0x10')](function(_0x5ab614){if(!_0x5ab614){throw new db['Sequelize']['ValidationError'](_0xa235('0x42'));}_0x5c735d=_0x5ab614;if(!_0x5c735d[_0xa235('0x5')]||!_0x5c735d[_0xa235('0x43')]||!_0x5c735d[_0xa235('0xf')]||!_0x5c735d['language']||!_0x5c735d[_0xa235('0x44')]){throw new db['Sequelize'][(_0xa235('0x1f'))](_0xa235('0x45'));}return db[_0xa235('0x24')][_0xa235('0x25')]({'where':{'id':_0x5c735d['transcribeAccountId']}});})[_0xa235('0x10')](function(_0x51144e){if(!_0x51144e){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x51144e[_0xa235('0xd')]||!_0x51144e[_0xa235('0xe')]){throw new db[(_0xa235('0x1e'))][(_0xa235('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x16d9e8=_0x51144e;var _0x550f21=[];_0x2e7562['forEach'](function(_0x386ba7){_0x550f21[_0xa235('0x46')](checkTranscribeJob(_0x386ba7,_0x5c735d,_0x16d9e8));});return BPromise['all'](_0x550f21);})['catch'](function(_0x9ce653){if(_0x9ce653){if(!_0x9ce653['name']||_0x9ce653['name']!==_0xa235('0x3b')){logger[_0xa235('0x47')](util[_0xa235('0x3d')](_0x9ce653,{'showHidden':![],'depth':null}));}}});}exports[_0xa235('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 175d791..c97f314 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 _0x55f6=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','schedule','redis','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','join'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55f6,0xc2));var _0x655f=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0x55f6[_0x20e283];return _0x199e10;};'use strict';var _=require(_0x655f('0x0'));var moment=require(_0x655f('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x655f('0x2'));var db=require(_0x655f('0x3'))['db'];var logger=require('../logger')(_0x655f('0x4'));config[_0x655f('0x5')]=_['defaults'](config[_0x655f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x655f('0x6'))(new Redis(config[_0x655f('0x5')]));function closeInteractions(){var _0x71f9c1=[];return db[_0x655f('0x7')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x655f('0x8')](0x18,_0x655f('0x9'))}}})[_0x655f('0xa')](function(_0x4dca43){if(_0x4dca43&&_0x4dca43[_0x655f('0xb')]){_0x71f9c1=_[_0x655f('0xc')](_0x4dca43||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x71f9c1[_0x655f('0xd')]());return db[_0x655f('0x7')]['update']({'closeReason':_0x655f('0xe'),'disposition':_0x655f('0xf'),'closed':!![],'closedAt':moment()[_0x655f('0x10')](_0x655f('0x11'))},{'where':{'id':_0x71f9c1}});}})['then'](function(){if(_0x71f9c1&&_0x71f9c1['length']){logger[_0x655f('0x12')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x71f9c1[_0x655f('0xd')]());for(var _0x284468=0x0;_0x284468<_0x71f9c1[_0x655f('0xb')];_0x284468++){io[_0x655f('0x13')](_0x655f('0x14'),{'id':_0x71f9c1[_0x284468],'closed':!![]});}}})[_0x655f('0x15')](function(_0x2391ac){logger[_0x655f('0x16')](_0x655f('0x17'),_0x2391ac?util[_0x655f('0x18')](_0x2391ac,{'showHidden':![],'depth':null}):'');});}exports[_0x655f('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x10ee=['moment','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','inspect','start','lodash'];(function(_0xad42a6,_0xc47139){var _0x44714b=function(_0x4d83c9){while(--_0x4d83c9){_0xad42a6['push'](_0xad42a6['shift']());}};_0x44714b(++_0xc47139);}(_0x10ee,0x9b));var _0xe10e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x10ee[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xe10e('0x0'));var moment=require(_0xe10e('0x1'));var Redis=require('ioredis');var util=require(_0xe10e('0x2'));var config=require('../../config/environment');var db=require(_0xe10e('0x3'))['db'];var logger=require(_0xe10e('0x4'))(_0xe10e('0x5'));config[_0xe10e('0x6')]=_['defaults'](config[_0xe10e('0x6')],{'host':_0xe10e('0x7'),'port':0x18eb});var io=require(_0xe10e('0x8'))(new Redis(config[_0xe10e('0x6')]));function closeInteractions(){var _0x30fd80=[];return db[_0xe10e('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe10e('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe10e('0xb'))}}})[_0xe10e('0xc')](function(_0x5acc91){if(_0x5acc91&&_0x5acc91[_0xe10e('0xd')]){_0x30fd80=_[_0xe10e('0xe')](_0x5acc91||[],'id');logger[_0xe10e('0xf')](_0xe10e('0x10'),_0x30fd80[_0xe10e('0x11')]());return db[_0xe10e('0x9')][_0xe10e('0x12')]({'closeReason':'system','disposition':_0xe10e('0x13'),'closed':!![],'closedAt':moment()['format'](_0xe10e('0x14'))},{'where':{'id':_0x30fd80}});}})[_0xe10e('0xc')](function(){if(_0x30fd80&&_0x30fd80[_0xe10e('0xd')]){logger[_0xe10e('0xf')](_0xe10e('0x15'),_0x30fd80[_0xe10e('0x11')]());for(var _0x5ec88c=0x0;_0x5ec88c<_0x30fd80[_0xe10e('0xd')];_0x5ec88c++){io[_0xe10e('0x16')]('whatsappInteraction:update',{'id':_0x30fd80[_0x5ec88c],'closed':!![]});}}})[_0xe10e('0x17')](function(_0xad2f2a){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xad2f2a?util[_0xe10e('0x18')](_0xad2f2a,{'showHidden':![],'depth':null}):'');});}exports[_0xe10e('0x19')]=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 00b2350..deb8b9a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0d0=['catch','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','push','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2'];(function(_0x26be65,_0x513b6a){var _0x35b5d8=function(_0x1be774){while(--_0x1be774){_0x26be65['push'](_0x26be65['shift']());}};_0x35b5d8(++_0x513b6a);}(_0xa0d0,0x79));var _0x0a0d=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa0d0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a0d('0x0'));var db=require(_0x0a0d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x0a0d('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a0d('0x3')+i+_0x0a0d('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x0a0d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a0d('0x5')](),'updatedAt':Date[_0x0a0d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x0a0d('0x6')+i,'lastName':_0x0a0d('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a0d('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0a0d('0x7')]({'id':i,'active':![],'scheduledat':Date[_0x0a0d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a0d('0x5')](),'updatedAt':Date['now']()});}db[_0x0a0d('0x8')][_0x0a0d('0x9')]({'where':{}})[_0x0a0d('0xa')](function(){return db[_0x0a0d('0x8')][_0x0a0d('0xb')](contacts);})[_0x0a0d('0xa')](function(){console['log'](_0x0a0d('0xc'),_0x0a0d('0xd'));return db[_0x0a0d('0xe')][_0x0a0d('0x9')]({'where':{}});})[_0x0a0d('0xa')](function(){return db[_0x0a0d('0xe')][_0x0a0d('0xb')](hopper);})[_0x0a0d('0xa')](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x10'));return db[_0x0a0d('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x11'));return db[_0x0a0d('0xe')][_0x0a0d('0xb')](hopper2);})[_0x0a0d('0xa')](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x12'));})[_0x0a0d('0x13')](function(_0x181b75){console[_0x0a0d('0xf')](_0x181b75);}); \ No newline at end of file +var _0x93c3=['contacts1','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','bulkCreate','then','log','finished\x20populating'];(function(_0x379a60,_0x206cb4){var _0x4f2f73=function(_0x43f02a){while(--_0x43f02a){_0x379a60['push'](_0x379a60['shift']());}};_0x4f2f73(++_0x206cb4);}(_0x93c3,0x135));var _0x393c=function(_0x1b70f8,_0x546078){_0x1b70f8=_0x1b70f8-0x0;var _0xb942=_0x93c3[_0x1b70f8];return _0xb942;};'use strict';var util=require(_0x393c('0x0'));var db=require(_0x393c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x393c('0x2')]({'id':i,'firstName':_0x393c('0x3')+i,'lastName':_0x393c('0x4')+i,'phone':0xf879fb460+i,'email':_0x393c('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x393c('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x393c('0x6')](),'updatedAt':Date[_0x393c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x393c('0x2')]({'id':i,'firstName':_0x393c('0x3')+i,'lastName':_0x393c('0x4')+i,'phone':0xf879fb460+i,'email':_0x393c('0x5')+i+_0x393c('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x393c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x393c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x393c('0x6')](),'updatedAt':Date[_0x393c('0x6')]()});}db[_0x393c('0x8')][_0x393c('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x393c('0xa')](contacts);})[_0x393c('0xb')](function(){console[_0x393c('0xc')](_0x393c('0xd'),_0x393c('0xe'));return db[_0x393c('0xf')][_0x393c('0x9')]({'where':{}});})[_0x393c('0xb')](function(){return db[_0x393c('0xf')][_0x393c('0xa')](hopper);})['then'](function(){console[_0x393c('0xc')](_0x393c('0xd'),_0x393c('0x10'));return db['CmContact'][_0x393c('0xa')](contacts2);})[_0x393c('0xb')](function(){console[_0x393c('0xc')](_0x393c('0xd'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0x393c('0xb')](function(){console[_0x393c('0xc')](_0x393c('0xd'),_0x393c('0x11'));})[_0x393c('0x12')](function(_0x348a2b){console[_0x393c('0xc')](_0x348a2b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 567fd60..7d91ad2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb632=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x1a504a,_0x15d44b){var _0x571c54=function(_0x505c73){while(--_0x505c73){_0x1a504a['push'](_0x1a504a['shift']());}};_0x571c54(++_0x15d44b);}(_0xb632,0xd7));var _0x2b63=function(_0x1fde0f,_0x163737){_0x1fde0f=_0x1fde0f-0x0;var _0x559ec0=_0xb632[_0x1fde0f];return _0x559ec0;};'use strict';var util=require(_0x2b63('0x0'));var db=require(_0x2b63('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2b63('0x2')]({'name':util[_0x2b63('0x3')]('%s%s',_0x2b63('0x4'),i),'fullname':util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),'email':util[_0x2b63('0x3')](_0x2b63('0x6'),_0x2b63('0x4'),i),'role':'agent','password':_0x2b63('0x7'),'internal':0xfa0+i,'type':_0x2b63('0x8'),'transport':[_0x2b63('0x9'),'ws',_0x2b63('0xa')],'disallow':[_0x2b63('0xb')],'allow':[_0x2b63('0xc')],'defaultuser':util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),'encryption':_0x2b63('0xd'),'avpf':_0x2b63('0xd'),'force_avp':_0x2b63('0xd'),'icesupport':_0x2b63('0xd'),'dtlsenable':_0x2b63('0xd'),'dtlsverify':'no','dtlscertfile':_0x2b63('0xe'),'dtlsprivatekey':_0x2b63('0xf'),'dtlssetup':_0x2b63('0x10'),'callerid':util[_0x2b63('0x3')](_0x2b63('0x11'),util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),0xfa0+i)});}db[_0x2b63('0x12')][_0x2b63('0x13')](users)['then'](function(){console[_0x2b63('0x14')](_0x2b63('0x15'));})[_0x2b63('0x16')](function(_0x133412){console[_0x2b63('0x14')](_0x133412);}); \ No newline at end of file +var _0xc327=['bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User'];(function(_0x354354,_0x4488f7){var _0x13c5fb=function(_0x161e77){while(--_0x161e77){_0x354354['push'](_0x354354['shift']());}};_0x13c5fb(++_0x4488f7);}(_0xc327,0xe0));var _0x7c32=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc327[_0x30ae5e];return _0x1f2e93;};'use strict';var util=require(_0x7c32('0x0'));var db=require(_0x7c32('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7c32('0x2')]({'name':util[_0x7c32('0x3')](_0x7c32('0x4'),'agent',i),'fullname':util['format'](_0x7c32('0x4'),_0x7c32('0x5'),i),'email':util['format'](_0x7c32('0x6'),'agent',i),'role':_0x7c32('0x5'),'password':_0x7c32('0x7'),'internal':0xfa0+i,'type':_0x7c32('0x8'),'transport':[_0x7c32('0x9'),'ws',_0x7c32('0xa')],'disallow':[_0x7c32('0xb')],'allow':[_0x7c32('0xc')],'defaultuser':util[_0x7c32('0x3')]('%s%s',_0x7c32('0x5'),i),'encryption':'yes','avpf':_0x7c32('0xd'),'force_avp':_0x7c32('0xd'),'icesupport':'yes','dtlsenable':_0x7c32('0xd'),'dtlsverify':'no','dtlscertfile':_0x7c32('0xe'),'dtlsprivatekey':_0x7c32('0xf'),'dtlssetup':_0x7c32('0x10'),'callerid':util[_0x7c32('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x7c32('0x5'),i),0xfa0+i)});}db[_0x7c32('0x11')][_0x7c32('0x12')](users)[_0x7c32('0x13')](function(){console[_0x7c32('0x14')]('add\x20user');})[_0x7c32('0x15')](function(_0x1231a7){console[_0x7c32('0x14')](_0x1231a7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9ee3f2a..63370e2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5324=['getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','format','%s:queue:%s','Agents','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','ChatQueues','ChatQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5324,0x154));var _0x4532=function(_0x4f26c9,_0x44c8e7){_0x4f26c9=_0x4f26c9-0x0;var _0x5f8cdf=_0x5324[_0x4f26c9];return _0x5f8cdf;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var BPromise=require(_0x4532('0x2'));var db=require(_0x4532('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4532('0x4')],'include':[{'as':'Agents','model':db[_0x4532('0x5')],'attributes':['id',_0x4532('0x4'),_0x4532('0x6')],'raw':!![],'where':{'role':_0x4532('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4532('0x4')],'where':{'role':_0x4532('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4532('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x4532('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4532('0x4'),_0x4532('0x9')],'where':{'type':_0x4532('0xa')}};function getAssociatedResources(_0x1fc834,_0x1b5839,_0x4340a7){return db[_0x4532('0xb')][_0x4532('0xc')]({'where':{'name':_0x1fc834,'userProfileId':_0x1b5839},'raw':!![]})[_0x4532('0xd')](function(_0x3f9647){if(_0x3f9647){if(_0x3f9647[_0x4532('0xe')]){switch(_0x1fc834){case _0x4532('0xf'):case'ChatQueues':case'FaxQueues':case _0x4532('0x10'):case'MailQueues':case _0x4532('0x11'):case _0x4532('0x12'):return db[_0x4340a7][_0x4532('0x13')](queryQueues);case _0x4532('0x14'):return db[_0x4340a7]['findAll'](queryTelephones);case _0x4532('0x15'):return db[_0x4340a7][_0x4532('0x13')](queryTrunks);case _0x4532('0x16'):return db[_0x4340a7][_0x4532('0x13')](queryCampaigns);}}else{return db[_0x4532('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x3f9647['id']},'raw':!![]})['then'](function(_0x38cd2a){if(_0x38cd2a){var _0x19ea01={'where':{'id':_[_0x4532('0x18')](_0x38cd2a,_0x4532('0x19'))},'raw':!![]};switch(_0x4340a7){case _0x4532('0x5'):_0x19ea01[_0x4532('0x1a')][_0x4532('0x6')]=_0x4532('0x8');break;case _0x4532('0x1b'):_0x19ea01['where'][_0x4532('0x9')]=_0x4532('0xa');break;}return db[_0x4340a7][_0x4532('0x13')](_0x19ea01);}else{return[];}});}}else{return[];}})['then'](function(_0x2875e0){return _0x2875e0;});}function joinOrLeaveQueues(_0x3734e3,_0x57c08d,_0x20a30c,_0x23488e){_0x3734e3[_0x57c08d](util[_0x4532('0x1c')](_0x4532('0x1d'),_0x20a30c,_0x23488e[_0x4532('0x4')]));if(_0x23488e[_0x4532('0x1e')]){for(var _0x6a669f=0x0;_0x6a669f<_0x23488e[_0x4532('0x1e')]['length'];_0x6a669f+=0x1){_0x3734e3[_0x57c08d](util[_0x4532('0x1c')](_0x4532('0x1f'),_0x23488e['Agents'][_0x6a669f][_0x4532('0x4')]));}}}function joinOrLeave(_0x182ec3,_0x472d0d,_0xed85b1){var _0x4fd4bd;if(_0x182ec3[_0x4532('0x20')]['query']['id']){db[_0x4532('0x5')][_0x4532('0x21')]({'attributes':['id',_0x4532('0x4'),_0x4532('0x6'),_0x4532('0x22')],'where':{'id':_0x182ec3[_0x4532('0x20')][_0x4532('0x23')]['id']},'include':[{'model':db[_0x4532('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4532('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x26')],'as':_0x4532('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x28')],'as':_0x4532('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x2b')],'as':_0x4532('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x4532('0xd')](function(_0x16836c){if(_0x16836c){_0x4fd4bd=_0x16836c;_0x182ec3[_0x472d0d](util[_0x4532('0x1c')]('user:%s',_0x16836c[_0x4532('0x4')]));var _0x3fabe3=[];switch(_0x16836c[_0x4532('0x6')]){case'admin':_0x182ec3[_0x472d0d]('voice:inbound');_0x182ec3[_0x472d0d]('voice:outbound');if(queryQueues[_0x4532('0x2d')](_0x4532('0x2e'))){delete queryQueues[_0x4532('0x2e')];}_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x30')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x31')]['findAll'](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x32')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x33')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x34')]['findAll'](queryQueues));_0x3fabe3['push'](db[_0x4532('0x35')][_0x4532('0x13')](queryQueues));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryTelephones));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x36')]['findAll'](queryTrunks));_0x3fabe3[_0x4532('0x2f')](db['Campaign'][_0x4532('0x13')](queryCampaigns));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryAgents));break;case _0x4532('0x37'):_0x182ec3[_0x472d0d](_0x4532('0x38'));_0x182ec3[_0x472d0d](_0x4532('0x39'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0xf'),_0x16836c[_0x4532('0x22')],_0x4532('0x30')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x3a'),_0x16836c['userProfileId'],_0x4532('0x3b')));_0x3fabe3['push'](getAssociatedResources('FaxQueues',_0x16836c[_0x4532('0x22')],'FaxQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x10'),_0x16836c[_0x4532('0x22')],_0x4532('0x32')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources('MailQueues',_0x16836c['userProfileId'],_0x4532('0x33')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources('OpenchannelQueues',_0x16836c[_0x4532('0x22')],'OpenchannelQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x12'),_0x16836c['userProfileId'],'WhatsappQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x14'),_0x16836c[_0x4532('0x22')],'User'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x15'),_0x16836c[_0x4532('0x22')],'Trunk'));_0x3fabe3['push'](getAssociatedResources(_0x4532('0x16'),_0x16836c[_0x4532('0x22')],_0x4532('0x1b')));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryAgents));break;case _0x4532('0x7'):_0x182ec3[_0x472d0d](_0x4532('0x38'));_0x182ec3[_0x472d0d]('voice:outbound');_0x3fabe3['push'](_0x16836c[_0x4532('0x3c')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3d')]({'attributes':['id','name']}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3e')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3f')]({'attributes':['id','name']}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x40')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x41')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c['getWhatsappQueues']({'attributes':['id',_0x4532('0x4')]}));break;}return BPromise['all'](_0x3fabe3);}})['then'](function(_0x8a2472){if(_0x8a2472&&_0x8a2472[_0x4532('0x42')]){for(var _0x509ff5=0x0;_0x509ff5<_0x8a2472['length'];_0x509ff5+=0x1){for(var _0x4162c9=0x0;_0x4162c9<_0x8a2472[_0x509ff5]['length'];_0x4162c9+=0x1){switch(_0x509ff5){case 0x0:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x43'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x1:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x44'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x2:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x45'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x3:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x46'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x4:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x47'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x5:joinOrLeaveQueues(_0x182ec3,_0x472d0d,'openchannel',_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x6:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x48'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x7:if(_0x4fd4bd[_0x4532('0x6')]!==_0x4532('0x7'))_0x182ec3[_0x472d0d](util['format'](_0x4532('0x49'),_0x8a2472[_0x509ff5][_0x4162c9]['name']));break;case 0x8:if(_0x4fd4bd[_0x4532('0x6')]!=='agent')_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x4a'),_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;case 0x9:if(_0x4fd4bd[_0x4532('0x6')]!==_0x4532('0x7'))_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x4b'),_0x8a2472[_0x509ff5][_0x4162c9]['type'],_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;case 0xa:_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x1f'),_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;}}}}})[_0x4532('0xd')](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x4ffa6a=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x4d')],'id');return _0x4fd4bd[_0x4532('0x4e')](_0x4ffa6a)[_0x4532('0xd')](function(){for(var _0x423868=0x0;_0x423868<_0x4ffa6a[_0x4532('0x42')];_0x423868+=0x1){_0xed85b1['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4ffa6a[_0x423868]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x9aebec=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x25')],'id');return _0x4fd4bd['removeMailInteractions'](_0x9aebec)[_0x4532('0xd')](function(){for(var _0x463ed6=0x0;_0x463ed6<_0x9aebec[_0x4532('0x42')];_0x463ed6+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x50'),{'MailInteractionId':Number(_0x9aebec[_0x463ed6]),'UserId':Number(_0x4fd4bd['id'])});}});}})[_0x4532('0xd')](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x41fd9e=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x27')],'id');return _0x4fd4bd[_0x4532('0x51')](_0x41fd9e)[_0x4532('0xd')](function(){for(var _0x31bee3=0x0;_0x31bee3<_0x41fd9e[_0x4532('0x42')];_0x31bee3+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x52'),{'FaxInteractionId':Number(_0x41fd9e[_0x31bee3]),'UserId':Number(_0x4fd4bd['id'])});}});}})[_0x4532('0xd')](function(){if(_0x472d0d==='leave'){var _0xee87a9=_[_0x4532('0x18')](_0x4fd4bd['SmsInteractions'],'id');return _0x4fd4bd[_0x4532('0x53')](_0xee87a9)[_0x4532('0xd')](function(){for(var _0x585437=0x0;_0x585437<_0xee87a9[_0x4532('0x42')];_0x585437+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x54'),{'SmsInteractionId':Number(_0xee87a9[_0x585437]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x4ca59f=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x55')],'id');return _0x4fd4bd['removeOpenchannelInteractions'](_0x4ca59f)[_0x4532('0xd')](function(){for(var _0x466c32=0x0;_0x466c32<_0x4ca59f[_0x4532('0x42')];_0x466c32+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x56'),{'OpenchannelInteractionId':Number(_0x4ca59f[_0x466c32]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x39da10=_[_0x4532('0x18')](_0x4fd4bd['WhatsappInteractions'],'id');return _0x4fd4bd['removeWhatsappInteractions'](_0x39da10)['then'](function(){for(var _0x33f600=0x0;_0x33f600<_0x39da10['length'];_0x33f600+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x57'),{'WhatsappInteractionId':Number(_0x39da10[_0x33f600]),'UserId':Number(_0x4fd4bd['id'])});}});}})['catch'](function(_0x33716e){_0x182ec3[_0x4532('0x58')](_0x33716e);});}}function onDisconnect(_0x1ec96e,_0x1201e6){joinOrLeave(_0x1ec96e,_0x4532('0x4c'),_0x1201e6);}function onConnect(_0x169971){joinOrLeave(_0x169971,_0x4532('0x59'));}exports[_0x4532('0x5a')]=function(_0x2654f8){_0x2654f8['on'](_0x4532('0x5b'),function(_0x58b51c){_0x58b51c[_0x4532('0x5c')](0x0);_0x58b51c['address']=_0x58b51c['request']['connection'][_0x4532('0x5d')]+':'+_0x58b51c[_0x4532('0x5e')][_0x4532('0x5b')][_0x4532('0x5f')];_0x58b51c['connectedAt']=new Date();_0x58b51c[_0x4532('0x58')]=function(_0x4866b1){console[_0x4532('0x58')](_0x4532('0x60')+_0x58b51c[_0x4532('0x61')][_0x4532('0x4')]+'['+_0x58b51c[_0x4532('0x62')]+']',_0x4866b1);};_0x58b51c['on'](_0x4532('0x63'),function(){onDisconnect(_0x58b51c,_0x2654f8);_0x58b51c[_0x4532('0x58')]('DISCONNECTED');});onConnect(_0x58b51c);_0x58b51c[_0x4532('0x58')](_0x4532('0x64'));});}; \ No newline at end of file +var _0x1189=['type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','format','%s:queue:%s','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','Campaign','voice:inbound','FaxQueues','OpenchannelQueue','WhatsappQueues','WhatsappQueue','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','role','agent'];(function(_0x8a0496,_0x382fd9){var _0x43c918=function(_0x590135){while(--_0x590135){_0x8a0496['push'](_0x8a0496['shift']());}};_0x43c918(++_0x382fd9);}(_0x1189,0x17f));var _0x9118=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x1189[_0x3eb450];return _0x2c4cfd;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var BPromise=require(_0x9118('0x2'));var db=require(_0x9118('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x9118('0x4')],'include':[{'as':_0x9118('0x5'),'model':db[_0x9118('0x6')],'attributes':['id',_0x9118('0x4'),_0x9118('0x7')],'raw':!![],'where':{'role':_0x9118('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9118('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x9118('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x9118('0x4')],'where':{'role':_0x9118('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9118('0x4'),_0x9118('0x9')],'where':{'type':_0x9118('0xa')}};function getAssociatedResources(_0x5cfd42,_0x3de6a2,_0x227eea){return db[_0x9118('0xb')][_0x9118('0xc')]({'where':{'name':_0x5cfd42,'userProfileId':_0x3de6a2},'raw':!![]})[_0x9118('0xd')](function(_0x319690){if(_0x319690){if(_0x319690[_0x9118('0xe')]){switch(_0x5cfd42){case'VoiceQueues':case _0x9118('0xf'):case'FaxQueues':case'SmsQueues':case _0x9118('0x10'):case _0x9118('0x11'):case'WhatsappQueues':return db[_0x227eea][_0x9118('0x12')](queryQueues);case _0x9118('0x13'):return db[_0x227eea][_0x9118('0x12')](queryTelephones);case _0x9118('0x14'):return db[_0x227eea][_0x9118('0x12')](queryTrunks);case _0x9118('0x15'):return db[_0x227eea][_0x9118('0x12')](queryCampaigns);}}else{return db[_0x9118('0x16')][_0x9118('0x12')]({'attributes':[_0x9118('0x17')],'where':{'sectionId':_0x319690['id']},'raw':!![]})[_0x9118('0xd')](function(_0x48e13a){if(_0x48e13a){var _0x5c403d={'where':{'id':_[_0x9118('0x18')](_0x48e13a,'resourceId')},'raw':!![]};switch(_0x227eea){case _0x9118('0x6'):_0x5c403d[_0x9118('0x19')][_0x9118('0x7')]=_0x9118('0x1a');break;case'Campaign':_0x5c403d[_0x9118('0x19')]['type']=_0x9118('0xa');break;}return db[_0x227eea]['findAll'](_0x5c403d);}else{return[];}});}}else{return[];}})[_0x9118('0xd')](function(_0x3f30a0){return _0x3f30a0;});}function joinOrLeaveQueues(_0x4d4826,_0x2763a3,_0x1e133b,_0x2a3b29){_0x4d4826[_0x2763a3](util[_0x9118('0x1b')](_0x9118('0x1c'),_0x1e133b,_0x2a3b29['name']));if(_0x2a3b29[_0x9118('0x5')]){for(var _0x178b01=0x0;_0x178b01<_0x2a3b29[_0x9118('0x5')][_0x9118('0x1d')];_0x178b01+=0x1){_0x4d4826[_0x2763a3](util[_0x9118('0x1b')](_0x9118('0x1e'),_0x2a3b29[_0x9118('0x5')][_0x178b01][_0x9118('0x4')]));}}}function joinOrLeave(_0x3d77de,_0x47177b,_0x5613dc){var _0x2f338e;if(_0x3d77de['handshake'][_0x9118('0x1f')]['id']){db[_0x9118('0x6')][_0x9118('0x20')]({'attributes':['id','name','role',_0x9118('0x21')],'where':{'id':_0x3d77de[_0x9118('0x22')]['query']['id']},'include':[{'model':db[_0x9118('0x23')],'as':_0x9118('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x9118('0x25')],'as':_0x9118('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x9118('0x27')],'as':_0x9118('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x9118('0x29')],'as':_0x9118('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x9118('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x9118('0x2c')],'as':_0x9118('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x9118('0xd')](function(_0x2f72bb){if(_0x2f72bb){_0x2f338e=_0x2f72bb;_0x3d77de[_0x47177b](util[_0x9118('0x1b')](_0x9118('0x1e'),_0x2f72bb[_0x9118('0x4')]));var _0x57c5d2=[];switch(_0x2f72bb[_0x9118('0x7')]){case _0x9118('0x2e'):_0x3d77de[_0x47177b]('voice:inbound');_0x3d77de[_0x47177b](_0x9118('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x31')][_0x9118('0x12')](queryQueues));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x32')][_0x9118('0x12')](queryQueues));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x33')]['findAll'](queryQueues));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x34')][_0x9118('0x12')](queryQueues));_0x57c5d2['push'](db[_0x9118('0x35')][_0x9118('0x12')](queryQueues));_0x57c5d2[_0x9118('0x30')](db['OpenchannelQueue'][_0x9118('0x12')](queryQueues));_0x57c5d2['push'](db['WhatsappQueue'][_0x9118('0x12')](queryQueues));_0x57c5d2['push'](db[_0x9118('0x6')][_0x9118('0x12')](queryTelephones));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x36')][_0x9118('0x12')](queryTrunks));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x37')]['findAll'](queryCampaigns));_0x57c5d2['push'](db[_0x9118('0x6')][_0x9118('0x12')](queryAgents));break;case'user':_0x3d77de[_0x47177b](_0x9118('0x38'));_0x3d77de[_0x47177b](_0x9118('0x2f'));_0x57c5d2[_0x9118('0x30')](getAssociatedResources('VoiceQueues',_0x2f72bb[_0x9118('0x21')],_0x9118('0x31')));_0x57c5d2[_0x9118('0x30')](getAssociatedResources(_0x9118('0xf'),_0x2f72bb[_0x9118('0x21')],_0x9118('0x32')));_0x57c5d2[_0x9118('0x30')](getAssociatedResources(_0x9118('0x39'),_0x2f72bb['userProfileId'],_0x9118('0x33')));_0x57c5d2['push'](getAssociatedResources('SmsQueues',_0x2f72bb[_0x9118('0x21')],_0x9118('0x34')));_0x57c5d2[_0x9118('0x30')](getAssociatedResources(_0x9118('0x10'),_0x2f72bb[_0x9118('0x21')],'MailQueue'));_0x57c5d2['push'](getAssociatedResources('OpenchannelQueues',_0x2f72bb['userProfileId'],_0x9118('0x3a')));_0x57c5d2['push'](getAssociatedResources(_0x9118('0x3b'),_0x2f72bb[_0x9118('0x21')],_0x9118('0x3c')));_0x57c5d2['push'](getAssociatedResources(_0x9118('0x13'),_0x2f72bb[_0x9118('0x21')],'User'));_0x57c5d2['push'](getAssociatedResources(_0x9118('0x14'),_0x2f72bb[_0x9118('0x21')],'Trunk'));_0x57c5d2[_0x9118('0x30')](getAssociatedResources(_0x9118('0x15'),_0x2f72bb['userProfileId'],_0x9118('0x37')));_0x57c5d2[_0x9118('0x30')](db[_0x9118('0x6')][_0x9118('0x12')](queryAgents));break;case'agent':_0x3d77de[_0x47177b](_0x9118('0x38'));_0x3d77de[_0x47177b](_0x9118('0x2f'));_0x57c5d2[_0x9118('0x30')](_0x2f72bb['getVoiceQueues']({'attributes':['id',_0x9118('0x4')]}));_0x57c5d2[_0x9118('0x30')](_0x2f72bb[_0x9118('0x3d')]({'attributes':['id','name']}));_0x57c5d2[_0x9118('0x30')](_0x2f72bb[_0x9118('0x3e')]({'attributes':['id',_0x9118('0x4')]}));_0x57c5d2[_0x9118('0x30')](_0x2f72bb[_0x9118('0x3f')]({'attributes':['id',_0x9118('0x4')]}));_0x57c5d2['push'](_0x2f72bb[_0x9118('0x40')]({'attributes':['id',_0x9118('0x4')]}));_0x57c5d2[_0x9118('0x30')](_0x2f72bb[_0x9118('0x41')]({'attributes':['id','name']}));_0x57c5d2[_0x9118('0x30')](_0x2f72bb[_0x9118('0x42')]({'attributes':['id',_0x9118('0x4')]}));break;}return BPromise[_0x9118('0x43')](_0x57c5d2);}})[_0x9118('0xd')](function(_0x2475a9){if(_0x2475a9&&_0x2475a9[_0x9118('0x1d')]){for(var _0x1fc9b5=0x0;_0x1fc9b5<_0x2475a9['length'];_0x1fc9b5+=0x1){for(var _0x1b6f40=0x0;_0x1b6f40<_0x2475a9[_0x1fc9b5][_0x9118('0x1d')];_0x1b6f40+=0x1){switch(_0x1fc9b5){case 0x0:joinOrLeaveQueues(_0x3d77de,_0x47177b,_0x9118('0x44'),_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x1:joinOrLeaveQueues(_0x3d77de,_0x47177b,'chat',_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x2:joinOrLeaveQueues(_0x3d77de,_0x47177b,_0x9118('0x45'),_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x3:joinOrLeaveQueues(_0x3d77de,_0x47177b,_0x9118('0x46'),_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x4:joinOrLeaveQueues(_0x3d77de,_0x47177b,'mail',_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x5:joinOrLeaveQueues(_0x3d77de,_0x47177b,_0x9118('0x47'),_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x6:joinOrLeaveQueues(_0x3d77de,_0x47177b,'whatsapp',_0x2475a9[_0x1fc9b5][_0x1b6f40]);break;case 0x7:if(_0x2f338e['role']!=='agent')_0x3d77de[_0x47177b](util[_0x9118('0x1b')](_0x9118('0x48'),_0x2475a9[_0x1fc9b5][_0x1b6f40][_0x9118('0x4')]));break;case 0x8:if(_0x2f338e[_0x9118('0x7')]!==_0x9118('0x8'))_0x3d77de[_0x47177b](util[_0x9118('0x1b')](_0x9118('0x49'),_0x2475a9[_0x1fc9b5][_0x1b6f40]['name']));break;case 0x9:if(_0x2f338e['role']!==_0x9118('0x8'))_0x3d77de[_0x47177b](util[_0x9118('0x1b')]('campaign:%s:%s',_0x2475a9[_0x1fc9b5][_0x1b6f40]['type'],_0x2475a9[_0x1fc9b5][_0x1b6f40][_0x9118('0x4')]));break;case 0xa:_0x3d77de[_0x47177b](util['format']('user:%s',_0x2475a9[_0x1fc9b5][_0x1b6f40][_0x9118('0x4')]));break;}}}}})[_0x9118('0xd')](function(){if(_0x47177b===_0x9118('0x4a')){var _0x4018b8=_[_0x9118('0x18')](_0x2f338e[_0x9118('0x24')],'id');return _0x2f338e[_0x9118('0x4b')](_0x4018b8)[_0x9118('0xd')](function(){for(var _0x170ff5=0x0;_0x170ff5<_0x4018b8['length'];_0x170ff5+=0x1){_0x5613dc[_0x9118('0x4c')](_0x9118('0x4d'),{'ChatInteractionId':Number(_0x4018b8[_0x170ff5]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0xd')](function(){if(_0x47177b==='leave'){var _0x52ca84=_[_0x9118('0x18')](_0x2f338e[_0x9118('0x26')],'id');return _0x2f338e['removeMailInteractions'](_0x52ca84)[_0x9118('0xd')](function(){for(var _0x3d8692=0x0;_0x3d8692<_0x52ca84['length'];_0x3d8692+=0x1){_0x5613dc[_0x9118('0x4c')](_0x9118('0x4e'),{'MailInteractionId':Number(_0x52ca84[_0x3d8692]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0xd')](function(){if(_0x47177b===_0x9118('0x4a')){var _0x2a19e4=_[_0x9118('0x18')](_0x2f338e[_0x9118('0x28')],'id');return _0x2f338e['removeFaxInteractions'](_0x2a19e4)[_0x9118('0xd')](function(){for(var _0x115322=0x0;_0x115322<_0x2a19e4['length'];_0x115322+=0x1){_0x5613dc[_0x9118('0x4c')](_0x9118('0x4f'),{'FaxInteractionId':Number(_0x2a19e4[_0x115322]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0xd')](function(){if(_0x47177b===_0x9118('0x4a')){var _0x38ce4d=_['map'](_0x2f338e[_0x9118('0x2a')],'id');return _0x2f338e[_0x9118('0x50')](_0x38ce4d)[_0x9118('0xd')](function(){for(var _0x2e7adc=0x0;_0x2e7adc<_0x38ce4d[_0x9118('0x1d')];_0x2e7adc+=0x1){_0x5613dc['emit'](_0x9118('0x51'),{'SmsInteractionId':Number(_0x38ce4d[_0x2e7adc]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0xd')](function(){if(_0x47177b===_0x9118('0x4a')){var _0x418f27=_['map'](_0x2f338e[_0x9118('0x2b')],'id');return _0x2f338e[_0x9118('0x52')](_0x418f27)[_0x9118('0xd')](function(){for(var _0x337513=0x0;_0x337513<_0x418f27[_0x9118('0x1d')];_0x337513+=0x1){_0x5613dc[_0x9118('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x418f27[_0x337513]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0xd')](function(){if(_0x47177b===_0x9118('0x4a')){var _0x2767b6=_[_0x9118('0x18')](_0x2f338e[_0x9118('0x2d')],'id');return _0x2f338e[_0x9118('0x53')](_0x2767b6)[_0x9118('0xd')](function(){for(var _0x3ce059=0x0;_0x3ce059<_0x2767b6[_0x9118('0x1d')];_0x3ce059+=0x1){_0x5613dc[_0x9118('0x4c')](_0x9118('0x54'),{'WhatsappInteractionId':Number(_0x2767b6[_0x3ce059]),'UserId':Number(_0x2f338e['id'])});}});}})[_0x9118('0x55')](function(_0x5b7cde){_0x3d77de['log'](_0x5b7cde);});}}function onDisconnect(_0x280bdb,_0x3809d4){joinOrLeave(_0x280bdb,_0x9118('0x4a'),_0x3809d4);}function onConnect(_0x54641f){joinOrLeave(_0x54641f,'join');}exports['default']=function(_0x41271d){_0x41271d['on'](_0x9118('0x56'),function(_0x2ab6d6){_0x2ab6d6[_0x9118('0x57')](0x0);_0x2ab6d6[_0x9118('0x58')]=_0x2ab6d6[_0x9118('0x59')][_0x9118('0x56')][_0x9118('0x5a')]+':'+_0x2ab6d6[_0x9118('0x59')]['connection'][_0x9118('0x5b')];_0x2ab6d6[_0x9118('0x5c')]=new Date();_0x2ab6d6[_0x9118('0x5d')]=function(_0x57a3ec){console[_0x9118('0x5d')](_0x9118('0x5e')+_0x2ab6d6[_0x9118('0x5f')][_0x9118('0x4')]+'['+_0x2ab6d6[_0x9118('0x58')]+']',_0x57a3ec);};_0x2ab6d6['on'](_0x9118('0x60'),function(){onDisconnect(_0x2ab6d6,_0x41271d);_0x2ab6d6[_0x9118('0x5d')](_0x9118('0x61'));});onConnect(_0x2ab6d6);_0x2ab6d6[_0x9118('0x5d')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9144b40..ac651db 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 _0x0d91=['newmessage','afterCreate','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','code','error','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','contact','UserId','SIP/%s','name','agent','AfterCreateMessage','opened','sequelize','interface','format','AfterCreate','changed','closed','substatus','User','fullname','internal','default','length','hasOwnProperty','model','hook','callback','condition','util','jayson/promise','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate'];(function(_0x5db3a3,_0x3a2556){var _0x169d18=function(_0x379ba9){while(--_0x379ba9){_0x5db3a3['push'](_0x5db3a3['shift']());}};_0x169d18(++_0x3a2556);}(_0x0d91,0x7b));var _0x10d9=function(_0x164798,_0x29e959){_0x164798=_0x164798-0x0;var _0xc5da=_0x0d91[_0x164798];return _0xc5da;};'use strict';var util=require(_0x10d9('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x10d9('0x1'));var logger=require('../logger')(_0x10d9('0x2'));var client=jayson[_0x10d9('0x3')][_0x10d9('0x4')]({'port':0x232a});var triggers=[{'channel':_0x10d9('0x5'),'model':_0x10d9('0x6'),'event':'afterCreate','condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0x5'),'model':'ChatInteraction','event':_0x10d9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':'afterCreate','condition':_0x10d9('0x9'),'callback':afterCreateMessage},{'channel':_0x10d9('0x5'),'model':'ChatOfflineMessage','event':_0x10d9('0xa'),'condition':_0x10d9('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x10d9('0xb'),'model':'SmsInteraction','event':'afterCreate','condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0xb'),'model':_0x10d9('0xc'),'event':_0x10d9('0x8'),'condition':_0x10d9('0xd'),'callback':afterUpdate},{'channel':'Sms','model':_0x10d9('0xe'),'event':_0x10d9('0xa'),'condition':_0x10d9('0x9'),'callback':afterCreateMessage},{'channel':_0x10d9('0xf'),'model':'WhatsappInteraction','event':_0x10d9('0xa'),'condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0xf'),'model':'WhatsappInteraction','event':_0x10d9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x10d9('0xf'),'model':_0x10d9('0x10'),'event':'afterCreate','condition':_0x10d9('0x9'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x10d9('0x11'),'event':'afterCreate','condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0x12'),'model':_0x10d9('0x11'),'event':_0x10d9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x10d9('0x13'),'event':_0x10d9('0xa'),'condition':_0x10d9('0x9'),'callback':afterCreateMessage},{'channel':_0x10d9('0x14'),'model':'MailInteraction','event':_0x10d9('0xa'),'condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0x14'),'model':'MailInteraction','event':_0x10d9('0x8'),'condition':_0x10d9('0xd'),'callback':afterUpdate},{'channel':_0x10d9('0x14'),'model':_0x10d9('0x15'),'event':_0x10d9('0xa'),'condition':_0x10d9('0x9'),'callback':afterCreateMessage},{'channel':_0x10d9('0x16'),'model':_0x10d9('0x17'),'event':_0x10d9('0xa'),'condition':_0x10d9('0x7'),'callback':afterCreate},{'channel':_0x10d9('0x16'),'model':_0x10d9('0x17'),'event':_0x10d9('0x8'),'condition':_0x10d9('0xd'),'callback':afterUpdate},{'channel':_0x10d9('0x16'),'model':_0x10d9('0x18'),'event':_0x10d9('0xa'),'condition':_0x10d9('0x9'),'callback':afterCreateMessage}];function request(_0x4729af){return client['request'](_0x10d9('0x19'),_0x4729af)['then'](function(_0x3ee12e){logger['info']('Trigger,\x20%s','EventManager',_0x3ee12e);if(_0x3ee12e['error']){if(_0x3ee12e['error'][_0x10d9('0x1a')]===0x1f4){logger[_0x10d9('0x1b')](_0x10d9('0x1c'),_0x10d9('0x19'),_0x3ee12e[_0x10d9('0x1b')]);}}})[_0x10d9('0x1d')](function(_0x305c39){logger[_0x10d9('0x1b')](_0x10d9('0x1c'),'EventManager',_0x305c39);});}function afterCreateMessage(_0x1285bc){return function(_0x2dadc8){_0x2dadc8=_0x2dadc8[_0x10d9('0x1e')]({'plain':!![]});_0x2dadc8[_0x10d9('0x1f')]=_0x1285bc;_0x2dadc8[_0x10d9('0x20')]=_0x1285bc;_0x2dadc8[_0x10d9('0x21')]=_0x2dadc8[_0x10d9('0x22')];Promise[_0x10d9('0x23')]()[_0x10d9('0x24')](function(){if(typeof _0x2dadc8[_0x10d9('0x25')]===_0x10d9('0x26'))return null;var _0x5c51b4=_0x10d9('0x27')+_0x2dadc8[_0x10d9('0x25')];return db['sequelize'][_0x10d9('0x28')](_0x5c51b4,{'type':db[_0x10d9('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x536ba7){if(_0x536ba7){_0x2dadc8[_0x10d9('0x2a')]=_0x536ba7[0x0];}if(typeof _0x2dadc8[_0x10d9('0x2b')]===_0x10d9('0x26'))return;return getAgent(_0x2dadc8[_0x10d9('0x2b')]);})[_0x10d9('0x24')](function(_0x3cf671){if(_0x3cf671){_0x2dadc8['interface']=util['format'](_0x10d9('0x2c'),_0x3cf671[_0x10d9('0x2d')]);_0x2dadc8[_0x10d9('0x2e')]=_0x3cf671;_0x2dadc8[_0x10d9('0x1f')]=_0x1285bc;return request({'event':'incomingmessage','message':_0x2dadc8});}else{return request({'event':'outgoingmessage','message':_0x2dadc8});}})[_0x10d9('0x1d')](function(_0x314c59){logger[_0x10d9('0x1b')](_0x10d9('0x1c'),_0x10d9('0x2f'),_0x314c59);});};}function afterCreateOfflineMessage(_0x41e68a){return function(_0x30dea5){_0x30dea5=_0x30dea5[_0x10d9('0x1e')]({'plain':!![]});_0x30dea5[_0x10d9('0x1f')]=_0x41e68a;_0x30dea5[_0x10d9('0x20')]=_0x41e68a;_0x30dea5[_0x10d9('0x21')]='offlineMessage';return request({'event':_0x30dea5['event'],'message':_0x30dea5});};}function afterCreate(_0x215b37,_0x3e33e8){return function(_0x2fa889){_0x2fa889=_0x2fa889[_0x10d9('0x1e')]({'plain':!![]});_0x2fa889[_0x10d9('0x1f')]=_0x215b37;_0x2fa889[_0x10d9('0x20')]=_0x215b37;_0x2fa889['event']=_0x10d9('0x30');Promise[_0x10d9('0x23')]()['then'](function(){var _0x5af596=_0x10d9('0x27')+_0x2fa889['ContactId'];return db[_0x10d9('0x31')][_0x10d9('0x28')](_0x5af596,{'type':db[_0x10d9('0x29')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x10d9('0x24')](function(_0x42fd70){if(_0x42fd70){_0x2fa889[_0x10d9('0x2a')]=_0x42fd70[0x0];}if(typeof _0x2fa889[_0x10d9('0x2b')]===_0x10d9('0x26'))return;return getAgent(_0x2fa889[_0x10d9('0x2b')]);})[_0x10d9('0x24')](function(_0x355157){if(_0x355157){_0x2fa889[_0x10d9('0x32')]=util[_0x10d9('0x33')](_0x10d9('0x2c'),_0x355157[_0x10d9('0x2d')]);_0x2fa889['agent']=_0x355157;}return request({'event':_0x3e33e8,'message':_0x2fa889});})['catch'](function(_0x2cbda3){logger[_0x10d9('0x1b')](_0x10d9('0x1c'),_0x10d9('0x34'),_0x2cbda3);});};}function afterUpdate(_0x3e4aea){return function(_0x421b57){var _0x52c83a=_0x421b57[_0x10d9('0x35')](_0x10d9('0x36'))&&_0x421b57[_0x10d9('0x36')];var _0x39c4f7=_0x421b57[_0x10d9('0x35')](_0x10d9('0x37'));if(_0x52c83a||_0x39c4f7){var _0xe79dc2=_0x52c83a?_0x10d9('0xd'):'substatus';var _0x5f30e0=_0x421b57[_0x10d9('0x1e')]({'plain':!![]});_0x5f30e0[_0x10d9('0x1f')]=_0x3e4aea;_0x5f30e0[_0x10d9('0x20')]=_0x3e4aea;_0x5f30e0[_0x10d9('0x21')]=_0x52c83a?_0x10d9('0x36'):'substatus';var _0x1f2921=_0x10d9('0x27')+_0x5f30e0['ContactId'];return db[_0x10d9('0x31')][_0x10d9('0x28')](_0x1f2921,{'type':db[_0x10d9('0x29')]['QueryTypes']['SELECT'],'raw':!![]})[_0x10d9('0x24')](function(_0x47f4b3){if(_0x47f4b3){_0x5f30e0['contact']=_0x47f4b3[0x0];}if(typeof _0x5f30e0[_0x10d9('0x2b')]==='undefined')return;return getAgent(_0x5f30e0[_0x10d9('0x2b')]);})[_0x10d9('0x24')](function(_0x19fa7b){if(_0x19fa7b){_0x5f30e0['interface']=util[_0x10d9('0x33')](_0x10d9('0x2c'),_0x19fa7b[_0x10d9('0x2d')]);_0x5f30e0[_0x10d9('0x2e')]=_0x19fa7b;}return request({'event':_0xe79dc2,'message':_0x5f30e0});})[_0x10d9('0x1d')](function(_0x284f78){logger[_0x10d9('0x1b')]('Trigger,\x20%s','AfterUpdate',_0x284f78);});}};}function getAgent(_0x27f801){return db[_0x10d9('0x38')]['find']({'where':{'id':_0x27f801},'attributes':['id',_0x10d9('0x2d'),_0x10d9('0x39'),'email',_0x10d9('0x3a')],'raw':!![]})[_0x10d9('0x24')](function(_0x54f1a0){return _0x54f1a0;});}exports[_0x10d9('0x3b')]=function(){for(var _0x34d29d=0x0;_0x34d29d=_0x5906e5[_0x77b4('0x12')]){throw Error(_0x77b4('0x13'));}_0x24e12d(_0x11eb17);})[_0x77b4('0x14')](function(_0x396c1e){_0x357218(_0x396c1e);});});}; \ No newline at end of file +var _0xfe21=['clearBlockUser','blockedAt','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes'];(function(_0x3ecf36,_0x38ed86){var _0x30bca6=function(_0x554609){while(--_0x554609){_0x3ecf36['push'](_0x3ecf36['shift']());}};_0x30bca6(++_0x38ed86);}(_0xfe21,0x18c));var _0x1fe2=function(_0x4f5329,_0x44fe2b){_0x4f5329=_0x4f5329-0x0;var _0x47d557=_0xfe21[_0x4f5329];return _0x47d557;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x1fe2('0x0'))['db'];var util=require(_0x1fe2('0x1'));var channels=[_0x1fe2('0x2'),_0x1fe2('0x3'),'chat',_0x1fe2('0x4'),_0x1fe2('0x5'),_0x1fe2('0x6'),_0x1fe2('0x7')];exports[_0x1fe2('0x8')]=function(){return channels;};exports[_0x1fe2('0x9')]=function(_0x1df8f8){_0x1df8f8=_0x1df8f8[_0x1fe2('0xa')]();return _[_0x1fe2('0xb')](channels,_0x1df8f8);};exports[_0x1fe2('0xc')]=function(_0x247c65,_0x3b4422,_0x41b2b2,_0x365101){var _0x85b2a7={'loginAttempts':_0x3b4422,'blocked':_0x41b2b2};if(!_['isUndefined'](_0x365101)){_0x85b2a7[_0x1fe2('0xd')]=_0x365101;}return _0x247c65[_0x1fe2('0xe')](_0x85b2a7);};exports['getLicense']=function(_0x5a7a2d){return new BPromise(function(_0x2426dd,_0x156b99){var _0x1f7038=0x0;if(_0x5a7a2d[_0x1fe2('0xf')]!==_0x1fe2('0x10')){_0x2426dd(_0x5a7a2d);}db[_0x1fe2('0x11')][_0x1fe2('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5a7a2d['id']}}})[_0x1fe2('0x13')](function(_0x533664){_0x1f7038=_0x533664;return util[_0x1fe2('0x14')]();})[_0x1fe2('0x13')](function(_0x8b2f70){if(_0x8b2f70&&_0x8b2f70[_0x1fe2('0x15')]&&_0x1f7038>=_0x8b2f70['agents']){throw Error(_0x1fe2('0x16'));}_0x2426dd(_0x5a7a2d);})[_0x1fe2('0x17')](function(_0x547959){_0x156b99(_0x547959);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index dfd17ab..e759d9e 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x3d1908,_0x355e0d){var _0x13b3c1=function(_0x39b63b){while(--_0x39b63b){_0x3d1908['push'](_0x3d1908['shift']());}};_0x13b3c1(++_0x355e0d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'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(_0x2a5c24,_0x1f022a){var _0x401d9e=function(_0x2617e3){while(--_0x2617e3){_0x2a5c24['push'](_0x2a5c24['shift']());}};_0x401d9e(++_0x1f022a);}(_0x7a54,0x106));var _0x47a5=function(_0x6dffed,_0x14eed1){_0x6dffed=_0x6dffed-0x0;var _0x541ed1=_0x7a54[_0x6dffed];return _0x541ed1;};'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 357e32e..b649b9f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5044=['status','render','json','404'];(function(_0x28cde3,_0x54a460){var _0x178b58=function(_0xd80b51){while(--_0xd80b51){_0x28cde3['push'](_0x28cde3['shift']());}};_0x178b58(++_0x54a460);}(_0x5044,0x1ef));var _0x4504=function(_0x16bc0b,_0x3daa66){_0x16bc0b=_0x16bc0b-0x0;var _0x5cd6ff=_0x5044[_0x16bc0b];return _0x5cd6ff;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3af78a,_0x4f5c80){var _0x36f66d=_0x4504('0x0');var _0x455bec=0x194;var _0x56527d={'status':_0x455bec};_0x4f5c80[_0x4504('0x1')](_0x56527d[_0x4504('0x1')]);_0x4f5c80[_0x4504('0x2')](_0x36f66d,{},function(_0x2e67f0,_0x2e2664){if(_0x2e67f0){return _0x4f5c80['status'](_0x56527d[_0x4504('0x1')])[_0x4504('0x3')](_0x56527d);}_0x4f5c80['send'](_0x2e2664);});}; \ No newline at end of file +var _0x9017=['send','exports','404','status'];(function(_0x503be0,_0x254ab5){var _0x2300f6=function(_0x17c3c4){while(--_0x17c3c4){_0x503be0['push'](_0x503be0['shift']());}};_0x2300f6(++_0x254ab5);}(_0x9017,0x149));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x7901('0x0')][0x194]=function pageNotFound(_0x3e42f9,_0xcf0009){var _0x2fd856=_0x7901('0x1');var _0x23f2e5=0x194;var _0x16fc9c={'status':_0x23f2e5};_0xcf0009['status'](_0x16fc9c[_0x7901('0x2')]);_0xcf0009['render'](_0x2fd856,{},function(_0x1e0fe2,_0x45762c){if(_0x1e0fe2){return _0xcf0009[_0x7901('0x2')](_0x16fc9c['status'])['json'](_0x16fc9c);}_0xcf0009[_0x7901('0x3')](_0x45762c);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index df43424..b9402d6 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(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 e11d780..17c479e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b0=['./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./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/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/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/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects'];(function(_0x29f7a1,_0x39c97d){var _0x331691=function(_0x500692){while(--_0x500692){_0x29f7a1['push'](_0x29f7a1['shift']());}};_0x331691(++_0x39c97d);}(_0xc3b0,0x166));var _0x0c3b=function(_0x15f22f,_0x15dde5){_0x15f22f=_0x15f22f-0x0;var _0x5434ea=_0xc3b0[_0x15f22f];return _0x5434ea;};'use strict';var path=require(_0x0c3b('0x0'));var express=require(_0x0c3b('0x1'));var errors=require(_0x0c3b('0x2'));var config=require(_0x0c3b('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x0c3b('0x4'));exports[_0x0c3b('0x5')]=function(_0x508b38){return setupLoggers(_0x508b38)[_0x0c3b('0x6')](function(){_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8'),require('./api/user'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9'),require(_0x0c3b('0xa')));_0x508b38['use']('/api/voice/contexts',require('./api/voiceContext'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb'),require(_0x0c3b('0xc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd'),require(_0x0c3b('0xe')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf'),require(_0x0c3b('0x10')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x11'),require(_0x0c3b('0x12')));_0x508b38['use'](_0x0c3b('0x13'),require('./api/screenRecording'));_0x508b38[_0x0c3b('0x7')]('/api/voice/mails',require(_0x0c3b('0x14')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x15'),require(_0x0c3b('0x16')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x17'),require('./api/voiceCallReport'));_0x508b38[_0x0c3b('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x18'),require(_0x0c3b('0x19')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x1a'),require('./api/voiceQueueReport'));_0x508b38['use'](_0x0c3b('0x1b'),require(_0x0c3b('0x1c')));_0x508b38[_0x0c3b('0x7')]('/api/trunks',require(_0x0c3b('0x1d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x1e'),require(_0x0c3b('0x1f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x20'),require(_0x0c3b('0x21')));_0x508b38['use'](_0x0c3b('0x22'),require('./api/mailAccount'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x23'),require(_0x0c3b('0x24')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x25'),require(_0x0c3b('0x26')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x27'),require(_0x0c3b('0x28')));_0x508b38['use'](_0x0c3b('0x29'),require(_0x0c3b('0x2a')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x2b'),require(_0x0c3b('0x2c')));_0x508b38['use'](_0x0c3b('0x2d'),require('./api/mailQueueReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x2e'),require(_0x0c3b('0x2f')));_0x508b38['use'](_0x0c3b('0x30'),require(_0x0c3b('0x31')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x32'),require(_0x0c3b('0x33')));_0x508b38[_0x0c3b('0x7')]('/api/fax/applications',require('./api/faxApplication'));_0x508b38['use']('/api/fax/interactions',require(_0x0c3b('0x34')));_0x508b38[_0x0c3b('0x7')]('/api/fax/messages',require(_0x0c3b('0x35')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x36'),require('./api/faxQueue'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x37'),require(_0x0c3b('0x38')));_0x508b38[_0x0c3b('0x7')]('/api/sms/accounts',require(_0x0c3b('0x39')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3a'),require(_0x0c3b('0x3b')));_0x508b38[_0x0c3b('0x7')]('/api/sms/interactions',require(_0x0c3b('0x3c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3d'),require(_0x0c3b('0x3e')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3f'),require(_0x0c3b('0x40')));_0x508b38['use'](_0x0c3b('0x41'),require('./api/openchannelAccount'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x42'),require('./api/openchannelApplication'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x43'),require(_0x0c3b('0x44')));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/messages',require(_0x0c3b('0x45')));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/queues',require(_0x0c3b('0x46')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x47'),require('./api/chatWebsite'));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/reports/queue',require(_0x0c3b('0x48')));_0x508b38['use'](_0x0c3b('0x49'),require(_0x0c3b('0x4a')));_0x508b38[_0x0c3b('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x508b38['use'](_0x0c3b('0x4b'),require(_0x0c3b('0x4c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x4d'),require('./api/chatOfflineMessage'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x4e'),require(_0x0c3b('0x4f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x50'),require(_0x0c3b('0x51')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x52'),require(_0x0c3b('0x53')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x54'),require(_0x0c3b('0x55')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x56'),require('./api/cmContact'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x57'),require(_0x0c3b('0x58')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x59'),require(_0x0c3b('0x5a')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5b'),require(_0x0c3b('0x5c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5d'),require('./api/cmHopperHistory'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5e'),require(_0x0c3b('0x5f')));_0x508b38[_0x0c3b('0x7')]('/api/actions',require(_0x0c3b('0x60')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x61'),require('./api/automation'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x62'),require('./api/cannedAnswer'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x63'),require(_0x0c3b('0x64')));_0x508b38['use']('/api/conditions',require(_0x0c3b('0x65')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x66'),require(_0x0c3b('0x67')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x68'),require(_0x0c3b('0x69')));_0x508b38[_0x0c3b('0x7')]('/api/cdr',require(_0x0c3b('0x6a')));_0x508b38[_0x0c3b('0x7')]('/api/voiceQueuesLog',require(_0x0c3b('0x6b')));_0x508b38[_0x0c3b('0x7')]('/api/schedules',require(_0x0c3b('0x6c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x6d'),require(_0x0c3b('0x6e')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x6f'),require(_0x0c3b('0x70')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x71'),require(_0x0c3b('0x72')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x73'),require('./api/cmContactHasItem'));_0x508b38['use'](_0x0c3b('0x74'),require(_0x0c3b('0x75')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x76'),require('./api/template'));_0x508b38['use'](_0x0c3b('0x77'),require(_0x0c3b('0x78')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x79'),require('./api/variable'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x7a'),require(_0x0c3b('0x7b')));_0x508b38['use'](_0x0c3b('0x7c'),require(_0x0c3b('0x7d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x7e'),require(_0x0c3b('0x7f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x80'),require(_0x0c3b('0x81')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x82'),require(_0x0c3b('0x83')));_0x508b38[_0x0c3b('0x7')]('/api/analytics/metrics',require(_0x0c3b('0x84')));_0x508b38['use'](_0x0c3b('0x85'),require(_0x0c3b('0x86')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x87'),require(_0x0c3b('0x88')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/salesforce/accounts',require(_0x0c3b('0x89')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8a'),require(_0x0c3b('0x8b')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8c'),require(_0x0c3b('0x8d')));_0x508b38['use'](_0x0c3b('0x8e'),require('./api/intSugarcrmAccount'));_0x508b38['use'](_0x0c3b('0x8f'),require(_0x0c3b('0x90')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/sugarcrm/fields',require(_0x0c3b('0x91')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x92'),require(_0x0c3b('0x93')));_0x508b38['use'](_0x0c3b('0x94'),require('./api/intDeskConfiguration'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x95'),require(_0x0c3b('0x96')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x97'),require(_0x0c3b('0x98')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x99'),require(_0x0c3b('0x9a')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/zoho/fields',require(_0x0c3b('0x9b')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9c'),require(_0x0c3b('0x9d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9e'),require(_0x0c3b('0x9f')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/zendesk/fields',require(_0x0c3b('0xa0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa1'),require(_0x0c3b('0xa2')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/freshdesk/configurations',require(_0x0c3b('0xa3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa4'),require(_0x0c3b('0xa5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa6'),require(_0x0c3b('0xa7')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/vtiger/configurations',require(_0x0c3b('0xa8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa9'),require('./api/intVtigerField'));_0x508b38[_0x0c3b('0x7')]('/api/integrations/servicenow/accounts',require(_0x0c3b('0xaa')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xab'),require(_0x0c3b('0xac')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/servicenow/fields',require(_0x0c3b('0xad')));_0x508b38['use'](_0x0c3b('0xae'),require(_0x0c3b('0xaf')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb0'),require(_0x0c3b('0xb1')));_0x508b38['use'](_0x0c3b('0xb2'),require(_0x0c3b('0xb3')));_0x508b38['use'](_0x0c3b('0xb4'),require(_0x0c3b('0xb5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb6'),require(_0x0c3b('0xb7')));_0x508b38['use'](_0x0c3b('0xb8'),require(_0x0c3b('0xb9')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xba'),require(_0x0c3b('0xbb')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbc'),require('./api/chatQueueReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbd'),require(_0x0c3b('0xbe')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbf'),require(_0x0c3b('0xc0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc1'),require('./api/jscriptyQuestionReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc2'),require('./api/jscriptySessionReport'));_0x508b38['use'](_0x0c3b('0xc3'),require(_0x0c3b('0xc4')));_0x508b38['use']('/api/square/reports',require(_0x0c3b('0xc5')));_0x508b38[_0x0c3b('0x7')]('/api/square/details/reports',require(_0x0c3b('0xc6')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc7'),require(_0x0c3b('0xc8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc9'),require(_0x0c3b('0xca')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xcb'),require(_0x0c3b('0xcc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xcd'),require(_0x0c3b('0xce')));_0x508b38[_0x0c3b('0x7')]('/api/square/recordings',require(_0x0c3b('0xcf')));_0x508b38[_0x0c3b('0x7')]('/api/square/messages',require(_0x0c3b('0xd0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd1'),require('./api/team'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd2'),require(_0x0c3b('0xd3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd4'),require(_0x0c3b('0xd5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd6'),require('./api/migration'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd7'),require(_0x0c3b('0xd8')));_0x508b38[_0x0c3b('0x7')]('/api/plugins',require(_0x0c3b('0xd9')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xda'),require(_0x0c3b('0xdb')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xdc'),require(_0x0c3b('0xdd')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xde'),require(_0x0c3b('0xdf')));_0x508b38['use'](_0x0c3b('0xe0'),require(_0x0c3b('0xe1')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe2'),require(_0x0c3b('0xe3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe4'),require(_0x0c3b('0xe5')));_0x508b38[_0x0c3b('0x7')]('/api/voice/prefixes',require(_0x0c3b('0xe6')));_0x508b38[_0x0c3b('0x7')]('/api/userProfiles',require('./api/userProfile'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe7'),require(_0x0c3b('0xe8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe9'),require('./api/userProfileResource'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xea'),require('./api/userNotification'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xeb'),require(_0x0c3b('0xec')));_0x508b38['use'](_0x0c3b('0xed'),require('./api/whatsappApplication'));_0x508b38[_0x0c3b('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x508b38['use'](_0x0c3b('0xee'),require('./api/whatsappMessage'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xef'),require(_0x0c3b('0xf0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf1'),require(_0x0c3b('0xf2')));_0x508b38[_0x0c3b('0x7')]('/api/whatsapp/queues',require(_0x0c3b('0xf3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf4'),require(_0x0c3b('0xf5')));_0x508b38[_0x0c3b('0x7')]('/api/realtime',require(_0x0c3b('0xf6')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf7'),require(_0x0c3b('0xf8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf9'),require(_0x0c3b('0xfa')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfb'),require(_0x0c3b('0xfc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfd'),require('./api/authActiveDirectory'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfe'),require('./api/jira'));_0x508b38[_0x0c3b('0x7')]('/api/rpc',require(_0x0c3b('0xff')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x100'),require(_0x0c3b('0x101')));_0x508b38['use'](_0x0c3b('0x102'),require(_0x0c3b('0x103')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x104'),require(_0x0c3b('0x105')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x106'),require(_0x0c3b('0x107')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x108'),clientSideLogs);_0x508b38['use'](_0x0c3b('0x109'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],'/apidoc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x10d'),express['static'](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10d'))));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x10e'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10e'))));_0x508b38['use']('/snippet',express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10f'),'3.5.0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x110'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],'/server/files/plugins')));_0x508b38[_0x0c3b('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x0c3b('0x112')](errors[0x194]);_0x508b38[_0x0c3b('0x111')]('/*')[_0x0c3b('0x112')](function(_0x5be0ef,_0x42eba8){_0x42eba8[_0x0c3b('0x113')](path[_0x0c3b('0x114')](_0x508b38[_0x0c3b('0x112')](_0x0c3b('0x115'))+_0x0c3b('0x116')));});return _0x508b38;});}; \ No newline at end of file +var _0x8e0d=['/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./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/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/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','/api/logs','static','join','root','/www','/demo','/snippet','snippet','3.5.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./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/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration'];(function(_0x196119,_0x4108de){var _0xa3ddce=function(_0x2c618a){while(--_0x2c618a){_0x196119['push'](_0x196119['shift']());}};_0xa3ddce(++_0x4108de);}(_0x8e0d,0x82));var _0xd8e0=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x8e0d[_0xa79977];return _0x109f10;};'use strict';var path=require(_0xd8e0('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0xd8e0('0x1'));var setupLoggers=require(_0xd8e0('0x2'))['setupLoggers'];var clientSideLogs=require(_0xd8e0('0x3'));exports[_0xd8e0('0x4')]=function(_0x14598d){return setupLoggers(_0x14598d)[_0xd8e0('0x5')](function(){_0x14598d['use']('/api/users',require(_0xd8e0('0x6')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x8'),require(_0xd8e0('0x9')));_0x14598d['use'](_0xd8e0('0xa'),require(_0xd8e0('0xb')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc'),require(_0xd8e0('0xd')));_0x14598d['use'](_0xd8e0('0xe'),require('./api/voiceMusicOnHold'));_0x14598d[_0xd8e0('0x7')]('/api/voice/queues',require('./api/voiceQueue'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xf'),require(_0xd8e0('0x10')));_0x14598d['use']('/api/screen/recordings',require(_0xd8e0('0x11')));_0x14598d['use'](_0xd8e0('0x12'),require('./api/voiceMail'));_0x14598d['use']('/api/voice/mails/messages',require(_0xd8e0('0x13')));_0x14598d['use'](_0xd8e0('0x14'),require(_0xd8e0('0x15')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x16'),require(_0xd8e0('0x17')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x18'),require(_0xd8e0('0x19')));_0x14598d[_0xd8e0('0x7')]('/api/voice/queues/reports',require(_0xd8e0('0x1a')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x1b'),require(_0xd8e0('0x1c')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x1d'),require(_0xd8e0('0x1e')));_0x14598d[_0xd8e0('0x7')]('/api/voice/transfers/reports',require(_0xd8e0('0x1f')));_0x14598d[_0xd8e0('0x7')]('/api/mail/out_servers',require(_0xd8e0('0x20')));_0x14598d['use']('/api/mail/accounts',require('./api/mailAccount'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x21'),require('./api/mailQueue'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x22'),require(_0xd8e0('0x23')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x24'),require(_0xd8e0('0x25')));_0x14598d['use'](_0xd8e0('0x26'),require(_0xd8e0('0x27')));_0x14598d['use']('/api/mail/applications',require('./api/mailApplication'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x28'),require(_0xd8e0('0x29')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x2a'),require('./api/dashboard'));_0x14598d['use'](_0xd8e0('0x2b'),require(_0xd8e0('0x2c')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x2d'),require('./api/faxAccount'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x2e'),require(_0xd8e0('0x2f')));_0x14598d[_0xd8e0('0x7')]('/api/fax/interactions',require(_0xd8e0('0x30')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x31'),require(_0xd8e0('0x32')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x33'),require(_0xd8e0('0x34')));_0x14598d['use'](_0xd8e0('0x35'),require(_0xd8e0('0x36')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x37'),require(_0xd8e0('0x38')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x39'),require(_0xd8e0('0x3a')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x3b'),require(_0xd8e0('0x3c')));_0x14598d['use'](_0xd8e0('0x3d'),require(_0xd8e0('0x3e')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x3f'),require(_0xd8e0('0x40')));_0x14598d[_0xd8e0('0x7')]('/api/openchannel/accounts',require(_0xd8e0('0x41')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x42'),require(_0xd8e0('0x43')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x44'),require('./api/openchannelInteraction'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x45'),require(_0xd8e0('0x46')));_0x14598d['use'](_0xd8e0('0x47'),require('./api/openchannelQueue'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x48'),require(_0xd8e0('0x49')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x4a'),require(_0xd8e0('0x4b')));_0x14598d['use'](_0xd8e0('0x4c'),require(_0xd8e0('0x4d')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x4e'),require(_0xd8e0('0x4f')));_0x14598d['use'](_0xd8e0('0x50'),require(_0xd8e0('0x51')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x52'),require(_0xd8e0('0x53')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x54'),require(_0xd8e0('0x55')));_0x14598d[_0xd8e0('0x7')]('/api/chat/groups',require(_0xd8e0('0x56')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x57'),require(_0xd8e0('0x58')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x59'),require(_0xd8e0('0x5a')));_0x14598d['use'](_0xd8e0('0x5b'),require(_0xd8e0('0x5c')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x5d'),require(_0xd8e0('0x5e')));_0x14598d[_0xd8e0('0x7')]('/api/cm/hopper_black',require(_0xd8e0('0x5f')));_0x14598d[_0xd8e0('0x7')]('/api/cm/hopper_final',require(_0xd8e0('0x60')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x61'),require(_0xd8e0('0x62')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x63'),require(_0xd8e0('0x64')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x65'),require(_0xd8e0('0x66')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x67'),require(_0xd8e0('0x68')));_0x14598d['use']('/api/canned_answers',require(_0xd8e0('0x69')));_0x14598d['use'](_0xd8e0('0x6a'),require(_0xd8e0('0x6b')));_0x14598d['use'](_0xd8e0('0x6c'),require(_0xd8e0('0x6d')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x6e'),require(_0xd8e0('0x6f')));_0x14598d['use'](_0xd8e0('0x70'),require(_0xd8e0('0x71')));_0x14598d[_0xd8e0('0x7')]('/api/cdr',require('./api/cdr'));_0x14598d['use'](_0xd8e0('0x72'),require(_0xd8e0('0x73')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x74'),require(_0xd8e0('0x75')));_0x14598d[_0xd8e0('0x7')]('/api/sounds',require(_0xd8e0('0x76')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x77'),require(_0xd8e0('0x78')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x79'),require(_0xd8e0('0x7a')));_0x14598d[_0xd8e0('0x7')]('/api/cm_contact_has_items',require(_0xd8e0('0x7b')));_0x14598d[_0xd8e0('0x7')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x7c'),require(_0xd8e0('0x7d')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x7e'),require(_0xd8e0('0x7f')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x80'),require(_0xd8e0('0x81')));_0x14598d['use'](_0xd8e0('0x82'),require(_0xd8e0('0x83')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/reports',require(_0xd8e0('0x84')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x85'),require(_0xd8e0('0x86')));_0x14598d['use'](_0xd8e0('0x87'),require(_0xd8e0('0x88')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x89'),require(_0xd8e0('0x8a')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x8b'),require(_0xd8e0('0x8c')));_0x14598d[_0xd8e0('0x7')]('/api/analytics/field_reports',require(_0xd8e0('0x8d')));_0x14598d['use'](_0xd8e0('0x8e'),require('./api/analyticTreeReport'));_0x14598d['use'](_0xd8e0('0x8f'),require(_0xd8e0('0x90')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x91'),require(_0xd8e0('0x92')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x93'),require('./api/intSalesforceField'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x94'),require(_0xd8e0('0x95')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xd8e0('0x96')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x97'),require(_0xd8e0('0x98')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x99'),require(_0xd8e0('0x9a')));_0x14598d['use'](_0xd8e0('0x9b'),require(_0xd8e0('0x9c')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x9d'),require(_0xd8e0('0x9e')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/zoho/accounts',require(_0xd8e0('0x9f')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xa0'),require(_0xd8e0('0xa1')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xa2'),require(_0xd8e0('0xa3')));_0x14598d['use'](_0xd8e0('0xa4'),require(_0xd8e0('0xa5')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/zendesk/configurations',require(_0xd8e0('0xa6')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xa7'),require('./api/intZendeskField'));_0x14598d['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xa8'),require(_0xd8e0('0xa9')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xaa'),require(_0xd8e0('0xab')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/vtiger/accounts',require(_0xd8e0('0xac')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xad'),require(_0xd8e0('0xae')));_0x14598d['use'](_0xd8e0('0xaf'),require(_0xd8e0('0xb0')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/servicenow/accounts',require(_0xd8e0('0xb1')));_0x14598d['use']('/api/integrations/servicenow/configurations',require(_0xd8e0('0xb2')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xb3'),require('./api/intServicenowField'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xb4'),require(_0xd8e0('0xb5')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/dynamics365/configurations',require(_0xd8e0('0xb6')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/dynamics365/fields',require(_0xd8e0('0xb7')));_0x14598d[_0xd8e0('0x7')]('/api/integrations/freshsales/accounts',require(_0xd8e0('0xb8')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xb9'),require('./api/intFreshsalesConfiguration'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xba'),require('./api/intFreshsalesField'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xbb'),require(_0xd8e0('0xbc')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xbd'),require(_0xd8e0('0xbe')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xbf'),require(_0xd8e0('0xc0')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc1'),require(_0xd8e0('0xc2')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc3'),require(_0xd8e0('0xc4')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc5'),require(_0xd8e0('0xc6')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc7'),require('./api/smsQueueReport'));_0x14598d[_0xd8e0('0x7')]('/api/square/reports',require(_0xd8e0('0xc8')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xc9'),require(_0xd8e0('0xca')));_0x14598d['use'](_0xd8e0('0xcb'),require(_0xd8e0('0xcc')));_0x14598d[_0xd8e0('0x7')]('/api/settings',require(_0xd8e0('0xcd')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xce'),require(_0xd8e0('0xcf')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xd0'),require(_0xd8e0('0xd1')));_0x14598d['use'](_0xd8e0('0xd2'),require(_0xd8e0('0xd3')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xd4'),require(_0xd8e0('0xd5')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xd6'),require('./api/team'));_0x14598d[_0xd8e0('0x7')]('/api/license',require(_0xd8e0('0xd7')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xd8'),require('./api/campaign'));_0x14598d['use'](_0xd8e0('0xd9'),require('./api/migration'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xda'),require(_0xd8e0('0xdb')));_0x14598d[_0xd8e0('0x7')]('/api/plugins',require(_0xd8e0('0xdc')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xdd'),require(_0xd8e0('0xde')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xdf'),require(_0xd8e0('0xe0')));_0x14598d['use'](_0xd8e0('0xe1'),require(_0xd8e0('0xe2')));_0x14598d['use'](_0xd8e0('0xe3'),require(_0xd8e0('0xe4')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xe5'),require(_0xd8e0('0xe6')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xe7'),require(_0xd8e0('0xe8')));_0x14598d['use']('/api/voice/prefixes',require(_0xd8e0('0xe9')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xea'),require(_0xd8e0('0xeb')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xec'),require(_0xd8e0('0xed')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xee'),require(_0xd8e0('0xef')));_0x14598d[_0xd8e0('0x7')]('/api/userNotifications',require(_0xd8e0('0xf0')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xf1'),require(_0xd8e0('0xf2')));_0x14598d['use'](_0xd8e0('0xf3'),require(_0xd8e0('0xf4')));_0x14598d['use'](_0xd8e0('0xf5'),require('./api/whatsappInteraction'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xf6'),require(_0xd8e0('0xf7')));_0x14598d['use']('/api/whatsapp/reports/queue',require(_0xd8e0('0xf8')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xf9'),require(_0xd8e0('0xfa')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xfb'),require(_0xd8e0('0xfc')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0xfd'),require(_0xd8e0('0xfe')));_0x14598d[_0xd8e0('0x7')]('/api/realtime',require(_0xd8e0('0xff')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x100'),require(_0xd8e0('0x101')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x102'),require('./api/authLocal'));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x103'),require(_0xd8e0('0x104')));_0x14598d['use'](_0xd8e0('0x105'),require(_0xd8e0('0x106')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x107'),require(_0xd8e0('0x108')));_0x14598d['use'](_0xd8e0('0x109'),require(_0xd8e0('0x10a')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x10b'),require('./api/version'));_0x14598d['use'](_0xd8e0('0x10c'),require(_0xd8e0('0x10d')));_0x14598d[_0xd8e0('0x7')]('/api/pm2',require('./api/pm2'));_0x14598d['use'](_0xd8e0('0x10e'),require(_0xd8e0('0x10f')));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x110'),clientSideLogs);_0x14598d[_0xd8e0('0x7')]('/apidoc',express[_0xd8e0('0x111')](path[_0xd8e0('0x112')](config[_0xd8e0('0x113')],'/apidoc')));_0x14598d['use'](_0xd8e0('0x114'),express[_0xd8e0('0x111')](path[_0xd8e0('0x112')](config[_0xd8e0('0x113')],_0xd8e0('0x114'))));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x115'),express[_0xd8e0('0x111')](path[_0xd8e0('0x112')](config[_0xd8e0('0x113')],_0xd8e0('0x115'))));_0x14598d[_0xd8e0('0x7')](_0xd8e0('0x116'),express['static'](path[_0xd8e0('0x112')](config[_0xd8e0('0x113')],_0xd8e0('0x117'),_0xd8e0('0x118'))));_0x14598d['use']('/plugins',express[_0xd8e0('0x111')](path[_0xd8e0('0x112')](config[_0xd8e0('0x113')],_0xd8e0('0x119'))));_0x14598d['route'](_0xd8e0('0x11a'))[_0xd8e0('0x11b')](errors[0x194]);_0x14598d['route']('/*')['get'](function(_0x33a30b,_0xb6165e){_0xb6165e[_0xd8e0('0x11c')](path['resolve'](_0x14598d['get'](_0xd8e0('0x11d'))+_0xd8e0('0x11e')));});return _0x14598d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9ba4ebf..e605536 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1487=['../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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1487,0xf2));var _0x7148=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x1487[_0x34eb31];return _0x254994;};'use strict';var jayson=require('jayson/promise');var _=require(_0x7148('0x0'));var config=require(_0x7148('0x1'));exports[_0x7148('0x2')]=function(){return new Promise(function(_0x52e7c2,_0x1f7003){var _0x474ed6={};_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x5')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x6')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x7')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x8')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x9')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xa')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xb')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xc')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xd')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0xe')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xf')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x10')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x11')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x12')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x13')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x14')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x15')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x16')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x17')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/faxInteraction/faxInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/faxMessage/faxMessage.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x18')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x19')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x1a')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1c')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1d')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x1e')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1f')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x20')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x21')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x22')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x23')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x24')));_0x474ed6=_['merge'](_0x474ed6,require('../api/cmContact/cmContact.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x25')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x26')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x27')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x28')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/interval/interval.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x29')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2a')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/template/template.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2c')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/variable/variable.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2d')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2e')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2f')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x30')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x31')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x32')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x33')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x34')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x35')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x36')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/squareProject/squareProject.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x37')));_0x474ed6=_['merge'](_0x474ed6,require('../api/squareMessage/squareMessage.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x38')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x39')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x3a')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3c')));var _0x4344ac=jayson['server'](_0x474ed6)['http']();var _0x2ca4e1=config[_0x7148('0x3d')][_0x7148('0x3e')]||config[_0x7148('0x3e')]+0x1;var _0x3bef50=config[_0x7148('0x3d')]['ip']||_0x7148('0x3f');_0x4344ac['on']('error',function(_0x1cd11c){return _0x1f7003(_0x1cd11c);});_0x4344ac[_0x7148('0x2')](_0x2ca4e1,_0x3bef50,function(){console[_0x7148('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3bef50,_0x2ca4e1);require(_0x7148('0x41'))[_0x7148('0x42')]();return _0x52e7c2(_0x7148('0x43')+_0x3bef50+':'+_0x2ca4e1);});});}; \ No newline at end of file +var _0x6cae=['../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc'];(function(_0x3b134d,_0x52a257){var _0x42fd9c=function(_0x1de2c5){while(--_0x1de2c5){_0x3b134d['push'](_0x3b134d['shift']());}};_0x42fd9c(++_0x52a257);}(_0x6cae,0xf0));var _0xe6ca=function(_0x102de6,_0x40832b){_0x102de6=_0x102de6-0x0;var _0x28dae0=_0x6cae[_0x102de6];return _0x28dae0;};'use strict';var jayson=require(_0xe6ca('0x0'));var _=require(_0xe6ca('0x1'));var config=require('../config/environment');exports[_0xe6ca('0x2')]=function(){return new Promise(function(_0x321f19,_0x3bc22b){var _0x3630f1={};_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x4')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/voiceExtension/voiceExtension.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x5')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x6')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x7')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x8')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x9')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0xa')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0xb')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0xc')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0xd')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0xe')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0xf')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x10')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x11')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x12')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/mailMessage/mailMessage.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/mailApplication/mailApplication.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x13')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x14')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x15')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x16')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x17')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x18')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x19')));_0x3630f1=_['merge'](_0x3630f1,require('../api/smsAccount/smsAccount.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x1a')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/smsMessage/smsMessage.rpc'));_0x3630f1=_['merge'](_0x3630f1,require('../api/smsQueue/smsQueue.rpc'));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x1b')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x1c')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x1d')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x1e')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x1f')));_0x3630f1=_['merge'](_0x3630f1,require('../api/chatInteraction/chatInteraction.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x20')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x21')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x22')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x23')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x24')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x25')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x26')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x27')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/pause/pause.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x28')));_0x3630f1=_['merge'](_0x3630f1,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x29')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x2a')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x2b')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x2c')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x2d')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x2e')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x2f')));_0x3630f1=_['merge'](_0x3630f1,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x30')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x31')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x32')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x33')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x34')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x35')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x36')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x37')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x38')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x39')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/squareProject/squareProject.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x3a')));_0x3630f1=_['merge'](_0x3630f1,require(_0xe6ca('0x3b')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x3c')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x3d')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/plugin/plugin.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x3e')));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x3f')));_0x3630f1=_['merge'](_0x3630f1,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3630f1=_[_0xe6ca('0x3')](_0x3630f1,require(_0xe6ca('0x40')));var _0x9a0b50=jayson[_0xe6ca('0x41')](_0x3630f1)[_0xe6ca('0x42')]();var _0x405b4e=config[_0xe6ca('0x43')]['port']||config['port']+0x1;var _0x45cbec=config[_0xe6ca('0x43')]['ip']||_0xe6ca('0x44');_0x9a0b50['on'](_0xe6ca('0x45'),function(_0x2d1416){return _0x3bc22b(_0x2d1416);});_0x9a0b50[_0xe6ca('0x2')](_0x405b4e,_0x45cbec,function(){console[_0xe6ca('0x46')](_0xe6ca('0x47'),_0x45cbec,_0x405b4e);require(_0xe6ca('0x48'))[_0xe6ca('0x49')]();return _0x321f19(_0xe6ca('0x4a')+_0x45cbec+':'+_0x405b4e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index db7b7f0..225c50a 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 _0x1d63=['GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','call','setEncoding','setTimeout','headers','line','toLowerCase','emit','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','close','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x1d63,0xa4));var _0x31d6=function(_0x4cae17,_0x2830a3){_0x4cae17=_0x4cae17-0x0;var _0x2ac6ef=_0x1d63[_0x4cae17];return _0x2ac6ef;};'use strict';var util=require(_0x31d6('0x0'));var _=require(_0x31d6('0x1'));var EventEmitter=require(_0x31d6('0x2'))[_0x31d6('0x3')];var AGIReply=require(_0x31d6('0x4'));var AGIError=require('./error');function AGIChannel(_0x2aa9f6){var _0x44ebb1=this,_0x27c1c8=new AGIReply(),_0xe4dc8b=![],_0x3e83c7={};EventEmitter[_0x31d6('0x5')](_0x44ebb1);_0x2aa9f6[_0x31d6('0x6')]('utf8');_0x2aa9f6[_0x31d6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x27c1c8[_0x31d6('0x6')]('utf8');_0x27c1c8['on'](_0x31d6('0x8'),function(_0x2c1b36){for(var _0x5ec404 in _0x2c1b36){_0x44ebb1[_0x5ec404]=_0x2c1b36[_0x5ec404];}_0x44ebb1['emit']('ready');});_0x27c1c8['on'](_0x31d6('0x9'),function(_0x341424){if(_0x341424[_0x31d6('0xa')]()=='hangup'){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0xc'));return;}if(_0x341424[_0x31d6('0xd')](0x0,0xb)==_0x31d6('0xe')){_0xe4dc8b=!![];}if(_0xe4dc8b){_0x3e83c7['rx']+=_0x341424+'\x0a';if(_0x341424[_0x31d6('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0xe4dc8b=![];}}else{_0x3e83c7['rx']=_0x341424;}if(_0xe4dc8b){return;}if(typeof _0x3e83c7['cb']==_0x31d6('0x10')){var _0x935b4f=_0x3e83c7['rx'][_0x31d6('0xd')](0x0,0x3),_0x267f2b=null,_0x4639b8=null;_0x935b4f=parseInt(_0x935b4f);if(isNaN(_0x935b4f)){_0x3e83c7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x31d6('0x11')});return;}if(_0x935b4f!=0xc8){_0x3e83c7['cb'](null,{'code':_0x935b4f,'result':-0x1,'extra':'KO'});return;}_0x267f2b=_0x3e83c7['rx']['substring'](0x4)[_0x31d6('0x12')](_0x31d6('0x13'),'');if(_0x267f2b[_0x31d6('0x14')]('\x20')!=-0x1){_0x267f2b=_0x267f2b[_0x31d6('0x15')](0x0,_0x267f2b['indexOf']('\x20'));}if(_[_0x31d6('0x16')](_0x267f2b,'-1')){_0x267f2b=parseInt(_0x267f2b);}_0x4639b8=_0x3e83c7['rx']['split']('\x20');if(_0x4639b8[_0x31d6('0x17')]==0x3){_0x4639b8=_0x4639b8[0x2][_0x31d6('0xd')](0x1,_0x4639b8[0x2][_0x31d6('0x17')]-0x1);}else if(_0x4639b8[_0x31d6('0x17')]>0x3){var _0x189784=/\((.+)\)/;var _0x437d41=_0x3e83c7['rx']['match'](_0x189784);if(_0x437d41){_0x4639b8=_0x437d41[0x1];}else{_0x4639b8=null;}}else{_0x4639b8=null;}_0x3e83c7['cb'](null,{'code':_0x935b4f,'result':_0x267f2b,'extra':_0x4639b8});}});_0x2aa9f6['on'](_0x31d6('0x18'),function(_0x403ef4){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0x18'),new AGIError(_0x31d6('0x19'),_0x403ef4[_0x31d6('0x1a')]));});_0x2aa9f6['on']('close',function(){_0x44ebb1[_0x31d6('0xb')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2aa9f6['on'](_0x31d6('0x1b'),function(){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0x1b'),new AGIError(_0x31d6('0x1c')));_0x2aa9f6[_0x31d6('0x1d')]();});_0x2aa9f6[_0x31d6('0x1e')](_0x27c1c8);this[_0x31d6('0x1f')]=function(_0x1d0351,_0x2eef78){var _0x1d0351=_0x1d0351||'',_0x2eef78=typeof _0x2eef78=='function'?_0x2eef78:new Function();_0x3e83c7={'tx':_0x1d0351,'rx':'','cb':_0x2eef78};_0x2aa9f6['write'](_0x1d0351+'\x0a');},this[_0x31d6('0x20')]=function(){_0x2aa9f6[_0x31d6('0x1d')]();};}util[_0x31d6('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x31d6('0x22')]=function(_0x2b9cc0){return this[_0x31d6('0x1f')][_0x31d6('0x23')](this,_0x2b9cc0);};AGIChannel[_0x31d6('0x24')][_0x31d6('0x25')]=function(){return this[_0x31d6('0x22')](_0x31d6('0x26'));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x27')]=function(_0x496902,_0x3823e1,_0x48fd41){_0x496902=_0x496902===undefined?'beep':_0x496902;_0x3823e1=_0x3823e1===undefined?'5':_0x3823e1;_0x48fd41=_0x48fd41===undefined?'1':_0x48fd41;return this[_0x31d6('0x22')](util['format'](_0x31d6('0x28'),_0x496902,_0x3823e1*0x3e8,_0x48fd41));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x29')]=function(_0x22f68c){_0x22f68c=_0x22f68c||_0x31d6('0x2a');return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('VERBOSE\x20\x22%s\x22',_0x22f68c));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x2c')]=function(_0xd5bc4a,_0x30ec61){if(_['isArray'](_0x30ec61)){return this[_0x31d6('0x22')](util['format'](_0x31d6('0x2d'),_0xd5bc4a,_0x30ec61[_0x31d6('0x2e')](',')));}return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('EXEC\x20%s\x20%s',_0xd5bc4a,_0x30ec61));};AGIChannel['prototype'][_0x31d6('0x2f')]=function(_0x26e822){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x30'),_0x26e822));};AGIChannel['prototype']['setExtension']=function(_0x1304cf){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('SET\x20EXTENSION\x20%s',_0x1304cf));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x31')]=function(_0x48dfb3){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('SET\x20PRIORITY\x20%s',_0x48dfb3));};AGIChannel['prototype'][_0x31d6('0xc')]=function(){return this[_0x31d6('0x22')](_0x31d6('0x32'));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x33')]=function(_0x2a8dae,_0x405d33){var _0x4049c7=_[_0x31d6('0x34')](_0x405d33)||_['isNumber'](_0x405d33)?_0x405d33[_0x31d6('0x35')]():_0x405d33;return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x36'),_0x2a8dae,_0x4049c7?_0x4049c7['toString']()[_0x31d6('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x31d6('0x37')]=function(_0x92856,_0x472d9c){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x38'),_0x92856,_0x472d9c));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x39')]=function(_0xf44e59,_0xed2655){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x3a'),_0xf44e59,_0xed2655));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3b')]=function(_0x13c194,_0x4aa0a7){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x3c'),_0x13c194,_0x4aa0a7));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3d')]=function(_0x1430e2,_0x4afd05,_0x9e3360){_0x4afd05=_0x4afd05||this[_0x31d6('0x3e')];_0x9e3360=_0x9e3360||0x1;this[_0x31d6('0x2f')](_0x1430e2);this['setExtension'](_0x4afd05);this[_0x31d6('0x31')](_0x9e3360);return this[_0x31d6('0x29')](util[_0x31d6('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1430e2,_0x4afd05,_0x9e3360));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3f')]=function(_0x4949d6){return this['sendRequest'](util['format'](_0x31d6('0x40'),_0x4949d6));};AGIChannel['prototype']['recordFile']=function(_0x5c1d85,_0x5613f5,_0x180ae6,_0x2f05c6,_0x20dbb2,_0x38cb97){_0x5613f5=_0x5613f5||_0x31d6('0x41');_0x180ae6=_0x180ae6||'';_0x2f05c6=_0x2f05c6===undefined?-0x1:_0x2f05c6==='-1'?-0x1:_0x2f05c6*0x3e8;_0x20dbb2=_0x20dbb2===undefined?'':'s='+_0x20dbb2;_0x38cb97=_0x38cb97?_0x31d6('0x42'):'';return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x43'),_0x5c1d85,_0x5613f5,_0x180ae6,_0x2f05c6,_0x38cb97,_0x20dbb2));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x44')]=function(_0x35996a,_0x188899){_0x188899=_0x188899||'';return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x45'),_0x35996a,_0x188899));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x46')]=function(_0x16b294){return this[_0x31d6('0x2c')](_0x31d6('0x47'),_0x16b294);};AGIChannel['prototype'][_0x31d6('0x48')]=function(_0x7d4824){return this[_0x31d6('0x2c')](_0x31d6('0x49'),_0x7d4824);};AGIChannel[_0x31d6('0x24')][_0x31d6('0x18')]=function(_0x431092,_0x3471ff){this[_0x31d6('0x29')](util['format'](_0x31d6('0x4a'),_0x431092['id'],_0x431092[_0x31d6('0x4b')],_0x3471ff));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xe706=['startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','pipe','command','write','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr'];(function(_0x1892ac,_0x1a0450){var _0x5ac57d=function(_0x458415){while(--_0x458415){_0x1892ac['push'](_0x1892ac['shift']());}};_0x5ac57d(++_0x1a0450);}(_0xe706,0x1ab));var _0x6e70=function(_0x5b0f89,_0x303a8b){_0x5b0f89=_0x5b0f89-0x0;var _0x21ae25=_0xe706[_0x5b0f89];return _0x21ae25;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require('events')[_0x6e70('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x6e70('0x3'));function AGIChannel(_0x1f2cd6){var _0x35e727=this,_0x5c9fb3=new AGIReply(),_0x26a1be=![],_0xdad23b={};EventEmitter[_0x6e70('0x4')](_0x35e727);_0x1f2cd6[_0x6e70('0x5')](_0x6e70('0x6'));_0x1f2cd6[_0x6e70('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5c9fb3[_0x6e70('0x5')](_0x6e70('0x6'));_0x5c9fb3['on'](_0x6e70('0x8'),function(_0x4a674f){for(var _0x4fafb2 in _0x4a674f){_0x35e727[_0x4fafb2]=_0x4a674f[_0x4fafb2];}_0x35e727[_0x6e70('0x9')](_0x6e70('0xa'));});_0x5c9fb3['on'](_0x6e70('0xb'),function(_0x68fdd3){if(_0x68fdd3[_0x6e70('0xc')]()=='hangup'){_0x35e727[_0x6e70('0x9')](_0x6e70('0xd'));return;}if(_0x68fdd3[_0x6e70('0xe')](0x0,0xb)=='520-Invalid'){_0x26a1be=!![];}if(_0x26a1be){_0xdad23b['rx']+=_0x68fdd3+'\x0a';if(_0x68fdd3[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x26a1be=![];}}else{_0xdad23b['rx']=_0x68fdd3;}if(_0x26a1be){return;}if(typeof _0xdad23b['cb']==_0x6e70('0x11')){var _0x4aff11=_0xdad23b['rx'][_0x6e70('0xe')](0x0,0x3),_0x34133e=null,_0x824c1e=null;_0x4aff11=parseInt(_0x4aff11);if(isNaN(_0x4aff11)){_0xdad23b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x12')});return;}if(_0x4aff11!=0xc8){_0xdad23b['cb'](null,{'code':_0x4aff11,'result':-0x1,'extra':'KO'});return;}_0x34133e=_0xdad23b['rx']['substring'](0x4)[_0x6e70('0x13')](_0x6e70('0x14'),'');if(_0x34133e[_0x6e70('0x15')]('\x20')!=-0x1){_0x34133e=_0x34133e[_0x6e70('0x16')](0x0,_0x34133e[_0x6e70('0x15')]('\x20'));}if(_[_0x6e70('0x17')](_0x34133e,'-1')){_0x34133e=parseInt(_0x34133e);}_0x824c1e=_0xdad23b['rx'][_0x6e70('0x18')]('\x20');if(_0x824c1e[_0x6e70('0x19')]==0x3){_0x824c1e=_0x824c1e[0x2][_0x6e70('0xe')](0x1,_0x824c1e[0x2][_0x6e70('0x19')]-0x1);}else if(_0x824c1e[_0x6e70('0x19')]>0x3){var _0x3cdfd5=/\((.+)\)/;var _0x35506a=_0xdad23b['rx']['match'](_0x3cdfd5);if(_0x35506a){_0x824c1e=_0x35506a[0x1];}else{_0x824c1e=null;}}else{_0x824c1e=null;}_0xdad23b['cb'](null,{'code':_0x4aff11,'result':_0x34133e,'extra':_0x824c1e});}});_0x1f2cd6['on']('error',function(_0x5a940f){_0x35e727[_0x6e70('0x9')](_0x6e70('0x1a'),new AGIError(_0x6e70('0x1b'),_0x5a940f['code']));});_0x1f2cd6['on'](_0x6e70('0x1c'),function(){_0x35e727[_0x6e70('0x9')](_0x6e70('0x1c'),new AGIError(_0x6e70('0x1d')));});_0x1f2cd6['on']('timeout',function(){_0x35e727['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1f2cd6['destroy']();});_0x1f2cd6[_0x6e70('0x1e')](_0x5c9fb3);this[_0x6e70('0x1f')]=function(_0x604071,_0x46dea3){var _0x604071=_0x604071||'',_0x46dea3=typeof _0x46dea3==_0x6e70('0x11')?_0x46dea3:new Function();_0xdad23b={'tx':_0x604071,'rx':'','cb':_0x46dea3};_0x1f2cd6[_0x6e70('0x20')](_0x604071+'\x0a');},this['close']=function(){_0x1f2cd6[_0x6e70('0x21')]();};}util[_0x6e70('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x6e70('0x23')][_0x6e70('0x24')]=function(_0x17e7cb){return this[_0x6e70('0x1f')][_0x6e70('0x25')](this,_0x17e7cb);};AGIChannel[_0x6e70('0x23')]['answer']=function(){return this[_0x6e70('0x24')](_0x6e70('0x26'));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x27')]=function(_0x1012aa,_0x378aca,_0x3d3ee9){_0x1012aa=_0x1012aa===undefined?'beep':_0x1012aa;_0x378aca=_0x378aca===undefined?'5':_0x378aca;_0x3d3ee9=_0x3d3ee9===undefined?'1':_0x3d3ee9;return this['sendRequest'](util['format'](_0x6e70('0x28'),_0x1012aa,_0x378aca*0x3e8,_0x3d3ee9));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x29')]=function(_0x3933a2){_0x3933a2=_0x3933a2||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x2c'),_0x3933a2));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x2d')]=function(_0x163dac,_0x1ab669){if(_[_0x6e70('0x2e')](_0x1ab669)){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x2f'),_0x163dac,_0x1ab669['join'](',')));}return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('EXEC\x20%s\x20%s',_0x163dac,_0x1ab669));};AGIChannel['prototype']['setContext']=function(_0x32836a){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SET\x20CONTEXT\x20%s',_0x32836a));};AGIChannel['prototype'][_0x6e70('0x30')]=function(_0x20070d){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SET\x20EXTENSION\x20%s',_0x20070d));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x31')]=function(_0x1614eb){return this['sendRequest'](util[_0x6e70('0x2b')](_0x6e70('0x32'),_0x1614eb));};AGIChannel[_0x6e70('0x23')][_0x6e70('0xd')]=function(){return this[_0x6e70('0x24')](_0x6e70('0x33'));};AGIChannel[_0x6e70('0x23')]['setVariable']=function(_0x49993e,_0x358ac5){var _0x405fca=_[_0x6e70('0x34')](_0x358ac5)||_[_0x6e70('0x35')](_0x358ac5)?_0x358ac5['toString']():_0x358ac5;return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x36'),_0x49993e,_0x405fca?_0x405fca[_0x6e70('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x580652,_0x3d8be4){return this['sendRequest'](util['format'](_0x6e70('0x38'),_0x580652,_0x3d8be4));};AGIChannel[_0x6e70('0x23')]['sayDigits']=function(_0x9527d3,_0x9ac887){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x39'),_0x9527d3,_0x9ac887));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3a')]=function(_0x1d0df0,_0x524291){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1d0df0,_0x524291));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3b')]=function(_0x6fbef6,_0x501c64,_0x4d303e){_0x501c64=_0x501c64||this[_0x6e70('0x3c')];_0x4d303e=_0x4d303e||0x1;this[_0x6e70('0x3d')](_0x6fbef6);this[_0x6e70('0x30')](_0x501c64);this[_0x6e70('0x31')](_0x4d303e);return this[_0x6e70('0x29')](util[_0x6e70('0x2b')](_0x6e70('0x3e'),_0x6fbef6,_0x501c64,_0x4d303e));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x3f')]=function(_0x19e6dd){return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x40'),_0x19e6dd));};AGIChannel['prototype'][_0x6e70('0x41')]=function(_0x3f2a0c,_0xc1c48,_0x309f7c,_0x1f731f,_0x4c51c8,_0x5b6b7f){_0xc1c48=_0xc1c48||_0x6e70('0x42');_0x309f7c=_0x309f7c||'';_0x1f731f=_0x1f731f===undefined?-0x1:_0x1f731f==='-1'?-0x1:_0x1f731f*0x3e8;_0x4c51c8=_0x4c51c8===undefined?'':'s='+_0x4c51c8;_0x5b6b7f=_0x5b6b7f?_0x6e70('0x43'):'';return this[_0x6e70('0x24')](util[_0x6e70('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3f2a0c,_0xc1c48,_0x309f7c,_0x1f731f,_0x5b6b7f,_0x4c51c8));};AGIChannel['prototype']['streamFile']=function(_0x3f9c17,_0x50339e){_0x50339e=_0x50339e||'';return this[_0x6e70('0x24')](util[_0x6e70('0x2b')](_0x6e70('0x44'),_0x3f9c17,_0x50339e));};AGIChannel[_0x6e70('0x23')][_0x6e70('0x45')]=function(_0x2b4ab7){return this[_0x6e70('0x2d')](_0x6e70('0x46'),_0x2b4ab7);};AGIChannel['prototype'][_0x6e70('0x47')]=function(_0x503e9d){return this[_0x6e70('0x2d')](_0x6e70('0x48'),_0x503e9d);};AGIChannel[_0x6e70('0x23')][_0x6e70('0x1a')]=function(_0x325669,_0xc501ba){this['noop'](util[_0x6e70('0x2b')](_0x6e70('0x49'),_0x325669['id'],_0x325669[_0x6e70('0x4a')],_0xc501ba));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1fade13..7dde45f 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 _0x68b6=['util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name'];(function(_0x3c9a34,_0x2e51a5){var _0x5f5458=function(_0x5de797){while(--_0x5de797){_0x3c9a34['push'](_0x3c9a34['shift']());}};_0x5f5458(++_0x2e51a5);}(_0x68b6,0xff));var _0x668b=function(_0x43f9d7,_0x39e674){_0x43f9d7=_0x43f9d7-0x0;var _0x53c2f4=_0x68b6[_0x43f9d7];return _0x53c2f4;};'use strict';var util=require(_0x668b('0x0'));var error={'E_AGI_UNDEFINED':_0x668b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x668b('0x2'),'E_AGI_SERVER_CLOSE':_0x668b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x668b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x668b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x668b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x668b('0x7'),'E_AGI_COMMAND_EMPTY':_0x668b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x668b('0x9'),'E_AGI_IVR_ENTRY':_0x668b('0xa')};function AGIError(_0xa4ed31){var _0xa4ed31=_0xa4ed31||null,_0x1e7ce2=_0x1e7ce2||[],_0x10136e=0x1,_0x4a37f2='';if(!error[_0xa4ed31]){_0xa4ed31=_0x668b('0xb');}_0x1e7ce2[_0x668b('0xc')](error[_0xa4ed31]);while(arguments[_0x10136e]){_0x1e7ce2[_0x668b('0xc')](arguments[_0x10136e]);_0x10136e++;}_0x4a37f2=util[_0x668b('0xd')]['apply'](util,_0x1e7ce2);this['message']=_0x4a37f2;this[_0x668b('0xe')]=_0xa4ed31;}module['exports']=AGIError; \ No newline at end of file +var _0xe3d5=['Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x10b1c5,_0x5622cf){var _0x210223=function(_0x527f10){while(--_0x527f10){_0x10b1c5['push'](_0x10b1c5['shift']());}};_0x210223(++_0x5622cf);}(_0xe3d5,0x84));var _0x5e3d=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xe3d5[_0x2f62aa];return _0x1a341f;};'use strict';var util=require(_0x5e3d('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5e3d('0x1'),'E_AGI_SERVER_ERROR':_0x5e3d('0x2'),'E_AGI_SERVER_CLOSE':_0x5e3d('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5e3d('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x5e3d('0x5'),'E_AGI_COMMAND_EMPTY':_0x5e3d('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5e3d('0x7'),'E_AGI_IVR_ENTRY':_0x5e3d('0x8')};function AGIError(_0x279138){var _0x279138=_0x279138||null,_0x3807d0=_0x3807d0||[],_0x1c9eb7=0x1,_0x3f142d='';if(!error[_0x279138]){_0x279138=_0x5e3d('0x9');}_0x3807d0[_0x5e3d('0xa')](error[_0x279138]);while(arguments[_0x1c9eb7]){_0x3807d0[_0x5e3d('0xa')](arguments[_0x1c9eb7]);_0x1c9eb7++;}_0x3f142d=util[_0x5e3d('0xb')]['apply'](util,_0x3807d0);this[_0x5e3d('0xc')]=_0x3f142d;this[_0x5e3d('0xd')]=_0x279138;}module[_0x5e3d('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0f3a666..28437d7 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 _0xf811=['ioredis','redis','defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xf811,0x1e8));var _0x1f81=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xf811[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x1f81('0x0'));var EventEmitter=require('events')[_0x1f81('0x1')];var Redis=require(_0x1f81('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x1f81('0x3')]=_[_0x1f81('0x4')](config[_0x1f81('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1f81('0x3')]);sub[_0x1f81('0x5')](_0x1f81('0x6'),function(_0x59bebd){if(_0x59bebd)return eventEmitter[_0x1f81('0x7')](_0x1f81('0x8'),new AGIError(_0x1f81('0x9'),_0x59bebd));});sub['on'](_0x1f81('0xa'),function(_0x462250,_0x2d73c5){if(_0x462250!==_0x1f81('0x6'))return;try{var _0xbf4d55=JSON[_0x1f81('0xb')](_0x2d73c5);eventEmitter[_0x1f81('0x7')](_0x1f81('0xc'),_0xbf4d55);}catch(_0x4fd857){eventEmitter[_0x1f81('0x7')]('error',new AGIError(_0x1f81('0x9'),_0x4fd857));}});module[_0x1f81('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xae83=['events','EventEmitter','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','lodash'];(function(_0x133ec0,_0x4ba91f){var _0x4ff979=function(_0xa28257){while(--_0xa28257){_0x133ec0['push'](_0x133ec0['shift']());}};_0x4ff979(++_0x4ba91f);}(_0xae83,0x1cf));var _0x3ae8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xae83[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x3ae8('0x0'));var EventEmitter=require(_0x3ae8('0x1'))[_0x3ae8('0x2')];var Redis=require('ioredis');var AGIError=require(_0x3ae8('0x3'));var config=require(_0x3ae8('0x4'));config[_0x3ae8('0x5')]=_[_0x3ae8('0x6')](config[_0x3ae8('0x5')],{'host':_0x3ae8('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3ae8('0x5')]);sub[_0x3ae8('0x8')]('agi',function(_0x55eae8){if(_0x55eae8)return eventEmitter[_0x3ae8('0x9')](_0x3ae8('0xa'),new AGIError(_0x3ae8('0xb'),_0x55eae8));});sub['on'](_0x3ae8('0xc'),function(_0x51d2d7,_0x462162){if(_0x51d2d7!==_0x3ae8('0xd'))return;try{var _0x3103ee=JSON[_0x3ae8('0xe')](_0x462162);eventEmitter[_0x3ae8('0x9')](_0x3ae8('0xf'),_0x3103ee);}catch(_0x429247){eventEmitter[_0x3ae8('0x9')](_0x3ae8('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x429247));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ee6a491..316fcb5 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 _0x2c12=['exports','lodash','../../../config/logger','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','vswitch','target','default','agicommand','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found'];(function(_0x51b546,_0x538a76){var _0x5e3ecb=function(_0x5785b3){while(--_0x5785b3){_0x51b546['push'](_0x51b546['shift']());}};_0x5e3ecb(++_0x538a76);}(_0x2c12,0x1b4));var _0x22c1=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x2c12[_0x1bd3ab];return _0x37e394;};'use strict';var _=require(_0x22c1('0x0'));var logger=require(_0x22c1('0x1'))('agi');var verticesWithRetry=['menu',_0x22c1('0x2'),_0x22c1('0x3')];var Graph=function(){this[_0x22c1('0x4')]={};this[_0x22c1('0x5')]={};this[_0x22c1('0x6')]=0x0;};Graph['prototype']['addVertex']=function(_0x3937c9){this['vertices'][_0x3937c9['id']]=_0x3937c9;this[_0x22c1('0x5')][_0x3937c9['id']]=[];};Graph[_0x22c1('0x7')]['addEdge']=function(_0x596323,_0x315795,_0x475e0d){this['edges'][_0x596323][_0x22c1('0x8')]({'target':_0x315795,'condition':_0x475e0d});this[_0x22c1('0x6')]+=0x1;};Graph[_0x22c1('0x7')][_0x22c1('0x9')]=function(){return _[_0x22c1('0x9')](this['vertices']);};Graph[_0x22c1('0x7')][_0x22c1('0xa')]=function(){return this[_0x22c1('0x6')];};Graph[_0x22c1('0x7')][_0x22c1('0xb')]=function(_0x455ead){return this[_0x22c1('0x4')][_0x455ead];};Graph[_0x22c1('0x7')][_0x22c1('0xc')]=function(_0x441823,_0x3e89d4){if(!this[_0x22c1('0x4')][_0x441823]){return logger[_0x22c1('0xd')](_0x22c1('0xe'));}var _0x2e1378=_0x3e89d4(this[_0x22c1('0x4')][_0x441823]);if(!_0x2e1378){return logger[_0x22c1('0xd')](_0x22c1('0xf'));}if(this[_0x22c1('0x5')][_0x441823]['length']===0x0){return logger[_0x22c1('0xd')](_0x22c1('0x10'));}for(var _0x1de2f3=0x0,_0x3117d8=[],_0x234856=![];_0x1de2f3\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleUnpublished','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','connection','lodash','syncho','util','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x813d,0x1b2));var _0xd813=function(_0xdfc347,_0x2aef5e){_0xdfc347=_0xdfc347-0x0;var _0x247fd3=_0x813d[_0xdfc347];return _0x247fd3;};'use strict';var _=require(_0xd813('0x0'));var syncho=require(_0xd813('0x1'));var util=require(_0xd813('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xd813('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0xd813('0x4'));var Project=require(_0xd813('0x5'));var AGIEmitter=require(_0xd813('0x6'))[_0xd813('0x7')];var projects=[];config[_0xd813('0x3')]=_[_0xd813('0x8')](config[_0xd813('0x3')],{'ip':_0xd813('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd813('0xa'),projectUpdateHandler);function connectionHandler(_0x8ed531){process[_0xd813('0xb')](function(){syncho(function(){try{setChannelVariables(_0x8ed531);agiHandler(_0x8ed531);}catch(_0x2d1510){logger[_0xd813('0xc')](_0x2d1510[_0xd813('0xd')]);}});});}function projectUpdateHandler(_0x1289f8){try{var _0x2cd896=_[_0xd813('0xe')](projects,['id',_0x1289f8['id']]);if(_0x2cd896>-0x1){if(_0x1289f8[_0xd813('0xf')]===!![]){projects[_0xd813('0x10')](_0x2cd896,0x1);}else{projects[_0x2cd896]=_0x1289f8;}}else{projects['push'](_0x1289f8);}}catch(_0x48397e){logger[_0xd813('0xc')](_0x48397e[_0xd813('0xd')]);}}function listeningHandler(){console[_0xd813('0x11')](_0xd813('0x12'),config[_0xd813('0x3')]['port']);logger[_0xd813('0x13')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xd813('0x3')]['ip'],config[_0xd813('0x3')][_0xd813('0x14')]));}function errorHandler(_0x43d020){if(_0x43d020&&_0x43d020[_0xd813('0x15')]&&_0x43d020['message']){logger[_0xd813('0xc')](util[_0xd813('0x16')]('[%s]\x20%s',_0x43d020[_0xd813('0x15')],_0x43d020[_0xd813('0x17')]));}else{logger[_0xd813('0xc')](util[_0xd813('0x16')](_0xd813('0x18'),_0x43d020[_0xd813('0xd')]));}}function closeHandler(){logger['info'](util[_0xd813('0x16')](_0xd813('0x19'),this[_0xd813('0x1a')],this[_0xd813('0x1b')],this[_0xd813('0x1c')],this[_0xd813('0x1d')],this[_0xd813('0x1e')]));try{createSquareReport(this);}catch(_0x534e3c){logger[_0xd813('0xc')](_0x534e3c[_0xd813('0xd')]);}}function timeoutHandler(){logger[_0xd813('0x13')](util[_0xd813('0x16')](_0xd813('0x1f'),this[_0xd813('0x1a')],this['calleridname'],this[_0xd813('0x1c')],this[_0xd813('0x1d')],this[_0xd813('0x1e')]));}function hangupHandler(){logger[_0xd813('0x13')](util['format'](_0xd813('0x20'),this[_0xd813('0x1a')],this[_0xd813('0x1b')],this[_0xd813('0x1c')],this['dnid'],this[_0xd813('0x1e')]));this[_0xd813('0x21')]=!![];}function createSquareReport(_0x30abfc,_0x5086e0){rpc[_0xd813('0x22')](_0x30abfc)[_0xd813('0x23')](function(_0xc4ffe4){if(_0x5086e0){_0x5086e0(null,_0xc4ffe4);}})[_0xd813('0x24')](function(_0x51c8af){if(_0x5086e0){_0x5086e0(null,_0x51c8af);}});}function setChannelVariables(_0xbcde04){for(var _0x4eddad in _0xbcde04){if(_0xbcde04[_0xd813('0x25')](_0x4eddad)){if(_0x4eddad[_0xd813('0x26')](_0xd813('0x27'))===0x0){_0xbcde04[_0x4eddad['substring'](0x4)]=_0xbcde04[_0x4eddad];delete _0xbcde04[_0x4eddad];}}}}function agiHandler(_0x10109c){logger['debug']('variables',JSON[_0xd813('0x28')](_0x10109c,null,0x2));logger[_0xd813('0x13')](util[_0xd813('0x16')](_0xd813('0x29'),_0x10109c['arg_1'],_0x10109c['calleridname'],_0x10109c[_0xd813('0x1c')],_0x10109c[_0xd813('0x1d')],_0x10109c['uniqueid']));_0x10109c['on']('error',errorHandler);_0x10109c['on'](_0xd813('0x2a'),closeHandler);_0x10109c['on'](_0xd813('0x2b'),timeoutHandler);_0x10109c[_0xd813('0x21')]=![];_0x10109c['on'](_0xd813('0x2c'),hangupHandler);var _0x3f3c76=_[_0xd813('0x2d')](projects,[_0xd813('0x15'),_0x10109c[_0xd813('0x1a')]]);if(!_0x3f3c76)return Project['handleNotFound'](_0x10109c);if(!_0x3f3c76['production'])return Project[_0xd813('0x2e')](_0x10109c);return Project[_0xd813('0x2f')](_0x3f3c76,_0x10109c);}function main(){var _0x73d72f;return utilLicense['getLicense']()['then'](function(_0x479af6){if(!_0x479af6)return;if(_0x479af6['voice']){if(_0x479af6[_0xd813('0x30')]&&_0x479af6[_0xd813('0x30')]>0x0){logger[_0xd813('0x13')](util['format'](_0xd813('0x31'),_0x479af6[_0xd813('0x30')]));_0x73d72f=_0x479af6[_0xd813('0x30')];}else{logger[_0xd813('0x13')](_0xd813('0x32'));}}else{logger[_0xd813('0x13')](_0xd813('0x33'));_0x73d72f=-0x1;}})['then'](function(){return Project[_0xd813('0x34')]();})['then'](function(_0x53489f){projects=_0x53489f;return;})[_0xd813('0x24')](function(_0x58373f){logger[_0xd813('0xc')]('[LICENSE]',_0x58373f[_0xd813('0xd')]);})[_0xd813('0x35')](function(){var _0x549a04=require(_0xd813('0x36'))(config[_0xd813('0x3')]['port'],config[_0xd813('0x3')]['ip'],_0x73d72f);_0x549a04['on'](_0xd813('0xc'),errorHandler);_0x549a04['on']('listening',listeningHandler);_0x549a04['on'](_0xd813('0x37'),connectionHandler);_0x549a04['on'](_0xd813('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x5ca6=['catch','finally','./server','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','timeout','find','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll'];(function(_0xc8dea4,_0x3df123){var _0xf99ad=function(_0xab0203){while(--_0xab0203){_0xc8dea4['push'](_0xc8dea4['shift']());}};_0xf99ad(++_0x3df123);}(_0x5ca6,0xf6));var _0x65ca=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x5ca6[_0x214a25];return _0x405988;};'use strict';var _=require(_0x65ca('0x0'));var syncho=require(_0x65ca('0x1'));var util=require(_0x65ca('0x2'));var config=require(_0x65ca('0x3'));var logger=require(_0x65ca('0x4'))(_0x65ca('0x5'));var utilLicense=require(_0x65ca('0x6'));var rpc=require(_0x65ca('0x7'));var Project=require('./project');var AGIEmitter=require(_0x65ca('0x8'))[_0x65ca('0x9')];var projects=[];config[_0x65ca('0x5')]=_[_0x65ca('0xa')](config[_0x65ca('0x5')],{'ip':_0x65ca('0xb'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x7d66e9){process[_0x65ca('0xc')](function(){syncho(function(){try{setChannelVariables(_0x7d66e9);agiHandler(_0x7d66e9);}catch(_0x554e5f){logger[_0x65ca('0xd')](_0x554e5f[_0x65ca('0xe')]);}});});}function projectUpdateHandler(_0x3823ea){try{var _0x37bb2d=_['findIndex'](projects,['id',_0x3823ea['id']]);if(_0x37bb2d>-0x1){if(_0x3823ea[_0x65ca('0xf')]===!![]){projects['splice'](_0x37bb2d,0x1);}else{projects[_0x37bb2d]=_0x3823ea;}}else{projects[_0x65ca('0x10')](_0x3823ea);}}catch(_0x4bd539){logger['error'](_0x4bd539[_0x65ca('0xe')]);}}function listeningHandler(){console[_0x65ca('0x11')](_0x65ca('0x12'),config[_0x65ca('0x5')][_0x65ca('0x13')]);logger[_0x65ca('0x14')](util[_0x65ca('0x15')](_0x65ca('0x16'),config[_0x65ca('0x5')]['ip'],config[_0x65ca('0x5')][_0x65ca('0x13')]));}function errorHandler(_0x3a700d){if(_0x3a700d&&_0x3a700d['name']&&_0x3a700d[_0x65ca('0x17')]){logger[_0x65ca('0xd')](util[_0x65ca('0x15')](_0x65ca('0x18'),_0x3a700d[_0x65ca('0x19')],_0x3a700d[_0x65ca('0x17')]));}else{logger['error'](util['format'](_0x65ca('0x1a'),_0x3a700d[_0x65ca('0xe')]));}}function closeHandler(){logger[_0x65ca('0x14')](util[_0x65ca('0x15')](_0x65ca('0x1b'),this[_0x65ca('0x1c')],this[_0x65ca('0x1d')],this[_0x65ca('0x1e')],this[_0x65ca('0x1f')],this[_0x65ca('0x20')]));try{createSquareReport(this);}catch(_0x238961){logger[_0x65ca('0xd')](_0x238961['stack']);}}function timeoutHandler(){logger[_0x65ca('0x14')](util[_0x65ca('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x65ca('0x1d')],this[_0x65ca('0x1e')],this[_0x65ca('0x1f')],this[_0x65ca('0x20')]));}function hangupHandler(){logger[_0x65ca('0x14')](util[_0x65ca('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x65ca('0x1c')],this[_0x65ca('0x1d')],this[_0x65ca('0x1e')],this[_0x65ca('0x1f')],this[_0x65ca('0x20')]));this[_0x65ca('0x21')]=!![];}function createSquareReport(_0x491ab5,_0x48c89e){rpc[_0x65ca('0x22')](_0x491ab5)[_0x65ca('0x23')](function(_0x44c953){if(_0x48c89e){_0x48c89e(null,_0x44c953);}})['catch'](function(_0x216683){if(_0x48c89e){_0x48c89e(null,_0x216683);}});}function setChannelVariables(_0x3f9db2){for(var _0x1d0556 in _0x3f9db2){if(_0x3f9db2[_0x65ca('0x24')](_0x1d0556)){if(_0x1d0556[_0x65ca('0x25')](_0x65ca('0x26'))===0x0){_0x3f9db2[_0x1d0556[_0x65ca('0x27')](0x4)]=_0x3f9db2[_0x1d0556];delete _0x3f9db2[_0x1d0556];}}}}function agiHandler(_0x2f8713){logger[_0x65ca('0x28')](_0x65ca('0x29'),JSON[_0x65ca('0x2a')](_0x2f8713,null,0x2));logger[_0x65ca('0x14')](util[_0x65ca('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2f8713['arg_1'],_0x2f8713[_0x65ca('0x1d')],_0x2f8713[_0x65ca('0x1e')],_0x2f8713[_0x65ca('0x1f')],_0x2f8713[_0x65ca('0x20')]));_0x2f8713['on'](_0x65ca('0xd'),errorHandler);_0x2f8713['on']('close',closeHandler);_0x2f8713['on'](_0x65ca('0x2b'),timeoutHandler);_0x2f8713[_0x65ca('0x21')]=![];_0x2f8713['on']('hangup',hangupHandler);var _0x97cc01=_[_0x65ca('0x2c')](projects,[_0x65ca('0x19'),_0x2f8713[_0x65ca('0x1c')]]);if(!_0x97cc01)return Project['handleNotFound'](_0x2f8713);if(!_0x97cc01[_0x65ca('0x2d')])return Project[_0x65ca('0x2e')](_0x2f8713);return Project[_0x65ca('0x2f')](_0x97cc01,_0x2f8713);}function main(){var _0x1b5fa0;return utilLicense[_0x65ca('0x30')]()['then'](function(_0x5c76ae){if(!_0x5c76ae)return;if(_0x5c76ae['voice']){if(_0x5c76ae['callysquare']&&_0x5c76ae[_0x65ca('0x31')]>0x0){logger[_0x65ca('0x14')](util[_0x65ca('0x15')](_0x65ca('0x32'),_0x5c76ae[_0x65ca('0x31')]));_0x1b5fa0=_0x5c76ae[_0x65ca('0x31')];}else{logger[_0x65ca('0x14')](_0x65ca('0x33'));}}else{logger[_0x65ca('0x14')](_0x65ca('0x34'));_0x1b5fa0=-0x1;}})[_0x65ca('0x23')](function(){return Project[_0x65ca('0x35')]();})[_0x65ca('0x23')](function(_0x50b5e9){projects=_0x50b5e9;return;})[_0x65ca('0x36')](function(_0x304881){logger['error']('[LICENSE]',_0x304881[_0x65ca('0xe')]);})[_0x65ca('0x37')](function(){var _0x3d438d=require(_0x65ca('0x38'))(config[_0x65ca('0x5')][_0x65ca('0x13')],config['agi']['ip'],_0x1b5fa0);_0x3d438d['on'](_0x65ca('0xd'),errorHandler);_0x3d438d['on'](_0x65ca('0x39'),listeningHandler);_0x3d438d['on'](_0x65ca('0x3a'),connectionHandler);_0x3d438d['on'](_0x65ca('0x3b'),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 f51e204..486c4d7 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 _0x4b2d=['jayson/promise','client','http','request','then','catch','sendMailMessage','bluebird'];(function(_0x4788ca,_0x5cda70){var _0x28a6f5=function(_0xa6db8){while(--_0xa6db8){_0x4788ca['push'](_0x4788ca['shift']());}};_0x28a6f5(++_0x5cda70);}(_0x4b2d,0x1bf));var _0xd4b2=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x4b2d[_0x449b81];return _0xb9b60c;};'use strict';var BPromise=require(_0xd4b2('0x0'));var jayson=require(_0xd4b2('0x1'));var client=jayson[_0xd4b2('0x2')][_0xd4b2('0x3')]({'port':0x232b});function request(_0x51172d,_0xefc7df){return new BPromise(function(_0x41e1e1,_0x2911c5){return client[_0xd4b2('0x4')](_0x51172d,_0xefc7df)[_0xd4b2('0x5')](function(_0x318324){if(_0x318324['error']){return _0x2911c5(_0x318324['error']['message']);}else{return _0x41e1e1(_0x318324['result']);}})[_0xd4b2('0x6')](function(_0x4fe1ab){return _0x2911c5(_0x4fe1ab);});});}exports[_0xd4b2('0x7')]=function(_0x5d7f84,_0x4b2c0f){return request('SendMail',{'account':_0x5d7f84,'message':_0x4b2c0f});}; \ No newline at end of file +var _0x5239=['SendMail','bluebird','client','http','request','then','error','message','catch','sendMailMessage'];(function(_0x596ab8,_0x2b80c2){var _0x174e4f=function(_0x18e402){while(--_0x18e402){_0x596ab8['push'](_0x596ab8['shift']());}};_0x174e4f(++_0x2b80c2);}(_0x5239,0x123));var _0x9523=function(_0x3e13a2,_0x225dad){_0x3e13a2=_0x3e13a2-0x0;var _0x52ab96=_0x5239[_0x3e13a2];return _0x52ab96;};'use strict';var BPromise=require(_0x9523('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9523('0x1')][_0x9523('0x2')]({'port':0x232b});function request(_0x17c658,_0x3a2fa7){return new BPromise(function(_0x2e882c,_0x4db514){return client[_0x9523('0x3')](_0x17c658,_0x3a2fa7)[_0x9523('0x4')](function(_0x3018ee){if(_0x3018ee[_0x9523('0x5')]){return _0x4db514(_0x3018ee[_0x9523('0x5')][_0x9523('0x6')]);}else{return _0x2e882c(_0x3018ee['result']);}})[_0x9523('0x7')](function(_0x3e8782){return _0x4db514(_0x3e8782);});});}exports[_0x9523('0x8')]=function(_0x406030,_0x30672d){return request(_0x9523('0x9'),{'account':_0x406030,'message':_0x30672d});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index c1b23c4..e71136c 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 _0xc243=['util','agi','./rpc','./mailRpc','getSquareProjects','catch','stack','agicommand','retry','addVertex','omit','hasOwnProperty','isArray','length','source','target','value','toJson','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','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','traverseBFS','start','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','error','agicommand\x20not\x20found','finally','dnid','uniqueid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0xc243,0xb2));var _0x3c24=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0xc243[_0x133fe4];return _0x4c4017;};'use strict';var _=require(_0x3c24('0x0'));var moment=require('moment');var parser=require(_0x3c24('0x1'));var util=require(_0x3c24('0x2'));var logger=require('../../config/logger')(_0x3c24('0x3'));var rpc=require(_0x3c24('0x4'));var mailRpc=require(_0x3c24('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3c24('0x6')]()[_0x3c24('0x7')](function(_0x2ad3f4){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x2ad3f4[_0x3c24('0x8')]);return[];});}function addVertex(_0x1c8331,_0x287286,_0x15452b){_0x287286[_0x3c24('0x9')]=_0x15452b;if(_0x287286['hasOwnProperty'](_0x3c24('0xa'))){_0x287286['maxRetry']=parseInt(_0x287286[_0x3c24('0xa')],0xa);}_0x1c8331[_0x3c24('0xb')](_[_0x3c24('0xc')](_0x287286,'mxCell'));}function initGraph(_0xab7b9c,_0x1875c8){var _0x15d1a6=new Graph();for(var _0x482ea6 in _0xab7b9c){if(_0xab7b9c[_0x3c24('0xd')](_0x482ea6)){if(_[_0x3c24('0xe')](_0xab7b9c[_0x482ea6])){for(var _0x58131b=0x0;_0x58131b<_0xab7b9c[_0x482ea6][_0x3c24('0xf')];_0x58131b+=0x1){addVertex(_0x15d1a6,_0xab7b9c[_0x482ea6][_0x58131b],_0x482ea6);}}else{addVertex(_0x15d1a6,_0xab7b9c[_0x482ea6],_0x482ea6);}}}for(var _0x367103=0x0;_0x367103<_0x1875c8[_0x3c24('0xf')];_0x367103+=0x1){if(_0x1875c8[_0x367103][_0x3c24('0x10')]&&_0x1875c8[_0x367103][_0x3c24('0x11')]){_0x15d1a6['addEdge'](_0x1875c8[_0x367103][_0x3c24('0x10')],_0x1875c8[_0x367103][_0x3c24('0x11')],_0x1875c8[_0x367103][_0x3c24('0x12')]);}}return _0x15d1a6;}function getRoot(_0x5b36a8){return parser[_0x3c24('0x13')](_0x5b36a8,{'object':!![]})['mxGraphModel'][_0x3c24('0x14')];}function inspect(_0x175740){return util[_0x3c24('0x15')](_0x175740,{'showHidden':![],'depth':null});}function initialize(_0x57955e,_0x1d262b){var _0x3dff52=getRoot(_0x57955e[_0x3c24('0x16')]);if(!_0x3dff52||!_0x3dff52['start'])return;var _0x436d91,_0x172949,_0x1d9daa;logger[_0x3c24('0x17')](_0x3c24('0x14'),JSON[_0x3c24('0x18')](_0x3dff52,null,0x2));_0x1d262b[_0x3c24('0x19')]=moment()[_0x3c24('0x1a')](_0x3c24('0x1b'));_0x436d91=initGraph(_[_0x3c24('0xc')](_0x3dff52,'mxCell'),_0x3dff52[_0x3c24('0x1c')]);_0x172949=new Vertices(_0x1d262b,rpc,mailRpc);logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')](_0x3c24('0x1e'),_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b[_0x3c24('0x21')],_0x1d262b['dnid'],_0x1d262b['uniqueid']));_0x436d91[_0x3c24('0x22')](_0x3dff52[_0x3c24('0x23')]['id'],function(_0x3428e7){try{_0x3428e7=_0x172949[_0x3c24('0x24')](_0x3428e7);logger[_0x3c24('0x17')]('vertex',JSON[_0x3c24('0x18')](_0x3428e7,null,0x2));if(_0x3428e7['agicommand']===_0x3c24('0x25')){logger['info'](_0x3c24('0x26'));_0x1d262b[_0x3c24('0x27')]=_0x3428e7[_0x3c24('0x27')]||_0x1d262b[_0x3c24('0x27')];_0x1d262b[_0x3c24('0x28')]=_0x3428e7['extension'];_0x1d262b[_0x3c24('0x29')]=_0x3428e7[_0x3c24('0x29')]?_0x3428e7['priority']-0x1:0x1;return null;}else if(_0x3428e7&&_0x172949[_0x3428e7[_0x3c24('0x9')]]){_0x1d9daa=_0x172949[_0x3428e7[_0x3c24('0x9')]](_0x3428e7);logger['info'](_0x3c24('0x2a'),JSON[_0x3c24('0x18')](_0x1d9daa,null,0x2));if(_0x1d9daa&&_0x1d9daa[_0x3c24('0x2b')]===AGI_CODE_SUCCESS&&_0x1d9daa['result']!==AGI_RESULT_ERROR&&!_0x1d262b[_0x3c24('0x2c')]){logger[_0x3c24('0x17')](_0x3c24('0x2a'),inspect(_0x1d9daa));return _[_0x3c24('0x2d')](_0x1d9daa[_0x3c24('0x2e')])?null:_0x1d9daa[_0x3c24('0x2e')][_0x3c24('0x2f')]();}else{logger[_0x3c24('0x30')](_0x3c24('0x2a'),inspect(_0x1d9daa));return null;}}else{logger[_0x3c24('0x30')](_0x3c24('0x31'));return null;}}catch(_0x4c385a){logger[_0x3c24('0x30')](_0x4c385a['stack']);return null;}});if(_0x3dff52[_0x3c24('0x32')]){logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b[_0x3c24('0x21')],_0x1d262b[_0x3c24('0x33')],_0x1d262b[_0x3c24('0x34')]));_0x436d91['traverseBFS'](_0x3dff52[_0x3c24('0x32')]['id'],function(_0x1d568a){try{_0x1d568a=_0x172949[_0x3c24('0x24')](_0x1d568a);logger[_0x3c24('0x17')](_0x3c24('0x35'),JSON[_0x3c24('0x18')](_0x1d568a,null,0x2));if(_0x1d568a&&_0x172949[_0x1d568a[_0x3c24('0x9')]]){_0x1d9daa=_0x172949[_0x1d568a[_0x3c24('0x9')]](_0x1d568a);if(_0x1d9daa){logger[_0x3c24('0x17')](_0x3c24('0x2a'),inspect(_0x1d9daa));return _[_0x3c24('0x2d')](_0x1d9daa[_0x3c24('0x2e')])?null:_0x1d9daa['result']['toString']();}else{logger[_0x3c24('0x30')](_0x3c24('0x2a'),inspect(_0x1d9daa));return null;}}else{logger[_0x3c24('0x30')](_0x3c24('0x31'));return null;}}catch(_0x2120e2){logger[_0x3c24('0x30')](_0x2120e2[_0x3c24('0x8')]);return null;}});}logger['info'](util['format'](_0x3c24('0x36'),_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b['callerid'],_0x1d262b[_0x3c24('0x33')],_0x1d262b['uniqueid']));logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')](_0x3c24('0x37'),_0x1d262b[_0x3c24('0x27')],_0x1d262b[_0x3c24('0x28')],parseInt(_0x1d262b[_0x3c24('0x29')],0xa)+0x1));_0x1d262b[_0x3c24('0x38')](_0x1d262b['context'],_0x1d262b[_0x3c24('0x28')],parseInt(_0x1d262b[_0x3c24('0x29')],0xa)+0x1);_0x1d262b[_0x3c24('0x39')]();}function handleNotFound(_0x686c61){logger[_0x3c24('0x30')](util[_0x3c24('0x1a')](_0x3c24('0x3a'),_0x686c61[_0x3c24('0x1f')]));_0x686c61[_0x3c24('0x38')](_0x686c61[_0x3c24('0x27')],_0x686c61[_0x3c24('0x28')],parseInt(_0x686c61[_0x3c24('0x29')],0xa)+0x1);_0x686c61[_0x3c24('0x39')]();}function handleUnpublished(_0x5401de){logger[_0x3c24('0x30')](util[_0x3c24('0x1a')]('Project\x20%s\x20not\x20published',_0x5401de[_0x3c24('0x1f')]));_0x5401de[_0x3c24('0x38')](_0x5401de[_0x3c24('0x27')],_0x5401de['extension'],parseInt(_0x5401de['priority'],0xa)+0x1);_0x5401de[_0x3c24('0x39')]();}module[_0x3c24('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6ad2=['hasOwnProperty','maxRetry','addVertex','mxCell','length','source','target','addEdge','value','toJson','inspect','production','start','debug','root','stringify','joinAt','format','omit','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','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','error','finally','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6ad2,0x66));var _0x26ad=function(_0x3f79c5,_0xde0759){_0x3f79c5=_0x3f79c5-0x0;var _0x4a3979=_0x6ad2[_0x3f79c5];return _0x4a3979;};'use strict';var _=require('lodash');var moment=require(_0x26ad('0x0'));var parser=require(_0x26ad('0x1'));var util=require(_0x26ad('0x2'));var logger=require(_0x26ad('0x3'))(_0x26ad('0x4'));var rpc=require(_0x26ad('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x26ad('0x6'));var Vertices=require(_0x26ad('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x26ad('0x8')]()['catch'](function(_0x3abe46){logger['error'](_0x26ad('0x9'),_0x3abe46[_0x26ad('0xa')]);return[];});}function addVertex(_0x471692,_0x56d5be,_0xfd0985){_0x56d5be[_0x26ad('0xb')]=_0xfd0985;if(_0x56d5be[_0x26ad('0xc')]('retry')){_0x56d5be[_0x26ad('0xd')]=parseInt(_0x56d5be['retry'],0xa);}_0x471692[_0x26ad('0xe')](_['omit'](_0x56d5be,_0x26ad('0xf')));}function initGraph(_0xf2da0d,_0x2d1a7a){var _0x2b4e18=new Graph();for(var _0x407413 in _0xf2da0d){if(_0xf2da0d[_0x26ad('0xc')](_0x407413)){if(_['isArray'](_0xf2da0d[_0x407413])){for(var _0xca3c18=0x0;_0xca3c18<_0xf2da0d[_0x407413][_0x26ad('0x10')];_0xca3c18+=0x1){addVertex(_0x2b4e18,_0xf2da0d[_0x407413][_0xca3c18],_0x407413);}}else{addVertex(_0x2b4e18,_0xf2da0d[_0x407413],_0x407413);}}}for(var _0x22b126=0x0;_0x22b126<_0x2d1a7a[_0x26ad('0x10')];_0x22b126+=0x1){if(_0x2d1a7a[_0x22b126][_0x26ad('0x11')]&&_0x2d1a7a[_0x22b126][_0x26ad('0x12')]){_0x2b4e18[_0x26ad('0x13')](_0x2d1a7a[_0x22b126][_0x26ad('0x11')],_0x2d1a7a[_0x22b126][_0x26ad('0x12')],_0x2d1a7a[_0x22b126][_0x26ad('0x14')]);}}return _0x2b4e18;}function getRoot(_0x264329){return parser[_0x26ad('0x15')](_0x264329,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x215672){return util[_0x26ad('0x16')](_0x215672,{'showHidden':![],'depth':null});}function initialize(_0x230bab,_0x55d83a){var _0xd44e8f=getRoot(_0x230bab[_0x26ad('0x17')]);if(!_0xd44e8f||!_0xd44e8f[_0x26ad('0x18')])return;var _0x17748,_0x1af303,_0xf9b5e8;logger[_0x26ad('0x19')](_0x26ad('0x1a'),JSON[_0x26ad('0x1b')](_0xd44e8f,null,0x2));_0x55d83a[_0x26ad('0x1c')]=moment()[_0x26ad('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x17748=initGraph(_[_0x26ad('0x1e')](_0xd44e8f,'mxCell'),_0xd44e8f[_0x26ad('0xf')]);_0x1af303=new Vertices(_0x55d83a,rpc,mailRpc);logger[_0x26ad('0x1f')](util[_0x26ad('0x1d')](_0x26ad('0x20'),_0x55d83a[_0x26ad('0x21')],_0x55d83a[_0x26ad('0x22')],_0x55d83a[_0x26ad('0x23')],_0x55d83a[_0x26ad('0x24')],_0x55d83a[_0x26ad('0x25')]));_0x17748['traverseBFS'](_0xd44e8f[_0x26ad('0x18')]['id'],function(_0x46e215){try{_0x46e215=_0x1af303['clear'](_0x46e215);logger[_0x26ad('0x19')](_0x26ad('0x26'),JSON[_0x26ad('0x1b')](_0x46e215,null,0x2));if(_0x46e215[_0x26ad('0xb')]===_0x26ad('0x27')){logger[_0x26ad('0x1f')](_0x26ad('0x28'));_0x55d83a[_0x26ad('0x29')]=_0x46e215[_0x26ad('0x29')]||_0x55d83a[_0x26ad('0x29')];_0x55d83a['extension']=_0x46e215[_0x26ad('0x2a')];_0x55d83a[_0x26ad('0x2b')]=_0x46e215[_0x26ad('0x2b')]?_0x46e215[_0x26ad('0x2b')]-0x1:0x1;return null;}else if(_0x46e215&&_0x1af303[_0x46e215[_0x26ad('0xb')]]){_0xf9b5e8=_0x1af303[_0x46e215[_0x26ad('0xb')]](_0x46e215);logger[_0x26ad('0x1f')](_0x26ad('0x2c'),JSON['stringify'](_0xf9b5e8,null,0x2));if(_0xf9b5e8&&_0xf9b5e8[_0x26ad('0x2d')]===AGI_CODE_SUCCESS&&_0xf9b5e8[_0x26ad('0x2e')]!==AGI_RESULT_ERROR&&!_0x55d83a[_0x26ad('0x2f')]){logger['debug'](_0x26ad('0x2c'),inspect(_0xf9b5e8));return _[_0x26ad('0x30')](_0xf9b5e8[_0x26ad('0x2e')])?null:_0xf9b5e8[_0x26ad('0x2e')]['toString']();}else{logger[_0x26ad('0x31')]('response',inspect(_0xf9b5e8));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4129d2){logger[_0x26ad('0x31')](_0x4129d2[_0x26ad('0xa')]);return null;}});if(_0xd44e8f['finally']){logger['info'](util[_0x26ad('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x55d83a[_0x26ad('0x21')],_0x55d83a[_0x26ad('0x22')],_0x55d83a[_0x26ad('0x23')],_0x55d83a[_0x26ad('0x24')],_0x55d83a[_0x26ad('0x25')]));_0x17748['traverseBFS'](_0xd44e8f[_0x26ad('0x32')]['id'],function(_0x791ad1){try{_0x791ad1=_0x1af303['clear'](_0x791ad1);logger[_0x26ad('0x19')](_0x26ad('0x26'),JSON[_0x26ad('0x1b')](_0x791ad1,null,0x2));if(_0x791ad1&&_0x1af303[_0x791ad1[_0x26ad('0xb')]]){_0xf9b5e8=_0x1af303[_0x791ad1[_0x26ad('0xb')]](_0x791ad1);if(_0xf9b5e8){logger[_0x26ad('0x19')](_0x26ad('0x2c'),inspect(_0xf9b5e8));return _[_0x26ad('0x30')](_0xf9b5e8[_0x26ad('0x2e')])?null:_0xf9b5e8[_0x26ad('0x2e')]['toString']();}else{logger[_0x26ad('0x31')](_0x26ad('0x2c'),inspect(_0xf9b5e8));return null;}}else{logger[_0x26ad('0x31')](_0x26ad('0x33'));return null;}}catch(_0x3e1e6f){logger['error'](_0x3e1e6f[_0x26ad('0xa')]);return null;}});}logger['info'](util[_0x26ad('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x55d83a[_0x26ad('0x21')],_0x55d83a['calleridname'],_0x55d83a[_0x26ad('0x23')],_0x55d83a[_0x26ad('0x24')],_0x55d83a[_0x26ad('0x25')]));logger[_0x26ad('0x1f')](util['format'](_0x26ad('0x34'),_0x55d83a[_0x26ad('0x29')],_0x55d83a[_0x26ad('0x2a')],parseInt(_0x55d83a['priority'],0xa)+0x1));_0x55d83a[_0x26ad('0x35')](_0x55d83a[_0x26ad('0x29')],_0x55d83a[_0x26ad('0x2a')],parseInt(_0x55d83a[_0x26ad('0x2b')],0xa)+0x1);_0x55d83a[_0x26ad('0x36')]();}function handleNotFound(_0x451151){logger[_0x26ad('0x31')](util[_0x26ad('0x1d')](_0x26ad('0x37'),_0x451151['arg_1']));_0x451151[_0x26ad('0x35')](_0x451151['context'],_0x451151[_0x26ad('0x2a')],parseInt(_0x451151[_0x26ad('0x2b')],0xa)+0x1);_0x451151[_0x26ad('0x36')]();}function handleUnpublished(_0x55f617){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x55f617['arg_1']));_0x55f617[_0x26ad('0x35')](_0x55f617[_0x26ad('0x29')],_0x55f617[_0x26ad('0x2a')],parseInt(_0x55f617['priority'],0xa)+0x1);_0x55f617[_0x26ad('0x36')]();}module[_0x26ad('0x38')]={'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 26f6473..d6aa7ea 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 _0x4754=['substring','length','slice','emit','line','exports','Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','indexOf'];(function(_0x3e852d,_0x3cd628){var _0x2f1a81=function(_0xbc2bbd){while(--_0xbc2bbd){_0x3e852d['push'](_0x3e852d['shift']());}};_0x2f1a81(++_0x3cd628);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var Transform=require('stream')[_0x4475('0x0')];function AGIReply(_0x54d279){Transform[_0x4475('0x1')](this,_0x54d279);this['_localBuffer']='';this[_0x4475('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x4475('0x3')][_0x4475('0x4')]=function(_0x24e26c,_0x412478,_0x28c3b6){var _0x3b5300='\x0a',_0x4f10b0=['\x0a\x0a',_0x4475('0x5')],_0x3968fe=-0x1,_0x751375=-0x1,_0x52103d='',_0x2fe2c9=0x0,_0x1db9f2='',_0x3ffe94='';this['_localBuffer']+=_0x24e26c['toString']();_0x1db9f2=this[_0x4475('0x6')];if(!this['_inBody']){_0x2fe2c9=0x0;while(_0x4f10b0[_0x2fe2c9]){while((_0x751375=_0x1db9f2[_0x4475('0x7')](_0x4f10b0[_0x2fe2c9]))!=-0x1){_0x52103d=_0x4f10b0[_0x2fe2c9];_0x3ffe94=_0x1db9f2['substring'](0x0,_0x751375);_0x1db9f2=_0x1db9f2[_0x4475('0x8')](_0x751375+_0x52103d[_0x4475('0x9')]);var _0x453d84=_0x3ffe94['split'](_0x3b5300),_0x3f7e62=0x0,_0x5d9183={},_0x5bab57='',_0x29b558='',_0x105924=-0x1;while(_0x453d84[_0x3f7e62]){_0x105924=_0x453d84[_0x3f7e62]['indexOf'](':');if(_0x105924!=-0x1){_0x5bab57=_0x453d84[_0x3f7e62][_0x4475('0xa')](0x0,_0x105924)['trim']();_0x29b558=_0x453d84[_0x3f7e62][_0x4475('0xa')](_0x105924+0x1)['trim']();if(_0x5bab57[_0x4475('0x9')]>0x0){_0x5d9183[_0x5bab57]=_0x29b558;}}else{}_0x3f7e62++;}this[_0x4475('0xb')]('headers',_0x5d9183);this[_0x4475('0x2')]=!![];}_0x2fe2c9++;}this[_0x4475('0x6')]=_0x1db9f2;}else{while((_0x3968fe=_0x1db9f2['indexOf'](_0x3b5300))!=-0x1){_0x3ffe94=_0x1db9f2['substring'](0x0,_0x3968fe);this['emit'](_0x4475('0xc'),_0x3ffe94);_0x1db9f2=_0x1db9f2[_0x4475('0x8')](_0x3968fe+_0x3b5300[_0x4475('0x9')]);}this['_localBuffer']=_0x1db9f2;}_0x28c3b6();};module[_0x4475('0xd')]=AGIReply; \ No newline at end of file +var _0x7497=['_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','indexOf','slice','trim','emit','headers','line','exports','util','stream','Transform','call'];(function(_0x2edf26,_0x229eec){var _0x256d52=function(_0x2eab6a){while(--_0x2eab6a){_0x2edf26['push'](_0x2edf26['shift']());}};_0x256d52(++_0x229eec);}(_0x7497,0x13c));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x7749('0x0'));var Transform=require(_0x7749('0x1'))[_0x7749('0x2')];function AGIReply(_0x74dc6d){Transform[_0x7749('0x3')](this,_0x74dc6d);this[_0x7749('0x4')]='';this[_0x7749('0x5')]=![];}util[_0x7749('0x6')](AGIReply,Transform);AGIReply[_0x7749('0x7')][_0x7749('0x8')]=function(_0x1ab389,_0x131f78,_0x35c27b){var _0x341c81='\x0a',_0xef965f=['\x0a\x0a',_0x7749('0x9')],_0x5882e7=-0x1,_0x544812=-0x1,_0x2a6ae8='',_0x1bd19b=0x0,_0x4af29d='',_0x5505b5='';this[_0x7749('0x4')]+=_0x1ab389[_0x7749('0xa')]();_0x4af29d=this[_0x7749('0x4')];if(!this['_inBody']){_0x1bd19b=0x0;while(_0xef965f[_0x1bd19b]){while((_0x544812=_0x4af29d['indexOf'](_0xef965f[_0x1bd19b]))!=-0x1){_0x2a6ae8=_0xef965f[_0x1bd19b];_0x5505b5=_0x4af29d[_0x7749('0xb')](0x0,_0x544812);_0x4af29d=_0x4af29d['substring'](_0x544812+_0x2a6ae8[_0x7749('0xc')]);var _0x51a57d=_0x5505b5['split'](_0x341c81),_0x504caf=0x0,_0x7f2c06={},_0x405149='',_0x28202e='',_0x55c9ba=-0x1;while(_0x51a57d[_0x504caf]){_0x55c9ba=_0x51a57d[_0x504caf][_0x7749('0xd')](':');if(_0x55c9ba!=-0x1){_0x405149=_0x51a57d[_0x504caf][_0x7749('0xe')](0x0,_0x55c9ba)[_0x7749('0xf')]();_0x28202e=_0x51a57d[_0x504caf][_0x7749('0xe')](_0x55c9ba+0x1)[_0x7749('0xf')]();if(_0x405149['length']>0x0){_0x7f2c06[_0x405149]=_0x28202e;}}else{}_0x504caf++;}this[_0x7749('0x10')](_0x7749('0x11'),_0x7f2c06);this[_0x7749('0x5')]=!![];}_0x1bd19b++;}this[_0x7749('0x4')]=_0x4af29d;}else{while((_0x5882e7=_0x4af29d['indexOf'](_0x341c81))!=-0x1){_0x5505b5=_0x4af29d[_0x7749('0xb')](0x0,_0x5882e7);this[_0x7749('0x10')](_0x7749('0x12'),_0x5505b5);_0x4af29d=_0x4af29d[_0x7749('0xb')](_0x5882e7+_0x341c81['length']);}this[_0x7749('0x4')]=_0x4af29d;}_0x35c27b();};module[_0x7749('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 5b26cbd..4992892 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 _0x7341=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','http','request','then','error','result','catch','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x7341,0xe4));var _0x1734=function(_0x50734f,_0x2bdf65){_0x50734f=_0x50734f-0x0;var _0x2722f9=_0x7341[_0x50734f];return _0x2722f9;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x1734('0x0'));var client=jayson['client'][_0x1734('0x1')]({'port':0x2329});function request(_0x36397c,_0x47c889){return new Promise(function(_0x3bf99a,_0x42c26d){return client[_0x1734('0x2')](_0x36397c,_0x47c889)[_0x1734('0x3')](function(_0x2de514){if(_0x2de514[_0x1734('0x4')]){return _0x42c26d(_0x2de514[_0x1734('0x4')]['message']);}else{return _0x3bf99a(_0x2de514[_0x1734('0x5')]);}})[_0x1734('0x6')](function(_0x45c529){return _0x42c26d(_0x45c529);});});}exports['getSquareProjects']=function(){return request(_0x1734('0x7'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x1734('0x8')]=function(_0xcf0632){return request(_0x1734('0x9'),{'options':{'raw':![],'where':{'name':_0xcf0632},'attributes':[_0x1734('0xa')]}});};exports[_0x1734('0xb')]=function(_0x22afe0){return request(_0x1734('0xc'),{'options':{'raw':![],'where':{'id':_0x22afe0},'include':[{'model':_0x1734('0xd'),'as':_0x1734('0xe'),'include':[{'model':_0x1734('0xf'),'as':'CloudProvider'}]}],'attributes':['id',_0x1734('0x10'),_0x1734('0x11')],'smtp':!![]}});};exports[_0x1734('0x12')]=function(_0xcf880f){return request(_0x1734('0x9'),{'options':{'where':{'id':_0xcf880f},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x13')]=function(_0xd2f288){return request(_0x1734('0x14'),{'options':{'where':{'id':_0xd2f288},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x15')]=function(_0x27679e){return request(_0x1734('0x16'),{'options':{'where':{'id':_0x27679e},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x17')]=function(_0x24bbf3){return request(_0x1734('0x18'),{'options':{'where':{'id':_0x24bbf3},'attributes':[_0x1734('0x19')]}});};exports[_0x1734('0x1a')]=function(_0x56756c){return request('ShowUser',{'options':{'where':{'id':_0x56756c},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x1b')]=function(_0x4a86d1){return request(_0x1734('0x1c'),{'options':{'where':{'phone':_0x4a86d1['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x5b2789){return request(_0x1734('0x1d'),{'options':{'where':{'id':_0x5b2789},'attributes':['name']}});};exports[_0x1734('0x1e')]=function(_0xc4b4cc){return request('ShowSound',{'options':{'where':{'id':_0xc4b4cc},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x1e7401){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1e7401},'include':[{'model':_0x1734('0x1f'),'as':'Intervals'}]}});};exports[_0x1734('0x20')]=function(_0x42485f){return request(_0x1734('0x21'),{'options':{'where':{'id':_0x42485f},'attributes':['id',_0x1734('0x10')]}});};exports[_0x1734('0x22')]=function(_0x45593e){return request(_0x1734('0x23'),{'body':_0x45593e});};exports[_0x1734('0x24')]=function(_0x2891bb){return request('CreateSquareDetailsReport',{'body':_0x2891bb});};exports[_0x1734('0x25')]=function(_0x568e0c){return request('CreateSquareReport',{'body':_[_0x1734('0x26')](_0x568e0c,{'project_name':_0x568e0c[_0x1734('0x27')],'prev_project_name':_0x568e0c[_0x1734('0x28')]||'','is_subproject':_0x568e0c[_0x1734('0x28')]?!![]:![],'leaveAt':moment()[_0x1734('0x29')](_0x1734('0x2a'))})});};exports[_0x1734('0x2b')]=function(_0x27d6e5){return request('CreateSquareRecording',{'body':_0x27d6e5});};exports[_0x1734('0x2c')]=function(_0x52eaf5){return request(_0x1734('0x2d'),{'body':_0x52eaf5});};exports[_0x1734('0x2e')]=function(_0xfca2ad){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xfca2ad[_0x1734('0x2f')],'ListId':_0xfca2ad[_0x1734('0x30')]}}})[_0x1734('0x3')](function(_0x50efce){if(_0x50efce){return _0x50efce;}return request(_0x1734('0x31'),{'body':_0xfca2ad});});};exports[_0x1734('0x32')]=function(_0x5594c0){return request(_0x1734('0x33'),{'options':{'where':{'id':_0x5594c0},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x34')]=function(_0xf3d22e,_0x4f4d92){return request(_0x1734('0x35'),{'body':{'interface':_0x4f4d92},'options':{'where':_0xf3d22e}});};exports[_0x1734('0x36')]=function(_0x546a94,_0x4dd04a,_0x321718){return request(_0x1734('0x37'),{'body':{'type':_0x4dd04a,'uniqueid':_0x321718},'options':{'where':_0x546a94}});};exports[_0x1734('0x38')]=function(_0x3903a7){return request(_0x1734('0x39'),{'body':{},'options':{'where':_0x3903a7}});};exports[_0x1734('0x3a')]=function(_0x3ba024){return request(_0x1734('0x3b'),{'body':{},'options':{'where':_0x3ba024}});}; \ No newline at end of file +var _0x0e35=['agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','result','catch','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','agentLogin','LoginUser'];(function(_0x489cf9,_0x5501a2){var _0x1114e8=function(_0x18fe5b){while(--_0x18fe5b){_0x489cf9['push'](_0x489cf9['shift']());}};_0x1114e8(++_0x5501a2);}(_0x0e35,0xc2));var _0x50e3=function(_0xb2a88a,_0xf31598){_0xb2a88a=_0xb2a88a-0x0;var _0xec3788=_0x0e35[_0xb2a88a];return _0xec3788;};'use strict';var _=require(_0x50e3('0x0'));var moment=require(_0x50e3('0x1'));var jayson=require(_0x50e3('0x2'));var client=jayson[_0x50e3('0x3')][_0x50e3('0x4')]({'port':0x2329});function request(_0x1d3e38,_0x3925be){return new Promise(function(_0x50a6c5,_0x2ae102){return client[_0x50e3('0x5')](_0x1d3e38,_0x3925be)['then'](function(_0x86283e){if(_0x86283e[_0x50e3('0x6')]){return _0x2ae102(_0x86283e['error']['message']);}else{return _0x50a6c5(_0x86283e[_0x50e3('0x7')]);}})[_0x50e3('0x8')](function(_0x57bb5f){return _0x2ae102(_0x57bb5f);});});}exports['getSquareProjects']=function(){return request(_0x50e3('0x9'),{'options':{'raw':![],'attributes':['id',_0x50e3('0xa'),_0x50e3('0xb')]}});};exports[_0x50e3('0xc')]=function(_0x3dbc46){return request(_0x50e3('0xd'),{'options':{'raw':![],'where':{'name':_0x3dbc46},'attributes':[_0x50e3('0xb')]}});};exports[_0x50e3('0xe')]=function(_0x2d43c5){return request(_0x50e3('0xf'),{'options':{'raw':![],'where':{'id':_0x2d43c5},'include':[{'model':_0x50e3('0x10'),'as':_0x50e3('0x11'),'include':[{'model':_0x50e3('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0x50e3('0xa'),_0x50e3('0x13')],'smtp':!![]}});};exports[_0x50e3('0x14')]=function(_0x9eb0c8){return request('ShowSquareProject',{'options':{'where':{'id':_0x9eb0c8},'attributes':[_0x50e3('0xa')]}});};exports[_0x50e3('0x15')]=function(_0x4b4d6f){return request(_0x50e3('0x16'),{'options':{'where':{'id':_0x4b4d6f},'attributes':[_0x50e3('0xa')]}});};exports[_0x50e3('0x17')]=function(_0x18f144){return request(_0x50e3('0x18'),{'options':{'where':{'id':_0x18f144},'attributes':['name']}});};exports[_0x50e3('0x19')]=function(_0x5f44e1){return request(_0x50e3('0x1a'),{'options':{'where':{'id':_0x5f44e1},'attributes':[_0x50e3('0x1b')]}});};exports[_0x50e3('0x1c')]=function(_0x4b1b85){return request(_0x50e3('0x1d'),{'options':{'where':{'id':_0x4b1b85},'attributes':[_0x50e3('0xa')]}});};exports[_0x50e3('0x1e')]=function(_0x3e56b6){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3e56b6['phone']},'attributes':['id']}});};exports[_0x50e3('0x1f')]=function(_0x5d002b){return request(_0x50e3('0x20'),{'options':{'where':{'id':_0x5d002b},'attributes':[_0x50e3('0xa')]}});};exports['getSoundById']=function(_0x4d20b1){return request(_0x50e3('0x21'),{'options':{'where':{'id':_0x4d20b1},'attributes':[_0x50e3('0x22')]}});};exports['getIntervalById']=function(_0x3444e3){return request(_0x50e3('0x23'),{'options':{'raw':![],'where':{'id':_0x3444e3},'include':[{'model':_0x50e3('0x24'),'as':_0x50e3('0x25')}]}});};exports[_0x50e3('0x26')]=function(_0x164e11){return request('ShowSmsAccount',{'options':{'where':{'id':_0x164e11},'attributes':['id',_0x50e3('0xa')]}});};exports[_0x50e3('0x27')]=function(_0x37acdb){return request(_0x50e3('0x28'),{'body':_0x37acdb});};exports[_0x50e3('0x29')]=function(_0x283459){return request(_0x50e3('0x2a'),{'body':_0x283459});};exports[_0x50e3('0x2b')]=function(_0x4dec8c){return request(_0x50e3('0x2c'),{'body':_['merge'](_0x4dec8c,{'project_name':_0x4dec8c[_0x50e3('0x2d')],'prev_project_name':_0x4dec8c[_0x50e3('0x2e')]||'','is_subproject':_0x4dec8c[_0x50e3('0x2e')]?!![]:![],'leaveAt':moment()[_0x50e3('0x2f')](_0x50e3('0x30'))})});};exports['createSquareRecording']=function(_0x5af9a4){return request(_0x50e3('0x31'),{'body':_0x5af9a4});};exports['createSquareMessage']=function(_0x3675db){return request('CreateSquareMessage',{'body':_0x3675db});};exports['createCmContact']=function(_0x5e5b36){return request(_0x50e3('0x32'),{'options':{'raw':![],'where':{'phone':_0x5e5b36[_0x50e3('0x33')],'ListId':_0x5e5b36[_0x50e3('0x34')]}}})[_0x50e3('0x35')](function(_0xda5416){if(_0xda5416){return _0xda5416;}return request(_0x50e3('0x36'),{'body':_0x5e5b36});});};exports[_0x50e3('0x37')]=function(_0x2a028b){return request('ShowPause',{'options':{'where':{'id':_0x2a028b},'attributes':[_0x50e3('0xa')]}});};exports[_0x50e3('0x38')]=function(_0x34fb1c,_0x47cae9){return request(_0x50e3('0x39'),{'body':{'interface':_0x47cae9},'options':{'where':_0x34fb1c}});};exports[_0x50e3('0x3a')]=function(_0x412d48,_0x501574,_0x21c561){return request(_0x50e3('0x3b'),{'body':{'type':_0x501574,'uniqueid':_0x21c561},'options':{'where':_0x412d48}});};exports['agentUnpause']=function(_0x3ac5d0){return request(_0x50e3('0x3c'),{'body':{},'options':{'where':_0x3ac5d0}});};exports[_0x50e3('0x3d')]=function(_0x53f4d3){return request(_0x50e3('0x3e'),{'body':{},'options':{'where':_0x53f4d3}});}; \ 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 da7d733..8b6eb3e 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 _0x5334=['./polly','./lex','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5334,0x84));var _0x4533=function(_0x2d8c90,_0xebac28){_0x2d8c90=_0x2d8c90-0x0;var _0x118c87=_0x5334[_0x2d8c90];return _0x118c87;};var polly=require(_0x4533('0x0'));var lex=require(_0x4533('0x1'));module[_0x4533('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5f6f=['./polly','./lex','exports'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x33fb76,_0x450ed3){_0x33fb76=_0x33fb76-0x0;var _0x41033e=_0x5f6f[_0x33fb76];return _0x41033e;};var polly=require(_0xf5f6('0x0'));var lex=require(_0xf5f6('0x1'));module[_0xf5f6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 7b7229a..a173244 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 _0x91a7=['exports'];(function(_0x41974d,_0x1e20a0){var _0x1985de=function(_0x41c676){while(--_0x41c676){_0x41974d['push'](_0x41974d['shift']());}};_0x1985de(++_0x1e20a0);}(_0x91a7,0xe7));var _0x791a=function(_0x49372a,_0x2970c8){_0x49372a=_0x49372a-0x0;var _0x2b8144=_0x91a7[_0x49372a];return _0x2b8144;};'use strict';var lex=require('./lib/api');module[_0x791a('0x0')]=function(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392){return lex(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392);}; \ No newline at end of file +var _0xe706=['exports','./lib/api'];(function(_0x5b2a20,_0x53a830){var _0x9d623a=function(_0x312009){while(--_0x312009){_0x5b2a20['push'](_0x5b2a20['shift']());}};_0x9d623a(++_0x53a830);}(_0xe706,0xa3));var _0x6e70=function(_0x527387,_0x331638){_0x527387=_0x527387-0x0;var _0x22032f=_0xe706[_0x527387];return _0x22032f;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ 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 fafcb1d..030b70c 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(_0x5221e5,_0x3d34cc){var _0x57de23=function(_0xa78f50){while(--_0xa78f50){_0x5221e5['push'](_0x5221e5['shift']());}};_0x57de23(++_0x3d34cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x2cc115,_0x1cfd0c){var _0x3906f8=function(_0x5651b9){while(--_0x5651b9){_0x2cc115['push'](_0x2cc115['shift']());}};_0x3906f8(++_0x1cfd0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 bf5dc71..0c19bd0 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 _0x5c8e=['exports'];(function(_0x17f944,_0x54d249){var _0xb33bde=function(_0x45f723){while(--_0x45f723){_0x17f944['push'](_0x17f944['shift']());}};_0xb33bde(++_0x54d249);}(_0x5c8e,0x111));var _0xe5c8=function(_0x19cf45,_0x4f9308){_0x19cf45=_0x19cf45-0x0;var _0x280cbc=_0x5c8e[_0x19cf45];return _0x280cbc;};'use strict';var polly=require('./lib/api');module[_0xe5c8('0x0')]=function(_0x210117,_0x13c7cc,_0x28fe8a,_0x40e7ed,_0x3d4523,_0x35e679,_0x44ea64){return polly(_0x210117,_0x13c7cc,_0x28fe8a,_0x40e7ed,_0x3d4523,_0x35e679,_0x44ea64);}; \ No newline at end of file +var _0x3069=['./lib/api','exports'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x3069,0x15a));var _0x9306=function(_0x57c49b,_0x512e22){_0x57c49b=_0x57c49b-0x0;var _0x24fcb9=_0x3069[_0x57c49b];return _0x24fcb9;};'use strict';var polly=require(_0x9306('0x0'));module[_0x9306('0x1')]=function(_0x2e7112,_0x533768,_0x27fa75,_0x398ab7,_0x32a8aa,_0x5f0726,_0x2ed448){return polly(_0x2e7112,_0x533768,_0x27fa75,_0x398ab7,_0x32a8aa,_0x5f0726,_0x2ed448);}; \ 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 41a95a0..6be2b81 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 _0xfe08=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xfe08,0x11d));var _0x8fe0=function(_0xc498b3,_0x5610b4){_0xc498b3=_0xc498b3-0x0;var _0x1e2530=_0xfe08[_0xc498b3];return _0x1e2530;};'use strict';var fs=require('fs');var path=require(_0x8fe0('0x0'));var BPromise=require('bluebird');var rs=require(_0x8fe0('0x1'));var AWS=require(_0x8fe0('0x2'));function pollyResult(_0x1739ad,_0x91ca4b,_0x1ac81a){return new BPromise(function(_0xca1b6f,_0x452b8a){_0x1739ad[_0x8fe0('0x3')](_0x91ca4b,function(_0x4784a5,_0x1c47ac){if(_0x4784a5){_0x452b8a(_0x4784a5);}else if(_0x1c47ac){if(_0x1c47ac['AudioStream']instanceof Buffer){fs[_0x8fe0('0x4')](_0x1ac81a,_0x1c47ac['AudioStream'],function(_0x16612e){if(_0x16612e){_0x452b8a(_0x16612e);}else{_0xca1b6f();}});}else{_0x452b8a(new Error(_0x8fe0('0x5')));}}else{_0x452b8a(new Error(_0x8fe0('0x6')));}});});}module[_0x8fe0('0x7')]=function(_0x41d7f1,_0x1f77bd,_0x4cc384,_0x433656,_0x3ff4c6,_0x48fd19,_0x12a9a4){var _0x82cf9d=new AWS[(_0x8fe0('0x8'))]({'accessKeyId':_0x41d7f1,'secretAccessKey':_0x1f77bd,'region':_0x4cc384});var _0x15a6a2={'Text':_0x3ff4c6,'TextType':_0x48fd19||'text','OutputFormat':_0x8fe0('0x9'),'VoiceId':_0x433656};return pollyResult(_0x82cf9d,_0x15a6a2,_0x12a9a4);}; \ No newline at end of file +var _0xd55d=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','bluebird','aws-sdk'];(function(_0x148ffd,_0x3a94e2){var _0x1159cc=function(_0x55e19d){while(--_0x55e19d){_0x148ffd['push'](_0x148ffd['shift']());}};_0x1159cc(++_0x3a94e2);}(_0xd55d,0x14e));var _0xdd55=function(_0x30ae5f,_0x3a1d8a){_0x30ae5f=_0x30ae5f-0x0;var _0x38f5c2=_0xd55d[_0x30ae5f];return _0x38f5c2;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xdd55('0x0'));var rs=require('randomstring');var AWS=require(_0xdd55('0x1'));function pollyResult(_0x281ca9,_0x4e66b3,_0x27ba1a){return new BPromise(function(_0x41f349,_0xc13725){_0x281ca9[_0xdd55('0x2')](_0x4e66b3,function(_0x3839b6,_0x4f2fe6){if(_0x3839b6){_0xc13725(_0x3839b6);}else if(_0x4f2fe6){if(_0x4f2fe6[_0xdd55('0x3')]instanceof Buffer){fs[_0xdd55('0x4')](_0x27ba1a,_0x4f2fe6['AudioStream'],function(_0x58d857){if(_0x58d857){_0xc13725(_0x58d857);}else{_0x41f349();}});}else{_0xc13725(new Error(_0xdd55('0x5')));}}else{_0xc13725(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3aabed,_0x255f28,_0x30fbec,_0x5bf69e,_0xfc723b,_0x1fc3e9,_0x3e04c8){var _0x4e8545=new AWS['Polly']({'accessKeyId':_0x3aabed,'secretAccessKey':_0x255f28,'region':_0x30fbec});var _0x5ef850={'Text':_0xfc723b,'TextType':_0x1fc3e9||_0xdd55('0x6'),'OutputFormat':_0xdd55('0x7'),'VoiceId':_0x5bf69e};return pollyResult(_0x4e8545,_0x5ef850,_0x3e04c8);}; \ 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 5e2b97c..bfe94d3 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 _0xdf22=['exports','./lib/api'];(function(_0x48b029,_0x1d9037){var _0x43347f=function(_0x5d8c90){while(--_0x5d8c90){_0x48b029['push'](_0x48b029['shift']());}};_0x43347f(++_0x1d9037);}(_0xdf22,0xe3));var _0x2df2=function(_0x3a5ac7,_0x493ce8){_0x3a5ac7=_0x3a5ac7-0x0;var _0x486efd=_0xdf22[_0x3a5ac7];return _0x486efd;};'use strict';var asr=require(_0x2df2('0x0'));module[_0x2df2('0x1')]=function(_0x2ee953,_0x4b07ae,_0x5534e1,_0x16399f){return asr(_0x2ee953,_0x4b07ae,_0x5534e1);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x4d91ed,_0x5cf905,_0x5b59f2,_0x4287f9){return asr(_0x4d91ed,_0x5cf905,_0x5b59f2);}; \ 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 fc4c7f6..68e296c 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 _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x44fa9a,_0x2cce12){var _0x16d5df=function(_0x3d86f3){while(--_0x3d86f3){_0x44fa9a['push'](_0x44fa9a['shift']());}};_0x16d5df(++_0x2cce12);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4c6fcd,_0x28d2a7){_0x4c6fcd=_0x4c6fcd-0x0;var _0x364e82=_0x6f7a[_0x4c6fcd];return _0x364e82;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'json':!![]});});}; \ No newline at end of file +var _0xc36d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x5e0c67,_0xed9c5){var _0x2d447d=function(_0x357b7a){while(--_0x357b7a){_0x5e0c67['push'](_0x5e0c67['shift']());}};_0x2d447d(++_0xed9c5);}(_0xc36d,0x7d));var _0xdc36=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0xc36d[_0x400322];return _0xfdd597;};'use strict';var url=require(_0xdc36('0x0'));var BPromise=require(_0xdc36('0x1'));var fs=require('fs');var host=_0xdc36('0x2');module[_0xdc36('0x3')]=function(_0x471240,_0x2d5df5,_0x4c42dd){return new BPromise(function(_0x42522b,_0x3431f9){var _0x53ac17;if(typeof _0x471240!==_0xdc36('0x4')||_0x471240[_0xdc36('0x5')]===0x0){return _0x3431f9(_0xdc36('0x6'));}if(typeof _0x2d5df5!==_0xdc36('0x4')||_0x2d5df5[_0xdc36('0x5')]===0x0){return _0x3431f9('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c42dd!==_0xdc36('0x7')&&(typeof _0x4c42dd!==_0xdc36('0x4')||_0x4c42dd[_0xdc36('0x5')]===0x0)){return _0x3431f9(_0xdc36('0x8'));}try{_0x53ac17=fs['readFileSync'](_0x471240)[_0xdc36('0x9')](_0xdc36('0xa'));}catch(_0x573f8e){return _0x3431f9(_0x573f8e);}return _0x42522b({'method':_0xdc36('0xb'),'uri':host+_0xdc36('0xc')+_0x2d5df5,'body':{'config':{'encoding':_0xdc36('0xd'),'sampleRateHertz':'8000','languageCode':_0x4c42dd},'audio':{'content':_0x53ac17}},'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 68370a8..2df533b 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 _0xf2b9=['exports','./asr'];(function(_0x4a2176,_0x176e35){var _0x29e2c7=function(_0x15ed95){while(--_0x15ed95){_0x4a2176['push'](_0x4a2176['shift']());}};_0x29e2c7(++_0x176e35);}(_0xf2b9,0x99));var _0x9f2b=function(_0x2e89e6,_0x5ba51d){_0x2e89e6=_0x2e89e6-0x0;var _0x2c9992=_0xf2b9[_0x2e89e6];return _0x2c9992;};var asr=require(_0x9f2b('0x0'));module[_0x9f2b('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe87a=['./asr'];(function(_0x539f3a,_0x5e3f6d){var _0x3b5599=function(_0x158af2){while(--_0x158af2){_0x539f3a['push'](_0x539f3a['shift']());}};_0x3b5599(++_0x5e3f6d);}(_0xe87a,0x130));var _0xae87=function(_0x807954,_0x22eb1d){_0x807954=_0x807954-0x0;var _0x5c023e=_0xe87a[_0x807954];return _0x5c023e;};var asr=require(_0xae87('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 78721ad..400015b 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 _0xd39e=['parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','results','map','alternatives','confidence','join','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','boolValue','intent','displayName','languageCode','queryText','responseId','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','request-promise','google-tts-api','parse','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','unlink','pipe','end','protocol','WHAT_EVER','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd39e,0xc3));var _0xed39=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0xd39e[_0x256422];return _0x55dddc;};'use strict';var apiai=require(_0xed39('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xed39('0x1'));var fs=require('fs');var http=require(_0xed39('0x2'));var https=require(_0xed39('0x3'));var md5=require(_0xed39('0x4'));var path=require('path');var querystring=require('querystring');var rp=require(_0xed39('0x5'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xed39('0x6'));var urlParse=require('url')[_0xed39('0x7')];var util=require(_0xed39('0x8'));var aws=require(_0xed39('0x9'));var google=require(_0xed39('0xa'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xed39('0xb'))(_0xed39('0xc'));var ISPEECH_API=_0xed39('0xd');function downloadFile(_0x359f70,_0x43042f){return new BPromise(function(_0x2dcad1,_0x18c211){var _0x38b6be=urlParse(_0x359f70);var _0x52ce8e=_0x38b6be['protocol']===_0xed39('0xe')?https:http;var _0x4bdc75={'host':_0x38b6be['host'],'path':_0x38b6be['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x52ce8e[_0xed39('0xf')](_0x4bdc75,function(_0x1a4070){if(_0x1a4070[_0xed39('0x10')]!==0xc8){logger[_0xed39('0x11')](_0xed39('0x12')+_0x359f70+_0xed39('0x13')+_0x1a4070[_0xed39('0x10')]+'\x20('+_0x1a4070[_0xed39('0x14')]+')');_0x18c211(new Error(_0xed39('0x12')+_0x359f70+_0xed39('0x13')+_0x1a4070[_0xed39('0x10')]+'\x20('+_0x1a4070[_0xed39('0x14')]+')'));return;}var _0x1c505d=fs['createWriteStream'](_0x43042f);_0x1c505d['on']('finish',function(){logger[_0xed39('0x15')]('finish\x20download\x20file');_0x1c505d[_0xed39('0x16')](_0x2dcad1);});_0x1c505d['on'](_0xed39('0x11'),function(_0x1ffc3c){fs[_0xed39('0x17')](_0x43042f);logger['error']('download\x20error',_0x1ffc3c);_0x18c211(_0x1ffc3c);});_0x1a4070[_0xed39('0x18')](_0x1c505d);})['on'](_0xed39('0x11'),function(_0x1a38d8){logger[_0xed39('0x11')](_0x1a38d8);_0x18c211(_0x1a38d8);})[_0xed39('0x19')]();});}function uploadFile(_0x49476f){return new BPromise(function(_0x3f7205,_0x1d4948){var _0x2b3118=urlParse(_0x49476f);var _0x8481fe=_0x2b3118[_0xed39('0x1a')]===_0xed39('0xe')?https:http;var _0x3b613f={'host':_0x2b3118['host'],'path':_0x2b3118['path'],'headers':{'user-agent':_0xed39('0x1b')}};_0x8481fe['get'](_0x3b613f,function(_0x138aab){if(_0x138aab[_0xed39('0x10')]!==0xc8){_0x1d4948(new Error(_0xed39('0x12')+_0x49476f+'\x20failed,\x20status\x20code\x20=\x20'+_0x138aab[_0xed39('0x10')]+'\x20('+_0x138aab[_0xed39('0x14')]+')'));return;}var _0x2ab55f='';_0x138aab['on'](_0xed39('0x1c'),function(_0x18842b){_0x2ab55f+=_0x18842b;});_0x138aab['on']('end',function(){_0x3f7205(_0x2ab55f);});})['on'](_0xed39('0x11'),function(_0x2cd7bc){_0x1d4948(_0x2cd7bc);})[_0xed39('0x19')]();});}function convertFile(_0x46e559,_0xe400a6){return new BPromise(function(_0x48699c,_0x1545b){var _0x2ac65e=sox[_0xed39('0x1d')](_0x46e559,_0xe400a6,{'sampleRate':0x1f40,'format':_0xed39('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ac65e['on'](_0xed39('0x11'),function(_0x22188a){logger[_0xed39('0x11')]('error\x20convert',_0x22188a);_0x1545b(_0x22188a);});_0x2ac65e['on'](_0xed39('0x19'),function(){logger[_0xed39('0x15')](_0xed39('0x1f'));_0x48699c();});_0x2ac65e[_0xed39('0x20')]();});}function base64Decode(_0x154f83,_0x33be3c){var _0x2c48cb=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs['generate'](0x4)+_0xed39('0x23'));fs[_0xed39('0x24')](_0x2c48cb,_0x154f83,'base64');return convertFile(_0x2c48cb,_0x33be3c)[_0xed39('0x25')](function(){try{fs['unlink'](_0x2c48cb);fs[_0xed39('0x26')](_0x33be3c,_0xed39('0x27'));}catch(_0xd2f909){logger[_0xed39('0x11')](_0xd2f909);}return _0x33be3c[_0xed39('0x28')]('.')[0x0];});}function base64Encode(_0x5803ab){var _0x273b32=fs[_0xed39('0x29')](_0x5803ab);return new Buffer(_0x273b32)[_0xed39('0x2a')](_0xed39('0x2b'));}exports[_0xed39('0x2c')]=function(_0x1255fc,_0x45aff1,_0x4e4f93,_0x29ef6d,_0x562869,_0x31c319){var _0xbf6ce4,_0x54c796;var _0x350762=_0xed39('0x2d');var _0x3d5eb5=_0xed39('0x2e')+_0x1255fc;var _0x5efc62={};if(_0x45aff1===_0xed39('0x2f')){_0x5efc62[_0xed39('0x30')]={'ssml':_0x4e4f93};}else{_0x5efc62['input']={'text':_0x4e4f93};};_0x5efc62[_0xed39('0x31')]={'languageCode':_0x29ef6d,'ssmlGender':_0x562869};_0x5efc62[_0xed39('0x32')]={'audioEncoding':_0xed39('0x33'),'sampleRateHertz':0x1f40};var _0xedc780={'url':_0x350762+_0xed39('0x34')+_0x3d5eb5,'method':_0xed39('0x35'),'json':!![],'body':_0x5efc62};return rp(_0xedc780)['then'](function(_0x31c7e7){return new BPromise(function(_0x11ec6d,_0x45220c){_0xbf6ce4=path['resolve'](__dirname,'tmp',rs[_0xed39('0x36')](0x4)+_0xed39('0x37'));var _0x628f87=Buffer['from'](_0x31c7e7[_0xed39('0x38')],_0xed39('0x2b'));return fs[_0xed39('0x39')](_0xbf6ce4,_0x628f87,function(_0x2ea0e0){_0x45220c(_0x2ea0e0);},function(_0x466074){fs[_0xed39('0x26')](_0xbf6ce4,_0xed39('0x27'));_0x11ec6d(_0x466074);});});})[_0xed39('0x25')](function(_0x5bc228){_0x54c796=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs['generate'](0x4)+'.wav');return convertFile(_0xbf6ce4,_0x54c796);})[_0xed39('0x25')](function(){try{fs['unlink'](_0xbf6ce4);fs[_0xed39('0x26')](_0x54c796,_0xed39('0x27'));}catch(_0x61f13d){logger[_0xed39('0x11')](_0x61f13d);}logger[_0xed39('0x15')]('googleCloudTTS\x20path',_0x54c796[_0xed39('0x28')]('.')[0x0]);return _0x54c796['split']('.')[0x0];});};exports[_0xed39('0x3a')]=function(_0x366cc4,_0x308ff8){var _0x1b0204=_0xed39('0x3b');var _0x3f1c90,_0x10709c;var _0x4fb68a;var _0x1dad0f={'encoding':'utf8','method':_0xed39('0x35'),'timeout':0x2710,'url':_0x1b0204,'headers':{'Content-Type':_0xed39('0x3c')},'body':_0xed39('0x3d')+encodeURIComponent(JSON[_0xed39('0x3e')]([[[_0xed39('0x3f'),JSON[_0xed39('0x3e')]([_0x366cc4,_0x308ff8||'en',![],_0xed39('0x40')]),null,_0xed39('0x41')]]]))};return rp(_0x1dad0f)[_0xed39('0x25')](function(_0xb5612d){try{_0x4fb68a=eval(_0xb5612d[_0xed39('0x42')](0x5))[0x0][0x2];}catch(_0x34a50c){throw new Error(_0xed39('0x43')+_0xb5612d[_0xed39('0x1c')]);}if(!_0x4fb68a){if(_0x366cc4['length']>0xc8){throw new Error(_0xed39('0x44'));}else{throw new Error(_0xed39('0x45')+_0x308ff8+_0xed39('0x46'));}}try{_0x4fb68a=eval(_0x4fb68a)[0x0];}catch(_0x18ed15){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x558e3e=_0x4fb68a;_0x3f1c90=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x37'));fs[_0xed39('0x24')](_0x3f1c90,_0x4fb68a,{'encoding':_0xed39('0x2b')});_0x10709c=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+_0xed39('0x23'));return convertFile(_0x3f1c90,_0x10709c);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x3f1c90);fs['chmodSync'](_0x10709c,'777');}catch(_0x4b8c9b){logger[_0xed39('0x11')](_0x4b8c9b);}logger['info'](_0xed39('0x47'),_0x10709c['split']('.')[0x0]);return _0x10709c[_0xed39('0x28')]('.')[0x0];});};exports[_0xed39('0x48')]=function(_0x478361,_0x526e97,_0x1f1ebe){return google['asr'](_0x478361,_0x526e97,_0x1f1ebe)[_0xed39('0x25')](function(_0x117141){logger[_0xed39('0x15')](_0x117141['uri']);return rp(_0x117141);})[_0xed39('0x25')](function(_0x21ab1a){var _0x22f2ef='';var _0x5329d4=0x0;try{fs['unlink'](_0x478361);}catch(_0x2e9ff7){logger[_0xed39('0x11')](_0x2e9ff7);}if(_0x21ab1a&&_0x21ab1a[_0xed39('0x49')]){_0x22f2ef=_0x21ab1a[_0xed39('0x49')][_0xed39('0x4a')](function(_0x1babec){return _0x1babec&&_0x1babec[_0xed39('0x4b')][0x0]&&_0x1babec['alternatives'][0x0]['transcript']?_0x1babec[_0xed39('0x4b')][0x0]['transcript']:'';})['join']('\x0a');_0x5329d4=_0x21ab1a[_0xed39('0x49')][_0xed39('0x4a')](function(_0x471047){return _0x471047&&_0x471047[_0xed39('0x4b')][0x0]&&_0x471047[_0xed39('0x4b')][0x0][_0xed39('0x4c')]?_0x471047['alternatives'][0x0]['confidence']:0x0;})[_0xed39('0x4d')]('\x0a');}logger[_0xed39('0x15')](_0xed39('0x4e'),_0x22f2ef);logger[_0xed39('0x15')](_0xed39('0x4f'),_0x5329d4);return{'transcript':_0x22f2ef,'confidence':_0x5329d4};})['catch'](function(_0x146da1){logger[_0xed39('0x11')]('[%s]\x20%s:%s',_0x146da1['statusCode'],_0x146da1[_0xed39('0x50')],_0x146da1[_0xed39('0x51')]);});};exports[_0xed39('0x52')]=function(_0x4f8f51,_0x505ee9,_0x5e1720,_0x383836){var _0x24bd25=apiai(_0x505ee9,{'language':_0x383836||'en'});return _0x24bd25[_0xed39('0x53')](_0x5e1720,{'sessionId':md5(_0x4f8f51)})[_0xed39('0x25')](function(_0x55229e){logger['info'](JSON[_0xed39('0x3e')](_0x55229e));return{'source':_0x55229e[_0xed39('0x54')][_0xed39('0x55')],'resolvedQuery':_0x55229e[_0xed39('0x54')][_0xed39('0x56')],'action':_0x55229e[_0xed39('0x54')][_0xed39('0x57')],'actionIncomplete':_0x55229e[_0xed39('0x54')][_0xed39('0x58')],'speech':_0x55229e['result'][_0xed39('0x59')]['speech'],'score':_0x55229e['result'][_0xed39('0x5a')],'statusCode':_0x55229e[_0xed39('0x5b')][_0xed39('0x5c')],'endConversation':_0x55229e['result'][_0xed39('0x5d')][_0xed39('0x5e')]||![],'isFallbackIntent':_0x55229e[_0xed39('0x54')][_0xed39('0x5d')][_0xed39('0x5f')]};});};exports['googleDialogflowV2']=function(_0x399009,_0x50472d,_0x8e80ad,_0xb23cb1,_0x21874f,_0x5bdd30){var _0x21c50f=_0xb23cb1[_0xed39('0x60')](/\\n/g,'\x0a');var _0x30641f={'credentials':{'private_key':_0x21c50f,'client_email':_0x8e80ad}};var _0x3b1c94=new dialogflow[(_0xed39('0x61'))](_0x30641f);var _0x5028ad=_0x3b1c94['sessionPath'](_0x50472d,md5(_0x399009));var _0x5ff369={'session':_0x5028ad,'queryInput':{'text':{'text':_0x21874f,'languageCode':_0x5bdd30}}};return _0x3b1c94[_0xed39('0x62')](_0x5ff369)['then'](function(_0x39e525){if(_0x39e525&&_0x39e525[_0xed39('0x63')]){logger['info'](_0xed39('0x64'),JSON['stringify'](_0x39e525));var _0x21b45f=_0x39e525[0x0];if(_0x21b45f){var _0x5274a5={'action':_0x21b45f['queryResult'][_0xed39('0x57')],'allRequiredParamsPresent':_0x21b45f[_0xed39('0x65')][_0xed39('0x66')],'endConversation':_0x21b45f[_0xed39('0x65')]['diagnosticInfo']&&_0x21b45f[_0xed39('0x65')]['diagnosticInfo'][_0xed39('0x67')]?_0x21b45f[_0xed39('0x65')][_0xed39('0x68')][_0xed39('0x67')]['end_conversation'][_0xed39('0x69')]:![],'fulfillmentText':_0x21b45f[_0xed39('0x65')]['fulfillmentText'],'intentName':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')][_0xed39('0x50')],'intentDisplayName':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')][_0xed39('0x6b')],'isFallbackIntent':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')]['isFallback'],'languageCode':_0x21b45f[_0xed39('0x65')][_0xed39('0x6c')],'queryText':_0x21b45f['queryResult'][_0xed39('0x6d')],'responseId':_0x21b45f[_0xed39('0x6e')],'score':_0x21b45f[_0xed39('0x65')]['intentDetectionConfidence'],'speech':_0x21b45f[_0xed39('0x65')][_0xed39('0x6f')],'providerResponse':JSON[_0xed39('0x3e')](_0x39e525)};return _0x5274a5;}}});};exports[_0xed39('0x70')]=function(_0x5861c4,_0x3cb1e0,_0xa26529,_0x4ffe76){return tilde[_0xed39('0x71')](_0x5861c4,_0x3cb1e0,_0xa26529,_0x4ffe76)[_0xed39('0x25')](function(_0x88a033){try{fs[_0xed39('0x17')](_0x5861c4);}catch(_0x55fc3f){logger['error'](_0x55fc3f);}logger[_0xed39('0x15')](_0xed39('0x72'),_0x88a033[_0xed39('0x73')]);logger[_0xed39('0x15')](_0xed39('0x74'),_0x88a033['confidence']);return _0x88a033;});};exports[_0xed39('0x75')]=function(_0x1285e9,_0x477e4c,_0x471b03,_0x16d748,_0x25c7b3,_0x575bcb){var _0x332653=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+_0xed39('0x37'));var _0x418c9c;return aws['polly'](_0x1285e9,_0x477e4c,_0x471b03,_0x16d748,_0x25c7b3,_0x575bcb,_0x332653)[_0xed39('0x25')](function(){_0x418c9c=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x23'));return convertFile(_0x332653,_0x418c9c);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x332653);fs[_0xed39('0x26')](_0x418c9c,_0xed39('0x27'));}catch(_0x4d5b77){logger['error'](_0x4d5b77);}return _0x418c9c['split']('.')[0x0];});};exports['awsLex']=function(_0x1c2c25,_0xb76c27,_0x4cb516,_0x8caff4,_0x31344e,_0x6eb9a4){return aws[_0xed39('0x76')](_0x1c2c25,_0xb76c27,_0x4cb516,_0x8caff4,_0x31344e,_0x6eb9a4)['then'](function(_0x1a7fbe){logger['info'](JSON[_0xed39('0x3e')](_0x1a7fbe));return _0x1a7fbe;});};exports['ispeechTTS']=function(_0x3f2a5d,_0x17f824,_0x2634ec,_0x465fc0){var _0x30f414=util[_0xed39('0x77')](_0xed39('0x78'),ISPEECH_API,_0x3f2a5d,encodeURIComponent(_0x17f824),_0x2634ec,_0x465fc0);var _0x1af671=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+'.mp3');var _0x4ab5b5;return downloadFile(_0x30f414,_0x1af671)[_0xed39('0x25')](function(){_0x4ab5b5=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x23'));return convertFile(_0x1af671,_0x4ab5b5);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x1af671);fs[_0xed39('0x26')](_0x4ab5b5,_0xed39('0x27'));}catch(_0xde7770){logger[_0xed39('0x11')](_0xde7770);}return _0x4ab5b5[_0xed39('0x28')]('.')[0x0];});};exports[_0xed39('0x79')]=function(_0x4007df,_0x24ca13,_0x1cbb51,_0x43683f){var _0x3360c2=util[_0xed39('0x77')](_0xed39('0x7a'),ISPEECH_API,_0x24ca13,_0x1cbb51,base64Encode(_0x4007df),_0x43683f?util[_0xed39('0x77')](_0xed39('0x7b'),encodeURIComponent(_0x43683f)):'freeform=3');return uploadFile(_0x3360c2)[_0xed39('0x25')](function(_0x5bd8a9){return querystring[_0xed39('0x7')](_0x5bd8a9);});};exports[_0xed39('0x7c')]=function(_0x4c4af9,_0x537445){return sestek[_0xed39('0x7d')](_0x4c4af9,_0x537445)['then'](function(_0x299230){logger[_0xed39('0x15')](JSON['stringify'](_0x299230));var _0x41e37f={'speech':_0x299230[_0xed39('0x7e')],'action':_0x299230[_0xed39('0x7f')]?_0x299230[_0xed39('0x7f')]['CustomAction']:undefined,'actiondata':_0x299230[_0xed39('0x7f')]?_0x299230['channelData'][_0xed39('0x80')]:undefined};if(_0x299230[_0xed39('0x7f')]&&_0x299230[_0xed39('0x7f')][_0xed39('0x81')]){return base64Decode(_0x299230['channelData']['AudioFromTts']['Data'],path['resolve'](__dirname,'tmp',rs[_0xed39('0x36')](0x4)+_0xed39('0x23')))[_0xed39('0x25')](function(_0x379cba){_0x41e37f['audiofile']=_0x379cba;return _0x41e37f;});}return _0x41e37f;});};exports[_0xed39('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0xd2f0=['%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','readFileSync','toString','googleCloudTTS','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','audioContent','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','end_conversation','boolValue','intent','isFallback','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsLex','ispeechTTS'];(function(_0x51e545,_0x5b33fd){var _0x25d5ef=function(_0x12dc28){while(--_0x12dc28){_0x51e545['push'](_0x51e545['shift']());}};_0x25d5ef(++_0x5b33fd);}(_0xd2f0,0x1a9));var _0x0d2f=function(_0x5ab89b,_0x131968){_0x5ab89b=_0x5ab89b-0x0;var _0x184e76=_0xd2f0[_0x5ab89b];return _0x184e76;};'use strict';var apiai=require(_0x0d2f('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x0d2f('0x1'));var fs=require('fs');var http=require(_0x0d2f('0x2'));var https=require(_0x0d2f('0x3'));var md5=require(_0x0d2f('0x4'));var path=require(_0x0d2f('0x5'));var querystring=require(_0x0d2f('0x6'));var rp=require(_0x0d2f('0x7'));var rs=require(_0x0d2f('0x8'));var sox=require(_0x0d2f('0x9'));var tts=require(_0x0d2f('0xa'));var urlParse=require(_0x0d2f('0xb'))['parse'];var util=require('util');var aws=require(_0x0d2f('0xc'));var google=require(_0x0d2f('0xd'));var sestek=require(_0x0d2f('0xe'));var tilde=require(_0x0d2f('0xf'));var logger=require(_0x0d2f('0x10'))(_0x0d2f('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x408441,_0x2f5da7){return new BPromise(function(_0x503b90,_0x18f08d){var _0x4c1aed=urlParse(_0x408441);var _0x47e5e9=_0x4c1aed[_0x0d2f('0x12')]===_0x0d2f('0x13')?https:http;var _0x4e74ae={'host':_0x4c1aed[_0x0d2f('0x14')],'path':_0x4c1aed[_0x0d2f('0x5')],'headers':{'user-agent':_0x0d2f('0x15')}};_0x47e5e9[_0x0d2f('0x16')](_0x4e74ae,function(_0x56e380){if(_0x56e380[_0x0d2f('0x17')]!==0xc8){logger[_0x0d2f('0x18')]('request\x20to\x20'+_0x408441+_0x0d2f('0x19')+_0x56e380['statusCode']+'\x20('+_0x56e380[_0x0d2f('0x1a')]+')');_0x18f08d(new Error(_0x0d2f('0x1b')+_0x408441+_0x0d2f('0x19')+_0x56e380['statusCode']+'\x20('+_0x56e380[_0x0d2f('0x1a')]+')'));return;}var _0x465f3c=fs['createWriteStream'](_0x2f5da7);_0x465f3c['on'](_0x0d2f('0x1c'),function(){logger[_0x0d2f('0x1d')](_0x0d2f('0x1e'));_0x465f3c[_0x0d2f('0x1f')](_0x503b90);});_0x465f3c['on'](_0x0d2f('0x18'),function(_0x374240){fs['unlink'](_0x2f5da7);logger[_0x0d2f('0x18')]('download\x20error',_0x374240);_0x18f08d(_0x374240);});_0x56e380['pipe'](_0x465f3c);})['on'](_0x0d2f('0x18'),function(_0x590bb8){logger[_0x0d2f('0x18')](_0x590bb8);_0x18f08d(_0x590bb8);})[_0x0d2f('0x20')]();});}function uploadFile(_0x3ae446){return new BPromise(function(_0x1ec522,_0x5c5c18){var _0x978c07=urlParse(_0x3ae446);var _0x12ce58=_0x978c07[_0x0d2f('0x12')]===_0x0d2f('0x13')?https:http;var _0x6fb868={'host':_0x978c07[_0x0d2f('0x14')],'path':_0x978c07[_0x0d2f('0x5')],'headers':{'user-agent':_0x0d2f('0x15')}};_0x12ce58['get'](_0x6fb868,function(_0x1ee5e8){if(_0x1ee5e8[_0x0d2f('0x17')]!==0xc8){_0x5c5c18(new Error(_0x0d2f('0x1b')+_0x3ae446+'\x20failed,\x20status\x20code\x20=\x20'+_0x1ee5e8[_0x0d2f('0x17')]+'\x20('+_0x1ee5e8['statusMessage']+')'));return;}var _0x52dec2='';_0x1ee5e8['on']('data',function(_0x5a7b5c){_0x52dec2+=_0x5a7b5c;});_0x1ee5e8['on']('end',function(){_0x1ec522(_0x52dec2);});})['on']('error',function(_0x5027d6){_0x5c5c18(_0x5027d6);})[_0x0d2f('0x20')]();});}function convertFile(_0x78918e,_0x1217f7){return new BPromise(function(_0x25ad06,_0x3f504a){var _0x250310=sox[_0x0d2f('0x21')](_0x78918e,_0x1217f7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x250310['on'](_0x0d2f('0x18'),function(_0x214499){logger[_0x0d2f('0x18')](_0x0d2f('0x22'),_0x214499);_0x3f504a(_0x214499);});_0x250310['on']('end',function(){logger[_0x0d2f('0x1d')](_0x0d2f('0x23'));_0x25ad06();});_0x250310[_0x0d2f('0x24')]();});}function base64Decode(_0x464580,_0x1d11b8){var _0x3585c5=path[_0x0d2f('0x25')](__dirname,'tmp',rs[_0x0d2f('0x26')](0x4)+_0x0d2f('0x27'));fs[_0x0d2f('0x28')](_0x3585c5,_0x464580,_0x0d2f('0x29'));return convertFile(_0x3585c5,_0x1d11b8)[_0x0d2f('0x2a')](function(){try{fs[_0x0d2f('0x2b')](_0x3585c5);fs[_0x0d2f('0x2c')](_0x1d11b8,_0x0d2f('0x2d'));}catch(_0x55b5ff){logger['error'](_0x55b5ff);}return _0x1d11b8['split']('.')[0x0];});}function base64Encode(_0x7faae5){var _0x2aa4d8=fs[_0x0d2f('0x2e')](_0x7faae5);return new Buffer(_0x2aa4d8)[_0x0d2f('0x2f')]('base64');}exports[_0x0d2f('0x30')]=function(_0x33d990,_0x48fb7b,_0x445205,_0x1c5e57,_0x1301e6,_0x3e3eaf){var _0x73da45,_0xa5021a;var _0x30d7f6='https://texttospeech.googleapis.com/v1/';var _0x159db1='?key='+_0x33d990;var _0x5b78ae={};if(_0x48fb7b===_0x0d2f('0x31')){_0x5b78ae['input']={'ssml':_0x445205};}else{_0x5b78ae[_0x0d2f('0x32')]={'text':_0x445205};};_0x5b78ae[_0x0d2f('0x33')]={'languageCode':_0x1c5e57,'ssmlGender':_0x1301e6};_0x5b78ae[_0x0d2f('0x34')]={'audioEncoding':_0x0d2f('0x35'),'sampleRateHertz':0x1f40};var _0x4ecabb={'url':_0x30d7f6+_0x0d2f('0x36')+_0x159db1,'method':_0x0d2f('0x37'),'json':!![],'body':_0x5b78ae};return rp(_0x4ecabb)['then'](function(_0x61b639){return new BPromise(function(_0x2ee566,_0xab210d){_0x73da45=path[_0x0d2f('0x25')](__dirname,_0x0d2f('0x38'),rs[_0x0d2f('0x26')](0x4)+'.mp3');var _0x1597ba=Buffer['from'](_0x61b639[_0x0d2f('0x39')],_0x0d2f('0x29'));return fs['writeFile'](_0x73da45,_0x1597ba,function(_0x429f8f){_0xab210d(_0x429f8f);},function(_0x3e2d40){fs['chmodSync'](_0x73da45,'777');_0x2ee566(_0x3e2d40);});});})[_0x0d2f('0x2a')](function(_0x522579){_0xa5021a=path[_0x0d2f('0x25')](__dirname,'tmp',rs[_0x0d2f('0x26')](0x4)+'.wav');return convertFile(_0x73da45,_0xa5021a);})['then'](function(){try{fs[_0x0d2f('0x2b')](_0x73da45);fs[_0x0d2f('0x2c')](_0xa5021a,_0x0d2f('0x2d'));}catch(_0x2c4acc){logger[_0x0d2f('0x18')](_0x2c4acc);}logger[_0x0d2f('0x1d')](_0x0d2f('0x3a'),_0xa5021a[_0x0d2f('0x3b')]('.')[0x0]);return _0xa5021a[_0x0d2f('0x3b')]('.')[0x0];});};exports[_0x0d2f('0x3c')]=function(_0x1f2e02,_0x245ba4){var _0x423d45='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4cbc35,_0x468752;var _0x5a7239;var _0x5513ab={'encoding':_0x0d2f('0x3d'),'method':_0x0d2f('0x37'),'timeout':0x2710,'url':_0x423d45,'headers':{'Content-Type':_0x0d2f('0x3e')},'body':_0x0d2f('0x3f')+encodeURIComponent(JSON[_0x0d2f('0x40')]([[[_0x0d2f('0x41'),JSON[_0x0d2f('0x40')]([_0x1f2e02,_0x245ba4||'en',![],_0x0d2f('0x42')]),null,'generic']]]))};return rp(_0x5513ab)[_0x0d2f('0x2a')](function(_0x145ada){try{_0x5a7239=eval(_0x145ada['slice'](0x5))[0x0][0x2];}catch(_0x3d037e){throw new Error(_0x0d2f('0x43')+_0x145ada[_0x0d2f('0x44')]);}if(!_0x5a7239){if(_0x1f2e02[_0x0d2f('0x45')]>0xc8){throw new Error(_0x0d2f('0x46'));}else{throw new Error(_0x0d2f('0x47')+_0x245ba4+_0x0d2f('0x48'));}}try{_0x5a7239=eval(_0x5a7239)[0x0];}catch(_0x4923fc){throw new Error(_0x0d2f('0x43')+res[_0x0d2f('0x44')]);}const _0x1746b1=_0x5a7239;_0x4cbc35=path['resolve'](__dirname,_0x0d2f('0x38'),rs[_0x0d2f('0x26')](0x4)+_0x0d2f('0x49'));fs['writeFileSync'](_0x4cbc35,_0x5a7239,{'encoding':_0x0d2f('0x29')});_0x468752=path['resolve'](__dirname,_0x0d2f('0x38'),rs['generate'](0x4)+_0x0d2f('0x27'));return convertFile(_0x4cbc35,_0x468752);})[_0x0d2f('0x2a')](function(){try{fs[_0x0d2f('0x2b')](_0x4cbc35);fs[_0x0d2f('0x2c')](_0x468752,'777');}catch(_0x5e4529){logger['error'](_0x5e4529);}logger[_0x0d2f('0x1d')](_0x0d2f('0x4a'),_0x468752[_0x0d2f('0x3b')]('.')[0x0]);return _0x468752['split']('.')[0x0];});};exports['googleASR']=function(_0xf320cb,_0xbece8b,_0x50357d){return google[_0x0d2f('0x4b')](_0xf320cb,_0xbece8b,_0x50357d)[_0x0d2f('0x2a')](function(_0x388f83){logger['info'](_0x388f83[_0x0d2f('0x4c')]);return rp(_0x388f83);})[_0x0d2f('0x2a')](function(_0x5e2bc8){var _0x3cbe0d='';var _0x2755bd=0x0;try{fs[_0x0d2f('0x2b')](_0xf320cb);}catch(_0x1ba6d2){logger[_0x0d2f('0x18')](_0x1ba6d2);}if(_0x5e2bc8&&_0x5e2bc8[_0x0d2f('0x4d')]){_0x3cbe0d=_0x5e2bc8[_0x0d2f('0x4d')][_0x0d2f('0x4e')](function(_0xfbbf9c){return _0xfbbf9c&&_0xfbbf9c[_0x0d2f('0x4f')][0x0]&&_0xfbbf9c[_0x0d2f('0x4f')][0x0][_0x0d2f('0x50')]?_0xfbbf9c['alternatives'][0x0][_0x0d2f('0x50')]:'';})[_0x0d2f('0x51')]('\x0a');_0x2755bd=_0x5e2bc8[_0x0d2f('0x4d')][_0x0d2f('0x4e')](function(_0xd1d62b){return _0xd1d62b&&_0xd1d62b[_0x0d2f('0x4f')][0x0]&&_0xd1d62b[_0x0d2f('0x4f')][0x0][_0x0d2f('0x52')]?_0xd1d62b[_0x0d2f('0x4f')][0x0][_0x0d2f('0x52')]:0x0;})[_0x0d2f('0x51')]('\x0a');}logger[_0x0d2f('0x1d')](_0x0d2f('0x53'),_0x3cbe0d);logger[_0x0d2f('0x1d')]('googleASR\x20confidence',_0x2755bd);return{'transcript':_0x3cbe0d,'confidence':_0x2755bd};})[_0x0d2f('0x54')](function(_0x17e1e1){logger[_0x0d2f('0x18')](_0x0d2f('0x55'),_0x17e1e1[_0x0d2f('0x17')],_0x17e1e1[_0x0d2f('0x56')],_0x17e1e1[_0x0d2f('0x57')]);});};exports[_0x0d2f('0x58')]=function(_0x208ab8,_0x44b3a2,_0x21be60,_0x15ee52){var _0x42487e=apiai(_0x44b3a2,{'language':_0x15ee52||'en'});return _0x42487e[_0x0d2f('0x59')](_0x21be60,{'sessionId':md5(_0x208ab8)})[_0x0d2f('0x2a')](function(_0x45fc7c){logger[_0x0d2f('0x1d')](JSON['stringify'](_0x45fc7c));return{'source':_0x45fc7c[_0x0d2f('0x5a')][_0x0d2f('0x5b')],'resolvedQuery':_0x45fc7c[_0x0d2f('0x5a')]['resolvedQuery'],'action':_0x45fc7c[_0x0d2f('0x5a')][_0x0d2f('0x5c')],'actionIncomplete':_0x45fc7c['result'][_0x0d2f('0x5d')],'speech':_0x45fc7c[_0x0d2f('0x5a')][_0x0d2f('0x5e')][_0x0d2f('0x5f')],'score':_0x45fc7c['result'][_0x0d2f('0x60')],'statusCode':_0x45fc7c[_0x0d2f('0x61')][_0x0d2f('0x62')],'endConversation':_0x45fc7c['result'][_0x0d2f('0x63')][_0x0d2f('0x64')]||![],'isFallbackIntent':_0x45fc7c[_0x0d2f('0x5a')][_0x0d2f('0x63')][_0x0d2f('0x65')]};});};exports[_0x0d2f('0x66')]=function(_0x939f29,_0x4cedc9,_0x1d7b80,_0x4d8895,_0x249dc5,_0x4a4360){var _0x34df0e=_0x4d8895['replace'](/\\n/g,'\x0a');var _0x5e2968={'credentials':{'private_key':_0x34df0e,'client_email':_0x1d7b80}};var _0x5eba9c=new dialogflow[(_0x0d2f('0x67'))](_0x5e2968);var _0x513faa=_0x5eba9c[_0x0d2f('0x68')](_0x4cedc9,md5(_0x939f29));var _0x36c85f={'session':_0x513faa,'queryInput':{'text':{'text':_0x249dc5,'languageCode':_0x4a4360}}};return _0x5eba9c[_0x0d2f('0x69')](_0x36c85f)[_0x0d2f('0x2a')](function(_0xf3ed8){if(_0xf3ed8&&_0xf3ed8[_0x0d2f('0x45')]){logger[_0x0d2f('0x1d')](_0x0d2f('0x6a'),JSON[_0x0d2f('0x40')](_0xf3ed8));var _0x3fee8a=_0xf3ed8[0x0];if(_0x3fee8a){var _0x437b5b={'action':_0x3fee8a['queryResult'][_0x0d2f('0x5c')],'allRequiredParamsPresent':_0x3fee8a['queryResult'][_0x0d2f('0x6b')],'endConversation':_0x3fee8a['queryResult'][_0x0d2f('0x6c')]&&_0x3fee8a['queryResult'][_0x0d2f('0x6c')]['fields']?_0x3fee8a[_0x0d2f('0x6d')][_0x0d2f('0x6c')]['fields'][_0x0d2f('0x6e')][_0x0d2f('0x6f')]:![],'fulfillmentText':_0x3fee8a[_0x0d2f('0x6d')]['fulfillmentText'],'intentName':_0x3fee8a['queryResult'][_0x0d2f('0x70')][_0x0d2f('0x56')],'intentDisplayName':_0x3fee8a[_0x0d2f('0x6d')][_0x0d2f('0x70')]['displayName'],'isFallbackIntent':_0x3fee8a[_0x0d2f('0x6d')]['intent'][_0x0d2f('0x71')],'languageCode':_0x3fee8a[_0x0d2f('0x6d')][_0x0d2f('0x72')],'queryText':_0x3fee8a[_0x0d2f('0x6d')][_0x0d2f('0x73')],'responseId':_0x3fee8a[_0x0d2f('0x74')],'score':_0x3fee8a['queryResult']['intentDetectionConfidence'],'speech':_0x3fee8a[_0x0d2f('0x6d')][_0x0d2f('0x75')],'providerResponse':JSON[_0x0d2f('0x40')](_0xf3ed8)};return _0x437b5b;}}});};exports[_0x0d2f('0x76')]=function(_0x5aabf9,_0x69f5ca,_0x349414,_0x1441dc){return tilde[_0x0d2f('0x4b')](_0x5aabf9,_0x69f5ca,_0x349414,_0x1441dc)[_0x0d2f('0x2a')](function(_0x19c9e4){try{fs['unlink'](_0x5aabf9);}catch(_0x1637d5){logger[_0x0d2f('0x18')](_0x1637d5);}logger[_0x0d2f('0x1d')](_0x0d2f('0x77'),_0x19c9e4[_0x0d2f('0x50')]);logger[_0x0d2f('0x1d')](_0x0d2f('0x78'),_0x19c9e4['confidence']);return _0x19c9e4;});};exports['awsPolly']=function(_0x2fda7b,_0x5464dd,_0x562bc3,_0x9a46bf,_0x1b9401,_0x42a5ac){var _0x19409e=path[_0x0d2f('0x25')](__dirname,_0x0d2f('0x38'),rs[_0x0d2f('0x26')](0x4)+_0x0d2f('0x49'));var _0x1a5e92;return aws['polly'](_0x2fda7b,_0x5464dd,_0x562bc3,_0x9a46bf,_0x1b9401,_0x42a5ac,_0x19409e)[_0x0d2f('0x2a')](function(){_0x1a5e92=path[_0x0d2f('0x25')](__dirname,_0x0d2f('0x38'),rs[_0x0d2f('0x26')](0x4)+_0x0d2f('0x27'));return convertFile(_0x19409e,_0x1a5e92);})['then'](function(){try{fs['unlink'](_0x19409e);fs['chmodSync'](_0x1a5e92,'777');}catch(_0x519733){logger[_0x0d2f('0x18')](_0x519733);}return _0x1a5e92['split']('.')[0x0];});};exports[_0x0d2f('0x79')]=function(_0xc340b7,_0x18da6c,_0x5e50cf,_0x39fac0,_0x3ac35d,_0x3d260f){return aws['lex'](_0xc340b7,_0x18da6c,_0x5e50cf,_0x39fac0,_0x3ac35d,_0x3d260f)[_0x0d2f('0x2a')](function(_0x2cbd2f){logger[_0x0d2f('0x1d')](JSON[_0x0d2f('0x40')](_0x2cbd2f));return _0x2cbd2f;});};exports[_0x0d2f('0x7a')]=function(_0x4b5ca1,_0x4e1342,_0x4c3366,_0x16780f){var _0xda4bd6=util['format'](_0x0d2f('0x7b'),ISPEECH_API,_0x4b5ca1,encodeURIComponent(_0x4e1342),_0x4c3366,_0x16780f);var _0x22efb7=path['resolve'](__dirname,_0x0d2f('0x38'),rs[_0x0d2f('0x26')](0x4)+'.mp3');var _0x336afb;return downloadFile(_0xda4bd6,_0x22efb7)[_0x0d2f('0x2a')](function(){_0x336afb=path[_0x0d2f('0x25')](__dirname,_0x0d2f('0x38'),rs['generate'](0x4)+_0x0d2f('0x27'));return convertFile(_0x22efb7,_0x336afb);})[_0x0d2f('0x2a')](function(){try{fs[_0x0d2f('0x2b')](_0x22efb7);fs['chmodSync'](_0x336afb,_0x0d2f('0x2d'));}catch(_0xe46cd6){logger['error'](_0xe46cd6);}return _0x336afb[_0x0d2f('0x3b')]('.')[0x0];});};exports['ispeechASR']=function(_0x2e4ecd,_0x1deaf8,_0x5b20ee,_0x2be320){var _0x2dc01c=util['format'](_0x0d2f('0x7c'),ISPEECH_API,_0x1deaf8,_0x5b20ee,base64Encode(_0x2e4ecd),_0x2be320?util[_0x0d2f('0x7d')](_0x0d2f('0x7e'),encodeURIComponent(_0x2be320)):_0x0d2f('0x7f'));return uploadFile(_0x2dc01c)[_0x0d2f('0x2a')](function(_0x158116){return querystring['parse'](_0x158116);});};exports['sestekNDA']=function(_0x11fac7,_0x1c2d08){return sestek[_0x0d2f('0x80')](_0x11fac7,_0x1c2d08)[_0x0d2f('0x2a')](function(_0xc1b6c9){logger[_0x0d2f('0x1d')](JSON[_0x0d2f('0x40')](_0xc1b6c9));var _0x125258={'speech':_0xc1b6c9[_0x0d2f('0x81')],'action':_0xc1b6c9['channelData']?_0xc1b6c9[_0x0d2f('0x82')][_0x0d2f('0x83')]:undefined,'actiondata':_0xc1b6c9[_0x0d2f('0x82')]?_0xc1b6c9[_0x0d2f('0x82')][_0x0d2f('0x84')]:undefined};if(_0xc1b6c9[_0x0d2f('0x82')]&&_0xc1b6c9[_0x0d2f('0x82')][_0x0d2f('0x85')]){return base64Decode(_0xc1b6c9[_0x0d2f('0x82')][_0x0d2f('0x85')][_0x0d2f('0x86')],path['resolve'](__dirname,_0x0d2f('0x38'),rs['generate'](0x4)+_0x0d2f('0x27')))[_0x0d2f('0x2a')](function(_0x44dfad){_0x125258[_0x0d2f('0x87')]=_0x44dfad;return _0x125258;});}return _0x125258;});};exports[_0x0d2f('0x88')]=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 5f388ab..98afa90 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 _0xa672=['exports'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0xa672,0x19f));var _0x2a67=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa672[_0x3070dc];return _0x431489;};var nda=require('./nda');module[_0x2a67('0x0')]={'nda':nda}; \ No newline at end of file +var _0x7a68=['exports','./nda'];(function(_0x55065b,_0x7d5de6){var _0x30869b=function(_0xfa70b){while(--_0xfa70b){_0x55065b['push'](_0x55065b['shift']());}};_0x30869b(++_0x7d5de6);}(_0x7a68,0x1df));var _0x87a6=function(_0x34a161,_0x52a77b){_0x34a161=_0x34a161-0x0;var _0x4412a1=_0x7a68[_0x34a161];return _0x4412a1;};var nda=require(_0x87a6('0x0'));module[_0x87a6('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 c821472..c166152 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 _0x35ba=['project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','access_token'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x35ba,0x8c));var _0xa35b=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x35ba[_0x56825b];return _0x69ce77;};'use strict';var rp=require(_0xa35b('0x0'));var url=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));module['exports']=function(_0x1bd11e,_0x1eb695){var _0x79573b={'method':_0xa35b('0x4'),'uri':url[_0xa35b('0x5')](_0x1eb695[_0xa35b('0x6')],'/token'),'form':{'grant_type':_0xa35b('0x7'),'username':_0x1eb695['username'],'password':_0x1eb695[_0xa35b('0x7')]},'json':!![]};return rp(_0x79573b)[_0xa35b('0x8')](function(_0x2be599){var _0x42da91={'method':_0xa35b('0x4'),'uri':url['resolve'](_0x1eb695[_0xa35b('0x9')],_0xa35b('0xa')),'body':{'type':_0x1eb695[_0xa35b('0xb')]||_0xa35b('0xc'),'channelId':_0xa35b('0xd'),'conversation':{'id':_0x1bd11e[_0xa35b('0xe')]},'from':{'id':_0x1bd11e[_0xa35b('0xf')],'name':_0x1bd11e[_0xa35b('0x10')]},'recipient':{'id':_0x1bd11e[_0xa35b('0x11')],'name':_0x1bd11e['extension']},'text':_0x1eb695[_0xa35b('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2be599[_0xa35b('0x13')]},'json':!![]};if(_0x1eb695[_0xa35b('0x14')]){_0x42da91[_0xa35b('0x15')][_0xa35b('0x16')][_0xa35b('0x17')]=_0x1eb695['project'];}if(_0x1eb695[_0xa35b('0x18')]=='1'){_0x42da91['body'][_0xa35b('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa35b('0x19')};}if(_0x1eb695[_0xa35b('0x1a')]){_0x42da91['body'][_0xa35b('0x16')][_0xa35b('0x1b')]=_0x1eb695[_0xa35b('0x1a')];if(_0x1eb695[_0xa35b('0x1c')]){_0x42da91[_0xa35b('0x15')][_0xa35b('0x16')][_0xa35b('0x1d')]=_0x1eb695[_0xa35b('0x1c')];}}logger[_0xa35b('0x1e')](JSON[_0xa35b('0x1f')](_0x42da91));return rp(_0x42da91);});}; \ No newline at end of file +var _0xd691=['audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x19e655,_0x5901c7){var _0x5e7c82=function(_0x2f3fb4){while(--_0x2f3fb4){_0x19e655['push'](_0x19e655['shift']());}};_0x5e7c82(++_0x5901c7);}(_0xd691,0xe6));var _0x1d69=function(_0xcdac34,_0x43f665){_0xcdac34=_0xcdac34-0x0;var _0x269d23=_0xd691[_0xcdac34];return _0x269d23;};'use strict';var rp=require(_0x1d69('0x0'));var url=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))('agi');module[_0x1d69('0x3')]=function(_0x44899f,_0x32502d){var _0x3dc1c9={'method':_0x1d69('0x4'),'uri':url[_0x1d69('0x5')](_0x32502d[_0x1d69('0x6')],_0x1d69('0x7')),'form':{'grant_type':_0x1d69('0x8'),'username':_0x32502d[_0x1d69('0x9')],'password':_0x32502d['password']},'json':!![]};return rp(_0x3dc1c9)['then'](function(_0x267da3){var _0x49f008={'method':_0x1d69('0x4'),'uri':url[_0x1d69('0x5')](_0x32502d[_0x1d69('0xa')],_0x1d69('0xb')),'body':{'type':_0x32502d['ndaactivity_type']||_0x1d69('0xc'),'channelId':_0x1d69('0xd'),'conversation':{'id':_0x44899f[_0x1d69('0xe')]},'from':{'id':_0x44899f[_0x1d69('0xf')],'name':_0x44899f[_0x1d69('0x10')]},'recipient':{'id':_0x44899f['dnid'],'name':_0x44899f['extension']},'text':_0x32502d[_0x1d69('0x11')],'channelData':{}},'headers':{'Authorization':_0x1d69('0x12')+_0x267da3[_0x1d69('0x13')]},'json':!![]};if(_0x32502d[_0x1d69('0x14')]){_0x49f008[_0x1d69('0x15')][_0x1d69('0x16')][_0x1d69('0x17')]=_0x32502d[_0x1d69('0x14')];}if(_0x32502d[_0x1d69('0x18')]=='1'){_0x49f008[_0x1d69('0x15')][_0x1d69('0x16')][_0x1d69('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1d69('0x1a')};}if(_0x32502d['custom_action']){_0x49f008['body'][_0x1d69('0x16')][_0x1d69('0x1b')]=_0x32502d[_0x1d69('0x1c')];if(_0x32502d[_0x1d69('0x1d')]){_0x49f008[_0x1d69('0x15')][_0x1d69('0x16')]['CustomActionData']=_0x32502d[_0x1d69('0x1d')];}}logger[_0x1d69('0x1e')](JSON[_0x1d69('0x1f')](_0x49f008));return rp(_0x49f008);});}; \ 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 59870a1..a6fb4a1 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 _0x9e1c=['./lib/api','exports'];(function(_0x2a3436,_0x29384d){var _0x28a98b=function(_0x5e1298){while(--_0x5e1298){_0x2a3436['push'](_0x2a3436['shift']());}};_0x28a98b(++_0x29384d);}(_0x9e1c,0x1b0));var _0xc9e1=function(_0x19731e,_0x1d2bba){_0x19731e=_0x19731e-0x0;var _0xb2d62c=_0x9e1c[_0x19731e];return _0xb2d62c;};'use strict';var asr=require(_0xc9e1('0x0'));module[_0xc9e1('0x1')]=function(_0x497876,_0x2ccfb3,_0x6c9595,_0x230e20){return asr(_0x497876,_0x2ccfb3,_0x6c9595,_0x230e20);}; \ No newline at end of file +var _0xaed1=['./lib/api','exports'];(function(_0x4da2e1,_0x379552){var _0x2c9e92=function(_0x1acab2){while(--_0x1acab2){_0x4da2e1['push'](_0x4da2e1['shift']());}};_0x2c9e92(++_0x379552);}(_0xaed1,0x1ba));var _0x1aed=function(_0x18fec8,_0x31d0cd){_0x18fec8=_0x18fec8-0x0;var _0x5e400c=_0xaed1[_0x18fec8];return _0x5e400c;};'use strict';var asr=require(_0x1aed('0x0'));module[_0x1aed('0x1')]=function(_0x6a3afa,_0x14420d,_0x3198ec,_0x1f0415){return asr(_0x6a3afa,_0x14420d,_0x3198ec,_0x1f0415);}; \ 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 33b0926..c24d9a4 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 _0xb4dd=['stringify','parse','status','result','final','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x2c72eb,_0x39429e){var _0x8b232c=function(_0xddc25b){while(--_0xddc25b){_0x2c72eb['push'](_0x2c72eb['shift']());}};_0x8b232c(++_0x39429e);}(_0xb4dd,0x184));var _0xdb4d=function(_0x24cdc6,_0x269fe8){_0x24cdc6=_0x24cdc6-0x0;var _0x5610a0=_0xb4dd[_0x24cdc6];return _0x5610a0;};'use strict';var BPromise=require(_0xdb4d('0x0'));var _=require(_0xdb4d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdb4d('0x2'));var crypto=require('crypto');var logger=require(_0xdb4d('0x3'))(_0xdb4d('0x4'));module[_0xdb4d('0x5')]=function(_0x530c56,_0x5a599e,_0x4c0c7f,_0x4c96ca){return new BPromise(function(_0x4fa51a,_0x29dcca){logger[_0xdb4d('0x6')](_0xdb4d('0x7'),_0x4c96ca||_0xdb4d('0x8'));var _0x12793e=new WebSocket(_0x4c96ca||_0xdb4d('0x8'),{'perMessageDeflate':![]});var _0x4e3755='';var _0x4cf003='0';var _0x3bdaba='1';var _0x186eac=_0xdb4d('0x9');function _0x45a48c(_0x5724f8){var _0x10135c=crypto[_0xdb4d('0xa')](_0xdb4d('0xb'));_0x10135c['update'](_0x5724f8);return _0x10135c[_0xdb4d('0xc')](_0xdb4d('0xd'));}function _0x3d5fff(){try{logger[_0xdb4d('0x6')](_0xdb4d('0xe'));var _0x147e43=moment()[_0xdb4d('0xf')]();var _0x370d68=_0x45a48c(_0x147e43+_0x5a599e+_0x4c0c7f);_0x12793e[_0xdb4d('0x10')](JSON['stringify']({'appID':_0x5a599e,'timestamp':_0x147e43,'appKey':_0x370d68}));var _0x3ac1c8=fs[_0xdb4d('0x11')](_0x530c56);_0x3ac1c8['on']('data',function(_0x11c68a){_0x12793e[_0xdb4d('0x10')](_0x11c68a);});_0x3ac1c8['on'](_0xdb4d('0x12'),function(){_0x12793e[_0xdb4d('0x10')](_0xdb4d('0x13'));});}catch(_0x180404){logger[_0xdb4d('0x14')](_0xdb4d('0x15'),JSON[_0xdb4d('0x16')](_0x180404));_0x12793e['terminate']();}}function _0x4fa179(_0x3cad6d){try{if(_0x3cad6d){var _0x4d3ac3=JSON[_0xdb4d('0x17')](_0x3cad6d);switch(_0x4d3ac3[_0xdb4d('0x18')]){case 0x0:if(_0x4d3ac3[_0xdb4d('0x19')]){if(_0x4d3ac3['result'][_0xdb4d('0x1a')]){logger[_0xdb4d('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xdb4d('0x16')](_0x4d3ac3[_0xdb4d('0x19')][_0xdb4d('0x1b')]));_0x4e3755=_0x4d3ac3['result']['hypotheses'][0x0][_0xdb4d('0x1c')];_0x4cf003=_0x4d3ac3[_0xdb4d('0x19')]['hypotheses'][0x0][_0xdb4d('0x1d')];_0x3bdaba='0';_0x186eac='Success.';_0x12793e[_0xdb4d('0x1e')]();}}break;case 0x1:logger['info'](_0xdb4d('0x9'));_0x3bdaba='1';_0x186eac=_0xdb4d('0x9');break;case 0x2:logger[_0xdb4d('0x6')](_0xdb4d('0x1f'));_0x3bdaba='2';_0x186eac=_0xdb4d('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3bdaba='9';_0x186eac=_0xdb4d('0x20');break;case 0xa:logger[_0xdb4d('0x6')](_0xdb4d('0x21'));_0x3bdaba='10';_0x186eac=_0xdb4d('0x21');break;case 0xb:logger[_0xdb4d('0x6')](_0xdb4d('0x22'));_0x3bdaba='11';_0x186eac='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a12e1){logger[_0xdb4d('0x14')](_0xdb4d('0x23'),JSON[_0xdb4d('0x16')](_0x4a12e1));_0x12793e['terminate']();}}function _0xad2d6(){logger[_0xdb4d('0x6')](_0xdb4d('0x24'));_0x4fa51a({'transcript':_0x4e3755,'confidence':_0x4cf003,'status':_0x3bdaba,'status_message':_0x186eac});}function _0x2e2bd1(_0x419d11){logger[_0xdb4d('0x14')](_0xdb4d('0x25'));if(!_[_0xdb4d('0x26')](_0x419d11)){logger[_0xdb4d('0x14')](_[_0xdb4d('0x27')](_0x419d11)?JSON['stringify'](_0x419d11):_0x419d11);}}_0x12793e['on']('open',_0x3d5fff);_0x12793e['on'](_0xdb4d('0x28'),_0x4fa179);_0x12793e['on'](_0xdb4d('0x12'),_0xad2d6);_0x12793e['on'](_0xdb4d('0x14'),_0x2e2bd1);});}; \ No newline at end of file +var _0x0074=['update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1'];(function(_0x3f8d17,_0x5851dc){var _0x3e6914=function(_0x56f707){while(--_0x56f707){_0x3f8d17['push'](_0x3f8d17['shift']());}};_0x3e6914(++_0x5851dc);}(_0x0074,0x145));var _0x4007=function(_0x4200f2,_0x2baf7a){_0x4200f2=_0x4200f2-0x0;var _0x5a2a85=_0x0074[_0x4200f2];return _0x5a2a85;};'use strict';var BPromise=require(_0x4007('0x0'));var _=require(_0x4007('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x4007('0x2'))(_0x4007('0x3'));module['exports']=function(_0x4f6210,_0x28c0ef,_0x3f5254,_0x275f7c){return new BPromise(function(_0x2b0cb1,_0x5a7b33){logger[_0x4007('0x4')]('Tilde\x20URI',_0x275f7c||_0x4007('0x5'));var _0x564fe5=new WebSocket(_0x275f7c||_0x4007('0x5'),{'perMessageDeflate':![]});var _0x3c4ab7='';var _0x1589d2='0';var _0x3ac6f8='1';var _0x55d316='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3d3218(_0x464aa9){var _0x16c859=crypto[_0x4007('0x6')](_0x4007('0x7'));_0x16c859[_0x4007('0x8')](_0x464aa9);return _0x16c859['digest'](_0x4007('0x9'));}function _0x587181(){try{logger[_0x4007('0x4')](_0x4007('0xa'));var _0x2f3694=moment()['unix']();var _0x4f1a20=_0x3d3218(_0x2f3694+_0x28c0ef+_0x3f5254);_0x564fe5[_0x4007('0xb')](JSON[_0x4007('0xc')]({'appID':_0x28c0ef,'timestamp':_0x2f3694,'appKey':_0x4f1a20}));var _0x225f6d=fs[_0x4007('0xd')](_0x4f6210);_0x225f6d['on']('data',function(_0x356648){_0x564fe5[_0x4007('0xb')](_0x356648);});_0x225f6d['on'](_0x4007('0xe'),function(){_0x564fe5[_0x4007('0xb')](_0x4007('0xf'));});}catch(_0x49314e){logger[_0x4007('0x10')](_0x4007('0x11'),JSON[_0x4007('0xc')](_0x49314e));_0x564fe5['terminate']();}}function _0x18e3c2(_0x32a399){try{if(_0x32a399){var _0x2069e5=JSON[_0x4007('0x12')](_0x32a399);switch(_0x2069e5[_0x4007('0x13')]){case 0x0:if(_0x2069e5[_0x4007('0x14')]){if(_0x2069e5[_0x4007('0x14')][_0x4007('0x15')]){logger[_0x4007('0x4')](_0x4007('0x16'),JSON['stringify'](_0x2069e5[_0x4007('0x14')]['hypotheses']));_0x3c4ab7=_0x2069e5[_0x4007('0x14')][_0x4007('0x17')][0x0][_0x4007('0x18')];_0x1589d2=_0x2069e5['result'][_0x4007('0x17')][0x0][_0x4007('0x19')];_0x3ac6f8='0';_0x55d316='Success.';_0x564fe5[_0x4007('0x1a')]();}}break;case 0x1:logger[_0x4007('0x4')](_0x4007('0x1b'));_0x3ac6f8='1';_0x55d316='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4007('0x4')](_0x4007('0x1c'));_0x3ac6f8='2';_0x55d316=_0x4007('0x1c');break;case 0x9:logger[_0x4007('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3ac6f8='9';_0x55d316=_0x4007('0x1d');break;case 0xa:logger[_0x4007('0x4')](_0x4007('0x1e'));_0x3ac6f8='10';_0x55d316='Authentication\x20failed.';break;case 0xb:logger['info'](_0x4007('0x1f'));_0x3ac6f8='11';_0x55d316=_0x4007('0x1f');}}}catch(_0x27f4ac){logger[_0x4007('0x10')](_0x4007('0x20'),JSON[_0x4007('0xc')](_0x27f4ac));_0x564fe5[_0x4007('0x1a')]();}}function _0xe454df(){logger[_0x4007('0x4')](_0x4007('0x21'));_0x2b0cb1({'transcript':_0x3c4ab7,'confidence':_0x1589d2,'status':_0x3ac6f8,'status_message':_0x55d316});}function _0x5103e4(_0x24fffa){logger['error'](_0x4007('0x22'));if(!_[_0x4007('0x23')](_0x24fffa)){logger['error'](_[_0x4007('0x24')](_0x24fffa)?JSON['stringify'](_0x24fffa):_0x24fffa);}}_0x564fe5['on']('open',_0x587181);_0x564fe5['on']('message',_0x18e3c2);_0x564fe5['on']('close',_0xe454df);_0x564fe5['on'](_0x4007('0x10'),_0x5103e4);});}; \ 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 0095f2d..2104917 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 _0x4826=['exports','./asr'];(function(_0x3d0528,_0x21a0b7){var _0x4ebb2d=function(_0x536ec8){while(--_0x536ec8){_0x3d0528['push'](_0x3d0528['shift']());}};_0x4ebb2d(++_0x21a0b7);}(_0x4826,0xb3));var _0x6482=function(_0x322722,_0x21e2cf){_0x322722=_0x322722-0x0;var _0x46b082=_0x4826[_0x322722];return _0x46b082;};var asr=require(_0x6482('0x0'));module[_0x6482('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5c2a=['exports','./asr'];(function(_0x2745fd,_0x47ee3c){var _0x5d4842=function(_0x347d43){while(--_0x347d43){_0x2745fd['push'](_0x2745fd['shift']());}};_0x5d4842(++_0x47ee3c);}(_0x5c2a,0x1b7));var _0xa5c2=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x5c2a[_0x2bb3f6];return _0x62b339;};var asr=require(_0xa5c2('0x0'));module[_0xa5c2('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 013c8b2..8401a08 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0xa28533,_0x2475d0){var _0x4d3d4b=function(_0x575577){while(--_0x575577){_0xa28533['push'](_0xa28533['shift']());}};_0x4d3d4b(++_0x2475d0);}(_0x34e8,0x12c));var _0x834e=function(_0x131d9f,_0x23538b){_0x131d9f=_0x131d9f-0x0;var _0x55ba64=_0x34e8[_0x131d9f];return _0x55ba64;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f4bac99..4f70e0c 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 _0xcb66=['map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','context','priority','accountcode','dnid','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','MALE','MP3','googleTTS','restAPI','timeout','includes','POST','PUT','method','toUpperCase','body','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','createCmContact','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','forEach','keys','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','digits','saynumber','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','debug','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','then','dsn','getUserById','getTrunkById','getSoundById','getSoundPath','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval'];(function(_0x7789e,_0x6cf9ae){var _0x284e64=function(_0x134898){while(--_0x134898){_0x7789e['push'](_0x7789e['shift']());}};_0x284e64(++_0x6cf9ae);}(_0xcb66,0x19f));var _0x6cb6=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xcb66[_0x23e6bb];return _0x1e3b4c;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x6cb6('0x0'));var sh=require(_0x6cb6('0x1'));var odbc=require(_0x6cb6('0x2'))();var rs=require(_0x6cb6('0x3'));var moment=require(_0x6cb6('0x4'));var Mustache=require('mustache');var rp=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var config=require(_0x6cb6('0x8'));var scripts=require(_0x6cb6('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x6cb6('0xa')];var verticesWithRetry=[_0x6cb6('0xb'),_0x6cb6('0xc'),_0x6cb6('0xd')];var AGIVertices=function(_0x1d0ee9,_0x4298d2,_0x3a5927){this[_0x6cb6('0xe')]=_0x1d0ee9;this[_0x6cb6('0xf')]=_0x4298d2;this[_0x6cb6('0x10')]=_0x3a5927;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x12')]=function(_0x1828f6,_0x592c78){this['rpc']['getVariableById'](_0x1828f6)['then'](function(_0x21de58){_0x592c78(null,_0x21de58?_0x21de58[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x2604e7){_0x592c78(_0x2604e7);});};AGIVertices['prototype'][_0x6cb6('0x15')]=function(_0x3c6267,_0x57ee3b){this[_0x6cb6('0xf')][_0x6cb6('0x16')](_0x3c6267)['then'](function(_0x107492){_0x57ee3b(null,_0x107492?_0x107492[_0x6cb6('0x13')]:![]);})['catch'](function(_0x5ab865){_0x57ee3b(_0x5ab865);});};AGIVertices['prototype']['getSquareProject']=function(_0x380edc,_0x298daa){this[_0x6cb6('0xf')][_0x6cb6('0x17')](_0x380edc)[_0x6cb6('0x18')](function(_0x40d445){_0x298daa(null,_0x40d445?_0x40d445['name']:![]);})[_0x6cb6('0x14')](function(_0xc0bdea){_0x298daa(_0xc0bdea);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x5ef3d2,_0x5b5dab){this['rpc']['getSquareOdbcById'](_0x5ef3d2)[_0x6cb6('0x18')](function(_0xcd1afa){_0x5b5dab(null,_0xcd1afa?_0xcd1afa[_0x6cb6('0x19')]:![]);})[_0x6cb6('0x14')](function(_0xc5dea0){_0x5b5dab(_0xc5dea0);});};AGIVertices['prototype']['getUser']=function(_0x2dffa4,_0x1d35d1){this[_0x6cb6('0xf')][_0x6cb6('0x1a')](_0x2dffa4)['then'](function(_0x34d1a6){_0x1d35d1(null,_0x34d1a6?_0x34d1a6[_0x6cb6('0x13')]:![]);})['catch'](function(_0x5ad4f2){_0x1d35d1(_0x5ad4f2);});};AGIVertices[_0x6cb6('0x11')]['getTrunk']=function(_0x5c91a2,_0x457865){this[_0x6cb6('0xf')][_0x6cb6('0x1b')](_0x5c91a2)[_0x6cb6('0x18')](function(_0x16db1d){_0x457865(null,_0x16db1d?_0x16db1d[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x1cc1ed){_0x457865(_0x1cc1ed);});};AGIVertices[_0x6cb6('0x11')]['getSound']=function(_0x5c525b,_0x4ea573){var _0x2dc6c9=this;this[_0x6cb6('0xf')][_0x6cb6('0x1c')](_0x5c525b)[_0x6cb6('0x18')](function(_0x1f8c9d){_0x4ea573(null,_0x1f8c9d?_0x2dc6c9[_0x6cb6('0x1d')](_0x1f8c9d['save_name']):![]);})[_0x6cb6('0x14')](function(_0x4d4ad9){_0x4ea573(_0x4d4ad9);});};AGIVertices[_0x6cb6('0x11')]['getMailAccount']=function(_0x13126c,_0x1f59cd){this[_0x6cb6('0xf')]['getMailAccountById'](_0x13126c)[_0x6cb6('0x18')](function(_0x1b7428){_0x1f59cd(null,_0x1b7428?_0x1b7428:![]);})[_0x6cb6('0x14')](function(_0x4a3785){_0x1f59cd(_0x4a3785);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1e')]=function(_0x386ef2,_0x573135,_0x16b653){this[_0x6cb6('0x10')]['sendMailMessage'](_0x386ef2,_0x573135)[_0x6cb6('0x18')](function(){_0x16b653(null);})[_0x6cb6('0x14')](function(_0x98abe0){_0x16b653(_0x98abe0);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1f')]=function(_0xb463fd,_0x3b05fe){this[_0x6cb6('0xf')][_0x6cb6('0x20')](_0xb463fd)[_0x6cb6('0x18')](function(_0x5a88be){if(_0x5a88be){if(_0x5a88be[_0x6cb6('0x21')]){_0x3b05fe(null,[_0x5a88be[_0x6cb6('0x22')]]);}else{_0x3b05fe(null,_[_0x6cb6('0x23')](_0x5a88be[_0x6cb6('0x24')],'interval'));}}else{_0x3b05fe(null,![]);}})['catch'](function(_0x59dd76){_0x3b05fe(_0x59dd76);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1d')]=function(_0x272f54){return util[_0x6cb6('0x25')](_0x6cb6('0x26'),FILES_PATH,_0x272f54);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x27')]=function(_0x950248,_0x4bbecb,_0x44d970){odbc['open'](_0x950248,function(_0x549368){if(_0x549368){logger[_0x6cb6('0x28')](_0x6cb6('0x29'),_0x549368);_0x44d970(_0x549368);}else{logger[_0x6cb6('0x2a')](_0x6cb6('0x2b'));odbc[_0x6cb6('0x2c')](_0x4bbecb,function(_0x1bb1e4,_0x5becea){if(_0x1bb1e4){logger[_0x6cb6('0x2a')]('Error\x20executing\x20query\x20%s',_0x4bbecb);_0x44d970(_0x1bb1e4);}else{logger[_0x6cb6('0x2a')](_0x6cb6('0x2d'),_0x4bbecb);odbc[_0x6cb6('0x2e')](function(_0x5a60a0){if(_0x5a60a0){logger['error'](_0x6cb6('0x2f'),_0x5a60a0);}_0x44d970(null,_0x5becea);});}});}});};AGIVertices['prototype'][_0x6cb6('0x30')]=function(_0x296a3b,_0xac22c9){this[_0x6cb6('0xf')][_0x6cb6('0x31')](_0x296a3b)[_0x6cb6('0x18')](function(_0x3652ca){_0xac22c9(null,_0x3652ca?_0x3652ca:![]);})['catch'](function(_0x359bd1){_0xac22c9(_0x359bd1);});};AGIVertices[_0x6cb6('0x11')]['createSmsMessage']=function(_0x163a8b,_0x4c6b9f){this[_0x6cb6('0xf')][_0x6cb6('0x32')](_0x163a8b)[_0x6cb6('0x18')](function(_0x3b435e){_0x4c6b9f(null,_0x3b435e);})['catch'](function(_0x5ba15f){_0x4c6b9f(_0x5ba15f);});};AGIVertices[_0x6cb6('0x11')]['createSquareDetailsReport']=function(_0x588ea4,_0x605673,_0x49beec){this[_0x6cb6('0xf')][_0x6cb6('0x33')]({'uniqueid':this['channel']['uniqueid'],'node':_0x588ea4[_0x6cb6('0x34')],'application':_0x588ea4['agicommand'],'data':_0x605673||null,'project_name':this[_0x6cb6('0xe')][_0x6cb6('0x35')],'callerid':this['channel'][_0x6cb6('0x36')]})[_0x6cb6('0x18')](function(_0x5ec0e1){if(_0x49beec){_0x49beec(null,_0x5ec0e1);}})[_0x6cb6('0x14')](function(_0x5b560d){if(_0x49beec){_0x49beec(_0x5b560d);}});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x37')]=function(_0x5b9d1d,_0x33a337,_0x2fc403,_0x591438){this['rpc'][_0x6cb6('0x37')]({'uniqueid':this[_0x6cb6('0xe')][_0x6cb6('0x38')],'callerid':this['channel'][_0x6cb6('0x36')],'calleridname':this[_0x6cb6('0xe')]['calleridname'],'context':this[_0x6cb6('0xe')][_0x6cb6('0x39')],'extension':this[_0x6cb6('0xe')]['extension'],'priority':this[_0x6cb6('0xe')][_0x6cb6('0x3a')],'accountcode':this[_0x6cb6('0xe')][_0x6cb6('0x3b')],'dnid':this[_0x6cb6('0xe')][_0x6cb6('0x3c')],'projectName':this['channel'][_0x6cb6('0x35')],'saveName':_0x33a337,'filename':_0x5b9d1d['file']||_0x33a337,'savePath':_0x2fc403})['then'](function(_0x29cb39){_0x591438(null,_0x29cb39);})[_0x6cb6('0x14')](function(_0x4b4137){_0x591438(_0x4b4137);});};AGIVertices[_0x6cb6('0x11')]['createSquareMessage']=function(_0x17b229,_0x2ae4ed,_0x3ed800,_0x5ee84a,_0x394f72){this[_0x6cb6('0xf')][_0x6cb6('0x3d')]({'uniqueid':this['channel'][_0x6cb6('0x38')],'body':_0x17b229,'direction':_0x2ae4ed,'providerName':_0x3ed800,'providerResponse':_0x5ee84a})['then'](function(_0x7e4104){if(_0x394f72){_0x394f72(null,_0x7e4104);}})[_0x6cb6('0x14')](function(_0x1bb142){if(_0x394f72){_0x394f72(_0x1bb142);}});};AGIVertices['prototype']['createCmContact']=function(_0xbf4f5f,_0x3dca6c){this[_0x6cb6('0xf')]['createCmContact']({'firstName':_[_0x6cb6('0x3e')](_0xbf4f5f[_0x6cb6('0x13')])||_[_0x6cb6('0x3f')](_0xbf4f5f['name'])?_0x6cb6('0x40')+Math[_0x6cb6('0x41')]():_0xbf4f5f[_0x6cb6('0x13')],'lastName':_['isEmpty'](_0xbf4f5f[_0x6cb6('0x42')])||_[_0x6cb6('0x3f')](_0xbf4f5f[_0x6cb6('0x42')])?null:_0xbf4f5f[_0x6cb6('0x42')],'phone':_0xbf4f5f[_0x6cb6('0x43')],'ListId':_0xbf4f5f[_0x6cb6('0x44')],'scheduledat':_0xbf4f5f[_0x6cb6('0x45')],'callbackUniqueid':this[_0x6cb6('0xe')][_0x6cb6('0x38')],'tags':_0x6cb6('0x46'),'description':_0x6cb6('0x47')+_0xbf4f5f[_0x6cb6('0x45')]['toString'](),'priority':_0xbf4f5f[_0x6cb6('0x48')]})[_0x6cb6('0x18')](function(_0x5f08e2){_0x3dca6c(null,_0x5f08e2);})[_0x6cb6('0x14')](function(_0x2e4382){_0x3dca6c(_0x2e4382);});};AGIVertices['prototype'][_0x6cb6('0x49')]=function(_0x23eba3,_0x4ece92){this['rpc'][_0x6cb6('0x4a')](_0x23eba3)[_0x6cb6('0x18')](function(_0x46ae66){_0x4ece92(null,_0x46ae66?_0x46ae66[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x9f2d9f){_0x4ece92(_0x9f2d9f);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x4b')]=function(_0x4e36d8,_0x142386,_0x4e9c3f){var _0x24d57c={'role':_0x6cb6('0x4c')};_0x24d57c[_0x4e36d8]=this['channel'][_0x6cb6('0x36')];this['rpc']['agentPause'](_0x24d57c,_0x142386,this[_0x6cb6('0xe')][_0x6cb6('0x38')])[_0x6cb6('0x18')](function(_0x34ccd7){_0x4e9c3f(null,_[_0x6cb6('0x3f')](_0x34ccd7)?![]:!![]);})['catch'](function(_0x217165){logger[_0x6cb6('0x28')](_0x217165);_0x4e9c3f(null,![]);});};AGIVertices['prototype'][_0x6cb6('0x4d')]=function(_0x43084b,_0x39b7c8){var _0x51ab15={'role':_0x6cb6('0x4c')};_0x51ab15[_0x43084b]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];this[_0x6cb6('0xf')][_0x6cb6('0x4d')](_0x51ab15)['then'](function(_0x34f98c){_0x39b7c8(null,_['isNil'](_0x34f98c)?![]:!![]);})[_0x6cb6('0x14')](function(_0x5d2091){logger[_0x6cb6('0x28')](_0x5d2091);_0x39b7c8(null,![]);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x4e')]=function(_0x2884b1,_0x72525b){var _0x5b7de3={'role':_0x6cb6('0x4c')};_0x5b7de3[_0x2884b1]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];this[_0x6cb6('0xf')][_0x6cb6('0x4e')](_0x5b7de3)[_0x6cb6('0x18')](function(_0x5be76b){_0x72525b(null,_['isNil'](_0x5be76b)?![]:!![]);})[_0x6cb6('0x14')](function(_0x1aec61){logger[_0x6cb6('0x28')](_0x1aec61);_0x72525b(null,![]);});};AGIVertices['prototype'][_0x6cb6('0x4f')]=function(_0x33829b,_0x84d0cc){var _0x51d1bd={'role':_0x6cb6('0x4c')};_0x51d1bd[_0x33829b]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];var _0x22ec81=_0x33829b!='internal'?util[_0x6cb6('0x25')]('%s/%s@from-sip/n',_0x6cb6('0x50'),this[_0x6cb6('0xe')][_0x6cb6('0x36')]):undefined;this['rpc']['agentLogin'](_0x51d1bd,_0x22ec81)[_0x6cb6('0x18')](function(_0x301b33){_0x84d0cc(null,_['isNil'](_0x301b33)?![]:!![]);})[_0x6cb6('0x14')](function(_0x47f528){logger[_0x6cb6('0x28')](_0x47f528);_0x84d0cc(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x4ad974,_0x2b542d){sh[_0x6cb6('0x51')](_[_0x6cb6('0x52')](_0x4ad974),function(_0x3556da,_0x4d2eaf){var _0x4fe51b=_0x4d2eaf[_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'');_0x2b542d(null,_0x4fe51b);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x302c63,_0x30f1f9){scripts[_0x6cb6('0x54')](_0x302c63[_0x6cb6('0x55')],_0x302c63['google_cloud_tts_text_type']||_0x6cb6('0x56'),_0x302c63[_0x6cb6('0x56')],_0x302c63[_0x6cb6('0x57')]||'en-US',_0x302c63['ssmlGender']||_0x6cb6('0x58'),_0x302c63['audioEncoding']||_0x6cb6('0x59'))['then'](function(_0x5adb9a){_0x30f1f9(null,_0x5adb9a);})[_0x6cb6('0x14')](function(_0x2448dd){_0x30f1f9(_0x2448dd);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x5a')]=function(_0xe28845,_0x2c3d4c){scripts[_0x6cb6('0x5a')](_0xe28845[_0x6cb6('0x56')],_0xe28845['google_tts_language']||'en',0x1)[_0x6cb6('0x18')](function(_0x11644d){_0x2c3d4c(null,_0x11644d);})[_0x6cb6('0x14')](function(_0x4283a7){_0x2c3d4c(_0x4283a7);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x5b')]=function(_0x27b851,_0xeaa6ab){var _0x285c9b={'uri':_0x27b851['url'],'method':_0x27b851['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x27b851['timeout'])==='number'&&parseInt(_0x27b851[_0x6cb6('0x5c')])>=0x1?parseInt(_0x27b851['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6cb6('0x5d')]([_0x6cb6('0x5e'),_0x6cb6('0x5f')],_0x285c9b[_0x6cb6('0x60')][_0x6cb6('0x61')]())){try{_0x285c9b[_0x6cb6('0x62')]=_0x27b851[_0x6cb6('0xa')]?JSON[_0x6cb6('0x63')](_0x27b851[_0x6cb6('0xa')]):{};}catch(_0x2f46bc){logger[_0x6cb6('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2f46bc);}}try{_0x285c9b['headers']=_0x27b851[_0x6cb6('0x64')]?JSON[_0x6cb6('0x63')](_0x27b851[_0x6cb6('0x64')]):{};}catch(_0x2b8f2c){logger[_0x6cb6('0x28')](_0x6cb6('0x65'),_0x2b8f2c);}if(_0x27b851['computedVariables']){try{var _0x526467=require(_0x27b851['computedVariables'])[_0x6cb6('0x66')](this,_0x285c9b);_0x285c9b[_0x6cb6('0x67')]=Mustache[_0x6cb6('0x68')](_0x27b851[_0x6cb6('0x69')],_0x526467,{},['$$','$$']);if(_0x285c9b[_0x6cb6('0x6a')]){_0x285c9b[_0x6cb6('0x6a')]=JSON[_0x6cb6('0x63')](Mustache['render'](JSON['stringify'](_0x285c9b['headers']),_0x526467,{},['$$','$$']));}if(_0x285c9b[_0x6cb6('0x62')]){_0x285c9b[_0x6cb6('0x62')]=JSON[_0x6cb6('0x63')](Mustache[_0x6cb6('0x68')](JSON[_0x6cb6('0x6b')](_0x285c9b[_0x6cb6('0x62')]),_0x526467,{},['$$','$$']));}}catch(_0x2b00ad){logger[_0x6cb6('0x28')](_0x6cb6('0x6c'),_0x2b00ad);}}rp(_0x285c9b)['then'](function(_0x2d646c){var _0x3e1d6c={'statusCode':_0x2d646c[_0x6cb6('0x6d')]||0xc8,'statusMessage':_0x2d646c[_0x6cb6('0x6e')]||'OK','headers':_0x2d646c[_0x6cb6('0x6a')]||{},'body':_0x2d646c[_0x6cb6('0x62')]||{}};_0xeaa6ab(null,_0x3e1d6c);})[_0x6cb6('0x14')](function(_0x4e53cd){var _0x54b00b={'statusCode':_0x4e53cd[_0x6cb6('0x6d')]||0x1f4,'statusMessage':_0x4e53cd[_0x6cb6('0x6f')]||_0x6cb6('0x70'),'headers':_0x4e53cd[_0x6cb6('0x71')]['headers']||{},'body':_0x4e53cd[_0x6cb6('0x71')][_0x6cb6('0x62')]||{}};_0xeaa6ab(null,_0x54b00b);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x72')]=function(_0x208f7b,_0x53e4e3){scripts[_0x6cb6('0x72')](this[_0x6cb6('0xe')][_0x6cb6('0x38')],_0x208f7b[_0x6cb6('0x73')],_0x208f7b[_0x6cb6('0x56')],_0x208f7b[_0x6cb6('0x74')]||'en')[_0x6cb6('0x18')](function(_0x41a918){_0x53e4e3(null,_0x41a918);})[_0x6cb6('0x14')](function(_0x3d891b){_0x53e4e3(_0x3d891b);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x75')]=function(_0x4c3672,_0x3bdddb){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x4c3672[_0x6cb6('0x76')],_0x4c3672['client_email'],_0x4c3672[_0x6cb6('0x77')],_0x4c3672[_0x6cb6('0x56')],_0x4c3672[_0x6cb6('0x78')]||'en')[_0x6cb6('0x18')](function(_0x2087d8){_0x3bdddb(null,_0x2087d8);})[_0x6cb6('0x14')](function(_0xaf5181){_0x3bdddb(_0xaf5181);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x79')]=function(_0x253a1f,_0x4943f3){scripts[_0x6cb6('0x79')](this[_0x6cb6('0xe')],_0x253a1f)['then'](function(_0x8d3531){_0x4943f3(null,_0x8d3531);})['catch'](function(_0x47f625){_0x4943f3(_0x47f625);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7a')]=function(_0x3a7be0,_0x3369ca){scripts[_0x6cb6('0x7a')](_0x3a7be0[_0x6cb6('0x73')],_0x3a7be0['text'],_0x3a7be0[_0x6cb6('0x7b')]||_0x6cb6('0x7c'),_0x3a7be0['speed'])[_0x6cb6('0x18')](function(_0x58a31a){_0x3369ca(null,_0x58a31a);})[_0x6cb6('0x14')](function(_0x40fe72){_0x3369ca(_0x40fe72);});};AGIVertices['prototype'][_0x6cb6('0x7d')]=function(_0x146bed,_0x38a305,_0x32d8cf){scripts[_0x6cb6('0x7d')](_0x38a305,_0x146bed[_0x6cb6('0x73')],_0x146bed['ispeech_asr_language']||_0x6cb6('0x7c'),this[_0x6cb6('0x7e')](_0x146bed[_0x6cb6('0x7f')])?_0x146bed[_0x6cb6('0x7f')]:undefined)[_0x6cb6('0x18')](function(_0x312a4a){_0x32d8cf(null,_0x312a4a);})['catch'](function(_0x16f774){_0x32d8cf(_0x16f774);});};AGIVertices['prototype']['awsPolly']=function(_0x3cd8bb,_0xfc4f5e){scripts['awsPolly'](_0x3cd8bb[_0x6cb6('0x80')],_0x3cd8bb[_0x6cb6('0x81')],_0x3cd8bb['aws_polly_region'],_0x3cd8bb[_0x6cb6('0x82')]||_0x6cb6('0x83'),_0x3cd8bb[_0x6cb6('0x56')],_0x3cd8bb['aws_text_type']||'text')[_0x6cb6('0x18')](function(_0xc256c4){_0xfc4f5e(null,_0xc256c4);})[_0x6cb6('0x14')](function(_0x429572){_0xfc4f5e(_0x429572);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x84')]=function(_0x3fef21,_0xcd0781){scripts[_0x6cb6('0x84')](this[_0x6cb6('0xe')][_0x6cb6('0x38')],_0x3fef21['aws_access_key_id'],_0x3fef21[_0x6cb6('0x81')],_0x3fef21[_0x6cb6('0x85')],_0x3fef21[_0x6cb6('0x56')],_0x3fef21[_0x6cb6('0x86')])[_0x6cb6('0x18')](function(_0x129fa7){_0xcd0781(null,_0x129fa7);})['catch'](function(_0x1a2172){_0xcd0781(_0x1a2172);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x87')]=function(_0x5733af,_0x11ba2f,_0x161600){scripts['googleASR'](_0x11ba2f,_0x5733af['key'],_0x5733af[_0x6cb6('0x88')]||'en-US')[_0x6cb6('0x18')](function(_0x2af6e6){_0x161600(null,_0x2af6e6);})['catch'](function(_0x282c3d){_0x161600(_0x282c3d);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x89')]=function(_0x303c38,_0x22858a,_0x4b0b04){scripts[_0x6cb6('0x89')](_0x22858a,_0x303c38[_0x6cb6('0x8a')],_0x303c38[_0x6cb6('0x8b')],_0x303c38[_0x6cb6('0x67')])['then'](function(_0x419b66){_0x4b0b04(null,_0x419b66);})[_0x6cb6('0x14')](function(_0x34641c){_0x4b0b04(_0x34641c);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x8c')]=function(_0x5217d7){var _0x49486a=_['includes'](verticesWithRetry,_0x5217d7[_0x6cb6('0x8d')])?_0x5217d7:_[_0x6cb6('0x8e')](_0x5217d7);for(var _0x399831 in _0x49486a){if(_0x49486a[_0x6cb6('0x8f')](_0x399831)){if(_0x49486a[_0x399831]&&_['isString'](_0x49486a[_0x399831])){if(_[_0x6cb6('0x5d')](recursiveMapAttributes,_0x399831)){_0x49486a[_0x399831]=this[_0x6cb6('0x90')](_0x49486a[_0x399831]);}else{_0x49486a[_0x399831]=this[_0x6cb6('0x91')](_0x49486a[_0x399831]);}}}}return _0x49486a;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x92')]=function(_0x49e78f){for(var _0x5e541e in _0x49e78f){if(_0x49e78f[_0x6cb6('0x8f')](_0x5e541e)){if(_[_0x6cb6('0x93')](_0x49e78f[_0x5e541e])){this[_0x6cb6('0x92')](_0x49e78f[_0x5e541e]);}else if(_[_0x6cb6('0x94')](_0x49e78f[_0x5e541e])){for(var _0x1c6ac8=0x0;_0x1c6ac8<_0x49e78f[_0x5e541e][_0x6cb6('0x95')];_0x1c6ac8++){this[_0x6cb6('0x92')](_0x49e78f[_0x5e541e][_0x1c6ac8]);}}else if(_[_0x6cb6('0x96')](_0x49e78f[_0x5e541e])){_0x49e78f[_0x5e541e]=this[_0x6cb6('0x91')](_0x49e78f[_0x5e541e]);}}}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x97')]=function(_0x1e4b50,_0x5c1116){for(var _0x445eb3 in _0x1e4b50){if(_0x1e4b50[_0x6cb6('0x8f')](_0x445eb3)){if(_[_0x6cb6('0x93')](_0x1e4b50[_0x445eb3])){if(!_[_0x6cb6('0x3e')](_0x1e4b50[_0x445eb3])){this[_0x6cb6('0x97')](_0x1e4b50[_0x445eb3],util[_0x6cb6('0x25')]('%s.%s',_0x5c1116,_0x445eb3));}}else if(_[_0x6cb6('0x94')](_0x1e4b50[_0x445eb3])){for(var _0x53c85e=0x0;_0x53c85e<_0x1e4b50[_0x445eb3][_0x6cb6('0x95')];_0x53c85e++){this[_0x6cb6('0x97')](_0x1e4b50[_0x445eb3][_0x53c85e],util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x5c1116,_0x445eb3+'['+_0x53c85e+']'));}}else{if(!_[_0x6cb6('0x3f')](_0x1e4b50[_0x445eb3])){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util['format']('%s.%s',_0x5c1116,_0x445eb3),_0x1e4b50[_0x445eb3]);}}}}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x90')]=function(_0x478fea){try{var _0x2a6aff=JSON[_0x6cb6('0x63')](_0x478fea);this['recursiveNodeIndex'](_0x2a6aff);return JSON['stringify'](_0x2a6aff);}catch(_0x49a59f){return this[_0x6cb6('0x91')](_0x478fea);}};AGIVertices[_0x6cb6('0x11')]['replaceAllVariables']=function(_0xc079e8){var _0x32906c=_0xc079e8[_0x6cb6('0x9a')]('{');for(var _0x4e0c9e=0x1;_0x4e0c9e<_0x32906c[_0x6cb6('0x95')];_0x4e0c9e+=0x1){var _0x4ca47b=_0x32906c[_0x4e0c9e]['split']('}');if(_0x4ca47b['length']>0x1){_0xc079e8=_0xc079e8[_0x6cb6('0x9b')]('{'+_0x4ca47b[0x0]+'}',this['channel'][_0x6cb6('0x12')](_0x4ca47b[0x0])[_0x6cb6('0x9c')]||_0x4ca47b[0x0]);}}if(_0x32906c[_0x6cb6('0x95')]===0x1){return _0xc079e8['toString']();}return this[_0x6cb6('0x91')](_0xc079e8);};AGIVertices['prototype']['getAndSetVariable']=function(_0x956faa,_0x32f2f4){var _0x535241=this[_0x6cb6('0xe')][_0x6cb6('0x12')](_0x956faa);if(_0x535241[_0x6cb6('0x9d')]===-0x1){return _0x535241;}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x9e'),_0x32f2f4,_0x535241[_0x6cb6('0x9c')]));return this[_0x6cb6('0xe')]['setVariable'](_0x32f2f4,_0x535241[_0x6cb6('0x9c')]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7e')]=function(_0x53a8ef){return _0x53a8ef&&_0x53a8ef!=='0'&&_0x53a8ef!=='-1'&&_0x53a8ef!=='';};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x9f')]=function(_0x27ef33){this[_0x6cb6('0x33')]['sync'](this,_0x27ef33,'-');_0x27ef33[_0x6cb6('0xa0')]=_0x27ef33[_0x6cb6('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6cb6('0x11')]['mrcpsynth']=function(_0x7c1691){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xa1'),_0x7c1691[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x7c1691['text'])){return this[_0x6cb6('0xe')]['noop']('no\x20text\x20configured');}var _0x299acf='\x22'+_0x7c1691['text']+'\x22';if(this[_0x6cb6('0x7e')](_0x7c1691['options'])){_0x299acf+=','+_0x7c1691['options'];}var _0x37a01b=this['channel']['exec'](_0x6cb6('0xa2'),_0x299acf);if(_0x37a01b[_0x6cb6('0x9d')]===-0x1){return _0x37a01b;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x299acf));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xa5')]=function(_0x279907){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x279907[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x279907['grammar'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20grammar\x20configured');}var _0x24159b=_0x279907[_0x6cb6('0xa6')];if(this['isConfigured'](_0x279907[_0x6cb6('0x71')])){_0x24159b+=','+_0x279907['options'];}var _0x274650=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa7'),_0x24159b);if(_0x274650[_0x6cb6('0x9d')]===-0x1){return _0x274650;}var _0x12bce9=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x12bce9[_0x6cb6('0x9d')]===-0x1){return _0x12bce9;}var _0x56465e=this[_0x6cb6('0xa8')]('RECOG_INPUT()',_0x6cb6('0xaa'));if(_0x56465e[_0x6cb6('0x9d')]===-0x1){return _0x56465e;}var _0x9385e7=this[_0x6cb6('0xa8')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x9385e7[_0x6cb6('0x9d')]===-0x1){return _0x9385e7;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x24159b));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7')]=function(_0x400bae){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xab'),_0x400bae[_0x6cb6('0x34')]));return this['channel'][_0x6cb6('0x7')]([_0x400bae[_0x6cb6('0xac')],_0x400bae[_0x6cb6('0xad')]]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xae')]=function(_0x19d0cd){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0xaf'),_0x19d0cd[_0x6cb6('0x34')]));if(this['isConfigured'](_0x19d0cd[_0x6cb6('0x5c')])){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x19d0cd[_0x6cb6('0x5c')]));var _0x5431ff=this[_0x6cb6('0xe')]['wait'](_0x19d0cd[_0x6cb6('0x5c')]);if(_0x5431ff[_0x6cb6('0x9d')]===-0x1){return _0x5431ff;}}return this['channel']['answer']();};AGIVertices['prototype']['callback']=function(_0x476c52){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xb0'),_0x476c52[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x476c52['list_id'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x476c52,_0x6cb6('0xb1'));}_0x476c52[_0x6cb6('0x45')]=moment();if(this[_0x6cb6('0x7e')](_0x476c52[_0x6cb6('0xb2')])){_0x476c52['scheduledAt']=moment()[_0x6cb6('0xb3')](_0x476c52[_0x6cb6('0xb2')],_0x6cb6('0xb4'));}if(!this[_0x6cb6('0x7e')](_0x476c52[_0x6cb6('0x48')])){_0x476c52['callback_priority']=0x2;}this[_0x6cb6('0xb5')][_0x6cb6('0x66')](this,_0x476c52);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x476c52[_0x6cb6('0x43')],_0x476c52['list_id'],_0x476c52[_0x6cb6('0x45')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xb6')]=function(_0x218d6f){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x218d6f['label']));var _0x156c78=this['channel'][_0x6cb6('0x51')](_0x218d6f[_0x6cb6('0xb7')],_0x218d6f[_0x6cb6('0x71')]);if(_0x156c78['result']===-0x1){return _0x156c78;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x218d6f[_0x6cb6('0xb7')],_0x218d6f[_0x6cb6('0x71')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xb9')]=function(_0x51e260){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xba'),_0x51e260['label']));if(!this[_0x6cb6('0x7e')](_0x51e260[_0x6cb6('0x56')])){return this['channel'][_0x6cb6('0xa3')]('no\x20text\x20configured');}var _0x50f33e='\x22'+_0x51e260[_0x6cb6('0x56')]+'\x22';if(this[_0x6cb6('0x7e')](_0x51e260[_0x6cb6('0x71')])){_0x50f33e+=','+_0x51e260[_0x6cb6('0x71')];}var _0x2fd9ff=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa2'),_0x50f33e);if(_0x2fd9ff[_0x6cb6('0x9d')]===-0x1){return _0x2fd9ff;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x50f33e));};AGIVertices[_0x6cb6('0x11')]['sestektts']=function(_0x1853ce){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1853ce[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x1853ce['text'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20text\x20configured');}var _0x4c7b6c='\x22'+_0x1853ce['text']+'\x22';if(this[_0x6cb6('0x7e')](_0x1853ce['options'])){_0x4c7b6c+=','+_0x1853ce[_0x6cb6('0x71')];}var _0x4e5661=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa2'),_0x4c7b6c);if(_0x4e5661['result']===-0x1){return _0x4e5661;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x4c7b6c));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xbb')]=function(_0x3295f6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xbc'),_0x3295f6[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x3295f6['grammar'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xbd'));}var _0x2ba800=_0x3295f6[_0x6cb6('0xa6')];if(this['isConfigured'](_0x3295f6[_0x6cb6('0x71')])){_0x2ba800+=','+_0x3295f6[_0x6cb6('0x71')];}var _0x565cd7=this[_0x6cb6('0xe')]['exec'](_0x6cb6('0xa7'),_0x2ba800);if(_0x565cd7['result']===-0x1){return _0x565cd7;}var _0x15fd77=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),'LUMENVOX_ASR_CONFIDENCE');if(_0x15fd77[_0x6cb6('0x9d')]===-0x1){return _0x15fd77;}var _0x1da669=this[_0x6cb6('0xa8')]('RECOG_INPUT()',_0x6cb6('0xbe'));if(_0x1da669['result']===-0x1){return _0x1da669;}var _0x210741=this[_0x6cb6('0xa8')](_0x6cb6('0xbf'),_0x6cb6('0xc0'));if(_0x210741[_0x6cb6('0x9d')]===-0x1){return _0x210741;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2ba800));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc1')]=function(_0xe3988){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xc2'),_0xe3988['label']));if(!this[_0x6cb6('0x7e')](_0xe3988['grammar'])){return this[_0x6cb6('0xe')]['noop']('no\x20grammar\x20configured');}var _0x49f842=_0xe3988[_0x6cb6('0xa6')];if(this[_0x6cb6('0x7e')](_0xe3988[_0x6cb6('0x71')])){_0x49f842+=','+_0xe3988[_0x6cb6('0x71')];}var _0x267233=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa7'),_0x49f842);if(_0x267233[_0x6cb6('0x9d')]===-0x1){return _0x267233;}var _0x57fd05=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),_0x6cb6('0xc3'));if(_0x57fd05['result']===-0x1){return _0x57fd05;}var _0x124218=this[_0x6cb6('0xa8')](_0x6cb6('0xc4'),_0x6cb6('0xc5'));if(_0x124218[_0x6cb6('0x9d')]===-0x1){return _0x124218;}var _0x130593=this['getAndSetVariable'](_0x6cb6('0xbf'),_0x6cb6('0xc6'));if(_0x130593[_0x6cb6('0x9d')]===-0x1){return _0x130593;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x49f842));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc7')]=function(_0x5129a7){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xc8'),_0x5129a7[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x5129a7['odbc_id'])){return this[_0x6cb6('0xe')]['error'](_0x5129a7,_0x6cb6('0xc9'));}var _0x60086b=this['getSquareOdbc'][_0x6cb6('0x66')](this,_0x5129a7[_0x6cb6('0xca')]);if(!_0x60086b){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,_0x6cb6('0xcb'));}if(!this[_0x6cb6('0x7e')](_0x5129a7[_0x6cb6('0x2c')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,_0x6cb6('0xcc'));}var _0xb02e89=_0x5129a7[_0x6cb6('0x2c')][_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('query:\x20%s',_0xb02e89));var _0x4e5593=this['getQueryOdbc'][_0x6cb6('0x66')](this,_0x60086b,_0xb02e89);this['createSquareDetailsReport']['sync'](this,_0x5129a7,_0xb02e89);if(!this[_0x6cb6('0x7e')](_0x5129a7[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x414926=this[_0x6cb6('0x12')]['sync'](this,_0x5129a7[_0x6cb6('0xcd')]);if(!_0x414926){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,'no\x20variable\x20found');}var _0x3209b9=this;_0x4e5593[_0x6cb6('0xce')](function(_0x3f98a6,_0x45b2d3){Object[_0x6cb6('0xcf')](_0x3f98a6)[_0x6cb6('0xce')](function(_0x478180){_0x3209b9[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')]('%s[%s][%s]',_0x414926,_0x45b2d3,_0x478180),_0x3f98a6[_0x478180]);});});this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xd0'),_0x414926),_0x4e5593[_0x6cb6('0x95')]);return this['channel'][_0x6cb6('0xa3')](util['format']('variable\x20%s\x20set',_0x414926));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xd1')]=function(_0x5ef860){logger['debug'](util[_0x6cb6('0x25')](_0x6cb6('0xd2'),_0x5ef860['label']));if(!this['isConfigured'](_0x5ef860[_0x6cb6('0xd3')])){return this['channel'][_0x6cb6('0x28')](_0x5ef860,'no\x20user\x20selected');}var _0x91122f=this[_0x6cb6('0xd4')][_0x6cb6('0x66')](this,_0x5ef860[_0x6cb6('0xd3')]);if(!_0x91122f){return this[_0x6cb6('0xe')]['error'](_0x5ef860,_0x6cb6('0xd5'));}var _0x110f1d=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xd6'),[util['format']('SIP/%s',_0x91122f),_0x5ef860[_0x6cb6('0x5c')],_0x5ef860[_0x6cb6('0xd7')],_0x5ef860[_0x6cb6('0x69')]]);if(_0x110f1d['result']===-0x1){return _0x110f1d;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xd8'),_0x6cb6('0xd6')));};AGIVertices['prototype'][_0x6cb6('0xd9')]=function(_0x2993be){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xda'),_0x2993be[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x2993be['key'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdb'));}if(!this[_0x6cb6('0x7e')](_0x2993be[_0x6cb6('0x56')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this['channel'][_0x6cb6('0xdd')]=!![];this['createSquareDetailsReport'](_0x2993be);this[_0x6cb6('0x3d')](_0x2993be['text'],'in','','');this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xde'),_0x2993be[_0x6cb6('0x56')]));var _0x38310b=this[_0x6cb6('0x72')][_0x6cb6('0x66')](this,_0x2993be);if(_0x38310b){for(var _0x1cb98e in _0x38310b){if(_0x38310b['hasOwnProperty'](_0x1cb98e)){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xdf'),_0x1cb98e[_0x6cb6('0x61')]()),_0x38310b[_0x1cb98e]);}}this[_0x6cb6('0x3d')](_0x38310b[_0x6cb6('0xe0')],_0x6cb6('0xe1'),'dialogflow','');return this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xe2'),_0x38310b['speech']));}return this['channel']['error'](_0x2993be,_0x6cb6('0xe3'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xe4')]=function(_0x230ec6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xe5'),_0x230ec6[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x76')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xe6'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0xe7')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xe8'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x77')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xe9'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x78')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xea'));}if(!this[_0x6cb6('0x7e')](_0x230ec6['text'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xdd')]=!![];this['createSquareDetailsReport'](_0x230ec6);this['createSquareMessage'](_0x230ec6[_0x6cb6('0x56')],'in','','');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x230ec6[_0x6cb6('0x56')]));var _0x5f1cc7=this[_0x6cb6('0x75')]['sync'](this,_0x230ec6);if(_0x5f1cc7){for(var _0x2eba4a in _0x5f1cc7){if(_0x5f1cc7['hasOwnProperty'](_0x2eba4a)){if(_0x2eba4a!==_0x6cb6('0xeb')){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xdf'),_0x2eba4a['toUpperCase']()),_0x5f1cc7[_0x2eba4a]);}}}this[_0x6cb6('0x3d')](_0x5f1cc7['speech'],'out','dialogflowV2',_0x5f1cc7[_0x6cb6('0xeb')]);return this['channel']['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xec'),_0x5f1cc7[_0x6cb6('0xe0')]));}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x230ec6,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x6cb6('0xed')]=function(_0x3de187){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xee'),_0x3de187[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x3de187['ndauth_url'])){return this['channel']['noop'](_0x6cb6('0xef'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf0')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xf1'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf2')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xf3'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf4')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x3de187);this[_0x6cb6('0x3d')](_0x3de187[_0x6cb6('0x56')],'in','','');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x3de187[_0x6cb6('0x56')]));var _0x393f3f=this['sestekNDA'][_0x6cb6('0x66')](this,_0x3de187);if(_0x393f3f){for(var _0x34af51 in _0x393f3f){if(_0x393f3f[_0x6cb6('0x8f')](_0x34af51)){this['channel'][_0x6cb6('0x99')](util['format']('SESTEK_NDA_%s',_0x34af51[_0x6cb6('0x61')]()),_0x393f3f[_0x34af51]);}}this[_0x6cb6('0x3d')](_0x393f3f[_0x6cb6('0xe0')],_0x6cb6('0xe1'),_0x6cb6('0xed'),'');if(_0x393f3f['audiofile']){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xf5'),_0x393f3f[_0x6cb6('0xf6')]));var _0x12b908=this['channel'][_0x6cb6('0xf7')](_0x393f3f[_0x6cb6('0xf6')]);try{fs[_0x6cb6('0xf8')](_0x393f3f['audiofile']+_0x6cb6('0xf9'));}catch(_0x433c42){logger[_0x6cb6('0x28')](_0x433c42);}return _0x12b908;}else{return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('SestekNDA\x20Result\x20%s',_0x393f3f[_0x6cb6('0xe0')]));}}return this['channel'][_0x6cb6('0x28')](_0x3de187,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xfa')]=function(_0x33aca9){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20END\x20(%s)\x20block',_0x33aca9[_0x6cb6('0x34')]));return this['channel'][_0x6cb6('0xa3')]('end');};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xfb')]=function(_0x2a64ee){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0xfc'),_0x2a64ee[_0x6cb6('0x34')]));var _0x352d9a='';if(_0x2a64ee[_0x6cb6('0xfd')]){if(!this['isConfigured'](_0x2a64ee[_0x6cb6('0xfd')])){return this[_0x6cb6('0xe')]['error'](_0x2a64ee,_0x6cb6('0xfe'));}else{var _0x55cc81=parseInt(_0x2a64ee['trunk_id'],0xa);if(isNaN(_0x55cc81)){_0x352d9a=_0x2a64ee[_0x6cb6('0xfd')];}else{_0x352d9a=this['getTrunk']['sync'](this,_0x2a64ee['trunk_id']);if(!_0x352d9a){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x2a64ee,_0x6cb6('0xff'));}}}}else if(_0x2a64ee[_0x6cb6('0x100')]){_0x352d9a=_0x2a64ee[_0x6cb6('0x100')];}else{return this['channel'][_0x6cb6('0x28')](_0x2a64ee,_0x6cb6('0xfe'));}var _0xdd11eb=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xd6'),[util['format']('SIP/%s/%s',_0x352d9a,_0x2a64ee[_0x6cb6('0x43')]),_0x2a64ee[_0x6cb6('0x5c')],_0x2a64ee[_0x6cb6('0xd7')],_0x2a64ee[_0x6cb6('0x69')]]);if(_0xdd11eb['result']===-0x1){return _0xdd11eb;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('Executed\x20command\x20%s',_0x6cb6('0xd6')));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x101')]=function(_0xe0dde4){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0xe0dde4[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x101'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc')]=function(_0x23a5e7){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x102'),_0x23a5e7[_0x6cb6('0x34')]));if(_0x23a5e7[_0x6cb6('0xa0')]===0x0){return this[_0x6cb6('0x9f')](_0x23a5e7);}_0x23a5e7[_0x6cb6('0xa0')]-=0x1;if(!this['isConfigured'](_0x23a5e7[_0x6cb6('0x103')])){return this['channel'][_0x6cb6('0x28')](_0x23a5e7,_0x6cb6('0x104'));}var _0x29a79b=this[_0x6cb6('0x105')][_0x6cb6('0x66')](this,_0x23a5e7[_0x6cb6('0x103')]);if(!_0x29a79b){return this['channel'][_0x6cb6('0x28')](_0x23a5e7,_0x6cb6('0x106'));}if(!this[_0x6cb6('0x7e')](_0x23a5e7[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x45650b=this[_0x6cb6('0xe')][_0x6cb6('0x107')](_0x29a79b,_0x23a5e7[_0x6cb6('0x108')],_0x23a5e7[_0x6cb6('0x109')]);var _0x306a95=_0x45650b['result']?_0x45650b[_0x6cb6('0x9d')][_0x6cb6('0x10a')]():'';logger[_0x6cb6('0x2a')](_0x6cb6('0x10b'),JSON['stringify'](_0x45650b));if(_0x45650b[_0x6cb6('0x9d')]===-0x1){this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x306a95);return _0x45650b;}else if(_0x45650b[_0x6cb6('0x9c')]===_0x6cb6('0x5c')){_0x45650b['result']=_0x306a95[_0x6cb6('0x95')]>=parseInt(_0x23a5e7['mindigit'])?'x':'i';}else{_0x45650b['result']=_0x306a95['length']>=parseInt(_0x23a5e7[_0x6cb6('0x10c')])&&_0x306a95[_0x6cb6('0x95')]<=parseInt(_0x23a5e7[_0x6cb6('0x109')])?'x':'i';}var _0x4676fb=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x23a5e7[_0x6cb6('0xcd')]);if(!_0x4676fb){return this['channel']['error'](_0x23a5e7,_0x6cb6('0x10d'));}this['channel']['setVariable'](_0x4676fb,_0x306a95);if(this[_0x6cb6('0x7e')](_0x23a5e7[_0x6cb6('0x10e')])){var _0x3f0cfb=parseInt(_0x23a5e7[_0x6cb6('0x10e')],0xa);var _0x2ff472=rs[_0x6cb6('0x10f')]({'charset':'*','length':_0x3f0cfb});var _0x512620=_0x306a95[_0x6cb6('0x95')];if(_0x512620>0x0){if(_0x512620>_0x3f0cfb){this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x23a5e7[_0x6cb6('0x110')]===_0x6cb6('0x111')?_0x2ff472+_0x306a95[_0x6cb6('0x112')](_0x3f0cfb):_0x306a95[_0x6cb6('0x112')](0x0,_0x512620-_0x3f0cfb)+_0x2ff472);}else{this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,rs[_0x6cb6('0x10f')]({'charset':'*','length':_0x512620}));}}else{this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x23a5e7,'');}}else{this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x306a95);}return _0x45650b;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xd')]=function(_0x2d4699){logger['info'](util['format'](_0x6cb6('0x113'),_0x2d4699[_0x6cb6('0x34')]));return this[_0x6cb6('0xc')](_0x2d4699);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x114')]=function(_0x5f32e3){logger['info'](util['format'](_0x6cb6('0x115'),_0x5f32e3['label']));this['createSquareDetailsReport']['sync'](this,_0x5f32e3,_0x5f32e3['goalname']);return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x116'),_0x5f32e3['goalname']));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x117')]=function(_0x27ba97){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x118'),_0x27ba97[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x27ba97['aws_access_key_id'])||!this[_0x6cb6('0x7e')](_0x27ba97[_0x6cb6('0x81')])){return this[_0x6cb6('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x27ba97[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x27ba97['text']));var _0x1c3311=this['awsPolly']['sync'](this,_0x27ba97);if(_0x1c3311){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x1c3311));var _0x48296e=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x1c3311);try{fs[_0x6cb6('0xf8')](_0x1c3311+_0x6cb6('0xf9'));}catch(_0x28ee8c){logger[_0x6cb6('0x28')](_0x28ee8c);}return _0x48296e;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27ba97,_0x6cb6('0x119'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x11a')]=function(_0x15201f){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x11b'),_0x15201f[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x15201f[_0x6cb6('0x80')])||!this[_0x6cb6('0x7e')](_0x15201f['aws_secret_access_key'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x11c'));}if(!this['isConfigured'](_0x15201f[_0x6cb6('0x86')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0x11d'));}if(!this[_0x6cb6('0x7e')](_0x15201f['text'])){return this['channel']['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xdd')]=!![];this[_0x6cb6('0x33')](_0x15201f);this['createSquareMessage'](_0x15201f['text'],'in','','');this['channel'][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x11e'),_0x15201f['text']));var _0x5c16b2=this['awsLex'][_0x6cb6('0x66')](this,_0x15201f);if(_0x5c16b2){for(var _0x1daaec in _0x5c16b2){if(_0x5c16b2[_0x6cb6('0x8f')](_0x1daaec)&&_['isString'](_0x5c16b2[_0x1daaec])){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x11f'),_0x1daaec[_0x6cb6('0x61')]()),_0x5c16b2[_0x1daaec]);}}if(_['isNil'](_0x5c16b2['message'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x120'));}else{this[_0x6cb6('0x3d')](_0x5c16b2['message'],'out',_0x6cb6('0x121'),'');return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x122'),_0x5c16b2[_0x6cb6('0x6f')]));}}return this[_0x6cb6('0xe')]['error'](_0x15201f,_0x6cb6('0x123'));};AGIVertices['prototype']['googleasr']=function(_0x234755){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x234755[_0x6cb6('0x34')],_0x234755[_0x6cb6('0x5c')]));if(!this[_0x6cb6('0x7e')](_0x234755['key'])){return this[_0x6cb6('0xe')]['noop']('no\x20key\x20configured');}var _0x20fb85=_0x6cb6('0x124');var _0x51334f=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs['generate'](0x4));var _0x2974e0=util['format'](_0x6cb6('0x98'),_0x51334f,_0x20fb85);var _0x4b671c=!![];if(_0x234755['beep']===_0x6cb6('0x126')){_0x4b671c=![];}var _0x1bb5b9=this[_0x6cb6('0xe')]['recordFile'](_0x51334f,_0x20fb85,_0x234755[_0x6cb6('0x127')],_0x234755[_0x6cb6('0x5c')],undefined,_0x4b671c);if(_0x1bb5b9[_0x6cb6('0x9d')]!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x128'),_0x2974e0));var _0x12fb7c=this['googleASR'][_0x6cb6('0x66')](this,_0x234755,_0x2974e0);if(_0x12fb7c){for(var _0x3cbfd6 in _0x12fb7c){if(_0x12fb7c['hasOwnProperty'](_0x3cbfd6)){this[_0x6cb6('0xe')]['setVariable'](util[_0x6cb6('0x25')]('GOOGLE_ASR_%s',_0x3cbfd6[_0x6cb6('0x61')]()),_0x12fb7c[_0x3cbfd6]);}}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x129'),JSON[_0x6cb6('0x6b')](_0x12fb7c)));}}return _0x1bb5b9;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x12a')]=function(_0x3b062c){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x12b'),_0x3b062c['label']));if(!this[_0x6cb6('0x7e')](_0x3b062c['appid'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x12c'));}if(!this[_0x6cb6('0x7e')](_0x3b062c[_0x6cb6('0x8b')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x12d'));}var _0x310e38=_0x6cb6('0x124');var _0x4e09c4=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs[_0x6cb6('0x10f')](0x4));var _0x21277e=util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x4e09c4,_0x310e38);var _0x521ba4=!![];if(_0x3b062c[_0x6cb6('0x12e')]==='NOBEEP'){_0x521ba4=![];}var _0x349596=this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x4e09c4,_0x310e38,_0x3b062c[_0x6cb6('0x127')],_0x3b062c['timeout'],undefined,_0x521ba4);if(_0x349596[_0x6cb6('0x9d')]!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x130'),_0x21277e));var _0x17a168=this[_0x6cb6('0x89')]['sync'](this,_0x3b062c,_0x21277e);if(_0x17a168){for(var _0x56db63 in _0x17a168){if(_0x17a168[_0x6cb6('0x8f')](_0x56db63)){this['channel'][_0x6cb6('0x99')](util['format'](_0x6cb6('0x131'),_0x56db63[_0x6cb6('0x61')]()),_0x17a168[_0x56db63]);}}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x132'),JSON[_0x6cb6('0x6b')](_0x17a168)));}}return _0x349596;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x133')]=function(_0x1f6bb3){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1f6bb3[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['continueAt'](_0x1f6bb3[_0x6cb6('0x39')],_0x1f6bb3[_0x6cb6('0x134')],_0x1f6bb3['priority']);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x135')]=function(_0x31d329){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x136'),_0x31d329[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x31d329[_0x6cb6('0x137')])){return this['channel'][_0x6cb6('0x28')](_0x31d329,'no\x20condition\x20configured');}try{var _0x381838=eval(_0x31d329[_0x6cb6('0x137')])?_0x6cb6('0x138'):_0x6cb6('0x139');this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x13a'),_0x31d329[_0x6cb6('0x137')],_0x381838));return{'code':0xc8,'result':_0x381838};}catch(_0x51d82d){return{'code':0xc8,'result':_0x6cb6('0x139')};}};AGIVertices[_0x6cb6('0x11')]['gotoiftime']=function(_0x5bfbb5){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5bfbb5[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x5bfbb5[_0x6cb6('0x13b')])){return this['channel'][_0x6cb6('0x28')](_0x5bfbb5,_0x6cb6('0x13c'));}var _0x1170a2=this['getIntervals'][_0x6cb6('0x66')](this,_0x5bfbb5[_0x6cb6('0x13b')]);if(!_0x1170a2){return this['channel'][_0x6cb6('0x28')](_0x5bfbb5,_0x6cb6('0x13d'));}for(var _0x52da7a=0x0;_0x52da7a<_0x1170a2[_0x6cb6('0x95')];_0x52da7a+=0x1){var _0x9c5b5d=this[_0x6cb6('0xe')][_0x6cb6('0x12')](util[_0x6cb6('0x25')](_0x6cb6('0x13e'),_0x1170a2[_0x52da7a]));if(_0x9c5b5d['result']===-0x1){return _0x9c5b5d;}logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x9c5b5d[_0x6cb6('0x9c')]));if(_0x9c5b5d['extra']==='true'){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x6cb6('0x138')));this['channel']['noop'](util[_0x6cb6('0x25')]('IFTIME\x20%s\x20%s',_0x1170a2[_0x52da7a],_0x6cb6('0x138')));return{'code':0xc8,'result':_0x6cb6('0x138')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],'false'));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x6cb6('0x139')));}}return{'code':0xc8,'result':_0x6cb6('0x139')};};AGIVertices[_0x6cb6('0x11')]['hangup']=function(_0x5906a1){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5906a1['label']));return this['channel'][_0x6cb6('0x140')]();};AGIVertices[_0x6cb6('0x11')]['ispeechasr']=function(_0x60f307){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x141'),_0x60f307[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x60f307[_0x6cb6('0x73')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20key\x20configured');}var _0x4bb493='wav';var _0x12e7f4=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs[_0x6cb6('0x10f')](0x4));var _0x151ebd=util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x12e7f4,_0x4bb493);var _0x2d187d=!![];if(_0x60f307[_0x6cb6('0x12e')]===_0x6cb6('0x126')){_0x2d187d=![];}var _0x4c1a74=this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x12e7f4,_0x4bb493,_0x60f307[_0x6cb6('0x127')],_0x60f307[_0x6cb6('0x5c')],undefined,_0x2d187d);if(_0x4c1a74['result']!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x142'),_0x151ebd));var _0x3a241f=this[_0x6cb6('0x7d')]['sync'](this,_0x60f307,_0x151ebd);if(_0x3a241f){for(var _0x51214f in _0x3a241f){if(_0x3a241f['hasOwnProperty'](_0x51214f)){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x143'),_0x51214f[_0x6cb6('0x61')]()),_0x3a241f[_0x51214f]);}}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x3a241f)));}}return _0x4c1a74;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x144')]=function(_0x15ae44){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x145'),_0x15ae44[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x15ae44[_0x6cb6('0x73')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdb'));}if(!this[_0x6cb6('0x7e')](_0x15ae44['text'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x146'),_0x15ae44[_0x6cb6('0x56')]));var _0x5258a1=this[_0x6cb6('0x7a')][_0x6cb6('0x66')](this,_0x15ae44);if(_0x5258a1){this['channel']['noop'](util['format'](_0x6cb6('0x142'),_0x5258a1));var _0x364ba6=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x5258a1,_0x15ae44[_0x6cb6('0x127')]);try{fs[_0x6cb6('0xf8')](_0x5258a1+_0x6cb6('0xf9'));}catch(_0x211142){logger[_0x6cb6('0x28')](_0x211142);}return _0x364ba6;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x15ae44,_0x6cb6('0x147'));};AGIVertices['prototype']['login']=function(_0x54eecb){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x148'),_0x54eecb[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x54eecb[_0x6cb6('0x149')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x54eecb,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb[_0x6cb6('0x149')]));var _0x5f0fed=this[_0x6cb6('0x4f')]['sync'](this,_0x54eecb[_0x6cb6('0x149')]);if(_0x5f0fed){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')]['callerid'],_0x54eecb[_0x6cb6('0x149')]));this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14d')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb['findBy']));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')]['callerid'],_0x54eecb[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x150')]=function(_0x328965){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x328965[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x328965['findBy'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x328965,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));var _0x382cba=this[_0x6cb6('0x4e')][_0x6cb6('0x66')](this,_0x328965[_0x6cb6('0x149')]);if(_0x382cba){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x151')]=function(_0x581c12){logger['info'](util['format'](_0x6cb6('0x152'),_0x581c12['label']));if(!this['isConfigured'](_0x581c12['operation'])){return this['channel'][_0x6cb6('0x28')](_0x581c12,_0x6cb6('0x153'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x154'),_0x581c12[_0x6cb6('0x155')]));var _0x536903=eval(_0x581c12[_0x6cb6('0x155')]);if(!this[_0x6cb6('0x7e')](_0x581c12['variable_id'])){return this['channel']['noop'](_0x6cb6('0x156'));}var _0x30405a=this[_0x6cb6('0x12')]['sync'](this,_0x581c12[_0x6cb6('0xcd')]);if(!_0x30405a){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x581c12,_0x6cb6('0x10d'));}if(_['isArray'](_0x536903)){var _0x54e001=this;_0x536903[_0x6cb6('0xce')](function(_0x374dff,_0x2156e2){_0x54e001[_0x6cb6('0xe')]['setVariable'](util[_0x6cb6('0x25')](_0x6cb6('0x157'),_0x30405a,_0x2156e2),_0x374dff);});return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('variable\x20%s[key]\x20set',_0x30405a));}else{return this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x30405a,_0x536903);}};AGIVertices[_0x6cb6('0x11')]['menu']=function(_0x8b6b2f){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x158'),_0x8b6b2f[_0x6cb6('0x34')]));if(_0x8b6b2f['retry']===0x0){return this[_0x6cb6('0x9f')](_0x8b6b2f);}_0x8b6b2f['retry']-=0x1;if(!this[_0x6cb6('0x7e')](_0x8b6b2f[_0x6cb6('0x103')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,_0x6cb6('0x104'));}var _0x4cf526=this[_0x6cb6('0x105')][_0x6cb6('0x66')](this,_0x8b6b2f[_0x6cb6('0x103')]);if(!_0x4cf526){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,'no\x20file\x20audio\x20found');}var _0x5a6d8b=this[_0x6cb6('0xe')][_0x6cb6('0x107')](_0x4cf526,_0x8b6b2f[_0x6cb6('0x108')],_0x8b6b2f[_0x6cb6('0x159')]);var _0xf1b2ed=_0x5a6d8b[_0x6cb6('0x9d')];if(_0x5a6d8b[_0x6cb6('0x9d')]===-0x1){this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x8b6b2f,'-1');return _0x5a6d8b;}else if(_0x5a6d8b[_0x6cb6('0x9c')]==='timeout'){_0x5a6d8b[_0x6cb6('0x9d')]=_0x5a6d8b['result'][_0x6cb6('0x95')]>0x0?_0x5a6d8b[_0x6cb6('0x9d')]:'t';}else if(_['isEmpty'](_0x5a6d8b[_0x6cb6('0x9d')])){_0x5a6d8b[_0x6cb6('0x9d')]='#';_0xf1b2ed='#';}if(!this[_0x6cb6('0x7e')](_0x8b6b2f['variable_id'])){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x156'));}else{var _0x2c7dfd=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x8b6b2f[_0x6cb6('0xcd')]);if(!_0x2c7dfd){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,_0x6cb6('0x10d'));}this[_0x6cb6('0xe')]['setVariable'](_0x2c7dfd,_0xf1b2ed);}this['createSquareDetailsReport']['sync'](this,_0x8b6b2f,_0xf1b2ed);return _0x5a6d8b;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xa3')]=function(_0x589e5b){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x15a'),_0x589e5b[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['noop'](_0x589e5b[_0x6cb6('0x15b')]||_0x589e5b['label']);};AGIVertices['prototype'][_0x6cb6('0x15c')]=function(_0x49f22a){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x15d'),_0x49f22a['label']));if(!this[_0x6cb6('0x7e')](_0x49f22a['findBy'])){return this['channel'][_0x6cb6('0x28')](_0x49f22a,'no\x20find\x20by\x20configured');}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));var _0xa6702b=this['getPause'][_0x6cb6('0x66')](this,_0x49f22a[_0x6cb6('0x15e')]);var _0x61d00a=this[_0x6cb6('0x4b')][_0x6cb6('0x66')](this,_0x49f22a['findBy'],_0xa6702b);if(_0x61d00a){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a[_0x6cb6('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a[_0x6cb6('0x149')]));this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x15f')]=function(_0x27aa82){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x160'),_0x27aa82['label']));if(!this[_0x6cb6('0x7e')](_0x27aa82[_0x6cb6('0x103')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27aa82,_0x6cb6('0x104'));}var _0x46071c=this['getSound']['sync'](this,_0x27aa82[_0x6cb6('0x103')]);if(!_0x46071c){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27aa82,_0x6cb6('0x106'));}var _0x690476=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0x161'),[_0x46071c,_0x27aa82[_0x6cb6('0xd7')]]);if(_0x690476[_0x6cb6('0x9d')]===-0x1){return _0x690476;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0xb8'),_0x6cb6('0x161'),_0x46071c));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x162')]=function(_0x12ce7c){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x12ce7c[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x12ce7c['queue_id'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x12ce7c,_0x6cb6('0x163'));}var _0x527014='';var _0x494969=parseInt(_0x12ce7c[_0x6cb6('0x164')],0xa);if(isNaN(_0x494969)){_0x527014=_0x12ce7c[_0x6cb6('0x164')];}else{_0x527014=this[_0x6cb6('0x15')][_0x6cb6('0x66')](this,_0x12ce7c[_0x6cb6('0x164')]);if(!_0x527014){return this['channel'][_0x6cb6('0x28')](_0x12ce7c,_0x6cb6('0x165'));}}var _0x129c57='';if(this[_0x6cb6('0x7e')](_0x12ce7c['file_id'])){var _0x5a8f78=this['getSound'][_0x6cb6('0x66')](this,_0x12ce7c[_0x6cb6('0x103')]);if(_0x5a8f78){_0x129c57=_0x5a8f78;}}this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x12ce7c,_0x527014);if(_0x12ce7c[_0x6cb6('0xd7')]['indexOf']('x')<0x0){_0x12ce7c[_0x6cb6('0xd7')]+='x';}if(_0x12ce7c['opts'][_0x6cb6('0x166')]('X')<0x0){_0x12ce7c[_0x6cb6('0xd7')]+='X';}this['channel'][_0x6cb6('0x99')]('XMCS-QUEUE',_0x527014?_0x527014[_0x6cb6('0x167')]():'');var _0x5d46fc=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0x168'),[_0x527014,_0x12ce7c[_0x6cb6('0xd7')],_0x12ce7c[_0x6cb6('0x69')],_0x129c57,_0x12ce7c[_0x6cb6('0x5c')],_0x12ce7c[_0x6cb6('0x7')],_0x12ce7c[_0x6cb6('0x169')],_0x12ce7c[_0x6cb6('0x16a')],'',_0x12ce7c[_0x6cb6('0x16b')]]);if(_0x5d46fc[_0x6cb6('0x9d')]===-0x1){return _0x5d46fc;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x168'),_0x527014));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x16c')]=function(_0x4a5943){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x16d'),_0x4a5943[_0x6cb6('0x34')]));var _0xc3d4b4=_0x4a5943[_0x6cb6('0x16e')]||_0x6cb6('0x124');var _0x194428=util[_0x6cb6('0x25')](_0x6cb6('0x16f'),this[_0x6cb6('0xe')][_0x6cb6('0x38')],rs[_0x6cb6('0x10f')](0x5));var _0x5bdf1f=util['format'](_0x6cb6('0x170'),FILES_PATH,_0x194428,_0xc3d4b4);var _0x41786f=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,_0x194428);this[_0x6cb6('0x37')]['sync'](this,_0x4a5943,_0x194428,_0x5bdf1f);this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x6cb6('0x171'),_0x194428);logger[_0x6cb6('0x2a')](_0x6cb6('0x172'),_0x41786f,_0xc3d4b4,_0x4a5943[_0x6cb6('0x173')],_0x4a5943['timeout']);return this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x41786f,_0xc3d4b4,_0x4a5943[_0x6cb6('0x173')],_0x4a5943[_0x6cb6('0x5c')],undefined,!![]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x174')]=function(_0x15e1d7){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x175'),_0x15e1d7['label']));if(!this[_0x6cb6('0x7e')](_0x15e1d7[_0x6cb6('0x69')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20url\x20configured');}var _0x23634b=this['restAPI']['sync'](this,_0x15e1d7);logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x176'),util[_0x6cb6('0x177')](_0x23634b,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x15e1d7['variable_id'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x178'));}var _0x4a71de=this['getVariable']['sync'](this,_0x15e1d7[_0x6cb6('0xcd')]);if(!_0x4a71de){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x15e1d7,'no\x20variable\x20found');}this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x179'),_0x4a71de),_0x23634b[_0x6cb6('0x6d')]?_0x23634b[_0x6cb6('0x6d')]:_0x6cb6('0x17a'));this[_0x6cb6('0xe')][_0x6cb6('0x99')](util['format']('%s_STATUS_MESSAGE',_0x4a71de),_0x23634b['statusMessage']?_0x23634b[_0x6cb6('0x6e')]:'OK');if(_0x23634b[_0x6cb6('0x62')]){try{this['saveRestApiResult'](_0x23634b[_0x6cb6('0x62')],_0x4a71de);}catch(_0x31e888){logger['error'](util['format'](_0x6cb6('0x17b'),_0x4a71de));}}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x17c'),_0x4a71de));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x17d')]=function(_0x49b21d){logger[_0x6cb6('0x2a')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x49b21d[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['sayDigits'](_0x49b21d[_0x6cb6('0x17e')]['replace'](/\s+/g,''),_0x49b21d['escape_digits']);};AGIVertices['prototype'][_0x6cb6('0x17f')]=function(_0x1fcfdf){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1fcfdf[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0x180')](_0x1fcfdf[_0x6cb6('0x181')][_0x6cb6('0x53')](/\s+/g,''),_0x1fcfdf['escape_digits']);};AGIVertices[_0x6cb6('0x11')]['sayphonetic']=function(_0x1a41b9){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x182'),_0x1a41b9[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0x183')](_0x1a41b9[_0x6cb6('0x56')],_0x1a41b9['escape_digits']);};AGIVertices['prototype'][_0x6cb6('0x184')]=function(_0x4dcdf7){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x185'),_0x4dcdf7[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x4dcdf7[_0x6cb6('0x186')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20mail\x20account\x20configured');}var _0x5e3063=this[_0x6cb6('0x187')][_0x6cb6('0x66')](this,_0x4dcdf7[_0x6cb6('0x186')]);if(!_0x5e3063||!_0x5e3063[_0x6cb6('0x188')]){return this['channel'][_0x6cb6('0x28')](_0x4dcdf7,'no\x20mail\x20account\x20found');}var _0x311c5e={'from':util['format'](_0x6cb6('0x189'),_0x5e3063['name'],_0x5e3063[_0x6cb6('0x18a')]||_0x5e3063[_0x6cb6('0x188')][_0x6cb6('0x18b')]),'to':_0x4dcdf7['to']||'','cc':_0x4dcdf7['cc']||'','bcc':_0x4dcdf7[_0x6cb6('0x18c')]||'','subject':_0x4dcdf7[_0x6cb6('0x18d')],'html':_0x4dcdf7['text'],'text':_0x4dcdf7['text']};if(this[_0x6cb6('0x7e')](_0x4dcdf7[_0x6cb6('0x18e')])){}logger[_0x6cb6('0x18f')](_0x6cb6('0x190'),JSON['stringify'](_0x311c5e));this['createSquareDetailsReport'][_0x6cb6('0x66')](this,_0x4dcdf7,_0x4dcdf7[_0x6cb6('0x186')]);this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5e3063['name']));this['sendMailMessage']['sync'](this,_0x5e3063[_0x6cb6('0x191')],_0x311c5e);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x192'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x193')]=function(_0x5f2422){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x194'),_0x5f2422[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x195'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x196')]=function(_0xbb748d){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xbb748d[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xbb748d[_0x6cb6('0x197')])){return this[_0x6cb6('0xe')]['noop']('no\x20sms\x20account\x20configured');}var _0x470308=this[_0x6cb6('0x30')][_0x6cb6('0x66')](this,_0xbb748d[_0x6cb6('0x197')]);if(!_0x470308){return this['channel'][_0x6cb6('0x28')](_0xbb748d,'no\x20sms\x20account\x20found');}var _0x12c8d9={'body':_0xbb748d[_0x6cb6('0x198')],'phone':_0xbb748d['to']||'','SmsAccountId':_0x470308['id']};logger['debug'](_0x6cb6('0x199'),JSON[_0x6cb6('0x6b')](_0x12c8d9));this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0xbb748d,_0xbb748d[_0x6cb6('0x197')]);this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x19a'),_0x470308[_0x6cb6('0x13')]));this[_0x6cb6('0x32')][_0x6cb6('0x66')](this,_0x12c8d9);return this['channel'][_0x6cb6('0xa3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6cb6('0x11')]['set']=function(_0x4428c3){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x19b'),_0x4428c3[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x4428c3[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x4428c3,_0x6cb6('0x19c'));}var _0x5ce075=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x4428c3['variable_id']);if(!_0x5ce075){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x4428c3,_0x6cb6('0x10d'));}return this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x5ce075,_0x4428c3[_0x6cb6('0x19d')]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x19e')]=function(_0x91c12a){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x19f'),_0x91c12a[_0x6cb6('0x34')]));this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x1a0'));var _0x3a9a8e=this[_0x6cb6('0xe')][_0x6cb6('0x12')]('XMCS-UNIQUEID');if(!_[_0x6cb6('0x3e')](_0x3a9a8e[_0x6cb6('0x9c')])){this[_0x6cb6('0xe')]['uniqueid']=_0x3a9a8e[_0x6cb6('0x9c')];}if(_0x91c12a[_0x6cb6('0xae')]===_0x6cb6('0x1a1')){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x1a2'));return this[_0x6cb6('0xe')][_0x6cb6('0xae')]();}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x1a3'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1a4')]=function(_0xd0ba58){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1a5'),_0xd0ba58[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xd0ba58[_0x6cb6('0x1a6')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xd0ba58,_0x6cb6('0x1a7'));}var _0x391c50=this[_0x6cb6('0x1a8')][_0x6cb6('0x66')](this,_0xd0ba58['project_id']);if(!this['isConfigured'](_0x391c50)){return this['channel'][_0x6cb6('0x28')](_0xd0ba58,util[_0x6cb6('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xd0ba58['project_id']));}if(_0x391c50===this[_0x6cb6('0xe')][_0x6cb6('0x35')]){return this[_0x6cb6('0xe')]['error'](_0xd0ba58,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0xd0ba58,_0x391c50);var _0x156fcc=this[_0x6cb6('0xe')][_0x6cb6('0x51')]('AGI',util[_0x6cb6('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x6cb6('0x7')][_0x6cb6('0x1a9')]||_0x6cb6('0x1aa'),_0x391c50,this[_0x6cb6('0xe')]['arg_1']));if(_0x156fcc['result']===-0x1){return _0x156fcc;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x1ab'),_0x391c50));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1ac')]=function(_0x3ba9d6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x1ad'),_0x3ba9d6[_0x6cb6('0x34')]));var _0x4625ba=this[_0x6cb6('0x1ae')][_0x6cb6('0x66')](this,_0x3ba9d6[_0x6cb6('0xac')]);this['createSquareDetailsReport']['sync'](this,_0x3ba9d6,_0x3ba9d6[_0x6cb6('0xac')]);if(this[_0x6cb6('0x7e')](_0x3ba9d6[_0x6cb6('0xcd')])){var _0x296314=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x3ba9d6[_0x6cb6('0xcd')]);if(_0x296314){this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x296314,_0x4625ba);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3ba9d6[_0x6cb6('0xac')],_0x296314));}}return this['channel']['noop'](util[_0x6cb6('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3ba9d6[_0x6cb6('0xac')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1af')]=function(_0xa2d575){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1b0'),_0xa2d575[_0x6cb6('0x34')]));_0xa2d575[_0x6cb6('0x56')]=_0xa2d575[_0x6cb6('0x56')][_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6cb6('0x7e')](_0xa2d575[_0x6cb6('0x55')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0x1b1'));}if(!this['isConfigured'](_0xa2d575[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x1b2'),_0xa2d575['text']));var _0x6ffd=this[_0x6cb6('0x54')]['sync'](this,_0xa2d575);if(_0x6ffd){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x1b3'),_0x6ffd));var _0x2ec658=this['channel'][_0x6cb6('0xf7')](_0x6ffd);try{fs[_0x6cb6('0xf8')](_0x6ffd+'.wav');}catch(_0x3195f8){logger[_0x6cb6('0x28')](_0x3195f8);}return _0x2ec658;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xa2d575,_0x6cb6('0x1b4'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1b5')]=function(_0x3d2d1a){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1b6'),_0x3d2d1a['label']));_0x3d2d1a[_0x6cb6('0x56')]=_0x3d2d1a[_0x6cb6('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6cb6('0x7e')](_0x3d2d1a[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x1b7'),_0x3d2d1a[_0x6cb6('0x56')]));var _0x20515f=this[_0x6cb6('0x5a')]['sync'](this,_0x3d2d1a);if(_0x20515f){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x20515f));var _0x34dc21=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x20515f);try{fs[_0x6cb6('0xf8')](_0x20515f+_0x6cb6('0xf9'));}catch(_0x803de5){logger[_0x6cb6('0x28')](_0x803de5);}return _0x34dc21;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x3d2d1a,_0x6cb6('0x1b8'));};AGIVertices['prototype'][_0x6cb6('0x1b9')]=function(_0xb14047){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x1ba'),_0xb14047[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xb14047[_0x6cb6('0x149')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xb14047,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0xb14047[_0x6cb6('0x149')]));var _0x36fb63=this[_0x6cb6('0x4d')]['sync'](this,_0xb14047[_0x6cb6('0x149')]);if(_0x36fb63){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14d')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1bb')]=function(_0x5acd5d){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x1bc'),_0x5acd5d['label']));var _0x403bf3=this['channel'][_0x6cb6('0x51')](_0x6cb6('0x1bd'),[_0x5acd5d[_0x6cb6('0x1be')],_0x5acd5d[_0x6cb6('0x71')]]);if(_0x403bf3[_0x6cb6('0x9d')]===-0x1){return _0x403bf3;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x1bd'),_0x5acd5d[_0x6cb6('0x1be')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1bf')]=function(_0x46ef87){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1c0'),_0x46ef87[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x46ef87[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')]['error'](_0x46ef87,_0x6cb6('0x19c'));}var _0x42f355=this['getVariable'][_0x6cb6('0x66')](this,_0x46ef87[_0x6cb6('0xcd')]);if(!_0x42f355){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x46ef87,_0x6cb6('0x10d'));}var _0x3a0c3f=this[_0x6cb6('0xe')][_0x6cb6('0x12')](_0x42f355);return{'code':0xc8,'result':_0x3a0c3f[_0x6cb6('0x9c')]?_0x3a0c3f['extra']:'-'};};String[_0x6cb6('0x11')]['replaceAll']=function(_0x2314ca,_0x598505){return this['split'](_0x2314ca)[_0x6cb6('0x1c1')](_0x598505);};module['exports']=AGIVertices; \ No newline at end of file +var _0x8819=['beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayNumber','sayphonetic','sayPhonetic','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','POST','PUT','toUpperCase','body','rawBody','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','sync','uri','render','stringify','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','includes','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceAll','getAndSetVariable','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','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','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','.wav','SestekNDA\x20is\x20unreachable','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','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'];(function(_0x81e065,_0x50994e){var _0x16441b=function(_0x3ae149){while(--_0x3ae149){_0x81e065['push'](_0x81e065['shift']());}};_0x16441b(++_0x50994e);}(_0x8819,0x94));var _0x9881=function(_0x6c7872,_0x11aa19){_0x6c7872=_0x6c7872-0x0;var _0x2bd8b3=_0x8819[_0x6c7872];return _0x2bd8b3;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x9881('0x0'));var odbc=require(_0x9881('0x1'))();var rs=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var Mustache=require(_0x9881('0x4'));var rp=require('request-promise');var logger=require(_0x9881('0x5'))(_0x9881('0x6'));var config=require(_0x9881('0x7'));var scripts=require(_0x9881('0x8'));var FILES_PATH=_0x9881('0x9');var recursiveMapAttributes=[_0x9881('0xa'),'rawBody'];var verticesWithRetry=[_0x9881('0xb'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x15c0f8,_0x48d5a6,_0x5c2c0f){this[_0x9881('0xc')]=_0x15c0f8;this['rpc']=_0x48d5a6;this[_0x9881('0xd')]=_0x5c2c0f;};AGIVertices[_0x9881('0xe')][_0x9881('0xf')]=function(_0x571947,_0x1df0ba){this[_0x9881('0x10')][_0x9881('0x11')](_0x571947)[_0x9881('0x12')](function(_0x5b6bad){_0x1df0ba(null,_0x5b6bad?_0x5b6bad[_0x9881('0x13')]:![]);})[_0x9881('0x14')](function(_0x5c6d2d){_0x1df0ba(_0x5c6d2d);});};AGIVertices[_0x9881('0xe')]['getVoiceQueue']=function(_0x52744e,_0x48cfe1){this['rpc'][_0x9881('0x15')](_0x52744e)[_0x9881('0x12')](function(_0x39f5fb){_0x48cfe1(null,_0x39f5fb?_0x39f5fb[_0x9881('0x13')]:![]);})[_0x9881('0x14')](function(_0x1d57ea){_0x48cfe1(_0x1d57ea);});};AGIVertices['prototype'][_0x9881('0x16')]=function(_0x14b5a9,_0xcc4b6d){this['rpc']['getSquareProjectById'](_0x14b5a9)['then'](function(_0x280ea2){_0xcc4b6d(null,_0x280ea2?_0x280ea2['name']:![]);})[_0x9881('0x14')](function(_0x5a9848){_0xcc4b6d(_0x5a9848);});};AGIVertices['prototype'][_0x9881('0x17')]=function(_0x310f11,_0x1cbac3){this[_0x9881('0x10')][_0x9881('0x18')](_0x310f11)[_0x9881('0x12')](function(_0x3ae21d){_0x1cbac3(null,_0x3ae21d?_0x3ae21d[_0x9881('0x19')]:![]);})[_0x9881('0x14')](function(_0x3a9cb2){_0x1cbac3(_0x3a9cb2);});};AGIVertices[_0x9881('0xe')][_0x9881('0x1a')]=function(_0xe60803,_0x300fa6){this[_0x9881('0x10')]['getUserById'](_0xe60803)['then'](function(_0x4031af){_0x300fa6(null,_0x4031af?_0x4031af['name']:![]);})['catch'](function(_0x1ba558){_0x300fa6(_0x1ba558);});};AGIVertices[_0x9881('0xe')]['getTrunk']=function(_0x501343,_0x92a67e){this['rpc'][_0x9881('0x1b')](_0x501343)[_0x9881('0x12')](function(_0x16eeca){_0x92a67e(null,_0x16eeca?_0x16eeca[_0x9881('0x13')]:![]);})[_0x9881('0x14')](function(_0x14e6f9){_0x92a67e(_0x14e6f9);});};AGIVertices[_0x9881('0xe')][_0x9881('0x1c')]=function(_0xc328b7,_0x23727b){var _0x900eae=this;this[_0x9881('0x10')][_0x9881('0x1d')](_0xc328b7)['then'](function(_0x31956e){_0x23727b(null,_0x31956e?_0x900eae[_0x9881('0x1e')](_0x31956e['save_name']):![]);})[_0x9881('0x14')](function(_0x3d7120){_0x23727b(_0x3d7120);});};AGIVertices['prototype'][_0x9881('0x1f')]=function(_0x3b6c6f,_0x217a1c){this[_0x9881('0x10')][_0x9881('0x20')](_0x3b6c6f)[_0x9881('0x12')](function(_0x225a4c){_0x217a1c(null,_0x225a4c?_0x225a4c:![]);})[_0x9881('0x14')](function(_0x4b203f){_0x217a1c(_0x4b203f);});};AGIVertices[_0x9881('0xe')][_0x9881('0x21')]=function(_0x2690f8,_0x4685a4,_0xffc845){this[_0x9881('0xd')]['sendMailMessage'](_0x2690f8,_0x4685a4)[_0x9881('0x12')](function(){_0xffc845(null);})[_0x9881('0x14')](function(_0x5daeb8){_0xffc845(_0x5daeb8);});};AGIVertices[_0x9881('0xe')][_0x9881('0x22')]=function(_0x23537b,_0x101e6e){this[_0x9881('0x10')]['getIntervalById'](_0x23537b)[_0x9881('0x12')](function(_0x152abc){if(_0x152abc){if(_0x152abc[_0x9881('0x23')]){_0x101e6e(null,[_0x152abc[_0x9881('0x24')]]);}else{_0x101e6e(null,_[_0x9881('0x25')](_0x152abc[_0x9881('0x26')],_0x9881('0x24')));}}else{_0x101e6e(null,![]);}})[_0x9881('0x14')](function(_0x2f6aea){_0x101e6e(_0x2f6aea);});};AGIVertices[_0x9881('0xe')][_0x9881('0x1e')]=function(_0x9bbbe8){return util[_0x9881('0x27')](_0x9881('0x28'),FILES_PATH,_0x9bbbe8);};AGIVertices[_0x9881('0xe')][_0x9881('0x29')]=function(_0x5d902d,_0x241c82,_0x5f14d5){odbc[_0x9881('0x2a')](_0x5d902d,function(_0x5c2277){if(_0x5c2277){logger[_0x9881('0x2b')](_0x9881('0x2c'),_0x5c2277);_0x5f14d5(_0x5c2277);}else{logger['info'](_0x9881('0x2d'));odbc['query'](_0x241c82,function(_0x2f298d,_0x39be9a){if(_0x2f298d){logger[_0x9881('0x2e')](_0x9881('0x2f'),_0x241c82);_0x5f14d5(_0x2f298d);}else{logger['info'](_0x9881('0x30'),_0x241c82);odbc[_0x9881('0x31')](function(_0xf2e781){if(_0xf2e781){logger[_0x9881('0x2b')](_0x9881('0x32'),_0xf2e781);}_0x5f14d5(null,_0x39be9a);});}});}});};AGIVertices[_0x9881('0xe')][_0x9881('0x33')]=function(_0x4feb70,_0x3f25db){this['rpc'][_0x9881('0x34')](_0x4feb70)[_0x9881('0x12')](function(_0x1c0396){_0x3f25db(null,_0x1c0396?_0x1c0396:![]);})['catch'](function(_0x51be30){_0x3f25db(_0x51be30);});};AGIVertices[_0x9881('0xe')][_0x9881('0x35')]=function(_0x4c5b11,_0x424d71){this[_0x9881('0x10')]['createSmsMessage'](_0x4c5b11)[_0x9881('0x12')](function(_0x41e48b){_0x424d71(null,_0x41e48b);})[_0x9881('0x14')](function(_0x1f84a5){_0x424d71(_0x1f84a5);});};AGIVertices[_0x9881('0xe')][_0x9881('0x36')]=function(_0x2ac606,_0x4421bc,_0x3240b0){this[_0x9881('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x9881('0xc')][_0x9881('0x37')],'node':_0x2ac606[_0x9881('0x38')],'application':_0x2ac606[_0x9881('0x39')],'data':_0x4421bc||null,'project_name':this[_0x9881('0xc')]['arg_1'],'callerid':this[_0x9881('0xc')][_0x9881('0x3a')]})[_0x9881('0x12')](function(_0x3bd039){if(_0x3240b0){_0x3240b0(null,_0x3bd039);}})['catch'](function(_0x28f0c0){if(_0x3240b0){_0x3240b0(_0x28f0c0);}});};AGIVertices[_0x9881('0xe')][_0x9881('0x3b')]=function(_0x5528b9,_0x249c07,_0x3746f6,_0x35f875){this[_0x9881('0x10')][_0x9881('0x3b')]({'uniqueid':this[_0x9881('0xc')][_0x9881('0x37')],'callerid':this[_0x9881('0xc')][_0x9881('0x3a')],'calleridname':this[_0x9881('0xc')]['calleridname'],'context':this[_0x9881('0xc')][_0x9881('0x3c')],'extension':this[_0x9881('0xc')]['extension'],'priority':this[_0x9881('0xc')][_0x9881('0x3d')],'accountcode':this[_0x9881('0xc')]['accountcode'],'dnid':this['channel'][_0x9881('0x3e')],'projectName':this[_0x9881('0xc')][_0x9881('0x3f')],'saveName':_0x249c07,'filename':_0x5528b9[_0x9881('0x40')]||_0x249c07,'savePath':_0x3746f6})['then'](function(_0x514263){_0x35f875(null,_0x514263);})[_0x9881('0x14')](function(_0x355357){_0x35f875(_0x355357);});};AGIVertices[_0x9881('0xe')]['createSquareMessage']=function(_0x2e22e8,_0x20cea3,_0x49839f,_0xe8a758,_0x262b8b){this[_0x9881('0x10')][_0x9881('0x41')]({'uniqueid':this[_0x9881('0xc')][_0x9881('0x37')],'body':_0x2e22e8,'direction':_0x20cea3,'providerName':_0x49839f,'providerResponse':_0xe8a758})[_0x9881('0x12')](function(_0x506a5a){if(_0x262b8b){_0x262b8b(null,_0x506a5a);}})[_0x9881('0x14')](function(_0x52b05f){if(_0x262b8b){_0x262b8b(_0x52b05f);}});};AGIVertices[_0x9881('0xe')][_0x9881('0x42')]=function(_0x7fb92e,_0x16ca26){this['rpc']['createCmContact']({'firstName':_[_0x9881('0x43')](_0x7fb92e[_0x9881('0x13')])||_[_0x9881('0x44')](_0x7fb92e['name'])?_0x9881('0x45')+Math[_0x9881('0x46')]():_0x7fb92e[_0x9881('0x13')],'lastName':_[_0x9881('0x43')](_0x7fb92e[_0x9881('0x47')])||_[_0x9881('0x44')](_0x7fb92e['lastName'])?null:_0x7fb92e[_0x9881('0x47')],'phone':_0x7fb92e[_0x9881('0x48')],'ListId':_0x7fb92e[_0x9881('0x49')],'scheduledat':_0x7fb92e[_0x9881('0x4a')],'callbackUniqueid':this[_0x9881('0xc')]['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x7fb92e[_0x9881('0x4a')][_0x9881('0x4b')](),'priority':_0x7fb92e[_0x9881('0x4c')]})[_0x9881('0x12')](function(_0x407e3e){_0x16ca26(null,_0x407e3e);})[_0x9881('0x14')](function(_0x4da4bf){_0x16ca26(_0x4da4bf);});};AGIVertices['prototype'][_0x9881('0x4d')]=function(_0x4429a4,_0x5e53c8){this[_0x9881('0x10')][_0x9881('0x4e')](_0x4429a4)[_0x9881('0x12')](function(_0x3b76b9){_0x5e53c8(null,_0x3b76b9?_0x3b76b9['name']:![]);})[_0x9881('0x14')](function(_0x5b4535){_0x5e53c8(_0x5b4535);});};AGIVertices[_0x9881('0xe')][_0x9881('0x4f')]=function(_0x4c11cb,_0x506371,_0x594da8){var _0x489fc0={'role':_0x9881('0x50')};_0x489fc0[_0x4c11cb]=this[_0x9881('0xc')]['callerid'];this[_0x9881('0x10')][_0x9881('0x4f')](_0x489fc0,_0x506371,this[_0x9881('0xc')][_0x9881('0x37')])[_0x9881('0x12')](function(_0x3cea77){_0x594da8(null,_[_0x9881('0x44')](_0x3cea77)?![]:!![]);})[_0x9881('0x14')](function(_0x5a9958){logger['error'](_0x5a9958);_0x594da8(null,![]);});};AGIVertices[_0x9881('0xe')][_0x9881('0x51')]=function(_0xb9d0ac,_0x12f6eb){var _0x16c60d={'role':_0x9881('0x50')};_0x16c60d[_0xb9d0ac]=this['channel'][_0x9881('0x3a')];this[_0x9881('0x10')][_0x9881('0x51')](_0x16c60d)[_0x9881('0x12')](function(_0x5de5cd){_0x12f6eb(null,_[_0x9881('0x44')](_0x5de5cd)?![]:!![]);})['catch'](function(_0xab3040){logger[_0x9881('0x2b')](_0xab3040);_0x12f6eb(null,![]);});};AGIVertices[_0x9881('0xe')][_0x9881('0x52')]=function(_0x5bfbdd,_0x581ebf){var _0x23f6cf={'role':'agent'};_0x23f6cf[_0x5bfbdd]=this['channel'][_0x9881('0x3a')];this[_0x9881('0x10')][_0x9881('0x52')](_0x23f6cf)['then'](function(_0x20f271){_0x581ebf(null,_[_0x9881('0x44')](_0x20f271)?![]:!![]);})['catch'](function(_0x2938e3){logger[_0x9881('0x2b')](_0x2938e3);_0x581ebf(null,![]);});};AGIVertices['prototype'][_0x9881('0x53')]=function(_0x5d2649,_0x410b54){var _0x1d2be9={'role':_0x9881('0x50')};_0x1d2be9[_0x5d2649]=this[_0x9881('0xc')][_0x9881('0x3a')];var _0x2d4bc4=_0x5d2649!='internal'?util[_0x9881('0x27')](_0x9881('0x54'),_0x9881('0x55'),this[_0x9881('0xc')][_0x9881('0x3a')]):undefined;this[_0x9881('0x10')][_0x9881('0x53')](_0x1d2be9,_0x2d4bc4)[_0x9881('0x12')](function(_0x2f7706){_0x410b54(null,_[_0x9881('0x44')](_0x2f7706)?![]:!![]);})[_0x9881('0x14')](function(_0x4d49ec){logger[_0x9881('0x2b')](_0x4d49ec);_0x410b54(null,![]);});};AGIVertices[_0x9881('0xe')]['shellCommand']=function(_0x1abcc3,_0x24fcb5){sh['exec'](_[_0x9881('0x56')](_0x1abcc3),function(_0x39dba7,_0x3dfc16){var _0x18ad64=_0x3dfc16[_0x9881('0x57')](/(\r\n|\n|\r)/gm,'');_0x24fcb5(null,_0x18ad64);});};AGIVertices['prototype'][_0x9881('0x58')]=function(_0x3658a7,_0x45c1b1){scripts['googleCloudTTS'](_0x3658a7[_0x9881('0x59')],_0x3658a7[_0x9881('0x5a')]||_0x9881('0x5b'),_0x3658a7[_0x9881('0x5b')],_0x3658a7[_0x9881('0x5c')]||'en-US',_0x3658a7[_0x9881('0x5d')]||'MALE',_0x3658a7[_0x9881('0x5e')]||_0x9881('0x5f'))[_0x9881('0x12')](function(_0x5997e5){_0x45c1b1(null,_0x5997e5);})[_0x9881('0x14')](function(_0xc7495b){_0x45c1b1(_0xc7495b);});};AGIVertices['prototype'][_0x9881('0x60')]=function(_0x402b94,_0x23206d){scripts[_0x9881('0x60')](_0x402b94[_0x9881('0x5b')],_0x402b94[_0x9881('0x61')]||'en',0x1)['then'](function(_0x20e70c){_0x23206d(null,_0x20e70c);})[_0x9881('0x14')](function(_0x3a1115){_0x23206d(_0x3a1115);});};AGIVertices[_0x9881('0xe')]['restAPI']=function(_0x1489cf,_0x30bd50){var _0x5125c1={'uri':_0x1489cf[_0x9881('0x62')],'method':_0x1489cf[_0x9881('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1489cf[_0x9881('0x64')])==='number'&&parseInt(_0x1489cf['timeout'])>=0x1?parseInt(_0x1489cf['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9881('0x65'),_0x9881('0x66')],_0x5125c1[_0x9881('0x63')][_0x9881('0x67')]())){try{_0x5125c1[_0x9881('0x68')]=_0x1489cf[_0x9881('0x69')]?JSON[_0x9881('0x6a')](_0x1489cf[_0x9881('0x69')]):{};}catch(_0x4dc3d6){logger[_0x9881('0x2b')](_0x9881('0x6b'),_0x4dc3d6);}}try{_0x5125c1[_0x9881('0x6c')]=_0x1489cf['rawHeaders']?JSON[_0x9881('0x6a')](_0x1489cf[_0x9881('0xa')]):{};}catch(_0x1f61d7){logger[_0x9881('0x2b')](_0x9881('0x6d'),_0x1f61d7);}if(_0x1489cf[_0x9881('0x6e')]){try{var _0x5e245b=require(_0x1489cf['computedVariables'])[_0x9881('0x6f')](this,_0x5125c1);_0x5125c1[_0x9881('0x70')]=Mustache[_0x9881('0x71')](_0x1489cf['url'],_0x5e245b,{},['$$','$$']);if(_0x5125c1[_0x9881('0x6c')]){_0x5125c1[_0x9881('0x6c')]=JSON[_0x9881('0x6a')](Mustache['render'](JSON[_0x9881('0x72')](_0x5125c1[_0x9881('0x6c')]),_0x5e245b,{},['$$','$$']));}if(_0x5125c1[_0x9881('0x68')]){_0x5125c1[_0x9881('0x68')]=JSON[_0x9881('0x6a')](Mustache[_0x9881('0x71')](JSON['stringify'](_0x5125c1['body']),_0x5e245b,{},['$$','$$']));}}catch(_0x21bc73){logger[_0x9881('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x21bc73);}}rp(_0x5125c1)[_0x9881('0x12')](function(_0x3de821){var _0x14dd3b={'statusCode':_0x3de821[_0x9881('0x73')]||0xc8,'statusMessage':_0x3de821['statusMessage']||'OK','headers':_0x3de821[_0x9881('0x6c')]||{},'body':_0x3de821['body']||{}};_0x30bd50(null,_0x14dd3b);})[_0x9881('0x14')](function(_0x3cee87){var _0xadf33={'statusCode':_0x3cee87['statusCode']||0x1f4,'statusMessage':_0x3cee87['message']||_0x9881('0x74'),'headers':_0x3cee87[_0x9881('0x75')][_0x9881('0x6c')]||{},'body':_0x3cee87['options'][_0x9881('0x68')]||{}};_0x30bd50(null,_0xadf33);});};AGIVertices[_0x9881('0xe')][_0x9881('0x76')]=function(_0x1c8218,_0x19937d){scripts[_0x9881('0x76')](this['channel'][_0x9881('0x37')],_0x1c8218['key'],_0x1c8218['text'],_0x1c8218[_0x9881('0x77')]||'en')[_0x9881('0x12')](function(_0x48c924){_0x19937d(null,_0x48c924);})[_0x9881('0x14')](function(_0x48d2d0){_0x19937d(_0x48d2d0);});};AGIVertices[_0x9881('0xe')][_0x9881('0x78')]=function(_0x2d598b,_0x5e8c3a){scripts[_0x9881('0x78')](this['channel'][_0x9881('0x37')],_0x2d598b[_0x9881('0x79')],_0x2d598b[_0x9881('0x7a')],_0x2d598b[_0x9881('0x7b')],_0x2d598b[_0x9881('0x5b')],_0x2d598b[_0x9881('0x7c')]||'en')[_0x9881('0x12')](function(_0x304552){_0x5e8c3a(null,_0x304552);})['catch'](function(_0x4a67d5){_0x5e8c3a(_0x4a67d5);});};AGIVertices[_0x9881('0xe')][_0x9881('0x7d')]=function(_0x99c85d,_0x436e15){scripts[_0x9881('0x7d')](this[_0x9881('0xc')],_0x99c85d)['then'](function(_0x28839e){_0x436e15(null,_0x28839e);})[_0x9881('0x14')](function(_0x567eed){_0x436e15(_0x567eed);});};AGIVertices[_0x9881('0xe')][_0x9881('0x7e')]=function(_0x32f08c,_0x1a6052){scripts[_0x9881('0x7e')](_0x32f08c[_0x9881('0x7f')],_0x32f08c['text'],_0x32f08c[_0x9881('0x80')]||_0x9881('0x81'),_0x32f08c[_0x9881('0x82')])['then'](function(_0x53d900){_0x1a6052(null,_0x53d900);})[_0x9881('0x14')](function(_0x2dfbc5){_0x1a6052(_0x2dfbc5);});};AGIVertices['prototype']['ispeechASR']=function(_0x169026,_0x22d856,_0xdb99b2){scripts[_0x9881('0x83')](_0x22d856,_0x169026[_0x9881('0x7f')],_0x169026['ispeech_asr_language']||_0x9881('0x81'),this[_0x9881('0x84')](_0x169026[_0x9881('0x85')])?_0x169026[_0x9881('0x85')]:undefined)[_0x9881('0x12')](function(_0x3c4293){_0xdb99b2(null,_0x3c4293);})[_0x9881('0x14')](function(_0x13b181){_0xdb99b2(_0x13b181);});};AGIVertices[_0x9881('0xe')]['awsPolly']=function(_0xaff6a9,_0x393628){scripts[_0x9881('0x86')](_0xaff6a9[_0x9881('0x87')],_0xaff6a9[_0x9881('0x88')],_0xaff6a9['aws_polly_region'],_0xaff6a9[_0x9881('0x89')]||_0x9881('0x8a'),_0xaff6a9['text'],_0xaff6a9[_0x9881('0x8b')]||_0x9881('0x5b'))['then'](function(_0xcc5481){_0x393628(null,_0xcc5481);})[_0x9881('0x14')](function(_0x516d8f){_0x393628(_0x516d8f);});};AGIVertices[_0x9881('0xe')][_0x9881('0x8c')]=function(_0x57736b,_0x2a35be){scripts[_0x9881('0x8c')](this[_0x9881('0xc')]['uniqueid'],_0x57736b['aws_access_key_id'],_0x57736b[_0x9881('0x88')],_0x57736b[_0x9881('0x8d')],_0x57736b[_0x9881('0x5b')],_0x57736b[_0x9881('0x8e')])[_0x9881('0x12')](function(_0x3ce499){_0x2a35be(null,_0x3ce499);})[_0x9881('0x14')](function(_0x2b445a){_0x2a35be(_0x2b445a);});};AGIVertices[_0x9881('0xe')]['googleASR']=function(_0xba04cc,_0x443aca,_0x425656){scripts[_0x9881('0x8f')](_0x443aca,_0xba04cc[_0x9881('0x7f')],_0xba04cc[_0x9881('0x90')]||_0x9881('0x81'))[_0x9881('0x12')](function(_0x504cf7){_0x425656(null,_0x504cf7);})[_0x9881('0x14')](function(_0x499286){_0x425656(_0x499286);});};AGIVertices[_0x9881('0xe')]['tildeASR']=function(_0x2b104d,_0x5892a3,_0x3d581a){scripts['tildeASR'](_0x5892a3,_0x2b104d[_0x9881('0x91')],_0x2b104d[_0x9881('0x92')],_0x2b104d['uri'])[_0x9881('0x12')](function(_0x19c2d2){_0x3d581a(null,_0x19c2d2);})[_0x9881('0x14')](function(_0x51e805){_0x3d581a(_0x51e805);});};AGIVertices['prototype']['clear']=function(_0x357c5f){var _0x463bb5=_[_0x9881('0x93')](verticesWithRetry,_0x357c5f['agicommand'])?_0x357c5f:_['clone'](_0x357c5f);for(var _0x3689de in _0x463bb5){if(_0x463bb5[_0x9881('0x94')](_0x3689de)){if(_0x463bb5[_0x3689de]&&_[_0x9881('0x95')](_0x463bb5[_0x3689de])){if(_[_0x9881('0x93')](recursiveMapAttributes,_0x3689de)){_0x463bb5[_0x3689de]=this[_0x9881('0x96')](_0x463bb5[_0x3689de]);}else{_0x463bb5[_0x3689de]=this['replaceAllVariables'](_0x463bb5[_0x3689de]);}}}}return _0x463bb5;};AGIVertices[_0x9881('0xe')][_0x9881('0x97')]=function(_0x186d4c){for(var _0x27cc14 in _0x186d4c){if(_0x186d4c[_0x9881('0x94')](_0x27cc14)){if(_[_0x9881('0x98')](_0x186d4c[_0x27cc14])){this[_0x9881('0x97')](_0x186d4c[_0x27cc14]);}else if(_[_0x9881('0x99')](_0x186d4c[_0x27cc14])){for(var _0x20c5e6=0x0;_0x20c5e6<_0x186d4c[_0x27cc14][_0x9881('0x9a')];_0x20c5e6++){this['recursiveNodeIndex'](_0x186d4c[_0x27cc14][_0x20c5e6]);}}else if(_['isString'](_0x186d4c[_0x27cc14])){_0x186d4c[_0x27cc14]=this[_0x9881('0x9b')](_0x186d4c[_0x27cc14]);}}}};AGIVertices[_0x9881('0xe')][_0x9881('0x9c')]=function(_0x1e6727,_0x6c3d7d){for(var _0x18c553 in _0x1e6727){if(_0x1e6727[_0x9881('0x94')](_0x18c553)){if(_[_0x9881('0x98')](_0x1e6727[_0x18c553])){if(!_[_0x9881('0x43')](_0x1e6727[_0x18c553])){this['saveRestApiResult'](_0x1e6727[_0x18c553],util[_0x9881('0x27')](_0x9881('0x9d'),_0x6c3d7d,_0x18c553));}}else if(_[_0x9881('0x99')](_0x1e6727[_0x18c553])){for(var _0x2d4933=0x0;_0x2d4933<_0x1e6727[_0x18c553][_0x9881('0x9a')];_0x2d4933++){this[_0x9881('0x9c')](_0x1e6727[_0x18c553][_0x2d4933],util[_0x9881('0x27')]('%s.%s',_0x6c3d7d,_0x18c553+'['+_0x2d4933+']'));}}else{if(!_[_0x9881('0x44')](_0x1e6727[_0x18c553])){this['channel'][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x9d'),_0x6c3d7d,_0x18c553),_0x1e6727[_0x18c553]);}}}}};AGIVertices[_0x9881('0xe')]['replaceObjectAllVariables']=function(_0x59db35){try{var _0x37064d=JSON[_0x9881('0x6a')](_0x59db35);this[_0x9881('0x97')](_0x37064d);return JSON[_0x9881('0x72')](_0x37064d);}catch(_0x29671a){return this[_0x9881('0x9b')](_0x59db35);}};AGIVertices['prototype'][_0x9881('0x9b')]=function(_0xf06bf0){var _0x2ade74=_0xf06bf0['split']('{');for(var _0x3b2943=0x1;_0x3b2943<_0x2ade74['length'];_0x3b2943+=0x1){var _0x595560=_0x2ade74[_0x3b2943]['split']('}');if(_0x595560[_0x9881('0x9a')]>0x1){_0xf06bf0=_0xf06bf0[_0x9881('0x9f')]('{'+_0x595560[0x0]+'}',this[_0x9881('0xc')][_0x9881('0xf')](_0x595560[0x0])['extra']||_0x595560[0x0]);}}if(_0x2ade74[_0x9881('0x9a')]===0x1){return _0xf06bf0['toString']();}return this['replaceAllVariables'](_0xf06bf0);};AGIVertices[_0x9881('0xe')][_0x9881('0xa0')]=function(_0xb107a9,_0x26a6ca){var _0x3c9a2f=this[_0x9881('0xc')][_0x9881('0xf')](_0xb107a9);if(_0x3c9a2f['result']===-0x1){return _0x3c9a2f;}logger[_0x9881('0x2e')](util[_0x9881('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x26a6ca,_0x3c9a2f[_0x9881('0xa1')]));return this[_0x9881('0xc')][_0x9881('0x9e')](_0x26a6ca,_0x3c9a2f[_0x9881('0xa1')]);};AGIVertices[_0x9881('0xe')]['isConfigured']=function(_0x473457){return _0x473457&&_0x473457!=='0'&&_0x473457!=='-1'&&_0x473457!=='';};AGIVertices[_0x9881('0xe')][_0x9881('0xa2')]=function(_0x58c49e){this['createSquareDetailsReport'][_0x9881('0x6f')](this,_0x58c49e,'-');_0x58c49e[_0x9881('0xa3')]=_0x58c49e[_0x9881('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9881('0xa4')]=function(_0x3d38f3){logger['info'](util['format'](_0x9881('0xa5'),_0x3d38f3[_0x9881('0x38')]));if(!this['isConfigured'](_0x3d38f3[_0x9881('0x5b')])){return this['channel'][_0x9881('0xa6')](_0x9881('0xa7'));}var _0x3be7cb='\x22'+_0x3d38f3['text']+'\x22';if(this[_0x9881('0x84')](_0x3d38f3[_0x9881('0x75')])){_0x3be7cb+=','+_0x3d38f3[_0x9881('0x75')];}var _0x4ed659=this['channel'][_0x9881('0xa8')](_0x9881('0xa9'),_0x3be7cb);if(_0x4ed659[_0x9881('0xaa')]===-0x1){return _0x4ed659;}return this['channel']['noop'](util[_0x9881('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3be7cb));};AGIVertices[_0x9881('0xe')][_0x9881('0xab')]=function(_0x335847){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xac'),_0x335847[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x335847['grammar'])){return this['channel']['noop'](_0x9881('0xad'));}var _0x22afca=_0x335847[_0x9881('0xae')];if(this[_0x9881('0x84')](_0x335847[_0x9881('0x75')])){_0x22afca+=','+_0x335847[_0x9881('0x75')];}var _0x1285a6=this[_0x9881('0xc')][_0x9881('0xa8')](_0x9881('0xaf'),_0x22afca);if(_0x1285a6[_0x9881('0xaa')]===-0x1){return _0x1285a6;}var _0x48052d=this[_0x9881('0xa0')](_0x9881('0xb0'),_0x9881('0xb1'));if(_0x48052d['result']===-0x1){return _0x48052d;}var _0x57eb75=this[_0x9881('0xa0')](_0x9881('0xb2'),_0x9881('0xb3'));if(_0x57eb75[_0x9881('0xaa')]===-0x1){return _0x57eb75;}var _0x138e58=this[_0x9881('0xa0')](_0x9881('0xb4'),_0x9881('0xb5'));if(_0x138e58[_0x9881('0xaa')]===-0x1){return _0x138e58;}return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xb6'),_0x22afca));};AGIVertices[_0x9881('0xe')][_0x9881('0x6')]=function(_0x1f96f0){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xb7'),_0x1f96f0[_0x9881('0x38')]));return this[_0x9881('0xc')][_0x9881('0x6')]([_0x1f96f0[_0x9881('0xb8')],_0x1f96f0['args']]);};AGIVertices[_0x9881('0xe')][_0x9881('0xb9')]=function(_0x1bb0e1){logger[_0x9881('0x2e')](util['format'](_0x9881('0xba'),_0x1bb0e1[_0x9881('0x38')]));if(this[_0x9881('0x84')](_0x1bb0e1[_0x9881('0x64')])){logger[_0x9881('0x2e')](util['format'](_0x9881('0xbb'),_0x1bb0e1[_0x9881('0x64')]));var _0xb80d6d=this[_0x9881('0xc')][_0x9881('0xbc')](_0x1bb0e1[_0x9881('0x64')]);if(_0xb80d6d[_0x9881('0xaa')]===-0x1){return _0xb80d6d;}}return this['channel']['answer']();};AGIVertices['prototype'][_0x9881('0xbd')]=function(_0x4b7c4b){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xbe'),_0x4b7c4b[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x4b7c4b[_0x9881('0x49')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x4b7c4b,_0x9881('0xbf'));}_0x4b7c4b['scheduledAt']=moment();if(this[_0x9881('0x84')](_0x4b7c4b[_0x9881('0xc0')])){_0x4b7c4b['scheduledAt']=moment()[_0x9881('0xc1')](_0x4b7c4b[_0x9881('0xc0')],'minutes');}if(!this[_0x9881('0x84')](_0x4b7c4b[_0x9881('0x4c')])){_0x4b7c4b[_0x9881('0x4c')]=0x2;}this['createCmContact'][_0x9881('0x6f')](this,_0x4b7c4b);return this['channel']['noop'](util[_0x9881('0x27')](_0x9881('0xc2'),_0x4b7c4b['phone'],_0x4b7c4b[_0x9881('0x49')],_0x4b7c4b[_0x9881('0x4a')]));};AGIVertices['prototype'][_0x9881('0xc3')]=function(_0x71e0a1){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x71e0a1[_0x9881('0x38')]));var _0x3acaef=this[_0x9881('0xc')]['exec'](_0x71e0a1[_0x9881('0xc4')],_0x71e0a1['options']);if(_0x3acaef[_0x9881('0xaa')]===-0x1){return _0x3acaef;}return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Executed\x20command\x20%s\x20%s',_0x71e0a1[_0x9881('0xc4')],_0x71e0a1[_0x9881('0x75')]));};AGIVertices[_0x9881('0xe')][_0x9881('0xc5')]=function(_0x139ace){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xc6'),_0x139ace[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x139ace[_0x9881('0x5b')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}var _0x3d4ef7='\x22'+_0x139ace['text']+'\x22';if(this[_0x9881('0x84')](_0x139ace[_0x9881('0x75')])){_0x3d4ef7+=','+_0x139ace['options'];}var _0x431834=this['channel'][_0x9881('0xa8')](_0x9881('0xa9'),_0x3d4ef7);if(_0x431834['result']===-0x1){return _0x431834;}return this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0xc7'),_0x3d4ef7));};AGIVertices[_0x9881('0xe')][_0x9881('0xc8')]=function(_0x536708){logger['info'](util[_0x9881('0x27')](_0x9881('0xc9'),_0x536708[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x536708[_0x9881('0x5b')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}var _0xbe6640='\x22'+_0x536708[_0x9881('0x5b')]+'\x22';if(this['isConfigured'](_0x536708['options'])){_0xbe6640+=','+_0x536708[_0x9881('0x75')];}var _0x33af2a=this[_0x9881('0xc')][_0x9881('0xa8')]('MRCPSynth',_0xbe6640);if(_0x33af2a[_0x9881('0xaa')]===-0x1){return _0x33af2a;}return this[_0x9881('0xc')][_0x9881('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0xbe6640));};AGIVertices[_0x9881('0xe')][_0x9881('0xca')]=function(_0x5e1a45){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xcb'),_0x5e1a45['label']));if(!this[_0x9881('0x84')](_0x5e1a45[_0x9881('0xae')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xad'));}var _0x414c24=_0x5e1a45[_0x9881('0xae')];if(this[_0x9881('0x84')](_0x5e1a45[_0x9881('0x75')])){_0x414c24+=','+_0x5e1a45[_0x9881('0x75')];}var _0x3e874b=this[_0x9881('0xc')][_0x9881('0xa8')](_0x9881('0xaf'),_0x414c24);if(_0x3e874b['result']===-0x1){return _0x3e874b;}var _0xb75f75=this[_0x9881('0xa0')](_0x9881('0xb0'),_0x9881('0xcc'));if(_0xb75f75[_0x9881('0xaa')]===-0x1){return _0xb75f75;}var _0x142180=this[_0x9881('0xa0')](_0x9881('0xb2'),_0x9881('0xcd'));if(_0x142180[_0x9881('0xaa')]===-0x1){return _0x142180;}var _0x92a0ba=this['getAndSetVariable'](_0x9881('0xb4'),_0x9881('0xce'));if(_0x92a0ba[_0x9881('0xaa')]===-0x1){return _0x92a0ba;}return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xb6'),_0x414c24));};AGIVertices[_0x9881('0xe')]['sestekasr']=function(_0x1c678b){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xcf'),_0x1c678b[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x1c678b[_0x9881('0xae')])){return this['channel']['noop'](_0x9881('0xad'));}var _0x51b709=_0x1c678b[_0x9881('0xae')];if(this['isConfigured'](_0x1c678b[_0x9881('0x75')])){_0x51b709+=','+_0x1c678b[_0x9881('0x75')];}var _0x27d812=this[_0x9881('0xc')][_0x9881('0xa8')]('MRCPRecog',_0x51b709);if(_0x27d812[_0x9881('0xaa')]===-0x1){return _0x27d812;}var _0x4b217a=this[_0x9881('0xa0')]('RECOG_CONFIDENCE()',_0x9881('0xd0'));if(_0x4b217a['result']===-0x1){return _0x4b217a;}var _0x1933b8=this[_0x9881('0xa0')](_0x9881('0xb2'),_0x9881('0xd1'));if(_0x1933b8[_0x9881('0xaa')]===-0x1){return _0x1933b8;}var _0x2b0874=this[_0x9881('0xa0')]('RECOG_INSTANCE()',_0x9881('0xd2'));if(_0x2b0874['result']===-0x1){return _0x2b0874;}return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xb6'),_0x51b709));};AGIVertices[_0x9881('0xe')][_0x9881('0xd3')]=function(_0x852b21){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0xd4'),_0x852b21[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x852b21[_0x9881('0xd5')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x852b21,_0x9881('0xd6'));}var _0x59288b=this[_0x9881('0x17')]['sync'](this,_0x852b21[_0x9881('0xd5')]);if(!_0x59288b){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x852b21,_0x9881('0xd7'));}if(!this['isConfigured'](_0x852b21[_0x9881('0xd8')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x852b21,_0x9881('0xd9'));}var _0xfee37e=_0x852b21['query'][_0x9881('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xda'),_0xfee37e));var _0x535550=this['getQueryOdbc'][_0x9881('0x6f')](this,_0x59288b,_0xfee37e);this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x852b21,_0xfee37e);if(!this[_0x9881('0x84')](_0x852b21[_0x9881('0xdb')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xdc'));}var _0x51bace=this[_0x9881('0xf')][_0x9881('0x6f')](this,_0x852b21['variable_id']);if(!_0x51bace){return this['channel'][_0x9881('0x2b')](_0x852b21,_0x9881('0xdd'));}var _0x4bef20=this;_0x535550[_0x9881('0xde')](function(_0x34c943,_0x179ada){Object[_0x9881('0xdf')](_0x34c943)[_0x9881('0xde')](function(_0x2fc562){_0x4bef20[_0x9881('0xc')]['setVariable'](util['format'](_0x9881('0xe0'),_0x51bace,_0x179ada,_0x2fc562),_0x34c943[_0x2fc562]);});});this[_0x9881('0xc')][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0xe1'),_0x51bace),_0x535550[_0x9881('0x9a')]);return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xe2'),_0x51bace));};AGIVertices['prototype']['dial']=function(_0x3a3aed){logger[_0x9881('0xe3')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3a3aed['label']));if(!this[_0x9881('0x84')](_0x3a3aed[_0x9881('0xe4')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x3a3aed,_0x9881('0xe5'));}var _0x43b646=this[_0x9881('0x1a')][_0x9881('0x6f')](this,_0x3a3aed[_0x9881('0xe4')]);if(!_0x43b646){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x3a3aed,_0x9881('0xe6'));}var _0x236050=this['channel'][_0x9881('0xa8')](_0x9881('0xe7'),[util[_0x9881('0x27')](_0x9881('0xe8'),_0x43b646),_0x3a3aed[_0x9881('0x64')],_0x3a3aed[_0x9881('0xe9')],_0x3a3aed[_0x9881('0x62')]]);if(_0x236050[_0x9881('0xaa')]===-0x1){return _0x236050;}return this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0xea'),_0x9881('0xe7')));};AGIVertices['prototype'][_0x9881('0xeb')]=function(_0x490316){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x490316[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x490316[_0x9881('0x7f')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20key\x20configured');}if(!this[_0x9881('0x84')](_0x490316['text'])){return this[_0x9881('0xc')]['noop'](_0x9881('0xa7'));}this['channel'][_0x9881('0xec')]=!![];this[_0x9881('0x36')](_0x490316);this[_0x9881('0x41')](_0x490316[_0x9881('0x5b')],'in','','');this['channel']['noop'](util['format'](_0x9881('0xed'),_0x490316['text']));var _0x5906aa=this[_0x9881('0x76')]['sync'](this,_0x490316);if(_0x5906aa){for(var _0x278aa2 in _0x5906aa){if(_0x5906aa[_0x9881('0x94')](_0x278aa2)){this['channel'][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0xee'),_0x278aa2['toUpperCase']()),_0x5906aa[_0x278aa2]);}}this[_0x9881('0x41')](_0x5906aa[_0x9881('0xef')],_0x9881('0xf0'),_0x9881('0xeb'),'');return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xf1'),_0x5906aa[_0x9881('0xef')]));}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x490316,_0x9881('0xf2'));};AGIVertices[_0x9881('0xe')]['dialogflowV2']=function(_0x53b2ec){logger['info'](util[_0x9881('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x53b2ec[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x53b2ec['dialogflowV2_project_id'])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xf3'));}if(!this[_0x9881('0x84')](_0x53b2ec['client_email'])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xf4'));}if(!this[_0x9881('0x84')](_0x53b2ec[_0x9881('0x7b')])){return this['channel'][_0x9881('0xa6')](_0x9881('0xf5'));}if(!this['isConfigured'](_0x53b2ec[_0x9881('0x7c')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xf6'));}if(!this[_0x9881('0x84')](_0x53b2ec['text'])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}this[_0x9881('0xc')][_0x9881('0xec')]=!![];this[_0x9881('0x36')](_0x53b2ec);this[_0x9881('0x41')](_0x53b2ec[_0x9881('0x5b')],'in','','');this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Trying\x20DialogflowV2:\x20%s',_0x53b2ec[_0x9881('0x5b')]));var _0x554c48=this[_0x9881('0x78')][_0x9881('0x6f')](this,_0x53b2ec);if(_0x554c48){for(var _0x2ff3be in _0x554c48){if(_0x554c48['hasOwnProperty'](_0x2ff3be)){if(_0x2ff3be!==_0x9881('0xf7')){this['channel']['setVariable'](util[_0x9881('0x27')](_0x9881('0xee'),_0x2ff3be['toUpperCase']()),_0x554c48[_0x2ff3be]);}}}this[_0x9881('0x41')](_0x554c48['speech'],_0x9881('0xf0'),_0x9881('0xf8'),_0x554c48[_0x9881('0xf7')]);return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xf9'),_0x554c48[_0x9881('0xef')]));}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x53b2ec,_0x9881('0xfa'));};AGIVertices[_0x9881('0xe')][_0x9881('0xfb')]=function(_0x52caf9){logger[_0x9881('0x2e')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x52caf9[_0x9881('0x38')]));if(!this['isConfigured'](_0x52caf9[_0x9881('0xfc')])){return this['channel']['noop'](_0x9881('0xfd'));}if(!this[_0x9881('0x84')](_0x52caf9[_0x9881('0xfe')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20username\x20configured');}if(!this[_0x9881('0x84')](_0x52caf9[_0x9881('0xff')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20password\x20configured');}if(!this[_0x9881('0x84')](_0x52caf9[_0x9881('0x100')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}this[_0x9881('0xc')]['bot']=!![];this[_0x9881('0x36')](_0x52caf9);this[_0x9881('0x41')](_0x52caf9[_0x9881('0x5b')],'in','','');this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x101'),_0x52caf9[_0x9881('0x5b')]));var _0x433bf6=this['sestekNDA'][_0x9881('0x6f')](this,_0x52caf9);if(_0x433bf6){for(var _0x1ce8d3 in _0x433bf6){if(_0x433bf6[_0x9881('0x94')](_0x1ce8d3)){this[_0x9881('0xc')][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x102'),_0x1ce8d3['toUpperCase']()),_0x433bf6[_0x1ce8d3]);}}this[_0x9881('0x41')](_0x433bf6[_0x9881('0xef')],'out',_0x9881('0xfb'),'');if(_0x433bf6[_0x9881('0x103')]){this[_0x9881('0xc')][_0x9881('0xa6')](util['format'](_0x9881('0x104'),_0x433bf6['audiofile']));var _0x221f51=this[_0x9881('0xc')]['streamFile'](_0x433bf6[_0x9881('0x103')]);try{fs['unlink'](_0x433bf6[_0x9881('0x103')]+_0x9881('0x105'));}catch(_0x46f3a9){logger[_0x9881('0x2b')](_0x46f3a9);}return _0x221f51;}else{return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('SestekNDA\x20Result\x20%s',_0x433bf6[_0x9881('0xef')]));}}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x52caf9,_0x9881('0x106'));};AGIVertices[_0x9881('0xe')]['end']=function(_0xc22caf){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0xc22caf[_0x9881('0x38')]));return this[_0x9881('0xc')]['noop']('end');};AGIVertices[_0x9881('0xe')]['ext_dial']=function(_0x1a12c0){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1a12c0[_0x9881('0x38')]));var _0x362cbb='';if(_0x1a12c0['trunk_id']){if(!this[_0x9881('0x84')](_0x1a12c0[_0x9881('0x107')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x1a12c0,_0x9881('0x108'));}else{var _0xfec949=parseInt(_0x1a12c0[_0x9881('0x107')],0xa);if(isNaN(_0xfec949)){_0x362cbb=_0x1a12c0[_0x9881('0x107')];}else{_0x362cbb=this[_0x9881('0x109')][_0x9881('0x6f')](this,_0x1a12c0[_0x9881('0x107')]);if(!_0x362cbb){return this[_0x9881('0xc')]['error'](_0x1a12c0,_0x9881('0x10a'));}}}}else if(_0x1a12c0[_0x9881('0x10b')]){_0x362cbb=_0x1a12c0[_0x9881('0x10b')];}else{return this['channel'][_0x9881('0x2b')](_0x1a12c0,_0x9881('0x108'));}var _0x57144d=this[_0x9881('0xc')][_0x9881('0xa8')](_0x9881('0xe7'),[util[_0x9881('0x27')](_0x9881('0x10c'),_0x362cbb,_0x1a12c0['phone']),_0x1a12c0['timeout'],_0x1a12c0[_0x9881('0xe9')],_0x1a12c0[_0x9881('0x62')]]);if(_0x57144d[_0x9881('0xaa')]===-0x1){return _0x57144d;}return this['channel'][_0x9881('0xa6')](util['format'](_0x9881('0xea'),_0x9881('0xe7')));};AGIVertices[_0x9881('0xe')][_0x9881('0x10d')]=function(_0x120793){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x10e'),_0x120793[_0x9881('0x38')]));return this['channel'][_0x9881('0xa6')](_0x9881('0x10d'));};AGIVertices[_0x9881('0xe')]['getdigits']=function(_0x23c664){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x23c664[_0x9881('0x38')]));if(_0x23c664[_0x9881('0xa3')]===0x0){return this['maxRetry'](_0x23c664);}_0x23c664[_0x9881('0xa3')]-=0x1;if(!this[_0x9881('0x84')](_0x23c664['file_id'])){return this['channel']['error'](_0x23c664,_0x9881('0x10f'));}var _0x1c43c6=this[_0x9881('0x1c')][_0x9881('0x6f')](this,_0x23c664[_0x9881('0x110')]);if(!_0x1c43c6){return this[_0x9881('0xc')]['error'](_0x23c664,'no\x20file\x20audio\x20found');}if(!this[_0x9881('0x84')](_0x23c664[_0x9881('0xdb')])){return this['channel'][_0x9881('0x2b')](_0x9881('0xdc'));}var _0x58aad2=this['channel'][_0x9881('0x111')](_0x1c43c6,_0x23c664['response'],_0x23c664[_0x9881('0x112')]);var _0x152ae1=_0x58aad2['result']?_0x58aad2[_0x9881('0xaa')][_0x9881('0x4b')]():'';logger[_0x9881('0x2e')](_0x9881('0x113'),JSON['stringify'](_0x58aad2));if(_0x58aad2['result']===-0x1){this[_0x9881('0x36')]['sync'](this,_0x23c664,_0x152ae1);return _0x58aad2;}else if(_0x58aad2[_0x9881('0xa1')]===_0x9881('0x64')){_0x58aad2['result']=_0x152ae1['length']>=parseInt(_0x23c664[_0x9881('0x114')])?'x':'i';}else{_0x58aad2[_0x9881('0xaa')]=_0x152ae1[_0x9881('0x9a')]>=parseInt(_0x23c664[_0x9881('0x114')])&&_0x152ae1[_0x9881('0x9a')]<=parseInt(_0x23c664['maxdigit'])?'x':'i';}var _0x185e69=this[_0x9881('0xf')]['sync'](this,_0x23c664[_0x9881('0xdb')]);if(!_0x185e69){return this[_0x9881('0xc')]['error'](_0x23c664,_0x9881('0xdd'));}this[_0x9881('0xc')][_0x9881('0x9e')](_0x185e69,_0x152ae1);if(this['isConfigured'](_0x23c664[_0x9881('0x115')])){var _0x410fe2=parseInt(_0x23c664[_0x9881('0x115')],0xa);var _0x168e09=rs[_0x9881('0x116')]({'charset':'*','length':_0x410fe2});var _0x51ed83=_0x152ae1[_0x9881('0x9a')];if(_0x51ed83>0x0){if(_0x51ed83>_0x410fe2){this['createSquareDetailsReport'][_0x9881('0x6f')](this,_0x23c664,_0x23c664[_0x9881('0x117')]===_0x9881('0x118')?_0x168e09+_0x152ae1[_0x9881('0x119')](_0x410fe2):_0x152ae1['substr'](0x0,_0x51ed83-_0x410fe2)+_0x168e09);}else{this['createSquareDetailsReport']['sync'](this,_0x23c664,rs[_0x9881('0x116')]({'charset':'*','length':_0x51ed83}));}}else{this['createSquareDetailsReport']['sync'](this,_0x23c664,'');}}else{this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x23c664,_0x152ae1);}return _0x58aad2;};AGIVertices[_0x9881('0xe')][_0x9881('0x11a')]=function(_0x15aad9){logger['info'](util[_0x9881('0x27')](_0x9881('0x11b'),_0x15aad9[_0x9881('0x38')]));return this['getdigits'](_0x15aad9);};AGIVertices[_0x9881('0xe')][_0x9881('0x11c')]=function(_0x31a7f9){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x11d'),_0x31a7f9[_0x9881('0x38')]));this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x31a7f9,_0x31a7f9['goalname']);return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x11e'),_0x31a7f9[_0x9881('0x11f')]));};AGIVertices[_0x9881('0xe')][_0x9881('0x120')]=function(_0x1d5cc5){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x121'),_0x1d5cc5[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x1d5cc5['aws_access_key_id'])||!this[_0x9881('0x84')](_0x1d5cc5[_0x9881('0x88')])){return this[_0x9881('0xc')]['noop'](_0x9881('0x122'));}if(!this[_0x9881('0x84')](_0x1d5cc5[_0x9881('0x5b')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x123'),_0x1d5cc5[_0x9881('0x5b')]));var _0x420c34=this[_0x9881('0x86')][_0x9881('0x6f')](this,_0x1d5cc5);if(_0x420c34){this[_0x9881('0xc')][_0x9881('0xa6')](util['format'](_0x9881('0x124'),_0x420c34));var _0x4f140f=this['channel'][_0x9881('0x125')](_0x420c34);try{fs[_0x9881('0x126')](_0x420c34+_0x9881('0x105'));}catch(_0x323f2a){logger['error'](_0x323f2a);}return _0x4f140f;}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x1d5cc5,_0x9881('0x127'));};AGIVertices[_0x9881('0xe')]['awslex']=function(_0x48b91e){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x48b91e[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x48b91e[_0x9881('0x87')])||!this[_0x9881('0x84')](_0x48b91e[_0x9881('0x88')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x9881('0x84')](_0x48b91e['aws_bot_name'])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0x128'));}if(!this[_0x9881('0x84')](_0x48b91e[_0x9881('0x5b')])){return this['channel'][_0x9881('0xa6')]('no\x20text\x20configured');}this[_0x9881('0xc')][_0x9881('0xec')]=!![];this['createSquareDetailsReport'](_0x48b91e);this[_0x9881('0x41')](_0x48b91e[_0x9881('0x5b')],'in','','');this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x129'),_0x48b91e[_0x9881('0x5b')]));var _0x43530a=this[_0x9881('0x8c')][_0x9881('0x6f')](this,_0x48b91e);if(_0x43530a){for(var _0x6c349 in _0x43530a){if(_0x43530a[_0x9881('0x94')](_0x6c349)&&_[_0x9881('0x95')](_0x43530a[_0x6c349])){this['channel'][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x12a'),_0x6c349[_0x9881('0x67')]()),_0x43530a[_0x6c349]);}}if(_[_0x9881('0x44')](_0x43530a[_0x9881('0x12b')])){return this[_0x9881('0xc')]['noop'](_0x9881('0x12c'));}else{this[_0x9881('0x41')](_0x43530a['message'],'out',_0x9881('0x12d'),'');return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x12e'),_0x43530a[_0x9881('0x12b')]));}}return this['channel'][_0x9881('0x2b')](_0x48b91e,_0x9881('0x12f'));};AGIVertices[_0x9881('0xe')][_0x9881('0x130')]=function(_0x388ae8){logger['info'](util[_0x9881('0x27')](_0x9881('0x131'),_0x388ae8[_0x9881('0x38')],_0x388ae8[_0x9881('0x64')]));if(!this[_0x9881('0x84')](_0x388ae8['key'])){return this[_0x9881('0xc')]['noop'](_0x9881('0x132'));}var _0x1cdc30=_0x9881('0x133');var _0x4bf477=util[_0x9881('0x27')](_0x9881('0x134'),FILES_PATH,rs[_0x9881('0x116')](0x4));var _0x6dda0d=util[_0x9881('0x27')]('%s.%s',_0x4bf477,_0x1cdc30);var _0x2a6220=!![];if(_0x388ae8[_0x9881('0x135')]===_0x9881('0x136')){_0x2a6220=![];}var _0x467e7c=this[_0x9881('0xc')][_0x9881('0x137')](_0x4bf477,_0x1cdc30,_0x388ae8[_0x9881('0x138')],_0x388ae8[_0x9881('0x64')],undefined,_0x2a6220);if(_0x467e7c[_0x9881('0xaa')]!==-0x1){this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')]('google\x20%s\x20file\x20created',_0x6dda0d));var _0x1892ed=this[_0x9881('0x8f')][_0x9881('0x6f')](this,_0x388ae8,_0x6dda0d);if(_0x1892ed){for(var _0x3c9a96 in _0x1892ed){if(_0x1892ed['hasOwnProperty'](_0x3c9a96)){this[_0x9881('0xc')][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x139'),_0x3c9a96[_0x9881('0x67')]()),_0x1892ed[_0x3c9a96]);}}return this['channel']['noop'](util['format'](_0x9881('0x13a'),JSON[_0x9881('0x72')](_0x1892ed)));}}return _0x467e7c;};AGIVertices[_0x9881('0xe')][_0x9881('0x13b')]=function(_0x2caa37){logger['info'](util[_0x9881('0x27')](_0x9881('0x13c'),_0x2caa37[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x2caa37['appid'])){return this[_0x9881('0xc')]['noop']('no\x20appid\x20configured');}if(!this[_0x9881('0x84')](_0x2caa37[_0x9881('0x92')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20appsecret\x20configured');}var _0x55aaec='wav';var _0xa41ddc=util[_0x9881('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x310ed8=util[_0x9881('0x27')](_0x9881('0x9d'),_0xa41ddc,_0x55aaec);var _0xd60d1b=!![];if(_0x2caa37[_0x9881('0x135')]==='NOBEEP'){_0xd60d1b=![];}var _0x57d3cb=this[_0x9881('0xc')]['recordFile'](_0xa41ddc,_0x55aaec,_0x2caa37[_0x9881('0x138')],_0x2caa37['timeout'],undefined,_0xd60d1b);if(_0x57d3cb['result']!==-0x1){this[_0x9881('0xc')][_0x9881('0xa6')](util['format'](_0x9881('0x13d'),_0x310ed8));var _0x3783c1=this[_0x9881('0x13e')][_0x9881('0x6f')](this,_0x2caa37,_0x310ed8);if(_0x3783c1){for(var _0x59f668 in _0x3783c1){if(_0x3783c1[_0x9881('0x94')](_0x59f668)){this[_0x9881('0xc')][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x13f'),_0x59f668[_0x9881('0x67')]()),_0x3783c1[_0x59f668]);}}return this[_0x9881('0xc')]['noop'](util['format'](_0x9881('0x140'),JSON[_0x9881('0x72')](_0x3783c1)));}}return _0x57d3cb;};AGIVertices[_0x9881('0xe')][_0x9881('0x141')]=function(_0x2f2e83){logger[_0x9881('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2f2e83[_0x9881('0x38')]));return this['channel']['continueAt'](_0x2f2e83[_0x9881('0x3c')],_0x2f2e83[_0x9881('0x142')],_0x2f2e83['priority']);};AGIVertices[_0x9881('0xe')][_0x9881('0x143')]=function(_0x406704){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x144'),_0x406704[_0x9881('0x38')]));if(!this['isConfigured'](_0x406704[_0x9881('0x145')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x406704,_0x9881('0x146'));}try{var _0x58ab62=eval(_0x406704[_0x9881('0x145')])?'true':_0x9881('0x147');this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x406704['condition'],_0x58ab62));return{'code':0xc8,'result':_0x58ab62};}catch(_0x503a73){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x9881('0x148')]=function(_0x198e3b){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x149'),_0x198e3b['label']));if(!this[_0x9881('0x84')](_0x198e3b[_0x9881('0x14a')])){return this['channel'][_0x9881('0x2b')](_0x198e3b,'no\x20interval\x20configured');}var _0x556681=this['getIntervals'][_0x9881('0x6f')](this,_0x198e3b[_0x9881('0x14a')]);if(!_0x556681){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x198e3b,_0x9881('0x14b'));}for(var _0x4d011e=0x0;_0x4d011e<_0x556681[_0x9881('0x9a')];_0x4d011e+=0x1){var _0xbd2d15=this[_0x9881('0xc')][_0x9881('0xf')](util[_0x9881('0x27')](_0x9881('0x14c'),_0x556681[_0x4d011e]));if(_0xbd2d15[_0x9881('0xaa')]===-0x1){return _0xbd2d15;}logger[_0x9881('0x2e')](util[_0x9881('0x27')]('IFTIME\x20%s\x20%s',_0x556681[_0x4d011e],_0xbd2d15[_0x9881('0xa1')]));if(_0xbd2d15[_0x9881('0xa1')]===_0x9881('0x14d')){logger[_0x9881('0x2e')](util['format'](_0x9881('0x14e'),_0x556681[_0x4d011e],_0x9881('0x14d')));this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('IFTIME\x20%s\x20%s',_0x556681[_0x4d011e],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x9881('0x2e')](util['format'](_0x9881('0x14e'),_0x556681[_0x4d011e],'false'));this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x14e'),_0x556681[_0x4d011e],'false'));}}return{'code':0xc8,'result':_0x9881('0x147')};};AGIVertices[_0x9881('0xe')][_0x9881('0x14f')]=function(_0x2590c8){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x150'),_0x2590c8[_0x9881('0x38')]));return this[_0x9881('0xc')][_0x9881('0x14f')]();};AGIVertices['prototype'][_0x9881('0x151')]=function(_0x4ce7f4){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x152'),_0x4ce7f4[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x4ce7f4[_0x9881('0x7f')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0x132'));}var _0x4af8a3='wav';var _0x341a81=util[_0x9881('0x27')](_0x9881('0x134'),FILES_PATH,rs[_0x9881('0x116')](0x4));var _0x55c92d=util[_0x9881('0x27')]('%s.%s',_0x341a81,_0x4af8a3);var _0x8825ff=!![];if(_0x4ce7f4[_0x9881('0x135')]===_0x9881('0x136')){_0x8825ff=![];}var _0x5a66de=this[_0x9881('0xc')][_0x9881('0x137')](_0x341a81,_0x4af8a3,_0x4ce7f4[_0x9881('0x138')],_0x4ce7f4[_0x9881('0x64')],undefined,_0x8825ff);if(_0x5a66de[_0x9881('0xaa')]!==-0x1){this[_0x9881('0xc')][_0x9881('0xa6')](util['format'](_0x9881('0x153'),_0x55c92d));var _0x7261e7=this['ispeechASR'][_0x9881('0x6f')](this,_0x4ce7f4,_0x55c92d);if(_0x7261e7){for(var _0x1ac5f7 in _0x7261e7){if(_0x7261e7[_0x9881('0x94')](_0x1ac5f7)){this[_0x9881('0xc')][_0x9881('0x9e')](util[_0x9881('0x27')](_0x9881('0x154'),_0x1ac5f7[_0x9881('0x67')]()),_0x7261e7[_0x1ac5f7]);}}return this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x155'),JSON[_0x9881('0x72')](_0x7261e7)));}}return _0x5a66de;};AGIVertices['prototype'][_0x9881('0x156')]=function(_0x3b2f29){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3b2f29['label']));if(!this[_0x9881('0x84')](_0x3b2f29[_0x9881('0x7f')])){return this[_0x9881('0xc')]['noop'](_0x9881('0x132'));}if(!this[_0x9881('0x84')](_0x3b2f29[_0x9881('0x5b')])){return this[_0x9881('0xc')]['noop'](_0x9881('0xa7'));}this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x157'),_0x3b2f29[_0x9881('0x5b')]));var _0x467bee=this[_0x9881('0x7e')]['sync'](this,_0x3b2f29);if(_0x467bee){this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x153'),_0x467bee));var _0x406037=this[_0x9881('0xc')][_0x9881('0x125')](_0x467bee,_0x3b2f29[_0x9881('0x138')]);try{fs['unlink'](_0x467bee+_0x9881('0x105'));}catch(_0x5f15e0){logger['error'](_0x5f15e0);}return _0x406037;}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x3b2f29,_0x9881('0x158'));};AGIVertices[_0x9881('0xe')][_0x9881('0x159')]=function(_0x2fa80d){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x15a'),_0x2fa80d[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x2fa80d[_0x9881('0x15b')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x2fa80d,_0x9881('0x15c'));}logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x15d'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x2fa80d[_0x9881('0x15b')]));var _0x335a96=this[_0x9881('0x53')][_0x9881('0x6f')](this,_0x2fa80d['findBy']);if(_0x335a96){logger[_0x9881('0x2e')](util['format'](_0x9881('0x15e'),this[_0x9881('0xc')]['callerid'],_0x2fa80d[_0x9881('0x15b')]));this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x15e'),this[_0x9881('0xc')]['callerid'],_0x2fa80d[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x15f')};}else{logger['info'](util[_0x9881('0x27')](_0x9881('0x160'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x2fa80d[_0x9881('0x15b')]));this[_0x9881('0xc')][_0x9881('0xa6')](util['format'](_0x9881('0x160'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x2fa80d[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x161')};}};AGIVertices['prototype'][_0x9881('0x162')]=function(_0x4a0a2f){logger[_0x9881('0x2e')](util['format'](_0x9881('0x163'),_0x4a0a2f[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x4a0a2f[_0x9881('0x15b')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x4a0a2f,'no\x20find\x20by\x20configured');}logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x15d'),this['channel'][_0x9881('0x3a')],_0x4a0a2f[_0x9881('0x15b')]));var _0x2ef54f=this[_0x9881('0x52')][_0x9881('0x6f')](this,_0x4a0a2f[_0x9881('0x15b')]);if(_0x2ef54f){logger['info'](util[_0x9881('0x27')](_0x9881('0x15e'),this['channel'][_0x9881('0x3a')],_0x4a0a2f['findBy']));this[_0x9881('0xc')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9881('0xc')][_0x9881('0x3a')],_0x4a0a2f[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x15f')};}else{logger['info'](util['format'](_0x9881('0x160'),this['channel'][_0x9881('0x3a')],_0x4a0a2f[_0x9881('0x15b')]));this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x160'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x4a0a2f[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x161')};}};AGIVertices[_0x9881('0xe')]['math']=function(_0x169e8b){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x169e8b['label']));if(!this[_0x9881('0x84')](_0x169e8b[_0x9881('0x164')])){return this[_0x9881('0xc')]['error'](_0x169e8b,'no\x20operation\x20configured');}this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')]('math\x20%s',_0x169e8b[_0x9881('0x164')]));var _0x482132=eval(_0x169e8b[_0x9881('0x164')]);if(!this[_0x9881('0x84')](_0x169e8b[_0x9881('0xdb')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xdc'));}var _0x2c2ba8=this[_0x9881('0xf')]['sync'](this,_0x169e8b[_0x9881('0xdb')]);if(!_0x2c2ba8){return this[_0x9881('0xc')]['error'](_0x169e8b,'no\x20variable\x20found');}if(_[_0x9881('0x99')](_0x482132)){var _0x49502e=this;_0x482132[_0x9881('0xde')](function(_0x4ab5de,_0x2bb16b){_0x49502e['channel'][_0x9881('0x9e')](util[_0x9881('0x27')]('%s[%s]',_0x2c2ba8,_0x2bb16b),_0x4ab5de);});return this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x165'),_0x2c2ba8));}else{return this[_0x9881('0xc')][_0x9881('0x9e')](_0x2c2ba8,_0x482132);}};AGIVertices[_0x9881('0xe')][_0x9881('0xb')]=function(_0x5c3d10){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x166'),_0x5c3d10[_0x9881('0x38')]));if(_0x5c3d10['retry']===0x0){return this[_0x9881('0xa2')](_0x5c3d10);}_0x5c3d10[_0x9881('0xa3')]-=0x1;if(!this['isConfigured'](_0x5c3d10[_0x9881('0x110')])){return this[_0x9881('0xc')]['error'](_0x5c3d10,_0x9881('0x10f'));}var _0x1395f4=this[_0x9881('0x1c')][_0x9881('0x6f')](this,_0x5c3d10[_0x9881('0x110')]);if(!_0x1395f4){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x5c3d10,_0x9881('0x167'));}var _0x229c66=this[_0x9881('0xc')][_0x9881('0x111')](_0x1395f4,_0x5c3d10[_0x9881('0x168')],_0x5c3d10['digit']);var _0x5212db=_0x229c66[_0x9881('0xaa')];if(_0x229c66[_0x9881('0xaa')]===-0x1){this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x5c3d10,'-1');return _0x229c66;}else if(_0x229c66[_0x9881('0xa1')]==='timeout'){_0x229c66['result']=_0x229c66['result'][_0x9881('0x9a')]>0x0?_0x229c66[_0x9881('0xaa')]:'t';}else if(_[_0x9881('0x43')](_0x229c66[_0x9881('0xaa')])){_0x229c66[_0x9881('0xaa')]='#';_0x5212db='#';}if(!this['isConfigured'](_0x5c3d10[_0x9881('0xdb')])){this['channel'][_0x9881('0xa6')](_0x9881('0xdc'));}else{var _0x2d21e8=this['getVariable'][_0x9881('0x6f')](this,_0x5c3d10[_0x9881('0xdb')]);if(!_0x2d21e8){return this[_0x9881('0xc')]['error'](_0x5c3d10,_0x9881('0xdd'));}this[_0x9881('0xc')][_0x9881('0x9e')](_0x2d21e8,_0x5212db);}this['createSquareDetailsReport'][_0x9881('0x6f')](this,_0x5c3d10,_0x5212db);return _0x229c66;};AGIVertices['prototype'][_0x9881('0xa6')]=function(_0x125e0a){logger[_0x9881('0x2e')](util['format'](_0x9881('0x169'),_0x125e0a['label']));return this['channel'][_0x9881('0xa6')](_0x125e0a[_0x9881('0x16a')]||_0x125e0a[_0x9881('0x38')]);};AGIVertices[_0x9881('0xe')]['pause']=function(_0x41326d){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x16b'),_0x41326d['label']));if(!this[_0x9881('0x84')](_0x41326d[_0x9881('0x15b')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x41326d,_0x9881('0x15c'));}logger[_0x9881('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9881('0xc')]['callerid'],_0x41326d[_0x9881('0x15b')]));var _0xbe5457=this['getPause'][_0x9881('0x6f')](this,_0x41326d[_0x9881('0x16c')]);var _0x3d88a6=this[_0x9881('0x4f')][_0x9881('0x6f')](this,_0x41326d['findBy'],_0xbe5457);if(_0x3d88a6){logger['info'](util[_0x9881('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x9881('0xc')]['callerid'],_0x41326d[_0x9881('0x15b')]));this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x15e'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x41326d[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x15f')};}else{logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x160'),this[_0x9881('0xc')]['callerid'],_0x41326d['findBy']));this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x15e'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x41326d[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x161')};}};AGIVertices[_0x9881('0xe')]['playback']=function(_0x9e0295){logger['info'](util[_0x9881('0x27')](_0x9881('0x16d'),_0x9e0295[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x9e0295['file_id'])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x9e0295,_0x9881('0x10f'));}var _0x127381=this[_0x9881('0x1c')][_0x9881('0x6f')](this,_0x9e0295[_0x9881('0x110')]);if(!_0x127381){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x9e0295,_0x9881('0x167'));}var _0x3ea358=this['channel'][_0x9881('0xa8')]('PLAYBACK',[_0x127381,_0x9e0295['opts']]);if(_0x3ea358['result']===-0x1){return _0x3ea358;}return this[_0x9881('0xc')]['noop'](util['format'](_0x9881('0x16e'),'PLAYBACK',_0x127381));};AGIVertices[_0x9881('0xe')][_0x9881('0x16f')]=function(_0x329283){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x329283['label']));if(!this['isConfigured'](_0x329283[_0x9881('0x170')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x329283,_0x9881('0x171'));}var _0x261e2e='';var _0x550aee=parseInt(_0x329283[_0x9881('0x170')],0xa);if(isNaN(_0x550aee)){_0x261e2e=_0x329283[_0x9881('0x170')];}else{_0x261e2e=this[_0x9881('0x172')][_0x9881('0x6f')](this,_0x329283['queue_id']);if(!_0x261e2e){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x329283,_0x9881('0x173'));}}var _0x2c7599='';if(this['isConfigured'](_0x329283[_0x9881('0x110')])){var _0x28ac6e=this[_0x9881('0x1c')][_0x9881('0x6f')](this,_0x329283['file_id']);if(_0x28ac6e){_0x2c7599=_0x28ac6e;}}this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x329283,_0x261e2e);if(_0x329283[_0x9881('0xe9')]['indexOf']('x')<0x0){_0x329283['opts']+='x';}if(_0x329283[_0x9881('0xe9')]['indexOf']('X')<0x0){_0x329283[_0x9881('0xe9')]+='X';}this[_0x9881('0xc')][_0x9881('0x9e')](_0x9881('0x174'),_0x261e2e?_0x261e2e[_0x9881('0x175')]():'');var _0x3e4f57=this[_0x9881('0xc')]['exec'](_0x9881('0x176'),[_0x261e2e,_0x329283['opts'],_0x329283[_0x9881('0x62')],_0x2c7599,_0x329283[_0x9881('0x64')],_0x329283[_0x9881('0x6')],_0x329283[_0x9881('0x177')],_0x329283[_0x9881('0x178')],'',_0x329283[_0x9881('0x179')]]);if(_0x3e4f57['result']===-0x1){return _0x3e4f57;}return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x16e'),_0x9881('0x176'),_0x261e2e));};AGIVertices[_0x9881('0xe')][_0x9881('0x17a')]=function(_0x50d404){logger['info'](util[_0x9881('0x27')](_0x9881('0x17b'),_0x50d404[_0x9881('0x38')]));var _0x32337c=_0x50d404['recordingFormat']||_0x9881('0x133');var _0x39a6a4=util['format'](_0x9881('0x17c'),this[_0x9881('0xc')][_0x9881('0x37')],rs['generate'](0x5));var _0x31a373=util['format'](_0x9881('0x17d'),FILES_PATH,_0x39a6a4,_0x32337c);var _0x167440=util['format'](_0x9881('0x134'),FILES_PATH,_0x39a6a4);this[_0x9881('0x3b')][_0x9881('0x6f')](this,_0x50d404,_0x39a6a4,_0x31a373);this[_0x9881('0xc')]['setVariable']('RECORDING_SAVENAME',_0x39a6a4);logger[_0x9881('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x167440,_0x32337c,_0x50d404[_0x9881('0x17e')],_0x50d404['timeout']);return this[_0x9881('0xc')][_0x9881('0x137')](_0x167440,_0x32337c,_0x50d404['escape_digits'],_0x50d404[_0x9881('0x64')],undefined,!![]);};AGIVertices[_0x9881('0xe')]['restapi']=function(_0x4d6419){logger[_0x9881('0x2e')](util['format'](_0x9881('0x17f'),_0x4d6419[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x4d6419[_0x9881('0x62')])){return this['channel'][_0x9881('0xa6')](_0x9881('0x180'));}var _0x1e8492=this[_0x9881('0x181')][_0x9881('0x6f')](this,_0x4d6419);logger['info'](util['format'](_0x9881('0x182'),util['inspect'](_0x1e8492,{'showHidden':![],'depth':null})));if(!this[_0x9881('0x84')](_0x4d6419[_0x9881('0xdb')])){return this[_0x9881('0xc')][_0x9881('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2e9833=this[_0x9881('0xf')][_0x9881('0x6f')](this,_0x4d6419[_0x9881('0xdb')]);if(!_0x2e9833){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x4d6419,_0x9881('0xdd'));}this[_0x9881('0xc')][_0x9881('0x9e')](util['format'](_0x9881('0x183'),_0x2e9833),_0x1e8492[_0x9881('0x73')]?_0x1e8492[_0x9881('0x73')]:_0x9881('0x184'));this[_0x9881('0xc')][_0x9881('0x9e')](util['format']('%s_STATUS_MESSAGE',_0x2e9833),_0x1e8492['statusMessage']?_0x1e8492[_0x9881('0x185')]:'OK');if(_0x1e8492[_0x9881('0x68')]){try{this[_0x9881('0x9c')](_0x1e8492[_0x9881('0x68')],_0x2e9833);}catch(_0x1b628a){logger[_0x9881('0x2b')](util['format'](_0x9881('0x186'),_0x2e9833));}}return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0xe2'),_0x2e9833));};AGIVertices[_0x9881('0xe')][_0x9881('0x187')]=function(_0x501825){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x188'),_0x501825['label']));return this[_0x9881('0xc')][_0x9881('0x189')](_0x501825[_0x9881('0x18a')][_0x9881('0x57')](/\s+/g,''),_0x501825[_0x9881('0x17e')]);};AGIVertices[_0x9881('0xe')]['saynumber']=function(_0x3b5d59){logger['info'](util[_0x9881('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3b5d59[_0x9881('0x38')]));return this[_0x9881('0xc')][_0x9881('0x18b')](_0x3b5d59['number']['replace'](/\s+/g,''),_0x3b5d59[_0x9881('0x17e')]);};AGIVertices[_0x9881('0xe')][_0x9881('0x18c')]=function(_0x228f3c){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x228f3c[_0x9881('0x38')]));return this[_0x9881('0xc')][_0x9881('0x18d')](_0x228f3c[_0x9881('0x5b')],_0x228f3c[_0x9881('0x17e')]);};AGIVertices[_0x9881('0xe')]['sendMail']=function(_0xec4cb7){logger[_0x9881('0x2e')](util[_0x9881('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xec4cb7['label']));if(!this['isConfigured'](_0xec4cb7[_0x9881('0x18e')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0x18f'));}var _0x54cd4b=this['getMailAccount'][_0x9881('0x6f')](this,_0xec4cb7[_0x9881('0x18e')]);if(!_0x54cd4b||!_0x54cd4b['Smtp']){return this[_0x9881('0xc')][_0x9881('0x2b')](_0xec4cb7,_0x9881('0x190'));}var _0x3dee1c={'from':util[_0x9881('0x27')](_0x9881('0x191'),_0x54cd4b[_0x9881('0x13')],_0x54cd4b[_0x9881('0x192')]||_0x54cd4b[_0x9881('0x193')][_0x9881('0x194')]),'to':_0xec4cb7['to']||'','cc':_0xec4cb7['cc']||'','bcc':_0xec4cb7[_0x9881('0x195')]||'','subject':_0xec4cb7[_0x9881('0x196')],'html':_0xec4cb7['text'],'text':_0xec4cb7[_0x9881('0x5b')]};if(this['isConfigured'](_0xec4cb7[_0x9881('0x197')])){}logger[_0x9881('0xe3')]('sendMail\x20message',JSON[_0x9881('0x72')](_0x3dee1c));this[_0x9881('0x36')]['sync'](this,_0xec4cb7,_0xec4cb7[_0x9881('0x18e')]);this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x198'),_0x54cd4b['name']));this[_0x9881('0x21')][_0x9881('0x6f')](this,_0x54cd4b[_0x9881('0x199')],_0x3dee1c);return this['channel'][_0x9881('0xa6')](_0x9881('0x19a'));};AGIVertices[_0x9881('0xe')][_0x9881('0x19b')]=function(_0x4104cd){logger['info'](util['format'](_0x9881('0x19c'),_0x4104cd[_0x9881('0x38')]));return this[_0x9881('0xc')]['noop'](_0x9881('0x19d'));};AGIVertices[_0x9881('0xe')]['sendSMS']=function(_0x24e2e8){logger['info'](util[_0x9881('0x27')](_0x9881('0x19e'),_0x24e2e8[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x24e2e8[_0x9881('0x19f')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0x1a0'));}var _0x5a880a=this[_0x9881('0x33')][_0x9881('0x6f')](this,_0x24e2e8[_0x9881('0x19f')]);if(!_0x5a880a){return this['channel'][_0x9881('0x2b')](_0x24e2e8,_0x9881('0x1a1'));}var _0x261e36={'body':_0x24e2e8[_0x9881('0x1a2')],'phone':_0x24e2e8['to']||'','SmsAccountId':_0x5a880a['id']};logger[_0x9881('0xe3')](_0x9881('0x1a3'),JSON[_0x9881('0x72')](_0x261e36));this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x24e2e8,_0x24e2e8[_0x9881('0x19f')]);this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5a880a[_0x9881('0x13')]));this[_0x9881('0x35')][_0x9881('0x6f')](this,_0x261e36);return this[_0x9881('0xc')]['noop'](_0x9881('0x1a4'));};AGIVertices[_0x9881('0xe')]['set']=function(_0x478a8e){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x1a5'),_0x478a8e[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x478a8e[_0x9881('0xdb')])){return this['channel'][_0x9881('0x2b')](_0x478a8e,_0x9881('0x1a6'));}var _0x5e9a0d=this['getVariable'][_0x9881('0x6f')](this,_0x478a8e['variable_id']);if(!_0x5e9a0d){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x478a8e,_0x9881('0xdd'));}return this['channel']['setVariable'](_0x5e9a0d,_0x478a8e[_0x9881('0x1a7')]);};AGIVertices['prototype']['start']=function(_0x3c1a49){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x1a8'),_0x3c1a49[_0x9881('0x38')]));this[_0x9881('0xc')]['noop'](_0x9881('0x1a9'));var _0x13235f=this[_0x9881('0xc')][_0x9881('0xf')](_0x9881('0x1aa'));if(!_['isEmpty'](_0x13235f[_0x9881('0xa1')])){this['channel'][_0x9881('0x37')]=_0x13235f[_0x9881('0xa1')];}if(_0x3c1a49['answer']===_0x9881('0x1ab')){this['channel'][_0x9881('0xa6')](_0x9881('0x1ac'));return this['channel'][_0x9881('0xb9')]();}return this['channel']['noop'](_0x9881('0x1ad'));};AGIVertices[_0x9881('0xe')]['subproject']=function(_0x21ef81){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x1ae'),_0x21ef81[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x21ef81['project_id'])){return this['channel']['error'](_0x21ef81,'no\x20subproject\x20selected');}var _0x4638ea=this['getSquareProject']['sync'](this,_0x21ef81[_0x9881('0x1af')]);if(!this[_0x9881('0x84')](_0x4638ea)){return this[_0x9881('0xc')]['error'](_0x21ef81,util['format'](_0x9881('0x1b0'),_0x21ef81['project_id']));}if(_0x4638ea===this[_0x9881('0xc')]['arg_1']){return this[_0x9881('0xc')]['error'](_0x21ef81,_0x9881('0x1b1'));}this[_0x9881('0x36')][_0x9881('0x6f')](this,_0x21ef81,_0x4638ea);var _0x14df05=this[_0x9881('0xc')][_0x9881('0xa8')](_0x9881('0x1b2'),util[_0x9881('0x27')](_0x9881('0x1b3'),config[_0x9881('0x6')][_0x9881('0x1b4')]||_0x9881('0x1b5'),_0x4638ea,this[_0x9881('0xc')][_0x9881('0x3f')]));if(_0x14df05[_0x9881('0xaa')]===-0x1){return _0x14df05;}return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Executed\x20command\x20%s\x20%s',_0x9881('0x1b2'),_0x4638ea));};AGIVertices[_0x9881('0xe')]['system']=function(_0x345c4b){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x1b6'),_0x345c4b[_0x9881('0x38')]));var _0x1a378b=this['shellCommand'][_0x9881('0x6f')](this,_0x345c4b[_0x9881('0xb8')]);this['createSquareDetailsReport'][_0x9881('0x6f')](this,_0x345c4b,_0x345c4b[_0x9881('0xb8')]);if(this[_0x9881('0x84')](_0x345c4b[_0x9881('0xdb')])){var _0x3f3af7=this['getVariable']['sync'](this,_0x345c4b[_0x9881('0xdb')]);if(_0x3f3af7){this[_0x9881('0xc')]['setVariable'](_0x3f3af7,_0x1a378b);return this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x1b7'),_0x345c4b[_0x9881('0xb8')],_0x3f3af7));}}return this['channel'][_0x9881('0xa6')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x345c4b[_0x9881('0xb8')]));};AGIVertices[_0x9881('0xe')][_0x9881('0x1b8')]=function(_0x5a70d8){logger['info'](util[_0x9881('0x27')](_0x9881('0x1b9'),_0x5a70d8[_0x9881('0x38')]));_0x5a70d8['text']=_0x5a70d8['text'][_0x9881('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9881('0x84')](_0x5a70d8[_0x9881('0x59')])){return this['channel'][_0x9881('0xa6')](_0x9881('0x1ba'));}if(!this[_0x9881('0x84')](_0x5a70d8[_0x9881('0x5b')])){return this['channel'][_0x9881('0xa6')](_0x9881('0xa7'));}this['channel'][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x1bb'),_0x5a70d8[_0x9881('0x5b')]));var _0x455353=this['googleCloudTTS'][_0x9881('0x6f')](this,_0x5a70d8);if(_0x455353){this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x455353));var _0x863b56=this[_0x9881('0xc')][_0x9881('0x125')](_0x455353);try{fs[_0x9881('0x126')](_0x455353+_0x9881('0x105'));}catch(_0x3d77a9){logger[_0x9881('0x2b')](_0x3d77a9);}return _0x863b56;}return this['channel'][_0x9881('0x2b')](_0x5a70d8,_0x9881('0x1bc'));};AGIVertices[_0x9881('0xe')][_0x9881('0x1bd')]=function(_0x38ec47){logger['info'](util[_0x9881('0x27')](_0x9881('0x1be'),_0x38ec47[_0x9881('0x38')]));_0x38ec47['text']=_0x38ec47[_0x9881('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9881('0x84')](_0x38ec47[_0x9881('0x5b')])){return this[_0x9881('0xc')][_0x9881('0xa6')](_0x9881('0xa7'));}this[_0x9881('0xc')][_0x9881('0xa6')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x38ec47[_0x9881('0x5b')]));var _0x3a1283=this[_0x9881('0x60')][_0x9881('0x6f')](this,_0x38ec47);if(_0x3a1283){this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x1bf'),_0x3a1283));var _0x287b30=this[_0x9881('0xc')]['streamFile'](_0x3a1283);try{fs['unlink'](_0x3a1283+'.wav');}catch(_0x56db28){logger[_0x9881('0x2b')](_0x56db28);}return _0x287b30;}return this[_0x9881('0xc')][_0x9881('0x2b')](_0x38ec47,_0x9881('0x1c0'));};AGIVertices[_0x9881('0xe')][_0x9881('0x1c1')]=function(_0x4e0fc0){logger[_0x9881('0x2e')](util['format'](_0x9881('0x1c2'),_0x4e0fc0[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x4e0fc0[_0x9881('0x15b')])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x4e0fc0,'no\x20find\x20by\x20configured');}logger[_0x9881('0x2e')](util[_0x9881('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x4e0fc0[_0x9881('0x15b')]));var _0x3e147e=this['agentUnpause'][_0x9881('0x6f')](this,_0x4e0fc0['findBy']);if(_0x3e147e){logger['info'](util['format'](_0x9881('0x15e'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x4e0fc0['findBy']));this[_0x9881('0xc')]['noop'](util[_0x9881('0x27')](_0x9881('0x15e'),this['channel'][_0x9881('0x3a')],_0x4e0fc0[_0x9881('0x15b')]));return{'code':0xc8,'result':_0x9881('0x15f')};}else{logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x160'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x4e0fc0[_0x9881('0x15b')]));this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')](_0x9881('0x160'),this[_0x9881('0xc')][_0x9881('0x3a')],_0x4e0fc0[_0x9881('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['voicemail']=function(_0x4886de){logger[_0x9881('0x2e')](util[_0x9881('0x27')](_0x9881('0x1c3'),_0x4886de[_0x9881('0x38')]));var _0x2611c1=this[_0x9881('0xc')][_0x9881('0xa8')](_0x9881('0x1c4'),[_0x4886de[_0x9881('0x1c5')],_0x4886de[_0x9881('0x75')]]);if(_0x2611c1[_0x9881('0xaa')]===-0x1){return _0x2611c1;}return this[_0x9881('0xc')][_0x9881('0xa6')](util[_0x9881('0x27')]('Executed\x20command\x20%s\x20%s',_0x9881('0x1c4'),_0x4886de['mailbox']));};AGIVertices[_0x9881('0xe')][_0x9881('0x1c6')]=function(_0x448aa0){logger[_0x9881('0x2e')](util['format'](_0x9881('0x1c7'),_0x448aa0[_0x9881('0x38')]));if(!this[_0x9881('0x84')](_0x448aa0['variable_id'])){return this[_0x9881('0xc')][_0x9881('0x2b')](_0x448aa0,_0x9881('0x1a6'));}var _0x241ffa=this[_0x9881('0xf')][_0x9881('0x6f')](this,_0x448aa0[_0x9881('0xdb')]);if(!_0x241ffa){return this['channel'][_0x9881('0x2b')](_0x448aa0,_0x9881('0xdd'));}var _0x96e44b=this[_0x9881('0xc')][_0x9881('0xf')](_0x241ffa);return{'code':0xc8,'result':_0x96e44b['extra']?_0x96e44b['extra']:'-'};};String[_0x9881('0xe')][_0x9881('0x9f')]=function(_0x53b1a7,_0x4cd45f){return this['split'](_0x53b1a7)[_0x9881('0x1c8')](_0x4cd45f);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c95d18f..06b6e73 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 _0x964b=['stopAcw','uniqueid','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','Auto-Pause','exports','lodash','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout'];(function(_0x24ee21,_0x3c9459){var _0x48b697=function(_0xa468f){while(--_0xa468f){_0x24ee21['push'](_0x24ee21['shift']());}};_0x48b697(++_0x3c9459);}(_0x964b,0x112));var _0xb964=function(_0x1e9de2,_0x190648){_0x1e9de2=_0x1e9de2-0x0;var _0x5eeab0=_0x964b[_0x1e9de2];return _0x5eeab0;};'use strict';var _=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var ami=require('../ami');var logger=require(_0xb964('0x2'))(_0xb964('0x3'));var RpcUser=require(_0xb964('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5c4f01){this[_0xb964('0x5')]=_0x5c4f01['voiceQueues'];this[_0xb964('0x6')]=_0x5c4f01[_0xb964('0x6')];this[_0xb964('0x7')]=_0x5c4f01[_0xb964('0x7')];this[_0xb964('0x8')]={};ami['on'](_0xb964('0x9'),this[_0xb964('0xa')]['bind'](this));ami['on']('hanguprequest',this[_0xb964('0xb')]['bind'](this));ami['on']('hangup',this[_0xb964('0xc')][_0xb964('0xd')](this));ami['on'](_0xb964('0xe'),this[_0xb964('0xf')][_0xb964('0xd')](this));ami['on'](_0xb964('0x10'),this['syncAttendedTransfer'][_0xb964('0xd')](this));ami['on'](_0xb964('0x11'),this[_0xb964('0x12')][_0xb964('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xb964('0x13')]['bind'](this));}function getDiff(_0x556533){var _0x3ce73e=moment()[_0xb964('0x14')](0x0);var _0xe111d2=moment(_0x556533)[_0xb964('0x14')](0x0);return _0x3ce73e[_0xb964('0x15')](_0xe111d2,_0xb964('0x16'));}Acw[_0xb964('0x17')]['updateAcw']=function(_0x3f507a,_0x5a2ce4){var _0x538d2e=this;var _0xd775d5=getDiff(_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x18')]);clearTimeout(_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x19')]);_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x19')]=![];return RpcVoiceAgentReport[_0xb964('0x1a')]({'acwtime':_0xd775d5},_0x538d2e[_0xb964('0x7')][_0x3f507a]['uniqueid'],_0x3f507a)['then'](function(_0x49a066){logger[_0xb964('0x1b')](_0xb964('0x1c'),_0x5a2ce4,_0xd775d5,_0x49a066);})[_0xb964('0x1d')](function(_0x527f62){logger[_0xb964('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x5a2ce4,_0x527f62);})['finally'](function(){delete _0x538d2e['timers'][_0x3f507a];});};Acw[_0xb964('0x17')][_0xb964('0x1f')]=function(_0x30d78f){try{var _0x4e5160=this;var _0x3cc265=this[_0xb964('0x8')][_0x30d78f][_0xb964('0x20')];var _0x5d85d9=this['channels'][_0x30d78f][_0xb964('0x21')];var _0x5469c2=this[_0xb964('0x5')][_0x5d85d9];var _0x2bace5=![];var _0x2b9b74=_0xb964('0x22');if(_0x5469c2['mandatoryDisposition']&&_0x5469c2[_0xb964('0x23')][_0xb964('0x24')]){_0x2bace5=!![];_0x2b9b74=_0x5469c2[_0xb964('0x23')][_0xb964('0x24')];}if(!_0x4e5160[_0xb964('0x6')][_0x3cc265]){return Promise[_0xb964('0x25')]();}return RpcUser[_0xb964('0x26')](_0x4e5160[_0xb964('0x6')][_0x3cc265]['id'])[_0xb964('0x27')](function(_0x4d82e2){if(!_0x4d82e2||_0x4d82e2[_0xb964('0x28')]){logger[_0xb964('0x1b')](_0xb964('0x29'),_0x30d78f,_0x3cc265,_0x5d85d9);return;}logger[_0xb964('0x1b')](_0xb964('0x2a'),_0x30d78f,_0x3cc265,_0x5d85d9);var _0x24cc22=_0x4e5160[_0xb964('0x8')][_0x30d78f]['attended']&&_0x4e5160[_0xb964('0x8')][_0x30d78f][_0xb964('0x2b')]?_0x4e5160[_0xb964('0x8')][_0x30d78f]['destlinkedid']:_0x30d78f;return RpcUser[_0xb964('0x2c')](_0x4e5160[_0xb964('0x6')][_0x3cc265],_0x2b9b74,_0x24cc22);})[_0xb964('0x27')](function(_0x2cc8b6){if(_0x2bace5||!_0x2cc8b6){return;}_0x4e5160[_0xb964('0x7')][_0x3cc265]={};logger[_0xb964('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30d78f,_0x4e5160['voiceQueues'][_0x5d85d9][_0xb964('0x2d')],_0x3cc265,_0x5d85d9);_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x19')]=setTimeout(_0x4e5160[_0xb964('0x2e')]['bind'](_0x4e5160,_0x3cc265),_0x4e5160[_0xb964('0x5')][_0x5d85d9]['acwTimeout']*0x3e8);_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x2f')]=_0x30d78f;_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x21')]=_0x5d85d9;_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x30')]=_0x4e5160['updateAcw']['bind'](_0x4e5160,_0x3cc265,_0x30d78f);})['catch'](function(){logger[_0xb964('0x1e')](_0xb964('0x31'),_0x30d78f,_0x4e5160[_0xb964('0x5')][_0x5d85d9][_0xb964('0x2d')],_0x3cc265,_0x5d85d9);})[_0xb964('0x32')](function(){delete _0x4e5160[_0xb964('0x8')][_0x30d78f];});}catch(_0x4e3eae){logger['error'](_0xb964('0x33'),_0x4e3eae[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x2e')]=function(_0x173de5){try{var _0x51e007=this;if(_0x51e007[_0xb964('0x7')][_0x173de5]){_0x51e007[_0xb964('0x7')][_0x173de5][_0xb964('0x19')]=![];var _0x5f3244=_0x51e007[_0xb964('0x7')][_0x173de5][_0xb964('0x2f')];var _0x4286c3=_0x51e007['timers'][_0x173de5][_0xb964('0x21')];var _0x575023=_0x51e007[_0xb964('0x5')][_0x4286c3]['acwTimeout'];logger[_0xb964('0x1b')](_0xb964('0x35'),_0x5f3244,_0x173de5);RpcUser['saveUnpause'](this['agents'][_0x173de5]);RpcVoiceAgentReport[_0xb964('0x1a')]({'acwtime':_0x575023,'agentacw':!![]},_0x5f3244,_0x173de5)[_0xb964('0x27')](function(_0x2f9e6d){logger[_0xb964('0x1b')](_0xb964('0x1c'),_0x5f3244,_0x575023,_0x2f9e6d);})['catch'](function(_0x1f7ee0){logger[_0xb964('0x1e')](_0xb964('0x36'),_0x5f3244,_0x1f7ee0);});}else{logger['error'](_0xb964('0x37'),_0x173de5);if(_0x51e007[_0xb964('0x7')]){logger[_0xb964('0x1b')](_0xb964('0x38'),JSON[_0xb964('0x39')](_0x51e007['timers']));}}}catch(_0xe962f9){logger[_0xb964('0x1e')]('[ACW][STOP]\x20%s',_0xe962f9[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0xa')]=function(_0x379b31){try{if(this['voiceQueues'][_0x379b31['queue']]&&(this[_0xb964('0x5')][_0x379b31[_0xb964('0x21')]][_0xb964('0x3')]||this[_0xb964('0x5')][_0x379b31[_0xb964('0x21')]][_0xb964('0x3a')])){if(this[_0xb964('0x6')][_0x379b31[_0xb964('0x20')]]){this['channels'][_0x379b31[_0xb964('0x2f')]]={'queue':_0x379b31['queue'],'interface':_0x379b31[_0xb964('0x20')],'destlinkedid':_0x379b31[_0xb964('0x2b')]};}}}catch(_0xea21db){logger['error'](_0xb964('0x3b'),_0xea21db[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x13')]=function(_0x43fcd0){try{if(this[_0xb964('0x5')][_0x43fcd0[_0xb964('0x21')]]&&(this[_0xb964('0x5')][_0x43fcd0[_0xb964('0x21')]]['acw']||this['voiceQueues'][_0x43fcd0['queue']][_0xb964('0x3a')])){if(this[_0xb964('0x6')][_0x43fcd0['interface']]){this[_0xb964('0x8')][_0x43fcd0[_0xb964('0x2f')]]={'queue':_0x43fcd0['queue'],'interface':_0x43fcd0['interface']};}}}catch(_0x343942){logger[_0xb964('0x1e')](_0xb964('0x3c'),_0x343942[_0xb964('0x34')]);}};Acw['prototype'][_0xb964('0xb')]=function(_0x52fbe7){try{if(this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x2f')]]&&_[_0xb964('0x3d')](this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x2f')]][_0xb964('0x3e')])){logger[_0xb964('0x1b')](_0xb964('0x3f'),_0x52fbe7['uniqueid']);this[_0xb964('0x1f')](_0x52fbe7[_0xb964('0x2f')]);}else if(this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x40')]]&&_['isUndefined'](this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x40')]][_0xb964('0x3e')])){logger[_0xb964('0x1b')](_0xb964('0x41'),_0x52fbe7[_0xb964('0x40')]);this[_0xb964('0x1f')](_0x52fbe7[_0xb964('0x40')]);}}catch(_0x3a0e8d){logger[_0xb964('0x1e')](_0xb964('0x42'),_0x3a0e8d[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0xc')]=function(_0x2f2a8a){try{if(this['channels'][_0x2f2a8a[_0xb964('0x2f')]]&&this['channels'][_0x2f2a8a[_0xb964('0x2f')]][_0xb964('0x3e')]){logger[_0xb964('0x1b')](_0xb964('0x43'),_0x2f2a8a['uniqueid']);this[_0xb964('0x1f')](_0x2f2a8a[_0xb964('0x2f')]);}else if(this[_0xb964('0x8')][_0x2f2a8a[_0xb964('0x40')]]&&this[_0xb964('0x8')][_0x2f2a8a['linkedid']]['attended']){logger[_0xb964('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2f2a8a[_0xb964('0x40')]);this[_0xb964('0x1f')](_0x2f2a8a['linkedid']);}}catch(_0x35d9f1){logger[_0xb964('0x1e')]('[ACW][syncHangup]\x20%s',_0x35d9f1[_0xb964('0x34')]);}};Acw[_0xb964('0x17')]['syncAttendedTransfer']=function(_0x1ac423){try{if(!_['isNil'](this[_0xb964('0x8')][_0x1ac423[_0xb964('0x44')]])){this[_0xb964('0x1f')](_0x1ac423[_0xb964('0x44')]);if(this[_0xb964('0x8')][_0x1ac423[_0xb964('0x45')]]){this[_0xb964('0x8')][_0x1ac423['secondtransfereruniqueid']][_0xb964('0x3e')]=!![];this['channels'][_0x1ac423[_0xb964('0x46')]]=this['channels'][_0x1ac423[_0xb964('0x45')]];delete this[_0xb964('0x8')][_0x1ac423[_0xb964('0x45')]];}}else if(!_[_0xb964('0x47')](this[_0xb964('0x8')][_0x1ac423[_0xb964('0x46')]])){this['startAcw'](_0x1ac423[_0xb964('0x46')]);if(this[_0xb964('0x8')][_0x1ac423['origtransfereruniqueid']]){this[_0xb964('0x8')][_0x1ac423[_0xb964('0x48')]]['attended']=!![];this[_0xb964('0x8')][_0x1ac423[_0xb964('0x44')]]=this[_0xb964('0x8')][_0x1ac423['origtransfereruniqueid']];delete this[_0xb964('0x8')][_0x1ac423[_0xb964('0x48')]];}}}catch(_0x3840a0){logger[_0xb964('0x1e')](_0xb964('0x49'),_0x3840a0[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x12')]=function(_0x1f8303){try{if(this['channels'][_0x1f8303[_0xb964('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xb964('0x39')](_0x1f8303['transfereruniqueid']));this[_0xb964('0x1f')](_0x1f8303[_0xb964('0x4a')]);}else if(this[_0xb964('0x8')][_0x1f8303['transfererlinkedid']]){logger[_0xb964('0x1b')](_0xb964('0x4b'),JSON['stringify'](_0x1f8303[_0xb964('0x4c')]));this[_0xb964('0x1f')](_0x1f8303[_0xb964('0x4c')]);}}catch(_0x4f75fe){logger[_0xb964('0x1e')]('[ACW][syncBlindTransfer]\x20%s',_0x4f75fe[_0xb964('0x34')]);}};Acw['prototype'][_0xb964('0xf')]=function(_0x120de2){try{if(this[_0xb964('0x5')][_0x120de2[_0xb964('0x21')]]&&this['voiceQueues'][_0x120de2[_0xb964('0x21')]]['autopause']===_0xb964('0x4d')){if(this[_0xb964('0x6')][_0x120de2[_0xb964('0x20')]]){logger[_0xb964('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x120de2[_0xb964('0x2f')],_0x120de2[_0xb964('0x20')],_0x120de2[_0xb964('0x21')]);return RpcUser[_0xb964('0x2c')](this[_0xb964('0x6')][_0x120de2[_0xb964('0x20')]],_0xb964('0x4e'),_0x120de2[_0xb964('0x2f')]);}}}catch(_0x1fdcbd){logger[_0xb964('0x1e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1fdcbd[_0xb964('0x34')]);}};module[_0xb964('0x4f')]=Acw; \ No newline at end of file +var _0x50e5=['[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','finally','stopAcw','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x2b9c9f,_0x14bdb7){var _0x91e5e5=function(_0x429f32){while(--_0x429f32){_0x2b9c9f['push'](_0x2b9c9f['shift']());}};_0x91e5e5(++_0x14bdb7);}(_0x50e5,0xb7));var _0x550e=function(_0x558bef,_0x106ae4){_0x558bef=_0x558bef-0x0;var _0x945cb1=_0x50e5[_0x558bef];return _0x945cb1;};'use strict';var _=require(_0x550e('0x0'));var moment=require(_0x550e('0x1'));var ami=require('../ami');var logger=require(_0x550e('0x2'))(_0x550e('0x3'));var RpcUser=require(_0x550e('0x4'));var RpcVoiceAgentReport=require(_0x550e('0x5'));function Acw(_0x40aee6){this[_0x550e('0x6')]=_0x40aee6[_0x550e('0x6')];this[_0x550e('0x7')]=_0x40aee6[_0x550e('0x7')];this[_0x550e('0x8')]=_0x40aee6[_0x550e('0x8')];this[_0x550e('0x9')]={};ami['on']('agentconnect',this[_0x550e('0xa')][_0x550e('0xb')](this));ami['on']('hanguprequest',this[_0x550e('0xc')][_0x550e('0xb')](this));ami['on'](_0x550e('0xd'),this['syncHangup'][_0x550e('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x550e('0xb')](this));ami['on'](_0x550e('0xe'),this['syncAttendedTransfer'][_0x550e('0xb')](this));ami['on'](_0x550e('0xf'),this[_0x550e('0x10')][_0x550e('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x550e('0x11')]['bind'](this));}function getDiff(_0x2dc276){var _0x4f5255=moment()[_0x550e('0x12')](0x0);var _0x4c6070=moment(_0x2dc276)[_0x550e('0x12')](0x0);return _0x4f5255[_0x550e('0x13')](_0x4c6070,_0x550e('0x14'));}Acw['prototype'][_0x550e('0x15')]=function(_0x49787c,_0xf28ba7){var _0x49474f=this;var _0x4a5f7a=getDiff(_0x49474f[_0x550e('0x8')][_0x49787c][_0x550e('0x16')]);clearTimeout(_0x49474f['timers'][_0x49787c]['timer']);_0x49474f['timers'][_0x49787c][_0x550e('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x4a5f7a},_0x49474f['timers'][_0x49787c][_0x550e('0x18')],_0x49787c)[_0x550e('0x19')](function(_0x6c7178){logger[_0x550e('0x1a')](_0x550e('0x1b'),_0xf28ba7,_0x4a5f7a,_0x6c7178);})[_0x550e('0x1c')](function(_0x3b4dca){logger[_0x550e('0x1d')](_0x550e('0x1e'),_0xf28ba7,_0x3b4dca);})['finally'](function(){delete _0x49474f[_0x550e('0x8')][_0x49787c];});};Acw[_0x550e('0x1f')]['startAcw']=function(_0x4f70bd){try{var _0x3e9822=this;var _0x2663c7=this['channels'][_0x4f70bd][_0x550e('0x20')];var _0xcf3981=this[_0x550e('0x9')][_0x4f70bd][_0x550e('0x21')];var _0x3aa1b8=this[_0x550e('0x6')][_0xcf3981];var _0x56f6a2=![];var _0x707f72=_0x550e('0x22');if(_0x3aa1b8[_0x550e('0x23')]&&_0x3aa1b8[_0x550e('0x24')][_0x550e('0x25')]){_0x56f6a2=!![];_0x707f72=_0x3aa1b8[_0x550e('0x24')][_0x550e('0x25')];}if(!_0x3e9822[_0x550e('0x7')][_0x2663c7]){return Promise[_0x550e('0x26')]();}return RpcUser[_0x550e('0x27')](_0x3e9822[_0x550e('0x7')][_0x2663c7]['id'])[_0x550e('0x19')](function(_0x5e0434){if(!_0x5e0434||_0x5e0434[_0x550e('0x28')]){logger[_0x550e('0x1a')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4f70bd,_0x2663c7,_0xcf3981);return;}logger[_0x550e('0x1a')](_0x550e('0x29'),_0x4f70bd,_0x2663c7,_0xcf3981);var _0x7ae242=_0x3e9822[_0x550e('0x9')][_0x4f70bd][_0x550e('0x2a')]&&_0x3e9822[_0x550e('0x9')][_0x4f70bd][_0x550e('0x2b')]?_0x3e9822[_0x550e('0x9')][_0x4f70bd][_0x550e('0x2b')]:_0x4f70bd;return RpcUser[_0x550e('0x2c')](_0x3e9822[_0x550e('0x7')][_0x2663c7],_0x707f72,_0x7ae242);})[_0x550e('0x19')](function(_0x32fd38){if(_0x56f6a2||!_0x32fd38){return;}_0x3e9822[_0x550e('0x8')][_0x2663c7]={};logger['info'](_0x550e('0x2d'),_0x4f70bd,_0x3e9822[_0x550e('0x6')][_0xcf3981]['acwTimeout'],_0x2663c7,_0xcf3981);_0x3e9822[_0x550e('0x8')][_0x2663c7][_0x550e('0x17')]=setTimeout(_0x3e9822['stopAcw'][_0x550e('0xb')](_0x3e9822,_0x2663c7),_0x3e9822[_0x550e('0x6')][_0xcf3981][_0x550e('0x2e')]*0x3e8);_0x3e9822[_0x550e('0x8')][_0x2663c7][_0x550e('0x16')]=moment()[_0x550e('0x2f')](_0x550e('0x30'));_0x3e9822[_0x550e('0x8')][_0x2663c7]['uniqueid']=_0x4f70bd;_0x3e9822[_0x550e('0x8')][_0x2663c7]['queue']=_0xcf3981;_0x3e9822[_0x550e('0x8')][_0x2663c7][_0x550e('0x15')]=_0x3e9822['updateAcw'][_0x550e('0xb')](_0x3e9822,_0x2663c7,_0x4f70bd);})[_0x550e('0x1c')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4f70bd,_0x3e9822['voiceQueues'][_0xcf3981]['acwTimeout'],_0x2663c7,_0xcf3981);})[_0x550e('0x31')](function(){delete _0x3e9822[_0x550e('0x9')][_0x4f70bd];});}catch(_0x6c42c6){logger['error']('[ACW][START]\x20%s',_0x6c42c6['message']);}};Acw[_0x550e('0x1f')][_0x550e('0x32')]=function(_0x4f44e3){try{var _0x5342bf=this;if(_0x5342bf['timers'][_0x4f44e3]){_0x5342bf[_0x550e('0x8')][_0x4f44e3][_0x550e('0x17')]=![];var _0x252e62=_0x5342bf['timers'][_0x4f44e3]['uniqueid'];var _0x33a720=_0x5342bf[_0x550e('0x8')][_0x4f44e3][_0x550e('0x21')];var _0xb54bf8=_0x5342bf['voiceQueues'][_0x33a720][_0x550e('0x2e')];logger[_0x550e('0x1a')]('[%s][TIMER][STOP][AGENT:%s]',_0x252e62,_0x4f44e3);RpcUser['saveUnpause'](this[_0x550e('0x7')][_0x4f44e3]);RpcVoiceAgentReport[_0x550e('0x33')]({'acwtime':_0xb54bf8,'agentacw':!![]},_0x252e62,_0x4f44e3)[_0x550e('0x19')](function(_0x437716){logger['info'](_0x550e('0x1b'),_0x252e62,_0xb54bf8,_0x437716);})[_0x550e('0x1c')](function(_0x1dc236){logger[_0x550e('0x1d')]('[%s][UPDATE][ERRORS:%s]',_0x252e62,_0x1dc236);});}else{logger[_0x550e('0x1d')](_0x550e('0x34'),_0x4f44e3);if(_0x5342bf[_0x550e('0x8')]){logger[_0x550e('0x1a')](_0x550e('0x35'),JSON[_0x550e('0x36')](_0x5342bf['timers']));}}}catch(_0x2f8cf5){logger[_0x550e('0x1d')](_0x550e('0x37'),_0x2f8cf5[_0x550e('0x38')]);}};Acw[_0x550e('0x1f')]['syncAgentConnect']=function(_0x10f18f){try{if(this[_0x550e('0x6')][_0x10f18f['queue']]&&(this[_0x550e('0x6')][_0x10f18f[_0x550e('0x21')]][_0x550e('0x3')]||this['voiceQueues'][_0x10f18f['queue']][_0x550e('0x23')])){if(this[_0x550e('0x7')][_0x10f18f['interface']]){this[_0x550e('0x9')][_0x10f18f[_0x550e('0x18')]]={'queue':_0x10f18f['queue'],'interface':_0x10f18f[_0x550e('0x20')],'destlinkedid':_0x10f18f[_0x550e('0x2b')]};}}}catch(_0x1a8405){logger[_0x550e('0x1d')](_0x550e('0x39'),_0x1a8405[_0x550e('0x38')]);}};Acw['prototype'][_0x550e('0x11')]=function(_0x56351d){try{if(this[_0x550e('0x6')][_0x56351d[_0x550e('0x21')]]&&(this['voiceQueues'][_0x56351d[_0x550e('0x21')]][_0x550e('0x3')]||this[_0x550e('0x6')][_0x56351d[_0x550e('0x21')]][_0x550e('0x23')])){if(this[_0x550e('0x7')][_0x56351d['interface']]){this[_0x550e('0x9')][_0x56351d[_0x550e('0x18')]]={'queue':_0x56351d[_0x550e('0x21')],'interface':_0x56351d[_0x550e('0x20')]};}}}catch(_0x5a9ef5){logger[_0x550e('0x1d')](_0x550e('0x3a'),_0x5a9ef5[_0x550e('0x38')]);}};Acw[_0x550e('0x1f')][_0x550e('0xc')]=function(_0x343d4b){try{if(this[_0x550e('0x9')][_0x343d4b[_0x550e('0x18')]]&&_[_0x550e('0x3b')](this[_0x550e('0x9')][_0x343d4b[_0x550e('0x18')]][_0x550e('0x2a')])){logger[_0x550e('0x1a')](_0x550e('0x3c'),_0x343d4b[_0x550e('0x18')]);this[_0x550e('0x3d')](_0x343d4b[_0x550e('0x18')]);}else if(this['channels'][_0x343d4b[_0x550e('0x3e')]]&&_[_0x550e('0x3b')](this[_0x550e('0x9')][_0x343d4b[_0x550e('0x3e')]][_0x550e('0x2a')])){logger[_0x550e('0x1a')](_0x550e('0x3f'),_0x343d4b['linkedid']);this[_0x550e('0x3d')](_0x343d4b[_0x550e('0x3e')]);}}catch(_0x23486f){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x23486f['message']);}};Acw[_0x550e('0x1f')][_0x550e('0x40')]=function(_0xe8a979){try{if(this[_0x550e('0x9')][_0xe8a979[_0x550e('0x18')]]&&this[_0x550e('0x9')][_0xe8a979['uniqueid']][_0x550e('0x2a')]){logger[_0x550e('0x1a')](_0x550e('0x41'),_0xe8a979['uniqueid']);this[_0x550e('0x3d')](_0xe8a979['uniqueid']);}else if(this[_0x550e('0x9')][_0xe8a979['linkedid']]&&this[_0x550e('0x9')][_0xe8a979[_0x550e('0x3e')]]['attended']){logger[_0x550e('0x1a')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xe8a979[_0x550e('0x3e')]);this['startAcw'](_0xe8a979[_0x550e('0x3e')]);}}catch(_0x45b188){logger['error'](_0x550e('0x42'),_0x45b188['message']);}};Acw[_0x550e('0x1f')][_0x550e('0x43')]=function(_0x2c8734){try{if(!_[_0x550e('0x44')](this['channels'][_0x2c8734['transfereeuniqueid']])){this[_0x550e('0x3d')](_0x2c8734['transfereeuniqueid']);if(this['channels'][_0x2c8734[_0x550e('0x45')]]){this[_0x550e('0x9')][_0x2c8734[_0x550e('0x45')]][_0x550e('0x2a')]=!![];this[_0x550e('0x9')][_0x2c8734[_0x550e('0x46')]]=this['channels'][_0x2c8734[_0x550e('0x45')]];delete this[_0x550e('0x9')][_0x2c8734[_0x550e('0x45')]];}}else if(!_[_0x550e('0x44')](this[_0x550e('0x9')][_0x2c8734[_0x550e('0x46')]])){this[_0x550e('0x3d')](_0x2c8734[_0x550e('0x46')]);if(this[_0x550e('0x9')][_0x2c8734['origtransfereruniqueid']]){this[_0x550e('0x9')][_0x2c8734[_0x550e('0x47')]][_0x550e('0x2a')]=!![];this[_0x550e('0x9')][_0x2c8734[_0x550e('0x48')]]=this[_0x550e('0x9')][_0x2c8734[_0x550e('0x47')]];delete this[_0x550e('0x9')][_0x2c8734[_0x550e('0x47')]];}}}catch(_0x368cd8){logger['error'](_0x550e('0x49'),_0x368cd8[_0x550e('0x38')]);}};Acw[_0x550e('0x1f')][_0x550e('0x10')]=function(_0x4056fb){try{if(this[_0x550e('0x9')][_0x4056fb[_0x550e('0x4a')]]){logger[_0x550e('0x1a')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x4056fb[_0x550e('0x4a')]));this[_0x550e('0x3d')](_0x4056fb[_0x550e('0x4a')]);}else if(this[_0x550e('0x9')][_0x4056fb[_0x550e('0x4b')]]){logger[_0x550e('0x1a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x550e('0x36')](_0x4056fb[_0x550e('0x4b')]));this['startAcw'](_0x4056fb['transfererlinkedid']);}}catch(_0xde5985){logger[_0x550e('0x1d')](_0x550e('0x4c'),_0xde5985[_0x550e('0x38')]);}};Acw[_0x550e('0x1f')][_0x550e('0x4d')]=function(_0x3da626){try{if(this[_0x550e('0x6')][_0x3da626['queue']]&&this[_0x550e('0x6')][_0x3da626[_0x550e('0x21')]]['autopause']===_0x550e('0x4e')){if(this[_0x550e('0x7')][_0x3da626[_0x550e('0x20')]]){logger[_0x550e('0x1a')](_0x550e('0x4f'),_0x3da626[_0x550e('0x18')],_0x3da626[_0x550e('0x20')],_0x3da626['queue']);return RpcUser[_0x550e('0x2c')](this[_0x550e('0x7')][_0x3da626[_0x550e('0x20')]],_0x550e('0x50'),_0x3da626[_0x550e('0x18')]);}}}catch(_0x59bf83){logger[_0x550e('0x1d')](_0x550e('0x51'),_0x59bf83['message']);}};module[_0x550e('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3c1e38a..a35481f 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 _0x9613=['then','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','resolve'];(function(_0x2a2898,_0x531d10){var _0x50a6b3=function(_0x25aef9){while(--_0x25aef9){_0x2a2898['push'](_0x2a2898['shift']());}};_0x50a6b3(++_0x531d10);}(_0x9613,0xf0));var _0x3961=function(_0x4b0cef,_0x4038ce){_0x4b0cef=_0x4b0cef-0x0;var _0x48f2b8=_0x9613[_0x4b0cef];return _0x48f2b8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var logger=require(_0x3961('0x2'))(_0x3961('0x3'));var config=require(_0x3961('0x4'));var ami=new Manager(config[_0x3961('0x5')][_0x3961('0x6')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')][_0x3961('0x8')],!![]);ami[_0x3961('0x9')]();ami[_0x3961('0xa')]=BPromise[_0x3961('0xb')](ami['action']);function error(_0xb2d165){logger[_0x3961('0xc')](util[_0x3961('0xd')](_0x3961('0xe'),config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')],util[_0x3961('0xf')](_0xb2d165,![],null)));}function close(){logger[_0x3961('0xc')](util['format'](_0x3961('0x10'),config[_0x3961('0x5')][_0x3961('0x7')],config['asterisk']['ip'],config[_0x3961('0x5')][_0x3961('0x6')]));}ami[_0x3961('0x11')]=function(){return function(){return ami[_0x3961('0xa')]({'action':_0x3961('0x12')});};};ami[_0x3961('0x13')]=function(){return function(){return ami['Action']({'action':_0x3961('0x14')});};};ami[_0x3961('0x15')]=function(){return function(){return ami[_0x3961('0xa')]({'action':_0x3961('0x16')});};};ami[_0x3961('0x17')]=function(){return function(){return ami['Action']({'action':_0x3961('0x18')});};};ami[_0x3961('0x19')]=function(){return function(){return ami[_0x3961('0xa')]({'action':'coreshowchannels'});};};function connect(){logger[_0x3961('0x1a')](util[_0x3961('0xd')](_0x3961('0x1b'),config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config['asterisk']['port']));ami[_0x3961('0x1c')](_0x3961('0xc'),error);ami[_0x3961('0x1c')](_0x3961('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0x3961('0x1e'),function(_0x4057ad){logger[_0x3961('0x1a')](util[_0x3961('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')],util[_0x3961('0xf')](_0x4057ad,![],null)));});ami['on']('fullybooted',function(){logger[_0x3961('0x1a')](util[_0x3961('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')]));return Promise[_0x3961('0x1f')]()[_0x3961('0x20')](ami[_0x3961('0x11')]())[_0x3961('0x20')](ami[_0x3961('0x13')]())[_0x3961('0x20')](ami[_0x3961('0x15')]())[_0x3961('0x20')](ami[_0x3961('0x17')]())[_0x3961('0x20')](ami[_0x3961('0x19')]())['catch'](function(_0x151ed2){logger[_0x3961('0xc')]('[ami.js][fullybooted]',util['inspect'](_0x151ed2,{'showHidden':![],'depth':null}));});});ami[_0x3961('0x1c')](_0x3961('0xc'),error);ami[_0x3961('0x1c')](_0x3961('0x1d'),close);module[_0x3961('0x21')]=ami; \ No newline at end of file +var _0x1a0f=['inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','port','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionDeviceStateList','then','actionSipPeerStatus','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','ami','../../config/environment','asterisk','username','password','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x1c7079,_0x1b1d7f){var _0x23602d=function(_0x1442b8){while(--_0x1442b8){_0x1c7079['push'](_0x1c7079['shift']());}};_0x23602d(++_0x1b1d7f);}(_0x1a0f,0x9a));var _0xf1a0=function(_0x51160c,_0x374b59){_0x51160c=_0x51160c-0x0;var _0x15a3fb=_0x1a0f[_0x51160c];return _0x15a3fb;};'use strict';var Manager=require(_0xf1a0('0x0'));var BPromise=require(_0xf1a0('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xf1a0('0x2'));var config=require(_0xf1a0('0x3'));var ami=new Manager(config[_0xf1a0('0x4')]['port'],config[_0xf1a0('0x4')]['ip'],config[_0xf1a0('0x4')][_0xf1a0('0x5')],config[_0xf1a0('0x4')][_0xf1a0('0x6')],!![]);ami['keepConnected']();ami[_0xf1a0('0x7')]=BPromise['promisify'](ami['action']);function error(_0x56a38e){logger[_0xf1a0('0x8')](util[_0xf1a0('0x9')](_0xf1a0('0xa'),config[_0xf1a0('0x4')]['username'],config['asterisk']['ip'],config[_0xf1a0('0x4')]['port'],util[_0xf1a0('0xb')](_0x56a38e,![],null)));}function close(){logger[_0xf1a0('0x8')](util['format'](_0xf1a0('0xc'),config['asterisk']['username'],config[_0xf1a0('0x4')]['ip'],config[_0xf1a0('0x4')]['port']));}ami[_0xf1a0('0xd')]=function(){return function(){return ami[_0xf1a0('0x7')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xf1a0('0x7')]({'action':_0xf1a0('0xe')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xf1a0('0xf')});};};ami[_0xf1a0('0x10')]=function(){return function(){return ami[_0xf1a0('0x7')]({'action':_0xf1a0('0x11')});};};ami[_0xf1a0('0x12')]=function(){return function(){return ami[_0xf1a0('0x7')]({'action':'coreshowchannels'});};};function connect(){logger[_0xf1a0('0x13')](util[_0xf1a0('0x9')](_0xf1a0('0x14'),config[_0xf1a0('0x4')][_0xf1a0('0x5')],config['asterisk']['ip'],config[_0xf1a0('0x4')][_0xf1a0('0x15')]));ami[_0xf1a0('0x16')]('error',error);ami[_0xf1a0('0x16')](_0xf1a0('0x17'),close);}ami['on']('connect',connect);ami['on'](_0xf1a0('0x18'),function(_0x401f80){logger[_0xf1a0('0x13')](util[_0xf1a0('0x9')](_0xf1a0('0x19'),config[_0xf1a0('0x4')]['username'],config[_0xf1a0('0x4')]['ip'],config[_0xf1a0('0x4')]['port'],util[_0xf1a0('0xb')](_0x401f80,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xf1a0('0x9')](_0xf1a0('0x1a'),config['asterisk'][_0xf1a0('0x5')],config[_0xf1a0('0x4')]['ip'],config['asterisk'][_0xf1a0('0x15')]));return Promise[_0xf1a0('0x1b')]()['then'](ami[_0xf1a0('0xd')]())['then'](ami[_0xf1a0('0x1c')]())[_0xf1a0('0x1d')](ami[_0xf1a0('0x1e')]())[_0xf1a0('0x1d')](ami[_0xf1a0('0x10')]())[_0xf1a0('0x1d')](ami[_0xf1a0('0x12')]())['catch'](function(_0x47515e){logger['error'](_0xf1a0('0x1f'),util[_0xf1a0('0xb')](_0x47515e,{'showHidden':![],'depth':null}));});});ami[_0xf1a0('0x16')]('error',error);ami[_0xf1a0('0x16')](_0xf1a0('0x17'),close);module[_0xf1a0('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 671f3f8..f7cf241 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x119c85,_0x268175){var _0x41d288=function(_0x52c0b2){while(--_0x52c0b2){_0x119c85['push'](_0x119c85['shift']());}};_0x41d288(++_0x268175);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 82f50f2..bf8d544 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 _0xfc33=['dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','UserId','[emptyContact][createHistory]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','assign','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','getSettings','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','push','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','resolve','statusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter'];(function(_0x48dcda,_0x32c378){var _0x3fb549=function(_0x3a734e){while(--_0x3a734e){_0x48dcda['push'](_0x48dcda['shift']());}};_0x3fb549(++_0x32c378);}(_0xfc33,0xd2));var _0x3fc3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xfc33[_0x36ed48];return _0x51c63a;};'use strict';var util=require(_0x3fc3('0x0'));var _=require(_0x3fc3('0x1'));var uuid=require(_0x3fc3('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x3fc3('0x3'));var utils=require(_0x3fc3('0x4'));var hopperUtils=require(_0x3fc3('0x5'));var ut=require(_0x3fc3('0x6'));var config=require(_0x3fc3('0x7'));var logger=require(_0x3fc3('0x8'))(_0x3fc3('0x9'));var loggerBooked=require(_0x3fc3('0x8'))(_0x3fc3('0xa'));var loggerPredictive=require(_0x3fc3('0x8'))('predictive');var loggerPredictiveCalls=require(_0x3fc3('0x8'))(_0x3fc3('0xb'));var loggerSyncQueueSummary=require(_0x3fc3('0x8'))('syncQueueSummary');var ami=require(_0x3fc3('0xc'));config[_0x3fc3('0xd')]=_['defaults'](config[_0x3fc3('0xd')],{'host':_0x3fc3('0xe'),'port':0x18eb});var io=require(_0x3fc3('0xf'))(new Redis(config[_0x3fc3('0xd')]));var cmHopper=require(_0x3fc3('0x10'));var voiceQueueRt=require(_0x3fc3('0x11'));var RpcSetting=require(_0x3fc3('0x12'));var Interval=require(_0x3fc3('0x13'));var Action=require(_0x3fc3('0x14'));var History=require('./models/history');var Final=require(_0x3fc3('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x3fc3('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0x3fc3('0x17')][_0x3fc3('0x18')]||_0x3fc3('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3fc3('0x1a')]['enqueue']=function(_0x2fbbc6){this[_0x3fc3('0x1b')]=this['tail']?this[_0x3fc3('0x1b')]['finally'](_0x2fbbc6):_0x2fbbc6();};function Dialer(_0x51080e,_0x54c10f){this[_0x3fc3('0x1c')]=new Sequence();this[_0x3fc3('0x1d')]=_0x54c10f;this['voiceQueues']=_0x51080e[_0x3fc3('0x1e')];this[_0x3fc3('0x1f')]=_0x51080e[_0x3fc3('0x1f')];this[_0x3fc3('0x20')]=_0x51080e['agents'];this[_0x3fc3('0x21')]=_0x51080e[_0x3fc3('0x21')];this[_0x3fc3('0x22')]=config['maxNumberOriginate']||0x2;this[_0x3fc3('0x23')]={};this[_0x3fc3('0x24')]={};this['contactsId']={};this[_0x3fc3('0x25')]={};this[_0x3fc3('0x26')]={};this[_0x3fc3('0x27')]={};this[_0x3fc3('0x28')]={};this[_0x3fc3('0x29')]={};this[_0x3fc3('0x2a')]={};this[_0x3fc3('0x2b')]={};this[_0x3fc3('0x2c')]={};ami['on'](_0x3fc3('0x2d'),this[_0x3fc3('0x2e')][_0x3fc3('0x2f')](this));ami['on']('queuecallerabandon',this[_0x3fc3('0x30')][_0x3fc3('0x2f')](this));ami['on']('originateresponse',this[_0x3fc3('0x31')][_0x3fc3('0x2f')](this));ami['on']('agentcomplete',this[_0x3fc3('0x32')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x33'),this[_0x3fc3('0x34')][_0x3fc3('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0x3fc3('0x35')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x36'),this[_0x3fc3('0x37')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x38'),this[_0x3fc3('0x39')]['bind'](this));ami['on'](_0x3fc3('0x3a'),this[_0x3fc3('0x3b')][_0x3fc3('0x2f')](this));ami['on']('queuemember',this[_0x3fc3('0x3c')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x3d'),this[_0x3fc3('0x3e')][_0x3fc3('0x2f')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x3fc3('0x3f')]()['then'](function(_0x1a29a2){previewRecallmeReminderInterval=_0x1a29a2['previewRecallmeReminderInterval'];});}function isNotNull(_0x354e52){return _0x354e52!==null&&!_[_0x3fc3('0x40')](_0x354e52);}function msgResponse(_0x3e4985,_0x330d9d,_0x326cd2){return{'action':_0x3e4985,'response':_0x330d9d,'message':_0x326cd2,'stack':_0x326cd2};}function emit(_0xd18620,_0x16ffeb,_0x2de34f){io['to'](_0xd18620)['emit'](_0x16ffeb,_0x2de34f);}function emitOutboundVoiceQueueSummary(_0x255467){if(_0x255467[_0x3fc3('0x41')]===_0x3fc3('0x42')){logger[_0x3fc3('0x43')](_0x3fc3('0x44'),util[_0x3fc3('0x45')](_0x255467,{'showHidden':![],'depth':null}));emit(util[_0x3fc3('0x46')](_0x3fc3('0x47'),_0x255467[_0x3fc3('0x48')]),_0x3fc3('0x49'),_0x255467);}}function checkGetDataPredictive(_0x306ae0){if(isNotNull(_0x306ae0)&&!_[_0x3fc3('0x4a')](_0x306ae0)){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x4c'));loggerPredictive['info'](_0x3fc3('0x4d'),_0x306ae0[_0x3fc3('0x4e')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x4f'),_0x306ae0[_0x3fc3('0x50')]);loggerPredictive['info'](_0x3fc3('0x51'),_0x306ae0['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x52'),_0x306ae0[_0x3fc3('0x53')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x54'),_0x306ae0['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3fc3('0x4b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x306ae0[_0x3fc3('0x55')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));if(_0x306ae0[_0x3fc3('0x4e')]>0x0){if(!_[_0x3fc3('0x40')](_0x306ae0['predictiveIntervalAvgTalktime'])&&_0x306ae0[_0x3fc3('0x55')]>0x0){return!![];}loggerPredictive['info'](_0x3fc3('0x57'));if(!_[_0x3fc3('0x40')](_0x306ae0[_0x3fc3('0x58')])&&_0x306ae0[_0x3fc3('0x58')]>0x0){return!![];}loggerPredictive[_0x3fc3('0x4b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x3fc3('0x59'));}}else{loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5a'));}return![];}function mergeDataErlangB(_0x1fb17f){return function(_0x45e437){loggerPredictive[_0x3fc3('0x4b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5b'),_0x45e437[_0x3fc3('0x5c')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5d'),_0x45e437[_0x3fc3('0x5e')]);loggerPredictive[_0x3fc3('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45e437[_0x3fc3('0x5f')]);loggerPredictive['info'](_0x3fc3('0x60'),_0x45e437[_0x3fc3('0x61')]);loggerPredictive[_0x3fc3('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45e437[_0x3fc3('0x5f')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));_['merge'](_0x1fb17f,_0x45e437);};}function ifInterval(_0x1a823b,_0x43fbd2){if(_[_0x3fc3('0x40')](_0x43fbd2)){return![];}return utils[_0x3fc3('0x62')](undefined,_0x43fbd2)<_0x1a823b*0x3c;}function clearPredictiveAttributes(_0x2e14ad){if(_0x2e14ad[_0x3fc3('0x28')]){_0x2e14ad[_0x3fc3('0x28')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],_0x3fc3('0x63'));}if(_0x2e14ad[_0x3fc3('0x27')]){_0x2e14ad[_0x3fc3('0x27')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],'startPredictive\x20value\x20cleared');}if(_0x2e14ad[_0x3fc3('0x64')]){clearInterval(_0x2e14ad[_0x3fc3('0x64')]);_0x2e14ad[_0x3fc3('0x64')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x190b3b,_0x513619){return function(_0x1a61e0){loggerPredictive[_0x3fc3('0x65')](_0x513619[_0x3fc3('0x48')],_0x190b3b);loggerPredictive[_0x3fc3('0x65')](_0x1a61e0['stack']);clearPredictiveAttributes(_0x513619);};}function loggerCatch(_0x192469){return function(_0x4fe942){logger[_0x3fc3('0x65')](_0x192469,util[_0x3fc3('0x45')](_0x4fe942,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xa0f031,_0x1e935d,_0x105b32){return function(_0x374db5){utils[_0x3fc3('0x66')](_0x1e935d,_0x105b32,0x0);_0x1e935d['temp']=0x0;logger[_0x3fc3('0x65')](_0xa0f031,util[_0x3fc3('0x45')](_0x374db5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x547b85){return function(_0x57e968){if(isNotNull(_0x57e968)&&isNotNull(_0x57e968[0x0])){if(_0x57e968[0x0][_0x3fc3('0x67')]>0x0){_0x547b85['message']=utils[_0x3fc3('0x68')][_0x3fc3('0x69')];logger[_0x3fc3('0x4b')](_0x3fc3('0x6a')+_0x547b85[_0x3fc3('0x48')],_0x57e968[0x0][_0x3fc3('0x67')],_0x3fc3('0x6b'));}else{_0x547b85[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x6d')];logger[_0x3fc3('0x4b')](_0x3fc3('0x6e')+_0x547b85[_0x3fc3('0x48')]);}}};}function createObjHistory(_0x12abe5,_0x82fb36,_0x1a0dea,_0x5fdf94,_0x4c2977){_0x12abe5[_0x3fc3('0x6c')]=_0x1a0dea;var _0xaf6783=new Action(_0x12abe5,_0x82fb36);var _0x436caa=new History(_0xaf6783);_0x436caa[_0x3fc3('0x6f')]=_0x5fdf94;_0x436caa[_0x3fc3('0x70')]=_0x4c2977;_0x436caa['endtime']=_0xaf6783[_0x3fc3('0x71')];return _0x436caa;}function unlockQueueStatus(_0x50a53f,_0x2e21e2){setTimeout(function(){if(_['isUndefined'](_0x50a53f[_0x3fc3('0x72')])){loggerBooked[_0x3fc3('0x65')]('[unlockQueueStatus][undefined]',_0x2e21e2);}_0x50a53f[_0x3fc3('0x72')]=!![];loggerBooked[_0x3fc3('0x4b')](_0x3fc3('0x73'),_0x2e21e2,JSON[_0x3fc3('0x74')](_[_0x3fc3('0x75')](_0x50a53f,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x984a42){return function(){if(!isNotNull(_0x984a42[_0x3fc3('0x76')])){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['NULL_INTERVAL'];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}if(!isNotNull(_0x984a42['Interval'][_0x3fc3('0x78')])){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x79')];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}if(!isNotNull(_[_0x3fc3('0x4a')](_0x984a42[_0x3fc3('0x76')][_0x3fc3('0x78')]))){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x79')];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}};}function checkIsIVRCampaignActive(_0x37d456){return function(){if(!utils[_0x3fc3('0x7a')](_0x37d456)){_0x37d456[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x7b')];throw _0x37d456[_0x3fc3('0x48')]+_0x3fc3('0x7c');}};}function emitCampaignSummary(_0x46ca33){if(utils[_0x3fc3('0x7d')](_0x46ca33)){emit(util[_0x3fc3('0x46')](_0x3fc3('0x7e'),_0x46ca33[_0x3fc3('0x48')]),_0x3fc3('0x7f'),_0x46ca33);}}function loggerCatchQueueSummary(_0x9bdd0a,_0x53a8b2){return function(_0x5cdb5c){clearPredictiveAttributes(_0x53a8b2);emitCampaignSummary(_0x53a8b2);loggerSyncQueueSummary['debug'](_0x9bdd0a,util['inspect'](_0x5cdb5c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x39aef2){if(_0x39aef2['sendMessageOneNotActive']){if(_0x39aef2[_0x3fc3('0x80')]===0x0){_0x39aef2[_0x3fc3('0x81')]=![];_0x39aef2[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x3fc3('0x82'),_0x39aef2[_0x3fc3('0x48')],_0x3fc3('0x83'));}else{_0x39aef2[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS'][_0x3fc3('0x84')];loggerSyncQueueSummary[_0x3fc3('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x39aef2[_0x3fc3('0x48')],'is\x20disactive');}emitCampaignSummary(_0x39aef2);}}function myreject(_0x1078c8){return function(_0xadde65){return _0x1078c8(msgResponse(_0x3fc3('0x85'),_0x3fc3('0x86'),JSON[_0x3fc3('0x74')](_0xadde65)));};}Dialer[_0x3fc3('0x1a')][_0x3fc3('0x87')]=function(_0x49dc68){return!_[_0x3fc3('0x40')](_0x49dc68)&&_0x49dc68&&!_['isUndefined'](_0x49dc68[_0x3fc3('0x48')])&&!_[_0x3fc3('0x40')](_0x49dc68[_0x3fc3('0x88')])&&_0x49dc68['active']&&(this[_0x3fc3('0x21')][util[_0x3fc3('0x46')](_0x3fc3('0x89'),_0x49dc68[_0x3fc3('0x48')])]['status']===_0x3fc3('0x8a')||this[_0x3fc3('0x21')][util[_0x3fc3('0x46')](_0x3fc3('0x89'),_0x49dc68['name'])][_0x3fc3('0x8b')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x4d5ce9){var _0x3df1c6=this;return function(){if(!_0x3df1c6[_0x3fc3('0x87')](_0x4d5ce9[_0x3fc3('0x8c')])){if(!_0x3df1c6[_0x3fc3('0x87')](_0x4d5ce9['TrunkBackup'])){_0x4d5ce9[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS'][_0x3fc3('0x8d')];throw _0x4d5ce9[_0x3fc3('0x48')]+_0x3fc3('0x8e');}}};};Dialer['prototype'][_0x3fc3('0x8f')]=function(_0xefc17,_0x300cbe,_0x5ad812,_0x5925f9){var _0x3d9327=this;return function(){var _0xe6bd3e=!![];return _0x3d9327[_0x3fc3('0x90')](_0xefc17,_0x300cbe,_0x5ad812,_0x5925f9,_0xe6bd3e);};};Dialer['prototype'][_0x3fc3('0x91')]=function(_0x116bb5,_0x71f1c3,_0x53c95d,_0x421809){var _0xaf2467=this;return function(){var _0x28de0f=![];return _0xaf2467[_0x3fc3('0x90')](_0x116bb5[_0x3fc3('0x78')],_0x71f1c3,_0x53c95d,_0x421809,_0x28de0f);};};Dialer['prototype']['ifTimeIvr']=function(_0x395036,_0x34985c,_0x2fd1f8,_0x18a6c3,_0x1174f){var _0x38b0ad=[];return new Promise(function(_0x3096de,_0x13dbed){if(!isNotNull(_0x395036)){_0x18a6c3[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x13dbed(msgResponse(_0x3fc3('0x92'),_0x3fc3('0x93'),_0x2fd1f8+_0x3fc3('0x94')));}if(_[_0x3fc3('0x4a')](_0x395036)){_0x18a6c3[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x95')];return _0x13dbed(msgResponse('ifTime',_0x3fc3('0x93'),_0x2fd1f8+_0x3fc3('0x96')));}if(_0x34985c&&_[_0x3fc3('0x40')](config[_0x3fc3('0x97')][_0x34985c])){_0x18a6c3[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x98')];return _0x13dbed(msgResponse(_0x3fc3('0x92'),_0x3fc3('0x93'),_0x2fd1f8+'\x20Timezone\x20unknow\x20'+_0x34985c));}if(_[_0x3fc3('0x99')](_0x395036)){for(var _0x41e8d4=0x0;_0x41e8d4<_0x395036[_0x3fc3('0x9a')];_0x41e8d4+=0x1){_0x38b0ad['push'](ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x9c'),'command':util[_0x3fc3('0x46')](_0x3fc3('0x9d'),_0x395036[_0x41e8d4][_0x3fc3('0x9e')],!_['isUndefined'](config[_0x3fc3('0x97')][_0x34985c])?_0x34985c:'')})[_0x3fc3('0x9f')](function(_0xf413e8){return _0xf413e8[_0x3fc3('0xa0')][_0x3fc3('0xa1')](_0x3fc3('0xa2'))>=0x0;})[_0x3fc3('0xa3')](myreject(_0x13dbed)));}}else{_0x38b0ad['push'](ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x9c'),'command':util[_0x3fc3('0x46')]('iftime\x20%s,%s',_0x395036,!_['isUndefined'](config[_0x3fc3('0x97')][_0x34985c])?_0x34985c:'')})['then'](function(_0x59f613){return _0x59f613[_0x3fc3('0xa0')]['indexOf'](_0x3fc3('0xa2'))>=0x0;})['catch'](myreject(_0x13dbed)));}Promise['all'](_0x38b0ad)[_0x3fc3('0x9f')](function(_0x1128bc){var _0x3b98be=_[_0x3fc3('0xa4')](_0x1128bc);if(_0x3b98be){return _0x3096de(_0x3b98be);}else{_0x18a6c3[_0x3fc3('0x6c')]=_0x1174f?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3fc3('0x68')][_0x3fc3('0xa5')];return _0x13dbed(msgResponse(_0x3fc3('0xa6'),_0x3fc3('0x93'),_0x3fc3('0xa7')+_0x1174f+'\x20'+_0x2fd1f8+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x395036,{'showHidden':![],'depth':null})+_0x3fc3('0xa8')+_0x34985c));}})[_0x3fc3('0xa3')](function(_0x3d5c96){return _0x13dbed(msgResponse('ifTime',_0x3fc3('0x93'),JSON[_0x3fc3('0x74')](_0x3d5c96)));});});};Dialer[_0x3fc3('0x1a')]['loopCampaigns']=function(){var _0x28d96c=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x3fc3('0x9f')](function(){setInterval(function(){_0x28d96c['syncCampaigns']();},0x3e8);});};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xa9')]=function(){var _0x29460d=this;var _0x4c8754;for(var _0x493b07 in this[_0x3fc3('0x1f')]){if(typeof this[_0x3fc3('0x1f')][_0x493b07]!==_0x3fc3('0xaa')){_0x4c8754=this[_0x3fc3('0x1f')][_0x493b07];if(utils[_0x3fc3('0x7d')](_0x4c8754)&&utils['isIVRCampaignActive'](_0x4c8754)){_0x4c8754[_0x3fc3('0x81')]=!![];Promise['resolve']()[_0x3fc3('0x9f')](checkIsIVRCampaignActive(_0x4c8754))[_0x3fc3('0x9f')](checkInterval(_0x4c8754))[_0x3fc3('0x9f')](_0x29460d['checkIsTrunkReachable'](_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0x8f')](_0x4c8754['dialGlobalInterval'],_0x4c8754[_0x3fc3('0xab')],_0x4c8754['name'],_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0x91')](_0x4c8754[_0x3fc3('0x76')],_0x4c8754[_0x3fc3('0xab')],_0x4c8754[_0x3fc3('0x48')],_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0xac')](_0x4c8754))[_0x3fc3('0xa3')](loggerCatchQueueSummary(_0x3fc3('0xad'),_0x4c8754));}else{notSendMessagesCampaign(_0x4c8754);}}}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xae')]=function(_0x123412){if(_0x123412[_0x3fc3('0xaf')]!==_0x3fc3('0xb0')){clearPredictiveAttributes(_0x123412);}switch(_0x123412[_0x3fc3('0xaf')]){case _0x3fc3('0xb1'):this[_0x3fc3('0xb2')](_0x123412,0x1);break;case _0x3fc3('0xb3'):this[_0x3fc3('0xb2')](_0x123412,_0x123412[_0x3fc3('0xb4')]);break;case _0x3fc3('0xb0'):this[_0x3fc3('0xb0')](_0x123412);break;case _0x3fc3('0xa'):this['handlePower'](_0x123412,0x1);break;default:logger[_0x3fc3('0x65')](_0x3fc3('0xb5'),_0x123412[_0x3fc3('0x48')],_0x3fc3('0xb6'));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x92')]=function(_0x52d595,_0xbc1c73){var _0x3fe09a=_0x52d595[_0x3fc3('0xab')];var _0x91df36=_0xbc1c73?_0x52d595[_0x3fc3('0xb7')]:_0x52d595[_0x3fc3('0x76')][_0x3fc3('0x78')];logger[_0x3fc3('0xb8')](_0x3fc3('0xb9'),_0x91df36,_0x3fe09a,_0x52d595[_0x3fc3('0x48')],util['format'](_0x3fc3('0xba'),_0x52d595[_0x3fc3('0x48')],_0x52d595['id']));var _0x5badec=null;return Interval[_0x3fc3('0xbb')](_0x91df36,_0x3fe09a)[_0x3fc3('0x9f')](function(_0x1df017){if(_0x1df017===!![]){return _0x1df017;}else{_0x52d595[_0x3fc3('0x6c')]=_0xbc1c73?utils[_0x3fc3('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3fc3('0x68')][_0x3fc3('0xa5')];_0x5badec=msgResponse(_0x3fc3('0xa6'),'Failure',_0x3fc3('0xa7')+_0xbc1c73+'\x20'+_0x52d595['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3fc3('0x45')](_0x91df36,{'showHidden':![],'depth':null})+_0x3fc3('0xa8')+_0x3fe09a);}if(_0x5badec!==null){logger[_0x3fc3('0xb8')](_0x3fc3('0xbc'),_0x5badec);_0x5badec['isGlobal']=_0xbc1c73;throw _0x5badec;}})[_0x3fc3('0xa3')](function(_0x56fbc7){logger[_0x3fc3('0x65')](_0x3fc3('0xbd'),_0x56fbc7);throw msgResponse(_0x3fc3('0x85'),_0x3fc3('0x86'),util[_0x3fc3('0x45')](_0x56fbc7,{'showHidden':![],'depth':null}));});};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x2e')]=function(_0x51b321){if(this[_0x3fc3('0x1e')][_0x51b321['queue']]){if(this[_0x3fc3('0x25')][_0x51b321[_0x3fc3('0xbe')]]&&this['uniqueId'][_0x51b321[_0x3fc3('0xbe')]][_0x3fc3('0x41')]!==_0x3fc3('0xbf')){this[_0x3fc3('0xc0')](this[_0x3fc3('0x1e')][_0x51b321[_0x3fc3('0xc1')]]);this[_0x3fc3('0x25')][_0x51b321[_0x3fc3('0xbe')]][_0x3fc3('0xc2')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));}}};Dialer[_0x3fc3('0x1a')]['syncAgentComplete']=function(_0x3ba94a){var _0x1d12b7=this[_0x3fc3('0x25')][_0x3ba94a['uniqueid']];if(this['voiceQueues'][_0x3ba94a[_0x3fc3('0xc1')]]){if(_0x1d12b7&&_0x1d12b7[_0x3fc3('0x41')]!=='ivr'){delete this[_0x3fc3('0x25')][_0x3ba94a[_0x3fc3('0xbe')]];this['voiceQueues'][_0x3ba94a['queue']][_0x3fc3('0xc4')]+=0x1;var _0x317b26=new AgentComplete(_0x1d12b7,_0x3ba94a);if(_0x3ba94a[_0x3fc3('0xc5')]===_0x3fc3('0xc6')){_0x317b26[_0x3fc3('0xc7')]=this[_0x3fc3('0x1e')][_0x3ba94a['queue']][_0x3fc3('0xc8')]&&this[_0x3fc3('0x1e')][_0x3ba94a[_0x3fc3('0xc1')]][_0x3fc3('0xc9')]?moment()[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x3fc3('0xca')](_0x317b26)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcb')));hopperUtils[_0x3fc3('0xcc')](_0x317b26)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcd')));}}};Dialer['prototype'][_0x3fc3('0x30')]=function(_0x1443de){var _0x5f28e1=this['uniqueId'][_0x1443de[_0x3fc3('0xbe')]];var _0x200abb=this;var _0x5f533c=![];var _0x4825ba;var _0x373093;if(this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]){if(_0x5f28e1&&_0x5f28e1[_0x3fc3('0x41')]!==_0x3fc3('0xbf')){delete this[_0x3fc3('0x25')][_0x1443de[_0x3fc3('0xbe')]];this['updateOriginated'](this[_0x3fc3('0x1e')][_0x1443de['queue']]);_0x5f28e1[_0x3fc3('0xce')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));var _0x4e811d=new QueueCallerAbandon(_0x5f28e1,_0x1443de);if(utils[_0x3fc3('0x62')](_0x5f28e1['droptime'],_0x5f28e1[_0x3fc3('0xcf')])>=_0x5f28e1[_0x3fc3('0xd0')]){this[_0x3fc3('0x1e')][_0x1443de['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd1')]+=0x1;this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd2')]+=0x1;_0x4e811d['state']=0xa;_0x4e811d[_0x3fc3('0x70')]='Drop';_0x4e811d['dropreason']=_0x3fc3('0xd3');_0x4e811d['agiafterat']=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xc8')]?moment()[_0x3fc3('0x46')](_0x3fc3('0xc3')):undefined;_0x4e811d[_0x3fc3('0xd4')]+=0x1;_0x4e811d[_0x3fc3('0xd5')]+=0x1;_0x4825ba=this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]['dialDropRetryFrequency'];_0x373093=this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xd7')](_0x4e811d,_0x4e811d[_0x3fc3('0x6f')],_0x5f28e1['voiceQueue'])[_0x3fc3('0x9f')](function(_0x4893d4){_0x5f533c=_0x4893d4[_0x3fc3('0xd8')]==0x1;if(_0x4e811d[_0x3fc3('0xd4')]>=_0x200abb['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]]['dialDropMaxRetry']){_0x200abb[_0x3fc3('0xd9')](_0x4e811d,_0x4893d4[_0x3fc3('0xd8')]);}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countdropretry':_0x4e811d['countdropretry'],'scheduledat':moment()[_0x3fc3('0xdb')](_0x200abb[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]['dialDropRetryFrequency'],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x5f28e1[_0x3fc3('0xdd')],'ListId':_0x5f28e1[_0x3fc3('0xde')],'VoiceQueueId':_0x5f28e1[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x5f28e1[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Drop]'));var _0x158c44=new History(_0x4e811d);_0x158c44[_0x3fc3('0x6f')]=0xa;_0x158c44[_0x3fc3('0x70')]=_0x3fc3('0xe1');_0x158c44[_0x3fc3('0x71')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));_0x158c44[_0x3fc3('0xe2')]=_0x158c44[_0x3fc3('0x71')];_0x158c44[_0x3fc3('0xe3')]=_0x4e811d[_0x3fc3('0xe3')];_0x158c44[_0x3fc3('0xe4')]=_0x4e811d[_0x3fc3('0xe4')];hopperUtils[_0x3fc3('0xca')](_0x158c44)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xe5')));}})[_0x3fc3('0x9f')](function(){if(_0x5f533c)hopperUtils[_0x3fc3('0xe6')](_0x4e811d,_0x4825ba,_0x373093)[_0x3fc3('0x9f')](function(){return 0x1;});});}else{this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0x53')]+=0x1;this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xe7')]+=0x1;_0x4e811d['state']=0xb;_0x4e811d[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x4e811d['dropreason']=_0x3fc3('0xe9');_0x4e811d[_0x3fc3('0xea')]+=0x1;_0x4e811d[_0x3fc3('0xd5')]+=0x1;_0x4825ba=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xeb')];_0x373093=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xd7')](_0x4e811d,_0x4e811d[_0x3fc3('0x6f')],_0x5f28e1['voiceQueue'])[_0x3fc3('0x9f')](function(_0xf9a468){if(_0x4e811d[_0x3fc3('0xea')]>=_0x200abb['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xec')]){_0x200abb[_0x3fc3('0xd9')](_0x4e811d,_0xf9a468[_0x3fc3('0xd8')]);}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countabandonedretry':_0x4e811d[_0x3fc3('0xea')],'scheduledat':moment()[_0x3fc3('0xdb')](_0x200abb[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xeb')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x5f28e1[_0x3fc3('0xdd')],'ListId':_0x5f28e1[_0x3fc3('0xde')],'VoiceQueueId':_0x5f28e1[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x5f28e1[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xed')));var _0x275b04=new History(_0x4e811d);_0x275b04[_0x3fc3('0x6f')]=0xb;_0x275b04[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x275b04['starttime']=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));_0x275b04[_0x3fc3('0xe2')]=_0x275b04[_0x3fc3('0x71')];_0x275b04[_0x3fc3('0xe3')]=_0x4e811d[_0x3fc3('0xe3')];_0x275b04['calleridnum']=_0x4e811d[_0x3fc3('0xe4')];hopperUtils[_0x3fc3('0xca')](_0x275b04)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xee')));}})[_0x3fc3('0x9f')](function(){if(_0x5f533c)hopperUtils['swapAdditionalPhones'](_0x4e811d,_0x4825ba,_0x373093)[_0x3fc3('0x9f')](function(){return 0x1;});});}}}};Dialer[_0x3fc3('0x1a')]['syncNewExten']=function(_0x34d0cd){if(this['actions'][_0x34d0cd[_0x3fc3('0xbe')]]){this[_0x3fc3('0x24')][_0x34d0cd['uniqueid']][_0x3fc3('0xef')]=_0x34d0cd[_0x3fc3('0xef')];}if(this['uniqueId'][_0x34d0cd[_0x3fc3('0xbe')]]){this[_0x3fc3('0x25')][_0x34d0cd[_0x3fc3('0xbe')]][_0x3fc3('0xef')]=_0x34d0cd[_0x3fc3('0xef')];}};Dialer[_0x3fc3('0x1a')]['syncQueueMember']=function(_0x15b986){if(!this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]){return;}var _0x552116=this[_0x3fc3('0x1e')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xf1')]||_0x3fc3('0xf2');if(_0x552116===_0x3fc3('0xf3')){if(this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]&&_[_0x3fc3('0xf4')](this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['locked'])&&_0x15b986[_0x3fc3('0x8b')]==='1'&&_0x15b986[_0x3fc3('0xf5')]==='0'){if(this[_0x3fc3('0x20')][_0x15b986['stateinterface']]){if(!this[_0x3fc3('0x20')][_0x15b986[_0x3fc3('0xf6')]][_0x3fc3('0xf7')]){this[_0x3fc3('0x20')][_0x15b986[_0x3fc3('0xf6')]][_0x3fc3('0xf7')]=!![];this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['locked']=!![];this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xf6')]=_0x15b986[_0x3fc3('0xf6')];}}}}else if(_0x552116==='rrmemory'){if(this[_0x3fc3('0x24')][_0x15b986['actionid']]){if(this['agents'][_0x15b986['stateinterface']]){this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xf6')]=_0x15b986[_0x3fc3('0xf6')];if(_[_0x3fc3('0xf4')](this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['queue']])){this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['queue']]=[];}this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xf8')](_['merge'](_['pick'](this[_0x3fc3('0x24')][_0x15b986['actionid']],[_0x3fc3('0xf9'),_0x3fc3('0xf6')]),{'status':_0x15b986[_0x3fc3('0x8b')],'paused':_0x15b986[_0x3fc3('0xf5')]}));}}}};Dialer[_0x3fc3('0x1a')]['syncQueueStatusComplete']=function(_0x194a2c){if(!this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]){return;}var _0x5192f0=this;var _0x2b1855=this['voiceQueues'][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]];var _0x4d9fca=_0x2b1855['strategy']||_0x3fc3('0xf2');if(_0x4d9fca===_0x3fc3('0xf3')){if(this[_0x3fc3('0x24')][_0x194a2c['actionid']]&&this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['stateinterface']){this[_0x3fc3('0x1d')][_0x3fc3('0xfa')](this['actions'][_0x194a2c['actionid']][_0x3fc3('0xf9')],this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xf6')])[_0x3fc3('0xa3')](function(_0x4bc226){logger[_0x3fc3('0x65')](_0x3fc3('0xfb'),util[_0x3fc3('0x45')](_0x4bc226,{'showHidden':![],'depth':null}));})[_0x3fc3('0xfc')](function(){_0x5192f0[_0x3fc3('0xc0')](_0x5192f0[_0x3fc3('0x1e')][_0x5192f0['actions'][_0x194a2c[_0x3fc3('0xf0')]]['queue']]);_0x5192f0[_0x3fc3('0x20')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c['actionid']]['stateinterface']]['locked']=![];delete _0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]];unlockQueueStatus(_0x2b1855);});}else{this['updateOriginated'](this[_0x3fc3('0x1e')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']]);hopperUtils[_0x3fc3('0xda')]({'active':![],'ContactId':this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xdd')],'ListId':this[_0x3fc3('0x24')][_0x194a2c['actionid']][_0x3fc3('0xde')],'VoiceQueueId':this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xdf')]||undefined,'CampaignId':this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xe0')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]];unlockQueueStatus(_0x2b1855);}}else if(_0x4d9fca===_0x3fc3('0xf2')){var _0x2b86ae;if(this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]&&!_[_0x3fc3('0x4a')](this[_0x3fc3('0x2a')][this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]])){if(this[_0x3fc3('0x2b')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]]){this[_0x3fc3('0x2b')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']]=this[_0x3fc3('0x2b')][this['actions'][_0x194a2c['actionid']][_0x3fc3('0xc1')]]?this['queueBookedRR'][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]]:this[_0x3fc3('0x2a')][this['actions'][_0x194a2c['actionid']][_0x3fc3('0xc1')]]?this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x194a2c['actionid']][_0x3fc3('0xc1')]]['_rr']||0x0:0x0;}this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xfd')]=this[_0x3fc3('0x2b')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']];for(var _0x52445a=0x0;_0x52445a=_0x6b8036[_0x3fc3('0x125')]){_0x329003[_0x3fc3('0x126')](_0xffe864,_0x561d16,_0x2b77a1,_0x3fc3('0x127'));}else{if(_0xffe864[_0x3fc3('0x11e')]>=_0x6b8036[_0x3fc3('0x128')]){_0x329003[_0x3fc3('0x129')](_0xffe864,_0x561d16,_0x2b77a1,_0x3fc3('0x12a'));}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countmachineretry':_0xffe864[_0x3fc3('0x11e')],'scheduledat':moment()[_0x3fc3('0xdb')](_0x6b8036['dialMachineRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xffe864['ContactId'],'ListId':_0xffe864[_0x3fc3('0xde')],'VoiceQueueId':_0xffe864[_0x3fc3('0xdf')]||undefined,'CampaignId':_0xffe864[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x561d16({'reschedule':0x1});}}});}if(_0x58f6b1[_0x3fc3('0x41')]===_0x3fc3('0xbf')&&this['campaigns'][_0x58f6b1[_0x3fc3('0xc1')]]['dialAMDActive']&&_0xdc1c03[_0x3fc3('0x110')]===_0x3fc3('0x111')){delete this['uniqueId'][_0xdc1c03['uniqueid']];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]]);_0x50bd8b=new Hangup(_0x58f6b1,_0xdc1c03);_0x50bd8b[_0x3fc3('0x6f')]=0x12;_0x50bd8b['statedesc']=_0x3fc3('0x113');_0x50bd8b[_0x3fc3('0x114')]='AMD';ami[_0x3fc3('0x116')](_0x3fc3('0x117'),ut['buildObj'](_0x50bd8b,_0x3fc3('0x118')));this[_0x3fc3('0x119')](_0x50bd8b,_0x3fc3('0x12b'),_0x3fc3('0x12c'));}if(_0x58f6b1[_0x3fc3('0x41')]===_0x3fc3('0xbf')&&this[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0x10f')]&&_0xdc1c03['value']===_0x3fc3('0x11c')){return new Promise(function(_0x65e61b,_0x424bb5){delete _0x329003[_0x3fc3('0x25')][_0xdc1c03[_0x3fc3('0xbe')]];_0x329003[_0x3fc3('0xc0')](_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]]);_0x329003['campaigns'][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0xc4')]+=0x1;_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0x112')]+=0x1;var _0x1f2b9e=_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]];var _0x58dc5e=new Hangup(_0x58f6b1,_0xdc1c03);_0x58dc5e[_0x3fc3('0x6f')]=0x13;_0x58dc5e[_0x3fc3('0x70')]='Machine';_0x58dc5e['membername']=_0x3fc3('0x115');_0x58dc5e[_0x3fc3('0x11e')]+=0x1;_0x58dc5e[_0x3fc3('0xd5')]+=0x1;_0x58dc5e[_0x3fc3('0x118')]=!![];ami[_0x3fc3('0x116')](_0x3fc3('0x117'),ut[_0x3fc3('0x11f')](_0x58dc5e,_0x3fc3('0x118')));hopperUtils['createHistory'](_0x58dc5e)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x120')));if(_0x58dc5e['countbusyretry']+_0x58dc5e[_0x3fc3('0x122')]+_0x58dc5e[_0x3fc3('0x12d')]+_0x58dc5e[_0x3fc3('0x123')]+_0x58dc5e[_0x3fc3('0xd4')]+_0x58dc5e[_0x3fc3('0xea')]+_0x58dc5e[_0x3fc3('0x11e')]+_0x58dc5e[_0x3fc3('0x124')]>=_0x1f2b9e['dialGlobalMaxRetry']){_0x329003[_0x3fc3('0x126')](_0x58dc5e,_0x65e61b,_0x424bb5,'reason19\x20machine....');}else{if(_0x58dc5e[_0x3fc3('0x11e')]>=_0x1f2b9e[_0x3fc3('0x128')]){_0x329003[_0x3fc3('0x129')](_0x58dc5e,_0x65e61b,_0x424bb5,_0x3fc3('0x12a'));}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countmachineretry':_0x58dc5e[_0x3fc3('0x11e')],'scheduledat':moment()['add'](_0x1f2b9e[_0x3fc3('0x12e')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x58dc5e['ContactId'],'ListId':_0x58dc5e[_0x3fc3('0xde')],'VoiceQueueId':_0x58dc5e[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x58dc5e['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x12f')));_0x65e61b({'reschedule':0x1});}}});}}};Dialer[_0x3fc3('0x1a')]['syncHangup']=function(_0x429137){var _0x51ac83=this['uniqueId'][_0x429137[_0x3fc3('0xbe')]];var _0x56b742;if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]==='ivr'){delete this[_0x3fc3('0x25')][_0x429137[_0x3fc3('0xbe')]];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1f')][_0x51ac83[_0x3fc3('0xc1')]]);this[_0x3fc3('0x1f')][_0x51ac83['queue']][_0x3fc3('0x130')]+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);hopperUtils['createHistory'](_0x56b742)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x131')));hopperUtils[_0x3fc3('0xcc')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x132')));}if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]!=='ivr'&&isNotNull(this[_0x3fc3('0x1e')][_0x51ac83['queue']][_0x3fc3('0x133')])){delete this['uniqueId'][_0x429137[_0x3fc3('0xbe')]];this['updateOriginated'](this[_0x3fc3('0x1e')][_0x51ac83['queue']]);this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0xc4')]+=0x1;this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);_0x56b742['state']=0x10;_0x56b742['statedesc']=_0x3fc3('0x134');_0x56b742[_0x3fc3('0x114')]=_0x3fc3('0x135');hopperUtils[_0x3fc3('0xca')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x131')));hopperUtils[_0x3fc3('0xcc')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x132')));}if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]!==_0x3fc3('0xbf')&&!isNotNull(this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0x133')])){delete this[_0x3fc3('0x25')][_0x429137['uniqueid']];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]]);this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0x136')]+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);_0x56b742[_0x3fc3('0x6f')]=0xc;_0x56b742[_0x3fc3('0x70')]=_0x429137[_0x3fc3('0x137')];_0x56b742[_0x3fc3('0x114')]=_0x3fc3('0x138');hopperUtils[_0x3fc3('0xca')](_0x56b742)[_0x3fc3('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x56b742)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x132')));}};Dialer['prototype'][_0x3fc3('0x34')]=function(_0x419d97){var _0x5d1b60=this;if(!_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]){_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]={'running':![]};}else if(_0x5d1b60[_0x3fc3('0x2c')][_0x419d97[_0x3fc3('0x48')]][_0x3fc3('0x139')]===!![]){return;}else if(_0x5d1b60['queuesSummary'][_0x419d97[_0x3fc3('0x48')]][_0x3fc3('0x139')]===![]){_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]['running']=!![];}var _0xf6f499=_0x5d1b60['voiceQueues'][_0x419d97[_0x3fc3('0x48')]];var _0x2f838c=_0xf6f499[_0x3fc3('0x6c')]!==utils['CAMPAIGN_STATUS'][_0x3fc3('0x7b')];var _0x47c3e7=utils[_0x3fc3('0x13a')](_0xf6f499);_0xf6f499['statusMessage']=utils[_0x3fc3('0x13b')](_0xf6f499,_0x5d1b60['trunks']);Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](function(){if(_0xf6f499[_0x3fc3('0x13d')]===utils[_0x3fc3('0x68')][_0x3fc3('0x7b')]){if(_0x2f838c){clearPredictiveAttributes(_0xf6f499);_0x419d97[_0x3fc3('0x27')]=undefined;_0x419d97['startProgressive']=undefined;}if(_0xf6f499[_0x3fc3('0x13d')]===utils[_0x3fc3('0x68')][_0x3fc3('0x7b')]){_0x419d97[_0x3fc3('0x13e')]=0x0;_0x419d97['paused']=0x0;_0x419d97[_0x3fc3('0x13f')]=0x0;_0x419d97['talking']=0x0;_0x419d97['pTalking']=0x0;}}else if(_0xf6f499['statusMessage']===utils['CAMPAIGN_STATUS'][_0x3fc3('0x140')]&&!_0x47c3e7){return _0x5d1b60[_0x3fc3('0x92')](_0xf6f499,!![])['then'](function(){return _0x5d1b60[_0x3fc3('0x92')](_0xf6f499,![]);})[_0x3fc3('0x9f')](function(){return _0x5d1b60[_0x3fc3('0xae')](_0xf6f499);})['catch'](function(_0x50ffbf){loggerSyncQueueSummary[_0x3fc3('0x43')](_0x3fc3('0x141'),util[_0x3fc3('0x45')](_0x50ffbf,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xf6f499);});}else{clearPredictiveAttributes(_0xf6f499);}})[_0x3fc3('0x9f')](function(){var _0x488f8a=_0x419d97[_0x3fc3('0x142')](_0xf6f499);if(_0x488f8a||_0xf6f499[_0x3fc3('0x143')]){_0xf6f499[_0x3fc3('0x143')]=![];_0x419d97[_0x3fc3('0x144')](_0xf6f499);Object['assign'](_0xf6f499,_0x419d97);emitOutboundVoiceQueueSummary(_0x419d97);}_0x5d1b60['queuesSummary'][_0xf6f499['name']][_0x3fc3('0x139')]=![];})[_0x3fc3('0xa3')](function(_0x108102){logger[_0x3fc3('0x65')](_0x3fc3('0x141'),util['inspect'](_0x108102,{'showHidden':![],'depth':null}));_0x5d1b60[_0x3fc3('0x2c')][_0xf6f499[_0x3fc3('0x48')]][_0x3fc3('0x139')]=![];});};Dialer['prototype'][_0x3fc3('0x35')]=_[_0x3fc3('0x145')](function(){var _0x30b42d=_[_0x3fc3('0x146')](this['voiceQueues'],function(_0x170592){return _0x170592[_0x3fc3('0x147')];});var _0x18c2e5=_[_0x3fc3('0x146')](this['agents'],function(_0x4ef2c4){return _0x4ef2c4['online']&&_0x4ef2c4[_0x3fc3('0x8b')]===_0x3fc3('0x8a');});if(_0x30b42d['length']>0x0&&_0x18c2e5['length']>0x0){return Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](cmHopper[_0x3fc3('0x148')](_[_0x3fc3('0x149')](_0x30b42d,'id'),previewRecallmeReminderInterval,_[_0x3fc3('0x149')](_0x18c2e5,'id')))[_0x3fc3('0x9f')](function(_0x351df3){for(var _0x220645=0x0;_0x220645<_0x351df3[_0x3fc3('0x9a')];_0x220645++){var _0x4fb9a8=_0x351df3[_0x220645][_0x3fc3('0x14a')]['name'];if(_0x4fb9a8)io['to'](util[_0x3fc3('0x46')](_0x3fc3('0x14b'),_0x4fb9a8))[_0x3fc3('0x116')](_0x3fc3('0x14c'),{'hopper':_0x351df3[_0x220645]});}})[_0x3fc3('0xa3')](function(_0x5485f5){logger['error'](_0x3fc3('0x14d'),_0x5485f5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14e')]=function(){var _0x40fbdb=this;setInterval(function(){_0x40fbdb[_0x3fc3('0x14f')](_0x40fbdb[_0x3fc3('0x25')],_0x3fc3('0x150'));_0x40fbdb[_0x3fc3('0x14f')](_0x40fbdb[_0x3fc3('0x24')],'[actions]');},0x32c8);};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14f')]=function(_0xeb3cba,_0x49711f){var _0x3f70d9=this;for(var _0x5e189b in _0xeb3cba){if(typeof _0xeb3cba[_0x5e189b]!==_0x3fc3('0xaa')){this[_0x3fc3('0x1c')]['enqueue'](function(){if(!_[_0x3fc3('0xf4')](_0xeb3cba[_0x5e189b])){return ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x8b'),'channel':_0xeb3cba[_0x5e189b][_0x3fc3('0xef')]})[_0x3fc3('0xa3')](function(_0x47ebb7){if(_0x47ebb7[_0x3fc3('0x6c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xeb3cba[_0x5e189b]&&_0xeb3cba[_0x5e189b]['type']!==_0x3fc3('0xbf')){_0x3f70d9[_0x3fc3('0xc0')](_0x3f70d9[_0x3fc3('0x1e')][_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]]);logger[_0x3fc3('0x65')](_0x3fc3('0x151'),_0x49711f,_0x5e189b,_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]);delete _0xeb3cba[_0x5e189b];}if(_0xeb3cba[_0x5e189b]&&_0xeb3cba[_0x5e189b][_0x3fc3('0x41')]==='ivr'){_0x3f70d9[_0x3fc3('0xc0')](_0x3f70d9[_0x3fc3('0x1f')][_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]]);logger['error'](_0x3fc3('0x152'),_0x49711f,_0x5e189b,_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]);delete _0xeb3cba[_0x5e189b];}},0x2328);}});}});}}};Dialer['prototype'][_0x3fc3('0x153')]=function(_0x2da6b6){return Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2da6b6))[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x154')));};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xc0')]=function(_0x3b81ce){if(!_[_0x3fc3('0x40')](_0x3b81ce)&&_0x3b81ce!==null){if(typeof _0x3b81ce['originated']!=='undefined'){if(_0x3b81ce[_0x3fc3('0x80')]>0x0){_0x3b81ce[_0x3fc3('0x80')]-=0x1;}else{logger[_0x3fc3('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3fc3('0x65')](_0x3fc3('0x155'));}};Dialer['prototype'][_0x3fc3('0x156')]=function(_0x2d8eed,_0xdacde2){var _0x563b2d=this;return function(_0xe09033){_0x563b2d['updateOriginated'](_0xdacde2);logger[_0x3fc3('0x65')](_0x2d8eed,util[_0x3fc3('0x45')](_0xe09033,{'showHidden':![],'depth':null}));};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x157')]=function(_0x4db501,_0x1641dc,_0x18e333){var _0x327614={'state':0x19,'statedesc':_0x3fc3('0x158')};this[_0x3fc3('0xc0')](_0x1641dc);this['saveInDb'](_[_0x3fc3('0x159')](_0x327614,_[_0x3fc3('0x75')](_0x18e333,[_0x3fc3('0xdd'),_0x3fc3('0xde'),_0x3fc3('0x15a'),_0x3fc3('0xdf'),_0x3fc3('0xe0')])),_0x3fc3('0x15b'),'[emptyContact]');logger[_0x3fc3('0x65')](_0x4db501);};Dialer['prototype'][_0x3fc3('0x119')]=function(_0x4da77a,_0x428593,_0x1e281c){hopperUtils['createHistory'](_0x4da77a)[_0x3fc3('0xa3')](loggerCatch(_0x428593));hopperUtils['moveContactManagedDialer'](_0x4da77a)[_0x3fc3('0xa3')](loggerCatch(_0x1e281c));};Dialer[_0x3fc3('0x1a')]['queueCallerAbandonCreateState']=function(_0x279a81,_0xce881d){hopperUtils[_0x3fc3('0xca')](_0x279a81)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcb')));if(_0xce881d==0x0){hopperUtils['moveContactManagedDialer'](_0x279a81)[_0x3fc3('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14d')]=function(_0x4b32af){return Promise[_0x3fc3('0x13c')]()['then'](cmHopper[_0x3fc3('0x148')](_0x4b32af['id'],previewRecallmeReminderInterval))['then'](function(_0x2736ba){for(var _0x168c9f=0x0;_0x168c9f<_0x2736ba[_0x3fc3('0x9a')];_0x168c9f++){var _0x26b625=_0x2736ba[_0x168c9f][_0x3fc3('0x14a')]['name'];if(_0x26b625)io['to'](util['format'](_0x3fc3('0x14b'),_0x26b625))[_0x3fc3('0x116')]('user:dialPreviewRecallReminder',{'hopper':_0x2736ba[_0x168c9f]});}})['catch'](function(){});};Dialer[_0x3fc3('0x1a')]['launchHandleIvr']=function(_0x1cd4dc){var _0x3ff05a=this;return function(){_0x3ff05a[_0x3fc3('0x15c')](_0x1cd4dc);};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x15d')]=function(_0x146451,_0x161cb6){var _0x3049cb=this;var _0x1b85bd=uuid['v4']();this[_0x3fc3('0x24')][_0x1b85bd]=new Action(_0x146451,_0x161cb6,_0x1b85bd);return new Promise(function(_0x11e281,_0x10117b){if(_['isUndefined'](_0x146451)&&typeof _0x146451!==_0x3fc3('0x15e')){return _0x10117b(msgResponse('originate',_0x3fc3('0x93'),_0x3fc3('0x15f')));}if(_[_0x3fc3('0x40')](_0x161cb6['phone'])||_0x161cb6['phone']===null){return _0x10117b(msgResponse(_0x3fc3('0x160'),_0x3fc3('0x93'),_0x3fc3('0x161')));}var _0x248ade={'XMD-CALLERID':_0x3049cb['actions'][_0x1b85bd][_0x3fc3('0x162')](),'XMD-AGI':_0x146451[_0x3fc3('0x133')]?util[_0x3fc3('0x46')](_0x3fc3('0x163'),ipAgi,_0x146451[_0x3fc3('0x133')]):_0x3fc3('0x164'),'XMD-AGIAFTER':_0x146451[_0x3fc3('0xc8')]?util['format'](_0x3fc3('0x163'),ipAgi,_0x146451['dialQueueProject2']):_0x3fc3('0x164'),'XMD-QUEUE':utils[_0x3fc3('0x165')](_0x146451)?util[_0x3fc3('0x46')]('\x22%s,%s%s,,,%s\x22',_0x146451[_0x3fc3('0x48')],_0x146451['dialQueueOptions']||'',_0x146451['dialAgiAfterHangupAgent']?'c':'',_0x146451[_0x3fc3('0xd0')]||0x3):_0x3fc3('0x164'),'XMD-CONTACTID':_0x161cb6['ContactId'],'XMD-CDRTYPE':_0x3fc3('0x9'),'CALLERID(all)':_0x3049cb[_0x3fc3('0x24')][_0x1b85bd][_0x3fc3('0x162')](),'XMD-AMD':_0x146451[_0x3fc3('0x10f')]?_0x3fc3('0x140'):_0x3fc3('0x164'),'XMD-DESTINATION':_0x3fc3('0x166')};if(_0x146451[_0x3fc3('0x10f')]){_0x248ade[_0x3fc3('0x167')]=_0x146451['dialAMDInitialSilence']||0x9c4;_0x248ade['XMD-AMDGREETING']=_0x146451[_0x3fc3('0x168')]||0x5dc;_0x248ade[_0x3fc3('0x169')]=_0x146451[_0x3fc3('0x16a')]||0x320;_0x248ade['XMD-AMDTOTALANALYSISTIME']=_0x146451[_0x3fc3('0x16b')]||0x1388;_0x248ade[_0x3fc3('0x16c')]=_0x146451[_0x3fc3('0x16d')]||0x64;_0x248ade[_0x3fc3('0x16e')]=_0x146451[_0x3fc3('0x16f')]||0x32;_0x248ade[_0x3fc3('0x170')]=_0x146451['dialAMDMaximumNumberOfWords']||0x3;_0x248ade['XMD-AMDSILENCETHRESHOLD']=_0x146451['dialAMDSilenceThreshold']||0x100;_0x248ade['XMD-AMDMAXIMUMWORDLENGTH']=_0x146451[_0x3fc3('0x171')]||0x1388;}if(utils[_0x3fc3('0x165')](_0x146451)){_0x248ade[_0x3fc3('0x172')]=_0x161cb6[_0x3fc3('0xdf')];}else{_0x248ade['XMD-CAMPAIGNID']=_0x161cb6[_0x3fc3('0xe0')];}var _0x343416=utils[_0x3fc3('0x173')](_0x161cb6[_0x3fc3('0x174')]);Object[_0x3fc3('0x175')](_0x248ade,_0x343416);var _0x16204f=_0x3049cb[_0x3fc3('0x87')](_0x146451[_0x3fc3('0x8c')])?utils[_0x3fc3('0x176')](_0x146451[_0x3fc3('0x8c')]['callerid'],_0x146451[_0x3fc3('0x177')],_0x146451[_0x3fc3('0x178')]>0x0?utils[_0x3fc3('0x179')](_0x146451[_0x3fc3('0x17a')],_0x146451[_0x3fc3('0x178')]):_0x146451[_0x3fc3('0x17a')]):utils[_0x3fc3('0x176')](_[_0x3fc3('0xf4')](_0x146451[_0x3fc3('0x17b')])?_0x146451[_0x3fc3('0x8c')][_0x3fc3('0x17c')]:_0x146451[_0x3fc3('0x17b')][_0x3fc3('0x17c')],_0x146451['dialOriginateCallerIdName'],_0x146451['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x3fc3('0x179')](_0x146451[_0x3fc3('0x17a')],_0x146451['dialRandomLastDigitCallerIdNumber']):_0x146451[_0x3fc3('0x17a')]);if(_0x16204f){_0x248ade[_0x3fc3('0x17d')]=_0x3049cb[_0x3fc3('0x24')][_0x1b85bd][_0x3fc3('0x17e')]=utils[_0x3fc3('0x17f')](_0x16204f);_0x248ade[_0x3fc3('0x180')]=_0x161cb6[_0x3fc3('0x181')];}_0x146451[_0x3fc3('0x182')]=_0x248ade;return ami[_0x3fc3('0x9b')]({'actionid':_0x1b85bd,'action':_0x3fc3('0x160'),'channel':_0x3049cb['isTrunkReachable'](_0x146451[_0x3fc3('0x8c')])?util['format'](_0x3fc3('0x183'),_0x146451[_0x3fc3('0x8c')]['name'],isNotNull(_0x146451[_0x3fc3('0x184')])?_0x146451[_0x3fc3('0x184')][_0x3fc3('0x185')]()||'':'',_0x146451[_0x3fc3('0x186')]>0x0?_0x161cb6['phone']['substring'](_0x146451['dialCutDigit']):_0x161cb6[_0x3fc3('0x181')]):util[_0x3fc3('0x46')]('SIP/%s/%s%s',_[_0x3fc3('0xf4')](_0x146451[_0x3fc3('0x17b')])?_0x146451['Trunk'][_0x3fc3('0x48')]:_0x146451['TrunkBackup'][_0x3fc3('0x48')],isNotNull(_0x146451[_0x3fc3('0x184')])?_0x146451['dialPrefix'][_0x3fc3('0x185')]()||'':'',_0x146451[_0x3fc3('0x186')]>0x0?_0x161cb6[_0x3fc3('0x181')]['substring'](_0x146451[_0x3fc3('0x186')]):_0x161cb6[_0x3fc3('0x181')]),'callerid':_0x16204f,'Exten':'xcally-motion-dialer','Context':_0x3fc3('0x187'),'Priority':'1','variable':_0x248ade,'timeout':(_0x146451[_0x3fc3('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b85bd})[_0x3fc3('0x9f')](function(_0x38b28c){return _0x11e281(_0x38b28c);})[_0x3fc3('0xa3')](function(_0x4c3aa8){_0x146451[_0x3fc3('0x189')]+=0x1;var _0x3c19e7=new History(_0x3049cb['actions'][_0x1b85bd]);logger['error'](util[_0x3fc3('0x46')](_0x3fc3('0x18a'),JSON['stringify'](_0x4c3aa8)));_0x3c19e7[_0x3fc3('0x6f')]=0xe;_0x3c19e7[_0x3fc3('0x70')]='OriginateError';_0x3c19e7[_0x3fc3('0x71')]=moment()['format'](_0x3fc3('0xc3'));_0x3c19e7[_0x3fc3('0xe2')]=_0x3c19e7[_0x3fc3('0x71')];hopperUtils[_0x3fc3('0xca')](_0x3c19e7)['catch'](loggerCatch(_0x3fc3('0x18b')));_0x3049cb[_0x3fc3('0xcc')](_0x3c19e7)[_0x3fc3('0xa3')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3049cb['actions'][_0x1b85bd];return _0x10117b(msgResponse(_0x3fc3('0x160'),_0x3fc3('0x86'),_0x3fc3('0x18c')));});});});};Dialer['prototype'][_0x3fc3('0x18d')]=function(_0xe49628,_0x53ce2a,_0x1f18ff){var _0x27eeb9=new History(_0x53ce2a);if(_0x27eeb9['countbusyretry']+_0x27eeb9['countcongestionretry']+_0x27eeb9[_0x3fc3('0x12d')]+_0x27eeb9[_0x3fc3('0x123')]+_0x27eeb9[_0x3fc3('0xd4')]+_0x27eeb9[_0x3fc3('0xea')]+_0x27eeb9[_0x3fc3('0x11e')]+_0x27eeb9[_0x3fc3('0x124')]>=_0x1f18ff[_0x3fc3('0x125')]-0x1){return!![];}switch(_0xe49628){case 0x3:if(_0x27eeb9[_0x3fc3('0x12d')]>=_0x1f18ff[_0x3fc3('0x18e')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countnoanswerretry':_0x27eeb9[_0x3fc3('0x12d')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialNoAnswerRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x27eeb9[_0x3fc3('0x121')]>=_0x1f18ff['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x27eeb9['countbusyretry']+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialBusyRetryFrequency'],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x27eeb9[_0x3fc3('0x122')]>=_0x1f18ff[_0x3fc3('0x18f')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countcongestionretry':_0x27eeb9[_0x3fc3('0x122')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x190')],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x191')));break;case 0x0:if(_0x27eeb9[_0x3fc3('0x123')]>=_0x1f18ff[_0x3fc3('0x192')]-0x1){return!![];}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countnosuchnumberretry':_0x27eeb9[_0x3fc3('0x123')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x193')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x27eeb9[_0x3fc3('0xd4')]>=_0x1f18ff[_0x3fc3('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x27eeb9[_0x3fc3('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x1f18ff[_0x3fc3('0x195')],'minutes')[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9['ListId'],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x27eeb9[_0x3fc3('0xea')]>=_0x1f18ff[_0x3fc3('0xec')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countabandonedretry':_0x27eeb9[_0x3fc3('0xea')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialAbandonedRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x27eeb9['ContactId'],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9['VoiceQueueId']||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xed')));break;case 0x13:if(_0x27eeb9[_0x3fc3('0x11e')]>=_0x1f18ff[_0x3fc3('0x128')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x27eeb9[_0x3fc3('0x11e')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x12e')],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9['ContactId'],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x12f')));break;case 0x14:if(_0x27eeb9[_0x3fc3('0x124')]>=_0x1f18ff['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countagentrejectretry':_0x27eeb9[_0x3fc3('0x124')]+=0x1,'scheduledat':moment()['add'](_0x1f18ff[_0x3fc3('0x196')],'minutes')[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x10a')]=function(_0x22f790,_0x5f3cdc,_0x57141c){var _0x277dcd=this;var _0x46bd51=new History(_0x22f790);var _0x5d4d38=![];var _0x525b5d;var _0x288647;return new Promise(function(_0x47b404,_0x200386){if(_[_0x3fc3('0x40')](_0x5f3cdc)&&typeof _0x5f3cdc!==_0x3fc3('0x15e')){return _0x200386(msgResponse(_0x3fc3('0x197'),_0x3fc3('0x93'),_0x3fc3('0x198')));}if(_['isUndefined'](_0x57141c)&&typeof _0x57141c!=='object'){return _0x200386(msgResponse('[callProgressDetecting]',_0x3fc3('0x93'),_0x3fc3('0x199')));}hopperUtils[_0x3fc3('0xd7')](_0x46bd51,_0x57141c[_0x3fc3('0xc5')],_0x5f3cdc)[_0x3fc3('0x9f')](function(_0x440a6c){if(_0x440a6c['additional']==0x1)_0x5d4d38=!![];switch(_0x57141c[_0x3fc3('0xc5')]){case'0':_0x5f3cdc[_0x3fc3('0x19a')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x0;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x19b');_0x46bd51[_0x3fc3('0x123')]+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;ami[_0x3fc3('0x116')](_0x3fc3('0x19c'),ut['buildObj'](_0x22f790,_0x3fc3('0x19d')));_0x525b5d=_0x5f3cdc[_0x3fc3('0x193')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x120')));if(_0x277dcd[_0x3fc3('0x18d')](0x0,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x123')]>=_0x5f3cdc[_0x3fc3('0x192')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,'reason\x200\x20no\x20such\x20number....');}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x19e'));}}break;case'3':_0x5f3cdc[_0x3fc3('0x19f')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x3;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1a0');_0x46bd51['countnoanswerretry']+=0x1;_0x46bd51['countglobal']+=0x1;var _0x3009b0=ut['buildNoAnswerEventPayload'](_0x22f790,_0x5f3cdc);ami[_0x3fc3('0x116')]('custom:agentnoanswer',_0x3009b0);_0x525b5d=_0x5f3cdc[_0x3fc3('0x1a1')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1a2')));if(_0x277dcd[_0x3fc3('0x18d')](0x3,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x12d')]>=_0x5f3cdc[_0x3fc3('0x18e')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1a3'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1a3'));}}break;case'5':_0x5f3cdc[_0x3fc3('0x1a4')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x5;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1a5');_0x46bd51['countbusyretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;ami[_0x3fc3('0x116')](_0x3fc3('0x1a6'),ut[_0x3fc3('0x11f')](_0x22f790,_0x3fc3('0x1a7')));_0x525b5d=_0x5f3cdc[_0x3fc3('0x1a8')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1a9')));if(_0x277dcd[_0x3fc3('0x18d')](0x5,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x121')]>=_0x5f3cdc[_0x3fc3('0x1aa')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1ab'));}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1ab'));}}break;case'8':_0x5f3cdc[_0x3fc3('0x1ac')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x8;_0x46bd51['statedesc']='Congestion';_0x46bd51['countcongestionretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc[_0x3fc3('0x190')];_0x288647=_0x5f3cdc['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x22f790,_0x3fc3('0x1ad')));hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1ae')));if(_0x277dcd[_0x3fc3('0x18d')](0x8,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x122')]>=_0x5f3cdc[_0x3fc3('0x18f')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1af'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1af'));}}break;case'11':_0x5f3cdc['outboundAbandonedCallsDay']+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0xb;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x46bd51[_0x3fc3('0xea')]+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc['dialAbandonedRetryFrequency'];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xee')));if(_0x277dcd['checkRetriveMax'](0xb,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countabandonedretry']>=_0x5f3cdc[_0x3fc3('0xec')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b0'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,'reason\x2011\x20abandoned');}}break;case'20':_0x5f3cdc[_0x3fc3('0x1b1')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x14;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1b2');_0x46bd51['countagentrejectretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc[_0x3fc3('0x196')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];ami[_0x3fc3('0x116')]('custom:agentreject',ut[_0x3fc3('0x11f')](_0x22f790,_0x3fc3('0x1b3')));hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1b4')));if(_0x277dcd['checkRetriveMax'](0x14,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countagentrejectretry']>=_0x5f3cdc['dialAgentRejectMaxRetry']){_0x277dcd['createStateFinal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b5'));}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b5'));}}break;default:_0x5f3cdc[_0x3fc3('0x136')]+=0x1;_0x46bd51['state']=0xc;_0x46bd51[_0x3fc3('0x70')]=_0x57141c['reason'];_0x525b5d=_0x5f3cdc[_0x3fc3('0x196')];_0x288647=_0x5f3cdc['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x277dcd[_0x3fc3('0x18d')](_0x57141c[_0x3fc3('0xc5')],_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countbusyretry']+_0x46bd51[_0x3fc3('0x122')]+_0x46bd51['countnoanswerretry']+_0x46bd51['countnosuchnumberretry']+_0x46bd51[_0x3fc3('0xd4')]+_0x46bd51[_0x3fc3('0xea')]+_0x46bd51[_0x3fc3('0x11e')]+_0x46bd51['countagentrejectretry']>=_0x5f3cdc[_0x3fc3('0x125')]){_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x57141c[_0x3fc3('0xc5')]);}else{_0x277dcd['createStateFinal'](_0x46bd51,_0x47b404,_0x200386,_0x57141c[_0x3fc3('0xc5')]);}}}})[_0x3fc3('0x9f')](function(){if(_0x5d4d38){hopperUtils[_0x3fc3('0xe6')](_0x46bd51,_0x525b5d,_0x288647)[_0x3fc3('0x9f')](function(){return _0x47b404(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2cd904,_0x2ea17e,_0x3bf034,_0x2aabdc){var _0x220e4a=new Final(_0x2cd904);_0x220e4a[_0x3fc3('0x6f')]=0xf;_0x220e4a[_0x3fc3('0x70')]=_0x3fc3('0x1b6');this[_0x3fc3('0x129')](_0x220e4a,_0x2ea17e,_0x3bf034,_0x2aabdc);};Dialer['prototype']['createStateFinal']=function(_0x422b19,_0x2fb80a,_0x4a6cf8,_0x1ecab5){hopperUtils[_0x3fc3('0xcc')](_0x422b19)[_0x3fc3('0x9f')](function(){return _0x2fb80a(msgResponse(_0x3fc3('0x197'),_0x3fc3('0x109'),_0x1ecab5));})['catch'](function(){return _0x4a6cf8(msgResponse(_0x3fc3('0x1b7'),_0x3fc3('0x93'),_0x3fc3('0x1b8')));});};Dialer['prototype'][_0x3fc3('0xb0')]=function(_0x411777){var _0x30887d=_0x411777[_0x3fc3('0x1b9')]/0x64;var _0x56ae65=_0x411777[_0x3fc3('0xd1')]/(_0x411777['outboundDropCallsDayTimeout']+_0x411777[_0x3fc3('0xc4')]);var _0xc5739b=Math[_0x3fc3('0x1ba')](_0x411777[_0x3fc3('0x1bb')]*(_0x411777[_0x3fc3('0x1bc')]/0x64));var _0x21fffa=Math['round'](_0x411777[_0x3fc3('0x1bb')]*(_0x411777[_0x3fc3('0x1bd')]/0x64));var _0x56c131=_0x411777[_0x3fc3('0x13e')]+_0x411777[_0x3fc3('0x1be')];var _0x4f286c=Math[_0x3fc3('0x1bf')](_0x411777[_0x3fc3('0x5c')]*_0x411777['erlangAbandonmentRate']*_0x411777['predictiveIntervalHitRate']*_0x411777['predictiveIntervalMultiplicativeFactor']);if(_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x28')])){if(!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x27')])){_0x411777['startPredictive']=undefined;loggerPredictive[_0x3fc3('0x65')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x64')])){loggerPredictive[_0x3fc3('0x65')](_0x3fc3('0x1c0'),_0x3fc3('0x1c1'));clearInterval(_0x411777[_0x3fc3('0x64')]);_0x411777['handlePredictive']=undefined;}_0x411777[_0x3fc3('0x28')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],'collection\x20data\x20in\x20progressive\x20at',_0x411777[_0x3fc3('0x28')]);this[_0x3fc3('0xb2')](_0x411777,0x1);}else if(ifInterval(_0x411777['dialPredictiveInterval'],_0x411777[_0x3fc3('0x28')])){this[_0x3fc3('0xb2')](_0x411777,0x1);loggerPredictiveCalls[_0x3fc3('0x4b')]('[startMethodPredictive][StartProgressive][Loop]',_0x411777['startProgressive'],_0x411777[_0x3fc3('0x48')]);_0x411777['erlangCalls']=0x0;_0x411777['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x30887d<_0x56ae65&&_0x411777[_0x3fc3('0x1c2')]==='dropRate'){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x1c3'),_0x3fc3('0x1c4'),_0x56ae65,_0x3fc3('0x28'),_0x411777[_0x3fc3('0x48')]);}else if(_0x4f286c<_0x411777[_0x3fc3('0xd2')]&&_0x411777['dialPredictiveOptimization']===_0x3fc3('0x1c5')){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x1c6'),_0x3fc3('0x1c7'),_0x4f286c,_0x3fc3('0x1c8'),_0x411777[_0x3fc3('0xd2')],_0x3fc3('0x28'),_0x411777[_0x3fc3('0x48')]);}else if(!ifInterval(_0x411777['dialPredictiveInterval'],_0x411777[_0x3fc3('0x28')])&&_[_0x3fc3('0x40')](_0x411777['startPredictive'])&&!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x28')])){_0x411777[_0x3fc3('0x27')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1c9'),_0x411777['startPredictive']);hopperUtils[_0x3fc3('0x1ca')](_0x411777[_0x3fc3('0x1cb')])['then'](this[_0x3fc3('0x1cc')](_0x411777))[_0x3fc3('0x9f')](mergeDataErlangB(_0x411777))[_0x3fc3('0x9f')](this[_0x3fc3('0x1cd')](_0x411777))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x411777));}else if(!ifInterval(_0x411777[_0x3fc3('0x1cb')],_0x411777['startPredictive'])){_0x411777[_0x3fc3('0xd2')]=0x0;_0x411777[_0x3fc3('0x27')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],'recalculate\x20predictive\x20at',_0x411777['startPredictive']);clearInterval(_0x411777[_0x3fc3('0x64')]);_0x411777[_0x3fc3('0x64')]=undefined;hopperUtils[_0x3fc3('0x1ca')](_0x411777[_0x3fc3('0x1cb')])[_0x3fc3('0x9f')](this[_0x3fc3('0x1cc')](_0x411777))[_0x3fc3('0x9f')](mergeDataErlangB(_0x411777))[_0x3fc3('0x9f')](this[_0x3fc3('0x1cd')](_0x411777))[_0x3fc3('0xa3')](loggerCatchPredictive(_0x3fc3('0x1ce'),_0x411777));}else if(_0x411777[_0x3fc3('0x1bb')]&&_0x56c131<_0x411777[_0x3fc3('0x1bb')]-_0x21fffa){clearPredictiveAttributes(_0x411777);loggerPredictive['info'](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1cf'),_0x56c131,_0x3fc3('0x1d0'),_0x411777[_0x3fc3('0x1bb')],'-',_0x21fffa,'=',_0x411777[_0x3fc3('0x1bb')]-_0x21fffa,')');}else if(_0x411777[_0x3fc3('0x1bb')]&&_0x56c131>_0x411777[_0x3fc3('0x1bb')]+_0xc5739b){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1cf'),_0x56c131,_0x3fc3('0x1d1'),_0x411777['predictiveIntervalAvailable'],'+',_0xc5739b,'=',_0x411777[_0x3fc3('0x1bb')]+_0xc5739b,')');}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1cc')]=function(_0x1798d0){var _0x4ec91a=this;return function(_0x2d5877){return new Promise(function(_0x645408,_0x3921ac){_[_0x3fc3('0x159')](_0x1798d0,_0x2d5877[0x0]);if(checkGetDataPredictive(_0x2d5877[0x0])){var _0x2a191e=_0x1798d0['predictiveIntervalAvailable']=_0x1798d0[_0x3fc3('0x1be')]+_0x1798d0['available'];var _0xff1e0b=_0x1798d0[_0x3fc3('0x1cb')]*0x3c;var _0x4f2c5b=_0x2d5877[0x0]['predictiveIntervalAvgTalktime']+_0x2d5877[0x0][_0x3fc3('0x58')];var _0x10ea7a=(_0x2d5877[0x0][_0x3fc3('0x50')]+_0x2d5877[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d5877[0x0][_0x3fc3('0x53')])/_0x2d5877[0x0][_0x3fc3('0x4e')];_0x1798d0[_0x3fc3('0x1d2')]=_0x10ea7a>0x0?_0x10ea7a:0x1;switch(_0x1798d0[_0x3fc3('0x1c2')]){case'dropRate':var _0x6599a8=_0x1798d0[_0x3fc3('0x1b9')]/0x64;return _0x4ec91a[_0x3fc3('0x1d3')](_0x2a191e,_0xff1e0b,_0x4f2c5b,_0x10ea7a,_0x6599a8)[_0x3fc3('0x9f')](function(_0x616933){return _0x645408(_0x616933);});case _0x3fc3('0x1d4'):var _0x2590a6=_0x1798d0[_0x3fc3('0x1b9')]/0x64;return _0x4ec91a[_0x3fc3('0x1d5')](_0x2a191e,_0xff1e0b,_0x4f2c5b,_0x10ea7a,_0x2590a6)['then'](function(_0x566b59){return _0x645408(_0x566b59);});default:return _0x3921ac(msgResponse(_0x3fc3('0x1d6'),_0x3fc3('0x93'),_0x3fc3('0x1d7')));}}else{return _0x3921ac(msgResponse(_0x3fc3('0x1d6'),'Failure',_0x3fc3('0x1d8')));}});};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1d9')]=function(_0x52df69){var _0x576606=this;return function(_0x2b2e71){return new Promise(function(_0x42f486,_0x4d2e4e){_['merge'](_0x52df69,_0x2b2e71[0x0]);if(checkGetDataPredictive(_0x2b2e71[0x0])){loggerPredictive[_0x3fc3('0x4b')](JSON[_0x3fc3('0x74')](_0x2b2e71[0x0]));if(_0x52df69[_0x3fc3('0x1c2')]==='dropRate'){return _0x576606['getVoiceQueueRtPauses'](_0x52df69['id'])['then'](function(_0x413a90){var _0x4e824e=_0x52df69[_0x3fc3('0x1da')]-_0x413a90[0x0][_0x3fc3('0x1db')];var _0x772b4e=_0x52df69[_0x3fc3('0x1cb')]*0x3c;var _0xc91c7e=_0x2b2e71[0x0][_0x3fc3('0x55')]+_0x2b2e71[0x0]['predictiveIntervalAvgHoldtime'];var _0x3b8137=(_0x2b2e71[0x0][_0x3fc3('0x50')]+_0x2b2e71[0x0][_0x3fc3('0x1dc')]+_0x2b2e71[0x0][_0x3fc3('0x53')])/_0x2b2e71[0x0][_0x3fc3('0x4e')];var _0x31cc4e=_0x52df69['dialPredictiveOptimizationPercentage']/0x64;_0x52df69[_0x3fc3('0x1dd')]=_0x413a90[0x0][_0x3fc3('0x1db')]||0x0;_0x52df69['predictiveIntervalHitRate']=_0x3b8137>0x0?_0x3b8137:0x1;return _0x576606[_0x3fc3('0x1d3')](_0x4e824e,_0x772b4e,_0xc91c7e,_0x3b8137,_0x31cc4e);})[_0x3fc3('0x9f')](function(_0x1c3558){return _0x42f486(_0x1c3558);})['catch'](function(_0x22b55a){return _0x4d2e4e(msgResponse(_0x3fc3('0x1de'),'Failure',JSON[_0x3fc3('0x74')](_0x22b55a)));});}if(_0x52df69[_0x3fc3('0x1c2')]===_0x3fc3('0x1d4')){return _0x576606[_0x3fc3('0x153')](_0x52df69['id'])[_0x3fc3('0x9f')](function(_0x4390b9){var _0x3e88e8=_0x52df69[_0x3fc3('0x1da')]-_0x4390b9[0x0]['outboundQueuePauses'];var _0x322091=_0x52df69[_0x3fc3('0x1cb')]*0x3c;var _0xe32d24=_0x2b2e71[0x0][_0x3fc3('0x55')]+_0x2b2e71[0x0][_0x3fc3('0x58')];var _0x5a2040=(_0x2b2e71[0x0][_0x3fc3('0x50')]+_0x2b2e71[0x0][_0x3fc3('0x1dc')]+_0x2b2e71[0x0][_0x3fc3('0x53')])/_0x2b2e71[0x0]['predictiveIntervalTotalCalls'];var _0x414646=_0x52df69[_0x3fc3('0x1b9')]/0x64;_0x52df69['predictiveIntervalPauses']=_0x4390b9[0x0][_0x3fc3('0x1db')]||0x0;_0x52df69[_0x3fc3('0x1d2')]=_0x5a2040>0x0?_0x5a2040:0x1;return _0x576606[_0x3fc3('0x1d5')](_0x3e88e8,_0x322091,_0xe32d24,_0x5a2040,_0x414646);})['then'](function(_0x4775ee){return _0x42f486(_0x4775ee);})[_0x3fc3('0xa3')](function(_0x4c910e){return _0x4d2e4e(msgResponse(_0x3fc3('0x1de'),_0x3fc3('0x93'),JSON['stringify'](_0x4c910e)));});}}else{return _0x4d2e4e(msgResponse(_0x3fc3('0x1d6'),_0x3fc3('0x93'),_0x3fc3('0x1d8')));}});};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1cd')]=function(_0x4d8fab){var _0x29cf67=this;return function(){var _0x342177=0x0;var _0xc6859=Math[_0x3fc3('0x1bf')](_0x4d8fab[_0x3fc3('0x5e')]*0x3e8);if(_0xc6859>0x0){_0xc6859=_0xc6859<0x64?0x64:_0xc6859;loggerPredictive['info'](_0x4d8fab['name'],_0x3fc3('0x1df'),_0xc6859,'milliseconds');_0x4d8fab['handlePredictive']=setInterval(function(){_0x29cf67[_0x3fc3('0x64')](_0x4d8fab);loggerPredictiveCalls[_0x3fc3('0x4b')](_0x3fc3('0x1e0'),_0x342177+=0x1);},_0xc6859);}else{loggerPredictive[_0x3fc3('0x4b')](_0x4d8fab[_0x3fc3('0x48')],_0x3fc3('0x1e1'));}};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1e2')]=function(_0xe6bce6,_0x390232){var _0x316831=this;return function(_0xfdbb97){if(_[_0x3fc3('0x4a')](_0xfdbb97)){if(_[_0x3fc3('0xf4')](_0x390232[_0x3fc3('0x15a')])||!_0x390232[_0x3fc3('0x1e3')]){if(_0xe6bce6[_0x3fc3('0xaf')]==='booked'){_0xe6bce6[_0x3fc3('0x72')]=_[_0x3fc3('0x40')](_0xe6bce6['queueStatusComplete'])?!![]:_0xe6bce6[_0x3fc3('0x72')];var _0x3f3c32=uuid['v4']();_0x316831[_0x3fc3('0x24')][_0x3f3c32]=new Action(_0xe6bce6,_0x390232,_0x3f3c32);loggerBooked[_0x3fc3('0x4b')](_0x3fc3('0x1e4'),_0x3f3c32,_0x3fc3('0x1e5'),JSON[_0x3fc3('0x74')](_0xe6bce6[_0x3fc3('0x72')]),'Queue:\x20',_0xe6bce6['name']);if(_0xe6bce6[_0x3fc3('0x72')]){_0xe6bce6[_0x3fc3('0x72')]=![];_0x316831['queueBooked'][_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xc1')]]=[];ami[_0x3fc3('0x9b')]({'actionid':_0x3f3c32,'action':_0x3fc3('0x1e6'),'queue':_0xe6bce6[_0x3fc3('0x48')]})[_0x3fc3('0xa3')](function(){_0x316831['updateOriginated'](_0xe6bce6);hopperUtils[_0x3fc3('0xda')]({'active':![],'ContactId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdd')],'ListId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xde')],'VoiceQueueId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xdf')]||undefined,'CampaignId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1e7')));delete _0x316831[_0x3fc3('0x24')][_0x3f3c32];});}else{loggerBooked[_0x3fc3('0x4b')]('[booked][checkContactBlack][else]',JSON['stringify'](_0xe6bce6[_0x3fc3('0x72')]),'Queue:\x20',_0xe6bce6['name']);_0x316831[_0x3fc3('0xc0')](_0xe6bce6);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdd')],'ListId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xde')],'VoiceQueueId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdf')]||undefined,'CampaignId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1e7')));delete _0x316831[_0x3fc3('0x24')][_0x3f3c32];}}else{return _0x316831[_0x3fc3('0x15d')](_0xe6bce6,_0x390232);}}else{if(utils[_0x3fc3('0x62')](undefined,_0x390232[_0x3fc3('0x1e8')])<_0xe6bce6[_0x3fc3('0x1e9')]*0x3c){if(_0x390232['Agent']&&!_0x390232[_0x3fc3('0x14a')]['voicePause']){_0x316831['preview'][_0x3fc3('0xfa')](_0x390232['id'])[_0x3fc3('0xfc')](function(){_0x316831[_0x3fc3('0xc0')](_0xe6bce6);});}else{hopperUtils[_0x3fc3('0x1ea')]({'active':![]},_0x390232['id'],0x1)[_0x3fc3('0xfc')](function(){_0x316831['updateOriginated'](_0xe6bce6);});}}else{_0xe6bce6[_0x3fc3('0x1eb')]+=0x1;_0x316831[_0x3fc3('0xc0')](_0xe6bce6);if(_0xe6bce6['dialRecallInQueue']){hopperUtils[_0x3fc3('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x390232['ContactId'],'ListId':_0x390232[_0x3fc3('0xde')],'VoiceQueueId':_0x390232[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x390232['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1ec')));hopperUtils['createHistory'](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')][_0x3fc3('0x1ed')],0x17,'RecallInQueue'))[_0x3fc3('0xa3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x316831[_0x3fc3('0x119')](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')]['RECALL_TIMEOUT'],0x16,_0x3fc3('0x1ee')),'[Originate][HistoryRecallClose][historyCatch]',_0x3fc3('0x1ef'));}}}}else{_0xe6bce6[_0x3fc3('0x1f0')]+=0x1;_0x316831['saveInDb'](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')][_0x3fc3('0x1f1')],0xd,'Blacklist'),_0x3fc3('0x1f2'),_0x3fc3('0x1f3'));throw _0x3fc3('0x1f4');}};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x15c')]=function(_0x48a73c){var _0x255d9f=this;var _0x2c9ba7=_0x48a73c[_0x3fc3('0x1f5')]-_0x48a73c['originated'];emitCampaignSummary(_0x48a73c);if(_0x2c9ba7>0x0&&_0x48a73c[_0x3fc3('0x1f6')]==0x0){if(_0x2c9ba7>this[_0x3fc3('0x22')]){_0x2c9ba7=this[_0x3fc3('0x22')];}_0x48a73c[_0x3fc3('0x1f6')]=0x1;hopperUtils[_0x3fc3('0x1f7')](_0x48a73c,_0x2c9ba7)[_0x3fc3('0x9f')](function(_0x29ae71){_0x48a73c[_0x3fc3('0x1f6')]=0x0;if(_0x29ae71){if(!utils[_0x3fc3('0x1f8')](_0x29ae71)){_0x48a73c[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x6d')];logger[_0x3fc3('0x4b')](_0x3fc3('0x1f9')+_0x48a73c[_0x3fc3('0x48')]);}else{_0x48a73c[_0x3fc3('0x80')]+=_0x29ae71[_0x3fc3('0x9a')];_0x48a73c[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x1fa')];for(var _0x16a585=0x0;_0x16a585<_0x29ae71[_0x3fc3('0x9a')];_0x16a585+=0x1){_0x48a73c[_0x3fc3('0x1fb')]+=0x1;if(_[_0x3fc3('0xf4')](_0x29ae71[_0x16a585])||_['isNil'](_0x29ae71[_0x16a585][_0x3fc3('0x174')])||_['isNil'](_0x29ae71[_0x16a585][_0x3fc3('0x181')])){_0x255d9f[_0x3fc3('0x157')]('[actionOriginate]\x20',_0x48a73c,_0x29ae71[_0x16a585]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x3fc3('0x75')](_0x29ae71[_0x16a585],[_0x3fc3('0xe0'),_0x3fc3('0x181')]))[_0x3fc3('0x9f')](_0x255d9f[_0x3fc3('0x1e2')](_0x48a73c,_0x29ae71[_0x16a585]))[_0x3fc3('0xa3')](_0x255d9f['loggerHandler'](_0x3fc3('0x1fc'),_0x48a73c));}}}}})[_0x3fc3('0xa3')](loggerGetContactDialer(_0x3fc3('0x1fd'),_0x48a73c,_0x2c9ba7));}};Dialer['prototype'][_0x3fc3('0xb2')]=function(_0xd96e23,_0xb495ec){var _0x1d8910=this;var _0x243b19=[];if(_0xb495ec<0x1||_0xd96e23[_0x3fc3('0xaf')]==='booked'){_0xb495ec=0x1;}var _0x2c562e=Math[_0x3fc3('0x1bf')](_0xd96e23[_0x3fc3('0x13e')]*_0xb495ec)-_0xd96e23[_0x3fc3('0x80')];if(_0xd96e23[_0x3fc3('0x1fe')]>0x0){var _0x22abb8=_0xd96e23[_0x3fc3('0x1fe')]-_0xd96e23[_0x3fc3('0x80')]-_0xd96e23[_0x3fc3('0x1be')]-_0xd96e23[_0x3fc3('0x1ff')];if(_0x2c562e>_0x22abb8){_0x2c562e=_0x22abb8;}}if(_0x2c562e>0x0&&_0xd96e23[_0x3fc3('0x1f6')]==0x0){if(_0xd96e23[_0x3fc3('0xaf')]==='booked'){_0x2c562e=0x1;}if(_0x2c562e>this[_0x3fc3('0x22')]){_0x2c562e=this[_0x3fc3('0x22')];}for(var _0x1144cf in this[_0x3fc3('0x20')]){if(typeof this['agents'][_0x1144cf]!=='undefined'){if(this['agents'][_0x1144cf][_0x3fc3('0x6f')]===_0x3fc3('0x200')&&this[_0x3fc3('0x20')][_0x1144cf][_0x3fc3('0x8b')]===_0x3fc3('0x8a')){_0x243b19[_0x3fc3('0xf8')](this[_0x3fc3('0x20')][_0x1144cf]['id']);}}}_0xd96e23[_0x3fc3('0x1f6')]=0x1;hopperUtils['getContactDialer'](_0xd96e23,_0x243b19,_0x2c562e)[_0x3fc3('0x9f')](function(_0x3f452e){_0xd96e23[_0x3fc3('0x1f6')]=0x0;if(_0x3f452e){if(!utils['checkContactEmpty'](_0x3f452e)){hopperUtils[_0x3fc3('0x201')](_0xd96e23)['then'](sendMessageReschedule(_0xd96e23))[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x202')));}else{_0xd96e23[_0x3fc3('0x80')]+=_0x3f452e[_0x3fc3('0x9a')];_0xd96e23[_0x3fc3('0x6c')]=_0xd96e23['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x3fc3('0x140')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x3bd188=0x0;_0x3bd188<_0x3f452e[_0x3fc3('0x9a')];_0x3bd188+=0x1){if(_[_0x3fc3('0xf4')](_0x3f452e[_0x3bd188])||_['isNil'](_0x3f452e[_0x3bd188][_0x3fc3('0x174')])||_[_0x3fc3('0xf4')](_0x3f452e[_0x3bd188][_0x3fc3('0x181')])){_0x1d8910['emptyContact'](_0x3fc3('0x203'),_0xd96e23,_0x3f452e[_0x3bd188]);}else{hopperUtils['checkIsBlackList'](_[_0x3fc3('0x75')](_0x3f452e[_0x3bd188],[_0x3fc3('0xdf'),_0x3fc3('0x181')]))['then'](_0x1d8910[_0x3fc3('0x1e2')](_0xd96e23,_0x3f452e[_0x3bd188]))[_0x3fc3('0xa3')](_0x1d8910[_0x3fc3('0x156')]('[actionOriginate]\x20',_0xd96e23));}}}}})[_0x3fc3('0xa3')](loggerGetContactDialer(_0x3fc3('0x204'),_0xd96e23,_0x2c562e));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x64')]=function(_0x2bc45e){if(_0x2bc45e[_0x3fc3('0x1fe')]>0x0){var _0x50cff6=_0x2bc45e['dialLimitQueue']-_0x2bc45e['originated']-_0x2bc45e[_0x3fc3('0x1be')];if(_0x50cff6>0x0&&_0x2bc45e['temp']==0x0){this[_0x3fc3('0x205')](_0x2bc45e);}else{loggerPredictiveCalls[_0x3fc3('0x4b')](_0x3fc3('0x206'));}}else{this[_0x3fc3('0x205')](_0x2bc45e);}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x205')]=function(_0x4c8b1e){var _0x29cf00=this;var _0x318e78=[];_0x4c8b1e[_0x3fc3('0x80')]+=0x1;for(var _0x24641c in this[_0x3fc3('0x20')]){if(typeof this[_0x3fc3('0x20')][_0x24641c]!==_0x3fc3('0xaa')){if(this[_0x3fc3('0x20')][_0x24641c][_0x3fc3('0x6f')]===_0x3fc3('0x200')&&this[_0x3fc3('0x20')][_0x24641c]['status']===_0x3fc3('0x8a')){_0x318e78[_0x3fc3('0xf8')](this['agents'][_0x24641c]['id']);}}}_0x4c8b1e[_0x3fc3('0x1f6')]=0x1;return this['getContactDialer'](_0x4c8b1e['id'],_0x318e78,0x1,_0x4c8b1e['dialOrderByScheduledAt'],_0x4c8b1e)[_0x3fc3('0x9f')](function(_0x430de5){_0x4c8b1e['temp']=0x1;if(_0x430de5){if(!utils[_0x3fc3('0x1f8')](_0x430de5)){utils[_0x3fc3('0x66')](_0x4c8b1e,0x1,0x0);return hopperUtils[_0x3fc3('0x201')](_0x4c8b1e)[_0x3fc3('0x9f')](sendMessageReschedule(_0x4c8b1e))['catch'](loggerCatch(_0x3fc3('0x202')));}else{_0x4c8b1e[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['RUNNING'];if(_['isNil'](_0x430de5[0x0])||_[_0x3fc3('0xf4')](_0x430de5[0x0][_0x3fc3('0x174')])||_[_0x3fc3('0xf4')](_0x430de5[0x0][_0x3fc3('0x181')])){_0x29cf00[_0x3fc3('0x157')](_0x3fc3('0x203'),_0x4c8b1e,_0x430de5[0x0]);}else{return hopperUtils[_0x3fc3('0x207')](_[_0x3fc3('0x75')](_0x430de5[0x0],[_0x3fc3('0xdf'),_0x3fc3('0x181')]))[_0x3fc3('0x9f')](_0x29cf00[_0x3fc3('0x1e2')](_0x4c8b1e,_0x430de5[0x0]))['catch'](_0x29cf00[_0x3fc3('0x156')](_0x3fc3('0x208'),_0x4c8b1e));}}}})['catch'](loggerGetContactDialer(_0x3fc3('0x209'),_0x4c8b1e,0x1));};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1d3')]=function(_0x39fec3,_0x46e0c7,_0x3b3c1c,_0xb14310,_0x3c28c7,_0x2a29b6){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20a'));loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20b'),_0x39fec3);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20c'),_0x46e0c7);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20d'),_0x3b3c1c);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20e'),_0xb14310);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20f'),_0x3c28c7);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));return new Promise(function(_0x4cce3b,_0x2f6924){if(_0x39fec3<=0x0||isNaN(_0x39fec3)){return _0x2f6924(msgResponse('[abandonmentRate]',_0x3fc3('0x86'),'m\x20=\x20'+_0x39fec3));}if(_0x3b3c1c<=0x0||isNaN(_0x3b3c1c)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),'Error',_0x3fc3('0x211')+_0x3b3c1c));}if(_0xb14310<=0x0||isNaN(_0xb14310)){return _0x2f6924(msgResponse('[abandonmentRate]',_0x3fc3('0x86'),_0x3fc3('0x212')+_0xb14310));}if(_0x46e0c7<=0x0||isNaN(_0x46e0c7)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),_0x3fc3('0x86'),_0x3fc3('0x213')+_0x46e0c7));}if(_0x3c28c7<=0x0||isNaN(_0x3c28c7)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),_0x3fc3('0x86'),_0x3fc3('0x214')+_0x3c28c7));}_0x2a29b6=_0x2a29b6||0x0;var _0x360f25=0x1/_0x3b3c1c;var _0x42cbe3=0x0;var _0x114031=0x0;var _0x3f2a59=0x0;var _0x43070a=0x0;for(var _0x1d973a=0x0;_0x3f2a59<_0x3c28c7;_0x1d973a+=0x1){_0x114031=_0x1d973a/_0x46e0c7;_0x42cbe3=(_0xb14310*_0x114031+_0x2a29b6)/_0x360f25;_0x3f2a59=utils[_0x3fc3('0x215')](_0x42cbe3,_0x39fec3);_0x43070a=_0x42cbe3/_0x39fec3*(0x1-utils['erlangb'](_0x42cbe3,_0x39fec3));}return _0x4cce3b({'erlangCalls':_0x1d973a,'erlangCallToSecond':_0x46e0c7/_0x1d973a,'erlangAbandonmentRate':_0x3f2a59,'erlangBusyFactor':_0x43070a});});};Dialer['prototype'][_0x3fc3('0x1d5')]=function(_0x159865,_0x48783e,_0x128cd6,_0x31167a,_0x1cc6c0,_0x5435d7){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x216'));loggerPredictive[_0x3fc3('0x4b')]('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',_0x159865);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20c'),_0x48783e);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20d'),_0x128cd6);loggerPredictive['info'](_0x3fc3('0x20e'),_0x31167a);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x217'),_0x1cc6c0);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));return new Promise(function(_0x59a0a2,_0x31c005){if(_0x159865<=0x0||isNaN(_0x159865)){return _0x31c005(msgResponse('[busyFactor]',_0x3fc3('0x86'),'m\x20=\x20'+_0x159865));}if(_0x128cd6<=0x0||isNaN(_0x128cd6)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),_0x3fc3('0x211')+_0x128cd6));}if(_0x31167a<=0x0||isNaN(_0x31167a)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),_0x3fc3('0x212')+_0x31167a));}if(_0x48783e<=0x0||isNaN(_0x48783e)){return _0x31c005(msgResponse(_0x3fc3('0x218'),'Error',_0x3fc3('0x213')+_0x48783e));}if(_0x1cc6c0<=0x0||isNaN(_0x1cc6c0)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),'Umin\x20=\x20'+_0x1cc6c0));}_0x5435d7=_0x5435d7||0x0;var _0x25ceea=0x1/_0x128cd6;var _0x1a76ac=0x0;var _0x20f2a7=0x0;var _0xa4124a=0x0;var _0x469471=0x0;for(var _0x4ea9a9=0x0;_0x469471<_0x1cc6c0;_0x4ea9a9+=0x1){_0x20f2a7=_0x4ea9a9/_0x48783e;_0x1a76ac=(_0x31167a*_0x20f2a7+_0x5435d7)/_0x25ceea;_0xa4124a=utils[_0x3fc3('0x215')](_0x1a76ac,_0x159865);_0x469471=_0x1a76ac/_0x159865*(0x1-utils['erlangb'](_0x1a76ac,_0x159865));}return _0x59a0a2({'erlangCalls':_0x4ea9a9,'erlangCallToSecond':_0x48783e/_0x4ea9a9,'erlangAbandonmentRate':_0xa4124a,'erlangBusyFactor':_0x469471});});};module['exports']=Dialer; \ No newline at end of file +var _0x2f55=['predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','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','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','timezones','UNKNOWN_TIMEZONE','length','push','Action','command','iftime\x20%s,%s','interval','content','true','catch','indexOf','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','dialTimezone','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','[ifTime][Action]','Error','uniqueid','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','ivr','getSeconds','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','state','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','add','ContactId','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','idHopper','syncQueueStatusComplete','preview','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','run','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','responsetime','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','outboundAnswerAgiCallsDay','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','dialMachineMaxRetry','dialMachineRetryFrequency','ivrAnswerCallsDay','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','dialPreviewRecallmeReminder','filter','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:%s','launchHandleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Machine]','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','object','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','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]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','erlangCallToSecond','[handlePredictive]','checkContactBlack','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','temp','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','Contact','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','erlangb','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','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/history','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive'];(function(_0x166dda,_0x13780a){var _0x1231a0=function(_0x980b3c){while(--_0x980b3c){_0x166dda['push'](_0x166dda['shift']());}};_0x1231a0(++_0x13780a);}(_0x2f55,0x1c9));var _0x52f5=function(_0x4c538c,_0x46c4dc){_0x4c538c=_0x4c538c-0x0;var _0x236796=_0x2f55[_0x4c538c];return _0x236796;};'use strict';var util=require(_0x52f5('0x0'));var _=require(_0x52f5('0x1'));var uuid=require(_0x52f5('0x2'));var moment=require(_0x52f5('0x3'));var rr=require('rr');var Redis=require(_0x52f5('0x4'));var utils=require(_0x52f5('0x5'));var hopperUtils=require(_0x52f5('0x6'));var ut=require(_0x52f5('0x7'));var config=require(_0x52f5('0x8'));var logger=require('../../../config/logger')(_0x52f5('0x9'));var loggerBooked=require(_0x52f5('0xa'))(_0x52f5('0xb'));var loggerPredictive=require(_0x52f5('0xa'))(_0x52f5('0xc'));var loggerPredictiveCalls=require(_0x52f5('0xa'))(_0x52f5('0xd'));var loggerSyncQueueSummary=require(_0x52f5('0xa'))(_0x52f5('0xe'));var ami=require(_0x52f5('0xf'));config[_0x52f5('0x10')]=_[_0x52f5('0x11')](config['redis'],{'host':_0x52f5('0x12'),'port':0x18eb});var io=require(_0x52f5('0x13'))(new Redis(config[_0x52f5('0x10')]));var cmHopper=require(_0x52f5('0x14'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x52f5('0x15'));var Interval=require(_0x52f5('0x16'));var Action=require('./models/action');var History=require(_0x52f5('0x17'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x52f5('0x18'));var Hangup=require(_0x52f5('0x19'));var ipAgi=process[_0x52f5('0x1a')][_0x52f5('0x1b')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x52f5('0x1c')][_0x52f5('0x1d')]=function(_0x5f3cc2){this[_0x52f5('0x1e')]=this[_0x52f5('0x1e')]?this[_0x52f5('0x1e')][_0x52f5('0x1f')](_0x5f3cc2):_0x5f3cc2();};function Dialer(_0x89e839,_0x4554a1){this[_0x52f5('0x20')]=new Sequence();this['preview']=_0x4554a1;this[_0x52f5('0x21')]=_0x89e839[_0x52f5('0x21')];this[_0x52f5('0x22')]=_0x89e839[_0x52f5('0x22')];this[_0x52f5('0x23')]=_0x89e839[_0x52f5('0x23')];this[_0x52f5('0x24')]=_0x89e839[_0x52f5('0x24')];this[_0x52f5('0x25')]=config['maxNumberOriginate']||0x2;this[_0x52f5('0x26')]={};this[_0x52f5('0x27')]={};this[_0x52f5('0x28')]={};this[_0x52f5('0x29')]={};this[_0x52f5('0x2a')]={};this[_0x52f5('0x2b')]={};this['startProgressive']={};this[_0x52f5('0x2c')]={};this[_0x52f5('0x2d')]={};this['queueBookedRR']={};this[_0x52f5('0x2e')]={};ami['on'](_0x52f5('0x2f'),this[_0x52f5('0x30')]['bind'](this));ami['on']('queuecallerabandon',this[_0x52f5('0x31')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x33'),this['syncOriginateResponse'][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x34'),this[_0x52f5('0x35')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x36'),this[_0x52f5('0xe')][_0x52f5('0x32')](this));ami['on']('custom:queuesummarycomplete',this[_0x52f5('0x37')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x38'),this[_0x52f5('0x39')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x3a'),this[_0x52f5('0x3b')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x3c'),this[_0x52f5('0x3d')]['bind'](this));ami['on'](_0x52f5('0x3e'),this[_0x52f5('0x3f')][_0x52f5('0x32')](this));ami['on'](_0x52f5('0x40'),this['syncQueueStatusComplete'][_0x52f5('0x32')](this));this[_0x52f5('0x41')]();this[_0x52f5('0x42')]();RpcSetting['getSettings']()[_0x52f5('0x43')](function(_0x558885){previewRecallmeReminderInterval=_0x558885[_0x52f5('0x44')];});}function isNotNull(_0x31d098){return _0x31d098!==null&&!_[_0x52f5('0x45')](_0x31d098);}function msgResponse(_0x646fd0,_0x1de43b,_0x3ba03f){return{'action':_0x646fd0,'response':_0x1de43b,'message':_0x3ba03f,'stack':_0x3ba03f};}function emit(_0x289d75,_0x575d4d,_0x1f184d){io['to'](_0x289d75)[_0x52f5('0x46')](_0x575d4d,_0x1f184d);}function emitOutboundVoiceQueueSummary(_0x4b674a){if(_0x4b674a[_0x52f5('0x47')]===_0x52f5('0x48')){logger[_0x52f5('0x49')](_0x52f5('0x4a'),util[_0x52f5('0x4b')](_0x4b674a,{'showHidden':![],'depth':null}));emit(util[_0x52f5('0x4c')](_0x52f5('0x4d'),_0x4b674a[_0x52f5('0x4e')]),_0x52f5('0x4f'),_0x4b674a);}}function checkGetDataPredictive(_0x1f1765){if(isNotNull(_0x1f1765)&&!_[_0x52f5('0x50')](_0x1f1765)){loggerPredictive['info'](_0x52f5('0x51'));loggerPredictive[_0x52f5('0x52')](_0x52f5('0x53'),_0x1f1765[_0x52f5('0x54')]);loggerPredictive['info'](_0x52f5('0x55'),_0x1f1765[_0x52f5('0x56')]);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x57'),_0x1f1765[_0x52f5('0x58')]);loggerPredictive['info'](_0x52f5('0x59'),_0x1f1765['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x5a'),_0x1f1765['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x52f5('0x5b'),_0x1f1765[_0x52f5('0x5c')]);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x5d'));if(_0x1f1765[_0x52f5('0x54')]>0x0){if(!_[_0x52f5('0x45')](_0x1f1765[_0x52f5('0x5c')])&&_0x1f1765[_0x52f5('0x5c')]>0x0){return!![];}loggerPredictive[_0x52f5('0x52')](_0x52f5('0x5e'));if(!_[_0x52f5('0x45')](_0x1f1765[_0x52f5('0x5f')])&&_0x1f1765[_0x52f5('0x5f')]>0x0){return!![];}loggerPredictive[_0x52f5('0x52')](_0x52f5('0x60'));}else{loggerPredictive['info'](_0x52f5('0x61'));}}else{loggerPredictive[_0x52f5('0x52')](_0x52f5('0x62'));}return![];}function mergeDataErlangB(_0x4a5f09){return function(_0x250d3d){loggerPredictive[_0x52f5('0x52')](_0x52f5('0x63'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x250d3d[_0x52f5('0x64')]);loggerPredictive[_0x52f5('0x52')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x250d3d['erlangCallToSecond']);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x65'),_0x250d3d[_0x52f5('0x66')]);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x67'),_0x250d3d[_0x52f5('0x68')]);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x65'),_0x250d3d[_0x52f5('0x66')]);loggerPredictive[_0x52f5('0x52')]('---------------------------');_[_0x52f5('0x69')](_0x4a5f09,_0x250d3d);};}function ifInterval(_0x3365dd,_0x37f343){if(_[_0x52f5('0x45')](_0x37f343)){return![];}return utils['getSeconds'](undefined,_0x37f343)<_0x3365dd*0x3c;}function clearPredictiveAttributes(_0x3ba9f8){if(_0x3ba9f8[_0x52f5('0x6a')]){_0x3ba9f8[_0x52f5('0x6a')]=undefined;loggerPredictive['debug'](_0x3ba9f8[_0x52f5('0x4e')],_0x52f5('0x6b'));}if(_0x3ba9f8['startPredictive']){_0x3ba9f8[_0x52f5('0x2b')]=undefined;loggerPredictive[_0x52f5('0x49')](_0x3ba9f8['name'],_0x52f5('0x6c'));}if(_0x3ba9f8[_0x52f5('0x6d')]){clearInterval(_0x3ba9f8[_0x52f5('0x6d')]);_0x3ba9f8[_0x52f5('0x6d')]=undefined;loggerPredictive['debug'](_0x3ba9f8['name'],_0x52f5('0x6e'));}}function loggerCatchPredictive(_0x576f03,_0x25d6e2){return function(_0x22b8b9){loggerPredictive[_0x52f5('0x6f')](_0x25d6e2['name'],_0x576f03);loggerPredictive[_0x52f5('0x6f')](_0x22b8b9[_0x52f5('0x70')]);clearPredictiveAttributes(_0x25d6e2);};}function loggerCatch(_0x41b1ab){return function(_0x19d830){logger[_0x52f5('0x6f')](_0x41b1ab,util[_0x52f5('0x4b')](_0x19d830,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2b0750,_0x28af85,_0x338f20){return function(_0x545c9c){utils[_0x52f5('0x71')](_0x28af85,_0x338f20,0x0);_0x28af85['temp']=0x0;logger[_0x52f5('0x6f')](_0x2b0750,util['inspect'](_0x545c9c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1bdc9c){return function(_0x2af22c){if(isNotNull(_0x2af22c)&&isNotNull(_0x2af22c[0x0])){if(_0x2af22c[0x0][_0x52f5('0x72')]>0x0){_0x1bdc9c[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x75')];logger[_0x52f5('0x52')](_0x52f5('0x76')+_0x1bdc9c[_0x52f5('0x4e')],_0x2af22c[0x0][_0x52f5('0x72')],'contacts');}else{_0x1bdc9c[_0x52f5('0x73')]=utils[_0x52f5('0x74')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x52f5('0x77')+_0x1bdc9c[_0x52f5('0x4e')]);}}};}function createObjHistory(_0x413c51,_0x365cea,_0x9a35c9,_0x36bf3b,_0x25fbd9){_0x413c51['message']=_0x9a35c9;var _0x1c9206=new Action(_0x413c51,_0x365cea);var _0x72b453=new History(_0x1c9206);_0x72b453['state']=_0x36bf3b;_0x72b453[_0x52f5('0x78')]=_0x25fbd9;_0x72b453[_0x52f5('0x79')]=_0x1c9206[_0x52f5('0x7a')];return _0x72b453;}function unlockQueueStatus(_0x318b2f,_0x37f5c7){setTimeout(function(){if(_[_0x52f5('0x45')](_0x318b2f[_0x52f5('0x7b')])){loggerBooked[_0x52f5('0x6f')](_0x52f5('0x7c'),_0x37f5c7);}_0x318b2f[_0x52f5('0x7b')]=!![];loggerBooked[_0x52f5('0x52')](_0x52f5('0x7d'),_0x37f5c7,JSON[_0x52f5('0x7e')](_[_0x52f5('0x7f')](_0x318b2f,[_0x52f5('0x4e'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x3c08e5){return function(){if(!isNotNull(_0x3c08e5[_0x52f5('0x80')])){_0x3c08e5['message']=utils[_0x52f5('0x74')][_0x52f5('0x81')];throw _0x3c08e5[_0x52f5('0x4e')]+_0x52f5('0x82');}if(!isNotNull(_0x3c08e5[_0x52f5('0x80')][_0x52f5('0x83')])){_0x3c08e5['message']=utils['CAMPAIGN_STATUS'][_0x52f5('0x81')];throw _0x3c08e5[_0x52f5('0x4e')]+_0x52f5('0x82');}if(!isNotNull(_[_0x52f5('0x50')](_0x3c08e5[_0x52f5('0x80')][_0x52f5('0x83')]))){_0x3c08e5[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x81')];throw _0x3c08e5['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x231979){return function(){if(!utils[_0x52f5('0x84')](_0x231979)){_0x231979[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x85')];throw _0x231979['name']+_0x52f5('0x86');}};}function emitCampaignSummary(_0x1110f1){if(utils[_0x52f5('0x87')](_0x1110f1)){emit(util[_0x52f5('0x4c')](_0x52f5('0x88'),_0x1110f1[_0x52f5('0x4e')]),_0x52f5('0x89'),_0x1110f1);}}function loggerCatchQueueSummary(_0x55bd14,_0x1f6659){return function(_0x15deb4){clearPredictiveAttributes(_0x1f6659);emitCampaignSummary(_0x1f6659);loggerSyncQueueSummary[_0x52f5('0x49')](_0x55bd14,util[_0x52f5('0x4b')](_0x15deb4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3793d6){if(_0x3793d6[_0x52f5('0x8a')]){if(_0x3793d6['originated']===0x0){_0x3793d6[_0x52f5('0x8a')]=![];_0x3793d6[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x85')];loggerSyncQueueSummary[_0x52f5('0x49')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3793d6['name'],_0x52f5('0x8b'));}else{_0x3793d6[_0x52f5('0x73')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x52f5('0x49')](_0x52f5('0x8c'),_0x3793d6[_0x52f5('0x4e')],_0x52f5('0x8d'));}emitCampaignSummary(_0x3793d6);}}function myreject(_0x55cd6e){return function(_0x301b24){return _0x55cd6e(msgResponse('[ifTime][Action]','Error',JSON[_0x52f5('0x7e')](_0x301b24)));};}Dialer[_0x52f5('0x1c')][_0x52f5('0x8e')]=function(_0x57ffbb){return!_['isUndefined'](_0x57ffbb)&&_0x57ffbb&&!_[_0x52f5('0x45')](_0x57ffbb[_0x52f5('0x4e')])&&!_[_0x52f5('0x45')](_0x57ffbb[_0x52f5('0x8f')])&&_0x57ffbb['active']&&(this[_0x52f5('0x24')][util[_0x52f5('0x4c')](_0x52f5('0x90'),_0x57ffbb['name'])]['status']===_0x52f5('0x91')||this[_0x52f5('0x24')][util[_0x52f5('0x4c')](_0x52f5('0x90'),_0x57ffbb[_0x52f5('0x4e')])][_0x52f5('0x92')]===_0x52f5('0x93'));};Dialer[_0x52f5('0x1c')][_0x52f5('0x94')]=function(_0x164cdc){var _0x5d2abc=this;return function(){if(!_0x5d2abc[_0x52f5('0x8e')](_0x164cdc['Trunk'])){if(!_0x5d2abc[_0x52f5('0x8e')](_0x164cdc['TrunkBackup'])){_0x164cdc[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x95')];throw _0x164cdc[_0x52f5('0x4e')]+_0x52f5('0x96');}}};};Dialer['prototype'][_0x52f5('0x97')]=function(_0x130a15,_0x6eebcf,_0x3b2e8f,_0x5f561d){var _0x1ed2c5=this;return function(){var _0x40b2b0=!![];return _0x1ed2c5[_0x52f5('0x98')](_0x130a15,_0x6eebcf,_0x3b2e8f,_0x5f561d,_0x40b2b0);};};Dialer[_0x52f5('0x1c')][_0x52f5('0x99')]=function(_0x540306,_0x267af0,_0x20a235,_0x17184a){var _0x45b430=this;return function(){var _0x4dec7a=![];return _0x45b430['ifTimeIvr'](_0x540306[_0x52f5('0x83')],_0x267af0,_0x20a235,_0x17184a,_0x4dec7a);};};Dialer[_0x52f5('0x1c')][_0x52f5('0x98')]=function(_0x57ede5,_0x3097d8,_0x4130d3,_0x3f18e3,_0x27d287){var _0x5cd267=[];return new Promise(function(_0x45ceba,_0x1beb03){if(!isNotNull(_0x57ede5)){_0x3f18e3[_0x52f5('0x73')]=utils['CAMPAIGN_STATUS'][_0x52f5('0x81')];return _0x1beb03(msgResponse('ifTime',_0x52f5('0x9a'),_0x4130d3+_0x52f5('0x9b')));}if(_[_0x52f5('0x50')](_0x57ede5)){_0x3f18e3['message']=utils[_0x52f5('0x74')][_0x52f5('0x9c')];return _0x1beb03(msgResponse(_0x52f5('0x9d'),_0x52f5('0x9a'),_0x4130d3+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3097d8&&_[_0x52f5('0x45')](config[_0x52f5('0x9e')][_0x3097d8])){_0x3f18e3['message']=utils[_0x52f5('0x74')][_0x52f5('0x9f')];return _0x1beb03(msgResponse('ifTime',_0x52f5('0x9a'),_0x4130d3+'\x20Timezone\x20unknow\x20'+_0x3097d8));}if(_['isArray'](_0x57ede5)){for(var _0x281009=0x0;_0x281009<_0x57ede5[_0x52f5('0xa0')];_0x281009+=0x1){_0x5cd267[_0x52f5('0xa1')](ami[_0x52f5('0xa2')]({'action':_0x52f5('0xa3'),'command':util[_0x52f5('0x4c')](_0x52f5('0xa4'),_0x57ede5[_0x281009][_0x52f5('0xa5')],!_[_0x52f5('0x45')](config[_0x52f5('0x9e')][_0x3097d8])?_0x3097d8:'')})[_0x52f5('0x43')](function(_0x2e00ad){return _0x2e00ad[_0x52f5('0xa6')]['indexOf'](_0x52f5('0xa7'))>=0x0;})[_0x52f5('0xa8')](myreject(_0x1beb03)));}}else{_0x5cd267[_0x52f5('0xa1')](ami[_0x52f5('0xa2')]({'action':_0x52f5('0xa3'),'command':util[_0x52f5('0x4c')](_0x52f5('0xa4'),_0x57ede5,!_[_0x52f5('0x45')](config[_0x52f5('0x9e')][_0x3097d8])?_0x3097d8:'')})[_0x52f5('0x43')](function(_0x249aa1){return _0x249aa1[_0x52f5('0xa6')][_0x52f5('0xa9')]('true')>=0x0;})[_0x52f5('0xa8')](myreject(_0x1beb03)));}Promise['all'](_0x5cd267)['then'](function(_0x4d3af8){var _0x35d643=_[_0x52f5('0xaa')](_0x4d3af8);if(_0x35d643){return _0x45ceba(_0x35d643);}else{_0x3f18e3[_0x52f5('0x73')]=_0x27d287?utils[_0x52f5('0x74')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x52f5('0xab')];return _0x1beb03(msgResponse(_0x52f5('0xac'),_0x52f5('0x9a'),'Global:\x20'+_0x27d287+'\x20'+_0x4130d3+_0x52f5('0xad')+util[_0x52f5('0x4b')](_0x57ede5,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3097d8));}})[_0x52f5('0xa8')](function(_0x393167){return _0x1beb03(msgResponse('ifTime',_0x52f5('0x9a'),JSON[_0x52f5('0x7e')](_0x393167)));});});};Dialer[_0x52f5('0x1c')]['loopCampaigns']=function(){var _0x144ead=this;return cmHopper[_0x52f5('0xae')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x144ead['syncCampaigns']();},0x3e8);});};Dialer[_0x52f5('0x1c')][_0x52f5('0xaf')]=function(){var _0x3a6e41=this;var _0x5024d3;for(var _0x308bf8 in this[_0x52f5('0x22')]){if(typeof this[_0x52f5('0x22')][_0x308bf8]!==_0x52f5('0xb0')){_0x5024d3=this['campaigns'][_0x308bf8];if(utils[_0x52f5('0x87')](_0x5024d3)&&utils[_0x52f5('0x84')](_0x5024d3)){_0x5024d3[_0x52f5('0x8a')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x5024d3))[_0x52f5('0x43')](checkInterval(_0x5024d3))['then'](_0x3a6e41[_0x52f5('0x94')](_0x5024d3))['then'](_0x3a6e41[_0x52f5('0x97')](_0x5024d3['dialGlobalInterval'],_0x5024d3['dialTimezone'],_0x5024d3[_0x52f5('0x4e')],_0x5024d3))[_0x52f5('0x43')](_0x3a6e41[_0x52f5('0x99')](_0x5024d3[_0x52f5('0x80')],_0x5024d3['dialTimezone'],_0x5024d3[_0x52f5('0x4e')],_0x5024d3))[_0x52f5('0x43')](_0x3a6e41['launchHandleIvr'](_0x5024d3))[_0x52f5('0xa8')](loggerCatchQueueSummary(_0x52f5('0xb1'),_0x5024d3));}else{notSendMessagesCampaign(_0x5024d3);}}}};Dialer[_0x52f5('0x1c')][_0x52f5('0xb2')]=function(_0x3b0680){if(_0x3b0680[_0x52f5('0xb3')]!=='predictive'){clearPredictiveAttributes(_0x3b0680);}switch(_0x3b0680['dialMethod']){case _0x52f5('0xb4'):this[_0x52f5('0xb5')](_0x3b0680,0x1);break;case _0x52f5('0xb6'):this[_0x52f5('0xb5')](_0x3b0680,_0x3b0680[_0x52f5('0xb7')]);break;case _0x52f5('0xc'):this['predictive'](_0x3b0680);break;case _0x52f5('0xb'):this[_0x52f5('0xb5')](_0x3b0680,0x1);break;default:logger[_0x52f5('0x6f')](_0x52f5('0xb8'),_0x3b0680[_0x52f5('0x4e')],'method\x20not\x20recognized');}};Dialer[_0x52f5('0x1c')][_0x52f5('0x9d')]=function(_0x3eb4f0,_0x2e82a2){var _0x3174d0=_0x3eb4f0[_0x52f5('0xb9')];var _0x2f06d4=_0x2e82a2?_0x3eb4f0[_0x52f5('0xba')]:_0x3eb4f0[_0x52f5('0x80')][_0x52f5('0x83')];logger[_0x52f5('0xbb')](_0x52f5('0xbc'),_0x2f06d4,_0x3174d0,_0x3eb4f0[_0x52f5('0x4e')],util[_0x52f5('0x4c')](_0x52f5('0xbd'),_0x3eb4f0[_0x52f5('0x4e')],_0x3eb4f0['id']));var _0x5d51b6=null;return Interval[_0x52f5('0xbe')](_0x2f06d4,_0x3174d0)[_0x52f5('0x43')](function(_0x4c5d47){if(_0x4c5d47===!![]){return _0x4c5d47;}else{_0x3eb4f0['message']=_0x2e82a2?utils[_0x52f5('0x74')][_0x52f5('0xbf')]:utils[_0x52f5('0x74')][_0x52f5('0xab')];_0x5d51b6=msgResponse(_0x52f5('0xac'),_0x52f5('0x9a'),_0x52f5('0xc0')+_0x2e82a2+'\x20'+_0x3eb4f0['name']+_0x52f5('0xad')+util['inspect'](_0x2f06d4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3174d0);}if(_0x5d51b6!==null){logger[_0x52f5('0xbb')](_0x52f5('0xc1'),_0x5d51b6);_0x5d51b6['isGlobal']=_0x2e82a2;throw _0x5d51b6;}})[_0x52f5('0xa8')](function(_0x1addea){logger[_0x52f5('0x6f')]('AMI\x20IfTime',_0x1addea);throw msgResponse(_0x52f5('0xc2'),_0x52f5('0xc3'),util[_0x52f5('0x4b')](_0x1addea,{'showHidden':![],'depth':null}));});};Dialer[_0x52f5('0x1c')][_0x52f5('0x30')]=function(_0x1b4b88){if(this[_0x52f5('0x21')][_0x1b4b88['queue']]){if(this[_0x52f5('0x29')][_0x1b4b88[_0x52f5('0xc4')]]&&this[_0x52f5('0x29')][_0x1b4b88[_0x52f5('0xc4')]][_0x52f5('0x47')]!=='ivr'){this[_0x52f5('0xc5')](this['voiceQueues'][_0x1b4b88[_0x52f5('0xc6')]]);this['uniqueId'][_0x1b4b88['uniqueid']][_0x52f5('0xc7')]=moment()[_0x52f5('0x4c')](_0x52f5('0xc8'));}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x35')]=function(_0x4706bc){var _0x32a213=this[_0x52f5('0x29')][_0x4706bc[_0x52f5('0xc4')]];if(this[_0x52f5('0x21')][_0x4706bc['queue']]){if(_0x32a213&&_0x32a213[_0x52f5('0x47')]!=='ivr'){delete this[_0x52f5('0x29')][_0x4706bc[_0x52f5('0xc4')]];this[_0x52f5('0x21')][_0x4706bc[_0x52f5('0xc6')]]['outboundAnswerCallsDay']+=0x1;var _0x3e41a7=new AgentComplete(_0x32a213,_0x4706bc);if(_0x4706bc[_0x52f5('0xc9')]===_0x52f5('0xca')){_0x3e41a7[_0x52f5('0xcb')]=this[_0x52f5('0x21')][_0x4706bc[_0x52f5('0xc6')]][_0x52f5('0xcc')]&&this[_0x52f5('0x21')][_0x4706bc[_0x52f5('0xc6')]][_0x52f5('0xcd')]?moment()[_0x52f5('0x4c')](_0x52f5('0xc8')):undefined;}hopperUtils[_0x52f5('0xce')](_0x3e41a7)['catch'](loggerCatch(_0x52f5('0xcf')));hopperUtils['moveContactManagedDialer'](_0x3e41a7)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xd0')));}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x31')]=function(_0x2d4143){var _0x26d1ec=this['uniqueId'][_0x2d4143[_0x52f5('0xc4')]];var _0x3fe031=this;var _0x32a4cb=![];var _0x48984d;var _0x475c13;if(this['voiceQueues'][_0x2d4143[_0x52f5('0xc6')]]){if(_0x26d1ec&&_0x26d1ec[_0x52f5('0x47')]!==_0x52f5('0xd1')){delete this['uniqueId'][_0x2d4143[_0x52f5('0xc4')]];this[_0x52f5('0xc5')](this[_0x52f5('0x21')][_0x2d4143['queue']]);_0x26d1ec['droptime']=moment()[_0x52f5('0x4c')](_0x52f5('0xc8'));var _0x3ecb2c=new QueueCallerAbandon(_0x26d1ec,_0x2d4143);if(utils[_0x52f5('0xd2')](_0x26d1ec[_0x52f5('0xd3')],_0x26d1ec['responsetime'])>=_0x26d1ec[_0x52f5('0xd4')]){this[_0x52f5('0x21')][_0x2d4143['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xd5')]+=0x1;this['voiceQueues'][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xd6')]+=0x1;_0x3ecb2c['state']=0xa;_0x3ecb2c[_0x52f5('0x78')]=_0x52f5('0xd7');_0x3ecb2c['dropreason']=_0x52f5('0xd8');_0x3ecb2c[_0x52f5('0xcb')]=this[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xcc')]?moment()['format'](_0x52f5('0xc8')):undefined;_0x3ecb2c[_0x52f5('0xd9')]+=0x1;_0x3ecb2c[_0x52f5('0xda')]+=0x1;_0x48984d=this[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]]['dialDropRetryFrequency'];_0x475c13=this['voiceQueues'][_0x2d4143['queue']][_0x52f5('0xdb')];hopperUtils['verifyAdditionalPhones'](_0x3ecb2c,_0x3ecb2c[_0x52f5('0xdc')],_0x26d1ec[_0x52f5('0xdd')])[_0x52f5('0x43')](function(_0x22c198){_0x32a4cb=_0x22c198[_0x52f5('0xde')]==0x1;if(_0x3ecb2c[_0x52f5('0xd9')]>=_0x3fe031[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xdf')]){_0x3fe031[_0x52f5('0xe0')](_0x3ecb2c,_0x22c198['additional']);}else{hopperUtils[_0x52f5('0xe1')]({'active':![],'countdropretry':_0x3ecb2c[_0x52f5('0xd9')],'scheduledat':moment()['add'](_0x3fe031[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]]['dialDropRetryFrequency'],_0x52f5('0xe2'))[_0x52f5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x26d1ec['ContactId'],'ListId':_0x26d1ec[_0x52f5('0xe3')],'VoiceQueueId':_0x26d1ec[_0x52f5('0xe4')]||undefined,'CampaignId':_0x26d1ec[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xe6')));var _0x5a7dbb=new History(_0x3ecb2c);_0x5a7dbb[_0x52f5('0xdc')]=0xa;_0x5a7dbb['statedesc']='Drop';_0x5a7dbb[_0x52f5('0x7a')]=moment()[_0x52f5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a7dbb['endtime']=_0x5a7dbb['starttime'];_0x5a7dbb['calleridname']=_0x3ecb2c['calleridname'];_0x5a7dbb['calleridnum']=_0x3ecb2c[_0x52f5('0xe7')];hopperUtils[_0x52f5('0xce')](_0x5a7dbb)['catch'](loggerCatch(_0x52f5('0xe8')));}})[_0x52f5('0x43')](function(){if(_0x32a4cb)hopperUtils[_0x52f5('0xe9')](_0x3ecb2c,_0x48984d,_0x475c13)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x2d4143['queue']][_0x52f5('0xea')]+=0x1;this[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xeb')]+=0x1;_0x3ecb2c['state']=0xb;_0x3ecb2c['statedesc']=_0x52f5('0xec');_0x3ecb2c[_0x52f5('0xed')]=_0x52f5('0xee');_0x3ecb2c[_0x52f5('0xef')]+=0x1;_0x3ecb2c[_0x52f5('0xda')]+=0x1;_0x48984d=this[_0x52f5('0x21')][_0x2d4143['queue']][_0x52f5('0xf0')];_0x475c13=this[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xdb')];hopperUtils[_0x52f5('0xf1')](_0x3ecb2c,_0x3ecb2c[_0x52f5('0xdc')],_0x26d1ec[_0x52f5('0xdd')])[_0x52f5('0x43')](function(_0x45e10e){if(_0x3ecb2c[_0x52f5('0xef')]>=_0x3fe031['voiceQueues'][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xf2')]){_0x3fe031['queueCallerAbandonCreateState'](_0x3ecb2c,_0x45e10e['additional']);}else{hopperUtils[_0x52f5('0xe1')]({'active':![],'countabandonedretry':_0x3ecb2c[_0x52f5('0xef')],'scheduledat':moment()[_0x52f5('0xf3')](_0x3fe031[_0x52f5('0x21')][_0x2d4143[_0x52f5('0xc6')]][_0x52f5('0xf0')],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x26d1ec[_0x52f5('0xf4')],'ListId':_0x26d1ec[_0x52f5('0xe3')],'VoiceQueueId':_0x26d1ec[_0x52f5('0xe4')]||undefined,'CampaignId':_0x26d1ec['CampaignId']||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xf5')));var _0x2b4f79=new History(_0x3ecb2c);_0x2b4f79['state']=0xb;_0x2b4f79['statedesc']=_0x52f5('0xec');_0x2b4f79[_0x52f5('0x7a')]=moment()[_0x52f5('0x4c')](_0x52f5('0xc8'));_0x2b4f79['endtime']=_0x2b4f79[_0x52f5('0x7a')];_0x2b4f79[_0x52f5('0xf6')]=_0x3ecb2c[_0x52f5('0xf6')];_0x2b4f79[_0x52f5('0xe7')]=_0x3ecb2c[_0x52f5('0xe7')];hopperUtils['createHistory'](_0x2b4f79)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xf7')));}})[_0x52f5('0x43')](function(){if(_0x32a4cb)hopperUtils[_0x52f5('0xe9')](_0x3ecb2c,_0x48984d,_0x475c13)[_0x52f5('0x43')](function(){return 0x1;});});}}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x3b')]=function(_0x34c609){if(this[_0x52f5('0x27')][_0x34c609[_0x52f5('0xc4')]]){this[_0x52f5('0x27')][_0x34c609['uniqueid']]['channel']=_0x34c609[_0x52f5('0xf8')];}if(this['uniqueId'][_0x34c609['uniqueid']]){this[_0x52f5('0x29')][_0x34c609[_0x52f5('0xc4')]]['channel']=_0x34c609[_0x52f5('0xf8')];}};Dialer['prototype'][_0x52f5('0x3f')]=function(_0x6103f0){if(!this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]){return;}var _0x3adf0d=this[_0x52f5('0x21')][this['actions'][_0x6103f0['actionid']]['queue']][_0x52f5('0xfa')]||_0x52f5('0xfb');if(_0x3adf0d===_0x52f5('0xfc')){if(this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]&&_[_0x52f5('0xfd')](this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]['locked'])&&_0x6103f0[_0x52f5('0x92')]==='1'&&_0x6103f0[_0x52f5('0xfe')]==='0'){if(this[_0x52f5('0x23')][_0x6103f0['stateinterface']]){if(!this[_0x52f5('0x23')][_0x6103f0[_0x52f5('0xff')]]['locked']){this['agents'][_0x6103f0[_0x52f5('0xff')]][_0x52f5('0x100')]=!![];this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]][_0x52f5('0x100')]=!![];this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]['stateinterface']=_0x6103f0[_0x52f5('0xff')];}}}}else if(_0x3adf0d===_0x52f5('0xfb')){if(this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]){if(this['agents'][_0x6103f0['stateinterface']]){this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]][_0x52f5('0xff')]=_0x6103f0['stateinterface'];if(_[_0x52f5('0xfd')](this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x6103f0['actionid']][_0x52f5('0xc6')]])){this['queueBooked'][this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]][_0x52f5('0xc6')]]=[];}this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]]['queue']][_0x52f5('0xa1')](_[_0x52f5('0x69')](_['pick'](this[_0x52f5('0x27')][_0x6103f0[_0x52f5('0xf9')]],[_0x52f5('0x101'),_0x52f5('0xff')]),{'status':_0x6103f0[_0x52f5('0x92')],'paused':_0x6103f0['paused']}));}}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x102')]=function(_0x2a76bd){if(!this['actions'][_0x2a76bd[_0x52f5('0xf9')]]){return;}var _0x5f2017=this;var _0x5540be=this['voiceQueues'][this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]];var _0x596bcb=_0x5540be['strategy']||_0x52f5('0xfb');if(_0x596bcb===_0x52f5('0xfc')){if(this['actions'][_0x2a76bd[_0x52f5('0xf9')]]&&this['actions'][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xff')]){this[_0x52f5('0x103')]['run'](this['actions'][_0x2a76bd['actionid']][_0x52f5('0x101')],this[_0x52f5('0x27')][_0x2a76bd['actionid']][_0x52f5('0xff')])[_0x52f5('0xa8')](function(_0x438fa8){logger['error'](_0x52f5('0x104'),util[_0x52f5('0x4b')](_0x438fa8,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5f2017[_0x52f5('0xc5')](_0x5f2017[_0x52f5('0x21')][_0x5f2017['actions'][_0x2a76bd['actionid']][_0x52f5('0xc6')]]);_0x5f2017['agents'][_0x5f2017[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xff')]][_0x52f5('0x100')]=![];delete _0x5f2017[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]];unlockQueueStatus(_0x5540be);});}else{this[_0x52f5('0xc5')](this[_0x52f5('0x21')][this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]]);hopperUtils[_0x52f5('0xe1')]({'active':![],'ContactId':this[_0x52f5('0x27')][_0x2a76bd['actionid']][_0x52f5('0xf4')],'ListId':this[_0x52f5('0x27')][_0x2a76bd['actionid']][_0x52f5('0xe3')],'VoiceQueueId':this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xe4')]||undefined,'CampaignId':this['actions'][_0x2a76bd['actionid']][_0x52f5('0xe5')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]];unlockQueueStatus(_0x5540be);}}else if(_0x596bcb===_0x52f5('0xfb')){var _0x5a9266;if(this[_0x52f5('0x27')][_0x2a76bd['actionid']]&&!_[_0x52f5('0x50')](this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x2a76bd['actionid']]['queue']])){if(this[_0x52f5('0x105')][_0x5f2017[_0x52f5('0x27')][_0x2a76bd['actionid']]['queue']]){this[_0x52f5('0x105')][_0x5f2017[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]]=this[_0x52f5('0x105')][this['actions'][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]]?this[_0x52f5('0x105')][this['actions'][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]]:this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]]['queue']]?this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]][_0x52f5('0xc6')]][_0x52f5('0x106')]||0x0:0x0;}this[_0x52f5('0x2d')][this[_0x52f5('0x27')][_0x2a76bd['actionid']][_0x52f5('0xc6')]][_0x52f5('0x106')]=this[_0x52f5('0x105')][this[_0x52f5('0x27')][_0x2a76bd[_0x52f5('0xf9')]]['queue']];for(var _0x4377d3=0x0;_0x4377d3=_0x59d22a[_0x52f5('0x130')]){_0x20ab33[_0x52f5('0x131')](_0x20bfbe,_0x4e9b8d,_0x570185,_0x52f5('0x132'));}else{if(_0x20bfbe[_0x52f5('0x129')]>=_0x59d22a['dialMachineMaxRetry']){_0x20ab33[_0x52f5('0x133')](_0x20bfbe,_0x4e9b8d,_0x570185,_0x52f5('0x134'));}else{hopperUtils[_0x52f5('0xe1')]({'active':![],'countmachineretry':_0x20bfbe[_0x52f5('0x129')],'scheduledat':moment()[_0x52f5('0xf3')](_0x59d22a['dialMachineRetryFrequency'],_0x52f5('0xe2'))[_0x52f5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20bfbe[_0x52f5('0xf4')],'ListId':_0x20bfbe[_0x52f5('0xe3')],'VoiceQueueId':_0x20bfbe[_0x52f5('0xe4')]||undefined,'CampaignId':_0x20bfbe['CampaignId']||undefined})[_0x52f5('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x4e9b8d({'reschedule':0x1});}}});}if(_0x3c84b4[_0x52f5('0x47')]===_0x52f5('0xd1')&&this['campaigns'][_0x3c84b4[_0x52f5('0xc6')]][_0x52f5('0x11b')]&&_0xb516e2[_0x52f5('0x125')]===_0x52f5('0x135')){delete this[_0x52f5('0x29')][_0xb516e2[_0x52f5('0xc4')]];this['updateOriginated'](this[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]]);_0x414e71=new Hangup(_0x3c84b4,_0xb516e2);_0x414e71['state']=0x12;_0x414e71['statedesc']='HangupInAMD';_0x414e71['membername']=_0x52f5('0x11e');ami[_0x52f5('0x46')](_0x52f5('0x11f'),ut[_0x52f5('0x120')](_0x414e71,_0x52f5('0x121')));this[_0x52f5('0x122')](_0x414e71,_0x52f5('0x136'),_0x52f5('0x137'));}if(_0x3c84b4['type']===_0x52f5('0xd1')&&this[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]][_0x52f5('0x11b')]&&_0xb516e2[_0x52f5('0x125')]===_0x52f5('0x138')){return new Promise(function(_0x430111,_0x378aa7){delete _0x20ab33['uniqueId'][_0xb516e2[_0x52f5('0xc4')]];_0x20ab33['updateOriginated'](_0x20ab33[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]]);_0x20ab33[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]][_0x52f5('0x11c')]+=0x1;_0x20ab33[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2dd63a=_0x20ab33[_0x52f5('0x22')][_0x3c84b4[_0x52f5('0xc6')]];var _0x3a2e9d=new Hangup(_0x3c84b4,_0xb516e2);_0x3a2e9d[_0x52f5('0xdc')]=0x13;_0x3a2e9d[_0x52f5('0x78')]='Machine';_0x3a2e9d['membername']='AMD';_0x3a2e9d[_0x52f5('0x129')]+=0x1;_0x3a2e9d[_0x52f5('0xda')]+=0x1;_0x3a2e9d[_0x52f5('0x121')]=!![];ami[_0x52f5('0x46')](_0x52f5('0x11f'),ut[_0x52f5('0x120')](_0x3a2e9d,_0x52f5('0x121')));hopperUtils[_0x52f5('0xce')](_0x3a2e9d)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x12a')));if(_0x3a2e9d[_0x52f5('0x12b')]+_0x3a2e9d['countcongestionretry']+_0x3a2e9d[_0x52f5('0x12d')]+_0x3a2e9d[_0x52f5('0x12e')]+_0x3a2e9d['countdropretry']+_0x3a2e9d[_0x52f5('0xef')]+_0x3a2e9d['countmachineretry']+_0x3a2e9d[_0x52f5('0x12f')]>=_0x2dd63a[_0x52f5('0x130')]){_0x20ab33[_0x52f5('0x131')](_0x3a2e9d,_0x430111,_0x378aa7,_0x52f5('0x132'));}else{if(_0x3a2e9d[_0x52f5('0x129')]>=_0x2dd63a[_0x52f5('0x139')]){_0x20ab33[_0x52f5('0x133')](_0x3a2e9d,_0x430111,_0x378aa7,_0x52f5('0x134'));}else{hopperUtils[_0x52f5('0xe1')]({'active':![],'countmachineretry':_0x3a2e9d['countmachineretry'],'scheduledat':moment()['add'](_0x2dd63a[_0x52f5('0x13a')],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x3a2e9d[_0x52f5('0xf4')],'ListId':_0x3a2e9d[_0x52f5('0xe3')],'VoiceQueueId':_0x3a2e9d[_0x52f5('0xe4')]||undefined,'CampaignId':_0x3a2e9d[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x430111({'reschedule':0x1});}}});}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x39')]=function(_0x4b91c8){var _0x3c1248=this['uniqueId'][_0x4b91c8[_0x52f5('0xc4')]];var _0x45de8c;if(_0x3c1248&&_0x3c1248['type']===_0x52f5('0xd1')){delete this[_0x52f5('0x29')][_0x4b91c8['uniqueid']];this[_0x52f5('0xc5')](this[_0x52f5('0x22')][_0x3c1248[_0x52f5('0xc6')]]);this[_0x52f5('0x22')][_0x3c1248['queue']][_0x52f5('0x13b')]+=0x1;_0x45de8c=new Hangup(_0x3c1248,_0x4b91c8);hopperUtils['createHistory'](_0x45de8c)[_0x52f5('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x52f5('0x13c')](_0x45de8c)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x13d')));}if(_0x3c1248&&_0x3c1248[_0x52f5('0x47')]!==_0x52f5('0xd1')&&isNotNull(this[_0x52f5('0x21')][_0x3c1248[_0x52f5('0xc6')]][_0x52f5('0x13e')])){delete this['uniqueId'][_0x4b91c8[_0x52f5('0xc4')]];this[_0x52f5('0xc5')](this[_0x52f5('0x21')][_0x3c1248[_0x52f5('0xc6')]]);this[_0x52f5('0x21')][_0x3c1248[_0x52f5('0xc6')]][_0x52f5('0x11c')]+=0x1;this['voiceQueues'][_0x3c1248[_0x52f5('0xc6')]][_0x52f5('0x126')]+=0x1;_0x45de8c=new Hangup(_0x3c1248,_0x4b91c8);_0x45de8c['state']=0x10;_0x45de8c[_0x52f5('0x78')]=_0x52f5('0x13f');_0x45de8c[_0x52f5('0x128')]=_0x52f5('0x140');hopperUtils[_0x52f5('0xce')](_0x45de8c)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x141')));hopperUtils[_0x52f5('0x13c')](_0x45de8c)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3c1248&&_0x3c1248[_0x52f5('0x47')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x3c1248[_0x52f5('0xc6')]]['dialQueueProject'])){delete this[_0x52f5('0x29')][_0x4b91c8[_0x52f5('0xc4')]];this[_0x52f5('0xc5')](this[_0x52f5('0x21')][_0x3c1248[_0x52f5('0xc6')]]);this[_0x52f5('0x21')][_0x3c1248[_0x52f5('0xc6')]][_0x52f5('0x142')]+=0x1;_0x45de8c=new Hangup(_0x3c1248,_0x4b91c8);_0x45de8c['state']=0xc;_0x45de8c[_0x52f5('0x78')]=_0x4b91c8[_0x52f5('0x143')];_0x45de8c[_0x52f5('0x128')]=_0x52f5('0x144');hopperUtils['createHistory'](_0x45de8c)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x141')));hopperUtils['moveContactManagedDialer'](_0x45de8c)[_0x52f5('0xa8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x52f5('0x1c')][_0x52f5('0xe')]=function(_0x119276){var _0x1258f9=this;if(!_0x1258f9[_0x52f5('0x2e')][_0x119276[_0x52f5('0x4e')]]){_0x1258f9[_0x52f5('0x2e')][_0x119276[_0x52f5('0x4e')]]={'running':![]};}else if(_0x1258f9['queuesSummary'][_0x119276['name']]['running']===!![]){return;}else if(_0x1258f9[_0x52f5('0x2e')][_0x119276[_0x52f5('0x4e')]][_0x52f5('0x145')]===![]){_0x1258f9[_0x52f5('0x2e')][_0x119276[_0x52f5('0x4e')]][_0x52f5('0x145')]=!![];}var _0xd8ef70=_0x1258f9[_0x52f5('0x21')][_0x119276[_0x52f5('0x4e')]];var _0x1b1e5a=_0xd8ef70['message']!==utils[_0x52f5('0x74')][_0x52f5('0x85')];var _0x23aa6d=utils[_0x52f5('0x146')](_0xd8ef70);_0xd8ef70[_0x52f5('0x147')]=utils[_0x52f5('0x148')](_0xd8ef70,_0x1258f9[_0x52f5('0x24')]);Promise[_0x52f5('0x149')]()['then'](function(){if(_0xd8ef70[_0x52f5('0x147')]===utils[_0x52f5('0x74')]['INACTIVE']){if(_0x1b1e5a){clearPredictiveAttributes(_0xd8ef70);_0x119276[_0x52f5('0x2b')]=undefined;_0x119276['startProgressive']=undefined;}if(_0xd8ef70[_0x52f5('0x147')]===utils[_0x52f5('0x74')][_0x52f5('0x85')]){_0x119276[_0x52f5('0x14a')]=0x0;_0x119276['paused']=0x0;_0x119276['inUse']=0x0;_0x119276[_0x52f5('0x14b')]=0x0;_0x119276[_0x52f5('0x14c')]=0x0;}}else if(_0xd8ef70[_0x52f5('0x147')]===utils['CAMPAIGN_STATUS'][_0x52f5('0x14d')]&&!_0x23aa6d){return _0x1258f9[_0x52f5('0x9d')](_0xd8ef70,!![])['then'](function(){return _0x1258f9['ifTime'](_0xd8ef70,![]);})[_0x52f5('0x43')](function(){return _0x1258f9['checkDialMethod'](_0xd8ef70);})[_0x52f5('0xa8')](function(_0x2c2d16){loggerSyncQueueSummary[_0x52f5('0x49')](_0x52f5('0x14e'),util[_0x52f5('0x4b')](_0x2c2d16,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xd8ef70);});}else{clearPredictiveAttributes(_0xd8ef70);}})[_0x52f5('0x43')](function(){var _0x364117=_0x119276[_0x52f5('0x14f')](_0xd8ef70);if(_0x364117||_0xd8ef70[_0x52f5('0x150')]){_0xd8ef70[_0x52f5('0x150')]=![];_0x119276['updateReportFromOutboundQueue'](_0xd8ef70);Object[_0x52f5('0x151')](_0xd8ef70,_0x119276);emitOutboundVoiceQueueSummary(_0x119276);}_0x1258f9[_0x52f5('0x2e')][_0xd8ef70['name']][_0x52f5('0x145')]=![];})[_0x52f5('0xa8')](function(_0x3929a4){logger[_0x52f5('0x6f')](_0x52f5('0x14e'),util[_0x52f5('0x4b')](_0x3929a4,{'showHidden':![],'depth':null}));_0x1258f9[_0x52f5('0x2e')][_0xd8ef70[_0x52f5('0x4e')]][_0x52f5('0x145')]=![];});};Dialer['prototype'][_0x52f5('0x37')]=_[_0x52f5('0x152')](function(){var _0xe2eb47=_['filter'](this[_0x52f5('0x21')],function(_0x5e9972){return _0x5e9972[_0x52f5('0x153')];});var _0x539587=_[_0x52f5('0x154')](this['agents'],function(_0x5b4b01){return _0x5b4b01['online']&&_0x5b4b01[_0x52f5('0x92')]===_0x52f5('0x91');});if(_0xe2eb47[_0x52f5('0xa0')]>0x0&&_0x539587['length']>0x0){return Promise['resolve']()['then'](cmHopper[_0x52f5('0x155')](_['map'](_0xe2eb47,'id'),previewRecallmeReminderInterval,_[_0x52f5('0x156')](_0x539587,'id')))[_0x52f5('0x43')](function(_0x24c467){for(var _0x4c71f5=0x0;_0x4c71f5<_0x24c467[_0x52f5('0xa0')];_0x4c71f5++){var _0x1a96cb=_0x24c467[_0x4c71f5][_0x52f5('0x157')][_0x52f5('0x4e')];if(_0x1a96cb)io['to'](util[_0x52f5('0x4c')]('user:%s',_0x1a96cb))['emit'](_0x52f5('0x158'),{'hopper':_0x24c467[_0x4c71f5]});}})[_0x52f5('0xa8')](function(_0x1b3160){logger[_0x52f5('0x6f')]('checkPreviewRecallReminder',_0x1b3160);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x52f5('0x1c')][_0x52f5('0x42')]=function(){var _0x31ca46=this;setInterval(function(){_0x31ca46['clearZombieChannels'](_0x31ca46[_0x52f5('0x29')],_0x52f5('0x159'));_0x31ca46[_0x52f5('0x15a')](_0x31ca46[_0x52f5('0x27')],_0x52f5('0x15b'));},0x32c8);};Dialer['prototype'][_0x52f5('0x15a')]=function(_0x339cf5,_0x30355d){var _0x26be0d=this;for(var _0x31c516 in _0x339cf5){if(typeof _0x339cf5[_0x31c516]!==_0x52f5('0xb0')){this[_0x52f5('0x20')]['enqueue'](function(){if(!_[_0x52f5('0xfd')](_0x339cf5[_0x31c516])){return ami[_0x52f5('0xa2')]({'action':_0x52f5('0x92'),'channel':_0x339cf5[_0x31c516]['channel']})[_0x52f5('0xa8')](function(_0x4d658a){if(_0x4d658a[_0x52f5('0x73')]===_0x52f5('0x15c')){setTimeout(function(){if(_0x339cf5[_0x31c516]&&_0x339cf5[_0x31c516][_0x52f5('0x47')]!==_0x52f5('0xd1')){_0x26be0d[_0x52f5('0xc5')](_0x26be0d[_0x52f5('0x21')][_0x339cf5[_0x31c516]['queue']]);logger[_0x52f5('0x6f')]('[Dialer][checkChannel]',_0x30355d,_0x31c516,_0x339cf5[_0x31c516][_0x52f5('0xc6')]);delete _0x339cf5[_0x31c516];}if(_0x339cf5[_0x31c516]&&_0x339cf5[_0x31c516]['type']==='ivr'){_0x26be0d[_0x52f5('0xc5')](_0x26be0d[_0x52f5('0x22')][_0x339cf5[_0x31c516]['queue']]);logger['error']('[Dialer][checkChannel][ivr]',_0x30355d,_0x31c516,_0x339cf5[_0x31c516][_0x52f5('0xc6')]);delete _0x339cf5[_0x31c516];}},0x2328);}});}});}}};Dialer[_0x52f5('0x1c')][_0x52f5('0x15d')]=function(_0x3b612c){return Promise['resolve']()[_0x52f5('0x43')](voiceQueueRt[_0x52f5('0x15d')](_0x3b612c))[_0x52f5('0xa8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x52f5('0x1c')][_0x52f5('0xc5')]=function(_0x54f694){if(!_[_0x52f5('0x45')](_0x54f694)&&_0x54f694!==null){if(typeof _0x54f694[_0x52f5('0x15e')]!==_0x52f5('0xb0')){if(_0x54f694[_0x52f5('0x15e')]>0x0){_0x54f694[_0x52f5('0x15e')]-=0x1;}else{logger[_0x52f5('0x6f')](_0x52f5('0x15f'));}}}else{logger[_0x52f5('0x6f')](_0x52f5('0x160'));}};Dialer['prototype'][_0x52f5('0x161')]=function(_0x513c92,_0xee0941){var _0x46e7ce=this;return function(_0x4978bd){_0x46e7ce[_0x52f5('0xc5')](_0xee0941);logger[_0x52f5('0x6f')](_0x513c92,util['inspect'](_0x4978bd,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x52f5('0x162')]=function(_0xfff9d9,_0x5106c2,_0x51f64f){var _0x5c7f91={'state':0x19,'statedesc':_0x52f5('0x163')};this[_0x52f5('0xc5')](_0x5106c2);this[_0x52f5('0x122')](_[_0x52f5('0x69')](_0x5c7f91,_['pick'](_0x51f64f,[_0x52f5('0xf4'),_0x52f5('0xe3'),'UserId',_0x52f5('0xe4'),'CampaignId'])),_0x52f5('0x164'),'[emptyContact]');logger['error'](_0xfff9d9);};Dialer['prototype'][_0x52f5('0x122')]=function(_0x4d3dc6,_0x3dc4a9,_0x263675){hopperUtils[_0x52f5('0xce')](_0x4d3dc6)[_0x52f5('0xa8')](loggerCatch(_0x3dc4a9));hopperUtils['moveContactManagedDialer'](_0x4d3dc6)['catch'](loggerCatch(_0x263675));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x349d41,_0x3f99b3){hopperUtils[_0x52f5('0xce')](_0x349d41)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xcf')));if(_0x3f99b3==0x0){hopperUtils[_0x52f5('0x13c')](_0x349d41)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x165')));}};Dialer['prototype'][_0x52f5('0x166')]=function(_0x30208b){return Promise[_0x52f5('0x149')]()[_0x52f5('0x43')](cmHopper[_0x52f5('0x155')](_0x30208b['id'],previewRecallmeReminderInterval))[_0x52f5('0x43')](function(_0x563bed){for(var _0x1e74c6=0x0;_0x1e74c6<_0x563bed[_0x52f5('0xa0')];_0x1e74c6++){var _0x331836=_0x563bed[_0x1e74c6][_0x52f5('0x157')][_0x52f5('0x4e')];if(_0x331836)io['to'](util[_0x52f5('0x4c')](_0x52f5('0x167'),_0x331836))[_0x52f5('0x46')]('user:dialPreviewRecallReminder',{'hopper':_0x563bed[_0x1e74c6]});}})[_0x52f5('0xa8')](function(){});};Dialer[_0x52f5('0x1c')][_0x52f5('0x168')]=function(_0x53e561){var _0x43b72b=this;return function(){_0x43b72b['handleIvr'](_0x53e561);};};Dialer[_0x52f5('0x1c')][_0x52f5('0x169')]=function(_0x2b7084,_0x35f70b){var _0x34d011=this;var _0x488065=uuid['v4']();this['actions'][_0x488065]=new Action(_0x2b7084,_0x35f70b,_0x488065);return new Promise(function(_0x58ab02,_0xe65354){if(_['isUndefined'](_0x2b7084)&&typeof _0x2b7084!=='object'){return _0xe65354(msgResponse(_0x52f5('0x16a'),_0x52f5('0x9a'),_0x52f5('0x16b')));}if(_['isUndefined'](_0x35f70b[_0x52f5('0x16c')])||_0x35f70b['phone']===null){return _0xe65354(msgResponse('originate',_0x52f5('0x9a'),_0x52f5('0x16d')));}var _0x39ec5d={'XMD-CALLERID':_0x34d011[_0x52f5('0x27')][_0x488065][_0x52f5('0x16e')](),'XMD-AGI':_0x2b7084['dialQueueProject']?util['format'](_0x52f5('0x16f'),ipAgi,_0x2b7084[_0x52f5('0x13e')]):_0x52f5('0x170'),'XMD-AGIAFTER':_0x2b7084[_0x52f5('0xcc')]?util[_0x52f5('0x4c')](_0x52f5('0x16f'),ipAgi,_0x2b7084[_0x52f5('0xcc')]):_0x52f5('0x170'),'XMD-QUEUE':utils[_0x52f5('0x171')](_0x2b7084)?util[_0x52f5('0x4c')](_0x52f5('0x172'),_0x2b7084[_0x52f5('0x4e')],_0x2b7084['dialQueueOptions']||'',_0x2b7084[_0x52f5('0xcd')]?'c':'',_0x2b7084[_0x52f5('0xd4')]||0x3):'NONE','XMD-CONTACTID':_0x35f70b[_0x52f5('0xf4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x34d011['actions'][_0x488065][_0x52f5('0x16e')](),'XMD-AMD':_0x2b7084[_0x52f5('0x11b')]?_0x52f5('0x14d'):_0x52f5('0x170'),'XMD-DESTINATION':_0x52f5('0x11a')};if(_0x2b7084[_0x52f5('0x11b')]){_0x39ec5d[_0x52f5('0x173')]=_0x2b7084['dialAMDInitialSilence']||0x9c4;_0x39ec5d[_0x52f5('0x174')]=_0x2b7084[_0x52f5('0x175')]||0x5dc;_0x39ec5d[_0x52f5('0x176')]=_0x2b7084[_0x52f5('0x177')]||0x320;_0x39ec5d[_0x52f5('0x178')]=_0x2b7084[_0x52f5('0x179')]||0x1388;_0x39ec5d['XMD-AMDMINWORDLENGTH']=_0x2b7084['dialAMDMinWordLength']||0x64;_0x39ec5d[_0x52f5('0x17a')]=_0x2b7084[_0x52f5('0x17b')]||0x32;_0x39ec5d[_0x52f5('0x17c')]=_0x2b7084[_0x52f5('0x17d')]||0x3;_0x39ec5d[_0x52f5('0x17e')]=_0x2b7084[_0x52f5('0x17f')]||0x100;_0x39ec5d['XMD-AMDMAXIMUMWORDLENGTH']=_0x2b7084[_0x52f5('0x180')]||0x1388;}if(utils[_0x52f5('0x171')](_0x2b7084)){_0x39ec5d[_0x52f5('0x181')]=_0x35f70b[_0x52f5('0xe4')];}else{_0x39ec5d['XMD-CAMPAIGNID']=_0x35f70b[_0x52f5('0xe5')];}var _0x471dea=utils[_0x52f5('0x182')](_0x35f70b['Contact']);Object[_0x52f5('0x151')](_0x39ec5d,_0x471dea);var _0x56f406=_0x34d011['isTrunkReachable'](_0x2b7084[_0x52f5('0x183')])?utils[_0x52f5('0x184')](_0x2b7084[_0x52f5('0x183')][_0x52f5('0x185')],_0x2b7084[_0x52f5('0x186')],_0x2b7084[_0x52f5('0x187')]>0x0?utils[_0x52f5('0x188')](_0x2b7084['dialOriginateCallerIdNumber'],_0x2b7084[_0x52f5('0x187')]):_0x2b7084[_0x52f5('0x189')]):utils[_0x52f5('0x184')](_['isNil'](_0x2b7084[_0x52f5('0x18a')])?_0x2b7084[_0x52f5('0x183')][_0x52f5('0x185')]:_0x2b7084[_0x52f5('0x18a')][_0x52f5('0x185')],_0x2b7084[_0x52f5('0x186')],_0x2b7084[_0x52f5('0x187')]>0x0?utils['getCallerIdRandom'](_0x2b7084[_0x52f5('0x189')],_0x2b7084[_0x52f5('0x187')]):_0x2b7084[_0x52f5('0x189')]);if(_0x56f406){_0x39ec5d[_0x52f5('0x18b')]=_0x34d011[_0x52f5('0x27')][_0x488065][_0x52f5('0x18c')]=utils[_0x52f5('0x18d')](_0x56f406);_0x39ec5d[_0x52f5('0x18e')]=_0x35f70b['phone'];}_0x2b7084[_0x52f5('0x18f')]=_0x39ec5d;return ami['Action']({'actionid':_0x488065,'action':'originate','channel':_0x34d011[_0x52f5('0x8e')](_0x2b7084['Trunk'])?util[_0x52f5('0x4c')]('SIP/%s/%s%s',_0x2b7084[_0x52f5('0x183')]['name'],isNotNull(_0x2b7084[_0x52f5('0x190')])?_0x2b7084[_0x52f5('0x190')][_0x52f5('0x191')]()||'':'',_0x2b7084[_0x52f5('0x192')]>0x0?_0x35f70b[_0x52f5('0x16c')][_0x52f5('0x193')](_0x2b7084[_0x52f5('0x192')]):_0x35f70b[_0x52f5('0x16c')]):util[_0x52f5('0x4c')]('SIP/%s/%s%s',_['isNil'](_0x2b7084['TrunkBackup'])?_0x2b7084['Trunk'][_0x52f5('0x4e')]:_0x2b7084[_0x52f5('0x18a')][_0x52f5('0x4e')],isNotNull(_0x2b7084[_0x52f5('0x190')])?_0x2b7084[_0x52f5('0x190')][_0x52f5('0x191')]()||'':'',_0x2b7084[_0x52f5('0x192')]>0x0?_0x35f70b['phone']['substring'](_0x2b7084['dialCutDigit']):_0x35f70b[_0x52f5('0x16c')]),'callerid':_0x56f406,'Exten':_0x52f5('0x11a'),'Context':_0x52f5('0x194'),'Priority':'1','variable':_0x39ec5d,'timeout':(_0x2b7084[_0x52f5('0x195')]||0x1e)*0x3e8,'async':!![],'channelid':_0x488065})[_0x52f5('0x43')](function(_0x6ff629){return _0x58ab02(_0x6ff629);})['catch'](function(_0x494024){_0x2b7084[_0x52f5('0x196')]+=0x1;var _0x15eb30=new History(_0x34d011[_0x52f5('0x27')][_0x488065]);logger[_0x52f5('0x6f')](util[_0x52f5('0x4c')]('[originateError]:\x20%s',JSON[_0x52f5('0x7e')](_0x494024)));_0x15eb30[_0x52f5('0xdc')]=0xe;_0x15eb30[_0x52f5('0x78')]=_0x52f5('0x197');_0x15eb30[_0x52f5('0x7a')]=moment()[_0x52f5('0x4c')](_0x52f5('0xc8'));_0x15eb30[_0x52f5('0x79')]=_0x15eb30['starttime'];hopperUtils[_0x52f5('0xce')](_0x15eb30)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x198')));_0x34d011[_0x52f5('0x13c')](_0x15eb30)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x198')))[_0x52f5('0x1f')](function(){delete _0x34d011[_0x52f5('0x27')][_0x488065];return _0xe65354(msgResponse(_0x52f5('0x16a'),_0x52f5('0xc3'),_0x52f5('0x199')));});});});};Dialer[_0x52f5('0x1c')][_0x52f5('0x19a')]=function(_0x4bdb0f,_0xe41e2e,_0x4df605){var _0x788f5a=new History(_0xe41e2e);if(_0x788f5a[_0x52f5('0x12b')]+_0x788f5a['countcongestionretry']+_0x788f5a['countnoanswerretry']+_0x788f5a[_0x52f5('0x12e')]+_0x788f5a['countdropretry']+_0x788f5a[_0x52f5('0xef')]+_0x788f5a[_0x52f5('0x129')]+_0x788f5a[_0x52f5('0x12f')]>=_0x4df605[_0x52f5('0x130')]-0x1){return!![];}switch(_0x4bdb0f){case 0x3:if(_0x788f5a['countnoanswerretry']>=_0x4df605[_0x52f5('0x19b')]-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countnoanswerretry':_0x788f5a[_0x52f5('0x12d')]+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605['dialNoAnswerRetryFrequency'],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a[_0x52f5('0xe3')],'VoiceQueueId':_0x788f5a[_0x52f5('0xe4')]||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x19c')));break;case 0x5:if(_0x788f5a[_0x52f5('0x12b')]>=_0x4df605[_0x52f5('0x19d')]-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countbusyretry':_0x788f5a['countbusyretry']+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605[_0x52f5('0x19e')],_0x52f5('0xe2'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x788f5a['ContactId'],'ListId':_0x788f5a[_0x52f5('0xe3')],'VoiceQueueId':_0x788f5a[_0x52f5('0xe4')]||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x19f')));break;case 0x8:if(_0x788f5a[_0x52f5('0x12c')]>=_0x4df605['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countcongestionretry':_0x788f5a[_0x52f5('0x12c')]+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605[_0x52f5('0x1a0')],'minutes')[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a[_0x52f5('0xe3')],'VoiceQueueId':_0x788f5a[_0x52f5('0xe4')]||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x788f5a[_0x52f5('0x12e')]>=_0x4df605['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x52f5('0xe1')]({'active':![],'countnosuchnumberretry':_0x788f5a['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4df605[_0x52f5('0x1a1')],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a['ListId'],'VoiceQueueId':_0x788f5a['VoiceQueueId']||undefined,'CampaignId':_0x788f5a['CampaignId']||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1a2')));}break;case 0xa:if(_0x788f5a[_0x52f5('0xd9')]>=_0x4df605[_0x52f5('0xdf')]-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countdropretry':_0x788f5a[_0x52f5('0xd9')]+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605[_0x52f5('0x1a3')],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a['ListId'],'VoiceQueueId':_0x788f5a['VoiceQueueId']||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xe6')));break;case 0xb:if(_0x788f5a[_0x52f5('0xef')]>=_0x4df605[_0x52f5('0xf2')]-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countabandonedretry':_0x788f5a[_0x52f5('0xef')]+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605['dialAbandonedRetryFrequency'],_0x52f5('0xe2'))[_0x52f5('0x4c')](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a[_0x52f5('0xe3')],'VoiceQueueId':_0x788f5a['VoiceQueueId']||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xf5')));break;case 0x13:if(_0x788f5a[_0x52f5('0x129')]>=_0x4df605[_0x52f5('0x139')]-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countmachineretry':_0x788f5a['countmachineretry']+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605[_0x52f5('0x13a')],_0x52f5('0xe2'))['format'](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a['ListId'],'VoiceQueueId':_0x788f5a['VoiceQueueId']||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1a4')));break;case 0x14:if(_0x788f5a[_0x52f5('0x12f')]>=_0x4df605['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x52f5('0xe1')]({'active':![],'countagentrejectretry':_0x788f5a[_0x52f5('0x12f')]+=0x1,'scheduledat':moment()[_0x52f5('0xf3')](_0x4df605['dialAgentRejectRetryFrequency'],_0x52f5('0xe2'))['format'](_0x52f5('0xc8')),'ContactId':_0x788f5a[_0x52f5('0xf4')],'ListId':_0x788f5a['ListId'],'VoiceQueueId':_0x788f5a['VoiceQueueId']||undefined,'CampaignId':_0x788f5a[_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1a5')));break;default:return!![];}};Dialer[_0x52f5('0x1c')][_0x52f5('0x1a6')]=function(_0x3f59f8,_0x48535f,_0x5cdfce){var _0x5dc3b7=this;var _0x34137a=new History(_0x3f59f8);var _0x9e40f5=![];var _0x5a51f5;var _0x4d0045;return new Promise(function(_0x394bdd,_0x43a57c){if(_['isUndefined'](_0x48535f)&&typeof _0x48535f!=='object'){return _0x43a57c(msgResponse(_0x52f5('0x1a7'),_0x52f5('0x9a'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x5cdfce)&&typeof _0x5cdfce!==_0x52f5('0x1a8')){return _0x43a57c(msgResponse(_0x52f5('0x1a7'),_0x52f5('0x9a'),_0x52f5('0x1a9')));}hopperUtils['verifyAdditionalPhones'](_0x34137a,_0x5cdfce[_0x52f5('0xc9')],_0x48535f)[_0x52f5('0x43')](function(_0x5b2917){if(_0x5b2917[_0x52f5('0xde')]==0x1)_0x9e40f5=!![];switch(_0x5cdfce['reason']){case'0':_0x48535f['outboundNoSuchCallsDay']+=0x1;_0x34137a[_0x52f5('0xdc')]=0x0;_0x34137a[_0x52f5('0x78')]=_0x52f5('0x1aa');_0x34137a[_0x52f5('0x12e')]+=0x1;_0x34137a['countglobal']+=0x1;ami[_0x52f5('0x46')](_0x52f5('0x1ab'),ut['buildObj'](_0x3f59f8,_0x52f5('0x1ac')));_0x5a51f5=_0x48535f[_0x52f5('0x1a1')];_0x4d0045=_0x48535f[_0x52f5('0xdb')];hopperUtils['createHistory'](_0x34137a)['catch'](loggerCatch(_0x52f5('0x12a')));if(_0x5dc3b7['checkRetriveMax'](0x0,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a['countnosuchnumberretry']>=_0x48535f[_0x52f5('0x1ad')]){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1ae'));}else{_0x5dc3b7['stateGlobal'](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1ae'));}}break;case'3':_0x48535f[_0x52f5('0x1af')]+=0x1;_0x34137a['state']=0x3;_0x34137a[_0x52f5('0x78')]=_0x52f5('0x1b0');_0x34137a[_0x52f5('0x12d')]+=0x1;_0x34137a[_0x52f5('0xda')]+=0x1;var _0x20afa6=ut[_0x52f5('0x1b1')](_0x3f59f8,_0x48535f);ami['emit']('custom:agentnoanswer',_0x20afa6);_0x5a51f5=_0x48535f[_0x52f5('0x1b2')];_0x4d0045=_0x48535f[_0x52f5('0xdb')];hopperUtils[_0x52f5('0xce')](_0x34137a)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1b3')));if(_0x5dc3b7[_0x52f5('0x19a')](0x3,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a[_0x52f5('0x12d')]>=_0x48535f['dialNoAnswerMaxRetry']){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1b4'));}else{_0x5dc3b7[_0x52f5('0x131')](_0x34137a,_0x394bdd,_0x43a57c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x48535f[_0x52f5('0x1b5')]+=0x1;_0x34137a[_0x52f5('0xdc')]=0x5;_0x34137a[_0x52f5('0x78')]=_0x52f5('0x1b6');_0x34137a[_0x52f5('0x12b')]+=0x1;_0x34137a[_0x52f5('0xda')]+=0x1;ami[_0x52f5('0x46')](_0x52f5('0x1b7'),ut['buildObj'](_0x3f59f8,'busy'));_0x5a51f5=_0x48535f[_0x52f5('0x19e')];_0x4d0045=_0x48535f[_0x52f5('0xdb')];hopperUtils['createHistory'](_0x34137a)['catch'](loggerCatch(_0x52f5('0x1b8')));if(_0x5dc3b7[_0x52f5('0x19a')](0x5,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a[_0x52f5('0x12b')]>=_0x48535f[_0x52f5('0x19d')]){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1b9'));}else{_0x5dc3b7[_0x52f5('0x131')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1b9'));}}break;case'8':_0x48535f[_0x52f5('0x1ba')]+=0x1;_0x34137a['state']=0x8;_0x34137a[_0x52f5('0x78')]=_0x52f5('0x1bb');_0x34137a[_0x52f5('0x12c')]+=0x1;_0x34137a[_0x52f5('0xda')]+=0x1;_0x5a51f5=_0x48535f[_0x52f5('0x1a0')];_0x4d0045=_0x48535f[_0x52f5('0xdb')];ami[_0x52f5('0x46')]('custom:agentcongestion',ut['buildObj'](_0x3f59f8,_0x52f5('0x1bc')));hopperUtils[_0x52f5('0xce')](_0x34137a)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1bd')));if(_0x5dc3b7[_0x52f5('0x19a')](0x8,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a['countcongestionretry']>=_0x48535f[_0x52f5('0x1be')]){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1bf'));}else{_0x5dc3b7[_0x52f5('0x131')](_0x34137a,_0x394bdd,_0x43a57c,'reason\x208\x20congestion');}}break;case'11':_0x48535f['outboundAbandonedCallsDay']+=0x1;_0x34137a[_0x52f5('0xdc')]=0xb;_0x34137a[_0x52f5('0x78')]=_0x52f5('0xec');_0x34137a['countabandonedretry']+=0x1;_0x34137a[_0x52f5('0xda')]+=0x1;_0x5a51f5=_0x48535f[_0x52f5('0xf0')];_0x4d0045=_0x48535f['callAdditionalPhoneAfterMin'];hopperUtils[_0x52f5('0xce')](_0x34137a)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0xf7')));if(_0x5dc3b7['checkRetriveMax'](0xb,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a[_0x52f5('0xef')]>=_0x48535f[_0x52f5('0xf2')]){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1c0'));}else{_0x5dc3b7['stateGlobal'](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1c0'));}}break;case'20':_0x48535f[_0x52f5('0x1c1')]+=0x1;_0x34137a['state']=0x14;_0x34137a[_0x52f5('0x78')]='AgentReject';_0x34137a[_0x52f5('0x12f')]+=0x1;_0x34137a[_0x52f5('0xda')]+=0x1;_0x5a51f5=_0x48535f[_0x52f5('0x1c2')];_0x4d0045=_0x48535f[_0x52f5('0xdb')];ami[_0x52f5('0x46')](_0x52f5('0x1c3'),ut[_0x52f5('0x120')](_0x3f59f8,_0x52f5('0x1c4')));hopperUtils[_0x52f5('0xce')](_0x34137a)[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1c5')));if(_0x5dc3b7[_0x52f5('0x19a')](0x14,_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a['countagentrejectretry']>=_0x48535f['dialAgentRejectMaxRetry']){_0x5dc3b7[_0x52f5('0x133')](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1c6'));}else{_0x5dc3b7['stateGlobal'](_0x34137a,_0x394bdd,_0x43a57c,_0x52f5('0x1c6'));}}break;default:_0x48535f[_0x52f5('0x142')]+=0x1;_0x34137a['state']=0xc;_0x34137a[_0x52f5('0x78')]=_0x5cdfce[_0x52f5('0xc9')];_0x5a51f5=_0x48535f['dialAgentRejectRetryFrequency'];_0x4d0045=_0x48535f[_0x52f5('0xdb')];hopperUtils[_0x52f5('0xce')](_0x34137a)['catch'](loggerCatch(_0x52f5('0x1c7')));if(_0x5dc3b7[_0x52f5('0x19a')](_0x5cdfce[_0x52f5('0xc9')],_0x3f59f8,_0x48535f)&&!_0x9e40f5){if(_0x34137a['countbusyretry']+_0x34137a['countcongestionretry']+_0x34137a[_0x52f5('0x12d')]+_0x34137a[_0x52f5('0x12e')]+_0x34137a[_0x52f5('0xd9')]+_0x34137a[_0x52f5('0xef')]+_0x34137a[_0x52f5('0x129')]+_0x34137a[_0x52f5('0x12f')]>=_0x48535f[_0x52f5('0x130')]){_0x5dc3b7[_0x52f5('0x131')](_0x34137a,_0x394bdd,_0x43a57c,_0x5cdfce['reason']);}else{_0x5dc3b7['createStateFinal'](_0x34137a,_0x394bdd,_0x43a57c,_0x5cdfce[_0x52f5('0xc9')]);}}}})[_0x52f5('0x43')](function(){if(_0x9e40f5){hopperUtils[_0x52f5('0xe9')](_0x34137a,_0x5a51f5,_0x4d0045)[_0x52f5('0x43')](function(){return _0x394bdd(0x1);});}});});};Dialer['prototype'][_0x52f5('0x131')]=function(_0x3d130f,_0x5d48dc,_0x419dad,_0x143bde){var _0x4a0bb6=new Final(_0x3d130f);_0x4a0bb6[_0x52f5('0xdc')]=0xf;_0x4a0bb6[_0x52f5('0x78')]=_0x52f5('0x1c8');this['createStateFinal'](_0x4a0bb6,_0x5d48dc,_0x419dad,_0x143bde);};Dialer[_0x52f5('0x1c')][_0x52f5('0x133')]=function(_0x3afa2e,_0x544b8b,_0x3dca6b,_0x538896){hopperUtils['moveContactManagedDialer'](_0x3afa2e)[_0x52f5('0x43')](function(){return _0x544b8b(msgResponse(_0x52f5('0x1a7'),_0x52f5('0x116'),_0x538896));})[_0x52f5('0xa8')](function(){return _0x3dca6b(msgResponse(_0x52f5('0x1c9'),'Failure',_0x52f5('0x1ca')));});};Dialer[_0x52f5('0x1c')][_0x52f5('0xc')]=function(_0x1a2cf7){var _0x28f31c=_0x1a2cf7['dialPredictiveOptimizationPercentage']/0x64;var _0x49e751=_0x1a2cf7[_0x52f5('0xd5')]/(_0x1a2cf7[_0x52f5('0xd5')]+_0x1a2cf7[_0x52f5('0x11c')]);var _0x23fb12=Math[_0x52f5('0x1cb')](_0x1a2cf7[_0x52f5('0x1cc')]*(_0x1a2cf7[_0x52f5('0x1cd')]/0x64));var _0x40fd01=Math[_0x52f5('0x1cb')](_0x1a2cf7[_0x52f5('0x1cc')]*(_0x1a2cf7[_0x52f5('0x1ce')]/0x64));var _0x59ceae=_0x1a2cf7[_0x52f5('0x14a')]+_0x1a2cf7[_0x52f5('0x14b')];var _0x3791e8=Math[_0x52f5('0x1cf')](_0x1a2cf7[_0x52f5('0x64')]*_0x1a2cf7[_0x52f5('0x66')]*_0x1a2cf7[_0x52f5('0x1d0')]*_0x1a2cf7[_0x52f5('0x1d1')]);if(_[_0x52f5('0x45')](_0x1a2cf7[_0x52f5('0x6a')])){if(!_[_0x52f5('0x45')](_0x1a2cf7[_0x52f5('0x2b')])){_0x1a2cf7[_0x52f5('0x2b')]=undefined;loggerPredictive['error'](_0x52f5('0x1d2'),_0x52f5('0x1d3'));}if(!_['isUndefined'](_0x1a2cf7[_0x52f5('0x6d')])){loggerPredictive[_0x52f5('0x6f')](_0x52f5('0x1d2'),_0x52f5('0x1d4'));clearInterval(_0x1a2cf7[_0x52f5('0x6d')]);_0x1a2cf7[_0x52f5('0x6d')]=undefined;}_0x1a2cf7[_0x52f5('0x6a')]=moment()[_0x52f5('0x4c')](_0x52f5('0xc8'));loggerPredictive[_0x52f5('0x52')](_0x1a2cf7[_0x52f5('0x4e')],_0x52f5('0x1d5'),_0x1a2cf7[_0x52f5('0x6a')]);this[_0x52f5('0xb5')](_0x1a2cf7,0x1);}else if(ifInterval(_0x1a2cf7[_0x52f5('0x1d6')],_0x1a2cf7['startProgressive'])){this[_0x52f5('0xb5')](_0x1a2cf7,0x1);loggerPredictiveCalls[_0x52f5('0x52')](_0x52f5('0x1d7'),_0x1a2cf7[_0x52f5('0x6a')],_0x1a2cf7[_0x52f5('0x4e')]);_0x1a2cf7[_0x52f5('0x64')]=0x0;_0x1a2cf7[_0x52f5('0xd6')]=0x0;}else if(_0x28f31c<_0x49e751&&_0x1a2cf7[_0x52f5('0x1d8')]==='dropRate'){clearPredictiveAttributes(_0x1a2cf7);loggerPredictive[_0x52f5('0x52')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x52f5('0x1d9'),_0x49e751,_0x52f5('0x6a'),_0x1a2cf7[_0x52f5('0x4e')]);}else if(_0x3791e8<_0x1a2cf7['predictiveIntervalErlangCallsDroppedCalls']&&_0x1a2cf7[_0x52f5('0x1d8')]===_0x52f5('0x1da')){clearPredictiveAttributes(_0x1a2cf7);loggerPredictive['info'](_0x52f5('0x1db'),_0x52f5('0x1dc'),_0x3791e8,_0x52f5('0x1dd'),_0x1a2cf7[_0x52f5('0xd6')],_0x52f5('0x6a'),_0x1a2cf7[_0x52f5('0x4e')]);}else if(!ifInterval(_0x1a2cf7[_0x52f5('0x1d6')],_0x1a2cf7[_0x52f5('0x6a')])&&_['isUndefined'](_0x1a2cf7[_0x52f5('0x2b')])&&!_['isUndefined'](_0x1a2cf7[_0x52f5('0x6a')])){_0x1a2cf7['startPredictive']=moment()['format'](_0x52f5('0xc8'));loggerPredictive[_0x52f5('0x52')](_0x1a2cf7['name'],'started\x20in\x20predictive\x20at',_0x1a2cf7[_0x52f5('0x2b')]);hopperUtils['avgHandleTime'](_0x1a2cf7[_0x52f5('0x1d6')])[_0x52f5('0x43')](this[_0x52f5('0x1de')](_0x1a2cf7))['then'](mergeDataErlangB(_0x1a2cf7))[_0x52f5('0x43')](this[_0x52f5('0x1df')](_0x1a2cf7))[_0x52f5('0xa8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1a2cf7));}else if(!ifInterval(_0x1a2cf7['dialPredictiveInterval'],_0x1a2cf7[_0x52f5('0x2b')])){_0x1a2cf7[_0x52f5('0xd6')]=0x0;_0x1a2cf7[_0x52f5('0x2b')]=moment()[_0x52f5('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x52f5('0x52')](_0x1a2cf7[_0x52f5('0x4e')],'recalculate\x20predictive\x20at',_0x1a2cf7[_0x52f5('0x2b')]);clearInterval(_0x1a2cf7[_0x52f5('0x6d')]);_0x1a2cf7[_0x52f5('0x6d')]=undefined;hopperUtils['avgHandleTime'](_0x1a2cf7[_0x52f5('0x1d6')])['then'](this[_0x52f5('0x1de')](_0x1a2cf7))[_0x52f5('0x43')](mergeDataErlangB(_0x1a2cf7))[_0x52f5('0x43')](this[_0x52f5('0x1df')](_0x1a2cf7))['catch'](loggerCatchPredictive(_0x52f5('0x1e0'),_0x1a2cf7));}else if(_0x1a2cf7[_0x52f5('0x1cc')]&&_0x59ceae<_0x1a2cf7[_0x52f5('0x1cc')]-_0x40fd01){clearPredictiveAttributes(_0x1a2cf7);loggerPredictive[_0x52f5('0x52')](_0x1a2cf7[_0x52f5('0x4e')],_0x52f5('0x1e1'),_0x59ceae,_0x52f5('0x1e2'),_0x1a2cf7[_0x52f5('0x1cc')],'-',_0x40fd01,'=',_0x1a2cf7[_0x52f5('0x1cc')]-_0x40fd01,')');}else if(_0x1a2cf7[_0x52f5('0x1cc')]&&_0x59ceae>_0x1a2cf7[_0x52f5('0x1cc')]+_0x23fb12){clearPredictiveAttributes(_0x1a2cf7);loggerPredictive[_0x52f5('0x52')](_0x1a2cf7['name'],_0x52f5('0x1e1'),_0x59ceae,_0x52f5('0x1e3'),_0x1a2cf7[_0x52f5('0x1cc')],'+',_0x23fb12,'=',_0x1a2cf7[_0x52f5('0x1cc')]+_0x23fb12,')');}};Dialer[_0x52f5('0x1c')][_0x52f5('0x1de')]=function(_0x151de9){var _0x1998c8=this;return function(_0x3fd0cb){return new Promise(function(_0x38ee92,_0xf470e1){_[_0x52f5('0x69')](_0x151de9,_0x3fd0cb[0x0]);if(checkGetDataPredictive(_0x3fd0cb[0x0])){var _0x165df2=_0x151de9[_0x52f5('0x1cc')]=_0x151de9['talking']+_0x151de9['available'];var _0x117cd4=_0x151de9['dialPredictiveInterval']*0x3c;var _0x1deaa3=_0x3fd0cb[0x0][_0x52f5('0x5c')]+_0x3fd0cb[0x0][_0x52f5('0x5f')];var _0x28db58=(_0x3fd0cb[0x0][_0x52f5('0x56')]+_0x3fd0cb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3fd0cb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3fd0cb[0x0]['predictiveIntervalTotalCalls'];_0x151de9['predictiveIntervalHitRate']=_0x28db58>0x0?_0x28db58:0x1;switch(_0x151de9[_0x52f5('0x1d8')]){case _0x52f5('0x1da'):var _0x12825a=_0x151de9['dialPredictiveOptimizationPercentage']/0x64;return _0x1998c8[_0x52f5('0x1e4')](_0x165df2,_0x117cd4,_0x1deaa3,_0x28db58,_0x12825a)[_0x52f5('0x43')](function(_0x5c6889){return _0x38ee92(_0x5c6889);});case _0x52f5('0x1e5'):var _0x6a02d1=_0x151de9[_0x52f5('0x1e6')]/0x64;return _0x1998c8[_0x52f5('0x1e7')](_0x165df2,_0x117cd4,_0x1deaa3,_0x28db58,_0x6a02d1)[_0x52f5('0x43')](function(_0x1974d2){return _0x38ee92(_0x1974d2);});default:return _0xf470e1(msgResponse(_0x52f5('0x1e8'),_0x52f5('0x9a'),_0x52f5('0x1e9')));}}else{return _0xf470e1(msgResponse('[getDataPredictive]',_0x52f5('0x9a'),'check\x20failure'));}});};};Dialer[_0x52f5('0x1c')][_0x52f5('0x1ea')]=function(_0x3997fb){var _0x3a5c80=this;return function(_0x3ec55){return new Promise(function(_0x504b77,_0x2cefe5){_['merge'](_0x3997fb,_0x3ec55[0x0]);if(checkGetDataPredictive(_0x3ec55[0x0])){loggerPredictive[_0x52f5('0x52')](JSON[_0x52f5('0x7e')](_0x3ec55[0x0]));if(_0x3997fb['dialPredictiveOptimization']===_0x52f5('0x1da')){return _0x3a5c80['getVoiceQueueRtPauses'](_0x3997fb['id'])['then'](function(_0x11d744){var _0x41de46=_0x3997fb[_0x52f5('0x1eb')]-_0x11d744[0x0][_0x52f5('0x1ec')];var _0x3dcb5d=_0x3997fb['dialPredictiveInterval']*0x3c;var _0x185cb4=_0x3ec55[0x0][_0x52f5('0x5c')]+_0x3ec55[0x0][_0x52f5('0x5f')];var _0x4ceafd=(_0x3ec55[0x0][_0x52f5('0x56')]+_0x3ec55[0x0][_0x52f5('0x58')]+_0x3ec55[0x0][_0x52f5('0xea')])/_0x3ec55[0x0]['predictiveIntervalTotalCalls'];var _0x1b4804=_0x3997fb['dialPredictiveOptimizationPercentage']/0x64;_0x3997fb['predictiveIntervalPauses']=_0x11d744[0x0][_0x52f5('0x1ec')]||0x0;_0x3997fb[_0x52f5('0x1d0')]=_0x4ceafd>0x0?_0x4ceafd:0x1;return _0x3a5c80['abandonmentRate'](_0x41de46,_0x3dcb5d,_0x185cb4,_0x4ceafd,_0x1b4804);})['then'](function(_0x56ff77){return _0x504b77(_0x56ff77);})[_0x52f5('0xa8')](function(_0x2a6856){return _0x2cefe5(msgResponse(_0x52f5('0x1ed'),'Failure',JSON['stringify'](_0x2a6856)));});}if(_0x3997fb['dialPredictiveOptimization']===_0x52f5('0x1e5')){return _0x3a5c80[_0x52f5('0x15d')](_0x3997fb['id'])['then'](function(_0x595a98){var _0x3a8cd0=_0x3997fb[_0x52f5('0x1eb')]-_0x595a98[0x0][_0x52f5('0x1ec')];var _0x5ee5a4=_0x3997fb['dialPredictiveInterval']*0x3c;var _0x23bb36=_0x3ec55[0x0][_0x52f5('0x5c')]+_0x3ec55[0x0][_0x52f5('0x5f')];var _0x37eaf3=(_0x3ec55[0x0][_0x52f5('0x56')]+_0x3ec55[0x0][_0x52f5('0x58')]+_0x3ec55[0x0][_0x52f5('0xea')])/_0x3ec55[0x0][_0x52f5('0x54')];var _0x5c8114=_0x3997fb[_0x52f5('0x1e6')]/0x64;_0x3997fb[_0x52f5('0x1ee')]=_0x595a98[0x0][_0x52f5('0x1ec')]||0x0;_0x3997fb[_0x52f5('0x1d0')]=_0x37eaf3>0x0?_0x37eaf3:0x1;return _0x3a5c80[_0x52f5('0x1e7')](_0x3a8cd0,_0x5ee5a4,_0x23bb36,_0x37eaf3,_0x5c8114);})[_0x52f5('0x43')](function(_0x74b133){return _0x504b77(_0x74b133);})['catch'](function(_0x34c117){return _0x2cefe5(msgResponse(_0x52f5('0x1ed'),'Failure',JSON[_0x52f5('0x7e')](_0x34c117)));});}}else{return _0x2cefe5(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x52f5('0x1c')][_0x52f5('0x1df')]=function(_0x2e8ebd){var _0x926715=this;return function(){var _0x1aede2=0x0;var _0x43c18e=Math[_0x52f5('0x1cf')](_0x2e8ebd[_0x52f5('0x1ef')]*0x3e8);if(_0x43c18e>0x0){_0x43c18e=_0x43c18e<0x64?0x64:_0x43c18e;loggerPredictive[_0x52f5('0x52')](_0x2e8ebd[_0x52f5('0x4e')],'one\x20call\x20every:',_0x43c18e,'milliseconds');_0x2e8ebd[_0x52f5('0x6d')]=setInterval(function(){_0x926715['handlePredictive'](_0x2e8ebd);loggerPredictiveCalls['info'](_0x52f5('0x1f0'),_0x1aede2+=0x1);},_0x43c18e);}else{loggerPredictive[_0x52f5('0x52')](_0x2e8ebd[_0x52f5('0x4e')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x52f5('0x1c')][_0x52f5('0x1f1')]=function(_0x3fc7d0,_0x2c3daa){var _0x368b34=this;return function(_0x4300ed){if(_[_0x52f5('0x50')](_0x4300ed)){if(_[_0x52f5('0xfd')](_0x2c3daa['UserId'])||!_0x2c3daa['recallme']){if(_0x3fc7d0['dialMethod']===_0x52f5('0xb')){_0x3fc7d0[_0x52f5('0x7b')]=_[_0x52f5('0x45')](_0x3fc7d0[_0x52f5('0x7b')])?!![]:_0x3fc7d0['queueStatusComplete'];var _0x2a44b3=uuid['v4']();_0x368b34[_0x52f5('0x27')][_0x2a44b3]=new Action(_0x3fc7d0,_0x2c3daa,_0x2a44b3);loggerBooked[_0x52f5('0x52')]('[booked][checkContactBlack]',_0x2a44b3,'queueStatusComplete:\x20',JSON[_0x52f5('0x7e')](_0x3fc7d0['queueStatusComplete']),_0x52f5('0x1f2'),_0x3fc7d0['name']);if(_0x3fc7d0['queueStatusComplete']){_0x3fc7d0[_0x52f5('0x7b')]=![];_0x368b34[_0x52f5('0x2d')][_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xc6')]]=[];ami[_0x52f5('0xa2')]({'actionid':_0x2a44b3,'action':_0x52f5('0x1f3'),'queue':_0x3fc7d0['name']})[_0x52f5('0xa8')](function(){_0x368b34[_0x52f5('0xc5')](_0x3fc7d0);hopperUtils[_0x52f5('0xe1')]({'active':![],'ContactId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xf4')],'ListId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xe3')],'VoiceQueueId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xe4')]||undefined,'CampaignId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1f4')));delete _0x368b34[_0x52f5('0x27')][_0x2a44b3];});}else{loggerBooked[_0x52f5('0x52')]('[booked][checkContactBlack][else]',JSON[_0x52f5('0x7e')](_0x3fc7d0[_0x52f5('0x7b')]),_0x52f5('0x1f2'),_0x3fc7d0[_0x52f5('0x4e')]);_0x368b34[_0x52f5('0xc5')](_0x3fc7d0);hopperUtils[_0x52f5('0xe1')]({'active':![],'ContactId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xf4')],'ListId':_0x368b34[_0x52f5('0x27')][_0x2a44b3]['ListId'],'VoiceQueueId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xe4')]||undefined,'CampaignId':_0x368b34[_0x52f5('0x27')][_0x2a44b3][_0x52f5('0xe5')]||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1f4')));delete _0x368b34[_0x52f5('0x27')][_0x2a44b3];}}else{return _0x368b34[_0x52f5('0x169')](_0x3fc7d0,_0x2c3daa);}}else{if(utils[_0x52f5('0xd2')](undefined,_0x2c3daa[_0x52f5('0x1f5')])<_0x3fc7d0[_0x52f5('0x1f6')]*0x3c){if(_0x2c3daa[_0x52f5('0x157')]&&!_0x2c3daa[_0x52f5('0x157')][_0x52f5('0x1f7')]){_0x368b34['preview'][_0x52f5('0x109')](_0x2c3daa['id'])['finally'](function(){_0x368b34[_0x52f5('0xc5')](_0x3fc7d0);});}else{hopperUtils[_0x52f5('0x1f8')]({'active':![]},_0x2c3daa['id'],0x1)[_0x52f5('0x1f')](function(){_0x368b34[_0x52f5('0xc5')](_0x3fc7d0);});}}else{_0x3fc7d0['outboundReCallsDay']+=0x1;_0x368b34['updateOriginated'](_0x3fc7d0);if(_0x3fc7d0[_0x52f5('0x1f9')]){hopperUtils[_0x52f5('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c3daa[_0x52f5('0xf4')],'ListId':_0x2c3daa[_0x52f5('0xe3')],'VoiceQueueId':_0x2c3daa[_0x52f5('0xe4')]||undefined,'CampaignId':_0x2c3daa['CampaignId']||undefined})[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1fa')));hopperUtils[_0x52f5('0xce')](createObjHistory(_0x3fc7d0,_0x2c3daa,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x52f5('0x1fb')))[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x1fc')));}else{_0x368b34[_0x52f5('0x122')](createObjHistory(_0x3fc7d0,_0x2c3daa,utils[_0x52f5('0x74')][_0x52f5('0x1fd')],0x16,_0x52f5('0x1fe')),_0x52f5('0x1ff'),'[Originate][HistoryRecallClose]');}}}}else{_0x3fc7d0[_0x52f5('0x200')]+=0x1;_0x368b34['saveInDb'](createObjHistory(_0x3fc7d0,_0x2c3daa,utils[_0x52f5('0x74')]['BLACKLIST'],0xd,_0x52f5('0x201')),_0x52f5('0x202'),'[Originate][MoveBlacklist]');throw _0x52f5('0x203');}};};Dialer[_0x52f5('0x1c')][_0x52f5('0x204')]=function(_0x149370){var _0x41c876=this;var _0xaa7686=_0x149370[_0x52f5('0x205')]-_0x149370[_0x52f5('0x15e')];emitCampaignSummary(_0x149370);if(_0xaa7686>0x0&&_0x149370[_0x52f5('0x206')]==0x0){if(_0xaa7686>this[_0x52f5('0x25')]){_0xaa7686=this['maxNumberOriginate'];}_0x149370[_0x52f5('0x206')]=0x1;hopperUtils['getContactDialerIvr'](_0x149370,_0xaa7686)[_0x52f5('0x43')](function(_0x1acf27){_0x149370[_0x52f5('0x206')]=0x0;if(_0x1acf27){if(!utils[_0x52f5('0x207')](_0x1acf27)){_0x149370[_0x52f5('0x73')]=utils[_0x52f5('0x74')]['NO_AVAILABLE_CONTACTS'];logger[_0x52f5('0x52')]('[getContactCampaign2][Empty]'+_0x149370[_0x52f5('0x4e')]);}else{_0x149370[_0x52f5('0x15e')]+=_0x1acf27[_0x52f5('0xa0')];_0x149370[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x208')];for(var _0x510e18=0x0;_0x510e18<_0x1acf27['length'];_0x510e18+=0x1){_0x149370[_0x52f5('0x209')]+=0x1;if(_[_0x52f5('0xfd')](_0x1acf27[_0x510e18])||_['isNil'](_0x1acf27[_0x510e18]['Contact'])||_[_0x52f5('0xfd')](_0x1acf27[_0x510e18][_0x52f5('0x16c')])){_0x41c876[_0x52f5('0x162')](_0x52f5('0x20a'),_0x149370,_0x1acf27[_0x510e18]);}else{hopperUtils[_0x52f5('0x20b')](_[_0x52f5('0x7f')](_0x1acf27[_0x510e18],[_0x52f5('0xe5'),_0x52f5('0x16c')]))[_0x52f5('0x43')](_0x41c876['checkContactBlack'](_0x149370,_0x1acf27[_0x510e18]))['catch'](_0x41c876[_0x52f5('0x161')](_0x52f5('0x20c'),_0x149370));}}}}})[_0x52f5('0xa8')](loggerGetContactDialer(_0x52f5('0x20d'),_0x149370,_0xaa7686));}};Dialer[_0x52f5('0x1c')][_0x52f5('0xb5')]=function(_0x562828,_0x115220){var _0x1f74ec=this;var _0x489d1a=[];if(_0x115220<0x1||_0x562828[_0x52f5('0xb3')]===_0x52f5('0xb')){_0x115220=0x1;}var _0x34cc36=Math['floor'](_0x562828[_0x52f5('0x14a')]*_0x115220)-_0x562828[_0x52f5('0x15e')];if(_0x562828[_0x52f5('0x20e')]>0x0){var _0x592d5d=_0x562828['dialLimitQueue']-_0x562828['originated']-_0x562828[_0x52f5('0x14b')]-_0x562828[_0x52f5('0x14c')];if(_0x34cc36>_0x592d5d){_0x34cc36=_0x592d5d;}}if(_0x34cc36>0x0&&_0x562828[_0x52f5('0x206')]==0x0){if(_0x562828[_0x52f5('0xb3')]==='booked'){_0x34cc36=0x1;}if(_0x34cc36>this['maxNumberOriginate']){_0x34cc36=this[_0x52f5('0x25')];}for(var _0x4ebbb7 in this[_0x52f5('0x23')]){if(typeof this[_0x52f5('0x23')][_0x4ebbb7]!==_0x52f5('0xb0')){if(this[_0x52f5('0x23')][_0x4ebbb7][_0x52f5('0xdc')]===_0x52f5('0x20f')&&this['agents'][_0x4ebbb7][_0x52f5('0x92')]===_0x52f5('0x91')){_0x489d1a[_0x52f5('0xa1')](this[_0x52f5('0x23')][_0x4ebbb7]['id']);}}}_0x562828['temp']=0x1;hopperUtils['getContactDialer'](_0x562828,_0x489d1a,_0x34cc36)[_0x52f5('0x43')](function(_0x222866){_0x562828['temp']=0x0;if(_0x222866){if(!utils[_0x52f5('0x207')](_0x222866)){hopperUtils[_0x52f5('0x210')](_0x562828)['then'](sendMessageReschedule(_0x562828))[_0x52f5('0xa8')](loggerCatch(_0x52f5('0x211')));}else{_0x562828[_0x52f5('0x15e')]+=_0x222866['length'];_0x562828[_0x52f5('0x73')]=_0x562828[_0x52f5('0xb3')]===_0x52f5('0xb')?utils[_0x52f5('0x74')]['ACTIVE']:utils[_0x52f5('0x74')][_0x52f5('0x208')];for(var _0x56aa1e=0x0;_0x56aa1e<_0x222866[_0x52f5('0xa0')];_0x56aa1e+=0x1){if(_[_0x52f5('0xfd')](_0x222866[_0x56aa1e])||_['isNil'](_0x222866[_0x56aa1e][_0x52f5('0x212')])||_[_0x52f5('0xfd')](_0x222866[_0x56aa1e][_0x52f5('0x16c')])){_0x1f74ec['emptyContact']('[actionOriginate]\x20',_0x562828,_0x222866[_0x56aa1e]);}else{hopperUtils['checkIsBlackList'](_[_0x52f5('0x7f')](_0x222866[_0x56aa1e],[_0x52f5('0xe4'),'phone']))[_0x52f5('0x43')](_0x1f74ec[_0x52f5('0x1f1')](_0x562828,_0x222866[_0x56aa1e]))['catch'](_0x1f74ec[_0x52f5('0x161')]('[actionOriginate]\x20',_0x562828));}}}}})[_0x52f5('0xa8')](loggerGetContactDialer(_0x52f5('0x213'),_0x562828,_0x34cc36));}};Dialer[_0x52f5('0x1c')][_0x52f5('0x6d')]=function(_0x5bc08d){if(_0x5bc08d[_0x52f5('0x20e')]>0x0){var _0x452d66=_0x5bc08d['dialLimitQueue']-_0x5bc08d['originated']-_0x5bc08d[_0x52f5('0x14b')];if(_0x452d66>0x0&&_0x5bc08d[_0x52f5('0x206')]==0x0){this[_0x52f5('0x214')](_0x5bc08d);}else{loggerPredictiveCalls[_0x52f5('0x52')](_0x52f5('0x215'));}}else{this['tryOriginatePredictive'](_0x5bc08d);}};Dialer['prototype'][_0x52f5('0x214')]=function(_0x2e2220){var _0x3c4249=this;var _0x1c1bc9=[];_0x2e2220[_0x52f5('0x15e')]+=0x1;for(var _0x2335a6 in this[_0x52f5('0x23')]){if(typeof this['agents'][_0x2335a6]!==_0x52f5('0xb0')){if(this[_0x52f5('0x23')][_0x2335a6]['state']===_0x52f5('0x20f')&&this[_0x52f5('0x23')][_0x2335a6]['status']===_0x52f5('0x91')){_0x1c1bc9[_0x52f5('0xa1')](this[_0x52f5('0x23')][_0x2335a6]['id']);}}}_0x2e2220[_0x52f5('0x206')]=0x1;return this['getContactDialer'](_0x2e2220['id'],_0x1c1bc9,0x1,_0x2e2220[_0x52f5('0x216')],_0x2e2220)[_0x52f5('0x43')](function(_0x55d178){_0x2e2220['temp']=0x1;if(_0x55d178){if(!utils[_0x52f5('0x207')](_0x55d178)){utils[_0x52f5('0x71')](_0x2e2220,0x1,0x0);return hopperUtils[_0x52f5('0x210')](_0x2e2220)[_0x52f5('0x43')](sendMessageReschedule(_0x2e2220))[_0x52f5('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x2e2220[_0x52f5('0x73')]=utils[_0x52f5('0x74')][_0x52f5('0x208')];if(_[_0x52f5('0xfd')](_0x55d178[0x0])||_[_0x52f5('0xfd')](_0x55d178[0x0][_0x52f5('0x212')])||_[_0x52f5('0xfd')](_0x55d178[0x0][_0x52f5('0x16c')])){_0x3c4249[_0x52f5('0x162')](_0x52f5('0x20a'),_0x2e2220,_0x55d178[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x52f5('0x7f')](_0x55d178[0x0],['VoiceQueueId',_0x52f5('0x16c')]))[_0x52f5('0x43')](_0x3c4249[_0x52f5('0x1f1')](_0x2e2220,_0x55d178[0x0]))[_0x52f5('0xa8')](_0x3c4249[_0x52f5('0x161')](_0x52f5('0x217'),_0x2e2220));}}}})['catch'](loggerGetContactDialer(_0x52f5('0x218'),_0x2e2220,0x1));};Dialer[_0x52f5('0x1c')]['abandonmentRate']=function(_0x280ed3,_0x53bfbc,_0x3b4e03,_0xdbbc7f,_0x57188c,_0x2f4d79){loggerPredictive['info'](_0x52f5('0x219'));loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21a'),_0x280ed3);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21b'),_0x53bfbc);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21c'),_0x3b4e03);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21d'),_0xdbbc7f);loggerPredictive['info'](_0x52f5('0x21e'),_0x57188c);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x5d'));return new Promise(function(_0x3f9705,_0x2a033f){if(_0x280ed3<=0x0||isNaN(_0x280ed3)){return _0x2a033f(msgResponse('[abandonmentRate]',_0x52f5('0xc3'),_0x52f5('0x21f')+_0x280ed3));}if(_0x3b4e03<=0x0||isNaN(_0x3b4e03)){return _0x2a033f(msgResponse(_0x52f5('0x220'),'Error',_0x52f5('0x221')+_0x3b4e03));}if(_0xdbbc7f<=0x0||isNaN(_0xdbbc7f)){return _0x2a033f(msgResponse(_0x52f5('0x220'),_0x52f5('0xc3'),'p\x20=\x20'+_0xdbbc7f));}if(_0x53bfbc<=0x0||isNaN(_0x53bfbc)){return _0x2a033f(msgResponse('[abandonmentRate]',_0x52f5('0xc3'),_0x52f5('0x222')+_0x53bfbc));}if(_0x57188c<=0x0||isNaN(_0x57188c)){return _0x2a033f(msgResponse(_0x52f5('0x220'),_0x52f5('0xc3'),'Amax\x20=\x20'+_0x57188c));}_0x2f4d79=_0x2f4d79||0x0;var _0x1d7524=0x1/_0x3b4e03;var _0x4294e3=0x0;var _0x46a874=0x0;var _0x48fb37=0x0;var _0x5e6e26=0x0;for(var _0x10cf25=0x0;_0x48fb37<_0x57188c;_0x10cf25+=0x1){_0x46a874=_0x10cf25/_0x53bfbc;_0x4294e3=(_0xdbbc7f*_0x46a874+_0x2f4d79)/_0x1d7524;_0x48fb37=utils[_0x52f5('0x223')](_0x4294e3,_0x280ed3);_0x5e6e26=_0x4294e3/_0x280ed3*(0x1-utils[_0x52f5('0x223')](_0x4294e3,_0x280ed3));}return _0x3f9705({'erlangCalls':_0x10cf25,'erlangCallToSecond':_0x53bfbc/_0x10cf25,'erlangAbandonmentRate':_0x48fb37,'erlangBusyFactor':_0x5e6e26});});};Dialer['prototype']['busyFactor']=function(_0x105668,_0x31c306,_0x2e465f,_0x46be76,_0xe9f55e,_0x10d505){loggerPredictive[_0x52f5('0x52')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21a'),_0x105668);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x21b'),_0x31c306);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e465f);loggerPredictive['info']('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',_0x46be76);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x224'),_0xe9f55e);loggerPredictive[_0x52f5('0x52')](_0x52f5('0x5d'));return new Promise(function(_0x51c741,_0x568fe2){if(_0x105668<=0x0||isNaN(_0x105668)){return _0x568fe2(msgResponse(_0x52f5('0x225'),_0x52f5('0xc3'),_0x52f5('0x21f')+_0x105668));}if(_0x2e465f<=0x0||isNaN(_0x2e465f)){return _0x568fe2(msgResponse(_0x52f5('0x225'),'Error',_0x52f5('0x221')+_0x2e465f));}if(_0x46be76<=0x0||isNaN(_0x46be76)){return _0x568fe2(msgResponse(_0x52f5('0x225'),'Error','p\x20=\x20'+_0x46be76));}if(_0x31c306<=0x0||isNaN(_0x31c306)){return _0x568fe2(msgResponse(_0x52f5('0x225'),_0x52f5('0xc3'),_0x52f5('0x222')+_0x31c306));}if(_0xe9f55e<=0x0||isNaN(_0xe9f55e)){return _0x568fe2(msgResponse(_0x52f5('0x225'),_0x52f5('0xc3'),_0x52f5('0x226')+_0xe9f55e));}_0x10d505=_0x10d505||0x0;var _0x51095e=0x1/_0x2e465f;var _0x51ad43=0x0;var _0x2be284=0x0;var _0x13ac8c=0x0;var _0x5d9c79=0x0;for(var _0x536c25=0x0;_0x5d9c79<_0xe9f55e;_0x536c25+=0x1){_0x2be284=_0x536c25/_0x31c306;_0x51ad43=(_0x46be76*_0x2be284+_0x10d505)/_0x51095e;_0x13ac8c=utils[_0x52f5('0x223')](_0x51ad43,_0x105668);_0x5d9c79=_0x51ad43/_0x105668*(0x1-utils[_0x52f5('0x223')](_0x51ad43,_0x105668));}return _0x51c741({'erlangCalls':_0x536c25,'erlangCallToSecond':_0x31c306/_0x536c25,'erlangAbandonmentRate':_0x13ac8c,'erlangBusyFactor':_0x5d9c79});});};module[_0x52f5('0x227')]=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 f0e6d3a..969e33a 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 _0x1657=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x24d288,_0x14ca69){var _0x4115f7=function(_0x1f3200){while(--_0x1f3200){_0x24d288['push'](_0x24d288['shift']());}};_0x4115f7(++_0x14ca69);}(_0x1657,0x6d));var _0x7165=function(_0x4c4ae4,_0x3ef806){_0x4c4ae4=_0x4c4ae4-0x0;var _0x430b4a=_0x1657[_0x4c4ae4];return _0x430b4a;};'use strict';var util=require(_0x7165('0x0'));var _=require(_0x7165('0x1'));var moment=require('moment');function checkNameSurname(_0x37a34f,_0x1cfceb,_0x35acda){var _0xcd7372='';if(!_[_0x7165('0x2')](_0x1cfceb)&&_0x7165('0x3')===typeof _0x1cfceb){_0xcd7372+=_0x1cfceb;}if(!_['isNil'](_0x35acda)&&_0x7165('0x3')===typeof _0x35acda){_0xcd7372+='\x20'+_0x35acda;}if(_0xcd7372!==''){return _0xcd7372;}return _0x37a34f;}function Action(_0x564753,_0x138e31,_0x17de3c){this[_0x7165('0x4')]=_0x564753;this[_0x7165('0x5')]=_0x17de3c||undefined;this[_0x7165('0x6')]=checkNameSurname(_0x138e31[_0x7165('0x7')][_0x7165('0x8')],_0x138e31[_0x7165('0x7')]['firstName'],_0x138e31[_0x7165('0x7')][_0x7165('0x9')]);this[_0x7165('0xa')]=_0x138e31[_0x7165('0x8')];this[_0x7165('0xb')]=_0x564753[_0x7165('0x6')];this[_0x7165('0xc')]=_0x138e31['active']||![];this[_0x7165('0xd')]=_0x564753['type'];this[_0x7165('0xe')]=_0x564753[_0x7165('0xe')]||0x3;this[_0x7165('0xf')]=_0x138e31[_0x7165('0xf')];this[_0x7165('0x10')]=_0x138e31[_0x7165('0x10')];this[_0x7165('0x11')]=_0x138e31['countcongestionretry'];this[_0x7165('0x12')]=_0x138e31[_0x7165('0x12')];this[_0x7165('0x13')]=_0x138e31['countnosuchnumberretry'];this[_0x7165('0x14')]=_0x138e31['countdropretry'];this['countabandonedretry']=_0x138e31[_0x7165('0x15')];this[_0x7165('0x16')]=_0x138e31['countmachineretry'];this[_0x7165('0x17')]=_0x138e31['countagentrejectretry'];this[_0x7165('0x18')]=_0x138e31[_0x7165('0x18')];this[_0x7165('0x19')]=_0x138e31[_0x7165('0x19')];this[_0x7165('0x1a')]=_0x138e31[_0x7165('0x1a')];this[_0x7165('0x1b')]=_0x138e31[_0x7165('0x1b')];this[_0x7165('0x1c')]=_0x138e31[_0x7165('0x1c')];this[_0x7165('0x1d')]=_0x138e31['id'];this[_0x7165('0x1e')]=_0x138e31[_0x7165('0x7')][_0x7165('0x1f')]||'';this['starttime']=moment()[_0x7165('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7165('0x21')]=_0x138e31['callback'];this[_0x7165('0x22')]=_0x138e31[_0x7165('0x22')];this[_0x7165('0x23')]=_0x138e31['callbackat'];this[_0x7165('0x24')]=_0x138e31[_0x7165('0x24')];this[_0x7165('0x25')]='';this[_0x7165('0x26')]='';}Action['prototype'][_0x7165('0x27')]=function(){return util[_0x7165('0x20')](_0x7165('0x28'),this[_0x7165('0x6')],this[_0x7165('0x4')][_0x7165('0x29')]>0x0?this[_0x7165('0xa')]['substring'](this[_0x7165('0x4')][_0x7165('0x29')]):this['number']);};Action[_0x7165('0x2a')][_0x7165('0x2b')]=function(){return this['queue'];};module[_0x7165('0x2c')]=Action; \ No newline at end of file +var _0x900f=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','isNil','string','voiceQueue','uniqueid','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x37d798,_0x483c95){var _0x402b46=function(_0x458651){while(--_0x458651){_0x37d798['push'](_0x37d798['shift']());}};_0x402b46(++_0x483c95);}(_0x900f,0x9b));var _0xf900=function(_0x2b9120,_0x4cba82){_0x2b9120=_0x2b9120-0x0;var _0x459db0=_0x900f[_0x2b9120];return _0x459db0;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2ecdbf,_0x3442a9,_0x1ba209){var _0x518258='';if(!_[_0xf900('0x0')](_0x3442a9)&&_0xf900('0x1')===typeof _0x3442a9){_0x518258+=_0x3442a9;}if(!_['isNil'](_0x1ba209)&&_0xf900('0x1')===typeof _0x1ba209){_0x518258+='\x20'+_0x1ba209;}if(_0x518258!==''){return _0x518258;}return _0x2ecdbf;}function Action(_0x524697,_0x5a177f,_0x4bacd1){this[_0xf900('0x2')]=_0x524697;this[_0xf900('0x3')]=_0x4bacd1||undefined;this['name']=checkNameSurname(_0x5a177f['Contact'][_0xf900('0x4')],_0x5a177f[_0xf900('0x5')][_0xf900('0x6')],_0x5a177f[_0xf900('0x5')][_0xf900('0x7')]);this[_0xf900('0x8')]=_0x5a177f['phone'];this[_0xf900('0x9')]=_0x524697['name'];this[_0xf900('0xa')]=_0x5a177f[_0xf900('0xa')]||![];this[_0xf900('0xb')]=_0x524697[_0xf900('0xb')];this[_0xf900('0xc')]=_0x524697[_0xf900('0xc')]||0x3;this[_0xf900('0xd')]=_0x5a177f[_0xf900('0xd')];this[_0xf900('0xe')]=_0x5a177f['countbusyretry'];this[_0xf900('0xf')]=_0x5a177f['countcongestionretry'];this[_0xf900('0x10')]=_0x5a177f[_0xf900('0x10')];this[_0xf900('0x11')]=_0x5a177f[_0xf900('0x11')];this[_0xf900('0x12')]=_0x5a177f[_0xf900('0x12')];this['countabandonedretry']=_0x5a177f[_0xf900('0x13')];this['countmachineretry']=_0x5a177f[_0xf900('0x14')];this[_0xf900('0x15')]=_0x5a177f[_0xf900('0x15')];this[_0xf900('0x16')]=_0x5a177f['ContactId'];this[_0xf900('0x17')]=_0x5a177f[_0xf900('0x17')];this[_0xf900('0x18')]=_0x5a177f[_0xf900('0x18')];this['VoiceQueueId']=_0x5a177f[_0xf900('0x19')];this[_0xf900('0x1a')]=_0x5a177f['CampaignId'];this[_0xf900('0x1b')]=_0x5a177f['id'];this[_0xf900('0x1c')]=_0x5a177f[_0xf900('0x5')]['firstName']||'';this[_0xf900('0x1d')]=moment()[_0xf900('0x1e')](_0xf900('0x1f'));this[_0xf900('0x20')]=_0x5a177f[_0xf900('0x20')];this[_0xf900('0x21')]=_0x5a177f[_0xf900('0x21')];this[_0xf900('0x22')]=_0x5a177f['callbackat'];this[_0xf900('0x23')]=_0x5a177f['recallme'];this[_0xf900('0x24')]='';this[_0xf900('0x25')]='';}Action['prototype'][_0xf900('0x26')]=function(){return util[_0xf900('0x1e')](_0xf900('0x27'),this['name'],this[_0xf900('0x2')][_0xf900('0x28')]>0x0?this[_0xf900('0x8')][_0xf900('0x29')](this['voiceQueue'][_0xf900('0x28')]):this['number']);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0xf900('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index cf037e1..43d848d 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 _0x8004=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x36e0b3,_0x97f10){var _0x2ba55c=function(_0x22072){while(--_0x22072){_0x36e0b3['push'](_0x36e0b3['shift']());}};_0x2ba55c(++_0x97f10);}(_0x8004,0x129));var _0x4800=function(_0x13c645,_0x2ed23b){_0x13c645=_0x13c645-0x0;var _0x2a09e2=_0x8004[_0x13c645];return _0x2a09e2;};'use strict';var moment=require(_0x4800('0x0'));var utils=require('../utils');function AgentComplete(_0x5577e8,_0x387051){this['state']=0x4;this['statedesc']=_0x4800('0x1');this[_0x4800('0x2')]=_0x5577e8[_0x4800('0x2')];this[_0x4800('0x3')]=_0x5577e8[_0x4800('0x3')];this[_0x4800('0x4')]=_0x5577e8['type']===_0x4800('0x5')?_0x4800('0x6'):_0x5577e8[_0x4800('0x3')];this['countbusyretry']=_0x5577e8[_0x4800('0x7')];this['countcongestionretry']=_0x5577e8[_0x4800('0x8')];this['countnoanswerretry']=_0x5577e8[_0x4800('0x9')];this[_0x4800('0xa')]=_0x5577e8[_0x4800('0x7')]+_0x5577e8[_0x4800('0x8')]+_0x5577e8[_0x4800('0x9')]+_0x5577e8[_0x4800('0xb')]+_0x5577e8[_0x4800('0xc')]+_0x5577e8[_0x4800('0xd')]+_0x5577e8[_0x4800('0xe')]+_0x5577e8[_0x4800('0xf')];this[_0x4800('0xb')]=_0x5577e8[_0x4800('0xb')];this[_0x4800('0xc')]=_0x5577e8[_0x4800('0xc')];this['countabandonedretry']=_0x5577e8['countabandonedretry'];this[_0x4800('0xe')]=_0x5577e8[_0x4800('0xe')];this['countagentrejectretry']=_0x5577e8[_0x4800('0xf')];this['uniqueid']=_0x387051[_0x4800('0x10')];this[_0x4800('0x11')]=_0x5577e8[_0x4800('0x12')];this['calleridnum']=_0x5577e8[_0x4800('0x13')];this['starttime']=_0x5577e8['starttime'];this[_0x4800('0x14')]=_0x5577e8[_0x4800('0x14')];this['answertime']=_0x5577e8[_0x4800('0x15')];this[_0x4800('0x16')]=moment()[_0x4800('0x17')](_0x4800('0x18'));this[_0x4800('0x19')]=utils[_0x4800('0x1a')](_0x5577e8[_0x4800('0x14')],_0x5577e8[_0x4800('0x1b')]);this[_0x4800('0x1c')]=utils[_0x4800('0x1a')](_0x5577e8['answertime'],_0x5577e8[_0x4800('0x14')]);this[_0x4800('0x1d')]=utils[_0x4800('0x1a')](this[_0x4800('0x16')],_0x5577e8[_0x4800('0x15')]);this[_0x4800('0x6')]=_0x387051['queue'];this['membername']=_0x387051[_0x4800('0x1e')];this['reason']=_0x387051[_0x4800('0x1f')];this[_0x4800('0x20')]=_0x5577e8[_0x4800('0x20')];this['callbackuniqueid']=_0x5577e8[_0x4800('0x21')];this['callbackat']=_0x5577e8[_0x4800('0x22')];this['recallme']=_0x5577e8[_0x4800('0x23')];this['ContactId']=_0x5577e8[_0x4800('0x24')];this['ListId']=_0x5577e8[_0x4800('0x25')];this['UserId']=_0x5577e8['UserId'];this[_0x4800('0x26')]=_0x5577e8[_0x4800('0x26')];this[_0x4800('0x27')]=_0x5577e8[_0x4800('0x27')];this['originatecalleridnum']=_0x5577e8[_0x4800('0x28')]||'';this['originatecalleridname']=_0x5577e8[_0x4800('0x29')]||'';this['agiafterat']=_0x5577e8[_0x4800('0x2a')];}module[_0x4800('0x2b')]=AgentComplete; \ No newline at end of file +var _0x3848=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime'];(function(_0x1ebe55,_0x17e463){var _0x240610=function(_0x290a88){while(--_0x290a88){_0x1ebe55['push'](_0x1ebe55['shift']());}};_0x240610(++_0x17e463);}(_0x3848,0x172));var _0x8384=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x3848[_0x4ed32d];return _0xf624df;};'use strict';var moment=require(_0x8384('0x0'));var utils=require(_0x8384('0x1'));function AgentComplete(_0x4c9c0d,_0x1f0f41){this[_0x8384('0x2')]=0x4;this[_0x8384('0x3')]=_0x8384('0x4');this[_0x8384('0x5')]=_0x4c9c0d[_0x8384('0x5')];this['type']=_0x4c9c0d[_0x8384('0x6')];this[_0x8384('0x7')]=_0x4c9c0d[_0x8384('0x6')]===_0x8384('0x8')?_0x8384('0x9'):_0x4c9c0d[_0x8384('0x6')];this['countbusyretry']=_0x4c9c0d[_0x8384('0xa')];this[_0x8384('0xb')]=_0x4c9c0d['countcongestionretry'];this[_0x8384('0xc')]=_0x4c9c0d['countnoanswerretry'];this['countglobal']=_0x4c9c0d[_0x8384('0xa')]+_0x4c9c0d[_0x8384('0xb')]+_0x4c9c0d[_0x8384('0xc')]+_0x4c9c0d['countnosuchnumberretry']+_0x4c9c0d[_0x8384('0xd')]+_0x4c9c0d[_0x8384('0xe')]+_0x4c9c0d[_0x8384('0xf')]+_0x4c9c0d[_0x8384('0x10')];this[_0x8384('0x11')]=_0x4c9c0d['countnosuchnumberretry'];this[_0x8384('0xd')]=_0x4c9c0d[_0x8384('0xd')];this[_0x8384('0xe')]=_0x4c9c0d[_0x8384('0xe')];this[_0x8384('0xf')]=_0x4c9c0d[_0x8384('0xf')];this['countagentrejectretry']=_0x4c9c0d[_0x8384('0x10')];this['uniqueid']=_0x1f0f41[_0x8384('0x12')];this[_0x8384('0x13')]=_0x4c9c0d[_0x8384('0x14')];this['calleridnum']=_0x4c9c0d[_0x8384('0x15')];this[_0x8384('0x16')]=_0x4c9c0d[_0x8384('0x16')];this[_0x8384('0x17')]=_0x4c9c0d[_0x8384('0x17')];this[_0x8384('0x18')]=_0x4c9c0d[_0x8384('0x18')];this[_0x8384('0x19')]=moment()[_0x8384('0x1a')](_0x8384('0x1b'));this[_0x8384('0x1c')]=utils[_0x8384('0x1d')](_0x4c9c0d[_0x8384('0x17')],_0x4c9c0d[_0x8384('0x16')]);this['holdtime']=utils['getSeconds'](_0x4c9c0d[_0x8384('0x18')],_0x4c9c0d[_0x8384('0x17')]);this['talktime']=utils[_0x8384('0x1d')](this[_0x8384('0x19')],_0x4c9c0d[_0x8384('0x18')]);this[_0x8384('0x9')]=_0x1f0f41[_0x8384('0x9')];this[_0x8384('0x1e')]=_0x1f0f41['membername'];this[_0x8384('0x1f')]=_0x1f0f41['reason'];this['callback']=_0x4c9c0d[_0x8384('0x20')];this['callbackuniqueid']=_0x4c9c0d[_0x8384('0x21')];this[_0x8384('0x22')]=_0x4c9c0d['callbackat'];this[_0x8384('0x23')]=_0x4c9c0d[_0x8384('0x23')];this[_0x8384('0x24')]=_0x4c9c0d[_0x8384('0x24')];this[_0x8384('0x25')]=_0x4c9c0d[_0x8384('0x25')];this[_0x8384('0x26')]=_0x4c9c0d[_0x8384('0x26')];this[_0x8384('0x27')]=_0x4c9c0d[_0x8384('0x27')];this[_0x8384('0x28')]=_0x4c9c0d[_0x8384('0x28')];this[_0x8384('0x29')]=_0x4c9c0d[_0x8384('0x29')]||'';this[_0x8384('0x2a')]=_0x4c9c0d[_0x8384('0x2a')]||'';this[_0x8384('0x2b')]=_0x4c9c0d[_0x8384('0x2b')];}module['exports']=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 df15ebb..6ec3816 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 _0x9292=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime'];(function(_0xd0dbec,_0x1315d7){var _0x328a4d=function(_0x4509d5){while(--_0x4509d5){_0xd0dbec['push'](_0xd0dbec['shift']());}};_0x328a4d(++_0x1315d7);}(_0x9292,0x105));var _0x2929=function(_0x4dd0e0,_0x393873){_0x4dd0e0=_0x4dd0e0-0x0;var _0x3d86bd=_0x9292[_0x4dd0e0];return _0x3d86bd;};'use strict';function Final(_0xef3aa){this[_0x2929('0x0')]=_0xef3aa[_0x2929('0x0')];this[_0x2929('0x1')]=_0xef3aa[_0x2929('0x1')];this['type']=_0xef3aa['type'];this[_0x2929('0x2')]=_0xef3aa['type']===_0x2929('0x3')?_0x2929('0x4'):_0xef3aa['type'];this[_0x2929('0x5')]=_0xef3aa['countbusyretry'];this[_0x2929('0x6')]=_0xef3aa['countcongestionretry'];this[_0x2929('0x7')]=_0xef3aa[_0x2929('0x7')];this[_0x2929('0x8')]=_0xef3aa[_0x2929('0x5')]+_0xef3aa[_0x2929('0x6')]+_0xef3aa['countnoanswerretry']+_0xef3aa[_0x2929('0x9')]+_0xef3aa['countdropretry']+_0xef3aa[_0x2929('0xa')]+_0xef3aa[_0x2929('0xb')]+_0xef3aa[_0x2929('0xc')];this['countnosuchnumberretry']=_0xef3aa[_0x2929('0x9')];this['countdropretry']=_0xef3aa[_0x2929('0xd')];this[_0x2929('0xa')]=_0xef3aa['countabandonedretry'];this[_0x2929('0xb')]=_0xef3aa[_0x2929('0xb')];this[_0x2929('0xc')]=_0xef3aa['countagentrejectretry'];this['queue']=_0xef3aa[_0x2929('0x4')];this['calleridname']=_0xef3aa[_0x2929('0xe')];this[_0x2929('0xf')]=_0xef3aa[_0x2929('0xf')];this[_0x2929('0x10')]=_0xef3aa[_0x2929('0x10')];this[_0x2929('0x11')]=_0xef3aa[_0x2929('0x11')];this[_0x2929('0x12')]=_0xef3aa[_0x2929('0x11')];this[_0x2929('0x13')]=_0xef3aa[_0x2929('0x13')]||0x0;this[_0x2929('0x14')]=_0xef3aa[_0x2929('0x14')]||0x0;this['talktime']=_0xef3aa[_0x2929('0x15')]||0x0;this[_0x2929('0x16')]=_0xef3aa[_0x2929('0x16')];this[_0x2929('0x17')]=_0xef3aa[_0x2929('0x17')];this[_0x2929('0x18')]=_0xef3aa[_0x2929('0x18')];this[_0x2929('0x19')]=_0xef3aa['recallme'];this[_0x2929('0x1a')]=_0xef3aa[_0x2929('0x1a')];this['ListId']=_0xef3aa[_0x2929('0x1b')];this[_0x2929('0x1c')]=_0xef3aa[_0x2929('0x1c')];this[_0x2929('0x1d')]=_0xef3aa[_0x2929('0x1d')];this[_0x2929('0x1e')]=_0xef3aa['CampaignId'];this[_0x2929('0x1f')]=_0xef3aa['originatecalleridnum']||'';this[_0x2929('0x20')]=_0xef3aa[_0x2929('0x20')]||'';this[_0x2929('0x21')]=_0xef3aa[_0x2929('0x21')];this['statedesc']=_0xef3aa[_0x2929('0x22')];}module['exports']=Final; \ No newline at end of file +var _0x219a=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countcongestionretry'];(function(_0x36c5aa,_0x1e5b00){var _0x172211=function(_0x164bbe){while(--_0x164bbe){_0x36c5aa['push'](_0x36c5aa['shift']());}};_0x172211(++_0x1e5b00);}(_0x219a,0x118));var _0xa219=function(_0x5efb97,_0x2e56b7){_0x5efb97=_0x5efb97-0x0;var _0x8a64c5=_0x219a[_0x5efb97];return _0x8a64c5;};'use strict';function Final(_0x4ff050){this['uniqueid']=_0x4ff050[_0xa219('0x0')];this['scheduledat']=_0x4ff050[_0xa219('0x1')];this[_0xa219('0x2')]=_0x4ff050[_0xa219('0x2')];this[_0xa219('0x3')]=_0x4ff050[_0xa219('0x2')]===_0xa219('0x4')?'queue':_0x4ff050[_0xa219('0x2')];this['countbusyretry']=_0x4ff050[_0xa219('0x5')];this['countcongestionretry']=_0x4ff050['countcongestionretry'];this[_0xa219('0x6')]=_0x4ff050['countnoanswerretry'];this['countglobal']=_0x4ff050['countbusyretry']+_0x4ff050[_0xa219('0x7')]+_0x4ff050['countnoanswerretry']+_0x4ff050[_0xa219('0x8')]+_0x4ff050[_0xa219('0x9')]+_0x4ff050['countabandonedretry']+_0x4ff050[_0xa219('0xa')]+_0x4ff050[_0xa219('0xb')];this[_0xa219('0x8')]=_0x4ff050[_0xa219('0x8')];this[_0xa219('0x9')]=_0x4ff050[_0xa219('0x9')];this[_0xa219('0xc')]=_0x4ff050[_0xa219('0xc')];this[_0xa219('0xa')]=_0x4ff050['countmachineretry'];this[_0xa219('0xb')]=_0x4ff050[_0xa219('0xb')];this[_0xa219('0xd')]=_0x4ff050['queue'];this['calleridname']=_0x4ff050[_0xa219('0xe')];this['calleridnum']=_0x4ff050[_0xa219('0xf')];this[_0xa219('0x10')]=_0x4ff050[_0xa219('0x10')];this[_0xa219('0x11')]=_0x4ff050[_0xa219('0x11')];this[_0xa219('0x12')]=_0x4ff050[_0xa219('0x11')];this['ringtime']=_0x4ff050[_0xa219('0x13')]||0x0;this[_0xa219('0x14')]=_0x4ff050['holdtime']||0x0;this['talktime']=_0x4ff050[_0xa219('0x15')]||0x0;this[_0xa219('0x16')]=_0x4ff050[_0xa219('0x16')];this[_0xa219('0x17')]=_0x4ff050[_0xa219('0x17')];this['callbackat']=_0x4ff050[_0xa219('0x18')];this[_0xa219('0x19')]=_0x4ff050[_0xa219('0x19')];this[_0xa219('0x1a')]=_0x4ff050[_0xa219('0x1a')];this[_0xa219('0x1b')]=_0x4ff050[_0xa219('0x1b')];this[_0xa219('0x1c')]=_0x4ff050['UserId'];this[_0xa219('0x1d')]=_0x4ff050[_0xa219('0x1d')];this[_0xa219('0x1e')]=_0x4ff050['CampaignId'];this[_0xa219('0x1f')]=_0x4ff050[_0xa219('0x1f')]||'';this[_0xa219('0x20')]=_0x4ff050[_0xa219('0x20')]||'';this[_0xa219('0x21')]=_0x4ff050[_0xa219('0x21')];this[_0xa219('0x22')]=_0x4ff050[_0xa219('0x22')];}module[_0xa219('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index d5ae16e..f50b33c 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 _0xb498=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5ce00e,_0x5be1b1){var _0x2f825b=function(_0xe8ed6){while(--_0xe8ed6){_0x5ce00e['push'](_0x5ce00e['shift']());}};_0x2f825b(++_0x5be1b1);}(_0xb498,0x6f));var _0x8b49=function(_0x1dfc39,_0x1debca){_0x1dfc39=_0x1dfc39-0x0;var _0x41a1cb=_0xb498[_0x1dfc39];return _0x41a1cb;};'use strict';var moment=require(_0x8b49('0x0'));var utils=require(_0x8b49('0x1'));function Hangup(_0x1435ce,_0x1ee3b3){this['state']=0x4;this[_0x8b49('0x2')]='Answer';this['scheduledat']=_0x1435ce['scheduledat'];this['type']=_0x1435ce[_0x8b49('0x3')];this[_0x8b49('0x4')]=_0x1435ce['type']===_0x8b49('0x5')?_0x8b49('0x6'):_0x1435ce[_0x8b49('0x3')];this[_0x8b49('0x7')]=_0x1435ce[_0x8b49('0x7')]||![];this[_0x8b49('0x8')]=_0x1435ce[_0x8b49('0x8')];this[_0x8b49('0x9')]=_0x1435ce['countcongestionretry'];this['countnoanswerretry']=_0x1435ce[_0x8b49('0xa')];this[_0x8b49('0xb')]=_0x1435ce[_0x8b49('0x8')]+_0x1435ce[_0x8b49('0x9')]+_0x1435ce[_0x8b49('0xa')]+_0x1435ce['countnosuchnumberretry']+_0x1435ce[_0x8b49('0xc')]+_0x1435ce[_0x8b49('0xd')]+_0x1435ce[_0x8b49('0xe')]+_0x1435ce[_0x8b49('0xf')];this[_0x8b49('0x10')]=_0x1435ce[_0x8b49('0x10')];this[_0x8b49('0xc')]=_0x1435ce[_0x8b49('0xc')];this[_0x8b49('0xd')]=_0x1435ce[_0x8b49('0xd')];this['countmachineretry']=_0x1435ce[_0x8b49('0xe')];this[_0x8b49('0xf')]=_0x1435ce[_0x8b49('0xf')];this['uniqueid']=_0x1ee3b3[_0x8b49('0x11')];this[_0x8b49('0x12')]=_0x1435ce['name'];this['calleridnum']=_0x1435ce[_0x8b49('0x13')];this[_0x8b49('0x14')]=_0x1435ce['starttime'];this['responsetime']=_0x1435ce['responsetime'];this[_0x8b49('0x15')]=moment()[_0x8b49('0x16')](_0x8b49('0x17'));this[_0x8b49('0x18')]=utils[_0x8b49('0x19')](_0x1435ce[_0x8b49('0x1a')],_0x1435ce['starttime']);this[_0x8b49('0x1b')]=0x0;this['talktime']=utils[_0x8b49('0x19')](this[_0x8b49('0x15')],_0x1435ce[_0x8b49('0x1a')]);this[_0x8b49('0x6')]=_0x1435ce[_0x8b49('0x6')];this['membername']=_0x8b49('0x1c');this[_0x8b49('0x1d')]=_0x1ee3b3[_0x8b49('0x1e')];this[_0x8b49('0x1f')]=_0x1435ce['callback'];this[_0x8b49('0x20')]=_0x1435ce['callbackuniqueid'];this['callbackat']=_0x1435ce[_0x8b49('0x21')];this[_0x8b49('0x22')]=_0x1435ce[_0x8b49('0x22')];this[_0x8b49('0x23')]=_0x1435ce[_0x8b49('0x23')];this[_0x8b49('0x24')]=_0x1435ce[_0x8b49('0x24')];this[_0x8b49('0x25')]=_0x1435ce['UserId'];this[_0x8b49('0x26')]=_0x1435ce[_0x8b49('0x26')];this[_0x8b49('0x27')]=_0x1435ce[_0x8b49('0x27')];}module[_0x8b49('0x28')]=Hangup; \ No newline at end of file +var _0x4d18=['countdropretry','uniqueid','calleridnum','number','starttime','endtime','ringtime','holdtime','talktime','responsetime','queue','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x4d18,0x188));var _0x84d1=function(_0x19544f,_0x4fb146){_0x19544f=_0x19544f-0x0;var _0xb51561=_0x4d18[_0x19544f];return _0xb51561;};'use strict';var moment=require(_0x84d1('0x0'));var utils=require(_0x84d1('0x1'));function Hangup(_0x15f47c,_0x4a748a){this[_0x84d1('0x2')]=0x4;this[_0x84d1('0x3')]=_0x84d1('0x4');this[_0x84d1('0x5')]=_0x15f47c[_0x84d1('0x5')];this[_0x84d1('0x6')]=_0x15f47c['type'];this[_0x84d1('0x7')]=_0x15f47c[_0x84d1('0x6')]===_0x84d1('0x8')?'queue':_0x15f47c[_0x84d1('0x6')];this[_0x84d1('0x9')]=_0x15f47c[_0x84d1('0x9')]||![];this[_0x84d1('0xa')]=_0x15f47c['countbusyretry'];this[_0x84d1('0xb')]=_0x15f47c[_0x84d1('0xb')];this['countnoanswerretry']=_0x15f47c[_0x84d1('0xc')];this[_0x84d1('0xd')]=_0x15f47c[_0x84d1('0xa')]+_0x15f47c['countcongestionretry']+_0x15f47c[_0x84d1('0xc')]+_0x15f47c[_0x84d1('0xe')]+_0x15f47c['countdropretry']+_0x15f47c[_0x84d1('0xf')]+_0x15f47c[_0x84d1('0x10')]+_0x15f47c[_0x84d1('0x11')];this['countnosuchnumberretry']=_0x15f47c['countnosuchnumberretry'];this[_0x84d1('0x12')]=_0x15f47c['countdropretry'];this[_0x84d1('0xf')]=_0x15f47c[_0x84d1('0xf')];this[_0x84d1('0x10')]=_0x15f47c[_0x84d1('0x10')];this['countagentrejectretry']=_0x15f47c[_0x84d1('0x11')];this[_0x84d1('0x13')]=_0x4a748a[_0x84d1('0x13')];this['calleridname']=_0x15f47c['name'];this[_0x84d1('0x14')]=_0x15f47c[_0x84d1('0x15')];this[_0x84d1('0x16')]=_0x15f47c[_0x84d1('0x16')];this['responsetime']=_0x15f47c['responsetime'];this[_0x84d1('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x84d1('0x18')]=utils['getSeconds'](_0x15f47c['responsetime'],_0x15f47c[_0x84d1('0x16')]);this[_0x84d1('0x19')]=0x0;this[_0x84d1('0x1a')]=utils['getSeconds'](this['endtime'],_0x15f47c[_0x84d1('0x1b')]);this[_0x84d1('0x1c')]=_0x15f47c[_0x84d1('0x1c')];this[_0x84d1('0x1d')]='IVR';this['reason']=_0x4a748a[_0x84d1('0x1e')];this[_0x84d1('0x1f')]=_0x15f47c[_0x84d1('0x1f')];this[_0x84d1('0x20')]=_0x15f47c[_0x84d1('0x20')];this[_0x84d1('0x21')]=_0x15f47c['callbackat'];this[_0x84d1('0x22')]=_0x15f47c[_0x84d1('0x22')];this['ContactId']=_0x15f47c[_0x84d1('0x23')];this['ListId']=_0x15f47c[_0x84d1('0x24')];this[_0x84d1('0x25')]=_0x15f47c[_0x84d1('0x25')];this[_0x84d1('0x26')]=_0x15f47c['VoiceQueueId'];this['CampaignId']=_0x15f47c[_0x84d1('0x27')];}module[_0x84d1('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 69efa2b..3308e37 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 _0xc04a=['../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports'];(function(_0x950588,_0x402c50){var _0xa8db75=function(_0x302d4e){while(--_0x302d4e){_0x950588['push'](_0x950588['shift']());}};_0xa8db75(++_0x402c50);}(_0xc04a,0xaf));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xac04('0x0'));function History(_0xd1447c){this[_0xac04('0x1')]=_0xd1447c['uniqueid'];this[_0xac04('0x2')]=_0xd1447c[_0xac04('0x2')]||undefined;this[_0xac04('0x3')]=_0xd1447c['type'];this['campaigntype']=_0xd1447c[_0xac04('0x3')]==='outbound'?_0xac04('0x4'):_0xd1447c[_0xac04('0x3')];this[_0xac04('0x5')]=_0xd1447c['countbusyretry'];this[_0xac04('0x6')]=_0xd1447c[_0xac04('0x6')];this[_0xac04('0x7')]=_0xd1447c[_0xac04('0x7')];this['countglobal']=_0xd1447c['countbusyretry']+_0xd1447c[_0xac04('0x6')]+_0xd1447c[_0xac04('0x7')]+_0xd1447c['countnosuchnumberretry']+_0xd1447c[_0xac04('0x8')]+_0xd1447c['countabandonedretry']+_0xd1447c[_0xac04('0x9')]+_0xd1447c[_0xac04('0xa')];this[_0xac04('0xb')]=_0xd1447c[_0xac04('0xb')];this[_0xac04('0x8')]=_0xd1447c['countdropretry'];this[_0xac04('0xc')]=_0xd1447c[_0xac04('0xc')];this[_0xac04('0x9')]=_0xd1447c['countmachineretry'];this[_0xac04('0xa')]=_0xd1447c['countagentrejectretry'];this[_0xac04('0x4')]=_0xd1447c['queue'];this[_0xac04('0xd')]=_0xd1447c[_0xac04('0xe')];this[_0xac04('0xf')]=_0xd1447c[_0xac04('0x10')];this['starttime']=_0xd1447c[_0xac04('0x11')];this['responsetime']=_0xd1447c[_0xac04('0x12')];this['endtime']=_0xd1447c[_0xac04('0x12')];this[_0xac04('0x13')]=utils[_0xac04('0x14')](_0xd1447c[_0xac04('0x12')],_0xd1447c[_0xac04('0x11')]);this[_0xac04('0x15')]=0x0;this[_0xac04('0x16')]=0x0;this[_0xac04('0x17')]=_0xd1447c[_0xac04('0x17')];this[_0xac04('0x18')]=_0xd1447c[_0xac04('0x18')];this[_0xac04('0x19')]=_0xd1447c[_0xac04('0x19')];this[_0xac04('0x1a')]=_0xd1447c[_0xac04('0x1a')];this[_0xac04('0x1b')]=_0xd1447c[_0xac04('0x1b')];this[_0xac04('0x1c')]=_0xd1447c['ListId'];this['UserId']=_0xd1447c['UserId'];this[_0xac04('0x1d')]=_0xd1447c['VoiceQueueId'];this[_0xac04('0x1e')]=_0xd1447c[_0xac04('0x1e')];this['originatecalleridnum']=_0xd1447c['originatecalleridnum']||'';this[_0xac04('0x1f')]=_0xd1447c[_0xac04('0x1f')]||'';this[_0xac04('0x20')]=_0xd1447c['state'];this[_0xac04('0x21')]=_0xd1447c[_0xac04('0x21')];}module[_0xac04('0x22')]=History; \ No newline at end of file +var _0xff57=['countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number','responsetime','endtime','getSeconds','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x57f7d7,_0x41443c){var _0x11b297=function(_0x2783ce){while(--_0x2783ce){_0x57f7d7['push'](_0x57f7d7['shift']());}};_0x11b297(++_0x41443c);}(_0xff57,0x197));var _0x7ff5=function(_0x36d03c,_0x35b8c9){_0x36d03c=_0x36d03c-0x0;var _0x3ae972=_0xff57[_0x36d03c];return _0x3ae972;};'use strict';var utils=require(_0x7ff5('0x0'));function History(_0x3c5013){this['uniqueid']=_0x3c5013[_0x7ff5('0x1')];this['scheduledat']=_0x3c5013['scheduledat']||undefined;this['type']=_0x3c5013[_0x7ff5('0x2')];this[_0x7ff5('0x3')]=_0x3c5013[_0x7ff5('0x2')]===_0x7ff5('0x4')?_0x7ff5('0x5'):_0x3c5013[_0x7ff5('0x2')];this['countbusyretry']=_0x3c5013[_0x7ff5('0x6')];this['countcongestionretry']=_0x3c5013[_0x7ff5('0x7')];this[_0x7ff5('0x8')]=_0x3c5013[_0x7ff5('0x8')];this['countglobal']=_0x3c5013[_0x7ff5('0x6')]+_0x3c5013[_0x7ff5('0x7')]+_0x3c5013[_0x7ff5('0x8')]+_0x3c5013[_0x7ff5('0x9')]+_0x3c5013[_0x7ff5('0xa')]+_0x3c5013['countabandonedretry']+_0x3c5013[_0x7ff5('0xb')]+_0x3c5013[_0x7ff5('0xc')];this[_0x7ff5('0x9')]=_0x3c5013[_0x7ff5('0x9')];this['countdropretry']=_0x3c5013[_0x7ff5('0xa')];this[_0x7ff5('0xd')]=_0x3c5013[_0x7ff5('0xd')];this['countmachineretry']=_0x3c5013['countmachineretry'];this[_0x7ff5('0xc')]=_0x3c5013['countagentrejectretry'];this['queue']=_0x3c5013[_0x7ff5('0x5')];this[_0x7ff5('0xe')]=_0x3c5013[_0x7ff5('0xf')];this[_0x7ff5('0x10')]=_0x3c5013[_0x7ff5('0x11')];this['starttime']=_0x3c5013['starttime'];this['responsetime']=_0x3c5013[_0x7ff5('0x12')];this[_0x7ff5('0x13')]=_0x3c5013[_0x7ff5('0x12')];this['ringtime']=utils[_0x7ff5('0x14')](_0x3c5013[_0x7ff5('0x12')],_0x3c5013[_0x7ff5('0x15')]);this[_0x7ff5('0x16')]=0x0;this[_0x7ff5('0x17')]=0x0;this[_0x7ff5('0x18')]=_0x3c5013['callback'];this[_0x7ff5('0x19')]=_0x3c5013[_0x7ff5('0x19')];this['callbackat']=_0x3c5013[_0x7ff5('0x1a')];this[_0x7ff5('0x1b')]=_0x3c5013[_0x7ff5('0x1b')];this[_0x7ff5('0x1c')]=_0x3c5013[_0x7ff5('0x1c')];this[_0x7ff5('0x1d')]=_0x3c5013['ListId'];this[_0x7ff5('0x1e')]=_0x3c5013[_0x7ff5('0x1e')];this[_0x7ff5('0x1f')]=_0x3c5013[_0x7ff5('0x1f')];this[_0x7ff5('0x20')]=_0x3c5013['CampaignId'];this[_0x7ff5('0x21')]=_0x3c5013[_0x7ff5('0x21')]||'';this[_0x7ff5('0x22')]=_0x3c5013[_0x7ff5('0x22')]||'';this[_0x7ff5('0x23')]=_0x3c5013[_0x7ff5('0x23')];this[_0x7ff5('0x24')]=_0x3c5013[_0x7ff5('0x24')];}module[_0x7ff5('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 9801b77..8072e7e 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 _0x50ce=['endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason'];(function(_0x3edf8e,_0x45b865){var _0x4fbd0c=function(_0x4b03ab){while(--_0x4b03ab){_0x3edf8e['push'](_0x3edf8e['shift']());}};_0x4fbd0c(++_0x45b865);}(_0x50ce,0x15d));var _0xe50c=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x50ce[_0x324496];return _0x899545;};'use strict';var utils=require(_0xe50c('0x0'));function QueueCallerAbandon(_0x4203e2,_0x1d1ed4){this[_0xe50c('0x1')]=_0x4203e2[_0xe50c('0x1')];this[_0xe50c('0x2')]=_0x4203e2[_0xe50c('0x2')];this['campaigntype']=_0x4203e2[_0xe50c('0x2')]===_0xe50c('0x3')?_0xe50c('0x4'):_0x4203e2[_0xe50c('0x2')];this[_0xe50c('0x5')]=_0x4203e2['countbusyretry'];this[_0xe50c('0x6')]=_0x4203e2[_0xe50c('0x6')];this['countnoanswerretry']=_0x4203e2['countnoanswerretry'];this['countglobal']=_0x4203e2[_0xe50c('0x5')]+_0x4203e2['countcongestionretry']+_0x4203e2[_0xe50c('0x7')]+_0x4203e2['countnosuchnumberretry']+_0x4203e2[_0xe50c('0x8')]+_0x4203e2['countabandonedretry']+_0x4203e2[_0xe50c('0x9')]+_0x4203e2[_0xe50c('0xa')];this[_0xe50c('0xb')]=_0x4203e2[_0xe50c('0xb')];this[_0xe50c('0x8')]=_0x4203e2[_0xe50c('0x8')];this['countabandonedretry']=_0x4203e2[_0xe50c('0xc')];this[_0xe50c('0x9')]=_0x4203e2[_0xe50c('0x9')];this[_0xe50c('0xa')]=_0x4203e2['countagentrejectretry'];this[_0xe50c('0xd')]=_0x1d1ed4[_0xe50c('0xd')];this['calleridname']=_0x4203e2[_0xe50c('0xe')];this['calleridnum']=_0x4203e2[_0xe50c('0xf')];this[_0xe50c('0x10')]=_0x4203e2[_0xe50c('0x10')];this['responsetime']=_0x4203e2[_0xe50c('0x11')];this[_0xe50c('0x12')]=_0x4203e2[_0xe50c('0x12')];this[_0xe50c('0x13')]=_0x4203e2[_0xe50c('0x13')];this[_0xe50c('0x14')]=this[_0xe50c('0x12')];this[_0xe50c('0x15')]=utils[_0xe50c('0x16')](_0x4203e2[_0xe50c('0x11')],_0x4203e2['starttime']);this['holdtime']=utils['getSeconds'](this[_0xe50c('0x12')],_0x4203e2[_0xe50c('0x11')]);this[_0xe50c('0x17')]=0x0;this['queue']=_0x1d1ed4[_0xe50c('0x4')];this[_0xe50c('0x18')]=_0x1d1ed4[_0xe50c('0x19')];this[_0xe50c('0x1a')]=_0x1d1ed4['reason'];this[_0xe50c('0x1b')]=_0x4203e2[_0xe50c('0x1b')];this[_0xe50c('0x1c')]=_0x4203e2[_0xe50c('0x1c')];this[_0xe50c('0x1d')]=_0x4203e2[_0xe50c('0x1d')];this[_0xe50c('0x1e')]=_0x4203e2[_0xe50c('0x1e')];this[_0xe50c('0x1f')]=_0x4203e2[_0xe50c('0x1f')];this['ListId']=_0x4203e2[_0xe50c('0x20')];this[_0xe50c('0x21')]=_0x4203e2[_0xe50c('0x21')];this[_0xe50c('0x22')]=_0x4203e2[_0xe50c('0x22')];this[_0xe50c('0x23')]=_0x4203e2[_0xe50c('0x23')];this[_0xe50c('0x24')]=_0x4203e2[_0xe50c('0x24')]||'';this[_0xe50c('0x25')]=_0x4203e2['originatecalleridname']||'';this[_0xe50c('0x26')]=_0x4203e2[_0xe50c('0x26')];this['state']=_0x4203e2['state'];this[_0xe50c('0x27')]=_0x4203e2[_0xe50c('0x27')];}module[_0xe50c('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xd22d=['agiafterat','state','statedesc','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0xd22d,0x1a8));var _0xdd22=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0xd22d[_0x1ca9eb];return _0x2e284e;};'use strict';var utils=require(_0xdd22('0x0'));function QueueCallerAbandon(_0x49232a,_0x21413b){this[_0xdd22('0x1')]=_0x49232a['scheduledat'];this[_0xdd22('0x2')]=_0x49232a[_0xdd22('0x2')];this['campaigntype']=_0x49232a[_0xdd22('0x2')]==='outbound'?'queue':_0x49232a['type'];this[_0xdd22('0x3')]=_0x49232a['countbusyretry'];this['countcongestionretry']=_0x49232a[_0xdd22('0x4')];this['countnoanswerretry']=_0x49232a[_0xdd22('0x5')];this[_0xdd22('0x6')]=_0x49232a['countbusyretry']+_0x49232a['countcongestionretry']+_0x49232a[_0xdd22('0x5')]+_0x49232a['countnosuchnumberretry']+_0x49232a[_0xdd22('0x7')]+_0x49232a[_0xdd22('0x8')]+_0x49232a[_0xdd22('0x9')]+_0x49232a[_0xdd22('0xa')];this['countnosuchnumberretry']=_0x49232a[_0xdd22('0xb')];this[_0xdd22('0x7')]=_0x49232a[_0xdd22('0x7')];this[_0xdd22('0x8')]=_0x49232a[_0xdd22('0x8')];this[_0xdd22('0x9')]=_0x49232a['countmachineretry'];this[_0xdd22('0xa')]=_0x49232a[_0xdd22('0xa')];this['uniqueid']=_0x21413b[_0xdd22('0xc')];this[_0xdd22('0xd')]=_0x49232a[_0xdd22('0xe')];this['calleridnum']=_0x49232a[_0xdd22('0xf')];this[_0xdd22('0x10')]=_0x49232a['starttime'];this[_0xdd22('0x11')]=_0x49232a[_0xdd22('0x11')];this[_0xdd22('0x12')]=_0x49232a[_0xdd22('0x12')];this[_0xdd22('0x13')]=_0x49232a['dropreason'];this[_0xdd22('0x14')]=this[_0xdd22('0x12')];this['ringtime']=utils[_0xdd22('0x15')](_0x49232a[_0xdd22('0x11')],_0x49232a['starttime']);this[_0xdd22('0x16')]=utils[_0xdd22('0x15')](this['droptime'],_0x49232a['responsetime']);this[_0xdd22('0x17')]=0x0;this['queue']=_0x21413b[_0xdd22('0x18')];this['membername']=_0x21413b[_0xdd22('0x19')];this['reason']=_0x21413b[_0xdd22('0x1a')];this[_0xdd22('0x1b')]=_0x49232a[_0xdd22('0x1b')];this[_0xdd22('0x1c')]=_0x49232a[_0xdd22('0x1c')];this['callbackat']=_0x49232a[_0xdd22('0x1d')];this[_0xdd22('0x1e')]=_0x49232a[_0xdd22('0x1e')];this[_0xdd22('0x1f')]=_0x49232a['ContactId'];this[_0xdd22('0x20')]=_0x49232a[_0xdd22('0x20')];this[_0xdd22('0x21')]=_0x49232a['UserId'];this[_0xdd22('0x22')]=_0x49232a[_0xdd22('0x22')];this[_0xdd22('0x23')]=_0x49232a[_0xdd22('0x23')];this[_0xdd22('0x24')]=_0x49232a[_0xdd22('0x24')]||'';this['originatecalleridname']=_0x49232a[_0xdd22('0x25')]||'';this[_0xdd22('0x26')]=_0x49232a[_0xdd22('0x26')];this[_0xdd22('0x27')]=_0x49232a[_0xdd22('0x27')];this['statedesc']=_0x49232a[_0xdd22('0x28')];}module[_0xdd22('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 6223f3e..faf03e5 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 _0x3e24=['[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','temp','countReScheduled'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3e24,0x167));var _0x43e2=function(_0xa1bf55,_0xc0f3f){_0xa1bf55=_0xa1bf55-0x0;var _0x51a788=_0x3e24[_0xa1bf55];return _0x51a788;};'use strict';var util=require(_0x43e2('0x0'));var logger=require(_0x43e2('0x1'))(_0x43e2('0x2'));var cmHopper=require(_0x43e2('0x3'));var cmHopperAdditionalPhone=require(_0x43e2('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x43e2('0x5'));function inspectError(_0x1ff04b){return util['inspect'](_0x1ff04b,{'showHidden':![],'depth':null});}function getContactDialer(_0x1dd127,_0x18629c,_0x1a89fc){return cmHopper[_0x43e2('0x6')](_0x1dd127['id'],_0x18629c,_0x1a89fc,_0x1dd127[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x23b2d8){_0x1dd127['temp']=0x0;logger[_0x43e2('0x9')](_0x43e2('0xa'),inspectError(_0x23b2d8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c96f9,_0x2fdf85){return cmHopper['getContactDialerIvr'](_0x1c96f9['id'],_0x2fdf85,_0x1c96f9[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x52146c){_0x1c96f9[_0x43e2('0xb')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x52146c));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x103220){return cmHopper[_0x43e2('0xc')](_0x103220)[_0x43e2('0x8')](function(_0x44781a){logger[_0x43e2('0x9')](_0x43e2('0xd'),inspectError(_0x44781a));});}exports[_0x43e2('0xc')]=countReScheduled;function rescheduleContact(_0x802e2d){return cmHopper[_0x43e2('0xe')](_0x802e2d)[_0x43e2('0x8')](function(_0x377097){logger[_0x43e2('0x9')]('[rescheduleContact]',inspectError(_0x377097));});}exports[_0x43e2('0xe')]=rescheduleContact;function unlockContact(_0x40fb7b,_0xb929b5,_0x2a0fb0){return cmHopper['unlockContact'](_0x40fb7b,_0xb929b5,_0x2a0fb0)['catch'](function(_0x241da2){logger[_0x43e2('0x9')](_0x43e2('0xf'),inspectError(_0x241da2));});}exports[_0x43e2('0x10')]=unlockContact;function moveContactManagedDialer(_0x105cb8){return cmHopper[_0x43e2('0x11')](_0x105cb8)[_0x43e2('0x8')](function(_0x15ecb5){logger[_0x43e2('0x9')](_0x43e2('0x12'),inspectError(_0x15ecb5));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3ee34c){return cmHopperBlack[_0x43e2('0x13')](_0x3ee34c)['catch'](function(_0x115c0a){logger['error'](_0x43e2('0x14'),inspectError(_0x115c0a));});}exports[_0x43e2('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1fac53){return cmHopperBlack[_0x43e2('0x15')](_0x1fac53)[_0x43e2('0x8')](function(_0x5ae97b){logger[_0x43e2('0x9')](_0x43e2('0x16'),inspectError(_0x5ae97b));});}exports[_0x43e2('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x52e361,_0x234a1d,_0x32f048){return cmHopperAdditionalPhone[_0x43e2('0x17')](_0x52e361,_0x234a1d,_0x32f048)[_0x43e2('0x8')](function(_0x4f20e6){logger[_0x43e2('0x9')](_0x43e2('0x18'),inspectError(_0x4f20e6));});}exports[_0x43e2('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3b7b22,_0x178223,_0x2a593e){return cmHopperAdditionalPhone[_0x43e2('0x19')](_0x3b7b22,_0x178223,_0x2a593e)[_0x43e2('0x8')](function(_0xd29b7b){logger[_0x43e2('0x9')](_0x43e2('0x1a'),inspectError(_0xd29b7b));});}exports[_0x43e2('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x52ed49){return cmHopperHistory[_0x43e2('0x1b')](_0x52ed49)[_0x43e2('0x8')](function(_0x545246){logger[_0x43e2('0x9')](_0x43e2('0x1c'),inspectError(_0x545246));});}exports[_0x43e2('0x1b')]=avgHandleTime;function createHistory(_0x404483){return cmHopperHistory[_0x43e2('0x1d')](_0x404483)['catch'](function(_0x42f495){logger[_0x43e2('0x9')](_0x43e2('0x1e'),inspectError(_0x42f495));});}exports[_0x43e2('0x1d')]=createHistory; \ No newline at end of file +var _0xafb9=['[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','catch','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xafb9,0x68));var _0x9afb=function(_0x217979,_0x1bc533){_0x217979=_0x217979-0x0;var _0x103af=_0xafb9[_0x217979];return _0x103af;};'use strict';var util=require(_0x9afb('0x0'));var logger=require(_0x9afb('0x1'))(_0x9afb('0x2'));var cmHopper=require(_0x9afb('0x3'));var cmHopperAdditionalPhone=require(_0x9afb('0x4'));var cmHopperBlack=require(_0x9afb('0x5'));var cmHopperHistory=require(_0x9afb('0x6'));function inspectError(_0x44892f){return util[_0x9afb('0x7')](_0x44892f,{'showHidden':![],'depth':null});}function getContactDialer(_0x4e983d,_0x498463,_0x91ffa0){return cmHopper['getContactDialer'](_0x4e983d['id'],_0x498463,_0x91ffa0,_0x4e983d[_0x9afb('0x8')])['catch'](function(_0x556880){_0x4e983d[_0x9afb('0x9')]=0x0;logger[_0x9afb('0xa')](_0x9afb('0xb'),inspectError(_0x556880));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x3ef362,_0x3e0264){return cmHopper[_0x9afb('0xc')](_0x3ef362['id'],_0x3e0264,_0x3ef362[_0x9afb('0x8')])[_0x9afb('0xd')](function(_0x56f477){_0x3ef362['temp']=0x0;logger[_0x9afb('0xa')](_0x9afb('0xe'),inspectError(_0x56f477));});}exports[_0x9afb('0xc')]=getContactDialerIvr;function countReScheduled(_0x31b574){return cmHopper[_0x9afb('0xf')](_0x31b574)[_0x9afb('0xd')](function(_0x374094){logger[_0x9afb('0xa')](_0x9afb('0x10'),inspectError(_0x374094));});}exports[_0x9afb('0xf')]=countReScheduled;function rescheduleContact(_0x47a804){return cmHopper[_0x9afb('0x11')](_0x47a804)['catch'](function(_0x59fd82){logger[_0x9afb('0xa')](_0x9afb('0x12'),inspectError(_0x59fd82));});}exports[_0x9afb('0x11')]=rescheduleContact;function unlockContact(_0x2d664d,_0x46b16f,_0x39cdf1){return cmHopper[_0x9afb('0x13')](_0x2d664d,_0x46b16f,_0x39cdf1)['catch'](function(_0x18505a){logger[_0x9afb('0xa')](_0x9afb('0x14'),inspectError(_0x18505a));});}exports[_0x9afb('0x13')]=unlockContact;function moveContactManagedDialer(_0x223aef){return cmHopper['moveContactManagedDialer'](_0x223aef)[_0x9afb('0xd')](function(_0x50a7e4){logger[_0x9afb('0xa')](_0x9afb('0x15'),inspectError(_0x50a7e4));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4a1c74){return cmHopperBlack[_0x9afb('0x16')](_0x4a1c74)[_0x9afb('0xd')](function(_0x3d8450){logger[_0x9afb('0xa')](_0x9afb('0x17'),inspectError(_0x3d8450));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x105253){return cmHopperBlack['checkIsBlackListIvr'](_0x105253)['catch'](function(_0x3fb534){logger[_0x9afb('0xa')](_0x9afb('0x18'),inspectError(_0x3fb534));});}exports[_0x9afb('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x50c835,_0x1e6f9c,_0x725a04){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x50c835,_0x1e6f9c,_0x725a04)['catch'](function(_0x5b5dab){logger[_0x9afb('0xa')]('[verifyAdditionalPhone]',inspectError(_0x5b5dab));});}exports[_0x9afb('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x123510,_0x50a919,_0x324293){return cmHopperAdditionalPhone[_0x9afb('0x1b')](_0x123510,_0x50a919,_0x324293)[_0x9afb('0xd')](function(_0x337d81){logger['error'](_0x9afb('0x1c'),inspectError(_0x337d81));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x29e092){return cmHopperHistory['avgHandleTime'](_0x29e092)['catch'](function(_0x1e6100){logger[_0x9afb('0xa')](_0x9afb('0x1d'),inspectError(_0x1e6100));});}exports[_0x9afb('0x1e')]=avgHandleTime;function createHistory(_0x119e04){return cmHopperHistory[_0x9afb('0x1f')](_0x119e04)[_0x9afb('0xd')](function(_0x5aabd5){logger['error'](_0x9afb('0x20'),inspectError(_0x5aabd5));});}exports[_0x9afb('0x1f')]=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 5ede925..d2d6a0e 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 _0x095e=['moment','util','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash'];(function(_0xdb703f,_0x383320){var _0x331202=function(_0x2692a6){while(--_0x2692a6){_0xdb703f['push'](_0xdb703f['shift']());}};_0x331202(++_0x383320);}(_0x095e,0x157));var _0xe095=function(_0x6290de,_0x380679){_0x6290de=_0x6290de-0x0;var _0x5e564d=_0x095e[_0x6290de];return _0x5e564d;};'use strict';var _=require(_0xe095('0x0'));var moment=require(_0xe095('0x1'));var util=require(_0xe095('0x2'));var logger=require('../../../../config/logger')(_0xe095('0x3'));var timezones=require(_0xe095('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe095('0x5'),'CONTACTS_RESCHEDULED':_0xe095('0x6'),'DEACTIVATED':_0xe095('0x7'),'DISACTIVED':_0xe095('0x8'),'EMPTY_INTERVAL':_0xe095('0x9'),'INACTIVE':_0xe095('0xa'),'NO_AGENTS_LOGGED':_0xe095('0xb'),'NO_AVAILABLE_CONTACTS':_0xe095('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xe095('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xe095('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xe095('0xf'),'RUNNING':_0xe095('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xe095('0x11')};exports[_0xe095('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x128773){return _0x128773[_0xe095('0x13')]===_0xe095('0x14');}exports[_0xe095('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x1914d2){return _0x1914d2[_0xe095('0x16')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3c139d){return _0x3c139d['type']===_0xe095('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xdeda54){return _0xdeda54[_0xe095('0x18')];}exports[_0xe095('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1fef3e){return _0x1fef3e[_0xe095('0x1a')];}exports[_0xe095('0x1b')]=isIVRCampaignActive;function getSeconds(_0x4b2224,_0x3bee31){var _0x59dc2c=moment(_0x4b2224)['milliseconds'](0x0);var _0x2b928a=moment(_0x3bee31)['milliseconds'](0x0);return _0x59dc2c['diff'](_0x2b928a,_0xe095('0x1c'));}exports[_0xe095('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x3a5018,_0x4b6da9){var _0x52ab07=![];var _0x394513=_0x3a5018[_0xe095('0x13')]!==_0x4b6da9[_0xe095('0x13')]||_0x3a5018[_0xe095('0x18')]!==_0x4b6da9[_0xe095('0x18')]||_0x3a5018[_0xe095('0x1e')]!==_0x4b6da9[_0xe095('0x1e')];var _0x1d9a2b=_0x3a5018['available']!==_0x4b6da9[_0xe095('0x1f')]||_0x3a5018[_0xe095('0x20')]!==_0x4b6da9[_0xe095('0x20')]||_0x3a5018[_0xe095('0x21')]!==_0x4b6da9['loggedInDb']||_0x3a5018['paused']!==_0x4b6da9[_0xe095('0x22')]||_0x3a5018[_0xe095('0x23')]!==_0x4b6da9[_0xe095('0x23')]||_0x3a5018['pTalking']!==_0x4b6da9[_0xe095('0x24')]||_0x3a5018[_0xe095('0x25')]!==_0x4b6da9[_0xe095('0x25')]||_0x3a5018[_0xe095('0x26')]!==_0x4b6da9['inUse']||_0x3a5018['originated']!==_0x4b6da9[_0xe095('0x27')];if(_0x3a5018[_0xe095('0x28')]&&_0x4b6da9['Trunk']){_0x52ab07=_0x3a5018[_0xe095('0x28')][_0xe095('0x29')]!==_0x4b6da9[_0xe095('0x28')]['name']||_0x3a5018[_0xe095('0x28')][_0xe095('0x1a')]!==_0x4b6da9[_0xe095('0x28')][_0xe095('0x1a')];}return _0x394513||_0x1d9a2b||_0x52ab07;}exports[_0xe095('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x59d0d0){var _0x4f8848=null;var _0x18082f=_0x59d0d0['dialTimezone'];if(_['isNil'](_0x59d0d0[_0xe095('0x2b')])||_['isNil'](_0x59d0d0['Interval'])||_[_0xe095('0x2c')](_0x59d0d0[_0xe095('0x2d')][_0xe095('0x2e')])){_0x4f8848=CAMPAIGN_STATUS[_0xe095('0x2f')];}else if(_[_0xe095('0x30')](_0x59d0d0[_0xe095('0x2b')])||_[_0xe095('0x30')](_0x59d0d0[_0xe095('0x2d')][_0xe095('0x2e')])){_0x4f8848=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x18082f&&!timezones[_0x18082f]){_0x4f8848=CAMPAIGN_STATUS[_0xe095('0x31')];}return _0x4f8848;}function checkAnyValidTrunk(_0x4e68ca,_0x1f4f0a){var _0x3bb0c1=null;var _0xc6b4ba=_0xe095('0x32');var _0x14a889=['reachable',_0xe095('0x33')];var _0x40dbc1=!![];if(_0x4e68ca[_0xe095('0x28')]&&_0x4e68ca['Trunk'][_0xe095('0x1a')]){_0xc6b4ba+=_0x4e68ca[_0xe095('0x28')][_0xe095('0x29')];_0x3bb0c1=_0x1f4f0a[_0xc6b4ba];_0x40dbc1=_0x14a889[_0xe095('0x34')](_0x3bb0c1[_0xe095('0x35')]);}else if(_0x4e68ca['TrunkBackup']&&_0x4e68ca['TrunkBackup']['active']){_0xc6b4ba+=_0x4e68ca[_0xe095('0x36')]['name'];_0x3bb0c1=_0x1f4f0a[_0xc6b4ba];_0x40dbc1=_0x14a889[_0xe095('0x34')](_0x3bb0c1[_0xe095('0x35')]);}return _0x40dbc1;}function getQueueCampaignStatusMessage(_0x3a6b5c,_0x19d2e2){var _0x986f25=CAMPAIGN_STATUS['ACTIVE'];var _0x2dd1e4=isPreviewCampaign(_0x3a6b5c);if(!isQueueCampaignActive(_0x3a6b5c)){if(_0x2dd1e4){_0x986f25=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3a6b5c[_0xe095('0x27')]===0x0&&_0x3a6b5c['talking']===0x0&&_0x3a6b5c[_0xe095('0x25')]===0x0&&(_0x3a6b5c[_0xe095('0x24')]||0x0)===0x0){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x37')];}else{_0x986f25=CAMPAIGN_STATUS[_0xe095('0x38')];}}}else if(_0x3a6b5c[_0xe095('0x20')]===0x0){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x39')];}else if(!checkAnyValidTrunk(_0x3a6b5c,_0x19d2e2)){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x3a')];}else if(!isPreviewCampaign(_0x3a6b5c)){var _0x1700ab=checkAnyValidQueueCampaignInterval(_0x3a6b5c);if(_0x1700ab){_0x986f25=_0x1700ab;}}return _0x986f25;}exports[_0xe095('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xdd18b8){var _0x459e2b=CAMPAIGN_STATUS[_0xe095('0x38')];if(_0xdd18b8['originated']===0x0&&_0xdd18b8[_0xe095('0x23')]===0x0&&_0xdd18b8[_0xe095('0x25')]===0x0&&(_0xdd18b8[_0xe095('0x24')]||0x0)===0x0){_0x459e2b=CAMPAIGN_STATUS[_0xe095('0x37')];}return _0x459e2b;}exports[_0xe095('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1842c2){var _0x1e1b73=_0x1842c2[_0xe095('0x3d')](/"(.*?)"/);return _0x1e1b73?_0x1e1b73[0x1]:_0x1842c2;}exports[_0xe095('0x3e')]=extractCalleridName;function getCallerId(_0xb57a7c,_0x3379fc,_0x13bccb){if(!_[_0xe095('0x3f')](_0x13bccb)&&typeof _0x13bccb==='string'&&!_[_0xe095('0x30')](_0x13bccb)){if(!_[_0xe095('0x3f')](_0x3379fc)&&typeof _0x3379fc==='string'&&!_[_0xe095('0x30')](_0x3379fc)){return util[_0xe095('0x40')](_0xe095('0x41'),_0x3379fc,_0x13bccb);}return util[_0xe095('0x40')]('\x22%s\x22\x20<%s>',_0x13bccb,_0x13bccb);}if(!_[_0xe095('0x3f')](_0xb57a7c)&&typeof _0xb57a7c===_0xe095('0x42')&&!_[_0xe095('0x30')](_0xb57a7c)){return _0xb57a7c;}return _0xe095('0x43');}exports[_0xe095('0x44')]=getCallerId;function getCallerIdRandom(_0x2afa1a,_0x17b51f){var _0x56e257;var _0x1c8039;var _0x172f3d;if(_0x17b51f<=0x0){_0x17b51f=0x1;}_0x56e257=new RegExp(_0xe095('0x45')+_0x17b51f+'}$');_0x1c8039=Math[_0xe095('0x46')](0xa,_0x17b51f-0x1);_0x172f3d=Math[_0xe095('0x46')](0xa,_0x17b51f)-0x1;return util[_0xe095('0x40')]('%s',_[_0xe095('0x47')](_0x2afa1a,_0x56e257,_[_0xe095('0x48')](_0x1c8039,_0x172f3d)['toString']()));}exports[_0xe095('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3e19c8){if(_0x3e19c8[_0xe095('0x27')]&&_0x3e19c8[_0xe095('0x27')]>0x0){_0x3e19c8[_0xe095('0x27')]-=0x1;}else{logger[_0xe095('0x4a')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x210fa4){return _0x210fa4&&_0x210fa4['length']>0x0;}exports[_0xe095('0x4b')]=checkContactEmpty;function erlangb(_0x26fe69,_0xd1b3ff){if(_0xd1b3ff===0x0){return 0x0;}var _0x8815d0=0x1;for(var _0x446e26=0x1;_0x446e26<=_0xd1b3ff;_0x446e26+=0x1){_0x8815d0=0x1+_0x8815d0*_0x446e26/_0x26fe69;}return 0x1/_0x8815d0;}exports[_0xe095('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x34abb2,_0x5aaa9e,_0x4e0cd6){if(_0x5aaa9e>_0x4e0cd6){for(var _0x1d7483=0x0;_0x1d7483<_0x5aaa9e-_0x4e0cd6;_0x1d7483+=0x1){decrementOriginate(_0x34abb2);}}}exports[_0xe095('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x57f49b){var _0x515fec={};var _0x164c86=['id',_0xe095('0x4e'),_0xe095('0x4f'),_0xe095('0x50'),'updatedAt'];if(_0x57f49b){for(var _0x2566ff in _0x57f49b){if(typeof _0x57f49b[_0x2566ff]!==_0xe095('0x51')){if(!_[_0xe095('0x2c')](_0x57f49b[_0x2566ff])&&!_0x164c86['includes'](_0x2566ff)){_0x515fec[util[_0xe095('0x40')](_0xe095('0x52'),_0xe095('0x53'),_0x2566ff[_0xe095('0x54')]())]=_0x57f49b[_0x2566ff];}}}}return _0x515fec;}exports[_0xe095('0x55')]=setXMDContactVariables; \ No newline at end of file +var _0x165a=['isIVRCampaignActive','milliseconds','diff','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','pTalking','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','getCallerId','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','XMD-','toUpperCase','setXMDContactVariables','util','../../../../config/logger','../../../../config/environment/shared','timezones','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','isIVRCampaign','outbound','isOutboundQueue','dialActive','active'];(function(_0x4a31c5,_0x5a4ad9){var _0x59f364=function(_0x3c11d0){while(--_0x3c11d0){_0x4a31c5['push'](_0x4a31c5['shift']());}};_0x59f364(++_0x5a4ad9);}(_0x165a,0x12f));var _0xa165=function(_0x5c46e7,_0x2ec078){_0x5c46e7=_0x5c46e7-0x0;var _0x4467f3=_0x165a[_0x5c46e7];return _0x4467f3;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa165('0x0'));var logger=require(_0xa165('0x1'))('dialer');var timezones=require(_0xa165('0x2'))[_0xa165('0x3')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xa165('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xa165('0x5'),'EMPTY_INTERVAL':_0xa165('0x6'),'INACTIVE':_0xa165('0x7'),'NO_AGENTS_LOGGED':_0xa165('0x8'),'NO_AVAILABLE_CONTACTS':_0xa165('0x9'),'NULL_INTERVAL':_0xa165('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xa165('0xb'),'RECALL_TIMEOUT':_0xa165('0xc'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xa165('0xd'),'UNREACHABLE_TRUNK':_0xa165('0xe')};exports[_0xa165('0xf')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x518661){return _0x518661[_0xa165('0x10')]===_0xa165('0x11');}exports[_0xa165('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x2b8e6c){return _0x2b8e6c[_0xa165('0x13')]==='ivr';}exports[_0xa165('0x14')]=isIVRCampaign;function isOutboundQueue(_0x3a635d){return _0x3a635d['type']===_0xa165('0x15');}exports[_0xa165('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x3d1db1){return _0x3d1db1[_0xa165('0x17')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x4d59c9){return _0x4d59c9[_0xa165('0x18')];}exports[_0xa165('0x19')]=isIVRCampaignActive;function getSeconds(_0x539f02,_0x4951ee){var _0x338167=moment(_0x539f02)[_0xa165('0x1a')](0x0);var _0xbdb204=moment(_0x4951ee)[_0xa165('0x1a')](0x0);return _0x338167[_0xa165('0x1b')](_0xbdb204,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x80d9e0,_0x46d61b){var _0x31062a=![];var _0x2479bf=_0x80d9e0[_0xa165('0x10')]!==_0x46d61b['dialMethod']||_0x80d9e0[_0xa165('0x17')]!==_0x46d61b['dialActive']||_0x80d9e0[_0xa165('0x1c')]!==_0x46d61b[_0xa165('0x1c')];var _0x5c5e25=_0x80d9e0[_0xa165('0x1d')]!==_0x46d61b['available']||_0x80d9e0[_0xa165('0x1e')]!==_0x46d61b[_0xa165('0x1e')]||_0x80d9e0[_0xa165('0x1f')]!==_0x46d61b[_0xa165('0x1f')]||_0x80d9e0['paused']!==_0x46d61b[_0xa165('0x20')]||_0x80d9e0[_0xa165('0x21')]!==_0x46d61b['talking']||_0x80d9e0['pTalking']!==_0x46d61b['pTalking']||_0x80d9e0[_0xa165('0x22')]!==_0x46d61b[_0xa165('0x22')]||_0x80d9e0['inUse']!==_0x46d61b[_0xa165('0x23')]||_0x80d9e0[_0xa165('0x24')]!==_0x46d61b[_0xa165('0x24')];if(_0x80d9e0[_0xa165('0x25')]&&_0x46d61b['Trunk']){_0x31062a=_0x80d9e0['Trunk']['name']!==_0x46d61b[_0xa165('0x25')][_0xa165('0x26')]||_0x80d9e0[_0xa165('0x25')][_0xa165('0x18')]!==_0x46d61b[_0xa165('0x25')]['active'];}return _0x2479bf||_0x5c5e25||_0x31062a;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1dd208){var _0x1a5b82=null;var _0x5a7d16=_0x1dd208[_0xa165('0x27')];if(_[_0xa165('0x28')](_0x1dd208[_0xa165('0x29')])||_['isNil'](_0x1dd208[_0xa165('0x2a')])||_['isNil'](_0x1dd208[_0xa165('0x2a')]['Intervals'])){_0x1a5b82=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xa165('0x2b')](_0x1dd208[_0xa165('0x29')])||_[_0xa165('0x2b')](_0x1dd208['Interval'][_0xa165('0x2c')])){_0x1a5b82=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x5a7d16&&!timezones[_0x5a7d16]){_0x1a5b82=CAMPAIGN_STATUS[_0xa165('0x2d')];}return _0x1a5b82;}function checkAnyValidTrunk(_0x307f0a,_0x120564){var _0x59d49d=null;var _0xbd6dfb=_0xa165('0x2e');var _0x360bf3=[_0xa165('0x2f'),_0xa165('0x30')];var _0x1b3adf=!![];if(_0x307f0a[_0xa165('0x25')]&&_0x307f0a[_0xa165('0x25')][_0xa165('0x18')]){_0xbd6dfb+=_0x307f0a[_0xa165('0x25')][_0xa165('0x26')];_0x59d49d=_0x120564[_0xbd6dfb];_0x1b3adf=_0x360bf3[_0xa165('0x31')](_0x59d49d[_0xa165('0x32')]);}else if(_0x307f0a[_0xa165('0x33')]&&_0x307f0a[_0xa165('0x33')]['active']){_0xbd6dfb+=_0x307f0a[_0xa165('0x33')][_0xa165('0x26')];_0x59d49d=_0x120564[_0xbd6dfb];_0x1b3adf=_0x360bf3[_0xa165('0x31')](_0x59d49d[_0xa165('0x32')]);}return _0x1b3adf;}function getQueueCampaignStatusMessage(_0x2a614c,_0x199b3c){var _0x2eb8a4=CAMPAIGN_STATUS[_0xa165('0x34')];var _0x260e6d=isPreviewCampaign(_0x2a614c);if(!isQueueCampaignActive(_0x2a614c)){if(_0x260e6d){_0x2eb8a4=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2a614c['originated']===0x0&&_0x2a614c[_0xa165('0x21')]===0x0&&_0x2a614c[_0xa165('0x22')]===0x0&&(_0x2a614c['pTalking']||0x0)===0x0){_0x2eb8a4=CAMPAIGN_STATUS[_0xa165('0x35')];}else{_0x2eb8a4=CAMPAIGN_STATUS[_0xa165('0x36')];}}}else if(_0x2a614c[_0xa165('0x1e')]===0x0){_0x2eb8a4=CAMPAIGN_STATUS[_0xa165('0x37')];}else if(!checkAnyValidTrunk(_0x2a614c,_0x199b3c)){_0x2eb8a4=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2a614c)){var _0x46e603=checkAnyValidQueueCampaignInterval(_0x2a614c);if(_0x46e603){_0x2eb8a4=_0x46e603;}}return _0x2eb8a4;}exports[_0xa165('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x364a9a){var _0x4c2fb0=CAMPAIGN_STATUS[_0xa165('0x36')];if(_0x364a9a[_0xa165('0x24')]===0x0&&_0x364a9a[_0xa165('0x21')]===0x0&&_0x364a9a[_0xa165('0x22')]===0x0&&(_0x364a9a[_0xa165('0x39')]||0x0)===0x0){_0x4c2fb0=CAMPAIGN_STATUS[_0xa165('0x35')];}return _0x4c2fb0;}exports[_0xa165('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x38a0d7){var _0x3af671=_0x38a0d7[_0xa165('0x3b')](/"(.*?)"/);return _0x3af671?_0x3af671[0x1]:_0x38a0d7;}exports[_0xa165('0x3c')]=extractCalleridName;function getCallerId(_0x185ed9,_0x1ac81c,_0x211655){if(!_['isUndefined'](_0x211655)&&typeof _0x211655===_0xa165('0x3d')&&!_[_0xa165('0x2b')](_0x211655)){if(!_[_0xa165('0x3e')](_0x1ac81c)&&typeof _0x1ac81c===_0xa165('0x3d')&&!_[_0xa165('0x2b')](_0x1ac81c)){return util[_0xa165('0x3f')](_0xa165('0x40'),_0x1ac81c,_0x211655);}return util[_0xa165('0x3f')](_0xa165('0x40'),_0x211655,_0x211655);}if(!_[_0xa165('0x3e')](_0x185ed9)&&typeof _0x185ed9===_0xa165('0x3d')&&!_[_0xa165('0x2b')](_0x185ed9)){return _0x185ed9;}return'\x22\x22\x20<>';}exports[_0xa165('0x41')]=getCallerId;function getCallerIdRandom(_0x4cc417,_0x390de3){var _0x4c1ab7;var _0x480548;var _0x3d26db;if(_0x390de3<=0x0){_0x390de3=0x1;}_0x4c1ab7=new RegExp('\x5cw{0,'+_0x390de3+'}$');_0x480548=Math[_0xa165('0x42')](0xa,_0x390de3-0x1);_0x3d26db=Math['pow'](0xa,_0x390de3)-0x1;return util[_0xa165('0x3f')]('%s',_[_0xa165('0x43')](_0x4cc417,_0x4c1ab7,_[_0xa165('0x44')](_0x480548,_0x3d26db)[_0xa165('0x45')]()));}exports[_0xa165('0x46')]=getCallerIdRandom;function decrementOriginate(_0x20251e){if(_0x20251e[_0xa165('0x24')]&&_0x20251e[_0xa165('0x24')]>0x0){_0x20251e[_0xa165('0x24')]-=0x1;}else{logger[_0xa165('0x47')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xa165('0x48')]=decrementOriginate;function checkContactEmpty(_0x3feca3){return _0x3feca3&&_0x3feca3['length']>0x0;}exports[_0xa165('0x49')]=checkContactEmpty;function erlangb(_0x45cc9b,_0x13116a){if(_0x13116a===0x0){return 0x0;}var _0x51b6a0=0x1;for(var _0x3c0f4e=0x1;_0x3c0f4e<=_0x13116a;_0x3c0f4e+=0x1){_0x51b6a0=0x1+_0x51b6a0*_0x3c0f4e/_0x45cc9b;}return 0x1/_0x51b6a0;}exports[_0xa165('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x50d319,_0x316caa,_0x551db9){if(_0x316caa>_0x551db9){for(var _0x239128=0x0;_0x239128<_0x316caa-_0x551db9;_0x239128+=0x1){decrementOriginate(_0x50d319);}}}exports[_0xa165('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4ad06f){var _0x4e3574={};var _0x3e55cb=['id',_0xa165('0x4c'),_0xa165('0x4d'),_0xa165('0x4e'),'updatedAt'];if(_0x4ad06f){for(var _0x3da808 in _0x4ad06f){if(typeof _0x4ad06f[_0x3da808]!=='undefined'){if(!_[_0xa165('0x28')](_0x4ad06f[_0x3da808])&&!_0x3e55cb['includes'](_0x3da808)){_0x4e3574[util[_0xa165('0x3f')]('%s%s',_0xa165('0x4f'),_0x3da808[_0xa165('0x50')]())]=_0x4ad06f[_0x3da808];}}}}return _0x4e3574;}exports[_0xa165('0x51')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2c75da4..3694575 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(_0x35c464,_0x1d976b){var _0xb83aac=function(_0x27ef81){while(--_0x27ef81){_0x35c464['push'](_0x35c464['shift']());}};_0xb83aac(++_0x1d976b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x1f0aba,_0x438de9){var _0x545a52=function(_0x4bed40){while(--_0x4bed40){_0x1f0aba['push'](_0x1f0aba['shift']());}};_0x545a52(++_0x438de9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 c80afff..4e8f981 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 _0x9012=['bind','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','value','channelstate','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','varset'];(function(_0x50db0d,_0x8c4eb7){var _0x2b8907=function(_0x470e12){while(--_0x470e12){_0x50db0d['push'](_0x50db0d['shift']());}};_0x2b8907(++_0x8c4eb7);}(_0x9012,0x1b0));var _0x2901=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x9012[_0x2a0350];return _0x425220;};'use strict';var util=require(_0x2901('0x0'));var _=require(_0x2901('0x1'));var BPromise=require('bluebird');var uuid=require(_0x2901('0x2'));var moment=require(_0x2901('0x3'));var path=require(_0x2901('0x4'));var tiff2pdf=require(_0x2901('0x5'));var gs=require('./util/gs');var logger=require(_0x2901('0x6'))(_0x2901('0x7'));var ami=require('../ami');var rpcDb=require(_0x2901('0x8'));var Channel=require('./channel');var ut=require(_0x2901('0x9'));var Action=require(_0x2901('0xa'));var faxAccount=require(_0x2901('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x35b8fd){this[_0x2901('0xc')]={};this[_0x2901('0xd')]=_0x35b8fd[_0x2901('0xd')];this[_0x2901('0xe')]=_0x35b8fd['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0x2901('0xf'),this['syncVarSet'][_0x2901('0x10')](this));ami['on'](_0x2901('0x11'),this[_0x2901('0x12')][_0x2901('0x10')](this));ami['on']('newexten',this[_0x2901('0x13')][_0x2901('0x10')](this));ami['on'](_0x2901('0x14'),this[_0x2901('0x15')][_0x2901('0x10')](this));ami['on'](_0x2901('0x16'),this[_0x2901('0x17')]['bind'](this));ami['on'](_0x2901('0x18'),this[_0x2901('0x19')][_0x2901('0x10')](this));ami['on'](_0x2901('0x1a'),this[_0x2901('0x1b')][_0x2901('0x10')](this));}Fax[_0x2901('0x1c')][_0x2901('0x1d')]=function(_0x3d3472){if(_0x3d3472[_0x2901('0x1e')]===_0x2901('0x1f')){for(var _0x51a414 in this[_0x2901('0xd')]){if(this[_0x2901('0xd')][_0x2901('0x20')](_0x51a414)){if(_0x3d3472[_0x2901('0x21')]===this['faxAccounts'][_0x51a414]['localstationid']){this[_0x2901('0xc')][_0x3d3472['uniqueid']]={};this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]][_0x2901('0x23')]=_0x3d3472[_0x2901('0x23')];this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]['id']=this[_0x2901('0xd')][_0x51a414]['id'];this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]['name']=this[_0x2901('0xd')][_0x51a414][_0x2901('0x24')];logger[_0x2901('0x25')](_0x3d3472[_0x2901('0x22')],_0x2901('0x26'));}}}}if(this[_0x2901('0x27')][_0x3d3472[_0x2901('0x22')]]){this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]={};this[_0x2901('0xc')][_0x3d3472['uniqueid']]['channel']=_0x3d3472[_0x2901('0x23')];logger[_0x2901('0x25')](_0x3d3472[_0x2901('0x22')],_0x2901('0x26'));}};Fax[_0x2901('0x1c')][_0x2901('0x28')]=function(_0x927ec6){if(this[_0x2901('0xc')][_0x927ec6['uniqueid']]){for(var _0x36efc0 in _0x927ec6[_0x2901('0x29')]){if(_0x927ec6['variable'][_0x2901('0x20')](_0x36efc0)){this[_0x2901('0xc')][_0x927ec6[_0x2901('0x22')]][_0x36efc0]=_0x927ec6[_0x2901('0x2a')];}}}};Fax[_0x2901('0x1c')][_0x2901('0x12')]=function(_0x260272){if(this[_0x2901('0xc')][_0x260272[_0x2901('0x22')]]){this['channels'][_0x260272[_0x2901('0x22')]]['channelstate']=_0x260272[_0x2901('0x2b')];this[_0x2901('0xc')][_0x260272[_0x2901('0x22')]]['channelstatedesc']=_0x260272['channelstatedesc'];}};Fax['prototype'][_0x2901('0x13')]=function(_0x2d4dd){if(this['channels'][_0x2d4dd[_0x2901('0x22')]]){for(var _0x480dac in _0x2d4dd[_0x2901('0x29')]){if(_0x2d4dd[_0x2901('0x29')][_0x2901('0x20')](_0x480dac)){this[_0x2901('0xc')][_0x2d4dd['uniqueid']][_0x480dac]=_0x2d4dd['value'];}}}};Fax[_0x2901('0x1c')][_0x2901('0x15')]=function(_0x3507c4){if(this[_0x2901('0xc')][_0x3507c4['uniqueid']]){this[_0x2901('0xc')][_0x3507c4[_0x2901('0x22')]]['operation']=_0x3507c4[_0x2901('0x2c')];this[_0x2901('0xc')][_0x3507c4['uniqueid']][_0x2901('0x2d')]=_0x3507c4[_0x2901('0x2d')];this['channels'][_0x3507c4[_0x2901('0x22')]][_0x2901('0x2e')]=_0x3507c4[_0x2901('0x2e')];this['channels'][_0x3507c4[_0x2901('0x22')]][_0x2901('0x2f')]=_0x3507c4[_0x2901('0x2f')];logger[_0x2901('0x25')](_0x3507c4[_0x2901('0x22')],_0x2901('0x30'));}};Fax[_0x2901('0x1c')]['syncReceiveFax']=function(_0x4c6ce0){var _0x29d764=this;if(this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]]){var _0x2ea0df=this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]]['id'];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x31')]=_0x4c6ce0[_0x2901('0x31')];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x32')]=_0x4c6ce0['pagestransferred'];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x2e')]=_0x4c6ce0[_0x2901('0x2e')];this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x33')]=_0x4c6ce0[_0x2901('0x33')];this['channels'][_0x4c6ce0['uniqueid']][_0x2901('0x34')]=_0x4c6ce0[_0x2901('0x34')];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x2f')]=_0x4c6ce0[_0x2901('0x2f')];this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x35')]=_0x4c6ce0[_0x2901('0x35')];if(this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x32')]>0x0){tiff2pdf(_0x4c6ce0[_0x2901('0x2f')],_0x2901('0x36'),function(_0x4a5339){logger['info'](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x37'),_0x4a5339[_0x2901('0x38')]);attachment[_0x2901('0x39')]({'name':path['parse'](_0x4c6ce0[_0x2901('0x2f')])['name'],'basename':path[_0x2901('0x3a')](_0x4c6ce0[_0x2901('0x2f')])['name']+'.pdf','type':_0x2901('0x3b')})[_0x2901('0x3c')](function(_0x4a8c45){faxAccount[_0x2901('0x3d')](_0x2ea0df,{'from':_0x4c6ce0[_0x2901('0x35')],'mapKey':_0x2901('0x7'),'body':path[_0x2901('0x3a')](_0x4c6ce0[_0x2901('0x2f')])['name']+_0x2901('0x3e'),'AttachmentId':_0x4a8c45['id']})[_0x2901('0x3f')](function(_0x486018){logger[_0x2901('0x40')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x41'),JSON[_0x2901('0x42')](_0x486018));});})['catch'](function(_0x3f9371){logger[_0x2901('0x40')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x43'),JSON[_0x2901('0x42')](_0x3f9371));});});}logger[_0x2901('0x25')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x43'));}};Fax[_0x2901('0x1c')][_0x2901('0x1b')]=function(_0x374c46){if(this['actions'][_0x374c46['uniqueid']]){_[_0x2901('0x44')](this[_0x2901('0xc')][_0x374c46['uniqueid']],_['pick'](_0x374c46,[_0x2901('0x45'),_0x2901('0x46')]));}};function updateStatus(_0x47ee96){if(_0x47ee96[_0x2901('0x47')]){faxMessage['update'](_0x47ee96[_0x2901('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2901('0x3c')](function(_0x2bf38b){ut[_0x2901('0x48')]('[Fax][Message][Error][Updated]',_0x2bf38b);})[_0x2901('0x3f')](function(_0x40ac9b){ut[_0x2901('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x40ac9b);});}else{ut[_0x2901('0x48')](_0x2901('0x49'));}}Fax[_0x2901('0x1c')][_0x2901('0x4a')]=function(_0x1bcaab,_0x6a1a24,_0x2ace66){var _0x12956d=this;var _0x178820={};if(_0x6a1a24){_0x178820={'read':_0x6a1a24};}else{_0x178820={'failMessage':_0x2ace66};}if(this[_0x2901('0x27')][_0x1bcaab][_0x2901('0x47')]){faxMessage[_0x2901('0x4b')](this[_0x2901('0x27')][_0x1bcaab]['AttachmentId'],_0x178820)[_0x2901('0x3c')](function(_0x19cb2a){ut[_0x2901('0x48')]('[Fax][Message][Updated]',_0x19cb2a);})[_0x2901('0x3f')](function(_0x50f000){ut['logger'](_0x2901('0x4c'),_0x50f000);})[_0x2901('0x4d')](function(){delete _0x12956d['channels'][_0x1bcaab];delete _0x12956d[_0x2901('0x27')][_0x1bcaab];});}else{ut[_0x2901('0x48')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x1bcaab];delete this[_0x2901('0x27')][_0x1bcaab];}};Fax[_0x2901('0x1c')][_0x2901('0x19')]=function(_0x343aae){var _0x4597df=this;if(this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]){if(this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]){this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]['id']=this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]['id'];this[_0x2901('0xc')][_0x343aae['uniqueid']][_0x2901('0x24')]=this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]['name'];}logger['info'](_0x343aae[_0x2901('0x22')],this['actions'][_0x343aae[_0x2901('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x2901('0x42')](this['channels'][_0x343aae[_0x2901('0x22')]]));if(this['actions'][_0x343aae['uniqueid']]){if(this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]][_0x2901('0x4e')]>0x0&&this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]['faxstatus']===_0x2901('0x4f')){this[_0x2901('0x4a')](_0x343aae[_0x2901('0x22')],!![]);}else{this[_0x2901('0x4a')](_0x343aae[_0x2901('0x22')],![],this[_0x2901('0xc')][_0x343aae['uniqueid']][_0x2901('0x50')]?_0x2901('0x51')+this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]][_0x2901('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x2901('0x1c')][_0x2901('0x52')]=function(_0x43ed36){var _0xb61888=this;return new BPromise(function(_0x57bafa,_0x3489c3){_0xb61888[_0x2901('0x53')](_0x43ed36,_0xb61888[_0x2901('0xd')][_0x43ed36['FaxAccountId']])['then'](function(_0x573094){ut[_0x2901('0x48')](_0x2901('0x54'),_0x573094);_0x57bafa(ut[_0x2901('0x38')](_0x2901('0x55')));})[_0x2901('0x3f')](function(_0x7cf0c6){ut[_0x2901('0x48')](_0x2901('0x56'),_0x7cf0c6);updateStatus(_0x43ed36);_0x3489c3(ut['message'](_0x2901('0x57')));});});};Fax[_0x2901('0x1c')][_0x2901('0x58')]=function(_0x44ee4e){var _0x579351=this;return new BPromise(function(_0x2e9a58,_0x28aa3f){var _0x4502fa=_0x579351[_0x2901('0x59')](_0x579351[_0x2901('0xd')][_0x44ee4e['FaxAccountId']][_0x2901('0x5a')],_0x44ee4e);if(_0x4502fa[_0x2901('0x5b')]){_0x2e9a58(ut[_0x2901('0x38')]('Trunk\x20Reachable'));}else{_0x28aa3f(ut[_0x2901('0x38')](_0x4502fa[_0x2901('0x38')]));}});};function originate(_0x2d76d1,_0x17a031,_0x2452fa){return new BPromise(function(_0x588c5a,_0xea8337){if(_0x2452fa){var _0x394dcb=util[_0x2901('0x5c')](_0x2901('0x5d'),path['parse'](_0x2d76d1[_0x2901('0x4')])[_0x2901('0x24')],_0x2d76d1[_0x2901('0x4')]);gs[_0x2901('0x5e')](_0x394dcb)[_0x2901('0x3c')](function(){_0x2d76d1[_0x2901('0x4')]=util[_0x2901('0x5c')](_0x2901('0x5f'),path['parse'](_0x2d76d1[_0x2901('0x4')])['dir'],path['parse'](_0x2d76d1[_0x2901('0x4')])[_0x2901('0x24')]);_0x17a031[_0x2901('0x60')]=_0x2d76d1[_0x2901('0x4')];ut['logger'](_0x2901('0x61'),'');ami[_0x2901('0x62')](ut[_0x2901('0x63')](_0x2d76d1,_0x17a031))[_0x2901('0x3c')](function(_0x2de2b0){_0x588c5a(_0x2de2b0);})['catch'](function(_0x5aee91){_0xea8337(_0x5aee91);});})[_0x2901('0x3f')](function(_0x3bb530){_0xea8337(_0x3bb530);});}else{ami[_0x2901('0x62')](ut[_0x2901('0x63')](_0x2d76d1,_0x17a031))[_0x2901('0x3c')](function(_0x3e31b9){_0x588c5a(_0x3e31b9);})[_0x2901('0x3f')](function(_0x7649cf){_0xea8337(_0x7649cf);});}});}Fax[_0x2901('0x1c')][_0x2901('0x53')]=function(_0x257988,_0x3edf0a){var _0x429821=this;return new BPromise(function(_0x48ac1e,_0xa08a37){var _0x3f33b5=uuid['v4']();var _0x4a89c3=ut['addVariables'](_0x257988,_0x3edf0a);_0x429821[_0x2901('0x27')][_0x3f33b5]=new Action(_0x3f33b5,_0x3edf0a,_0x257988);var _0x25b732=_0x429821[_0x2901('0x27')][_0x3f33b5];if(path[_0x2901('0x3a')](_0x257988[_0x2901('0x4')])[_0x2901('0x64')]===_0x2901('0x3e')){originate(_0x25b732,_0x4a89c3,!![])[_0x2901('0x3c')](function(_0x3ecd0b){_0x48ac1e(_0x3ecd0b);})['catch'](function(_0x958a1b){_0xa08a37(_0x958a1b);});}else{originate(_0x25b732,_0x4a89c3,![])[_0x2901('0x3c')](function(_0x4f8678){_0x48ac1e(_0x4f8678);})[_0x2901('0x3f')](function(_0x2cdbee){_0xa08a37(_0x2cdbee);});}});};Fax['prototype']['isTrunkReachable']=function(_0x21d0c6){return!_[_0x2901('0x65')](_0x21d0c6)&&!_[_0x2901('0x65')](_0x21d0c6['name'])&&!_[_0x2901('0x65')](_0x21d0c6[_0x2901('0x66')])&&_0x21d0c6['active']&&!_['isNil'](this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])])&&!_['isNil'](this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')])&&(this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')]===_0x2901('0x68')||this[_0x2901('0xe')][util[_0x2901('0x5c')]('SIP/%s',_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')]===_0x2901('0x69'));};Fax[_0x2901('0x1c')][_0x2901('0x59')]=function(_0x4a1dce,_0x40faa4){if(!this['isTrunkReachable'](_0x4a1dce)){ut[_0x2901('0x48')](_0x2901('0x6a'),_[_0x2901('0x65')](_0x4a1dce)?'':_0x4a1dce['name']+_0x2901('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x2901('0x65')](_0x40faa4[_0x2901('0x7')])){ut[_0x2901('0x48')](_0x2901('0x6c'),JSON[_0x2901('0x42')](_0x40faa4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2901('0x65')](_0x40faa4['path'])){ut[_0x2901('0x48')](_0x2901('0x6d'),JSON[_0x2901('0x42')](_0x40faa4));return{'isValid':![],'message':_0x2901('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2901('0x6f')]=Fax; \ No newline at end of file +var _0x3080=['[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','calleridnum','pagestransferred','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','format','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly'];(function(_0x42855f,_0x3c26c1){var _0x38511b=function(_0x4dab30){while(--_0x4dab30){_0x42855f['push'](_0x42855f['shift']());}};_0x38511b(++_0x3c26c1);}(_0x3080,0xf3));var _0x0308=function(_0x4d184c,_0x1169e3){_0x4d184c=_0x4d184c-0x0;var _0x3b254a=_0x3080[_0x4d184c];return _0x3b254a;};'use strict';var util=require(_0x0308('0x0'));var _=require(_0x0308('0x1'));var BPromise=require('bluebird');var uuid=require(_0x0308('0x2'));var moment=require(_0x0308('0x3'));var path=require(_0x0308('0x4'));var tiff2pdf=require(_0x0308('0x5'));var gs=require('./util/gs');var logger=require(_0x0308('0x6'))(_0x0308('0x7'));var ami=require('../ami');var rpcDb=require(_0x0308('0x8'));var Channel=require(_0x0308('0x9'));var ut=require('./util/util');var Action=require(_0x0308('0xa'));var faxAccount=require(_0x0308('0xb'));var attachment=require(_0x0308('0xc'));var faxMessage=require(_0x0308('0xd'));function Fax(_0x27bb6b){this[_0x0308('0xe')]={};this[_0x0308('0xf')]=_0x27bb6b['faxAccounts'];this[_0x0308('0x10')]=_0x27bb6b[_0x0308('0x10')];this[_0x0308('0x11')]={};ami['on']('newchannel',this[_0x0308('0x12')]['bind'](this));ami['on'](_0x0308('0x13'),this[_0x0308('0x14')][_0x0308('0x15')](this));ami['on'](_0x0308('0x16'),this[_0x0308('0x17')][_0x0308('0x15')](this));ami['on'](_0x0308('0x18'),this[_0x0308('0x19')][_0x0308('0x15')](this));ami['on'](_0x0308('0x1a'),this[_0x0308('0x1b')]['bind'](this));ami['on'](_0x0308('0x1c'),this[_0x0308('0x1d')][_0x0308('0x15')](this));ami['on'](_0x0308('0x1e'),this[_0x0308('0x1f')][_0x0308('0x15')](this));ami['on'](_0x0308('0x20'),this[_0x0308('0x21')][_0x0308('0x15')](this));}Fax['prototype'][_0x0308('0x12')]=function(_0x54e36e){if(_0x54e36e[_0x0308('0x22')]===_0x0308('0x23')){for(var _0x49e99f in this[_0x0308('0xf')]){if(this[_0x0308('0xf')][_0x0308('0x24')](_0x49e99f)){if(_0x54e36e[_0x0308('0x25')]===this[_0x0308('0xf')][_0x49e99f][_0x0308('0x26')]){this[_0x0308('0xe')][_0x54e36e['uniqueid']]={};this[_0x0308('0xe')][_0x54e36e[_0x0308('0x27')]]['channel']=_0x54e36e[_0x0308('0x28')];this[_0x0308('0xe')][_0x54e36e[_0x0308('0x27')]]['id']=this[_0x0308('0xf')][_0x49e99f]['id'];this[_0x0308('0xe')][_0x54e36e[_0x0308('0x27')]][_0x0308('0x29')]=this['faxAccounts'][_0x49e99f][_0x0308('0x29')];logger[_0x0308('0x2a')](_0x54e36e[_0x0308('0x27')],'\x20syncNewchannel\x20');}}}}if(this[_0x0308('0x11')][_0x54e36e[_0x0308('0x27')]]){this[_0x0308('0xe')][_0x54e36e[_0x0308('0x27')]]={};this[_0x0308('0xe')][_0x54e36e[_0x0308('0x27')]][_0x0308('0x28')]=_0x54e36e[_0x0308('0x28')];logger[_0x0308('0x2a')](_0x54e36e[_0x0308('0x27')],'\x20syncNewchannel\x20');}};Fax[_0x0308('0x2b')][_0x0308('0x14')]=function(_0x3ebd90){if(this[_0x0308('0xe')][_0x3ebd90[_0x0308('0x27')]]){for(var _0x3febec in _0x3ebd90[_0x0308('0x2c')]){if(_0x3ebd90[_0x0308('0x2c')][_0x0308('0x24')](_0x3febec)){this['channels'][_0x3ebd90[_0x0308('0x27')]][_0x3febec]=_0x3ebd90[_0x0308('0x2d')];}}}};Fax[_0x0308('0x2b')][_0x0308('0x17')]=function(_0x48cf39){if(this['channels'][_0x48cf39['uniqueid']]){this[_0x0308('0xe')][_0x48cf39['uniqueid']][_0x0308('0x2e')]=_0x48cf39['channelstate'];this[_0x0308('0xe')][_0x48cf39[_0x0308('0x27')]][_0x0308('0x2f')]=_0x48cf39[_0x0308('0x2f')];}};Fax[_0x0308('0x2b')][_0x0308('0x19')]=function(_0x1152b2){if(this['channels'][_0x1152b2[_0x0308('0x27')]]){for(var _0x3b4189 in _0x1152b2[_0x0308('0x2c')]){if(_0x1152b2[_0x0308('0x2c')]['hasOwnProperty'](_0x3b4189)){this[_0x0308('0xe')][_0x1152b2['uniqueid']][_0x3b4189]=_0x1152b2[_0x0308('0x2d')];}}}};Fax[_0x0308('0x2b')][_0x0308('0x1b')]=function(_0x551ace){if(this[_0x0308('0xe')][_0x551ace['uniqueid']]){this['channels'][_0x551ace[_0x0308('0x27')]][_0x0308('0x30')]=_0x551ace[_0x0308('0x30')];this[_0x0308('0xe')][_0x551ace[_0x0308('0x27')]][_0x0308('0x31')]=_0x551ace[_0x0308('0x31')];this['channels'][_0x551ace[_0x0308('0x27')]][_0x0308('0x26')]=_0x551ace['localstationid'];this[_0x0308('0xe')][_0x551ace[_0x0308('0x27')]][_0x0308('0x32')]=_0x551ace['filename'];logger[_0x0308('0x2a')](_0x551ace[_0x0308('0x27')],_0x0308('0x33'));}};Fax[_0x0308('0x2b')]['syncReceiveFax']=function(_0x2e3be9){var _0x81c4a0=this;if(this[_0x0308('0xe')][_0x2e3be9[_0x0308('0x27')]]){var _0x19da89=this[_0x0308('0xe')][_0x2e3be9['uniqueid']]['id'];this['channels'][_0x2e3be9[_0x0308('0x27')]]['remotestationid']=_0x2e3be9[_0x0308('0x34')];this[_0x0308('0xe')][_0x2e3be9[_0x0308('0x27')]]['pagestransferred']=_0x2e3be9['pagestransferred'];this['channels'][_0x2e3be9[_0x0308('0x27')]][_0x0308('0x26')]=_0x2e3be9[_0x0308('0x26')];this['channels'][_0x2e3be9[_0x0308('0x27')]][_0x0308('0x35')]=_0x2e3be9[_0x0308('0x35')];this[_0x0308('0xe')][_0x2e3be9[_0x0308('0x27')]]['transferrate']=_0x2e3be9['transferrate'];this[_0x0308('0xe')][_0x2e3be9[_0x0308('0x27')]][_0x0308('0x32')]=_0x2e3be9['filename'];this[_0x0308('0xe')][_0x2e3be9['uniqueid']][_0x0308('0x36')]=_0x2e3be9[_0x0308('0x36')];if(this[_0x0308('0xe')][_0x2e3be9[_0x0308('0x27')]][_0x0308('0x37')]>0x0){tiff2pdf(_0x2e3be9[_0x0308('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x1cbd2d){logger['info'](_0x2e3be9[_0x0308('0x27')],_0x0308('0x38'),_0x1cbd2d[_0x0308('0x39')]);attachment['create']({'name':path[_0x0308('0x3a')](_0x2e3be9['filename'])['name'],'basename':path[_0x0308('0x3a')](_0x2e3be9[_0x0308('0x32')])[_0x0308('0x29')]+_0x0308('0x3b'),'type':_0x0308('0x3c')})[_0x0308('0x3d')](function(_0x1310b8){faxAccount[_0x0308('0x3e')](_0x19da89,{'from':_0x2e3be9[_0x0308('0x36')],'mapKey':_0x0308('0x7'),'body':path[_0x0308('0x3a')](_0x2e3be9[_0x0308('0x32')])[_0x0308('0x29')]+_0x0308('0x3b'),'AttachmentId':_0x1310b8['id']})[_0x0308('0x3f')](function(_0x1ccdad){logger[_0x0308('0x40')](_0x2e3be9['uniqueid'],'\x20notify\x20',JSON[_0x0308('0x41')](_0x1ccdad));});})[_0x0308('0x3f')](function(_0x1e0e6d){logger['error'](_0x2e3be9[_0x0308('0x27')],_0x0308('0x42'),JSON['stringify'](_0x1e0e6d));});});}logger[_0x0308('0x2a')](_0x2e3be9['uniqueid'],_0x0308('0x42'));}};Fax['prototype'][_0x0308('0x21')]=function(_0x3ddf7c){if(this[_0x0308('0x11')][_0x3ddf7c['uniqueid']]){_[_0x0308('0x43')](this[_0x0308('0xe')][_0x3ddf7c[_0x0308('0x27')]],_[_0x0308('0x44')](_0x3ddf7c,['response','reason']));}};function updateStatus(_0x27bf57){if(_0x27bf57[_0x0308('0x45')]){faxMessage[_0x0308('0x46')](_0x27bf57[_0x0308('0x45')],{'failMessage':_0x0308('0x47')})[_0x0308('0x3d')](function(_0x140dfc){ut[_0x0308('0x48')]('[Fax][Message][Error][Updated]',_0x140dfc);})['catch'](function(_0x121bba){ut['logger'](_0x0308('0x49'),_0x121bba);});}else{ut[_0x0308('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x0308('0x2b')][_0x0308('0x4a')]=function(_0x28b57d,_0x594263,_0x483e5c){var _0x5be875=this;var _0xa42846={};if(_0x594263){_0xa42846={'read':_0x594263};}else{_0xa42846={'failMessage':_0x483e5c};}if(this[_0x0308('0x11')][_0x28b57d][_0x0308('0x45')]){faxMessage[_0x0308('0x46')](this['actions'][_0x28b57d][_0x0308('0x45')],_0xa42846)[_0x0308('0x3d')](function(_0x583f09){ut['logger'](_0x0308('0x4b'),_0x583f09);})['catch'](function(_0x4e6856){ut[_0x0308('0x48')](_0x0308('0x4c'),_0x4e6856);})[_0x0308('0x4d')](function(){delete _0x5be875[_0x0308('0xe')][_0x28b57d];delete _0x5be875['actions'][_0x28b57d];});}else{ut['logger'](_0x0308('0x4e'));delete this['channels'][_0x28b57d];delete this[_0x0308('0x11')][_0x28b57d];}};Fax[_0x0308('0x2b')][_0x0308('0x1f')]=function(_0x5c9a38){var _0x1fbca6=this;if(this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]]){if(this[_0x0308('0x11')][_0x5c9a38[_0x0308('0x27')]]){this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]]['id']=this[_0x0308('0x11')][_0x5c9a38[_0x0308('0x27')]]['id'];this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]][_0x0308('0x29')]=this['actions'][_0x5c9a38[_0x0308('0x27')]][_0x0308('0x29')];}logger[_0x0308('0x2a')](_0x5c9a38[_0x0308('0x27')],this[_0x0308('0x11')][_0x5c9a38['uniqueid']]?_0x0308('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x0308('0x41')](this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]]));if(this[_0x0308('0x11')][_0x5c9a38[_0x0308('0x27')]]){if(this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]][_0x0308('0x50')]>0x0&&this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]]['faxstatus']===_0x0308('0x51')){this['updateStatus'](_0x5c9a38[_0x0308('0x27')],!![]);}else{this[_0x0308('0x4a')](_0x5c9a38[_0x0308('0x27')],![],this[_0x0308('0xe')][_0x5c9a38[_0x0308('0x27')]][_0x0308('0x52')]?_0x0308('0x53')+this['channels'][_0x5c9a38[_0x0308('0x27')]]['faxstatusstring']:_0x0308('0x54'));}}}};Fax[_0x0308('0x2b')][_0x0308('0x55')]=function(_0x455ba8){var _0x1a65d5=this;return new BPromise(function(_0x2751cd,_0x3bec9c){_0x1a65d5[_0x0308('0x56')](_0x455ba8,_0x1a65d5[_0x0308('0xf')][_0x455ba8[_0x0308('0x57')]])[_0x0308('0x3d')](function(_0x316fb1){ut[_0x0308('0x48')](_0x0308('0x58'),_0x316fb1);_0x2751cd(ut[_0x0308('0x39')](_0x0308('0x59')));})[_0x0308('0x3f')](function(_0xaee09c){ut[_0x0308('0x48')](_0x0308('0x5a'),_0xaee09c);updateStatus(_0x455ba8);_0x3bec9c(ut[_0x0308('0x39')]('Fax\x20failed'));});});};Fax[_0x0308('0x2b')]['checkAfterSend']=function(_0x35481c){var _0x19b795=this;return new BPromise(function(_0x54435a,_0x530302){var _0x3114b8=_0x19b795[_0x0308('0x5b')](_0x19b795[_0x0308('0xf')][_0x35481c[_0x0308('0x57')]][_0x0308('0x5c')],_0x35481c);if(_0x3114b8['isValid']){_0x54435a(ut[_0x0308('0x39')](_0x0308('0x5d')));}else{_0x530302(ut[_0x0308('0x39')](_0x3114b8[_0x0308('0x39')]));}});};function originate(_0x4acdef,_0x345228,_0x51d87d){return new BPromise(function(_0x526e15,_0x252bbf){if(_0x51d87d){var _0x1ae2b8=util['format'](_0x0308('0x5e'),path[_0x0308('0x3a')](_0x4acdef['path'])[_0x0308('0x29')],_0x4acdef['path']);gs[_0x0308('0x5f')](_0x1ae2b8)['then'](function(){_0x4acdef[_0x0308('0x4')]=util['format'](_0x0308('0x60'),path[_0x0308('0x3a')](_0x4acdef[_0x0308('0x4')])[_0x0308('0x61')],path[_0x0308('0x3a')](_0x4acdef['path'])[_0x0308('0x29')]);_0x345228[_0x0308('0x62')]=_0x4acdef[_0x0308('0x4')];ut['logger'](_0x0308('0x63'),'');ami[_0x0308('0x64')](ut['variablesAction'](_0x4acdef,_0x345228))[_0x0308('0x3d')](function(_0x43a417){_0x526e15(_0x43a417);})['catch'](function(_0x5f5a27){_0x252bbf(_0x5f5a27);});})['catch'](function(_0x5b20ec){_0x252bbf(_0x5b20ec);});}else{ami['Action'](ut[_0x0308('0x65')](_0x4acdef,_0x345228))[_0x0308('0x3d')](function(_0x21a3c3){_0x526e15(_0x21a3c3);})['catch'](function(_0x4b5ee1){_0x252bbf(_0x4b5ee1);});}});}Fax[_0x0308('0x2b')][_0x0308('0x56')]=function(_0x11f91e,_0x1026ad){var _0x3dd8d1=this;return new BPromise(function(_0x2507b9,_0x32c396){var _0x239f53=uuid['v4']();var _0x563f9f=ut[_0x0308('0x66')](_0x11f91e,_0x1026ad);_0x3dd8d1[_0x0308('0x11')][_0x239f53]=new Action(_0x239f53,_0x1026ad,_0x11f91e);var _0x343f97=_0x3dd8d1[_0x0308('0x11')][_0x239f53];if(path[_0x0308('0x3a')](_0x11f91e[_0x0308('0x4')])[_0x0308('0x67')]===_0x0308('0x3b')){originate(_0x343f97,_0x563f9f,!![])[_0x0308('0x3d')](function(_0x2080e2){_0x2507b9(_0x2080e2);})[_0x0308('0x3f')](function(_0x43365){_0x32c396(_0x43365);});}else{originate(_0x343f97,_0x563f9f,![])[_0x0308('0x3d')](function(_0x47e50d){_0x2507b9(_0x47e50d);})[_0x0308('0x3f')](function(_0x17d0d3){_0x32c396(_0x17d0d3);});}});};Fax[_0x0308('0x2b')][_0x0308('0x68')]=function(_0x2b55fa){return!_[_0x0308('0x69')](_0x2b55fa)&&!_[_0x0308('0x69')](_0x2b55fa[_0x0308('0x29')])&&!_[_0x0308('0x69')](_0x2b55fa[_0x0308('0x6a')])&&_0x2b55fa[_0x0308('0x6a')]&&!_['isNil'](this[_0x0308('0x10')][util['format'](_0x0308('0x6b'),_0x2b55fa[_0x0308('0x29')])])&&!_['isNil'](this['trunks'][util[_0x0308('0x6c')]('SIP/%s',_0x2b55fa[_0x0308('0x29')])]['status'])&&(this[_0x0308('0x10')][util[_0x0308('0x6c')](_0x0308('0x6b'),_0x2b55fa[_0x0308('0x29')])][_0x0308('0x31')]===_0x0308('0x6d')||this['trunks'][util[_0x0308('0x6c')](_0x0308('0x6b'),_0x2b55fa[_0x0308('0x29')])][_0x0308('0x31')]===_0x0308('0x6e'));};Fax[_0x0308('0x2b')][_0x0308('0x5b')]=function(_0x50da1a,_0x285f49){if(!this[_0x0308('0x68')](_0x50da1a)){ut['logger'](_0x0308('0x6f'),_[_0x0308('0x69')](_0x50da1a)?'':_0x50da1a[_0x0308('0x29')]+_0x0308('0x70'));return{'isValid':![],'message':_0x0308('0x71')};}if(_[_0x0308('0x69')](_0x285f49['fax'])){ut[_0x0308('0x48')](_0x0308('0x72'),JSON[_0x0308('0x41')](_0x285f49));return{'isValid':![],'message':_0x0308('0x73')};}if(_[_0x0308('0x69')](_0x285f49[_0x0308('0x4')])){ut[_0x0308('0x48')](_0x0308('0x74'),JSON['stringify'](_0x285f49));return{'isValid':![],'message':_0x0308('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x0308('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 6742bb1..9cb4b7d 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 _0x9435=['lodash','../rpc/faxAccount','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x9435,0x130));var _0x5943=function(_0x40ad1b,_0x375280){_0x40ad1b=_0x40ad1b-0x0;var _0x2997c0=_0x9435[_0x40ad1b];return _0x2997c0;};'use strict';var util=require(_0x5943('0x0'));var BPromise=require(_0x5943('0x1'));var logger=require(_0x5943('0x2'))(_0x5943('0x3'));var _=require(_0x5943('0x4'));var faxAccount=require(_0x5943('0x5'));function loggerCatch(_0x22b2fb){return function(_0x35d858){logger['error'](_0x22b2fb,util[_0x5943('0x6')](_0x35d858,{'showHidden':![],'depth':null}));};}exports[_0x5943('0x7')]=function(_0x591bd3,_0x40e1a0){return BPromise[_0x5943('0x8')]()['then'](faxAccount['notify'](_0x591bd3,_0x40e1a0))[_0x5943('0x9')](loggerCatch(_0x5943('0xa')));}; \ No newline at end of file +var _0x224d=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','resolve','then','catch'];(function(_0xb6eb8a,_0x38cc80){var _0x247fd9=function(_0xd2d6d9){while(--_0xd2d6d9){_0xb6eb8a['push'](_0xb6eb8a['shift']());}};_0x247fd9(++_0x38cc80);}(_0x224d,0x6d));var _0xd224=function(_0x542a5d,_0x27e6c8){_0x542a5d=_0x542a5d-0x0;var _0x251378=_0x224d[_0x542a5d];return _0x251378;};'use strict';var util=require(_0xd224('0x0'));var BPromise=require(_0xd224('0x1'));var logger=require(_0xd224('0x2'))(_0xd224('0x3'));var _=require(_0xd224('0x4'));var faxAccount=require(_0xd224('0x5'));function loggerCatch(_0x3475db){return function(_0x5d8987){logger['error'](_0x3475db,util[_0xd224('0x6')](_0x5d8987,{'showHidden':![],'depth':null}));};}exports[_0xd224('0x7')]=function(_0x4d3700,_0x38e71e){return BPromise[_0xd224('0x8')]()[_0xd224('0x9')](faxAccount['notify'](_0x4d3700,_0x38e71e))[_0xd224('0xa')](loggerCatch(_0xd224('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5682892..89558f6 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 _0x46c6=['Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','execute','info'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x46c6,0x17a));var _0x646c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x46c6[_0x36884e];return _0x1cc367;};'use strict';var util=require(_0x646c('0x0'));var logger=require(_0x646c('0x1'))(_0x646c('0x2'));var BPromise=require(_0x646c('0x3'));var exec=require('child_process')['exec'];exports[_0x646c('0x4')]=function(_0x1c8178){return new BPromise(function(_0xcefe93,_0x2c03fc){exec(_0x1c8178,function(_0x14cd28,_0x1e595a,_0x3e1fa0){logger[_0x646c('0x5')](_0x646c('0x6'),_0x1e595a);if(_0x14cd28){logger[_0x646c('0x5')](_0x646c('0x6'),_0x646c('0x7'),util['inspect'](_0x14cd28,{'showHidden':![],'depth':null}),_0x1e595a,_0x3e1fa0);_0x2c03fc(_0x14cd28);}_0xcefe93(_0x1e595a);});});}; \ No newline at end of file +var _0x7b2c=['fax','child_process','exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7b2c,0xbb));var _0xc7b2=function(_0x58be64,_0x12c943){_0x58be64=_0x58be64-0x0;var _0x166728=_0x7b2c[_0x58be64];return _0x166728;};'use strict';var util=require(_0xc7b2('0x0'));var logger=require(_0xc7b2('0x1'))(_0xc7b2('0x2'));var BPromise=require('bluebird');var exec=require(_0xc7b2('0x3'))[_0xc7b2('0x4')];exports[_0xc7b2('0x5')]=function(_0x4823fe){return new BPromise(function(_0x427254,_0x5cd98d){exec(_0x4823fe,function(_0xd4247c,_0x1c5ae9,_0x465a0e){logger[_0xc7b2('0x6')](_0xc7b2('0x7'),_0x1c5ae9);if(_0xd4247c){logger[_0xc7b2('0x6')](_0xc7b2('0x7'),'\x20Error\x20:',util[_0xc7b2('0x8')](_0xd4247c,{'showHidden':![],'depth':null}),_0x1c5ae9,_0x465a0e);_0x5cd98d(_0xd4247c);}_0x427254(_0x1c5ae9);});});}; \ 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 9d6fa38..4b62db3 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 _0x9e15=['util','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','gateway','faxdetect','path','variablesAction','originate','xcally-motion-fax','from-sip','headerinfo','uniqueid'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x9e15,0xc6));var _0x59e1=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9e15[_0x82129b];return _0x2ae5dc;};'use strict';var util=require(_0x59e1('0x0'));var _=require(_0x59e1('0x1'));var moment=require(_0x59e1('0x2'));var logger=require(_0x59e1('0x3'))(_0x59e1('0x4'));exports[_0x59e1('0x5')]=function(_0x25108b){return{'message':_0x25108b};};exports['logger']=function(_0x46bed5,_0x44b845){logger[_0x59e1('0x6')](_0x46bed5,util[_0x59e1('0x7')](_0x44b845,{'showHidden':![],'depth':null}));};exports[_0x59e1('0x8')]=function(_0x3f39ae,_0x1899c1){var _0x34a346={'XMF-ECM':_0x1899c1[_0x59e1('0x9')],'XMF-HEADERINFO':_0x1899c1['headerinfo'],'XMF-MINRATE':_0x1899c1['minrate'],'XMF-MAXRATE':_0x1899c1[_0x59e1('0xa')],'XMF-MODEM':util[_0x59e1('0xb')](_0x59e1('0xc'),_0x1899c1['modem']),'XMF-GATEWAY':_0x1899c1[_0x59e1('0xd')],'XMF-FAXDETECT':_0x1899c1[_0x59e1('0xe')],'XMF-T38TIMEOUT':_0x1899c1['t38timeout'],'XMF-LOCALSTATIONID':_0x1899c1['localstationid'],'XMF-PATH':_0x3f39ae[_0x59e1('0xf')]};return _0x34a346;};exports[_0x59e1('0x10')]=function(_0x472a19,_0x2350b2){return{'actionid':_0x472a19['uniqueid'],'action':_0x59e1('0x11'),'channel':_0x472a19['channel'],'Exten':_0x59e1('0x12'),'Context':_0x59e1('0x13'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x472a19[_0x59e1('0x14')]?_0x472a19[_0x59e1('0x14')]:'',_0x472a19['localstationid']),'variable':_0x2350b2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x472a19[_0x59e1('0x15')]};}; \ No newline at end of file +var _0x07c0=['format','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','\x22%s\x22\x20<%s>','headerinfo','lodash','../../../../config/logger','logger','info','inspect','ecm','minrate','maxrate'];(function(_0x241237,_0xaaabec){var _0x1bc339=function(_0x2336df){while(--_0x2336df){_0x241237['push'](_0x241237['shift']());}};_0x1bc339(++_0xaaabec);}(_0x07c0,0x1ec));var _0x007c=function(_0x51cabf,_0x2828db){_0x51cabf=_0x51cabf-0x0;var _0x517538=_0x07c0[_0x51cabf];return _0x517538;};'use strict';var util=require('util');var _=require(_0x007c('0x0'));var moment=require('moment');var logger=require(_0x007c('0x1'))('fax');exports['message']=function(_0x20b72b){return{'message':_0x20b72b};};exports[_0x007c('0x2')]=function(_0x259b19,_0x5c2773){logger[_0x007c('0x3')](_0x259b19,util[_0x007c('0x4')](_0x5c2773,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1a7a64,_0xc3778){var _0x1015f4={'XMF-ECM':_0xc3778[_0x007c('0x5')],'XMF-HEADERINFO':_0xc3778['headerinfo'],'XMF-MINRATE':_0xc3778[_0x007c('0x6')],'XMF-MAXRATE':_0xc3778[_0x007c('0x7')],'XMF-MODEM':util[_0x007c('0x8')]('\x22%s\x22',_0xc3778[_0x007c('0x9')]),'XMF-GATEWAY':_0xc3778[_0x007c('0xa')],'XMF-FAXDETECT':_0xc3778[_0x007c('0xb')],'XMF-T38TIMEOUT':_0xc3778[_0x007c('0xc')],'XMF-LOCALSTATIONID':_0xc3778[_0x007c('0xd')],'XMF-PATH':_0x1a7a64[_0x007c('0xe')]};return _0x1015f4;};exports['variablesAction']=function(_0x213fcf,_0x53a570){return{'actionid':_0x213fcf[_0x007c('0xf')],'action':_0x007c('0x10'),'channel':_0x213fcf[_0x007c('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x007c('0x8')](_0x007c('0x12'),_0x213fcf[_0x007c('0x13')]?_0x213fcf[_0x007c('0x13')]:'',_0x213fcf[_0x007c('0xd')]),'variable':_0x53a570,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x213fcf[_0x007c('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index caae541..812f3f8 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 _0xc7c3=['./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x51191b,_0x2d2a78){var _0x260047=function(_0x4c39e9){while(--_0x4c39e9){_0x51191b['push'](_0x51191b['shift']());}};_0x260047(++_0x2d2a78);}(_0xc7c3,0x178));var _0x3c7c=function(_0x5b35a5,_0x393761){_0x5b35a5=_0x5b35a5-0x0;var _0x468b1e=_0xc7c3[_0x5b35a5];return _0x468b1e;};'use strict';var util=require(_0x3c7c('0x0'));var moment=require(_0x3c7c('0x1'));var server=require(_0x3c7c('0x2'));var Realtime=require(_0x3c7c('0x3'));var Report=require(_0x3c7c('0x4'));var Acw=require(_0x3c7c('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x3c7c('0x6'));var Preview=require(_0x3c7c('0x7'));var Fax=require(_0x3c7c('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x3c7c('0x9'));var voiceCallReport=require(_0x3c7c('0xa'));var trunk=require(_0x3c7c('0xb'));var trigger=require(_0x3c7c('0xc'));var template=require(_0x3c7c('0xd'));var cmHopperHistory=require(_0x3c7c('0xe'));var campaign=require(_0x3c7c('0xf'));var voiceExtension=require(_0x3c7c('0x10'));var faxAccount=require(_0x3c7c('0x11'));var zendesk=require(_0x3c7c('0x12'));var salesforce=require(_0x3c7c('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3c7c('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x3c7c('0x15'));var vtiger=require(_0x3c7c('0x16'));var freshsales=require(_0x3c7c('0x17'));var servicenow=require(_0x3c7c('0x18'));var dynamics365=require(_0x3c7c('0x19'));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(_0x3c7c('0x1a'))(_0x3c7c('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3c7c('0x1c')](_0x3c7c('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x3c7c('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3c7c('0x1e')]()[_0x3c7c('0x1f')](user[_0x3c7c('0x20')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x21')]())[_0x3c7c('0x1f')](user['getTelephones']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x22')]())[_0x3c7c('0x1f')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x3c7c('0x1f')](voiceQueue[_0x3c7c('0x23')]())[_0x3c7c('0x1f')](realtime['initVoiceQueues']())[_0x3c7c('0x1f')](trigger[_0x3c7c('0x24')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x25')]())[_0x3c7c('0x1f')](template[_0x3c7c('0x26')]())[_0x3c7c('0x1f')](realtime['initTemplates']())[_0x3c7c('0x1f')](zendesk[_0x3c7c('0x27')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x28')]())['then'](salesforce[_0x3c7c('0x29')]())[_0x3c7c('0x1f')](realtime['initSalesforceAccounts']())[_0x3c7c('0x1f')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0x3c7c('0x2a')]())[_0x3c7c('0x1f')](freshdesk['getFreshdeskAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2b')]())[_0x3c7c('0x1f')](desk['getDeskAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2c')]())['then'](zoho['getZohoAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2d')]())['then'](vtiger[_0x3c7c('0x2e')]())[_0x3c7c('0x1f')](realtime['initVtigerAccounts']())['then'](freshsales[_0x3c7c('0x2f')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x3c7c('0x30')]())['then'](realtime[_0x3c7c('0x31')]())['then'](dynamics365['getDynamics365Accounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x32')]())[_0x3c7c('0x1f')](campaign[_0x3c7c('0x33')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x34')]())[_0x3c7c('0x1f')](voiceExtension[_0x3c7c('0x35')]())[_0x3c7c('0x1f')](realtime['initVoiceExtensions']())[_0x3c7c('0x1f')](faxAccount[_0x3c7c('0x36')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x37')]())[_0x3c7c('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x3c7c('0x1e')]()[_0x3c7c('0x1f')](voiceQueueReport[_0x3c7c('0x38')]())[_0x3c7c('0x1f')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x3c7c('0x39')]())['then'](cmHopperHistory[_0x3c7c('0x3a')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x3b')]())[_0x3c7c('0x1f')](voiceCallReport[_0x3c7c('0x3c')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x3d')]())[_0x3c7c('0x3e')](function(_0xcf3237){logger[_0x3c7c('0x3f')]('[index.js][initParams]',util[_0x3c7c('0x40')](_0xcf3237,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3c7c('0x41')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x3c7c('0x1f')](function(){return initParams();})[_0x3c7c('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x4acba3){logger[_0x3c7c('0x3f')]('[index.js][main]',util['inspect'](_0x4acba3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x200d=['ami','hour','get','resolve','then','initAgents','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','inspect','listen','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x5c9317,_0x38bba4){var _0x50ccb4=function(_0x467423){while(--_0x467423){_0x5c9317['push'](_0x5c9317['shift']());}};_0x50ccb4(++_0x38bba4);}(_0x200d,0x64));var _0xd200=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x200d[_0x4382bc];return _0x13c82a;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0xd200('0x0'));var Realtime=require('./realtime');var Report=require(_0xd200('0x1'));var Acw=require(_0xd200('0x2'));var Trigger=require(_0xd200('0x3'));var Dialer=require(_0xd200('0x4'));var Preview=require('./preview');var Fax=require(_0xd200('0x5'));var user=require(_0xd200('0x6'));var voiceQueue=require(_0xd200('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xd200('0x8'));var trunk=require(_0xd200('0x9'));var trigger=require('./rpc/trigger');var template=require(_0xd200('0xa'));var cmHopperHistory=require(_0xd200('0xb'));var campaign=require(_0xd200('0xc'));var voiceExtension=require(_0xd200('0xd'));var faxAccount=require(_0xd200('0xe'));var zendesk=require(_0xd200('0xf'));var salesforce=require(_0xd200('0x10'));var sugarcrm=require(_0xd200('0x11'));var freshdesk=require(_0xd200('0x12'));var desk=require(_0xd200('0x13'));var zoho=require(_0xd200('0x14'));var vtiger=require(_0xd200('0x15'));var freshsales=require(_0xd200('0x16'));var servicenow=require(_0xd200('0x17'));var dynamics365=require(_0xd200('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd200('0x19'))(_0xd200('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xd200('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd200('0x1c')](_0xd200('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd200('0x1d')]()[_0xd200('0x1e')](user['getAgents']())[_0xd200('0x1e')](realtime[_0xd200('0x1f')]())[_0xd200('0x1e')](user['getTelephones']())[_0xd200('0x1e')](realtime[_0xd200('0x20')]())['then'](trunk[_0xd200('0x21')]())['then'](realtime[_0xd200('0x22')]())['then'](voiceQueue['getVoiceQueues']())[_0xd200('0x1e')](realtime['initVoiceQueues']())[_0xd200('0x1e')](trigger[_0xd200('0x23')]())[_0xd200('0x1e')](realtime[_0xd200('0x24')]())[_0xd200('0x1e')](template[_0xd200('0x25')]())[_0xd200('0x1e')](realtime[_0xd200('0x26')]())[_0xd200('0x1e')](zendesk['getZendeskAccounts']())[_0xd200('0x1e')](realtime[_0xd200('0x27')]())['then'](salesforce[_0xd200('0x28')]())[_0xd200('0x1e')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xd200('0x29')]())[_0xd200('0x1e')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xd200('0x2a')]())['then'](realtime[_0xd200('0x2b')]())[_0xd200('0x1e')](desk[_0xd200('0x2c')]())[_0xd200('0x1e')](realtime[_0xd200('0x2d')]())['then'](zoho['getZohoAccounts']())[_0xd200('0x1e')](realtime[_0xd200('0x2e')]())[_0xd200('0x1e')](vtiger['getVtigerAccounts']())[_0xd200('0x1e')](realtime[_0xd200('0x2f')]())[_0xd200('0x1e')](freshsales['getFreshsalesAccounts']())[_0xd200('0x1e')](realtime[_0xd200('0x30')]())['then'](servicenow['getServicenowAccounts']())[_0xd200('0x1e')](realtime[_0xd200('0x31')]())[_0xd200('0x1e')](dynamics365['getDynamics365Accounts']())[_0xd200('0x1e')](realtime[_0xd200('0x32')]())[_0xd200('0x1e')](campaign[_0xd200('0x33')]())['then'](realtime['initCampaigns']())[_0xd200('0x1e')](voiceExtension['getVoiceExtensions']())[_0xd200('0x1e')](realtime[_0xd200('0x34')]())[_0xd200('0x1e')](faxAccount[_0xd200('0x35')]())[_0xd200('0x1e')](realtime[_0xd200('0x36')]())[_0xd200('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0xd200('0x1d')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())[_0xd200('0x1e')](cmHopperHistory[_0xd200('0x37')]())[_0xd200('0x1e')](realtime[_0xd200('0x38')]())[_0xd200('0x1e')](cmHopperHistory[_0xd200('0x39')]())[_0xd200('0x1e')](realtime[_0xd200('0x3a')]())[_0xd200('0x1e')](voiceCallReport[_0xd200('0x3b')]())[_0xd200('0x1e')](realtime['initVoiceCallReports']())[_0xd200('0x3c')](function(_0xe3b8cf){logger['error']('[index.js][initParams]',util[_0xd200('0x3d')](_0xe3b8cf,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd200('0x3e')](realtime,preview,fax)[_0xd200('0x1e')](function(){return initRealtime();})[_0xd200('0x1e')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xd200('0x3c')](function(_0x355621){logger['error']('[index.js][main]',util[_0xd200('0x3d')](_0x355621,{'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 d79d209..a58f022 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 _0x9de3=['onhold','format','user:%s','user:ami:update','emit','user:presence','lodash','moment','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause'];(function(_0x564a65,_0x25cc30){var _0x48e722=function(_0x146511){while(--_0x146511){_0x564a65['push'](_0x564a65['shift']());}};_0x48e722(++_0x25cc30);}(_0x9de3,0xea));var _0x39de=function(_0x509d66,_0x2eb933){_0x509d66=_0x509d66-0x0;var _0x5011c8=_0x9de3[_0x509d66];return _0x5011c8;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var moment=require(_0x39de('0x1'));var Redis=require(_0x39de('0x2'));var config=require(_0x39de('0x3'));config['redis']=_[_0x39de('0x4')](config['redis'],{'host':_0x39de('0x5'),'port':0x18eb});var io=require(_0x39de('0x6'))(new Redis(config[_0x39de('0x7')]));function Agent(_0x1d59d6){this['id']=_0x1d59d6['id']||0x0;this['name']=_0x1d59d6[_0x39de('0x8')]||'';this[_0x39de('0x9')]=_0x1d59d6[_0x39de('0x9')]||'';this[_0x39de('0xa')]=_0x1d59d6[_0x39de('0xa')]||'';this['fullname']=_0x1d59d6['fullname']||'';this['state']=_0x39de('0xb');this[_0x39de('0xc')]=0x0;this[_0x39de('0xd')]=_0x39de('0xb');this[_0x39de('0xe')]='';this[_0x39de('0xf')]='';this[_0x39de('0x10')]='';this[_0x39de('0x11')]='';this['online']=_0x1d59d6[_0x39de('0x12')]||![];this['voiceStatus']='unknown';this[_0x39de('0x13')]=0x0;this[_0x39de('0x14')]='';this[_0x39de('0x15')]='';this['onhold']=![];this[_0x39de('0x16')]=![];}Agent[_0x39de('0x17')][_0x39de('0x18')]=function(_0x905132){if(!_0x905132[_0x39de('0x19')]){return;}var _0x3ebd39=null;var _0x229ecc=_0x905132[_0x39de('0x19')][_0x39de('0x1a')]();switch(_0x229ecc){case _0x39de('0x1b'):_0x229ecc='idle';break;case _0x39de('0x1c'):_0x229ecc=_0x39de('0x1d');break;}if(this[_0x39de('0x1e')]!==_0x229ecc||_0x905132[_0x39de('0x1f')]){_0x3ebd39=_['toNumber'](moment()['format']('x'));}var _0x2d355b={'id':this['id'],'name':this['name'],'email':this[_0x39de('0x9')],'accountcode':this[_0x39de('0xa')],'fullname':this['fullname'],'state':this[_0x39de('0x19')],'stateTime':this['stateTime'],'status':this[_0x39de('0xd')],'address':this[_0x39de('0xe')],'voiceStatus':_0x229ecc||this['voiceStatus'],'voiceStatusTime':_0x3ebd39||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x39de('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x39de('0x20')]};if(this[_0x39de('0x1e')]!==_0x229ecc){this[_0x39de('0x1e')]=_0x229ecc;io['to'](util[_0x39de('0x21')](_0x39de('0x22'),_0x2d355b[_0x39de('0x8')]))['emit'](_0x39de('0x23'),_0x2d355b);io[_0x39de('0x24')](_0x39de('0x25'),_0x2d355b);}};module['exports']=Agent; \ No newline at end of file +var _0x7ee1=['unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','prototype','toLowerCase','not_inuse','idle','talking','statePause','toNumber','format','voiceStatusCallerIdNumber','user:%s','emit','user:ami:update','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','stateTime','status'];(function(_0x4d207a,_0x3d4b39){var _0x3ff007=function(_0x1e52f1){while(--_0x1e52f1){_0x4d207a['push'](_0x4d207a['shift']());}};_0x3ff007(++_0x3d4b39);}(_0x7ee1,0xab));var _0x17ee=function(_0x3b902f,_0x2f65df){_0x3b902f=_0x3b902f-0x0;var _0x55af07=_0x7ee1[_0x3b902f];return _0x55af07;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require(_0x17ee('0x1'));var Redis=require(_0x17ee('0x2'));var config=require(_0x17ee('0x3'));config[_0x17ee('0x4')]=_[_0x17ee('0x5')](config['redis'],{'host':_0x17ee('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x126d34){this['id']=_0x126d34['id']||0x0;this[_0x17ee('0x7')]=_0x126d34[_0x17ee('0x7')]||'';this[_0x17ee('0x8')]=_0x126d34[_0x17ee('0x8')]||'';this['accountcode']=_0x126d34[_0x17ee('0x9')]||'';this['fullname']=_0x126d34[_0x17ee('0xa')]||'';this[_0x17ee('0xb')]='unknown';this[_0x17ee('0xc')]=0x0;this[_0x17ee('0xd')]=_0x17ee('0xe');this[_0x17ee('0xf')]='';this[_0x17ee('0x10')]='';this[_0x17ee('0x11')]='';this[_0x17ee('0x12')]='';this[_0x17ee('0x13')]=_0x126d34[_0x17ee('0x13')]||![];this[_0x17ee('0x14')]=_0x17ee('0xe');this[_0x17ee('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x17ee('0x16')]='';this[_0x17ee('0x17')]=![];this['local']=![];}Agent[_0x17ee('0x18')]['updateStatusRealtime']=function(_0x2f452e){if(!_0x2f452e[_0x17ee('0xb')]){return;}var _0x16a1b5=null;var _0x206f85=_0x2f452e['state'][_0x17ee('0x19')]();switch(_0x206f85){case _0x17ee('0x1a'):_0x206f85=_0x17ee('0x1b');break;case'inuse':_0x206f85=_0x17ee('0x1c');break;}if(this[_0x17ee('0x14')]!==_0x206f85||_0x2f452e[_0x17ee('0x1d')]){_0x16a1b5=_[_0x17ee('0x1e')](moment()[_0x17ee('0x1f')]('x'));}var _0x3785ed={'id':this['id'],'name':this[_0x17ee('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x17ee('0xa')],'state':this[_0x17ee('0xb')],'stateTime':this[_0x17ee('0xc')],'status':this[_0x17ee('0xd')],'address':this['address'],'voiceStatus':_0x206f85||this[_0x17ee('0x14')],'voiceStatusTime':_0x16a1b5||this[_0x17ee('0x15')],'voiceStatusCallerIdNumber':this[_0x17ee('0x20')],'voiceStatusQueue':this[_0x17ee('0x16')],'interface':this['interface'],'onhold':this[_0x17ee('0x17')]};if(this[_0x17ee('0x14')]!==_0x206f85){this[_0x17ee('0x14')]=_0x206f85;io['to'](util['format'](_0x17ee('0x21'),_0x3785ed[_0x17ee('0x7')]))[_0x17ee('0x22')](_0x17ee('0x23'),_0x3785ed);io[_0x17ee('0x22')]('user:presence',_0x3785ed);}};module[_0x17ee('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 50a2605..818648c 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 _0x9ade=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9ade,0x8e));var _0xe9ad=function(_0x1a87a8,_0x127bc9){_0x1a87a8=_0x1a87a8-0x0;var _0x51b8b7=_0x9ade[_0x1a87a8];return _0x51b8b7;};'use strict';function Campaign(_0x121db6){this['id']=_0x121db6['id']||0x0;this[_0xe9ad('0x0')]=_0x121db6[_0xe9ad('0x0')]||'';this[_0xe9ad('0x1')]=_0x121db6[_0xe9ad('0x1')]||_0xe9ad('0x2');this[_0xe9ad('0x3')]=0x0;this[_0xe9ad('0x4')]=0x0;this[_0xe9ad('0x5')]=0x0;this[_0xe9ad('0x6')]=0x0;this['message']='';this[_0xe9ad('0x7')]=!![];this['active']=_0x121db6['active'];this[_0xe9ad('0x8')]=_0x121db6[_0xe9ad('0x8')];this[_0xe9ad('0x9')]=_0x121db6[_0xe9ad('0x9')]||null;this[_0xe9ad('0xa')]=_0x121db6[_0xe9ad('0xa')]?_0x121db6[_0xe9ad('0xa')]:null;this[_0xe9ad('0xb')]=_0x121db6[_0xe9ad('0xb')];this[_0xe9ad('0xc')]=_0x121db6[_0xe9ad('0xc')];this['dialOriginateTimeout']=_0x121db6[_0xe9ad('0xd')]||0x1e;this[_0xe9ad('0xe')]=_0x121db6['dialCongestionMaxRetry'];this[_0xe9ad('0xf')]=_0x121db6[_0xe9ad('0xf')];this[_0xe9ad('0x10')]=_0x121db6['dialBusyMaxRetry'];this[_0xe9ad('0x11')]=_0x121db6['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x121db6[_0xe9ad('0x12')];this[_0xe9ad('0x13')]=_0x121db6[_0xe9ad('0x13')];this[_0xe9ad('0x14')]=_0x121db6[_0xe9ad('0x14')];this[_0xe9ad('0x15')]=_0x121db6[_0xe9ad('0x15')]||0x3;this[_0xe9ad('0x16')]=_0x121db6['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe9ad('0x17')]=_0x121db6[_0xe9ad('0x17')]||0x3;this[_0xe9ad('0x18')]=_0x121db6[_0xe9ad('0x18')]||0x96;this[_0xe9ad('0x19')]=_0x121db6[_0xe9ad('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x121db6[_0xe9ad('0x1a')]||0x96;this[_0xe9ad('0x1b')]=_0x121db6[_0xe9ad('0x1b')]||0x3;this[_0xe9ad('0x1c')]=_0x121db6[_0xe9ad('0x1c')]||0x96;this[_0xe9ad('0x1d')]=_0x121db6[_0xe9ad('0x1d')]||0x3;this[_0xe9ad('0x1e')]=_0x121db6[_0xe9ad('0x1e')]||0x96;this[_0xe9ad('0x1f')]=_0x121db6[_0xe9ad('0x1f')]||'DESC';this[_0xe9ad('0x20')]=_0x121db6['dialPrefix']||undefined;this[_0xe9ad('0x21')]=_0x121db6['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xe9ad('0x22')]=_0x121db6['dialCutDigit']||undefined;this[_0xe9ad('0x23')]=_0x121db6[_0xe9ad('0x23')]?_0x121db6[_0xe9ad('0x23')]:undefined;this['Trunk']=_0x121db6['Trunk']?_0x121db6[_0xe9ad('0x24')]:undefined;this[_0xe9ad('0x25')]=_0x121db6['Interval']?_0x121db6[_0xe9ad('0x25')]:undefined;this[_0xe9ad('0x26')]=_0x121db6[_0xe9ad('0x26')]?_0x121db6['SquareProject']:undefined;this[_0xe9ad('0x27')]=_0x121db6[_0xe9ad('0x26')]?_0x121db6[_0xe9ad('0x26')][_0xe9ad('0x0')]:undefined;this[_0xe9ad('0x28')]=_0x121db6['dialAMDActive']||![];this[_0xe9ad('0x29')]=_0x121db6[_0xe9ad('0x29')];this[_0xe9ad('0x2a')]=_0x121db6[_0xe9ad('0x2a')];this[_0xe9ad('0x2b')]=_0x121db6[_0xe9ad('0x2b')];this['dialAMDTotalAnalysisTime']=_0x121db6['dialAMDTotalAnalysisTime'];this[_0xe9ad('0x2c')]=_0x121db6['dialAMDMinWordLength'];this[_0xe9ad('0x2d')]=_0x121db6[_0xe9ad('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x121db6[_0xe9ad('0x2e')];this[_0xe9ad('0x2f')]=_0x121db6[_0xe9ad('0x2f')];this[_0xe9ad('0x30')]=_0x121db6[_0xe9ad('0x30')];}module[_0xe9ad('0x31')]=Campaign; \ No newline at end of file +var _0x9529=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x19925b,_0x5727f0){var _0x1acd8a=function(_0xbb4619){while(--_0xbb4619){_0x19925b['push'](_0x19925b['shift']());}};_0x1acd8a(++_0x5727f0);}(_0x9529,0x1a7));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';function Campaign(_0x48037e){this['id']=_0x48037e['id']||0x0;this[_0x9952('0x0')]=_0x48037e[_0x9952('0x0')]||'';this['type']=_0x48037e[_0x9952('0x1')]||_0x9952('0x2');this['originated']=0x0;this[_0x9952('0x3')]=0x0;this[_0x9952('0x4')]=0x0;this[_0x9952('0x5')]=0x0;this[_0x9952('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x9952('0x7')]=_0x48037e[_0x9952('0x7')];this[_0x9952('0x8')]=_0x48037e['limitCalls'];this[_0x9952('0x9')]=_0x48037e[_0x9952('0x9')]||null;this[_0x9952('0xa')]=_0x48037e[_0x9952('0xa')]?_0x48037e[_0x9952('0xa')]:null;this['dialOriginateCallerIdName']=_0x48037e[_0x9952('0xb')];this[_0x9952('0xc')]=_0x48037e[_0x9952('0xc')];this[_0x9952('0xd')]=_0x48037e[_0x9952('0xd')]||0x1e;this[_0x9952('0xe')]=_0x48037e[_0x9952('0xe')];this[_0x9952('0xf')]=_0x48037e[_0x9952('0xf')];this[_0x9952('0x10')]=_0x48037e[_0x9952('0x10')];this[_0x9952('0x11')]=_0x48037e['dialBusyRetryFrequency'];this[_0x9952('0x12')]=_0x48037e[_0x9952('0x12')];this[_0x9952('0x13')]=_0x48037e[_0x9952('0x13')];this[_0x9952('0x14')]=_0x48037e[_0x9952('0x14')];this[_0x9952('0x15')]=_0x48037e[_0x9952('0x15')]||0x3;this[_0x9952('0x16')]=_0x48037e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9952('0x17')]=_0x48037e[_0x9952('0x17')]||0x3;this[_0x9952('0x18')]=_0x48037e[_0x9952('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x48037e[_0x9952('0x19')]||0x3;this[_0x9952('0x1a')]=_0x48037e['dialAbandonedRetryFrequency']||0x96;this[_0x9952('0x1b')]=_0x48037e['dialMachineMaxRetry']||0x3;this[_0x9952('0x1c')]=_0x48037e[_0x9952('0x1c')]||0x96;this[_0x9952('0x1d')]=_0x48037e[_0x9952('0x1d')]||0x3;this[_0x9952('0x1e')]=_0x48037e['dialAgentRejectRetryFrequency']||0x96;this[_0x9952('0x1f')]=_0x48037e[_0x9952('0x1f')]||_0x9952('0x20');this[_0x9952('0x21')]=_0x48037e[_0x9952('0x21')]||undefined;this[_0x9952('0x22')]=_0x48037e[_0x9952('0x22')]||undefined;this['dialCutDigit']=_0x48037e['dialCutDigit']||undefined;this[_0x9952('0x23')]=_0x48037e[_0x9952('0x23')]?_0x48037e[_0x9952('0x23')]:undefined;this[_0x9952('0x24')]=_0x48037e[_0x9952('0x24')]?_0x48037e[_0x9952('0x24')]:undefined;this['Interval']=_0x48037e[_0x9952('0x25')]?_0x48037e[_0x9952('0x25')]:undefined;this[_0x9952('0x26')]=_0x48037e[_0x9952('0x26')]?_0x48037e[_0x9952('0x26')]:undefined;this[_0x9952('0x27')]=_0x48037e[_0x9952('0x26')]?_0x48037e[_0x9952('0x26')][_0x9952('0x0')]:undefined;this[_0x9952('0x28')]=_0x48037e['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x48037e['dialAMDInitialSilence'];this[_0x9952('0x29')]=_0x48037e['dialAMDGreeting'];this[_0x9952('0x2a')]=_0x48037e['dialAMDAfterGreetingSilence'];this[_0x9952('0x2b')]=_0x48037e[_0x9952('0x2b')];this['dialAMDMinWordLength']=_0x48037e[_0x9952('0x2c')];this[_0x9952('0x2d')]=_0x48037e[_0x9952('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x48037e[_0x9952('0x2e')];this[_0x9952('0x2f')]=_0x48037e[_0x9952('0x2f')];this[_0x9952('0x30')]=_0x48037e[_0x9952('0x30')];}module[_0x9952('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5045f78..c04c952 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 _0xb01c=['accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb01c,0xbe));var _0xcb01=function(_0x3144e4,_0x107c42){_0x3144e4=_0x3144e4-0x0;var _0x39b7ff=_0xb01c[_0x3144e4];return _0x39b7ff;};'use strict';function Channel(){this[_0xcb01('0x0')]=null;this['channel']='';this[_0xcb01('0x1')]='';this[_0xcb01('0x2')]=0x0;this[_0xcb01('0x3')]='';this[_0xcb01('0x4')]=undefined;this[_0xcb01('0x5')]=undefined;this[_0xcb01('0x6')]=0x0;this[_0xcb01('0x7')]='';this['uniqueid']=0x0;this[_0xcb01('0x8')]=0x0;this[_0xcb01('0x9')]=0x0;this[_0xcb01('0xa')]=![];this[_0xcb01('0xb')]=null;this[_0xcb01('0xc')]=null;this[_0xcb01('0xd')]=![];this[_0xcb01('0xe')]=![];this['lastapplication']='';this[_0xcb01('0xf')]='';this[_0xcb01('0x10')]=0x0;this[_0xcb01('0x11')]=0x0;this[_0xcb01('0x12')]=0x0;this['type']=null;this[_0xcb01('0x13')]=null;this[_0xcb01('0x14')]=null;this[_0xcb01('0x15')]=![];this['monitorFilename']=null;this[_0xcb01('0x16')]=null;this[_0xcb01('0x17')]=[];this[_0xcb01('0x18')]=undefined;this[_0xcb01('0x19')]=undefined;this[_0xcb01('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xcb01('0x1b')]=Channel; \ No newline at end of file +var _0xeb3f=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb3f[_0x432682];return _0x463d05;};'use strict';function Channel(){this[_0xfeb3('0x0')]=null;this[_0xfeb3('0x1')]='';this[_0xfeb3('0x2')]='';this[_0xfeb3('0x3')]=0x0;this[_0xfeb3('0x4')]='';this[_0xfeb3('0x5')]=undefined;this[_0xfeb3('0x6')]=undefined;this[_0xfeb3('0x7')]=0x0;this[_0xfeb3('0x8')]='';this[_0xfeb3('0x9')]=0x0;this[_0xfeb3('0xa')]=0x0;this[_0xfeb3('0xb')]=0x0;this[_0xfeb3('0xc')]=![];this[_0xfeb3('0xd')]=null;this[_0xfeb3('0xe')]=null;this['unmanaged']=![];this[_0xfeb3('0xf')]=![];this[_0xfeb3('0x10')]='';this[_0xfeb3('0x11')]='';this[_0xfeb3('0x12')]=0x0;this[_0xfeb3('0x13')]=0x0;this[_0xfeb3('0x14')]=0x0;this[_0xfeb3('0x15')]=null;this[_0xfeb3('0x16')]=null;this[_0xfeb3('0x17')]=null;this['monitor']=![];this[_0xfeb3('0x18')]=null;this[_0xfeb3('0x19')]=null;this[_0xfeb3('0x1a')]=[];this[_0xfeb3('0x1b')]=undefined;this[_0xfeb3('0x1c')]=undefined;this[_0xfeb3('0x1d')]=undefined;this[_0xfeb3('0x1e')]=0x0;}module[_0xfeb3('0x1f')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2406fe0..451025e 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 _0x9106=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9106,0x1cd));var _0x6910=function(_0x22fefb,_0x105065){_0x22fefb=_0x22fefb-0x0;var _0x49a5e0=_0x9106[_0x22fefb];return _0x49a5e0;};'use strict';function DeskAccount(_0x255aa8){this['id']=_0x255aa8['id']||0x0;this[_0x6910('0x0')]=_0x255aa8[_0x6910('0x0')]||'';this[_0x6910('0x1')]=_0x255aa8[_0x6910('0x1')]||'';this[_0x6910('0x2')]=_0x255aa8[_0x6910('0x2')]||'';this['authType']=_0x255aa8[_0x6910('0x3')]||'';this[_0x6910('0x4')]=_0x255aa8[_0x6910('0x4')]||'';this['consumerKey']=_0x255aa8[_0x6910('0x5')]||'';this['consumerSecret']=_0x255aa8[_0x6910('0x6')]||'';this[_0x6910('0x7')]=_0x255aa8[_0x6910('0x7')]||'';this['tokenSecret']=_0x255aa8[_0x6910('0x8')]||'';this[_0x6910('0x9')]=_0x255aa8[_0x6910('0x9')]||'';this[_0x6910('0xa')]=_0x255aa8[_0x6910('0xa')]||'';this[_0x6910('0xb')]=_0x255aa8[_0x6910('0xb')]||{};}module[_0x6910('0xc')]=DeskAccount; \ No newline at end of file +var _0x52cb=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','type','serverUrl','Configurations','exports'];(function(_0x5d8910,_0x3c93ae){var _0x285190=function(_0x22f28f){while(--_0x22f28f){_0x5d8910['push'](_0x5d8910['shift']());}};_0x285190(++_0x3c93ae);}(_0x52cb,0x90));var _0xb52c=function(_0x3e74f4,_0x3e9c91){_0x3e74f4=_0x3e74f4-0x0;var _0x489758=_0x52cb[_0x3e74f4];return _0x489758;};'use strict';function DeskAccount(_0x5bfa1e){this['id']=_0x5bfa1e['id']||0x0;this[_0xb52c('0x0')]=_0x5bfa1e[_0xb52c('0x0')]||'';this['username']=_0x5bfa1e[_0xb52c('0x1')]||'';this[_0xb52c('0x2')]=_0x5bfa1e[_0xb52c('0x2')]||'';this[_0xb52c('0x3')]=_0x5bfa1e['authType']||'';this[_0xb52c('0x4')]=_0x5bfa1e[_0xb52c('0x4')]||'';this[_0xb52c('0x5')]=_0x5bfa1e[_0xb52c('0x5')]||'';this[_0xb52c('0x6')]=_0x5bfa1e['consumerSecret']||'';this['token']=_0x5bfa1e[_0xb52c('0x7')]||'';this['tokenSecret']=_0x5bfa1e['tokenSecret']||'';this[_0xb52c('0x8')]=_0x5bfa1e['type']||'';this[_0xb52c('0x9')]=_0x5bfa1e[_0xb52c('0x9')]||'';this[_0xb52c('0xa')]=_0x5bfa1e[_0xb52c('0xa')]||{};}module[_0xb52c('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 78c0f8f..94d1066 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 _0x3e90=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','password','remoteUri','clientId','clientSecret'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3e90,0x18b));var _0x03e9=function(_0x5071a8,_0x53ce34){_0x5071a8=_0x5071a8-0x0;var _0x54fc76=_0x3e90[_0x5071a8];return _0x54fc76;};'use strict';function Dynamics365Account(_0x48c1f3){this['id']=_0x48c1f3['id']||0x0;this[_0x03e9('0x0')]=_0x48c1f3['name']||'';this['username']=_0x48c1f3['username']||'';this[_0x03e9('0x1')]=_0x48c1f3[_0x03e9('0x1')]||'';this[_0x03e9('0x2')]=_0x48c1f3[_0x03e9('0x2')]||'';this['tenantId']=_0x48c1f3['tenantId']||'';this['clientId']=_0x48c1f3[_0x03e9('0x3')]||'';this[_0x03e9('0x4')]=_0x48c1f3[_0x03e9('0x4')]||{};this[_0x03e9('0x5')]=_0x48c1f3[_0x03e9('0x5')]||'';this[_0x03e9('0x6')]=_0x48c1f3['modernAuthentication']||![];this[_0x03e9('0x7')]=_0x48c1f3[_0x03e9('0x7')]||{};this['CloudProvider']=_0x48c1f3[_0x03e9('0x8')]||{};}module[_0x03e9('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xc0fe=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','CloudProvider','exports'];(function(_0x2c2032,_0x416574){var _0x25a977=function(_0x3db53d){while(--_0x3db53d){_0x2c2032['push'](_0x2c2032['shift']());}};_0x25a977(++_0x416574);}(_0xc0fe,0xf0));var _0xec0f=function(_0x1dacba,_0x3b81a9){_0x1dacba=_0x1dacba-0x0;var _0x5edf7b=_0xc0fe[_0x1dacba];return _0x5edf7b;};'use strict';function Dynamics365Account(_0x336adb){this['id']=_0x336adb['id']||0x0;this['name']=_0x336adb['name']||'';this[_0xec0f('0x0')]=_0x336adb[_0xec0f('0x0')]||'';this['password']=_0x336adb[_0xec0f('0x1')]||'';this[_0xec0f('0x2')]=_0x336adb[_0xec0f('0x2')]||'';this[_0xec0f('0x3')]=_0x336adb[_0xec0f('0x3')]||'';this[_0xec0f('0x4')]=_0x336adb[_0xec0f('0x4')]||'';this['clientSecret']=_0x336adb[_0xec0f('0x5')]||{};this['serverUrl']=_0x336adb[_0xec0f('0x6')]||'';this['modernAuthentication']=_0x336adb[_0xec0f('0x7')]||![];this['Configurations']=_0x336adb['Configurations']||{};this[_0xec0f('0x8')]=_0x336adb[_0xec0f('0x8')]||{};}module[_0xec0f('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4a66914..9adc716 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 _0x35f8=['name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','exports'];(function(_0x54db8f,_0x27ff93){var _0x49fa81=function(_0x48cf74){while(--_0x48cf74){_0x54db8f['push'](_0x54db8f['shift']());}};_0x49fa81(++_0x27ff93);}(_0x35f8,0x69));var _0x835f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x35f8[_0x432682];return _0x463d05;};'use strict';function FaxAccount(_0x22370d){this['id']=_0x22370d['id']||0x0;this[_0x835f('0x0')]=_0x22370d[_0x835f('0x0')]||'';this['description']=_0x22370d[_0x835f('0x1')];this[_0x835f('0x2')]=_0x22370d['ecm'];this['headerinfo']=_0x22370d['headerinfo'];this[_0x835f('0x3')]=_0x22370d[_0x835f('0x3')];this[_0x835f('0x4')]=_0x22370d['minrate']||0x960;this[_0x835f('0x5')]=_0x22370d[_0x835f('0x5')]||0x3840;this[_0x835f('0x6')]=_0x22370d[_0x835f('0x6')]||_0x835f('0x7');this[_0x835f('0x8')]=_0x22370d[_0x835f('0x8')]||'no';this[_0x835f('0x9')]=_0x22370d[_0x835f('0x9')]||'no';this[_0x835f('0xa')]=_0x22370d['t38timeout']||0x1388;this[_0x835f('0xb')]=_0x22370d[_0x835f('0xb')]||_0x835f('0xc');this[_0x835f('0xd')]=_0x22370d[_0x835f('0xd')]?_0x22370d[_0x835f('0xd')]:undefined;this['ListId']=_0x22370d['ListId'];this['key']=_0x22370d['key'];}module[_0x835f('0xe')]=FaxAccount; \ No newline at end of file +var _0x0d87=['key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId'];(function(_0x53381d,_0x41ab1a){var _0x5a1ace=function(_0x3432f4){while(--_0x3432f4){_0x53381d['push'](_0x53381d['shift']());}};_0x5a1ace(++_0x41ab1a);}(_0x0d87,0x12e));var _0x70d8=function(_0xae3adc,_0x53d7bc){_0xae3adc=_0xae3adc-0x0;var _0xc6e031=_0x0d87[_0xae3adc];return _0xc6e031;};'use strict';function FaxAccount(_0x16b8cb){this['id']=_0x16b8cb['id']||0x0;this[_0x70d8('0x0')]=_0x16b8cb[_0x70d8('0x0')]||'';this[_0x70d8('0x1')]=_0x16b8cb['description'];this[_0x70d8('0x2')]=_0x16b8cb[_0x70d8('0x2')];this[_0x70d8('0x3')]=_0x16b8cb['headerinfo'];this['localstationid']=_0x16b8cb['localstationid'];this[_0x70d8('0x4')]=_0x16b8cb[_0x70d8('0x4')]||0x960;this['maxrate']=_0x16b8cb[_0x70d8('0x5')]||0x3840;this[_0x70d8('0x6')]=_0x16b8cb[_0x70d8('0x6')]||'v17,v27,v29';this['gateway']=_0x16b8cb[_0x70d8('0x7')]||'no';this['faxdetect']=_0x16b8cb[_0x70d8('0x8')]||'no';this[_0x70d8('0x9')]=_0x16b8cb[_0x70d8('0x9')]||0x1388;this[_0x70d8('0xa')]=_0x16b8cb[_0x70d8('0xa')]||'SIP';this[_0x70d8('0xb')]=_0x16b8cb[_0x70d8('0xb')]?_0x16b8cb[_0x70d8('0xb')]:undefined;this[_0x70d8('0xc')]=_0x16b8cb[_0x70d8('0xc')];this[_0x70d8('0xd')]=_0x16b8cb[_0x70d8('0xd')];}module[_0x70d8('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 bbdb3d5..50fe088 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 _0x05e2=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x13ccfe,_0x53d873){var _0x34b1b3=function(_0x551527){while(--_0x551527){_0x13ccfe['push'](_0x13ccfe['shift']());}};_0x34b1b3(++_0x53d873);}(_0x05e2,0x169));var _0x205e=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x05e2[_0xfed299];return _0x4ef1f2;};'use strict';function FreshdeskAccount(_0x1ada7a){this['id']=_0x1ada7a['id']||0x0;this['name']=_0x1ada7a[_0x205e('0x0')]||'';this[_0x205e('0x1')]=_0x1ada7a[_0x205e('0x1')]||'';this[_0x205e('0x2')]=_0x1ada7a[_0x205e('0x3')]||'';this['remoteUri']=_0x1ada7a[_0x205e('0x4')]||'';this[_0x205e('0x5')]=_0x1ada7a[_0x205e('0x5')]||'';this[_0x205e('0x6')]=_0x1ada7a[_0x205e('0x6')]||{};}module[_0x205e('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x9153=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x9153,0x1d6));var _0x3915=function(_0x60a68c,_0x5ad819){_0x60a68c=_0x60a68c-0x0;var _0x253abe=_0x9153[_0x60a68c];return _0x253abe;};'use strict';function FreshdeskAccount(_0x18a7bc){this['id']=_0x18a7bc['id']||0x0;this[_0x3915('0x0')]=_0x18a7bc[_0x3915('0x0')]||'';this[_0x3915('0x1')]=_0x18a7bc[_0x3915('0x1')]||'';this['apiKey']=_0x18a7bc[_0x3915('0x2')]||'';this[_0x3915('0x3')]=_0x18a7bc[_0x3915('0x3')]||'';this[_0x3915('0x4')]=_0x18a7bc[_0x3915('0x4')]||'';this[_0x3915('0x5')]=_0x18a7bc[_0x3915('0x5')]||{};}module[_0x3915('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1ecabed..586c503 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 _0x4351=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x158b4f,_0x1cd927){var _0x175036=function(_0x4ea028){while(--_0x4ea028){_0x158b4f['push'](_0x158b4f['shift']());}};_0x175036(++_0x1cd927);}(_0x4351,0x1b5));var _0x1435=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4351[_0x422905];return _0x33dc6c;};'use strict';function FreshsalesAccount(_0x203408){this['id']=_0x203408['id']||0x0;this[_0x1435('0x0')]=_0x203408[_0x1435('0x0')]||'';this[_0x1435('0x1')]=_0x203408[_0x1435('0x1')]||'';this[_0x1435('0x2')]=_0x203408[_0x1435('0x3')]||'';this[_0x1435('0x4')]=_0x203408[_0x1435('0x4')]||'';this[_0x1435('0x5')]=_0x203408[_0x1435('0x5')]||'';this[_0x1435('0x6')]=_0x203408[_0x1435('0x6')]||{};}module[_0x1435('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2cd3=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x54fbc0,_0x3ed298){var _0x55108f=function(_0x4c1e5c){while(--_0x4c1e5c){_0x54fbc0['push'](_0x54fbc0['shift']());}};_0x55108f(++_0x3ed298);}(_0x2cd3,0xf1));var _0x32cd=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x2cd3[_0x289891];return _0x31cf2e;};'use strict';function FreshsalesAccount(_0x21c841){this['id']=_0x21c841['id']||0x0;this['name']=_0x21c841[_0x32cd('0x0')]||'';this[_0x32cd('0x1')]=_0x21c841[_0x32cd('0x1')]||'';this[_0x32cd('0x2')]=_0x21c841[_0x32cd('0x3')]||'';this[_0x32cd('0x4')]=_0x21c841['remoteUri']||'';this['serverUrl']=_0x21c841[_0x32cd('0x5')]||'';this[_0x32cd('0x6')]=_0x21c841[_0x32cd('0x6')]||{};}module[_0x32cd('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b7c375e..c56e148 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 _0xf74d=['type','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','variables'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf74d,0x168));var _0xdf74=function(_0x122fac,_0x4b9447){_0x122fac=_0x122fac-0x0;var _0x462833=_0xf74d[_0x122fac];return _0x462833;};'use strict';function QueueReport(){this[_0xdf74('0x0')]='inbound';this['uniqueid']='';this[_0xdf74('0x1')]='';this[_0xdf74('0x2')]='';this[_0xdf74('0x3')]='';this[_0xdf74('0x4')]=null;this[_0xdf74('0x5')]=null;this[_0xdf74('0x6')]=0x1;this['count']=0x1;this[_0xdf74('0x7')]=![];this[_0xdf74('0x8')]=null;this[_0xdf74('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xdf74('0xa')]=null;this[_0xdf74('0xb')]=0x1;this[_0xdf74('0xc')]='';this[_0xdf74('0xd')]='';this['connectedlinename']='';this[_0xdf74('0xe')]='';this[_0xdf74('0xf')]='';this[_0xdf74('0x10')]='';this[_0xdf74('0x11')]='';this[_0xdf74('0x12')]=0x0;this[_0xdf74('0x13')]=![];this['lastAssignedTo']='';this[_0xdf74('0x14')]=_0xdf74('0x15');this['routealias']=null;this[_0xdf74('0x16')]=0x0;this[_0xdf74('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x420d=['mohtime','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice'];(function(_0x346caa,_0x46888d){var _0x1f4548=function(_0x3e7c1b){while(--_0x3e7c1b){_0x346caa['push'](_0x346caa['shift']());}};_0x1f4548(++_0x46888d);}(_0x420d,0x85));var _0xd420=function(_0x4beb90,_0x333b47){_0x4beb90=_0x4beb90-0x0;var _0x1f509a=_0x420d[_0x4beb90];return _0x1f509a;};'use strict';function QueueReport(){this['type']=_0xd420('0x0');this[_0xd420('0x1')]='';this['calleridnum']='';this[_0xd420('0x2')]='';this[_0xd420('0x3')]='';this[_0xd420('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xd420('0x5')]=0x1;this[_0xd420('0x6')]=0x1;this[_0xd420('0x7')]=![];this[_0xd420('0x8')]=null;this['queuecallercomplete']=![];this[_0xd420('0x9')]=null;this[_0xd420('0xa')]=![];this[_0xd420('0xb')]=null;this[_0xd420('0xc')]=0x1;this[_0xd420('0xd')]='';this[_0xd420('0xe')]='';this['connectedlinename']='';this[_0xd420('0xf')]='';this[_0xd420('0x10')]='';this[_0xd420('0x11')]='';this[_0xd420('0x12')]='';this[_0xd420('0x13')]=0x0;this[_0xd420('0x14')]=![];this['lastAssignedTo']='';this[_0xd420('0x15')]=_0xd420('0x16');this['routealias']=null;this[_0xd420('0x17')]=0x0;this[_0xd420('0x18')]={};}module[_0xd420('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1e5568c..a3681b9 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 _0x3e94=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x340708,_0x537c03){var _0x25ea19=function(_0x1fa759){while(--_0x1fa759){_0x340708['push'](_0x340708['shift']());}};_0x25ea19(++_0x537c03);}(_0x3e94,0x67));var _0x43e9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e94[_0x17d9e3];return _0x14192d;};'use strict';function SalesforceAccount(_0x2a8809){this['id']=_0x2a8809['id']||0x0;this[_0x43e9('0x0')]=_0x2a8809['name']||'';this[_0x43e9('0x1')]=_0x2a8809[_0x43e9('0x1')]||'';this[_0x43e9('0x2')]=_0x2a8809['remoteUri']||'';this[_0x43e9('0x3')]=_0x2a8809[_0x43e9('0x3')]||'';this[_0x43e9('0x4')]=_0x2a8809['clientId']||'';this[_0x43e9('0x5')]=_0x2a8809['clientSecret']||'';this[_0x43e9('0x6')]=_0x2a8809['securityToken']||'';this[_0x43e9('0x7')]=_0x2a8809[_0x43e9('0x7')]||_0x43e9('0x8');this['serverUrl']=_0x2a8809[_0x43e9('0x9')]||'';this[_0x43e9('0xa')]=_0x2a8809[_0x43e9('0xa')]||{};}module[_0x43e9('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xb3c3=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports'];(function(_0x1a957b,_0x3a5dca){var _0x2b79f4=function(_0x113582){while(--_0x113582){_0x1a957b['push'](_0x1a957b['shift']());}};_0x2b79f4(++_0x3a5dca);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x4708e3,_0x630b5){_0x4708e3=_0x4708e3-0x0;var _0x52977f=_0xb3c3[_0x4708e3];return _0x52977f;};'use strict';function SalesforceAccount(_0x217e43){this['id']=_0x217e43['id']||0x0;this['name']=_0x217e43[_0x3b3c('0x0')]||'';this['username']=_0x217e43[_0x3b3c('0x1')]||'';this['remoteUri']=_0x217e43[_0x3b3c('0x2')]||'';this[_0x3b3c('0x3')]=_0x217e43[_0x3b3c('0x3')]||'';this['clientId']=_0x217e43[_0x3b3c('0x4')]||'';this[_0x3b3c('0x5')]=_0x217e43['clientSecret']||'';this[_0x3b3c('0x6')]=_0x217e43['securityToken']||'';this[_0x3b3c('0x7')]=_0x217e43[_0x3b3c('0x7')]||_0x3b3c('0x8');this['serverUrl']=_0x217e43['serverUrl']||'';this[_0x3b3c('0x9')]=_0x217e43['Configurations']||{};}module[_0x3b3c('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index f049888..74cfc55 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 _0xb59c=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x30fd47,_0x389fe6){var _0x2916a8=function(_0x13a003){while(--_0x13a003){_0x30fd47['push'](_0x30fd47['shift']());}};_0x2916a8(++_0x389fe6);}(_0xb59c,0x1f1));var _0xcb59=function(_0x3a676b,_0x297c77){_0x3a676b=_0x3a676b-0x0;var _0x1aac22=_0xb59c[_0x3a676b];return _0x1aac22;};'use strict';function ServicenowAccount(_0x2f916f){this['id']=_0x2f916f['id']||0x0;this['name']=_0x2f916f[_0xcb59('0x0')]||'';this[_0xcb59('0x1')]=_0x2f916f[_0xcb59('0x1')]||'';this['password']=_0x2f916f[_0xcb59('0x2')]||'';this['remoteUri']=_0x2f916f[_0xcb59('0x3')]||'';this[_0xcb59('0x4')]=_0x2f916f[_0xcb59('0x4')]||'';this[_0xcb59('0x5')]=_0x2f916f['Configurations']||{};}module[_0xcb59('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8587=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x49cf28,_0x5eed1d){var _0x280cba=function(_0x1750a4){while(--_0x1750a4){_0x49cf28['push'](_0x49cf28['shift']());}};_0x280cba(++_0x5eed1d);}(_0x8587,0x1dc));var _0x7858=function(_0x3f4125,_0x2456f9){_0x3f4125=_0x3f4125-0x0;var _0x227221=_0x8587[_0x3f4125];return _0x227221;};'use strict';function ServicenowAccount(_0x43f938){this['id']=_0x43f938['id']||0x0;this[_0x7858('0x0')]=_0x43f938[_0x7858('0x0')]||'';this[_0x7858('0x1')]=_0x43f938[_0x7858('0x1')]||'';this[_0x7858('0x2')]=_0x43f938[_0x7858('0x2')]||'';this[_0x7858('0x3')]=_0x43f938[_0x7858('0x3')]||'';this[_0x7858('0x4')]=_0x43f938[_0x7858('0x4')]||'';this[_0x7858('0x5')]=_0x43f938[_0x7858('0x5')]||{};}module[_0x7858('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 52507c2..441033d 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 _0x06b7=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1c59cf,_0x1ab506){var _0x4ba4ac=function(_0x30d7fa){while(--_0x30d7fa){_0x1c59cf['push'](_0x1c59cf['shift']());}};_0x4ba4ac(++_0x1ab506);}(_0x06b7,0x17d));var _0x706b=function(_0x2acc4a,_0x24b538){_0x2acc4a=_0x2acc4a-0x0;var _0x59f0c7=_0x06b7[_0x2acc4a];return _0x59f0c7;};'use strict';function SugarcrmAccount(_0x140102){this['id']=_0x140102['id']||0x0;this['name']=_0x140102[_0x706b('0x0')]||'';this[_0x706b('0x1')]=_0x140102['username']||'';this[_0x706b('0x2')]=_0x140102['password']||'';this[_0x706b('0x3')]=_0x140102[_0x706b('0x3')]||'';this[_0x706b('0x4')]=_0x140102[_0x706b('0x4')]||'';this[_0x706b('0x5')]=_0x140102[_0x706b('0x5')]||{};}module[_0x706b('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xa2d7=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x51c358,_0x54c9d2){_0x51c358=_0x51c358-0x0;var _0x522ee1=_0xa2d7[_0x51c358];return _0x522ee1;};'use strict';function SugarcrmAccount(_0x1b8b7d){this['id']=_0x1b8b7d['id']||0x0;this[_0x7a2d('0x0')]=_0x1b8b7d[_0x7a2d('0x0')]||'';this['username']=_0x1b8b7d['username']||'';this[_0x7a2d('0x1')]=_0x1b8b7d[_0x7a2d('0x1')]||'';this[_0x7a2d('0x2')]=_0x1b8b7d[_0x7a2d('0x2')]||'';this['serverUrl']=_0x1b8b7d[_0x7a2d('0x3')]||'';this[_0x7a2d('0x4')]=_0x1b8b7d[_0x7a2d('0x4')]||{};}module[_0x7a2d('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3cc246d..f6c57b5 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 _0x9f98=['state','unknown','status','exports','name','accountcode'];(function(_0x10106a,_0x343b68){var _0x5da8b9=function(_0x18801c){while(--_0x18801c){_0x10106a['push'](_0x10106a['shift']());}};_0x5da8b9(++_0x343b68);}(_0x9f98,0xac));var _0x89f9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9f98[_0x3ab51d];return _0x29a04e;};'use strict';function Telephone(_0x4c1204){this['id']=_0x4c1204['id']||0x0;this[_0x89f9('0x0')]=_0x4c1204[_0x89f9('0x0')]||'';this[_0x89f9('0x1')]=_0x4c1204['accountcode']||'';this[_0x89f9('0x2')]=_0x89f9('0x3');this['stateTime']=0x0;this[_0x89f9('0x4')]=_0x89f9('0x3');this['address']='';}module[_0x89f9('0x5')]=Telephone; \ No newline at end of file +var _0x42cb=['status','name','accountcode','unknown','stateTime'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x42cb,0x178));var _0xb42c=function(_0x4d8027,_0xfb9231){_0x4d8027=_0x4d8027-0x0;var _0x2ee50e=_0x42cb[_0x4d8027];return _0x2ee50e;};'use strict';function Telephone(_0xd87a11){this['id']=_0xd87a11['id']||0x0;this['name']=_0xd87a11[_0xb42c('0x0')]||'';this['accountcode']=_0xd87a11[_0xb42c('0x1')]||'';this['state']=_0xb42c('0x2');this[_0xb42c('0x3')]=0x0;this[_0xb42c('0x4')]=_0xb42c('0x2');this['address']='';}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 2cc37f8..68ffb90 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(_0x4297ad,_0x1db93d){var _0x37a5f6=function(_0x4a95c8){while(--_0x4a95c8){_0x4297ad['push'](_0x4297ad['shift']());}};_0x37a5f6(++_0x1db93d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x54968b,_0x409b73){var _0x9c12d6=function(_0x2ae72a){while(--_0x2ae72a){_0x54968b['push'](_0x54968b['shift']());}};_0x9c12d6(++_0x409b73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 8278d35..fbba75c 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x43f16f,_0x5b99e5){var _0x66db51=function(_0x1b017b){while(--_0x1b017b){_0x43f16f['push'](_0x43f16f['shift']());}};_0x66db51(++_0x5b99e5);}(_0x4fc2,0x111));var _0x24fc=function(_0x401e25,_0x51ce02){_0x401e25=_0x401e25-0x0;var _0x192d3d=_0x4fc2[_0x401e25];return _0x192d3d;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 5d98343..2204e29 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 _0x9c30=['stateTime','status','registry','indexOf','host','stateRegistry','address','defaultuser','exports','active','name','unknown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c30,0xb1));var _0x09c3=function(_0x2bb8e4,_0xe5bc48){_0x2bb8e4=_0x2bb8e4-0x0;var _0x30c048=_0x9c30[_0x2bb8e4];return _0x30c048;};'use strict';function Trunk(_0x111e1f){this['id']=_0x111e1f['id']||0x0;this[_0x09c3('0x0')]=_0x111e1f[_0x09c3('0x0')]||![];this[_0x09c3('0x1')]=_0x111e1f[_0x09c3('0x1')]||'';this['state']=_0x09c3('0x2');this[_0x09c3('0x3')]=0x0;this[_0x09c3('0x4')]='unknown';this[_0x09c3('0x5')]=_0x111e1f[_0x09c3('0x5')]&&_0x111e1f[_0x09c3('0x5')][_0x09c3('0x6')](':')?_0x111e1f['registry']['split'](':')[0x0]:'';this[_0x09c3('0x7')]='';this['port']='';this['domain']='';this['domainport']='';this['refresh']='';this[_0x09c3('0x8')]=_0x09c3('0x2');this['registrationtime']='';this[_0x09c3('0x9')]='';this[_0x09c3('0xa')]=_0x111e1f[_0x09c3('0xa')]||'';}module[_0x09c3('0xb')]=Trunk; \ No newline at end of file +var _0x5cfc=['registry','split','host','port','domain','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5cfc,0x118));var _0xc5cf=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x5cfc[_0x2fdce0];return _0x36f07e;};'use strict';function Trunk(_0x11f397){this['id']=_0x11f397['id']||0x0;this[_0xc5cf('0x0')]=_0x11f397[_0xc5cf('0x0')]||![];this['name']=_0x11f397[_0xc5cf('0x1')]||'';this[_0xc5cf('0x2')]=_0xc5cf('0x3');this[_0xc5cf('0x4')]=0x0;this['status']=_0xc5cf('0x3');this[_0xc5cf('0x5')]=_0x11f397['registry']&&_0x11f397[_0xc5cf('0x5')]['indexOf'](':')?_0x11f397['registry'][_0xc5cf('0x6')](':')[0x0]:'';this[_0xc5cf('0x7')]='';this[_0xc5cf('0x8')]='';this[_0xc5cf('0x9')]='';this['domainport']='';this['refresh']='';this[_0xc5cf('0xa')]=_0xc5cf('0x3');this[_0xc5cf('0xb')]='';this[_0xc5cf('0xc')]='';this['defaultuser']=_0x11f397[_0xc5cf('0xd')]||'';}module[_0xc5cf('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0bfe165..46657ff 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 _0x286a=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x157f80,_0x5dc3eb){var _0x19784=function(_0x5b62c0){while(--_0x5b62c0){_0x157f80['push'](_0x157f80['shift']());}};_0x19784(++_0x5dc3eb);}(_0x286a,0x11f));var _0xa286=function(_0x37dc02,_0xa88670){_0x37dc02=_0x37dc02-0x0;var _0x2a8046=_0x286a[_0x37dc02];return _0x2a8046;};'use strict';function voiceExtension(_0x1419ca){this['id']=_0x1419ca['id']||0x0;this[_0xa286('0x0')]=_0x1419ca[_0xa286('0x0')]||'';this['recordingFormat']=_0x1419ca[_0xa286('0x1')]||_0xa286('0x2');this[_0xa286('0x3')]=_0x1419ca[_0xa286('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xd8ad=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x4f4ad,_0x4374f8){var _0x48ad55=function(_0x58ca24){while(--_0x58ca24){_0x4f4ad['push'](_0x4f4ad['shift']());}};_0x48ad55(++_0x4374f8);}(_0xd8ad,0x73));var _0xdd8a=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xd8ad[_0x47a7d0];return _0xb9bd08;};'use strict';function voiceExtension(_0x51297a){this['id']=_0x51297a['id']||0x0;this[_0xdd8a('0x0')]=_0x51297a[_0xdd8a('0x0')]||'';this['recordingFormat']=_0x51297a[_0xdd8a('0x1')]||_0xdd8a('0x2');this[_0xdd8a('0x3')]=_0x51297a[_0xdd8a('0x3')]||![];}module[_0xdd8a('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 139c2df..c57de8f 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 _0xc962=['busy','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available'];(function(_0xfd125f,_0x40d8ab){var _0x104251=function(_0x4f0f33){while(--_0x4f0f33){_0xfd125f['push'](_0xfd125f['shift']());}};_0x104251(++_0x40d8ab);}(_0xc962,0x6d));var _0x2c96=function(_0x8377e1,_0x3bd9c5){_0x8377e1=_0x8377e1-0x0;var _0x1b0d61=_0xc962[_0x8377e1];return _0x1b0d61;};'use strict';var monitorFormat={'wav':_0x2c96('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x2c96('0x1'),'linear':_0x2c96('0x2'),'random':_0x2c96('0x3'),'ringall':_0x2c96('0x4'),'rr':_0x2c96('0x5'),'rrmemory':_0x2c96('0x6'),'rrordered':_0x2c96('0x7'),'wrandom':_0x2c96('0x8')};function VoiceQueue(_0x599a47){this['id']=_0x599a47['id']||0x0;this[_0x2c96('0x9')]=_0x599a47[_0x2c96('0x9')]||'';this[_0x2c96('0xa')]=_0x599a47[_0x2c96('0xa')]||'';this[_0x2c96('0xb')]=_0x599a47[_0x2c96('0xb')]||_0x2c96('0xc');this[_0x2c96('0xd')]=0x0;this[_0x2c96('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x2c96('0xf')]=0x0;this[_0x2c96('0x10')]=0x0;this[_0x2c96('0x11')]=0x0;this[_0x2c96('0x12')]=0x0;this[_0x2c96('0x13')]=0x0;this[_0x2c96('0x14')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0x2c96('0x15')]=0x0;this[_0x2c96('0x16')]=0x0;this[_0x2c96('0x17')]=0x0;this[_0x2c96('0x18')]=0x0;this[_0x2c96('0x19')]=0x0;this[_0x2c96('0x1a')]=0x0;this[_0x2c96('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x599a47[_0x2c96('0x1c')]||![];this[_0x2c96('0x1d')]=_0x599a47['acwTimeout']||0xa;this[_0x2c96('0x1e')]=_0x599a47[_0x2c96('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x2c96('0x1f')]='';this[_0x2c96('0x20')]='';this[_0x2c96('0x21')]=0x0;this[_0x2c96('0x22')]=0x0;this[_0x2c96('0x23')]=_0x599a47[_0x2c96('0x23')]||null;this[_0x2c96('0x24')]=_0x599a47[_0x2c96('0x24')]?_0x599a47[_0x2c96('0x24')]:null;this['dialActive']=_0x599a47['dialActive'];this[_0x2c96('0x25')]=_0x599a47[_0x2c96('0x25')]||_0x2c96('0x26');this['dialLimitChannel']=_0x599a47[_0x2c96('0x27')]||0x0;this[_0x2c96('0x28')]=_0x599a47[_0x2c96('0x28')]||0x0;this['dialPowerLevel']=_0x599a47[_0x2c96('0x29')]||0x1;this[_0x2c96('0x2a')]=_0x599a47['dialPredictiveOptimization']||_0x2c96('0x2b');this[_0x2c96('0x2c')]=_0x599a47[_0x2c96('0x2c')]||0.03;this[_0x2c96('0x2d')]=_0x599a47[_0x2c96('0x2d')]||0x258;this[_0x2c96('0x2e')]=_0x599a47[_0x2c96('0x2e')]||'anonymous';this[_0x2c96('0x2f')]=_0x599a47['dialOriginateCallerIdNumber']||'anonymous';this[_0x2c96('0x30')]=_0x599a47['dialOriginateTimeout']||0x1e;this[_0x2c96('0x31')]=_0x599a47[_0x2c96('0x31')]||_0x2c96('0x32');this[_0x2c96('0x33')]=_0x599a47['dialQueueTimeout']||0x3;this[_0x2c96('0x34')]=_0x599a47[_0x2c96('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x599a47[_0x2c96('0x35')]||0x3;this[_0x2c96('0x36')]=_0x599a47[_0x2c96('0x36')]||0x96;this[_0x2c96('0x37')]=_0x599a47['dialBusyMaxRetry']||0x3;this[_0x2c96('0x38')]=_0x599a47[_0x2c96('0x38')]||0x96;this[_0x2c96('0x39')]=_0x599a47[_0x2c96('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0x599a47[_0x2c96('0x3a')]||0x96;this[_0x2c96('0x3b')]=_0x599a47['dialNoSuchNumberMaxRetry']||0x3;this[_0x2c96('0x3c')]=_0x599a47['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2c96('0x3d')]=_0x599a47[_0x2c96('0x3d')]||0x3;this[_0x2c96('0x3e')]=_0x599a47[_0x2c96('0x3e')]||0x96;this[_0x2c96('0x3f')]=_0x599a47[_0x2c96('0x3f')]||0x3;this[_0x2c96('0x40')]=_0x599a47[_0x2c96('0x40')]||0x96;this['dialMachineMaxRetry']=_0x599a47[_0x2c96('0x41')]||0x3;this[_0x2c96('0x42')]=_0x599a47[_0x2c96('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x599a47[_0x2c96('0x43')]||0x3;this[_0x2c96('0x44')]=_0x599a47[_0x2c96('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x599a47[_0x2c96('0x45')]||0x3;this[_0x2c96('0x46')]=_0x599a47[_0x2c96('0x46')]||0x4;this[_0x2c96('0x47')]=_0x599a47[_0x2c96('0x47')]?_0x599a47['Trunk']:undefined;this[_0x2c96('0x48')]=_0x599a47[_0x2c96('0x48')]?_0x599a47[_0x2c96('0x48')]:undefined;this[_0x2c96('0x49')]=_0x599a47[_0x2c96('0x49')]||undefined;this[_0x2c96('0x4a')]=_0x599a47[_0x2c96('0x4a')]?_0x599a47[_0x2c96('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x599a47['dialOrderByScheduledAt']||_0x2c96('0x4b');this[_0x2c96('0x4c')]=_0x599a47[_0x2c96('0x4c')]||undefined;this[_0x2c96('0x4d')]=_0x599a47['dialCutDigit']||undefined;this[_0x2c96('0x4e')]=strategy[_0x599a47['strategy']];this[_0x2c96('0x4f')]=!![];this[_0x2c96('0x50')]=_0x599a47[_0x2c96('0x50')]||![];this[_0x2c96('0x51')]=_0x599a47[_0x2c96('0x51')];this['dialAMDGreeting']=_0x599a47[_0x2c96('0x52')];this['dialAMDAfterGreetingSilence']=_0x599a47[_0x2c96('0x53')];this[_0x2c96('0x54')]=_0x599a47['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x599a47[_0x2c96('0x55')];this[_0x2c96('0x56')]=_0x599a47[_0x2c96('0x56')];this[_0x2c96('0x57')]=_0x599a47[_0x2c96('0x57')];this[_0x2c96('0x58')]=_0x599a47['dialAMDSilenceThreshold'];this[_0x2c96('0x59')]=_0x599a47[_0x2c96('0x59')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x2c96('0x5a')]=_0x599a47[_0x2c96('0x5a')];this[_0x2c96('0x5b')]=0x0;this[_0x2c96('0x5c')]=0x0;this[_0x2c96('0x5d')]=0x0;this[_0x2c96('0x5e')]=0x0;this[_0x2c96('0x5f')]=0x0;this[_0x2c96('0x60')]=0x0;this[_0x2c96('0x61')]=0x0;this[_0x2c96('0x62')]=0x0;this[_0x2c96('0x63')]=0x0;this[_0x2c96('0x64')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2c96('0x65')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2c96('0x66')]=undefined;this[_0x2c96('0x67')]=undefined;this[_0x2c96('0x68')]=undefined;this[_0x2c96('0x69')]=1.05;this[_0x2c96('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2c96('0x6b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2c96('0x6c')]=0x0;this[_0x2c96('0x6d')]=0x0;this[_0x2c96('0x6e')]=0x0;this[_0x2c96('0x6f')]=_0x599a47[_0x2c96('0x70')]||0x14;this['predictiveIntervalMinThreshold']=_0x599a47[_0x2c96('0x70')]||0xa;this[_0x2c96('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2c96('0x72')]=0x1;this['erlangCalls']=0x0;this[_0x2c96('0x73')]=0x0;this[_0x2c96('0x74')]=0x0;this[_0x2c96('0x75')]=0x0;this[_0x2c96('0x76')]=_0x599a47[_0x2c96('0x76')]||0x1e;this[_0x2c96('0x77')]=_0x599a47[_0x2c96('0x77')]||![];this[_0x2c96('0x78')]=!!_0x599a47['dialPreviewAutoRecallMe']||![];this[_0x2c96('0x79')]=!!_0x599a47[_0x2c96('0x79')]||![];this[_0x2c96('0x7a')]=_0x599a47[_0x2c96('0x7a')]||undefined;this['dialAgiAfterHangupClient']=_0x599a47[_0x2c96('0x7b')]||![];this[_0x2c96('0x7c')]=_0x599a47[_0x2c96('0x7c')]||![];this[_0x2c96('0xa')]=monitorFormat[_0x599a47[_0x2c96('0xa')]]?monitorFormat[_0x599a47['monitor_format']]:undefined;this[_0x2c96('0x7d')]=_0x599a47[_0x2c96('0x7d')]||![];this['mandatoryDispositionPause']=_0x599a47[_0x2c96('0x7e')]?_0x599a47['mandatoryDispositionPause']:undefined;this[_0x2c96('0x7f')]=![];}module[_0x2c96('0x80')]=VoiceQueue; \ No newline at end of file +var _0x04cc=['startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0x04cc,0x11a));var _0xc04c=function(_0x48dfc7,_0x28410f){_0x48dfc7=_0x48dfc7-0x0;var _0x553cbf=_0x04cc[_0x48dfc7];return _0x553cbf;};'use strict';var monitorFormat={'wav':_0xc04c('0x0'),'wav49':_0xc04c('0x1'),'gsm':_0xc04c('0x2')};var strategy={'fewestcalls':_0xc04c('0x3'),'leastrecent':'leastrecent','linear':_0xc04c('0x4'),'random':'random','ringall':'ringall','rr':_0xc04c('0x5'),'rrmemory':_0xc04c('0x6'),'rrordered':_0xc04c('0x7'),'wrandom':_0xc04c('0x8')};function VoiceQueue(_0x28d35d){this['id']=_0x28d35d['id']||0x0;this[_0xc04c('0x9')]=_0x28d35d[_0xc04c('0x9')]||'';this['monitor_format']=_0x28d35d[_0xc04c('0xa')]||'';this[_0xc04c('0xb')]=_0x28d35d[_0xc04c('0xb')]||_0xc04c('0xc');this[_0xc04c('0xd')]=0x0;this[_0xc04c('0xe')]=0x0;this[_0xc04c('0xf')]=0x0;this[_0xc04c('0x10')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xc04c('0x11')]=0x0;this[_0xc04c('0x12')]=0x0;this[_0xc04c('0x13')]=0x0;this[_0xc04c('0x14')]=0x0;this[_0xc04c('0x15')]=0x0;this[_0xc04c('0x16')]=0x0;this[_0xc04c('0x17')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0xc04c('0x18')]=0x0;this['ringing']=0x0;this[_0xc04c('0x19')]=0x0;this[_0xc04c('0x1a')]=0x0;this[_0xc04c('0x1b')]=0x0;this[_0xc04c('0x1c')]=0x0;this['acw']=_0x28d35d[_0xc04c('0x1d')]||![];this[_0xc04c('0x1e')]=_0x28d35d[_0xc04c('0x1e')]||0xa;this[_0xc04c('0x1f')]=_0x28d35d['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xc04c('0x20')]='';this[_0xc04c('0x21')]=0x0;this['temp']=0x0;this[_0xc04c('0x22')]=_0x28d35d['dialTimezone']||null;this[_0xc04c('0x23')]=_0x28d35d[_0xc04c('0x23')]?_0x28d35d['dialGlobalInterval']:null;this[_0xc04c('0x24')]=_0x28d35d[_0xc04c('0x24')];this[_0xc04c('0x25')]=_0x28d35d[_0xc04c('0x25')]||_0xc04c('0x26');this[_0xc04c('0x27')]=_0x28d35d[_0xc04c('0x27')]||0x0;this[_0xc04c('0x28')]=_0x28d35d[_0xc04c('0x28')]||0x0;this[_0xc04c('0x29')]=_0x28d35d[_0xc04c('0x29')]||0x1;this['dialPredictiveOptimization']=_0x28d35d[_0xc04c('0x2a')]||_0xc04c('0x2b');this[_0xc04c('0x2c')]=_0x28d35d[_0xc04c('0x2c')]||0.03;this[_0xc04c('0x2d')]=_0x28d35d[_0xc04c('0x2d')]||0x258;this[_0xc04c('0x2e')]=_0x28d35d[_0xc04c('0x2e')]||_0xc04c('0x2f');this[_0xc04c('0x30')]=_0x28d35d['dialOriginateCallerIdNumber']||_0xc04c('0x2f');this['dialOriginateTimeout']=_0x28d35d[_0xc04c('0x31')]||0x1e;this[_0xc04c('0x32')]=_0x28d35d[_0xc04c('0x32')]||_0xc04c('0x33');this[_0xc04c('0x34')]=_0x28d35d['dialQueueTimeout']||0x3;this[_0xc04c('0x35')]=_0x28d35d[_0xc04c('0x35')]||undefined;this[_0xc04c('0x36')]=_0x28d35d[_0xc04c('0x36')]||0x3;this[_0xc04c('0x37')]=_0x28d35d['dialCongestionRetryFrequency']||0x96;this[_0xc04c('0x38')]=_0x28d35d[_0xc04c('0x38')]||0x3;this[_0xc04c('0x39')]=_0x28d35d['dialBusyRetryFrequency']||0x96;this[_0xc04c('0x3a')]=_0x28d35d['dialNoAnswerMaxRetry']||0x3;this[_0xc04c('0x3b')]=_0x28d35d[_0xc04c('0x3b')]||0x96;this[_0xc04c('0x3c')]=_0x28d35d['dialNoSuchNumberMaxRetry']||0x3;this[_0xc04c('0x3d')]=_0x28d35d['dialNoSuchNumberRetryFrequency']||0x96;this[_0xc04c('0x3e')]=_0x28d35d[_0xc04c('0x3e')]||0x3;this[_0xc04c('0x3f')]=_0x28d35d[_0xc04c('0x3f')]||0x96;this[_0xc04c('0x40')]=_0x28d35d['dialAbandonedMaxRetry']||0x3;this[_0xc04c('0x41')]=_0x28d35d['dialAbandonedRetryFrequency']||0x96;this[_0xc04c('0x42')]=_0x28d35d['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x28d35d['dialMachineRetryFrequency']||0x96;this[_0xc04c('0x43')]=_0x28d35d[_0xc04c('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x28d35d['dialAgentRejectRetryFrequency']||0x96;this[_0xc04c('0x44')]=_0x28d35d[_0xc04c('0x44')]||0x3;this[_0xc04c('0x45')]=_0x28d35d[_0xc04c('0x45')]||0x4;this['Trunk']=_0x28d35d[_0xc04c('0x46')]?_0x28d35d[_0xc04c('0x46')]:undefined;this[_0xc04c('0x47')]=_0x28d35d[_0xc04c('0x47')]?_0x28d35d[_0xc04c('0x47')]:undefined;this[_0xc04c('0x48')]=_0x28d35d[_0xc04c('0x48')]||undefined;this[_0xc04c('0x49')]=_0x28d35d[_0xc04c('0x49')]?_0x28d35d['Interval']:undefined;this[_0xc04c('0x4a')]=_0x28d35d[_0xc04c('0x4a')]||_0xc04c('0x4b');this[_0xc04c('0x4c')]=_0x28d35d[_0xc04c('0x4c')]||undefined;this[_0xc04c('0x4d')]=_0x28d35d['dialCutDigit']||undefined;this[_0xc04c('0x4e')]=strategy[_0x28d35d['strategy']];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x28d35d[_0xc04c('0x4f')]||![];this[_0xc04c('0x50')]=_0x28d35d[_0xc04c('0x50')];this[_0xc04c('0x51')]=_0x28d35d[_0xc04c('0x51')];this[_0xc04c('0x52')]=_0x28d35d[_0xc04c('0x52')];this[_0xc04c('0x53')]=_0x28d35d['dialAMDTotalAnalysisTime'];this[_0xc04c('0x54')]=_0x28d35d[_0xc04c('0x54')];this['dialAMDBetweenWordsSilence']=_0x28d35d[_0xc04c('0x55')];this[_0xc04c('0x56')]=_0x28d35d[_0xc04c('0x56')];this[_0xc04c('0x57')]=_0x28d35d[_0xc04c('0x57')];this[_0xc04c('0x58')]=_0x28d35d[_0xc04c('0x58')];this[_0xc04c('0x59')]=0x0;this['pTalking']=0x0;this[_0xc04c('0x5a')]=_0x28d35d['timeout'];this[_0xc04c('0x5b')]=0x0;this[_0xc04c('0x5c')]=0x0;this[_0xc04c('0x5d')]=0x0;this[_0xc04c('0x5e')]=0x0;this[_0xc04c('0x5f')]=0x0;this[_0xc04c('0x60')]=0x0;this[_0xc04c('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc04c('0x62')]=0x0;this[_0xc04c('0x63')]=0x0;this[_0xc04c('0x64')]=0x0;this[_0xc04c('0x65')]=0x0;this[_0xc04c('0x66')]=0x0;this[_0xc04c('0x67')]=0x0;this[_0xc04c('0x68')]=undefined;this[_0xc04c('0x69')]=undefined;this[_0xc04c('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc04c('0x6b')]=0x0;this[_0xc04c('0x6c')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xc04c('0x6d')]=0x0;this[_0xc04c('0x6e')]=0x0;this[_0xc04c('0x6f')]=0x0;this[_0xc04c('0x70')]=0x0;this[_0xc04c('0x71')]=0x0;this[_0xc04c('0x72')]=_0x28d35d[_0xc04c('0x73')]||0x14;this['predictiveIntervalMinThreshold']=_0x28d35d[_0xc04c('0x73')]||0xa;this[_0xc04c('0x74')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xc04c('0x75')]=0x1;this[_0xc04c('0x76')]=0x0;this[_0xc04c('0x77')]=0x0;this[_0xc04c('0x78')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x28d35d['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x28d35d['dialRecallInQueue']||![];this[_0xc04c('0x79')]=!!_0x28d35d[_0xc04c('0x79')]||![];this['dialPreviewRecallmeReminder']=!!_0x28d35d[_0xc04c('0x7a')]||![];this[_0xc04c('0x7b')]=_0x28d35d[_0xc04c('0x7b')]||undefined;this[_0xc04c('0x7c')]=_0x28d35d[_0xc04c('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x28d35d['dialAgiAfterHangupAgent']||![];this[_0xc04c('0xa')]=monitorFormat[_0x28d35d[_0xc04c('0xa')]]?monitorFormat[_0x28d35d[_0xc04c('0xa')]]:undefined;this[_0xc04c('0x7d')]=_0x28d35d[_0xc04c('0x7d')]||![];this['mandatoryDispositionPause']=_0x28d35d[_0xc04c('0x7e')]?_0x28d35d[_0xc04c('0x7e')]:undefined;this[_0xc04c('0x7f')]=![];}module[_0xc04c('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index b1ce87b..495ea8a 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 _0x044a=['length','SIP/','online','includes','status','booked','keys','queue','dialer','xcally-motion-preview','some','message','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','name','active','prototype','createReport','loggedin','callers'];(function(_0x1ad347,_0x475e2b){var _0x290698=function(_0x3bd333){while(--_0x3bd333){_0x1ad347['push'](_0x1ad347['shift']());}};_0x290698(++_0x475e2b);}(_0x044a,0x173));var _0xa044=function(_0x571a10,_0x2ff4ea){_0x571a10=_0x571a10-0x0;var _0xf88c42=_0x044a[_0x571a10];return _0xf88c42;};'use strict';var INBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x1'),_0xa044('0x2'),_0xa044('0x3'),_0xa044('0x4'),_0xa044('0x5'),_0xa044('0x6')];var OUTBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x7'),_0xa044('0x8'),'loggedIn',_0xa044('0x2'),_0xa044('0x9'),_0xa044('0xa'),_0xa044('0xb'),'outboundBlacklistCallsDay',_0xa044('0xc'),_0xa044('0xd'),_0xa044('0xe'),_0xa044('0xf'),'outboundReCallsDay',_0xa044('0x10'),_0xa044('0x11'),_0xa044('0x3'),'pTalking',_0xa044('0x5'),_0xa044('0x12'),_0xa044('0x13'),_0xa044('0x14'),'waiting'];function VoiceQueueSummary(_0x195edf){this['id']=_0x195edf['id'];this['name']=_0x195edf['name'];this[_0xa044('0x15')]=_0x195edf[_0xa044('0x15')];this[_0xa044('0x16')]=_0x195edf[_0xa044('0x16')]||0x0;this[_0xa044('0x7')]=_0x195edf[_0xa044('0x7')]||0x0;this[_0xa044('0x0')]=_0x195edf['available']||0x0;this[_0xa044('0x17')]=_0x195edf['busy']||0x0;this[_0xa044('0x8')]=_0x195edf[_0xa044('0x8')]||0x0;this[_0xa044('0x18')]=_0x195edf[_0xa044('0x18')]||0x0;this[_0xa044('0x1')]=_0x195edf['loggedIn']||0x0;this['loggedInDb']=_0x195edf[_0xa044('0x2')]||0x0;this['onHold']=_0x195edf[_0xa044('0x19')]||0x0;this[_0xa044('0x1a')]=_0x195edf[_0xa044('0x1a')]||0x0;this[_0xa044('0x3')]=_0x195edf[_0xa044('0x3')]||0x0;this['ringing']=_0x195edf['ringing']||0x0;this['ringInUse']=_0x195edf[_0xa044('0x1b')];this[_0xa044('0x12')]=_0x195edf[_0xa044('0x12')];this['sumDuration']=_0x195edf[_0xa044('0x13')];this[_0xa044('0x1c')]=_0x195edf['sumHoldTime']||0x0;this[_0xa044('0x5')]=_0x195edf[_0xa044('0x5')]||0x0;this[_0xa044('0x14')]=_0x195edf['total']||0x0;this[_0xa044('0x1d')]=_0x195edf[_0xa044('0x1d')];this[_0xa044('0x1e')]=_0x195edf[_0xa044('0x1e')]||0x0;this[_0xa044('0x1f')]=_0x195edf[_0xa044('0x1f')]||0x0;this[_0xa044('0x20')]=_0x195edf[_0xa044('0x20')]||0x0;this[_0xa044('0x6')]=_0x195edf['waiting']||0x0;if(_0x195edf['type']===_0xa044('0x21')){this[_0xa044('0x22')]=_0x195edf[_0xa044('0x22')]||0x0;this['dialActive']=_0x195edf[_0xa044('0x23')];this[_0xa044('0x24')]=_0x195edf['dialMethod'];this[_0xa044('0x25')]=_0x195edf[_0xa044('0x25')];this['dialOriginateCallerIdNumber']=_0x195edf[_0xa044('0x26')];this[_0xa044('0x27')]=_0x195edf['dialOriginateTimeout'];this['dialPrefix']=_0x195edf['dialPrefix'];this[_0xa044('0x28')]=_0x195edf[_0xa044('0x28')];this[_0xa044('0x29')]=_0x195edf['outboundAnswerAgiCallsDay'];this[_0xa044('0xb')]=_0x195edf[_0xa044('0xb')];this['outboundBlacklistCallsDay']=_0x195edf[_0xa044('0x2a')];this['outboundBusyCallsDay']=_0x195edf['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x195edf['outboundCongestionCallsDay'];this[_0xa044('0x2b')]=_0x195edf[_0xa044('0x2b')];this[_0xa044('0x2c')]=_0x195edf[_0xa044('0x2c')];this[_0xa044('0x2d')]=_0x195edf[_0xa044('0x2d')];this['outboundNoAnswerCallsDay']=_0x195edf[_0xa044('0xe')];this[_0xa044('0xf')]=_0x195edf[_0xa044('0xf')];this[_0xa044('0x2e')]=_0x195edf['outboundOriginateFailureCallsDay'];this[_0xa044('0x2f')]=_0x195edf[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x195edf['outboundRejectCallsDay'];this[_0xa044('0x11')]=_0x195edf[_0xa044('0x11')];this['predictiveIntervalAnsweredCalls']=_0x195edf[_0xa044('0x30')];this[_0xa044('0x31')]=_0x195edf[_0xa044('0x31')];this['predictiveIntervalAvgTalktime']=_0x195edf[_0xa044('0x32')];this[_0xa044('0x33')]=_0x195edf[_0xa044('0x33')];this[_0xa044('0x34')]=_0x195edf[_0xa044('0x34')];this['predictiveIntervalErlangCalls']=_0x195edf[_0xa044('0x35')];this[_0xa044('0x36')]=_0x195edf[_0xa044('0x36')];this['predictiveIntervalHitRate']=_0x195edf[_0xa044('0x37')];this[_0xa044('0x38')]=_0x195edf['predictiveIntervalMultiplicativeFactor'];this[_0xa044('0x39')]=_0x195edf[_0xa044('0x39')];this[_0xa044('0x3a')]=_0x195edf[_0xa044('0x3a')];this[_0xa044('0x3b')]=_0x195edf[_0xa044('0x3b')];this[_0xa044('0x9')]=_0x195edf[_0xa044('0x9')];this['erlangCalls']=_0x195edf[_0xa044('0x3c')];this[_0xa044('0x3d')]=_0x195edf[_0xa044('0x3d')];this[_0xa044('0x3e')]=_0x195edf[_0xa044('0x3e')];this['erlangBusyFactor']=_0x195edf[_0xa044('0x3f')];this['startPredictive']=_0x195edf[_0xa044('0x40')];this[_0xa044('0x41')]=_0x195edf['startProgressive'];this['message']=_0x195edf['message'];this[_0xa044('0x42')]=_0x195edf[_0xa044('0x42')];}if(_0x195edf[_0xa044('0x43')]){this[_0xa044('0x43')]={'id':_0x195edf[_0xa044('0x43')]['id'],'name':_0x195edf[_0xa044('0x43')][_0xa044('0x44')],'active':_0x195edf[_0xa044('0x43')][_0xa044('0x45')],'callerid':_0x195edf[_0xa044('0x43')]['callerid']};}}VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x47')]=function(_0x1e84c1,_0x7d768b,_0xde6a4c,_0x1295c0){this[_0xa044('0x2')]=0x0;this[_0xa044('0x5')]=0x0;this[_0xa044('0x3')]=0x0;this[_0xa044('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xa044('0x17')]=0x0;this['invalid']=0x0;this[_0xa044('0x1e')]=0x0;this[_0xa044('0x4')]=0x0;this[_0xa044('0x1b')]=0x0;this[_0xa044('0x19')]=0x0;if(_0xde6a4c){if(_0xde6a4c[_0xa044('0x0')]){this[_0xa044('0x0')]=Number(_0xde6a4c['available']);}if(_0xde6a4c[_0xa044('0x48')]){this['loggedIn']=Number(_0xde6a4c[_0xa044('0x48')]);}if(_0xde6a4c[_0xa044('0x49')]){this[_0xa044('0x6')]=Number(_0xde6a4c['callers']);}}for(var _0x543e64=0x0;_0x543e64<_0x1e84c1[_0xa044('0x4a')];_0x543e64++){var _0x1e4a4f=_0x7d768b[_0xa044('0x4b')+_0x1e84c1[_0x543e64][_0xa044('0x44')]];if(_0x1e4a4f&&_0x1e4a4f[_0xa044('0x4c')]){this[_0xa044('0x2')]+=0x1;}if(_0x1e84c1[_0x543e64]['incall']==='1'){this[_0xa044('0x5')]+=0x1;}if(_0x1e84c1[_0x543e64][_0xa044('0x3')]==='1'&&!['2','7','8'][_0xa044('0x4d')](_0x1e84c1[_0x543e64][_0xa044('0x4e')])){this[_0xa044('0x3')]+=0x1;}switch(_0x1e84c1[_0x543e64][_0xa044('0x4e')]){case'0':this[_0xa044('0x1f')]+=0x1;break;case'1':this[_0xa044('0x1a')]+=0x1;break;case'2':this[_0xa044('0x8')]+=0x1;break;case'3':this[_0xa044('0x17')]+=0x1;break;case'4':this[_0xa044('0x18')]+=0x1;break;case'5':this[_0xa044('0x1e')]+=0x1;break;case'6':this[_0xa044('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa044('0x19')]+=0x1;break;}}if(this[_0xa044('0x24')]===_0xa044('0x4f')){var _0x228fc0=Object[_0xa044('0x50')](_0x1295c0);for(var _0x230ecf=0x0;_0x230ecf<_0x228fc0[_0xa044('0x4a')];_0x230ecf++){var _0x5c2498=_0x228fc0[_0x230ecf];var _0x57261c=_0x1295c0[_0x5c2498];if(_0x57261c[_0xa044('0x51')]===this[_0xa044('0x44')]&&_0x57261c[_0xa044('0x1d')]===_0xa044('0x52')&&_0x57261c['exten']===_0xa044('0x53')){this[_0xa044('0x5')]+=0x1;}}if(this[_0xa044('0x5')]>this[_0xa044('0x8')]){this[_0xa044('0x5')]=this[_0xa044('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa044('0x46')]['compareToInboundQueue']=function(_0x5ad9fa){var _0x4152c7=![];if(_0x5ad9fa){_0x4152c7=INBOUND_COUNTERS[_0xa044('0x54')](function(_0x3ea870){return this[_0x3ea870]!==_0x5ad9fa[_0x3ea870];},this);}return _0x4152c7;};VoiceQueueSummary[_0xa044('0x46')]['compareToOutboundQueue']=function(_0x55f25d){var _0x4e50d5=![];var _0x26e66a=![];var _0x698e27=![];if(_0x55f25d){_0x4e50d5=this['dialMethod']!==_0x55f25d[_0xa044('0x24')]||this[_0xa044('0x23')]!==_0x55f25d['dialActive']||this['message']!==_0x55f25d[_0xa044('0x55')]||this[_0xa044('0x42')]!==_0x55f25d[_0xa044('0x42')];_0x26e66a=OUTBOUND_COUNTERS[_0xa044('0x54')](function(_0x4c91d0){return this[_0x4c91d0]!==_0x55f25d[_0x4c91d0];},this);if(this[_0xa044('0x43')]&&_0x55f25d[_0xa044('0x43')]){_0x698e27=this[_0xa044('0x43')][_0xa044('0x44')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x44')]||this[_0xa044('0x43')][_0xa044('0x45')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x45')];}}return _0x4e50d5||_0x26e66a||_0x698e27;};VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x56')]=function(_0x2b6fa4){this[_0xa044('0x7')]=_0x2b6fa4[_0xa044('0x7')];this['message']=_0x2b6fa4[_0xa044('0x55')];this[_0xa044('0x42')]=_0x2b6fa4[_0xa044('0x42')];this[_0xa044('0x9')]=_0x2b6fa4[_0xa044('0x9')];this[_0xa044('0xa')]=_0x2b6fa4['outboundAbandonedCallsDay'];this[_0xa044('0xb')]=_0x2b6fa4[_0xa044('0xb')];this[_0xa044('0x2a')]=_0x2b6fa4[_0xa044('0x2a')];this[_0xa044('0xc')]=_0x2b6fa4['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x2b6fa4['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x2b6fa4[_0xa044('0xe')];this[_0xa044('0xf')]=_0x2b6fa4['outboundNoSuchCallsDay'];this[_0xa044('0x2f')]=_0x2b6fa4[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x2b6fa4[_0xa044('0x10')];this['outboundUnknownCallsDay']=_0x2b6fa4['outboundUnknownCallsDay'];this[_0xa044('0x12')]=_0x2b6fa4['sumBillable'];this['sumDuration']=_0x2b6fa4[_0xa044('0x13')];this[_0xa044('0x14')]=_0x2b6fa4[_0xa044('0x14')];if(this['dialMethod']===_0xa044('0x57')){this[_0xa044('0x22')]=_0x2b6fa4[_0xa044('0x22')];}};module[_0xa044('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x9a22=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','callers','SIP/','incall','includes','status','booked','keys','length','queue','dialer','exten','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor'];(function(_0x437db1,_0x284aa2){var _0x106945=function(_0x51b942){while(--_0x51b942){_0x437db1['push'](_0x437db1['shift']());}};_0x106945(++_0x284aa2);}(_0x9a22,0x75));var _0x29a2=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x9a22[_0x38a7ac];return _0x53061a;};'use strict';var INBOUND_COUNTERS=[_0x29a2('0x0'),_0x29a2('0x1'),_0x29a2('0x2'),_0x29a2('0x3'),_0x29a2('0x4'),_0x29a2('0x5'),_0x29a2('0x6')];var OUTBOUND_COUNTERS=['available','answered',_0x29a2('0x7'),_0x29a2('0x1'),_0x29a2('0x2'),_0x29a2('0x8'),_0x29a2('0x9'),_0x29a2('0xa'),_0x29a2('0xb'),_0x29a2('0xc'),'outboundCongestionCallsDay',_0x29a2('0xd'),_0x29a2('0xe'),'outboundReCallsDay',_0x29a2('0xf'),_0x29a2('0x10'),'paused',_0x29a2('0x11'),_0x29a2('0x5'),'sumBillable',_0x29a2('0x12'),_0x29a2('0x13'),_0x29a2('0x6')];function VoiceQueueSummary(_0x1cd604){this['id']=_0x1cd604['id'];this[_0x29a2('0x14')]=_0x1cd604[_0x29a2('0x14')];this['strategy']=_0x1cd604[_0x29a2('0x15')];this[_0x29a2('0x16')]=_0x1cd604[_0x29a2('0x16')]||0x0;this[_0x29a2('0x17')]=_0x1cd604[_0x29a2('0x17')]||0x0;this[_0x29a2('0x0')]=_0x1cd604[_0x29a2('0x0')]||0x0;this['busy']=_0x1cd604[_0x29a2('0x18')]||0x0;this[_0x29a2('0x7')]=_0x1cd604[_0x29a2('0x7')]||0x0;this[_0x29a2('0x19')]=_0x1cd604['invalid']||0x0;this['loggedIn']=_0x1cd604[_0x29a2('0x1')]||0x0;this[_0x29a2('0x2')]=_0x1cd604[_0x29a2('0x2')]||0x0;this[_0x29a2('0x1a')]=_0x1cd604[_0x29a2('0x1a')]||0x0;this['notInUse']=_0x1cd604[_0x29a2('0x1b')]||0x0;this[_0x29a2('0x3')]=_0x1cd604['paused']||0x0;this[_0x29a2('0x4')]=_0x1cd604['ringing']||0x0;this[_0x29a2('0x1c')]=_0x1cd604[_0x29a2('0x1c')];this[_0x29a2('0x1d')]=_0x1cd604[_0x29a2('0x1d')];this['sumDuration']=_0x1cd604['sumDuration'];this['sumHoldTime']=_0x1cd604[_0x29a2('0x1e')]||0x0;this[_0x29a2('0x5')]=_0x1cd604[_0x29a2('0x5')]||0x0;this[_0x29a2('0x13')]=_0x1cd604[_0x29a2('0x13')]||0x0;this[_0x29a2('0x1f')]=_0x1cd604[_0x29a2('0x1f')];this['unavailable']=_0x1cd604[_0x29a2('0x20')]||0x0;this[_0x29a2('0x21')]=_0x1cd604[_0x29a2('0x21')]||0x0;this[_0x29a2('0x22')]=_0x1cd604[_0x29a2('0x22')]||0x0;this[_0x29a2('0x6')]=_0x1cd604[_0x29a2('0x6')]||0x0;if(_0x1cd604[_0x29a2('0x1f')]==='outbound'){this['pTalking']=_0x1cd604[_0x29a2('0x11')]||0x0;this[_0x29a2('0x23')]=_0x1cd604[_0x29a2('0x23')];this[_0x29a2('0x24')]=_0x1cd604[_0x29a2('0x24')];this[_0x29a2('0x25')]=_0x1cd604[_0x29a2('0x25')];this[_0x29a2('0x26')]=_0x1cd604[_0x29a2('0x26')];this[_0x29a2('0x27')]=_0x1cd604[_0x29a2('0x27')];this[_0x29a2('0x28')]=_0x1cd604[_0x29a2('0x28')];this['temp']=_0x1cd604[_0x29a2('0x29')];this[_0x29a2('0x2a')]=_0x1cd604[_0x29a2('0x2a')];this[_0x29a2('0xa')]=_0x1cd604['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x1cd604[_0x29a2('0xb')];this[_0x29a2('0xc')]=_0x1cd604['outboundBusyCallsDay'];this[_0x29a2('0x2b')]=_0x1cd604['outboundCongestionCallsDay'];this[_0x29a2('0x2c')]=_0x1cd604['outboundDropCallsDayACS'];this[_0x29a2('0x2d')]=_0x1cd604['outboundDropCallsDayCallersExit'];this[_0x29a2('0x2e')]=_0x1cd604[_0x29a2('0x2e')];this[_0x29a2('0xd')]=_0x1cd604['outboundNoAnswerCallsDay'];this[_0x29a2('0xe')]=_0x1cd604[_0x29a2('0xe')];this[_0x29a2('0x2f')]=_0x1cd604['outboundOriginateFailureCallsDay'];this[_0x29a2('0x30')]=_0x1cd604[_0x29a2('0x30')];this[_0x29a2('0xf')]=_0x1cd604['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x1cd604['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x1cd604[_0x29a2('0x31')];this[_0x29a2('0x32')]=_0x1cd604[_0x29a2('0x32')];this[_0x29a2('0x33')]=_0x1cd604[_0x29a2('0x33')];this[_0x29a2('0x34')]=_0x1cd604[_0x29a2('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x1cd604[_0x29a2('0x35')];this[_0x29a2('0x36')]=_0x1cd604['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x1cd604['predictiveIntervalErlangCallsDroppedCalls'];this[_0x29a2('0x37')]=_0x1cd604[_0x29a2('0x37')];this[_0x29a2('0x38')]=_0x1cd604['predictiveIntervalMultiplicativeFactor'];this[_0x29a2('0x39')]=_0x1cd604[_0x29a2('0x39')];this[_0x29a2('0x3a')]=_0x1cd604['predictiveIntervalAvailable'];this[_0x29a2('0x3b')]=_0x1cd604[_0x29a2('0x3b')];this['originated']=_0x1cd604[_0x29a2('0x8')];this['erlangCalls']=_0x1cd604[_0x29a2('0x3c')];this[_0x29a2('0x3d')]=_0x1cd604[_0x29a2('0x3d')];this[_0x29a2('0x3e')]=_0x1cd604[_0x29a2('0x3e')];this[_0x29a2('0x3f')]=_0x1cd604[_0x29a2('0x3f')];this[_0x29a2('0x40')]=_0x1cd604['startPredictive'];this[_0x29a2('0x41')]=_0x1cd604[_0x29a2('0x41')];this['message']=_0x1cd604[_0x29a2('0x42')];this[_0x29a2('0x43')]=_0x1cd604[_0x29a2('0x43')];}if(_0x1cd604['Trunk']){this[_0x29a2('0x44')]={'id':_0x1cd604[_0x29a2('0x44')]['id'],'name':_0x1cd604[_0x29a2('0x44')]['name'],'active':_0x1cd604['Trunk'][_0x29a2('0x45')],'callerid':_0x1cd604[_0x29a2('0x44')][_0x29a2('0x46')]};}}VoiceQueueSummary[_0x29a2('0x47')][_0x29a2('0x48')]=function(_0x1f5e32,_0x329b50,_0x4d38df,_0x51382e){this[_0x29a2('0x2')]=0x0;this[_0x29a2('0x5')]=0x0;this[_0x29a2('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x29a2('0x7')]=0x0;this[_0x29a2('0x18')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x29a2('0x1c')]=0x0;this[_0x29a2('0x1a')]=0x0;if(_0x4d38df){if(_0x4d38df[_0x29a2('0x0')]){this['available']=Number(_0x4d38df[_0x29a2('0x0')]);}if(_0x4d38df['loggedin']){this[_0x29a2('0x1')]=Number(_0x4d38df['loggedin']);}if(_0x4d38df[_0x29a2('0x49')]){this[_0x29a2('0x6')]=Number(_0x4d38df[_0x29a2('0x49')]);}}for(var _0x4d6976=0x0;_0x4d6976<_0x1f5e32['length'];_0x4d6976++){var _0x652255=_0x329b50[_0x29a2('0x4a')+_0x1f5e32[_0x4d6976][_0x29a2('0x14')]];if(_0x652255&&_0x652255['online']){this[_0x29a2('0x2')]+=0x1;}if(_0x1f5e32[_0x4d6976][_0x29a2('0x4b')]==='1'){this[_0x29a2('0x5')]+=0x1;}if(_0x1f5e32[_0x4d6976][_0x29a2('0x3')]==='1'&&!['2','7','8'][_0x29a2('0x4c')](_0x1f5e32[_0x4d6976][_0x29a2('0x4d')])){this[_0x29a2('0x3')]+=0x1;}switch(_0x1f5e32[_0x4d6976][_0x29a2('0x4d')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x29a2('0x7')]+=0x1;break;case'3':this[_0x29a2('0x18')]+=0x1;break;case'4':this[_0x29a2('0x19')]+=0x1;break;case'5':this[_0x29a2('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x29a2('0x1a')]+=0x1;break;}}if(this[_0x29a2('0x24')]===_0x29a2('0x4e')){var _0x1563a0=Object[_0x29a2('0x4f')](_0x51382e);for(var _0x3e40cc=0x0;_0x3e40cc<_0x1563a0[_0x29a2('0x50')];_0x3e40cc++){var _0x421d70=_0x1563a0[_0x3e40cc];var _0x3da968=_0x51382e[_0x421d70];if(_0x3da968[_0x29a2('0x51')]===this[_0x29a2('0x14')]&&_0x3da968['type']===_0x29a2('0x52')&&_0x3da968[_0x29a2('0x53')]==='xcally-motion-preview'){this[_0x29a2('0x5')]+=0x1;}}if(this['talking']>this['inUse']){this['talking']=this[_0x29a2('0x7')];}this[_0x29a2('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x29a2('0x47')]['compareToInboundQueue']=function(_0x151ad5){var _0x4c1807=![];if(_0x151ad5){_0x4c1807=INBOUND_COUNTERS['some'](function(_0x22dbce){return this[_0x22dbce]!==_0x151ad5[_0x22dbce];},this);}return _0x4c1807;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x10610a){var _0x21dd26=![];var _0x19072d=![];var _0xd33bbb=![];if(_0x10610a){_0x21dd26=this[_0x29a2('0x24')]!==_0x10610a['dialMethod']||this[_0x29a2('0x23')]!==_0x10610a[_0x29a2('0x23')]||this['message']!==_0x10610a[_0x29a2('0x42')]||this[_0x29a2('0x43')]!==_0x10610a[_0x29a2('0x43')];_0x19072d=OUTBOUND_COUNTERS['some'](function(_0x1a1ffa){return this[_0x1a1ffa]!==_0x10610a[_0x1a1ffa];},this);if(this['Trunk']&&_0x10610a[_0x29a2('0x44')]){_0xd33bbb=this[_0x29a2('0x44')]['name']!==_0x10610a[_0x29a2('0x44')][_0x29a2('0x14')]||this[_0x29a2('0x44')]['active']!==_0x10610a[_0x29a2('0x44')][_0x29a2('0x45')];}}return _0x21dd26||_0x19072d||_0xd33bbb;};VoiceQueueSummary['prototype'][_0x29a2('0x54')]=function(_0x774fc5){this[_0x29a2('0x17')]=_0x774fc5[_0x29a2('0x17')];this[_0x29a2('0x42')]=_0x774fc5[_0x29a2('0x42')];this[_0x29a2('0x43')]=_0x774fc5['statusMessage'];this[_0x29a2('0x8')]=_0x774fc5[_0x29a2('0x8')];this['outboundAbandonedCallsDay']=_0x774fc5[_0x29a2('0x9')];this['outboundAnswerCallsDay']=_0x774fc5[_0x29a2('0xa')];this[_0x29a2('0xb')]=_0x774fc5['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x774fc5['outboundBusyCallsDay'];this[_0x29a2('0x2b')]=_0x774fc5[_0x29a2('0x2b')];this[_0x29a2('0xd')]=_0x774fc5[_0x29a2('0xd')];this['outboundNoSuchCallsDay']=_0x774fc5['outboundNoSuchCallsDay'];this[_0x29a2('0x30')]=_0x774fc5[_0x29a2('0x30')];this[_0x29a2('0xf')]=_0x774fc5['outboundRejectCallsDay'];this[_0x29a2('0x10')]=_0x774fc5[_0x29a2('0x10')];this[_0x29a2('0x1d')]=_0x774fc5[_0x29a2('0x1d')];this[_0x29a2('0x12')]=_0x774fc5['sumDuration'];this[_0x29a2('0x13')]=_0x774fc5[_0x29a2('0x13')];if(this[_0x29a2('0x24')]===_0x29a2('0x55')){this[_0x29a2('0x11')]=_0x774fc5[_0x29a2('0x11')];}};module[_0x29a2('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a55e0de..62de678 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 _0xb9ae=['exports','name','username','accessKey','remoteUri','Configurations'];(function(_0x5d77fd,_0x923869){var _0xf60f8a=function(_0x349896){while(--_0x349896){_0x5d77fd['push'](_0x5d77fd['shift']());}};_0xf60f8a(++_0x923869);}(_0xb9ae,0xaf));var _0xeb9a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb9ae[_0x40a045];return _0x1a687c;};'use strict';function VtigerAccount(_0x39a7c7){this['id']=_0x39a7c7['id']||0x0;this[_0xeb9a('0x0')]=_0x39a7c7['name']||'';this['username']=_0x39a7c7[_0xeb9a('0x1')]||'';this[_0xeb9a('0x2')]=_0x39a7c7[_0xeb9a('0x2')]||'';this['remoteUri']=_0x39a7c7[_0xeb9a('0x3')]||'';this['serverUrl']=_0x39a7c7['serverUrl']||'';this[_0xeb9a('0x4')]=_0x39a7c7[_0xeb9a('0x4')]||{};}module[_0xeb9a('0x5')]=VtigerAccount; \ No newline at end of file +var _0xa14b=['Configurations','exports','name','accessKey','remoteUri','serverUrl'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa14b,0x68));var _0xba14=function(_0x209c44,_0x12eb9b){_0x209c44=_0x209c44-0x0;var _0x1bfb1d=_0xa14b[_0x209c44];return _0x1bfb1d;};'use strict';function VtigerAccount(_0x2b21a0){this['id']=_0x2b21a0['id']||0x0;this[_0xba14('0x0')]=_0x2b21a0[_0xba14('0x0')]||'';this['username']=_0x2b21a0['username']||'';this[_0xba14('0x1')]=_0x2b21a0['accessKey']||'';this[_0xba14('0x2')]=_0x2b21a0['remoteUri']||'';this[_0xba14('0x3')]=_0x2b21a0[_0xba14('0x3')]||'';this[_0xba14('0x4')]=_0x2b21a0[_0xba14('0x4')]||{};}module[_0xba14('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 25d75e3..fff85f7 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 _0xbe89=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xbe89,0x12a));var _0x9be8=function(_0x42f0b6,_0x47dcfd){_0x42f0b6=_0x42f0b6-0x0;var _0x4ee770=_0xbe89[_0x42f0b6];return _0x4ee770;};'use strict';function ZendeskAccount(_0x5f0c9e){this['id']=_0x5f0c9e['id']||0x0;this[_0x9be8('0x0')]=_0x5f0c9e[_0x9be8('0x0')]||'';this[_0x9be8('0x1')]=_0x5f0c9e[_0x9be8('0x1')]||'';this[_0x9be8('0x2')]=_0x5f0c9e[_0x9be8('0x2')]||'';this[_0x9be8('0x3')]=_0x5f0c9e[_0x9be8('0x3')]||'';this[_0x9be8('0x4')]=_0x5f0c9e['remoteUri']||'';this[_0x9be8('0x5')]=_0x5f0c9e[_0x9be8('0x5')]||'';this[_0x9be8('0x6')]=_0x5f0c9e['type']||_0x9be8('0x7');this[_0x9be8('0x8')]=_0x5f0c9e[_0x9be8('0x8')]||'';this[_0x9be8('0x9')]=_0x5f0c9e[_0x9be8('0x9')]||{};}module[_0x9be8('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x48bb=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x48bb,0xed));var _0xb48b=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x48bb[_0x243217];return _0x478029;};'use strict';function ZendeskAccount(_0x2b60a2){this['id']=_0x2b60a2['id']||0x0;this[_0xb48b('0x0')]=_0x2b60a2['name']||'';this[_0xb48b('0x1')]=_0x2b60a2['username']||'';this[_0xb48b('0x2')]=_0x2b60a2['password']||'';this[_0xb48b('0x3')]=_0x2b60a2[_0xb48b('0x3')]||'';this[_0xb48b('0x4')]=_0x2b60a2[_0xb48b('0x4')]||'';this[_0xb48b('0x5')]=_0x2b60a2[_0xb48b('0x5')]||'';this[_0xb48b('0x6')]=_0x2b60a2[_0xb48b('0x6')]||_0xb48b('0x7');this[_0xb48b('0x8')]=_0x2b60a2[_0xb48b('0x8')]||'';this[_0xb48b('0x9')]=_0x2b60a2[_0xb48b('0x9')]||{};}module[_0xb48b('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 803519c..b65e5c5 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 _0x32fe=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x32fe,0x154));var _0xe32f=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x32fe[_0x285c85];return _0x2f81cd;};'use strict';function ZohoAccount(_0x326fef){this['id']=_0x326fef['id']||0x0;this[_0xe32f('0x0')]=_0x326fef['name']||'';this[_0xe32f('0x1')]=_0x326fef[_0xe32f('0x1')]||'';this[_0xe32f('0x2')]=_0x326fef[_0xe32f('0x2')]||'';this[_0xe32f('0x3')]=_0x326fef[_0xe32f('0x3')]||'';this['clientId']=_0x326fef[_0xe32f('0x4')]||'';this[_0xe32f('0x5')]=_0x326fef[_0xe32f('0x5')]||'';this[_0xe32f('0x6')]=_0x326fef[_0xe32f('0x6')]||'';this[_0xe32f('0x7')]=_0x326fef[_0xe32f('0x7')]||'';this[_0xe32f('0x8')]=_0x326fef['refreshToken']||'';this['Configurations']=_0x326fef[_0xe32f('0x9')]||{};}module[_0xe32f('0xa')]=ZohoAccount; \ No newline at end of file +var _0x12b2=['name','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports'];(function(_0x28e71a,_0x4405bd){var _0x268fed=function(_0x404197){while(--_0x404197){_0x28e71a['push'](_0x28e71a['shift']());}};_0x268fed(++_0x4405bd);}(_0x12b2,0x1d6));var _0x212b=function(_0x48ea27,_0x2b1d54){_0x48ea27=_0x48ea27-0x0;var _0xc63a78=_0x12b2[_0x48ea27];return _0xc63a78;};'use strict';function ZohoAccount(_0x39fb27){this['id']=_0x39fb27['id']||0x0;this['name']=_0x39fb27[_0x212b('0x0')]||'';this[_0x212b('0x1')]=_0x39fb27[_0x212b('0x1')]||'';this[_0x212b('0x2')]=_0x39fb27['host']||'';this[_0x212b('0x3')]=_0x39fb27[_0x212b('0x3')]||'';this['clientId']=_0x39fb27[_0x212b('0x4')]||'';this[_0x212b('0x5')]=_0x39fb27['clientSecret']||'';this[_0x212b('0x6')]=_0x39fb27[_0x212b('0x6')]||'';this[_0x212b('0x7')]=_0x39fb27[_0x212b('0x7')]||'';this['refreshToken']=_0x39fb27['refreshToken']||'';this[_0x212b('0x8')]=_0x39fb27[_0x212b('0x8')]||{};}module[_0x212b('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 a1f6f32..5fd2c10 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 _0xd943=['countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xd943,0x15d));var _0x3d94=function(_0x403fff,_0xecb737){_0x403fff=_0x403fff-0x0;var _0xe048c2=_0xd943[_0x403fff];return _0xe048c2;};'use strict';var util=require(_0x3d94('0x0'));var _=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));function checkNameSurname(_0x440dd8,_0x5495df,_0x691e28){var _0x3edd1b='';if(!_[_0x3d94('0x3')](_0x5495df)&&_0x3d94('0x4')===typeof _0x5495df){_0x3edd1b+=_0x5495df;}if(!_[_0x3d94('0x3')](_0x691e28)&&'string'===typeof _0x691e28){_0x3edd1b+='\x20'+_0x691e28;}if(_0x3edd1b!==''){return _0x3edd1b;}return _0x440dd8;}function Action(_0x54e692,_0x34c9c3,_0x51cf1f,_0x54e81f,_0x4d29e7){this[_0x3d94('0x5')]=_0x51cf1f||undefined;this[_0x3d94('0x6')]=_0x54e692['id'];this['queue']=_0x34c9c3['name'];this[_0x3d94('0x7')]=_0x34c9c3[_0x3d94('0x7')];this[_0x3d94('0x8')]='queue';this[_0x3d94('0x9')]=![];this['membername']=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?undefined:_0x54e692['Agent'][_0x3d94('0xb')];this[_0x3d94('0xc')]=this[_0x3d94('0xd')]?util[_0x3d94('0xe')](_0x3d94('0xf'),this['membername']):_0x54e81f||undefined;this[_0x3d94('0x10')]=checkNameSurname(_0x54e692[_0x3d94('0x11')][_0x3d94('0x12')],_0x54e692['Contact'][_0x3d94('0x13')],_0x54e692[_0x3d94('0x11')][_0x3d94('0x14')]);this['active']=_0x54e692[_0x3d94('0x15')]||![];this[_0x3d94('0x16')]=_0x54e692[_0x3d94('0x12')];this[_0x3d94('0x17')]=_0x54e692[_0x3d94('0x17')];this[_0x3d94('0x18')]=_0x54e692[_0x3d94('0x18')]||0x0;this[_0x3d94('0x19')]=_0x54e692['countcongestionretry']||0x0;this[_0x3d94('0x1a')]=_0x54e692[_0x3d94('0x1a')]||0x0;this[_0x3d94('0x1b')]=(_0x54e692[_0x3d94('0x18')]||0x0)+(_0x54e692[_0x3d94('0x19')]||0x0)+(_0x54e692[_0x3d94('0x1a')]||0x0)+(_0x54e692[_0x3d94('0x1c')]||0x0)+(_0x54e692['countdropretry']||0x0)+(_0x54e692[_0x3d94('0x1d')]||0x0)+(_0x54e692['countmachineretry']||0x0)+(_0x54e692[_0x3d94('0x1e')]||0x0);this[_0x3d94('0x1c')]=_0x54e692[_0x3d94('0x1c')]||0x0;this[_0x3d94('0x1f')]=_0x54e692[_0x3d94('0x1f')]||0x0;this['countabandonedretry']=_0x54e692['countabandonedretry']||0x0;this[_0x3d94('0x20')]=_0x54e692[_0x3d94('0x20')]||0x0;this[_0x3d94('0x1e')]=_0x54e692['countagentrejectretry']||0x0;this[_0x3d94('0x21')]=_0x54e692[_0x3d94('0x21')];this[_0x3d94('0x22')]=_0x54e692[_0x3d94('0x22')];this[_0x3d94('0x23')]=_0x54e692[_0x3d94('0x23')];this[_0x3d94('0x24')]=_0x54e692[_0x3d94('0x24')];this[_0x3d94('0x25')]=_0x54e692[_0x3d94('0x25')];this[_0x3d94('0x26')]=_0x54e692[_0x3d94('0x26')];this[_0x3d94('0x27')]=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?_0x54e692['UserId']:_0x54e692[_0x3d94('0xa')]['id'];this['VoiceQueueId']=_0x54e692[_0x3d94('0x28')];this[_0x3d94('0x29')]='';this[_0x3d94('0x2a')]='';}Action[_0x3d94('0x2b')][_0x3d94('0x2c')]=function(){return util[_0x3d94('0xe')](_0x3d94('0x2d'),this['calleridname'],this['number']);};module[_0x3d94('0x2e')]=Action; \ No newline at end of file +var _0x57ca=['name','type','campaigntype','dialAnswer','Agent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x324786,_0x47a15a){var _0x172caa=function(_0x43290d){while(--_0x43290d){_0x324786['push'](_0x324786['shift']());}};_0x172caa(++_0x47a15a);}(_0x57ca,0x108));var _0xa57c=function(_0x21bdb9,_0x22ad79){_0x21bdb9=_0x21bdb9-0x0;var _0x49d8d8=_0x57ca[_0x21bdb9];return _0x49d8d8;};'use strict';var util=require('util');var _=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));function checkNameSurname(_0x4b1712,_0x3a7394,_0x396613){var _0x1d38e7='';if(!_[_0xa57c('0x2')](_0x3a7394)&&_0xa57c('0x3')===typeof _0x3a7394){_0x1d38e7+=_0x3a7394;}if(!_['isNil'](_0x396613)&&_0xa57c('0x3')===typeof _0x396613){_0x1d38e7+='\x20'+_0x396613;}if(_0x1d38e7!==''){return _0x1d38e7;}return _0x4b1712;}function Action(_0x1c3e31,_0x113dcf,_0x19473f,_0xbdfffb,_0x314574){this[_0xa57c('0x4')]=_0x19473f||undefined;this[_0xa57c('0x5')]=_0x1c3e31['id'];this['queue']=_0x113dcf[_0xa57c('0x6')];this['type']=_0x113dcf[_0xa57c('0x7')];this[_0xa57c('0x8')]='queue';this[_0xa57c('0x9')]=![];this['membername']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?undefined:_0x1c3e31['Agent'][_0xa57c('0x6')];this['channelAgent']=this[_0xa57c('0xb')]?util[_0xa57c('0xc')](_0xa57c('0xd'),this[_0xa57c('0xb')]):_0xbdfffb||undefined;this[_0xa57c('0xe')]=checkNameSurname(_0x1c3e31['Contact'][_0xa57c('0xf')],_0x1c3e31['Contact'][_0xa57c('0x10')],_0x1c3e31[_0xa57c('0x11')][_0xa57c('0x12')]);this[_0xa57c('0x13')]=_0x1c3e31[_0xa57c('0x13')]||![];this[_0xa57c('0x14')]=_0x1c3e31[_0xa57c('0xf')];this['scheduledat']=_0x1c3e31[_0xa57c('0x15')];this[_0xa57c('0x16')]=_0x1c3e31[_0xa57c('0x16')]||0x0;this['countcongestionretry']=_0x1c3e31[_0xa57c('0x17')]||0x0;this['countnoanswerretry']=_0x1c3e31[_0xa57c('0x18')]||0x0;this[_0xa57c('0x19')]=(_0x1c3e31[_0xa57c('0x16')]||0x0)+(_0x1c3e31[_0xa57c('0x17')]||0x0)+(_0x1c3e31[_0xa57c('0x18')]||0x0)+(_0x1c3e31[_0xa57c('0x1a')]||0x0)+(_0x1c3e31[_0xa57c('0x1b')]||0x0)+(_0x1c3e31[_0xa57c('0x1c')]||0x0)+(_0x1c3e31['countmachineretry']||0x0)+(_0x1c3e31[_0xa57c('0x1d')]||0x0);this['countnosuchnumberretry']=_0x1c3e31['countnosuchnumberretry']||0x0;this[_0xa57c('0x1b')]=_0x1c3e31[_0xa57c('0x1b')]||0x0;this[_0xa57c('0x1c')]=_0x1c3e31[_0xa57c('0x1c')]||0x0;this['countmachineretry']=_0x1c3e31[_0xa57c('0x1e')]||0x0;this[_0xa57c('0x1d')]=_0x1c3e31[_0xa57c('0x1d')]||0x0;this[_0xa57c('0x1f')]=_0x1c3e31[_0xa57c('0x1f')];this[_0xa57c('0x20')]=_0x1c3e31[_0xa57c('0x20')];this[_0xa57c('0x21')]=_0x1c3e31[_0xa57c('0x21')];this[_0xa57c('0x22')]=_0x1c3e31[_0xa57c('0x22')];this[_0xa57c('0x23')]=_0x1c3e31[_0xa57c('0x23')];this[_0xa57c('0x24')]=_0x1c3e31[_0xa57c('0x24')];this['UserId']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?_0x1c3e31[_0xa57c('0x25')]:_0x1c3e31[_0xa57c('0xa')]['id'];this[_0xa57c('0x26')]=_0x1c3e31[_0xa57c('0x26')];this[_0xa57c('0x27')]='';this[_0xa57c('0x28')]='';}Action[_0xa57c('0x29')][_0xa57c('0x2a')]=function(){return util['format'](_0xa57c('0x2b'),this['calleridname'],this['number']);};module[_0xa57c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ab49b02..6061408 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 _0x07d7=['CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','\x20Queue','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','phone','substring','dialCutDigit','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','variablesAction','Action','OriginateError','lookAgent','logLookAgent','clone','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','ListId','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','unlockAgent','countbusyretry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]'];(function(_0x5eb1a8,_0x2188da){var _0x3abfaf=function(_0x3b22d9){while(--_0x3b22d9){_0x5eb1a8['push'](_0x5eb1a8['shift']());}};_0x3abfaf(++_0x2188da);}(_0x07d7,0x85));var _0x707d=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x07d7[_0x54f7c0];return _0x245d03;};'use strict';var util=require(_0x707d('0x0'));var _=require(_0x707d('0x1'));var uuid=require(_0x707d('0x2'));var moment=require(_0x707d('0x3'));var Redis=require(_0x707d('0x4'));var config=require(_0x707d('0x5'));var logger=require(_0x707d('0x6'))(_0x707d('0x7'));var loggerAction=require(_0x707d('0x6'))(_0x707d('0x8'));var ami=require(_0x707d('0x9'));var rpcDb=require(_0x707d('0xa'));var cmHopperAdditionalPhone=require(_0x707d('0xb'));var Action=require(_0x707d('0xc'));var ut=require(_0x707d('0xd'));var utils=require(_0x707d('0xe'));config['redis']=_['defaults'](config[_0x707d('0xf')],{'host':_0x707d('0x10'),'port':0x18eb});var io=require(_0x707d('0x11'))(new Redis(config[_0x707d('0xf')]));var Sequence=function(){};Sequence[_0x707d('0x12')]['enqueue']=function(_0x3f45f5){this[_0x707d('0x13')]=this[_0x707d('0x13')]?this['tail'][_0x707d('0x14')](_0x3f45f5):_0x3f45f5();};function Preview(_0x355ce4){this[_0x707d('0x15')]=new Sequence();this['campaignsPreview']=_0x355ce4['voiceQueues'];this['trunks']=_0x355ce4[_0x707d('0x16')];this[_0x707d('0x17')]={};this[_0x707d('0x18')]=_0x355ce4['agents'];this[_0x707d('0x19')]=0x0;ami['on']('originateresponse',this[_0x707d('0x1a')][_0x707d('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x707d('0x1b')](this));ami['on']('hanguprequest',this[_0x707d('0x1c')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x1d'),this[_0x707d('0x1e')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x1f'),this[_0x707d('0x20')]['bind'](this));ami['on'](_0x707d('0x21'),this[_0x707d('0x22')][_0x707d('0x1b')](this));ami['on']('attendedtransfer',this[_0x707d('0x23')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x24'),this[_0x707d('0x25')][_0x707d('0x1b')](this));this[_0x707d('0x26')](this[_0x707d('0x27')]);}function emit(_0x446629,_0x33a726,_0x10d192){io['to'](_0x446629)[_0x707d('0x28')](_0x33a726,_0x10d192);}function emitVoiceQueueChannelRemove(_0x366ef7){logger[_0x707d('0x29')](_0x707d('0x2a'),JSON[_0x707d('0x2b')](_0x366ef7));emit(util[_0x707d('0x2c')](_0x707d('0x2d'),_0x366ef7['name']),_0x707d('0x2e'),_0x366ef7);io['emit'](_0x707d('0x2f'),_0x366ef7);}function notSendMessagesQueue(_0x139ad5){if(_0x139ad5[_0x707d('0x30')]){if(_0x139ad5[_0x707d('0x31')]===0x0&&_0x139ad5[_0x707d('0x32')]===0x0){_0x139ad5['sendMessageOneNotActive']=![];_0x139ad5[_0x707d('0x33')]=0x0;_0x139ad5[_0x707d('0x34')]=0x0;_0x139ad5[_0x707d('0x35')]=utils[_0x707d('0x36')][_0x707d('0x37')];ut[_0x707d('0x38')](_0x707d('0x39'),_0x139ad5[_0x707d('0x3a')]+_0x707d('0x3b'));}else{_0x139ad5[_0x707d('0x35')]=utils[_0x707d('0x36')][_0x707d('0x3c')];ut[_0x707d('0x38')](_0x707d('0x39'),_0x139ad5[_0x707d('0x3a')]+_0x707d('0x3d'));}}}Preview[_0x707d('0x12')][_0x707d('0x26')]=function(){var _0x599ba6=this;setInterval(function(){_0x599ba6[_0x707d('0x3e')]();},0x7cf);};Preview[_0x707d('0x12')][_0x707d('0x3e')]=function(){var _0x4a3d8e=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x18c7e4 in _0x4a3d8e){if(_0x4a3d8e[_0x707d('0x3f')](_0x18c7e4)&&(_0x4a3d8e[_0x18c7e4][_0x707d('0x40')]===_0x707d('0x7')||_0x4a3d8e[_0x18c7e4][_0x707d('0x40')]===_0x707d('0x41'))&&_0x4a3d8e[_0x18c7e4][_0x707d('0x42')]===_0x707d('0x43')){if(this[_0x707d('0x19')]>0x7){this[_0x707d('0x19')]=0x0;this[_0x707d('0x44')]();}}if(_0x4a3d8e[_0x707d('0x3f')](_0x18c7e4)&&_0x4a3d8e[_0x18c7e4]['dialMethod']===_0x707d('0x7')&&_0x4a3d8e[_0x18c7e4][_0x707d('0x42')]===_0x707d('0x43')){if(_0x4a3d8e[_0x18c7e4][_0x707d('0x45')]){this[_0x707d('0x46')](_0x4a3d8e[_0x18c7e4]);if(_0x4a3d8e[_0x18c7e4]['dialPreviewAutoRecallMe'])this[_0x707d('0x47')](_0x4a3d8e[_0x18c7e4]);}else{notSendMessagesQueue(_0x4a3d8e[_0x18c7e4]);}}}};Preview[_0x707d('0x12')]['clearZombieChannel']=function(_0x325bd9){var _0x260b2=this;this[_0x707d('0x15')][_0x707d('0x48')](function(){if(!_[_0x707d('0x49')](_0x260b2[_0x707d('0x17')][_0x325bd9])){loggerAction[_0x707d('0x29')](_0x707d('0x4a'),_0x325bd9,_0x707d('0x4b'),_0x260b2['actions'][_0x325bd9][_0x707d('0x4c')],_0x707d('0x4d'),JSON[_0x707d('0x2b')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']][_0x707d('0x31')]),_0x707d('0x4e'),JSON[_0x707d('0x2b')](_0x260b2['campaignsPreview'][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']][_0x707d('0x32')]),JSON[_0x707d('0x2b')](_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4f')]),JSON['stringify'](_['pick'](_0x260b2[_0x707d('0x17')][_0x325bd9],[_0x707d('0x50'),'UserId','VoiceQueueId',_0x707d('0x51')])));return ami['Action']({'action':'status','channel':_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x52')]})[_0x707d('0x53')](function(_0x14772e){if(_0x14772e[_0x707d('0x35')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x260b2[_0x707d('0x17')][_0x325bd9]){ut[_0x707d('0x54')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4c')]],_0x707d('0x55'));if(_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4f')]===!![]){ut[_0x707d('0x56')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']],_0x707d('0x55'));ut[_0x707d('0x57')]('[Dialer][checkChannel][pTalking][Preview]'+_0x325bd9,_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4c')]);}ut[_0x707d('0x57')](_0x707d('0x58')+_0x325bd9,_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']);delete _0x260b2[_0x707d('0x17')][_0x325bd9];}},0x2328);}});}});};Preview[_0x707d('0x12')][_0x707d('0x44')]=function(){var _0x5b718=this;loggerAction[_0x707d('0x29')](_0x707d('0x59'),_[_0x707d('0x5a')](this[_0x707d('0x17')]));for(var _0x3de8b3 in this['actions']){if(_0x5b718[_0x707d('0x17')]['hasOwnProperty'](_0x3de8b3)){_0x5b718[_0x707d('0x5b')](_0x3de8b3);}}};Preview[_0x707d('0x12')][_0x707d('0x47')]=function(_0x208fdf){var _0x467397=this;rpcDb[_0x707d('0x5c')](_0x208fdf['id'],ut[_0x707d('0x5d')](this[_0x707d('0x18')]))['then'](function(_0x1cfde2){if(!_[_0x707d('0x49')](_0x1cfde2)){for(var _0x39b291=0x0;_0x39b291<_0x1cfde2[_0x707d('0x5e')];_0x39b291+=0x1){if(ut[_0x707d('0x5f')](_0x1cfde2[_0x39b291][_0x707d('0x60')])<_0x208fdf['dialRecallMeTimeout']*0x3c){if(_0x1cfde2[_0x39b291][_0x707d('0x61')]&&!_0x1cfde2[_0x39b291][_0x707d('0x61')][_0x707d('0x62')]){_0x467397[_0x707d('0x63')](_0x1cfde2[_0x39b291]['id'])[_0x707d('0x64')](ut[_0x707d('0x65')]('[RecallMe]'))['catch'](ut[_0x707d('0x65')](_0x707d('0x66')));}else{rpcDb['disableContact'](_0x1cfde2[_0x39b291]['id']);}}else{var _0x31ac73=new Action(_0x1cfde2[_0x39b291],_0x208fdf);_0x31ac73[_0x707d('0x67')]=moment()[_0x707d('0x2c')](_0x707d('0x68'));_0x208fdf['outboundReCallsDay']+=0x1;ut[_0x707d('0x69')](_0x31ac73,0x17,_0x707d('0x6a'));if(_0x208fdf[_0x707d('0x6b')]){rpcDb['rescheduleContactInQueue'](ut[_0x707d('0x6c')](_0x1cfde2[_0x39b291]));rpcDb[_0x707d('0x6d')](_0x31ac73,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x707d('0x69')](_0x31ac73,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x31ac73,'[HistoryRecallClose]');rpcDb[_0x707d('0x6e')](_0x31ac73,_0x707d('0x6f'));}}}}})[_0x707d('0x53')](ut[_0x707d('0x65')](_0x707d('0x70')));};Preview[_0x707d('0x12')]['setMessage']=function(_0x439281){_0x439281[_0x707d('0x30')]=!![];if(ut['IsNotLoggedIn'](_0x439281['loggedIn'])){_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x71')];}else if(!ut[_0x707d('0x72')](_0x439281['dialActive'])){_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x37')];}else if(!this[_0x707d('0x73')](_0x439281[_0x707d('0x74')])){if(!this[_0x707d('0x73')](_0x439281[_0x707d('0x75')])){_0x439281['message']=utils[_0x707d('0x36')][_0x707d('0x76')];}else{_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x77')];}}else{_0x439281['message']=utils[_0x707d('0x36')][_0x707d('0x77')];}};Preview[_0x707d('0x12')]['callProgressDetectingCustomer']=function(_0x530dd2,_0x36ae56,_0x211c37){var _0x3283f1=this;var _0xb72911=this[_0x707d('0x17')][_0x36ae56];var _0x234b90=this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]];var _0x54940d;var _0x475dbc=![];var _0x145c60=0x2;var _0xc3867b=0x3;if(_0x234b90){switch(_0x211c37){case'1':_0x234b90[_0x707d('0x78')]+=0x1;_0xb72911[_0x707d('0x79')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x0,_0x707d('0x7c'));ami[_0x707d('0x28')](_0x707d('0x7d'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x7f')));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0x80'));_0x3283f1[_0x707d('0x81')](_0xb72911,'0',_0x234b90)['then'](function(_0x1d05d9){_0x475dbc=_0x1d05d9[_0x707d('0x82')]==0x1;_0x145c60=_0x234b90[_0x707d('0x83')];_0xc3867b=_0x234b90[_0x707d('0x84')];if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0x87'));}else{if(_0xb72911[_0x707d('0x79')]>=_0x234b90[_0x707d('0x88')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x707d('0x89')](ut['scheduledAt'](_0xb72911,_0x707d('0x79'),_0x234b90[_0x707d('0x83')]),_0xb72911['unlockAgent'],_0xb72911[_0x707d('0x8a')]);}}delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];}else{_0xb72911[_0x707d('0x79')]++;logger['info'](_0x707d('0x8c'),_0xb72911[_0x707d('0x79')]);logger[_0x707d('0x29')]('id',_0xb72911[_0x707d('0x8d')]);_0x3283f1['incrementPreviewCounters']({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnosuchnumberretry':_0xb72911['countnosuchnumberretry']}})[_0x707d('0x64')](function(){_0x3283f1['swapAdditionalPhones'](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0x8e'):var _0x5aa44c=moment()[_0x707d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0xb72911[_0x707d('0x8f')]=_0x5aa44c;_0xb72911[_0x707d('0x90')]=_0x5aa44c;_0xb72911['dialAnswer']=!![];_0x234b90[_0x707d('0x32')]+=0x1;logger[_0x707d('0x29')]('[syncHangup][talking][increment]',_0xb72911[_0x707d('0x91')],'\x20Queue',_0x234b90[_0x707d('0x3a')],_0x707d('0x4e'),_0x234b90[_0x707d('0x32')]);ami[_0x707d('0x28')](_0x707d('0x92'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x93'),this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]]));if(_0x234b90[_0x707d('0x94')]){ami[_0x707d('0x28')](_0x707d('0x95'),ut[_0x707d('0x96')](_0xb72911));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x707d('0x7e')](_0xb72911,'complete',this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]]));emitVoiceQueueChannelRemove(ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x97')));_0x234b90[_0x707d('0x98')]+=0x1;_0x234b90[_0x707d('0x99')]+=0x1;_0x234b90[_0x707d('0x9a')]+=0x1;ut['decrementTalkink'](_0x234b90,'[16]');_0xb72911['countglobal']=ut[_0x707d('0x7b')](_0xb72911);ut['logCustomer'](_0xb72911,0x4,_0x707d('0x9b'));rpcDb[_0x707d('0x6d')](_0xb72911,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0x9c'));rpcDb[_0x707d('0x9d')](_0xb72911);_0x234b90[_0x707d('0x9e')]+=_0xb72911[_0x707d('0x9f')];_0x234b90[_0x707d('0xa0')]+=_0xb72911[_0x707d('0x9f')];logger[_0x707d('0x29')](_0x707d('0xa1'),_0xb72911[_0x707d('0x91')],'\x20Queue',_0x234b90['name'],_0x707d('0x4e'),_0x234b90[_0x707d('0x32')]);delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;case _0x707d('0xa2'):_0x234b90[_0x707d('0xa3')]+=0x1;_0xb72911['countbusyretry']+=0x1;_0xb72911[_0x707d('0x7a')]=ut['totalGlobal'](_0xb72911);ut['logCustomer'](_0xb72911,0x5,_0x707d('0xa4'));_0x145c60=_0x234b90[_0x707d('0xa5')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];ami[_0x707d('0x28')]('custom:agentbusy',ut['buildObj'](_0xb72911,_0x707d('0xa6')));rpcDb[_0x707d('0x6d')](_0xb72911,'[callProgressDetectingCustomer][logBusy]');_0x3283f1[_0x707d('0x81')](_0xb72911,'5',_0x234b90)[_0x707d('0x64')](function(_0x22eed7){_0x475dbc=_0x22eed7[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xa8'));}else{if(_0xb72911['countbusyretry']>=_0x234b90[_0x707d('0xa9')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,'countbusyretry',_0x234b90[_0x707d('0xa5')]),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911[_0x707d('0xac')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911['idContact'],'field':{'countbusyretry':_0xb72911['countbusyretry']}})['then'](function(){_0x3283f1['swapAdditionalPhones'](_0xb72911,_0x145c60,_0xc3867b)['then'](function(){});});}});break;case _0x707d('0xae'):_0x234b90[_0x707d('0xaf')]+=0x1;_0xb72911[_0x707d('0xb0')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x3,_0x707d('0xb1'));_0x145c60=_0x234b90[_0x707d('0xb2')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];var _0x1cd37d=ut['buildNoAnswerEventPayload'](_0xb72911,_0x234b90);ami[_0x707d('0x28')](_0x707d('0xb3'),_0x1cd37d);rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xb4'));_0x3283f1[_0x707d('0x81')](_0xb72911,'3',_0x234b90)['then'](function(_0x3a4665){_0x475dbc=_0x3a4665['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xb5'));}else{if(_0xb72911[_0x707d('0xb0')]>=_0x234b90[_0x707d('0xb6')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,'countnoanswerretry',_0x234b90[_0x707d('0xb2')]),_0xb72911[_0x707d('0xab')],_0xb72911['activeContact']);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})['then'](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0xb8'):_0x234b90['outboundCongestionCallsDay']+=0x1;_0xb72911[_0x707d('0xb9')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x8,_0x707d('0xba'));_0x145c60=_0x234b90[_0x707d('0xbb')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];ami['emit'](_0x707d('0xbc'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xbd')));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xbe'));_0x3283f1[_0x707d('0x81')](_0xb72911,'8',_0x234b90)[_0x707d('0x64')](function(_0x2a7c12){_0x475dbc=_0x2a7c12['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xbf'));}else{if(_0xb72911['countcongestionretry']>=_0x234b90['dialCongestionMaxRetry']){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xb9'),_0x234b90[_0x707d('0xa5')]),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911['countcongestionretry']++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countcongestionretry':_0xb72911[_0x707d('0xb9')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0xc0'):_0x234b90[_0x707d('0xc1')]+=0x1;_0xb72911[_0x707d('0xc2')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x14,_0x707d('0xc3'));_0x145c60=_0x234b90[_0x707d('0xc4')];_0xc3867b=_0x234b90[_0x707d('0x84')];ami[_0x707d('0x28')](_0x707d('0xc5'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xc6')));rpcDb[_0x707d('0x6d')](_0xb72911,'[syncHangupRequest][logAgentReject]');_0x3283f1[_0x707d('0x81')](_0xb72911,'20',_0x234b90)[_0x707d('0x64')](function(_0x3f4918){_0x475dbc=_0x3f4918[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0x14,_0x707d('0xc3'));rpcDb[_0x707d('0x6e')](_0x54940d,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0xb72911[_0x707d('0xc2')]>=_0x234b90['dialAgentRejectMaxRetry']){rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xc7'));}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xc2'),_0x234b90['dialAgentRejectRetryFrequency']),_0xb72911[_0x707d('0xab')],_0xb72911['activeContact']);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911['countnoanswerretry']}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)['then'](function(){});});}});break;case'ABANDONED':_0x234b90[_0x707d('0xc8')]+=0x1;_0xb72911[_0x707d('0xc9')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0xb,_0x707d('0xca'));rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xcb'));_0x3283f1[_0x707d('0x81')](_0xb72911,'11',_0x234b90)[_0x707d('0x64')](function(_0x9e3646){_0x475dbc=_0x9e3646['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xcb'));}else{if(_0xb72911[_0x707d('0xcc')]>=_0x234b90[_0x707d('0xcd')]){rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xc9'),_0x234b90['dialAbandonedRetryFrequency']),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911['idContact'],'field':{'countnoanswerretry':_0xb72911['countnoanswerretry']}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case'18':_0x234b90['outboundUnknownCallsDay']+=0x1;_0xb72911[_0x707d('0xce')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut['totalGlobal'](_0xb72911);ut['logCustomer'](_0xb72911,0x12,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);ami[_0x707d('0x28')](_0x707d('0xd1'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xd2')));rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xd3'));_0x3283f1[_0x707d('0x81')](_0xb72911,'18',_0x234b90)[_0x707d('0x64')](function(_0x1f6deb){_0x475dbc=_0x1f6deb[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0x12,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xd3'));}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd3'));}}else{_0xb72911['countnoanswerretry']++;_0x3283f1['incrementPreviewCounters']({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;case'19':_0x234b90[_0x707d('0xd4')]+=0x1;_0xb72911['countglobal']=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x13,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);ami[_0x707d('0x28')]('custom:amd',ut[_0x707d('0x7e')](_0xb72911,'amd'));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xd5'));_0x3283f1['verifyAdditionalPhones'](_0xb72911,'18',_0x234b90)['then'](function(_0x384d90){_0x475dbc=_0x384d90['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut['cloneAction'](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xd5'));}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd5'));}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;default:if(_0xb72911[_0x707d('0x4f')]){ut[_0x707d('0x56')](_0x234b90,_0x707d('0xd6'));ut[_0x707d('0x57')](_0x707d('0xd7')+_0x234b90[_0x707d('0x3a')],_0x530dd2);}_0x234b90['outboundUnknownCallsDay']+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut['logCustomer'](_0xb72911,0xc,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);_0x145c60=_0x234b90[_0x707d('0xc4')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xd8'));_0x3283f1[_0x707d('0x81')](_0xb72911,'20',_0x234b90)[_0x707d('0x64')](function(_0xa0f8e2){_0x475dbc=_0xa0f8e2[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd9'));}delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];}else{_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});}});}if(!(_0xb72911[_0x707d('0x4f')]&&_0x211c37==='16')){ut[_0x707d('0x54')](_0x234b90,_0x707d('0xda'));logger[_0x707d('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0xb72911[_0x707d('0x91')],_0x707d('0xdb'),_0x234b90[_0x707d('0x3a')],_0x707d('0x4d'),_0x234b90['originated']);}if(_0x211c37!==_0x707d('0x8e')){delete this['actions'][_0x530dd2[_0x707d('0x8b')]];delete this[_0x707d('0x17')][_0x530dd2['destlinkedid']];}_0x234b90[_0x707d('0xdc')]=!![];}};Preview['prototype'][_0x707d('0xdd')]=function(_0x4ed922,_0x52fe2e,_0x54ad2c){if(_['isUndefined'](_0x52fe2e)&&_0x707d('0xde')!==typeof _0x52fe2e){return;}if(_['isUndefined'](_0x54ad2c)&&_0x707d('0xde')!==typeof _0x54ad2c){return;}switch(_0x54ad2c[_0x707d('0xdf')]){case'0':ut[_0x707d('0xe0')](_0x4ed922,0x0,_0x707d('0x7c'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe2'));break;case'3':ut['logAgent'](_0x4ed922,0x3,_0x707d('0xb1'));rpcDb[_0x707d('0xe1')](_0x4ed922,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x707d('0xe0')](_0x4ed922,0x5,_0x707d('0xa4'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe3'));break;case'8':ut[_0x707d('0xe0')](_0x4ed922,0x8,_0x707d('0xba'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe4'));break;case'22':ut['logAgent'](_0x4ed922,0x16,_0x707d('0xe5'));rpcDb[_0x707d('0xe1')](_0x4ed922,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x4ed922,0xc,_0x54ad2c[_0x707d('0xdf')]);rpcDb['createAgentHistory'](_0x4ed922,_0x707d('0xe4'));}ut[_0x707d('0x54')](_0x52fe2e,'[callProgressDetectingAgent]');logger[_0x707d('0x29')](_0x707d('0xe6'),_0x4ed922[_0x707d('0x91')],_0x707d('0xdb'),_0x52fe2e[_0x707d('0x3a')],_0x707d('0x4d'),_0x52fe2e[_0x707d('0x31')]);delete this[_0x707d('0x17')][_0x4ed922[_0x707d('0x91')]];};Preview[_0x707d('0x12')][_0x707d('0x81')]=function(_0x24f34f,_0x5ebd4c,_0x31d3f9){return cmHopperAdditionalPhone[_0x707d('0x81')](_0x24f34f,_0x5ebd4c,_0x31d3f9)[_0x707d('0x53')](logger[_0x707d('0x29')](_0x707d('0xe7')));};Preview[_0x707d('0x12')][_0x707d('0xb7')]=function(_0x1a9ebd,_0x3ead19,_0x1993dd){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1a9ebd,_0x3ead19,_0x1993dd)[_0x707d('0x53')](logger[_0x707d('0x29')](_0x707d('0xe8')));};Preview[_0x707d('0x12')][_0x707d('0xad')]=function(_0x116b4a){return Promise[_0x707d('0xe9')]()['then'](cmHopperAdditionalPhone[_0x707d('0xad')](_0x116b4a))[_0x707d('0x53')](logger['info'](_0x707d('0xea')));};Preview[_0x707d('0x12')][_0x707d('0xeb')]=function(_0x4f081d,_0x5cb579,_0x422342,_0x27251d,_0x4952cb){var _0x1018d2=this;return new Promise(function(_0x306f98,_0x5ee5cf){if(_[_0x707d('0x49')](_0x5cb579)||_[_0x707d('0x49')](_0x5cb579[_0x707d('0xec')])||_[_0x707d('0x49')](_0x5cb579['phone'])||_[_0x707d('0x49')](_0x5cb579[_0x707d('0xed')])){_0x5ee5cf(ut[_0x707d('0x35')](_0x707d('0xee'),_0x27251d,_0x4952cb));return;}var _0x5712eb=uuid['v4']();var _0x1baeb5=_0x1018d2[_0x707d('0x27')][_0x5cb579[_0x707d('0x4b')][_0x707d('0x3a')]];var _0x2bf44d=_0x422342?_0x1018d2[_0x707d('0x18')][_0x422342]['id']:undefined;_0x1018d2[_0x707d('0x17')][_0x5712eb]=new Action(_0x5cb579,_0x1baeb5,_0x5712eb,_0x422342,_0x2bf44d);var _0x33040c=_0x1018d2['actions'][_0x5712eb];_0x33040c[_0x707d('0xab')]=_0x27251d;_0x33040c[_0x707d('0x8a')]=_0x4952cb;_0x33040c['lookAgent']=_0x422342;if(_['isEmpty'](_0x4f081d)){_0x1018d2[_0x707d('0xef')](_0x33040c,_0x1baeb5,_0x5cb579,_0x422342)[_0x707d('0x64')](function(_0x3c76cb){logger['info'](_0x707d('0xf0'),_0x707d('0xf1')+_0x33040c[_0x707d('0x4c')]+_0x707d('0xf2')+_0x33040c['idContact'],JSON[_0x707d('0x2b')](_0x3c76cb));ami['emit'](_0x707d('0xf3'),ut['buildObj'](_0x33040c,'called',_0x1018d2['campaignsPreview'][_0x33040c[_0x707d('0x4c')]]));_0x306f98(ut['message'](_0x707d('0xf4')));})['catch'](function(_0x51e554){ut[_0x707d('0x38')](_0x707d('0xf5'),_0x51e554);_0x5ee5cf(ut[_0x707d('0x35')]('Call\x20failed',_0x27251d,_0x4952cb));});}else{_0x1baeb5['outboundBlacklistCallsDay']+=0x1;ut[_0x707d('0xf6')](_0x33040c);rpcDb[_0x707d('0xf7')](_0x33040c,_0x707d('0xf8'));delete _0x1018d2[_0x707d('0x17')][_0x5712eb];_0x5ee5cf(ut['message'](_0x707d('0xf9'),_0x27251d,_0x4952cb));}});};Preview[_0x707d('0x12')][_0x707d('0x73')]=function(_0x5cb102){return!_[_0x707d('0x49')](_0x5cb102)&&!_[_0x707d('0x49')](_0x5cb102[_0x707d('0x3a')])&&!_['isNil'](_0x5cb102[_0x707d('0xfa')])&&_0x5cb102['active']&&!_[_0x707d('0x49')](this[_0x707d('0x16')][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])])&&!_[_0x707d('0x49')](this[_0x707d('0x16')][util['format'](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])][_0x707d('0xfc')])&&(this['trunks'][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])]['status']==='reachable'||this['trunks'][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])][_0x707d('0xfc')]===_0x707d('0xfd'));};Preview['prototype'][_0x707d('0x63')]=function(_0x110e19,_0x273e85){return this[_0x707d('0xfe')](_0x110e19,_0x273e85)['then'](function(_0x59f284){return _[_0x707d('0xff')](_0x59f284,[_0x707d('0x35')]);})[_0x707d('0x53')](function(_0x386fdb){if(_0x386fdb[_0x707d('0x100')]){rpcDb[_0x707d('0x101')](_0x110e19);}if(_0x386fdb[_0x707d('0xfa')]){rpcDb[_0x707d('0x102')](_0x110e19);}throw _[_0x707d('0xff')](_0x386fdb,['message']);});};Preview[_0x707d('0x12')][_0x707d('0xfe')]=function(_0x264f53,_0x4cbce0){var _0x1c6178=this;var _0x11f075,_0x35f12f;return rpcDb[_0x707d('0x103')](_0x264f53)[_0x707d('0x64')](function(_0x1402f9){if(!_[_0x707d('0x49')](_0x1402f9[0x0])){_0x35f12f=_0x1402f9[0x0]['recallme']?![]:!![];_0x11f075=_0x1402f9[0x0][_0x707d('0x104')]?!![]:![];_0x11f075=_0x4cbce0?!![]:_0x11f075;}var _0x46eb5b=_0x1c6178[_0x707d('0x105')](_0x1402f9);if(_0x46eb5b[_0x707d('0x106')]){rpcDb[_0x707d('0x107')](_[_0x707d('0xff')](_0x1402f9[0x0],[_0x707d('0xed'),'phone']))['then'](function(_0x2ef96b){_0x1c6178[_0x707d('0xeb')](_0x2ef96b,_0x1402f9[0x0],_0x4cbce0,_0x35f12f,_0x11f075)[_0x707d('0x64')](function(_0x37a62f){return _0x37a62f;})['catch'](function(_0x2bdb10){throw _0x2bdb10;});})[_0x707d('0x53')](function(_0x26cdb8){ut['logger']('[Preview][checkIsBlackList]',_0x26cdb8);throw ut[_0x707d('0x35')]('Call\x20unsuccessful',_0x35f12f,_0x11f075);});}else{throw ut[_0x707d('0x35')](_0x46eb5b[_0x707d('0x35')],_0x35f12f,_0x11f075);}})['catch'](function(_0xcc477c){ut[_0x707d('0x38')]('[Preview][getContactPreview]',_0xcc477c);throw ut[_0x707d('0x35')](_0x707d('0x108'),![],!![]);});};Preview['prototype'][_0x707d('0x105')]=function(_0x56560c){if(_[_0x707d('0x49')](_0x56560c)||_['isEmpty'](_0x56560c)||!_[_0x707d('0x49')](_0x56560c[0x0]['Agent'])&&_['isNil'](_0x56560c[0x0][_0x707d('0x61')]['name'])){ut[_0x707d('0x38')](_0x707d('0x109'),_0x56560c);return{'isValid':![],'message':_0x707d('0x10a')};}var _0x57601e=this[_0x707d('0x27')][_0x56560c[0x0][_0x707d('0x4b')][_0x707d('0x3a')]];_0x57601e['message']=utils['CAMPAIGN_STATUS'][_0x707d('0x77')];if(_[_0x707d('0x49')](_0x57601e)){ut[_0x707d('0x38')](_0x707d('0x10b'),_0x57601e);return{'isValid':![],'message':_0x707d('0x10c')};}if(!this['isTrunkReachable'](_0x57601e[_0x707d('0x74')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x57601e[_0x707d('0x3a')]+_0x707d('0x10d'));if(!this[_0x707d('0x73')](_0x57601e[_0x707d('0x75')])){ut['logger'](_0x707d('0x10e'),_0x57601e[_0x707d('0x3a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x707d('0x10f')};}}if(!ut[_0x707d('0x72')](_0x57601e[_0x707d('0x45')])){ut[_0x707d('0x38')]('[Preview][validateContact][Campaign\x20Active]',_0x57601e[_0x707d('0x3a')]+_0x707d('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57601e[_0x707d('0x3a')]+_0x707d('0x110')};}return{'isValid':!![],'message':_0x707d('0x111')};};Preview['prototype'][_0x707d('0xef')]=function(_0x17147b,_0x394e78,_0x209632,_0x13c988){var _0x4f477b=this;return new Promise(function(_0x26080d,_0x53e8c0){var _0x1ab5c4=_0x17147b['uniqueid'];var _0x24572b=_0x4f477b['isTrunkReachable'](_0x394e78['Trunk'])?util[_0x707d('0x2c')](_0x707d('0x112'),_0x394e78[_0x707d('0x74')][_0x707d('0x3a')],_['isNil'](_0x394e78['dialPrefix'])?'':_0x394e78[_0x707d('0x113')][_0x707d('0x114')]()||'',_0x394e78['dialCutDigit']>0x0?_0x209632[_0x707d('0x115')][_0x707d('0x116')](_0x394e78[_0x707d('0x117')]):_0x209632['phone']):util['format'](_0x707d('0x112'),_[_0x707d('0x49')](_0x394e78[_0x707d('0x75')])?_0x394e78['Trunk'][_0x707d('0x3a')]:_0x394e78['TrunkBackup'][_0x707d('0x3a')],_[_0x707d('0x49')](_0x394e78[_0x707d('0x113')])?'':_0x394e78[_0x707d('0x113')][_0x707d('0x114')]()||'',_0x394e78[_0x707d('0x117')]>0x0?_0x209632['phone'][_0x707d('0x116')](_0x394e78[_0x707d('0x117')]):_0x209632[_0x707d('0x115')]);var _0x285df0=_0x4f477b[_0x707d('0x73')](_0x394e78[_0x707d('0x74')])?ut['getCallerId'](_0x394e78[_0x707d('0x74')][_0x707d('0x118')],_0x394e78[_0x707d('0x119')],_0x394e78['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x394e78[_0x707d('0x11a')],_0x394e78[_0x707d('0x11b')]):_0x394e78[_0x707d('0x11a')]):ut[_0x707d('0x11c')](_[_0x707d('0x49')](_0x394e78['TrunkBackup'])?_0x394e78[_0x707d('0x74')][_0x707d('0x118')]:_0x394e78[_0x707d('0x75')][_0x707d('0x118')],_0x394e78['dialOriginateCallerIdName'],_0x394e78[_0x707d('0x11b')]>0x0?ut[_0x707d('0x11d')](_0x394e78['dialOriginateCallerIdNumber'],_0x394e78[_0x707d('0x11b')]):_0x394e78[_0x707d('0x11a')]);if(_0x285df0){_0x17147b[_0x707d('0x11e')]=ut[_0x707d('0x11f')](_0x285df0);_0x17147b[_0x707d('0x120')]=ut[_0x707d('0x121')](_0x285df0);}var _0x557cd8=ut[_0x707d('0x122')](_0x394e78,_0x209632,_0x24572b,_0x285df0,_0x1ab5c4,_0x17147b);var _0x17c223=utils['setXMDContactVariables'](_0x209632[_0x707d('0xec')]);Object[_0x707d('0x123')](_0x557cd8,_0x17c223);_[_0x707d('0x124')](_0x17147b,ut[_0x707d('0x125')](_0x557cd8));_0x17147b[_0x707d('0x67')]=moment()[_0x707d('0x2c')](_0x707d('0x68'));_0x394e78['variables']=_0x557cd8;var _0x4ef2dc=ut[_0x707d('0x126')](_0x17147b,_0x394e78,_0x557cd8,_0x17147b[_0x707d('0x8a')],_0x13c988);return ami[_0x707d('0x127')](_0x4ef2dc)[_0x707d('0x64')](function(_0x1a6179){_0x394e78[_0x707d('0x31')]+=0x1;logger['info']('[originated][increment]',_0x1ab5c4,'\x20Queue',_0x394e78[_0x707d('0x3a')],_0x707d('0x4d'),_0x394e78['originated']);_0x26080d(_0x1a6179);})[_0x707d('0x53')](function(_0xd457f){ut[_0x707d('0xe0')](_0x17147b,0xe,_0x707d('0x128'));rpcDb[_0x707d('0xe1')](_0x17147b,'[originateFailure][logOriginateFailure]');_0x53e8c0(_0xd457f);});});};Preview['prototype'][_0x707d('0x20')]=function(_0xfbf1e0){if(this[_0x707d('0x17')][_0xfbf1e0[_0x707d('0x8b')]]){this['actions'][_0xfbf1e0[_0x707d('0x8b')]][_0x707d('0x52')]=_0xfbf1e0[_0x707d('0x52')];}};Preview[_0x707d('0x12')][_0x707d('0x1a')]=function(_0xac12f7){var _0x465b66=this;var _0x5300eb=this[_0x707d('0x17')][_0xac12f7['actionid']];if(_0x5300eb){if(_0x5300eb[_0x707d('0x129')]&&this['agents'][_0x5300eb[_0x707d('0x129')]]){ut[_0x707d('0x12a')](_0x5300eb,this[_0x707d('0x18')][_0x5300eb['lookAgent']][_0x707d('0x3a')],this[_0x707d('0x18')][_0x5300eb['lookAgent']]['id']);}var _0x56a533=_[_0x707d('0x12b')](_0x5300eb);_0x56a533['responsetime']=moment()[_0x707d('0x2c')](_0x707d('0x68'));var _0x22aa7b=_0x465b66[_0x707d('0x27')][_0x5300eb['queue']];if(ut[_0x707d('0x12c')](_0xac12f7['response'])){if(_0x5300eb[_0x707d('0xab')]){rpcDb[_0x707d('0x101')](_0x5300eb[_0x707d('0x8d')]);}if(_0x5300eb['activeContact']){rpcDb[_0x707d('0x102')](_0x5300eb[_0x707d('0x8d')]);}ami['emit']('custom:agentringnoanswer',ut[_0x707d('0x7e')](_0x5300eb,_0x707d('0x12d'),this['campaignsPreview'][_0x5300eb[_0x707d('0x4c')]]));this['callProgressDetectingAgent'](_0x56a533,_0x22aa7b,_0xac12f7);}else{_0x5300eb['starttime']=moment()[_0x707d('0x2c')](_0x707d('0x68'));ut[_0x707d('0xe0')](_0x56a533,0x4,_0x707d('0x9b'));rpcDb[_0x707d('0xe1')](_0x56a533,_0x707d('0x12e'));}}};Preview[_0x707d('0x12')]['syncHangup']=function(_0x516799){var _0x2473c0=this[_0x707d('0x17')][_0x516799[_0x707d('0x8b')]];var _0x2c40d3;if(_0x2473c0){_0x2c40d3=this[_0x707d('0x27')][_0x2473c0[_0x707d('0x4c')]];logger[_0x707d('0x29')](_0x707d('0x12f'),_0x516799['linkedid'],'\x20Queue',_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);}if(this['actions'][_0x516799[_0x707d('0x8b')]]&&_0x516799[_0x707d('0x8b')]!==_0x516799[_0x707d('0x91')]){if(_0x516799[_0x707d('0x130')]==='16'&&this[_0x707d('0x17')][_0x516799['linkedid']]['dialAnswer']){this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}else if(this[_0x707d('0x17')][_0x516799[_0x707d('0x8b')]]['dialAnswer']){logger[_0x707d('0x29')](_0x707d('0x132'),_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')],'\x20Queue',_0x2c40d3['name'],'pTalking:\x20',_0x2c40d3[_0x707d('0x32')]);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}}else if(_0x2473c0&&_[_0x707d('0x49')](_0x2473c0[_0x707d('0x133')])&&_0x2c40d3[_0x707d('0x134')]&&_0x516799[_0x707d('0x8b')]===_0x516799[_0x707d('0x91')]&&_[_0x707d('0x49')](_0x516799[_0x707d('0xdf')])&&_0x516799[_0x707d('0x130')]==='16'&&_0x516799[_0x707d('0x135')]==='6'&&_[_0x707d('0x136')](_0x2473c0['transfer'])){if(_0x2473c0[_0x707d('0xab')]){rpcDb['unlockContact'](_0x2473c0[_0x707d('0x8d')]);}if(_0x2473c0[_0x707d('0x8a')]){rpcDb[_0x707d('0x102')](_0x2473c0[_0x707d('0x8d')]);}_0x516799[_0x707d('0xdf')]='22';this[_0x707d('0xdd')](_0x2473c0,_0x2c40d3,_0x516799);}else if(_0x2473c0&&_0x2473c0[_0x707d('0x137')]){if(_0x516799[_0x707d('0x130')]==='16'&&this[_0x707d('0x17')][_0x516799['linkedid']][_0x707d('0x4f')]){logger[_0x707d('0x29')](_0x707d('0x138'),_0x516799['linkedid'],_0x516799['cause'],_0x707d('0xdb'),_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}else if(this[_0x707d('0x17')][_0x516799['linkedid']][_0x707d('0x4f')]){logger[_0x707d('0x29')]('[syncHangup][talking][cause]',_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')],_0x707d('0xdb'),_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')]);}}};Preview[_0x707d('0x12')][_0x707d('0x1e')]=function(_0x33452c){if(this['actions'][_0x33452c[_0x707d('0x139')]]&&_0x33452c[_0x707d('0x139')]!==_0x33452c[_0x707d('0x13a')]){this['callProgressDetectingCustomer'](_0x33452c,_0x33452c['destlinkedid'],_0x33452c['dialstatus']);}};Preview[_0x707d('0x12')]['syncHangupRequest']=function(_0x391d59){if(this[_0x707d('0x17')][_0x391d59['linkedid']]&&_0x391d59['linkedid']!==_0x391d59[_0x707d('0x91')]&&!this[_0x707d('0x17')][_0x391d59[_0x707d('0x8b')]][_0x707d('0x4f')]){if(_0x391d59[_0x707d('0x130')]==='1'){this['callProgressDetectingCustomer'](_0x391d59,_0x391d59[_0x707d('0x8b')],_0x391d59[_0x707d('0x130')]);}}};Preview[_0x707d('0x12')]['addVariable']=function(_0x264768,_0x12ef1d,_0xd3587b){if(this[_0x707d('0x17')][_0x264768]){if(_['isNil'](this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')])){this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')]={};}this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')][_0x12ef1d]=_0xd3587b;}};Preview[_0x707d('0x12')][_0x707d('0x22')]=function(_0x28bd5a){try{if(!_[_0x707d('0x49')](_0x28bd5a)){if(ut[_0x707d('0x13c')](_[_0x707d('0x13d')](_0x28bd5a[_0x707d('0x13e')])[0x0])){this['addVariable'](_0x28bd5a[_0x707d('0x91')],_[_0x707d('0x13d')](_0x28bd5a[_0x707d('0x13e')])[0x0],_0x28bd5a[_0x707d('0x13f')]);}}}catch(_0x5c3f62){logger['error'](_0x707d('0x140'),util[_0x707d('0x141')](_0x5c3f62,{'showHidden':![],'depth':null}));}};Preview[_0x707d('0x12')]['syncAttendedTransfer']=function(_0x34db41){if(_0x34db41){if(this['actions'][_0x34db41[_0x707d('0x142')]]){this[_0x707d('0x17')][_0x34db41[_0x707d('0x142')]]['transfer']=!![];}}};Preview['prototype'][_0x707d('0x25')]=function(_0x245354){if(_0x245354){if(this[_0x707d('0x17')][_0x245354['transfererlinkedid']]){this[_0x707d('0x17')][_0x245354[_0x707d('0x143')]][_0x707d('0x137')]=!![];}}};module[_0x707d('0x144')]=Preview; \ No newline at end of file +var _0xa2da=['buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','additional','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','verifyAdditionalPhones','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','linkedid','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','isNil','Contact','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','recallme','validateContact','isValid','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','variablesAction','OriginateError','logLookAgent','clone','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','message','\x20is\x20deactivated','loopCampaigns','syncCampaigns','clockClearZombieChannels','dialMethod','booked','type','clearZombieChannels','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','info','size','hasOwnProperty','length','scheduledat','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa2da,0x1e1));var _0xaa2d=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xa2da[_0x1fa760];return _0xd8eda1;};'use strict';var util=require(_0xaa2d('0x0'));var _=require(_0xaa2d('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0xaa2d('0x2'));var config=require(_0xaa2d('0x3'));var logger=require(_0xaa2d('0x4'))(_0xaa2d('0x5'));var loggerAction=require(_0xaa2d('0x4'))('actionPreview');var ami=require(_0xaa2d('0x6'));var rpcDb=require(_0xaa2d('0x7'));var cmHopperAdditionalPhone=require(_0xaa2d('0x8'));var Action=require('./action');var ut=require(_0xaa2d('0x9'));var utils=require(_0xaa2d('0xa'));config[_0xaa2d('0xb')]=_[_0xaa2d('0xc')](config[_0xaa2d('0xb')],{'host':_0xaa2d('0xd'),'port':0x18eb});var io=require(_0xaa2d('0xe'))(new Redis(config[_0xaa2d('0xb')]));var Sequence=function(){};Sequence[_0xaa2d('0xf')][_0xaa2d('0x10')]=function(_0x6b2613){this['tail']=this['tail']?this[_0xaa2d('0x11')]['finally'](_0x6b2613):_0x6b2613();};function Preview(_0x454ef7){this[_0xaa2d('0x12')]=new Sequence();this[_0xaa2d('0x13')]=_0x454ef7[_0xaa2d('0x14')];this['trunks']=_0x454ef7[_0xaa2d('0x15')];this[_0xaa2d('0x16')]={};this['agents']=_0x454ef7[_0xaa2d('0x17')];this['clockClearZombieChannels']=0x0;ami['on'](_0xaa2d('0x18'),this[_0xaa2d('0x19')][_0xaa2d('0x1a')](this));ami['on'](_0xaa2d('0x1b'),this['syncHangup'][_0xaa2d('0x1a')](this));ami['on'](_0xaa2d('0x1c'),this[_0xaa2d('0x1d')]['bind'](this));ami['on'](_0xaa2d('0x1e'),this['syncDialEnd'][_0xaa2d('0x1a')](this));ami['on'](_0xaa2d('0x1f'),this[_0xaa2d('0x20')][_0xaa2d('0x1a')](this));ami['on'](_0xaa2d('0x21'),this['syncVarSet'][_0xaa2d('0x1a')](this));ami['on'](_0xaa2d('0x22'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xaa2d('0x23'),this['syncBlindTransfer'][_0xaa2d('0x1a')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x2bed14,_0x5b6d0f,_0x488aea){io['to'](_0x2bed14)[_0xaa2d('0x24')](_0x5b6d0f,_0x488aea);}function emitVoiceQueueChannelRemove(_0x229dab){logger['info'](_0xaa2d('0x25'),JSON[_0xaa2d('0x26')](_0x229dab));emit(util['format'](_0xaa2d('0x27'),_0x229dab['name']),_0xaa2d('0x28'),_0x229dab);io[_0xaa2d('0x24')]('voice_queue_presence:remove',_0x229dab);}function notSendMessagesQueue(_0xba08e3){if(_0xba08e3[_0xaa2d('0x29')]){if(_0xba08e3[_0xaa2d('0x2a')]===0x0&&_0xba08e3[_0xaa2d('0x2b')]===0x0){_0xba08e3[_0xaa2d('0x29')]=![];_0xba08e3[_0xaa2d('0x2c')]=0x0;_0xba08e3[_0xaa2d('0x2d')]=0x0;_0xba08e3['message']=utils[_0xaa2d('0x2e')][_0xaa2d('0x2f')];ut[_0xaa2d('0x30')](_0xaa2d('0x31'),_0xba08e3[_0xaa2d('0x32')]+_0xaa2d('0x33'));}else{_0xba08e3[_0xaa2d('0x34')]=utils[_0xaa2d('0x2e')]['DEACTIVATED'];ut[_0xaa2d('0x30')](_0xaa2d('0x31'),_0xba08e3[_0xaa2d('0x32')]+_0xaa2d('0x35'));}}}Preview[_0xaa2d('0xf')][_0xaa2d('0x36')]=function(){var _0x4ae53a=this;setInterval(function(){_0x4ae53a[_0xaa2d('0x37')]();},0x7cf);};Preview['prototype'][_0xaa2d('0x37')]=function(){var _0x132bbb=this['campaignsPreview'];this[_0xaa2d('0x38')]+=0x1;for(var _0x5718b5 in _0x132bbb){if(_0x132bbb['hasOwnProperty'](_0x5718b5)&&(_0x132bbb[_0x5718b5]['dialMethod']==='preview'||_0x132bbb[_0x5718b5][_0xaa2d('0x39')]===_0xaa2d('0x3a'))&&_0x132bbb[_0x5718b5][_0xaa2d('0x3b')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xaa2d('0x3c')]();}}if(_0x132bbb['hasOwnProperty'](_0x5718b5)&&_0x132bbb[_0x5718b5][_0xaa2d('0x39')]==='preview'&&_0x132bbb[_0x5718b5][_0xaa2d('0x3b')]===_0xaa2d('0x3d')){if(_0x132bbb[_0x5718b5]['dialActive']){this[_0xaa2d('0x3e')](_0x132bbb[_0x5718b5]);if(_0x132bbb[_0x5718b5][_0xaa2d('0x3f')])this[_0xaa2d('0x40')](_0x132bbb[_0x5718b5]);}else{notSendMessagesQueue(_0x132bbb[_0x5718b5]);}}}};Preview['prototype'][_0xaa2d('0x41')]=function(_0x3e3066){var _0x138c0a=this;this['sequence'][_0xaa2d('0x10')](function(){if(!_['isNil'](_0x138c0a[_0xaa2d('0x16')][_0x3e3066])){loggerAction['info']('[clearZombieChannels][talking]',_0x3e3066,'Queue',_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')],'originated:\x20',JSON[_0xaa2d('0x26')](_0x138c0a[_0xaa2d('0x13')][_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')]][_0xaa2d('0x2a')]),_0xaa2d('0x43'),JSON['stringify'](_0x138c0a[_0xaa2d('0x13')][_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')]][_0xaa2d('0x2b')]),JSON[_0xaa2d('0x26')](_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x44')]),JSON['stringify'](_[_0xaa2d('0x45')](_0x138c0a[_0xaa2d('0x16')][_0x3e3066],[_0xaa2d('0x46'),'UserId',_0xaa2d('0x47'),_0xaa2d('0x48')])));return ami['Action']({'action':_0xaa2d('0x49'),'channel':_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x4a')]})[_0xaa2d('0x4b')](function(_0x349309){if(_0x349309['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x138c0a[_0xaa2d('0x16')][_0x3e3066]){ut[_0xaa2d('0x4c')](_0x138c0a[_0xaa2d('0x13')][_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')]],_0xaa2d('0x4d'));if(_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x44')]===!![]){ut['decrementTalkink'](_0x138c0a['campaignsPreview'][_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')]],_0xaa2d('0x4d'));ut['loggerError'](_0xaa2d('0x4e')+_0x3e3066,_0x138c0a[_0xaa2d('0x16')][_0x3e3066]['queue']);}ut[_0xaa2d('0x4f')](_0xaa2d('0x50')+_0x3e3066,_0x138c0a[_0xaa2d('0x16')][_0x3e3066][_0xaa2d('0x42')]);delete _0x138c0a[_0xaa2d('0x16')][_0x3e3066];}},0x2328);}});}});};Preview[_0xaa2d('0xf')][_0xaa2d('0x3c')]=function(){var _0x1af7a1=this;loggerAction[_0xaa2d('0x51')]('[action]',_[_0xaa2d('0x52')](this[_0xaa2d('0x16')]));for(var _0x12c81b in this['actions']){if(_0x1af7a1['actions'][_0xaa2d('0x53')](_0x12c81b)){_0x1af7a1['clearZombieChannel'](_0x12c81b);}}};Preview[_0xaa2d('0xf')]['recallMe']=function(_0x3e1f30){var _0x1c77e1=this;rpcDb['getContactRecallMe'](_0x3e1f30['id'],ut['agentReadyId'](this[_0xaa2d('0x17')]))['then'](function(_0x2bb5bb){if(!_['isNil'](_0x2bb5bb)){for(var _0x54723d=0x0;_0x54723d<_0x2bb5bb[_0xaa2d('0x54')];_0x54723d+=0x1){if(ut['getDiff'](_0x2bb5bb[_0x54723d][_0xaa2d('0x55')])<_0x3e1f30['dialRecallMeTimeout']*0x3c){if(_0x2bb5bb[_0x54723d]['Agent']&&!_0x2bb5bb[_0x54723d][_0xaa2d('0x56')]['voicePause']){_0x1c77e1[_0xaa2d('0x57')](_0x2bb5bb[_0x54723d]['id'])[_0xaa2d('0x58')](ut[_0xaa2d('0x59')]('[RecallMe]'))['catch'](ut[_0xaa2d('0x59')](_0xaa2d('0x5a')));}else{rpcDb[_0xaa2d('0x5b')](_0x2bb5bb[_0x54723d]['id']);}}else{var _0x3ef817=new Action(_0x2bb5bb[_0x54723d],_0x3e1f30);_0x3ef817[_0xaa2d('0x5c')]=moment()[_0xaa2d('0x5d')](_0xaa2d('0x5e'));_0x3e1f30[_0xaa2d('0x5f')]+=0x1;ut[_0xaa2d('0x60')](_0x3ef817,0x17,_0xaa2d('0x61'));if(_0x3e1f30[_0xaa2d('0x62')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x2bb5bb[_0x54723d]));rpcDb['createCustomerHistory'](_0x3ef817,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xaa2d('0x60')](_0x3ef817,0x16,_0xaa2d('0x63'));rpcDb[_0xaa2d('0x64')](_0x3ef817,_0xaa2d('0x65'));rpcDb[_0xaa2d('0x66')](_0x3ef817,_0xaa2d('0x65'));}}}}})['catch'](ut[_0xaa2d('0x59')]('[getContactRecallMe]'));};Preview[_0xaa2d('0xf')][_0xaa2d('0x3e')]=function(_0x1c6429){_0x1c6429[_0xaa2d('0x29')]=!![];if(ut[_0xaa2d('0x67')](_0x1c6429[_0xaa2d('0x68')])){_0x1c6429[_0xaa2d('0x34')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x1c6429[_0xaa2d('0x69')])){_0x1c6429[_0xaa2d('0x34')]=utils[_0xaa2d('0x2e')][_0xaa2d('0x2f')];}else if(!this[_0xaa2d('0x6a')](_0x1c6429[_0xaa2d('0x6b')])){if(!this['isTrunkReachable'](_0x1c6429['TrunkBackup'])){_0x1c6429[_0xaa2d('0x34')]=utils[_0xaa2d('0x2e')][_0xaa2d('0x6c')];}else{_0x1c6429['message']=utils[_0xaa2d('0x2e')]['ACTIVE'];}}else{_0x1c6429[_0xaa2d('0x34')]=utils[_0xaa2d('0x2e')][_0xaa2d('0x6d')];}};Preview[_0xaa2d('0xf')][_0xaa2d('0x6e')]=function(_0x46005f,_0x39b1b2,_0x4c059b){var _0x2b3526=this;var _0x1efd02=this[_0xaa2d('0x16')][_0x39b1b2];var _0x21b086=this[_0xaa2d('0x13')][_0x1efd02[_0xaa2d('0x42')]];var _0x568333;var _0x3fbd32=![];var _0x1a6218=0x2;var _0x19e796=0x3;if(_0x21b086){switch(_0x4c059b){case'1':_0x21b086[_0xaa2d('0x6f')]+=0x1;_0x1efd02[_0xaa2d('0x70')]+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0x0,_0xaa2d('0x73'));ami['emit'](_0xaa2d('0x74'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0x76')));rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0x77'));_0x2b3526['verifyAdditionalPhones'](_0x1efd02,'0',_0x21b086)[_0xaa2d('0x58')](function(_0x406513){_0x3fbd32=_0x406513['additional']==0x1;_0x1a6218=_0x21b086['dialNoSuchNumberRetryFrequency'];_0x19e796=_0x21b086['callAdditionalPhoneAfterMin'];if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086[_0xaa2d('0x78')]){_0x568333=ut['cloneAction'](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0x7a'));}else{if(_0x1efd02[_0xaa2d('0x70')]>=_0x21b086['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x1efd02,_0xaa2d('0x7a'));}else{rpcDb[_0xaa2d('0x7b')](ut[_0xaa2d('0x7c')](_0x1efd02,_0xaa2d('0x70'),_0x21b086[_0xaa2d('0x7d')]),_0x1efd02[_0xaa2d('0x7e')],_0x1efd02[_0xaa2d('0x7f')]);}}delete this['actions'][_0x46005f['linkedid']];}else{_0x1efd02['countnosuchnumberretry']++;logger[_0xaa2d('0x51')](_0xaa2d('0x80'),_0x1efd02[_0xaa2d('0x70')]);logger[_0xaa2d('0x51')]('id',_0x1efd02[_0xaa2d('0x81')]);_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countnosuchnumberretry':_0x1efd02[_0xaa2d('0x70')]}})[_0xaa2d('0x58')](function(){_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case _0xaa2d('0x84'):var _0x483115=moment()[_0xaa2d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1efd02[_0xaa2d('0x85')]=_0x483115;_0x1efd02[_0xaa2d('0x86')]=_0x483115;_0x1efd02['dialAnswer']=!![];_0x21b086[_0xaa2d('0x2b')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x1efd02[_0xaa2d('0x87')],_0xaa2d('0x88'),_0x21b086[_0xaa2d('0x32')],_0xaa2d('0x43'),_0x21b086[_0xaa2d('0x2b')]);ami[_0xaa2d('0x24')](_0xaa2d('0x89'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0x8a'),this[_0xaa2d('0x13')][_0x1efd02[_0xaa2d('0x42')]]));if(_0x21b086['acw']){ami[_0xaa2d('0x24')]('custom:agentConnectPreview',ut['buildAcw'](_0x1efd02));}break;case'16':ami[_0xaa2d('0x24')](_0xaa2d('0x8b'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0x8c'),this[_0xaa2d('0x13')][_0x1efd02['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x1efd02,_0xaa2d('0x8c')));_0x21b086[_0xaa2d('0x8d')]+=0x1;_0x21b086[_0xaa2d('0x8e')]+=0x1;_0x21b086[_0xaa2d('0x8f')]+=0x1;ut[_0xaa2d('0x90')](_0x21b086,_0xaa2d('0x91'));_0x1efd02[_0xaa2d('0x71')]=ut['totalGlobal'](_0x1efd02);ut['logCustomer'](_0x1efd02,0x4,_0xaa2d('0x92'));rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0x93'));rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0x94'));rpcDb['crateCustomerReportQueue'](_0x1efd02);_0x21b086[_0xaa2d('0x95')]+=_0x1efd02[_0xaa2d('0x96')];_0x21b086[_0xaa2d('0x97')]+=_0x1efd02[_0xaa2d('0x96')];logger['info']('[syncHangup][talking][decrement]',_0x1efd02[_0xaa2d('0x87')],_0xaa2d('0x88'),_0x21b086['name'],_0xaa2d('0x43'),_0x21b086[_0xaa2d('0x2b')]);delete this[_0xaa2d('0x16')][_0x46005f['linkedid']];break;case _0xaa2d('0x98'):_0x21b086[_0xaa2d('0x99')]+=0x1;_0x1efd02[_0xaa2d('0x9a')]+=0x1;_0x1efd02['countglobal']=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0x5,_0xaa2d('0x9b'));_0x1a6218=_0x21b086[_0xaa2d('0x9c')];_0x19e796=_0x21b086['callAdditionalPhoneAfterMin'];ami[_0xaa2d('0x24')](_0xaa2d('0x9d'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0x9e')));rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0x9f'));_0x2b3526['verifyAdditionalPhones'](_0x1efd02,'5',_0x21b086)[_0xaa2d('0x58')](function(_0x31ec78){_0x3fbd32=_0x31ec78['additional']==0x1;if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086[_0xaa2d('0x78')]){_0x568333=ut[_0xaa2d('0xa0')](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0xa1'));}else{if(_0x1efd02[_0xaa2d('0x9a')]>=_0x21b086[_0xaa2d('0xa2')]){rpcDb[_0xaa2d('0x66')](_0x1efd02,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xaa2d('0x7b')](ut[_0xaa2d('0x7c')](_0x1efd02,_0xaa2d('0x9a'),_0x21b086[_0xaa2d('0x9c')]),_0x1efd02['unlockAgent'],_0x1efd02[_0xaa2d('0x7f')]);}}}else{_0x1efd02[_0xaa2d('0x9a')]++;_0x2b3526['incrementPreviewCounters']({'id':_0x1efd02['idContact'],'field':{'countbusyretry':_0x1efd02[_0xaa2d('0x9a')]}})[_0xaa2d('0x58')](function(){_0x2b3526['swapAdditionalPhones'](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case _0xaa2d('0xa3'):_0x21b086[_0xaa2d('0xa4')]+=0x1;_0x1efd02[_0xaa2d('0xa5')]+=0x1;_0x1efd02['countglobal']=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0x3,_0xaa2d('0xa6'));_0x1a6218=_0x21b086[_0xaa2d('0xa7')];_0x19e796=_0x21b086[_0xaa2d('0xa8')];var _0x118bf7=ut[_0xaa2d('0xa9')](_0x1efd02,_0x21b086);ami[_0xaa2d('0x24')]('custom:agentnoanswer',_0x118bf7);rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0xaa'));_0x2b3526['verifyAdditionalPhones'](_0x1efd02,'3',_0x21b086)[_0xaa2d('0x58')](function(_0x1533eb){_0x3fbd32=_0x1533eb[_0xaa2d('0xab')]==0x1;if(!_0x3fbd32){if(ut['totalGlobal'](_0x1efd02)>=_0x21b086[_0xaa2d('0x78')]){_0x568333=ut['cloneAction'](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb['createCustomerFinal'](_0x568333,_0xaa2d('0xac'));}else{if(_0x1efd02[_0xaa2d('0xa5')]>=_0x21b086['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x1efd02,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xaa2d('0x7b')](ut[_0xaa2d('0x7c')](_0x1efd02,_0xaa2d('0xa5'),_0x21b086[_0xaa2d('0xa7')]),_0x1efd02['unlockAgent'],_0x1efd02[_0xaa2d('0x7f')]);}}}else{_0x1efd02[_0xaa2d('0xa5')]++;_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countnoanswerretry':_0x1efd02[_0xaa2d('0xa5')]}})[_0xaa2d('0x58')](function(){_0x2b3526['swapAdditionalPhones'](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case _0xaa2d('0xad'):_0x21b086[_0xaa2d('0xae')]+=0x1;_0x1efd02[_0xaa2d('0xaf')]+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0x8,_0xaa2d('0xb0'));_0x1a6218=_0x21b086['dialCongestionRetryFrequency'];_0x19e796=_0x21b086[_0xaa2d('0xa8')];ami[_0xaa2d('0x24')](_0xaa2d('0xb1'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0xb2')));rpcDb['createCustomerHistory'](_0x1efd02,_0xaa2d('0xb3'));_0x2b3526['verifyAdditionalPhones'](_0x1efd02,'8',_0x21b086)['then'](function(_0x3e5d86){_0x3fbd32=_0x3e5d86['additional']==0x1;if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086['dialGlobalMaxRetry']){_0x568333=ut[_0xaa2d('0xa0')](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0xb4'));}else{if(_0x1efd02[_0xaa2d('0xaf')]>=_0x21b086[_0xaa2d('0xb5')]){rpcDb['createCustomerFinal'](_0x1efd02,_0xaa2d('0xb3'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1efd02,'countcongestionretry',_0x21b086['dialBusyRetryFrequency']),_0x1efd02[_0xaa2d('0x7e')],_0x1efd02['activeContact']);}}}else{_0x1efd02[_0xaa2d('0xaf')]++;_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countcongestionretry':_0x1efd02[_0xaa2d('0xaf')]}})[_0xaa2d('0x58')](function(){_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case _0xaa2d('0xb6'):_0x21b086[_0xaa2d('0xb7')]+=0x1;_0x1efd02['countagentrejectretry']+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut['totalGlobal'](_0x1efd02);ut['logCustomer'](_0x1efd02,0x14,'AgentReject');_0x1a6218=_0x21b086[_0xaa2d('0xb8')];_0x19e796=_0x21b086[_0xaa2d('0xa8')];ami['emit'](_0xaa2d('0xb9'),ut[_0xaa2d('0x75')](_0x1efd02,_0xaa2d('0xba')));rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0xbb'));_0x2b3526[_0xaa2d('0xbc')](_0x1efd02,'20',_0x21b086)[_0xaa2d('0x58')](function(_0x3e4d75){_0x3fbd32=_0x3e4d75[_0xaa2d('0xab')]==0x1;if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086[_0xaa2d('0x78')]){_0x568333=ut['cloneAction'](_0x1efd02,0x14,'AgentReject');rpcDb[_0xaa2d('0x66')](_0x568333,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x1efd02['countagentrejectretry']>=_0x21b086[_0xaa2d('0xbd')]){rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0xbe'));}else{rpcDb[_0xaa2d('0x7b')](ut['scheduledAt'](_0x1efd02,_0xaa2d('0xbf'),_0x21b086[_0xaa2d('0xb8')]),_0x1efd02[_0xaa2d('0x7e')],_0x1efd02[_0xaa2d('0x7f')]);}}}else{_0x1efd02['countnoanswerretry']++;_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countnoanswerretry':_0x1efd02[_0xaa2d('0xa5')]}})[_0xaa2d('0x58')](function(){_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case'ABANDONED':_0x21b086[_0xaa2d('0xc0')]+=0x1;_0x1efd02['countabandonedretry']+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0xb,_0xaa2d('0xc1'));rpcDb['createCustomerHistory'](_0x1efd02,_0xaa2d('0xc2'));_0x2b3526['verifyAdditionalPhones'](_0x1efd02,'11',_0x21b086)[_0xaa2d('0x58')](function(_0x232b61){_0x3fbd32=_0x232b61[_0xaa2d('0xab')]==0x1;if(!_0x3fbd32){if(ut['totalGlobal'](_0x1efd02)>=_0x21b086[_0xaa2d('0x78')]){_0x568333=ut[_0xaa2d('0xa0')](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1efd02[_0xaa2d('0xc3')]>=_0x21b086[_0xaa2d('0xc4')]){rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0xc2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1efd02,'countabandonedretry',_0x21b086[_0xaa2d('0xc5')]),_0x1efd02[_0xaa2d('0x7e')],_0x1efd02['activeContact']);}}}else{_0x1efd02[_0xaa2d('0xa5')]++;_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countnoanswerretry':_0x1efd02[_0xaa2d('0xa5')]}})[_0xaa2d('0x58')](function(){_0x2b3526['swapAdditionalPhones'](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});break;case'18':_0x21b086[_0xaa2d('0xc6')]+=0x1;_0x1efd02[_0xaa2d('0xc7')]+=0x1;_0x1efd02['countglobal']=ut[_0xaa2d('0x72')](_0x1efd02);ut['logCustomer'](_0x1efd02,0x12,_0x46005f[_0xaa2d('0xc8')]||_0x46005f[_0xaa2d('0xc9')]);ami[_0xaa2d('0x24')](_0xaa2d('0xca'),ut[_0xaa2d('0x75')](_0x1efd02,'amd'));rpcDb[_0xaa2d('0x64')](_0x1efd02,'[callProgressDetectingCustomer][hangupInAMD]');_0x2b3526[_0xaa2d('0xbc')](_0x1efd02,'18',_0x21b086)[_0xaa2d('0x58')](function(_0x4e5563){_0x3fbd32=_0x4e5563['additional']==0x1;if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086['dialGlobalMaxRetry']){_0x568333=ut['cloneAction'](_0x1efd02,0x12,'Global');rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0xcb'));}else{rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0xcb'));}}else{_0x1efd02[_0xaa2d('0xa5')]++;_0x2b3526[_0xaa2d('0x82')]({'id':_0x1efd02[_0xaa2d('0x81')],'field':{'countnoanswerretry':_0x1efd02[_0xaa2d('0xa5')]}})[_0xaa2d('0x58')](function(){_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)['then'](function(){});});}});delete this['actions'][_0x46005f['linkedid']];break;case'19':_0x21b086[_0xaa2d('0xc6')]+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut[_0xaa2d('0x72')](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0x13,_0x46005f[_0xaa2d('0xc8')]||_0x46005f[_0xaa2d('0xc9')]);ami['emit']('custom:amd',ut[_0xaa2d('0x75')](_0x1efd02,'amd'));rpcDb[_0xaa2d('0x64')](_0x1efd02,_0xaa2d('0xcc'));_0x2b3526[_0xaa2d('0xbc')](_0x1efd02,'18',_0x21b086)[_0xaa2d('0x58')](function(_0x348558){_0x3fbd32=_0x348558[_0xaa2d('0xab')]==0x1;if(!_0x3fbd32){if(ut[_0xaa2d('0x72')](_0x1efd02)>=_0x21b086['dialGlobalMaxRetry']){_0x568333=ut['cloneAction'](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0xcc'));}else{rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0xcc'));}}else{_0x1efd02[_0xaa2d('0xa5')]++;_0x2b3526['incrementPreviewCounters']({'id':_0x1efd02['idContact'],'field':{'countnoanswerretry':_0x1efd02[_0xaa2d('0xa5')]}})[_0xaa2d('0x58')](function(){_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});});}});delete this[_0xaa2d('0x16')][_0x46005f[_0xaa2d('0xcd')]];break;default:if(_0x1efd02[_0xaa2d('0x44')]){ut[_0xaa2d('0x90')](_0x21b086,_0xaa2d('0xce'));ut[_0xaa2d('0x4f')](_0xaa2d('0xcf')+_0x21b086[_0xaa2d('0x32')],_0x46005f);}_0x21b086[_0xaa2d('0xc6')]+=0x1;_0x1efd02[_0xaa2d('0x71')]=ut['totalGlobal'](_0x1efd02);ut[_0xaa2d('0x60')](_0x1efd02,0xc,_0x46005f[_0xaa2d('0xc8')]||_0x46005f[_0xaa2d('0xc9')]);_0x1a6218=_0x21b086['dialAgentRejectRetryFrequency'];_0x19e796=_0x21b086[_0xaa2d('0xa8')];rpcDb['createCustomerHistory'](_0x1efd02,_0xaa2d('0xd0'));_0x2b3526[_0xaa2d('0xbc')](_0x1efd02,'20',_0x21b086)[_0xaa2d('0x58')](function(_0x222e8f){_0x3fbd32=_0x222e8f[_0xaa2d('0xab')]==0x1;if(!_0x3fbd32){if(ut['totalGlobal'](_0x1efd02)>=_0x21b086['dialGlobalMaxRetry']){_0x568333=ut[_0xaa2d('0xa0')](_0x1efd02,0xf,_0xaa2d('0x79'));rpcDb[_0xaa2d('0x66')](_0x568333,_0xaa2d('0xd1'));}else{rpcDb[_0xaa2d('0x66')](_0x1efd02,_0xaa2d('0xd1'));}delete this[_0xaa2d('0x16')][_0x46005f[_0xaa2d('0xcd')]];}else{_0x2b3526[_0xaa2d('0x83')](_0x1efd02,_0x1a6218,_0x19e796)[_0xaa2d('0x58')](function(){});}});}if(!(_0x1efd02[_0xaa2d('0x44')]&&_0x4c059b==='16')){ut[_0xaa2d('0x4c')](_0x21b086,_0xaa2d('0xd2'));logger[_0xaa2d('0x51')]('[originated][decrement][callProgressDetectingCustomer]',_0x1efd02[_0xaa2d('0x87')],'\x20Queue',_0x21b086['name'],_0xaa2d('0xd3'),_0x21b086[_0xaa2d('0x2a')]);}if(_0x4c059b!==_0xaa2d('0x84')){delete this[_0xaa2d('0x16')][_0x46005f['linkedid']];delete this['actions'][_0x46005f[_0xaa2d('0xd4')]];}_0x21b086[_0xaa2d('0xd5')]=!![];}};Preview['prototype'][_0xaa2d('0xd6')]=function(_0x7e9a4,_0xb3725f,_0x3d06fd){if(_[_0xaa2d('0xd7')](_0xb3725f)&&'object'!==typeof _0xb3725f){return;}if(_[_0xaa2d('0xd7')](_0x3d06fd)&&'object'!==typeof _0x3d06fd){return;}switch(_0x3d06fd[_0xaa2d('0xd8')]){case'0':ut['logAgent'](_0x7e9a4,0x0,_0xaa2d('0x73'));rpcDb['createAgentHistory'](_0x7e9a4,_0xaa2d('0xd9'));break;case'3':ut[_0xaa2d('0xda')](_0x7e9a4,0x3,'NoAnswer');rpcDb[_0xaa2d('0xdb')](_0x7e9a4,_0xaa2d('0xdc'));break;case'5':ut[_0xaa2d('0xda')](_0x7e9a4,0x5,_0xaa2d('0x9b'));rpcDb[_0xaa2d('0xdb')](_0x7e9a4,_0xaa2d('0xdd'));break;case'8':ut[_0xaa2d('0xda')](_0x7e9a4,0x8,_0xaa2d('0xb0'));rpcDb[_0xaa2d('0xdb')](_0x7e9a4,_0xaa2d('0xde'));break;case'22':ut['logAgent'](_0x7e9a4,0x16,_0xaa2d('0xdf'));rpcDb[_0xaa2d('0xdb')](_0x7e9a4,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xaa2d('0xda')](_0x7e9a4,0xc,_0x3d06fd[_0xaa2d('0xd8')]);rpcDb[_0xaa2d('0xdb')](_0x7e9a4,_0xaa2d('0xde'));}ut['updateOriginated'](_0xb3725f,_0xaa2d('0xe0'));logger[_0xaa2d('0x51')](_0xaa2d('0xe1'),_0x7e9a4['uniqueid'],_0xaa2d('0x88'),_0xb3725f[_0xaa2d('0x32')],_0xaa2d('0xd3'),_0xb3725f[_0xaa2d('0x2a')]);delete this[_0xaa2d('0x16')][_0x7e9a4[_0xaa2d('0x87')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x53d9e7,_0x4405ef,_0x545411){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53d9e7,_0x4405ef,_0x545411)[_0xaa2d('0x4b')](logger['info'](_0xaa2d('0xe2')));};Preview[_0xaa2d('0xf')]['swapAdditionalPhones']=function(_0x582d26,_0x3343df,_0x12601b){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x582d26,_0x3343df,_0x12601b)['catch'](logger['info'](_0xaa2d('0xe3')));};Preview[_0xaa2d('0xf')]['incrementPreviewCounters']=function(_0x37981e){return Promise[_0xaa2d('0xe4')]()[_0xaa2d('0x58')](cmHopperAdditionalPhone[_0xaa2d('0x82')](_0x37981e))[_0xaa2d('0x4b')](logger[_0xaa2d('0x51')]('[incrementPreviewCounters]\x20'));};Preview[_0xaa2d('0xf')]['checkInBlack']=function(_0x379a7d,_0xaf2711,_0x787521,_0x402156,_0x473679){var _0x16525c=this;return new Promise(function(_0x4d0e6c,_0x27bcd7){if(_['isNil'](_0xaf2711)||_[_0xaa2d('0xe5')](_0xaf2711[_0xaa2d('0xe6')])||_[_0xaa2d('0xe5')](_0xaf2711['phone'])||_[_0xaa2d('0xe5')](_0xaf2711[_0xaa2d('0x47')])){_0x27bcd7(ut[_0xaa2d('0x34')](_0xaa2d('0xe7'),_0x402156,_0x473679));return;}var _0x4db43c=uuid['v4']();var _0x1a24d6=_0x16525c[_0xaa2d('0x13')][_0xaf2711[_0xaa2d('0xe8')]['name']];var _0x35066d=_0x787521?_0x16525c[_0xaa2d('0x17')][_0x787521]['id']:undefined;_0x16525c[_0xaa2d('0x16')][_0x4db43c]=new Action(_0xaf2711,_0x1a24d6,_0x4db43c,_0x787521,_0x35066d);var _0x14a9e6=_0x16525c[_0xaa2d('0x16')][_0x4db43c];_0x14a9e6[_0xaa2d('0x7e')]=_0x402156;_0x14a9e6[_0xaa2d('0x7f')]=_0x473679;_0x14a9e6[_0xaa2d('0xe9')]=_0x787521;if(_['isEmpty'](_0x379a7d)){_0x16525c[_0xaa2d('0xea')](_0x14a9e6,_0x1a24d6,_0xaf2711,_0x787521)[_0xaa2d('0x58')](function(_0x58ca5d){logger['info'](_0xaa2d('0xeb'),_0xaa2d('0xec')+_0x14a9e6[_0xaa2d('0x42')]+_0xaa2d('0xed')+_0x14a9e6[_0xaa2d('0x81')],JSON[_0xaa2d('0x26')](_0x58ca5d));ami[_0xaa2d('0x24')](_0xaa2d('0xee'),ut[_0xaa2d('0x75')](_0x14a9e6,_0xaa2d('0xef'),_0x16525c[_0xaa2d('0x13')][_0x14a9e6[_0xaa2d('0x42')]]));_0x4d0e6c(ut[_0xaa2d('0x34')]('Calling'));})[_0xaa2d('0x4b')](function(_0x410584){ut[_0xaa2d('0x30')](_0xaa2d('0xf0'),_0x410584);_0x27bcd7(ut['message'](_0xaa2d('0xf1'),_0x402156,_0x473679));});}else{_0x1a24d6[_0xaa2d('0xf2')]+=0x1;ut[_0xaa2d('0xf3')](_0x14a9e6);rpcDb[_0xaa2d('0xf4')](_0x14a9e6,_0xaa2d('0xf5'));delete _0x16525c[_0xaa2d('0x16')][_0x4db43c];_0x27bcd7(ut[_0xaa2d('0x34')](_0xaa2d('0xf6'),_0x402156,_0x473679));}});};Preview[_0xaa2d('0xf')][_0xaa2d('0x6a')]=function(_0x3aa3b4){return!_['isNil'](_0x3aa3b4)&&!_[_0xaa2d('0xe5')](_0x3aa3b4[_0xaa2d('0x32')])&&!_[_0xaa2d('0xe5')](_0x3aa3b4[_0xaa2d('0xf7')])&&_0x3aa3b4[_0xaa2d('0xf7')]&&!_[_0xaa2d('0xe5')](this['trunks'][util[_0xaa2d('0x5d')](_0xaa2d('0xf8'),_0x3aa3b4['name'])])&&!_[_0xaa2d('0xe5')](this['trunks'][util[_0xaa2d('0x5d')](_0xaa2d('0xf8'),_0x3aa3b4['name'])][_0xaa2d('0x49')])&&(this['trunks'][util[_0xaa2d('0x5d')](_0xaa2d('0xf8'),_0x3aa3b4[_0xaa2d('0x32')])][_0xaa2d('0x49')]===_0xaa2d('0xf9')||this[_0xaa2d('0x15')][util['format'](_0xaa2d('0xf8'),_0x3aa3b4['name'])]['status']===_0xaa2d('0xfa'));};Preview[_0xaa2d('0xf')]['run']=function(_0x408a3f,_0x16279a){return this[_0xaa2d('0xfb')](_0x408a3f,_0x16279a)[_0xaa2d('0x58')](function(_0x457987){return _[_0xaa2d('0x45')](_0x457987,[_0xaa2d('0x34')]);})[_0xaa2d('0x4b')](function(_0x408f68){if(_0x408f68['unlock']){rpcDb[_0xaa2d('0xfc')](_0x408a3f);}if(_0x408f68['active']){rpcDb['disableContact'](_0x408a3f);}throw _[_0xaa2d('0x45')](_0x408f68,['message']);});};Preview[_0xaa2d('0xf')][_0xaa2d('0xfb')]=function(_0x1ae847,_0x285210){var _0x2ad96c=this;var _0x5c45f1,_0x2bbb78;return rpcDb['getContactPreview'](_0x1ae847)[_0xaa2d('0x58')](function(_0xc1f86a){if(!_[_0xaa2d('0xe5')](_0xc1f86a[0x0])){_0x2bbb78=_0xc1f86a[0x0][_0xaa2d('0xfd')]?![]:!![];_0x5c45f1=_0xc1f86a[0x0][_0xaa2d('0xfd')]?!![]:![];_0x5c45f1=_0x285210?!![]:_0x5c45f1;}var _0x314552=_0x2ad96c[_0xaa2d('0xfe')](_0xc1f86a);if(_0x314552[_0xaa2d('0xff')]){rpcDb[_0xaa2d('0x100')](_[_0xaa2d('0x45')](_0xc1f86a[0x0],[_0xaa2d('0x47'),_0xaa2d('0x101')]))[_0xaa2d('0x58')](function(_0x1b40ab){_0x2ad96c[_0xaa2d('0x102')](_0x1b40ab,_0xc1f86a[0x0],_0x285210,_0x2bbb78,_0x5c45f1)[_0xaa2d('0x58')](function(_0x2b3f0f){return _0x2b3f0f;})[_0xaa2d('0x4b')](function(_0x4c9265){throw _0x4c9265;});})['catch'](function(_0xd518f4){ut[_0xaa2d('0x30')](_0xaa2d('0x103'),_0xd518f4);throw ut[_0xaa2d('0x34')](_0xaa2d('0x104'),_0x2bbb78,_0x5c45f1);});}else{throw ut[_0xaa2d('0x34')](_0x314552[_0xaa2d('0x34')],_0x2bbb78,_0x5c45f1);}})[_0xaa2d('0x4b')](function(_0x4d575b){ut[_0xaa2d('0x30')](_0xaa2d('0x105'),_0x4d575b);throw ut[_0xaa2d('0x34')](_0xaa2d('0x104'),![],!![]);});};Preview[_0xaa2d('0xf')][_0xaa2d('0xfe')]=function(_0x2e3a16){if(_[_0xaa2d('0xe5')](_0x2e3a16)||_['isEmpty'](_0x2e3a16)||!_[_0xaa2d('0xe5')](_0x2e3a16[0x0][_0xaa2d('0x56')])&&_['isNil'](_0x2e3a16[0x0][_0xaa2d('0x56')][_0xaa2d('0x32')])){ut[_0xaa2d('0x30')](_0xaa2d('0x106'),_0x2e3a16);return{'isValid':![],'message':_0xaa2d('0x107')};}var _0x1b0f5d=this['campaignsPreview'][_0x2e3a16[0x0][_0xaa2d('0xe8')][_0xaa2d('0x32')]];_0x1b0f5d['message']=utils[_0xaa2d('0x2e')][_0xaa2d('0x6d')];if(_[_0xaa2d('0xe5')](_0x1b0f5d)){ut['logger'](_0xaa2d('0x108'),_0x1b0f5d);return{'isValid':![],'message':_0xaa2d('0x109')};}if(!this[_0xaa2d('0x6a')](_0x1b0f5d['Trunk'])){ut[_0xaa2d('0x30')](_0xaa2d('0x10a'),_0xaa2d('0x10b')+_0x1b0f5d[_0xaa2d('0x32')]+_0xaa2d('0x10c'));if(!this['isTrunkReachable'](_0x1b0f5d[_0xaa2d('0x10d')])){ut[_0xaa2d('0x30')](_0xaa2d('0x10a'),_0x1b0f5d[_0xaa2d('0x32')]+_0xaa2d('0x10e'));return{'isValid':![],'message':_0xaa2d('0x10f')};}}if(!ut[_0xaa2d('0x110')](_0x1b0f5d[_0xaa2d('0x69')])){ut[_0xaa2d('0x30')](_0xaa2d('0x111'),_0x1b0f5d[_0xaa2d('0x32')]+_0xaa2d('0x112'));return{'isValid':![],'message':_0xaa2d('0x10b')+_0x1b0f5d[_0xaa2d('0x32')]+_0xaa2d('0x112')};}return{'isValid':!![],'message':_0xaa2d('0x113')};};Preview[_0xaa2d('0xf')][_0xaa2d('0xea')]=function(_0x3652ae,_0xdaa731,_0xe9f4d5,_0xf47acb){var _0x5c499b=this;return new Promise(function(_0x22a822,_0x4fcfe5){var _0x52d5d1=_0x3652ae[_0xaa2d('0x87')];var _0x3f32c5=_0x5c499b['isTrunkReachable'](_0xdaa731[_0xaa2d('0x6b')])?util['format'](_0xaa2d('0x114'),_0xdaa731[_0xaa2d('0x6b')][_0xaa2d('0x32')],_[_0xaa2d('0xe5')](_0xdaa731[_0xaa2d('0x115')])?'':_0xdaa731[_0xaa2d('0x115')][_0xaa2d('0x116')]()||'',_0xdaa731[_0xaa2d('0x117')]>0x0?_0xe9f4d5[_0xaa2d('0x101')][_0xaa2d('0x118')](_0xdaa731[_0xaa2d('0x117')]):_0xe9f4d5[_0xaa2d('0x101')]):util[_0xaa2d('0x5d')](_0xaa2d('0x114'),_['isNil'](_0xdaa731[_0xaa2d('0x10d')])?_0xdaa731['Trunk'][_0xaa2d('0x32')]:_0xdaa731['TrunkBackup'][_0xaa2d('0x32')],_[_0xaa2d('0xe5')](_0xdaa731[_0xaa2d('0x115')])?'':_0xdaa731['dialPrefix'][_0xaa2d('0x116')]()||'',_0xdaa731['dialCutDigit']>0x0?_0xe9f4d5['phone'][_0xaa2d('0x118')](_0xdaa731['dialCutDigit']):_0xe9f4d5['phone']);var _0x5a8113=_0x5c499b[_0xaa2d('0x6a')](_0xdaa731[_0xaa2d('0x6b')])?ut[_0xaa2d('0x119')](_0xdaa731['Trunk'][_0xaa2d('0x11a')],_0xdaa731['dialOriginateCallerIdName'],_0xdaa731[_0xaa2d('0x11b')]>0x0?ut[_0xaa2d('0x11c')](_0xdaa731['dialOriginateCallerIdNumber'],_0xdaa731[_0xaa2d('0x11b')]):_0xdaa731[_0xaa2d('0x11d')]):ut[_0xaa2d('0x119')](_['isNil'](_0xdaa731['TrunkBackup'])?_0xdaa731['Trunk']['callerid']:_0xdaa731[_0xaa2d('0x10d')][_0xaa2d('0x11a')],_0xdaa731[_0xaa2d('0x11e')],_0xdaa731[_0xaa2d('0x11b')]>0x0?ut[_0xaa2d('0x11c')](_0xdaa731[_0xaa2d('0x11d')],_0xdaa731[_0xaa2d('0x11b')]):_0xdaa731[_0xaa2d('0x11d')]);if(_0x5a8113){_0x3652ae['originatecalleridname']=ut[_0xaa2d('0x11f')](_0x5a8113);_0x3652ae[_0xaa2d('0x120')]=ut[_0xaa2d('0x121')](_0x5a8113);}var _0x4297d0=ut[_0xaa2d('0x122')](_0xdaa731,_0xe9f4d5,_0x3f32c5,_0x5a8113,_0x52d5d1,_0x3652ae);var _0x3aa345=utils[_0xaa2d('0x123')](_0xe9f4d5[_0xaa2d('0xe6')]);Object['assign'](_0x4297d0,_0x3aa345);_[_0xaa2d('0x124')](_0x3652ae,ut[_0xaa2d('0x125')](_0x4297d0));_0x3652ae[_0xaa2d('0x5c')]=moment()[_0xaa2d('0x5d')](_0xaa2d('0x5e'));_0xdaa731[_0xaa2d('0x126')]=_0x4297d0;var _0x33c134=ut[_0xaa2d('0x127')](_0x3652ae,_0xdaa731,_0x4297d0,_0x3652ae[_0xaa2d('0x7f')],_0xf47acb);return ami['Action'](_0x33c134)[_0xaa2d('0x58')](function(_0x4413b1){_0xdaa731[_0xaa2d('0x2a')]+=0x1;logger[_0xaa2d('0x51')]('[originated][increment]',_0x52d5d1,_0xaa2d('0x88'),_0xdaa731[_0xaa2d('0x32')],_0xaa2d('0xd3'),_0xdaa731[_0xaa2d('0x2a')]);_0x22a822(_0x4413b1);})[_0xaa2d('0x4b')](function(_0x4a2937){ut['logAgent'](_0x3652ae,0xe,_0xaa2d('0x128'));rpcDb['createAgentHistory'](_0x3652ae,'[originateFailure][logOriginateFailure]');_0x4fcfe5(_0x4a2937);});});};Preview[_0xaa2d('0xf')][_0xaa2d('0x20')]=function(_0xf2a0d1){if(this[_0xaa2d('0x16')][_0xf2a0d1[_0xaa2d('0xcd')]]){this[_0xaa2d('0x16')][_0xf2a0d1[_0xaa2d('0xcd')]][_0xaa2d('0x4a')]=_0xf2a0d1[_0xaa2d('0x4a')];}};Preview[_0xaa2d('0xf')][_0xaa2d('0x19')]=function(_0x27f924){var _0x40b054=this;var _0xb9aec2=this[_0xaa2d('0x16')][_0x27f924['actionid']];if(_0xb9aec2){if(_0xb9aec2[_0xaa2d('0xe9')]&&this[_0xaa2d('0x17')][_0xb9aec2[_0xaa2d('0xe9')]]){ut[_0xaa2d('0x129')](_0xb9aec2,this[_0xaa2d('0x17')][_0xb9aec2[_0xaa2d('0xe9')]][_0xaa2d('0x32')],this[_0xaa2d('0x17')][_0xb9aec2[_0xaa2d('0xe9')]]['id']);}var _0x755736=_[_0xaa2d('0x12a')](_0xb9aec2);_0x755736[_0xaa2d('0x85')]=moment()[_0xaa2d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3102f6=_0x40b054[_0xaa2d('0x13')][_0xb9aec2['queue']];if(ut['isFailure'](_0x27f924['response'])){if(_0xb9aec2[_0xaa2d('0x7e')]){rpcDb[_0xaa2d('0xfc')](_0xb9aec2[_0xaa2d('0x81')]);}if(_0xb9aec2[_0xaa2d('0x7f')]){rpcDb[_0xaa2d('0x5b')](_0xb9aec2[_0xaa2d('0x81')]);}ami[_0xaa2d('0x24')](_0xaa2d('0x12b'),ut['buildObj'](_0xb9aec2,'rejected',this['campaignsPreview'][_0xb9aec2[_0xaa2d('0x42')]]));this['callProgressDetectingAgent'](_0x755736,_0x3102f6,_0x27f924);}else{_0xb9aec2[_0xaa2d('0x5c')]=moment()[_0xaa2d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xaa2d('0xda')](_0x755736,0x4,_0xaa2d('0x92'));rpcDb[_0xaa2d('0xdb')](_0x755736,_0xaa2d('0x12c'));}}};Preview['prototype'][_0xaa2d('0x12d')]=function(_0x32dda7){var _0x589715=this[_0xaa2d('0x16')][_0x32dda7['linkedid']];var _0x1afb0c;if(_0x589715){_0x1afb0c=this[_0xaa2d('0x13')][_0x589715[_0xaa2d('0x42')]];logger['info'](_0xaa2d('0x12e'),_0x32dda7[_0xaa2d('0xcd')],_0xaa2d('0x88'),_0x1afb0c['name'],_0xaa2d('0x43'),_0x1afb0c[_0xaa2d('0x2b')]);}if(this[_0xaa2d('0x16')][_0x32dda7[_0xaa2d('0xcd')]]&&_0x32dda7[_0xaa2d('0xcd')]!==_0x32dda7[_0xaa2d('0x87')]){if(_0x32dda7[_0xaa2d('0x12f')]==='16'&&this['actions'][_0x32dda7[_0xaa2d('0xcd')]]['dialAnswer']){this[_0xaa2d('0x6e')](_0x32dda7,_0x32dda7[_0xaa2d('0xcd')],_0x32dda7[_0xaa2d('0x12f')]);}else if(this['actions'][_0x32dda7['linkedid']][_0xaa2d('0x44')]){logger[_0xaa2d('0x51')]('[syncHangup][talking][cause]',_0x32dda7[_0xaa2d('0xcd')],_0x32dda7['cause'],_0xaa2d('0x88'),_0x1afb0c['name'],_0xaa2d('0x43'),_0x1afb0c[_0xaa2d('0x2b')]);this[_0xaa2d('0x6e')](_0x32dda7,_0x32dda7[_0xaa2d('0xcd')],_0x32dda7[_0xaa2d('0x12f')]);}}else if(_0x589715&&_[_0xaa2d('0xe5')](_0x589715[_0xaa2d('0x130')])&&_0x1afb0c[_0xaa2d('0x131')]&&_0x32dda7[_0xaa2d('0xcd')]===_0x32dda7[_0xaa2d('0x87')]&&_[_0xaa2d('0xe5')](_0x32dda7[_0xaa2d('0xd8')])&&_0x32dda7['cause']==='16'&&_0x32dda7[_0xaa2d('0x132')]==='6'&&_[_0xaa2d('0xd7')](_0x589715[_0xaa2d('0x133')])){if(_0x589715[_0xaa2d('0x7e')]){rpcDb['unlockContact'](_0x589715[_0xaa2d('0x81')]);}if(_0x589715[_0xaa2d('0x7f')]){rpcDb['disableContact'](_0x589715[_0xaa2d('0x81')]);}_0x32dda7[_0xaa2d('0xd8')]='22';this[_0xaa2d('0xd6')](_0x589715,_0x1afb0c,_0x32dda7);}else if(_0x589715&&_0x589715[_0xaa2d('0x133')]){if(_0x32dda7[_0xaa2d('0x12f')]==='16'&&this[_0xaa2d('0x16')][_0x32dda7[_0xaa2d('0xcd')]][_0xaa2d('0x44')]){logger[_0xaa2d('0x51')](_0xaa2d('0x134'),_0x32dda7[_0xaa2d('0xcd')],_0x32dda7['cause'],_0xaa2d('0x88'),_0x1afb0c['name'],_0xaa2d('0x43'),_0x1afb0c[_0xaa2d('0x2b')]);this['callProgressDetectingCustomer'](_0x32dda7,_0x32dda7['linkedid'],_0x32dda7[_0xaa2d('0x12f')]);}else if(this[_0xaa2d('0x16')][_0x32dda7[_0xaa2d('0xcd')]]['dialAnswer']){logger[_0xaa2d('0x51')](_0xaa2d('0x135'),_0x32dda7[_0xaa2d('0xcd')],_0x32dda7[_0xaa2d('0x12f')],_0xaa2d('0x88'),_0x1afb0c[_0xaa2d('0x32')],_0xaa2d('0x43'),_0x1afb0c[_0xaa2d('0x2b')]);this[_0xaa2d('0x6e')](_0x32dda7,_0x32dda7[_0xaa2d('0xcd')],_0x32dda7[_0xaa2d('0x12f')]);}}};Preview[_0xaa2d('0xf')][_0xaa2d('0x136')]=function(_0x29e8f6){if(this[_0xaa2d('0x16')][_0x29e8f6[_0xaa2d('0xd4')]]&&_0x29e8f6[_0xaa2d('0xd4')]!==_0x29e8f6[_0xaa2d('0x137')]){this['callProgressDetectingCustomer'](_0x29e8f6,_0x29e8f6[_0xaa2d('0xd4')],_0x29e8f6[_0xaa2d('0xc9')]);}};Preview[_0xaa2d('0xf')][_0xaa2d('0x1d')]=function(_0x1599db){if(this[_0xaa2d('0x16')][_0x1599db[_0xaa2d('0xcd')]]&&_0x1599db[_0xaa2d('0xcd')]!==_0x1599db[_0xaa2d('0x87')]&&!this['actions'][_0x1599db['linkedid']][_0xaa2d('0x44')]){if(_0x1599db['cause']==='1'){this[_0xaa2d('0x6e')](_0x1599db,_0x1599db[_0xaa2d('0xcd')],_0x1599db[_0xaa2d('0x12f')]);}}};Preview[_0xaa2d('0xf')][_0xaa2d('0x138')]=function(_0x51087c,_0x263ca0,_0x30645f){if(this[_0xaa2d('0x16')][_0x51087c]){if(_['isNil'](this['actions'][_0x51087c][_0xaa2d('0x126')])){this[_0xaa2d('0x16')][_0x51087c]['variables']={};}this[_0xaa2d('0x16')][_0x51087c][_0xaa2d('0x126')][_0x263ca0]=_0x30645f;}};Preview['prototype'][_0xaa2d('0x139')]=function(_0x4c6a6e){try{if(!_[_0xaa2d('0xe5')](_0x4c6a6e)){if(ut[_0xaa2d('0x13a')](_[_0xaa2d('0x13b')](_0x4c6a6e[_0xaa2d('0x13c')])[0x0])){this[_0xaa2d('0x138')](_0x4c6a6e[_0xaa2d('0x87')],_[_0xaa2d('0x13b')](_0x4c6a6e[_0xaa2d('0x13c')])[0x0],_0x4c6a6e[_0xaa2d('0x13d')]);}}}catch(_0x19e8c5){logger[_0xaa2d('0x13e')](_0xaa2d('0x13f'),util[_0xaa2d('0x140')](_0x19e8c5,{'showHidden':![],'depth':null}));}};Preview[_0xaa2d('0xf')][_0xaa2d('0x141')]=function(_0x663736){if(_0x663736){if(this[_0xaa2d('0x16')][_0x663736[_0xaa2d('0x142')]]){this[_0xaa2d('0x16')][_0x663736[_0xaa2d('0x142')]][_0xaa2d('0x133')]=!![];}}};Preview[_0xaa2d('0xf')]['syncBlindTransfer']=function(_0x50a8a3){if(_0x50a8a3){if(this[_0xaa2d('0x16')][_0x50a8a3[_0xaa2d('0x143')]]){this[_0xaa2d('0x16')][_0x50a8a3['transfererlinkedid']][_0xaa2d('0x133')]=!![];}}};module[_0xaa2d('0x144')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 548e018..f7d019b 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 _0xe5d8=['then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe5d8,0xf4));var _0x8e5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe5d8[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x8e5d('0x0'));var BPromise=require(_0x8e5d('0x1'));var logger=require(_0x8e5d('0x2'))(_0x8e5d('0x3'));var cmHopper=require(_0x8e5d('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8e5d('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8e5d('0x6'));function loggerCatch(_0x3903da){return function(_0x43e50c){logger['error'](_0x3903da,util['inspect'](_0x43e50c,{'showHidden':![],'depth':null}));};}function create(_0xfc0aa5){return cmHopperHistory[_0x8e5d('0x7')](_0xfc0aa5)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x9')));}function createAgent(_0x1cae45){return BPromise[_0x8e5d('0xa')]()[_0x8e5d('0xb')](agentReportPreview[_0x8e5d('0x7')](_0x1cae45))[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x9')));}function moveContact(_0x55ec5d){return cmHopper[_0x8e5d('0xc')](_0x55ec5d,!![])['catch'](loggerCatch(_0x8e5d('0xd')));}exports[_0x8e5d('0xe')]=function(_0x4b41a3){return cmHopperBlack[_0x8e5d('0xe')](_0x4b41a3)[_0x8e5d('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8e5d('0xf')]=function(_0x2c5705){return BPromise[_0x8e5d('0xa')]()['then'](cmHopper[_0x8e5d('0xf')](_0x2c5705))['catch'](loggerCatch(_0x8e5d('0x10')));};exports[_0x8e5d('0x7')]=function(_0xd7dfe4,_0x491402){create(_0xd7dfe4)[_0x8e5d('0x8')](loggerCatch(_0x491402));moveContact(_0xd7dfe4)[_0x8e5d('0x8')](loggerCatch(_0x491402));};exports[_0x8e5d('0x11')]=function(_0x153aec,_0x2f3b7d){createAgent(_0x153aec)['catch'](loggerCatch(_0x2f3b7d));};exports[_0x8e5d('0x12')]=function(_0x534428,_0x10687b){create(_0x534428)[_0x8e5d('0x8')](loggerCatch(_0x10687b));};exports[_0x8e5d('0x13')]=function(_0x532265,_0x376b3d){moveContact(_0x532265)[_0x8e5d('0x8')](loggerCatch(_0x376b3d));};exports[_0x8e5d('0x14')]=function(_0x5f1e30,_0x1560c9,_0x4d5c39){if(_0x1560c9){_0x5f1e30[_0x8e5d('0x15')]=null;}if(_0x4d5c39){_0x5f1e30['active']=![];}return cmHopper['rescheduleContact'](_0x5f1e30)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x16')));};exports[_0x8e5d('0x17')]=function(_0x2e0575){return cmHopper[_0x8e5d('0x17')](_0x2e0575)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x18')));};exports['unlockContact']=function(_0x5a5984){return cmHopper['unlockContact']({'UserId':null},_0x5a5984,0x1)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x19')));};exports[_0x8e5d('0x1a')]=function(_0x337fc7){return cmHopper[_0x8e5d('0x1b')]({'active':![]},_0x337fc7,0x1)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x1c')));};exports[_0x8e5d('0x1d')]=function(_0x5a952f){var _0x436d0e={};_0x436d0e[_0x8e5d('0x1e')]=_0x5a952f[_0x8e5d('0x1e')];_0x436d0e[_0x8e5d('0x1f')]=_0x5a952f['uniqueid'];_0x436d0e[_0x8e5d('0x20')]=_0x5a952f[_0x8e5d('0x20')];_0x436d0e[_0x8e5d('0x21')]=_0x5a952f['calleridname'];_0x436d0e[_0x8e5d('0x22')]=_0x5a952f[_0x8e5d('0x22')];_0x436d0e[_0x8e5d('0x23')]=_0x5a952f['answertime'];_0x436d0e[_0x8e5d('0x24')]=_0x5a952f[_0x8e5d('0x25')];_0x436d0e[_0x8e5d('0x26')]=0x1;_0x436d0e[_0x8e5d('0x27')]=_0x5a952f['endtime'];_0x436d0e[_0x8e5d('0x28')]=_0x5a952f[_0x8e5d('0x29')];_0x436d0e[_0x8e5d('0x2a')]='from-sip';_0x436d0e[_0x8e5d('0x2b')]=_0x8e5d('0x2c');_0x436d0e[_0x8e5d('0x2d')]=0x0;_0x436d0e[_0x8e5d('0x2e')]=0x1;_0x436d0e[_0x8e5d('0x2f')]=_0x5a952f[_0x8e5d('0x29')];_0x436d0e['queuecallerexitreason']=_0x8e5d('0x30');return BPromise['resolve']()[_0x8e5d('0xb')](voiceQueueReport['create'](_0x436d0e))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x8e5d('0x31')]=function(_0x6fdf8d,_0x48ff39){return BPromise[_0x8e5d('0xa')]()['then'](cmHopper[_0x8e5d('0x31')](_0x6fdf8d,_0x48ff39))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0xe0275e){return cmHopper['rescheduleContact'](_0xe0275e,!![],!![])[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x32')));}; \ No newline at end of file +var _0x3b95=['[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','UserId','active'];(function(_0x414ba2,_0x13cdaa){var _0x5f341f=function(_0x37d382){while(--_0x37d382){_0x414ba2['push'](_0x414ba2['shift']());}};_0x5f341f(++_0x13cdaa);}(_0x3b95,0x89));var _0x53b9=function(_0x113b6b,_0x5081f4){_0x113b6b=_0x113b6b-0x0;var _0x515e0f=_0x3b95[_0x113b6b];return _0x515e0f;};'use strict';var util=require(_0x53b9('0x0'));var BPromise=require(_0x53b9('0x1'));var logger=require(_0x53b9('0x2'))(_0x53b9('0x3'));var cmHopper=require(_0x53b9('0x4'));var cmHopperHistory=require(_0x53b9('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x53b9('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4eed41){return function(_0x426632){logger[_0x53b9('0x7')](_0x4eed41,util[_0x53b9('0x8')](_0x426632,{'showHidden':![],'depth':null}));};}function create(_0x743132){return cmHopperHistory[_0x53b9('0x9')](_0x743132)[_0x53b9('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x393f1d){return BPromise[_0x53b9('0xb')]()[_0x53b9('0xc')](agentReportPreview['createHistory'](_0x393f1d))['catch'](loggerCatch(_0x53b9('0xd')));}function moveContact(_0x3027e7){return cmHopper[_0x53b9('0xe')](_0x3027e7,!![])[_0x53b9('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x53b9('0xf')]=function(_0x48cd92){return cmHopperBlack['checkIsBlackList'](_0x48cd92)[_0x53b9('0xa')](loggerCatch(_0x53b9('0x10')));};exports[_0x53b9('0x11')]=function(_0x384794){return BPromise[_0x53b9('0xb')]()['then'](cmHopper[_0x53b9('0x11')](_0x384794))[_0x53b9('0xa')](loggerCatch(_0x53b9('0x12')));};exports[_0x53b9('0x9')]=function(_0x5729ff,_0x21e106){create(_0x5729ff)[_0x53b9('0xa')](loggerCatch(_0x21e106));moveContact(_0x5729ff)[_0x53b9('0xa')](loggerCatch(_0x21e106));};exports['createAgentHistory']=function(_0x377e21,_0x1ad710){createAgent(_0x377e21)[_0x53b9('0xa')](loggerCatch(_0x1ad710));};exports['createCustomerHistory']=function(_0xfb351,_0x114fdb){create(_0xfb351)[_0x53b9('0xa')](loggerCatch(_0x114fdb));};exports['createCustomerFinal']=function(_0x28f1c7,_0x57c1f3){moveContact(_0x28f1c7)[_0x53b9('0xa')](loggerCatch(_0x57c1f3));};exports[_0x53b9('0x13')]=function(_0x31fd11,_0x75a62,_0x22da5f){if(_0x75a62){_0x31fd11[_0x53b9('0x14')]=null;}if(_0x22da5f){_0x31fd11[_0x53b9('0x15')]=![];}return cmHopper[_0x53b9('0x13')](_0x31fd11)[_0x53b9('0xa')](loggerCatch(_0x53b9('0x16')));};exports[_0x53b9('0x17')]=function(_0x510795){return cmHopper['countReScheduled'](_0x510795)[_0x53b9('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x371f80){return cmHopper[_0x53b9('0x18')]({'UserId':null},_0x371f80,0x1)[_0x53b9('0xa')](loggerCatch(_0x53b9('0x19')));};exports[_0x53b9('0x1a')]=function(_0x5d4fed){return cmHopper[_0x53b9('0x18')]({'active':![]},_0x5d4fed,0x1)['catch'](loggerCatch(_0x53b9('0x1b')));};exports[_0x53b9('0x1c')]=function(_0x2ce8be){var _0x2162d6={};_0x2162d6[_0x53b9('0x1d')]=_0x2ce8be['type'];_0x2162d6['uniqueid']=_0x2ce8be[_0x53b9('0x1e')];_0x2162d6['calleridnum']=_0x2ce8be[_0x53b9('0x1f')];_0x2162d6['calleridname']=_0x2ce8be[_0x53b9('0x20')];_0x2162d6[_0x53b9('0x21')]=_0x2ce8be[_0x53b9('0x21')];_0x2162d6[_0x53b9('0x22')]=_0x2ce8be[_0x53b9('0x23')];_0x2162d6[_0x53b9('0x24')]=_0x2ce8be[_0x53b9('0x23')];_0x2162d6[_0x53b9('0x25')]=0x1;_0x2162d6[_0x53b9('0x26')]=_0x2ce8be['endtime'];_0x2162d6['connectedlinename']=_0x2ce8be['membername'];_0x2162d6[_0x53b9('0x27')]=_0x53b9('0x28');_0x2162d6[_0x53b9('0x29')]=_0x53b9('0x2a');_0x2162d6[_0x53b9('0x2b')]=0x0;_0x2162d6[_0x53b9('0x2c')]=0x1;_0x2162d6['lastAssignedTo']=_0x2ce8be[_0x53b9('0x2d')];_0x2162d6[_0x53b9('0x2e')]=_0x53b9('0x2f');return BPromise[_0x53b9('0xb')]()[_0x53b9('0xc')](voiceQueueReport[_0x53b9('0x30')](_0x2162d6))[_0x53b9('0xa')](loggerCatch(_0x53b9('0x31')));};exports[_0x53b9('0x32')]=function(_0x293fc0,_0x5a1676){return BPromise[_0x53b9('0xb')]()[_0x53b9('0xc')](cmHopper[_0x53b9('0x32')](_0x293fc0,_0x5a1676))[_0x53b9('0xa')](loggerCatch(_0x53b9('0x33')));};exports[_0x53b9('0x34')]=function(_0x54b951){return cmHopper[_0x53b9('0x13')](_0x54b951,!![],!![])[_0x53b9('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 243b2f0..20807a0 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 _0x8cbc=['monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','endtime','logAgent','statedesc','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','YYYY-MM-DD\x20HH:mm:ss','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','CampaignId','idContact','campaigntype','dialAnswer','active','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2'];(function(_0x4e005f,_0x3e7ba0){var _0x990170=function(_0x4c6549){while(--_0x4c6549){_0x4e005f['push'](_0x4e005f['shift']());}};_0x990170(++_0x3e7ba0);}(_0x8cbc,0x18b));var _0xc8cb=function(_0x2277e3,_0x21e6bf){_0x2277e3=_0x2277e3-0x0;var _0xeded2a=_0x8cbc[_0x2277e3];return _0xeded2a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc8cb('0x0'));var logger=require(_0xc8cb('0x1'))(_0xc8cb('0x2'));var ipAgi=process[_0xc8cb('0x3')][_0xc8cb('0x4')]||_0xc8cb('0x5');var utils=require(_0xc8cb('0x6'));exports[_0xc8cb('0x7')]=function(_0x5e6acd){return function(_0x1c38cb){logger[_0xc8cb('0x8')](_0x5e6acd,util[_0xc8cb('0x9')](_0x1c38cb,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5756bf,_0x1d3b5f){logger[_0xc8cb('0xa')](_0x5756bf,util['inspect'](_0x1d3b5f,{'showHidden':![],'depth':null}));};exports[_0xc8cb('0xb')]=function(_0x50b2bc,_0x16bfbe){logger[_0xc8cb('0x8')](_0x50b2bc,util[_0xc8cb('0x9')](_0x16bfbe,{'showHidden':![],'depth':null}));};exports[_0xc8cb('0xc')]=function(_0x106d75){return function(_0x475d4d){logger[_0xc8cb('0xa')](_0x106d75,util[_0xc8cb('0x9')](_0x475d4d,{'showHidden':![],'depth':null}));};};exports[_0xc8cb('0xd')]=function(_0x14f881,_0x447159,_0x112b67){return{'message':_0x14f881,'unlock':_0x447159,'active':_0x112b67};};exports[_0xc8cb('0xe')]=function(_0x3dcaf0,_0xda8acf,_0x2083b5){if(!_[_0xc8cb('0xf')](_0x2083b5)&&'string'===typeof _0x2083b5&&!_[_0xc8cb('0x10')](_0x2083b5)){if(!_[_0xc8cb('0xf')](_0xda8acf)&&_0xc8cb('0x11')===typeof _0xda8acf&&!_['isEmpty'](_0xda8acf)){return util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0xda8acf,_0x2083b5);}return util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0x2083b5,_0x2083b5);}if(!_[_0xc8cb('0xf')](_0x3dcaf0)&&_0xc8cb('0x11')===typeof _0x3dcaf0&&!_[_0xc8cb('0x10')](_0x3dcaf0)){return _0x3dcaf0;}return'\x22\x22\x20<>';};exports[_0xc8cb('0x14')]=function(_0x15c39d){if(_[_0xc8cb('0x15')](_0x15c39d)){return![];}return _0x15c39d;};exports['addVariables']=function(_0x3cd48f,_0xe1cf06,_0x4c8abd,_0x1512dd,_0x479156,_0xdeae61){var _0x1c9694={'XMD-QUEUE':_0xe1cf06[_0xc8cb('0x16')]?_0xe1cf06[_0xc8cb('0x16')]['name']:'','XMD-CALLERID':_0x1512dd,'XMD-CALLERID-PREVIEW':_0xdeae61?util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0xdeae61['calleridname'],_0xdeae61[_0xc8cb('0x17')]):_0x1512dd,'XMD-DIALID':_0x479156,'XMD-CONTACTID':_0xe1cf06[_0xc8cb('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1512dd,'XMD-VOICEQUEUEID':_0xe1cf06['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4c8abd,'XMD-DIALTIMEOUT':_0x3cd48f[_0xc8cb('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xc8cb('0x12')](_0xc8cb('0x1a'),_0x3cd48f[_0xc8cb('0x1b')]?'g':'',_[_0xc8cb('0x10')](_0x3cd48f[_0xc8cb('0x1c')])?'':_0xc8cb('0x1d')),'XMD-DIALURL':_0x3cd48f['dialPreviewUrl']||'','XMD-AGI':_0x3cd48f['dialQueueProject']?util['format'](_0xc8cb('0x1e'),ipAgi,_0x3cd48f[_0xc8cb('0x1f')]):_0xc8cb('0x20'),'XMD-AGIAFTER':_0x3cd48f[_0xc8cb('0x1b')]?util[_0xc8cb('0x12')](_0xc8cb('0x1e'),ipAgi,_0x3cd48f[_0xc8cb('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xdeae61?_0xdeae61[_0xc8cb('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0xdeae61?_0xdeae61[_0xc8cb('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc8cb('0x10')](_0x3cd48f[_0xc8cb('0x1c')])){_0x1c9694[util[_0xc8cb('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3cd48f[_0xc8cb('0x1c')];_0x1c9694[util[_0xc8cb('0x12')]('%s',_0xc8cb('0x23'))]=_0x479156;}return _0x1c9694;};exports['toLowerVariables']=function(_0x6e5a1a){var _0x242aaf={};for(var _0x15d431 in _0x6e5a1a){if(_0x6e5a1a[_0xc8cb('0x24')](_0x15d431)){_0x242aaf[util[_0xc8cb('0x12')]('%s',_[_0xc8cb('0x25')](_0x15d431))]=_0x6e5a1a[_0x15d431];}}return{'variables':_0x242aaf};};exports[_0xc8cb('0x26')]=function(_0x126da7,_0x80c67d){if(!_[_0xc8cb('0x15')](_0x126da7)){if(_0x126da7[_0xc8cb('0x24')]('originated')){if(_0x126da7[_0xc8cb('0x27')]>0x0){_0x126da7[_0xc8cb('0x27')]-=0x1;}else{logger[_0xc8cb('0x8')](_0xc8cb('0x28'),_0x80c67d);}}}else{logger[_0xc8cb('0x8')](_0xc8cb('0x29'),_0x80c67d);}};exports[_0xc8cb('0x2a')]=function(_0x2c057e){var _0x581bf2=moment()[_0xc8cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c057e[_0xc8cb('0x2b')]=0xd;_0x2c057e['statedesc']=_0xc8cb('0x2c');_0x2c057e[_0xc8cb('0x2d')]=_0x581bf2;_0x2c057e['responsetime']=_0x581bf2;_0x2c057e[_0xc8cb('0x2e')]=_0x581bf2;};exports[_0xc8cb('0x2f')]=function(_0x2489f0,_0x1ab30e,_0xbaf9d1){var _0x37bdba=moment()[_0xc8cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2489f0[_0xc8cb('0x2b')]=_0x1ab30e;_0x2489f0[_0xc8cb('0x30')]=_0xbaf9d1;_0x2489f0[_0xc8cb('0x31')]=_0x37bdba;_0x2489f0[_0xc8cb('0x32')]=utils[_0xc8cb('0x33')](_0x2489f0['responsetime'],_0x2489f0[_0xc8cb('0x2d')]);};exports[_0xc8cb('0x34')]=function(_0x309750,_0x35205c,_0x216b36){_0x309750[_0xc8cb('0x35')]=_0x35205c;_0x309750[_0xc8cb('0x36')]=_0x216b36;};exports['logCustomer']=function(_0x3d5a26,_0x3785c8,_0xdbb364){var _0x13b691=moment()[_0xc8cb('0x12')](_0xc8cb('0x37'));_0x3d5a26[_0xc8cb('0x2b')]=_0x3785c8;_0x3d5a26[_0xc8cb('0x30')]=_0xdbb364;_0x3d5a26[_0xc8cb('0x31')]=_0x3d5a26['responsetime']?_0x3d5a26[_0xc8cb('0x31')]:_0x13b691;_0x3d5a26[_0xc8cb('0x2e')]=_0x3d5a26[_0xc8cb('0x2e')]?_0x3d5a26[_0xc8cb('0x2e')]:_0x13b691;_0x3d5a26[_0xc8cb('0x32')]=utils[_0xc8cb('0x33')](_0x3d5a26[_0xc8cb('0x31')]||0x0,_0x3d5a26['starttime']||0x0);_0x3d5a26['talktime']=_0x3d5a26[_0xc8cb('0x38')]?utils[_0xc8cb('0x33')](_0x3d5a26['endtime'],_0x3d5a26[_0xc8cb('0x38')]):0x0;};exports[_0xc8cb('0x39')]=function(_0x2264b7){return _0x2264b7===_0xc8cb('0x3a');};exports[_0xc8cb('0x3b')]=function(_0x3e1e4f,_0x463933,_0x487235,_0x4cbeb9,_0x320923){var _0x51b9a8=_0x4cbeb9?_0xc8cb('0x3c'):_0x3e1e4f[_0xc8cb('0x3d')];_0x51b9a8=_0x320923?_0xc8cb('0x3e'):_0x51b9a8;return{'actionid':_0x3e1e4f[_0xc8cb('0x3f')],'action':_0xc8cb('0x40'),'channel':_0x3e1e4f[_0xc8cb('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x51b9a8,_0x3e1e4f[_0xc8cb('0x17')]),'Exten':_0xc8cb('0x42'),'Context':_0xc8cb('0x43'),'Priority':'1','variable':_0x487235,'timeout':(_0x463933[_0xc8cb('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e1e4f[_0xc8cb('0x3f')]};};exports[_0xc8cb('0x45')]=function(_0x41fe24){return _0x41fe24[_0xc8cb('0x46')]+_0x41fe24['countcongestionretry']+_0x41fe24[_0xc8cb('0x47')]+_0x41fe24[_0xc8cb('0x48')]+_0x41fe24[_0xc8cb('0x49')];};exports['cloneAction']=function(_0x447a15){var _0x271ed0=_[_0xc8cb('0x4a')](_0x447a15);_0x271ed0[_0xc8cb('0x2b')]=0xf;_0x271ed0['statedesc']=_0xc8cb('0x4b');return _0x271ed0;};exports[_0xc8cb('0x4c')]=function(_0x42039d,_0x11e28a,_0x1a0661){var _0x68f8d7={};_0x68f8d7[_0x11e28a]=_0x42039d[_0x11e28a];_0x68f8d7['active']=![];_0x68f8d7[_0xc8cb('0x4d')]=moment()[_0xc8cb('0x4e')](_0x1a0661,_0xc8cb('0x4f'))[_0xc8cb('0x12')](_0xc8cb('0x37'));_0x68f8d7['ContactId']=_0x42039d[_0xc8cb('0x18')];_0x68f8d7[_0xc8cb('0x50')]=_0x42039d[_0xc8cb('0x50')];_0x68f8d7[_0xc8cb('0x51')]=_0x42039d[_0xc8cb('0x51')]||undefined;return _0x68f8d7;};exports[_0xc8cb('0x52')]=function(_0x2f2903,_0x153ed9){if(!_[_0xc8cb('0x15')](_0x2f2903)){if(_0x2f2903['pTalking']>0x0){_0x2f2903[_0xc8cb('0x53')]-=0x1;}else{logger['error'](_0x153ed9,_0xc8cb('0x54'));}}else{logger[_0xc8cb('0x8')](_0x153ed9,_0xc8cb('0x55'));}};exports[_0xc8cb('0x56')]=function(_0x9dd061){if(_0x9dd061<=0x0){return!![];}return![];};function buildObj(_0x5edcd1,_0x251166,_0x41802e){_0x5edcd1[_0xc8cb('0x57')]=_0x251166;_0x5edcd1[_0xc8cb('0x58')]=_0x5edcd1[_0xc8cb('0x59')];_0x5edcd1['interface']=_0x5edcd1[_0xc8cb('0x41')];_0x5edcd1[_0xc8cb('0x5a')]='voice';if(_0x41802e){_0x5edcd1['mandatoryDisposition']=_0x41802e[_0xc8cb('0x5b')];}return _0x5edcd1;}exports['buildObj']=buildObj;exports[_0xc8cb('0x5c')]=function(_0x3160bd){var _0x42c45a={};_0x42c45a['queue']=_0x3160bd[_0xc8cb('0x59')];_0x42c45a[_0xc8cb('0x5d')]=_0x3160bd[_0xc8cb('0x41')];_0x42c45a[_0xc8cb('0x3f')]=_0x3160bd[_0xc8cb('0x3f')];return _0x42c45a;};exports[_0xc8cb('0x5e')]=function(_0xf76de9){var _0x2ffca6=[];for(var _0x139036 in _0xf76de9){if(_0xf76de9[_0xc8cb('0x24')](_0x139036)){if(!_[_0xc8cb('0x15')](_0xf76de9[_0x139036])&&_0xf76de9[_0x139036][_0xc8cb('0x2b')]===_0xc8cb('0x5f')&&_0xf76de9[_0x139036][_0xc8cb('0x60')]===_0xc8cb('0x61')){_0x2ffca6[_0xc8cb('0x62')](_0xf76de9[_0x139036]['id']);}}}return _0x2ffca6;};exports[_0xc8cb('0x63')]=function(_0x1954c3){var _0x481355=moment()[_0xc8cb('0x64')](0x0);var _0x1e4cc4=moment(_0x1954c3)[_0xc8cb('0x64')](0x0);return _0x481355['diff'](_0x1e4cc4,'seconds');};exports['createBody']=function(_0x30d454){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x30d454[_0xc8cb('0x18')],'ListId':_0x30d454[_0xc8cb('0x50')],'VoiceQueueId':_0x30d454['VoiceQueueId']||undefined,'CampaignId':_0x30d454[_0xc8cb('0x65')]||undefined};};exports['filterKey']=function(_0x4ac9dd){if(_0x4ac9dd===_0xc8cb('0x3f')||_0x4ac9dd===_0xc8cb('0x66')||_0x4ac9dd==='queue'||_0x4ac9dd==='type'||_0x4ac9dd===_0xc8cb('0x67')||_0x4ac9dd===_0xc8cb('0x68')||_0x4ac9dd===_0xc8cb('0x35')||_0x4ac9dd===_0xc8cb('0x41')||_0x4ac9dd===_0xc8cb('0x3d')||_0x4ac9dd===_0xc8cb('0x69')||_0x4ac9dd==='calleridnum'||_0x4ac9dd===_0xc8cb('0x4d')||_0x4ac9dd===_0xc8cb('0x46')||_0x4ac9dd===_0xc8cb('0x6a')||_0x4ac9dd===_0xc8cb('0x47')||_0x4ac9dd==='countglobal'||_0x4ac9dd===_0xc8cb('0x6b')||_0x4ac9dd===_0xc8cb('0x6c')||_0x4ac9dd===_0xc8cb('0x6d')||_0x4ac9dd===_0xc8cb('0x6e')||_0x4ac9dd===_0xc8cb('0x18')||_0x4ac9dd===_0xc8cb('0x50')||_0x4ac9dd===_0xc8cb('0x36')||_0x4ac9dd===_0xc8cb('0x51')||_0x4ac9dd===_0xc8cb('0x6f')||_0x4ac9dd===_0xc8cb('0x70')||_0x4ac9dd===_0xc8cb('0x71')||_0x4ac9dd===_0xc8cb('0x72')||_0x4ac9dd==='xmd-listid'||_0x4ac9dd==='xmd-dialurl'||_0x4ac9dd===_0xc8cb('0x73')||_0x4ac9dd===_0xc8cb('0x74')||_0x4ac9dd===_0xc8cb('0x75')||_0x4ac9dd===_0xc8cb('0x76')||_0x4ac9dd===_0xc8cb('0x77')||_0x4ac9dd===_0xc8cb('0x78')||_0x4ac9dd===_0xc8cb('0x79')||_0x4ac9dd===_0xc8cb('0x7a')||_0x4ac9dd==='xmd-agi'||_0x4ac9dd===_0xc8cb('0x7b')||_0x4ac9dd===_0xc8cb('0x7c')||_0x4ac9dd==='rtpaudioqosjitter'||_0x4ac9dd==='rtpaudioqosjitterbridged'||_0x4ac9dd===_0xc8cb('0x7d')||_0x4ac9dd===_0xc8cb('0x7e')||_0x4ac9dd===_0xc8cb('0x7f')||_0x4ac9dd===_0xc8cb('0x80')||_0x4ac9dd===_0xc8cb('0x7b')||_0x4ac9dd===_0xc8cb('0x7c')||_0x4ac9dd===_0xc8cb('0x81')||_0x4ac9dd==='rtpaudioqosjitterbridged'||_0x4ac9dd==='rtpaudioqosloss'||_0x4ac9dd===_0xc8cb('0x7e')||_0x4ac9dd===_0xc8cb('0x7f')||_0x4ac9dd===_0xc8cb('0x80')||_0x4ac9dd==='bridgepeer'||_0x4ac9dd===_0xc8cb('0x82')||_0x4ac9dd===_0xc8cb('0x2b')||_0x4ac9dd===_0xc8cb('0x30')){return![];}return!![];};exports[_0xc8cb('0x83')]=function(_0x5e1b12,_0x168040){var _0x54bf12,_0x130a4d,_0xdd1119;if(_0x168040<=0x0){_0x168040=0x1;}_0x54bf12=new RegExp('\x5cw{0,'+_0x168040+'}$');_0x130a4d=Math[_0xc8cb('0x84')](0xa,_0x168040-0x1);_0xdd1119=Math[_0xc8cb('0x84')](0xa,_0x168040)-0x1;return util[_0xc8cb('0x12')]('%s',_['replace'](_0x5e1b12,_0x54bf12,_[_0xc8cb('0x85')](_0x130a4d,_0xdd1119)));};exports[_0xc8cb('0x86')]=function(_0x226327){var _0x1fe180=_0x226327[_0xc8cb('0x87')](/"(.*?)"/);return _0x1fe180?_0x1fe180[0x1]:_0x226327;};exports[_0xc8cb('0x88')]=function(_0x34e171){var _0x48ef88=_0x34e171[_0xc8cb('0x87')](/<(.*?)>/);return _0x48ef88?_0x48ef88[0x1]:_0x34e171;};function buildNoAnswerEventPayload(_0x43c985,_0x525449){var _0x91da5a=buildObj(_0x43c985,_0xc8cb('0x89'));if(!_[_0xc8cb('0x10')](_0x525449[_0xc8cb('0x8a')])){Object[_0xc8cb('0x8b')](_0x525449[_0xc8cb('0x8a')])[_0xc8cb('0x8c')](function(_0x25e9d6){_0x91da5a[_0x25e9d6['toLowerCase']()]=_0x525449[_0xc8cb('0x8a')][_0x25e9d6];});}return _0x91da5a;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x447c=['diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','active','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','responsetime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff','milliseconds'];(function(_0x1b16ac,_0x108ae2){var _0x424d4b=function(_0x5077d6){while(--_0x5077d6){_0x1b16ac['push'](_0x1b16ac['shift']());}};_0x424d4b(++_0x108ae2);}(_0x447c,0x152));var _0xc447=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x447c[_0x40220a];return _0x3903cc;};'use strict';var util=require(_0xc447('0x0'));var _=require(_0xc447('0x1'));var moment=require(_0xc447('0x2'));var logger=require(_0xc447('0x3'))(_0xc447('0x4'));var ipAgi=process[_0xc447('0x5')][_0xc447('0x6')]||'127.0.0.1';var utils=require(_0xc447('0x7'));exports[_0xc447('0x8')]=function(_0x42f6b0){return function(_0x112335){logger[_0xc447('0x9')](_0x42f6b0,util[_0xc447('0xa')](_0x112335,{'showHidden':![],'depth':null}));};};exports[_0xc447('0xb')]=function(_0x370ac6,_0x4cb4b7){logger[_0xc447('0xc')](_0x370ac6,util['inspect'](_0x4cb4b7,{'showHidden':![],'depth':null}));};exports[_0xc447('0xd')]=function(_0x4f6aeb,_0x5303e4){logger[_0xc447('0x9')](_0x4f6aeb,util[_0xc447('0xa')](_0x5303e4,{'showHidden':![],'depth':null}));};exports[_0xc447('0xe')]=function(_0x4b02ec){return function(_0x36b30d){logger[_0xc447('0xc')](_0x4b02ec,util['inspect'](_0x36b30d,{'showHidden':![],'depth':null}));};};exports[_0xc447('0xf')]=function(_0x4acb6e,_0x3a5268,_0x9c626c){return{'message':_0x4acb6e,'unlock':_0x3a5268,'active':_0x9c626c};};exports[_0xc447('0x10')]=function(_0x20dc15,_0x5555bd,_0x5d4a0f){if(!_[_0xc447('0x11')](_0x5d4a0f)&&_0xc447('0x12')===typeof _0x5d4a0f&&!_[_0xc447('0x13')](_0x5d4a0f)){if(!_[_0xc447('0x11')](_0x5555bd)&&_0xc447('0x12')===typeof _0x5555bd&&!_[_0xc447('0x13')](_0x5555bd)){return util['format']('\x22%s\x22\x20<%s>',_0x5555bd,_0x5d4a0f);}return util[_0xc447('0x14')](_0xc447('0x15'),_0x5d4a0f,_0x5d4a0f);}if(!_[_0xc447('0x11')](_0x20dc15)&&_0xc447('0x12')===typeof _0x20dc15&&!_[_0xc447('0x13')](_0x20dc15)){return _0x20dc15;}return _0xc447('0x16');};exports[_0xc447('0x17')]=function(_0x199453){if(_['isNil'](_0x199453)){return![];}return _0x199453;};exports[_0xc447('0x18')]=function(_0x2ad636,_0x8f353a,_0x20777b,_0x235e8f,_0x4b3b5a,_0x30f69d){var _0x4d1130={'XMD-QUEUE':_0x8f353a['Queue']?_0x8f353a[_0xc447('0x19')]['name']:'','XMD-CALLERID':_0x235e8f,'XMD-CALLERID-PREVIEW':_0x30f69d?util[_0xc447('0x14')](_0xc447('0x15'),_0x30f69d[_0xc447('0x1a')],_0x30f69d['calleridnum']):_0x235e8f,'XMD-DIALID':_0x4b3b5a,'XMD-CONTACTID':_0x8f353a[_0xc447('0x1b')],'XMD-CDRTYPE':_0xc447('0x1c'),'CALLERID(all)':_0x235e8f,'XMD-VOICEQUEUEID':_0x8f353a['VoiceQueueId'],'XMD-DIALCHANNEL':_0x20777b,'XMD-DIALTIMEOUT':_0x2ad636[_0xc447('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xc447('0x14')](_0xc447('0x1e'),_0x2ad636['dialQueueProject2']?'g':'',_[_0xc447('0x13')](_0x2ad636[_0xc447('0x1f')])?'':_0xc447('0x20')),'XMD-DIALURL':_0x2ad636[_0xc447('0x21')]||'','XMD-AGI':_0x2ad636[_0xc447('0x22')]?util[_0xc447('0x14')](_0xc447('0x23'),ipAgi,_0x2ad636[_0xc447('0x22')]):_0xc447('0x24'),'XMD-AGIAFTER':_0x2ad636['dialQueueProject2']?util[_0xc447('0x14')](_0xc447('0x23'),ipAgi,_0x2ad636[_0xc447('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x30f69d?_0x30f69d[_0xc447('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x30f69d?_0x30f69d['originatecalleridname']:'','XMD-DESTINATION':_0xc447('0x27'),'SIPADDHEADER':_0xc447('0x28')};if(!_[_0xc447('0x13')](_0x2ad636[_0xc447('0x1f')])){_0x4d1130[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2ad636['monitor_format'];_0x4d1130[util[_0xc447('0x14')]('%s',_0xc447('0x29'))]=_0x4b3b5a;}return _0x4d1130;};exports[_0xc447('0x2a')]=function(_0x14b0fd){var _0x23266e={};for(var _0x289b40 in _0x14b0fd){if(_0x14b0fd[_0xc447('0x2b')](_0x289b40)){_0x23266e[util['format']('%s',_[_0xc447('0x2c')](_0x289b40))]=_0x14b0fd[_0x289b40];}}return{'variables':_0x23266e};};exports[_0xc447('0x2d')]=function(_0x443195,_0xce534f){if(!_[_0xc447('0x2e')](_0x443195)){if(_0x443195[_0xc447('0x2b')](_0xc447('0x2f'))){if(_0x443195[_0xc447('0x2f')]>0x0){_0x443195[_0xc447('0x2f')]-=0x1;}else{logger[_0xc447('0x9')](_0xc447('0x30'),_0xce534f);}}}else{logger[_0xc447('0x9')](_0xc447('0x31'),_0xce534f);}};exports[_0xc447('0x32')]=function(_0x5b062){var _0x5d3fa0=moment()[_0xc447('0x14')](_0xc447('0x33'));_0x5b062[_0xc447('0x34')]=0xd;_0x5b062[_0xc447('0x35')]='Blacklist';_0x5b062['starttime']=_0x5d3fa0;_0x5b062['responsetime']=_0x5d3fa0;_0x5b062[_0xc447('0x36')]=_0x5d3fa0;};exports['logAgent']=function(_0x2dff39,_0x27b5c,_0x11cb54){var _0x5f4fd3=moment()[_0xc447('0x14')](_0xc447('0x33'));_0x2dff39[_0xc447('0x34')]=_0x27b5c;_0x2dff39[_0xc447('0x35')]=_0x11cb54;_0x2dff39[_0xc447('0x37')]=_0x5f4fd3;_0x2dff39[_0xc447('0x38')]=utils['getSeconds'](_0x2dff39[_0xc447('0x37')],_0x2dff39[_0xc447('0x39')]);};exports[_0xc447('0x3a')]=function(_0x718814,_0x166efc,_0x25e268){_0x718814[_0xc447('0x3b')]=_0x166efc;_0x718814[_0xc447('0x3c')]=_0x25e268;};exports[_0xc447('0x3d')]=function(_0x56d517,_0x485f9a,_0x3217fe){var _0x171399=moment()[_0xc447('0x14')](_0xc447('0x33'));_0x56d517[_0xc447('0x34')]=_0x485f9a;_0x56d517['statedesc']=_0x3217fe;_0x56d517[_0xc447('0x37')]=_0x56d517['responsetime']?_0x56d517[_0xc447('0x37')]:_0x171399;_0x56d517[_0xc447('0x36')]=_0x56d517[_0xc447('0x36')]?_0x56d517['endtime']:_0x171399;_0x56d517[_0xc447('0x38')]=utils[_0xc447('0x3e')](_0x56d517[_0xc447('0x37')]||0x0,_0x56d517[_0xc447('0x39')]||0x0);_0x56d517[_0xc447('0x3f')]=_0x56d517[_0xc447('0x40')]?utils['getSeconds'](_0x56d517[_0xc447('0x36')],_0x56d517[_0xc447('0x40')]):0x0;};exports[_0xc447('0x41')]=function(_0x49bc3a){return _0x49bc3a===_0xc447('0x42');};exports['variablesAction']=function(_0x20eb5f,_0x601f65,_0x323628,_0x5245fe,_0x3d2c6f){var _0x354712=_0x5245fe?_0xc447('0x43'):_0x20eb5f[_0xc447('0x1a')];_0x354712=_0x3d2c6f?_0xc447('0x44'):_0x354712;return{'actionid':_0x20eb5f[_0xc447('0x45')],'action':_0xc447('0x46'),'channel':_0x20eb5f[_0xc447('0x47')],'callerid':util[_0xc447('0x14')](_0xc447('0x15'),_0x354712,_0x20eb5f[_0xc447('0x48')]),'Exten':_0xc447('0x27'),'Context':_0xc447('0x49'),'Priority':'1','variable':_0x323628,'timeout':(_0x601f65[_0xc447('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20eb5f[_0xc447('0x45')]};};exports[_0xc447('0x4b')]=function(_0x1f3f13){return _0x1f3f13[_0xc447('0x4c')]+_0x1f3f13[_0xc447('0x4d')]+_0x1f3f13[_0xc447('0x4e')]+_0x1f3f13[_0xc447('0x4f')]+_0x1f3f13[_0xc447('0x50')];};exports[_0xc447('0x51')]=function(_0x424255){var _0x5f049e=_[_0xc447('0x52')](_0x424255);_0x5f049e[_0xc447('0x34')]=0xf;_0x5f049e[_0xc447('0x35')]='Global';return _0x5f049e;};exports['scheduledAt']=function(_0x3b3161,_0x2ef177,_0x64f7a5){var _0xe95cac={};_0xe95cac[_0x2ef177]=_0x3b3161[_0x2ef177];_0xe95cac['active']=![];_0xe95cac[_0xc447('0x53')]=moment()[_0xc447('0x54')](_0x64f7a5,_0xc447('0x55'))[_0xc447('0x14')](_0xc447('0x33'));_0xe95cac[_0xc447('0x1b')]=_0x3b3161[_0xc447('0x1b')];_0xe95cac[_0xc447('0x56')]=_0x3b3161[_0xc447('0x56')];_0xe95cac[_0xc447('0x57')]=_0x3b3161[_0xc447('0x57')]||undefined;return _0xe95cac;};exports[_0xc447('0x58')]=function(_0x311063,_0x30ad3d){if(!_[_0xc447('0x2e')](_0x311063)){if(_0x311063['pTalking']>0x0){_0x311063['pTalking']-=0x1;}else{logger[_0xc447('0x9')](_0x30ad3d,_0xc447('0x59'));}}else{logger[_0xc447('0x9')](_0x30ad3d,_0xc447('0x5a'));}};exports['IsNotLoggedIn']=function(_0x44f602){if(_0x44f602<=0x0){return!![];}return![];};function buildObj(_0x35ada0,_0x233719,_0x554dfa){_0x35ada0[_0xc447('0x5b')]=_0x233719;_0x35ada0[_0xc447('0x5c')]=_0x35ada0[_0xc447('0x5d')];_0x35ada0[_0xc447('0x5e')]=_0x35ada0[_0xc447('0x47')];_0x35ada0[_0xc447('0x5f')]=_0xc447('0x60');if(_0x554dfa){_0x35ada0['mandatoryDisposition']=_0x554dfa[_0xc447('0x61')];}return _0x35ada0;}exports[_0xc447('0x62')]=buildObj;exports[_0xc447('0x63')]=function(_0x33b0d1){var _0x5ce92d={};_0x5ce92d[_0xc447('0x5d')]=_0x33b0d1['queue'];_0x5ce92d['interface']=_0x33b0d1[_0xc447('0x47')];_0x5ce92d[_0xc447('0x45')]=_0x33b0d1['uniqueid'];return _0x5ce92d;};exports[_0xc447('0x64')]=function(_0x2802b2){var _0x366e99=[];for(var _0x34c086 in _0x2802b2){if(_0x2802b2['hasOwnProperty'](_0x34c086)){if(!_['isNil'](_0x2802b2[_0x34c086])&&_0x2802b2[_0x34c086][_0xc447('0x34')]===_0xc447('0x65')&&_0x2802b2[_0x34c086][_0xc447('0x66')]==='reachable'){_0x366e99[_0xc447('0x67')](_0x2802b2[_0x34c086]['id']);}}}return _0x366e99;};exports[_0xc447('0x68')]=function(_0x46d479){var _0x3bd38f=moment()[_0xc447('0x69')](0x0);var _0x2c447a=moment(_0x46d479)[_0xc447('0x69')](0x0);return _0x3bd38f[_0xc447('0x6a')](_0x2c447a,_0xc447('0x6b'));};exports[_0xc447('0x6c')]=function(_0x3d5ca8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d5ca8['ContactId'],'ListId':_0x3d5ca8[_0xc447('0x56')],'VoiceQueueId':_0x3d5ca8[_0xc447('0x57')]||undefined,'CampaignId':_0x3d5ca8[_0xc447('0x6d')]||undefined};};exports[_0xc447('0x6e')]=function(_0x4c354b){if(_0x4c354b===_0xc447('0x45')||_0x4c354b===_0xc447('0x6f')||_0x4c354b==='queue'||_0x4c354b===_0xc447('0x70')||_0x4c354b==='campaigntype'||_0x4c354b===_0xc447('0x71')||_0x4c354b==='membername'||_0x4c354b==='channelAgent'||_0x4c354b===_0xc447('0x1a')||_0x4c354b===_0xc447('0x72')||_0x4c354b===_0xc447('0x48')||_0x4c354b===_0xc447('0x53')||_0x4c354b==='countbusyretry'||_0x4c354b===_0xc447('0x4d')||_0x4c354b===_0xc447('0x4e')||_0x4c354b==='countglobal'||_0x4c354b===_0xc447('0x73')||_0x4c354b===_0xc447('0x74')||_0x4c354b===_0xc447('0x75')||_0x4c354b===_0xc447('0x76')||_0x4c354b===_0xc447('0x1b')||_0x4c354b==='ListId'||_0x4c354b===_0xc447('0x3c')||_0x4c354b===_0xc447('0x57')||_0x4c354b===_0xc447('0x77')||_0x4c354b===_0xc447('0x78')||_0x4c354b===_0xc447('0x79')||_0x4c354b===_0xc447('0x7a')||_0x4c354b===_0xc447('0x7b')||_0x4c354b===_0xc447('0x7c')||_0x4c354b==='xmd-dialtimeout'||_0x4c354b==='xmd-dialoptions'||_0x4c354b==='xmd-dialid'||_0x4c354b===_0xc447('0x7d')||_0x4c354b==='xmd-contactid'||_0x4c354b===_0xc447('0x7e')||_0x4c354b==='xmd-callerid'||_0x4c354b===_0xc447('0x7f')||_0x4c354b===_0xc447('0x80')||_0x4c354b===_0xc447('0x81')||_0x4c354b===_0xc447('0x82')||_0x4c354b===_0xc447('0x83')||_0x4c354b===_0xc447('0x84')||_0x4c354b===_0xc447('0x85')||_0x4c354b==='rtpaudioqoslossbridged'||_0x4c354b===_0xc447('0x86')||_0x4c354b===_0xc447('0x87')||_0x4c354b==='rtpaudioqos'||_0x4c354b==='rtpaudioqosbridged'||_0x4c354b===_0xc447('0x83')||_0x4c354b===_0xc447('0x84')||_0x4c354b===_0xc447('0x85')||_0x4c354b===_0xc447('0x88')||_0x4c354b==='rtpaudioqosrtt'||_0x4c354b==='rtpaudioqosrttbridged'||_0x4c354b===_0xc447('0x89')||_0x4c354b===_0xc447('0x8a')||_0x4c354b==='state'||_0x4c354b===_0xc447('0x35')){return![];}return!![];};exports[_0xc447('0x8b')]=function(_0x445db6,_0x19f4fb){var _0x395172,_0x3375eb,_0x56639e;if(_0x19f4fb<=0x0){_0x19f4fb=0x1;}_0x395172=new RegExp(_0xc447('0x8c')+_0x19f4fb+'}$');_0x3375eb=Math[_0xc447('0x8d')](0xa,_0x19f4fb-0x1);_0x56639e=Math[_0xc447('0x8d')](0xa,_0x19f4fb)-0x1;return util[_0xc447('0x14')]('%s',_['replace'](_0x445db6,_0x395172,_['random'](_0x3375eb,_0x56639e)));};exports[_0xc447('0x8e')]=function(_0x1ad161){var _0x1f1de5=_0x1ad161[_0xc447('0x8f')](/"(.*?)"/);return _0x1f1de5?_0x1f1de5[0x1]:_0x1ad161;};exports['extractCalleridNumber']=function(_0xc7044b){var _0x20f7eb=_0xc7044b[_0xc447('0x8f')](/<(.*?)>/);return _0x20f7eb?_0x20f7eb[0x1]:_0xc7044b;};function buildNoAnswerEventPayload(_0x899a03,_0x4d77bb){var _0x3711eb=buildObj(_0x899a03,_0xc447('0x90'));if(!_[_0xc447('0x13')](_0x4d77bb[_0xc447('0x91')])){Object['keys'](_0x4d77bb[_0xc447('0x91')])['forEach'](function(_0x12e8cd){_0x3711eb[_0x12e8cd[_0xc447('0x92')]()]=_0x4d77bb[_0xc447('0x91')][_0x12e8cd];});}return _0x3711eb;}exports[_0xc447('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6f58cb2..efe3bef 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 _0xa6ed=['boolean','queueremove','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x527e4a,_0x18b84c){var _0x2b6622=function(_0x1404e8){while(--_0x1404e8){_0x527e4a['push'](_0x527e4a['shift']());}};_0x2b6622(++_0x18b84c);}(_0xa6ed,0x1bf));var _0xda6e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa6ed[_0x2c91e9];return _0x13f0ff;};'use strict';exports[_0xda6e('0x0')]={'queue':{'type':_0xda6e('0x1'),'required':!![]},'interface':{'type':_0xda6e('0x1'),'required':!![]},'membername':{'type':_0xda6e('0x1'),'required':!![]},'penalty':{'type':_0xda6e('0x2'),'required':![]},'paused':{'type':_0xda6e('0x3'),'required':![]}};exports[_0xda6e('0x4')]={'queue':{'type':_0xda6e('0x1'),'required':!![]},'interface':{'type':_0xda6e('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xda6e('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xda6e('0x1'),'required':![]}};exports[_0xda6e('0x5')]={'module':{'type':_0xda6e('0x1'),'required':![]}};exports[_0xda6e('0x6')]={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xda6e('0x1')},'mixmonitorid':{'type':_0xda6e('0x1')}};exports[_0xda6e('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xda6e('0x8')]={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]},'exten':{'type':_0xda6e('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x80ca=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','voicechannel'];(function(_0x4a46d3,_0x1d41d4){var _0x2dde96=function(_0x325b94){while(--_0x325b94){_0x4a46d3['push'](_0x4a46d3['shift']());}};_0x2dde96(++_0x1d41d4);}(_0x80ca,0x13d));var _0xa80c=function(_0x1f2e74,_0xbcb68b){_0x1f2e74=_0x1f2e74-0x0;var _0x2802fc=_0x80ca[_0x1f2e74];return _0x2802fc;};'use strict';exports[_0xa80c('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xa80c('0x1'),'required':!![]},'penalty':{'type':_0xa80c('0x2'),'required':![]},'paused':{'type':_0xa80c('0x3'),'required':![]}};exports[_0xa80c('0x4')]={'queue':{'type':_0xa80c('0x1'),'required':!![]},'interface':{'type':_0xa80c('0x1'),'required':!![]}};exports[_0xa80c('0x5')]={'interface':{'type':_0xa80c('0x1'),'required':!![]},'paused':{'type':_0xa80c('0x3')},'reason':{'type':_0xa80c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xa80c('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xa80c('0x1'),'required':!![]}};exports[_0xa80c('0x6')]={'uniqueid':{'type':_0xa80c('0x1'),'required':!![]},'filename':{'type':_0xa80c('0x1')},'format':{'type':_0xa80c('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xa80c('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa80c('0x8')]={'uniqueid':{'type':_0xa80c('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xa80c('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fc6af32..a841376 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0xa6bc7b,_0x2169e8){var _0x1e77b8=function(_0x2bf02c){while(--_0x2bf02c){_0xa6bc7b['push'](_0xa6bc7b['shift']());}};_0x1e77b8(++_0x2169e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0xb10b[_0x5baf32];return _0x539cae;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2032,0xd9));var _0x2203=function(_0x168044,_0x42e397){_0x168044=_0x168044-0x0;var _0x33cb61=_0x2032[_0x168044];return _0x33cb61;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e96a26b..a4a5a28 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 _0xa33a=['assign','mergeDBDataToRealtime'];(function(_0x230ce1,_0x3c463a){var _0x1e05fc=function(_0x251938){while(--_0x251938){_0x230ce1['push'](_0x230ce1['shift']());}};_0x1e05fc(++_0x3c463a);}(_0xa33a,0x15a));var _0xaa33=function(_0x41da76,_0x4055a3){_0x41da76=_0x41da76-0x0;var _0x3a6ece=_0xa33a[_0x41da76];return _0x3a6ece;};'use strict';function mergeDBDataToRealtime(_0x34e444,_0x388b64){var _0x1248cf=Object[_0xaa33('0x0')]({},_0x34e444);for(var _0x3d5731 in _0x388b64){if(_0x1248cf['hasOwnProperty'](_0x3d5731)){_0x1248cf[_0x3d5731]=_0x388b64[_0x3d5731];}}return _0x1248cf;}exports[_0xaa33('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x4280=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x1fc3ae,_0x14e4b8){var _0x5ede72=function(_0x1e3b0e){while(--_0x1e3b0e){_0x1fc3ae['push'](_0x1fc3ae['shift']());}};_0x5ede72(++_0x14e4b8);}(_0x4280,0xe8));var _0x0428=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4280[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0x3aa81f,_0x3f0042){var _0x3826e5=Object[_0x0428('0x0')]({},_0x3aa81f);for(var _0xb649e0 in _0x3f0042){if(_0x3826e5[_0x0428('0x1')](_0xb649e0)){_0x3826e5[_0xb649e0]=_0x3f0042[_0xb649e0];}}return _0x3826e5;}exports[_0x0428('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 613cfb1..24dfb80 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 _0x1a75=['monitors','filename','createdAt','exten','calleridname','connectedlinename','membername','voiceAgentReport','isArray','forEach','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','accountcode','name','find','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor'];(function(_0x186bcb,_0xb42ad7){var _0x13c5b7=function(_0x3f6415){while(--_0x3f6415){_0x186bcb['push'](_0x186bcb['shift']());}};_0x13c5b7(++_0xb42ad7);}(_0x1a75,0x6d));var _0x51a7=function(_0x1906da,_0x57a578){_0x1906da=_0x1906da-0x0;var _0x31f489=_0x1a75[_0x1906da];return _0x31f489;};'use strict';var _=require('lodash');var moment=require(_0x51a7('0x0'));var util=require(_0x51a7('0x1'));var config=require(_0x51a7('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x51a7('0x3'));var RpcVoiceCallReport=require(_0x51a7('0x4'));var RpcVoiceDialReport=require(_0x51a7('0x5'));var RpcMemberReport=require(_0x51a7('0x6'));var RpcVoiceQueueReport=require(_0x51a7('0x7'));var RpcVoiceRecording=require(_0x51a7('0x8'));var RpcVoiceTransferReport=require(_0x51a7('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x51a7('0xa'));var VoiceAgentReport=require(_0x51a7('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x51a7('0xc'));function Report(_0x15267b){this[_0x51a7('0xd')]=_0x15267b;this[_0x51a7('0xe')]=_0x15267b[_0x51a7('0xe')];this['telephones']=_0x15267b[_0x51a7('0xf')];}Report['prototype'][_0x51a7('0x10')]=function(_0x1f0840){var _0x23a735=new VoiceQueueReport(this[_0x51a7('0xd')]);var _0x351a3a=new VoiceAgentReport(this[_0x51a7('0xd')]);var _0x3cc171=new VoiceDialReport(this[_0x51a7('0xd')]);var _0xcc9377=new VoiceCallReport(this[_0x51a7('0xd')]);var _0x29a9ae=new UserReport(this[_0x51a7('0xd')]);if(config[_0x51a7('0x11')]&&config[_0x51a7('0x11')]['disabled']){ami['on'](_0x51a7('0x12'),this[_0x51a7('0x13')]['bind'](this));ami['on'](_0x51a7('0x14'),this[_0x51a7('0x15')][_0x51a7('0x16')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x51a7('0x16')](this));ami['on'](_0x51a7('0x17'),this[_0x51a7('0x18')][_0x51a7('0x16')](this));ami['on'](_0x51a7('0x19'),this[_0x51a7('0x1a')][_0x51a7('0x16')](this));ami['on'](_0x51a7('0x1b'),this['attendedTransfer'][_0x51a7('0x16')](this));}};Report[_0x51a7('0x1c')][_0x51a7('0x1d')]=function(_0x3912c0){var _0x15caaa;_0x15caaa=_['find'](this['agents'],function(_0x223358){return _0x223358[_0x51a7('0x1e')]==_0x3912c0||_0x223358[_0x51a7('0x1f')]==_0x3912c0;});if(_['isNil'](_0x15caaa)){var _0x5804db=_[_0x51a7('0x20')](this[_0x51a7('0xf')],function(_0x25d5e6){return _0x25d5e6[_0x51a7('0x1e')]==_0x3912c0||_0x25d5e6[_0x51a7('0x1f')]==_0x3912c0;});if(_0x5804db){_0x15caaa=_[_0x51a7('0x20')](this['agents'],function(_0xa3e70d){return _0xa3e70d[_0x51a7('0x21')]==util[_0x51a7('0x22')](_0x51a7('0x23'),_0x5804db[_0x51a7('0x1f')]);});}}return _0x15caaa;};Report[_0x51a7('0x1c')]['voiceQueueReport']=function(_0x5b1f90){for(var _0x3ff01a=0x0;_0x3ff01a<_0x5b1f90[_0x51a7('0x24')];_0x3ff01a+=0x1){var _0x24d0b2=this[_0x51a7('0x1d')](_0x5b1f90[_0x3ff01a][_0x51a7('0x25')]);if(_0x24d0b2){_0x5b1f90[_0x3ff01a][_0x51a7('0x1e')]=_0x24d0b2[_0x51a7('0x1e')];_0x5b1f90[_0x3ff01a]['assigned']=!![];_0x5b1f90[_0x3ff01a][_0x51a7('0x26')]=_0x24d0b2[_0x51a7('0x1f')];_0x5b1f90[_0x3ff01a][_0x51a7('0x21')]=_[_0x51a7('0x27')](_0x24d0b2['interface'])?util[_0x51a7('0x22')](_0x51a7('0x23'),_0x24d0b2[_0x51a7('0x1f')]):_0x24d0b2[_0x51a7('0x21')];if(_0x5b1f90[_0x3ff01a][_0x51a7('0x28')]){_0x5b1f90[_0x3ff01a][_0x51a7('0x29')]=moment()[_0x51a7('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5b1f90[_0x3ff01a]['queuecallerexit']){_0x5b1f90[_0x3ff01a]['queuecallerexitAt']=moment()[_0x51a7('0x22')](_0x51a7('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x5b1f90[_0x3ff01a]);}RpcVoiceQueueReport[_0x51a7('0x2b')](_0x5b1f90[_0x3ff01a]);}};function extractCalleridNumber(_0x552e03){var _0x95e440=_0x552e03[_0x51a7('0x2c')](/<(.*?)>/);return _0x95e440?_0x95e440[0x1]:_0x552e03;}Report[_0x51a7('0x1c')][_0x51a7('0x2d')]=function(_0x66596e){for(var _0x1e9672=0x0;_0x1e9672',_0x479c63['calleridname'],_0x479c63[_0x51a7('0x32')]);}if(RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63['linkedid']]){var _0x50ea84=RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63[_0x51a7('0x44')]];_0x50ea84[_0x51a7('0x45')]=_0x479c63[_0x51a7('0x46')];RpcVoiceTransferReport['blindTransfer'](_0x50ea84);delete RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63[_0x51a7('0x44')]];}if(_[_0x51a7('0x27')](_0x479c63[_0x51a7('0x35')])){_0x479c63[_0x51a7('0x35')]=this[_0x51a7('0x2f')](_0x479c63);}if(_['isNil'](_0x479c63[_0x51a7('0x47')])){var _0x5233e0=_0x479c63[_0x51a7('0x30')][_0x51a7('0x31')]('-')[0x0];var _0x4a39f7=this[_0x51a7('0xe')][_0x5233e0];if(!_0x4a39f7)_0x4a39f7=this[_0x51a7('0x2d')](_0x479c63[_0x51a7('0x1e')]);if(_0x4a39f7){_0x479c63[_0x51a7('0x47')]=_0x4a39f7['id'];_0x479c63['membername']=_0x4a39f7[_0x51a7('0x1f')];}}RpcVoiceCallReport['create'](_0x479c63);if(_0x479c63[_0x51a7('0x48')]){for(var _0x243861=0x0;_0x243861<_0x479c63[_0x51a7('0x49')]['length'];_0x243861+=0x1){_0x479c63['monitorFilename']=_0x479c63[_0x51a7('0x49')][_0x243861][_0x51a7('0x4a')];_0x479c63[_0x51a7('0x4b')]=_0x479c63[_0x51a7('0x49')][_0x243861][_0x51a7('0x4b')];if(_0x479c63[_0x51a7('0x4c')]==_0x51a7('0x3d')){_0x479c63['calleridnum']=_0x479c63['connectedlinenum'];_0x479c63[_0x51a7('0x4d')]=_0x479c63['connectedlinename'];_0x479c63[_0x51a7('0x25')]=_0x479c63['accountcode'];_0x479c63[_0x51a7('0x4e')]=_0x479c63[_0x51a7('0x4f')];_0x479c63[_0x51a7('0x4c')]=_0x479c63['originatecalleridnum'];}else if(_0x479c63[_0x51a7('0x4c')]=='xcally-motion-dialer'){_0x479c63[_0x51a7('0x32')]=_0x479c63['destination'];_0x479c63[_0x51a7('0x4c')]=_0x479c63['originatecalleridnum'];}RpcVoiceRecording['create'](_0x479c63);}}};Report[_0x51a7('0x1c')][_0x51a7('0x50')]=function(_0x6f7d31){if(_[_0x51a7('0x51')](_0x6f7d31)){_0x6f7d31[_0x51a7('0x52')](function(_0x2275da){RpcVoiceAgentReport['create'](_0x2275da);});}else{RpcVoiceAgentReport[_0x51a7('0x2b')](_0x6f7d31);}};Report[_0x51a7('0x1c')][_0x51a7('0x18')]=function(_0x54494e){RpcVoiceDialReport['create'](_0x54494e);var _0x794e19;var _0x2fab9e;var _0x3f70bb=_0x54494e['channel'];if(_['startsWith'](_0x3f70bb,_0x51a7('0x53'))){_0x2fab9e=_0x3f70bb[_0x51a7('0x54')](_0x3f70bb[_0x51a7('0x55')]('/')+0x1,_0x3f70bb[_0x51a7('0x55')]('@'));_0x794e19=_[_0x51a7('0x20')](this['agents'],function(_0x2f8fd1){return _0x2f8fd1['mobile']==_0x2fab9e||_0x2f8fd1[_0x51a7('0x56')]==_0x2fab9e||_0x2f8fd1[_0x51a7('0x1e')]==_0x2fab9e;});}else{_0x2fab9e=_0x3f70bb[_0x51a7('0x54')](_0x3f70bb[_0x51a7('0x55')]('/')+0x1,_0x3f70bb[_0x51a7('0x57')]('-'));_0x794e19=this[_0x51a7('0x1d')](_0x2fab9e);}if(_0x794e19){_0x54494e[_0x51a7('0x21')]=_[_0x51a7('0x27')](_0x794e19[_0x51a7('0x21')])?util[_0x51a7('0x22')](_0x51a7('0x23'),_0x794e19[_0x51a7('0x1f')]):_0x794e19[_0x51a7('0x21')];_0x54494e[_0x51a7('0x4f')]=_0x794e19['name'];_0x54494e['accountcode']=_0x794e19['accountcode'];RpcMemberReport[_0x51a7('0x18')](_0x54494e);}};Report[_0x51a7('0x1c')][_0x51a7('0x1a')]=function(_0x5952b0){RpcVoiceTransferReport[_0x51a7('0x43')][_0x5952b0[_0x51a7('0x58')]]=_0x5952b0;};Report[_0x51a7('0x1c')][_0x51a7('0x59')]=function(_0x1844c7){RpcVoiceTransferReport['attendedTransfer'](_0x1844c7);};module[_0x51a7('0x5a')]=Report; \ No newline at end of file +var _0xaf9b=['calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','exten','xcally-motion-dialer','voiceAgentReport','forEach','substring','indexOf','mobile','transfererlinkedid','attendedTransfer','exports','lodash','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','channel','calleridnum','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview'];(function(_0x4ed997,_0x479eef){var _0x13132d=function(_0x4c24da){while(--_0x4c24da){_0x4ed997['push'](_0x4ed997['shift']());}};_0x13132d(++_0x479eef);}(_0xaf9b,0x18c));var _0xbaf9=function(_0x34407b,_0x75ade6){_0x34407b=_0x34407b-0x0;var _0x3d1302=_0xaf9b[_0x34407b];return _0x3d1302;};'use strict';var _=require(_0xbaf9('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xbaf9('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xbaf9('0x2'));var RpcVoiceCallReport=require(_0xbaf9('0x3'));var RpcVoiceDialReport=require(_0xbaf9('0x4'));var RpcMemberReport=require(_0xbaf9('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xbaf9('0x6'));var RpcVoiceTransferReport=require(_0xbaf9('0x7'));var VoiceQueueReport=require(_0xbaf9('0x8'));var VoiceCallReport=require(_0xbaf9('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xbaf9('0xa'));var UserReport=require('./userReport');function Report(_0x48ece3){this['realtime']=_0x48ece3;this[_0xbaf9('0xb')]=_0x48ece3[_0xbaf9('0xb')];this[_0xbaf9('0xc')]=_0x48ece3[_0xbaf9('0xc')];}Report[_0xbaf9('0xd')][_0xbaf9('0xe')]=function(_0x5d7b1d){var _0x69de56=new VoiceQueueReport(this[_0xbaf9('0xf')]);var _0x4354e3=new VoiceAgentReport(this['realtime']);var _0x30507c=new VoiceDialReport(this[_0xbaf9('0xf')]);var _0x555c68=new VoiceCallReport(this[_0xbaf9('0xf')]);var _0x35bd62=new UserReport(this[_0xbaf9('0xf')]);if(config[_0xbaf9('0x10')]&&config[_0xbaf9('0x10')][_0xbaf9('0x11')]){ami['on'](_0xbaf9('0x12'),this[_0xbaf9('0x13')][_0xbaf9('0x14')](this));ami['on'](_0xbaf9('0x15'),this[_0xbaf9('0x16')][_0xbaf9('0x14')](this));ami['on'](_0xbaf9('0x17'),this['voiceAgentReport'][_0xbaf9('0x14')](this));ami['on'](_0xbaf9('0x18'),this[_0xbaf9('0x19')][_0xbaf9('0x14')](this));ami['on'](_0xbaf9('0x1a'),this[_0xbaf9('0x1b')][_0xbaf9('0x14')](this));ami['on'](_0xbaf9('0x1c'),this['attendedTransfer'][_0xbaf9('0x14')](this));}};Report[_0xbaf9('0xd')][_0xbaf9('0x1d')]=function(_0x97831a){var _0x5638b8;_0x5638b8=_[_0xbaf9('0x1e')](this[_0xbaf9('0xb')],function(_0x14286f){return _0x14286f[_0xbaf9('0x1f')]==_0x97831a||_0x14286f[_0xbaf9('0x20')]==_0x97831a;});if(_[_0xbaf9('0x21')](_0x5638b8)){var _0x1ee6c2=_[_0xbaf9('0x1e')](this['telephones'],function(_0x1bf7b6){return _0x1bf7b6[_0xbaf9('0x1f')]==_0x97831a||_0x1bf7b6['name']==_0x97831a;});if(_0x1ee6c2){_0x5638b8=_[_0xbaf9('0x1e')](this[_0xbaf9('0xb')],function(_0x4253bd){return _0x4253bd[_0xbaf9('0x22')]==util[_0xbaf9('0x23')](_0xbaf9('0x24'),_0x1ee6c2[_0xbaf9('0x20')]);});}}return _0x5638b8;};Report[_0xbaf9('0xd')]['voiceQueueReport']=function(_0x6d68a0){for(var _0x1b70d3=0x0;_0x1b70d3<_0x6d68a0[_0xbaf9('0x25')];_0x1b70d3+=0x1){var _0x5f3b84=this['findAgent'](_0x6d68a0[_0x1b70d3][_0xbaf9('0x26')]);if(_0x5f3b84){_0x6d68a0[_0x1b70d3][_0xbaf9('0x1f')]=_0x5f3b84[_0xbaf9('0x1f')];_0x6d68a0[_0x1b70d3][_0xbaf9('0x27')]=!![];_0x6d68a0[_0x1b70d3][_0xbaf9('0x28')]=_0x5f3b84[_0xbaf9('0x20')];_0x6d68a0[_0x1b70d3][_0xbaf9('0x22')]=_[_0xbaf9('0x21')](_0x5f3b84[_0xbaf9('0x22')])?util['format'](_0xbaf9('0x24'),_0x5f3b84[_0xbaf9('0x20')]):_0x5f3b84[_0xbaf9('0x22')];if(_0x6d68a0[_0x1b70d3][_0xbaf9('0x29')]){_0x6d68a0[_0x1b70d3][_0xbaf9('0x2a')]=moment()[_0xbaf9('0x23')](_0xbaf9('0x2b'));}if(_0x6d68a0[_0x1b70d3][_0xbaf9('0x2c')]){_0x6d68a0[_0x1b70d3][_0xbaf9('0x2d')]=moment()[_0xbaf9('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xbaf9('0x13')](_0x6d68a0[_0x1b70d3]);}RpcVoiceQueueReport[_0xbaf9('0x2e')](_0x6d68a0[_0x1b70d3]);}};function extractCalleridNumber(_0x41c35c){var _0x48f008=_0x41c35c['match'](/<(.*?)>/);return _0x48f008?_0x48f008[0x1]:_0x41c35c;}Report[_0xbaf9('0xd')][_0xbaf9('0x2f')]=function(_0x113cf6){for(var _0x1c7294=0x0;_0x1c72940x0?!![]:![];if(!_0x1f53be){return this[_0xef53('0x1b')](this[_0xef53('0x17')][_0xef53('0x70')]);}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x1e')]=function(_0x3fe689){var _0x371cef=this['summary']['id'];if(this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef]&&this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef][_0x3fe689[_0xef53('0x67')]]){this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef][_0x3fe689[_0xef53('0x67')]][_0xef53('0x12')][_0xef53('0x71')](_0x3fe689);}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x72')]=function(_0x443e38){var _0x9793d1=this;try{if(this[_0xef53('0x73')](_0x443e38)&&this[_0xef53('0x73')](_0x443e38[_0xef53('0x54')])){logger[_0xef53('0x4e')](_0xef53('0x74'),util['inspect'](_0x443e38,{'showHidden':![],'depth':null}));var _0x2604ec=this[_0xef53('0x15')][_0x443e38['queue']];if(_0x2604ec){logger[_0xef53('0x4e')](_0xef53('0x75'),_0x2604ec['name']);this[_0xef53('0x17')][_0xef53('0x63')][_0x2604ec[_0xef53('0x5f')]]={'summaryEvent':_0x443e38};this[_0xef53('0x17')]['statusRequests']+=0x1;return ami[_0xef53('0x62')]({'action':'queuestatus','queue':_0x2604ec['name']})['then'](function(_0x3d6166){if(!_0x9793d1[_0xef53('0x17')][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]]){_0x9793d1[_0xef53('0x17')][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]]={};}_0x9793d1['summary'][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]][_0x3d6166['actionid']]={'queue':_0x2604ec[_0xef53('0x5f')],'agents':[]};})['catch'](function(_0x4602f7){throw _0x4602f7;});}}}catch(_0x5f311c){logger['error'](_0xef53('0x76'),util[_0xef53('0x46')](_0x5f311c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x1b')]=function(_0x567d6e){if(this['summary'][_0xef53('0x6f')]>0x0){this[_0xef53('0x17')][_0xef53('0x70')]=_0x567d6e;return;}logger[_0xef53('0x4e')](_0xef53('0x77'),util[_0xef53('0x46')](_0x567d6e,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xef53('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x22')]=function(_0x533d31){try{if(this[_0xef53('0x73')](_0x533d31)){logger[_0xef53('0x4e')](_0xef53('0x78'),_0x533d31[_0xef53('0x51')],util[_0xef53('0x46')](_0x533d31,{'showHidden':![],'depth':null}));if(_[_0xef53('0x61')](this[_0xef53('0x10')][_0x533d31[_0xef53('0x51')]])){this[_0xef53('0x10')][_0x533d31[_0xef53('0x51')]]=[];}if(_[_0xef53('0x61')](this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]])){this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]]={};}var _0x1d4ce0=new QueueReport();_0x1d4ce0[_0xef53('0x54')]=_0x533d31['queue'];_0x1d4ce0['type']=this[_0xef53('0x15')][_0x1d4ce0[_0xef53('0x54')]]&&this['voiceQueues'][_0x1d4ce0[_0xef53('0x54')]][_0xef53('0x5c')]?this[_0xef53('0x15')][_0x1d4ce0[_0xef53('0x54')]][_0xef53('0x5c')]||_0xef53('0x5d'):'inbound';_0x1d4ce0[_0xef53('0x79')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x1d4ce0[_0xef53('0x7b')]=_0x533d31[_0xef53('0x7b')];_0x1d4ce0['count']=_0x533d31[_0xef53('0x7c')];_0x1d4ce0[_0xef53('0x51')]=_0x533d31[_0xef53('0x51')];_0x1d4ce0[_0xef53('0x7d')]=this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]][_0xef53('0x7d')];logger[_0xef53('0x7e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1d4ce0['queue'],_0x1d4ce0['type']);Object[_0xef53('0x6e')](_0x1d4ce0,_[_0xef53('0x7f')](_0x533d31,_['keys'](_0x1d4ce0)));this[_0xef53('0x10')][_0x533d31['uniqueid']][_0xef53('0x71')](_0x1d4ce0);this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]]=_0x1d4ce0;this[_0xef53('0x4d')](_0x1d4ce0,_0xef53('0x21'));}}catch(_0x4baaf8){logger[_0xef53('0x44')](_0xef53('0x78'),_0x533d31[_0xef53('0x51')],util[_0xef53('0x46')](_0x4baaf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x24')]=function(_0x235491){try{if(this[_0xef53('0x73')](_0x235491)){logger[_0xef53('0x4e')](_0xef53('0x80'),_0x235491['uniqueid'],util[_0xef53('0x46')](_0x235491,{'showHidden':![],'depth':null}));if(this[_0xef53('0x10')][_0x235491[_0xef53('0x51')]]){var _0x3b8288=_[_0xef53('0x81')](this['queueReports'][_0x235491['uniqueid']]);_0x3b8288[_0xef53('0x3b')]=![];_0x3b8288[_0xef53('0x82')]=null;_0x3b8288['holdtime']=_0x235491[_0xef53('0x83')];_0x3b8288['originalposition']=_0x235491[_0xef53('0x84')];_0x3b8288[_0xef53('0x23')]=!![];_0x3b8288[_0xef53('0x85')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x3b8288['queuecallerexitreason']=_0xef53('0x86');_0x3b8288[_0xef53('0x87')]=null;logger['info'](_0xef53('0x88'),_0x3b8288['queue'],_0x3b8288[_0xef53('0x5c')]);this[_0xef53('0x13')][_0x235491[_0xef53('0x51')]]=_0x3b8288;this[_0xef53('0x89')](_0x3b8288,_0xef53('0x23'));}}}catch(_0x526a05){logger[_0xef53('0x44')](_0xef53('0x80'),_0x235491[_0xef53('0x51')],util['inspect'](_0x526a05,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x8a')]=function(_0x104be5){try{if(this['isNotNull'](_0x104be5)){logger['debug'](_0xef53('0x8b'),_0x104be5['uniqueid'],util[_0xef53('0x46')](_0x104be5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x104be5[_0xef53('0x51')]]){var _0xf35bbf=_['last'](this[_0xef53('0x10')][_0x104be5['uniqueid']]);_0xf35bbf[_0xef53('0x8c')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0xf35bbf['connectedlinenum']=_0x104be5['connectedlinenum'];_0xf35bbf[_0xef53('0x8d')]=_0x104be5[_0xef53('0x8d')];logger[_0xef53('0x7e')](_0xef53('0x8e'),_0xf35bbf['queue'],_0xf35bbf[_0xef53('0x5c')],_0x104be5[_0xef53('0x8f')],_0x104be5['connectedlinename']);this['channels'][_0x104be5['uniqueid']]=_0xf35bbf;this[_0xef53('0x4d')](_0xf35bbf,'queuecallerleave');}}}catch(_0x257442){logger[_0xef53('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x104be5[_0xef53('0x51')],util[_0xef53('0x46')](_0x257442,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x28')]=function(_0x1d7ecc){try{if(this[_0xef53('0x73')](_0x1d7ecc)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x1d7ecc['uniqueid'],util[_0xef53('0x46')](_0x1d7ecc,{'showHidden':![],'depth':null}));if(this[_0xef53('0x10')][_0x1d7ecc[_0xef53('0x51')]]){var _0x3e6f5c=_['last'](this[_0xef53('0x10')][_0x1d7ecc['uniqueid']]);_0x3e6f5c[_0xef53('0x3b')]=!![];_0x3e6f5c[_0xef53('0x57')]=_0xef53('0x90');logger[_0xef53('0x7e')](_0xef53('0x91'),_0x3e6f5c[_0xef53('0x54')],_0x3e6f5c[_0xef53('0x5c')]);}}}catch(_0x41efb1){logger[_0xef53('0x44')](_0xef53('0x92'),_0x1d7ecc[_0xef53('0x51')],util['inspect'](_0x41efb1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x26')]=function(_0x16ca3c){try{if(this[_0xef53('0x73')](_0x16ca3c)){logger[_0xef53('0x4e')](_0xef53('0x93'),_0x16ca3c[_0xef53('0x51')],util[_0xef53('0x46')](_0x16ca3c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x16ca3c[_0xef53('0x51')]]){var _0x33e00f=_[_0xef53('0x81')](this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x51')]]);_0x33e00f[_0xef53('0x23')]=![];_0x33e00f['queuecallerabandonAt']=null;_0x33e00f[_0xef53('0x94')]=!![];_0x33e00f[_0xef53('0x87')]=_0x16ca3c[_0xef53('0x95')];_0x33e00f['holdtime']=_0x16ca3c[_0xef53('0x83')];_0x33e00f[_0xef53('0x3b')]=!![];_0x33e00f[_0xef53('0x3a')]=![];_0x33e00f[_0xef53('0x96')]=null;if(!_0x33e00f[_0xef53('0x97')]){if(_0x16ca3c[_0xef53('0x98')]==_0xef53('0x97')){_0x33e00f[_0xef53('0x57')]=_0xef53('0x99');logger[_0xef53('0x7e')](_0xef53('0x9a'),_0x33e00f[_0xef53('0x54')],_0x33e00f[_0xef53('0x5c')]);}else{if(_['startsWith'](_0x16ca3c[_0xef53('0x40')][_0xef53('0x9b')](),'local/')){if(this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x9c')]]){var _0x5578b6=_['last'](this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x9c')]]);_0x5578b6['queuecallercomplete']=![];_0x5578b6['queuecallerexit']=!![];_0x5578b6[_0xef53('0x96')]=moment(_0x33e00f['queuecallerjoinAt'])[_0xef53('0x9d')](_0x16ca3c[_0xef53('0x83')],_0xef53('0x9e'))[_0xef53('0x52')](_0xef53('0x7a'));_0x5578b6[_0xef53('0x57')]=_0xef53('0x9f');_0x5578b6[_0xef53('0x97')]=!![];_0x5578b6[_0xef53('0xa0')]='FORWARD';_0x5578b6['transferexten']=_0x16ca3c['destexten'];_0x5578b6[_0xef53('0xa1')]=_0x16ca3c[_0xef53('0x51')];logger[_0xef53('0x7e')](_0xef53('0xa2'),_0x5578b6[_0xef53('0x54')],_0x5578b6['type']);var _0x465829=this['queueReports'][_0x16ca3c[_0xef53('0x9c')]];this[_0xef53('0x10')][_0x16ca3c['linkedid']]=this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x51')]];this['queueReports'][_0x16ca3c[_0xef53('0x51')]]=_0x465829;}}else{_0x33e00f[_0xef53('0x57')]='COMPLETEDBY'+_0x16ca3c[_0xef53('0x98')]['toUpperCase']();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x33e00f[_0xef53('0x54')],_0x33e00f['type'],_0x33e00f[_0xef53('0x57')]);}}}this[_0xef53('0x13')][_0x16ca3c[_0xef53('0x51')]]=_0x33e00f;}}}catch(_0x58c1e6){logger[_0xef53('0x44')](_0xef53('0x93'),_0x16ca3c[_0xef53('0x51')],util[_0xef53('0x46')](_0x58c1e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0xa3')]=function(_0x5aa501){try{if(this['isNotNull'](_0x5aa501)){logger['debug'](_0xef53('0xa4'),_0x5aa501[_0xef53('0x51')],util[_0xef53('0x46')](_0x5aa501,{'showHidden':![],'depth':null}));this[_0xef53('0xa5')](_0x5aa501[_0xef53('0x51')],_[_0xef53('0xa6')](_0x5aa501[_0xef53('0xa7')])[0x0],_0x5aa501[_0xef53('0xa8')]);if(this[_0xef53('0x10')][_0x5aa501[_0xef53('0x51')]]){var _0x5c0953=_[_0xef53('0x81')](this['queueReports'][_0x5aa501['uniqueid']]);if(_0x5c0953){if(this[_0xef53('0x73')](_0x5aa501[_0xef53('0xa7')])&&this[_0xef53('0x73')](_0x5aa501[_0xef53('0xa7')][_0xef53('0x69')])){switch(_0x5aa501['value']){case _0xef53('0xa9'):_0x5c0953[_0xef53('0x3a')]=![];_0x5c0953[_0xef53('0x96')]=null;break;case'TIMEOUT':_0x5c0953[_0xef53('0xaa')]=_0xef53('0xab');_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953[_0xef53('0x96')]=moment()[_0xef53('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c0953['queuecallerleaveAt']=moment()[_0xef53('0x52')](_0xef53('0x7a'));logger[_0xef53('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5aa501[_0xef53('0x51')],util[_0xef53('0x46')](_0x5c0953,{'showHidden':![],'depth':null}));ami[_0xef53('0x4c')](_0xef53('0xac'),_0x5c0953);break;default:_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953['queuecallerexitAt']=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x5c0953[_0xef53('0x8c')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));}_0x5c0953[_0xef53('0x23')]=![];_0x5c0953[_0xef53('0x85')]=null;_0x5c0953[_0xef53('0x57')]=_0x5aa501['value'];this[_0xef53('0x13')][_0x5aa501['uniqueid']]=_0x5c0953;this[_0xef53('0x89')](_0x5c0953,_0xef53('0x29'));}else if(this[_0xef53('0x73')](_0x5aa501['variable'])&&this['isNotNull'](_0x5aa501['variable'][_0xef53('0xad')])){if(!_0x5c0953['queuecallerabandon']){_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953[_0xef53('0x96')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x5c0953[_0xef53('0x57')]=_0xef53('0xae');_0x5c0953['queuecallerleaveAt']=moment()['format'](_0xef53('0x7a'));this['channels'][_0x5aa501[_0xef53('0x51')]]=_0x5c0953;}}logger[_0xef53('0x7e')](_0xef53('0xaf'),_0x5aa501[_0xef53('0x51')],_0x5c0953[_0xef53('0x54')],_0x5c0953[_0xef53('0x5c')],_[_0xef53('0xa6')](_0x5aa501['variable'])[0x0],_0x5aa501[_0xef53('0xa8')]);_0x5c0953['variables']=this['variables'][_0x5aa501['uniqueid']];}}}}catch(_0x42e375){logger['error'](_0xef53('0xa4'),_0x5aa501[_0xef53('0x51')],util['inspect'](_0x42e375,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0xa5')]=function(_0x536984,_0x512451,_0x6e2db2){var _0x2df3e5=[_0xef53('0xb0'),_0xef53('0xb1'),_0xef53('0xb2'),_0xef53('0xb3'),'rtpaudioqosloss',_0xef53('0xb4'),'rtpaudioqosrtt',_0xef53('0xb5'),_0xef53('0xb6'),_0xef53('0xb7'),'bridgepeer',_0xef53('0xb8'),_0xef53('0xb9'),_0xef53('0xba'),_0xef53('0xbb'),_0xef53('0xbc'),_0xef53('0x95'),_0xef53('0xbd'),_0xef53('0xbe')];if(!_['isNil'](_0x512451)&&!_[_0xef53('0xbf')](_0x2df3e5,_0x512451)){if(_[_0xef53('0x61')](this[_0xef53('0x18')][_0x536984])){this['variables'][_0x536984]={};}this[_0xef53('0x18')][_0x536984][_0x512451]=_0x6e2db2;}};VoiceQueueReport['prototype']['handleHangup']=function(_0xdf1126,_0x4e7129,_0x19f699){try{var _0x47d619={};if(this['queueReports'][_0xdf1126]){for(var _0x334774=0x0;_0x3347740x0?!![]:![];if(!_0x21c28d){return this[_0xc941('0x19')](this[_0xc941('0x49')][_0xc941('0x74')]);}};VoiceQueueReport[_0xc941('0x46')]['syncQueueMember']=function(_0x233d39){var _0x1b42b6=this[_0xc941('0x49')]['id'];if(this[_0xc941('0x49')][_0xc941('0x68')][_0x1b42b6]&&this[_0xc941('0x49')][_0xc941('0x68')][_0x1b42b6][_0x233d39[_0xc941('0x67')]]){this['summary'][_0xc941('0x68')][_0x1b42b6][_0x233d39[_0xc941('0x67')]][_0xc941('0x10')][_0xc941('0x75')](_0x233d39);}};VoiceQueueReport[_0xc941('0x46')][_0xc941('0x16')]=function(_0x311c2b){var _0x45e39b=this;try{if(this[_0xc941('0x61')](_0x311c2b)&&this[_0xc941('0x61')](_0x311c2b[_0xc941('0x59')])){logger[_0xc941('0x4e')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x311c2b,{'showHidden':![],'depth':null}));var _0xce2c21=this[_0xc941('0x12')][_0x311c2b['queue']];if(_0xce2c21){logger[_0xc941('0x4e')](_0xc941('0x76'),_0xce2c21[_0xc941('0x6a')]);this[_0xc941('0x49')]['queues'][_0xce2c21[_0xc941('0x6a')]]={'summaryEvent':_0x311c2b};this[_0xc941('0x49')][_0xc941('0x73')]+=0x1;return ami[_0xc941('0x3b')]({'action':_0xc941('0x68'),'queue':_0xce2c21[_0xc941('0x6a')]})[_0xc941('0x66')](function(_0x57fdc7){if(!_0x45e39b[_0xc941('0x49')]['queuestatus'][_0x311c2b['actionid']]){_0x45e39b[_0xc941('0x49')][_0xc941('0x68')][_0x311c2b[_0xc941('0x67')]]={};}_0x45e39b['summary'][_0xc941('0x68')][_0x311c2b[_0xc941('0x67')]][_0x57fdc7['actionid']]={'queue':_0xce2c21[_0xc941('0x6a')],'agents':[]};})[_0xc941('0x3e')](function(_0x4e2387){throw _0x4e2387;});}}}catch(_0x1dd853){logger['error'](_0xc941('0x77'),util[_0xc941('0x43')](_0x1dd853,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc941('0x19')]=function(_0x569e23){if(this[_0xc941('0x49')]['statusRequests']>0x0){this[_0xc941('0x49')][_0xc941('0x74')]=_0x569e23;return;}logger['debug'](_0xc941('0x78'),util[_0xc941('0x43')](_0x569e23,{'showHidden':![],'depth':null}));this[_0xc941('0x49')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xc941('0x46')]['syncQueueCallerJoin']=function(_0x4cabfc){try{if(this['isNotNull'](_0x4cabfc)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x4cabfc[_0xc941('0x51')],util[_0xc941('0x43')](_0x4cabfc,{'showHidden':![],'depth':null}));if(_[_0xc941('0x62')](this[_0xc941('0xf')][_0x4cabfc['uniqueid']])){this['queueReports'][_0x4cabfc['uniqueid']]=[];}if(_['isUndefined'](this[_0xc941('0x39')][_0x4cabfc[_0xc941('0x51')]])){this[_0xc941('0x39')][_0x4cabfc[_0xc941('0x51')]]={};}var _0x2fb12e=new QueueReport();_0x2fb12e['queue']=_0x4cabfc[_0xc941('0x59')];_0x2fb12e[_0xc941('0x5d')]=this[_0xc941('0x12')][_0x2fb12e[_0xc941('0x59')]]&&this[_0xc941('0x12')][_0x2fb12e[_0xc941('0x59')]][_0xc941('0x5d')]?this[_0xc941('0x12')][_0x2fb12e[_0xc941('0x59')]]['type']||_0xc941('0x5e'):_0xc941('0x5e');_0x2fb12e[_0xc941('0x79')]=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x2fb12e[_0xc941('0x7b')]=_0x4cabfc[_0xc941('0x7b')];_0x2fb12e[_0xc941('0x7c')]=_0x4cabfc[_0xc941('0x7c')];_0x2fb12e['uniqueid']=_0x4cabfc['uniqueid'];_0x2fb12e['routealias']=this[_0xc941('0x39')][_0x4cabfc[_0xc941('0x51')]][_0xc941('0x7d')];logger[_0xc941('0x7e')](_0xc941('0x7f'),_0x2fb12e[_0xc941('0x59')],_0x2fb12e['type']);Object[_0xc941('0x70')](_0x2fb12e,_['pick'](_0x4cabfc,_[_0xc941('0x80')](_0x2fb12e)));this[_0xc941('0xf')][_0x4cabfc['uniqueid']][_0xc941('0x75')](_0x2fb12e);this[_0xc941('0x39')][_0x4cabfc[_0xc941('0x51')]]=_0x2fb12e;this[_0xc941('0x4d')](_0x2fb12e,_0xc941('0x1b'));}}catch(_0x142203){logger[_0xc941('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4cabfc[_0xc941('0x51')],util['inspect'](_0x142203,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc941('0x1d')]=function(_0x4fee42){try{if(this['isNotNull'](_0x4fee42)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x4fee42[_0xc941('0x51')],util[_0xc941('0x43')](_0x4fee42,{'showHidden':![],'depth':null}));if(this[_0xc941('0xf')][_0x4fee42[_0xc941('0x51')]]){var _0x551668=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x4fee42[_0xc941('0x51')]]);_0x551668[_0xc941('0x37')]=![];_0x551668[_0xc941('0x82')]=null;_0x551668['holdtime']=_0x4fee42['holdtime'];_0x551668[_0xc941('0x83')]=_0x4fee42[_0xc941('0x83')];_0x551668['queuecallerabandon']=!![];_0x551668[_0xc941('0x84')]=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x551668['queuecallerexitreason']=_0xc941('0x85');_0x551668[_0xc941('0x86')]=null;logger['info'](_0xc941('0x87'),_0x551668[_0xc941('0x59')],_0x551668['type']);this['channels'][_0x4fee42[_0xc941('0x51')]]=_0x551668;this[_0xc941('0x4a')](_0x551668,_0xc941('0x1c'));}}}catch(_0x491d39){logger[_0xc941('0x41')](_0xc941('0x88'),_0x4fee42['uniqueid'],util['inspect'](_0x491d39,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc941('0x89')]=function(_0x30a477){try{if(this['isNotNull'](_0x30a477)){logger[_0xc941('0x4e')]('[%s][voiceQueueReport][queuecallerleave]',_0x30a477[_0xc941('0x51')],util[_0xc941('0x43')](_0x30a477,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x30a477[_0xc941('0x51')]]){var _0x40b594=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x30a477[_0xc941('0x51')]]);_0x40b594[_0xc941('0x8a')]=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x40b594[_0xc941('0x8b')]=_0x30a477['connectedlinenum'];_0x40b594[_0xc941('0x8c')]=_0x30a477[_0xc941('0x8c')];logger[_0xc941('0x7e')](_0xc941('0x8d'),_0x40b594['queue'],_0x40b594['type'],_0x30a477[_0xc941('0x8b')],_0x30a477[_0xc941('0x8c')]);this['channels'][_0x30a477['uniqueid']]=_0x40b594;this[_0xc941('0x4d')](_0x40b594,_0xc941('0x1e'));}}}catch(_0x258979){logger['error'](_0xc941('0x8e'),_0x30a477[_0xc941('0x51')],util[_0xc941('0x43')](_0x258979,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc941('0x46')][_0xc941('0x1f')]=function(_0x5de160){try{if(this[_0xc941('0x61')](_0x5de160)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x5de160['uniqueid'],util[_0xc941('0x43')](_0x5de160,{'showHidden':![],'depth':null}));if(this[_0xc941('0xf')][_0x5de160[_0xc941('0x51')]]){var _0x622e5e=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x5de160[_0xc941('0x51')]]);_0x622e5e[_0xc941('0x37')]=!![];_0x622e5e[_0xc941('0x57')]=_0xc941('0x8f');logger['info'](_0xc941('0x90'),_0x622e5e['queue'],_0x622e5e[_0xc941('0x5d')]);}}}catch(_0x315a65){logger[_0xc941('0x41')](_0xc941('0x91'),_0x5de160[_0xc941('0x51')],util[_0xc941('0x43')](_0x315a65,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc941('0x92')]=function(_0x3caf34){try{if(this[_0xc941('0x61')](_0x3caf34)){logger[_0xc941('0x4e')](_0xc941('0x93'),_0x3caf34[_0xc941('0x51')],util['inspect'](_0x3caf34,{'showHidden':![],'depth':null}));if(this[_0xc941('0xf')][_0x3caf34[_0xc941('0x51')]]){var _0x54c431=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x3caf34[_0xc941('0x51')]]);_0x54c431[_0xc941('0x1c')]=![];_0x54c431[_0xc941('0x84')]=null;_0x54c431[_0xc941('0x94')]=!![];_0x54c431['lastAssignedTo']=_0x3caf34[_0xc941('0x95')];_0x54c431[_0xc941('0x96')]=_0x3caf34['holdtime'];_0x54c431[_0xc941('0x37')]=!![];_0x54c431[_0xc941('0x36')]=![];_0x54c431[_0xc941('0x97')]=null;if(!_0x54c431[_0xc941('0x98')]){if(_0x3caf34[_0xc941('0x99')]==_0xc941('0x98')){_0x54c431[_0xc941('0x57')]=_0xc941('0x9a');logger[_0xc941('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x54c431[_0xc941('0x59')],_0x54c431[_0xc941('0x5d')]);}else{if(_[_0xc941('0x9b')](_0x3caf34[_0xc941('0x3d')][_0xc941('0x9c')](),_0xc941('0x9d'))){if(this[_0xc941('0xf')][_0x3caf34[_0xc941('0x9e')]]){var _0xa7657a=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x3caf34[_0xc941('0x9e')]]);_0xa7657a[_0xc941('0x37')]=![];_0xa7657a[_0xc941('0x36')]=!![];_0xa7657a[_0xc941('0x97')]=moment(_0x54c431['queuecallerjoinAt'])[_0xc941('0x9f')](_0x3caf34[_0xc941('0x96')],_0xc941('0xa0'))[_0xc941('0x52')](_0xc941('0x7a'));_0xa7657a['queuecallerexitreason']='FORWARDTRANSFER';_0xa7657a[_0xc941('0x98')]=!![];_0xa7657a[_0xc941('0xa1')]='FORWARD';_0xa7657a[_0xc941('0xa2')]=_0x3caf34[_0xc941('0xa3')];_0xa7657a[_0xc941('0xa4')]=_0x3caf34[_0xc941('0x51')];logger[_0xc941('0x7e')](_0xc941('0xa5'),_0xa7657a['queue'],_0xa7657a[_0xc941('0x5d')]);var _0x19b3f0=this[_0xc941('0xf')][_0x3caf34[_0xc941('0x9e')]];this['queueReports'][_0x3caf34[_0xc941('0x9e')]]=this[_0xc941('0xf')][_0x3caf34[_0xc941('0x51')]];this['queueReports'][_0x3caf34[_0xc941('0x51')]]=_0x19b3f0;}}else{_0x54c431[_0xc941('0x57')]='COMPLETEDBY'+_0x3caf34[_0xc941('0x99')][_0xc941('0xa6')]();logger['info'](_0xc941('0xa7'),_0x54c431[_0xc941('0x59')],_0x54c431[_0xc941('0x5d')],_0x54c431[_0xc941('0x57')]);}}}this[_0xc941('0x39')][_0x3caf34[_0xc941('0x51')]]=_0x54c431;}}}catch(_0x4b8bef){logger[_0xc941('0x41')](_0xc941('0x93'),_0x3caf34[_0xc941('0x51')],util[_0xc941('0x43')](_0x4b8bef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc941('0x21')]=function(_0x2431c2){try{if(this[_0xc941('0x61')](_0x2431c2)){logger[_0xc941('0x4e')](_0xc941('0xa8'),_0x2431c2[_0xc941('0x51')],util[_0xc941('0x43')](_0x2431c2,{'showHidden':![],'depth':null}));this['addVariable'](_0x2431c2[_0xc941('0x51')],_[_0xc941('0x80')](_0x2431c2[_0xc941('0xa9')])[0x0],_0x2431c2[_0xc941('0xaa')]);if(this[_0xc941('0xf')][_0x2431c2[_0xc941('0x51')]]){var _0x15b79b=_[_0xc941('0x81')](this[_0xc941('0xf')][_0x2431c2[_0xc941('0x51')]]);if(_0x15b79b){if(this[_0xc941('0x61')](_0x2431c2[_0xc941('0xa9')])&&this[_0xc941('0x61')](_0x2431c2['variable'][_0xc941('0x68')])){switch(_0x2431c2[_0xc941('0xaa')]){case'CONTINUE':_0x15b79b[_0xc941('0x36')]=![];_0x15b79b['queuecallerexitAt']=null;break;case _0xc941('0xab'):_0x15b79b[_0xc941('0xac')]=_0xc941('0xad');_0x15b79b[_0xc941('0x36')]=!![];_0x15b79b['queuecallerexitAt']=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x15b79b['queuecallerleaveAt']=moment()[_0xc941('0x52')](_0xc941('0x7a'));logger['debug'](_0xc941('0xae'),_0x2431c2[_0xc941('0x51')],util[_0xc941('0x43')](_0x15b79b,{'showHidden':![],'depth':null}));ami[_0xc941('0x4c')](_0xc941('0xaf'),_0x15b79b);break;default:_0x15b79b[_0xc941('0x36')]=!![];_0x15b79b['queuecallerexitAt']=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x15b79b[_0xc941('0x8a')]=moment()['format'](_0xc941('0x7a'));}_0x15b79b[_0xc941('0x1c')]=![];_0x15b79b[_0xc941('0x84')]=null;_0x15b79b[_0xc941('0x57')]=_0x2431c2['value'];this['channels'][_0x2431c2['uniqueid']]=_0x15b79b;this[_0xc941('0x4a')](_0x15b79b,'varset');}else if(this['isNotNull'](_0x2431c2['variable'])&&this[_0xc941('0x61')](_0x2431c2[_0xc941('0xa9')][_0xc941('0xb0')])){if(!_0x15b79b[_0xc941('0x1c')]){_0x15b79b[_0xc941('0x36')]=!![];_0x15b79b['queuecallerexitAt']=moment()[_0xc941('0x52')](_0xc941('0x7a'));_0x15b79b[_0xc941('0x57')]=_0xc941('0xb1');_0x15b79b['queuecallerleaveAt']=moment()['format'](_0xc941('0x7a'));this[_0xc941('0x39')][_0x2431c2[_0xc941('0x51')]]=_0x15b79b;}}logger[_0xc941('0x7e')](_0xc941('0xb2'),_0x2431c2[_0xc941('0x51')],_0x15b79b[_0xc941('0x59')],_0x15b79b[_0xc941('0x5d')],_[_0xc941('0x80')](_0x2431c2['variable'])[0x0],_0x2431c2[_0xc941('0xaa')]);_0x15b79b[_0xc941('0x14')]=this['variables'][_0x2431c2[_0xc941('0x51')]];}}}}catch(_0x394b3e){logger[_0xc941('0x41')](_0xc941('0xa8'),_0x2431c2[_0xc941('0x51')],util['inspect'](_0x394b3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc941('0x46')][_0xc941('0xb3')]=function(_0x455320,_0x2a7a8b,_0x235c01){var _0x4d13d9=[_0xc941('0xb4'),_0xc941('0xb5'),_0xc941('0xb6'),_0xc941('0xb7'),_0xc941('0xb8'),_0xc941('0xb9'),_0xc941('0xba'),_0xc941('0xbb'),_0xc941('0xbc'),_0xc941('0xbd'),_0xc941('0xbe'),_0xc941('0xbf'),'membercalls',_0xc941('0xc0'),_0xc941('0xc1'),_0xc941('0xc2'),'membername','memberpenalty',_0xc941('0xc3')];if(!_[_0xc941('0x3a')](_0x2a7a8b)&&!_[_0xc941('0xc4')](_0x4d13d9,_0x2a7a8b)){if(_[_0xc941('0x62')](this[_0xc941('0x14')][_0x455320])){this[_0xc941('0x14')][_0x455320]={};}this['variables'][_0x455320][_0x2a7a8b]=_0x235c01;}};VoiceQueueReport[_0xc941('0x46')][_0xc941('0xc5')]=function(_0x382078,_0x164f62,_0x5ae64e){try{var _0x8e870b={};if(this[_0xc941('0xf')][_0x382078]){for(var _0x1a2e12=0x0;_0x1a2e12=0x0?moment(_0x2dce4d[_0x1cbe('0x16')])[_0x1cbe('0x17')](_0x2dce4d['starttime'],_0x1cbe('0xb')):null,'data1':'outbound','data2':_0x2dce4d[_0x1cbe('0xf')],'data3':_0x2dce4d['exten'],'data4':_0x2dce4d[_0x1cbe('0x18')]||null,'role':_0x1cbe('0xe'),'internal':_0x2dce4d[_0x1cbe('0xf')]?_[_0x1cbe('0x10')](_0x2dce4d[_0x1cbe('0xf')]):undefined,'uniqueid':_0x2dce4d[_0x1cbe('0x11')]},'log':_0x1cbe('0x5')});}; \ No newline at end of file +var _0xba4f=['format','SIP/%s','lastAssignedTo','interface','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','agent','accountcode','uniqueid','voiceDialReport','Request','membername','endtime','starttime','outbound','dialstring','toNumber','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice'];(function(_0x3133c8,_0x1ecaa8){var _0x1d4f12=function(_0x5af4af){while(--_0x5af4af){_0x3133c8['push'](_0x3133c8['shift']());}};_0x1d4f12(++_0x1ecaa8);}(_0xba4f,0x1e5));var _0xfba4=function(_0x23df26,_0x37c0e9){_0x23df26=_0x23df26-0x0;var _0x21a6fc=_0xba4f[_0x23df26];return _0x21a6fc;};'use strict';var moment=require(_0xfba4('0x0'));var _=require(_0xfba4('0x1'));var util=require('util');var client=require(_0xfba4('0x2'));exports[_0xfba4('0x3')]=function(_0x1a5ffc){var _0x713f6d=_0x1a5ffc[_0xfba4('0x4')]||_0x1a5ffc[_0xfba4('0x5')];return client['Request'](_0xfba4('0x6'),{'body':{'channel':_0xfba4('0x7'),'membername':_0x1a5ffc['lastAssignedTo'],'interface':_['isNil'](_0x1a5ffc['interface'])?util[_0xfba4('0x8')](_0xfba4('0x9'),_0x1a5ffc[_0xfba4('0xa')]):_0x1a5ffc[_0xfba4('0xb')],'type':_0xfba4('0xc'),'enterAt':_0x1a5ffc[_0xfba4('0xd')],'exitAt':_0x713f6d,'duration':moment(_0x713f6d)[_0xfba4('0xe')](_0x1a5ffc[_0xfba4('0xd')],_0xfba4('0xf')),'data1':'inbound','data2':_0x1a5ffc[_0xfba4('0x10')],'data3':_0x1a5ffc[_0xfba4('0x11')],'data4':null,'data5':_0x1a5ffc['queue'],'role':_0xfba4('0x12'),'internal':_0x1a5ffc[_0xfba4('0x13')]?_['toNumber'](_0x1a5ffc[_0xfba4('0x13')]):undefined,'uniqueid':_0x1a5ffc[_0xfba4('0x14')]},'log':_0xfba4('0x6')});};exports[_0xfba4('0x15')]=function(_0x3a13ea){return client[_0xfba4('0x16')](_0xfba4('0x6'),{'body':{'channel':_0xfba4('0x7'),'membername':_0x3a13ea[_0xfba4('0x17')],'interface':_0x3a13ea['interface'],'type':_0xfba4('0xc'),'enterAt':_0x3a13ea['starttime'],'exitAt':_0x3a13ea[_0xfba4('0x18')],'duration':moment(_0x3a13ea['endtime'])[_0xfba4('0xe')](_0x3a13ea[_0xfba4('0x19')],_0xfba4('0xf'))>=0x0?moment(_0x3a13ea[_0xfba4('0x18')])['diff'](_0x3a13ea[_0xfba4('0x19')],_0xfba4('0xf')):null,'data1':_0xfba4('0x1a'),'data2':_0x3a13ea[_0xfba4('0x13')],'data3':_0x3a13ea['exten'],'data4':_0x3a13ea[_0xfba4('0x1b')]||null,'role':_0xfba4('0x12'),'internal':_0x3a13ea[_0xfba4('0x13')]?_[_0xfba4('0x1c')](_0x3a13ea[_0xfba4('0x13')]):undefined,'uniqueid':_0x3a13ea[_0xfba4('0x14')]},'log':_0xfba4('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 90a3379..c03b574 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 _0x04bc=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x04bc,0xeb));var _0xc04b=function(_0x2cf365,_0x1ae23d){_0x2cf365=_0x2cf365-0x0;var _0x4d440b=_0x04bc[_0x2cf365];return _0x4d440b;};'use strict';var client=require(_0xc04b('0x0'));exports[_0xc04b('0x1')]=function(){return client[_0xc04b('0x2')](_0xc04b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc04b('0x4'),'previewRecallmeReminderInterval']},'log':_0xc04b('0x5')});}; \ No newline at end of file +var _0xd509=['Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x40737e,_0x25992e){var _0x263ca1=function(_0x521635){while(--_0x521635){_0x40737e['push'](_0x40737e['shift']());}};_0x263ca1(++_0x25992e);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x9d50('0x0')](_0x9d50('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9d50('0x2'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 47b125b..110406e 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 _0x60aa=['GetTemplate','name','html','getTemplates','Request'];(function(_0x4801bd,_0x368071){var _0x3cf6fc=function(_0x4d376c){while(--_0x4d376c){_0x4801bd['push'](_0x4801bd['shift']());}};_0x3cf6fc(++_0x368071);}(_0x60aa,0x13e));var _0xa60a=function(_0x31b761,_0x1f1619){_0x31b761=_0x31b761-0x0;var _0x1fd625=_0x60aa[_0x31b761];return _0x1fd625;};'use strict';var client=require('../client');exports[_0xa60a('0x0')]=function(_0x55582f){return function(_0x1ab7ec){return client[_0xa60a('0x1')](_0xa60a('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa60a('0x3'),_0xa60a('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x12d4=['Request','GetTemplate','html'];(function(_0x35d8b6,_0x2ae111){var _0x2ae569=function(_0x1fd4a4){while(--_0x1fd4a4){_0x35d8b6['push'](_0x35d8b6['shift']());}};_0x2ae569(++_0x2ae111);}(_0x12d4,0x1e0));var _0x412d=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x12d4[_0x44268d];return _0x4be92d;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x2bc2d1){return function(_0x41ae15){return client[_0x412d('0x0')](_0x412d('0x1'),{'options':{'raw':!![],'attributes':['id','name',_0x412d('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 693374b..fbb0464 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 _0xf81e=['Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data2','data3','data4','data6','GetTrigger','../client'];(function(_0x19f7ec,_0x523430){var _0x4eba4=function(_0x2aa362){while(--_0x2aa362){_0x19f7ec['push'](_0x19f7ec['shift']());}};_0x4eba4(++_0x523430);}(_0xf81e,0x1ed));var _0xef81=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf81e[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xef81('0x0'));exports['getTriggers']=function(_0x5161ed){return function(_0x137c04){return client[_0xef81('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xef81('0x2'),_0xef81('0x3'),_0xef81('0x4')],'include':[{'model':_0xef81('0x5'),'as':_0xef81('0x6'),'attributes':['id',_0xef81('0x7'),_0xef81('0x8'),_0xef81('0x9')]},{'model':_0xef81('0x5'),'as':_0xef81('0xa'),'attributes':['id',_0xef81('0x7'),_0xef81('0x8'),'value']},{'model':_0xef81('0xb'),'as':_0xef81('0xc'),'attributes':['id',_0xef81('0xd'),'data1',_0xef81('0xe'),_0xef81('0xf'),_0xef81('0x10'),'data5',_0xef81('0x11'),'data7']}]},'log':_0xef81('0x12')});};}; \ No newline at end of file +var _0x2a3d=['Condition','field','value','AnyConditions','operator','Action','Actions','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel'];(function(_0x1bcc92,_0x4929b8){var _0x88406a=function(_0x4670f8){while(--_0x4670f8){_0x1bcc92['push'](_0x1bcc92['shift']());}};_0x88406a(++_0x4929b8);}(_0x2a3d,0x1ee));var _0xd2a3=function(_0x10fbd4,_0x59b9af){_0x10fbd4=_0x10fbd4-0x0;var _0x28a4e0=_0x2a3d[_0x10fbd4];return _0x28a4e0;};'use strict';var client=require(_0xd2a3('0x0'));exports[_0xd2a3('0x1')]=function(_0x3397c3){return function(_0x1ff0f4){return client[_0xd2a3('0x2')](_0xd2a3('0x3'),{'options':{'raw':![],'attributes':['id',_0xd2a3('0x4'),_0xd2a3('0x5'),'status'],'include':[{'model':_0xd2a3('0x6'),'as':'AllConditions','attributes':['id',_0xd2a3('0x7'),'operator',_0xd2a3('0x8')]},{'model':'Condition','as':_0xd2a3('0x9'),'attributes':['id',_0xd2a3('0x7'),_0xd2a3('0xa'),'value']},{'model':_0xd2a3('0xb'),'as':_0xd2a3('0xc'),'attributes':['id',_0xd2a3('0xd'),_0xd2a3('0xe'),'data2',_0xd2a3('0xf'),_0xd2a3('0x10'),_0xd2a3('0x11'),_0xd2a3('0x12'),_0xd2a3('0x13')]}]},'log':_0xd2a3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2faa74e..9e54547 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 _0xb150=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb150,0x18e));var _0x0b15=function(_0x2a6b68,_0x422702){_0x2a6b68=_0x2a6b68-0x0;var _0x1fb369=_0xb150[_0x2a6b68];return _0x1fb369;};'use strict';var client=require(_0x0b15('0x0'));exports[_0x0b15('0x1')]=function(_0x416729){return function(_0x234c4c){return client[_0x0b15('0x2')](_0x0b15('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0b15('0x4'),_0x0b15('0x5'),_0x0b15('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x1271=['GetTrunk','registry','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1271,0x9a));var _0x1127=function(_0x4a4437,_0x36702a){_0x4a4437=_0x4a4437-0x0;var _0x4eb03c=_0x1271[_0x4a4437];return _0x4eb03c;};'use strict';var client=require(_0x1127('0x0'));exports['getTrunks']=function(_0x229dd0){return function(_0x1d4123){return client[_0x1127('0x1')](_0x1127('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x1127('0x3'),'defaultuser']},'log':_0x1127('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4f14a26..3789b44 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(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe706,0xa3));var _0x6e70=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xe706[_0x512f81];return _0xa15099;};'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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x26a2ef,_0x5b3ee8){var _0x1c88b2=function(_0x1db5b4){while(--_0x1db5b4){_0x26a2ef['push'](_0x26a2ef['shift']());}};_0x1c88b2(++_0x5b3ee8);}(_0x70e0,0x17b));var _0x070e=function(_0x17c279,_0x4650f5){_0x17c279=_0x17c279-0x0;var _0x14fbfa=_0x70e0[_0x17c279];return _0x14fbfa;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bc8b8fd..4b530fc 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 _0xe523=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x4f15d3,_0x387363){var _0x3b9205=function(_0x75a864){while(--_0x75a864){_0x4f15d3['push'](_0x4f15d3['shift']());}};_0x3b9205(++_0x387363);}(_0xe523,0x180));var _0x3e52=function(_0x21c246,_0x498740){_0x21c246=_0x21c246-0x0;var _0x23af98=_0xe523[_0x21c246];return _0x23af98;};'use strict';var client=require(_0x3e52('0x0'));exports['create']=function(_0xbe8cd2){return client[_0x3e52('0x1')](_0x3e52('0x2'),{'body':_0xbe8cd2,'log':_0x3e52('0x2')});};exports[_0x3e52('0x3')]=function(_0xb9e4af,_0x177732,_0x4eea91){return client[_0x3e52('0x1')](_0x3e52('0x4'),{'body':_0xb9e4af,'options':{'where':{'uniqueid':_0x177732,'interface':_0x4eea91,'agentcomplete':!![]}},'log':_0x3e52('0x4')});}; \ No newline at end of file +var _0xb35c=['CreateVoiceAgentReport','UpdateVoiceAgentReport','create','Request'];(function(_0x217df4,_0x55e19a){var _0x45d49d=function(_0x1da478){while(--_0x1da478){_0x217df4['push'](_0x217df4['shift']());}};_0x45d49d(++_0x55e19a);}(_0xb35c,0x1ea));var _0xcb35=function(_0x5601d8,_0x25b23a){_0x5601d8=_0x5601d8-0x0;var _0x1fb771=_0xb35c[_0x5601d8];return _0x1fb771;};'use strict';var client=require('../client');exports[_0xcb35('0x0')]=function(_0x2569fc){return client[_0xcb35('0x1')](_0xcb35('0x2'),{'body':_0x2569fc,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x48f296,_0x3c507d,_0x133a90){return client['Request'](_0xcb35('0x3'),{'body':_0x48f296,'options':{'where':{'uniqueid':_0x3c507d,'interface':_0x133a90,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index adea720..dfeb12b 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 _0xcef1=['disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x1f1170,_0x3b5783){var _0x127b7b=function(_0x30c5ed){while(--_0x30c5ed){_0x1f1170['push'](_0x1f1170['shift']());}};_0x127b7b(++_0x3b5783);}(_0xcef1,0x1e7));var _0x1cef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcef1[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x1cef('0x0'));var util=require(_0x1cef('0x1'));var _=require(_0x1cef('0x2'));var client=require(_0x1cef('0x3'));exports[_0x1cef('0x4')]=function(_0x48206f){return client[_0x1cef('0x5')](_0x1cef('0x6'),{'body':_['merge'](_0x48206f,{'source':_0x48206f['calleridnum'],'destinationcontext':_0x48206f[_0x1cef('0x7')],'callerid':_0x48206f[_0x1cef('0x8')],'amaflags':_0x1cef('0x9')}),'log':_0x1cef('0x6')});};exports[_0x1cef('0xa')]=function(){return function(){return client[_0x1cef('0x5')](_0x1cef('0xb'),{'options':{'where':{'type':[_0x1cef('0xc')],'createdAt':{'$between':[moment()[_0x1cef('0xd')](_0x1cef('0xe'))[_0x1cef('0xf')](_0x1cef('0x10')),moment()[_0x1cef('0x11')](_0x1cef('0xe'))['format'](_0x1cef('0x10'))]}},'attributes':[_0x1cef('0x12'),_0x1cef('0x13'),_0x1cef('0x14'),_0x1cef('0x15')]},'log':_0x1cef('0x16')});};}; \ No newline at end of file +var _0x3efe=['lodash','../client','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3efe,0x18d));var _0xe3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efe[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0xe3ef('0x0'));var util=require(_0xe3ef('0x1'));var _=require(_0xe3ef('0x2'));var client=require(_0xe3ef('0x3'));exports['create']=function(_0x269c6f){return client[_0xe3ef('0x4')]('CreateVoiceCallReport',{'body':_[_0xe3ef('0x5')](_0x269c6f,{'source':_0x269c6f[_0xe3ef('0x6')],'destinationcontext':_0x269c6f[_0xe3ef('0x7')],'callerid':_0x269c6f['callerid'],'amaflags':_0xe3ef('0x8')}),'log':_0xe3ef('0x9')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xe3ef('0xa')],'createdAt':{'$between':[moment()[_0xe3ef('0xb')](_0xe3ef('0xc'))[_0xe3ef('0xd')](_0xe3ef('0xe')),moment()[_0xe3ef('0xf')](_0xe3ef('0xc'))['format'](_0xe3ef('0xe'))]}},'attributes':[_0xe3ef('0x10'),_0xe3ef('0x11'),_0xe3ef('0x12'),_0xe3ef('0x13')]},'log':_0xe3ef('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0b9331d..e247d79 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 _0x3489=['Request','CreateVoiceDialReport','../client','create'];(function(_0xaa3788,_0x16b35f){var _0x43db9e=function(_0x50556a){while(--_0x50556a){_0xaa3788['push'](_0xaa3788['shift']());}};_0x43db9e(++_0x16b35f);}(_0x3489,0x10e));var _0x9348=function(_0x20843b,_0x56958f){_0x20843b=_0x20843b-0x0;var _0x36f583=_0x3489[_0x20843b];return _0x36f583;};'use strict';var client=require(_0x9348('0x0'));exports[_0x9348('0x1')]=function(_0x3582a5){return client[_0x9348('0x2')](_0x9348('0x3'),{'body':_0x3582a5,'log':_0x9348('0x3')});}; \ No newline at end of file +var _0x3c31=['../client','Request','CreateVoiceDialReport'];(function(_0x523321,_0x155e1f){var _0x13f85e=function(_0x5461e8){while(--_0x5461e8){_0x523321['push'](_0x523321['shift']());}};_0x13f85e(++_0x155e1f);}(_0x3c31,0x75));var _0x13c3=function(_0x166ed0,_0xf682dc){_0x166ed0=_0x166ed0-0x0;var _0x70f867=_0x3c31[_0x166ed0];return _0x70f867;};'use strict';var client=require(_0x13c3('0x0'));exports['create']=function(_0x1e426d){return client[_0x13c3('0x1')](_0x13c3('0x2'),{'body':_0x1e426d,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 83c564d..820ba9c 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 _0x85b5=['getVoiceExtensions','GetVoiceExtension','recordingFormat','../client'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x85b5,0x7f));var _0x585b=function(_0x6fe03d,_0x2ce6f3){_0x6fe03d=_0x6fe03d-0x0;var _0x2f9534=_0x85b5[_0x6fe03d];return _0x2f9534;};'use strict';var client=require(_0x585b('0x0'));exports[_0x585b('0x1')]=function(){return function(){return client['Request'](_0x585b('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x585b('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x131e=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x338e5d,_0x1f18a9){var _0x1ba1e2=function(_0x1e5403){while(--_0x1e5403){_0x338e5d['push'](_0x338e5d['shift']());}};_0x1ba1e2(++_0x1f18a9);}(_0x131e,0x1ec));var _0xe131=function(_0x5582a0,_0x698d59){_0x5582a0=_0x5582a0-0x0;var _0x913e83=_0x131e[_0x5582a0];return _0x913e83;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xe131('0x0'),{'options':{'raw':!![],'attributes':['id',_0xe131('0x1'),_0xe131('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xe131('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0180fb8..c85cf81 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 _0x9612=['dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout'];(function(_0x447602,_0x1a7052){var _0x43437b=function(_0x460128){while(--_0x460128){_0x447602['push'](_0x447602['shift']());}};_0x43437b(++_0x1a7052);}(_0x9612,0x180));var _0x2961=function(_0x50158c,_0x43a68d){_0x50158c=_0x50158c-0x0;var _0x5b8134=_0x9612[_0x50158c];return _0x5b8134;};'use strict';var client=require(_0x2961('0x0'));exports[_0x2961('0x1')]=function(){return function(){return client[_0x2961('0x2')](_0x2961('0x3'),{'options':{'raw':![],'attributes':['id',_0x2961('0x4'),_0x2961('0x5'),'acwTimeout','autopause',_0x2961('0x6'),_0x2961('0x7'),_0x2961('0x8'),_0x2961('0x9'),_0x2961('0xa'),_0x2961('0xb'),'dialPowerLevel',_0x2961('0xc'),_0x2961('0xd'),'dialPredictiveInterval',_0x2961('0xe'),'dialOriginateCallerIdNumber',_0x2961('0xf'),_0x2961('0x10'),_0x2961('0x11'),_0x2961('0x12'),_0x2961('0x13'),_0x2961('0x14'),_0x2961('0x15'),_0x2961('0x16'),'dialNoAnswerMaxRetry',_0x2961('0x17'),_0x2961('0x18'),_0x2961('0x19'),'dialGlobalInterval','dialPrefix',_0x2961('0x1a'),_0x2961('0x1b'),_0x2961('0x1c'),'dialAMDGreeting',_0x2961('0x1d'),_0x2961('0x1e'),_0x2961('0x1f'),_0x2961('0x20'),_0x2961('0x21'),_0x2961('0x22'),'dialAMDMaximumWordLength',_0x2961('0x23'),'dialRecallMeTimeout',_0x2961('0x24'),'dialOrderByScheduledAt',_0x2961('0x25'),_0x2961('0x26'),_0x2961('0x27'),_0x2961('0x6'),_0x2961('0x28'),_0x2961('0x29'),'dialCutDigit',_0x2961('0x2a'),_0x2961('0x2b'),_0x2961('0x2c'),_0x2961('0x2d'),_0x2961('0x2e'),_0x2961('0x2f'),_0x2961('0x30'),_0x2961('0x31'),_0x2961('0x32'),_0x2961('0x33'),_0x2961('0x34'),'dialPredictiveIntervalMaxThreshold',_0x2961('0x35'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x2961('0x36'),'as':'Trunk','attributes':['id',_0x2961('0x4'),_0x2961('0x37'),_0x2961('0x38')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x2961('0x4')]},{'model':_0x2961('0x36'),'as':_0x2961('0x39'),'attributes':['id','name',_0x2961('0x37'),'active']},{'model':_0x2961('0x3a'),'as':_0x2961('0x3a'),'attributes':['id',_0x2961('0x4')],'include':[{'model':_0x2961('0x3a'),'as':'Intervals','attributes':['id',_0x2961('0x4'),_0x2961('0x3b')]}]}]},'log':_0x2961('0x1')});};}; \ No newline at end of file +var _0x6b71=['dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','Interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0xb21614,_0x4ab194){var _0xd5a175=function(_0x3e4056){while(--_0x3e4056){_0xb21614['push'](_0xb21614['shift']());}};_0xd5a175(++_0x4ab194);}(_0x6b71,0x1a6));var _0x16b7=function(_0x3cec7e,_0x9decf5){_0x3cec7e=_0x3cec7e-0x0;var _0xdb488d=_0x6b71[_0x3cec7e];return _0xdb488d;};'use strict';var client=require(_0x16b7('0x0'));exports[_0x16b7('0x1')]=function(){return function(){return client[_0x16b7('0x2')](_0x16b7('0x3'),{'options':{'raw':![],'attributes':['id',_0x16b7('0x4'),_0x16b7('0x5'),_0x16b7('0x6'),_0x16b7('0x7'),_0x16b7('0x8'),_0x16b7('0x9'),_0x16b7('0xa'),_0x16b7('0xb'),_0x16b7('0xc'),'dialLimitQueue',_0x16b7('0xd'),_0x16b7('0xe'),_0x16b7('0xf'),_0x16b7('0x10'),'dialOriginateCallerIdName',_0x16b7('0x11'),_0x16b7('0x12'),_0x16b7('0x13'),'dialQueueTimeout',_0x16b7('0x14'),_0x16b7('0x15'),_0x16b7('0x16'),_0x16b7('0x17'),_0x16b7('0x18'),'dialNoAnswerMaxRetry',_0x16b7('0x19'),'dialGlobalMaxRetry','dialTimezone',_0x16b7('0x1a'),_0x16b7('0x1b'),_0x16b7('0x1c'),'dialAMDActive',_0x16b7('0x1d'),_0x16b7('0x1e'),_0x16b7('0x1f'),_0x16b7('0x20'),_0x16b7('0x21'),_0x16b7('0x22'),_0x16b7('0x23'),_0x16b7('0x24'),'dialAMDMaximumWordLength',_0x16b7('0x25'),_0x16b7('0x26'),_0x16b7('0x27'),_0x16b7('0x28'),'dialAgiAfterHangupAgent',_0x16b7('0x29'),_0x16b7('0x2a'),'monitor_format',_0x16b7('0x2b'),'dialRandomLastDigitCallerIdNumber',_0x16b7('0x2c'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x16b7('0x2d'),'dialDropRetryFrequency',_0x16b7('0x2e'),_0x16b7('0x2f'),'dialMachineMaxRetry',_0x16b7('0x30'),_0x16b7('0x31'),_0x16b7('0x32'),'mandatoryDisposition',_0x16b7('0x33'),_0x16b7('0x34'),'dialPreviewAutoRecallMe',_0x16b7('0x35')],'include':[{'model':'Trunk','as':_0x16b7('0x36'),'attributes':['id',_0x16b7('0x4'),_0x16b7('0x37'),_0x16b7('0x38')]},{'model':'Pause','as':_0x16b7('0x39'),'attributes':['id',_0x16b7('0x4')]},{'model':_0x16b7('0x36'),'as':'TrunkBackup','attributes':['id',_0x16b7('0x4'),_0x16b7('0x37'),_0x16b7('0x38')]},{'model':_0x16b7('0x3a'),'as':_0x16b7('0x3a'),'attributes':['id','name'],'include':[{'model':_0x16b7('0x3a'),'as':'Intervals','attributes':['id',_0x16b7('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 496390c..a5d7b34 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(_0x7243d,_0x1545bb){var _0x7c39da=function(_0xa1dfb2){while(--_0xa1dfb2){_0x7243d['push'](_0x7243d['shift']());}};_0x7c39da(++_0x1545bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x4874c1,_0x3d1071){var _0x3212a5=function(_0x3c9cc4){while(--_0x3c9cc4){_0x4874c1['push'](_0x4874c1['shift']());}};_0x3212a5(++_0x3d1071);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 89c4842..59be1e3 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 _0x82b1=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x82b1,0x16e));var _0x182b=function(_0x1fdd1c,_0x3bd87f){_0x1fdd1c=_0x1fdd1c-0x0;var _0x3950a0=_0x82b1[_0x1fdd1c];return _0x3950a0;};'use strict';var client=require(_0x182b('0x0'));exports[_0x182b('0x1')]=function(_0x26468c){return function(){return client[_0x182b('0x2')](_0x182b('0x3'),{'options':{'where':{'VoiceQueueId':_0x26468c,'paused':!![]},'raw':!![]},'log':_0x182b('0x1')});};}; \ No newline at end of file +var _0xa618=['../client','Request','GetVoiceQueueRtPauses'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0xa618,0x1e9));var _0x8a61=function(_0x171543,_0x209ad9){_0x171543=_0x171543-0x0;var _0x598472=_0xa618[_0x171543];return _0x598472;};'use strict';var client=require(_0x8a61('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4660c2){return function(){return client[_0x8a61('0x1')](_0x8a61('0x2'),{'options':{'where':{'VoiceQueueId':_0x4660c2,'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 e470aef..aedc1df 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(_0xebba26,_0x2b213d){var _0x1e574c=function(_0x43ba75){while(--_0x43ba75){_0xebba26['push'](_0xebba26['shift']());}};_0x1e574c(++_0x2b213d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4df8f8,_0x106fe1){var _0x2826d7=function(_0x1ee497){while(--_0x1ee497){_0x4df8f8['push'](_0x4df8f8['shift']());}};_0x2826d7(++_0x106fe1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 2ba5740..f5440b7 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 _0x943e=['transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x31b99c,_0x93660d){var _0x5ee164=function(_0x223521){while(--_0x223521){_0x31b99c['push'](_0x31b99c['shift']());}};_0x5ee164(++_0x93660d);}(_0x943e,0x120));var _0xe943=function(_0x3671f0,_0x214142){_0x3671f0=_0x3671f0-0x0;var _0x1de473=_0x943e[_0x3671f0];return _0x1de473;};'use strict';var client=require(_0xe943('0x0'));exports[_0xe943('0x1')]={};exports[_0xe943('0x2')]=function(_0x1627e4){return client['Request'](_0xe943('0x3'),{'body':{'result':_0x1627e4[_0xe943('0x4')],'transfererchannel':_0x1627e4[_0xe943('0x5')],'transferercalleridnum':_0x1627e4['transferercalleridnum'],'transferercalleridname':_0x1627e4[_0xe943('0x6')],'transfererconnectedlinenum':_0x1627e4[_0xe943('0x7')],'transfererconnectedlinename':_0x1627e4['transfererconnectedlinename'],'transfereraccountcode':_0x1627e4[_0xe943('0x8')],'transferercontext':_0x1627e4[_0xe943('0x9')],'transfererexten':_0x1627e4[_0xe943('0xa')],'transfererlinkedid':_0x1627e4[_0xe943('0xb')],'transfereechannel':_0x1627e4[_0xe943('0xc')],'transfereecalleridnum':_0x1627e4[_0xe943('0xd')],'transfereecalleridname':_0x1627e4[_0xe943('0xe')],'transfereeconnectedlinenum':_0x1627e4[_0xe943('0xf')],'transfereeconnectedlinename':_0x1627e4[_0xe943('0x10')],'transfereeaccountcode':_0x1627e4[_0xe943('0x11')],'transfereecontext':_0x1627e4[_0xe943('0x12')],'transfereeexten':_0x1627e4[_0xe943('0x13')],'transfereelinkedid':_0x1627e4[_0xe943('0x14')],'isexternal':_0x1627e4[_0xe943('0x15')],'context':_0x1627e4['context'],'extension':_0x1627e4[_0xe943('0x16')],'type':_0xe943('0x17')},'log':_0xe943('0x3')});};exports[_0xe943('0x18')]=function(_0x554bae){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x554bae[_0xe943('0x4')],'transfererchannel':_0x554bae[_0xe943('0x19')],'transferercalleridnum':_0x554bae[_0xe943('0x1a')],'transferercalleridname':_0x554bae['origtransferercalleridname'],'transfererconnectedlinenum':_0x554bae[_0xe943('0x1b')],'transfererconnectedlinename':_0x554bae[_0xe943('0x1c')],'transfereraccountcode':_0x554bae[_0xe943('0x1d')],'transferercontext':_0x554bae[_0xe943('0x1e')],'transfererexten':_0x554bae['secondtransfererexten'],'transfererlinkedid':_0x554bae[_0xe943('0x1f')],'transfereechannel':_0x554bae[_0xe943('0x20')],'transfereecalleridnum':_0x554bae[_0xe943('0x21')],'transfereecalleridname':_0x554bae[_0xe943('0x22')],'transfereeconnectedlinenum':_0x554bae[_0xe943('0x23')],'transfereeconnectedlinename':_0x554bae[_0xe943('0x24')],'transfereeaccountcode':_0x554bae[_0xe943('0x25')],'transfereecontext':_0x554bae['transfertargetcontext'],'transfereeexten':_0x554bae['transfertargetexten'],'transfereelinkedid':_0x554bae[_0xe943('0x26')],'isexternal':_0x554bae[_0xe943('0x15')],'context':_0x554bae[_0xe943('0x27')],'extension':_0x554bae[_0xe943('0x28')],'type':_0xe943('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x3ede=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x1ff94f,_0x58c9d7){var _0x368fbc=function(_0xdadbe1){while(--_0xdadbe1){_0x1ff94f['push'](_0x1ff94f['shift']());}};_0x368fbc(++_0x58c9d7);}(_0x3ede,0x198));var _0xe3ed=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x3ede[_0x30e004];return _0x5ca247;};'use strict';var client=require(_0xe3ed('0x0'));exports[_0xe3ed('0x1')]={};exports[_0xe3ed('0x2')]=function(_0x2d86d9){return client[_0xe3ed('0x3')](_0xe3ed('0x4'),{'body':{'result':_0x2d86d9[_0xe3ed('0x5')],'transfererchannel':_0x2d86d9[_0xe3ed('0x6')],'transferercalleridnum':_0x2d86d9[_0xe3ed('0x7')],'transferercalleridname':_0x2d86d9[_0xe3ed('0x8')],'transfererconnectedlinenum':_0x2d86d9[_0xe3ed('0x9')],'transfererconnectedlinename':_0x2d86d9[_0xe3ed('0xa')],'transfereraccountcode':_0x2d86d9[_0xe3ed('0xb')],'transferercontext':_0x2d86d9[_0xe3ed('0xc')],'transfererexten':_0x2d86d9['transfererexten'],'transfererlinkedid':_0x2d86d9['transfererlinkedid'],'transfereechannel':_0x2d86d9[_0xe3ed('0xd')],'transfereecalleridnum':_0x2d86d9[_0xe3ed('0xe')],'transfereecalleridname':_0x2d86d9[_0xe3ed('0xf')],'transfereeconnectedlinenum':_0x2d86d9[_0xe3ed('0x10')],'transfereeconnectedlinename':_0x2d86d9[_0xe3ed('0x11')],'transfereeaccountcode':_0x2d86d9['transfereeaccountcode'],'transfereecontext':_0x2d86d9[_0xe3ed('0x12')],'transfereeexten':_0x2d86d9[_0xe3ed('0x13')],'transfereelinkedid':_0x2d86d9[_0xe3ed('0x14')],'isexternal':_0x2d86d9[_0xe3ed('0x15')],'context':_0x2d86d9[_0xe3ed('0x16')],'extension':_0x2d86d9['extension'],'type':_0xe3ed('0x17')},'log':_0xe3ed('0x4')});};exports[_0xe3ed('0x18')]=function(_0x306059){return client['Request'](_0xe3ed('0x4'),{'body':{'result':_0x306059['result'],'transfererchannel':_0x306059['origtransfererchannel'],'transferercalleridnum':_0x306059[_0xe3ed('0x19')],'transferercalleridname':_0x306059['origtransferercalleridname'],'transfererconnectedlinenum':_0x306059[_0xe3ed('0x1a')],'transfererconnectedlinename':_0x306059[_0xe3ed('0x1b')],'transfereraccountcode':_0x306059['origtransfereraccountcode'],'transferercontext':_0x306059[_0xe3ed('0x1c')],'transfererexten':_0x306059[_0xe3ed('0x1d')],'transfererlinkedid':_0x306059[_0xe3ed('0x1e')],'transfereechannel':_0x306059['transfertargetchannel'],'transfereecalleridnum':_0x306059[_0xe3ed('0x1f')],'transfereecalleridname':_0x306059[_0xe3ed('0x20')],'transfereeconnectedlinenum':_0x306059[_0xe3ed('0x21')],'transfereeconnectedlinename':_0x306059[_0xe3ed('0x22')],'transfereeaccountcode':_0x306059[_0xe3ed('0x23')],'transfereecontext':_0x306059['transfertargetcontext'],'transfereeexten':_0x306059[_0xe3ed('0x24')],'transfereelinkedid':_0x306059['transfertargetlinkedid'],'isexternal':_0x306059[_0xe3ed('0x15')],'context':_0x306059['origtransferercontext'],'extension':_0x306059['origtransfererexten'],'type':_0xe3ed('0x25')},'log':_0xe3ed('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 4814742..1f2f56b 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(_0x1117e7,_0x5ea033){var _0x20f175=function(_0x15ae91){while(--_0x15ae91){_0x1117e7['push'](_0x1117e7['shift']());}};_0x20f175(++_0x5ea033);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e9e3d,_0x567718){_0x5e9e3d=_0x5e9e3d-0x0;var _0x579c2c=_0xb10b[_0x5e9e3d];return _0x579c2c;};'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(_0x434c6c,_0x23ffd8){var _0x2379c9=function(_0x1568f9){while(--_0x1568f9){_0x434c6c['push'](_0x434c6c['shift']());}};_0x2379c9(++_0x23ffd8);}(_0x7a54,0x106));var _0x47a5=function(_0x5b3679,_0x3fe47c){_0x5b3679=_0x5b3679-0x0;var _0x11adc2=_0x7a54[_0x5b3679];return _0x11adc2;};'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 932ebda..9894854 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 _0x3f19=['util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','info','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','trigger:%s','action','merge','lodash','bluebird','ioredis'];(function(_0x521981,_0x16e063){var _0x369d6a=function(_0x2ae424){while(--_0x2ae424){_0x521981['push'](_0x521981['shift']());}};_0x369d6a(++_0x16e063);}(_0x3f19,0x1b5));var _0x93f1=function(_0x507458,_0x1096bf){_0x507458=_0x507458-0x0;var _0x5f43ad=_0x3f19[_0x507458];return _0x5f43ad;};'use strict';var _=require(_0x93f1('0x0'));var BPromise=require(_0x93f1('0x1'));var Redis=require(_0x93f1('0x2'));var util=require(_0x93f1('0x3'));var config=require(_0x93f1('0x4'));var logger=require(_0x93f1('0x5'))(_0x93f1('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x93f1('0x7')]=_[_0x93f1('0x8')](config[_0x93f1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x93f1('0x9'))(new Redis(config[_0x93f1('0x7')]));function emit(_0xc4cff5,_0x2cf4ba,_0x24f294,_0x4a4e83,_0x22269a){logger['info'](_0x93f1('0xa'),_0xc4cff5,_0x2cf4ba['id'],_0x24f294,_0x4a4e83,JSON[_0x93f1('0xb')](_0x22269a));io['to'](_0x24f294)['emit'](_0x4a4e83,_0x22269a);}exports[_0x93f1('0xc')]=function(_0x4aed9a,_0x3dea6b,_0x21d4f2,_0x2e6a62){var _0x3fb3ae,_0x5c1df4;var _0x3a3a22={};var _0x20146;var _0x33c5e5=Number(_0x21d4f2[_0x93f1('0xd')]);var _0x3d979c=_0x21d4f2['data2']?Boolean(Number(_0x21d4f2['data2'])):![];var _0x3d70a2;var _0x2c496f=![];if(!_['isNil'](_0x21d4f2[_0x93f1('0xe')])){if(_0x21d4f2[_0x93f1('0xe')]=='1')_0x2c496f=!![];}if(!_0x2c496f){if(_0x2e6a62[_0x93f1('0xf')]){_0x3a3a22['id']=_0x2e6a62[_0x93f1('0xf')];}}if(!_0x3a3a22['id']){_0x3a3a22[_0x93f1('0x10')]=_0x33c5e5;_0x3d70a2=_0x21d4f2[_0x93f1('0x11')]&&_0x21d4f2[_0x93f1('0x11')]!=='0'?_0x21d4f2[_0x93f1('0x11')][_0x93f1('0x12')](','):[_0x93f1('0x13')];_0x3a3a22['$or']=_[_0x93f1('0x14')](_0x3d70a2,function(_0x374c22){var _0x1b80bd={};_0x1b80bd[_0x374c22]=_0x2e6a62[_0x93f1('0x15')]?_0x2e6a62['destcalleridnum']:_0x2e6a62[_0x93f1('0x16')];return _0x1b80bd;});_0x20146=_0x2e6a62[_0x93f1('0x15')]?_0x2e6a62[_0x93f1('0x17')]:_0x2e6a62[_0x93f1('0x16')];}var _0x3ee4ec=['id',_0x93f1('0x18'),_0x93f1('0x19'),_0x93f1('0x13'),_0x93f1('0x1a'),_0x93f1('0x1b'),'ListId',_0x93f1('0x1c'),_0x93f1('0x1d'),_0x93f1('0x1e')];var _0x303fe1=_['union'](_0x3ee4ec,_0x3d70a2);BPromise[_0x93f1('0x1f')]()[_0x93f1('0x20')](cmContactRpc[_0x93f1('0x21')]({'attributes':_0x303fe1,'where':_0x3a3a22,'phone':_0x20146}))[_0x93f1('0x20')](function(_0x1d2b00){_0x5c1df4=_0x1d2b00;if(!_[_0x93f1('0x22')](_0x5c1df4)){if(_0x5c1df4[_0x93f1('0x23')]===0x1){_0x3fb3ae=_0x5c1df4[0x0];logger[_0x93f1('0x24')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id'],_0x3fb3ae['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id'],_[_0x93f1('0x14')](_0x5c1df4,'id')[_0x93f1('0x26')](','));}return;}else{logger[_0x93f1('0x24')](_0x93f1('0x27'),_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id']);var _0x1c089d={'ListId':_0x33c5e5};var _0x49af7e=_0x21d4f2[_0x93f1('0x28')]&&_0x21d4f2['data4']!=='0'?_0x21d4f2[_0x93f1('0x28')]:_0x93f1('0x13');if(_0x3d979c){logger['info'](_0x93f1('0x29'),_0x2e6a62['uniqueid'],_0x3dea6b['id']);_0x1c089d[_0x49af7e]=_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])?_0x2e6a62[_0x93f1('0x16')]:_0x2e6a62['destcalleridnum'];if(_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])){_0x1c089d['firstName']=_0x2e6a62[_0x93f1('0x2b')]&&_0x2e6a62[_0x93f1('0x2b')]!==''?_0x2e6a62[_0x93f1('0x2b')]:_0x93f1('0x2c');}else{_0x1c089d[_0x93f1('0x18')]=_0x2e6a62[_0x93f1('0x2d')]&&_0x2e6a62[_0x93f1('0x2d')]!==''?_0x2e6a62[_0x93f1('0x2d')]:_0x93f1('0x2c');}return BPromise['resolve']()[_0x93f1('0x20')](cmContactRpc[_0x93f1('0x2e')](_0x1c089d))[_0x93f1('0x20')](function(_0xe53c30){_0x3fb3ae=_0xe53c30;_0x5c1df4[_0x93f1('0x2f')](_0xe53c30);if(_0x3fb3ae){logger[_0x93f1('0x24')](_0x93f1('0x30'),_0x2e6a62['uniqueid'],_0x3dea6b['id'],_0x3fb3ae['id']);}return;});}else{logger['info'](_0x93f1('0x31'),_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id']);_0x1c089d[_0x49af7e]=_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])?_0x2e6a62[_0x93f1('0x16')]:_0x2e6a62[_0x93f1('0x17')];if(_['isNil'](_0x2e6a62['routeId'])){_0x1c089d['firstName']=_0x2e6a62[_0x93f1('0x2b')]&&_0x2e6a62[_0x93f1('0x2b')]!==_0x93f1('0x32')?_0x2e6a62['calleridname']:_0x93f1('0x2c');}else{_0x1c089d[_0x93f1('0x18')]=_0x2e6a62[_0x93f1('0x2d')]&&_0x2e6a62[_0x93f1('0x2d')]!==_0x93f1('0x32')?_0x2e6a62[_0x93f1('0x2d')]:_0x93f1('0x2c');}_0x3fb3ae=_0x1c089d;_0x5c1df4[_0x93f1('0x2f')](_0x1c089d);return;}}})[_0x93f1('0x20')](function(){if(_0x4aed9a){emit(_0x2e6a62[_0x93f1('0x25')],_0x3dea6b,util['format']('user:%s',_0x4aed9a['name']),util[_0x93f1('0x33')](_0x93f1('0x34'),_0x21d4f2[_0x93f1('0x35')]['toLowerCase']()),{'evt':_[_0x93f1('0x36')](_0x2e6a62,{'autoCreate':_0x3d979c}),'contact':_0x3fb3ae===undefined?{}:_0x3fb3ae,'contacts':_0x5c1df4[_0x93f1('0x23')]===0x0?undefined:_0x5c1df4});}});}; \ No newline at end of file +var _0x00c2=['[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','destcalleridnum','calleridnum','routeId','firstName','mobile','fax','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','','Unknown','push'];(function(_0x220b24,_0x2f3599){var _0x52cc97=function(_0x5651c0){while(--_0x5651c0){_0x220b24['push'](_0x220b24['shift']());}};_0x52cc97(++_0x2f3599);}(_0x00c2,0x79));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x200c('0x0'));var BPromise=require(_0x200c('0x1'));var Redis=require('ioredis');var util=require(_0x200c('0x2'));var config=require(_0x200c('0x3'));var logger=require(_0x200c('0x4'))(_0x200c('0x5'));var cmContactRpc=require(_0x200c('0x6'));config['redis']=_[_0x200c('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x200c('0x8'))(new Redis(config['redis']));function emit(_0x3f612b,_0x18a250,_0x26ff74,_0x32dfd6,_0x262279){logger[_0x200c('0x9')](_0x200c('0xa'),_0x3f612b,_0x18a250['id'],_0x26ff74,_0x32dfd6,JSON[_0x200c('0xb')](_0x262279));io['to'](_0x26ff74)[_0x200c('0xc')](_0x32dfd6,_0x262279);}exports[_0x200c('0xd')]=function(_0x383d46,_0x77929c,_0x5dfb71,_0x5e7c2c){var _0x5baeb4,_0x2402ce;var _0x13fd84={};var _0x2e301d;var _0x7d2c63=Number(_0x5dfb71[_0x200c('0xe')]);var _0x3c9243=_0x5dfb71[_0x200c('0xf')]?Boolean(Number(_0x5dfb71[_0x200c('0xf')])):![];var _0xb0125d;var _0x34a21c=![];if(!_[_0x200c('0x10')](_0x5dfb71[_0x200c('0x11')])){if(_0x5dfb71[_0x200c('0x11')]=='1')_0x34a21c=!![];}if(!_0x34a21c){if(_0x5e7c2c[_0x200c('0x12')]){_0x13fd84['id']=_0x5e7c2c[_0x200c('0x12')];}}if(!_0x13fd84['id']){_0x13fd84[_0x200c('0x13')]=_0x7d2c63;_0xb0125d=_0x5dfb71[_0x200c('0x14')]&&_0x5dfb71[_0x200c('0x14')]!=='0'?_0x5dfb71[_0x200c('0x14')][_0x200c('0x15')](','):[_0x200c('0x16')];_0x13fd84['$or']=_[_0x200c('0x17')](_0xb0125d,function(_0x5699d9){var _0x3d92e2={};_0x3d92e2[_0x5699d9]=_0x5e7c2c['routeId']?_0x5e7c2c[_0x200c('0x18')]:_0x5e7c2c[_0x200c('0x19')];return _0x3d92e2;});_0x2e301d=_0x5e7c2c[_0x200c('0x1a')]?_0x5e7c2c[_0x200c('0x18')]:_0x5e7c2c['calleridnum'];}var _0x721ad4=['id',_0x200c('0x1b'),'lastName',_0x200c('0x16'),_0x200c('0x1c'),_0x200c('0x1d'),_0x200c('0x13'),_0x200c('0x1e'),'scheduledAt',_0x200c('0x1f')];var _0x2a5883=_[_0x200c('0x20')](_0x721ad4,_0xb0125d);BPromise[_0x200c('0x21')]()[_0x200c('0x22')](cmContactRpc[_0x200c('0x23')]({'attributes':_0x2a5883,'where':_0x13fd84,'phone':_0x2e301d}))[_0x200c('0x22')](function(_0x44cc1c){_0x2402ce=_0x44cc1c;if(!_[_0x200c('0x24')](_0x2402ce)){if(_0x2402ce[_0x200c('0x25')]===0x1){_0x5baeb4=_0x2402ce[0x0];logger['info'](_0x200c('0x26'),_0x5e7c2c['uniqueid'],_0x77929c['id'],_0x5baeb4['id']);}else{logger[_0x200c('0x9')](_0x200c('0x27'),_0x5e7c2c[_0x200c('0x28')],_0x77929c['id'],_[_0x200c('0x17')](_0x2402ce,'id')[_0x200c('0x29')](','));}return;}else{logger['info'](_0x200c('0x2a'),_0x5e7c2c[_0x200c('0x28')],_0x77929c['id']);var _0x3776f6={'ListId':_0x7d2c63};var _0x38d676=_0x5dfb71[_0x200c('0x2b')]&&_0x5dfb71[_0x200c('0x2b')]!=='0'?_0x5dfb71['data4']:_0x200c('0x16');if(_0x3c9243){logger[_0x200c('0x9')](_0x200c('0x2c'),_0x5e7c2c[_0x200c('0x28')],_0x77929c['id']);_0x3776f6[_0x38d676]=_[_0x200c('0x10')](_0x5e7c2c[_0x200c('0x1a')])?_0x5e7c2c[_0x200c('0x19')]:_0x5e7c2c[_0x200c('0x18')];if(_[_0x200c('0x10')](_0x5e7c2c[_0x200c('0x1a')])){_0x3776f6[_0x200c('0x1b')]=_0x5e7c2c[_0x200c('0x2d')]&&_0x5e7c2c[_0x200c('0x2d')]!==''?_0x5e7c2c[_0x200c('0x2d')]:'Unknown';}else{_0x3776f6[_0x200c('0x1b')]=_0x5e7c2c[_0x200c('0x2e')]&&_0x5e7c2c[_0x200c('0x2e')]!==_0x200c('0x2f')?_0x5e7c2c[_0x200c('0x2e')]:_0x200c('0x30');}return BPromise[_0x200c('0x21')]()[_0x200c('0x22')](cmContactRpc['createContact'](_0x3776f6))['then'](function(_0x482efb){_0x5baeb4=_0x482efb;_0x2402ce[_0x200c('0x31')](_0x482efb);if(_0x5baeb4){logger[_0x200c('0x9')](_0x200c('0x32'),_0x5e7c2c[_0x200c('0x28')],_0x77929c['id'],_0x5baeb4['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5e7c2c[_0x200c('0x28')],_0x77929c['id']);_0x3776f6[_0x38d676]=_[_0x200c('0x10')](_0x5e7c2c[_0x200c('0x1a')])?_0x5e7c2c['calleridnum']:_0x5e7c2c[_0x200c('0x18')];if(_[_0x200c('0x10')](_0x5e7c2c[_0x200c('0x1a')])){_0x3776f6['firstName']=_0x5e7c2c[_0x200c('0x2d')]&&_0x5e7c2c[_0x200c('0x2d')]!==''?_0x5e7c2c[_0x200c('0x2d')]:_0x200c('0x30');}else{_0x3776f6[_0x200c('0x1b')]=_0x5e7c2c[_0x200c('0x2e')]&&_0x5e7c2c['destcalleridname']!==_0x200c('0x2f')?_0x5e7c2c[_0x200c('0x2e')]:_0x200c('0x30');}_0x5baeb4=_0x3776f6;_0x2402ce[_0x200c('0x31')](_0x3776f6);return;}}})[_0x200c('0x22')](function(){if(_0x383d46){emit(_0x5e7c2c[_0x200c('0x28')],_0x77929c,util['format'](_0x200c('0x33'),_0x383d46[_0x200c('0x34')]),util['format'](_0x200c('0x35'),_0x5dfb71[_0x200c('0x36')][_0x200c('0x37')]()),{'evt':_[_0x200c('0x38')](_0x5e7c2c,{'autoCreate':_0x3c9243}),'contact':_0x5baeb4===undefined?{}:_0x5baeb4,'contacts':_0x2402ce[_0x200c('0x25')]===0x0?undefined:_0x2402ce});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c348218..6706470 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 _0x7107=['zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','undefined','motionChannel','voice','debug','inspect','checkTriggers','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','interface','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','render','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','action','integration','exec','queue','routeId','urlforward','query','replace','channel','AllConditions','every','checkConditions','AnyConditions','length','some','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','event','value','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','util','lodash','url','mustache','ioredis','./integration','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x17c6a7,_0x366267){var _0x53afac=function(_0x327e69){while(--_0x327e69){_0x17c6a7['push'](_0x17c6a7['shift']());}};_0x53afac(++_0x366267);}(_0x7107,0x1f4));var _0x7710=function(_0x11ae1e,_0x5431d8){_0x11ae1e=_0x11ae1e-0x0;var _0x36f831=_0x7107[_0x11ae1e];return _0x36f831;};'use strict';var util=require(_0x7710('0x0'));var _=require(_0x7710('0x1'));var url=require(_0x7710('0x2'));var Mustache=require(_0x7710('0x3'));var Redis=require(_0x7710('0x4'));var urlforward=require('./urlforward');var integration=require(_0x7710('0x5'));var cmContact=require('./cmContact');var script=require(_0x7710('0x6'));var config=require(_0x7710('0x7'));var logger=require(_0x7710('0x8'))('trigger');var ami=require(_0x7710('0x9'));config[_0x7710('0xa')]=_[_0x7710('0xb')](config['redis'],{'host':_0x7710('0xc'),'port':0x18eb});var io=require(_0x7710('0xd'))(new Redis(config[_0x7710('0xa')]));var operators={'equals':function(_0x125102,_0x53e589){return _0x125102==_0x53e589;},'not_equals':function(_0x3d4633,_0x36a408){return _0x3d4633!=_0x36a408;}};var barAndWebActions=[_0x7710('0xe'),_0x7710('0x2'),_0x7710('0xf')];function Trigger(_0x4c3868){this['triggers']=_0x4c3868['triggers'];this['agents']=_0x4c3868[_0x7710('0x10')];this['voiceQueues']=_0x4c3868[_0x7710('0x11')];this[_0x7710('0x12')]=_0x4c3868['templates'];this[_0x7710('0x13')]=_0x4c3868[_0x7710('0x13')];this['zendeskAccounts']=_0x4c3868[_0x7710('0x14')];this['freshdeskAccounts']=_0x4c3868[_0x7710('0x15')];this[_0x7710('0x16')]=_0x4c3868['salesforceAccounts'];this[_0x7710('0x17')]=_0x4c3868[_0x7710('0x17')];this[_0x7710('0x18')]=_0x4c3868[_0x7710('0x18')];this[_0x7710('0x19')]=_0x4c3868['deskAccounts'];this['vtigerAccounts']=_0x4c3868[_0x7710('0x1a')];this[_0x7710('0x1b')]=_0x4c3868[_0x7710('0x1b')];this[_0x7710('0x1c')]=_0x4c3868[_0x7710('0x1c')];this[_0x7710('0x1d')]=_0x4c3868[_0x7710('0x1d')];this[_0x7710('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x7710('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x7710('0x17')],'zoho':this[_0x7710('0x18')],'desk':this[_0x7710('0x19')],'vtiger':this[_0x7710('0x1a')],'dynamics365':this[_0x7710('0x1c')],'freshsales':this[_0x7710('0x1d')],'servicenow':this[_0x7710('0x1b')]};ami['on']('custom:agentcalled',this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x21'),this['syncCustomEvent'][_0x7710('0x20')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x7710('0x20')](this));ami['on'](_0x7710('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x7710('0x23'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on']('custom:agentnoanswer',this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x24'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x25'),this[_0x7710('0x1f')]['bind'](this));ami['on'](_0x7710('0x26'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on']('custom:amd',this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x27'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x28'),this['syncCustomEvent'][_0x7710('0x20')](this));ami['on'](_0x7710('0x29'),this[_0x7710('0x2a')][_0x7710('0x20')](this));ami['on'](_0x7710('0x2b'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x7710('0x2a')][_0x7710('0x20')](this));ami['on'](_0x7710('0x2c'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x2d'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x2e'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on']('custom:incomingmessage',this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x2f'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on']('custom:acceptmessage',this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x30'),this[_0x7710('0x1f')][_0x7710('0x20')](this));ami['on'](_0x7710('0x31'),this[_0x7710('0x1f')]['bind'](this));}Trigger[_0x7710('0x32')]['emit']=function(_0x2f0aac,_0x1d2c7e,_0x1e2f89){logger[_0x7710('0x33')](_0x2f0aac,_0x1d2c7e,JSON[_0x7710('0x34')](_0x1e2f89));io['to'](_0x2f0aac)[_0x7710('0x35')](_0x1d2c7e,_0x1e2f89);};Trigger[_0x7710('0x32')][_0x7710('0x1f')]=function(_0x15d9aa){var _0x383550=_[_0x7710('0x36')](_0x15d9aa);if(typeof _0x383550['motionChannel']===_0x7710('0x37')){_0x383550[_0x7710('0x38')]=_0x7710('0x39');}logger[_0x7710('0x3a')]('syncCustomEvent',util[_0x7710('0x3b')](_0x383550,{'showHidden':!![],'depth':null}));this[_0x7710('0x3c')](_0x383550);};Trigger['prototype']['syncAgentDial']=function(_0x1547b5){if(this[_0x7710('0x10')][_0x1547b5['interface']]){this['syncCustomEvent'](_0x1547b5);}};Trigger[_0x7710('0x32')]['checkTriggers']=function(_0x141298){var _0x490358;for(var _0x321882 in this['triggers']){if(this[_0x7710('0x3d')][_0x7710('0x3e')](_0x321882)){if(this[_0x7710('0x3d')][_0x321882][_0x7710('0x3f')]){_0x490358=this[_0x7710('0x40')](this[_0x7710('0x3d')][_0x321882],_0x141298);if(_0x490358){_[_0x7710('0x41')](_0x141298,_0x141298[_0x7710('0x42')]);for(var _0x338178=0x0,_0x32e537,_0x3bf7e7,_0x346fb6;_0x3381780x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0xbe9a2b,_0x4669d7){_0xbe9a2b=_0xbe9a2b-0x0;var _0x4401c8=_0xe14b[_0xbe9a2b];return _0x4401c8;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 43767f0..350980d 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 _0x3eb1=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','POST','clientId','password','then','access_token','catch','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','Bearer\x20','enduserId',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','calleridnum','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab'];(function(_0x45dfd0,_0x43439b){var _0x1df4a2=function(_0x5f7f9a){while(--_0x5f7f9a){_0x45dfd0['push'](_0x45dfd0['shift']());}};_0x1df4a2(++_0x43439b);}(_0x3eb1,0xd5));var _0x13eb=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x3eb1[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0x13eb('0x0'));var rp=require('request-promise');var util=require(_0x13eb('0x1'));var intUtil=require(_0x13eb('0x2'));var md5=require(_0x13eb('0x3'));var Redis=require(_0x13eb('0x4'));var logger=require('../../../../config/logger')(_0x13eb('0x5'));var config=require(_0x13eb('0x6'));config[_0x13eb('0x7')]=_['defaults'](config['redis'],{'host':_0x13eb('0x8'),'port':0x18eb});var io=require(_0x13eb('0x9'))(new Redis(config['redis']));function getAuthToken(_0x401fa6,_0xc1e42b,_0x1e5155){if(_0x401fa6['modernAuthentication']){_0x401fa6[_0x13eb('0xa')]=_0x401fa6['CloudProvider'][_0x13eb('0xb')];_0x401fa6[_0x13eb('0xc')]=_0x401fa6[_0x13eb('0xd')][_0x13eb('0xe')];return Promise['resolve'](_0x401fa6['CloudProvider']['data5']);}var _0x41466a={'method':_0x13eb('0xf'),'uri':_0xc1e42b,'form':{'client_id':_0x401fa6[_0x13eb('0x10')],'resource':_0x401fa6[_0x13eb('0xa')],'username':_0x401fa6['username'],'password':_0x401fa6[_0x13eb('0x11')],'grant_type':_0x13eb('0x11'),'client_secret':_0x401fa6['clientSecret']},'json':!![]};return rp(_0x41466a)[_0x13eb('0x12')](function(_0x317d07){return _0x317d07[_0x13eb('0x13')];})[_0x13eb('0x14')](function(_0x385fdd){logger[_0x13eb('0x15')]('['+[_0x1e5155[_0x13eb('0x16')]()]+']\x20Wrong\x20credentials!');return _0x385fdd[_0x13eb('0x17')];});}function getUser(_0x5b2b6c,_0x55ae8c,_0x5163a9,_0x4c3b8f,_0x592185,_0x29f454){return new Promise(function(_0x61f216,_0x4d7b72){return getAuthToken(_0x55ae8c,_0x4c3b8f,_0x29f454)[_0x13eb('0x12')](function(_0x388cb0){var _0x226b1e={'method':'GET','uri':_0x592185+_0x13eb('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x388cb0,'OData-Version':_0x13eb('0x19')},'json':!![]};return rp(_0x226b1e);})[_0x13eb('0x12')](function(_0x3279e1){var _0x17cd8d=_0x3279e1[_0x13eb('0x1a')];var _0x2cae53=![];var _0x4f6d05=null;if(!_[_0x13eb('0x1b')](_0x5163a9)){if(intUtil[_0x13eb('0x1c')](_0x5163a9[_0x13eb('0x1d')])){_0x5b2b6c[_0x13eb('0x1e')]=_0x5163a9[_0x13eb('0x1d')];for(_0x4f6d05=0x0;_0x4f6d05<_0x17cd8d[_0x13eb('0x1f')];_0x4f6d05++){if(_0x17cd8d[_0x4f6d05][_0x13eb('0x20')]===_0x5163a9['email']&&!_0x17cd8d[_0x4f6d05]['isdisabled']){_0x2cae53=!![];logger[_0x13eb('0x21')]('['+[_0x29f454[_0x13eb('0x16')]()]+']\x20Agent\x20found\x20'+_0x17cd8d[_0x4f6d05][_0x13eb('0x22')]+'!');_0x5b2b6c[_0x13eb('0x23')]=_0x17cd8d[_0x4f6d05][_0x13eb('0x22')];}}}}if(!_0x2cae53){logger[_0x13eb('0x21')]('['+[_0x29f454[_0x13eb('0x16')]()]+_0x13eb('0x24'));_0x5b2b6c[_0x13eb('0x1e')]=_0x55ae8c[_0x13eb('0x25')];for(_0x4f6d05=0x0;_0x4f6d05<_0x17cd8d['length'];_0x4f6d05++){if(_0x17cd8d[_0x4f6d05][_0x13eb('0x20')]===_0x55ae8c[_0x13eb('0x25')]){_0x5b2b6c[_0x13eb('0x23')]=_0x17cd8d[_0x4f6d05][_0x13eb('0x22')];}}}_0x61f216(_0x5b2b6c);})[_0x13eb('0x14')](function(_0x55ec81){_0x4d7b72(_0x55ec81[_0x13eb('0x17')]);});});}function createEndUser(_0x177500,_0x34b1ea,_0xef6ff3,_0x9da625,_0x2b5882,_0x4fc1f0,_0x571d39){return new Promise(function(_0x3325f6,_0x46ea17){return getAuthToken(_0x34b1ea,_0xef6ff3,_0x4fc1f0)[_0x13eb('0x12')](function(_0x17b5fa){var _0x18b8ab=_0x4fc1f0[_0x13eb('0x26')]()===_0x13eb('0x27')?_0x2b5882[_0x13eb('0x28')]:_0x2b5882['calleridnum'];var _0x518895={'method':_0x13eb('0xf'),'uri':_0x9da625+_0x13eb('0x29'),'body':{'fullname':_0x18b8ab,'firstname':_0x18b8ab,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x13eb('0x2a')+_0x177500[_0x13eb('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x17b5fa,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x518895['body'][_0x571d39]=_0x18b8ab;return rp(_0x518895);})[_0x13eb('0x12')](function(_0x40a5dc){var _0x4c47ed=_0x40a5dc['headers'][_0x13eb('0x2b')];var _0x2f5648=_0x4c47ed[_0x13eb('0x2c')](_0x4c47ed[_0x13eb('0x2d')]('(')+0x1,_0x4c47ed[_0x13eb('0x2d')](')'));_0x177500['enduserId']=_0x2f5648;_0x3325f6(_0x177500);})[_0x13eb('0x14')](function(_0x1e1841){_0x46ea17(_0x1e1841[_0x13eb('0x17')]);});});}function getEndUser(_0xec82c0,_0x305f6e,_0x402b6f,_0x3e92b4,_0xb49c5c,_0x4bcf3a,_0x5dc347,_0x15c2fe){var _0x17b325=_0x4bcf3a[_0x13eb('0x26')]()===_0x13eb('0x27')?_0xb49c5c[_0x13eb('0x28')]:_0xb49c5c['calleridnum'];return getAuthToken(_0x305f6e,_0x402b6f,_0x4bcf3a)[_0x13eb('0x12')](function(_0x12b864){_0x15c2fe=_0x15c2fe?_0x15c2fe:'telephone1';var _0xab3cda={'method':_0x13eb('0x2e'),'uri':_0x3e92b4+_0x13eb('0x2f')+_0x15c2fe+'&$filter='+_0x15c2fe+_0x13eb('0x30')+_0x17b325[_0x13eb('0x31')]('+',_0x13eb('0x32'))+'\x27','headers':{'Authorization':_0x13eb('0x33')+_0x12b864,'If-None-Match':null,'OData-Version':_0x13eb('0x19')},'json':!![]};return rp(_0xab3cda);})[_0x13eb('0x12')](function(_0xbfa558){var _0x734a82=![];if(!_0xbfa558)return _0x734a82;var _0x2c9735=_0xbfa558[_0x13eb('0x1a')];for(var _0x1c7691=0x0;_0x1c7691<_0x2c9735['length'];_0x1c7691++){if(_0x2c9735[_0x1c7691][_0x15c2fe]===_0x17b325){_0x734a82=!![];_0xec82c0[_0x13eb('0x34')]=_0x2c9735[_0x1c7691]['contactid'];}}return _0x734a82;})[_0x13eb('0x12')](function(_0x560d57){if(_0x560d57)return _0xec82c0;if(_0x5dc347==='nothing'){logger[_0x13eb('0x21')]('['+[_0x4bcf3a[_0x13eb('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xec82c0;}return createEndUser(_0xec82c0,_0x305f6e,_0x402b6f,_0x3e92b4,_0xb49c5c,_0x4bcf3a,_0x15c2fe)[_0x13eb('0x12')](function(_0x44a716){logger['info']('['+[_0x4bcf3a[_0x13eb('0x16')]()]+_0x13eb('0x35'),_0x44a716[_0x13eb('0x34')]);return _0x44a716;});});}function getCustomFields(_0x5bd6ca,_0x6eba08,_0x54d4e2){var _0x239486={};if(_0x5bd6ca[_0x13eb('0x1f')]>0x0){_[_0x13eb('0x36')](_0x5bd6ca,function(_0x51d241){if(_[_0x13eb('0x37')]([_0x13eb('0x38'),'picklist'],_0x51d241[_0x13eb('0x39')])&&_0x51d241[_0x13eb('0x3a')]&&!_0x51d241[_0x13eb('0x3b')]){var _0x447971=_0x51d241['idField'][_0x13eb('0x26')]();var _0x335bd3=_0x447971[_0x13eb('0x2c')](0x0,_0x447971[_0x13eb('0x3c')]('_'));var _0x24161b=_0x447971['substring'](_0x447971['indexOf']('_')+0x1);if(_0x335bd3===_0x54d4e2){_0x239486[_0x24161b]=_0x51d241[_0x13eb('0x3d')];}}});}return _0x239486;}function getTicket(_0x3ece8f,_0x4dd4e6,_0x2a1cb2,_0x335dbd,_0x97ba43,_0x50b7e7,_0x512f5c){return new Promise(function(_0x8663a9,_0x2bd581){var _0x51e679;return getAuthToken(_0x4dd4e6,_0x2a1cb2,_0x512f5c)[_0x13eb('0x12')](function(_0x5187a4){if(_0x50b7e7[_0x13eb('0x3e')]==='incident'){_0x51e679={'method':_0x13eb('0xf'),'uri':_0x335dbd+_0x13eb('0x3f'),'body':Object[_0x13eb('0x40')]({},{'title':intUtil[_0x13eb('0x41')](_0x50b7e7[_0x13eb('0x42')],_0x97ba43,'\x20'),'description':intUtil['getString'](_0x50b7e7[_0x13eb('0x43')],_0x97ba43,'\x0a'),'customerid_contact@odata.bind':_0x3ece8f['enduserId']?'/contacts('+_0x3ece8f['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3ece8f[_0x13eb('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x50b7e7[_0x13eb('0x44')],_0x97ba43,_0x50b7e7[_0x13eb('0x3e')])),'headers':{'Authorization':_0x13eb('0x33')+_0x5187a4,'OData-Version':_0x13eb('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50b7e7[_0x13eb('0x3e')]===_0x13eb('0x45')){var _0x4566f9=_0x3ece8f['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3ece8f[_0x13eb('0x23')]+')','participationtypemask':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x13eb('0x48')+_0x3ece8f['enduserId']+')','participationtypemask':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x13eb('0x2a')+_0x3ece8f['userId']+')','participationtypemask':_0x3ece8f['callDirection']===_0x13eb('0x47')?0x2:0x1}];_0x51e679={'method':'POST','uri':_0x335dbd+_0x13eb('0x49'),'body':Object[_0x13eb('0x40')]({},{'subject':intUtil['getString'](_0x50b7e7[_0x13eb('0x42')],_0x97ba43,'\x20'),'phonenumber':String(_0x97ba43[_0x13eb('0x4a')]),'description':intUtil[_0x13eb('0x41')](_0x50b7e7['Descriptions'],_0x97ba43,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3ece8f['enduserId']?'/contacts('+_0x3ece8f[_0x13eb('0x34')]+')':undefined,'ownerid@odata.bind':_0x13eb('0x2a')+_0x3ece8f[_0x13eb('0x23')]+')','directioncode':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?![]:!![],'phonecall_activity_parties':_0x4566f9},getCustomFields(_0x50b7e7[_0x13eb('0x44')],_0x97ba43,_0x50b7e7[_0x13eb('0x3e')])),'headers':{'Authorization':_0x13eb('0x33')+_0x5187a4,'OData-Version':_0x13eb('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x51e679);})[_0x13eb('0x12')](function(_0x12e0db){var _0x4ea909=_0x12e0db['headers'][_0x13eb('0x2b')];var _0x5a4a7c=_0x4ea909['substring'](_0x4ea909[_0x13eb('0x2d')]('(')+0x1,_0x4ea909[_0x13eb('0x2d')](')'));_0x3ece8f['ticketId']=_0x5a4a7c;_0x8663a9(_0x3ece8f);})[_0x13eb('0x14')](function(_0x31f515){_0x2bd581(_0x31f515[_0x13eb('0x17')]);});});}function emit(_0x21329e,_0xf66384,_0x224e9a,_0x7c9cf9){var _0x4ac79b={'uri':util[_0x13eb('0x4b')](_0x13eb('0x4c'),_0x21329e,_0x224e9a,_0x7c9cf9)};io['to'](util[_0x13eb('0x4b')](_0x13eb('0x4d'),_0xf66384))[_0x13eb('0x4e')](_0x13eb('0x4f'),_0x4ac79b);}exports['cs']=function(_0x2fd299,_0x54d5bf,_0x5a8c89,_0x1dce61,_0x55356e,_0x34f52c,_0x132f8d,_0x1c2128){var _0x225931={};_0x34f52c['remoteUri']=_0x34f52c[_0x13eb('0x50')]?intUtil['stripTrailingSlash'](_0x34f52c[_0x13eb('0xd')][_0x13eb('0xb')]):intUtil[_0x13eb('0x51')](_0x34f52c[_0x13eb('0xa')]);_0x34f52c[_0x13eb('0x52')]=intUtil[_0x13eb('0x51')](_0x34f52c[_0x13eb('0x52')]);_0x225931[_0x13eb('0x46')]=_0x1c2128===_0x13eb('0x47')||_0x1c2128===_0x13eb('0x53')?_0x13eb('0x47'):_0x13eb('0x27');var _0x59b096=_0x34f52c[_0x13eb('0x50')]?util[_0x13eb('0x4b')](_0x13eb('0x54'),_0x34f52c[_0x13eb('0xd')]['data7']):util[_0x13eb('0x4b')]('%s/api/data/v9.0/',_0x34f52c['remoteUri']);var _0x22dec7=util[_0x13eb('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x34f52c['tenantId']);var _0x8a4090=util[_0x13eb('0x4b')](_0x13eb('0x55'),_0x34f52c[_0x13eb('0x52')],_0x54d5bf[_0x13eb('0x56')],md5(_0x54d5bf['uniqueid']));if(_0x55356e&&_0x55356e['monitor_format']){logger[_0x13eb('0x21')](_0x13eb('0x57'),_0x13eb('0x58'));_0x54d5bf[_0x13eb('0x59')]=_0x8a4090;}else if(_0x132f8d&&_0x132f8d[_0x13eb('0x5a')]&&_0x132f8d[_0x13eb('0x5a')]!=='none'){logger[_0x13eb('0x21')](_0x13eb('0x5b'),'Recording\x20is\x20enabled!');_0x54d5bf[_0x13eb('0x59')]=_0x8a4090;}else{_0x54d5bf[_0x13eb('0x59')]='';}return getUser(_0x225931,_0x34f52c,_0x1dce61,_0x22dec7,_0x59b096,_0x1c2128)['then'](function(_0x14d409){logger[_0x13eb('0x21')]('['+_0x1c2128['toUpperCase']()+_0x13eb('0x5c'),_0x14d409[_0x13eb('0x23')]);logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x5d'),_0x14d409[_0x13eb('0x1e')]);return getEndUser(_0x14d409,_0x34f52c,_0x22dec7,_0x59b096,_0x54d5bf,_0x1c2128,_0x5a8c89[_0x13eb('0x5e')],_0x5a8c89[_0x13eb('0x5f')]);})[_0x13eb('0x12')](function(_0x41b479){logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x41b479['enduserId']);logger[_0x13eb('0x21')]('['+_0x1c2128['toUpperCase']()+_0x13eb('0x60'),_0x54d5bf[_0x13eb('0x4a')]);return getTicket(_0x41b479,_0x34f52c,_0x22dec7,_0x59b096,_0x54d5bf,_0x5a8c89,_0x1c2128);})[_0x13eb('0x12')](function(_0x2e4564){logger[_0x13eb('0x21')](util[_0x13eb('0x4b')]('['+_0x1c2128['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5a8c89[_0x13eb('0x3e')],_0x2e4564['ticketId']));logger[_0x13eb('0x21')](util[_0x13eb('0x4b')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x61'),_0x1c2128));if(_0x1c2128!=='unmanaged'&&_0x5a8c89[_0x13eb('0x62')]){logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+']',_0x13eb('0x63'));emit(_0x34f52c['remoteUri'],_0x1dce61[_0x13eb('0x64')],_0x5a8c89[_0x13eb('0x3e')],_0x2e4564[_0x13eb('0x65')]);}})[_0x13eb('0x14')](function(_0x514a0c){logger[_0x13eb('0x15')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x66'),_0x514a0c[_0x13eb('0x17')]);console[_0x13eb('0x15')](_0x13eb('0x67'),_0x514a0c);});}; \ No newline at end of file +var _0xd3cc=['unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid','userId','toUpperCase','toLowerCase','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid','nothing','forEach','includes','string','type','nameField','customField','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','queue','callDirection','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','modernAuthentication','data7','stripTrailingSlash','serverUrl'];(function(_0x40fd7a,_0x1e8293){var _0x20e00c=function(_0x473a81){while(--_0x473a81){_0x40fd7a['push'](_0x40fd7a['shift']());}};_0x20e00c(++_0x1e8293);}(_0xd3cc,0x163));var _0xcd3c=function(_0x52788c,_0x235d0a){_0x52788c=_0x52788c-0x0;var _0x203c56=_0xd3cc[_0x52788c];return _0x203c56;};'use strict';var _=require(_0xcd3c('0x0'));var rp=require(_0xcd3c('0x1'));var util=require('util');var intUtil=require(_0xcd3c('0x2'));var md5=require(_0xcd3c('0x3'));var Redis=require(_0xcd3c('0x4'));var logger=require(_0xcd3c('0x5'))('dynamics365');var config=require(_0xcd3c('0x6'));config[_0xcd3c('0x7')]=_['defaults'](config[_0xcd3c('0x7')],{'host':_0xcd3c('0x8'),'port':0x18eb});var io=require(_0xcd3c('0x9'))(new Redis(config[_0xcd3c('0x7')]));function getAuthToken(_0x391d7f,_0x523d3a,_0x4abdad){if(_0x391d7f['modernAuthentication']){_0x391d7f[_0xcd3c('0xa')]=_0x391d7f[_0xcd3c('0xb')]['data7'];_0x391d7f[_0xcd3c('0xc')]=_0x391d7f['CloudProvider'][_0xcd3c('0xd')];return Promise['resolve'](_0x391d7f['CloudProvider'][_0xcd3c('0xe')]);}var _0x17ffde={'method':_0xcd3c('0xf'),'uri':_0x523d3a,'form':{'client_id':_0x391d7f[_0xcd3c('0x10')],'resource':_0x391d7f[_0xcd3c('0xa')],'username':_0x391d7f[_0xcd3c('0x11')],'password':_0x391d7f[_0xcd3c('0x12')],'grant_type':_0xcd3c('0x12'),'client_secret':_0x391d7f['clientSecret']},'json':!![]};return rp(_0x17ffde)[_0xcd3c('0x13')](function(_0x23bc5f){return _0x23bc5f[_0xcd3c('0x14')];})[_0xcd3c('0x15')](function(_0x59494a){logger[_0xcd3c('0x16')]('['+[_0x4abdad['toUpperCase']()]+_0xcd3c('0x17'));return _0x59494a[_0xcd3c('0x18')];});}function getUser(_0x2b38a6,_0xa41c0d,_0x412fae,_0x5079d3,_0x10eaf9,_0x12db7c){return new Promise(function(_0x26910c,_0x2239ba){return getAuthToken(_0xa41c0d,_0x5079d3,_0x12db7c)[_0xcd3c('0x13')](function(_0x554f5c){var _0x1334e3={'method':_0xcd3c('0x19'),'uri':_0x10eaf9+_0xcd3c('0x1a'),'headers':{'Authorization':_0xcd3c('0x1b')+_0x554f5c,'OData-Version':_0xcd3c('0x1c')},'json':!![]};return rp(_0x1334e3);})[_0xcd3c('0x13')](function(_0x3b52f6){var _0x5bf1d3=_0x3b52f6[_0xcd3c('0x1d')];var _0x677e48=![];var _0x5ed4a9=null;if(!_['isNil'](_0x412fae)){if(intUtil[_0xcd3c('0x1e')](_0x412fae[_0xcd3c('0x1f')])){_0x2b38a6[_0xcd3c('0x20')]=_0x412fae[_0xcd3c('0x1f')];for(_0x5ed4a9=0x0;_0x5ed4a9<_0x5bf1d3[_0xcd3c('0x21')];_0x5ed4a9++){if(_0x5bf1d3[_0x5ed4a9]['internalemailaddress']===_0x412fae[_0xcd3c('0x1f')]&&!_0x5bf1d3[_0x5ed4a9]['isdisabled']){_0x677e48=!![];logger[_0xcd3c('0x22')]('['+[_0x12db7c['toUpperCase']()]+_0xcd3c('0x23')+_0x5bf1d3[_0x5ed4a9][_0xcd3c('0x24')]+'!');_0x2b38a6[_0xcd3c('0x25')]=_0x5bf1d3[_0x5ed4a9][_0xcd3c('0x24')];}}}}if(!_0x677e48){logger[_0xcd3c('0x22')]('['+[_0x12db7c[_0xcd3c('0x26')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2b38a6[_0xcd3c('0x20')]=_0xa41c0d['username'];for(_0x5ed4a9=0x0;_0x5ed4a9<_0x5bf1d3['length'];_0x5ed4a9++){if(_0x5bf1d3[_0x5ed4a9]['internalemailaddress']===_0xa41c0d[_0xcd3c('0x11')]){_0x2b38a6[_0xcd3c('0x25')]=_0x5bf1d3[_0x5ed4a9]['systemuserid'];}}}_0x26910c(_0x2b38a6);})['catch'](function(_0x52081d){_0x2239ba(_0x52081d['message']);});});}function createEndUser(_0x45bceb,_0xedb729,_0x543966,_0x4b7001,_0xdf8916,_0x17cebc,_0x2eef01){return new Promise(function(_0x3fbd85,_0x349494){return getAuthToken(_0xedb729,_0x543966,_0x17cebc)[_0xcd3c('0x13')](function(_0x75b222){var _0x58c723=_0x17cebc[_0xcd3c('0x27')]()==='outbound'?_0xdf8916[_0xcd3c('0x28')]:_0xdf8916[_0xcd3c('0x29')];var _0x43d649={'method':_0xcd3c('0xf'),'uri':_0x4b7001+_0xcd3c('0x2a'),'body':{'fullname':_0x58c723,'firstname':_0x58c723,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x45bceb[_0xcd3c('0x25')]+')'},'headers':{'Authorization':_0xcd3c('0x1b')+_0x75b222,'OData-Version':_0xcd3c('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x43d649[_0xcd3c('0x2b')][_0x2eef01]=_0x58c723;return rp(_0x43d649);})[_0xcd3c('0x13')](function(_0x49540f){var _0xd75ef3=_0x49540f[_0xcd3c('0x2c')][_0xcd3c('0x2d')];var _0x182744=_0xd75ef3[_0xcd3c('0x2e')](_0xd75ef3['lastIndexOf']('(')+0x1,_0xd75ef3[_0xcd3c('0x2f')](')'));_0x45bceb['enduserId']=_0x182744;_0x3fbd85(_0x45bceb);})[_0xcd3c('0x15')](function(_0x53d9f0){_0x349494(_0x53d9f0[_0xcd3c('0x18')]);});});}function getEndUser(_0x1bf020,_0x274742,_0xf9101e,_0x5b8cb0,_0x1544d5,_0x153e2b,_0x4542cd,_0x5b7768){var _0x449966=_0x153e2b[_0xcd3c('0x27')]()===_0xcd3c('0x30')?_0x1544d5[_0xcd3c('0x28')]:_0x1544d5[_0xcd3c('0x29')];return getAuthToken(_0x274742,_0xf9101e,_0x153e2b)[_0xcd3c('0x13')](function(_0x368e3c){_0x5b7768=_0x5b7768?_0x5b7768:_0xcd3c('0x31');var _0x506c4a={'method':_0xcd3c('0x19'),'uri':_0x5b8cb0+_0xcd3c('0x32')+_0x5b7768+_0xcd3c('0x33')+_0x5b7768+_0xcd3c('0x34')+_0x449966['replace']('+',_0xcd3c('0x35'))+'\x27','headers':{'Authorization':_0xcd3c('0x1b')+_0x368e3c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x506c4a);})[_0xcd3c('0x13')](function(_0xdca527){var _0x56ff98=![];if(!_0xdca527)return _0x56ff98;var _0x38c821=_0xdca527['value'];for(var _0x391a18=0x0;_0x391a18<_0x38c821[_0xcd3c('0x21')];_0x391a18++){if(_0x38c821[_0x391a18][_0x5b7768]===_0x449966){_0x56ff98=!![];_0x1bf020[_0xcd3c('0x36')]=_0x38c821[_0x391a18][_0xcd3c('0x37')];}}return _0x56ff98;})[_0xcd3c('0x13')](function(_0xcf2a95){if(_0xcf2a95)return _0x1bf020;if(_0x4542cd===_0xcd3c('0x38')){logger['info']('['+[_0x153e2b[_0xcd3c('0x26')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1bf020;}return createEndUser(_0x1bf020,_0x274742,_0xf9101e,_0x5b8cb0,_0x1544d5,_0x153e2b,_0x5b7768)[_0xcd3c('0x13')](function(_0x3dbecc){logger['info']('['+[_0x153e2b[_0xcd3c('0x26')]()]+']\x20Enduser\x20created!',_0x3dbecc[_0xcd3c('0x36')]);return _0x3dbecc;});});}function getCustomFields(_0x1418f6,_0x8ac3c6,_0x4d8b34){var _0x2d360f={};if(_0x1418f6[_0xcd3c('0x21')]>0x0){_[_0xcd3c('0x39')](_0x1418f6,function(_0x49e3f2){if(_[_0xcd3c('0x3a')]([_0xcd3c('0x3b'),'picklist'],_0x49e3f2[_0xcd3c('0x3c')])&&_0x49e3f2[_0xcd3c('0x3d')]&&!_0x49e3f2[_0xcd3c('0x3e')]){var _0xdb3881=_0x49e3f2['idField'][_0xcd3c('0x27')]();var _0x5dd2cb=_0xdb3881[_0xcd3c('0x2e')](0x0,_0xdb3881['indexOf']('_'));var _0x404eb=_0xdb3881[_0xcd3c('0x2e')](_0xdb3881['indexOf']('_')+0x1);if(_0x5dd2cb===_0x4d8b34){_0x2d360f[_0x404eb]=_0x49e3f2['content'];}}});}return _0x2d360f;}function getTicket(_0x346f75,_0x1cb091,_0x4bc97d,_0x120820,_0xd570e5,_0x3019b4,_0x2f176a){return new Promise(function(_0xf1b3bd,_0x1b9ef1){var _0x3a477d;return getAuthToken(_0x1cb091,_0x4bc97d,_0x2f176a)[_0xcd3c('0x13')](function(_0x648543){if(_0x3019b4[_0xcd3c('0x3f')]===_0xcd3c('0x40')){_0x3a477d={'method':'POST','uri':_0x120820+_0xcd3c('0x41'),'body':Object[_0xcd3c('0x42')]({},{'title':intUtil[_0xcd3c('0x43')](_0x3019b4[_0xcd3c('0x44')],_0xd570e5,'\x20'),'description':intUtil[_0xcd3c('0x43')](_0x3019b4[_0xcd3c('0x45')],_0xd570e5,'\x0a'),'customerid_contact@odata.bind':_0x346f75['enduserId']?_0xcd3c('0x46')+_0x346f75['enduserId']+')':undefined,'ownerid@odata.bind':_0xcd3c('0x47')+_0x346f75[_0xcd3c('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3019b4[_0xcd3c('0x48')],_0xd570e5,_0x3019b4['ticketType'])),'headers':{'Authorization':_0xcd3c('0x1b')+_0x648543,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3019b4[_0xcd3c('0x3f')]===_0xcd3c('0x49')){var _0x38e14c=_0x346f75[_0xcd3c('0x36')]?[{'partyid_systemuser@odata.bind':_0xcd3c('0x47')+_0x346f75[_0xcd3c('0x25')]+')','participationtypemask':_0x346f75['callDirection']===_0xcd3c('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xcd3c('0x46')+_0x346f75[_0xcd3c('0x36')]+')','participationtypemask':_0x346f75[_0xcd3c('0x4b')]===_0xcd3c('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x346f75[_0xcd3c('0x25')]+')','participationtypemask':_0x346f75[_0xcd3c('0x4b')]===_0xcd3c('0x4a')?0x2:0x1}];_0x3a477d={'method':_0xcd3c('0xf'),'uri':_0x120820+_0xcd3c('0x4c'),'body':Object[_0xcd3c('0x42')]({},{'subject':intUtil[_0xcd3c('0x43')](_0x3019b4[_0xcd3c('0x44')],_0xd570e5,'\x20'),'phonenumber':String(_0xd570e5[_0xcd3c('0x29')]),'description':intUtil[_0xcd3c('0x43')](_0x3019b4['Descriptions'],_0xd570e5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x346f75[_0xcd3c('0x36')]?_0xcd3c('0x46')+_0x346f75['enduserId']+')':undefined,'ownerid@odata.bind':_0xcd3c('0x47')+_0x346f75[_0xcd3c('0x25')]+')','directioncode':_0x346f75['callDirection']===_0xcd3c('0x4a')?![]:!![],'phonecall_activity_parties':_0x38e14c},getCustomFields(_0x3019b4[_0xcd3c('0x48')],_0xd570e5,_0x3019b4[_0xcd3c('0x3f')])),'headers':{'Authorization':_0xcd3c('0x1b')+_0x648543,'OData-Version':_0xcd3c('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3a477d);})[_0xcd3c('0x13')](function(_0x640fb3){var _0x4aeb92=_0x640fb3[_0xcd3c('0x2c')][_0xcd3c('0x2d')];var _0x4c85e5=_0x4aeb92[_0xcd3c('0x2e')](_0x4aeb92['lastIndexOf']('(')+0x1,_0x4aeb92[_0xcd3c('0x2f')](')'));_0x346f75['ticketId']=_0x4c85e5;_0xf1b3bd(_0x346f75);})['catch'](function(_0x7a45a7){_0x1b9ef1(_0x7a45a7[_0xcd3c('0x18')]);});});}function emit(_0xd8324a,_0x25eb1c,_0x545ddc,_0x2f61e9){var _0x39c1e4={'uri':util[_0xcd3c('0x4d')](_0xcd3c('0x4e'),_0xd8324a,_0x545ddc,_0x2f61e9)};io['to'](util[_0xcd3c('0x4d')]('user:%s',_0x25eb1c))[_0xcd3c('0x4f')](_0xcd3c('0x50'),_0x39c1e4);}exports['cs']=function(_0x6bae0d,_0x14d314,_0x2fc5a7,_0x13f9eb,_0x36b51b,_0x75cde1,_0x5700bb,_0x8600d){var _0x2e2571={};_0x75cde1[_0xcd3c('0xa')]=_0x75cde1[_0xcd3c('0x51')]?intUtil['stripTrailingSlash'](_0x75cde1['CloudProvider'][_0xcd3c('0x52')]):intUtil[_0xcd3c('0x53')](_0x75cde1['remoteUri']);_0x75cde1['serverUrl']=intUtil[_0xcd3c('0x53')](_0x75cde1[_0xcd3c('0x54')]);_0x2e2571[_0xcd3c('0x4b')]=_0x8600d==='queue'||_0x8600d===_0xcd3c('0x55')?_0xcd3c('0x4a'):_0xcd3c('0x30');var _0x58723b=_0x75cde1[_0xcd3c('0x51')]?util[_0xcd3c('0x4d')](_0xcd3c('0x56'),_0x75cde1[_0xcd3c('0xb')]['data7']):util[_0xcd3c('0x4d')](_0xcd3c('0x56'),_0x75cde1['remoteUri']);var _0x3e5dd2=util[_0xcd3c('0x4d')](_0xcd3c('0x57'),_0x75cde1[_0xcd3c('0xc')]);var _0x3657b0=util['format'](_0xcd3c('0x58'),_0x75cde1[_0xcd3c('0x54')],_0x14d314[_0xcd3c('0x59')],md5(_0x14d314['uniqueid']));if(_0x36b51b&&_0x36b51b[_0xcd3c('0x5a')]){logger[_0xcd3c('0x22')](_0xcd3c('0x5b'),_0xcd3c('0x5c'));_0x14d314[_0xcd3c('0x5d')]=_0x3657b0;}else if(_0x5700bb&&_0x5700bb[_0xcd3c('0x5e')]&&_0x5700bb[_0xcd3c('0x5e')]!==_0xcd3c('0x5f')){logger['info'](_0xcd3c('0x60'),'Recording\x20is\x20enabled!');_0x14d314[_0xcd3c('0x5d')]=_0x3657b0;}else{_0x14d314[_0xcd3c('0x5d')]='';}return getUser(_0x2e2571,_0x75cde1,_0x13f9eb,_0x3e5dd2,_0x58723b,_0x8600d)[_0xcd3c('0x13')](function(_0x41f49e){logger[_0xcd3c('0x22')]('['+_0x8600d['toUpperCase']()+_0xcd3c('0x61'),_0x41f49e['userId']);logger['info']('['+_0x8600d['toUpperCase']()+_0xcd3c('0x62'),_0x41f49e[_0xcd3c('0x20')]);return getEndUser(_0x41f49e,_0x75cde1,_0x3e5dd2,_0x58723b,_0x14d314,_0x8600d,_0x2fc5a7[_0xcd3c('0x63')],_0x2fc5a7[_0xcd3c('0x64')]);})[_0xcd3c('0x13')](function(_0x22b304){logger[_0xcd3c('0x22')]('['+_0x8600d[_0xcd3c('0x26')]()+_0xcd3c('0x65'),_0x22b304[_0xcd3c('0x36')]);logger[_0xcd3c('0x22')]('['+_0x8600d[_0xcd3c('0x26')]()+_0xcd3c('0x66'),_0x14d314['calleridnum']);return getTicket(_0x22b304,_0x75cde1,_0x3e5dd2,_0x58723b,_0x14d314,_0x2fc5a7,_0x8600d);})[_0xcd3c('0x13')](function(_0x36e4be){logger[_0xcd3c('0x22')](util['format']('['+_0x8600d[_0xcd3c('0x26')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2fc5a7[_0xcd3c('0x3f')],_0x36e4be['ticketId']));logger[_0xcd3c('0x22')](util['format']('['+_0x8600d[_0xcd3c('0x26')]()+_0xcd3c('0x67'),_0x8600d));if(_0x8600d!==_0xcd3c('0x55')&&_0x2fc5a7[_0xcd3c('0x68')]){logger[_0xcd3c('0x22')]('['+_0x8600d[_0xcd3c('0x26')]()+']',_0xcd3c('0x69'));emit(_0x75cde1[_0xcd3c('0xa')],_0x13f9eb[_0xcd3c('0x6a')],_0x2fc5a7['ticketType'],_0x36e4be[_0xcd3c('0x6b')]);}})[_0xcd3c('0x15')](function(_0x4df9f5){logger['error']('['+_0x8600d['toUpperCase']()+_0xcd3c('0x6c'),_0x4df9f5[_0xcd3c('0x18')]);console['error'](_0xcd3c('0x6d'),_0x4df9f5);});}; \ 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 af63dc0..8800d50 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 _0x2929=['trigger:browser:url','catch','error','outbound','serverUrl','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','emit','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','push','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x17f7c1,_0x2fa7b9){var _0x13c24a=function(_0x4a7f44){while(--_0x4a7f44){_0x17f7c1['push'](_0x17f7c1['shift']());}};_0x13c24a(++_0x2fa7b9);}(_0x2929,0x129));var _0x9292=function(_0x21d2c6,_0x4fc7e7){_0x21d2c6=_0x21d2c6-0x0;var _0x39fc00=_0x2929[_0x21d2c6];return _0x39fc00;};'use strict';var _=require(_0x9292('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9292('0x1'));var Redis=require(_0x9292('0x2'));var intUtil=require('./util');var config=require(_0x9292('0x3'));var logger=require(_0x9292('0x4'))(_0x9292('0x5'));config[_0x9292('0x6')]=_[_0x9292('0x7')](config[_0x9292('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9292('0x6')]));var headers={'Content-Type':_0x9292('0x8'),'Accept':'application/json'};function emit(_0xbec757,_0x2c8581,_0x430305){io['to'](_0xbec757)[_0x9292('0x9')](_0x2c8581,_0x430305);}function getTicket(_0x2860e7,_0x5ae9f8,_0x11b092,_0x3a3b79,_0x3121c6){logger['info'](_0x9292('0xa'));var _0x90d1ff=_['merge']({'responder_id':_0x5ae9f8['id'],'requester_id':_0x11b092['id'],'name':util['format'](_0x9292('0xb'),_0x3121c6[_0x9292('0xc')]),'phone':_0x3121c6[_0x9292('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9292('0xe')](_0x3a3b79[_0x9292('0xf')],_0x3121c6,'\x20'),'description':intUtil[_0x9292('0xe')](_0x3a3b79[_0x9292('0x10')],_0x3121c6,_0x9292('0x11')),'tags':getTags(_0x3a3b79[_0x9292('0x12')],'name')},getCustomFields(_0x3a3b79[_0x9292('0x13')],_0x3121c6));_0x90d1ff[_0x9292('0x14')]=_[_0x9292('0x15')](_[_0x9292('0x16')](_0x90d1ff[_0x9292('0x14')],'id'),_0x9292('0x17'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x19'),_0x2860e7['remoteUri']),'method':_0x9292('0x1a'),'body':_0x90d1ff})[_0x9292('0x1b')](function(_0x46baf1){logger[_0x9292('0x1c')](_0x9292('0x1d'));return _0x46baf1;});}function getUser(_0x2520ac,_0x252c99){if(intUtil[_0x9292('0x1e')](_0x252c99)){return request({'uri':util['format'](_0x9292('0x1f'),_0x2520ac['remoteUri']),'qs':{'email':_0x252c99}})[_0x9292('0x1b')](function(_0x329523){if(_0x329523[_0x9292('0x20')]){logger[_0x9292('0x1c')](_0x9292('0x21'));return _[_0x9292('0x22')](_0x329523,function(_0x3359ff){return _0x3359ff[_0x9292('0x23')]['email']===_0x252c99;});}else{logger[_0x9292('0x1c')](_0x9292('0x24'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x25'),_0x2520ac[_0x9292('0x26')])})[_0x9292('0x1b')](function(_0x71a216){logger['info'](_0x9292('0x27'));return _0x71a216;});}});}else{logger[_0x9292('0x1c')](_0x9292('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2520ac['remoteUri'])})['then'](function(_0x75f59a){logger[_0x9292('0x1c')]('Admin\x20account\x20selected.');return _0x75f59a;});}}function getEndUser(_0x2c824c,_0xf22c26,_0x6387c8){logger[_0x9292('0x1c')]('Searching\x20enduser\x20with\x20phone',_0x6387c8);return request({'uri':util[_0x9292('0x18')](_0x9292('0x29'),_0x2c824c[_0x9292('0x26')]),'qs':{'phone':_0x6387c8}})[_0x9292('0x1b')](function(_0x11d3ea){if(_0x11d3ea[_0x9292('0x20')]){logger[_0x9292('0x1c')](_0x9292('0x2a'));return _[_0x9292('0x22')](_0x11d3ea,{'phone':_0x6387c8});}else{logger[_0x9292('0x1c')](_0x9292('0x2b'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x29'),_0x2c824c[_0x9292('0x26')]),'method':_0x9292('0x1a'),'body':{'name':_0xf22c26,'phone':_0x6387c8}})[_0x9292('0x1b')](function(_0x56f534){logger[_0x9292('0x1c')](_0x9292('0x2c'));return _0x56f534;});}});}function getAuth(_0x130657){return util[_0x9292('0x18')](_0x9292('0x2d'),new Buffer(_0x130657[_0x9292('0x2e')]+':X')[_0x9292('0x2f')]('base64'));}function request(_0x149183){logger[_0x9292('0x30')](_0x9292('0x31'),JSON['stringify'](_0x149183));return rp(_['defaults'](_0x149183,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4f55b9,_0xcb9ce6){var _0x29e0a0=[];if(_0x4f55b9&&_0x4f55b9[_0x9292('0x20')]>0x0){_0x29e0a0=_['map'](_0x4f55b9,_0xcb9ce6);}return _0x29e0a0;}function getCustomFields(_0xe028b6,_0x9247c9){var _0x2e2045=[];var _0xc52f27={'custom_fields':[]};if(_0xe028b6[_0x9292('0x20')]>0x0){_[_0x9292('0x32')](_0xe028b6,function(_0x4d8ae9){if(_[_0x9292('0x33')]([_0x9292('0x34'),_0x9292('0x35')],_0x4d8ae9[_0x9292('0x36')])&&_0x4d8ae9[_0x9292('0x37')]&&!_0x4d8ae9[_0x9292('0x38')]){_0xc52f27[_0x4d8ae9[_0x9292('0x37')][_0x9292('0x39')]()]=_0x4d8ae9[_0x9292('0x3a')][_0x9292('0x2f')]();}else if(_[_0x9292('0x33')]([_0x9292('0x34'),'picklist'],_0x4d8ae9[_0x9292('0x36')])&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9['customField']){_0xc52f27[_0x9292('0x14')]['push']({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x4d8ae9[_0x9292('0x3a')]['toString']()});}else if(_0x4d8ae9[_0x9292('0x36')]===_0x9292('0x3c')&&_0x4d8ae9[_0x9292('0x3d')]&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9[_0x9292('0x38')]){_0x9247c9[_0x4d8ae9[_0x9292('0x3d')]]&&_0xc52f27[_0x9292('0x14')][_0x9292('0x3e')]({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x9247c9[_0x4d8ae9[_0x9292('0x3d')]][_0x9292('0x2f')]()});}else if(_0x4d8ae9[_0x9292('0x36')]==='customVariable'&&_0x4d8ae9[_0x9292('0x3f')]&&_0x4d8ae9['Variable'][_0x9292('0x40')]&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9['customField']){_0x9247c9[_0x4d8ae9['Variable'][_0x9292('0x40')]['toLowerCase']()]&&_0xc52f27[_0x9292('0x14')]['push']({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x9247c9[_0x4d8ae9[_0x9292('0x3f')][_0x9292('0x40')][_0x9292('0x39')]()][_0x9292('0x2f')]()});}});}return _0xc52f27;}exports[_0x9292('0x41')]=function(_0x5b2db2,_0x4a8c56,_0x35ff95,_0x156482,_0x54a17c,_0x379084){var _0x3501e0,_0xe85fc0;_0x379084['remoteUri']=intUtil[_0x9292('0x42')](_0x379084['remoteUri']);_0x379084['serverUrl']=intUtil['stripTrailingSlash'](_0x379084['serverUrl']);if(_0x54a17c&&_0x54a17c[_0x9292('0x43')]){logger[_0x9292('0x1c')](_0x9292('0x44'),_0x9292('0x45'));_0x4a8c56[_0x9292('0x46')]=util[_0x9292('0x18')](_0x9292('0x47'),_0x379084['serverUrl'],_0x4a8c56[_0x9292('0x48')],md5(_0x4a8c56[_0x9292('0x48')]));}else{_0x4a8c56[_0x9292('0x46')]='';}headers['Authorization']=getAuth(_0x379084);return getUser(_0x379084,_0x156482[_0x9292('0x49')])[_0x9292('0x1b')](function(_0x5d5238){_0x3501e0=_0x5d5238;logger[_0x9292('0x1c')](_0x9292('0x4a'),_0x3501e0['id']);return getEndUser(_0x379084,_0x4a8c56['calleridname'],_0x4a8c56[_0x9292('0xd')]);})[_0x9292('0x1b')](function(_0x32b420){_0xe85fc0=_0x32b420;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0xe85fc0['id']);return getTicket(_0x379084,_0x3501e0,_0xe85fc0,_0x35ff95,_0x4a8c56);})[_0x9292('0x1b')](function(_0x2326ae){if(_0x2326ae&&_0x2326ae['id']){logger[_0x9292('0x1c')]('Ticket\x20created!');logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x2326ae['id']);logger['info']('[QUEUE]',_0x9292('0x4d'));emit(util[_0x9292('0x18')](_0x9292('0x4e'),_0x156482[_0x9292('0x40')]),_0x9292('0x4f'),{'uri':util[_0x9292('0x18')]('%s/helpdesk/tickets/%d',_0x379084[_0x9292('0x26')],_0x2326ae['id'])});}})[_0x9292('0x50')](function(_0x3b044c){logger[_0x9292('0x51')]('[QUEUE]',JSON['stringify'](_0x3b044c));});};exports[_0x9292('0x52')]=function(_0x352017,_0x59a1a6,_0x441154,_0x47a293,_0x4626a4,_0x21cded,_0x5cbda6){var _0x588ddd,_0x307473;_0x21cded[_0x9292('0x26')]=intUtil[_0x9292('0x42')](_0x21cded[_0x9292('0x26')]);_0x21cded[_0x9292('0x53')]=intUtil[_0x9292('0x42')](_0x21cded[_0x9292('0x53')]);if(_0x5cbda6&&_0x5cbda6[_0x9292('0x54')]&&_0x5cbda6['recordingFormat']!==_0x9292('0x55')){logger[_0x9292('0x1c')]('[OUTBOUND]',_0x9292('0x45'));_0x59a1a6['recordingURL']=util[_0x9292('0x18')](_0x9292('0x47'),_0x21cded['serverUrl'],_0x59a1a6[_0x9292('0x48')],md5(_0x59a1a6[_0x9292('0x48')]));}headers[_0x9292('0x56')]=getAuth(_0x21cded);return getUser(_0x21cded,_0x47a293['email'])['then'](function(_0x1deafe){_0x588ddd=_0x1deafe;logger['info'](_0x9292('0x4a'),_0x588ddd['id']);return getEndUser(_0x21cded,_0x59a1a6[_0x9292('0x57')],_0x59a1a6[_0x9292('0x58')]);})[_0x9292('0x1b')](function(_0x2dc689){_0x307473=_0x2dc689;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0x307473['id']);return getTicket(_0x21cded,_0x588ddd,_0x307473,_0x441154,_0x59a1a6);})[_0x9292('0x1b')](function(_0x549e11){if(_0x549e11&&_0x549e11['id']){logger[_0x9292('0x1c')](_0x9292('0x1d'));logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x549e11['id']);logger[_0x9292('0x1c')](_0x9292('0x59'),_0x9292('0x4d'));emit(util['format'](_0x9292('0x4e'),_0x47a293[_0x9292('0x40')]),_0x9292('0x4f'),{'uri':util[_0x9292('0x18')]('%s/helpdesk/tickets/%d',_0x21cded['remoteUri'],_0x549e11['id'])});}})[_0x9292('0x50')](function(_0x3bdf23){logger[_0x9292('0x51')](_0x9292('0x59'),JSON[_0x9292('0x5a')](_0x3bdf23));});};exports[_0x9292('0x5b')]=function(_0x21ba1c,_0x473069,_0x21961c,_0x4f0f1f,_0xb782ec,_0x1a35ee){var _0x2017eb,_0x59e16c;_0x1a35ee[_0x9292('0x26')]=intUtil['stripTrailingSlash'](_0x1a35ee[_0x9292('0x26')]);_0x1a35ee[_0x9292('0x53')]=intUtil[_0x9292('0x42')](_0x1a35ee[_0x9292('0x53')]);if(_0xb782ec&&_0xb782ec['monitor_format']){logger[_0x9292('0x1c')]('['+_0x473069[_0x9292('0x5c')][_0x9292('0x5d')]()+']','Recording\x20is\x20enabled!');_0x473069['recordingURL']=util[_0x9292('0x18')](_0x9292('0x47'),_0x1a35ee[_0x9292('0x53')],_0x473069['uniqueid'],md5(_0x473069[_0x9292('0x48')]));}else{_0x473069[_0x9292('0x46')]='';}headers['Authorization']=getAuth(_0x1a35ee);return getUser(_0x1a35ee,'')['then'](function(_0x393c2c){_0x2017eb=_0x393c2c;logger['info'](_0x9292('0x4a'),_0x2017eb['id']);return getEndUser(_0x1a35ee,_0x473069['calleridname'],_0x473069['calleridnum']);})[_0x9292('0x1b')](function(_0x4b16be){_0x59e16c=_0x4b16be;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0x59e16c['id']);return getTicket(_0x1a35ee,_0x2017eb,_0x59e16c,_0x21961c,_0x473069);})[_0x9292('0x1b')](function(_0x21fdff){if(_0x21fdff){logger[_0x9292('0x1c')](_0x9292('0x1d'));logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x21fdff['id']);}})[_0x9292('0x50')](function(_0x31fb37){logger['error']('['+_0x473069[_0x9292('0x5c')][_0x9292('0x5d')]()+']',JSON[_0x9292('0x5a')](_0x31fb37));});}; \ No newline at end of file +var _0xe561=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','includes','picklist','type','nameField','toLowerCase','content','string','idField','customField','push','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash'];(function(_0x2842ed,_0x23ba81){var _0x1625bd=function(_0x29acd1){while(--_0x29acd1){_0x2842ed['push'](_0x2842ed['shift']());}};_0x1625bd(++_0x23ba81);}(_0xe561,0x177));var _0x1e56=function(_0x27378b,_0x1a7162){_0x27378b=_0x27378b-0x0;var _0x4b637b=_0xe561[_0x27378b];return _0x4b637b;};'use strict';var _=require(_0x1e56('0x0'));var rp=require('request-promise');var md5=require(_0x1e56('0x1'));var util=require(_0x1e56('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1e56('0x3'));var config=require('../../../../config/environment');var logger=require(_0x1e56('0x4'))('freshdesk');config[_0x1e56('0x5')]=_[_0x1e56('0x6')](config['redis'],{'host':_0x1e56('0x7'),'port':0x18eb});var io=require(_0x1e56('0x8'))(new Redis(config[_0x1e56('0x5')]));var headers={'Content-Type':_0x1e56('0x9'),'Accept':_0x1e56('0x9')};function emit(_0x17c9c5,_0x2af5f0,_0x581d69){io['to'](_0x17c9c5)[_0x1e56('0xa')](_0x2af5f0,_0x581d69);}function getTicket(_0x9d4266,_0x46d237,_0x18bde9,_0x129f34,_0x5ecb04){logger[_0x1e56('0xb')]('Creating\x20new\x20ticket...');var _0x5ea5eb=_['merge']({'responder_id':_0x46d237['id'],'requester_id':_0x18bde9['id'],'name':util[_0x1e56('0xc')](_0x1e56('0xd'),_0x5ecb04[_0x1e56('0xe')]),'phone':_0x5ecb04[_0x1e56('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1e56('0x10')](_0x129f34[_0x1e56('0x11')],_0x5ecb04,'\x20'),'description':intUtil[_0x1e56('0x10')](_0x129f34['Descriptions'],_0x5ecb04,_0x1e56('0x12')),'tags':getTags(_0x129f34[_0x1e56('0x13')],'name')},getCustomFields(_0x129f34[_0x1e56('0x14')],_0x5ecb04));_0x5ea5eb[_0x1e56('0x15')]=_[_0x1e56('0x16')](_[_0x1e56('0x17')](_0x5ea5eb[_0x1e56('0x15')],'id'),'value');return request({'uri':util[_0x1e56('0xc')](_0x1e56('0x18'),_0x9d4266['remoteUri']),'method':_0x1e56('0x19'),'body':_0x5ea5eb})['then'](function(_0x2f6ce4){logger[_0x1e56('0xb')](_0x1e56('0x1a'));return _0x2f6ce4;});}function getUser(_0x2d3df9,_0x46791e){if(intUtil['validateEmail'](_0x46791e)){return request({'uri':util[_0x1e56('0xc')](_0x1e56('0x1b'),_0x2d3df9['remoteUri']),'qs':{'email':_0x46791e}})['then'](function(_0x374e16){if(_0x374e16['length']){logger[_0x1e56('0xb')](_0x1e56('0x1c'));return _[_0x1e56('0x1d')](_0x374e16,function(_0x3acc0e){return _0x3acc0e[_0x1e56('0x1e')][_0x1e56('0x1f')]===_0x46791e;});}else{logger['info'](_0x1e56('0x20'));return request({'uri':util['format'](_0x1e56('0x21'),_0x2d3df9[_0x1e56('0x22')])})[_0x1e56('0x23')](function(_0x51672d){logger[_0x1e56('0xb')](_0x1e56('0x24'));return _0x51672d;});}});}else{logger['info'](_0x1e56('0x25'));return request({'uri':util['format'](_0x1e56('0x21'),_0x2d3df9[_0x1e56('0x22')])})[_0x1e56('0x23')](function(_0x3ccaf4){logger[_0x1e56('0xb')](_0x1e56('0x24'));return _0x3ccaf4;});}}function getEndUser(_0x11a16d,_0x18a9d4,_0x37c77b){logger[_0x1e56('0xb')]('Searching\x20enduser\x20with\x20phone',_0x37c77b);return request({'uri':util[_0x1e56('0xc')](_0x1e56('0x26'),_0x11a16d[_0x1e56('0x22')]),'qs':{'phone':_0x37c77b}})[_0x1e56('0x23')](function(_0x535aeb){if(_0x535aeb[_0x1e56('0x27')]){logger['info']('Enduser\x20found!');return _[_0x1e56('0x1d')](_0x535aeb,{'phone':_0x37c77b});}else{logger[_0x1e56('0xb')](_0x1e56('0x28'));return request({'uri':util[_0x1e56('0xc')]('%s/api/v2/contacts',_0x11a16d[_0x1e56('0x22')]),'method':_0x1e56('0x19'),'body':{'name':_0x18a9d4,'phone':_0x37c77b}})[_0x1e56('0x23')](function(_0x1de3b0){logger[_0x1e56('0xb')](_0x1e56('0x29'));return _0x1de3b0;});}});}function getAuth(_0x138308){return util[_0x1e56('0xc')](_0x1e56('0x2a'),new Buffer(_0x138308[_0x1e56('0x2b')]+':X')[_0x1e56('0x2c')](_0x1e56('0x2d')));}function request(_0x3eea17){logger['debug'](_0x1e56('0x2e'),JSON[_0x1e56('0x2f')](_0x3eea17));return rp(_[_0x1e56('0x6')](_0x3eea17,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3c507a,_0x32c20c){var _0x4d0402=[];if(_0x3c507a&&_0x3c507a[_0x1e56('0x27')]>0x0){_0x4d0402=_['map'](_0x3c507a,_0x32c20c);}return _0x4d0402;}function getCustomFields(_0x53e3a7,_0x1958fc){var _0x23e6c1=[];var _0x40bbf9={'custom_fields':[]};if(_0x53e3a7[_0x1e56('0x27')]>0x0){_['forEach'](_0x53e3a7,function(_0x794b7){if(_[_0x1e56('0x30')](['string',_0x1e56('0x31')],_0x794b7[_0x1e56('0x32')])&&_0x794b7[_0x1e56('0x33')]&&!_0x794b7['customField']){_0x40bbf9[_0x794b7['nameField'][_0x1e56('0x34')]()]=_0x794b7[_0x1e56('0x35')]['toString']();}else if(_[_0x1e56('0x30')]([_0x1e56('0x36'),_0x1e56('0x31')],_0x794b7['type'])&&_0x794b7[_0x1e56('0x37')]&&_0x794b7[_0x1e56('0x38')]){_0x40bbf9[_0x1e56('0x15')][_0x1e56('0x39')]({'id':_0x794b7[_0x1e56('0x37')],'value':_0x794b7[_0x1e56('0x35')][_0x1e56('0x2c')]()});}else if(_0x794b7['type']===_0x1e56('0x3a')&&_0x794b7[_0x1e56('0x3b')]&&_0x794b7[_0x1e56('0x37')]&&_0x794b7['customField']){_0x1958fc[_0x794b7[_0x1e56('0x3b')]]&&_0x40bbf9[_0x1e56('0x15')]['push']({'id':_0x794b7['idField'],'value':_0x1958fc[_0x794b7[_0x1e56('0x3b')]][_0x1e56('0x2c')]()});}else if(_0x794b7[_0x1e56('0x32')]==='customVariable'&&_0x794b7[_0x1e56('0x3c')]&&_0x794b7['Variable'][_0x1e56('0x3d')]&&_0x794b7[_0x1e56('0x37')]&&_0x794b7[_0x1e56('0x38')]){_0x1958fc[_0x794b7[_0x1e56('0x3c')][_0x1e56('0x3d')][_0x1e56('0x34')]()]&&_0x40bbf9[_0x1e56('0x15')]['push']({'id':_0x794b7[_0x1e56('0x37')],'value':_0x1958fc[_0x794b7['Variable'][_0x1e56('0x3d')][_0x1e56('0x34')]()][_0x1e56('0x2c')]()});}});}return _0x40bbf9;}exports[_0x1e56('0x3e')]=function(_0x8714a6,_0x535a2c,_0x105421,_0x40deba,_0x3d29cf,_0x20d61c){var _0x4a2894,_0x37c526;_0x20d61c[_0x1e56('0x22')]=intUtil['stripTrailingSlash'](_0x20d61c['remoteUri']);_0x20d61c[_0x1e56('0x3f')]=intUtil[_0x1e56('0x40')](_0x20d61c['serverUrl']);if(_0x3d29cf&&_0x3d29cf[_0x1e56('0x41')]){logger[_0x1e56('0xb')](_0x1e56('0x42'),_0x1e56('0x43'));_0x535a2c['recordingURL']=util['format'](_0x1e56('0x44'),_0x20d61c[_0x1e56('0x3f')],_0x535a2c[_0x1e56('0x45')],md5(_0x535a2c[_0x1e56('0x45')]));}else{_0x535a2c['recordingURL']='';}headers[_0x1e56('0x46')]=getAuth(_0x20d61c);return getUser(_0x20d61c,_0x40deba[_0x1e56('0x1f')])[_0x1e56('0x23')](function(_0x4d256f){_0x4a2894=_0x4d256f;logger[_0x1e56('0xb')](_0x1e56('0x47'),_0x4a2894['id']);return getEndUser(_0x20d61c,_0x535a2c[_0x1e56('0xe')],_0x535a2c[_0x1e56('0xf')]);})[_0x1e56('0x23')](function(_0x7d9405){_0x37c526=_0x7d9405;logger[_0x1e56('0xb')](_0x1e56('0x48'),_0x37c526['id']);return getTicket(_0x20d61c,_0x4a2894,_0x37c526,_0x105421,_0x535a2c);})[_0x1e56('0x23')](function(_0x473e8d){if(_0x473e8d&&_0x473e8d['id']){logger[_0x1e56('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x473e8d['id']);logger[_0x1e56('0xb')](_0x1e56('0x42'),_0x1e56('0x49'));emit(util[_0x1e56('0xc')](_0x1e56('0x4a'),_0x40deba['name']),_0x1e56('0x4b'),{'uri':util[_0x1e56('0xc')]('%s/helpdesk/tickets/%d',_0x20d61c[_0x1e56('0x22')],_0x473e8d['id'])});}})[_0x1e56('0x4c')](function(_0x5a24cc){logger[_0x1e56('0x4d')](_0x1e56('0x42'),JSON[_0x1e56('0x2f')](_0x5a24cc));});};exports['outbound']=function(_0x432d4a,_0x5db6d3,_0x47b168,_0x1d64d2,_0x120d4b,_0x612d82,_0x4f2f6c){var _0x357114,_0xc563dc;_0x612d82[_0x1e56('0x22')]=intUtil[_0x1e56('0x40')](_0x612d82[_0x1e56('0x22')]);_0x612d82[_0x1e56('0x3f')]=intUtil[_0x1e56('0x40')](_0x612d82['serverUrl']);if(_0x4f2f6c&&_0x4f2f6c[_0x1e56('0x4e')]&&_0x4f2f6c['recordingFormat']!==_0x1e56('0x4f')){logger[_0x1e56('0xb')](_0x1e56('0x50'),_0x1e56('0x43'));_0x5db6d3[_0x1e56('0x51')]=util[_0x1e56('0xc')](_0x1e56('0x44'),_0x612d82[_0x1e56('0x3f')],_0x5db6d3[_0x1e56('0x45')],md5(_0x5db6d3[_0x1e56('0x45')]));}headers[_0x1e56('0x46')]=getAuth(_0x612d82);return getUser(_0x612d82,_0x1d64d2[_0x1e56('0x1f')])[_0x1e56('0x23')](function(_0x358556){_0x357114=_0x358556;logger[_0x1e56('0xb')]('The\x20User\x20ID\x20is:',_0x357114['id']);return getEndUser(_0x612d82,_0x5db6d3['destcalleridname'],_0x5db6d3[_0x1e56('0x52')]);})[_0x1e56('0x23')](function(_0x256fc8){_0xc563dc=_0x256fc8;logger['info']('The\x20Enduser\x20ID\x20is:',_0xc563dc['id']);return getTicket(_0x612d82,_0x357114,_0xc563dc,_0x47b168,_0x5db6d3);})[_0x1e56('0x23')](function(_0x9d955b){if(_0x9d955b&&_0x9d955b['id']){logger[_0x1e56('0xb')](_0x1e56('0x1a'));logger[_0x1e56('0xb')](_0x1e56('0x53'),_0x9d955b['id']);logger[_0x1e56('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1e56('0xc')](_0x1e56('0x4a'),_0x1d64d2['name']),'trigger:browser:url',{'uri':util[_0x1e56('0xc')](_0x1e56('0x54'),_0x612d82[_0x1e56('0x22')],_0x9d955b['id'])});}})[_0x1e56('0x4c')](function(_0x20cee2){logger['error'](_0x1e56('0x50'),JSON[_0x1e56('0x2f')](_0x20cee2));});};exports[_0x1e56('0x55')]=function(_0x19632b,_0x549951,_0x55bf49,_0x1c5b2d,_0x2d92a1,_0x14cc6b){var _0x58d671,_0x3a20bb;_0x14cc6b[_0x1e56('0x22')]=intUtil[_0x1e56('0x40')](_0x14cc6b['remoteUri']);_0x14cc6b['serverUrl']=intUtil[_0x1e56('0x40')](_0x14cc6b['serverUrl']);if(_0x2d92a1&&_0x2d92a1[_0x1e56('0x41')]){logger[_0x1e56('0xb')]('['+_0x549951[_0x1e56('0x56')][_0x1e56('0x57')]()+']',_0x1e56('0x43'));_0x549951[_0x1e56('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14cc6b[_0x1e56('0x3f')],_0x549951[_0x1e56('0x45')],md5(_0x549951['uniqueid']));}else{_0x549951[_0x1e56('0x51')]='';}headers['Authorization']=getAuth(_0x14cc6b);return getUser(_0x14cc6b,'')[_0x1e56('0x23')](function(_0x26b193){_0x58d671=_0x26b193;logger['info']('The\x20User\x20ID\x20is:',_0x58d671['id']);return getEndUser(_0x14cc6b,_0x549951[_0x1e56('0xe')],_0x549951[_0x1e56('0xf')]);})['then'](function(_0x49ee33){_0x3a20bb=_0x49ee33;logger['info'](_0x1e56('0x48'),_0x3a20bb['id']);return getTicket(_0x14cc6b,_0x58d671,_0x3a20bb,_0x55bf49,_0x549951);})[_0x1e56('0x23')](function(_0x1910e1){if(_0x1910e1){logger['info'](_0x1e56('0x1a'));logger[_0x1e56('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1910e1['id']);}})[_0x1e56('0x4c')](function(_0x8ba7cc){logger[_0x1e56('0x4d')]('['+_0x549951[_0x1e56('0x56')]['toUpperCase']()+']',JSON[_0x1e56('0x2f')](_0x8ba7cc));});}; \ 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 d8ae71c..3c3126e 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 _0x5191=['contact','Creating\x20new\x20task','getString','Subjects','Contact','format','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','adminEmail','error','toUpperCase','message','/api/lookup?q=','&f=','find','contacts','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','userId','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x21e93e,_0x1b1b75){var _0x68e4e0=function(_0xde87b6){while(--_0xde87b6){_0x21e93e['push'](_0x21e93e['shift']());}};_0x68e4e0(++_0x1b1b75);}(_0x5191,0x117));var _0x1519=function(_0x4b9298,_0x40ddcf){_0x4b9298=_0x4b9298-0x0;var _0x369af0=_0x5191[_0x4b9298];return _0x369af0;};'use strict';var _=require(_0x1519('0x0'));var rp=require('request-promise');var md5=require(_0x1519('0x1'));var util=require(_0x1519('0x2'));var moment=require(_0x1519('0x3'));var Promise=require(_0x1519('0x4'));var Redis=require(_0x1519('0x5'));var intUtil=require(_0x1519('0x6'));var config=require(_0x1519('0x7'));var logger=require(_0x1519('0x8'))(_0x1519('0x9'));config['redis']=_[_0x1519('0xa')](config[_0x1519('0xb')],{'host':_0x1519('0xc'),'port':0x18eb});var io=require(_0x1519('0xd'))(new Redis(config[_0x1519('0xb')]));function getAdminId(_0x12e0a3,_0x583dbf,_0x4dca22,_0x3e88eb){return new Promise(function(_0x34bf37,_0x18b1e1){var _0x122dc7=![];var _0xc4b6c0={'method':_0x1519('0xe'),'uri':_0x3e88eb+_0x1519('0xf'),'json':!![]};_0xc4b6c0[_0x1519('0x10')]=_0x4dca22;logger[_0x1519('0x11')](_0x1519('0x12'));return rp(_0xc4b6c0)[_0x1519('0x13')](function(_0x3c82a2){if(_0x3c82a2){var _0x49c546=_0x3c82a2[_0x1519('0x14')];var _0x1f283e=null;for(_0x1f283e=0x0;_0x1f283e<_0x49c546['length'];_0x1f283e++){if(_0x49c546[_0x1f283e][_0x1519('0x15')]===_0x12e0a3['adminEmail']){_0x12e0a3[_0x1519('0x16')]=_0x49c546[_0x1f283e]['id'];_0x122dc7=!![];}}if(_0x122dc7){logger[_0x1519('0x11')](_0x1519('0x17'),_0x12e0a3['adminId']);_0x34bf37(_0x12e0a3);}else{_0x18b1e1({'statusCode':0x194,'message':_0x1519('0x18')});}}else{_0x18b1e1({'statusCode':0x194,'message':_0x1519('0x18')});}})[_0x1519('0x19')](function(_0x506248){logger['error']('['+[_0x583dbf['toUpperCase']()]+']',_0x506248['message']);_0x18b1e1(_0x506248);});});}function getUser(_0x524a20,_0xed37b7,_0x2a6e69){return function(_0x26efd2){return new Promise(function(_0x563d3d,_0x1b80dd){var _0x28e652={'method':_0x1519('0xe'),'uri':_0x2a6e69+_0x1519('0xf'),'json':!![]};_0x28e652[_0x1519('0x10')]=_0xed37b7;logger[_0x1519('0x11')](_0x1519('0x1a'));return rp(_0x28e652)[_0x1519('0x13')](function(_0x5bb4b0){if(_0x5bb4b0){var _0x45df52=_0x5bb4b0[_0x1519('0x14')];var _0x522937=![];var _0x27be1b=null;if(_0x26efd2[_0x1519('0x1b')]!==null){logger[_0x1519('0x11')](_0x1519('0x1c'),_0x26efd2[_0x1519('0x1b')]);_0x26efd2[_0x1519('0x1d')]=_0x26efd2[_0x1519('0x1b')];for(_0x27be1b=0x0;_0x27be1b<_0x45df52['length'];_0x27be1b++){if(_0x45df52[_0x27be1b][_0x1519('0x15')]===_0x26efd2[_0x1519('0x1b')]){_0x522937=!![];_0x26efd2['userId']=_0x45df52[_0x27be1b]['id'];logger['info'](_0x1519('0x1e'),_0x26efd2['userId']);}}}if(!_0x522937){logger[_0x1519('0x11')]('Admin\x20selected');_0x26efd2['userEmail']=_0x26efd2[_0x1519('0x1f')];_0x26efd2['userId']=_0x26efd2[_0x1519('0x16')];_0x522937=!![];}if(_0x522937){_0x563d3d(_0x26efd2);}else{_0x1b80dd({'statusCode':0x194,'message':_0x1519('0x18')});}}else{_0x1b80dd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1519('0x19')](function(_0xdd9266){logger[_0x1519('0x20')]('['+[_0x524a20[_0x1519('0x21')]()]+']',_0xdd9266[_0x1519('0x22')]);_0x1b80dd(_0xdd9266);});});};}function searchContact(_0x493cac,_0x585254,_0x5c6b91,_0xe8628b){return new Promise(function(_0x2c4b6a,_0x52c54b){var _0x53b699={'method':_0x1519('0xe'),'headers':_0x585254,'uri':_0x493cac+_0x1519('0x23')+_0xe8628b+_0x1519('0x24')+_0x5c6b91+'&entities=contact','json':!![]};rp(_0x53b699)[_0x1519('0x13')](function(_0x155c71){var _0x1ae951=_[_0x1519('0x25')](_0x155c71[_0x1519('0x26')][_0x1519('0x26')],[_0x5c6b91,_0xe8628b]);_0x2c4b6a(_0x1ae951);})[_0x1519('0x19')](function(_0x449fe7){_0x52c54b(_0x449fe7);});});}function getEndUser(_0x1a4be9,_0x1534e5,_0x21c852){return function(_0x11d497){return new Promise(function(_0x30db8f,_0x5bbe6e){logger[_0x1519('0x11')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x11d497[_0x1519('0x27')]));searchContact(_0x21c852,_0x1534e5,_0x1519('0x28'),_0x11d497[_0x1519('0x27')])['then'](function(_0x4140af){if(_0x4140af){_0x11d497[_0x1519('0x29')]=_0x4140af['id'];logger[_0x1519('0x11')](_0x1519('0x2a'),_0x11d497[_0x1519('0x29')]);return _0x30db8f(_0x11d497);}searchContact(_0x21c852,_0x1534e5,_0x1519('0x2b'),_0x11d497[_0x1519('0x27')])[_0x1519('0x13')](function(_0x240078){if(_0x240078){_0x11d497[_0x1519('0x29')]=_0x240078['id'];logger[_0x1519('0x11')](_0x1519('0x2c'),_0x11d497[_0x1519('0x29')]);return _0x30db8f(_0x11d497);}createEndUser(_0x11d497,_0x1a4be9,_0x1534e5,_0x21c852)[_0x1519('0x13')](function(_0x54c6cb){logger[_0x1519('0x11')]('Contact\x20created:',_0x54c6cb[_0x1519('0x29')]);return _0x30db8f(_0x54c6cb);});});})[_0x1519('0x19')](function(_0x1bd5fa){_0x5bbe6e(_0x1bd5fa);});});};}function createEndUser(_0x431bc3,_0x5bd8f3,_0x1f2aa4,_0x3d355f){return new Promise(function(_0x1f6d2b,_0x2dbc4f){var _0x37eebd=moment();var _0xb1baa1={'method':_0x1519('0x2d'),'uri':_0x3d355f+_0x1519('0x2e'),'body':{'contact':{'last_name':_0x431bc3[_0x1519('0x27')],'work_number':_0x431bc3[_0x1519('0x27')],'mobile_number':_0x431bc3['contactNumber'],'owner_id':_0x431bc3[_0x1519('0x2f')],'created_at':_0x37eebd['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xb1baa1[_0x1519('0x10')]=_0x1f2aa4;logger[_0x1519('0x11')](_0x1519('0x30'));return rp(_0xb1baa1)['then'](function(_0x5ee6fd){_0x431bc3[_0x1519('0x29')]=_0x5ee6fd[_0x1519('0x31')]['id'];_0x1f6d2b(_0x431bc3);})['catch'](function(_0x32b530){logger[_0x1519('0x20')]('['+[_0x5bd8f3[_0x1519('0x21')]()]+']',_0x32b530['message']);_0x2dbc4f(_0x32b530[_0x1519('0x22')]);});});}function getTicket(_0x169195,_0x2c22cb,_0x38bc4c,_0x317eae,_0x4ce1f5){return function(_0x1f04dc){logger[_0x1519('0x11')](_0x1519('0x32'));return new Promise(function(_0x3e9dd3,_0xf8ae8b){var _0x14f6c5=moment();var _0x3c700f={'method':'POST','uri':_0x38bc4c+'/api/tasks','body':{'title':intUtil[_0x1519('0x33')](_0x317eae[_0x1519('0x34')],_0x4ce1f5,'\x20'),'description':intUtil['getString'](_0x317eae['Descriptions'],_0x4ce1f5,'\x0a'),'owner_id':_0x1f04dc[_0x1519('0x2f')],'creater_id':_0x1f04dc[_0x1519('0x16')],'targetable_id':_0x1f04dc[_0x1519('0x29')],'targetable_type':_0x1519('0x35'),'created_at':_0x14f6c5[_0x1519('0x36')](_0x1519('0x37')),'due_date':_0x14f6c5[_0x1519('0x38')](0x1e,'m')[_0x1519('0x36')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3c700f[_0x1519('0x10')]=_0x2c22cb;return rp(_0x3c700f)[_0x1519('0x13')](function(_0x49718c){_0x1f04dc[_0x1519('0x39')]=_0x49718c[_0x1519('0x3a')]['id'];logger['info'](_0x1519('0x3b'),_0x1f04dc['ticketId']);_0x3e9dd3(_0x1f04dc);})['catch'](function(_0x43af2e){logger[_0x1519('0x20')]('['+[_0x169195[_0x1519('0x21')]()]+']',_0x43af2e['message']);_0xf8ae8b(_0x43af2e[_0x1519('0x22')]);});});};}function emit(_0x5ea96e,_0x547761,_0x20d38a){var _0x2e5127={'uri':_0x5ea96e+_0x1519('0x3c')+_0x20d38a};io['to'](util[_0x1519('0x36')](_0x1519('0x3d'),_0x547761))['emit']('trigger:browser:url',_0x2e5127);}exports['cs']=function(_0x59cba3,_0x2a3013,_0x3f2405,_0x461648,_0x34759a,_0x38ce02,_0x514d08,_0x2102d3){var _0x15d207={};var _0x31206e={'Authorization':_0x1519('0x3e')+_0x38ce02[_0x1519('0x3f')]};_0x38ce02[_0x1519('0x40')]=intUtil[_0x1519('0x41')](_0x38ce02[_0x1519('0x40')]);_0x38ce02[_0x1519('0x42')]=intUtil[_0x1519('0x41')](_0x38ce02[_0x1519('0x42')]);var _0x2334a6=_0x38ce02[_0x1519('0x40')];_0x15d207[_0x1519('0x1f')]=_0x38ce02[_0x1519('0x43')];_0x15d207[_0x1519('0x27')]=_0x2102d3[_0x1519('0x44')]()===_0x1519('0x45')?_0x2a3013['destcalleridnum']:_0x2a3013[_0x1519('0x46')];_0x15d207[_0x1519('0x47')]=_0x2102d3===_0x1519('0x48')||_0x2102d3===_0x1519('0x49')?_0x1519('0x48'):_0x1519('0x45');if(_0x461648){_0x15d207[_0x1519('0x1b')]=_0x461648[_0x1519('0x15')];}var _0x23a298=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38ce02['serverUrl'],_0x2a3013['uniqueid'],md5(_0x2a3013[_0x1519('0x4a')]));if(_0x34759a&&_0x34759a['monitor_format']){logger['info'](_0x1519('0x4b'),'Recording\x20is\x20enabled!');_0x2a3013[_0x1519('0x4c')]=_0x23a298;}else if(_0x514d08&&_0x514d08[_0x1519('0x4d')]&&_0x514d08[_0x1519('0x4d')]!==_0x1519('0x4e')){logger[_0x1519('0x11')](_0x1519('0x4f'),'Recording\x20is\x20enabled!');_0x2a3013['recordingURL']=_0x23a298;}else{_0x2a3013[_0x1519('0x4c')]='';}return getAdminId(_0x15d207,_0x2102d3,_0x31206e,_0x2334a6)[_0x1519('0x13')](getUser(_0x2102d3,_0x31206e,_0x2334a6))['then'](getEndUser(_0x2102d3,_0x31206e,_0x2334a6))['then'](getTicket(_0x2102d3,_0x31206e,_0x2334a6,_0x3f2405,_0x2a3013))[_0x1519('0x13')](function(_0x332fd2){logger[_0x1519('0x11')](util[_0x1519('0x36')]('The\x20ticket\x20ID\x20is:\x20%s',_0x332fd2[_0x1519('0x39')]));if(_0x2102d3!==_0x1519('0x49')){logger[_0x1519('0x11')]('['+[_0x2102d3[_0x1519('0x21')]()]+']',_0x1519('0x50'));emit(_0x2334a6,_0x461648['name'],_0x332fd2[_0x1519('0x29')]);}})['catch'](function(_0xd9d581){logger[_0x1519('0x20')]('['+[_0x2102d3[_0x1519('0x21')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x1519('0x51')](_0xd9d581,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1e69=['recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','GET','/api/selector/owners','headers','Getting\x20admin\x20information','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','then','users','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','task','Task\x20created:','ticketId','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','unmanaged','outbound','monitor_format','[QUEUE]','recordingURL'];(function(_0x256961,_0x3768d1){var _0xbd1500=function(_0x4f2b73){while(--_0x4f2b73){_0x256961['push'](_0x256961['shift']());}};_0xbd1500(++_0x3768d1);}(_0x1e69,0xa4));var _0x91e6=function(_0xd274ec,_0x6b590b){_0xd274ec=_0xd274ec-0x0;var _0x5345c8=_0x1e69[_0xd274ec];return _0x5345c8;};'use strict';var _=require(_0x91e6('0x0'));var rp=require(_0x91e6('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0x91e6('0x2'));var Promise=require(_0x91e6('0x3'));var Redis=require(_0x91e6('0x4'));var intUtil=require('./util');var config=require(_0x91e6('0x5'));var logger=require(_0x91e6('0x6'))('freshsales');config[_0x91e6('0x7')]=_[_0x91e6('0x8')](config[_0x91e6('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x91e6('0x7')]));function getAdminId(_0x5d506d,_0x5005a1,_0x312470,_0x46a85e){return new Promise(function(_0xd43b00,_0x5a8278){var _0x2b6d1b=![];var _0x486cfe={'method':_0x91e6('0x9'),'uri':_0x46a85e+_0x91e6('0xa'),'json':!![]};_0x486cfe[_0x91e6('0xb')]=_0x312470;logger['info'](_0x91e6('0xc'));return rp(_0x486cfe)['then'](function(_0x3d0e65){if(_0x3d0e65){var _0xbff4e1=_0x3d0e65['users'];var _0x131b63=null;for(_0x131b63=0x0;_0x131b63<_0xbff4e1[_0x91e6('0xd')];_0x131b63++){if(_0xbff4e1[_0x131b63][_0x91e6('0xe')]===_0x5d506d[_0x91e6('0xf')]){_0x5d506d['adminId']=_0xbff4e1[_0x131b63]['id'];_0x2b6d1b=!![];}}if(_0x2b6d1b){logger[_0x91e6('0x10')](_0x91e6('0x11'),_0x5d506d[_0x91e6('0x12')]);_0xd43b00(_0x5d506d);}else{_0x5a8278({'statusCode':0x194,'message':_0x91e6('0x13')});}}else{_0x5a8278({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x91e6('0x14')](function(_0x1e9806){logger['error']('['+[_0x5005a1[_0x91e6('0x15')]()]+']',_0x1e9806[_0x91e6('0x16')]);_0x5a8278(_0x1e9806);});});}function getUser(_0x2c3f3c,_0x3532a2,_0x3ba56e){return function(_0x429bb1){return new Promise(function(_0x11ffb6,_0x8619f6){var _0x3dad72={'method':_0x91e6('0x9'),'uri':_0x3ba56e+_0x91e6('0xa'),'json':!![]};_0x3dad72['headers']=_0x3532a2;logger[_0x91e6('0x10')](_0x91e6('0x17'));return rp(_0x3dad72)[_0x91e6('0x18')](function(_0xee3c36){if(_0xee3c36){var _0x2388ef=_0xee3c36[_0x91e6('0x19')];var _0x33fe8f=![];var _0x1d1d1d=null;if(_0x429bb1['agentEmail']!==null){logger[_0x91e6('0x10')](_0x91e6('0x1a'),_0x429bb1[_0x91e6('0x1b')]);_0x429bb1[_0x91e6('0x1c')]=_0x429bb1[_0x91e6('0x1b')];for(_0x1d1d1d=0x0;_0x1d1d1d<_0x2388ef[_0x91e6('0xd')];_0x1d1d1d++){if(_0x2388ef[_0x1d1d1d][_0x91e6('0xe')]===_0x429bb1[_0x91e6('0x1b')]){_0x33fe8f=!![];_0x429bb1[_0x91e6('0x1d')]=_0x2388ef[_0x1d1d1d]['id'];logger[_0x91e6('0x10')](_0x91e6('0x1e'),_0x429bb1[_0x91e6('0x1d')]);}}}if(!_0x33fe8f){logger[_0x91e6('0x10')](_0x91e6('0x1f'));_0x429bb1[_0x91e6('0x1c')]=_0x429bb1[_0x91e6('0xf')];_0x429bb1['userId']=_0x429bb1[_0x91e6('0x12')];_0x33fe8f=!![];}if(_0x33fe8f){_0x11ffb6(_0x429bb1);}else{_0x8619f6({'statusCode':0x194,'message':_0x91e6('0x13')});}}else{_0x8619f6({'statusCode':0x194,'message':_0x91e6('0x13')});}})['catch'](function(_0xff1b9a){logger[_0x91e6('0x20')]('['+[_0x2c3f3c['toUpperCase']()]+']',_0xff1b9a[_0x91e6('0x16')]);_0x8619f6(_0xff1b9a);});});};}function searchContact(_0x85d462,_0x46da0a,_0x3a6af4,_0xe2c4ab){return new Promise(function(_0x4ace75,_0x9b50cb){var _0x4a7a7d={'method':_0x91e6('0x9'),'headers':_0x46da0a,'uri':_0x85d462+_0x91e6('0x21')+_0xe2c4ab+_0x91e6('0x22')+_0x3a6af4+'&entities=contact','json':!![]};rp(_0x4a7a7d)[_0x91e6('0x18')](function(_0x415b90){var _0x518e3a=_[_0x91e6('0x23')](_0x415b90[_0x91e6('0x24')]['contacts'],[_0x3a6af4,_0xe2c4ab]);_0x4ace75(_0x518e3a);})[_0x91e6('0x14')](function(_0x2dd45d){_0x9b50cb(_0x2dd45d);});});}function getEndUser(_0x28cd0a,_0x545b62,_0x25a7e7){return function(_0x3e21ab){return new Promise(function(_0xc9fc3,_0xb88401){logger[_0x91e6('0x10')](util[_0x91e6('0x25')](_0x91e6('0x26'),_0x3e21ab['contactNumber']));searchContact(_0x25a7e7,_0x545b62,_0x91e6('0x27'),_0x3e21ab[_0x91e6('0x28')])[_0x91e6('0x18')](function(_0xf7e14b){if(_0xf7e14b){_0x3e21ab[_0x91e6('0x29')]=_0xf7e14b['id'];logger[_0x91e6('0x10')]('Contact\x20found\x20mobile_number:',_0x3e21ab[_0x91e6('0x29')]);return _0xc9fc3(_0x3e21ab);}searchContact(_0x25a7e7,_0x545b62,_0x91e6('0x2a'),_0x3e21ab[_0x91e6('0x28')])[_0x91e6('0x18')](function(_0x5a6d54){if(_0x5a6d54){_0x3e21ab['endUserId']=_0x5a6d54['id'];logger[_0x91e6('0x10')](_0x91e6('0x2b'),_0x3e21ab['endUserId']);return _0xc9fc3(_0x3e21ab);}createEndUser(_0x3e21ab,_0x28cd0a,_0x545b62,_0x25a7e7)[_0x91e6('0x18')](function(_0x52ee54){logger[_0x91e6('0x10')](_0x91e6('0x2c'),_0x52ee54[_0x91e6('0x29')]);return _0xc9fc3(_0x52ee54);});});})['catch'](function(_0x4ee295){_0xb88401(_0x4ee295);});});};}function createEndUser(_0x28d269,_0x443e12,_0x311611,_0x5bc8cc){return new Promise(function(_0x56a686,_0x314737){var _0x234850=moment();var _0x29ee65={'method':_0x91e6('0x2d'),'uri':_0x5bc8cc+'/api/contacts','body':{'contact':{'last_name':_0x28d269[_0x91e6('0x28')],'work_number':_0x28d269['contactNumber'],'mobile_number':_0x28d269[_0x91e6('0x28')],'owner_id':_0x28d269['userId'],'created_at':_0x234850['format'](_0x91e6('0x2e'))}},'json':!![]};_0x29ee65[_0x91e6('0xb')]=_0x311611;logger['info'](_0x91e6('0x2f'));return rp(_0x29ee65)[_0x91e6('0x18')](function(_0x30ffef){_0x28d269['endUserId']=_0x30ffef[_0x91e6('0x30')]['id'];_0x56a686(_0x28d269);})[_0x91e6('0x14')](function(_0x555e2d){logger[_0x91e6('0x20')]('['+[_0x443e12[_0x91e6('0x15')]()]+']',_0x555e2d[_0x91e6('0x16')]);_0x314737(_0x555e2d['message']);});});}function getTicket(_0x490420,_0x2013bb,_0xc4cdba,_0x275309,_0x2139b5){return function(_0x250ee4){logger[_0x91e6('0x10')](_0x91e6('0x31'));return new Promise(function(_0x316440,_0x281b55){var _0x3c0917=moment();var _0x4a128b={'method':_0x91e6('0x2d'),'uri':_0xc4cdba+'/api/tasks','body':{'title':intUtil[_0x91e6('0x32')](_0x275309['Subjects'],_0x2139b5,'\x20'),'description':intUtil['getString'](_0x275309[_0x91e6('0x33')],_0x2139b5,'\x0a'),'owner_id':_0x250ee4[_0x91e6('0x1d')],'creater_id':_0x250ee4['adminId'],'targetable_id':_0x250ee4['endUserId'],'targetable_type':_0x91e6('0x34'),'created_at':_0x3c0917['format'](_0x91e6('0x2e')),'due_date':_0x3c0917['add'](0x1e,'m')[_0x91e6('0x25')](_0x91e6('0x2e'))},'json':!![]};_0x4a128b[_0x91e6('0xb')]=_0x2013bb;return rp(_0x4a128b)[_0x91e6('0x18')](function(_0xd9275c){_0x250ee4['ticketId']=_0xd9275c[_0x91e6('0x35')]['id'];logger['info'](_0x91e6('0x36'),_0x250ee4[_0x91e6('0x37')]);_0x316440(_0x250ee4);})[_0x91e6('0x14')](function(_0x525604){logger[_0x91e6('0x20')]('['+[_0x490420[_0x91e6('0x15')]()]+']',_0x525604['message']);_0x281b55(_0x525604[_0x91e6('0x16')]);});});};}function emit(_0x3ea734,_0x3775e1,_0x5848f3){var _0x55b05d={'uri':_0x3ea734+'/contacts/'+_0x5848f3};io['to'](util['format'](_0x91e6('0x38'),_0x3775e1))['emit'](_0x91e6('0x39'),_0x55b05d);}exports['cs']=function(_0x19767b,_0x1ed936,_0x390d56,_0x426755,_0xd302b7,_0x5b31bf,_0x3fa1d6,_0x216ce3){var _0x355ab9={};var _0x23d165={'Authorization':_0x91e6('0x3a')+_0x5b31bf['apiKey']};_0x5b31bf[_0x91e6('0x3b')]=intUtil[_0x91e6('0x3c')](_0x5b31bf[_0x91e6('0x3b')]);_0x5b31bf['serverUrl']=intUtil[_0x91e6('0x3c')](_0x5b31bf['serverUrl']);var _0x17a243=_0x5b31bf['remoteUri'];_0x355ab9['adminEmail']=_0x5b31bf[_0x91e6('0x3d')];_0x355ab9[_0x91e6('0x28')]=_0x216ce3[_0x91e6('0x3e')]()==='outbound'?_0x1ed936[_0x91e6('0x3f')]:_0x1ed936[_0x91e6('0x40')];_0x355ab9['callDirection']=_0x216ce3==='queue'||_0x216ce3===_0x91e6('0x41')?'queue':_0x91e6('0x42');if(_0x426755){_0x355ab9[_0x91e6('0x1b')]=_0x426755[_0x91e6('0xe')];}var _0x5e4047=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b31bf['serverUrl'],_0x1ed936['uniqueid'],md5(_0x1ed936['uniqueid']));if(_0xd302b7&&_0xd302b7[_0x91e6('0x43')]){logger[_0x91e6('0x10')](_0x91e6('0x44'),'Recording\x20is\x20enabled!');_0x1ed936[_0x91e6('0x45')]=_0x5e4047;}else if(_0x3fa1d6&&_0x3fa1d6[_0x91e6('0x46')]&&_0x3fa1d6['recordingFormat']!==_0x91e6('0x47')){logger[_0x91e6('0x10')](_0x91e6('0x48'),'Recording\x20is\x20enabled!');_0x1ed936[_0x91e6('0x45')]=_0x5e4047;}else{_0x1ed936['recordingURL']='';}return getAdminId(_0x355ab9,_0x216ce3,_0x23d165,_0x17a243)[_0x91e6('0x18')](getUser(_0x216ce3,_0x23d165,_0x17a243))[_0x91e6('0x18')](getEndUser(_0x216ce3,_0x23d165,_0x17a243))[_0x91e6('0x18')](getTicket(_0x216ce3,_0x23d165,_0x17a243,_0x390d56,_0x1ed936))[_0x91e6('0x18')](function(_0x4b8c98){logger['info'](util[_0x91e6('0x25')](_0x91e6('0x49'),_0x4b8c98['ticketId']));if(_0x216ce3!==_0x91e6('0x41')){logger[_0x91e6('0x10')]('['+[_0x216ce3[_0x91e6('0x15')]()]+']',_0x91e6('0x4a'));emit(_0x17a243,_0x426755[_0x91e6('0x4b')],_0x4b8c98['endUserId']);}})[_0x91e6('0x14')](function(_0x3f9106){logger[_0x91e6('0x20')]('['+[_0x216ce3[_0x91e6('0x15')]()]+_0x91e6('0x4c'),util[_0x91e6('0x4d')](_0x3f9106,{'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 1d66099..5699af4 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 _0x5010=['%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','data1','error','[EXEC]','format'];(function(_0x5e235c,_0x4e02dd){var _0x5d3c59=function(_0x66f3e6){while(--_0x66f3e6){_0x5e235c['push'](_0x5e235c['shift']());}};_0x5d3c59(++_0x4e02dd);}(_0x5010,0x78));var _0x0501=function(_0x4b8118,_0xf1377d){_0x4b8118=_0x4b8118-0x0;var _0x532a26=_0x5010[_0x4b8118];return _0x532a26;};'use strict';var _=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var zendesk=require(_0x0501('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x0501('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x0501('0x4'));var desk=require(_0x0501('0x5'));var vtiger=require(_0x0501('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x0501('0x7'));var freshsales=require(_0x0501('0x8'));var integrations=[_0x0501('0x9'),_0x0501('0xa'),'sugarcrm',_0x0501('0xb'),_0x0501('0xc'),_0x0501('0xd'),_0x0501('0xe'),_0x0501('0xf'),_0x0501('0x10'),_0x0501('0x11')];exports[_0x0501('0x12')]=function(_0xe0cd7e,_0x3f64a1,_0x272160,_0x35a675,_0x52b49e,_0x5176af){if(_0x272160){if(_[_0x0501('0x13')](integrations,_0xe0cd7e['data1']['toLowerCase']())){try{var _0x383a11=null;var _0x59d0f5='';var _0x20e90c=_0x272160[_0xe0cd7e['data1'][_0x0501('0x14')]()];if(_0x20e90c){var _0xb9f083=_0x20e90c[_0xe0cd7e[_0x0501('0x15')]];if(_0xb9f083){var _0x3e8dc1=_[_0x0501('0x16')](_0xb9f083[_0x0501('0x17')],{'id':parseInt(_0xe0cd7e[_0x0501('0x18')],0xa)});if(_0x3e8dc1){if(_0x35a675){if(_0x52b49e&&_0x3f64a1[_0x0501('0x19')]){_0x59d0f5=_0x0501('0x19');}else if(_0x3f64a1[_0x0501('0x1a')]){_0x59d0f5='outbound';}else{console[_0x0501('0x1b')](_0x0501('0x1c'),_0x3f64a1);}}else{_0x59d0f5=_0x0501('0x1d');}switch(_0xe0cd7e['data1'][_0x0501('0x14')]()){case _0x0501('0x9'):zendesk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xa'):salesforce[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0x1e'):sugarcrm[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xb'):freshdesk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xc'):zoho[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xd'):desk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xe'):vtiger[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0x10'):freshsales['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;case _0x0501('0x11'):servicenow['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;case _0x0501('0xf'):dynamics365['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;default:console[_0x0501('0x1b')](_0x0501('0x1f'));}}else{_0x383a11=require('../../../../config/logger')(_0xe0cd7e[_0x0501('0x20')][_0x0501('0x14')]());_0x383a11[_0x0501('0x21')](_0x0501('0x22'),util[_0x0501('0x23')](_0x0501('0x24'),_0xe0cd7e[_0x0501('0x20')][_0x0501('0x14')](),_0xe0cd7e['data3']));}}else{_0x383a11=require(_0x0501('0x25'))(_0xe0cd7e['data1'][_0x0501('0x14')]());_0x383a11[_0x0501('0x21')](_0x0501('0x22'),util['format'](_0x0501('0x26'),_0xe0cd7e['data1'][_0x0501('0x14')](),_0xe0cd7e[_0x0501('0x15')]));}}else{}}catch(_0x115fd6){console[_0x0501('0x21')](_0x115fd6);}}}}; \ No newline at end of file +var _0xfd5c=['unmanaged','toLowerCase','salesforce','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','exec','includes','data1','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN'];(function(_0x5afa77,_0x17e8a5){var _0x527c05=function(_0x4677dc){while(--_0x4677dc){_0x5afa77['push'](_0x5afa77['shift']());}};_0x527c05(++_0x17e8a5);}(_0xfd5c,0x143));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcfd5('0x0'));var util=require(_0xcfd5('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xcfd5('0x2'));var freshdesk=require(_0xcfd5('0x3'));var zoho=require(_0xcfd5('0x4'));var desk=require(_0xcfd5('0x5'));var vtiger=require(_0xcfd5('0x6'));var servicenow=require(_0xcfd5('0x7'));var dynamics365=require(_0xcfd5('0x8'));var freshsales=require(_0xcfd5('0x9'));var integrations=[_0xcfd5('0xa'),'salesforce',_0xcfd5('0xb'),_0xcfd5('0xc'),_0xcfd5('0xd'),_0xcfd5('0xe'),_0xcfd5('0xf'),'dynamics365',_0xcfd5('0x10'),'servicenow'];exports[_0xcfd5('0x11')]=function(_0x41ea04,_0x30488b,_0x475f7,_0x25ea38,_0x268b3e,_0x2b1385){if(_0x475f7){if(_[_0xcfd5('0x12')](integrations,_0x41ea04[_0xcfd5('0x13')]['toLowerCase']())){try{var _0xed6769=null;var _0x4d2e6f='';var _0x1717f8=_0x475f7[_0x41ea04[_0xcfd5('0x13')]['toLowerCase']()];if(_0x1717f8){var _0x1c0d7d=_0x1717f8[_0x41ea04['data2']];if(_0x1c0d7d){var _0x262bed=_[_0xcfd5('0x14')](_0x1c0d7d[_0xcfd5('0x15')],{'id':parseInt(_0x41ea04[_0xcfd5('0x16')],0xa)});if(_0x262bed){if(_0x25ea38){if(_0x268b3e&&_0x30488b[_0xcfd5('0x17')]){_0x4d2e6f=_0xcfd5('0x17');}else if(_0x30488b[_0xcfd5('0x18')]){_0x4d2e6f=_0xcfd5('0x19');}else{console[_0xcfd5('0x1a')](_0xcfd5('0x1b'),_0x30488b);}}else{_0x4d2e6f=_0xcfd5('0x1c');}switch(_0x41ea04[_0xcfd5('0x13')][_0xcfd5('0x1d')]()){case _0xcfd5('0xa'):zendesk[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0x1e'):salesforce[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0xb'):sugarcrm[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0xc'):freshdesk[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0xd'):zoho[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0xe'):desk[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case _0xcfd5('0xf'):vtiger[_0x4d2e6f](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385);break;case'freshsales':freshsales['cs'](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385,_0x4d2e6f);break;case'servicenow':servicenow['cs'](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385,_0x4d2e6f);break;case _0xcfd5('0x1f'):dynamics365['cs'](_0x41ea04,_0x30488b,_0x262bed,_0x25ea38,_0x268b3e,_0x1c0d7d,_0x2b1385,_0x4d2e6f);break;default:console[_0xcfd5('0x1a')](_0xcfd5('0x20'));}}else{_0xed6769=require(_0xcfd5('0x21'))(_0x41ea04[_0xcfd5('0x13')][_0xcfd5('0x1d')]());_0xed6769[_0xcfd5('0x22')](_0xcfd5('0x23'),util[_0xcfd5('0x24')]('%s\x20configuration\x20#%s\x20not\x20found',_0x41ea04[_0xcfd5('0x13')][_0xcfd5('0x1d')](),_0x41ea04[_0xcfd5('0x16')]));}}else{_0xed6769=require(_0xcfd5('0x21'))(_0x41ea04[_0xcfd5('0x13')]['toLowerCase']());_0xed6769[_0xcfd5('0x22')](_0xcfd5('0x23'),util[_0xcfd5('0x24')](_0xcfd5('0x25'),_0x41ea04[_0xcfd5('0x13')][_0xcfd5('0x1d')](),_0x41ea04[_0xcfd5('0x26')]));}}else{}}catch(_0x4d5980){console[_0xcfd5('0x22')](_0x4d5980);}}}}; \ 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 cecdf24..75f5d9d 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 _0x1f79=['lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','account','leadId','sobject','create','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','format','forEach','includes','picklist','idField','content','variable','variableName','toString','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x1f79,0x7e));var _0x91f7=function(_0x3a4559,_0xa90b89){_0x3a4559=_0x3a4559-0x0;var _0x56cde0=_0x1f79[_0x3a4559];return _0x56cde0;};'use strict';var _=require(_0x91f7('0x0'));var rp=require(_0x91f7('0x1'));var moment=require(_0x91f7('0x2'));var BPromise=require(_0x91f7('0x3'));var md5=require(_0x91f7('0x4'));var jsforce=require('jsforce');var util=require(_0x91f7('0x5'));var Redis=require(_0x91f7('0x6'));var intUtil=require(_0x91f7('0x7'));var config=require(_0x91f7('0x8'));var logger=require(_0x91f7('0x9'))(_0x91f7('0xa'));config['redis']=_['defaults'](config[_0x91f7('0xb')],{'host':_0x91f7('0xc'),'port':0x18eb});var io=require(_0x91f7('0xd'))(new Redis(config['redis']));function emit(_0x51d0f7,_0x2472ef,_0x4a681e){io['to'](_0x51d0f7)[_0x91f7('0xe')](_0x2472ef,_0x4a681e);}function getTicket(_0x1405c0,_0x43abb9,_0x40c9e2,_0x298270,_0x326423,_0x38f60e,_0x2058bd,_0x526b5c){var _0x1a42c3=Object[_0x91f7('0xf')]({},{'OwnerId':_0x43abb9['id'],'Subject':intUtil['getString'](_0x298270[_0x91f7('0x10')],_0x326423,'\x20'),'Description':intUtil['getString'](_0x298270[_0x91f7('0x11')],_0x326423,'\x0a')},getCustomFields(_0x38f60e,_0x326423));if(_0x40c9e2){if(_0x298270[_0x91f7('0x12')]===_0x91f7('0x13')){_0x1a42c3[_0x91f7('0x14')]=moment[_0x91f7('0x15')]();_0x1a42c3['IsReminderSet']=![];_0x1a42c3[_0x91f7('0x16')]=![];if(_0x40c9e2[_0x91f7('0x17')]===_0x91f7('0x18')||_0x40c9e2[_0x91f7('0x17')]==='lead'){_0x1a42c3[_0x91f7('0x19')]=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]==='account'){_0x1a42c3[_0x91f7('0x1a')]=_0x40c9e2['id'];}}else if(_0x298270['ticketType']==='Case'){if(_0x40c9e2[_0x91f7('0x17')]==='contact'){_0x1a42c3['ContactId']=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]===_0x91f7('0x1b')){_0x1a42c3['AccountId']=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]==='lead'&&_0x298270[_0x91f7('0x1c')]){_0x1a42c3[_0x298270['leadId']]=_0x40c9e2['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2058bd[_0x91f7('0x1d')](_0x298270[_0x91f7('0x12')])[_0x91f7('0x1e')](_0x1a42c3);}function getUser(_0x3d0d2d,_0x45b7a7,_0x1b7b91){if(!_['isNil'](_0x45b7a7)&&intUtil[_0x91f7('0x1f')](_0x45b7a7)){var _0x305887={'Email':_0x45b7a7};var _0x171a94={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1b7b91['sobject'](_0x91f7('0x20'))[_0x91f7('0x21')](_0x305887,_0x171a94)[_0x91f7('0x22')]()[_0x91f7('0x23')](function(_0x5acce0){if(_0x5acce0[_0x91f7('0x24')]){var _0x1ebd21=_[_0x91f7('0x21')](_0x5acce0,function(_0x3463e2){return _0x3463e2[_0x91f7('0x25')]===_0x45b7a7;});if(_0x1ebd21){logger[_0x91f7('0x26')]('Agent\x20%s\x20found.',_0x45b7a7);return BPromise[_0x91f7('0x27')]({'id':_0x1ebd21['Id'],'name':_0x1ebd21[_0x91f7('0x28')]});}}else{logger[_0x91f7('0x26')](_0x91f7('0x29'),_0x45b7a7);return _0x1b7b91[_0x91f7('0x2a')]()[_0x91f7('0x23')](function(_0x3aea50){return BPromise['resolve']({'id':_0x3aea50[_0x91f7('0x2b')],'name':_0x3aea50['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x45b7a7);return _0x1b7b91['identity']()['then'](function(_0x36702a){return BPromise[_0x91f7('0x27')]({'id':_0x36702a[_0x91f7('0x2b')],'name':_0x36702a[_0x91f7('0x2c')]});});}}function getEndUser(_0x231aba,_0x5cd23b,_0x43f430,_0x3bc309,_0x33a3b6){var _0x278ecb={'$or':{'Phone':_0x3bc309}};var _0x25227d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x91f7('0x27')]()['then'](function(){logger[_0x91f7('0x26')](_0x91f7('0x2d'),_0x3bc309,_0x5cd23b[_0x91f7('0x2e')]);switch(_0x5cd23b[_0x91f7('0x2e')]){case'contact_lead':var _0x52ef41=_['cloneDeep'](_0x278ecb);if(_0x5cd23b[_0x91f7('0x2f')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_['merge'](_0x52ef41[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x31'))['find'](_0x52ef41,_0x25227d)[_0x91f7('0x22')]()['then'](function(_0x449fdc){if(_0x449fdc&&_0x449fdc[_0x91f7('0x24')]){return _0x449fdc;}else{var _0x1fac4f=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0xbd63de={};_0xbd63de[_0x5cd23b[_0x91f7('0x33')]]=_0x3bc309;_[_0x91f7('0x34')](_0x1fac4f[_0x91f7('0x30')],_0xbd63de);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x35'))[_0x91f7('0x21')](_0x1fac4f,_0x25227d);}});case'account_contact_lead':var _0x54425d=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x36')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x36')]]=_0x3bc309;_[_0x91f7('0x34')](_0x54425d[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x37'))[_0x91f7('0x21')](_0x54425d,_0x25227d)[_0x91f7('0x22')]()[_0x91f7('0x23')](function(_0x134c1f){if(_0x134c1f&&_0x134c1f[_0x91f7('0x24')]){return _0x134c1f;}else{var _0x56568c=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b['additionalSearchContact']){var _0x5c2385={};_0x5c2385[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_[_0x91f7('0x34')](_0x56568c[_0x91f7('0x30')],_0x5c2385);}return _0x33a3b6['sobject'](_0x91f7('0x31'))[_0x91f7('0x21')](_0x56568c,_0x25227d)[_0x91f7('0x23')](function(_0xa97eca){if(_0xa97eca&&_0xa97eca['length']){return _0xa97eca;}else{var _0xd715d4=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0x3a1837={};_0x3a1837[_0x5cd23b[_0x91f7('0x33')]]=_0x3bc309;_[_0x91f7('0x34')](_0xd715d4[_0x91f7('0x30')],_0x3a1837);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x35'))[_0x91f7('0x21')](_0xd715d4,_0x25227d);}});}});case _0x91f7('0x18'):var _0x52ef41=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b['additionalSearchContact']){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_[_0x91f7('0x34')](_0x52ef41[_0x91f7('0x30')],_0x553329);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x31'))['find'](_0x52ef41,_0x25227d)[_0x91f7('0x22')]();case'lead':var _0x52d5b3=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0x553329={};_0x553329[_0x5cd23b['additionalSearchLead']]=_0x3bc309;_[_0x91f7('0x34')](_0x52d5b3[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x35'))['find'](_0x52d5b3,_0x25227d);case _0x91f7('0x1b'):var _0x54425d=_['cloneDeep'](_0x278ecb);if(_0x5cd23b[_0x91f7('0x36')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x36')]]=_0x3bc309;_[_0x91f7('0x34')](_0x54425d[_0x91f7('0x30')],_0x553329);}return _0x33a3b6[_0x91f7('0x1d')]('Account')['find'](_0x54425d,_0x25227d);default:return null;}})['then'](function(_0x54585a){if(_0x54585a&&_0x54585a[_0x91f7('0x24')]){var _0x294bb5=_[_0x91f7('0x38')](_0x54585a);if(_0x294bb5){return BPromise['resolve']({'id':_0x294bb5['Id'],'name':_0x294bb5[_0x91f7('0x28')],'phone':_0x294bb5[_0x91f7('0x39')],'endUserType':_0x294bb5[_0x91f7('0x3a')][_0x91f7('0x3b')][_0x91f7('0x3c')]()});}}})[_0x91f7('0x23')](function(_0x509af7){if(_0x509af7){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x509af7[_0x91f7('0x17')],_0x3bc309);return BPromise[_0x91f7('0x27')](_0x509af7);}else{logger['info'](_0x91f7('0x3d'),_0x3bc309);var _0x42e4ac={'Phone':_0x3bc309};if(_0x5cd23b[_0x91f7('0x3e')]){if(_0x5cd23b[_0x91f7('0x3e')]==='contact'){logger[_0x91f7('0x26')](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b[_0x91f7('0x3e')]);_0x42e4ac[_0x91f7('0x40')]=_0x43f430!==_0x91f7('0x41')?_0x43f430:util['format'](_0x91f7('0x42'),_0x3bc309);}else if(_0x5cd23b[_0x91f7('0x3e')]==='lead'){logger[_0x91f7('0x26')](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b['moduleCreate']);_0x42e4ac['LastName']=_0x43f430!==_0x91f7('0x41')?_0x43f430:util['format'](_0x91f7('0x42'),_0x3bc309);_0x42e4ac[_0x91f7('0x43')]=_0x91f7('0x44');}else if(_0x5cd23b[_0x91f7('0x3e')]===_0x91f7('0x1b')){logger['info'](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b[_0x91f7('0x3e')]);_0x42e4ac[_0x91f7('0x28')]=_0x43f430!==_0x91f7('0x41')?_0x43f430:util[_0x91f7('0x45')](_0x91f7('0x42'),_0x3bc309);}else{return null;}}return _0x33a3b6[_0x91f7('0x1d')](_['upperFirst'](_0x5cd23b['moduleCreate']))[_0x91f7('0x1e')](_0x42e4ac)['then'](function(_0x58a17a){return BPromise[_0x91f7('0x27')]({'id':_0x58a17a['id'],'endUserType':_0x5cd23b['moduleCreate']});});}});}function getCustomFields(_0x5d18c8,_0x376e3b){var _0x1c4bfe={};if(_0x5d18c8[_0x91f7('0x24')]>0x0){_[_0x91f7('0x46')](_0x5d18c8,function(_0xa47ebd){if(_[_0x91f7('0x47')](['string',_0x91f7('0x48')],_0xa47ebd['type'])&&_0xa47ebd[_0x91f7('0x49')]){_0x1c4bfe[_0xa47ebd[_0x91f7('0x49')]]=_0xa47ebd[_0x91f7('0x4a')]['toString']();}else if(_0xa47ebd['type']===_0x91f7('0x4b')&&_0xa47ebd['variableName']&&_0xa47ebd[_0x91f7('0x49')]){_0x376e3b[_0xa47ebd['variableName']]&&(_0x1c4bfe[_0xa47ebd[_0x91f7('0x49')]]=_0x376e3b[_0xa47ebd[_0x91f7('0x4c')]][_0x91f7('0x4d')]());}else if(_0xa47ebd['type']==='customVariable'&&_0xa47ebd['Variable']&&_0xa47ebd[_0x91f7('0x4e')]['name']&&_0xa47ebd['idField']){_0x376e3b[_0xa47ebd[_0x91f7('0x4e')][_0x91f7('0x4f')]['toLowerCase']()]&&(_0x1c4bfe[_0xa47ebd['idField']]=_0x376e3b[_0xa47ebd['Variable'][_0x91f7('0x4f')][_0x91f7('0x3c')]()][_0x91f7('0x4d')]());}});}return _0x1c4bfe;}function getConnection(_0x2414bb){var _0x394a5f=_0x2414bb[_0x91f7('0x50')]['concat'](_0x2414bb[_0x91f7('0x51')]);var _0x3109e0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2414bb[_0x91f7('0x52')]||_0x91f7('0x53'),'clientId':_0x2414bb['clientId'],'clientSecret':_0x2414bb[_0x91f7('0x54')]}});return _0x3109e0[_0x91f7('0x55')](_0x2414bb[_0x91f7('0x56')],_0x394a5f)['then'](function(){logger[_0x91f7('0x26')]('Connection\x20established.');return _0x3109e0;});}exports[_0x91f7('0x57')]=function(_0x2f3043,_0x4ed061,_0x5e211e,_0x58fda2,_0x37e105,_0x177b3b){var _0x668318,_0xe8e8cf,_0x40c648,_0x2be900;_0x177b3b[_0x91f7('0x58')]=intUtil[_0x91f7('0x59')](_0x177b3b[_0x91f7('0x58')]);_0x177b3b['remoteUri']=intUtil[_0x91f7('0x59')](_0x177b3b[_0x91f7('0x52')]);if(_0x37e105&&_0x37e105[_0x91f7('0x5a')]){logger['info'](_0x91f7('0x5b'),_0x91f7('0x5c'));_0x4ed061[_0x91f7('0x5d')]=util[_0x91f7('0x45')](_0x91f7('0x5e'),_0x177b3b[_0x91f7('0x58')],_0x4ed061['uniqueid'],md5(_0x4ed061[_0x91f7('0x5f')]));}else{_0x4ed061[_0x91f7('0x5d')]='';}return getConnection(_0x177b3b)[_0x91f7('0x23')](function(_0x49d946){_0x2be900=_0x49d946;return getUser(_0x177b3b,_0x58fda2[_0x91f7('0x60')],_0x2be900);})[_0x91f7('0x23')](function(_0x38475f){_0x668318=_0x38475f;return getEndUser(_0x177b3b,_0x5e211e,_0x4ed061[_0x91f7('0x61')],_0x4ed061[_0x91f7('0x62')],_0x2be900);})[_0x91f7('0x23')](function(_0x291dba){_0xe8e8cf=_0x291dba;return getTicket(_0x177b3b,_0x668318,_0xe8e8cf,_0x5e211e,_0x4ed061,_0x5e211e[_0x91f7('0x63')],_0x2be900,_0x91f7('0x57'));})[_0x91f7('0x23')](function(_0x181763){_0x40c648=_0x181763;logger[_0x91f7('0x26')](_0x91f7('0x64'),_0x40c648['id']);logger[_0x91f7('0x26')](_0x91f7('0x65'),_0x40c648['id'],_0x58fda2[_0x91f7('0x4f')],_0x177b3b[_0x91f7('0x3b')]);switch(_0x177b3b[_0x91f7('0x3b')]){case'integrationTab':emit(util['format'](_0x91f7('0x66'),_0x58fda2[_0x91f7('0x4f')]),_0x91f7('0x67'),{'recordId':_0x40c648['id']});break;case _0x91f7('0x68'):emit(util[_0x91f7('0x45')](_0x91f7('0x66'),_0x58fda2['name']),_0x91f7('0x69'),{'uri':util[_0x91f7('0x45')]('%s/%s/e',_0x2be900[_0x91f7('0x6a')],_0x40c648['id'])});break;default:logger[_0x91f7('0x6b')](_0x91f7('0x6c'));}})[_0x91f7('0x6d')](function(_0x11570e){logger['error'](_0x91f7('0x5b'),_0x11570e);});};exports[_0x91f7('0x6e')]=function(_0x39aaf7,_0x4f8738,_0x44cbf4,_0x13c5b9,_0x354289,_0x182300,_0x154b08){var _0x15252b,_0x313967,_0x3f95ec,_0x59c8c6;_0x182300[_0x91f7('0x58')]=intUtil[_0x91f7('0x59')](_0x182300['serverUrl']);_0x182300[_0x91f7('0x52')]=intUtil['stripTrailingSlash'](_0x182300[_0x91f7('0x52')]);if(_0x154b08&&_0x154b08[_0x91f7('0x6f')]&&_0x154b08[_0x91f7('0x6f')]!==_0x91f7('0x70')){logger[_0x91f7('0x26')]('[OUTBOUND]',_0x91f7('0x5c'));_0x4f8738[_0x91f7('0x5d')]=util[_0x91f7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x182300[_0x91f7('0x58')],_0x4f8738['uniqueid'],md5(_0x4f8738[_0x91f7('0x5f')]));}return getConnection(_0x182300)[_0x91f7('0x23')](function(_0x1cd107){_0x59c8c6=_0x1cd107;return getUser(_0x182300,_0x13c5b9[_0x91f7('0x60')],_0x59c8c6);})[_0x91f7('0x23')](function(_0x1f2238){_0x15252b=_0x1f2238;return getEndUser(_0x182300,_0x44cbf4,_0x4f8738[_0x91f7('0x71')],_0x4f8738['destcalleridnum'],_0x59c8c6);})[_0x91f7('0x23')](function(_0x30f299){_0x313967=_0x30f299;return getTicket(_0x182300,_0x15252b,_0x313967,_0x44cbf4,_0x4f8738,_0x44cbf4[_0x91f7('0x63')],_0x59c8c6,'outbound');})[_0x91f7('0x23')](function(_0x4721c5){_0x3f95ec=_0x4721c5;logger[_0x91f7('0x26')](_0x91f7('0x72'),_0x3f95ec['id']);logger[_0x91f7('0x26')](_0x91f7('0x73'),_0x3f95ec['id'],_0x13c5b9[_0x91f7('0x4f')],_0x182300[_0x91f7('0x3b')]);switch(_0x182300['type']){case _0x91f7('0x74'):emit(util[_0x91f7('0x45')](_0x91f7('0x66'),_0x13c5b9[_0x91f7('0x4f')]),_0x91f7('0x67'),{'recordId':_0x3f95ec['id']});break;case _0x91f7('0x68'):emit(util[_0x91f7('0x45')]('user:%s',_0x13c5b9[_0x91f7('0x4f')]),_0x91f7('0x69'),{'uri':util['format'](_0x91f7('0x75'),_0x59c8c6[_0x91f7('0x6a')],_0x3f95ec['id'])});break;default:logger[_0x91f7('0x6b')](_0x91f7('0x76'),_0x91f7('0x77'));}})[_0x91f7('0x6d')](function(_0x228cf8){logger['error'](_0x91f7('0x76'),_0x228cf8);});};exports[_0x91f7('0x78')]=function(_0x2bec4e,_0x12c682,_0x5dab7f,_0x41fe05,_0x3af914,_0x3f529b){var _0x3cdb6b,_0x9b88b8,_0x15c647,_0x3d3545;_0x3f529b[_0x91f7('0x58')]=intUtil['stripTrailingSlash'](_0x3f529b[_0x91f7('0x58')]);_0x3f529b[_0x91f7('0x52')]=intUtil['stripTrailingSlash'](_0x3f529b['remoteUri']);if(_0x3af914&&_0x3af914['monitor_format']){logger[_0x91f7('0x26')]('['+_0x12c682[_0x91f7('0x79')][_0x91f7('0x7a')]()+']',_0x91f7('0x5c'));_0x12c682[_0x91f7('0x5d')]=util[_0x91f7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f529b[_0x91f7('0x58')],_0x12c682['uniqueid'],md5(_0x12c682['uniqueid']));}else{_0x12c682[_0x91f7('0x5d')]='';}return getConnection(_0x3f529b)[_0x91f7('0x23')](function(_0x8b9b4b){_0x3d3545=_0x8b9b4b;if(!_[_0x91f7('0x7b')](_0x41fe05)){return getUser(_0x3f529b,_0x41fe05[_0x91f7('0x4f')],_0x3d3545);}else{return getUser(_0x3f529b,null,_0x3d3545);}})[_0x91f7('0x23')](function(_0x534d00){_0x3cdb6b=_0x534d00;return getEndUser(_0x3f529b,_0x5dab7f,_0x12c682[_0x91f7('0x61')],_0x12c682[_0x91f7('0x62')],_0x3d3545);})['then'](function(_0x3f215c){_0x9b88b8=_0x3f215c;return getTicket(_0x3f529b,_0x3cdb6b,_0x9b88b8,_0x5dab7f,_0x12c682,_0x5dab7f[_0x91f7('0x63')],_0x3d3545);})['then'](function(_0x53308a){_0x15c647=_0x53308a;logger[_0x91f7('0x26')]('['+_0x12c682['lastevent'][_0x91f7('0x7a')]()+_0x91f7('0x7c'),_0x15c647['id']);logger['info']('['+_0x12c682['lastevent'][_0x91f7('0x7a')]()+_0x91f7('0x7d'),_0x3f529b[_0x91f7('0x3b')]);})[_0x91f7('0x6d')](function(_0x22552a){logger[_0x91f7('0x6b')]('['+_0x12c682[_0x91f7('0x79')][_0x91f7('0x7a')]()+']',_0x22552a);});}; \ No newline at end of file +var _0xdde1=['recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','emit','assign','getString','Subjects','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','length','Email','info','Agent\x20%s\x20found.','resolve','user_id','display_name','identity','then','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','Account','cloneDeep','lead','account','additionalSearchAccount','Name','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','serverUrl','uniqueid','email','calleridname','Fields','integrationTab','user:%s','trigger:salesforce:display','newTab','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound'];(function(_0x3cb773,_0x3ba3b7){var _0x520be6=function(_0x5c8659){while(--_0x5c8659){_0x3cb773['push'](_0x3cb773['shift']());}};_0x520be6(++_0x3ba3b7);}(_0xdde1,0x10c));var _0x1dde=function(_0x113945,_0x102a24){_0x113945=_0x113945-0x0;var _0x5836c8=_0xdde1[_0x113945];return _0x5836c8;};'use strict';var _=require(_0x1dde('0x0'));var rp=require(_0x1dde('0x1'));var moment=require(_0x1dde('0x2'));var BPromise=require(_0x1dde('0x3'));var md5=require(_0x1dde('0x4'));var jsforce=require('jsforce');var util=require(_0x1dde('0x5'));var Redis=require(_0x1dde('0x6'));var intUtil=require(_0x1dde('0x7'));var config=require(_0x1dde('0x8'));var logger=require(_0x1dde('0x9'))(_0x1dde('0xa'));config[_0x1dde('0xb')]=_[_0x1dde('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x383377,_0x32e8d0,_0x152a56){io['to'](_0x383377)[_0x1dde('0xd')](_0x32e8d0,_0x152a56);}function getTicket(_0x34f882,_0x330dfd,_0x403a38,_0x2c936c,_0x3b9635,_0x568d88,_0xc97d56,_0x4e70b5){var _0x5646fb=Object[_0x1dde('0xe')]({},{'OwnerId':_0x330dfd['id'],'Subject':intUtil[_0x1dde('0xf')](_0x2c936c[_0x1dde('0x10')],_0x3b9635,'\x20'),'Description':intUtil[_0x1dde('0xf')](_0x2c936c['Descriptions'],_0x3b9635,'\x0a')},getCustomFields(_0x568d88,_0x3b9635));if(_0x403a38){if(_0x2c936c[_0x1dde('0x11')]==='Task'){_0x5646fb[_0x1dde('0x12')]=moment['utc']();_0x5646fb[_0x1dde('0x13')]=![];_0x5646fb[_0x1dde('0x14')]=![];if(_0x403a38[_0x1dde('0x15')]===_0x1dde('0x16')||_0x403a38[_0x1dde('0x15')]==='lead'){_0x5646fb[_0x1dde('0x17')]=_0x403a38['id'];}else if(_0x403a38[_0x1dde('0x15')]==='account'){_0x5646fb['WhatId']=_0x403a38['id'];}}else if(_0x2c936c[_0x1dde('0x11')]===_0x1dde('0x18')){if(_0x403a38[_0x1dde('0x15')]===_0x1dde('0x16')){_0x5646fb[_0x1dde('0x19')]=_0x403a38['id'];}else if(_0x403a38['endUserType']==='account'){_0x5646fb[_0x1dde('0x1a')]=_0x403a38['id'];}else if(_0x403a38[_0x1dde('0x15')]==='lead'&&_0x2c936c[_0x1dde('0x1b')]){_0x5646fb[_0x2c936c[_0x1dde('0x1b')]]=_0x403a38['id'];}else{logger['info'](_0x1dde('0x1c'));}}}return _0xc97d56['sobject'](_0x2c936c[_0x1dde('0x11')])[_0x1dde('0x1d')](_0x5646fb);}function getUser(_0xaffc6a,_0x3ecd0d,_0x5a3457){if(!_[_0x1dde('0x1e')](_0x3ecd0d)&&intUtil[_0x1dde('0x1f')](_0x3ecd0d)){var _0x2527f3={'Email':_0x3ecd0d};var _0x39cb4c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5a3457[_0x1dde('0x20')](_0x1dde('0x21'))[_0x1dde('0x22')](_0x2527f3,_0x39cb4c)['execute']()['then'](function(_0x3c7d03){if(_0x3c7d03[_0x1dde('0x23')]){var _0x1915a3=_[_0x1dde('0x22')](_0x3c7d03,function(_0x8bf88c){return _0x8bf88c[_0x1dde('0x24')]===_0x3ecd0d;});if(_0x1915a3){logger[_0x1dde('0x25')](_0x1dde('0x26'),_0x3ecd0d);return BPromise[_0x1dde('0x27')]({'id':_0x1915a3['Id'],'name':_0x1915a3['Name']});}}else{logger[_0x1dde('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3ecd0d);return _0x5a3457['identity']()['then'](function(_0x3f7452){return BPromise[_0x1dde('0x27')]({'id':_0x3f7452[_0x1dde('0x28')],'name':_0x3f7452[_0x1dde('0x29')]});});}});}else{logger[_0x1dde('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3ecd0d);return _0x5a3457[_0x1dde('0x2a')]()[_0x1dde('0x2b')](function(_0x3e1caa){return BPromise['resolve']({'id':_0x3e1caa[_0x1dde('0x28')],'name':_0x3e1caa['display_name']});});}}function getEndUser(_0x5f07e1,_0x460cac,_0x3e69f7,_0x1d4f68,_0x21627a){var _0x1383b5={'$or':{'Phone':_0x1d4f68}};var _0x14415b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1dde('0x27')]()[_0x1dde('0x2b')](function(){logger[_0x1dde('0x25')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1d4f68,_0x460cac['moduleSearch']);switch(_0x460cac[_0x1dde('0x2c')]){case _0x1dde('0x2d'):var _0x5c3b3b=_['cloneDeep'](_0x1383b5);if(_0x460cac[_0x1dde('0x2e')]){var _0xb376fb={};_0xb376fb[_0x460cac[_0x1dde('0x2e')]]=_0x1d4f68;_[_0x1dde('0x2f')](_0x5c3b3b[_0x1dde('0x30')],_0xb376fb);}return _0x21627a['sobject'](_0x1dde('0x31'))[_0x1dde('0x22')](_0x5c3b3b,_0x14415b)[_0x1dde('0x32')]()[_0x1dde('0x2b')](function(_0xf5c927){if(_0xf5c927&&_0xf5c927['length']){return _0xf5c927;}else{var _0x96742=_['cloneDeep'](_0x1383b5);if(_0x460cac[_0x1dde('0x33')]){var _0x373856={};_0x373856[_0x460cac[_0x1dde('0x33')]]=_0x1d4f68;_['merge'](_0x96742[_0x1dde('0x30')],_0x373856);}return _0x21627a[_0x1dde('0x20')](_0x1dde('0x34'))['find'](_0x96742,_0x14415b);}});case'account_contact_lead':var _0x2c9668=_['cloneDeep'](_0x1383b5);if(_0x460cac['additionalSearchAccount']){var _0xb376fb={};_0xb376fb[_0x460cac['additionalSearchAccount']]=_0x1d4f68;_[_0x1dde('0x2f')](_0x2c9668[_0x1dde('0x30')],_0xb376fb);}return _0x21627a[_0x1dde('0x20')](_0x1dde('0x35'))['find'](_0x2c9668,_0x14415b)[_0x1dde('0x32')]()[_0x1dde('0x2b')](function(_0x55f282){if(_0x55f282&&_0x55f282[_0x1dde('0x23')]){return _0x55f282;}else{var _0x536ac8=_[_0x1dde('0x36')](_0x1383b5);if(_0x460cac[_0x1dde('0x2e')]){var _0x116c5c={};_0x116c5c[_0x460cac[_0x1dde('0x2e')]]=_0x1d4f68;_['merge'](_0x536ac8[_0x1dde('0x30')],_0x116c5c);}return _0x21627a[_0x1dde('0x20')]('Contact')[_0x1dde('0x22')](_0x536ac8,_0x14415b)['then'](function(_0x3258b){if(_0x3258b&&_0x3258b['length']){return _0x3258b;}else{var _0x3c9a10=_[_0x1dde('0x36')](_0x1383b5);if(_0x460cac[_0x1dde('0x33')]){var _0x1b6398={};_0x1b6398[_0x460cac[_0x1dde('0x33')]]=_0x1d4f68;_[_0x1dde('0x2f')](_0x3c9a10['$or'],_0x1b6398);}return _0x21627a[_0x1dde('0x20')]('Lead')['find'](_0x3c9a10,_0x14415b);}});}});case _0x1dde('0x16'):var _0x5c3b3b=_[_0x1dde('0x36')](_0x1383b5);if(_0x460cac[_0x1dde('0x2e')]){var _0xb376fb={};_0xb376fb[_0x460cac[_0x1dde('0x2e')]]=_0x1d4f68;_[_0x1dde('0x2f')](_0x5c3b3b[_0x1dde('0x30')],_0xb376fb);}return _0x21627a['sobject'](_0x1dde('0x31'))[_0x1dde('0x22')](_0x5c3b3b,_0x14415b)[_0x1dde('0x32')]();case _0x1dde('0x37'):var _0x427d83=_['cloneDeep'](_0x1383b5);if(_0x460cac[_0x1dde('0x33')]){var _0xb376fb={};_0xb376fb[_0x460cac[_0x1dde('0x33')]]=_0x1d4f68;_[_0x1dde('0x2f')](_0x427d83[_0x1dde('0x30')],_0xb376fb);}return _0x21627a[_0x1dde('0x20')]('Lead')[_0x1dde('0x22')](_0x427d83,_0x14415b);case _0x1dde('0x38'):var _0x2c9668=_[_0x1dde('0x36')](_0x1383b5);if(_0x460cac[_0x1dde('0x39')]){var _0xb376fb={};_0xb376fb[_0x460cac[_0x1dde('0x39')]]=_0x1d4f68;_['merge'](_0x2c9668[_0x1dde('0x30')],_0xb376fb);}return _0x21627a['sobject']('Account')[_0x1dde('0x22')](_0x2c9668,_0x14415b);default:return null;}})[_0x1dde('0x2b')](function(_0x167f16){if(_0x167f16&&_0x167f16['length']){var _0x152ddb=_['first'](_0x167f16);if(_0x152ddb){return BPromise[_0x1dde('0x27')]({'id':_0x152ddb['Id'],'name':_0x152ddb[_0x1dde('0x3a')],'phone':_0x152ddb[_0x1dde('0x3b')],'endUserType':_0x152ddb[_0x1dde('0x3c')][_0x1dde('0x3d')]['toLowerCase']()});}}})[_0x1dde('0x2b')](function(_0x13dd52){if(_0x13dd52){logger[_0x1dde('0x25')](_0x1dde('0x3e'),_0x13dd52[_0x1dde('0x15')],_0x1d4f68);return BPromise[_0x1dde('0x27')](_0x13dd52);}else{logger[_0x1dde('0x25')](_0x1dde('0x3f'),_0x1d4f68);var _0x5b30f5={'Phone':_0x1d4f68};if(_0x460cac[_0x1dde('0x40')]){if(_0x460cac[_0x1dde('0x40')]===_0x1dde('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1d4f68,_0x460cac[_0x1dde('0x40')]);_0x5b30f5[_0x1dde('0x41')]=_0x3e69f7!==''?_0x3e69f7:util['format'](_0x1dde('0x42'),_0x1d4f68);}else if(_0x460cac['moduleCreate']==='lead'){logger[_0x1dde('0x25')](_0x1dde('0x43'),_0x1d4f68,_0x460cac[_0x1dde('0x40')]);_0x5b30f5[_0x1dde('0x41')]=_0x3e69f7!==_0x1dde('0x44')?_0x3e69f7:util['format'](_0x1dde('0x42'),_0x1d4f68);_0x5b30f5[_0x1dde('0x45')]=_0x1dde('0x46');}else if(_0x460cac[_0x1dde('0x40')]===_0x1dde('0x38')){logger[_0x1dde('0x25')](_0x1dde('0x43'),_0x1d4f68,_0x460cac['moduleCreate']);_0x5b30f5[_0x1dde('0x3a')]=_0x3e69f7!==_0x1dde('0x44')?_0x3e69f7:util['format'](_0x1dde('0x42'),_0x1d4f68);}else{return null;}}return _0x21627a[_0x1dde('0x20')](_[_0x1dde('0x47')](_0x460cac['moduleCreate']))[_0x1dde('0x1d')](_0x5b30f5)[_0x1dde('0x2b')](function(_0x4af091){return BPromise[_0x1dde('0x27')]({'id':_0x4af091['id'],'endUserType':_0x460cac[_0x1dde('0x40')]});});}});}function getCustomFields(_0x4cf954,_0x5ec036){var _0x5a2564={};if(_0x4cf954[_0x1dde('0x23')]>0x0){_[_0x1dde('0x48')](_0x4cf954,function(_0x3690ba){if(_['includes']([_0x1dde('0x49'),_0x1dde('0x4a')],_0x3690ba[_0x1dde('0x3d')])&&_0x3690ba[_0x1dde('0x4b')]){_0x5a2564[_0x3690ba['idField']]=_0x3690ba['content']['toString']();}else if(_0x3690ba['type']===_0x1dde('0x4c')&&_0x3690ba[_0x1dde('0x4d')]&&_0x3690ba[_0x1dde('0x4b')]){_0x5ec036[_0x3690ba[_0x1dde('0x4d')]]&&(_0x5a2564[_0x3690ba[_0x1dde('0x4b')]]=_0x5ec036[_0x3690ba[_0x1dde('0x4d')]][_0x1dde('0x4e')]());}else if(_0x3690ba[_0x1dde('0x3d')]===_0x1dde('0x4f')&&_0x3690ba[_0x1dde('0x50')]&&_0x3690ba['Variable'][_0x1dde('0x51')]&&_0x3690ba[_0x1dde('0x4b')]){_0x5ec036[_0x3690ba['Variable'][_0x1dde('0x51')][_0x1dde('0x52')]()]&&(_0x5a2564[_0x3690ba[_0x1dde('0x4b')]]=_0x5ec036[_0x3690ba[_0x1dde('0x50')][_0x1dde('0x51')][_0x1dde('0x52')]()][_0x1dde('0x4e')]());}});}return _0x5a2564;}function getConnection(_0x4b4d9b){var _0x462b44=_0x4b4d9b[_0x1dde('0x53')][_0x1dde('0x54')](_0x4b4d9b[_0x1dde('0x55')]);var _0x493158=new jsforce[(_0x1dde('0x56'))]({'oauth2':{'loginUrl':_0x4b4d9b[_0x1dde('0x57')]||_0x1dde('0x58'),'clientId':_0x4b4d9b['clientId'],'clientSecret':_0x4b4d9b[_0x1dde('0x59')]}});return _0x493158['login'](_0x4b4d9b[_0x1dde('0x5a')],_0x462b44)['then'](function(){logger[_0x1dde('0x25')]('Connection\x20established.');return _0x493158;});}exports[_0x1dde('0x5b')]=function(_0x4a3637,_0x33fe19,_0xc07365,_0x1cf222,_0x1d51fc,_0x1d30c4){var _0x5596ed,_0x529e42,_0x5b04a1,_0x41303c;_0x1d30c4['serverUrl']=intUtil['stripTrailingSlash'](_0x1d30c4['serverUrl']);_0x1d30c4[_0x1dde('0x57')]=intUtil[_0x1dde('0x5c')](_0x1d30c4[_0x1dde('0x57')]);if(_0x1d51fc&&_0x1d51fc[_0x1dde('0x5d')]){logger[_0x1dde('0x25')]('[QUEUE]',_0x1dde('0x5e'));_0x33fe19[_0x1dde('0x5f')]=util[_0x1dde('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d30c4[_0x1dde('0x61')],_0x33fe19['uniqueid'],md5(_0x33fe19[_0x1dde('0x62')]));}else{_0x33fe19[_0x1dde('0x5f')]='';}return getConnection(_0x1d30c4)[_0x1dde('0x2b')](function(_0x2881f6){_0x41303c=_0x2881f6;return getUser(_0x1d30c4,_0x1cf222[_0x1dde('0x63')],_0x41303c);})['then'](function(_0x236e7b){_0x5596ed=_0x236e7b;return getEndUser(_0x1d30c4,_0xc07365,_0x33fe19[_0x1dde('0x64')],_0x33fe19['calleridnum'],_0x41303c);})['then'](function(_0xf60c2d){_0x529e42=_0xf60c2d;return getTicket(_0x1d30c4,_0x5596ed,_0x529e42,_0xc07365,_0x33fe19,_0xc07365[_0x1dde('0x65')],_0x41303c,_0x1dde('0x5b'));})[_0x1dde('0x2b')](function(_0x535234){_0x5b04a1=_0x535234;logger[_0x1dde('0x25')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5b04a1['id']);logger[_0x1dde('0x25')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5b04a1['id'],_0x1cf222['name'],_0x1d30c4[_0x1dde('0x3d')]);switch(_0x1d30c4[_0x1dde('0x3d')]){case _0x1dde('0x66'):emit(util['format'](_0x1dde('0x67'),_0x1cf222[_0x1dde('0x51')]),_0x1dde('0x68'),{'recordId':_0x5b04a1['id']});break;case _0x1dde('0x69'):emit(util[_0x1dde('0x60')](_0x1dde('0x67'),_0x1cf222['name']),'trigger:browser:url',{'uri':util[_0x1dde('0x60')]('%s/%s/e',_0x41303c['instanceUrl'],_0x5b04a1['id'])});break;default:logger[_0x1dde('0x6a')](_0x1dde('0x6b'));}})['catch'](function(_0x14cdea){logger[_0x1dde('0x6a')](_0x1dde('0x6c'),_0x14cdea);});};exports[_0x1dde('0x6d')]=function(_0x39c20a,_0x3d3ce7,_0x477ab1,_0x5aa3cd,_0x53035c,_0xc5407b,_0x3c2fe0){var _0x4ffb3d,_0xadeb55,_0x1dd069,_0x5e1cac;_0xc5407b[_0x1dde('0x61')]=intUtil[_0x1dde('0x5c')](_0xc5407b[_0x1dde('0x61')]);_0xc5407b[_0x1dde('0x57')]=intUtil[_0x1dde('0x5c')](_0xc5407b['remoteUri']);if(_0x3c2fe0&&_0x3c2fe0[_0x1dde('0x6e')]&&_0x3c2fe0[_0x1dde('0x6e')]!==_0x1dde('0x6f')){logger[_0x1dde('0x25')]('[OUTBOUND]',_0x1dde('0x5e'));_0x3d3ce7[_0x1dde('0x5f')]=util[_0x1dde('0x60')](_0x1dde('0x70'),_0xc5407b[_0x1dde('0x61')],_0x3d3ce7['uniqueid'],md5(_0x3d3ce7[_0x1dde('0x62')]));}return getConnection(_0xc5407b)[_0x1dde('0x2b')](function(_0x380de5){_0x5e1cac=_0x380de5;return getUser(_0xc5407b,_0x5aa3cd[_0x1dde('0x63')],_0x5e1cac);})[_0x1dde('0x2b')](function(_0x2b445a){_0x4ffb3d=_0x2b445a;return getEndUser(_0xc5407b,_0x477ab1,_0x3d3ce7['destcalleridname'],_0x3d3ce7[_0x1dde('0x71')],_0x5e1cac);})['then'](function(_0x3eb42e){_0xadeb55=_0x3eb42e;return getTicket(_0xc5407b,_0x4ffb3d,_0xadeb55,_0x477ab1,_0x3d3ce7,_0x477ab1[_0x1dde('0x65')],_0x5e1cac,'outbound');})[_0x1dde('0x2b')](function(_0x51139a){_0x1dd069=_0x51139a;logger[_0x1dde('0x25')](_0x1dde('0x72'),_0x1dd069['id']);logger[_0x1dde('0x25')](_0x1dde('0x73'),_0x1dd069['id'],_0x5aa3cd['name'],_0xc5407b[_0x1dde('0x3d')]);switch(_0xc5407b[_0x1dde('0x3d')]){case _0x1dde('0x66'):emit(util[_0x1dde('0x60')](_0x1dde('0x67'),_0x5aa3cd[_0x1dde('0x51')]),'trigger:salesforce:display',{'recordId':_0x1dd069['id']});break;case _0x1dde('0x69'):emit(util['format'](_0x1dde('0x67'),_0x5aa3cd[_0x1dde('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x1dde('0x74'),_0x5e1cac[_0x1dde('0x75')],_0x1dd069['id'])});break;default:logger['error']('[OUTBOUND]',_0x1dde('0x76'));}})[_0x1dde('0x77')](function(_0xa71ebd){logger['error']('[OUTBOUND]',_0xa71ebd);});};exports[_0x1dde('0x78')]=function(_0xb8ffee,_0x348847,_0x9e1180,_0xecb94c,_0xa849fb,_0x542fe0){var _0x35b6f7,_0x1a0671,_0x1e8e30,_0x1efa1d;_0x542fe0[_0x1dde('0x61')]=intUtil['stripTrailingSlash'](_0x542fe0[_0x1dde('0x61')]);_0x542fe0[_0x1dde('0x57')]=intUtil['stripTrailingSlash'](_0x542fe0[_0x1dde('0x57')]);if(_0xa849fb&&_0xa849fb[_0x1dde('0x5d')]){logger[_0x1dde('0x25')]('['+_0x348847[_0x1dde('0x79')]['toUpperCase']()+']',_0x1dde('0x5e'));_0x348847[_0x1dde('0x5f')]=util[_0x1dde('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x542fe0[_0x1dde('0x61')],_0x348847[_0x1dde('0x62')],md5(_0x348847[_0x1dde('0x62')]));}else{_0x348847[_0x1dde('0x5f')]='';}return getConnection(_0x542fe0)[_0x1dde('0x2b')](function(_0x21068a){_0x1efa1d=_0x21068a;if(!_[_0x1dde('0x1e')](_0xecb94c)){return getUser(_0x542fe0,_0xecb94c[_0x1dde('0x51')],_0x1efa1d);}else{return getUser(_0x542fe0,null,_0x1efa1d);}})['then'](function(_0x1f05c9){_0x35b6f7=_0x1f05c9;return getEndUser(_0x542fe0,_0x9e1180,_0x348847['calleridname'],_0x348847[_0x1dde('0x7a')],_0x1efa1d);})[_0x1dde('0x2b')](function(_0x5e7623){_0x1a0671=_0x5e7623;return getTicket(_0x542fe0,_0x35b6f7,_0x1a0671,_0x9e1180,_0x348847,_0x9e1180[_0x1dde('0x65')],_0x1efa1d);})['then'](function(_0x4a1738){_0x1e8e30=_0x4a1738;logger[_0x1dde('0x25')]('['+_0x348847['lastevent'][_0x1dde('0x7b')]()+_0x1dde('0x7c'),_0x1e8e30['id']);logger[_0x1dde('0x25')]('['+_0x348847['lastevent'][_0x1dde('0x7b')]()+_0x1dde('0x7d'),_0x542fe0[_0x1dde('0x3d')]);})[_0x1dde('0x77')](function(_0x2bbc5d){logger['error']('['+_0x348847[_0x1dde('0x79')]['toUpperCase']()+']',_0x2bbc5d);});}; \ 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 49b7ae3..953e53f 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 _0x0077=['includes','idField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','format','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString'];(function(_0x4bddef,_0x4b34f1){var _0x570ced=function(_0x19941d){while(--_0x19941d){_0x4bddef['push'](_0x4bddef['shift']());}};_0x570ced(++_0x4b34f1);}(_0x0077,0x16b));var _0x7007=function(_0x4a5939,_0x3e370d){_0x4a5939=_0x4a5939-0x0;var _0x118f42=_0x0077[_0x4a5939];return _0x118f42;};'use strict';var _=require(_0x7007('0x0'));var Promise=require('bluebird');var rp=require(_0x7007('0x1'));var util=require('util');var md5=require(_0x7007('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7007('0x3'));var config=require(_0x7007('0x4'));var logger=require(_0x7007('0x5'))('servicenow');config[_0x7007('0x6')]=_[_0x7007('0x7')](config[_0x7007('0x6')],{'host':_0x7007('0x8'),'port':0x18eb});var io=require(_0x7007('0x9'))(new Redis(config[_0x7007('0x6')]));function getAdminUser(_0x33e0c4,_0x31636a,_0x500afc,_0xb5ec0a,_0x3699ec,_0x144765){return new Promise(function(_0x290041,_0x467654){var _0x1da6a6={'method':_0x7007('0xa'),'uri':_0xb5ec0a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3699ec+'&'+_0x144765,'auth':_0x31636a,'json':!![]};return rp(_0x1da6a6)[_0x7007('0xb')](function(_0x29dd04){if(_0x29dd04[_0x7007('0xc')][_0x7007('0xd')]>0x0){_0x500afc['adminId']=_0x29dd04[_0x7007('0xc')][0x0][_0x7007('0xe')];}logger[_0x7007('0xf')]('['+[_0x33e0c4['toUpperCase']()]+_0x7007('0x10'),_0x500afc);_0x290041(_0x500afc);})[_0x7007('0x11')](function(_0x593135){logger[_0x7007('0x12')]('['+[_0x33e0c4[_0x7007('0x13')]()]+']',_0x593135['message']);_0x467654(_0x593135[_0x7007('0x14')]);});});}function getUser(_0x545fb9,_0x4fe9b6,_0x32b21a,_0x21d1b4,_0x34e5fc){return function(_0x34f4f1){logger[_0x7007('0xf')]('['+[_0x545fb9[_0x7007('0x13')]()]+_0x7007('0x15'),_0x34f4f1);return new Promise(function(_0x3429cb,_0x4cb79e){if(intUtil[_0x7007('0x16')](_0x34f4f1[_0x7007('0x17')])){var _0x123c5f={'method':_0x7007('0xa'),'uri':_0x32b21a+_0x7007('0x18')+_0x34f4f1[_0x7007('0x17')]+'&'+_0x21d1b4+'&'+_0x34e5fc,'auth':_0x4fe9b6,'json':!![]};logger[_0x7007('0xf')]('['+[_0x545fb9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x123c5f);return rp(_0x123c5f)[_0x7007('0xb')](function(_0x1d2f73){logger['info']('['+[_0x545fb9[_0x7007('0x13')]()]+_0x7007('0x19'),_0x1d2f73);if(_0x1d2f73[_0x7007('0xc')][_0x7007('0xd')]>0x0&&String(_0x1d2f73[_0x7007('0xc')][0x0][_0x7007('0x1a')])==='true'){_0x34f4f1[_0x7007('0x1b')]=_0x1d2f73['result'][0x0][_0x7007('0xe')];}else{_0x34f4f1[_0x7007('0x1b')]=_0x34f4f1[_0x7007('0x1c')];_0x34f4f1['userEmail']=_0x34f4f1[_0x7007('0x1d')];}logger[_0x7007('0xf')]('['+[_0x545fb9['toUpperCase']()]+_0x7007('0x1e'),_0x34f4f1);_0x3429cb(_0x34f4f1);})[_0x7007('0x11')](function(_0x122672){logger[_0x7007('0x12')]('['+[_0x545fb9[_0x7007('0x13')]()]+']',_0x122672[_0x7007('0x14')]);_0x4cb79e(_0x122672[_0x7007('0x14')]);});}else{logger['info']('['+[_0x545fb9[_0x7007('0x13')]()]+']\x20using\x20admin\x20profile');_0x34f4f1['userId']=_0x34f4f1[_0x7007('0x1c')];_0x34f4f1['userEmail']=_0x34f4f1[_0x7007('0x1d')];_0x3429cb(_0x34f4f1);}});};}function createEndUser(_0x4c6187,_0x40f984,_0x1ca8d1,_0x2d763e,_0x21a819){logger[_0x7007('0xf')]('['+[_0x4c6187[_0x7007('0x13')]()]+_0x7007('0x1f'),_0x1ca8d1);return new Promise(function(_0x2ec9ad,_0x6efe5a){var _0x1c3263={'method':_0x7007('0x20'),'uri':_0x2d763e+_0x7007('0x21')+_0x21a819,'body':{'user_name':_0x1ca8d1[_0x7007('0x22')],'roles':_0x7007('0x23'),'first_name':_0x1ca8d1['endUserNumber'],'active':_0x7007('0x24'),'date_format':_0x7007('0x25'),'phone':_0x1ca8d1[_0x7007('0x22')]},'auth':_0x40f984,'json':!![]};return rp(_0x1c3263)[_0x7007('0xb')](function(_0x2a0897){logger[_0x7007('0xf')]('['+[_0x4c6187[_0x7007('0x13')]()]+_0x7007('0x26'),_0x2a0897['result']);_0x1ca8d1['endUserId']=_0x2a0897[_0x7007('0xc')]['sys_id'];_0x2ec9ad(_0x1ca8d1);})[_0x7007('0x11')](function(_0x3fe2df){logger[_0x7007('0x12')]('['+[_0x4c6187['toUpperCase']()]+']',_0x3fe2df[_0x7007('0x14')]);_0x6efe5a(_0x3fe2df['message']);});});}function getEndUser(_0x2844f5,_0x1f76da,_0x43447b,_0x417db9,_0x2928c0){return function(_0x342e0a){logger[_0x7007('0xf')]('['+[_0x2844f5[_0x7007('0x13')]()]+_0x7007('0x27'),_0x342e0a);return new Promise(function(_0x5bcaeb,_0x30810c){var _0x1f31d9={'method':'GET','uri':_0x43447b+'sys_user?sysparm_query=phone%3D'+_0x342e0a[_0x7007('0x22')]+'&'+_0x417db9+'&'+_0x2928c0,'auth':_0x1f76da,'json':!![]};return rp(_0x1f31d9)[_0x7007('0xb')](function(_0x1ba447){if(_0x1ba447[_0x7007('0xc')][_0x7007('0xd')]>0x0){_0x342e0a['endUserId']=_0x1ba447[_0x7007('0xc')][0x0][_0x7007('0xe')];logger[_0x7007('0xf')]('['+[_0x2844f5[_0x7007('0x13')]()]+'],\x20getEndUser\x20crm',_0x342e0a);_0x5bcaeb(_0x342e0a);}else{return createEndUser(_0x2844f5,_0x1f76da,_0x342e0a,_0x43447b,_0x417db9)['then'](function(_0x4c91c2){logger[_0x7007('0xf')]('['+[_0x2844f5['toUpperCase']()]+_0x7007('0x28'),_0x4c91c2);_0x5bcaeb(_0x4c91c2);});}})[_0x7007('0x11')](function(_0x49661d){logger[_0x7007('0x12')]('['+[_0x2844f5[_0x7007('0x13')]()]+']',_0x49661d[_0x7007('0x14')]);_0x30810c(_0x49661d['message']);});});};}function getCustomFields(_0x3763ce,_0x14efbd){var _0x13aec8={};if(_0x3763ce[_0x7007('0xd')]>0x0){_['forEach'](_0x3763ce,function(_0x269e9f){if(_['includes']([_0x7007('0x29'),_0x7007('0x2a')],_0x269e9f[_0x7007('0x2b')])&&_0x269e9f[_0x7007('0x2c')]&&!_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x2c')][_0x7007('0x2e')]()]=_0x269e9f[_0x7007('0x2f')][_0x7007('0x30')]();}else if(_[_0x7007('0x31')]([_0x7007('0x29'),_0x7007('0x2a')],_0x269e9f[_0x7007('0x2b')])&&_0x269e9f[_0x7007('0x32')]&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x32')]['toLowerCase']()]=_0x269e9f[_0x7007('0x2f')][_0x7007('0x30')]();}else if(_0x269e9f['type']==='variable'&&_0x269e9f['variableName']&&_0x269e9f[_0x7007('0x32')]&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f['idField'][_0x7007('0x2e')]()]=_0x14efbd[_0x269e9f['variableName']][_0x7007('0x30')]();}else if(_0x269e9f[_0x7007('0x2b')]==='customVariable'&&_0x269e9f['Variable']&&_0x269e9f[_0x7007('0x33')]['name']&&_0x269e9f['idField']&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x32')][_0x7007('0x2e')]()]=_0x14efbd[_0x269e9f[_0x7007('0x33')][_0x7007('0x34')]['toLowerCase']()][_0x7007('0x30')]();}});}return _0x13aec8;}function getTicket(_0x5c895c,_0x225a25,_0x228d6b,_0x50f6df,_0x4d51aa,_0x4cecf0){return function(_0x24de9f){logger[_0x7007('0xf')]('['+[_0x5c895c[_0x7007('0x13')]()]+_0x7007('0x35'),_0x24de9f);return new Promise(function(_0x1b073e,_0x48e36d){var _0x12dbfb=_0x5c895c[_0x7007('0x2e')]()===_0x7007('0x36')?_0x24de9f[_0x7007('0x1b')]:_0x24de9f[_0x7007('0x37')];var _0x1476a2={'method':_0x7007('0x20'),'uri':_0x228d6b+_0x7007('0x38')+'?'+_0x4cecf0,'body':Object[_0x7007('0x39')]({},{'active':_0x7007('0x24'),'caller_id':_0x12dbfb,'assigned_to':_0x24de9f[_0x7007('0x1b')],'short_description':intUtil[_0x7007('0x3a')](_0x50f6df[_0x7007('0x3b')],_0x4d51aa,'\x20'),'description':intUtil['getString'](_0x50f6df['Descriptions'],_0x4d51aa,'\x0a')},getCustomFields(_0x50f6df[_0x7007('0x3c')],_0x4d51aa)),'auth':_0x225a25,'json':!![]};return rp(_0x1476a2)[_0x7007('0xb')](function(_0x1008c0){logger[_0x7007('0xf')]('['+[_0x5c895c[_0x7007('0x13')]()]+_0x7007('0x3d'),_0x1008c0[_0x7007('0xc')]);_0x24de9f['ticketId']=_0x1008c0[_0x7007('0xc')][_0x7007('0xe')];_0x24de9f[_0x7007('0x3e')]=_0x1008c0['result'][_0x7007('0x3f')];logger[_0x7007('0xf')]('['+[_0x5c895c['toUpperCase']()]+_0x7007('0x40'),_0x24de9f);_0x1b073e(_0x24de9f);})[_0x7007('0x11')](function(_0x442141){logger[_0x7007('0x12')]('['+[_0x5c895c[_0x7007('0x13')]()]+']',_0x442141[_0x7007('0x14')]);_0x48e36d(_0x442141[_0x7007('0x14')]);});});};}function createRemoteTag(_0x2fe269,_0x3bef72,_0x942e18,_0x3c4aed){return new Promise(function(_0x486fc2,_0x48be12){var _0x5a268a={'method':_0x7007('0x20'),'uri':_0x942e18+_0x7007('0x41')+'?'+_0x3c4aed,'body':{'short_description':_0x2fe269,'global':!![],'active':!![],'name':_0x2fe269},'auth':_0x3bef72,'json':!![]};return rp(_0x5a268a)[_0x7007('0xb')](function(_0x1e4b1f){var _0x3f2370=_0x1e4b1f['result'][_0x7007('0xe')];_0x486fc2(_0x3f2370);});});}function getRemoteTag(_0x2ea974,_0x2fa411,_0x37b345,_0x4e94eb,_0x5bd079){return new Promise(function(_0x20b01f,_0x1999a1){var _0x660dcc={'method':_0x7007('0xa'),'uri':_0x37b345+_0x7007('0x41')+'?sysparm_query=name%3D'+_0x2ea974+'&'+_0x4e94eb,'auth':_0x2fa411,'json':!![]};return rp(_0x660dcc)['then'](function(_0x2a3f4a){if(_0x2a3f4a[_0x7007('0xc')][_0x7007('0xd')]>0x0){var _0x1e873c=_0x2a3f4a[_0x7007('0xc')][0x0][_0x7007('0xe')];_0x20b01f(_0x1e873c);}else{return createRemoteTag(_0x2ea974,_0x2fa411,_0x37b345,_0x4e94eb)[_0x7007('0xb')](function(_0x77f40b){_0x20b01f(_0x77f40b);});}});});}function assignTagToIncident(_0x492be3,_0x3a16df,_0x1be342,_0x6b8e36,_0x2f895c){return new Promise(function(_0xf34cf,_0x3181b0){var _0x3dfbfb={'method':_0x7007('0x20'),'uri':_0x1be342+'label_entry'+'?'+_0x2f895c,'body':{'label':_0x492be3,'table':_0x7007('0x38'),'id_type':_0x7007('0x42'),'table_key':_0x6b8e36[_0x7007('0x43')],'title':_0x7007('0x44')+_0x6b8e36[_0x7007('0x3e')],'id_display':_0x6b8e36[_0x7007('0x3e')]},'auth':_0x3a16df,'json':!![]};return rp(_0x3dfbfb)[_0x7007('0xb')](function(_0x14d9da){_0xf34cf();})[_0x7007('0x11')](function(){_0xf34cf();});});}function manageTags(_0x39dbe6,_0x149e19,_0x51e136,_0x430421,_0x56af2b,_0x200986,_0x2ace9a){return new Promise(function(_0x45742c,_0x5bd7f8){var _0x55f0ef=[];_0x149e19['forEach'](function(_0x45b96e){_0x55f0ef[_0x7007('0x45')](getRemoteTag(_0x45b96e,_0x51e136,_0x430421,_0x200986,_0x2ace9a));});return Promise['all'](_0x55f0ef)['then'](function(_0x288d9d){if(_0x288d9d[_0x7007('0xd')]){logger[_0x7007('0xf')]('['+[_0x39dbe6[_0x7007('0x13')]()]+_0x7007('0x46'),_0x288d9d);var _0x23c598=[];_0x288d9d[_0x7007('0x47')](function(_0x582584){_0x23c598[_0x7007('0x45')](assignTagToIncident(_0x582584,_0x51e136,_0x430421,_0x56af2b,_0x200986));});return Promise[_0x7007('0x48')](_0x23c598)[_0x7007('0xb')](function(){_0x45742c();})[_0x7007('0x11')](function(){_0x45742c();});}else{_0x45742c();}});});}function getTags(_0x44997e,_0x599513,_0x4e3bf8,_0x59edb5,_0x5cb568,_0xd01633){return function(_0x49ac3d){return new Promise(function(_0x25e7db,_0x52db6f){var _0x588531=[];var _0x36e648=_0x59edb5[_0x7007('0x49')];if(_0x36e648&&_0x36e648[_0x7007('0xd')]>0x0){_0x588531=_[_0x7007('0x4a')](_0x36e648,'name');}if(_0x588531[_0x7007('0xd')]>0x0){return manageTags(_0x44997e,_0x588531,_0x599513,_0x4e3bf8,_0x49ac3d,_0x5cb568,_0xd01633)[_0x7007('0xb')](function(){_0x25e7db(_0x49ac3d);});}else{_0x25e7db(_0x49ac3d);}});};}function emit(_0x3b81b0,_0x2e5b42,_0x17a0c1){var _0x5120d2=_0x7007('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7007('0x4c')+_0x7007('0x4d');var _0x95b754={'uri':_0x3b81b0+_0x7007('0x4e')+_0x17a0c1+_0x5120d2};io['to'](util['format'](_0x7007('0x4f'),_0x2e5b42))['emit'](_0x7007('0x50'),_0x95b754);}exports['cs']=function(_0xbce6ac,_0x568fca,_0x4c1488,_0x64ca2,_0x39ef0b,_0x4e8ca9,_0x38f539,_0x26521e){var _0x9d7674={};var _0x4883f1={'user':_0x4e8ca9[_0x7007('0x51')],'pass':_0x4e8ca9[_0x7007('0x52')]};var _0x5bb92f='sysparm_limit=1';var _0x1704d1=_0x7007('0x53');_0x4e8ca9[_0x7007('0x54')]=intUtil[_0x7007('0x55')](_0x4e8ca9[_0x7007('0x54')]);_0x4e8ca9['serverUrl']=intUtil['stripTrailingSlash'](_0x4e8ca9['serverUrl']);var _0x33ca9e=util[_0x7007('0x56')]('%s/api/now/table/',_0x4e8ca9[_0x7007('0x54')]);_0x9d7674['userEmail']=!_['isNil'](_0x64ca2)?_0x64ca2['email']:null;_0x9d7674[_0x7007('0x1d')]=_0x4e8ca9[_0x7007('0x57')];_0x9d7674[_0x7007('0x22')]=_0x26521e['toLowerCase']()==='outbound'?_0x568fca['destcalleridnum']:_0x568fca[_0x7007('0x58')];_0x9d7674[_0x7007('0x59')]=_0x26521e===_0x7007('0x5a')||_0x26521e===_0x7007('0x5b')?_0x7007('0x5a'):_0x7007('0x36');var _0x2a5d8c=util[_0x7007('0x56')](_0x7007('0x5c'),_0x4e8ca9[_0x7007('0x5d')],_0x568fca[_0x7007('0x5e')],md5(_0x568fca[_0x7007('0x5e')]));if(_0x39ef0b&&_0x39ef0b['monitor_format']){logger[_0x7007('0xf')]('[QUEUE]',_0x7007('0x5f'));_0x568fca['recordingURL']=_0x2a5d8c;}else if(_0x38f539&&_0x38f539[_0x7007('0x60')]&&_0x38f539['recordingFormat']!==_0x7007('0x61')){logger[_0x7007('0xf')](_0x7007('0x62'),_0x7007('0x5f'));_0x568fca[_0x7007('0x63')]=_0x2a5d8c;}else{_0x568fca[_0x7007('0x63')]='';}return getAdminUser(_0x26521e,_0x4883f1,_0x9d7674,_0x33ca9e,_0x1704d1,_0x5bb92f)[_0x7007('0xb')](getUser(_0x26521e,_0x4883f1,_0x33ca9e,_0x1704d1,_0x5bb92f))[_0x7007('0xb')](getEndUser(_0x26521e,_0x4883f1,_0x33ca9e,_0x1704d1,_0x5bb92f))[_0x7007('0xb')](getTicket(_0x26521e,_0x4883f1,_0x33ca9e,_0x4c1488,_0x568fca,_0x1704d1))[_0x7007('0xb')](function(_0x3c5fb0){logger[_0x7007('0xf')](util['format'](_0x7007('0x64'),_0x3c5fb0[_0x7007('0x43')]));logger[_0x7007('0xf')](util['format'](_0x7007('0x65'),_0x26521e));if(_0x26521e!==_0x7007('0x5b')){logger[_0x7007('0xf')]('['+[_0x26521e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4e8ca9[_0x7007('0x54')],_0x64ca2['name'],_0x3c5fb0[_0x7007('0x43')]);}})[_0x7007('0x11')](function(_0x31d9a0){logger[_0x7007('0x12')]('['+[_0x26521e[_0x7007('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x7007('0x66')](_0x31d9a0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x546c=['getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','active','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','type','customField','toLowerCase','content','toString','picklist','idField','variable','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','Subjects'];(function(_0x2487c0,_0x22b578){var _0x1564bd=function(_0x39d687){while(--_0x39d687){_0x2487c0['push'](_0x2487c0['shift']());}};_0x1564bd(++_0x22b578);}(_0x546c,0x1c9));var _0xc546=function(_0x2a484f,_0x547207){_0x2a484f=_0x2a484f-0x0;var _0x345763=_0x546c[_0x2a484f];return _0x345763;};'use strict';var _=require(_0xc546('0x0'));var Promise=require(_0xc546('0x1'));var rp=require(_0xc546('0x2'));var util=require(_0xc546('0x3'));var md5=require(_0xc546('0x4'));var Redis=require(_0xc546('0x5'));var intUtil=require(_0xc546('0x6'));var config=require(_0xc546('0x7'));var logger=require(_0xc546('0x8'))(_0xc546('0x9'));config[_0xc546('0xa')]=_['defaults'](config[_0xc546('0xa')],{'host':_0xc546('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x13cb23,_0x3ebd8c,_0x442033,_0x50e7ee,_0x46a3e7,_0x192667){return new Promise(function(_0x55dc6f,_0x5cfa47){var _0x60d0d5={'method':_0xc546('0xc'),'uri':_0x50e7ee+_0xc546('0xd')+'&'+_0x46a3e7+'&'+_0x192667,'auth':_0x3ebd8c,'json':!![]};return rp(_0x60d0d5)[_0xc546('0xe')](function(_0x5c95fd){if(_0x5c95fd[_0xc546('0xf')][_0xc546('0x10')]>0x0){_0x442033[_0xc546('0x11')]=_0x5c95fd[_0xc546('0xf')][0x0][_0xc546('0x12')];}logger[_0xc546('0x13')]('['+[_0x13cb23['toUpperCase']()]+_0xc546('0x14'),_0x442033);_0x55dc6f(_0x442033);})['catch'](function(_0x4f4014){logger[_0xc546('0x15')]('['+[_0x13cb23[_0xc546('0x16')]()]+']',_0x4f4014[_0xc546('0x17')]);_0x5cfa47(_0x4f4014[_0xc546('0x17')]);});});}function getUser(_0x282b95,_0x51e584,_0x35d037,_0x45e5b5,_0x3d5eb9){return function(_0x407d65){logger[_0xc546('0x13')]('['+[_0x282b95[_0xc546('0x16')]()]+_0xc546('0x18'),_0x407d65);return new Promise(function(_0x2ef4bd,_0x52a204){if(intUtil[_0xc546('0x19')](_0x407d65[_0xc546('0x1a')])){var _0x25efa5={'method':_0xc546('0xc'),'uri':_0x35d037+_0xc546('0x1b')+_0x407d65[_0xc546('0x1a')]+'&'+_0x45e5b5+'&'+_0x3d5eb9,'auth':_0x51e584,'json':!![]};logger['info']('['+[_0x282b95[_0xc546('0x16')]()]+'],\x20getUser\x20rp\x20obj',_0x25efa5);return rp(_0x25efa5)['then'](function(_0x373b31){logger[_0xc546('0x13')]('['+[_0x282b95['toUpperCase']()]+'],\x20getUser\x20entity',_0x373b31);if(_0x373b31['result']['length']>0x0&&String(_0x373b31[_0xc546('0xf')][0x0][_0xc546('0x1c')])==='true'){_0x407d65[_0xc546('0x1d')]=_0x373b31[_0xc546('0xf')][0x0][_0xc546('0x12')];}else{_0x407d65[_0xc546('0x1d')]=_0x407d65[_0xc546('0x11')];_0x407d65['userEmail']=_0x407d65[_0xc546('0x1e')];}logger[_0xc546('0x13')]('['+[_0x282b95[_0xc546('0x16')]()]+_0xc546('0x1f'),_0x407d65);_0x2ef4bd(_0x407d65);})[_0xc546('0x20')](function(_0x34400d){logger[_0xc546('0x15')]('['+[_0x282b95[_0xc546('0x16')]()]+']',_0x34400d[_0xc546('0x17')]);_0x52a204(_0x34400d[_0xc546('0x17')]);});}else{logger[_0xc546('0x13')]('['+[_0x282b95[_0xc546('0x16')]()]+']\x20using\x20admin\x20profile');_0x407d65[_0xc546('0x1d')]=_0x407d65[_0xc546('0x11')];_0x407d65[_0xc546('0x1a')]=_0x407d65['adminEmail'];_0x2ef4bd(_0x407d65);}});};}function createEndUser(_0x2cd2f6,_0x5b8054,_0x2323ed,_0x3bb0e0,_0x4e11d6){logger[_0xc546('0x13')]('['+[_0x2cd2f6[_0xc546('0x16')]()]+_0xc546('0x21'),_0x2323ed);return new Promise(function(_0x5addb8,_0xf6883b){var _0x3509a5={'method':_0xc546('0x22'),'uri':_0x3bb0e0+'sys_user?'+_0x4e11d6,'body':{'user_name':_0x2323ed[_0xc546('0x23')],'roles':_0xc546('0x24'),'first_name':_0x2323ed['endUserNumber'],'active':_0xc546('0x25'),'date_format':'System','phone':_0x2323ed[_0xc546('0x23')]},'auth':_0x5b8054,'json':!![]};return rp(_0x3509a5)[_0xc546('0xe')](function(_0x738bb9){logger[_0xc546('0x13')]('['+[_0x2cd2f6[_0xc546('0x16')]()]+_0xc546('0x26'),_0x738bb9[_0xc546('0xf')]);_0x2323ed[_0xc546('0x27')]=_0x738bb9[_0xc546('0xf')]['sys_id'];_0x5addb8(_0x2323ed);})[_0xc546('0x20')](function(_0x459fb0){logger[_0xc546('0x15')]('['+[_0x2cd2f6[_0xc546('0x16')]()]+']',_0x459fb0[_0xc546('0x17')]);_0xf6883b(_0x459fb0[_0xc546('0x17')]);});});}function getEndUser(_0x39029d,_0x2e091a,_0x4c575f,_0x4a8452,_0x257c2f){return function(_0x5f1c6d){logger[_0xc546('0x13')]('['+[_0x39029d['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x5f1c6d);return new Promise(function(_0x583f3e,_0x28e1a9){var _0x267d10={'method':'GET','uri':_0x4c575f+'sys_user?sysparm_query=phone%3D'+_0x5f1c6d[_0xc546('0x23')]+'&'+_0x4a8452+'&'+_0x257c2f,'auth':_0x2e091a,'json':!![]};return rp(_0x267d10)[_0xc546('0xe')](function(_0x20b677){if(_0x20b677[_0xc546('0xf')][_0xc546('0x10')]>0x0){_0x5f1c6d[_0xc546('0x27')]=_0x20b677[_0xc546('0xf')][0x0][_0xc546('0x12')];logger[_0xc546('0x13')]('['+[_0x39029d[_0xc546('0x16')]()]+_0xc546('0x28'),_0x5f1c6d);_0x583f3e(_0x5f1c6d);}else{return createEndUser(_0x39029d,_0x2e091a,_0x5f1c6d,_0x4c575f,_0x4a8452)[_0xc546('0xe')](function(_0x4e10c6){logger[_0xc546('0x13')]('['+[_0x39029d[_0xc546('0x16')]()]+'],\x20createEndUser\x20crm',_0x4e10c6);_0x583f3e(_0x4e10c6);});}})[_0xc546('0x20')](function(_0xd3a32a){logger[_0xc546('0x15')]('['+[_0x39029d['toUpperCase']()]+']',_0xd3a32a[_0xc546('0x17')]);_0x28e1a9(_0xd3a32a[_0xc546('0x17')]);});});};}function getCustomFields(_0x4e44e9,_0x62203c){var _0xeade8b={};if(_0x4e44e9[_0xc546('0x10')]>0x0){_[_0xc546('0x29')](_0x4e44e9,function(_0x496819){if(_[_0xc546('0x2a')]([_0xc546('0x2b'),'picklist'],_0x496819[_0xc546('0x2c')])&&_0x496819['nameField']&&!_0x496819[_0xc546('0x2d')]){_0xeade8b[_0x496819['nameField'][_0xc546('0x2e')]()]=_0x496819[_0xc546('0x2f')][_0xc546('0x30')]();}else if(_['includes'](['string',_0xc546('0x31')],_0x496819[_0xc546('0x2c')])&&_0x496819[_0xc546('0x32')]&&_0x496819[_0xc546('0x2d')]){_0xeade8b[_0x496819['idField'][_0xc546('0x2e')]()]=_0x496819['content']['toString']();}else if(_0x496819[_0xc546('0x2c')]===_0xc546('0x33')&&_0x496819['variableName']&&_0x496819['idField']&&_0x496819[_0xc546('0x2d')]){_0xeade8b[_0x496819['idField']['toLowerCase']()]=_0x62203c[_0x496819['variableName']][_0xc546('0x30')]();}else if(_0x496819[_0xc546('0x2c')]===_0xc546('0x34')&&_0x496819[_0xc546('0x35')]&&_0x496819[_0xc546('0x35')]['name']&&_0x496819[_0xc546('0x32')]&&_0x496819[_0xc546('0x2d')]){_0xeade8b[_0x496819[_0xc546('0x32')][_0xc546('0x2e')]()]=_0x62203c[_0x496819['Variable']['name'][_0xc546('0x2e')]()][_0xc546('0x30')]();}});}return _0xeade8b;}function getTicket(_0x860ee1,_0x2c6325,_0x16e2ad,_0x1c182f,_0xeb5c07,_0xae586c){return function(_0x4c6989){logger['info']('['+[_0x860ee1[_0xc546('0x16')]()]+_0xc546('0x36'),_0x4c6989);return new Promise(function(_0x5d923a,_0x3b5a86){var _0x38f398=_0x860ee1[_0xc546('0x2e')]()===_0xc546('0x37')?_0x4c6989[_0xc546('0x1d')]:_0x4c6989['endUserId'];var _0x21b432={'method':_0xc546('0x22'),'uri':_0x16e2ad+_0xc546('0x38')+'?'+_0xae586c,'body':Object['assign']({},{'active':_0xc546('0x25'),'caller_id':_0x38f398,'assigned_to':_0x4c6989['userId'],'short_description':intUtil['getString'](_0x1c182f[_0xc546('0x39')],_0xeb5c07,'\x20'),'description':intUtil[_0xc546('0x3a')](_0x1c182f['Descriptions'],_0xeb5c07,'\x0a')},getCustomFields(_0x1c182f['Fields'],_0xeb5c07)),'auth':_0x2c6325,'json':!![]};return rp(_0x21b432)[_0xc546('0xe')](function(_0x33c33f){logger[_0xc546('0x13')]('['+[_0x860ee1[_0xc546('0x16')]()]+_0xc546('0x3b'),_0x33c33f[_0xc546('0xf')]);_0x4c6989[_0xc546('0x3c')]=_0x33c33f[_0xc546('0xf')][_0xc546('0x12')];_0x4c6989[_0xc546('0x3d')]=_0x33c33f[_0xc546('0xf')]['number'];logger['info']('['+[_0x860ee1[_0xc546('0x16')]()]+_0xc546('0x3e'),_0x4c6989);_0x5d923a(_0x4c6989);})[_0xc546('0x20')](function(_0x910e02){logger[_0xc546('0x15')]('['+[_0x860ee1[_0xc546('0x16')]()]+']',_0x910e02[_0xc546('0x17')]);_0x3b5a86(_0x910e02[_0xc546('0x17')]);});});};}function createRemoteTag(_0x1ca6f3,_0x531515,_0xf72588,_0x81c8cf){return new Promise(function(_0x126d56,_0x5dc670){var _0x333afb={'method':'POST','uri':_0xf72588+_0xc546('0x3f')+'?'+_0x81c8cf,'body':{'short_description':_0x1ca6f3,'global':!![],'active':!![],'name':_0x1ca6f3},'auth':_0x531515,'json':!![]};return rp(_0x333afb)[_0xc546('0xe')](function(_0x384b16){var _0x162f39=_0x384b16[_0xc546('0xf')][_0xc546('0x12')];_0x126d56(_0x162f39);});});}function getRemoteTag(_0x287766,_0x136a50,_0x4f7da3,_0x1daa5e,_0x5799e5){return new Promise(function(_0x2d2577,_0xf6033f){var _0x3ff048={'method':'GET','uri':_0x4f7da3+'label'+_0xc546('0x40')+_0x287766+'&'+_0x1daa5e,'auth':_0x136a50,'json':!![]};return rp(_0x3ff048)['then'](function(_0x33c623){if(_0x33c623[_0xc546('0xf')]['length']>0x0){var _0x2d8668=_0x33c623[_0xc546('0xf')][0x0][_0xc546('0x12')];_0x2d2577(_0x2d8668);}else{return createRemoteTag(_0x287766,_0x136a50,_0x4f7da3,_0x1daa5e)['then'](function(_0x408370){_0x2d2577(_0x408370);});}});});}function assignTagToIncident(_0x42912f,_0x2f6654,_0x3139ca,_0x3c8943,_0x2b717e){return new Promise(function(_0x361e1e,_0xca7729){var _0xef3642={'method':_0xc546('0x22'),'uri':_0x3139ca+_0xc546('0x41')+'?'+_0x2b717e,'body':{'label':_0x42912f,'table':'incident','id_type':_0xc546('0x42'),'table_key':_0x3c8943[_0xc546('0x3c')],'title':'Incident\x20-\x20'+_0x3c8943[_0xc546('0x3d')],'id_display':_0x3c8943[_0xc546('0x3d')]},'auth':_0x2f6654,'json':!![]};return rp(_0xef3642)[_0xc546('0xe')](function(_0x17b9ef){_0x361e1e();})['catch'](function(){_0x361e1e();});});}function manageTags(_0x14f428,_0x5bc1b6,_0xd42c61,_0x3c6a96,_0x31af96,_0x32ac60,_0x184325){return new Promise(function(_0x3e317d,_0x1bf915){var _0x1682ae=[];_0x5bc1b6[_0xc546('0x29')](function(_0x3d0c0a){_0x1682ae[_0xc546('0x43')](getRemoteTag(_0x3d0c0a,_0xd42c61,_0x3c6a96,_0x32ac60,_0x184325));});return Promise['all'](_0x1682ae)[_0xc546('0xe')](function(_0x219b08){if(_0x219b08[_0xc546('0x10')]){logger[_0xc546('0x13')]('['+[_0x14f428[_0xc546('0x16')]()]+_0xc546('0x44'),_0x219b08);var _0x3b1c42=[];_0x219b08[_0xc546('0x29')](function(_0x90f3ad){_0x3b1c42[_0xc546('0x43')](assignTagToIncident(_0x90f3ad,_0xd42c61,_0x3c6a96,_0x31af96,_0x32ac60));});return Promise[_0xc546('0x45')](_0x3b1c42)['then'](function(){_0x3e317d();})[_0xc546('0x20')](function(){_0x3e317d();});}else{_0x3e317d();}});});}function getTags(_0x4de2a4,_0x275a94,_0x51e903,_0x3342ab,_0x58504e,_0x38d2d5){return function(_0x46346a){return new Promise(function(_0x396cb3,_0x2d558a){var _0x2c470d=[];var _0xacc48f=_0x3342ab[_0xc546('0x46')];if(_0xacc48f&&_0xacc48f[_0xc546('0x10')]>0x0){_0x2c470d=_['map'](_0xacc48f,_0xc546('0x47'));}if(_0x2c470d['length']>0x0){return manageTags(_0x4de2a4,_0x2c470d,_0x275a94,_0x51e903,_0x46346a,_0x58504e,_0x38d2d5)['then'](function(){_0x396cb3(_0x46346a);});}else{_0x396cb3(_0x46346a);}});};}function emit(_0x3eb8e0,_0x12b7ed,_0xb6d47a){var _0x4a2193=_0xc546('0x48')+_0xc546('0x49')+_0xc546('0x4a')+'%255EORDERBYDESCnumber';var _0x50654a={'uri':_0x3eb8e0+_0xc546('0x4b')+_0xb6d47a+_0x4a2193};io['to'](util[_0xc546('0x4c')](_0xc546('0x4d'),_0x12b7ed))[_0xc546('0x4e')](_0xc546('0x4f'),_0x50654a);}exports['cs']=function(_0x2badc2,_0x38b53a,_0x17da2e,_0x2241fe,_0x37fed4,_0x3ac97d,_0xdeff33,_0x4a24c8){var _0x5e16d3={};var _0x228740={'user':_0x3ac97d[_0xc546('0x50')],'pass':_0x3ac97d['password']};var _0x7823e9=_0xc546('0x51');var _0x71cef7=_0xc546('0x52');_0x3ac97d[_0xc546('0x53')]=intUtil[_0xc546('0x54')](_0x3ac97d[_0xc546('0x53')]);_0x3ac97d['serverUrl']=intUtil[_0xc546('0x54')](_0x3ac97d[_0xc546('0x55')]);var _0x33c746=util[_0xc546('0x4c')](_0xc546('0x56'),_0x3ac97d[_0xc546('0x53')]);_0x5e16d3['userEmail']=!_[_0xc546('0x57')](_0x2241fe)?_0x2241fe[_0xc546('0x58')]:null;_0x5e16d3[_0xc546('0x1e')]=_0x3ac97d[_0xc546('0x58')];_0x5e16d3['endUserNumber']=_0x4a24c8['toLowerCase']()===_0xc546('0x37')?_0x38b53a[_0xc546('0x59')]:_0x38b53a[_0xc546('0x5a')];_0x5e16d3[_0xc546('0x5b')]=_0x4a24c8==='queue'||_0x4a24c8===_0xc546('0x5c')?'queue':_0xc546('0x37');var _0x4ab305=util[_0xc546('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac97d[_0xc546('0x55')],_0x38b53a[_0xc546('0x5d')],md5(_0x38b53a[_0xc546('0x5d')]));if(_0x37fed4&&_0x37fed4[_0xc546('0x5e')]){logger[_0xc546('0x13')]('[QUEUE]',_0xc546('0x5f'));_0x38b53a[_0xc546('0x60')]=_0x4ab305;}else if(_0xdeff33&&_0xdeff33['recordingFormat']&&_0xdeff33['recordingFormat']!==_0xc546('0x61')){logger[_0xc546('0x13')](_0xc546('0x62'),_0xc546('0x5f'));_0x38b53a[_0xc546('0x60')]=_0x4ab305;}else{_0x38b53a[_0xc546('0x60')]='';}return getAdminUser(_0x4a24c8,_0x228740,_0x5e16d3,_0x33c746,_0x71cef7,_0x7823e9)[_0xc546('0xe')](getUser(_0x4a24c8,_0x228740,_0x33c746,_0x71cef7,_0x7823e9))[_0xc546('0xe')](getEndUser(_0x4a24c8,_0x228740,_0x33c746,_0x71cef7,_0x7823e9))[_0xc546('0xe')](getTicket(_0x4a24c8,_0x228740,_0x33c746,_0x17da2e,_0x38b53a,_0x71cef7))[_0xc546('0xe')](function(_0x4e3c34){logger[_0xc546('0x13')](util['format'](_0xc546('0x63'),_0x4e3c34[_0xc546('0x3c')]));logger[_0xc546('0x13')](util[_0xc546('0x4c')](_0xc546('0x64'),_0x4a24c8));if(_0x4a24c8!==_0xc546('0x5c')){logger[_0xc546('0x13')]('['+[_0x4a24c8[_0xc546('0x16')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3ac97d[_0xc546('0x53')],_0x2241fe[_0xc546('0x47')],_0x4e3c34[_0xc546('0x3c')]);}})['catch'](function(_0x1c1ba6){logger[_0xc546('0x15')]('['+[_0x4a24c8[_0xc546('0x16')]()]+_0xc546('0x65'),util[_0xc546('0x66')](_0x1c1ba6,{'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 22a390f..b119d4f 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 _0x7327=['stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','users','error','lodash','request-promise','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','getString','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON'];(function(_0x30631b,_0x50799b){var _0x3d57c6=function(_0x3ecce0){while(--_0x3ecce0){_0x30631b['push'](_0x30631b['shift']());}};_0x3d57c6(++_0x50799b);}(_0x7327,0x147));var _0x7732=function(_0x594245,_0x37fa88){_0x594245=_0x594245-0x0;var _0x538195=_0x7327[_0x594245];return _0x538195;};'use strict';var _=require(_0x7732('0x0'));var rp=require(_0x7732('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x7732('0x2'));var Redis=require(_0x7732('0x3'));var intUtil=require(_0x7732('0x4'));var config=require(_0x7732('0x5'));var logger=require('../../../../config/logger')(_0x7732('0x6'));config[_0x7732('0x7')]=_[_0x7732('0x8')](config[_0x7732('0x7')],{'host':_0x7732('0x9'),'port':0x18eb});var io=require(_0x7732('0xa'))(new Redis(config[_0x7732('0x7')]));var def={'method':_0x7732('0xb'),'json':!![]};function emit(_0x21e30e,_0x1117fd,_0x4f3789){io['to'](_0x21e30e)[_0x7732('0xc')](_0x1117fd,_0x4f3789);}function getTicket(_0x1f6a1e,_0x298949,_0x4d1cf6,_0x2cc9d6,_0x44cc62,_0x5dde8c,_0x532388,_0x3f0088){logger[_0x7732('0xd')]('Creating\x20new\x20ticket...');var _0x4c3282=new Date();var _0x468f3b=[{'name':'name','value':intUtil[_0x7732('0xe')](_0x2cc9d6['Subjects'],_0x44cc62,'\x20')},{'name':_0x7732('0xf'),'value':_0x298949['id']},{'name':'created_by','value':_0x298949['id']},{'name':_0x7732('0x10'),'value':intUtil[_0x7732('0xe')](_0x2cc9d6[_0x7732('0x11')],_0x44cc62,'\x0a')},{'name':_0x7732('0x12'),'value':_0x4c3282[_0x7732('0x13')]()[_0x7732('0x14')](0x0,0x13)[_0x7732('0x15')]('T','\x20')},{'name':_0x7732('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7732('0x17'),'value':_0x4d1cf6['id']},{'name':_0x7732('0x18'),'value':_0x7732('0x19')},{'name':_0x7732('0x1a'),'value':_0x4d1cf6[_0x7732('0x1b')]},{'name':_0x7732('0x1c'),'value':_0x3f0088}];if(_0x5dde8c[_0x7732('0x1d')]){_[_0x7732('0x1e')](_0x5dde8c,function(_0x313526){if(_0x44cc62[_0x313526[_0x7732('0x1f')]]){_0x468f3b[_0x7732('0x20')]({'name':_0x313526[_0x7732('0x21')],'value':_0x44cc62[_0x313526[_0x7732('0x1f')]]});}});}return request({'form':{'method':_0x7732('0x22'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x532388['id'],'module_name':_0x7732('0x25'),'name_value_list':_0x468f3b})}});}function getAuth(_0x359524){return util[_0x7732('0x26')](_0x7732('0x27'),new Buffer(_0x359524[_0x7732('0x28')]+':X')[_0x7732('0x29')]('base64'));}function getServerInfo(_0x4da4e6){return request({'form':{'method':_0x7732('0x2a'),'input_type':_0x7732('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4da4e6['id']})}});}function getUser(_0x10c427,_0x5b46fb,_0x4eb1a0){if(!_[_0x7732('0x2b')](_0x5b46fb)){logger['info'](_0x7732('0x2c'),_0x5b46fb);return request({'form':{'method':_0x7732('0x2d'),'input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x4eb1a0['id'],'module_name':_0x7732('0x2e'),'query':util[_0x7732('0x26')](_0x7732('0x2f'),_0x5b46fb),'order_by':'','offset':'0','select_fields':['id',_0x7732('0x1b'),_0x7732('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7732('0x31')](function(_0x138a8f){if(_0x138a8f[_0x7732('0x32')][_0x7732('0x1d')]){var _0x4aacbc=_[_0x7732('0x33')](_0x138a8f['entry_list'],function(_0x27fafe){return _0x27fafe['name_value_list']['user_name'][_0x7732('0x34')]===_0x5b46fb;});if(_0x4aacbc){logger['info'](_0x7732('0x35'));return BPromise[_0x7732('0x36')]({'id':_0x4aacbc[_0x7732('0x37')]['id'][_0x7732('0x34')],'name':_0x4aacbc[_0x7732('0x37')]['name']['value']});}}logger[_0x7732('0xd')](_0x7732('0x38'));return BPromise[_0x7732('0x36')]({'id':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x39')]['value'],'name':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x30')][_0x7732('0x34')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7732('0x36')]({'id':_0x4eb1a0['name_value_list']['user_id'][_0x7732('0x34')],'name':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x30')]['value']});}}function getEndUser(_0x227091,_0x2877e8,_0x3585bd,_0x156787){logger[_0x7732('0xd')](_0x7732('0x3a'),_0x3585bd);return request({'form':{'method':_0x7732('0x2d'),'input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x156787['id'],'module_name':'Contacts','query':util[_0x7732('0x26')](_0x7732('0x3b'),_0x3585bd),'order_by':'','offset':'0','select_fields':['id',_0x7732('0x1b'),_0x7732('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7732('0x31')](function(_0x2f84f0){if(_0x2f84f0['entry_list']['length']){var _0x2547cd=_[_0x7732('0x33')](_0x2f84f0[_0x7732('0x32')],function(_0x3c1db6){return _0x3c1db6['name_value_list'][_0x7732('0x3c')]['value']===_0x3585bd;});if(_0x2547cd){logger[_0x7732('0xd')](_0x7732('0x3d'));return BPromise[_0x7732('0x36')]({'id':_0x2547cd[_0x7732('0x37')]['id'][_0x7732('0x34')],'name':_0x2547cd[_0x7732('0x37')][_0x7732('0x1b')]['value'],'phone':_0x2547cd[_0x7732('0x37')][_0x7732('0x3c')][_0x7732('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x7732('0x22'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x156787['id'],'module_name':_0x7732('0x19'),'name_value_list':[{'name':_0x7732('0x3e'),'value':_0x2877e8!==_0x7732('0x3f')?_0x2877e8:util[_0x7732('0x26')](_0x7732('0x40'),_0x3585bd)},{'name':_0x7732('0x3c'),'value':_0x3585bd}]})}})[_0x7732('0x31')](function(_0x38689f){logger['info']('Enduser\x20created.');return BPromise[_0x7732('0x36')]({'id':_0x38689f['id'],'name':_0x38689f[_0x7732('0x32')]['first_name'][_0x7732('0x34')],'phone':_0x38689f['entry_list'][_0x7732('0x3c')]['value']});});}});}function request(_0x389fcc){logger[_0x7732('0x41')]('[HTTP]',JSON[_0x7732('0x24')](_0x389fcc));return rp(_[_0x7732('0x42')](def,_0x389fcc));}function getTags(_0x502359,_0x578ca1){var _0x27c183=[];if(_0x502359&&_0x502359[_0x7732('0x1d')]>0x0){_0x27c183=_[_0x7732('0x43')](_0x502359,_0x578ca1);}return _0x27c183;}function getCustomFields(_0x1b4c36,_0x4f1225){var _0x5222f5=[];var _0x281759={'custom_fields':[]};if(_0x1b4c36['length']>0x0){_['forEach'](_0x1b4c36,function(_0x3cea22){if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x45')&&_0x3cea22['nameField']&&!_0x3cea22[_0x7732('0x46')]){_0x281759[_0x3cea22[_0x7732('0x47')][_0x7732('0x48')]()]=_0x3cea22[_0x7732('0x49')][_0x7732('0x29')]();}else if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x45')&&_0x3cea22['idField']&&_0x3cea22[_0x7732('0x46')]){_0x281759['custom_fields'][_0x7732('0x20')]({'id':_0x3cea22[_0x7732('0x21')],'value':_0x3cea22[_0x7732('0x49')][_0x7732('0x29')]()});}else if(_0x3cea22['type']==='variable'&&_0x3cea22[_0x7732('0x1f')]&&_0x3cea22['idField']&&_0x3cea22['customField']){_0x4f1225[_0x3cea22[_0x7732('0x1f')]]&&_0x281759[_0x7732('0x4a')][_0x7732('0x20')]({'id':_0x3cea22[_0x7732('0x21')],'value':_0x4f1225[_0x3cea22['variableName']][_0x7732('0x29')]()});}else if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x4b')&&_0x3cea22[_0x7732('0x4c')]&&_0x3cea22[_0x7732('0x4c')][_0x7732('0x1b')]&&_0x3cea22['idField']&&_0x3cea22[_0x7732('0x46')]){_0x4f1225[_0x3cea22['Variable'][_0x7732('0x1b')][_0x7732('0x48')]()]&&_0x281759['custom_fields']['push']({'id':_0x3cea22[_0x7732('0x21')],'value':_0x4f1225[_0x3cea22['Variable'][_0x7732('0x1b')][_0x7732('0x48')]()][_0x7732('0x29')]()});}});}return _0x281759;}function getConnection(_0x5933e){return request({'method':_0x7732('0xb'),'form':{'method':_0x7732('0x4d'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'user_auth':{'user_name':_0x5933e[_0x7732('0x4e')],'password':_0x5933e[_0x7732('0x4f')],'encryption':_0x7732('0x50')},'application':_0x7732('0x51')})}})[_0x7732('0x31')](function(_0x4cd028){var _0x29ba63=_0x4cd028;if(_0x29ba63['id']){def[_0x7732('0x52')]=_0x29ba63['id'];return BPromise[_0x7732('0x36')](_0x29ba63);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5933e['id']));}});}function setRelationship(_0x226c52,_0x48f35e,_0xa41474,_0x56a076){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x226c52['id'],'module_name':_0x7732('0x25'),'module_id':_0xa41474['id'],'link_field_name':_0x56a076,'related_ids':[_0x48f35e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7732('0x53')]=function(_0x25ac81,_0x4cae72,_0x22cc9d,_0x5e7301,_0x15fd3e,_0x32e0d0){var _0x107d67,_0x1a7f5d,_0x6df4b,_0x50ab78;_0x32e0d0[_0x7732('0x54')]=intUtil[_0x7732('0x55')](_0x32e0d0[_0x7732('0x54')]);_0x32e0d0['serverUrl']=intUtil[_0x7732('0x55')](_0x32e0d0['serverUrl']);def[_0x7732('0x56')]=util[_0x7732('0x26')](_0x7732('0x57'),_0x32e0d0[_0x7732('0x54')]);if(_0x15fd3e&&_0x15fd3e[_0x7732('0x58')]){logger[_0x7732('0xd')](_0x7732('0x59'),'Recording\x20is\x20enabled!');_0x4cae72[_0x7732('0x5a')]=util[_0x7732('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32e0d0[_0x7732('0x5b')],_0x4cae72[_0x7732('0x5c')],md5(_0x4cae72['uniqueid']));}else{_0x4cae72[_0x7732('0x5a')]='';}return getConnection(_0x32e0d0)['then'](function(_0x349d11){_0x50ab78=_0x349d11;return getUser(_0x32e0d0,_0x5e7301[_0x7732('0x1b')],_0x50ab78);})[_0x7732('0x31')](function(_0x10301e){_0x107d67=_0x10301e;logger[_0x7732('0xd')](_0x7732('0x5d'),_0x107d67['id']);return getEndUser(_0x32e0d0,_0x4cae72[_0x7732('0x5e')],_0x4cae72[_0x7732('0x5f')],_0x50ab78);})[_0x7732('0x31')](function(_0x57d266){_0x1a7f5d=_0x57d266;logger[_0x7732('0xd')](_0x7732('0x60'),_0x1a7f5d['id']);return getTicket(_0x32e0d0,_0x107d67,_0x1a7f5d,_0x22cc9d,_0x4cae72,_0x22cc9d['Fields'],_0x50ab78,_0x7732('0x61'));})[_0x7732('0x31')](function(_0x4a444b){_0x6df4b=_0x4a444b;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')](_0x7732('0x63'),_0x6df4b['id']);return setRelationship(_0x50ab78,_0x107d67,_0x6df4b,'users');})[_0x7732('0x31')](function(){return setRelationship(_0x50ab78,_0x1a7f5d,_0x6df4b,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x50ab78);})[_0x7732('0x31')](function(_0x4b0bcd){var _0x444572=parseInt(_0x4b0bcd[_0x7732('0x65')][_0x7732('0x66')](0x0));var _0x42d84c=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x32e0d0['remoteUri'],_0x6df4b['id']);if(_0x444572>0x6){_0x42d84c=util['format'](_0x7732('0x67'),_0x32e0d0[_0x7732('0x54')],_0x6df4b['id']);}logger[_0x7732('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7732('0x26')](_0x7732('0x68'),_0x5e7301['name']),_0x7732('0x69'),{'uri':_0x42d84c});})[_0x7732('0x6a')](function(_0x2c363e){logger['error'](_0x7732('0x59'),JSON[_0x7732('0x24')](_0x2c363e));});};exports[_0x7732('0x6b')]=function(_0xe43094,_0x2a6a04,_0x115772,_0x3367ce,_0xa387e4,_0x59938e,_0x9cb1f4){var _0x2c4a46,_0x592ac5,_0x357c91,_0x314912;_0x59938e[_0x7732('0x54')]=intUtil[_0x7732('0x55')](_0x59938e[_0x7732('0x54')]);_0x59938e['serverUrl']=intUtil[_0x7732('0x55')](_0x59938e[_0x7732('0x5b')]);def[_0x7732('0x56')]=util[_0x7732('0x26')](_0x7732('0x57'),_0x59938e[_0x7732('0x54')]);if(_0x9cb1f4&&_0x9cb1f4[_0x7732('0x6c')]&&_0x9cb1f4[_0x7732('0x6c')]!=='none'){logger[_0x7732('0xd')]('[OUTBOUND]',_0x7732('0x6d'));_0x2a6a04[_0x7732('0x5a')]=util['format'](_0x7732('0x6e'),_0x59938e['serverUrl'],_0x2a6a04[_0x7732('0x5c')],md5(_0x2a6a04['uniqueid']));}return getConnection(_0x59938e)['then'](function(_0x1c3551){_0x314912=_0x1c3551;return getUser(_0x59938e,_0x3367ce['name'],_0x314912);})[_0x7732('0x31')](function(_0x4faf4e){_0x2c4a46=_0x4faf4e;logger[_0x7732('0xd')]('The\x20User\x20ID\x20is:',_0x2c4a46['id']);return getEndUser(_0x59938e,_0x2a6a04['destcalleridname'],_0x2a6a04[_0x7732('0x6f')],_0x314912);})[_0x7732('0x31')](function(_0x34fdce){_0x592ac5=_0x34fdce;logger[_0x7732('0xd')](_0x7732('0x60'),_0x592ac5['id']);return getTicket(_0x59938e,_0x2c4a46,_0x592ac5,_0x115772,_0x2a6a04,_0x115772[_0x7732('0x70')],_0x314912,_0x7732('0x71'));})[_0x7732('0x31')](function(_0x588d0b){_0x357c91=_0x588d0b;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')](_0x7732('0x63'),_0x357c91['id']);return setRelationship(_0x314912,_0x2c4a46,_0x357c91,'users');})['then'](function(){return setRelationship(_0x314912,_0x592ac5,_0x357c91,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x314912);})['then'](function(_0x38fae9){var _0x234170=parseInt(_0x38fae9[_0x7732('0x65')][_0x7732('0x66')](0x0));var _0x309ba3=util['format'](_0x7732('0x72'),_0x59938e[_0x7732('0x54')],_0x357c91['id']);if(_0x234170>0x6){_0x309ba3=util['format'](_0x7732('0x67'),_0x59938e[_0x7732('0x54')],_0x357c91['id']);}logger[_0x7732('0xd')](_0x7732('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7732('0x26')]('user:%s',_0x3367ce[_0x7732('0x1b')]),_0x7732('0x69'),{'uri':_0x309ba3});})[_0x7732('0x6a')](function(_0x3aecfa){logger['error'](_0x7732('0x73'),JSON[_0x7732('0x24')](_0x3aecfa));});};exports[_0x7732('0x74')]=function(_0x4022a7,_0x2532c3,_0x2c13a1,_0x23d622,_0x9d1217,_0x647267){var _0x2d5606,_0x1e5dc0,_0x17bc41,_0x1e84bd;_0x647267[_0x7732('0x54')]=intUtil['stripTrailingSlash'](_0x647267[_0x7732('0x54')]);_0x647267[_0x7732('0x5b')]=intUtil[_0x7732('0x55')](_0x647267[_0x7732('0x5b')]);def[_0x7732('0x56')]=util['format'](_0x7732('0x57'),_0x647267[_0x7732('0x54')]);if(_0x9d1217&&_0x9d1217[_0x7732('0x58')]){logger['info']('['+_0x2532c3[_0x7732('0x75')][_0x7732('0x76')]()+']',_0x7732('0x6d'));_0x2532c3[_0x7732('0x5a')]=util['format'](_0x7732('0x6e'),_0x647267[_0x7732('0x5b')],_0x2532c3[_0x7732('0x5c')],md5(_0x2532c3['uniqueid']));}else{_0x2532c3[_0x7732('0x5a')]='';}return getConnection(_0x647267)[_0x7732('0x31')](function(_0x114824){_0x1e84bd=_0x114824;if(!_[_0x7732('0x2b')](_0x23d622)){return getUser(_0x647267,_0x23d622[_0x7732('0x1b')],_0x1e84bd);}else{return getUser(_0x647267,null,_0x1e84bd);}})[_0x7732('0x31')](function(_0x4b1266){_0x2d5606=_0x4b1266;logger[_0x7732('0xd')](_0x7732('0x5d'),_0x2d5606['id']);return getEndUser(_0x647267,_0x2532c3[_0x7732('0x5e')],_0x2532c3['calleridnum'],_0x1e84bd);})['then'](function(_0x5e4582){_0x1e5dc0=_0x5e4582;logger[_0x7732('0xd')](_0x7732('0x60'),_0x1e5dc0['id']);return getTicket(_0x647267,_0x2d5606,_0x1e5dc0,_0x2c13a1,_0x2532c3,_0x2c13a1['Fields'],_0x1e84bd,_0x7732('0x61'));})[_0x7732('0x31')](function(_0x487f75){_0x17bc41=_0x487f75;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')]('The\x20Ticket\x20ID\x20is:',_0x17bc41['id']);return setRelationship(_0x1e84bd,_0x2d5606,_0x17bc41,_0x7732('0x77'));})['then'](function(){return setRelationship(_0x1e84bd,_0x1e5dc0,_0x17bc41,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x1e84bd);})[_0x7732('0x6a')](function(_0xbd98b3){logger[_0x7732('0x78')]('['+_0x2532c3[_0x7732('0x75')][_0x7732('0x76')]()+']',JSON[_0x7732('0x24')](_0xbd98b3));});}; \ No newline at end of file +var _0x718e=['catch','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','redis','POST','emit','info','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','get_entry_list','Employees','name','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','then','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','content','variable','custom_fields','customVariable','Variable','toLowerCase','login','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url'];(function(_0xad6d58,_0x38fc4f){var _0x2dd640=function(_0xf802da){while(--_0xf802da){_0xad6d58['push'](_0xad6d58['shift']());}};_0x2dd640(++_0x38fc4f);}(_0x718e,0x1ee));var _0xe718=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0x718e[_0x2526e3];return _0xcf6f48;};'use strict';var _=require(_0xe718('0x0'));var rp=require('request-promise');var BPromise=require(_0xe718('0x1'));var md5=require('md5');var util=require(_0xe718('0x2'));var Redis=require(_0xe718('0x3'));var intUtil=require(_0xe718('0x4'));var config=require(_0xe718('0x5'));var logger=require(_0xe718('0x6'))(_0xe718('0x7'));config['redis']=_[_0xe718('0x8')](config['redis'],{'host':_0xe718('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe718('0xa')]));var def={'method':_0xe718('0xb'),'json':!![]};function emit(_0x4491aa,_0x51bbbe,_0x582b7d){io['to'](_0x4491aa)[_0xe718('0xc')](_0x51bbbe,_0x582b7d);}function getTicket(_0x3db820,_0x2b0ea3,_0x4976bc,_0x358736,_0x2644c9,_0x435986,_0x4c3401,_0x1721fc){logger[_0xe718('0xd')]('Creating\x20new\x20ticket...');var _0x1c9988=new Date();var _0x24d1b0=[{'name':'name','value':intUtil[_0xe718('0xe')](_0x358736[_0xe718('0xf')],_0x2644c9,'\x20')},{'name':_0xe718('0x10'),'value':_0x2b0ea3['id']},{'name':_0xe718('0x11'),'value':_0x2b0ea3['id']},{'name':_0xe718('0x12'),'value':intUtil[_0xe718('0xe')](_0x358736['Descriptions'],_0x2644c9,'\x0a')},{'name':_0xe718('0x13'),'value':_0x1c9988[_0xe718('0x14')]()[_0xe718('0x15')](0x0,0x13)[_0xe718('0x16')]('T','\x20')},{'name':_0xe718('0x17'),'value':'0'},{'name':_0xe718('0x18'),'value':'15'},{'name':_0xe718('0x19'),'value':_0x4976bc['id']},{'name':_0xe718('0x1a'),'value':'Contacts'},{'name':_0xe718('0x1b'),'value':_0x4976bc['name']},{'name':_0xe718('0x1c'),'value':_0x1721fc}];if(_0x435986['length']){_['forEach'](_0x435986,function(_0x48ef92){if(_0x2644c9[_0x48ef92[_0xe718('0x1d')]]){_0x24d1b0[_0xe718('0x1e')]({'name':_0x48ef92[_0xe718('0x1f')],'value':_0x2644c9[_0x48ef92['variableName']]});}});}return request({'form':{'method':_0xe718('0x20'),'input_type':_0xe718('0x21'),'response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'session':_0x4c3401['id'],'module_name':_0xe718('0x23'),'name_value_list':_0x24d1b0})}});}function getAuth(_0x43d92e){return util[_0xe718('0x24')]('Basic\x20%s',new Buffer(_0x43d92e['apiKey']+':X')[_0xe718('0x25')](_0xe718('0x26')));}function getServerInfo(_0xc11be2){return request({'form':{'method':_0xe718('0x27'),'input_type':_0xe718('0x21'),'response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'session':_0xc11be2['id']})}});}function getUser(_0x2fb769,_0x5aebbd,_0x29a07f){if(!_[_0xe718('0x28')](_0x5aebbd)){logger[_0xe718('0xd')]('Getting\x20agent\x20with\x20name',_0x5aebbd);return request({'form':{'method':_0xe718('0x29'),'input_type':_0xe718('0x21'),'response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'session':_0x29a07f['id'],'module_name':_0xe718('0x2a'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5aebbd),'order_by':'','offset':'0','select_fields':['id',_0xe718('0x2b'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x379806){if(_0x379806[_0xe718('0x2c')][_0xe718('0x2d')]){var _0x447217=_[_0xe718('0x2e')](_0x379806['entry_list'],function(_0x363d91){return _0x363d91[_0xe718('0x2f')]['user_name'][_0xe718('0x30')]===_0x5aebbd;});if(_0x447217){logger[_0xe718('0xd')]('Agent\x20found!');return BPromise[_0xe718('0x31')]({'id':_0x447217[_0xe718('0x2f')]['id'][_0xe718('0x30')],'name':_0x447217[_0xe718('0x2f')][_0xe718('0x2b')][_0xe718('0x30')]});}}logger['info'](_0xe718('0x32'));return BPromise[_0xe718('0x31')]({'id':_0x29a07f[_0xe718('0x2f')][_0xe718('0x33')]['value'],'name':_0x29a07f[_0xe718('0x2f')][_0xe718('0x34')][_0xe718('0x30')]});});}else{logger[_0xe718('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe718('0x31')]({'id':_0x29a07f['name_value_list'][_0xe718('0x33')][_0xe718('0x30')],'name':_0x29a07f[_0xe718('0x2f')][_0xe718('0x34')]['value']});}}function getEndUser(_0xccf4ec,_0x1c258f,_0x816974,_0x27cfaa){logger[_0xe718('0xd')](_0xe718('0x35'),_0x816974);return request({'form':{'method':_0xe718('0x29'),'input_type':'JSON','response_type':_0xe718('0x21'),'rest_data':JSON['stringify']({'session':_0x27cfaa['id'],'module_name':_0xe718('0x36'),'query':util[_0xe718('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x816974),'order_by':'','offset':'0','select_fields':['id','name',_0xe718('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe718('0x38')](function(_0x539b1b){if(_0x539b1b[_0xe718('0x2c')][_0xe718('0x2d')]){var _0x2c357e=_[_0xe718('0x2e')](_0x539b1b[_0xe718('0x2c')],function(_0x4517d8){return _0x4517d8[_0xe718('0x2f')][_0xe718('0x37')][_0xe718('0x30')]===_0x816974;});if(_0x2c357e){logger[_0xe718('0xd')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x2c357e[_0xe718('0x2f')]['id'][_0xe718('0x30')],'name':_0x2c357e[_0xe718('0x2f')][_0xe718('0x2b')][_0xe718('0x30')],'phone':_0x2c357e['name_value_list']['phone_home']['value']});}}else{logger[_0xe718('0xd')](_0xe718('0x39'));return request({'form':{'method':_0xe718('0x20'),'input_type':'JSON','response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'session':_0x27cfaa['id'],'module_name':'Contacts','name_value_list':[{'name':_0xe718('0x3a'),'value':_0x1c258f!==_0xe718('0x3b')?_0x1c258f:util[_0xe718('0x24')](_0xe718('0x3c'),_0x816974)},{'name':'phone_home','value':_0x816974}]})}})[_0xe718('0x38')](function(_0x404f09){logger[_0xe718('0xd')](_0xe718('0x3d'));return BPromise[_0xe718('0x31')]({'id':_0x404f09['id'],'name':_0x404f09[_0xe718('0x2c')]['first_name'][_0xe718('0x30')],'phone':_0x404f09[_0xe718('0x2c')][_0xe718('0x37')][_0xe718('0x30')]});});}});}function request(_0x4b6a0c){logger[_0xe718('0x3e')](_0xe718('0x3f'),JSON[_0xe718('0x22')](_0x4b6a0c));return rp(_[_0xe718('0x40')](def,_0x4b6a0c));}function getTags(_0x422a28,_0x50e65d){var _0x2157bc=[];if(_0x422a28&&_0x422a28[_0xe718('0x2d')]>0x0){_0x2157bc=_[_0xe718('0x41')](_0x422a28,_0x50e65d);}return _0x2157bc;}function getCustomFields(_0x112d4e,_0x5c14cd){var _0x555f80=[];var _0x460dfc={'custom_fields':[]};if(_0x112d4e[_0xe718('0x2d')]>0x0){_['forEach'](_0x112d4e,function(_0x4cd3f8){if(_0x4cd3f8[_0xe718('0x42')]===_0xe718('0x43')&&_0x4cd3f8[_0xe718('0x44')]&&!_0x4cd3f8['customField']){_0x460dfc[_0x4cd3f8['nameField']['toLowerCase']()]=_0x4cd3f8['content'][_0xe718('0x25')]();}else if(_0x4cd3f8['type']===_0xe718('0x43')&&_0x4cd3f8[_0xe718('0x1f')]&&_0x4cd3f8[_0xe718('0x45')]){_0x460dfc['custom_fields']['push']({'id':_0x4cd3f8['idField'],'value':_0x4cd3f8[_0xe718('0x46')][_0xe718('0x25')]()});}else if(_0x4cd3f8['type']===_0xe718('0x47')&&_0x4cd3f8[_0xe718('0x1d')]&&_0x4cd3f8[_0xe718('0x1f')]&&_0x4cd3f8[_0xe718('0x45')]){_0x5c14cd[_0x4cd3f8[_0xe718('0x1d')]]&&_0x460dfc[_0xe718('0x48')]['push']({'id':_0x4cd3f8[_0xe718('0x1f')],'value':_0x5c14cd[_0x4cd3f8[_0xe718('0x1d')]][_0xe718('0x25')]()});}else if(_0x4cd3f8[_0xe718('0x42')]===_0xe718('0x49')&&_0x4cd3f8[_0xe718('0x4a')]&&_0x4cd3f8[_0xe718('0x4a')][_0xe718('0x2b')]&&_0x4cd3f8[_0xe718('0x1f')]&&_0x4cd3f8[_0xe718('0x45')]){_0x5c14cd[_0x4cd3f8[_0xe718('0x4a')][_0xe718('0x2b')][_0xe718('0x4b')]()]&&_0x460dfc[_0xe718('0x48')][_0xe718('0x1e')]({'id':_0x4cd3f8['idField'],'value':_0x5c14cd[_0x4cd3f8[_0xe718('0x4a')][_0xe718('0x2b')][_0xe718('0x4b')]()][_0xe718('0x25')]()});}});}return _0x460dfc;}function getConnection(_0x4c2fd7){return request({'method':_0xe718('0xb'),'form':{'method':_0xe718('0x4c'),'input_type':_0xe718('0x21'),'response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'user_auth':{'user_name':_0x4c2fd7['username'],'password':_0x4c2fd7[_0xe718('0x4d')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xe718('0x38')](function(_0x10e514){var _0x1a449b=_0x10e514;if(_0x1a449b['id']){def[_0xe718('0x4e')]=_0x1a449b['id'];return BPromise['resolve'](_0x1a449b);}else{throw new Error(util['format'](_0xe718('0x4f'),_0x4c2fd7['id']));}});}function setRelationship(_0x5ca623,_0xf1c14,_0x59ce0f,_0x5db61c){return request({'form':{'method':_0xe718('0x50'),'input_type':_0xe718('0x21'),'response_type':_0xe718('0x21'),'rest_data':JSON[_0xe718('0x22')]({'session':_0x5ca623['id'],'module_name':'Calls','module_id':_0x59ce0f['id'],'link_field_name':_0x5db61c,'related_ids':[_0xf1c14['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe718('0x51')]=function(_0x2e1c5d,_0x3bbdfd,_0x19252a,_0x2e4b3f,_0x5592bd,_0x38cf55){var _0x27762d,_0x2c1ba5,_0x535597,_0x967afd;_0x38cf55[_0xe718('0x52')]=intUtil[_0xe718('0x53')](_0x38cf55[_0xe718('0x52')]);_0x38cf55['serverUrl']=intUtil['stripTrailingSlash'](_0x38cf55[_0xe718('0x54')]);def['uri']=util[_0xe718('0x24')](_0xe718('0x55'),_0x38cf55[_0xe718('0x52')]);if(_0x5592bd&&_0x5592bd[_0xe718('0x56')]){logger[_0xe718('0xd')](_0xe718('0x57'),_0xe718('0x58'));_0x3bbdfd[_0xe718('0x59')]=util['format'](_0xe718('0x5a'),_0x38cf55[_0xe718('0x54')],_0x3bbdfd['uniqueid'],md5(_0x3bbdfd[_0xe718('0x5b')]));}else{_0x3bbdfd['recordingURL']='';}return getConnection(_0x38cf55)[_0xe718('0x38')](function(_0x4db80d){_0x967afd=_0x4db80d;return getUser(_0x38cf55,_0x2e4b3f[_0xe718('0x2b')],_0x967afd);})[_0xe718('0x38')](function(_0x217fe7){_0x27762d=_0x217fe7;logger[_0xe718('0xd')](_0xe718('0x5c'),_0x27762d['id']);return getEndUser(_0x38cf55,_0x3bbdfd[_0xe718('0x5d')],_0x3bbdfd[_0xe718('0x5e')],_0x967afd);})[_0xe718('0x38')](function(_0x559b0e){_0x2c1ba5=_0x559b0e;logger[_0xe718('0xd')](_0xe718('0x5f'),_0x2c1ba5['id']);return getTicket(_0x38cf55,_0x27762d,_0x2c1ba5,_0x19252a,_0x3bbdfd,_0x19252a['Fields'],_0x967afd,_0xe718('0x60'));})[_0xe718('0x38')](function(_0x14f0f5){_0x535597=_0x14f0f5;logger[_0xe718('0xd')]('Ticket\x20created!');logger[_0xe718('0xd')](_0xe718('0x61'),_0x535597['id']);return setRelationship(_0x967afd,_0x27762d,_0x535597,_0xe718('0x62'));})['then'](function(){return setRelationship(_0x967afd,_0x2c1ba5,_0x535597,_0xe718('0x63'));})[_0xe718('0x38')](function(){return getServerInfo(_0x967afd);})['then'](function(_0x4ab21e){var _0x12d1ca=parseInt(_0x4ab21e[_0xe718('0x64')][_0xe718('0x65')](0x0));var _0x5a38b6=util[_0xe718('0x24')](_0xe718('0x66'),_0x38cf55[_0xe718('0x52')],_0x535597['id']);if(_0x12d1ca>0x6){_0x5a38b6=util[_0xe718('0x24')](_0xe718('0x67'),_0x38cf55[_0xe718('0x52')],_0x535597['id']);}logger[_0xe718('0xd')](_0xe718('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xe718('0x68'),_0x2e4b3f['name']),_0xe718('0x69'),{'uri':_0x5a38b6});})[_0xe718('0x6a')](function(_0x487056){logger[_0xe718('0x6b')](_0xe718('0x57'),JSON['stringify'](_0x487056));});};exports[_0xe718('0x6c')]=function(_0x3f2dda,_0x24ef9c,_0x52e5b5,_0x112ead,_0x4b738b,_0xbea5ca,_0x3b3760){var _0x103f07,_0x36ebc1,_0x474357,_0x226835;_0xbea5ca[_0xe718('0x52')]=intUtil['stripTrailingSlash'](_0xbea5ca['remoteUri']);_0xbea5ca[_0xe718('0x54')]=intUtil[_0xe718('0x53')](_0xbea5ca[_0xe718('0x54')]);def[_0xe718('0x6d')]=util[_0xe718('0x24')](_0xe718('0x55'),_0xbea5ca[_0xe718('0x52')]);if(_0x3b3760&&_0x3b3760[_0xe718('0x6e')]&&_0x3b3760[_0xe718('0x6e')]!=='none'){logger[_0xe718('0xd')](_0xe718('0x6f'),_0xe718('0x58'));_0x24ef9c[_0xe718('0x59')]=util['format'](_0xe718('0x5a'),_0xbea5ca[_0xe718('0x54')],_0x24ef9c[_0xe718('0x5b')],md5(_0x24ef9c[_0xe718('0x5b')]));}return getConnection(_0xbea5ca)['then'](function(_0x5ed4d3){_0x226835=_0x5ed4d3;return getUser(_0xbea5ca,_0x112ead['name'],_0x226835);})[_0xe718('0x38')](function(_0x2c7a91){_0x103f07=_0x2c7a91;logger[_0xe718('0xd')](_0xe718('0x5c'),_0x103f07['id']);return getEndUser(_0xbea5ca,_0x24ef9c[_0xe718('0x70')],_0x24ef9c[_0xe718('0x71')],_0x226835);})[_0xe718('0x38')](function(_0x16075e){_0x36ebc1=_0x16075e;logger[_0xe718('0xd')](_0xe718('0x5f'),_0x36ebc1['id']);return getTicket(_0xbea5ca,_0x103f07,_0x36ebc1,_0x52e5b5,_0x24ef9c,_0x52e5b5[_0xe718('0x72')],_0x226835,_0xe718('0x73'));})[_0xe718('0x38')](function(_0x5751d4){_0x474357=_0x5751d4;logger[_0xe718('0xd')](_0xe718('0x74'));logger['info'](_0xe718('0x61'),_0x474357['id']);return setRelationship(_0x226835,_0x103f07,_0x474357,'users');})['then'](function(){return setRelationship(_0x226835,_0x36ebc1,_0x474357,_0xe718('0x63'));})[_0xe718('0x38')](function(){return getServerInfo(_0x226835);})[_0xe718('0x38')](function(_0x458cb1){var _0x51f9d3=parseInt(_0x458cb1[_0xe718('0x64')][_0xe718('0x65')](0x0));var _0x5ef117=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xbea5ca[_0xe718('0x52')],_0x474357['id']);if(_0x51f9d3>0x6){_0x5ef117=util[_0xe718('0x24')](_0xe718('0x67'),_0xbea5ca['remoteUri'],_0x474357['id']);}logger['info'](_0xe718('0x6f'),_0xe718('0x75'));emit(util[_0xe718('0x24')](_0xe718('0x68'),_0x112ead[_0xe718('0x2b')]),'trigger:browser:url',{'uri':_0x5ef117});})[_0xe718('0x6a')](function(_0x58b69c){logger[_0xe718('0x6b')](_0xe718('0x6f'),JSON[_0xe718('0x22')](_0x58b69c));});};exports[_0xe718('0x76')]=function(_0x286cb6,_0x4de32f,_0x445640,_0x1fc5e1,_0x5d8cd3,_0x185526){var _0x5a9862,_0x1ca3ab,_0x4cc20c,_0x353bc2;_0x185526[_0xe718('0x52')]=intUtil[_0xe718('0x53')](_0x185526['remoteUri']);_0x185526['serverUrl']=intUtil[_0xe718('0x53')](_0x185526[_0xe718('0x54')]);def[_0xe718('0x6d')]=util[_0xe718('0x24')](_0xe718('0x55'),_0x185526['remoteUri']);if(_0x5d8cd3&&_0x5d8cd3['monitor_format']){logger[_0xe718('0xd')]('['+_0x4de32f['lastevent']['toUpperCase']()+']',_0xe718('0x58'));_0x4de32f[_0xe718('0x59')]=util[_0xe718('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x185526[_0xe718('0x54')],_0x4de32f['uniqueid'],md5(_0x4de32f[_0xe718('0x5b')]));}else{_0x4de32f[_0xe718('0x59')]='';}return getConnection(_0x185526)[_0xe718('0x38')](function(_0x180525){_0x353bc2=_0x180525;if(!_[_0xe718('0x28')](_0x1fc5e1)){return getUser(_0x185526,_0x1fc5e1[_0xe718('0x2b')],_0x353bc2);}else{return getUser(_0x185526,null,_0x353bc2);}})[_0xe718('0x38')](function(_0x40589f){_0x5a9862=_0x40589f;logger['info'](_0xe718('0x5c'),_0x5a9862['id']);return getEndUser(_0x185526,_0x4de32f[_0xe718('0x5d')],_0x4de32f[_0xe718('0x5e')],_0x353bc2);})[_0xe718('0x38')](function(_0xc48dad){_0x1ca3ab=_0xc48dad;logger[_0xe718('0xd')](_0xe718('0x5f'),_0x1ca3ab['id']);return getTicket(_0x185526,_0x5a9862,_0x1ca3ab,_0x445640,_0x4de32f,_0x445640[_0xe718('0x72')],_0x353bc2,_0xe718('0x60'));})[_0xe718('0x38')](function(_0x8fb673){_0x4cc20c=_0x8fb673;logger['info']('Ticket\x20created!');logger[_0xe718('0xd')](_0xe718('0x61'),_0x4cc20c['id']);return setRelationship(_0x353bc2,_0x5a9862,_0x4cc20c,_0xe718('0x62'));})[_0xe718('0x38')](function(){return setRelationship(_0x353bc2,_0x1ca3ab,_0x4cc20c,'contacts');})[_0xe718('0x38')](function(){return getServerInfo(_0x353bc2);})[_0xe718('0x6a')](function(_0x57f765){logger[_0xe718('0x6b')]('['+_0x4de32f['lastevent'][_0xe718('0x77')]()+']',JSON[_0xe718('0x22')](_0x57f765));});}; \ 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 b0b670a..1c4ebf0 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 _0xe7da=['substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','%s:\x20%s','format','join','stripTrailingSlash'];(function(_0x151045,_0x1affb8){var _0xbff17c=function(_0x36460d){while(--_0x36460d){_0x151045['push'](_0x151045['shift']());}};_0xbff17c(++_0x1affb8);}(_0xe7da,0x171));var _0xae7d=function(_0x592f23,_0x128334){_0x592f23=_0x592f23-0x0;var _0x3afb4e=_0xe7da[_0x592f23];return _0x3afb4e;};'use strict';var _=require(_0xae7d('0x0'));var util=require(_0xae7d('0x1'));exports[_0xae7d('0x2')]=function(_0x2d326d,_0x5dd398,_0x192994){var _0x4c5365=[];if(_0x2d326d[_0xae7d('0x3')]>0x0){var _0x16e32b=_['sortBy'](_0x2d326d,['id']);for(var _0x5bb0cc=0x0;_0x5bb0cc<_0x16e32b['length'];_0x5bb0cc++){var _0x34a8f5=_0x16e32b[_0x5bb0cc];if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0x5')){_0x4c5365[_0xae7d('0x6')](_0x34a8f5[_0xae7d('0x7')]);}else if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0x8')&&_0x34a8f5[_0xae7d('0x9')]){_0x5dd398[_0x34a8f5[_0xae7d('0x9')]]&&_0x4c5365[_0xae7d('0x6')](_0x5dd398[_0x34a8f5[_0xae7d('0x9')]][_0xae7d('0xa')]());}else if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0xb')&&_0x34a8f5['Variable']&&_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')]){_0x5dd398[_0x34a8f5['Variable']['name'][_0xae7d('0xe')]()]&&_0x4c5365['push'](_0x5dd398[_0x34a8f5[_0xae7d('0xc')]['name'][_0xae7d('0xe')]()][_0xae7d('0xa')]());}else if(_0x34a8f5[_0xae7d('0x4')]==='keyValue'){if(_0x34a8f5[_0xae7d('0xf')]===_0xae7d('0x5')&&_0x34a8f5[_0xae7d('0x10')]){_0x4c5365[_0xae7d('0x6')](util['format'](_0xae7d('0x11'),_0x34a8f5[_0xae7d('0x10')],_0x34a8f5['keyContent']));}else if(_0x34a8f5['keyType']===_0xae7d('0x8')&&_0x34a8f5[_0xae7d('0x9')]&&_0x34a8f5[_0xae7d('0x10')]){_0x5dd398[_0x34a8f5[_0xae7d('0x9')]]&&_0x4c5365['push'](util['format'](_0xae7d('0x11'),_0x34a8f5['key'],_0x5dd398[_0x34a8f5['variableName']]));}else if(_0x34a8f5[_0xae7d('0xf')]===_0xae7d('0xb')&&_0x34a8f5['Variable']&&_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')]&&_0x34a8f5[_0xae7d('0x10')]){_0x5dd398[_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')][_0xae7d('0xe')]()]&&_0x4c5365['push'](util[_0xae7d('0x12')](_0xae7d('0x11'),_0x34a8f5[_0xae7d('0x10')],_0x5dd398[_0x34a8f5[_0xae7d('0xc')]['name'][_0xae7d('0xe')]()]));}}}}return _0x4c5365[_0xae7d('0x13')](_0x192994);};exports[_0xae7d('0x14')]=function(_0x19aab9){var _0x5c28fc=_0x19aab9['slice'](-0x1);if(_0x5c28fc==='/'){_0x19aab9=_0x19aab9[_0xae7d('0x15')](0x0,_0x19aab9[_0xae7d('0x16')](_0x5c28fc));}return _0x19aab9;};exports[_0xae7d('0x17')]=function(_0x317e69){if(!_[_0xae7d('0x18')](_0x317e69)&&_0x317e69!==''){var _0x8aa7a9=/^(([^<>()\[\]\\.,;:\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 _0x8aa7a9[_0xae7d('0x19')](String(_0x317e69)[_0xae7d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x00a1=['validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','string','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x2f3d43,_0x151f9f){var _0x483214=function(_0x3cc1e2){while(--_0x3cc1e2){_0x2f3d43['push'](_0x2f3d43['shift']());}};_0x483214(++_0x151f9f);}(_0x00a1,0x1d3));var _0x100a=function(_0x5c32a9,_0x471541){_0x5c32a9=_0x5c32a9-0x0;var _0x5489e0=_0x00a1[_0x5c32a9];return _0x5489e0;};'use strict';var _=require(_0x100a('0x0'));var util=require(_0x100a('0x1'));exports[_0x100a('0x2')]=function(_0xb6d1c8,_0x13dd87,_0x1c84d8){var _0x442dfd=[];if(_0xb6d1c8[_0x100a('0x3')]>0x0){var _0x561344=_[_0x100a('0x4')](_0xb6d1c8,['id']);for(var _0x150e18=0x0;_0x150e18<_0x561344['length'];_0x150e18++){var _0x3900c9=_0x561344[_0x150e18];if(_0x3900c9[_0x100a('0x5')]==='string'){_0x442dfd['push'](_0x3900c9['content']);}else if(_0x3900c9['type']===_0x100a('0x6')&&_0x3900c9[_0x100a('0x7')]){_0x13dd87[_0x3900c9[_0x100a('0x7')]]&&_0x442dfd['push'](_0x13dd87[_0x3900c9[_0x100a('0x7')]][_0x100a('0x8')]());}else if(_0x3900c9[_0x100a('0x5')]===_0x100a('0x9')&&_0x3900c9[_0x100a('0xa')]&&_0x3900c9[_0x100a('0xa')][_0x100a('0xb')]){_0x13dd87[_0x3900c9[_0x100a('0xa')][_0x100a('0xb')][_0x100a('0xc')]()]&&_0x442dfd[_0x100a('0xd')](_0x13dd87[_0x3900c9[_0x100a('0xa')][_0x100a('0xb')][_0x100a('0xc')]()][_0x100a('0x8')]());}else if(_0x3900c9[_0x100a('0x5')]===_0x100a('0xe')){if(_0x3900c9[_0x100a('0xf')]===_0x100a('0x10')&&_0x3900c9[_0x100a('0x11')]){_0x442dfd['push'](util[_0x100a('0x12')]('%s:\x20%s',_0x3900c9['key'],_0x3900c9[_0x100a('0x13')]));}else if(_0x3900c9[_0x100a('0xf')]===_0x100a('0x6')&&_0x3900c9[_0x100a('0x7')]&&_0x3900c9['key']){_0x13dd87[_0x3900c9[_0x100a('0x7')]]&&_0x442dfd[_0x100a('0xd')](util['format'](_0x100a('0x14'),_0x3900c9[_0x100a('0x11')],_0x13dd87[_0x3900c9[_0x100a('0x7')]]));}else if(_0x3900c9[_0x100a('0xf')]===_0x100a('0x9')&&_0x3900c9['Variable']&&_0x3900c9[_0x100a('0xa')][_0x100a('0xb')]&&_0x3900c9[_0x100a('0x11')]){_0x13dd87[_0x3900c9['Variable']['name'][_0x100a('0xc')]()]&&_0x442dfd[_0x100a('0xd')](util['format']('%s:\x20%s',_0x3900c9[_0x100a('0x11')],_0x13dd87[_0x3900c9[_0x100a('0xa')]['name'][_0x100a('0xc')]()]));}}}}return _0x442dfd[_0x100a('0x15')](_0x1c84d8);};exports[_0x100a('0x16')]=function(_0x573cf5){var _0x1fc306=_0x573cf5[_0x100a('0x17')](-0x1);if(_0x1fc306==='/'){_0x573cf5=_0x573cf5[_0x100a('0x18')](0x0,_0x573cf5[_0x100a('0x19')](_0x1fc306));}return _0x573cf5;};exports[_0x100a('0x1a')]=function(_0x32c0ad){if(!_[_0x100a('0x1b')](_0x32c0ad)&&_0x32c0ad!==''){var _0x355bbe=/^(([^<>()\[\]\\.,;:\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 _0x355bbe[_0x100a('0x1c')](String(_0x32c0ad)[_0x100a('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 34bfdcc..df0290a 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x418cd3,_0x221e00){var _0x356a7c=function(_0x1e812e){while(--_0x1e812e){_0x418cd3['push'](_0x418cd3['shift']());}};_0x356a7c(++_0x221e00);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x4b440a,_0x4e3005){var _0x2506f6=function(_0x2adbb3){while(--_0x2adbb3){_0x4b440a['push'](_0x4b440a['shift']());}};_0x2506f6(++_0x4e3005);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index a0a3bf3..9419425 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 _0x0222=['content','picklist','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','serverUrl','[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:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','none','destcalleridname','[OUTBOUND]','/api/v2','catch','toUpperCase','Recording\x20is\x20enabled!','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','password','%s:%s','username','authType','token','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','string','type','nameField','customField'];(function(_0x54cfcf,_0x3ecf5b){var _0x1c2060=function(_0x484a41){while(--_0x484a41){_0x54cfcf['push'](_0x54cfcf['shift']());}};_0x1c2060(++_0x3ecf5b);}(_0x0222,0x1ec));var _0x2022=function(_0x285723,_0x2c0b04){_0x285723=_0x285723-0x0;var _0x172e0a=_0x0222[_0x285723];return _0x172e0a;};'use strict';var _=require(_0x2022('0x0'));var rp=require(_0x2022('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x2022('0x2'));var intUtil=require('./util');var config=require(_0x2022('0x3'));var logger=require(_0x2022('0x4'))(_0x2022('0x5'));config[_0x2022('0x6')]=_['defaults'](config['redis'],{'host':_0x2022('0x7'),'port':0x18eb});var io=require(_0x2022('0x8'))(new Redis(config['redis']));function emit(_0x1aebfe,_0x941ffd,_0x4d9b57){io['to'](_0x1aebfe)[_0x2022('0x9')](_0x941ffd,_0x4d9b57);}var headers={'Content-Type':'application/json','Accept':_0x2022('0xa')};function getTicket(_0x185a41,_0x8e3836,_0xcec50e,_0x4da4b9,_0x1a5770){logger[_0x2022('0xb')](_0x2022('0xc'));return request({'uri':util[_0x2022('0xd')](_0x2022('0xe'),_0x185a41[_0x2022('0xf')]),'method':'POST','body':{'ticket':_[_0x2022('0x10')]({'requester_id':_0xcec50e['id'],'submitter_id':_0x8e3836?_0x8e3836['id']:undefined,'assignee_id':_0x8e3836?_0x8e3836['id']:undefined,'tags':getTags(_0x4da4b9[_0x2022('0x11')],_0x2022('0x12')),'subject':intUtil[_0x2022('0x13')](_0x4da4b9[_0x2022('0x14')],_0x1a5770,'\x20'),'description':intUtil[_0x2022('0x13')](_0x4da4b9['Descriptions'],_0x1a5770,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2022('0x13')](_0x4da4b9[_0x2022('0x15')],_0x1a5770,'\x0a')}},getCustomFields(_0x4da4b9[_0x2022('0x16')],_0x1a5770))}})[_0x2022('0x17')](function(_0x53ec54){logger[_0x2022('0xb')](_0x2022('0x18'));return _0x53ec54[_0x2022('0x19')];});}function getUser(_0x4259b7,_0x1ddd90){if(intUtil['validateEmail'](_0x1ddd90)){logger[_0x2022('0xb')](_0x2022('0x1a'),_0x1ddd90);return request({'uri':util[_0x2022('0xd')](_0x2022('0x1b'),_0x4259b7[_0x2022('0xf')]),'qs':{'query':util[_0x2022('0xd')](_0x2022('0x1c'),_0x1ddd90)}})[_0x2022('0x17')](function(_0x12a293){if(_0x12a293[_0x2022('0x1d')]){logger[_0x2022('0xb')](_0x2022('0x1e'));return _[_0x2022('0x1f')](_0x12a293[_0x2022('0x20')],{'email':_0x1ddd90,'role':_0x2022('0x21')});}else{logger['info'](_0x2022('0x22'));return request({'uri':util[_0x2022('0xd')](_0x2022('0x23'),_0x4259b7[_0x2022('0xf')])})[_0x2022('0x17')](function(_0xd788da){logger[_0x2022('0xb')](_0x2022('0x24'));return _0xd788da[_0x2022('0x25')];});}});}else{logger[_0x2022('0xb')](_0x2022('0x22'));return request({'uri':util[_0x2022('0xd')](_0x2022('0x23'),_0x4259b7[_0x2022('0xf')])})[_0x2022('0x17')](function(_0x30aca6){logger[_0x2022('0xb')](_0x2022('0x24'));return _0x30aca6[_0x2022('0x25')];});}}function getEndUser(_0x3e3d24,_0x2127f7,_0x2fc019){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2fc019);return request({'uri':util[_0x2022('0xd')](_0x2022('0x1b'),_0x3e3d24[_0x2022('0xf')]),'qs':{'query':util[_0x2022('0xd')](_0x2022('0x26'),_0x2fc019)}})[_0x2022('0x17')](function(_0x283aab){var _0x55ba79;if(_0x283aab[_0x2022('0x20')][_0x2022('0x27')]){_0x283aab['results']=_[_0x2022('0x28')](_0x283aab[_0x2022('0x20')],{'suspended':![],'role':_0x2022('0x29')});if(_0x283aab[_0x2022('0x20')][_0x2022('0x27')]){_0x55ba79=_['first'](_0x283aab[_0x2022('0x20')]);}}if(_0x55ba79){logger[_0x2022('0xb')](_0x2022('0x2a'));return _0x55ba79;}else{logger[_0x2022('0xb')](_0x2022('0x2b'));return request({'uri':util[_0x2022('0xd')]('%s/users.json',_0x3e3d24[_0x2022('0xf')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x2022('0xd')]('Caller\x20-\x20%s',_0x2127f7||_0x2fc019),'phone':_0x2fc019}}})[_0x2022('0x17')](function(_0x49e8a2){logger['info'](_0x2022('0x2c'));return _0x49e8a2['user'];});}});}function getAuth(_0x2e183e){var _0x127135;if(_0x2e183e['authType']===_0x2022('0x2d')){_0x127135=util['format'](_0x2022('0x2e'),_0x2e183e[_0x2022('0x2f')],_0x2e183e[_0x2022('0x2d')]);}else if(_0x2e183e[_0x2022('0x30')]===_0x2022('0x31')){_0x127135=util[_0x2022('0xd')]('%s/token:%s',_0x2e183e[_0x2022('0x2f')],_0x2e183e['token']);}return util[_0x2022('0xd')]('Basic\x20%s',new Buffer(_0x127135)[_0x2022('0x32')](_0x2022('0x33')));}function request(_0xb1e9cf){logger[_0x2022('0x34')](_0x2022('0x35'),JSON[_0x2022('0x36')](_0xb1e9cf));return rp(_[_0x2022('0x37')](_0xb1e9cf,{'method':_0x2022('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x381632,_0x1f81e1){var _0x4077b1=[];if(_0x381632&&_0x381632[_0x2022('0x27')]>0x0){_0x4077b1=_[_0x2022('0x39')](_0x381632,_0x1f81e1);}return _0x4077b1;}function getCustomFields(_0x2adade,_0x12b2bc){var _0x3f759b=[];var _0x2e646e={'custom_fields':[]};if(_0x2adade[_0x2022('0x27')]>0x0){_['forEach'](_0x2adade,function(_0x224ca7){if(_[_0x2022('0x3a')]([_0x2022('0x3b'),'picklist'],_0x224ca7[_0x2022('0x3c')])&&_0x224ca7[_0x2022('0x3d')]&&!_0x224ca7[_0x2022('0x3e')]){_0x2e646e[_0x224ca7['nameField']['toLowerCase']()]=_0x224ca7[_0x2022('0x3f')][_0x2022('0x32')]();}else if(_[_0x2022('0x3a')]([_0x2022('0x3b'),_0x2022('0x40')],_0x224ca7[_0x2022('0x3c')])&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x2e646e['custom_fields'][_0x2022('0x42')]({'id':_0x224ca7['idField'],'value':_0x224ca7['content'][_0x2022('0x32')]()});}else if(_0x224ca7[_0x2022('0x3c')]===_0x2022('0x43')&&_0x224ca7[_0x2022('0x44')]&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x12b2bc[_0x224ca7[_0x2022('0x44')]]&&_0x2e646e[_0x2022('0x45')][_0x2022('0x42')]({'id':_0x224ca7[_0x2022('0x41')],'value':_0x12b2bc[_0x224ca7[_0x2022('0x44')]]['toString']()});}else if(_0x224ca7[_0x2022('0x3c')]===_0x2022('0x46')&&_0x224ca7['Variable']&&_0x224ca7['Variable']['name']&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x12b2bc[_0x224ca7[_0x2022('0x47')]['name'][_0x2022('0x48')]()]&&_0x2e646e[_0x2022('0x45')][_0x2022('0x42')]({'id':_0x224ca7[_0x2022('0x41')],'value':_0x12b2bc[_0x224ca7[_0x2022('0x47')][_0x2022('0x12')][_0x2022('0x48')]()]['toString']()});}});}return _0x2e646e;}exports['queue']=function(_0x1583c4,_0x19e518,_0x12b1e6,_0x145a6c,_0x2ca082,_0x31eae5){var _0x1e0c03,_0x2bc8ad;_0x31eae5[_0x2022('0xf')]=intUtil['stripTrailingSlash'](_0x31eae5[_0x2022('0xf')]);_0x31eae5['serverUrl']=intUtil['stripTrailingSlash'](_0x31eae5[_0x2022('0x49')]);if(_0x2ca082&&_0x2ca082['monitor_format']){logger[_0x2022('0xb')](_0x2022('0x4a'),'Recording\x20is\x20enabled!');_0x19e518[_0x2022('0x4b')]=util[_0x2022('0xd')](_0x2022('0x4c'),_0x31eae5[_0x2022('0x49')],_0x19e518[_0x2022('0x4d')],md5(_0x19e518[_0x2022('0x4d')]));}else{_0x19e518[_0x2022('0x4b')]='';}headers[_0x2022('0x4e')]=getAuth(_0x31eae5);return getUser(_0x31eae5,_0x145a6c[_0x2022('0x4f')])['then'](function(_0x2b531b){_0x1e0c03=_0x2b531b;logger['info'](_0x2022('0x50'),_0x1e0c03['id']);return getEndUser(_0x31eae5,_0x19e518[_0x2022('0x51')],_0x19e518[_0x2022('0x52')]);})[_0x2022('0x17')](function(_0x40639b){_0x2bc8ad=_0x40639b;logger[_0x2022('0xb')](_0x2022('0x53'),_0x2bc8ad['id']);return getTicket(_0x31eae5,_0x1e0c03,_0x2bc8ad,_0x12b1e6,_0x19e518);})['then'](function(_0x1ac68d){if(_0x1ac68d){logger[_0x2022('0xb')](_0x2022('0x54'),_0x1ac68d['id']);switch(_0x31eae5[_0x2022('0x3c')]){case _0x2022('0x55'):logger[_0x2022('0xb')](_0x2022('0x4a'),_0x2022('0x56'));return request({'uri':util['format'](_0x2022('0x57'),_0x31eae5['remoteUri'],_0x1e0c03['id'],_0x1ac68d['id']),'method':_0x2022('0x58')});case _0x2022('0x59'):logger['info'](_0x2022('0x4a'),_0x2022('0x5a'));emit(util['format'](_0x2022('0x5b'),_0x145a6c[_0x2022('0x12')]),_0x2022('0x5c'),{'uri':util['format'](_0x2022('0x5d'),_0x31eae5[_0x2022('0xf')][_0x2022('0x5e')]('/api/v2',''),_0x1ac68d['id'])});break;default:logger[_0x2022('0x5f')]('[QUEUE]',_0x2022('0x60'));}}})['catch'](function(_0x2dbbfb){logger[_0x2022('0x5f')](_0x2022('0x61'),util[_0x2022('0x62')](_0x2dbbfb,{'showHidden':!![],'depth':null}));});};exports[_0x2022('0x63')]=function(_0x2dd757,_0x53e017,_0x2d5890,_0x175eb5,_0x2aff37,_0x1bd304,_0x12d83c){var _0x29ca5d,_0x217974;_0x1bd304[_0x2022('0xf')]=intUtil[_0x2022('0x64')](_0x1bd304[_0x2022('0xf')]);_0x1bd304[_0x2022('0x49')]=intUtil[_0x2022('0x64')](_0x1bd304[_0x2022('0x49')]);if(_0x12d83c&&_0x12d83c[_0x2022('0x65')]&&_0x12d83c[_0x2022('0x65')]!==_0x2022('0x66')){logger[_0x2022('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x53e017[_0x2022('0x4b')]=util[_0x2022('0xd')](_0x2022('0x4c'),_0x1bd304['serverUrl'],_0x53e017[_0x2022('0x4d')],md5(_0x53e017[_0x2022('0x4d')]));}headers[_0x2022('0x4e')]=getAuth(_0x1bd304);return getUser(_0x1bd304,_0x175eb5['email'])[_0x2022('0x17')](function(_0x2fca20){_0x29ca5d=_0x2fca20;logger['info'](_0x2022('0x50'),_0x29ca5d['id']);return getEndUser(_0x1bd304,_0x53e017[_0x2022('0x67')],_0x53e017['destcalleridnum']);})[_0x2022('0x17')](function(_0x1a0af9){_0x217974=_0x1a0af9;logger['info'](_0x2022('0x53'),_0x217974['id']);return getTicket(_0x1bd304,_0x29ca5d,_0x217974,_0x2d5890,_0x53e017);})[_0x2022('0x17')](function(_0x2c719e){if(_0x2c719e){logger[_0x2022('0xb')](_0x2022('0x54'),_0x2c719e['id']);switch(_0x1bd304['type']){case'integrationTab':logger[_0x2022('0xb')](_0x2022('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2022('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1bd304[_0x2022('0xf')],_0x29ca5d['id'],_0x2c719e['id']),'method':_0x2022('0x58')});case'newTab':logger[_0x2022('0xb')]('[OUTBOUND]',_0x2022('0x5a'));emit(util[_0x2022('0xd')]('user:%s',_0x175eb5[_0x2022('0x12')]),_0x2022('0x5c'),{'uri':util['format'](_0x2022('0x5d'),_0x1bd304['remoteUri'][_0x2022('0x5e')](_0x2022('0x69'),''),_0x2c719e['id'])});break;default:logger['error'](_0x2022('0x68'),_0x2022('0x60'));}}})[_0x2022('0x6a')](function(_0x6bafc7){logger[_0x2022('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2022('0x62')](_0x6bafc7,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1bace7,_0x190fcf,_0x268c8d,_0x3eda66,_0x3b4d19,_0x588a32){var _0x2cd90f,_0x485f82;_0x588a32[_0x2022('0xf')]=intUtil['stripTrailingSlash'](_0x588a32[_0x2022('0xf')]);_0x588a32[_0x2022('0x49')]=intUtil[_0x2022('0x64')](_0x588a32[_0x2022('0x49')]);if(_0x3b4d19&&_0x3b4d19['monitor_format']){logger[_0x2022('0xb')]('['+_0x190fcf['lastevent'][_0x2022('0x6b')]()+']',_0x2022('0x6c'));_0x190fcf['recordingURL']=util['format'](_0x2022('0x4c'),_0x588a32[_0x2022('0x49')],_0x190fcf['uniqueid'],md5(_0x190fcf[_0x2022('0x4d')]));}else{_0x190fcf[_0x2022('0x4b')]='';}headers[_0x2022('0x4e')]=getAuth(_0x588a32);return getUser(_0x588a32)[_0x2022('0x17')](function(_0x2f3fe3){_0x2cd90f=_0x2f3fe3;logger[_0x2022('0xb')](_0x2022('0x50'),_0x2cd90f['id']);return getEndUser(_0x588a32,_0x190fcf[_0x2022('0x51')],_0x190fcf[_0x2022('0x52')]);})[_0x2022('0x17')](function(_0x44ec07){_0x485f82=_0x44ec07;logger[_0x2022('0xb')](_0x2022('0x53'),_0x485f82['id']);return getTicket(_0x588a32,_0x2cd90f,_0x485f82,_0x268c8d,_0x190fcf);})[_0x2022('0x17')](function(_0x48e871){if(_0x48e871){logger[_0x2022('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48e871['id']);}})[_0x2022('0x6a')](function(_0x4b0e11){logger[_0x2022('0x5f')]('['+_0x190fcf[_0x2022('0x6d')]['toUpperCase']()+']'+_0x2022('0x6e'),util[_0x2022('0x62')](_0x4b0e11,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb9f8=['Searching\x20enduser\x20with\x20phone','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xb9f8,0xc7));var _0x8b9f=function(_0x28ad9c,_0x19d2d2){_0x28ad9c=_0x28ad9c-0x0;var _0x432523=_0xb9f8[_0x28ad9c];return _0x432523;};'use strict';var _=require(_0x8b9f('0x0'));var rp=require(_0x8b9f('0x1'));var md5=require(_0x8b9f('0x2'));var util=require(_0x8b9f('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8b9f('0x4'));var config=require(_0x8b9f('0x5'));var logger=require(_0x8b9f('0x6'))('zendesk');config[_0x8b9f('0x7')]=_[_0x8b9f('0x8')](config[_0x8b9f('0x7')],{'host':_0x8b9f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b9f('0x7')]));function emit(_0x1625f2,_0x462a18,_0x3959f7){io['to'](_0x1625f2)['emit'](_0x462a18,_0x3959f7);}var headers={'Content-Type':_0x8b9f('0xa'),'Accept':_0x8b9f('0xa')};function getTicket(_0x549ac0,_0x40bdd1,_0x5aeb73,_0x1cb20e,_0x54604b){logger[_0x8b9f('0xb')](_0x8b9f('0xc'));return request({'uri':util[_0x8b9f('0xd')](_0x8b9f('0xe'),_0x549ac0[_0x8b9f('0xf')]),'method':_0x8b9f('0x10'),'body':{'ticket':_[_0x8b9f('0x11')]({'requester_id':_0x5aeb73['id'],'submitter_id':_0x40bdd1?_0x40bdd1['id']:undefined,'assignee_id':_0x40bdd1?_0x40bdd1['id']:undefined,'tags':getTags(_0x1cb20e[_0x8b9f('0x12')],'name'),'subject':intUtil['getString'](_0x1cb20e[_0x8b9f('0x13')],_0x54604b,'\x20'),'description':intUtil[_0x8b9f('0x14')](_0x1cb20e['Descriptions'],_0x54604b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8b9f('0x14')](_0x1cb20e['Descriptions'],_0x54604b,'\x0a')}},getCustomFields(_0x1cb20e[_0x8b9f('0x15')],_0x54604b))}})[_0x8b9f('0x16')](function(_0x3a3c41){logger[_0x8b9f('0xb')](_0x8b9f('0x17'));return _0x3a3c41[_0x8b9f('0x18')];});}function getUser(_0x589417,_0x3ffa80){if(intUtil['validateEmail'](_0x3ffa80)){logger['info'](_0x8b9f('0x19'),_0x3ffa80);return request({'uri':util[_0x8b9f('0xd')](_0x8b9f('0x1a'),_0x589417[_0x8b9f('0xf')]),'qs':{'query':util[_0x8b9f('0xd')](_0x8b9f('0x1b'),_0x3ffa80)}})[_0x8b9f('0x16')](function(_0x4d3bd8){if(_0x4d3bd8[_0x8b9f('0x1c')]){logger[_0x8b9f('0xb')]('Agent\x20found!');return _[_0x8b9f('0x1d')](_0x4d3bd8['results'],{'email':_0x3ffa80,'role':_0x8b9f('0x1e')});}else{logger['info'](_0x8b9f('0x1f'));return request({'uri':util[_0x8b9f('0xd')]('%s/users/me.json',_0x589417[_0x8b9f('0xf')])})[_0x8b9f('0x16')](function(_0x2fa059){logger[_0x8b9f('0xb')](_0x8b9f('0x20'));return _0x2fa059[_0x8b9f('0x21')];});}});}else{logger[_0x8b9f('0xb')](_0x8b9f('0x1f'));return request({'uri':util[_0x8b9f('0xd')](_0x8b9f('0x22'),_0x589417['remoteUri'])})[_0x8b9f('0x16')](function(_0x3d92a2){logger[_0x8b9f('0xb')]('Admin\x20account\x20selected.');return _0x3d92a2[_0x8b9f('0x21')];});}}function getEndUser(_0x5a1aa2,_0x430ff3,_0x2d52e0){logger[_0x8b9f('0xb')](_0x8b9f('0x23'),_0x2d52e0);return request({'uri':util[_0x8b9f('0xd')](_0x8b9f('0x1a'),_0x5a1aa2['remoteUri']),'qs':{'query':util[_0x8b9f('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x2d52e0)}})[_0x8b9f('0x16')](function(_0x194765){var _0x571586;if(_0x194765[_0x8b9f('0x24')]['length']){_0x194765[_0x8b9f('0x24')]=_[_0x8b9f('0x25')](_0x194765['results'],{'suspended':![],'role':_0x8b9f('0x26')});if(_0x194765['results'][_0x8b9f('0x27')]){_0x571586=_[_0x8b9f('0x28')](_0x194765['results']);}}if(_0x571586){logger[_0x8b9f('0xb')](_0x8b9f('0x29'));return _0x571586;}else{logger[_0x8b9f('0xb')](_0x8b9f('0x2a'));return request({'uri':util['format']('%s/users.json',_0x5a1aa2[_0x8b9f('0xf')]),'method':'POST','body':{'user':{'role':_0x8b9f('0x26'),'name':util[_0x8b9f('0xd')](_0x8b9f('0x2b'),_0x430ff3||_0x2d52e0),'phone':_0x2d52e0}}})['then'](function(_0x3c5846){logger[_0x8b9f('0xb')](_0x8b9f('0x2c'));return _0x3c5846[_0x8b9f('0x21')];});}});}function getAuth(_0x79f7a9){var _0x5de879;if(_0x79f7a9[_0x8b9f('0x2d')]===_0x8b9f('0x2e')){_0x5de879=util[_0x8b9f('0xd')](_0x8b9f('0x2f'),_0x79f7a9[_0x8b9f('0x30')],_0x79f7a9['password']);}else if(_0x79f7a9['authType']==='token'){_0x5de879=util[_0x8b9f('0xd')](_0x8b9f('0x31'),_0x79f7a9[_0x8b9f('0x30')],_0x79f7a9[_0x8b9f('0x32')]);}return util[_0x8b9f('0xd')](_0x8b9f('0x33'),new Buffer(_0x5de879)[_0x8b9f('0x34')](_0x8b9f('0x35')));}function request(_0x3e04b1){logger[_0x8b9f('0x36')](_0x8b9f('0x37'),JSON[_0x8b9f('0x38')](_0x3e04b1));return rp(_[_0x8b9f('0x8')](_0x3e04b1,{'method':_0x8b9f('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x389edd,_0x1754da){var _0x1d1b54=[];if(_0x389edd&&_0x389edd[_0x8b9f('0x27')]>0x0){_0x1d1b54=_[_0x8b9f('0x3a')](_0x389edd,_0x1754da);}return _0x1d1b54;}function getCustomFields(_0x237e9d,_0x2b64e4){var _0x50ac55=[];var _0x5f2469={'custom_fields':[]};if(_0x237e9d[_0x8b9f('0x27')]>0x0){_[_0x8b9f('0x3b')](_0x237e9d,function(_0xda96a6){if(_[_0x8b9f('0x3c')]([_0x8b9f('0x3d'),_0x8b9f('0x3e')],_0xda96a6['type'])&&_0xda96a6[_0x8b9f('0x3f')]&&!_0xda96a6['customField']){_0x5f2469[_0xda96a6['nameField'][_0x8b9f('0x40')]()]=_0xda96a6[_0x8b9f('0x41')]['toString']();}else if(_['includes'](['string','picklist'],_0xda96a6[_0x8b9f('0x42')])&&_0xda96a6[_0x8b9f('0x43')]&&_0xda96a6[_0x8b9f('0x44')]){_0x5f2469[_0x8b9f('0x45')][_0x8b9f('0x46')]({'id':_0xda96a6['idField'],'value':_0xda96a6[_0x8b9f('0x41')][_0x8b9f('0x34')]()});}else if(_0xda96a6[_0x8b9f('0x42')]===_0x8b9f('0x47')&&_0xda96a6['variableName']&&_0xda96a6[_0x8b9f('0x43')]&&_0xda96a6['customField']){_0x2b64e4[_0xda96a6[_0x8b9f('0x48')]]&&_0x5f2469[_0x8b9f('0x45')]['push']({'id':_0xda96a6['idField'],'value':_0x2b64e4[_0xda96a6[_0x8b9f('0x48')]][_0x8b9f('0x34')]()});}else if(_0xda96a6['type']===_0x8b9f('0x49')&&_0xda96a6['Variable']&&_0xda96a6[_0x8b9f('0x4a')][_0x8b9f('0x4b')]&&_0xda96a6['idField']&&_0xda96a6[_0x8b9f('0x44')]){_0x2b64e4[_0xda96a6['Variable']['name'][_0x8b9f('0x40')]()]&&_0x5f2469[_0x8b9f('0x45')][_0x8b9f('0x46')]({'id':_0xda96a6['idField'],'value':_0x2b64e4[_0xda96a6[_0x8b9f('0x4a')]['name'][_0x8b9f('0x40')]()][_0x8b9f('0x34')]()});}});}return _0x5f2469;}exports[_0x8b9f('0x4c')]=function(_0x198a13,_0x2fe954,_0x661dad,_0x4dfbe4,_0x1543f1,_0x5385c5){var _0x494321,_0x5c8f62;_0x5385c5[_0x8b9f('0xf')]=intUtil[_0x8b9f('0x4d')](_0x5385c5[_0x8b9f('0xf')]);_0x5385c5[_0x8b9f('0x4e')]=intUtil[_0x8b9f('0x4d')](_0x5385c5['serverUrl']);if(_0x1543f1&&_0x1543f1[_0x8b9f('0x4f')]){logger[_0x8b9f('0xb')](_0x8b9f('0x50'),_0x8b9f('0x51'));_0x2fe954[_0x8b9f('0x52')]=util[_0x8b9f('0xd')](_0x8b9f('0x53'),_0x5385c5[_0x8b9f('0x4e')],_0x2fe954[_0x8b9f('0x54')],md5(_0x2fe954[_0x8b9f('0x54')]));}else{_0x2fe954[_0x8b9f('0x52')]='';}headers['Authorization']=getAuth(_0x5385c5);return getUser(_0x5385c5,_0x4dfbe4[_0x8b9f('0x55')])[_0x8b9f('0x16')](function(_0x266a94){_0x494321=_0x266a94;logger[_0x8b9f('0xb')](_0x8b9f('0x56'),_0x494321['id']);return getEndUser(_0x5385c5,_0x2fe954['calleridname'],_0x2fe954[_0x8b9f('0x57')]);})['then'](function(_0x2e84e6){_0x5c8f62=_0x2e84e6;logger['info'](_0x8b9f('0x58'),_0x5c8f62['id']);return getTicket(_0x5385c5,_0x494321,_0x5c8f62,_0x661dad,_0x2fe954);})[_0x8b9f('0x16')](function(_0x22e428){if(_0x22e428){logger[_0x8b9f('0xb')](_0x8b9f('0x59'),_0x22e428['id']);switch(_0x5385c5['type']){case _0x8b9f('0x5a'):logger[_0x8b9f('0xb')]('[QUEUE]',_0x8b9f('0x5b'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5385c5[_0x8b9f('0xf')],_0x494321['id'],_0x22e428['id']),'method':'POST'});case _0x8b9f('0x5c'):logger['info']('[QUEUE]',_0x8b9f('0x5d'));emit(util[_0x8b9f('0xd')](_0x8b9f('0x5e'),_0x4dfbe4['name']),_0x8b9f('0x5f'),{'uri':util[_0x8b9f('0xd')](_0x8b9f('0x60'),_0x5385c5[_0x8b9f('0xf')][_0x8b9f('0x61')]('/api/v2',''),_0x22e428['id'])});break;default:logger[_0x8b9f('0x62')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x6f611d){logger[_0x8b9f('0x62')](_0x8b9f('0x63'),util[_0x8b9f('0x64')](_0x6f611d,{'showHidden':!![],'depth':null}));});};exports[_0x8b9f('0x65')]=function(_0x43a62b,_0x46800c,_0x5208f8,_0x4beae5,_0x24b52b,_0x177ccd,_0x30795a){var _0x120b6b,_0x5b8143;_0x177ccd['remoteUri']=intUtil[_0x8b9f('0x4d')](_0x177ccd['remoteUri']);_0x177ccd[_0x8b9f('0x4e')]=intUtil[_0x8b9f('0x4d')](_0x177ccd[_0x8b9f('0x4e')]);if(_0x30795a&&_0x30795a[_0x8b9f('0x66')]&&_0x30795a[_0x8b9f('0x66')]!==_0x8b9f('0x67')){logger[_0x8b9f('0xb')](_0x8b9f('0x68'),_0x8b9f('0x51'));_0x46800c[_0x8b9f('0x52')]=util['format'](_0x8b9f('0x53'),_0x177ccd[_0x8b9f('0x4e')],_0x46800c[_0x8b9f('0x54')],md5(_0x46800c[_0x8b9f('0x54')]));}headers[_0x8b9f('0x69')]=getAuth(_0x177ccd);return getUser(_0x177ccd,_0x4beae5[_0x8b9f('0x55')])[_0x8b9f('0x16')](function(_0x537cd1){_0x120b6b=_0x537cd1;logger['info'](_0x8b9f('0x56'),_0x120b6b['id']);return getEndUser(_0x177ccd,_0x46800c[_0x8b9f('0x6a')],_0x46800c['destcalleridnum']);})[_0x8b9f('0x16')](function(_0x2b4e17){_0x5b8143=_0x2b4e17;logger[_0x8b9f('0xb')](_0x8b9f('0x58'),_0x5b8143['id']);return getTicket(_0x177ccd,_0x120b6b,_0x5b8143,_0x5208f8,_0x46800c);})[_0x8b9f('0x16')](function(_0xd5301e){if(_0xd5301e){logger[_0x8b9f('0xb')](_0x8b9f('0x59'),_0xd5301e['id']);switch(_0x177ccd[_0x8b9f('0x42')]){case'integrationTab':logger[_0x8b9f('0xb')]('[OUTBOUND]',_0x8b9f('0x5b'));return request({'uri':util[_0x8b9f('0xd')](_0x8b9f('0x6b'),_0x177ccd[_0x8b9f('0xf')],_0x120b6b['id'],_0xd5301e['id']),'method':_0x8b9f('0x10')});case _0x8b9f('0x5c'):logger['info']('[OUTBOUND]',_0x8b9f('0x5d'));emit(util[_0x8b9f('0xd')](_0x8b9f('0x5e'),_0x4beae5['name']),_0x8b9f('0x5f'),{'uri':util[_0x8b9f('0xd')]('%s/agent/tickets/%s',_0x177ccd[_0x8b9f('0xf')][_0x8b9f('0x61')](_0x8b9f('0x6c'),''),_0xd5301e['id'])});break;default:logger[_0x8b9f('0x62')](_0x8b9f('0x68'),_0x8b9f('0x6d'));}}})[_0x8b9f('0x6e')](function(_0x49d4c8){logger['error'](_0x8b9f('0x6f'),util[_0x8b9f('0x64')](_0x49d4c8,{'showHidden':!![],'depth':null}));});};exports[_0x8b9f('0x70')]=function(_0x4fc94f,_0x5be0d7,_0x9f21ac,_0x1c19cf,_0x1b56e2,_0x1361e6){var _0x32c089,_0x23cbf6;_0x1361e6[_0x8b9f('0xf')]=intUtil['stripTrailingSlash'](_0x1361e6[_0x8b9f('0xf')]);_0x1361e6[_0x8b9f('0x4e')]=intUtil['stripTrailingSlash'](_0x1361e6['serverUrl']);if(_0x1b56e2&&_0x1b56e2[_0x8b9f('0x4f')]){logger['info']('['+_0x5be0d7[_0x8b9f('0x71')][_0x8b9f('0x72')]()+']',_0x8b9f('0x51'));_0x5be0d7['recordingURL']=util[_0x8b9f('0xd')](_0x8b9f('0x53'),_0x1361e6[_0x8b9f('0x4e')],_0x5be0d7[_0x8b9f('0x54')],md5(_0x5be0d7[_0x8b9f('0x54')]));}else{_0x5be0d7[_0x8b9f('0x52')]='';}headers[_0x8b9f('0x69')]=getAuth(_0x1361e6);return getUser(_0x1361e6)[_0x8b9f('0x16')](function(_0x121f30){_0x32c089=_0x121f30;logger[_0x8b9f('0xb')](_0x8b9f('0x56'),_0x32c089['id']);return getEndUser(_0x1361e6,_0x5be0d7[_0x8b9f('0x73')],_0x5be0d7[_0x8b9f('0x57')]);})[_0x8b9f('0x16')](function(_0x501fb7){_0x23cbf6=_0x501fb7;logger[_0x8b9f('0xb')](_0x8b9f('0x58'),_0x23cbf6['id']);return getTicket(_0x1361e6,_0x32c089,_0x23cbf6,_0x9f21ac,_0x5be0d7);})[_0x8b9f('0x16')](function(_0x2dd54d){if(_0x2dd54d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2dd54d['id']);}})[_0x8b9f('0x6e')](function(_0x2f1948){logger['error']('['+_0x5be0d7[_0x8b9f('0x71')][_0x8b9f('0x72')]()+']'+_0x8b9f('0x74'),util[_0x8b9f('0x64')](_0x2f1948,{'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 2e126b0..9800f5a 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 _0x4f88=['profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','enduserType','log','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','host','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','The\x20Call\x20ID\x20is:','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','Recording\x20is\x20enabled!','toUpperCase','lodash','request-promise','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','then','seconds','catch','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f88,0xf3));var _0x84f8=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x4f88[_0x59b2a1];return _0x4908d1;};'use strict';var _=require(_0x84f8('0x0'));var rp=require(_0x84f8('0x1'));var md5=require('md5');var util=require(_0x84f8('0x2'));var intUtil=require(_0x84f8('0x3'));var moment=require(_0x84f8('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x84f8('0x5'));var logger=require(_0x84f8('0x6'))(_0x84f8('0x7'));config[_0x84f8('0x8')]=_[_0x84f8('0x9')](config[_0x84f8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x84f8('0xa'))(new Redis(config[_0x84f8('0x8')]));function emit(_0x4ae430,_0x4a09d3,_0x3f2c92){io['to'](_0x4ae430)[_0x84f8('0xb')](_0x4a09d3,_0x3f2c92);}function request(_0x432edd){logger[_0x84f8('0xc')](_0x84f8('0xd'),JSON[_0x84f8('0xe')](_0x432edd));return rp(_0x432edd);}function getCustomFields(_0x46243d,_0x79fd17){var _0x51cffb={};if(_0x46243d['length']>0x0){_[_0x84f8('0xf')](_0x46243d,function(_0x3b6539){if(_[_0x84f8('0x10')]([_0x84f8('0x11'),_0x84f8('0x12')],_0x3b6539['type'])&&_0x3b6539[_0x84f8('0x13')]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x3b6539[_0x84f8('0x14')][_0x84f8('0x15')]();}else if(_0x3b6539[_0x84f8('0x16')]==='variable'&&_0x3b6539[_0x84f8('0x17')]&&_0x3b6539[_0x84f8('0x13')]&&_0x79fd17[_0x3b6539[_0x84f8('0x17')]]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x79fd17[_0x3b6539['variableName']][_0x84f8('0x15')]();}else if(_0x3b6539['type']===_0x84f8('0x18')&&_0x3b6539[_0x84f8('0x19')]&&_0x3b6539[_0x84f8('0x19')]['name']&&_0x3b6539[_0x84f8('0x13')]&&_0x79fd17[_0x3b6539[_0x84f8('0x19')][_0x84f8('0x1a')][_0x84f8('0x1b')]()]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x79fd17[_0x3b6539[_0x84f8('0x19')]['name'][_0x84f8('0x1b')]()][_0x84f8('0x15')]();}});}return _0x51cffb;}function getName(_0x20c99d){if(_0x20c99d['indexOf']('\x20')>0x0){var _0x51092d=_0x20c99d[_0x84f8('0x1c')](/ (.+)/);if(_0x51092d[0x1]){return _0x51092d;}}return[_0x20c99d,_0x20c99d];}var accountsTokens={};function getAccessToken(_0x5ecb0d){return new Promise(function(_0x224909,_0x44ee39){if(!_[_0x84f8('0x1d')](accountsTokens[_0x5ecb0d['id']])&&!_[_0x84f8('0x1d')](accountsTokens[_0x5ecb0d['id']]['access_token'])){if(moment()[_0x84f8('0x1e')](accountsTokens[_0x5ecb0d['id']][_0x84f8('0x1f')])){_0x224909(accountsTokens[_0x5ecb0d['id']][_0x84f8('0x20')]);}}var _0x2d5c99;switch(_0x5ecb0d['zone']){case'US':_0x2d5c99=_0x84f8('0x21');break;case'AU':_0x2d5c99=_0x84f8('0x22');break;case'EU':_0x2d5c99=_0x84f8('0x23');break;case'IN':_0x2d5c99='https://accounts.zoho.in';break;case'CN':_0x2d5c99=_0x84f8('0x24');break;default:_0x2d5c99=_0x84f8('0x23');break;}var _0x230ea3={'method':_0x84f8('0x25'),'uri':_0x2d5c99+_0x84f8('0x26'),'qs':{'refresh_token':_0x5ecb0d['refreshToken'],'client_id':_0x5ecb0d[_0x84f8('0x27')],'client_secret':_0x5ecb0d['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x230ea3)[_0x84f8('0x28')](function(_0x17123a){accountsTokens[_0x5ecb0d['id']]={'access_token':_0x17123a[_0x84f8('0x20')],'expires_in':moment()['add'](_0x17123a[_0x84f8('0x1f')],_0x84f8('0x29'))};_0x224909(_0x17123a['access_token']);})[_0x84f8('0x2a')](function(_0x255d10){logger['error']('Failing\x20creating\x20the\x20access_token',_0x255d10[_0x84f8('0x2b')]);_0x44ee39(_0x255d10);});});}function getUser(_0x32d5e7,_0x826794,_0x262a31,_0x5d839e){logger[_0x84f8('0x2c')](_0x84f8('0x2d'));return request({'method':_0x84f8('0x2e'),'uri':util[_0x84f8('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x826794),'qs':{'type':_0x84f8('0x30')},'headers':{'Authorization':_0x84f8('0x31')+_0x32d5e7},'json':!![]})[_0x84f8('0x28')](function(_0x407dee){if(_0x407dee['users']){var _0x506c08=-0x1;if(_['isArrayLikeObject'](_0x407dee[_0x84f8('0x32')])){if(!_[_0x84f8('0x1d')](_0x5d839e)){_0x506c08=_[_0x84f8('0x33')](_0x407dee[_0x84f8('0x32')],function(_0xc2a605){return _0xc2a605[_0x84f8('0x34')]===_0x5d839e;});}if(_0x506c08>=0x0){logger[_0x84f8('0x2c')](_0x84f8('0x35'));}else{logger[_0x84f8('0x2c')](_0x84f8('0x36'));_0x506c08=_[_0x84f8('0x33')](_0x407dee[_0x84f8('0x32')],function(_0xb4b03a){return _0xb4b03a[_0x84f8('0x37')][_0x84f8('0x1a')]===_0x84f8('0x38');});}return _0x407dee['users'][_0x506c08];}else{if(_0x407dee[_0x84f8('0x39')]['profile'][_0x84f8('0x1a')]===_0x84f8('0x38')){logger['info'](_0x84f8('0x36'));user=_0x407dee[_0x84f8('0x39')];return user;}else{logger[_0x84f8('0x3a')]('The\x20failing\x20result\x20is',JSON[_0x84f8('0xe')](_0x407dee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x407dee));}}}else{logger['error'](_0x84f8('0x3b'),JSON[_0x84f8('0xe')](_0x407dee));throw new Error(_0x84f8('0x3c')+JSON[_0x84f8('0xe')](_0x407dee));}})[_0x84f8('0x2a')](function(_0x1bdcd3){console[_0x84f8('0x3a')](_0x1bdcd3);});}function getZohoUser(_0x3a54c2,_0x43ccf4){return new BPromise(function(_0x3d105a,_0x1025b8){request(_0x3a54c2)[_0x84f8('0x28')](function(_0x1bb75f){var _0x472a05=null;if(_0x1bb75f){_0x472a05=_0x1bb75f[_0x84f8('0x3d')][0x0];_0x472a05['enduserType']=_0x43ccf4;}_0x3d105a(_0x472a05);})[_0x84f8('0x2a')](function(_0x423168){_0x1025b8(_0x423168);});});}function createEndUser(_0x2ff8c8,_0x544e0a,_0x13fd0e,_0x43a9b6,_0x51284e,_0x57f0e6){var _0x13fd0e=getName(_0x13fd0e);return request({'method':_0x84f8('0x25'),'uri':_0x84f8('0x3e')+_0x544e0a+_0x84f8('0x3f')+_[_0x84f8('0x40')](_0x57f0e6[_0x84f8('0x41')])+'s','body':{'data':[{'Last_Name':_0x13fd0e[0x1],'First_Name':_0x13fd0e[0x0],'Phone':_0x43a9b6,'Owner':{'name':!_['isNil'](_0x51284e[_0x84f8('0x42')]['name'])?_0x51284e[_0x84f8('0x42')][_0x84f8('0x1a')]:!_[_0x84f8('0x1d')](_0x51284e['first_name'])?_0x51284e[_0x84f8('0x43')]+'\x20'+_0x51284e['last_name']:_0x51284e['last_name'],'id':_0x51284e['id']}}]},'headers':{'Authorization':_0x84f8('0x31')+_0x2ff8c8},'json':!![]})['then'](function(_0x224cc0){if(_0x224cc0&&_0x224cc0[_0x84f8('0x3d')][0x0][_0x84f8('0x44')]===_0x84f8('0x45')){var _0x21ea0b=_0x224cc0['data'][0x0][_0x84f8('0x46')];_0x21ea0b[_0x84f8('0x47')]=_[_0x84f8('0x40')](_0x57f0e6[_0x84f8('0x41')])+'s';return _0x21ea0b;}logger['error'](_0x84f8('0x3b'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x84f8('0xe')](data));})[_0x84f8('0x2a')](function(_0x2861c5){console[_0x84f8('0x48')]('CREATE\x20ERROR',_0x2861c5);});}function getEndUser(_0xbc0efd,_0x1d1f12,_0x4f8e3e,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473){var _0x4d8e1b={'method':_0x84f8('0x2e'),'uri':'','headers':{'Authorization':_0x84f8('0x31')+_0xbc0efd},'json':!![]};switch(_0x30f473['moduleSearch']){case'contact_lead':_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4a')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4b'))['then'](function(_0x363bd8){if(_0x363bd8)return _0x363bd8;_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4c')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4d'))[_0x84f8('0x28')](function(_0x449cf2){if(_0x449cf2)return _0x449cf2;if(_0x30f473[_0x84f8('0x41')]!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});});break;case _0x84f8('0x4f'):_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4a')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4b'))[_0x84f8('0x28')](function(_0x3e9b4d){if(_0x3e9b4d)return _0x3e9b4d;if(_0x30f473[_0x84f8('0x41')]!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});break;case'lead':_0x4d8e1b['uri']='https://www.zohoapis.'+_0x1d1f12+_0x84f8('0x4c')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,'Leads')[_0x84f8('0x28')](function(_0x3a67f1){if(_0x3a67f1)return _0x3a67f1;if(_0x30f473['moduleCreate']!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});break;}}function getCall(_0x212e2e,_0x3ef66b,_0x11d392,_0x4230bd,_0x47e60d,_0x4e41ae,_0x2e453a,_0x57ca09){logger[_0x84f8('0x2c')](_0x84f8('0x50'));var _0xe6c4fe={};_0xe6c4fe[_0x84f8('0x51')]={'name':!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x42')][_0x84f8('0x1a')])&&!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x37')][_0x84f8('0x1a')])&&_0x4230bd[_0x84f8('0x37')]['name']===_0x84f8('0x52')?_0x4230bd['role'][_0x84f8('0x1a')]:!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x43')])?_0x4230bd[_0x84f8('0x43')]+'\x20'+_0x4230bd[_0x84f8('0x53')]:_0x4230bd[_0x84f8('0x53')],'id':_0x4230bd['id']};_0xe6c4fe[_0x84f8('0x54')]=intUtil['getString'](_0x4e41ae[_0x84f8('0x55')],_0x2e453a,'\x20');_0xe6c4fe[_0x84f8('0x56')]=intUtil['getString'](_0x4e41ae[_0x84f8('0x57')],_0x2e453a,'\x0a');if(_0x47e60d[_0x84f8('0x47')]===_0x84f8('0x4b')){_0xe6c4fe[_0x84f8('0x58')]={'name':!_[_0x84f8('0x1d')](_0x47e60d[_0x84f8('0x59')])?_0x47e60d[_0x84f8('0x59')]:!_['isNil'](_0x47e60d[_0x84f8('0x5a')])?_0x47e60d[_0x84f8('0x5a')]+'\x20'+_0x47e60d['Last_Name']:_0x47e60d[_0x84f8('0x5b')],'id':_0x47e60d['id']};}if(_0x47e60d[_0x84f8('0x47')]===_0x84f8('0x4d')){_0xe6c4fe['What_Id']={'name':!_[_0x84f8('0x1d')](_0x47e60d[_0x84f8('0x59')])?_0x47e60d[_0x84f8('0x59')]:!_[_0x84f8('0x1d')](_0x47e60d['First_Name'])?_0x47e60d[_0x84f8('0x5a')]+'\x20'+_0x47e60d[_0x84f8('0x5b')]:_0x47e60d[_0x84f8('0x5b')],'id':_0x47e60d['id']};_0xe6c4fe[_0x84f8('0x5c')]=_[_0x84f8('0x40')](_0x47e60d[_0x84f8('0x47')]);}if(_0x2e453a[_0x84f8('0x5d')]){_0xe6c4fe[_0x84f8('0x5e')]=moment[_0x84f8('0x5f')](parseInt(_0x2e453a[_0x84f8('0x5d')])*0x3e8)[_0x84f8('0x2f')]('mm:ss');}else if(_0x2e453a[_0x84f8('0x60')]&&_0x2e453a[_0x84f8('0x61')]){_0xe6c4fe[_0x84f8('0x5e')]=moment[_0x84f8('0x5f')](moment(_0x2e453a[_0x84f8('0x61')],_0x84f8('0x62'))[_0x84f8('0x63')](moment(_0x2e453a[_0x84f8('0x64')],_0x84f8('0x62'))))['format'](_0x84f8('0x65'));}switch(_0x2e453a[_0x84f8('0x66')]){case _0x84f8('0x67'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x69');break;case _0x84f8('0x6a'):case _0x84f8('0x6b'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x6c');break;case'rejected':_0xe6c4fe['Call_Result']=_0x84f8('0x6d');break;case'abandoned':_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x6e');break;case _0x84f8('0x6f'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x70');default:}_0xe6c4fe['Call_Start_Time']=(_0x57ca09===_0x84f8('0x71')?moment(_0x2e453a[_0x84f8('0x64')])[_0x84f8('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2e453a[_0x84f8('0x72')])['format'](_0x84f8('0x62')))||moment()['format'](_0x84f8('0x62'));_0xe6c4fe[_0x84f8('0x73')]=_0x57ca09||_0x84f8('0x74');_0xe6c4fe=_[_0x84f8('0x75')](_0xe6c4fe,getCustomFields(_0x4e41ae[_0x84f8('0x76')],_0x2e453a));return request({'method':_0x84f8('0x25'),'uri':_0x84f8('0x3e')+_0x3ef66b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x212e2e},'body':{'data':[_0xe6c4fe]},'json':!![]})[_0x84f8('0x28')](function(_0xdd821b){if(_0xdd821b&&_0xdd821b[_0x84f8('0x3d')][0x0][_0x84f8('0x44')]===_0x84f8('0x45')){logger[_0x84f8('0x2c')](_0x84f8('0x77'));return{'id':_0xdd821b[_0x84f8('0x3d')][0x0][_0x84f8('0x46')]['id']};}})[_0x84f8('0x2a')](function(_0x1d900c){logger[_0x84f8('0x2c')]('err',_0x1d900c[_0x84f8('0x2b')]);console[_0x84f8('0x48')](_0x84f8('0x78'),_0x1d900c);});}exports[_0x84f8('0x79')]=function(_0x16a8a4,_0x290d06,_0x59b976,_0x2e6964,_0x2d1e29,_0x213a28){var _0x5c90f7,_0x3ee3a3,_0x3b8b48;_0x213a28['host']=intUtil[_0x84f8('0x7a')](_0x213a28['host']);_0x213a28[_0x84f8('0x7b')]=intUtil[_0x84f8('0x7a')](_0x213a28[_0x84f8('0x7b')]);if(_0x2d1e29&&_0x2d1e29['monitor_format']){logger['info'](_0x84f8('0x7c'),'Recording\x20is\x20enabled!');_0x290d06['recordingURL']=_0x213a28['serverUrl']+_0x84f8('0x7d')+_0x290d06[_0x84f8('0x7e')]+_0x84f8('0x7f')+md5(_0x290d06[_0x84f8('0x7e')]);}else{_0x290d06[_0x84f8('0x80')]='';}var _0x3536d2=_0x213a28['host']===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x213a28)[_0x84f8('0x28')](function(_0x216dde){_0x3b8b48=_0x216dde;return getUser(_0x3b8b48,_0x3536d2,_0x213a28,_0x2e6964[_0x84f8('0x34')]);})[_0x84f8('0x28')](function(_0x32bb4e){_0x5c90f7=_0x32bb4e;logger[_0x84f8('0x2c')](_0x84f8('0x83'),_0x5c90f7['id']);return getEndUser(_0x3b8b48,_0x3536d2,_0x213a28,_0x290d06[_0x84f8('0x84')],_0x290d06[_0x84f8('0x85')],_0x5c90f7,_0x59b976);})[_0x84f8('0x28')](function(_0x36e001){_0x3ee3a3=_0x36e001;return getCall(_0x3b8b48,_0x3536d2,_0x213a28,_0x5c90f7,_0x3ee3a3,_0x59b976,_0x290d06,_0x84f8('0x74'));})[_0x84f8('0x28')](function(_0x61d96f){if(_0x61d96f){logger[_0x84f8('0x2c')]('The\x20Call\x20ID\x20is:',_0x61d96f['id']);logger[_0x84f8('0x2c')](_0x84f8('0x7c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x84f8('0x2f')](_0x84f8('0x86'),_0x2e6964['name']),_0x84f8('0x87'),{'uri':_0x84f8('0x88')+_0x213a28[_0x84f8('0x89')]+_0x84f8('0x8a')+_0x61d96f['id']});}})[_0x84f8('0x2a')](function(_0x137989){logger[_0x84f8('0x3a')](_0x84f8('0x7c'),JSON['stringify'](_0x137989));});};exports['outbound']=function(_0x669946,_0x4dc4ad,_0x5cfb3c,_0x45662c,_0x28142e,_0x462be9,_0xf412dc){var _0x1b1419,_0x30fc98,_0x3357c6;_0x462be9[_0x84f8('0x89')]=intUtil[_0x84f8('0x7a')](_0x462be9[_0x84f8('0x89')]);_0x462be9['serverUrl']=intUtil['stripTrailingSlash'](_0x462be9[_0x84f8('0x7b')]);if(_0xf412dc&&_0xf412dc[_0x84f8('0x8b')]&&_0xf412dc[_0x84f8('0x8b')]!==_0x84f8('0x8c')){logger[_0x84f8('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4dc4ad[_0x84f8('0x80')]=_0x462be9[_0x84f8('0x7b')]+_0x84f8('0x7d')+_0x4dc4ad['uniqueid']+_0x84f8('0x7f')+md5(_0x4dc4ad['uniqueid']);}var _0x5437a4=_0x462be9['host']===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x462be9)['then'](function(_0x27d4e8){_0x3357c6=_0x27d4e8;return getUser(_0x3357c6,_0x5437a4,_0x462be9,_0x45662c[_0x84f8('0x34')]);})[_0x84f8('0x28')](function(_0xccead){_0x1b1419=_0xccead;logger['info'](_0x84f8('0x83'),_0x1b1419['id']);return getEndUser(_0x3357c6,_0x5437a4,_0x462be9,_0x4dc4ad[_0x84f8('0x8d')],_0x4dc4ad['destcalleridnum'],_0x1b1419,_0x5cfb3c);})[_0x84f8('0x28')](function(_0x12c643){_0x30fc98=_0x12c643;return getCall(_0x3357c6,_0x5437a4,_0x462be9,_0x1b1419,_0x30fc98,_0x5cfb3c,_0x4dc4ad,'Outbound');})[_0x84f8('0x28')](function(_0x10e85c){if(_0x10e85c){logger[_0x84f8('0x2c')](_0x84f8('0x8e'),_0x10e85c['id']);logger[_0x84f8('0x2c')](_0x84f8('0x8f'),_0x84f8('0x90'));emit(util['format'](_0x84f8('0x86'),_0x45662c['name']),_0x84f8('0x87'),{'uri':_0x84f8('0x88')+_0x462be9[_0x84f8('0x89')]+_0x84f8('0x8a')+_0x10e85c['id']});}})[_0x84f8('0x2a')](function(_0x2675f5){logger['error'](_0x84f8('0x8f'),JSON['stringify'](_0x2675f5));});};exports[_0x84f8('0x91')]=function(_0x461d67,_0x11b764,_0x122f21,_0x31272f,_0x3dedb2,_0x5d246f){var _0x3328fa,_0x3f5d70,_0x131387;_0x5d246f[_0x84f8('0x89')]=intUtil[_0x84f8('0x7a')](_0x5d246f[_0x84f8('0x89')]);_0x5d246f[_0x84f8('0x7b')]=intUtil[_0x84f8('0x7a')](_0x5d246f[_0x84f8('0x7b')]);if(_0x3dedb2&&_0x3dedb2[_0x84f8('0x92')]){logger[_0x84f8('0x2c')]('['+_0x11b764[_0x84f8('0x66')]['toUpperCase']()+']',_0x84f8('0x93'));_0x11b764['recordingURL']=_0x5d246f['serverUrl']+'/api/voice/recordings/'+_0x11b764[_0x84f8('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x11b764[_0x84f8('0x7e')]);}else{_0x11b764[_0x84f8('0x80')]='';}var _0x4aa01d=_0x5d246f[_0x84f8('0x89')]===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x5d246f)[_0x84f8('0x28')](function(_0x1283ef){_0x131387=_0x1283ef;return getUser(_0x131387,_0x4aa01d,_0x5d246f);})[_0x84f8('0x28')](function(_0x5a49d9){_0x3328fa=_0x5a49d9;logger[_0x84f8('0x2c')](_0x84f8('0x83'),_0x3328fa['id']);return getEndUser(_0x131387,_0x4aa01d,_0x5d246f,_0x11b764[_0x84f8('0x84')],_0x11b764[_0x84f8('0x85')],_0x3328fa,_0x122f21);})[_0x84f8('0x28')](function(_0x10ab65){_0x3f5d70=_0x10ab65;return getCall(_0x131387,_0x4aa01d,_0x5d246f,_0x3328fa,_0x3f5d70,_0x122f21,_0x11b764,_0x84f8('0x74'));})[_0x84f8('0x28')](function(_0x45a35b){if(_0x45a35b){logger[_0x84f8('0x2c')]('The\x20Call\x20ID\x20is:',_0x45a35b['id']);}})['catch'](function(_0x3bafdf){logger[_0x84f8('0x3a')]('['+_0x11b764[_0x84f8('0x66')][_0x84f8('0x94')]()+']',JSON[_0x84f8('0xe')](_0x3bafdf));});}; \ No newline at end of file +var _0xca57=['[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','zoho.eu','com','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','request-promise','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','abandoned','Abandoned','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat'];(function(_0x3f81af,_0x3a5250){var _0x5e376a=function(_0x4bb366){while(--_0x4bb366){_0x3f81af['push'](_0x3f81af['shift']());}};_0x5e376a(++_0x3a5250);}(_0xca57,0x1d5));var _0x7ca5=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xca57[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x7ca5('0x0'));var rp=require(_0x7ca5('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x7ca5('0x2'));var moment=require(_0x7ca5('0x3'));var Redis=require(_0x7ca5('0x4'));var BPromise=require('bluebird');var config=require(_0x7ca5('0x5'));var logger=require(_0x7ca5('0x6'))(_0x7ca5('0x7'));config[_0x7ca5('0x8')]=_['defaults'](config[_0x7ca5('0x8')],{'host':_0x7ca5('0x9'),'port':0x18eb});var io=require(_0x7ca5('0xa'))(new Redis(config[_0x7ca5('0x8')]));function emit(_0x75d51a,_0x2f0b07,_0x286a14){io['to'](_0x75d51a)['emit'](_0x2f0b07,_0x286a14);}function request(_0x9c227e){logger[_0x7ca5('0xb')](_0x7ca5('0xc'),JSON[_0x7ca5('0xd')](_0x9c227e));return rp(_0x9c227e);}function getCustomFields(_0x2d7da4,_0xef60f8){var _0x38ed4d={};if(_0x2d7da4[_0x7ca5('0xe')]>0x0){_[_0x7ca5('0xf')](_0x2d7da4,function(_0x4af35c){if(_['includes'](['string',_0x7ca5('0x10')],_0x4af35c[_0x7ca5('0x11')])&&_0x4af35c[_0x7ca5('0x12')]){_0x38ed4d[_0x4af35c['idField']]=_0x4af35c[_0x7ca5('0x13')][_0x7ca5('0x14')]();}else if(_0x4af35c['type']===_0x7ca5('0x15')&&_0x4af35c[_0x7ca5('0x16')]&&_0x4af35c['idField']&&_0xef60f8[_0x4af35c[_0x7ca5('0x16')]]){_0x38ed4d[_0x4af35c[_0x7ca5('0x12')]]=_0xef60f8[_0x4af35c[_0x7ca5('0x16')]]['toString']();}else if(_0x4af35c[_0x7ca5('0x11')]===_0x7ca5('0x17')&&_0x4af35c[_0x7ca5('0x18')]&&_0x4af35c[_0x7ca5('0x18')][_0x7ca5('0x19')]&&_0x4af35c[_0x7ca5('0x12')]&&_0xef60f8[_0x4af35c[_0x7ca5('0x18')]['name']['toLowerCase']()]){_0x38ed4d[_0x4af35c[_0x7ca5('0x12')]]=_0xef60f8[_0x4af35c['Variable'][_0x7ca5('0x19')][_0x7ca5('0x1a')]()][_0x7ca5('0x14')]();}});}return _0x38ed4d;}function getName(_0x3d616c){if(_0x3d616c[_0x7ca5('0x1b')]('\x20')>0x0){var _0x11b1ac=_0x3d616c[_0x7ca5('0x1c')](/ (.+)/);if(_0x11b1ac[0x1]){return _0x11b1ac;}}return[_0x3d616c,_0x3d616c];}var accountsTokens={};function getAccessToken(_0x4ea5db){return new Promise(function(_0x15865f,_0x2f9af7){if(!_['isNil'](accountsTokens[_0x4ea5db['id']])&&!_[_0x7ca5('0x1d')](accountsTokens[_0x4ea5db['id']][_0x7ca5('0x1e')])){if(moment()[_0x7ca5('0x1f')](accountsTokens[_0x4ea5db['id']][_0x7ca5('0x20')])){_0x15865f(accountsTokens[_0x4ea5db['id']][_0x7ca5('0x1e')]);}}var _0x279be9;switch(_0x4ea5db[_0x7ca5('0x21')]){case'US':_0x279be9=_0x7ca5('0x22');break;case'AU':_0x279be9=_0x7ca5('0x23');break;case'EU':_0x279be9=_0x7ca5('0x24');break;case'IN':_0x279be9=_0x7ca5('0x25');break;case'CN':_0x279be9=_0x7ca5('0x26');break;default:_0x279be9=_0x7ca5('0x24');break;}var _0x155196={'method':_0x7ca5('0x27'),'uri':_0x279be9+_0x7ca5('0x28'),'qs':{'refresh_token':_0x4ea5db['refreshToken'],'client_id':_0x4ea5db[_0x7ca5('0x29')],'client_secret':_0x4ea5db[_0x7ca5('0x2a')],'grant_type':_0x7ca5('0x2b')},'json':!![]};return rp(_0x155196)['then'](function(_0x342d62){accountsTokens[_0x4ea5db['id']]={'access_token':_0x342d62[_0x7ca5('0x1e')],'expires_in':moment()['add'](_0x342d62[_0x7ca5('0x20')],_0x7ca5('0x2c'))};_0x15865f(_0x342d62[_0x7ca5('0x1e')]);})[_0x7ca5('0x2d')](function(_0x3a65fe){logger[_0x7ca5('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x3a65fe[_0x7ca5('0x2f')]);_0x2f9af7(_0x3a65fe);});});}function getUser(_0xe82dba,_0xa83b40,_0x35938b,_0x5a19bb){logger[_0x7ca5('0x30')](_0x7ca5('0x31'));return request({'method':_0x7ca5('0x32'),'uri':util[_0x7ca5('0x33')](_0x7ca5('0x34'),_0xa83b40),'qs':{'type':_0x7ca5('0x35')},'headers':{'Authorization':_0x7ca5('0x36')+_0xe82dba},'json':!![]})[_0x7ca5('0x37')](function(_0x10497f){if(_0x10497f[_0x7ca5('0x38')]){var _0x5a17fc=-0x1;if(_[_0x7ca5('0x39')](_0x10497f[_0x7ca5('0x38')])){if(!_[_0x7ca5('0x1d')](_0x5a19bb)){_0x5a17fc=_[_0x7ca5('0x3a')](_0x10497f['users'],function(_0x4f5843){return _0x4f5843[_0x7ca5('0x3b')]===_0x5a19bb;});}if(_0x5a17fc>=0x0){logger[_0x7ca5('0x30')](_0x7ca5('0x3c'));}else{logger[_0x7ca5('0x30')]('Using\x20the\x20admin\x20account!');_0x5a17fc=_['findIndex'](_0x10497f[_0x7ca5('0x38')],function(_0x3dc03d){return _0x3dc03d[_0x7ca5('0x3d')][_0x7ca5('0x19')]===_0x7ca5('0x3e');});}return _0x10497f[_0x7ca5('0x38')][_0x5a17fc];}else{if(_0x10497f['user'][_0x7ca5('0x3d')]['name']==='Administrator'){logger[_0x7ca5('0x30')](_0x7ca5('0x3f'));user=_0x10497f[_0x7ca5('0x40')];return user;}else{logger[_0x7ca5('0x2e')](_0x7ca5('0x41'),JSON[_0x7ca5('0xd')](_0x10497f));throw new Error(_0x7ca5('0x42')+JSON[_0x7ca5('0xd')](_0x10497f));}}}else{logger[_0x7ca5('0x2e')](_0x7ca5('0x41'),JSON['stringify'](_0x10497f));throw new Error(_0x7ca5('0x42')+JSON[_0x7ca5('0xd')](_0x10497f));}})[_0x7ca5('0x2d')](function(_0x23d0f2){console[_0x7ca5('0x2e')](_0x23d0f2);});}function getZohoUser(_0xfba6a8,_0x395fdb){return new BPromise(function(_0x50f0fc,_0x2d34a0){request(_0xfba6a8)[_0x7ca5('0x37')](function(_0x2c8771){var _0x2e1b1a=null;if(_0x2c8771){_0x2e1b1a=_0x2c8771[_0x7ca5('0x43')][0x0];_0x2e1b1a[_0x7ca5('0x44')]=_0x395fdb;}_0x50f0fc(_0x2e1b1a);})[_0x7ca5('0x2d')](function(_0x182c5c){_0x2d34a0(_0x182c5c);});});}function createEndUser(_0x26729f,_0x29949d,_0x1ae330,_0x89ced5,_0x4b6135,_0x320494){var _0x1ae330=getName(_0x1ae330);return request({'method':_0x7ca5('0x27'),'uri':_0x7ca5('0x45')+_0x29949d+_0x7ca5('0x46')+_[_0x7ca5('0x47')](_0x320494[_0x7ca5('0x48')])+'s','body':{'data':[{'Last_Name':_0x1ae330[0x1],'First_Name':_0x1ae330[0x0],'Phone':_0x89ced5,'Owner':{'name':!_[_0x7ca5('0x1d')](_0x4b6135[_0x7ca5('0x49')]['name'])?_0x4b6135[_0x7ca5('0x49')][_0x7ca5('0x19')]:!_[_0x7ca5('0x1d')](_0x4b6135[_0x7ca5('0x4a')])?_0x4b6135[_0x7ca5('0x4a')]+'\x20'+_0x4b6135['last_name']:_0x4b6135[_0x7ca5('0x4b')],'id':_0x4b6135['id']}}]},'headers':{'Authorization':_0x7ca5('0x36')+_0x26729f},'json':!![]})[_0x7ca5('0x37')](function(_0x3d04bf){if(_0x3d04bf&&_0x3d04bf['data'][0x0]['code']===_0x7ca5('0x4c')){var _0x42a211=_0x3d04bf[_0x7ca5('0x43')][0x0][_0x7ca5('0x4d')];_0x42a211['enduserType']=_['startCase'](_0x320494[_0x7ca5('0x48')])+'s';return _0x42a211;}logger['error'](_0x7ca5('0x41'),JSON[_0x7ca5('0xd')](data));throw new Error('Error:\x20'+JSON[_0x7ca5('0xd')](data));})[_0x7ca5('0x2d')](function(_0x33feb3){console[_0x7ca5('0x4e')](_0x7ca5('0x4f'),_0x33feb3);});}function getEndUser(_0x450eb2,_0xd020d4,_0x244888,_0x33f977,_0x3cd25e,_0x502047,_0x39e21e){var _0x1ddbb1={'method':_0x7ca5('0x32'),'uri':'','headers':{'Authorization':_0x7ca5('0x36')+_0x450eb2},'json':!![]};switch(_0x39e21e[_0x7ca5('0x50')]){case _0x7ca5('0x51'):_0x1ddbb1[_0x7ca5('0x52')]=_0x7ca5('0x45')+_0xd020d4+_0x7ca5('0x53')+_0x3cd25e+'))';return getZohoUser(_0x1ddbb1,'Contacts')[_0x7ca5('0x37')](function(_0x3f355d){if(_0x3f355d)return _0x3f355d;_0x1ddbb1[_0x7ca5('0x52')]=_0x7ca5('0x45')+_0xd020d4+_0x7ca5('0x54')+_0x3cd25e+'))';return getZohoUser(_0x1ddbb1,_0x7ca5('0x55'))[_0x7ca5('0x37')](function(_0xb3f6a2){if(_0xb3f6a2)return _0xb3f6a2;if(_0x39e21e[_0x7ca5('0x48')]!=_0x7ca5('0x56')){return createEndUser(_0x450eb2,_0xd020d4,_0x33f977,_0x3cd25e,_0x502047,_0x39e21e);}else{return{};}});});break;case _0x7ca5('0x57'):_0x1ddbb1[_0x7ca5('0x52')]='https://www.zohoapis.'+_0xd020d4+_0x7ca5('0x53')+_0x3cd25e+'))';return getZohoUser(_0x1ddbb1,_0x7ca5('0x58'))[_0x7ca5('0x37')](function(_0x1f151b){if(_0x1f151b)return _0x1f151b;if(_0x39e21e[_0x7ca5('0x48')]!=_0x7ca5('0x56')){return createEndUser(_0x450eb2,_0xd020d4,_0x33f977,_0x3cd25e,_0x502047,_0x39e21e);}else{return{};}});break;case'lead':_0x1ddbb1[_0x7ca5('0x52')]='https://www.zohoapis.'+_0xd020d4+_0x7ca5('0x54')+_0x3cd25e+'))';return getZohoUser(_0x1ddbb1,_0x7ca5('0x55'))[_0x7ca5('0x37')](function(_0x3cae46){if(_0x3cae46)return _0x3cae46;if(_0x39e21e['moduleCreate']!=_0x7ca5('0x56')){return createEndUser(_0x450eb2,_0xd020d4,_0x33f977,_0x3cd25e,_0x502047,_0x39e21e);}else{return{};}});break;}}function getCall(_0x5ea4d4,_0x582bb5,_0x45af95,_0x1ca60f,_0xfb8e49,_0x3194ce,_0x219d7c,_0x555ce6){logger[_0x7ca5('0x30')](_0x7ca5('0x59'));var _0x14578b={};_0x14578b[_0x7ca5('0x5a')]={'name':!_[_0x7ca5('0x1d')](_0x1ca60f[_0x7ca5('0x49')][_0x7ca5('0x19')])&&!_['isNil'](_0x1ca60f[_0x7ca5('0x3d')]['name'])&&_0x1ca60f[_0x7ca5('0x3d')][_0x7ca5('0x19')]===_0x7ca5('0x5b')?_0x1ca60f[_0x7ca5('0x49')]['name']:!_[_0x7ca5('0x1d')](_0x1ca60f['first_name'])?_0x1ca60f[_0x7ca5('0x4a')]+'\x20'+_0x1ca60f['last_name']:_0x1ca60f[_0x7ca5('0x4b')],'id':_0x1ca60f['id']};_0x14578b[_0x7ca5('0x5c')]=intUtil[_0x7ca5('0x5d')](_0x3194ce[_0x7ca5('0x5e')],_0x219d7c,'\x20');_0x14578b[_0x7ca5('0x5f')]=intUtil['getString'](_0x3194ce['Descriptions'],_0x219d7c,'\x0a');if(_0xfb8e49['enduserType']===_0x7ca5('0x58')){_0x14578b[_0x7ca5('0x60')]={'name':!_[_0x7ca5('0x1d')](_0xfb8e49[_0x7ca5('0x61')])?_0xfb8e49[_0x7ca5('0x61')]:!_['isNil'](_0xfb8e49[_0x7ca5('0x62')])?_0xfb8e49[_0x7ca5('0x62')]+'\x20'+_0xfb8e49[_0x7ca5('0x63')]:_0xfb8e49['Last_Name'],'id':_0xfb8e49['id']};}if(_0xfb8e49['enduserType']===_0x7ca5('0x55')){_0x14578b[_0x7ca5('0x64')]={'name':!_[_0x7ca5('0x1d')](_0xfb8e49[_0x7ca5('0x61')])?_0xfb8e49[_0x7ca5('0x61')]:!_[_0x7ca5('0x1d')](_0xfb8e49[_0x7ca5('0x62')])?_0xfb8e49[_0x7ca5('0x62')]+'\x20'+_0xfb8e49[_0x7ca5('0x63')]:_0xfb8e49[_0x7ca5('0x63')],'id':_0xfb8e49['id']};_0x14578b[_0x7ca5('0x65')]=_['startCase'](_0xfb8e49[_0x7ca5('0x44')]);}if(_0x219d7c[_0x7ca5('0x66')]){_0x14578b[_0x7ca5('0x67')]=moment['utc'](parseInt(_0x219d7c[_0x7ca5('0x66')])*0x3e8)[_0x7ca5('0x33')]('mm:ss');}else if(_0x219d7c['answertime']&&_0x219d7c[_0x7ca5('0x68')]){_0x14578b[_0x7ca5('0x67')]=moment['utc'](moment(_0x219d7c[_0x7ca5('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0x7ca5('0x69')](moment(_0x219d7c[_0x7ca5('0x6a')],_0x7ca5('0x6b'))))[_0x7ca5('0x33')]('mm:ss');}switch(_0x219d7c[_0x7ca5('0x6c')]){case _0x7ca5('0x6d'):_0x14578b[_0x7ca5('0x6e')]=_0x7ca5('0x6f');break;case _0x7ca5('0x70'):case _0x7ca5('0x71'):_0x14578b['Call_Result']='Answered';break;case'rejected':_0x14578b[_0x7ca5('0x6e')]='Rejected';break;case _0x7ca5('0x72'):_0x14578b[_0x7ca5('0x6e')]=_0x7ca5('0x73');break;case'timeout':_0x14578b[_0x7ca5('0x6e')]='Timeout';default:}_0x14578b['Call_Start_Time']=(_0x555ce6===_0x7ca5('0x74')?moment(_0x219d7c[_0x7ca5('0x6a')])['format'](_0x7ca5('0x6b')):moment(_0x219d7c[_0x7ca5('0x75')])['format'](_0x7ca5('0x6b')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x14578b[_0x7ca5('0x76')]=_0x555ce6||_0x7ca5('0x77');_0x14578b=_[_0x7ca5('0x78')](_0x14578b,getCustomFields(_0x3194ce[_0x7ca5('0x79')],_0x219d7c));return request({'method':_0x7ca5('0x27'),'uri':_0x7ca5('0x45')+_0x582bb5+_0x7ca5('0x7a'),'headers':{'Authorization':_0x7ca5('0x36')+_0x5ea4d4},'body':{'data':[_0x14578b]},'json':!![]})[_0x7ca5('0x37')](function(_0x37f641){if(_0x37f641&&_0x37f641[_0x7ca5('0x43')][0x0][_0x7ca5('0x7b')]===_0x7ca5('0x4c')){logger[_0x7ca5('0x30')](_0x7ca5('0x7c'));return{'id':_0x37f641[_0x7ca5('0x43')][0x0][_0x7ca5('0x4d')]['id']};}})[_0x7ca5('0x2d')](function(_0x207b4a){logger[_0x7ca5('0x30')](_0x7ca5('0x7d'),_0x207b4a[_0x7ca5('0x2f')]);console[_0x7ca5('0x4e')]('err',_0x207b4a);});}exports[_0x7ca5('0x7e')]=function(_0x388f62,_0x583e38,_0x54cf88,_0x3f0190,_0x3e7a3d,_0x28b1f1){var _0x1a351b,_0x221c43,_0xfca0b3;_0x28b1f1['host']=intUtil['stripTrailingSlash'](_0x28b1f1['host']);_0x28b1f1[_0x7ca5('0x7f')]=intUtil[_0x7ca5('0x80')](_0x28b1f1[_0x7ca5('0x7f')]);if(_0x3e7a3d&&_0x3e7a3d[_0x7ca5('0x81')]){logger['info'](_0x7ca5('0x82'),'Recording\x20is\x20enabled!');_0x583e38['recordingURL']=_0x28b1f1['serverUrl']+'/api/voice/recordings/'+_0x583e38[_0x7ca5('0x83')]+_0x7ca5('0x84')+md5(_0x583e38[_0x7ca5('0x83')]);}else{_0x583e38[_0x7ca5('0x85')]='';}var _0x51e30f=_0x28b1f1[_0x7ca5('0x86')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x28b1f1)[_0x7ca5('0x37')](function(_0x4ab627){_0xfca0b3=_0x4ab627;return getUser(_0xfca0b3,_0x51e30f,_0x28b1f1,_0x3f0190['email']);})['then'](function(_0x24a324){_0x1a351b=_0x24a324;logger[_0x7ca5('0x30')]('The\x20User\x20ID\x20is:',_0x1a351b['id']);return getEndUser(_0xfca0b3,_0x51e30f,_0x28b1f1,_0x583e38[_0x7ca5('0x87')],_0x583e38[_0x7ca5('0x88')],_0x1a351b,_0x54cf88);})[_0x7ca5('0x37')](function(_0x3cf356){_0x221c43=_0x3cf356;return getCall(_0xfca0b3,_0x51e30f,_0x28b1f1,_0x1a351b,_0x221c43,_0x54cf88,_0x583e38,_0x7ca5('0x77'));})['then'](function(_0x1ac0e3){if(_0x1ac0e3){logger[_0x7ca5('0x30')](_0x7ca5('0x89'),_0x1ac0e3['id']);logger[_0x7ca5('0x30')](_0x7ca5('0x82'),_0x7ca5('0x8a'));emit(util[_0x7ca5('0x33')]('user:%s',_0x3f0190[_0x7ca5('0x19')]),_0x7ca5('0x8b'),{'uri':_0x7ca5('0x8c')+_0x28b1f1['host']+_0x7ca5('0x8d')+_0x1ac0e3['id']});}})[_0x7ca5('0x2d')](function(_0x26f707){logger[_0x7ca5('0x2e')](_0x7ca5('0x82'),JSON[_0x7ca5('0xd')](_0x26f707));});};exports[_0x7ca5('0x74')]=function(_0x308ecf,_0x4a07e9,_0x565314,_0xbca0fa,_0x11f72f,_0x375bd2,_0x47acab){var _0x9d091e,_0x3351b9,_0x43af59;_0x375bd2[_0x7ca5('0x86')]=intUtil[_0x7ca5('0x80')](_0x375bd2['host']);_0x375bd2[_0x7ca5('0x7f')]=intUtil[_0x7ca5('0x80')](_0x375bd2[_0x7ca5('0x7f')]);if(_0x47acab&&_0x47acab[_0x7ca5('0x8e')]&&_0x47acab[_0x7ca5('0x8e')]!=='none'){logger[_0x7ca5('0x30')](_0x7ca5('0x8f'),_0x7ca5('0x90'));_0x4a07e9[_0x7ca5('0x85')]=_0x375bd2[_0x7ca5('0x7f')]+_0x7ca5('0x91')+_0x4a07e9[_0x7ca5('0x83')]+_0x7ca5('0x84')+md5(_0x4a07e9['uniqueid']);}var _0x2a9151=_0x375bd2[_0x7ca5('0x86')]===_0x7ca5('0x92')?'eu':_0x7ca5('0x93');return getAccessToken(_0x375bd2)['then'](function(_0x4c709d){_0x43af59=_0x4c709d;return getUser(_0x43af59,_0x2a9151,_0x375bd2,_0xbca0fa[_0x7ca5('0x3b')]);})[_0x7ca5('0x37')](function(_0x14aa8d){_0x9d091e=_0x14aa8d;logger[_0x7ca5('0x30')](_0x7ca5('0x94'),_0x9d091e['id']);return getEndUser(_0x43af59,_0x2a9151,_0x375bd2,_0x4a07e9['destcalleridname'],_0x4a07e9[_0x7ca5('0x95')],_0x9d091e,_0x565314);})[_0x7ca5('0x37')](function(_0x4f7990){_0x3351b9=_0x4f7990;return getCall(_0x43af59,_0x2a9151,_0x375bd2,_0x9d091e,_0x3351b9,_0x565314,_0x4a07e9,_0x7ca5('0x96'));})[_0x7ca5('0x37')](function(_0x2c9af6){if(_0x2c9af6){logger[_0x7ca5('0x30')](_0x7ca5('0x89'),_0x2c9af6['id']);logger[_0x7ca5('0x30')]('[OUTBOUND]',_0x7ca5('0x8a'));emit(util[_0x7ca5('0x33')]('user:%s',_0xbca0fa['name']),_0x7ca5('0x8b'),{'uri':_0x7ca5('0x8c')+_0x375bd2['host']+_0x7ca5('0x8d')+_0x2c9af6['id']});}})[_0x7ca5('0x2d')](function(_0x3b194c){logger[_0x7ca5('0x2e')](_0x7ca5('0x8f'),JSON[_0x7ca5('0xd')](_0x3b194c));});};exports[_0x7ca5('0x97')]=function(_0x58ec35,_0x6fef2c,_0x4a9e2e,_0x1ac3e3,_0x1c5e3e,_0x5f3294){var _0x562e85,_0x23a4cb,_0x49d27e;_0x5f3294[_0x7ca5('0x86')]=intUtil[_0x7ca5('0x80')](_0x5f3294[_0x7ca5('0x86')]);_0x5f3294['serverUrl']=intUtil[_0x7ca5('0x80')](_0x5f3294['serverUrl']);if(_0x1c5e3e&&_0x1c5e3e['monitor_format']){logger[_0x7ca5('0x30')]('['+_0x6fef2c[_0x7ca5('0x6c')][_0x7ca5('0x98')]()+']','Recording\x20is\x20enabled!');_0x6fef2c[_0x7ca5('0x85')]=_0x5f3294[_0x7ca5('0x7f')]+'/api/voice/recordings/'+_0x6fef2c[_0x7ca5('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x6fef2c[_0x7ca5('0x83')]);}else{_0x6fef2c[_0x7ca5('0x85')]='';}var _0x542a8f=_0x5f3294[_0x7ca5('0x86')]==='zoho.eu'?'eu':_0x7ca5('0x93');return getAccessToken(_0x5f3294)[_0x7ca5('0x37')](function(_0x2fa0ff){_0x49d27e=_0x2fa0ff;return getUser(_0x49d27e,_0x542a8f,_0x5f3294);})[_0x7ca5('0x37')](function(_0x26284f){_0x562e85=_0x26284f;logger[_0x7ca5('0x30')](_0x7ca5('0x94'),_0x562e85['id']);return getEndUser(_0x49d27e,_0x542a8f,_0x5f3294,_0x6fef2c['calleridname'],_0x6fef2c['calleridnum'],_0x562e85,_0x4a9e2e);})[_0x7ca5('0x37')](function(_0xef2288){_0x23a4cb=_0xef2288;return getCall(_0x49d27e,_0x542a8f,_0x5f3294,_0x562e85,_0x23a4cb,_0x4a9e2e,_0x6fef2c,_0x7ca5('0x77'));})[_0x7ca5('0x37')](function(_0x3b1e3f){if(_0x3b1e3f){logger['info'](_0x7ca5('0x89'),_0x3b1e3f['id']);}})[_0x7ca5('0x2d')](function(_0x223b45){logger['error']('['+_0x6fef2c[_0x7ca5('0x6c')][_0x7ca5('0x98')]()+']',JSON[_0x7ca5('0xd')](_0x223b45));});}; \ 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 15f63a0..059c911 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 _0x8723=['format','shelljs','mustache','trigger','data2','Script','data3','render','exec','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8723,0xe7));var _0x3872=function(_0x2fa523,_0x174b28){_0x2fa523=_0x2fa523-0x0;var _0x3e78f5=_0x8723[_0x2fa523];return _0x3e78f5;};'use strict';var util=require('util');var sh=require(_0x3872('0x0'));var Mustache=require(_0x3872('0x1'));var logger=require('../../../../config/logger')(_0x3872('0x2'));exports['exec']=function(_0x4f780c,_0x4f2426){var _0x4df559=_0x4f780c[_0x3872('0x3')]?_0x4f780c['data2']:_0x3872('0x4');var _0x4b67b8=_0x4f780c[_0x3872('0x5')]?Mustache[_0x3872('0x6')](_0x4f780c[_0x3872('0x5')],_0x4f2426):_0x4f2426;sh[_0x3872('0x7')](_0x4b67b8,function(_0x5e81c6,_0x212225,_0x15f683){if(_0x5e81c6!==0x0){logger[_0x3872('0x8')](util[_0x3872('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4df559,_0x4b67b8,_0x5e81c6,_0x15f683));}else{logger['info'](util[_0x3872('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4df559,_0x4b67b8,_0x212225));}});}; \ No newline at end of file +var _0xeb65=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeb65,0x121));var _0x5eb6=function(_0x3f12c8,_0x5ecee0){_0x3f12c8=_0x3f12c8-0x0;var _0xbc9d49=_0xeb65[_0x3f12c8];return _0xbc9d49;};'use strict';var util=require(_0x5eb6('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x5eb6('0x1'))(_0x5eb6('0x2'));exports[_0x5eb6('0x3')]=function(_0x2db5c7,_0x2139ac){var _0x261eda=_0x2db5c7[_0x5eb6('0x4')]?_0x2db5c7[_0x5eb6('0x4')]:_0x5eb6('0x5');var _0x286fe8=_0x2db5c7[_0x5eb6('0x6')]?Mustache[_0x5eb6('0x7')](_0x2db5c7[_0x5eb6('0x6')],_0x2139ac):_0x2139ac;sh[_0x5eb6('0x3')](_0x286fe8,function(_0x593fb4,_0x26061c,_0xfbaf73){if(_0x593fb4!==0x0){logger[_0x5eb6('0x8')](util[_0x5eb6('0x9')](_0x5eb6('0xa'),_0x261eda,_0x286fe8,_0x593fb4,_0xfbaf73));}else{logger['info'](util[_0x5eb6('0x9')](_0x5eb6('0xb'),_0x261eda,_0x286fe8,_0x26061c));}});}; \ 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 0a7cd49..34eccac 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 _0x1c41=['DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','GET'];(function(_0x3316de,_0x29382e){var _0x58f8b4=function(_0x3aad10){while(--_0x3aad10){_0x3316de['push'](_0x3316de['shift']());}};_0x58f8b4(++_0x29382e);}(_0x1c41,0xba));var _0x11c4=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x1c41[_0x5d0609];return _0xaa3fd1;};'use strict';var rp=require('request-promise');var util=require(_0x11c4('0x0'));var _=require(_0x11c4('0x1'));var Mustache=require(_0x11c4('0x2'));var logger=require(_0x11c4('0x3'))(_0x11c4('0x4'));exports[_0x11c4('0x5')]=function(_0x544ae8,_0x10344d){var _0x207d97,_0x12237e;var _0x5d4827={'method':_0x544ae8[_0x11c4('0x6')][_0x11c4('0x7')](),'uri':Mustache[_0x11c4('0x8')](_0x544ae8[_0x11c4('0x9')],_0x10344d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x544ae8[_0x11c4('0xa')])===_0x11c4('0xb')&&parseInt(_0x544ae8['data5'])>=0x1&&parseInt(_0x544ae8['data5'])<=0xa?parseInt(_0x544ae8[_0x11c4('0xa')])*0x3e8:0x5*0x3e8};try{_0x5d4827[_0x11c4('0xc')]=_0x544ae8['data6']?JSON[_0x11c4('0xd')](Mustache[_0x11c4('0x8')](_0x544ae8[_0x11c4('0xe')],_0x10344d)):{};}catch(_0x3ae9d3){logger[_0x11c4('0xf')](_0x3ae9d3[_0x11c4('0x10')]);}switch(_0x544ae8[_0x11c4('0x6')]['toUpperCase']()){case _0x11c4('0x11'):case _0x11c4('0x12'):_0x207d97=null;_0x5d4827['qs']=_0x10344d;break;case _0x11c4('0x13'):case'PUT':if(_0x544ae8[_0x11c4('0x14')]){try{_0x207d97=JSON[_0x11c4('0xd')](Mustache['render'](_0x544ae8[_0x11c4('0x14')],_0x10344d));_0x5d4827[_0x11c4('0x15')]=_0x207d97;}catch(_0x2acbc0){logger[_0x11c4('0xf')](_0x2acbc0[_0x11c4('0x10')]);logger[_0x11c4('0xf')](_0x11c4('0x16'));}}else{_0x207d97=_0x10344d;_0x5d4827['body']=_0x207d97;}break;}logger[_0x11c4('0x17')](util[_0x11c4('0x18')](_0x11c4('0x19'),_0x544ae8[_0x11c4('0x6')],_0x544ae8[_0x11c4('0x9')],JSON[_0x11c4('0x1a')](_0x5d4827)));rp(_0x5d4827)[_0x11c4('0x1b')](function(_0x5313cd){_0x207d97=!_[_0x11c4('0x1c')](_0x207d97)?_0x11c4('0x1d')+_0x207d97:'';_0x12237e=typeof _0x5313cd[_0x11c4('0x15')]==='object'?JSON['stringify'](_0x5313cd['body']):_0x5313cd[_0x11c4('0x15')];logger[_0x11c4('0x17')](util[_0x11c4('0x18')](_0x11c4('0x1e'),_0x544ae8['data1'],_0x544ae8['data2'],_0x5313cd[_0x11c4('0x1f')],_0x12237e));})['catch'](function(_0x509fcc){logger[_0x11c4('0xf')](util['format'](_0x11c4('0x20'),_0x544ae8[_0x11c4('0x6')],_0x544ae8['data2'],_0x509fcc[_0x11c4('0x1f')],_0x509fcc[_0x11c4('0x21')],_0x509fcc['message']));});}; \ No newline at end of file +var _0x16b3=['error','stack','GET','POST','PUT','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse'];(function(_0x2fc013,_0x1bb40e){var _0x2ecda6=function(_0x2ab3fb){while(--_0x2ab3fb){_0x2fc013['push'](_0x2fc013['shift']());}};_0x2ecda6(++_0x1bb40e);}(_0x16b3,0x9c));var _0x316b=function(_0x3ef286,_0x304988){_0x3ef286=_0x3ef286-0x0;var _0xf7420a=_0x16b3[_0x3ef286];return _0xf7420a;};'use strict';var rp=require('request-promise');var util=require(_0x316b('0x0'));var _=require(_0x316b('0x1'));var Mustache=require('mustache');var logger=require(_0x316b('0x2'))(_0x316b('0x3'));exports[_0x316b('0x4')]=function(_0x5edb66,_0x3d7ac4){var _0xc09a93,_0x35bd25;var _0x1529fd={'method':_0x5edb66[_0x316b('0x5')][_0x316b('0x6')](),'uri':Mustache[_0x316b('0x7')](_0x5edb66[_0x316b('0x8')],_0x3d7ac4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5edb66[_0x316b('0x9')])===_0x316b('0xa')&&parseInt(_0x5edb66['data5'])>=0x1&&parseInt(_0x5edb66[_0x316b('0x9')])<=0xa?parseInt(_0x5edb66[_0x316b('0x9')])*0x3e8:0x5*0x3e8};try{_0x1529fd[_0x316b('0xb')]=_0x5edb66[_0x316b('0xc')]?JSON[_0x316b('0xd')](Mustache['render'](_0x5edb66[_0x316b('0xc')],_0x3d7ac4)):{};}catch(_0x5712c0){logger[_0x316b('0xe')](_0x5712c0[_0x316b('0xf')]);}switch(_0x5edb66[_0x316b('0x5')][_0x316b('0x6')]()){case _0x316b('0x10'):case'DELETE':_0xc09a93=null;_0x1529fd['qs']=_0x3d7ac4;break;case _0x316b('0x11'):case _0x316b('0x12'):if(_0x5edb66['data7']){try{_0xc09a93=JSON[_0x316b('0xd')](Mustache['render'](_0x5edb66['data7'],_0x3d7ac4));_0x1529fd[_0x316b('0x13')]=_0xc09a93;}catch(_0x22264b){logger[_0x316b('0xe')](_0x22264b['stack']);logger[_0x316b('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xc09a93=_0x3d7ac4;_0x1529fd[_0x316b('0x13')]=_0xc09a93;}break;}logger[_0x316b('0x14')](util[_0x316b('0x15')](_0x316b('0x16'),_0x5edb66[_0x316b('0x5')],_0x5edb66[_0x316b('0x8')],JSON[_0x316b('0x17')](_0x1529fd)));rp(_0x1529fd)[_0x316b('0x18')](function(_0x48f7b4){_0xc09a93=!_[_0x316b('0x19')](_0xc09a93)?_0x316b('0x1a')+_0xc09a93:'';_0x35bd25=typeof _0x48f7b4[_0x316b('0x13')]===_0x316b('0x1b')?JSON[_0x316b('0x17')](_0x48f7b4[_0x316b('0x13')]):_0x48f7b4[_0x316b('0x13')];logger['info'](util['format'](_0x316b('0x1c'),_0x5edb66['data1'],_0x5edb66[_0x316b('0x8')],_0x48f7b4[_0x316b('0x1d')],_0x35bd25));})[_0x316b('0x1e')](function(_0x2f0038){logger['error'](util[_0x316b('0x15')](_0x316b('0x1f'),_0x5edb66[_0x316b('0x5')],_0x5edb66[_0x316b('0x8')],_0x2f0038['statusCode'],_0x2f0038[_0x316b('0x20')],_0x2f0038[_0x316b('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8df1903..7bd4dab 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 _0x585a=['message','catch','exports','bluebird','routing','client','http','Request','request','then','debug','error','rpc'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x585a,0x155));var _0xa585=function(_0x3a3c81,_0x253ca1){_0x3a3c81=_0x3a3c81-0x0;var _0x53acaf=_0x585a[_0x3a3c81];return _0x53acaf;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa585('0x0'));var logger=require('../../config/logger')(_0xa585('0x1'));var client=jayson[_0xa585('0x2')][_0xa585('0x3')]({'port':0x2329});client[_0xa585('0x4')]=function(_0x439328,_0x1cd338){return new BPromise(function(_0x16b6ae,_0x223ab5){return client[_0xa585('0x5')](_0x439328,_0x1cd338)[_0xa585('0x6')](function(_0x2d38bb){logger[_0xa585('0x7')]('rpc','routing',_0x439328,_0x1cd338,_0x2d38bb);if(_0x2d38bb[_0xa585('0x8')]){logger[_0xa585('0x8')](_0xa585('0x9'),'routing',_0x439328,_0x2d38bb['error'][_0xa585('0xa')],_0x1cd338);return _0x223ab5(_0x2d38bb[_0xa585('0x8')]['message']);}else{return _0x16b6ae(_0x2d38bb['result']);}})[_0xa585('0xb')](function(_0x2327b0){logger[_0xa585('0x8')](_0xa585('0x9'),_0xa585('0x1'),_0x439328,_0x2327b0,_0x1cd338);return _0x223ab5(_0x2327b0);});});};module[_0xa585('0xc')]=client; \ No newline at end of file +var _0x146a=['result','catch','jayson/promise','../../config/logger','routing','then','debug','rpc','error','message'];(function(_0x33aeab,_0x1242b4){var _0x50cec9=function(_0x7eee88){while(--_0x7eee88){_0x33aeab['push'](_0x33aeab['shift']());}};_0x50cec9(++_0x1242b4);}(_0x146a,0x1b0));var _0xa146=function(_0x4b8fc7,_0x5022fc){_0x4b8fc7=_0x4b8fc7-0x0;var _0x249f4a=_0x146a[_0x4b8fc7];return _0x249f4a;};'use strict';var jayson=require(_0xa146('0x0'));var BPromise=require('bluebird');var logger=require(_0xa146('0x1'))(_0xa146('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x140ed2,_0x430399){return new BPromise(function(_0x41f5c7,_0x143de3){return client['request'](_0x140ed2,_0x430399)[_0xa146('0x3')](function(_0x20d306){logger[_0xa146('0x4')](_0xa146('0x5'),_0xa146('0x2'),_0x140ed2,_0x430399,_0x20d306);if(_0x20d306['error']){logger[_0xa146('0x6')](_0xa146('0x5'),_0xa146('0x2'),_0x140ed2,_0x20d306['error'][_0xa146('0x7')],_0x430399);return _0x143de3(_0x20d306[_0xa146('0x6')]['message']);}else{return _0x41f5c7(_0x20d306[_0xa146('0x8')]);}})[_0xa146('0x9')](function(_0x2a91b0){logger['error']('rpc',_0xa146('0x2'),_0x140ed2,_0x2a91b0,_0x430399);return _0x143de3(_0x2a91b0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 564a3b2..1dc97ed 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 _0xde5a=['getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x5b474b,_0x136b79){var _0x3640bb=function(_0x196aaf){while(--_0x196aaf){_0x5b474b['push'](_0x5b474b['shift']());}};_0x3640bb(++_0x136b79);}(_0xde5a,0x1a8));var _0xade5=function(_0x4c9bb9,_0xa701af){_0x4c9bb9=_0x4c9bb9-0x0;var _0x454e00=_0xde5a[_0x4c9bb9];return _0x454e00;};'use strict';var server=require('./server');var Realtime=require(_0xade5('0x0'));var EmailChannel=require(_0xade5('0x1'));var mailAccount=require(_0xade5('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xade5('0x3')]()['then'](mailAccount[_0xade5('0x4')]())[_0xade5('0x5')](realtime[_0xade5('0x6')]())['then'](function(){email[_0xade5('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xade5('0x5')](function(){return setting[_0xade5('0x8')]();})[_0xade5('0x5')](function(_0x2cc3e5){return setInterval(initRealtime,_0x2cc3e5[_0xade5('0x9')]*0x3e8);})['catch'](function(_0x3a287a){logger[_0xade5('0xa')](_0xade5('0xb'),_0x3a287a);});}main(); \ No newline at end of file +var _0x0779=['./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0779,0x1b9));var _0x9077=function(_0x5b036c,_0x26691b){_0x5b036c=_0x5b036c-0x0;var _0x2309e5=_0x0779[_0x5b036c];return _0x2309e5;};'use strict';var server=require(_0x9077('0x0'));var Realtime=require(_0x9077('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x9077('0x2'));var setting=require(_0x9077('0x3'));var logger=require(_0x9077('0x4'))(_0x9077('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x9077('0x6')]()[_0x9077('0x7')](mailAccount[_0x9077('0x8')]())[_0x9077('0x7')](realtime[_0x9077('0x9')]())[_0x9077('0x7')](function(){email[_0x9077('0xa')](realtime[_0x9077('0xb')]);return realtime;});}function main(){return server[_0x9077('0xc')](realtime,email)[_0x9077('0x7')](function(){return initRealtime();})[_0x9077('0x7')](function(){return setting[_0x9077('0xd')]();})[_0x9077('0x7')](function(_0x3b33a5){return setInterval(initRealtime,_0x3b33a5[_0x9077('0xe')]*0x3e8);})[_0x9077('0xf')](function(_0x5516d4){logger['error'](_0x9077('0x10'),_0x5516d4);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index dbc7f1a..c225339 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 _0x1591=['Imap','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./smtp','info','mailAccounts','imapAccounts','emit','name','key','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x1591,0xf4));var _0x1159=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x1591[_0x1b3564];return _0x504069;};'use strict';var _=require(_0x1159('0x0'));var moment=require(_0x1159('0x1'));var BPromise=require(_0x1159('0x2'));var md5=require(_0x1159('0x3'));var Redis=require(_0x1159('0x4'));var config=require(_0x1159('0x5'));var logger=require('../../../config/logger')(_0x1159('0x6'));config['redis']=_[_0x1159('0x7')](config[_0x1159('0x8')],{'host':_0x1159('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1159('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x1159('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2ed2f3){logger[_0x1159('0xb')]('start\x20email\x20channel');this[_0x1159('0xc')]=_0x2ed2f3[_0x1159('0xc')];this[_0x1159('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x1159('0xe')]=function(_0x5066ac){var _0x30eb08=this['mailAccounts'][_0x5066ac];var _0x40aa55={'id':_0x30eb08['id'],'name':_0x30eb08[_0x1159('0xf')],'key':_0x30eb08[_0x1159('0x10')],'active':_0x30eb08['active'],'Imap':{'status':_0x30eb08['Imap'][_0x1159('0x11')],'messageStatus':_0x30eb08['Imap'][_0x1159('0x12')],'total':_0x30eb08['Imap'][_0x1159('0x13')]}};if(_[_0x1159('0x14')](md5Accounts[_0x5066ac])){md5Accounts[_0x5066ac]={};}var _0x33774f=md5(JSON[_0x1159('0x15')](_0x40aa55));if(md5Accounts[_0x5066ac]['md5']!==_0x33774f){md5Accounts[_0x5066ac][_0x1159('0x3')]=_0x33774f;io['emit'](_0x1159('0x16'),_0x40aa55);}};EmailChannel[_0x1159('0x17')][_0x1159('0x18')]=function(_0x485c8d){for(var _0x1473a9 in _0x485c8d){if(_0x485c8d[_0x1159('0x19')](_0x1473a9)){if(_0x485c8d[_0x1473a9][_0x1159('0x1a')]&&_0x485c8d[_0x1473a9]['active']){var _0x36b092=_0x485c8d[_0x1473a9][_0x1159('0x1a')];if(!_0x36b092[_0x1159('0x1b')]&&_0x485c8d[_0x1473a9][_0x1159('0x1c')]!==_0x1159('0x1d'))_0x36b092[_0x1159('0x1b')]=_0x485c8d[_0x1473a9][_0x1159('0x1c')];if(!this[_0x1159('0xd')][_0x1159('0x19')](_0x36b092['id'])){this['imapAccounts'][_0x36b092['id']]=new EmailImap(_0x36b092,_0x485c8d[_0x1473a9]['email']);this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x1e'),this[_0x1159('0x1f')][_0x1159('0x20')](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x6'),this[_0x1159('0x21')]['bind'](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x22'),this[_0x1159('0x23')][_0x1159('0x20')](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x24'),this[_0x1159('0x25')][_0x1159('0x20')](this,_0x1473a9));}}else{if(_[_0x1159('0x14')](this[_0x1159('0xc')][_0x1473a9][_0x1159('0x1a')])){this[_0x1159('0xc')][_0x1473a9]['Imap']={};}this[_0x1159('0xc')][_0x1473a9]['Imap'][_0x1159('0x11')]=_0x1159('0x26');this['mailAccounts'][_0x1473a9][_0x1159('0x1a')]['messageStatus']='';this['emit'](_0x1473a9);}}}};EmailChannel[_0x1159('0x17')][_0x1159('0x1f')]=function(_0x4631e4,_0x48725f){if(this[_0x1159('0xc')][_0x4631e4]){this[_0x1159('0xc')][_0x4631e4]['Imap'][_0x1159('0x11')]=_0x1159('0x27');this['mailAccounts'][_0x4631e4]['Imap']['messageStatus']=_0x48725f[_0x1159('0xf')];if(_0x48725f[_0x1159('0x28')]){this[_0x1159('0xc')][_0x4631e4][_0x1159('0x1a')]['total']=_0x48725f['messages'][_0x1159('0x13')];}return this[_0x1159('0xe')](_0x4631e4);}};EmailChannel[_0x1159('0x17')][_0x1159('0x21')]=function(_0x3c37ef,_0x16cfa3){logger[_0x1159('0xb')](_0x1159('0x29'),_0x16cfa3[_0x1159('0x2a')],_0x16cfa3[_0x1159('0x2b')],_0x16cfa3['from'],_0x3c37ef);if(this['mailAccounts'][_0x3c37ef]){return mailAccount[_0x1159('0x2c')](_0x3c37ef,_0x16cfa3)['then'](function(_0x27d2a2){if(_0x27d2a2){logger[_0x1159('0xb')](_0x1159('0x2d'));}})[_0x1159('0x2e')](function(_0x21f01d){logger[_0x1159('0x24')](_0x1159('0x2f'),JSON[_0x1159('0x15')](_0x21f01d));});}};EmailChannel[_0x1159('0x17')]['handleImapEnd']=function(_0x554dc6){if(this['mailAccounts'][_0x554dc6]&&this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]){if(this[_0x1159('0xd')][this['mailAccounts'][_0x554dc6][_0x1159('0x1a')]['id']]){delete this[_0x1159('0xd')][this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]['id']];}this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]['lastSync']=moment();this[_0x1159('0xe')](_0x554dc6);}};EmailChannel[_0x1159('0x17')]['handleImapError']=function(_0x50821d,_0xc1dfb1){if(this['mailAccounts'][_0x50821d]){this[_0x1159('0xc')][_0x50821d][_0x1159('0x1a')][_0x1159('0x11')]=_0x1159('0x24');this[_0x1159('0xc')][_0x50821d][_0x1159('0x1a')]['messageStatus']=_0xc1dfb1;return this['emit'](_0x50821d);}};EmailChannel[_0x1159('0x17')]['sendMail']=function(_0xb213af,_0x52d416){return this['smtp'][_0x1159('0x30')](_0xb213af,_0x52d416);};EmailChannel[_0x1159('0x17')][_0x1159('0x31')]=function(_0x34b53c){var _0x48d450=this;if(this[_0x1159('0xc')][_0x34b53c['id']]){if(_[_0x1159('0x14')](this[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')])){this[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')]={};}this[_0x1159('0xc')][_0x34b53c['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x12e42a,_0x476eae){return _0x48d450['smtp'][_0x1159('0x33')](_0x34b53c)['then'](function(_0x22b05a){_0x48d450[_0x1159('0xc')][_0x34b53c['id']]['Smtp'][_0x1159('0x11')]=_0x1159('0x34');_0x48d450[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')]['messageStatus']='';_0x48d450[_0x1159('0xe')](_0x34b53c['id']);_0x12e42a(_0x22b05a);})['catch'](function(_0xb61721){_0x48d450[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')][_0x1159('0x11')]='error';_0x48d450['mailAccounts'][_0x34b53c['id']][_0x1159('0x32')][_0x1159('0x12')]=_0xb61721;_0x48d450['emit'](_0x34b53c['id']);_0x476eae(_0xb61721);});});}return this['smtp'][_0x1159('0x33')](_0x34b53c);};module[_0x1159('0x35')]=EmailChannel; \ No newline at end of file +var _0x134a=['sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','md5','mailAccount:update','hasOwnProperty','service','provider','imapAccounts','handleImapEmail','bind','error','handleImapError','isNil','disabled','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','stringify','handleImapEnd','lastSync'];(function(_0x3006ec,_0x520480){var _0x1b7e14=function(_0x4657b2){while(--_0x4657b2){_0x3006ec['push'](_0x3006ec['shift']());}};_0x1b7e14(++_0x520480);}(_0x134a,0x77));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa134('0x0'));var moment=require(_0xa134('0x1'));var BPromise=require(_0xa134('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xa134('0x3'));var logger=require(_0xa134('0x4'))(_0xa134('0x5'));config[_0xa134('0x6')]=_[_0xa134('0x7')](config[_0xa134('0x6')],{'host':_0xa134('0x8'),'port':0x18eb});var io=require(_0xa134('0x9'))(new Redis(config[_0xa134('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xa134('0xa'));var mailAccount=require(_0xa134('0xb'));var md5Accounts={};function EmailChannel(_0x3ad65e){logger[_0xa134('0xc')]('start\x20email\x20channel');this[_0xa134('0xd')]=_0x3ad65e[_0xa134('0xd')];this['imapAccounts']={};this[_0xa134('0xe')]=new EmailSmtp();}EmailChannel[_0xa134('0xf')][_0xa134('0x10')]=function(_0x586889){var _0x81d455=this[_0xa134('0xd')][_0x586889];var _0x16f959={'id':_0x81d455['id'],'name':_0x81d455['name'],'key':_0x81d455[_0xa134('0x11')],'active':_0x81d455[_0xa134('0x12')],'Imap':{'status':_0x81d455[_0xa134('0x13')][_0xa134('0x14')],'messageStatus':_0x81d455['Imap'][_0xa134('0x15')],'total':_0x81d455['Imap'][_0xa134('0x16')]}};if(_['isNil'](md5Accounts[_0x586889])){md5Accounts[_0x586889]={};}var _0x5e1161=md5(JSON['stringify'](_0x16f959));if(md5Accounts[_0x586889][_0xa134('0x17')]!==_0x5e1161){md5Accounts[_0x586889][_0xa134('0x17')]=_0x5e1161;io[_0xa134('0x10')](_0xa134('0x18'),_0x16f959);}};EmailChannel[_0xa134('0xf')]['refresh']=function(_0x3bb9a6){for(var _0x2bcbca in _0x3bb9a6){if(_0x3bb9a6[_0xa134('0x19')](_0x2bcbca)){if(_0x3bb9a6[_0x2bcbca][_0xa134('0x13')]&&_0x3bb9a6[_0x2bcbca][_0xa134('0x12')]){var _0x1af48d=_0x3bb9a6[_0x2bcbca]['Imap'];if(!_0x1af48d[_0xa134('0x1a')]&&_0x3bb9a6[_0x2bcbca][_0xa134('0x1b')]!=='custom')_0x1af48d[_0xa134('0x1a')]=_0x3bb9a6[_0x2bcbca][_0xa134('0x1b')];if(!this['imapAccounts'][_0xa134('0x19')](_0x1af48d['id'])){this[_0xa134('0x1c')][_0x1af48d['id']]=new EmailImap(_0x1af48d,_0x3bb9a6[_0x2bcbca][_0xa134('0x5')]);this['imapAccounts'][_0x1af48d['id']]['on']('box',this['handleImapBox']['bind'](this,_0x2bcbca));this[_0xa134('0x1c')][_0x1af48d['id']]['on'](_0xa134('0x5'),this[_0xa134('0x1d')]['bind'](this,_0x2bcbca));this[_0xa134('0x1c')][_0x1af48d['id']]['on']('end',this['handleImapEnd'][_0xa134('0x1e')](this,_0x2bcbca));this[_0xa134('0x1c')][_0x1af48d['id']]['on'](_0xa134('0x1f'),this[_0xa134('0x20')][_0xa134('0x1e')](this,_0x2bcbca));}}else{if(_[_0xa134('0x21')](this[_0xa134('0xd')][_0x2bcbca][_0xa134('0x13')])){this[_0xa134('0xd')][_0x2bcbca]['Imap']={};}this[_0xa134('0xd')][_0x2bcbca][_0xa134('0x13')][_0xa134('0x14')]=_0xa134('0x22');this[_0xa134('0xd')][_0x2bcbca]['Imap']['messageStatus']='';this[_0xa134('0x10')](_0x2bcbca);}}}};EmailChannel[_0xa134('0xf')][_0xa134('0x23')]=function(_0x5aa47d,_0x5a2068){if(this['mailAccounts'][_0x5aa47d]){this[_0xa134('0xd')][_0x5aa47d][_0xa134('0x13')]['status']=_0xa134('0x24');this[_0xa134('0xd')][_0x5aa47d][_0xa134('0x13')][_0xa134('0x15')]=_0x5a2068[_0xa134('0x25')];if(_0x5a2068[_0xa134('0x26')]){this[_0xa134('0xd')][_0x5aa47d][_0xa134('0x13')][_0xa134('0x16')]=_0x5a2068[_0xa134('0x26')][_0xa134('0x16')];}return this[_0xa134('0x10')](_0x5aa47d);}};EmailChannel[_0xa134('0xf')][_0xa134('0x1d')]=function(_0x3d0fd1,_0x59fb5e){logger[_0xa134('0xc')](_0xa134('0x27'),_0x59fb5e[_0xa134('0x28')],_0x59fb5e[_0xa134('0x29')],_0x59fb5e[_0xa134('0x2a')],_0x3d0fd1);if(this[_0xa134('0xd')][_0x3d0fd1]){return mailAccount[_0xa134('0x2b')](_0x3d0fd1,_0x59fb5e)[_0xa134('0x2c')](function(_0xad12bd){if(_0xad12bd){logger[_0xa134('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0xa134('0x2d')](function(_0x371623){logger[_0xa134('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa134('0x2e')](_0x371623));});}};EmailChannel[_0xa134('0xf')][_0xa134('0x2f')]=function(_0xddb1a1){if(this[_0xa134('0xd')][_0xddb1a1]&&this[_0xa134('0xd')][_0xddb1a1][_0xa134('0x13')]){if(this[_0xa134('0x1c')][this[_0xa134('0xd')][_0xddb1a1][_0xa134('0x13')]['id']]){delete this[_0xa134('0x1c')][this['mailAccounts'][_0xddb1a1][_0xa134('0x13')]['id']];}this['mailAccounts'][_0xddb1a1][_0xa134('0x13')][_0xa134('0x30')]=moment();this['emit'](_0xddb1a1);}};EmailChannel[_0xa134('0xf')][_0xa134('0x20')]=function(_0x2a1d7a,_0x16cf68){if(this['mailAccounts'][_0x2a1d7a]){this[_0xa134('0xd')][_0x2a1d7a][_0xa134('0x13')]['status']=_0xa134('0x1f');this[_0xa134('0xd')][_0x2a1d7a][_0xa134('0x13')][_0xa134('0x15')]=_0x16cf68;return this['emit'](_0x2a1d7a);}};EmailChannel[_0xa134('0xf')][_0xa134('0x31')]=function(_0x371f7d,_0x58722b){return this['smtp'][_0xa134('0x32')](_0x371f7d,_0x58722b);};EmailChannel['prototype'][_0xa134('0x33')]=function(_0xc38a67){var _0x582824=this;if(this['mailAccounts'][_0xc38a67['id']]){if(_[_0xa134('0x21')](this[_0xa134('0xd')][_0xc38a67['id']][_0xa134('0x34')])){this['mailAccounts'][_0xc38a67['id']][_0xa134('0x34')]={};}this[_0xa134('0xd')][_0xc38a67['id']][_0xa134('0x34')]['lastSync']=moment();return new BPromise(function(_0x5744ea,_0x369008){return _0x582824[_0xa134('0xe')][_0xa134('0x35')](_0xc38a67)[_0xa134('0x2c')](function(_0x4465b2){_0x582824[_0xa134('0xd')][_0xc38a67['id']][_0xa134('0x34')]['status']=_0xa134('0x36');_0x582824[_0xa134('0xd')][_0xc38a67['id']][_0xa134('0x34')][_0xa134('0x15')]='';_0x582824['emit'](_0xc38a67['id']);_0x5744ea(_0x4465b2);})[_0xa134('0x2d')](function(_0x423651){_0x582824[_0xa134('0xd')][_0xc38a67['id']][_0xa134('0x34')][_0xa134('0x14')]=_0xa134('0x1f');_0x582824[_0xa134('0xd')][_0xc38a67['id']]['Smtp'][_0xa134('0x15')]=_0x423651;_0x582824[_0xa134('0x10')](_0xc38a67['id']);_0x369008(_0x423651);});});}return this['smtp'][_0xa134('0x35')](_0xc38a67);};module[_0xa134('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1bda369..dcce643 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 _0xaadf=['handleReadUnseen','length','fetch','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','tls','autotls','required','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN'];(function(_0x431dbc,_0x1cd214){var _0x2e5bed=function(_0x1d3faf){while(--_0x1d3faf){_0x431dbc['push'](_0x431dbc['shift']());}};_0x2e5bed(++_0x1cd214);}(_0xaadf,0x114));var _0xfaad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaadf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfaad('0x0'));var util=require(_0xfaad('0x1'));var Imap=require(_0xfaad('0x2'));var simpleParser=require('mailparser')[_0xfaad('0x3')];var Iconv=require('iconv')[_0xfaad('0x4')];var EventEmitter=require(_0xfaad('0x5'))[_0xfaad('0x6')];var utils=require(_0xfaad('0x7'));var logger=require(_0xfaad('0x8'))('email');function EmailImap(_0x320228,_0x3418ce){this[_0xfaad('0x9')]=_0x320228[_0xfaad('0x9')];this[_0xfaad('0xa')]=this[_0xfaad('0xb')](_0x320228,_0x3418ce);this[_0xfaad('0x2')]=new Imap(this[_0xfaad('0xa')]);this[_0xfaad('0x2')][_0xfaad('0xc')](_0xfaad('0xd'),this['handleReady'][_0xfaad('0xe')](this));this[_0xfaad('0x2')][_0xfaad('0xc')](_0xfaad('0xf'),this[_0xfaad('0x10')][_0xfaad('0xe')](this));this[_0xfaad('0x2')]['on'](_0xfaad('0x11'),this[_0xfaad('0x12')][_0xfaad('0xe')](this));this[_0xfaad('0x2')]['connect']();}util[_0xfaad('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xfaad('0xb')]=function(_0x2e4177,_0x2844c5){var _0x6dae3e={'connTimeout':_0x2e4177[_0xfaad('0x14')]?_0x2e4177[_0xfaad('0x14')]*0x3e8:0x2710,'authTimeout':_0x2e4177[_0xfaad('0x15')]?_0x2e4177[_0xfaad('0x15')]*0x3e8:0x1388};if(_0x2e4177[_0xfaad('0x16')]){_0x6dae3e[_0xfaad('0x17')]=_0x2e4177[_0xfaad('0x17')];if(_0x2e4177['modernAuthentication']){_0x6dae3e['xoauth2']=utils[_0xfaad('0x18')](_0x2e4177[_0xfaad('0x19')][_0xfaad('0x1a')],_0x2e4177[_0xfaad('0x17')]);}else{_0x6dae3e[_0xfaad('0x1b')]=_0x2e4177[_0xfaad('0x1b')];}}else{if(_0x2e4177[_0xfaad('0x1c')]){_0x6dae3e['user']=_0x2e4177[_0xfaad('0x17')];_0x6dae3e[_0xfaad('0x1b')]=_0x2e4177['password'];}}_0x6dae3e[_0xfaad('0x1d')]=_0x2844c5||_0x2e4177[_0xfaad('0x17')]||_0xfaad('0x1e');_0x6dae3e['host']=_0x2e4177[_0xfaad('0x1f')];_0x6dae3e['port']=_0x2e4177['port']||0x3e1;if(_0x2e4177[_0xfaad('0x20')]){_0x6dae3e[_0xfaad('0x20')]=!![];}else{_0x6dae3e['tls']=![];_0x6dae3e[_0xfaad('0x21')]=_0xfaad('0x22');}return _0x6dae3e;};EmailImap[_0xfaad('0x23')][_0xfaad('0x24')]=function(){this[_0xfaad('0x2')][_0xfaad('0x25')](this[_0xfaad('0x9')],![],this[_0xfaad('0x26')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x26')]=function(_0x5aa382,_0x376c94){if(_0x5aa382){this[_0xfaad('0x12')](_0x5aa382,!![]);}else{this[_0xfaad('0x27')](_0xfaad('0x28'),_0x376c94);this[_0xfaad('0x29')]();}};EmailImap[_0xfaad('0x23')]['handleCloseBox']=function(_0x4a9dc7){if(_0x4a9dc7){this[_0xfaad('0x12')](_0x4a9dc7,!![]);}else{this[_0xfaad('0x2')][_0xfaad('0xf')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xfaad('0x2')][_0xfaad('0x2a')]([_0xfaad('0x2b')],this[_0xfaad('0x2c')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')]['handleReadUnseen']=function(_0x54712e,_0x367655){if(_0x54712e){this[_0xfaad('0x12')](_0x54712e,!![]);}else{if(_0x367655[_0xfaad('0x2d')]){try{var _0x2688a9=this[_0xfaad('0x2')][_0xfaad('0x2e')](_0x367655,{'bodies':'','markSeen':!![]});_0x2688a9['on']('message',this['handleFetchMessage'][_0xfaad('0xe')](this));_0x2688a9['once'](_0xfaad('0x11'),this[_0xfaad('0x2f')]['bind'](this));_0x2688a9['once'](_0xfaad('0xf'),this[_0xfaad('0x30')]['bind'](this));}catch(_0xf7dad2){logger[_0xfaad('0x11')](_0xf7dad2);}}else{this[_0xfaad('0x2')][_0xfaad('0x31')](!![],this[_0xfaad('0x32')]['bind'](this));}}};EmailImap[_0xfaad('0x23')][_0xfaad('0x33')]=function(_0x4b7c4b){_0x4b7c4b['on'](_0xfaad('0x34'),this['handleMessageBody']['bind'](this));_0x4b7c4b[_0xfaad('0xc')](_0xfaad('0x35'),this['handleMessageAttributes'][_0xfaad('0xe')](this));_0x4b7c4b['once'](_0xfaad('0xf'),this[_0xfaad('0x36')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x37')]=function(_0x7ed1a3){simpleParser(_0x7ed1a3,{'Iconv':Iconv},this[_0xfaad('0x38')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x39')]=function(){};EmailImap['prototype'][_0xfaad('0x36')]=function(){};EmailImap[_0xfaad('0x23')][_0xfaad('0x38')]=function(_0x1feac6,_0x15894b){if(_0x1feac6){logger[_0xfaad('0x11')](_0x1feac6);}else{var _0x577a42=this;utils[_0xfaad('0x3a')](this[_0xfaad('0xa')],_0x15894b,function(_0x5a22be){_0x577a42[_0xfaad('0x27')](_0xfaad('0x1d'),_0x5a22be);});}};EmailImap[_0xfaad('0x23')][_0xfaad('0x30')]=function(){this['imap'][_0xfaad('0x31')](!![],this[_0xfaad('0x32')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x2f')]=function(_0xdace4d){this['handleError'](_0xdace4d);this[_0xfaad('0x2')][_0xfaad('0x31')](!![],this[_0xfaad('0x32')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x10')]=function(){this[_0xfaad('0x27')](_0xfaad('0xf'));};EmailImap[_0xfaad('0x23')][_0xfaad('0x12')]=function(_0x4a7406,_0x3766ba){logger[_0xfaad('0x11')](_0xfaad('0x12'),this[_0xfaad('0xa')]['email'],JSON[_0xfaad('0x3b')](_0x4a7406));var _0x2748a0='';if(_0x4a7406){if(_0x4a7406[_0xfaad('0x3c')]){_0x2748a0=_0x4a7406[_0xfaad('0x3c')];}else{for(var _0x31296e in _0x4a7406){if(_0x4a7406[_0xfaad('0x3d')](_0x31296e)){_0x2748a0+=_[_0xfaad('0x3e')](_0x31296e)+':\x20'+_0x4a7406[_0x31296e]+'\x0a';}}}}if(_0x3766ba){this[_0xfaad('0x2')][_0xfaad('0xf')]();}else{this[_0xfaad('0x27')]('error',_0x2748a0);this[_0xfaad('0x27')](_0xfaad('0xf'));}};module[_0xfaad('0x3f')]=EmailImap; \ No newline at end of file +var _0x5d25=['authentication','host','port','tls','autotls','handleReady','openBox','handleOpenBox','handleError','readUnseen','end','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','emit','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleEnd','bind','error','connect','prototype','authTimeout','service','user','xoauth2','generateXOAuth2Token','data5','password'];(function(_0x3dfd03,_0x4f887b){var _0x262bd1=function(_0x37aed6){while(--_0x37aed6){_0x3dfd03['push'](_0x3dfd03['shift']());}};_0x262bd1(++_0x4f887b);}(_0x5d25,0x8e));var _0x55d2=function(_0x2c95aa,_0x403df0){_0x2c95aa=_0x2c95aa-0x0;var _0x5db2d5=_0x5d25[_0x2c95aa];return _0x5db2d5;};'use strict';var _=require(_0x55d2('0x0'));var util=require(_0x55d2('0x1'));var Imap=require(_0x55d2('0x2'));var simpleParser=require('mailparser')[_0x55d2('0x3')];var Iconv=require(_0x55d2('0x4'))[_0x55d2('0x5')];var EventEmitter=require('events')[_0x55d2('0x6')];var utils=require('./utils');var logger=require(_0x55d2('0x7'))(_0x55d2('0x8'));function EmailImap(_0x15543c,_0x53bbf2){this[_0x55d2('0x9')]=_0x15543c[_0x55d2('0x9')];this[_0x55d2('0xa')]=this[_0x55d2('0xb')](_0x15543c,_0x53bbf2);this['imap']=new Imap(this[_0x55d2('0xa')]);this[_0x55d2('0x2')][_0x55d2('0xc')](_0x55d2('0xd'),this['handleReady']['bind'](this));this[_0x55d2('0x2')]['once']('end',this[_0x55d2('0xe')][_0x55d2('0xf')](this));this[_0x55d2('0x2')]['on'](_0x55d2('0x10'),this['handleError'][_0x55d2('0xf')](this));this[_0x55d2('0x2')][_0x55d2('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x55d2('0x12')][_0x55d2('0xb')]=function(_0x4edb88,_0x168b21){var _0x35de20={'connTimeout':_0x4edb88['connTimeout']?_0x4edb88['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4edb88[_0x55d2('0x13')]?_0x4edb88[_0x55d2('0x13')]*0x3e8:0x1388};if(_0x4edb88[_0x55d2('0x14')]){_0x35de20[_0x55d2('0x15')]=_0x4edb88[_0x55d2('0x15')];if(_0x4edb88['modernAuthentication']){_0x35de20[_0x55d2('0x16')]=utils[_0x55d2('0x17')](_0x4edb88['CloudProvider'][_0x55d2('0x18')],_0x4edb88[_0x55d2('0x15')]);}else{_0x35de20['password']=_0x4edb88[_0x55d2('0x19')];}}else{if(_0x4edb88[_0x55d2('0x1a')]){_0x35de20[_0x55d2('0x15')]=_0x4edb88[_0x55d2('0x15')];_0x35de20['password']=_0x4edb88[_0x55d2('0x19')];}}_0x35de20[_0x55d2('0x8')]=_0x168b21||_0x4edb88[_0x55d2('0x15')]||'anonymous@xcally.com';_0x35de20[_0x55d2('0x1b')]=_0x4edb88['host'];_0x35de20[_0x55d2('0x1c')]=_0x4edb88[_0x55d2('0x1c')]||0x3e1;if(_0x4edb88['tls']){_0x35de20[_0x55d2('0x1d')]=!![];}else{_0x35de20[_0x55d2('0x1d')]=![];_0x35de20[_0x55d2('0x1e')]='required';}return _0x35de20;};EmailImap[_0x55d2('0x12')][_0x55d2('0x1f')]=function(){this[_0x55d2('0x2')][_0x55d2('0x20')](this[_0x55d2('0x9')],![],this['handleOpenBox'][_0x55d2('0xf')](this));};EmailImap[_0x55d2('0x12')][_0x55d2('0x21')]=function(_0x589db2,_0x3c35bc){if(_0x589db2){this[_0x55d2('0x22')](_0x589db2,!![]);}else{this['emit']('box',_0x3c35bc);this[_0x55d2('0x23')]();}};EmailImap[_0x55d2('0x12')]['handleCloseBox']=function(_0x4e29db){if(_0x4e29db){this['handleError'](_0x4e29db,!![]);}else{this[_0x55d2('0x2')][_0x55d2('0x24')]();}};EmailImap[_0x55d2('0x12')]['readUnseen']=function(){this['imap'][_0x55d2('0x25')]([_0x55d2('0x26')],this[_0x55d2('0x27')][_0x55d2('0xf')](this));};EmailImap[_0x55d2('0x12')][_0x55d2('0x27')]=function(_0x479b32,_0x1fe876){if(_0x479b32){this[_0x55d2('0x22')](_0x479b32,!![]);}else{if(_0x1fe876['length']){try{var _0xc71e5d=this['imap'][_0x55d2('0x28')](_0x1fe876,{'bodies':'','markSeen':!![]});_0xc71e5d['on']('message',this[_0x55d2('0x29')][_0x55d2('0xf')](this));_0xc71e5d[_0x55d2('0xc')](_0x55d2('0x10'),this[_0x55d2('0x2a')][_0x55d2('0xf')](this));_0xc71e5d[_0x55d2('0xc')](_0x55d2('0x24'),this[_0x55d2('0x2b')][_0x55d2('0xf')](this));}catch(_0x476dae){logger[_0x55d2('0x10')](_0x476dae);}}else{this['imap'][_0x55d2('0x2c')](!![],this[_0x55d2('0x2d')][_0x55d2('0xf')](this));}}};EmailImap['prototype'][_0x55d2('0x29')]=function(_0x147fbc){_0x147fbc['on']('body',this['handleMessageBody'][_0x55d2('0xf')](this));_0x147fbc[_0x55d2('0xc')]('attributes',this['handleMessageAttributes'][_0x55d2('0xf')](this));_0x147fbc['once'](_0x55d2('0x24'),this[_0x55d2('0x2e')][_0x55d2('0xf')](this));};EmailImap['prototype'][_0x55d2('0x2f')]=function(_0x4c585a){simpleParser(_0x4c585a,{'Iconv':Iconv},this[_0x55d2('0x30')][_0x55d2('0xf')](this));};EmailImap['prototype'][_0x55d2('0x31')]=function(){};EmailImap[_0x55d2('0x12')][_0x55d2('0x2e')]=function(){};EmailImap[_0x55d2('0x12')][_0x55d2('0x30')]=function(_0x5b5d02,_0x9d12d){if(_0x5b5d02){logger[_0x55d2('0x10')](_0x5b5d02);}else{var _0x317052=this;utils[_0x55d2('0x32')](this[_0x55d2('0xa')],_0x9d12d,function(_0x35752c){_0x317052[_0x55d2('0x33')](_0x55d2('0x8'),_0x35752c);});}};EmailImap[_0x55d2('0x12')][_0x55d2('0x2b')]=function(){this[_0x55d2('0x2')][_0x55d2('0x2c')](!![],this[_0x55d2('0x2d')]['bind'](this));};EmailImap['prototype'][_0x55d2('0x2a')]=function(_0x549459){this[_0x55d2('0x22')](_0x549459);this[_0x55d2('0x2')][_0x55d2('0x2c')](!![],this[_0x55d2('0x2d')][_0x55d2('0xf')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0x55d2('0x24'));};EmailImap[_0x55d2('0x12')][_0x55d2('0x22')]=function(_0x5776bc,_0x197014){logger[_0x55d2('0x10')]('handleError',this['account'][_0x55d2('0x8')],JSON[_0x55d2('0x34')](_0x5776bc));var _0x8ed57b='';if(_0x5776bc){if(_0x5776bc[_0x55d2('0x35')]){_0x8ed57b=_0x5776bc['textCode'];}else{for(var _0x444677 in _0x5776bc){if(_0x5776bc[_0x55d2('0x36')](_0x444677)){_0x8ed57b+=_['upperFirst'](_0x444677)+':\x20'+_0x5776bc[_0x444677]+'\x0a';}}}}if(_0x197014){this['imap']['end']();}else{this[_0x55d2('0x33')](_0x55d2('0x10'),_0x8ed57b);this[_0x55d2('0x33')](_0x55d2('0x24'));}};module[_0x55d2('0x37')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9da6184..c942011 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 _0xbb4e=['compile','sendMail','verify','toString','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x2ced4f,_0x3e2bec){var _0x4cf01a=function(_0x1c0a08){while(--_0x1c0a08){_0x2ced4f['push'](_0x2ced4f['shift']());}};_0x4cf01a(++_0x3e2bec);}(_0xbb4e,0x7d));var _0xebb4=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0xbb4e[_0x2f54b6];return _0x169f21;};'use strict';var nodemailer=require(_0xebb4('0x0'));var inlineBase64=require(_0xebb4('0x1'));function EmailSmtp(){}EmailSmtp[_0xebb4('0x2')]['send']=function(_0x491e14,_0x350236){return new Promise(function(_0x154ede,_0x2872bd){var _0x380eb9=nodemailer[_0xebb4('0x3')](_0x491e14);_0x380eb9[_0xebb4('0x4')](_0xebb4('0x5'),inlineBase64());_0x380eb9[_0xebb4('0x6')](_0x350236,function(_0x1c95bd,_0x2a6f43){if(_0x1c95bd){_0x2872bd(_0x1c95bd['toString']());}else{_0x154ede(_0x2a6f43);}});});};EmailSmtp[_0xebb4('0x2')][_0xebb4('0x7')]=function(_0x36d77a){return new Promise(function(_0x579053,_0x15a2d8){var _0x5d79fd=nodemailer[_0xebb4('0x3')](_0x36d77a);_0x5d79fd[_0xebb4('0x7')](function(_0x200168,_0x2b8c9d){if(_0x200168){_0x15a2d8(_0x200168[_0xebb4('0x8')]());}else{if(_0x2b8c9d){_0x579053(_0x2b8c9d);}else{_0x15a2d8('Not\x20verifired');}}});});};module[_0xebb4('0x9')]=EmailSmtp; \ No newline at end of file +var _0xe454=['toString','verify','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xe454,0x1b3));var _0x4e45=function(_0x1e3993,_0x5358b8){_0x1e3993=_0x1e3993-0x0;var _0x25b3c1=_0xe454[_0x1e3993];return _0x25b3c1;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x4e45('0x0'));function EmailSmtp(){}EmailSmtp[_0x4e45('0x1')][_0x4e45('0x2')]=function(_0x2703ff,_0x5764db){return new Promise(function(_0x2bda07,_0x1af203){var _0x4edbad=nodemailer[_0x4e45('0x3')](_0x2703ff);_0x4edbad[_0x4e45('0x4')]('compile',inlineBase64());_0x4edbad[_0x4e45('0x5')](_0x5764db,function(_0x3096fd,_0x2676d1){if(_0x3096fd){_0x1af203(_0x3096fd[_0x4e45('0x6')]());}else{_0x2bda07(_0x2676d1);}});});};EmailSmtp[_0x4e45('0x1')][_0x4e45('0x7')]=function(_0x8a4a89){return new Promise(function(_0x4d6667,_0x7d165d){var _0x99f2db=nodemailer['createTransport'](_0x8a4a89);_0x99f2db['verify'](function(_0x12629a,_0x4667dd){if(_0x12629a){_0x7d165d(_0x12629a[_0x4e45('0x6')]());}else{if(_0x4667dd){_0x4d6667(_0x4667dd);}else{_0x7d165d('Not\x20verifired');}}});});};module[_0x4e45('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1a14511..ec0ccab 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 _0xa4bb=['info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','value','name','substring','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','test','replace','includes','attachments','forEach','push','filename','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x403306[_0xba4b('0x10')](0x0,-0x1)[_0xba4b('0x11')]('\x20'):_0x3b0e52[_0xba4b('0xd')];}return _0xba4b('0x12');}function getLastName(_0x3f40cf){var _0x336b06=_[_0xba4b('0x8')](_0x3f40cf[_0xba4b('0xc')]);if(_0x336b06&&_0x336b06['name']){var _0xe5108d=_0x336b06[_0xba4b('0xd')][_0xba4b('0xf')](/\s+/);return _0xe5108d[_0xba4b('0x13')]>0x1?_0xe5108d[_0xba4b('0x14')]():'';}return'';}function getMails(_0x446249,_0x41d5e3){var _0x2881ff='';for(var _0x165a91=0x0;_0x165a91<_0x41d5e3[_0xba4b('0xc')]['length'];_0x165a91+=0x1){if(_0x41d5e3['value'][_0x165a91][_0xba4b('0x9')]!==_0x446249){if(!_[_0xba4b('0x15')](_0x2881ff)){_0x2881ff+=',';}_0x2881ff+=_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0xd')]||_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0x9')]||'';_0x2881ff+='\x20<';_0x2881ff+=_0x41d5e3[_0xba4b('0xc')][_0x165a91]['address']?_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0x9')]:_0xba4b('0xa')+random[_0xba4b('0xb')](0x6)+_0xba4b('0x16');_0x2881ff+='>';}}return _0x2881ff;}function parseEmail(_0x54493d,_0x3d4b73,_0x7c7a88){if(_0x3d4b73[_0xba4b('0x17')]){var _0x4b9de1=/)<[^<]*)*<\/script>/gi;while(_0x4b9de1[_0xba4b('0x18')](_0x3d4b73[_0xba4b('0x17')])){_0x3d4b73[_0xba4b('0x17')]=_0x3d4b73['html'][_0xba4b('0x19')](_0x4b9de1,'');}if(_0x3d4b73['html'][_0xba4b('0x1a')]('{_0x18effd[_0xba4b('0x1d')](_0x3c0667[_0xba4b('0x1e')]);});var _0x40ccaf=/]+>/g;var _0x2efbf1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1e4b46=_0x3d4b73[_0xba4b('0x17')][_0xba4b('0x19')](_0x2efbf1,'_SRC');var _0x1827de=_0x1e4b46['replace'](_0x40ccaf,'_IMG');for(let _0x2250a1=0x0;_0x2250a1<_0x18effd['length'];_0x2250a1++){var _0x416d48=_0x1827de[_0xba4b('0x19')]('_IMG',_0xba4b('0x1f')+_0x18effd[_0x2250a1]+_0xba4b('0x20'));_0x1827de=_0x416d48;}_0x3d4b73[_0xba4b('0x17')]=_0x1827de;}_0x7c7a88[_0xba4b('0x21')]=_0x3d4b73['html'];}else{_0x7c7a88[_0xba4b('0x21')]=_0x3d4b73[_0xba4b('0x22')];}if(_0x7c7a88[_0xba4b('0x21')]){_0x7c7a88[_0xba4b('0x21')]=_0x7c7a88[_0xba4b('0x21')]['replace'](/0x0){var _0x58a6fb=[_0xba4b('0x30'),_0xba4b('0x31'),_0xba4b('0x32')];for(var _0x1260ef=0x0;_0x1260ef<_0x3d4b73['headerLines'][_0xba4b('0x13')];_0x1260ef++){var _0x3a270b=_['indexOf'](_0x58a6fb,_0x3d4b73[_0xba4b('0x2f')][_0x1260ef][_0xba4b('0x33')]);if(_0x3a270b>=0x0){_0x7c7a88['isAutoreply']=!![];}}}return _0x7c7a88;}exports[_0xba4b('0x34')]=function(_0x935542,_0x591e0d,_0x31b6b9){var _0x1277ae={'from':getAddress(_0x591e0d[_0xba4b('0x35')]),'firstName':getFirstName(_0x591e0d[_0xba4b('0x35')]),'lastName':getLastName(_0x591e0d[_0xba4b('0x35')]),'mapKey':_0xba4b('0x25'),'message':{'from':getMails(_0x935542[_0xba4b('0x25')],_0x591e0d[_0xba4b('0x35')]),'to':_0x935542['email'],'cc':'','subject':_0x591e0d[_0xba4b('0x36')]||'','messageId':_0x591e0d[_0xba4b('0x37')],'inReplyTo':_0x591e0d[_0xba4b('0x38')],'sentAt':moment(_0x591e0d['date'])['format'](_0xba4b('0x39')),'attach':![],'attachments':[]}};if(!_0x591e0d[_0xba4b('0x17')]&&!_0x591e0d[_0xba4b('0x22')]){var _0x5f24bc=_[_0xba4b('0x3a')](_0x591e0d[_0xba4b('0x1b')],{'contentType':_0xba4b('0x3b')});if(_0x5f24bc[_0xba4b('0x13')]){logger[_0xba4b('0x3c')](util['format'](_0xba4b('0x3d'),_0x591e0d[_0xba4b('0x37')]));tnef['parseBuffer'](_[_0xba4b('0x3e')](_0x5f24bc)['content'],function(_0x5407e3,_0x2df606){if(_0x2df606){_0x591e0d[_0xba4b('0x17')]=_0x2df606[_0xba4b('0x3f')]||_0xba4b('0x40');if(_0x2df606['Attachments']){for(var _0x3bfbba=0x0;_0x3bfbba<_0x2df606[_0xba4b('0x41')]['length'];_0x3bfbba++){var _0x323149=_0x2df606[_0xba4b('0x41')][_0x3bfbba];_0x1277ae['message'][_0xba4b('0x1b')][_0xba4b('0x1d')]({'filename':_0x323149['Title'],'content':Buffer['from'](_0x323149['Data'])});}}}_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));});}else{_0x591e0d[_0xba4b('0x17')]=_0xba4b('0x40');_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));}}else{_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));}};exports[_0xba4b('0x42')]=function(_0x5f168b,_0xb62289){var _0x2df47f=[_0xba4b('0x43')+(_0xb62289||''),_0xba4b('0x44')+_0x5f168b,'',''];return Buffer['from'](_0x2df47f[_0xba4b('0x11')](''),_0xba4b('0x45'))[_0xba4b('0x46')](_0xba4b('0x47'));}; \ No newline at end of file +var _0xf437=['filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','Anonymous','isEmpty','html','replace','0x1?_0x57449f[_0x7f43('0x12')](0x0,-0x1)['join']('\x20'):_0x5d1d24[_0x7f43('0xf')];}return _0x7f43('0x13');}function getLastName(_0x202c5f){var _0x55f6af=_['head'](_0x202c5f[_0x7f43('0xa')]);if(_0x55f6af&&_0x55f6af[_0x7f43('0xf')]){var _0x588ec3=_0x55f6af[_0x7f43('0xf')][_0x7f43('0x10')](/\s+/);return _0x588ec3[_0x7f43('0x11')]>0x1?_0x588ec3['pop']():'';}return'';}function getMails(_0x3a3509,_0x4860ea){var _0x46dbb8='';for(var _0x5dd9d2=0x0;_0x5dd9d2<_0x4860ea[_0x7f43('0xa')]['length'];_0x5dd9d2+=0x1){if(_0x4860ea[_0x7f43('0xa')][_0x5dd9d2][_0x7f43('0xb')]!==_0x3a3509){if(!_[_0x7f43('0x14')](_0x46dbb8)){_0x46dbb8+=',';}_0x46dbb8+=_0x4860ea[_0x7f43('0xa')][_0x5dd9d2][_0x7f43('0xf')]||_0x4860ea[_0x7f43('0xa')][_0x5dd9d2]['address']||'';_0x46dbb8+='\x20<';_0x46dbb8+=_0x4860ea['value'][_0x5dd9d2][_0x7f43('0xb')]?_0x4860ea['value'][_0x5dd9d2]['address']:'anonymous'+random[_0x7f43('0xd')](0x6)+_0x7f43('0xe');_0x46dbb8+='>';}}return _0x46dbb8;}function parseEmail(_0x406ebd,_0x5abfb8,_0x46d88a){if(_0x5abfb8[_0x7f43('0x15')]){var _0x40368a=/)<[^<]*)*<\/script>/gi;while(_0x40368a['test'](_0x5abfb8[_0x7f43('0x15')])){_0x5abfb8['html']=_0x5abfb8[_0x7f43('0x15')][_0x7f43('0x16')](_0x40368a,'');}if(_0x5abfb8[_0x7f43('0x15')]['includes'](_0x7f43('0x17'))){var _0x2ac901=[];_0x5abfb8[_0x7f43('0x18')][_0x7f43('0x19')](_0x51d045=>{_0x2ac901[_0x7f43('0x1a')](_0x51d045[_0x7f43('0x1b')]);});var _0x1b25b0=/]+>/g;var _0x44da0f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x10a480=_0x5abfb8[_0x7f43('0x15')]['replace'](_0x44da0f,_0x7f43('0x1c'));var _0x235bc5=_0x10a480[_0x7f43('0x16')](_0x1b25b0,_0x7f43('0x1d'));for(let _0x1b5c41=0x0;_0x1b5c41<_0x2ac901[_0x7f43('0x11')];_0x1b5c41++){var _0x511edb=_0x235bc5['replace']('_IMG',_0x7f43('0x1e')+_0x2ac901[_0x1b5c41]+_0x7f43('0x1f'));_0x235bc5=_0x511edb;}_0x5abfb8['html']=_0x235bc5;}_0x46d88a[_0x7f43('0x20')]=_0x5abfb8[_0x7f43('0x15')];}else{_0x46d88a['body']=_0x5abfb8[_0x7f43('0x21')];}if(_0x46d88a[_0x7f43('0x20')]){_0x46d88a[_0x7f43('0x20')]=_0x46d88a[_0x7f43('0x20')]['replace'](/0x0){var _0x45bb6e=[_0x7f43('0x33'),_0x7f43('0x34'),_0x7f43('0x35')];for(var _0x3594d6=0x0;_0x3594d6<_0x5abfb8[_0x7f43('0x32')][_0x7f43('0x11')];_0x3594d6++){var _0x7a1368=_['indexOf'](_0x45bb6e,_0x5abfb8[_0x7f43('0x32')][_0x3594d6][_0x7f43('0x36')]);if(_0x7a1368>=0x0){_0x46d88a['isAutoreply']=!![];}}}return _0x46d88a;}exports[_0x7f43('0x37')]=function(_0x4e2024,_0x4a93f4,_0x32e134){var _0x4c0e51={'from':getAddress(_0x4a93f4['from']),'firstName':getFirstName(_0x4a93f4[_0x7f43('0x38')]),'lastName':getLastName(_0x4a93f4['from']),'mapKey':_0x7f43('0x7'),'message':{'from':getMails(_0x4e2024[_0x7f43('0x7')],_0x4a93f4[_0x7f43('0x38')]),'to':_0x4e2024[_0x7f43('0x7')],'cc':'','subject':_0x4a93f4[_0x7f43('0x39')]||'','messageId':_0x4a93f4[_0x7f43('0x3a')],'inReplyTo':_0x4a93f4[_0x7f43('0x3b')],'sentAt':moment(_0x4a93f4[_0x7f43('0x3c')])[_0x7f43('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4a93f4[_0x7f43('0x15')]&&!_0x4a93f4[_0x7f43('0x21')]){var _0x28024c=_[_0x7f43('0x3d')](_0x4a93f4[_0x7f43('0x18')],{'contentType':_0x7f43('0x3e')});if(_0x28024c[_0x7f43('0x11')]){logger['info'](util[_0x7f43('0x2a')](_0x7f43('0x3f'),_0x4a93f4[_0x7f43('0x3a')]));tnef['parseBuffer'](_[_0x7f43('0x40')](_0x28024c)[_0x7f43('0x31')],function(_0x2bd404,_0x1386a5){if(_0x1386a5){_0x4a93f4[_0x7f43('0x15')]=_0x1386a5[_0x7f43('0x41')]||_0x7f43('0x42');if(_0x1386a5['Attachments']){for(var _0x29e275=0x0;_0x29e275<_0x1386a5[_0x7f43('0x43')][_0x7f43('0x11')];_0x29e275++){var _0x2c2149=_0x1386a5[_0x7f43('0x43')][_0x29e275];_0x4c0e51[_0x7f43('0x23')][_0x7f43('0x18')]['push']({'filename':_0x2c2149['Title'],'content':Buffer[_0x7f43('0x38')](_0x2c2149['Data'])});}}}_0x32e134(parseEmail(_0x4e2024,_0x4a93f4,_0x4c0e51));});}else{_0x4a93f4[_0x7f43('0x15')]=_0x7f43('0x42');_0x32e134(parseEmail(_0x4e2024,_0x4a93f4,_0x4c0e51));}}else{_0x32e134(parseEmail(_0x4e2024,_0x4a93f4,_0x4c0e51));}};exports[_0x7f43('0x44')]=function(_0x4f3e7f,_0x573281){var _0x37f4b6=[_0x7f43('0x45')+(_0x573281||''),'auth=Bearer\x20'+_0x4f3e7f,'',''];return Buffer[_0x7f43('0x38')](_0x37f4b6[_0x7f43('0x2d')](''),_0x7f43('0x46'))[_0x7f43('0x47')](_0x7f43('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 983f999..b28323a 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 _0x457f=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x473791,_0x4f69bf){var _0x41917b=function(_0x2270d7){while(--_0x2270d7){_0x473791['push'](_0x473791['shift']());}};_0x41917b(++_0x4f69bf);}(_0x457f,0xd9));var _0xf457=function(_0x4ba981,_0x37f3f9){_0x4ba981=_0x4ba981-0x0;var _0x1159e2=_0x457f[_0x4ba981];return _0x1159e2;};'use strict';var _=require(_0xf457('0x0'));function MailAccount(_0x40baa3){this['id']=_0x40baa3['id']||0x0;this[_0xf457('0x1')]=_0x40baa3['name']||_0xf457('0x2');this[_0xf457('0x3')]=_0x40baa3[_0xf457('0x3')]||_0xf457('0x4');this[_0xf457('0x5')]=_0x40baa3[_0xf457('0x5')]||![];this[_0xf457('0x6')]=_0x40baa3[_0xf457('0x6')]||[];this[_0xf457('0x7')]=_0x40baa3['Smtp']||[];}module[_0xf457('0x8')]=MailAccount; \ No newline at end of file +var _0x8088=['lodash','name','Service','active','Imap','Smtp'];(function(_0x40f3a4,_0x42e6e8){var _0x440dcf=function(_0x5da3b1){while(--_0x5da3b1){_0x40f3a4['push'](_0x40f3a4['shift']());}};_0x440dcf(++_0x42e6e8);}(_0x8088,0x66));var _0x8808=function(_0x4d4498,_0x3b0d44){_0x4d4498=_0x4d4498-0x0;var _0x2cfc0f=_0x8088[_0x4d4498];return _0x2cfc0f;};'use strict';var _=require(_0x8808('0x0'));function MailAccount(_0x416823){this['id']=_0x416823['id']||0x0;this[_0x8808('0x1')]=_0x416823[_0x8808('0x1')]||_0x8808('0x2');this['key']=_0x416823['key']||'SERV';this[_0x8808('0x3')]=_0x416823[_0x8808('0x3')]||![];this['Imap']=_0x416823[_0x8808('0x4')]||[];this[_0x8808('0x5')]=_0x416823['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5e7cb37..154bb72 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 _0xb89c=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined'];(function(_0xf6a7f3,_0x259f77){var _0x1a6a53=function(_0x44eb0c){while(--_0x44eb0c){_0xf6a7f3['push'](_0xf6a7f3['shift']());}};_0x1a6a53(++_0x259f77);}(_0xb89c,0x130));var _0xcb89=function(_0x41e8d7,_0x45934a){_0x41e8d7=_0x41e8d7-0x0;var _0x2b001a=_0xb89c[_0x41e8d7];return _0x2b001a;};'use strict';var _=require(_0xcb89('0x0'));var MailAccount=require(_0xcb89('0x1'));var Realtime=function(){this[_0xcb89('0x2')]={};};function freeIsNotKey(_0x3ac4e6,_0x43deb4,_0x271120){var _0x57e7e4=_['mapKeys'](_0x3ac4e6,function(_0x201824,_0x4e17a9){return _0x201824[_0x271120];});for(var _0x4a8b4b in _0x43deb4){if(_0x43deb4[_0xcb89('0x3')](_0x4a8b4b)){if(!_0x57e7e4[_0x4a8b4b]){delete _0x43deb4[_0x4a8b4b];}}}}Realtime[_0xcb89('0x4')][_0xcb89('0x5')]=function(_0x21b80c,_0x2f47b9){for(var _0x5ce137 in _0x2f47b9){if(_0x21b80c[_0xcb89('0x3')](_0x5ce137)){_0x21b80c[_0x5ce137]=_0x2f47b9[_0x5ce137];}}};Realtime[_0xcb89('0x4')]['initMailAccounts']=function(){var _0xa38ccb=this;return function(_0x405251){if(_0x405251){freeIsNotKey(_0x405251,_0xa38ccb[_0xcb89('0x2')],'id');for(var _0x1b6a47=0x0,_0x5eccc5={},_0x4d987d={};_0x1b6a47<_0x405251[_0xcb89('0x6')];_0x1b6a47+=0x1){_0x5eccc5=_0x405251[_0x1b6a47];if(_[_0xcb89('0x7')](_0xa38ccb[_0xcb89('0x2')][_0x5eccc5['id']])){_0xa38ccb['mailAccounts'][_0x5eccc5['id']]=new MailAccount(_0x5eccc5);}else{_['merge'](_0xa38ccb[_0xcb89('0x2')][_0x5eccc5['id']],_0x5eccc5);}}}return _0xa38ccb[_0xcb89('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x18bd=['exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','merge'];(function(_0x3dfe45,_0x15ae78){var _0x27fde2=function(_0x435120){while(--_0x435120){_0x3dfe45['push'](_0x3dfe45['shift']());}};_0x27fde2(++_0x15ae78);}(_0x18bd,0x139));var _0xd18b=function(_0x559f3c,_0x38a42a){_0x559f3c=_0x559f3c-0x0;var _0xa4a879=_0x18bd[_0x559f3c];return _0xa4a879;};'use strict';var _=require('lodash');var MailAccount=require(_0xd18b('0x0'));var Realtime=function(){this[_0xd18b('0x1')]={};};function freeIsNotKey(_0x4b3434,_0x5d51a0,_0x54b443){var _0x2311e9=_[_0xd18b('0x2')](_0x4b3434,function(_0x547c49,_0x486a71){return _0x547c49[_0x54b443];});for(var _0xafc5b3 in _0x5d51a0){if(_0x5d51a0[_0xd18b('0x3')](_0xafc5b3)){if(!_0x2311e9[_0xafc5b3]){delete _0x5d51a0[_0xafc5b3];}}}}Realtime['prototype'][_0xd18b('0x4')]=function(_0x13b02e,_0x2df281){for(var _0x425ce3 in _0x2df281){if(_0x13b02e[_0xd18b('0x3')](_0x425ce3)){_0x13b02e[_0x425ce3]=_0x2df281[_0x425ce3];}}};Realtime[_0xd18b('0x5')]['initMailAccounts']=function(){var _0x15158f=this;return function(_0x171efc){if(_0x171efc){freeIsNotKey(_0x171efc,_0x15158f[_0xd18b('0x1')],'id');for(var _0x5e5312=0x0,_0x19976d={},_0x5f3971={};_0x5e5312<_0x171efc['length'];_0x5e5312+=0x1){_0x19976d=_0x171efc[_0x5e5312];if(_['isUndefined'](_0x15158f[_0xd18b('0x1')][_0x19976d['id']])){_0x15158f[_0xd18b('0x1')][_0x19976d['id']]=new MailAccount(_0x19976d);}else{_[_0xd18b('0x6')](_0x15158f[_0xd18b('0x1')][_0x19976d['id']],_0x19976d);}}}return _0x15158f[_0xd18b('0x1')];};};module[_0xd18b('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0aa6d21..cb9135e 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 _0x3946=['MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','MailServerIn','Imap','type','data5','CloudProvider'];(function(_0xdb0b7d,_0x14a8ad){var _0x5765c0=function(_0x365766){while(--_0x365766){_0xdb0b7d['push'](_0xdb0b7d['shift']());}};_0x5765c0(++_0x14a8ad);}(_0x3946,0x10e));var _0x6394=function(_0x14b74f,_0xf24abd){_0x14b74f=_0x14b74f-0x0;var _0x11f35e=_0x3946[_0x14b74f];return _0x11f35e;};'use strict';var client=require(_0x6394('0x0'));exports[_0x6394('0x1')]=function(){return function(){return client[_0x6394('0x2')](_0x6394('0x3'),{'options':{'attributes':['id',_0x6394('0x4'),_0x6394('0x5'),_0x6394('0x6'),_0x6394('0x7'),_0x6394('0x8'),'key',_0x6394('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0x6394('0xa'),'as':_0x6394('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0x6394('0x4'),_0x6394('0x6'),_0x6394('0xc'),_0x6394('0xd')],'as':_0x6394('0xe')}]},{'model':_0x6394('0xf'),'as':_0x6394('0x10'),'include':[{'model':_0x6394('0xe'),'attributes':['id',_0x6394('0x4'),_0x6394('0x6'),_0x6394('0xc'),'data5'],'as':_0x6394('0xe')}]}]},'log':_0x6394('0x11')});};};exports['notify']=function(_0x21e9bc,_0x7d218e){return client[_0x6394('0x2')](_0x6394('0x12'),{'account':{'id':_0x21e9bc},'body':_0x7d218e,'log':_0x6394('0x12')});}; \ No newline at end of file +var _0x1574=['Imap','CloudProvider','name','type','data5','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x1fb25f,_0x5a62dc){var _0x1c5ad1=function(_0x575f94){while(--_0x575f94){_0x1fb25f['push'](_0x1fb25f['shift']());}};_0x1c5ad1(++_0x5a62dc);}(_0x1574,0x148));var _0x4157=function(_0x5dbde1,_0x3ae4fc){_0x5dbde1=_0x5dbde1-0x0;var _0x52b518=_0x1574[_0x5dbde1];return _0x52b518;};'use strict';var client=require(_0x4157('0x0'));exports[_0x4157('0x1')]=function(){return function(){return client[_0x4157('0x2')](_0x4157('0x3'),{'options':{'attributes':['id','name',_0x4157('0x4'),_0x4157('0x5'),_0x4157('0x6'),_0x4157('0x7'),_0x4157('0x8'),_0x4157('0x9'),_0x4157('0xa')],'raw':![],'include':[{'model':_0x4157('0xb'),'as':_0x4157('0xc'),'include':[{'model':_0x4157('0xd'),'attributes':['id',_0x4157('0xe'),_0x4157('0x5'),_0x4157('0xf'),_0x4157('0x10')],'as':_0x4157('0xd')}]},{'model':'MailServerOut','as':_0x4157('0x11'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x4157('0xf'),_0x4157('0x10')],'as':_0x4157('0xd')}]}]},'log':'getMailAccount'});};};exports[_0x4157('0x12')]=function(_0x127130,_0x4316a6){return client[_0x4157('0x2')](_0x4157('0x13'),{'account':{'id':_0x127130},'body':_0x4316a6,'log':_0x4157('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5b8f9ec..e5e3d6e 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 _0x5b81=['GetSettings','Request'];(function(_0x269f84,_0x3fc79a){var _0x190cd9=function(_0x4b7f5a){while(--_0x4b7f5a){_0x269f84['push'](_0x269f84['shift']());}};_0x190cd9(++_0x3fc79a);}(_0x5b81,0x159));var _0x15b8=function(_0x36b7ca,_0x51f49d){_0x36b7ca=_0x36b7ca-0x0;var _0x3771ae=_0x5b81[_0x36b7ca];return _0x3771ae;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x15b8('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x15b8('0x1')});}; \ No newline at end of file +var _0x3e0a=['loginMailFrequency','../client','getSettings','ShowSetting'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x3e0a,0x10d));var _0xa3e0=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x3e0a[_0x3238ea];return _0x4aaac2;};'use strict';var client=require(_0xa3e0('0x0'));exports[_0xa3e0('0x1')]=function(){return client['Request'](_0xa3e0('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa3e0('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a2dee4e..c8a91a7 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 0ebafa4..f413564 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 _0x281b=['http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','localhost','default','../../config/socketio','../../config/express','../../routes','once','listening','log','lodash'];(function(_0x1e849f,_0x1ab5de){var _0x258194=function(_0x588a53){while(--_0x588a53){_0x1e849f['push'](_0x1e849f['shift']());}};_0x258194(++_0x1ab5de);}(_0x281b,0x1a3));var _0xb281=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0x281b[_0x217cfd];return _0x1e887f;};'use strict';var _=require(_0xb281('0x0'));var http=require(_0xb281('0x1'));var express=require(_0xb281('0x2'));var sticky=require(_0xb281('0x3'));var Redis=require('ioredis');var config=require(_0xb281('0x4'));var app=express();var server=http[_0xb281('0x5')](app);server[_0xb281('0x6')]=0xdbba0;if(sticky[_0xb281('0x7')](server,config[_0xb281('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xb281('0x9'),_0xb281('0xa')]});config[_0xb281('0xb')]=_['defaults'](config[_0xb281('0xb')],{'host':_0xb281('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb281('0xb')])}));require('../../config/triggers')[_0xb281('0xd')]();require(_0xb281('0xe'))[_0xb281('0xd')](socketio);require(_0xb281('0xf'))['default'](app);require(_0xb281('0x10'))[_0xb281('0xd')](app);}else{server[_0xb281('0x11')](_0xb281('0x12'),function(){console[_0xb281('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x34ef=['defaults','localhost','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','listening','log','exports','lodash','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis'];(function(_0x9d65f5,_0x3d7c56){var _0x107b0e=function(_0x2ae578){while(--_0x2ae578){_0x9d65f5['push'](_0x9d65f5['shift']());}};_0x107b0e(++_0x3d7c56);}(_0x34ef,0x1d8));var _0xf34e=function(_0xad1c22,_0x2b2ed4){_0xad1c22=_0xad1c22-0x0;var _0x33f8ee=_0x34ef[_0xad1c22];return _0x33f8ee;};'use strict';var _=require(_0xf34e('0x0'));var http=require('http');var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xf34e('0x1'));var config=require(_0xf34e('0x2'));var app=express();var server=http[_0xf34e('0x3')](app);server[_0xf34e('0x4')]=0xdbba0;if(sticky[_0xf34e('0x5')](server,config[_0xf34e('0x6')])){var socketio=require(_0xf34e('0x7'))(server,{'transports':[_0xf34e('0x8'),_0xf34e('0x9')]});config[_0xf34e('0xa')]=_[_0xf34e('0xb')](config[_0xf34e('0xa')],{'host':_0xf34e('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xf34e('0xa')])}));require(_0xf34e('0xd'))['default']();require(_0xf34e('0xe'))[_0xf34e('0xf')](socketio);require(_0xf34e('0x10'))['default'](app);require(_0xf34e('0x11'))[_0xf34e('0xf')](app);}else{server['once'](_0xf34e('0x12'),function(){console[_0xf34e('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0xf34e('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4b53528..81df227 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 _0x289d=['catch','jayson/promise','../../config/logger','client','http','request','then','debug','rpc','routing','error','message','result'];(function(_0x478970,_0x5df032){var _0x1759f1=function(_0x58579d){while(--_0x58579d){_0x478970['push'](_0x478970['shift']());}};_0x1759f1(++_0x5df032);}(_0x289d,0x90));var _0xd289=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x289d[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0xd289('0x0'));var BPromise=require('bluebird');var logger=require(_0xd289('0x1'))('routing');var client=jayson[_0xd289('0x2')][_0xd289('0x3')]({'port':0x2329});client['Request']=function(_0x1d5a07,_0x26847c){return new BPromise(function(_0x2dd820,_0x133151){return client[_0xd289('0x4')](_0x1d5a07,_0x26847c)[_0xd289('0x5')](function(_0x3d9f64){logger[_0xd289('0x6')](_0xd289('0x7'),_0xd289('0x8'),_0x1d5a07,_0x26847c,_0x3d9f64);if(_0x3d9f64[_0xd289('0x9')]){logger[_0xd289('0x9')](_0xd289('0x7'),'routing',_0x1d5a07,_0x3d9f64[_0xd289('0x9')]['message'],_0x26847c);return _0x133151(_0x3d9f64[_0xd289('0x9')][_0xd289('0xa')]);}else{return _0x2dd820(_0x3d9f64[_0xd289('0xb')]);}})[_0xd289('0xc')](function(_0x5ed15d){logger['error']('rpc',_0xd289('0x8'),_0x1d5a07,_0x5ed15d,_0x26847c);return _0x133151(_0x5ed15d);});});};module['exports']=client; \ No newline at end of file +var _0x8cf3=['rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','error','message','result'];(function(_0x1ffb7e,_0x3846dd){var _0xc3f67c=function(_0xbeee80){while(--_0xbeee80){_0x1ffb7e['push'](_0x1ffb7e['shift']());}};_0xc3f67c(++_0x3846dd);}(_0x8cf3,0xf0));var _0x38cf=function(_0x2ff37b,_0x390997){_0x2ff37b=_0x2ff37b-0x0;var _0x2b7eae=_0x8cf3[_0x2ff37b];return _0x2b7eae;};'use strict';var jayson=require(_0x38cf('0x0'));var BPromise=require(_0x38cf('0x1'));var logger=require(_0x38cf('0x2'))(_0x38cf('0x3'));var client=jayson[_0x38cf('0x4')][_0x38cf('0x5')]({'port':0x2329});client['Request']=function(_0x226b23,_0xa96f16){return new BPromise(function(_0x12095b,_0x15a433){return client[_0x38cf('0x6')](_0x226b23,_0xa96f16)[_0x38cf('0x7')](function(_0x1ba6cd){logger[_0x38cf('0x8')]('rpc',_0x38cf('0x3'),_0x226b23,_0xa96f16,_0x1ba6cd);if(_0x1ba6cd[_0x38cf('0x9')]){logger['error']('rpc','routing',_0x226b23,_0x1ba6cd[_0x38cf('0x9')][_0x38cf('0xa')],_0xa96f16);return _0x15a433(_0x1ba6cd[_0x38cf('0x9')][_0x38cf('0xa')]);}else{return _0x12095b(_0x1ba6cd[_0x38cf('0xb')]);}})['catch'](function(_0x3422d1){logger['error'](_0x38cf('0xc'),_0x38cf('0x3'),_0x226b23,_0x3422d1,_0xa96f16);return _0x15a433(_0x3422d1);});});};module[_0x38cf('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 83442e6..49e3059 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 _0xd4a1=['log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x8dbd41,_0x4da4cd){var _0x4f00ee=function(_0xe26ca8){while(--_0xe26ca8){_0x8dbd41['push'](_0x8dbd41['shift']());}};_0x4f00ee(++_0x4da4cd);}(_0xd4a1,0x135));var _0x1d4a=function(_0x3ac8ed,_0x338754){_0x3ac8ed=_0x3ac8ed-0x0;var _0x2bb0d7=_0xd4a1[_0x3ac8ed];return _0x2bb0d7;};'use strict';var BPromise=require('bluebird');var server=require(_0x1d4a('0x0'));var Realtime=require(_0x1d4a('0x1'));var user=require(_0x1d4a('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x1d4a('0x3'));var chatQueue=require(_0x1d4a('0x4'));var smsQueue=require(_0x1d4a('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1d4a('0x6'));var whatsappQueue=require(_0x1d4a('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1d4a('0x8')]()[_0x1d4a('0x9')](user[_0x1d4a('0xa')]())[_0x1d4a('0x9')](realtime['initAgents']())[_0x1d4a('0x9')](interval[_0x1d4a('0xb')]())[_0x1d4a('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x1d4a('0xc')]())[_0x1d4a('0x9')](realtime[_0x1d4a('0xd')]())[_0x1d4a('0x9')](chatQueue[_0x1d4a('0xe')]())[_0x1d4a('0x9')](realtime['initChatQueues']())[_0x1d4a('0x9')](smsQueue[_0x1d4a('0xf')]())['then'](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0x1d4a('0x9')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0x1d4a('0x9')](realtime[_0x1d4a('0x10')]())[_0x1d4a('0x9')](whatsappQueue[_0x1d4a('0x11')]())['then'](realtime[_0x1d4a('0x12')]())[_0x1d4a('0x9')](function(){return realtime;});}function main(){return server[_0x1d4a('0x13')](realtime)[_0x1d4a('0x9')](function(_0x216aea){return initRealtime();})[_0x1d4a('0x9')](function(_0x2b79f7){return setInterval(initRealtime,0x1388);})[_0x1d4a('0x14')](function(_0x557ddd){console[_0x1d4a('0x15')](_0x557ddd);});}main(); \ No newline at end of file +var _0xe9c5=['resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','listen','catch','./server','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue'];(function(_0x2a573d,_0x284675){var _0x370c3f=function(_0x1ddb31){while(--_0x1ddb31){_0x2a573d['push'](_0x2a573d['shift']());}};_0x370c3f(++_0x284675);}(_0xe9c5,0x93));var _0x5e9c=function(_0x416e48,_0x5cd0c7){_0x416e48=_0x416e48-0x0;var _0x32cf9b=_0xe9c5[_0x416e48];return _0x32cf9b;};'use strict';var BPromise=require('bluebird');var server=require(_0x5e9c('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x5e9c('0x1'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x5e9c('0x2'));var mailQueue=require(_0x5e9c('0x3'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x5e9c('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x5e9c('0x5')]()[_0x5e9c('0x6')](user['getAgents']())[_0x5e9c('0x6')](realtime[_0x5e9c('0x7')]())['then'](interval[_0x5e9c('0x8')]())[_0x5e9c('0x6')](realtime[_0x5e9c('0x9')]())['then'](openchannelQueue[_0x5e9c('0xa')]())[_0x5e9c('0x6')](realtime['initOpenchannelQueues']())[_0x5e9c('0x6')](chatQueue[_0x5e9c('0xb')]())[_0x5e9c('0x6')](realtime[_0x5e9c('0xc')]())[_0x5e9c('0x6')](smsQueue[_0x5e9c('0xd')]())[_0x5e9c('0x6')](realtime[_0x5e9c('0xe')]())[_0x5e9c('0x6')](mailQueue[_0x5e9c('0xf')]())[_0x5e9c('0x6')](realtime['initMailQueues']())[_0x5e9c('0x6')](faxQueue['getFaxQueues']())[_0x5e9c('0x6')](realtime[_0x5e9c('0x10')]())[_0x5e9c('0x6')](whatsappQueue['getWhatsappQueues']())[_0x5e9c('0x6')](realtime['initWhatsappQueues']())[_0x5e9c('0x6')](function(){return realtime;});}function main(){return server[_0x5e9c('0x11')](realtime)[_0x5e9c('0x6')](function(_0x4bbb5b){return initRealtime();})[_0x5e9c('0x6')](function(_0x5add0a){return setInterval(initRealtime,0x1388);})[_0x5e9c('0x12')](function(_0x470c79){console['log'](_0x470c79);});}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 41a14f4..1d416f1 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x404a11,_0x268dc0){var _0x435823=function(_0x8bf3a){while(--_0x8bf3a){_0x404a11['push'](_0x404a11['shift']());}};_0x435823(++_0x268dc0);}(_0x326f,0xd1));var _0xf326=function(_0x516070,_0x40a332){_0x516070=_0x516070-0x0;var _0x46eaf5=_0x326f[_0x516070];return _0x46eaf5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x3378a6,_0x2eedcc){var _0x1674d9=function(_0x275430){while(--_0x275430){_0x3378a6['push'](_0x3378a6['shift']());}};_0x1674d9(++_0x2eedcc);}(_0x2ef3,0xba));var _0x32ef=function(_0xa20e68,_0x4c0160){_0xa20e68=_0xa20e68-0x0;var _0x5b425d=_0x2ef3[_0xa20e68];return _0x5b425d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 336b503..3531b89 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 _0x4320=['sendMailMessage','SendMail','jayson/promise','client','http','then','error','message','result'];(function(_0x1b1a55,_0x258f35){var _0x259c77=function(_0x469a9e){while(--_0x469a9e){_0x1b1a55['push'](_0x1b1a55['shift']());}};_0x259c77(++_0x258f35);}(_0x4320,0x80));var _0x0432=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x4320[_0x409353];return _0x4f4b59;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0432('0x0'));var client=jayson[_0x0432('0x1')][_0x0432('0x2')]({'port':0x232b});function request(_0x4b1c31,_0x2971f1){return new BPromise(function(_0x54117d,_0x84387){return client['request'](_0x4b1c31,_0x2971f1)[_0x0432('0x3')](function(_0x30a618){if(_0x30a618[_0x0432('0x4')]){return _0x84387(_0x30a618[_0x0432('0x4')][_0x0432('0x5')]);}else{return _0x54117d(_0x30a618[_0x0432('0x6')]);}})['catch'](function(_0x911a95){return _0x84387(_0x911a95);});});}exports[_0x0432('0x7')]=function(_0x7638df,_0x2f119c){return request(_0x0432('0x8'),{'account':_0x7638df,'message':_0x2f119c});}; \ No newline at end of file +var _0x28b0=['then','error','result','catch','SendMail','bluebird','jayson/promise','client'];(function(_0xc7bea9,_0xe5f6b8){var _0xf25d6c=function(_0x4e00a2){while(--_0x4e00a2){_0xc7bea9['push'](_0xc7bea9['shift']());}};_0xf25d6c(++_0xe5f6b8);}(_0x28b0,0x11d));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x028b('0x0'));var jayson=require(_0x028b('0x1'));var client=jayson[_0x028b('0x2')]['http']({'port':0x232b});function request(_0x53b88c,_0xdf02da){return new BPromise(function(_0x48011f,_0x2c1e70){return client['request'](_0x53b88c,_0xdf02da)[_0x028b('0x3')](function(_0x3ddb0b){if(_0x3ddb0b[_0x028b('0x4')]){return _0x2c1e70(_0x3ddb0b[_0x028b('0x4')]['message']);}else{return _0x48011f(_0x3ddb0b[_0x028b('0x5')]);}})[_0x028b('0x6')](function(_0x255264){return _0x2c1e70(_0x255264);});});}exports['sendMailMessage']=function(_0x136835,_0x37497b){return request(_0x028b('0x7'),{'account':_0x136835,'message':_0x37497b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index f5320f4..144ad67 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 _0xdb28=['user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','idle','mail','chat','fax','sms','whatsapp','Status','StatusTime','toNumber','format','mailStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','stringify'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xdb28,0x106));var _0x8db2=function(_0x106cf1,_0x12dc65){_0x106cf1=_0x106cf1-0x0;var _0x10bb37=_0xdb28[_0x106cf1];return _0x10bb37;};'use strict';var _=require(_0x8db2('0x0'));var md5=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var Redis=require(_0x8db2('0x3'));var config=require('../../../config/environment');config[_0x8db2('0x4')]=_[_0x8db2('0x5')](config[_0x8db2('0x4')],{'host':_0x8db2('0x6'),'port':0x18eb});var io=require(_0x8db2('0x7'))(new Redis(config['redis']));function Agent(_0x21a03e){this['id']=_0x21a03e['id']||0x0;this[_0x8db2('0x8')]=_0x21a03e['name']||'';this['online']=_0x21a03e[_0x8db2('0x9')]||!![];this[_0x8db2('0xa')]=_0x21a03e[_0x8db2('0xa')]||![];this[_0x8db2('0xb')]=_0x21a03e[_0x8db2('0xb')]||![];this[_0x8db2('0xc')]=_0x21a03e[_0x8db2('0xc')]||![];this['faxPause']=_0x21a03e[_0x8db2('0xd')]||![];this[_0x8db2('0xe')]=_0x21a03e[_0x8db2('0xe')]||![];this['openchannelPause']=_0x21a03e[_0x8db2('0xf')]||![];this[_0x8db2('0x10')]='unknown';this[_0x8db2('0x11')]=0x0;this[_0x8db2('0x12')]=_0x21a03e[_0x8db2('0x12')]||0x0;this[_0x8db2('0x13')]=0x0;this[_0x8db2('0x14')]='unknown';this['mailStatusTime']=0x0;this[_0x8db2('0x15')]=_0x21a03e[_0x8db2('0x15')]||0x0;this[_0x8db2('0x16')]=0x0;this[_0x8db2('0x17')]=_0x8db2('0x18');this[_0x8db2('0x19')]=0x0;this[_0x8db2('0x1a')]=_0x21a03e[_0x8db2('0x1a')]||0x0;this[_0x8db2('0x1b')]=0x0;this[_0x8db2('0x1c')]='unknown';this[_0x8db2('0x1d')]=0x0;this[_0x8db2('0x1e')]=_0x21a03e['smsCapacity']||0x0;this[_0x8db2('0x1f')]=0x0;this[_0x8db2('0x20')]=_0x8db2('0x18');this[_0x8db2('0x21')]=0x0;this[_0x8db2('0x22')]=_0x21a03e[_0x8db2('0x22')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x8db2('0x18');this[_0x8db2('0x23')]=0x0;this[_0x8db2('0x24')]=_0x21a03e[_0x8db2('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8db2('0x25')]=![];this[_0x8db2('0x26')]=undefined;this[_0x8db2('0x1')]='';this[_0x8db2('0x27')]={};this[_0x8db2('0x28')]={};this['mailWaitingInteractions']={};this[_0x8db2('0x29')]={};this[_0x8db2('0x2a')]={};this[_0x8db2('0x2b')]={};this[_0x8db2('0x2c')]();}Agent[_0x8db2('0x2d')][_0x8db2('0x2e')]=function(_0x796ec1){if(this[_0x796ec1+'CurrentCapacity']>0x0){if(this[_0x796ec1+_0x8db2('0x2f')]>0x0&&this[_0x796ec1+'CurrentCapacity']>=this[_0x796ec1+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x8db2('0x30');}};Agent[_0x8db2('0x2d')][_0x8db2('0x2c')]=function(){var _0x2baed0=[_0x8db2('0x31'),_0x8db2('0x32'),'openchannel',_0x8db2('0x33'),_0x8db2('0x34'),_0x8db2('0x35')];for(var _0x8b7cec=0x0;_0x8b7cec<_0x2baed0['length'];_0x8b7cec+=0x1){var _0x2e0691=this[_0x8db2('0x2e')](_0x2baed0[_0x8b7cec]);if(this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]!==_0x2e0691){this[_0x2baed0[_0x8b7cec]+_0x8db2('0x37')]=_[_0x8db2('0x38')](moment()[_0x8db2('0x39')]('x'));}this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]=_0x2e0691;}var _0x3124d5={'id':this['id'],'name':this[_0x8db2('0x8')],'online':this['online'],'voicePause':this[_0x8db2('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x8db2('0xe')],'faxPause':this[_0x8db2('0xd')],'openchannelPause':this[_0x8db2('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x8db2('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8db2('0x13')],'mailStatus':this[_0x8db2('0x14')],'mailStatusTime':this[_0x8db2('0x3a')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x8db2('0x17')],'faxStatusTime':this[_0x8db2('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x8db2('0x1c')],'smsStatusTime':this[_0x8db2('0x1d')],'smsCapacity':this[_0x8db2('0x1e')],'smsCurrentCapacity':this[_0x8db2('0x1f')],'whatsappStatus':this[_0x8db2('0x20')],'whatsappStatusTime':this[_0x8db2('0x21')],'whatsappCapacity':this[_0x8db2('0x22')],'whatsappCurrentCapacity':this[_0x8db2('0x3b')],'openchannelStatus':this[_0x8db2('0x3c')],'openchannelStatusTime':this[_0x8db2('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8db2('0x3d')],'busy':this[_0x8db2('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x8db2('0x27')],'faxWaitingInteractions':this[_0x8db2('0x28')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x8db2('0x2a')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3dfbaa=md5(JSON[_0x8db2('0x3e')](_0x3124d5));if(this[_0x8db2('0x1')]!==_0x3dfbaa){this[_0x8db2('0x1')]=_0x3dfbaa;io['emit'](_0x8db2('0x3f'),_['omit'](_0x3124d5,[_0x8db2('0x9')]));}};module[_0x8db2('0x40')]=Agent; \ No newline at end of file +var _0x430c=['smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','mailCurrentCapacity','smsStatus','smsStatusTime','whatsappStatusTime','chatWaitingInteractions','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','ioredis','../../../config/environment','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0x430c,0x1a1));var _0xc430=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x430c[_0x3c504b];return _0x2e5354;};'use strict';var _=require(_0xc430('0x0'));var md5=require('md5');var moment=require('moment');var Redis=require(_0xc430('0x1'));var config=require(_0xc430('0x2'));config[_0xc430('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc430('0x3')]));function Agent(_0x2408f5){this['id']=_0x2408f5['id']||0x0;this['name']=_0x2408f5[_0xc430('0x4')]||'';this['online']=_0x2408f5[_0xc430('0x5')]||!![];this[_0xc430('0x6')]=_0x2408f5[_0xc430('0x6')]||![];this[_0xc430('0x7')]=_0x2408f5[_0xc430('0x7')]||![];this[_0xc430('0x8')]=_0x2408f5[_0xc430('0x8')]||![];this[_0xc430('0x9')]=_0x2408f5[_0xc430('0x9')]||![];this['smsPause']=_0x2408f5[_0xc430('0xa')]||![];this[_0xc430('0xb')]=_0x2408f5['openchannelPause']||![];this[_0xc430('0xc')]='unknown';this[_0xc430('0xd')]=0x0;this['chatCapacity']=_0x2408f5[_0xc430('0xe')]||0x0;this[_0xc430('0xf')]=0x0;this[_0xc430('0x10')]=_0xc430('0x11');this[_0xc430('0x12')]=0x0;this[_0xc430('0x13')]=_0x2408f5[_0xc430('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xc430('0x11');this[_0xc430('0x14')]=0x0;this[_0xc430('0x15')]=_0x2408f5[_0xc430('0x15')]||0x0;this[_0xc430('0x16')]=0x0;this['smsStatus']=_0xc430('0x11');this['smsStatusTime']=0x0;this['smsCapacity']=_0x2408f5[_0xc430('0x17')]||0x0;this[_0xc430('0x18')]=0x0;this[_0xc430('0x19')]='unknown';this['whatsappStatusTime']=0x0;this[_0xc430('0x1a')]=_0x2408f5['whatsappCapacity']||0x0;this[_0xc430('0x1b')]=0x0;this['openchannelStatus']='unknown';this[_0xc430('0x1c')]=0x0;this['openchannelCapacity']=_0x2408f5[_0xc430('0x1d')]||0x0;this[_0xc430('0x1e')]=0x0;this[_0xc430('0x1f')]=![];this[_0xc430('0x20')]=undefined;this[_0xc430('0x21')]='';this['chatWaitingInteractions']={};this[_0xc430('0x22')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0xc430('0x23')]={};this[_0xc430('0x24')]={};this[_0xc430('0x25')]();}Agent['prototype'][_0xc430('0x26')]=function(_0x57d26e){if(this[_0x57d26e+_0xc430('0x27')]>0x0){if(this[_0x57d26e+_0xc430('0x28')]>0x0&&this[_0x57d26e+'CurrentCapacity']>=this[_0x57d26e+_0xc430('0x28')]){return _0xc430('0x29');}else{return'working';}}else{return _0xc430('0x2a');}};Agent['prototype'][_0xc430('0x25')]=function(){var _0x4b5280=[_0xc430('0x2b'),_0xc430('0x2c'),'openchannel',_0xc430('0x2d'),_0xc430('0x2e'),_0xc430('0x2f')];for(var _0x44833e=0x0;_0x44833e<_0x4b5280[_0xc430('0x30')];_0x44833e+=0x1){var _0x57cd72=this[_0xc430('0x26')](_0x4b5280[_0x44833e]);if(this[_0x4b5280[_0x44833e]+_0xc430('0x31')]!==_0x57cd72){this[_0x4b5280[_0x44833e]+_0xc430('0x32')]=_[_0xc430('0x33')](moment()['format']('x'));}this[_0x4b5280[_0x44833e]+_0xc430('0x31')]=_0x57cd72;}var _0x4cf56c={'id':this['id'],'name':this[_0xc430('0x4')],'online':this['online'],'voicePause':this[_0xc430('0x6')],'chatPause':this[_0xc430('0x7')],'mailPause':this[_0xc430('0x8')],'smsPause':this[_0xc430('0xa')],'faxPause':this['faxPause'],'openchannelPause':this[_0xc430('0xb')],'chatStatus':this[_0xc430('0xc')],'chatStatusTime':this[_0xc430('0xd')],'chatCapacity':this[_0xc430('0xe')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc430('0x10')],'mailStatusTime':this[_0xc430('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xc430('0x34')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xc430('0x15')],'faxCurrentCapacity':this[_0xc430('0x16')],'smsStatus':this[_0xc430('0x35')],'smsStatusTime':this[_0xc430('0x36')],'smsCapacity':this[_0xc430('0x17')],'smsCurrentCapacity':this[_0xc430('0x18')],'whatsappStatus':this[_0xc430('0x19')],'whatsappStatusTime':this[_0xc430('0x37')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xc430('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc430('0x1c')],'openchannelCapacity':this[_0xc430('0x1d')],'openchannelCurrentCapacity':this[_0xc430('0x1e')],'busy':this[_0xc430('0x1f')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xc430('0x38')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xc430('0x39')],'smsWaitingInteractions':this[_0xc430('0x23')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x5ff73c=md5(JSON[_0xc430('0x3a')](_0x4cf56c));if(this[_0xc430('0x21')]!==_0x5ff73c){this[_0xc430('0x21')]=_0x5ff73c;io[_0xc430('0x3b')](_0xc430('0x3c'),_[_0xc430('0x3d')](_0x4cf56c,[_0xc430('0x5')]));}};module[_0xc430('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1a25021..a709eb9 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 _0x50cc=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost','name','timeout'];(function(_0x5bfd3b,_0x4f9a9f){var _0x1f37f5=function(_0x147fac){while(--_0x147fac){_0x5bfd3b['push'](_0x5bfd3b['shift']());}};_0x1f37f5(++_0x4f9a9f);}(_0x50cc,0x142));var _0xc50c=function(_0x2d9653,_0xa29f22){_0x2d9653=_0x2d9653-0x0;var _0x59ac24=_0x50cc[_0x2d9653];return _0x59ac24;};'use strict';var _=require(_0xc50c('0x0'));var md5=require(_0xc50c('0x1'));var util=require(_0xc50c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xc50c('0x3')]=_[_0xc50c('0x4')](config['redis'],{'host':_0xc50c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x20fd75){this['id']=_0x20fd75['id']||0x0;this[_0xc50c('0x6')]=_0x20fd75['name']||'';this[_0xc50c('0x7')]=_0x20fd75['timeout']||0xa;this[_0xc50c('0x8')]=_0x20fd75[_0xc50c('0x8')]||_0xc50c('0x9');this[_0xc50c('0xa')]=_0x20fd75[_0xc50c('0xa')];this[_0xc50c('0xb')]={};this[_0xc50c('0xc')]=0x0;this[_0xc50c('0x1')]='';this[_0xc50c('0xd')]();this[_0xc50c('0xe')]();}ChatQueue['prototype'][_0xc50c('0xd')]=function(){var _0x41863=this['mapAgentsId'][_0xc50c('0xf')];this[_0xc50c('0xb')]=_[_0xc50c('0x10')](this[_0xc50c('0xa')],'id');this[_0xc50c('0xb')]['_rr']=_0x41863;};ChatQueue[_0xc50c('0x11')][_0xc50c('0xe')]=function(){this[_0xc50c('0x12')]=0x0;this['paused']=0x0;for(var _0x2c507a=0x0;_0x2c507a=0x0?this[_0xc50c('0x17')]:0x0;var _0x273648={'id':this['id'],'available':this[_0xc50c('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xc50c('0x6')],'paused':this['paused'],'waiting':this[_0xc50c('0xc')]};var _0x58541a=md5(JSON[_0xc50c('0x18')](_0x273648));if(this['md5']!==_0x58541a){this[_0xc50c('0x1')]=_0x58541a;io['to'](util[_0xc50c('0x19')](_0xc50c('0x1a'),_0x273648[_0xc50c('0x6')]))[_0xc50c('0x1b')](_0xc50c('0x1c'),_0x273648);}};module[_0xc50c('0x1d')]=ChatQueue; \ No newline at end of file +var _0xa7ee=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','waiting','md5','format','chat:queue:%s','emit','chat_queue:save','exports','util','ioredis','../../../config/environment','redis'];(function(_0x49fa12,_0x8e837e){var _0x19c441=function(_0x477c65){while(--_0x477c65){_0x49fa12['push'](_0x49fa12['shift']());}};_0x19c441(++_0x8e837e);}(_0xa7ee,0x1be));var _0xea7e=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xa7ee[_0x2a453b];return _0x132f79;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xea7e('0x0'));var Redis=require(_0xea7e('0x1'));var config=require(_0xea7e('0x2'));config['redis']=_['defaults'](config[_0xea7e('0x3')],{'host':_0xea7e('0x4'),'port':0x18eb});var io=require(_0xea7e('0x5'))(new Redis(config[_0xea7e('0x3')]));function ChatQueue(_0x19b075){this['id']=_0x19b075['id']||0x0;this[_0xea7e('0x6')]=_0x19b075[_0xea7e('0x6')]||'';this[_0xea7e('0x7')]=_0x19b075['timeout']||0xa;this[_0xea7e('0x8')]=_0x19b075['strategy']||_0xea7e('0x9');this['Agents']=_0x19b075[_0xea7e('0xa')];this[_0xea7e('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0xea7e('0xc')]();this['updateRealtime']();}ChatQueue[_0xea7e('0xd')][_0xea7e('0xc')]=function(){var _0x22c2b7=this['mapAgentsId'][_0xea7e('0xe')];this[_0xea7e('0xb')]=_[_0xea7e('0xf')](this[_0xea7e('0xa')],'id');this[_0xea7e('0xb')][_0xea7e('0xe')]=_0x22c2b7;};ChatQueue[_0xea7e('0xd')][_0xea7e('0x10')]=function(){this[_0xea7e('0x11')]=0x0;this[_0xea7e('0x12')]=0x0;for(var _0x279a65=0x0;_0x279a65=0x0?this['available']:0x0;var _0x40cece={'id':this['id'],'available':this[_0xea7e('0x16')],'loggedIn':this[_0xea7e('0x11')],'name':this[_0xea7e('0x6')],'paused':this['paused'],'waiting':this[_0xea7e('0x17')]};var _0x25097c=md5(JSON['stringify'](_0x40cece));if(this[_0xea7e('0x18')]!==_0x25097c){this[_0xea7e('0x18')]=_0x25097c;io['to'](util[_0xea7e('0x19')](_0xea7e('0x1a'),_0x40cece[_0xea7e('0x6')]))[_0xea7e('0x1b')](_0xea7e('0x1c'),_0x40cece);}};module[_0xea7e('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b7bef63..fed77e2 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 _0x8949=['util','redis','defaults','name','timeout','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save','exports','lodash'];(function(_0x25ae55,_0x4a7244){var _0x55a9af=function(_0x50176e){while(--_0x50176e){_0x25ae55['push'](_0x25ae55['shift']());}};_0x55a9af(++_0x4a7244);}(_0x8949,0x15d));var _0x9894=function(_0x4e0090,_0x803be0){_0x4e0090=_0x4e0090-0x0;var _0x180148=_0x8949[_0x4e0090];return _0x180148;};'use strict';var _=require(_0x9894('0x0'));var md5=require('md5');var util=require(_0x9894('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9894('0x2')]=_[_0x9894('0x3')](config[_0x9894('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x30be5c){this['id']=_0x30be5c['id']||0x0;this[_0x9894('0x4')]=_0x30be5c['name']||'';this[_0x9894('0x5')]=_0x30be5c[_0x9894('0x5')]||0xa;this['strategy']=_0x30be5c['strategy']||'beepall';this[_0x9894('0x6')]=_0x30be5c[_0x9894('0x6')];this[_0x9894('0x7')]={};this[_0x9894('0x8')]=0x0;this[_0x9894('0x9')]='';this[_0x9894('0xa')]();this[_0x9894('0xb')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x16ca49=this[_0x9894('0x7')][_0x9894('0xc')];this['mapAgentsId']=_[_0x9894('0xd')](this[_0x9894('0x6')],'id');this[_0x9894('0x7')][_0x9894('0xc')]=_0x16ca49;};FaxQueue[_0x9894('0xe')][_0x9894('0xb')]=function(){this[_0x9894('0xf')]=0x0;this[_0x9894('0x10')]=0x0;for(var _0x96466c=0x0;_0x96466c=0x0?this['available']:0x0;var _0x31a22a={'id':this['id'],'available':this[_0x9894('0x14')],'loggedIn':this[_0x9894('0xf')],'name':this[_0x9894('0x4')],'paused':this[_0x9894('0x10')],'waiting':this['waiting']};var _0x2ac863=md5(JSON['stringify'](_0x31a22a));if(this[_0x9894('0x9')]!==_0x2ac863){this[_0x9894('0x9')]=_0x2ac863;io['to'](util[_0x9894('0x15')]('fax:queue:%s',_0x31a22a[_0x9894('0x4')]))[_0x9894('0x16')](_0x9894('0x17'),_0x31a22a);}};module[_0x9894('0x18')]=FaxQueue; \ No newline at end of file +var _0x55eb=['paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0xa1c46b,_0x2e035b){var _0x5114e7=function(_0x1757cd){while(--_0x1757cd){_0xa1c46b['push'](_0xa1c46b['shift']());}};_0x5114e7(++_0x2e035b);}(_0x55eb,0x122));var _0xb55e=function(_0x2c31d6,_0x3df631){_0x2c31d6=_0x2c31d6-0x0;var _0x1798ba=_0x55eb[_0x2c31d6];return _0x1798ba;};'use strict';var _=require(_0xb55e('0x0'));var md5=require(_0xb55e('0x1'));var util=require('util');var Redis=require(_0xb55e('0x2'));var config=require(_0xb55e('0x3'));config[_0xb55e('0x4')]=_[_0xb55e('0x5')](config['redis'],{'host':_0xb55e('0x6'),'port':0x18eb});var io=require(_0xb55e('0x7'))(new Redis(config[_0xb55e('0x4')]));function FaxQueue(_0x147d4c){this['id']=_0x147d4c['id']||0x0;this[_0xb55e('0x8')]=_0x147d4c[_0xb55e('0x8')]||'';this[_0xb55e('0x9')]=_0x147d4c[_0xb55e('0x9')]||0xa;this[_0xb55e('0xa')]=_0x147d4c['strategy']||'beepall';this[_0xb55e('0xb')]=_0x147d4c['Agents'];this['mapAgentsId']={};this[_0xb55e('0xc')]=0x0;this[_0xb55e('0x1')]='';this[_0xb55e('0xd')]();this[_0xb55e('0xe')]();}FaxQueue[_0xb55e('0xf')][_0xb55e('0xd')]=function(){var _0xc3859d=this[_0xb55e('0x10')][_0xb55e('0x11')];this[_0xb55e('0x10')]=_[_0xb55e('0x12')](this[_0xb55e('0xb')],'id');this[_0xb55e('0x10')][_0xb55e('0x11')]=_0xc3859d;};FaxQueue[_0xb55e('0xf')][_0xb55e('0xe')]=function(){this[_0xb55e('0x13')]=0x0;this[_0xb55e('0x14')]=0x0;for(var _0x18dd76=0x0;_0x18dd76=0x0?this['available']:0x0;var _0x23470c={'id':this['id'],'available':this[_0xb55e('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xb55e('0x8')],'paused':this[_0xb55e('0x14')],'waiting':this[_0xb55e('0xc')]};var _0x3ceebb=md5(JSON[_0xb55e('0x19')](_0x23470c));if(this['md5']!==_0x3ceebb){this['md5']=_0x3ceebb;io['to'](util[_0xb55e('0x1a')](_0xb55e('0x1b'),_0x23470c['name']))[_0xb55e('0x1c')](_0xb55e('0x1d'),_0x23470c);}};module[_0xb55e('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 21a94dd..c01adee 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 _0x4349=['name','Intervals'];(function(_0x251006,_0x206560){var _0x4d9ca3=function(_0x448bec){while(--_0x448bec){_0x251006['push'](_0x251006['shift']());}};_0x4d9ca3(++_0x206560);}(_0x4349,0x178));var _0x9434=function(_0x3953ed,_0x36a688){_0x3953ed=_0x3953ed-0x0;var _0x203c03=_0x4349[_0x3953ed];return _0x203c03;};'use strict';function Interval(_0x55ebff){this['id']=_0x55ebff['id']||0x0;this['name']=_0x55ebff[_0x9434('0x0')]||'';this[_0x9434('0x1')]=_0x55ebff[_0x9434('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xb324=['exports','name'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xb324,0x1bb));var _0x4b32=function(_0x2a6e6a,_0x26e879){_0x2a6e6a=_0x2a6e6a-0x0;var _0xd216a4=_0xb324[_0x2a6e6a];return _0xd216a4;};'use strict';function Interval(_0x51ebe6){this['id']=_0x51ebe6['id']||0x0;this[_0x4b32('0x0')]=_0x51ebe6['name']||'';this['Intervals']=_0x51ebe6['Intervals']||{};}module[_0x4b32('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1648ee3..f7effb6 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 _0x3c92=['map','updateRealtime','loggedIn','length','online','mailPause','paused','available','waiting','stringify','md5','format','mail:queue:%s','emit','exports','lodash','util','ioredis','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr'];(function(_0x2647da,_0x10c32b){var _0x342158=function(_0x310b87){while(--_0x310b87){_0x2647da['push'](_0x2647da['shift']());}};_0x342158(++_0x10c32b);}(_0x3c92,0x1b3));var _0x23c9=function(_0x1cd7cf,_0x49e869){_0x1cd7cf=_0x1cd7cf-0x0;var _0x3d6282=_0x3c92[_0x1cd7cf];return _0x3d6282;};'use strict';var _=require(_0x23c9('0x0'));var md5=require('md5');var util=require(_0x23c9('0x1'));var Redis=require(_0x23c9('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x23c9('0x3')](config['redis'],{'host':_0x23c9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x23c9('0x5')]));function MailQueue(_0x51ece7){this['id']=_0x51ece7['id']||0x0;this['name']=_0x51ece7[_0x23c9('0x6')]||'';this[_0x23c9('0x7')]=_0x51ece7['timeout']||0xa;this[_0x23c9('0x8')]=_0x51ece7[_0x23c9('0x8')]||_0x23c9('0x9');this[_0x23c9('0xa')]=_0x51ece7[_0x23c9('0xa')];this[_0x23c9('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x23c9('0xc')][_0x23c9('0xd')]=function(){var _0x5eb91b=this[_0x23c9('0xb')][_0x23c9('0xe')];this[_0x23c9('0xb')]=_[_0x23c9('0xf')](this['Agents'],'id');this[_0x23c9('0xb')]['_rr']=_0x5eb91b;};MailQueue[_0x23c9('0xc')][_0x23c9('0x10')]=function(){this[_0x23c9('0x11')]=0x0;this['paused']=0x0;for(var _0x3f13c3=0x0;_0x3f13c3=0x0?this[_0x23c9('0x16')]:0x0;var _0x1a41d6={'id':this['id'],'available':this[_0x23c9('0x16')],'loggedIn':this[_0x23c9('0x11')],'name':this[_0x23c9('0x6')],'paused':this[_0x23c9('0x15')],'waiting':this[_0x23c9('0x17')]};var _0x143b78=md5(JSON[_0x23c9('0x18')](_0x1a41d6));if(this[_0x23c9('0x19')]!==_0x143b78){this[_0x23c9('0x19')]=_0x143b78;io['to'](util[_0x23c9('0x1a')](_0x23c9('0x1b'),_0x1a41d6['name']))[_0x23c9('0x1c')]('mail_queue:save',_0x1a41d6);}};module[_0x23c9('0x1d')]=MailQueue; \ No newline at end of file +var _0x5599=['name','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','Agents','mapAgentsId','prototype','_rr','updateRealtime','loggedIn','paused','length','online','available','waiting','stringify','mail:queue:%s'];(function(_0x376805,_0x322613){var _0x4af5e4=function(_0x14bbda){while(--_0x14bbda){_0x376805['push'](_0x376805['shift']());}};_0x4af5e4(++_0x322613);}(_0x5599,0x148));var _0x9559=function(_0x5a9baa,_0x387d86){_0x5a9baa=_0x5a9baa-0x0;var _0x411439=_0x5599[_0x5a9baa];return _0x411439;};'use strict';var _=require('lodash');var md5=require(_0x9559('0x0'));var util=require(_0x9559('0x1'));var Redis=require(_0x9559('0x2'));var config=require(_0x9559('0x3'));config['redis']=_[_0x9559('0x4')](config[_0x9559('0x5')],{'host':_0x9559('0x6'),'port':0x18eb});var io=require(_0x9559('0x7'))(new Redis(config[_0x9559('0x5')]));function MailQueue(_0x3edf89){this['id']=_0x3edf89['id']||0x0;this['name']=_0x3edf89['name']||'';this[_0x9559('0x8')]=_0x3edf89[_0x9559('0x8')]||0xa;this[_0x9559('0x9')]=_0x3edf89['strategy']||'beepall';this[_0x9559('0xa')]=_0x3edf89[_0x9559('0xa')];this[_0x9559('0xb')]={};this['waiting']=0x0;this[_0x9559('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x9559('0xc')]['updateRouting']=function(){var _0x532481=this['mapAgentsId'][_0x9559('0xd')];this[_0x9559('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x9559('0xd')]=_0x532481;};MailQueue[_0x9559('0xc')][_0x9559('0xe')]=function(){this[_0x9559('0xf')]=0x0;this[_0x9559('0x10')]=0x0;for(var _0x2e6dc7=0x0;_0x2e6dc7=0x0?this['available']:0x0;var _0x12bed5={'id':this['id'],'available':this[_0x9559('0x13')],'loggedIn':this[_0x9559('0xf')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9559('0x14')]};var _0x397107=md5(JSON[_0x9559('0x15')](_0x12bed5));if(this[_0x9559('0x0')]!==_0x397107){this[_0x9559('0x0')]=_0x397107;io['to'](util['format'](_0x9559('0x16'),_0x12bed5[_0x9559('0x17')]))[_0x9559('0x18')](_0x9559('0x19'),_0x12bed5);}};module[_0x9559('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index dfc96d4..bfa109d 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4906e3,_0x9af591){_0x4906e3=_0x4906e3-0x0;var _0x38553e=_0x2ef3[_0x4906e3];return _0x38553e;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3e7b8e2..f45d4c1 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 _0xfa2b=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x181197,_0x89a352){var _0x16d938=function(_0x4dd92f){while(--_0x4dd92f){_0x181197['push'](_0x181197['shift']());}};_0x16d938(++_0x89a352);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x57a8df,_0x49afe4){_0x57a8df=_0x57a8df-0x0;var _0x147ba3=_0xfa2b[_0x57a8df];return _0x147ba3;};'use strict';var _=require(_0xbfa2('0x0'));var md5=require(_0xbfa2('0x1'));var util=require(_0xbfa2('0x2'));var Redis=require(_0xbfa2('0x3'));var config=require(_0xbfa2('0x4'));config[_0xbfa2('0x5')]=_[_0xbfa2('0x6')](config[_0xbfa2('0x5')],{'host':_0xbfa2('0x7'),'port':0x18eb});var io=require(_0xbfa2('0x8'))(new Redis(config[_0xbfa2('0x5')]));function SmsQueue(_0x2e8f3b){this['id']=_0x2e8f3b['id']||0x0;this[_0xbfa2('0x9')]=_0x2e8f3b[_0xbfa2('0x9')]||'';this[_0xbfa2('0xa')]=_0x2e8f3b[_0xbfa2('0xa')]||0xa;this['strategy']=_0x2e8f3b[_0xbfa2('0xb')]||'beepall';this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]={};this[_0xbfa2('0xe')]=0x0;this[_0xbfa2('0x1')]='';this[_0xbfa2('0xf')]();this[_0xbfa2('0x10')]();}SmsQueue[_0xbfa2('0x11')][_0xbfa2('0xf')]=function(){var _0x4e0f1e=this['mapAgentsId']['_rr'];this[_0xbfa2('0xd')]=_[_0xbfa2('0x12')](this[_0xbfa2('0xc')],'id');this[_0xbfa2('0xd')][_0xbfa2('0x13')]=_0x4e0f1e;};SmsQueue[_0xbfa2('0x11')]['updateRealtime']=function(){this[_0xbfa2('0x14')]=0x0;this[_0xbfa2('0x15')]=0x0;for(var _0x458653=0x0;_0x458653=0x0?this[_0xbfa2('0x19')]:0x0;var _0x28fe6f={'id':this['id'],'available':this[_0xbfa2('0x19')],'loggedIn':this[_0xbfa2('0x14')],'name':this[_0xbfa2('0x9')],'paused':this[_0xbfa2('0x15')],'waiting':this['waiting']};var _0xb805f7=md5(JSON[_0xbfa2('0x1a')](_0x28fe6f));if(this[_0xbfa2('0x1')]!==_0xb805f7){this['md5']=_0xb805f7;io['to'](util[_0xbfa2('0x1b')](_0xbfa2('0x1c'),_0x28fe6f['name']))[_0xbfa2('0x1d')]('sms_queue:save',_0x28fe6f);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb38e=['smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online'];(function(_0x336c75,_0x234d58){var _0x5e37fd=function(_0x26480e){while(--_0x26480e){_0x336c75['push'](_0x336c75['shift']());}};_0x5e37fd(++_0x234d58);}(_0xb38e,0xa7));var _0xeb38=function(_0x51f3ff,_0x134155){_0x51f3ff=_0x51f3ff-0x0;var _0x4db8e3=_0xb38e[_0x51f3ff];return _0x4db8e3;};'use strict';var _=require(_0xeb38('0x0'));var md5=require(_0xeb38('0x1'));var util=require(_0xeb38('0x2'));var Redis=require(_0xeb38('0x3'));var config=require(_0xeb38('0x4'));config[_0xeb38('0x5')]=_[_0xeb38('0x6')](config['redis'],{'host':_0xeb38('0x7'),'port':0x18eb});var io=require(_0xeb38('0x8'))(new Redis(config['redis']));function SmsQueue(_0x113205){this['id']=_0x113205['id']||0x0;this[_0xeb38('0x9')]=_0x113205[_0xeb38('0x9')]||'';this[_0xeb38('0xa')]=_0x113205['timeout']||0xa;this[_0xeb38('0xb')]=_0x113205[_0xeb38('0xb')]||_0xeb38('0xc');this[_0xeb38('0xd')]=_0x113205['Agents'];this[_0xeb38('0xe')]={};this[_0xeb38('0xf')]=0x0;this[_0xeb38('0x1')]='';this[_0xeb38('0x10')]();this[_0xeb38('0x11')]();}SmsQueue[_0xeb38('0x12')][_0xeb38('0x10')]=function(){var _0x5838cd=this[_0xeb38('0xe')]['_rr'];this[_0xeb38('0xe')]=_[_0xeb38('0x13')](this['Agents'],'id');this[_0xeb38('0xe')][_0xeb38('0x14')]=_0x5838cd;};SmsQueue[_0xeb38('0x12')][_0xeb38('0x11')]=function(){this[_0xeb38('0x15')]=0x0;this[_0xeb38('0x16')]=0x0;for(var _0x4d765f=0x0;_0x4d765f=0x0?this['available']:0x0;var _0x521ef1={'id':this['id'],'available':this[_0xeb38('0x1a')],'loggedIn':this[_0xeb38('0x15')],'name':this[_0xeb38('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x3f8ed1=md5(JSON[_0xeb38('0x1b')](_0x521ef1));if(this[_0xeb38('0x1')]!==_0x3f8ed1){this[_0xeb38('0x1')]=_0x3f8ed1;io['to'](util[_0xeb38('0x1c')](_0xeb38('0x1d'),_0x521ef1['name']))['emit'](_0xeb38('0x1e'),_0x521ef1);}};module[_0xeb38('0x1f')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index aa83579..079e4be 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 _0x0cae=['map','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x15bf2c,_0x4457f8){var _0x163525=function(_0x5d148b){while(--_0x5d148b){_0x15bf2c['push'](_0x15bf2c['shift']());}};_0x163525(++_0x4457f8);}(_0x0cae,0x66));var _0xe0ca=function(_0x2c70b1,_0x5c28f7){_0x2c70b1=_0x2c70b1-0x0;var _0x561893=_0x0cae[_0x2c70b1];return _0x561893;};'use strict';var _=require('lodash');var md5=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var Redis=require(_0xe0ca('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe0ca('0x3')](config[_0xe0ca('0x4')],{'host':_0xe0ca('0x5'),'port':0x18eb});var io=require(_0xe0ca('0x6'))(new Redis(config[_0xe0ca('0x4')]));function WhatsappQueue(_0x3b78e3){this['id']=_0x3b78e3['id']||0x0;this[_0xe0ca('0x7')]=_0x3b78e3[_0xe0ca('0x7')]||'';this[_0xe0ca('0x8')]=_0x3b78e3['timeout']||0xa;this[_0xe0ca('0x9')]=_0x3b78e3['strategy']||_0xe0ca('0xa');this[_0xe0ca('0xb')]=_0x3b78e3[_0xe0ca('0xb')];this[_0xe0ca('0xc')]={};this[_0xe0ca('0xd')]=0x0;this['md5']='';this[_0xe0ca('0xe')]();this[_0xe0ca('0xf')]();}WhatsappQueue[_0xe0ca('0x10')][_0xe0ca('0xe')]=function(){var _0x504aeb=this[_0xe0ca('0xc')][_0xe0ca('0x11')];this[_0xe0ca('0xc')]=_[_0xe0ca('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x504aeb;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe0ca('0x13')]=0x0;for(var _0x3c95c7=0x0;_0x3c95c7=0x0?this['available']:0x0;var _0x19b47c={'id':this['id'],'available':this[_0xe0ca('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe0ca('0x13')],'waiting':this[_0xe0ca('0xd')]};var _0x41ff97=md5(JSON[_0xe0ca('0x19')](_0x19b47c));if(this[_0xe0ca('0x0')]!==_0x41ff97){this[_0xe0ca('0x0')]=_0x41ff97;io['to'](util['format'](_0xe0ca('0x1a'),_0x19b47c[_0xe0ca('0x7')]))[_0xe0ca('0x1b')](_0xe0ca('0x1c'),_0x19b47c);}};module[_0xe0ca('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x68d6=['redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','paused','length','online','loggedIn','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x555512,_0x243de7){var _0x268e3b=function(_0x535abf){while(--_0x535abf){_0x555512['push'](_0x555512['shift']());}};_0x268e3b(++_0x243de7);}(_0x68d6,0x1ae));var _0x668d=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x68d6[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x668d('0x0'));var md5=require(_0x668d('0x1'));var util=require(_0x668d('0x2'));var Redis=require(_0x668d('0x3'));var config=require(_0x668d('0x4'));config[_0x668d('0x5')]=_[_0x668d('0x6')](config[_0x668d('0x5')],{'host':_0x668d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x668d('0x5')]));function WhatsappQueue(_0x1b7f96){this['id']=_0x1b7f96['id']||0x0;this[_0x668d('0x8')]=_0x1b7f96[_0x668d('0x8')]||'';this[_0x668d('0x9')]=_0x1b7f96[_0x668d('0x9')]||0xa;this[_0x668d('0xa')]=_0x1b7f96['strategy']||_0x668d('0xb');this[_0x668d('0xc')]=_0x1b7f96[_0x668d('0xc')];this[_0x668d('0xd')]={};this[_0x668d('0xe')]=0x0;this[_0x668d('0x1')]='';this['updateRouting']();this[_0x668d('0xf')]();}WhatsappQueue[_0x668d('0x10')][_0x668d('0x11')]=function(){var _0x6fbe01=this[_0x668d('0xd')]['_rr'];this[_0x668d('0xd')]=_['map'](this[_0x668d('0xc')],'id');this[_0x668d('0xd')][_0x668d('0x12')]=_0x6fbe01;};WhatsappQueue[_0x668d('0x10')][_0x668d('0xf')]=function(){this['loggedIn']=0x0;this[_0x668d('0x13')]=0x0;for(var _0x22ed9b=0x0;_0x22ed9b=0x0?this[_0x668d('0x18')]:0x0;var _0x1c53a1={'id':this['id'],'available':this[_0x668d('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x668d('0x13')],'waiting':this['waiting']};var _0x3458d5=md5(JSON['stringify'](_0x1c53a1));if(this[_0x668d('0x1')]!==_0x3458d5){this[_0x668d('0x1')]=_0x3458d5;io['to'](util[_0x668d('0x19')](_0x668d('0x1a'),_0x1c53a1[_0x668d('0x8')]))[_0x668d('0x1b')]('whatsapp_queue:save',_0x1c53a1);}};module[_0x668d('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8f9d975..03c5c5d 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(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x843849,_0x22fbec){var _0xf6f4d3=function(_0x37596b){while(--_0x37596b){_0x843849['push'](_0x843849['shift']());}};_0xf6f4d3(++_0x22fbec);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ccbc7,_0x3093c8){_0x3ccbc7=_0x3ccbc7-0x0;var _0x50c97a=_0xb10b[_0x3ccbc7];return _0x50c97a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 05f1092..0225652 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 _0x7803=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7803,0xad));var _0x3780=function(_0x488b3a,_0xfee276){_0x488b3a=_0x488b3a-0x0;var _0x4f24c1=_0x7803[_0x488b3a];return _0x4f24c1;};'use strict';var client=require(_0x3780('0x0'));exports[_0x3780('0x1')]=function(_0x526236,_0x5dc2ad){return client[_0x3780('0x2')](_0x3780('0x3'),{'body':_0x5dc2ad,'options':{'where':{'id':_0x526236}},'log':_0x3780('0x4')});};exports['addTags']=function(_0x1efae1,_0x3ba6bd){return client[_0x3780('0x2')](_0x3780('0x5'),{'body':_0x3ba6bd,'options':{'where':{'id':_0x1efae1}},'log':_0x3780('0x6')});}; \ No newline at end of file +var _0x19f4=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x52e333,_0x4fc3a5){var _0x5e6562=function(_0x3cdfd8){while(--_0x3cdfd8){_0x52e333['push'](_0x52e333['shift']());}};_0x5e6562(++_0x4fc3a5);}(_0x19f4,0x6f));var _0x419f=function(_0x2dfd4b,_0x4e2999){_0x2dfd4b=_0x2dfd4b-0x0;var _0x1a6200=_0x19f4[_0x2dfd4b];return _0x1a6200;};'use strict';var client=require(_0x419f('0x0'));exports[_0x419f('0x1')]=function(_0xfcf6de,_0x4e4f9a){return client[_0x419f('0x2')](_0x419f('0x3'),{'body':_0x4e4f9a,'options':{'where':{'id':_0xfcf6de}},'log':_0x419f('0x4')});};exports[_0x419f('0x5')]=function(_0x1d10a4,_0x1a742f){return client[_0x419f('0x2')](_0x419f('0x6'),{'body':_0x1a742f,'options':{'where':{'id':_0x1d10a4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index bfc36e2..cc6f194 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 _0x959e=['Request','CreateChatMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x959e,0x1b2));var _0xe959=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x959e[_0x51d129];return _0x44c377;};'use strict';var client=require(_0xe959('0x0'));exports[_0xe959('0x1')]=function(_0x2e8dc8){return client[_0xe959('0x2')](_0xe959('0x3'),{'body':_0x2e8dc8,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8c4f=['../client','createChatMessage'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0x8c4f,0x138));var _0xf8c4=function(_0x5668aa,_0x1cd4cd){_0x5668aa=_0x5668aa-0x0;var _0x455a3d=_0x8c4f[_0x5668aa];return _0x455a3d;};'use strict';var client=require(_0xf8c4('0x0'));exports['create']=function(_0x3df2cc){return client['Request']('CreateChatMessage',{'body':_0x3df2cc,'log':_0xf8c4('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5f31a13..3275d6f 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 _0xadf0=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0x30c97f,_0x1a74a5){var _0x3e8c33=function(_0x476ec4){while(--_0x476ec4){_0x30c97f['push'](_0x30c97f['shift']());}};_0x3e8c33(++_0x1a74a5);}(_0xadf0,0x12d));var _0x0adf=function(_0x5d0f73,_0x4c91a9){_0x5d0f73=_0x5d0f73-0x0;var _0xa769de=_0xadf0[_0x5d0f73];return _0xa769de;};'use strict';var client=require('../client');exports[_0x0adf('0x0')]=function(){return function(){return client[_0x0adf('0x1')](_0x0adf('0x2'),{'options':{'raw':![],'attributes':['id',_0x0adf('0x3'),_0x0adf('0x4'),_0x0adf('0x5')],'include':[{'model':_0x0adf('0x6'),'as':'Agents','attributes':['id',_0x0adf('0x3'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xf776=['getChatQueues','../client','Request','GetChatQueue','timeout','strategy','User','Agents','online'];(function(_0x32c20f,_0x814731){var _0x54cec0=function(_0x3b9cd7){while(--_0x3b9cd7){_0x32c20f['push'](_0x32c20f['shift']());}};_0x54cec0(++_0x814731);}(_0xf776,0x169));var _0x6f77=function(_0x3f91a7,_0x5b570d){_0x3f91a7=_0x3f91a7-0x0;var _0x53fa1c=_0xf776[_0x3f91a7];return _0x53fa1c;};'use strict';var client=require(_0x6f77('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x6f77('0x1')](_0x6f77('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6f77('0x3'),_0x6f77('0x4')],'include':[{'model':_0x6f77('0x5'),'as':_0x6f77('0x6'),'attributes':['id','name',_0x6f77('0x7'),'chatPause']}]},'log':_0x6f77('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 1178cb7..25cd029 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 _0x495e=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x45f71c,_0x428007){var _0x5e9249=function(_0x2c2722){while(--_0x2c2722){_0x45f71c['push'](_0x45f71c['shift']());}};_0x5e9249(++_0x428007);}(_0x495e,0xfb));var _0xe495=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x495e[_0xf64e5];return _0x5f312c;};'use strict';var client=require(_0xe495('0x0'));exports['create']=function(_0x47f8b7){return client[_0xe495('0x1')](_0xe495('0x2'),{'body':_0x47f8b7,'log':_0xe495('0x2')});};exports[_0xe495('0x3')]=function(_0x4e5ce9,_0x3f119c){return client[_0xe495('0x1')](_0xe495('0x4'),{'body':_0x3f119c,'options':{'where':{'uniqueid':_0x4e5ce9},'order':[['id',_0xe495('0x5')]],'limit':0x1},'log':_0xe495('0x4')});}; \ No newline at end of file +var _0xc1c4=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x5bddde,_0x384afd){var _0x4d19c6=function(_0x2323c9){while(--_0x2323c9){_0x5bddde['push'](_0x5bddde['shift']());}};_0x4d19c6(++_0x384afd);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x4f45ec,_0x270691){_0x4f45ec=_0x4f45ec-0x0;var _0x3640d8=_0xc1c4[_0x4f45ec];return _0x3640d8;};'use strict';var client=require(_0x4c1c('0x0'));exports[_0x4c1c('0x1')]=function(_0x2fb284){return client[_0x4c1c('0x2')](_0x4c1c('0x3'),{'body':_0x2fb284,'log':_0x4c1c('0x3')});};exports[_0x4c1c('0x4')]=function(_0x5b8a39,_0x5c1e2c){return client[_0x4c1c('0x2')](_0x4c1c('0x5'),{'body':_0x5c1e2c,'options':{'where':{'uniqueid':_0x5b8a39},'order':[['id',_0x4c1c('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8aeaa86..09f590d 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x7a54,0x106));var _0x47a5=function(_0x5958e5,_0x4f623a){_0x5958e5=_0x5958e5-0x0;var _0x528a2d=_0x7a54[_0x5958e5];return _0x528a2d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x7a54,0x106));var _0x47a5=function(_0x3ead0e,_0x35469f){_0x3ead0e=_0x3ead0e-0x0;var _0x531373=_0x7a54[_0x3ead0e];return _0x531373;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 47b7c15..4e1c3fd 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 _0x1cf7=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x1cf7,0xb3));var _0x71cf=function(_0x351357,_0x2461ff){_0x351357=_0x351357-0x0;var _0x78dbb=_0x1cf7[_0x351357];return _0x78dbb;};'use strict';var client=require(_0x71cf('0x0'));exports[_0x71cf('0x1')]=function(_0x2a51bf){return client[_0x71cf('0x2')](_0x71cf('0x3'),{'body':_0x2a51bf,'log':_0x71cf('0x4')});}; \ No newline at end of file +var _0xa5b9=['../client','CreateFaxMessage'];(function(_0x595dac,_0x4563cc){var _0x1c4062=function(_0x53a491){while(--_0x53a491){_0x595dac['push'](_0x595dac['shift']());}};_0x1c4062(++_0x4563cc);}(_0xa5b9,0xe6));var _0x9a5b=function(_0x5d85a9,_0x36d5e2){_0x5d85a9=_0x5d85a9-0x0;var _0x52ecd3=_0xa5b9[_0x5d85a9];return _0x52ecd3;};'use strict';var client=require(_0x9a5b('0x0'));exports['create']=function(_0x3f340b){return client['Request'](_0x9a5b('0x1'),{'body':_0x3f340b,'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 3502bfe..9a8d971 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 _0x3f61=['name','online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x42446c,_0x106c25){var _0x29059d=function(_0x217ff2){while(--_0x217ff2){_0x42446c['push'](_0x42446c['shift']());}};_0x29059d(++_0x106c25);}(_0x3f61,0x71));var _0x13f6=function(_0x3fef4b,_0x10e531){_0x3fef4b=_0x3fef4b-0x0;var _0x352c84=_0x3f61[_0x3fef4b];return _0x352c84;};'use strict';var client=require('../client');exports[_0x13f6('0x0')]=function(){return function(){return client[_0x13f6('0x1')](_0x13f6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x13f6('0x3'),_0x13f6('0x4')],'include':[{'model':_0x13f6('0x5'),'as':_0x13f6('0x6'),'attributes':['id',_0x13f6('0x7'),_0x13f6('0x8'),_0x13f6('0x9')]}]},'log':_0x13f6('0x0')});};}; \ No newline at end of file +var _0x7bef=['getFaxQueues','Request','name','strategy','Agents','faxPause','../client'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x7bef,0x102));var _0xf7be=function(_0x1b9a9f,_0x482c35){_0x1b9a9f=_0x1b9a9f-0x0;var _0x2552fd=_0x7bef[_0x1b9a9f];return _0x2552fd;};'use strict';var client=require(_0xf7be('0x0'));exports[_0xf7be('0x1')]=function(){return function(){return client[_0xf7be('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xf7be('0x3'),'timeout',_0xf7be('0x4')],'include':[{'model':'User','as':_0xf7be('0x5'),'attributes':['id',_0xf7be('0x3'),'online',_0xf7be('0x6')]}]},'log':_0xf7be('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index c599fa6..c6a5422 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 _0x1b89=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x4fd96d,_0x3a5551){var _0xf7e94b=function(_0x30eeb5){while(--_0x30eeb5){_0x4fd96d['push'](_0x4fd96d['shift']());}};_0xf7e94b(++_0x3a5551);}(_0x1b89,0x183));var _0x91b8=function(_0x272a46,_0x12b300){_0x272a46=_0x272a46-0x0;var _0x2bfd12=_0x1b89[_0x272a46];return _0x2bfd12;};'use strict';var client=require(_0x91b8('0x0'));exports[_0x91b8('0x1')]=function(_0x332f7f){return client[_0x91b8('0x2')](_0x91b8('0x3'),{'body':_0x332f7f,'log':_0x91b8('0x3')});};exports[_0x91b8('0x4')]=function(_0x4df532,_0x276ced){return client['Request'](_0x91b8('0x5'),{'body':_0x276ced,'options':{'where':{'uniqueid':_0x4df532},'order':[['id',_0x91b8('0x6')]],'limit':0x1},'log':_0x91b8('0x5')});}; \ No newline at end of file +var _0x9089=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x2886b5,_0x16820b){var _0x44ae6e=function(_0x38e044){while(--_0x38e044){_0x2886b5['push'](_0x2886b5['shift']());}};_0x44ae6e(++_0x16820b);}(_0x9089,0x136));var _0x9908=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x9089[_0x36d203];return _0x2f9e62;};'use strict';var client=require(_0x9908('0x0'));exports[_0x9908('0x1')]=function(_0x1b504a){return client['Request'](_0x9908('0x2'),{'body':_0x1b504a,'log':_0x9908('0x2')});};exports[_0x9908('0x3')]=function(_0xdcf13f,_0x5e71ee){return client[_0x9908('0x4')](_0x9908('0x5'),{'body':_0x5e71ee,'options':{'where':{'uniqueid':_0xdcf13f},'order':[['id',_0x9908('0x6')]],'limit':0x1},'log':_0x9908('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2054fe4..1fe3101 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 _0x885a=['name','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x885a,0x1bc));var _0xa885=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x885a[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xa885('0x0'));exports[_0xa885('0x1')]=function(){return function(){return client[_0xa885('0x2')](_0xa885('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa885('0x4')],'include':[{'model':'Interval','as':_0xa885('0x5'),'attributes':['id',_0xa885('0x4'),_0xa885('0x6')]}]},'log':_0xa885('0x1')});};}; \ No newline at end of file +var _0x51af=['Request','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0xf02eaf,_0x3b3e68){var _0xde78a5=function(_0x310dc0){while(--_0x310dc0){_0xf02eaf['push'](_0xf02eaf['shift']());}};_0xde78a5(++_0x3b3e68);}(_0x51af,0x7c));var _0xf51a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x51af[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0xf51a('0x0'));exports[_0xf51a('0x1')]=function(){return function(){return client[_0xf51a('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf51a('0x3')],'include':[{'model':_0xf51a('0x4'),'as':_0xf51a('0x5'),'attributes':['id',_0xf51a('0x3'),_0xf51a('0x6')]}]},'log':_0xf51a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b2c1717..ddd70ae 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 _0x8f4c=['update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x21aba4,_0x1e6758){var _0x4d52f9=function(_0x278cf2){while(--_0x278cf2){_0x21aba4['push'](_0x21aba4['shift']());}};_0x4d52f9(++_0x1e6758);}(_0x8f4c,0x113));var _0xc8f4=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x8f4c[_0x54b283];return _0x2462b3;};'use strict';var client=require(_0xc8f4('0x0'));exports[_0xc8f4('0x1')]=function(_0xce26f2,_0x43926b){return client[_0xc8f4('0x2')](_0xc8f4('0x3'),{'body':_0x43926b,'options':{'where':{'id':_0xce26f2}},'log':'updateMailInteraction'});};exports[_0xc8f4('0x4')]=function(_0x47350d,_0x133764){return client['Request'](_0xc8f4('0x5'),{'body':_0x133764,'options':{'where':{'id':_0x47350d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x2e5e73,_0x30d4d9){var _0x4cf641=function(_0x26b1b6){while(--_0x26b1b6){_0x2e5e73['push'](_0x2e5e73['shift']());}};_0x4cf641(++_0x30d4d9);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b7fad2c..2a092d6 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 _0xaeb2=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x4a285d,_0x3b801b){var _0x328ccc=function(_0xa7f476){while(--_0xa7f476){_0x4a285d['push'](_0x4a285d['shift']());}};_0x328ccc(++_0x3b801b);}(_0xaeb2,0xf1));var _0x2aeb=function(_0x51c89b,_0x24a1c6){_0x51c89b=_0x51c89b-0x0;var _0x5411f2=_0xaeb2[_0x51c89b];return _0x5411f2;};'use strict';var client=require(_0x2aeb('0x0'));exports[_0x2aeb('0x1')]=function(_0xce06c8){return client['Request'](_0x2aeb('0x2'),{'body':_0xce06c8,'log':_0x2aeb('0x3')});}; \ No newline at end of file +var _0x4670=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x4670,0xc3));var _0x0467=function(_0x4f082b,_0x39268d){_0x4f082b=_0x4f082b-0x0;var _0x18aa26=_0x4670[_0x4f082b];return _0x18aa26;};'use strict';var client=require(_0x0467('0x0'));exports[_0x0467('0x1')]=function(_0x5583f8){return client['Request'](_0x0467('0x2'),{'body':_0x5583f8,'log':_0x0467('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0894947..71f761c 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 _0x964c=['Agents','online','mailPause','getMailQueues','timeout','strategy','User'];(function(_0x194618,_0x2b8535){var _0x3a6638=function(_0x3853f6){while(--_0x3853f6){_0x194618['push'](_0x194618['shift']());}};_0x3a6638(++_0x2b8535);}(_0x964c,0x65));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xc964('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc964('0x1'),_0xc964('0x2')],'include':[{'model':_0xc964('0x3'),'as':_0xc964('0x4'),'attributes':['id','name',_0xc964('0x5'),_0xc964('0x6')]}]},'log':_0xc964('0x0')});};}; \ No newline at end of file +var _0x2fa9=['name','timeout','strategy','User','getMailQueues','Request','GetMailQueue'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x2fa9,0x1ee));var _0x92fa=function(_0x3201cd,_0x384776){_0x3201cd=_0x3201cd-0x0;var _0x317977=_0x2fa9[_0x3201cd];return _0x317977;};'use strict';var client=require('../client');exports[_0x92fa('0x0')]=function(){return function(){return client[_0x92fa('0x1')](_0x92fa('0x2'),{'options':{'raw':![],'attributes':['id',_0x92fa('0x3'),_0x92fa('0x4'),_0x92fa('0x5')],'include':[{'model':_0x92fa('0x6'),'as':'Agents','attributes':['id',_0x92fa('0x3'),'online','mailPause']}]},'log':_0x92fa('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9b56bb5..bd424be 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 _0x453a=['Request','CreateMailQueueReport','DESC','UpdateMailQueueReport','../client','create'];(function(_0x3dbd1f,_0x23520c){var _0x1749e5=function(_0xa90777){while(--_0xa90777){_0x3dbd1f['push'](_0x3dbd1f['shift']());}};_0x1749e5(++_0x23520c);}(_0x453a,0xb8));var _0xa453=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0x453a[_0x19c6a6];return _0x29014;};'use strict';var client=require(_0xa453('0x0'));exports[_0xa453('0x1')]=function(_0x16fba3){return client[_0xa453('0x2')]('CreateMailQueueReport',{'body':_0x16fba3,'log':_0xa453('0x3')});};exports['update']=function(_0x506a7c,_0x3e80a8){return client[_0xa453('0x2')]('UpdateMailQueueReport',{'body':_0x3e80a8,'options':{'where':{'uniqueid':_0x506a7c},'order':[['id',_0xa453('0x4')]],'limit':0x1},'log':_0xa453('0x5')});}; \ No newline at end of file +var _0xfef6=['create','Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client'];(function(_0x1062e1,_0x1be769){var _0x26c085=function(_0x5bcd11){while(--_0x5bcd11){_0x1062e1['push'](_0x1062e1['shift']());}};_0x26c085(++_0x1be769);}(_0xfef6,0x95));var _0x6fef=function(_0x203ef7,_0x22e5ca){_0x203ef7=_0x203ef7-0x0;var _0x2ae754=_0xfef6[_0x203ef7];return _0x2ae754;};'use strict';var client=require(_0x6fef('0x0'));exports[_0x6fef('0x1')]=function(_0x236457){return client[_0x6fef('0x2')]('CreateMailQueueReport',{'body':_0x236457,'log':_0x6fef('0x3')});};exports['update']=function(_0x2f8c51,_0x238c41){return client[_0x6fef('0x2')](_0x6fef('0x4'),{'body':_0x238c41,'options':{'where':{'uniqueid':_0x2f8c51},'order':[['id',_0x6fef('0x5')]],'limit':0x1},'log':_0x6fef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3b0775f..3f3f2f0 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 _0x498a=['addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x113350,_0x21bf5e){var _0x3b7aae=function(_0x280af8){while(--_0x280af8){_0x113350['push'](_0x113350['shift']());}};_0x3b7aae(++_0x21bf5e);}(_0x498a,0x112));var _0xa498=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x498a[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xa498('0x0'));exports[_0xa498('0x1')]=function(_0x4b9542,_0x1571d4){return client[_0xa498('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1571d4,'options':{'where':{'id':_0x4b9542}},'log':_0xa498('0x3')});};exports[_0xa498('0x4')]=function(_0x1ad9eb,_0x13a0db){return client[_0xa498('0x2')](_0xa498('0x5'),{'body':_0x13a0db,'options':{'where':{'id':_0x1ad9eb}},'log':_0xa498('0x6')});}; \ No newline at end of file +var _0x0eea=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x0eea,0x1ae));var _0xa0ee=function(_0x580103,_0x438384){_0x580103=_0x580103-0x0;var _0x5d1096=_0x0eea[_0x580103];return _0x5d1096;};'use strict';var client=require(_0xa0ee('0x0'));exports[_0xa0ee('0x1')]=function(_0x5c3ce1,_0x4fe1da){return client[_0xa0ee('0x2')](_0xa0ee('0x3'),{'body':_0x4fe1da,'options':{'where':{'id':_0x5c3ce1}},'log':_0xa0ee('0x4')});};exports[_0xa0ee('0x5')]=function(_0x240f2d,_0x1b63c3){return client[_0xa0ee('0x2')](_0xa0ee('0x6'),{'body':_0x1b63c3,'options':{'where':{'id':_0x240f2d}},'log':_0xa0ee('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index edf81bd..c383b47 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 _0x3c41=['Request','createOpenchannelMessage','../client','create'];(function(_0x49f0b8,_0x48f7aa){var _0x4180f3=function(_0x73e5ba){while(--_0x73e5ba){_0x49f0b8['push'](_0x49f0b8['shift']());}};_0x4180f3(++_0x48f7aa);}(_0x3c41,0x9a));var _0x13c4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3c41[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x13c4('0x0'));exports[_0x13c4('0x1')]=function(_0x5a08d6){return client[_0x13c4('0x2')]('CreateOpenchannelMessage',{'body':_0x5a08d6,'log':_0x13c4('0x3')});}; \ No newline at end of file +var _0x61fd=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x61fd,0x100));var _0xd61f=function(_0x26c0dc,_0x5c87e0){_0x26c0dc=_0x26c0dc-0x0;var _0x244d35=_0x61fd[_0x26c0dc];return _0x244d35;};'use strict';var client=require(_0xd61f('0x0'));exports[_0xd61f('0x1')]=function(_0x1b8165){return client[_0xd61f('0x2')](_0xd61f('0x3'),{'body':_0x1b8165,'log':_0xd61f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8ea8285..fdbb2ed 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 _0x39f8=['Agents','name','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x11d3f1,_0x58b502){var _0x2cec1c=function(_0x188f6d){while(--_0x188f6d){_0x11d3f1['push'](_0x11d3f1['shift']());}};_0x2cec1c(++_0x58b502);}(_0x39f8,0xa5));var _0x839f=function(_0x57f6aa,_0x7d09e5){_0x57f6aa=_0x57f6aa-0x0;var _0xc3fdd=_0x39f8[_0x57f6aa];return _0xc3fdd;};'use strict';var client=require('../client');exports[_0x839f('0x0')]=function(){return function(){return client[_0x839f('0x1')](_0x839f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x839f('0x3'),_0x839f('0x4')],'include':[{'model':_0x839f('0x5'),'as':_0x839f('0x6'),'attributes':['id',_0x839f('0x7'),'online',_0x839f('0x8')]}]},'log':_0x839f('0x0')});};}; \ No newline at end of file +var _0x4d88=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x463de0,_0x4a0c27){var _0x51314b=function(_0x5e79df){while(--_0x5e79df){_0x463de0['push'](_0x463de0['shift']());}};_0x51314b(++_0x4a0c27);}(_0x4d88,0x195));var _0x84d8=function(_0x2432da,_0x524e50){_0x2432da=_0x2432da-0x0;var _0x2318dc=_0x4d88[_0x2432da];return _0x2318dc;};'use strict';var client=require(_0x84d8('0x0'));exports[_0x84d8('0x1')]=function(){return function(){return client[_0x84d8('0x2')](_0x84d8('0x3'),{'options':{'raw':![],'attributes':['id',_0x84d8('0x4'),_0x84d8('0x5'),_0x84d8('0x6')],'include':[{'model':_0x84d8('0x7'),'as':_0x84d8('0x8'),'attributes':['id',_0x84d8('0x4'),_0x84d8('0x9'),_0x84d8('0xa')]}]},'log':_0x84d8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 34db4cc..cb73a66 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 _0x7ece=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x1c48c9,_0x4420aa){var _0x5eed2a=function(_0x2a585b){while(--_0x2a585b){_0x1c48c9['push'](_0x1c48c9['shift']());}};_0x5eed2a(++_0x4420aa);}(_0x7ece,0x1e3));var _0xe7ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7ece[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xe7ec('0x0'));exports[_0xe7ec('0x1')]=function(_0x16f149){return client[_0xe7ec('0x2')]('CreateOpenchannelQueueReport',{'body':_0x16f149,'log':_0xe7ec('0x3')});};exports['update']=function(_0x9194cc,_0x2180ba){return client[_0xe7ec('0x2')](_0xe7ec('0x4'),{'body':_0x2180ba,'options':{'where':{'uniqueid':_0x9194cc},'order':[['id',_0xe7ec('0x5')]],'limit':0x1},'log':_0xe7ec('0x4')});}; \ No newline at end of file +var _0x9a89=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x5e6b45,_0x4d1d98){var _0x34de84=function(_0x4b3da9){while(--_0x4b3da9){_0x5e6b45['push'](_0x5e6b45['shift']());}};_0x34de84(++_0x4d1d98);}(_0x9a89,0xce));var _0x99a8=function(_0x10f31b,_0x486fc9){_0x10f31b=_0x10f31b-0x0;var _0x33744c=_0x9a89[_0x10f31b];return _0x33744c;};'use strict';var client=require(_0x99a8('0x0'));exports[_0x99a8('0x1')]=function(_0x3816f3){return client[_0x99a8('0x2')](_0x99a8('0x3'),{'body':_0x3816f3,'log':'CreateOpenchannelQueueReport'});};exports[_0x99a8('0x4')]=function(_0x17d139,_0x5bb08c){return client[_0x99a8('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x5bb08c,'options':{'where':{'uniqueid':_0x17d139},'order':[['id',_0x99a8('0x5')]],'limit':0x1},'log':_0x99a8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 18ebbf0..50c495e 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 _0x9ffd=['updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction'];(function(_0x34b05c,_0x4105f2){var _0x2989ee=function(_0x298be6){while(--_0x298be6){_0x34b05c['push'](_0x34b05c['shift']());}};_0x2989ee(++_0x4105f2);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x21a6d8,_0x3061db){_0x21a6d8=_0x21a6d8-0x0;var _0x48a593=_0x9ffd[_0x21a6d8];return _0x48a593;};'use strict';var client=require(_0xd9ff('0x0'));exports[_0xd9ff('0x1')]=function(_0x13fd7e,_0x223887){return client['Request'](_0xd9ff('0x2'),{'body':_0x223887,'options':{'where':{'id':_0x13fd7e}},'log':_0xd9ff('0x3')});};exports[_0xd9ff('0x4')]=function(_0x96ee9a,_0x44c750){return client['Request']('AddTagsToSmsInteraction',{'body':_0x44c750,'options':{'where':{'id':_0x96ee9a}},'log':_0xd9ff('0x5')});}; \ No newline at end of file +var _0x3351=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x3351,0x1b4));var _0x1335=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x3351[_0x3899d1];return _0xeb4a7d;};'use strict';var client=require(_0x1335('0x0'));exports['update']=function(_0x5a075d,_0x2bf4df){return client[_0x1335('0x1')](_0x1335('0x2'),{'body':_0x2bf4df,'options':{'where':{'id':_0x5a075d}},'log':_0x1335('0x3')});};exports[_0x1335('0x4')]=function(_0x173f26,_0x1f635d){return client['Request'](_0x1335('0x5'),{'body':_0x1f635d,'options':{'where':{'id':_0x173f26}},'log':_0x1335('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4fb49f5..33d72ef 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 _0xb5ce=['createSmsMessage','CreateSmsMessage'];(function(_0x2a0210,_0x27ecdb){var _0x1bad7a=function(_0x342a43){while(--_0x342a43){_0x2a0210['push'](_0x2a0210['shift']());}};_0x1bad7a(++_0x27ecdb);}(_0xb5ce,0x12b));var _0xeb5c=function(_0x5370d9,_0x3e56f6){_0x5370d9=_0x5370d9-0x0;var _0x6347c6=_0xb5ce[_0x5370d9];return _0x6347c6;};'use strict';var client=require('../client');exports['create']=function(_0x1a7d5f){return client['Request'](_0xeb5c('0x0'),{'body':_0x1a7d5f,'log':_0xeb5c('0x1')});}; \ No newline at end of file +var _0x75ef=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x30e43d,_0x4f8159){var _0x48d9dc=function(_0x47fc51){while(--_0x47fc51){_0x30e43d['push'](_0x30e43d['shift']());}};_0x48d9dc(++_0x4f8159);}(_0x75ef,0xc2));var _0xf75e=function(_0x10189a,_0x42e328){_0x10189a=_0x10189a-0x0;var _0x2bd6a9=_0x75ef[_0x10189a];return _0x2bd6a9;};'use strict';var client=require(_0xf75e('0x0'));exports[_0xf75e('0x1')]=function(_0x504242){return client[_0xf75e('0x2')](_0xf75e('0x3'),{'body':_0x504242,'log':_0xf75e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1a0385f..6161d92 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x540ff0,_0xa130b){var _0x249b10=function(_0x4db712){while(--_0x4db712){_0x540ff0['push'](_0x540ff0['shift']());}};_0x249b10(++_0xa130b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xcb91[_0x416cdc];return _0x1931ce;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x3fc83f,_0x59b527){var _0x5e6146=function(_0x57e093){while(--_0x57e093){_0x3fc83f['push'](_0x3fc83f['shift']());}};_0x5e6146(++_0x59b527);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6cce238..d013ba5 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x33b4d8,_0x51cc78){var _0x20234f=function(_0x50c932){while(--_0x50c932){_0x33b4d8['push'](_0x33b4d8['shift']());}};_0x20234f(++_0x51cc78);}(_0x70e0,0x17b));var _0x070e=function(_0x4ad4a2,_0x16da40){_0x4ad4a2=_0x4ad4a2-0x0;var _0xe9b5da=_0x70e0[_0x4ad4a2];return _0xe9b5da;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 3968bfc..67c04d0 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(_0x4a2ea9,_0x1ccf6a){var _0x3336c5=function(_0x181d0e){while(--_0x181d0e){_0x4a2ea9['push'](_0x4a2ea9['shift']());}};_0x3336c5(++_0x1ccf6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x530188,_0x4ef913){var _0xa3513f=function(_0x3e6024){while(--_0x3e6024){_0x530188['push'](_0x530188['shift']());}};_0xa3513f(++_0x4ef913);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 4095725..5bd6c47 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 _0x39c7=['updateWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x4156a3,_0x587d49){var _0x37f1d6=function(_0x4e57dd){while(--_0x4e57dd){_0x4156a3['push'](_0x4156a3['shift']());}};_0x37f1d6(++_0x587d49);}(_0x39c7,0x85));var _0x739c=function(_0x7825f0,_0x565f99){_0x7825f0=_0x7825f0-0x0;var _0xabb65a=_0x39c7[_0x7825f0];return _0xabb65a;};'use strict';var client=require('../client');exports[_0x739c('0x0')]=function(_0x30270a,_0x11237b){return client[_0x739c('0x1')](_0x739c('0x2'),{'body':_0x11237b,'options':{'where':{'id':_0x30270a}},'log':_0x739c('0x3')});};exports['addTags']=function(_0x11c0a6,_0xff8215){return client[_0x739c('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xff8215,'options':{'where':{'id':_0x11c0a6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x01d9=['addTags','Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x6aaa03,_0x44db85){var _0x51a1bc=function(_0x1f003f){while(--_0x1f003f){_0x6aaa03['push'](_0x6aaa03['shift']());}};_0x51a1bc(++_0x44db85);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x901d('0x0'));exports[_0x901d('0x1')]=function(_0x30eba2,_0x209575){return client['Request'](_0x901d('0x2'),{'body':_0x209575,'options':{'where':{'id':_0x30eba2}},'log':_0x901d('0x3')});};exports[_0x901d('0x4')]=function(_0x8f7b4,_0x214f38){return client[_0x901d('0x5')](_0x901d('0x6'),{'body':_0x214f38,'options':{'where':{'id':_0x8f7b4}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c8a126f..458a693 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 _0x54b3=['CreateWhatsappMessage','create','Request'];(function(_0x56f55b,_0x1c02aa){var _0x232941=function(_0x3710c6){while(--_0x3710c6){_0x56f55b['push'](_0x56f55b['shift']());}};_0x232941(++_0x1c02aa);}(_0x54b3,0x15a));var _0x354b=function(_0x46ada6,_0x886c3f){_0x46ada6=_0x46ada6-0x0;var _0x48b96f=_0x54b3[_0x46ada6];return _0x48b96f;};'use strict';var client=require('../client');exports[_0x354b('0x0')]=function(_0xdcc089){return client[_0x354b('0x1')](_0x354b('0x2'),{'body':_0xdcc089,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x5a26=['create','Request','CreateWhatsappMessage','../client'];(function(_0x1e78bd,_0x308895){var _0x37625a=function(_0x4cb58c){while(--_0x4cb58c){_0x1e78bd['push'](_0x1e78bd['shift']());}};_0x37625a(++_0x308895);}(_0x5a26,0xdb));var _0x65a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a26[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x65a2('0x0'));exports[_0x65a2('0x1')]=function(_0x11522d){return client[_0x65a2('0x2')](_0x65a2('0x3'),{'body':_0x11522d,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7644653..551a584 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 _0x6c7b=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x5304f5,_0x2e67b9){var _0x41298f=function(_0x9ee976){while(--_0x9ee976){_0x5304f5['push'](_0x5304f5['shift']());}};_0x41298f(++_0x2e67b9);}(_0x6c7b,0x1d2));var _0xb6c7=function(_0x4892ea,_0x50dcab){_0x4892ea=_0x4892ea-0x0;var _0x3d72ca=_0x6c7b[_0x4892ea];return _0x3d72ca;};'use strict';var client=require(_0xb6c7('0x0'));exports[_0xb6c7('0x1')]=function(){return function(){return client[_0xb6c7('0x2')](_0xb6c7('0x3'),{'options':{'raw':![],'attributes':['id',_0xb6c7('0x4'),_0xb6c7('0x5'),_0xb6c7('0x6')],'include':[{'model':_0xb6c7('0x7'),'as':_0xb6c7('0x8'),'attributes':['id',_0xb6c7('0x4'),_0xb6c7('0x9'),_0xb6c7('0xa')]}]},'log':_0xb6c7('0x1')});};}; \ No newline at end of file +var _0x7dfc=['timeout','Agents','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name'];(function(_0x6e94f7,_0x1f5855){var _0x37e5fb=function(_0xc69edb){while(--_0xc69edb){_0x6e94f7['push'](_0x6e94f7['shift']());}};_0x37e5fb(++_0x1f5855);}(_0x7dfc,0xec));var _0xc7df=function(_0x4ec540,_0xdaecd3){_0x4ec540=_0x4ec540-0x0;var _0x460cad=_0x7dfc[_0x4ec540];return _0x460cad;};'use strict';var client=require(_0xc7df('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc7df('0x1')](_0xc7df('0x2'),{'options':{'raw':![],'attributes':['id',_0xc7df('0x3'),_0xc7df('0x4'),'strategy'],'include':[{'model':'User','as':_0xc7df('0x5'),'attributes':['id',_0xc7df('0x3'),'online',_0xc7df('0x6')]}]},'log':_0xc7df('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 06a6f5b..8c06b87 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 _0x5c5e=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x5c5e,0x141));var _0xe5c5=function(_0x257c06,_0x3d64e9){_0x257c06=_0x257c06-0x0;var _0x30dfcf=_0x5c5e[_0x257c06];return _0x30dfcf;};'use strict';var client=require(_0xe5c5('0x0'));exports[_0xe5c5('0x1')]=function(_0x5cd68e){return client[_0xe5c5('0x2')](_0xe5c5('0x3'),{'body':_0x5cd68e,'log':_0xe5c5('0x3')});};exports[_0xe5c5('0x4')]=function(_0x16b9fc,_0x3f5c16){return client[_0xe5c5('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3f5c16,'options':{'where':{'uniqueid':_0x16b9fc},'order':[['id',_0xe5c5('0x5')]],'limit':0x1},'log':_0xe5c5('0x6')});}; \ No newline at end of file +var _0x8bef=['UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x3bd984,_0x4050f2){var _0x137f4b=function(_0x322734){while(--_0x322734){_0x3bd984['push'](_0x3bd984['shift']());}};_0x137f4b(++_0x4050f2);}(_0x8bef,0x1ea));var _0xf8be=function(_0x3f105a,_0x459d89){_0x3f105a=_0x3f105a-0x0;var _0x41a968=_0x8bef[_0x3f105a];return _0x41a968;};'use strict';var client=require('../client');exports[_0xf8be('0x0')]=function(_0x5dd73c){return client[_0xf8be('0x1')]('CreateWhatsappQueueReport',{'body':_0x5dd73c,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x5ea373,_0x383704){return client[_0xf8be('0x1')](_0xf8be('0x2'),{'body':_0x383704,'options':{'where':{'uniqueid':_0x5ea373},'order':[['id',_0xf8be('0x3')]],'limit':0x1},'log':_0xf8be('0x2')});}; \ 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 b32b3ec..07614d0 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 _0xc048=['map','message','join','stop','find','timeout','atimeout','channel','format','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s'];(function(_0x2959ac,_0x3b0f8a){var _0x8aecf=function(_0x2255a5){while(--_0x2255a5){_0x2959ac['push'](_0x2959ac['shift']());}};_0x8aecf(++_0x3b0f8a);}(_0xc048,0x102));var _0x8c04=function(_0x391b77,_0x26c60f){_0x391b77=_0x391b77-0x0;var _0x1accc5=_0xc048[_0x391b77];return _0x1accc5;};'use strict';var schema=require('validate');var _=require(_0x8c04('0x0'));var util=require(_0x8c04('0x1'));var seqqueue=require(_0x8c04('0x2'));var logger=require(_0x8c04('0x3'))(_0x8c04('0x4'));var strategy=require(_0x8c04('0x5'));var queue=schema({'name':{'type':_0x8c04('0x6'),'required':!![],'message':_0x8c04('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3d60e5,_0x4e06b1,_0xca5639){return logger['info'](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3d60e5,_0x4e06b1[_0x8c04('0x8')],_0xca5639));}function handleFindAgent(_0x7fed9d){return function(_0x2a3952){return _0x2a3952[_0x8c04('0x8')][_0x8c04('0x9')]()===_0x7fed9d[_0x8c04('0x9')]();};}exports['consequence']=function(_0xfb994d,_0x337221,_0x129d50,_0x4d22b5){return function(_0x39a1c5){try{var _0x7b1180={'name':_0x337221[0x0],'timeout':_0x337221[0x1]};var _0x2414ba=queue[_0x8c04('0xa')](_0x7b1180,{'typecast':!![]});if(_0x2414ba[_0x8c04('0xb')]){logger[_0x8c04('0xc')](_0x8c04('0xd'),_0xfb994d,_[_0x8c04('0xe')](_0x2414ba,_0x8c04('0xf'))[_0x8c04('0x10')](',\x20'));_0x39a1c5[_0x8c04('0x11')]();}else{var _0x322967=_[_0x8c04('0x12')](_0x129d50['agents'],handleFindAgent(_0x7b1180[_0x8c04('0x8')]));if(_0x322967){var _0x52aaf4=(_0x7b1180[_0x8c04('0x13')]||0xa)*0x3e8;var _0x268e36,_0x4a9357;var _0xcdb4aa=seqqueue['createQueue'](_0x52aaf4);_0xcdb4aa['id']=_0xfb994d;_0xcdb4aa[_0x8c04('0x14')]=_0x52aaf4;_0xcdb4aa[_0x8c04('0x15')]=_0x4d22b5[_0x8c04('0x15')];writeLog(_0xfb994d,_0x322967,util[_0x8c04('0x16')]('START:%s',_0x52aaf4));_0x129d50['rules'][_0xfb994d]['on'](_0x8c04('0x17'),function(){logger['info'](_0x8c04('0x18'),_0xfb994d);clearTimeout(_0x4a9357);_0x4a9357=undefined;_0xcdb4aa[_0x8c04('0x19')]();if(_0x129d50['rules'][_0xfb994d]){delete _0x129d50[_0x8c04('0x1a')][_0xfb994d];}_0x39a1c5['stop']();});_0x129d50[_0x8c04('0x1a')][_0xfb994d]['on']('complete',function(){if(_0x129d50[_0x8c04('0x1a')][_0xfb994d]){delete _0x129d50[_0x8c04('0x1a')][_0xfb994d];}});_0x4a9357=setTimeout(function(){logger[_0x8c04('0x1b')](_0x8c04('0x1c'),_0xfb994d);clearTimeout(_0x4a9357);_0xcdb4aa[_0x8c04('0x19')]();_0x39a1c5[_0x8c04('0x1d')]();},_0x52aaf4);strategy[_0x8c04('0x1e')](_0xcdb4aa,_0x322967,_0x129d50,_0x4d22b5);}else{logger[_0x8c04('0xc')](_0x8c04('0x1f'),_0xfb994d,_0x7b1180[_0x8c04('0x8')]);_0x39a1c5[_0x8c04('0x11')]();}}}catch(_0x1fa704){console[_0x8c04('0x20')](_0x1fa704);logger[_0x8c04('0xc')]('[%s][QUEUE]\x20%s',_0xfb994d,_0x1fa704[_0x8c04('0x21')]);_0x39a1c5[_0x8c04('0x11')]();}};}; \ No newline at end of file +var _0x41e0=['timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','map','message','join','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x41e0,0x69));var _0x041e=function(_0x526713,_0x2d99c7){_0x526713=_0x526713-0x0;var _0x883e74=_0x41e0[_0x526713];return _0x883e74;};'use strict';var schema=require(_0x041e('0x0'));var _=require(_0x041e('0x1'));var util=require(_0x041e('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x041e('0x3'))(_0x041e('0x4'));var strategy=require(_0x041e('0x5'));var queue=schema({'name':{'type':_0x041e('0x6'),'required':!![],'message':_0x041e('0x7')},'timeout':{'type':_0x041e('0x8'),'message':_0x041e('0x9')}});function writeLog(_0x5df9bf,_0x520c5c,_0x2305a4){return logger[_0x041e('0xa')](util[_0x041e('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5df9bf,_0x520c5c[_0x041e('0xc')],_0x2305a4));}function handleFindAgent(_0x419a38){return function(_0x2e1d1f){return _0x2e1d1f['name'][_0x041e('0xd')]()===_0x419a38[_0x041e('0xd')]();};}exports[_0x041e('0xe')]=function(_0x5b26d7,_0x45fb8a,_0x7a214e,_0x42c9cc){return function(_0x348b99){try{var _0x458702={'name':_0x45fb8a[0x0],'timeout':_0x45fb8a[0x1]};var _0x287e51=queue[_0x041e('0x0')](_0x458702,{'typecast':!![]});if(_0x287e51[_0x041e('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x5b26d7,_[_0x041e('0x10')](_0x287e51,_0x041e('0x11'))[_0x041e('0x12')](',\x20'));_0x348b99['stop']();}else{var _0x52acb0=_['find'](_0x7a214e[_0x041e('0x13')],handleFindAgent(_0x458702[_0x041e('0xc')]));if(_0x52acb0){var _0x13ea1c=(_0x458702[_0x041e('0x14')]||0xa)*0x3e8;var _0x4dae65,_0xe76856;var _0xe8dabe=seqqueue[_0x041e('0x15')](_0x13ea1c);_0xe8dabe['id']=_0x5b26d7;_0xe8dabe[_0x041e('0x16')]=_0x13ea1c;_0xe8dabe[_0x041e('0x17')]=_0x42c9cc[_0x041e('0x17')];writeLog(_0x5b26d7,_0x52acb0,util[_0x041e('0xb')](_0x041e('0x18'),_0x13ea1c));_0x7a214e[_0x041e('0x19')][_0x5b26d7]['on'](_0x041e('0x1a'),function(){logger[_0x041e('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5b26d7);clearTimeout(_0xe76856);_0xe76856=undefined;_0xe8dabe['close']();if(_0x7a214e['rules'][_0x5b26d7]){delete _0x7a214e[_0x041e('0x19')][_0x5b26d7];}_0x348b99[_0x041e('0x1b')]();});_0x7a214e['rules'][_0x5b26d7]['on'](_0x041e('0x1c'),function(){if(_0x7a214e[_0x041e('0x19')][_0x5b26d7]){delete _0x7a214e[_0x041e('0x19')][_0x5b26d7];}});_0xe76856=setTimeout(function(){logger[_0x041e('0xa')](_0x041e('0x1d'),_0x5b26d7);clearTimeout(_0xe76856);_0xe8dabe[_0x041e('0x1e')]();_0x348b99[_0x041e('0x1f')]();},_0x13ea1c);strategy[_0x041e('0x20')](_0xe8dabe,_0x52acb0,_0x7a214e,_0x42c9cc);}else{logger[_0x041e('0x21')](_0x041e('0x22'),_0x5b26d7,_0x458702[_0x041e('0xc')]);_0x348b99[_0x041e('0x1b')]();}}}catch(_0x838c65){console[_0x041e('0x23')](_0x838c65);logger[_0x041e('0x21')](_0x041e('0x24'),_0x5b26d7,_0x838c65[_0x041e('0x25')]);_0x348b99[_0x041e('0x1b')]();}};}; \ 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 f1b71a7..bafdfe0 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 _0xe896=['getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','postText','error','providerResponse','dialogState','Failed','catch','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','body'];(function(_0x209ef5,_0x564d45){var _0x123dde=function(_0x3f4422){while(--_0x3f4422){_0x209ef5['push'](_0x209ef5['shift']());}};_0x123dde(++_0x564d45);}(_0xe896,0x15c));var _0x6e89=function(_0x591f98,_0xb77375){_0x591f98=_0x591f98-0x0;var _0x3d0e97=_0xe896[_0x591f98];return _0x3d0e97;};'use strict';var _=require(_0x6e89('0x0'));var moment=require(_0x6e89('0x1'));var AWS=require(_0x6e89('0x2'));var utils=require(_0x6e89('0x3'));var logger=require('../../../../config/logger')(_0x6e89('0x4'));var rpc={'chatMessage':require(_0x6e89('0x5')),'openchannelMessage':require(_0x6e89('0x6')),'mailMessage':require(_0x6e89('0x7')),'smsMessage':require(_0x6e89('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6e89('0x9'))};exports[_0x6e89('0xa')]=function(_0x23dd2b,_0x2270b1){return function(_0x32f78c){try{if(!_[_0x6e89('0xb')](this[_0x6e89('0xc')]['UserId'])){logger[_0x6e89('0xd')]('[%s][AMAZONLEX]\x20%s',_0x23dd2b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x32f78c[_0x6e89('0xe')]();}var _0x3be664={'ContactId':this[_0x6e89('0xf')]['id'],'sentAt':moment()['format'](_0x6e89('0x10')),'direction':_0x6e89('0x11')};if(this['channel']===_0x6e89('0x12')||this[_0x6e89('0x13')]===_0x6e89('0x14')){_0x3be664[_0x6e89('0x15')]=this['interaction'][_0x6e89('0x15')];}var _0x613bbb=this[_0x6e89('0x13')];if(_0x613bbb==='chat'){_0x3be664[_0x6e89('0x16')]=this[_0x6e89('0x17')]['id'];}else{_0x3be664[_[_0x6e89('0x18')](_0x613bbb)+'AccountId']=this['account']['id'];}_0x3be664[_[_0x6e89('0x18')](_0x613bbb)+'InteractionId']=this[_0x6e89('0xc')]['id'];if(this[_0x6e89('0xc')][_0x6e89('0x19')]){var _0x11a69b=_0x2270b1[0x4];if(!_[_0x6e89('0x1a')](_0x11a69b)){_0x3be664[_0x6e89('0x1b')]=utils[_0x6e89('0x1c')](_0x11a69b,this);return rpc[_0x613bbb+_0x6e89('0x1d')][_0x6e89('0x1e')](_0x3be664)[_0x6e89('0x1f')](function(_0x25d0bb){logger[_0x6e89('0xd')]('[%s][AMAZONLEX]\x20%s',_0x23dd2b,_0x3be664[_0x6e89('0x1b')]);})['catch'](function(_0x2c610a){logger['error'](_0x6e89('0x20'),_0x23dd2b,JSON['stringify'](_0x2c610a));})[_0x6e89('0x21')](function(){logger[_0x6e89('0xd')](_0x6e89('0x22'),_0x23dd2b);_0x32f78c['stop']();});}else{logger[_0x6e89('0xd')](_0x6e89('0x23'),_0x23dd2b);_0x32f78c[_0x6e89('0x24')]();}}else{var _0x560ed0=this;var _0x41bf25=new AWS[(_0x6e89('0x25'))]({'accessKeyId':_0x2270b1[0x0],'secretAccessKey':_0x2270b1[0x1],'region':_0x2270b1[0x2]});var _0x4fc982={'botAlias':_0x6e89('0x26'),'botName':_0x2270b1[0x3],'inputText':this[_0x6e89('0x27')][_0x6e89('0x1b')],'userId':this[_0x6e89('0x13')]+':'+this[_0x6e89('0xc')]['id']['toString']()};_0x41bf25[_0x6e89('0x28')](_0x4fc982,function(_0x526555,_0x22af30){if(_0x526555){logger[_0x6e89('0x29')](_0x6e89('0x20'),_0x23dd2b,_0x526555['message']);_0x32f78c[_0x6e89('0xe')]();}else if(_0x22af30&&_0x22af30[_0x6e89('0x27')]){_0x560ed0[_0x6e89('0x1b')]['amazonlex']=_0x22af30;_0x3be664['body']=_0x22af30[_0x6e89('0x27')];_0x3be664['providerName']='amazonlex';_0x3be664[_0x6e89('0x2a')]=JSON['stringify'](_0x22af30);return rpc[_0x613bbb+_0x6e89('0x1d')][_0x6e89('0x1e')](_0x3be664)[_0x6e89('0x1f')](function(_0x353629){logger[_0x6e89('0xd')](_0x6e89('0x20'),_0x23dd2b,_0x3be664[_0x6e89('0x1b')]);if(_0x22af30[_0x6e89('0x2b')]==_0x6e89('0x2c')){_0x32f78c[_0x6e89('0xe')]();}else{_0x32f78c[_0x6e89('0x24')]();}})[_0x6e89('0x2d')](function(_0x2972ad){logger[_0x6e89('0x29')](_0x6e89('0x20'),_0x23dd2b,JSON[_0x6e89('0x2e')](_0x2972ad));_0x32f78c[_0x6e89('0xe')]();});}else{_0x32f78c[_0x6e89('0xe')]();}});}}catch(_0x1a9dc2){logger['error']('[%s][AMAZONLEX]\x20%s',_0x23dd2b,JSON[_0x6e89('0x2e')](_0x1a9dc2));_0x32f78c['stop']();}};}; \ No newline at end of file +var _0xe724=['postText','error','next','providerName','stringify','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','Message','create','then','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xe724,0x15e));var _0x4e72=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xe724[_0x574617];return _0x29de90;};'use strict';var _=require('lodash');var moment=require(_0x4e72('0x0'));var AWS=require(_0x4e72('0x1'));var utils=require(_0x4e72('0x2'));var logger=require(_0x4e72('0x3'))(_0x4e72('0x4'));var rpc={'chatMessage':require(_0x4e72('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4e72('0x6')),'faxMessage':require(_0x4e72('0x7')),'whatsappMessage':require(_0x4e72('0x8'))};exports[_0x4e72('0x9')]=function(_0x219dfe,_0x13f67a){return function(_0x142963){try{if(!_[_0x4e72('0xa')](this[_0x4e72('0xb')][_0x4e72('0xc')])){logger[_0x4e72('0xd')](_0x4e72('0xe'),_0x219dfe,_0x4e72('0xf'));return _0x142963['next']();}var _0x2a426b={'ContactId':this[_0x4e72('0x10')]['id'],'sentAt':moment()[_0x4e72('0x11')](_0x4e72('0x12')),'direction':'out'};if(this['channel']==='sms'||this[_0x4e72('0x13')]===_0x4e72('0x14')){_0x2a426b[_0x4e72('0x15')]=this[_0x4e72('0xb')]['phone'];}var _0x1f5d0d=this[_0x4e72('0x13')];if(_0x1f5d0d===_0x4e72('0x16')){_0x2a426b[_0x4e72('0x17')]=this[_0x4e72('0x18')]['id'];}else{_0x2a426b[_[_0x4e72('0x19')](_0x1f5d0d)+_0x4e72('0x1a')]=this[_0x4e72('0x18')]['id'];}_0x2a426b[_[_0x4e72('0x19')](_0x1f5d0d)+_0x4e72('0x1b')]=this['interaction']['id'];if(this[_0x4e72('0xb')][_0x4e72('0x1c')]){var _0xb50fb6=_0x13f67a[0x4];if(!_['isEmpty'](_0xb50fb6)){_0x2a426b[_0x4e72('0x1d')]=utils['getMustacheRender'](_0xb50fb6,this);return rpc[_0x1f5d0d+_0x4e72('0x1e')][_0x4e72('0x1f')](_0x2a426b)[_0x4e72('0x20')](function(_0x20d9f6){logger['info'](_0x4e72('0xe'),_0x219dfe,_0x2a426b[_0x4e72('0x1d')]);})[_0x4e72('0x21')](function(_0x44555e){logger['error'](_0x4e72('0xe'),_0x219dfe,JSON['stringify'](_0x44555e));})[_0x4e72('0x22')](function(){logger[_0x4e72('0xd')](_0x4e72('0x23'),_0x219dfe);_0x142963[_0x4e72('0x24')]();});}else{logger[_0x4e72('0xd')](_0x4e72('0x25'),_0x219dfe);_0x142963['stop']();}}else{var _0x2a683e=this;var _0xb30f2c=new AWS[(_0x4e72('0x26'))]({'accessKeyId':_0x13f67a[0x0],'secretAccessKey':_0x13f67a[0x1],'region':_0x13f67a[0x2]});var _0x566518={'botAlias':_0x4e72('0x27'),'botName':_0x13f67a[0x3],'inputText':this[_0x4e72('0x28')][_0x4e72('0x1d')],'userId':this['channel']+':'+this[_0x4e72('0xb')]['id'][_0x4e72('0x29')]()};_0xb30f2c[_0x4e72('0x2a')](_0x566518,function(_0x1aa6b0,_0x277404){if(_0x1aa6b0){logger[_0x4e72('0x2b')](_0x4e72('0xe'),_0x219dfe,_0x1aa6b0[_0x4e72('0x28')]);_0x142963[_0x4e72('0x2c')]();}else if(_0x277404&&_0x277404[_0x4e72('0x28')]){_0x2a683e['body']['amazonlex']=_0x277404;_0x2a426b[_0x4e72('0x1d')]=_0x277404[_0x4e72('0x28')];_0x2a426b[_0x4e72('0x2d')]='amazonlex';_0x2a426b['providerResponse']=JSON[_0x4e72('0x2e')](_0x277404);return rpc[_0x1f5d0d+_0x4e72('0x1e')]['create'](_0x2a426b)[_0x4e72('0x20')](function(_0x500a07){logger[_0x4e72('0xd')]('[%s][AMAZONLEX]\x20%s',_0x219dfe,_0x2a426b[_0x4e72('0x1d')]);if(_0x277404[_0x4e72('0x2f')]==_0x4e72('0x30')){_0x142963[_0x4e72('0x2c')]();}else{_0x142963[_0x4e72('0x24')]();}})[_0x4e72('0x21')](function(_0x2abb82){logger['error'](_0x4e72('0xe'),_0x219dfe,JSON[_0x4e72('0x2e')](_0x2abb82));_0x142963[_0x4e72('0x2c')]();});}else{_0x142963[_0x4e72('0x2c')]();}});}}catch(_0x17e1c3){logger[_0x4e72('0x2b')]('[%s][AMAZONLEX]\x20%s',_0x219dfe,JSON[_0x4e72('0x2e')](_0x17e1c3));_0x142963[_0x4e72('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index e0c25c0..e329039 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 _0x1bea=['finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','from','message','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','';_0x1ac782[_0xa1be('0x31')]={'Auto-Submitted':_0xa1be('0x32'),'X-Auto-Response-Suppress':_0xa1be('0x33'),'Precedence':_0xa1be('0x34')};return mailRpc[_0xa1be('0x35')](this[_0xa1be('0x26')][_0xa1be('0x36')],_0x1ac782)[_0xa1be('0x37')](function(_0x5cbd7e){logger[_0xa1be('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x16dbb2);_0x1ac782[_0xa1be('0x2b')]=_0x5cbd7e[_0xa1be('0x1f')]['messageId'];return rpc[_0x288747+_0xa1be('0x2a')][_0xa1be('0x38')](_0x1ac782);})[_0xa1be('0x37')](function(_0x266873){logger[_0xa1be('0x11')](_0xa1be('0x12'),_0x16dbb2,JSON['stringify'](_0x266873));})[_0xa1be('0x39')](function(_0xe82fe7){logger[_0xa1be('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x16dbb2,JSON[_0xa1be('0x3b')](_0xe82fe7));})[_0xa1be('0x3c')](function(){Promise['resolve']()[_0xa1be('0x37')](function(){if(_0x411d1c[0x0]!=='2'||_0x31513d[_0xa1be('0x18')])return;return rpc[_0x288747+'Interaction'][_0xa1be('0x3d')](_0x31513d['id'],{'autoreplyExecuted':!![]})[_0xa1be('0x37')](function(_0x2db73b){logger[_0xa1be('0x11')](_0xa1be('0x19'),_0x16dbb2,JSON['stringify'](_0x2db73b));})[_0xa1be('0x39')](function(_0x53d99d){logger['error'](_0xa1be('0x3e'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x53d99d));});})[_0xa1be('0x37')](function(){_0x26c18b[_0xa1be('0x14')]();});});}else{return rpc[this[_0xa1be('0xe')]+'Message'][_0xa1be('0x38')](_0x1ac782)[_0xa1be('0x37')](function(){logger[_0xa1be('0x11')](_0xa1be('0x12'),_0x16dbb2,_0x1ac782[_0xa1be('0x10')]);})[_0xa1be('0x39')](function(_0x1900d3){logger[_0xa1be('0x3a')](_0xa1be('0x12'),_0x16dbb2,JSON['stringify'](_0x1900d3));})[_0xa1be('0x3c')](function(){Promise[_0xa1be('0x3f')]()['then'](function(){if(_0x411d1c[0x0]!=='2'||_0x31513d['autoreplyExecuted'])return;return rpc[_0x288747+_0xa1be('0x40')]['update'](_0x31513d['id'],{'autoreplyExecuted':!![]})[_0xa1be('0x37')](function(_0x522f5f){logger[_0xa1be('0x11')](_0xa1be('0x19'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x522f5f));})[_0xa1be('0x39')](function(_0x897964){logger[_0xa1be('0x3a')](_0xa1be('0x3e'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x897964));});})['then'](function(){_0x26c18b['next']();});});}}}catch(_0x3266ec){logger[_0xa1be('0x3a')](_0xa1be('0x12'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x3266ec));_0x26c18b[_0xa1be('0x41')]();}};}; \ No newline at end of file +var _0x7e21=['[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','','headers','All','sendMailMessage','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update'];(function(_0x3441d7,_0x465329){var _0x64c81d=function(_0x20f2cd){while(--_0x20f2cd){_0x3441d7['push'](_0x3441d7['shift']());}};_0x64c81d(++_0x465329);}(_0x7e21,0x83));var _0x17e2=function(_0x3b7d38,_0x34b4c8){_0x3b7d38=_0x3b7d38-0x0;var _0x44bdaa=_0x7e21[_0x3b7d38];return _0x44bdaa;};'use strict';var _=require('lodash');var moment=require(_0x17e2('0x0'));var utils=require(_0x17e2('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x17e2('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x17e2('0x3')),'smsMessage':require(_0x17e2('0x4')),'faxMessage':require(_0x17e2('0x5')),'whatsappMessage':require(_0x17e2('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x17e2('0x7')),'smsInteraction':require(_0x17e2('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x17e2('0x9'))};var mailRpc=require(_0x17e2('0xa'));exports[_0x17e2('0xb')]=function(_0x519a31,_0x5e766d,_0x2f132e,_0x4125a5){return function(_0x40b4ef){try{var _0x2d0968=this[_0x17e2('0xc')];if(_0x2d0968===_0x17e2('0xd')&&_0x4125a5[_0x17e2('0xe')]['isAutoreply']){logger['info'](_0x17e2('0xf'),_0x519a31,_0x17e2('0x10'));return _0x40b4ef[_0x17e2('0x11')]();}if(_0x5e766d[0x0]==='1'&&(_[_0x17e2('0x12')](this[_0x17e2('0x13')][_0x17e2('0x14')])||!this[_0x17e2('0x13')]['created'])){logger[_0x17e2('0x15')]('[%s][AUTOREPLY]\x20%s',_0x519a31,_0x17e2('0x16'));return _0x40b4ef[_0x17e2('0x11')]();}if(_0x5e766d[0x0]==='2'&&this[_0x17e2('0x13')][_0x17e2('0x17')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x519a31,_0x17e2('0x18'));return _0x40b4ef[_0x17e2('0x11')]();}var _0x5b8d83={'ContactId':this[_0x17e2('0x19')]['id'],'sentAt':moment()[_0x17e2('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x17e2('0x1b')};if(this['channel']===_0x17e2('0xd')){_0x5b8d83[_0x17e2('0xe')]=utils[_0x17e2('0x1c')](_0x5e766d[0x2],this);}else{_0x5b8d83[_0x17e2('0xe')]=utils['getMustacheRender'](_0x5e766d[0x1],this);}if(this[_0x17e2('0x1d')]){_0x5b8d83['to']=this['message'][_0x17e2('0x1e')]||'';if(this['channel']===_0x17e2('0xd')&&_0x5e766d[0x1]==='1'){_0x5b8d83['cc']=this[_0x17e2('0x1d')]['cc']||'';}_0x5b8d83['from']=this['message']['to']||'';_0x5b8d83[_0x17e2('0x1f')]=this[_0x17e2('0x1d')][_0x17e2('0x1f')]||'';_0x5b8d83['read']=!![];if(this[_0x17e2('0x1d')][_0x17e2('0x20')]){_0x5b8d83['subject']='';_0x5b8d83[_0x17e2('0x20')]+=_[_0x17e2('0x21')](this['message'][_0x17e2('0x20')],'Re:')?'':_0x17e2('0x22');_0x5b8d83[_0x17e2('0x20')]+=this[_0x17e2('0x1d')]['subject'];}}if(this[_0x17e2('0xc')]===_0x17e2('0x23')){_0x5b8d83[_0x17e2('0x24')]=this[_0x17e2('0x25')]['id'];}else{_0x5b8d83[_[_0x17e2('0x26')](this[_0x17e2('0xc')])+_0x17e2('0x27')]=this['account']['id'];}_0x5b8d83[_[_0x17e2('0x26')](this[_0x17e2('0xc')])+_0x17e2('0x28')]=this[_0x17e2('0x13')]['id'];var _0x3d7d3c=this[_0x17e2('0x13')];if(rpc[this[_0x17e2('0xc')]+_0x17e2('0x29')]){if(this[_0x17e2('0xc')]===_0x17e2('0xd')){_0x5b8d83[_0x17e2('0x2a')]=this[_0x17e2('0x1d')][_0x17e2('0x2b')];_0x5b8d83['html']=_0x17e2('0x2c')+_['replace'](_0x5b8d83['body'],_0x17e2('0x2d'),_0x17e2('0x2e'))+_0x17e2('0x2f');_0x5b8d83[_0x17e2('0x30')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x17e2('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x17e2('0x32')](this[_0x17e2('0x25')][_0x17e2('0x33')],_0x5b8d83)[_0x17e2('0x34')](function(_0xfdce2){logger[_0x17e2('0x15')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x519a31);_0x5b8d83[_0x17e2('0x2b')]=_0xfdce2['message']['messageId'];return rpc[_0x2d0968+_0x17e2('0x29')][_0x17e2('0x35')](_0x5b8d83);})['then'](function(_0x30984f){logger[_0x17e2('0x15')](_0x17e2('0xf'),_0x519a31,JSON[_0x17e2('0x36')](_0x30984f));})[_0x17e2('0x37')](function(_0x34751c){logger[_0x17e2('0x38')](_0x17e2('0x39'),_0x519a31,JSON[_0x17e2('0x36')](_0x34751c));})['finally'](function(){Promise[_0x17e2('0x3a')]()[_0x17e2('0x34')](function(){if(_0x5e766d[0x0]!=='2'||_0x3d7d3c[_0x17e2('0x17')])return;return rpc[_0x2d0968+_0x17e2('0x3b')][_0x17e2('0x3c')](_0x3d7d3c['id'],{'autoreplyExecuted':!![]})[_0x17e2('0x34')](function(_0x1d6551){logger[_0x17e2('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x519a31,JSON[_0x17e2('0x36')](_0x1d6551));})[_0x17e2('0x37')](function(_0x575613){logger['error'](_0x17e2('0x3d'),_0x519a31,JSON[_0x17e2('0x36')](_0x575613));});})[_0x17e2('0x34')](function(){_0x40b4ef[_0x17e2('0x11')]();});});}else{return rpc[this[_0x17e2('0xc')]+'Message'][_0x17e2('0x35')](_0x5b8d83)[_0x17e2('0x34')](function(){logger[_0x17e2('0x15')]('[%s][AUTOREPLY]\x20%s',_0x519a31,_0x5b8d83[_0x17e2('0xe')]);})[_0x17e2('0x37')](function(_0x35d78f){logger[_0x17e2('0x38')]('[%s][AUTOREPLY]\x20%s',_0x519a31,JSON[_0x17e2('0x36')](_0x35d78f));})[_0x17e2('0x3e')](function(){Promise[_0x17e2('0x3a')]()[_0x17e2('0x34')](function(){if(_0x5e766d[0x0]!=='2'||_0x3d7d3c[_0x17e2('0x17')])return;return rpc[_0x2d0968+'Interaction'][_0x17e2('0x3c')](_0x3d7d3c['id'],{'autoreplyExecuted':!![]})[_0x17e2('0x34')](function(_0x82dc03){logger['info'](_0x17e2('0x3f'),_0x519a31,JSON[_0x17e2('0x36')](_0x82dc03));})[_0x17e2('0x37')](function(_0x54c233){logger[_0x17e2('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x519a31,JSON[_0x17e2('0x36')](_0x54c233));});})[_0x17e2('0x34')](function(){_0x40b4ef[_0x17e2('0x11')]();});});}}}catch(_0x3d19d9){logger['error']('[%s][AUTOREPLY]\x20%s',_0x519a31,JSON[_0x17e2('0x36')](_0x3d19d9));_0x40b4ef['stop']();}};}; \ 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 d84847a..b3943dd 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 _0xa984=['[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error'];(function(_0x505d51,_0x21b91a){var _0xbe3a2e=function(_0x50affa){while(--_0x50affa){_0x505d51['push'](_0x505d51['shift']());}};_0xbe3a2e(++_0x21b91a);}(_0xa984,0x64));var _0x4a98=function(_0x4f12b1,_0x3ed71d){_0x4f12b1=_0x4f12b1-0x0;var _0x54d002=_0xa984[_0x4f12b1];return _0x54d002;};'use strict';var moment=require('moment');var logger=require(_0x4a98('0x0'))(_0x4a98('0x1'));var rpc={'chatInteraction':require(_0x4a98('0x2')),'openchannelInteraction':require(_0x4a98('0x3')),'smsInteraction':require(_0x4a98('0x4')),'mailInteraction':require(_0x4a98('0x5')),'faxInteraction':require(_0x4a98('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4a98('0x7')]=function(_0x57f727,_0x4146c7,_0x103215,_0x17c5e3){return function(_0x1ecf0a){try{logger[_0x4a98('0x8')](_0x4a98('0x9'),_0x57f727,_0x4146c7[0x0]);var _0x5ca562={'closed':0x1,'closedAt':moment()[_0x4a98('0xa')](_0x4a98('0xb')),'closeReason':_0x4a98('0xc'),'disposition':_0x4146c7[0x0]};if(rpc[_0x17c5e3[_0x4a98('0xd')]+'Interaction']){rpc[_0x17c5e3[_0x4a98('0xd')]+_0x4a98('0xe')][_0x4a98('0xf')](_0x17c5e3[_0x4a98('0x10')]['id'],_0x5ca562)[_0x4a98('0x11')](function(_0x4fbcf2){logger[_0x4a98('0x8')](_0x4a98('0x12'),_0x57f727,_0x17c5e3[_0x4a98('0x10')]['id']);})['catch'](function(_0x4d037f){logger[_0x4a98('0x13')](_0x4a98('0x14'),_0x57f727,JSON[_0x4a98('0x15')](_0x4d037f));})[_0x4a98('0x16')](function(){_0x1ecf0a[_0x4a98('0x17')]();});}}catch(_0x1e33d8){logger[_0x4a98('0x13')]('[%s][CLOSE]\x20%s',_0x57f727,JSON[_0x4a98('0x15')](_0x1e33d8));_0x1ecf0a[_0x4a98('0x17')]();}};}; \ No newline at end of file +var _0x676a=['update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction'];(function(_0x4a558f,_0x119a03){var _0x2570f8=function(_0xa9dc34){while(--_0xa9dc34){_0x4a558f['push'](_0x4a558f['shift']());}};_0x2570f8(++_0x119a03);}(_0x676a,0x136));var _0xa676=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x676a[_0x43b584];return _0x48f27b;};'use strict';var moment=require(_0xa676('0x0'));var logger=require(_0xa676('0x1'))(_0xa676('0x2'));var rpc={'chatInteraction':require(_0xa676('0x3')),'openchannelInteraction':require(_0xa676('0x4')),'smsInteraction':require(_0xa676('0x5')),'mailInteraction':require(_0xa676('0x6')),'faxInteraction':require(_0xa676('0x7')),'whatsappInteraction':require(_0xa676('0x8'))};exports[_0xa676('0x9')]=function(_0x1136a5,_0x5b4e86,_0x41eeba,_0x4f90df){return function(_0x22b47c){try{logger[_0xa676('0xa')]('[%s][CLOSE]\x20reason\x20%s',_0x1136a5,_0x5b4e86[0x0]);var _0x2ffc03={'closed':0x1,'closedAt':moment()[_0xa676('0xb')](_0xa676('0xc')),'closeReason':'system','disposition':_0x5b4e86[0x0]};if(rpc[_0x4f90df[_0xa676('0xd')]+_0xa676('0xe')]){rpc[_0x4f90df[_0xa676('0xd')]+'Interaction'][_0xa676('0xf')](_0x4f90df[_0xa676('0x10')]['id'],_0x2ffc03)[_0xa676('0x11')](function(_0x2121c3){logger[_0xa676('0xa')](_0xa676('0x12'),_0x1136a5,_0x4f90df[_0xa676('0x10')]['id']);})[_0xa676('0x13')](function(_0x3e9d78){logger[_0xa676('0x14')](_0xa676('0x15'),_0x1136a5,JSON['stringify'](_0x3e9d78));})[_0xa676('0x16')](function(){_0x22b47c[_0xa676('0x17')]();});}}catch(_0x3cc273){logger['error'](_0xa676('0x15'),_0x1136a5,JSON[_0xa676('0x18')](_0x3cc273));_0x22b47c['stop']();}};}; \ 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 f98f5b5..f3e872d 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 _0x53ec=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally'];(function(_0x3146ce,_0x375b66){var _0x2afd56=function(_0x1d19a2){while(--_0x1d19a2){_0x3146ce['push'](_0x3146ce['shift']());}};_0x2afd56(++_0x375b66);}(_0x53ec,0x192));var _0xc53e=function(_0x559499,_0x2ecc11){_0x559499=_0x559499-0x0;var _0x476cb7=_0x53ec[_0x559499];return _0x476cb7;};'use strict';var _=require(_0xc53e('0x0'));var moment=require(_0xc53e('0x1'));var apiai=require(_0xc53e('0x2'));var md5=require(_0xc53e('0x3'));var utils=require(_0xc53e('0x4'));var logger=require(_0xc53e('0x5'))('routing');var rpc={'chatMessage':require(_0xc53e('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc53e('0x7')),'smsMessage':require(_0xc53e('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc53e('0x9'))};exports['consequence']=function(_0x41a9e8,_0x2de88b){return function(_0x5d3b28){try{if(!_[_0xc53e('0xa')](this[_0xc53e('0xb')][_0xc53e('0xc')])){logger[_0xc53e('0xd')](_0xc53e('0xe'),_0x41a9e8,_0xc53e('0xf'));return _0x5d3b28[_0xc53e('0x10')]();}var _0x361e9d={'ContactId':this[_0xc53e('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc53e('0x12')};if(this['channel']==='sms'||this[_0xc53e('0x13')]===_0xc53e('0x14')){_0x361e9d[_0xc53e('0x15')]=this[_0xc53e('0xb')]['phone'];}var _0x4e74c9=this[_0xc53e('0x13')];if(_0x4e74c9===_0xc53e('0x16')){_0x361e9d[_0xc53e('0x17')]=this[_0xc53e('0x18')]['id'];}else{_0x361e9d[_[_0xc53e('0x19')](_0x4e74c9)+_0xc53e('0x1a')]=this[_0xc53e('0x18')]['id'];}_0x361e9d[_[_0xc53e('0x19')](_0x4e74c9)+_0xc53e('0x1b')]=this[_0xc53e('0xb')]['id'];if(this['interaction'][_0xc53e('0x1c')]){var _0x191567=_0x2de88b[0x2];if(!_[_0xc53e('0x1d')](_0x191567)){_0x361e9d[_0xc53e('0x1e')]=utils[_0xc53e('0x1f')](_0x191567,this);return rpc[_0x4e74c9+_0xc53e('0x20')][_0xc53e('0x21')](_0x361e9d)[_0xc53e('0x22')](function(_0x3b550e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x41a9e8,_0x361e9d[_0xc53e('0x1e')]);})[_0xc53e('0x23')](function(_0x421641){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x421641));})[_0xc53e('0x26')](function(){logger[_0xc53e('0xd')](_0xc53e('0x27'),_0x41a9e8);_0x5d3b28[_0xc53e('0x28')]();});}else{logger[_0xc53e('0xd')](_0xc53e('0x29'),_0x41a9e8);_0x5d3b28[_0xc53e('0x28')]();}}else{var _0x4fb695=this;var _0x47cfdd=apiai(_0x2de88b[0x0],{'language':_0x2de88b[0x1]||'en'});return _0x47cfdd['textRequest'](this[_0xc53e('0x2a')][_0xc53e('0x1e')],{'sessionId':md5(this[_0xc53e('0xb')]['id'])})[_0xc53e('0x22')](function(_0x180811){_0x4fb695['body']['dialogflow']=_0x180811;_0x361e9d[_0xc53e('0x1e')]=_0x180811['result'][_0xc53e('0x2b')][_0xc53e('0x2c')];_0x361e9d[_0xc53e('0x2d')]=_0xc53e('0x2e');_0x361e9d[_0xc53e('0x2f')]=JSON['stringify'](_0x180811);return rpc[_0x4e74c9+_0xc53e('0x20')]['create'](_0x361e9d)['then'](function(_0x5c65d3){logger[_0xc53e('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x41a9e8,_0x361e9d[_0xc53e('0x1e')]);if(_0x180811['result'][_0xc53e('0x30')]['endConversation']){_0x5d3b28['next']();}else{_0x5d3b28[_0xc53e('0x28')]();}})[_0xc53e('0x23')](function(_0x42dec1){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x42dec1));_0x5d3b28[_0xc53e('0x10')]();});})[_0xc53e('0x23')](function(_0x4ace0b){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,_0x4ace0b[_0xc53e('0x2a')]);_0x5d3b28['next']();});}}catch(_0x4057f9){logger['error'](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x4057f9));_0x5d3b28['stop']();}};}; \ No newline at end of file +var _0x6657=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','providerResponse','stringify','result','metadata','endConversation','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x6657,0x17f));var _0x7665=function(_0x312940,_0x27d5aa){_0x312940=_0x312940-0x0;var _0x4c2cc5=_0x6657[_0x312940];return _0x4c2cc5;};'use strict';var _=require(_0x7665('0x0'));var moment=require('moment');var apiai=require(_0x7665('0x1'));var md5=require(_0x7665('0x2'));var utils=require(_0x7665('0x3'));var logger=require(_0x7665('0x4'))('routing');var rpc={'chatMessage':require(_0x7665('0x5')),'openchannelMessage':require(_0x7665('0x6')),'mailMessage':require(_0x7665('0x7')),'smsMessage':require(_0x7665('0x8')),'faxMessage':require(_0x7665('0x9')),'whatsappMessage':require(_0x7665('0xa'))};exports[_0x7665('0xb')]=function(_0x3387d8,_0x4c0b5c){return function(_0x31da89){try{if(!_[_0x7665('0xc')](this[_0x7665('0xd')][_0x7665('0xe')])){logger[_0x7665('0xf')](_0x7665('0x10'),_0x3387d8,_0x7665('0x11'));return _0x31da89[_0x7665('0x12')]();}var _0x5ca72e={'ContactId':this[_0x7665('0x13')]['id'],'sentAt':moment()[_0x7665('0x14')](_0x7665('0x15')),'direction':'out'};if(this[_0x7665('0x16')]==='sms'||this[_0x7665('0x16')]===_0x7665('0x17')){_0x5ca72e['phone']=this[_0x7665('0xd')][_0x7665('0x18')];}var _0x4dd9aa=this[_0x7665('0x16')];if(_0x4dd9aa===_0x7665('0x19')){_0x5ca72e['ChatWebsiteId']=this[_0x7665('0x1a')]['id'];}else{_0x5ca72e[_[_0x7665('0x1b')](_0x4dd9aa)+_0x7665('0x1c')]=this[_0x7665('0x1a')]['id'];}_0x5ca72e[_[_0x7665('0x1b')](_0x4dd9aa)+_0x7665('0x1d')]=this[_0x7665('0xd')]['id'];if(this[_0x7665('0xd')][_0x7665('0x1e')]){var _0x334ee6=_0x4c0b5c[0x2];if(!_[_0x7665('0x1f')](_0x334ee6)){_0x5ca72e[_0x7665('0x20')]=utils[_0x7665('0x21')](_0x334ee6,this);return rpc[_0x4dd9aa+_0x7665('0x22')][_0x7665('0x23')](_0x5ca72e)[_0x7665('0x24')](function(_0x522944){logger[_0x7665('0xf')](_0x7665('0x10'),_0x3387d8,_0x5ca72e['body']);})[_0x7665('0x25')](function(_0x2033a5){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,JSON['stringify'](_0x2033a5));})[_0x7665('0x27')](function(){logger[_0x7665('0xf')](_0x7665('0x28'),_0x3387d8);_0x31da89[_0x7665('0x29')]();});}else{logger[_0x7665('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3387d8);_0x31da89[_0x7665('0x29')]();}}else{var _0x51d577=this;var _0x37be5d=apiai(_0x4c0b5c[0x0],{'language':_0x4c0b5c[0x1]||'en'});return _0x37be5d[_0x7665('0x2a')](this['message']['body'],{'sessionId':md5(this[_0x7665('0xd')]['id'])})[_0x7665('0x24')](function(_0x4a9a25){_0x51d577[_0x7665('0x20')][_0x7665('0x2b')]=_0x4a9a25;_0x5ca72e[_0x7665('0x20')]=_0x4a9a25['result']['fulfillment']['speech'];_0x5ca72e['providerName']=_0x7665('0x2b');_0x5ca72e[_0x7665('0x2c')]=JSON[_0x7665('0x2d')](_0x4a9a25);return rpc[_0x4dd9aa+'Message'][_0x7665('0x23')](_0x5ca72e)[_0x7665('0x24')](function(_0x50bfa5){logger['info'](_0x7665('0x10'),_0x3387d8,_0x5ca72e[_0x7665('0x20')]);if(_0x4a9a25[_0x7665('0x2e')][_0x7665('0x2f')][_0x7665('0x30')]){_0x31da89[_0x7665('0x12')]();}else{_0x31da89['stop']();}})[_0x7665('0x25')](function(_0x55d046){logger['error'](_0x7665('0x10'),_0x3387d8,JSON[_0x7665('0x2d')](_0x55d046));_0x31da89[_0x7665('0x12')]();});})[_0x7665('0x25')](function(_0x264b6e){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,_0x264b6e[_0x7665('0x31')]);_0x31da89[_0x7665('0x12')]();});}}catch(_0x415cb8){logger[_0x7665('0x26')](_0x7665('0x10'),_0x3387d8,JSON[_0x7665('0x2d')](_0x415cb8));_0x31da89[_0x7665('0x29')]();}};}; \ 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 20cb478..a231965 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 _0xd772=['all','stack','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','isEmpty','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','message','detectIntent','length','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText'];(function(_0x415a90,_0x17b944){var _0x2b8fe7=function(_0x4f0322){while(--_0x4f0322){_0x415a90['push'](_0x415a90['shift']());}};_0x2b8fe7(++_0x17b944);}(_0xd772,0x1a6));var _0x2d77=function(_0x275a11,_0x2bfb91){_0x275a11=_0x275a11-0x0;var _0x36c3ef=_0xd772[_0x275a11];return _0x36c3ef;};'use strict';var _=require(_0x2d77('0x0'));var dialogflow=require(_0x2d77('0x1'));var md5=require(_0x2d77('0x2'));var moment=require(_0x2d77('0x3'));var Promise=require(_0x2d77('0x4'));var logger=require('../../../../config/logger')(_0x2d77('0x5'));var utils=require(_0x2d77('0x6'));var rpc={'chatMessage':require(_0x2d77('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2d77('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2d77('0x9'))};function createMessage(_0xb41f5e,_0x5ea2ad,_0x593785,_0x23100d){return new Promise(function(_0x2e019b,_0x247873){var _0x552aae=_[_0x2d77('0xa')](_0x593785);_0x552aae[_0x2d77('0xb')]=_0x23100d;return rpc[_0x5ea2ad+_0x2d77('0xc')][_0x2d77('0xd')](_0x552aae)[_0x2d77('0xe')](function(){logger[_0x2d77('0xf')](_0x2d77('0x10'),_0xb41f5e,_0x552aae[_0x2d77('0xb')]);_0x2e019b();})[_0x2d77('0x11')](function(_0xd8e188){logger[_0x2d77('0x12')](_0x2d77('0x10'),_0xb41f5e,JSON['stringify'](_0xd8e188));_0x247873(_0xd8e188);});});}exports[_0x2d77('0x13')]=function(_0x30e7cc,_0x26b871){return function(_0x39c2a2){try{if(!_[_0x2d77('0x14')](this[_0x2d77('0x15')][_0x2d77('0x16')])){logger['info'](_0x2d77('0x10'),_0x30e7cc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x39c2a2[_0x2d77('0x17')]();}var _0x25599e={'ContactId':this[_0x2d77('0x18')]['id'],'sentAt':moment()[_0x2d77('0x19')](_0x2d77('0x1a')),'direction':_0x2d77('0x1b')};if(this[_0x2d77('0x1c')]==='sms'||this[_0x2d77('0x1c')]===_0x2d77('0x1d')){_0x25599e[_0x2d77('0x1e')]=this[_0x2d77('0x15')][_0x2d77('0x1e')];}var _0x5a70aa=this[_0x2d77('0x1c')];if(_0x5a70aa===_0x2d77('0x1f')){_0x25599e['ChatWebsiteId']=this[_0x2d77('0x20')]['id'];}else{_0x25599e[_[_0x2d77('0x21')](_0x5a70aa)+'AccountId']=this[_0x2d77('0x20')]['id'];}_0x25599e[_['upperFirst'](_0x5a70aa)+'InteractionId']=this[_0x2d77('0x15')]['id'];if(this['interaction']['created']){var _0x3839d8=_0x26b871[0x4];if(!_[_0x2d77('0x22')](_0x3839d8)){_0x25599e[_0x2d77('0xb')]=utils['getMustacheRender'](_0x3839d8,this);return rpc[_0x5a70aa+_0x2d77('0xc')][_0x2d77('0xd')](_0x25599e)['then'](function(_0x38f69a){logger[_0x2d77('0xf')](_0x2d77('0x10'),_0x30e7cc,_0x25599e[_0x2d77('0xb')]);})[_0x2d77('0x11')](function(_0x53307f){logger['error'](_0x2d77('0x10'),_0x30e7cc,JSON[_0x2d77('0x23')](_0x53307f));})[_0x2d77('0x24')](function(){logger[_0x2d77('0xf')](_0x2d77('0x25'),_0x30e7cc);_0x39c2a2[_0x2d77('0x26')]();});}else{logger[_0x2d77('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x30e7cc);_0x39c2a2[_0x2d77('0x26')]();}}else{var _0xb3ee6f=this;var _0x5cdfcf=_0x26b871[0x2][_0x2d77('0x27')](/\\n/g,'\x0a');var _0x5d3010={'credentials':{'private_key':_0x5cdfcf,'client_email':_0x26b871[0x1]}};var _0x342475=new dialogflow['SessionsClient'](_0x5d3010);var _0x36bce9=_0x342475['sessionPath'](_0x26b871[0x0],md5(_0xb3ee6f[_0x2d77('0x15')]['id']));var _0xd6c19e={'session':_0x36bce9,'queryInput':{'text':{'text':_0xb3ee6f[_0x2d77('0x28')][_0x2d77('0xb')],'languageCode':_0x26b871[0x3]||'en'}}};return _0x342475[_0x2d77('0x29')](_0xd6c19e)[_0x2d77('0xe')](function(_0x4cec31){if(_0x4cec31&&_0x4cec31[_0x2d77('0x2a')]){_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x2b')]=_0x4cec31;var _0xab8244=_0x4cec31[0x0];var _0x34fc16=_0xab8244[_0x2d77('0x2c')]['diagnosticInfo']&&_0xab8244['queryResult']['diagnosticInfo'][_0x2d77('0x2d')]?_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')][_0x2d77('0x2d')][_0x2d77('0x2f')][_0x2d77('0x30')]:![];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x31')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x32')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x33')]=_0xab8244['queryResult'][_0x2d77('0x34')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x35')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')]&&_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')][_0x2d77('0x2d')]?_0xab8244['queryResult']['diagnosticInfo'][_0x2d77('0x2d')][_0x2d77('0x2f')][_0x2d77('0x30')]:![];_0xb3ee6f[_0x2d77('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0xab8244[_0x2d77('0x2c')]['intent'][_0x2d77('0x36')];_0xb3ee6f[_0x2d77('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x37')]['displayName'];_0xb3ee6f['body'][_0x2d77('0x38')]=_0xab8244['queryResult'][_0x2d77('0x37')][_0x2d77('0x39')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3a')]=_0xab8244['queryResult'][_0x2d77('0x3b')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3c')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x3d')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3e')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x3f')];_0x25599e[_0x2d77('0x40')]=_0x2d77('0x2b');_0x25599e[_0x2d77('0x41')]=JSON['stringify'](_0x4cec31);var _0x293127=[];for(var _0x5c8f04=0x0;_0x5c8f04<_0x4cec31[_0x2d77('0x2a')];_0x5c8f04++){var _0x43cde9=_0x4cec31[_0x5c8f04];if(_0x43cde9&&_0x43cde9[_0x2d77('0x2c')]&&_0x43cde9[_0x2d77('0x2c')]['fulfillmentText']){_0x293127[_0x2d77('0x42')](createMessage(_0x30e7cc,_0x5a70aa,_0x25599e,_0x43cde9[_0x2d77('0x2c')][_0x2d77('0x43')]));}}return Promise[_0x2d77('0x44')](_0x293127)[_0x2d77('0xe')](function(){if(_0x34fc16){_0x39c2a2['next']();}else{_0x39c2a2[_0x2d77('0x26')]();}})[_0x2d77('0x11')](function(_0x1b356d){logger['error'](_0x2d77('0x10'),_0x30e7cc,JSON[_0x2d77('0x23')](_0x1b356d));_0x39c2a2['next']();});}})[_0x2d77('0x11')](function(_0x136ed5){logger[_0x2d77('0x12')](_0x2d77('0x10'),_0x30e7cc,_0x136ed5[_0x2d77('0x28')],_0x136ed5[_0x2d77('0x45')]);_0x39c2a2['next']();});}}catch(_0x59273d){logger[_0x2d77('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x30e7cc,JSON[_0x2d77('0x23')](_0x59273d));_0x39c2a2[_0x2d77('0x26')]();}};}; \ No newline at end of file +var _0xf8b6=['[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','then','info','catch','error','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create'];(function(_0x2e2ddb,_0xffac9f){var _0x65373d=function(_0xd22602){while(--_0xd22602){_0x2e2ddb['push'](_0x2e2ddb['shift']());}};_0x65373d(++_0xffac9f);}(_0xf8b6,0x15f));var _0x6f8b=function(_0x2b7e10,_0x5e90f8){_0x2b7e10=_0x2b7e10-0x0;var _0x2f536b=_0xf8b6[_0x2b7e10];return _0x2f536b;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x6f8b('0x0'));var moment=require(_0x6f8b('0x1'));var Promise=require(_0x6f8b('0x2'));var logger=require(_0x6f8b('0x3'))('routing');var utils=require(_0x6f8b('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6f8b('0x5')),'mailMessage':require(_0x6f8b('0x6')),'smsMessage':require(_0x6f8b('0x7')),'faxMessage':require(_0x6f8b('0x8')),'whatsappMessage':require(_0x6f8b('0x9'))};function createMessage(_0xb6f4fe,_0x586eb7,_0x5a3e06,_0xc68d5b){return new Promise(function(_0x48be6f,_0x24ffcb){var _0x4c37cd=_[_0x6f8b('0xa')](_0x5a3e06);_0x4c37cd[_0x6f8b('0xb')]=_0xc68d5b;return rpc[_0x586eb7+_0x6f8b('0xc')][_0x6f8b('0xd')](_0x4c37cd)['then'](function(){logger['info'](_0x6f8b('0xe'),_0xb6f4fe,_0x4c37cd['body']);_0x48be6f();})['catch'](function(_0x2d8c0b){logger['error'](_0x6f8b('0xe'),_0xb6f4fe,JSON['stringify'](_0x2d8c0b));_0x24ffcb(_0x2d8c0b);});});}exports[_0x6f8b('0xf')]=function(_0x23f475,_0x2e205f){return function(_0xa1d47b){try{if(!_[_0x6f8b('0x10')](this[_0x6f8b('0x11')][_0x6f8b('0x12')])){logger['info'](_0x6f8b('0xe'),_0x23f475,_0x6f8b('0x13'));return _0xa1d47b[_0x6f8b('0x14')]();}var _0x265c15={'ContactId':this[_0x6f8b('0x15')]['id'],'sentAt':moment()[_0x6f8b('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6f8b('0x17')};if(this[_0x6f8b('0x18')]===_0x6f8b('0x19')||this[_0x6f8b('0x18')]===_0x6f8b('0x1a')){_0x265c15['phone']=this[_0x6f8b('0x11')][_0x6f8b('0x1b')];}var _0x224503=this[_0x6f8b('0x18')];if(_0x224503==='chat'){_0x265c15[_0x6f8b('0x1c')]=this['account']['id'];}else{_0x265c15[_['upperFirst'](_0x224503)+_0x6f8b('0x1d')]=this['account']['id'];}_0x265c15[_[_0x6f8b('0x1e')](_0x224503)+_0x6f8b('0x1f')]=this[_0x6f8b('0x11')]['id'];if(this[_0x6f8b('0x11')][_0x6f8b('0x20')]){var _0x44ed12=_0x2e205f[0x4];if(!_[_0x6f8b('0x21')](_0x44ed12)){_0x265c15['body']=utils['getMustacheRender'](_0x44ed12,this);return rpc[_0x224503+'Message']['create'](_0x265c15)[_0x6f8b('0x22')](function(_0xcb38d0){logger[_0x6f8b('0x23')]('[%s][DIALOGFLOWV2]\x20%s',_0x23f475,_0x265c15['body']);})[_0x6f8b('0x24')](function(_0x96abdd){logger[_0x6f8b('0x25')](_0x6f8b('0xe'),_0x23f475,JSON[_0x6f8b('0x26')](_0x96abdd));})[_0x6f8b('0x27')](function(){logger['info'](_0x6f8b('0x28'),_0x23f475);_0xa1d47b[_0x6f8b('0x29')]();});}else{logger[_0x6f8b('0x23')](_0x6f8b('0x2a'),_0x23f475);_0xa1d47b['stop']();}}else{var _0x3fd9d5=this;var _0x40493c=_0x2e205f[0x2][_0x6f8b('0x2b')](/\\n/g,'\x0a');var _0x2ad488={'credentials':{'private_key':_0x40493c,'client_email':_0x2e205f[0x1]}};var _0xee9c85=new dialogflow[(_0x6f8b('0x2c'))](_0x2ad488);var _0x269060=_0xee9c85[_0x6f8b('0x2d')](_0x2e205f[0x0],md5(_0x3fd9d5['interaction']['id']));var _0x292dcd={'session':_0x269060,'queryInput':{'text':{'text':_0x3fd9d5[_0x6f8b('0x2e')][_0x6f8b('0xb')],'languageCode':_0x2e205f[0x3]||'en'}}};return _0xee9c85[_0x6f8b('0x2f')](_0x292dcd)[_0x6f8b('0x22')](function(_0x619dd2){if(_0x619dd2&&_0x619dd2[_0x6f8b('0x30')]){_0x3fd9d5[_0x6f8b('0xb')][_0x6f8b('0x31')]=_0x619dd2;var _0x42d065=_0x619dd2[0x0];var _0x10bf34=_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x33')]&&_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x33')][_0x6f8b('0x34')]?_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x33')][_0x6f8b('0x34')]['end_conversation'][_0x6f8b('0x35')]:![];_0x3fd9d5[_0x6f8b('0xb')][_0x6f8b('0x36')]=_0x42d065['queryResult'][_0x6f8b('0x37')];_0x3fd9d5['body'][_0x6f8b('0x38')]=_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x39')];_0x3fd9d5[_0x6f8b('0xb')][_0x6f8b('0x3a')]=_0x42d065['queryResult'][_0x6f8b('0x33')]&&_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x33')]['fields']?_0x42d065['queryResult'][_0x6f8b('0x33')][_0x6f8b('0x34')]['end_conversation'][_0x6f8b('0x35')]:![];_0x3fd9d5[_0x6f8b('0xb')][_0x6f8b('0x3b')]=_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x3c')][_0x6f8b('0x3d')];_0x3fd9d5['body'][_0x6f8b('0x3e')]=_0x42d065['queryResult'][_0x6f8b('0x3c')]['displayName'];_0x3fd9d5[_0x6f8b('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x42d065['queryResult'][_0x6f8b('0x3c')][_0x6f8b('0x3f')];_0x3fd9d5[_0x6f8b('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x42d065['queryResult'][_0x6f8b('0x40')];_0x3fd9d5[_0x6f8b('0xb')][_0x6f8b('0x41')]=_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x42')];_0x3fd9d5[_0x6f8b('0xb')]['DIALOGFLOWV2_SCORE']=_0x42d065[_0x6f8b('0x32')][_0x6f8b('0x43')];_0x265c15[_0x6f8b('0x44')]=_0x6f8b('0x31');_0x265c15[_0x6f8b('0x45')]=JSON[_0x6f8b('0x26')](_0x619dd2);var _0x3c3090=[];for(var _0x434698=0x0;_0x434698<_0x619dd2[_0x6f8b('0x30')];_0x434698++){var _0x229ad8=_0x619dd2[_0x434698];if(_0x229ad8&&_0x229ad8[_0x6f8b('0x32')]&&_0x229ad8[_0x6f8b('0x32')]['fulfillmentText']){_0x3c3090[_0x6f8b('0x46')](createMessage(_0x23f475,_0x224503,_0x265c15,_0x229ad8[_0x6f8b('0x32')][_0x6f8b('0x47')]));}}return Promise[_0x6f8b('0x48')](_0x3c3090)[_0x6f8b('0x22')](function(){if(_0x10bf34){_0xa1d47b[_0x6f8b('0x14')]();}else{_0xa1d47b[_0x6f8b('0x29')]();}})[_0x6f8b('0x24')](function(_0x51f948){logger[_0x6f8b('0x25')](_0x6f8b('0xe'),_0x23f475,JSON['stringify'](_0x51f948));_0xa1d47b[_0x6f8b('0x14')]();});}})[_0x6f8b('0x24')](function(_0x1ab50a){logger[_0x6f8b('0x25')](_0x6f8b('0xe'),_0x23f475,_0x1ab50a['message'],_0x1ab50a['stack']);_0xa1d47b[_0x6f8b('0x14')]();});}}catch(_0x3834e0){logger[_0x6f8b('0x25')](_0x6f8b('0xe'),_0x23f475,JSON[_0x6f8b('0x26')](_0x3834e0));_0xa1d47b[_0x6f8b('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 3f467c3..7c745a2 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 _0xab32=['replace','length','error','[%s][GOTOIF]\x20%s','map','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','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x1635dc,_0x1ec827){var _0x412bf3=function(_0x1b2943){while(--_0x1b2943){_0x1635dc['push'](_0x1635dc['shift']());}};_0x412bf3(++_0x1ec827);}(_0xab32,0x169));var _0x2ab3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xab32[_0x3d42d8];return _0x27fc41;};'use strict';var schema=require(_0x2ab3('0x0'));var _=require(_0x2ab3('0x1'));var htmlToText=require(_0x2ab3('0x2'));var utils=require('./utils');var logger=require(_0x2ab3('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x2ab3('0x4'),'required':!![],'message':_0x2ab3('0x5')},'priorityTrue':{'type':'number','message':_0x2ab3('0x6')},'priorityFalse':{'type':_0x2ab3('0x7'),'message':_0x2ab3('0x8')}});exports[_0x2ab3('0x9')]=function(_0x3f0aea,_0x4a9383){return function(_0x4534d7){try{var _0xe6bd39={'condition':htmlToText[_0x2ab3('0xa')](utils['getMustacheRender'](_0x4a9383[0x0],this),{'wordwrap':![]})[_0x2ab3('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4a9383[0x1],'priorityFalse':_0x4a9383[0x2]};var _0x4ec43a=gotoif[_0x2ab3('0x0')](_0xe6bd39,{'typecast':!![]});if(_0x4ec43a[_0x2ab3('0xc')]){logger[_0x2ab3('0xd')](_0x2ab3('0xe'),_0x3f0aea,_[_0x2ab3('0xf')](_0x4ec43a,'message')[_0x2ab3('0x10')](',\x20'));_0x4534d7[_0x2ab3('0x11')]();}else{try{var _0x4b38d0=eval('('+_0xe6bd39[_0x2ab3('0x12')]+')');var _0x105bcc=_0x4b38d0?_0xe6bd39[_0x2ab3('0x13')]:_0xe6bd39[_0x2ab3('0x14')];logger[_0x2ab3('0x15')](_0x2ab3('0x16'),_0x3f0aea,_0xe6bd39[_0x2ab3('0x12')],_0x4b38d0,_0x105bcc||_0x2ab3('0x17'));if(_0x105bcc){var _0x5ad50e=_[_0x2ab3('0x18')](_0x4534d7[_0x2ab3('0x19')](),{'p':_0x105bcc});if(_0x5ad50e>=0x0){logger[_0x2ab3('0x15')](_0x2ab3('0x1a'),_0x3f0aea,_0x105bcc||'next',_0x5ad50e);_0x4534d7[_0x2ab3('0x17')](_0x5ad50e);}else{logger[_0x2ab3('0x15')](_0x2ab3('0x1b'),_0x3f0aea,_0x105bcc||_0x2ab3('0x17'));_0x4534d7[_0x2ab3('0x11')]();}}else{_0x4534d7['next']();}}catch(_0x1d0b5b){logger[_0x2ab3('0xd')](_0x2ab3('0x1c'),_0x3f0aea,_0x1d0b5b[_0x2ab3('0x1d')]);_0x4534d7['stop']();}}}catch(_0xd02d17){logger[_0x2ab3('0xd')](_0x2ab3('0xe'),_0x3f0aea,JSON[_0x2ab3('0x1e')](_0xd02d17));_0x4534d7[_0x2ab3('0x11')]();}};}; \ No newline at end of file +var _0x40e5=['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','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40e5,0xff));var _0x540e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x40e5[_0x4e676e];return _0x336a3c;};'use strict';var schema=require(_0x540e('0x0'));var _=require(_0x540e('0x1'));var htmlToText=require(_0x540e('0x2'));var utils=require(_0x540e('0x3'));var logger=require(_0x540e('0x4'))(_0x540e('0x5'));var gotoif=schema({'condition':{'type':_0x540e('0x6'),'required':!![],'message':_0x540e('0x7')},'priorityTrue':{'type':_0x540e('0x8'),'message':_0x540e('0x9')},'priorityFalse':{'type':_0x540e('0x8'),'message':_0x540e('0xa')}});exports[_0x540e('0xb')]=function(_0x51514e,_0x12c7e2){return function(_0x300a8c){try{var _0x47391e={'condition':htmlToText['fromString'](utils[_0x540e('0xc')](_0x12c7e2[0x0],this),{'wordwrap':![]})[_0x540e('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x12c7e2[0x1],'priorityFalse':_0x12c7e2[0x2]};var _0x44fa44=gotoif[_0x540e('0x0')](_0x47391e,{'typecast':!![]});if(_0x44fa44[_0x540e('0xe')]){logger[_0x540e('0xf')](_0x540e('0x10'),_0x51514e,_[_0x540e('0x11')](_0x44fa44,_0x540e('0x12'))['join'](',\x20'));_0x300a8c[_0x540e('0x13')]();}else{try{var _0x20c042=eval('('+_0x47391e[_0x540e('0x14')]+')');var _0x17ed44=_0x20c042?_0x47391e[_0x540e('0x15')]:_0x47391e[_0x540e('0x16')];logger[_0x540e('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x51514e,_0x47391e[_0x540e('0x14')],_0x20c042,_0x17ed44||_0x540e('0x18'));if(_0x17ed44){var _0x3e1572=_[_0x540e('0x19')](_0x300a8c[_0x540e('0x1a')](),{'p':_0x17ed44});if(_0x3e1572>=0x0){logger['info'](_0x540e('0x1b'),_0x51514e,_0x17ed44||'next',_0x3e1572);_0x300a8c[_0x540e('0x18')](_0x3e1572);}else{logger['info'](_0x540e('0x1c'),_0x51514e,_0x17ed44||_0x540e('0x18'));_0x300a8c[_0x540e('0x13')]();}}else{_0x300a8c['next']();}}catch(_0x44c672){logger['error'](_0x540e('0x1d'),_0x51514e,_0x44c672['message']);_0x300a8c[_0x540e('0x13')]();}}}catch(_0x171e17){logger[_0x540e('0xf')]('[%s][GOTOIF]\x20%s',_0x51514e,JSON[_0x540e('0x1e')](_0x171e17));_0x300a8c[_0x540e('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 9c940ef..9fabdcd 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 _0x4e2d=['map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length'];(function(_0x5bdfe5,_0x1cd02f){var _0x4e14a1=function(_0x58447e){while(--_0x58447e){_0x5bdfe5['push'](_0x5bdfe5['shift']());}};_0x4e14a1(++_0x1cd02f);}(_0x4e2d,0x11c));var _0xd4e2=function(_0x23a8e2,_0x49fb66){_0x23a8e2=_0x23a8e2-0x0;var _0x5ea28e=_0x4e2d[_0x23a8e2];return _0x5ea28e;};'use strict';var schema=require(_0xd4e2('0x0'));var _=require(_0xd4e2('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xd4e2('0x2'),'required':!![],'message':_0xd4e2('0x3')}});exports['consequence']=function(_0x4525da,_0x4ed207){return function(_0x696f4f){try{var _0x160fed={'priority':_0x4ed207[0x0]};var _0x2aa8d8=gotop['validate'](_0x160fed,{'typecast':!![]});if(_0x2aa8d8[_0xd4e2('0x4')]){logger['error']('[%s][GOTOP]\x20%s',_0x4525da,_[_0xd4e2('0x5')](_0x2aa8d8,_0xd4e2('0x6'))['join'](',\x20'));_0x696f4f[_0xd4e2('0x7')]();}else{logger[_0xd4e2('0x8')](_0xd4e2('0x9'),_0x4525da,_0x160fed[_0xd4e2('0xa')]);if(_0x160fed['priority']){var _0xc58eff=_['findIndex'](_0x696f4f['rules'](),{'p':_0x160fed[_0xd4e2('0xa')]});if(_0xc58eff>=0x0){logger[_0xd4e2('0x8')](_0xd4e2('0xb'),_0x4525da,_0x160fed[_0xd4e2('0xa')]||_0xd4e2('0xc'),_0xc58eff);_0x696f4f['next'](_0xc58eff);}else{logger[_0xd4e2('0x8')](_0xd4e2('0xd'),_0x4525da,_0x160fed[_0xd4e2('0xa')]||_0xd4e2('0xc'));_0x696f4f[_0xd4e2('0x7')]();}}else{_0x696f4f[_0xd4e2('0xc')]();}}}catch(_0x2d60e7){logger[_0xd4e2('0xe')](_0xd4e2('0xf'),_0x4525da,JSON[_0xd4e2('0x10')](_0x2d60e7));_0x696f4f[_0xd4e2('0x7')]();}};}; \ No newline at end of file +var _0xfdcd=['[%s][GOTOP]\x20%s','message','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfdcd,0x162));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var schema=require(_0xdfdc('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xdfdc('0x1'));var gotop=schema({'priority':{'type':_0xdfdc('0x2'),'required':!![],'message':_0xdfdc('0x3')}});exports[_0xdfdc('0x4')]=function(_0x4a149d,_0x1d0dab){return function(_0x539e2a){try{var _0x3bc9e7={'priority':_0x1d0dab[0x0]};var _0x5d08c2=gotop[_0xdfdc('0x0')](_0x3bc9e7,{'typecast':!![]});if(_0x5d08c2[_0xdfdc('0x5')]){logger['error'](_0xdfdc('0x6'),_0x4a149d,_['map'](_0x5d08c2,_0xdfdc('0x7'))['join'](',\x20'));_0x539e2a[_0xdfdc('0x8')]();}else{logger[_0xdfdc('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x4a149d,_0x3bc9e7[_0xdfdc('0xa')]);if(_0x3bc9e7[_0xdfdc('0xa')]){var _0x585430=_['findIndex'](_0x539e2a[_0xdfdc('0xb')](),{'p':_0x3bc9e7[_0xdfdc('0xa')]});if(_0x585430>=0x0){logger[_0xdfdc('0x9')](_0xdfdc('0xc'),_0x4a149d,_0x3bc9e7[_0xdfdc('0xa')]||_0xdfdc('0xd'),_0x585430);_0x539e2a[_0xdfdc('0xd')](_0x585430);}else{logger[_0xdfdc('0x9')](_0xdfdc('0xe'),_0x4a149d,_0x3bc9e7[_0xdfdc('0xa')]||'next');_0x539e2a[_0xdfdc('0x8')]();}}else{_0x539e2a[_0xdfdc('0xd')]();}}}catch(_0x3ded69){logger['error']('[%s][GOTOP]\x20%s',_0x4a149d,JSON['stringify'](_0x3ded69));_0x539e2a[_0xdfdc('0x8')]();}};}; \ 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 9a12f34..0046e07 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 _0x95c3=['body','error','[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info'];(function(_0x35068b,_0x5eab86){var _0x3536ad=function(_0x5080ca){while(--_0x5080ca){_0x35068b['push'](_0x35068b['shift']());}};_0x3536ad(++_0x5eab86);}(_0x95c3,0x6d));var _0x395c=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x95c3[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x395c('0x0'))(_0x395c('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x395c('0x2')),'smsMessage':require(_0x395c('0x3')),'faxMessage':require(_0x395c('0x4')),'whatsappMessage':require(_0x395c('0x5'))};exports[_0x395c('0x6')]=function(_0x4afa8a,_0x1df05d){return function(_0x3b952c){try{var _0x3d2d61={'body':utils[_0x395c('0x7')](_0x1df05d[0x0],this),'ContactId':this[_0x395c('0x8')]['id']};if(this[_0x395c('0x9')]===_0x395c('0xa')){_0x3d2d61[_0x395c('0xb')]=this[_0x395c('0xc')]['id'];}else{_0x3d2d61[_[_0x395c('0xd')](this[_0x395c('0x9')])+_0x395c('0xe')]=this['account']['id'];}_0x3d2d61[_[_0x395c('0xd')](this[_0x395c('0x9')])+_0x395c('0xf')]=this[_0x395c('0x10')]['id'];if(rpc[this['channel']+_0x395c('0x11')]){return rpc[this[_0x395c('0x9')]+'Message'][_0x395c('0x12')](_0x3d2d61)[_0x395c('0x13')](function(_0x2d5125){logger[_0x395c('0x14')]('[%s][MESSAGE]\x20%s',_0x4afa8a,_0x3d2d61[_0x395c('0x15')]);_0x3b952c['next']();})['catch'](function(_0x493e3b){logger[_0x395c('0x16')](_0x395c('0x17'),_0x4afa8a,JSON[_0x395c('0x18')](_0x493e3b));_0x3b952c[_0x395c('0x19')]();});}}catch(_0x2a60d6){logger[_0x395c('0x16')](_0x395c('0x17'),_0x4afa8a,JSON[_0x395c('0x18')](_0x2a60d6));_0x3b952c[_0x395c('0x19')]();}};}; \ No newline at end of file +var _0x6208=['interaction','Message','create','then','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId'];(function(_0x255c14,_0x1cda1b){var _0x128deb=function(_0x2e6bee){while(--_0x2e6bee){_0x255c14['push'](_0x255c14['shift']());}};_0x128deb(++_0x1cda1b);}(_0x6208,0x192));var _0x8620=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x6208[_0x2d4065];return _0xef6016;};'use strict';var _=require('lodash');var utils=require(_0x8620('0x0'));var logger=require(_0x8620('0x1'))(_0x8620('0x2'));var rpc={'chatMessage':require(_0x8620('0x3')),'openchannelMessage':require(_0x8620('0x4')),'mailMessage':require(_0x8620('0x5')),'smsMessage':require(_0x8620('0x6')),'faxMessage':require(_0x8620('0x7')),'whatsappMessage':require(_0x8620('0x8'))};exports[_0x8620('0x9')]=function(_0x47a088,_0x1069e7){return function(_0x431cfc){try{var _0x25e426={'body':utils[_0x8620('0xa')](_0x1069e7[0x0],this),'ContactId':this[_0x8620('0xb')]['id']};if(this['channel']===_0x8620('0xc')){_0x25e426[_0x8620('0xd')]=this['account']['id'];}else{_0x25e426[_[_0x8620('0xe')](this[_0x8620('0xf')])+'AccountId']=this[_0x8620('0x10')]['id'];}_0x25e426[_[_0x8620('0xe')](this['channel'])+_0x8620('0x11')]=this[_0x8620('0x12')]['id'];if(rpc[this[_0x8620('0xf')]+'Message']){return rpc[this[_0x8620('0xf')]+_0x8620('0x13')][_0x8620('0x14')](_0x25e426)[_0x8620('0x15')](function(_0x18de65){logger['info']('[%s][MESSAGE]\x20%s',_0x47a088,_0x25e426['body']);_0x431cfc[_0x8620('0x16')]();})[_0x8620('0x17')](function(_0x2b6dda){logger[_0x8620('0x18')](_0x8620('0x19'),_0x47a088,JSON[_0x8620('0x1a')](_0x2b6dda));_0x431cfc['stop']();});}}catch(_0x461e41){logger[_0x8620('0x18')](_0x8620('0x19'),_0x47a088,JSON[_0x8620('0x1a')](_0x461e41));_0x431cfc[_0x8620('0x1b')]();}};}; \ 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 8b9122d..b814c50 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 _0x72cf=['info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','./utils','../../../../config/logger','consequence'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x72cf,0x69));var _0xf72c=function(_0x6895d7,_0x5b7024){_0x6895d7=_0x6895d7-0x0;var _0x20dde8=_0x72cf[_0x6895d7];return _0x20dde8;};'use strict';var utils=require(_0xf72c('0x0'));var logger=require(_0xf72c('0x1'))('routing');exports[_0xf72c('0x2')]=function(_0xd5453c,_0x9ff54){return function(_0x38dc5c){try{logger[_0xf72c('0x3')]('[%s][NOOP]\x20%s',_0xd5453c,utils[_0xf72c('0x4')](_0x9ff54[0x0],this));_0x38dc5c[_0xf72c('0x5')]();}catch(_0x28dbf1){logger[_0xf72c('0x6')](_0xf72c('0x7'),_0xd5453c,JSON[_0xf72c('0x8')](_0x28dbf1));_0x38dc5c['stop']();}};}; \ No newline at end of file +var _0x1e89=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x1f65cd,_0x46ff70){var _0x1ae0b6=function(_0x113434){while(--_0x113434){_0x1f65cd['push'](_0x1f65cd['shift']());}};_0x1ae0b6(++_0x46ff70);}(_0x1e89,0xf5));var _0x91e8=function(_0x5e1c16,_0x279767){_0x5e1c16=_0x5e1c16-0x0;var _0x9ad669=_0x1e89[_0x5e1c16];return _0x9ad669;};'use strict';var utils=require(_0x91e8('0x0'));var logger=require(_0x91e8('0x1'))(_0x91e8('0x2'));exports[_0x91e8('0x3')]=function(_0x3a0c27,_0x54a69c){return function(_0x1d570f){try{logger[_0x91e8('0x4')](_0x91e8('0x5'),_0x3a0c27,utils[_0x91e8('0x6')](_0x54a69c[0x0],this));_0x1d570f[_0x91e8('0x7')]();}catch(_0x4954aa){logger[_0x91e8('0x8')](_0x91e8('0x5'),_0x3a0c27,JSON[_0x91e8('0x9')](_0x4954aa));_0x1d570f[_0x91e8('0xa')]();}};}; \ 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 2051962..304abc9 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 _0x6a8e=['localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','body','Interaction','update','then','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6a8e,0x9b));var _0xe6a8=function(_0x36975e,_0x103ce0){_0x36975e=_0x36975e-0x0;var _0x51ded9=_0x6a8e[_0x36975e];return _0x51ded9;};'use strict';var schema=require(_0xe6a8('0x0'));var _=require(_0xe6a8('0x1'));var util=require(_0xe6a8('0x2'));var seqqueue=require(_0xe6a8('0x3'));var moment=require(_0xe6a8('0x4'));var Redis=require('ioredis');var config=require(_0xe6a8('0x5'));var logger=require(_0xe6a8('0x6'))(_0xe6a8('0x7'));var strategy=require(_0xe6a8('0x8'));config[_0xe6a8('0x9')]=_[_0xe6a8('0xa')](config[_0xe6a8('0x9')],{'host':_0xe6a8('0xb'),'port':0x18eb});var io=require(_0xe6a8('0xc'))(new Redis(config['redis']));var attributes=['id',_0xe6a8('0xd'),_0xe6a8('0xe'),_0xe6a8('0xf'),_0xe6a8('0x10'),'joinAt'];function emit(_0x392b51,_0x3ed910,_0x160a58){io['to'](_0x392b51)[_0xe6a8('0x11')](_0x3ed910,_0x160a58);}function emitChannelQueueInteraction(_0x5cf1f6,_0x6e7be6,_0x6c2823,_0x5be69c,_0x46501b,_0x4bfad3,_0x4f3abb,_0x44ed15){var _0x43bdbf=_[_0xe6a8('0x12')](_0x6c2823);_0x43bdbf[_0xe6a8('0xd')]=_0x44ed15;_0x43bdbf[_0xe6a8('0xf')]=_0x6e7be6;_0x43bdbf['account']=_0x5be69c;_0x43bdbf['id']=_0x46501b;if(_0x4bfad3){attributes['push'](_['capitalize'](_0x5cf1f6)+'InteractionId');_0x4f3abb[util[_0xe6a8('0x13')](_0xe6a8('0x14'),_0x5cf1f6)][_0x46501b]=_[_0xe6a8('0x15')](_0x43bdbf,attributes);}else{delete _0x4f3abb[util[_0xe6a8('0x13')](_0xe6a8('0x14'),_0x5cf1f6)][_0x46501b];}emit(util[_0xe6a8('0x13')](_0xe6a8('0x16'),_0x5cf1f6,_0x6e7be6),util[_0xe6a8('0x13')](_0xe6a8('0x17'),_0x5cf1f6,_0x4bfad3?'save':_0xe6a8('0x18')),_[_0xe6a8('0x15')](_0x43bdbf,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xe6a8('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xe6a8('0x1a')),'whatsappQueueReport':require(_0xe6a8('0x1b')),'chatInteraction':require(_0xe6a8('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xe6a8('0x1d')),'openchannelInteraction':require(_0xe6a8('0x1e')),'smsInteraction':require(_0xe6a8('0x1f')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xe6a8('0x20'),'required':!![],'message':_0xe6a8('0x21')},'timeout':{'type':'number','message':_0xe6a8('0x22')}});function startRouting(_0xd9cce0,_0x577e50,_0x17b336,_0x3f2543){if(_0xd9cce0&&_0x577e50&&_0x17b336){_0x577e50['waiting']+=0x1;var _0xc11cf6={'uniqueid':_0xd9cce0,'from':_0x17b336['body']?_0x17b336['body']['from']:'','joinAt':moment()[_0xe6a8('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17b336[_0xe6a8('0x23')]?_0x17b336[_0xe6a8('0x23')]['id']:null,'ListId':_0x17b336[_0xe6a8('0x24')]?_0x17b336[_0xe6a8('0x24')]['id']:null};_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x26')]=_0x577e50['id']||null;_0xc11cf6[_[_0xe6a8('0x27')](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x28')]=_0x17b336['interaction']?_0x17b336[_0xe6a8('0x29')]['id']:null;_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x2a')]=_0x17b336[_0xe6a8('0x2b')]?_0x17b336['message']['id']:null;_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+(_0x17b336[_0xe6a8('0x25')]!==_0xe6a8('0x2c')?_0xe6a8('0x2d'):_0xe6a8('0x2e'))]=_0x17b336[_0xe6a8('0xe')]?_0x17b336[_0xe6a8('0xe')]['id']:null;logger[_0xe6a8('0x2f')](util[_0xe6a8('0x13')](_0xe6a8('0x30'),_0xd9cce0,_0x577e50[_0xe6a8('0x31')]));emitChannelQueueInteraction(_0x17b336[_0xe6a8('0x25')],_0x577e50[_0xe6a8('0x31')],_0xc11cf6,_0x17b336[_0xe6a8('0xe')][_0xe6a8('0x31')],_0x17b336['message']['id'],!![],_0x3f2543,_0x577e50['id']);if(rpc[_0x17b336[_0xe6a8('0x25')]+_0xe6a8('0x32')]){return rpc[_0x17b336[_0xe6a8('0x25')]+_0xe6a8('0x32')]['create'](_0xc11cf6)[_0xe6a8('0x33')](function(_0x9933c9){logger[_0xe6a8('0x34')](_0xe6a8('0x35'),_0x9933c9);});}}}function stopRouting(_0x4f120f,_0xc974ce,_0x20c41f,_0x43a97f){if(_0x4f120f&&_0xc974ce){_0xc974ce['waiting']-=0x1;var _0x11d157={'leaveAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'acceptAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'reason':_0xe6a8('0x37')};logger[_0xe6a8('0x2f')](util['format'](_0xe6a8('0x38'),_0x4f120f,_0xc974ce['name']));emitChannelQueueInteraction(_0x20c41f['channel'],_0xc974ce[_0xe6a8('0x31')],_0x20c41f[_0xe6a8('0x39')],_0x20c41f['account'][_0xe6a8('0x31')],_0x20c41f[_0xe6a8('0x2b')]['id'],![],_0x43a97f,_0xc974ce['id']);return rpc[_0x20c41f['channel']+_0xe6a8('0x3a')][_0xe6a8('0x3b')](_0x20c41f[_0xe6a8('0x29')]['id'],{'queueId':_0xc974ce['id']})[_0xe6a8('0x3c')](function(){if(rpc[_0x20c41f['channel']+_0xe6a8('0x32')]){return rpc[_0x20c41f[_0xe6a8('0x25')]+_0xe6a8('0x32')][_0xe6a8('0x3b')](_0x4f120f,_0x11d157)[_0xe6a8('0x33')](function(_0x5cdcfc){logger[_0xe6a8('0x34')](_0xe6a8('0x3d'),_0x5cdcfc);});}});}}function endRouting(_0x67d010,_0x3efd12,_0x3680f9,_0xb51c00){if(_0x67d010&&_0x3efd12){_0x3efd12[_0xe6a8('0x3e')]-=0x1;var _0x168ef7={'leaveAt':moment()[_0xe6a8('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'reason':_0xe6a8('0x3f')};logger[_0xe6a8('0x2f')](util['format'](_0xe6a8('0x40'),_0x67d010,_0x3efd12['name']));emitChannelQueueInteraction(_0x3680f9[_0xe6a8('0x25')],_0x3efd12['name'],_0x3680f9[_0xe6a8('0x39')],_0x3680f9['account'][_0xe6a8('0x31')],_0x3680f9[_0xe6a8('0x2b')]['id'],![],_0xb51c00);if(rpc[_0x3680f9['channel']+'QueueReport']){return rpc[_0x3680f9[_0xe6a8('0x25')]+_0xe6a8('0x32')][_0xe6a8('0x3b')](_0x67d010,_0x168ef7)[_0xe6a8('0x33')](function(_0x50d23b){logger[_0xe6a8('0x34')](_0xe6a8('0x3d'),_0x50d23b);});}}}function handleFindQueue(_0x1fc963){return function(_0x57cfe3){return _0x57cfe3[_0xe6a8('0x31')][_0xe6a8('0x41')]()===_0x1fc963['toLowerCase']();};}exports[_0xe6a8('0x42')]=function(_0x411fb6,_0x33b17a,_0x5d9da0,_0x51394a){return function(_0x2cb42d){try{var _0x2ab960={'name':_0x33b17a[0x0],'timeout':_0x33b17a[0x1]};var _0x374775=queue[_0xe6a8('0x0')](_0x2ab960,{'typecast':!![]});if(_0x374775[_0xe6a8('0x43')]){logger[_0xe6a8('0x34')](_0xe6a8('0x44'),_0x411fb6,_['map'](_0x374775,_0xe6a8('0x2b'))[_0xe6a8('0x45')](',\x20'));_0x2cb42d[_0xe6a8('0x46')]();}else{var _0x5ee536=_[_0xe6a8('0x47')](_0x5d9da0[_0x51394a[_0xe6a8('0x25')]+_0xe6a8('0x48')],handleFindQueue(_0x2ab960[_0xe6a8('0x31')]));if(_0x5ee536){startRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);var _0x28b9dd=(_0x5ee536[_0xe6a8('0x3f')]||0xa)*0x3e8;var _0x23c5cc=(_0x2ab960[_0xe6a8('0x3f')]||0x14)*0x3e8;var _0x5973a4;if(_0x28b9dd>_0x23c5cc){_0x23c5cc=_0x28b9dd;}var _0x2d7387=seqqueue['createQueue'](_0x28b9dd);_0x2d7387['id']=_0x411fb6;_0x2d7387['atimeout']=_0x28b9dd;_0x2d7387['qtimeout']=_0x23c5cc;_0x2d7387[_0xe6a8('0x25')]=_0x51394a[_0xe6a8('0x25')];_0x5d9da0['rules'][_0x411fb6]['on']('end',function(){logger['info'](_0xe6a8('0x49'),_0x411fb6);stopRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);clearTimeout(_0x5973a4);_0x5973a4=undefined;_0x2d7387[_0xe6a8('0x4a')](!![]);if(_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]){delete _0x5d9da0[_0xe6a8('0x4b')][_0x411fb6];}_0x2cb42d[_0xe6a8('0x46')]();});_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]['on'](_0xe6a8('0x4c'),function(){if(_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]){delete _0x5d9da0['rules'][_0x411fb6];}});_0x5973a4=setTimeout(function(){logger[_0xe6a8('0x2f')](_0xe6a8('0x4d'),_0x411fb6);endRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);clearTimeout(_0x5973a4);_0x2d7387[_0xe6a8('0x4a')](!![]);_0x2cb42d[_0xe6a8('0x4e')]();},_0x23c5cc);switch(_0x5ee536['strategy']){case _0xe6a8('0x4f'):strategy['rrmemory'](_0x2d7387,_0x5ee536,_0x5d9da0,_0x51394a);break;default:strategy[_0xe6a8('0x50')](_0x2d7387,_0x5ee536,_0x5d9da0,_0x51394a);}}else{logger[_0xe6a8('0x34')](_0xe6a8('0x51'),_0x411fb6,_0x2ab960[_0xe6a8('0x31')]);_0x2cb42d[_0xe6a8('0x46')]();}}}catch(_0x1fd97e){logger['error'](_0xe6a8('0x44'),_0x411fb6,_0x1fd97e[_0xe6a8('0x52')]);_0x2cb42d[_0xe6a8('0x46')]();}};}; \ No newline at end of file +var _0x2741=['[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','clone','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../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','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','then','update','update\x20queue\x20report','timeout','catch','toLowerCase','consequence','length'];(function(_0x142c5d,_0x4b498c){var _0x76373b=function(_0x4905e7){while(--_0x4905e7){_0x142c5d['push'](_0x142c5d['shift']());}};_0x76373b(++_0x4b498c);}(_0x2741,0x1b8));var _0x1274=function(_0x2b193e,_0x8d000a){_0x2b193e=_0x2b193e-0x0;var _0x5e24e8=_0x2741[_0x2b193e];return _0x5e24e8;};'use strict';var schema=require(_0x1274('0x0'));var _=require(_0x1274('0x1'));var util=require('util');var seqqueue=require(_0x1274('0x2'));var moment=require(_0x1274('0x3'));var Redis=require(_0x1274('0x4'));var config=require(_0x1274('0x5'));var logger=require(_0x1274('0x6'))('routing');var strategy=require(_0x1274('0x7'));config[_0x1274('0x8')]=_['defaults'](config[_0x1274('0x8')],{'host':_0x1274('0x9'),'port':0x18eb});var io=require(_0x1274('0xa'))(new Redis(config['redis']));var attributes=['id',_0x1274('0xb'),_0x1274('0xc'),'queue',_0x1274('0xd'),_0x1274('0xe')];function emit(_0x525819,_0xfa5168,_0x319c76){io['to'](_0x525819)['emit'](_0xfa5168,_0x319c76);}function emitChannelQueueInteraction(_0x353cf9,_0x577738,_0x203e37,_0x524476,_0x22d12a,_0x5c7987,_0x15fec8,_0x1b4704){var _0x29b730=_[_0x1274('0xf')](_0x203e37);_0x29b730[_0x1274('0xb')]=_0x1b4704;_0x29b730['queue']=_0x577738;_0x29b730['account']=_0x524476;_0x29b730['id']=_0x22d12a;if(_0x5c7987){attributes['push'](_[_0x1274('0x10')](_0x353cf9)+_0x1274('0x11'));_0x15fec8[util[_0x1274('0x12')](_0x1274('0x13'),_0x353cf9)][_0x22d12a]=_[_0x1274('0x14')](_0x29b730,attributes);}else{delete _0x15fec8[util['format'](_0x1274('0x13'),_0x353cf9)][_0x22d12a];}emit(util[_0x1274('0x12')]('%s:queue:%s',_0x353cf9,_0x577738),util[_0x1274('0x12')](_0x1274('0x15'),_0x353cf9,_0x5c7987?_0x1274('0x16'):_0x1274('0x17')),_['pick'](_0x29b730,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1274('0x18')),'chatQueueReport':require(_0x1274('0x19')),'smsQueueReport':require(_0x1274('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x1274('0x1b')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x1274('0x1c')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x1274('0x1d'))};var queue=schema({'name':{'type':_0x1274('0x1e'),'required':!![],'message':_0x1274('0x1f')},'timeout':{'type':_0x1274('0x20'),'message':_0x1274('0x21')}});function startRouting(_0x23dcaa,_0x1129c8,_0x4da228,_0x18c6b6){if(_0x23dcaa&&_0x1129c8&&_0x4da228){_0x1129c8[_0x1274('0x22')]+=0x1;var _0x90eff1={'uniqueid':_0x23dcaa,'from':_0x4da228['body']?_0x4da228[_0x1274('0x23')]['from']:'','joinAt':moment()[_0x1274('0x12')](_0x1274('0x24')),'ContactId':_0x4da228['contact']?_0x4da228[_0x1274('0x25')]['id']:null,'ListId':_0x4da228[_0x1274('0x26')]?_0x4da228[_0x1274('0x26')]['id']:null};_0x90eff1[_[_0x1274('0x27')](_0x4da228[_0x1274('0x28')])+_0x1274('0x29')]=_0x1129c8['id']||null;_0x90eff1[_[_0x1274('0x27')](_0x4da228[_0x1274('0x28')])+_0x1274('0x11')]=_0x4da228[_0x1274('0x2a')]?_0x4da228[_0x1274('0x2a')]['id']:null;_0x90eff1[_[_0x1274('0x27')](_0x4da228['channel'])+_0x1274('0x2b')]=_0x4da228[_0x1274('0x2c')]?_0x4da228['message']['id']:null;_0x90eff1[_[_0x1274('0x27')](_0x4da228['channel'])+(_0x4da228[_0x1274('0x28')]!==_0x1274('0x2d')?_0x1274('0x2e'):_0x1274('0x2f'))]=_0x4da228[_0x1274('0xc')]?_0x4da228[_0x1274('0xc')]['id']:null;logger['info'](util[_0x1274('0x12')](_0x1274('0x30'),_0x23dcaa,_0x1129c8[_0x1274('0x31')]));emitChannelQueueInteraction(_0x4da228['channel'],_0x1129c8['name'],_0x90eff1,_0x4da228['account'][_0x1274('0x31')],_0x4da228['message']['id'],!![],_0x18c6b6,_0x1129c8['id']);if(rpc[_0x4da228[_0x1274('0x28')]+_0x1274('0x32')]){return rpc[_0x4da228[_0x1274('0x28')]+_0x1274('0x32')][_0x1274('0x33')](_0x90eff1)['catch'](function(_0x530b9b){logger[_0x1274('0x34')]('create\x20queue\x20report',_0x530b9b);});}}}function stopRouting(_0xce1aa7,_0x53b1b1,_0x1eee1a,_0x4ce5ee){if(_0xce1aa7&&_0x53b1b1){_0x53b1b1[_0x1274('0x22')]-=0x1;var _0x2eee5f={'leaveAt':moment()['format'](_0x1274('0x24')),'acceptAt':moment()[_0x1274('0x12')](_0x1274('0x24')),'reason':_0x1274('0x35')};logger[_0x1274('0x36')](util['format'](_0x1274('0x37'),_0xce1aa7,_0x53b1b1[_0x1274('0x31')]));emitChannelQueueInteraction(_0x1eee1a[_0x1274('0x28')],_0x53b1b1['name'],_0x1eee1a[_0x1274('0x23')],_0x1eee1a[_0x1274('0xc')]['name'],_0x1eee1a[_0x1274('0x2c')]['id'],![],_0x4ce5ee,_0x53b1b1['id']);return rpc[_0x1eee1a['channel']+'Interaction']['update'](_0x1eee1a[_0x1274('0x2a')]['id'],{'queueId':_0x53b1b1['id']})[_0x1274('0x38')](function(){if(rpc[_0x1eee1a['channel']+_0x1274('0x32')]){return rpc[_0x1eee1a['channel']+_0x1274('0x32')][_0x1274('0x39')](_0xce1aa7,_0x2eee5f)['catch'](function(_0xb54ba1){logger['error'](_0x1274('0x3a'),_0xb54ba1);});}});}}function endRouting(_0x3573e5,_0x45b9e6,_0x16f12a,_0x2a37c8){if(_0x3573e5&&_0x45b9e6){_0x45b9e6[_0x1274('0x22')]-=0x1;var _0x197c83={'leaveAt':moment()[_0x1274('0x12')](_0x1274('0x24')),'exitAt':moment()['format'](_0x1274('0x24')),'reason':_0x1274('0x3b')};logger[_0x1274('0x36')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x3573e5,_0x45b9e6['name']));emitChannelQueueInteraction(_0x16f12a[_0x1274('0x28')],_0x45b9e6['name'],_0x16f12a[_0x1274('0x23')],_0x16f12a[_0x1274('0xc')]['name'],_0x16f12a[_0x1274('0x2c')]['id'],![],_0x2a37c8);if(rpc[_0x16f12a[_0x1274('0x28')]+_0x1274('0x32')]){return rpc[_0x16f12a[_0x1274('0x28')]+_0x1274('0x32')][_0x1274('0x39')](_0x3573e5,_0x197c83)[_0x1274('0x3c')](function(_0x201495){logger[_0x1274('0x34')](_0x1274('0x3a'),_0x201495);});}}}function handleFindQueue(_0x1a85d3){return function(_0x4a7699){return _0x4a7699[_0x1274('0x31')]['toLowerCase']()===_0x1a85d3[_0x1274('0x3d')]();};}exports[_0x1274('0x3e')]=function(_0x467570,_0x367d17,_0x3648c1,_0x3b57c4){return function(_0x2d872f){try{var _0x5d97b8={'name':_0x367d17[0x0],'timeout':_0x367d17[0x1]};var _0x35885f=queue[_0x1274('0x0')](_0x5d97b8,{'typecast':!![]});if(_0x35885f[_0x1274('0x3f')]){logger[_0x1274('0x34')](_0x1274('0x40'),_0x467570,_[_0x1274('0x41')](_0x35885f,_0x1274('0x2c'))[_0x1274('0x42')](',\x20'));_0x2d872f[_0x1274('0x43')]();}else{var _0x3ec0e1=_[_0x1274('0x44')](_0x3648c1[_0x3b57c4['channel']+_0x1274('0x45')],handleFindQueue(_0x5d97b8[_0x1274('0x31')]));if(_0x3ec0e1){startRouting(_0x467570,_0x3ec0e1,_0x3b57c4,_0x3648c1);var _0x2ed96c=(_0x3ec0e1[_0x1274('0x3b')]||0xa)*0x3e8;var _0x3ca826=(_0x5d97b8['timeout']||0x14)*0x3e8;var _0xcd0faf;if(_0x2ed96c>_0x3ca826){_0x3ca826=_0x2ed96c;}var _0x3c0851=seqqueue[_0x1274('0x46')](_0x2ed96c);_0x3c0851['id']=_0x467570;_0x3c0851[_0x1274('0x47')]=_0x2ed96c;_0x3c0851[_0x1274('0x48')]=_0x3ca826;_0x3c0851[_0x1274('0x28')]=_0x3b57c4['channel'];_0x3648c1['rules'][_0x467570]['on'](_0x1274('0x49'),function(){logger[_0x1274('0x36')](_0x1274('0x4a'),_0x467570);stopRouting(_0x467570,_0x3ec0e1,_0x3b57c4,_0x3648c1);clearTimeout(_0xcd0faf);_0xcd0faf=undefined;_0x3c0851['close'](!![]);if(_0x3648c1[_0x1274('0x4b')][_0x467570]){delete _0x3648c1['rules'][_0x467570];}_0x2d872f[_0x1274('0x43')]();});_0x3648c1[_0x1274('0x4b')][_0x467570]['on'](_0x1274('0x4c'),function(){if(_0x3648c1[_0x1274('0x4b')][_0x467570]){delete _0x3648c1['rules'][_0x467570];}});_0xcd0faf=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x467570);endRouting(_0x467570,_0x3ec0e1,_0x3b57c4,_0x3648c1);clearTimeout(_0xcd0faf);_0x3c0851[_0x1274('0x4d')](!![]);_0x2d872f[_0x1274('0x4e')]();},_0x3ca826);switch(_0x3ec0e1[_0x1274('0x4f')]){case _0x1274('0x50'):strategy[_0x1274('0x50')](_0x3c0851,_0x3ec0e1,_0x3648c1,_0x3b57c4);break;default:strategy[_0x1274('0x51')](_0x3c0851,_0x3ec0e1,_0x3648c1,_0x3b57c4);}}else{logger[_0x1274('0x34')](_0x1274('0x52'),_0x467570,_0x5d97b8[_0x1274('0x31')]);_0x2d872f[_0x1274('0x43')]();}}}catch(_0x233968){logger[_0x1274('0x34')](_0x1274('0x40'),_0x467570,_0x233968[_0x1274('0x53')]);_0x2d872f[_0x1274('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index d7ede30..4ff730a 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 _0x34e8=['busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x34e8,0x12c));var _0x834e=function(_0x54c386,_0x311a75){_0x54c386=_0x54c386-0x0;var _0x239be2=_0x34e8[_0x54c386];return _0x239be2;};'use strict';var _=require(_0x834e('0x0'));var uuid=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var logger=require(_0x834e('0x3'))('routing');var Agent=function(_0x832422,_0x21e2e0,_0x472111,_0x31bf20){this[_0x834e('0x4')]=uuid['v4']();this[_0x834e('0x5')]=_0x832422;this[_0x834e('0x6')]=_0x21e2e0;this['realtime']=_0x472111;this[_0x834e('0x7')]=_0x31bf20;this['squeue'][_0x834e('0x8')](this[_0x834e('0x9')][_0x834e('0xa')](this),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xc'),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xd'),this[_0x834e('0xe')][_0x834e('0xa')](this));};Agent[_0x834e('0xf')][_0x834e('0x8')]=function(){this[_0x834e('0x5')][_0x834e('0x8')](this['handleRun'][_0x834e('0xa')](this),this[_0x834e('0xb')]['bind'](this));};Agent[_0x834e('0xf')][_0x834e('0xe')]=function(){this[_0x834e('0xb')](!![]);};Agent[_0x834e('0xf')]['handleRun']=function(){logger[_0x834e('0x10')](_0x834e('0x11'),this['squeue']['id'],this[_0x834e('0x6')]['id']);if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']])){logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x834e('0x8')][_0x834e('0xa')](this),0x3e8);}else{if(this[_0x834e('0x7')][_0x834e('0x15')]||util[_0x834e('0x16')](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']],this[_0x834e('0x5')][_0x834e('0x17')],![])){this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=!![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue'][_0x834e('0x17')]);util[_0x834e('0x1a')](this['notificationId'],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']],null,this[_0x834e('0x7')]);util[_0x834e('0x1b')](this['squeue']['id'],this['realtime'][_0x834e('0x13')][this['agent']['id']],_0x834e('0x1c')+(this[_0x834e('0x7')][_0x834e('0x15')]?_0x834e('0x1d'):''));}else{logger[_0x834e('0x10')](_0x834e('0x1e'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x834e('0xf')][_0x834e('0xb')]=function(_0x106d6a){if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']])){return logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this[_0x834e('0x6')]['id']);}else{logger[_0x834e('0x10')](_0x834e('0x1f'),this['squeue']['id'],this[_0x834e('0x6')]['id']);util['hideNotification'](this[_0x834e('0x4')],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],null,this[_0x834e('0x7')]);this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util[_0x834e('0x20')](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue']['channel']);util['writeLog'](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],_0x106d6a?_0x834e('0x21'):_0x834e('0x22'));}if(!_0x106d6a){setTimeout(this['push'][_0x834e('0xa')](this),0x3e8);}};function agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed){return new Agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed);}module[_0x834e('0x23')]=agent; \ No newline at end of file +var _0x8d0e=['handleTimeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','busy','busyQueue','saveWaitingNotification','channel','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','push','handleRun','bind'];(function(_0x134fde,_0x2f3ce2){var _0x523b4d=function(_0xb55f1f){while(--_0xb55f1f){_0x134fde['push'](_0x134fde['shift']());}};_0x523b4d(++_0x2f3ce2);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x483807,_0x11861b){_0x483807=_0x483807-0x0;var _0x1f678a=_0x8d0e[_0x483807];return _0x1f678a;};'use strict';var _=require(_0xe8d0('0x0'));var uuid=require(_0xe8d0('0x1'));var util=require(_0xe8d0('0x2'));var logger=require(_0xe8d0('0x3'))(_0xe8d0('0x4'));var Agent=function(_0x3584ab,_0x15521e,_0x940176,_0x32cee9){this['notificationId']=uuid['v4']();this[_0xe8d0('0x5')]=_0x3584ab;this['agent']=_0x15521e;this['realtime']=_0x940176;this[_0xe8d0('0x4')]=_0x32cee9;this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')][_0xe8d0('0x8')](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('timeout',this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('drained',this['handleDrained'][_0xe8d0('0x8')](this));};Agent[_0xe8d0('0xa')][_0xe8d0('0x6')]=function(){this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')]['bind'](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));};Agent['prototype'][_0xe8d0('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xe8d0('0x7')]=function(){logger[_0xe8d0('0xc')](_0xe8d0('0xd'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);if(_[_0xe8d0('0xf')](this['realtime'][_0xe8d0('0x10')][this['agent']['id']])){logger[_0xe8d0('0xc')](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xe8d0('0x4')][_0xe8d0('0x12')]||util[_0xe8d0('0x13')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],this[_0xe8d0('0x5')]['channel'],![])){this['realtime']['agents'][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x15')]=!![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x16')]=undefined;util[_0xe8d0('0x17')](this[_0xe8d0('0x14')],this[_0xe8d0('0x4')],this['agent'],this[_0xe8d0('0x5')][_0xe8d0('0x18')]);util['showNotification'](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],null,this[_0xe8d0('0x4')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],'RINGING'+(this[_0xe8d0('0x4')][_0xe8d0('0x12')]?_0xe8d0('0x1b'):''));}else{logger['debug'](_0xe8d0('0x1c'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xe8d0('0x6')][_0xe8d0('0x8')](this),0x3e8);}}};Agent[_0xe8d0('0xa')][_0xe8d0('0x9')]=function(_0x3cf3d6){if(_['isNil'](this[_0xe8d0('0x14')]['agents'][this['agent']['id']])){return logger['debug'](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe8d0('0x5')]['id'],this['agent']['id']);util[_0xe8d0('0x1d')](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']],null,this[_0xe8d0('0x4')]);this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']]['busy']=![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']][_0xe8d0('0x16')]=undefined;util['removeWaitingNotification'](this[_0xe8d0('0x14')],this['routing'],this[_0xe8d0('0xe')],this['squeue'][_0xe8d0('0x18')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],_0x3cf3d6?_0xe8d0('0x1e'):_0xe8d0('0x1f'));}if(!_0x3cf3d6){setTimeout(this['push'][_0xe8d0('0x8')](this),0x3e8);}};function agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41){return new Agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index fda6522..084b921 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 _0xf56d=['channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','queue','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue'];(function(_0x3b856f,_0x3fcc70){var _0x5c6b5e=function(_0x19279d){while(--_0x19279d){_0x3b856f['push'](_0x3b856f['shift']());}};_0x5c6b5e(++_0x3fcc70);}(_0xf56d,0x10e));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf56('0x0'));var uuid=require(_0xdf56('0x1'));var util=require('./util');var logger=require(_0xdf56('0x2'))(_0xdf56('0x3'));var Beepall=function(_0x37cafa,_0x345829,_0x48f4b5,_0x349ffe){this[_0xdf56('0x4')]=uuid['v4']();this[_0xdf56('0x5')]=_0x37cafa;this['queue']=_0x345829;this['realtime']=_0x48f4b5;this[_0xdf56('0x3')]=_0x349ffe;this[_0xdf56('0x5')][_0xdf56('0x6')](this['handleRun'][_0xdf56('0x7')](this),this['handleTimeout'][_0xdf56('0x7')](this));this[_0xdf56('0x5')]['on'](_0xdf56('0x8'),this[_0xdf56('0x9')][_0xdf56('0x7')](this));this[_0xdf56('0x5')]['on'](_0xdf56('0xa'),this[_0xdf56('0xb')]['bind'](this));};Beepall[_0xdf56('0xc')]['push']=function(){this[_0xdf56('0x5')]['push'](this[_0xdf56('0xd')][_0xdf56('0x7')](this),this[_0xdf56('0x9')][_0xdf56('0x7')](this));};Beepall['prototype'][_0xdf56('0xb')]=function(){this['handleTimeout'](!![]);};Beepall[_0xdf56('0xc')][_0xdf56('0xd')]=function(){var _0x5bfbb1=!![];if(!_[_0xdf56('0xe')](this[_0xdf56('0xf')])&&!_[_0xdf56('0xe')](this[_0xdf56('0xf')][_0xdf56('0x10')])&&this[_0xdf56('0xf')]['Agents'][_0xdf56('0x11')]>0x0){for(var _0x25ad85=0x0,_0x363fbe;_0x25ad850x0){for(var _0xb3c899=0x0,_0x32a76a;_0xb3c8990x0&&_0xe73329[_0xcb7621+_0x8b13('0x26')]>=_0xe73329[_0xcb7621+_0x8b13('0x25')]){writeLog(_0x51dd1d,_0xe73329,_0xcb7621['toUpperCase']()+_0x8b13('0x27'));return![];}}return!![];};exports[_0x8b13('0x28')]=function(_0x4f8e58,_0x134c5e,_0x14a739,_0x410122,_0x4048e4){return sendNotification(!![],_0x4f8e58,_0x134c5e,_0x14a739,_0x410122,_0x4048e4);};exports[_0x8b13('0x29')]=function(_0x54cdfc,_0x6023f5,_0x1b09e2,_0x3475d8,_0x1511bf){return sendNotification(![],_0x54cdfc,_0x6023f5,_0x1b09e2,_0x3475d8,_0x1511bf);};exports[_0x8b13('0x2a')]=function(_0x2bb51d,_0x5ab161,_0x35fdca){var _0xfec033=_0x5ab161[_0x8b13('0x2b')][_0x8b13('0x2c')];if(!_0xfec033&&_0x35fdca){_0xfec033=_0x35fdca['id'];}var _0x23fde7=_[_0x8b13('0x2d')](_0x2bb51d[_0x5ab161[_0x8b13('0x2e')]+_0x8b13('0x2f')],function(_0x36f732){var _0x5751db=_[_0x8b13('0x30')](_0x5ab161[_0x8b13('0x2e')])+_0x8b13('0x31');return _0x36f732[_0x5751db]===_0x5ab161[_0x8b13('0x2b')]['id'];});if(!_0x23fde7&&_0xfec033&&_0x2bb51d['agents'][_0xfec033]){_0x23fde7=_['some'](_0x2bb51d[_0x8b13('0x32')][_0xfec033][_0x5ab161['channel']+'WaitingInteractions'],function(_0x3b1dfa){return _0x3b1dfa['id']===_0x5ab161['interaction']['id'];});}return _0x23fde7;};exports[_0x8b13('0x33')]=function(_0x408626,_0x40fc29,_0x39a3d2,_0x11657e){if(_0x39a3d2&&_0x39a3d2['id']&&_0x408626[_0x8b13('0x32')]&&_0x408626[_0x8b13('0x32')][_0x39a3d2['id']]){_0x408626[_0x8b13('0x32')][_0x39a3d2['id']][_0x11657e+_0x8b13('0x34')][_0x40fc29[_0x8b13('0x1a')]['id']]={'id':_0x40fc29['interaction']['id']};}};exports[_0x8b13('0x35')]=function(_0x31f5bd,_0x19b21c,_0x4141db,_0x1ff25c){if(_0x4141db&&_0x4141db['id']&&_0x31f5bd[_0x8b13('0x32')]&&_0x31f5bd[_0x8b13('0x32')][_0x4141db['id']]){delete _0x31f5bd[_0x8b13('0x32')][_0x4141db['id']][_0x1ff25c+'WaitingInteractions'][_0x19b21c[_0x8b13('0x1a')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xe7de=['error','format','[%s][QUEUE]\x20%s','message','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate'];(function(_0x40282c,_0x554f5b){var _0x5a77be=function(_0x29ecfa){while(--_0x29ecfa){_0x40282c['push'](_0x40282c['shift']());}};_0x5a77be(++_0x554f5b);}(_0xe7de,0x165));var _0xee7d=function(_0x4a6086,_0x2bbce6){_0x4a6086=_0x4a6086-0x0;var _0x445467=_0xe7de[_0x4a6086];return _0x445467;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var utils=require(_0xee7d('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0xee7d('0x3'))(_0xee7d('0x4'));config[_0xee7d('0x5')]=_[_0xee7d('0x6')](config[_0xee7d('0x5')],{'host':_0xee7d('0x7'),'port':0x18eb});var io=require(_0xee7d('0x8'))(new Redis(config[_0xee7d('0x5')]));function sendNotification(_0x401cd0,_0x28d5b6,_0xe926ab,_0x2e172d,_0x1c0584,_0x941d94){io['to'](util['format'](_0xee7d('0x9'),_0x2e172d[_0xee7d('0xa')]))[_0xee7d('0xb')](_0xee7d('0xc'),_0x2e172d);var _0x146172=_0x941d94||{};var _0x36e00f=_0xe926ab['split']('.');var _0x201ad4={'uniqueid':_0x28d5b6,'channel':_0x36e00f[0x0],'id':_0x36e00f[0x1],'title':_0x36e00f[0x0]+'\x20interaction','interactionId':_0x36e00f[0x2],'queue':_0x1c0584?_0x1c0584[_0xee7d('0xa')]:null,'sound':_0x146172[_0xee7d('0xd')][_0xee7d('0xe')],'shake':_0x146172[_0xee7d('0xd')][_0xee7d('0xf')]};try{if(!_0x146172[_0xee7d('0x10')]){_0x146172[_0xee7d('0x10')]={};}if(_0x1c0584){_0x146172[_0xee7d('0x10')][_0xee7d('0x11')]=_0x1c0584;}else if(_0x146172[_0xee7d('0x10')][_0xee7d('0x11')]){delete _0x146172['body']['queue'];}_0x201ad4[_0xee7d('0x12')]=utils[_0xee7d('0x13')](_0x146172[_0xee7d('0xd')][_0xee7d('0x14')],_0x146172);}catch(_0x1a2976){_0x201ad4[_0xee7d('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xee7d('0x15')](util[_0xee7d('0x16')](_0xee7d('0x17'),_0x28d5b6,_0x1a2976[_0xee7d('0x18')]));}io['to'](util[_0xee7d('0x16')](_0xee7d('0x9'),_0x2e172d['name']))[_0xee7d('0xb')](util[_0xee7d('0x16')](_0xee7d('0x19'),_0x401cd0?'save':_0xee7d('0x1a')),_0x201ad4);}function writeLog(_0x47fa16,_0x1ef8ea,_0x34209e){return logger[_0xee7d('0x1b')](util['format'](_0xee7d('0x1c'),_0x47fa16,_0x1ef8ea['name'],_0x34209e));}exports[_0xee7d('0x1d')]=function(_0x2d5dd6,_0x269835,_0xed4f9f,_0x52eaf4){if(_0x269835[_0xee7d('0x1e')]){writeLog(_0x2d5dd6,_0x269835,_0xee7d('0x1f'));return![];}if(!_0x269835[_0xee7d('0x20')]){writeLog(_0x2d5dd6,_0x269835,_0xee7d('0x21'));return![];}if(_0x269835[_0xed4f9f+_0xee7d('0x22')]){writeLog(_0x2d5dd6,_0x269835,_0xee7d('0x23'));return![];}if(_0x52eaf4&&_0x269835[_0xee7d('0x24')](_0xed4f9f+_0xee7d('0x25'))&&_0x269835[_0xee7d('0x24')](_0xed4f9f+'CurrentCapacity')){if(_0x269835[_0xed4f9f+_0xee7d('0x25')]>0x0&&_0x269835[_0xed4f9f+_0xee7d('0x26')]>=_0x269835[_0xed4f9f+_0xee7d('0x25')]){writeLog(_0x2d5dd6,_0x269835,_0xed4f9f['toUpperCase']()+_0xee7d('0x27'));return![];}}return!![];};exports[_0xee7d('0x28')]=function(_0x4532cb,_0x2b9482,_0x2e2264,_0x1b4492,_0xb727c9){return sendNotification(!![],_0x4532cb,_0x2b9482,_0x2e2264,_0x1b4492,_0xb727c9);};exports[_0xee7d('0x29')]=function(_0x3dda5b,_0x589fc0,_0x440bc4,_0x4e1bf5,_0x5ca947){return sendNotification(![],_0x3dda5b,_0x589fc0,_0x440bc4,_0x4e1bf5,_0x5ca947);};exports[_0xee7d('0x2a')]=function(_0x4d4ff0,_0x151094,_0xc2e2c1){var _0x4b7786=_0x151094[_0xee7d('0x2b')][_0xee7d('0x2c')];if(!_0x4b7786&&_0xc2e2c1){_0x4b7786=_0xc2e2c1['id'];}var _0xac47ec=_[_0xee7d('0x2d')](_0x4d4ff0[_0x151094[_0xee7d('0x2e')]+'QueuesWaitingInteractions'],function(_0x382630){var _0x303e1c=_[_0xee7d('0x2f')](_0x151094[_0xee7d('0x2e')])+_0xee7d('0x30');return _0x382630[_0x303e1c]===_0x151094[_0xee7d('0x2b')]['id'];});if(!_0xac47ec&&_0x4b7786&&_0x4d4ff0[_0xee7d('0x31')][_0x4b7786]){_0xac47ec=_[_0xee7d('0x2d')](_0x4d4ff0['agents'][_0x4b7786][_0x151094[_0xee7d('0x2e')]+_0xee7d('0x32')],function(_0xccf52c){return _0xccf52c['id']===_0x151094['interaction']['id'];});}return _0xac47ec;};exports[_0xee7d('0x33')]=function(_0x571cf4,_0x3cf5fb,_0x41fc59,_0x5d04ac){if(_0x41fc59&&_0x41fc59['id']&&_0x571cf4['agents']&&_0x571cf4[_0xee7d('0x31')][_0x41fc59['id']]){_0x571cf4['agents'][_0x41fc59['id']][_0x5d04ac+_0xee7d('0x32')][_0x3cf5fb[_0xee7d('0x18')]['id']]={'id':_0x3cf5fb[_0xee7d('0x2b')]['id']};}};exports[_0xee7d('0x34')]=function(_0x140e4a,_0x53de17,_0x57f0c2,_0x389c08){if(_0x57f0c2&&_0x57f0c2['id']&&_0x140e4a['agents']&&_0x140e4a[_0xee7d('0x31')][_0x57f0c2['id']]){delete _0x140e4a[_0xee7d('0x31')][_0x57f0c2['id']][_0x389c08+_0xee7d('0x32')][_0x53de17[_0xee7d('0x18')]['id']];}};exports[_0xee7d('0x35')]=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 e5e31af..e5c976d 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 _0x4fdb=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x25c227,_0x43301a){_0x25c227=_0x25c227-0x0;var _0x4c813c=_0x4fdb[_0x25c227];return _0x4c813c;};'use strict';var schema=require(_0xb4fd('0x0'));var sh=require(_0xb4fd('0x1'));var _=require(_0xb4fd('0x2'));var utils=require(_0xb4fd('0x3'));var logger=require(_0xb4fd('0x4'))(_0xb4fd('0x5'));var system=schema({'command':{'type':_0xb4fd('0x6'),'required':!![],'message':_0xb4fd('0x7')}});exports[_0xb4fd('0x8')]=function(_0x5b73bb,_0x308de6){return function(_0x5c07c5){try{var _0x14052b={'command':_0x308de6[0x0]};var _0x5d8b39=system['validate'](_0x14052b,{'typecast':!![]});if(_0x5d8b39[_0xb4fd('0x9')]){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_['map'](_0x5d8b39,'message')[_0xb4fd('0xc')](',\x20'));logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5['next']();}else{var _0x1e1e16=this;var _0x17ac4b=utils[_0xb4fd('0xf')](_0x308de6[0x0],this);logger[_0xb4fd('0xd')](_0xb4fd('0x10'),_0x5b73bb,_0x17ac4b);sh['exec'](_[_0xb4fd('0x11')](_0x17ac4b),function(_0x1f3e30,_0x2e8ee1){logger[_0xb4fd('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b73bb,_0x1f3e30);if(_0x1f3e30==0x0){var _0x38173d=_0x2e8ee1[_0xb4fd('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb4fd('0x13')](_0x308de6[0x1])||_['isEmpty'](_0x308de6[0x1])){logger[_0xb4fd('0xd')](_0xb4fd('0x14'),_0x5b73bb);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}else{logger[_0xb4fd('0xd')](_0xb4fd('0x16'),_0x5b73bb,_0x308de6[0x1],_0x38173d);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}}_0x5c07c5[_0xb4fd('0x17')]();});}}catch(_0x47e288){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_[_0xb4fd('0x18')](_0x47e288)?JSON[_0xb4fd('0x19')](_0x47e288):_0x47e288);logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5[_0xb4fd('0x17')]();}};}; \ No newline at end of file +var _0xd59a=['[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x2b4d02,_0x54d4f9){var _0x19a9c2=function(_0x8c4ea6){while(--_0x8c4ea6){_0x2b4d02['push'](_0x2b4d02['shift']());}};_0x19a9c2(++_0x54d4f9);}(_0xd59a,0x17d));var _0xad59=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd59a[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0xad59('0x0'));var sh=require(_0xad59('0x1'));var _=require(_0xad59('0x2'));var utils=require(_0xad59('0x3'));var logger=require('../../../../config/logger')(_0xad59('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xad59('0x5')}});exports[_0xad59('0x6')]=function(_0x58073b,_0x4f8174){return function(_0x23bcaf){try{var _0x3cf16f={'command':_0x4f8174[0x0]};var _0x50f1bf=system[_0xad59('0x0')](_0x3cf16f,{'typecast':!![]});if(_0x50f1bf[_0xad59('0x7')]){logger[_0xad59('0x8')](_0xad59('0x9'),_0x58073b,_['map'](_0x50f1bf,'message')[_0xad59('0xa')](',\x20'));logger[_0xad59('0xb')](_0xad59('0xc'),_0x58073b);_0x23bcaf[_0xad59('0xd')]();}else{var _0x49155a=this;var _0x22d8d2=utils[_0xad59('0xe')](_0x4f8174[0x0],this);logger[_0xad59('0xb')](_0xad59('0xf'),_0x58073b,_0x22d8d2);sh[_0xad59('0x10')](_[_0xad59('0x11')](_0x22d8d2),function(_0x4dcea5,_0x1c78a5){logger[_0xad59('0xb')](_0xad59('0x12'),_0x58073b,_0x4dcea5);if(_0x4dcea5==0x0){var _0x258f73=_0x1c78a5[_0xad59('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xad59('0x14')](_0x4f8174[0x1])||_['isEmpty'](_0x4f8174[0x1])){logger[_0xad59('0xb')](_0xad59('0x15'),_0x58073b);_0x49155a['body'][_0x4f8174[0x1]]=_0x258f73;}else{logger[_0xad59('0xb')](_0xad59('0x16'),_0x58073b,_0x4f8174[0x1],_0x258f73);_0x49155a[_0xad59('0x17')][_0x4f8174[0x1]]=_0x258f73;}}_0x23bcaf[_0xad59('0xd')]();});}}catch(_0x340aad){logger[_0xad59('0x8')]('[%s][SYSTEM]\x20%s',_0x58073b,_[_0xad59('0x18')](_0x340aad)?JSON[_0xad59('0x19')](_0x340aad):_0x340aad);logger[_0xad59('0xb')](_0xad59('0xc'),_0x58073b);_0x23bcaf[_0xad59('0xd')]();}};}; \ 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 30b6b66..5a71fd1 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 _0x2f38=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','join','next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','finally','isObject'];(function(_0x22a341,_0x18d485){var _0x92ab4d=function(_0x1790c2){while(--_0x1790c2){_0x22a341['push'](_0x22a341['shift']());}};_0x92ab4d(++_0x18d485);}(_0x2f38,0x153));var _0x82f3=function(_0x583f66,_0x196e7d){_0x583f66=_0x583f66-0x0;var _0x547eb3=_0x2f38[_0x583f66];return _0x547eb3;};'use strict';var schema=require(_0x82f3('0x0'));var _=require(_0x82f3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x82f3('0x2')),'faxInteraction':require(_0x82f3('0x3')),'whatsappInteraction':require(_0x82f3('0x4'))};var logger=require(_0x82f3('0x5'))(_0x82f3('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x82f3('0x7')}});exports[_0x82f3('0x8')]=function(_0x211440,_0x14ab06,_0x10c564,_0x21741a){return function(_0x127350){try{var _0x327ef2={'tag':_0x14ab06[0x0]};var _0x3597c3=tag['validate'](_0x327ef2,{'typecast':!![]});if(_0x3597c3[_0x82f3('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x211440,_[_0x82f3('0xa')](_0x3597c3,'message')[_0x82f3('0xb')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x211440);_0x127350[_0x82f3('0xc')]();}else{var _0x33716b={'ids':[_0x14ab06[0x0]]};if(rpc[_0x21741a[_0x82f3('0xd')]+_0x82f3('0xe')]){rpc[_0x21741a[_0x82f3('0xd')]+_0x82f3('0xe')][_0x82f3('0xf')](_0x21741a[_0x82f3('0x10')]['id'],_0x33716b)['then'](function(_0x214214){logger[_0x82f3('0x11')](_0x82f3('0x12'),_0x211440,_0x14ab06[0x1],_0x21741a[_0x82f3('0xd')],_0x21741a['interaction']['id']);})[_0x82f3('0x13')](function(_0x218587){logger[_0x82f3('0x14')](_0x82f3('0x15'),_0x211440,JSON[_0x82f3('0x16')](_0x218587));logger[_0x82f3('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x211440);})[_0x82f3('0x17')](function(){_0x127350[_0x82f3('0xc')]();});}}}catch(_0x309f60){logger[_0x82f3('0x14')]('[%s][TAG]\x20%s',_0x211440,_[_0x82f3('0x18')](_0x309f60)?JSON[_0x82f3('0x16')](_0x309f60):_0x309f60);logger[_0x82f3('0x11')](_0x82f3('0x19'),_0x211440);_0x127350['next']();}};}; \ No newline at end of file +var _0xbcae=['then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction'];(function(_0x532144,_0x1e15f3){var _0x57f65d=function(_0x3c0753){while(--_0x3c0753){_0x532144['push'](_0x532144['shift']());}};_0x57f65d(++_0x1e15f3);}(_0xbcae,0x11c));var _0xebca=function(_0x48c152,_0x2f3746){_0x48c152=_0x48c152-0x0;var _0x4f4012=_0xbcae[_0x48c152];return _0x4f4012;};'use strict';var schema=require(_0xebca('0x0'));var _=require(_0xebca('0x1'));var rpc={'chatInteraction':require(_0xebca('0x2')),'openchannelInteraction':require(_0xebca('0x3')),'smsInteraction':require(_0xebca('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xebca('0x5'))};var logger=require(_0xebca('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xebca('0x7')}});exports[_0xebca('0x8')]=function(_0xf577f4,_0x265b82,_0x1b4bef,_0x5e0c60){return function(_0xcc87ed){try{var _0x29bcb3={'tag':_0x265b82[0x0]};var _0x2bc5f1=tag[_0xebca('0x0')](_0x29bcb3,{'typecast':!![]});if(_0x2bc5f1['length']){logger['error'](_0xebca('0x9'),_0xf577f4,_['map'](_0x2bc5f1,'message')[_0xebca('0xa')](',\x20'));logger['info'](_0xebca('0xb'),_0xf577f4);_0xcc87ed['next']();}else{var _0x2b2c8c={'ids':[_0x265b82[0x0]]};if(rpc[_0x5e0c60[_0xebca('0xc')]+_0xebca('0xd')]){rpc[_0x5e0c60[_0xebca('0xc')]+_0xebca('0xd')][_0xebca('0xe')](_0x5e0c60[_0xebca('0xf')]['id'],_0x2b2c8c)[_0xebca('0x10')](function(_0x52513e){logger[_0xebca('0x11')](_0xebca('0x12'),_0xf577f4,_0x265b82[0x1],_0x5e0c60['channel'],_0x5e0c60[_0xebca('0xf')]['id']);})[_0xebca('0x13')](function(_0x5ee6d8){logger[_0xebca('0x14')](_0xebca('0x9'),_0xf577f4,JSON[_0xebca('0x15')](_0x5ee6d8));logger[_0xebca('0x11')](_0xebca('0xb'),_0xf577f4);})[_0xebca('0x16')](function(){_0xcc87ed[_0xebca('0x17')]();});}}}catch(_0x2929ba){logger[_0xebca('0x14')](_0xebca('0x9'),_0xf577f4,_[_0xebca('0x18')](_0x2929ba)?JSON[_0xebca('0x15')](_0x2929ba):_0x2929ba);logger[_0xebca('0x11')](_0xebca('0xb'),_0xf577f4);_0xcc87ed[_0xebca('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 80c5cd2..b2f587b 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 _0x73d2=['jsonrpc','2.0','login','push','stringify','utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','urlOnAnswer','?params=','title'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73d2,0x16a));var _0x273d=function(_0xb6245,_0x55bdbc){_0xb6245=_0xb6245-0x0;var _0x5c1f1d=_0x73d2[_0xb6245];return _0x5c1f1d;};'use strict';var rp=require(_0x273d('0x0'));var logger=require(_0x273d('0x1'))(_0x273d('0x2'));var _=require(_0x273d('0x3'));var arr=[];exports[_0x273d('0x4')]=function(_0x2d726b,_0x5cfd39){return function(_0x31741a){var _0x463fd0=_0x5cfd39[0xa];var _0x358dc=_0x5cfd39[0xb];var _0x3c0e6c=_0x5cfd39[0xc];var _0x3e2b74=_0x5cfd39[0xd];var _0x51a700=_0x5cfd39[0xe];var _0xc39831=_0x5cfd39[0xf][_0x273d('0x5')](/\n/g,'\x20-\x20');var _0x34eaa9=_0x5cfd39[0x10][_0x273d('0x5')](/\n/g,'\x20');if(!arr[_0x273d('0x6')](_0x358dc)){arr['push'](_0x358dc);var _0x4788ef=_0x5cfd39[0x3];var _0x5b2c80=_0x5cfd39[0x4];var _0xfed993=_0x5cfd39[0x1];var _0x587c6a=_0x5cfd39[0x0];var _0x20ee6c={};_0x20ee6c[_0x273d('0x7')]=_0x5cfd39[0x8]+'?params='+_0x3c0e6c+'|'+_0x463fd0+'|'+_0x3e2b74+'|'+_0x358dc+'|'+_0x51a700;_0x20ee6c['urlOnRing']=_0x5cfd39[0x7]+_0x273d('0x8')+_0x3c0e6c+'|'+_0x463fd0+'|'+_0x3e2b74+'|'+_0x358dc+'|'+_0x51a700+'|'+_0xc39831+'|'+_0x34eaa9;_0x20ee6c[_0x273d('0x9')]=_0x5cfd39[0x9];var _0x58fc18={};_0x58fc18[_0x273d('0xa')]=_0x273d('0xb');_0x58fc18['method']=_0x273d('0xc');var _0x14cd11=[];_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x2]);_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x5]);_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x6]);_0x58fc18['params']=_0x14cd11;_0x58fc18['id']=0x1;var _0x31a368=JSON[_0x273d('0xe')](_0x58fc18);var _0x819c94={'encoding':_0x273d('0xf'),'method':_0x273d('0x10'),'timeout':0x2710,'url':_0x4788ef,'headers':{'Content-Type':'application/json-rpc'},'body':_0x31a368};return rp(_0x819c94)[_0x273d('0x11')](function(_0xe05e3a){const _0x4a4336=JSON['parse'](_0xe05e3a);if(!_0x4a4336[_0x273d('0x12')][_0x273d('0x13')]){throw new Error(_0x273d('0x14'));}var _0xd6e130=_0x358dc;var _0x9caab2=_0x273d('0x15')+_0xfed993+_0x273d('0x16')+_0x587c6a+_0x273d('0x17')+_0xd6e130+_0x273d('0x18')+JSON[_0x273d('0xe')](_0x20ee6c);var _0x1c40b3=_0x5b2c80+'?'+_0x9caab2;return rp(_0x1c40b3);})['then'](function(_0xa40f01){logger[_0x273d('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2d726b,_0xa40f01);_0x31741a[_0x273d('0x1a')]();})[_0x273d('0x1b')](function(_0x2ef8bc){logger['error'](_0x273d('0x1c'),_0x2d726b,_[_0x273d('0x1d')](_0x2ef8bc)?JSON[_0x273d('0xe')](_0x2ef8bc):_0x2ef8bc);_0x31741a[_0x273d('0x1a')]();});}else{logger[_0x273d('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2d726b);_0x31741a[_0x273d('0x1e')]();}};}; \ No newline at end of file +var _0x1be8=['then','parse','result','logged','channelId=','&sessionId=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','stringify','utf8'];(function(_0x2727aa,_0x5c0361){var _0x340b19=function(_0xff6258){while(--_0xff6258){_0x2727aa['push'](_0x2727aa['shift']());}};_0x340b19(++_0x5c0361);}(_0x1be8,0x113));var _0x81be=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x1be8[_0x298ed3];return _0x5aad28;};'use strict';var rp=require(_0x81be('0x0'));var logger=require(_0x81be('0x1'))('routing');var _=require(_0x81be('0x2'));var arr=[];exports['consequence']=function(_0x4aa6e7,_0x2f32eb){return function(_0x11cf75){var _0xdccda0=_0x2f32eb[0xa];var _0x28e768=_0x2f32eb[0xb];var _0xe3bcc6=_0x2f32eb[0xc];var _0x5292fb=_0x2f32eb[0xd];var _0x44d4db=_0x2f32eb[0xe];var _0x79636b=_0x2f32eb[0xf][_0x81be('0x3')](/\n/g,'\x20-\x20');var _0x4ee470=_0x2f32eb[0x10][_0x81be('0x3')](/\n/g,'\x20');if(!arr[_0x81be('0x4')](_0x28e768)){arr[_0x81be('0x5')](_0x28e768);var _0x4b5d19=_0x2f32eb[0x3];var _0x22c003=_0x2f32eb[0x4];var _0x27f6f3=_0x2f32eb[0x1];var _0xd0a9e7=_0x2f32eb[0x0];var _0x39c287={};_0x39c287[_0x81be('0x6')]=_0x2f32eb[0x8]+_0x81be('0x7')+_0xe3bcc6+'|'+_0xdccda0+'|'+_0x5292fb+'|'+_0x28e768+'|'+_0x44d4db;_0x39c287[_0x81be('0x8')]=_0x2f32eb[0x7]+_0x81be('0x7')+_0xe3bcc6+'|'+_0xdccda0+'|'+_0x5292fb+'|'+_0x28e768+'|'+_0x44d4db+'|'+_0x79636b+'|'+_0x4ee470;_0x39c287[_0x81be('0x9')]=_0x2f32eb[0x9];var _0x1ea05a={};_0x1ea05a[_0x81be('0xa')]=_0x81be('0xb');_0x1ea05a[_0x81be('0xc')]='login';var _0x29d4ae=[];_0x29d4ae[_0x81be('0x5')](_0x2f32eb[0x2]);_0x29d4ae[_0x81be('0x5')](_0x2f32eb[0x5]);_0x29d4ae[_0x81be('0x5')](_0x2f32eb[0x6]);_0x1ea05a['params']=_0x29d4ae;_0x1ea05a['id']=0x1;var _0xb03483=JSON[_0x81be('0xd')](_0x1ea05a);var _0x200f0f={'encoding':_0x81be('0xe'),'method':'POST','timeout':0x2710,'url':_0x4b5d19,'headers':{'Content-Type':'application/json-rpc'},'body':_0xb03483};return rp(_0x200f0f)[_0x81be('0xf')](function(_0x3daf74){const _0x4e3b1d=JSON[_0x81be('0x10')](_0x3daf74);if(!_0x4e3b1d[_0x81be('0x11')][_0x81be('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x23e19f=_0x28e768;var _0x5563ee=_0x81be('0x13')+_0x27f6f3+'&serviceId='+_0xd0a9e7+_0x81be('0x14')+_0x23e19f+'&data='+JSON['stringify'](_0x39c287);var _0x16c1d9=_0x22c003+'?'+_0x5563ee;return rp(_0x16c1d9);})[_0x81be('0xf')](function(_0x1c2882){logger[_0x81be('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4aa6e7,_0x1c2882);_0x11cf75[_0x81be('0x16')]();})[_0x81be('0x17')](function(_0x4dbbbe){logger[_0x81be('0x18')](_0x81be('0x19'),_0x4aa6e7,_[_0x81be('0x1a')](_0x4dbbbe)?JSON[_0x81be('0xd')](_0x4dbbbe):_0x4dbbbe);_0x11cf75[_0x81be('0x16')]();});}else{logger[_0x81be('0x15')](_0x81be('0x1b'),_0x4aa6e7);_0x11cf75[_0x81be('0x1c')]();}};}; \ 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 02f97a3..05c6a48 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(_0x56809e,_0x6d1ac2){var _0x3df1fa=function(_0x2e6b61){while(--_0x2e6b61){_0x56809e['push'](_0x56809e['shift']());}};_0x3df1fa(++_0x6d1ac2);}(_0xe706,0xa3));var _0x6e70=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xe706[_0xb0fe92];return _0x41787f;};'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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3dc187,_0xd85c70){var _0x596f2c=function(_0x3ca940){while(--_0x3ca940){_0x3dc187['push'](_0x3dc187['shift']());}};_0x596f2c(++_0xd85c70);}(_0xe706,0xa3));var _0x6e70=function(_0x362e87,_0x38d17c){_0x362e87=_0x362e87-0x0;var _0x334244=_0xe706[_0x362e87];return _0x334244;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index cf16adb..9901c90 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 _0xe3e6=['agents','busyQueue','end','QueueReport','catch','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflowv2','amazonlex','split','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','consequence','priority','info','Push\x20new\x20rule','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent'];(function(_0x122eac,_0x192e03){var _0x19e458=function(_0x236d08){while(--_0x236d08){_0x122eac['push'](_0x122eac['shift']());}};_0x19e458(++_0x192e03);}(_0xe3e6,0x80));var _0x6e3e=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xe3e6[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x6e3e('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x6e3e('0x1'));var BPromise=require(_0x6e3e('0x2'));var utils=require(_0x6e3e('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6e3e('0x4'))(_0x6e3e('0x5'));var rpc={'openchannelQueueReport':require(_0x6e3e('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6e3e('0x7')),'smsQueueReport':require(_0x6e3e('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6e3e('0x9'))};var RuleEngine=require(_0x6e3e('0xa'));function getId(_0x3cf17b,_0x492464,_0x26e7f0){return util[_0x6e3e('0xb')](_0x6e3e('0xc'),_0x3cf17b,_0x492464||0x0,_0x26e7f0||0x0);}function getIntervals(_0x2c0477,_0x3a0a10){var _0x3d9a0b=[];if(!_[_0x6e3e('0xd')](_0x3a0a10[_0x6e3e('0xe')])&&!_['isNil'](_0x2c0477[_0x3a0a10['IntervalId']])&&!_[_0x6e3e('0xd')](_0x2c0477[_0x3a0a10['IntervalId']]['Intervals'])){_0x3d9a0b=_[_0x6e3e('0xf')](_0x2c0477[_0x3a0a10[_0x6e3e('0xe')]]['Intervals'],'interval');}else if(!_[_0x6e3e('0xd')](_0x3a0a10[_0x6e3e('0x10')])){_0x3d9a0b=[_0x3a0a10['interval']];}return _0x3d9a0b;}exports[_0x6e3e('0x11')]=function(_0x9d5431){_0x9d5431[_0x6e3e('0x12')]={};return new BPromise(function(_0x2ff4aa,_0x547636){var _0xf369d5={'Start':function(_0x45c947){var _0x44e959=this;return new Promise(function(_0x28e4de,_0x267b8c){if(_0x45c947){try{var _0x5131c7=[];var _0x538f68=getId(_0x45c947[_0x6e3e('0x13')],_0x45c947[_0x6e3e('0x14')]?_0x45c947['message']['id']:0x0,_0x45c947['interaction']?_0x45c947[_0x6e3e('0x15')]['id']:0x0);var _0x2e6306=sUtils[_0x6e3e('0x16')](_0x9d5431,_0x45c947);if(!_0x2e6306&&_0x45c947[_0x6e3e('0x17')]&&_[_0x6e3e('0x18')](_0x45c947[_0x6e3e('0x17')])&&_0x45c947[_0x6e3e('0x17')][_0x6e3e('0x19')]){for(var _0x2abfaa=0x0;_0x2abfaa<_0x45c947[_0x6e3e('0x17')][_0x6e3e('0x19')];_0x2abfaa+=0x1){var _0x38cdaf=_0x45c947[_0x6e3e('0x17')][_0x2abfaa];if(fs[_0x6e3e('0x1a')](path[_0x6e3e('0x1b')](__dirname,_0x6e3e('0x17'),_0x38cdaf[_0x6e3e('0x1c')]+_0x6e3e('0x1d')))){var _0xfd60b8=[];switch(_0x38cdaf['app'][_0x6e3e('0x1e')]()){case'autoreply':var _0x1cb983=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');if(_0x45c947['channel']===_0x6e3e('0x20')){_0xfd60b8[_0x6e3e('0x21')](_0x1cb983[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x1cb983[0x1]);_0xfd60b8['push'](_0x1cb983['slice'](0x2,_0x1cb983[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));}else{_0xfd60b8['push'](_0x1cb983[0x0]);_0xfd60b8['push'](_0x1cb983[_0x6e3e('0x22')](0x1,_0x1cb983[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));}break;case'dialogflow':var _0x24aaef=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[0x1]);_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[_0x6e3e('0x22')](0x2,_0x24aaef['length'])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x23'):var _0x25843a=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');_0xfd60b8['push'](_0x25843a[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x25843a[0x1]);_0xfd60b8['push'](_0x25843a[0x2]);_0xfd60b8['push'](_0x25843a[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x25843a[_0x6e3e('0x22')](0x4,_0x25843a[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x24'):var _0x98436e=_0x38cdaf[_0x6e3e('0x1f')][_0x6e3e('0x25')](',');_0xfd60b8[_0x6e3e('0x21')](_0x98436e[0x0]);_0xfd60b8['push'](_0x98436e[0x1]);_0xfd60b8['push'](_0x98436e[0x2]);_0xfd60b8['push'](_0x98436e[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x98436e['slice'](0x4,_0x98436e[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x14'):_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf[_0x6e3e('0x1f')]);break;case _0x6e3e('0x26'):_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf[_0x6e3e('0x27')]);_0xfd60b8['push'](_0x38cdaf['appdata']);break;case _0x6e3e('0x28'):var _0x21f385=utils[_0x6e3e('0x29')](_0x45c947[_0x6e3e('0x2a')][_0x6e3e('0x2b')],_0x45c947);var _0x254f56=_0x38cdaf['appdata'][_0x6e3e('0x25')](',');_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x1]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x2]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x4]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x5]);_0xfd60b8['push'](_0x254f56[0x6]);_0xfd60b8['push'](_0x254f56[0x7]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x8]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x9]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0xa]);_0xfd60b8['push'](_0x45c947['interaction']['id']);_0xfd60b8[_0x6e3e('0x21')](_0x45c947[_0x6e3e('0x14')]['id']);_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf['ChatWebsiteId']);_0xfd60b8[_0x6e3e('0x21')](_0x45c947['interaction'][_0x6e3e('0x2c')]);_0xfd60b8[_0x6e3e('0x21')](_0x45c947['body'][_0x6e3e('0x2d')]);_0xfd60b8[_0x6e3e('0x21')](_0x21f385);break;default:_0xfd60b8=_['isNil'](_0x38cdaf[_0x6e3e('0x1f')])?[]:_0x38cdaf['appdata']['split'](',');}var _0x5e4d6b={'id':util['format'](_0x6e3e('0x2e'),_0x538f68,_0x38cdaf['id'],_0x38cdaf[_0x6e3e('0x1c')]),'condition':require('./interval')['condition'](_0x538f68,getIntervals(_0x9d5431['intervals'],_0x38cdaf),_0x9d5431),'consequence':require('./applications/'+_0x38cdaf['app'])[_0x6e3e('0x2f')](_0x538f68,_0xfd60b8,_0x9d5431,_0x45c947),'p':_0x38cdaf[_0x6e3e('0x30')]||0x0};logger[_0x6e3e('0x31')](_0x6e3e('0x32'),_0x5e4d6b['id'],'on\x20interval',getIntervals(_0x9d5431[_0x6e3e('0x33')],_0x38cdaf)[_0x6e3e('0x1b')]('\x20|\x20'));_0x5131c7[_0x6e3e('0x21')](_0x5e4d6b);}else{logger[_0x6e3e('0x34')](_0x6e3e('0x35'),path[_0x6e3e('0x1b')](__dirname,_0x6e3e('0x17'),_0x38cdaf[_0x6e3e('0x1c')]+'.js'));}}_0x9d5431[_0x6e3e('0x12')][_0x538f68]=new RuleEngine(_0x5131c7);_0x9d5431[_0x6e3e('0x12')][_0x538f68][_0x6e3e('0x36')](_0x45c947,function(_0x9eb5dd){logger[_0x6e3e('0x31')](_0x6e3e('0x37'),JSON['stringify'](_0x9eb5dd[_0x6e3e('0x38')]));if(_0x9d5431[_0x6e3e('0x12')][_0x538f68]){_0x9d5431[_0x6e3e('0x12')][_0x538f68][_0x6e3e('0x39')]('complete');}});return _0x28e4de({'code':0xc8,'message':_0x45c947});}else{if(_0x2e6306){logger['info'](util['format'](_0x6e3e('0x3a'),_0x538f68));}else{logger[_0x6e3e('0x31')](_0x6e3e('0x3b'));}return _0x28e4de({'code':0xc8,'message':_0x45c947});}}catch(_0x4f196c){logger[_0x6e3e('0x34')](_0x4f196c[_0x6e3e('0x3c')]);return _0x267b8c(_0x44e959['error'](0x1f4,_0x4f196c));}}return _0x267b8c('routing\x20is\x20empty');});},'AcceptMessage':function(_0x41b722){var _0x3992b9=this;return new Promise(function(_0x35fd7d,_0xe1e629){if(_0x41b722[_0x6e3e('0x3d')]&&_0x41b722[_0x6e3e('0x3d')]['id']){if(_0x9d5431[_0x6e3e('0x3e')][_0x41b722[_0x6e3e('0x3d')]['id']]){_0x9d5431[_0x6e3e('0x3e')][_0x41b722[_0x6e3e('0x3d')]['id']]['busy']=![];_0x9d5431['agents'][_0x41b722[_0x6e3e('0x3d')]['id']][_0x6e3e('0x3f')]=undefined;}}if(_0x41b722[_0x6e3e('0x14')]&&_0x41b722[_0x6e3e('0x14')]['id']){try{var _0x451e90=getId(_0x41b722[_0x6e3e('0x13')],_0x41b722[_0x6e3e('0x14')]?_0x41b722[_0x6e3e('0x14')]['id']:0x0,_0x41b722[_0x6e3e('0x15')]?_0x41b722[_0x6e3e('0x15')]['id']:0x0);if(_0x9d5431[_0x6e3e('0x12')][_0x451e90]){_0x9d5431[_0x6e3e('0x12')][_0x451e90][_0x6e3e('0x39')](_0x6e3e('0x40'));if(rpc[_0x41b722['channel']+_0x6e3e('0x41')]){rpc[_0x41b722[_0x6e3e('0x13')]+_0x6e3e('0x41')]['update'](_0x451e90,{'UserId':_0x41b722[_0x6e3e('0x14')]['UserId']})[_0x6e3e('0x42')](function(){logger[_0x6e3e('0x34')]('error\x20update\x20queue\x20report');});}}return _0x35fd7d({'code':0xc8,'message':_0x41b722});}catch(_0x50ccc5){logger[_0x6e3e('0x34')](_0x50ccc5['stack']);return _0xe1e629(_0x3992b9[_0x6e3e('0x34')](0x1f4,_0x50ccc5));}}logger[_0x6e3e('0x34')](_0x6e3e('0x43'));return _0xe1e629(_0x3992b9[_0x6e3e('0x34')](0x1f4,_0x6e3e('0x43')));});},'RejectMessage':function(_0x128781){var _0xe8aed2=this;return new Promise(function(_0x20a5df,_0x14f6eb){if(_0x128781[_0x6e3e('0x3d')]&&_0x128781[_0x6e3e('0x3d')]['id']){try{if(_0x9d5431['agents'][_0x128781['agent']['id']]){_0x9d5431[_0x6e3e('0x3e')][_0x128781[_0x6e3e('0x3d')]['id']][_0x6e3e('0x44')]=![];_0x9d5431[_0x6e3e('0x3e')][_0x128781[_0x6e3e('0x3d')]['id']]['busyQueue']=undefined;}return _0x20a5df({'code':0xc8,'message':_0x128781});}catch(_0x381b41){logger[_0x6e3e('0x34')](_0x381b41[_0x6e3e('0x3c')]);return _0x14f6eb(_0xe8aed2[_0x6e3e('0x34')](0x1f4,_0x381b41));}}logger['error'](_0x6e3e('0x43'));return _0x14f6eb(_0xe8aed2['error'](0x1f4,_0x6e3e('0x43')));});},'AbandonInteraction':function(_0x13275a){var _0x4721f1=this;return new Promise(function(_0xbcdc6e,_0x57966b){if(_0x13275a[_0x6e3e('0x13')]&&_0x13275a[_0x6e3e('0x15')]&&_0x13275a[_0x6e3e('0x15')]['id']){try{var _0x23ec15=getId(_0x13275a[_0x6e3e('0x13')],_0x13275a['message']?_0x13275a['message']['id']:0x0,_0x13275a[_0x6e3e('0x15')]?_0x13275a['interaction']['id']:0x0);if(_0x9d5431[_0x6e3e('0x12')][_0x23ec15]){_0x9d5431['rules'][_0x23ec15][_0x6e3e('0x39')](_0x6e3e('0x40'));}return _0xbcdc6e({'code':0xc8,'message':_0x13275a});}catch(_0x56f86f){logger['error'](_0x56f86f['stack']);return _0x57966b(_0x4721f1['error'](0x1f4,_0x56f86f));}}logger[_0x6e3e('0x34')](_0x6e3e('0x43'));return _0x57966b(_0x4721f1[_0x6e3e('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1c9496){var _0x3c8a57=this;return new Promise(function(_0x42daf1,_0x239ed8){if(_0x9d5431[_0x6e3e('0x3e')]['hasOwnProperty'](_0x1c9496['id'])){for(var _0x2a8986 in _0x1c9496[_0x6e3e('0x45')]){if(_0x1c9496[_0x6e3e('0x45')]['hasOwnProperty'](_0x2a8986)){if(_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']][_0x6e3e('0x46')](_0x2a8986+_0x6e3e('0x47'))){_0x9d5431['agents'][_0x1c9496['id']][_0x2a8986+_0x6e3e('0x47')]=parseInt(_0x1c9496['capacity'][_0x2a8986],0xa);}}}_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']][_0x6e3e('0x48')]();return _0x42daf1({'code':0xc8,'message':_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']]});}else{return _0x239ed8(_0x3c8a57[_0x6e3e('0x34')](0x1f4,_0x6e3e('0x49')));}});},'Agents':function(_0x1bacac){return new Promise(function(_0x1528a9){var _0x1ef9df=_['values'](_0x9d5431['agents']);if(_0x1bacac&&_0x1bacac['id']){var _0x5868c3=_['find'](_0x1ef9df,function(_0x24716d){return _0x24716d['id']===_0x1bacac['id'];});_0x1528a9(_0x5868c3);}else{_0x1528a9({'count':_0x1ef9df[_0x6e3e('0x19')],'rows':_0x1ef9df});}});},'ChatQueues':function(){return new Promise(function(_0x56dc45){var _0x787f6a=[];for(var _0x58a402 in _0x9d5431['chatQueues']){if(_0x9d5431[_0x6e3e('0x4a')][_0x6e3e('0x46')](_0x58a402)){var _0x11cdfb=_0x9d5431[_0x6e3e('0x4a')][_0x58a402];var _0x5edeac={'id':_0x11cdfb['id'],'available':_0x11cdfb[_0x6e3e('0x4b')],'loggedIn':_0x11cdfb['loggedIn'],'name':_0x11cdfb[_0x6e3e('0x4c')],'paused':_0x11cdfb[_0x6e3e('0x4d')],'waiting':_0x11cdfb[_0x6e3e('0x4e')]};_0x787f6a['push'](_0x5edeac);}}_0x56dc45({'count':_0x787f6a[_0x6e3e('0x19')],'rows':_0x787f6a});});},'MailQueues':function(){return new Promise(function(_0x2a8435){var _0x2aba3d=[];for(var _0x1f4724 in _0x9d5431[_0x6e3e('0x4f')]){if(_0x9d5431[_0x6e3e('0x4f')][_0x6e3e('0x46')](_0x1f4724)){var _0x3d3487=_0x9d5431[_0x6e3e('0x4f')][_0x1f4724];var _0x3e407f={'id':_0x3d3487['id'],'available':_0x3d3487['available'],'loggedIn':_0x3d3487['loggedIn'],'name':_0x3d3487['name'],'paused':_0x3d3487[_0x6e3e('0x4d')],'waiting':_0x3d3487[_0x6e3e('0x4e')]};_0x2aba3d[_0x6e3e('0x21')](_0x3e407f);}}_0x2a8435({'count':_0x2aba3d[_0x6e3e('0x19')],'rows':_0x2aba3d});});},'OpenchannelQueues':function(){return new Promise(function(_0x2e5141){var _0x2de622=[];for(var _0x2a4efb in _0x9d5431[_0x6e3e('0x50')]){if(_0x9d5431[_0x6e3e('0x50')][_0x6e3e('0x46')](_0x2a4efb)){var _0x353bf0=_0x9d5431['openchannelQueues'][_0x2a4efb];var _0x2c7ebe={'id':_0x353bf0['id'],'available':_0x353bf0[_0x6e3e('0x4b')],'loggedIn':_0x353bf0[_0x6e3e('0x51')],'name':_0x353bf0[_0x6e3e('0x4c')],'paused':_0x353bf0[_0x6e3e('0x4d')],'waiting':_0x353bf0[_0x6e3e('0x4e')]};_0x2de622[_0x6e3e('0x21')](_0x2c7ebe);}}_0x2e5141({'count':_0x2de622[_0x6e3e('0x19')],'rows':_0x2de622});});},'SmsQueues':function(){return new Promise(function(_0x23d3eb){var _0x2a185c=[];for(var _0x53c38e in _0x9d5431[_0x6e3e('0x52')]){if(_0x9d5431['smsQueues'][_0x6e3e('0x46')](_0x53c38e)){var _0x10da5a=_0x9d5431[_0x6e3e('0x52')][_0x53c38e];var _0x167f55={'id':_0x10da5a['id'],'available':_0x10da5a[_0x6e3e('0x4b')],'loggedIn':_0x10da5a['loggedIn'],'name':_0x10da5a['name'],'paused':_0x10da5a['paused'],'waiting':_0x10da5a[_0x6e3e('0x4e')]};_0x2a185c[_0x6e3e('0x21')](_0x167f55);}}_0x23d3eb({'count':_0x2a185c[_0x6e3e('0x19')],'rows':_0x2a185c});});},'FaxQueues':function(){return new Promise(function(_0x528e0e){var _0x70d2cc=[];for(var _0x45bcd8 in _0x9d5431[_0x6e3e('0x53')]){if(_0x9d5431[_0x6e3e('0x53')][_0x6e3e('0x46')](_0x45bcd8)){var _0x5d0143=_0x9d5431[_0x6e3e('0x53')][_0x45bcd8];var _0x3ccaab={'id':_0x5d0143['id'],'available':_0x5d0143[_0x6e3e('0x4b')],'loggedIn':_0x5d0143[_0x6e3e('0x51')],'name':_0x5d0143[_0x6e3e('0x4c')],'paused':_0x5d0143[_0x6e3e('0x4d')],'waiting':_0x5d0143[_0x6e3e('0x4e')]};_0x70d2cc[_0x6e3e('0x21')](_0x3ccaab);}}_0x528e0e({'count':_0x70d2cc['length'],'rows':_0x70d2cc});});},'WhatsappQueues':function(){return new Promise(function(_0x1a5f0c){var _0x54a8f8=[];for(var _0x245fdd in _0x9d5431[_0x6e3e('0x54')]){if(_0x9d5431[_0x6e3e('0x54')][_0x6e3e('0x46')](_0x245fdd)){var _0x30b20c=_0x9d5431['whatsappQueues'][_0x245fdd];var _0xbee09={'id':_0x30b20c['id'],'available':_0x30b20c[_0x6e3e('0x4b')],'loggedIn':_0x30b20c[_0x6e3e('0x51')],'name':_0x30b20c[_0x6e3e('0x4c')],'paused':_0x30b20c[_0x6e3e('0x4d')],'waiting':_0x30b20c[_0x6e3e('0x4e')]};_0x54a8f8[_0x6e3e('0x21')](_0xbee09);}}_0x1a5f0c({'count':_0x54a8f8[_0x6e3e('0x19')],'rows':_0x54a8f8});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x8b8129){var _0x799d67=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x56')]);_0x8b8129({'count':_0x799d67['length'],'rows':_0x799d67});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2a8aed){var _0x3653b5=_['values'](_0x9d5431[_0x6e3e('0x57')]);_0x2a8aed({'count':_0x3653b5[_0x6e3e('0x19')],'rows':_0x3653b5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x47073a){var _0x5914e4=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x58')]);_0x47073a({'count':_0x5914e4[_0x6e3e('0x19')],'rows':_0x5914e4});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xcc87bb){var _0x1fdf48=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x59')]);_0xcc87bb({'count':_0x1fdf48['length'],'rows':_0x1fdf48});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5f0683){var _0x25bd67=_[_0x6e3e('0x55')](_0x9d5431['faxQueuesWaitingInteractions']);_0x5f0683({'count':_0x25bd67[_0x6e3e('0x19')],'rows':_0x25bd67});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2756cb){var _0x18e832=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x5a')]);_0x2756cb({'count':_0x18e832['length'],'rows':_0x18e832});});}};var _0xeaa441=jayson[_0x6e3e('0x5b')](_0xf369d5)[_0x6e3e('0x5c')]();_0xeaa441['on'](_0x6e3e('0x34'),function(_0x337af7){logger[_0x6e3e('0x34')](JSON['stringify'](_0x337af7));return _0x547636(_0x337af7);});_0xeaa441[_0x6e3e('0x11')](0x232c,'127.0.0.1',function(){console[_0x6e3e('0x5d')](_0x6e3e('0x5e'),0x232c);return _0x2ff4aa('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x9c57=['body','%s:%s:%s','./interval','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','error','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','.js','app','autoreply','appdata','push','slice','dialogflow','split','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x9c57,0x99));var _0x79c5=function(_0x1cf279,_0x31c825){_0x1cf279=_0x1cf279-0x0;var _0x33f5b6=_0x9c57[_0x1cf279];return _0x33f5b6;};'use strict';var _=require(_0x79c5('0x0'));var util=require(_0x79c5('0x1'));var path=require(_0x79c5('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x79c5('0x3'));var utils=require(_0x79c5('0x4'));var sUtils=require(_0x79c5('0x5'));var logger=require(_0x79c5('0x6'))(_0x79c5('0x7'));var rpc={'openchannelQueueReport':require(_0x79c5('0x8')),'mailQueueReport':require(_0x79c5('0x9')),'chatQueueReport':require(_0x79c5('0xa')),'smsQueueReport':require(_0x79c5('0xb')),'faxQueueReport':require(_0x79c5('0xc')),'whatsappQueueReport':require(_0x79c5('0xd'))};var RuleEngine=require(_0x79c5('0xe'));function getId(_0x355d14,_0x935b9c,_0x44f582){return util[_0x79c5('0xf')](_0x79c5('0x10'),_0x355d14,_0x935b9c||0x0,_0x44f582||0x0);}function getIntervals(_0x2b39e3,_0x3811e3){var _0x132a27=[];if(!_[_0x79c5('0x11')](_0x3811e3[_0x79c5('0x12')])&&!_[_0x79c5('0x11')](_0x2b39e3[_0x3811e3[_0x79c5('0x12')]])&&!_[_0x79c5('0x11')](_0x2b39e3[_0x3811e3[_0x79c5('0x12')]][_0x79c5('0x13')])){_0x132a27=_[_0x79c5('0x14')](_0x2b39e3[_0x3811e3[_0x79c5('0x12')]][_0x79c5('0x13')],_0x79c5('0x15'));}else if(!_[_0x79c5('0x11')](_0x3811e3[_0x79c5('0x15')])){_0x132a27=[_0x3811e3[_0x79c5('0x15')]];}return _0x132a27;}exports[_0x79c5('0x16')]=function(_0x4df93f){_0x4df93f[_0x79c5('0x17')]={};return new BPromise(function(_0x2d0410,_0x555da7){var _0x154a90={'Start':function(_0x53fe46){var _0x227d8e=this;return new Promise(function(_0x133f7c,_0x402a2e){if(_0x53fe46){try{var _0x297c6d=[];var _0x30be93=getId(_0x53fe46[_0x79c5('0x18')],_0x53fe46[_0x79c5('0x19')]?_0x53fe46['message']['id']:0x0,_0x53fe46[_0x79c5('0x1a')]?_0x53fe46['interaction']['id']:0x0);var _0x376c44=sUtils[_0x79c5('0x1b')](_0x4df93f,_0x53fe46);if(_0x53fe46[_0x79c5('0x1c')]||!_0x376c44&&_0x53fe46[_0x79c5('0x1d')]&&_[_0x79c5('0x1e')](_0x53fe46['applications'])&&_0x53fe46[_0x79c5('0x1d')][_0x79c5('0x1f')]){for(var _0x3887e5=0x0;_0x3887e5<_0x53fe46[_0x79c5('0x1d')]['length'];_0x3887e5+=0x1){var _0x386819=_0x53fe46[_0x79c5('0x1d')][_0x3887e5];if(fs['existsSync'](path[_0x79c5('0x20')](__dirname,_0x79c5('0x1d'),_0x386819['app']+_0x79c5('0x21')))){var _0x1f6c73=[];switch(_0x386819[_0x79c5('0x22')]['toLowerCase']()){case _0x79c5('0x23'):var _0x8d10ed=_0x386819[_0x79c5('0x24')]['split'](',');if(_0x53fe46[_0x79c5('0x18')]==='mail'){_0x1f6c73[_0x79c5('0x25')](_0x8d10ed[0x0]);_0x1f6c73['push'](_0x8d10ed[0x1]);_0x1f6c73[_0x79c5('0x25')](_0x8d10ed[_0x79c5('0x26')](0x2,_0x8d10ed['length'])[_0x79c5('0x20')](','));}else{_0x1f6c73[_0x79c5('0x25')](_0x8d10ed[0x0]);_0x1f6c73['push'](_0x8d10ed[_0x79c5('0x26')](0x1,_0x8d10ed[_0x79c5('0x1f')])['join'](','));}break;case _0x79c5('0x27'):var _0x52f60b=_0x386819[_0x79c5('0x24')][_0x79c5('0x28')](',');_0x1f6c73[_0x79c5('0x25')](_0x52f60b[0x0]);_0x1f6c73[_0x79c5('0x25')](_0x52f60b[0x1]);_0x1f6c73[_0x79c5('0x25')](_0x52f60b['slice'](0x2,_0x52f60b[_0x79c5('0x1f')])['join'](','));break;case'dialogflowv2':var _0x22a6dd=_0x386819['appdata'][_0x79c5('0x28')](',');_0x1f6c73[_0x79c5('0x25')](_0x22a6dd[0x0]);_0x1f6c73[_0x79c5('0x25')](_0x22a6dd[0x1]);_0x1f6c73[_0x79c5('0x25')](_0x22a6dd[0x2]);_0x1f6c73['push'](_0x22a6dd[0x3]);_0x1f6c73[_0x79c5('0x25')](_0x22a6dd['slice'](0x4,_0x22a6dd[_0x79c5('0x1f')])[_0x79c5('0x20')](','));break;case _0x79c5('0x29'):var _0x2c7ffc=_0x386819[_0x79c5('0x24')][_0x79c5('0x28')](',');_0x1f6c73[_0x79c5('0x25')](_0x2c7ffc[0x0]);_0x1f6c73[_0x79c5('0x25')](_0x2c7ffc[0x1]);_0x1f6c73[_0x79c5('0x25')](_0x2c7ffc[0x2]);_0x1f6c73['push'](_0x2c7ffc[0x3]);_0x1f6c73[_0x79c5('0x25')](_0x2c7ffc[_0x79c5('0x26')](0x4,_0x2c7ffc[_0x79c5('0x1f')])['join'](','));break;case _0x79c5('0x19'):_0x1f6c73['push'](_0x386819[_0x79c5('0x24')]);break;case _0x79c5('0x2a'):_0x1f6c73[_0x79c5('0x25')](_0x386819[_0x79c5('0x2b')]);_0x1f6c73['push'](_0x386819['appdata']);break;case _0x79c5('0x2c'):var _0x1f8e19=utils[_0x79c5('0x2d')](_0x53fe46['account'][_0x79c5('0x2e')],_0x53fe46);var _0x5b8660=_0x386819['appdata']['split'](',');_0x1f6c73['push'](_0x5b8660[0x0]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x1]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x2]);_0x1f6c73['push'](_0x5b8660[0x3]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x4]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x5]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x6]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x7]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x8]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0x9]);_0x1f6c73[_0x79c5('0x25')](_0x5b8660[0xa]);_0x1f6c73[_0x79c5('0x25')](_0x53fe46['interaction']['id']);_0x1f6c73['push'](_0x53fe46[_0x79c5('0x19')]['id']);_0x1f6c73[_0x79c5('0x25')](_0x386819[_0x79c5('0x2f')]);_0x1f6c73[_0x79c5('0x25')](_0x53fe46[_0x79c5('0x1a')][_0x79c5('0x30')]);_0x1f6c73[_0x79c5('0x25')](_0x53fe46[_0x79c5('0x31')][_0x79c5('0x31')]);_0x1f6c73[_0x79c5('0x25')](_0x1f8e19);break;default:_0x1f6c73=_['isNil'](_0x386819[_0x79c5('0x24')])?[]:_0x386819[_0x79c5('0x24')][_0x79c5('0x28')](',');}var _0x395bdb={'id':util[_0x79c5('0xf')](_0x79c5('0x32'),_0x30be93,_0x386819['id'],_0x386819['app']),'condition':require(_0x79c5('0x33'))['condition'](_0x30be93,getIntervals(_0x4df93f[_0x79c5('0x34')],_0x386819),_0x4df93f),'consequence':require(_0x79c5('0x35')+_0x386819[_0x79c5('0x22')])[_0x79c5('0x36')](_0x30be93,_0x1f6c73,_0x4df93f,_0x53fe46),'p':_0x386819['priority']||0x0};logger[_0x79c5('0x37')](_0x79c5('0x38'),_0x395bdb['id'],_0x79c5('0x39'),getIntervals(_0x4df93f[_0x79c5('0x34')],_0x386819)[_0x79c5('0x20')]('\x20|\x20'));_0x297c6d[_0x79c5('0x25')](_0x395bdb);}else{logger[_0x79c5('0x3a')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x79c5('0x20')](__dirname,_0x79c5('0x1d'),_0x386819[_0x79c5('0x22')]+'.js'));}}_0x4df93f[_0x79c5('0x17')][_0x30be93]=new RuleEngine(_0x297c6d);_0x4df93f[_0x79c5('0x17')][_0x30be93]['execute'](_0x53fe46,function(_0x5d7251){logger['info'](_0x79c5('0x3b'),JSON[_0x79c5('0x3c')](_0x5d7251[_0x79c5('0x3d')]));if(_0x4df93f['rules'][_0x30be93]){_0x4df93f[_0x79c5('0x17')][_0x30be93][_0x79c5('0x3e')]('complete');}});return _0x133f7c({'code':0xc8,'message':_0x53fe46});}else{if(_0x376c44){logger[_0x79c5('0x37')](util['format'](_0x79c5('0x3f'),_0x30be93));}else{logger['info'](_0x79c5('0x40'));}return _0x133f7c({'code':0xc8,'message':_0x53fe46});}}catch(_0x2ac89b){logger[_0x79c5('0x3a')](_0x2ac89b['stack']);return _0x402a2e(_0x227d8e[_0x79c5('0x3a')](0x1f4,_0x2ac89b));}}return _0x402a2e(_0x79c5('0x41'));});},'AcceptMessage':function(_0x57c0c5){var _0xae2135=this;return new Promise(function(_0x270e4a,_0x4c1d6d){if(_0x57c0c5[_0x79c5('0x42')]&&_0x57c0c5[_0x79c5('0x42')]['id']){if(_0x4df93f[_0x79c5('0x43')][_0x57c0c5[_0x79c5('0x42')]['id']]){_0x4df93f[_0x79c5('0x43')][_0x57c0c5[_0x79c5('0x42')]['id']][_0x79c5('0x44')]=![];_0x4df93f['agents'][_0x57c0c5['agent']['id']]['busyQueue']=undefined;}}if(_0x57c0c5[_0x79c5('0x19')]&&_0x57c0c5[_0x79c5('0x19')]['id']){try{var _0xe7dbb2=getId(_0x57c0c5[_0x79c5('0x18')],_0x57c0c5['message']?_0x57c0c5[_0x79c5('0x19')]['id']:0x0,_0x57c0c5[_0x79c5('0x1a')]?_0x57c0c5[_0x79c5('0x1a')]['id']:0x0);if(_0x4df93f[_0x79c5('0x17')][_0xe7dbb2]){_0x4df93f['rules'][_0xe7dbb2][_0x79c5('0x3e')](_0x79c5('0x45'));if(rpc[_0x57c0c5[_0x79c5('0x18')]+_0x79c5('0x46')]){rpc[_0x57c0c5['channel']+'QueueReport'][_0x79c5('0x47')](_0xe7dbb2,{'UserId':_0x57c0c5[_0x79c5('0x19')][_0x79c5('0x48')]})[_0x79c5('0x49')](function(){logger[_0x79c5('0x3a')]('error\x20update\x20queue\x20report');});}}return _0x270e4a({'code':0xc8,'message':_0x57c0c5});}catch(_0x197c6b){logger[_0x79c5('0x3a')](_0x197c6b['stack']);return _0x4c1d6d(_0xae2135['error'](0x1f4,_0x197c6b));}}logger[_0x79c5('0x3a')](_0x79c5('0x4a'));return _0x4c1d6d(_0xae2135[_0x79c5('0x3a')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x26f9c5){var _0x4a76ec=this;return new Promise(function(_0x1d4c22,_0x276ab4){if(_0x26f9c5[_0x79c5('0x42')]&&_0x26f9c5[_0x79c5('0x42')]['id']){try{if(_0x4df93f[_0x79c5('0x43')][_0x26f9c5[_0x79c5('0x42')]['id']]){_0x4df93f[_0x79c5('0x43')][_0x26f9c5['agent']['id']][_0x79c5('0x44')]=![];_0x4df93f[_0x79c5('0x43')][_0x26f9c5[_0x79c5('0x42')]['id']]['busyQueue']=undefined;}return _0x1d4c22({'code':0xc8,'message':_0x26f9c5});}catch(_0x5430ba){logger['error'](_0x5430ba[_0x79c5('0x4b')]);return _0x276ab4(_0x4a76ec[_0x79c5('0x3a')](0x1f4,_0x5430ba));}}logger['error'](_0x79c5('0x4a'));return _0x276ab4(_0x4a76ec['error'](0x1f4,_0x79c5('0x4a')));});},'AbandonInteraction':function(_0x456b94){var _0x23f26e=this;return new Promise(function(_0x4e8de5,_0x3fdef7){if(_0x456b94[_0x79c5('0x18')]&&_0x456b94[_0x79c5('0x1a')]&&_0x456b94[_0x79c5('0x1a')]['id']){try{var _0x50fe12=getId(_0x456b94[_0x79c5('0x18')],_0x456b94[_0x79c5('0x19')]?_0x456b94[_0x79c5('0x19')]['id']:0x0,_0x456b94[_0x79c5('0x1a')]?_0x456b94[_0x79c5('0x1a')]['id']:0x0);if(_0x4df93f[_0x79c5('0x17')][_0x50fe12]){_0x4df93f['rules'][_0x50fe12][_0x79c5('0x3e')]('end');}return _0x4e8de5({'code':0xc8,'message':_0x456b94});}catch(_0x5a95d7){logger[_0x79c5('0x3a')](_0x5a95d7[_0x79c5('0x4b')]);return _0x3fdef7(_0x23f26e[_0x79c5('0x3a')](0x1f4,_0x5a95d7));}}logger[_0x79c5('0x3a')](_0x79c5('0x4a'));return _0x3fdef7(_0x23f26e[_0x79c5('0x3a')](0x1f4,_0x79c5('0x4a')));});},'AgentCapacity':function(_0x4d5cb2){var _0x30bfc1=this;return new Promise(function(_0x39e44d,_0x989e97){if(_0x4df93f[_0x79c5('0x43')][_0x79c5('0x4c')](_0x4d5cb2['id'])){for(var _0x6f32e in _0x4d5cb2[_0x79c5('0x4d')]){if(_0x4d5cb2[_0x79c5('0x4d')][_0x79c5('0x4c')](_0x6f32e)){if(_0x4df93f['agents'][_0x4d5cb2['id']][_0x79c5('0x4c')](_0x6f32e+_0x79c5('0x4e'))){_0x4df93f['agents'][_0x4d5cb2['id']][_0x6f32e+_0x79c5('0x4e')]=parseInt(_0x4d5cb2[_0x79c5('0x4d')][_0x6f32e],0xa);}}}_0x4df93f[_0x79c5('0x43')][_0x4d5cb2['id']][_0x79c5('0x4f')]();return _0x39e44d({'code':0xc8,'message':_0x4df93f[_0x79c5('0x43')][_0x4d5cb2['id']]});}else{return _0x989e97(_0x30bfc1[_0x79c5('0x3a')](0x1f4,_0x79c5('0x50')));}});},'Agents':function(_0x422a1c){return new Promise(function(_0x354e15){var _0x55960c=_[_0x79c5('0x51')](_0x4df93f[_0x79c5('0x43')]);if(_0x422a1c&&_0x422a1c['id']){var _0x91544f=_['find'](_0x55960c,function(_0x1dde23){return _0x1dde23['id']===_0x422a1c['id'];});_0x354e15(_0x91544f);}else{_0x354e15({'count':_0x55960c[_0x79c5('0x1f')],'rows':_0x55960c});}});},'ChatQueues':function(){return new Promise(function(_0x2fef42){var _0x770778=[];for(var _0x30a027 in _0x4df93f[_0x79c5('0x52')]){if(_0x4df93f[_0x79c5('0x52')][_0x79c5('0x4c')](_0x30a027)){var _0x336032=_0x4df93f[_0x79c5('0x52')][_0x30a027];var _0x407b77={'id':_0x336032['id'],'available':_0x336032[_0x79c5('0x53')],'loggedIn':_0x336032[_0x79c5('0x54')],'name':_0x336032[_0x79c5('0x55')],'paused':_0x336032[_0x79c5('0x56')],'waiting':_0x336032[_0x79c5('0x57')]};_0x770778[_0x79c5('0x25')](_0x407b77);}}_0x2fef42({'count':_0x770778[_0x79c5('0x1f')],'rows':_0x770778});});},'MailQueues':function(){return new Promise(function(_0x2aa94b){var _0x37f1b0=[];for(var _0x48e4e8 in _0x4df93f[_0x79c5('0x58')]){if(_0x4df93f[_0x79c5('0x58')][_0x79c5('0x4c')](_0x48e4e8)){var _0x91cff6=_0x4df93f['mailQueues'][_0x48e4e8];var _0x21f2be={'id':_0x91cff6['id'],'available':_0x91cff6[_0x79c5('0x53')],'loggedIn':_0x91cff6['loggedIn'],'name':_0x91cff6[_0x79c5('0x55')],'paused':_0x91cff6[_0x79c5('0x56')],'waiting':_0x91cff6[_0x79c5('0x57')]};_0x37f1b0[_0x79c5('0x25')](_0x21f2be);}}_0x2aa94b({'count':_0x37f1b0[_0x79c5('0x1f')],'rows':_0x37f1b0});});},'OpenchannelQueues':function(){return new Promise(function(_0x33be99){var _0x45675f=[];for(var _0x5f008c in _0x4df93f[_0x79c5('0x59')]){if(_0x4df93f[_0x79c5('0x59')][_0x79c5('0x4c')](_0x5f008c)){var _0x2bda43=_0x4df93f[_0x79c5('0x59')][_0x5f008c];var _0x2b8bad={'id':_0x2bda43['id'],'available':_0x2bda43[_0x79c5('0x53')],'loggedIn':_0x2bda43['loggedIn'],'name':_0x2bda43[_0x79c5('0x55')],'paused':_0x2bda43[_0x79c5('0x56')],'waiting':_0x2bda43['waiting']};_0x45675f[_0x79c5('0x25')](_0x2b8bad);}}_0x33be99({'count':_0x45675f[_0x79c5('0x1f')],'rows':_0x45675f});});},'SmsQueues':function(){return new Promise(function(_0x2fd7ae){var _0x51f653=[];for(var _0x4792eb in _0x4df93f['smsQueues']){if(_0x4df93f[_0x79c5('0x5a')][_0x79c5('0x4c')](_0x4792eb)){var _0x45ed03=_0x4df93f[_0x79c5('0x5a')][_0x4792eb];var _0x1d4eef={'id':_0x45ed03['id'],'available':_0x45ed03['available'],'loggedIn':_0x45ed03[_0x79c5('0x54')],'name':_0x45ed03[_0x79c5('0x55')],'paused':_0x45ed03['paused'],'waiting':_0x45ed03[_0x79c5('0x57')]};_0x51f653['push'](_0x1d4eef);}}_0x2fd7ae({'count':_0x51f653[_0x79c5('0x1f')],'rows':_0x51f653});});},'FaxQueues':function(){return new Promise(function(_0x5e2901){var _0x3b6116=[];for(var _0xd03cbb in _0x4df93f[_0x79c5('0x5b')]){if(_0x4df93f['faxQueues'][_0x79c5('0x4c')](_0xd03cbb)){var _0x19cd46=_0x4df93f[_0x79c5('0x5b')][_0xd03cbb];var _0x133588={'id':_0x19cd46['id'],'available':_0x19cd46[_0x79c5('0x53')],'loggedIn':_0x19cd46[_0x79c5('0x54')],'name':_0x19cd46['name'],'paused':_0x19cd46[_0x79c5('0x56')],'waiting':_0x19cd46[_0x79c5('0x57')]};_0x3b6116[_0x79c5('0x25')](_0x133588);}}_0x5e2901({'count':_0x3b6116[_0x79c5('0x1f')],'rows':_0x3b6116});});},'WhatsappQueues':function(){return new Promise(function(_0x316ade){var _0x3e1e25=[];for(var _0x3e98d6 in _0x4df93f[_0x79c5('0x5c')]){if(_0x4df93f[_0x79c5('0x5c')][_0x79c5('0x4c')](_0x3e98d6)){var _0x3c3cde=_0x4df93f['whatsappQueues'][_0x3e98d6];var _0x5187bd={'id':_0x3c3cde['id'],'available':_0x3c3cde['available'],'loggedIn':_0x3c3cde['loggedIn'],'name':_0x3c3cde[_0x79c5('0x55')],'paused':_0x3c3cde['paused'],'waiting':_0x3c3cde[_0x79c5('0x57')]};_0x3e1e25[_0x79c5('0x25')](_0x5187bd);}}_0x316ade({'count':_0x3e1e25[_0x79c5('0x1f')],'rows':_0x3e1e25});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x26d6d0){var _0x36f7bf=_['values'](_0x4df93f[_0x79c5('0x5d')]);_0x26d6d0({'count':_0x36f7bf['length'],'rows':_0x36f7bf});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5911e4){var _0xb01b8d=_[_0x79c5('0x51')](_0x4df93f['mailQueuesWaitingInteractions']);_0x5911e4({'count':_0xb01b8d[_0x79c5('0x1f')],'rows':_0xb01b8d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3102e0){var _0x1bec9c=_['values'](_0x4df93f[_0x79c5('0x5e')]);_0x3102e0({'count':_0x1bec9c[_0x79c5('0x1f')],'rows':_0x1bec9c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2e3e1d){var _0x3f90db=_['values'](_0x4df93f[_0x79c5('0x5f')]);_0x2e3e1d({'count':_0x3f90db[_0x79c5('0x1f')],'rows':_0x3f90db});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x19b72c){var _0x4ce1b4=_['values'](_0x4df93f[_0x79c5('0x60')]);_0x19b72c({'count':_0x4ce1b4[_0x79c5('0x1f')],'rows':_0x4ce1b4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x460a8e){var _0x1456b0=_[_0x79c5('0x51')](_0x4df93f[_0x79c5('0x61')]);_0x460a8e({'count':_0x1456b0[_0x79c5('0x1f')],'rows':_0x1456b0});});}};var _0x4b20be=jayson['server'](_0x154a90)['http']();_0x4b20be['on'](_0x79c5('0x3a'),function(_0x4c7eb7){logger[_0x79c5('0x3a')](JSON[_0x79c5('0x3c')](_0x4c7eb7));return _0x555da7(_0x4c7eb7);});_0x4b20be[_0x79c5('0x16')](0x232c,_0x79c5('0x62'),function(){console['log'](_0x79c5('0x63'),0x232c);return _0x2d0410(_0x79c5('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4cd8d1e..0d2caef 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 _0xe5ca=['stop','lodash','../../../utils/iftime','iftime','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xe5ca,0x141));var _0xae5c=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xe5ca[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xae5c('0x0'));var iftime=require(_0xae5c('0x1'))[_0xae5c('0x2')];var logger=require('../../../config/logger')(_0xae5c('0x3'));exports[_0xae5c('0x4')]=function(_0x2e71d2,_0x3e33bb,_0x56556a){return function(_0x22cf01){if(_0x56556a[_0xae5c('0x5')]&&!_0x56556a[_0xae5c('0x5')][_0x2e71d2]){logger[_0xae5c('0x6')](_0xae5c('0x7'),_0x2e71d2);return _0x22cf01['stop']();}var _0x5232c6=_0x3e33bb[_0xae5c('0x8')](function(_0xe034b){return iftime(_0xe034b);});var _0x369e9d=_[_0xae5c('0x9')](_0x5232c6);if(_0x369e9d){logger[_0xae5c('0x6')](_0xae5c('0xa'),_0x2e71d2,_0x3e33bb[_0xae5c('0xb')](_0xae5c('0xc')),_0x369e9d);_0x22cf01[_0xae5c('0xd')](_0x369e9d);}else{logger['info'](_0xae5c('0xe'),_0x2e71d2,_0x3e33bb[_0xae5c('0xb')](_0xae5c('0xc')));_0x22cf01[_0xae5c('0xf')]();}};}; \ No newline at end of file +var _0x7358=['when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join','../../../utils/iftime','iftime','routing','condition','rules','stop','map','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x7358,0xe0));var _0x8735=function(_0x454fcb,_0x5a9e7c){_0x454fcb=_0x454fcb-0x0;var _0x49458d=_0x7358[_0x454fcb];return _0x49458d;};'use strict';var _=require('lodash');var iftime=require(_0x8735('0x0'))[_0x8735('0x1')];var logger=require('../../../config/logger')(_0x8735('0x2'));exports[_0x8735('0x3')]=function(_0x565441,_0x43c876,_0x2a1f27){return function(_0x4a44f6){if(_0x2a1f27[_0x8735('0x4')]&&!_0x2a1f27[_0x8735('0x4')][_0x565441]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x565441);return _0x4a44f6[_0x8735('0x5')]();}var _0x5e8e16=_0x43c876[_0x8735('0x6')](function(_0x46d378){return iftime(_0x46d378);});var _0x43b3af=_['some'](_0x5e8e16);if(_0x43b3af){logger[_0x8735('0x7')](_0x8735('0x8'),_0x565441,_0x43c876['join'](_0x8735('0x9')),_0x43b3af);_0x4a44f6[_0x8735('0xa')](_0x43b3af);}else{logger[_0x8735('0x7')](_0x8735('0xb'),_0x565441,_0x43c876[_0x8735('0xc')](_0x8735('0x9')));_0x4a44f6[_0x8735('0x5')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index af293d7..7f83a82 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 _0x3f8c=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','./utils','info','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent'];(function(_0xc9a9dd,_0x184e67){var _0x321497=function(_0x558ea1){while(--_0x558ea1){_0xc9a9dd['push'](_0xc9a9dd['shift']());}};_0x321497(++_0x184e67);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4aa918,_0x53621f){_0x4aa918=_0x4aa918-0x0;var _0x13c549=_0x3f8c[_0x4aa918];return _0x13c549;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f8('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1f6a,_0x2e70c4){utils[_0xc3f8('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1f6a['uniqueid'],_0x3a1f6a['channel'],_0x3a1f6a['queue'],_0x3a1f6a[_0xc3f8('0x2')],_0x3a1f6a[_0xc3f8('0x3')],_0x3a1f6a[_0xc3f8('0x4')],_0x3a1f6a[_0xc3f8('0x5')],_0x3a1f6a[_0xc3f8('0x6')]));if(_0x3a1f6a[_0xc3f8('0x7')]){utils['getVoiceQueueByName'](_0x3a1f6a[_0xc3f8('0x7')])[_0xc3f8('0x8')](function(_0x15cb3b){if(_0x15cb3b){_0x3a1f6a[_0xc3f8('0x9')]=_0x15cb3b[_0xc3f8('0x9')];_0x3a1f6a[_0xc3f8('0xa')]=_0x3a1f6a[_0xc3f8('0xb')]?_0x15cb3b['acw']:![];_0x3a1f6a[_0xc3f8('0xc')]=_0x3a1f6a[_0xc3f8('0xa')]?_0x15cb3b[_0xc3f8('0xd')]:0x0;}utils[_0xc3f8('0xe')]('CreateVoiceAgentReport',_0x3a1f6a);});}else{utils[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x3a1f6a);}if(_0x2e70c4){delete transfers[_0x3a1f6a[_0xc3f8('0x10')]];}else{delete agents[_0x3a1f6a[_0xc3f8('0x11')]];}}exports['agentcalled']=function(_0x84f489){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x14'),_0x84f489[_0xc3f8('0x10')]),_0x84f489);agents[_0x84f489[_0xc3f8('0x11')]]=_0x84f489;agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x17');agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinenum']=null;agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinename']=null;utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x18'),_0x84f489[_0xc3f8('0x10')],agents[_0x84f489[_0xc3f8('0x11')]]['membername'],_0x84f489[_0xc3f8('0x11')]));}catch(_0x1db809){utils['error'](util[_0xc3f8('0x13')]('[%s][agents][agentcalled]',_0x84f489[_0xc3f8('0x10')]),_0x1db809);}};exports[_0xc3f8('0x19')]=function(_0x3b2e98){try{if(!_['isNil'](agents[_0x3b2e98['destuniqueid']])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98[_0xc3f8('0x10')]),_0x3b2e98);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x1b'),_0x3b2e98[_0xc3f8('0x10')],agents[_0x3b2e98['destuniqueid']]['membername'],_0x3b2e98['destuniqueid']));agents[_0x3b2e98[_0xc3f8('0x11')]]['agentringnoanswer']=!![];agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1c')]=utils['now']();agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1f')]=_0x3b2e98[_0xc3f8('0x20')]?parseInt(_0x3b2e98[_0xc3f8('0x20')])/0x3e8:0x0;agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x21')]=0x0;unanswered[_0xc3f8('0x22')](_0x3b2e98[_0xc3f8('0x11')]);}}catch(_0x59e4dd){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98['uniqueid']),_0x59e4dd);}};exports[_0xc3f8('0x24')]=function(_0x4d39a0){try{_[_0xc3f8('0x25')](agents,function(_0x32343e,_0x47ab53){if(_0x32343e['uniqueid']==_0x4d39a0[_0xc3f8('0x10')]&&!_[_0xc3f8('0x26')](unanswered,_0x32343e[_0xc3f8('0x11')])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0[_0xc3f8('0x10')]),_0x4d39a0);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x28'),_0x4d39a0['uniqueid'],_0x32343e[_0xc3f8('0x2')],_0x32343e[_0xc3f8('0x11')]));_0x32343e[_0xc3f8('0x19')]=!![];_0x32343e[_0xc3f8('0x1c')]=utils[_0xc3f8('0x16')]();_0x32343e['lastevent']='abandoned';_0x32343e[_0xc3f8('0x1e')]=_0xc3f8('0x29');_0x32343e[_0xc3f8('0x1f')]=_0x4d39a0[_0xc3f8('0x1f')];_0x32343e[_0xc3f8('0x21')]=0x0;writeDB(_0x32343e);}});}catch(_0x4e51ac){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0['uniqueid']),_0x4e51ac);}};exports[_0xc3f8('0x2a')]=function(_0x11ecc2){try{if(agents[_0x11ecc2[_0xc3f8('0x11')]]){utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x11ecc2);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x2c'),_0x11ecc2[_0xc3f8('0x10')],agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x11ecc2['destuniqueid']));agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x5')]=_0x11ecc2['connectedlinenum'];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2e')]=_0x11ecc2[_0xc3f8('0x2e')];agents[_0x11ecc2['destuniqueid']][_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x6')]='connect';_[_0xc3f8('0x25')](agents,function(_0x45d416,_0x2df096){if(_0x45d416[_0xc3f8('0x11')]!=_0x11ecc2['destuniqueid']&&_0x45d416[_0xc3f8('0x10')]==_0x11ecc2['uniqueid']){_0x45d416['talktime']=0x0;_0x45d416[_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];_0x45d416[_0xc3f8('0x19')]=!![];_0x45d416[_0xc3f8('0x1c')]=utils['now']();_0x45d416['lastevent']=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x1e')]=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x30')]=_0x11ecc2[_0xc3f8('0x11')];_0x45d416[_0xc3f8('0x31')]=_0x11ecc2[_0xc3f8('0x2')];writeDB(_0x45d416);}});}}catch(_0x45e6ea){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x45e6ea);}};exports[_0xc3f8('0xb')]=function(_0x22e9b3){try{if(!_['isNil'](agents[_0x22e9b3[_0xc3f8('0x11')]])){utils[_0xc3f8('0x12')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0x22e9b3);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x33'),_0x22e9b3[_0xc3f8('0x10')],agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x22e9b3[_0xc3f8('0x11')]));agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0xb')]=!![];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x34')],agents[_0x22e9b3['destuniqueid']]['agentconnectAt']);agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0x22e9b3[_0xc3f8('0x1e')];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x36');writeDB(agents[_0x22e9b3[_0xc3f8('0x11')]]);}}catch(_0xe3d5c4){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0xe3d5c4);}};exports['blindtransfer']=function(_0x1becae){try{if(!_[_0xc3f8('0x37')](agents[_0x1becae[_0xc3f8('0x38')]])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae[_0xc3f8('0x10')]),_0x1becae);utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x3a'),_0x1becae['uniqueid'],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x2')],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')]));agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3b')]=!![];agents[_0x1becae[_0xc3f8('0x38')]]['transfertype']=_0xc3f8('0x3c');agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3d')]=_0x1becae[_0xc3f8('0x3e')];agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3f')]=agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')];}}catch(_0x4fc02c){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae['uniqueid']),_0x4fc02c);}};exports['attendedtransfer']=function(_0x773d56){try{utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x773d56);if(_0x773d56['origtransfereruniqueid']==_0x773d56[_0xc3f8('0x42')]){if(!_['isNil'](agents[_0x773d56['secondtransfereruniqueid']])){utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x44')]]['membername']));agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56['secondtransfereruniqueid']]['transferexten']=_0x773d56[_0xc3f8('0x47')];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3f')]=_0x773d56[_0xc3f8('0x41')];}if(_0x773d56[_0xc3f8('0x48')]&&agents[_0x773d56['transfereeuniqueid']]){agents[_0x773d56[_0xc3f8('0x48')]]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x48')]]=_[_0xc3f8('0x49')](agents[_0x773d56[_0xc3f8('0x48')]]);transfers[_0x773d56[_0xc3f8('0x48')]]['calleridnum']=agents[_0x773d56[_0xc3f8('0x44')]]['calleridnum'];transfers[_0x773d56['transfereeuniqueid']]['calleridname']=agents[_0x773d56['secondtransfereruniqueid']][_0xc3f8('0x4a')];transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x4b')]=0x2;}}else if(_0x773d56[_0xc3f8('0x44')]==_0x773d56[_0xc3f8('0x4c')]){if(!_[_0xc3f8('0x37')](agents[_0x773d56['origtransfereruniqueid']])){utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x41')]]['membername']));agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56[_0xc3f8('0x41')]]['transferexten']=_0x773d56[_0xc3f8('0x4d')];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3f')]=_0x773d56['secondtransfereruniqueid'];}if(_0x773d56[_0xc3f8('0x4e')]&&agents[_0x773d56[_0xc3f8('0x4e')]]){agents[_0x773d56['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x4e')]]=_[_0xc3f8('0x49')](agents[_0x773d56['transfertargetuniqueid']]);transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4')];transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4a')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4a')];transfers[_0x773d56['transfertargetuniqueid']]['agentcalledAt']=utils[_0xc3f8('0x16')]();transfers[_0x773d56['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x773d56['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4b')]=0x2;}}}catch(_0x188d39){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x188d39);}};exports['hangup']=function(_0x3b9b47){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')]('[%s][agents][hangup]',_0x3b9b47[_0xc3f8('0x10')]),_0x3b9b47);if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47['uniqueid']]['reason']===_0xc3f8('0x1d')){if(_0x3b9b47[_0xc3f8('0x4f')]==='21'){agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')]=_0xc3f8('0x50');agents[_0x3b9b47['uniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x50');}utils['info'](util[_0xc3f8('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47[_0xc3f8('0x10')]]['membername'],agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],agents[_0x3b9b47[_0xc3f8('0x10')]]['lastevent']));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);var _0x5de19e=unanswered[_0xc3f8('0x51')](_0x3b9b47['uniqueid']);if(_0x5de19e>-0x1){unanswered[_0xc3f8('0x52')](_0x5de19e,0x1);}}if(transfers[_0x3b9b47[_0xc3f8('0x10')]]){transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0xb')]=!![];transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x21')]=utils['diffTime'](transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]);transfers[_0x3b9b47[_0xc3f8('0x10')]]['reason']=_0xc3f8('0x53');transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],transfers[_0x3b9b47[_0xc3f8('0x10')]]['membername'],transfers[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(transfers[_0x3b9b47[_0xc3f8('0x10')]],!![]);}if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]){agents[_0x3b9b47[_0xc3f8('0x10')]]['agentcomplete']=!![];agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils['now']();agents[_0x3b9b47['uniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x3b9b47['uniqueid']][_0xc3f8('0x34')],agents[_0x3b9b47[_0xc3f8('0x10')]]['agentconnectAt']);agents[_0x3b9b47[_0xc3f8('0x10')]]['reason']=agents[_0x3b9b47[_0xc3f8('0x10')]]['transfer']?_0xc3f8('0x3b'):_0xc3f8('0x53');agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47['uniqueid']]['membername'],agents[_0x3b9b47[_0xc3f8('0x10')]]['reason'],agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);}}catch(_0xfb05eb){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x55'),_0x3b9b47[_0xc3f8('0x10')]),_0xfb05eb);}}; \ No newline at end of file +var _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0xe3cc6f,_0x1ab24e){var _0x33605e=function(_0x206a57){while(--_0x206a57){_0xe3cc6f['push'](_0xe3cc6f['shift']());}};_0x33605e(++_0x1ab24e);}(_0x6cb4,0xff));var _0x46cb=function(_0x30ba88,_0x130e87){_0x30ba88=_0x30ba88-0x0;var _0x58b89a=_0x6cb4[_0x30ba88];return _0x58b89a;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6e72b3c..cb8fe24 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 _0x14e1=['execif','set','gotoif','lastapplication','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','calleridnum','connectedlinenum','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','destinationchannel','channel','answertime','toNumber','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','callerid','xmcs-queue','xmd-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','hangup'];(function(_0x2f7a9b,_0x2a102d){var _0x2cc3ae=function(_0x2e384a){while(--_0x2e384a){_0x2f7a9b['push'](_0x2f7a9b['shift']());}};_0x2cc3ae(++_0x2a102d);}(_0x14e1,0xd0));var _0x114e=function(_0x4eb4ca,_0x46c303){_0x4eb4ca=_0x4eb4ca-0x0;var _0x1d3367=_0x14e1[_0x4eb4ca];return _0x1d3367;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x114e('0x0'));var dispositions=[_0x114e('0x1'),_0x114e('0x2'),_0x114e('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x114e('0x1'),_0x114e('0x3'),'BUSY',_0x114e('0x2'),'FAILED',_0x114e('0x2')];var channels={};function writeDB(_0x97da60){utils[_0x114e('0x4')](util['format'](_0x114e('0x5'),_0x97da60[_0x114e('0x6')],_0x97da60['channel'],_0x97da60[_0x114e('0x7')],_0x97da60['membername'],_0x97da60[_0x114e('0x8')],_0x97da60[_0x114e('0x9')],_0x97da60[_0x114e('0xa')],_0x97da60['lastevent']));if(_0x97da60['accountcode']){utils['getUserByInternal'](_0x97da60['accountcode'])[_0x114e('0xb')](function(_0x3bdb14){if(_0x3bdb14){_0x97da60[_0x114e('0xc')]=_0x3bdb14['id'];}utils[_0x114e('0xd')]('CreateVoiceCallReport',_0x97da60);});}else{utils[_0x114e('0xd')](_0x114e('0xe'),_0x97da60);}if(channels[_0x97da60['uniqueid']]){delete channels[_0x97da60[_0x114e('0x6')]];}}exports[_0x114e('0xf')]=function(_0x3327f8){try{utils[_0x114e('0x10')](util[_0x114e('0x11')]('[%s][calls][newchannel]',_0x3327f8[_0x114e('0x6')]),_0x3327f8);if(_0x3327f8['uniqueid']==_0x3327f8[_0x114e('0x12')]&&_0x3327f8['channel']!='OutgoingSpoolFailed'){utils['info'](util[_0x114e('0x11')](_0x114e('0x13'),_0x3327f8[_0x114e('0x6')],_0x3327f8[_0x114e('0x14')],_0x3327f8[_0x114e('0x15')]));channels[_0x3327f8[_0x114e('0x6')]]={'uniqueid':_0x3327f8[_0x114e('0x6')],'accountcode':_0x3327f8[_0x114e('0x16')],'source':_0x3327f8[_0x114e('0x9')],'destination':_0x3327f8[_0x114e('0x15')],'destinationcontext':_0x3327f8['context'],'channel':_0x3327f8['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x114e('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x50bdd8){utils[_0x114e('0x17')](util['format'](_0x114e('0x18'),_0x3327f8[_0x114e('0x6')]),_0x50bdd8);}};exports[_0x114e('0x19')]=function(_0x4a51f1){try{utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x1a'),_0x4a51f1[_0x114e('0x6')]),_0x4a51f1);if(!_[_0x114e('0x1b')](channels[_0x4a51f1[_0x114e('0x6')]])&&_0x4a51f1[_0x114e('0x1c')]==0x6){utils['info'](util['format'](_0x114e('0x1d'),_0x4a51f1[_0x114e('0x6')],_0x4a51f1[_0x114e('0x14')],_0x4a51f1['channel']));if(_['isNil'](channels[_0x4a51f1[_0x114e('0x6')]][_0x114e('0x1e')])){channels[_0x4a51f1[_0x114e('0x6')]][_0x114e('0x1e')]=utils[_0x114e('0x1f')]();}}else if(!_[_0x114e('0x1b')](channels[_0x4a51f1[_0x114e('0x12')]])&&_0x4a51f1[_0x114e('0x1c')]==0x6&&_0x4a51f1[_0x114e('0x14')]!=_0x114e('0x20')){utils['info'](util[_0x114e('0x11')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4a51f1['uniqueid'],_0x4a51f1[_0x114e('0x12')],_0x4a51f1[_0x114e('0x14')],_0x4a51f1['channel']));channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x16')]=_0x4a51f1[_0x114e('0x16')];channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x21')]=_0x4a51f1[_0x114e('0x22')];if(_['isNil'](channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x23')])){channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x23')]=utils[_0x114e('0x1f')]();}channels[_0x4a51f1[_0x114e('0x12')]]['disposition']=dispositions[_[_0x114e('0x24')](_0x4a51f1[_0x114e('0x1c')])]||_0x114e('0x3');}}catch(_0x17ebe9){utils[_0x114e('0x17')](util['format'](_0x114e('0x1a'),_0x4a51f1[_0x114e('0x6')]),_0x17ebe9);}};exports['hangup']=function(_0x5253b5){try{if(!_[_0x114e('0x1b')](channels[_0x5253b5[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x25'),_0x5253b5[_0x114e('0x6')]),_0x5253b5);if(_[_0x114e('0x1b')](channels[_0x5253b5[_0x114e('0x6')]]['callerid'])){channels[_0x5253b5[_0x114e('0x6')]]['callerid']=_0x5253b5[_0x114e('0x26')]+'\x20<'+_0x5253b5[_0x114e('0x9')]+'>';}utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x27'),_0x5253b5[_0x114e('0x6')],channels[_0x5253b5[_0x114e('0x6')]]['callerid'],_0x5253b5[_0x114e('0x28')]));channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x29')]=utils[_0x114e('0x1f')]();channels[_0x5253b5['uniqueid']]['duration']=utils['diffTime'](channels[_0x5253b5['uniqueid']][_0x114e('0x29')],channels[_0x5253b5['uniqueid']][_0x114e('0x2a')]);channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x2b')]=channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x23')]?utils[_0x114e('0x2c')](channels[_0x5253b5[_0x114e('0x6')]]['endtime'],channels[_0x5253b5['uniqueid']][_0x114e('0x23')]):0x0;writeDB(channels[_0x5253b5['uniqueid']]);}}catch(_0x4c863e){utils['error'](util['format']('[%s][calls][hangup]',_0x5253b5['uniqueid']),_0x4c863e);}};exports[_0x114e('0x2d')]=function(_0x216601){try{if(!_[_0x114e('0x1b')](channels[_0x216601[_0x114e('0x2e')]])){utils[_0x114e('0x10')](util['format'](_0x114e('0x2f'),_0x216601[_0x114e('0x30')]),_0x216601);if(channels[_0x216601['localtwolinkedid']][_0x114e('0x22')]==_0x216601[_0x114e('0x31')]){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x32'),_0x216601['origtransfereruniqueid'],_0x216601[_0x114e('0x2e')],_0x216601['secondtransfererchannel']));channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x21')]=_0x216601['secondtransfererchannel'];channels[_0x216601[_0x114e('0x2e')]]['userfield']=_0x114e('0x33');}else if(channels[_0x216601[_0x114e('0x2e')]]['channel']=_0x216601[_0x114e('0x34')]){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x32'),_0x216601[_0x114e('0x30')],_0x216601['localtwolinkedid'],_0x216601[_0x114e('0x35')]));channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x21')]=_0x216601[_0x114e('0x35')];channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x36')]='_attended';}}}catch(_0x11775d){utils[_0x114e('0x17')](util['format']('[%s][calls][attendedtransfer]',_0x216601['origtransfereruniqueid']),_0x11775d);}};exports[_0x114e('0x37')]=function(_0x202dc2){try{if(!_[_0x114e('0x1b')](channels[_0x202dc2[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x38'),_0x202dc2[_0x114e('0x6')]),_0x202dc2);channels[_0x202dc2['uniqueid']][_0x114e('0x39')]=utils[_0x114e('0x1f')]();utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x202dc2[_0x114e('0x6')],channels[_0x202dc2[_0x114e('0x6')]]['musiconholdstartAt']));}}catch(_0x5013f8){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x38'),_0x202dc2[_0x114e('0x6')]),_0x5013f8);}};exports[_0x114e('0x3a')]=function(_0xfccc8a){try{if(!_[_0x114e('0x1b')](channels[_0xfccc8a[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x3b'),_0xfccc8a[_0x114e('0x6')]),_0xfccc8a);if(!_[_0x114e('0x1b')](channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')])){channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x3c')]+=utils[_0x114e('0x2c')](utils['now'](),channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')]);utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x3d'),_0xfccc8a[_0x114e('0x6')],channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x3c')]));delete channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')];}}}catch(_0x3bbc68){utils[_0x114e('0x17')](util['format'](_0x114e('0x3b'),_0xfccc8a['uniqueid']),_0x3bbc68);}};exports[_0x114e('0x3e')]=function(_0x4c6507){try{if(!_['isNil'](channels[_0x4c6507[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x3f'),_0x4c6507[_0x114e('0x6')]),_0x4c6507);if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x41')])){utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4c6507['uniqueid'],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507['uniqueid']][_0x114e('0x43')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x44')])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x45'),_0x4c6507[_0x114e('0x6')],_0x4c6507['value']));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x46')]=_0x4c6507[_0x114e('0x42')];channels[_0x4c6507['uniqueid']]['callerid']='\x22'+_0x4c6507[_0x114e('0x42')]+'\x22\x20<'+_0x4c6507[_0x114e('0x42')]+'>';}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x47')])||!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-callerid'])){utils['info'](util[_0x114e('0x11')](_0x114e('0x48'),_0x4c6507[_0x114e('0x6')],!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')]['xmd-callerid-preview'])?_0x114e('0x47'):_0x114e('0x49'),_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x4a')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-queue'])||!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x4b')])){utils['info'](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4c6507[_0x114e('0x6')],!_[_0x114e('0x1b')](_0x4c6507['variable'][_0x114e('0x4c')])?_0x114e('0x4c'):_0x114e('0x4b'),_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]]['lastapplication']=_0x114e('0x4d');channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x4e')]=_0x4c6507[_0x114e('0x42')];channels[_0x4c6507[_0x114e('0x6')]]['queue']=!![];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-contactid'])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x4f'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x50')]=_0x4c6507[_0x114e('0x42')];}if(!_['isNil'](_0x4c6507[_0x114e('0x40')]['xmd-cdrtype'])){utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x51')]=_0x4c6507['value'];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['outboundrouteid'])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x52'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x53')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x54')])){utils[_0x114e('0x4')](util['format'](_0x114e('0x55'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x54')]=_0x4c6507[_0x114e('0x42')];}}}catch(_0x3904b9){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x3f'),_0x4c6507[_0x114e('0x6')]),_0x3904b9);}};exports[_0x114e('0x56')]=function(_0x19fe35){try{if(!_[_0x114e('0x1b')](channels[_0x19fe35[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x57'),_0x19fe35[_0x114e('0x6')]),_0x19fe35);utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x19fe35[_0x114e('0x6')],_0x19fe35[_0x114e('0x58')],_0x19fe35[_0x114e('0x59')]));if(_0x19fe35[_0x114e('0x58')][_0x114e('0x5a')]()=='set'&&_[_0x114e('0x5b')](_0x19fe35['appdata'][_0x114e('0x5a')](),_0x114e('0x5c'))){var _0x4dfacf=_0x19fe35[_0x114e('0x59')][_0x114e('0x5d')]('=');var _0x15a3b4=_0x4dfacf[0x0][_0x114e('0x5e')](_0x4dfacf[0x0]['lastIndexOf']('(')+0x1,_0x4dfacf[0x0][_0x114e('0x5f')](')'));var _0x58fa13=_0x4dfacf[0x1];channels[_0x19fe35['uniqueid']][_0x15a3b4]=_0x58fa13;}if(!_[_0x114e('0x60')]([_0x114e('0x61'),'noop',_0x114e('0x62'),_0x114e('0x63'),_0x114e('0x64')],_0x19fe35[_0x114e('0x58')][_0x114e('0x5a')]())){channels[_0x19fe35[_0x114e('0x6')]][_0x114e('0x65')]=_0x19fe35[_0x114e('0x58')];channels[_0x19fe35[_0x114e('0x6')]][_0x114e('0x4e')]=_0x19fe35[_0x114e('0x59')];}}}catch(_0x140b01){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x57'),_0x19fe35[_0x114e('0x6')]),_0x140b01);}}; \ No newline at end of file +var _0x51e5=['[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][hangup]','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','accountcode','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][calls][newstate]','isNil','channelstate'];(function(_0x56aba2,_0x4d4a5f){var _0x39176b=function(_0x5ec995){while(--_0x5ec995){_0x56aba2['push'](_0x56aba2['shift']());}};_0x39176b(++_0x4d4a5f);}(_0x51e5,0x124));var _0x551e=function(_0x2e598b,_0x29442d){_0x2e598b=_0x2e598b-0x0;var _0x5c52c2=_0x51e5[_0x2e598b];return _0x5c52c2;};'use strict';var _=require('lodash');var util=require(_0x551e('0x0'));var utils=require(_0x551e('0x1'));var dispositions=[_0x551e('0x2'),_0x551e('0x3'),_0x551e('0x3'),_0x551e('0x2'),_0x551e('0x2'),_0x551e('0x2'),_0x551e('0x4'),_0x551e('0x5'),_0x551e('0x3'),_0x551e('0x3'),'FAILED'];var channels={};function writeDB(_0x51339a){utils[_0x551e('0x6')](util['format'](_0x551e('0x7'),_0x51339a[_0x551e('0x8')],_0x51339a['channel'],_0x51339a[_0x551e('0x9')],_0x51339a[_0x551e('0xa')],_0x51339a[_0x551e('0xb')],_0x51339a[_0x551e('0xc')],_0x51339a[_0x551e('0xd')],_0x51339a['lastevent']));if(_0x51339a[_0x551e('0xe')]){utils['getUserByInternal'](_0x51339a[_0x551e('0xe')])['then'](function(_0x1dc5d2){if(_0x1dc5d2){_0x51339a['UserId']=_0x1dc5d2['id'];}utils[_0x551e('0xf')]('CreateVoiceCallReport',_0x51339a);});}else{utils['request'](_0x551e('0x10'),_0x51339a);}if(channels[_0x51339a[_0x551e('0x8')]]){delete channels[_0x51339a[_0x551e('0x8')]];}}exports[_0x551e('0x11')]=function(_0x1d1bc7){try{utils[_0x551e('0x12')](util[_0x551e('0x13')](_0x551e('0x14'),_0x1d1bc7[_0x551e('0x8')]),_0x1d1bc7);if(_0x1d1bc7['uniqueid']==_0x1d1bc7[_0x551e('0x15')]&&_0x1d1bc7['channel']!=_0x551e('0x16')){utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x17'),_0x1d1bc7[_0x551e('0x8')],_0x1d1bc7[_0x551e('0x18')],_0x1d1bc7['exten']));channels[_0x1d1bc7[_0x551e('0x8')]]={'uniqueid':_0x1d1bc7[_0x551e('0x8')],'accountcode':_0x1d1bc7['accountcode'],'source':_0x1d1bc7[_0x551e('0xc')],'destination':_0x1d1bc7[_0x551e('0x19')],'destinationcontext':_0x1d1bc7[_0x551e('0x18')],'channel':_0x1d1bc7[_0x551e('0x1a')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x551e('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x578513){utils[_0x551e('0x1b')](util[_0x551e('0x13')](_0x551e('0x14'),_0x1d1bc7[_0x551e('0x8')]),_0x578513);}};exports[_0x551e('0x1c')]=function(_0x2760ac){try{utils['debug'](util[_0x551e('0x13')](_0x551e('0x1d'),_0x2760ac[_0x551e('0x8')]),_0x2760ac);if(!_[_0x551e('0x1e')](channels[_0x2760ac[_0x551e('0x8')]])&&_0x2760ac[_0x551e('0x1f')]==0x6){utils['info'](util[_0x551e('0x13')](_0x551e('0x20'),_0x2760ac[_0x551e('0x8')],_0x2760ac[_0x551e('0x18')],_0x2760ac['channel']));if(_[_0x551e('0x1e')](channels[_0x2760ac['uniqueid']][_0x551e('0x21')])){channels[_0x2760ac[_0x551e('0x8')]][_0x551e('0x21')]=utils[_0x551e('0x22')]();}}else if(!_['isNil'](channels[_0x2760ac[_0x551e('0x15')]])&&_0x2760ac[_0x551e('0x1f')]==0x6&&_0x2760ac[_0x551e('0x18')]!=_0x551e('0x23')){utils['info'](util[_0x551e('0x13')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2760ac[_0x551e('0x8')],_0x2760ac[_0x551e('0x15')],_0x2760ac[_0x551e('0x18')],_0x2760ac['channel']));channels[_0x2760ac[_0x551e('0x15')]]['accountcode']=_0x2760ac['accountcode'];channels[_0x2760ac[_0x551e('0x15')]][_0x551e('0x24')]=_0x2760ac[_0x551e('0x1a')];if(_[_0x551e('0x1e')](channels[_0x2760ac[_0x551e('0x15')]]['answertime'])){channels[_0x2760ac[_0x551e('0x15')]][_0x551e('0x25')]=utils[_0x551e('0x22')]();}channels[_0x2760ac['linkedid']][_0x551e('0x26')]=dispositions[_[_0x551e('0x27')](_0x2760ac[_0x551e('0x1f')])]||_0x551e('0x4');}}catch(_0x15d8f8){utils[_0x551e('0x1b')](util['format'](_0x551e('0x1d'),_0x2760ac[_0x551e('0x8')]),_0x15d8f8);}};exports[_0x551e('0x28')]=function(_0x12d430){try{if(!_[_0x551e('0x1e')](channels[_0x12d430[_0x551e('0x8')]])){utils[_0x551e('0x12')](util[_0x551e('0x13')]('[%s][calls][hangup]',_0x12d430[_0x551e('0x8')]),_0x12d430);if(_[_0x551e('0x1e')](channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x29')])){channels[_0x12d430[_0x551e('0x8')]]['callerid']=_0x12d430[_0x551e('0x2a')]+'\x20<'+_0x12d430['calleridnum']+'>';}utils['info'](util[_0x551e('0x13')](_0x551e('0x2b'),_0x12d430[_0x551e('0x8')],channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x29')],_0x12d430[_0x551e('0x2c')]));channels[_0x12d430[_0x551e('0x8')]]['endtime']=utils[_0x551e('0x22')]();channels[_0x12d430['uniqueid']][_0x551e('0x2d')]=utils[_0x551e('0x2e')](channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x2f')],channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x30')]);channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x31')]=channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x25')]?utils[_0x551e('0x2e')](channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x2f')],channels[_0x12d430[_0x551e('0x8')]][_0x551e('0x25')]):0x0;writeDB(channels[_0x12d430['uniqueid']]);}}catch(_0x291804){utils['error'](util[_0x551e('0x13')](_0x551e('0x32'),_0x12d430[_0x551e('0x8')]),_0x291804);}};exports['attendedtransfer']=function(_0x559bdd){try{if(!_[_0x551e('0x1e')](channels[_0x559bdd[_0x551e('0x33')]])){utils['debug'](util[_0x551e('0x13')]('[%s][calls][attendedtransfer]',_0x559bdd[_0x551e('0x34')]),_0x559bdd);if(channels[_0x559bdd[_0x551e('0x33')]][_0x551e('0x1a')]==_0x559bdd[_0x551e('0x35')]){utils[_0x551e('0x6')](util['format'](_0x551e('0x36'),_0x559bdd['origtransfereruniqueid'],_0x559bdd[_0x551e('0x33')],_0x559bdd[_0x551e('0x37')]));channels[_0x559bdd[_0x551e('0x33')]][_0x551e('0x24')]=_0x559bdd[_0x551e('0x37')];channels[_0x559bdd[_0x551e('0x33')]][_0x551e('0x38')]='_attended';}else if(channels[_0x559bdd[_0x551e('0x33')]]['channel']=_0x559bdd[_0x551e('0x39')]){utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x36'),_0x559bdd[_0x551e('0x34')],_0x559bdd[_0x551e('0x33')],_0x559bdd[_0x551e('0x3a')]));channels[_0x559bdd[_0x551e('0x33')]][_0x551e('0x24')]=_0x559bdd['origtransfererchannel'];channels[_0x559bdd[_0x551e('0x33')]][_0x551e('0x38')]='_attended';}}}catch(_0x1a2e70){utils[_0x551e('0x1b')](util[_0x551e('0x13')](_0x551e('0x3b'),_0x559bdd[_0x551e('0x34')]),_0x1a2e70);}};exports[_0x551e('0x3c')]=function(_0x56a257){try{if(!_[_0x551e('0x1e')](channels[_0x56a257[_0x551e('0x8')]])){utils[_0x551e('0x12')](util[_0x551e('0x13')](_0x551e('0x3d'),_0x56a257[_0x551e('0x8')]),_0x56a257);channels[_0x56a257[_0x551e('0x8')]][_0x551e('0x3e')]=utils['now']();utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x3f'),_0x56a257[_0x551e('0x8')],channels[_0x56a257[_0x551e('0x8')]][_0x551e('0x3e')]));}}catch(_0x35c2fd){utils[_0x551e('0x1b')](util['format'](_0x551e('0x3d'),_0x56a257['uniqueid']),_0x35c2fd);}};exports[_0x551e('0x40')]=function(_0x24373c){try{if(!_['isNil'](channels[_0x24373c[_0x551e('0x8')]])){utils['debug'](util[_0x551e('0x13')](_0x551e('0x41'),_0x24373c['uniqueid']),_0x24373c);if(!_[_0x551e('0x1e')](channels[_0x24373c[_0x551e('0x8')]][_0x551e('0x3e')])){channels[_0x24373c[_0x551e('0x8')]][_0x551e('0x42')]+=utils[_0x551e('0x2e')](utils[_0x551e('0x22')](),channels[_0x24373c[_0x551e('0x8')]]['musiconholdstartAt']);utils['info'](util[_0x551e('0x13')](_0x551e('0x43'),_0x24373c[_0x551e('0x8')],channels[_0x24373c['uniqueid']][_0x551e('0x42')]));delete channels[_0x24373c[_0x551e('0x8')]][_0x551e('0x3e')];}}}catch(_0x4d2351){utils['error'](util['format'](_0x551e('0x41'),_0x24373c[_0x551e('0x8')]),_0x4d2351);}};exports[_0x551e('0x44')]=function(_0x18abee){try{if(!_[_0x551e('0x1e')](channels[_0x18abee[_0x551e('0x8')]])){utils[_0x551e('0x12')](util[_0x551e('0x13')]('[%s][calls][varset]',_0x18abee[_0x551e('0x8')]),_0x18abee);if(!_[_0x551e('0x1e')](_0x18abee['variable']['xmd-originatecalleridnum'])){utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x45'),_0x18abee[_0x551e('0x8')],_0x18abee[_0x551e('0x46')]));channels[_0x18abee['uniqueid']][_0x551e('0x47')]=_0x18abee[_0x551e('0x46')];}if(!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')][_0x551e('0x49')])){utils['info'](util[_0x551e('0x13')](_0x551e('0x4a'),_0x18abee['uniqueid'],_0x18abee[_0x551e('0x46')]));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x4b')]=_0x18abee[_0x551e('0x46')];channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x29')]='\x22'+_0x18abee[_0x551e('0x46')]+_0x551e('0x4c')+_0x18abee[_0x551e('0x46')]+'>';}if(!_['isNil'](_0x18abee[_0x551e('0x48')][_0x551e('0x4d')])||!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')][_0x551e('0x4e')])){utils[_0x551e('0x6')](util[_0x551e('0x13')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x18abee[_0x551e('0x8')],!_[_0x551e('0x1e')](_0x18abee['variable']['xmd-callerid-preview'])?_0x551e('0x4d'):_0x551e('0x4e'),_0x18abee[_0x551e('0x46')]));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x29')]=_0x18abee[_0x551e('0x46')];}if(!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')][_0x551e('0x4f')])||!_[_0x551e('0x1e')](_0x18abee['variable'][_0x551e('0x50')])){utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x51'),_0x18abee[_0x551e('0x8')],!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')][_0x551e('0x4f')])?_0x551e('0x4f'):'xmcs-queue',_0x18abee[_0x551e('0x46')]));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x52')]=_0x551e('0x53');channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x54')]=_0x18abee[_0x551e('0x46')];channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x9')]=!![];}if(!_['isNil'](_0x18abee['variable'][_0x551e('0x55')])){utils[_0x551e('0x6')](util['format'](_0x551e('0x56'),_0x18abee[_0x551e('0x8')],_0x18abee['value']));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x57')]=_0x18abee[_0x551e('0x46')];}if(!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')]['xmd-cdrtype'])){utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x58'),_0x18abee[_0x551e('0x8')],_0x18abee[_0x551e('0x46')]));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x59')]=_0x18abee[_0x551e('0x46')];}if(!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')]['outboundrouteid'])){utils[_0x551e('0x6')](util[_0x551e('0x13')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x18abee[_0x551e('0x8')],_0x18abee[_0x551e('0x46')]));channels[_0x18abee['uniqueid']][_0x551e('0x5a')]=_0x18abee[_0x551e('0x46')];}if(!_[_0x551e('0x1e')](_0x18abee[_0x551e('0x48')][_0x551e('0x5b')])){utils[_0x551e('0x6')](util[_0x551e('0x13')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x18abee['uniqueid'],_0x18abee['value']));channels[_0x18abee[_0x551e('0x8')]][_0x551e('0x5b')]=_0x18abee[_0x551e('0x46')];}}}catch(_0x3344fe){utils['error'](util[_0x551e('0x13')](_0x551e('0x5c'),_0x18abee[_0x551e('0x8')]),_0x3344fe);}};exports['newexten']=function(_0x532ed3){try{if(!_[_0x551e('0x1e')](channels[_0x532ed3['uniqueid']])){utils['debug'](util[_0x551e('0x13')](_0x551e('0x5d'),_0x532ed3['uniqueid']),_0x532ed3);utils[_0x551e('0x6')](util[_0x551e('0x13')](_0x551e('0x5e'),_0x532ed3[_0x551e('0x8')],_0x532ed3[_0x551e('0x5f')],_0x532ed3['appdata']));if(_0x532ed3[_0x551e('0x5f')][_0x551e('0x60')]()==_0x551e('0x61')&&_[_0x551e('0x62')](_0x532ed3[_0x551e('0x63')][_0x551e('0x60')](),_0x551e('0x64'))){var _0x3bc169=_0x532ed3[_0x551e('0x63')][_0x551e('0x65')]('=');var _0x3dc908=_0x3bc169[0x0][_0x551e('0x66')](_0x3bc169[0x0][_0x551e('0x67')]('(')+0x1,_0x3bc169[0x0][_0x551e('0x67')](')'));var _0x13758=_0x3bc169[0x1];channels[_0x532ed3[_0x551e('0x8')]][_0x3dc908]=_0x13758;}if(!_[_0x551e('0x68')](['hangup',_0x551e('0x69'),_0x551e('0x6a'),_0x551e('0x61'),_0x551e('0x6b')],_0x532ed3[_0x551e('0x5f')][_0x551e('0x60')]())){channels[_0x532ed3['uniqueid']]['lastapplication']=_0x532ed3['application'];channels[_0x532ed3['uniqueid']][_0x551e('0x54')]=_0x532ed3['appdata'];}}}catch(_0x28182b){utils[_0x551e('0x1b')](util[_0x551e('0x13')](_0x551e('0x5d'),_0x532ed3[_0x551e('0x8')]),_0x28182b);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index da841d1..7d42e88 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 _0xd4ab=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x404deb,_0x700f79){var _0x41b21e=function(_0x52eb51){while(--_0x52eb51){_0x404deb['push'](_0x404deb['shift']());}};_0x41b21e(++_0x700f79);}(_0xd4ab,0x112));var _0xbd4a=function(_0x439ab1,_0x7c2913){_0x439ab1=_0x439ab1-0x0;var _0x500ea1=_0xd4ab[_0x439ab1];return _0x500ea1;};'use strict';var utils=require('./utils');exports[_0xbd4a('0x0')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0x2'));};exports[_0xbd4a('0x3')]=function(){utils['info'](_0xbd4a('0x4'));};exports[_0xbd4a('0x5')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0x6'));};exports['error']=function(_0x1ace15){utils[_0xbd4a('0x7')](_0xbd4a('0x8'),_0x1ace15);};exports[_0xbd4a('0x9')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0xa'));};exports[_0xbd4a('0xb')]=function(_0x3705e6){}; \ No newline at end of file +var _0x0012=['error','[core]\x20error','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x1fb038,_0xc3f69b){var _0x1600dc=function(_0x2a040e){while(--_0x2a040e){_0x1fb038['push'](_0x1fb038['shift']());}};_0x1600dc(++_0xc3f69b);}(_0x0012,0x111));var _0x2001=function(_0x94181e,_0x5f5a18){_0x94181e=_0x94181e-0x0;var _0x3582da=_0x0012[_0x94181e];return _0x3582da;};'use strict';var utils=require('./utils');exports[_0x2001('0x0')]=function(){utils[_0x2001('0x1')](_0x2001('0x2'));};exports['shutdown']=function(){utils[_0x2001('0x1')](_0x2001('0x3'));};exports[_0x2001('0x4')]=function(){utils[_0x2001('0x1')](_0x2001('0x5'));};exports[_0x2001('0x6')]=function(_0x39e632){utils[_0x2001('0x6')](_0x2001('0x7'),_0x39e632);};exports['close']=function(){utils[_0x2001('0x1')]('[core]\x20close');};exports[_0x2001('0x8')]=function(_0x10d12f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0df1219..963c019 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 _0x8bac=['toLowerCase','startsWith','appdata','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','answertime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8bac,0x177));var _0xc8ba=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x8bac[_0x3d34da];return _0xcf6af8;};'use strict';var _=require(_0xc8ba('0x0'));var util=require(_0xc8ba('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x32e0cb){utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x4'),_0x32e0cb['uniqueid'],_0x32e0cb[_0xc8ba('0x5')],_0x32e0cb[_0xc8ba('0x6')],_0x32e0cb[_0xc8ba('0x7')],_0x32e0cb[_0xc8ba('0x8')],_0x32e0cb['dialstatus']));utils[_0xc8ba('0x9')](_0xc8ba('0xa'),_0x32e0cb);delete dials[_0x32e0cb[_0xc8ba('0xb')]];}exports[_0xc8ba('0xc')]=function(_0x337e3c){try{utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0xe'),_0x337e3c[_0xc8ba('0xb')]),_0x337e3c);utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0xf'),_0x337e3c[_0xc8ba('0xb')],_0x337e3c[_0xc8ba('0x10')],_0x337e3c['appdata']));if(_0x337e3c[_0xc8ba('0x10')][_0xc8ba('0x11')]()=='set'&&_[_0xc8ba('0x12')](_0x337e3c[_0xc8ba('0x13')]['toLowerCase'](),'cdr(routeid)')){var _0x377184=_0x337e3c[_0xc8ba('0x13')]['split']('=');dials[_0x337e3c[_0xc8ba('0xb')]]={'routeId':_0x377184[0x1]};}}catch(_0x58121b){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0xe'),_0x337e3c[_0xc8ba('0xb')]),_0x58121b);}};exports['varset']=function(_0x468cbf){try{utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x15'),_0x468cbf[_0xc8ba('0xb')]),_0x468cbf);if(!_[_0xc8ba('0x16')](_0x468cbf['variable'][_0xc8ba('0x17')])){utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x18'),_0x468cbf['uniqueid'],_0x468cbf[_0xc8ba('0x19')]));dials[_0x468cbf[_0xc8ba('0xb')]]={'routeId':_0x468cbf[_0xc8ba('0x19')]};}}catch(_0x3771ec){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x15'),_0x468cbf['uniqueid']),_0x3771ec);}};exports[_0xc8ba('0x1a')]=function(_0x54a0f2){try{if(!_[_0xc8ba('0x16')](dials[_0x54a0f2[_0xc8ba('0xb')]])){utils['debug'](util[_0xc8ba('0x3')]('[%s][dials][dialbegin]',_0x54a0f2['uniqueid']),_0x54a0f2);dials[_0x54a0f2[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x54a0f2[_0xc8ba('0xb')]],_0x54a0f2);dials[_0x54a0f2['uniqueid']][_0xc8ba('0x1c')]=utils['now']();dials[_0x54a0f2[_0xc8ba('0xb')]]['lastevent']='called';utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x1d'),_0x54a0f2['uniqueid'],dials[_0x54a0f2[_0xc8ba('0xb')]][_0xc8ba('0x1c')]));}}catch(_0x1b613c){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x1e'),_0x54a0f2['uniqueid']),_0x1b613c);}};exports[_0xc8ba('0x1f')]=function(_0x31ffd6){try{if(!_[_0xc8ba('0x16')](dials[_0x31ffd6['uniqueid']])){utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x20'),_0x31ffd6[_0xc8ba('0xb')]),_0x31ffd6);dials[_0x31ffd6[_0xc8ba('0xb')]][_0xc8ba('0x21')]=_0x31ffd6['dialstatus'];if(_0x31ffd6[_0xc8ba('0x21')]=='ANSWER'){dials[_0x31ffd6[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x31ffd6[_0xc8ba('0xb')]],_0x31ffd6);dials[_0x31ffd6[_0xc8ba('0xb')]]['answertime']=utils[_0xc8ba('0x22')]();dials[_0x31ffd6[_0xc8ba('0xb')]][_0xc8ba('0x23')]=_0xc8ba('0x24');utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x25'),_0x31ffd6[_0xc8ba('0xb')],_0x31ffd6[_0xc8ba('0x21')],dials[_0x31ffd6['uniqueid']]['answertime']));}else{utils['info'](util[_0xc8ba('0x3')](_0xc8ba('0x26'),_0x31ffd6[_0xc8ba('0xb')],_0x31ffd6[_0xc8ba('0x21')]));}}}catch(_0x37d31e){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x20'),_0x31ffd6[_0xc8ba('0xb')]),_0x37d31e);}};exports[_0xc8ba('0x27')]=function(_0x16e450){try{if(!_[_0xc8ba('0x16')](dials[_0x16e450['uniqueid']])){utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x28'),_0x16e450[_0xc8ba('0xb')]),_0x16e450);utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x29'),_0x16e450[_0xc8ba('0xb')],_0x16e450[_0xc8ba('0x7')],_0x16e450[_0xc8ba('0x2a')],_0x16e450['cause-txt']));dials[_0x16e450[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x16e450[_0xc8ba('0xb')]],{'endtime':utils[_0xc8ba('0x22')](),'lastevent':_0xc8ba('0x2b')});dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2c')]=utils[_0xc8ba('0x2d')](dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]]['starttime']);dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2f')]=utils[_0xc8ba('0x2d')](dials[_0x16e450[_0xc8ba('0xb')]]['answertime']||dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x1c')]);dials[_0x16e450['uniqueid']]['billableseconds']=dials[_0x16e450['uniqueid']][_0xc8ba('0x30')]?utils['diffTime'](dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x30')]):0x0;writeDB(dials[_0x16e450['uniqueid']]);}}catch(_0x29f18c){utils['error'](util[_0xc8ba('0x3')]('[%s][dials][hangup]',_0x16e450[_0xc8ba('0xb')]),_0x29f18c);}}; \ No newline at end of file +var _0xffee=['[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','[%s][dials][dialbegin]','now','lastevent','starttime','dialend','ANSWER','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xffee,0xfe));var _0xeffe=function(_0x471bc9,_0x79f788){_0x471bc9=_0x471bc9-0x0;var _0x3ec800=_0xffee[_0x471bc9];return _0x3ec800;};'use strict';var _=require(_0xeffe('0x0'));var util=require(_0xeffe('0x1'));var utils=require(_0xeffe('0x2'));var dials={};function writeDB(_0x3375f0){utils[_0xeffe('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3375f0[_0xeffe('0x4')],_0x3375f0[_0xeffe('0x5')],_0x3375f0['dialstring'],_0x3375f0[_0xeffe('0x6')],_0x3375f0['connectedlinenum'],_0x3375f0[_0xeffe('0x7')]));utils[_0xeffe('0x8')](_0xeffe('0x9'),_0x3375f0);delete dials[_0x3375f0[_0xeffe('0x4')]];}exports['newexten']=function(_0x2ab3d8){try{utils[_0xeffe('0xa')](util[_0xeffe('0xb')]('[%s][dials][newexten]',_0x2ab3d8['uniqueid']),_0x2ab3d8);utils['info'](util['format'](_0xeffe('0xc'),_0x2ab3d8[_0xeffe('0x4')],_0x2ab3d8[_0xeffe('0xd')],_0x2ab3d8[_0xeffe('0xe')]));if(_0x2ab3d8[_0xeffe('0xd')]['toLowerCase']()==_0xeffe('0xf')&&_[_0xeffe('0x10')](_0x2ab3d8[_0xeffe('0xe')][_0xeffe('0x11')](),'cdr(routeid)')){var _0x2060e6=_0x2ab3d8[_0xeffe('0xe')][_0xeffe('0x12')]('=');dials[_0x2ab3d8[_0xeffe('0x4')]]={'routeId':_0x2060e6[0x1]};}}catch(_0x2aaad2){utils['error'](util['format'](_0xeffe('0x13'),_0x2ab3d8[_0xeffe('0x4')]),_0x2aaad2);}};exports[_0xeffe('0x14')]=function(_0x50f7b7){try{utils[_0xeffe('0xa')](util[_0xeffe('0xb')](_0xeffe('0x15'),_0x50f7b7[_0xeffe('0x4')]),_0x50f7b7);if(!_['isNil'](_0x50f7b7[_0xeffe('0x16')]['outboundrouteid'])){utils['info'](util[_0xeffe('0xb')](_0xeffe('0x17'),_0x50f7b7[_0xeffe('0x4')],_0x50f7b7[_0xeffe('0x18')]));dials[_0x50f7b7['uniqueid']]={'routeId':_0x50f7b7[_0xeffe('0x18')]};}}catch(_0x40417e){utils[_0xeffe('0x19')](util[_0xeffe('0xb')](_0xeffe('0x15'),_0x50f7b7[_0xeffe('0x4')]),_0x40417e);}};exports[_0xeffe('0x1a')]=function(_0x85d0b6){try{if(!_[_0xeffe('0x1b')](dials[_0x85d0b6[_0xeffe('0x4')]])){utils[_0xeffe('0xa')](util['format'](_0xeffe('0x1c'),_0x85d0b6[_0xeffe('0x4')]),_0x85d0b6);dials[_0x85d0b6['uniqueid']]=_['assign'](dials[_0x85d0b6['uniqueid']],_0x85d0b6);dials[_0x85d0b6[_0xeffe('0x4')]]['starttime']=utils[_0xeffe('0x1d')]();dials[_0x85d0b6[_0xeffe('0x4')]][_0xeffe('0x1e')]='called';utils[_0xeffe('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x85d0b6[_0xeffe('0x4')],dials[_0x85d0b6[_0xeffe('0x4')]][_0xeffe('0x1f')]));}}catch(_0x35acfa){utils[_0xeffe('0x19')](util[_0xeffe('0xb')](_0xeffe('0x1c'),_0x85d0b6['uniqueid']),_0x35acfa);}};exports[_0xeffe('0x20')]=function(_0x4e436c){try{if(!_[_0xeffe('0x1b')](dials[_0x4e436c['uniqueid']])){utils[_0xeffe('0xa')](util[_0xeffe('0xb')]('[%s][dials][dialend]',_0x4e436c[_0xeffe('0x4')]),_0x4e436c);dials[_0x4e436c['uniqueid']][_0xeffe('0x7')]=_0x4e436c['dialstatus'];if(_0x4e436c['dialstatus']==_0xeffe('0x21')){dials[_0x4e436c[_0xeffe('0x4')]]=_[_0xeffe('0x22')](dials[_0x4e436c['uniqueid']],_0x4e436c);dials[_0x4e436c[_0xeffe('0x4')]][_0xeffe('0x23')]=utils['now']();dials[_0x4e436c[_0xeffe('0x4')]][_0xeffe('0x1e')]='connect';utils[_0xeffe('0x3')](util[_0xeffe('0xb')](_0xeffe('0x24'),_0x4e436c['uniqueid'],_0x4e436c[_0xeffe('0x7')],dials[_0x4e436c[_0xeffe('0x4')]][_0xeffe('0x23')]));}else{utils['info'](util[_0xeffe('0xb')](_0xeffe('0x25'),_0x4e436c['uniqueid'],_0x4e436c[_0xeffe('0x7')]));}}}catch(_0x22895f){utils['error'](util[_0xeffe('0xb')](_0xeffe('0x26'),_0x4e436c[_0xeffe('0x4')]),_0x22895f);}};exports[_0xeffe('0x27')]=function(_0x153267){try{if(!_[_0xeffe('0x1b')](dials[_0x153267['uniqueid']])){utils[_0xeffe('0xa')](util[_0xeffe('0xb')](_0xeffe('0x28'),_0x153267[_0xeffe('0x4')]),_0x153267);utils['info'](util[_0xeffe('0xb')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x153267[_0xeffe('0x4')],_0x153267['calleridnum'],_0x153267[_0xeffe('0x29')],_0x153267[_0xeffe('0x2a')]));dials[_0x153267[_0xeffe('0x4')]]=_[_0xeffe('0x22')](dials[_0x153267['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xeffe('0x2b')});dials[_0x153267['uniqueid']][_0xeffe('0x2c')]=utils[_0xeffe('0x2d')](dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x2e')],dials[_0x153267['uniqueid']][_0xeffe('0x1f')]);dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x2f')]=utils[_0xeffe('0x2d')](dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x23')]||dials[_0x153267['uniqueid']]['endtime'],dials[_0x153267['uniqueid']][_0xeffe('0x1f')]);dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x30')]=dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x23')]?utils['diffTime'](dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x2e')],dials[_0x153267[_0xeffe('0x4')]][_0xeffe('0x23')]):0x0;writeDB(dials[_0x153267[_0xeffe('0x4')]]);}}catch(_0x4693e6){utils[_0xeffe('0x19')](util[_0xeffe('0xb')](_0xeffe('0x28'),_0x153267[_0xeffe('0x4')]),_0x4693e6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9bd8799..1b1245a 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 _0xed58=['[%s][index][dialend]','../../config/environment','./utils','util','disabled','xdr','env','production','local','asterisk','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend'];(function(_0x596ee2,_0x12009a){var _0x1d22ea=function(_0x50a31d){while(--_0x50a31d){_0x596ee2['push'](_0x596ee2['shift']());}};_0x1d22ea(++_0x12009a);}(_0xed58,0x85));var _0x8ed5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xed58[_0x465028];return _0xb783d4;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8ed5('0x0'));var utils=require(_0x8ed5('0x1'));var util=require(_0x8ed5('0x2'));var isXDREnabled=config['xdr']&&config['xdr'][_0x8ed5('0x3')]?!config[_0x8ed5('0x4')]['disabled']:!![];var isProduction=config[_0x8ed5('0x5')]===_0x8ed5('0x6')||![];var isLocalAsterisk=config[_0x8ed5('0x4')]&&config[_0x8ed5('0x4')][_0x8ed5('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x8ed5('0x8')]['port'],config[_0x8ed5('0x8')]['ip'],config[_0x8ed5('0x8')]['username'],config[_0x8ed5('0x8')]['password'],!![]);ami[_0x8ed5('0x9')]();if(!isXDREnabled){utils[_0x8ed5('0xa')](_0x8ed5('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8ed5('0xa')](_0x8ed5('0xc'));}else{var agents=require(_0x8ed5('0xd'));var calls=require('./calls.controller');var queues=require(_0x8ed5('0xe'));var recordings=require(_0x8ed5('0xf'));var members=require('./members.controller');var dials=require(_0x8ed5('0x10'));var transfers=require(_0x8ed5('0x11'));var core=require(_0x8ed5('0x12'));ami['on'](_0x8ed5('0x13'),core[_0x8ed5('0x13')]);ami['on'](_0x8ed5('0x14'),core[_0x8ed5('0x14')]);ami['on']('fullybooted',core[_0x8ed5('0x15')]);ami['on'](_0x8ed5('0x16'),core[_0x8ed5('0x16')]);ami['on'](_0x8ed5('0x17'),core[_0x8ed5('0x17')]);ami['on'](_0x8ed5('0x18'),core[_0x8ed5('0x18')]);ami['on']('devicestatechange',function(_0x187b09){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x1b'),_0x187b09[_0x8ed5('0x1c')]),_0x187b09);members['devicestatechange'](_0x187b09);}catch(_0x1f4ee1){utils[_0x8ed5('0x16')](util['format']('[%s][index][devicestatechange]',_0x187b09[_0x8ed5('0x1c')]),_0x1f4ee1);}});ami['on']('agentcalled',function(_0x47db5b){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][agentcalled]',_0x47db5b[_0x8ed5('0x1d')]),_0x47db5b);agents[_0x8ed5('0x1e')](_0x47db5b);}catch(_0x4e2721){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x1f'),_0x47db5b[_0x8ed5('0x1d')]),_0x4e2721);}});ami['on'](_0x8ed5('0x20'),function(_0x1faf72){try{utils['debug'](util['format'](_0x8ed5('0x21'),_0x1faf72[_0x8ed5('0x1d')]),_0x1faf72);agents['agentringnoanswer'](_0x1faf72);}catch(_0x1688c0){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x21'),_0x1faf72['uniqueid']),_0x1688c0);}});ami['on'](_0x8ed5('0x22'),function(_0x3c212a){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][agentconnect]',_0x3c212a['uniqueid']),_0x3c212a);agents[_0x8ed5('0x22')](_0x3c212a);queues[_0x8ed5('0x22')](_0x3c212a);}catch(_0x4f3e25){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][agentconnect]',_0x3c212a[_0x8ed5('0x1d')]),_0x4f3e25);}});ami['on'](_0x8ed5('0x23'),function(_0x52bfa8){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x24'),_0x52bfa8[_0x8ed5('0x1d')]),_0x52bfa8);agents['agentcomplete'](_0x52bfa8);queues['agentcomplete'](_0x52bfa8);members[_0x8ed5('0x23')](_0x52bfa8);}catch(_0x448cbd){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x24'),_0x52bfa8['uniqueid']),_0x448cbd);}});ami['on'](_0x8ed5('0x25'),function(_0x1b83af){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x26'),_0x1b83af[_0x8ed5('0x1d')]),_0x1b83af);agents['queuecallerabandon'](_0x1b83af);queues[_0x8ed5('0x25')](_0x1b83af);}catch(_0x2355e2){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x26'),_0x1b83af[_0x8ed5('0x1d')]),_0x2355e2);}});ami['on'](_0x8ed5('0x27'),function(_0x120b57){try{utils['debug'](util['format'](_0x8ed5('0x28'),_0x120b57['uniqueid']),_0x120b57);queues[_0x8ed5('0x27')](_0x120b57);recordings[_0x8ed5('0x27')](_0x120b57);}catch(_0x5f3767){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][queuecallerjoin]',_0x120b57[_0x8ed5('0x1d')]),_0x5f3767);}});ami['on'](_0x8ed5('0x29'),function(_0xabd1ff){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x2a'),_0xabd1ff[_0x8ed5('0x1d')]),_0xabd1ff);queues[_0x8ed5('0x29')](_0xabd1ff);}catch(_0x4ad7a8){utils[_0x8ed5('0x16')](util['format']('[%s][index][queuecallerleave]',_0xabd1ff['uniqueid']),_0x4ad7a8);}});ami['on'](_0x8ed5('0x2b'),function(_0x193380){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x2c'),_0x193380['uniqueid']),_0x193380);queues[_0x8ed5('0x2b')](_0x193380);calls[_0x8ed5('0x2b')](_0x193380);}catch(_0x27adde){utils[_0x8ed5('0x16')](util['format']('[%s][index][musiconholdstart]',_0x193380[_0x8ed5('0x1d')]),_0x27adde);}});ami['on']('musiconholdstop',function(_0x4a0274){try{utils['debug'](util['format']('[%s][index][musiconholdstop]',_0x4a0274[_0x8ed5('0x1d')]),_0x4a0274);queues['musiconholdstop'](_0x4a0274);calls[_0x8ed5('0x2d')](_0x4a0274);}catch(_0x3b49ab){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x2e'),_0x4a0274[_0x8ed5('0x1d')]),_0x3b49ab);}});ami['on'](_0x8ed5('0x2f'),function(_0x556745){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][newstate]',_0x556745[_0x8ed5('0x1d')]),_0x556745);calls['newstate'](_0x556745);recordings[_0x8ed5('0x2f')](_0x556745);}catch(_0x55ad87){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x30'),_0x556745[_0x8ed5('0x1d')]),_0x55ad87);}});ami['on'](_0x8ed5('0x31'),function(_0xfd24b2){try{utils['debug'](util[_0x8ed5('0x1a')]('[%s][index][hangup]',_0xfd24b2[_0x8ed5('0x1d')]),_0xfd24b2);calls[_0x8ed5('0x31')](_0xfd24b2);recordings['hangup'](_0xfd24b2);dials[_0x8ed5('0x31')](_0xfd24b2);agents[_0x8ed5('0x31')](_0xfd24b2);queues['hangup'](_0xfd24b2);}catch(_0x5b1b09){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x32'),_0xfd24b2['uniqueid']),_0x5b1b09);}});ami['on'](_0x8ed5('0x33'),function(_0x312cd0){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x34'),_0x312cd0['uniqueid']),_0x312cd0);members['cdr'](_0x312cd0);}catch(_0x25bf18){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x34'),_0x312cd0[_0x8ed5('0x1d')]),_0x25bf18);}});ami['on']('blindtransfer',function(_0x19c533){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x35'),_0x19c533[_0x8ed5('0x1d')]),_0x19c533);queues[_0x8ed5('0x36')](_0x19c533);agents[_0x8ed5('0x36')](_0x19c533);transfers[_0x8ed5('0x36')](_0x19c533);}catch(_0x55dc57){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x35'),_0x19c533['uniqueid']),_0x55dc57);}});ami['on'](_0x8ed5('0x37'),function(_0x6257dc){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x38'),_0x6257dc['origtransfereruniqueid']),_0x6257dc);queues[_0x8ed5('0x37')](_0x6257dc);transfers[_0x8ed5('0x37')](_0x6257dc);agents[_0x8ed5('0x37')](_0x6257dc);calls[_0x8ed5('0x37')](_0x6257dc);}catch(_0x45433b){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x38'),_0x6257dc['origtransfereruniqueid']),_0x45433b);}});ami['on'](_0x8ed5('0x39'),function(_0x48bd9d){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][varset]',_0x48bd9d[_0x8ed5('0x1d')]),_0x48bd9d);queues[_0x8ed5('0x39')](_0x48bd9d);recordings[_0x8ed5('0x39')](_0x48bd9d);calls[_0x8ed5('0x39')](_0x48bd9d);dials[_0x8ed5('0x39')](_0x48bd9d);}catch(_0x2808a8){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x3a'),_0x48bd9d[_0x8ed5('0x1d')]),_0x2808a8);}});ami['on'](_0x8ed5('0x3b'),function(_0x141dae){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x3c'),_0x141dae['uniqueid']),_0x141dae);calls[_0x8ed5('0x3b')](_0x141dae);recordings[_0x8ed5('0x3b')](_0x141dae);dials[_0x8ed5('0x3b')](_0x141dae);}catch(_0x4cff35){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x3c'),_0x141dae[_0x8ed5('0x1d')]),_0x4cff35);}});ami['on'](_0x8ed5('0x3d'),function(_0x4a7ae7){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x3e'),_0x4a7ae7[_0x8ed5('0x1d')]),_0x4a7ae7);calls[_0x8ed5('0x3d')](_0x4a7ae7);recordings[_0x8ed5('0x3d')](_0x4a7ae7);}catch(_0x5bc8de){utils['error'](util[_0x8ed5('0x1a')]('[%s][index][newchannel]',_0x4a7ae7[_0x8ed5('0x1d')]),_0x5bc8de);}});ami['on']('dialbegin',function(_0x51e57d){try{utils['debug'](util[_0x8ed5('0x1a')]('[%s][index][dialbegin]',_0x51e57d[_0x8ed5('0x1d')]),_0x51e57d);dials[_0x8ed5('0x3f')](_0x51e57d);}catch(_0x35f3b9){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s]dialbegin',_0x51e57d['uniqueid']),_0x35f3b9);}});ami['on'](_0x8ed5('0x40'),function(_0x41b53d){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x41'),_0x41b53d[_0x8ed5('0x1d')]),_0x41b53d);dials['dialend'](_0x41b53d);}catch(_0xe442bb){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][dialend]',_0x41b53d[_0x8ed5('0x1d')]),_0xe442bb);}});} \ No newline at end of file +var _0x3f8c=['hangup','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][newexten]','newexten','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','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]'];(function(_0xe178b9,_0x1e68f1){var _0x3429d7=function(_0x5121f8){while(--_0x5121f8){_0xe178b9['push'](_0xe178b9['shift']());}};_0x3429d7(++_0x1e68f1);}(_0x3f8c,0xdf));var _0xc3f8=function(_0x3a540a,_0x567845){_0x3a540a=_0x3a540a-0x0;var _0x470024=_0x3f8c[_0x3a540a];return _0x470024;};var AsteriskManager=require('asterisk-manager');var config=require(_0xc3f8('0x0'));var utils=require(_0xc3f8('0x1'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0xc3f8('0x2')][_0xc3f8('0x3')]?!config[_0xc3f8('0x2')][_0xc3f8('0x3')]:!![];var isProduction=config[_0xc3f8('0x4')]===_0xc3f8('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xc3f8('0x2')][_0xc3f8('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xc3f8('0x7')],config[_0xc3f8('0x8')]['ip'],config[_0xc3f8('0x8')][_0xc3f8('0x9')],config[_0xc3f8('0x8')][_0xc3f8('0xa')],!![]);ami[_0xc3f8('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xc3f8('0xc')](_0xc3f8('0xd'));}else{var agents=require(_0xc3f8('0xe'));var calls=require(_0xc3f8('0xf'));var queues=require(_0xc3f8('0x10'));var recordings=require(_0xc3f8('0x11'));var members=require('./members.controller');var dials=require(_0xc3f8('0x12'));var transfers=require(_0xc3f8('0x13'));var core=require(_0xc3f8('0x14'));ami['on'](_0xc3f8('0x15'),core[_0xc3f8('0x15')]);ami['on'](_0xc3f8('0x16'),core[_0xc3f8('0x16')]);ami['on'](_0xc3f8('0x17'),core[_0xc3f8('0x17')]);ami['on']('error',core[_0xc3f8('0x18')]);ami['on'](_0xc3f8('0x19'),core[_0xc3f8('0x19')]);ami['on']('managerevent',core[_0xc3f8('0x1a')]);ami['on'](_0xc3f8('0x1b'),function(_0x3b6cde){try{utils['debug'](util['format'](_0xc3f8('0x1c'),_0x3b6cde[_0xc3f8('0x1d')]),_0x3b6cde);members['devicestatechange'](_0x3b6cde);}catch(_0x240b95){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x1c'),_0x3b6cde['device']),_0x240b95);}});ami['on'](_0xc3f8('0x1f'),function(_0x4358f5){try{utils['debug'](util['format'](_0xc3f8('0x20'),_0x4358f5[_0xc3f8('0x21')]),_0x4358f5);agents['agentcalled'](_0x4358f5);}catch(_0x4da916){utils[_0xc3f8('0x18')](util['format']('[%s][index][agentcalled]',_0x4358f5['uniqueid']),_0x4da916);}});ami['on'](_0xc3f8('0x22'),function(_0xaf53d7){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x24'),_0xaf53d7[_0xc3f8('0x21')]),_0xaf53d7);agents['agentringnoanswer'](_0xaf53d7);}catch(_0x379942){utils[_0xc3f8('0x18')](util['format'](_0xc3f8('0x24'),_0xaf53d7[_0xc3f8('0x21')]),_0x379942);}});ami['on']('agentconnect',function(_0x3a0bae){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x25'),_0x3a0bae[_0xc3f8('0x21')]),_0x3a0bae);agents[_0xc3f8('0x26')](_0x3a0bae);queues['agentconnect'](_0x3a0bae);}catch(_0x4bf406){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')]('[%s][index][agentconnect]',_0x3a0bae[_0xc3f8('0x21')]),_0x4bf406);}});ami['on']('agentcomplete',function(_0x3f02ea){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')]('[%s][index][agentcomplete]',_0x3f02ea[_0xc3f8('0x21')]),_0x3f02ea);agents[_0xc3f8('0x27')](_0x3f02ea);queues[_0xc3f8('0x27')](_0x3f02ea);members[_0xc3f8('0x27')](_0x3f02ea);}catch(_0x3bb0e6){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x28'),_0x3f02ea[_0xc3f8('0x21')]),_0x3bb0e6);}});ami['on'](_0xc3f8('0x29'),function(_0x2c20be){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x2a'),_0x2c20be[_0xc3f8('0x21')]),_0x2c20be);agents[_0xc3f8('0x29')](_0x2c20be);queues[_0xc3f8('0x29')](_0x2c20be);}catch(_0x194bdf){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x2a'),_0x2c20be['uniqueid']),_0x194bdf);}});ami['on']('queuecallerjoin',function(_0x356dda){try{utils['debug'](util[_0xc3f8('0x1e')](_0xc3f8('0x2b'),_0x356dda[_0xc3f8('0x21')]),_0x356dda);queues[_0xc3f8('0x2c')](_0x356dda);recordings[_0xc3f8('0x2c')](_0x356dda);}catch(_0x2deb07){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x2b'),_0x356dda[_0xc3f8('0x21')]),_0x2deb07);}});ami['on'](_0xc3f8('0x2d'),function(_0x25b746){try{utils['debug'](util[_0xc3f8('0x1e')](_0xc3f8('0x2e'),_0x25b746[_0xc3f8('0x21')]),_0x25b746);queues[_0xc3f8('0x2d')](_0x25b746);}catch(_0x1da1c1){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x2e'),_0x25b746[_0xc3f8('0x21')]),_0x1da1c1);}});ami['on'](_0xc3f8('0x2f'),function(_0x117bd4){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x30'),_0x117bd4[_0xc3f8('0x21')]),_0x117bd4);queues[_0xc3f8('0x2f')](_0x117bd4);calls['musiconholdstart'](_0x117bd4);}catch(_0x49e264){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x30'),_0x117bd4['uniqueid']),_0x49e264);}});ami['on'](_0xc3f8('0x31'),function(_0x5e923c){try{utils['debug'](util['format'](_0xc3f8('0x32'),_0x5e923c[_0xc3f8('0x21')]),_0x5e923c);queues['musiconholdstop'](_0x5e923c);calls[_0xc3f8('0x31')](_0x5e923c);}catch(_0x19fae5){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x32'),_0x5e923c[_0xc3f8('0x21')]),_0x19fae5);}});ami['on'](_0xc3f8('0x33'),function(_0x31980e){try{utils['debug'](util[_0xc3f8('0x1e')](_0xc3f8('0x34'),_0x31980e[_0xc3f8('0x21')]),_0x31980e);calls[_0xc3f8('0x33')](_0x31980e);recordings[_0xc3f8('0x33')](_0x31980e);}catch(_0x3b4056){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x34'),_0x31980e[_0xc3f8('0x21')]),_0x3b4056);}});ami['on'](_0xc3f8('0x35'),function(_0x80c255){try{utils[_0xc3f8('0x23')](util['format']('[%s][index][hangup]',_0x80c255[_0xc3f8('0x21')]),_0x80c255);calls[_0xc3f8('0x35')](_0x80c255);recordings[_0xc3f8('0x35')](_0x80c255);dials[_0xc3f8('0x35')](_0x80c255);agents['hangup'](_0x80c255);queues['hangup'](_0x80c255);}catch(_0x102c7e){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')]('[%s][index][hangup]',_0x80c255[_0xc3f8('0x21')]),_0x102c7e);}});ami['on'](_0xc3f8('0x36'),function(_0x33592b){try{utils['debug'](util[_0xc3f8('0x1e')]('[%s][index][cdr]',_0x33592b['uniqueid']),_0x33592b);members['cdr'](_0x33592b);}catch(_0x68dda8){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')]('[%s][index][cdr]',_0x33592b[_0xc3f8('0x21')]),_0x68dda8);}});ami['on'](_0xc3f8('0x37'),function(_0x104f8f){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x38'),_0x104f8f[_0xc3f8('0x21')]),_0x104f8f);queues['blindtransfer'](_0x104f8f);agents[_0xc3f8('0x37')](_0x104f8f);transfers['blindtransfer'](_0x104f8f);}catch(_0x192139){utils['error'](util[_0xc3f8('0x1e')](_0xc3f8('0x38'),_0x104f8f[_0xc3f8('0x21')]),_0x192139);}});ami['on']('attendedtransfer',function(_0x32aebf){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')](_0xc3f8('0x39'),_0x32aebf[_0xc3f8('0x3a')]),_0x32aebf);queues['attendedtransfer'](_0x32aebf);transfers[_0xc3f8('0x3b')](_0x32aebf);agents[_0xc3f8('0x3b')](_0x32aebf);calls['attendedtransfer'](_0x32aebf);}catch(_0xfa1a99){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')]('[%s][index][attendedtransfer]',_0x32aebf['origtransfereruniqueid']),_0xfa1a99);}});ami['on']('varset',function(_0x5b7071){try{utils[_0xc3f8('0x23')](util['format']('[%s][index][varset]',_0x5b7071[_0xc3f8('0x21')]),_0x5b7071);queues[_0xc3f8('0x3c')](_0x5b7071);recordings[_0xc3f8('0x3c')](_0x5b7071);calls[_0xc3f8('0x3c')](_0x5b7071);dials[_0xc3f8('0x3c')](_0x5b7071);}catch(_0x36fdd5){utils['error'](util[_0xc3f8('0x1e')]('[%s][index][varset]',_0x5b7071['uniqueid']),_0x36fdd5);}});ami['on']('newexten',function(_0x29831e){try{utils['debug'](util[_0xc3f8('0x1e')](_0xc3f8('0x3d'),_0x29831e[_0xc3f8('0x21')]),_0x29831e);calls['newexten'](_0x29831e);recordings[_0xc3f8('0x3e')](_0x29831e);dials[_0xc3f8('0x3e')](_0x29831e);}catch(_0x2433b2){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x3d'),_0x29831e[_0xc3f8('0x21')]),_0x2433b2);}});ami['on'](_0xc3f8('0x3f'),function(_0x215fee){try{utils['debug'](util[_0xc3f8('0x1e')]('[%s][index][newchannel]',_0x215fee['uniqueid']),_0x215fee);calls[_0xc3f8('0x3f')](_0x215fee);recordings[_0xc3f8('0x3f')](_0x215fee);}catch(_0x391a74){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')]('[%s][index][newchannel]',_0x215fee['uniqueid']),_0x391a74);}});ami['on'](_0xc3f8('0x40'),function(_0x4ab5bc){try{utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x41'),_0x4ab5bc['uniqueid']),_0x4ab5bc);dials['dialbegin'](_0x4ab5bc);}catch(_0x396b37){utils[_0xc3f8('0x18')](util['format'](_0xc3f8('0x42'),_0x4ab5bc[_0xc3f8('0x21')]),_0x396b37);}});ami['on'](_0xc3f8('0x43'),function(_0x2aacb2){try{utils[_0xc3f8('0x23')](util[_0xc3f8('0x1e')]('[%s][index][dialend]',_0x2aacb2['uniqueid']),_0x2aacb2);dials['dialend'](_0x2aacb2);}catch(_0x3d5247){utils[_0xc3f8('0x18')](util[_0xc3f8('0x1e')](_0xc3f8('0x44'),_0x2aacb2['uniqueid']),_0x3d5247);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b2c1de1..d835036 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 _0xad53=['now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','membername','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0xad53,0x1ea));var _0x3ad5=function(_0x4d18c7,_0x1bda95){_0x4d18c7=_0x4d18c7-0x0;var _0x27bfc1=_0xad53[_0x4d18c7];return _0x27bfc1;};'use strict';var _=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var utils=require(_0x3ad5('0x2'));var members={};var exclude=[_0x3ad5('0x3'),_0x3ad5('0x4')];function writeDB(_0x34f953){utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x34f953[_0x3ad5('0x7')],_0x34f953[_0x3ad5('0x8')],_0x34f953[_0x3ad5('0x9')],_0x34f953[_0x3ad5('0xa')],_0x34f953[_0x3ad5('0xb')],_0x34f953['type']));if(_0x34f953['interface']){utils['getUserByInterface'](_0x34f953[_0x3ad5('0x8')])[_0x3ad5('0xc')](function(_0x2e07f){if(_0x2e07f){_0x34f953[_0x3ad5('0xb')]=_0x2e07f[_0x3ad5('0xd')];_0x34f953[_0x3ad5('0xe')]=_0x2e07f[_0x3ad5('0xe')];utils[_0x3ad5('0xf')]('CreateMemberReport',_0x34f953);}else{utils[_0x3ad5('0x10')](_0x34f953[_0x3ad5('0x8')][_0x3ad5('0x11')]('/')[0x1])[_0x3ad5('0xc')](function(_0x4c93e7){if(_0x4c93e7){_0x34f953[_0x3ad5('0xb')]=_0x4c93e7[_0x3ad5('0xd')];_0x34f953[_0x3ad5('0xe')]=_0x4c93e7['internal'];utils[_0x3ad5('0xf')](_0x3ad5('0x12'),_0x34f953);}});}})[_0x3ad5('0x13')](function(_0x214a29){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')]('[%s][members][writeDB]',_0x34f953['uniqueid']),_0x214a29);});}delete members[_0x34f953[_0x3ad5('0x8')]];}function startsWith(_0x278364,_0xabcbc0){return _[_0x3ad5('0x15')](_0x278364,function(_0x1d5868){return _[_0x3ad5('0x16')](_0xabcbc0,_0x1d5868);});}exports['devicestatechange']=function(_0x56123a){try{utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')]('[%s][members][devicestatechange]',members[_0x56123a['device']]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a[_0x3ad5('0x18')]),_0x56123a);utils[_0x3ad5('0x5')](util['format'](_0x3ad5('0x19'),members[_0x56123a[_0x3ad5('0x18')]]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a[_0x3ad5('0x18')],_0x56123a[_0x3ad5('0x1a')],_0x56123a[_0x3ad5('0x18')]));switch(_0x56123a[_0x3ad5('0x1a')]){case _0x3ad5('0x1b'):case'BUSY':if(!startsWith(exclude,_0x56123a[_0x3ad5('0x18')])){members[_0x56123a['device']]={'channel':_0x3ad5('0x1c'),'interface':_0x56123a['device'],'type':_0x3ad5('0x1d'),'enterAt':utils[_0x3ad5('0x1e')](),'role':_0x3ad5('0x1f')};}break;case _0x3ad5('0x20'):if(!_[_0x3ad5('0x21')](members[_0x56123a[_0x3ad5('0x18')]])){members[_0x56123a['device']][_0x3ad5('0x22')]=utils[_0x3ad5('0x1e')]();members[_0x56123a['device']][_0x3ad5('0x23')]=utils[_0x3ad5('0x24')](members[_0x56123a[_0x3ad5('0x18')]]['exitAt'],members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x25')]);if(members[_0x56123a[_0x3ad5('0x18')]]['uniqueid']){writeDB(members[_0x56123a['device']]);}}break;default:break;}}catch(_0x578463){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x26'),members[_0x56123a['device']]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a['device']),_0x578463);}};exports['agentcomplete']=function(_0x2a402c){try{if(!_['isNil'](members[_0x2a402c[_0x3ad5('0x8')]])){utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')](_0x3ad5('0x27'),_0x2a402c[_0x3ad5('0x7')]),_0x2a402c);utils['info'](util['format'](_0x3ad5('0x28'),_0x2a402c[_0x3ad5('0x7')],_0x2a402c[_0x3ad5('0x8')],_0x2a402c[_0x3ad5('0x29')]));members[_0x2a402c['interface']]=_[_0x3ad5('0x2a')](members[_0x2a402c[_0x3ad5('0x8')]],{'data4':_0x2a402c[_0x3ad5('0x29')],'uniqueid':_0x2a402c[_0x3ad5('0x7')]});}}catch(_0x2df2f6){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x27'),_0x2a402c[_0x3ad5('0x7')]),_0x2df2f6);}};exports[_0x3ad5('0x2b')]=function(_0x53a00c){try{utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')](_0x3ad5('0x2c'),_0x53a00c[_0x3ad5('0x7')]),_0x53a00c);if(_0x53a00c[_0x3ad5('0x9')]){var _0x41240f=_0x53a00c[_0x3ad5('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x41240f])){members[_0x41240f]=_[_0x3ad5('0x2a')](members[_0x41240f],{'data1':members[_0x41240f][_0x3ad5('0x2d')]||_0x53a00c['type'],'data2':members[_0x41240f][_0x3ad5('0xa')]||_0x53a00c[_0x3ad5('0x2e')],'data3':members[_0x41240f][_0x3ad5('0x2f')]||_0x53a00c[_0x3ad5('0x30')],'uniqueid':members[_0x41240f][_0x3ad5('0x7')]||_0x53a00c[_0x3ad5('0x7')]});utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')](_0x3ad5('0x31'),_0x53a00c[_0x3ad5('0x7')],members[_0x41240f][_0x3ad5('0x2d')],members[_0x41240f][_0x3ad5('0xa')],members[_0x41240f][_0x3ad5('0x2f')]));if(members[_0x41240f]['exitAt']){writeDB(members[_0x41240f]);}}}if(_0x53a00c[_0x3ad5('0x32')]){var _0x5cf352=_0x53a00c[_0x3ad5('0x32')][_0x3ad5('0x11')]('-')[0x0];if(!_[_0x3ad5('0x21')](members[_0x5cf352])){members[_0x5cf352]=_[_0x3ad5('0x2a')](members[_0x5cf352],{'data1':members[_0x5cf352][_0x3ad5('0x2d')]||_0x53a00c[_0x3ad5('0x33')],'data2':members[_0x5cf352][_0x3ad5('0xa')]||_0x53a00c['source'],'data3':members[_0x5cf352]['data3']||_0x53a00c[_0x3ad5('0x30')],'uniqueid':members[_0x5cf352][_0x3ad5('0x7')]||_0x53a00c[_0x3ad5('0x7')]});utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')](_0x3ad5('0x31'),_0x53a00c[_0x3ad5('0x7')],members[_0x5cf352][_0x3ad5('0x2d')],members[_0x5cf352][_0x3ad5('0xa')],members[_0x5cf352][_0x3ad5('0x2f')]));if(members[_0x5cf352][_0x3ad5('0x22')]){writeDB(members[_0x5cf352]);}}}}catch(_0x3ea7e5){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x2c'),_0x53a00c[_0x3ad5('0x7')]),_0x3ea7e5);}}; \ No newline at end of file +var _0x9a62=['getUserByName','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','error','agentcomplete','[%s][members][agentcomplete]','info','queue','assign','cdr','[%s][members][cdr]','split','data1','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','request','CreateMemberReport'];(function(_0x28cae4,_0x444da3){var _0x2d8c20=function(_0x25fbb2){while(--_0x25fbb2){_0x28cae4['push'](_0x28cae4['shift']());}};_0x2d8c20(++_0x444da3);}(_0x9a62,0x1bc));var _0x29a6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9a62[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x29a6('0x0'));var utils=require(_0x29a6('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x29a6('0x2')];function writeDB(_0x2d49a0){utils['info'](util['format'](_0x29a6('0x3'),_0x2d49a0[_0x29a6('0x4')],_0x2d49a0[_0x29a6('0x5')],_0x2d49a0[_0x29a6('0x6')],_0x2d49a0[_0x29a6('0x7')],_0x2d49a0[_0x29a6('0x8')],_0x2d49a0[_0x29a6('0x9')]));if(_0x2d49a0['interface']){utils['getUserByInterface'](_0x2d49a0[_0x29a6('0x5')])[_0x29a6('0xa')](function(_0x5cee47){if(_0x5cee47){_0x2d49a0['membername']=_0x5cee47[_0x29a6('0xb')];_0x2d49a0[_0x29a6('0xc')]=_0x5cee47[_0x29a6('0xc')];utils[_0x29a6('0xd')](_0x29a6('0xe'),_0x2d49a0);}else{utils[_0x29a6('0xf')](_0x2d49a0[_0x29a6('0x5')]['split']('/')[0x1])[_0x29a6('0xa')](function(_0x6efb99){if(_0x6efb99){_0x2d49a0['membername']=_0x6efb99['name'];_0x2d49a0['internal']=_0x6efb99[_0x29a6('0xc')];utils[_0x29a6('0xd')]('CreateMemberReport',_0x2d49a0);}});}})[_0x29a6('0x10')](function(_0x13251a){utils['error'](util['format'](_0x29a6('0x11'),_0x2d49a0[_0x29a6('0x4')]),_0x13251a);});}delete members[_0x2d49a0['interface']];}function startsWith(_0x389255,_0x22378a){return _[_0x29a6('0x12')](_0x389255,function(_0x4fef5c){return _[_0x29a6('0x13')](_0x22378a,_0x4fef5c);});}exports[_0x29a6('0x14')]=function(_0x695718){try{utils[_0x29a6('0x15')](util[_0x29a6('0x16')](_0x29a6('0x17'),members[_0x695718[_0x29a6('0x18')]]?members[_0x695718[_0x29a6('0x18')]]['uniqueid']:_0x695718[_0x29a6('0x18')]),_0x695718);utils['info'](util[_0x29a6('0x16')](_0x29a6('0x19'),members[_0x695718[_0x29a6('0x18')]]?members[_0x695718['device']][_0x29a6('0x4')]:_0x695718['device'],_0x695718['state'],_0x695718['device']));switch(_0x695718[_0x29a6('0x1a')]){case _0x29a6('0x1b'):case _0x29a6('0x1c'):if(!startsWith(exclude,_0x695718[_0x29a6('0x18')])){members[_0x695718[_0x29a6('0x18')]]={'channel':'voice','interface':_0x695718[_0x29a6('0x18')],'type':_0x29a6('0x1d'),'enterAt':utils[_0x29a6('0x1e')](),'role':_0x29a6('0x1f')};}break;case _0x29a6('0x20'):if(!_[_0x29a6('0x21')](members[_0x695718[_0x29a6('0x18')]])){members[_0x695718['device']][_0x29a6('0x22')]=utils[_0x29a6('0x1e')]();members[_0x695718[_0x29a6('0x18')]][_0x29a6('0x23')]=utils[_0x29a6('0x24')](members[_0x695718[_0x29a6('0x18')]][_0x29a6('0x22')],members[_0x695718['device']]['enterAt']);if(members[_0x695718[_0x29a6('0x18')]][_0x29a6('0x4')]){writeDB(members[_0x695718[_0x29a6('0x18')]]);}}break;default:break;}}catch(_0x6f9041){utils[_0x29a6('0x25')](util[_0x29a6('0x16')]('[%s][members][devicestatechange]',members[_0x695718['device']]?members[_0x695718[_0x29a6('0x18')]][_0x29a6('0x4')]:_0x695718[_0x29a6('0x18')]),_0x6f9041);}};exports[_0x29a6('0x26')]=function(_0x2b6b35){try{if(!_['isNil'](members[_0x2b6b35['interface']])){utils[_0x29a6('0x15')](util[_0x29a6('0x16')](_0x29a6('0x27'),_0x2b6b35[_0x29a6('0x4')]),_0x2b6b35);utils[_0x29a6('0x28')](util[_0x29a6('0x16')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2b6b35['uniqueid'],_0x2b6b35[_0x29a6('0x5')],_0x2b6b35[_0x29a6('0x29')]));members[_0x2b6b35[_0x29a6('0x5')]]=_[_0x29a6('0x2a')](members[_0x2b6b35[_0x29a6('0x5')]],{'data4':_0x2b6b35[_0x29a6('0x29')],'uniqueid':_0x2b6b35[_0x29a6('0x4')]});}}catch(_0x4aec1f){utils[_0x29a6('0x25')](util[_0x29a6('0x16')](_0x29a6('0x27'),_0x2b6b35[_0x29a6('0x4')]),_0x4aec1f);}};exports[_0x29a6('0x2b')]=function(_0x1abfe9){try{utils[_0x29a6('0x15')](util[_0x29a6('0x16')](_0x29a6('0x2c'),_0x1abfe9['uniqueid']),_0x1abfe9);if(_0x1abfe9[_0x29a6('0x6')]){var _0x10fc0a=_0x1abfe9[_0x29a6('0x6')][_0x29a6('0x2d')]('-')[0x0];if(!_[_0x29a6('0x21')](members[_0x10fc0a])){members[_0x10fc0a]=_[_0x29a6('0x2a')](members[_0x10fc0a],{'data1':members[_0x10fc0a][_0x29a6('0x2e')]||_0x1abfe9['type'],'data2':members[_0x10fc0a]['data2']||_0x1abfe9['source'],'data3':members[_0x10fc0a][_0x29a6('0x2f')]||_0x1abfe9[_0x29a6('0x30')],'uniqueid':members[_0x10fc0a][_0x29a6('0x4')]||_0x1abfe9[_0x29a6('0x4')]});utils[_0x29a6('0x28')](util[_0x29a6('0x16')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1abfe9[_0x29a6('0x4')],members[_0x10fc0a][_0x29a6('0x2e')],members[_0x10fc0a]['data2'],members[_0x10fc0a][_0x29a6('0x2f')]));if(members[_0x10fc0a][_0x29a6('0x22')]){writeDB(members[_0x10fc0a]);}}}if(_0x1abfe9['destinationchannel']){var _0x479ee4=_0x1abfe9[_0x29a6('0x31')][_0x29a6('0x2d')]('-')[0x0];if(!_['isNil'](members[_0x479ee4])){members[_0x479ee4]=_[_0x29a6('0x2a')](members[_0x479ee4],{'data1':members[_0x479ee4][_0x29a6('0x2e')]||_0x1abfe9[_0x29a6('0x9')],'data2':members[_0x479ee4]['data2']||_0x1abfe9['source'],'data3':members[_0x479ee4][_0x29a6('0x2f')]||_0x1abfe9['destination'],'uniqueid':members[_0x479ee4][_0x29a6('0x4')]||_0x1abfe9[_0x29a6('0x4')]});utils['info'](util[_0x29a6('0x16')](_0x29a6('0x32'),_0x1abfe9[_0x29a6('0x4')],members[_0x479ee4][_0x29a6('0x2e')],members[_0x479ee4][_0x29a6('0x7')],members[_0x479ee4][_0x29a6('0x2f')]));if(members[_0x479ee4][_0x29a6('0x22')]){writeDB(members[_0x479ee4]);}}}}catch(_0x3621a3){utils[_0x29a6('0x25')](util[_0x29a6('0x16')](_0x29a6('0x2c'),_0x1abfe9[_0x29a6('0x4')]),_0x3621a3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c9961c3..833be48 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 _0x8c10=['lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','membername','destaccountcode','assigned','[%s][queues][agentconnect]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]'];(function(_0x3b18ce,_0x4e0e0d){var _0x1e3be0=function(_0x5b0b4e){while(--_0x5b0b4e){_0x3b18ce['push'](_0x3b18ce['shift']());}};_0x1e3be0(++_0x4e0e0d);}(_0x8c10,0x138));var _0x08c1=function(_0x5c8523,_0x4ea9bb){_0x5c8523=_0x5c8523-0x0;var _0x496c1c=_0x8c10[_0x5c8523];return _0x496c1c;};'use strict';var _=require(_0x08c1('0x0'));var util=require('util');var utils=require(_0x08c1('0x1'));var queues={};function writeDB(_0x26620b){utils[_0x08c1('0x2')](util['format'](_0x08c1('0x3'),_0x26620b['uniqueid'],_0x26620b[_0x08c1('0x4')],_0x26620b[_0x08c1('0x5')],_0x26620b[_0x08c1('0x6')],_0x26620b[_0x08c1('0x7')],_0x26620b[_0x08c1('0x8')],_0x26620b[_0x08c1('0x9')]));if(_0x26620b[_0x08c1('0x5')]){utils[_0x08c1('0xa')](_0x26620b['queue'])[_0x08c1('0xb')](function(_0x55d5da){if(_0x55d5da){_0x26620b[_0x08c1('0xc')]=_0x55d5da[_0x08c1('0xc')];}utils['request'](_0x08c1('0xd'),_0x26620b);});}else{utils[_0x08c1('0xe')](_0x08c1('0xd'),_0x26620b);}if(_0x26620b['transfereduniqueid']){delete queues[_0x26620b[_0x08c1('0xf')]];}else{delete queues[_0x26620b[_0x08c1('0x10')]];}}exports['queuecallerjoin']=function(_0x3155d9){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x13'),_0x3155d9[_0x08c1('0x10')]),_0x3155d9);utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x14'),_0x3155d9['uniqueid'],_0x3155d9[_0x08c1('0x5')],_0x3155d9['position']));queues[_0x3155d9[_0x08c1('0x10')]]=_[_0x08c1('0x15')](_0x3155d9,{'originalposition':_0x3155d9[_0x08c1('0x16')],'queuecallerjoinAt':utils[_0x08c1('0x17')](),'mohtime':0x0});}catch(_0x170298){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x13'),_0x3155d9[_0x08c1('0x10')]),_0x170298);}};exports[_0x08c1('0x19')]=function(_0x4ac18e){try{if(!_[_0x08c1('0x1a')](queues[_0x4ac18e['uniqueid']])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x1b'),_0x4ac18e[_0x08c1('0x10')]),_0x4ac18e);if(queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerleaveAt']){if(!queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerabandon']&&!queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1c')]){queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1d')]=!![];queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1e')]=utils[_0x08c1('0x17')]();queues[_0x4ac18e['uniqueid']][_0x08c1('0x9')]=_0x08c1('0x1f');}utils[_0x08c1('0x2')](util['format'](_0x08c1('0x20'),_0x4ac18e[_0x08c1('0x10')],queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x4ac18e[_0x08c1('0x10')]]);}else if(queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0xf')]){utils['info'](util[_0x08c1('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ac18e[_0x08c1('0x10')],queues[_0x4ac18e['uniqueid']]['name'],queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0xf')]));queues[queues[_0x4ac18e[_0x08c1('0x10')]]['transfereduniqueid']]=queues[_0x4ac18e[_0x08c1('0x10')]];queues[queues[_0x4ac18e['uniqueid']][_0x08c1('0xf')]][_0x08c1('0x22')]=0x2;delete queues[_0x4ac18e[_0x08c1('0x10')]];}}}catch(_0x285974){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x1b'),_0x4ac18e['uniqueid']),_0x285974);}};exports[_0x08c1('0x23')]=function(_0x43502a){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x24'),_0x43502a['uniqueid']),_0x43502a);if(!_[_0x08c1('0x1a')](_0x43502a[_0x08c1('0x25')][_0x08c1('0x26')])&&_0x43502a['value'][_0x08c1('0x27')]()!==_0x08c1('0x28')){if(!_['isNil'](queues[_0x43502a['uniqueid']])){queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x2a')]=null;queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexit']=!![];queues[_0x43502a['uniqueid']][_0x08c1('0x2b')]=utils['now']();queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitreason']=_0x43502a[_0x08c1('0x2c')][_0x08c1('0x27')]();utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x2d'),_0x43502a[_0x08c1('0x10')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x21')],_0x43502a[_0x08c1('0x2c')],queues[_0x43502a['uniqueid']][_0x08c1('0x9')]));writeDB(queues[_0x43502a[_0x08c1('0x10')]]);}}else if(!_[_0x08c1('0x1a')](_0x43502a[_0x08c1('0x25')][_0x08c1('0x2e')])){if(!_[_0x08c1('0x1a')](queues[_0x43502a[_0x08c1('0x10')]])&&!queues[_0x43502a[_0x08c1('0x10')]]['queuecallerabandon']){queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x43502a[_0x08c1('0x10')]]['queuecallerabandonAt']=null;queues[_0x43502a['uniqueid']][_0x08c1('0x1c')]=!![];queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitAt']=utils['now']();queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x08c1('0x12')](_0x08c1('0x2f'),_0x43502a[_0x08c1('0x10')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x21')],_0x43502a[_0x08c1('0x2c')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x9')]));}}}catch(_0x514918){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x24'),_0x43502a[_0x08c1('0x10')]),_0x514918);}};exports[_0x08c1('0x29')]=function(_0x551db4){try{if(!_[_0x08c1('0x1a')](queues[_0x551db4[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x30'),_0x551db4[_0x08c1('0x10')]),_0x551db4);queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x1c')]=![];queues[_0x551db4['uniqueid']][_0x08c1('0x2b')]=null;queues[_0x551db4['uniqueid']][_0x08c1('0x29')]=!![];queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x2a')]=utils[_0x08c1('0x17')]();queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x9')]=_0x08c1('0x31');utils[_0x08c1('0x2')](util[_0x08c1('0x12')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x551db4[_0x08c1('0x10')],queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x9')]));}}catch(_0x2891af){utils['error'](util['format'](_0x08c1('0x30'),_0x551db4[_0x08c1('0x10')]),_0x2891af);}};exports[_0x08c1('0x32')]=function(_0x1f50d0){try{if(!_[_0x08c1('0x1a')](queues[_0x1f50d0[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][queuecallerleave]',_0x1f50d0['uniqueid']),_0x1f50d0);utils[_0x08c1('0x2')](util['format'](_0x08c1('0x33'),_0x1f50d0[_0x08c1('0x10')],queues[_0x1f50d0['uniqueid']][_0x08c1('0x21')],_0x1f50d0['connectedlinenum'],_0x1f50d0[_0x08c1('0x34')]));queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x32')]=!![];queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x35')]=utils['now']();queues[_0x1f50d0[_0x08c1('0x10')]]['holdtime']=utils[_0x08c1('0x36')](queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x35')],queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x37')]);queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x16')]=_0x1f50d0[_0x08c1('0x16')];queues[_0x1f50d0[_0x08c1('0x10')]]['count']=_0x1f50d0[_0x08c1('0x38')];queues[_0x1f50d0[_0x08c1('0x10')]]['connectedlinenum']=_0x1f50d0['connectedlinenum'];queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x34')]=_0x1f50d0[_0x08c1('0x34')];}}catch(_0x424065){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x39'),_0x1f50d0[_0x08c1('0x10')]),_0x424065);}};exports['agentconnect']=function(_0x4242ea){try{if(!_[_0x08c1('0x1a')](queues[_0x4242ea[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][agentconnect]',_0x4242ea[_0x08c1('0x10')]),_0x4242ea);utils[_0x08c1('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4242ea['uniqueid'],queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x21')],_0x4242ea[_0x08c1('0x3a')],_0x4242ea[_0x08c1('0x3b')]));queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x4242ea['uniqueid']][_0x08c1('0x2a')]=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x1c')]=![];queues[_0x4242ea['uniqueid']]['queuecallerexitreason']=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x2b')]=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x3c')]=!![];queues[_0x4242ea['uniqueid']][_0x08c1('0x8')]=_0x4242ea[_0x08c1('0x3b')];queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x6')]=_0x4242ea[_0x08c1('0x3a')];}}catch(_0x1764fe){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x3d'),_0x4242ea[_0x08c1('0x10')]),_0x1764fe);}};exports['agentcomplete']=function(_0x577282){try{if(!_[_0x08c1('0x1a')](queues[_0x577282[_0x08c1('0x10')]])){if(queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x35')]){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][agentcomplete]',_0x577282[_0x08c1('0x10')]),_0x577282);queues[_0x577282['uniqueid']]['queuecallerabandon']=![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x577282['uniqueid']][_0x08c1('0x2a')]=null;queues[_0x577282[_0x08c1('0x10')]]['queuecallerexit']=![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x2b')]=null;queues[_0x577282[_0x08c1('0x10')]]['assigned']=!![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x6')]=_0x577282[_0x08c1('0x3a')];queues[_0x577282['uniqueid']]['queuecallercomplete']=!![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x1e')]=utils['now']();if(_0x577282[_0x08c1('0x3e')]=='transfer'){if(!queues[_0x577282['uniqueid']][_0x08c1('0x3f')]){queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x9')]=_0x08c1('0x40');}}else{queues[_0x577282[_0x08c1('0x10')]]['queuecallerexitreason']=_0x08c1('0x41')+_0x577282[_0x08c1('0x3e')][_0x08c1('0x27')]();}utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x42'),_0x577282[_0x08c1('0x10')],queues[_0x577282['uniqueid']]['name'],_0x577282[_0x08c1('0x3a')],queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x9')]));writeDB(queues[_0x577282[_0x08c1('0x10')]]);}}}catch(_0x27ccdc){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x43'),_0x577282[_0x08c1('0x10')]),_0x27ccdc);}};exports[_0x08c1('0x44')]=function(_0x49682f){try{if(!_[_0x08c1('0x1a')](queues[_0x49682f[_0x08c1('0x45')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x46'),_0x49682f[_0x08c1('0x10')]),_0x49682f);queues[_0x49682f['transfereeuniqueid']][_0x08c1('0x3f')]=!![];queues[_0x49682f['transfereeuniqueid']]['transfertype']=_0x08c1('0x47');queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x48')]=_0x49682f['extension'];queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x49')]=_0x49682f[_0x08c1('0x45')];queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x9')]='BLINDTRANSFER';utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x4a'),_0x49682f[_0x08c1('0x10')],queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x21')],_0x49682f['transfereeuniqueid'],_0x49682f[_0x08c1('0x4b')]));}}catch(_0x575398){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x46'),_0x49682f[_0x08c1('0x10')]),_0x575398);}};exports[_0x08c1('0x4c')]=function(_0x18ea39){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x4d'),_0x18ea39[_0x08c1('0x4e')]),_0x18ea39);if(_0x18ea39[_0x08c1('0x4e')]==_0x18ea39[_0x08c1('0x4f')]){if(!_['isNil'](queues[_0x18ea39[_0x08c1('0x50')]])){utils['info'](util[_0x08c1('0x12')](_0x08c1('0x51'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39['secondtransfererlinkedid']][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x52')]));queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x3f')]=!![];queues[_0x18ea39['secondtransfererlinkedid']][_0x08c1('0x53')]=_0x08c1('0x54');queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x48')]=_0x18ea39[_0x08c1('0x52')];queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x49')]=_0x18ea39[_0x08c1('0x4e')];queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x9')]=_0x08c1('0x55');}if(!_[_0x08c1('0x1a')](queues[_0x18ea39['origtransfererlinkedid']])){if(_0x18ea39[_0x08c1('0x56')]&&queues[_0x18ea39['transfereelinkedid']]){queues[_0x18ea39[_0x08c1('0x56')]][_0x08c1('0x22')]=0x1;queues[_0x18ea39[_0x08c1('0x45')]]=_[_0x08c1('0x57')](queues[_0x18ea39[_0x08c1('0x56')]]);queues[_0x18ea39[_0x08c1('0x45')]]['transfereduniqueid']=_0x18ea39['transfertargetuniqueid'];queues[_0x18ea39[_0x08c1('0x45')]]['queuecallerenterreason']=0x2;queues[_0x18ea39['transfereeuniqueid']]['calleridnum']=queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x7')];queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x58')]=queues[_0x18ea39[_0x08c1('0x50')]]['calleridname'];queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x37')]=utils[_0x08c1('0x17')]();queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x35')]=utils[_0x08c1('0x17')]();queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x59')]=0x0;queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x5a')]=0x0;utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x5b'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x21')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x7')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x58')]));}else{utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x5c'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x50')]));queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0xf')]=_0x18ea39['secondtransfererlinkedid'];}}}else if(_0x18ea39[_0x08c1('0x5d')]==_0x18ea39[_0x08c1('0x50')]){if(!_[_0x08c1('0x1a')](queues[_0x18ea39[_0x08c1('0x4f')]])){utils['info'](util[_0x08c1('0x12')](_0x08c1('0x5e'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x5d')],_0x18ea39[_0x08c1('0x5f')]));queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x3f')]=!![];queues[_0x18ea39[_0x08c1('0x4f')]]['transfertype']=_0x08c1('0x54');queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x48')]=_0x18ea39[_0x08c1('0x5f')];queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x49')]=_0x18ea39[_0x08c1('0x5d')];queues[_0x18ea39[_0x08c1('0x4f')]]['queuecallerexitreason']=_0x08c1('0x55');}if(!_[_0x08c1('0x1a')](queues[_0x18ea39[_0x08c1('0x50')]])){if(_0x18ea39['transfertargetlinkedid']&&queues[_0x18ea39[_0x08c1('0x60')]]){queues[_0x18ea39[_0x08c1('0x60')]][_0x08c1('0x22')]=0x1;queues[_0x18ea39['transfertargetuniqueid']]=_['clone'](queues[_0x18ea39['transfertargetlinkedid']]);queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0xf')]=_0x18ea39['transfertargetuniqueid'];queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x22')]=0x2;queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x7')]=queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0x7')];queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x58')]=queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x58')];queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x37')]=utils[_0x08c1('0x17')]();queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x35')]=utils[_0x08c1('0x17')]();queues[_0x18ea39[_0x08c1('0x61')]]['holdtime']=0x0;queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x5a')]=0x0;utils[_0x08c1('0x2')](util[_0x08c1('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x21')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0xf')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x7')],queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x58')]));}else{utils[_0x08c1('0x2')](util['format'](_0x08c1('0x5c'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x4f')]));queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0xf')]=_0x18ea39[_0x08c1('0x4f')];}}}}catch(_0x252cb7){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x4d'),_0x18ea39[_0x08c1('0x4e')]),_0x252cb7);}};exports['musiconholdstart']=function(_0x778dfd){try{if(!_[_0x08c1('0x1a')](queues[_0x778dfd[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util['format'](_0x08c1('0x62'),_0x778dfd[_0x08c1('0x10')]),_0x778dfd);queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x63')]=utils[_0x08c1('0x17')]();utils['info'](util[_0x08c1('0x12')](_0x08c1('0x64'),_0x778dfd['uniqueid'],queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x63')]));}}catch(_0x1a9ae6){utils[_0x08c1('0x18')](util[_0x08c1('0x12')]('[%s][queues][musiconholdstart]',_0x778dfd['uniqueid']),_0x1a9ae6);}};exports[_0x08c1('0x65')]=function(_0x16b7f4){try{if(!_[_0x08c1('0x1a')](queues[_0x16b7f4[_0x08c1('0x10')]])){if(!_[_0x08c1('0x1a')](queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][musiconholdstop]',_0x16b7f4[_0x08c1('0x10')]),_0x16b7f4);queues[_0x16b7f4['uniqueid']][_0x08c1('0x5a')]+=utils['diffTime'](utils[_0x08c1('0x17')](),queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')]);utils['info'](util[_0x08c1('0x12')](_0x08c1('0x66'),_0x16b7f4[_0x08c1('0x10')],queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x16b7f4['uniqueid']][_0x08c1('0x5a')]));delete queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')];}}}catch(_0x1ee456){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x67'),_0x16b7f4[_0x08c1('0x10')]),_0x1ee456);}}; \ No newline at end of file +var _0x9ba4=['[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','error','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format'];(function(_0x2ecebb,_0xf3a6d9){var _0xb8f864=function(_0x2af916){while(--_0x2af916){_0x2ecebb['push'](_0x2ecebb['shift']());}};_0xb8f864(++_0xf3a6d9);}(_0x9ba4,0x13c));var _0x49ba=function(_0x1e3697,_0x3e8d57){_0x1e3697=_0x1e3697-0x0;var _0x466dc7=_0x9ba4[_0x1e3697];return _0x466dc7;};'use strict';var _=require(_0x49ba('0x0'));var util=require(_0x49ba('0x1'));var utils=require(_0x49ba('0x2'));var queues={};function writeDB(_0x402ffe){utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x5'),_0x402ffe[_0x49ba('0x6')],_0x402ffe[_0x49ba('0x7')],_0x402ffe[_0x49ba('0x8')],_0x402ffe[_0x49ba('0x9')],_0x402ffe['calleridnum'],_0x402ffe[_0x49ba('0xa')],_0x402ffe[_0x49ba('0xb')]));if(_0x402ffe[_0x49ba('0x8')]){utils['getVoiceQueueByName'](_0x402ffe[_0x49ba('0x8')])[_0x49ba('0xc')](function(_0x129b12){if(_0x129b12){_0x402ffe['type']=_0x129b12[_0x49ba('0xd')];}utils[_0x49ba('0xe')](_0x49ba('0xf'),_0x402ffe);});}else{utils[_0x49ba('0xe')](_0x49ba('0xf'),_0x402ffe);}if(_0x402ffe[_0x49ba('0x10')]){delete queues[_0x402ffe[_0x49ba('0x10')]];}else{delete queues[_0x402ffe['uniqueid']];}}exports['queuecallerjoin']=function(_0x3c4876){try{utils['debug'](util[_0x49ba('0x4')](_0x49ba('0x11'),_0x3c4876[_0x49ba('0x6')]),_0x3c4876);utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x12'),_0x3c4876[_0x49ba('0x6')],_0x3c4876[_0x49ba('0x8')],_0x3c4876['position']));queues[_0x3c4876[_0x49ba('0x6')]]=_[_0x49ba('0x13')](_0x3c4876,{'originalposition':_0x3c4876[_0x49ba('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x321e8f){utils[_0x49ba('0x15')](util['format'](_0x49ba('0x11'),_0x3c4876[_0x49ba('0x6')]),_0x321e8f);}};exports[_0x49ba('0x16')]=function(_0x4d26d7){try{if(!_[_0x49ba('0x17')](queues[_0x4d26d7[_0x49ba('0x6')]])){utils[_0x49ba('0x18')](util[_0x49ba('0x4')]('[%s][queues][hangup]',_0x4d26d7['uniqueid']),_0x4d26d7);if(queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x19')]){if(!queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x1a')]&&!queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x1b')]){queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x1c')]=!![];queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x1d')]=utils[_0x49ba('0x1e')]();queues[_0x4d26d7['uniqueid']][_0x49ba('0xb')]='COMPLETEDBYAGENT';}utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x1f'),_0x4d26d7['uniqueid'],queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x20')],queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0xb')]));writeDB(queues[_0x4d26d7[_0x49ba('0x6')]]);}else if(queues[_0x4d26d7[_0x49ba('0x6')]]['transfereduniqueid']){utils[_0x49ba('0x3')](util[_0x49ba('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4d26d7[_0x49ba('0x6')],queues[_0x4d26d7['uniqueid']][_0x49ba('0x20')],queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x10')]));queues[queues[_0x4d26d7[_0x49ba('0x6')]][_0x49ba('0x10')]]=queues[_0x4d26d7[_0x49ba('0x6')]];queues[queues[_0x4d26d7['uniqueid']][_0x49ba('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x4d26d7['uniqueid']];}}}catch(_0x2ba649){utils[_0x49ba('0x15')](util[_0x49ba('0x4')]('[%s][queues][hangup]',_0x4d26d7['uniqueid']),_0x2ba649);}};exports[_0x49ba('0x21')]=function(_0x4e07d0){try{utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x22'),_0x4e07d0[_0x49ba('0x6')]),_0x4e07d0);if(!_[_0x49ba('0x17')](_0x4e07d0[_0x49ba('0x23')][_0x49ba('0x24')])&&_0x4e07d0[_0x49ba('0x25')][_0x49ba('0x26')]()!==_0x49ba('0x27')){if(!_[_0x49ba('0x17')](queues[_0x4e07d0[_0x49ba('0x6')]])){queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x1a')]=![];queues[_0x4e07d0['uniqueid']][_0x49ba('0x28')]=null;queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x1b')]=!![];queues[_0x4e07d0[_0x49ba('0x6')]]['queuecallerexitAt']=utils[_0x49ba('0x1e')]();queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0xb')]=_0x4e07d0[_0x49ba('0x25')]['toUpperCase']();utils[_0x49ba('0x3')](util['format'](_0x49ba('0x29'),_0x4e07d0['uniqueid'],queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x20')],_0x4e07d0[_0x49ba('0x25')],queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0xb')]));writeDB(queues[_0x4e07d0[_0x49ba('0x6')]]);}}else if(!_[_0x49ba('0x17')](_0x4e07d0[_0x49ba('0x23')]['queueposition'])){if(!_[_0x49ba('0x17')](queues[_0x4e07d0[_0x49ba('0x6')]])&&!queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x1a')]){queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x1a')]=![];queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x28')]=null;queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x1b')]=!![];queues[_0x4e07d0[_0x49ba('0x6')]]['queuecallerexitAt']=utils[_0x49ba('0x1e')]();queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0xb')]=_0x49ba('0x2a');utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x2b'),_0x4e07d0['uniqueid'],queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0x20')],_0x4e07d0[_0x49ba('0x25')],queues[_0x4e07d0[_0x49ba('0x6')]][_0x49ba('0xb')]));}}}catch(_0x517012){utils[_0x49ba('0x15')](util['format'](_0x49ba('0x22'),_0x4e07d0[_0x49ba('0x6')]),_0x517012);}};exports[_0x49ba('0x1a')]=function(_0x3645b8){try{if(!_['isNil'](queues[_0x3645b8[_0x49ba('0x6')]])){utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x2c'),_0x3645b8[_0x49ba('0x6')]),_0x3645b8);queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0x1b')]=![];queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0x2d')]=null;queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0x1a')]=!![];queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0x28')]=utils[_0x49ba('0x1e')]();queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0xb')]=_0x49ba('0x2e');utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x2f'),_0x3645b8['uniqueid'],queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0x20')],queues[_0x3645b8[_0x49ba('0x6')]][_0x49ba('0xb')]));}}catch(_0x53ec67){utils['error'](util[_0x49ba('0x4')]('[%s][queues][queuecallerabandon]',_0x3645b8['uniqueid']),_0x53ec67);}};exports[_0x49ba('0x30')]=function(_0x4ec8ff){try{if(!_[_0x49ba('0x17')](queues[_0x4ec8ff[_0x49ba('0x6')]])){utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x31'),_0x4ec8ff[_0x49ba('0x6')]),_0x4ec8ff);utils['info'](util['format'](_0x49ba('0x32'),_0x4ec8ff['uniqueid'],queues[_0x4ec8ff[_0x49ba('0x6')]]['name'],_0x4ec8ff[_0x49ba('0x33')],_0x4ec8ff['connectedlinename']));queues[_0x4ec8ff['uniqueid']]['queuecallerleave']=!![];queues[_0x4ec8ff[_0x49ba('0x6')]][_0x49ba('0x19')]=utils[_0x49ba('0x1e')]();queues[_0x4ec8ff['uniqueid']][_0x49ba('0x34')]=utils[_0x49ba('0x35')](queues[_0x4ec8ff['uniqueid']][_0x49ba('0x19')],queues[_0x4ec8ff[_0x49ba('0x6')]][_0x49ba('0x36')]);queues[_0x4ec8ff['uniqueid']][_0x49ba('0x14')]=_0x4ec8ff[_0x49ba('0x14')];queues[_0x4ec8ff[_0x49ba('0x6')]][_0x49ba('0x37')]=_0x4ec8ff[_0x49ba('0x37')];queues[_0x4ec8ff[_0x49ba('0x6')]][_0x49ba('0x33')]=_0x4ec8ff['connectedlinenum'];queues[_0x4ec8ff[_0x49ba('0x6')]]['connectedlinename']=_0x4ec8ff[_0x49ba('0x38')];}}catch(_0x3e7ede){utils[_0x49ba('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x4ec8ff['uniqueid']),_0x3e7ede);}};exports['agentconnect']=function(_0x23ef34){try{if(!_[_0x49ba('0x17')](queues[_0x23ef34[_0x49ba('0x6')]])){utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x39'),_0x23ef34[_0x49ba('0x6')]),_0x23ef34);utils[_0x49ba('0x3')](util['format'](_0x49ba('0x3a'),_0x23ef34['uniqueid'],queues[_0x23ef34['uniqueid']][_0x49ba('0x20')],_0x23ef34[_0x49ba('0x3b')],_0x23ef34[_0x49ba('0x3c')]));queues[_0x23ef34[_0x49ba('0x6')]][_0x49ba('0x1a')]=![];queues[_0x23ef34['uniqueid']][_0x49ba('0x1a')]=![];queues[_0x23ef34['uniqueid']][_0x49ba('0x28')]=null;queues[_0x23ef34[_0x49ba('0x6')]][_0x49ba('0x1b')]=![];queues[_0x23ef34['uniqueid']][_0x49ba('0xb')]=null;queues[_0x23ef34[_0x49ba('0x6')]]['queuecallerexitAt']=null;queues[_0x23ef34[_0x49ba('0x6')]]['assigned']=!![];queues[_0x23ef34[_0x49ba('0x6')]][_0x49ba('0xa')]=_0x23ef34[_0x49ba('0x3c')];queues[_0x23ef34['uniqueid']][_0x49ba('0x9')]=_0x23ef34[_0x49ba('0x3b')];}}catch(_0x3d2771){utils[_0x49ba('0x15')](util['format']('[%s][queues][agentconnect]',_0x23ef34[_0x49ba('0x6')]),_0x3d2771);}};exports[_0x49ba('0x3d')]=function(_0x54fa57){try{if(!_[_0x49ba('0x17')](queues[_0x54fa57[_0x49ba('0x6')]])){if(queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x19')]){utils['debug'](util[_0x49ba('0x4')]('[%s][queues][agentcomplete]',_0x54fa57[_0x49ba('0x6')]),_0x54fa57);queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x1a')]=![];queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x1a')]=![];queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x28')]=null;queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x1b')]=![];queues[_0x54fa57[_0x49ba('0x6')]]['queuecallerexitAt']=null;queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x3e')]=!![];queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x9')]=_0x54fa57['membername'];queues[_0x54fa57['uniqueid']]['queuecallercomplete']=!![];queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0x1d')]=utils[_0x49ba('0x1e')]();if(_0x54fa57[_0x49ba('0x3f')]==_0x49ba('0x40')){if(!queues[_0x54fa57['uniqueid']][_0x49ba('0x40')]){queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0xb')]=_0x49ba('0x41');}}else{queues[_0x54fa57['uniqueid']][_0x49ba('0xb')]=_0x49ba('0x42')+_0x54fa57[_0x49ba('0x3f')][_0x49ba('0x26')]();}utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x43'),_0x54fa57[_0x49ba('0x6')],queues[_0x54fa57[_0x49ba('0x6')]]['name'],_0x54fa57[_0x49ba('0x3b')],queues[_0x54fa57[_0x49ba('0x6')]][_0x49ba('0xb')]));writeDB(queues[_0x54fa57[_0x49ba('0x6')]]);}}}catch(_0xb95218){utils[_0x49ba('0x15')](util['format'](_0x49ba('0x44'),_0x54fa57[_0x49ba('0x6')]),_0xb95218);}};exports[_0x49ba('0x45')]=function(_0x154ae8){try{if(!_[_0x49ba('0x17')](queues[_0x154ae8[_0x49ba('0x46')]])){utils['debug'](util[_0x49ba('0x4')](_0x49ba('0x47'),_0x154ae8[_0x49ba('0x6')]),_0x154ae8);queues[_0x154ae8[_0x49ba('0x46')]][_0x49ba('0x40')]=!![];queues[_0x154ae8[_0x49ba('0x46')]]['transfertype']=_0x49ba('0x48');queues[_0x154ae8['transfereeuniqueid']][_0x49ba('0x49')]=_0x154ae8[_0x49ba('0x4a')];queues[_0x154ae8[_0x49ba('0x46')]]['transferuniqueid']=_0x154ae8[_0x49ba('0x46')];queues[_0x154ae8[_0x49ba('0x46')]][_0x49ba('0xb')]='BLINDTRANSFER';utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x4b'),_0x154ae8[_0x49ba('0x6')],queues[_0x154ae8[_0x49ba('0x46')]][_0x49ba('0x20')],_0x154ae8[_0x49ba('0x46')],_0x154ae8[_0x49ba('0x4a')]));}}catch(_0x48a5a7){utils[_0x49ba('0x15')](util['format']('[%s][queues][blindtransfer]',_0x154ae8[_0x49ba('0x6')]),_0x48a5a7);}};exports[_0x49ba('0x4c')]=function(_0x2e9104){try{utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x4d'),_0x2e9104[_0x49ba('0x4e')]),_0x2e9104);if(_0x2e9104['origtransfereruniqueid']==_0x2e9104[_0x49ba('0x4f')]){if(!_[_0x49ba('0x17')](queues[_0x2e9104[_0x49ba('0x50')]])){utils[_0x49ba('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x20')],_0x2e9104['origtransfererexten']));queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x40')]=!![];queues[_0x2e9104['secondtransfererlinkedid']][_0x49ba('0x51')]=_0x49ba('0x52');queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x49')]=_0x2e9104[_0x49ba('0x53')];queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x54')]=_0x2e9104[_0x49ba('0x4e')];queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0xb')]=_0x49ba('0x55');}if(!_[_0x49ba('0x17')](queues[_0x2e9104[_0x49ba('0x4f')]])){if(_0x2e9104[_0x49ba('0x56')]&&queues[_0x2e9104[_0x49ba('0x56')]]){queues[_0x2e9104['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x2e9104['transfereeuniqueid']]=_[_0x49ba('0x57')](queues[_0x2e9104[_0x49ba('0x56')]]);queues[_0x2e9104['transfereeuniqueid']][_0x49ba('0x10')]=_0x2e9104[_0x49ba('0x58')];queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x59')]=0x2;queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x5a')]=queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x5a')];queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x5b')]=queues[_0x2e9104['secondtransfererlinkedid']][_0x49ba('0x5b')];queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x36')]=utils['now']();queues[_0x2e9104['transfereeuniqueid']][_0x49ba('0x19')]=utils[_0x49ba('0x1e')]();queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x34')]=0x0;queues[_0x2e9104['transfereeuniqueid']]['mohtime']=0x0;utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x5c'),_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x20')],queues[_0x2e9104[_0x49ba('0x46')]][_0x49ba('0x5a')],queues[_0x2e9104[_0x49ba('0x46')]]['calleridname']));}else{utils['info'](util[_0x49ba('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104['origtransfererlinkedid']][_0x49ba('0x20')],_0x2e9104[_0x49ba('0x50')]));queues[_0x2e9104['origtransfererlinkedid']]['transfereduniqueid']=_0x2e9104[_0x49ba('0x50')];}}}else if(_0x2e9104['secondtransfereruniqueid']==_0x2e9104[_0x49ba('0x50')]){if(!_[_0x49ba('0x17')](queues[_0x2e9104[_0x49ba('0x4f')]])){utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x5d'),_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104[_0x49ba('0x4f')]][_0x49ba('0x20')],_0x2e9104[_0x49ba('0x5e')],_0x2e9104[_0x49ba('0x5f')]));queues[_0x2e9104['origtransfererlinkedid']][_0x49ba('0x40')]=!![];queues[_0x2e9104[_0x49ba('0x4f')]]['transfertype']=_0x49ba('0x52');queues[_0x2e9104[_0x49ba('0x4f')]][_0x49ba('0x49')]=_0x2e9104[_0x49ba('0x5f')];queues[_0x2e9104['origtransfererlinkedid']][_0x49ba('0x54')]=_0x2e9104[_0x49ba('0x5e')];queues[_0x2e9104[_0x49ba('0x4f')]][_0x49ba('0xb')]=_0x49ba('0x55');}if(!_[_0x49ba('0x17')](queues[_0x2e9104[_0x49ba('0x50')]])){if(_0x2e9104[_0x49ba('0x60')]&&queues[_0x2e9104[_0x49ba('0x60')]]){queues[_0x2e9104['transfertargetlinkedid']][_0x49ba('0x59')]=0x1;queues[_0x2e9104['transfertargetuniqueid']]=_[_0x49ba('0x57')](queues[_0x2e9104[_0x49ba('0x60')]]);queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x10')]=_0x2e9104[_0x49ba('0x58')];queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x59')]=0x2;queues[_0x2e9104['transfertargetuniqueid']]['calleridnum']=queues[_0x2e9104['origtransfererlinkedid']][_0x49ba('0x5a')];queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x5b')]=queues[_0x2e9104[_0x49ba('0x4f')]][_0x49ba('0x5b')];queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x36')]=utils[_0x49ba('0x1e')]();queues[_0x2e9104[_0x49ba('0x58')]]['queuecallerleaveAt']=utils[_0x49ba('0x1e')]();queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x34')]=0x0;queues[_0x2e9104[_0x49ba('0x58')]][_0x49ba('0x61')]=0x0;utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x62'),_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104[_0x49ba('0x58')]]['name'],queues[_0x2e9104['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x2e9104[_0x49ba('0x58')]]['calleridnum'],queues[_0x2e9104['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util['format'](_0x49ba('0x63'),_0x2e9104[_0x49ba('0x4e')],queues[_0x2e9104['secondtransfererlinkedid']][_0x49ba('0x20')],_0x2e9104[_0x49ba('0x4f')]));queues[_0x2e9104[_0x49ba('0x50')]][_0x49ba('0x10')]=_0x2e9104[_0x49ba('0x4f')];}}}}catch(_0x89c81d){utils[_0x49ba('0x15')](util[_0x49ba('0x4')](_0x49ba('0x4d'),_0x2e9104[_0x49ba('0x4e')]),_0x89c81d);}};exports[_0x49ba('0x64')]=function(_0x526575){try{if(!_[_0x49ba('0x17')](queues[_0x526575[_0x49ba('0x6')]])){utils[_0x49ba('0x18')](util[_0x49ba('0x4')](_0x49ba('0x65'),_0x526575[_0x49ba('0x6')]),_0x526575);queues[_0x526575[_0x49ba('0x6')]][_0x49ba('0x66')]=utils[_0x49ba('0x1e')]();utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x67'),_0x526575[_0x49ba('0x6')],queues[_0x526575[_0x49ba('0x6')]]['name'],queues[_0x526575['uniqueid']][_0x49ba('0x66')]));}}catch(_0x42b245){utils[_0x49ba('0x15')](util[_0x49ba('0x4')](_0x49ba('0x65'),_0x526575[_0x49ba('0x6')]),_0x42b245);}};exports[_0x49ba('0x68')]=function(_0x51ddce){try{if(!_[_0x49ba('0x17')](queues[_0x51ddce[_0x49ba('0x6')]])){if(!_['isNil'](queues[_0x51ddce[_0x49ba('0x6')]][_0x49ba('0x66')])){utils[_0x49ba('0x18')](util['format'](_0x49ba('0x69'),_0x51ddce[_0x49ba('0x6')]),_0x51ddce);queues[_0x51ddce['uniqueid']][_0x49ba('0x61')]+=utils[_0x49ba('0x35')](utils[_0x49ba('0x1e')](),queues[_0x51ddce[_0x49ba('0x6')]]['musiconholdstartAt']);utils[_0x49ba('0x3')](util[_0x49ba('0x4')](_0x49ba('0x6a'),_0x51ddce[_0x49ba('0x6')],queues[_0x51ddce[_0x49ba('0x6')]]['name'],queues[_0x51ddce[_0x49ba('0x6')]][_0x49ba('0x61')]));delete queues[_0x51ddce[_0x49ba('0x6')]]['musiconholdstartAt'];}}}catch(_0x27a1b9){utils['error'](util['format'](_0x49ba('0x69'),_0x51ddce[_0x49ba('0x6')]),_0x27a1b9);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7655f55..dc8dd72 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 _0x7c8c=['getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','format','uniqueid','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value','replace','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','[%s][recordings][writeDB]','accountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c8c,0xef));var _0xc7c8=function(_0x857b31,_0x4427fd){_0x857b31=_0x857b31-0x0;var _0x5b6dab=_0x7c8c[_0x857b31];return _0x5b6dab;};'use strict';var _=require('lodash');var util=require(_0xc7c8('0x0'));var utils=require(_0xc7c8('0x1'));var recordings={};function writeDB(_0x242ba4){utils[_0xc7c8('0x2')](util['format'](_0xc7c8('0x3'),_0x242ba4['uniqueid']));if(_0x242ba4[_0xc7c8('0x4')]){utils[_0xc7c8('0x5')](_0x242ba4[_0xc7c8('0x4')])['then'](function(_0x1035c4){if(_0x1035c4){_0x242ba4[_0xc7c8('0x6')]=_0x1035c4[_0xc7c8('0x7')];_0x242ba4[_0xc7c8('0x8')]=_0x1035c4['id'];}utils[_0xc7c8('0x9')](_0xc7c8('0xa'),_0x242ba4);});}else{utils[_0xc7c8('0x9')](_0xc7c8('0xa'),_0x242ba4);}}exports['newchannel']=function(_0x244458){try{utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]',_0x244458[_0xc7c8('0xd')]),_0x244458);if(_0x244458['uniqueid']==_0x244458[_0xc7c8('0xe')]){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x244458[_0xc7c8('0xd')],_0x244458[_0xc7c8('0xf')],_0x244458['exten']));recordings[_0x244458['uniqueid']]={'uniqueid':_0x244458[_0xc7c8('0xd')],'accountcode':_0x244458[_0xc7c8('0x4')],'exten':_0x244458[_0xc7c8('0x10')],'context':_0x244458[_0xc7c8('0xf')],'channel':_0x244458['channel'],'monitors':[]};}}catch(_0x40f6b2){utils[_0xc7c8('0x11')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]',_0x244458[_0xc7c8('0xd')]),_0x40f6b2);}};exports[_0xc7c8('0x12')]=function(_0x795057){try{utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x13'),_0x795057[_0xc7c8('0xd')]),_0x795057);if(!_[_0xc7c8('0x14')](recordings[_0x795057[_0xc7c8('0xd')]])&&_0x795057[_0xc7c8('0x15')]==0x6){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x16'),_0x795057['uniqueid'],_0x795057[_0xc7c8('0xf')],_0x795057[_0xc7c8('0x17')]));}else if(!_[_0xc7c8('0x14')](recordings[_0x795057[_0xc7c8('0xe')]])&&_0x795057['channelstate']==0x6&&_0x795057[_0xc7c8('0xf')]!=_0xc7c8('0x18')){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x795057[_0xc7c8('0xd')],_0x795057[_0xc7c8('0xe')],_0x795057[_0xc7c8('0xf')],_0x795057[_0xc7c8('0x17')]));recordings[_0x795057[_0xc7c8('0xe')]][_0xc7c8('0x4')]=_0x795057[_0xc7c8('0x4')];}}catch(_0x1eb0d8){utils['error'](util[_0xc7c8('0xc')](_0xc7c8('0x13'),_0x795057[_0xc7c8('0xd')]),_0x1eb0d8);}};exports[_0xc7c8('0x19')]=function(_0x5f0cd2){try{if(!_[_0xc7c8('0x14')](_0x5f0cd2[_0xc7c8('0x1a')])&&!_['isNil'](_0x5f0cd2[_0xc7c8('0x1a')][_0xc7c8('0x1b')])){utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x1c'),_0x5f0cd2['uniqueid']),_0x5f0cd2);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5f0cd2[_0xc7c8('0xd')],_0x5f0cd2[_0xc7c8('0x1a')],_0x5f0cd2['value']));if(_[_0xc7c8('0x1d')](_0x5f0cd2[_0xc7c8('0x1e')],'.wav49')){_0x5f0cd2[_0xc7c8('0x1e')]=_0x5f0cd2[_0xc7c8('0x1e')][_0xc7c8('0x1f')](_0xc7c8('0x20'),'.WAV');}if(recordings[_0x5f0cd2['linkedid']]){var _0x3049a6=_[_0xc7c8('0x21')](recordings[_0x5f0cd2[_0xc7c8('0xe')]]['monitors'],{'value':_0x5f0cd2['value']});if(_[_0xc7c8('0x14')](_0x3049a6)){recordings[_0x5f0cd2[_0xc7c8('0xe')]][_0xc7c8('0x22')][_0xc7c8('0x23')]({'value':_0x5f0cd2['value']});}}}}catch(_0x49e32a){utils['error'](util['format']('[%s][recordings][varset]',_0x5f0cd2[_0xc7c8('0xd')]),_0x49e32a);}};exports[_0xc7c8('0x24')]=function(_0x3be7a0){try{if(!_[_0xc7c8('0x14')](recordings[_0x3be7a0[_0xc7c8('0xd')]])){utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x25'),_0x3be7a0['uniqueid']),_0x3be7a0);utils[_0xc7c8('0x2')](util['format'](_0xc7c8('0x26'),_0x3be7a0[_0xc7c8('0xd')],_0x3be7a0['calleridnum'],_0x3be7a0[_0xc7c8('0x27')],_0x3be7a0[_0xc7c8('0x28')]));recordings[_0x3be7a0[_0xc7c8('0xd')]]['calleridnum']=_0x3be7a0[_0xc7c8('0x29')];recordings[_0x3be7a0[_0xc7c8('0xd')]]['calleridname']=_0x3be7a0[_0xc7c8('0x27')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2a')]=_0x3be7a0[_0xc7c8('0x2a')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2b')]=_0x3be7a0[_0xc7c8('0x2b')];if(recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2c')]==_0xc7c8('0x2d')&&recordings[_0x3be7a0['uniqueid']][_0xc7c8('0x4')]){recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2a')]=recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x4')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2b')]='';}recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x22')]['forEach'](function(_0x3a9d03){var _0xc2aff1=_['clone'](recordings[_0x3be7a0['uniqueid']]);_0xc2aff1[_0xc7c8('0x1e')]=_0x3a9d03[_0xc7c8('0x1e')];writeDB(_0xc2aff1);});delete recordings[_0x3be7a0[_0xc7c8('0xd')]];}}catch(_0x252782){utils['error'](util[_0xc7c8('0xc')](_0xc7c8('0x25'),_0x3be7a0['uniqueid']),_0x252782);}};exports[_0xc7c8('0x2e')]=function(_0x869866){try{if(!_[_0xc7c8('0x14')](recordings[_0x869866[_0xc7c8('0xd')]])){utils['debug'](util['format'](_0xc7c8('0x2f'),_0x869866['uniqueid']),_0x869866);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x30'),_0x869866['uniqueid'],_0x869866[_0xc7c8('0x31')],_0x869866[_0xc7c8('0x32')]));if(_0x869866['application']['toLowerCase']()==_0xc7c8('0x33')&&_[_0xc7c8('0x34')](_0x869866[_0xc7c8('0x32')][_0xc7c8('0x35')](),_0xc7c8('0x36'))){var _0x740169=_0x869866[_0xc7c8('0x32')][_0xc7c8('0x37')]('=');var _0x526a7a=_0x740169[0x0][_0xc7c8('0x38')](_0x740169[0x0][_0xc7c8('0x39')]('(')+0x1,_0x740169[0x0][_0xc7c8('0x39')](')'));var _0x1fd411=_0x740169[0x1];recordings[_0x869866['uniqueid']][_0x526a7a]=_0x1fd411;}}}catch(_0xafea0d){utils['error'](util[_0xc7c8('0xc')]('[%s][recordings][newexten]',_0x869866[_0xc7c8('0xd')]),_0xafea0d);}};exports['queuecallerjoin']=function(_0xfef08a){try{if(!_[_0xc7c8('0x14')](recordings[_0xfef08a[_0xc7c8('0xd')]])){utils[_0xc7c8('0xb')](util['format'](_0xc7c8('0x3a'),_0xfef08a['uniqueid']),_0xfef08a);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x3b'),_0xfef08a['uniqueid'],_0xfef08a[_0xc7c8('0x3c')]));recordings[_0xfef08a[_0xc7c8('0xd')]]['queue']=_0xfef08a[_0xc7c8('0x3c')];}}catch(_0x488a25){utils[_0xc7c8('0x11')](util[_0xc7c8('0xc')](_0xc7c8('0x3a'),_0xfef08a[_0xc7c8('0xd')]),_0x488a25);}}; \ No newline at end of file +var _0x5289=['[%s][recordings][newchannel]','context','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','.wav49','value','.WAV','find','monitors','push','hangup','debug','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel'];(function(_0x42eb51,_0xafa7f2){var _0x403569=function(_0x51d5b9){while(--_0x51d5b9){_0x42eb51['push'](_0x42eb51['shift']());}};_0x403569(++_0xafa7f2);}(_0x5289,0xa8));var _0x9528=function(_0x2fe336,_0x5c3905){_0x2fe336=_0x2fe336-0x0;var _0x394834=_0x5289[_0x2fe336];return _0x394834;};'use strict';var _=require(_0x9528('0x0'));var util=require(_0x9528('0x1'));var utils=require(_0x9528('0x2'));var recordings={};function writeDB(_0x13356c){utils[_0x9528('0x3')](util[_0x9528('0x4')](_0x9528('0x5'),_0x13356c[_0x9528('0x6')]));if(_0x13356c[_0x9528('0x7')]){utils[_0x9528('0x8')](_0x13356c['accountcode'])[_0x9528('0x9')](function(_0x2807c4){if(_0x2807c4){_0x13356c['membername']=_0x2807c4[_0x9528('0xa')];_0x13356c[_0x9528('0xb')]=_0x2807c4['id'];}utils['request']('CreateVoiceRecording',_0x13356c);});}else{utils[_0x9528('0xc')](_0x9528('0xd'),_0x13356c);}}exports[_0x9528('0xe')]=function(_0x58fff2){try{utils['debug'](util['format'](_0x9528('0xf'),_0x58fff2['uniqueid']),_0x58fff2);if(_0x58fff2[_0x9528('0x6')]==_0x58fff2['linkedid']){utils['info'](util[_0x9528('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x58fff2[_0x9528('0x6')],_0x58fff2[_0x9528('0x10')],_0x58fff2['exten']));recordings[_0x58fff2['uniqueid']]={'uniqueid':_0x58fff2[_0x9528('0x6')],'accountcode':_0x58fff2['accountcode'],'exten':_0x58fff2['exten'],'context':_0x58fff2[_0x9528('0x10')],'channel':_0x58fff2['channel'],'monitors':[]};}}catch(_0x19178e){utils[_0x9528('0x11')](util['format'](_0x9528('0xf'),_0x58fff2[_0x9528('0x6')]),_0x19178e);}};exports[_0x9528('0x12')]=function(_0x372587){try{utils['debug'](util[_0x9528('0x4')](_0x9528('0x13'),_0x372587[_0x9528('0x6')]),_0x372587);if(!_[_0x9528('0x14')](recordings[_0x372587['uniqueid']])&&_0x372587[_0x9528('0x15')]==0x6){utils[_0x9528('0x3')](util[_0x9528('0x4')](_0x9528('0x16'),_0x372587[_0x9528('0x6')],_0x372587['context'],_0x372587[_0x9528('0x17')]));}else if(!_['isNil'](recordings[_0x372587[_0x9528('0x18')]])&&_0x372587[_0x9528('0x15')]==0x6&&_0x372587[_0x9528('0x10')]!='transfer'){utils[_0x9528('0x3')](util[_0x9528('0x4')](_0x9528('0x19'),_0x372587[_0x9528('0x6')],_0x372587[_0x9528('0x18')],_0x372587['context'],_0x372587[_0x9528('0x17')]));recordings[_0x372587[_0x9528('0x18')]]['accountcode']=_0x372587['accountcode'];}}catch(_0x4cd472){utils[_0x9528('0x11')](util['format'](_0x9528('0x13'),_0x372587[_0x9528('0x6')]),_0x4cd472);}};exports[_0x9528('0x1a')]=function(_0xf71cad){try{if(!_['isNil'](_0xf71cad['variable'])&&!_['isNil'](_0xf71cad[_0x9528('0x1b')][_0x9528('0x1c')])){utils['debug'](util['format'](_0x9528('0x1d'),_0xf71cad[_0x9528('0x6')]),_0xf71cad);utils[_0x9528('0x3')](util[_0x9528('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0xf71cad[_0x9528('0x6')],_0xf71cad[_0x9528('0x1b')],_0xf71cad['value']));if(_[_0x9528('0x1e')](_0xf71cad['value'],_0x9528('0x1f'))){_0xf71cad[_0x9528('0x20')]=_0xf71cad[_0x9528('0x20')]['replace'](_0x9528('0x1f'),_0x9528('0x21'));}if(recordings[_0xf71cad['linkedid']]){var _0x2cbb9a=_[_0x9528('0x22')](recordings[_0xf71cad[_0x9528('0x18')]][_0x9528('0x23')],{'value':_0xf71cad[_0x9528('0x20')]});if(_[_0x9528('0x14')](_0x2cbb9a)){recordings[_0xf71cad[_0x9528('0x18')]][_0x9528('0x23')][_0x9528('0x24')]({'value':_0xf71cad[_0x9528('0x20')]});}}}}catch(_0x3ee448){utils['error'](util[_0x9528('0x4')](_0x9528('0x1d'),_0xf71cad[_0x9528('0x6')]),_0x3ee448);}};exports[_0x9528('0x25')]=function(_0x49f52f){try{if(!_['isNil'](recordings[_0x49f52f['uniqueid']])){utils[_0x9528('0x26')](util[_0x9528('0x4')](_0x9528('0x27'),_0x49f52f[_0x9528('0x6')]),_0x49f52f);utils[_0x9528('0x3')](util[_0x9528('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x49f52f[_0x9528('0x6')],_0x49f52f[_0x9528('0x28')],_0x49f52f[_0x9528('0x29')],_0x49f52f[_0x9528('0x2a')]));recordings[_0x49f52f[_0x9528('0x6')]][_0x9528('0x28')]=_0x49f52f[_0x9528('0x28')];recordings[_0x49f52f['uniqueid']]['calleridname']=_0x49f52f[_0x9528('0x29')];recordings[_0x49f52f['uniqueid']][_0x9528('0x2b')]=_0x49f52f['connectedlinenum'];recordings[_0x49f52f[_0x9528('0x6')]][_0x9528('0x2c')]=_0x49f52f['connectedlinename'];if(recordings[_0x49f52f[_0x9528('0x6')]][_0x9528('0x2d')]=='outbound'&&recordings[_0x49f52f[_0x9528('0x6')]][_0x9528('0x7')]){recordings[_0x49f52f[_0x9528('0x6')]][_0x9528('0x2b')]=recordings[_0x49f52f['uniqueid']][_0x9528('0x7')];recordings[_0x49f52f[_0x9528('0x6')]]['connectedlinename']='';}recordings[_0x49f52f['uniqueid']]['monitors']['forEach'](function(_0x4e7c5c){var _0x55290d=_[_0x9528('0x2e')](recordings[_0x49f52f[_0x9528('0x6')]]);_0x55290d[_0x9528('0x20')]=_0x4e7c5c[_0x9528('0x20')];writeDB(_0x55290d);});delete recordings[_0x49f52f[_0x9528('0x6')]];}}catch(_0x347e9f){utils['error'](util[_0x9528('0x4')]('[%s][recordings][hangup]',_0x49f52f['uniqueid']),_0x347e9f);}};exports[_0x9528('0x2f')]=function(_0x5d2b5b){try{if(!_[_0x9528('0x14')](recordings[_0x5d2b5b['uniqueid']])){utils['debug'](util[_0x9528('0x4')]('[%s][recordings][newexten]',_0x5d2b5b[_0x9528('0x6')]),_0x5d2b5b);utils['info'](util['format'](_0x9528('0x30'),_0x5d2b5b[_0x9528('0x6')],_0x5d2b5b[_0x9528('0x31')],_0x5d2b5b[_0x9528('0x32')]));if(_0x5d2b5b[_0x9528('0x31')][_0x9528('0x33')]()=='set'&&_[_0x9528('0x34')](_0x5d2b5b[_0x9528('0x32')]['toLowerCase'](),_0x9528('0x35'))){var _0x59b365=_0x5d2b5b[_0x9528('0x32')][_0x9528('0x36')]('=');var _0x572157=_0x59b365[0x0][_0x9528('0x37')](_0x59b365[0x0][_0x9528('0x38')]('(')+0x1,_0x59b365[0x0][_0x9528('0x38')](')'));var _0x274a4e=_0x59b365[0x1];recordings[_0x5d2b5b[_0x9528('0x6')]][_0x572157]=_0x274a4e;}}}catch(_0x2d6f81){utils['error'](util['format'](_0x9528('0x39'),_0x5d2b5b[_0x9528('0x6')]),_0x2d6f81);}};exports['queuecallerjoin']=function(_0x29bc18){try{if(!_['isNil'](recordings[_0x29bc18[_0x9528('0x6')]])){utils[_0x9528('0x26')](util[_0x9528('0x4')](_0x9528('0x3a'),_0x29bc18[_0x9528('0x6')]),_0x29bc18);utils[_0x9528('0x3')](util[_0x9528('0x4')](_0x9528('0x3b'),_0x29bc18[_0x9528('0x6')],_0x29bc18[_0x9528('0x3c')]));recordings[_0x29bc18[_0x9528('0x6')]][_0x9528('0x3c')]=_0x29bc18[_0x9528('0x3c')];}}catch(_0x3f51a5){utils['error'](util[_0x9528('0x4')](_0x9528('0x3a'),_0x29bc18[_0x9528('0x6')]),_0x3f51a5);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9158888..bd2aa96 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 _0x791b=['transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','info','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel'];(function(_0x2eade3,_0x5be0b9){var _0x5c4845=function(_0x19fbe7){while(--_0x19fbe7){_0x2eade3['push'](_0x2eade3['shift']());}};_0x5c4845(++_0x5be0b9);}(_0x791b,0xcb));var _0xb791=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x791b[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb791('0x0'));var util=require('util');var utils=require(_0xb791('0x1'));function writeDB(_0x4bcddd){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x4bcddd[_0xb791('0x2')]===_0xb791('0x3')?_0x4bcddd[_0xb791('0x4')]:_0x4bcddd[_0xb791('0x5')],_0x4bcddd[_0xb791('0x2')]));utils['request']('CreateVoiceTransferReport',_0x4bcddd);}exports[_0xb791('0x6')]=function(_0x4bdd9f){try{utils[_0xb791('0x7')](util['format']('[%s][transfers][blindtransfer]',_0x4bdd9f[_0xb791('0x5')]),_0x4bdd9f);utils[_0xb791('0x8')](util[_0xb791('0x9')](_0xb791('0xa'),_0x4bdd9f['uniqueid'],_0x4bdd9f[_0xb791('0xb')],_0x4bdd9f['transferercalleridname'],_0x4bdd9f['transfereecalleridnum'],_0x4bdd9f[_0xb791('0xc')]));_0x4bdd9f[_0xb791('0x2')]=_0xb791('0xd');writeDB(_0x4bdd9f);}catch(_0x34e5d5){utils['error'](util[_0xb791('0x9')](_0xb791('0xe'),_0x4bdd9f[_0xb791('0x5')]),_0x34e5d5);}};exports['attendedtransfer']=function(_0x4810f4){try{utils['debug'](util[_0xb791('0x9')](_0xb791('0xf'),_0x4810f4['origtransfereruniqueid']),_0x4810f4);utils[_0xb791('0x8')](util['format'](_0xb791('0x10'),_0x4810f4[_0xb791('0x4')],_0x4810f4[_0xb791('0x11')],_0x4810f4[_0xb791('0x12')],_0x4810f4[_0xb791('0x13')],_0x4810f4[_0xb791('0x14')]));_0x4810f4=_[_0xb791('0x15')](_0x4810f4,{'transfererchannel':_0x4810f4[_0xb791('0x16')],'transferercalleridnum':_0x4810f4[_0xb791('0x11')],'transferercalleridname':_0x4810f4[_0xb791('0x12')],'transfererconnectedlinenum':_0x4810f4[_0xb791('0x17')],'transfererconnectedlinename':_0x4810f4['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4810f4[_0xb791('0x18')],'transferercontext':_0x4810f4[_0xb791('0x19')],'transfererexten':_0x4810f4[_0xb791('0x1a')],'transfererlinkedid':_0x4810f4[_0xb791('0x1b')],'context':_0x4810f4[_0xb791('0x1c')],'extension':_0x4810f4[_0xb791('0x1d')],'type':'attended'});if(_['isNil'](_0x4810f4[_0xb791('0x1e')])){_0x4810f4=_[_0xb791('0x15')](_0x4810f4,{'transfereechannel':_0x4810f4[_0xb791('0x1f')],'transfereecalleridnum':_0x4810f4['transfertargetcalleridnum'],'transfereecalleridname':_0x4810f4[_0xb791('0x14')],'transfereeconnectedlinenum':_0x4810f4[_0xb791('0x20')],'transfereeconnectedlinename':_0x4810f4[_0xb791('0x21')],'transfereeaccountcode':_0x4810f4[_0xb791('0x22')],'transfereecontext':_0x4810f4[_0xb791('0x23')],'transfereeexten':_0x4810f4[_0xb791('0x24')],'transfereelinkedid':_0x4810f4[_0xb791('0x25')]});}writeDB(_0x4810f4);}catch(_0x2450bd){utils[_0xb791('0x26')](util[_0xb791('0x9')](_0xb791('0xf'),_0x4810f4[_0xb791('0x4')]),_0x2450bd);}}; \ No newline at end of file +var _0x3799=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','type','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3799,0x1c8));var _0x9379=function(_0x1223a5,_0x420f36){_0x1223a5=_0x1223a5-0x0;var _0x3692c5=_0x3799[_0x1223a5];return _0x3692c5;};'use strict';var _=require(_0x9379('0x0'));var util=require('util');var utils=require(_0x9379('0x1'));function writeDB(_0x3831a0){utils['info'](util[_0x9379('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x3831a0[_0x9379('0x3')]==='attended'?_0x3831a0[_0x9379('0x4')]:_0x3831a0['uniqueid'],_0x3831a0[_0x9379('0x3')]));utils['request'](_0x9379('0x5'),_0x3831a0);}exports[_0x9379('0x6')]=function(_0x13c726){try{utils[_0x9379('0x7')](util[_0x9379('0x2')](_0x9379('0x8'),_0x13c726[_0x9379('0x9')]),_0x13c726);utils[_0x9379('0xa')](util['format'](_0x9379('0xb'),_0x13c726[_0x9379('0x9')],_0x13c726[_0x9379('0xc')],_0x13c726['transferercalleridname'],_0x13c726[_0x9379('0xd')],_0x13c726[_0x9379('0xe')]));_0x13c726['type']='blind';writeDB(_0x13c726);}catch(_0x2e24a6){utils[_0x9379('0xf')](util[_0x9379('0x2')](_0x9379('0x8'),_0x13c726[_0x9379('0x9')]),_0x2e24a6);}};exports[_0x9379('0x10')]=function(_0x4ab189){try{utils['debug'](util[_0x9379('0x2')](_0x9379('0x11'),_0x4ab189[_0x9379('0x4')]),_0x4ab189);utils['info'](util['format'](_0x9379('0x12'),_0x4ab189[_0x9379('0x4')],_0x4ab189[_0x9379('0x13')],_0x4ab189[_0x9379('0x14')],_0x4ab189[_0x9379('0x15')],_0x4ab189['transfertargetcalleridname']));_0x4ab189=_[_0x9379('0x16')](_0x4ab189,{'transfererchannel':_0x4ab189[_0x9379('0x17')],'transferercalleridnum':_0x4ab189[_0x9379('0x13')],'transferercalleridname':_0x4ab189[_0x9379('0x14')],'transfererconnectedlinenum':_0x4ab189[_0x9379('0x18')],'transfererconnectedlinename':_0x4ab189[_0x9379('0x19')],'transfereraccountcode':_0x4ab189[_0x9379('0x1a')],'transferercontext':_0x4ab189[_0x9379('0x1b')],'transfererexten':_0x4ab189['secondtransfererexten'],'transfererlinkedid':_0x4ab189[_0x9379('0x1c')],'context':_0x4ab189[_0x9379('0x1d')],'extension':_0x4ab189[_0x9379('0x1e')],'type':_0x9379('0x1f')});if(_[_0x9379('0x20')](_0x4ab189['transfereechannel'])){_0x4ab189=_['assign'](_0x4ab189,{'transfereechannel':_0x4ab189[_0x9379('0x21')],'transfereecalleridnum':_0x4ab189[_0x9379('0x15')],'transfereecalleridname':_0x4ab189[_0x9379('0x22')],'transfereeconnectedlinenum':_0x4ab189[_0x9379('0x23')],'transfereeconnectedlinename':_0x4ab189[_0x9379('0x24')],'transfereeaccountcode':_0x4ab189['transfertargetaccountcode'],'transfereecontext':_0x4ab189[_0x9379('0x25')],'transfereeexten':_0x4ab189[_0x9379('0x26')],'transfereelinkedid':_0x4ab189[_0x9379('0x27')]});}writeDB(_0x4ab189);}catch(_0x29ac94){utils[_0x9379('0xf')](util[_0x9379('0x2')](_0x9379('0x11'),_0x4ab189['origtransfereruniqueid']),_0x29ac94);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 79500cc..26d2672 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 _0xceca=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0xceca,0x163));var _0xacec=function(_0x179340,_0x5e0d90){_0x179340=_0x179340-0x0;var _0x4d4d3e=_0xceca[_0x179340];return _0x4d4d3e;};'use strict';var BPromise=require(_0xacec('0x0'));var jayson=require(_0xacec('0x1'));var moment=require(_0xacec('0x2'));var util=require(_0xacec('0x3'));var client=jayson['client'][_0xacec('0x4')]({'port':0x2329});var logger=require(_0xacec('0x5'))(_0xacec('0x6'));exports[_0xacec('0x7')]=function(_0x3b9feb,_0x24733a){logger[_0xacec('0x7')](_0x3b9feb,_0x24733a?util[_0xacec('0x8')](_0x24733a,{'showHidden':![],'depth':null}):'');};exports[_0xacec('0x9')]=function(_0x3b5d3f,_0x3a3be6){logger[_0xacec('0x9')](_0x3b5d3f,_0x3a3be6?util['inspect'](_0x3a3be6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x2c54af,_0x28f5a7){logger[_0xacec('0xa')](_0x2c54af,_0x28f5a7?util[_0xacec('0x8')](_0x28f5a7,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xa5286e,_0x32358a){return client['request'](_0xa5286e,{'body':_0x32358a})[_0xacec('0xb')](function(_0x558ed1){logger[_0xacec('0x9')](_0xacec('0xc'),_0xa5286e,_0x558ed1?util[_0xacec('0x8')](_0x558ed1,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5721ed){logger['error'](_0xacec('0xc'),_0xa5286e,_0x5721ed?util[_0xacec('0x8')](_0x5721ed,{'showHidden':![],'depth':null}):'');});};function getUser(_0xbf6e6){return client[_0xacec('0xd')](_0xacec('0xe'),{'options':{'raw':!![],'attributes':['id',_0xacec('0xf'),_0xacec('0x10'),'interface'],'where':_0xbf6e6,'limit':0x1}})[_0xacec('0xb')](function(_0x1a7d3a){logger[_0xacec('0x9')](_0xacec('0x11'),JSON[_0xacec('0x12')](_0xbf6e6),_0x1a7d3a?util['inspect'](_0x1a7d3a,{'showHidden':![],'depth':null}):'');return _0x1a7d3a[_0xacec('0x13')]['length']?_0x1a7d3a[_0xacec('0x13')][0x0]:null;});}exports[_0xacec('0x14')]=function(_0x3a1019){return new BPromise(function(_0x5738e7,_0x463834){if(_0x3a1019){return getUser({'internal':_0x3a1019})[_0xacec('0xb')](function(_0x39392f){logger[_0xacec('0x7')](_0xacec('0x15'),_0x3a1019,_0x39392f?_0xacec('0x16'):'notfound');return _0x5738e7(_0x39392f);})[_0xacec('0x17')](function(_0x1d8949){logger['error']('[utils][getUserByInternal]',_0x1d8949?util[_0xacec('0x8')](_0x1d8949,{'showHidden':![],'depth':null}):'');return _0x5738e7(null);});}return _0x5738e7(null);});};exports[_0xacec('0x18')]=function(_0x56e73e){return new BPromise(function(_0x187f4a,_0x4f8805){if(_0x56e73e){return getUser({'interface':_0x56e73e})[_0xacec('0xb')](function(_0x319360){logger[_0xacec('0x7')](_0xacec('0x19'),_0x56e73e,_0x319360?'found':'notfound');return _0x187f4a(_0x319360);})[_0xacec('0x17')](function(_0x1e7c69){logger[_0xacec('0xa')]('[utils][getUserByInterface]',_0x1e7c69?util[_0xacec('0x8')](_0x1e7c69,{'showHidden':![],'depth':null}):'');return _0x187f4a(null);});}return _0x187f4a(null);});};exports[_0xacec('0x1a')]=function(_0x59fde7){return new BPromise(function(_0x48b3f6,_0x4f44d1){if(_0x59fde7){return getUser({'name':_0x59fde7})[_0xacec('0xb')](function(_0x2aef51){logger[_0xacec('0x7')](_0xacec('0x1b'),_0x59fde7,_0x2aef51?'found':_0xacec('0x1c'));return _0x48b3f6(_0x2aef51);})[_0xacec('0x17')](function(_0x57c310){logger['error'](_0xacec('0x1d'),_0x57c310?util[_0xacec('0x8')](_0x57c310,{'showHidden':![],'depth':null}):'');return _0x48b3f6(null);});}return _0x48b3f6(null);});};exports[_0xacec('0x1e')]=function(_0x5edfd9){return new BPromise(function(_0xefcd2d,_0x1b833e){if(_0x5edfd9){return client[_0xacec('0xd')](_0xacec('0x1f'),{'options':{'raw':!![],'attributes':['id','name','type',_0xacec('0x20'),_0xacec('0x21')],'where':{'name':_0x5edfd9},'limit':0x1}})[_0xacec('0xb')](function(_0x18ba88){logger[_0xacec('0x9')](_0xacec('0x22'),_0x5edfd9,_0x18ba88?util[_0xacec('0x8')](_0x18ba88,{'showHidden':![],'depth':null}):'');logger[_0xacec('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x5edfd9,_0x18ba88?_0xacec('0x16'):_0xacec('0x1c'));return _0xefcd2d(_0x18ba88[_0xacec('0x13')][_0xacec('0x23')]?_0x18ba88[_0xacec('0x13')][0x0]:null);})['catch'](function(_0x96618c){logger[_0xacec('0xa')](_0xacec('0x24'),_0x96618c?util[_0xacec('0x8')](_0x96618c,{'showHidden':![],'depth':null}):'');return _0xefcd2d(null);});}return _0xefcd2d(null);});};exports[_0xacec('0x25')]=function(_0x5506fe,_0x352416){return moment(_0x5506fe)[_0xacec('0x26')](_0x352416,_0xacec('0x27'))['format'](_0xacec('0x28'));};exports[_0xacec('0x29')]=function(_0x13b143,_0x668cde){return moment(_0x13b143)['subtract'](_0x668cde,'seconds')[_0xacec('0x2a')](_0xacec('0x28'));};exports[_0xacec('0x2b')]=function(_0x16d1b0,_0x5cf046){return moment(_0x16d1b0)[_0xacec('0x2c')](moment(_0x5cf046),_0xacec('0x27'));};exports[_0xacec('0x2d')]=function(_0x200044,_0x5cad30){return parseInt(_0x200044,0xa)+parseInt(_0x5cad30,0xa);};exports[_0xacec('0x2e')]=function(){return moment()[_0xacec('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x330687,_0x129b77){if(_0x129b77){return moment(_0x330687)['isAfter'](_0x129b77);}return!![];};exports['isBefore']=function(_0x27347f,_0x164b65){if(_0x164b65){return moment(_0x27347f)['isBefore'](_0x164b65);}else if(_0x27347f){return!![];}return![];}; \ No newline at end of file +var _0x7fd1=['getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','isAfter','bluebird','jayson/promise','moment','util','http','xdr','info','inspect','debug','error','request','then','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result'];(function(_0x4b3bef,_0x2ae107){var _0x2c9a45=function(_0x5ceb3d){while(--_0x5ceb3d){_0x4b3bef['push'](_0x4b3bef['shift']());}};_0x2c9a45(++_0x2ae107);}(_0x7fd1,0x6a));var _0x17fd=function(_0x5bf3e2,_0x2d7c4b){_0x5bf3e2=_0x5bf3e2-0x0;var _0x44fe35=_0x7fd1[_0x5bf3e2];return _0x44fe35;};'use strict';var BPromise=require(_0x17fd('0x0'));var jayson=require(_0x17fd('0x1'));var moment=require(_0x17fd('0x2'));var util=require(_0x17fd('0x3'));var client=jayson['client'][_0x17fd('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x17fd('0x5'));exports['info']=function(_0x35d465,_0x4c0c2f){logger[_0x17fd('0x6')](_0x35d465,_0x4c0c2f?util[_0x17fd('0x7')](_0x4c0c2f,{'showHidden':![],'depth':null}):'');};exports[_0x17fd('0x8')]=function(_0x55db38,_0x4bf786){logger[_0x17fd('0x8')](_0x55db38,_0x4bf786?util[_0x17fd('0x7')](_0x4bf786,{'showHidden':![],'depth':null}):'');};exports[_0x17fd('0x9')]=function(_0x2ed22d,_0x19cd32){logger[_0x17fd('0x9')](_0x2ed22d,_0x19cd32?util['inspect'](_0x19cd32,{'showHidden':![],'depth':null}):'');};exports[_0x17fd('0xa')]=function(_0x25142a,_0x40c717){return client[_0x17fd('0xa')](_0x25142a,{'body':_0x40c717})[_0x17fd('0xb')](function(_0x58f67e){logger[_0x17fd('0x8')]('[utils][request]\x20name:%s',_0x25142a,_0x58f67e?util[_0x17fd('0x7')](_0x58f67e,{'showHidden':![],'depth':null}):'');})[_0x17fd('0xc')](function(_0x42da8e){logger['error']('[utils][request]\x20name:%s',_0x25142a,_0x42da8e?util['inspect'](_0x42da8e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x302931){return client[_0x17fd('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x17fd('0xd'),_0x17fd('0xe'),_0x17fd('0xf')],'where':_0x302931,'limit':0x1}})[_0x17fd('0xb')](function(_0x4923d2){logger[_0x17fd('0x8')](_0x17fd('0x10'),JSON[_0x17fd('0x11')](_0x302931),_0x4923d2?util[_0x17fd('0x7')](_0x4923d2,{'showHidden':![],'depth':null}):'');return _0x4923d2['result'][_0x17fd('0x12')]?_0x4923d2[_0x17fd('0x13')][0x0]:null;});}exports[_0x17fd('0x14')]=function(_0x20fcb1){return new BPromise(function(_0x491b0c,_0x1456c2){if(_0x20fcb1){return getUser({'internal':_0x20fcb1})[_0x17fd('0xb')](function(_0x358d47){logger[_0x17fd('0x6')](_0x17fd('0x15'),_0x20fcb1,_0x358d47?_0x17fd('0x16'):'notfound');return _0x491b0c(_0x358d47);})[_0x17fd('0xc')](function(_0x7c5713){logger['error'](_0x17fd('0x17'),_0x7c5713?util['inspect'](_0x7c5713,{'showHidden':![],'depth':null}):'');return _0x491b0c(null);});}return _0x491b0c(null);});};exports['getUserByInterface']=function(_0x5b7948){return new BPromise(function(_0x223c24,_0x50ced7){if(_0x5b7948){return getUser({'interface':_0x5b7948})['then'](function(_0x421ffa){logger[_0x17fd('0x6')](_0x17fd('0x18'),_0x5b7948,_0x421ffa?_0x17fd('0x16'):'notfound');return _0x223c24(_0x421ffa);})[_0x17fd('0xc')](function(_0x56b524){logger['error']('[utils][getUserByInterface]',_0x56b524?util[_0x17fd('0x7')](_0x56b524,{'showHidden':![],'depth':null}):'');return _0x223c24(null);});}return _0x223c24(null);});};exports[_0x17fd('0x19')]=function(_0x4fc4b3){return new BPromise(function(_0x59bb77,_0x384448){if(_0x4fc4b3){return getUser({'name':_0x4fc4b3})[_0x17fd('0xb')](function(_0x4db24e){logger[_0x17fd('0x6')](_0x17fd('0x1a'),_0x4fc4b3,_0x4db24e?'found':_0x17fd('0x1b'));return _0x59bb77(_0x4db24e);})[_0x17fd('0xc')](function(_0x533379){logger[_0x17fd('0x9')](_0x17fd('0x1c'),_0x533379?util['inspect'](_0x533379,{'showHidden':![],'depth':null}):'');return _0x59bb77(null);});}return _0x59bb77(null);});};exports['getVoiceQueueByName']=function(_0x279748){return new BPromise(function(_0x486f5f,_0x1f6a5a){if(_0x279748){return client[_0x17fd('0xa')](_0x17fd('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0x17fd('0x1e'),'acw','acwTimeout'],'where':{'name':_0x279748},'limit':0x1}})[_0x17fd('0xb')](function(_0x476650){logger['debug'](_0x17fd('0x1f'),_0x279748,_0x476650?util[_0x17fd('0x7')](_0x476650,{'showHidden':![],'depth':null}):'');logger[_0x17fd('0x6')](_0x17fd('0x20'),_0x279748,_0x476650?_0x17fd('0x16'):'notfound');return _0x486f5f(_0x476650[_0x17fd('0x13')][_0x17fd('0x12')]?_0x476650[_0x17fd('0x13')][0x0]:null);})[_0x17fd('0xc')](function(_0x5586ae){logger['error']('[utils][getVoiceQueueByName]',_0x5586ae?util[_0x17fd('0x7')](_0x5586ae,{'showHidden':![],'depth':null}):'');return _0x486f5f(null);});}return _0x486f5f(null);});};exports[_0x17fd('0x21')]=function(_0xc0f772,_0x5d58ea){return moment(_0xc0f772)[_0x17fd('0x22')](_0x5d58ea,'seconds')[_0x17fd('0x23')](_0x17fd('0x24'));};exports[_0x17fd('0x25')]=function(_0x191596,_0x56b933){return moment(_0x191596)['subtract'](_0x56b933,_0x17fd('0x26'))[_0x17fd('0x23')](_0x17fd('0x24'));};exports[_0x17fd('0x27')]=function(_0x35f173,_0x55218e){return moment(_0x35f173)[_0x17fd('0x28')](moment(_0x55218e),'seconds');};exports['sumTime']=function(_0x5d5a13,_0x20ab81){return parseInt(_0x5d5a13,0xa)+parseInt(_0x20ab81,0xa);};exports['now']=function(){return moment()[_0x17fd('0x23')](_0x17fd('0x24'));};exports[_0x17fd('0x29')]=function(_0x1b1e24,_0x22cfa6){if(_0x22cfa6){return moment(_0x1b1e24)[_0x17fd('0x29')](_0x22cfa6);}return!![];};exports['isBefore']=function(_0x598424,_0x4e588f){if(_0x4e588f){return moment(_0x598424)['isBefore'](_0x4e588f);}else if(_0x598424){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 ca291ad..ceb9c46 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 _0x7ef8=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','x-forwarded-for','remoteAddress','other','agent_name','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','log','role','ensureDir','then','user','no-user','data','timestamp','client','error','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','connection','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device'];(function(_0x2cb7ff,_0x316573){var _0x5e01c2=function(_0x5f38b0){while(--_0x5f38b0){_0x2cb7ff['push'](_0x2cb7ff['shift']());}};_0x5e01c2(++_0x316573);}(_0x7ef8,0x1bf));var _0x87ef=function(_0x27ff0a,_0x469915){_0x27ff0a=_0x27ff0a-0x0;var _0x590123=_0x7ef8[_0x27ff0a];return _0x590123;};var fs=require(_0x87ef('0x0'));var _=require(_0x87ef('0x1'));var ewinston=require(_0x87ef('0x2'));var path=require('path');var util=require(_0x87ef('0x3'));var fileLogger=require(_0x87ef('0x4'))[_0x87ef('0x5')];var safeTemplate=require(_0x87ef('0x6'))[_0x87ef('0x7')];var maskSensitiveData=require(_0x87ef('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0xf2b2ad(_0x2b63c1){var _0x40583f=path[_0x87ef('0x9')]('/var',_0x87ef('0xa'),'xcally');var _0xdf7d1e=path[_0x87ef('0x9')]('client',_0x2b63c1[_0x87ef('0xb')]+'-'+_0x2b63c1['name']);return fs[_0x87ef('0xc')](path['join'](_0x40583f,_0xdf7d1e))[_0x87ef('0xd')](function(){var _0x101d20=fileLogger('client',path[_0x87ef('0x9')](_0x40583f,_0xdf7d1e));return _0x101d20;})['catch'](function(_0x13dea6){throw _0x13dea6;});}this[_0x87ef('0xa')]=function(_0x16c314,_0x4fb2de,_0x5a3b50,_0x1fb056){return _0xf2b2ad(_0x16c314[_0x87ef('0xe')])[_0x87ef('0xd')](function(_0x36d232){var _0x1d9956=_0x36d232[_0x4fb2de];return _0x1d9956;})[_0x87ef('0xd')](function(_0x353975){var _0x1cbe4a=_0x16c314[_0x87ef('0xe')]?_0x16c314[_0x87ef('0xe')]['id']:_0x87ef('0xf');var _0x29d159=_0x1fb056[_0x87ef('0x10')];var _0x431fcd=_0x1fb056[_0x87ef('0x11')];var _0x7c7769=new Date(Number(_0x431fcd));return _0x353975(_0x1cbe4a,_0x7c7769,_0x5a3b50,_0x29d159);})['catch'](function(_0x43a5e6){fileLogger(_0x87ef('0x12'))[_0x87ef('0x13')](_0x43a5e6);});};}function setupLoggers(_0x189fb5){return new Promise(function(_0x1937fc){var _0x542119=new ClientSideLogger();var _0x235357=fileLogger('api');var _0x14d9fb=fileLogger('auth');_0x189fb5[_0x87ef('0x14')](_0x87ef('0x15'),_0x542119);_0x189fb5['use'](ewinston[_0x87ef('0x16')]({'winstonInstance':_0x235357,'meta':![],'statusLevels':!![],'msg':function(_0x3ab86d,_0x51b8c4){var _0x110116=_0x87ef('0x17');if(!_[_0x87ef('0x18')](_0x3ab86d[_0x87ef('0x19')])){_0x110116+=_0x87ef('0x1a');var _0x3ce66d=_0x3ab86d[_0x87ef('0x19')];maskSensitiveData(_0x3ce66d);}return safeTemplate(util['format'](_0x110116,_0x3ab86d[_0x87ef('0x1b')],_0x3ab86d[_0x87ef('0x1c')]['x-forwarded-for']?_0x3ab86d[_0x87ef('0x1c')]['x-forwarded-for']:_0x3ab86d[_0x87ef('0x1d')]['remoteAddress']||_0x3ab86d['ip'],_0x3ab86d[_0x87ef('0x1e')],_0x51b8c4[_0x87ef('0x1f')],_0x51b8c4[_0x87ef('0x20')],_0x3ab86d[_0x87ef('0xe')]?_0x3ab86d[_0x87ef('0xe')]['id']:null,_0x3ab86d['user']?_0x3ab86d[_0x87ef('0xe')]['name']:null,_0x3ab86d[_0x87ef('0xe')]?_0x3ab86d[_0x87ef('0xe')][_0x87ef('0xb')]:null,_0x3ce66d?util[_0x87ef('0x21')](_0x3ce66d,![],null):''));}}));_0x189fb5[_0x87ef('0x22')](ewinston['logger']({'winstonInstance':_0x14d9fb,'meta':![],'statusLevels':!![],'msg':function(_0x3ba677,_0x9dcac){var _0x5c0c03=_0x87ef('0x23');if(_0x3ba677['body']&&_0x3ba677[_0x87ef('0x19')][_0x87ef('0x24')]&&_0x3ba677[_0x87ef('0x19')][_0x87ef('0x25')]){_0x5c0c03=_0x87ef('0x26');}return util[_0x87ef('0x27')](_0x5c0c03,_0x3ba677[_0x87ef('0x1b')],_0x3ba677[_0x87ef('0x1c')][_0x87ef('0x28')]?_0x3ba677['headers'][_0x87ef('0x28')]:_0x3ba677[_0x87ef('0x1d')][_0x87ef('0x29')]||_0x3ba677['ip'],_0x3ba677[_0x87ef('0x1e')],_0x9dcac['statusCode'],_0x9dcac[_0x87ef('0x20')],_0x3ba677[_0x87ef('0xe')]?_0x3ba677['user']['id']:null,_0x3ba677[_0x87ef('0xe')]?_0x3ba677[_0x87ef('0xe')]['name']:null,_0x3ba677['user']?_0x3ba677[_0x87ef('0xe')][_0x87ef('0xb')]:null,_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['device']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x24')]:_0x87ef('0x2a'),_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['agent_id']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x25')]:'',_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['agent_name']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x2b')]:'');},'ignoreRoute':function(_0x444c48){var _0x51a387=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51a387['test'](_0x444c48['url']);}}));return _0x1937fc();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x1a81=['method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','use','device','agent_id','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','timestamp','api','set','client-side-logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format'];(function(_0x2d5c70,_0x36487a){var _0x17ee2c=function(_0x861185){while(--_0x861185){_0x2d5c70['push'](_0x2d5c70['shift']());}};_0x17ee2c(++_0x36487a);}(_0x1a81,0x1e8));var _0x11a8=function(_0x49667b,_0x423b08){_0x49667b=_0x49667b-0x0;var _0x32d154=_0x1a81[_0x49667b];return _0x32d154;};var fs=require(_0x11a8('0x0'));var _=require(_0x11a8('0x1'));var ewinston=require('express-winston');var path=require(_0x11a8('0x2'));var util=require(_0x11a8('0x3'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x11a8('0x4'))[_0x11a8('0x5')];var maskSensitiveData=require(_0x11a8('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x3fa57c(_0x4e3fe6){var _0x44624f=path[_0x11a8('0x7')](_0x11a8('0x8'),_0x11a8('0x9'),_0x11a8('0xa'));var _0x40735c=path[_0x11a8('0x7')](_0x11a8('0xb'),_0x4e3fe6[_0x11a8('0xc')]+'-'+_0x4e3fe6[_0x11a8('0xd')]);return fs[_0x11a8('0xe')](path[_0x11a8('0x7')](_0x44624f,_0x40735c))[_0x11a8('0xf')](function(){var _0x53c3e5=fileLogger(_0x11a8('0xb'),path[_0x11a8('0x7')](_0x44624f,_0x40735c));return _0x53c3e5;})[_0x11a8('0x10')](function(_0x3a3c9c){throw _0x3a3c9c;});}this[_0x11a8('0x9')]=function(_0x387004,_0xf91215,_0x831acd,_0x5b00c9){return _0x3fa57c(_0x387004[_0x11a8('0x11')])[_0x11a8('0xf')](function(_0x119527){var _0x335bb7=_0x119527[_0xf91215];return _0x335bb7;})[_0x11a8('0xf')](function(_0x53d69a){var _0x4edeb4=_0x387004[_0x11a8('0x11')]?_0x387004[_0x11a8('0x11')]['id']:_0x11a8('0x12');var _0x1f2a81=_0x5b00c9['data'];var _0x418dfa=_0x5b00c9[_0x11a8('0x13')];var _0x3587ef=new Date(Number(_0x418dfa));return _0x53d69a(_0x4edeb4,_0x3587ef,_0x831acd,_0x1f2a81);})['catch'](function(_0x2a4ab4){fileLogger(_0x11a8('0xb'))['error'](_0x2a4ab4);});};}function setupLoggers(_0x511a04){return new Promise(function(_0x29123f){var _0x5c4ddf=new ClientSideLogger();var _0x17c3e5=fileLogger(_0x11a8('0x14'));var _0x9164b2=fileLogger('auth');_0x511a04[_0x11a8('0x15')](_0x11a8('0x16'),_0x5c4ddf);_0x511a04['use'](ewinston['logger']({'winstonInstance':_0x17c3e5,'meta':![],'statusLevels':!![],'msg':function(_0x484b94,_0x26ec94){var _0x5d209c=_0x11a8('0x17');if(!_[_0x11a8('0x18')](_0x484b94[_0x11a8('0x19')])){_0x5d209c+=_0x11a8('0x1a');var _0x5063ee=_0x484b94[_0x11a8('0x19')];maskSensitiveData(_0x5063ee);}return safeTemplate(util[_0x11a8('0x1b')](_0x5d209c,_0x484b94[_0x11a8('0x1c')],_0x484b94[_0x11a8('0x1d')][_0x11a8('0x1e')]?_0x484b94[_0x11a8('0x1d')]['x-forwarded-for']:_0x484b94[_0x11a8('0x1f')][_0x11a8('0x20')]||_0x484b94['ip'],_0x484b94[_0x11a8('0x21')],_0x26ec94[_0x11a8('0x22')],_0x26ec94['responseTime'],_0x484b94[_0x11a8('0x11')]?_0x484b94[_0x11a8('0x11')]['id']:null,_0x484b94['user']?_0x484b94[_0x11a8('0x11')]['name']:null,_0x484b94['user']?_0x484b94['user'][_0x11a8('0xc')]:null,_0x5063ee?util['inspect'](_0x5063ee,![],null):''));}}));_0x511a04[_0x11a8('0x23')](ewinston['logger']({'winstonInstance':_0x9164b2,'meta':![],'statusLevels':!![],'msg':function(_0x55aa83,_0x524a5b){var _0x294d58='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x55aa83[_0x11a8('0x19')]&&_0x55aa83[_0x11a8('0x19')][_0x11a8('0x24')]&&_0x55aa83[_0x11a8('0x19')][_0x11a8('0x25')]){_0x294d58='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x294d58,_0x55aa83['method'],_0x55aa83[_0x11a8('0x1d')][_0x11a8('0x1e')]?_0x55aa83[_0x11a8('0x1d')][_0x11a8('0x1e')]:_0x55aa83[_0x11a8('0x1f')][_0x11a8('0x20')]||_0x55aa83['ip'],_0x55aa83[_0x11a8('0x21')],_0x524a5b['statusCode'],_0x524a5b[_0x11a8('0x26')],_0x55aa83['user']?_0x55aa83[_0x11a8('0x11')]['id']:null,_0x55aa83[_0x11a8('0x11')]?_0x55aa83[_0x11a8('0x11')][_0x11a8('0xd')]:null,_0x55aa83['user']?_0x55aa83[_0x11a8('0x11')]['role']:null,_0x55aa83[_0x11a8('0x19')]&&_0x55aa83[_0x11a8('0x19')][_0x11a8('0x24')]?_0x55aa83[_0x11a8('0x19')][_0x11a8('0x24')]:_0x11a8('0x27'),_0x55aa83[_0x11a8('0x19')]&&_0x55aa83['body'][_0x11a8('0x25')]?_0x55aa83['body']['agent_id']:'',_0x55aa83[_0x11a8('0x19')]&&_0x55aa83[_0x11a8('0x19')][_0x11a8('0x28')]?_0x55aa83[_0x11a8('0x19')][_0x11a8('0x28')]:'');},'ignoreRoute':function(_0x5381b8){var _0x51f907=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51f907[_0x11a8('0x29')](_0x5381b8[_0x11a8('0x21')]);}}));return _0x29123f();});}exports[_0x11a8('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index efe02f1..045d130 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2036=['minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes','guess','split','padStart','length','iftime','lodash','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours'];(function(_0xe1e424,_0x5ad7a2){var _0xc40fbc=function(_0x53bed0){while(--_0x53bed0){_0xe1e424['push'](_0xe1e424['shift']());}};_0xc40fbc(++_0x5ad7a2);}(_0x2036,0x64));var _0x6203=function(_0x3688e8,_0x5e1826){_0x3688e8=_0x3688e8-0x0;var _0x33c03d=_0x2036[_0x3688e8];return _0x33c03d;};var _=require(_0x6203('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x1b0a4a){return _0x1b0a4a['source'];})[_0x6203('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6203('0x2');var EINVALID_DATE=_0x6203('0x3');function throwIfDateNotValid(_0x52ab66){if(!_0x52ab66['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x305b45){var _0x22f42c=_0x305b45['split'](':')[_0x6203('0x4')](function(_0x265fe1){return parseInt(_0x265fe1,0xa);});var _0x3edcd0=_0x22f42c[0x0];var _0x55ce16=_0x22f42c[0x1];if(_0x3edcd0<0x0||_0x3edcd0>0x17||_0x55ce16<0x0||_0x55ce16>0x3b){throw new Error(EINVALID_DATE);}return[_0x3edcd0,_0x55ce16];}function circularDoWInterval(_0x4d31a4,_0x29464b){if(_0x4d31a4===_0x29464b){return[_0x4d31a4];}else{var _0x2d7625=moment[_0x6203('0x5')]();moment[_0x6203('0x5')]('en');var _0x11382c=moment[_0x6203('0x6')]()[_0x6203('0x4')](function(_0x1821d5){return _0x1821d5[_0x6203('0x7')]();});moment[_0x6203('0x5')](_0x2d7625);var _0x7c5153=_0x11382c['indexOf'](_0x4d31a4);var _0x102e8c=_0x11382c[_0x6203('0x8')](_0x29464b);if(_0x102e8c>_0x7c5153){return _0x11382c[_0x6203('0x9')](_0x7c5153,_0x102e8c+0x1);}else{var _0x2e2b64=_0x11382c[_0x6203('0x9')](0x0,_0x102e8c+0x1);var _0x3f2ecf=_0x11382c['slice'](_0x7c5153);return _0x3f2ecf[_0x6203('0xa')](_0x2e2b64);}}}module[_0x6203('0xb')][_0x6203('0xc')]=circularDoWInterval;function circularMonthInterval(_0x502c20,_0x5b097b){if(_0x502c20===_0x5b097b){return[_0x502c20];}else{var _0x519ee6=moment[_0x6203('0x5')]();moment[_0x6203('0x5')]('en');var _0x439c84=moment[_0x6203('0xd')]()['map'](function(_0x55d41f){return _0x55d41f[_0x6203('0x7')]();});moment[_0x6203('0x5')](_0x519ee6);var _0x13cae9=_0x439c84[_0x6203('0x8')](_0x502c20);var _0x1ca86e=_0x439c84['indexOf'](_0x5b097b);if(_0x1ca86e>_0x13cae9){return _0x439c84[_0x6203('0x9')](_0x13cae9,_0x1ca86e+0x1);}else{var _0x1850b3=_0x439c84[_0x6203('0x9')](0x0,_0x1ca86e+0x1);var _0xdd9565=_0x439c84[_0x6203('0x9')](_0x13cae9);return _0xdd9565[_0x6203('0xa')](_0x1850b3);}}}module[_0x6203('0xb')][_0x6203('0xe')]=circularMonthInterval;function parseDom(_0xeee5a4){var _0x570cc1=parseInt(_0xeee5a4,0xa);if(_0x570cc1<0x1||_0x570cc1>0x1f){throw new Error(EINVALID_DATE);}return _0x570cc1;}function timeCompare(_0x1637f8,_0x5ad32c,_0x10aa40){var _0x1d4a9f=_0x1637f8[_0x6203('0xf')]();var _0x99e80e=extractTime(_0x5ad32c);var _0x217848=_0x99e80e[0x0];var _0x312d6b=_0x99e80e[0x1];var _0x4bcf5f=_0x1637f8[_0x6203('0xf')]()[_0x6203('0x10')](_0x217848)[_0x6203('0x11')](_0x312d6b);throwIfDateNotValid(_0x4bcf5f);var _0x5493ae=extractTime(_0x10aa40);var _0x359bc0=_0x5493ae[0x0];var _0x43c4a6=_0x5493ae[0x1];var _0x551994=_0x1637f8[_0x6203('0xf')]()[_0x6203('0x10')](_0x359bc0)[_0x6203('0x11')](_0x43c4a6);throwIfDateNotValid(_0x551994);if(_0x551994[_0x6203('0x12')](_0x4bcf5f)){var _0x407963=_0x1d4a9f[_0x6203('0xf')]()[_0x6203('0x13')](_0x6203('0x14'));var _0x5f2994=_0x1d4a9f[_0x6203('0xf')]()[_0x6203('0x15')](_0x6203('0x14'));return _0x1d4a9f[_0x6203('0x16')](_0x4bcf5f,_0x5f2994,undefined,'[]')||_0x1d4a9f['isBetween'](_0x407963,_0x551994,undefined,'[]');}else{return _0x1d4a9f['isBetween'](_0x4bcf5f,_0x551994,undefined,'[]');}}module[_0x6203('0xb')][_0x6203('0x17')]=timeCompare;function dowCompare(_0x2e165f,_0x4ee5ee,_0x125280){var _0x9ca640=_0x2e165f[_0x6203('0x5')]('en')[_0x6203('0x18')](_0x6203('0x19'))[_0x6203('0x7')]();return circularDoWInterval(_0x4ee5ee,_0x125280)['includes'](_0x9ca640);}module['exports'][_0x6203('0x1a')]=dowCompare;function domCompare(_0xe955ab,_0x3aa96b,_0x111abf){var _0x3671f9=_0xe955ab[_0x6203('0x1b')]();if(_0x3aa96b===_0x111abf){return _0x3671f9===_0x3aa96b;}else{var _0xa534a1=_0xe955ab[_0x6203('0x1c')]();var _0x2ab45b=_0x3aa96b<_0x111abf;let _0x66c666=![];var _0x4bff3f=0x0;var _0x4eaaef=0x0;if(_0x2ab45b){_0x4bff3f=Math[_0x6203('0x1d')](0x1,_0x3aa96b);_0x4eaaef=Math[_0x6203('0x1e')](_0x111abf,_0xa534a1);_0x66c666=_0x3671f9>=_0x4bff3f&&_0x3671f9<=_0x4eaaef;}else{_0x4bff3f=Math[_0x6203('0x1e')](_0x3aa96b,_0xa534a1);_0x4eaaef=Math[_0x6203('0x1d')](0x1,_0x111abf);_0x66c666=_0x3671f9>=_0x4bff3f||_0x3671f9<=_0x4eaaef;}return _0x66c666;}}module[_0x6203('0xb')][_0x6203('0x1f')]=domCompare;function monthCompare(_0x3cef09,_0x156eba,_0x4cfc1b){var _0x18222e=_0x3cef09[_0x6203('0x5')]('en')[_0x6203('0x18')](_0x6203('0x20'))[_0x6203('0x7')]();return circularMonthInterval(_0x156eba,_0x4cfc1b)[_0x6203('0x21')](_0x18222e);}module[_0x6203('0xb')]['monthCompare']=monthCompare;function iftime(_0x227396,_0x5b2650=moment['tz'][_0x6203('0x22')](),_0x1c8ffb=moment()){if(!validateRx['test'](_0x227396)){throw new Error(EINVALID_STRING);}else{var _0x4983af=(moment['isMoment'](_0x1c8ffb)?_0x1c8ffb[_0x6203('0xf')]():moment(_0x1c8ffb))['tz'](_0x5b2650)[_0x6203('0x5')]('en');throwIfDateNotValid(_0x4983af);var _0x27a4d6=_0x227396[_0x6203('0x23')](',');var _0x22144f=_0x27a4d6[0x0];var _0x5d0adc=_0x27a4d6[0x1];var _0x1a1548=_0x27a4d6[0x2];var _0x3f8ea2=_0x27a4d6[0x3];let _0x1d8778=!![];if(_0x22144f!=='*'){var _0xd24760=_0x22144f[_0x6203('0x23')]('-');var _0x57da7e=_[_0x6203('0x24')](_0xd24760[0x0],0x5,'0');var _0x55c0b0=_0xd24760['length']===0x2?_[_0x6203('0x24')](_0xd24760[0x1],0x5,'0'):_0x57da7e;_0x1d8778=timeCompare(_0x4983af,_0x57da7e,_0x55c0b0);}let _0x137e41=!![];if(_0x5d0adc!=='*'){var _0x465f62=_0x5d0adc[_0x6203('0x23')]('-');var _0x12bacb=_0x465f62[0x0];var _0x5750a4=_0x465f62[_0x6203('0x25')]===0x2?_0x465f62[0x1]:_0x12bacb;_0x137e41=dowCompare(_0x4983af,_0x12bacb,_0x5750a4);}let _0x256752=!![];if(_0x1a1548!=='*'){var _0xc0b456=_0x1a1548[_0x6203('0x23')]('-');var _0x148423=parseDom(_0xc0b456[0x0]);var _0x4e0571=_0xc0b456[_0x6203('0x25')]===0x2?parseDom(_0xc0b456[0x1]):_0x148423;_0x256752=domCompare(_0x4983af,_0x148423,_0x4e0571);}let _0xdd143=!![];if(_0x3f8ea2!=='*'){var _0x14d25f=_0x3f8ea2[_0x6203('0x23')]('-');var _0x59e7b9=_0x14d25f[0x0];var _0x1c05f0=_0x14d25f[_0x6203('0x25')]===0x2?_0x14d25f[0x1]:_0x14d25f[0x0];_0xdd143=monthCompare(_0x4983af,_0x59e7b9,_0x1c05f0);}return _0x1d8778&&_0x137e41&&_0x256752&&_0xdd143;}}module[_0x6203('0xb')][_0x6203('0x26')]=iftime; \ No newline at end of file +var _0xc241=['join','Date\x20not\x20valid','isValid','weekdaysShort','locale','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','format','MMM','toLowerCase','monthCompare','split','padStart','length','moment-timezone','map','source'];(function(_0x26e081,_0x5677ed){var _0x4e91f4=function(_0x38126b){while(--_0x38126b){_0x26e081['push'](_0x26e081['shift']());}};_0x4e91f4(++_0x5677ed);}(_0xc241,0x1c5));var _0x1c24=function(_0x33523b,_0xaf579f){_0x33523b=_0x33523b-0x0;var _0x36f573=_0xc241[_0x33523b];return _0x36f573;};var _=require('lodash');var moment=require(_0x1c24('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1c24('0x1')](function(_0x3b2690){return _0x3b2690[_0x1c24('0x2')];})[_0x1c24('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x1c24('0x4');function throwIfDateNotValid(_0x12d1d7){if(!_0x12d1d7[_0x1c24('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4f6a67){var _0x4a0b9b=_0x4f6a67['split'](':')[_0x1c24('0x1')](function(_0x40f09d){return parseInt(_0x40f09d,0xa);});var _0x867eba=_0x4a0b9b[0x0];var _0x2f3ce7=_0x4a0b9b[0x1];if(_0x867eba<0x0||_0x867eba>0x17||_0x2f3ce7<0x0||_0x2f3ce7>0x3b){throw new Error(EINVALID_DATE);}return[_0x867eba,_0x2f3ce7];}function circularDoWInterval(_0x47d4ca,_0x2221f8){if(_0x47d4ca===_0x2221f8){return[_0x47d4ca];}else{var _0x43e267=moment['locale']();moment['locale']('en');var _0x1706a1=moment[_0x1c24('0x6')]()[_0x1c24('0x1')](function(_0x2f91fd){return _0x2f91fd['toLowerCase']();});moment[_0x1c24('0x7')](_0x43e267);var _0x5670bd=_0x1706a1[_0x1c24('0x8')](_0x47d4ca);var _0x167d8b=_0x1706a1['indexOf'](_0x2221f8);if(_0x167d8b>_0x5670bd){return _0x1706a1[_0x1c24('0x9')](_0x5670bd,_0x167d8b+0x1);}else{var _0x5b1507=_0x1706a1['slice'](0x0,_0x167d8b+0x1);var _0x6f47ee=_0x1706a1[_0x1c24('0x9')](_0x5670bd);return _0x6f47ee[_0x1c24('0xa')](_0x5b1507);}}}module[_0x1c24('0xb')][_0x1c24('0xc')]=circularDoWInterval;function circularMonthInterval(_0x5baef9,_0x2031bf){if(_0x5baef9===_0x2031bf){return[_0x5baef9];}else{var _0x2a3299=moment[_0x1c24('0x7')]();moment[_0x1c24('0x7')]('en');var _0x5ca6d9=moment[_0x1c24('0xd')]()['map'](function(_0x3b0139){return _0x3b0139['toLowerCase']();});moment[_0x1c24('0x7')](_0x2a3299);var _0x190d3d=_0x5ca6d9[_0x1c24('0x8')](_0x5baef9);var _0x19159e=_0x5ca6d9['indexOf'](_0x2031bf);if(_0x19159e>_0x190d3d){return _0x5ca6d9[_0x1c24('0x9')](_0x190d3d,_0x19159e+0x1);}else{var _0x5587d7=_0x5ca6d9[_0x1c24('0x9')](0x0,_0x19159e+0x1);var _0x46a6ee=_0x5ca6d9['slice'](_0x190d3d);return _0x46a6ee['concat'](_0x5587d7);}}}module[_0x1c24('0xb')][_0x1c24('0xe')]=circularMonthInterval;function parseDom(_0x4970f3){var _0x231192=parseInt(_0x4970f3,0xa);if(_0x231192<0x1||_0x231192>0x1f){throw new Error(EINVALID_DATE);}return _0x231192;}function timeCompare(_0x325df4,_0x8d0266,_0x5567d7){var _0x3ad7b5=_0x325df4[_0x1c24('0xf')]();var _0x5b346a=extractTime(_0x8d0266);var _0x3a4181=_0x5b346a[0x0];var _0x5aa2c7=_0x5b346a[0x1];var _0x12c6cc=_0x325df4[_0x1c24('0xf')]()[_0x1c24('0x10')](_0x3a4181)[_0x1c24('0x11')](_0x5aa2c7);throwIfDateNotValid(_0x12c6cc);var _0x16fe76=extractTime(_0x5567d7);var _0x57f974=_0x16fe76[0x0];var _0xceaa80=_0x16fe76[0x1];var _0x21f624=_0x325df4[_0x1c24('0xf')]()[_0x1c24('0x10')](_0x57f974)[_0x1c24('0x11')](_0xceaa80);throwIfDateNotValid(_0x21f624);if(_0x21f624[_0x1c24('0x12')](_0x12c6cc)){var _0x49e66f=_0x3ad7b5[_0x1c24('0xf')]()['startOf'](_0x1c24('0x13'));var _0x4b0a96=_0x3ad7b5[_0x1c24('0xf')]()[_0x1c24('0x14')](_0x1c24('0x13'));return _0x3ad7b5[_0x1c24('0x15')](_0x12c6cc,_0x4b0a96,undefined,'[]')||_0x3ad7b5[_0x1c24('0x15')](_0x49e66f,_0x21f624,undefined,'[]');}else{return _0x3ad7b5[_0x1c24('0x15')](_0x12c6cc,_0x21f624,undefined,'[]');}}module['exports'][_0x1c24('0x16')]=timeCompare;function dowCompare(_0x27f4c9,_0x5ea422,_0x409f51){var _0x343954=_0x27f4c9['locale']('en')['format'](_0x1c24('0x17'))['toLowerCase']();return circularDoWInterval(_0x5ea422,_0x409f51)[_0x1c24('0x18')](_0x343954);}module['exports'][_0x1c24('0x19')]=dowCompare;function domCompare(_0x167147,_0x38581b,_0x41a2a5){var _0x342576=_0x167147[_0x1c24('0x1a')]();if(_0x38581b===_0x41a2a5){return _0x342576===_0x38581b;}else{var _0x467004=_0x167147[_0x1c24('0x1b')]();var _0x2bba43=_0x38581b<_0x41a2a5;let _0x54f107=![];var _0x10604e=0x0;var _0x4fc2a7=0x0;if(_0x2bba43){_0x10604e=Math[_0x1c24('0x1c')](0x1,_0x38581b);_0x4fc2a7=Math[_0x1c24('0x1d')](_0x41a2a5,_0x467004);_0x54f107=_0x342576>=_0x10604e&&_0x342576<=_0x4fc2a7;}else{_0x10604e=Math[_0x1c24('0x1d')](_0x38581b,_0x467004);_0x4fc2a7=Math['max'](0x1,_0x41a2a5);_0x54f107=_0x342576>=_0x10604e||_0x342576<=_0x4fc2a7;}return _0x54f107;}}module[_0x1c24('0xb')][_0x1c24('0x1e')]=domCompare;function monthCompare(_0x78d63d,_0x2a1a14,_0x14ea30){var _0xc9770=_0x78d63d[_0x1c24('0x7')]('en')[_0x1c24('0x1f')](_0x1c24('0x20'))[_0x1c24('0x21')]();return circularMonthInterval(_0x2a1a14,_0x14ea30)[_0x1c24('0x18')](_0xc9770);}module[_0x1c24('0xb')][_0x1c24('0x22')]=monthCompare;function iftime(_0x555c28,_0x36d1a6=moment['tz']['guess'](),_0x144334=moment()){if(!validateRx['test'](_0x555c28)){throw new Error(EINVALID_STRING);}else{var _0x4ab896=(moment['isMoment'](_0x144334)?_0x144334[_0x1c24('0xf')]():moment(_0x144334))['tz'](_0x36d1a6)[_0x1c24('0x7')]('en');throwIfDateNotValid(_0x4ab896);var _0x266737=_0x555c28['split'](',');var _0x1654a3=_0x266737[0x0];var _0x4e0cfb=_0x266737[0x1];var _0xdf7900=_0x266737[0x2];var _0x2eb5ba=_0x266737[0x3];let _0x1c6e28=!![];if(_0x1654a3!=='*'){var _0x4a50fa=_0x1654a3[_0x1c24('0x23')]('-');var _0xc2dcf4=_[_0x1c24('0x24')](_0x4a50fa[0x0],0x5,'0');var _0x4ab286=_0x4a50fa['length']===0x2?_['padStart'](_0x4a50fa[0x1],0x5,'0'):_0xc2dcf4;_0x1c6e28=timeCompare(_0x4ab896,_0xc2dcf4,_0x4ab286);}let _0x371630=!![];if(_0x4e0cfb!=='*'){var _0x6fa6bd=_0x4e0cfb[_0x1c24('0x23')]('-');var _0x8ae48d=_0x6fa6bd[0x0];var _0x21c2b9=_0x6fa6bd[_0x1c24('0x25')]===0x2?_0x6fa6bd[0x1]:_0x8ae48d;_0x371630=dowCompare(_0x4ab896,_0x8ae48d,_0x21c2b9);}let _0x14510b=!![];if(_0xdf7900!=='*'){var _0x414191=_0xdf7900[_0x1c24('0x23')]('-');var _0x253257=parseDom(_0x414191[0x0]);var _0x183ddf=_0x414191[_0x1c24('0x25')]===0x2?parseDom(_0x414191[0x1]):_0x253257;_0x14510b=domCompare(_0x4ab896,_0x253257,_0x183ddf);}let _0x2b1584=!![];if(_0x2eb5ba!=='*'){var _0x52b742=_0x2eb5ba[_0x1c24('0x23')]('-');var _0x5d8c9a=_0x52b742[0x0];var _0x5ab2c2=_0x52b742[_0x1c24('0x25')]===0x2?_0x52b742[0x1]:_0x52b742[0x0];_0x2b1584=monthCompare(_0x4ab896,_0x5d8c9a,_0x5ab2c2);}return _0x1c6e28&&_0x371630&&_0x14510b&&_0x2b1584;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1e9f465..e532347 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f2=['stringify','Logger','transports','Console','File','error','%s-%s','warn','consoleLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20cyan','/var/log/xcally','format','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','keys','meta','length'];(function(_0x1b270a,_0x5ede7f){var _0x5bf3b2=function(_0x384f32){while(--_0x384f32){_0x1b270a['push'](_0x1b270a['shift']());}};_0x5bf3b2(++_0x5ede7f);}(_0x31f2,0xe1));var _0x231f=function(_0x27612c,_0x4707b4){_0x27612c=_0x27612c-0x0;var _0x53b6e5=_0x31f2[_0x27612c];return _0x53b6e5;};'use strict';var path=require(_0x231f('0x0'));var util=require(_0x231f('0x1'));var moment=require(_0x231f('0x2'));var winston=require(_0x231f('0x3'));var config=require('../config/environment');var debugLevel=config[_0x231f('0x4')]?config[_0x231f('0x4')][_0x231f('0x5')]():_0x231f('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x231f('0x7'),'error':_0x231f('0x8'),'warn':_0x231f('0x9'),'info':_0x231f('0xa'),'print':_0x231f('0xb'),'success':_0x231f('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x231f('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x22f239,_0xcb1be,_0x4846c3){var _0x388fb0=_0x22f239||_0x231f('0xe');return path['join'](_0x388fb0,util[_0x231f('0xf')]('%s-%s.log',_0xcb1be,_0x4846c3));}function formatter(_0x1a7412,_0x329152){_0x329152['message']=_0x329152['message'][_0x231f('0x10')](/@@{/g,_0x231f('0x11'))[_0x231f('0x10')](/}@@/g,_0x231f('0x12'))['replace'](/@{/g,'{{')[_0x231f('0x10')](/}@/g,'}}');return util[_0x231f('0xf')](_0x231f('0x13'),moment()[_0x231f('0xf')](_0x231f('0x14')),_0x329152[_0x231f('0x15')][_0x231f('0x16')](),_0x1a7412,_0x329152[_0x231f('0x17')]);}function fileFormat(_0x4eee42,_0x5cbb0b){_0x5cbb0b[_0x231f('0x17')]=_0x5cbb0b[_0x231f('0x17')][_0x231f('0x10')](/@@{/g,_0x231f('0x11'))['replace'](/}@@/g,_0x231f('0x12'))[_0x231f('0x10')](/@{/g,'{{')[_0x231f('0x10')](/}@/g,'}}');var _0x4f485f=_0x5cbb0b['meta']&&Object[_0x231f('0x18')](_0x5cbb0b[_0x231f('0x19')])[_0x231f('0x1a')]?'\x0a\x09'+JSON[_0x231f('0x1b')](_0x5cbb0b[_0x231f('0x19')]):'';return util[_0x231f('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x231f('0xf')](_0x231f('0x14')),_0x5cbb0b[_0x231f('0x15')][_0x231f('0x16')](),_0x4eee42,_0x5cbb0b[_0x231f('0x17')],_0x4f485f);}function consoleLogger(){var _0x1b1e4c=new winston[(_0x231f('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x231f('0x1d'))][(_0x231f('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x340bab){return formatter('',_0x340bab);}})]});return _0x1b1e4c;}function fileLogger(_0x2ee925,_0x2825e2){var _0x21e6dc=new winston[(_0x231f('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x231f('0x1f'))]({'name':util[_0x231f('0xf')]('%s-%s',_0x2ee925,'error'),'filename':getLogFileName(_0x2825e2,_0x2ee925,_0x231f('0x20')),'level':_0x231f('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c3e25){return fileFormat(_0x2ee925,_0x2c3e25);}}),new winston[(_0x231f('0x1d'))]['File']({'name':util[_0x231f('0xf')](_0x231f('0x21'),_0x2ee925,debugLevel),'filename':getLogFileName(_0x2825e2,_0x2ee925,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7ea040){return fileFormat(_0x2ee925,_0x7ea040);}}),new winston['transports'][(_0x231f('0x1e'))]({'level':_0x231f('0x22'),'json':![],'formatter':function(_0x574d01){return fileFormat(_0x2ee925,_0x574d01);}})]});return _0x21e6dc;}exports[_0x231f('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xd9a1=['util','winston','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','Console','Logger','File','%s-%s','error','warn','fileLogger','path'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xd9a1,0x65));var _0x1d9a=function(_0x92bc95,_0x2dbcc0){_0x92bc95=_0x92bc95-0x0;var _0x1d671e=_0xd9a1[_0x92bc95];return _0x1d671e;};'use strict';var path=require(_0x1d9a('0x0'));var util=require(_0x1d9a('0x1'));var moment=require('moment');var winston=require(_0x1d9a('0x2'));var config=require('../config/environment');var debugLevel=config[_0x1d9a('0x3')]?config[_0x1d9a('0x3')]['toLowerCase']():_0x1d9a('0x4');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':_0x1d9a('0x5'),'error':_0x1d9a('0x6'),'warn':_0x1d9a('0x7'),'info':_0x1d9a('0x8'),'print':_0x1d9a('0x9'),'success':_0x1d9a('0xa'),'http':'gray','verbose':_0x1d9a('0xb'),'debug':'bold\x20blue','silly':_0x1d9a('0xc')};winston[_0x1d9a('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1d5018,_0x5ab798,_0x1fe184){var _0x30fdcf=_0x1d5018||_0x1d9a('0xe');return path[_0x1d9a('0xf')](_0x30fdcf,util[_0x1d9a('0x10')]('%s-%s.log',_0x5ab798,_0x1fe184));}function formatter(_0x393dd3,_0x23140f){_0x23140f['message']=_0x23140f[_0x1d9a('0x11')][_0x1d9a('0x12')](/@@{/g,_0x1d9a('0x13'))[_0x1d9a('0x12')](/}@@/g,_0x1d9a('0x14'))[_0x1d9a('0x12')](/@{/g,'{{')[_0x1d9a('0x12')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x1d9a('0x10')](_0x1d9a('0x15')),_0x23140f[_0x1d9a('0x16')][_0x1d9a('0x17')](),_0x393dd3,_0x23140f['message']);}function fileFormat(_0x1ee5e2,_0x15ef1e){_0x15ef1e[_0x1d9a('0x11')]=_0x15ef1e['message'][_0x1d9a('0x12')](/@@{/g,_0x1d9a('0x13'))[_0x1d9a('0x12')](/}@@/g,_0x1d9a('0x14'))[_0x1d9a('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1ce833=_0x15ef1e[_0x1d9a('0x18')]&&Object[_0x1d9a('0x19')](_0x15ef1e[_0x1d9a('0x18')])[_0x1d9a('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x15ef1e[_0x1d9a('0x18')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x1d9a('0x15')),_0x15ef1e['level'][_0x1d9a('0x17')](),_0x1ee5e2,_0x15ef1e[_0x1d9a('0x11')],_0x1ce833);}function consoleLogger(){var _0x58bd96=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1d9a('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x597cbb){return formatter('',_0x597cbb);}})]});return _0x58bd96;}function fileLogger(_0x35f60c,_0x5c0c4a){var _0x12c1ef=new winston[(_0x1d9a('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1d9a('0x1d'))]({'name':util['format'](_0x1d9a('0x1e'),_0x35f60c,_0x1d9a('0x1f')),'filename':getLogFileName(_0x5c0c4a,_0x35f60c,_0x1d9a('0x1f')),'level':_0x1d9a('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12cc94){return fileFormat(_0x35f60c,_0x12cc94);}}),new winston['transports'][(_0x1d9a('0x1d'))]({'name':util[_0x1d9a('0x10')](_0x1d9a('0x1e'),_0x35f60c,debugLevel),'filename':getLogFileName(_0x5c0c4a,_0x35f60c,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x254d22){return fileFormat(_0x35f60c,_0x254d22);}}),new winston['transports'][(_0x1d9a('0x1b'))]({'level':_0x1d9a('0x20'),'json':![],'formatter':function(_0x336bbe){return fileFormat(_0x35f60c,_0x336bbe);}})]});return _0x12c1ef;}exports['consoleLogger']=consoleLogger;exports[_0x1d9a('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ceff56c..a4f9bab 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x1a85,0x178));var _0x51a8=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0x1a85[_0x1aa13e];return _0x1144bd;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x451e52,_0x536a21){var _0x18a061=function(_0x122372){while(--_0x122372){_0x451e52['push'](_0x451e52['shift']());}};_0x18a061(++_0x536a21);}(_0x66fa,0x117));var _0xa66f=function(_0x217758,_0x16b285){_0x217758=_0x217758-0x0;var _0x37a035=_0x66fa[_0x217758];return _0x37a035;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 8815955..d766397 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2cbd8c,_0x4f5428){_0x2cbd8c=_0x2cbd8c-0x0;var _0xf554ad=_0xf4f4[_0x2cbd8c];return _0xf554ad;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0x34b7=['string','replace','isPlainObject','keys','reduce','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x101125,_0x2c5953){var _0x40f6b0=function(_0x58a6fc){while(--_0x58a6fc){_0x101125['push'](_0x101125['shift']());}};_0x40f6b0(++_0x2c5953);}(_0x34b7,0x196));var _0x734b=function(_0x1bffc9,_0x505bf0){_0x1bffc9=_0x1bffc9-0x0;var _0x26177e=_0x34b7[_0x1bffc9];return _0x26177e;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57123d){return _0x57123d==='{{'?_0x734b('0x0'):_0x734b('0x1');}function safeTemplate(_0x6e4318){var _0x354f96=_0x6e4318;if(typeof _0x6e4318===_0x734b('0x2')){_0x354f96=_0x6e4318[_0x734b('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x6e4318)){_0x354f96=_0x6e4318['map'](function(_0x303067){return safeTemplate(_0x303067);});}else if(_[_0x734b('0x4')](_0x6e4318)){_0x354f96=Object[_0x734b('0x5')](_0x6e4318)[_0x734b('0x6')](function(_0x28918a,_0x35d685){_0x28918a[_0x35d685]=safeTemplate(_0x6e4318[_0x35d685]);return _0x28918a;},{});}return _0x354f96;}module['exports'][_0x734b('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index a846fee..79ac437 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 _0x7283=['exports','../config/environment','root','server/app.json','resolve','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7283,0x16a));var _0x3728=function(_0x1b29aa,_0x4cb6a8){_0x1b29aa=_0x1b29aa-0x0;var _0x20b95d=_0x7283[_0x1b29aa];return _0x20b95d;};var fs=require('fs-extra');var path=require('path');var config=require(_0x3728('0x0'));var root=config[_0x3728('0x1')];var APP_JSON_PATH=path['resolve'](root,_0x3728('0x2'));var NODEPATH=path[_0x3728('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x3f76b8){let _0x2d390a=![];if(Array[_0x3728('0x4')](_0x3f76b8['apps'])){var _0x1a0204=_0x3f76b8[_0x3728('0x5')][_0x3728('0x6')](function(_0xd8c0d6){return _0xd8c0d6[_0x3728('0x7')]===_0x3728('0x8');});if(_0x1a0204>-0x1){var _0x2a637a=_0x3f76b8['apps'][_0x1a0204];if(typeof _0x2a637a[_0x3728('0x9')][_0x3728('0xa')]!==_0x3728('0xb')){_0x2a637a['env'][_0x3728('0xa')]=NODEPATH;_0x2d390a=!![];}}return{'appConfig':_0x3f76b8,'updated':_0x2d390a};}}function updateAppConfig(_0x172a7e){return fs[_0x3728('0xc')](APP_JSON_PATH)[_0x3728('0xd')](function(_0xf7a359){if(_0xf7a359){return fs[_0x3728('0xe')](APP_JSON_PATH)[_0x3728('0xd')](function(_0x19a98d){var _0x222291=setLegacyLibsNodeEnvPath(_0x19a98d);if(_0x222291[_0x3728('0xf')]){_0x172a7e['info'](_0x3728('0x10'));return fs[_0x3728('0x11')](APP_JSON_PATH,_0x19a98d,{'spaces':0x2});}else{return Promise[_0x3728('0x3')]();}});}else{return Promise[_0x3728('0x3')]();}});}module[_0x3728('0x12')]=updateAppConfig; \ No newline at end of file +var _0x7b24=['Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','findIndex','name','motion2','apps','env','NODE_PATH','string','pathExists','then','readJSON','info'];(function(_0x5cf93c,_0x2b5075){var _0x56aa24=function(_0x20b2ee){while(--_0x20b2ee){_0x5cf93c['push'](_0x5cf93c['shift']());}};_0x56aa24(++_0x2b5075);}(_0x7b24,0x137));var _0x47b2=function(_0x24990a,_0x2e136c){_0x24990a=_0x24990a-0x0;var _0xf47942=_0x7b24[_0x24990a];return _0xf47942;};var fs=require(_0x47b2('0x0'));var path=require(_0x47b2('0x1'));var config=require(_0x47b2('0x2'));var root=config[_0x47b2('0x3')];var APP_JSON_PATH=path[_0x47b2('0x4')](root,_0x47b2('0x5'));var NODEPATH=path[_0x47b2('0x4')](root,_0x47b2('0x6'));function setLegacyLibsNodeEnvPath(_0x41ab31){let _0x19933c=![];if(Array[_0x47b2('0x7')](_0x41ab31['apps'])){var _0x22dab2=_0x41ab31['apps'][_0x47b2('0x8')](function(_0x4e52cf){return _0x4e52cf[_0x47b2('0x9')]===_0x47b2('0xa');});if(_0x22dab2>-0x1){var _0x11eb92=_0x41ab31[_0x47b2('0xb')][_0x22dab2];if(typeof _0x11eb92[_0x47b2('0xc')][_0x47b2('0xd')]!==_0x47b2('0xe')){_0x11eb92[_0x47b2('0xc')][_0x47b2('0xd')]=NODEPATH;_0x19933c=!![];}}return{'appConfig':_0x41ab31,'updated':_0x19933c};}}function updateAppConfig(_0x22dcec){return fs[_0x47b2('0xf')](APP_JSON_PATH)[_0x47b2('0x10')](function(_0x5833db){if(_0x5833db){return fs[_0x47b2('0x11')](APP_JSON_PATH)[_0x47b2('0x10')](function(_0x47b061){var _0x19133c=setLegacyLibsNodeEnvPath(_0x47b061);if(_0x19133c['updated']){_0x22dcec[_0x47b2('0x12')](_0x47b2('0x13'));return fs[_0x47b2('0x14')](APP_JSON_PATH,_0x47b061,{'spaces':0x2});}else{return Promise[_0x47b2('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x47b2('0x15')]=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index 28d2a15..c06e349 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -26,4 +26,4 @@ status != 'online' && status != 'offline' && status != 'unmanaged' - " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file + " ng-click="vm.close(); $event.stopPropagation();">